Java Code Examples for com.google.gwt.user.client.ui.Image#setStyleName()
The following examples show how to use
com.google.gwt.user.client.ui.Image#setStyleName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TopPanel.java From appinventor-extensions with Apache License 2.0 | 6 votes |
private void addLogo(HorizontalPanel panel) { // Logo is a link to App Inv homepage. Add timestamp to logo url // to get around browsers that agressively cache the image! This // same trick is used in StorageUtil.getFilePath(). Image logo = new Image(LOGO_IMAGE_URL + "?t=" + System.currentTimeMillis()); logo.setSize("180px", "40px"); logo.setStyleName("ode-Logo"); String logoUrl = ode.getSystemConfig().getLogoUrl(); if (!Strings.isNullOrEmpty(logoUrl)) { logo.addClickHandler(new WindowOpenClickHandler(logoUrl)); } panel.add(logo); panel.setCellWidth(logo, "230px"); panel.setCellHorizontalAlignment(logo, HorizontalPanel.ALIGN_LEFT); panel.setCellVerticalAlignment(logo, HorizontalPanel.ALIGN_MIDDLE); }
Example 2
Source File: TimePreferenceCell.java From unitime with Apache License 2.0 | 6 votes |
@Override public void refresh() { clear(); RoomCookie cookie = RoomCookie.getInstance(); if (iPattern != null && !iPattern.isEmpty() && !cookie.isGridAsText()) { final Image availability = new Image(GWT.getHostPageBaseURL() + "pattern?pref=" + iPattern + "&v=" + (cookie.areRoomsHorizontal() ? "0" : "1") + (cookie.hasMode() ? "&s=" + cookie.getMode() : "")); availability.setStyleName("grid"); add(availability); } else { for (PreferenceInfo p: iPreferences) { P prf = new P("prf"); prf.setText(p.getOwnerName()); PreferenceInterface preference = iProperties.getPreference(p.getPreference()); if (preference != null) { prf.getElement().getStyle().setColor(preference.getColor()); prf.setTitle(preference.getName() + " " + p.getOwnerName()); } add(prf); } } }
Example 3
Source File: ProposedQueryReceivedUserInfoImage.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * ProposedSubscriptionUserInfoImage */ public ProposedQueryReceivedUserInfoImage() { image = new Image(OKMBundleResources.INSTANCE.shareQuery()); image.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.DASHBOARD); DashboardComunicator.showToolBoxExtension(MessagingToolBarBox.get().messagingToolBarBox); MessagingToolBarBox.get().messageDashboard.messageStack.stackPanel.showWidget(MessageStack.STACK_QUERY_RECEIVED); } }); image.setTitle(GeneralComunicator.i18nExtension("messaging.user.info.new.proposed.query")); image.setStyleName("okm-Hyperlink"); initWidget(image); }
Example 4
Source File: MessageReceivedUserInfoImage.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * MessageReceivedUserInfoImage */ public MessageReceivedUserInfoImage() { image = new Image(OKMBundleResources.INSTANCE.messageReceived()); image.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.DASHBOARD); DashboardComunicator.showToolBoxExtension(MessagingToolBarBox.get().messagingToolBarBox); MessagingToolBarBox.get().messageDashboard.messageStack.stackPanel.showWidget(MessageStack.STACK_MESSAGES_RECEIVED); } }); image.setTitle(GeneralComunicator.i18nExtension("messaging.user.info.new.message.received")); image.setStyleName("okm-Hyperlink"); initWidget(image); }
Example 5
Source File: ProposedSubscriptionReceivedUserInfoImage.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * ProposedSubscriptionUserInfoImage */ public ProposedSubscriptionReceivedUserInfoImage() { image = new Image(OKMBundleResources.INSTANCE.proposeSubscription()); image.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.DASHBOARD); DashboardComunicator.showToolBoxExtension(MessagingToolBarBox.get().messagingToolBarBox); MessagingToolBarBox.get().messageDashboard.messageStack.stackPanel.showWidget(MessageStack.STACK_SUBSCRIPTION_RECEIVED); } }); image.setTitle(GeneralComunicator.i18nExtension("messaging.user.info.new.proposed.subscription")); image.setStyleName("okm-Hyperlink"); initWidget(image); }
Example 6
Source File: Clipboard.java From document-management-system with GNU General Public License v2.0 | 5 votes |
public Clipboard() { // Show clipboard icon imgCopyDav = new Image(OKMBundleResources.INSTANCE.clipboard()); imgCopyDav.setStyleName("okm-Hyperlink"); imgCopyDav.addClickHandler(this); // All composites must call initWidget() in their constructors. initWidget(imgCopyDav); }
Example 7
Source File: Clipboard.java From document-management-system with GNU General Public License v2.0 | 5 votes |
public Clipboard(String text) { this.text = text; // Show clipboard icon imgCopyDav = new Image(OKMBundleResources.INSTANCE.clipboardSmall()); imgCopyDav.setStyleName("okm-Hyperlink"); imgCopyDav.setAltText(text); imgCopyDav.setTitle(text); imgCopyDav.addClickHandler(this); // All composites must call initWidget() in their constructors. initWidget(imgCopyDav); }
Example 8
Source File: RoomsTable.java From unitime with Apache License 2.0 | 5 votes |
protected P getPopupWidget() { if (iPopupWidget == null) { iPopupWidget = new P("unitime-RoomPictureHint"); Image image = new Image(GWT.getHostPageBaseURL() + "picture?id=" + iPicture.getUniqueId()); image.setStyleName("picture"); iPopupWidget.add(image); P caption = new P("caption"); caption.setText(iPicture.getName() + (iPicture.getPictureType() == null ? "" : " (" + iPicture.getPictureType().getAbbreviation() + ")")); iPopupWidget.add(caption); } return iPopupWidget; }
Example 9
Source File: RoomDetail.java From unitime with Apache License 2.0 | 5 votes |
protected P getPopupWidget() { if (iPopupWidget == null) { iPopupWidget = new P("unitime-RoomPictureHint"); Image image = new Image(GWT.getHostPageBaseURL() + "picture?id=" + iPicture.getUniqueId()); image.setStyleName("picture"); iPopupWidget.add(image); P caption = new P("caption"); caption.setText(iPicture.getName() + (iPicture.getPictureType() == null ? "" : " (" + iPicture.getPictureType().getAbbreviation() + ")")); iPopupWidget.add(caption); } return iPopupWidget; }
Example 10
Source File: ScheduleStatus.java From unitime with Apache License 2.0 | 5 votes |
public ScheduleStatus() { super("unitime-ScheduleStatus"); setVisible(false); iImage = new Image(); iImage.setStyleName("image"); iMessage = new P("message"); add(iImage); add(iMessage); }
Example 11
Source File: Header.java From core with GNU Lesser General Public License v2.1 | 5 votes |
private Widget getProductSection() { final HorizontalPanel panel = new HorizontalPanel(); panel.getElement().setAttribute("role", "presentation"); panel.getElement().setAttribute("aria-hidden", "true"); final Image logo = new Image(); logo.getElement().setAttribute("style", "cursor:pointer"); logo.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { toggleNavigation(false); placeManager.revealPlace(new PlaceRequest(NameTokens.HomepagePresenter)); } }); logo.setStyleName("logo"); panel.add(logo); if (ProductConfig.Profile.PRODUCT.equals(productConfig.getProfile())) { logo.addErrorHandler(new ErrorHandler() { @Override public void onError(ErrorEvent event) { panel.remove(logo); Label productName = new Label(productConfig.getProductName()); productName.setStyleName("header-product-name"); panel.insert(productName, 0); } }); logo.setUrl("images/logo/" + logoName(productConfig.getProductName()) + ".png"); logo.setAltText(productConfig.getProductName()); } else { logo.setUrl("images/logo/community_title.png"); logo.setAltText("Wildlfy Application Server"); } return panel; }
Example 12
Source File: TutorialPanel.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Enlarges image on page */ private static void createImageDialog(String img) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel DialogBoxContents = new VerticalPanel(); FlowPanel holder = new FlowPanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); ok.setStyleName("DialogBox-button"); // Adds Image final Image image = new Image(img); image.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent evt) { final int imageWidth = image.getWidth(); final int imageHeight = image.getHeight(); final int windowWidth = (int) ((float) Window.getClientWidth() * 0.8); final int windowHeight = (int) ((float) Window.getClientHeight() * 0.9); int effectiveWidth = imageWidth; int effectiveHeight = imageHeight; if (imageWidth > windowWidth) { effectiveWidth = windowWidth; effectiveHeight = (int)(imageHeight * ((float)effectiveWidth / imageWidth)); } if (effectiveHeight > windowHeight) { effectiveHeight = windowHeight; effectiveWidth = (int)(imageWidth * ((float)effectiveHeight / imageHeight)); } image.setPixelSize(effectiveWidth, effectiveHeight); dialogBox.center(); } }); image.setStyleName("DialogBox-image"); holder.add(ok); DialogBoxContents.add(image); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.center(); dialogBox.show(); }
Example 13
Source File: StapleTableManager.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * addDocument */ public static void addDocument(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) { int row = table.getRowCount(); final GWTDocument doc = staple.getDoc(); if (doc.isCheckedOut()) { table.setHTML(row, 0, Util.imageItemHTML("img/icon/edit.png")); } else if (doc.isLocked()) { table.setHTML(row, 0, Util.imageItemHTML("img/icon/lock.gif")); } else { table.setHTML(row, 0, " "); } // Subscribed is a special case, must add icon with others if (doc.isSubscribed()) { table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/subscribed.gif")); } if (doc.isHasNotes()) { table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/note.gif")); } table.setHTML(row, 1, Util.mimeImageHTML(doc.getMimeType())); Anchor anchor = new Anchor(); anchor.setHTML(doc.getName()); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { String docPath = doc.getPath(); String path = docPath.substring(0, docPath.lastIndexOf("/")); GeneralComunicator.openPath(path, doc.getPath()); } }); anchor.setStyleName("okm-KeyMap-ImageHover"); table.setWidget(row, 2, anchor); table.setHTML(row, 3, Util.formatSize(doc.getActualVersion().getSize())); if (enableDelete) { Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon()); delete.setStyleName("okm-KeyMap-ImageHover"); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() { @Override public void onSuccess(Object result) { if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) { Stapling.get().refreshFolder(uuid); } else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) { Stapling.get().refreshDocument(uuid); } else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) { Stapling.get().refreshMail(uuid); } } @Override public void onFailure(Throwable caught) { GeneralComunicator.showError("remove", caught); } }); } }); table.setWidget(row, 4, delete); } else { table.setHTML(row, 4, ""); } table.getCellFormatter().setWidth(row, 0, "60px"); table.getCellFormatter().setWidth(row, 1, "25px"); table.getCellFormatter().setWidth(row, 4, "25px"); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER); }
Example 14
Source File: StapleTableManager.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * addFolder */ public static void addFolder(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) { int row = table.getRowCount(); final GWTFolder folder = staple.getFolder(); // Subscribed is a special case, must add icon with others if (folder.isSubscribed()) { table.setHTML(row, 0, Util.imageItemHTML("img/icon/subscribed.gif")); } else { table.setHTML(row, 0, " "); } // Looks if must change icon on parent if now has no childs and properties with user security atention if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) { if (folder.isHasChildren()) { table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_childs.gif")); } else { table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_empty.gif")); } } else { if (folder.isHasChildren()) { table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_childs_ro.gif")); } else { table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_empty_ro.gif")); } } Anchor anchor = new Anchor(); anchor.setHTML(folder.getName()); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { GeneralComunicator.openPath(folder.getPath(), null); } }); anchor.setStyleName("okm-KeyMap-ImageHover"); table.setWidget(row, 2, anchor); table.setHTML(row, 3, " "); if (enableDelete) { Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon()); delete.setStyleName("okm-KeyMap-ImageHover"); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() { @Override public void onSuccess(Object result) { if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) { Stapling.get().refreshFolder(uuid); } else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) { Stapling.get().refreshDocument(uuid); } else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) { Stapling.get().refreshMail(uuid); } } @Override public void onFailure(Throwable caught) { GeneralComunicator.showError("remove", caught); } }); } }); table.setWidget(row, 4, delete); } else { table.setHTML(row, 4, ""); } table.getCellFormatter().setWidth(row, 0, "60px"); table.getCellFormatter().setWidth(row, 1, "25px"); table.getCellFormatter().setWidth(row, 4, "25px"); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER); }
Example 15
Source File: StapleTableManager.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * addMail */ public static void addMail(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) { int row = table.getRowCount(); final GWTMail mail = staple.getMail(); // Mail is never checkout or subscribed ( because can not be changed ) table.setHTML(row, 0, " "); if (mail.getAttachments().size() > 0) { table.setHTML(row, 1, Util.imageItemHTML("img/email_attach.gif")); } else { table.setHTML(row, 1, Util.imageItemHTML("img/email.gif")); } Anchor anchor = new Anchor(); anchor.setHTML(mail.getSubject()); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { String docPath = mail.getPath(); String path = docPath.substring(0, docPath.lastIndexOf("/")); GeneralComunicator.openPath(path, docPath); } }); anchor.setStyleName("okm-KeyMap-ImageHover"); table.setWidget(row, 2, anchor); table.setHTML(row, 3, Util.formatSize(mail.getSize())); if (enableDelete) { Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon()); delete.setStyleName("okm-KeyMap-ImageHover"); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() { @Override public void onSuccess(Object result) { if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) { Stapling.get().refreshFolder(uuid); } else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) { Stapling.get().refreshDocument(uuid); } else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) { Stapling.get().refreshMail(uuid); } } @Override public void onFailure(Throwable caught) { GeneralComunicator.showError("remove", caught); } }); } }); table.setWidget(row, 4, delete); } else { table.setHTML(row, 4, ""); } table.getCellFormatter().setWidth(row, 0, "60px"); table.getCellFormatter().setWidth(row, 1, "25px"); table.getCellFormatter().setWidth(row, 4, "25px"); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER); }
Example 16
Source File: Auth.java From requestor with Apache License 2.0 | 4 votes |
public void addImage(String imageUrl) { final Image img = new Image(imageUrl); img.setStyleName("img-circle"); img.getElement().getStyle().setMarginRight(4, Style.Unit.PX); faces.add(img); }