use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class EdgeStyleAction method setSelected.
@Override
public void setSelected() {
final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
final EdgeModel model = EdgeModel.getModel(node);
if (model != null) {
if (mStyle.equals(model.getStyle())) {
setSelected(true);
return;
}
}
setSelected(false);
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class EdgeWidthAction method setSelected.
@Override
public void setSelected() {
final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
final EdgeModel model = EdgeModel.getModel(node);
if (model == null) {
if (mWidth == EdgeModel.WIDTH_PARENT) {
setSelected(true);
return;
}
} else if (model.getWidth() == mWidth) {
setSelected(true);
return;
}
setSelected(false);
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class AddAttributeAction method actionPerformed.
public void actionPerformed(final ActionEvent arg0) {
final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
final int selection = UITools.showConfirmDialog(Controller.getCurrentController().getSelection().getSelected(), getPanel(), TextUtils.getText("attributes_AddAttributeAction.text"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
// OK button pressed
if (selection == JOptionPane.OK_OPTION) {
if (attributeNames.getSelectedItem() == null) {
UITools.showAttributeEmptyStringErrorMessage();
return;
}
final String name = attributeNames.getSelectedItem().toString();
if (name.equals("")) {
UITools.showAttributeEmptyStringErrorMessage();
return;
}
final Object valueSelectedItem = attributeValues.getSelectedItem();
final String value = valueSelectedItem != null ? valueSelectedItem.toString() : "";
// Add attributes to nodes
for (final NodeModel node : nodes) {
final NodeAttributeTableModel attributes = attrContr.createAttributeTableModel(node);
attrContr.performInsertRow(attributes, attributes.getRowCount(), name, value);
}
}
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class AttributeBuilder method endElement.
public void endElement(final Object parent, final String tag, final Object userObject, final XMLElement dom) {
/* attributes */
if (tag.equals(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_NAME)) {
final RegisteredAttributeProperties rap = (RegisteredAttributeProperties) userObject;
if (rap.visible) {
AttributeRegistry.getRegistry(getMap()).getElement(rap.attributeName).setVisibility(true);
}
if (rap.restricted) {
AttributeRegistry.getRegistry(getMap()).getElement(rap.attributeName).setRestriction(true);
}
if (rap.manual) {
AttributeRegistry.getRegistry(getMap()).getElement(rap.attributeName).setManual(true);
}
return;
}
if (tag.equals(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_VALUE)) {
final AttributeProperties ap = (AttributeProperties) userObject;
final RegisteredAttributeProperties rap = (RegisteredAttributeProperties) ap.parent;
final Attribute attribute = new Attribute(rap.attributeName, ap.getValue());
final AttributeRegistry r = AttributeRegistry.getRegistry(getMap());
r.registry(attribute);
}
if (parent instanceof NodeModel) {
final NodeModel node = (NodeModel) parent;
if (tag.equals(AttributeBuilder.XML_NODE_ATTRIBUTE)) {
final AttributeProperties ap = (AttributeProperties) userObject;
final Attribute attribute = new Attribute(ap.attributeName, ap.getValue());
attributeController.createAttributeTableModel(node);
final NodeAttributeTableModel model = NodeAttributeTableModel.getModel(node);
model.addRowNoUndo(attribute);
return;
}
return;
}
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class AttributeBuilder method registerBy.
/**
*/
public void registerBy(final ReadManager reader, final WriteManager writer) {
reader.addElementHandler("attribute_registry", this);
reader.addElementHandler(AttributeBuilder.XML_NODE_ATTRIBUTE, this);
reader.addElementHandler(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_NAME, this);
reader.addElementHandler(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_VALUE, this);
writer.addExtensionElementWriter(NodeAttributeTableModel.class, new IExtensionElementWriter() {
public void writeContent(final ITreeWriter writer, final Object node, final IExtension extension) throws IOException {
final NodeAttributeTableModel attributes = (NodeAttributeTableModel) extension;
save((NodeModel) node, attributes, writer);
}
});
writer.addExtensionElementWriter(AttributeRegistry.class, new IExtensionElementWriter() {
public void writeContent(final ITreeWriter writer, final Object node, final IExtension extension) throws IOException {
final AttributeRegistry attributes = (AttributeRegistry) extension;
attributes.write(writer);
}
});
registerAttributeHandlers(reader);
}
Aggregations