Ejemplo n.º 1
0
  public XMLElement save() {
    XMLElement arrowLink = new XMLElement();
    arrowLink.setName("arrowlink");

    if (style != null) {
      arrowLink.setAttribute("STYLE", style);
    }
    if (getUniqueID() != null) {
      arrowLink.setAttribute("ID", getUniqueID());
    }
    if (color != null) {
      arrowLink.setAttribute("COLOR", Tools.colorToXml(color));
    }
    if (getDestinationLabel() != null) {
      arrowLink.setAttribute("DESTINATION", getDestinationLabel());
    }
    if (getReferenceText() != null) {
      arrowLink.setAttribute("REFERENCETEXT", getReferenceText());
    }
    if (getStartInclination() != null) {
      arrowLink.setAttribute("STARTINCLINATION", Tools.PointToXml(getStartInclination()));
    }
    if (getEndInclination() != null) {
      arrowLink.setAttribute("ENDINCLINATION", Tools.PointToXml(getEndInclination()));
    }
    if (getStartArrow() != null) arrowLink.setAttribute("STARTARROW", (getStartArrow()));
    if (getEndArrow() != null) arrowLink.setAttribute("ENDARROW", (getEndArrow()));
    return arrowLink;
  }
Ejemplo n.º 2
0
 /* (non-Javadoc)
  * @see freemind.modes.MindMapEdge#getStyleAsInt()
  */
 public int getStyleAsInt() {
   final String edgeStyle = getStyle();
   if (Tools.safeEquals(edgeStyle, EDGESTYLE_LINEAR)) {
     return INT_EDGESTYLE_LINEAR;
   } else if (Tools.safeEquals(edgeStyle, EDGESTYLE_BEZIER)) {
     return INT_EDGESTYLE_BEZIER;
   } else if (Tools.safeEquals(edgeStyle, EDGESTYLE_SHARP_LINEAR)) {
     return INT_EDGESTYLE_SHARP_LINEAR;
   } else if (Tools.safeEquals(edgeStyle, EDGESTYLE_SHARP_BEZIER)) {
     return INT_EDGESTYLE_SHARP_BEZIER;
   } else {
     throw new IllegalArgumentException("Unknown Edge Style " + edgeStyle);
   }
 }
Ejemplo n.º 3
0
 public void propertyChanged(String propertyName, String newValue, String oldValue) {
   if (propertyName.equals(FreeMind.RESOURCES_EDGE_COLOR)) {
     EdgeAdapter.standardColor = Tools.xmlToColor(newValue);
   }
   if (propertyName.equals(FreeMind.RESOURCES_EDGE_STYLE)) {
     EdgeAdapter.standardStyle = newValue;
   }
 }
Ejemplo n.º 4
0
 private boolean acquirePrinterJobAndPageFormat() {
   if (printerJob == null) {
     try {
       printerJob = PrinterJob.getPrinterJob();
     } catch (SecurityException ex) {
       isPrintingAllowed = false;
       return false;
     }
   }
   if (pageFormat == null) {
     pageFormat = printerJob.defaultPage();
     if (Tools.safeEquals(getProperty("page_orientation"), "landscape")) {
       pageFormat.setOrientation(PageFormat.LANDSCAPE);
     } else if (Tools.safeEquals(getProperty("page_orientation"), "portrait")) {
       pageFormat.setOrientation(PageFormat.PORTRAIT);
     } else if (Tools.safeEquals(getProperty("page_orientation"), "reverse_landscape")) {
       pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
     }
   }
   return true;
 }
Ejemplo n.º 5
0
 public void act(XmlAction action) {
   if (action instanceof FontNodeAction) {
     FontNodeAction fontFamilyAction = (FontNodeAction) action;
     MindMapNode node = getNodeFromID(fontFamilyAction.getNode());
     String fontFamily = fontFamilyAction.getFont();
     if (!Tools.safeEquals(node.getFontFamilyName(), fontFamily)) {
       ((NodeAdapter) node).establishOwnFont();
       node.setFont(
           modeController
               .getController()
               .getFontThroughMap(
                   new Font(fontFamily, node.getFont().getStyle(), node.getFont().getSize())));
       modeController.nodeChanged(node);
     }
   }
 }
