use of com.haulmont.cuba.gui.components.Action in project cuba by cuba-platform.
the class WebFrameActionsHolder method actionPropertyChanged.
protected void actionPropertyChanged(PropertyChangeEvent propertyChangeEvent) {
if (Action.PROP_SHORTCUT.equals(propertyChangeEvent.getPropertyName())) {
Action action = (Action) propertyChangeEvent.getSource();
actions.inverse().remove(action);
if (action.getShortcutCombination() != null) {
actions.put(createShortcutAction(action), action);
}
}
}
use of com.haulmont.cuba.gui.components.Action in project cuba by cuba-platform.
the class WebPickerField method setDebugId.
@Override
public void setDebugId(String id) {
super.setDebugId(id);
if (id != null) {
String debugId = getDebugId();
TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
for (Action action : actions) {
CubaButton button = actionButtons.get(action);
if (button != null && Strings.isNullOrEmpty(button.getId())) {
button.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
}
}
}
}
use of com.haulmont.cuba.gui.components.Action in project cuba by cuba-platform.
the class WebPickerField method actionPropertyChanged.
protected void actionPropertyChanged(PropertyChangeEvent evt) {
Action action = (Action) evt.getSource();
CubaButton button = actionButtons.get(action);
if (Action.PROP_ICON.equals(evt.getPropertyName())) {
setPickerButtonIcon(button, action.getIcon());
} else if (Action.PROP_CAPTION.equals(evt.getPropertyName())) {
button.setCaption(action.getCaption());
} else if (Action.PROP_DESCRIPTION.equals(evt.getPropertyName())) {
button.setDescription(action.getDescription());
} else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) {
button.setEnabled(action.isEnabled());
} else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) {
button.setVisible(action.isVisible());
} else if (action instanceof PickerFieldAction && PickerFieldAction.PROP_EDITABLE.equals(evt.getPropertyName())) {
button.setVisible(((PickerFieldAction) action).isEditable());
}
}
use of com.haulmont.cuba.gui.components.Action in project cuba by cuba-platform.
the class WebNotificationFacet method subscribeOnAction.
protected void subscribeOnAction(Frame owner) {
Action action = WebComponentsHelper.findAction(owner, actionId);
if (!(action instanceof BaseAction)) {
throw new GuiDevelopmentException(String.format("Unable to find Notification target action with id '%s'", actionId), owner.getId());
}
((BaseAction) action).addActionPerformedListener(e -> show());
}
use of com.haulmont.cuba.gui.components.Action in project cuba by cuba-platform.
the class UserSwitchLinkHandlerProcessor method substituteUserAndOpenWindow.
protected void substituteUserAndOpenWindow(ExternalLinkContext linkContext, UUID userId) {
App app = linkContext.getApp();
UserSession userSession = app.getConnection().getSession();
assert userSession != null;
final User substitutedUser = loadUser(userId, userSession.getUser());
if (substitutedUser != null) {
app.getWindowManager().showOptionDialog(messages.getMainMessage("toSubstitutedUser.title"), getDialogMessage(substitutedUser), Frame.MessageType.CONFIRMATION_HTML, new Action[] { new ChangeSubstUserAction(substitutedUser) {
@Override
public void doAfterChangeUser() {
super.doAfterChangeUser();
screenHandler.handle(linkContext);
}
@Override
public void doRevert() {
super.doRevert();
JavaScript js = Page.getCurrent().getJavaScript();
js.execute("window.close();");
}
@Override
public String getCaption() {
return messages.getMainMessage("action.switch");
}
}, new DoNotChangeSubstUserAction() {
@Override
public void actionPerform(Component component) {
super.actionPerform(component);
JavaScript js = Page.getCurrent().getJavaScript();
js.execute("window.close();");
}
@Override
public String getCaption() {
return messages.getMainMessage("action.cancel");
}
} });
} else {
User user = loadUser(userId);
app.getWindowManager().showOptionDialog(messages.getMainMessage("warning.title"), getWarningMessage(user), Frame.MessageType.WARNING_HTML, new Action[] { new DialogAction(DialogAction.Type.OK).withHandler(event -> {
JavaScript js = Page.getCurrent().getJavaScript();
js.execute("window.close();");
}) });
}
}
Aggregations