Java Examples for com.google.gwt.user.client.ui.InlineLabel
The following java examples will help you to understand the usage of com.google.gwt.user.client.ui.InlineLabel. These source code samples are taken from different open source projects.
Example 1
| Project: aokp-gerrit-master File: Gerrit.java View source code |
private static void populateBottomMenu(RootPanel btmmenu, HostPageData hpd) {
String vs = hpd.version;
if (vs == null || vs.isEmpty()) {
vs = "dev";
}
btmmenu.add(new InlineLabel(C.keyHelp()));
btmmenu.add(new InlineLabel(" | "));
btmmenu.add(new InlineHTML(M.poweredBy(vs)));
final String reportBugText = getConfig().getReportBugText();
Anchor a = new Anchor(reportBugText == null ? C.reportBug() : reportBugText, getConfig().getReportBugUrl());
a.setTarget("_blank");
a.setStyleName("");
btmmenu.add(new InlineLabel(" | "));
btmmenu.add(a);
}Example 2
| Project: artificer-master File: NotificationService.java View source code |
/**
* Creates the UI widget for the notification.
* @param notification
*/
private void createNotificationWidget(final Notification notification) {
NotificationWidget widget = this.notificationWidgetFactory.get();
String additionalClass = "growl-dialog-" + notification.getData().getType();
widget.addStyleName(additionalClass);
widget.setNotificationTitle(notification.getData().getTitle());
if (notification.getData().getMessageWidget() != null) {
widget.setNotificationMessage((Widget) notification.getData().getMessageWidget());
} else if (notification.getData().getType() == NotificationType.error) {
FlowPanel errorDetails = new FlowPanel();
if (notification.getData().getMessage() != null) {
errorDetails.add(new InlineLabel(notification.getData().getMessage()));
}
if (notification.getData().getException() != null) {
// TODO handle exceptions - need to create an exception dialog
}
widget.setNotificationMessage(errorDetails);
} else {
widget.setNotificationMessage(notification.getData().getMessage(), notification.getData().getType());
}
widget.getCloseButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
notification.getAliveTimer().cancel();
onNotificationClosed(notification);
}
});
widget.addMouseInHandler(new MouseInEvent.Handler() {
@Override
public void onMouseIn(MouseInEvent event) {
notification.getAliveTimer().cancel();
notification.getAutoCloseAnimation().cancel();
}
});
widget.addMouseOutHandler(new MouseOutEvent.Handler() {
@Override
public void onMouseOut(MouseOutEvent event) {
if (notification.getData().getType() == NotificationType.notification) {
notification.getAliveTimer().schedule(5000);
}
}
});
notification.setWidget(widget);
}Example 3
| Project: cmestemp22-master File: StreamMessageItemRenderer.java View source code |
/**
* Render a message item.
*
* @param msg
* the message item.
*
* @return the rendered item as a FlowPanel.
*/
public Panel render(final ActivityDTO msg) {
if (msg.getDestinationStream().getUniqueIdentifier().equals(msg.getActor().getUniqueIdentifier())) {
showRecipient = ShowRecipient.FOREIGN_ONLY;
} else {
showRecipient = showRecipientInStream;
}
Panel mainPanel = new FlowPanel();
mainPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamMessageItem());
mainPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().listItem());
mainPanel.addStyleName(state.toString());
VerbRenderer verbRenderer = verbDictionary.get(msg.getVerb());
verbRenderer.setup(objectDictionary, msg, state, showRecipient);
boolean doManageFlagged = showManageFlagged && !state.equals(State.READONLY) && msg.isDeletable();
// left column items
Panel leftColumn = null;
if (doManageFlagged) {
leftColumn = new FlowPanel();
leftColumn.addStyleName(StaticResourceBundle.INSTANCE.coreCss().leftColumn());
mainPanel.add(leftColumn);
}
// avatar
Widget avatar = verbRenderer.getAvatar();
if (avatar != null) {
Panel parent = leftColumn == null ? mainPanel : leftColumn;
parent.add(avatar);
}
if (doManageFlagged) {
leftColumn.add(buildManageFlaggedControls(msg, mainPanel));
}
FlowPanel msgContent = new FlowPanel();
msgContent.addStyleName(StaticResourceBundle.INSTANCE.coreCss().description());
mainPanel.add(msgContent);
CommentsListPanel commentsPanel = null;
if (!state.equals(State.READONLY)) {
commentsPanel = new CommentsListPanel(msg.getFirstComment(), msg.getLastComment(), msg.getCommentCount(), msg.getEntityId(), msg.isCommentable(), msg.getDestinationStream().getType(), msg.getDestinationStream().getUniqueIdentifier(), activityLinkBuilder);
}
// row for who posted
Panel sourceMetaData = new FlowPanel();
sourceMetaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageMetadataSource());
for (StatefulRenderer itemRenderer : verbRenderer.getSourceMetaDataItemRenderers()) {
Widget metaDataItem = itemRenderer.render();
if (metaDataItem != null) {
sourceMetaData.add(metaDataItem);
}
}
msgContent.add(sourceMetaData);
// content
FlowPanel nonMetaData = new FlowPanel();
nonMetaData.addStyleName(state.toString());
Widget content = verbRenderer.getContent();
if (content != null) {
nonMetaData.add(content);
msgContent.add(nonMetaData);
}
// additional metadata
FlowPanel metaData = new FlowPanel();
metaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageMetadataAdditional());
for (StatefulRenderer itemRenderer : verbRenderer.getMetaDataItemRenderers()) {
Widget metaDataItem = itemRenderer.render();
if (metaDataItem != null) {
metaData.add(metaDataItem);
}
}
if (metaData.getWidgetCount() > 0) {
msgContent.add(metaData);
}
// timestamp and actions
Panel timestampActions = new FlowPanel();
timestampActions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageTimestampActionsArea());
String date = new DateFormatter(new Date()).timeAgo(msg.getPostedTime());
Widget dateLink;
if (createPermalink) {
String permalinkUrl = activityLinkBuilder.buildActivityPermalink(msg.getId(), msg.getDestinationStream().getType(), msg.getDestinationStream().getUniqueIdentifier());
dateLink = new InlineHyperlink(date, permalinkUrl);
} else {
dateLink = new InlineLabel(date);
}
dateLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageTimestampLink());
timestampActions.add(dateLink);
if (msg.getAppName() != null) {
String appSource = msg.getAppSource();
if (appSource != null) {
FlowPanel viaPanel = new FlowPanel();
viaPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().viaMetadata());
viaPanel.add(new InlineLabel("via "));
viaPanel.add(new Anchor(msg.getAppName(), appSource));
timestampActions.add(viaPanel);
} else {
InlineLabel viaLine = new InlineLabel("via " + msg.getAppName());
viaLine.addStyleName(StaticResourceBundle.INSTANCE.coreCss().viaMetadata());
timestampActions.add(viaLine);
}
// TODO: If appSource is not supplied, the link should go to the respective galleries for apps and plugins.
// However, the app galery requires knowing the start page tab id, and the worthwhile plugin gallery is only
// available to coordinators.
}
if (verbRenderer.getAllowLike()) {
LikeCountWidget likeCount = new LikeCountWidget(msg.getEntityId(), msg.getLikeCount(), msg.getLikers(), msg.isLiked());
timestampActions.add(likeCount);
}
timestampActions.add(buildActions(msg, mainPanel, commentsPanel, verbRenderer));
msgContent.add(timestampActions);
// comments
if (commentsPanel != null) {
mainPanel.add(commentsPanel);
if (msg.getComments() != null && !msg.getComments().isEmpty()) {
commentsPanel.renderAllComments(msg.getComments());
}
if (showComment) {
commentsPanel.activatePostComment();
}
}
return mainPanel;
}Example 4
| Project: dtgov-master File: NotificationService.java View source code |
/**
* Creates the UI widget for the notification.
*
* @param notification
*/
private void createNotificationWidget(final Notification notification) {
NotificationWidget widget = this.notificationWidgetFactory.get();
//$NON-NLS-1$
String additionalClass = "growl-dialog-" + notification.getData().getType();
widget.addStyleName(additionalClass);
widget.setNotificationTitle(notification.getData().getTitle());
if (notification.getData().getMessageWidget() != null) {
widget.setNotificationMessage((Widget) notification.getData().getMessageWidget());
} else if (notification.getData().getType() == NotificationType.error) {
FlowPanel errorDetails = new FlowPanel();
if (notification.getData().getMessage() != null) {
errorDetails.add(new InlineLabel(notification.getData().getMessage()));
}
if (notification.getData().getException() != null) {
// TODO handle exceptions - need to create an exception dialog
}
widget.setNotificationMessage(errorDetails);
} else {
widget.setNotificationMessage(notification.getData().getMessage(), notification.getData().getType());
}
widget.getCloseButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
notification.getAliveTimer().cancel();
onNotificationClosed(notification);
}
});
widget.addMouseInHandler(new org.overlord.dtgov.ui.client.local.events.MouseInEvent.Handler() {
@Override
public void onMouseIn(MouseInEvent event) {
notification.getAliveTimer().cancel();
notification.getAutoCloseAnimation().cancel();
}
});
widget.addMouseOutHandler(new org.overlord.dtgov.ui.client.local.events.MouseOutEvent.Handler() {
@Override
public void onMouseOut(MouseOutEvent event) {
if (notification.getData().getType() == NotificationType.notification) {
notification.getAliveTimer().schedule(5000);
}
}
});
notification.setWidget(widget);
}Example 5
| Project: eurekastreams-master File: StreamDetailsComposite.java View source code |
public void update(final GotStreamPopularHashTagsEvent event) {
// Note: using widgets since IE will lose all history when navigating using a simple anchor
streamHashtags.clear();
boolean empty = true;
for (String tag : event.getPopularHashTags()) {
if (empty) {
empty = false;
} else {
streamHashtags.add(new InlineLabel(" "));
}
streamHashtags.add(new InlineHyperlink(tag, streamSearchLinkBuilder.buildHashtagSearchLink(tag, null).substring(1)));
}
if (empty) {
streamHashtags.add(new InlineLabel("No popular hashtags."));
streamHashtags.addStyleName(style.emptyDetailStyle());
} else {
streamHashtags.removeStyleName(style.emptyDetailStyle());
}
}Example 6
| Project: gerrit-master File: Gerrit.java View source code |
private static void populateBottomMenu(RootPanel btmmenu, HostPageData hpd) {
String vs = hpd.version;
if (vs == null || vs.isEmpty()) {
vs = "dev";
}
btmmenu.add(new InlineHTML(M.poweredBy(vs)));
if (info().gerrit().webUis().contains(UiType.POLYGERRIT)) {
btmmenu.add(new InlineLabel(" | "));
uiSwitcherLink = new Anchor(C.newUi(), getUiSwitcherUrl(History.getToken()));
uiSwitcherLink.setStyleName("");
btmmenu.add(uiSwitcherLink);
}
String reportBugUrl = info().gerrit().reportBugUrl();
if (reportBugUrl != null) {
String reportBugText = info().gerrit().reportBugText();
Anchor a = new Anchor(reportBugText == null ? C.reportBug() : reportBugText, reportBugUrl);
a.setTarget("_blank");
a.setStyleName("");
btmmenu.add(new InlineLabel(" | "));
btmmenu.add(a);
}
btmmenu.add(new InlineLabel(" | "));
btmmenu.add(new InlineLabel(C.keyHelp()));
}Example 7
| Project: gwt-mvp-master File: MenuDisplay.java View source code |
private void initHeader() {
headerPanel = new FlowPanel();
menuPanel.add(headerPanel);
headerPanel.addStyleName("header");
headerPanel.addStyleName("container_16");
logoArea = new FlowPanel();
headerPanel.add(logoArea);
logoArea.addStyleName("logo");
logoArea.addStyleName("grid_8");
inlineLabel = new InlineLabel("MVP && widgets showcase");
logoArea.add(inlineLabel);
FlowPanel wrap = new FlowPanel();
headerPanel.add(wrap);
wrap.addStyleName("grid_8");
}Example 8
| Project: bonita-web-master File: LabelWidget.java View source code |
private InlineLabel createMandatorySymbol(String mandatoryFieldSymbol, String mandatoryFieldClasses) { InlineLabel mandatoryWidget = new InlineLabel(); if (mandatoryFieldSymbol == null || mandatoryFieldSymbol.equals("#defaultMandatoryFieldSymbol")) { mandatoryFieldSymbol = FormsResourceBundle.getMessages().defaultMandatoryFieldSymbol(); } mandatoryWidget.setText(mandatoryFieldSymbol); mandatoryWidget.setStyleName("bonita_form_mandatory"); if (mandatoryFieldClasses != null && mandatoryFieldClasses.length() > 0) { mandatoryWidget.addStyleName(mandatoryFieldClasses); } return mandatoryWidget; }
Example 9
| Project: geomajas-project-client-gwt2-master File: CloseableDialogExample.java View source code |
@Override
public void onMouseDown(MouseDownEvent mouseDownEvent) {
final CloseableDialogBoxWidget widget = new CloseableDialogBoxWidget();
VerticalPanel panel = new VerticalPanel();
panel.setWidth("100%");
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
HorizontalPanel top = new HorizontalPanel();
top.setSpacing(10);
InlineLabel labelTop = new InlineLabel(msg.closeableDialogBoxExampleLabel());
top.add(labelTop);
HorizontalPanel middle = new HorizontalPanel();
middle.setSpacing(10);
final Button middleButton = new Button(msg.closeableDialogBoxExampleButton());
middle.add(middleButton);
HorizontalPanel bottom = new HorizontalPanel();
bottom.setSpacing(10);
final InlineLabel bottomlabel = new InlineLabel(msg.loremIpsum());
bottom.add(bottomlabel);
middleButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (clicked < 3) {
bottomlabel.setText(bottomlabel.getText() + bottomlabel.getText());
layerEventLayout.add(new Label(msg.closeableDialogBoxExampleButtonMessage()));
scrollPanel.scrollToBottom();
clicked++;
if (clicked == 3) {
middleButton.setText(msg.closeableDialogBoxExampleButtonClear());
}
} else {
layerEventLayout.add(new Label(msg.closeableDialogBoxExampleButtonClearMessage()));
scrollPanel.scrollToBottom();
middleButton.setText(msg.closeableDialogBoxExampleButton());
bottomlabel.setText(msg.loremIpsum());
clicked = 0;
}
}
});
panel.add(top);
panel.add(middle);
panel.add(bottom);
widget.addContent(panel);
widget.setGlassEnabled(true);
widget.setModal(true);
widget.setTitle(msg.closeableDialogTitle());
widget.setSize(380, 150);
widget.center();
widget.show();
widget.setOnCloseHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
layerEventLayout.add(new Label(msg.closeableDialogBoxHandlerMessage()));
scrollPanel.scrollToBottom();
}
});
}Example 10
| Project: kie-wb-common-master File: NavigatorBreadcrumbs.java View source code |
public void build(final List<FolderItem> segments, final FolderItem file, final ParameterizedCommand<FolderItem> onPathClick, final CustomDropdown... headers) {
build(headers);
if (segments != null) {
for (final FolderItem activeItem : segments) {
breadcrumbs.add(new AnchorListItem(activeItem.getFileName()) {
{
setStyleName(ProjectExplorerResources.INSTANCE.CSS().directory());
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onPathClick.execute(activeItem);
}
});
}
});
}
if (file != null) {
breadcrumbs.add(new ListItem() {
{
add(makeLabel(file.getFileName()));
setStyleName(ProjectExplorerResources.INSTANCE.CSS().directory());
}
InlineLabel makeLabel(final String text) {
final InlineLabel il = GWT.create(InlineLabel.class);
il.setText(text);
return il;
}
});
}
}
}Example 11
| Project: rtgov-master File: NotificationService.java View source code |
/**
* Creates the UI widget for the notification.
* @param notification
*/
private void createNotificationWidget(final Notification notification) {
NotificationWidget widget = this.notificationWidgetFactory.get();
//$NON-NLS-1$
String additionalClass = "growl-dialog-" + notification.getData().getType();
widget.addStyleName(additionalClass);
widget.setNotificationTitle(notification.getData().getTitle());
if (notification.getData().getMessageWidget() != null) {
widget.setNotificationMessage((Widget) notification.getData().getMessageWidget());
} else if (notification.getData().getType() == NotificationType.error) {
FlowPanel errorDetails = new FlowPanel();
if (notification.getData().getMessage() != null) {
errorDetails.add(new InlineLabel(notification.getData().getMessage()));
}
if (notification.getData().getException() != null) {
// TODO handle exceptions - need to create an exception dialog
}
widget.setNotificationMessage(errorDetails);
} else {
widget.setNotificationMessage(notification.getData().getMessage(), notification.getData().getType());
}
widget.getCloseButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
notification.getAliveTimer().cancel();
onNotificationClosed(notification);
}
});
widget.addMouseInHandler(new org.overlord.rtgov.ui.client.local.events.MouseInEvent.Handler() {
@Override
public void onMouseIn(MouseInEvent event) {
notification.getAliveTimer().cancel();
notification.getAutoCloseAnimation().cancel();
}
});
widget.addMouseOutHandler(new org.overlord.rtgov.ui.client.local.events.MouseOutEvent.Handler() {
@Override
public void onMouseOut(MouseOutEvent event) {
if (notification.getData().getType() == NotificationType.notification) {
notification.getAliveTimer().schedule(5000);
}
}
});
notification.setWidget(widget);
}Example 12
| Project: sigmah-master File: CalendarWidget.java View source code |
/**
* Display the events for the cell located at <code>column</code>, <code>row</code>
*
* @param row
* @param column
* @param date
* @param currentMonth
*/
private void drawEvents(int row, int column, final Date date) {
final FlexTable grid = (FlexTable) getWidget();
// final VerticalPanel cell = (VerticalPanel) grid.getWidget(row,
// column);
final FlowPanel cell = (FlowPanel) grid.getWidget(row, column);
if (cell == null)
throw new NullPointerException("The specified cell (" + row + ',' + column + ") doesn't exist.");
// Displaying events
final TreeSet<Event> sortedEvents = new TreeSet<Event>(new Comparator<Event>() {
@Override
public int compare(Event o1, Event o2) {
int compare = 0;
if (o1 == null && o2 == null)
return 0;
else if (o2 == null)
return 1;
else if (o1 == null)
return -1;
if (compare == 0 && o1.getDtstart() != null && o2.getDtstart() != null) {
long o1Start = o1.getDtstart().getTime();
long o2Start = o2.getDtstart().getTime();
if (o1Start < o2Start)
compare = -1;
else if (o1Start > o2Start)
compare = 1;
}
if (compare == 0 && o1.getSummary() != null && o2.getSummary() != null)
compare = o1.getSummary().compareTo(o2.getSummary());
return compare;
}
});
for (final Calendar calendar : calendars) {
final Map<Date, List<Event>> eventMap = normalize(calendar);
final List<Event> events = eventMap.get(date);
if (events != null) {
sortedEvents.addAll(events);
}
}
final Iterator<Event> iterator = sortedEvents.iterator();
for (int i = 0; iterator.hasNext() && i < eventLimit; i++) {
final Event event = iterator.next();
final ClickableFlowPanel flowPanel = new ClickableFlowPanel();
flowPanel.addStyleName("calendar-event");
boolean fullDayEvent = false;
final StringBuilder eventDate = new StringBuilder();
eventDate.append(hourFormatter.format(event.getDtstart()));
if (event.getDtend() != null) {
eventDate.append(" ");
eventDate.append(hourFormatter.format(event.getDtend()));
if (event.getDtstart().getDate() != event.getDtend().getDate() || event.getDtstart().getMonth() != event.getDtend().getMonth() || event.getDtstart().getYear() != event.getDtend().getYear()) {
fullDayEvent = true;
flowPanel.addStyleName("calendar-fullday-event");
}
}
final InlineLabel dateLabel = new InlineLabel(eventDate.toString());
dateLabel.addStyleName("calendar-event-date");
final InlineLabel eventLabel = new InlineLabel(event.getSummary());
eventLabel.addStyleName("calendar-event-label");
if (fullDayEvent)
flowPanel.addStyleName("calendar-fullday-event-" + event.getParent().getStyle());
else
eventLabel.addStyleName("calendar-event-" + event.getParent().getStyle());
if (!fullDayEvent)
flowPanel.add(dateLabel);
flowPanel.add(eventLabel);
final DecoratedPopupPanel detailPopup = new DecoratedPopupPanel(true);
final Grid popupContent = new Grid(event.getParent().isEditable() ? 5 : 3, 1);
popupContent.setText(0, 0, event.getSummary());
popupContent.getCellFormatter().addStyleName(0, 0, "calendar-popup-header");
if (!fullDayEvent) {
popupContent.getCellFormatter().addStyleName(1, 0, "calendar-popup-date");
popupContent.getCellFormatter().addStyleName(1, 0, "calendar-event-" + event.getParent().getStyle());
popupContent.setText(1, 0, eventDate.toString());
} else
popupContent.setText(1, 0, "");
if (event.getDescription() != null && !"".equals(event.getDescription())) {
popupContent.getCellFormatter().addStyleName(2, 0, "calendar-popup-description");
popupContent.setText(2, 0, event.getDescription());
} else
popupContent.setText(2, 0, "");
if (event.getParent().isEditable() && ProfileUtils.isGranted(authentication, GlobalPermissionEnum.EDIT_PROJECT_AGENDA)) {
final Anchor editAnchor = new Anchor(I18N.CONSTANTS.calendarEditEvent());
editAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
delegate.edit(event, CalendarWidget.this);
}
});
final Anchor deleteAnchor = new Anchor(I18N.CONSTANTS.calendarDeleteEvent());
deleteAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
delegate.delete(event, CalendarWidget.this);
detailPopup.hide();
}
});
popupContent.setWidget(3, 0, editAnchor);
popupContent.setWidget(4, 0, deleteAnchor);
}
detailPopup.setWidget(popupContent);
flowPanel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final int left = flowPanel.getAbsoluteLeft() - 10;
final int bottom = Window.getClientHeight() - flowPanel.getAbsoluteTop();
detailPopup.setWidth((getCellWidth(CELL_DEFAULT_WIDTH) + 20) + "px");
// Show the popup
detailPopup.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
detailPopup.getElement().getStyle().setPropertyPx("left", left);
detailPopup.getElement().getStyle().setProperty("top", "");
detailPopup.getElement().getStyle().setPropertyPx("bottom", bottom);
}
});
}
});
cell.add(flowPanel);
}
if (eventLimit != UNDEFINED && sortedEvents.size() > eventLimit) {
final Anchor eventLabel = new Anchor("▼");
final Date thisDate = new Date(date.getTime());
eventLabel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
startDate = thisDate;
setDisplayMode(DisplayMode.WEEK);
}
});
eventLabel.addStyleName("calendar-event-limit");
cell.add(eventLabel);
}
}Example 13
| Project: vaadin-chatbox-master File: ChatWidgetLine.java View source code |
private InlineLabel createLabel(String text, String style, final String itemId) { InlineLabel label = new InlineLabel(text); if (!style.isEmpty()) { label.setStylePrimaryName(style); } if (!itemId.isEmpty()) { label.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { parent.clicked(itemId); } }); } return label; }
Example 14
| Project: Hello-Spiffy-PHP-master File: Index.java View source code |
@Override
public void onModuleLoad() {
MainHeader header = new MainHeader();
header.setHeaderTitle("Hello Spiffy PHP!");
MainFooter footer = new MainFooter();
footer.setFooterString("This application is a <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a> application");
FlowPanel panel = new FlowPanel() {
@Override
public void onLoad() {
super.onLoad();
/*
Let's set focus into the text field when the page first loads
*/
m_text.setFocus(true);
}
};
panel.add(m_longMessage);
final InlineLabel label = new InlineLabel("What's your name? ");
label.setHeight("1em");
panel.add(label);
panel.add(m_text);
panel.add(m_submit);
panel.add(m_submitWithError);
m_submit.addClickHandler(this);
m_submitWithError.addClickHandler(this);
m_text.addKeyPressHandler(this);
RootPanel.get("mainContent").add(panel);
}Example 15
| Project: kune-master File: ErrorsDialog.java View source code |
/**
* Creates the dialog lazy.
*/
private void createDialogLazy() {
if (dialog == null) {
dialog = new BasicTopDialog.Builder(ERROR_LOGGER_ID, true, true, i18n.getDirection()).title(i18n.t("Errors info")).autoscroll(true).firstButtonTitle(i18n.t("Ok")).firstButtonId(ERROR_LOGGER_BUTTON_ID).tabIndexStart(1).width("400px").height("400px").build();
dialog.getTitleText().setText(i18n.t("Info about errors"), i18n.getDirection());
final InlineLabel subTitle = new InlineLabel(i18n.t("Please copy/paste this info to report problems"));
dialog.getInnerPanel().add(subTitle);
dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
scroll.setHeight("350px");
// scroll.setAlwaysShowScrollBars(true);
dialog.getFirstBtn().addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
dialog.hide();
}
});
}
}Example 16
| Project: SPIFF-master File: Index.java View source code |
@Override
public void onModuleLoad() {
DOM.getElementById("main").addClassName("landing");
/*
We are setting a custom authentication provider. Custom authentication
providers can override the UI of the login or provide access to totally
new authentication mechanisms. Ours just overrides a string in the
login panel
*/
SampleAuthUtil auth = new SampleAuthUtil();
RESTility.setAuthProvider(auth);
RESTility.setOAuthProvider(auth);
m_header = new SPSampleHeader();
Anchor title = new Anchor(getStrings().mainTitle(), "#");
m_header.addHeaderTitleWidget(title);
title.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.preventDefault();
selectItem(LANDING_NAV_ITEM_ID);
}
});
InlineLabel subtitle = new InlineLabel(getStrings().mainSubtitle());
m_header.addHeaderTitleWidget(subtitle);
subtitle.getElement().setId("mainsubtitle");
m_footer = new MainFooter();
loadFooter();
m_navBar = new MainNavBar();
if (isRunningUnitTests()) {
loadUnitTests();
return;
}
/*
The landing panel
*/
NavItem item = new NavItem(LANDING_NAV_ITEM_ID, getStrings().landing(), getStrings().landing_tt(), generateNavItemURL(LANDING_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new LandingPanel());
/*
The overview panel
*/
item = new NavItem(OVERVIEW_NAV_ITEM_ID, getStrings().overview(), getStrings().overview_tt(), generateNavItemURL(OVERVIEW_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new OverviewPanel());
/*
The Getting started panels
*/
item = new NavItem(GET_STARTED_NAV_ITEM_ID, getStrings().getStarted(), getStrings().getStarted_tt(), generateNavItemURL(GET_STARTED_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new GetStartedPanel());
/*
The samples panels
*/
item = new NavItem(SAMPLES_NAV_ITEM_ID, getStrings().samples(), getStrings().samples_tt(), generateNavItemURL(SAMPLES_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new SamplesPanel());
/*
* Collapsible Features Nav Section
*/
NavSection featureSection = new NavSection("featuresNavSection", getStrings().features());
featureSection.setTitle(getStrings().features_tt());
m_navBar.add(featureSection);
/*
The CSS panel
*/
item = new NavItem(CSS_NAV_ITEM_ID, getStrings().css(), getStrings().css_tt(), generateNavItemURL(CSS_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new CSSPanel());
/*
The date info panel
*/
item = new NavItem(DATES_NAV_ITEM_ID, getStrings().l10n(), getStrings().l10n_tt(), generateNavItemURL(DATES_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new DatePanel());
/*
The rest info panel
*/
item = new NavItem(REST_NAV_ITEM_ID, getStrings().restTitle(), getStrings().restTitle_tt(), generateNavItemURL(REST_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new RESTPanel());
/*
The authentication info panel
*/
item = new NavItem(AUTH_NAV_ITEM_ID, getStrings().auth(), getStrings().auth_tt(), generateNavItemURL(AUTH_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new AuthPanel());
/*
The build info panel
*/
item = new NavItem(SPEED_NAV_ITEM_ID, getStrings().speed(), getStrings().speed_tt(), generateNavItemURL(SPEED_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new BuildPanel());
addSamplePanels();
/*
A separator
*/
m_navBar.add(new NavSeparator(HTMLPanel.createUniqueId()));
addDocPanels();
m_navBar.addListener(this);
m_navBar.setBookmarkable(true);
selectDefaultItem();
RESTility.addLoginListener(this);
addBackToTop();
}Example 17
| Project: spiffyui-master File: Index.java View source code |
@Override
public void onModuleLoad() {
DOM.getElementById("main").addClassName("landing");
/*
We are setting a custom authentication provider. Custom authentication
providers can override the UI of the login or provide access to totally
new authentication mechanisms. Ours just overrides a string in the
login panel
*/
SampleAuthUtil auth = new SampleAuthUtil();
RESTility.setAuthProvider(auth);
RESTility.setOAuthProvider(auth);
m_header = new SPSampleHeader();
Anchor title = new Anchor(getStrings().mainTitle(), "#");
m_header.addHeaderTitleWidget(title);
title.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.preventDefault();
selectItem(LANDING_NAV_ITEM_ID);
}
});
InlineLabel subtitle = new InlineLabel(getStrings().mainSubtitle());
m_header.addHeaderTitleWidget(subtitle);
subtitle.getElement().setId("mainsubtitle");
m_footer = new MainFooter();
loadFooter();
m_navBar = new MainNavBar();
if (isRunningUnitTests()) {
loadUnitTests();
return;
}
/*
The landing panel
*/
NavItem item = new NavItem(LANDING_NAV_ITEM_ID, getStrings().landing(), getStrings().landing_tt(), generateNavItemURL(LANDING_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new LandingPanel());
/*
The overview panel
*/
item = new NavItem(OVERVIEW_NAV_ITEM_ID, getStrings().overview(), getStrings().overview_tt(), generateNavItemURL(OVERVIEW_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new OverviewPanel());
/*
The Getting started panels
*/
item = new NavItem(GET_STARTED_NAV_ITEM_ID, getStrings().getStarted(), getStrings().getStarted_tt(), generateNavItemURL(GET_STARTED_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new GetStartedPanel());
/*
The samples panels
*/
item = new NavItem(SAMPLES_NAV_ITEM_ID, getStrings().samples(), getStrings().samples_tt(), generateNavItemURL(SAMPLES_NAV_ITEM_ID));
m_navBar.add(item);
m_panels.put(item, new SamplesPanel());
/*
* Collapsible Features Nav Section
*/
NavSection featureSection = new NavSection("featuresNavSection", getStrings().features());
featureSection.setTitle(getStrings().features_tt());
m_navBar.add(featureSection);
/*
The CSS panel
*/
item = new NavItem(CSS_NAV_ITEM_ID, getStrings().css(), getStrings().css_tt(), generateNavItemURL(CSS_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new CSSPanel());
/*
The date info panel
*/
item = new NavItem(DATES_NAV_ITEM_ID, getStrings().l10n(), getStrings().l10n_tt(), generateNavItemURL(DATES_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new DatePanel());
/*
The rest info panel
*/
item = new NavItem(REST_NAV_ITEM_ID, getStrings().restTitle(), getStrings().restTitle_tt(), generateNavItemURL(REST_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new RESTPanel());
/*
The authentication info panel
*/
item = new NavItem(AUTH_NAV_ITEM_ID, getStrings().auth(), getStrings().auth_tt(), generateNavItemURL(AUTH_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new AuthPanel());
/*
The build info panel
*/
item = new NavItem(SPEED_NAV_ITEM_ID, getStrings().speed(), getStrings().speed_tt(), generateNavItemURL(SPEED_NAV_ITEM_ID));
featureSection.add(item);
m_panels.put(item, new BuildPanel());
addSamplePanels();
/*
A separator
*/
m_navBar.add(new NavSeparator(HTMLPanel.createUniqueId()));
addDocPanels();
m_navBar.addListener(this);
m_navBar.setBookmarkable(true);
selectDefaultItem();
RESTility.addLoginListener(this);
addBackToTop();
}Example 18
| Project: xwiki-platform-master File: LinkConfigWizardStep.java View source code |
/**
* Helper function to setup the label field in this link form.
*/
private void setUpLabelField() {
Panel labelLabel = new FlowPanel();
labelLabel.setStyleName(INFO_LABEL_STYLE);
labelLabel.add(new InlineLabel(Strings.INSTANCE.linkLabelLabel()));
InlineLabel mandatoryLabel = new InlineLabel(Strings.INSTANCE.mandatory());
mandatoryLabel.addStyleName("xMandatory");
labelLabel.add(mandatoryLabel);
Label helpLabelLabel = new Label(getLabelTextBoxTooltip());
helpLabelLabel.setStyleName(HELP_LABEL_STYLE);
labelErrorLabel.addStyleName(ERROR_LABEL_STYLE);
labelErrorLabel.setVisible(false);
// on enter in the textbox, submit the form
labelTextBox.addKeyPressHandler(this);
labelTextBox.setTitle(getLabelTextBoxTooltip());
display().add(labelLabel);
display().add(helpLabelLabel);
display().add(labelErrorLabel);
display().add(labelTextBox);
}Example 19
| Project: ahome-ace-master File: AceDemo.java View source code |
/**
* This method builds the UI. It creates UI widgets that exercise most/all of the AceEditor methods, so it's a bit of a kitchen sink.
*/
private void buildUI() {
VerticalPanel mainPanel = new VerticalPanel();
mainPanel.setWidth("100%");
mainPanel.add(new Label("Label above!"));
mainPanel.add(editor1);
// Label to display current row/column
rowColLabel = new InlineLabel("");
mainPanel.add(rowColLabel);
// Create some buttons for testing various editor APIs
HorizontalPanel buttonPanel = new HorizontalPanel();
// Add button to insert text at current cursor position
Button insertTextButton = new Button("Insert");
insertTextButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// Window.alert("Cursor at: " + editor1.getCursorPosition());
editor1.insertAtCursor("inserted text!");
}
});
buttonPanel.add(insertTextButton);
// Add check box to enable/disable soft tabs
final CheckBox softTabsBox = new CheckBox("Soft tabs");
// I think soft tabs is the default
softTabsBox.setValue(true);
softTabsBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.setUseSoftTabs(softTabsBox.getValue());
}
});
buttonPanel.add(softTabsBox);
// add text box and button to set tab size
final TextBox tabSizeTextBox = new TextBox();
tabSizeTextBox.setWidth("4em");
Button setTabSizeButton = new Button("Set tab size");
setTabSizeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.setTabSize(Integer.parseInt(tabSizeTextBox.getText()));
}
});
buttonPanel.add(new InlineLabel("Tab size: "));
buttonPanel.add(tabSizeTextBox);
buttonPanel.add(setTabSizeButton);
// add text box and button to go to a given line
final TextBox gotoLineTextBox = new TextBox();
gotoLineTextBox.setWidth("4em");
Button gotoLineButton = new Button("Go to line");
gotoLineButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.gotoLine(Integer.parseInt(gotoLineTextBox.getText()));
}
});
buttonPanel.add(new InlineLabel("Go to line: "));
buttonPanel.add(gotoLineTextBox);
buttonPanel.add(gotoLineButton);
// checkbox to set whether or not horizontal scrollbar is always visible
final CheckBox hScrollBarAlwaysVisibleBox = new CheckBox("H scrollbar: ");
hScrollBarAlwaysVisibleBox.setValue(true);
hScrollBarAlwaysVisibleBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisibleBox.getValue());
}
});
buttonPanel.add(hScrollBarAlwaysVisibleBox);
// checkbox to show/hide gutter
final CheckBox showGutterBox = new CheckBox("Show gutter: ");
showGutterBox.setValue(true);
showGutterBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.setShowGutter(showGutterBox.getValue());
}
});
buttonPanel.add(showGutterBox);
// checkbox to set/unset readonly mode
final CheckBox readOnlyBox = new CheckBox("Read only: ");
readOnlyBox.setValue(false);
readOnlyBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.setReadOnly(readOnlyBox.getValue());
}
});
buttonPanel.add(readOnlyBox);
// checkbox to show/hide print margin
final CheckBox showPrintMarginBox = new CheckBox("Show print margin: ");
showPrintMarginBox.setValue(true);
showPrintMarginBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor1.setShowPrintMargin(showPrintMarginBox.getValue());
}
});
buttonPanel.add(showPrintMarginBox);
mainPanel.add(buttonPanel);
mainPanel.add(editor2);
mainPanel.add(new Label("Label below!"));
RootPanel.get().add(mainPanel);
}Example 20
| Project: android-gps-emulator-master File: GpsEmulator.java View source code |
/**
* Initialize the UI
*/
private void buildUi() {
// Create textboxes and set default hostname and port
_hostname = new TextBox();
_hostname.setText(DEFAULT_HOST);
_hostname.getElement().setPropertyString("placeholder", "hostname");
_port = new TextBox();
_port.setText(String.valueOf(DEFAULT_PORT));
_port.getElement().setPropertyString("placeholder", "port");
// Create button to connect
_button = new Button("Connect");
// Create the info/status label, initially not visible
_info = new InlineLabel();
_info.setVisible(false);
// register the button action
_button.addClickHandler(new ClickHandler() {
public void onClick(final ClickEvent event) {
final String hostname = _hostname.getText();
final int port = Integer.valueOf(_port.getText());
new PortAsyncCallback(hostname, port).execute();
}
});
// Create panel for textbox, button and info label
final FlowPanel div = new FlowPanel();
div.setStylePrimaryName("emulator-controls");
_hostname.setStyleName("emulator-hostname");
_port.setStyleName("emulator-port");
_button.setStyleName("emulator-connect");
_info.setStyleName("emulator-info");
div.add(_hostname);
div.add(_port);
div.add(_button);
div.add(_info);
// Create a map centered on Cawker City, KS USA
final MapOptions opts = MapOptions.newInstance();
final LatLng cawkerCity = LatLng.newInstance(39.509, -98.434);
opts.setCenter(cawkerCity);
opts.setZoom(4);
_map = new MapWidget(opts);
// Register map click handler
_map.addClickHandler(this);
// add the controls before the map so that the div doesn't cover the map
RootLayoutPanel.get().add(div);
RootLayoutPanel.get().add(_map);
}Example 21
| Project: che-master File: ActionPopupButton.java View source code |
/**
* Redraw the icon.
*/
private void renderImage() {
panel.clear();
if (presentation.getImageResource() != null) {
Image image = new Image(presentationFactory.getPresentation(action).getImageResource());
image.setStyleName(toolbarResources.toolbar().popupButtonIcon());
panel.add(image);
} else if (presentation.getSVGResource() != null) {
SVGImage image = new SVGImage(presentation.getSVGResource());
image.getElement().setAttribute("class", toolbarResources.toolbar().popupButtonIcon());
panel.add(image);
} else if (presentation.getHTMLResource() != null) {
FlowPanel icon = new FlowPanel();
icon.setStyleName(toolbarResources.toolbar().iconButtonIcon());
FlowPanel inner = new FlowPanel();
inner.setStyleName(toolbarResources.toolbar().popupButtonIconInner());
inner.getElement().setInnerHTML(presentation.getHTMLResource());
icon.add(inner);
panel.add(inner);
}
InlineLabel caret = new InlineLabel("");
caret.setStyleName(toolbarResources.toolbar().caret());
panel.add(caret);
}Example 22
| Project: DevTools-master File: ActionPopupButton.java View source code |
/**
* Redraw the icon.
*/
private void renderImage() {
panel.clear();
if (presentation.getImageResource() != null) {
Image image = new Image(presentationFactory.getPresentation(action).getImageResource());
image.setStyleName(toolbarResources.toolbar().popupButtonIcon());
panel.add(image);
} else if (presentation.getSVGResource() != null) {
SVGImage image = new SVGImage(presentation.getSVGResource());
image.getElement().setAttribute("class", toolbarResources.toolbar().popupButtonIcon());
panel.add(image);
} else if (presentation.getHTMLResource() != null) {
FlowPanel icon = new FlowPanel();
icon.setStyleName(toolbarResources.toolbar().iconButtonIcon());
FlowPanel inner = new FlowPanel();
inner.setStyleName(toolbarResources.toolbar().popupButtonIconInner());
inner.getElement().setInnerHTML(presentation.getHTMLResource());
icon.add(inner);
panel.add(inner);
}
InlineLabel caret = new InlineLabel("");
caret.setStyleName(toolbarResources.toolbar().caret());
panel.add(caret);
}Example 23
| Project: Fall2010_Practicum_Samsung-master File: Remindme_appengine.java View source code |
public void onData(Object[] data) {
// Process userInfo RPC call results
JSONObject userInfoJson = (JSONObject) data[0];
if (userInfoJson.containsKey(RemindMeProtocol.UserInfo.RET_USER)) {
Remindme_appengine.sUserInfo = (ModelJso.UserInfo) userInfoJson.get(RemindMeProtocol.UserInfo.RET_USER).isObject().getJavaScriptObject();
InlineLabel label = new InlineLabel();
label.getElement().setId("userNameLabel");
label.setText(sUserInfo.getEmail());
loginPanel.add(label);
loginPanel.add(new InlineLabel(" | "));
Anchor anchor = new Anchor("Sign out", userInfoJson.get(RemindMeProtocol.UserInfo.RET_LOGOUT_URL).isString().stringValue());
loginPanel.add(anchor);
} else {
sLoginUrl = userInfoJson.get(RemindMeProtocol.UserInfo.RET_LOGIN_URL).isString().stringValue();
Anchor anchor = new Anchor("Sign in", sLoginUrl);
loginPanel.add(anchor);
}
// Process notesList RPC call results
JSONObject notesListJson = (JSONObject) data[1];
if (notesListJson != null) {
JSONArray notesJson = notesListJson.get(RemindMeProtocol.AlertsList.RET_NOTES).isArray();
for (int i = 0; i < notesJson.size(); i++) {
ModelJso.Alert alert = (ModelJso.Alert) notesJson.get(i).isObject().getJavaScriptObject();
sAlerts.put(alert.getId(), alert);
}
}
callback.run();
}Example 24
| Project: gadget-server-master File: TabLayout.java View source code |
private void addTabTitle(String tabTitle, String tabContentId) {
ListItem li = new ListItem();
li.getElement().setClassName("ui-state-default ui-corner-top");
Anchor anchor = new Anchor();
anchor.setHref("#" + tabContentId);
anchor.setText(tabTitle);
li.add(anchor);
InlineLabel removeBtn = new InlineLabel();
removeBtn.setText("remove");
removeBtn.setStyleName("ui-icon ui-icon-close");
li.add(removeBtn);
tabsBar.add(li);
}Example 25
| Project: geomajas-gwt2-quickstart-application-master File: LayerLegend.java View source code |
/**
* Get a fully build layer legend for a LayersModel.
*
* @param layerPopupPanelContent Original HTMLPanel
* @param layersModel LayersModel of the map
* @return HTMLPanel fully build legend.
*/
private HTMLPanel getLayersLegend(HTMLPanel layerPopupPanelContent, LayersModel layersModel) {
for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) {
HTMLPanel layer = new HTMLPanel("");
CheckBox visible = new CheckBox();
final int finalI = i;
visible.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (mapPresenter.getLayersModel().getLayer(finalI).isMarkedAsVisible()) {
mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(false);
} else {
mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(true);
}
}
});
if (mapPresenter.getLayersModel().getLayer(i).isMarkedAsVisible()) {
visible.setValue(true);
}
InlineLabel layerName = new InlineLabel(mapPresenter.getLayersModel().getLayer(i).getTitle());
layer.add(visible);
layer.add(layerName);
layerPopupPanelContent.add(layer);
////////////////////////////////
// Add legend items
////////////////////////////////
Layer legendLayer = mapPresenter.getLayersModel().getLayer(i);
if (legendLayer instanceof VectorServerLayerImpl) {
VectorServerLayerImpl serverLayer = (VectorServerLayerImpl) legendLayer;
String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
NamedStyleInfo styleInfo = serverLayer.getLayerInfo().getNamedStyleInfo();
String name = serverLayer.getLayerInfo().getNamedStyleInfo().getName();
int x = 0;
for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) {
for (RuleInfo rInfo : sfi.getRuleList()) {
UrlBuilder url = new UrlBuilder(legendUrl);
url.addPath(serverLayer.getServerLayerId());
url.addPath(name);
url.addPath(x + ".png");
x++;
HorizontalPanel layout = new HorizontalPanel();
layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
layout.add(new Image(url.toString()));
Label labelUi = new Label(rInfo.getName());
labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
layout.add(labelUi);
layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX);
layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX);
layerPopupPanelContent.add(layout);
}
}
} else if (legendLayer instanceof RasterServerLayerImpl) {
RasterServerLayerImpl serverLayer = (RasterServerLayerImpl) legendLayer;
String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
UrlBuilder url = new UrlBuilder(legendUrl);
url.addPath(serverLayer.getServerLayerId() + ".png");
HorizontalPanel layout = new HorizontalPanel();
layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
layout.add(new Image(url.toString()));
Label labelUi = new Label("");
labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
layout.add(labelUi);
layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX);
layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX);
layerPopupPanelContent.add(layout);
}
}
return layerPopupPanelContent;
}Example 26
| Project: google-apis-explorer-master File: JsonPrettifier.java View source code |
/**
* Entry point for the formatter.
*
* @param destination Destination GWT object where the results will be placed
* @param jsonString String to format
* @param linkFactory Which links factory should be used when generating links and navigation
* menus.
* @throws JsonFormatException when parsing the Json causes an error
*/
public static void prettify(ApiService service, Panel destination, String jsonString, PrettifierLinkFactory linkFactory) throws JsonFormatException {
// Make sure the user set a style before invoking prettify.
Preconditions.checkState(style != null, "Must call setStyle before using.");
Preconditions.checkNotNull(service);
Preconditions.checkNotNull(destination);
// Don't bother syntax highlighting empty text.
boolean empty = Strings.isNullOrEmpty(jsonString);
destination.setVisible(!empty);
if (empty) {
return;
}
if (!GWT.isScript()) {
// Syntax highlighting is *very* slow in Development Mode (~30s for large
// responses), but very fast when compiled and run as JS (~30ms). For the
// sake of my sanity, syntax highlighting is disabled in Development
destination.add(new InlineLabel(jsonString));
} else {
try {
DynamicJso root = JsonUtils.<DynamicJso>safeEval(jsonString);
Collection<ApiMethod> compatibleMethods = computeCompatibleMethods(root, service);
Widget menuForMethods = createRequestMenu(compatibleMethods, service, root, linkFactory);
JsObjectIterable rootObject = new JsObjectIterable(service, root, 1, linkFactory);
Widget object = formatGroup(rootObject, "", 0, "{", "}", false, menuForMethods);
destination.add(object);
} catch (IllegalArgumentException e) {
throw new JsonFormatException("Invalid json.", e);
}
}
}Example 27
| Project: ide-master File: ProjectExplorerViewImpl.java View source code |
/** {@inheritDoc} */
@Override
public void setProjectHeader(@Nonnull ProjectDescriptor project) {
if (toolBar.getWidgetIndex(projectHeader) < 0) {
toolBar.addSouth(projectHeader, 28);
setToolbarHeight(50);
}
projectHeader.clear();
FlowPanel delimiter = new FlowPanel();
delimiter.setStyleName(resources.partStackCss().idePartStackToolbarSeparator());
projectHeader.add(delimiter);
SVGImage projectVisibilityImage = new SVGImage("private".equals(project.getVisibility()) ? resources.privateProject() : resources.publicProject());
projectVisibilityImage.getElement().setAttribute("class", resources.partStackCss().idePartStackToolbarBottomIcon());
projectHeader.add(projectVisibilityImage);
InlineLabel projectTitle = new InlineLabel(project.getName());
projectHeader.add(projectTitle);
}Example 28
| Project: kramerius-master File: AdvancedTabLayoutPanel.java View source code |
private Widget createCloseTabWidget(final Widget child) {
Label closeHandle = new InlineLabel();
closeHandle.setTitle(I18N.closeTabHandleTooltip());
closeHandle.addStyleName("ui-icon ui-icon-close");
closeHandle.addStyleName(this.style.tabCloseButton());
closeHandle.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
int widgetIndex = delegate.getWidgetIndex(child);
CloseEvent.fire(AdvancedTabLayoutPanel.this, widgetIndex, false);
}
});
return closeHandle;
}Example 29
| Project: Mashery-Client-API-Examples-master File: Examples.java View source code |
@Override
public void onSuccess(final String email) {
final Anchor loginLink = new Anchor();
loginLink.setHref(email == null ? "/examples/login" : "/examples/login?logout=true");
loginLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
String callbackURL = Window.Location.createUrlBuilder().buildString();
StringBuilder buf = new StringBuilder("/examples/login?callbackURL=");
buf.append(URL.encodeQueryString(callbackURL));
if (email != null)
buf.append("&logout=true");
loginLink.setHref(buf.toString());
}
});
if (email == null) {
loginLink.setHTML("Sign in");
} else {
loginLink.setHTML("Sign out");
userPanel.add(new InlineLabel(email));
userPanel.add(new InlineHTML(" | "));
}
userPanel.add(loginLink);
}Example 30
| Project: mini-git-server-master File: PatchSetComplexDisclosurePanel.java View source code |
private void displayDownload() {
final Project.NameKey projectKey = changeDetail.getChange().getProject();
final String projectName = projectKey.get();
final CopyableLabel copyLabel = new CopyableLabel("");
final DownloadCommandPanel commands = new DownloadCommandPanel();
final DownloadUrlPanel urls = new DownloadUrlPanel(commands);
final Set<DownloadScheme> allowedSchemes = Gerrit.getConfig().getDownloadSchemes();
copyLabel.setStyleName(Gerrit.RESOURCES.css().downloadLinkCopyLabel());
if (changeDetail.isAllowsAnonymous() && Gerrit.getConfig().getGitDaemonUrl() != null && allowedSchemes.contains(DownloadScheme.ANON_GIT)) {
StringBuilder r = new StringBuilder();
r.append(Gerrit.getConfig().getGitDaemonUrl());
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.ANON_GIT, Util.M.anonymousDownload("Git"), r.toString()));
}
if (changeDetail.isAllowsAnonymous() && (allowedSchemes.contains(DownloadScheme.ANON_HTTP) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
StringBuilder r = new StringBuilder();
r.append(GWT.getHostPageBaseURL());
r.append("p/");
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.ANON_HTTP, Util.M.anonymousDownload("HTTP"), r.toString()));
}
if (Gerrit.getConfig().getSshdAddress() != null && Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null && Gerrit.getUserAccount().getUserName().length() > 0 && (allowedSchemes.contains(DownloadScheme.SSH) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
String sshAddr = Gerrit.getConfig().getSshdAddress();
final StringBuilder r = new StringBuilder();
r.append("ssh://");
r.append(Gerrit.getUserAccount().getUserName());
r.append("@");
if (sshAddr.startsWith("*:") || "".equals(sshAddr)) {
r.append(Window.Location.getHostName());
}
if (sshAddr.startsWith("*")) {
sshAddr = sshAddr.substring(1);
}
r.append(sshAddr);
r.append("/");
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.SSH, "SSH", r.toString()));
}
if (Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null && Gerrit.getUserAccount().getUserName().length() > 0 && (allowedSchemes.contains(DownloadScheme.HTTP) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
String base = GWT.getHostPageBaseURL();
int p = base.indexOf("://");
int s = base.indexOf('/', p + 3);
if (s < 0) {
s = base.length();
}
String host = base.substring(p + 3, s);
if (host.contains("@")) {
host = host.substring(host.indexOf('@') + 1);
}
final StringBuilder r = new StringBuilder();
r.append(base.substring(0, p + 3));
r.append(Gerrit.getUserAccount().getUserName());
r.append('@');
r.append(host);
r.append(base.substring(s));
r.append("p/");
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.HTTP, "HTTP", r.toString()));
}
if (allowedSchemes.contains(DownloadScheme.REPO_DOWNLOAD)) {
// This site prefers usage of the 'repo' tool, so suggest
// that for easy fetch.
//
final StringBuilder r = new StringBuilder();
r.append("repo download ");
r.append(projectName);
r.append(" ");
r.append(changeDetail.getChange().getChangeId());
r.append("/");
r.append(patchSet.getPatchSetId());
final String cmd = r.toString();
commands.add(new DownloadCommandLink(DownloadCommand.REPO_DOWNLOAD, "repo download") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(false);
copyLabel.setText(cmd);
}
});
}
if (!urls.isEmpty()) {
commands.add(new DownloadCommandLink(DownloadCommand.CHECKOUT, "checkout") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData + " && git checkout FETCH_HEAD");
}
});
commands.add(new DownloadCommandLink(DownloadCommand.PULL, "pull") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git pull " + link.urlData);
}
});
commands.add(new DownloadCommandLink(DownloadCommand.CHERRY_PICK, "cherry-pick") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData + " && git cherry-pick FETCH_HEAD");
}
});
commands.add(new DownloadCommandLink(DownloadCommand.FORMAT_PATCH, "patch") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData + " && git format-patch -1 --stdout FETCH_HEAD");
}
});
}
final FlowPanel fp = new FlowPanel();
if (!commands.isEmpty()) {
final AccountGeneralPreferences pref;
if (Gerrit.isSignedIn()) {
pref = Gerrit.getUserAccount().getGeneralPreferences();
} else {
pref = new AccountGeneralPreferences();
pref.resetToDefaults();
}
commands.select(pref.getDownloadCommand());
urls.select(pref.getDownloadUrl());
FlowPanel p = new FlowPanel();
p.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeader());
p.add(commands);
final InlineLabel glue = new InlineLabel();
glue.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeaderGap());
p.add(glue);
p.add(urls);
fp.add(p);
fp.add(copyLabel);
}
infoTable.setWidget(R_DOWNLOAD, 1, fp);
}Example 31
| Project: popsimple-master File: TextEditToolbarImpl.java View source code |
private void addTitledToolbarItem(String title, Widget widget) {
FlowPanel listBoxWrapper = new FlowPanel();
listBoxWrapper.addStyleName(CanvasResources.INSTANCE.main().canvasToolbarItemWrapper());
InlineLabel titleLabel = new InlineLabel(title);
titleLabel.addStyleName(CanvasResources.INSTANCE.main().canvasToolbarItemTitle());
listBoxWrapper.add(titleLabel);
listBoxWrapper.add(widget);
this.rootPanel.add(listBoxWrapper);
}Example 32
| Project: tools_gerrit-master File: PatchSetComplexDisclosurePanel.java View source code |
private void displayDownload() {
final Project.NameKey projectKey = changeDetail.getChange().getProject();
final String projectName = projectKey.get();
final CopyableLabel copyLabel = new CopyableLabel("");
final DownloadCommandPanel commands = new DownloadCommandPanel();
final DownloadUrlPanel urls = new DownloadUrlPanel(commands);
final Set<DownloadScheme> allowedSchemes = Gerrit.getConfig().getDownloadSchemes();
copyLabel.setStyleName(Gerrit.RESOURCES.css().downloadLinkCopyLabel());
if (changeDetail.isAllowsAnonymous() && Gerrit.getConfig().getGitDaemonUrl() != null && allowedSchemes.contains(DownloadScheme.ANON_GIT)) {
StringBuilder r = new StringBuilder();
r.append(Gerrit.getConfig().getGitDaemonUrl());
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.ANON_GIT, Util.M.anonymousDownload("Git"), r.toString()));
}
if (changeDetail.isAllowsAnonymous() && (allowedSchemes.contains(DownloadScheme.ANON_HTTP) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
StringBuilder r = new StringBuilder();
r.append(GWT.getHostPageBaseURL());
r.append("p/");
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.ANON_HTTP, Util.M.anonymousDownload("HTTP"), r.toString()));
}
if (Gerrit.getConfig().getSshdAddress() != null && Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null && Gerrit.getUserAccount().getUserName().length() > 0 && (allowedSchemes.contains(DownloadScheme.SSH) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
String sshAddr = Gerrit.getConfig().getSshdAddress();
final StringBuilder r = new StringBuilder();
r.append("ssh://");
r.append(Gerrit.getUserAccount().getUserName());
r.append("@");
if (sshAddr.startsWith("*:") || "".equals(sshAddr)) {
r.append(Window.Location.getHostName());
}
if (sshAddr.startsWith("*")) {
sshAddr = sshAddr.substring(1);
}
r.append(sshAddr);
r.append("/");
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.SSH, "SSH", r.toString()));
}
if (Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null && Gerrit.getUserAccount().getUserName().length() > 0 && (allowedSchemes.contains(DownloadScheme.HTTP) || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
String base = GWT.getHostPageBaseURL();
int p = base.indexOf("://");
int s = base.indexOf('/', p + 3);
if (s < 0) {
s = base.length();
}
String host = base.substring(p + 3, s);
if (host.contains("@")) {
host = host.substring(host.indexOf('@') + 1);
}
final StringBuilder r = new StringBuilder();
r.append(base.substring(0, p + 3));
r.append(Gerrit.getUserAccount().getUserName());
r.append('@');
r.append(host);
r.append(base.substring(s));
r.append("p/");
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
urls.add(new DownloadUrlLink(DownloadScheme.HTTP, "HTTP", r.toString()));
}
if (allowedSchemes.contains(DownloadScheme.REPO_DOWNLOAD)) {
// This site prefers usage of the 'repo' tool, so suggest
// that for easy fetch.
//
final StringBuilder r = new StringBuilder();
r.append("repo download ");
r.append(projectName);
r.append(" ");
r.append(changeDetail.getChange().getChangeId());
r.append("/");
r.append(patchSet.getPatchSetId());
final String cmd = r.toString();
commands.add(new DownloadCommandLink(DownloadCommand.REPO_DOWNLOAD, "repo download") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(false);
copyLabel.setText(cmd);
}
});
}
if (!urls.isEmpty()) {
commands.add(new DownloadCommandLink(DownloadCommand.CHECKOUT, "checkout") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData + " && git checkout FETCH_HEAD");
}
});
commands.add(new DownloadCommandLink(DownloadCommand.PULL, "pull") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git pull " + link.urlData);
}
});
commands.add(new DownloadCommandLink(DownloadCommand.CHERRY_PICK, "cherry-pick") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData + " && git cherry-pick FETCH_HEAD");
}
});
commands.add(new DownloadCommandLink(DownloadCommand.FORMAT_PATCH, "patch") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData + " && git format-patch -1 --stdout FETCH_HEAD");
}
});
}
final FlowPanel fp = new FlowPanel();
if (!commands.isEmpty()) {
final AccountGeneralPreferences pref;
if (Gerrit.isSignedIn()) {
pref = Gerrit.getUserAccount().getGeneralPreferences();
} else {
pref = new AccountGeneralPreferences();
pref.resetToDefaults();
}
commands.select(pref.getDownloadCommand());
urls.select(pref.getDownloadUrl());
FlowPanel p = new FlowPanel();
p.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeader());
p.add(commands);
final InlineLabel glue = new InlineLabel();
glue.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeaderGap());
p.add(glue);
p.add(urls);
fp.add(p);
fp.add(copyLabel);
}
infoTable.setWidget(R_DOWNLOAD, 1, fp);
}Example 33
| Project: activityinfo-master File: SiteDialog.java View source code |
private LayoutContainer modernViewAlert() {
Anchor linkToDesign = new Anchor(I18N.CONSTANTS.switchToNewLayout());
linkToDesign.setHref("#");
linkToDesign.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (activity.isDesignAllowed()) {
Map<String, Object> changes = Maps.newHashMap();
changes.put("classicView", Boolean.FALSE);
dispatcher.execute(new UpdateEntity(activity, changes)).then(new SuccessCallback<VoidResult>() {
@Override
public void onSuccess(VoidResult result) {
SiteDialog.this.hide();
resourceLocator.getFormInstance(site.getInstanceId()).then(new SuccessCallback<FormInstance>() {
@Override
public void onSuccess(FormInstance result) {
SiteDialogLauncher.showModernFormDialog(activity.getName(), result, callback, newSite, resourceLocator);
}
});
}
});
} else {
MessageBox.alert(I18N.CONSTANTS.alert(), I18N.CONSTANTS.noDesignPrivileges(), new SelectionListener<MessageBoxEvent>() {
@Override
public void componentSelected(MessageBoxEvent ce) {
}
});
}
}
});
Anchor linkToMore = new Anchor(I18N.CONSTANTS.learnMore());
linkToMore.setHref(NewFormDialog.CLASSIC_VIEW_EXPLANATION_URL);
linkToMore.setTarget("_blank");
ContentPanel panel = new ContentPanel();
panel.setHeaderVisible(false);
panel.setLayout(new FlowLayout());
panel.add(new Label(I18N.CONSTANTS.alertAboutModerView()));
panel.add(linkToDesign);
panel.add(new InlineLabel(I18N.CONSTANTS.orWithSpaces()));
panel.add(linkToMore);
return panel;
}Example 34
| Project: geogebra-master File: AlgebraViewW.java View source code |
/**
*
* @param geo
* element
* @param forceLayer
* override layer stored in Geo
* @return parent node of this geo
*/
protected TreeItem getParentNode(GeoElement geo, int forceLayer) {
TreeItem parent;
switch(treeMode) {
case DEPENDENCY:
if (geo.isAuxiliaryObject()) {
parent = auxiliaryNode;
} else if (geo.isIndependent()) {
parent = indNode;
} else {
parent = depNode;
}
break;
case TYPE:
// get type node
String typeString = geo.getTypeStringForAlgebraView();
parent = typeNodesMap.get(typeString);
// do we have to create the parent node?
if (parent == null) {
String transTypeString = geo.translatedTypeStringForAlgebraView();
parent = new AVTreeItem(new InlineLabel(transTypeString));
setUserObject(parent, transTypeString, typeString);
typeNodesMap.put(typeString, parent);
// find insert pos
int pos = getItemCount();
for (int i = 0; i < pos; i++) {
TreeItem child = getItem(i);
String groupName = getGroupName(child);
if (typeString.compareTo(groupName) < 0 || (child.getWidget() != null && this.inputPanelTreeItem != null && this.inputPanelTreeItem.getWidget() != null && child.getWidget().equals(this.inputPanelTreeItem.getWidget()))) {
pos = i;
break;
}
}
insertItem(pos, parent);
}
break;
case LAYER:
// get type node
int layer = forceLayer > -1 ? forceLayer : geo.getLayer();
parent = layerNodesMap.get(layer);
// do we have to create the parent node?
if (parent == null) {
String layerStr = loc.getPlain("LayerA", layer + "");
parent = new AVTreeItem(new InlineLabel(layerStr));
setUserObject(parent, layerStr, layer + "");
layerNodesMap.put(layer, parent);
// find insert pos
int pos = getItemCount();
for (int i = 0; i < pos; i++) {
TreeItem child = getItem(i);
if (layerStr.compareTo(getGroupName(child)) < 0) {
pos = i;
break;
}
}
insertItem(pos, parent);
}
break;
case ORDER:
parent = rootOrder;
break;
default:
parent = null;
}
return parent;
}Example 35
| Project: opentsdb-master File: QueryUi.java View source code |
@Override
public void onValueChange(final ValueChangeEvent<Boolean> event) {
if (autoreload.getValue()) {
final HorizontalPanel hbox = new HorizontalPanel();
hbox.setWidth("100%");
hbox.add(new InlineLabel("Every:"));
hbox.add(autoreoload_interval);
hbox.add(new InlineLabel("seconds"));
table.setWidget(1, 1, hbox);
if (autoreoload_interval.getValue().isEmpty()) {
autoreoload_interval.setValue("15");
}
autoreoload_interval.setFocus(true);
// Force refreshGraph.
lastgraphuri = "";
// Trigger the 1st auto-reload
refreshGraph();
} else {
table.setWidget(1, 1, end_datebox);
}
}Example 36
| Project: R2Time-master File: QueryUi.java View source code |
@Override
public void onValueChange(final ValueChangeEvent<Boolean> event) {
if (autoreload.getValue()) {
final HorizontalPanel hbox = new HorizontalPanel();
hbox.setWidth("100%");
hbox.add(new InlineLabel("Every:"));
hbox.add(autoreoload_interval);
hbox.add(new InlineLabel("seconds"));
table.setWidget(1, 1, hbox);
if (autoreoload_interval.getValue().isEmpty()) {
autoreoload_interval.setValue("15");
}
autoreoload_interval.setFocus(true);
// Force refreshGraph.
lastgraphuri = "";
// Trigger the 1st auto-reload
refreshGraph();
} else {
table.setWidget(1, 1, end_datebox);
}
}Example 37
| Project: eucalyptus-fork-2.0-master File: ImageWidget.java View source code |
private Widget buildTitlePanel() {
FlowPanel visibleDetailsPanel = new FlowPanel();
visibleDetailsPanel.add(versionPanel);
FlowPanel hiddenDetailsPanel = new FlowPanel();
hiddenDetailsPanel.add(sizePanel);
hiddenDetailsPanel.add(tagsPanel);
InlineLabel versionHeaderLabel = new InlineLabel("Image version:");
InlineLabel sizeHeaderLabel = new InlineLabel("Image size:");
InlineLabel tagsHeaderLabel = new InlineLabel("Image tags:");
versionPanel.add(versionHeaderLabel);
versionPanel.add(versionLabel);
sizePanel.add(sizeHeaderLabel);
sizePanel.add(sizeLabel);
tagsPanel.add(tagsHeaderLabel);
tagsPanel.add(tagsLabel);
VerticalPanel readMorePanel = new VerticalPanel();
readMorePanel.add(hiddenDetailsPanel);
readMorePanel.add(descriptionHtml);
DisclosurePanel readMoreDisclosurePanel = new DisclosurePanel();
readMoreDisclosurePanel.setHeader(readMoreLabel);
readMoreDisclosurePanel.setContent(readMorePanel);
VerticalPanel topPanel = new VerticalPanel();
topPanel.add(titleLabel);
topPanel.add(visibleDetailsPanel);
topPanel.add(summaryLabel);
topPanel.add(readMoreDisclosurePanel);
titleLabel.setStyleName("istore-image-title");
summaryLabel.setStyleName("istore-image-summary");
topPanel.setStyleName("istore-title-panel");
readMoreLabel.setStyleName("istore-read-more-label");
visibleDetailsPanel.setStyleName("istore-visible-image-details-panel");
hiddenDetailsPanel.setStyleName("istore-hidden-image-details-panel");
versionHeaderLabel.setStyleName("istore-image-version-label");
versionHeaderLabel.addStyleName("istore-image-detail-label");
versionLabel.setStyleName("istore-image-version-value-label");
versionLabel.addStyleName("istore-image-detail-value-label");
sizeHeaderLabel.setStyleName("istore-image-size-label");
sizeHeaderLabel.addStyleName("istore-image-detail-label");
sizeLabel.setStyleName("istore-image-size-value-label");
sizeLabel.addStyleName("istore-image-detail-value-label");
tagsHeaderLabel.setStyleName("istore-image-tags-label");
tagsHeaderLabel.addStyleName("istore-image-detail-label");
tagsLabel.setStyleName("istore-image-tags-value-label");
tagsLabel.addStyleName("istore-image-detail-value-label");
descriptionHtml.setStyleName("istore-image-description");
ReadMoreOpenCloseHandler rmoch = this.new ReadMoreOpenCloseHandler();
readMoreDisclosurePanel.addOpenHandler(rmoch);
readMoreDisclosurePanel.addCloseHandler(rmoch);
return topPanel;
}Example 38
| Project: jqm4gwt-master File: JQMForm.java View source code |
/**
* Adds a validator and binds it to the collection of widgets. The widget
* list can be empty.
*
* @param validator the validator that will be invoked
* @param notifiedWidget the widget that will be notified of the error. If null
* then the firing widget will be used.
* @param firingWidgets the list of widgets that will fire the validator
* @param immediate - if true then validator will be called during firingWidgets onBlur() event
* @param positionErrorAfter - optional, if defined then error label will be placed
* right after this widget, otherwise it will be added as the current last one.
*/
public void addValidator(Widget notifiedWidget, Validator validator, boolean immediate, Widget positionErrorAfter, JQMFormWidget... firingWidgets) {
boolean labelAdded = false;
if (firingWidgets != null) {
for (JQMFormWidget w : firingWidgets) {
Label la = w.addErrorLabel();
if (la == null)
continue;
labelAdded = true;
addErrorLabel(validator, la);
}
}
if (!labelAdded) {
// create a label that will show the validation error
Label label = new InlineLabel();
label.setStyleName(JQM4GWT_ERROR_LABEL_STYLENAME);
if (globalValidationErrorStyles != null && !globalValidationErrorStyles.isEmpty()) {
JQMCommon.addStyleNames(label, globalValidationErrorStyles);
}
label.setVisible(false);
addErrorLabel(validator, label);
if (positionErrorAfter == null) {
// add the error label to the document as the next child of this form container
add(label);
} else {
boolean inserted = false;
Widget w = positionErrorAfter;
while (w != null) {
int i = getWidgetIndex(w);
if (i >= 0) {
// next after w
i++;
while (i < getWidgetCount()) {
Widget wi = getWidget(i);
if (wi instanceof Label && JQMCommon.hasStyle(wi, JQM4GWT_ERROR_LABEL_STYLENAME)) {
// next after previous errors
i++;
} else {
break;
}
}
insert(label, i);
inserted = true;
break;
}
w = w.getParent();
}
if (!inserted)
add(label);
}
}
registerValidatorWithFiringWidgets(validator, firingWidgets, immediate);
boolean required = validator instanceof NotNullOrEmptyValidator;
String validatorClass = STYLE_FORM_VALIDATOR + getShortClassName(validator.getClass());
if (notifiedWidget != null) {
notifiedWidgets.put(validator, notifiedWidget);
notifiedWidget.getElement().addClassName(validatorClass);
if (required)
notifiedWidget.getElement().addClassName(STYLE_FORM_REQUIRED);
} else if (firingWidgets != null) {
for (JQMFormWidget w : firingWidgets) {
w.asWidget().getElement().addClassName(validatorClass);
if (required)
w.asWidget().getElement().addClassName(STYLE_FORM_REQUIRED);
}
}
}Example 39
| Project: mimir-master File: UI.java View source code |
protected void initGui() {
HTMLPanel searchDiv = HTMLPanel.wrap(Document.get().getElementById("searchBox"));
TextArea searchTextArea = new TextArea();
searchTextArea.setCharacterWidth(60);
searchTextArea.setVisibleLines(10);
searchBox = new SuggestBox(new MimirOracle(), searchTextArea);
searchBox.setTitle("Press Escape to hide suggestions list; " + "press Ctrl+Space to show it again.");
searchBox.addStyleName("mimirSearchBox");
searchDiv.add(searchBox);
searchButton = new Button();
searchButton.setText("Search");
searchButton.addStyleName("searchButton");
searchDiv.add(searchButton);
HTMLPanel resultsBar = HTMLPanel.wrap(Document.get().getElementById("feedbackBar"));
feedbackLabel = new InlineLabel();
resultsBar.add(feedbackLabel);
resultsBar.add(new InlineHTML(" "));
searchResultsPanel = HTMLPanel.wrap(Document.get().getElementById("searchResults"));
updateResultsDisplay(null);
pageLinksPanel = HTMLPanel.wrap(Document.get().getElementById("pageLinks"));
pageLinksPanel.add(new InlineHTML(" "));
}Example 40
| Project: viaja-facil-master File: Colectivos.java View source code |
private void showResults() {
// evtl. relevant falls es nötig ist das stackPanel zu resizen: http://stackoverflow.com/questions/4334216/stacklayoutpanel-has-no-more-place-to-show-the-children-when-there-are-too-many-h
resultsPanel.setVisible(false);
resultsPanel.clear();
DOM.getElementById("leftcontainer").getStyle().setProperty("display", "none");
boolean gotAResult = false;
int stackPanelTotalHeight = 0;
int biggestContentHeight = 0;
for (SearchResultProxy resultProxy : resultList) {
if (resultProxy.getConnections() != null) {
for (ConnectionProxy connProxy : resultProxy.getConnections()) {
if (connProxy != null) {
gotAResult = true;
int col = 0;
String connection = connProxy.getTime() + CONSTANTS.min() + " " + CONSTANTS.with() + " ";
FlowPanel connectionDetailsPanelnew = new FlowPanel();
;
for (LineProxy l : connProxy.getLines()) {
if (col >= colors.size()) {
col = col % colors.size();
}
if (l.getType() != 0) {
String lineText = l.getLinenum();
if (l.getType() == 1 && connProxy.getLines().size() == 3) {
String[] parts1 = l.getRamal().split("-");
if (parts1.length == 2) {
lineText += " " + parts1[0].substring(0, parts1[0].length() - 1);
}
}
connection += l.getTypeAsString() + " ";
connection += lineText + ", ";
InlineLabel lineNum = new InlineLabel(l.getLinenum() + " ");
connectionDetailsPanelnew.add(lineNum);
lineNum.getElement().setAttribute("style", "color:" + colors.get(col) + ";font-size:120%");
col++;
InlineLabel lineRamal = new InlineLabel(" " + l.getRamal());
lineRamal.getElement().setAttribute("style", "font-size:120%");
connectionDetailsPanelnew.add(lineRamal);
if (l.getAlternativeLines().size() > 0) {
String alternativesText = " (" + CONSTANTS.alternatives() + ": ";
for (String s : l.getAlternativeLines()) {
alternativesText += s + ", ";
}
alternativesText = alternativesText.substring(0, alternativesText.length() - 2);
alternativesText += ")";
InlineLabel alternatives = new InlineLabel(alternativesText);
connectionDetailsPanelnew.add(alternatives);
}
if (l.getStartStreet() != null && l.getDestStreet() != null) {
FlowPanel streets = new FlowPanel();
InlineLabel from = new InlineLabel(CONSTANTS.from() + " ");
streets.add(from);
InlineLabel fromStreet = new InlineLabel(l.getStartStreet());
fromStreet.addStyleName("resultPosLink");
fromStreet.getElement().setPropertyDouble("x_coord", l.getRelevantPoints().get(0));
fromStreet.getElement().setPropertyDouble("y_coord", l.getRelevantPoints().get(1));
fromStreet.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
InlineLabel source = (InlineLabel) event.getSource();
panToAndMark(source.getElement().getPropertyDouble("x_coord"), source.getElement().getPropertyDouble("y_coord"));
}
});
streets.add(fromStreet);
InlineLabel to = new InlineLabel(" " + CONSTANTS.to() + " ");
streets.add(to);
InlineLabel toStreet = new InlineLabel(l.getDestStreet());
toStreet.addStyleName("resultPosLink");
toStreet.getElement().setPropertyDouble("x_coord", l.getRelevantPoints().get(l.getRelevantPoints().size() - 2));
toStreet.getElement().setPropertyDouble("y_coord", l.getRelevantPoints().get(l.getRelevantPoints().size() - 1));
toStreet.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
InlineLabel source = (InlineLabel) event.getSource();
panToAndMark(source.getElement().getPropertyDouble("x_coord"), source.getElement().getPropertyDouble("y_coord"));
}
});
streets.add(toStreet);
connectionDetailsPanelnew.add(streets);
}
}
}
connection = connection.substring(0, connection.length() - 2);
Label lConnTemp = new Label(connection);
Label lConn = new Label(connection);
lConnTemp.setStyleName("gwt-StackLayoutPanelHeader");
lConnTemp.setWidth(resultsWidth + "px");
dummyPanel.add(lConnTemp);
int heightHeader = lConnTemp.getElement().getOffsetHeight();
dummyPanel.remove(lConnTemp);
connectionDetailsPanelnew.setStyleName("gwt-StackLayoutPanelContent");
connectionDetailsPanelnew.setWidth(resultsWidth + "px");
dummyPanel.add(connectionDetailsPanelnew);
int heightContent = connectionDetailsPanelnew.getElement().getOffsetHeight() + 5;
// GWT.log("eleD: " +lConnDetailsTemp.getElement().getOffsetHeight() + ", widgetD: " + lConnDetailsTemp.getOffsetHeight());
dummyPanel.remove(connectionDetailsPanelnew);
resultsPanel.add(connectionDetailsPanelnew, lConn, heightHeader);
stackPanelTotalHeight += heightHeader;
if (heightContent > biggestContentHeight) {
biggestContentHeight = heightContent;
}
/*GWT.log(connection);
GWT.log(connectionDetails);*/
}
}
}
}
stackPanelTotalHeight += biggestContentHeight + 5;
// GWT.log("Total height: " + stackPanelTotalHeight);
resultsPanel.setHeight(stackPanelTotalHeight + "px");
/*int spacerheight = 120 + stackPanelTotalHeight;
if(spacerheight > 120 + scrollPanel.getOffsetHeight()) {
spacerheight = 120 + scrollPanel.getOffsetHeight();
}
DOM.getElementById("topspacer").getStyle().setProperty("height", spacerheight + "px");*/
resultsPanel.setVisible(true);
if (gotAResult) {
drawConnection(0);
}
}Example 41
| Project: errai-master File: I18nNestedComponent.java View source code |
public InlineLabel getNestedLabel() {
return nestedLabel;
}Example 42
| Project: gae-studio-master File: EntityEditorView.java View source code |
@Override
public void setHeader(String text) {
InlineLabel headerLabel = new InlineLabel(text);
panel.add(headerLabel);
}Example 43
| Project: listmaker-master File: FormBuilder.java View source code |
private LabelWidget createLabel(String forId, String label) {
LabelWidget labelWidget = new LabelWidget();
labelWidget.add(new InlineLabel(label));
labelWidget.setHtmlFor(forId);
return labelWidget;
}Example 44
| Project: rstudio-master File: RmdNullableOption.java View source code |
protected Widget getOptionLabelWidget() {
if (nonNullCheck_ != null)
return nonNullCheck_;
else
return new InlineLabel(getOption().getUiName() + ": ");
}Example 45
| Project: GWTP-Samples-master File: BreadcrumbsMobileView.java View source code |
@Override
public void clearBreadcrumbs(int breadcrumbSize) {
breadcrumbs.clear();
for (int i = 0; i < breadcrumbSize; ++i) {
if (i > 0) {
breadcrumbs.add(new InlineLabel(" > "));
}
breadcrumbs.add(new InlineHyperlink("Loading title...", placeManager.buildRelativeHistoryToken(i + 1)));
}
}Example 46
| Project: gwt-pushstate-master File: BreadcrumbsView.java View source code |
@Override
public void clearBreadcrumbs(int breadcrumbSize) {
breadcrumbs.clear();
for (int i = 0; i < breadcrumbSize; ++i) {
if (i > 0) {
breadcrumbs.add(new InlineLabel(" > "));
}
breadcrumbs.add(new InlineHyperlinkPushState("Loading title...", placeManager.buildRelativeHistoryToken(i + 1)));
}
}Example 47
| Project: appinventor-sources-master File: MockListView.java View source code |
private void createLabelItem(int i) {
labelInItem = new InlineLabel(currentList[i]);
labelInItem.setSize(ComponentConstants.LISTVIEW_PREFERRED_WIDTH + "px", "100%");
MockComponentsUtil.setWidgetBackgroundColor(labelInItem, backgroundColor);
MockComponentsUtil.setWidgetTextColor(labelInItem, textColor);
}Example 48
| Project: gwt-client-util-master File: WidgetUtilities.java View source code |
/**
* Create a message
* @param messageType
* the type of message
* @param message
* the message text
* @return
* the message
*/
public static Widget createMessage(MessageType messageType, String message) {
return createMessage(messageType, new InlineLabel(message));
}Example 49
| Project: gwt-esri-master File: SelectFeatures.java View source code |
@Override
public void onLoad() {
messages = new InlineLabel();
root.add(messages, 0, 445);
mapWidget.getElement().addClassName("selectFeaturesMap");
initSelectToolbar();
onClientReady();
}