final Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP); text.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle textTrim = text.computeTrim(0, 0, textSize.x, text.getLineHeight()); final int textPadding = textTrim.height - text.getLineHeight(); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { int height = text.getLineCount() * text.getLineHeight() + textPadding; text.setSize(text.getSize().x, height); // need to layout parent, in order to change position of // siblings parent.layout(); } });
email.setRequired(); email.setLabel(T_email_address); email.setHelp(T_email_address_help); email.setValue(this.email); email.addError(T_error_not_found);
text.setLabel(dcInput.getLabel()); text.setHelp(cleanHints(dcInput.getHints())); String fieldKey = MetadataAuthorityManager.makeFieldKey(dcInput.getSchema(), dcInput.getElement(), dcInput.getQualifier()); boolean isAuth = MetadataAuthorityManager.getManager().isAuthorityControlled(fieldKey); if (isAuth) text.setAuthorityControlled(); text.setAuthorityRequired(MetadataAuthorityManager.getManager().isAuthorityRequired(fieldKey)); text.setChoices(fieldKey); text.setChoicesPresentation(ChoiceAuthorityManager.getManager().getPresentation(fieldKey)); text.setChoicesClosed(ChoiceAuthorityManager.getManager().isClosed(fieldKey)); text.setRequired(); text.addError(dcInput.getWarning()); text.addError(T_required_field); text.enableAddOperation(); text.enableDeleteOperation(); text.setDisabled(); Instance ti = text.addInstance(); ti.setValue(dcValue.value); if (isAuth)
name.setRequired(); name.setLabel(T_name); name.setHelp(T_name_help); name.setValue(nameValue); name.setSize(35); if (errors.contains("short_description")) name.addError(T_name_error); mimeType.setLabel(T_mimetype); mimeType.setHelp(T_mimetype_help); mimeType.setValue(mimetypeValue); mimeType.setSize(35); name.setDisabled(); extensions.setLabel(T_extensions); extensions.setHelp(T_extensions_help); extensions.enableAddOperation(); extensions.enableDeleteOperation(); for (String extensionValue : extensionValues) extensions.addInstance().setValue(extensionValue);
year.setDisabled(); month.setDisabled(); day.setDisabled(); year.setLabel(T_year); year.setSize(4,4); day.setLabel(T_day); day.setSize(2,2); year.addInstance().setValue(String.valueOf(dcDate.getYear())); month.addInstance().setOptionSelected(dcDate.getMonth()); day.addInstance().setValue(String.valueOf(dcDate.getDay())); fullDate.addInstance().setValue(dcDate.toString()); year.setValue(String.valueOf(dcDate.getYear())); month.setOptionSelected(dcDate.getMonth()); day.setValue(""); day.setValue(String.valueOf(dcDate.getDay()));
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException { // Build the item viewer division. Division feedback = body.addInteractiveDivision("feedback-form", contextPath+"/feedback",Division.METHOD_POST,"primary"); feedback.setHead(T_head); feedback.addPara(T_para1); List form = feedback.addList("form",List.TYPE_FORM); Text email = form.addItem().addText("email"); email.setLabel(T_email); email.setHelp(T_email_help); email.setValue(parameters.getParameter("email","")); TextArea comments = form.addItem().addTextArea("comments"); comments.setLabel(T_comments); comments.setValue(parameters.getParameter("comments","")); form.addItem().addButton("submit").setValue(T_submit); feedback.addHidden("page").setValue(parameters.getParameter("page","unknown")); } }
/** * Set the raw value of the field removing any previous raw values. * * @param characters * (May be null) Field value as a string */ public void setValue(String characters) throws WingException { Value value = this.setValue(); value.addContent(characters); }
value.setDisabled(); value.addInstance().setValue(dcValue.value); qualdrop.addInstance().setValue(dcValue.qualifier + ":" + dcValue.value); value.setValue(dcValues[0].value);
description.setLabel(T_description_label); description.setHelp(T_description_help); description.setDisabled();
jumpForm.addText("starts_with").setHelp(T_starts_with_help);
/** * Set the authority value of the field removing any previous authority values. * Initialized to an empty value. */ public Value setAuthorityValue() throws WingException { return setAuthorityValue("", "UNSET"); }