private void addActionMenu() { Button button = new Button("Action"); Menu menu = new Menu(); if (settings.containsKey(SettingType.twitterClientId) && !Utils.isEmptyString(settings.get(SettingType.twitterClientId)) && user != null) { menu.add( actionMenuItem( "Enable Facebook", AbstractImagePrototype.create(Icons.INSTANCE.connection()), Action.facebook)); } if (settings.containsKey(SettingType.facebookAPIKey) && !Utils.isEmptyString(settings.get(SettingType.facebookAPIKey))) { menu.add( actionMenuItem( "Enable Twitter", AbstractImagePrototype.create(Icons.INSTANCE.connection()), Action.twitter)); } menu.add( actionMenuItem( "Enable Instant Message (XMPP)", AbstractImagePrototype.create(Icons.INSTANCE.list_items()), Action.xmpp)); button.setMenu(menu); add(button); }
public HelpDialog() { setMaximizable(true); setBodyBorder(false); // setIcon(Resources.ICONS.side_list()); setHeading("Help"); setWidth(750); setHeight(400); setHideOnButtonClick(true); setLayout(new FitLayout()); HTML html = new HTML(htmlString); html.setStyleName("helpDialog"); add(html); setButtons(""); setScrollMode(Scroll.AUTO); Button dontShowOnStartup = new Button( "Close", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { hide(); } }); dontShowOnStartup.setWidth("50%"); addButton(dontShowOnStartup); show(); }
private Button createDeleteButton(final IViewContext<ICommonClientServiceAsync> context) { Button deleteButton = new Button(context.getMessage(Dict.BUTTON_DELETE)); deleteButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { List<BaseEntityModel<T>> types = getSelectedItems(); if (types.isEmpty()) { return; } final List<String> selectedTypeCodes = new ArrayList<String>(); for (BaseEntityModel<T> model : types) { EntityType term = model.getBaseObject(); selectedTypeCodes.add(term.getCode()); } ConfirmationDialog confirmationDialog = new ConfirmationDialog( context.getMessage(Dict.DELETE_CONFIRMATION_TITLE), context.getMessage( Dict.DELETE_CONFIRMATION_MESSAGE, StringUtils.joinList(selectedTypeCodes))) { @Override protected void onYes() { deleteEntityTypes(selectedTypeCodes, new RefreshCallback(viewContext)); } }; confirmationDialog.show(); } }); return deleteButton; }
private Button createButton() { String confirm = getField().getAttribute("confirm", "false"); String icon = getField().getAttribute("icon", "icsc-edit"); String toggle = getField().getAttribute("toggle", "false"); String toggleGroup = getField().getAttribute("toggleGroup", ""); Button btn = null; if (Boolean.parseBoolean(toggle)) { btn = new ToggleButton(getField().getLabel()); if (!toggleGroup.equals("")) { ((ToggleButton) btn).setToggleGroup(toggleGroup); } } else { if (confirm.toLowerCase().equals("false")) { btn = new gkButton(getField().getLabel(), false); } else { btn = new gkButton(getField().getLabel(), confirm); } ((gkButton) btn).setValue(getField().getValue()); } // 为btn设定图片,在gul语法中设定icon="xxx",xxx可以是css文件中已定义好的选择器(如:icsc-edit) // 也可以是自定义的图片路径,若无设定,则默认使用icon="icsc-edit" btn.setIconStyle(icon); // 如果 <field type='btn'>..</field>有子節點,是為menu,進行建立menu動作 if (getField().getWidgets().size() > 0) { attachWidget(btn); } return btn; }
public void handleEvent(MessageBoxEvent ce) { Button btn = ce.getButtonClicked(); if (btn.getText().equals("OK")) { status.hide(); submitButton.unmask(); } }
private Button setOkButtonListener( SelectionListener<ButtonEvent> DialogOkBtnSelectionListenerImpl) { Button bntOk = getButtonById(Dialog.OK); bntOk.addSelectionListener(DialogOkBtnSelectionListenerImpl); bntOk.disable(); return bntOk; }
/** * Display a Prompting Message to enter some text in the Application. The OK button will be * enabled iff the text is not empty or blank. * * @param title * @param message * @param callback */ public static MessageBox promptMessage( String title, String message, Listener<MessageBoxEvent> callback) { final MessageBox box = MessageBox.prompt(title, message, callback); final Button okButton = box.getDialog().getButtonById(Dialog.OK); okButton.disable(); final TextField<String> textBox = box.getTextBox(); textBox.addKeyListener( new KeyListener() { @Override public void componentKeyPress(ComponentEvent event) { if (okButton.isEnabled() && event.getKeyCode() == KeyCodes.KEY_ENTER) { box.getDialog().hide(okButton); } } }); box.addListener( Events.OnKeyUp, new Listener<MessageBoxEvent>() { @Override public void handleEvent(MessageBoxEvent be) { String value = textBox.getValue(); if (value == null || value.trim().equals("")) { okButton.disable(); } else { okButton.enable(); } } }); return box; }
private static Button connectionButton() { final Button b = new Button(" Connect"); b.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.email2())); b.addListener(Events.OnClick, new ConnectBaseEventListener()); return b; }
private Button pendingConnectionsButton() throws NimbitsException { final Button connectionRequest = new Button("Connection Requests(" + connectionCount + ')'); connectionRequest.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.add16())); service.getPendingConnectionRequests( user.getEmail(), new GetPendingRequestListAsyncCallback(connectionRequest)); return connectionRequest; }
private Button addChartButton() { Button addChartButton = new Button(" Add Chart"); addChartButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.lineChart())); addChartButton.setToolTip("Add another chart"); addChartButton.addListener(Events.OnClick, new AddChartBaseEventListener()); return addChartButton; }
public LatestVirtualReportItemsPanel() { setHeading("Virtual Level Monitoring"); setLayout(new FitLayout()); ToolBar toolBar = new ToolBar(); Button reflesh = new Button("Refresh"); reflesh.setIcon(IconHelper.createStyle("icon-email-add")); id = new TextField<String>(); id.setFieldLabel("Virtual ID"); id.setAllowBlank(false); toolBar.add(new LabelToolItem("Virtual ID: ")); toolBar.add(id); toolBar.add(reflesh); setTopComponent(toolBar); reflesh.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { String virtualId = id.getValue(); service = (MonitoringManagerWebServiceAsync) Registry.get("guiservice"); service.getMonitoringResources( "virtual", virtualId, new AsyncCallback<List<MonitoringResource>>() { public void onFailure(Throwable caught) { Dispatcher.forwardEvent(MainEvents.Error, caught); } public void onSuccess(List<MonitoringResource> result) { getVirtualStore().removeAll(); if (result.size() > 0) virtualStore.add(result); } }); } }); virtualStore = new GroupingStore<MonitoringResource>(); virtualStore.groupBy("resource_type"); cm = new ColumnModel(OptimisResource.getColumnConfig()); GroupingView view = new GroupingView(); view.setShowGroupedColumn(true); view.setForceFit(true); view.setGroupRenderer( new GridGroupRenderer() { public String render(GroupColumnData data) { String f = cm.getColumnById(data.field).getHeader(); String l = data.models.size() == 1 ? "Item" : "Items"; return f + ": " + data.group + " (" + data.models.size() + " " + l + ")"; } }); virtualGrid = new Grid<MonitoringResource>(virtualStore, cm); virtualGrid.setTitle(" Service Resources "); virtualGrid.setView(view); virtualGrid.setBorders(true); virtualGrid.getView().setForceFit(true); add(virtualGrid); }
public SearchFormPanel() { ListStore<BeanModel> comboStore = new ListStore<BeanModel>(); combo = new ComboBox<BeanModel>(); combo.setStore(comboStore); combo.setFieldLabel("Asset type"); combo.setDisplayField("name"); combo.setTypeAhead(true); combo.setForceSelection(true); combo.setTriggerAction(ComboBox.TriggerAction.ALL); // combo.setWidth(150); combo.addSelectionChangedListener( new SelectionChangedListener<BeanModel>() { public void selectionChanged(SelectionChangedEvent<BeanModel> se) { prepareForm((MetaAsset) combo.getValue().getBean()); } }); Button btnSearch = new Button("Search"); btnSearch.addSelectionListener( new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent be) { submitSearch(); } }); form = new FormPanel(); form.setHeaderVisible(false); form.setBodyBorder(false); form.setScrollMode(Style.Scroll.AUTOY); // form.setWidth(300); HBoxLayout layout = new HBoxLayout(); layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE); ContentPanel topPanel = new ContentPanel(layout); topPanel.setHeaderVisible(false); topPanel.setFrame(true); topPanel.setHeight(40); topPanel.add(new Text("Asset type: ")); HBoxLayoutData layoutData = new HBoxLayoutData(0, 2, 0, 2); topPanel.add(combo, layoutData); topPanel.add(btnSearch); setHeading("Advanced search"); setLayout(new FitLayout()); setFrame(true); setTopComponent(topPanel); add(form); /* addListener(Events.Expand, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { initComponents(false); } });*/ initComponents(false); }
protected boolean checkPanel() { boolean v = panel.isValid(true); for (Button button : buttons) { if (v != button.isEnabled()) { button.setEnabled(v); } } return v; }
public LatestPhysicalReportItemsPanel() { setHeading("Physical Level Monitoring"); setLayout(new FitLayout()); ToolBar toolBar = new ToolBar(); ToolBar toolBarBottom = new ToolBar(); Button reflesh = new Button("Refresh"); reflesh.setIcon(IconHelper.createStyle("icon-email-add")); id = new TextField<String>(); id.setFieldLabel("Physical ID"); id.setAllowBlank(false); toolBar.add(new LabelToolItem("Physical ID: ")); toolBar.add(id); toolBar.add(reflesh); setTopComponent(toolBar); lt = new LabelField(""); setToolBar4Status(""); toolBarBottom.add(lt); setBottomComponent(toolBarBottom); reflesh.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { setToolBar4Status("Loading data, please wait..."); String physicalId = id.getValue(); service = (MonitoringManagerWebServiceAsync) Registry.get("guiservice"); service.getMonitoringResources( "physical", physicalId, new AsyncCallback<List<MonitoringResource>>() { public void onFailure(Throwable caught) { setToolBar4Status("Connection failed by loading data, please try again."); Dispatcher.forwardEvent(MainEvents.Error, caught); } public void onSuccess(List<MonitoringResource> result) { setToolBar4Status(""); getStore().removeAll(); if (result.size() > 0) { store.add(result); } else { setToolBar4ErrorStatus("No data found."); } } }); } }); cm = new ColumnModel(OptimisResource.getColumnConfig()); store = new ListStore<MonitoringResource>(); grid = new Grid<MonitoringResource>(store, cm); grid.setTitle(" Physical Level Resources "); grid.setBorders(true); grid.getView().setForceFit(true); add(grid); setLayout(new FitLayout()); }
private void addFileMenu() { Button fileButton = new Button("File"); Menu fileMenu = new Menu(); fileMenu.add(newDataPoint()); fileMenu.add(newFolder()); fileMenu.add(uploadFile()); fileButton.setMenu(fileMenu); add(fileButton); }
private void createButtons() { Button submitBtn = new Button("Submit"); Button resetBtn = new Button("Reset"); submitBtn.addSelectionListener(new FormSubmitListener(form)); resetBtn.addSelectionListener(new FormResetListener(form)); form.addButton(submitBtn); form.addButton(resetBtn); addBeforSubmitListener(); }
private void checkPermissins() { if (permissions != null) { PermissionWeb permission = permissions.get(Permission.USER_EDIT); if (permission == null) { setReadonlyFields(true); submitButton.disable(); cancelButton.disable(); } } }
public PersonForm() { saveButton.setEnabled(true); saveButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { savePerson(); } }); loadPerson(); }
private void addNavigateMenu() { Button button = new Button("Navigate"); Menu menu = new Menu(); menu.add( actionMenuItem( "Toggle Expansion", AbstractImagePrototype.create(Icons.INSTANCE.expand()), Action.expand)); button.setMenu(menu); add(button); }
private Button buildNewToolRequestMenuItem() { Button newToolBtn = new Button(org.iplantc.core.tito.client.I18N.DISPLAY.requestNewTool()); newToolBtn.setIcon(AbstractImagePrototype.create(Resources.ICONS.add())); newToolBtn.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { new NewToolRequestWindow().show(); } }); newToolBtn.setId(ID_BTN_NEW_TOOL_BTN); return newToolBtn; }
private LayoutContainer createContentContainer() { LayoutContainer contentContainer = new LayoutContainer(); contentContainer.setBorders(false); contentContainer.setSize(340, 170); HBoxLayout tabbarContainerLayout = new HBoxLayout(); tabbarContainerLayout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP); contentContainer.setLayout(tabbarContainerLayout); LayoutContainer contentItemsContainer = new LayoutContainer(); contentItemsContainer.setBorders(true); contentItemsContainer.setWidth(230); contentItemsContainer.setHeight(160); contentItemsContainer.setLayout(new FitLayout()); contentItemsContainer.setStyleAttribute("backgroundColor", "white"); // overflow-auto style is for IE hack. contentItemsContainer.addStyleName("overflow-auto"); TreeStore<BeanModel> deviceContentTreeStore = new TreeStore<BeanModel>(); deviceContentTree = TreePanelBuilder.buildDeviceContentTree(deviceContentTreeStore); contentItemsContainer.add(deviceContentTree); LayoutContainer buttonsContainer = new LayoutContainer(); buttonsContainer.setSize(110, 160); buttonsContainer.setBorders(false); buttonsContainer.setLayout(new RowLayout(Orientation.VERTICAL)); Button addCommandBtn = new Button("Add command"); addCommandBtn.addSelectionListener(new AddCommandListener()); Button addSensorBtn = new Button("Add sensor"); addSensorBtn.addSelectionListener(new AddSensorListener()); Button addSwitchBtn = new Button("Add switch"); addSwitchBtn.addSelectionListener(new AddSwitchListener()); Button addSliderBtn = new Button("Add slider"); addSliderBtn.addSelectionListener(new AddSliderListener()); Button deleteBtn = new Button("Delete"); deleteBtn.addSelectionListener(new DeleteContentListener()); buttonsContainer.add(addCommandBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(addSensorBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(addSwitchBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(addSliderBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(deleteBtn, new RowData(110, -1, new Margins(5))); contentContainer.add(contentItemsContainer); contentContainer.add(buttonsContainer); return contentContainer; }
private void addAdminMenu() { Button button = new Button("Admin"); Menu menu = new Menu(); menu.add( urlMenuItem( "Run System Maintenance Service", AbstractImagePrototype.create(Icons.INSTANCE.expand()), "http://" + com.google.gwt.user.client.Window.Location.getHostName() + "/cron/SystemMaint")); button.setMenu(menu); add(button); }
public void init() { toolBar = new PagingToolBar(5, true); getStore(); // initwidget(); store.addBaseStoreListener(BaseStoreEvent.EventType.LOAD_COMPLETE, this); printer = new Button("打印"); // printer.setStyleName("printer"); // printer.setIconStyle("printer"); // printer.setId("printer"); printer.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.print_16())); printer.addListener(Events.Select, this); }
private void reportesMenu(ContentPanel accordionPanel) { /* Reportes */ ContentPanel reportesCP = new ContentPanel(); reportesCP.setAnimCollapse(false); reportesCP.setHeading("Reportes"); reportesCP.setLayout(new RowLayout(Orientation.VERTICAL)); Button insp = new Button("Inspecciones"); insp.setWidth("100%"); reportesCP.add(insp); accordionPanel.add(reportesCP); }
/** * Creates the logout button for the user logout the application. * * @return the button */ private Button createLogoutButton() { String currentUserName = (this.authority == null) ? "" : "(" + this.authority.getUsername() + ")"; Button logoutButton = new Button(); logoutButton.setIcon(icons.logout()); logoutButton.setToolTip("Logout" + currentUserName); logoutButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { Window.open("j_security_logout", "_self", ""); } }); return logoutButton; }
private Button getExportButton() { Button exportButton = new Button(I18nUtils.getMessages().config_button_export()); exportButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.page_save())); exportButton.addListener( Events.OnClick, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { String url = GWT.getModuleBaseURL() + "exportconfig"; Window.open(url, "_self", ""); } }); return exportButton; }
private Button buildSearchButton() { Button searchBtn = new Button(); searchBtn.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { search(filter.getValue()); } }); searchBtn.setId(ID_SEARCH_BTN); searchBtn.setIcon(AbstractImagePrototype.create(Resources.ICONS.search())); return searchBtn; }
private void addOptionsMenu() { Button button = new Button("Options"); Menu menu = new Menu(); CheckBox saveToNowCheckBox = new CheckBox(); menu.add(saveToNowCheckBox); saveToNowCheckBox.setBoxLabel("Save with Current Time"); saveToNowCheckBox.setValue(true); // autoSaveCheckBox.setBoxLabel("Auto-Save when a number is entered"); // autoSaveCheckBox.setValue(true); // menu.add(autoSaveCheckBox); button.setMenu(menu); add(button); }
private ContentPanel createMulti() { ContentPanel panel = new SamplePanel(); panel.setHeading("Multi Columns"); ToolBar toolBar = new ToolBar(); panel.setTopComponent(toolBar); ButtonGroup group = new ButtonGroup(2); group.setHeading("Clipboard"); Button btn = new Button("Cool", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); Menu menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); toolBar.add(group); group = new ButtonGroup(2); group.setHeading("Other Bugus Actions"); btn = new Button("Cool", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); toolBar.add(group); return panel; }
@SuppressWarnings("unchecked") @Override protected void handleEvent(AppEvent event) { if (event.getType() == AppEvents.AuditEventEntryView) { searchCriteria = null; currentEntity = Registry.get(Constants.ENTITY_ATTRIBUTE_MODEL); initUI(); if (Registry.get(Constants.AUDIT_EVENT_TYPE_CODES) != null) { List<AuditEventTypeWeb> auditEventTypes = (List<AuditEventTypeWeb>) Registry.get(Constants.AUDIT_EVENT_TYPE_CODES); /* * for (AuditEventTypeWeb type : auditEventTypes) { Info.display("Information", "Event Types: "+ * type.getAuditEventTypeCd() + ", " + type.getAuditEventTypeName()); } */ eventTypesStore.removeAll(); eventTypesStore.add(auditEventTypes); } } else if (event.getType() == AppEvents.Logout) { Dispatcher.get().dispatch(AppEvents.Logout); } else if (event.getType() == AppEvents.AuditEventReceived) { // Info.display("Information", "EventReceived"); store.removeAll(); AuditEventEntryListWeb events = (AuditEventEntryListWeb) event.getData(); if (events.getAuditEventEntries() != null) { store.add(events.getAuditEventEntries()); } grid.getSelectionModel().select(0, true); grid.getSelectionModel().deselect(0); status.hide(); searchButton.unmask(); } else if (event.getType() == AppEvents.EntityByIdRequest) { RecordWeb record = (RecordWeb) event.getData(); if (record != null) { identifierStore.removeAll(); buildRefRecordInfoDialog(); refRecordInfoDialog.show(); displayEntityRecord(attributeFieldMap, record); displayEntityIdentifier(record); } } else if (event.getType() == AppEvents.Error) { String message = event.getData(); MessageBox.alert("Information", "Failure: " + message, null); } }