Merge pull request #275 from lvotypko/master

New extension point
This commit is contained in:
Nicolas De loof committed 2011-10-13 01:40:20 -07:00
commit 2b461b190c
3 files changed
+58

No files matched your search

@@ -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<ComputerPanelBox> getComputerPanelBoxs(){
return ComputerPanelBox.all(this);
}
/**
* Returns the transient {@link Action}s associated with the computer.
*/
@@ -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<ComputerPanelBox> all(Computer computer) {
List<ComputerPanelBox> boxs = new ArrayList<ComputerPanelBox>();
for(ComputerPanelBox box: Hudson.getInstance().getExtensionList(ComputerPanelBox.class)){
box.setComputer(computer);
boxs.add(box);
}
return boxs;
}
}