com.vaadin.ui.Button.ClickEvent Java Examples

The following examples show how to use com.vaadin.ui.Button.ClickEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColumnSelectionWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeButton() {
	self.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit
				//
				self.textFieldColumn.commit();
				//
				// If we get here, the value is valid.
				// Mark ourselves as saved and close the window
				//
				self.isSaved = true;
				self.close();
			} catch (SourceException | InvalidValueException e) {
				//
				// Vaadin will display error
				//
			}
		}
	});
}
 
Example #2
Source File: LoadBalancerButtonsBottom.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
private void deleteButtonClick(ClickEvent event) {
    final LoadBalancerDto dto = (LoadBalancerDto) sender.loadBalancerPanel.loadBalancerTable.getValue();

    String message = ViewMessages.getMessage("IUI-000056", dto.getLoadBalancer().getLoadBalancerName());
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancel);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }

            delete(dto.getLoadBalancer().getLoadBalancerNo());
        }
    });
    getApplication().getMainWindow().addWindow(dialog);
}
 
Example #3
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
private void okButtonClick(ClickEvent event) {
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatform().getPlatformType())) {
        updateAwsInstance();
    } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platform.getPlatform().getPlatformType())) {
        updateVmwareInstance();
    } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platform.getPlatform().getPlatformType())) {
        updateNiftyInstance();
    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatform().getPlatformType())) {
        updateCloudstackInstance();
    } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platform.getPlatform().getPlatformType())) {
        updateVcloudInstance();
    } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatform().getPlatformType())) {
        updateAzureInstance();
    } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatform().getPlatformType())) {
        updateOpenstackInstance();
    }
}
 
Example #4
Source File: WinCloudStackLoadBalancerEdit.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
private void editButtonClick(ClickEvent event) {
    // 入力チェック
    basicTab.commentField.validate();
    basicTab.algorithmSelect.validate();
    basicTab.publicPortField.validate();
    basicTab.privatePortField.validate();

    LoadBalancerService loadBalancerService = BeanContext.getBean(LoadBalancerService.class);

    // 入力値を取得
    String comment = (String) basicTab.commentField.getValue();
    Long componentNo = (Long) basicTab.serviceSelect.getValue();
    String algorithm = (String) basicTab.algorithmSelect.getValue();
    String publicPort = (String) basicTab.publicPortField.getValue();
    String privatePort = (String) basicTab.privatePortField.getValue();

    // ロードバランサを変更
    String loadBalancerName = loadBalancer.getLoadBalancer().getLoadBalancerName();
    loadBalancerService.updateCloudstackLoadBalancer(loadBalancerNo, loadBalancerName, comment, componentNo,
            algorithm, publicPort, privatePort);

    // 画面を閉じる
    close();
}
 
Example #5
Source File: DisableGoogleAuthenticatorCredentialClickListenerTest.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final DisableGoogleAuthenticatorCredentialRequest request = new DisableGoogleAuthenticatorCredentialRequest();		
	final DisableGoogleAuthenticatorCredentialClickListener listener = Mockito.spy(new DisableGoogleAuthenticatorCredentialClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final DisableGoogleAuthenticatorCredentialResponse response = new DisableGoogleAuthenticatorCredentialResponse(ServiceResult.FAILURE);
	response.setErrorMessage("errorMessage");
	Mockito.when(applicationManager.service(request)).thenReturn(response);
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #6
Source File: LogoutClickListenerTest.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final LogoutRequest request = new LogoutRequest();		
	final LogoutClickListener listener = Mockito.spy(new LogoutClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final LogoutResponse response = new LogoutResponse(ServiceResult.FAILURE);
	response.setErrorMessage("errorMessage");
	Mockito.when(applicationManager.service(request)).thenReturn(response);
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #7
Source File: FilterByStatusLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void buttonClick(final ClickEvent event) {
    buttonClicked = event.getButton();
    if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.UNKNOWN.toString())) {
        processUnknownFilterStatus();
    } else if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.IN_SYNC.toString())) {
        processInSyncFilterStatus();
    } else if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.PENDING.toString())) {
        processPendingFilterStatus();
    } else if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.ERROR.toString())) {
        processErrorFilterStatus();
    } else if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.REGISTERED.toString())) {
        processRegisteredFilterStatus();
    } else if (event.getButton().getCaption().equalsIgnoreCase(OVERDUE_CAPTION)) {
        processOverdueFilterStatus();
    }
}
 
