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

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

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

暂无

代码示例

代码示例来源:origin: stackoverflow.com

protected RadioMenuItem getMenuItemFor(int dataIndex) {
  if (dataIndex < 0) return null;
  int loopIndex = dataIndex;
  while (loopIndex < popup.getItems().size()) {
    MenuItem item = popup.getItems().get(loopIndex);

    ObservableMap<Object, Object> properties = item.getProperties();
    Object object = properties.get("data-index");
    if ((object instanceof Integer) && dataIndex == (Integer) object) {
      return item instanceof RadioMenuItem ? (RadioMenuItem)item : null;
    }
    loopIndex++;
  }
  return null;
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Finds out if a {@code default value} has been registered with the target {@code Node}, returning the value if found.
 *
 * @param node the target node on which the value may have been registered.
 *
 * @return the value registered with the target {@code Node} or {@code null} if not found.
 *
 * @since 2.9.0
 */
@Nullable
public static String getI18nDefaultValue(@Nonnull MenuItem node) {
  requireNonNull(node, ERROR_NODE_NULL);
  return (String) node.getProperties().get(MessageSource.class.getName() + SUFFIX_DEFAULT_VALUE);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Associates an default value {@code node}.
 * The value will be used alongside a key to resolve a message via the application's {@code MessageSource}.
 *
 * @param node         the target node on which the key will be registered.
 * @param defaultValue the value to be registered.
 *
 * @since 2.9.0
 */
public static void setI18nDefaultValue(@Nonnull MenuItem node, @Nullable String defaultValue) {
  requireNonNull(node, ERROR_NODE_NULL);
  node.getProperties().put(MessageSource.class.getName() + SUFFIX_DEFAULT_VALUE, defaultValue);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Finds out if an {@code Action} has been registered with the target {@code MenuItem}, returning the action id if found.
 *
 * @param menuItem the target menuItem on which the action may have been registered.
 *
 * @return the name of the action registered with the target {@code MenuItem} or {@code null} if not found.
 *
 * @since 2.8.0
 */
@Nullable
public static String getGriffonActionId(@Nonnull MenuItem menuItem) {
  requireNonNull(menuItem, ERROR_NODE_NULL);
  return (String) menuItem.getProperties().get(Action.class.getName());
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Finds out if an {@code arguments array} has been registered with the target {@code Node}, returning the array if found.
 *
 * @param node the target node on which the arguments may have been registered.
 *
 * @return the arguments registered with the target {@code Node} or {@code null} if not found.
 *
 * @since 2.9.0
 */
@Nullable
public static String getI18nArgs(@Nonnull MenuItem node) {
  requireNonNull(node, ERROR_NODE_NULL);
  return (String) node.getProperties().get(MessageSource.class.getName() + SUFFIX_ARGS);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Finds out if an i18n {@code key} has been registered with the target {@code Node}, returning the key if found.
 *
 * @param node the target node on which the key may have been registered.
 *
 * @return the key registered with the target {@code Node} or {@code null} if not found.
 *
 * @since 2.9.0
 */
@Nullable
public static String getI18nKey(@Nonnull MenuItem node) {
  requireNonNull(node, ERROR_NODE_NULL);
  return (String) node.getProperties().get(MessageSource.class.getName() + SUFFIX_KEY);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Associates an i18n key to a {@code node}. The key is used to resolve a message via the application's {@code MessageSource}.
 *
 * @param node the target node on which the key will be registered.
 * @param key  the message key to be registered.
 *
 * @since 2.9.0
 */
public static void setI18nKey(@Nonnull MenuItem node, @Nonnull String key) {
  requireNonNull(node, ERROR_NODE_NULL);
  requireNonBlank(key, ERROR_KEY_BLANK);
  node.getProperties().put(MessageSource.class.getName() + SUFFIX_KEY, key);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Associates an i18n arrays of arguments to a {@code node}.
 * These arguments will be used alongside a key to resolve a message via the application's {@code MessageSource}.
 *
 * @param node the target node on which the key will be registered.
 * @param args the array of arguments to be registered.
 *
 * @since 2.9.0
 */
public static void setI18nArgs(@Nonnull MenuItem node, @Nullable String args) {
  requireNonNull(node, ERROR_NODE_NULL);
  requireNonBlank(args, ERROR_ARGS_BLANK);
  node.getProperties().put(MessageSource.class.getName() + SUFFIX_ARGS, args);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

/**
 * Associates a {@code Action} with a target {@code MenuItem}.
 *
 * @param menuItem the target menuItem on which the action will be registered.
 * @param actionId the id of the action to be registered.
 *
 * @since 2.8.0
 */
public static void setGriffonActionId(@Nonnull MenuItem menuItem, @Nonnull String actionId) {
  requireNonNull(menuItem, ERROR_NODE_NULL);
  requireNonBlank(actionId, ERROR_ID_BLANK);
  menuItem.getProperties().put(Action.class.getName(), actionId);
}

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

@Override public void onChanged(MapChangeListener.Change<?, ?> change) {
  T menuItem = menuItemWeakReference.get();
  if (menuItem == null) {
    action.getProperties().removeListener(this);
  } else {
    menuItem.getProperties().clear();
    menuItem.getProperties().putAll(action.getProperties());
  }
}

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

menuItem.getProperties().putAll(action.getProperties());
action.getProperties().addListener(new MenuItemPropertiesMapChangeListener<>(menuItem, action));

相关文章