javafx.scene.control.MenuItem.disableProperty()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中javafx.scene.control.MenuItem.disableProperty()方法的一些代码示例,展示了MenuItem.disableProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.disableProperty()方法的具体详情如下:
包路径:javafx.scene.control.MenuItem
类名称:MenuItem
方法名:disableProperty

暂无

代码示例

代码示例来源:origin: torakiki/pdfsam

copyItem.disableProperty().bind(new BooleanBinding() {
clearItem.setOnAction(e -> logView.getItems().clear());
clearItem.disableProperty().bind(new BooleanBinding() {
selectAllItem.setOnAction(e -> logView.getSelectionModel().selectAll());
selectAllItem.disableProperty().bind(clearItem.disableProperty());
saveItem.setOnAction(e -> saveLog());
saveItem.disableProperty().bind(clearItem.disableProperty());
SeparatorMenuItem separator = new SeparatorMenuItem();
logView.setContextMenu(new ContextMenu(copyItem, clearItem, selectAllItem, separator, saveItem));

代码示例来源:origin: ssaring/sportstracker

/**
 * Setup of bindings for the menu items and toolbar buttons. There is an action*Disabled property
 * for each action which is bound to the disabled property of the appropriate controls. So the
 * status of all similar action controls can be controlled by one action*Disabled property.
 */
private void setupActionBindings() {
  miSave.disableProperty().bind(actionSaveDisabled);
  btSave.disableProperty().bind(actionSaveDisabled);
  miEditEntry.disableProperty().bind(actionEditEntryDisabled);
  btEditEntry.disableProperty().bind(actionEditEntryDisabled);
  miCopyEntry.disableProperty().bind(actionEditEntryDisabled);
  btCopyEntry.disableProperty().bind(actionEditEntryDisabled);
  miDeleteEntry.disableProperty().bind(actionDeleteEntryDisabled);
  btDeleteEntry.disableProperty().bind(actionDeleteEntryDisabled);
  miViewHrm.disableProperty().bind(actionViewHrmDisabled);
  btViewHrm.disableProperty().bind(actionViewHrmDisabled);
  miCalendarView.disableProperty().bind(actionCalendarViewDisabled);
  btCalendarView.disableProperty().bind(actionCalendarViewDisabled);
  miExerciseListView.disableProperty().bind(actionExerciseListViewDisabled);
  btExerciseListView.disableProperty().bind(actionExerciseListViewDisabled);
  miNoteListView.disableProperty().bind(actionNoteListViewDisabled);
  btNoteListView.disableProperty().bind(actionNoteListViewDisabled);
  miWeightListView.disableProperty().bind(actionWeightListViewDisabled);
  btWeightListView.disableProperty().bind(actionWeightListViewDisabled);
  miFilterDisable.disableProperty().bind(actionFilterDisableDisabled);
  btFilterDisable.disableProperty().bind(actionFilterDisableDisabled);
}

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

@Override
public Node createValueListVisualisation() {
  CheckComboBox<T> comboBox = new CheckComboBox<>();
  possibleValuesProvider.get().stream().distinct().forEach(comboBox.getItems()::add);
  CheckComboBoxHelper.addOpenCloseListener(comboBox, this::updateCheckComboBox);
  comboBox.setConverter(new DataStringConverter<>());
  comboBox.setMinWidth(300);
  comboBox.disableProperty().bind(readOnly);
  ContextMenu contextMenu = new ContextMenu(menuItem(selectAll, comboBox, true), menuItem(selectNon, comboBox, false));
  contextMenu.getItems().forEach(m->m.disableProperty().bind(readOnly));
  comboBox.setContextMenu(contextMenu);
  updateCheckComboBox(comboBox);
  return comboBox;
}

代码示例来源:origin: com.powsybl/powsybl-gse-security-analysis

private static <T> void addContextMenu(CheckListView<T> listView) {
  listView.setOnContextMenuRequested(event -> {
    ContextMenu contextMenu = new ContextMenu();
    MenuItem selectAll = new MenuItem(RESOURCE_BUNDLE.getString("SelectAll"));
    selectAll.disableProperty().bind(Bindings.equal(listView.getItems().size(), Bindings.size(listView.getCheckModel().getCheckedIndices())));
    selectAll.setOnAction(event2 -> listView.getCheckModel().checkAll());
    MenuItem deselectAll = new MenuItem(RESOURCE_BUNDLE.getString("DeselectAll"));
    deselectAll.disableProperty().bind(Bindings.isEmpty(listView.getCheckModel().getCheckedIndices()));
    deselectAll.setOnAction(event2 -> listView.getCheckModel().clearChecks());
    contextMenu.getItems().addAll(selectAll, deselectAll);
    contextMenu.show(listView, event.getScreenX(), event.getScreenY());
  });
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx

public PerspectiveButton(PerspectiveSwitcherNode container, GraphicsLoader loader, MPerspective perspective, EPartService service, boolean toggled) {
    setSelected(toggled);
    getStyleClass().add("perspective-button"); //$NON-NLS-1$
    // FIXME React on perspective renaming and locale changes!
    setText(perspective.getLocalizedLabel());
    // FIXME React in URL change
    if (perspective.getIconURI() != null) {
      URI uri = URI.createURI(perspective.getIconURI());
      setGraphic(loader.getGraphicsNode(new EMFUri(uri)));
    }
    this.perspective = perspective;
    setOnAction(e -> {
      service.switchPerspective(perspective);
    });
    ContextMenu m = new ContextMenu();
    MenuItem item = new MenuItem("Remove");
    item.disableProperty().bind(selectedProperty());
    item.setOnAction( e -> {
      container.getChildren().remove(this);
      container.publishNewPerspectiveList(perspective.getElementId(), false);
    });
    m.getItems().add(item);
    setContextMenu(m);
  }
}

代码示例来源:origin: ssaring/sportstracker

/**
 * Sets up the context menu for the calendar control. Unfortunately it can't be defined in
 * FXML, the Pane classes does not support context menus directly.
 */
private void setupCalendarContextMenu() {
  final BooleanBinding bindingNoEntrySelected = Bindings.isNull(calendarControl.selectedEntryProperty());
  final MenuItem miCtxAddExercise = createContextMenuItem( //
      "miCtxAddExercise", "st.view.exercise_add.Action.text", //
      event -> addExerciseForDate(calendarControl.dateOfContextMenuProperty().get()));
  final MenuItem miCtxAddNote = createContextMenuItem( //
      "miCtxAddNote", "st.view.note_add.Action.text", //
      event -> addNoteForDate(calendarControl.dateOfContextMenuProperty().get()));
  final MenuItem miCtxAddWeight = createContextMenuItem( //
      "miCtxAddWeight", "st.view.weight_add.Action.text", //
      event -> addWeightForDate(calendarControl.dateOfContextMenuProperty().get()));
  final MenuItem miCtxEditEntry = createContextMenuItem( //
      "miCtxEditEntry", "st.view.entry_edit.Action.text", //
      event -> getEventHandler().onEditEntry(event));
  miCtxEditEntry.disableProperty().bind(bindingNoEntrySelected);
  final MenuItem miCtxCopyEntry = createContextMenuItem( //
      "miCtxCopyEntry", "st.view.entry_copy.Action.text", //
      event -> getEventHandler().onCopyEntry(event));
  miCtxCopyEntry.disableProperty().bind(bindingNoEntrySelected);
  final MenuItem miCtxDeleteEntry = createContextMenuItem( //
      "miCtxDeleteEntry", "st.view.entry_delete.Action.text", //
      event -> getEventHandler().onDeleteEntry(event));
  miCtxDeleteEntry.disableProperty().bind(bindingNoEntrySelected);
  calendarControl.setContextMenu(new ContextMenu( //
      miCtxAddExercise, miCtxAddNote, miCtxAddWeight, miCtxEditEntry, miCtxCopyEntry, miCtxDeleteEntry));
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

copy.disableProperty().bind(treeView.getSelectionModel().selectedItemProperty().isNull());
contextMenu.getItems().add(copy);
treeView.setContextMenu(contextMenu);

代码示例来源:origin: org.drombler.commons/drombler-commons-action-fx

/**
 * Configures a {@link MenuItem} with the specified action.
 *
 * @param menuItem the menu item to configre
 * @param action the action
 * @param iconSize the icon size
 */
public static void configureMenuItem(MenuItem menuItem, FXAction action, int iconSize) {
  menuItem.setMnemonicParsing(true);
  menuItem.textProperty().bind(action.displayNameProperty());
  menuItem.acceleratorProperty().bind(action.acceleratorProperty());
  menuItem.setOnAction(action);
  menuItem.disableProperty().bind(action.enabledProperty().not());
  if (action.getGraphicFactory() != null) {
    Node graphic = action.getGraphicFactory().createGraphic(iconSize);
    if (graphic != null) {
      menuItem.setGraphic(graphic);
    }
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

private static void unconfigure(final MenuItem menuItem) {
  if (menuItem == null || !(menuItem.getOnAction() instanceof Action)) {
    return;
  }
  Action action = (Action) menuItem.getOnAction();
  menuItem.styleProperty().unbind();
  menuItem.textProperty().unbind();
  menuItem.disableProperty().unbind();
  menuItem.acceleratorProperty().unbind();
  menuItem.graphicProperty().unbind();
  action.getProperties().removeListener(new MenuItemPropertiesMapChangeListener<>(menuItem, action));
  if (menuItem instanceof RadioMenuItem) {
    ((RadioMenuItem) menuItem).selectedProperty().unbindBidirectional(action.selectedProperty());
  } else if (menuItem instanceof CheckMenuItem) {
    ((CheckMenuItem) menuItem).selectedProperty().unbindBidirectional(action.selectedProperty());
  }
  menuItem.setOnAction(null);
}

代码示例来源:origin: brunoborges/webfx

closeTab.disableProperty().bind(selectionTab.getSelectedItem().closableProperty().not());

代码示例来源:origin: org.controlsfx/controlsfx

menuItem.disableProperty().bind(action.disabledProperty());
menuItem.acceleratorProperty().bind(action.acceleratorProperty());

代码示例来源:origin: org.copper-engine/copper-monitoring-client

menuItem.disableProperty().bind(resultTable.getSelectionModel().selectedItemProperty().isNull());
contextMenu.getItems().add(menuItem);

代码示例来源:origin: org.copper-engine/copper-monitoring-client

detailMenuItem.disableProperty().bind(resultTable.getSelectionModel().selectedItemProperty().isNull());
contextMenu.getItems().add(detailMenuItem);
MenuItem audittrailMenuItem = new MenuItem("AuditTrail");
audittrailMenuItem.disableProperty().bind(resultTable.getSelectionModel().selectedItemProperty().isNull());
contextMenu.getItems().add(audittrailMenuItem);

相关文章