當前位置: 首頁>>代碼示例>>Java>>正文


Java ClickEvent類代碼示例

本文整理匯總了Java中com.vaadin.ui.Button.ClickEvent的典型用法代碼示例。如果您正苦於以下問題:Java ClickEvent類的具體用法?Java ClickEvent怎麽用?Java ClickEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ClickEvent類屬於com.vaadin.ui.Button包,在下文中一共展示了ClickEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildSubmenu

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
private void buildSubmenu(CssLayout submenu, Set<OSCViewProvider<?>> views) {
    for (final OSCViewProvider<?> view : views) {
        String viewName = view.getName();
        NativeButton b = new NativeButton(viewName);
        // selecting default menu button
        if (view.getName().equals(VIEW_FRAGMENT_ALERTS)) {
            b.addStyleName("selected");
        }
        b.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                clearMenuSelection();
                event.getButton().addStyleName("selected");
                if (!MainUI.this.nav.getState().equals(viewName)) {
                    MainUI.this.nav.navigateTo(viewName);
                }
            }
        });
        submenu.setSizeFull();
        submenu.addComponent(b);
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:23,代碼來源:MainUI.java

示例2: buttonClicked

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@Override
public void buttonClicked(ClickEvent event) throws Exception {
    if (event.getButton().getId().equals(ToolbarButtons.ADD.getId())) {
        log.debug("Redirecting to Add Manager Connector Window");
        ViewUtil.addWindow(new AddManagerConnectorWindow(this, this.addManagerConnectorService, this.pluginService, this.validator, this.trustManager, this.server));
    }
    if (event.getButton().getId().equals(ToolbarButtons.EDIT.getId())) {
        log.debug("Redirecting to Update Manager Connector Window");
        ViewUtil.addWindow(new UpdateManagerConnectorWindow(this, this.updateManagerConnectorService, this.pluginService, this.validator, this.trustManager, this.server));
    }
    if (event.getButton().getId().equals(ToolbarButtons.DELETE.getId())) {
        log.debug("Redirecting to Delete Manager Connector Window");
        ViewUtil.addWindow(new DeleteManagerConnectorWindow(this, this.deleteManagerConnectorService, this.server));
    }
    if (event.getButton().getId().equals(ToolbarButtons.CONFORM.getId())) {
        conformManagerConnector(getParentItemId());
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:19,代碼來源:ManagerConnectorView.java

示例3: buttonClicked

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@Override
public void buttonClicked(ClickEvent event) throws Exception {
    if (event.getButton().getId().equals(ToolbarButtons.ADD.getId())) {
        log.debug("Redirecting to Add Security Group interface Window");
        ViewUtil.addWindow(new AddSecurityGroupInterfaceWindow(getDtoInContext().getId(), this.addSecurityGroupInterfaceService, this.listVirtualSystemPolicyService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.EDIT.getId())) {
        log.debug("Redirecting to Update Security Group interface Window");
        ViewUtil.addWindow(new UpdateSecurityGroupInterfaceWindow(getSelectedItem().getBean(),
                this.listVirtualSystemPolicyService, this.updateSecurityGroupInterfaceService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.DELETE.getId())) {
        log.debug("Redirecting to Delete Security Group interface Window");
        DeleteWindowUtil.deleteSecurityGroupInterface(getSelectedItem().getBean(), this.deleteSecurityGroupInterfaceService);
    }
    if (event.getButton().getId().equals(ToolbarButtons.BACK.getId())) {
        // removing object from the sub view map so it can be garbage collected
        this.currentView.childSubViewMap.put(this.currentView.getKeyforChildSubView(2), null);
        this.currentView.viewSplitter.removeComponent(this.currentView.viewSplitter.getSecondComponent());
        this.currentView.viewSplitter.addComponent(this.currentView.childContainerLayout);
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:23,代碼來源:SecurityGroupInterfaceSubView.java

示例4: setupOkClickedListener

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@SuppressWarnings("serial")
private void setupOkClickedListener(final VmidcWindow<OkCancelButtonModel> alertWindow) {
    alertWindow.getComponentModel().setOkClickedListener(new Button.ClickListener(){
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                InternalCertReplacementUploader.this.x509TrustManager
                    .replaceInternalCertificate(InternalCertReplacementUploader.this.file, true);
            } catch (Exception e) {
                ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
            } finally {
                alertWindow.close();
                removeUploadedFile();
            }
        }});
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:InternalCertReplacementUploader.java

示例5: createEditButton

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@SuppressWarnings("serial")
private Button createEditButton() {
    // creating edit button
    this.edit = new Button("Edit");
    this.edit.setEnabled(true);
    this.edit.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.edit.addStyleName(StyleConstants.EDIT_BUTTON);
    this.edit.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing email settings", e);
            }
        }
    });
    return this.edit;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:20,代碼來源:EmailLayout.java

示例6: createIPSettingsEditButton

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@SuppressWarnings("serial")
private Button createIPSettingsEditButton() {
    // creating edit button
    this.editIPSettings = new Button("Edit");
    this.editIPSettings.setEnabled(true);
    this.editIPSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.editIPSettings.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editIPSettingsClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing IP settings", e);
            }
        }
    });
    return this.editIPSettings;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:19,代碼來源:NetworkLayout.java

