Package org.freeplane.features.styles

Examples of org.freeplane.features.styles.ConditionalStyleModel


      MenuBuilder.setLabelAndMnemonic(create, TextUtils.getRawText("new"));
      create.setMaximumSize(UITools.MAX_BUTTON_DIMENSION);
      create.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int row = conditionalStyleTable.getRowCount();
        final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
        ((MLogicalStyleController)LogicalStyleController.getController()).addConditionalStyle(map, conditionalStyleModel, true, null, MapStyleModel.DEFAULT_STYLE, false);
        conditionalStyleTable.setRowSelectionInterval(row, row);
      }
    });

      JButton edit = new JButton();
      MenuBuilder.setLabelAndMnemonic(edit, TextUtils.getRawText("edit"));
      edit.setMaximumSize(UITools.MAX_BUTTON_DIMENSION);
      edit.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int selectedRow = conditionalStyleTable.getSelectedRow();
        if(selectedRow == -1){
          return;
        }
        final ASelectableCondition value = (ASelectableCondition) conditionalStyleTable.getValueAt(selectedRow, 1);
        final MLogicalStyleController styleController = MLogicalStyleController.getController();
        final ASelectableCondition newCondition = styleController.editCondition(value);
        conditionalStyleTable.setValueAt(newCondition, selectedRow, 1);
      }
    });

      JButton delete = new JButton();
      MenuBuilder.setLabelAndMnemonic(delete, TextUtils.getRawText("delete"));
      delete.setMaximumSize(UITools.MAX_BUTTON_DIMENSION);
      delete.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int selectedRow = conditionalStyleTable.getSelectedRow();
        if(selectedRow == -1){
          return;
        }
        final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
        ((MLogicalStyleController)LogicalStyleController.getController()).removeConditionalStyle(map, conditionalStyleModel, selectedRow);
        if(conditionalStyleTable.getRowCount() == selectedRow){
          selectedRow--;
        }
        if(selectedRow == -1){
          return;
        }
        conditionalStyleTable.setRowSelectionInterval(selectedRow, selectedRow);
      }
    });
      JButton up = new JButton();
      MenuBuilder.setLabelAndMnemonic(up, TextUtils.getRawText("up"));
      up.setMaximumSize(UITools.MAX_BUTTON_DIMENSION);
      up.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int selectedRow = conditionalStyleTable.getSelectedRow();
        if(selectedRow <= 0){
          return;
        }
        final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
        ((MLogicalStyleController)LogicalStyleController.getController()).moveConditionalStyleUp(map, conditionalStyleModel, selectedRow);
        selectedRow--;
        conditionalStyleTable.setRowSelectionInterval(selectedRow, selectedRow);
      }
    });
      JButton down = new JButton();
      MenuBuilder.setLabelAndMnemonic(down, TextUtils.getRawText("down"));
      down.setMaximumSize(UITools.MAX_BUTTON_DIMENSION);
      down.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int selectedRow = conditionalStyleTable.getSelectedRow();
        if(selectedRow == -1 || selectedRow == conditionalStyleTable.getRowCount() - 1){
          return;
        }
        final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
        ((MLogicalStyleController)LogicalStyleController.getController()).moveConditionalStyleDown(map, conditionalStyleModel, selectedRow);
        selectedRow++;
        conditionalStyleTable.setRowSelectionInterval(selectedRow, selectedRow);
      }
    });
View Full Code Here


    }

  public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
    Component pane = createConditionalStylePane(map, conditionalStyleModel);
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.startTransaction();
    try{
      final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageNodeConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
View Full Code Here

  @Override
  public ConditionalStyleModel getConditionalStyleModel() {
    final Controller controller = Controller.getCurrentController();
    final NodeModel node = controller.getSelection().getSelected();
    ConditionalStyleModel conditionalStyleModel = (ConditionalStyleModel) node.getExtension(ConditionalStyleModel.class);
    if(conditionalStyleModel == null){
      conditionalStyleModel = new ConditionalStyleModel();
      node.addExtension(conditionalStyleModel);
    }
      return conditionalStyleModel;
    }
View Full Code Here

    }

  public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
    Component pane = createConditionalStylePane(map, conditionalStyleModel);
    Controller.getCurrentModeController().startTransaction();
    try{
      final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
      if(JOptionPane.OK_OPTION == confirmed){
View Full Code Here

  @Override
  public ConditionalStyleModel getConditionalStyleModel() {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
      final MapStyleModel styleModel = MapStyleModel.getExtension(map);
    final ConditionalStyleModel conditionalStyleModel = styleModel.getConditionalStyleModel();
      return conditionalStyleModel;
    }
View Full Code Here

TOP

Related Classes of org.freeplane.features.styles.ConditionalStyleModel

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.