List of usage examples for com.vaadin.ui Label setContentMode
public void setContentMode(ContentMode contentMode)
From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesEntry.java
License:Open Source License
private void construct(final AbstractJcrNodeAdapter favorite, final FavoritesView.Listener listener) { addStyleName("favorites-entry"); setSizeUndefined();/*from w ww.j a v a 2s . c om*/ root.setSizeUndefined(); this.enterKeyShortcutListener = new EnterKeyShortcutListener(listener); this.escapeKeyShortcutListener = new EscapeKeyShortcutListener(); this.nodename = favorite.getNodeName(); this.location = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.URL).getValue().toString(); this.title = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.TITLE).getValue().toString(); String icon = "icon-app"; if (favorite.getItemProperty(AdmincentralNodeTypes.Favorite.ICON).getValue() != null) { icon = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.ICON).getValue().toString(); } final Label iconLabel = new Label(); iconLabel.setValue("<span class=\"" + icon + "\"></span>"); iconLabel.setStyleName("icon"); iconLabel.setContentMode(ContentMode.HTML); root.addComponent(iconLabel); titleField = new TextField(); titleField.setValue(title); titleField.setReadOnly(true); titleField.addFocusListener(new FocusListener() { @Override public void focus(FocusEvent event) { iconLabel.removeShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(escapeKeyShortcutListener); } }); titleField.addBlurListener(new BlurListener() { @Override public void blur(BlurEvent event) { titleField.removeShortcutListener(enterKeyShortcutListener); titleField.removeShortcutListener(escapeKeyShortcutListener); } }); root.addComponent(titleField); editButton = new NativeButton(); editButton.setHtmlContentAllowed(true); editButton.setCaption("<span class=\"icon-edit\"></span>"); editButton.addStyleName("favorite-action"); editButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { doEditTitle(listener); } }); editButton.setVisible(false); root.addComponent(editButton); removeButton = new NativeButton(); removeButton.setHtmlContentAllowed(true); removeButton.setCaption("<span class=\"icon-trash\"></span>"); removeButton.addStyleName("favorite-action"); removeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { shell.openConfirmation(MessageStyleTypeEnum.WARNING, i18n.translate("confirmation.delete.title.generic"), i18n.translate("confirmation.cannot.undo"), i18n.translate("confirmation.delete.yes"), i18n.translate("confirmation.no"), false, new ConfirmationCallback() { @Override public void onSuccess() { listener.removeFavorite(getRelPath()); } @Override public void onCancel() { // no op } }); } }); removeButton.setVisible(false); root.addComponent(removeButton); root.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { if (event.getClickedComponent() == titleField && !editable) { if (event.isDoubleClick()) { // TODO fgrilli commented out as, besides making the text editable, it also goes to the saved location // See MGNLUI-1317 } else { listener.goToLocation(location); } } } }); setCompositionRoot(root); setIconsVisibility(false); }
From source file:io.subutai.plugin.accumulo.ui.wizard.VerificationStep.java
public VerificationStep(final Accumulo accumulo, final Hadoop hadoop, final ExecutorService executorService, final Tracker tracker, EnvironmentManager environmentManager, final Wizard wizard) { setSizeFull();/*from w ww . j a va2 s .c o m*/ GridLayout grid = new GridLayout(1, 5); grid.setSpacing(true); grid.setMargin(true); grid.setSizeFull(); Label confirmationLbl = new Label("<strong>Please verify the installation settings " + "(you may change them by clicking on Back button)</strong><br/>"); confirmationLbl.setContentMode(ContentMode.HTML); ConfigView cfgView = new ConfigView("Installation configuration"); cfgView.addStringCfg("Cluster Name", wizard.getConfig().getClusterName()); cfgView.addStringCfg("Instance name", wizard.getConfig().getInstanceName()); cfgView.addStringCfg("Password", wizard.getConfig().getPassword()); cfgView.addStringCfg("Hadoop cluster", wizard.getConfig().getHadoopClusterName()); cfgView.addStringCfg("Zookeeper cluster", wizard.getConfig().getZookeeperClusterName()); if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) { try { Environment hadoopEnvironment = environmentManager.loadEnvironment( hadoop.getCluster(wizard.getConfig().getHadoopClusterName()).getEnvironmentId()); EnvironmentContainerHost master = hadoopEnvironment .getContainerHostById(wizard.getConfig().getMasterNode()); EnvironmentContainerHost gc = hadoopEnvironment .getContainerHostById(wizard.getConfig().getGcNode()); EnvironmentContainerHost monitor = hadoopEnvironment .getContainerHostById(wizard.getConfig().getMonitor()); Set<EnvironmentContainerHost> tracers = hadoopEnvironment .getContainerHostsByIds(wizard.getConfig().getTracers()); Set<EnvironmentContainerHost> slaves = hadoopEnvironment .getContainerHostsByIds(wizard.getConfig().getSlaves()); cfgView.addStringCfg("Master node", master.getHostname()); cfgView.addStringCfg("GC node", gc.getHostname()); cfgView.addStringCfg("Monitor node", monitor.getHostname()); for (EnvironmentContainerHost containerHost : tracers) { cfgView.addStringCfg("Tracers", containerHost.getHostname()); } for (EnvironmentContainerHost containerHost : slaves) { cfgView.addStringCfg("Slaves", containerHost.getHostname()); } } catch (EnvironmentNotFoundException | ContainerHostNotFoundException e) { LOGGER.error("Error applying operations on environment/container", e); } } else { cfgView.addStringCfg("Number of Hadoop slaves", wizard.getHadoopClusterConfig().getCountOfSlaveNodes() + ""); cfgView.addStringCfg("Hadoop replication factor", wizard.getHadoopClusterConfig().getReplicationFactor() + ""); cfgView.addStringCfg("Hadoop domain name", wizard.getHadoopClusterConfig().getDomainName() + ""); cfgView.addStringCfg("Number of tracers", wizard.getConfig().getNumberOfTracers() + ""); cfgView.addStringCfg("Number of slaves", wizard.getConfig().getNumberOfSlaves() + ""); } Button install = new Button("Install"); install.setId("installBtn"); install.addStyleName("default"); install.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UUID trackID; if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) { trackID = accumulo.installCluster(wizard.getConfig()); } else { trackID = accumulo.installCluster(wizard.getConfig()); } ProgressWindow window = new ProgressWindow(executorService, tracker, trackID, AccumuloClusterConfig.PRODUCT_KEY); window.getWindow().addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { wizard.init(); } }); getUI().addWindow(window.getWindow()); } }); Button back = new Button("Back"); back.setId("verBack"); back.addStyleName("default"); back.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { wizard.back(); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.addComponent(back); buttons.addComponent(install); grid.addComponent(confirmationLbl, 0, 0); grid.addComponent(cfgView.getCfgTable(), 0, 1, 0, 3); grid.addComponent(buttons, 0, 4); setContent(grid); }
From source file:io.subutai.plugin.accumulo.ui.wizard.WelcomeStep.java
public WelcomeStep(final Wizard wizard) { setSizeFull();/*from w ww . ja v a 2 s. c o m*/ GridLayout grid = new GridLayout(10, 6); grid.setSpacing(true); grid.setMargin(true); grid.setSizeFull(); Label welcomeMsg = new Label("<center><h2>Welcome to Accumulo Installation Wizard!</h2>"); welcomeMsg.setContentMode(ContentMode.HTML); grid.addComponent(welcomeMsg, 3, 1, 6, 2); Label logoImg = new Label(); // Image as a file resource logoImg.setIcon(new FileResource(FileUtil.getFile(AccumuloPortalModule.MODULE_IMAGE, this))); logoImg.setContentMode(ContentMode.HTML); logoImg.setHeight(56, Unit.PIXELS); logoImg.setWidth(220, Unit.PIXELS); grid.addComponent(logoImg, 1, 3, 2, 5); Button startOverHadoopNZK = new Button("Start over Hadoop & ZK installation"); startOverHadoopNZK.setId("startOverHadoopNZK"); startOverHadoopNZK.addStyleName("default"); grid.addComponent(startOverHadoopNZK, 4, 4, 4, 4); grid.setComponentAlignment(startOverHadoopNZK, Alignment.BOTTOM_RIGHT); startOverHadoopNZK.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { wizard.init(); wizard.getConfig().setSetupType(SetupType.OVER_HADOOP_N_ZK); wizard.next(); } }); setContent(grid); }
From source file:jp.primecloud.auto.ui.MainMenu.java
License:Open Source License
MainMenu(final Window mainWindow) { this.mainWindow = mainWindow; VerticalLayout layout = (VerticalLayout) getContent(); setSizeFull();// w w w . ja v a2 s. c o m setStyleName("mainmenu"); addStyleName(Reindeer.PANEL_LIGHT); layout.setMargin(false); layout.setSpacing(true); layout.setSizeFull(); tree.setNullSelectionAllowed(false); final String[][] menus = new String[][] { new String[] { "MyCloud", "New", "Manage" }, new String[] { "Cloud?", "" } }; for (int i = 0; i < menus.length; i++) { String planet = (menus[i][0]); tree.addItem(planet); if (menus[i].length == 1) { // The planet has no moons so make it a leaf. tree.setChildrenAllowed(planet, false); } else { // Add children (moons) under the planets. for (int j = 1; j < menus[i].length; j++) { String moon = menus[i][j]; // Add the item as a regular item. tree.addItem(moon); // Set it to be a child. tree.setParent(moon, planet); // Make the moons look like leaves. tree.setChildrenAllowed(moon, false); } // Expand the subtree. tree.expandItemsRecursively(planet); } } layout.addComponent(tree); // VerticalLayout adlayout = new VerticalLayout(); adlayout.setSpacing(false); adlayout.setMargin(false); Label ad1 = new Label( "<a href='http://www.csk.com/systems/services/technology/index.html' target='_blank'><img width='147' alt='????' src='./VAADIN/themes/classy/images/technology_ttl.jpg'></a>"); ad1.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad1); Label ad2 = new Label( "<a href='http://www.csk.com/systems/services/technology/technology01.html' target='_blank'><img width='147' alt='??????????' src='./VAADIN/themes/classy/images/technology_menu1.jpg'></a>"); ad2.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad2); Label ad3 = new Label( "<a href='http://www.csk.com/systems/services/technology/technology02.html' target='_blank'><img width='147' alt='?????' src='./VAADIN/themes/classy/images/technology_menu2.jpg'></a>"); ad3.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad3); Label ad4 = new Label( "<a href='http://www.csk.com/systems/services/technology/technology03.html' target='_blank'><img width='147' alt='' src='./VAADIN/themes/classy/images/technology_menu3.jpg'></a>"); ad4.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad4); layout.addComponent(adlayout); layout.setComponentAlignment(adlayout, Alignment.MIDDLE_CENTER); // ?? ItemClickEvent.ItemClickListener listener = new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { String click = (String) event.getItemId(); if ("Manage".equals(click)) { showCloudEditWindow(); } else if ("New".equals(click)) { showCloudAddWindow(); } else if ("".equals(click)) { String url = Config.getProperty("zabbix.url"); mainWindow.open(new ExternalResource(url), "_blank"); } } }; tree.addListener(listener); // ??? showFirst(); }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.ComCompanyErrorView.java
License:Open Source License
public ComCompanyErrorView() { setSizeFull();//from www. j av a 2 s.c om Label message = new Label("<h1>Error: the console does not exist, you should run MsrCreator first.</h1>"); message.setSizeUndefined(); message.setContentMode(ContentMode.HTML); addComponent(message); setComponentAlignment(message, Alignment.MIDDLE_CENTER); }
From source file:oracle.social.johtaja.carbon.view.AboutWindow.java
License:Open Source License
private void createDialog() { Label richText = new Label(legalNotice); richText.setContentMode(Label.CONTENT_XHTML); addComponent(richText);//from w ww . j a v a 2 s . co m }
From source file:org.activiti.explorer.ui.custom.ToolBar.java
License:Apache License
public ToolBar() { entryMap = new HashMap<String, ToolbarEntry>(); actionButtons = new ArrayList<Button>(); additionalComponents = new ArrayList<Component>(); setWidth("100%"); setHeight(36, UNITS_PIXELS);/*from www .java 2s.c om*/ addStyleName(ExplorerLayout.STYLE_TOOLBAR); setSpacing(true); setMargin(false, true, false, true); // Add label to fill excess space Label spacer = new Label(); spacer.setContentMode(Label.CONTENT_XHTML); spacer.setValue(" "); addComponent(spacer); setExpandRatio(spacer, 1.0f); }
From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java
License:Apache License
protected void addTasks() { Label header = new Label(i18nManager.getMessage(Messages.FLOW_INSTANCE_HEADER_TASKS)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); verticalLayout.addComponent(header); Label spacer = new Label(); spacer.setValue(" "); spacer.setContentMode(Label.CONTENT_XHTML); verticalLayout.addComponent(spacer); Table taskTable = new Table(); taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST); taskTable.setWidth(100, UNITS_PERCENTAGE); // Fetch all tasks List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() .processInstanceId(processInstance.getId()).orderByHistoricTaskInstanceEndTime().desc() .orderByHistoricActivityInstanceStartTime().desc().list(); if (tasks.size() > 0) { // Finished icon taskTable.addContainerProperty("finished", Component.class, null, "", null, Table.ALIGN_CENTER); taskTable.setColumnWidth("finished", 22); taskTable.addContainerProperty("name", String.class, null, i18nManager.getMessage(Messages.TASK_NAME), null, Table.ALIGN_LEFT); taskTable.addContainerProperty("priority", Integer.class, null, i18nManager.getMessage(Messages.TASK_PRIORITY), null, Table.ALIGN_LEFT); taskTable.addContainerProperty("assignee", Component.class, null, i18nManager.getMessage(Messages.TASK_ASSIGNEE), null, Table.ALIGN_LEFT); taskTable.addContainerProperty("dueDate", Component.class, null, i18nManager.getMessage(Messages.TASK_DUEDATE), null, Table.ALIGN_LEFT); taskTable.addContainerProperty("startDate", Component.class, null, i18nManager.getMessage(Messages.TASK_CREATE_TIME), null, Table.ALIGN_LEFT); taskTable.addContainerProperty("endDate", Component.class, null, i18nManager.getMessage(Messages.TASK_COMPLETE_TIME), null, Table.ALIGN_LEFT); verticalLayout.addComponent(taskTable); verticalLayout.setExpandRatio(taskTable, 1.0f); for (HistoricTaskInstance task : tasks) { addTaskItem(task, taskTable); }/*from www.j a v a 2 s . co m*/ taskTable.setPageLength(taskTable.size()); } else { // No tasks Label noTaskLabel = new Label(i18nManager.getMessage(Messages.FLOW_INSTANCE_NO_TASKS)); verticalLayout.addComponent(noTaskLabel); } }
From source file:org.activiti.explorer.ui.mainlayout.MainLayout.java
License:Apache License
protected void initFooter() { footer = new CssLayout(); footer.setWidth(100, UNITS_PERCENTAGE); footer.addStyleName(ExplorerLayout.STYLE_MAIN_FOOTER); addComponent(footer);//w w w . ja va2s. c om Label footerLabel = new Label(); footerLabel.setContentMode(Label.CONTENT_XHTML); footerLabel.setValue(i18nManager.getMessage(Messages.FOOTER_MESSAGE)); footerLabel.setWidth(100, UNITS_PERCENTAGE); footer.addComponent(footerLabel); }
From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java
License:Apache License
protected void addJobState() { Label processDefinitionHeader = new Label(i18nManager.getMessage(Messages.JOB_HEADER_EXECUTION)); processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_H3); processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); processDefinitionHeader.setWidth(100, UNITS_PERCENTAGE); addComponent(processDefinitionHeader); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);//from ww w .j a v a 2 s. c o m layout.setSizeFull(); layout.setMargin(true, false, true, false); addDetailComponent(layout); setDetailExpandRatio(layout, 1.0f); // Exceptions if (job.getExceptionMessage() != null) { // Number of retries Label retrieslabel = new Label(getRetriesLabel(job)); layout.addComponent(retrieslabel); // Exception Label exceptionMessageLabel = new Label( i18nManager.getMessage(Messages.JOB_ERROR) + ": " + job.getExceptionMessage()); exceptionMessageLabel.addStyleName(ExplorerLayout.STYLE_JOB_EXCEPTION_MESSAGE); layout.addComponent(exceptionMessageLabel); // Add Exception stacktrace String stack = managementService.getJobExceptionStacktrace(job.getId()); Label stackTraceLabel = new Label(stack); stackTraceLabel.setContentMode(Label.CONTENT_PREFORMATTED); stackTraceLabel.addStyleName(ExplorerLayout.STYLE_JOB_EXCEPTION_TRACE); stackTraceLabel.setSizeFull(); Panel stackPanel = new Panel(); stackPanel.setWidth(100, UNITS_PERCENTAGE); stackPanel.setSizeFull(); stackPanel.setScrollable(true); stackPanel.addComponent(stackTraceLabel); layout.addComponent(stackPanel); layout.setExpandRatio(stackPanel, 1.0f); } else { if (job.getProcessDefinitionId() != null) { // This is a hack .. need to cleanify this in the engine JobEntity jobEntity = (JobEntity) job; if (jobEntity.getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) { addLinkToProcessDefinition(layout, i18nManager.getMessage(Messages.JOB_SUSPEND_PROCESSDEFINITION), false); } else if (jobEntity.getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) { addLinkToProcessDefinition(layout, i18nManager.getMessage(Messages.JOB_ACTIVATE_PROCESSDEFINITION), true); } else { addNotYetExecutedLabel(layout); } } else { addNotYetExecutedLabel(layout); } } }