Package com.mxgraph.swing

Examples of com.mxgraph.swing.mxGraphComponent


     */
    public void actionPerformed(ActionEvent e)
    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        mxConnectionHandler handler = graphComponent
            .getConnectionHandler();
        handler.setHandleEnabled(!handler.isHandleEnabled());
      }
    }
View Full Code Here


        /**
         *
         */
        public void actionPerformed(ActionEvent e)
        {
          mxGraphComponent graphComponent = editor
              .getGraphComponent();

          if (graphComponent != null)
          {
            mxConnectionHandler handler = graphComponent
                .getConnectionHandler();
            handler.setCreateTarget(!handler.isCreateTarget());
            setSelected(handler.isCreateTarget());
          }
        }
View Full Code Here

      }

      // Repaints the graph component
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        graphComponent.repaint();
      }
    }
View Full Code Here

     */
    public void actionPerformed(ActionEvent e)
    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        Component editorComponent = null;

        if (graphComponent.getCellEditor() instanceof mxCellEditor)
        {
          editorComponent = ((mxCellEditor) graphComponent
              .getCellEditor()).getEditor();
        }

        if (editorComponent instanceof JEditorPane)
        {
          JEditorPane editorPane = (JEditorPane) editorComponent;
          int start = editorPane.getSelectionStart();
          int ende = editorPane.getSelectionEnd();
          String text = editorPane.getSelectedText();

          if (text == null)
          {
            text = "";
          }

          try
          {
            HTMLEditorKit editorKit = new HTMLEditorKit();
            HTMLDocument document = (HTMLDocument) editorPane
                .getDocument();
            document.remove(start, (ende - start));
            editorKit.insertHTML(document, start, ((bold) ? "<b>"
                : "<i>") + text + ((bold) ? "</b>" : "</i>"),
                0, 0, (bold) ? HTML.Tag.B : HTML.Tag.I);
          }
          catch (Exception ex)
          {
            ex.printStackTrace();
          }

          editorPane.requestFocus();
          editorPane.select(start, ende);
        }
        else
        {
          mxIGraphModel model = graphComponent.getGraph().getModel();
          model.beginUpdate();
          try
          {
            graphComponent.stopEditing(false);
            graphComponent.getGraph().toggleCellStyleFlags(
                mxConstants.STYLE_FONTSTYLE,
                (bold) ? mxConstants.FONT_BOLD
                    : mxConstants.FONT_ITALIC);
          }
          finally
View Full Code Here

     */
    public void actionPerformed(ActionEvent e)
    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        Object[] cells = graphComponent.getGraph().getSelectionCells();

        if (cells != null && cells.length > 0)
        {
          String warning = JOptionPane.showInputDialog(mxResources
              .get("enterWarningMessage"));

          for (int i = 0; i < cells.length; i++)
          {
            graphComponent.setCellWarning(cells[i], warning);
          }
        }
        else
        {
          JOptionPane.showMessageDialog(graphComponent,
View Full Code Here

      /**
       *
       */
      public void actionPerformed(ActionEvent e)
      {
        mxGraphComponent graphComponent = editor.getGraphComponent();

        // Zoomcombo is changed when the scale is changed in the diagram
        // but the change is ignored here
        if (!ignoreZoomChange)
        {
          String zoom = zoomCombo.getSelectedItem().toString();

          if (zoom.equals(mxResources.get("page")))
          {
            graphComponent.setPageVisible(true);
            graphComponent
                .setZoomPolicy(mxGraphComponent.ZOOM_POLICY_PAGE);
          }
          else if (zoom.equals(mxResources.get("width")))
          {
            graphComponent.setPageVisible(true);
            graphComponent
                .setZoomPolicy(mxGraphComponent.ZOOM_POLICY_WIDTH);
          }
          else if (zoom.equals(mxResources.get("actualSize")))
          {
            graphComponent.zoomActual();
          }
          else
          {
            try
            {
              zoom = zoom.replace("%", "");
              double scale = Math.min(16, Math.max(0.01,
                  Double.parseDouble(zoom) / 100));
              graphComponent.zoomTo(scale, graphComponent
                  .isCenterZoom());
            }
            catch (Exception ex)
            {
              JOptionPane.showMessageDialog(editor, ex
View Full Code Here

        /**
         *
         */
        public void actionPerformed(ActionEvent e)
        {
          mxGraphComponent graphComponent = editor
              .getGraphComponent();

          if (graphComponent.getColumnHeader() != null)
          {
            graphComponent.setColumnHeader(null);
            graphComponent.setRowHeader(null);
          }
          else
          {
            graphComponent.setColumnHeaderView(new EditorRuler(
                graphComponent,
                EditorRuler.ORIENTATION_HORIZONTAL));
            graphComponent.setRowHeaderView(new EditorRuler(
                graphComponent,
                EditorRuler.ORIENTATION_VERTICAL));
          }
        }
      });
View Full Code Here

        /**
         *
         */
        public void actionPerformed(ActionEvent e)
        {
          mxGraphComponent graphComponent = editor
              .getGraphComponent();
          mxGraph graph = graphComponent.getGraph();
          boolean enabled = !graph.isGridEnabled();

          graph.setGridEnabled(enabled);
          graphComponent.setGridVisible(enabled);
          graphComponent.repaint();
          setSelected(enabled);
        }
      });
    }
View Full Code Here

     */
    public void actionPerformed(ActionEvent e)
    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        mxGraph graph = graphComponent.getGraph();
        mxCodec codec = new mxCodec();
        Document doc = mxUtils.loadDocument(EditorActions.class
            .getResource(stylesheet).toString());

        if (doc != null)
View Full Code Here

     */
    public void actionPerformed(ActionEvent e)
    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        graphComponent.setPageVisible(true);
        graphComponent.setZoomPolicy(zoomPolicy);
      }
    }
View Full Code Here

TOP

Related Classes of com.mxgraph.swing.mxGraphComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.