示例#1
0
 private void addStyleBox(final DefaultFormBuilder rightBuilder) {
   mStyleBox = uiFactory.createStyleBox();
   mSetStyle = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   final StyleChangeListener listener = new StyleChangeListener();
   mSetStyle.addPropertyChangeListener(listener);
   mSetStyle.layout(rightBuilder);
   rightBuilder.append(new JLabel(TextUtils.getText("style")));
   rightBuilder.append(mStyleBox);
   rightBuilder.nextLine();
 }
示例#2
0
 private void addFontBoldControl(final List<IPropertyControl> controls) {
   mSetNodeFontBold = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeFontBold);
   mNodeFontBold = new BooleanProperty(StyleEditorPanel.NODE_FONT_BOLD);
   controls.add(mNodeFontBold);
   final FontBoldChangeListener listener =
       new FontBoldChangeListener(mSetNodeFontBold, mNodeFontBold);
   mSetNodeFontBold.addPropertyChangeListener(listener);
   mNodeFontBold.addPropertyChangeListener(listener);
   mNodeFontBold.fireOnMouseClick();
 }
示例#3
0
 private void addFontItalicControl(final List<IPropertyControl> controls) {
   mSetNodeFontItalic = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeFontItalic);
   mNodeFontItalic = new BooleanProperty(StyleEditorPanel.NODE_FONT_ITALIC);
   controls.add(mNodeFontItalic);
   final FontItalicChangeListener listener =
       new FontItalicChangeListener(mSetNodeFontItalic, mNodeFontItalic);
   mSetNodeFontItalic.addPropertyChangeListener(listener);
   mNodeFontItalic.addPropertyChangeListener(listener);
   mNodeFontItalic.fireOnMouseClick();
 }
示例#4
0
 private void addFontHyperlinkControl(final List<IPropertyControl> controls) {
   mSetNodeFontHyperlink = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeFontHyperlink);
   mNodeFontHyperlink = new BooleanProperty(StyleEditorPanel.NODE_FONT_HYPERLINK);
   controls.add(mNodeFontHyperlink);
   final FontHyperlinkChangeListener listener =
       new FontHyperlinkChangeListener(mSetNodeFontHyperlink, mNodeFontHyperlink);
   mSetNodeFontHyperlink.addPropertyChangeListener(listener);
   mNodeFontHyperlink.addPropertyChangeListener(listener);
   mNodeFontHyperlink.fireOnMouseClick();
 }
示例#5
0
 private void addNodeNumberingControl(final List<IPropertyControl> controls) {
   mSetNodeNumbering = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeNumbering);
   mNodeNumbering = new BooleanProperty(StyleEditorPanel.NODE_NUMBERING);
   controls.add(mNodeNumbering);
   final NodeNumberingChangeListener listener =
       new NodeNumberingChangeListener(mSetNodeNumbering, mNodeNumbering);
   mSetNodeNumbering.addPropertyChangeListener(listener);
   mNodeNumbering.addPropertyChangeListener(listener);
   mNodeNumbering.fireOnMouseClick();
 }
示例#6
0
 public void propertyChange(PropertyChangeEvent evt) {
   if (internalChange) {
     return;
   }
   BooleanProperty isSet = (BooleanProperty) evt.getSource();
   final MLogicalStyleController styleController =
       (MLogicalStyleController) LogicalStyleController.getController();
   if (isSet.getBooleanValue()) {
     styleController.setStyle((IStyle) uiFactory.getStyles().getSelectedItem());
   } else {
     styleController.setStyle(null);
   }
 }
示例#7
0
 private void addCloudShapeControl(final List<IPropertyControl> controls) {
   mCloudShape = new ComboProperty(StyleEditorPanel.CLOUD_SHAPE, CLOUD_SHAPES);
   controls.add(mCloudShape);
   final CloudShapeChangeListener listener = new CloudShapeChangeListener(mSetCloud, mCloudShape);
   mSetCloud.addPropertyChangeListener(listener);
   mCloudShape.addPropertyChangeListener(listener);
   mCloudShape.fireOnMouseClick();
 }
示例#8
0
 private void addEdgeStyleControl(final List<IPropertyControl> controls) {
   mSetEdgeStyle = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetEdgeStyle);
   mEdgeStyle = new ComboProperty(StyleEditorPanel.EDGE_STYLE, EDGE_STYLES);
   controls.add(mEdgeStyle);
   final EdgeStyleChangeListener listener = new EdgeStyleChangeListener(mSetEdgeStyle, mEdgeStyle);
   mSetEdgeStyle.addPropertyChangeListener(listener);
   mEdgeStyle.addPropertyChangeListener(listener);
   mEdgeStyle.fireOnMouseClick();
 }
