use of com.haulmont.cuba.web.widgets.CubaButton in project cuba by cuba-platform.
the class NoUserSessionHandler method showNoUserSessionDialog.
protected void showNoUserSessionDialog(AppUI ui) {
Messages messages = beanLocator.get(Messages.class);
Connection connection = ui.getApp().getConnection();
// noinspection ConstantConditions
Locale locale = connection.getSession().getLocale();
Window dialog = new NoUserSessionExceptionDialog();
dialog.setStyleName("c-nousersession-dialog");
dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
dialog.setClosable(false);
dialog.setResizable(false);
dialog.setModal(true);
CubaLabel messageLab = new CubaLabel();
messageLab.setWidthUndefined();
messageLab.setValue(messages.getMainMessage("noUserSession.message", locale));
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(false);
layout.setWidthUndefined();
layout.setStyleName("c-nousersession-dialog-layout");
layout.setSpacing(true);
dialog.setContent(layout);
CubaButton reloginBtn = new CubaButton();
reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
reloginBtn.addClickListener(event -> relogin());
reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey()));
String iconName = beanLocator.get(Icons.class).get(Type.OK.getIconKey());
reloginBtn.setIcon(beanLocator.get(IconResolver.class).getIconResource(iconName));
ClientConfig clientConfig = beanLocator.get(Configuration.class).getConfig(ClientConfig.class);
setClickShortcut(reloginBtn, clientConfig.getCommitShortcut());
reloginBtn.focus();
layout.addComponent(messageLab);
layout.addComponent(reloginBtn);
layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT);
ui.addWindow(dialog);
dialog.center();
if (ui.isTestMode()) {
dialog.setCubaId("optionDialog");
reloginBtn.setCubaId("reloginBtn");
}
if (ui.isPerformanceTestMode()) {
dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
}
}
use of com.haulmont.cuba.web.widgets.CubaButton in project cuba by cuba-platform.
the class WebAbstractTable method showCustomPopupActions.
@Override
public void showCustomPopupActions(List<Action> actions) {
VerticalLayout customContextMenu = new VerticalLayout();
customContextMenu.setMargin(false);
customContextMenu.setSpacing(false);
customContextMenu.setWidthUndefined();
customContextMenu.setStyleName("c-cm-container");
for (Action action : actions) {
CubaButton contextMenuButton = createContextMenuButton();
initContextMenuButton(contextMenuButton, action);
customContextMenu.addComponent(contextMenuButton);
}
if (customContextMenu.getComponentCount() > 0) {
component.showCustomPopup(customContextMenu);
component.setCustomPopupAutoClose(true);
}
}
use of com.haulmont.cuba.web.widgets.CubaButton in project cuba by cuba-platform.
the class MismatchedUserSessionHandler method showMismatchedSessionDialog.
protected void showMismatchedSessionDialog(AppUI ui) {
Messages messages = beanLocator.get(Messages.class);
Connection connection = ui.getApp().getConnection();
// noinspection ConstantConditions
Locale locale = connection.getSession().getLocale();
Window dialog = new MismatchedUserSessionExceptionDialog();
dialog.setStyleName("c-sessionchanged-dialog");
dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
dialog.setClosable(false);
dialog.setResizable(false);
dialog.setModal(true);
CubaLabel messageLab = new CubaLabel();
messageLab.setWidthUndefined();
messageLab.setValue(messages.getMainMessage("sessionChangedMsg", locale));
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(false);
layout.setWidthUndefined();
layout.setStyleName("c-sessionchanged-dialog-layout");
layout.setSpacing(true);
dialog.setContent(layout);
CubaButton reloginBtn = new CubaButton();
reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
reloginBtn.setCaption(messages.getMainMessage(DialogAction.Type.OK.getMsgKey(), locale));
reloginBtn.addClickListener(event -> ui.getApp().recreateUi(ui));
String iconName = beanLocator.get(Icons.class).get(DialogAction.Type.OK.getIconKey());
reloginBtn.setIcon(beanLocator.get(IconResolver.class).getIconResource(iconName));
ClientConfig clientConfig = beanLocator.get(Configuration.class).getConfig(ClientConfig.class);
setClickShortcut(reloginBtn, clientConfig.getCommitShortcut());
reloginBtn.focus();
layout.addComponent(messageLab);
layout.addComponent(reloginBtn);
layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT);
ui.addWindow(dialog);
dialog.center();
if (ui.isTestMode()) {
dialog.setCubaId("optionDialog");
reloginBtn.setCubaId("reloginBtn");
}
if (ui.isPerformanceTestMode()) {
dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
}
}
use of com.haulmont.cuba.web.widgets.CubaButton in project cuba by cuba-platform.
the class WebAbstractActionsHolderComponent method actionPropertyChanged.
protected void actionPropertyChanged(PropertyChangeEvent evt) {
Action action = (Action) evt.getSource();
CubaButton button = actionButtons.get(action);
if (Action.PROP_ICON.equals(evt.getPropertyName())) {
setContextMenuButtonIcon(button, showIconsForPopupMenuActions ? action.getIcon() : null);
} else if (Action.PROP_CAPTION.equals(evt.getPropertyName())) {
setContextMenuButtonCaption(button, action.getCaption(), action.getShortcutCombination());
} 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());
}
}
use of com.haulmont.cuba.web.widgets.CubaButton in project cuba by cuba-platform.
the class CubaFileUploadWrapper method initLayout.
protected void initLayout(UploadComponent uploadComponent) {
this.uploadButton = uploadComponent;
container = new CssLayout();
container.addStyleName("c-fileupload-container");
fileNameButton = new CubaButton();
fileNameButton.setWidth(100, Unit.PERCENTAGE);
fileNameButton.addStyleName(ValoTheme.BUTTON_LINK);
fileNameButton.addStyleName("c-fileupload-filename");
setFileNameButtonCaption(null);
container.addComponent(fileNameButton);
container.addComponent(uploadComponent);
clearButton = new CubaButton("");
clearButton.setStyleName("c-fileupload-clear");
container.addComponent(clearButton);
setShowClearButton(showClearButton);
setShowFileName(false);
setWidthUndefined();
}
Aggregations