本文整理匯總了Java中com.google.gwt.event.logical.shared.SelectionHandler類的典型用法代碼示例。如果您正苦於以下問題:Java SelectionHandler類的具體用法?Java SelectionHandler怎麽用?Java SelectionHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SelectionHandler類屬於com.google.gwt.event.logical.shared包,在下文中一共展示了SelectionHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TreePanel
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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());
}
}
});
}
示例2: BaseTree
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
});
}
示例3: initLayerCombo1
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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;
}
示例4: getTabPanelSelectionHandler
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
}
};
}
示例5: initContentOracle
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
}
}
示例6: getDeleteSelectionHandler
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
private SelectionHandler<MenuItem> getDeleteSelectionHandler() {
if (deleteSelectionHandler == null) {
deleteSelectionHandler = new SelectionHandler<MenuItem>() {
@Override
public void onSelection(SelectionEvent<MenuItem> event) {
getPresenter().onDelete();
}
};
}
return deleteSelectionHandler;
}
示例7: TableInfoPanel
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
}
}
});
}
示例8: testSelectionEvent
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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]);
}
示例9: init
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
示例10: AddMemberBox
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
示例11: LazyStackPanel
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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();
}
}
});
}
示例12: onModuleLoad
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
/**
* 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);
}
示例13: ButtonGroup
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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);
}
}
}
});
}
示例14: setItemSelected
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
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));
}
});
}
}
}
示例15: setExchangePlaces
import com.google.gwt.event.logical.shared.SelectionHandler; //導入依賴的package包/類
@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);
}
}