public TreePanel(GwtTree main) { this.main = main; this.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { Object obj = event.getSelectedItem().getUserObject(); if (obj instanceof CompanyItem) { TreePanel.this.main.showCompany(((CompanyItem)obj).getId()); } else if (obj instanceof DepartmentItem) { TreePanel.this.main.showDepartment(((DepartmentItem)obj).getId()); } else if (obj instanceof EmployeeItem) { TreePanel.this.main.showEmployee(((EmployeeItem)obj).getId()); } } }); }
public BaseTree() { super(new TreeImageResources(), true); this.addStyleName("bda-treedir"); this.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { TreeItem item = event.getSelectedItem(); Boolean state = item.getState(); // [GWT Issue 3660] to avoid pass invoke onSection two times TreeItem parent = item.getParentItem(); item.getTree().setSelectedItem(parent, false); if (parent != null) parent.setSelected(false); item.setState(!state); } }); }
private ComboBox<VectorLayerInfo> initLayerCombo1() { VectorLayerProperties properties = GWT .create(VectorLayerProperties.class); layerStore1 = new ListStore<VectorLayerInfo>(properties.key()); layerCombo1 = new ComboBox<VectorLayerInfo>(layerStore1, properties.name()); layerCombo1.setEmptyText((UIMessages.INSTANCE.sbLayerComboEmptyText())); layerCombo1.setTypeAhead(true); layerCombo1.setTriggerAction(TriggerAction.ALL); layerCombo1.setForceSelection(true); layerCombo1.setEditable(false); layerCombo1.enableEvents(); layerCombo1.setWidth(width); layerCombo1.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() { @Override public void onSelection(SelectionEvent<VectorLayerInfo> event) { layerCombo1.setValue(event.getSelectedItem(), true); } }); return layerCombo1; }
private SelectionHandler<Widget> getTabPanelSelectionHandler() { return new SelectionHandler<Widget>() { @Override public void onSelection(SelectionEvent<Widget> event) { if (UIMessages.INSTANCE.empty().equals(getActiveTab())) { dataFormatField.setVisible(false); } else { dataFormatField.setVisible(true); } if (UIMessages.INSTANCE.wfs().equals(getActiveTab())) { vectorFormatCombo.setValue(VectorFormat.GML_FORMAT); } else { vectorFormatCombo.setValue(null); } if (UIMessages.INSTANCE.gitHubResponseTitle().equals(getActiveTab())) { layerName.setEnabled(false); } else { layerName.setEnabled(true); } } }; }
void initContentOracle() { contentOracle = new MultiWordSuggestOracle(); contentSuggestBox = new SuggestBox(contentOracle); contentSuggestBox.getElement().setId("content-box"); // Some initial content xml strings contentOracle.add(""); contentOracle.add("abcd"); contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() { @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) { setFromContentBox(); } }); String[] extra = extendSampleContent(); if (extra != null) { for (String content : extra) { contentOracle.add(content); } } }
private SelectionHandler<MenuItem> getDeleteSelectionHandler() { if (deleteSelectionHandler == null) { deleteSelectionHandler = new SelectionHandler<MenuItem>() { @Override public void onSelection(SelectionEvent<MenuItem> event) { getPresenter().onDelete(); } }; } return deleteSelectionHandler; }
public TableInfoPanel(TableManagerPresenter c) { this.presenter = c; this.context = presenter.getPlatformContext(); setBodyBorder(false); add(getTableInfoTab(), new TabItemConfig("基本信息")); add(getColumnInfoTab(), new TabItemConfig("字段信息")); add(getPtTab(), new TabItemConfig("分区信息")); addSelectionHandler(new SelectionHandler<Widget>() { @Override public void onSelection(SelectionEvent<Widget> event) { if (getConfig(event.getSelectedItem()).getText().equals("分区信息")) { if (isPartitionLoaded() == false) { getPtTab().load(table); setPartitionLoaded(true); } } } }); }
public void testSelectionEvent() { MaterialNavSection widget = new MaterialNavSection(); final boolean[] isSelectionEventFired = {false}; widget.addSelectionHandler(selectionEvent -> isSelectionEventFired[0] = true); widget.fireEvent(new GwtEvent<SelectionHandler<?>>() { @Override public Type<SelectionHandler<?>> getAssociatedType() { return SelectionEvent.getType(); } @Override protected void dispatch(SelectionHandler eventHandler) { eventHandler.onSelection(null); } }); assertTrue(isSelectionEventFired[0]); }
private void init(RootPanel root) { _deckPanel = new DeckPanel(); _tree = createTree(); _tree.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { TreeItem item = event.getSelectedItem(); if(item.getUserObject() != null) { ContentWidget widget = (ContentWidget)item.getUserObject(); widget.init(); int i = _deckPanel.getWidgetIndex(widget); if(i != -1) _deckPanel.showWidget(i); } } }); FlexTable table = new FlexTable(); table.setWidget(0, 0, _tree); table.setWidget(0, 1, _deckPanel); table.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); root.add(table); }
public AddMemberBox(final String buttonLabel, String hint, SuggestOracle suggestOracle) { addPanel = new FlowPanel(); addMember = new Button(buttonLabel); suggestBox = new RemoteSuggestBox(suggestOracle); suggestBox.setStyleName(Gerrit.RESOURCES.css().addMemberTextBox()); suggestBox.setVisibleLength(50); suggestBox.setHintText(hint); suggestBox.addSelectionHandler( new SelectionHandler<String>() { @Override public void onSelection(SelectionEvent<String> event) { addMember.fireEvent(new ClickEvent() {}); } }); addPanel.add(suggestBox); addPanel.add(addMember); initWidget(addPanel); }
public LazyStackPanel() { initWidget(flexTable); flexTable.setStyleName("guvnor-lazyStackPanel"); addSelectionHandler(new SelectionHandler<LazyStackPanelRow>() { public void onSelection(SelectionEvent<LazyStackPanelRow> event) { LazyStackPanelRow row = event.getSelectedItem(); if (row.isExpanded()) { row.compress(); } else { row.expand(); } } }); }
/** * This is the entry point method. */ public void onModuleLoad() { HorizontalPanel mainPanel = new HorizontalPanel(); final MiddlePanel mPanel = new MiddlePanel(); Tree menu = new Tree(); menu.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { mPanel.set((MenuItem) event.getSelectedItem()); } }); initMenu(menu); mainPanel.add(menu); mainPanel.add(mPanel); menu.setSelectedItem(menu.getItem(0)); mainPanel.setStyleName("mvp4gshowcase"); RootPanel.get() .add(mainPanel); }
public ButtonGroup() { super(); addSelectionHandler(new SelectionHandler<UIObject>() { @Override public void onSelection(SelectionEvent<UIObject> event) { if (onItemSelected != null) { try { JavaScriptObject jsItem = event.getSelectedItem() instanceof HasPublished ? ((HasPublished)event.getSelectedItem()).getPublished() : null; Utils.executeScriptEventVoid(published, onItemSelected, EventsPublisher.publishItemEvent(published, jsItem)); } catch (Exception e) { Logger.getLogger(EventsExecutor.class.getName()).log(Level.SEVERE, null, e); } } } }); }
public void setItemSelected(JavaScriptObject aValue) { if (itemSelected != aValue) { if (selectedItemReg != null) { selectedItemReg.removeHandler(); selectedItemReg = null; } itemSelected = aValue; if (component instanceof HasSelectionHandlers<?>) { selectedItemReg = ((HasSelectionHandlers<Object>) component).addSelectionHandler(new SelectionHandler<Object>() { @Override public void onSelection(SelectionEvent<Object> event) { JavaScriptObject published = ((HasPublished) event.getSource()).getPublished(); Object oItem = event.getSelectedItem(); if (oItem instanceof HasPublished) oItem = ((HasPublished) oItem).getPublished(); executeEvent(itemSelected, EventsPublisher.publishItemEvent(published, oItem instanceof JavaScriptObject ? (JavaScriptObject) oItem : null)); } }); } } }
@Override public void setExchangePlaces(List<ExchangePlaceDTO> places) { if (places != null && places.size() > 0) { for (final ExchangePlaceDTO place : places) { MenuItem placeItem = new MenuItem(place.getLabel()); Menu subMenu = new Menu(); placeItem.setSubMenu(subMenu); currencyMenu.add(placeItem); for (final String currencyCode : place.getCurrencyCodes()) { MenuItem currencyItem = new MenuItem(currencyCode); currencyItem.addSelectionHandler(new SelectionHandler<Item>() { public void onSelection(SelectionEvent<Item> event) { presenter.loadCurrencyDetails(place, currencyCode); } }); subMenu.add(currencyItem); } } currencyButton.setEnabled(true); } }
private void initSelection() { // Hook up a tab listener to do something when the user selects a tab. contentBar.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { if (presentationInfo != null) { updateData(); } int selectedIndex = event.getSelectedItem(); contentPanel.showWidget(selectedIndex); // fixes issues with the editor when instance is first shown if (contentPanel.getVisibleWidget() == HTML_INDEX){ htmlArea.onShow(); } // update the layout every time layoutWidget.initWidget(presentationInfo); } }); }
public TablePanel() { initWidget(uiBinder.createAndBindUi(this)); locationPanelMap.put(EAST, eastCardsPanel); locationPanelMap.put(SOUTH, southCardsPanel); locationPanelMap.put(WEST, westCardsPanel); locationPanelMap.put(CENTER, centerCardsPanel); locationPanelMap.put(WIDOW, widowPanel); int cardWidth = resources.c7().getWidth() / 2; int cardHeight = resources.c7().getHeight() / 2; centerCardLayout = new CenterLayout(centerCardsPanel, cardWidth, cardHeight); locationLayoutMap.put(EAST, new EastLayout(eastCardsPanel, cardWidth, cardHeight)); locationLayoutMap.put(SOUTH, new HorizontalLayout(southCardsPanel, cardWidth)); locationLayoutMap.put(WEST, new WestLayout(westCardsPanel, cardWidth, cardHeight)); locationLayoutMap.put(WIDOW, new WidowLayout(widowPanel, cardWidth, cardHeight)); switchToTab(0); centerTabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { layoutLocation(TableLocation.CENTER); layoutLocation(TableLocation.WIDOW); } }); }
private void createComboLayer(final ComboBox<VectorLayerInfo> combo, final String numCombo, final TextButton validateButton) { clearLayerComboBox(combo); combo.setTypeAhead(true); combo.setTriggerAction(TriggerAction.ALL); combo.setForceSelection(true); combo.setEditable(false); combo.enableEvents(); combo.setWidth(WIDTH_COMBO_LAYER); combo.setId(numCombo); combo.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() { @Override public void onSelection(SelectionEvent<VectorLayerInfo> event) { combo.setValue(event.getSelectedItem(), true); List<VectorLayerInfo> updatedLayers = removeLayer(event .getSelectedItem()); if (COMBO1_ID.equals(combo.getId())) { updateCombo(LAYER_COMBO_2, LAYER_STORE_2, updatedLayers); } else { updateCombo(LAYER_COMBO_1, LAYER_STORE_1, updatedLayers); } } }); validateButton.setToolTip(UIMessages.INSTANCE .descriptionValidationToolText()); final HorizontalPanel horizontalGroup = getHorizontalPanel(); horizontalGroup.add(combo); horizontalGroup.add(validateButton); panel.add(new Label(UIMessages.INSTANCE.layerLabelText(numCombo))); panel.add(horizontalGroup); }
private void createGeoprocessAndDistanceField(final Geoprocesses spatialOperation) { spatialOperationComboBox = new GeoprocessComboBox( spatialOperation.getAll()); spatialOperationComboBox.setWidth(WIDTH_SPATIAL_OPERATION_COMBO); clearSpatialOperationComboBox(); spatialOperationComboBox .addSelectionHandler(new SelectionHandler<Geoprocess>() { @Override public void onSelection(SelectionEvent<Geoprocess> event) { spatialOperationComboBox.setValue( event.getSelectedItem(), true); if (event.getSelectedItem() instanceof BufferGeoprocess) { LAYER_COMBO_2.setValue(null); LAYER_COMBO_2.setEnabled(false); distanceTextField.setText("0"); distanceTextField.setEnabled(true); distanceTextField.setVisible(true); } else { LAYER_COMBO_2.setEnabled(true); distanceTextField.setText(""); distanceTextField.setEnabled(false); distanceTextField.setVisible(false); } } }); initDistanceTextField(); final HorizontalPanel horizontalGroup = getHorizontalPanel(); horizontalGroup.add(spatialOperationComboBox); horizontalGroup.add(distanceTextField); panel.add(horizontalGroup); }
private void createSelectionHandler() { addSelectionHandler(new SelectionHandler<Geoprocess>() { @Override public void onSelection(SelectionEvent<Geoprocess> event) { setValue(event.getSelectedItem(), true); } }); }
private void createSelectionHandler() { addSelectionHandler(new SelectionHandler<VectorFormat>() { @Override public void onSelection(SelectionEvent<VectorFormat> event) { setValue(event.getSelectedItem(), true); } }); }
private SelectionHandler<VectorFormat> getVectorComboSelectionHandler() { return new SelectionHandler<VectorFormat>() { @Override public void onSelection(SelectionEvent<VectorFormat> event) { epsgCombo.enable(); } }; }
/** * @param handler * @deprecated Currently there are no listeners for {@link SelectionHandler * <TreeItem>} handlers in this class. TODO: Fix that */ @Deprecated public void setDatasetSelectionHandler(SelectionHandler<TreeItem> handler) { xRegisterDatasetSelectionHandler.removeHandler(); // xRegisterDatasetSelectionHandler = xDatasetButton // .addSelectionHandler(handler); xRegisterDatasetSelectionHandler = eventBus.addHandler(SelectionEvent.getType(), handler); }
/** * Folder Tree */ public FolderSelectTree() { tree = new Tree(); rootItem.setStyleName("okm-TreeItem"); rootItem.setUserObject(new GWTFolder()); rootItem.setSelected(true); rootItem.setState(true); tree.setStyleName("okm-Tree"); tree.addItem(rootItem); tree.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { boolean refresh = true; TreeItem item = event.getSelectedItem(); // Case that not refreshing tree and file browser ( right click ) if (actualItem.equals(item)) { refresh = false; } else { // Disables actual item because on changing active node by // application this it's not changed automatically if (!actualItem.equals(item)) { actualItem.setSelected(false); actualItem = item; } else { refresh = false; } } if (refresh) { refresh(true); } } }); actualItem = tree.getItem(0); initWidget(tree); }
private void setHandlerForSuggestBox(final SuggestBox suggestBox) { suggestBox.addSelectionHandler(new SelectionHandler<Suggestion>() { @Override public void onSelection(SelectionEvent<Suggestion> arg0) { String value = suggestBox.getText(); for (int i = 0; i < documentTypes.getItemCount(); i++) { if (documentTypes.getItemText(i).equalsIgnoreCase(value)) { ScreenMaskUtility.maskScreen(); onDocumentTypeChange(documentTypes.getValue(i)); break; } } } }); validatableSuggestBox = new ValidatableWidget<SuggestBox>(suggestBox); validatableSuggestBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { validatableSuggestBox.toggleValidDateBox(); } }); List<String> altValues = new ArrayList<String>(); for (int i = 0; i < documentTypes.getItemCount(); i++) { altValues.add(documentTypes.getItemText(i)); } validatableSuggestBox.addValidator(new SuggestBoxValidator(suggestBox, altValues)); validatableSuggestBox.toggleValidDateBox(); }
private SelectionHandler<MenuItem> getCollapseSelectionHandler() { if (collapseSelectionHandler == null) { collapseSelectionHandler = new SelectionHandler<MenuItem>() { @Override public void onSelection(SelectionEvent<MenuItem> event) { getPresenter().onCollapse(); } }; } return collapseSelectionHandler; }
private SelectionHandler<MenuItem> getCreateSelectionHandler() { if (createSelectionHandler == null) { createSelectionHandler = new SelectionHandler<MenuItem>() { @Override public void onSelection(SelectionEvent<MenuItem> event) { Boolean folder = event.getSelectedItem().<Boolean> getData(FILE_TYPE); String suffix=event.getSelectedItem().getData(FILE_SUFFIX); getPresenter().onCreate(folder,suffix); } }; } return createSelectionHandler; }
private SelectionHandler<MenuItem> getEditNameSelectionHandler() { if (editNameSelectionHandler == null) { editNameSelectionHandler = new SelectionHandler<MenuItem>() { @Override public void onSelection(SelectionEvent<MenuItem> event) { getPresenter().onEditName(); } }; } return editNameSelectionHandler; }
private SelectionHandler<MenuItem> getExpandSelectionHandler() { if (expandSelectionHandler == null) { expandSelectionHandler = new SelectionHandler<MenuItem>() { @Override public void onSelection(SelectionEvent<MenuItem> event) { getPresenter().onExpand(); } }; } return expandSelectionHandler; }
private SelectionHandler<MenuItem> getOpenSelectionHandler() { if (openSelectionHandler == null) { openSelectionHandler = new SelectionHandler<MenuItem>() { @Override public void onSelection(SelectionEvent<MenuItem> event) { getPresenter().onOpen(); } }; } return openSelectionHandler; }
private void Init() { setHeight(600); setWidth(500); setModal(true); tabPanel = new TabPanel(); tabPanel.addSelectionHandler(new SelectionHandler<Widget>() { @Override public void onSelection(SelectionEvent<Widget> event) { Widget selectedItem = event.getSelectedItem(); if (selectedItem instanceof JobTreePanel) { JobTreePanel panel = (JobTreePanel)selectedItem; if (panel==copyPanel && !panel.isHasData()) { copyPanel.loadDataOfOtherDependentJob(jobId); } } } }); checkablePanel = new JobTreePanel(); checkablePanel.setHeadingText("选择依赖任务(可以多选)"); copyPanel = new JobTreePanel(); copyPanel.setHeadingText("复制所选依赖任务的依赖到本任务"); copyPanel.getTree().setCheckable(false); copyPanel.getTree().getSelectionModel().setSelectionMode(SelectionMode.SINGLE); tabPanel.add(checkablePanel,new TabItemConfig("选择依赖任务",false)); tabPanel.add(copyPanel,new TabItemConfig("复制依赖到本任务",false)); add(tabPanel); }
@Override public HandlerRegistration addSelectionHandler(final SelectionHandler<Widget> handler) { return addHandler((SelectionHandler<Widget>) event -> { Widget widget = event.getSelectedItem(); if (widget instanceof HasEnabled && ((HasEnabled) widget).isEnabled() && isEnabled()) { handler.onSelection(event); } }, SelectionEvent.getType()); }
/** * Creates a new Menu. */ public Menu( final MenuItem[] menuItems, final Panel pageContainer ) { this.menuItems = menuItems; this.pageContainer = pageContainer; for ( final MenuItem mi : menuItems ) addTab( mi.getLabel() ); addSelectionHandler( new SelectionHandler< Integer >() { @Override public void onSelection( final SelectionEvent< Integer > event ) { menuItems[ event.getSelectedItem() ].onActivate( Menu.this ); } } ); }
public IndexedTab() { tab.addSelectionHandler( new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { onTabActivated( event ); } }); tab.setStyleName("tab"); }