Package org.pushingpixels.flamingo.internal.ui.ribbon

Examples of org.pushingpixels.flamingo.internal.ui.ribbon.JRibbonTaskToggleButton


  }

  public void testMinimizeWithMouse() throws Exception {
    assertFalse(this.ribbon.isMinimized());

    JRibbonTaskToggleButton taskButton = getTaskButton(this.ribbon, "Task");
    assertNotNull(taskButton);

    Robot robot = new Robot();
    // set enough delay to emulate double mouse click
    robot.setAutoDelay(20);
    // move the mouse to the center of the task toggle button
    Point taskButtonLoc = taskButton.getLocationOnScreen();
    robot.mouseMove(taskButtonLoc.x + taskButton.getWidth() / 2,
        taskButtonLoc.y + taskButton.getHeight() / 2);
    // emulate double click
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
View Full Code Here


  }

  public void testMinimizeAndPopup() throws Exception {
    this.ribbon.setMinimized(true);

    JRibbonTaskToggleButton taskButton = getTaskButton(this.ribbon, "Task");
    assertNotNull(taskButton);

    Robot robot = new Robot();
    // move the mouse to the center of the task toggle button
    Point taskButtonLoc = taskButton.getLocationOnScreen();
    robot.mouseMove(taskButtonLoc.x + taskButton.getWidth() / 2,
        taskButtonLoc.y + taskButton.getHeight() / 2);

    // mouse press should show the ribbon in popup
    robot.mousePress(InputEvent.BUTTON1_MASK);
    Thread.sleep(100);
    assertTrue(this.ribbon.isMinimized());
View Full Code Here

    }

    if (c instanceof Container) {
      Container cont = (Container) c;
      for (int i = 0; i < cont.getComponentCount(); i++) {
        JRibbonTaskToggleButton result = getTaskButton(cont
            .getComponent(i), title);
        if (result != null)
          return result;
      }
    }
View Full Code Here

  }

  public void testCommandButtonPopupInMinimizedRibbon() throws Exception {
    this.ribbon.setMinimized(true);

    JRibbonTaskToggleButton taskButton = getTaskButton(this.ribbon, "Task");
    assertNotNull(taskButton);

    Robot robot = new Robot();
    // move the mouse to the center of the task toggle button
    Point taskButtonLoc = taskButton.getLocationOnScreen();
    robot.mouseMove(taskButtonLoc.x + taskButton.getWidth() / 2,
        taskButtonLoc.y + taskButton.getHeight() / 2);

    // mouse press should show the ribbon in popup
    robot.mousePress(InputEvent.BUTTON1_MASK);
    Thread.sleep(200);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
View Full Code Here

  }

  public void testCommandButtonPopupInMinimizedRibbon2() throws Exception {
    this.ribbon.setMinimized(true);

    JRibbonTaskToggleButton taskButton = getTaskButton(this.ribbon, "Task");
    assertNotNull(taskButton);

    Robot robot = new Robot();
    // move the mouse to the center of the task toggle button
    Point taskButtonLoc = taskButton.getLocationOnScreen();
    robot.mouseMove(taskButtonLoc.x + taskButton.getWidth() / 2,
        taskButtonLoc.y + taskButton.getHeight() / 2);

    // mouse press should show the ribbon in popup
    robot.mousePress(InputEvent.BUTTON1_MASK);
    Thread.sleep(200);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
View Full Code Here

          }
        }
      }

      for (RibbonTask taskWithTrailingSeparator : tasksWithTrailingSeparators) {
        JRibbonTaskToggleButton taskToggleButton = taskToggleButtons
            .get(taskWithTrailingSeparator);
        Rectangle bounds = taskToggleButton.getBounds();
        int x = bounds.x + bounds.width + getTabButtonGap() / 2 - 1;
        g2d.drawLine(x, 0, x, getHeight());
        // System.out.println(taskWithTrailingSeparator.getTitle() + ":"
        // + x);
      }
View Full Code Here

      int taskToggleButtonHeight = getTaskToggleButtonHeight();

      int totalTaskButtonsWidth = 0;
      List<RibbonTask> visibleTasks = getCurrentlyShownRibbonTasks();
      for (RibbonTask task : visibleTasks) {
        JRibbonTaskToggleButton tabButton = taskToggleButtons.get(task);
        int pw = tabButton.getPreferredSize().width;
        totalTaskButtonsWidth += (pw + tabButtonGap);
      }

      return new Dimension(totalTaskButtonsWidth, taskToggleButtonHeight);
    }
