示例#1
0
  private void showContextMenu(double x, double y) {
    if (contextMenu != null && contextMenu.isShowing()) contextMenu.hide();
    contextMenu = new ContextMenu();
    // contextMenu.getStyleClass().add("background");

    Color bg = cfg.colorProperty().getValue();
    Color fg = bg.getBrightness() < 0.5f ? Color.WHITE : Color.BLACK;

    contextMenu.setStyle(background(bg, true));

    contextMenu.setOnHidden(
        value -> {
          if (cfg.autoHideProperty().get() && !arePopupsOpen()) maybeHideDock();
        });
    if (!cfg.autoHideProperty().get()) {
      MenuItem hide = new MenuItem(resources.getString("menu.hide"));
      hide.setOnAction(value -> getStage().setIconified(true));
      hide.setStyle(textFill(fg));
      contextMenu.getItems().add(hide);
    }
    MenuItem close = new MenuItem(resources.getString("menu.exit"));
    close.setOnAction(
        value -> {
          context.confirmExit();
          maybeHideDock();
        });
    close.setStyle(textFill(fg));
    contextMenu.getItems().add(close);
    Point2D loc = new Point2D(x + getStage().getX(), y + getStage().getY());
    contextMenu.show(dockContent, loc.getX(), loc.getY());
  }
 /*     */ protected void handleControlPropertyChanged(String paramString) /*     */ {
   /*  72 */ super.handleControlPropertyChanged(paramString);
   /*  73 */ if (paramString == "DEFAULT_BUTTON") {
     /*  74 */ setDefaultButton(((Button) getSkinnable()).isDefaultButton());
     /*     */ }
   /*  76 */ else if (paramString == "CANCEL_BUTTON") {
     /*  77 */ setCancelButton(((Button) getSkinnable()).isCancelButton());
     /*     */ }
   /*  79 */ else if (paramString == "FOCUSED") {
     /*  80 */ if (!((Button) getSkinnable()).isFocused()) {
       /*  81 */ ContextMenu localContextMenu = ((Button) getSkinnable()).getContextMenu();
       /*  82 */ if ((localContextMenu != null) && /*  83 */ (localContextMenu.isShowing())) {
         /*  84 */ localContextMenu.hide();
         /*  85 */ Utils.removeMnemonics(localContextMenu, ((Button) getSkinnable()).getScene());
         /*     */ }
       /*     */ }
     /*     */ }
   /*  89 */ else if ((paramString == "PARENT")
       &&
       /*  90 */ (((Button) getSkinnable()).getParent() == null)
       && (getScene() != null)) {
     /*  91 */ if (((Button) getSkinnable()).isDefaultButton()) {
       /*  92 */ getScene().getAccelerators().remove(this.defaultAcceleratorKeyCodeCombination);
       /*     */ }
     /*  94 */ if (((Button) getSkinnable()).isCancelButton())
       /*  95 */ getScene().getAccelerators().remove(this.cancelAcceleratorKeyCodeCombination);
     /*     */ }
   /*     */ }
示例#3
0
 @FXML
 private void evtMouseExit(MouseEvent evt) throws Exception {
   stopDockRevealerTimer();
   if (cfg.autoHideProperty().get()
       && !arePopupsOpen()
       && (contextMenu == null || !contextMenu.isShowing())) {
     maybeHideDock();
     evt.consume();
   }
 }
 /** Show pop-up menu. */
 public void showPopup() {
   if (!popupMenu.isShowing()) {
     popupMenu.show(this, Side.BOTTOM, 0, 0);
   }
 }