示例7: createNATEditButton

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@SuppressWarnings("serial")
private Button createNATEditButton() {
    // creating edit button
    this.editNATSettings = new Button("Edit");
    this.editNATSettings.setEnabled(true);
    this.editNATSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.editNATSettings.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editNATSettingsClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing NAT settings", e);
            }
        }
    });
    return this.editNATSettings;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:19,代碼來源:NetworkLayout.java

示例8: buttonClicked

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@Override
public void buttonClicked(ClickEvent event) throws Exception {
    if (event.getButton().getId().equals(ToolbarButtons.ADD.getId())) {
        log.debug("Redirecting to Add Alarm Window");
        ViewUtil.addWindow(new AddAlarmWindow(this, this.addAlarmService,
                this.getEmailSettingsService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.EDIT.getId())) {
        log.debug("Redirecting to Update Alarm Window");
        ViewUtil.addWindow(new UpdateAlarmWindow(this, this.updateAlarmService,
                this.getEmailSettingsService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.DELETE.getId())) {
        log.debug("Redirecting to Delete Alarm Window");
        DeleteWindowUtil.deleteAlarm(this.deleteAlarmService, getParentItem().getBean());
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:18,代碼來源:AlarmView.java

示例9: createHeader

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
    HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            populateTable();
        }
    });
    header.addComponent(refresh);
    return header;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:CRUDBaseSubView.java

示例10: AdvancedSettingsWindow

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
public AdvancedSettingsWindow(BaseVCWindow baseVCWindow) throws Exception {
    this.baseVCWindow = baseVCWindow;
    createWindow(ADVANCED_SETTINGS_CAPTION);
    getComponentModel().setOkClickedListener(new ClickListener() {
        /**
         *
         */
        private static final long serialVersionUID = -8326846388022657979L;

        @Override
        public void buttonClick(ClickEvent event) {
            submitForm();

        }
    });
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:AdvancedSettingsWindow.java

示例11: deleteVirtualSystem

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@SuppressWarnings("serial")
public static void deleteVirtualSystem(final ForceDeleteVirtualSystemServiceApi forceDeleteVsService,
        final VirtualSystemDto dto, ServerApi server) {

    final VmidcWindow<OkCancelButtonModel> deleteWindow = WindowUtil
            .createAlertWindow("Force Delete Virtual System", "Force Delete Virtual System - " + dto.getName());

    deleteWindow.getComponentModel().setOkClickedListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                BaseJobResponse response = forceDeleteVsService.dispatch(new BaseDeleteRequest(dto.getId(), true));
                deleteWindow.close();
                if (response.getJobId() != null) {
                    ViewUtil.showJobNotification(response.getJobId(), server);
                }
            } catch (Exception e) {
                ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    ViewUtil.addWindow(deleteWindow);
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:26,代碼來源:DeleteWindowUtil.java

示例12: deleteAlert

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
public static void deleteAlert(final DeleteAlertServiceApi deleteAlertService, final List<AlertDto> dtoList) {
    final VmidcWindow<OkCancelButtonModel> deleteWindow = WindowUtil.createAlertWindow("Delete Alert",
            "Delete selected alert(s)? ");

    deleteWindow.getComponentModel().setOkClickedListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            try {
                AlertRequest req = new AlertRequest();
                req.setDtoList(dtoList);
                deleteAlertService.dispatch(req);
                deleteWindow.close();
                log.info("Delete Alert(s) Successful!");
            } catch (Exception e) {
                log.error("Failed to delete Alert(s)", e);
                ViewUtil.iscNotification("Failed to delete Alert(s).", Notification.Type.WARNING_MESSAGE);
            }
        }
    });

    ViewUtil.addWindow(deleteWindow);
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:27,代碼來源:DeleteWindowUtil.java

示例13: getUpgradeAlertWindow

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
private VmidcWindow<OkCancelButtonModel> getUpgradeAlertWindow() {
    String fromVersion = this.currentDAObject.getApplianceModel() + "-" + this.currentDAObject.getApplianceSoftwareVersionName();
    String toVersion = ((ApplianceModelSoftwareVersionDto) this.applianceDefinition.getValue()).getName();
    final VmidcWindow<OkCancelButtonModel> upgradeAlert = WindowUtil.createAlertWindow(
            VmidcMessages.getString(VmidcMessages_.DA_UPGRADE_WARNING_TITLE),
            VmidcMessages.getString(VmidcMessages_.DA_UPGRADE_WARNING, fromVersion, toVersion));
    upgradeAlert.getComponentModel().setOkClickedListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            upgradeAlert.close();
            submitRequest();
        }
    });
    return upgradeAlert;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:UpdateDistributedApplianceWindow.java

