Examples of RibbonTask


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

  }
 
  private RibbonTask getTokengameTask() {
   
    if (tokengameTask == null) {
      tokengameTask = new RibbonTask(Messages.getTitle("Task.Tokengame"), getTokengameCloseBand(), getTokengameStepBand(), getTokengameAutoBand());
      tokengameTask.setResizeSequencingPolicy(new CoreRibbonResizeSequencingPolicies.CollapseFromLast(tokengameTask));
    }
   
    return tokengameTask;
  }
View Full Code Here

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

 
  private RibbonTask getRegistrationTask() {
   
    if(registrationTask == null){
      //registrationTask = new RibbonTask(Messages.getTitle("Task.Registration"), getRegistrationBand());     
      registrationTask = new RibbonTask("Registration", getSocialMediaBand(), getRegistrationBand());     
      registrationTask.setResizeSequencingPolicy(new CoreRibbonResizeSequencingPolicies.CollapseFromLast(registrationTask));
     
    }
    return registrationTask;
  }
View Full Code Here

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

      g2d.setPaint(paint);

      Set<RibbonTask> tasksWithTrailingSeparators = new HashSet<RibbonTask>();
      // add all regular tasks except the last
      for (int i = 0; i < ribbon.getTaskCount() - 1; i++) {
        RibbonTask task = ribbon.getTask(i);
        tasksWithTrailingSeparators.add(task);
        // System.out.println("Added " + task.getTitle());
      }
      // add all tasks of visible contextual groups except last task in
      // each group
      for (int i = 0; i < ribbon.getContextualTaskGroupCount(); i++) {
        RibbonContextualTaskGroup group = ribbon
            .getContextualTaskGroup(i);
        if (ribbon.isVisible(group)) {
          for (int j = 0; j < group.getTaskCount() - 1; j++) {
            RibbonTask task = group.getTask(j);
            tasksWithTrailingSeparators.add(task);
            // System.out.println("Added " + task.getTitle());
          }
        }
      }
