com.google.gwt.user.client.ui.Image Java Examples

The following examples show how to use com.google.gwt.user.client.ui.Image. 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: Status.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The status
 */
public Status() {
	super(false, true);
	hPanel = new HorizontalPanel();
	image = new Image(OKMBundleResources.INSTANCE.indicator());
	msg = new HTML("");
	space = new HTML("");

	hPanel.add(image);
	hPanel.add(msg);
	hPanel.add(space);

	hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
	hPanel.setCellWidth(image, "30px");
	hPanel.setCellWidth(space, "7px");

	hPanel.setHeight("25px");

	msg.setStyleName("okm-NoWrap");

	super.hide();
	setWidget(hPanel);
}
 
Example #2
Source File: GalleryImage.java    From gwtbootstrap3-extras with Apache License 2.0 6 votes vote down vote up
@Override
public void setHeight(String height) {
    super.setHeight(height);
    image.setHeight(height);

    Scheduler.get().scheduleDeferred(new Command() {
        @Override
        public void execute() {
            for (Widget child : GalleryImage.this) {
                if (child instanceof HasClickHandlers && !(child instanceof Image)) {
                    Style style = child.getElement().getStyle();
                    style.setBottom((double) image.getHeight(), Unit.PX);
                }
            }
        }
    });
}
 
Example #3
Source File: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public IconsCell add(ImageResource resource, final String title, final boolean html) {
	if (resource == null) return this;
	Image icon = new Image(resource);
	String text = title;
	if (html) { HTML h = new HTML(title); text = h.getText(); }
	icon.setTitle(text);
	icon.setAltText(text);
	if (iPanel.getWidgetCount() > 0)
		icon.getElement().getStyle().setMarginLeft(3, Unit.PX);
	iPanel.add(icon);
	iPanel.setCellVerticalAlignment(icon, HasVerticalAlignment.ALIGN_MIDDLE);
	if (title != null && !title.isEmpty()) {
		icon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title, html);
			}
		});
	}
	return this;
}
 
Example #4
Source File: WorkflowManager.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * WorkflowManager
 */
public WorkflowManager() {
	workflowGraph = new Image();
	scrollGraphPanel = new ScrollPanel(workflowGraph);
	toolbar = new TabToolbarWorkflow(this);
	workflowTable = new WorkflowTable(this);
	workflowDetailTable = new WorkflowDetailTable();
	vPanel = new VerticalPanel();
	vPanel.add(toolbar); // Always visible

	toolbar.setHeight("" + TOOLBAR_HEADER + "px");
	toolbar.setWidth("100%");
	vPanel.setCellHeight(toolbar, "" + TOOLBAR_HEADER + "px");

	initWidget(vPanel);
}
 
Example #5
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 #6
Source File: TableImages.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
@Override
public AbstractImagePrototype scrollTableFillWidth() {
	return new AbstractImagePrototype() {
		public void applyTo(Image image) {
			image.setUrl("img/fill_width.gif");
		}

		public Image createImage() {
			return new Image("img/fill_width.gif");
		}

		public String getHTML() {
			return "<img border=\"0\" src=\"img/fill_width.gif\"/>";
		}
	};
}
 
Example #7
Source File: TableImages.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
@Override
public AbstractImagePrototype scrollTableDescending() {
	return new AbstractImagePrototype() {
		public void applyTo(Image image) {
			image.setUrl("img/sort_desc.gif");
		}

		public Image createImage() {
			return new Image("img/sort_desc.gif");
		}

		public String getHTML() {
			return "<img border=\"0\" src=\"img/sort_desc.gif\"/>";
		}
	};
}
 
Example #8
Source File: TimePreferenceCell.java    From unitime with Apache License 2.0 6 votes vote down vote up
@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 #9
Source File: DataStore.java    From djvu-html5 with GNU General Public License v2.0 6 votes vote down vote up
private CanvasElement prepareMissingTileImage() {
	int tileSize = DjvuContext.getTileSize();
	CanvasElement canvas = createImage(tileSize, tileSize);
	Context2d context2d = canvas.getContext2d();
	context2d.setFillStyle("white");
	context2d.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
	Image image = new Image();
	final ImageElement imageElement = image.getElement().cast();
	imageElement.getStyle().setProperty("visibility", "hidden");
	Event.setEventListener(imageElement, event -> {
		if (Event.ONLOAD == event.getTypeInt()) {
			missingTileImage.getContext2d().drawImage(imageElement, 0, 0);
			RootPanel.get().getElement().removeChild(imageElement);
		}
	});
	RootPanel.get().getElement().appendChild(imageElement);
	image.setUrl(getBlankImageUrl());
	return canvas;
}
 
Example #10
Source File: Icon.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new icon with the specified caption.
 *
 * @param image  image shown on icon (preferably 16 x 16px)
 * @param caption  caption shown below image
 */
public Icon(Image image, String caption) {

  panel = new VerticalPanel() {
    @Override
    public void onBrowserEvent(Event event) {
      Icon.this.onBrowserEvent(event);
    }
  };
  panel.add(image);
  panel.setCellHorizontalAlignment(image, VerticalPanel.ALIGN_CENTER);
  captionLabel = new Label(caption);
  panel.add(captionLabel);

  initWidget(panel);

  setStylePrimaryName("ode-Icon");
}
 
