use of com.haulmont.cuba.web.toolkit.ui.CubaButton in project cuba by cuba-platform.
the class WindowBreadCrumbs method update.
public void update() {
AppUI ui = AppUI.getCurrent();
boolean isTestMode = ui.isTestMode();
linksLayout.removeAllComponents();
btn2win.clear();
for (Iterator<Window> it = windows.iterator(); it.hasNext(); ) {
Window window = it.next();
Button button = new CubaButton(StringUtils.trimToEmpty(window.getCaption()), new BtnClickListener());
button.setSizeUndefined();
button.setStyleName(BaseTheme.BUTTON_LINK);
button.setTabIndex(-1);
if (isTestMode) {
button.setCubaId("breadCrubms_Button_" + window.getId());
button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId()));
}
btn2win.put(button, window);
if (it.hasNext()) {
linksLayout.addComponent(button);
Label separatorLab = new Label(" > ");
separatorLab.setStyleName("c-breadcrumbs-separator");
separatorLab.setSizeUndefined();
separatorLab.setContentMode(ContentMode.HTML);
linksLayout.addComponent(separatorLab);
} else {
Label captionLabel = new Label(window.getCaption());
captionLabel.setStyleName("c-breadcrumbs-win-caption");
captionLabel.setSizeUndefined();
linksLayout.addComponent(captionLabel);
this.label = captionLabel;
}
}
}
use of com.haulmont.cuba.web.toolkit.ui.CubaButton in project cuba by cuba-platform.
the class LogWindow method initUI.
private void initUI() {
ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class);
String closeShortcut = clientConfig.getCloseShortcut();
KeyCombination closeCombination = KeyCombination.create(closeShortcut);
com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction("closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers()));
addActionHandler(new com.vaadin.event.Action.Handler() {
@Override
public com.vaadin.event.Action[] getActions(Object target, Object sender) {
return new com.vaadin.event.Action[] { closeShortcutAction };
}
@Override
public void handleAction(com.vaadin.event.Action action, Object sender, Object target) {
if (Objects.equals(action, closeShortcutAction)) {
close();
}
}
});
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setSizeFull();
setContent(layout);
Panel scrollablePanel = new Panel();
scrollablePanel.setSizeFull();
VerticalLayout scrollContent = new VerticalLayout();
scrollContent.setSizeUndefined();
scrollablePanel.setContent(scrollContent);
final Label label = new Label();
label.setContentMode(ContentMode.HTML);
label.setValue(writeLog());
label.setSizeUndefined();
label.setStyleName("c-log-content");
((Layout) scrollablePanel.getContent()).addComponent(label);
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("100%");
topLayout.setHeightUndefined();
Messages messages = AppBeans.get(Messages.NAME);
Button refreshBtn = new CubaButton(messages.getMessage(getClass(), "logWindow.refreshBtn"), (Button.ClickListener) event -> label.setValue(writeLog()));
topLayout.addComponent(refreshBtn);
layout.addComponent(topLayout);
layout.addComponent(scrollablePanel);
layout.setExpandRatio(scrollablePanel, 1.0f);
}
use of com.haulmont.cuba.web.toolkit.ui.CubaButton in project cuba by cuba-platform.
the class PresentationEditor method initLayout.
protected void initLayout() {
ThemeConstants theme = App.getInstance().getThemeConstants();
VerticalLayout root = new VerticalLayout();
root.setWidthUndefined();
root.setSpacing(true);
setContent(root);
messages = AppBeans.get(Messages.class);
nameField = new TextField(messages.getMainMessage("PresentationsEditor.name"));
nameField.setWidth(theme.get("cuba.web.PresentationEditor.name.width"));
nameField.setValue(getPresentationCaption());
root.addComponent(nameField);
autoSaveField = new CheckBox();
autoSaveField.setCaption(messages.getMainMessage("PresentationsEditor.autoSave"));
autoSaveField.setValue(BooleanUtils.isTrue(presentation.getAutoSave()));
root.addComponent(autoSaveField);
defaultField = new CheckBox();
defaultField.setCaption(messages.getMainMessage("PresentationsEditor.default"));
defaultField.setValue(presentation.getId().equals(component.getDefaultPresentationId()));
root.addComponent(defaultField);
if (allowGlobalPresentations) {
globalField = new CheckBox();
globalField.setCaption(messages.getMainMessage("PresentationsEditor.global"));
globalField.setValue(!isNew && presentation.getUser() == null);
root.addComponent(globalField);
}
HorizontalLayout buttons = new HorizontalLayout();
buttons.setSpacing(true);
buttons.setWidthUndefined();
root.addComponent(buttons);
root.setComponentAlignment(buttons, Alignment.MIDDLE_LEFT);
Button commitButton = new CubaButton(messages.getMainMessage("PresentationsEditor.save"));
commitButton.addClickListener(event -> {
if (validate()) {
commit();
close();
}
});
buttons.addComponent(commitButton);
Button closeButton = new CubaButton(messages.getMainMessage("PresentationsEditor.close"));
closeButton.addClickListener(event -> {
close();
});
buttons.addComponent(closeButton);
nameField.focus();
}
Aggregations