本文整理汇总了Java中com.google.gwt.user.client.ui.Image类的典型用法代码示例。如果您正苦于以下问题:Java Image类的具体用法?Java Image怎么用?Java Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Image类属于com.google.gwt.user.client.ui包,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refresh
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
@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);
}
}
}
示例2: SolverStatus
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
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());
}
});
}
});
}
示例3: IconCell
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
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);
}
iIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.stopPropagation();
UniTimeConfirmationDialog.info(title);
}
});
}
示例4: add
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
public IconsCell add(ImageResource resource, final String title) {
if (resource == null) return this;
Image icon = new Image(resource);
icon.setTitle(title);
icon.setAltText(title);
if (iPanel.getWidgetCount() > 0)
icon.getElement().getStyle().setPaddingLeft(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);
}
});
}
return this;
}
示例5: NoteCell
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
public NoteCell(String text, final String title) {
super(null);
if (Window.getClientWidth() <= 800 && title != null && !title.isEmpty()) {
iIcon = new Image(RESOURCES.note());
iIcon.setTitle(title);
iIcon.setAltText(title);
iIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.stopPropagation();
UniTimeConfirmationDialog.info(title);
}
});
} else {
iNote = new P("unitime-Note");
iNote.setHTML(text);
if (title != null) iNote.setTitle(title);
}
}
示例6: PageLabelImpl
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
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);
}
});
}
示例7: ActionBar
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
public ActionBar() {
super();
setWidth(300);
setHeaderVisible(false);
addStyleName(ThemeStyles.get().style().borderBottom());
setPosition(0, 0);
getElement().getStyle().setPosition(Position.ABSOLUTE);
HorizontalPanel horizontalGroup = new HorizontalPanel();
horizontalGroup.add(getMenuButton());
horizontalGroup.add(new SeparatorToolItem());
Image image = new Image(ImageProvider.INSTANCE.menulogoGeowe());
horizontalGroup.add(image);
horizontalGroup.add(new SeparatorToolItem());
horizontalGroup.add(new SeparatorToolItem());
horizontalGroup.add(getGeocodingButton());
setWidget(horizontalGroup);
}
示例8: DropDownButton
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
public DropDownButton(String widgetName, Image icon, List<DropDownItem> toolbarItems,
boolean rightAlign) {
super(icon); // icon for button
this.menu = new ContextMenu();
this.items = new ArrayList<MenuItem>();
this.rightAlign = rightAlign;
for (DropDownItem item : toolbarItems) {
if (item != null) {
addItem(item);
} else {
menu.addSeparator();
}
}
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement()));
}
});
}
示例9: Icon
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
/**
* 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");
}
示例10: addLogo
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
private void addLogo(HorizontalPanel panel) {
// Logo should be a link to App Inv homepage. Currently, after the user
// has logged in, the top level *is* ODE; so for now don't make it a link.
// 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("40px", "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, "50px");
Label title = new Label("MIT App Inventor");
title.setStyleName("ode-LogoText");
VerticalPanel titleContainer = new VerticalPanel();
titleContainer.add(title);
panel.add(titleContainer);
panel.setCellWidth(titleContainer, "180px");
panel.setCellHorizontalAlignment(logo, HorizontalPanel.ALIGN_LEFT);
panel.setCellVerticalAlignment(logo, HorizontalPanel.ALIGN_MIDDLE);
}
示例11: render
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
@Override
public void render(Context context, TemplateInfo template, SafeHtmlBuilder sb) {
if (template == null)
return;
sb.appendHtmlConstant("<table>");
// Add the thumbnail image, if available, or a default image.
sb.appendHtmlConstant("<tr><td rowspan='3'>");
if ( !template.thumbStr.equals("") ) {
String src = hostUrl + TEMPLATES_ROOT_DIRECTORY + template.name + "/" + template.thumbStr;
sb.appendHtmlConstant("<img style='width:32px' src='" + src + "'>");
} else {
ImageResource imgResource = Ode.getImageBundle().appInventorLogo();
Image img = new Image(imgResource);
String url = img.getUrl();
sb.appendHtmlConstant("<img style='width:32px' src='" + url + "'>");
}
sb.appendHtmlConstant("</td>");
// Add the name and description.
sb.appendHtmlConstant("<td style='font-size:95%;'>");
sb.appendEscaped(template.name);
sb.appendHtmlConstant("</td></tr><tr><td>");
sb.appendEscaped(template.subtitle);
sb.appendHtmlConstant("</td></tr></table>");
}
示例12: GalleryAppBox
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
/**
* Creates new Gallery app box.
*/
private GalleryAppBox() {
gContainer = new FlowPanel();
final HorizontalPanel container = new HorizontalPanel();
container.setWidth("100%");
container.setSpacing(0);
container.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
HorizontalPanel panel = new HorizontalPanel();
Image image = new Image();
image.setResource(Ode.getImageBundle().waitingIcon());
panel.add(image);
Label label = new Label();
label.setText(Ode.getMessages().defaultRpcMessage());
panel.add(label);
gContainer.add(panel);
this.add(gContainer);
}
示例13: getBuiltInBlocksTree
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
/**
* Constructs a tree item for built-in blocks.
*
* @return tree item
*/
public TreeItem getBuiltInBlocksTree() {
initBundledImages();
TreeItem builtinNode = new TreeItem(new HTML("<span>" + MESSAGES.builtinBlocksLabel()
+ "</span>"));
for (final String drawerName : BUILTIN_DRAWER_NAMES) {
Image drawerImage = new Image(bundledImages.get(drawerName));
TreeItem itemNode = new TreeItem(new HTML("<span>" + drawerImage
+ getBuiltinDrawerNames(drawerName) + "</span>"));
SourceStructureExplorerItem sourceItem = new BlockSelectorItem() {
@Override
public void onSelected() {
fireBuiltinDrawerSelected(drawerName);
}
};
itemNode.setUserObject(sourceItem);
builtinNode.addItem(itemNode);
}
builtinNode.setState(true);
return builtinNode;
}
示例14: getImageFromPath
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
public static Image getImageFromPath(String iconPath, String packageName, long projectId) {
if (!imagesInitialized) {
initBundledImages();
}
if (iconPath.startsWith("aiwebres/") && packageName != null) {
// icon for extension
Image image = new Image(StorageUtil.getFileUrl(projectId,
"assets/external_comps/" + packageName + "/" + iconPath));
image.setWidth("16px");
image.setHeight("16px");
return image;
}
if (bundledImages.containsKey(iconPath)) {
return new Image(bundledImages.get(iconPath));
} else {
return new Image(iconPath);
}
}
示例15: LASAnnotationsButton
import com.google.gwt.user.client.ui.Image; //导入依赖的package包/类
public LASAnnotationsButton() {
mainPanel.add(layoutPanel);
annotationsButton = new ToggleButton(new Image(GWT.getModuleBaseURL()+"../images/i_off.png"),
new Image(GWT.getModuleBaseURL()+"../images/i_on.png"), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if ( annotationsButton.isDown() ) {
setOpen(true);
annotationsButton.setTitle(DEFAULT_UP_TOOLTIP);
} else {
setOpen(false);
annotationsButton.setTitle(DEFAULT_DOWN_TOOLTIP);
}
}
});
annotationsButton.setTitle(DEFAULT_UP_TOOLTIP);
annotationsButton.setStylePrimaryName("OL_MAP-ToggleButton");
annotationsButton.addStyleDependentName("WIDTH");
initWidget(annotationsButton);
}