Example #11
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 #12
Source File: FuturamaWalking.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * FuturamaWalking
 */
public FuturamaWalking() {
	// Establishes auto-close when click outside
	super(false, false);
	left = -180;
	top = Window.getClientHeight() - 80 - 21;

	vPanel = new VerticalPanel();
	vPanel.setWidth("186px");
	vPanel.setHeight("80px");

	logo = new Image("img/eastereggs/futurama_walking.gif");
	vPanel.add(logo);

	setPopupPosition(left, top);

	hide();
	setWidget(vPanel);
}
 
Example #13
Source File: SVGToolBarImpl.java    From openchemlib-js with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Draw the current ESR image
 *
 * @param ctx
 */
private void drawESRButtons(GraphicsContext ctx) {
  int row = Model.rowFromESRType(model.getESRType());
  int y = (int) (IMAGE_HEIGHT * scale / ROWS * 3);
  int x = (int) (IMAGE_WIDTH * scale / COLS * 1);
  double dx = IMAGE_WIDTH * scale / COLS;
  double dy = IMAGE_HEIGHT * scale / ROWS;

  Image node = null;
  switch (row) {
  case 0:
    break;
  case 1:
    node = BUTTON_ESROR;
    break;
  case 2:
    node = BUTTON_ESRAND;
    break;
  }
  if (node != null) {
    ctx.clearRect(x, y, node.getWidth() * scale, node.getHeight() * scale);
    ctx.drawImage(node, 0, 0, node.getWidth(), node.getHeight(), x, y, node.getWidth() * scale,
        node.getHeight() * scale);
  }

}
 
Example #14
Source File: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text) {
	super(null);
	iIcon = new Image(resource);
	iIcon.setTitle(title);
	iIcon.setAltText(title);
	if (text != null && !text.isEmpty()) {
		iLabel = new HTML(text, false);
		iPanel = new HorizontalPanel();
		iPanel.setStyleName("icon");
		iPanel.add(iIcon);
		iPanel.add(iLabel);
		iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
		iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
	}
	if (title != null && !title.isEmpty()) {
		iIcon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title);
			}
		});
	}
}
 
Example #15
Source File: SuggestPopup.java    From cuba with Apache License 2.0 5 votes vote down vote up
public SuggestPopup() {
	super(true);
	setWidth(WIDTH + "px");
	SuggestionResources resources = GWT.create(SuggestionResources.class);
	loadingImage = new Image(resources.loading());
	setWidget(loadingImage);
}
 
Example #16
Source File: ProposedSubscriptionReceivedUserInfoImage.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #17
Source File: WebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public InstructorCell(ArrayList<String> names, ArrayList<String> emails, String separator) {
	super(null, separator);
	if (names != null && !names.isEmpty()) {
		separator = separator.replace(" ", "&nbsp;");
		for (int i = 0; i < names.size(); i++) {
			String text = names.get(i) + (i + 1 < names.size() ? separator : "");
			String email = (emails != null && i < emails.size() ? emails.get(i) : null);
			if (email != null && !email.isEmpty()) {
				iText += text;
				HorizontalPanel p = new HorizontalPanel();
				p.setStyleName("instructor");
				Anchor a = new Anchor();
				a.setHref("mailto:" + email);
				a.setHTML(new Image(RESOURCES.email()).getElement().getString());
				a.setTitle(MESSAGES.sendEmail(names.get(i)));
				a.setStyleName("unitime-SimpleLink");
				a.addClickHandler(new ClickHandler() {
					public void onClick(ClickEvent event) {
						event.stopPropagation();
					}
				});
				p.add(a);
				p.setCellVerticalAlignment(a, HasVerticalAlignment.ALIGN_MIDDLE);
				HTML h = new HTML(text, false);
				h.getElement().getStyle().setMarginLeft(2, Unit.PX);
				p.add(h);
				iPanel.add(p);
				iContent.add(h);
			} else
				add(text);
		}
	} else {
		add("&nbsp;");
	}
}
 
Example #18
Source File: MaterialInfo.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void showInfo(HTMLPanel panel, ImageResource resource, String message) {
    panel.clear();

    HTMLPanel container = new HTMLPanel("");
    container.addStyleName(CssName.MATERIAL_INFO);
    container.add(new Image(resource));
    container.add(new Label(message));
    panel.add(container);
}
 
Example #19
Source File: ToolBarButton.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public ToolBarButton(Image image, String title, ClickHandler handler) {
	super();
	this.image = image;
	this.image.setTitle(title);
	addClickHandler(handler); // Adding clickhandler to widget

	add(image);
	setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
	setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
	setSize("24", "24");
	setCellHeight(image, "24");
	setCellWidth(image, "24");

	sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS);
}
 
Example #20
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * markProposeAsAccepted
 */