Ejemplo n.º 6
0
 public static void replace(
     IReplaceInputInformation info, String searchString, String replaceString) {
   String regExp = "(" + (searchString) + ")";
   Pattern p = Pattern.compile(regExp, Pattern.CASE_INSENSITIVE);
   // String replacement = getPureRegularExpression(replaceString);
   String replacement = (replaceString);
   int length = info.getLength();
   for (int i = 0; i < length; i++) {
     NodeHolder nodeHolder = info.getNodeHolderAt(i);
     String text = nodeHolder.node.getText();
     String replaceResult = HtmlTools.getInstance().getReplaceResult(p, replacement, text);
     if (!Tools.safeEquals(text, replaceResult)) {
       // set new node text only, if different.
       info.changeString(nodeHolder, replaceResult);
     }
   }
 }
Ejemplo n.º 7
0
  public XMLElement save() {
    if (style != null || color != null || width != WIDTH_PARENT) {
      XMLElement edge = new XMLElement();
      edge.setName("edge");

      if (style != null) {
        edge.setAttribute("STYLE", style);
      }
      if (color != null) {
        edge.setAttribute("COLOR", Tools.colorToXml(color));
      }
      if (width != WIDTH_PARENT) {
        if (width == WIDTH_THIN) edge.setAttribute("WIDTH", EDGE_WIDTH_THIN_STRING);
        else edge.setAttribute("WIDTH", Integer.toString(width));
      }
      return edge;
    }
    return null;
  }
Ejemplo n.º 8
0
 public void invoke(MindMapNode node) {
   super.invoke(node);
   boolean foldState = Tools.xmlToBoolean(getResourceString("foldingState"));
   String foldingType = getResourceString("foldingType");
   String applyTo = getResourceString("applyTo");
   if ("root".equals(applyTo)) {
     node = getMindMapController().getRootNode();
   }
   if (foldingType.equals("All")) {
     if (foldState) {
       foldAll(node);
     } else {
       unfoldAll(node);
     }
   } else {
     if (foldState) {
       foldOneStage(node);
     } else {
       unfoldOneStage(node);
     }
   }
 }
Ejemplo n.º 9
0
 protected void createStart() {
   start = source.getMainViewOutPoint(getTarget(), end);
   Tools.convertPointToAncestor(source.getMainView(), start, source);
 }
