use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class WorkspaceRootNode method getChildAt.
public AWorkspaceTreeNode getChildAt(int childIndex) {
AWorkspaceTreeNode node = null;
int offset = super.getChildCount();
if (offset > 0) {
node = super.getChildAt(childIndex);
}
if (node == null) {
node = (AWorkspaceTreeNode) WorkspaceController.getCurrentModel().getChild(this, childIndex);
}
return node;
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class ProjectModel method valueForPathChanged.
public void valueForPathChanged(TreePath path, Object newValue) {
AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
if (node instanceof IWorkspaceNodeActionListener) {
((IWorkspaceNodeActionListener) node).handleAction(new WorkspaceActionEvent(node, WorkspaceActionEvent.WSNODE_CHANGED, newValue));
nodeChanged(node);
} else {
node.setName(newValue.toString());
}
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class ProjectModel method nodeChanged.
public void nodeChanged(AWorkspaceTreeNode node) {
if (listenerList != null && node != null) {
AWorkspaceTreeNode parent = node.getParent();
if (parent != null) {
int anIndex = parent.getIndex(node);
if (anIndex != -1) {
int[] cIndexs = new int[1];
cIndexs[0] = anIndex;
nodesChanged(parent, cIndexs);
}
} else if (node == getRoot()) {
nodesChanged(node, null);
}
}
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class ProjectModel method addIndexOnlyRecursively.
private void addIndexOnlyRecursively(AWorkspaceTreeNode node) {
this.hashStringKeyIndex.put(node.getKey(), node);
if (node.getChildCount() > 0) {
for (int i = 0; i < node.getChildCount(); i++) {
AWorkspaceTreeNode childNode = node.getChildAt(i);
addIndexOnlyRecursively(childNode);
}
}
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class ProjectModel method addToIndexRecursively.
private void addToIndexRecursively(AWorkspaceTreeNode node, AWorkspaceTreeNode targetNode) {
this.hashStringKeyIndex.put(node.getKey(), node);
if (node.getChildCount() > 0) {
int[] indices = new int[node.getChildCount()];
for (int i = 0; i < node.getChildCount(); i++) {
AWorkspaceTreeNode childNode = node.getChildAt(i);
addToIndexRecursively(childNode, node);
indices[i] = targetNode.getChildCount() - 1;
}
nodesWereInserted(targetNode, indices);
}
}
Aggregations