diff --git a/images/genj/tree/images/Expand.png b/images/genj/tree/images/Expand.png new file mode 100644 index 0000000..67191a6 Binary files /dev/null and b/images/genj/tree/images/Expand.png differ diff --git a/src/core/genj/tree/Images.java b/src/core/genj/tree/Images.java index fad38aa..82cbc23 100644 --- a/src/core/genj/tree/Images.java +++ b/src/core/genj/tree/Images.java @@ -35,7 +35,8 @@ final class Images { imgVert, imgDoFams, imgDontFams, - imgFoldSymbols; + imgFoldSymbols, + imgExpand; /** * Constructor which pre-loads all images @@ -53,6 +54,7 @@ final class Images { imgDontFams = new ImageIcon(this,"images/DontFams" ); imgFoldSymbols = new ImageIcon(this,"images/FoldUnfold" ); + imgExpand = new ImageIcon(this, "images/Expand"); } } //Images diff --git a/src/core/genj/tree/Model.java b/src/core/genj/tree/Model.java index deff3f3..b10b570 100644 --- a/src/core/genj/tree/Model.java +++ b/src/core/genj/tree/Model.java @@ -85,6 +85,11 @@ import java.util.concurrent.CopyOnWriteArrayList; /** whether we show toggles for un/folding */ private boolean isFoldSymbols = true; + + //OUR CODE///////////////////////////////////////////////////////////////////////////////////////////////// + private boolean isExpandAll = false; + + /** individuals whose ancestors we're not interested in */ private Set hideAncestors = new HashSet(); @@ -146,6 +151,26 @@ import java.util.concurrent.CopyOnWriteArrayList; return root; } + /** + * Accessor - expand all + **/ + public void setExpandAll(boolean set) { + if (isExpandAll==set) return; + isExpandAll = set; + if (set) + { + clearHiddenIDs(); + } + update(); + } + + /** + * Accessor - get isExpandAll + */ + public boolean isExpandAll() { + return isExpandAll; + } + /** * Accessor - wether we're vertical */ diff --git a/src/core/genj/tree/TreeView.java b/src/core/genj/tree/TreeView.java index 19b3969..b2330fc 100644 --- a/src/core/genj/tree/TreeView.java +++ b/src/core/genj/tree/TreeView.java @@ -466,6 +466,9 @@ public class TreeView extends View implements ContextProvider, ActionProvider { // gap toolbar.addSeparator(); + // expand all + toolbar.add(bh.create(new ActionExpandAll(), Images.imgExpand, model.isExpandAll())); + // vertical/horizontal toolbar.add(bh.create(new ActionOrientation(), Images.imgVert, model.isVertical())); @@ -1039,6 +1042,28 @@ public class TreeView extends View implements ContextProvider, ActionProvider { } } + + /** + * Action ExpandAll on/off + */ + private class ActionExpandAll extends Action2 { + /** + * Constructor + */ + private ActionExpandAll() { + super.setImage(Images.imgExpand); + //super.setTip(RESOURCES, "expandall.tip"); + } + /** + * @see genj.util.swing.Action2#execute() + */ + public void actionPerformed(ActionEvent event) { + model.setExpandAll(!model.isExpandAll()); + scrollToCurrent(); + } + }//ActionExpanding + + /** * Action - bookmark something