Example #8
Source File: RemoveAction.java    From jdal with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void buttonClick(ClickEvent event) {
	
	final TableComponent<?> table = getTable();
	final Collection<?> selected = table.getSelected();
	
	if (selected.isEmpty())  // nothing to delete
		return;
	
	Command command = new DefaultCommand() {
		public boolean execute(Object data) {
			table.delete(selected);
			table.refresh();
			return true;
		}
	};

	String message = messageSource.getMessage("removeAction.confirm", new Object[] {
			selected.size() }); 
	FormUtils.showConfirmDialog(getTable().getUI(), command, message);
}
 
Example #9
Source File: JobLogTable.java    From chipster with MIT License 6 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Button link = new Button("Output");
	link.setStyleName(BaseTheme.BUTTON_LINK);
	link.setDescription("Show job output");

	link.addClickListener(new Button.ClickListener() {

		public void buttonClick(ClickEvent event) {

			select(itemId);
			view.showOutput(itemId);
		}
	});

	return link;
}
 
Example #10
Source File: TimesheetDayChangeViewImplEx.java    From vaadinator with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeUi() {
	super.initializeUi();
	// change default behavior: store the day in the section caption (and
	// hide the day field)
	super.day.setVisible(false);
	setSectionCaption(day);
	plusEntry.addClickListener(new ClickListener() {

		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			observer.onAdditionalEntry();
		}
	});
	layout.addComponent(plusEntry);
}
 
Example #11
Source File: SubSetSelector.java    From viritin with Apache License 2.0 6 votes vote down vote up
/**
 * Sets a form which can be used to add new items to the selection. A button
 * to add new instances is displayed if this method is called.
 *
 * @param newInstanceForm the form
 */
public void setNewInstanceForm(AbstractForm<ET> newInstanceForm) {
    this.newInstanceForm = newInstanceForm;
    if (newInstanceForm != null) {
        if (newInstanceBtn == null) {
            newInstanceBtn = new MButton(VaadinIcons.PLUS)
                    .withStyleName(ValoTheme.BUTTON_ICON_ONLY);
            newInstanceBtn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    addEntity(null);
                }
            });
            toprow.add(newInstanceBtn);
        }
    } else if (newInstanceBtn != null) {
        toprow.removeComponent(newInstanceBtn);
        newInstanceBtn = null;
    }
}
 
Example #12
Source File: CSCTextToToolClickListener.java    From chipster with MIT License 6 votes vote down vote up
@Override
public void buttonClick(ClickEvent event) {
	
	ChipsterSADLParser parser = new ChipsterSADLParser();
	try {
		SADLDescription description = parser.parse(root.getTextEditor().getHeader());
		root.getToolEditor().removeItems();
		root.getTreeToolEditor().removeAllChildren();
		root.getToolEditor().addTool(description);
		List<Input> inputs = description.getInputs();
		for(int i = 0 ; i < inputs.size(); i++) {
			root.getToolEditor().addInput(inputs.get(i));
		}
		List<Output> outputs = description.getOutputs();
		for(int i = 0 ; i < outputs.size(); i++) {
			root.getToolEditor().addOutput(outputs.get(i));
		}
		List<Parameter> parameters = description.getParameters();
		for(int i = 0 ; i < parameters.size(); i++) {
			root.getToolEditor().addParameter(parameters.get(i));
		}
		
	} catch (Exception e) {
		new Notification("Something wrong with the header\n\n" + e.getMessage(), Type.WARNING_MESSAGE).show(Page.getCurrent());
	}
}
 
Example #13
Source File: VariableDefinitionEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeButton() {
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit it
				//
				self.textFieldID.commit();
				//
				// Save it
				//
				self.variable.setVariableId(self.textFieldID.getValue());
				self.isSaved = true;
				//
				// Close window
				//
				self.close();
			} catch (SourceException | InvalidValueException e) {
			}
		}			
	});
}
 
Example #14
Source File: CommonDialogWindow.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void onCloseEvent(final ClickEvent clickEvent) {
    if (!clickEvent.getButton().equals(saveButton)) {
        close();
        return;
    }

    if (!closeListener.canWindowSaveOrUpdate()) {
        return;
    }
    closeListener.saveOrUpdate();

    if (closeListener.canWindowClose()) {
        close();
    }

}
 
