本文整理汇总了Java中com.google.gwt.user.client.ui.Label.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setVisible方法的具体用法?Java Label.setVisible怎么用?Java Label.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Label
的用法示例。
在下文中一共展示了Label.setVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
});
}
示例2: initReportSection
import com.google.gwt.user.client.ui.Label; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the report section
*/
private void initReportSection() {
final HTML reportPrompt = new HTML();
reportPrompt.setHTML(MESSAGES.galleryReportPrompt());
reportPrompt.addStyleName("primary-prompt");
final TextArea reportText = new TextArea();
reportText.addStyleName("action-textarea");
final Button submitReport = new Button(MESSAGES.galleryReportButton());
submitReport.addStyleName("action-button");
final Label descriptionError = new Label();
descriptionError.setText("Description required");
descriptionError.setStyleName("ode-ErrorMessage");
descriptionError.setVisible(false);
appReportPanel.add(reportPrompt);
appReportPanel.add(descriptionError);
appReportPanel.add(reportText);
appReportPanel.add(submitReport);
final OdeAsyncCallback<Boolean> isReportdByUserCallback = new OdeAsyncCallback<Boolean>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(Boolean isAlreadyReported) {
if(isAlreadyReported) { //already reported, cannot report again
reportPrompt.setHTML(MESSAGES.galleryAlreadyReportedPrompt());
reportText.setVisible(false);
submitReport.setVisible(false);
submitReport.setEnabled(false);
} else {
submitReport.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final OdeAsyncCallback<Long> reportClickCallback = new OdeAsyncCallback<Long>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(Long id) {
reportPrompt.setHTML(MESSAGES.galleryReportCompletionPrompt());
reportText.setVisible(false);
submitReport.setVisible(false);
submitReport.setEnabled(false);
}
};
if (!reportText.getText().trim().isEmpty()){
Ode.getInstance().getGalleryService().addAppReport(app, reportText.getText(),
reportClickCallback);
descriptionError.setVisible(false);
} else {
descriptionError.setVisible(true);
}
}
});
}
}
};
Ode.getInstance().getGalleryService().isReportedByUser(app.getGalleryAppId(),
isReportdByUserCallback);
}