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

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.Image. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: TimePreferenceCell.java   View source code 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 2
Project: unitimes   File: SolverPage.java   View source code 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 3
Project: unitimes   File: WebTable.java   View source code 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);
	}
	iIcon.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			event.stopPropagation();
			UniTimeConfirmationDialog.info(title);
		}
	});
}
 
Example 4
Project: unitimes   File: WebTable.java   View source code 6 votes vote down vote up
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;
}
 
Example 5
Project: unitimes   File: WebTable.java   View source code 6 votes vote down vote up
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);
	}
}
 
Example 6
Project: unitimes   File: PageLabelImpl.java   View source code 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 7
Project: sig-seguimiento-vehiculos   File: ActionBar.java   View source code 6 votes vote down vote up
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);		
}
 
Example 8
Project: appinventor-extensions   File: DropDownButton.java   View source code 6 votes vote down vote up
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()));
    }
  });
}
 
Example 9
Project: appinventor-extensions   File: Icon.java   View source code 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 10
Project: appinventor-extensions   File: TopPanel.java   View source code 6 votes vote down vote up
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);
}
 
Example 11
Project: appinventor-extensions   File: TemplateUploadWizard.java   View source code 6 votes vote down vote up
@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>");
}
 
Example 12
Project: appinventor-extensions   File: GalleryAppBox.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 13
Project: appinventor-extensions   File: BlockSelectorBox.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 14
Project: appinventor-extensions   File: SimpleComponentDescriptor.java   View source code 6 votes vote down vote up
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);
  }
}
 
Example 15
Project: LAS   File: LASAnnotationsButton.java   View source code 6 votes vote down vote up
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);
}
 
Example 16
Project: LAS   File: OutputPanel.java   View source code 6 votes vote down vote up
public void setImage(String image_url, String link_url) {
    final String url = link_url;
    Image image = new Image(image_url);
    image.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            Window.open(url, "_blank", "scrollbars=1");

        }

    });
    image.setTitle("  Click to Enlarge.  Images will size with browser.");
    grid.setWidget(plotRow, 0, image);
}
 
Example 17
Project: LAS   File: LASAnnotationsButtonPanelImpl.java   View source code 6 votes vote down vote up
public LASAnnotationsButtonPanelImpl(String outputPanelID) {
    setName(outputPanelID);
    String moduleBaseURL = GWT.getModuleBaseURL();
    String upImageURL = moduleBaseURL + "../images/i_off.png";
    Image upImage = new Image(upImageURL);
    String downImageURL = moduleBaseURL + "../images/i_on.png";
    Image downImage = new Image(downImageURL);
    button = new ToggleButton(
            upImage,
            downImage);
    button.setTitle("Plot Annotations");
    button.setStylePrimaryName("OL_MAP-ToggleButton");
    button.addStyleDependentName("WIDTH");

    button.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            annotations.setVisible(button.isDown());
        }
    });

    initWidget(button);
}
 
Example 18
Project: LAS   File: IESafeImage.java   View source code 6 votes vote down vote up
/**
 * Returns the original height when using IE.
 * 
 * @see com.google.gwt.user.client.ui.Image#getHeight()
 */
@Override
public int getHeight() {
    int superHeight = super.getHeight();
    logger.log(Level.INFO, "superHeight:" + superHeight);
    logger.log(Level.INFO, "isAttached():" + isAttached());
    if ( (superHeight <= 0) ) {
        // If this is being run under IE the default answer may be 0 when it
        // shouldn't be, so return the height from a hidden and attached
        // temp image
        Image temp = new Image(this.getUrl());
        temp.getElement().getStyle().setVisibility(Visibility.HIDDEN);
        RootPanel.get().add(temp);
        logger.log(Level.WARNING, "temp.isAttached():" + temp.isAttached());
        int tempHeight = temp.getHeight();
        logger.log(Level.WARNING, "tempHeight:" + tempHeight);
        temp.removeFromParent();
        return tempHeight;
    }
    return superHeight;
}
 
Example 19
Project: LAS   File: IESafeImage.java   View source code 6 votes vote down vote up
/**
 * Returns the original width when when using IE.
 * 
 * @see com.google.gwt.user.client.ui.Image#getWidth()
 */
@Override
public int getWidth() {
    int superWidth = super.getWidth();
    logger.log(Level.INFO, "superWidth:" + superWidth);
    logger.log(Level.INFO, "isAttached():" + isAttached());
    if ( (superWidth <= 0) ) {
        // If this is being run under IE the default answer may be 0 when it
        // shouldn't be, so return the height from a hidden and attached
        // temp image
        Image temp = new Image(this.getUrl());
        temp.getElement().getStyle().setVisibility(Visibility.HIDDEN);
        RootPanel.get().add(temp);
        logger.log(Level.WARNING, "temp.isAttached():" + temp.isAttached());
        int tempWidth = temp.getWidth();
        logger.log(Level.WARNING, "tempWidth:" + tempWidth);
        temp.removeFromParent();
        return tempWidth;
    }
    return superWidth;
}
 
