Examples of PopupButtonModel


Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

        .setPopupOrientationKind(CommandButtonPopupOrientationKind.SIDEWARD);
    button.setHGapScaleFactor(0.75);
    button.getPopupModel().addChangeListener(new ChangeListener() {
      @Override
      public void stateChanged(ChangeEvent e) {
        PopupButtonModel model = button.getPopupModel();
        boolean displayDownwards = model.isRollover()
            || model.isPopupShowing();
        CommandButtonPopupOrientationKind popupOrientationKind = displayDownwards ? CommandButtonPopupOrientationKind.DOWNWARD
            : CommandButtonPopupOrientationKind.SIDEWARD;
        button.setPopupOrientationKind(popupOrientationKind);
      }
    });
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

    // + (e.isTemporary() ? "temporary" : "permanent")
    // + " focus to \n\t" + e.getOppositeComponent());
    b.getActionModel().setArmed(false);
    b.getActionModel().setPressed(false);
    if (b instanceof JCommandButton) {
      PopupButtonModel popupModel = ((JCommandButton) b).getPopupModel();
      popupModel.setPressed(false);
      popupModel.setArmed(false);
    }
  }
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

            actionModel.setArmed(true);
            actionModel.setPressed(true);
          }
        } else {
          if ((popupRect != null) && popupRect.contains(e.getPoint())) {
            PopupButtonModel popupModel = ((JCommandButton) b)
                .getPopupModel();
            if (popupModel.isEnabled()) {
              popupModel.setArmed(true);
              popupModel.setPressed(true);
            }
          }
        }

        // System.err.println(b.getText() + " - hasFocus():"
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

   *            Mouse event for the model synchronization.
   */
  private void syncMouseMovement(MouseEvent e) {
    AbstractCommandButton b = (AbstractCommandButton) e.getSource();
    ButtonModel actionModel = b.getActionModel();
    PopupButtonModel popupModel = (b instanceof JCommandButton) ? ((JCommandButton) b)
        .getPopupModel()
        : null;
    CommandButtonUI ui = b.getUI();
    Rectangle actionRect = ui.getLayoutInfo().actionClickArea;
    Rectangle popupRect = ui.getLayoutInfo().popupClickArea;

    if ((actionRect != null) && actionRect.contains(e.getPoint())) {
      if (actionModel.isEnabled()) {
        if (!SwingUtilities.isLeftMouseButton(e))
          actionModel.setRollover(true);
        if (actionModel.isPressed())
          actionModel.setArmed(true);
      }
      if (popupModel != null && !SwingUtilities.isLeftMouseButton(e))
        popupModel.setRollover(false);
    } else {
      if ((popupRect != null) && popupRect.contains(e.getPoint())) {
        if ((popupModel != null) && popupModel.isEnabled()) {
          if (!SwingUtilities.isLeftMouseButton(e))
            popupModel.setRollover(true);
          if (popupModel.isPressed())
            popupModel.setArmed(true);
        }
        if (!SwingUtilities.isLeftMouseButton(e))
          actionModel.setRollover(false);
      }
    }
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

   * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
   */
  public void mouseExited(MouseEvent e) {
    AbstractCommandButton b = (AbstractCommandButton) e.getSource();
    ButtonModel actionModel = b.getActionModel();
    PopupButtonModel popupModel = (b instanceof JCommandButton) ? ((JCommandButton) b)
        .getPopupModel()
        : null;
    actionModel.setRollover(false);
    actionModel.setArmed(false);
    if (popupModel != null) {
      popupModel.setRollover(false);
      popupModel.setArmed(false);
    }
  };
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

          updateBorder();
        }

        if ("popupModel".equals(evt.getPropertyName())) {
          // rewire the popup action listener on the new popup model
          PopupButtonModel oldModel = (PopupButtonModel) evt
              .getOldValue();
          PopupButtonModel newModel = (PopupButtonModel) evt
              .getNewValue();

          if (oldModel != null) {
            oldModel.removePopupActionListener(popupActionListener);
            popupActionListener = null;
          }

          if (newModel != null) {
            popupActionListener = createPopupActionListener();
            newModel.addPopupActionListener(popupActionListener);
          }
        }
        if ("displayState".equals(evt.getPropertyName())) {
          syncIconDimension();
          syncDisabledIcon();
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

   * @param toFill
   *            Rectangle for the background.
   */
  protected void paintButtonBackground(Graphics graphics, Rectangle toFill) {
    ButtonModel actionModel = this.commandButton.getActionModel();
    PopupButtonModel popupModel = (this.commandButton instanceof JCommandButton) ? ((JCommandButton) this.commandButton)
        .getPopupModel()
        : null;

    // first time - paint the full background passing both models
    this.paintButtonBackground(graphics, toFill, actionModel, popupModel);

    Rectangle actionArea = this.getLayoutInfo().actionClickArea;
    Rectangle popupArea = this.getLayoutInfo().popupClickArea;
    if ((actionArea != null) && !actionArea.isEmpty()) {
      // now overlay the action area with the background matching action
      // model
      Graphics2D graphicsAction = (Graphics2D) graphics.create();
      // System.out.println(actionArea);
      graphicsAction.clip(actionArea);
      float actionAlpha = 0.4f;
      if ((popupModel != null) && !popupModel.isEnabled())
        actionAlpha = 1.0f;
      graphicsAction.setComposite(AlphaComposite.SrcOver
          .derive(actionAlpha));
      // System.out.println(graphicsAction.getClipBounds());
      this.paintButtonBackground(graphicsAction, toFill, actionModel);
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

   * Returns indication whether the action-popup areas separator is painted.
   *
   * @return <code>true</code> if the action-popup areas separator is painted.
   */
  protected boolean isPaintingSeparators() {
    PopupButtonModel popupModel = (this.commandButton instanceof JCommandButton) ? ((JCommandButton) this.commandButton)
        .getPopupModel()
        : null;
    boolean isActionRollover = this.commandButton.getActionModel()
        .isRollover();
    boolean isPopupRollover = (popupModel != null)
        && popupModel.isRollover();
    // Rectangle actionArea = this.getActionClickArea();
    // Rectangle popupArea = this.getPopupClickArea();
    // boolean hasNonEmptyAreas = (actionArea.width * actionArea.height
    // * popupArea.width * popupArea.height > 0);
    return // hasNonEmptyAreas &&
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

   * Returns indication whether the button background is painted.
   *
   * @return <code>true</code> if the button background is painted.
   */
  protected boolean isPaintingBackground() {
    PopupButtonModel popupModel = (this.commandButton instanceof JCommandButton) ? ((JCommandButton) this.commandButton)
        .getPopupModel()
        : null;
    boolean isActionSelected = this.commandButton.getActionModel()
        .isSelected();
    boolean isPopupSelected = (popupModel != null)
        && popupModel.isSelected();
    boolean isActionRollover = this.commandButton.getActionModel()
        .isRollover();
    boolean isPopupRollover = (popupModel != null)
        && popupModel.isRollover();
    boolean isPopupShowing = (popupModel != null)
        && (popupModel.isPopupShowing());
    boolean isActionArmed = this.commandButton.getActionModel().isArmed();
    boolean isPopupArmed = (popupModel != null) && (popupModel.isArmed());

    return (isActionSelected || isPopupSelected || isActionRollover
        || isPopupRollover || isPopupShowing || isActionArmed
        || isPopupArmed || !this.commandButton.isFlat());
  }
View Full Code Here

Examples of org.pushingpixels.flamingo.api.common.model.PopupButtonModel

   *            The new popup model for this button.
   * @see #getPopupModel()
   */
  public void setPopupModel(PopupButtonModel newModel) {

    PopupButtonModel oldModel = getPopupModel();

    if (oldModel != null) {
      oldModel.removeChangeListener(this.popupHandler);
      oldModel.removeActionListener(this.popupHandler);
    }

    this.popupModel = newModel;

    if (newModel != null) {
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.