Package org.pushingpixels.flamingo.api.common

Examples of org.pushingpixels.flamingo.api.common.JCommandButton$PopupHandler


       
        parent.addChild(band, new ChildProperties(parseOrderSettings(attributes.getProperty("orderPriority", ""))));         
      }

      private void createToolbarsMenu(final RibbonBuildContext context, JRibbonBand band) {
        JCommandButton button = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_toolbars")));
        button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
        button.setPopupCallback(new PopupPanelCallback() {
          public JPopupPanel getPopupPanel(JCommandButton commandButton) {
            JCommandPopupMenu popupmenu = new JCommandPopupMenu();         
             
              final AFreeplaneAction toggleFBarAction = context.getBuilder().getMode().getAction("ToggleFBarAction");
              final JCommandToggleMenuButton toggleFBarButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleFBarAction);
              toggleFBarAction.setSelected();
              toggleFBarButton.getActionModel().setSelected(toggleFBarAction.isSelected());
              popupmenu.addMenuButton(toggleFBarButton);
             
              final AFreeplaneAction toggleLeftToolbarAction = context.getBuilder().getMode().getAction("ToggleLeftToolbarAction");
              final JCommandToggleMenuButton toggleLeftToolbarButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleLeftToolbarAction);
              toggleLeftToolbarAction.setSelected();
              toggleLeftToolbarButton.getActionModel().setSelected(toggleLeftToolbarAction.isSelected());
              popupmenu.addMenuButton(toggleLeftToolbarButton);
             
              final AFreeplaneAction toggleStatusAction = context.getBuilder().getMode().getAction("ToggleStatusAction");
              final JCommandToggleMenuButton toggleStatusButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleStatusAction);
              toggleStatusAction.setSelected();
              toggleStatusButton.getActionModel().setSelected(toggleStatusAction.isSelected());
              popupmenu.addMenuButton(toggleStatusButton);
             
              final AFreeplaneAction toggleScrollbarsAction = context.getBuilder().getMode().getAction("ToggleScrollbarsAction");
              final JCommandToggleMenuButton toggleScrollbarsButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleScrollbarsAction);
              toggleScrollbarsAction.setSelected();
              toggleScrollbarsButton.getActionModel().setSelected(toggleScrollbarsAction.isSelected());
              popupmenu.addMenuButton(toggleScrollbarsButton);
             
            return popupmenu;
          }
        });
        band.addCommandButton(button, RibbonElementPriority.MEDIUM);
       
        AFreeplaneAction action = context.getBuilder().getMode().getAction("SetShortenerStateAction");
        button = RibbonActionContributorFactory.createCommandButton(action);
        band.addCommandButton(button, RibbonElementPriority.MEDIUM);
       
        action = context.getBuilder().getMode().getAction("ToggleDetailsAction");       
        button = RibbonActionContributorFactory.createCommandButton(action);
        band.addCommandButton(button, RibbonElementPriority.MEDIUM);       
      }


      private void createToolTipMenu(final RibbonBuildContext context, final JRibbonBand band) {
        JCommandButton button = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_hoverView")));
        button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
        button.setPopupCallback(new PopupPanelCallback() {
          public JPopupPanel getPopupPanel(JCommandButton commandButton) {
            JCommandPopupMenu popupmenu = new JCommandPopupMenu();
           
            final SetBooleanPropertyAction showAction = (SetBooleanPropertyAction) context.getBuilder().getMode().getAction("SetBooleanPropertyAction.show_node_tooltips");
              final JCommandToggleMenuButton showButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showAction);
              showAction.setSelected();
              showButton.getActionModel().setSelected(showAction.isSelected());
              popupmenu.addMenuButton(showButton);
             
              final SetBooleanPropertyAction showStylesAction = (SetBooleanPropertyAction) context.getBuilder().getMode().getAction("SetBooleanPropertyAction.show_styles_in_tooltip");
              final JCommandToggleMenuButton showStylesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showStylesAction);
              showStylesAction.setSelected();
              showStylesButton.getActionModel().setSelected(showStylesAction.isSelected());
              popupmenu.addMenuButton(showStylesButton);
             
              final AFreeplaneAction modificationAction = context.getBuilder().getMode().getAction("CreationModificationPluginAction");
              final JCommandToggleMenuButton modificationButton = RibbonActionContributorFactory.createCommandToggleMenuButton(modificationAction);
              modificationAction.setSelected();
              modificationButton.getActionModel().setSelected(modificationAction.isSelected());
              popupmenu.addMenuButton(modificationButton);
             
            return popupmenu;
          }
        });
        band.addCommandButton(button, RibbonElementPriority.MEDIUM);
      }


      private void createNoteViewMenu(final RibbonBuildContext context, final JRibbonBand band) {       
        JCommandButton displayNotesButton = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_noteView")));
        displayNotesButton.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
        displayNotesButton.setPopupCallback(new PopupPanelCallback() {
          public JPopupPanel getPopupPanel(JCommandButton commandButton) {
            JCommandPopupMenu popupmenu = new JCommandPopupMenu();
           
            final ShowNotesInMapAction showNotesInMapAction = (ShowNotesInMapAction) context.getBuilder().getMode().getAction("ShowNotesInMapAction");
            final JCommandToggleMenuButton showNotedsInMapButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showNotesInMapAction);
            showNotesInMapAction.setSelected();
            showNotedsInMapButton.getActionModel().setSelected(showNotesInMapAction.isSelected());
              popupmenu.addMenuButton(showNotedsInMapButton);
             
            final SetBooleanMapPropertyAction showIconAction = (SetBooleanMapPropertyAction) context.getBuilder().getMode().getAction("SetBooleanMapPropertyAction.show_note_icons");
              final JCommandToggleMenuButton toggleButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showIconAction);
              showIconAction.setSelected();
              toggleButton.getActionModel().setSelected(showIconAction.isSelected());
              popupmenu.addMenuButton(toggleButton);
             
              JCommandMenuButton button = new JCommandMenuButton(TextUtils.removeTranslateComment(TextUtils.getText("note_window_location")), null);
              button.setDisplayState(CommandButtonDisplayState.MEDIUM);
              button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
              button.setPopupCallback(new PopupPanelCallback() {
                public JPopupPanel getPopupPanel(JCommandButton commandButton) {
                  JCommandPopupMenu popupmenu = new JCommandPopupMenu();
               
                  final SetNoteWindowPosition posTopAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.top");
                  final JCommandToggleMenuButton posTopButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posTopAction);             
                  popupmenu.addMenuButton(posTopButton);
                  posTopAction.setSelected();
                  posTopButton.getActionModel().setSelected(posTopAction.isSelected());
                 
                  final SetNoteWindowPosition posLeftAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.left");
                  final JCommandToggleMenuButton posLeftButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posLeftAction);             
                  popupmenu.addMenuButton(posLeftButton);
                  posLeftAction.setSelected();
                  posLeftButton.getActionModel().setSelected(posLeftAction.isSelected());
                 
                  final SetNoteWindowPosition posRightAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.right");
                  final JCommandToggleMenuButton posRightButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posRightAction);             
                  popupmenu.addMenuButton(posRightButton);
                  posRightAction.setSelected();
                  posRightButton.getActionModel().setSelected(posRightAction.isSelected());
                 
                  final SetNoteWindowPosition posBottomAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.bottom");
                  final JCommandToggleMenuButton posBottomButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posBottomAction);             
                  popupmenu.addMenuButton(posBottomButton);
                  posBottomAction.setSelected();
                  posBottomButton.getActionModel().setSelected(posBottomAction.isSelected());
                 
                  return popupmenu;
                }
              });             
              popupmenu.addMenuButton(button);
             
            return popupmenu;
          }
        });
        band.addCommandButton(displayNotesButton, RibbonElementPriority.MEDIUM);
      }

      private void createAttributeViewMenu(final RibbonBuildContext context, JRibbonBand band) {
        JCommandButton button = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_displayAttributes")));
        button.setDisplayState(CommandButtonDisplayState.MEDIUM);
        button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
        button.setPopupCallback(new PopupPanelCallback() {
          public JPopupPanel getPopupPanel(JCommandButton commandButton) {
            JCommandPopupMenu popupmenu = new JCommandPopupMenu();
           
            final AttributeViewTypeAction showSelectedAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("ShowSelectedAttributesAction");
            final JCommandToggleMenuButton showSelectedAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showSelectedAttributesAction);             
View Full Code Here


        final JCommandToggleButton italicButton = RibbonActionContributorFactory.createCommandToggleButton(action);
        addDefaultToggleHandler(context, action, italicButton);
        styleStrip.add(italicButton);
       
        action = context.getBuilder().getMode().getAction("NodeColorAction");
        JCommandButton button = RibbonActionContributorFactory.createCommandButton(action);
        addDefaultToggleHandler(context, action, button);
        styleStrip.add(button);
       
        action = context.getBuilder().getMode().getAction("NodeBackgroundColorAction");
        button = RibbonActionContributorFactory.createCommandButton(action);
        addDefaultToggleHandler(context, action, button);
        styleStrip.add(button);
       
        action = context.getBuilder().getMode().getAction("NodeColorBlendAction");
        button = RibbonActionContributorFactory.createCommandButton(action);
        addDefaultToggleHandler(context, action, button);
        styleStrip.add(button);
       
        action = context.getBuilder().getMode().getAction("BlinkingNodeHookAction");
        button = RibbonActionContributorFactory.createCommandButton(action);
        addDefaultToggleHandler(context, action, button);
        styleStrip.add(button);
       
        action = context.getBuilder().getMode().getAction("MapBackgroundColorAction");
        button = RibbonActionContributorFactory.createCommandButton(action);
        addDefaultToggleHandler(context, action, button);
        styleStrip.add(button);
               
        band.addFlowComponent(styleStrip);
       
        action = context.getBuilder().getMode().getAction("RemoveFormatAction");       
        button = RibbonActionContributorFactory.createCommandButton(action);
        button.setDisplayState(CommandButtonDisplayState.MEDIUM);       
        addDefaultToggleHandler(context, action, button);
        band.addFlowComponent(button);
       
        action = context.getBuilder().getMode().getAction("UsePlainTextAction");
        button = RibbonActionContributorFactory.createCommandButton(action);
        button.setDisplayState(CommandButtonDisplayState.MEDIUM);
        addDefaultToggleHandler(context, action, button);
        band.addFlowComponent(button);
       
        List<RibbonBandResizePolicy> policies = new ArrayList<RibbonBandResizePolicy>();       
        policies.add(new CoreRibbonResizePolicies.FlowThreeRows(band.getControlPanel()));
View Full Code Here

                new CoreRibbonResizePolicies.None(projetoBand.getControlPanel()),
                new CoreRibbonResizePolicies.None(projetoBand.getControlPanel()),
                new CoreRibbonResizePolicies.None(projetoBand.getControlPanel()),
                new IconRibbonBandResizePolicy(projetoBand.getControlPanel())));

        btnNovoProjeto = new JCommandButton(null, getResizableIconFromResource("new.png"));
        btnNovoProjeto.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                novoProjeto();
            }
        });
        btnAbrirProjeto = new JCommandButton(null, getResizableIconFromResource("open.png"));

        btnAbrirProjeto.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                AbreProjetoPresenter abreProjeto = new AbreProjetoPresenter();
                if (abreProjeto.getProjeto() != null) {
                    abreProjeto(abreProjeto.getProjeto());
                }
            }
        });

        btnFecharProjeto = new JCommandButton(null, getResizableIconFromResource("close.png"));
        btnFecharProjeto.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                projeto = null;
                state.fecharProjeto();
            }
        });

        JCommandButton btnArvores = new JCommandButton(null, getResizableIconFromResource("arvores.png"));

        projetoBand.addCommandButton(btnNovoProjeto, RibbonElementPriority.TOP);
        projetoBand.addCommandButton(btnAbrirProjeto, RibbonElementPriority.TOP);
        projetoBand.addCommandButton(btnFecharProjeto, RibbonElementPriority.TOP);
        projetoBand.addCommandButton(btnArvores, RibbonElementPriority.TOP);

        // Volume Band
        JRibbonBand volumeBand = new JRibbonBand("Volume", getResizableIconFromResource("exit.png"));

        volumeBand.setResizePolicies((List) Arrays.asList(
                new CoreRibbonResizePolicies.None(projetoBand.getControlPanel()),
                new CoreRibbonResizePolicies.None(projetoBand.getControlPanel()),
                new IconRibbonBandResizePolicy(projetoBand.getControlPanel())));

        btnVolumeNovoCenario = new JCommandButton(null, getResizableIconFromResource("newvolscenario.png"));
        btnVolumeNovoCenario.setActionRichTooltip(new RichTooltip("Cenário", "Cria um novo cenário"));
        btnVolumeNovoCenario.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                novoCenarioVolume();
            }
        });

        btnVolumeDuplicarCenario = new JCommandButton(null, getResizableIconFromResource("dupCenarioVolume.png"));
        btnVolumeDuplicarCenario.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                DuplicarCenarioPresenter dpCenario = new DuplicarCenarioPresenter(Main.this);

            }
        });


        volumeBand.addCommandButton(btnVolumeNovoCenario, RibbonElementPriority.TOP);
        volumeBand.addCommandButton(btnVolumeDuplicarCenario, RibbonElementPriority.TOP);


        JRibbonBand indLocalBand = new JRibbonBand("Índice de Local", getResizableIconFromResource("exit.png"));

        btnIndLocalNovoCenario = new JCommandButton(null, getResizableIconFromResource("newilscenario.png"));


        btnIndLocalNovoCenario.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                iLocal++;
                IconNode node = new IconNode("Cenário " + iLocal, true, new ImageIcon(Configuracao.getPath() + "images/cenario4.png"), IconNode.CENARIO_INDICELOCAL);
                addNode("Índice de Local", node);
            }
        });

        indLocalBand.addCommandButton(btnIndLocalNovoCenario, RibbonElementPriority.LOW);

        indLocalBand.setPreferredSize(new Dimension(100, 100));

        indLocalBand.setResizePolicies((List) Arrays.asList(
                new CoreRibbonResizePolicies.None(projetoBand.getControlPanel()),
                new IconRibbonBandResizePolicy(projetoBand.getControlPanel())));

        JRibbonBand dadosBand = new JRibbonBand("world!", null);
        dadosBand.setResizePolicies((List) Arrays.asList(new IconRibbonBandResizePolicy(dadosBand.getControlPanel())));

        JRibbonBand configuracoesBand = new JRibbonBand("Configurações", null);
        configuracoesBand.setResizePolicies((List) Arrays.asList(
                new CoreRibbonResizePolicies.None(configuracoesBand.getControlPanel())));

        JCommandButton btnConfiguracoes = new JCommandButton(null, getResizableIconFromResource("settings.png"));
        btnConfiguracoes.setActionRichTooltip(new RichTooltip("Configurações", "Permite alterar as configurações do sistema"));
        btnConfiguracoes.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ConfiguracoesView configuracoes = new ConfiguracoesView(null, true);
                configuracoes.setVisible(true);
            }
        });
        configuracoesBand.addCommandButton(btnConfiguracoes, RibbonElementPriority.TOP);

        JRibbonBand janelaBand = new JRibbonBand("Organizar", getResizableIconFromResource("exit.png"));
        janelaBand.setResizePolicies((List) Arrays.asList(
                new CoreRibbonResizePolicies.None(janelaBand.getControlPanel()),
                new CoreRibbonResizePolicies.None(janelaBand.getControlPanel()),
                new IconRibbonBandResizePolicy(janelaBand.getControlPanel())));
        JCommandButton btnLadoALado = new JCommandButton(null, getResizableIconFromResource("tile_vertical.png"));
        JCommandButton btnCascata = new JCommandButton(null, getResizableIconFromResource("cascade.png"));

        btnLadoALado.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                desktop.tileFrames();
            }
        });

        btnCascata.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                desktop.cascadeFrames();
            }
        });

        janelaBand.addCommandButton(btnLadoALado, RibbonElementPriority.MEDIUM);
        janelaBand.addCommandButton(btnCascata, RibbonElementPriority.MEDIUM);

        JRibbonBand modeloBand = new JRibbonBand("Modelos", getResizableIconFromResource("models.png"));

        modeloBand.setResizePolicies((List) Arrays.asList(
                new CoreRibbonResizePolicies.None(janelaBand.getControlPanel()),
                new IconRibbonBandResizePolicy(janelaBand.getControlPanel())));

        JCommandButton btnManterModelos = new JCommandButton(null, getResizableIconFromResource("models.png"));

        btnManterModelos.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                mantemModelos();
            }
