use of org.sirix.gui.view.VisualItemAxis in project sirix by sirixdb.
the class TreeView method refreshUpdate.
@Override
public void refreshUpdate(final Optional<VisualItemAxis> pAxis) {
// Use our sirix model and renderer.
dispose();
final ReadDB db = mGUI.getReadDB();
mTree.setModel(new TreeModel(db));
mTree.setCellRenderer(new TreeCellRenderer(db));
if (mTree.getTreeSelectionListeners().length == 0) {
// Listen for when the selection changes.
mTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(final TreeSelectionEvent paramE) {
if (paramE.getNewLeadSelectionPath() != null && paramE.getNewLeadSelectionPath() != paramE.getOldLeadSelectionPath()) {
/*
* Returns the last path element of the selection. This method is
* useful only when the selection model allows a single selection.
*/
final Node node = (Node) paramE.getNewLeadSelectionPath().getLastPathComponent();
db.setKey(node.getNodeKey());
mNotifier.update(mView, Optional.<VisualItemAxis>absent());
}
}
});
}
}
use of org.sirix.gui.view.VisualItemAxis in project sirix by sirixdb.
the class SunburstControl method notifyChanges.
/**
* Notify other views of changes.
*
* @param pItems
* the new item list
*/
private void notifyChanges(final List<SunburstItem> pItems) {
assert pItems != null;
final SunburstView view = (SunburstView) ((Embedded) mSunburstGUI.mParent).getView();
final ViewNotifier notifier = view.getNotifier();
if (mModel instanceof SunburstModel) {
notifier.update(view, Optional.<VisualItemAxis>absent());
} else if (mModel instanceof SunburstCompareModel) {
notifier.update(view, Optional.of(new VisualItemAxis(pItems)));
}
}
Aggregations