Example 20
Project: document-management-system   File: TableImages.java   View source code 6 votes vote down vote up
@Override
public AbstractImagePrototype scrollTableAscending() {
	return new AbstractImagePrototype() {
		public void applyTo(Image image) {
			image.setUrl("img/sort_asc.gif");
		}

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

		public String getHTML() {
			return "<img border=\"0\" src=\"img/sort_asc.gif\"/>";
		}
	};
}
 
Example 21
Project: document-management-system   File: TableImages.java   View source code 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 22
Project: document-management-system   File: TableImages.java   View source code 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 23
Project: document-management-system   File: WorkflowManager.java   View source code 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 24
Project: document-management-system   File: Status.java   View source code 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 25
Project: document-management-system   File: FuturamaWalking.java   View source code 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 26
Project: document-management-system   File: Status.java   View source code 6 votes vote down vote up
/**
 * 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 27
Project: firefly   File: GridCmd.java   View source code 6 votes vote down vote up
@Override
public Image createCmdImage() {

    VisIconCreator ic= VisIconCreator.Creator.getInstance();
    String iStr= this.getIconProperty();
    if (iStr!=null) {

        if (iStr.equals("grid.on.Icon"))  {
            return new Image(ic.getGridOn());
        }
        else if (iStr.equals("grid.off.Icon"))  {
            return new Image(ic.getGridOff());
        }
        else if (iStr.equals("grid.Icon"))  {
            return new Image(ic.getGridOff());
        }
    }
    return null;
}
 
Example 28
Project: sweng15   File: GWTModuleLoader.java   View source code 6 votes vote down vote up
/**
 * Create main VerticalPanel, add it to the RootPanel and display a loading message
 */
private void buildLoadScreen() {
	// Create new main vertical panel to which all other GUI panels shall be added
	mainVerPanel = new VerticalPanel();

	// Add header image
	Image image = new Image();
	image.setUrl("/images/header.png");
	mainVerPanel.add(image);

	// Add loading label
	Label loadingLabel = new Label("Loading Application. Please wait...");
	mainVerPanel.add(loadingLabel);

	// Vertical Panel Settings
	mainVerPanel.setSpacing(25);

	// Insert the main vertical panel into a scroll panel to allow for scrolling
	ScrollPanel sp = new ScrollPanel();
	sp.add(mainVerPanel);

	// Add main vertical panel inside scroll panel to root panel
	RootPanel.get().add(sp);
}
 
Example 29
Project: blogwt   File: GalleryPart.java   View source code 6 votes vote down vote up
/**
 * @param line
 */
public void addImageWithLine (String line) {
	if (line.length() > 0) {
		ConfigLine config = parseConfigLine(line);

		if (config.url != null && config.url.length() > 0) {
			Image image = new Image(config.url);

			if (config.name != null) {
				image.setTitle(config.name);
				image.setAltText(config.caption);
			}

			((HTMLPanel) this.getWidget()).add(image);

			if (config.caption != null) {
				((HTMLPanel) this.getWidget())
						.add(new HTMLPanel(SafeHtmlUtils.fromTrustedString(
								PostHelper.makeMarkup(config.caption))));
			}
		}
	}
}
 
Example 30
Project: unitime   File: WebTable.java   View source code 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);
	}
	iIcon.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			event.stopPropagation();
			UniTimeConfirmationDialog.info(title);
		}
	});
}
 
Example 31
Project: unitime   File: SolverPage.java   View source code 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 32
Project: ontobrowser   File: CodeListView.java   View source code 6 votes vote down vote up
public CodeListView(EventBus eventBus, OntoBrowserServiceAsync service) {
	super(eventBus,service);
	
	Image emptyListWidget = new Image(ImageResources.INSTANCE.spinner());
	emptyListWidget.setStyleName("float-right");
	list.setEmptyListWidget(emptyListWidget);
	list.setKeyboardPagingPolicy(KeyboardPagingPolicy.CURRENT_PAGE);
	list.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
	list.setSelectionModel(selection);
	selection.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
		public void onSelectionChange(SelectionChangeEvent event) {
			Term selected = selection.getSelectedObject();
			if(selected != null) {
				History.newItem(selected.getReferenceId());
			}
		}
	});
			
	codelistContainer.add(list);
	
	initWidget(codelistContainer);
	addStyleName("padded-border vert-scroll");
	eventBus.addHandler(ViewTermEvent.TYPE, this);
}
 
