Пример #1
0
 protected void sleepALittle() {
   try {
     Thread.sleep(100);
   } catch (InterruptedException e) {
     freemind.main.Resources.getInstance().logException(e);
   }
 }
Пример #2
0
 /** Creates a table model for the new table and returns it. */
 private DefaultTableModel updateModel() {
   TimeWindowConfigurationStorage storage = null;
   // if not first call, get configuration
   if (sorter != null) {
     storage = getTableConfiguration();
   }
   DefaultTableModel model = new MindmapTableModel();
   model.addColumn(COLUMN_DATE);
   model.addColumn(COLUMN_TEXT);
   model.addColumn(COLUMN_ICONS);
   model.addColumn(COLUMN_CREATED);
   model.addColumn(COLUMN_MODIFIED);
   model.addColumn(COLUMN_NOTES);
   MindMapNode node = getMindMapController().getMap().getRootNode();
   updateModel(model, node);
   timeTableModel = model;
   mFlatNodeTableFilterModel =
       new FlatNodeTableFilterModel(timeTableModel, NODE_TEXT_COLUMN, NODE_NOTES_COLUMN);
   if (sorter == null) {
     sorter = new TableSorter(mFlatNodeTableFilterModel);
     timeTable.setModel(sorter);
   } else {
     sorter.setTableModel(mFlatNodeTableFilterModel);
   }
   if (storage != null) {
     setTableConfiguration(storage);
   }
   try {
     String text = getRegularExpression(getText(mFilterTextSearchField.getDocument()));
     mFlatNodeTableFilterModel.setFilter(text);
   } catch (BadLocationException e) {
     freemind.main.Resources.getInstance().logException(e);
   }
   return model;
 }
 public void setFolded(boolean folded) {
   if (isDecrypted || folded) {
     super.setFolded(folded);
     return;
   }
   ControllerAdapter browseController = (ControllerAdapter) mModeController;
   // get password:
   final EnterPasswordDialog pwdDialog = new EnterPasswordDialog(null, browseController, false);
   pwdDialog.setModal(true);
   pwdDialog.show();
   if (pwdDialog.getResult() == EnterPasswordDialog.CANCEL) {
     return;
   }
   SingleDesEncrypter encrypter = new SingleDesEncrypter(pwdDialog.getPassword());
   // Decrypt
   String decrypted = encrypter.decrypt(encryptedContent);
   if (decrypted == null) return;
   String[] childs = decrypted.split(ModeController.NODESEPARATOR);
   // and now? paste it:
   for (int i = childs.length - 1; i >= 0; i--) {
     String string = childs[i];
     logger.finest("Decrypted '" + string + "'.");
     // if the encrypted node is empty, we skip the insert.
     if (string.length() == 0) continue;
     try {
       NodeAdapter node =
           (NodeAdapter) browseController.createNodeTreeFromXml(new StringReader(string));
       // now, the import is finished. We can inform others about
       // the new nodes:
       browseController.insertNodeInto(node, this);
       MapAdapter model = browseController.getModel();
       browseController.invokeHooksRecursively(node, model);
       super.setFolded(folded);
       browseController.nodeChanged(this);
       browseController.nodeStructureChanged(this);
       isDecrypted = true;
       updateIcon();
     } catch (XMLParseException e) {
       freemind.main.Resources.getInstance().logException(e);
       return;
     } catch (IOException e) {
       freemind.main.Resources.getInstance().logException(e);
       return;
     }
   }
 }
Пример #4
0
 private void replace(IReplaceInputInformation info) {
   try {
     String searchString = getText(mFilterTextSearchField.getDocument());
     String replaceString = getText(mFilterTextReplaceField.getDocument());
     replace(info, searchString, replaceString);
     timeTableModel.fireTableDataChanged();
     mFlatNodeTableFilterModel.resetFilter();
     mFilterTextSearchField.setText("");
   } catch (BadLocationException e) {
     freemind.main.Resources.getInstance().logException(e);
   }
 }
 /** @return Returns the delete. */
 private JMenuItem getDelete() {
   if (delete == null) {
     delete = new JMenuItem(Resources.getInstance().getResourceString("attributes_popup_delete"));
     delete.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             table.removeRow(row);
           }
         });
   }
   return delete;
 }
 /** @return Returns the insert. */
 private JMenuItem getInsert() {
   if (insert == null) {
     insert = new JMenuItem(Resources.getInstance().getResourceString("attributes_popup_new"));
     insert.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             table.insertRow(row + 1);
           }
         });
   }
   return insert;
 }
 /** @return Returns the down. */
 private JMenuItem getDown() {
   if (down == null) {
     down = new JMenuItem(Resources.getInstance().getResourceString("attributes_popup_down"));
     down.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             table.moveRowDown(row);
           }
         });
   }
   return down;
 }
 /** @return Returns the up. */
 private JMenuItem getUp() {
   if (up == null) {
     up = new JMenuItem(Resources.getInstance().getResourceString("attributes_popup_up"));
     up.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             table.moveRowUp(row);
           }
         });
   }
   return up;
 }
 /** @return Returns the optimalWidth. */
 private JMenuItem getOptimalWidth() {
   if (optimalWidth == null) {
     optimalWidth =
         new JMenuItem(
             Resources.getInstance().getResourceString("attributes_popup_optimal_width"));
     optimalWidth.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             table.setOptimalColumnWidths();
           }
         });
   }
   return optimalWidth;
 }
 protected String createDesctiption() {
   final String simpleCondition =
       Resources.getInstance().getResourceString(ConditionFactory.FILTER_DOES_NOT_EXIST);
   return ConditionFactory.createDescription(attribute, simpleCondition, null, false);
 }
Пример #11
0
 protected boolean binOptionIsTrue(String option) {
   return Resources.getInstance().getBoolProperty(option);
 }
Пример #12
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);
    }
  }