List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:com.mycollab.module.project.view.UserDashboardViewImpl.java
License:Open Source License
private void displaySearchResult(String value) { removeAllComponents();//from www .ja v a 2 s . c o m Component headerWrapper = setupHeader(); MVerticalLayout layout = new MVerticalLayout().withFullWidth(); with(headerWrapper, layout).expand(layout); MHorizontalLayout headerComp = new MHorizontalLayout(); ELabel headerLbl = ELabel.h2(String.format(headerTitle, value, 0)); Button backDashboard = new Button("Back to workboard", clickEvent -> showDashboard()); backDashboard.setStyleName(WebThemes.BUTTON_ACTION); headerComp.with(headerLbl, backDashboard).alignAll(Alignment.MIDDLE_LEFT); layout.with(headerComp); ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.class); prjKeys = prjService.getProjectKeysUserInvolved(UserUIContext.getUsername(), MyCollabUI.getAccountId()); if (CollectionUtils.isNotEmpty(prjKeys)) { ProjectGenericItemSearchCriteria searchCriteria = new ProjectGenericItemSearchCriteria(); searchCriteria.setPrjKeys(new SetSearchField<>(prjKeys.toArray(new Integer[prjKeys.size()]))); searchCriteria.setTxtValue(StringSearchField.and(value)); DefaultBeanPagedList<ProjectGenericItemService, ProjectGenericItemSearchCriteria, ProjectGenericItem> searchItemsTable = new DefaultBeanPagedList<>( AppContextUtil.getSpringBean(ProjectGenericItemService.class), new GenericItemRowDisplayHandler()); searchItemsTable.setControlStyle("borderlessControl"); int foundNum = searchItemsTable.setSearchCriteria(searchCriteria); headerLbl.setValue(String.format(headerTitle, value, foundNum)); layout.with(searchItemsTable).expand(searchItemsTable); } }
From source file:com.mycollab.module.user.accountsettings.team.view.GetStartedInstructionWindow.java
License:Open Source License
private void displayInfo(SimpleUser user) { Div infoDiv = new Div().appendText( "You have not setup SMTP account properly. So we can not send the invitation by email automatically. Please copy/paste below paragraph and inform to the user by yourself") .setStyle("font-weight:bold;color:red"); Label infoLbl = new Label(infoDiv.write(), ContentMode.HTML); Div userInfoDiv = new Div().appendText("Your username is ") .appendChild(new B().appendText(user.getEmail())); Label userInfoLbl = ELabel.html(userInfoDiv.write()); if (Boolean.TRUE.equals(user.getIsAccountOwner())) { user.setRoleName(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)); }// w w w . j a va2 s . co m Div roleInfoDiv = new Div().appendText("Your role is ").appendChild(new B().appendText(user.getRoleName())); Label roleInfoLbl = new Label(roleInfoDiv.write(), ContentMode.HTML); contentLayout.with(infoLbl, userInfoLbl, roleInfoLbl); final Button addNewBtn = new Button("Create another user", clickEvent -> { EventBusFactory.getInstance().post(new UserEvent.GotoAdd(GetStartedInstructionWindow.this, null)); close(); }); addNewBtn.setStyleName(WebThemes.BUTTON_ACTION); Button doneBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_DONE), clickEvent -> close()); doneBtn.setStyleName(WebThemes.BUTTON_ACTION); final MHorizontalLayout controlsBtn = new MHorizontalLayout(addNewBtn, doneBtn).withMargin(true); contentLayout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT); }
From source file:com.mycompany.controller.initUImethods.java
public void createButt(String day, Grid.MultiSelectionModel selectionOfGivenDay, Grid gridOfGivenDay, Grid.FooterRow footer) {/*from w w w. j a v a2 s.c om*/ Button buttonThisDay = new Button("Add to cart", new Button.ClickListener() { //anonim inner class @Override public void buttonClick(Button.ClickEvent e) { for (Object itemId : selectionOfGivenDay.getSelectedRows()) { Property nameOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId, "name"); Property priceOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId, "price"); Property quantityOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId, "quantity"); int price = Integer.parseInt(priceOfGiven.getValue().toString()); int quan = Integer.parseInt(quantityOfGiven.getValue().toString()); cartItems.add(new CartObject(day, nameOfGiven.getValue().toString(), price, quan, Days.valueOf(day).getPriority())); } cart.getContainerDataSource().removeAllItems(); //sorbarendezs miatt, nem a legjobb de elmegy sum = 0; gridOfGivenDay.getSelectionModel().reset(); cartItems.sort(Comparator.comparing(CartObject::getPriority)); for (CartObject cartItem : cartItems) { cart.addRow(cartItem.getDay(), cartItem.getFoodName(), cartItem.getPrice(), cartItem.getQuan()); sum += cartItem.getPrice() * cartItem.getQuan(); } footer.getCell("Mennyisg").setText(Integer.toString(sum)); } }); gridOfGivenDay.getFooterRow(0).getCell("name").setComponent(buttonThisDay); buttonThisDay.setStyleName(ValoTheme.BUTTON_FRIENDLY); }
From source file:com.mycompany.controller.initUImethods.java
public void createDeleteSelectedButton(Grid.MultiSelectionModel selectionOfCart, Grid.FooterRow footer) { Button deleteSelected = new Button("Delete Row(s)", (Button.ClickEvent e) -> { for (Object itemId : selectionOfCart.getSelectedRows()) { Property quantityOfGiven = cart.getContainerDataSource().getContainerProperty(itemId, "Mennyisg"); int price = Integer.parseInt( cart.getContainerDataSource().getContainerProperty(itemId, "?r").getValue().toString()) * Integer.parseInt(quantityOfGiven.getValue().toString()); sum -= price;//from www.java 2s. co m String foodName = cart.getContainerDataSource().getContainerProperty(itemId, "tel").getValue() .toString(); String foodDay = cart.getContainerDataSource().getContainerProperty(itemId, "Nap").getValue() .toString(); Iterator<CartObject> it = cartItems.iterator(); while (it.hasNext()) { CartObject co = it.next(); if ((co.getFoodName().equals(foodName)) && (co.getDay().equals(foodDay))) { it.remove(); } } cart.getContainerDataSource().removeItem(itemId); } cart.getSelectionModel().reset(); footer.getCell("Mennyisg").setText(Integer.toString(sum)); }); deleteSelected.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); footer.getCell("Nap").setComponent(deleteSelected); }
From source file:com.mycompany.controller.initUImethods.java
public void createDeleteAllButton(Grid.FooterRow footer) { Button bt = new Button("Clear cart", e -> { cart.getContainerDataSource().removeAllItems(); sum = 0;//w w w.j a v a 2 s . co m footer.getCell("Mennyisg").setText(Integer.toString(sum)); cartItems.clear(); }); bt.setStyleName(ValoTheme.BUTTON_DANGER); footer.getCell("tel").setComponent(bt); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java
License:Open Source License
private Layout createToolbarFormattingElements() { CssLayout wrapper = new CssLayout(); wrapper.addStyleName("toolbar-elements"); wrapper.addStyleName("toolbar-formatting"); for (int i = 0; i < 4; i++) { Button addButton = new Button(null, new Button.ClickListener() { @Override//from w w w . j a v a2 s .c o m public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addButton.setStyleName("toolbar-formatting-button"); ThemeResource tableResource = new ThemeResource("img/placeholder.png"); addButton.setIcon(tableResource); wrapper.addComponent(addButton); } return wrapper; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java
License:Open Source License
private Layout createToolbarContentElements() { ThemeResource placeHolder = new ThemeResource("img/placeholder.png"); CssLayout wrapper = new CssLayout(); wrapper.addStyleName("toolbar-elements"); Button addTableButton = new Button("table", new Button.ClickListener() { @Override// w w w. java2 s . c o m public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addTableButton.setStyleName("ax-shape-button"); ThemeResource tableResource = new ThemeResource("img/table.png"); addTableButton.setIcon(tableResource); wrapper.addComponent(addTableButton); Button addRuleButton = new Button("rule", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addRuleButton.setStyleName("ax-shape-button"); addRuleButton.setIcon(placeHolder); wrapper.addComponent(addRuleButton); Button addParagraphButton = new Button("section", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { listener.createSection("Section"); } }); addParagraphButton.setStyleName("ax-shape-button"); ThemeResource sectionResource = new ThemeResource("img/section_sign.gif"); addParagraphButton.setIcon(sectionResource); wrapper.addComponent(addParagraphButton); Button addPullQuoteButton = new Button("pullquote", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addPullQuoteButton.setStyleName("ax-shape-button"); addPullQuoteButton.setIcon(placeHolder); wrapper.addComponent(addPullQuoteButton); return wrapper; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java
License:Open Source License
private Layout createToolbarAssetsElements() { final CssLayout wrapper = new CssLayout(); wrapper.addStyleName("toolbar-elements"); final Button addPhotographButton = new Button("photograph"); addPhotographButton.addClickListener(new Button.ClickListener() { @Override/*from ww w . j ava2s.com*/ public void buttonClick(Button.ClickEvent event) { listener.openMediaGallery(); } }); addPhotographButton.setStyleName("ax-shape-button"); ThemeResource sectionResource = new ThemeResource("img/photograph.png"); addPhotographButton.setIcon(sectionResource); wrapper.addComponent(addPhotographButton); List<String> assetElements = Arrays.asList(new String[] { "video", "poll", "related link", "iFrame" }); for (String name : assetElements) { Button addButton = new Button(name, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addButton.setStyleName("ax-shape-button"); ThemeResource tableResource = new ThemeResource("img/placeholder.png"); addButton.setIcon(tableResource); wrapper.addComponent(addButton); } return wrapper; }
From source file:com.openhris.employee.EmployeePersonalInformation.java
public ComponentContainer layout() { glayout = new GridLayout(4, 19); glayout.setSpacing(true);//ww w. j av a 2s . com glayout.setWidth("600px"); glayout.setHeight("100%"); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setWidth("100px"); avatar = new Embedded(null, new ThemeResource("../myTheme/img/fnc.jpg")); avatar.setImmediate(true); avatar.setWidth(90, Sizeable.UNITS_PIXELS); avatar.setHeight(90, Sizeable.UNITS_PIXELS); avatar.addStyleName("logo-img"); imagePanel.addComponent(avatar); glayout.addComponent(avatar, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); Button uploadPhotoBtn = new Button("Upload.."); uploadPhotoBtn.setWidth("100%"); uploadPhotoBtn.setStyleName(Reindeer.BUTTON_SMALL); uploadPhotoBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, avatar, getEmployeeId()); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPhotoBtn, 0, 2); glayout.setComponentAlignment(uploadPhotoBtn, Alignment.MIDDLE_CENTER); fnField = createTextField("Firstname: "); glayout.addComponent(fnField, 1, 0); glayout.setComponentAlignment(fnField, Alignment.MIDDLE_LEFT); mnField = createTextField("Middlename: "); glayout.addComponent(mnField, 2, 0); glayout.setComponentAlignment(mnField, Alignment.MIDDLE_LEFT); lnField = createTextField("Lastname: "); glayout.addComponent(lnField, 3, 0); glayout.setComponentAlignment(lnField, Alignment.MIDDLE_LEFT); companyIdField = createTextField("Employee ID: "); companyIdField.setEnabled(false); glayout.addComponent(companyIdField, 1, 1, 2, 1); glayout.setComponentAlignment(companyIdField, Alignment.MIDDLE_LEFT); dobField = new PopupDateField("Date of Birth: "); dobField.addStyleName("mydate"); dobField.setDateFormat("MM/dd/yyyy"); dobField.setWidth("100%"); dobField.setResolution(DateField.RESOLUTION_DAY); glayout.addComponent(dobField, 1, 2); glayout.setComponentAlignment(dobField, Alignment.MIDDLE_LEFT); pobField = createTextField("Birth Place: "); pobField.setValue("N/A"); glayout.addComponent(pobField, 2, 2, 3, 2); glayout.setComponentAlignment(pobField, Alignment.MIDDLE_LEFT); genderBox = dropDownComponent.populateGenderList(new ComboBox()); genderBox.setWidth("100%"); glayout.addComponent(genderBox, 1, 3); glayout.setComponentAlignment(genderBox, Alignment.MIDDLE_LEFT); civilStatusBox = dropDownComponent.populateCivilStatusList(new ComboBox()); civilStatusBox.setWidth("100%"); glayout.addComponent(civilStatusBox, 2, 3); glayout.setComponentAlignment(civilStatusBox, Alignment.MIDDLE_LEFT); citizenshipField = createTextField("Citizenship: "); citizenshipField.setValue("N/A"); glayout.addComponent(citizenshipField, 3, 3); glayout.setComponentAlignment(citizenshipField, Alignment.MIDDLE_LEFT); heightField = createTextField("Height(cm):"); heightField.setValue(0.0); glayout.addComponent(heightField, 1, 4); glayout.setComponentAlignment(heightField, Alignment.MIDDLE_LEFT); weightField = createTextField("Weight(kg): "); weightField.setValue(0.0); glayout.addComponent(weightField, 2, 4); glayout.setComponentAlignment(weightField, Alignment.MIDDLE_LEFT); religionField = createTextField("Religion: "); religionField.setValue("N/A"); glayout.addComponent(religionField, 3, 4); glayout.setComponentAlignment(religionField, Alignment.MIDDLE_LEFT); spouseNameField = createTextField("Spouse Name: "); spouseNameField.setValue("N/A"); glayout.addComponent(spouseNameField, 1, 5, 2, 5); glayout.setComponentAlignment(spouseNameField, Alignment.MIDDLE_LEFT); spouseOccupationField = createTextField("Spouse Occupation: "); spouseOccupationField.setValue("N/A"); glayout.addComponent(spouseOccupationField, 3, 5); glayout.setComponentAlignment(spouseOccupationField, Alignment.MIDDLE_LEFT); spouseOfficeAddressField = createTextField("Spouse Office Address: "); spouseOfficeAddressField.setValue("N/A"); glayout.addComponent(spouseOfficeAddressField, 1, 6, 3, 6); glayout.setComponentAlignment(spouseOfficeAddressField, Alignment.MIDDLE_LEFT); fathersNameField = createTextField("Father's Name: "); fathersNameField.setValue("N/A"); glayout.addComponent(fathersNameField, 1, 7, 2, 7); glayout.setComponentAlignment(fathersNameField, Alignment.MIDDLE_LEFT); fathersOccupationField = createTextField("Father's Occupation: "); fathersOccupationField.setValue("N/A"); glayout.addComponent(fathersOccupationField, 3, 7); glayout.setComponentAlignment(fathersOccupationField, Alignment.MIDDLE_LEFT); mothersNameField = createTextField("Mother's Maiden Name: "); mothersNameField.setValue("N/A"); glayout.addComponent(mothersNameField, 1, 8, 2, 8); glayout.setComponentAlignment(mothersNameField, Alignment.MIDDLE_LEFT); mothersOccupationField = createTextField("Mother's Occupation: "); mothersOccupationField.setValue("N/A"); glayout.addComponent(mothersOccupationField, 3, 8); glayout.setComponentAlignment(mothersOccupationField, Alignment.MIDDLE_LEFT); parentsAddressField = createTextField("Parents Address"); parentsAddressField.setValue("N/A"); glayout.addComponent(parentsAddressField, 1, 9, 3, 9); glayout.setComponentAlignment(parentsAddressField, Alignment.MIDDLE_LEFT); dialectSpeakWriteField = createTextField("Language or Dialect you can speak or write: "); dialectSpeakWriteField.setValue("N/A"); glayout.addComponent(dialectSpeakWriteField, 1, 10, 3, 10); glayout.setComponentAlignment(dialectSpeakWriteField, Alignment.MIDDLE_LEFT); contactPersonNameField = createTextField("Contact Person: "); contactPersonNameField.setValue("N/A"); glayout.addComponent(contactPersonNameField, 1, 11); glayout.setComponentAlignment(contactPersonNameField, Alignment.MIDDLE_LEFT); contactPersonAddressField = createTextField("Contact Person's Address: "); contactPersonAddressField.setValue("N/A"); glayout.addComponent(contactPersonAddressField, 2, 11, 3, 11); glayout.setComponentAlignment(contactPersonAddressField, Alignment.MIDDLE_LEFT); contactPersonNoField = createTextField("Contact Person's Tel No: "); contactPersonNoField.setValue("N/A"); glayout.addComponent(contactPersonNoField, 1, 12); glayout.setComponentAlignment(contactPersonNoField, Alignment.MIDDLE_LEFT); skillsField = createTextField("Skills: "); skillsField.setValue("N/A"); glayout.addComponent(skillsField, 2, 12); glayout.setComponentAlignment(skillsField, Alignment.MIDDLE_LEFT); hobbyField = createTextField("Hobbies"); hobbyField.setValue("N/A"); glayout.addComponent(hobbyField, 3, 12); glayout.setComponentAlignment(hobbyField, Alignment.MIDDLE_LEFT); if (employeeId != null) { personalInformation = piService.getPersonalInformationData(employeeId); final byte[] image = personalInformation.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, personalInformation.getFirstname() + ".jpg", getThisApplication()); imageResource.setCacheTime(0); avatar.setSource(imageResource); } fnField.setValue(personalInformation.getFirstname().toUpperCase()); mnField.setValue(personalInformation.getMiddlename().toUpperCase()); lnField.setValue(personalInformation.getLastname().toUpperCase()); companyIdField.setValue(employeeId); dobField.setValue(personalInformation.getDob()); pobField.setValue(personalInformation.getPob()); if (personalInformation.getCivilStatus() != null) { Object civilStatusId = civilStatusBox.addItem(); civilStatusBox.setItemCaption(civilStatusId, personalInformation.getCivilStatus()); civilStatusBox.setValue(civilStatusId); } if (personalInformation.getGender() != null) { Object genderId = genderBox.addItem(); genderBox.setItemCaption(genderId, personalInformation.getGender()); genderBox.setValue(genderId); } citizenshipField.setValue(personalInformation.getCitizenship()); heightField.setValue(personalInformation.getHeight()); weightField.setValue(personalInformation.getWeight()); religionField.setValue(personalInformation.getReligion()); spouseNameField.setValue(personalInformation.getSpouseName()); spouseOccupationField.setValue(personalInformation.getSpouseOccupation()); spouseOfficeAddressField.setValue(personalInformation.getSpouseOfficeAddress()); fathersNameField.setValue(personalInformation.getFathersName()); fathersOccupationField.setValue(personalInformation.getFathersOccupation()); mothersNameField.setValue(personalInformation.getMothersName()); mothersOccupationField.setValue(personalInformation.getMothersOccupation()); parentsAddressField.setValue(personalInformation.getParentsAddress()); dialectSpeakWriteField.setValue(personalInformation.getDialectSpeakWrite()); contactPersonNameField.setValue(personalInformation.getContactPersonName()); contactPersonAddressField.setValue(personalInformation.getContactPersonAddress()); contactPersonNoField.setValue(personalInformation.getContactPersonNo()); skillsField.setValue(personalInformation.getSkills()); hobbyField.setValue(personalInformation.getHobby()); } Button removeBtn = new Button("REMOVE EMPLOYEE"); removeBtn.setWidth("100%"); boolean visible = false; if (GlobalVariables.getUserRole() == null) { visible = false; } else if (GlobalVariables.getUserRole().equals("hr") || GlobalVariables.getUserRole().equals("administrator")) { visible = true; } removeBtn.setVisible(visible); removeBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (!GlobalVariables.getUserRole().equals("administrator")) { getWindow().showNotification("You need to an ADMINISTRATOR to perform this ACTION.", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window window = getRemoveWindow(getEmployeeId()); window.setModal(true); if (window.getParent() == null) { getWindow().addWindow(window); } window.center(); } }); glayout.addComponent(removeBtn, 1, 13); Button saveButton = new Button("UPDATE EMPLOYEE's INFORMATION"); saveButton.setWidth("100%"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (dobField.getValue() == null || dobField.getValue().toString().isEmpty()) { getWindow().showNotification("Date of Birth Required!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (heightField.getValue() == null || heightField.getValue().toString().isEmpty()) { getWindow().showNotification("Null/Empty Value for Height is not ALLOWED!", Window.Notification.TYPE_ERROR_MESSAGE); return; } else { if (!convertionUtilities.checkInputIfDouble(heightField.getValue().toString())) { getWindow().showNotification("Enter a numeric format for Height!", Window.Notification.TYPE_ERROR_MESSAGE); return; } } if (weightField.getValue() == null || weightField.getValue().toString().isEmpty()) { getWindow().showNotification("Null/Empty Value for Weight is not ALLOWED!", Window.Notification.TYPE_ERROR_MESSAGE); return; } else { if (!convertionUtilities.checkInputIfDouble(weightField.getValue().toString())) { getWindow().showNotification("Enter a numeric format for Weight!", Window.Notification.TYPE_ERROR_MESSAGE); return; } } if (genderBox.getValue() == null || genderBox.getValue().toString().isEmpty()) { getWindow().showNotification("Select a Gender!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (civilStatusBox.getValue() == null || civilStatusBox.getValue().toString().isEmpty()) { getWindow().showNotification("Select Civil Status!", Window.Notification.TYPE_ERROR_MESSAGE); return; } PersonalInformation pi = new PersonalInformation(); pi.setFirstname(fnField.getValue().toString().toLowerCase().trim()); pi.setMiddlename(mnField.getValue().toString().toLowerCase().trim()); pi.setLastname(lnField.getValue().toString().toLowerCase().trim()); pi.setEmployeeId(employeeId); pi.setDob((Date) dobField.getValue()); pi.setPob((pobField.getValue() == null) ? "N/A" : pobField.getValue().toString().toLowerCase().trim()); pi.setHeight(convertionUtilities.convertStringToDouble(heightField.getValue().toString())); pi.setWeight(convertionUtilities.convertStringToDouble(weightField.getValue().toString())); if (convertionUtilities.checkInputIfInteger(genderBox.getValue().toString())) { pi.setGender(genderBox.getItemCaption(genderBox.getValue())); } else { pi.setGender(genderBox.getValue().toString()); } if (convertionUtilities.checkInputIfInteger(civilStatusBox.getValue().toString())) { pi.setCivilStatus(civilStatusBox.getItemCaption(civilStatusBox.getValue())); } else { pi.setCivilStatus(civilStatusBox.getValue().toString()); } pi.setCitizenship( (citizenshipField.getValue() == null) ? "N/A" : citizenshipField.getValue().toString()); pi.setReligion((religionField.getValue() == null) ? "N/A" : religionField.getValue().toString()); pi.setSpouseName( (spouseNameField.getValue() == null) ? "N/A" : spouseNameField.getValue().toString()); pi.setSpouseOccupation((spouseOccupationField.getValue() == null) ? "N/A" : spouseOccupationField.getValue().toString()); pi.setSpouseOfficeAddress((spouseOfficeAddressField.getValue() == null) ? "N/A" : spouseOfficeAddressField.getValue().toString()); pi.setFathersName( (fathersNameField.getValue() == null) ? "N/A" : fathersNameField.getValue().toString()); pi.setFathersOccupation((fathersOccupationField.getValue() == null) ? "N/A" : fathersOccupationField.getValue().toString()); pi.setMothersName( (mothersNameField.getValue() == null) ? "N/A" : mothersNameField.getValue().toString()); pi.setMothersOccupation((mothersOccupationField.getValue() == null) ? "N/A" : mothersOccupationField.getValue().toString()); pi.setParentsAddress((parentsAddressField.getValue() == null) ? "N/A" : parentsAddressField.getValue().toString()); pi.setDialectSpeakWrite((dialectSpeakWriteField.getValue() == null) ? "N/A" : dialectSpeakWriteField.getValue().toString()); pi.setContactPersonName((contactPersonNameField.getValue() == null) ? "N/A" : contactPersonNameField.getValue().toString()); pi.setContactPersonAddress((contactPersonAddressField.getValue() == null) ? "N/A" : contactPersonAddressField.getValue().toString()); pi.setContactPersonNo((contactPersonNoField.getValue() == null) ? "N/A" : contactPersonNoField.getValue().toString()); pi.setSkills((skillsField.getValue() == null) ? "N/A" : skillsField.getValue().toString()); pi.setHobby((hobbyField.getValue() == null) ? "N/A" : hobbyField.getValue().toString()); pi.setEmployeeId(getEmployeeId()); // boolean result = piService.updatePersonalInformation(pi, "UPDATE PERSONAL INFORMATION"); Window window = updatePersonalInformationConfirmation(pi); window.setModal(true); if (window.getParent() == null) { getWindow().addWindow(window); } window.center(); // if(result){ // getWindow().showNotification("Information Updated", Window.Notification.TYPE_TRAY_NOTIFICATION); // } else { // getWindow().showNotification("SQL Error", Window.Notification.TYPE_ERROR_MESSAGE); // } } }); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { saveButton.setEnabled(true); } else { saveButton.setEnabled(false); } glayout.addComponent(saveButton, 2, 13, 3, 13); glayout.setColumnExpandRatio(1, .10f); glayout.setColumnExpandRatio(2, .10f); glayout.setColumnExpandRatio(3, .10f); return glayout; }
From source file:com.skysql.manager.ui.PanelInfo.java
License:Open Source License
/** * Creates the charts layout./*from ww w . j a v a 2s. c om*/ */ private void createChartsLayout() { chartsLayout = new VerticalLayout(); chartsLayout.addStyleName("chartsLayout"); chartsLayout.setHeight("100%"); chartsLayout.setSpacing(true); addComponent(chartsLayout); final HorizontalLayout chartsHeaderLayout = new HorizontalLayout(); chartsHeaderLayout.setStyleName("panelHeaderLayout"); chartsHeaderLayout.setWidth("100%"); chartsHeaderLayout.setSpacing(true); chartsHeaderLayout.setMargin(new MarginInfo(false, true, false, true)); chartsLayout.addComponent(chartsHeaderLayout); chartControls = new ChartControls(); chartControls.addIntervalSelectionListener(chartIntervalListener); chartControls.addThemeSelectionListener(chartThemeListener); chartsHeaderLayout.addComponent(chartControls); chartsHeaderLayout.setComponentAlignment(chartControls, Alignment.MIDDLE_LEFT); final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); chartsHeaderLayout.addComponent(buttonsLayout); chartsHeaderLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_RIGHT); SettingsDialog settingsDialog = new SettingsDialog("Edit Monitors...", "Monitors"); final Button editMonitorsButton = settingsDialog.getButton(); editMonitorsButton.setVisible(false); buttonsLayout.addComponent(editMonitorsButton); final Button addChartButton = new Button("Add Chart..."); addChartButton.setVisible(false); buttonsLayout.addComponent(addChartButton); addChartButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { new ChartsDialog(chartsArrayLayout, null); } }); final Button editButton = new Button("Edit"); editButton.setDescription("Enter Editing mode"); final Button saveButton = new Button("Done"); saveButton.setDescription("Exit Editing mode"); buttonsLayout.addComponent(editButton); editButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { buttonsLayout.replaceComponent(editButton, saveButton); chartsArrayLayout.setDragMode(LayoutDragMode.CLONE); chartsArrayLayout.setEditable(true); chartsHeaderLayout.setStyleName("panelHeaderLayout-editable"); editMonitorsButton.setVisible(true); addChartButton.setVisible(true); OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class); overviewPanel.setEnabled(false); } }); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { buttonsLayout.replaceComponent(saveButton, editButton); chartsArrayLayout.setDragMode(LayoutDragMode.NONE); chartsArrayLayout.setEditable(false); chartsHeaderLayout.setStyleName("panelHeaderLayout"); editMonitorsButton.setVisible(false); addChartButton.setVisible(false); OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class); overviewPanel.setEnabled(true); refresh(); } }); final Button expandButton = new NativeButton(); expandButton.setStyleName("expandButton"); expandButton.setDescription("Expand/Reduce viewing area"); buttonsLayout.addComponent(expandButton); buttonsLayout.setComponentAlignment(expandButton, Alignment.MIDDLE_CENTER); expandButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { isExpanded = !isExpanded; AnimatorProxy proxy = getSession().getAttribute(AnimatorProxy.class); proxy.addListener(new AnimationListener() { public void onAnimation(AnimationEvent event) { Component component = event.getComponent(); component.setVisible(isExpanded ? false : true); } }); // OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class); // if (!isExpanded) { // overviewPanel.setVisible(isExpanded ? false : true); // } // proxy.animate(overviewPanel, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN).setDuration(500).setDelay(100); // // TopPanel topPanel = getSession().getAttribute(TopPanel.class); // if (!isExpanded) { // topPanel.setVisible(isExpanded ? false : true); // } // proxy.animate(topPanel, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN).setDuration(500).setDelay(100); VerticalLayout topMid = getSession().getAttribute(VerticalLayout.class); if (!isExpanded) { topMid.setVisible(isExpanded ? false : true); } proxy.animate(topMid, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN) .setDuration(500).setDelay(100); expandButton.setStyleName(isExpanded ? "contractButton" : "expandButton"); } }); chartsPanel = new Panel(); chartsPanel.setSizeFull(); chartsPanel.addStyleName(Runo.PANEL_LIGHT); chartsLayout.addComponent(chartsPanel); chartsLayout.setExpandRatio(chartsPanel, 1.0f); }