示例14: testButton

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@Test
public void testButton() {
    FButton button = new FButton().withCaption("My button")
                                  .withIcon(VaadinIcons.ARROW_BACKWARD)
                                  .withIconAlternateText("backward")
                                  .withClickListener(click -> System.out.println("clicked"))
                                  .withClickShortcut(ShortcutAction.KeyCode.ENTER, null)
                                  .withBlurListener(blur -> System.out.println("lost focus"))
                                  .withFocusListener(focus -> System.out.println("gain focus"))
                                  .withTabIndex(5)
                                  .withDisableOnClick(true);

    assertEquals("My button", button.getCaption());
    assertEquals(VaadinIcons.ARROW_BACKWARD, button.getIcon());
    assertEquals("backward", button.getIconAlternateText());
    assertEquals(5, button.getTabIndex());
    assertEquals(1, button.getListeners(ClickEvent.class).size());
    assertEquals(1, button.getListeners(FocusEvent.class).size());
    assertEquals(1, button.getListeners(BlurEvent.class).size());
    assertTrue(button.getClickShortcut() != null);
    assertTrue(button.isDisableOnClick());

}
 
開發者ID:viydaag,項目名稱:vaadin-fluent-api,代碼行數:24,代碼來源:FButtonTest.java

示例15: testNativeButton

import com.vaadin.ui.Button.ClickEvent; //導入依賴的package包/類
@Test
public void testNativeButton() {
    FNativeButton button = new FNativeButton().withCaption("My button")
                                              .withIcon(VaadinIcons.ARROW_BACKWARD)
                                              .withIconAlternateText("backward")
                                              .withClickListener(click -> System.out.println("clicked"))
                                              .withClickShortcut(ShortcutAction.KeyCode.ENTER, null)
                                              .withBlurListener(blur -> System.out.println("lost focus"))
                                              .withFocusListener(focus -> System.out.println("gain focus"))
                                              .withTabIndex(5)
                                              .withDisableOnClick(true);

    assertEquals("My button", button.getCaption());
    assertEquals(VaadinIcons.ARROW_BACKWARD, button.getIcon());
    assertEquals("backward", button.getIconAlternateText());
    assertEquals(5, button.getTabIndex());
    assertEquals(1, button.getListeners(ClickEvent.class).size());
    assertEquals(1, button.getListeners(FocusEvent.class).size());
    assertEquals(1, button.getListeners(BlurEvent.class).size());
    assertTrue(button.isDisableOnClick());

}
 
開發者ID:viydaag,項目名稱:vaadin-fluent-api,代碼行數:23,代碼來源:FButtonTest.java


注:本文中的com.vaadin.ui.Button.ClickEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。