Ejemplo n.º 10
0
  public void startupMapHook() {
    super.startupMapHook();

    mMyMindMapController = super.getMindMapController();
    getMindMapController().getController().getMapModuleManager().addListener(this);

    // get strings from resources:
    COLUMN_MODIFIED = getResourceString("plugins/TimeList.xml_Modified");
    COLUMN_CREATED = getResourceString("plugins/TimeList.xml_Created");
    COLUMN_ICONS = getResourceString("plugins/TimeList.xml_Icons");
    COLUMN_TEXT = getResourceString("plugins/TimeList.xml_Text");
    COLUMN_DATE = getResourceString("plugins/TimeList.xml_Date");
    COLUMN_NOTES = getResourceString("plugins/TimeList.xml_Notes");

    showAllNodes = Tools.xmlToBoolean(getResourceString("show_all_nodes"));
    dialog = new JDialog(getController().getFrame().getJFrame(), false /* unmodal */);
    String windowTitle;
    if (showAllNodes) {
      windowTitle = "plugins/TimeManagement.xml_WindowTitle_All_Nodes";
    } else {
      windowTitle = "plugins/TimeManagement.xml_WindowTitle";
    }
    dialog.setTitle(getResourceString(windowTitle));
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            disposeDialog();
          }
        });
    Tools.addEscapeActionToDialog(
        dialog,
        new AbstractAction() {
          public void actionPerformed(ActionEvent arg0) {
            disposeDialog();
          }
        });
    Container contentPane = dialog.getContentPane();
    GridBagLayout gbl = new GridBagLayout();
    gbl.columnWeights = new double[] {1.0f};
    gbl.rowWeights = new double[] {1.0f};
    contentPane.setLayout(gbl);
    contentPane.add(
        new JLabel(getResourceString("plugins/TimeManagement.xml_Find")),
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mFilterTextSearchField = new JTextField();
    mFilterTextSearchField.getDocument().addDocumentListener(new FilterTextDocumentListener());
    mFilterTextSearchField.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent pEvent) {
            // logger.info("Key event:" + pEvent.getKeyCode());
            if (pEvent.getKeyCode() == KeyEvent.VK_DOWN) {
              logger.info("Set Focus to replace fields");
              mFilterTextReplaceField.requestFocusInWindow();
            }
          }
        });
    contentPane.add(
        /* new JScrollPane */ (mFilterTextSearchField),
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    contentPane.add(
        new JLabel(getResourceString("plugins/TimeManagement.xml_Replace")),
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mFilterTextReplaceField = new JTextField();
    contentPane.add(
        /* new JScrollPane */ (mFilterTextReplaceField),
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mFilterTextReplaceField.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent pEvent) {
            if (pEvent.getKeyCode() == KeyEvent.VK_DOWN) {
              logger.info("Set Focus to table");
              timeTable.requestFocusInWindow();
            } else if (pEvent.getKeyCode() == KeyEvent.VK_UP) {
              logger.info("Set Focus to table");
              mFilterTextSearchField.requestFocusInWindow();
            }
          }
        });
    dateRenderer = new DateRenderer();
    nodeRenderer = new NodeRenderer();
    notesRenderer = new NotesRenderer();
    iconsRenderer = new IconsRenderer(getController());
    timeTable = new FlatNodeTable();
    timeTable.addKeyListener(new FlatNodeTableKeyListener());
    // double click = goto.
    timeTable.addMouseListener(new FlatNodeTableMouseAdapter());
    // disable moving:
    timeTable.getTableHeader().setReorderingAllowed(false);
    updateModel();

    sorter.setTableHeader(timeTable.getTableHeader());
    sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMAPRATOR);
    sorter.setColumnComparator(NodeHolder.class, TableSorter.LEXICAL_COMPARATOR);
    sorter.setColumnComparator(NotesHolder.class, TableSorter.LEXICAL_COMPARATOR);
    sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMAPRATOR);
    // Sort by default by date.
    sorter.setSortingStatus(DATE_COLUMN, TableSorter.ASCENDING);
    JScrollPane pane = new JScrollPane(timeTable);
    contentPane.add(
        pane,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            1.0,
            10.0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    mTreeLabel = new JLabel();
    contentPane.add(
        new JScrollPane(mTreeLabel),
        new GridBagConstraints(
            0,
            5,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    // button bar
    AbstractAction selectAction =
        new AbstractAction(getResourceString("plugins/TimeManagement.xml_Select")) {
          public void actionPerformed(ActionEvent arg0) {
            selectSelectedRows();
          }
        };
    AbstractAction exportAction =
        new AbstractAction(getResourceString("plugins/TimeManagement.xml_Export")) {
          public void actionPerformed(ActionEvent arg0) {
            exportSelectedRowsAndClose();
          }
        };
    AbstractAction replaceAllAction =
        new AbstractAction(getResourceString("plugins/TimeManagement.xml_Replace_All")) {
          public void actionPerformed(ActionEvent arg0) {
            replace(new ReplaceAllInfo());
          }
        };
    AbstractAction replaceSelectedAction =
        new AbstractAction(getResourceString("plugins/TimeManagement.xml_Replace_Selected")) {
          public void actionPerformed(ActionEvent arg0) {
            replace(new ReplaceSelectedInfo());
          }
        };
    AbstractAction gotoAction =
        new AbstractAction(getResourceString("plugins/TimeManagement.xml_Goto")) {
          public void actionPerformed(ActionEvent arg0) {
            selectSelectedRows();
            disposeDialog();
          }
        };
    AbstractAction disposeAction =
        new AbstractAction(getResourceString("plugins/TimeManagement.xml_Cancel")) {
          public void actionPerformed(ActionEvent arg0) {
            disposeDialog();
          }
        };

    AbstractAction toggleViewFoldedNodesAction =
        new ToggleViewFoldedNodesAction(
            getResourceString("plugins/TimeManagement.xml_ToggleViewFoldedNodesAction"));

    /** Menu * */
    StructuredMenuHolder menuHolder = new StructuredMenuHolder();
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu(getResourceString("plugins/TimeManagement.xml_menu_actions"));
    menuHolder.addMenu(menu, "main/actions/.");
    final JMenuItem selectMenuItem =
        addAccelerator(
            menuHolder.addAction(selectAction, "main/actions/select"),
            "keystroke_plugins/TimeList_select");
    final JMenuItem gotoMenuItem =
        addAccelerator(
            menuHolder.addAction(gotoAction, "main/actions/goto"),
            "keystroke_plugins/TimeList_goto");
    final JMenuItem replaceSelectedMenuItem =
        addAccelerator(
            menuHolder.addAction(replaceSelectedAction, "main/actions/replaceSelected"),
            "keystroke_plugins/TimeList_replaceSelected");
    final JMenuItem replaceAllMenuItem =
        addAccelerator(
            menuHolder.addAction(replaceAllAction, "main/actions/replaceAll"),
            "keystroke_plugins/TimeList_replaceAll");

    final JMenuItem exportMenuItem =
        addAccelerator(
            menuHolder.addAction(exportAction, "main/actions/export"),
            "keystroke_plugins/TimeList_export");
    addAccelerator(
        menuHolder.addAction(disposeAction, "main/actions/dispose"),
        "keystroke_plugins/TimeList_dispose");
    JMenu viewMenu = new JMenu(getResourceString("plugins/TimeManagement.xml_menu_view"));
    menuHolder.addMenu(viewMenu, "main/view/.");
    addAccelerator(
        menuHolder.addAction(toggleViewFoldedNodesAction, "main/view/showFoldedNodes"),
        "keystroke_plugins/TimeList_showFoldedNodes");
    menuHolder.updateMenus(menuBar, "main/");
    dialog.setJMenuBar(menuBar);

    /* Initial State */
    selectMenuItem.setEnabled(false);
    gotoMenuItem.setEnabled(false);
    exportMenuItem.setEnabled(false);
    replaceSelectedMenuItem.setEnabled(false);

    // table selection listeners to enable/disable menu actions:
    ListSelectionModel rowSM = timeTable.getSelectionModel();
    rowSM.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            // Ignore extra messages.
            if (e.getValueIsAdjusting()) return;

            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            boolean enable = !(lsm.isSelectionEmpty());
            replaceSelectedMenuItem.setEnabled(enable);
            selectMenuItem.setEnabled(enable);
            gotoMenuItem.setEnabled(enable);
            exportMenuItem.setEnabled(enable);
          }
        });
    // table selection listener to display the history of the selected nodes
    rowSM.addListSelectionListener(
        new ListSelectionListener() {
          String getNodeText(MindMapNode node) {
            return Tools.getNodeTextHierarchy(node, getMindMapController());
          }

          public void valueChanged(ListSelectionEvent e) {
            // Ignore extra messages.
            if (e.getValueIsAdjusting()) return;

            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            if (lsm.isSelectionEmpty()) {
              mTreeLabel.setText("");
              return;
            }
            int selectedRow = lsm.getLeadSelectionIndex();
            MindMapNode mindMapNode = getMindMapNode(selectedRow);
            mTreeLabel.setText(getNodeText(mindMapNode));
          }
        });

    // restore preferences:
    // Retrieve window size and column positions.
    WindowConfigurationStorage storage =
        getMindMapController().decorateDialog(dialog, WINDOW_PREFERENCE_STORAGE_PROPERTY);
    if (storage != null) {
      setTableConfiguration(storage);
    }
    dialog.setVisible(true);
  }
