List of usage examples for com.vaadin.ui ComboBox ComboBox
public ComboBox()
From source file:annis.gui.controlpanel.CorpusListPanel.java
License:Apache License
public CorpusListPanel(InstanceConfig instanceConfig, ExampleQueriesPanel autoGenQueries, final AnnisUI ui) { this.instanceConfig = instanceConfig; this.autoGenQueries = autoGenQueries; this.ui = ui; final CorpusListPanel finalThis = this; setSizeFull();/* w w w . ja va2 s .c om*/ selectionLayout = new HorizontalLayout(); selectionLayout.setWidth("100%"); selectionLayout.setHeight("-1px"); selectionLayout.setVisible(false); Label lblVisible = new Label("Visible: "); lblVisible.setSizeUndefined(); selectionLayout.addComponent(lblVisible); cbSelection = new ComboBox(); cbSelection.setDescription("Choose corpus selection set"); cbSelection.setWidth("100%"); cbSelection.setHeight("-1px"); cbSelection.addStyleName(ValoTheme.COMBOBOX_SMALL); cbSelection.setInputPrompt("Add new corpus selection set"); cbSelection.setNullSelectionAllowed(false); cbSelection.setNewItemsAllowed(true); cbSelection.setNewItemHandler((AbstractSelect.NewItemHandler) this); cbSelection.setImmediate(true); cbSelection.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { updateCorpusTable(); updateAutoGeneratedQueriesPanel(); } }); selectionLayout.addComponent(cbSelection); selectionLayout.setExpandRatio(cbSelection, 1.0f); selectionLayout.setSpacing(true); selectionLayout.setComponentAlignment(cbSelection, Alignment.MIDDLE_RIGHT); selectionLayout.setComponentAlignment(lblVisible, Alignment.MIDDLE_LEFT); addComponent(selectionLayout); txtFilter = new TextField(); txtFilter.setVisible(false); txtFilter.setInputPrompt("Filter"); txtFilter.setImmediate(true); txtFilter.setTextChangeTimeout(500); txtFilter.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { BeanContainer<String, AnnisCorpus> availableCorpora = ui.getQueryState().getAvailableCorpora(); if (textFilter != null) { // remove the old filter availableCorpora.removeContainerFilter(textFilter); textFilter = null; } if (event.getText() != null && !event.getText().isEmpty()) { Set<String> selectedIDs = ui.getQueryState().getSelectedCorpora().getValue(); textFilter = new SimpleStringFilter("name", event.getText(), true, false); availableCorpora.addContainerFilter(textFilter); // select the first item List<String> filteredIDs = availableCorpora.getItemIds(); Set<String> selectedAndFiltered = new HashSet<>(selectedIDs); selectedAndFiltered.retainAll(filteredIDs); Set<String> selectedAndOutsideFilter = new HashSet<>(selectedIDs); selectedAndOutsideFilter.removeAll(filteredIDs); for (String id : selectedAndOutsideFilter) { tblCorpora.unselect(id); } if (selectedAndFiltered.isEmpty() && !filteredIDs.isEmpty()) { for (String id : selectedIDs) { tblCorpora.unselect(id); } tblCorpora.select(filteredIDs.get(0)); } } } }); txtFilter.setWidth("100%"); txtFilter.setHeight("-1px"); txtFilter.addStyleName(ValoTheme.TEXTFIELD_SMALL); addComponent(txtFilter); pbLoadCorpora = new ProgressBar(); pbLoadCorpora.setCaption("Loading corpus list..."); pbLoadCorpora.setIndeterminate(true); addComponent(pbLoadCorpora); tblCorpora = new Table(); addComponent(tblCorpora); tblCorpora.setVisible(false); // don't show list before it was not loaded tblCorpora.setContainerDataSource(ui.getQueryState().getAvailableCorpora()); tblCorpora.setMultiSelect(true); tblCorpora.setPropertyDataSource(ui.getQueryState().getSelectedCorpora()); tblCorpora.addGeneratedColumn("info", new InfoGenerator()); tblCorpora.addGeneratedColumn("docs", new DocLinkGenerator()); tblCorpora.setVisibleColumns("name", "textCount", "tokenCount", "info", "docs"); tblCorpora.setColumnHeaders("Name", "Texts", "Tokens", "", ""); tblCorpora.setHeight("100%"); tblCorpora.setWidth("100%"); tblCorpora.setSelectable(true); tblCorpora.setNullSelectionAllowed(false); tblCorpora.setColumnExpandRatio("name", 0.6f); tblCorpora.setColumnExpandRatio("textCount", 0.15f); tblCorpora.setColumnExpandRatio("tokenCount", 0.25f); tblCorpora.addStyleName(ValoTheme.TABLE_SMALL); tblCorpora.addActionHandler((Action.Handler) this); tblCorpora.setImmediate(true); tblCorpora.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { Set selections = (Set) tblCorpora.getValue(); if (selections.size() == 1 && event.isCtrlKey() && tblCorpora.isSelected(event.getItemId())) { tblCorpora.setValue(null); } } }); tblCorpora.setItemDescriptionGenerator(new TooltipGenerator()); tblCorpora.addValueChangeListener(new CorpusTableChangedListener(finalThis)); Button btReload = new Button(); btReload.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { updateCorpusSetList(false, false); Notification.show("Reloaded corpus list", Notification.Type.HUMANIZED_MESSAGE); } }); btReload.setIcon(FontAwesome.REFRESH); btReload.setDescription("Reload corpus list"); btReload.addStyleName(ValoTheme.BUTTON_ICON_ONLY); selectionLayout.addComponent(btReload); selectionLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT); tblCorpora.setSortContainerPropertyId("name"); setExpandRatio(tblCorpora, 1.0f); updateCorpusSetList(true, true); }
From source file:annis.gui.flatquerybuilder.EdgeBox.java
License:Apache License
public EdgeBox(FlatQueryBuilder sq) { initEOs();/*from w w w . ja va 2s . c o m*/ storedValue = "."; edge = new ComboBox(); edge.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT); for (String o : EO.keySet()) { edge.addItem(o); edge.setItemCaption(o, EO.get(o)); } edge.setNewItemsAllowed(true); edge.setTextInputAllowed(true); edge.setWidth(WIDTH); edge.setNullSelectionAllowed(false); edge.setImmediate(true); edge.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent e) { //this prevents the creation of an invalid entry edge.select(null); } }); edge.addBlurListener(new BlurListener() { @Override public void blur(FieldEvents.BlurEvent e) { if (edge.getValue() != null) { String value = edge.getValue().toString(); //<--- CATCH NullPointerException HERE! if (!value.equals("")) { boolean valid = validOperator(value); if (!EO.containsKey(value) & valid) { String caption = value + UD_EO_DESCRIPTION; EO.put(value, caption); edge.setItemCaption(value, caption); } if (!valid) { edge.removeItem(value); /*this should make the user recognize his/her mistake:*/ edge.select(null); } } storedValue = (edge.getValue() != null) ? edge.getValue().toString() : storedValue; } else { edge.setValue(storedValue); } } }); setContent(edge); edge.select(BASIS_OPERATORS[0][0]); }
From source file:annis.gui.MetaDataPanel.java
License:Apache License
public MetaDataPanel(String toplevelCorpusName, String documentName) { super("Metadata"); this.toplevelCorpusName = toplevelCorpusName; this.documentName = documentName; setSizeFull();// www .j av a 2 s . co m layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); if (documentName == null) { docs = getAllSubcorpora(toplevelCorpusName); HorizontalLayout selectionLayout = new HorizontalLayout(); Label selectLabel = new Label("Select corpus/document: "); corpusSelection = new ComboBox(); selectionLayout.addComponents(selectLabel, corpusSelection); layout.addComponent(selectionLayout); selectLabel.setSizeUndefined(); corpusSelection.setWidth(100, Unit.PERCENTAGE); corpusSelection.setHeight("-1px"); corpusSelection.addValueChangeListener(MetaDataPanel.this); selectionLayout.setWidth(100, Unit.PERCENTAGE); selectionLayout.setHeight("-1px"); selectionLayout.setSpacing(true); selectionLayout.setComponentAlignment(selectLabel, Alignment.MIDDLE_LEFT); selectionLayout.setComponentAlignment(corpusSelection, Alignment.MIDDLE_LEFT); selectionLayout.setExpandRatio(selectLabel, 0.4f); selectionLayout.setExpandRatio(corpusSelection, 0.6f); corpusSelection.addItem(toplevelCorpusName); corpusSelection.select(toplevelCorpusName); corpusSelection.setNullSelectionAllowed(false); corpusSelection.setImmediate(true); for (Annotation c : docs) { corpusSelection.addItem(c.getName()); } } else { Map<Integer, List<Annotation>> hashMData = splitListAnnotations(); List<BeanItemContainer<Annotation>> l = putInBeanContainer(hashMData); Accordion accordion = new Accordion(); accordion.setSizeFull(); // set output to none if no metadata are available if (l.isEmpty()) { addEmptyLabel(); } else { for (BeanItemContainer<Annotation> item : l) { String corpusName = item.getIdByIndex(0).getCorpusName(); String path = toplevelCorpusName.equals(corpusName) ? "corpus: " + corpusName : "document: " + corpusName; if (item.getItemIds().isEmpty()) { accordion.addTab(new Label("none"), path); } else { accordion.addTab(setupTable(item), path); } } layout.addComponent(accordion); } } }
From source file:annis.gui.querybuilder.EdgeWindow.java
License:Apache License
public EdgeWindow(final TigerQueryBuilderCanvas parent, NodeWindow source, NodeWindow target) { this.parent = parent; this.source = source; this.target = target; setSizeFull();/*from w w w. j a v a 2 s . com*/ // HACK: use our own border since the one from chameleon does not really work addStyleName(ValoTheme.PANEL_BORDERLESS); addStyleName("border-layout"); addStyleName("white-panel"); VerticalLayout vLayout = new VerticalLayout(); setContent(vLayout); vLayout.setMargin(false); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("toolbar"); toolbar.setWidth("100%"); toolbar.setHeight("-1px"); vLayout.addComponent(toolbar); Label lblTitle = new Label("AQL Operator"); lblTitle.setWidth("100%"); toolbar.addComponent(lblTitle); toolbar.setComponentAlignment(lblTitle, Alignment.MIDDLE_LEFT); toolbar.setExpandRatio(lblTitle, 1.0f); btClose = new Button(); btClose.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btClose.addStyleName(ValoTheme.BUTTON_SMALL); btClose.setIcon(FontAwesome.TIMES_CIRCLE); btClose.setWidth("-1px"); btClose.addListener((Button.ClickListener) this); toolbar.addComponent(btClose); toolbar.setComponentAlignment(btClose, Alignment.MIDDLE_RIGHT); toolbar.setExpandRatio(btClose, 0.0f); cbOperator = new ComboBox(); cbOperator.setNewItemsAllowed(false); cbOperator.setTextInputAllowed(false); cbOperator.setNullSelectionAllowed(true); cbOperator.addItem(CUSTOM); cbOperator.setItemCaption(CUSTOM, "custom"); cbOperator.setNullSelectionItemId(CUSTOM); cbOperator.setNewItemHandler(new SimpleNewItemHandler(cbOperator)); cbOperator.setImmediate(true); vLayout.addComponent(cbOperator); for (AQLOperator o : AQLOperator.values()) { cbOperator.addItem(o); cbOperator.setItemCaption(o, o.getDescription() + " (" + o.getOp() + ")"); } cbOperator.setValue(AQLOperator.DIRECT_PRECEDENCE); cbOperator.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object val = event.getProperty().getValue(); if (val instanceof AQLOperator) { txtOperator.setValue(((AQLOperator) val).getOp()); } } }); cbOperator.setWidth("100%"); cbOperator.setHeight("20px"); txtOperator = new TextField(); txtOperator.setValue("."); txtOperator.setInputPrompt("select operator definition"); txtOperator.setSizeFull(); txtOperator.addValueChangeListener(new OperatorValueChangeListener(parent)); txtOperator.setImmediate(true); vLayout.addComponent(txtOperator); vLayout.setExpandRatio(cbOperator, 1.0f); }
From source file:annis.gui.querybuilder.QueryBuilderChooser.java
License:Apache License
public QueryBuilderChooser(QueryController controller, PluginSystem pluginSystem, InstanceConfig instanceConfig) { this.controller = controller; this.pluginSystem = pluginSystem; this.instanceConfig = instanceConfig; this.pluginRegistry = new HashMap<>(); this.short2caption = new HashMap<>(); setStyleName(ValoTheme.PANEL_BORDERLESS); layout = new VerticalLayout(); setContent(layout);// ww w . j a v a 2 s. co m layout.setSizeFull(); layout.setSpacing(true); setSizeFull(); // add combobox to choose the query builder cbChooseBuilder = new ComboBox(); cbChooseBuilder.setNewItemsAllowed(false); cbChooseBuilder.setNullSelectionAllowed(false); cbChooseBuilder.setImmediate(true); cbChooseBuilder.setInputPrompt("Choose a query builder"); cbChooseBuilder.setWidth("200px"); PluginManagerUtil util = new PluginManagerUtil(pluginSystem.getPluginManager()); Collection<QueryBuilderPlugin> builders = util.getPlugins(QueryBuilderPlugin.class); for (QueryBuilderPlugin b : builders) { short2caption.put(b.getShortName(), b.getCaption()); pluginRegistry.put(b.getCaption(), b); cbChooseBuilder.addItem(b.getCaption()); } cbChooseBuilder.addListener((Property.ValueChangeListener) this); layout.addComponent(cbChooseBuilder); layout.setExpandRatio(cbChooseBuilder, 0.0f); if (instanceConfig.getDefaultQueryBuilder() != null) { cbChooseBuilder.setValue(short2caption.get(instanceConfig.getDefaultQueryBuilder())); } }
From source file:annis.gui.resultview.SingleResultPanel.java
License:Apache License
public SingleResultPanel(final SDocument result, Match match, long resultNumber, ResolverProvider resolverProvider, PluginSystem ps, AnnisUI ui, Set<String> visibleTokenAnnos, String segmentationName, QueryController controller, InstanceConfig instanceConfig, DisplayedResultQuery query) {/*from w ww . j a v a2 s . co m*/ this.ps = ps; this.ui = ui; this.result = result; this.segmentationName = segmentationName; this.queryController = controller; this.resultNumber = resultNumber; this.resolverProvider = resolverProvider; this.visibleTokenAnnos = visibleTokenAnnos; this.instanceConfig = instanceConfig; this.query = query; this.match = match; calculateHelperVariables(); setWidth("100%"); setHeight("-1px"); if (query != null && query.getSelectedMatches().contains(resultNumber)) { addStyleName("selected-match"); } infoBar = new HorizontalLayout(); infoBar.addStyleName("info-bar"); infoBar.setWidth("100%"); infoBar.setHeight("-1px"); Label lblNumber = new Label("" + (resultNumber + 1)); infoBar.addComponent(lblNumber); lblNumber.setSizeUndefined(); btInfo = new Button(); btInfo.setStyleName(ValoTheme.BUTTON_BORDERLESS); btInfo.setIcon(ICON_RESOURCE); btInfo.setDescription("Show metadata"); btInfo.addClickListener((Button.ClickListener) this); infoBar.addComponent(btInfo); btLink = new Button(); btLink.setStyleName(ValoTheme.BUTTON_BORDERLESS); btLink.setIcon(FontAwesome.SHARE_ALT); btLink.setDescription("Share match reference"); btLink.setDisableOnClick(true); btLink.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { showShareSingleMatchGenerator(); } }); infoBar.addComponent(btLink); /** * Extract the top level corpus name and the document name of this single * result. */ path = CommonHelper.getCorpusPath(result.getGraph(), result); Collections.reverse(path); corpusName = path.get(0); documentName = path.get(path.size() - 1); MinMax minMax = getIds(result.getDocumentGraph()); // build label StringBuilder sb = new StringBuilder("Path: "); sb.append(StringUtils.join(path, " > ")); sb.append(" (" + minMax.segName + " ").append(minMax.min); sb.append(" - ").append(minMax.max).append(")"); Label lblPath = new Label(sb.toString()); lblPath.addStyleName("path-label"); lblPath.setWidth("100%"); lblPath.setHeight("-1px"); infoBar.addComponent(lblPath); infoBar.setExpandRatio(lblPath, 1.0f); infoBar.setSpacing(false); this.visualizerState = new HashMap<>(); // init context combox lftCtxCombo = new ComboBox(); rghtCtxCombo = new ComboBox(); lftCtxCombo.setWidth(50, Unit.PIXELS); rghtCtxCombo.setWidth(50, Unit.PIXELS); lftCtxCombo.setNullSelectionAllowed(false); rghtCtxCombo.setNullSelectionAllowed(false); lftCtxCombo.addStyleName(ValoTheme.COMBOBOX_SMALL); rghtCtxCombo.addStyleName(ValoTheme.COMBOBOX_SMALL); IndexedContainer lftCtxContainer = new IndexedContainer(); IndexedContainer rghtCtxContainer = new IndexedContainer(); // and a property for sorting lftCtxContainer.addContainerProperty("number", Integer.class, 0); rghtCtxContainer.addContainerProperty("number", Integer.class, 0); for (int i = 0; i < 30; i += 5) { lftCtxContainer.addItem(i).getItemProperty("number").setValue(i); rghtCtxContainer.addItem(i).getItemProperty("number").setValue(i); } int lftContextIdx = query == null ? 0 : query.getLeftContext(); lftCtxContainer.addItemAt(lftContextIdx, lftContextIdx); lftCtxContainer.sort(new Object[] { "number" }, new boolean[] { true }); int rghtCtxIdx = query == null ? 0 : query.getRightContext(); rghtCtxContainer.addItem(rghtCtxIdx); rghtCtxContainer.sort(new Object[] { "number" }, new boolean[] { true }); lftCtxCombo.setContainerDataSource(lftCtxContainer); rghtCtxCombo.setContainerDataSource(rghtCtxContainer); lftCtxCombo.select(lftContextIdx); rghtCtxCombo.select(rghtCtxIdx); lftCtxCombo.setNewItemsAllowed(true); rghtCtxCombo.setNewItemsAllowed(true); lftCtxCombo.setImmediate(true); rghtCtxCombo.setImmediate(true); lftCtxCombo.setNewItemHandler(new AddNewItemHandler(lftCtxCombo)); rghtCtxCombo.setNewItemHandler(new AddNewItemHandler(rghtCtxCombo)); lftCtxCombo.addValueChangeListener(new ContextChangeListener(resultNumber, true)); rghtCtxCombo.addValueChangeListener(new ContextChangeListener(resultNumber, false)); Label leftCtxLabel = new Label("left context: "); Label rightCtxLabel = new Label("right context: "); leftCtxLabel.setWidth("-1px"); rightCtxLabel.setWidth("-1px"); HorizontalLayout ctxLayout = new HorizontalLayout(); ctxLayout.setSpacing(true); ctxLayout.addComponents(leftCtxLabel, lftCtxCombo, rightCtxLabel, rghtCtxCombo); infoBar.addComponent(ctxLayout); addComponent(infoBar); initVisualizer(); }
From source file:br.com.anteros.mobileserver.app.form.ApplicationForm.java
License:Apache License
private void createFields() { fldId = new TextField(); fldId.setCaption("Id"); fldId.setWidth("100px"); fldId.setStyleName("small"); fldName = new TextField(); fldName.setCaption("Nome da aplicao"); fldName.setWidth("200px"); fldName.setRequired(true);//from ww w . jav a 2 s .c om fldName.setRequiredError("Informe o nome da aplicao."); fldName.setStyleName("small"); fldDescription = new TextField(); fldDescription.setCaption("Descrio da aplicao"); fldDescription.setWidth("500px"); fldDescription.setRequired(true); fldDescription.setRequiredError("Informe a descrio da aplicao."); fldDescription.setStyleName("small"); cbDialect = new ComboBox(); cbDialect.setImmediate(false); cbDialect.setWidth("-1px"); cbDialect.setHeight("-1px"); cbDialect.addItem(MobileServerContext.H2); cbDialect.addItem(MobileServerContext.ORACLE); cbDialect.addItem(MobileServerContext.MYSQL); cbDialect.addItem(MobileServerContext.FIREBIRD); cbDialect.addItem(MobileServerContext.POSTGRESQL); cbDialect.setRequired(true); cbDialect.setCaption("Dialeto"); cbDialect.setRequiredError("Informe a dialeto da aplicao."); cbDialect.setStyleName("small"); cbCharset = new ComboBox(); cbCharset.setImmediate(false); cbCharset.setWidth("157px"); cbCharset.setHeight("-1px"); cbCharset.addItem(AnterosStandardsCharsets.ISO_8859_1.name()); cbCharset.addItem(AnterosStandardsCharsets.US_ASCII.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_16.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_16BE.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_16LE.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_8.name()); cbCharset.setRequired(true); cbCharset.setCaption("Charset"); cbCharset.setRequiredError("Informe o charset da aplicao."); cbCharset.setStyleName("small"); fldURL = new TextField(); fldURL.setImmediate(false); fldURL.setWidth("458px"); fldURL.setHeight("-1px"); fldURL.setCaption("URL"); fldURL.setRequired(true); fldURL.setRequiredError("Informe a URL de conexo com o banco de dados."); fldUser = new TextField(); fldUser.setImmediate(false); fldUser.setWidth("157px"); fldUser.setHeight("-1px"); fldUser.setCaption("Usurio"); fldUser.setRequired(true); fldUser.setRequiredError("Informe o usurio para conexo com o banco de dados."); fldPassword = new PasswordField(); fldPassword.setImmediate(false); fldPassword.setWidth("157px"); fldPassword.setHeight("-1px"); fldPassword.setCaption("Senha"); cbPoolType = new ComboBox(); cbPoolType.setImmediate(false); cbPoolType.setWidth("-1px"); cbPoolType.setHeight("-1px"); cbPoolType.addItem(PoolDatasource.POOL_C3P0); cbPoolType.addItem(PoolDatasource.POOL_TOMCAT); cbPoolType.addItem(PoolDatasource.POOL_JNDI); cbPoolType.addItem(PoolDatasource.JDBC_WITHOUT_PO0L); cbPoolType.setRequired(true); cbPoolType.setCaption("Gerenciador conexes"); cbPoolType.setRequiredError("Informe o gerenciador de conexes da aplicao."); cbPoolType.setStyleName("small"); fldJNDI = new TextField(); fldJNDI.setImmediate(false); fldJNDI.setWidth("250px"); fldJNDI.setHeight("-1px"); fldJNDI.setCaption("Recurso JNDI"); fldJNDI.setRequired(false); fldJNDI.setRequiredError("Informe o nome do recurso JNDI."); fldInitPoolSize = new TextField(); fldInitPoolSize.setImmediate(false); fldInitPoolSize.setWidth("157px"); fldInitPoolSize.setHeight("-1px"); fldInitPoolSize.setCaption("Tamanho Inicial do Pool"); fldInitPoolSize.setRequired(true); fldInitPoolSize.setRequiredError("Informe o tamanho inicial para o pool de conexes da aplicao."); fldMinPoolSize = new TextField(); fldMinPoolSize.setImmediate(false); fldMinPoolSize.setWidth("157px"); fldMinPoolSize.setHeight("-1px"); fldMinPoolSize.setCaption("Tamanho mnimo do Pool"); fldMinPoolSize.setRequired(true); fldMinPoolSize.setRequiredError("Informe o tamanho mnimo para o pool de conexes da aplicao."); fldMaxPoolSize = new TextField(); fldMaxPoolSize.setImmediate(false); fldMaxPoolSize.setWidth("157px"); fldMaxPoolSize.setHeight("-1px"); fldMaxPoolSize.setCaption("Tamanho mximo do Pool"); fldMaxPoolSize.setRequired(true); fldMaxPoolSize.setRequiredError("Informe o tamanho mximo para o pool de conexes da aplicao."); fldAcquireIncrement = new TextField(); fldAcquireIncrement.setImmediate(false); fldAcquireIncrement.setWidth("157px"); fldAcquireIncrement.setHeight("-1px"); fldAcquireIncrement.setCaption("Incremento do Pool"); fldAcquireIncrement.setRequired(true); fldAcquireIncrement .setRequiredError("Informe o tamanho para incremento do pool de conexes da aplicao."); fldCatalog = new TextField(); fldCatalog.setImmediate(false); fldCatalog.setWidth("157px"); fldCatalog.setHeight("-1px"); fldCatalog.setCaption("Catalog"); fldSchema = new TextField(); fldSchema.setImmediate(false); fldSchema.setWidth("157px"); fldSchema.setHeight("-1px"); fldSchema.setCaption("Schema"); chActive = new CheckBox(); chActive.setCaption("Ativa?"); chActive.setImmediate(false); chActive.setWidth("-1px"); chActive.setHeight("-1px"); applicationForm.addField("fldId", fldId); applicationForm.addField("fldName", fldName); applicationForm.addField("fldDescription", fldDescription); applicationForm.addField("cbDialect", cbDialect); applicationForm.addField("cbPoolType", cbPoolType); applicationForm.addField("fldJNDI", fldJNDI); applicationForm.addField("fldURL", fldURL); applicationForm.addField("fldUser", fldUser); applicationForm.addField("fldPassword", fldPassword); applicationForm.addField("cbCharset", cbCharset); applicationForm.addField("fldInitPoolSize", fldInitPoolSize); applicationForm.addField("fldMinPoolSize", fldMinPoolSize); applicationForm.addField("fldMaxPoolSize", fldMaxPoolSize); applicationForm.addField("fldAcquireIncrement", fldAcquireIncrement); applicationForm.addField("fldCatalog", fldCatalog); applicationForm.addField("fldSchema", fldSchema); applicationForm.addField("chActive", chActive); }
From source file:br.com.anteros.mobileserver.app.form.ConfigurationForm.java
License:Apache License
private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/*from w w w . jav a2 s . c o m*/ mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); // top-level component properties setWidth("100%"); setHeight("100%"); // cbDialect cbDialect = new ComboBox(); cbDialect.setImmediate(false); cbDialect.setWidth("-1px"); cbDialect.setHeight("-1px"); cbDialect.addItem(MobileServerContext.H2); cbDialect.addItem(MobileServerContext.ORACLE); cbDialect.addItem(MobileServerContext.MYSQL); cbDialect.addItem(MobileServerContext.FIREBIRD); cbDialect.addItem(MobileServerContext.POSTGRESQL); // lblDialect lblDialect = new Label(); lblDialect.setImmediate(false); lblDialect.setWidth("-1px"); lblDialect.setHeight("-1px"); lblDialect.setValue("Dialeto"); // cbCharset cbCharset = new ComboBox(); cbCharset.setImmediate(false); cbCharset.setWidth("-1px"); cbCharset.setHeight("-1px"); cbCharset.addItem(AnterosStandardsCharsets.ISO_8859_1.name()); cbCharset.addItem(AnterosStandardsCharsets.US_ASCII.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_16.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_16BE.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_16LE.name()); cbCharset.addItem(AnterosStandardsCharsets.UTF_8.name()); // lblCharset lblCharset = new Label(); lblCharset.setImmediate(false); lblCharset.setWidth("-1px"); lblCharset.setHeight("-1px"); lblCharset.setValue("Charset"); // fldURL fldURL = new TextField(); fldURL.setImmediate(false); fldURL.setWidth("458px"); fldURL.setHeight("-1px"); // lblURL lblURL = new Label(); lblURL.setImmediate(false); lblURL.setWidth("-1px"); lblURL.setHeight("-1px"); lblURL.setValue("Url conexo"); // fldUser fldUser = new TextField(); fldUser.setImmediate(false); fldUser.setWidth("157px"); fldUser.setHeight("-1px"); // lblUser lblUser = new Label(); lblUser.setImmediate(false); lblUser.setWidth("-1px"); lblUser.setHeight("-1px"); lblUser.setValue("Usurio"); // fldPassword fldPassword = new PasswordField(); fldPassword.setImmediate(false); fldPassword.setWidth("157px"); fldPassword.setHeight("-1px"); // lblPassword lblPassword = new Label(); lblPassword.setImmediate(false); lblPassword.setWidth("-1px"); lblPassword.setHeight("-1px"); lblPassword.setValue("Senha"); // fldCatalog fldCatalog = new TextField(); fldCatalog.setImmediate(false); fldCatalog.setWidth("157px"); fldCatalog.setHeight("-1px"); // lblCatalog lblCatalog = new Label(); lblCatalog.setImmediate(false); lblCatalog.setWidth("-1px"); lblCatalog.setHeight("-1px"); lblCatalog.setValue("Catalog"); // fldSchema fldSchema = new TextField(); fldSchema.setImmediate(false); fldSchema.setWidth("157px"); fldSchema.setHeight("-1px"); // lblSchema lblSchema = new Label(); lblSchema.setImmediate(false); lblSchema.setWidth("-1px"); lblSchema.setHeight("-1px"); lblSchema.setValue("Schema"); // imgAnteros imgAnteros = new Embedded(); imgAnteros.setImmediate(false); imgAnteros.setWidth("165px"); imgAnteros.setHeight("45px"); imgAnteros.setSource(new ThemeResource("images/anteros_mobile_server45.png")); imgAnteros.setType(1); imgAnteros.setMimeType("image/png"); // fldInitPoolSize fldInitPoolSize = new TextField(); fldInitPoolSize.setImmediate(false); fldInitPoolSize.setWidth("157px"); fldInitPoolSize.setHeight("-1px"); // lblPool lblPool = new Label(); lblPool.setImmediate(false); lblPool.setWidth("-1px"); lblPool.setHeight("-1px"); lblPool.setValue("<b>Pool de conexes</b>"); lblPool.setContentMode(3); // label_2 label_2 = new Label(); label_2.setImmediate(false); label_2.setWidth("-1px"); label_2.setHeight("-1px"); label_2.setValue("<b>Pool de conexes</b>"); label_2.setContentMode(3); // lblInitialPoolSize lblInitialPoolSize = new Label(); lblInitialPoolSize.setImmediate(false); lblInitialPoolSize.setWidth("-1px"); lblInitialPoolSize.setHeight("-1px"); lblInitialPoolSize.setValue("Tamanho inicial"); // fldMinPoolSize fldMinPoolSize = new TextField(); fldMinPoolSize.setImmediate(false); fldMinPoolSize.setWidth("157px"); fldMinPoolSize.setHeight("-1px"); // lblMinPoolSize lblMinPoolSize = new Label(); lblMinPoolSize.setImmediate(false); lblMinPoolSize.setWidth("-1px"); lblMinPoolSize.setHeight("-1px"); lblMinPoolSize.setValue("Tamanho Mnimo"); // lblMaxPoolSize lblMaxPoolSize = new Label(); lblMaxPoolSize.setImmediate(false); lblMaxPoolSize.setWidth("-1px"); lblMaxPoolSize.setHeight("-1px"); lblMaxPoolSize.setValue("Tamanho Mximo"); // fldMaxPoolSize fldMaxPoolSize = new TextField(); fldMaxPoolSize.setImmediate(false); fldMaxPoolSize.setWidth("157px"); fldMaxPoolSize.setHeight("-1px"); // fldAcquireIncrement fldAcquireIncrement = new TextField(); fldAcquireIncrement.setImmediate(false); fldAcquireIncrement.setWidth("157px"); fldAcquireIncrement.setHeight("-1px"); // lblAcquireIncrement lblAcquireIncrement = new Label(); lblAcquireIncrement.setImmediate(false); lblAcquireIncrement.setWidth("-1px"); lblAcquireIncrement.setHeight("-1px"); lblAcquireIncrement.setValue("Incremento"); // chShowSql chShowSql = new CheckBox(); chShowSql.setCaption("Mostrar SQL's no log"); chShowSql.setImmediate(false); chShowSql.setWidth("-1px"); chShowSql.setHeight("-1px"); // chFormatSql chFormatSql = new CheckBox(); chFormatSql.setCaption("Formatar SQL's "); chFormatSql.setImmediate(false); chFormatSql.setWidth("-1px"); chFormatSql.setHeight("-1px"); // btnOk btnOk = new Button(); btnOk.setCaption("Ok"); btnOk.setIcon(new ThemeResource("icons/16/ok.png")); btnOk.setImmediate(true); btnOk.setWidth("-1px"); btnOk.setHeight("-1px"); // btnCancel btnCancel = new Button(); btnCancel.setCaption("Cancela"); btnCancel.setIcon(new ThemeResource("icons/16/cancel.png")); btnCancel.setImmediate(true); btnCancel.setWidth("-1px"); btnCancel.setHeight("-1px"); // imgConfiguration imgConfiguration = new Embedded(); imgConfiguration.setImmediate(false); imgConfiguration.setWidth("48px"); imgConfiguration.setHeight("48px"); imgConfiguration.setSource(new ThemeResource("images/configuration.png")); imgConfiguration.setType(1); imgConfiguration.setMimeType("image/png"); // lblAccessControl lblAccessControl = new Label(); lblAccessControl.setImmediate(false); lblAccessControl.setWidth("-1px"); lblAccessControl.setHeight("-1px"); lblAccessControl.setValue("<b>Controle de acesso</b>"); lblAccessControl.setContentMode(3); // lblAccessUser lblAccessUser = new Label(); lblAccessUser.setImmediate(false); lblAccessUser.setWidth("-1px"); lblAccessUser.setHeight("-1px"); lblAccessUser.setValue("Usurio"); // fldAccessUser fldAccessUser = new TextField(); fldAccessUser.setImmediate(false); fldAccessUser.setWidth("157px"); fldAccessUser.setHeight("-1px"); // lblAccessPassword lblAccessPassword = new Label(); lblAccessPassword.setImmediate(false); lblAccessPassword.setWidth("-1px"); lblAccessPassword.setHeight("-1px"); lblAccessPassword.setValue("Senha"); // fldAccessPassword fldAccessPassword = new PasswordField(); fldAccessPassword.setImmediate(false); fldAccessPassword.setWidth("157px"); fldAccessPassword.setHeight("-1px"); // cbTipoPool cbTipoPool = new ComboBox(); cbTipoPool.setImmediate(false); cbTipoPool.setWidth("100.0%"); cbTipoPool.setHeight("-1px"); cbTipoPool.addItem(PoolDatasource.POOL_C3P0); cbTipoPool.addItem(PoolDatasource.POOL_TOMCAT); cbTipoPool.addItem(PoolDatasource.POOL_JNDI); cbTipoPool.addItem(PoolDatasource.JDBC_WITHOUT_PO0L); // lblTipoPool lblTipoPool = new Label(); lblTipoPool.setImmediate(false); lblTipoPool.setWidth("103px"); lblTipoPool.setHeight("-1px"); lblTipoPool.setValue("Gerenciador pool"); // fldJNDI fldJNDI = new TextField(); fldJNDI.setImmediate(false); fldJNDI.setWidth("300px"); fldJNDI.setHeight("-1"); // lblJNDI lblJNDI = new Label(); lblJNDI.setImmediate(false); lblJNDI.setWidth("-1px"); lblJNDI.setHeight("-1px"); lblJNDI.setValue("Recurso JNDI"); // lblQueryTimeout lblQueryTimeout = new Label(); lblQueryTimeout.setImmediate(false); lblQueryTimeout.setWidth("-1px"); lblQueryTimeout.setHeight("-1px"); lblQueryTimeout.setValue("Timeout query"); // fldMaxPoolSize fldQueryTimeout = new TextField(); fldQueryTimeout.setImmediate(false); fldQueryTimeout.setWidth("100px"); fldQueryTimeout.setHeight("-1px"); // lblQueryTimeoutSeconds lblQueryTimeoutSeconds = new Label(); lblQueryTimeoutSeconds.setImmediate(false); lblQueryTimeoutSeconds.setWidth("-1px"); lblQueryTimeoutSeconds.setHeight("-1px"); lblQueryTimeoutSeconds.setValue("segundos"); mainLayout.addComponent(cbDialect, "top:20.0px;left:269.0px;"); mainLayout.addComponent(lblDialect, "top:17.0px;left:223.0px;"); mainLayout.addComponent(cbCharset, "top:20.0px;left:569.0px;"); mainLayout.addComponent(lblCharset, "top:17.0px;left:519.0px;"); mainLayout.addComponent(fldURL, "top:44.0px;left:269.0px;"); mainLayout.addComponent(lblURL, "top:41.0px;left:195.0px;"); mainLayout.addComponent(fldUser, "top:69.0px;left:269.0px;"); mainLayout.addComponent(lblUser, "top:69.0px;left:218.0px;"); mainLayout.addComponent(fldPassword, "top:69.0px;left:571.0px;"); mainLayout.addComponent(lblPassword, "top:69.0px;left:529.0px;"); mainLayout.addComponent(fldCatalog, "top:94.0px;left:269.0px;"); mainLayout.addComponent(lblCatalog, "top:94.0px;left:216.0px;"); mainLayout.addComponent(fldSchema, "top:94.0px;left:571.0px;"); mainLayout.addComponent(lblSchema, "top:93.0px;left:519.0px;"); mainLayout.addComponent(imgAnteros, "top:5.0px;left:5.0px;"); mainLayout.addComponent(cbTipoPool, "top:159.0px;right:230.0px;left:269.0px;"); mainLayout.addComponent(lblTipoPool, "top:156.0px;left:165.0px;"); mainLayout.addComponent(lblJNDI, "top:197.0px;left:184.0px;"); mainLayout.addComponent(fldJNDI, "top:197.0px;left:269.0px;"); mainLayout.addComponent(fldInitPoolSize, "top:221.0px;left:269.0px;"); mainLayout.addComponent(lblPool, "top:130.0px;left:269.0px;"); mainLayout.addComponent(label_2, "top:130.0px;left:269.0px;"); mainLayout.addComponent(lblInitialPoolSize, "top:221.0px;left:172.0px;"); mainLayout.addComponent(fldMinPoolSize, "top:246.0px;left:269.0px;"); mainLayout.addComponent(lblMinPoolSize, "top:247.0px;left:164.0px;"); mainLayout.addComponent(lblMaxPoolSize, "top:273.0px;left:162.0px;"); mainLayout.addComponent(fldMaxPoolSize, "top:272.0px;left:269.0px;"); mainLayout.addComponent(fldAcquireIncrement, "top:297.0px;left:269.0px;"); mainLayout.addComponent(lblAcquireIncrement, "top:298.0px;left:200.0px;"); mainLayout.addComponent(chShowSql, "top:234.0px;left:571.0px;"); mainLayout.addComponent(chFormatSql, "top:250.0px;left:571.0px;"); mainLayout.addComponent(lblQueryTimeout, "top:297.0px;left:480.0px;"); mainLayout.addComponent(fldQueryTimeout, "top:298.0px;left:571.0px;"); mainLayout.addComponent(lblQueryTimeoutSeconds, "top:297.0px;left:675.0px;"); mainLayout.addComponent(imgConfiguration, "top:153.0px;left:30.0px;"); mainLayout.addComponent(lblAccessControl, "top:328.0px;left:180.0px;"); mainLayout.addComponent(lblAccessUser, "top:350.0px;left:220.0px;"); mainLayout.addComponent(fldAccessUser, "top:350.0px;left:269.0px;"); mainLayout.addComponent(lblAccessPassword, "top:349.0px;left:529.0px;"); mainLayout.addComponent(fldAccessPassword, "top:348.0px;left:571.0px;"); mainLayout.addComponent(btnOk, "top:394.0px;left:580.0px;"); mainLayout.addComponent(btnCancel, "top:394.0px;left:648.0px;"); return mainLayout; }
From source file:br.com.anteros.mobileserver.app.form.FieldForm.java
License:Apache License
private void createFields() { fldId = new TextField(); fldId.setCaption("Id"); fldId.setWidth("100px"); fldId.setStyleName("small"); fldName = new TextField(); fldName.setCaption("Nome do campo"); fldName.setWidth("200px"); fldName.setRequired(true);//from w w w. j a va2 s .c om fldName.setRequiredError("Informe o nome da campo."); fldName.setStyleName("small"); fldDescription = new TextField(); fldDescription.setCaption("Descrio do campo"); fldDescription.setWidth("500px"); fldDescription.setRequired(true); fldDescription.setRequiredError("Informe a descrio do campo."); fldDescription.setStyleName("small"); fldSQLFieldName = new TextField(); fldSQLFieldName.setCaption("Nome do campo SQL"); fldSQLFieldName.setWidth("200px"); fldSQLFieldName.setRequired(true); fldSQLFieldName.setRequiredError("Informe o nome do campo SQL."); fldSQLFieldName.setStyleName("small"); fldFieldType = new ComboBox(); fldFieldType.setCaption("Tipo de Campo"); fldFieldType.setWidth("200px"); fldFieldType.setRequired(true); fldFieldType.setRequiredError("Informe o tipo do campo."); fldFieldType.setStyleName("small"); Iterator<String> it = FieldTypes.getFieldTypes().keySet().iterator(); while (it.hasNext()) { String key = it.next(); String value = (String) FieldTypes.getFieldTypes().get(key); fldFieldType.addItem(value); } fieldForm.addField("fldId", fldId); fieldForm.addField("fldName", fldName); fieldForm.addField("fldDescription", fldDescription); fieldForm.addField("fldSQLFieldName", fldSQLFieldName); fieldForm.addField("fldFieldType", fldFieldType); }
From source file:br.com.anteros.mobileserver.app.form.ParameterForm.java
License:Apache License
private void createFields() { fldId = new TextField(); fldId.setCaption("Id"); fldId.setWidth("100px"); fldId.setStyleName("small"); fldName = new TextField(); fldName.setCaption("Nome do parmetro"); fldName.setWidth("200px"); fldName.setRequired(true);//from w w w . j a v a 2 s. c om fldName.setRequiredError("Informe o nome da aplicao."); fldName.setStyleName("small"); fldDescription = new TextField(); fldDescription.setCaption("Descrio do parmetro"); fldDescription.setWidth("500px"); fldDescription.setRequired(true); fldDescription.setRequiredError("Informe a descrio do parmetro."); fldDescription.setStyleName("small"); fldParameterDataType = new ComboBox(); fldParameterDataType.setCaption("Tipo de dado do parmetro"); fldParameterDataType.setWidth("200px"); fldParameterDataType.setRequired(true); fldParameterDataType.setRequiredError("Informe o tipo de dado do parmetro."); fldParameterDataType.setStyleName("small"); Iterator<String> it = FieldTypes.getFieldTypes().keySet().iterator(); while (it.hasNext()) { String key = it.next(); String value = (String) FieldTypes.getFieldTypes().get(key); fldParameterDataType.addItem(value); } fldParameterType = new ComboBox(); fldParameterType.setCaption("Tipo do parmetro"); fldParameterType.setWidth("200px"); fldParameterType.setRequired(true); fldParameterType.setRequiredError("Informe o tipo do parmetro."); fldParameterType.addItem("INPUT"); fldParameterType.addItem("OUTPUT"); if (objectOwner instanceof TableSynchronism) fldParameterType.addItem("SUBSTITUITION"); fldParameterType.setStyleName("small"); parameterForm.addField("fldId", fldId); parameterForm.addField("fldName", fldName); parameterForm.addField("fldDescription", fldDescription); parameterForm.addField("fldParameterDataType", fldParameterDataType); parameterForm.addField("fldParameterType", fldParameterType); }