List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java
License:Apache License
protected final void createButtonLink(final GridLayout panelContent, final String linkText, final Resource icon, final ClickListener command, final String description) { final GridLayout grid = new GridLayout(2, 1); grid.setWidth(100, Unit.PERCENTAGE); grid.setHeight(100, Unit.PERCENTAGE); grid.setColumnExpandRatio(0, 1);//w w w .j a v a2 s . co m grid.setColumnExpandRatio(1, 2); final Button b = new Button(linkText); b.setStyleName("link"); b.addClickListener(command); b.setWidth(100, Unit.PERCENTAGE); b.setIcon(icon); b.setWidth(100, Unit.PERCENTAGE); grid.addComponent(b, 0, 0); grid.setComponentAlignment(b, Alignment.MIDDLE_LEFT); final Label descriptionLabel = new Label(description); descriptionLabel.setWidth(100, Unit.PERCENTAGE); grid.addComponent(descriptionLabel, 1, 0); grid.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_LEFT); panelContent.addComponent(grid); panelContent.setComponentAlignment(grid, Alignment.MIDDLE_LEFT); }
From source file:com.haulmont.cuba.web.AppUI.java
License:Apache License
protected void showCriticalExceptionMessage(Exception exception) { String initErrorCaption = messages.getMainMessage("app.initErrorCaption"); String initErrorMessage = messages.getMainMessage("app.initErrorMessage"); VerticalLayout content = new VerticalLayout(); content.setStyleName("c-init-error-view"); content.setSizeFull();//w ww. j av a 2 s .c om VerticalLayout errorPanel = new VerticalLayout(); errorPanel.setStyleName("c-init-error-panel"); errorPanel.setWidthUndefined(); errorPanel.setSpacing(true); Label captionLabel = new Label(initErrorCaption); captionLabel.setWidthUndefined(); captionLabel.setStyleName("c-init-error-caption"); captionLabel.addStyleName("h2"); captionLabel.setValue(initErrorCaption); errorPanel.addComponent(captionLabel); Label messageLabel = new Label(initErrorCaption); messageLabel.setWidthUndefined(); messageLabel.setStyleName("c-init-error-message"); messageLabel.setValue(initErrorMessage); errorPanel.addComponent(messageLabel); Button retryButton = new Button(messages.getMainMessage("app.initRetry")); retryButton.setStyleName("c-init-error-retry"); retryButton.addClickListener(event -> { // always restart UI String url = ControllerUtils.getLocationWithoutParams() + "?restartApp"; getPage().open(url, "_self"); }); errorPanel.addComponent(retryButton); errorPanel.setComponentAlignment(retryButton, Alignment.MIDDLE_CENTER); content.addComponent(errorPanel); content.setComponentAlignment(errorPanel, Alignment.MIDDLE_CENTER); setContent(content); }
From source file:com.haulmont.cuba.web.gui.components.WebPopupButton.java
License:Apache License
protected Button createActionButton(Action action) { WebButton button = new PopupButtonActionButton() { @Override//from w ww . ja va 2 s .c o m protected void beforeActionPerformed() { WebPopupButton.this.requestFocus(); } }; button.setAction(new PopupActionWrapper(action)); button.setIcon(this.isShowActionIcons() ? action.getIcon() : null); Button vButton = (Button) button.getComposition(); vButton.setImmediate(true); vButton.setSizeFull(); vButton.setStyleName(CONTEXT_MENU_BUTTON_STYLENAME); if (AppUI.getCurrent().isTestMode()) { String debugId = getDebugId(); if (debugId != null) { button.setDebugId(AppUI.getCurrent().getTestIdManager().getTestId(debugId + "_" + action.getId())); } button.setId(action.getId()); } return vButton; }
From source file:com.haulmont.cuba.web.sys.WindowBreadCrumbs.java
License:Apache License
public void update() { AppUI ui = AppUI.getCurrent();//from w w w . j av a2 s .c o m 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; } } }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaButtonField.java
License:Apache License
@Override protected Component initContent() { Button button = new CubaButton(); button.setStyleName(BaseTheme.BUTTON_LINK); return button; }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaPickerField.java
License:Apache License
public void addButton(Button button, int index) { button.setTabIndex(-1);//from w w w .j a v a 2 s .co m button.setStyleName("c-pickerfield-button"); buttons.add(index, button); container.addComponent(button, index + 1); // 0 - field }
From source file:com.hybridbpm.ui.component.adaptive.AdaptiveTaskEditor.java
License:Apache License
@Override public void buttonClick(Button.ClickEvent event) { if (event.getButton().equals(btnSend)) { } else if (event.getButton().equals(btnProcess)) { adaptiveLayout.setVisible(false); templateLayout.removeAllComponents(); templateLayout.setVisible(true); for (StartProcess startProcess : HybridbpmUI.getBpmAPI().getMyProcessToStart()) { String startTaskTitle = startProcess.getProcessModel() .getTaskModelByName(startProcess.getTaskName()).getTitle(); String processTitle = startProcess.getProcessModel().getTitle() .getValue(HybridbpmUI.getCurrent().getLocale()); Button button = new Button(processTitle + " (" + startTaskTitle + ")"); button.setData(startProcess); button.addClickListener(this); button.setStyleName(ValoTheme.BUTTON_LINK); button.addStyleName(ValoTheme.BUTTON_SMALL); button.setIcon(FontAwesome.valueOf(startProcess.getIcon())); templateLayout.addComponent(button); }/* w w w .j a v a2 s .c o m*/ templateLayout.addComponent(btnBack); templateLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_RIGHT); } else if (event.getButton().getData() instanceof StartProcess) { StartProcess spd = (StartProcess) event.getButton().getData(); if (taskLayout != null && card.getComponentIndex(taskLayout) > -1) { card.removeComponent(taskLayout); } taskLayout = new TaskLayout(null, spd.getProcessModel().getName(), spd.getTaskName(), true); card.addComponents(taskLayout); card.setExpandRatio(taskLayout, 1f); card.setSizeFull(); topLayout.setVisible(false); // panelView.toggleMaximized(this, true); } else if (event.getButton().equals(btnBack)) { adaptiveLayout.setVisible(true); templateLayout.setVisible(false); } }
From source file:com.jain.addon.action.ActionButtonGroup.java
License:Apache License
/** * Method to initialize component/*from w w w. j a v a2 s.c o m*/ */ @JNIComponentInit public void initActions() { if (!initialized) { int i = 0; Button actionButton = null; for (JNAction action : actions) { actionButton = new Button(actionsToName.get(action), listener); if (StringHelper.isNotEmptyWithTrim(action.description())) actionButton.setDescription(action.description()); else actionButton.setDescription(actionsToName.get(action)); actionButton.setVisible(validatePermission(action)); findNAddIcon(action, actionButton); if (StringHelper.isNotEmptyWithTrim(getActionStyle())) actionButton.setStyleName(getActionStyle()); if (i == 0) actionButton.addStyleName(getFirstActionStyle()); i++; addComponent(actionButton); setComponentAlignment(actionButton, Alignment.TOP_RIGHT); } if (actionButton != null) actionButton.addStyleName(getLastActionStyle()); initialized = true; } else { throw new IllegalArgumentException("Please add action before adding component into container"); } }
From source file:com.jain.addon.web.layout.segment.ButtonSegment.java
License:Apache License
/** * Initialize a button segment by adding resources {@link JNINamedResourceVisible} and {@link ClickListener}. <br/> * Every {@link JNINamedResourceVisible} will be converted into button having this {@link ClickListener}. * @param listener - {@link ClickListener} for the button * @param namedResources - {@link JNINamedResourceVisible} to create button and there visibility *///w w w .j a va 2s. co m public void createSegment(ClickListener listener, JNINamedResourceVisible... namedResources) { if (namedResources != null) { this.namedResources = namedResources; int i = 0; Button action = null; for (JNINamedResourceVisible named : namedResources) { action = new Button(named.getDisplayName(), listener); action.setDescription(named.getDescription()); action.setVisible(named.isVisible()); if (StringHelper.isNotEmptyWithTrim(buttonStyle)) action.setStyleName(firstButtonStyle); if (i == 0) action.addStyleName(firstButtonStyle); i++; addComponent(action); setComponentAlignment(action, Alignment.TOP_RIGHT); } if (action != null) action.addStyleName(lastButtonStyle); } }
From source file:com.jain.common.header.Header.java
License:Apache License
private void addHeaderMenu() { HorizontalLayout layout = new HorizontalLayout(); layout.setStyleName(ApplicationTheme.HEADER_SEGMENT); int i = 0;/*from w w w .j ava2 s . c o m*/ Button button = null; for (JHeaderItem item : JHeaderItem.values()) { button = new Button(item.getDisplayName(), this); layout.addComponent(button); if (i == 0) { current = button; current.setStyleName(ApplicationTheme.FIRST); current.addStyleName(ApplicationTheme.SELECTED); i++; } } button.setStyleName(ApplicationTheme.LAST); addComponent(layout); setComponentAlignment(layout, Alignment.MIDDLE_LEFT); setExpandRatio(layout, 1); }