public WorkspaceManager() { PrettyFormLayout form = new PrettyFormLayout(); form.addHeader( GuvnorImages.INSTANCE.WorkspaceManager(), new HTML("<b>" + constants.ManageWorkspaces() + "</b>")); form.startSection(constants.Workspaces()); form.addAttribute("", buildDoubleList()); HorizontalPanel hPanel = new HorizontalPanel(); Button create = new Button(constants.AddWorkspace()); create.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { WorkspaceEditor newCat = new WorkspaceEditor( new Command() { public void execute() { refreshWorkspaceList(); } }); newCat.show(); } }); Button remove = new Button(constants.DeleteSelectedWorkspace()); remove.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { if (availableWorkspacesListBox.getSelectedIndex() == -1) { Window.alert(constants.PleaseSelectAWorkspaceToRemove()); return; } removeWorkspace(); } }); Button updateWorkspace = new Button(constants.UpdateSelectedWorkspace()); updateWorkspace.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { if (availableWorkspacesListBox.getSelectedIndex() == -1) { Window.alert(constants.PleaseSelectAWorkspaceToUpdate()); return; } updateWorkspace(); } }); hPanel.add(create); hPanel.add(remove); hPanel.add(updateWorkspace); form.addAttribute("", hPanel); form.endSection(); initWidget(form); }
public CategoryManager() { PrettyFormLayout form = new PrettyFormLayout(); form.addHeader(images.editCategory(), new HTML(constants.EditCategories())); form.startSection(constants.CategoriesPurposeTip()); explorer = new CategoryExplorerWidget( new CategorySelectHandler() { public void selected(String sel) { // don't need this here as we don't do anything on select in this spot } }); SimplePanel editable = new SimplePanel(); editable.add(explorer); form.addAttribute(constants.CurrentCategories(), editable); HorizontalPanel actions = new HorizontalPanel(); form.addAttribute("", actions); Button newCat = new Button(constants.NewCategory()); newCat.setTitle(constants.CreateANewCategory()); newCat.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { CategoryEditor newCat = new CategoryEditor( explorer.getSelectedPath(), new Command() { public void execute() { explorer.refresh(); } }); newCat.show(); } }); actions.add(newCat); Button rename = new Button(constants.RenameSelected()); rename.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { if (!explorer.isSelected()) { Window.alert(constants.PleaseSelectACategoryToRename()); return; } renameSelected(); } }); actions.add(rename); Button delete = new Button(constants.DeleteSelected()); delete.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { if (!explorer.isSelected()) { Window.alert(constants.PleaseSelectACategoryToDelete()); return; } deleteSelected(); } }); delete.setTitle(constants.DeleteSelectedCat()); actions.add(delete); form.endSection(); initWidget(form); }