View Full Code Here

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

    this.propertyChangeListener = new PropertyChangeListener() {
      @Override
      public void propertyChange(PropertyChangeEvent evt) {
        if ("selectedTask".equals(evt.getPropertyName())) {
          RibbonTask old = (RibbonTask) evt.getOldValue();
          final RibbonTask curr = (RibbonTask) evt.getNewValue();
          if ((old != null) && (taskToggleButtons.get(old) != null)) {
            taskToggleButtons.get(old).getActionModel()
                .setSelected(false);
          }
          if ((curr != null) && (taskToggleButtons.get(curr) != null)) {
View Full Code Here

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

    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setColor(FlamingoUtilities.getBorderColor());
    g2d.draw(outerContour);

    // check whether the currently selected task is a contextual task
    RibbonTask selected = this.ribbon.getSelectedTask();
    RibbonContextualTaskGroup contextualGroup = selected
        .getContextualGroup();
    if (contextualGroup != null) {
      // paint a small gradient directly below the task area
      Insets ins = this.ribbon.getInsets();
      int topY = ins.top + getTaskbarHeight();
View Full Code Here

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

    }

    // go over all visible ribbon tasks and create a toggle button
    // for each one of them
    List<RibbonTask> visibleTasks = this.getCurrentlyShownRibbonTasks();
    final RibbonTask selectedTask = this.ribbon.getSelectedTask();
    for (final RibbonTask task : visibleTasks) {
      final JRibbonTaskToggleButton taskToggleButton = new JRibbonTaskToggleButton(
          task);
      taskToggleButton.setKeyTip(task.getKeyTip());
      // wire listener to select the task when the button is
      // selected
      taskToggleButton.addActionListener(new ActionListener() {
        @Override
                public void actionPerformed(ActionEvent e) {
          SwingUtilities.invokeLater(new Runnable() {
            @Override
                        public void run() {
              scrollAndRevealTaskToggleButton(taskToggleButton);

              ribbon.setSelectedTask(task);

              // System.out.println("Button click on "
              // + task.getTitle() + ", ribbon minimized? "
              // + ribbon.isMinimized());

              if (ribbon.isMinimized()) {
                if (Boolean.TRUE.equals(ribbon
                    .getClientProperty(JUST_MINIMIZED))) {
                  ribbon.putClientProperty(JUST_MINIMIZED,
                      null);
                  return;
                }

                // special case - do we have this task currently
                // shown in a popup?
                List<PopupPanelManager.PopupInfo> popups = PopupPanelManager
                    .defaultManager().getShownPath();
                if (popups.size() > 0) {
                  for (PopupPanelManager.PopupInfo popup : popups) {
                    if (popup.getPopupOriginator() == taskToggleButton) {
                      // hide all popups and return (hides
                      // the task popup and does not
                      // show any additional popup).
                      PopupPanelManager.defaultManager()
                          .hidePopups(null);
                      return;
                    }
                  }
                }

                PopupPanelManager.defaultManager().hidePopups(
                    null);
                ribbon.remove(bandScrollablePanel);

                int prefHeight = bandScrollablePanel.getView()
                    .getPreferredSize().height;
                Insets ins = ribbon.getInsets();
                prefHeight += ins.top + ins.bottom;
                AbstractRibbonBand band = (ribbon
                    .getSelectedTask().getBandCount() > 0) ? ribbon
                    .getSelectedTask().getBand(0)
                    : null;
                if (band != null) {
                  Insets bandIns = band.getInsets();
                  prefHeight += bandIns.top + bandIns.bottom;
                }

                // System.out.println(prefHeight
                // + ":"
                // + bandScrollablePanel.getView()
                // .getComponentCount());

                JPopupPanel popupPanel = new BandHostPopupPanel(
                    bandScrollablePanel, new Dimension(
                        ribbon.getWidth(), prefHeight));

                int x = ribbon.getLocationOnScreen().x;
                int y = ribbon.getLocationOnScreen().y
                    + ribbon.getHeight();

                // make sure that the popup stays in
                // bounds
                Rectangle scrBounds = ribbon
                    .getGraphicsConfiguration().getBounds();
                int pw = popupPanel.getPreferredSize().width;
                if ((x + pw) > (scrBounds.x + scrBounds.width)) {
                  x = scrBounds.x + scrBounds.width - pw;
                }
                int ph = popupPanel.getPreferredSize().height;
                if ((y + ph) > (scrBounds.y + scrBounds.height)) {
                  y = scrBounds.y + scrBounds.height - ph;
                }

                // get the popup and show it
                popupPanel.setPreferredSize(new Dimension(
                    ribbon.getWidth(), prefHeight));
                Popup popup = PopupFactory.getSharedInstance()
                    .getPopup(taskToggleButton, popupPanel,
                        x, y);
                PopupPanelManager.PopupListener tracker = new PopupPanelManager.PopupListener() {
                  @Override
                  public void popupShown(PopupEvent event) {
                    JComponent originator = event
                        .getPopupOriginator();
                    if (originator instanceof JRibbonTaskToggleButton) {
                      bandScrollablePanel.doLayout();
                      bandScrollablePanel.repaint();
                    }
                  }

                  @Override
                  public void popupHidden(PopupEvent event) {
                    JComponent originator = event
                        .getPopupOriginator();
                    if (originator instanceof JRibbonTaskToggleButton) {
                      ribbon.add(bandScrollablePanel);
                      PopupPanelManager.defaultManager()
                          .removePopupListener(this);
                      ribbon.revalidate();
                      ribbon.doLayout();
                      ribbon.repaint();
                    }
                  }
                };
                PopupPanelManager.defaultManager()
                    .addPopupListener(tracker);
                PopupPanelManager.defaultManager().addPopup(
                    taskToggleButton, popup, popupPanel);
              }
            }
          });
        }
      });
      // wire listener to toggle ribbon minimization on double
      // mouse click
      taskToggleButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
          if ((ribbon.getSelectedTask() == task)
              && (e.getClickCount() == 2)) {
            boolean wasMinimized = ribbon.isMinimized();
            ribbon.setMinimized(!wasMinimized);
            if (!wasMinimized) {
              // fix for issue 69 - mark the ribbon as
              // "just minimized" to prevent the action handler
              // of the toggle button to show the ribbon in
              // popup mode
              ribbon.putClientProperty(JUST_MINIMIZED,
                  Boolean.TRUE);
            }
          }
        }
      });
      // set the background hue color on the tab buttons
      // of tasks in contextual groups
      if (task.getContextualGroup() != null) {
        taskToggleButton.setContextualGroupHueColor(task
            .getContextualGroup().getHueColor());
      }

      taskToggleButton.putClientProperty(
          BasicCommandButtonUI.DONT_DISPOSE_POPUPS, Boolean.TRUE);

      this.taskToggleButtonGroup.add(taskToggleButton);
      taskToggleButtonsHostPanel.add(taskToggleButton);
      this.taskToggleButtons.put(task, taskToggleButton);
    }

    JRibbonTaskToggleButton toSelect = this.taskToggleButtons
        .get(selectedTask);
    if (toSelect != null) {
      toSelect.getActionModel().setSelected(true);
    }

    for (int i = 0; i < this.ribbon.getTaskCount(); i++) {
      RibbonTask task = this.ribbon.getTask(i);
      for (AbstractRibbonBand band : task.getBands()) {
        bandHostPanel.add(band);
        band.setVisible(selectedTask == task);
      }
    }
    for (int i = 0; i < this.ribbon.getContextualTaskGroupCount(); i++) {
      RibbonContextualTaskGroup taskGroup = this.ribbon
          .getContextualTaskGroup(i);
      for (int j = 0; j < taskGroup.getTaskCount(); j++) {
        RibbonTask task = taskGroup.getTask(j);
        for (AbstractRibbonBand band : task.getBands()) {
          bandHostPanel.add(band);
          band.setVisible(selectedTask == task);
        }
      }
    }
View Full Code Here

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

  protected List<RibbonTask> getCurrentlyShownRibbonTasks() {
    List<RibbonTask> result = new ArrayList<RibbonTask>();

    // add all regular tasks
    for (int i = 0; i < this.ribbon.getTaskCount(); i++) {
      RibbonTask task = this.ribbon.getTask(i);
      result.add(task);
    }
    // add all tasks of visible contextual groups
    for (int i = 0; i < this.ribbon.getContextualTaskGroupCount(); i++) {
      RibbonContextualTaskGroup group = this.ribbon
          .getContextualTaskGroup(i);
      if (this.ribbon.isVisible(group)) {
        for (int j = 0; j < group.getTaskCount(); j++) {
          RibbonTask task = group.getTask(j);
          result.add(task);
        }
      }
    }
View Full Code Here

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

      Insets ins = c.getInsets();
      int maxPrefBandHeight = 0;
      boolean isRibbonMinimized = ribbon.isMinimized();
      if (!isRibbonMinimized) {
        if (ribbon.getTaskCount() > 0) {
          RibbonTask selectedTask = ribbon.getSelectedTask();
          for (AbstractRibbonBand<?> ribbonBand : selectedTask
              .getBands()) {
            int bandPrefHeight = ribbonBand.getPreferredSize().height;
            Insets bandInsets = ribbonBand.getInsets();
            maxPrefBandHeight = Math.max(maxPrefBandHeight,
                bandPrefHeight + bandInsets.top
View Full Code Here

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

        extraHeight += getTaskbarHeight();

      if (ribbon.getTaskCount() > 0) {
        boolean isRibbonMinimized = ribbon.isMinimized();
        // minimum is when all the tasks are collapsed
        RibbonTask selectedTask = ribbon.getSelectedTask();
        for (AbstractRibbonBand ribbonBand : selectedTask.getBands()) {
          int bandPrefHeight = ribbonBand.getMinimumSize().height;
          Insets bandInsets = ribbonBand.getInsets();
          RibbonBandUI bandUI = ribbonBand.getUI();
          width += bandUI.getPreferredCollapsedWidth();
          if (!isRibbonMinimized) {
            maxMinBandHeight = Math.max(maxMinBandHeight,
                bandPrefHeight + bandInsets.top
                    + bandInsets.bottom);
          }
        }
        // add inter-band gaps
        width += gap * (selectedTask.getBandCount() - 1);
      } else {
        // fix for issue 44 (empty ribbon)
        width = 50;
      }
      return new Dimension(width, maxMinBandHeight + extraHeight
View Full Code Here

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

    @Override
        public Dimension preferredLayoutSize(Container c) {
      // Insets ins = c.getInsets();
      int maxPrefBandHeight = 0;
      if (ribbon.getTaskCount() > 0) {
        RibbonTask selectedTask = ribbon.getSelectedTask();
        for (AbstractRibbonBand<?> ribbonBand : selectedTask.getBands()) {
          int bandPrefHeight = ribbonBand.getPreferredSize().height;
          Insets bandInsets = ribbonBand.getInsets();
          maxPrefBandHeight = Math
              .max(maxPrefBandHeight, bandPrefHeight
                  + bandInsets.top + bandInsets.bottom);
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.