本文整理汇总了Java中com.google.gwt.user.client.ui.Label.addStyleName方法的典型用法代码示例。如果您正苦于以下问题:Java Label.addStyleName方法的具体用法?Java Label.addStyleName怎么用?Java Label.addStyleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Label
的用法示例。
在下文中一共展示了Label.addStyleName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SqlScriptFileConfigTable
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
public SqlScriptFileConfigTable(SqlProgramWidget widget, String name){
this.widget = widget;
this.name = name;
this.insertRow(0);
Label add = new Label();
add.addStyleName("admin-user-edit");
this.setWidget(0, 0, new Label(name));
this.setWidget(0, 1, new Label());
this.setWidget(0, 2, add);
this.setWidget(0, 3, new Label());
add.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
int i = 0;
while( i < SqlScriptFileConfigTable.this.getRowCount()
&& SqlScriptFileConfigTable.this.getWidget(i, 2 ) != event.getSource() ) i ++ ;
if( i < SqlScriptFileConfigTable.this.getRowCount() ){
addRow( i, "");
}
}
});
}
示例2: initAppTitle
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the app's title section
* @param container The container that title resides
*/
private void initAppTitle(Panel container) {
if (newOrUpdateApp()) {
// GUI for editable title container
if (editStatus==NEWAPP) {
// If it's new app, give a textual hint telling user this is title
titleText.setText(app.getTitle());
} else if (editStatus==UPDATEAPP) {
// If it's not new, just set whatever's in the data field already
titleText.setText(app.getTitle());
}
titleText.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
app.setTitle(titleText.getText());
}
});
titleText.addStyleName("app-desc-textarea");
container.add(titleText);
container.addStyleName("app-title-container");
} else {
Label title = new Label(app.getTitle());
title.addStyleName("app-title");
container.add(title);
}
}
示例3: initSalvageSection
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the salvage section
* @param container The container that salvage label reside
*/
private void initSalvageSection(Panel container) { //TODO: Update the location of this button
if (!canSalvage()) { // Permitted to salvage?
return;
}
final Label salvagePrompt = new Label("salvage");
salvagePrompt.addStyleName("primary-link");
container.add(salvagePrompt);
salvagePrompt.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final OdeAsyncCallback<Void> callback = new OdeAsyncCallback<Void>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(Void bool) {
salvagePrompt.setText("done");
}
};
Ode.getInstance().getGalleryService().salvageGalleryApp(app.getGalleryAppId(), callback);
}
});
}
示例4: initAppComments
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the app's comment area
*/
private void initAppComments() {
// App details - comments
appDetails.add(appComments);
appComments.addStyleName("app-comments-wrapper");
Label commentsHeader = new Label("Comments and Reviews");
commentsHeader.addStyleName("app-comments-header");
appComments.add(commentsHeader);
final TextArea commentTextArea = new TextArea();
commentTextArea.addStyleName("app-comments-textarea");
appComments.add(commentTextArea);
Button commentSubmit = new Button("Submit my comment");
commentSubmit.addStyleName("app-comments-submit");
commentSubmit.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final OdeAsyncCallback<Long> commentPublishCallback = new OdeAsyncCallback<Long>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(Long date) {
// get the new comment list so gui updates
// note: we might modify the call to publishComment so it returns
// the list instead, this would save one server call
gallery.GetComments(app.getGalleryAppId(), 0, 100);
}
};
Ode.getInstance().getGalleryService().publishComment(app.getGalleryAppId(),
commentTextArea.getText(), commentPublishCallback);
}
});
appComments.add(commentSubmit);
// Add list of comments
gallery.GetComments(app.getGalleryAppId(), 0, 100);
appComments.add(appCommentsList);
appCommentsList.addStyleName("app-comments");
}
示例5: addGalleryAppTab
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Creates the GUI components for a regular app tab.
* This method resides here because it needs access to global variables.
* @param container: the FlowPanel that this app tab will reside.
* @param content: the sub-panel that contains the actual app content.
*/
private void addGalleryAppTab(FlowPanel container, FlowPanel content, final String incomingUserId) {
// Search specific
generalTotalResultsLabel = new Label();
container.add(generalTotalResultsLabel);
final OdeAsyncCallback<GalleryAppListResult> byAuthorCallback = new OdeAsyncCallback<GalleryAppListResult>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(GalleryAppListResult appsResult) {
refreshApps(appsResult,false);
}
};
Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
container.add(content);
buttonNext = new Label();
buttonNext.setText(MESSAGES.galleryMoreApps());
buttonNext.addStyleName("active");
FlowPanel next = new FlowPanel();
next.add(buttonNext);
next.addStyleName("gallery-nav-next");
container.add(next);
buttonNext.addClickHandler(new ClickHandler() {
// @Override
public void onClick(ClickEvent event) {
if (!appCatalogExhausted) {
// If the next page still has apps to retrieve, do it
appCatalogCounter += NUMAPPSTOSHOW;
Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
}
}
});
}
示例6: setHeaderRow
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Adds the header row to the table.
*
*/
private void setHeaderRow() {
table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");
HorizontalPanel nameHeader = new HorizontalPanel();
final Label nameHeaderLabel = new Label(MESSAGES.projectNameHeader());
nameHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
nameHeader.add(nameHeaderLabel);
nameSortIndicator.addStyleName("ode-ProjectHeaderLabel");
nameHeader.add(nameSortIndicator);
table.setWidget(0, 1, nameHeader);
HorizontalPanel dateCreatedHeader = new HorizontalPanel();
final Label dateCreatedHeaderLabel = new Label(MESSAGES.projectDateCreatedHeader());
dateCreatedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
dateCreatedHeader.add(dateCreatedHeaderLabel);
dateCreatedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
dateCreatedHeader.add(dateCreatedSortIndicator);
table.setWidget(0, 2, dateCreatedHeader);
HorizontalPanel dateModifiedHeader = new HorizontalPanel();
final Label dateModifiedHeaderLabel = new Label(MESSAGES.projectDateModifiedHeader());
dateModifiedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
dateModifiedHeader.add(dateModifiedHeaderLabel);
dateModifiedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
dateModifiedHeader.add(dateModifiedSortIndicator);
table.setWidget(0, 3, dateModifiedHeader);
HorizontalPanel publishedHeader = new HorizontalPanel();
final Label publishedHeaderLabel = new Label(MESSAGES.projectPublishedHeader());
publishedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
publishedHeader.add(publishedHeaderLabel);
publishedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
publishedHeader.add(publishedSortIndicator);
table.setWidget(0, 4, publishedHeader);
MouseDownHandler mouseDownHandler = new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent e) {
SortField clickedSortField;
if (e.getSource() == nameHeaderLabel || e.getSource() == nameSortIndicator) {
clickedSortField = SortField.NAME;
} else if (e.getSource() == dateCreatedHeaderLabel || e.getSource() == dateCreatedSortIndicator) {
clickedSortField = SortField.DATE_CREATED;
} else if (e.getSource() == dateModifiedHeaderLabel || e.getSource() == dateModifiedSortIndicator){
clickedSortField = SortField.DATE_MODIFIED;
}else{
clickedSortField = SortField.PUBLISHED;
}
changeSortOrder(clickedSortField);
}
};
nameHeaderLabel.addMouseDownHandler(mouseDownHandler);
nameSortIndicator.addMouseDownHandler(mouseDownHandler);
dateCreatedHeaderLabel.addMouseDownHandler(mouseDownHandler);
dateCreatedSortIndicator.addMouseDownHandler(mouseDownHandler);
dateModifiedHeaderLabel.addMouseDownHandler(mouseDownHandler);
dateModifiedSortIndicator.addMouseDownHandler(mouseDownHandler);
publishedHeaderLabel.addMouseDownHandler(mouseDownHandler);
publishedSortIndicator.addMouseDownHandler(mouseDownHandler);
}
示例7: setHeaderRow
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Adds the header row to the table.
*
*/
private void setHeaderRow() {
table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");
HorizontalPanel reportHeader = new HorizontalPanel();
final Label reportHeaderLabel = new Label(MESSAGES.moderationReportTextHeader());
reportHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
reportHeader.add(reportHeaderLabel);
table.setWidget(0, 0, reportHeader);
HorizontalPanel appHeader = new HorizontalPanel();
final Label appHeaderLabel = new Label(MESSAGES.moderationAppHeader());
appHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
appHeader.add(appHeaderLabel);
table.setWidget(0, 1, appHeader);
HorizontalPanel dateCreatedHeader = new HorizontalPanel();
final Label dateCreatedHeaderLabel = new Label(MESSAGES.moderationReportDateCreatedHeader());
dateCreatedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
dateCreatedHeader.add(dateCreatedHeaderLabel);
table.setWidget(0, 2, dateCreatedHeader);
HorizontalPanel appAuthorHeader = new HorizontalPanel();
final Label appAuthorHeaderLabel = new Label(MESSAGES.moderationAppAuthorHeader());
appAuthorHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
appAuthorHeader.add(appAuthorHeaderLabel);
table.setWidget(0, 3, appAuthorHeader);
HorizontalPanel reporterHeader = new HorizontalPanel();
final Label reporterHeaderLabel = new Label(MESSAGES.moderationReporterHeader());
reporterHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
reporterHeader.add(reporterHeaderLabel);
table.setWidget(0, 4, reporterHeader);
}
示例8: ReportWidgets
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Constructor of ReportWidgets
* @param report GalleryAppReport
*/
private ReportWidgets(final GalleryAppReport report) {
reportTextLabel = new Label(report.getReportText());
reportTextLabel.addStyleName("ode-ProjectNameLabel");
reportTextLabel.setWordWrap(true);
reportTextLabel.setWidth("200px");
appLabel = new Label(report.getApp().getTitle());
appLabel.addStyleName("primary-link");
DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();
Date dateCreated = new Date(report.getTimeStamp());
dateCreatedLabel = new Label(dateTimeFormat.format(dateCreated));
appAuthorlabel = new Label(report.getOffender().getUserName());
appAuthorlabel.addStyleName("primary-link");
reporterLabel = new Label(report.getReporter().getUserName());
reporterLabel.addStyleName("primary-link");
sendEmailButton = new Button(MESSAGES.buttonSendEmail());
deactiveAppButton = new Button(MESSAGES.labelDeactivateApp());
markAsResolvedButton = new Button(MESSAGES.labelmarkAsResolved());
seeAllActions = new Button(MESSAGES.labelSeeAllActions());
}
示例9: createEmailCollapse
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Help method for Email Collapse Function
* When the button(see more) is clicked, it will retrieve the whole email from database.
* @param parent the parent container
* @param emailId email id
* @param preview email preview
*/
void createEmailCollapse(final FlowPanel parent, final long emailId, final String preview){
final Label emailContent = new Label();
emailContent.setText(preview);
emailContent.addStyleName("inline-label");
parent.add(emailContent);
final Label actionButton = new Label();
actionButton.setText(MESSAGES.seeMoreLink());
actionButton.addStyleName("seemore-link");
parent.add(actionButton);
if(preview.length() <= MAX_EMAIL_PREVIEW_LENGTH){
actionButton.setVisible(false);
}
actionButton.addClickHandler(new ClickHandler() {
boolean ifPreview = true;
@Override
public void onClick(ClickEvent event) {
if(ifPreview == true){
OdeAsyncCallback<Email> callback = new OdeAsyncCallback<Email>(
// failure message
MESSAGES.serverUnavailable()) {
@Override
public void onSuccess(final Email email) {
emailContent.setText(email.getBody());
emailContent.addStyleName("inline");
actionButton.setText(MESSAGES.hideLink());
ifPreview = false;
}
};
Ode.getInstance().getGalleryService().getEmail(emailId, callback);
}else{
emailContent.setText(preview);
actionButton.setText(MESSAGES.seeMoreLink());
ifPreview = true;
}
}
});
}
示例10: setHeaderRow
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Adds the header row to the table.
*
*/
private void setHeaderRow() {
if (galleryEnabledHolder.enabled) {
table.resizeColumns(5); // Number of columns varies based on whether or not
// the Gallery is enabled
} else {
table.resizeColumns(4);
}
table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");
HorizontalPanel emailHeader = new HorizontalPanel();
final Label emailHeaderLabel = new Label("User Email");
int column = 0;
emailHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
emailHeader.add(emailHeaderLabel);
emailHeader.add(nameSortIndicator);
table.setWidget(0, column, emailHeader);
column += 1;
HorizontalPanel uidHeader = new HorizontalPanel();
final Label uidHeaderLabel = new Label("UID");
uidHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
uidHeader.add(uidHeaderLabel);
table.setWidget(0, column++, uidHeader);
HorizontalPanel adminHeader = new HorizontalPanel();
final Label adminHeaderLabel = new Label("isAdmin?");
adminHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
adminHeader.add(adminHeaderLabel);
table.setWidget(0, column++, adminHeader);
if (galleryEnabledHolder.enabled) {
HorizontalPanel moderatorHeader = new HorizontalPanel();
final Label moderatorHeaderLabel = new Label("isModerator?");
moderatorHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
moderatorHeader.add(moderatorHeaderLabel);
table.setWidget(0, column++, moderatorHeader);
}
HorizontalPanel visitedHeader = new HorizontalPanel();
final Label visitedLabel = new Label("Visited");
visitedLabel.addStyleName("ode-ProjectHeaderLabel");
visitedHeader.add(visitedLabel);
visitedHeader.add(visitedSortIndicator);
table.setWidget(0, column++, visitedHeader);
MouseDownHandler mouseDownHandler = new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent e) {
SortField clickedSortField;
if (e.getSource() == emailHeaderLabel || e.getSource() == nameSortIndicator) {
clickedSortField = SortField.NAME;
} else if (e.getSource() == visitedLabel || e.getSource() == visitedSortIndicator) {
clickedSortField = SortField.VISITED;
} else {
return;
}
changeSortOrder(clickedSortField);
}
};
emailHeaderLabel.addMouseDownHandler(mouseDownHandler);
nameSortIndicator.addMouseDownHandler(mouseDownHandler);
visitedLabel.addMouseDownHandler(mouseDownHandler);
visitedSortIndicator.addMouseDownHandler(mouseDownHandler);
}
示例11: generateAppPageComments
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Creates list of comments in the app page.
* @param comments: list of returned gallery comments from callback.
* @param container: the GUI panel where comments will reside.
*/
public void generateAppPageComments(List<GalleryComment> comments, FlowPanel container) {
container.clear(); // so don't show previous listing
if (comments == null) {
Label noComments = new Label("This app does not have any comments yet.");
noComments.addStyleName("comment-nope");
container.add(noComments);
}
for ( GalleryComment c : comments) {
FlowPanel commentItem = new FlowPanel();
FlowPanel commentPerson = new FlowPanel();
FlowPanel commentMeta = new FlowPanel();
FlowPanel commentContent = new FlowPanel();
// Add commentPerson, default avatar for now
Image cPerson = new Image();
cPerson.setUrl(PERSON_URL);
commentPerson.add(cPerson);
commentPerson.addStyleName("comment-person");
commentItem.add(commentPerson);
// Add commentContent
Label cAuthor = new Label(c.getUserName());
cAuthor.addStyleName("comment-author");
commentMeta.add(cAuthor);
Date commentDate = new Date(c.getTimeStamp());
DateTimeFormat dateFormat = DateTimeFormat.getFormat("yyyy/MM/dd hh:mm:ss a");
Label cDate = new Label(" on " + dateFormat.format(commentDate));
cDate.addStyleName("comment-date");
commentMeta.add(cDate);
commentMeta.addStyleName("comment-meta");
commentContent.add(commentMeta);
Label cText = new Label(c.getComment());
cText.addStyleName("comment-text");
commentContent.add(cText);
commentContent.addStyleName("comment-content");
commentItem.add(commentContent);
commentItem.addStyleName("comment-item");
commentItem.addStyleName("clearfix");
container.add(commentItem);
}
}
示例12: SimplePaletteItem
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Creates a new palette item.
*
* @param scd component descriptor for palette item
* @param dropTargetProvider provider of targets that palette items can be dropped on
*/
public SimplePaletteItem(SimpleComponentDescriptor scd, DropTargetProvider dropTargetProvider) {
this.dropTargetProvider = dropTargetProvider;
this.scd = scd;
componentPrototype = null;
// Initialize palette item UI
HorizontalPanel panel = new HorizontalPanel();
panel.setStylePrimaryName("ode-SimplePaletteItem");
Image image = scd.getImage();
image.setStylePrimaryName("ode-SimplePaletteItem-icon");
panel.add(image);
panel.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT);
panel.setCellWidth(image, "30px");
Label label = new Label(ComponentsTranslation.getComponentName(scd.getName()));
label.setHorizontalAlignment(Label.ALIGN_LEFT);
label.addStyleName("ode-SimplePaletteItem-caption");
panel.add(label);
HorizontalPanel optPanel = new HorizontalPanel();
ComponentHelpWidget helpImage = new ComponentHelpWidget(scd);
helpImage.addStyleName("ode-SimplePalleteItem-button");
optPanel.add(helpImage);
optPanel.setCellHorizontalAlignment(helpImage, HorizontalPanel.ALIGN_LEFT);
if (scd.getExternal()) {
ComponentRemoveWidget deleteImage = new ComponentRemoveWidget(scd);
deleteImage.addStyleName("ode-SimplePalleteItem-button");
optPanel.add(deleteImage);
optPanel.setCellHorizontalAlignment(deleteImage, HorizontalPanel.ALIGN_RIGHT);
}
panel.add(optPanel);
panel.setCellHorizontalAlignment(optPanel, HorizontalPanel.ALIGN_RIGHT);
panel.setWidth("100%");
add(panel);
setWidth("100%");
addHandlers();
}