Package org.dspace.app.xmlui.wing.element

Examples of org.dspace.app.xmlui.wing.element.Text


    Select primarySelect = edit.addItem().addSelect("primary");
    primarySelect.setLabel(T_primary_label);
    primarySelect.addOption(primaryBitstream,"yes",T_primary_option_yes);
    primarySelect.addOption(!primaryBitstream,"no",T_primary_option_no);
   
    Text description = edit.addItem().addText("description");
    description.setLabel(T_description_label);
    description.setHelp(T_description_help);
    description.setValue(bitstream.getDescription());

    edit.addItem(T_para1);

    // System supported formats
    Select format = edit.addItem().addSelect("formatID");
    format.setLabel(T_format_label);

                // load the options menu, skipping the "Unknown" format since "Not on list" takes its place
                int unknownFormatID = BitstreamFormat.findUnknown(context).getID();
    format.addOption(-1,T_format_default);
    for (BitstreamFormat bitstreamFormat : bitstreamFormats)
    {
                        if (bitstreamFormat.getID() == unknownFormatID)
                            continue;
      String supportLevel = "Unknown";
      if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
        supportLevel = "known";
      else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
        supportLevel = "Supported";
      String name = bitstreamFormat.getShortDescription()+" ("+supportLevel+")";
                        if (bitstreamFormat.isInternal())
                            name += " (Internal)";
      int id = bitstreamFormat.getID();

      format.addOption(id,name);
    }
    if (currentFormat != null)
    {
      format.setOptionSelected(currentFormat.getID());
    }
    else
    {
      format.setOptionSelected(-1);
    }

    edit.addItem(T_para2);

    // User supplied format
    Text userFormat = edit.addItem().addText("user_format");
    userFormat.setLabel(T_user_label);
    userFormat.setHelp(T_user_help);
    userFormat.setValue(bitstream.getUserFormatDescription());




    // ITEM: form actions
View Full Code Here


      
       register.addPara(T_para2);
      
       List form = register.addList("form",List.TYPE_FORM);
      
       Text email = form.addItem().addText("email");
       email.setRequired();
       email.setLabel(T_email_address);
       email.setHelp(T_email_address_help);
       email.setValue(this.email);
       if (errors.contains("email"))
           email.addError(T_error_bad_email);
      
       Item submit = form.addItem();
       submit.addButton("submit").setValue(T_submit_register);
      
       register.addHidden("eperson-continue").setValue(knot.getId());
