List of usage examples for com.vaadin.ui CssLayout addStyleName
@Override public void addStyleName(String style)
From source file:com.esofthead.mycollab.vaadin.web.ui.OptionPopupContent.java
License:Open Source License
public void addOption(Button btn) { CssLayout wrap = new CssLayout(); btn.setWidth("100%"); btn.setDescription(btn.getCaption()); btn.addStyleName("action"); wrap.addStyleName("action-wrap"); wrap.addComponent(btn);//w w w .j a v a2 s. c o m ((ComponentContainer) this.getCompositionRoot()).addComponent(wrap); }
From source file:com.esofthead.mycollab.vaadin.web.ui.OptionPopupContent.java
License:Open Source License
public void addDangerOption(Component btn) { CssLayout wrap = new CssLayout(); btn.setWidth("100%"); btn.addStyleName("action"); wrap.addStyleName("action-wrap danger"); wrap.addComponent(btn);/* w ww .j a va 2 s . co m*/ ((ComponentContainer) this.getCompositionRoot()).addComponent(wrap); }
From source file:com.etest.valo.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);/*w w w.java 2 s .c o m*/ Label h1 = new Label("Combo Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); ComboBox combo = new ComboBox("Normal"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png")); row.addComponent(combo); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); combo = new ComboBox(); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.setWidth("240px"); group.addComponent(combo); Button today = new Button("Do It"); group.addComponent(today); combo = new ComboBox("Explicit size"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setWidth("260px"); combo.setHeight("60px"); row.addComponent(combo); combo = new ComboBox("No text input allowed"); combo.setInputPrompt("You can click here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setTextInputAllowed(false); combo.setNullSelectionAllowed(false); combo.select("Option One"); row.addComponent(combo); combo = new ComboBox("Error"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); row.addComponent(combo); combo = new ComboBox("Error, borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Disabled"); combo.setInputPrompt("You can't type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setEnabled(false); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("large"); row.addComponent(combo); combo = new ComboBox("Borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Tiny"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
From source file:com.etest.valo.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);//from w w w . j av a 2 s . c o m content.setSpacing(true); content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for"); group.addStyleName("v-component-group"); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(800); } catch (InterruptedException e) { } } }); group.addComponent(loading); Button delay = new Button("3"); delay.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(3000); } catch (InterruptedException e) { } } }); group.addComponent(delay); Button wait = new Button("15"); wait.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(15000); } catch (InterruptedException e) { } } }); wait.addStyleName("last"); group.addComponent(wait); Label label = new Label(" seconds", ContentMode.HTML); label.setSizeUndefined(); group.addComponent(label); Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added."); spinnerDesc.addStyleName("small"); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!MainUI.isTestMode()) { final Label spinner = new Label(); spinner.addStyleName("spinner"); Button showSpinnerButton = new Button("Show spinner", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { content.replaceComponent(event.getComponent(), spinner); } }); content.addComponent(showSpinnerButton); } return p; }
From source file:com.haulmont.cuba.web.gui.components.WebFilterHelper.java
License:Apache License
@Override public com.haulmont.cuba.gui.components.Component.Container createSearchButtonGroupContainer() { CssLayout layout = componentsFactory.createComponent(CssLayout.class); layout.addStyleName("v-component-group"); return layout; }
From source file:com.hybridbpm.ui.MainMenu.java
License:Apache License
protected void addMenuItemComponent(final ViewDefinition viewDefinition, String parameters) { CssLayout dashboardWrapper = new CssLayout(); dashboardWrapper.addStyleName("badgewrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); dashboardWrapper.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); Label notificationsBadge = new Label(); notificationsBadge.addStyleName(ValoTheme.MENU_BADGE); notificationsBadge.setWidthUndefined(); notificationsBadge.setVisible(false); if (viewDefinition != null) { dashboardWrapper.addComponents(new ValoMenuItemButton(viewDefinition, parameters), notificationsBadge); menuItemsLayout.addComponent(dashboardWrapper); } else if (HybridbpmUI.getDeveloperMode()) { dashboardWrapper.addComponents(new ValoMenuAddViewButton(), notificationsBadge); menuItemsLayout.addComponent(dashboardWrapper); }//from w ww . ja v a 2s . c o m }
From source file:com.klwork.explorer.ui.custom.DetailPanel.java
License:Apache License
public DetailPanel() { setSizeFull();/*from w ww . j a va 2 s . co m*/ addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); setMargin(true); CssLayout cssLayout = new CssLayout(); // Needed for rounded corners, cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); cssLayout.setSizeFull(); super.addComponent(cssLayout); mainPanel = new Panel(); mainPanel.addStyleName(Reindeer.PANEL_LIGHT); mainPanel.setSizeFull(); cssLayout.addComponent(mainPanel); // Use default layout VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth(100, Unit.PERCENTAGE); verticalLayout.setMargin(true); mainPanel.setContent(verticalLayout); }
From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void initDescription() { CssLayout descriptionLayout = new CssLayout(); descriptionLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); descriptionLayout.setWidth(100, UNITS_PERCENTAGE); if (historicTask.getDescription() != null) { Label descriptionLabel = new Label(historicTask.getDescription()); descriptionLayout.addComponent(descriptionLabel); }//from ww w . ja v a 2s . com centralLayout.addComponent(descriptionLayout); }
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form //task.getT/*from ww w . j av a2 s .co m*/ TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && StringTool.judgeBlank(formData.getFormKey())) { TaskForm c = TaskFormFactory.create(formData.getFormKey(), task); centralLayout.addComponent(c); c.addListener(new SubmitEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override protected void submitted(SubmitEvent event) { //?????? Map<String, Object> properties = (Map<String, Object>) event.getData(); System.out.println(properties); taskService.complete(task.getId(), properties); notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } @Override protected void cancelled(SubmitEvent event) { taskForm.clear(); } }); return; } //formService.getS if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) { taskForm = new FormPropertiesForm(); taskForm.setSubmitButtonCaption(i18nManager.getMessage(Messages.TASK_COMPLETE)); taskForm.setCancelButtonCaption(i18nManager.getMessage(Messages.TASK_RESET_FORM)); taskForm.setFormHelp(i18nManager.getMessage(Messages.TASK_FORM_HELP)); taskForm.setFormProperties(formData.getFormProperties()); //WW_TODO form? taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override protected void handleFormSubmit(FormPropertiesEvent event) { //?????? Map<String, String> properties = event.getFormProperties(); formService.submitTaskFormData(task.getId(), properties); notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page centralLayout.addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, Unit.PERCENTAGE); centralLayout.addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(Messages.TASK_COMPLETE)); completeButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * This method builds audio library for current filter. * /*w w w .j a va 2 s. co m*/ * @param grid * The object to locate the audio covers. * @param filter * The filter to extract need music files. */ private void buildAudioLibrary(GridLayout grid, String filter) { AudioCollection audio = new AudioCollection(); for (final AudioFile audioFile : audio.getAudioCollection(filter)) { CssLayout select = new CssLayout(); select.addStyleName(Runo.CSSLAYOUT_SELECTABLE); CssLayout musicFile = new CssLayout(); musicFile.addStyleName(Runo.CSSLAYOUT_SHADOW); musicFile.addComponent(createImageCover(audioFile.getCover())); select.addComponent(musicFile); musicFile.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 5789650754220216969L; @Override public void layoutClick(LayoutClickEvent event) { buildInformationPanel(audioFile); } }); grid.addComponent(select); grid.setComponentAlignment(select, Alignment.MIDDLE_CENTER); } Label text = new Label("Note: This track are on Crative Common license."); text.addStyleName(Runo.LABEL_SMALL); text.setWidth("90%"); grid.addComponent(text); grid.setComponentAlignment(text, Alignment.MIDDLE_CENTER); }