View Full Code Here

      int taskToggleButtonHeight = getTaskToggleButtonHeight();

      int totalTaskButtonsWidth = 0;
      List<RibbonTask> visibleTasks = getCurrentlyShownRibbonTasks();
      for (RibbonTask task : visibleTasks) {
        JRibbonTaskToggleButton tabButton = taskToggleButtons.get(task);
        int pw = tabButton.getMinimumSize().width;
        totalTaskButtonsWidth += (pw + tabButtonGap);
      }

      return new Dimension(totalTaskButtonsWidth, taskToggleButtonHeight);
    }
View Full Code Here

      int totalMinWidth = 0;
      List<RibbonTask> visibleTasks = getCurrentlyShownRibbonTasks();
      Map<JRibbonTaskToggleButton, Integer> diffMap = new HashMap<JRibbonTaskToggleButton, Integer>();
      int totalDiff = 0;
      for (RibbonTask task : visibleTasks) {
        JRibbonTaskToggleButton tabButton = taskToggleButtons.get(task);
        int pw = tabButton.getPreferredSize().width;
        int mw = tabButton.getMinimumSize().width;
        diffMap.put(tabButton, pw - mw);
        totalDiff += (pw - mw);
        totalPrefWidth += pw;
        totalMinWidth += mw;
      }
      totalPrefWidth += tabButtonGap * visibleTasks.size();
      totalMinWidth += tabButtonGap * visibleTasks.size();

      boolean ltr = c.getComponentOrientation().isLeftToRight();

      // do we have enough width?
      if (totalPrefWidth <= c.getWidth()) {
        // compute bounds for the tab buttons
        int x = ltr ? 0 : c.getWidth();
        for (RibbonTask task : visibleTasks) {
          JRibbonTaskToggleButton tabButton = taskToggleButtons
              .get(task);
          int pw = tabButton.getPreferredSize().width;
          if (ltr) {
            tabButton.setBounds(x, y + 1, pw,
                taskToggleButtonHeight - 1);
            x += (pw + tabButtonGap);
          } else {
            tabButton.setBounds(x - pw, y + 1, pw,
                taskToggleButtonHeight - 1);
            x -= (pw + tabButtonGap);
          }
          tabButton.setActionRichTooltip(null);
        }
        ((JComponent) c).putClientProperty(
            TaskToggleButtonsHostPanel.IS_SQUISHED, null);
      } else {
        if (totalMinWidth > c.getWidth()) {
          throw new IllegalStateException(
              "Available width not enough to host minimized task tab buttons");
        }
        int x = ltr ? 0 : c.getWidth();
        // how much do we need to take from each toggle button?
        int toDistribute = totalPrefWidth - c.getWidth() + 2;
        for (RibbonTask task : visibleTasks) {
          JRibbonTaskToggleButton tabButton = taskToggleButtons
              .get(task);
          int pw = tabButton.getPreferredSize().width;
          int delta = (toDistribute * diffMap.get(tabButton) / totalDiff);
          int finalWidth = pw - delta;
          if (ltr) {
            tabButton.setBounds(x, y + 1, finalWidth,
                taskToggleButtonHeight - 1);
            x += (finalWidth + tabButtonGap);
          } else {
            tabButton.setBounds(x - finalWidth, y + 1, finalWidth,
                taskToggleButtonHeight - 1);
            x -= (finalWidth + tabButtonGap);
          }
          // show the tooltip with the full title
          RichTooltip tooltip = new RichTooltip();
          tooltip.setTitle(task.getTitle());
          tabButton.setActionRichTooltip(tooltip);
        }
        ((JComponent) c).putClientProperty(
            TaskToggleButtonsHostPanel.IS_SQUISHED, Boolean.TRUE);
      }
    }
View Full Code Here

          if (isShowingScrollsForTaskToggleButtons()
              && (curr != null)) {
            // scroll selected task as necessary so that it's
            // visible
            JRibbonTaskToggleButton toggleButton = taskToggleButtons
                .get(curr);
            if (toggleButton != null) {
              scrollAndRevealTaskToggleButton(toggleButton);
            }
          }
View Full Code Here

TOP

Related Classes of org.pushingpixels.flamingo.internal.ui.ribbon.JRibbonTaskToggleButton

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.