@AutoGenerated private HorizontalLayout buildHorizontalLayout_1() { // common part: create layout horizontalLayout_1 = new HorizontalLayout(); horizontalLayout_1.setImmediate(false); horizontalLayout_1.setWidth("-1px"); horizontalLayout_1.setHeight("-1px"); horizontalLayout_1.setMargin(false); horizontalLayout_1.setSpacing(true); // cmbPolicia cmbPolicia = new ComboBox(); cmbPolicia.setCaption("Policia"); cmbPolicia.setImmediate(false); cmbPolicia.setWidth("230px"); cmbPolicia.setHeight("-1px"); horizontalLayout_1.addComponent(cmbPolicia); // btnAgregarPolicia btnAgregarPolicia = new Button(); btnAgregarPolicia.setCaption(" "); btnAgregarPolicia.setImmediate(true); btnAgregarPolicia.setWidth("-1px"); btnAgregarPolicia.setHeight("-1px"); horizontalLayout_1.addComponent(btnAgregarPolicia); horizontalLayout_1.setComponentAlignment(btnAgregarPolicia, new Alignment(9)); return horizontalLayout_1; }
/** * The constructor should first build the main layout, set the composition root and then do any * custom initialization. * * <p>The constructor will not be automatically regenerated by the visual editor. */ public ParameterPathQuestion() { buildMainLayout(); setCompositionRoot(mainLayout); // Parameter Name parameterName.setNullRepresentation(""); parameterName.setRequiredError("Parameter must be filled"); // TODO: vyrobit skryvani // TODO: brat v uvahu fragmenty!!! // TODO: link na vnorene fieldy BeanItemContainer<ParameterType> parameterTypeContainer = new BeanItemContainer<ParameterType>( ParameterType.class, Arrays.asList(ParameterType.values())); parameterType.setContainerDataSource(parameterTypeContainer); parameterType.setImmediate(true); parameterType.setNullSelectionAllowed(false); parameterType.addListener( new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (parameterType.getValue() instanceof ParameterType) { ParameterType value = (ParameterType) parameterType.getValue(); if (ParameterType.FIXED.equals(value)) { semanticComposite.setVisible(false); } else { semanticComposite.setVisible(true); } } } }); }
protected final void setupRowPerPageCombo( final PMContext ctx, final PaginatedList list, HorizontalLayout l, final PMMainWindow window) throws UnsupportedOperationException { rowPerPage = new ComboBox(); rowPerPage.addItem("5"); rowPerPage.addItem("10"); rowPerPage.addItem("20"); rowPerPage.addItem("50"); if (list.getRowsPerPage() == null) { rowPerPage.select("10"); } else { rowPerPage.select(list.getRowsPerPage().toString()); } rowPerPage.setNullSelectionAllowed(false); rowPerPage.setNewItemsAllowed(false); rowPerPage.setWidth("50px"); rowPerPage.setFilteringMode(Filtering.FILTERINGMODE_OFF); rowPerPage.setImmediate(true); rowPerPage.addListener( new ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { list.setRowsPerPage(Integer.parseInt((String) event.getProperty().getValue())); PMContext c = cloneContext(ctx); c.put("rows_per_page", list.getRowsPerPage()); final ListCommand cmd = new ListCommand(c); window.setMainScreen(cmd.execute()); } }); l.addComponent(rowPerPage); }
ComboBox userList() { users.setCaption("Users: "); users.setWidth("200px"); users.setNullSelectionAllowed(false); users.addContainerProperty("y", String.class, ""); users.setItemCaptionPropertyId("y"); Item i; for (User u : service.getUserList()) { i = users.addItem(u.getId()); i.getItemProperty("y").setValue(u.getUsername()); } users.addListener( new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { allowedBackwardInputAttendance.setValue( service.isUserAllowedToEnterPreviousAttendance( util.convertStringToInteger(event.getProperty().getValue().toString()))); } }); users.setImmediate(true); return users; }
private ComboBox createSelect() { final ComboBox outSelect = new ComboBox(null); outSelect.setStyleName("ripla-select"); // $NON-NLS-1$ outSelect.setWidth(55, Unit.PIXELS); outSelect.setNullSelectionAllowed(false); outSelect.setImmediate(true); return outSelect; }
public JanelaGerenciarUsuarios() { this.center(); this.setWidth("40%"); this.setHeight("80%"); this.setModal(true); users = new ComboBox("Usuários"); preencheCB(); users.setImmediate(true); users.addListener(new EventoMostraDados()); users.setNullSelectionAllowed(false); leiaute = new FormLayout(); leiaute.setSpacing(true); titulo = new Label("Gerenciar Usuários"); nome = new TextField("Nome"); email = new TextField("E-Mail"); telefone = new TextField("Telefone"); cargo = new TextField("Cargo"); login = new TextField("Login"); senha1 = new PasswordField("Senha"); senha2 = new PasswordField("Confirme a senha"); admin = new CheckBox("Administrador? "); bloquear = new CheckBox("Bloqueado? "); // bloquear.setEnabled(false); addUser = new Button("Adicionar Usuário"); addUser.addListener(new EventoNovoUsuario()); editar = new Button("Editar Usuário"); editar.addListener(new EventoEditarUsuario()); excluir = new Button("Excluir Usuário"); excluir.addListener(new EventoExclusao()); desligaCampos(); leiaute.addComponent(titulo); leiaute.addComponent(users); leiaute.addComponent(nome); leiaute.addComponent(email); leiaute.addComponent(telefone); leiaute.addComponent(cargo); leiaute.addComponent(login); leiaute.addComponent(senha1); leiaute.addComponent(senha2); leiaute.addComponent(admin); leiaute.addComponent(bloquear); leiaute.addComponent(addUser); leiaute.addComponent(editar); leiaute.addComponent(excluir); this.addComponent(leiaute); }
public VentanaAltaConsultaSesion( final IPacientes iPacientes, Observer observer, Evaluacion evaluacion) { this.iPacientes = iPacientes; this.observer = observer; this.evaluacion = evaluacion; setModal(true); setCaption("Ingeso de consulta/sesión"); layout.setMargin(true); fecha = new PopupDateField(); fecha.setValue(Calendar.getInstance().getTime()); layout.addComponent(fecha); textArea.setInputPrompt("observaciones"); layout.addComponent(textArea); // containerTipoConsulta = new BeanItemContainer<TipoConsulta>(TipoConsulta.class, // TipoConsulta.getAll()); containerTipoConsulta = new BeanItemContainer<TipoConsulta>( TipoConsulta.class, Arrays.asList(TipoConsulta.values())); comboBoxTipoConsulta = new ComboBox(); comboBoxTipoConsulta.setContainerDataSource(containerTipoConsulta); comboBoxTipoConsulta.setItemCaptionPropertyId("descripcion"); comboBoxTipoConsulta.setItemCaptionMode(ItemCaptionMode.PROPERTY); comboBoxTipoConsulta.setImmediate(true); comboBoxTipoConsulta.addValueChangeListener( new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty() != null) { TipoConsulta tipoConsulta = (TipoConsulta) event.getProperty().getValue(); layoutAdicional.removeAllComponents(); if (tipoConsulta != null) { if (tipoConsulta.equals(TipoConsulta.TERAPIA_FISICA)) { layoutAdicional.addComponent(opcionesTerapiaFisica); } else if (tipoConsulta.equals(TipoConsulta.GIMNASIO)) { layoutAdicional.addComponent(opcionesGimnasio); } } } } }); layout.addComponent(comboBoxTipoConsulta); cargarTipoTerapiaFisica(); cargarTipoGimnasio(); layout.addComponent(layoutAdicional); layout.addComponent(this.obtenerBotonGuardar()); this.setContent(layout); }
private ComboBox getComboBox(String caption, boolean addNullItem) { ComboBox cb = new ComboBox(caption); cb.setImmediate(true); if (addNullItem) { cb.addItem("Null item"); cb.setNullSelectionItemId("Null item"); } cb.addItem("Value 1"); cb.addItem("Value 2"); cb.addItem("Value 3"); return cb; }
private ComboBox createType(Object itemId) { ComboBox select = new ComboBox(); for (AttribType type : AttribType.values()) { select.addItem(type.name()); } select.setValue(AttribType.gauge); select.setNullSelectionAllowed(false); select.setData(itemId); select.setBuffered(false); select.setImmediate(true); select.addValueChangeListener(validateOnValueChangeListener); return select; }
@AutoGenerated private AbsoluteLayout buildAbsLCaracteristicas2() { // common part: create layout absLCaracteristicas2 = new AbsoluteLayout(); absLCaracteristicas2.setImmediate(false); absLCaracteristicas2.setWidth("100.0%"); absLCaracteristicas2.setHeight("45px"); // cmbEtapa cmbEtapa = new ComboBox(); cmbEtapa.setCaption("Etapa Fenológica"); cmbEtapa.setImmediate(false); cmbEtapa.setWidth("250px"); cmbEtapa.setHeight("25px"); absLCaracteristicas2.addComponent(cmbEtapa, "top:18.0px;left:10.0px;"); // txtSupRegada txtSupRegada = new TextField(); txtSupRegada.setCaption("Superficie Regada"); txtSupRegada.setImmediate(false); txtSupRegada.setWidth("100px"); txtSupRegada.setHeight("25px"); absLCaracteristicas2.addComponent(txtSupRegada, "top:18.0px;left:280.0px;"); // lblSupRegada lblSupRegada = new Label(); lblSupRegada.setImmediate(false); lblSupRegada.setWidth("-1px"); lblSupRegada.setHeight("-1px"); lblSupRegada.setValue("ha"); absLCaracteristicas2.addComponent(lblSupRegada, "top:22.0px;left:385.0px;"); // txtProfRaices txtProfRaices = new TextField(); txtProfRaices.setCaption("Prof. de Raíces"); txtProfRaices.setImmediate(false); txtProfRaices.setWidth("100px"); txtProfRaices.setHeight("25px"); absLCaracteristicas2.addComponent(txtProfRaices, "top:18.0px;left:415.0px;"); // lblProfRaices lblProfRaices = new Label(); lblProfRaices.setImmediate(false); lblProfRaices.setWidth("-1px"); lblProfRaices.setHeight("-1px"); lblProfRaices.setValue("cm"); absLCaracteristicas2.addComponent(lblProfRaices, "top:22.0px;left:520.0px;"); return absLCaracteristicas2; }
public DepartmentSelector() { setImmediate(false); // conu = SpringApplicationContext.getContainerUtils(); container = conu.createJPABatchableContainer(Department.class); geoContainer = conu.createJPABatchableContainer(Department.class); geoContainer.setAutoCommit(false); container.setAutoCommit(false); setCaption("Department"); // Only list "roots" which are in our example geographical super // departments geoContainer.addContainerFilter(new IsNull("parent")); geographicalDepartment.setContainerDataSource(geoContainer); geographicalDepartment.setItemCaptionPropertyId("name"); geographicalDepartment.setImmediate(true); container.setApplyFiltersImmediately(false); filterDepartments(null); department.setContainerDataSource(container); department.setItemCaptionPropertyId("name"); geographicalDepartment.addListener( new Property.ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { /* * Modify filtering of the department combobox */ EntityItem<Department> item = geoContainer.getItem(geographicalDepartment.getValue()); Department entity = item.getEntity(); filterDepartments(entity); } }); department.addListener( new Property.ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { /* * Modify the actual value of the custom field. */ if (department.getValue() == null) { setValue(null, false); } else { Department entity = container.getItem(department.getValue()).getEntity(); setValue(entity, false); } } }); }
@AutoGenerated private HorizontalLayout buildHorizontalLayout_1() { // common part: create layout horizontalLayout_1 = new HorizontalLayout(); horizontalLayout_1.setImmediate(false); horizontalLayout_1.setWidth("-1px"); horizontalLayout_1.setHeight("-1px"); horizontalLayout_1.setMargin(false); horizontalLayout_1.setSpacing(true); // textAreaDescription textAreaDescription = new TextArea(); textAreaDescription.setCaption("Enter A Description"); textAreaDescription.setImmediate(false); textAreaDescription.setWidth("50.0%"); textAreaDescription.setHeight("-1px"); horizontalLayout_1.addComponent(textAreaDescription); // textFieldFilter textFieldFilter = new TextField(); textFieldFilter.setCaption("Filter Function By ID"); textFieldFilter.setImmediate(false); textFieldFilter.setWidth("-1px"); textFieldFilter.setHeight("-1px"); horizontalLayout_1.addComponent(textFieldFilter); horizontalLayout_1.setComponentAlignment(textFieldFilter, new Alignment(9)); // comboBoxDatatypeFilter comboBoxDatatypeFilter = new ComboBox(); comboBoxDatatypeFilter.setCaption("Filter By Data Type"); comboBoxDatatypeFilter.setImmediate(false); comboBoxDatatypeFilter.setWidth("-1px"); comboBoxDatatypeFilter.setHeight("-1px"); horizontalLayout_1.addComponent(comboBoxDatatypeFilter); horizontalLayout_1.setComponentAlignment(comboBoxDatatypeFilter, new Alignment(9)); // checkBoxFilterIsBag checkBoxFilterIsBag = new CheckBox(); checkBoxFilterIsBag.setCaption("Is Bag Filter"); checkBoxFilterIsBag.setImmediate(false); checkBoxFilterIsBag.setWidth("-1px"); checkBoxFilterIsBag.setHeight("-1px"); horizontalLayout_1.addComponent(checkBoxFilterIsBag); horizontalLayout_1.setComponentAlignment(checkBoxFilterIsBag, new Alignment(9)); return horizontalLayout_1; }
private ComboBox createSelect(String caption) { final ComboBox cb = new ComboBox(); cb.setImmediate(true); cb.addContainerProperty(CAPTION, String.class, ""); cb.setItemCaptionPropertyId(CAPTION); cb.setCaption(caption); cb.addValueChangeListener( new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Notification.show( "Value now:" + cb.getValue() + " " + cb.getItemCaption(cb.getValue())); } }); return cb; }
@AutoGenerated private GridLayout buildHeadLayout() { // common part: create layout headLayout = new GridLayout(); headLayout.setImmediate(false); headLayout.setWidth("-1px"); headLayout.setHeight("-1px"); headLayout.setMargin(false); headLayout.setSpacing(true); headLayout.setColumns(2); headLayout.setRows(2); // parameterTypeLabel parameterTypeLabel = new Label(); parameterTypeLabel.setImmediate(false); parameterTypeLabel.setWidth("-1px"); parameterTypeLabel.setHeight("-1px"); parameterTypeLabel.setValue("Type of Parameter"); headLayout.addComponent(parameterTypeLabel, 0, 0); // parameterType parameterType = new ComboBox(); parameterType.setImmediate(false); parameterType.setWidth("-1px"); parameterType.setHeight("-1px"); headLayout.addComponent(parameterType, 1, 0); // parameterNameLabel parameterNameLabel = new Label(); parameterNameLabel.setImmediate(false); parameterNameLabel.setWidth("-1px"); parameterNameLabel.setHeight("-1px"); parameterNameLabel.setValue("Parameter"); headLayout.addComponent(parameterNameLabel, 0, 1); headLayout.setComponentAlignment(parameterNameLabel, new Alignment(6)); // parameterName parameterName = new TextField(); parameterName.setImmediate(false); parameterName.setWidth("-1px"); parameterName.setHeight("-1px"); parameterName.setRequired(true); headLayout.addComponent(parameterName, 1, 1); return headLayout; }
@AutoGenerated private HorizontalLayout buildLytFormulario1() { // common part: create layout lytFormulario1 = new HorizontalLayout(); lytFormulario1.setImmediate(false); lytFormulario1.setWidth("-1px"); lytFormulario1.setHeight("-1px"); lytFormulario1.setMargin(false); lytFormulario1.setSpacing(true); // lblUnidadProcuraduria lblUnidadProcuraduria = new Label(); lblUnidadProcuraduria.setImmediate(false); lblUnidadProcuraduria.setWidth("160px"); lblUnidadProcuraduria.setHeight("-1px"); lblUnidadProcuraduria.setValue("Unidad Procuraduria"); lytFormulario1.addComponent(lblUnidadProcuraduria); // cmbUnidadProcuraduria cmbUnidadProcuraduria = new ComboBox(); cmbUnidadProcuraduria.setImmediate(false); cmbUnidadProcuraduria.setWidth("150px"); cmbUnidadProcuraduria.setHeight("-1px"); lytFormulario1.addComponent(cmbUnidadProcuraduria); // lblTipoNotificacion lblTipoNotificacion = new Label(); lblTipoNotificacion.setImmediate(false); lblTipoNotificacion.setWidth("160px"); lblTipoNotificacion.setHeight("-1px"); lblTipoNotificacion.setValue("Tipo Notificacion"); lytFormulario1.addComponent(lblTipoNotificacion); // cmbTipoNotificacion cmbTipoNotificacion = new ComboBoxLOVS(); cmbTipoNotificacion.setImmediate(false); cmbTipoNotificacion.setWidth("150px"); cmbTipoNotificacion.setHeight("-1px"); lytFormulario1.addComponent(cmbTipoNotificacion); return lytFormulario1; }
@Override protected void setup() { List<String> list = new ArrayList<String>(); for (int i = 0; i < 100; i++) { list.add("Item " + i); } ComboBox cb = new ComboBox("Combobox", list); cb.setImmediate(true); cb.setInputPrompt("Enter text"); cb.setDescription("Some Combobox"); addComponent(cb); final ObjectProperty<String> log = new ObjectProperty<String>(""); cb.addListener( new FieldEvents.FocusListener() { public void focus(FocusEvent event) { log.setValue(log.getValue().toString() + "<br>" + counter + ": Focus event!"); counter++; } }); cb.addListener( new FieldEvents.BlurListener() { public void blur(BlurEvent event) { log.setValue(log.getValue().toString() + "<br>" + counter + ": Blur event!"); counter++; } }); TextField field = new TextField("Some textfield"); field.setImmediate(true); addComponent(field); Label output = new Label(log); output.setCaption("Events:"); output.setContentMode(Label.CONTENT_XHTML); addComponent(output); }
/* (non-Javadoc) * @see com.vaadin.ui.FormFieldFactory#createField(com.vaadin.data.Item, java.lang.Object, com.vaadin.ui.Component) */ public Field createField(Item item, Object propertyId, Component uiContext) { if ("name".equals(propertyId)) { final TextField f = new TextField("Group Name"); f.setRequired(true); f.setWidth("100%"); return f; } if ("ifType".equals(propertyId)) { final ComboBox f = new ComboBox("ifType Filter"); f.addItem("ignore"); f.addItem("all"); f.setNullSelectionAllowed(false); f.setRequired(true); f.setImmediate(true); f.setNewItemsAllowed(true); f.setNewItemHandler( new NewItemHandler() { public void addNewItem(String newItemCaption) { if (!f.containsId(newItemCaption)) { f.addItem(newItemCaption); f.setValue(newItemCaption); } } }); return f; } if ("mibObjCollection".equals(propertyId)) { final MibObjField f = new MibObjField(resourceTypes); f.setCaption("MIB Objects"); f.setRequired(true); f.setImmediate(true); f.setWidth("100%"); return f; } return null; }
protected void replaceToCombo(String key, Container container, String defaultValue) { final TextField field = (TextField) map.get(key); HorizontalLayout layout = (HorizontalLayout) field.getParent(); field.setVisible(false); final ComboBox comboBox = new ComboBox("", container); comboBox.setImmediate(true); comboBox.setNullSelectionAllowed(false); comboBox.addValueChangeListener( new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { field.setValue((String) comboBox.getValue()); } }); if (container.containsId(field.getValue())) { comboBox.select(field.getValue()); } else { field.setValue(defaultValue); comboBox.select(defaultValue); } layout.addComponent(comboBox, 1); }
private void buildView() { logger.info( "Company ID : " + companyId + " | User Name : " + userName + " > " + "Painting Attendance Process UI"); // Material Components Definition btnsaveAttenProc.setVisible(false); cbPayPeried = new GERPComboBox("Pay Period"); cbPayPeried.setImmediate(true); cbPayPeried.setNullSelectionAllowed(false); cbPayPeried.setWidth("130"); cbPayPeried.setItemCaptionPropertyId("periodName"); cbPayPeried.addValueChangeListener( new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { Object itemId = event.getProperty().getValue(); if (itemId != null) { BeanItem<?> item = (BeanItem<?>) cbPayPeried.getItem(itemId); payPeriodList = (PayPeriodDM) item.getBean(); payPeriodId = payPeriodList.getPayPeriodId(); loadStartandEndDates(); } } }); btnsaveAttenProc.setCaption("Save"); tblMstScrSrchRslt.addItemClickListener( new ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { if (tblMstScrSrchRslt.isSelected(event.getItemId())) { tblMstScrSrchRslt.setImmediate(true); btnsaveAttenProc.setStyleName("savebt"); resetFields(); } else { ((AbstractSelect) event.getSource()).select(event.getItemId()); btnsaveAttenProc.setStyleName("savebt"); readonlyfalse(); editAttenProc(); readonlytrue(); } } }); hlPageHdrContainter.addComponent(btnsaveAttenProc); hlPageHdrContainter.setComponentAlignment(btnsaveAttenProc, Alignment.MIDDLE_RIGHT); tfProcessPeriod = new GERPTextField("Process Period"); tfProcessPeriod.setWidth("170"); tfProcessPeriod.setReadOnly(true); cbBranch = new GERPComboBox("Branch"); cbBranch.setWidth("170"); cbBranch.setNullSelectionAllowed(false); cbBranch.setItemCaptionPropertyId("branchName"); cbBranch.setImmediate(true); cbBranch.setValue(0L); cbBranch.addValueChangeListener( new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { Object itemId = event.getProperty().getValue(); if (itemId != null) { loadEmployeeList(); } } }); btnsaveAttenProc.addClickListener( new ClickListener() { // Click Listener for Add and Update private static final long serialVersionUID = 6551953728534136363L; @Override public void buttonClick(ClickEvent event) { saveattapprove(); } }); cbEmployeeName = new GERPComboBox("Employee Name"); cbEmployeeName.setItemCaptionPropertyId("firstname"); cbEmployeeName.setWidth("200"); cbEmployeeName.setImmediate(true); cbEmployeeName.setNullSelectionAllowed(false); btnSearchStaff = new GERPButton("Search Employee", "searchbt", this); btnAttendanceProc = new GERPButton("Run Attendance Process", "savebt", this); btnAttendanceProc.addClickListener( new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub loadAttendenceProcess(); // new AttendenceApprove(); } }); btnSearch.setVisible(false); hlSearchLayout = new GERPAddEditHLayout(); assembleSearchLayout(); hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout)); resetFields(); loadAttendanceProcessBranchList(); loadPayPeriod(); loadSrchRslt(); }
@AutoGenerated private AbsoluteLayout buildGeneralLayout() { // common part: create layout generalLayout = new AbsoluteLayout(); generalLayout.setImmediate(false); generalLayout.setWidth("100.0%"); generalLayout.setHeight("100.0%"); generalLayout.setMargin(false); // photoField photoField = new ImageField(); photoField.setImmediate(false); photoField.setWidth("420px"); photoField.setHeight("140px"); generalLayout.addComponent(photoField, "top:20.0px;left:10.0px;"); // vatField vatField = new TextField(); vatField.setCaption("CIF/NIF"); vatField.setImmediate(false); vatField.setWidth("120px"); vatField.setHeight("-1px"); generalLayout.addComponent(vatField, "top:16.0px;left:435.0px;"); // clientTypeField clientTypeField = new ComboBox(); clientTypeField.setCaption("Tipo"); clientTypeField.setImmediate(false); clientTypeField.setDescription("Tipo Cliente"); clientTypeField.setWidth("-1px"); clientTypeField.setHeight("-1px"); clientTypeField.setRequired(true); generalLayout.addComponent(clientTypeField, "top:54.0px;left:435.0px;"); // clientGroupField clientGroupField = new ComboBox(); clientGroupField.setCaption("Grupo"); clientGroupField.setImmediate(false); clientGroupField.setWidth("-1px"); clientGroupField.setHeight("-1px"); clientGroupField.setRequired(true); generalLayout.addComponent(clientGroupField, "top:92.0px;left:435.0px;"); // phoneField phoneField = new TextField(); phoneField.setCaption("Teléfono 01"); phoneField.setImmediate(false); phoneField.setWidth("115px"); phoneField.setHeight("-1px"); generalLayout.addComponent(phoneField, "top:16.0px;left:653.0px;"); // faxField faxField = new TextField(); faxField.setCaption("Fax"); faxField.setImmediate(false); faxField.setWidth("115px"); faxField.setHeight("-1px"); generalLayout.addComponent(faxField, "top:54.0px;left:779.0px;"); // facebookIdField facebookIdField = new TextField(); facebookIdField.setCaption("Facebook Id"); facebookIdField.setImmediate(false); facebookIdField.setWidth("242px"); facebookIdField.setHeight("24px"); generalLayout.addComponent(facebookIdField, "top:90.0px;left:653.0px;"); // mobileField mobileField = new TextField(); mobileField.setCaption("Teléfono 02"); mobileField.setImmediate(false); mobileField.setWidth("115px"); mobileField.setHeight("-1px"); generalLayout.addComponent(mobileField, "top:16.0px;left:780.0px;"); // descriptionField descriptionField = new TextField(); descriptionField.setCaption("Descripción"); descriptionField.setImmediate(false); descriptionField.setWidth("460px"); descriptionField.setHeight("-1px"); generalLayout.addComponent(descriptionField, "top:132.0px;left:435.0px;"); // commentField commentField = new TextArea(); commentField.setCaption("Comentarios"); commentField.setImmediate(false); commentField.setWidth("885px"); commentField.setHeight("70px"); generalLayout.addComponent(commentField, "top:206.0px;left:11.0px;"); // emailField emailField = new TextField(); emailField.setCaption("Email"); emailField.setImmediate(false); emailField.setWidth("460px"); emailField.setHeight("-1px"); generalLayout.addComponent(emailField, "top:172.0px;left:435.0px;"); return generalLayout; }
@Override protected void init(final VaadinRequest request) { final TabSheet tabLayout = new TabSheet(); final VerticalLayout layout = new VerticalLayout(); layout.addComponent(tabLayout); setContent(layout); final BinderCollection<MarathonData> binders = new BinderCollection<MarathonData>(); binders.commitHandler(); final FormLayout competitionParameters = new FormLayout(); binders.appendBinder(showOverviewData(competitionParameters)); tabLayout.addTab(competitionParameters, "Übersicht"); final FormLayout phaseATabContent = new FormLayout(); binders.appendBinder(showPhaseData(phaseATabContent, Phase.A)); tabLayout.addTab(phaseATabContent, "Phase A"); final FormLayout phaseDTabContent = new FormLayout(); binders.appendBinder(showPhaseData(phaseDTabContent, Phase.D)); tabLayout.addTab(phaseDTabContent, "Phase D"); final FormLayout phaseETabContent = new FormLayout(); binders.appendBinder(showPhaseData(phaseETabContent, Phase.E)); tabLayout.addTab(phaseETabContent, "Phase E"); final VerticalLayout outputLayout = new VerticalLayout(); final FormLayout outputParameters = new FormLayout(); final BeanItemContainer<String> driverDataSource = new BeanItemContainer<String>(String.class); final ComboBox selectDriverCombo = new ComboBox("Fahrer", driverDataSource); selectDriverCombo.setNewItemsAllowed(false); selectDriverCombo.setImmediate(true); outputLayout.addComponent(selectDriverCombo); binders.appendBinder( new DataBinder<MarathonData>() { private MarathonData data; @Override public void bindData(final MarathonData data) { this.data = data; driverDataSource.removeAllItems(); driverDataSource.addAll(data.getDrivers().keySet()); } @Override public void commitHandler() {} @Override public MarathonData getCurrentData() { return data; } }); // new Button("Erstelle PDF"); outputLayout.setSizeFull(); outputLayout.addComponent(outputParameters); outputLayout.setExpandRatio(outputParameters, 0); final MarathonData marathonData = loadMarathonData("default"); binders.bindData(marathonData); final StreamResource source = new StreamResource( new StreamSource() { @Override public InputStream getStream() { final ByteArrayOutputStream os = new ByteArrayOutputStream(); new GeneratePdf() .makePdf(os, binders.getCurrentData(), (String) selectDriverCombo.getValue()); return new ByteArrayInputStream(os.toByteArray()); } }, makeOutputFilename()); source.setMIMEType("application/pdf"); final BrowserFrame pdf = new BrowserFrame("Output", source); pdf.setSizeFull(); outputLayout.addComponent(pdf); outputLayout.setExpandRatio(pdf, 1); tabLayout.addTab(outputLayout, "Resultat"); tabLayout.setSizeFull(); layout.setExpandRatio(tabLayout, 1); layout.setSizeFull(); selectDriverCombo.addValueChangeListener( new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { binders.commitHandler(); saveMarathonData(binders.getCurrentData()); source.setFilename(makeOutputFilename()); pdf.markAsDirty(); } }); final Button saveButton = new Button( "Übernehmen", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { binders.commitHandler(); saveMarathonData(binders.getCurrentData()); source.setFilename(makeOutputFilename()); pdf.markAsDirty(); } }); layout.addComponent(saveButton); }
private void initUI() { addStyleName(Reindeer.WINDOW_LIGHT); setModal(true); setHeight("90%"); setWidth("60%"); center(); HorizontalLayout bottom = new HorizontalLayout(); bottom.setStyleName(ExplorerLayout.THEME); bottom.setSizeFull(); // bottom.setMargin(true); bottom.setSpacing(true); bottom.addStyleName(Runo.LAYOUT_DARKER); this.setContent(bottom); scheduleEventFieldGroup = new FieldGroup(); scheduleEventFieldGroup.setBuffered(true); if (currentBeanItem != null) { scheduleEventFieldGroup.setItemDataSource(currentBeanItem); } line = new GridLayout(4, 20); line.addStyleName("v-gridlayout"); line.setWidth("100%"); line.setSpacing(true); line.setMargin(true); final Label lbTitle = CommonFieldHandler.createLable("计划名称:"); line.addComponent(lbTitle); line.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT); final TextField txtTitle = new TextField(); txtTitle.setWidth("80%"); scheduleEventFieldGroup.bind(txtTitle, "name"); line.addComponent(txtTitle, 1, 0, 3, 0); line.setComponentAlignment(txtTitle, Alignment.MIDDLE_LEFT); Label label2 = CommonFieldHandler.createLable("开始时间:"); line.addComponent(label2, 0, 1, 0, 1); line.setComponentAlignment(label2, Alignment.MIDDLE_RIGHT); // 创建一个时间后台变化的listener BlurListener startTimeListener = createTimeReCountListener(); DateField startDateField = CommonFieldHandler.createDateField("", false); scheduleEventFieldGroup.bind(startDateField, "startDate"); startDateField.addBlurListener(startTimeListener); line.addComponent(startDateField, 1, 1, 1, 1); line.setComponentAlignment(startDateField, Alignment.MIDDLE_LEFT); Label label3 = CommonFieldHandler.createLable("估算时间:"); line.addComponent(label3, 2, 1, 2, 1); line.setComponentAlignment(label3, Alignment.MIDDLE_RIGHT); HorizontalLayout hlay = new HorizontalLayout(); final TextField estimateField = new TextField(); estimateField.setValue("1"); estimateField.setWidth("60px"); estimateField.setNullSettingAllowed(false); BlurListener timeReCountListener = createTimeReCountListener(); estimateField.addBlurListener(timeReCountListener); scheduleEventFieldGroup.bind(estimateField, "estimate"); hlay.addComponent(estimateField); Map<Object, String> data = new HashMap(); data.put(0, "天"); data.put(1, "时"); data.put(2, "分"); // WW_TODO 估算时间单位 ComboBox unit_cb = createComboBox(data, "55px"); scheduleEventFieldGroup.bind(unit_cb, "estimateUnit"); hlay.addComponent(unit_cb); line.addComponent(hlay, 3, 1, 3, 1); line.setComponentAlignment(hlay, Alignment.MIDDLE_LEFT); Label label4 = CommonFieldHandler.createLable("到期时间:"); line.addComponent(label4, 0, 2, 0, 2); line.setComponentAlignment(label4, Alignment.MIDDLE_RIGHT); completionDateField = CommonFieldHandler.createDateField("", false); line.addComponent(completionDateField, 1, 2, 1, 2); line.setComponentAlignment(completionDateField, Alignment.MIDDLE_LEFT); scheduleEventFieldGroup.bind(completionDateField, "completionDate"); // line.setExpandRatio(completionDateField, 1.0f); Label label6 = CommonFieldHandler.createLable("消耗时间:"); line.addComponent(label6, 2, 2, 2, 2); line.setComponentAlignment(label6, Alignment.MIDDLE_RIGHT); TextField gs1 = new TextField(); gs1.setValue("20%"); gs1.setInputPrompt("50%"); scheduleEventFieldGroup.bind(gs1, "useup"); line.addComponent(gs1, 3, 2, 3, 2); line.setComponentAlignment(gs1, Alignment.MIDDLE_LEFT); Label label5 = CommonFieldHandler.createLable("优先级:"); // label.setWidth("80px"); line.addComponent(label5, 0, 3, 0, 3); line.setComponentAlignment(label5, Alignment.MIDDLE_RIGHT); Map<Object, String> dtp = new HashMap(); dtp.put(0, "底"); dtp.put(1, "中"); dtp.put(2, "高"); ComboBox selectPriority = createComboBox(dtp, "100px"); // NativeSelect select = new NativeSelect(); // select.addItem("无"); // select.addItem("0(最低)"); // String itemId = "1(中)"; // select.addItem(itemId); // select.addItem("2(高)"); selectPriority.setNullSelectionAllowed(false); selectPriority.select(2); scheduleEventFieldGroup.bind(selectPriority, "priority"); line.addComponent(selectPriority, 1, 3, 1, 3); line.setComponentAlignment(selectPriority, Alignment.MIDDLE_LEFT); Label label1 = CommonFieldHandler.createLable("完成百分比:"); line.addComponent(label1, 2, 3, 2, 3); line.setComponentAlignment(label1, Alignment.MIDDLE_RIGHT); TextField tf = new TextField(); tf.setInputPrompt("50%"); line.addComponent(tf, 3, 3, 3, 3); line.setComponentAlignment(tf, Alignment.MIDDLE_LEFT); Label label7 = CommonFieldHandler.createLable("关联日程:"); line.addComponent(label7, 0, 4, 0, 4); line.setComponentAlignment(label7, Alignment.MIDDLE_RIGHT); CheckBox relatedCalendar_cb = new CheckBox(); relatedCalendar_cb.setValue(false); line.addComponent(relatedCalendar_cb, 1, 4, 1, 4); line.setComponentAlignment(relatedCalendar_cb, Alignment.MIDDLE_LEFT); scheduleEventFieldGroup.bind(relatedCalendar_cb, "relatedCalendar"); Label lbStatus = CommonFieldHandler.createLable("计划状态:"); lbStatus.setWidth("20px"); line.addComponent(lbStatus, 2, 4, 2, 4); line.setComponentAlignment(lbStatus, Alignment.MIDDLE_RIGHT); Map<Object, String> sta = new HashMap(); sta.put(0, "新建"); sta.put(1, "完成"); sta.put(2, "关闭"); sta.put(3, "取消"); ComboBox sectStatus = createComboBox(sta, "100px"); sectStatus.setNullSelectionAllowed(false); scheduleEventFieldGroup.bind(sectStatus, "status"); line.addComponent(sectStatus, 3, 4, 3, 4); line.setComponentAlignment(sectStatus, Alignment.MIDDLE_LEFT); Label label8 = CommonFieldHandler.createLable("关联外部任务:"); label8.setWidth("20px"); line.addComponent(label8, 0, 5, 0, 5); line.setComponentAlignment(label8, Alignment.MIDDLE_RIGHT); CheckBox cb = new CheckBox(); cb.setValue(true); line.addComponent(cb, 1, 5, 1, 5); line.setComponentAlignment(cb, Alignment.MIDDLE_LEFT); scheduleEventFieldGroup.bind(cb, "relatedTask"); Label label9 = CommonFieldHandler.createLable("外部任务类型:"); label9.setWidth("20px"); line.addComponent(label9, 2, 5, 2, 5); line.setComponentAlignment(label9, Alignment.MIDDLE_RIGHT); Map<Object, String> oat = new HashMap(); oat.put(0, "外包任务"); oat.put(1, "外包任务-类型2"); ComboBox select2 = createComboBox(oat, "150px"); // NativeSelect select2 = new NativeSelect(); // select2.addItem("外包任务"); // select2.addItem("外包任务-类型2"); select2.setNullSelectionAllowed(false); scheduleEventFieldGroup.bind(select2, "type"); line.addComponent(select2, 3, 5, 3, 5); line.setComponentAlignment(select2, Alignment.MIDDLE_LEFT); // select2.select("Timed"); Label lbOwnGrp = CommonFieldHandler.createLable("计划分配团队:"); lbOwnGrp.setWidth("20px"); line.addComponent(lbOwnGrp, 0, 6, 0, 6); line.setComponentAlignment(lbOwnGrp, Alignment.MIDDLE_RIGHT); // NativeSelect sectOwnGrp = new NativeSelect(); Map<Object, String> groupsMap = teamService.queryTeamOfUser(LoginHandler.getLoggedInUser().getId()); groupsMap.put("", "请选择"); ComboBox sectOwnGrp = createComboBox(groupsMap, "150px"); // for (String p : groupsMap.keySet()) { // String title = groupsMap.get(p); // sectOwnGrp.addItem(p); // sectOwnGrp.setItemCaption(p, title); // } sectOwnGrp.setNullSelectionAllowed(false); ValueChangeListener valueChangeListener = createValueChangeListener(); sectOwnGrp.addValueChangeListener(valueChangeListener); sectOwnGrp.setImmediate(true); scheduleEventFieldGroup.bind(sectOwnGrp, "assignedTeam"); line.addComponent(sectOwnGrp, 1, 6, 1, 6); line.setComponentAlignment(sectOwnGrp, Alignment.MIDDLE_LEFT); final Label lbOwner = CommonFieldHandler.createLable("计划分配用户:"); lbOwner.setWidth("20px"); line.addComponent(lbOwner, 2, 6, 2, 6); line.setComponentAlignment(lbOwner, Alignment.MIDDLE_RIGHT); // sectOwner = new NativeSelect(); // sectOwner.addItem("请选择"); sectOwner.setNullSelectionAllowed(false); scheduleEventFieldGroup.bind(sectOwner, "assignedUser"); line.addComponent(sectOwner, 3, 6, 3, 6); line.setComponentAlignment(sectOwner, Alignment.MIDDLE_LEFT); final Label lbDesc = CommonFieldHandler.createLable("计划描述:"); lbDesc.setWidth("15px"); line.addComponent(lbDesc, 0, 7, 0, 7); line.setComponentAlignment(lbDesc, Alignment.MIDDLE_RIGHT); final TextArea taDesc = CommonFieldHandler.createTextArea(""); taDesc.setWidth("85%"); taDesc.setHeight("290px"); scheduleEventFieldGroup.bind(taDesc, "description"); line.addComponent(taDesc, 1, 7, 3, 13); line.setComponentAlignment(taDesc, Alignment.MIDDLE_LEFT); // CKEditorConfig config = new CKEditorConfig(); final Button updateSave = new Button("保存"); updateSave.addClickListener( new ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { // WW_TODO 修改保存到数据库 Todo fieldGroupTodo = saveFieldGroupToDB(); fireEvent( new SubmitEvent( updateSave, SubmitEvent.SUBMITTED, scheduleEventFieldGroup.getItemDataSource())); // close popup window close(); /* * Todo fieldGroupTodo = saveFieldGroupToDB(); //reflash current * Item copyBeanValueToContainer(hContainer,(BeanItem<Todo>)( * scheduleEventFieldGroup.getItemDataSource())); //刷新日历 * main.refreshCalendarView(); Notification.show("保存成功", * Notification.Type.HUMANIZED_MESSAGE); //如果有外部流程,启动外部流程 if * (fieldGroupTodo.getRelatedTask()) { ViewToolManager * .showPopupWindow(new ActivityStartPopupWindow( "1111")); } */ if (fieldGroupTodo.getRelatedTask()) { ViewToolManager.showPopupWindow(new ActivityStartPopupWindow("1111")); } } }); line.addComponent(updateSave, 3, 14, 3, 14); line.setComponentAlignment(updateSave, Alignment.MIDDLE_RIGHT); // line.setExpandRatio(updateSave, 1.0f); bottom.addComponent(line); }
public void attach() { this.addStyleName("custom-report-step-caption"); Label caption = new Label("Select Reference Table"); caption.setStyleName("caption"); this.addComponent(caption); box.setWidth(fieldWidth); box.setImmediate(true); box.addStyleName("custom-report-step-box"); BeanItemContainer<ReportModel> container = new BeanItemContainer<ReportModel>(ReportModel.class); container.addAll(getReportModels()); box.setContainerDataSource(container); box.setItemCaptionPropertyId("tableLabel"); box.addListener(this); this.addComponent(box); columnLayout.setSpacing(true); columnLayout.setVisible(false); // List<ReportTable> relateReportTables=null; // if(getEditableReportTable()!=null){ // for(Iterator<ReportModel> it=container.getItemIds().iterator();it.hasNext();){ // rm=(ReportModel) it.next(); // if(rm.getTableName().equals(getEditableReportTable().getTableName())){ // box.setValue(rm); // mainReportTable=rm.getReportTables().iterator().next(); // relateReportTables=buildEditableRelatedTableInfo(); // break; // } // } // box.setValue(getEditableReportTable().getTableName()); // rm.getReportTables().addAll(relateReportTables); // } if (relateReportTables != null && isEditableFlg) { columnLayout.setVisible(true); columnLayout.setImmediate(true); // columnLayout.addComponent(gridLayout); // box.setValue(getEditableReportTable().getTableName()); // rm.getReportTables().addAll(relateReportTables); for (ReportTable relateRT : relateReportTables) { for (Iterator<ReportModel> it = container.getItemIds().iterator(); it.hasNext(); ) { ReportModel tempRm = it.next(); if (tempRm.getTableName().equals(relateRT.getTableName())) { box.setValue(tempRm); break; } } List<ReportColumn> columnFields = relateRT.getReportColumns(); for (final ReportColumn columnField : columnFields) { if (columnField.getColumnLabel() != null) { ReportColumnCard reportColumnCard = new ReportColumnCard(columnField) { private static final long serialVersionUID = 1L; @Override public void layoutClick(LayoutClickEvent event) { ReportColumn reportColumn = columnField; reportColumn.setColumnUseMode( ReportConfiguration.ReportColumnType.OutputColumn.toString()); rm.getSubTableSelectedColumns().add(reportColumn); } }; for (ReportColumn rc : relateRT.getReportColumns()) { if (rc.getColumnUseMode() != null && rc.getColumnUseMode() .equals(ReportConfiguration.ReportColumnType.OutputColumn.toString())) { if (rc.getColumnName().equals(columnField.getColumnName())) { reportColumnCard.getCheckBox().setValue(true); } } } gridLayout.addComponent(reportColumnCard); } } } } this.addComponent(columnLayout); reportColumnLabel.setStyleName("custom-report-step-column-caption"); reportColumnLabel.setVisible(false); reportColumnStepDesc.setStyleName("custom-report-step-column-desc"); reportColumnStepDesc.setVisible(false); this.addComponent(reportColumnLabel); this.addComponent(reportColumnStepDesc); gridLayout.setSizeFull(); gridLayout.setImmediate(true); gridLayout.addStyleName("custom-report-step-column-gridlayout"); this.addComponent(gridLayout); }
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("650px"); mainLayout.setHeight("220px"); mainLayout.setMargin(true); // top-level component properties setWidth("650px"); setHeight("220px"); // jobGroupField jobGroupField = new TextField(); jobGroupField.setCaption("Grupo"); jobGroupField.setImmediate(false); jobGroupField.setWidth("140px"); jobGroupField.setHeight("-1px"); jobGroupField.setRequired(true); mainLayout.addComponent(jobGroupField, "top:20.0px;left:180.0px;"); // jobIntervalField jobIntervalField = new TextField(); jobIntervalField.setCaption("Intervalo"); jobIntervalField.setImmediate(false); jobIntervalField.setWidth("60px"); jobIntervalField.setHeight("-1px"); mainLayout.addComponent(jobIntervalField, "top:180.0px;left:20.0px;"); // jobNameField jobNameField = new TextField(); jobNameField.setCaption("Nombre"); jobNameField.setImmediate(false); jobNameField.setWidth("140px"); jobNameField.setHeight("-1px"); jobNameField.setRequired(true); mainLayout.addComponent(jobNameField, "top:20.0px;left:20.0px;"); // jobTriggerPriorityField jobTriggerPriorityField = new TextField(); jobTriggerPriorityField.setCaption("Job Trigger Priority"); jobTriggerPriorityField.setImmediate(false); jobTriggerPriorityField.setWidth("160px"); jobTriggerPriorityField.setHeight("-1px"); mainLayout.addComponent(jobTriggerPriorityField, "top:140.0px;left:200.0px;"); // jobTriggerTypeField jobTriggerTypeField = new ComboBox(); jobTriggerTypeField.setCaption("Tipo Disparador"); jobTriggerTypeField.setImmediate(true); jobTriggerTypeField.setWidth("160px"); jobTriggerTypeField.setHeight("-1px"); jobTriggerTypeField.setRequired(true); mainLayout.addComponent(jobTriggerTypeField, "top:140.0px;left:20.0px;"); // cronExpressionField cronExpressionField = new TextField(); cronExpressionField.setCaption("Expresión Cron "); cronExpressionField.setImmediate(false); cronExpressionField.setWidth("340px"); cronExpressionField.setHeight("-1px"); mainLayout.addComponent(cronExpressionField, "top:180.0px;left:20.0px;"); // descriptionField descriptionField = new TextField(); descriptionField.setCaption("Descripción"); descriptionField.setImmediate(false); descriptionField.setWidth("620px"); descriptionField.setHeight("-1px"); mainLayout.addComponent(descriptionField, "top:100.0px;left:20.0px;"); // endTimeField endTimeField = new DateField(); endTimeField.setCaption("Fecha Finalización"); endTimeField.setImmediate(false); endTimeField.setWidth("-1px"); endTimeField.setHeight("-1px"); endTimeField.setInvalidAllowed(false); mainLayout.addComponent(endTimeField, "top:60.0px;left:225.0px;"); // futureField futureField = new CheckBox(); futureField.setCaption("Futuro"); futureField.setImmediate(false); futureField.setWidth("-1px"); futureField.setHeight("-1px"); mainLayout.addComponent(futureField, "top:140.0px;left:585.0px;"); // future_timeField future_timeField = new TextField(); future_timeField.setCaption("Future_time"); future_timeField.setImmediate(false); future_timeField.setWidth("160px"); future_timeField.setHeight("-1px"); mainLayout.addComponent(future_timeField, "top:140.0px;left:400.0px;"); // repeatCountField repeatCountField = new TextField(); repeatCountField.setCaption("Repeticiones"); repeatCountField.setImmediate(false); repeatCountField.setWidth("60px"); repeatCountField.setHeight("24px"); mainLayout.addComponent(repeatCountField, "top:180.0px;right:290.0px;"); // startTimeField startTimeField = new DateField(); startTimeField.setCaption("Fecha Comienzo"); startTimeField.setImmediate(false); startTimeField.setWidth("-1px"); startTimeField.setHeight("-1px"); startTimeField.setInvalidAllowed(false); mainLayout.addComponent(startTimeField, "top:60.0px;left:20.0px;"); // areaField areaField = new ComboBox(); areaField.setCaption("Area Trabajo"); areaField.setImmediate(false); areaField.setWidth("-1px"); areaField.setHeight("-1px"); areaField.setRequired(true); mainLayout.addComponent(areaField, "top:60.0px;left:420.0px;"); // jobCalendarField jobCalendarField = new JobTriggerCalendarField(); jobCalendarField.setImmediate(false); jobCalendarField.setWidth("-1px"); jobCalendarField.setHeight("-1px"); mainLayout.addComponent(jobCalendarField, "top:167.0px;left:397.0px;"); // jobIntervalTypeField jobIntervalTypeField = new ComboBox(); jobIntervalTypeField.setCaption("Tipo Intervalo"); jobIntervalTypeField.setImmediate(false); jobIntervalTypeField.setWidth("175px"); jobIntervalTypeField.setHeight("-1px"); mainLayout.addComponent(jobIntervalTypeField, "top:180.0px;left:100.0px;"); return mainLayout; }
@AutoGenerated private VerticalLayout buildVerticalLayout_3() { // common part: create layout verticalLayout_3 = new VerticalLayout(); verticalLayout_3.setStyleName("h1"); verticalLayout_3.setCaption("Administracion del Usuario"); verticalLayout_3.setImmediate(false); verticalLayout_3.setWidth("-1px"); verticalLayout_3.setHeight("-1px"); verticalLayout_3.setMargin(true); verticalLayout_3.setSpacing(true); // txtUsuario txtUsuario = new TextField(); txtUsuario.setCaption("Usuario:"); txtUsuario.setImmediate(false); txtUsuario.setWidth("-1px"); txtUsuario.setHeight("-1px"); txtUsuario.setRequired(true); txtUsuario.setInputPrompt("Usuario de logueo "); verticalLayout_3.addComponent(txtUsuario); // horizontalLayout_1 horizontalLayout_1 = buildHorizontalLayout_1(); verticalLayout_3.addComponent(horizontalLayout_1); // txtNombres txtNombres = new TextField(); txtNombres.setCaption("Nombre:"); txtNombres.setImmediate(false); txtNombres.setWidth("164px"); txtNombres.setHeight("-1px"); txtNombres.setRequired(true); txtNombres.setInputPrompt("Nombre de inicio de sesión"); verticalLayout_3.addComponent(txtNombres); // txtApellidoPaterno txtApellidoPaterno = new TextField(); txtApellidoPaterno.setCaption("Paterno"); txtApellidoPaterno.setImmediate(false); txtApellidoPaterno.setWidth("250px"); txtApellidoPaterno.setHeight("-1px"); txtApellidoPaterno.setRequired(true); txtApellidoPaterno.setInputPrompt("Apellido Paterno"); verticalLayout_3.addComponent(txtApellidoPaterno); // txtApellidoMaterno txtApellidoMaterno = new TextField(); txtApellidoMaterno.setCaption("Materno"); txtApellidoMaterno.setImmediate(false); txtApellidoMaterno.setWidth("250px"); txtApellidoMaterno.setHeight("-1px"); txtApellidoMaterno.setRequired(true); txtApellidoMaterno.setInputPrompt("Apellido Materno"); verticalLayout_3.addComponent(txtApellidoMaterno); // cmbOficina cmbOficina = new ComboBox(); cmbOficina.setCaption("Oficina"); cmbOficina.setImmediate(false); cmbOficina.setWidth("204px"); cmbOficina.setHeight("-1px"); cmbOficina.setRequired(true); verticalLayout_3.addComponent(cmbOficina); // cmbRol cmbRol = new ComboBox(); cmbRol.setCaption("Rol"); cmbRol.setImmediate(false); cmbRol.setWidth("194px"); cmbRol.setHeight("-1px"); cmbRol.setRequired(true); verticalLayout_3.addComponent(cmbRol); // txtCargo txtCargo = new TextField(); txtCargo.setCaption("Cargo"); txtCargo.setImmediate(false); txtCargo.setWidth("250px"); txtCargo.setHeight("-1px"); txtCargo.setRequired(true); txtCargo.setInputPrompt("Cargo que desempeña"); verticalLayout_3.addComponent(txtCargo); // txtCargoDescripcion txtCargoDescripcion = new TextField(); txtCargoDescripcion.setCaption("Descripcion del Cargo"); txtCargoDescripcion.setImmediate(false); txtCargoDescripcion.setWidth("250px"); txtCargoDescripcion.setHeight("-1px"); txtCargoDescripcion.setRequired(true); txtCargoDescripcion.setInputPrompt("Breve descripcion del Cargo que desempeña"); verticalLayout_3.addComponent(txtCargoDescripcion); // horizontalLayout_2 horizontalLayout_2 = buildHorizontalLayout_2(); verticalLayout_3.addComponent(horizontalLayout_2); verticalLayout_3.setComponentAlignment(horizontalLayout_2, new Alignment(48)); return verticalLayout_3; }
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("560px"); mainLayout.setHeight("280px"); mainLayout.setMargin(true); // top-level component properties setWidth("560px"); setHeight("280px"); // commentField commentField = new TextField(); commentField.setCaption("Comentario"); commentField.setImmediate(false); commentField.setWidth("520px"); commentField.setHeight("120px"); commentField.setTabIndex(9); mainLayout.addComponent(commentField, "top:140.0px;left:20.0px;"); // kmField kmField = new TextField(); kmField.setCaption("Km"); kmField.setImmediate(false); kmField.setWidth("80px"); kmField.setHeight("-1px"); kmField.setTabIndex(7); mainLayout.addComponent(kmField, "top:98.0px;left:260.0px;"); // punctureField punctureField = new TextField(); punctureField.setCaption("Pinchazos"); punctureField.setImmediate(false); punctureField.setWidth("140px"); punctureField.setHeight("-1px"); punctureField.setTabIndex(5); mainLayout.addComponent(punctureField, "top:56.0px;left:400.0px;"); // serialNumberField serialNumberField = new TextField(); serialNumberField.setCaption("Número de serie"); serialNumberField.setImmediate(false); serialNumberField.setWidth("160px"); serialNumberField.setHeight("-1px"); serialNumberField.setTabIndex(1); serialNumberField.setRequired(true); mainLayout.addComponent(serialNumberField, "top:17.0px;left:20.0px;"); // vehicleLocationField vehicleLocationField = new TextField(); vehicleLocationField.setCaption("Ubicación vehículo"); vehicleLocationField.setImmediate(false); vehicleLocationField.setWidth("120px"); vehicleLocationField.setHeight("-1px"); vehicleLocationField.setTabIndex(4); mainLayout.addComponent(vehicleLocationField, "top:56.0px;left:260.0px;"); // supplierField supplierField = new ComboBox(); supplierField.setCaption("Proveedor"); supplierField.setImmediate(false); supplierField.setWidth("220px"); supplierField.setHeight("-1px"); supplierField.setTabIndex(6); mainLayout.addComponent(supplierField, "top:100.0px;left:20.0px;"); // tireTypeField tireTypeField = new ComboBox(); tireTypeField.setCaption("Tipo neumático"); tireTypeField.setImmediate(false); tireTypeField.setWidth("168px"); tireTypeField.setHeight("-1px"); tireTypeField.setTabIndex(8); tireTypeField.setRequired(true); mainLayout.addComponent(tireTypeField, "top:97.0px;left:372.0px;"); // vehicleField vehicleField = new ComboBox(); vehicleField.setCaption("Vehículo"); vehicleField.setImmediate(false); vehicleField.setWidth("220px"); vehicleField.setHeight("-1px"); vehicleField.setTabIndex(3); vehicleField.setRequired(true); mainLayout.addComponent(vehicleField, "top:56.0px;left:20.0px;"); // tireStatusField tireStatusField = new ComboBox(); tireStatusField.setCaption("Estado neumático"); tireStatusField.setImmediate(false); tireStatusField.setWidth("168px"); tireStatusField.setHeight("-1px"); tireStatusField.setTabIndex(2); tireStatusField.setRequired(true); mainLayout.addComponent(tireStatusField, "top:17.0px;left:372.0px;"); return mainLayout; }
@Override public void postConstruct() { flagNuevoUsuario = true; btnCrearUsuario.setIcon(Constante.ICONOS.SAVE); btnEliminarUsuario.setIcon(Constante.ICONOS.DELETE); btnAgregarPolicia.setIcon(Constante.ICONOS.CREATE); lstRoles = rolService.buscar(null); BeanItemContainer<Rol> bicRoles = new BeanItemContainer<Rol>(Rol.class, lstRoles); cmbRol.setInputPrompt("Rol"); cmbRol.setContainerDataSource(bicRoles); cmbRol.setItemCaptionPropertyId("nombre"); cmbRol.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); cmbRol.setImmediate(true); cmbRol.addListener((ValueChangeListener) this); lstPolicias = policiaService.buscar(null); BeanItemContainer<Policia> bicPolicias = new BeanItemContainer<Policia>(Policia.class, lstPolicias); cmbPolicia.setInputPrompt("Policia"); cmbPolicia.setContainerDataSource(bicPolicias); cmbPolicia.setItemCaptionPropertyId("nombreCompleto"); cmbPolicia.setImmediate(true); cmbPolicia.addListener( new ValueChangeListener() { private static final long serialVersionUID = 4418094011985520491L; @Override public void valueChange(ValueChangeEvent event) { pintarPersona(event); } private void pintarPersona(ValueChangeEvent event) { if (cmbPolicia.getValue() != null) { Policia policia = (Policia) cmbPolicia.getValue(); txtApellidoPaterno.setValue(policia.getPersona().getApePaterno()); txtApellidoMaterno.setValue(policia.getPersona().getApeMaterno()); txtNombres.setValue(policia.getPersona().getNombres()); txtCargo.setValue( policia.getCargo() != null ? policia.getCargo().getNombre() : StringUtils.EMPTY); } } }); cmbPolicia.addListener((ValueChangeListener) this); cmbOficina.setItemCaptionPropertyId("nombre"); cmbOficina.setInputPrompt("Oficina"); lstDependencias = dependenciasService.buscar(null); BeanItemContainer<Dependencia> bicDependencias = new BeanItemContainer<Dependencia>(Dependencia.class, lstDependencias); cmbOficina.setContainerDataSource(bicDependencias); cmbOficina.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); cmbOficina.setImmediate(true); cmbOficina.addListener((ValueChangeListener) this); tblUsuarios.setSelectable(true); tblUsuarios.setImmediate(true); tblUsuarios.setNullSelectionAllowed(true); tblUsuarios.setNullSelectionItemId(null); habilitarBoton(false); btnCrearUsuario.addListener((ClickListener) this); btnEliminarUsuario.addListener((ClickListener) this); btnAgregarPolicia.addListener((ClickListener) this); tblUsuarios.addListener( new ValueChangeListener() { private static final long serialVersionUID = -6124596484581515359L; @Override public void valueChange(ValueChangeEvent event) { boolean esModoNuevo = tblUsuarios.getValue() == null; habilitarBoton(!esModoNuevo); limpiar(); if (esModoNuevo) { tblUsuarios.setValue(null); habilitarEdicion(esModoNuevo); } else { Item item = tblUsuarios.getItem(tblUsuarios.getValue()); clave = item.getItemProperty("clave").getValue().toString(); txtUsuario.setValue(item.getItemProperty("usuario").getValue()); txtNombres.setValue(item.getItemProperty("nombres").getValue()); txtApellidoPaterno.setValue(item.getItemProperty("apePat").getValue()); txtApellidoMaterno.setValue(item.getItemProperty("apeMat").getValue()); cmbPolicia.select(item.getItemProperty("policia").getValue()); cmbOficina.select(item.getItemProperty("dependencia").getValue()); cmbRol.select(item.getItemProperty("rol").getValue()); txtCargo.setValue( item.getItemProperty("cargo").getValue() != null ? item.getItemProperty("cargo").getValue() : StringUtils.EMPTY); txtCargoDescripcion.setValue( item.getItemProperty("descCargo").getValue() != null ? item.getItemProperty("descCargo").getValue() : StringUtils.EMPTY); habilitarEdicion(esModoNuevo); } } }); txtFiltroUsuario.addShortcutListener( new ShortcutListener("", KeyCode.ENTER, null) { private static final long serialVersionUID = 4068232062569621771L; @Override public void handleAction(Object sender, Object target) { shortCutEnter(sender, target); } }); txtFiltroNombres.addShortcutListener( new ShortcutListener("", KeyCode.ENTER, null) { private static final long serialVersionUID = 4068232062569621771L; @Override public void handleAction(Object sender, Object target) { shortCutEnter(sender, target); } }); txtFiltroApePaterno.addShortcutListener( new ShortcutListener("", KeyCode.ENTER, null) { private static final long serialVersionUID = 4068232062569621771L; @Override public void handleAction(Object sender, Object target) { shortCutEnter(sender, target); } }); txtFiltroApeMaterno.addShortcutListener( new ShortcutListener("", KeyCode.ENTER, null) { private static final long serialVersionUID = 4068232062569621771L; @Override public void handleAction(Object sender, Object target) { shortCutEnter(sender, target); } }); txtFiltroCargo.addShortcutListener( new ShortcutListener("", KeyCode.ENTER, null) { private static final long serialVersionUID = 4068232062569621771L; @Override public void handleAction(Object sender, Object target) { shortCutEnter(sender, target); } }); txtFiltroOficina.addShortcutListener( new ShortcutListener("", KeyCode.ENTER, null) { private static final long serialVersionUID = 4068232062569621771L; @Override public void handleAction(Object sender, Object target) { shortCutEnter(sender, target); } }); txtUsuario.setImmediate(true); txtNombres.setImmediate(true); txtApellidoPaterno.setImmediate(true); txtApellidoMaterno.setImmediate(true); txtCargo.setImmediate(true); txtFiltroOficina.setImmediate(true); txtUsuario.addListener((TextChangeListener) this); txtNombres.addListener((TextChangeListener) this); txtApellidoPaterno.addListener((TextChangeListener) this); txtApellidoMaterno.addListener((TextChangeListener) this); txtCargo.addListener((TextChangeListener) this); txtFiltroOficina.addListener((TextChangeListener) this); lstUsuarios = usuarioService.buscar(null); cargarUsuarios(lstUsuarios, true); }
/** * The constructor should first build the main layout, set the composition root and then do any * custom initialization. * * <p>The constructor will not be automatically regenerated by the visual editor. * * @throws Exception * @throws IllegalArgumentException */ public JobViewForm() throws IllegalArgumentException, Exception { buildMainLayout(); setCompositionRoot(mainLayout); // TODO add user code here initComponents(); cronExpressionField.setVisible(false); future_timeField.setEnabled(false); startTimeField.setResolution(DateField.RESOLUTION_SEC); endTimeField.setResolution(DateField.RESOLUTION_SEC); // configure Type data areaField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); areaField.setItemCaptionPropertyId("name"); jobTriggerTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); jobTriggerTypeField.setItemCaptionPropertyId("description"); jobIntervalTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); jobIntervalTypeField.setItemCaptionPropertyId("description"); // get form services from OSGi Service Registry getServices(); // load data sources loadData(); futureField.setImmediate(true); futureField.addListener( new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() == null) return; if ((Boolean) event.getProperty().getValue()) future_timeField.setEnabled(true); else { future_timeField.setValue(null); future_timeField.setEnabled(false); } } }); jobTriggerTypeField.setImmediate(true); jobTriggerTypeField.setNullSelectionAllowed(false); jobTriggerTypeField.addListener( new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() == null) return; if (((JobTriggerType) event.getProperty().getValue()) .getCode() .equals(Job.JOB_TRIGGER_TYPE.SIMPLE.name())) { jobIntervalField.setVisible(true); jobIntervalTypeField.setVisible(true); repeatCountField.setVisible(true); cronExpressionField.setVisible(false); } else { jobIntervalField.setVisible(false); jobIntervalTypeField.setVisible(false); repeatCountField.setVisible(false); cronExpressionField.setVisible(true); } } }); }
/** * Instantiates a new include collection window. * * @param dataCollectionConfigDao the data collection configuration DAO * @param container the source list of elements * @param wrapper the current selected value */ public IncludeCollectionWindow( final DataCollectionConfigDao dataCollectionConfigDao, final BeanItemContainer<IncludeCollectionWrapper> container, final IncludeCollectionWrapper wrapper) { setCaption("Include SystemDef/DataCollectionGroup"); setModal(true); setWidth("400px"); setHeight("180px"); setResizable(false); setClosable(false); addStyleName(Runo.WINDOW_DIALOG); form.setImmediate(true); form.setWidth("100%"); form.setWriteThrough(false); form.getLayout().setMargin(true); final ComboBox valueField = new ComboBox("Value"); valueField.setEnabled(false); valueField.setRequired(true); valueField.setImmediate(true); valueField.setNewItemsAllowed(false); valueField.setNullSelectionAllowed(false); final ComboBox typeField = new ComboBox("Type"); typeField.setRequired(true); typeField.setImmediate(true); typeField.setNewItemsAllowed(false); typeField.setNullSelectionAllowed(false); typeField.addItem(IncludeCollectionWrapper.DC_GROUP); typeField.addItem(IncludeCollectionWrapper.SYSTEM_DEF); typeField.addListener( new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String selected = (String) typeField.getValue(); if (selected == null) { return; } // Get available fields. // FIXME If a new dcGroup is added, DataCollectionConfigDao is not able to reach it. List<String> values = selected.equals(IncludeCollectionWrapper.SYSTEM_DEF) ? dataCollectionConfigDao.getAvailableSystemDefs() : dataCollectionConfigDao.getAvailableDataCollectionGroups(); // Remove already selected for (IncludeCollectionWrapper obj : container.getItemIds()) { if (obj.getType().equals(selected)) { values.remove(obj.getValue()); } } // Updating combo-box valueField.removeAllItems(); for (String v : values) { valueField.addItem(v); } if (wrapper.getValue() != null) { valueField.addItem(wrapper.getValue()); } valueField.setEnabled(valueField.getItemIds().size() > 1); } }); form.setFormFieldFactory( new FormFieldFactory() { @Override public Field createField(Item item, Object propertyId, Component uiContext) { if (propertyId.equals("type")) return typeField; if (propertyId.equals("value")) return valueField; return null; } }); okButton = new Button("Update"); okButton.addListener(this); cancelButton = new Button("Cancel"); cancelButton.addListener(this); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addComponent(okButton); toolbar.addComponent(cancelButton); addComponent(form); addComponent(toolbar); ((VerticalLayout) getContent()).setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT); form.setItemDataSource(new BeanItem<IncludeCollectionWrapper>(wrapper)); }
@Override public void init() { inputUserName = new TextField("Nama Untuk Log In"); inputUserName.setDescription("Nama yang digunakan untuk log in"); inputUserName.setImmediate(true); inputUserName.setWidth(function.FORM_WIDTH); inputUserName.setMaxLength(10); inputUserName.addValueChangeListener(this); inputName = new TextField("Nama Lengkap"); inputName.setDescription("Nama lengkap pengguna"); inputName.setImmediate(true); inputName.addValueChangeListener(this); inputName.setWidth(function.FORM_WIDTH); selectRole = new ComboBox("Role Pengguna"); selectRole.setImmediate(true); selectRole.setDescription("Role dari pengguna"); selectRole.addValueChangeListener(this); selectRole.setWidth(function.FORM_WIDTH); selectRole.setNullSelectionAllowed(false); inputEmployeeNum = new TextField("Nomor pegawai"); inputEmployeeNum.setDescription("Nomor pegawai"); inputEmployeeNum.addValueChangeListener(this); inputEmployeeNum.setImmediate(true); inputEmployeeNum.setWidth(function.FORM_WIDTH); inputTitle = new TextField("Jabatan"); inputTitle.setDescription("Jabatan dari pengguna"); inputTitle.addValueChangeListener(this); inputTitle.setImmediate(true); inputTitle.setWidth(function.FORM_WIDTH); inputPhoneNumber = new TextField("Nomor Telepon"); inputPhoneNumber.setDescription("Nomor Telepon yang bisa dihubungi"); inputPhoneNumber.setImmediate(true); inputPhoneNumber.addValueChangeListener(this); inputPhoneNumber.setWidth(function.FORM_WIDTH); inputAddress = new TextArea("Alamat"); inputAddress.setDescription("Alamat pengguna"); inputAddress.addValueChangeListener(this); inputAddress.setImmediate(true); inputAddress.setWidth(function.FORM_WIDTH); inputPassword1 = new PasswordField("Password"); inputPassword1.setDescription("Masukan password untuk pengguna"); inputPassword1.addValueChangeListener(this); inputPassword1.setImmediate(true); inputPassword1.setWidth(function.FORM_WIDTH); inputPassword2 = new PasswordField("Ulangi Password"); inputPassword2.setDescription("Masukan password untuk pengguna"); inputPassword2.addValueChangeListener(this); inputPassword2.setImmediate(true); inputPassword2.setWidth(function.FORM_WIDTH); inputSika = new TextField("SIKA"); inputSika.setDescription("Masukan nomor SIKA"); inputSika.addValueChangeListener(this); inputSika.setImmediate(true); inputSika.setWidth(function.FORM_WIDTH); labelError = new Label() { { setVisible(false); addStyleName("form-error"); setContentMode(ContentMode.HTML); } }; buttonSubmit = new Button("Simpan"); buttonSubmit.addClickListener(this); buttonSaveEdit = new Button("Simpan Perubahan"); buttonSaveEdit.addClickListener(this); buttonReset = new Button("Reset Form"); buttonReset.addClickListener(this); buttonCancel = new Button("Batalkan"); buttonCancel.addClickListener(this); buttonActivation = new Button(""); buttonActivation.addClickListener(this); buttonResetPassword = new Button("Reset Password"); buttonResetPassword.addClickListener(this); construct(); }