public void markProposeAsAccepted() {
	if (isProposedSubscriptionReceivedSelected()) {
		getProposedSubscriptionReceived().setAccepted(true);
		dataTable.setWidget(getSelectedRow(), 0, new Image(OKMBundleResources.INSTANCE.yes()));
	} else if (isProposedQueryReceivedSelected()) {
		getProposedQueryReceived().setAccepted(true);
		dataTable.setWidget(getSelectedRow(), 0, new Image(OKMBundleResources.INSTANCE.yes()));
	}
}
 
Example #21
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");
}
 
Example #22
Source File: ClientUtils.java    From sc2gears with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a widget which indicates that the logged in user is being checked.
 * @return a widget which indicates that the logged in user is being checked
 */
public static Widget createCheckingUserWidget() {
	final HorizontalPanel panel = new HorizontalPanel();
	panel.setHeight( "20px" );
	
	panel.add( new Image( "/images/loading.gif" ) );
	panel.add( createHorizontalEmptyWidget( 3 ) );
	panel.add( styledWidget( new Label( "Checking user..." ), "note" ) );
	
	return panel;
}
 
Example #23
Source File: Clipboard.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
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 #24
Source File: DownloadButton.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public DownloadButton(List<String> uuidList) {
	if (isRegistered(uuidList)) {
		button = new ToolBarButton(new Image(OKMBundleResources.INSTANCE.downloadDisabled()),
				GeneralComunicator.i18nExtension("download.button.title"), new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (enabled) {
					GeneralComunicator.downloadDocument(false);
				}
			}
		});
	}
}
 
Example #25
Source File: ToolBarBoxForum.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * ToolBarBoxForum
 */
public ToolBarBoxForum() {
	toolBarBoxExtension = new ToolBarBoxExtension(new Image(OKMBundleResources.INSTANCE.forum()), GeneralComunicator.i18nExtension("forum.title")) {
		@Override
		public Widget getWidget() {
			return hPanel;
		}
	};

	hPanel = new Panel();
	forumManager = new ForumManager();
	controller = forumManager.getController();
	// Refresh forums
	if (GeneralComunicator.getWorkspace() == null) {
		timer = new Timer() {
			@Override
			public void run() {
				if (GeneralComunicator.getWorkspace() == null) {
					firstTimeRefreshForum();
				} else {
					controller.refreshForums();
				}
			}
		};
		firstTimeRefreshForum();
	} else {
		controller.refreshForums();
	}
	hPanel.add(forumManager);
}
 
Example #26
Source File: GeoDataImportDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private Widget createUrlToShareAnchor() {
	urlPanel = new HorizontalPanel();
	urlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	urlPanel.setSpacing(1);
	urlToShareAnchor = new AnchorBuilder().build();
	urlPanel.add(urlToShareAnchor);
	Image img = new Image(ImageProvider.INSTANCE.externalLink16());
	urlPanel.add(img);
	urlPanel.setVisible(false);
	return urlPanel;
}
 
Example #27
Source File: ToolBarBoxWiki.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * ToolBarBoxWiki
 */
public ToolBarBoxWiki() {
	toolBarBoxExtension = new ToolBarBoxExtension(new Image(OKMBundleResources.INSTANCE.wiki()), GeneralComunicator.i18nExtension("wiki.title")) {
		@Override
		public Widget getWidget() {
			return hPanel;
		}
	};

	hPanel = new Panel();
	wikiManager = new WikiManager(true);

	// Refresh forums
	if (GeneralComunicator.getWorkspace() == null) {
		timer = new Timer() {
			@Override
			public void run() {
				if (GeneralComunicator.getWorkspace() == null) {
					firstTimeRefreshWiki();
				} else {
					wikiManager.findWikiPageByTitle(TabToolbarWiki.MAIN_PAGE_TITTLE);
				}
			}
		};
		firstTimeRefreshWiki();
	} else {
		wikiManager.findWikiPageByNode(TabToolbarWiki.MAIN_PAGE_TITTLE);
	}

	hPanel.add(wikiManager);
}
 
Example #28
Source File: ImageThumbnailWidget.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Create a double buffer loader for a given image widget
 *
 * @param spinner
 * @param imageToLoad
 */
public DoubleBufferImage(Widget spinner, Widget error, Image imageToLoad) {
  if (UserAgent.isIE()) {
    DomHelper.makeUnselectable(doubleLoadedImage.getElement());
  }
  this.spinner = spinner;
  this.error = error;
  this.imageToLoad = imageToLoad;
}
 
Example #29
Source File: ToolBarButtonExample.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public ToolBarButtonExample() {
	button = new ToolBarButton(new Image(OKMExtensionBundleExampleResources.INSTANCE.box()), title, new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			Window.alert("make some operation");
		}
	});
}
 
Example #30
Source File: Welcome.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private HorizontalPanel getPanel(final HTML data) {
	HorizontalPanel panel = new HorizontalPanel();
	panel.setSize("520px", "310px");
	panel.setSpacing(5);
	panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	Anchor anchor = new AnchorBuilder().setHref("http://www.geowe.org")
			.setImage(new Image(ImageProvider.INSTANCE.geoweSquareLogo()))
			.build();

	panel.add(anchor);
	panel.add(data);
	return panel;
}