Ejemplo n.º 11
0
 public KeyStroke getKeyStroke() {
   return Tools.getKeyStroke(
       getMindMapController().getFrame().getAdjustableProperty(getKeystrokeResourceName()));
 }
Ejemplo n.º 12
0
    public void actionPerformed(ActionEvent e) {
      if (!acquirePrinterJobAndPageFormat()) {
        return;
      }

      // Ask about custom printing settings
      final JDialog dialog =
          new JDialog(
              (JFrame) getFrame(), getResourceString("printing_settings"), /* modal= */ true);
      final JCheckBox fitToPage =
          new JCheckBox(
              getResourceString("fit_to_page"),
              Tools.safeEquals("true", getProperty("fit_to_page")));
      final JLabel userZoomL = new JLabel(getResourceString("user_zoom"));
      final JTextField userZoom = new JTextField(getProperty("user_zoom"), 3);
      userZoom.setEditable(!fitToPage.isSelected());
      final JButton okButton = new JButton(getResourceString("ok"));
      final Tools.IntHolder eventSource = new Tools.IntHolder();
      JPanel panel = new JPanel();

      GridBagLayout gridbag = new GridBagLayout();
      GridBagConstraints c = new GridBagConstraints();

      eventSource.setValue(0);
      okButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              eventSource.setValue(1);
              dialog.dispose();
            }
          });
      fitToPage.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              userZoom.setEditable(e.getStateChange() == ItemEvent.DESELECTED);
            }
          });

      // c.weightx = 0.5;
      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 2;
      gridbag.setConstraints(fitToPage, c);
      panel.add(fitToPage);
      c.gridy = 1;
      c.gridwidth = 1;
      gridbag.setConstraints(userZoomL, c);
      panel.add(userZoomL);
      c.gridx = 1;
      c.gridwidth = 1;
      gridbag.setConstraints(userZoom, c);
      panel.add(userZoom);
      c.gridy = 2;
      c.gridx = 0;
      c.gridwidth = 3;
      c.insets = new Insets(10, 0, 0, 0);
      gridbag.setConstraints(okButton, c);
      panel.add(okButton);
      panel.setLayout(gridbag);
      dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
      dialog.setContentPane(panel);
      dialog.setLocationRelativeTo((JFrame) getFrame());
      dialog.getRootPane().setDefaultButton(okButton);
      dialog.pack(); // calculate the size
      dialog.show();

      if (eventSource.getValue() == 1) {
        setProperty("user_zoom", userZoom.getText());
        setProperty("fit_to_page", fitToPage.isSelected() ? "true" : "false");
      } else return;

      // Ask user for page format (e.g., portrait/landscape)
      pageFormat = printerJob.pageDialog(pageFormat);
      if (pageFormat.getOrientation() == PageFormat.LANDSCAPE) {
        setProperty("page_orientation", "landscape");
      } else if (pageFormat.getOrientation() == PageFormat.PORTRAIT) {
        setProperty("page_orientation", "portrait");
      } else if (pageFormat.getOrientation() == PageFormat.REVERSE_LANDSCAPE) {
        setProperty("page_orientation", "reverse_landscape");
      }
    }
