当前位置: 首页>>代码示例>>Java>>正文


Java Button.setEnabled方法代码示例

本文整理汇总了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;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:26,代码来源:ViewUtil.java

示例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);
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:20,代码来源:DatePickerFooter.java

示例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;
    }
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:31,代码来源:CRUDBaseView.java

示例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;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:13,代码来源:SslConfigurationLayout.java

示例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;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:16,代码来源:CRUDBaseSubView.java

示例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();
  }
}
 
开发者ID:Terracotta-OSS,项目名称:tinypounder,代码行数:9,代码来源:TinyPounderMainUI.java

示例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();
}
 
开发者ID:Terracotta-OSS,项目名称:tinypounder,代码行数:39,代码来源:TinyPounderMainUI.java

示例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;
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:33,代码来源:ButtonsView.java

示例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;
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:34,代码来源:ButtonsView.java

示例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);
        });
      }
    }
  }
}
 
开发者ID:Terracotta-OSS,项目名称:tinypounder,代码行数:54,代码来源:TinyPounderMainUI.java

示例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));
	}
 
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:51,代码来源:ApplicationOverviewPanel.java


注:本文中的com.vaadin.ui.Button.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。