List of usage examples for com.google.gwt.user.client.ui PushButton getDownFace
public final Face getDownFace()
From source file:com.github.gwt.user.client.ui.ClearBox.java
License:Apache License
private FocusWidget defaultClearButton() { PushButton pushClearButton = new PushButton(); Image upImage = new Image(RESOURCES.clearButton().up()); pushClearButton.getUpFace().setImage(upImage); Image hover = new Image(RESOURCES.clearButton().upHovering()); pushClearButton.getUpHoveringFace().setImage(hover); Image disabled = new Image(RESOURCES.clearButton().upDisabled()); pushClearButton.getUpDisabledFace().setImage(disabled); Image down = new Image(RESOURCES.clearButton().down()); pushClearButton.getDownFace().setImage(down); Image downHover = new Image(RESOURCES.clearButton().downHover()); pushClearButton.getDownHoveringFace().setImage(downHover); Image downDisabled = new Image(RESOURCES.clearButton().downDisabled()); pushClearButton.getDownDisabledFace().setImage(downDisabled); return pushClearButton; }
From source file:com.github.gwt.user.client.ui.DateTimeBox.java
License:Apache License
private FocusWidget defaultButton() { PushButton button = new PushButton(); Image up = new Image(resources.calButton().up()); button.getUpFace().setImage(up);// www . j av a 2s . c o m Image upHover = new Image(resources.calButton().upHover()); button.getUpHoveringFace().setImage(upHover); Image upDisable = new Image(resources.calButton().upDisabled()); button.getUpDisabledFace().setImage(upDisable); Image down = new Image(resources.calButton().down()); button.getDownFace().setImage(down); Image downHover = new Image(resources.calButton().downHover()); button.getDownHoveringFace().setImage(downHover); Image downDsbl = new Image(resources.calButton().downDsbld()); button.getDownDisabledFace().setImage(downDsbl); return button; }
From source file:com.google.appengine.demos.sticky.client.Buttons.java
License:Apache License
/** * Creates a {@link PushButton} with the specified face images and stylename. * * @param upImage// w w w . j av a 2s.c o m * the image to be used on the up face * @param hvImage * the image to be used on the hover face * @param dnImage * the image to be used on the down face * @param styleName * the stylename to use for the widget * @param handler * a click handler to which to bind the button * @return the button */ public static PushButton createPushButtonWithImageStates(Image upImage, Image hvImage, Image dnImage, String styleName, ClickHandler handler) { final PushButton button = createPushButtonWithImageStates(upImage, hvImage, styleName, handler); button.getDownFace().setImage(dnImage); return button; }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.ButtonRenderer.java
License:Apache License
/** * Creates PushButton component with image. * Also associated context menu is specified. * @param menu/*from w w w. j av a 2s. c o m*/ * @param buttonGVO * @param uuid * @param parent * @param context * @return */ private PushButton createPushButton(MenuItemGVO menu, final ButtonGVO buttonGVO, final String uuid, final String parent, String context) { PushButton pushButton = null; if (menu != null) { pushButton = new PushButton() { @Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCONTEXTMENU) { DOM.eventPreventDefault(event); applyContextMenu(event, buttonGVO, uuid, parent); } super.onBrowserEvent(event); } @Override protected void setElement(Element elem) { super.setElement(elem); sinkEvents(Event.ONCONTEXTMENU); } }; } else { pushButton = new PushButton(); } RendererHelper.fillIn(buttonGVO, pushButton, uuid, parent, context); /** * Following code manages width and height of pushbutton holding image. * Style attribute from the uiObject rendered as div is taken off. * In case of PushButton the uiObject is rendered as a div which holds html element of type text and image. * All styles are made in effect on the image. The text input remains empty. * Width & Height mentioned in style attribute of push button tag has higher priority followed value of width & height attributes available in button tag * and the least priority goes to the properties mentioned in css style class. * If width and height is not mentioned at all by any means then size of the image is made effective as size of the push button. * */ pushButton.getElement().removeAttribute("style"); Image image = new Image(buttonGVO.getImageLocation()); String imageHeight = buttonGVO.getHeight() == null ? image.getHeight() + "" : buttonGVO.getHeight(); String imageWidth = buttonGVO.getWidth() == null ? image.getWidth() + "" : buttonGVO.getWidth(); image.setSize(imageWidth, imageHeight); pushButton.setSize(imageWidth, imageHeight); if (buttonGVO.getStyleClass() != null) { image.setStylePrimaryName(buttonGVO.getStyleClass()); } if (buttonGVO.getStyleProperties().length > 0) { RendererHelper.setStyleForElement(image.getElement(), buttonGVO.getStyleProperties()); } pushButton.getUpFace().setImage(image); pushButton.getDownFace().setImage(image); return pushButton; }
From source file:org.freemedsoftware.gwt.client.screen.MainScreen.java
License:Open Source License
protected void initTopHeaderNavPanel() { shortCutsPanel.clear();// ww w. j a v a 2s . c o m shortCutsPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL); // adding current page help link PushButton helpButton = new PushButton(); helpButton.setTitle(_("help")); helpButton.setStyleName(AppConstants.STYLE_BUTTON_SIMPLE); helpButton.getUpFace().setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/help.16x16.png")); helpButton.getDownFace().setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/help.16x16.png")); helpButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (Util.getProgramMode() == ProgramMode.STUBBED) { Window.alert("Running in stubbed mode"); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { CustomIFrame customIFrame = new CustomIFrame(Util.getHelpRequest(), (int) (Window.getClientWidth() * .60), (int) (Window.getClientHeight() * .60)); shortCutsPanel.add(customIFrame); customIFrame.show(); customIFrame.center(); } } }); Util.attachHelp(helpButton, _("Help Icon"), _("Help for the currently selected tab."), true); shortCutsPanel.add(helpButton); HTML separator = null; if (CurrentState.isMenuAllowed(AppConstants.SYSTEM_CATEGORY, AppConstants.SCHEDULER)) { // Adding spacer separator = new HTML("|"); separator.setWidth("8px"); separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); shortCutsPanel.add(separator); // adding scheduler link PushButton schedulerButton = new PushButton(); schedulerButton.setTitle(_("scheduler")); schedulerButton.setStyleName(AppConstants.STYLE_BUTTON_SIMPLE); schedulerButton.getUpFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/scheduler.16x16.png")); schedulerButton.getDownFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/scheduler.16x16.png")); schedulerButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Util.spawnTab(AppConstants.SCHEDULER, SchedulerScreen.getInstance()); } }); Util.attachHelp(schedulerButton, _("Scheduler"), _("View and book appointments."), true); shortCutsPanel.add(schedulerButton); } if (CurrentState.isMenuAllowed(AppConstants.PATIENT_CATEGORY, AppConstants.SEARCH)) { // Adding spacer separator = new HTML("|"); separator.setWidth("8px"); separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); shortCutsPanel.add(separator); // adding Patient Search Link PushButton ptSearchButton = new PushButton(); ptSearchButton.setTitle(_("search patient")); ptSearchButton.setStyleName(AppConstants.STYLE_BUTTON_SIMPLE); ptSearchButton.getUpFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/patient_icon.16x16.png")); ptSearchButton.getDownFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/patient_icon.16x16.png")); ptSearchButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Util.spawnTab(AppConstants.SEARCH, PatientSearchScreen.getInstance()); } }); Util.attachHelp(ptSearchButton, _("Patient Search"), _("Search for patients."), true); shortCutsPanel.add(ptSearchButton); } // Adding spacer separator = new HTML("|"); separator.setWidth("8px"); separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); shortCutsPanel.add(separator); // Adding preferences link PushButton preferencesButton = new PushButton(); preferencesButton.setTitle(_("preferences")); preferencesButton.setStyleName(AppConstants.STYLE_BUTTON_SIMPLE); preferencesButton.getUpFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/preferences.16x16.png")); preferencesButton.getDownFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/preferences.16x16.png")); preferencesButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // logout event when clicked on logout link // if (Util.getProgramMode() == ProgramMode.STUBBED) { // Window.alert("Running in stubbed mode"); // } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { final PreferencesScreen preferencesScreen = PreferencesScreen.getInstance(); Util.spawnTab(_("Preferences"), preferencesScreen); // } } }); Util.attachHelp(preferencesButton, _("Preferences"), _("Set your user prefereneces."), true); shortCutsPanel.add(preferencesButton); separator = new HTML("|"); separator.setWidth("8px"); separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); shortCutsPanel.add(separator); // Adding support link PushButton supportButton = new PushButton(); supportButton.setTitle(_("support")); supportButton.setStyleName(AppConstants.STYLE_BUTTON_SIMPLE); supportButton.getUpFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/support.16x16.png")); supportButton.getDownFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/support.16x16.png")); supportButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { InfoDialog d = new InfoDialog(); d.setCaption("Support"); d.setContent(new HTML( "Commercial support is available for <b>FreeMED</b> through the Foundation's commercial support partners." + "<br/><br/>" + "More information is available at <a href=\"http://freemedsoftware.org/commercial_support\" target=\"_new\">http://freemedsoftware.org/commercial_support</a>." + "<br/><br/>" + "<hr/>" + "<br/></br>" + "Community support is available on the FreeMED group at " + "<a href=\"http://groups.google.com/group/freemed-support?hl=en\">http://groups.google.com/group/freemed-support?hl=en</a>.")); d.center(); } }); Util.attachHelp(supportButton, _("Support"), _("More information about support."), true); shortCutsPanel.add(supportButton); // Adding logout link separator = new HTML("|"); separator.setWidth("8px"); separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); shortCutsPanel.add(separator); // Adding logout link PushButton logoutButton = new PushButton(); logoutButton.setTitle(_("logout")); logoutButton.setStyleName(AppConstants.STYLE_BUTTON_SIMPLE); logoutButton.getUpFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/logout.16x16.png")); logoutButton.getDownFace() .setImage(new Image(GWT.getHostPageBaseURL() + "resources/images/logout.16x16.png")); logoutButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // logout event when clicked on logout link if (Util.getProgramMode() == ProgramMode.STUBBED) { Window.alert("Running in stubbed mode"); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { // dashboard.saveArrangement(); Util.logout(new Command() { @Override public void execute() { // TODO Auto-generated method stub notifications.stop(); } }); } } }); Util.attachHelp(logoutButton, _("Logout"), _("Logout of FreeMED."), true); shortCutsPanel.add(logoutButton); }