Ejemplo n.º 13
0
  public Controller(FreeMindMain frame) {
    checkJavaVersion();

    this.frame = frame;
    if (logger == null) {
      logger = frame.getLogger(this.getClass().getName());
    }
    // new object factory for xml actions:
    actionXmlFactory = JaxbTools.getInstance().getObjectFactory();

    lastOpened = new LastOpenedList(this, getProperty("lastOpened"));
    mapModuleManager = new MapModuleManager(this, history, lastOpened);

    nodeMouseMotionListener = new NodeMouseMotionListener(this);
    nodeMotionListener = new NodeMotionListener(this);
    nodeKeyListener = new NodeKeyListener(this);
    nodeDragListener = new NodeDragListener(this);
    nodeDropListener = new NodeDropListener(this);

    mapMouseMotionListener = new MapMouseMotionListener(this);
    mapMouseWheelListener = new MapMouseWheelListener(this);

    close = new CloseAction(this);

    print = new PrintAction(this, true);
    printDirect = new PrintAction(this, false);
    page = new PageAction(this);
    quit = new QuitAction(this);
    background = new BackgroundAction(this, bswatch);
    about = new AboutAction(this);
    faq = new OpenFAQAction(this);
    documentation = new DocumentationAction(this);
    license = new LicenseAction(this);
    historyPreviousMap = new HistoryPreviousMapAction(this);
    historyNextMap = new HistoryNextMapAction(this);
    navigationPreviousMap = new NavigationPreviousMapAction(this);
    navigationNextMap = new NavigationNextMapAction(this);
    toggleMenubar = new ToggleMenubarAction(this);
    toggleToolbar = new ToggleToolbarAction(this);
    // ICON AOP
    // toggleLeftToolbar = new ToggleLeftToolbarAction(this);
    optionAntialiasAction = new OptionAntialiasAction(this);
    optionHTMLExportFoldingAction = new OptionHTMLExportFoldingAction(this);
    optionSelectionMechanismAction = new OptionSelectionMechanismAction(this);

    zoomIn = new ZoomInAction(this);
    zoomOut = new ZoomOutAction(this);
    propertyAction = new PropertyAction(this);

    moveToRoot = new MoveToRootAction(this);

    // Create the ToolBar
    toolbar = new MainToolBar(this);
    getFrame().getContentPane().add(toolbar, BorderLayout.NORTH);

    setAllActions(false);

    if (!Tools.isAvailableFontFamily(getProperty("standardfont"))) {
      System.out.println(
          "Warning: the font you have set as standard - "
              + getProperty("standardfont")
              + " - is not available.");
      frame.setProperty("standardfont", "SansSerif");
    }
  }
