private ButtonPanel createButtonPanel() { final Button customizeButton = new Button(""); customizeButton.setVisible(_isDashboardEditor); customizeButton.addStyleDependentName("ImageButton"); customizeButton.setTitle("Customize timeline"); customizeButton.addStyleName("CustomizeButton"); customizeButton.addClickHandler(new CustomizeTimelineHandler(_service, this)); final Button copyButton = new Button(""); copyButton.setVisible(_isDashboardEditor); copyButton.addStyleDependentName("ImageButton"); copyButton.setTitle("Copy timeline"); copyButton.addStyleName("CopyButton"); copyButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { TimelinePanel copyPanel = new TimelinePanel(_tenant, _service, null, _timelineGroupPanel, _isDashboardEditor); copyPanel.setTimelineDefinition(_timelineDefinition); _timelineGroupPanel.add(copyPanel); } }); final ButtonPanel buttonPanel = new ButtonPanel(); buttonPanel.add(_header); buttonPanel.add(customizeButton); buttonPanel.add(copyButton); buttonPanel.add(_saveButton); buttonPanel.add(_deleteButton); return buttonPanel; }
/** * Page widgets. * * @param cellTree the cell tree */ public void createPageView(CellTree cellTree) { this.cellTree = cellTree; mainPanel.setStyleName("div-wrapper"); // main div SimplePanel leftPanel = new SimplePanel(); leftPanel.getElement().setId("leftPanel_SimplePanel"); leftPanel.setStyleName("div-first bottomPadding10px"); // left side div which will have tree SimplePanel rightPanel = new SimplePanel(); rightPanel.getElement().setId("rightPanel_SimplePanel"); rightPanel.setStyleName("div-second"); // right div having tree creation inputs. VerticalPanel treePanel = new VerticalPanel(); treePanel.getElement().setId("treePanel_VerticalPanel"); HorizontalPanel expandCollapse = new HorizontalPanel(); expandCollapse.getElement().setId("expandCollapse_HorizontalPanel"); expandCollapse.setStyleName("leftAndTopPadding"); expandCollapse.setSize("100px", "20px"); buttonExpand.setStylePrimaryName("expandAllButton"); buttonCollapse.setStylePrimaryName("collapseAllButton"); buttonExpand.setTitle("Expand All (Shift +)"); buttonCollapse.setTitle("Collapse All (Shift -)"); expandCollapse.add(buttonExpand); expandCollapse.add(buttonCollapse); buttonExpand.setFocus(true); buttonCollapse.setVisible(true); treePanel.add(expandCollapse); treePanel.add(cellTree); leftPanel.add(treePanel); SimplePanel bottomSavePanel = new SimplePanel(); bottomSavePanel.getElement().setId("bottomSavePanel_SimplePanel"); bottomSavePanel.setStyleName("div-first buttonPadding"); VerticalPanel vp = new VerticalPanel(); HorizontalPanel savePanel = new HorizontalPanel(); savePanel.getElement().setId("savePanel_VerticalPanel"); savePanel.add(new SpacerWidget()); // savePanel.add(errorMessageDisplay); vp.add(successMessageDisplay); // saveBtn.setTitle("Ctrl+Alt+s"); savePanel.add(saveBtn); validateBtn.setTitle("Validate"); savePanel.add(validateBtn); vp.add(warningMessageDisplay); vp.add(savePanel); bottomSavePanel.add(vp); SimplePanel errPanel = new SimplePanel(); errPanel.getElement().setId("errPanel_SimplePanel"); errPanel.add(errorMessageDisplay); mainPanel.add(errPanel); mainPanel.add(leftPanel); mainPanel.add(rightPanel); mainPanel.add(bottomSavePanel); focusPanel.addKeyDownHandler(this); focusPanel.addFocusHandler(this); cellTreeHandlers(); }
public static Button getButton(String text, String styleName) { Button b = new Button(text); if (null != styleName) { b.setStyleName(styleName); } b.setTitle(text); updateNameAndId(b, text.replaceAll(" ", "")); return b; }
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); }
public DialogListaPontoEncontro( final InfoCaronaServerAsync controller, final String idSessao, final String idCarona) { novosPontos = ""; listaNovosPontosEncontros = new ArrayList<InfoPontoEncontro>(); this.idCarona = idCarona; this.controller = controller; setText("Pontos de Encontro - ID: " + idCarona); setAnimationEnabled(true); setGlassEnabled(true); center(); VerticalPanel panelListaPontoEncontro = new VerticalPanel(); tabelaPontoEncontro = new CellTable<InfoPontoEncontro>(); tabelaPontoEncontro.setWidth("400px"); dataProvider = new ListDataProvider<InfoPontoEncontro>(); SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true); pager.setDisplay(tabelaPontoEncontro); pager.setPageSize(5); TextColumn<InfoPontoEncontro> colunaIdPontoEncontro = new TextColumn<InfoPontoEncontro>() { @Override public String getValue(InfoPontoEncontro pontoEncontro) { return pontoEncontro.getIdPontoEncontro(); } }; TextColumn<InfoPontoEncontro> colunaPontosEncontro = new TextColumn<InfoPontoEncontro>() { @Override public String getValue(InfoPontoEncontro pontoEncontro) { return pontoEncontro.getPontoEncontro(); } }; tabelaPontoEncontro.addColumn(colunaPontosEncontro, "Pontos de Encontro"); listaPontoEncontros = new ArrayList<InfoPontoEncontro>(); populaTabela(); HorizontalPanel hPanel01 = new HorizontalPanel(); final TextBox boxNovoPontoEncontro = new TextBox(); boxNovoPontoEncontro.setWidth("200px"); boxNovoPontoEncontro.setStyleName("boxModificada"); Button buttonAdicionarOutroPontoEncontro = new Button(); buttonAdicionarOutroPontoEncontro.setStyleName("botaoModificado"); buttonAdicionarOutroPontoEncontro.setTitle("Adicionar Sugestão"); buttonAdicionarOutroPontoEncontro.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (boxNovoPontoEncontro.getText().trim().equals("")) { DialogMensagemUsuario dialogErro = new DialogMensagemUsuario("Falhou", "Ponto de Encontro Inválido"); dialogErro.show(); } else { novosPontos += boxNovoPontoEncontro.getText().trim() + ";"; InfoPontoEncontro novoPontoEncontro = new InfoPontoEncontro("00", boxNovoPontoEncontro.getText().trim()); boxNovoPontoEncontro.setText(""); listaNovosPontosEncontros.add(novoPontoEncontro); listaPontoEncontros = new ArrayList<InfoPontoEncontro>(); for (InfoPontoEncontro novoPonto : listaNovosPontosEncontros) { listaPontoEncontros.add(novoPonto); } populaTabela(); } } }); Image imageFiltro = new Image("imagens/adicionar.png"); imageFiltro.setSize("15px", "15px"); buttonAdicionarOutroPontoEncontro.getElement().appendChild(imageFiltro.getElement()); Button buttonSalvarNovosPontos = new Button("Salvar"); buttonSalvarNovosPontos.setStyleName("botaoModificado"); buttonSalvarNovosPontos.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { controller.cadastrarNovosPontosEncontro( idSessao, idCarona, novosPontos, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { DialogMensagemUsuario dialogSucess = new DialogMensagemUsuario("Erro", caught.getMessage()); dialogSucess.show(); } @Override public void onSuccess(String result) { DialogMensagemUsuario dialogSucess = new DialogMensagemUsuario( "ID: " + result, "Pontos de Encontro Cadastrados com Sucesso!"); dialogSucess.show(); hide(); } }); } }); Button buttonFechar = new Button("Fechar"); buttonFechar.setStyleName("botaoModificado"); buttonFechar.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); colunaPontosEncontro.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); hPanel01.setCellVerticalAlignment(boxNovoPontoEncontro, HasVerticalAlignment.ALIGN_BOTTOM); hPanel01.setCellVerticalAlignment(buttonSalvarNovosPontos, HasVerticalAlignment.ALIGN_TOP); hPanel01.setCellVerticalAlignment( buttonAdicionarOutroPontoEncontro, HasVerticalAlignment.ALIGN_TOP); hPanel01.setCellVerticalAlignment(buttonFechar, HasVerticalAlignment.ALIGN_TOP); hPanel01.setCellHorizontalAlignment(boxNovoPontoEncontro, HasHorizontalAlignment.ALIGN_CENTER); hPanel01.setCellHorizontalAlignment( buttonSalvarNovosPontos, HasHorizontalAlignment.ALIGN_CENTER); hPanel01.setCellHorizontalAlignment( buttonAdicionarOutroPontoEncontro, HasHorizontalAlignment.ALIGN_CENTER); hPanel01.setCellHorizontalAlignment(buttonFechar, HasHorizontalAlignment.ALIGN_CENTER); hPanel01.setWidth("100%"); hPanel01.setSpacing(6); hPanel01.add(boxNovoPontoEncontro); hPanel01.add(buttonAdicionarOutroPontoEncontro); hPanel01.add(buttonSalvarNovosPontos); hPanel01.add(buttonFechar); panelListaPontoEncontro.add(tabelaPontoEncontro); panelListaPontoEncontro.add(pager); panelListaPontoEncontro.add(hPanel01); panelListaPontoEncontro.setCellVerticalAlignment( tabelaPontoEncontro, HasVerticalAlignment.ALIGN_MIDDLE); panelListaPontoEncontro.setCellVerticalAlignment(pager, HasVerticalAlignment.ALIGN_MIDDLE); panelListaPontoEncontro.setCellHorizontalAlignment( tabelaPontoEncontro, HasHorizontalAlignment.ALIGN_CENTER); panelListaPontoEncontro.setCellHorizontalAlignment(pager, HasHorizontalAlignment.ALIGN_CENTER); panelListaPontoEncontro.setSpacing(8); setWidget(panelListaPontoEncontro); }
public TimelinePanel( TenantIdentifier tenant, DashboardServiceAsync service, TimelineIdentifier timelineIdentifier, DashboardGroupPanel timelineGroupPanel, boolean isDashboardEditor) { super(); _tenant = tenant; _service = service; _timelineIdentifier = timelineIdentifier; _timelineGroupPanel = timelineGroupPanel; _isDashboardEditor = isDashboardEditor; _header = new HeadingLabel(""); _loadingIndicator = new LoadingIndicator(); _loadingIndicator.setHeight((DefaultVAxisOption.DEFAULT_HEIGHT + 4) + "px"); _saveButton = new Button(""); _saveButton.setVisible(isDashboardEditor); _saveButton.addStyleDependentName("ImageButton"); _saveButton.setTitle("Save timeline"); _saveButton.addStyleName("SaveButton"); _saveButton.addClickHandler(new SaveTimelineClickHandler(_service, _tenant, this)); if (_timelineIdentifier != null) { // initially does not make sense to save an (unchanged) and // identifyable timeline. setTimelineDefinitionUnchanged(); } _deleteButton = new Button(); _deleteButton.setVisible(isDashboardEditor); _deleteButton.addStyleDependentName("ImageButton"); _deleteButton.setTitle("Delete timeline"); _deleteButton.addStyleName("DeleteButton"); _deleteButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final boolean confirmation = Window.confirm("Are you sure you wish to delete this timeline?"); if (confirmation) { if (_timelineIdentifier != null) { _service.removeTimeline( _tenant, _timelineIdentifier, new DCAsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { // do nothing } }); } _timelineGroupPanel.removeTimelinePanel(TimelinePanel.this); } } }); addStyleName("TimelinePanel"); add(createButtonPanel()); updateHeader(); setLoading(); if (_timelineIdentifier != null) { _service.getTimelineDefinition( _tenant, _timelineIdentifier, new DCAsyncCallback<TimelineDefinition>() { @Override public void onSuccess(final TimelineDefinition definition) { setTimelineDefinition(definition); } }); } }
public PackageBuilderWidget(final PackageConfigData conf, ClientFactory clientFactory) { this.conf = conf; this.clientFactory = clientFactory; // UI above the results table FormStyleLayout layout = new FormStyleLayout(); final VerticalPanel container = new VerticalPanel(); final VerticalPanel buildResults = new VerticalPanel(); RadioButton wholePackageRadioButton = new RadioButton("action", constants.BuildWholePackage()); RadioButton builtInSelectorRadioButton = new RadioButton("action", constants.BuildPackageUsingBuiltInSelector()); RadioButton customSelectorRadioButton = new RadioButton("action", constants.BuildPackageUsingCustomSelector()); wholePackageRadioButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); buildMode = "buildWholePackage"; } }); builtInSelectorRadioButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(true); customSelectorLayout.setVisible(false); buildMode = "BuiltInSelector"; } }); customSelectorRadioButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { buildWholePackageLayout.setVisible(false); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(true); buildMode = "customSelector"; } }); VerticalPanel verticalPanel = new VerticalPanel(); HorizontalPanel wholePackageRadioButtonPanel = new HorizontalPanel(); wholePackageRadioButtonPanel.add(wholePackageRadioButton); wholePackageRadioButtonPanel.add( new InfoPopup(constants.BuildWholePackage(), constants.BuildWholePackageTip())); verticalPanel.add(wholePackageRadioButtonPanel); HorizontalPanel builtInSelectorRadioButtonPanel = new HorizontalPanel(); builtInSelectorRadioButtonPanel.add(builtInSelectorRadioButton); builtInSelectorRadioButtonPanel.add( new InfoPopup(constants.BuiltInSelector(), constants.BuiltInSelectorTip())); verticalPanel.add(builtInSelectorRadioButtonPanel); HorizontalPanel customSelectorRadioButtonPanel = new HorizontalPanel(); customSelectorRadioButtonPanel.add(customSelectorRadioButton); customSelectorRadioButtonPanel.add( new InfoPopup(constants.CustomSelector(), constants.SelectorTip())); verticalPanel.add(customSelectorRadioButtonPanel); layout.addAttribute("", verticalPanel); wholePackageRadioButton.setValue(true); buildWholePackageLayout.setVisible(true); builtInSelectorLayout.setVisible(false); customSelectorLayout.setVisible(false); // Build whole package layout layout.addRow(buildWholePackageLayout); // Built-in selector layout builtInSelectorLayout.addRow( new HTML(" <i>" + constants.BuildPackageUsingFollowingAssets() + "</i>")); HorizontalPanel builtInSelectorStatusPanel = new HorizontalPanel(); final CheckBox enableStatusCheckBox = new CheckBox(); enableStatusCheckBox.setValue(false); builtInSelectorStatusPanel.add(enableStatusCheckBox); builtInSelectorStatusPanel.add( new HTML(" <i>" + constants.BuildPackageUsingBuiltInSelectorStatus() + " </i>")); final ListBox statusOperator = new ListBox(); String[] vals = new String[] {"=", "!="}; for (int i = 0; i < vals.length; i++) { statusOperator.addItem(vals[i], vals[i]); } builtInSelectorStatusPanel.add(statusOperator); final TextBox statusValue = new TextBox(); statusValue.setTitle(constants.WildCardsSearchTip()); builtInSelectorStatusPanel.add(statusValue); builtInSelectorLayout.addRow(builtInSelectorStatusPanel); HorizontalPanel builtInSelectorCatPanel = new HorizontalPanel(); final CheckBox enableCategoryCheckBox = new CheckBox(); enableCategoryCheckBox.setValue(false); builtInSelectorCatPanel.add(enableCategoryCheckBox); builtInSelectorCatPanel.add( new HTML(" <i>" + constants.BuildPackageUsingBuiltInSelectorCat() + " </i>")); final ListBox catOperator = new ListBox(); String[] catVals = new String[] {"=", "!="}; for (int i = 0; i < catVals.length; i++) { catOperator.addItem(catVals[i], catVals[i]); } builtInSelectorCatPanel.add(catOperator); final CategoryExplorerWidget catChooser = new CategoryExplorerWidget( new CategorySelectHandler() { public void selected(String selectedPath) {} }); ScrollPanel catScroll = new ScrollPanel(catChooser); catScroll.setAlwaysShowScrollBars(true); catScroll.setSize("300px", "130px"); builtInSelectorCatPanel.add(catScroll); builtInSelectorLayout.addRow(builtInSelectorCatPanel); layout.addRow(builtInSelectorLayout); // Custom selector layout customSelectorLayout.setVisible(false); HorizontalPanel customSelectorPanel = new HorizontalPanel(); customSelectorPanel.add( new HTML( " <i>" + constants.BuildPackageUsingCustomSelectorSelector() + " </i>")); // NON-NLS final ListBox customSelector = new ListBox(); customSelector.setTitle(constants.WildCardsSearchTip()); customSelectorPanel.add(customSelector); loadCustomSelectorList(customSelector); customSelectorLayout.addRow(customSelectorPanel); layout.addRow(customSelectorLayout); final Button b = new Button(constants.BuildPackage()); b.setTitle(constants.ThisWillValidateAndCompileAllTheAssetsInAPackage()); b.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { doBuild( buildResults, statusOperator.getValue(statusOperator.getSelectedIndex()), statusValue.getText(), enableStatusCheckBox.getValue(), catOperator.getValue(catOperator.getSelectedIndex()), catChooser.getSelectedPath(), enableCategoryCheckBox.getValue(), customSelector.getSelectedIndex() != -1 ? customSelector.getValue(customSelector.getSelectedIndex()) : null); } }); HorizontalPanel buildStuff = new HorizontalPanel(); buildStuff.add(b); layout.addAttribute(constants.BuildBinaryPackage(), buildStuff); layout.addRow( new HTML("<i><small>" + constants.BuildingPackageNote() + "</small></i>")); // NON-NLS container.add(layout); // The build results container.add(buildResults); // UI below the results table layout = new FormStyleLayout(); Button snap = new Button(constants.CreateSnapshotForDeployment()); snap.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { showSnapshotDialog(conf.getName(), null); } }); layout.addAttribute(constants.TakeSnapshot(), snap); container.add(layout); initWidget(container); }
@PostConstruct public void init() { explorer = new CategoryTreeEditorWidget(); form = new PrettyFormLayout(); form.addHeader(Images.INSTANCE.EditCategories(), new HTML(Constants.INSTANCE.EditCategories())); form.startSection(Constants.INSTANCE.CategoriesPurposeTip()); final SimplePanel editable = new SimplePanel(); editable.add(explorer); form.addAttribute(Constants.INSTANCE.CurrentCategories(), editable); final HorizontalPanel actions = new HorizontalPanel(); form.addAttribute("", actions); final Button newCat = new Button(Constants.INSTANCE.NewCategory()); newCat.setTitle(Constants.INSTANCE.CreateANewCategory()); newCat.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { final CategoryEditor newCat; if (explorer.getSelectedCategory() == null) { newCat = new CategoryEditor(explorer.getCategories()); } else { newCat = new CategoryEditor(explorer.getSelectedCategory()); } newCat.show(); } }); actions.add(newCat); final Button rename = new Button(Constants.INSTANCE.RenameSelected()); rename.addClickHandler( new ClickHandler() { public void onClick(ClickEvent w) { if (!explorer.isSelected()) { Window.alert(Constants.INSTANCE.PleaseSelectACategoryToRename()); return; } final String name = Window.prompt(Constants.INSTANCE.CategoryNewNamePleaseEnter(), ""); if (name != null) { isDirty = true; explorer.renameSelected(name); } } }); actions.add(rename); final Button delete = new Button(Constants.INSTANCE.DeleteSelected()); delete.addClickHandler( new ClickHandler() { public void onClick(final ClickEvent w) { if (!explorer.isSelected()) { Window.alert(Constants.INSTANCE.PleaseSelectACategoryToDelete()); return; } if (Window.confirm( Constants.INSTANCE.AreYouSureYouWantToDeleteCategory() + explorer.getSelectedCategory().getName())) { isDirty = true; explorer.removeSelected(); } } }); delete.setTitle(Constants.INSTANCE.DeleteSelectedCat()); actions.add(delete); form.endSection(); initWidget(form); }