List of usage examples for com.vaadin.ui VerticalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.oodrive.nuage.webui.component.SnapshotItemComponent.java
License:Apache License
/** * Create delete tab in the accordion.//w w w.j a v a 2s .co m * * @return the component. */ @SuppressWarnings("serial") private final AbstractComponent createDelete() { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); final Label label = new Label("Deleting a snapshot can be done, only if it is not the root snapshot."); label.setWidth(null); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); final Button deleteButton = new Button("Delete"); if (model.getItemUuid().equals(model.getSnapshotParent())) { // Root snapshot can not be deleted deleteButton.setEnabled(false); } layout.addComponent(deleteButton); layout.setComponentAlignment(deleteButton, Alignment.BOTTOM_CENTER); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final SnapshotDeleteWindow deleteWindow = new SnapshotDeleteWindow(model.getItemUuid()); deleteWindow.add(model); } catch (final Exception e) { LOGGER.error("Can not delete snapshot:", e); final ErrorWindow err = new ErrorWindow("Snapshot not deleted: " + e.getMessage()); err.add(model); } } }); return layout; }
From source file:com.oodrive.nuage.webui.component.SnapshotItemComponent.java
License:Apache License
/** * Create the component to create a device. * // w ww . j ava 2 s . c o m * @return the component */ @SuppressWarnings("serial") private final AbstractComponent createDevice() { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); final FormLayout createDeviceLayout = new FormLayout(); createDeviceLayout.setMargin(true); createDeviceLayout.setWidth(null); createDeviceLayout.setImmediate(true); layout.addComponent(createDeviceLayout); layout.setComponentAlignment(createDeviceLayout, Alignment.MIDDLE_CENTER); // Enter name final TextField deviceName = new TextField("Name", ""); createDeviceLayout.addComponent(deviceName); // Enter size final TextField deviceSize = new TextField("Size", ""); createDeviceLayout.addComponent(deviceSize); // Create button final Button create = new Button("Create device"); layout.addComponent(create); layout.setComponentAlignment(create, Alignment.MIDDLE_CENTER); create.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { model.createDevice(deviceName.getValue(), Long.valueOf(deviceSize.getValue())); Notification.show("New device created", Notification.Type.TRAY_NOTIFICATION); } catch (final NumberFormatException e) { final ErrorWindow err = new ErrorWindow("Size must be a valid number"); err.add(model); } catch (final Exception e) { final ErrorWindow err = new ErrorWindow("Device not created: " + e.getMessage()); err.add(model); } } }); return layout; }
From source file:com.oodrive.nuage.webui.component.window.AbstractConfirmationWindow.java
License:Apache License
@SuppressWarnings("serial") @Override//from ww w .j a va 2 s .com public Window init(final AbstractItemModel model) { // Add new window final Window vvrConfirmationWindow = new Window("Confirmation"); vvrConfirmationWindow.center(); vvrConfirmationWindow.setResizable(false); final VerticalLayout vvrConfirmationLayout = new VerticalLayout(); vvrConfirmationLayout.setMargin(true); vvrConfirmationWindow.setContent(vvrConfirmationLayout); // Message to display before buttons final Label confirmationMessage = new Label(confirmation); vvrConfirmationLayout.addComponent(confirmationMessage); vvrConfirmationLayout.setComponentAlignment(confirmationMessage, Alignment.MIDDLE_CENTER); vvrConfirmationLayout.setSpacing(true); final HorizontalLayout buttonLayout = new HorizontalLayout(); vvrConfirmationLayout.addComponent(buttonLayout); // Button OK final Button okButton = new Button("OK"); buttonLayout.setSizeFull(); buttonLayout.addComponent(okButton); buttonLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); okButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { action.execute(model); vvrConfirmationWindow.close(); } catch (final Exception e) { vvrConfirmationWindow.close(); } } }); // Button cancel final Button cancelButton = new Button("Cancel"); buttonLayout.addComponent(cancelButton); buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); cancelButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { // Just close the window vvrConfirmationWindow.close(); } }); return vvrConfirmationWindow; }
From source file:com.oodrive.nuage.webui.component.window.ErrorWindow.java
License:Apache License
@SuppressWarnings("serial") @Override/*from w ww.j a va 2 s . c om*/ public final Window init(final AbstractItemModel model) { // Add new window with title "Error" final Window vvrErrorWindow = new Window("Error"); vvrErrorWindow.center(); vvrErrorWindow.setResizable(false); final VerticalLayout vvrErrorLayout = new VerticalLayout(); vvrErrorLayout.setMargin(true); vvrErrorWindow.setContent(vvrErrorLayout); // Display message final Label errorMessage = new Label(message); vvrErrorLayout.addComponent(errorMessage); vvrErrorLayout.setComponentAlignment(errorMessage, Alignment.MIDDLE_CENTER); vvrErrorLayout.setSpacing(true); // Button OK final Button okButton = new Button("OK"); vvrErrorLayout.addComponent(okButton); vvrErrorLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER); okButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { // Just close the window vvrErrorWindow.close(); } }); return vvrErrorWindow; }
From source file:com.oodrive.nuage.webui.component.window.VvrAttributesWindow.java
License:Apache License
@SuppressWarnings("serial") @Override/*www. j a v a 2 s. c o m*/ public final Window init(final AbstractItemModel model) { // Cast model in vvrModel final VvrModel vvrModel = (VvrModel) model; // Add new window final Window vvrAttributesWindow = new Window("VVR Attributes"); vvrAttributesWindow.center(); vvrAttributesWindow.setWidth("400px"); vvrAttributesWindow.setResizable(false); final VerticalLayout layout = new VerticalLayout(); vvrAttributesWindow.setContent(layout); layout.setMargin(true); final FormLayout vvrAttributesLayout = new FormLayout(); layout.addComponent(vvrAttributesLayout); vvrAttributesLayout.setMargin(true); // Enter NAME String value = vvrModel.getVvrName(); if (value == null) { value = ""; } final TextField name = new TextField("Name", value); name.setSizeFull(); vvrAttributesLayout.addComponent(name); // Enter description value = vvrModel.getVvrDescription(); if (value == null) { value = ""; } final TextField desc = new TextField("Description", value); desc.setSizeFull(); vvrAttributesLayout.addComponent(desc); // Enter name final TextField vvrUUID = new TextField("UUID"); vvrUUID.setValue(vvrUuid.toString()); vvrUUID.setReadOnly(true); vvrUUID.setSizeFull(); vvrAttributesLayout.addComponent(vvrUUID); // OK button final HorizontalLayout hzlayout = new HorizontalLayout(); layout.addComponent(hzlayout); hzlayout.setSizeFull(); final Button okButton = new Button("OK"); hzlayout.addComponent(okButton); hzlayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); okButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { WaitingComponent.executeBackground(vvrModel, new Background() { @Override public void processing() { vvrModel.setVvrName(name.getValue()); vvrModel.setVvrDescription(desc.getValue()); } @Override public void postProcessing() { } }); vvrAttributesWindow.close(); } }); // Cancel button final Button cancelButton = new Button("Cancel"); hzlayout.addComponent(cancelButton); hzlayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); cancelButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { // Just close the window vvrAttributesWindow.close(); } }); return vvrAttributesWindow; }
From source file:com.openhris.administrator.ChangePassword.java
public ComponentContainer layout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/* ww w . j av a 2 s . c o m*/ vlayout.setMargin(true); vlayout.setSizeFull(); vlayout.setImmediate(true); final PasswordField currentPassword = createPasswordField("Current Password: "); vlayout.addComponent(currentPassword); final PasswordField newPassword = createPasswordField("New Password: "); vlayout.addComponent(newPassword); final PasswordField rePassword = createPasswordField("Re-enter Password: "); vlayout.addComponent(rePassword); Button changeBtn = new Button("UPDATE PASSWORD"); changeBtn.setWidth("100%"); changeBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (!adminService.checkEnteredPasswordIfCorrect(getUserId(), currentPassword.getValue().toString().toLowerCase().trim())) { getWindow().showNotification("Incorrect Password, contact your Administrator!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (!newPassword.getValue().toString().toLowerCase().trim() .equals(rePassword.getValue().toString().toLowerCase().trim())) { getWindow().showNotification("Entered Password do not Match!", Window.Notification.TYPE_WARNING_MESSAGE); return; } boolean result = adminService.updateUserPassword(getUserId(), rePassword.getValue().toString().toLowerCase().trim()); if (result) { GlobalVariables.setLogoutAfterPasswordChange(true); close(); } else { GlobalVariables.setLogoutAfterPasswordChange(false); getWindow().showNotification("Change Password SQL Error!, Contact your DBA", Window.Notification.TYPE_ERROR_MESSAGE); return; } } }); vlayout.addComponent(changeBtn); return vlayout; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
VerticalLayout scheduleLayout() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true);/*from w w w . j a va2s. c o m*/ eventType = createEventTypelect(); layout.addComponent(eventType); startDate = createDateField("Start Date: "); layout.addComponent(startDate); endDate = createDateField("End Date: "); layout.addComponent(endDate); caption = createTextField("Caption: "); layout.addComponent(caption); location = createTextField("Where: "); layout.addComponent(location); description = new TextArea("Description: "); description.setWidth("100%"); description.setRows(3); layout.addComponent(description); color = createStyleNameSelect(); layout.addComponent(color); saveEventButton = new Button("SAVE", saveEventBtnListener); saveEventButton.setWidth("100%"); deleteEventButton = new Button("DELETE", deleteEventBtnListener); deleteEventButton.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setWidth("100%"); buttons.addComponent(deleteEventButton); buttons.addComponent(saveEventButton); // buttons.addComponent(editEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); return layout; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
VerticalLayout populateSchedule(CalendarComponentEvents.EventClick event) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true);// w ww . ja v a2s . c om eventType = createEventTypelect(); eventType.setValue(basicEvent.getEventType()); layout.addComponent(eventType); startDate = createDateField("Start Date: "); startDate.setValue(event.getCalendarEvent().getStart()); layout.addComponent(startDate); endDate = createDateField("End Date: "); endDate.setValue(event.getCalendarEvent().getEnd()); layout.addComponent(endDate); caption = createTextField("Caption: "); caption.setValue(event.getCalendarEvent().getCaption()); layout.addComponent(caption); location = createTextField("Where: "); location.setValue(getBasicEvent().getLocation()); layout.addComponent(location); description = new TextArea("Description: "); description.setWidth("100%"); description.setRows(3); description.setValue(event.getCalendarEvent().getDescription()); layout.addComponent(description); color = createStyleNameSelect(); color.setValue(basicEvent.getStyleName()); layout.addComponent(color); eventDataId = createTextField("id: "); eventDataId.setValue(getBasicEvent().getEventId()); eventDataId.setVisible(false); layout.addComponent(eventDataId); editEventButton = new Button("EDIT", editEventBtnListener); editEventButton.setWidth("100%"); deleteEventButton = new Button("DELETE", deleteEventBtnListener); deleteEventButton.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setWidth("100%"); buttons.addComponent(deleteEventButton); buttons.addComponent(editEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); return layout; }
From source file:com.openhris.commons.AboutHris.java
public Window aboutHris() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/* w w w .jav a 2s .c o m*/ vlayout.setMargin(true); final Window subWindow = new Window("About HRMS", vlayout); subWindow.setWidth("300px"); Label version = new Label("Version: <b>1.0</b>"); version.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(version); Label title = new Label("Title: <b>Human Resource Information System</b>"); title.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(title); Label developer = new Label("Developed By: <b>Engr. Godfrey D. Beray</b>"); developer.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(developer); Label framework = new Label("Framework: <b>VAADIN - Sept2012</b>"); framework.setContentMode(Label.CONTENT_XHTML); subWindow.addComponent(framework); return subWindow; }
From source file:com.openhris.employee.allowance.EmployeeAllowanceInformation.java
Window remarks(final String buttonCaption) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true);//from ww w . j a va 2 s .c om remarksSubWindow = new Window("REMARKS", v); remarksSubWindow.setWidth("400px"); remarksSubWindow.setModal(true); remarksSubWindow.center(); remarks = new TextArea("Add Remarks: "); remarks.setWidth("100%"); remarks.setRows(3); remarksSubWindow.addComponent(remarks); Button b = new Button(buttonCaption); b.setWidth("100%"); b.addListener(updateClickListener); remarksSubWindow.addComponent(b); return remarksSubWindow; }