List of usage examples for com.google.gwt.event.logical.shared BeforeSelectionHandler BeforeSelectionHandler
BeforeSelectionHandler
From source file:org.aksw.TripleCheckMate.client.TripleCheckMate.java
License:Apache License
private void setVisualPlacement() { RootPanel rootPanel = RootPanel.get(); VerticalPanel page = new VerticalPanel(); page.setHeight("100%"); page.setWidth("100%"); rootPanel.add(page);//from w w w. jav a2 s .c o m VerticalPanel evalTabPanel = new VerticalPanel(); SessionContext.tabPanel.add(SessionContext.pageStart, "DBpedia Evaluation Campaign"); SessionContext.tabPanel.add(SessionContext.pageEval, "Evaluate"); SessionContext.tabPanel.addStyleName("main-tab"); SessionContext.tabPanel.selectTab(0); SessionContext.tabPanel.setAnimationEnabled(true); SessionContext.tabPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { if (SessionContext.user.userID == -1) { event.cancel(); } } }); page.add(SessionContext.tabPanel); VerticalPanel bodyPanel = new VerticalPanel(); bodyPanel.setWidth("100%"); bodyPanel.setSpacing(4); evalTabPanel.add(bodyPanel); VerticalPanel graphPanel = new VerticalPanel(); HTML label = new HTML("Graphs"); graphPanel.add(label); }
From source file:org.appverse.web.framework.frontend.gwt.widgets.search.suggest.impl.gxt.SuggestWidgetImpl.java
License:Appverse Public License
private void initLoaders() { /**** SUGGEST *****/ // proxy for getting suggestions from server final DataProxy<PagingLoadConfig, PagingLoadResult<M>> proxySuggest = new DataProxy<PagingLoadConfig, PagingLoadResult<M>>() { @Override/*w w w . jav a 2 s . c o m*/ public void load(final PagingLoadConfig loadConfig, final Callback<PagingLoadResult<M>, Throwable> callback) { GWT.log("Proxy load method called"); // We clean any possible previously selected value value = null; callbackSuggest = new AppverseCallback<GWTPresentationPaginatedResult<M>>() { @Override public void onFailure(final Throwable caught) { GWT.log("list load failed!! " + caught.getMessage()); } @Override @SuppressWarnings("unchecked") public void onSuccess(final GWTPresentationPaginatedResult<M> result) { GWT.log("list loaded!! "); final PagingLoadResult<M> loadResult = (PagingLoadResult<M>) GxtPaginationConverter .convert(result); callback.onSuccess(loadResult); } }; loadConfig.setSortInfo(new ArrayList<SortInfo>()); dataFilter = GxtPaginationConverter.convert(loadConfig); // CAUTION // You must use "getDataFilter()" to avoid loosing any kind of // filter when using toolbar handlerManager.fireEvent(new LoadSuggestEvent<M>(getDataFilter(), callbackSuggest)); } }; final PagingLoader<PagingLoadConfig, PagingLoadResult<M>> listLoaderSuggest = new PagingLoader<PagingLoadConfig, PagingLoadResult<M>>( proxySuggest); final LoadResultListStoreBinding<PagingLoadConfig, M, PagingLoadResult<M>> handlerSuggest = new LoadResultListStoreBinding<PagingLoadConfig, M, PagingLoadResult<M>>( listStoreSuggest); listLoaderSuggest.addLoadHandler(handlerSuggest); searchText.setLoader(listLoaderSuggest); /* Combo selection clicked */ searchText.addBeforeSelectionHandler(new BeforeSelectionHandler<M>() { @Override public void onBeforeSelection(final BeforeSelectionEvent<M> event) { event.cancel(); M model = searchText.getListView().getSelectionModel().getSelectedItem(); setValue(model); handlerManager.fireEvent(new SelectSuggestEvent<M>(model)); } }); searchText.addBlurHandler(new BlurHandler() { @Override public void onBlur(final BlurEvent event) { // If no value has been selected and force selection flag is // true, we clear the field if (isForceSelection() && value == null) { clear(); } } }); /* set to null selected value, since criteria has changed */ //workaround to solve keypressed event bug. workaround is not documented. //http://code.google.com/p/google-web-toolkit/issues/detail?id=72 searchText.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(final KeyUpEvent event) { if (!oldText.equals(searchText.getText())) setValue(null); } }); /**************************************************************/ /* setPageSize MUST be called AFTER setting loader in combobox. */ /**************************************************************/ searchText.setPageSize(10); }
From source file:org.bonitasoft.console.client.view.identity.IdentityManagementView.java
License:Open Source License
/** * Default constructor.//from w w w . j a va2s . c o m * * @param aUserSelection * @param aUserDataSource */ public IdentityManagementView(MessageDataSource aMessageDataSource, UserDataSource aUserDataSource, GroupDataSource aGroupDataSource, RoleDataSource aRoleDataSource, UserMetadataDataSource aUserMetadataDataSource) { super(); myOuterPanel = new FlowPanel(); myUsersListTab = initUsersList(aMessageDataSource, aUserDataSource, aRoleDataSource, aGroupDataSource, aUserMetadataDataSource); myRolesListTab = initRolesList(aMessageDataSource, aRoleDataSource); myGroupsListTab = initGroupsList(aMessageDataSource, aGroupDataSource); myUserMetadataListTab = initUserMetadatasList(aMessageDataSource, aUserMetadataDataSource); myInnerPanel = new DecoratedTabPanel(); myInnerPanel.add(myUsersListTab, constants.usersTabName()); myInnerPanel.add(myRolesListTab, constants.rolesTabName()); myInnerPanel.add(myGroupsListTab, constants.groupsTabName()); myInnerPanel.add(myUserMetadataListTab, constants.userMetadataTabName()); myOuterPanel.add(myInnerPanel); // Keep order of datasources myDatasources = new ArrayList<BonitaFilteredDataSource<?, ?, ?>>(); myDatasources.add(aUserDataSource); myDatasources.add(aRoleDataSource); myDatasources.add(aGroupDataSource); myDatasources.add(aUserMetadataDataSource); myOuterPanel.setStylePrimaryName("identity_management_outer_panel"); myInnerPanel.setStylePrimaryName("identity_management_tab_panel"); myInnerPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> aEvent) { try { if (aEvent != null && aEvent.getItem() >= 0 && aEvent.getItem() < myDatasources.size()) { myDatasources.get(aEvent.getItem()).reload(); } } catch (Exception e) { GWT.log("Error while trying to reload datasource on tab selection", e); } } }); myInnerPanel.selectTab(0); this.initWidget(myOuterPanel); }
From source file:org.cruxframework.crux.smartfaces.client.tab.TabPanel.java
License:Apache License
/** * Creates an empty tab panel.//from w w w . j a v a 2 s.c o m */ public TabPanel() { FacesBackboneResourcesCommon.INSTANCE.css().ensureInjected(); tabBar = new TabBar(); deck = new TabbedDeckPanel(tabBar); FlowPanel panel = new FlowPanel(); panel.add(tabBar); panel.add(deck); initWidget(panel); tabBar.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { showTabContent(event.getSelectedItem()); } }); tabBar.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { BeforeSelectionEvent<Integer> tabPanelEvent = BeforeSelectionEvent.fire(TabPanel.this, event.getItem()); if (tabPanelEvent == null || tabPanelEvent.isCanceled()) { if (event != null) { event.cancel(); } } } }); setStyleName(DEFAULT_STYLE_NAME); deck.setStyleName(TAB_PANEL_DECK_STYLE_NAME); deck.addStyleName(FacesBackboneResourcesCommon.INSTANCE.css().tabPanelDeck()); // Add a11y role "TabPanel" Roles.getTabpanelRole().set(deck.getElement()); }
From source file:org.cruxframework.crux.smartfaces.client.tabviewcontainer.TabContainer.java
License:Apache License
/** * @param tabId/*w w w . j a v a 2 s . c o m*/ */ private BeforeSelectionHandler<Integer> createBeforeSelectionHandler() { return new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { Tab selectedTab = getFocusedTab(); String tabId = getViewId(event.getItem()); boolean canceled = false; if (selectedTab != null && !selectedTab.getViewId().equals(tabId)) { BeforeBlurEvent evt = BeforeBlurEvent.fire(selectedTab.getFlap()); canceled = evt.isCanceled(); } if ((!canceled) && (selectedTab == null || !selectedTab.getViewId().equals(tabId))) { BeforeFocusEvent evt = BeforeFocusEvent.fire(getTab(tabId)); canceled = canceled || evt.isCanceled(); } if (canceled) { event.cancel(); } } }; }
From source file:org.cruxframework.crux.smartfaces.client.tabviewcontainer.TabCrawlableViewContainer.java
License:Apache License
private BeforeSelectionHandler<Integer> createBeforeSelectionHandler() { return new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { Tab selectedTab = getFocusedTab(); String tabId = getViewId(event.getItem()); boolean canceled = false; if (selectedTab != null && !selectedTab.getViewId().equals(tabId)) { BeforeBlurEvent evt = BeforeBlurEvent.fire(selectedTab.getFlap()); canceled = evt.isCanceled(); }//from ww w . ja v a2 s .c o m if ((!canceled) && (selectedTab == null || !selectedTab.getViewId().equals(tabId))) { BeforeFocusEvent evt = BeforeFocusEvent.fire(getTab(tabId)); canceled = canceled || evt.isCanceled(); } if (canceled) { event.cancel(); } } }; }
From source file:org.cruxframework.crux.widgets.client.rollingtabs.RollingTabPanel.java
License:Apache License
/** * Creates an empty tab panel./*from w w w .j a v a2 s . c om*/ */ public RollingTabPanel() { tabBar = new RollingTabBar(); deck = new TabbedDeckPanel(tabBar); VerticalPanel panel = new VerticalPanel(); panel.add(tabBar); panel.add(deck); panel.setCellHeight(deck, "100%"); tabBar.setWidth("100%"); initWidget(panel); tabBar.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { deck.showWidget(event.getSelectedItem()); } }); tabBar.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { BeforeSelectionEvent<Integer> tabPanelEvent = BeforeSelectionEvent.fire(RollingTabPanel.this, event.getItem()); if (tabPanelEvent == null || tabPanelEvent.isCanceled()) { if (event != null) { event.cancel(); } } } }); setStyleName("crux-TabPanel"); deck.setStyleName("crux-TabPanelBottom"); deck.getElement().getStyle().setOverflow(Overflow.HIDDEN); // Add a11y role "TabPanel" Accessibility.setRole(deck.getElement(), Accessibility.ROLE_TABPANEL); }
From source file:org.drools.guvnor.client.asseteditor.drools.WorkingSetEditor.java
License:Apache License
private void refreshWidgets() { WorkingSetConfigData wsData = (WorkingSetConfigData) workingSet.getContent(); TabPanel tPanel = new TabPanel(); //tPanel.setWidth(800); ScrollPanel pnl = new ScrollPanel(); // pnl.setAutoWidth(true); //pnl.setClosable(false); pnl.setTitle("WS Definition"); //TODO {bauna} i18n // pnl.setAutoHeight(true); pnl.add(buildDoubleList(wsData));//from w ww. j ava 2 s .co m tPanel.add(pnl, "WS Definition"); pnl = new ScrollPanel(); // pnl.setAutoWidth(true); //pnl.setClosable(false); //pnl.setTitle("WS Constraints"); //TODO {bauna} i18n // pnl.setAutoHeight(true); this.factsConstraintsgEditorPanel = new FactsConstraintsEditorPanel(this); pnl.add(this.factsConstraintsgEditorPanel); tPanel.add(pnl, "WS Constraints"); pnl = new ScrollPanel(); // pnl.setAutoWidth(true); //pnl.setClosable(false); pnl.setTitle("WS Custom Forms"); //TODO {bauna} i18n // pnl.setAutoHeight(true); this.customFormsEditorPanel = new CustomFormsEditorPanel(this); pnl.add(this.customFormsEditorPanel); tPanel.add(pnl, "WS Custom Forms"); tPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<java.lang.Integer>() { public void onBeforeSelection(BeforeSelectionEvent<java.lang.Integer> arg0) { factsConstraintsgEditorPanel.fillSelectedFacts(); customFormsEditorPanel.fillSelectedFacts(); } }); tPanel.selectTab(0); initWidget(tPanel); }
From source file:org.drools.guvnor.client.explorer.ExplorerViewCenterPanel.java
License:Apache License
private void addBeforeSelectionHandler() { tabLayoutPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> integerBeforeSelectionEvent) { if (!tabLayoutPanel.isCanSelectTabToggle()) { integerBeforeSelectionEvent.cancel(); clientFactory.getPlaceController() .goTo(openedTabs.getKey(integerBeforeSelectionEvent.getItem())); }/*from w w w . j a v a 2 s .c om*/ } }); }
From source file:org.drools.guvnor.client.ruleeditor.WorkingSetEditor.java
License:Apache License
private void refreshWidgets() { WorkingSetConfigData wsData = (WorkingSetConfigData) workingSet.content; TabPanel tPanel = new TabPanel(); //tPanel.setWidth(800); ScrollPanel pnl = new ScrollPanel(); // pnl.setAutoWidth(true); //pnl.setClosable(false); pnl.setTitle("WS Definition"); //TODO {bauna} i18n // pnl.setAutoHeight(true); pnl.add(buildDoubleList(wsData));//from ww w .j a va2s.c o m tPanel.add(pnl, "WS Definition"); pnl = new ScrollPanel(); // pnl.setAutoWidth(true); //pnl.setClosable(false); //pnl.setTitle("WS Constraints"); //TODO {bauna} i18n // pnl.setAutoHeight(true); this.factsConstraintsgEditorPanel = new FactsConstraintsEditorPanel(this); pnl.add(this.factsConstraintsgEditorPanel); tPanel.add(pnl, "WS Constraints"); pnl = new ScrollPanel(); // pnl.setAutoWidth(true); //pnl.setClosable(false); pnl.setTitle("WS Custom Forms"); //TODO {bauna} i18n // pnl.setAutoHeight(true); this.customFormsEditorPanel = new CustomFormsEditorPanel(this); pnl.add(this.customFormsEditorPanel); tPanel.add(pnl, "WS Custom Forms"); tPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<java.lang.Integer>() { public void onBeforeSelection(BeforeSelectionEvent<java.lang.Integer> arg0) { factsConstraintsgEditorPanel.fillSelectedFacts(); customFormsEditorPanel.fillSelectedFacts(); } }); tPanel.selectTab(0); initWidget(tPanel); }