actions [ACTION_INDEX_ADD] = new JaspiraAction(resourceCollection, "propertybrowser.addelement")
{
public void actionPerformed(ActionEvent ae)
{
// Add a new node to the collection
final AbstractNode newPos = addNewNode();
if (newPos != null)
{
// Set the focus to the edit column of the next row (usually the 'name' field of the new node)
// Adding a new node caused a model change, so select after all model change events have been processed.
// (Don't ask, it works...)
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
selectNode(newPos, 1, 1);
}
});
}
});
}
}
};
actions [ACTION_INDEX_COPY] = new JaspiraAction(resourceCollection, "propertybrowser.copyelement")
{
public void actionPerformed(ActionEvent ae)
{
// Copy the node contents to the clipboard
copyNode();
// We have copied something, make sure the paste action reflects this.
updateActionState();
}
};
actions [ACTION_INDEX_CUT] = new JaspiraAction(resourceCollection, "propertybrowser.cutelement")
{
public void actionPerformed(ActionEvent ae)
{
// Copy the node contents to the clipboard
copyNode();
// Remove the node from the collection
AbstractNode newPos = removeNode();
if (newPos != null)
{
// Set the focus to the edit column of the next row (usually the 'name' field of the new node)
selectNode(newPos, 0, 0);
}
// We have copied something, make sure the paste action reflects this.
updateActionState();
}
};
actions [ACTION_INDEX_PASTE] = new JaspiraAction(resourceCollection, "propertybrowser.pasteelement")
{
public void actionPerformed(ActionEvent ae)
{
// Paste an element from the clipboard to a new node of the collection
final AbstractNode newPos = pasteNode();
if (newPos != null)
{
// Set the focus to the edit column of the next row (usually the 'name' field of the new node)
// Adding a new node caused a model change, so select after all model change events have been processed.
// (Don't ask, it works...)
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
selectNode(newPos, 1, 1);
}
});
}
});
}
}
};
actions [ACTION_INDEX_REMOVE] = new JaspiraAction(resourceCollection, "propertybrowser.removeelement")
{
public void actionPerformed(ActionEvent ae)
{
// Remove the node from the collection
AbstractNode newPos = removeNode();
if (newPos != null)
{
// Set the focus to the edit column of the next row (usually the 'name' field of the new node)
selectNode(newPos, 0, 0);
}