Ejemplo n.º 14
0
  /*
   * (non-Javadoc)
   *
   * @see freemind.extensions.HookAdapter#startupMapHook()
   */
  public void startupMapHook() {
    super.startupMapHook();
    if (logger == null) {
      logger = freemind.main.Resources.getInstance().getLogger(this.getClass().getName());
    }
    mMyMindMapController = super.getMindMapController();
    mSimpleFormatter = new SimpleFormatter();
    // retrieve content
    final String pathname =
        getMindMapController().getFrame().getFreemindDirectory()
            + File.separator
            + FreeMind.LOG_FILE_NAME
            + ".0";
    String logFileContents = Tools.getFile(new File(pathname));
    // done.
    getMindMapController().getController().getMapModuleManager().addListener(this);
    mLogFileViewer = new JDialog(getController().getFrame().getJFrame(), false);
    mLogFileViewer.setTitle(getResourceString("LogFileViewer_title") + pathname);
    mLogFileViewer.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    mLogFileViewer.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            disposeDialog();
          }
        });
    mCloseAction = new CloseAction();
    // the action title is changed by the following method, thus we create
    // another close action.
    Tools.addEscapeActionToDialog(mLogFileViewer, new CloseAction());

    /** Menu * */
    StructuredMenuHolder menuHolder = new StructuredMenuHolder();
    mMenuBar = new JMenuBar();
    JMenu mainItem = new JMenu(getResourceString("MapControllerPopupDialog.Actions"));
    menuHolder.addMenu(mainItem, "main/actions/.");
    Action printOperationAction = new PrintOperationAction();
    addAccelerator(
        menuHolder.addAction(printOperationAction, "main/actions/printOperationAction"),
        "keystroke_accessories/plugins/LogFileViewer_printOperationAction");
    JMenu loggerItem = new JMenu(getResourceString("MapControllerPopupDialog.LogLevels"));
    menuHolder.addMenu(loggerItem, "main/loglevel/.");
    Level[] levels =
        new Level[] {
          Level.FINEST, Level.FINER, Level.FINE, Level.INFO, Level.WARNING, Level.SEVERE, Level.OFF
        };
    for (int i = 0; i < levels.length; i++) {
      Level level = levels[i];
      menuHolder.addAction(
          new SetLogLevelAction(level), "main/loglevel/setLogLevel_" + level.getName());
    }
    menuHolder.updateMenus(mMenuBar, "main/");
    mLogFileViewer.setJMenuBar(mMenuBar);
    mLogFileViewer.setSize(400, 400);
    mLogFileViewer.setLayout(new BorderLayout());
    mTextArea = new JTextArea(logFileContents);
    mTextArea.setEditable(false);
    mTextArea.getCaret().setVisible(true);
    // scroll at the end
    mTextArea.setCaretPosition(logFileContents.length());
    mLogFileViewer.add(new JScrollPane(mTextArea), BorderLayout.CENTER);
    // restore preferences:
    // Retrieve window size and column positions.
    LogFileViewerConfigurationStorage storage =
        (LogFileViewerConfigurationStorage)
            getMindMapController()
                .decorateDialog(mLogFileViewer, WINDOW_PREFERENCE_STORAGE_PROPERTY);
    if (storage != null) {
      // retrieve_additional_data_here
    }
    mLogFileViewer.setVisible(true);
    mUpdateTextAreaThread = new UpdateTextAreaThread();
    mUpdateTextAreaThread.start();
    LogFileLogHandler baseHandler = getBaseHandler();
    if (baseHandler != null) {
      baseHandler.setLogReceiver(this);
    }
  }
Ejemplo n.º 15
0
 public KeyStroke getKeyStroke() {
   final String keystrokeResourceName = icon.getKeystrokeResourceName();
   final String keyStrokeDescription =
       getMindMapController().getFrame().getAdjustableProperty(keystrokeResourceName);
   return Tools.getKeyStroke(keyStrokeDescription);
 }
Ejemplo n.º 16
0
 protected void decorateButtonAndAction(
     String stringProperty, final AbstractAction selectAction, JButton selectButton) {
   String resourceString = getResourceString(stringProperty);
   selectAction.putValue(AbstractAction.NAME, resourceString.replaceAll("&", ""));
   Tools.setLabelAndMnemonic(selectButton, resourceString);
 }
 protected void setName(String name) {
   if (name != null) {
     putValue(Action.NAME, name);
     putValue(Action.SHORT_DESCRIPTION, Tools.removeMnemonic(name));
   }
 }
Ejemplo n.º 18
0
 protected void createEnd() {
   end = getTarget().getMainViewInPoint();
   Tools.convertPointToAncestor(this.target.getMainView(), end, source);
 }