View Full Code Here

   
    List list = div.addList("fieldTest",List.TYPE_FORM);
    list.setHead("Tests");
   
    // text
    Text text = list.addItem().addText("text");
    text.setLabel("Text");
    text.enableAddOperation();
    text.enableDeleteOperation();
    if (help)
      text.setHelp("This is helpfull text.");
    if (error)
      text.addError("This field is in error.");
    text.setValue("First is special");
    Instance instance = text.addInstance();
    instance.setValue("Second raw");
    instance.setInterpretedValue("Second interpreted");
    instance = text.addInstance();
    instance.setValue("Third raw");
    instance.setInterpretedValue("Third interpreted");

    // Select
    Select select = list.addItem().addSelect("select");
    select.setLabel("Text");
    select.enableAddOperation();
    select.enableDeleteOperation();
    select.setMultiple();
    select.setSize(4);
    if (help)
      select.setHelp("This is helpfull text.");
    if (error)
      select.addError("This field is in error.");
    select.addOption("one", "uno");
    select.addOption("two", "dos");
    select.addOption("three", "tres");
    select.addOption("four", "cuatro");
    select.addOption("five", "cinco");
   
    instance = select.addInstance();
    instance.setOptionSelected("one");
   
    instance = select.addInstance();
    instance.setOptionSelected("one");
    instance.setOptionSelected("two");
   
    instance = select.addInstance();
    instance.setOptionSelected("one");
    instance.setOptionSelected("two");
    instance.setOptionSelected("three");
   
    instance = select.addInstance();
    instance.setOptionSelected("one");
    instance.setOptionSelected("two");
    instance.setOptionSelected("three");
    instance.setOptionSelected("four");
   
    instance = select.addInstance();
    instance.setOptionSelected("one");
    instance.setOptionSelected("two");
    instance.setOptionSelected("three");
    instance.setOptionSelected("four");
    instance.setOptionSelected("five");
   

        // composite two text fields  
        Composite composite = list.addItem().addComposite("compositeA");
        composite.setLabel("Composite (two text fields)");
        composite.enableAddOperation();
        composite.enableDeleteOperation();
        if (help)
          composite.setHelp("This field is composed of two text fields, fill them both in.");
        if (error)
          composite.addError("Just the composite is in error.");
        text = composite.addText("firstA");
        if (help)
          text.setHelp("This is helpfull text.");
        text.addInstance().setValue("1, Raw A");
        text.addInstance().setValue("2, Raw A");
        text.addInstance().setValue("3, Raw A");
       
        text = composite.addText("secondA");
        if (help)
          text.setHelp("This is helpfull text.");
        text.addInstance().setValue("1, Raw B");
        text.addInstance().setValue("2, Raw B");
        text.addInstance().setValue("3, Raw B");
       
        // composite select & text fields
        composite = list.addItem().addComposite("compositeB");
        composite.setLabel("Composite (select & text fields)");
        composite.enableAddOperation();
        composite.enableDeleteOperation();
        if (help)
          composite.setHelp("This field is composed of a select and text field, select one and type the other.");
 
        select = composite.addSelect("selectB");
        if (help)
          select.setHelp("Me, me, me..... select me!");
        if (error)
          select.addError("The composite elements are in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");
       
        select.addInstance().addOptionValue("one");
        select.addInstance().addOptionValue("two");
        select.addInstance().addOptionValue("three");
       
        text = composite.addText("TextB");
        if (help)
          text.setHelp("Yay, yet another text field");
        if (error)
          text.addError("The composite elements are in error.");
        text.addInstance().setValue("1, Raw B");
        text.addInstance().setValue("2, Raw B");
        text.addInstance().setValue("3, Raw B");
       
        composite.addInstance().setInterpretedValue("One interpreted.");
        composite.addInstance().setInterpretedValue("Two interpreted.");
        composite.addInstance().setInterpretedValue("Three interpreted.");
       
        // Composite (date)
        composite = list.addItem().addComposite("composite-date");
        composite.setLabel("Composite (date)");
        composite.enableAddOperation();
        composite.enableDeleteOperation();
        if (help)
          composite.setHelp("The date when something happened.");
        if (error)
          composite.setHelp("The composite is in error.");
       
        text = composite.addText("day");
        if (help)
          text.setHelp("day");
        if (error)
          text.setHelp("The first text field is in error.");
        text.setSize(4,2);
       
        text.addInstance().setValue("1");
        text.addInstance().setValue("2");
        text.addInstance().setValue("3");
        text.addInstance().setValue("4");
        text.addInstance().setValue("5");
       
        select = composite.addSelect("month");
        if (error)
          select.setHelp("The select box is in error.");
        select.addOption("","(Select Month)");
        select.addOption(1,"January");
        select.addOption(2,"Feburary");
        select.addOption(3,"March");
        select.addOption(4,"April");
        select.addOption(5,"May");
        select.addOption(6,"June");
        select.addOption(7,"July");
        select.addOption(8,"August");
        select.addOption(9,"September");
        select.addOption(10,"August");
        select.addOption(11,"October");
        select.addOption(12,"November");
        select.addOption(13,"December");
       
        select.addInstance().setOptionSelected(1);
        select.addInstance().setOptionSelected(2);
        select.addInstance().setOptionSelected(3);
        select.addInstance().setOptionSelected(4);
        select.addInstance().setOptionSelected(5);
       
        text = composite.addText("year");
        text.setSize(4,4);
        if (help)
          text.setHelp("year");
        if (error)
          text.setHelp("The second text field is in error.");
        text.addInstance().setValue("2001");
        text.addInstance().setValue("2002");
        text.addInstance().setValue("2003");
        text.addInstance().setValue("2004");
        text.addInstance().setValue("2005");
       
        // Buttons one typical finds at the end of forums
        Item actions = list.addItem();
        actions.addButton("submit_save").setValue("Save");
        actions.addButton("submit_cancel").setValue("Cancel");
