private Widget newActionContainer(final boolean atEnd) { FlowPanel itemActionContainer = new FlowPanel(); itemActionContainer.addStyleName("itemActionContainer"); AnchorButton add = new AnchorButton("Ajouter"); add.getElement().setAttribute("name", "anchor"); add.addStyleName("button_add"); add.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { addItemContent(newItemInstance()); ValueChangeEvent.fire(ExtendedAbstractComponent.this, getValue()); } private void addItemContent(Bloc item) { // update data in order to save local widget change getValue(); // where to add if (atEnd) { addItem(item); } else { addItem(0, item); } // refresh widget refreshWidget(); } }); add.setVisible(!isReadOnly()); itemActionContainer.add(add); return itemActionContainer; }
@Override public void init() { FlowPanel mainPanel = new FlowPanel(); GroupBoxPanel generalBox = new GroupBoxPanel(); mainPanel.add(generalBox); FlowPanel contentPanel = new FlowPanel(); contentPanel.addStyleName("BlocCreationViewHeader"); generalBox.add(contentPanel); name = new LabelMarkup(); contentPanel.add(name); contentPanel.add(new LabelMarkup("Commentaire:")); comment = new TextArea(); contentPanel.add(comment); GroupBoxPanel iPanel = new GroupBoxPanel(); iPanel.setText("Serveurs"); mainPanel.add(iPanel); targetListWidget = new NewTargetListWidget(Boolean.FALSE); iPanel.add(targetListWidget); iPanel = new GroupBoxPanel(); iPanel.setText("Ressources"); mainPanel.add(iPanel); resourceListWidget = new NewTargetListWidget(Boolean.TRUE); iPanel.add(resourceListWidget); FlowPanel actionsPanel = new FlowPanel(); mainPanel.add(actionsPanel); cancel = new AnchorButton("Annuler"); cancel.addStyleName("button_delete"); cancel.setTitle("Annuler"); actionsPanel.add(cancel); validate = new AnchorButton("Valider"); validate.addStyleName("button_ok"); validate.setTitle("Valider les changements"); actionsPanel.add(validate); window = new WindowPopup(); window.getContent().add(mainPanel); window.setCaption("Nouvelle Publication"); window.setWidth("640px"); window.center(); window.show(); }
@Override public void init() { mainPanel = new FlowPanel(); composantPropertiesWidget = new ComposantPropertiesWidget(); composantPropertiesWidget.addValueChangeHandler( new ValueChangeHandler<Composant>() { @Override public void onValueChange(ValueChangeEvent<Composant> event) { isModified = true; } }); mainPanel.add(composantPropertiesWidget); GroupBoxPanel blocBox = new GroupBoxPanel(); blocBox.setHtml("<b>Liste des blocs qui r\u00e9f\u00e9rencent ce composant</b>"); mainPanel.add(blocBox); FlowPanel blocsPanel = new FlowPanel(); blocsPanel.addStyleName("BlocUsedComposnant-Panel"); blocBox.add(blocsPanel); composantsBlocsListWidget = new ComposantsBlocsListWidget(); blocsPanel.add(composantsBlocsListWidget); GroupBoxPanel regionsBox = new GroupBoxPanel(); regionsBox.setHtml("<b>Liste des vues</b>"); mainPanel.add(regionsBox); viewListWidget = new ViewListWidget(); viewListWidget.addValueChangeHandler( new ValueChangeHandler<List<View>>() { @Override public void onValueChange(ValueChangeEvent<List<View>> event) { isModified = true; } }); regionsBox.add(viewListWidget); FlowPanel actionsPanel = new FlowPanel(); mainPanel.add(actionsPanel); save = new AnchorButton("Sauvegarder"); actionsPanel.add(save); save.addStyleName("button_ok"); save.setTitle("Sauvegarder les modifications"); }
@Override public void addCloseHandler(ClickHandler clickHandler) { if (clickHandler != null && cancel != null) cancel.addClickHandler(clickHandler); if (window != null) window.addClosehandler(clickHandler); }
@Override public void addValidateClickHandler(ClickHandler clickHandler) { if (clickHandler != null && validate != null) { validate.addClickHandler(clickHandler); } }
@Override public void addSaveHandler(ClickHandler clickHandler) { if (save != null) { save.addClickHandler(clickHandler); } }