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

The following examples show how to use com.google.gwt.user.client.ui.Image#setTitle() . These examples are extracted from open source projects. 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 Project: unitime   File: WebTable.java    License: 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 2
Source Project: unitime   File: WebTable.java    License: 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 3
/**
 * 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
/**
 * 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
/**
 * 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
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 7
Source Project: unitime   File: InstructorsTable.java    License: Apache License 2.0 5 votes vote down vote up
protected Widget getCell(final InstructorInterface instructor, final InstructorsColumn column, final int idx) {
	switch (column) {
	case ID:
		if (instructor.getExternalId() == null) {
			Image warning = new Image(RESOURCES.warning());
			warning.setTitle(MESSAGES.warnInstructorHasNoExternalId(instructor.getFormattedName()));
			return warning;
		} else {
			return new Label(instructor.getExternalId());
		}
	case NAME:
		return new Label(instructor.getFormattedName());
	case POSITION:
		return new Label(instructor.getPosition() == null ? "" : instructor.getPosition().getLabel());
	case TEACHING_PREF:
		if (instructor.getTeachingPreference() == null) {
			return new Label("");
		} else {
			Label pref = new Label(instructor.getTeachingPreference().getName());
			if (instructor.getTeachingPreference().getColor() != null)
				pref.getElement().getStyle().setColor(instructor.getTeachingPreference().getColor());
			return pref;
		}
	case MAX_LOAD:
		return new Label(instructor.hasMaxLoad() ? NumberFormat.getFormat(CONSTANTS.teachingLoadFormat()).format(instructor.getMaxLoad()) : "");
	case SELECTION:
		return new SelectableCell(instructor);
	case ATTRIBUTES:
		AttributeTypeInterface type = iProperties.getAttributeTypes().get(idx);
		List<AttributeInterface> attributes = instructor.getAttributes(type);
		if (!attributes.isEmpty() && !isColumnVisible(getCellIndex(column) + idx)) {
			setColumnVisible(getCellIndex(column) + idx, true);
		}
		return new AttributesCell(attributes);
	default:
		return null;
	}
}
 
Example 8
Source Project: unitime   File: WebTable.java    License: Apache License 2.0 5 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text, boolean reverse) {
	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");
		if (reverse) {
			iPanel.add(iLabel);
			iPanel.add(iIcon);
			iLabel.getElement().getStyle().setPaddingRight(3, Unit.PX);
			iLabel.setWidth("100%");
			iPanel.setWidth("100%");
			iIcon.getElement().getStyle().setFloat(Float.RIGHT);
		} else {
			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 9
public void open(List<DegreePlanInterface> plans) {
	iTable.clearTable(1);
	int select = -1;
	boolean hasTS = false;
	for (DegreePlanInterface plan: plans) {
		List<Widget> row = new ArrayList<Widget>();
		P p = new P("icons");
		if (plan.isLocked()) {
			Image lock = new Image(RESOURCES.locked());
			lock.setTitle(MESSAGES.hintLockedPlan());
			p.add(lock);
		} else if (plan.isActive()) {
			Image active = new Image(RESOURCES.activePlan());
			active.setTitle(MESSAGES.hintActivePlan());
			p.add(active);
		}
		row.add(p);
		row.add(new Label(plan.getName() == null ? "" : plan.getName()));
		row.add(new Label(plan.getDegree() == null ? "" : plan.getDegree()));
		row.add(new Label(plan.getLastModified() == null ? "" : sModifiedDateFormat.format(plan.getLastModified())));
		row.add(new Label(plan.getModifiedWho() == null ? "" : plan.getModifiedWho()));
		if (plan.getLastModified() != null || plan.getModifiedWho() != null)
			hasTS = true;
		if (plan.getId().equals(iLastSubmit))
			select = iTable.getRowCount();
		else if (select < 0 && plan.isActive())
			select = iTable.getRowCount();
		iTable.addRow(plan, row);
		
	}
	iTable.setColumnVisible(3, hasTS);
	iTable.setColumnVisible(4, hasTS);
	iTable.setSelected(select < 0 ? 1 : select, true);
	center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iFooter.setFocus("select", true);
		}
	});
	updateAriaStatus(true);
}