Examples of AFreeplaneAction


Examples of org.freeplane.core.ui.AFreeplaneAction

        final boolean mandatory = Boolean.parseBoolean(attributes.getProperty("mandatory", "false").toLowerCase());
        ChildProperties childProps = new ChildProperties(parseOrderSettings(attributes.getProperty("orderPriority", "")));
        childProps.set(RibbonElementPriority.class, getPriority(attributes.getProperty("priority", "medium")));
       
        if(actionKey != null) {
          AFreeplaneAction action = context.getBuilder().getMode().getAction(actionKey);
         
          if(action != null) {
            if(mandatory) {
              action.putValue(MANDATORY_PROPERTY, mandatory);
            }
            AbstractCommandButton button;
            if(isSelectionListener(action)) {
              button = createCommandToggleButton(action);
              if (context.hasChildren(context.getCurrentPath())) {
                LogUtils.severe("RibbonActionContributorFactory.getContributor(): can't add popup menu to toggle button for action: "+context.getCurrentPath().toString());
              }
            }
            else {
              button = createCommandButton(action);
              if(context.hasChildren(context.getCurrentPath())) {
                StructurePath path = context.getCurrentPath();
                ((JCommandButton)button).setPopupCallback(getPopupPanelCallBack(path, context));
                ((JCommandButton)button).setCommandButtonKind(CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
                KeyStroke ks = context.getBuilder().getAcceleratorManager().getAccelerator(actionKey);
                updateRichTooltip(button, action, ks);
                updateActionState(action, button);
              }
            }
            button.putClientProperty(ACTION_KEY_PROPERTY, action);
           
            KeyStroke ks = context.getBuilder().getAcceleratorManager().getAccelerator(actionKey);
            if(ks != null) {
              button.putClientProperty(ACTION_ACCELERATOR, ks);
              updateRichTooltip(button, action, ks);
            }
            getAccelChangeListener().addAction(actionKey, button);
           
            builder.getMapChangeAdapter().addListener(new ActionChangeListener(action, button))
            parent.addChild(button, childProps);
          }
        }
        else {
          final String name = attributes.getProperty("name");
          if(name != null) {
            AFreeplaneAction action = ActionUtils.getDummyAction(name);
            final JCommandButton button = new JCommandButton(ActionUtils.getActionTitle(action), ActionUtils.getActionIcon(action));
            button.putClientProperty(ACTION_NAME_PROPERTY, action);
            updateRichTooltip(button, action, null);
            if(context.hasChildren(context.getCurrentPath())) {
              StructurePath path = context.getCurrentPath();
              button.setPopupCallback(getPopupPanelCallBack(path, context));
              button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
            }
            button.setFocusable(false);
            parent.addChild(button, childProps);
          }
        }
      }
     
      private PopupPanelCallback getPopupPanelCallBack(StructurePath path, final RibbonBuildContext context) {
        childButtons.clear();
        context.processChildren(path, this);
        return new PopupPanelCallback() {
         
          public JPopupPanel getPopupPanel(JCommandButton commandButton) {
            JCommandPopupMenu popupmenu = new JCommandPopupMenu();
            for (Component comp : childButtons) {
              if(comp instanceof JSeparator) {
                popupmenu.addMenuSeparator();
              }
              else if(comp instanceof AbstractCommandButton) {
                AbstractCommandButton button = (AbstractCommandButton) comp;
               
                AbstractCommandButton menuButton = null;               
                AFreeplaneAction action = (AFreeplaneAction)button.getClientProperty(ACTION_KEY_PROPERTY);
                if(action != null) {
                  if(isSelectionListener(action)) {
                    menuButton = createCommandToggleMenuButton(action);
                    popupmenu.addMenuButton((JCommandToggleMenuButton) menuButton);
                  }
                  else {
                    menuButton = createCommandMenuButton(action);
                    popupmenu.addMenuButton((JCommandMenuButton) menuButton);
                  }
                  menuButton.setEnabled(button.isEnabled());
                  menuButton.putClientProperty(ACTION_KEY_PROPERTY, action);
                  KeyStroke ks = context.getBuilder().getAcceleratorManager().getAccelerator(action.getKey());
                  updateRichTooltip(menuButton, action, ks);
                  updateActionState(action, menuButton);
                }
                else {
                  action = (AFreeplaneAction)button.getClientProperty(ACTION_NAME_PROPERTY);
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

  }

  public void setAnchorID(final String anchorID) {
    this.anchorID = anchorID;
    final String tooltip;
    AFreeplaneAction setLinkAnchorAction = modeController.getAction("SetLinkAnchorAction");
    final boolean anchored = isAnchored();
    if(anchored)
      tooltip = TextUtils.format(setLinkAnchorAction.getTooltipKey() + "_anchored", anchorID);
    else
      tooltip = TextUtils.getRawText(setLinkAnchorAction.getTooltipKey());
    setLinkAnchorAction.putValue(Action.SHORT_DESCRIPTION, tooltip);
    setLinkAnchorAction.putValue(Action.LONG_DESCRIPTION, tooltip);
    setLinkAnchorAction.setSelected(anchored);
    modeController.getAction("ClearLinkAnchorAction").setEnabled(anchored);
    modeController.getAction("MakeLinkToAnchorAction").setEnabled(anchored);
    modeController.getAction("MakeLinkFromAnchorAction").setEnabled(anchored);
  }
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

    approximateMatchingButtonModel.setSelected(false);
    caseSensitiveButtonModel = new JToggleButton.ToggleButtonModel();
    caseSensitiveButtonModel.setSelected(false);

    controller.getMapViewManager().addMapSelectionListener(this);
        final AFreeplaneAction showFilterToolbar = new ToggleFilterToolbarAction("ShowFilterToolbarAction", "/filter_toolbar");
    quickEditor = new FilterConditionEditor(this, 0, true);
    quickEditor.setEnterKeyActionListener( new ActionListener()  {

      public void actionPerformed(ActionEvent e) {
        ((QuickFindAction)Controller.getCurrentController().getAction("QuickFindAction.FORWARD")).executeAction(true);
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

      this.key = action.getKey();
      this.builder = Controller.getCurrentModeController().getUserInputListenerFactory().getMenuBuilder(RibbonBuilder.class);
    }

    public void actionPerformed(ActionEvent e) {
      AFreeplaneAction action = Controller.getCurrentModeController().getAction(key);
     
      if(action == null || linkAccelerator(action, e)) {
        return;
      }
     
      if ((0 != (e.getModifiers() & ActionEvent.CTRL_MASK))) {
        builder.getAcceleratorManager().newAccelerator(action, null);
        return;
      }
      builder.getRibbonActionEventHandler().fireAboutToPerformEvent(new AboutToPerformEvent(action));
      action.actionPerformed(e);
    }
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

  public AController() {
  }

  public void addAction(final AFreeplaneAction value) {
    final String key = value.getKey();
    final AFreeplaneAction old = getActions().put(key, value);
    //String pattern = key.replaceAll("\\.", "\\\\.").replaceAll("/", "\\\\/");      
    //System.out.println("key\t\t" + value.getClass().getSimpleName() + "\t\ts/\\\"" + pattern + "\\\"/\\\"" + value.getClass().getSimpleName() + "\\\"/;");   
    if (old != null && !old.equals(value)) {
      getActions().put(key, old);
      throw new RuntimeException("action " + key + " already registered");
    }
    if (AFreeplaneAction.checkSelectionOnPropertyChange(value)) {
      final ActionSelectorOnPropertyChange listener = new ActionSelectorOnPropertyChange(value);
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

  protected Map<String, AFreeplaneAction> getActions() {
    return actions;
  }

  public AFreeplaneAction removeAction(final String key) {
    final AFreeplaneAction action = getActions().remove(key);
    if (AFreeplaneAction.checkSelectionOnPropertyChange(action)) {
      ResourceController.getResourceController().removePropertyChangeListener(
          ActionSelectorOnPropertyChange.class, action);
    }
    return action;
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

    actor.act();
  }

  @Override
  public AFreeplaneAction getAction(final String key) {
    final AFreeplaneAction action = super.getAction(key);
    if (action != null) {
      return action;
    }
    return getController().getAction(key);
  }
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

    }
  }

  @Override
  public AFreeplaneAction removeAction(final String key) {
    final AFreeplaneAction action = super.removeAction(key);
    if (mapController != null) {
      mapController.removeListenerForAction(action);
    }
    return action;
  }
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

    menu.setToolTipText(group.getDescription());
    return menu;
  }

  private void addActionToIconSubmenu(final JMenu menu, final MindIcon icon, final String fileName) {
    final AFreeplaneAction myAction = iconActions.get(icon);
    final int separatorPosition = fileName.indexOf('/');
    if (separatorPosition == -1) {
      new MenuSplitter().addMenuComponent(menu, new JMenuItem(myAction),  menu.getItemCount());
      return;
    }
View Full Code Here

Examples of org.freeplane.core.ui.AFreeplaneAction

      return;
    }
    final String[] fpIcons = ResourceController.getResourceController().getProperty("icons.list").split(";");
    for (final String icon : fpIcons) {
      final MindIcon mindIcon = STORE.getMindIcon(icon);
      final AFreeplaneAction iconAction = iconActions.get(mindIcon);
      iconToolBar.add(iconAction).setAlignmentX(JComponent.CENTER_ALIGNMENT);
    }
    final Collection<MindIcon> userIcons = STORE.getUserIcons();
    for (final MindIcon icon : userIcons) {
      final AFreeplaneAction iconAction = iconActions.get(icon);
      iconToolBar.add(iconAction).setAlignmentX(JComponent.CENTER_ALIGNMENT);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.