List of usage examples for com.vaadin.ui GridLayout GridLayout
public GridLayout(int columns, int rows)
From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationView.java
License:Open Source License
public ReservationView() { reservationMakeView = new ReservationMakeView(); reservationTableView = new ReservationTableView(); VerticalLayout makeViewLayoutVL = reservationMakeView.getMakeViewLayout(); VerticalLayout listReservationsVL = reservationTableView.getListReservations(); GridLayout grid = new GridLayout(2, 1); grid.addComponent(makeViewLayoutVL, 0, 0); grid.addComponent(listReservationsVL, 1, 0); grid.setComponentAlignment(makeViewLayoutVL, Alignment.TOP_CENTER); grid.setComponentAlignment(listReservationsVL, Alignment.TOP_CENTER); grid.setSizeUndefined();//from w w w .j a va 2 s . c o m setSizeFull(); addComponent(grid); setComponentAlignment(grid, Alignment.TOP_CENTER); }
From source file:ch.bfh.ti.soed.hs16.srs.purple.view.ReservationView.java
License:Open Source License
/** * Shows the popup window where a reservation can be modified, deleted or inserted * @param res The Reservation Object (for a new reservation, fill the startDate with the current Timestamp!) *//*from w ww . j a v a2s . co m*/ @SuppressWarnings("serial") private void showPopup(Reservation res) { this.res = res; //Update the member boolean newRes = res.getReservationID() > 0 ? false : true; boolean isHost = isHost(actualUser, res.getHostList()); boolean isParticipant = isHost(actualUser, res.getParticipantList()); final GridLayout gridLayout = new GridLayout(3, 5); ValueChangeListener vcl = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { List<Room> roomList = resCont.getAllFreeRooms(new Timestamp(startDate.getValue().getTime()), new Timestamp(endDate.getValue().getTime())); if (ReservationView.this.res.getReservationID() > 0) { System.out.println("Aktuellen Raum"); rooms.addItem(ReservationView.this.res.getRoom().getRoomID()); rooms.setItemCaption(ReservationView.this.res.getRoom().getRoomID(), ReservationView.this.res.getRoom().getName() + " (" + ReservationView.this.res.getRoom().getNumberOfSeats() + " Pltze)"); rooms.select(ReservationView.this.res.getRoom().getRoomID()); } for (int i = 0; i < roomList.size(); i++) { rooms.addItem(roomList.get(i).getRoomID()); String caption = roomList.get(i).getName() + " (" + roomList.get(i).getNumberOfSeats() + " Pltze)"; rooms.setItemCaption(roomList.get(i).getRoomID(), caption); } if (ReservationView.this.res.getReservationID() <= 0 && actualRoom != null) rooms.select(actualRoom.getRoomID()); } }; popUpWindow = new Window(); popUpWindow.center(); popUpWindow.setModal(true); startDate = new DateField("Startzeit"); startDate.setLocale(VaadinSession.getCurrent().getLocale()); startDate.setValue(res.getStart()); startDate.addValueChangeListener(vcl); startDate.setDateFormat("dd.MM.yyyy HH:mm"); startDate.setResolution(Resolution.HOUR); endDate = new DateField("Endzeit"); endDate.setValue(res.getEnd()); endDate.addValueChangeListener(vcl); endDate.setDateFormat("dd.MM.yyyy HH:mm"); endDate.setLocale(VaadinSession.getCurrent().getLocale()); endDate.setResolution(Resolution.HOUR); title = new TextField("Titel"); title.setValue(res.getTitle()); title.setWidth(100, Unit.PERCENTAGE); description = new TextArea("Beschreibung"); description.setValue(res.getDescription()); description.setRows(3); description.setWidth(100, Unit.PERCENTAGE); hosts = new ListSelect("Reservierender"); hosts.setMultiSelect(true); hosts.clear(); for (int i = 0; i < hostList.size(); i++) { hosts.addItem(hostList.get(i).getUserID()); hosts.setItemCaption(hostList.get(i).getUserID(), hostList.get(i).getUsername()); } //select the hosts in list if (!newRes) { List<User> resHosts = res.getHostList(); for (int i = 0; i < resHosts.size(); i++) for (int y = 0; y < hostList.size(); y++) if (hostList.get(y).getUserID() == resHosts.get(i).getUserID()) hosts.select(resHosts.get(i).getUserID()); } else hosts.select(actualUser.getUserID()); hosts.select(0); hosts.setRows(hostList.size() > 5 ? 5 : hostList.size()); participantList = new ListSelect("Teilnehmer"); participantList.setMultiSelect(true); participantList.clear(); for (int i = 0; i < participant.size(); i++) { participantList.addItem(participant.get(i).getUserID()); participantList.setItemCaption(participant.get(i).getUserID(), participant.get(i).getUsername()); } //select the participants in list if (!newRes) { List<User> resPart = res.getParticipantList(); for (int i = 0; i < resPart.size(); i++) for (int y = 0; y < participant.size(); y++) if (participant.get(y).getUserID() == resPart.get(i).getUserID()) participantList.select(resPart.get(i).getUserID()); } participantList.setRows(participant.size() > 5 ? 5 : participant.size()); rooms = new NativeSelect("Raum"); rooms.setNullSelectionAllowed(false); rooms.removeAllItems(); List<Room> roomList = resCont.getAllFreeRooms(new Timestamp(startDate.getValue().getTime()), new Timestamp(endDate.getValue().getTime())); if (!newRes) { rooms.addItem(res.getRoom().getRoomID()); rooms.setItemCaption(res.getRoom().getRoomID(), res.getRoom().getName() + " (" + res.getRoom().getNumberOfSeats() + " Pltze)"); rooms.select(res.getRoom().getRoomID()); } for (int i = 0; i < roomList.size(); i++) { rooms.addItem(roomList.get(i).getRoomID()); String caption = roomList.get(i).getName() + " (" + roomList.get(i).getNumberOfSeats() + " Pltze)"; rooms.setItemCaption(roomList.get(i).getRoomID(), caption); } if (newRes && actualRoom != null) rooms.select(actualRoom.getRoomID()); saveButton = new Button("Speichern"); saveButton.addClickListener(clButton); deleteButton = new Button("Lschen"); deleteButton.addClickListener(clButton); deleteButton.setVisible(res.getReservationID() > 0 ? true : false); if (!newRes) setEditable(false); gridLayout.addComponent(startDate, 0, 0); gridLayout.addComponent(endDate, 0, 1); gridLayout.addComponent(hosts, 1, 0, 1, 1); gridLayout.addComponent(participantList, 2, 0, 2, 1); gridLayout.addComponent(title, 0, 2); gridLayout.addComponent(rooms, 1, 2, 2, 2); gridLayout.addComponent(description, 0, 3, 1, 3); if (roomList.size() == 0) saveButton.setEnabled(false); if (isHost || newRes) //show buttons for edit and delete only if the user is host or its a new reservation { gridLayout.addComponent(saveButton, 0, 4); gridLayout.addComponent(deleteButton, 1, 4); } if (isParticipant) //show buttons for accept oder decline a reservation { acceptButton = new Button("Zusagen"); rejectButton = new Button("Absagen"); acceptButton.addClickListener(clButton); rejectButton.addClickListener(clButton); if (isHost(actualUser, res.getAcceptedParticipantsList())) { acceptButton.setEnabled(false); rejectButton.setEnabled(true); } else { rejectButton.setEnabled(false); acceptButton.setEnabled(true); } gridLayout.addComponent(acceptButton, 0, 4); gridLayout.addComponent(rejectButton, 1, 4); } gridLayout.setSpacing(true); gridLayout.setMargin(new MarginInfo(false, false, false, true)); gridLayout.setWidth(100, Unit.PERCENTAGE); popUpWindow.setContent(gridLayout); popUpWindow.setWidth("600px"); popUpWindow.setHeight("450px"); popUpWindow.setCaption(res.getReservationID() > 0 ? "Reservierungsdetails" : "Neue Reservierung"); UI.getCurrent().addWindow(popUpWindow); }
From source file:ch.bfh.ti.soed.hs16.srs.view.views.BookerView.java
License:Open Source License
public BookerView(Navigator nav) { /* init objects */ this.layout = new GridLayout(6, 6); this.menu = new Menu(nav); this.bookerController = new BookerController(); /* add components to layout */ layout.addComponent(menu.getLayout(), 0, 0, 5, 0); grid.setWidth("1000px"); layout.addComponent(this.grid); setCompositionRoot(layout);/*from w w w . j av a2s. c o m*/ setSizeFull(); }
From source file:ch.bfh.ti.soed.hs16.srs.view.views.RoomView.java
License:Open Source License
public RoomView(Navigator nav) { /* init objects */ this.layout = new GridLayout(6, 6); this.menu = new Menu(nav); this.roomController = new RoomController(); /* add components to layout */ this.layout.addComponent(menu.getLayout(), 0, 0, 5, 0); this.grid.setWidth("1000px"); this.layout.addComponent(this.grid); setCompositionRoot(this.layout); setSizeFull();/*from ww w . j a v a 2 s . co m*/ }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.subviews.RoomsView.java
License:Open Source License
@Override public Component createHeader() { GridLayout headerGrid = new GridLayout(3, 1); headerGrid.setStyleName("table-parent"); Label labelID = new Label("ID"); labelID.setStyleName("display-table-header"); Label labelName = new Label("Name"); labelName.setStyleName("display-table-header"); Label labelSeats = new Label("Seats Available"); labelSeats.setStyleName("display-table-header"); headerGrid.addComponent(labelID);//from w w w .ja va2 s . c o m headerGrid.addComponent(labelName); headerGrid.addComponent(labelSeats); return headerGrid; }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.subviews.UsersView.java
License:Open Source License
@Override public Component createHeader() { GridLayout headerGrid = new GridLayout(4, 1); headerGrid.setStyleName("table-parent"); Label labelID = new Label("ID"); labelID.setStyleName("display-table-header"); Label labelFName = new Label("First Name"); labelFName.setStyleName("display-table-header"); Label labelLName = new Label("Last Name"); labelLName.setStyleName("display-table-header"); Label labelEMail = new Label("E-Mail"); labelEMail.setStyleName("display-table-header"); headerGrid.addComponent(labelID);/*w ww . j a v a 2 s . c om*/ headerGrid.addComponent(labelFName); headerGrid.addComponent(labelLName); headerGrid.addComponent(labelEMail); return headerGrid; }
From source file:com.anphat.customer.ui.CustomerCareHistoryDialog.java
private void buildGridCareHistory() { gridCareHistoryLayout = new GridLayout(2, 4); CommonUtils.setBasicAttributeLayout(gridCareHistoryLayout, BundleUtils.getString("label.history.care.caption"), false); locale = (Locale) VaadinSession.getCurrent().getAttribute("locale"); if (locale == null) { locale = new Locale("vi"); }//from w w w . j a v a 2 s. c om dfDateTracking = new DateField(BundleUtils.getString("customerCareHistoryForm.dateTracking")); dfDateTracking.setWidth("100%"); dfDateTracking.setImmediate(true); dfDateTracking.setLocale(locale); gridCareHistoryLayout.addComponent(dfDateTracking, 0, 3); taNotes = new TextArea(BundleUtils.getString("customerCareHistoryForm.notes")); taNotes.setRequired(true); taNotes.setWidth("100%"); gridCareHistoryLayout.addComponent(taNotes, 0, 2, 1, 2); cbxService = CommonUtils.buildComboBox(BundleUtils.getString("term.information.service")); cbxService.setNullSelectionAllowed(true); gridCareHistoryLayout.addComponent(cbxService, 0, 0); cbxCustomerServiceStatus = CommonUtils.buildComboBox(BundleUtils.getString("customerStatusForm.status")); cbxCustomerServiceStatus.setNullSelectionAllowed(true); gridCareHistoryLayout.addComponent(cbxCustomerServiceStatus, 1, 3); f9Contact = new MappingCombobox(BundleUtils.getString("customer.contact.name"), BundleUtils.getString("customerCareHistoryForm.telNumber")); gridCareHistoryLayout.addComponent(f9Contact.getLayout(), 1, 0); btnAddContact = new Button(BundleUtils.getString("label.customer.contact.addNew")); btnAddContact.addStyleName("v-button-link"); btnAddContact.setDisableOnClick(true); ShortcutUtils.setShortkeyF2(btnAddContact); gridCareHistoryLayout.addComponent(btnAddContact, 1, 1); mainLayout.addComponent(gridCareHistoryLayout); GridManyButton gridManyButton = CommonUtils.getCommonButtonDialog(this); btnSave = gridManyButton.getBtnCommon().get(0); mainLayout.addComponent(gridManyButton); DataUtil.addFocusWindow(this, taNotes); }
From source file:com.anphat.customer.ui.CustomerContactDialog.java
private void buildGridCustomerContact() { gridCustomerContact = new GridLayout(4, 1); gridCareHistory = new GridLayout(6, 3); locale = (Locale) VaadinSession.getCurrent().getAttribute("locale"); if (locale == null) { locale = new Locale("vi"); }//from ww w. j a v a 2 s . c om CommonUtils.setBasicAttributeLayout(gridCustomerContact, "", false); CommonUtils.setBasicAttributeLayout(gridCareHistory, BundleUtils.getString("label.history.care.caption"), true); txtName = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.name"), 100); txtEmail = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.email"), 100); txtTelNumber = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.telNumber"), 100); txtRegency = CommonUtils.buildTextField(BundleUtils.getString("customer.contact.regency"), 100); dfDateTracking = new DateField(BundleUtils.getString("customerCareHistoryForm.dateTracking")); dfDateTracking.setWidth("100%"); dfDateTracking.setImmediate(true); dfDateTracking.setLocale(locale); taNotes = new TextArea(BundleUtils.getString("customerCareHistoryForm.notes")); taNotes.setRequired(true); taNotes.setWidth("100%"); // cboStatus = CommonUtils.buildComboBox(BundleUtils.getString("customerStatusForm.status")); // cboStatus.setNullSelectionAllowed(true); cboRegency = CommonUtils.buildComboBox("customer.contact.regency"); gridStatusButton = new GridLayout(1, 2); // gridStatusButton.setWidth("100%"); gridCustomerContact.addComponent(txtName, 0, 0); gridCustomerContact.addComponent(txtEmail, 1, 0); gridCustomerContact.addComponent(txtTelNumber, 2, 0); gridCustomerContact.addComponent(cboRegency, 3, 0); gridStatusButton.addComponent(dfDateTracking, 0, 1); ogCustStatus = getCustomerStatus(); ogCustStatus.setMultiSelect(false); ogCustStatus.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); ogCustStatus.setItemCaptionPropertyId("parName"); ogCustStatus.addStyleName("horizontal"); gridStatusButton.addComponent(ogCustStatus, 0, 0); gridCareHistory.addComponent(gridStatusButton, 0, 0, 5, 0); gridCareHistory.addComponent(taNotes, 0, 2, 5, 2); mainLayout.addComponent(gridCustomerContact); mainLayout.addComponent(gridCareHistory); lstRegency = DataUtil.getListApParams(Constants.APP_PARAMS.CUSTOMER_CONTACT_REGENCY); String valueRegencyDefault = Constants.NULL; if (!DataUtil.isListNullOrEmpty(lstRegency)) { valueRegencyDefault = lstRegency.get(0).getParCode(); } combo = new ComboComponent(); combo.fillDataCombo(cboRegency, Constants.NULL, valueRegencyDefault, lstRegency, Constants.APP_PARAMS.CUSTOMER_CONTACT_REGENCY); // combo.fillDataCombo(cboStatus, Constants.NULL, valueRegencyDefault, lstCustomerStatus, Constants.APP_PARAMS.CUSTOMER_SERVICE_STATUS); GridManyButton gridManyButton = CommonUtils.getCommonButtonDialog(this); btnSave = gridManyButton.getBtnCommon().get(0); mainLayout.addComponent(gridManyButton); // DataUtil.addFocusWindow(this, txtName); }
From source file:com.anphat.customer.ui.CustomerDetailForm.java
private GridLayout buildGridDetail() { gridCustDetail = new GridLayout(4, 2); CommonUtils.setBasicAttributeLayout(gridCustDetail, GRID_UPLOAD_CAPTION, false); Label lbTaxCode = CommonUtils.buildLabel(BundleUtils.getString("customer.code"), true); Label lbName = CommonUtils.buildLabel(BundleUtils.getString("customer.name"), true); // Label lbDeployAddress = CommonUtils.buildLabel(BundleUtils.getString("customer.deployAddress"), true); // Label lbOfficeAddress = CommonUtils.buildLabel(BundleUtils.getString("customer.officeAddress"), true); Label lbTaxAuthority = CommonUtils.buildLabel(BundleUtils.getString("label.taxAuthority"), true); // Label lbTaxDepartment = CommonUtils.buildLabel(BundleUtils.getString("customer.taxDepartment"), true); // Label lbStatus = CommonUtils.buildLabel(BundleUtils.getString("customer.status"), true); txtTaxCode = CommonUtils.buildLabel("", false); txtName = CommonUtils.buildLabel("", false); // txtDeployAddress = CommonUtils.buildLabel("", false); // txtOfficeAddress = CommonUtils.buildLabel("", false); // txtTaxDepartment = CommonUtils.buildLabel("", false); txtTaxAuthority = CommonUtils.buildLabel("", false); // txtStatus = CommonUtils.buildLabel("", false); gridCustDetail.addComponent(lbTaxCode, 0, 0); gridCustDetail.addComponent(txtTaxCode, 1, 0); // gridCustDetail.addComponent(lbStatus, // 2, 0); // gridCustDetail.addComponent(txtStatus, // 3, 0); gridCustDetail.addComponent(lbName, 0, 1); gridCustDetail.addComponent(txtName, 1, 1, 3, 1); gridCustDetail.addComponent(lbTaxAuthority, 2, 0); gridCustDetail.addComponent(txtTaxAuthority, 3, 0); // gridCustDetail.addComponent(lbTaxDepartment, // 2, 2); // gridCustDetail.addComponent(txtTaxDepartment, // 3, 2); // gridCustDetail.addComponent(lbDeployAddress, // 0, 3); // gridCustDetail.addComponent(txtDeployAddress, // 1, 3, 3, 3); // gridCustDetail.addComponent(lbOfficeAddress, // 0, 4); // gridCustDetail.addComponent(txtOfficeAddress, // 1, 4, 3, 4); return gridCustDetail; }
From source file:com.anphat.customer.ui.ImportCustomerUploadForm.java
private GridLayout buildGridUpload() { uploadInfoLayout = new GridLayout(4, 1); CommonUtils.setBasicAttributeLayout(uploadInfoLayout, null, false); choiceTypeUpload = CommonUtils.buildComboBox(); uploadInfoLayout.addComponent(choiceTypeUpload, 1, 0, 2, 0); // uploadInfoLayout.setComponentAlignment(choiceTypeUpload, Alignment.MIDDLE_LEFT); linkTemplate = new Link(LINK_CAPTION, FontAwesome.LINK); linkTemplate.setImmediate(true);//from ww w . j ava2 s .c o m uploadInfoLayout.addComponent(linkTemplate, 3, 0); // uploadInfoLayout.setComponentAlignment(linkTemplate, Alignment.MIDDLE_LEFT); return uploadInfoLayout; }