Examples of JRibbonComponent


Examples of org.pushingpixels.flamingo.api.ribbon.JRibbonComponent

        band.setCollapsedStateKeyTip("ZF");

        MUIFactory uiFactory = Controller.getCurrentModeController().getExtension(MUIFactory.class);

        final Container fontBox = uiFactory.createFontBox();
        JRibbonComponent fontComboWrapper = new JRibbonComponent((JComponent) fontBox);
        fontComboWrapper.setKeyTip("SF");
        addDefaultToggleHandler(context, fontComboWrapper);
        band.addFlowComponent(fontComboWrapper);

        final Container sizeBox = uiFactory.createSizeBox();
        JRibbonComponent sizeComboWrapper = new JRibbonComponent((JComponent) sizeBox);
        sizeComboWrapper.setKeyTip("SS");
        addDefaultToggleHandler(context, sizeComboWrapper);
        band.addFlowComponent(sizeComboWrapper);

        final Container styleBox = uiFactory.createStyleBox();
        JRibbonComponent styleComboWrapper = new JRibbonComponent((JComponent) styleBox);
        styleComboWrapper.setKeyTip("SD");
        addDefaultToggleHandler(context, styleComboWrapper);
        band.addFlowComponent(styleComboWrapper);

        JCommandButtonStrip styleStrip = new JCommandButtonStrip();
View Full Code Here

Examples of org.pushingpixels.flamingo.api.ribbon.JRibbonComponent

 
  private JRibbonComponent getOverviewComponent() {
   
    if (overviewComponent == null) {
      overviewCheckbox = new JCheckBox(Messages.getString("Sidebar.Overview.Title"));
      overviewComponent = new JRibbonComponent(overviewCheckbox);
      overviewCheckbox.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_SHOWOVERVIEW, AbstractViewEvent.VIEWEVENTTYPE_GUI, overviewCheckbox));
      overviewCheckbox.setToolTipText(Messages.getString("Sidebar.Overview.Tooltip"));
    }
   
    return overviewComponent;
View Full Code Here

Examples of org.pushingpixels.flamingo.api.ribbon.JRibbonComponent

  private JRibbonComponent getTreeviewComponent() {
   
    if (treeviewComponent == null) {
      treeviewCheckbox = new JCheckBox(Messages.getString("Sidebar.Treeview.Title"));
      treeviewComponent = new JRibbonComponent(treeviewCheckbox);
      treeviewCheckbox.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_SHOWTREEVIEW, AbstractViewEvent.VIEWEVENTTYPE_GUI, treeviewCheckbox));
      treeviewCheckbox.setToolTipText(Messages.getString("Sidebar.Treeview.Tooltip"));
    }
   
    return treeviewComponent;
View Full Code Here

Examples of org.pushingpixels.flamingo.api.ribbon.JRibbonComponent

    }
  }

  @Override
  public void paint(Graphics g, JComponent c) {
    JRibbonComponent ribbonComp = (JRibbonComponent) c;
    if (isIconVisible(this.ribbonComponent.getDisplayPriority())) {
      Insets ins = ribbonComp.getInsets();
      ResizableIcon icon = ribbonComp.isEnabled() ? ribbonComp.getIcon()
          : this.disabledIcon;
      if (icon != null) {
        int availableHeight = ribbonComp.getHeight() - ins.top
            - ins.bottom;
        int iconY = Math.max(0, ins.top
            + (availableHeight - icon.getIconHeight()) / 2);
        if (ribbonComp.getComponentOrientation().isLeftToRight()) {
          paintIcon(g, ribbonComp, icon, ins.left, iconY);
        } else {
          paintIcon(g, ribbonComp, icon, ribbonComp.getWidth()
              - ins.right - icon.getIconWidth(), iconY);
        }
      }
    }
  }
View Full Code Here

