List of usage examples for com.google.gwt.user.client.ui FocusPanel addMouseOutHandler
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
From source file:com.alkacon.geranium.client.ui.input.A_SelectBox.java
License:Open Source License
/** * Helper method for adding event handlers for a 'hover' effect to the opener.<p> * /* ww w . j av a 2s . c o m*/ * @param panel the opener */ private void addHoverHandlers(FocusPanel panel) { final StyleVariable hoverVar = new StyleVariable(panel); hoverVar.setValue(CSS.openerNoHover()); panel.addMouseOverHandler(new MouseOverHandler() { /** * @see com.google.gwt.event.dom.client.MouseOverHandler#onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent) */ public void onMouseOver(MouseOverEvent event) { hoverVar.setValue(CSS.openerHover()); } }); panel.addMouseOutHandler(new MouseOutHandler() { /** * @see com.google.gwt.event.dom.client.MouseOutHandler#onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent) */ public void onMouseOut(MouseOutEvent event) { hoverVar.setValue(CSS.openerNoHover()); } }); }
From source file:com.google.api.explorer.client.history.JsonPrettifier.java
License:Apache License
/** * Create a drop down menu that allows the user to navigate to compatible methods for the * specified resource.//from ww w . j a v a2 s . c om * * @param methods Methods for which to build the menu. * @param service Service to which the methods correspond. * @param objectToPackage Object which should be passed to the destination menus. * @param linkFactory Factory that will be used to create links. * @return A button that will show the menu that was generated or {@code null} if there are no * compatible methods. */ private static PushButton createRequestMenu(final Collection<ApiMethod> methods, final ApiService service, DynamicJso objectToPackage, PrettifierLinkFactory linkFactory) { // Determine if a menu even needs to be generated. if (methods.isEmpty()) { return null; } // Create the parameters that will be passed to the destination menu. String resourceContents = new JSONObject(objectToPackage).toString(); final Multimap<String, String> resourceParams = ImmutableMultimap.of(UrlBuilder.BODY_QUERY_PARAM_KEY, resourceContents); // Create the menu itself. FlowPanel menuContents = new FlowPanel(); // Add a description of what the menu does. Label header = new Label("Use this resource in one of the following methods:"); header.addStyleName(style.dropDownMenuItem()); menuContents.add(header); // Add a menu item for each method. for (ApiMethod method : methods) { PushButton methodItem = new PushButton(); methodItem.addStyleName(style.dropDownMenuItem()); methodItem.addStyleName(style.selectableDropDownMenuItem()); methodItem.setText(method.getId()); menuContents.add(methodItem); // When clicked, Navigate to the menu item. UrlBuilder builder = new UrlBuilder(); String newUrl = builder.addRootNavigationItem(RootNavigationItem.ALL_VERSIONS) .addService(service.getName(), service.getVersion()).addMethodName(method.getId()) .addQueryParams(resourceParams).toString(); methodItem.addClickHandler(linkFactory.generateMenuHandler(newUrl)); } // Create the panel which will be disclosed. final PopupPanel popupMenu = new PopupPanel(/* auto hide */ true); popupMenu.setStyleName(style.dropDownMenuPopup()); FocusPanel focusContents = new FocusPanel(); focusContents.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { popupMenu.hide(); } }); focusContents.setWidget(menuContents); popupMenu.setWidget(focusContents); // Create the button which will disclose the menu. final PushButton menuButton = new PushButton(new Image(resources.downArrow())); menuButton.addStyleName(style.reusableResourceButton()); menuButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { popupMenu.setPopupPositionAndShow(new PositionCallback() { @Override public void setPosition(int offsetWidth, int offsetHeight) { popupMenu.setPopupPosition( menuButton.getAbsoluteLeft() + menuButton.getOffsetWidth() - offsetWidth, menuButton.getAbsoluteTop() + menuButton.getOffsetHeight()); } }); } }); // Return only the button to the caller. return menuButton; }
From source file:com.koobe.editor.admin.client.application.sandbox.SandboxView.java
License:Apache License
@UiHandler("draftAddButton") void onDraftAddButtonClick(ClickEvent event) { final HTML widget = new HTML("<h1>Chapter Title</h1>"); final FocusPanel wrapper = new FocusPanel(); wrapper.add(widget);//w w w . j ava 2s . c om wrapper.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent mouseOverEvent) { widget.setStyleName("draft-with-border"); } }); wrapper.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent mouseOutEvent) { widget.removeStyleName("draft-with-border"); } }); wrapper.addDoubleClickHandler(new DoubleClickHandler() { @Override public void onDoubleClick(DoubleClickEvent doubleClickEvent) { Bootbox.prompt("Write:", new PromptCallback() { @Override public void callback(String result) { widget.setHTML("<h1>" + result + "</h1>"); } }); } }); draftPanel.add(wrapper); }
From source file:com.mecatran.otp.gwt.client.view.ItineraryWidget.java
License:Open Source License
public ItineraryWidget(ItineraryBean anItinerary, ItineraryListener aListener) { itinerary = anItinerary;//w ww . j a v a 2 s . co m listener = aListener; FocusPanel focusPanel = new FocusPanel(); VerticalPanel openablePanel = new VerticalPanel(); openablePanel.setWidth("100%"); // Header: summary itinerarySummaryWidget = new ItinerarySummaryWidget(itinerary, new ClickHandler() { @Override public void onClick(ClickEvent event) { event.stopPropagation(); listener.onItineraryCloseButtonClicked(ItineraryWidget.this); } }, new ClickHandler() { @Override public void onClick(ClickEvent event) { event.stopPropagation(); listener.onItineraryPinButtonClicked(ItineraryWidget.this, itinerarySummaryWidget.isPinned()); } }); itinerarySummaryWidget.addStyleName("itinerary-summary-panel"); openablePanel.add(itinerarySummaryWidget); // Print link click handler itinerarySummaryWidget.addPrintClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.stopPropagation(); listener.onItineraryPrintButtonClicked(ItineraryWidget.this); } }); // Timeline (not visible by default) itineraryTimeLineWidget = new ItineraryTimeLineWidget(itinerary); openablePanel.add(itineraryTimeLineWidget); itineraryTimeLineWidget.setVisible(false); // Details (not visible by default) itineraryDetailsWidget = new ItineraryDetailsWidget(itinerary, listener); itineraryDetailsWidget.addStyleName("itinerary-details-panel"); itineraryDetailsWidget.setVisible(false); opened = false; openablePanel.add(itineraryDetailsWidget); focusPanel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { boolean wasSelected = selected; listener.onItineraryHover(ItineraryWidget.this, false); listener.onItineraryClicked(ItineraryWidget.this); if (!opened) { itinerarySummaryWidget.setOpened(true); itineraryDetailsWidget.setVisible(true); itineraryTimeLineWidget.setVisible(true); opened = true; } else if (wasSelected && selected) { // We close it only if we were already selected. itinerarySummaryWidget.setOpened(false); itineraryDetailsWidget.setVisible(false); itineraryTimeLineWidget.setVisible(false); opened = false; } } }); focusPanel.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { if (!selected) listener.onItineraryHover(ItineraryWidget.this, true); } }); focusPanel.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { if (!selected) listener.onItineraryHover(ItineraryWidget.this, false); } }); focusPanel.add(openablePanel); initWidget(focusPanel); this.addStyleName("itinerary-panel-outer"); }
From source file:com.moesol.gwt.maps.client.MapController.java
License:Open Source License
public void bindHandlers(FocusPanel focusPanel) { focusPanel.addMouseMoveHandler(this); focusPanel.addMouseDownHandler(this); focusPanel.addMouseUpHandler(this); focusPanel.addMouseOutHandler(this); focusPanel.addMouseWheelHandler(this); focusPanel.addKeyDownHandler(this); focusPanel.addKeyUpHandler(this); focusPanel.addKeyPressHandler(this); }
From source file:com.objetdirect.gwt.umlapi.client.umlCanvas.DecoratorCanvas.java
License:Open Source License
private void addSidePanelHandlers(final Direction direction, final FocusPanel sidePanel) { sidePanel.getElement().getStyle().setBackgroundColor(backgroundColor); sidePanel.getElement().getStyle().setOpacity(opacityValue); sidePanel.addMouseOverHandler(new MouseOverHandler() { @Override/* ww w . ja va 2s. c o m*/ public void onMouseOver(final MouseOverEvent event) { for (double d = opacityValue; d <= opacityMax; d += 0.05) { final double opacity = Math.ceil(d * 100) / 100; new Scheduler.Task("Opacifying") { @Override public void process() { sidePanel.getElement().getStyle().setOpacity(opacity); } }; } new Scheduler.Task("MovingAllArtifacts") { @Override public void process() { Scheduler.cancel("MovingAllArtifactsRecursive"); umlCanvas.moveAll(direction.withSpeed(Direction.getDependingOnQualityLevelSpeed()), true); } }; } }); sidePanel.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(final MouseOutEvent event) { Scheduler.cancel("Opacifying"); Scheduler.cancel("MovingAllArtifacts"); Scheduler.cancel("MovingAllArtifactsRecursive"); sidePanel.getElement().getStyle().setOpacity(opacityValue); } }); sidePanel.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(final MouseDownEvent event) { sidePanel.getElement().getStyle() .setBackgroundColor(ThemeManager.getTheme().getDirectionPanelPressedColor().toString()); Scheduler.cancel("MovingAllArtifactsRecursive"); } }); sidePanel.addMouseUpHandler(new MouseUpHandler() { @Override public void onMouseUp(final MouseUpEvent event) { sidePanel.getElement().getStyle() .setBackgroundColor(ThemeManager.getTheme().getDirectionPanelColor().toString()); umlCanvas.moveAll(direction.withSpeed( Math.min(DecoratorCanvas.this.getOffsetHeight(), DecoratorCanvas.this.getOffsetWidth())), false); } }); }
From source file:geogebra.web.gui.advanced.client.ui.widget.ListPopupPanel.java
License:Apache License
/** * This method wraps the specified widget into the focus panel and adds necessary listeners. * * @param widget is an item widget to be wraped. * @return a focus panel adopted for displaying. */// w w w .ja v a 2 s . c om protected FocusPanel adoptItemWidget(Widget widget) { FocusPanel panel = new FocusPanel(widget); panel.addClickHandler(getItemClickHandler()); panel.addMouseOverHandler(getMouseEventsHandler()); panel.addMouseOutHandler(getMouseEventsHandler()); panel.setStyleName("item"); DOM.removeElementAttribute(panel.getElement(), "tabindex"); return panel; }
From source file:opus.gwt.management.console.client.dashboard.DashboardPanel.java
License:Apache License
public void handleProjectInformation(String projectName) { applicationsFlowPanel.clear();/*from w ww . j a v a 2s . c o m*/ final Project project = clientFactory.getProjects().get(projectName); HashMap<String, Application> applicationsMap = clientFactory.getApplications(); JsArrayString applicationsArray = project.getApps(); if (active) { activeButton.setText("Deactivate project"); } else { activeButton.setText("Activate project"); } for (int i = 0; i < applicationsArray.length() - 1; i++) { final Application app = applicationsMap.get(applicationsArray.get(i)); final FlowPanel application = new FlowPanel(); final FocusPanel applicationLabel = new FocusPanel(); final Label appName = new Label(app.getName()); final Label httpLabel = new Label("HTTP"); final Label httpsLabel = new Label("HTTPS"); final Label settingsLabel = new Label("Settings"); Image appIcon = new Image(); if (app.getIconURL().split("//").length < 2) { appIcon = new Image(JSVarHandler.getCommunityBaseURL() + app.getIconURL()); } else { appIcon = new Image(app.getIconURL()); } appIcon.setSize("64px", "64px"); application.add(appIcon); application.add(appName); application.add(httpLabel); application.add(httpsLabel); application.add(settingsLabel); application.setStyleName(manager.appIcon()); applicationLabel.add(application); applicationLabel.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { if (active) { applicationLabel.setStyleName(manager.appIconActive()); appName.addStyleName(manager.text()); httpLabel.addStyleName(manager.link()); httpsLabel.addStyleName(manager.link()); settingsLabel.addStyleName(manager.link()); } } }); applicationLabel.addMouseOutHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { applicationLabel.setStyleName(manager.appIcon()); appName.removeStyleName(manager.text()); httpLabel.removeStyleName(manager.link()); httpsLabel.removeStyleName(manager.link()); settingsLabel.removeStyleName(manager.link()); } }); httpLabel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (active) { Window.Location.assign(project.getURLS().get(0) + app.getAppName()); } } }); httpsLabel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (active) { Window.Location.assign(project.getURLS().get(1) + app.getAppName()); } } }); settingsLabel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (active) { eventBus.fireEvent(new PanelTransitionEvent(PanelTransitionEvent.TransitionTypes.SETTINGS, app.getAppName())); } } }); applicationsFlowPanel.add(applicationLabel); } }
From source file:opus.gwt.management.console.client.dashboard.IconPanel.java
License:Apache License
public void addProjectIcon(Project project) { FlowPanel projectPanel = new FlowPanel(); JsArrayString appStrings = project.getApps(); String description = ""; for (int i = 0; i < appStrings.length(); i++) { if (i == appStrings.length() - 1) description += appStrings.get(i); else// w w w . j a v a2 s . c o m description += appStrings.get(i) + ", "; } final String projectName = project.getName(); final String appNames = description; Image projectImg = new Image(res.projectdefaulticon2().getUrl()); projectImg.setPixelSize(64, 64); projectPanel.add(projectImg); projectPanel.add(new Label(projectName)); final FocusPanel testLabel = new FocusPanel(); testLabel.add(projectPanel); testLabel.setStyleName(style.projectIcon()); testLabel.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { testLabel.setStyleName(style.projectIconActive()); int[] pos = getDescPosition(testLabel); desc.show(); desc.setPopupPosition(pos[0], pos[1]); desc.setTitle("Applications"); desc.setText(appNames); } }); testLabel.addMouseOutHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { testLabel.setStyleName(style.projectIcon()); desc.hide(); } }); testLabel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { testLabel.setStyleName(style.projectIcon()); eventBus.fireEvent( new PanelTransitionEvent(PanelTransitionEvent.TransitionTypes.DASHBOARD, projectName)); } }); projectIconsFlowPanel.add(testLabel); iconMap.put(project.getName(), projectIconsFlowPanel.getWidgetIndex(testLabel)); }
From source file:org.opencms.gwt.client.ui.input.A_CmsSelectBox.java
License:Open Source License
/** * Helper method for adding event handlers for a 'hover' effect to the opener.<p> * //from w w w. j a va 2s. c o m * @param panel the opener */ private void addHoverHandlers(FocusPanel panel) { final CmsStyleVariable hoverVar = new CmsStyleVariable(panel); hoverVar.setValue(CSS.openerNoHover()); panel.addMouseOverHandler(new MouseOverHandler() { /** * @see com.google.gwt.event.dom.client.MouseOverHandler#onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent) */ public void onMouseOver(MouseOverEvent event) { hoverVar.setValue(CSS.openerHover()); } }); panel.addMouseOutHandler(new MouseOutHandler() { /** * @see com.google.gwt.event.dom.client.MouseOutHandler#onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent) */ public void onMouseOut(MouseOutEvent event) { hoverVar.setValue(CSS.openerNoHover()); } }); }