View Full Code Here

        private void renderNameField(List form, String fieldName, DCInput dcInput, DCValue[] dcValues, boolean readonly) throws WingException
        {
                // The name field is a composite field containing two text fields, one
                // for first name the other for last name.
                Composite fullName = form.addItem().addComposite(fieldName, "submit-name");
                Text lastName = fullName.addText(fieldName+"_last");
                Text firstName = fullName.addText(fieldName+"_first");

                // Setup the full name
                fullName.setLabel(dcInput.getLabel());
                fullName.setHelp(cleanHints(dcInput.getHints()));
                if (dcInput.isRequired())
                        fullName.setRequired();
                if (isFieldInError(fieldName))
                    if (dcInput.getWarning() != null && dcInput.getWarning().length() > 0) {
                        fullName.addError(dcInput.getWarning());
                    } else {
                        fullName.addError(T_required_field);
                    }
                if (dcInput.isRepeatable() && !readonly)
                        fullName.enableAddOperation();
                if ((dcInput.isRepeatable() || dcValues.length > 1&& !readonly)
                        fullName.enableDeleteOperation();
                String fieldKey = MetadataAuthorityManager.makeFieldKey(dcInput.getSchema(), dcInput.getElement(), dcInput.getQualifier());
                boolean isAuthorityControlled = MetadataAuthorityManager.getManager().isAuthorityControlled(fieldKey);
                if (isAuthorityControlled)
                {
                    fullName.setAuthorityControlled();
                    fullName.setAuthorityRequired(MetadataAuthorityManager.getManager().isAuthorityRequired(fieldKey));
                }
                if (ChoiceAuthorityManager.getManager().isChoicesConfigured(fieldKey))
                {
                    fullName.setChoices(fieldKey);
                    fullName.setChoicesPresentation(ChoiceAuthorityManager.getManager().getPresentation(fieldKey));
                    fullName.setChoicesClosed(ChoiceAuthorityManager.getManager().isClosed(fieldKey));
                }

                // Setup the first and last name
                lastName.setLabel(T_last_name_help);
                firstName.setLabel(T_first_name_help);
               
                if (readonly)
                {
                    lastName.setDisabled();
                    firstName.setDisabled();
                    fullName.setDisabled();
                }
               
                // Setup the field's values
                if (dcInput.isRepeatable() || dcValues.length > 1)
                {
                        for (DCValue dcValue : dcValues)
                        {
                                DCPersonName dpn = new DCPersonName(dcValue.value);
               
                                lastName.addInstance().setValue(dpn.getLastName());
                                firstName.addInstance().setValue(dpn.getFirstNames());
                                Instance fi = fullName.addInstance();
                                fi.setValue(dcValue.value);
                                if (isAuthorityControlled)
                                {
                                    if (dcValue.authority == null || dcValue.authority.equals(""))
                                        fi.setAuthorityValue("", "blank");
                                    else
                                        fi.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
                        }
                }
                }
                else if (dcValues.length == 1)
                {
                        DCPersonName dpn = new DCPersonName(dcValues[0].value);
               
                        lastName.setValue(dpn.getLastName());
                        firstName.setValue(dpn.getFirstNames());
                        if (isAuthorityControlled)
                        {
                            if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
                                lastName.setAuthorityValue("", "blank");
                            else
View Full Code Here

        {
                // The date field consists of three primitive fields: a text field
                // for the year, followed by a select box of the months, follewed
                // by a text box for the day.
                Composite fullDate = form.addItem().addComposite(fieldName, "submit-date");
                Text year = fullDate.addText(fieldName+"_year");
                Select month = fullDate.addSelect(fieldName+"_month");
                Text day = fullDate.addText(fieldName+"_day");

                // Set up the full field
                fullDate.setLabel(dcInput.getLabel());
                fullDate.setHelp(cleanHints(dcInput.getHints()));
                if (dcInput.isRequired())
                        fullDate.setRequired();
                if (isFieldInError(fieldName))
                    if (dcInput.getWarning() != null && dcInput.getWarning().length() > 0) {
                        fullDate.addError(dcInput.getWarning());
                    } else {
                        fullDate.addError(T_required_field);
                    }
                if (dcInput.isRepeatable() && !readonly)
                        fullDate.enableAddOperation();
                if ((dcInput.isRepeatable() || dcValues.length > 1) && !readonly)
                        fullDate.enableDeleteOperation();

                if (readonly)
                {
                    year.setDisabled();
                    month.setDisabled();
                    day.setDisabled();
                }
               
                // Setup the year field
                year.setLabel(T_year);
                year.setSize(4,4);

                // Setup the month field
                month.setLabel(T_month);
                month.addOption(0,"");
                for (int i = 1; i < 13; i++)
                {
                        month.addOption(i,org.dspace.content.DCDate.getMonthName(i,Locale.getDefault()));
                }

                // Setup the day field
                day.setLabel(T_day);
                day.setSize(2,2);
               
                // Setup the field's values
                if (dcInput.isRepeatable() || dcValues.length > 1)
                {
                        for (DCValue dcValue : dcValues)
                        {
                                DCDate dcDate = new DCDate(dcValue.value);

                                year.addInstance().setValue(String.valueOf(dcDate.getYear()));
                                month.addInstance().setOptionSelected(dcDate.getMonth());
                                day.addInstance().setValue(String.valueOf(dcDate.getDay()));
                                fullDate.addInstance().setValue(dcDate.toString());
                        }
                }
                else if (dcValues.length == 1)
                {
                        DCDate dcDate = new DCDate(dcValues[0].value);

                        year.setValue(String.valueOf(dcDate.getYear()));
                        month.setOptionSelected(dcDate.getMonth());
                       
                        // Check if the day field is not specified, if so then just
                        // put a blank value in instead of the wiered looking -1.
                        if (dcDate.getDay() == -1)
                                day.setValue("");
                        else
                                day.setValue(String.valueOf(dcDate.getDay()));
                }
        }
View Full Code Here

       // Email
       identity.addLabel(T_email_address);
       identity.addItem(email);
      
       // First name
       Text firstName = identity.addItem().addText("first_name");
       firstName.setRequired();
       firstName.setLabel(T_first_name);
       firstName.setValue(defaultFirstName);
       if (errors.contains("first_name"))
       {
           firstName.addError(T_error_required);
       }
       if (!registering && !ConfigurationManager.getBooleanProperty("xmlui.user.editmetadata", true))
           firstName.setDisabled();
      
       // Last name
       Text lastName = identity.addItem().addText("last_name");
       lastName.setRequired();
       lastName.setLabel(T_last_name);
       lastName.setValue(defaultLastName);
       if (errors.contains("last_name"))
       {
           lastName.addError(T_error_required);
       }
       if (!registering &&!ConfigurationManager.getBooleanProperty("xmlui.user.editmetadata", true))
           lastName.setDisabled();
      
       // Phone
       Text phone = identity.addItem().addText("phone");
       phone.setLabel(T_telephone);
       phone.setValue(defaultPhone);
       if (errors.contains("phone"))
       {
           phone.addError(T_error_required);
       }
       if (!registering && !ConfigurationManager.getBooleanProperty("xmlui.user.editmetadata", true))
           phone.setDisabled();
       
       // Language
       Select lang = identity.addItem().addSelect("language");
       lang.setLabel(T_language);
       if (supportedLocales.length > 0)
View Full Code Here

        private void renderSeriesField(List form, String fieldName, DCInput dcInput, DCValue[] dcValues, boolean readonly) throws WingException
        {
                // The seiries field consists of two parts, a series name (text field)
                // and report or paper number (also a text field).
                Composite fullSeries = form.addItem().addComposite(fieldName,"submit-"+dcInput.getInputType());
                Text series = fullSeries.addText(fieldName+"_series");
                Text number = fullSeries.addText(fieldName+"_number");

                // Setup the full field.
                fullSeries.setLabel(dcInput.getLabel());
                fullSeries.setHelp(cleanHints(dcInput.getHints()));
                if (dcInput.isRequired())
                        fullSeries.setRequired();
                if (isFieldInError(fieldName))
                    if (dcInput.getWarning() != null && dcInput.getWarning().length() > 0) {
                        fullSeries.addError(dcInput.getWarning());
                    } else {
                        fullSeries.addError(T_required_field);
                    }
                if (dcInput.isRepeatable() && !readonly)
                        fullSeries.enableAddOperation();
                if ((dcInput.isRepeatable() || dcValues.length > 1) && !readonly)
                        fullSeries.enableDeleteOperation();

                series.setLabel(T_series_name);
                number.setLabel(T_report_no);

                if (readonly)
                {
                    fullSeries.setDisabled();
                    series.setDisabled();
                    number.setDisabled();
                }
               
                // Setup the field's values
                if (dcInput.isRepeatable() || dcValues.length > 1)
                {
                        for (DCValue dcValue : dcValues)
                        {
                                DCSeriesNumber dcSeriesNumber = new DCSeriesNumber(dcValue.value);

                                series.addInstance().setValue(dcSeriesNumber.getSeries());
                                number.addInstance().setValue(dcSeriesNumber.getNumber());
                                fullSeries.addInstance().setValue(dcSeriesNumber.toString());
                        }
                       
                }
                else if (dcValues.length == 1)
                {
                        DCSeriesNumber dcSeriesNumber = new DCSeriesNumber(dcValues[0].value);

                        series.setValue(dcSeriesNumber.getSeries());
                        number.setValue(dcSeriesNumber.getNumber());
                }
        }
View Full Code Here

         */
        private void renderQualdropField(List form, String fieldName, DCInput dcInput, DCValue[] dcValues, boolean readonly) throws WingException
        {
                Composite qualdrop = form.addItem().addComposite(fieldName,"submit-qualdrop");
                Select qual = qualdrop.addSelect(fieldName+"_qualifier");
                Text value = qualdrop.addText(fieldName+"_value");

                // Setup the full field.
                qualdrop.setLabel(dcInput.getLabel());
                qualdrop.setHelp(cleanHints(dcInput.getHints()));
                if (dcInput.isRequired())
                        qualdrop.setRequired();
                if (isFieldInError(fieldName))
                    if (dcInput.getWarning() != null && dcInput.getWarning().length() > 0) {
                        qualdrop.addError(dcInput.getWarning());
                    } else {
                        qualdrop.addError(T_required_field);
                    }
                if (dcInput.isRepeatable() && !readonly)
                        qualdrop.enableAddOperation();
                // Update delete based upon the filtered values.
                if ((dcInput.isRepeatable() || dcValues.length > 1) && !readonly)
                        qualdrop.enableDeleteOperation();
               
                if (readonly)
                {
                    qualdrop.setDisabled();
                    qual.setDisabled();
                    value.setDisabled();
                }
               
                // Setup the possible options
                @SuppressWarnings("unchecked") // This cast is correct
                java.util.List<String> pairs = dcInput.getPairs();
                for (int i = 0; i < pairs.size(); i += 2)
                {
                        String display = pairs.get(i);
                        String returnValue = pairs.get(i+1);
                        qual.addOption(returnValue,display);
                }

                // Setup the field's values
                if (dcInput.isRepeatable() || dcValues.length > 1)
                {
                        for (DCValue dcValue : dcValues)
                        {
                                qual.addInstance().setOptionSelected(dcValue.qualifier);
                                value.addInstance().setValue(dcValue.value);
                                qualdrop.addInstance().setValue(dcValue.qualifier + ":" + dcValue.value);
                        }
                }
                else if (dcValues.length == 1)
                {
                        qual.setOptionSelected(dcValues[0].qualifier);
                        value.setValue(dcValues[0].value);
                }
        }
View Full Code Here

                // that the user may enter any value. The difference between
                // the two is that a onebox should be rendered in one column
                // as twobox should be listed in a two column format. Since this
                // decision is not something the Aspect can effect we merely place
                // as a render hint.
                Text text = form.addItem().addText(fieldName,"submit-text");

                // Setup the select field
                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));
                }
                if (ChoiceAuthorityManager.getManager().isChoicesConfigured(fieldKey))
                {
                    text.setChoices(fieldKey);
                    text.setChoicesPresentation(ChoiceAuthorityManager.getManager().getPresentation(fieldKey));
                    text.setChoicesClosed(ChoiceAuthorityManager.getManager().isClosed(fieldKey));
                }

                if (dcInput.isRequired())
                        text.setRequired();
                if (isFieldInError(fieldName))
                    if (dcInput.getWarning() != null && dcInput.getWarning().length() > 0) {
                        text.addError(dcInput.getWarning());
                    } else {
                        text.addError(T_required_field);
                    }
                if (dcInput.isRepeatable() && !readonly)
                        text.enableAddOperation();
                if ((dcInput.isRepeatable() || dcValues.length > 1) && !readonly)
                        text.enableDeleteOperation();

                if (readonly)
                {
                    text.setDisabled();
                }
               
                // Setup the field's values
                if (dcInput.isRepeatable() || dcValues.length > 1)
                {
                        for (DCValue dcValue : dcValues)
                        {
                                Instance ti = text.addInstance();
                                ti.setValue(dcValue.value);
                                if (isAuth)
                                {
                                    if (dcValue.authority == null || dcValue.authority.equals(""))
                                        ti.setAuthorityValue("", "blank");
                                    else
                                        ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
                        }
                }
                }
                else if (dcValues.length == 1)
                {
                        text.setValue(dcValues[0].value);
                        if (isAuth)
                        {
                            if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
                                text.setAuthorityValue("", "blank");
                            else
                                text.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
                }
        }
        }