Examples of org.pushingpixels.flamingo.api.ribbon.JRibbonComponent

      return getPreferredSize(ribbonComponent.getDisplayPriority());
    }

    @Override
    public void layoutContainer(Container parent) {
      JRibbonComponent ribbonComp = (JRibbonComponent) parent;
      Insets ins = ribbonComp.getInsets();
      int gap = getLayoutGap();
      int availableHeight = ribbonComp.getHeight() - ins.top - ins.bottom;
      int availableWidth = ribbonComp.getWidth() - ins.left - ins.right;

      HorizontalAlignment horizAlignment = ribbonComp
          .getHorizontalAlignment();
      JComponent mainComp = ribbonComp.getMainComponent();
      Dimension prefMainDim = mainComp.getPreferredSize();
      int prefMainWidth = prefMainDim.width;
      int finalHeight = Math.min(prefMainDim.height, availableHeight);
      boolean ltr = ribbonComp.getComponentOrientation().isLeftToRight();

      if (ribbonComp.isSimpleWrapper()) {
        int finalMainWidth = Math.min(availableWidth, prefMainWidth);
        int offset = availableWidth - prefMainWidth;
        int topMain = ins.top + (availableHeight - finalHeight) / 2;
        int x = ltr ? ins.left : ribbonComp.getWidth() - ins.right;
        switch (horizAlignment) {
        case LEADING:
          if (ltr) {
            mainComp.setBounds(x, topMain, finalMainWidth,
                finalHeight);
          } else {
            mainComp.setBounds(x - finalMainWidth, topMain,
                finalMainWidth, finalHeight);
          }
          break;
        case TRAILING:
          if (ltr) {
            mainComp.setBounds(x + offset, topMain, finalMainWidth,
                finalHeight);
          } else {
            mainComp.setBounds(x - finalMainWidth - offset,
                topMain, finalMainWidth, finalHeight);
          }
          break;
        case CENTER:
          if (ltr) {
            mainComp.setBounds(x + offset / 2, topMain,
                finalMainWidth, finalHeight);
          } else {
            mainComp.setBounds(x - finalMainWidth - offset / 2,
                topMain, finalMainWidth, finalHeight);
          }
          break;
        case FILL:
          if (ltr) {
            mainComp.setBounds(x, topMain, availableWidth,
                finalHeight);
          } else {
            mainComp.setBounds(x - availableWidth, topMain,
                availableWidth, finalHeight);
          }
          break;
        }
        mainComp.doLayout();
      } else {
        int x = ltr ? ins.left : ribbonComp.getWidth() - ins.right;
        if (isIconVisible(ribbonComponent.getDisplayPriority())) {
          if (ribbonComp.getIcon() != null) {
            // icon is painted separately
            int iconW = ribbonComp.getIcon().getIconWidth();
            x = ltr ? x + iconW + gap : x - iconW - gap;
          }
        }

        if (isCaptionVisible(ribbonComponent.getDisplayPriority())) {
          captionLabel.setVisible(true);
          Dimension prefCaptionDim = captionLabel.getPreferredSize();
          if (ltr) {
            captionLabel
                .setBounds(
                    x,
                    ins.top
                        + (availableHeight - prefCaptionDim.height)
                        / 2, prefCaptionDim.width,
                    prefCaptionDim.height);
            x += (prefCaptionDim.width + gap);
          } else {
            captionLabel
                .setBounds(
                    x - prefCaptionDim.width,
                    ins.top
                        + (availableHeight - prefCaptionDim.height)
                        / 2, prefCaptionDim.width,
                    prefCaptionDim.height);
            x -= (prefCaptionDim.width + gap);
          }
        } else {
          captionLabel.setVisible(false);
        }

        int topMain = ins.top + (availableHeight - finalHeight) / 2;
        int finalMainWidth = ltr ? Math.min(ribbonComp.getWidth()
            - ins.right - x, prefMainWidth) : Math.min(
            x - ins.left, prefMainWidth);
        int offset = ltr ? ribbonComp.getWidth() - ins.right - x
            - prefMainWidth : x - prefMainWidth - ins.left;

        switch (horizAlignment) {
        case LEADING:
          if (ltr) {
            mainComp.setBounds(x, topMain, finalMainWidth,
                finalHeight);
          } else {
            mainComp.setBounds(x - finalMainWidth, topMain,
                finalMainWidth, finalHeight);
          }
          break;
        case TRAILING:
          if (ltr) {
            mainComp.setBounds(x + offset, topMain, finalMainWidth,
                finalHeight);
          } else {
            mainComp.setBounds(x - finalMainWidth - offset,
                topMain, finalMainWidth, finalHeight);
          }
          break;
        case CENTER:
          if (ltr) {
            mainComp.setBounds(x + offset / 2, topMain,
                finalMainWidth, finalHeight);
          } else {
            mainComp.setBounds(x - finalMainWidth - offset / 2,
                topMain, finalMainWidth, finalHeight);
          }
          break;
        case FILL:
          if (ltr) {
            mainComp.setBounds(x, topMain, ribbonComp.getWidth()
                - ins.right - x, finalHeight);
          } else {
            mainComp.setBounds(ins.left, topMain, x - ins.left,
                finalHeight);
          }
View Full Code Here

Examples of org.pushingpixels.flamingo.api.ribbon.JRibbonComponent

    String title=getString(name+".Title");
    JRibbonBand result=new JRibbonBand(title,null);

    JComponent customComponent=customBandsGenerator.createRibbonComponent(name);
    if (customComponent!=null){
      JRibbonComponent ribbonComponent;
      if (customComponent instanceof JRibbonComponent)
        ribbonComponent=(JRibbonComponent)customComponent;
      else ribbonComponent=new JRibbonComponent(customComponent);
      result.addRibbonComponent(ribbonComponent,3);
      return result;
    }   
   
    @SuppressWarnings("unchecked")
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.