List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:com.klwork.explorer.ui.custom.ToolBar.java
License:Apache License
/** * Add a button to the toolbar. The buttons are rendered on the right of the * toolbar.//from ww w . ja v a2 s.c o m */ public void addButton(Button button) { button.addStyleName(ExplorerLayout.STYLE_TOOLBAR_BUTTON); actionButtons.add(button); // Button is added after the spacer addComponent(button); setComponentAlignment(button, Alignment.MIDDLE_RIGHT); }
From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
/** * Highlights the given main navigation in the menubar. *//*w w w . jav a2 s .c om*/ public synchronized void setMainNavigation(String navigation) { if (currentMainNavigation != null) { menuItemButtons.get(currentMainNavigation).removeStyleName(ExplorerLayout.STYLE_ACTIVE); } currentMainNavigation = navigation; Button current = menuItemButtons.get(navigation); if (current != null) { current.addStyleName(ExplorerLayout.STYLE_ACTIVE); } }
From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) { Button button = new Button(label); button.addStyleName(type); button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON); button.addStyleName(Reindeer.BUTTON_LINK); button.setHeight(54, Unit.PIXELS);/*ww w . java 2 s.c o m*/ button.setIcon(icon); button.setWidth(width, Unit.PIXELS); addComponent(button); setComponentAlignment(button, Alignment.TOP_CENTER); return button; }
From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void initParentTaskLink() { if (historicTask.getParentTaskId() != null) { final HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery() .taskId(historicTask.getParentTaskId()).singleResult(); Button showParentTaskButton = new Button( i18nManager.getMessage(Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName())); showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK); showParentTaskButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { viewManager.showTaskPage(parentTask.getId()); }// ww w . j a v a 2 s .co m }); centralLayout.addComponent(showParentTaskButton); } }
From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) { for (final HistoricTaskInstance subTask : subTasks) { // icon//from w w w.java2 s . c o m Embedded icon = new Embedded(null, Images.TASK_22); icon.setWidth(22, UNITS_PIXELS); icon.setWidth(22, UNITS_PIXELS); subTaskGrid.addComponent(icon); // Link to subtask Button subTaskLink = new Button(subTask.getName()); subTaskLink.addStyleName(Reindeer.BUTTON_LINK); subTaskLink.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { ViewToolManager.getMainView().showTaskPage(subTask.getId()); } }); subTaskGrid.addComponent(subTaskLink); subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT); } }
From source file:com.klwork.explorer.ui.task.SubTaskComponent.java
License:Apache License
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) { if (subTasks.size() > 0) { for (final HistoricTaskInstance subTask : subTasks) { // icon Embedded icon = null;/*from ww w . ja v a2 s. c om*/ if (subTask.getEndTime() != null) {//? icon = new Embedded(null, Images.TASK_FINISHED_22); } else { icon = new Embedded(null, Images.TASK_22); } icon.setWidth(22, UNITS_PIXELS); icon.setWidth(22, UNITS_PIXELS); subTaskLayout.addComponent(icon); // Link to subtask Button subTaskLink = new Button(subTask.getName()); subTaskLink.addStyleName(Reindeer.BUTTON_LINK); subTaskLink.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { //ExplorerApp.get().getViewManager().showTaskPage(subTask.getId()); } }); subTaskLayout.addComponent(subTaskLink); subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT); if (subTask.getEndTime() == null) { // Delete icon only appears when task is not finished yet Embedded deleteIcon = new Embedded(null, Images.DELETE); deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE); deleteIcon.addListener(new DeleteSubTaskClickListener(subTask, this)); subTaskLayout.addComponent(deleteIcon); subTaskLayout.setComponentAlignment(deleteIcon, Alignment.MIDDLE_RIGHT); } else { // Next line of grid subTaskLayout.newLine(); } } } else { Label noSubTasksLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_SUBTASKS)); noSubTasksLabel.setSizeUndefined(); noSubTasksLabel.addStyleName(Reindeer.LABEL_SMALL); subTaskLayout.addComponent(noSubTasksLabel); } }
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initProcessLink() { if (task.getProcessInstanceId() != null) { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionId(task.getProcessDefinitionId()).singleResult(); Button showProcessInstanceButton = new Button(i18nManager.getMessage(Messages.TASK_PART_OF_PROCESS, getProcessDisplayName(processDefinition))); showProcessInstanceButton.addStyleName(Reindeer.BUTTON_LINK); showProcessInstanceButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { //viewManager.showMyProcessInstancesPage(task.getProcessInstanceId()); }// w w w .ja va 2 s. com }); centralLayout.addComponent(showProcessInstanceButton); addEmptySpace(centralLayout); } }
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initParentTaskLink() { if (task.getParentTaskId() != null) { final Task parentTask = taskService.createTaskQuery().taskId(task.getParentTaskId()).singleResult(); Button showParentTaskButton = new Button( i18nManager.getMessage(Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName())); showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK); showParentTaskButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { //viewManager.showTaskPage(parentTask.getId()); }//from ww w . java 2 s . c o m }); centralLayout.addComponent(showParentTaskButton); addEmptySpace(centralLayout); } }
From source file:com.klwork.explorer.ui.task.TaskRelatedContentComponent.java
License:Apache License
protected void initActions() { // WW_TODO ?//w ww . j a va 2 s. co m HorizontalLayout actionsContainer = new HorizontalLayout(); actionsContainer.setSizeFull(); // Title Label processTitle = new Label(i18nManager.getMessage(Messages.TASK_RELATED_CONTENT)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processTitle.setSizeFull(); actionsContainer.addComponent(processTitle); actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT); actionsContainer.setExpandRatio(processTitle, 1.0f); // Add content button Button addRelatedContentButton = new Button(); addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD); addRelatedContentButton.addClickListener(new com.vaadin.ui.Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow(); if (task.getProcessInstanceId() != null) { popup.setProcessInstanceId(task.getProcessInstanceId()); } else { popup.setTaskId(task.getId()); } // Add listener to update attachments when added popup.addListener(new SubmitEventListener() { private static final long serialVersionUID = 1L; @Override protected void submitted(SubmitEvent event) { taskDetailPanel.notifyRelatedContentChanged(); } @Override protected void cancelled(SubmitEvent event) { // No attachment was added so updating UI isn't // needed. } }); ViewToolManager.showPopupWindow(popup); } }); actionsContainer.addComponent(addRelatedContentButton); actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT); addComponent(actionsContainer); }
From source file:com.klwork.explorer.ui.task.UserDetailsComponent.java
License:Apache License
protected void addUserDetails() { VerticalLayout detailsLayout = new VerticalLayout(); addComponent(detailsLayout);// w w w . j a va 2s .c om // Layout for name + skype HorizontalLayout nameLayout = new HorizontalLayout(); nameLayout.setSpacing(true); detailsLayout.addComponent(nameLayout); // Name Label nameLabel = null; if (user != null) { nameLabel = new Label(user.getFirstName() + " " + user.getLastName()); nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD); } else { nameLabel = new Label(" ", Label.CONTENT_XHTML); } nameLayout.addComponent(nameLabel); // Layout for lower details HorizontalLayout actionsLayout = new HorizontalLayout(); actionsLayout.setSpacing(true); detailsLayout.addComponent(actionsLayout); // Role Label roleLabel = new Label(role); actionsLayout.addComponent(roleLabel); // Action button if (clickListener != null) { Button button = new Button(buttonCaption); button.addStyleName(Reindeer.BUTTON_SMALL); button.addClickListener(clickListener); actionsLayout.addComponent(button); } }