示例#9
0
 private void addEdgeWidthControl(final List<IPropertyControl> controls) {
   mSetEdgeWidth = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetEdgeWidth);
   mEdgeWidth = new NumberProperty(StyleEditorPanel.EDGE_WIDTH, 0, 100, 1);
   controls.add(mEdgeWidth);
   final EdgeWidthChangeListener listener = new EdgeWidthChangeListener(mSetEdgeWidth, mEdgeWidth);
   mSetEdgeWidth.addPropertyChangeListener(listener);
   mEdgeWidth.addPropertyChangeListener(listener);
   mEdgeWidth.fireOnMouseClick();
 }
示例#10
0
 private void addFontNameControl(final List<IPropertyControl> controls) {
   mSetNodeFontName = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeFontName);
   mNodeFontName = new FontProperty(StyleEditorPanel.NODE_FONT_NAME);
   controls.add(mNodeFontName);
   final FontNameChangeListener listener =
       new FontNameChangeListener(mSetNodeFontName, mNodeFontName);
   mSetNodeFontName.addPropertyChangeListener(listener);
   mNodeFontName.addPropertyChangeListener(listener);
   mNodeFontName.fireOnMouseClick();
 }
示例#11
0
 private void addMinNodeWidthControl(final List<IPropertyControl> controls) {
   mSetMinNodeWidth = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetMinNodeWidth);
   mMinNodeWidth = new NumberProperty(StyleEditorPanel.MIN_NODE_WIDTH, 1, Integer.MAX_VALUE, 1);
   controls.add(mMinNodeWidth);
   final MinNodeWidthChangeListener listener =
       new MinNodeWidthChangeListener(mSetMinNodeWidth, mMinNodeWidth);
   mSetMinNodeWidth.addPropertyChangeListener(listener);
   mMinNodeWidth.addPropertyChangeListener(listener);
   mMinNodeWidth.fireOnMouseClick();
 }
示例#12
0
 private void addNodeShapeControl(final List<IPropertyControl> controls) {
   mSetNodeShape = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeShape);
   mNodeShape =
       new ComboProperty(
           StyleEditorPanel.NODE_SHAPE, new String[] {"fork", "bubble", "as_parent", "combined"});
   controls.add(mNodeShape);
   final NodeShapeChangeListener listener = new NodeShapeChangeListener(mSetNodeShape, mNodeShape);
   mSetNodeShape.addPropertyChangeListener(listener);
   mNodeShape.addPropertyChangeListener(listener);
   mNodeShape.fireOnMouseClick();
 }
示例#13
0
 public void propertyChange(final PropertyChangeEvent evt) {
   if (internalChange) {
     return;
   }
   final boolean enabled;
   if (evt.getSource().equals(mSet)) {
     enabled = mSet.getBooleanValue();
   } else {
     assert evt.getSource().equals(mProperty);
     enabled = true;
     mSet.setValue(true);
   }
   final IMapSelection selection = Controller.getCurrentController().getSelection();
   final Collection<NodeModel> nodes = selection.getSelection();
   if (enabled) internalChange = true;
   for (final NodeModel node : nodes) {
     applyValue(enabled, node, evt);
   }
   internalChange = false;
   setStyle(selection.getSelected());
 }
示例#14
0
 private void addFontSizeControl(final List<IPropertyControl> controls) {
   mSetNodeFontSize = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeFontSize);
   final List<String> sizesVector = new ArrayList<String>(Arrays.asList(MUIFactory.FONT_SIZES));
   mNodeFontSize = new ComboProperty(StyleEditorPanel.NODE_FONT_SIZE, sizesVector, sizesVector);
   mNodeFontSize.setEditable(true);
   controls.add(mNodeFontSize);
   final FontSizeChangeListener listener =
       new FontSizeChangeListener(mSetNodeFontSize, mNodeFontSize);
   mSetNodeFontSize.addPropertyChangeListener(listener);
   mNodeFontSize.addPropertyChangeListener(listener);
   mNodeFontSize.fireOnMouseClick();
 }
示例#15
0
 private void addColorControl(final List<IPropertyControl> controls) {
   mSetNodeColor = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeColor);
   mNodeColor =
       new ColorProperty(
           StyleEditorPanel.NODE_COLOR,
           ResourceController.getResourceController().getDefaultProperty(NODE_TEXT_COLOR));
   controls.add(mNodeColor);
   final ColorChangeListener listener = new ColorChangeListener(mSetNodeColor, mNodeColor);
   mSetNodeColor.addPropertyChangeListener(listener);
   mNodeColor.addPropertyChangeListener(listener);
   mNodeColor.fireOnMouseClick();
 }