Example #15
Source File: LoadBalancerDescBasic.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
private void addButtonClick(Button.ClickEvent event) {
    WinLoadBalancerConfigListener win = new WinLoadBalancerConfigListener(
            loadBalancer.getLoadBalancer().getLoadBalancerNo(), null);
    win.addListener(new Window.CloseListener() {
        @Override
        public void windowClose(Window.CloseEvent e) {
            refreshTable();
        }
    });

    getWindow().addWindow(win);
}
 
Example #16
Source File: RegisterUserClickListener.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public void buttonClick(final ClickEvent event) {
	final ServiceResponse response = getApplicationManager().service(reqisterRequest);
	if (ServiceResult.SUCCESS == response.getResult()) {
		LOGGER.info(LOG_MSG_REGISTER_USER,reqisterRequest.getUsername());
		UI.getCurrent().getNavigator().navigateTo(UserViews.USERHOME_VIEW_NAME);
	} else {
		showNotification(REGISTER_FAILED,
				response.getErrorMessage(),
                  Notification.Type.WARNING_MESSAGE);
		LOGGER.info(REGISTER_USER_FAILURE,reqisterRequest.getUsername());
	}
}
 
Example #17
Source File: ButtonBar.java    From jdal with Apache License 2.0 5 votes vote down vote up
@Override
public void buttonClick(ClickEvent event) {
	Button selected = event.getButton();
	selected.addStyleName("selected");
	
	for (Button b : buttons) {
		if (!b.equals(event.getButton()))
			b.removeStyleName("selected");
	}
}
 
Example #18
Source File: ChangePasswordClickListener.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public final void buttonClick(final ClickEvent event) {
	final ChangePasswordResponse response = (ChangePasswordResponse) getApplicationManager().service(changePasswordRequest);

	if (ServiceResult.FAILURE == response.getResult()) {
		showNotification(PROBLEM_CHANGING_PASSWORD, response.getErrorMessage(), Notification.Type.WARNING_MESSAGE);
		LOGGER.info(PROBLEM_CHANGING_PASSWORD_SESSIONID, changePasswordRequest.getSessionId());
	}
}
 
Example #19
Source File: UpdateApplicationConfigurationClickListenerTest.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final UpdateApplicationConfigurationRequest request = new UpdateApplicationConfigurationRequest();		
	final UpdateApplicationConfigurationClickListener listener = Mockito.spy(new UpdateApplicationConfigurationClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	Mockito.when(applicationManager.service(request)).thenReturn(new UpdateApplicationConfigurationResponse(ServiceResult.FAILURE));
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #20
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
private void editButtonClick(ClickEvent event) {
    InstanceNetworkDto instanceNetwork = (InstanceNetworkDto) networkTable.getValue();
    WinServerNetworkConfig winServerDataDiskConfig = new WinServerNetworkConfig(getApplication(),
            instance.getInstance().getInstanceNo(), instance.getInstance().getPlatformNo(), instanceNetwork,
            instanceNetworks);
    winServerDataDiskConfig.addListener(new Window.CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            //テーブル再表示
            networkTable.loadData();
            networkTable.show();
        }
    });
    getWindow().getApplication().getMainWindow().addWindow(winServerDataDiskConfig);
}
 
Example #21
Source File: UpdateSearchIndexClickListenerTest.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Show notification success test.
 */
@Test
public void showNotificationSuccessTest() {
	final UpdateSearchIndexRequest request = new UpdateSearchIndexRequest();		
	final UpdateSearchIndexClickListener listener = Mockito.spy(new UpdateSearchIndexClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final UpdateSearchIndexResponse response = new UpdateSearchIndexResponse(ServiceResult.SUCCESS);
	Mockito.when(applicationManager.asyncService(request)).thenReturn(Mockito.mock(Future.class));
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #22
Source File: StorageView.java    From chipster with MIT License 5 votes vote down vote up
public void buttonClick(ClickEvent event) {
	final Button source = event.getButton();

	if (super.isRefreshButton(source)) {
					
		update();
		updateStorageEntries(null);
	}
}
 
Example #23
Source File: ConfirmationDialog.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * TenantAwareEvent handler for button clicks.
 * 
 * @param event
 *            the click event.
 */
@Override
public void buttonClick(final ClickEvent event) {
    if (window.getParent() != null) {
        isImplicitClose = true;
        UI.getCurrent().removeWindow(window);
    }
    callback.response(event.getSource().equals(okButton));
}
 
Example #24
Source File: ServiceButtonsBottom.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
private void addButtonClick(ClickEvent event) {
    WinServiceAdd winServiceAdd = new WinServiceAdd();
    winServiceAdd.addListener(new Window.CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            refreshTable();
        }
    });

    getWindow().addWindow(winServiceAdd);
}
 
