本文整理匯總了Java中com.vaadin.ui.Label.setStyleName方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setStyleName方法的具體用法?Java Label.setStyleName怎麽用?Java Label.setStyleName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Label
的用法示例。
在下文中一共展示了Label.setStyleName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: enter
import com.vaadin.ui.Label; //導入方法依賴的package包/類
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
Label errorLabel = new Label("エラーが発生しました。");
errorLabel.setStyleName(ValoTheme.LABEL_FAILURE);
VaadinSession session = VaadinSession.getCurrent();
String paramMessage = (String) session.getAttribute(PARAM_MESSAGE);
if (paramMessage != null) {
addComponent(new Label(paramMessage));
}
session.setAttribute(PARAM_MESSAGE, null);
Throwable paramThrowable = (Throwable) session.getAttribute(PARAM_THROWABLE);
if (paramThrowable != null) {
addComponent(new Label(throwable2html(paramThrowable), ContentMode.HTML));
}
session.setAttribute(PARAM_THROWABLE, null);
log.error(paramMessage, paramThrowable);
if (paramThrowable instanceof AuthenticationException) {
Button loginButton = new Button("ログイン", click -> getUI().getNavigator().navigateTo(LoginView.VIEW_NAME));
addComponent(loginButton);
setComponentAlignment(loginButton, Alignment.MIDDLE_CENTER);
}
Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例2: Card
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Card(String title) {
Label titleLabel = new Label(String.format("%s", title), ContentMode.HTML);
titleLabel.setStyleName("persephone-card-title");
this.addComponent(titleLabel);
this.setStyleName("persephone-card");
}
示例3: OtherView
import com.vaadin.ui.Label; //導入方法依賴的package包/類
public OtherView()
{
final Label title = new Label("Other View");
title.setStyleName(ValoTheme.LABEL_H2);
rootLayout.addComponent(title);
rootLayout.addComponent(label);
}
示例4: HomeView
import com.vaadin.ui.Label; //導入方法依賴的package包/類
public HomeView()
{
final Label title = new Label("Home View");
title.setStyleName(ValoTheme.LABEL_H2);
rootLayout.addComponent(title);
rootLayout.addComponent(label);
}
示例5: getLogsPanel
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Panel getLogsPanel(Application app, String logs, String propertyLoggingPath) {
// Logs text area
Label logsLabel = new Label(logs, ContentMode.PREFORMATTED);
logsLabel.setStyleName("app-logs");
// Create panel
VerticalLayout layout = new VerticalLayout(logsLabel);
layout.setSpacing(false);
layout.setSizeUndefined();
Panel panel = new Panel(String.format("Application Logs (from %s)", propertyLoggingPath), layout);
panel.setHeight(500, Unit.PIXELS);
scrollToBottom(panel);
// Auto refresh logs
ajaxRefreshInit(args -> {
int uiId = ((PersephoneUI)getUI()).getUIId();
LOGGER.trace("UI-{}: Logs Refresh Start", uiId);
// Get current session range
LogsRange currentSessionRange = ((PersephoneUI)getUI()).getUserData().getCurrentRange();
LOGGER.trace("UI-{}: Logs Refresh: Current Range: {}-{}", uiId, currentSessionRange.getStart(), currentSessionRange.getEnd());
// Get next logs range to retrieve
LogsRange nextRange = logsService.getLogsRange(app, currentSessionRange, bytesToRetrieveRefresh);
LOGGER.trace("UI-{}: Logs Refresh: Next Range: {}-{}", uiId, nextRange.getStart(), nextRange.getEnd());
// Update current range into user session
((PersephoneUI)getUI()).getUserData().setCurrentRange(nextRange);
// Get logs
String newLogs = logsService.getLogs(app, nextRange);
// Update UI
if(!StringUtils.isEmpty(newLogs)) {
String oldLogs = logsLabel.getValue();
// Too much logs displayed => let's strip them out
if(oldLogs.length() + newLogs.length() > bytesToDisplayMax) {
newLogs = oldLogs + newLogs;
LOGGER.trace("UI-{}: Logs Refresh: Too much logs are going to be displayed (length={}), it will be stripped to {} chars", uiId, newLogs.length(), bytesToDisplayMax);
newLogs = newLogs.substring(newLogs.length() - bytesToDisplayMax);
logsLabel.setValue(newLogs);
}
// max length not reached yet
else {
logsLabel.setValue(oldLogs + newLogs);
}
}
scrollToBottom(panel);
LOGGER.trace("UI-{} Logs Refresh End", uiId);
});
return panel;
}
示例6: init
import com.vaadin.ui.Label; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request)
{
setLocale(Locale.US);
final HorizontalLayout rootLayout = new HorizontalLayout();
rootLayout.setSpacing(false);
rootLayout.setSizeFull();
final VerticalLayout navigationLayout = new VerticalLayout();
navigationLayout.setWidth(null);
final Label title = new Label("HTML5 History API<br>Navigation", ContentMode.HTML);
title.setStyleName(ValoTheme.LABEL_H1);
title.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER);
navigationLayout.addComponent(title);
rootLayout.addComponent(navigationLayout);
final TextField param1Field = new TextField("Parameter 1");
final TextField param2Field = new TextField("Parameter 2");
final Button homeButton = new Button("Home View",
event -> getNavigator().navigateTo(HomeView.VIEW_NAME + "/" +
getParameters(param1Field.getValue(), param2Field.getValue())));
navigationLayout.addComponent(homeButton);
final Button parameterButton = new Button("Other View",
event -> getNavigator().navigateTo(OtherView.VIEW_NAME + "/" +
getParameters(param1Field.getValue(), param2Field.getValue())));
navigationLayout.addComponents(parameterButton, param1Field, param2Field);
final Panel contentPanel = new Panel();
contentPanel.setSizeFull();
rootLayout.addComponent(contentPanel);
rootLayout.setExpandRatio(contentPanel, 1.0f);
setNavigator(HistoryApiNavigatorFactory.createHistoryApiNavigator(this, new CustomViewDisplay(contentPanel)));
final HomeView homeView = new HomeView();
getNavigator().addView(HomeView.VIEW_NAME, homeView);
getNavigator().addView(OtherView.VIEW_NAME, new OtherView());
setContent(rootLayout);
}