示例#16
0
 private void addEdgeColorControl(final List<IPropertyControl> controls) {
   mSetEdgeColor = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetEdgeColor);
   mEdgeColor =
       new ColorProperty(
           StyleEditorPanel.EDGE_COLOR,
           ColorUtils.colorToString(EdgeController.STANDARD_EDGE_COLOR));
   controls.add(mEdgeColor);
   final EdgeColorChangeListener listener = new EdgeColorChangeListener(mSetEdgeColor, mEdgeColor);
   mSetEdgeColor.addPropertyChangeListener(listener);
   mEdgeColor.addPropertyChangeListener(listener);
   mEdgeColor.fireOnMouseClick();
 }
示例#17
0
 private void addCloudColorControl(final List<IPropertyControl> controls) {
   mSetCloud = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetCloud);
   mCloudColor =
       new ColorProperty(
           StyleEditorPanel.CLOUD_COLOR,
           ResourceController.getResourceController()
               .getDefaultProperty(CloudController.RESOURCES_CLOUD_COLOR));
   controls.add(mCloudColor);
   final CloudColorChangeListener listener = new CloudColorChangeListener(mSetCloud, mCloudColor);
   mSetCloud.addPropertyChangeListener(listener);
   mCloudColor.addPropertyChangeListener(listener);
   mCloudColor.fireOnMouseClick();
 }
示例#18
0
 private void addFormatControl(final List<IPropertyControl> controls) {
   mSetNodeFormat = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetNodeFormat);
   mNodeFormat =
       new EditablePatternComboProperty(
           StyleEditorPanel.NODE_FORMAT,
           PatternFormat.getIdentityPatternFormat(),
           FormatController.getController().getAllFormats());
   controls.add(mNodeFormat);
   final NodeFormatChangeListener listener =
       new NodeFormatChangeListener(mSetNodeFormat, mNodeFormat);
   mSetNodeFormat.addPropertyChangeListener(listener);
   mNodeFormat.addPropertyChangeListener(listener);
   mNodeFormat.fireOnMouseClick();
 }
