List of usage examples for com.vaadin.ui.themes ValoTheme FORMLAYOUT_LIGHT
String FORMLAYOUT_LIGHT
To view the source code for com.vaadin.ui.themes ValoTheme FORMLAYOUT_LIGHT.
Click Source Link
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.RequirementSpecComponent.java
License:Apache License
private void init() { FormLayout layout = new FormLayout(); setContent(layout);/*from ww w . j a va 2s .c o m*/ addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(rs.getClass()); binder.setItemDataSource(rs); Field<?> name = binder.buildAndBind(TRANSLATOR.translate("general.name"), "name"); layout.addComponent(name); Field desc = binder.buildAndBind(TRANSLATOR.translate("general.description"), "description", TextArea.class); desc.setSizeFull(); layout.addComponent(desc); Field<?> date = binder.buildAndBind(TRANSLATOR.translate("general.modification.data"), "modificationDate"); layout.addComponent(date); date.setEnabled(false); SpecLevelJpaController controller = new SpecLevelJpaController(DataBaseManager.getEntityManagerFactory()); List<SpecLevel> levels = controller.findSpecLevelEntities(); BeanItemContainer<SpecLevel> specLevelContainer = new BeanItemContainer<>(SpecLevel.class, levels); ComboBox level = new ComboBox(TRANSLATOR.translate("spec.level")); level.setContainerDataSource(specLevelContainer); level.getItemIds().forEach(id -> { level.setItemCaption(id, TRANSLATOR.translate(((SpecLevel) id).getName())); }); binder.bind(level, "specLevel"); layout.addComponent(level); Button cancel = new Button(TRANSLATOR.translate("general.cancel")); cancel.addClickListener((Button.ClickEvent event) -> { binder.discard(); if (rs.getRequirementSpecPK() == null) { ((VMUI) UI.getCurrent()).displayObject(rs.getProject()); } else { ((VMUI) UI.getCurrent()).displayObject(rs, false); } }); if (edit) { if (rs.getRequirementSpecPK() == null) { //Creating a new one Button save = new Button(TRANSLATOR.translate("general.save")); save.addClickListener((Button.ClickEvent event) -> { try { rs.setName(name.getValue().toString()); rs.setModificationDate(new Date()); rs.setSpecLevel((SpecLevel) level.getValue()); rs.setProject(((Project) ((VMUI) UI.getCurrent()).getSelectdValue())); rs.setRequirementSpecPK( new RequirementSpecPK(rs.getProject().getId(), rs.getSpecLevel().getId())); new RequirementSpecJpaController(DataBaseManager.getEntityManagerFactory()).create(rs); setVisible(false); //Recreate the tree to show the addition ((VMUI) UI.getCurrent()).updateProjectList(); ((VMUI) UI.getCurrent()).buildProjectTree(rs); ((VMUI) UI.getCurrent()).displayObject(rs, true); ((VMUI) UI.getCurrent()).updateScreen(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.creation"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(save); hl.addComponent(cancel); layout.addComponent(hl); } else { //Editing existing one Button update = new Button(TRANSLATOR.translate("general.update")); update.addClickListener((Button.ClickEvent event) -> { try { rs.setName(name.getValue().toString()); rs.setModificationDate(new Date()); rs.setSpecLevel((SpecLevel) level.getValue()); ((VMUI) UI.getCurrent()).handleVersioning(rs, () -> { try { new RequirementSpecJpaController(DataBaseManager.getEntityManagerFactory()) .edit(rs); ((VMUI) UI.getCurrent()).displayObject(rs, true); } catch (NonexistentEntityException ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(update); hl.addComponent(cancel); layout.addComponent(hl); } } binder.setReadOnly(!edit); binder.bindMemberFields(this); layout.setSizeFull(); setSizeFull(); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.RequirementSpecNodeComponent.java
License:Apache License
private void init() { FormLayout layout = new FormLayout(); setContent(layout);// w ww .j a v a2 s. co m addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(rsn.getClass()); binder.setItemDataSource(rsn); Field<?> name = binder.buildAndBind(TRANSLATOR.translate("general.name"), "name"); layout.addComponent(name); Field desc = binder.buildAndBind(TRANSLATOR.translate("general.description"), "description", TextArea.class); desc.setSizeFull(); layout.addComponent(desc); Field<?> scope = binder.buildAndBind(TRANSLATOR.translate("general.scope"), "scope"); layout.addComponent(scope); Button cancel = new Button(TRANSLATOR.translate("general.cancel")); cancel.addClickListener((Button.ClickEvent event) -> { binder.discard(); if (rsn.getRequirementSpecNodePK() == null) { ((VMUI) UI.getCurrent()).displayObject(rsn.getRequirementSpec()); } else { ((VMUI) UI.getCurrent()).displayObject(rsn, false); } }); if (edit) { if (rsn.getRequirementSpecNodePK() == null) { //Creating a new one Button save = new Button(TRANSLATOR.translate("general.save")); save.addClickListener((Button.ClickEvent event) -> { try { rsn.setName(name.getValue().toString()); rsn.setDescription(desc.getValue().toString()); rsn.setScope(scope.getValue().toString()); rsn.setRequirementSpec((RequirementSpec) ((VMUI) UI.getCurrent()).getSelectdValue()); new RequirementSpecNodeJpaController(DataBaseManager.getEntityManagerFactory()).create(rsn); setVisible(false); //Recreate the tree to show the addition ((VMUI) UI.getCurrent()).updateProjectList(); ((VMUI) UI.getCurrent()).buildProjectTree(rsn); ((VMUI) UI.getCurrent()).displayObject(rsn, true); ((VMUI) UI.getCurrent()).updateScreen(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.creation"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(save); hl.addComponent(cancel); layout.addComponent(hl); } else { //Editing existing one Button update = new Button(TRANSLATOR.translate("general.update")); update.addClickListener((Button.ClickEvent event) -> { rsn.setName(name.getValue().toString()); rsn.setDescription(desc.getValue().toString()); rsn.setScope(scope.getValue().toString()); ((VMUI) UI.getCurrent()).handleVersioning(rsn, () -> { try { new RequirementSpecNodeJpaController(DataBaseManager.getEntityManagerFactory()) .edit(rsn); ((VMUI) UI.getCurrent()).displayObject(rsn, true); } catch (NonexistentEntityException ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(update); hl.addComponent(cancel); layout.addComponent(hl); } } binder.setReadOnly(!edit); binder.bindMemberFields(this); layout.setSizeFull(); setSizeFull(); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.RequirementTypeComponent.java
License:Apache License
private void init() { FormLayout layout = new FormLayout(); setContent(layout);// www . j av a 2 s . c o m addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(rt.getClass()); binder.setItemDataSource(rt); Field<?> name = binder.buildAndBind(TRANSLATOR.translate("general.name"), "name"); layout.addComponent(name); Field<?> desc = binder.buildAndBind(TRANSLATOR.translate("general.description"), "description"); layout.addComponent(desc); if (edit) { Button update = new Button(rt.getId() == null ? TRANSLATOR.translate("general.create") : TRANSLATOR.translate("general.update")); update.addClickListener((Button.ClickEvent event) -> { RequirementTypeJpaController c = new RequirementTypeJpaController( DataBaseManager.getEntityManagerFactory()); if (rt.getId() == null) { rt.setName((String) name.getValue()); rt.setDescription((String) desc.getValue()); c.create(rt); } else { try { binder.commit(); } catch (FieldGroup.CommitException ex) { LOG.log(Level.SEVERE, null, ex); } } }); Button cancel = new Button( Lookup.getDefault().lookup(InternationalizationProvider.class).translate("general.cancel")); cancel.addClickListener((Button.ClickEvent event) -> { binder.discard(); ((VMUI) UI.getCurrent()).updateScreen(); }); binder.setReadOnly(!edit); binder.setBuffered(true); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(update); hl.addComponent(cancel); layout.addComponent(hl); } }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.StepComponent.java
License:Apache License
private void init() { FormLayout layout = new FormLayout(); setContent(layout);//from w w w . jav a2s .co m addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(s.getClass()); binder.setItemDataSource(s); Field<?> sequence = binder.buildAndBind(TRANSLATOR.translate("general.sequence"), "stepSequence"); layout.addComponent(sequence); TextArea text = new TextArea(TRANSLATOR.translate("general.text")); text.setConverter(new ByteToStringConverter()); binder.bind(text, "text"); layout.addComponent(text); TextArea result = new TextArea(TRANSLATOR.translate("expected.result")); result.setConverter(new ByteToStringConverter()); binder.bind(result, "expectedResult"); layout.addComponent(result); Field notes = binder.buildAndBind(TRANSLATOR.translate("general.notes"), "notes", TextArea.class); notes.setSizeFull(); layout.addComponent(notes); if (!s.getRequirementList().isEmpty() && !edit) { layout.addComponent(((ValidationManagerUI) UI.getCurrent()).getDisplayRequirementList( TRANSLATOR.translate("related.requirements"), s.getRequirementList())); } else { AbstractSelect requirements = ((ValidationManagerUI) UI.getCurrent()) .getRequirementSelectionComponent(); //Select the exisitng ones. if (s.getRequirementList() != null) { s.getRequirementList().forEach((r) -> { requirements.select(r); }); } requirements.addValueChangeListener(event -> { Set<Requirement> selected = (Set<Requirement>) event.getProperty().getValue(); s.getRequirementList().clear(); selected.forEach(r -> { s.getRequirementList().add(r); }); }); layout.addComponent(requirements); } DataEntryComponent fields = new DataEntryComponent(edit); binder.bind(fields, "dataEntryList"); layout.addComponent(fields); binder.setReadOnly(edit); Button cancel = new Button(TRANSLATOR.translate("general.cancel")); cancel.addClickListener((Button.ClickEvent event) -> { binder.discard(); if (s.getStepPK() == null) { ((ValidationManagerUI) UI.getCurrent()) .displayObject(((ValidationManagerUI) UI.getCurrent()).getTree().getValue()); } else { ((ValidationManagerUI) UI.getCurrent()).displayObject(s, false); } }); if (edit) { Button add = new Button(TRANSLATOR.translate("add.field")); add.addClickListener(listener -> { VMWindow w = new VMWindow(); FormLayout fl = new FormLayout(); ComboBox newType = new ComboBox(TRANSLATOR.translate("general.type")); newType.setNewItemsAllowed(false); newType.setTextInputAllowed(false); newType.addValidator(new NullValidator(TRANSLATOR.translate("message.required.field.missing") .replaceAll("%f", TRANSLATOR.translate("general.type")), false)); BeanItemContainer<DataEntryType> container = new BeanItemContainer<>(DataEntryType.class, new DataEntryTypeJpaController(DataBaseManager.getEntityManagerFactory()) .findDataEntryTypeEntities()); newType.setContainerDataSource(container); newType.getItemIds().forEach(id -> { DataEntryType temp = ((DataEntryType) id); newType.setItemCaption(id, TRANSLATOR.translate(temp.getTypeName())); }); fl.addComponent(newType); TextField tf = new TextField(TRANSLATOR.translate("general.name")); fl.addComponent(tf); HorizontalLayout hl = new HorizontalLayout(); Button a = new Button(TRANSLATOR.translate("general.add")); a.addClickListener(l -> { DataEntryType det = (DataEntryType) newType.getValue(); DataEntry de = null; switch (det.getId()) { case 1: de = DataEntryServer.getStringField(tf.getValue()); break; case 2: de = DataEntryServer.getNumericField(tf.getValue(), null, null); break; case 3: de = DataEntryServer.getBooleanField(tf.getValue()); break; case 4: de = DataEntryServer.getAttachmentField(tf.getValue()); break; } if (de != null) { s.getDataEntryList().add(de); ((ValidationManagerUI) UI.getCurrent()).displayObject(s); } UI.getCurrent().removeWindow(w); }); hl.addComponent(a); Button c = new Button(TRANSLATOR.translate("general.cancel")); c.addClickListener(l -> { UI.getCurrent().removeWindow(w); }); hl.addComponent(c); fl.addComponent(hl); w.setContent(fl); UI.getCurrent().addWindow(w); }); if (s.getStepPK() == null) { //Creating a new one Button save = new Button(TRANSLATOR.translate("general.save")); save.addClickListener(listener -> { try { s.setExpectedResult(((TextArea) result).getValue().getBytes(encoding)); s.setNotes(notes.getValue() == null ? "" : notes.getValue().toString()); s.setStepSequence(Integer.parseInt(sequence.getValue().toString())); s.setTestCase((TestCase) ((ValidationManagerUI) UI.getCurrent()).getTree().getValue()); s.setText(text.getValue().getBytes(encoding)); if (s.getRequirementList() == null) { s.setRequirementList(new ArrayList<>()); } new StepJpaController(DataBaseManager.getEntityManagerFactory()).create(s); setVisible(false); //Recreate the tree to show the addition ((ValidationManagerUI) UI.getCurrent()).updateProjectList(); ((ValidationManagerUI) UI.getCurrent()).updateScreen(); ((ValidationManagerUI) UI.getCurrent()).displayObject(s); ((ValidationManagerUI) UI.getCurrent()).buildProjectTree(s); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.creation"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(save); hl.addComponent(add); hl.addComponent(cancel); layout.addComponent(hl); } else { //Editing existing one Button update = new Button(TRANSLATOR.translate("general.update")); update.addClickListener((Button.ClickEvent event) -> { try { s.setExpectedResult(((TextArea) result).getValue().getBytes(encoding)); s.setNotes(notes.getValue().toString()); s.setStepSequence(Integer.parseInt(sequence.getValue().toString())); s.setText(text.getValue().getBytes(encoding)); if (s.getRequirementList() == null) { s.setRequirementList(new ArrayList<>()); } ((ValidationManagerUI) UI.getCurrent()).handleVersioning(s, () -> { try { new StepJpaController(DataBaseManager.getEntityManagerFactory()).edit(s); } catch (NonexistentEntityException ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); ((ValidationManagerUI) UI.getCurrent()).displayObject(s); } catch (UnsupportedEncodingException | NumberFormatException ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.creation"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(update); hl.addComponent(add); hl.addComponent(cancel); layout.addComponent(hl); } } binder.setReadOnly(!edit); binder.bindMemberFields(this); layout.setSizeFull(); setSizeFull(); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.UserComponent.java
License:Apache License
private void init() { FormLayout layout = new FormLayout(); setContent(layout);/* ww w .j a v a 2s . c om*/ addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(user.getClass()); binder.setItemDataSource(user); Field<?> fn = binder.buildAndBind(TRANSLATOR.translate("general.first.name"), "firstName", TextField.class); layout.addComponent(fn); Field<?> ln = binder.buildAndBind(TRANSLATOR.translate("general.last.name"), "lastName", TextField.class); layout.addComponent(ln); Field<?> username = binder.buildAndBind(TRANSLATOR.translate("general.username"), "username", TextField.class); layout.addComponent(username); PasswordField pw = (PasswordField) binder.buildAndBind(TRANSLATOR.translate("general.password"), "password", PasswordField.class); PasswordChangeListener listener = new PasswordChangeListener(); pw.addTextChangeListener(listener); pw.setConverter(new UserPasswordConverter()); layout.addComponent(pw); Field<?> email = binder.buildAndBind(TRANSLATOR.translate("general.email"), "email", TextField.class); layout.addComponent(email); ComboBox locale = new ComboBox(TRANSLATOR.translate("general.locale")); locale.setTextInputAllowed(false); ValidationManagerUI.getAvailableLocales().forEach(l -> { locale.addItem(l.toString()); }); if (user.getLocale() != null) { locale.setValue(user.getLocale()); } binder.bind(locale, "locale"); layout.addComponent(locale); //Status ComboBox status = new ComboBox(TRANSLATOR.translate("general.status")); new UserStatusJpaController(DataBaseManager.getEntityManagerFactory()).findUserStatusEntities() .forEach(us -> { status.addItem(us); status.setItemCaption(us, TRANSLATOR.translate(us.getStatus())); }); binder.bind(status, "userStatusId"); status.setTextInputAllowed(false); layout.addComponent(status); List<UserHasRole> userRoles = new ArrayList<>(); //Project specific roles if (!user.getUserHasRoleList().isEmpty()) { Tree roles = new Tree(TRANSLATOR.translate("project.specific.role")); user.getUserHasRoleList().forEach(uhr -> { if (uhr.getProjectId() != null) { Project p = uhr.getProjectId(); if (!roles.containsId(p)) { roles.addItem(p); roles.setItemCaption(p, p.getName()); roles.setItemIcon(p, VMUI.PROJECT_ICON); } roles.addItem(uhr); roles.setItemCaption(uhr, TRANSLATOR.translate(uhr.getRole().getRoleName())); roles.setChildrenAllowed(uhr, false); roles.setItemIcon(uhr, VaadinIcons.USER_CARD); roles.setParent(uhr, p); } }); if (!roles.getItemIds().isEmpty()) { layout.addComponent(roles); } } //Roles if (edit && ((VMUI) UI.getCurrent()).checkRight("system.configuration")) { Button projectRole = new Button(TRANSLATOR.translate("manage.project.role")); projectRole.addClickListener(l -> { VMWindow w = new VMWindow(TRANSLATOR.translate("manage.project.role")); w.setContent(getProjectRoleManager()); ((VMUI) UI.getCurrent()).addWindow(w); }); layout.addComponent(projectRole); List<Role> list = new RoleJpaController(DataBaseManager.getEntityManagerFactory()).findRoleEntities(); Collections.sort(list, (Role r1, Role r2) -> TRANSLATOR.translate(r1.getRoleName()) .compareTo(TRANSLATOR.translate(r2.getRoleName()))); BeanItemContainer<Role> roleContainer = new BeanItemContainer<>(Role.class, list); TwinColSelect roles = new TwinColSelect(TRANSLATOR.translate("general.role")); roles.setContainerDataSource(roleContainer); roles.setRows(5); roles.setLeftColumnCaption(TRANSLATOR.translate("available.roles")); roles.setRightColumnCaption(TRANSLATOR.translate("current.roles")); roles.setImmediate(true); list.forEach(r -> { roles.setItemCaption(r, TRANSLATOR.translate(r.getDescription())); }); if (user.getUserHasRoleList() != null) { Set<Role> rs = new HashSet<>(); user.getUserHasRoleList().forEach(uhr -> { if (uhr.getProjectId() == null) { rs.add(uhr.getRole()); } }); roles.setValue(rs); } roles.addValueChangeListener(event -> { Set<Role> selected = (Set<Role>) event.getProperty().getValue(); selected.forEach(r -> { UserHasRole temp = new UserHasRole(); temp.setRole(r); temp.setVmUser(user); userRoles.add(temp); }); }); layout.addComponent(roles); } else { if (!user.getUserHasRoleList().isEmpty()) { Table roles = new Table(TRANSLATOR.translate("general.role")); user.getUserHasRoleList().forEach(role -> { roles.addItem(role.getRole()); roles.setItemCaption(role.getRole(), TRANSLATOR.translate(role.getRole().getRoleName())); roles.setItemIcon(role.getRole(), VaadinIcons.USER_STAR); }); layout.addComponent(roles); } } Button update = new Button(user.getId() == null ? TRANSLATOR.translate("general.create") : TRANSLATOR.translate("general.update")); update.addClickListener((Button.ClickEvent event) -> { try { VMUserServer us; String password = (String) pw.getValue(); if (user.getId() == null) { us = new VMUserServer((String) username.getValue(), password, (String) fn.getValue(), (String) ln.getValue(), (String) email.getValue()); } else { us = new VMUserServer(user); us.setFirstName((String) fn.getValue()); us.setLastName((String) ln.getValue()); us.setEmail((String) email.getValue()); us.setUsername((String) username.getValue()); } us.setLocale((String) locale.getValue()); if (user.getUserHasRoleList() == null) { user.setUserHasRoleList(new ArrayList<>()); } user.getUserHasRoleList().clear(); userRoles.forEach(uhr -> { UserHasRoleJpaController c = new UserHasRoleJpaController( DataBaseManager.getEntityManagerFactory()); try { c.create(uhr); user.getUserHasRoleList().add(uhr); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); } }); if (listener.isChanged() && !password.equals(user.getPassword())) { //Different password. Prompt for confirmation MessageBox mb = MessageBox.create(); VerticalLayout vl = new VerticalLayout(); Label l = new Label(TRANSLATOR.translate("password.confirm.pw.message")); vl.addComponent(l); PasswordField np = new PasswordField(Lookup.getDefault() .lookup(InternationalizationProvider.class).translate("general.password")); vl.addComponent(np); mb.asModal(true) .withCaption(Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("password.confirm.pw")) .withMessage(vl).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> { try { if (password.equals(MD5.encrypt(np.getValue()))) { us.setHashPassword(true); us.setPassword(np.getValue()); us.write2DB(); Notification.show( TRANSLATOR.translate("audit.user.account.password.change"), Notification.Type.ASSISTIVE_NOTIFICATION); ((VMUI) UI.getCurrent()).updateScreen(); } else { Notification.show(TRANSLATOR.translate("password.does.not.match"), Notification.Type.WARNING_MESSAGE); } mb.close(); } catch (VMException ex) { Exceptions.printStackTrace(ex); } }, ButtonOption.focus(), ButtonOption.closeOnClick(false), ButtonOption.icon(VaadinIcons.CHECK)) .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE)).getWindow() .setIcon(ValidationManagerUI.SMALL_APP_ICON); mb.open(); } else { us.write2DB(); } ((VMUI) UI.getCurrent()).getUser().update(); ((VMUI) UI.getCurrent()).setLocale(new Locale(us.getLocale())); ((VMUI) UI.getCurrent()).updateScreen(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); Button cancel = new Button( Lookup.getDefault().lookup(InternationalizationProvider.class).translate("general.cancel")); cancel.addClickListener((Button.ClickEvent event) -> { binder.discard(); ((VMUI) UI.getCurrent()).updateScreen(); }); binder.setReadOnly(!edit); binder.setBuffered(true); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(update); hl.addComponent(cancel); layout.addComponent(hl); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java
License:Apache License
@Override public Component getContent() { Panel form = new Panel(TRANSLATOR.translate("step.detail")); if (getExecutionStep().getExecutionStart() == null) { //Set the start date. getExecutionStep().setExecutionStart(new Date()); }/* ww w .ja va 2s.c om*/ FormLayout layout = new FormLayout(); form.setContent(layout); form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(getExecutionStep().getStep().getClass()); binder.setItemDataSource(getExecutionStep().getStep()); TextArea text = new TextArea(TRANSLATOR.translate("general.text")); text.setConverter(new ByteToStringConverter()); binder.bind(text, "text"); text.setSizeFull(); layout.addComponent(text); Field notes = binder.buildAndBind(TRANSLATOR.translate("general.notes"), "notes", TextArea.class); notes.setSizeFull(); layout.addComponent(notes); if (getExecutionStep().getExecutionStart() != null) { start = new DateField(TRANSLATOR.translate("start.date")); start.setResolution(Resolution.SECOND); start.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); start.setValue(getExecutionStep().getExecutionStart()); start.setReadOnly(true); layout.addComponent(start); } if (getExecutionStep().getExecutionEnd() != null) { end = new DateField(TRANSLATOR.translate("end.date")); end.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); end.setResolution(Resolution.SECOND); end.setValue(getExecutionStep().getExecutionEnd()); end.setReadOnly(true); layout.addComponent(end); } binder.setReadOnly(true); //Space to record result if (getExecutionStep().getResultId() != null) { result.setValue(getExecutionStep().getResultId().getResultName()); } layout.addComponent(result); if (reviewer) {//Space to record review if (getExecutionStep().getReviewResultId() != null) { review.setValue(getExecutionStep().getReviewResultId().getReviewName()); } layout.addComponent(review); } //Add Reviewer name if (getExecutionStep().getReviewer() != null) { TextField reviewerField = new TextField(TRANSLATOR.translate("general.reviewer")); reviewerField.setValue(getExecutionStep().getReviewer().getFirstName() + " " + getExecutionStep().getReviewer().getLastName()); reviewerField.setReadOnly(true); layout.addComponent(reviewerField); } if (getExecutionStep().getReviewDate() != null) { reviewDate = new DateField(TRANSLATOR.translate("review.date")); reviewDate.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); reviewDate.setResolution(Resolution.SECOND); reviewDate.setValue(getExecutionStep().getReviewDate()); reviewDate.setReadOnly(true); layout.addComponent(reviewDate); } if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) { TextArea expectedResult = new TextArea(TRANSLATOR.translate("expected.result")); expectedResult.setConverter(new ByteToStringConverter()); binder.bind(expectedResult, "expectedResult"); expectedResult.setSizeFull(); layout.addComponent(expectedResult); } //Add the fields fields.clear(); getExecutionStep().getStep().getDataEntryList().forEach(de -> { switch (de.getDataEntryType().getId()) { case 1://String TextField tf = new TextField(TRANSLATOR.translate(de.getEntryName())); tf.setRequired(true); tf.setData(de.getEntryName()); if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) { //Add expected result DataEntryProperty stringCase = DataEntryServer.getProperty(de, "property.match.case"); DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result"); if (r != null && !r.getPropertyValue().equals("null")) { String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue(); tf.setRequiredError(error); tf.setRequired(DataEntryServer.getProperty(de, "property.required").getPropertyValue() .equals("true")); tf.addValidator((Object val) -> { //We have an expected result and a match case requirement if (stringCase != null && stringCase.getPropertyValue().equals("true") ? !((String) val).equals(r.getPropertyValue()) : !((String) val).equalsIgnoreCase(r.getPropertyValue())) { throw new InvalidValueException(error); } }); } } fields.add(tf); //Set value if already recorded updateValue(tf); layout.addComponent(tf); break; case 2://Numeric NumberField field = new NumberField(TRANSLATOR.translate(de.getEntryName())); field.setSigned(true); field.setUseGrouping(true); field.setGroupingSeparator(','); field.setDecimalSeparator('.'); field.setConverter(new StringToDoubleConverter()); field.setRequired( DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true")); field.setData(de.getEntryName()); Double min = null, max = null; for (DataEntryProperty prop : de.getDataEntryPropertyList()) { String value = prop.getPropertyValue(); if (prop.getPropertyName().equals("property.max")) { try { max = Double.parseDouble(value); } catch (NumberFormatException ex) { //Leave as null } } else if (prop.getPropertyName().equals("property.min")) { try { min = Double.parseDouble(value); } catch (NumberFormatException ex) { //Leave as null } } } //Add expected result if (VMSettingServer.getSetting("show.expected.result").getBoolVal() && (min != null || max != null)) { String error = TRANSLATOR.translate("error.out.of.range") + " " + (min == null ? " " : (TRANSLATOR.translate("property.min") + ": " + min)) + " " + (max == null ? "" : (TRANSLATOR.translate("property.max") + ": " + max)); field.setRequiredError(error); field.addValidator(new DoubleRangeValidator(error, min, max)); } fields.add(field); //Set value if already recorded updateValue(field); layout.addComponent(field); break; case 3://Boolean CheckBox cb = new CheckBox(TRANSLATOR.translate(de.getEntryName())); cb.setData(de.getEntryName()); cb.setRequired( DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true")); if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) { DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result"); if (r != null) { //Add expected result String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue(); cb.addValidator((Object val) -> { if (!val.toString().equals(r.getPropertyValue())) { throw new InvalidValueException(error); } }); } } fields.add(cb); //Set value if already recorded updateValue(cb); layout.addComponent(cb); break; case 4://Attachment Label l = new Label(TRANSLATOR.translate(de.getEntryName())); layout.addComponent(l); break; default: LOG.log(Level.SEVERE, "Unexpected field type: {0}", de.getDataEntryType().getId()); } }); //Add the Attachments HorizontalLayout attachments = new HorizontalLayout(); attachments.setCaption(TRANSLATOR.translate("general.attachment")); HorizontalLayout comments = new HorizontalLayout(); comments.setCaption(TRANSLATOR.translate("general.comments")); HorizontalLayout issues = new HorizontalLayout(); issues.setCaption(TRANSLATOR.translate("general.issue")); int commentCounter = 0; int issueCounter = 0; for (ExecutionStepHasIssue ei : getExecutionStep().getExecutionStepHasIssueList()) { issueCounter++; Button a = new Button("Issue #" + issueCounter); a.setIcon(VaadinIcons.BUG); a.addClickListener((Button.ClickEvent event) -> { displayIssue(new IssueServer(ei.getIssue())); }); a.setEnabled(!step.getLocked()); issues.addComponent(a); } for (ExecutionStepHasAttachment attachment : getExecutionStep().getExecutionStepHasAttachmentList()) { switch (attachment.getAttachment().getAttachmentType().getType()) { case "comment": { //Comments go in a different section commentCounter++; Button a = new Button("Comment #" + commentCounter); a.setIcon(VaadinIcons.CLIPBOARD_TEXT); a.addClickListener((Button.ClickEvent event) -> { if (!step.getLocked()) { //Prompt if user wants this removed MessageBox mb = getDeletionPrompt(attachment); mb.open(); } else { displayComment(new AttachmentServer(attachment.getAttachment().getAttachmentPK())); } }); a.setEnabled(!step.getLocked()); comments.addComponent(a); break; } default: { Button a = new Button(attachment.getAttachment().getFileName()); a.setEnabled(!step.getLocked()); a.setIcon(VaadinIcons.PAPERCLIP); a.addClickListener((Button.ClickEvent event) -> { if (!step.getLocked()) { //Prompt if user wants this removed MessageBox mb = getDeletionPrompt(attachment); mb.open(); } else { displayAttachment(new AttachmentServer(attachment.getAttachment().getAttachmentPK())); } }); attachments.addComponent(a); break; } } } if (attachments.getComponentCount() > 0) { layout.addComponent(attachments); } if (comments.getComponentCount() > 0) { layout.addComponent(comments); } if (issues.getComponentCount() > 0) { layout.addComponent(issues); } //Add the menu HorizontalLayout hl = new HorizontalLayout(); attach = new Button(TRANSLATOR.translate("add.attachment")); attach.setIcon(VaadinIcons.PAPERCLIP); attach.addClickListener((Button.ClickEvent event) -> { //Show dialog to upload file. Window dialog = new VMWindow(TRANSLATOR.translate("attach.file")); VerticalLayout vl = new VerticalLayout(); MultiFileUpload multiFileUpload = new MultiFileUpload() { @Override protected void handleFile(File file, String fileName, String mimeType, long length) { try { LOG.log(Level.FINE, "Received file {1} at: {0}", new Object[] { file.getAbsolutePath(), fileName }); //Process the file //Create the attachment AttachmentServer a = new AttachmentServer(); a.addFile(file, fileName); //Overwrite the default file name set in addFile. It'll be a temporary file name a.setFileName(fileName); a.write2DB(); //Now add it to this Execution Step if (getExecutionStep().getExecutionStepHasAttachmentList() == null) { getExecutionStep().setExecutionStepHasAttachmentList(new ArrayList<>()); } getExecutionStep().addAttachment(a); getExecutionStep().write2DB(); w.updateCurrentStep(); } catch (Exception ex) { LOG.log(Level.SEVERE, "Error creating attachment!", ex); } } }; multiFileUpload.setCaption(TRANSLATOR.translate("select.files.attach")); vl.addComponent(multiFileUpload); dialog.setContent(vl); dialog.setHeight(25, Sizeable.Unit.PERCENTAGE); dialog.setWidth(25, Sizeable.Unit.PERCENTAGE); ValidationManagerUI.getInstance().addWindow(dialog); }); hl.addComponent(attach); bug = new Button(TRANSLATOR.translate("create.issue")); bug.setIcon(VaadinIcons.BUG); bug.addClickListener((Button.ClickEvent event) -> { displayIssue(new IssueServer()); }); hl.addComponent(bug); comment = new Button(TRANSLATOR.translate("add.comment")); comment.setIcon(VaadinIcons.CLIPBOARD_TEXT); comment.addClickListener((Button.ClickEvent event) -> { AttachmentServer as = new AttachmentServer(); //Get comment type AttachmentType type = AttachmentTypeServer.getTypeForExtension("comment"); as.setAttachmentType(type); displayComment(as); }); hl.addComponent(comment); step.update(); attach.setEnabled(!step.getLocked()); bug.setEnabled(!step.getLocked()); comment.setEnabled(!step.getLocked()); result.setEnabled(!step.getLocked()); layout.addComponent(hl); return layout; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.plan.DetailStep.java
License:Apache License
@Override public Component getContent() { Panel form = new Panel("execution.detail"); FormLayout layout = new FormLayout(); form.setContent(layout);//w w w .j a va 2s . c o m form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(TestCaseExecution.class); binder.setItemDataSource(tce); TextArea name = new TextArea("general.name"); name.setConverter(new ByteToStringConverter()); binder.bind(name, "name"); layout.addComponent(name); TextArea scope = new TextArea("general.scope"); scope.setConverter(new ByteToStringConverter()); binder.bind(scope, "scope"); layout.addComponent(scope); if (tce.getId() != null) { TextArea conclusion = new TextArea("general.conclusion"); conclusion.setConverter(new ByteToStringConverter()); binder.bind(conclusion, "conclusion"); layout.addComponent(conclusion); conclusion.setSizeFull(); layout.addComponent(conclusion); } binder.setBuffered(false); binder.bindMemberFields(form); form.setSizeFull(); return form; }
From source file:org.esn.esobase.view.tab.BookTranslateTab.java
public BookTranslateTab(DBService service) { this.service = service; this.setSizeFull(); FilterChangeListener filterChangeListener = new FilterChangeListener(); bookListlayout = new HorizontalLayout(); bookListlayout.setWidth(100f, Unit.PERCENTAGE); bookTable = new ComboBox(""); bookTable.setPageLength(20);//from w w w. j av a 2 s . c o m bookTable.setScrollToSelectedItem(true); bookTable.setDataProvider(new ListDataProvider<>(books)); bookTable.addValueChangeListener(new BookSelectListener()); bookTable.setWidth(100f, Unit.PERCENTAGE); locationTable = new ComboBox("?"); locationTable.setPageLength(15); locationTable.setScrollToSelectedItem(true); locationTable.setWidth(100f, Unit.PERCENTAGE); locationTable.setDataProvider(new ListDataProvider<>(locations)); locationTable.addValueChangeListener(filterChangeListener); subLocationTable = new ComboBox("?"); subLocationTable.setPageLength(15); subLocationTable.setScrollToSelectedItem(true); subLocationTable.addValueChangeListener(filterChangeListener); subLocationTable.setWidth(100f, Unit.PERCENTAGE); subLocationTable.setDataProvider(new ListDataProvider<>(subLocations)); FormLayout locationAndBook = new FormLayout(locationTable, subLocationTable, bookTable); locationAndBook.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); locationAndBook.setSizeFull(); bookListlayout.addComponent(locationAndBook); translateStatus = new ComboBoxMultiselect("? ", Arrays.asList(TRANSLATE_STATUS.values())); translateStatus.setClearButtonCaption("?"); translateStatus.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadFilters(); } }); noTranslations = new CheckBox("? ?"); noTranslations.setValue(Boolean.FALSE); noTranslations.addValueChangeListener(filterChangeListener); emptyTranslations = new CheckBox("? "); emptyTranslations.setValue(Boolean.FALSE); emptyTranslations.addValueChangeListener(filterChangeListener); HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); translatorBox.setScrollToSelectedItem(true); translatorBox.setDataProvider(new ListDataProvider(service.getSysAccounts())); translatorBox.addValueChangeListener(filterChangeListener); refreshButton = new Button(""); refreshButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LoadFilters(); LoadBookContent(); } }); countLabel = new Label(); searchField = new TextField("?? ?"); searchField.setSizeFull(); searchField.setNullRepresentation(""); searchField.addValueChangeListener(filterChangeListener); FormLayout filtersLayout = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField); filtersLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); filtersLayout.setSizeFull(); bookListlayout.addComponent(filtersLayout); bookListlayout.addComponent(refreshButton); bookListlayout.addComponent(countLabel); bookListlayout.setExpandRatio(locationAndBook, 0.4f); bookListlayout.setExpandRatio(filtersLayout, 0.4f); bookListlayout.setExpandRatio(refreshButton, 0.1f); bookListlayout.setExpandRatio(countLabel, 0.1f); bookListlayout.setHeight(105f, Unit.PIXELS); bookContentLayout = new TabSheet(); bookContentLayout.setSizeFull(); bookNameLayout = new HorizontalLayout(); bookNameLayout.setSizeFull(); bookNameOrigLayout = new VerticalLayout(); bookNameEn = new TextField("?"); bookNameEn.setWidth(500f, Unit.PIXELS); bookNameRu = new TextField(" ?"); bookNameRu.setWidth(500f, Unit.PIXELS); bookNameRu.setNullRepresentation(""); bookNameOrigLayout.addComponent(bookNameEn); bookNameOrigLayout.addComponent(bookNameRu); bookNameLayout.addComponent(bookNameOrigLayout); bookNameTranslationsLayout = new VerticalLayout(); bookNameTranslationsLayout.setSizeFull(); bookNameLayout.addComponent(bookNameTranslationsLayout); bookContentLayout.addTab(bookNameLayout, "?"); bookTextLayout = new HorizontalLayout(); bookTextLayout.setSizeFull(); bookTextOrigLayout = new HorizontalLayout(); bookTextOrigLayout.setSizeFull(); bookTextEn = new TextArea("?"); bookTextEn.setRows(20); bookTextEn.setSizeFull(); bookTextRu = new TextArea(" ?"); bookTextRu.setRows(20); bookTextRu.setSizeFull(); bookTextRu.setNullRepresentation(""); bookTextOrigLayout.addComponent(bookTextEn); bookTextOrigLayout.addComponent(bookTextRu); bookTextLayout.addComponent(bookTextOrigLayout); bookTextTranslationsLayout = new VerticalLayout(); bookTextTranslationsLayout.setSizeFull(); bookTextLayout.addComponent(bookTextTranslationsLayout); bookTextLayout.setExpandRatio(bookTextOrigLayout, 2f); bookTextLayout.setExpandRatio(bookTextTranslationsLayout, 1f); bookContentLayout.addTab(bookTextLayout, "?"); bookNameEn.setReadOnly(true); bookNameRu.setReadOnly(true); bookTextEn.setReadOnly(true); bookTextRu.setReadOnly(true); this.addComponent(bookListlayout); this.addComponent(bookContentLayout); this.bookListlayout.setHeight(105f, Unit.PIXELS); this.setExpandRatio(bookContentLayout, 1f); new NoAutcompleteComboBoxExtension(locationTable); new NoAutcompleteComboBoxExtension(subLocationTable); new NoAutcompleteComboBoxExtension(translatorBox); LoadFilters(); }
From source file:org.esn.esobase.view.tab.QuestTranslateTab.java
public QuestTranslateTab(DBService service_) { this.setSizeFull(); this.setSpacing(false); this.setMargin(false); this.service = service_; QuestChangeListener questChangeListener = new QuestChangeListener(); FilterChangeListener filterChangeListener = new FilterChangeListener(); questListlayout = new HorizontalLayout(); questListlayout.setWidth(100f, Unit.PERCENTAGE); questListlayout.setSpacing(false);/*from w w w . ja v a 2s . c o m*/ questListlayout.setMargin(false); locationTable = new ComboBox("?"); locationTable.setPageLength(30); locationTable.setScrollToSelectedItem(true); locationTable.setWidth(100f, Unit.PERCENTAGE); locationTable.addValueChangeListener(filterChangeListener); locationTable.setDataProvider(new ListDataProvider<>(locations)); questTable = new ComboBox("?"); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.setPageLength(15); questTable.setScrollToSelectedItem(true); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.addValueChangeListener(questChangeListener); questTable.setDataProvider(new ListDataProvider<>(questList)); questListlayout.addComponent(questTable); FormLayout locationAndQuestLayout = new FormLayout(locationTable, questTable); locationAndQuestLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); locationAndQuestLayout.setSizeFull(); questListlayout.addComponent(locationAndQuestLayout); translateStatus = new ComboBoxMultiselect("? ", Arrays.asList(TRANSLATE_STATUS.values())); translateStatus.setClearButtonCaption("?"); translateStatus.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadFilters(); LoadContent(); } }); noTranslations = new CheckBox("? ?"); noTranslations.setValue(Boolean.FALSE); noTranslations.addValueChangeListener(filterChangeListener); emptyTranslations = new CheckBox("? "); emptyTranslations.setValue(Boolean.FALSE); emptyTranslations.addValueChangeListener(filterChangeListener); HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations); checkBoxlayout.setSpacing(false); checkBoxlayout.setMargin(false); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); translatorBox.setScrollToSelectedItem(true); translatorBox.setDataProvider(new ListDataProvider<SysAccount>(service.getSysAccounts())); translatorBox.addValueChangeListener(filterChangeListener); refreshButton = new Button(""); refreshButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LoadFilters(); LoadContent(); } }); countLabel = new Label(); searchField = new TextField("?? ?"); searchField.setSizeFull(); searchField.addValueChangeListener(filterChangeListener); FormLayout filtersLayout = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField); filtersLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); filtersLayout.setSizeFull(); questListlayout.addComponent(filtersLayout); questListlayout.addComponent(refreshButton); questListlayout.addComponent(countLabel); questListlayout.setExpandRatio(locationAndQuestLayout, 0.4f); questListlayout.setExpandRatio(filtersLayout, 0.4f); questListlayout.setExpandRatio(refreshButton, 0.1f); questListlayout.setExpandRatio(countLabel, 0.1f); questListlayout.setHeight(105f, Unit.PIXELS); this.addComponent(questListlayout); infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); infoLayout.setSpacing(false); infoLayout.setMargin(false); tabSheet = new TabSheet(); tabSheet.setSizeFull(); nameLayout = new VerticalLayout(); nameLayout.setSizeFull(); nameHLayout = new HorizontalLayout(); nameHLayout.setSizeFull(); nameHLayout.setSpacing(false); nameHLayout.setMargin(false); nameLayout = new VerticalLayout(); nameLayout.setSizeFull(); nameLayout.setSpacing(false); nameLayout.setMargin(false); questNameEnArea = new TextArea("?"); questNameEnArea.setSizeFull(); questNameEnArea.setRows(1); questNameEnArea.setReadOnly(true); questNameRuArea = new TextArea("? Ru"); questNameRuArea.setSizeFull(); questNameRuArea.setRows(1); questNameRuArea.setReadOnly(true); questNameRawEnArea = new TextArea("? "); questNameRawEnArea.setSizeFull(); questNameRawEnArea.setRows(1); questNameRawEnArea.setReadOnly(true); questNameRawRuArea = new TextArea("? Ru"); questNameRawRuArea.setSizeFull(); questNameRawRuArea.setRows(1); questNameRawRuArea.setReadOnly(true); nameLayout.addComponents(questNameEnArea, questNameRuArea, questNameRawEnArea, questNameRawRuArea); nameHLayout.addComponent(nameLayout); nameTranslateLayout = new VerticalLayout(); nameTranslateLayout.setSizeFull(); nameTranslateLayout.setSpacing(false); nameTranslateLayout.setMargin(false); nameHLayout.addComponent(nameTranslateLayout); infoLayout.addComponent(nameHLayout); descriptionLayout = new VerticalLayout(); descriptionLayout.setSizeFull(); descriptionHLayout = new HorizontalLayout(); descriptionHLayout.setSizeFull(); descriptionHLayout.setSpacing(false); descriptionHLayout.setMargin(false); descriptionLayout = new VerticalLayout(); descriptionLayout.setSizeFull(); descriptionLayout.setSpacing(false); descriptionLayout.setMargin(false); questDescriptionEnArea = new TextArea("?"); questDescriptionEnArea.setSizeFull(); questDescriptionEnArea.setRows(4); questDescriptionEnArea.setReadOnly(true); questDescriptionRuArea = new TextArea("? Ru"); questDescriptionRuArea.setSizeFull(); questDescriptionRuArea.setRows(4); questDescriptionRuArea.setReadOnly(true); questDescriptionRawEnArea = new TextArea("? "); questDescriptionRawEnArea.setSizeFull(); questDescriptionRawEnArea.setRows(4); questDescriptionRawEnArea.setReadOnly(true); questDescriptionRawRuArea = new TextArea("? Ru"); questDescriptionRawRuArea.setSizeFull(); questDescriptionRawRuArea.setRows(4); questDescriptionRawRuArea.setReadOnly(true); descriptionLayout.addComponents(questDescriptionEnArea, questDescriptionRuArea, questDescriptionRawEnArea, questDescriptionRawRuArea); descriptionHLayout.addComponent(descriptionLayout); descriptionTranslateLayout = new VerticalLayout(); descriptionTranslateLayout.setSizeFull(); descriptionTranslateLayout.setSpacing(false); descriptionTranslateLayout.setMargin(false); descriptionHLayout.addComponent(descriptionTranslateLayout); infoLayout.addComponent(descriptionHLayout); tabSheet.addTab(infoLayout, "?"); stepsLayout = new VerticalLayout(); stepsLayout.setSizeFull(); stepsLayout.setSpacing(false); stepsLayout.setMargin(false); stepsData = new TreeData(); stepsGrid = new TreeGrid(new TreeDataProvider(stepsData)); stepsGrid.setSelectionMode(Grid.SelectionMode.NONE); stepsGrid.setRowHeight(250); stepsGrid.setHeaderVisible(false); stepsGrid.setSizeFull(); stepsGrid.setItemCollapseAllowedProvider(new ItemCollapseAllowedProvider() { @Override public boolean test(Object item) { return false; } }); stepsGrid.addColumn(new ValueProvider() { @Override public Object apply(Object source) { if (source instanceof QuestStep) { return "?"; } if (source instanceof QuestDirection) { return " - " + ((QuestDirection) source).getDirectionType().name(); } return null; } }).setId("rowType").setCaption("").setWidth(132).setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { QuestStep step = (QuestStep) source; if (step.getTextEn() != null && !step.getTextEn().isEmpty()) { TextArea textEnArea = new TextArea("? "); textEnArea.setValue(step.getTextEn()); textEnArea.setReadOnly(true); textEnArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnArea); } if (step.getTextRu() != null && !step.getTextRu().isEmpty()) { TextArea textRuArea = new TextArea(" "); textRuArea.setValue(step.getTextRu()); textRuArea.setReadOnly(true); textRuArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuArea); } } else if (source instanceof QuestDirection) { QuestDirection d = (QuestDirection) source; if (d.getTextEn() != null && !d.getTextEn().isEmpty()) { TextArea textEnArea = new TextArea("? "); textEnArea.setValue(d.getTextEn()); textEnArea.setRows(2); textEnArea.setReadOnly(true); textEnArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnArea); } if (d.getTextRu() != null && !d.getTextRu().isEmpty()) { TextArea textRuArea = new TextArea(" "); textRuArea.setValue(d.getTextRu()); textRuArea.setRows(2); textRuArea.setReadOnly(true); textRuArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuArea); } } return result; } }).setId("ingameText").setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { QuestStep step = (QuestStep) source; if (step.getSheetsJournalEntry() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(step.getSheetsJournalEntry().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (step.getSheetsJournalEntry().getTextRu() != null && !step.getSheetsJournalEntry() .getTextRu().equals(step.getSheetsJournalEntry().getTextEn())) { TextArea textRuRawArea = new TextArea(" " + step.getSheetsJournalEntry().getTranslator()); textRuRawArea.setValue(step.getSheetsJournalEntry().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } else if (source instanceof QuestDirection) { QuestDirection d = (QuestDirection) source; if (d.getSheetsQuestDirection() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(d.getSheetsQuestDirection().getTextEn()); textEnRawArea.setRows(2); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (d.getSheetsQuestDirection().getTextRu() != null && !d.getSheetsQuestDirection() .getTextRu().equals(d.getSheetsQuestDirection().getTextEn())) { TextArea textRuRawArea = new TextArea(" " + d.getSheetsQuestDirection().getTranslator()); textRuRawArea.setValue(d.getSheetsQuestDirection().getTextRu()); textRuRawArea.setRows(2); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea); } } } return result; } }).setId("rawText").setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestStep step = (QuestStep) source; list.addAll(step.getSheetsJournalEntry().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && step.getSheetsJournalEntry() != null && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsJournalEntry(step.getSheetsJournalEntry()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsJournalEntry() != null) { translatedText.getSpreadSheetsJournalEntry().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } else if (source instanceof QuestDirection) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestDirection d = (QuestDirection) source; list.addAll(d.getSheetsQuestDirection().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && d.getSheetsQuestDirection() != null && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsQuestDirection(d.getSheetsQuestDirection()); Button addTranslation = new Button(" "); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsQuestDirection() != null) { translatedText.getSpreadSheetsQuestDirection().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } panel.setContent(result); return panel; } }).setId("translation").setStyleGenerator(rowStyleGenerator); stepsGrid.setColumns("rowType", "ingameText", "rawText", "translation"); stepsLayout.addComponent(stepsGrid); tabSheet.addTab(stepsLayout, ""); itemsGrid = new Grid(new ListDataProvider(itemList)); itemsGrid.setSelectionMode(Grid.SelectionMode.NONE); itemsGrid.setRowHeight(250); itemsGrid.setHeaderVisible(false); itemsGrid.setSizeFull(); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { QuestItem item = (QuestItem) source; if (item.getName() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(item.getName().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (item.getName().getTextRu() != null && !item.getName().getTextRu().equals(item.getName().getTextEn())) { TextArea textRuRawArea = new TextArea( " ? " + item.getName().getTranslator()); textRuRawArea.setValue(item.getName().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } return result; } }).setId("rawName"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { QuestItem item = (QuestItem) source; if (item.getDescription() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(item.getDescription().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (item.getDescription().getTextRu() != null && !item.getDescription().getTextRu().equals(item.getDescription().getTextEn())) { TextArea textRuRawArea = new TextArea( " ?? " + item.getDescription().getTranslator()); textRuRawArea.setValue(item.getDescription().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } return result; } }).setId("rawDescription"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestItem item = (QuestItem) source; if (item.getName() != null) { String text = item.getName().getTextEn(); list.addAll(item.getName().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsItemName(item.getName()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsItemName() != null) { translatedText.getSpreadSheetsItemName().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } } panel.setContent(result); return panel; } }).setId("nameTranslation"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestItem item = (QuestItem) source; if (item.getDescription() != null) { String text = item.getDescription().getTextEn(); list.addAll(item.getDescription().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsItemDescription(item.getDescription()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsItemDescription() != null) { translatedText.getSpreadSheetsItemDescription().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } } panel.setContent(result); return panel; } }).setId("descriptionTranslation"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setMargin(new MarginInfo(true, false, false, false)); result.setSpacing(false); if (source instanceof QuestItem) { GSpreadSheetsItemName name = ((QuestItem) source).getName(); if (name.getIcon() != null) { Image image = new Image(null, new ExternalResource( "https://elderscrolls.net" + name.getIcon().replaceAll(".dds", ".png"))); result.addComponent(image); return result; } } return result; } }).setId("icon").setWidth(95); itemsGrid.setColumns("icon", "rawName", "nameTranslation", "rawDescription", "descriptionTranslation"); tabSheet.addTab(itemsGrid, ""); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1f); GridScrollExtension stepsScrollExtension = new GridScrollExtension(stepsGrid); GridScrollExtension itemsScrollExtension = new GridScrollExtension(itemsGrid); new NoAutcompleteComboBoxExtension(locationTable); new NoAutcompleteComboBoxExtension(questTable); new NoAutcompleteComboBoxExtension(translatorBox); LoadFilters(); }
From source file:org.esn.esobase.view.tab.TranslateTab.java
public void Init() { removeAllComponents();//from w w w . j a v a 2s .c o m TopicNpcColumnGenerator topicNpcColumnGenerator = new TopicNpcColumnGenerator(); TopicPlayerColumnGenerator topicPlayerColumnGenerator = new TopicPlayerColumnGenerator(); SubtitleColumnGenerator subtitleColumnGenerator = new SubtitleColumnGenerator(); TranslationColumnGenerator translationColumnGenerator = new TranslationColumnGenerator(); FilterChangeListener filterChangeListener = new FilterChangeListener(); this.setSizeFull(); this.setSpacing(false); this.setMargin(false); npcListlayout = new HorizontalLayout(); npcListlayout.setSpacing(false); npcListlayout.setMargin(false); npcListlayout.setSizeFull(); npcTable = new ComboBox("NPC"); npcTable.setPageLength(30); npcTable.setScrollToSelectedItem(true); npcTable.setWidth(100f, Unit.PERCENTAGE); npcTable.addValueChangeListener(new NpcSelectListener()); npcTable.setScrollToSelectedItem(true); npcTable.setEmptySelectionAllowed(true); locationTable = new ComboBox("?"); locationTable.setPageLength(30); locationTable.setScrollToSelectedItem(true); locationTable.setWidth(100f, Unit.PERCENTAGE); locationTable.addValueChangeListener(filterChangeListener); locationTable.setDataProvider(new ListDataProvider<>(locations)); locationTable.setEmptySelectionAllowed(true); subLocationTable = new ComboBox("?"); subLocationTable.setPageLength(30); subLocationTable.setScrollToSelectedItem(true); subLocationTable.setWidth(100f, Unit.PERCENTAGE); subLocationTable.addValueChangeListener(filterChangeListener); subLocationTable.setDataProvider(new ListDataProvider<>(subLocations)); subLocationTable.setEmptySelectionAllowed(true); questTable = new ComboBox("?"); questTable.setPageLength(30); questTable.setScrollToSelectedItem(true); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.addValueChangeListener(filterChangeListener); questTable.setDataProvider(new ListDataProvider<>(questList)); npcTable.setDataProvider(new ListDataProvider<>(npcList)); FormLayout locationAndNpc = new FormLayout(questTable, locationTable, subLocationTable, npcTable); locationAndNpc.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); locationAndNpc.setSizeFull(); npcListlayout.addComponent(locationAndNpc); translateStatus = new ComboBoxMultiselect("? ", Arrays.asList(TRANSLATE_STATUS.values())); translateStatus.setClearButtonCaption("?"); translateStatus.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadFilters(); LoadNpcContent(); } }); translateStatus.setPageLength(20); noTranslations = new CheckBox("? ?"); noTranslations.setValue(Boolean.FALSE); noTranslations.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() { @Override public void valueChange(HasValue.ValueChangeEvent<Boolean> event) { LoadFilters(); LoadNpcContent(); } }); emptyTranslations = new CheckBox("? "); emptyTranslations.setValue(Boolean.FALSE); emptyTranslations.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() { @Override public void valueChange(HasValue.ValueChangeEvent<Boolean> event) { LoadFilters(); LoadNpcContent(); } }); HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); translatorBox.setScrollToSelectedItem(true); translatorBox.setDataProvider(new ListDataProvider(service.getSysAccounts())); translatorBox.addValueChangeListener(new HasValue.ValueChangeListener() { @Override public void valueChange(HasValue.ValueChangeEvent event) { LoadFilters(); LoadNpcContent(); } }); refreshButton = new Button(""); refreshButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LoadFilters(); LoadNpcContent(); } }); countLabel = new Label(); searchField = new TextField("?? ?"); searchField.setSizeFull(); searchField.addValueChangeListener(new HasValue.ValueChangeListener<String>() { @Override public void valueChange(HasValue.ValueChangeEvent<String> event) { LoadFilters(); LoadNpcContent(); } }); FormLayout questAndWithNewTranslations = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField); questAndWithNewTranslations.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); questAndWithNewTranslations.setSizeFull(); npcListlayout.addComponent(questAndWithNewTranslations); npcListlayout.addComponent(refreshButton); npcListlayout.addComponent(countLabel); npcListlayout.setExpandRatio(locationAndNpc, 0.4f); npcListlayout.setExpandRatio(questAndWithNewTranslations, 0.4f); npcListlayout.setExpandRatio(refreshButton, 0.1f); npcListlayout.setExpandRatio(countLabel, 0.1f); npcContentLayout = new VerticalLayout(); npcContentLayout.setSizeFull(); npcContentLayout.setSpacing(false); npcContentLayout.setMargin(false); npcTabSheet = new TabSheet(); npcTabSheet.setSizeFull(); npcTabLayout = new VerticalLayout(); locationName = new TextField("? "); npcTabLayout.addComponent(locationName); locationNameRu = new TextField(" ? "); npcTabLayout.addComponent(locationNameRu); npcName = new TextField("? NPC"); npcTabLayout.addComponent(npcName); npcNameRu = new TextField(" NPC"); npcTabLayout.addComponent(npcNameRu); npcTab = npcTabSheet.addTab(npcTabLayout, ""); npcTopicsTable = new Table(); npcTopicsTable.addStyleName(ValoTheme.TABLE_COMPACT); npcTopicsTable.setSizeFull(); npcTopicsTable.setPageLength(0); topicsContainer = new BeanItemContainer<>(Topic.class); npcTopicsTable.setContainerDataSource(topicsContainer); npcTopicsTable.addGeneratedColumn("npcTextG", topicNpcColumnGenerator); npcTopicsTable.addGeneratedColumn("playerTextG", topicPlayerColumnGenerator); npcTopicsTable.removeGeneratedColumn("playerTranslations"); npcTopicsTable.addGeneratedColumn("playerTranslations", translationColumnGenerator); npcTopicsTable.removeGeneratedColumn("npcTranslations"); npcTopicsTable.addGeneratedColumn("npcTranslations", translationColumnGenerator); npcTopicsTable.setVisibleColumns( new Object[] { "playerTextG", "playerTranslations", "npcTextG", "npcTranslations" }); npcTopicsTable.setColumnHeaders(new String[] { " ", "", " NPC", "" }); npcTopicsTable.setColumnExpandRatio("playerTextG", 1f); npcTopicsTable.setColumnExpandRatio("playerTranslations", 1.5f); npcTopicsTable.setColumnExpandRatio("npcTextG", 1.5f); npcTopicsTable.setColumnExpandRatio("npcTranslations", 1.5f); npcTopicsTable.setColumnWidth("actions", 150); npcSubtitlesTable = new Table(); npcSubtitlesTable.addStyleName(ValoTheme.TABLE_COMPACT); npcSubtitlesTable.setSizeFull(); npcSubtitlesTable.setPageLength(0); subtitlesContainer = new BeanItemContainer<>(Subtitle.class); npcSubtitlesTable.setContainerDataSource(subtitlesContainer); npcSubtitlesTable.addGeneratedColumn("textG", subtitleColumnGenerator); npcSubtitlesTable.removeGeneratedColumn("translations"); npcSubtitlesTable.addGeneratedColumn("translations", translationColumnGenerator); npcSubtitlesTable.setVisibleColumns(new Object[] { "textG", "translations" }); npcSubtitlesTable.setColumnHeaders(new String[] { "", "" }); npcSubtitlesTable.setColumnExpandRatio("textG", 1f); npcSubtitlesTable.setColumnExpandRatio("translations", 1f); npcSubtitlesTable.setColumnWidth("actions", 150); npcTopicsTab = npcTabSheet.addTab(npcTopicsTable, ""); npcSubtitlesTab = npcTabSheet.addTab(npcSubtitlesTable, ""); npcContentLayout.addComponent(npcTabSheet); this.addComponent(npcListlayout); this.addComponent(npcContentLayout); this.npcListlayout.setHeight(105f, Unit.PIXELS); this.setExpandRatio(npcContentLayout, 1f); LoadFilters(); new NoAutcompleteComboBoxExtension(questTable); new NoAutcompleteComboBoxExtension(locationTable); new NoAutcompleteComboBoxExtension(subLocationTable); new NoAutcompleteComboBoxExtension(npcTable); new NoAutcompleteComboBoxExtension(translatorBox); }