List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:com.esofthead.mycollab.mobile.module.project.ui.TimeLogEditView.java
License:Open Source License
private void initUI() { headerPanel = new HorizontalLayout(); headerPanel.setWidth("100%"); headerPanel.setStyleName("summary-info-panel"); headerPanel.setMargin(new MarginInfo(true, false, true, false)); headerPanel.setHeightUndefined();//from w w w. j av a 2 s . c o m content.addComponent(headerPanel); constructSpentTimeEntryPanel(); constructRemainTimeEntryPanel(); this.tableItem = new DefaultPagedBeanList<ItemTimeLoggingService, ItemTimeLoggingSearchCriteria, SimpleItemTimeLogging>( ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), new TimeLogRowHandler()) { private static final long serialVersionUID = -4549910960891655297L; @Override protected void renderRows() { int i = 0; Date currentDate = new GregorianCalendar(2100, 1, 1).getTime(); for (final SimpleItemTimeLogging item : currentListData) { if (!DateUtils.isSameDay(item.getLogforday(), currentDate)) { Label dateLbl = new Label(AppContext.formatDate(item.getLogforday())); dateLbl.setStyleName("log-day"); listContainer.addComponent(dateLbl); currentDate = item.getLogforday(); } final Component row = getRowDisplayHandler().generateRow(item, i); listContainer.addComponent(row); i++; } } }; this.tableItem.setWidth("100%"); content.addComponent(tableItem); content.setExpandRatio(tableItem, 1.0f); VerticalLayout controlBtns = new VerticalLayout(); controlBtns.setSpacing(true); controlBtns.setWidth("100%"); controlBtns.setMargin(true); controlBtns.addStyleName("edit-btn-layout"); controlBtns.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Button addNewEntryBtn = new Button(AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_ADD_TIME_LOG_ENTRY), new Button.ClickListener() { private static final long serialVersionUID = -2540265040691537699L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new NewTimeLogEntryWindow()); } }); addNewEntryBtn.setWidth("100%"); controlBtns.addComponent(addNewEntryBtn); Button updateRemainTimeBtn = new Button( AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_UPDATE_REMAIN_HOURS), new Button.ClickListener() { private static final long serialVersionUID = 9215577509351959739L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new UpdateRemainTimeWindow()); } }); updateRemainTimeBtn.setWidth("100%"); controlBtns.addComponent(updateRemainTimeBtn); NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu(); editBtn.setButtonCaption(null); editBtn.setStyleName("edit-btn"); editBtn.setContent(controlBtns); this.setRightComponent(editBtn); }
From source file:com.esofthead.mycollab.mobile.module.project.view.ProjectLoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);//ww w. j a va 2 s . c o m contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); Label welcomeText = new Label("Login to Projects"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new ProjectEvent.PlainLogin(this, new String[] { emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) })); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu(); editBtn.setButtonCaption(null);//from w ww. ja va2s . co m editBtn.setStyleName("edit-btn"); ProjectPreviewFormControlsGenerator<SimpleTaskList> controlsGenerator = new ProjectPreviewFormControlsGenerator<>( this); VerticalLayout menuContent = controlsGenerator.createButtonControls(ProjectRolePermissionCollections.TASKS); Button viewTaskList = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_VIEW), new Button.ClickListener() { private static final long serialVersionUID = 150675475815367481L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance() .post(new TaskEvent.GotoListView(this, currentTaskList.getId())); } }); viewTaskList.setWidth("100%"); viewTaskList.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); Button addNewTask = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), new Button.ClickListener() { private static final long serialVersionUID = -8074297964143853121L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoAdd(this, currentTaskList.getId())); } }); addNewTask.setWidth("100%"); addNewTask.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); Button closeBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { currentTaskList.setStatus(StatusI18nEnum.Closed.name()); final ProjectTaskListService taskListService = ApplicationContextUtil .getSpringBean(ProjectTaskListService.class); taskListService.updateWithSession(currentTaskList, AppContext.getUsername()); EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null)); } }); closeBtn.setWidth("100%"); closeBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); controlsGenerator.insertToControlBlock(closeBtn); controlsGenerator.insertToControlBlock(viewTaskList); controlsGenerator.insertToControlBlock(addNewTask); editBtn.setContent(menuContent); return editBtn; }
From source file:com.esofthead.mycollab.mobile.module.user.view.LoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);/*ww w . ja v a 2 s . co m*/ contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); welcomeTextWrapper.setHeight("15px"); Label welcomeText = new Label("Welcome Back!"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { ShellController.doLogin(emailField.getValue(), pwdField.getValue(), rememberPassword.getValue()); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.shell.view.MainView.java
License:Open Source License
public MainView() { super();//w w w .ja v a 2 s .com this.setSizeFull(); MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth(); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); welcomeTextWrapper.setHeight("15px"); contentLayout.addComponent(welcomeTextWrapper); Button crmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_CRM), new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null)); } }); crmButton.addStyleName(UIConstants.BUTTON_ACTION); crmButton.setWidth("100%"); contentLayout.addComponent(crmButton); Button pmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null)); } }); pmButton.setWidth("100%"); pmButton.addStyleName(UIConstants.BUTTON_ACTION); contentLayout.addComponent(pmButton); this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.ui.ConfirmDialog.java
License:Open Source License
private void constructUI(final String message, final String okCaption, final String cancelCaption) { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined();/* ww w .ja v a2 s .c om*/ layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); VerticalLayout messageWrapper = new VerticalLayout(); messageWrapper.setStyleName("message-wrapper"); messageWrapper.setWidth("100%"); messageWrapper.setMargin(true); final Label messageDisplay = new Label(message); messageDisplay.setWidth("100%"); messageWrapper.addComponent(messageDisplay); layout.addComponent(messageWrapper); HorizontalLayout controlBtn = new HorizontalLayout(); controlBtn.setWidth("100%"); final Button okBtn = new Button(okCaption); okBtn.setWidth("100%"); okBtn.setHeight("35px"); final Button cancelBtn = new Button(cancelCaption); cancelBtn.setWidth("100%"); cancelBtn.setHeight("35px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = -8306231710367659086L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.this.setConfirmed(event.getButton() == okBtn); if (ConfirmDialog.this.getListener() != null) { ConfirmDialog.this.getListener().onClose(ConfirmDialog.this); } ConfirmDialog.this.close(); } }; okBtn.addClickListener(listener); cancelBtn.addClickListener(listener); controlBtn.addComponent(cancelBtn); controlBtn.addComponent(okBtn); layout.addComponent(controlBtn); this.setContent(layout); }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); HorizontalLayout attachmentRow = new HorizontalLayout(); attachmentRow.setStyleName("attachment-row"); attachmentRow.setWidth("100%"); attachmentRow.setSpacing(true);/*from w w w . j a v a 2s. c o m*/ attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentRow.addComponent(thumbnailWrap); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); } if (MimeTypesUtil.isImageType(docName)) { Button b = new Button(attachment.getTitle(), new Button.ClickListener() { private static final long serialVersionUID = -1713187920922886934L; @Override public void buttonClick(Button.ClickEvent event) { AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceManager .getResourceManager().getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE)); EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView)); } }); b.setWidth("100%"); attachmentRow.addComponent(b); attachmentRow.setExpandRatio(b, 1.0f); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); attachmentRow.addComponent(l); attachmentRow.setExpandRatio(l, 1.0f); } return attachmentRow; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugKanbanViewImpl.java
License:Open Source License
public BugKanbanViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new BugSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override// w w w .j a v a2 s.c om public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new BugEvent.GotoList(BugKanbanViewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Detail"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withFullHeight(); kanbanLayout.addStyleName("kanban-layout"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskDashboardViewImpl.java
License:Open Source License
public TaskDashboardViewImpl() { this.withMargin(new MarginInfo(false, true, true, true)); taskSearchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); groupWrapLayout.addComponent(new Label("Sort")); final ComboBox sortCombo = new ValueComboBox(false, AppContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING), AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING)); sortCombo.addValueChangeListener(new Property.ValueChangeListener() { @Override//from w w w .ja v a 2 s . c o m public void valueChange(Property.ValueChangeEvent valueChangeEvent) { String sortValue = (String) sortCombo.getValue(); if (AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) { sortDirection = SearchCriteria.ASC; } else { sortDirection = SearchCriteria.DESC; } queryAndDisplayTasks(); } }); sortDirection = SearchCriteria.DESC; groupWrapLayout.addComponent(sortCombo); groupWrapLayout.addComponent(new Label("Group by")); final ComboBox groupCombo = new ValueComboBox(false, GROUP_DUE_DATE, GROUP_START_DATE, GROUP_CREATED_DATE, PLAIN_LIST, GROUP_USER); groupCombo.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { groupByState = (String) groupCombo.getValue(); queryAndDisplayTasks(); } }); groupByState = GROUP_DUE_DATE; groupWrapLayout.addComponent(groupCombo); taskSearchPanel.addHeaderRight(groupWrapLayout); Button printBtn = new Button("", new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { UI.getCurrent().addWindow(new TaskCustomizeReportOutputWindow(new LazyValueInjector() { @Override protected Object doEval() { return baseCriteria; } })); } }); printBtn.setIcon(FontAwesome.PRINT); printBtn.addStyleName(UIConstants.BUTTON_OPTION); printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT)); groupWrapLayout.addComponent(printBtn); Button newTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { SimpleTask newTask = new SimpleTask(); newTask.setProjectid(CurrentProjectVariables.getProjectId()); newTask.setSaccountid(AppContext.getAccountId()); newTask.setLogby(AppContext.getUsername()); UI.getCurrent().addWindow(new TaskAddWindow(newTask)); } } }); newTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); newTaskBtn.setIcon(FontAwesome.PLUS); newTaskBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(newTaskBtn); Button advanceDisplayBtn = new Button("List"); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban", new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { displayKanbanView(); } }); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(advanceDisplayBtn); groupWrapLayout.addComponent(viewButtons); MHorizontalLayout mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth(); wrapBody = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, false)); rightColumn = new MVerticalLayout().withWidth("370px") .withMargin(new MarginInfo(true, false, false, false)); mainLayout.with(wrapBody, rightColumn).expand(wrapBody); this.with(taskSearchPanel, mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskKanbanBoardViewImpl.java
License:Open Source License
public TaskKanbanBoardViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); toggleShowColumsBtn = new Button(""); toggleShowColumsBtn.addClickListener(new Button.ClickListener() { @Override/*from www .ja v a 2 s. com*/ public void buttonClick(Button.ClickEvent clickEvent) { displayHiddenColumns = !displayHiddenColumns; reload(); toggleShowButton(); } }); toggleShowColumsBtn.addStyleName(UIConstants.BUTTON_LINK); groupWrapLayout.addComponent(toggleShowColumsBtn); toggleShowButton(); Button addNewColumnBtn = new Button(AppContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().addWindow(new AddNewColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK, "status")); } }); addNewColumnBtn.setIcon(FontAwesome.PLUS); addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(addNewColumnBtn); Button deleteColumnBtn = new Button("Delete columns", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent() .addWindow(new DeleteColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK)); } }); deleteColumnBtn.setIcon(FontAwesome.TRASH_O); deleteColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); deleteColumnBtn.setStyleName(UIConstants.BUTTON_DANGER); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoDashboard(TaskKanbanBoardViewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new DDHorizontalLayout(); kanbanLayout.setHeight("100%"); kanbanLayout.addStyleName("kanban-layout"); kanbanLayout.setSpacing(true); kanbanLayout.setMargin(new MarginInfo(true, false, true, false)); kanbanLayout.setComponentHorizontalDropRatio(0.3f); kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER); // Enable dropping components kanbanLayout.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event .getTargetDetails(); Component dragComponent = transferable.getComponent(); if (dragComponent instanceof KanbanBlock) { KanbanBlock kanbanItem = (KanbanBlock) dragComponent; int newIndex = details.getOverIndex(); if (details.getDropLocation() == HorizontalDropLocation.RIGHT) { kanbanLayout.addComponent(kanbanItem); } else if (newIndex == -1) { kanbanLayout.addComponent(kanbanItem, 0); } else { kanbanLayout.addComponent(kanbanItem, newIndex); } //Update options index for this project List<Map<String, Integer>> indexMap = new ArrayList<>(); for (int i = 0; i < kanbanLayout.getComponentCount(); i++) { KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i); Map<String, Integer> map = new HashedMap(2); map.put("id", blockItem.optionVal.getId()); map.put("index", i); indexMap.add(map); } if (indexMap.size() > 0) { optionValService.massUpdateOptionIndexes(indexMap, AppContext.getAccountId()); } } } @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } }); this.setWidth("100%"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }