use of org.eclipse.scout.rt.client.ui.action.menu.IMenuType in project scout.rt by eclipse.
the class JsonMenu method initJsonProperties.
@Override
protected void initJsonProperties(MENU model) {
super.initJsonProperties(model);
putJsonProperty(new JsonProperty<MENU>(PROP_SEPARATOR, model) {
@Override
protected Boolean modelValue() {
return getModel().isSeparator();
}
});
putJsonProperty(new JsonProperty<MENU>(PROP_OUTLINE_MENU_WRAPPER, model) {
@Override
protected Boolean modelValue() {
return getModel() instanceof OutlineMenuWrapper;
}
});
putJsonProperty(new JsonProperty<MENU>(IMenu.PROP_MENU_TYPES, model) {
@Override
protected Set<IMenuType> modelValue() {
return getModel().getMenuTypes();
}
@Override
public Object prepareValueForToJson(Object value) {
Set<String> menuTypes = new HashSet<>();
for (IMenuType type : getModel().getMenuTypes()) {
String prefix = type.getClass().getSimpleName().replace("MenuType", "");
menuTypes.add(prefix + "." + type.toString());
}
return new JSONArray(menuTypes);
}
});
putJsonProperty(new JsonProperty<MENU>(IMenu.PROP_PREVENT_DOUBLE_CLICK, model) {
@Override
protected Boolean modelValue() {
return getModel().isPreventDoubleClick();
}
});
}
use of org.eclipse.scout.rt.client.ui.action.menu.IMenuType in project scout.rt by eclipse.
the class OutlineMenuWrapper method mapMenuTypes.
protected Set<IMenuType> mapMenuTypes(IMenu menu, IMenuTypeMapper mapper) {
Set<IMenuType> originalTypes = menu.getMenuTypes();
Set<IMenuType> mappedTypes = new HashSet<IMenuType>(originalTypes.size());
for (IMenuType menuType : originalTypes) {
mappedTypes.add(mapper.map(menuType));
}
return mappedTypes;
}
use of org.eclipse.scout.rt.client.ui.action.menu.IMenuType in project scout.rt by eclipse.
the class JsonValueField method attachModel.
@Override
protected void attachModel() {
super.attachModel();
if (m_contextMenuListener != null) {
throw new IllegalStateException();
}
m_contextMenuListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (IMenu.PROP_VISIBLE.equals(evt.getPropertyName())) {
handleModelContextMenuVisibleChanged((Boolean) evt.getNewValue());
} else if (IContextMenu.PROP_CURRENT_MENU_TYPES.equals(evt.getPropertyName())) {
@SuppressWarnings("unchecked") Set<? extends IMenuType> newValue = (Set<? extends IMenuType>) evt.getNewValue();
handleModelContextMenuCurrentMenuTypesChanged(newValue);
}
}
};
getModel().getContextMenu().addPropertyChangeListener(m_contextMenuListener);
}
Aggregations