Example #25
Source File: AbstractDistributionSetDetails.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void showMetadata(final ClickEvent event) {
    final Optional<DistributionSet> ds = distributionSetManagement.get(getSelectedBaseEntityId());
    if (!ds.isPresent()) {
        uiNotification.displayWarning(getI18n().getMessage("distributionset.not.exists"));
        return;
    }
    UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds.get(), null));
}
 
Example #26
Source File: AbstractDistributionSetDetails.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void onEdit(final ClickEvent event) {
    final Window newDistWindow = distributionAddUpdateWindowLayout
            .getWindowForUpdateDistributionSet(getSelectedBaseEntityId());
    UI.getCurrent().addWindow(newDistWindow);
    newDistWindow.setVisible(Boolean.TRUE);
}
 
Example #27
Source File: ToolEditorUI.java    From chipster with MIT License 5 votes vote down vote up
private HorizontalLayout getButtonPanel() {
HorizontalLayout hLayout = new HorizontalLayout();
hLayout.setSpacing(true);

btUpdateTextEditor = new Button();
btUpdateTextEditor.setDescription("Update text area");
btUpdateTextEditor.setIcon(new ThemeResource("images/arrow_down.png"));
btUpdateTextEditor.addClickListener(new CSCToolToTextClickListener(this));
hLayout.addComponent(btUpdateTextEditor);
btUpdateToolEditor = new Button();
btUpdateToolEditor.setDescription("Update tool elements");
btUpdateToolEditor.setIcon(new ThemeResource("images/arrow_up.png"));
btUpdateToolEditor.addClickListener(new CSCTextToToolClickListener(this));
hLayout.addComponent(btUpdateToolEditor);
Button btClearAll = new Button("Clear All");
btClearAll.addClickListener(new ClickListener() {
	private static final long serialVersionUID = 1487893808578560989L;

	@Override
	public void buttonClick(ClickEvent event) {
		
		ToolEditorUI.this.addWindow(new ConfirmClearAll(ToolEditorUI.this));
	}
});
hLayout.addComponent(btClearAll);
return hLayout;

  }
 
Example #28
Source File: PolicyEditor.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeButtons() {
	//
	// The Save button
	//
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			self.savePolicy();
		}
	});
	//
	// Attach a window opener to the View XML button
	//
	BrowserWindowOpener opener = new BrowserWindowOpener(new StreamResource(new StreamResource.StreamSource() {
		private static final long serialVersionUID = 1L;

		@Override
		public InputStream getStream() {
			try {
				if (logger.isDebugEnabled()) {
					logger.debug("Setting view xml button to: " + self.file.getAbsolutePath());
				}
				return new FileInputStream(self.file);
			} catch (Exception e) {
				logger.error("Failed to open input stream " + self.file);
			}
			return null;
		}
	}, self.file.getName()));
	opener.setWindowName("_new");
	opener.extend(this.buttonViewXML);
}
 
Example #29
Source File: ServiceButtonsBottom.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
private void editButtonClick(Button.ClickEvent event) {
    ComponentDto component = (ComponentDto) sender.servicePanel.serviceTable.getValue();

    WinServiceEdit winServiceEdit = new WinServiceEdit(component.getComponent().getComponentNo());
    winServiceEdit.addListener(new Window.CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            refreshTable();
        }
    });

    getWindow().addWindow(winServiceEdit);
}
 
Example #30
Source File: StringListView.java    From jdal with Apache License 2.0 5 votes vote down vote up
@Override
public void buttonClick(ClickEvent event) {
	Object value = listSelect.getValue();
	
	if (value != null)
		listSelect.removeItem(value);
}