@Inject public HeaderView(Binder uiBinder, NavigationListStyle listResources, PlaceManager placeManager) { this.placeManager = placeManager; CellList<MenuItem> placeList = new CellList<MenuItem>(new EnumCell<MenuItem>(), listResources); menuBar = new ValuePicker<MenuItem>(placeList); initWidget(uiBinder.createAndBindUi(this)); menuBar.setAcceptableValues(Arrays.asList(MenuItem.values())); menuBar.setValue(MenuItem.MANUFACTURER); menuBar.setVisible(false); userOptions.setVisible(false); }
@Override public void enableUserOptions(CurrentUser currentUser) { userOptions.setVisible(true); menuBar.setVisible(true); UserDto userDto = currentUser.getUser(); name.setText(userDto.getFirstName()); }
private void init() { GWT.setUncaughtExceptionHandler( new GWT.UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { log.log(Level.SEVERE, e.getMessage(), e); } }); if (LogConfiguration.loggingIsEnabled()) { /* Add remote logging handler */ RequestFactoryLogHandler.LoggingRequestProvider provider = new RequestFactoryLogHandler.LoggingRequestProvider() { public LoggingRequest getLoggingRequest() { return requestFactory.loggingRequest(); } }; Logger.getLogger("") .addHandler( new RequestFactoryLogHandler(provider, Level.WARNING, new ArrayList<String>())); } // AppEngine user authentication new GaeLoginWidgetDriver(requestFactory).setWidget(shell.loginWidget); new ReloadOnAuthenticationFailure().register(eventBus); /* Left side lets us pick from all the types of entities */ final Renderer<ProxyListPlace> placePickerRenderer = new ApplicationListPlaceRenderer(); Cell<ProxyListPlace> placePickerCell = new AbstractCell<ProxyListPlace>() { @Override public void render(Context context, ProxyListPlace value, SafeHtmlBuilder sb) { sb.appendEscaped(placePickerRenderer.render(value)); } }; CellList<ProxyListPlace> placePickerList = new CellList<ProxyListPlace>(placePickerCell, getMobileListResources()); placePickerList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); final ValuePicker<ProxyListPlace> placePickerView = new ValuePicker<ProxyListPlace>(placePickerList); Activity defaultActivity = new DefaultActivity(placePickerView); ProxyPlaceToListPlace proxyPlaceToListPlace = new ProxyPlaceToListPlace(); ProxyListPlacePicker proxyListPlacePicker = new ProxyListPlacePicker(placeController, proxyPlaceToListPlace); placePickerView.setAcceptableValues(getTopPlaces()); proxyListPlacePicker.register(eventBus, placePickerView); /* * Wrap the scaffoldMobileActivities so we can intercept activity requests * and remember the last activity (for back button support). */ scaffoldMobileActivities.setRootActivity(defaultActivity); ActivityMapper activityMapper = new ActivityMapper() { public Activity getActivity(Place place) { // Defer to scaffoldMobileActivities. Activity nextActivity = scaffoldMobileActivities.getActivity(place); // Clear the value of the placePicker so we can select a new top level // value. placePickerView.setValue(null, false); // Update the title, back and edit buttons. Button backButton = shell.getBackButton(); if (nextActivity instanceof IsScaffoldMobileActivity) { lastActivity = (IsScaffoldMobileActivity) nextActivity; // Update the title. shell.setTitleText(lastActivity.getTitleText()); // Update the back button. String backButtonText = lastActivity.getBackButtonText(); if (backButtonText == null || backButtonText.length() == 0) { shell.setBackButtonVisible(false); } else { shell.setBackButtonVisible(true); backButton.setText(backButtonText); } // Update the edit button. shell.setEditButtonVisible(lastActivity.hasEditButton()); } else { lastActivity = null; shell.setTitleText(""); shell.setBackButtonVisible(false); shell.setEditButtonVisible(false); } // Return the activity. return nextActivity; } }; /* * The body is run by an ActivityManager that listens for PlaceChange events * and finds the corresponding Activity to run */ final ActivityManager activityManager = new ActivityManager(activityMapper, eventBus); activityManager.setDisplay(shell.getBody()); /* Browser history integration */ ScaffoldPlaceHistoryMapper mapper = GWT.create(ScaffoldPlaceHistoryMapper.class); mapper.setFactory(placeHistoryFactory); PlaceHistoryHandler placeHistoryHandler = new PlaceHistoryHandler(mapper); placeHistoryHandler.register(placeController, eventBus, ROOT_PLACE); placeHistoryHandler.handleCurrentHistory(); shell .getBackButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (lastActivity != null) { Place backPlace = lastActivity.getBackButtonPlace(); if (backPlace != null) { placeController.goTo(backPlace); } } } }); shell .getEditButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (lastActivity != null) { Place editPlace = lastActivity.getEditButtonPlace(); if (editPlace != null) { placeController.goTo(editPlace); } } } }); }
@UiHandler("menuBar") void onMenuItemChanged(ValueChangeEvent<MenuItem> event) { placeManager.revealPlace( new PlaceRequest.Builder().nameToken(menuBar.getValue().getPlaceToken()).build()); }
@Override public void disableUserOptions() { userOptions.setVisible(false); menuBar.setVisible(false); }
public com.google.gwt.user.client.ui.Widget createAndBindUi( final com.testroo.client.scaffold.ScaffoldDesktopShell owner) { com.testroo.client.scaffold.ScaffoldDesktopShell_BinderImpl_GenBundle clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay = (com.testroo.client.scaffold.ScaffoldDesktopShell_BinderImpl_GenBundle) GWT.create( com.testroo.client.scaffold.ScaffoldDesktopShell_BinderImpl_GenBundle.class); com.google.gwt.resources.client.ImageResource gwtLogo = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.gwtLogo(); com.google.gwt.resources.client.ImageResource rooLogo = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.rooLogo(); com.testroo.client.scaffold.ScaffoldDesktopShell_BinderImpl_GenCss_style style = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style(); com.google.gwt.dom.client.DivElement error = null; java.lang.String domId0 = com.google.gwt.dom.client.Document.get().createUniqueId(); java.lang.String domId1 = com.google.gwt.dom.client.Document.get().createUniqueId(); com.google.gwt.requestfactory.ui.client.LoginWidget loginWidget = (com.google.gwt.requestfactory.ui.client.LoginWidget) GWT.create(com.google.gwt.requestfactory.ui.client.LoginWidget.class); com.google.gwt.user.client.ui.HTMLPanel f_HTMLPanel2 = new com.google.gwt.user.client.ui.HTMLPanel( "<div class='" + "" + style.banner() + "" + "'> <div class='" + "" + style.error() + "" + "' id='" + domId0 + "'></div> <span class='" + "" + style.title() + "" + "'><h2>Data Browser</h2></span> <span id='" + domId1 + "'></span> </div>"); com.google.gwt.user.client.ui.HTML f_HTML3 = (com.google.gwt.user.client.ui.HTML) GWT.create(com.google.gwt.user.client.ui.HTML.class); com.google.gwt.user.client.ui.ValuePicker placesBox = owner.placesBox; com.google.gwt.user.client.ui.SimplePanel f_SimplePanel5 = (com.google.gwt.user.client.ui.SimplePanel) GWT.create(com.google.gwt.user.client.ui.SimplePanel.class); com.google.gwt.user.client.ui.NotificationMole mole = (com.google.gwt.user.client.ui.NotificationMole) GWT.create(com.google.gwt.user.client.ui.NotificationMole.class); com.google.gwt.user.client.ui.SimplePanel master = (com.google.gwt.user.client.ui.SimplePanel) GWT.create(com.google.gwt.user.client.ui.SimplePanel.class); com.google.gwt.user.client.ui.FlowPanel f_FlowPanel6 = (com.google.gwt.user.client.ui.FlowPanel) GWT.create(com.google.gwt.user.client.ui.FlowPanel.class); com.google.gwt.user.client.ui.SimplePanel details = (com.google.gwt.user.client.ui.SimplePanel) GWT.create(com.google.gwt.user.client.ui.SimplePanel.class); com.google.gwt.user.client.ui.FlowPanel f_FlowPanel4 = (com.google.gwt.user.client.ui.FlowPanel) GWT.create(com.google.gwt.user.client.ui.FlowPanel.class); com.google.gwt.user.client.ui.DockLayoutPanel f_DockLayoutPanel1 = new com.google.gwt.user.client.ui.DockLayoutPanel(com.google.gwt.dom.client.Style.Unit.EM); loginWidget.setStyleName("" + style.login() + ""); f_HTMLPanel2.setStyleName("" + style.centered() + ""); f_DockLayoutPanel1.addNorth(f_HTMLPanel2, 6); f_HTML3.setHTML( "<div class='" + "" + style.logos() + "" + "'> <span>Powered by: </span> <a href='http://code.google.com/webtoolkit/'><div class='" + "" + style.gwtLogo() + "" + "'></div></a> <a href='http://www.springsource.org/roo/'><div class='" + "" + style.rooLogo() + "" + "'></div></a> </div>"); f_DockLayoutPanel1.addSouth(f_HTML3, 2); placesBox.setStyleName("" + style.entitiesList() + ""); placesBox.setWidth("100%"); placesBox.setPageSize(100); f_SimplePanel5.add(placesBox); f_SimplePanel5.setStyleName("" + style.entities() + ""); f_FlowPanel4.add(f_SimplePanel5); mole.setMessage("loading..."); mole.setAnimationDuration(0); f_FlowPanel6.add(mole); master.setStyleName("" + style.entityDetails() + ""); f_FlowPanel6.add(master); f_FlowPanel4.add(f_FlowPanel6); details.setStyleName("" + style.entityDetails() + ""); f_FlowPanel4.add(details); f_FlowPanel4.setStyleName("" + style.content() + " " + style.centered() + ""); f_DockLayoutPanel1.add(f_FlowPanel4); UiBinderUtil.TempAttachment attachRecord0 = UiBinderUtil.attachToDom(f_HTMLPanel2.getElement()); error = com.google.gwt.dom.client.Document.get().getElementById(domId0).cast(); error.removeAttribute("id"); com.google.gwt.user.client.Element domId1Element = com.google.gwt.dom.client.Document.get().getElementById(domId1).cast(); attachRecord0.detach(); f_HTMLPanel2.addAndReplaceElement(loginWidget, domId1Element); owner.details = details; owner.error = error; owner.loginWidget = loginWidget; owner.master = master; owner.mole = mole; clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected(); return f_DockLayoutPanel1; }