View Full Code Here

  }

  private JCommandButton getAndJoinButton() {
   
    if (andJoinButton == null) {
      andJoinButton = new JCommandButton(Messages.getString("Forms.ANDJoin.text"), new forms_and_join());
      andJoinButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_DRAWMODE_ANDJOIN, AbstractViewEvent.DRAWMODE_ANDJOIN, andJoinButton));
      setTooltip(andJoinButton, "Forms.ANDJoin");
    }
   
    return andJoinButton;
View Full Code Here

    return andJoinButton;
  }

  private JCommandButton getXorSplitJoinButton() {
    if (xorSplitJoinButton == null) {
      xorSplitJoinButton = new JCommandButton(Messages.getString("Forms.XORSplitJoin.text"), new forms_xor_split_join());
      xorSplitJoinButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_DRAWMODE_XORSPLITJOIN, AbstractViewEvent.DRAWMODE_XORSPLITJOIN, xorSplitJoinButton));
      setTooltip(xorSplitJoinButton, "Forms.XORSplitJoin");
    }
   
    return xorSplitJoinButton;
View Full Code Here

  }

  private JCommandButton getAndSplitJoinButton() {
   
    if (andSplitJoinButton == null) {
      andSplitJoinButton = new JCommandButton(Messages.getString("Forms.ANDSplitJoin.text"), new forms_and_split_join());
      andSplitJoinButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_DRAWMODE_ANDSPLITJOIN, AbstractViewEvent.DRAWMODE_ANDSPLITJOIN, andSplitJoinButton));
      setTooltip(andSplitJoinButton, "Forms.ANDSplitJoin");
    }
   
    return andSplitJoinButton;
