package org.jenkinsci.plugins.systemmessage;

import org.kohsuke.stapler.DataBoundConstructor;

import hudson.Extension;
import hudson.model.PageDecorator;

@Extension
public class SystemMessagePanelPageDecorator extends PageDecorator {
	/* persisted attributes */
	
	private String headingText;

	
	/* transient attributes */
	// none
	
	public SystemMessagePanelPageDecorator() {
		super();
		
		this.load();
		SystemMessagePanelManager.getInstance().add(this);
	}

	@DataBoundConstructor
	public SystemMessagePanelPageDecorator(String headingText) {
		super();
		this.headingText = headingText;
	}

	@Override
	public String getDisplayName() {
		return "System Message (Panel) Plugin";
	}
	
	/* decoration takes places via the header.jelly/footer.jelly files 
	 * in the resource folder
	 */

	public String getHeadingText() {
		return headingText;
	}

	public void setHeadingText(String headingText) {
		this.headingText = headingText;
	}
	
}

@@ -90,16 +90,60 @@
 ructor;%0D
+%0Aimport org.kohsuke.stapler.StaplerRequest;%0D
 %0A%0D%0Aimpor
@@ -198,16 +198,95 @@
 orator;%0D
+%0Aimport hudson.model.Descriptor.FormException;%0D%0Aimport net.sf.json.JSONObject;%0D
 %0A%0D%0A@Exte
@@ -841,24 +841,30 @@
 n%22;%0D%0A%09%7D%0D%0A%09%0D%0A
+%09%0D%0A%09%0D%0A
 %09/* decorati
@@ -953,24 +953,298 @@
 er%0D%0A%09 */%0D%0A%0D%0A
+%09@Override%0D%0A%09public boolean configure(StaplerRequest req, JSONObject json) throws FormException %7B%0D%0A%09%09boolean b = super.configure(req, json);%0D%0A%09%09%0D%0A%09%09req.bindJSON(this, json);%0D%0A%09%09%0D%0A%09%09this.save();%0D%0A%09%09SystemMessagePanelManager.getInstance().reloadAll();%0D%0A%09%09%0D%0A%09%09return b;%0D%0A%09%7D%0D%0A%0D%0A
 %09public Stri
@@ -1381,18 +1381,21 @@
 gText;%0D%0A
-
 %09%7D%0D%0A%09%0D%0A
+%09%0D%0A
 %7D%0D%0A

Fix save issue on configuration change