use of cl.utfsm.acs.types.ComplexObject in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method refreshNodesTree.
private void refreshNodesTree() {
DefaultTreeModel model = (DefaultTreeModel) nodesTree.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
root.removeAllChildren();
if (docSelected == null) {
model.reload();
return;
}
TreeMap<String, ComplexObject> nodes = docSelected.getNodes();
for (ComplexObject node : nodes.values()) {
root.add(new DefaultMutableTreeNode(node));
}
model.reload();
}
use of cl.utfsm.acs.types.ComplexObject in project ACS by ACS-Community.
the class EbeDocument method save.
/** Save the data to the selected path
* @throws IOException
* @throws FileNotFoundException */
public void save() throws FileNotFoundException, IOException {
Document docFile = new DocumentImpl();
Element typeElement = docFile.createElement(EbeDocument.getClassType().name);
fillAttributes(this, typeElement);
for (ComplexObject node : nodes.values()) {
Element nodeElement;
if (node instanceof Error)
nodeElement = docFile.createElement("ErrorCode");
else
nodeElement = docFile.createElement("Code");
fillAttributes(node, nodeElement);
if (node instanceof Error) {
Error err = (Error) node;
for (ComplexObject memb : err.getMembers().values()) {
Element membElement = docFile.createElement("Member");
fillAttributes(memb, membElement);
nodeElement.appendChild(membElement);
}
}
typeElement.appendChild(nodeElement);
}
docFile.appendChild(typeElement);
saveXmlDocument(docFile, getPath());
}
use of cl.utfsm.acs.types.ComplexObject in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method getNewCompletionMenuItem.
/**
* This method initializes jMenuItem1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getNewCompletionMenuItem() {
if (newCompletionMenuItem == null) {
newCompletionMenuItem = new JMenuItem();
newCompletionMenuItem.setText("Completion");
newCompletionMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (docSelected.getNode("NewCompletion") != null) {
log("\t[ATENTION: 'NewCompletion' is not allowed as a valid completion name, please change it before adding new errors]");
} else {
ComplexObject newObj = new Completion();
newObj.setValue("NewCompletion");
newObj.setAttributeValue("name", "NewCompletion");
docSelected.putNode(newObj);
complexSelected = newObj;
log("\t[New Completion Added ]");
}
refreshNodesTree();
refreshNodeAttributesTable();
}
});
}
return newCompletionMenuItem;
}
use of cl.utfsm.acs.types.ComplexObject in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method getNewErrorMenuItem.
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getNewErrorMenuItem() {
if (newErrorMenuItem == null) {
newErrorMenuItem = new JMenuItem();
newErrorMenuItem.setText("Error");
newErrorMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (docSelected.getNode("NewError") != null) {
log("\t[ATENTION: 'NewError' is not allowed as a valid error name, please change it before adding new errors]");
} else {
ComplexObject newObj = new Error();
newObj.setValue("NewError");
newObj.setAttributeValue("name", "NewError");
docSelected.putNode(newObj);
complexSelected = newObj;
log("\t[New Error Added ]");
}
refreshNodesTree();
refreshNodeAttributesTable();
}
});
}
return newErrorMenuItem;
}
Aggregations