View Full Code Here

    suited.addPara("Below are a list of embedded fields that are normally considered usefully in an inline context.");
   
    // Text field
    Para p = suited.addPara();
    p.addContent("This is a plain 'Text' field, ");
        Text text = p.addText("text");
        text.setLabel("Text");
        if (help)
          text.setHelp("This is helpfull text.");
        if (error)
          text.addError("This field is in error.");
        text.setValue("Current raw value");
        p.addContent(", embedded in a paragraph.");
       
        // Single Checkbox field
        p = suited.addPara();
    p.addContent("This is a singe 'CheckBox' field, ");
        CheckBox checkBox = p.addCheckBox("yes-or-no");
        if (help)
          checkBox.setHelp("Select either yes or no.");
        if (error)
          checkBox.addError("You are incorrect, try again.");
        checkBox.setLabel("Yes or no");
        checkBox.addOption("yes");
        p.addContent(", embedded in a paragraph.");
       
        // File
        p = suited.addPara();
    p.addContent("This is a 'File' field, ");
        File file = p.addFile("file");
        file.setLabel("File");
        if (help)
          file.setHelp("Upload a file.");
        if (error)
          file.addError("This field is in error.");
        p.addContent(", embedded in a paragraph.");
       
        // Select (single)
        p = suited.addPara();
    p.addContent("This is single 'Select' (aka dropdown) field, ");
        Select select = p.addSelect("select");
        select.setLabel("Select (single)");
        if (help)
          select.setHelp("Select one of the options");
        if (error)
          select.addError("This field is in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");
        p.addContent(", embedded in a paragraph.");
       
        // Button
        p = suited.addPara();
    p.addContent("This is a 'Button' field, ");
        Button button = p.addButton("button");
        button.setLabel("Button");
        button.setValue("When you touch me I do things, lots of things");
        if (help)
          button.setHelp("Submit buttons allow the user to submit the form.");
        if (error)
          button.addError("This button is in error.");
        p.addContent(", embedded in a paragraph.");
       
       
       
        Division unsuited = body.addDivision("unsuited");
        unsuited.setHead("Fields typicaly unsuited towards being used inline");
   
        unsuited.addPara("Below are a list of embedded fields that are normally considered useless in an inline context. This is because there widgets normally cross multiple lines making them hard to render inline. However these are all legal, but perhaps not advisable, and in some circumstances may be needed.");
   
       
        // Text Area Field
        p = unsuited.addPara();
    p.addContent("This is a 'Text Area' field, ");
        TextArea textArea = p.addTextArea("textarea");
        textArea.setLabel("Text Area");
        if (help)
          textArea.setHelp("This is helpfull text.");
        if (error)
          textArea.addError("This field is in error.");
        textArea.setValue("This is the raw value");
        p.addContent(", embedded in a paragraph.");
       
        // Multi-option Checkbox field
        p = unsuited.addPara();
    p.addContent("This is a multi-option 'CheckBox' field, ");
        checkBox = p.addCheckBox("fruit");
        if (help)
          checkBox.setHelp("Select all the fruits that you like to eat");
        if (error)
          checkBox.addError("You are incorrect you actualy do like Tootse Rolls.");
        checkBox.setLabel("fruits");
        checkBox.addOption("apple","Apples");
        checkBox.addOption(true,"orange","Oranges");
        checkBox.addOption("pear","Pears");
        checkBox.addOption("tootsie","Tootsie Roll");
        checkBox.addOption(true,"cherry","Cherry");
        p.addContent(", embedded in a paragraph.");
       
        // multi-option Radio field
        p = unsuited.addPara();
    p.addContent("This is a multi-option 'Radio' field, ");
        Radio radio = p.addRadio("sex");
        radio.setLabel("Football colors");        
        if (help)
          radio.setHelp("Select the colors of the best (college) football team.");
        if (error)
          radio.addError("Error, Maroon & White is the only acceptable answer.");
        radio.addOption("ut","Burnt Orange & White");
        radio.addOption(true,"tamu","Maroon & White");
        radio.addOption("ttu","Tech Red & Black");
        radio.addOption("baylor","Green & Gold");
        radio.addOption("rice","Blue & Gray");
        radio.addOption("uh","Scarlet Red & Albino White");
        p.addContent(", embedded in a paragraph.");

        // Select (multiple)
        p = unsuited.addPara();
    p.addContent("This is multiple 'Select' field, ");
        select = p.addSelect("multi-select");
        select.setLabel("Select (multiple)");
        select.setMultiple();
        select.setSize(4);
        if (help)
          select.setHelp("Select one or more options");
        if (error)
          select.addError("This field is in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");
        select.setOptionSelected("three");
        select.setOptionSelected("five");
        p.addContent(", embedded in a paragraph.");
       
        // Composite
        p = unsuited.addPara();
    p.addContent("This is a 'Composite' field of two text fields, ");
        Composite composite = p.addComposite("composite-2text");
        composite.setLabel("Composite (two text fields)");
        if (help)
          composite.setHelp("I am the help for the entire composite");
        if (error)
          composite.addError("Just the composite is in error");
        text = composite.addText("partA");
        text.setLabel("Part A");
        text.setValue("Value for part A");
        if (help)
          text.setHelp("Part A");
        text = composite.addText("partB");
        text.setLabel("Part B");
        text.setValue("Value for part B");
        if (help)
          text.setHelp("Part B");
        p.addContent(", embedded in a paragraph.");
       
       
       
    }
View Full Code Here

TOP

Related Classes of org.dspace.app.xmlui.wing.element.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.