List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.klwork.explorer.ui.main.views.GuestView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();/* w w w . j a v a2 s . c om*/ VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresGuest")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.RoleAdminView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();/*from w w w .j ava 2 s . co m*/ VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresRoles(\"admin\")")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.RoleUserView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from w w w . j a v a2 s . c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresRoles(\"user\")")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.SampleMainView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from w ww. ja va2 s . c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); HorizontalLayout usernameLayout = new HorizontalLayout(); usernameLayout.setSpacing(true); usernameLayout.addComponent(new Label("Username:")); usernameLayout.addComponent(usernameLabel); //HorizontalLayout userRolesLayout = new HorizontalLayout(); //userRolesLayout.setSpacing(true); //userRolesLayout.addComponent(new Label("Roles:")); //userRolesLayout.addComponent(rolesLabel); layout.addComponent(usernameLayout); //addComponent(userRolesLayout); Link roleUserView = new Link("Role \"user\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleUserView.NAME)); Link roleAdminView = new Link("Role \"admin\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME)); Link authenticatedView = new Link("@RequiresAuthentication View (disabled, if user doesn't have access)", new ExternalResource("#!" + AuthenticatedView.NAME)); Link guestView = new Link("@RequiresGuest View (disabled, if user doesn't have access)", new ExternalResource("#!" + GuestView.NAME)); Link userView = new Link("@RequiresUser View (disabled, if user doesn't have access)", new ExternalResource("#!" + UserView.NAME)); roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class)); roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class)); authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class)); guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class)); userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class)); layout.addComponent(roleUserView); layout.addComponent(roleAdminView); layout.addComponent(authenticatedView); layout.addComponent(guestView); layout.addComponent(userView); layout.addComponent(new Link("Role \"admin\" View (throw exception, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME))); layout.addComponent(new Link("Logout", new ExternalResource("/logout/"))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.UserView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();/*from w ww . j a va2 s . c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresUser")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java
License:Apache License
protected void addTaskEventText(final Comment taskEvent, final GridLayout eventGrid) { VerticalLayout layout = new VerticalLayout(); layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT); layout.setWidth("100%"); eventGrid.addComponent(layout);/*from w w w . j a v a 2 s . co m*/ // Actual text Label text = taskEventTextResolver.resolveText(taskEvent); text.setWidth("100%"); layout.addComponent(text); // Time String human = new HumanTime(i18nManager).format(taskEvent.getTime()); Label time = new Label(human + "(" + ")"); time.setSizeUndefined(); time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME); layout.addComponent(time); }
From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java
License:Apache License
public void initAddEventInput(HorizontalLayout hLayout) { Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be // attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout textFieldPanelLayout = new VerticalLayout(); textFieldPanel.setContent(textFieldPanelLayout); textFieldPanel.setWidth(100, Unit.PERCENTAGE); hLayout.addComponent(textFieldPanel); hLayout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, Unit.PERCENTAGE); textFieldPanelLayout.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); }//from w w w . j a v a 2s .c o m public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); }
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); }/*from w w w . ja v a2 s . c o m*/ 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.TaskEventsPanel.java
License:Apache License
protected void addTaskEventText(final org.activiti.engine.task.Event taskEvent, final GridLayout eventGrid) { VerticalLayout layout = new VerticalLayout(); layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT); layout.setWidth("100%"); eventGrid.addComponent(layout);/*from w w w .jav a 2 s. co m*/ // Actual text Label text = taskEventTextResolver.resolveText(taskEvent); text.setWidth("100%"); layout.addComponent(text); // Time Label time = new Label(new HumanTime(i18nManager).format(taskEvent.getTime())); time.setSizeUndefined(); time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME); layout.addComponent(time); }
From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java
License:Apache License
public void initAddEventInput(HorizontalLayout hLayout) { Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout textFieldPanelLayout = new VerticalLayout(); textFieldPanel.setContent(textFieldPanelLayout); textFieldPanel.setWidth(100, Unit.PERCENTAGE); hLayout.addComponent(textFieldPanel); hLayout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, Unit.PERCENTAGE); textFieldPanelLayout.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); }//from w w w .j a v a 2 s . com public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); }