List of usage examples for com.vaadin.ui TextArea setRows
public void setRows(int rows)
From source file:eu.lod2.ESpotlight.java
License:Apache License
public ESpotlight(LOD2DemoState st) { // The internal state and state = st;// w ww .j a va 2 s. co m VerticalLayout panel = new VerticalLayout(); // Spotlight form start // annotate a plain text // TODO: and add the result as RDF to the default graph Form t2f = new Form(); t2f.setDebugId(this.getClass().getSimpleName() + "_t2f"); t2f.setCaption("Annotate plain text"); TextArea textToAnnotateField = new TextArea("text:"); textToAnnotateField.setDebugId(this.getClass().getSimpleName() + "_textToAnnotateField"); textToAnnotateField.setImmediate(false); textToAnnotateField.addListener(this); textToAnnotateField.setColumns(50); textToAnnotateField.setRows(10); t2f.getLayout().addComponent(textToAnnotateField); annotatedTextField = new Label("annotated text", Label.CONTENT_XHTML); t2f.getLayout().addComponent(annotatedTextField); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); annotateButton = new Button("Annotate with Spotlight", new ClickListener() { public void buttonClick(ClickEvent event) { annotateText(event); } }); annotateButton.setDebugId(this.getClass().getSimpleName() + "_annotateButton"); annotateButton.setDescription("Annotate the text with Spotlight"); annotateButton.setEnabled(false); t2f.getFooter().addComponent(annotateButton); panel.addComponent(t2f); // Spotlight form end // The composition root MUST be set setCompositionRoot(panel); }
From source file:eu.lod2.QueryingTab.java
License:Apache License
private void extractionQuery(ClickEvent event) { try {/*w ww .j a v a 2s. co m*/ RepositoryConnection con = state.getRdfStore().getConnection(); if (querygraph.equals("")) { sparqlResult.removeAllComponents(); getWindow().showNotification("No query issued."); } else { //Initialize the result page sparqlResult.removeAllComponents(); String query = "select * from <" + querygraph + "> where {?s ?p ?o} LIMIT 100"; TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, query); TupleQueryResult result = tupleQuery.evaluate(); String statements = ""; while (result.hasNext()) { BindingSet bindingSet = result.next(); Value valueOfS = bindingSet.getValue("s"); Value valueOfP = bindingSet.getValue("p"); Value valueOfO = bindingSet.getValue("o"); String objectType = ""; String objectString = ""; if (valueOfO instanceof LiteralImpl) { objectType = "literal"; LiteralImpl literalO = (LiteralImpl) valueOfO; objectString = "\"" + literalO.getLabel() + "\" ^^ <" + literalO.getDatatype() + ">"; } ; if (valueOfO instanceof URIImpl) { objectType = "resource"; objectString = "<" + valueOfO.stringValue() + ">"; } ; String triple = "<" + valueOfS.stringValue() + "> <" + valueOfP.stringValue() + "> " + objectString; statements = statements + "\n" + triple; // do something interesting with the values here... } TextArea resultArea = new TextArea("", statements); resultArea.setDebugId(this.getClass().getSimpleName() + "_resultArea"); resultArea.setReadOnly(true); resultArea.setColumns(0); resultArea.setRows(30); sparqlResult.addComponent(resultArea); } } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedQueryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (QueryEvaluationException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:eu.lod2.SesameSPARQL.java
License:Apache License
private void extractionQuery(ClickEvent event) { try {//from w w w .j a v a 2s .com RepositoryConnection con = state.getRdfStore().getConnection(); String queryValue = (String) query.getValue(); if (queryValue.equals("")) { sparqlResult.removeAllComponents(); getWindow().showNotification("No query issued."); } else { //Initialize the result page sparqlResult.removeAllComponents(); TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryValue); TupleQueryResult result = tupleQuery.evaluate(); String statements = ""; while (result.hasNext()) { BindingSet bindingSet = result.next(); Value valueOfS = bindingSet.getValue("s"); Value valueOfP = bindingSet.getValue("p"); Value valueOfO = bindingSet.getValue("o"); String objectType = ""; String objectString = ""; if (valueOfO instanceof LiteralImpl) { objectType = "literal"; LiteralImpl literalO = (LiteralImpl) valueOfO; objectString = "\"" + literalO.getLabel() + "\" ^^ <" + literalO.getDatatype() + ">"; } ; if (valueOfO instanceof URIImpl) { objectType = "resource"; objectString = "<" + valueOfO.stringValue() + ">"; } ; String triple = "<" + valueOfS.stringValue() + "> <" + valueOfP.stringValue() + "> " + objectString; statements = statements + "\n" + triple; // do something interesting with the values here... } TextArea resultArea = new TextArea("", statements); resultArea.setDebugId(this.getClass().getSimpleName() + "_resultArea"); resultArea.setReadOnly(true); resultArea.setColumns(0); resultArea.setRows(30); sparqlResult.addComponent(resultArea); } } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedQueryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (QueryEvaluationException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:info.magnolia.ui.form.field.factory.TextFieldFactory.java
License:Open Source License
@Override protected Field<String> createFieldComponent() { // Create a TextArea if the rows > 1 if (definition.getRows() > 1) { TextArea textArea = new TextArea(); textArea.setRows(definition.getRows()); field = textArea;/*www.ja va 2 s . c om*/ } else { field = new TextField(); } field.setNullRepresentation(""); field.setNullSettingAllowed(true); if (definition.getMaxLength() != -1) { field.setMaxLength(definition.getMaxLength()); MaxLengthIndicator.extend(field); } return field; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getTextFieldPreviews() { Layout grid = getPreviewLayout("Text fields"); TextField tf = new TextField(); tf.setValue("Text field"); grid.addComponent(tf);//from w ww. jav a2 s. com tf = new TextField(); tf.setValue("Small field"); tf.setStyleName("small"); grid.addComponent(tf); tf = new TextField(); tf.setValue("Big field"); tf.setStyleName("big"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Search field"); tf.setStyleName("search"); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Small search"); tf.setStyleName("search small"); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Big search"); tf.setStyleName("search big"); grid.addComponent(tf); tf = new TextField("Error"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Error"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Small error"); tf.setStyleName("small"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); TextArea ta = new TextArea(); ta.setInputPrompt("Multiline"); ta.setRows(4); grid.addComponent(ta); ta = new TextArea(); ta.setInputPrompt("Small multiline"); ta.setStyleName("small"); ta.setRows(4); grid.addComponent(ta); ta = new TextArea(); ta.setInputPrompt("Big multiline"); ta.setStyleName("big"); ta.setRows(4); grid.addComponent(ta); return grid; }
From source file:nz.co.senanque.workflowui.FieldGroupWizard.java
License:Apache License
@SuppressWarnings("serial") public void load(final WorkflowForm form) { ProcessDefinition processDefinition = form.getProcessDefinition(); String task = processDefinition.getTask(form.getProcessInstance().getTaskId()).toString(); ProcessDefinition ownerProcessDefinition = processDefinition; while (processDefinition != null) { ownerProcessDefinition = processDefinition; processDefinition = processDefinition.getOwnerProcess(); }//from w w w . ja v a 2s. c o m setCaption(m_messageSourceAccessor.getMessage("form.wizard.caption", new Object[] { new Long(form.getProcessInstance().getId()), ownerProcessDefinition.getName(), form.getProcessInstance().getReference(), ownerProcessDefinition.getDescription() })); formPanel.removeAllComponents(); formPanel.addComponent((VerticalLayout) form); ProcessInstance processInstance = form.getProcessInstance(); if (!form.isReadOnly()) { PermissionManager pm = m_maduraSessionManager.getPermissionManager(); processInstance = getWorkflowClient().lockProcessInstance(form.getProcessInstance(), pm.hasPermission(FixedPermissions.TECHSUPPORT), pm.getCurrentUser()); if (processInstance == null) { com.vaadin.ui.Notification.show(m_messageSourceAccessor.getMessage("failed.to.get.lock"), m_messageSourceAccessor.getMessage("message.noop"), com.vaadin.ui.Notification.Type.HUMANIZED_MESSAGE); return; } } form.setProcessInstance(processInstance); // This is binding the process instance associated with the form to the workflow validation session. // log.debug("Binding {} to Validation engine {}",processInstance.getClass().getSimpleName(),getMaduraSessionManager().getValidationEngine().getIdentifier()); getMaduraSessionManager().getValidationSession().bind(form.getProcessInstance()); ((VerticalLayout) form).addListener(new Listener() { @Override public void componentEvent(Event event) { close(); fireEvent(event); } }); formPanel.markAsDirty(); BeanItem<ProcessInstance> beanItem = new BeanItem<ProcessInstance>(form.getProcessInstance()); m_maduraFieldGroup = m_maduraSessionManager.createMaduraFieldGroup(); Button attachments = m_maduraFieldGroup.createButton("attachments", new ClickListener() { @Override public void buttonClick(ClickEvent event) { m_attachmentsPopup.load(form.getProcessInstance().getId()); } }); Map<String, Field<?>> fields = m_maduraFieldGroup.buildAndBind(new String[] { "queueName", "bundleName", "status", "reference", "lastUpdated", "lockedBy", "comment" }, beanItem); TextArea comment = (TextArea) fields.get("comment"); comment.setRows(2); comment.setWordwrap(true); comment.setWidth("700px"); TextArea taskField = new TextArea(); taskField.setRows(2); taskField.setWordwrap(true); taskField.setWidth("700px"); taskField.setValue(task); taskField.setReadOnly(true); processPanel.removeAllComponents(); processPanel.setMargin(true); processPanel.setSpacing(true); HorizontalLayout processPanelHorizontal = new HorizontalLayout(); processPanelHorizontal.setSpacing(true); processPanel.addComponent(processPanelHorizontal); VerticalLayout processPanelColumn1 = new VerticalLayout(); VerticalLayout processPanelColumn2 = new VerticalLayout(); VerticalLayout processPanelColumn3 = new VerticalLayout(); processPanelHorizontal.addComponent(processPanelColumn1); processPanelHorizontal.addComponent(processPanelColumn2); processPanelHorizontal.addComponent(processPanelColumn3); processPanelColumn1.addComponent(fields.get("queueName")); processPanelColumn1.addComponent(fields.get("bundleName")); processPanelColumn2.addComponent(fields.get("reference")); processPanelColumn2.addComponent(fields.get("lastUpdated")); processPanelColumn3.addComponent(fields.get("lockedBy")); processPanelColumn3.addComponent(fields.get("status")); processPanel.addComponent(comment); processPanel.addComponent(taskField); m_maduraSessionManager.updateOtherFields(null); m_maduraFieldGroup.setReadOnly(form.isReadOnly()); processPanel.addComponent(attachments); processPanel.markAsDirty(); auditPanel.removeAllComponents(); m_audits.setup(form.getProcessInstance()); auditPanel.addComponent(m_audits); if (getParent() == null) { UI.getCurrent().addWindow(this); this.center(); } }
From source file:nz.co.senanque.workflowui.WorkflowUIHints.java
License:Apache License
public AbstractField<?> getTextField(MaduraPropertyWrapper property) { AbstractTextField ret = null;/*ww w . j a v a 2s . c om*/ if (property.isSecret()) { ret = new PasswordField(); } else { if ("comment".equals(property.getName())) { TextArea textArea = new TextArea(); textArea.setRows(5); textArea.setWordwrap(true); textArea.setWidth("400px"); ret = textArea; } else { ret = new TextField(); } } ret.setMaxLength(property.getMaxLength()); if (property.getValue() == null) { property.setValue(""); } return ret; }
From source file:org.activiti.explorer.ui.form.TextAreaFormPropertyRenderer.java
License:Apache License
@Override public Field getPropertyField(FormProperty formProperty) { TextArea textArea = new TextArea(getPropertyLabel(formProperty)); textArea.setRequired(formProperty.isRequired()); textArea.setEnabled(formProperty.isWritable()); textArea.setRows(10); textArea.setColumns(40);// w w w .ja v a2 s . c o m textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); if (formProperty.getValue() != null) { textArea.setValue(formProperty.getValue()); } return textArea; }
From source file:org.apache.ace.log.server.ui.LogViewerExtension.java
License:Apache License
/** * Creates a {@link TextArea} with a dump of the given event's properties. * //from w w w .j a v a2 s .co m * @param event * the event to create a textarea for, cannot be <code>null</code>. * @return a {@link TextArea} instance, never <code>null</code>. */ final TextArea getProperties(Event event) { Map<String, String> props = event.getProperties(); TextArea area = new TextArea("", dumpProperties(props)); area.setWidth(FILL_AREA); area.setRows(props.size()); area.setWordwrap(false); area.setReadOnly(true); area.setImmediate(true); return area; }
From source file:org.apache.openaz.xacml.admin.view.windows.PDPStatusWindow.java
License:Apache License
protected TextArea createTextArea(String value, int lines) { TextArea area = new TextArea(); area.setValue(value);// w w w . j a va 2s .c o m area.setNullRepresentation(""); area.setSizeFull(); area.setReadOnly(true); area.setRows(lines); return area; }