List of usage examples for com.google.gwt.place.shared PlaceController getWhere
public Place getWhere()
From source file:com.goodow.web.ui.client.nav.TagsUi.java
License:Apache License
@Inject private TagsUi(final NavTreeViewModel treeViewModel, final SingleSelectionModel<com.goodow.web.mvp.shared.tree.TreeNodeProxy> selectionModel, final Resources resources, final PlaceController placeController, final Provider<TreeNodePlace> placeProvider) { this.placeController = placeController; logger.finest("init start"); this.treeViewModel = treeViewModel; this.selectionModel = selectionModel; this.resources = resources; // Listen for selection. We need to add this handler before the CellBrowser // adds its own handler. this.selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override/*from www . j av a 2 s .c om*/ public void onSelectionChange(final SelectionChangeEvent event) { com.goodow.web.mvp.shared.tree.TreeNodeProxy lastSelected = selectionModel.getSelectedObject(); TreeNodePlace place = placeProvider.get().setPath(lastSelected.getPath()); if (!place.equals(placeController.getWhere())) { placeController.goTo(place); } } }); initWidget(layout); if (LogConfiguration.loggingIsEnabled()) { logger.log(Level.FINEST, "init end"); } }
From source file:com.google.gwt.sample.mobilewebapp.client.desktop.MobileWebAppShellDesktop.java
License:Apache License
/** * Construct a new {@link MobileWebAppShellDesktop}. *///from w ww .j a v a 2s .com public MobileWebAppShellDesktop(EventBus bus, TaskChartPresenter pieChart, final PlaceController placeController, TaskListView taskListView, TaskEditView taskEditView, TaskReadView taskReadView) { // Initialize the main menu. Resources resources = GWT.create(Resources.class); mainMenu = new CellList<MainMenuItem>(new MainMenuItem.Cell(), resources); mainMenu.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); // We don't expect to have more than 30 menu items. mainMenu.setVisibleRange(0, 30); // Add items to the main menu. final List<MainMenuItem> menuItems = new ArrayList<MainMenuItem>(); menuItems.add(new MainMenuItem("Task List", new TaskListPlace(false)) { @Override public boolean mapsToPlace(Place p) { // Map to all TaskListPlace instances. return p instanceof TaskListPlace; } }); menuItems.add(new MainMenuItem("Add Task", TaskPlace.getTaskCreatePlace())); mainMenu.setRowData(menuItems); // Choose a place when a menu item is selected. final SingleSelectionModel<MainMenuItem> selectionModel = new SingleSelectionModel<MainMenuItem>(); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { MainMenuItem selected = selectionModel.getSelectedObject(); if (selected != null && !selected.mapsToPlace(placeController.getWhere())) { placeController.goTo(selected.getPlace()); } } }); mainMenu.setSelectionModel(selectionModel); // Update selection based on the current place. bus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { public void onPlaceChange(PlaceChangeEvent event) { Place place = event.getNewPlace(); for (MainMenuItem menuItem : menuItems) { if (menuItem.mapsToPlace(place)) { // We found a match in the main menu. selectionModel.setSelected(menuItem, true); return; } } // We didn't find a match in the main menu. selectionModel.setSelected(null, true); } }); // Initialize this widget. initWidget(uiBinder.createAndBindUi(this)); // Initialize the pie chart. String chartUrlValue = Window.Location.getParameter(CHART_URL_ATTRIBUTE); if (chartUrlValue != null && chartUrlValue.startsWith("f")) { // Chart manually disabled. leftNav.remove(1); // Pie Chart. leftNav.remove(0); // Pie chart legend. } else if (pieChart == null) { // Chart not supported. pieChartContainer.setWidget(new Label("Try upgrading to a modern browser to enable charts.")); } else { // Chart supported. Widget pieWidget = pieChart.asWidget(); pieWidget.setWidth("90%"); pieWidget.setHeight("90%"); pieWidget.getElement().getStyle().setMarginLeft(5.0, Unit.PCT); pieWidget.getElement().getStyle().setMarginTop(5.0, Unit.PCT); pieChartContainer.setWidget(pieChart); } /* * Add all views to the DeckLayoutPanel so we can animate between them. * Using a DeckLayoutPanel here works because we only have a few views, and * we always know that the task views should animate in from the right side * of the screen. A more complex app will require more complex logic to * figure out which direction to animate. */ contentContainer.add(taskListView); contentContainer.add(taskReadView); contentContainer.add(taskEditView); contentContainer.setAnimationDuration(800); // Show a tutorial when the help link is clicked. helpLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showTutorial(); } }); }
From source file:com.logikas.samples.errai.client.mvp.presenter.configure.MVPInitializer.java
License:Apache License
@PostConstruct private void init() { EventBus b = Preconditions.checkNotNull(bus, "Event Buss is Null"); GWT.log(b.toString());/* w w w . j av a2s. co m*/ PlaceController c = Preconditions.checkNotNull(controller, "PlaceController is Null"); GWT.log(c.getWhere().toString()); centerActivityManager = Preconditions.checkNotNull(centerActivityManager, "Center ActivityManager is Null"); GWT.log(centerActivityManager.getClass().toString() + " Injected"); //cam.setDisplay(layout.getCenterReqion()); //ActivityManager pam = Preconditions.checkNotNull(popupActivityManager, "Popup ActivityManager is Null"); //GWT.log(pam.getClass().toString()+" Injected"); //pam.setDisplay(layout.getPopupRegion()); //MainLayout ml = Preconditions.checkNotNull(layout, "Layout is Null"); //GWT.log(ml.getClass().toString()+" Injected"); }
From source file:org.apache.hupa.client.ui.MessagesCellTable.java
License:Apache License
public String parseFolderName(final PlaceController pc) { // Block insertion: ////from ww w . j a v a 2s .c om InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x1"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x20x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x3_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x20x0"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x00x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x00x0"); Place place = pc.getWhere(); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x1"); if (place instanceof FolderPlace) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x10x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x10x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x10x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x10x00x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x10x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x10x0"); folderName = ((FolderPlace) place).getToken(); } else if (place instanceof MessagePlace) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x00x00x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x00x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x10x20x10x0"); folderName = ((MessagePlace) place).getTokenWrapper().getFolder(); } InstrumentationLoggerProvider.get() .instrument("org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f55d7b632bc0x30x2"); return folderName; }