示例#19
0
  public void setStyle(final NodeModel node) {
    if (internalChange) {
      return;
    }
    internalChange = true;
    try {
      final LogicalStyleController logicalStyleController = LogicalStyleController.getController();
      if (addStyleBox) {
        final boolean isStyleSet = LogicalStyleModel.getStyle(node) != null;
        mSetStyle.setValue(isStyleSet);
        setStyleList(mMapStyleButton, logicalStyleController.getMapStyleNames(node, "\n"));
      }
      setStyleList(mNodeStyleButton, logicalStyleController.getNodeStyleNames(node, "\n"));
      final NodeStyleController styleController = NodeStyleController.getController();
      {
        final Color nodeColor = NodeStyleModel.getColor(node);
        final Color viewNodeColor = styleController.getColor(node);
        mSetNodeColor.setValue(nodeColor != null);
        mNodeColor.setColorValue(viewNodeColor);
      }
      {
        final Color color = NodeStyleModel.getBackgroundColor(node);
        final Color viewColor = styleController.getBackgroundColor(node);
        mSetNodeBackgroundColor.setValue(color != null);
        mNodeBackgroundColor.setColorValue(
            viewColor != null
                ? viewColor
                : Controller.getCurrentController().getMapViewManager().getBackgroundColor(node));
      }
      {
        final String shape = NodeStyleModel.getShape(node);
        final String viewShape = styleController.getShape(node);
        mSetNodeShape.setValue(shape != null);
        mNodeShape.setValue(viewShape);
      }
      final NodeSizeModel nodeSizeModel = NodeSizeModel.getModel(node);
      {
        final int width =
            nodeSizeModel != null ? nodeSizeModel.getMaxNodeWidth() : NodeSizeModel.NOT_SET;
        final int viewWidth = styleController.getMaxWidth(node);
        mSetMaxNodeWidth.setValue(width != NodeSizeModel.NOT_SET);
        mMaxNodeWidth.setValue(Integer.toString(viewWidth));
      }
      {
        final int width =
            nodeSizeModel != null ? nodeSizeModel.getMinNodeWidth() : NodeSizeModel.NOT_SET;
        final int viewWidth = styleController.getMinWidth(node);
        mSetMinNodeWidth.setValue(width != NodeSizeModel.NOT_SET);
        mMinNodeWidth.setValue(Integer.toString(viewWidth));
      }
      final EdgeController edgeController = EdgeController.getController();
      final EdgeModel edgeModel = EdgeModel.getModel(node);
      {
        final Color edgeColor = edgeModel != null ? edgeModel.getColor() : null;
        final Color viewColor = edgeController.getColor(node);
        mSetEdgeColor.setValue(edgeColor != null);
        mEdgeColor.setColorValue(viewColor);
      }
      {
        final EdgeStyle style = edgeModel != null ? edgeModel.getStyle() : null;
        final EdgeStyle viewStyle = edgeController.getStyle(node);
        mSetEdgeStyle.setValue(style != null);
        mEdgeStyle.setValue(viewStyle.toString());
      }
      {
        final int width = edgeModel != null ? edgeModel.getWidth() : EdgeModel.DEFAULT_WIDTH;
        final int viewWidth = edgeController.getWidth(node);
        mSetEdgeWidth.setValue(width != EdgeModel.DEFAULT_WIDTH);
        mEdgeWidth.setValue(Integer.toString(viewWidth));
      }
      {
        final CloudController cloudController = CloudController.getController();
        final CloudModel cloudModel = CloudModel.getModel(node);
        final Color viewCloudColor = cloudController.getColor(node);
        mSetCloud.setValue(cloudModel != null);
        mCloudColor.setColorValue(viewCloudColor);

        final CloudModel.Shape viewCloudShape = cloudController.getShape(node);
        mCloudShape.setValue(
            viewCloudShape != null ? viewCloudShape.toString() : CloudModel.Shape.ARC.toString());
      }
      {
        final String fontFamilyName = NodeStyleModel.getFontFamilyName(node);
        final String viewFontFamilyName = styleController.getFontFamilyName(node);
        mSetNodeFontName.setValue(fontFamilyName != null);
        mNodeFontName.setValue(viewFontFamilyName);
      }
      {
        final Integer fontSize = NodeStyleModel.getFontSize(node);
        final Integer viewfontSize = styleController.getFontSize(node);
        mSetNodeFontSize.setValue(fontSize != null);
        mNodeFontSize.setValue(viewfontSize.toString());
      }
      {
        final Boolean bold = NodeStyleModel.isBold(node);
        final Boolean viewbold = styleController.isBold(node);
        mSetNodeFontBold.setValue(bold != null);
        mNodeFontBold.setValue(viewbold);
      }
      {
        final Boolean italic = NodeStyleModel.isItalic(node);
        final Boolean viewitalic = styleController.isItalic(node);
        mSetNodeFontItalic.setValue(italic != null);
        mNodeFontItalic.setValue(viewitalic);
      }
      {
        final Boolean hyperlink = NodeLinks.formatNodeAsHyperlink(node);
        final Boolean viewhyperlink = LinkController.getController().formatNodeAsHyperlink(node);
        mSetNodeFontHyperlink.setValue(hyperlink != null);
        mNodeFontHyperlink.setValue(viewhyperlink);
      }
      {
        final Boolean nodeNumbering = NodeStyleModel.getNodeNumbering(node);
        final Boolean viewNodeNumbering = styleController.getNodeNumbering(node);
        mSetNodeNumbering.setValue(nodeNumbering != null);
        mNodeNumbering.setValue(viewNodeNumbering);
      }
      {
        String nodeFormat = NodeStyleModel.getNodeFormat(node);
        String viewNodeFormat = TextController.getController().getNodeFormat(node);
        mSetNodeFormat.setValue(nodeFormat != null);
        if (viewNodeFormat == null && node.getUserObject() instanceof IFormattedObject)
          viewNodeFormat = ((IFormattedObject) node.getUserObject()).getPattern();
        mNodeFormat.setValue(viewNodeFormat);
      }
      if (mAutomaticLayoutComboBox != null) {
        final ModeController modeController = Controller.getCurrentModeController();
        AutomaticLayoutController al = modeController.getExtension(AutomaticLayoutController.class);
        IExtension extension = al.getExtension(node);
        if (extension == null) mAutomaticLayoutComboBox.setSelectedItem(AUTOMATIC_LAYOUT_DISABLED);
        else mAutomaticLayoutComboBox.setSelectedIndex(((AutomaticLayout) extension).ordinal());
      }
      if (mAutomaticEdgeColorCheckBox != null) {
        final ModeController modeController = Controller.getCurrentModeController();
        AutomaticEdgeColorHook al =
            (AutomaticEdgeColorHook) modeController.getExtension(AutomaticEdgeColorHook.class);
        mAutomaticEdgeColorCheckBox.setSelected(al.isActive(node));
      }
    } finally {
      internalChange = false;
    }
  }