List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:annis.gui.controlpanel.QueryPanel.java
License:Apache License
public QueryPanel(final AnnisUI ui) { super(4, 5);/*from ww w . j a v a2 s . c o m*/ this.ui = ui; this.lastPublicStatus = "Welcome to ANNIS! " + "A tutorial is available on the right side."; this.state = ui.getQueryState(); setSpacing(true); setMargin(false); setRowExpandRatio(0, 1.0f); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 0.1f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); txtQuery = new AqlCodeEditor(); txtQuery.setPropertyDataSource(state.getAql()); txtQuery.setInputPrompt("Please enter AQL query"); txtQuery.addStyleName("query"); if (ui.getInstanceFont() == null) { txtQuery.addStyleName("default-query-font"); txtQuery.setTextareaStyle("default-query-font"); } else { txtQuery.addStyleName(Helper.CORPUS_FONT); txtQuery.setTextareaStyle(Helper.CORPUS_FONT); } txtQuery.addStyleName("keyboardInput"); txtQuery.setWidth("100%"); txtQuery.setHeight(15f, Unit.EM); txtQuery.setTextChangeTimeout(500); final VirtualKeyboardCodeEditor virtualKeyboard; if (ui.getInstanceConfig().getKeyboardLayout() == null) { virtualKeyboard = null; } else { virtualKeyboard = new VirtualKeyboardCodeEditor(); virtualKeyboard.setKeyboardLayout(ui.getInstanceConfig().getKeyboardLayout()); virtualKeyboard.extend(txtQuery); } txtStatus = new TextArea(); txtStatus.setValue(this.lastPublicStatus); txtStatus.setWidth("100%"); txtStatus.setHeight(4.0f, Unit.EM); txtStatus.addStyleName("border-layout"); txtStatus.setReadOnly(true); piCount = new ProgressBar(); piCount.setIndeterminate(true); piCount.setEnabled(false); piCount.setVisible(false); btShowResult = new Button("Search"); btShowResult.setIcon(FontAwesome.SEARCH); btShowResult.setWidth("100%"); btShowResult.addClickListener(new ShowResultClickListener()); btShowResult.setDescription("<strong>Show Result</strong><br />Ctrl + Enter"); btShowResult.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL); btShowResult.setDisableOnClick(true); VerticalLayout historyListLayout = new VerticalLayout(); historyListLayout.setSizeUndefined(); lstHistory = new ListSelect(); lstHistory.setWidth("200px"); lstHistory.setNullSelectionAllowed(false); lstHistory.setValue(null); lstHistory.addValueChangeListener((ValueChangeListener) this); lstHistory.setImmediate(true); lstHistory.setContainerDataSource(historyContainer); lstHistory.setItemCaptionPropertyId("query"); lstHistory.addStyleName(Helper.CORPUS_FONT); Button btShowMoreHistory = new Button("Show more details", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (historyWindow == null) { historyWindow = new Window("History"); historyWindow.setModal(false); historyWindow.setWidth("400px"); historyWindow.setHeight("250px"); } historyWindow.setContent(new HistoryPanel(state.getHistory(), ui.getQueryController())); if (UI.getCurrent().getWindows().contains(historyWindow)) { historyWindow.bringToFront(); } else { UI.getCurrent().addWindow(historyWindow); } } }); btShowMoreHistory.setWidth("100%"); historyListLayout.addComponent(lstHistory); historyListLayout.addComponent(btShowMoreHistory); historyListLayout.setExpandRatio(lstHistory, 1.0f); historyListLayout.setExpandRatio(btShowMoreHistory, 0.0f); btHistory = new PopupButton("History"); btHistory.setContent(historyListLayout); btHistory.setDescription("<strong>Show History</strong><br />" + "Either use the short overview (arrow down) or click on the button " + "for the extended view."); Button btShowKeyboard = null; if (virtualKeyboard != null) { btShowKeyboard = new Button(); btShowKeyboard.setWidth("100%"); btShowKeyboard.setDescription("Click to show a virtual keyboard"); btShowKeyboard.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btShowKeyboard.addStyleName(ValoTheme.BUTTON_SMALL); btShowKeyboard.setIcon(new ClassResource(VirtualKeyboardCodeEditor.class, "keyboard.png")); btShowKeyboard.addClickListener(new ShowKeyboardClickListener(virtualKeyboard)); } Button btShowQueryBuilder = new Button("Query<br />Builder"); btShowQueryBuilder.setHtmlContentAllowed(true); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_SMALL); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); btShowQueryBuilder.setIcon(new ThemeResource("images/tango-icons/32x32/document-properties.png")); btShowQueryBuilder.addClickListener(new ShowQueryBuilderClickListener(ui)); VerticalLayout moreActionsLayout = new VerticalLayout(); moreActionsLayout.setWidth("250px"); btMoreActions = new PopupButton("More"); btMoreActions.setContent(moreActionsLayout); // btShowResultNewTab = new Button("Search (open in new tab)"); // btShowResultNewTab.setWidth("100%"); // btShowResultNewTab.addClickListener(new ShowResultInNewTabClickListener()); // btShowResultNewTab.setDescription("<strong>Show Result and open result in new tab</strong><br />Ctrl + Shift + Enter"); // btShowResultNewTab.setDisableOnClick(true); // btShowResultNewTab.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL, ModifierKey.SHIFT); // moreActionsLayout.addComponent(btShowResultNewTab); Button btShowExport = new Button("Export", new ShowExportClickListener(ui)); btShowExport.setIcon(FontAwesome.DOWNLOAD); btShowExport.setWidth("100%"); moreActionsLayout.addComponent(btShowExport); Button btShowFrequency = new Button("Frequency Analysis", new ShowFrequencyClickListener(ui)); btShowFrequency.setIcon(FontAwesome.BAR_CHART_O); btShowFrequency.setWidth("100%"); moreActionsLayout.addComponent(btShowFrequency); /* * We use the grid layout for a better rendering efficiency, but this comes * with the cost of some complexity when defining the positions of the * elements in the layout. * * This grid hopefully helps a little bit in understanding the "magic" * numbers better. * * Q: Query text field * QB: Button to toggle query builder // TODO * KEY: Button to show virtual keyboard * SEA: "Search" button * MOR: "More actions" button * HIST: "History" button * STAT: Text field with the real status * PROG: indefinite progress bar (spinning circle) * * \ 0 | 1 | 2 | 3 * --+-----+---+---+---+----- * 0 | Q | Q | Q | QB * --+-----+-----+-----+----- * 1 | Q | Q | Q | KEY * --+-----+-----+-----+----- * 2 | SEA | MOR | HIST| * --+-----+-----+-----+----- * 3 | STAT| STAT| STAT| PROG */ addComponent(txtQuery, 0, 0, 2, 1); addComponent(txtStatus, 0, 3, 2, 3); addComponent(btShowResult, 0, 2); addComponent(btMoreActions, 1, 2); addComponent(btHistory, 2, 2); addComponent(piCount, 3, 3); addComponent(btShowQueryBuilder, 3, 0); if (btShowKeyboard != null) { addComponent(btShowKeyboard, 3, 1); } // alignment setRowExpandRatio(0, 0.0f); setRowExpandRatio(1, 1.0f); setColumnExpandRatio(0, 1.0f); setColumnExpandRatio(1, 0.0f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); //setComponentAlignment(btShowQueryBuilder, Alignment.BOTTOM_CENTER); }
From source file:annis.visualizers.component.rst.RSTPanel.java
License:Apache License
RSTPanel(VisualizerInput visInput) { String btWidth = "30px"; HorizontalLayout grid = new HorizontalLayout(); final int scrollStep = 200; // the calculation of the output json is done here. final RSTImpl rstView = new RSTImpl(visInput); rstView.setId(UUID.randomUUID().toString()); this.setHeight("-1px"); this.setWidth("100%"); grid.setHeight("-1px"); grid.setWidth("100%"); final Button buttonLeft = new Button(); buttonLeft.setWidth(btWidth); buttonLeft.setHeight("100%"); buttonLeft.addStyleName("left-button"); buttonLeft.setEnabled(false);//from w w w .j a va2 s. c o m final Button buttonRight = new Button(); buttonRight.setWidth(btWidth); buttonRight.setHeight("100%"); buttonRight.addStyleName("right-button"); buttonLeft.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (rstView.getScrollLeft() < scrollStep) { buttonLeft.setEnabled(false); rstView.setScrollLeft(0); } else { //if the right button was deactivated set it back rstView.setScrollLeft(rstView.getScrollLeft() - scrollStep); } buttonRight.setEnabled(true); } }); buttonRight.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { renderInfo.calculate("#" + rstView.getId() + " canvas"); } }); renderInfo = new CssRenderInfo(new CssRenderInfo.Callback() { @Override public void renderInfoReceived(int width, int height) { if (width - rstView.getScrollLeft() > scrollStep) { buttonLeft.setEnabled(true); rstView.setScrollLeft(rstView.getScrollLeft() + scrollStep); } else { rstView.setScrollLeft(rstView.getScrollLeft() - (width - rstView.getScrollLeft())); buttonLeft.setEnabled(true); buttonRight.setEnabled(false); } } }); rstView.addExtension(renderInfo); grid.addComponent(buttonLeft); grid.addComponent(rstView); grid.addComponent(buttonRight); setContent(grid); grid.setExpandRatio(rstView, 1.0f); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.core.VaadinUI.java
License:LGPL
public VaadinUI() { // Set up the Navigator navigator = new Navigator(this, this); // Create Welcome Screen MainUI mainScreen = new MainUI(); mainScreen.setMargin(true);/*from ww w.j av a2s. c o m*/ Button start = new Button("Start", e -> { navigator.navigateTo(Views.TEST.toString()); }); start.setWidth("40%"); start.setHeight("40%"); //mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Willkommen zur " + productData))); mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h2", "Bitte klicke den <b>" + start.getCaption() + "</b> Button um mit dem Rechnungswesentest zu beginnen!"))); mainScreen.addComponent(start); mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER); navigator.addView(Views.DEFAULT.toString(), mainScreen); // Question view // Change this to the questionManager you like final QuestionManager manager = new AccountingQuestionManager("Rechnungswesentest"); navigator.addView(Views.TEST.toString(), manager); navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName()))); navigator.addView(Views.Admin.toString(), new AdminView(manager)); navigator.addView(Views.Results.toString(), new ResultView(manager)); navigator.setErrorView(mainScreen); LogHelper.logInfo("Startup completed"); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.core.VaadinUI.java
License:LGPL
public VaadinUI() { // Set up the Navigator navigator = new Navigator(this, this); // Create Welcome Screen MainUI mainScreen = new MainUI(); mainScreen.setMargin(true);//from ww w. j av a 2 s . c om Button start = new Button("Start", e -> { navigator.navigateTo(Views.TEST.toString()); }); start.setWidth("40%"); start.setHeight("40%"); mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Welcome to " + productData))); mainScreen.addComponent(new HtmlLabel( HtmlUtils.center("h2", "Click the <b>" + start.getCaption() + "</b> Button to start!"))); mainScreen.addComponent(start); mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER); navigator.addView(Views.DEFAULT.toString(), mainScreen); // Question view // Change this to the questionManager you like final QuestionManager manager = new AccountingQuestionManager("Accounting Quiz"); navigator.addView(Views.TEST.toString(), manager); navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName()))); navigator.setErrorView(mainScreen); LogHelper.logInfo("Startup completed"); }
From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java
License:Open Source License
/** * Method which actually creates the whole UI. *//*from www . j a va 2s. c o m*/ @Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); Panel panel = new Panel("Login"); panel.setSizeUndefined(); FormLayout content = new FormLayout(); userName = new TextField("Username"); content.addComponent(userName); PasswordField password = new PasswordField("Password"); content.addComponent(password); Button login = new Button("Login"); register = new Button("Register"); CheckBox askBox = new CheckBox("Are you a Roommanager?"); login.setStyleName(Reindeer.BUTTON_SMALL); login.setWidth("86px"); register.setStyleName(Reindeer.BUTTON_SMALL); register.setWidth("86px"); askBox.setStyleName(Reindeer.BUTTON_SMALL); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(login); hl.addComponent(register); hl.addComponent(askBox); content.addComponent(hl); content.setSizeUndefined(); content.setMargin(true); panel.setContent(content); login.addClickListener(e -> { System.out.println(userName.getValue()); System.out.println(password.getValue()); try { if (controller.login(userName.getValue(), password.getValue()) || userName.equals(userName.getValue()) && password.equals(password.getValue())) { setContent(new ReservationUI()); } } catch (Throwable e1) { e1.printStackTrace(); } }); register.addClickListener(e -> { try { Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER; controller.register(userName.getValue(), password.getValue(), x); } catch (Throwable e1) { e1.printStackTrace(); } }); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(panel); setContent(layout); }
From source file:com.antonjohansson.managementcenter.core.web.welcome.WelcomeView.java
License:Apache License
private Component getExistingConnectionLayout() { ComboBox connection = new ComboBox("Existing connection"); connection.addItem("SQL Server 01"); connection.addItem("Elasticsearch Server 01"); connection.setWidth("400"); connection.setNullSelectionAllowed(false); connection.setTextInputAllowed(false); Button connect = new Button("Connect"); connect.addStyleName(ValoTheme.BUTTON_PRIMARY); connect.setClickShortcut(KeyCode.ENTER); connect.setWidth("120"); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*from ww w. j av a 2 s . c om*/ layout.addComponents(connection, connect); layout.setComponentAlignment(connect, Alignment.BOTTOM_LEFT); return layout; }
From source file:com.bellkenz.modules.PersonalInformation.java
public ComponentContainer personalInformation() { employeeInformationDAO = new EmployeeInformationDAO(getEmployeeId()); employeePersonalInformation = new EmployeePersonalInformation(); GridLayout glayout = new GridLayout(5, 9); glayout.setSpacing(true);/*from w w w .jav a 2 s .co m*/ glayout.setMargin(true); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setSizeFull(); employeeImage = new Embedded(null, new ThemeResource("../myTheme/images/ronnie.jpg")); employeeImage.setImmediate(true); employeeImage.setWidth(90, Sizeable.UNITS_PIXELS); employeeImage.setHeight(90, Sizeable.UNITS_PIXELS); employeeImage.setStyleName("logo-img"); imagePanel.addComponent(employeeImage); glayout.addComponent(employeeImage, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); firstname = createTextField("Firstname: "); glayout.addComponent(firstname, 1, 0, 2, 0); final TextField middlename = createTextField("Middlename: "); glayout.addComponent(middlename, 3, 0); final TextField lastname = createTextField("Lastname: "); glayout.addComponent(lastname, 4, 0); final TextField houseNo = createTextField("No: "); houseNo.setWidth("40px"); glayout.addComponent(houseNo, 1, 1); final TextField street = createTextField("Street: "); street.setWidth("118"); glayout.addComponent(street, 2, 1); final TextField city = createTextField("City: "); glayout.addComponent(city, 3, 1); final TextField zipCode = createTextField("Zip Code:"); glayout.addComponent(zipCode, 4, 1); final TextField nickname = createTextField("Nickname: "); nickname.setWidth("90px"); glayout.addComponent(nickname, 0, 2); final TextField permanentAddress = createTextField("Permanent/Provincial Address: "); permanentAddress.setWidth("533px"); glayout.addComponent(permanentAddress, 1, 2, 4, 2); Button uploadPicture = new Button("Upload..."); uploadPicture.setWidth("100%"); uploadPicture.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeId == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, employeeImage, employeeId); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPicture, 0, 3); final TextField landline = createTextField("Landline #: "); glayout.addComponent(landline, 1, 3, 2, 3); final TextField mobileNo = createTextField("Mobile #: "); glayout.addComponent(mobileNo, 3, 3); final TextField age = createTextField("Age: "); glayout.addComponent(age, 4, 3); final TextField emailAddress = createTextField("Email Address: "); glayout.addComponent(emailAddress, 1, 4, 2, 4); final PopupDateField dob = (PopupDateField) createDateField("Date of Birth: "); glayout.addComponent(dob, 3, 4); final TextField height = createTextField("Height: "); glayout.addComponent(height, 4, 4); final ComboBox civilStatus = new ComboBox("Civil Status: "); civilStatus.setWidth("100%"); dropDownBoxList.populateCivilStatusList(civilStatus); glayout.addComponent(civilStatus, 1, 5, 2, 5); final ComboBox gender = new ComboBox("Gender: "); gender.setWidth("100%"); dropDownBoxList.populateGenderList(gender); glayout.addComponent(gender, 3, 5); final TextField weight = createTextField("Weigth: "); glayout.addComponent(weight, 4, 5); final TextField driversLicenseNo = createTextField("Drivers License: "); glayout.addComponent(driversLicenseNo, 1, 6, 2, 6); final TextField restrictionCode = createTextField("Restriction Code: "); glayout.addComponent(restrictionCode, 3, 6); final TextField religion = createTextField("Religion: "); glayout.addComponent(religion, 4, 6); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); glayout.addComponent(division, 1, 7, 2, 7); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); glayout.addComponent(department, 3, 7); final TextField position = createTextField("Position: "); glayout.addComponent(position, 4, 7); //glayout.setComponentAlignment(position, Alignment.BOTTOM_LEFT); Button transferButton = new Button("Transfer Employee"); transferButton.setWidth("100%"); transferButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select an Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window subWindow = transferEmployee(getEmployeeId(), division, department, position); if (subWindow.getParent() == null) { getWindow().addWindow(subWindow); } subWindow.setModal(true); subWindow.center(); } }); glayout.addComponent(transferButton, 1, 8, 2, 8); glayout.setComponentAlignment(transferButton, Alignment.BOTTOM_CENTER); if (employeeId != null) { epiList = employeeInformationDAO.employeePersonalInformation(); for (EmployeePersonalInformation epi : epiList) { final byte[] image = epi.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, epi.getFirstname() + ".jpg", getApplication()); imageResource.setCacheTime(0); employeeImage.setSource(imageResource); } firstname.setValue(epi.getFirstname()); middlename.setValue(epi.getMiddlename()); lastname.setValue(epi.getLastname()); houseNo.setValue(epi.getHouseNumber()); street.setValue(epi.getStreet()); city.setValue(epi.getStreet()); zipCode.setValue(epi.getZipCode()); nickname.setValue(epi.getNickname()); permanentAddress.setValue(epi.getPermanentAddress()); landline.setValue(epi.getLandlineNumber()); mobileNo.setValue(epi.getMobileNumber()); age.setValue(epi.getAge()); emailAddress.setValue(epi.getEmailAddress()); if (epi.getDob() != null) { dob.setValue(conUtil.parsingDate(epi.getDob())); } else { dob.setValue(null); } height.setValue(epi.getHeight()); if (epi.getCivilStatus() != null) { Object civilStatusId = civilStatus.addItem(); civilStatus.setItemCaption(civilStatusId, epi.getCivilStatus()); civilStatus.setValue(civilStatusId); } if (epi.getGender() != null) { Object genderId = gender.addItem(); gender.setItemCaption(genderId, epi.getGender()); gender.setValue(genderId); } weight.setValue(epi.getWeight()); driversLicenseNo.setValue(epi.getDriversLicense()); restrictionCode.setValue(epi.getRestrictionCode()); religion.setValue(epi.getReligion()); position.setValue(epi.getPosition()); Object divisionObjectId = division.addItem(); division.setItemCaption(divisionObjectId, epi.getDivision()); division.setValue(divisionObjectId); Object departmentObjectId = department.addItem(); department.setItemCaption(departmentObjectId, epi.getDepartment()); department.setValue(departmentObjectId); } } firstname.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { employeePersonalInformation.setFirstname(event.getProperty().getValue().toString()); } }); firstname.setImmediate(true); setInformation(employeePersonalInformation); return glayout; }
From source file:com.bellkenz.modules.PersonalInformation.java
public Window transferEmployee(final String employeeId, final ComboBox div, final ComboBox dept, final TextField post) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true);//w w w .jav a2s .c o m vlayout.setSpacing(true); final Window subWindow = new Window("Transfer Employee", vlayout); subWindow.setWidth("200px"); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); subWindow.addComponent(division); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); subWindow.addComponent(department); final TextField position = createTextField("Position: "); position.setWidth("100%"); subWindow.addComponent(position); final PopupDateField entryDate = (PopupDateField) createDateField("Date of Entry: "); subWindow.addComponent(entryDate); Button updateButton = new Button("UPDATE"); updateButton.setWidth("100%"); updateButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (division.getValue() == null) { getWindow().showNotification("Select Division!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (department.getValue() == null) { getWindow().showNotification("Select Department!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (position.getValue() == null || position.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Position!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (entryDate.getValue() == null) { getWindow().showNotification("Select Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE); return; } List<EmployeePositionHistory> ephList = new ArrayList<EmployeePositionHistory>(); EmployeePositionHistory eph = new EmployeePositionHistory(); eph.setBranch(division.getValue().toString()); eph.setDepartment(department.getValue().toString()); eph.setPosition(position.getValue().toString().trim().toLowerCase()); eph.setEntryDate(conUtil.convertDateFormat(entryDate.getValue().toString())); ephList.add(eph); Integer deptId = departmentDAO.getDepartmentId(divisionId, department.getValue().toString()); Boolean result = employeeInformationDAO.transferEmployee(ephList, deptId); if (result) { Object divObjectId = div.addItem(); div.setItemCaption(divObjectId, division.getValue().toString()); div.setValue(divObjectId); Object deptObjectId = dept.addItem(); dept.setItemCaption(deptObjectId, department.getValue().toString()); dept.setValue(deptObjectId); post.setValue(position.getValue().toString().trim().toLowerCase()); (subWindow.getParent()).removeWindow(subWindow); } else { getWindow().showNotification("Cannot Transfer employee", Window.Notification.TYPE_ERROR_MESSAGE); } } }); subWindow.addComponent(updateButton); return subWindow; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.CrmLoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);//from w ww . j a va 2s. com contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); Label welcomeText = new Label("Login to CRM"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] { emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) })); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.module.project.ui.form.field.ProjectFormAttachmentDisplayField.java
License:Open Source License
@Override protected Component initContent() { ResourceService resourceService = ApplicationContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = resourceService.getContents( AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(), projectid, type, typeid)); if (CollectionUtils.isNotEmpty(attachments)) { VerticalLayout comp = new VerticalLayout(); comp.setStyleName("attachment-view-panel"); for (final Content attachment : attachments) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/*from www.j av a2s . co m*/ if (MimeTypesUtil.isImageType(docName)) { Button b = new Button(attachment.getTitle(), new Button.ClickListener() { private static final long serialVersionUID = 293396615972447886L; @Override public void buttonClick(Button.ClickEvent event) { AttachmentPreviewView previewView = new AttachmentPreviewView( VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE)); EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView)); } }); b.setWidth("100%"); comp.addComponent(b); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); comp.addComponent(l); } } return comp; } return new Label(" ", ContentMode.HTML); }