View Full Code Here

  }

  private JCommandButton getAndJoinXorSplitButton() {
   
    if (andJoinXorSplitButton == null) {
      andJoinXorSplitButton = new JCommandButton(Messages.getString("Forms.ANDJoinXORSplit.text"), new forms_and_join_xor_split());
      andJoinXorSplitButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_DRAWMODE_ANDJOINXORSPLIT, AbstractViewEvent.DRAWMODE_ANDJOIN_XORSPLIT, andJoinXorSplitButton));
      setTooltip(andJoinXorSplitButton, "Forms.ANDJoinXORSplit");
    }
   
    return andJoinXorSplitButton;
View Full Code Here

  }

  private JCommandButton getXorJoinAndSplitButton() {
   
    if (xorJoinAndSplitButton == null) {
      xorJoinAndSplitButton = new JCommandButton(Messages.getString("Forms.XORJoinANDSplit.text"), new forms_xor_join_and_split());
      xorJoinAndSplitButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_DRAWMODE_XORJOINANDSPLIT, AbstractViewEvent.DRAWMODE_XORJOIN_ANDSPLIT, xorJoinAndSplitButton));
      setTooltip(xorJoinAndSplitButton, "Forms.XORJoinANDSplit");
    }
   
    return xorJoinAndSplitButton;
View Full Code Here

  }

  private JCommandButton getSubprocessButton() {
   
    if (subprocessButton == null) {
      subprocessButton = new JCommandButton(Messages.getString("Forms.subprocess.text"), new forms_subprocess());
      subprocessButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_DRAWMODE_SUB, AbstractViewEvent.DRAWMODE_SUB, subprocessButton));
      setTooltip(subprocessButton, "Forms.subprocess");
    }
   
    return subprocessButton;
View Full Code Here

  }

  private JCommandButton getColoringButton() {
   
    if (coloringButton == null) {
      coloringButton = new JCommandButton(Messages.getString("Tools.coloring.text"), new analyze_coloring());
      coloringButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_COLORING, AbstractViewEvent.COLORING, coloringButton));
      setTooltip(coloringButton, "Tools.coloring");
    }
   
    return coloringButton;
View Full Code Here

TOP

Related Classes of org.pushingpixels.flamingo.api.common.JCommandButton$PopupHandler

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.