本文整理匯總了Java中com.vaadin.ui.Button.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.setEnabled方法的具體用法?Java Button.setEnabled怎麽用?Java Button.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Button
的用法示例。
在下文中一共展示了Button.setEnabled方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildToolbarButton
import com.vaadin.ui.Button; //導入方法依賴的package包/類
/**
* @param toolbar
* HorizontalLayout which contains all the action Buttons
* @param toolbarButton
* Which Tool bar button to create (Provided using ENUM constant)
* @param listner
* Click listener called when this button is clicked
* @return
*/
public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
ClickListener listner) {
Button button = new Button(toolbarButton.getText());
button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
button.setDescription(toolbarButton.getTooltip());
button.setStyleName(ValoTheme.BUTTON_LINK);
if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
}
button.setEnabled(false);
button.setId(toolbarButton.getId());
button.addClickListener(listner);
toolbar.addComponent(button);
return button;
}
示例2: DatePickerFooter
import com.vaadin.ui.Button; //導入方法依賴的package包/類
public DatePickerFooter(InlineDateField field, boolean lightTheme) {
setAlignItems(FlexLayout.AlignItems.CENTER);
setJustifyContent(FlexLayout.JustifyContent.FLEX_END);
addStyleName(Paddings.All.SMALL);
addStyleName(Spacings.Right.SMALL);
addStyleName(FlexItem.FlexShrink.SHRINK_0);
cancel = new Button("Cancel");
cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
ok = new Button("OK");
ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
ok.setEnabled(field.getValue() != null);
this.field = field;
this.field.addValueChangeListener(event -> ok.setEnabled(this.field.getValue() != null));
addComponents(cancel, ok);
}
示例3: createParentToolbar
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private HorizontalLayout createParentToolbar(List<ToolbarButtons> parentCRUDButtons) {
this.parentToolbar = new HorizontalLayout();
this.parentToolbar.addStyleName("buttonToolbar");
this.parentToolbar.setWidth("100%");
Label filler = new Label();
for (ToolbarButtons button : parentCRUDButtons) {
if (button == null) {
continue;
}
if (button.getAlignment() == HorizontalAlignment.RIGHT
&& this.parentToolbar.getComponentIndex(filler) == -1) {
this.parentToolbar.addComponent(filler);
this.parentToolbar.setExpandRatio(filler, 1.0f);
}
Button buttonComponent = ViewUtil.buildToolbarButton(this.parentToolbar, button, this.buttonClickListener);
if (button == ToolbarButtons.ADD || button == ToolbarButtons.SHOW_PENDING_ACKNOWLEDGE_ALERTS
|| button == ToolbarButtons.SHOW_ALL_ALERTS) {
buttonComponent.setEnabled(true);
}
// TODO: Future. Later use the following code to support Parent Table drill down
}
if (this.parentToolbar.getComponentIndex(filler) == -1) {
this.parentToolbar.addComponent(filler);
this.parentToolbar.setExpandRatio(filler, 1.0f);
}
return this.parentToolbar;
}
示例4: createDeleteEntry
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Button createDeleteEntry(CertificateBasicInfoModel certificateModel) {
String removeBtnLabel = (certificateModel.isConnected()) ? "Force delete" : "Delete";
final Button deleteArchiveButton = new Button(removeBtnLabel);
deleteArchiveButton.setData(certificateModel);
deleteArchiveButton.addClickListener(this.removeButtonListener);
if (certificateModel.getAlias().contains(getString(KEYPAIR_INTERNAL_DISPLAY_ALIAS))) {
deleteArchiveButton.setEnabled(false);
}
return deleteArchiveButton;
}
示例5: createToolbar
import com.vaadin.ui.Button; //導入方法依賴的package包/類
public HorizontalLayout createToolbar(ToolbarButtons[] crudButtons) {
this.toolbar = new HorizontalLayout();
this.toolbar.addStyleName("buttonToolbar");
for (ToolbarButtons button : crudButtons) {
if (button == null) {
continue;
}
Button buttonComponent = ViewUtil.buildToolbarButton(this.toolbar, button, this.buttonClickListener);
if (button == ToolbarButtons.ADD || button == ToolbarButtons.BACK) {
buttonComponent.setEnabled(true);
}
}
return this.toolbar;
}
示例6: stopServer
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void stopServer(String stripeName, String serverName, Button stopBT) {
RunningServer runningServer = runningServers.get(stripeName + "-" + serverName);
if (runningServer != null) {
runningServer.stop();
stopBT.setEnabled(false);
runningServer.refreshConsole();
}
}
示例7: startServer
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void startServer(String stripeName, String serverName, Button startBT, Button stopBT, Label stateLBL, Label pidLBL) {
File stripeconfig = tcConfigLocationPerStripe.get(stripeName);
if (stripeconfig == null) {
generateXML(false);
stripeconfig = tcConfigLocationPerStripe.get(stripeName);
}
File workDir = new File(settings.getKitPath());
String key = stripeName + "-" + serverName;
TextArea console = getConsole(key);
RunningServer runningServer = new RunningServer(
workDir, stripeconfig, serverName, console, 500,
() -> {
runningServers.remove(key);
access(() -> {
stopBT.setEnabled(false);
startBT.setEnabled(true);
pidLBL.setValue("");
stateLBL.setValue("STOPPED");
});
},
newState -> access(() -> stateLBL.setValue("STATE: " + newState)),
newPID -> access(() -> pidLBL.setValue("PID: " + newPID))
);
if (runningServers.put(key, runningServer) != null) {
Notification.show("ERROR", "Server is running: " + serverName, Notification.Type.ERROR_MESSAGE);
return;
}
consoles.setSelectedTab(console);
stateLBL.setValue("STARTING");
runningServer.start();
startBT.setEnabled(false);
stopBT.setEnabled(true);
runningServer.refreshConsole();
}
示例8: createRaisedButtons
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Component createRaisedButtons() {
Button light = new RaisedButton("Raised Light");
Button lightDisabled = new RaisedButton("Raised Light Disabled");
lightDisabled.setEnabled(false);
FlexLayout l1 = new FlexLayout(FlexDirection.COLUMN, light, lightDisabled);
l1.setWidth(320, Unit.PIXELS);
l1.setAlignItems(AlignItems.CENTER);
l1.addStyleName(Paddings.All.LARGE);
l1.addStyleName(Spacings.Bottom.MEDIUM);
l1.addStyleName(MaterialColor.GREY_50.getBackgroundColorStyle());
Button dark = new RaisedButton("Raised Dark", false);
Button darkDisabled = new RaisedButton("Raised Dark Disabled", false);
darkDisabled.setEnabled(false);
FlexLayout l2 = new FlexLayout(FlexDirection.COLUMN, dark, darkDisabled);
l2.setWidth(320, Unit.PIXELS);
l2.setAlignItems(AlignItems.CENTER);
l2.addStyleName(Paddings.All.LARGE);
l2.addStyleName(Spacings.Bottom.MEDIUM);
l2.addStyleName(MaterialColor.GREY_800.getBackgroundColorStyle());
l2.addStyleName("card");
FlexLayout row = new FlexLayout(l1, l2);
row.setAlignItems(AlignItems.BASELINE);
row.setFlexWrap(FlexWrap.WRAP);
row.setJustifyContent(JustifyContent.SPACE_BETWEEN);
row.addStyleName(Spacings.Bottom.LARGE);
return row;
}
示例9: createFlatButtons
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Component createFlatButtons() {
Button light = new FlatButton("Flat Light");
Button lightDisabled = new FlatButton("Flat Light Disabled");
lightDisabled.setEnabled(false);
FlexLayout l1 = new FlexLayout(FlexDirection.COLUMN, light, lightDisabled);
l1.setWidth(320, Unit.PIXELS);
l1.setAlignItems(AlignItems.CENTER);
l1.addStyleName(Paddings.All.LARGE);
l1.addStyleName(Spacings.Bottom.MEDIUM);
l1.addStyleName(MaterialColor.GREY_50.getBackgroundColorStyle());
l1.addStyleName("card");
Button dark = new FlatButton("Flat Dark", false);
Button darkDisabled = new FlatButton("Flat Dark Disabled", false);
darkDisabled.setEnabled(false);
FlexLayout l2 = new FlexLayout(FlexDirection.COLUMN, dark, darkDisabled);
l2.setWidth(320, Unit.PIXELS);
l2.setAlignItems(AlignItems.CENTER);
l2.addStyleName(Paddings.All.LARGE);
l2.addStyleName(Spacings.Bottom.MEDIUM);
l2.addStyleName(MaterialColor.GREY_800.getBackgroundColorStyle());
l2.addStyleName("card");
FlexLayout row = new FlexLayout(l1, l2);
row.setAlignItems(AlignItems.BASELINE);
row.setFlexWrap(FlexWrap.WRAP);
row.setJustifyContent(JustifyContent.SPACE_BETWEEN);
row.addStyleName(Spacings.Bottom.LARGE);
return row;
}
示例10: updateServerControls
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void updateServerControls() {
int nStripes = serverGrid.getRows() - 1;
int nServersPerStripe = serverGrid.getColumns() - 1;
serverControls.removeAllComponents();
serverControls.setRows(nStripes * nServersPerStripe);
serverControls.setColumns(5);
for (int i = consoles.getComponentCount() - 1; i > 0; i--) {
consoles.removeTab(consoles.getTab(i));
}
for (int stripeId = 1; stripeId < serverGrid.getRows(); stripeId++) {
String stripeName = "stripe-" + stripeId;
for (int serverId = 1; serverId < serverGrid.getColumns(); serverId++) {
FormLayout form = (FormLayout) serverGrid.getComponent(serverId, stripeId);
if (form != null) {
TextField serverNameTF = (TextField) form.getComponent(0);
String serverName = serverNameTF.getValue();
serverControls.addComponent(new Label(serverName));
Button startBT = new Button();
startBT.setCaption("START");
startBT.setData(serverName);
startBT.setStyleName("align-top");
serverControls.addComponent(startBT);
Button stopBT = new Button();
stopBT.setEnabled(false);
stopBT.setCaption("STOP");
stopBT.setStyleName("align-top");
stopBT.setData(serverName);
serverControls.addComponent(stopBT);
Label pid = new Label();
serverControls.addComponent(pid);
Label state = new Label();
serverControls.addComponent(state);
addConsole(serverName, stripeName + "-" + serverName);
startBT.addClickListener((Button.ClickListener) event -> {
startServer(stripeName, (String) event.getButton().getData(), startBT, stopBT, state, pid);
});
stopBT.addClickListener((Button.ClickListener) event -> {
stopServer(stripeName, (String) event.getButton().getData(), stopBT);
});
}
}
}
}
示例11: ApplicationOverviewPanel
import com.vaadin.ui.Button; //導入方法依賴的package包/類
public ApplicationOverviewPanel(Application app, Environment env, Optional<Metrics> metricsOpt) {
// Title
Label titleLabel = new Label(String.format("<h3>%s (%s)</h3>", app.getName(), app.getEnvironment()), ContentMode.HTML);
Label pidLabel = new Label(String.format("PID: %s", env.get("PID")));
Link appLink = new Link(app.getUrl(), new ExternalResource(app.getUrl()), "_blank", 0, 0, BorderStyle.DEFAULT);
// Overview info
String springProfiles = env.get("spring.profiles.active");
Label springProfilesLabel = new Label(String.format("Spring Profiles: %s", springProfiles));
Label javaLabel = new Label(String.format("Java Version %s (%s on %s)", env.get("java.version"), env.get("java.home"), env.get("os.name")));
List<Component> infos = new ArrayList<>();
if(!StringUtils.isEmpty(springProfiles)) {
infos.add(springProfilesLabel);
}
infos.add(javaLabel);
if(metricsOpt.isPresent()) {
Metrics metrics = metricsOpt.get();
String memAllocated = Formatters.readableFileSize(metrics.getMemAllocated() * 1000);
String memTotal = Formatters.readableFileSize(metrics.getMem() * 1000);
Label memLabel = new Label(String.format("Memory: %s / %s (%s%% free)", memAllocated, memTotal, metrics.getMemFreePercentage()));
Label sessionsLabel = new Label(String.format("HTTP Sessions Active: %s", metrics.getHttpSessionsActive()));
Label uptimeLabel = new Label(String.format("Uptime: %s", Formatters.readableDuration(metrics.getUptime())));
infos.add(memLabel);
infos.add(uptimeLabel);
if(metricsOpt.get().getHttpSessionsActive() >= 0) {
infos.add(sessionsLabel);
}
}
// Buttons
Button metricsButton = new Button("Metrics", e -> getUI().getNavigator().navigateTo(PersephoneViews.METRICS+"/"+app.getId()));
metricsButton.setEnabled(metricsOpt.isPresent());
Button propertiesButton = new Button("Properties", e -> getUI().getNavigator().navigateTo(PersephoneViews.PROPERTIES+"/"+app.getId()));
Button logsButton = new Button("Show Logs", e -> getUI().getNavigator().navigateTo(PersephoneViews.LOGS+"/"+app.getId()));
Button loggersButton = new Button("Loggers Config", e -> getUI().getNavigator().navigateTo(PersephoneViews.LOGGERS+"/"+app.getId()));
Button traceButton = new Button("Last HTTP Requests", e -> getUI().getNavigator().navigateTo(PersephoneViews.TRACE+"/"+app.getId()));
traceButton.setEnabled(app.getActuatorVersion() == ActuatorVersion.V1);
Button actuatorButton = new Button("Actuator Endpoints", e -> getUI().getNavigator().navigateTo(PersephoneViews.ENDPOINTS+"/"+app.getId()));
this.addComponent(titleLayout(titleLabel, pidLabel, appLink));
this.addComponent(infoLayout(infos.toArray(new Component[] {})));
this.addComponent(buttonsLayout(metricsButton, propertiesButton, logsButton, loggersButton, traceButton, actuatorButton));
}