private void buildToolbar(RowData data) { toolbar = new ToolBar(); saveAndAddTaxa = new Button(); saveAndAddTaxa.setText("Save and Add Taxa"); saveAndAddTaxa.setIconStyle("icon-go-jump"); saveAndAddTaxa.setTitle("Save and Add Taxa"); saveAndAddTaxa.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { save(SAVEANDCONTINUE); } }); save = new Button(); save.setText("Save"); save.setIconStyle("icon-save"); save.setTitle("Save and Continue Editing"); save.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { save(SAVE); } }); saveAndExit = new Button(); saveAndExit.setIconStyle("icon-save-and-exit"); saveAndExit.setText("Save and Exit"); saveAndExit.setTitle("Save and Exit without adding taxa"); saveAndExit.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { save(SAVEANDEXIT); } }); cancel = new Button(); cancel.setIconStyle("icon-cancel"); cancel.setText("Cancel"); cancel.setTitle("Cancel"); cancel.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { cancel(); } }); addItemsToToolBar(); add(toolbar, data); }
public void draw() { if (!drawn) { for (String definable : DefinitionCache.impl.getDefinables()) addDefinition(definable, DefinitionCache.impl.getDefinition(definable)); Button save = new Button(); save.setText("Save"); save.setIconStyle("icon-save"); save.setTitle("Save"); save.addListener( Events.Select, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { save(); } }); Button add = new Button(); add.setText("Add new definition"); add.setIconStyle("icon-add"); add.setTitle("Add new definition"); add.addListener( Events.Select, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { TextField<String> f = addDefinition("", ""); layout(); scrollIntoView(f); } }); ToolBar toolbar = new ToolBar(); toolbar.add(save); toolbar.add(add); setTopComponent(toolbar); drawn = true; } }
@Override public ToolBar initToolBar() { SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus()); final Button importUser = new Button(); importUser.setText(I18nUtils.getMessages().user_button_importUsers()); importUser.setTitle(I18nUtils.getMessages().user_button_importUsers_tip()); importUser.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.user())); importUser.enable(); importUser.addListener( Events.OnClick, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { initUserImportView(); } }); toolbar.add(importUser); return toolbar; }
@Override public ToolBar initToolBar() { SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus(), getSubModule().hasEditRight()); final Button bmToolbarButton = new Button( I18nUtils.getMessages().project_button_BranchManagment(), AbstractImagePrototype.create(Icons.INSTANCE.branches())); AdaptId.adapt(bmToolbarButton, IdElementsAdmResource.INSTANCE.idBranchManagementButton()); bmToolbarButton.disable(); bmToolbarButton.setTitle(I18nUtils.getMessages().project_button_BranchManagment()); bmToolbarButton.addListener( Events.OnClick, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { ModelData selected = getSelectedItem(); if (selected != null && bmToolbarButton.isEnabled()) { Object obj = selected.get(ProjectBeanDesc.id.getName()); int projectId = 0; if (obj != null) { projectId = (Integer) obj; } String name = selected.get(ProjectBeanDesc.label.getName()); String warning = selected.get(ProjectBeanDesc.warning.getName()); if (warning == null) { Window window = new BranchManagmentWindow(projectId, name); window.show(); } else { String messageTitle = "<font size='3'>" + "Can't manage branches:" + "<font/><br>"; String messageDetail = "<I><font size='2' style='color:red'>" + warning + "<font/><I/>"; String message = messageTitle + messageDetail; MessageBox.alert("Warning", message, null); } } } }); if (!getSubModule().hasEditRight()) { GXTUtils.hideComponents(bmToolbarButton); } getEventBus() .addHandler( SubModuleEvent.getType(), new SubModuleHandler() { public void onEvent(SubModuleEvent event) { if (event.getEventType() == EventType.OnGridSelect && getSubModule().hasEditRight()) { bmToolbarButton.enable(); } else if (event.getEventType() == EventType.OnGridUnselect || event.getEventType() == EventType.OnClickCancel) { bmToolbarButton.disable(); } } }); toolbar.add(bmToolbarButton); return toolbar; }
@Override protected void onRender(Element target, int index) { super.onRender(target, index); layout.setPadding(new Padding(2, 17, 1, 10)); // DIM layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE); c.setLayout(layout); c.setLayoutOnChange(true); c.setAutoHeight(false); c.setAutoWidth(false); left.setIcon(AbstractImagePrototype.create(AzzeroCO2Resources.INSTANCE.left())); left.setIconAlign(Style.IconAlign.LEFT); left.setSize(32, 32); left.setText(""); left.setToolTip(""); left.setTitle(""); left.setEnabled(false); left.setVisible(false); left.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { Dispatcher.forwardEvent(new AppEvent(UnAnnoDiAttivitaEvents.Previous, ce)); } }); c.add(left, new HBoxLayoutData(new Margins(0, 0, 0, 0))); flex.setFlex(1); c.add(leftText, flex); leftText.setSize(200, 15); rigthText.setSize(250, 15); rigthText.setStyleAttribute("text-align", "right"); rigthText.setStyleAttribute("font-family", "arial"); leftText.setStyleAttribute("font-family", "arial"); leftText.setStyleAttribute("font-size", "14px"); rigthText.setStyleAttribute("font-size", "14px"); c.add(rigthText, new HBoxLayoutData(new Margins(0, 5, 0, 0))); right.setIconAlign(Style.IconAlign.RIGHT); // right.setText("Energia"); right.setIcon(AbstractImagePrototype.create(AzzeroCO2Resources.INSTANCE.rigth())); right.setSize(32, 32); right.setTitle(""); right.setText(""); right.setToolTip(""); c.add(right, new HBoxLayoutData(new Margins(0, 0, 0, 0))); right.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { if (rigthText.getText().equalsIgnoreCase("torna alla home")) { Dispatcher.forwardEvent(CentralEvents.ShowPanel, Eventi.MAIN); } else { Dispatcher.forwardEvent(new AppEvent(UnAnnoDiAttivitaEvents.Next, ce)); } } }); add(c); }