Example 33
Project: gerrit   File: ProjectInfoScreen.java   View source code 6 votes vote down vote up
private void addWidget(LabeledWidgetsGrid g, Widget w, ConfigParameterInfo param) {
  if (param.description() != null || param.warning() != null) {
    HorizontalPanel p = new HorizontalPanel();
    p.add(new Label(getDisplayName(param)));
    if (param.description() != null) {
      Image infoImg = new Image(Gerrit.RESOURCES.info());
      infoImg.setTitle(param.description());
      p.add(infoImg);
    }
    if (param.warning() != null) {
      Image warningImg = new Image(Gerrit.RESOURCES.warning());
      warningImg.setTitle(param.warning());
      p.add(warningImg);
    }
    p.add(new Label(":"));
    g.add(p, w);
  } else {
    g.add(getDisplayName(param), w);
  }
}
 
Example 34
Project: sandbox-frame   File: ProjectViewImpl.java   View source code 6 votes vote down vote up
@Override
public void setPlatforms(List<Platform> platforms) {
    for (int i=0;i<platforms.size();i++) {
        Platform platform = platforms.get(i);
        Image image = new Image(Utils.getPlatformIcon(platform));
        image.setTitle(Utils.getPlatformText(platform));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getPlatformText(platform));
        platformsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        platformsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        platformsPanel.add(image);
        platformsPanel.setCellWidth(image, "32px");
        platformsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        platformsPanel.add(label);
        if (i < platforms.size()-1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
    }
}
 
Example 35
Project: fullmetalgalaxy   File: MAppPresences.java   View source code 6 votes vote down vote up
@Override
public void onChannelMessage(Object p_message)
{
  // redraw widget according to new presenceRoom
  PresenceRoom newPresenceRoom = (PresenceRoom)p_message;
  m_panel.clear();
  Set<String> pseudoList = new HashSet<String>();
  for( Presence presence : newPresenceRoom )
  {
    if( !pseudoList.contains( presence.getPseudo() ) )
    {
      pseudoList.add( presence.getPseudo() );
      Panel panel = new HorizontalPanel();
      Image image = new Image( presence.getAvatarUrl() );
      image.setPixelSize( 32, 32 );
      image.setAltText( presence.getPseudo() );
      image.setTitle( presence.getPseudo() );
      panel.add( image );
      panel.add( new Label(presence.getPseudo()) );
      m_panel.add( panel );
    }
  }
}
 
Example 36
Project: gerrit   File: ProjectsTable.java   View source code 6 votes vote down vote up
protected void populateState(int row, ProjectInfo k) {
  Image state = new Image();
  switch (k.state()) {
    case HIDDEN:
      state.setResource(Gerrit.RESOURCES.redNot());
      state.setTitle(com.google.gerrit.client.admin.Util.toLongString(k.state()));
      table.setWidget(row, ProjectsTable.C_STATE, state);
      break;
    case READ_ONLY:
      state.setResource(Gerrit.RESOURCES.readOnly());
      state.setTitle(com.google.gerrit.client.admin.Util.toLongString(k.state()));
      table.setWidget(row, ProjectsTable.C_STATE, state);
      break;
    case ACTIVE:
    default:
      // Intentionally left blank, do not show an icon when active.
      break;
  }
}
 
Example 37
Project: sandbox-frame   File: ProjectBundleViewImpl.java   View source code 6 votes vote down vote up
@Override
public void setFeatures(List<Feature> features) {
    for (int i=0;i<features.size();i++) {
        Feature feature = features.get(i);
        Image image = new Image(Utils.getFeatureIcon(feature));
        image.setTitle(Utils.getFeatureText(feature));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getFeatureText(feature));
        featuresPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        featuresPanel.add(image);
        featuresPanel.setCellWidth(image, "32px");
        featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        featuresPanel.add(label);
        if (i < features.size()-1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
        
    }
}
 
Example 38
Project: gerrit   File: ProjectInfoScreen.java   View source code 6 votes vote down vote up
private CheckBox renderCheckBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
  CheckBox checkBox = new CheckBox(getDisplayName(param));
  checkBox.setValue(Boolean.parseBoolean(param.value()));
  HorizontalPanel p = new HorizontalPanel();
  p.add(checkBox);
  if (param.description() != null) {
    Image infoImg = new Image(Gerrit.RESOURCES.info());
    infoImg.setTitle(param.description());
    p.add(infoImg);
  }
  if (param.warning() != null) {
    Image warningImg = new Image(Gerrit.RESOURCES.warning());
    warningImg.setTitle(param.warning());
    p.add(warningImg);
  }
  g.add((String) null, p);
  saveEnabler.listenTo(checkBox);
  return checkBox;
}
 
Example 39
Project: unitime   File: WebTable.java   View source code 6 votes vote down vote up
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;
}
 
Example 40
Project: unitime   File: PageLabelImpl.java   View source code 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);
		}
	});
}