made Expand image
made isExpandAll getter setter in Model TreeView.ActionExpandAll class populate toolbar expand button addedmaster
parent
cd7d88b7ec
commit
7ec846a567
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -35,7 +35,8 @@ final class Images {
|
||||||
imgVert,
|
imgVert,
|
||||||
imgDoFams,
|
imgDoFams,
|
||||||
imgDontFams,
|
imgDontFams,
|
||||||
imgFoldSymbols;
|
imgFoldSymbols,
|
||||||
|
imgExpand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor which pre-loads all images
|
* Constructor which pre-loads all images
|
||||||
|
@ -53,6 +54,7 @@ final class Images {
|
||||||
imgDontFams = new ImageIcon(this,"images/DontFams" );
|
imgDontFams = new ImageIcon(this,"images/DontFams" );
|
||||||
|
|
||||||
imgFoldSymbols = new ImageIcon(this,"images/FoldUnfold" );
|
imgFoldSymbols = new ImageIcon(this,"images/FoldUnfold" );
|
||||||
|
imgExpand = new ImageIcon(this, "images/Expand");
|
||||||
}
|
}
|
||||||
|
|
||||||
} //Images
|
} //Images
|
||||||
|
|
|
@ -85,6 +85,11 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
/** whether we show toggles for un/folding */
|
/** whether we show toggles for un/folding */
|
||||||
private boolean isFoldSymbols = true;
|
private boolean isFoldSymbols = true;
|
||||||
|
|
||||||
|
|
||||||
|
//OUR CODE/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
private boolean isExpandAll = false;
|
||||||
|
|
||||||
|
|
||||||
/** individuals whose ancestors we're not interested in */
|
/** individuals whose ancestors we're not interested in */
|
||||||
private Set<String> hideAncestors = new HashSet<String>();
|
private Set<String> hideAncestors = new HashSet<String>();
|
||||||
|
|
||||||
|
@ -146,6 +151,26 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
return root;
|
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
|
* Accessor - wether we're vertical
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -466,6 +466,9 @@ public class TreeView extends View implements ContextProvider, ActionProvider {
|
||||||
// gap
|
// gap
|
||||||
toolbar.addSeparator();
|
toolbar.addSeparator();
|
||||||
|
|
||||||
|
// expand all
|
||||||
|
toolbar.add(bh.create(new ActionExpandAll(), Images.imgExpand, model.isExpandAll()));
|
||||||
|
|
||||||
// vertical/horizontal
|
// vertical/horizontal
|
||||||
toolbar.add(bh.create(new ActionOrientation(), Images.imgVert, model.isVertical()));
|
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
|
* Action - bookmark something
|
||||||
|
|
Loading…
Reference in New Issue