List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:com.hivesys.dashboard.view.search.TextualView.java
public void UpdateSearchPane(String searchString) { css.removeAllComponents();/*from ww w.j a v a 2s .c o m*/ SearchResponse response = ElasticSearchContext.getInstance().searchSimpleQuery(searchString); logResponse(response); SearchHits results = response.getHits(); Label labelResultSummary = new Label("About " + results.getHits().length + " results found <br><br>", ContentMode.HTML); css.addComponent(labelResultSummary); for (SearchHit hit : results) { CssLayout cssResult = new CssLayout(); cssResult.setStyleName("search-result"); try { String filename = DocumentDB.getInstance().getDocumentNameFromHash(hit.getId()); String boxviewID = DocumentDB.getInstance().getBoxViewIDFromHash(hit.getId()); String highlight = ""; HighlightField objhighlight = hit.highlightFields().get("file"); if (objhighlight != null) { for (Text fgmt : objhighlight.getFragments()) { highlight += fgmt.string() + "<br>"; } } Button lblfileName = new Button(filename); lblfileName.addClickListener((Button.ClickEvent event) -> { if (boxviewID != null) { String url = BoxViewDocuments.getInstance().getViewURL(boxviewID); if (url != null || !url.equals("")) { url = BoxViewDocuments.getInstance().getViewURL(boxviewID); BrowserFrame bframe = new BrowserFrame(filename, new ExternalResource(url)); VerticalLayout vlayout = new VerticalLayout(bframe); final Window w = new Window(); w.setSizeFull(); w.setModal(true); w.setWindowMode(WindowMode.MAXIMIZED); w.setContent(vlayout); vlayout.setSizeFull(); vlayout.setMargin(true); w.setResizable(false); w.setDraggable(false); UI.getCurrent().addWindow(w); bframe.setSizeFull(); return; } Notification.show("Preview not available for this document!"); } }); lblfileName.setPrimaryStyleName("filename"); Label lblHighlight = new Label(highlight, ContentMode.HTML); lblHighlight.setStyleName("highlight"); cssResult.addComponent(lblfileName); cssResult.addComponent(lblHighlight); css.addComponent(cssResult); css.addComponent(new Label("<br>", ContentMode.HTML)); } catch (SQLException ex) { } } }
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. j av a 2 s .c o m*/ }
From source file:com.klwork.explorer.project.PublicProjectListPage.java
License:Apache License
Layout buildTree() { CssLayout margin = new CssLayout(); margin.setWidth("100%"); //margin.setMargin(new MarginInfo(true, false, true, true)); // Spacing/*from w ww. j ava 2 s . c o m*/ margin.addComponent(new Label(" ", ContentMode.HTML)); Label text = new Label("hello,word"); text.addStyleName(Runo.LABEL_SMALL); margin.addComponent(text); text.setWidth("90%"); Tree t = new Tree(); String itemId = "?"; t.addItem(itemId); t.select(itemId); t.setItemIcon(itemId, new ThemeResource("icons/16/calendar.png")); createTreeItem(t, "(5000)", itemId); t.expandItem(itemId); String itemId2 = ""; t.addItem(itemId2); t.setItemIcon(itemId2, new ThemeResource("icons/16/document.png")); createTreeItem(t, "?(300)", itemId2); createTreeItem(t, "log", itemId2); t.expandItem(itemId2); String itemId3 = "?"; t.addItem(itemId3); t.setItemIcon(itemId3, new ThemeResource("icons/16/document.png")); createTreeItem(t, "?(3009)", itemId3); createTreeItem(t, "(40000)", itemId3); t.expandItem(itemId3); margin.addComponent(t); return margin; }
From source file:com.klwork.explorer.ui.custom.DetailPanel.java
License:Apache License
public DetailPanel() { setSizeFull();//from w w w . j a va2s . 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.mainlayout.MainLayout.java
License:Apache License
protected void initHeader() { header = new CssLayout(); header.addStyleName(ExplorerLayout.STYLE_HEADER); header.setWidth(100, Unit.PERCENTAGE); addComponent(header); }
From source file:com.klwork.explorer.ui.mainlayout.MainLayout.java
License:Apache License
protected void initMain() { main = new CssLayout(); main.setSizeFull();//from w w w . j a v a 2 s . c o m main.addStyleName(ExplorerLayout.STYLE_MAIN_CONTENT); addComponent(main); setExpandRatio(main, 1.0f); }
From source file:com.klwork.explorer.ui.mainlayout.MainLayout.java
License:Apache License
protected void initFooter() { footer = new CssLayout(); footer.setWidth(100, Unit.PERCENTAGE); footer.addStyleName(ExplorerLayout.STYLE_MAIN_FOOTER); addComponent(footer);/*from w w w. j ava 2s. c om*/ Label footerLabel = new Label(); footerLabel.setContentMode(ContentMode.HTML); footerLabel.setValue(i18nManager.getMessage(Messages.FOOTER_MESSAGE)); footerLabel.setWidth(100, Unit.PERCENTAGE); footer.addComponent(footerLabel); }
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); }/* w w w.j ava2 s.c om*/ centralLayout.addComponent(descriptionLayout); }
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initDescription(HorizontalLayout layout) { final CssLayout descriptionLayout = new CssLayout(); descriptionLayout.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLayout); layout.setExpandRatio(descriptionLayout, 1.0f); layout.setComponentAlignment(descriptionLayout, Alignment.MIDDLE_LEFT); String descriptionText = null; if (task.getDescription() != null && !"".equals(task.getDescription())) { descriptionText = task.getDescription(); } else {//?? descriptionText = i18nManager.getMessage(Messages.TASK_NO_DESCRIPTION); }// w ww.j a v a 2 s . com final Label descriptionLabel = new Label(descriptionText); descriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE); descriptionLayout.addComponent(descriptionLabel); descriptionLayout.addLayoutClickListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) { // layout for textarea + ok button final VerticalLayout editLayout = new VerticalLayout(); editLayout.setSpacing(true); // textarea final TextArea descriptionTextArea = new TextArea(); // descriptionTextArea.setNullRepresentation(""); descriptionTextArea.setWidth(100, Unit.PERCENTAGE); descriptionTextArea.setValue(task.getDescription()); editLayout.addComponent(descriptionTextArea); // ok button Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK)); editLayout.addComponent(okButton); editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT); // replace descriptionLayout.replaceComponent(descriptionLabel, editLayout); // When OK is clicked -> update task data + ui okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { // Update data task.setDescription(descriptionTextArea.getValue().toString()); taskService.saveTask(task); // Update UI descriptionLabel.setValue(task.getDescription()); descriptionLayout.replaceComponent(editLayout, descriptionLabel); } }); } } }); }
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form //task.getT// www . ja v a 2 s . c o 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); } }