diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index a5844ee7e4..ad6b805a9b 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -154,6 +154,13 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces setNode(node); } + /** + * Returns list of all boxes {@link ComputerPanelBox}s. + */ + public List getComputerPanelBoxs(){ + return ComputerPanelBox.all(this); + } + /** * Returns the transient {@link Action}s associated with the computer. */ diff --git a/core/src/main/java/hudson/model/ComputerPanelBox.java b/core/src/main/java/hudson/model/ComputerPanelBox.java new file mode 100644 index 0000000000..0f6af199cb --- /dev/null +++ b/core/src/main/java/hudson/model/ComputerPanelBox.java @@ -0,0 +1,48 @@ +package hudson.model; + +import hudson.ExtensionPoint; +import java.util.ArrayList; +import java.util.List; + +/** + * Adds box rendered in the computer side panel. + * + * Add box.jelly to display box + * + * @author Lucie Votypkova + * @since 1.434 + * @see jenkins.model.Computer#getComputerPanelBoxs() + */ + +public abstract class ComputerPanelBox implements ExtensionPoint{ + + private Computer computer; + + + public void setComputer(Computer computer){ + this.computer = computer; + } + + public Computer getComputer(){ + return computer; + } + + /** + * Create boxes for the given computer in its page. + * + * @param computer + * The computer for which displays the boxes. Never null. + * @return + * List of all the registered {@link ComputerPanelBox}s. + */ + public static List all(Computer computer) { + List boxs = new ArrayList(); + for(ComputerPanelBox box: Hudson.getInstance().getExtensionList(ComputerPanelBox.class)){ + box.setComputer(computer); + boxs.add(box); + } + return boxs; + } + + +} diff --git a/core/src/main/resources/hudson/model/Computer/sidepanel.jelly b/core/src/main/resources/hudson/model/Computer/sidepanel.jelly index e5e3c84af3..5dc2829913 100644 --- a/core/src/main/resources/hudson/model/Computer/sidepanel.jelly +++ b/core/src/main/resources/hudson/model/Computer/sidepanel.jelly @@ -40,6 +40,9 @@ THE SOFTWARE. + + + \ No newline at end of file