Java Code Examples for com.google.gwt.user.client.ui.Image#addStyleName()

The following examples show how to use com.google.gwt.user.client.ui.Image#addStyleName() . 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: SolverPage.java    From unitime with Apache License 2.0 6 votes vote down vote up
public SolverStatus() {
	super("unitime-SolverStatus");
	iStatus = new P("status-label");
	iIcon = new Image(RESOURCES.helpIcon()); iIcon.addStyleName("status-icon");
	iIcon.setVisible(false);
	add(iStatus); add(iIcon);
	RPC.execute(new PageNameRpcRequest("Solver Status"), new AsyncCallback<PageNameInterface>() {
		@Override
		public void onFailure(Throwable caught) {}
		@Override
		public void onSuccess(final PageNameInterface result) {
			iIcon.setTitle(MESSAGES.pageHelp(result.getName()));
			iIcon.setVisible(true);
			iIcon.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					if (result.getHelpUrl() == null || result.getHelpUrl().isEmpty()) return;
					UniTimeFrameDialog.openDialog(MESSAGES.pageHelp(result.getName()), result.getHelpUrl());
				}
			});
		}
	});
}
 
Example 2
Source File: PageLabelImpl.java    From unitime with Apache License 2.0 6 votes vote down vote up
public PageLabelImpl() {
       iName = new P("text");
       
	iHelp = new Image(RESOURCES.help());
	iHelp.addStyleName("icon");
	iHelp.setVisible(false);
	
	add(iName);
	add(iHelp);
	
	iHelp.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (iUrl == null || iUrl.isEmpty()) return;
			UniTimeFrameDialog.openDialog(MESSAGES.pageHelp(getText()), iUrl);
		}
	});
}
 
Example 3
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to update the app image
 * @param url  The URL of the image to show
 * @param container  The container that image widget resides
 */
private void updateAppImage(String url, final Panel container) {
    image = new Image();
    image.addStyleName("app-image");
    image.setUrl(url);
    // if the user has provided a gallery app image, we'll load it. But if not
    // the error will occur and we'll load default image
    image.addErrorHandler(new ErrorHandler() {
      public void onError(ErrorEvent event) {
        image.setResource(GalleryImages.get().genericApp());
      }
    });
    container.add(image);

    if(gallery.getSystemEnvironment() != null &&
        gallery.getSystemEnvironment().toString().equals("Development")){
      final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
        // failure message
        MESSAGES.galleryError()) {
          @Override
          public void onSuccess(String newUrl) {
            if (newUrl != null) {
              image.setUrl(newUrl + "?" + System.currentTimeMillis());
            }
          }
        };
      Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
    }
}
 
Example 4
Source File: ProfilePage.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to update the user's image
 * @param url  The URL of the image to show
 * @param container  The container that image widget resides
 */
private void updateUserImage(final String url, Panel container) {
  userAvatar = new Image();
  //setUrl if the new URL is the same one as it was before; an easy workaround is
  //to make the URL unique so it forces the browser to reload
  userAvatar.setUrl(url + "?" + System.currentTimeMillis());
  userAvatar.addStyleName("app-image");
  if (profileStatus == PRIVATE) {
    //userAvatar.addStyleName("status-updating");
  }
  // if the user has provided a gallery app image, we'll load it. But if not
  // the error will occur and we'll load default image
  userAvatar.addErrorHandler(new ErrorHandler() {
    public void onError(ErrorEvent event) {
      userAvatar.setResource(GalleryImages.get().androidIcon());
    }
  });
  container.add(userAvatar);

  if(gallery.getSystemEnvironment() != null &&
      gallery.getSystemEnvironment().toString().equals("Development")){
    final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(String newUrl) {
          if (userAvatar != null) {
            userAvatar.setUrl(newUrl + "?" + System.currentTimeMillis());
          }
        }
      };
    Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
  }
}
 
Example 5
Source File: CurriculumEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
Check(boolean value, String onMessage, String offMessage) {
	Image image = new Image(value ? RESOURCES.on() : RESOURCES.off());
	image.addStyleName("image");
	add(image);
	InlineHTML text = new InlineHTML(value ? onMessage : offMessage);
	text.addStyleName("message");
	add(text);
	if (value)
		addStyleName("check-enabled");
	else
		addStyleName("check-disabled");
}
 
Example 6
Source File: RoomDetail.java    From unitime with Apache License 2.0 5 votes vote down vote up
Check(boolean value, String onMessage, String offMessage) {
	Image image = new Image(value ? RESOURCES.on() : RESOURCES.off());
	image.addStyleName("image");
	add(image);
	InlineHTML text = new InlineHTML(value ? onMessage : offMessage);
	text.addStyleName("message");
	add(text);
	if (value)
		addStyleName("check-enabled");
	else
		addStyleName("check-disabled");
}