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

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


    file.setRequired();

    if (bundleCount == 0)
      file.setDisabled();
   
    Text description = upload.addItem().addText("description");
    description.setLabel(T_description_label);
    description.setHelp(T_description_help);

    if (bundleCount == 0)
      description.setDisabled();
   
    if (bundleCount == 0)
      upload.addItem().addContent(T_no_bundles);
   
    // ITEM: actions
View Full Code Here


        List list = div.addList("fieldTest",List.TYPE_FORM);
        list.setHead("Fields");
       
        // Text field
        Text text = list.addItem().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");
       
        // Long help
        Text longHelp = list.addItem().addText("longHelp");
        longHelp.setLabel("Long Help");
        if (help)
          longHelp.setHelp("This is a really long help message. It could potentially be a paragraph of material, really really long. Actually we don't know how long it can be because there is no upper limit on it! Although if you do find your self adding a long help message consider whether your user will actually read any of this, my bet is that they won't. However we still need to support these really, really, really, long messages that may break across multiple lines!");
        if (error)
          longHelp.addError("This field is in error.");
        longHelp.setValue("Current raw value");
       
        // Long error
        Text longError = list.addItem().addText("longError");
        longError.setLabel("Long Error");
        if (help)
          longError.setHelp("TThis is helpfull text.");
        if (error)
          longError.addError("This field is very much is serious trouble, it's so horrible wrong that i now have to give you a very long stern message that may break across multiple lines! To fix this problem you should examine what you are attempting to do and consider other factors like what might have lead you to this path vs another path. Are you sure you even want this field or might another one work just as well?");
        longError.setValue("Current raw value");
       
        // Text Area Field
        TextArea textArea = list.addItem().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");
       
        // Blank Text Area Field
        TextArea emptyTextArea = list.addItem().addTextArea("emptyTextarea");
        emptyTextArea.setLabel("Empty Text Area");
        if (help)
          emptyTextArea.setHelp("This is helpfull text.");
        if (error)
          emptyTextArea.addError("This field is in error.");
       
       
        // Password field
        Password password = list.addItem().addPassword("password");
        password.setLabel("password");
        if (help)
          password.setHelp("This is helpfull text.");
        if (error)
          password.addError("This field is in error.");
       
        // Hidden field
        Hidden hidden = list.addItem().addHidden("hidden");
        hidden.setLabel("Hidden");
        hidden.setValue("You can not see this.");
        if (help)
          hidden.setHelp("This is hidden help?");
        if (error)
          hidden.addError("This a hidden error - I have no idea what this means?");
       
        // Checkbox field
        CheckBox checkBox = list.addItem().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");
       
        // Radio buttons
       
        Radio radio = list.addItem().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");
       
        // File
        File file = list.addItem().addFile("file");
        file.setLabel("File");
        if (help)
          file.setHelp("Upload a file.");
        if (error)
          file.addError("This field is in error.");
       
        // Select (single)
        Select select = list.addItem().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");

        select = list.addItem().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");
       
        // Non-Field-item
        list.addLabel("Non-Field");
        list.addItem().addContent("This is just text, not a field, but it has a list label.");
       
        // Button
        Button button = list.addItem().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.");
       
        // Non-field-unlabeled-item
        list.addItem().addContent("The following fields are all various use cases of composites. Also note that this item is an item inside a list of type form that 1) does not contain a field and 2) does not have a label.");
       
        // Composite
        Composite composite = list.addItem().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");
       
        // composite select & text fields 
        composite = list.addItem().addComposite("compositeB");
        composite.setLabel("Composite (select & text fields)");
        if (help)
          composite.setHelp("This field is composed of a select and text field, select one and type the other.");
 
        select = composite.addSelect("selectB");
        select.setLabel("Numbers");
        if (help)
          select.setHelp("Me, me, me..... select me!");
        if (error)
          select.addError("The composite components 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");
       
        text = composite.addText("TextB");
        text.setLabel("Spanish Numbers");
        if (help)
          text.setHelp("Yay, yet another text field");
        if (error)
          text.addError("The composite components are in error.");
       
       
        // Composite
        composite = list.addItem().addComposite("composite-date");
        composite.setLabel("Composite (date)");
        if (help)
          composite.setHelp("The data the item was published.");
        if (error)
          composite.addError("The date is in error.");
       
        text = composite.addText("year");
        text.setLabel("Year");
        text.setSize(4,4);
        if (help)
          text.setHelp("year");
        if (error)
          text.addError("The year is in error");
       
       
        select = composite.addSelect("month");
        select.setLabel("Month");
        if (error)
          select.addError("The month is in error");
        if (help)
          text.setHelp("month");
        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");
       
        text = composite.addText("day");
        text.setLabel("Day");
        if (help)
          text.setHelp("day");
        if (error)
          text.addError("The day is in error.");
        text.setSize(4,2);
       
        // 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");
       
       
       
       
        /////////////////////////////////////////////////
        /// Multi section
        ////////////////////////////////////////////////
       
        div.addPara("This next test will use form sections. Sections are logical groupings of related fields that together form the entire set.");
       
        list = div.addList("sectionTest",List.TYPE_FORM);
        list.setHead("Multi-Section form");
        List identity = list.addList("identity",List.TYPE_FORM);
        identity.setHead("Identity");
       
        Text name = identity.addItem().addText("name");
        name.setLabel("Username");
        if (help)
          name.setHelp("The username you wish to chooose");
        if (error)
          name.addError("Sorry, that username is allready used by another user.");
       
        Composite ssn = identity.addItem().addComposite("ssn");
        ssn.setLabel("SSN");
        if (help)
          ssn.setHelp("Your Social Security Number, really we won't use it for anything bad.... you can trust me.");
        if (error)
          ssn.addError("The SSN you entered is invalid.");
        Text ssn1 = ssn.addText("ssn1");
        ssn1.setSize(4,4);
        Text ssn2 = ssn.addText("ssn2");
        ssn2.setSize(2,2);
        Text ssn3 = ssn.addText("ssn3");
        ssn3.setSize(4,4);
       
        List intrests = list.addList("intrests",List.TYPE_FORM);
        intrests.setHead("Intrests");
       
        CheckBox intrest = intrests.addItem().addCheckBox("intrests");
        intrest.setLabel("Intrests");
        if (help)
          intrest.setHelp("Select all topics which are of intrests to you.");
        if (error)
          intrest.addError("You're intrests are in error?");
        intrest.addOption("DL","Digital Libraries");
        intrest.addOption("HT","Hypertexts");
        intrest.addOption("IM","Information Managment");
        intrest.addOption("ID","Information Discovery");
        intrest.addOption("SI","Social Impact");
       
        List affiliation = list.addList("affiliation",List.TYPE_FORM);
        affiliation.setHead("Affiliation");
       
        Text institution = affiliation.addItem().addText("institution");
        institution.setLabel("Institution");
        if (help)
          name.setHelp("The institution you are affiliated with");
        if (error)
          name.addError("That institution is an invalid option.");
       
View Full Code Here

      // The grand list of metadata options
      List metadataList = main.addList("metadataList", "form");
     
      // community name
      metadataList.addLabel(T_label_name);
      Text name = metadataList.addItem().addText("name");
      name.setSize(40);
     
      // short description
      metadataList.addLabel(T_label_short_description);
      Text short_description = metadataList.addItem().addText("short_description");
      short_description.setSize(40);
     
      // introductory text
      metadataList.addLabel(T_label_introductory_text);
      TextArea introductory_text = metadataList.addItem().addTextArea("introductory_text");
      introductory_text.setSize(6, 40);
View Full Code Here

        + "/ldap-login", Division.METHOD_POST, "primary");
    login.setHead(T_head1);

    List list = login.addList("ldap-login", List.TYPE_FORM);

    Text email = list.addItem().addText("username");
    email.setRequired();
    email.setLabel(T_userName);
    if (previousUserName != null) {
      email.setValue(previousUserName);
      email.addError(T_error_bad_login);
    }

    Item item = list.addItem();
    Password password = item.addPassword("ldap_password");
    password.setRequired();
View Full Code Here

      
       forgot.addPara(T_para1);
      
       List form = forgot.addList("form",List.TYPE_FORM);
      
       Text email = form.addItem().addText("email");
       email.setRequired();
       email.setLabel(T_email_address);
       email.setHelp(T_email_address_help);
      
       // Prefill with invalid email if this is a retry attempt.
       if (email != null)
           email.setValue(this.email);
       if (errors.contains("email"))
           email.addError(T_error_not_found);
      
       Item submit = form.addItem();
       submit.addButton("submit").setValue(T_submit);
      
       forgot.addHidden("eperson-continue").setValue(knot.getId());
View Full Code Here

    Division findItem = body.addInteractiveDivision("find-item",contextPath + "/admin/item", Division.METHOD_GET,"primary administrative item");
    findItem.setHead(T_head1);
   
    List form = findItem.addList("find-item-form", List.TYPE_FORM);
   
    Text id = form.addItem().addText("identifier");
    id.setLabel(T_identifier_label);
    if (identifier != null)
      id.setValue(identifier);
    if (errors.contains("identifier"))
      id.addError(T_identifier_error);
   
    form.addItem().addButton("submit_find").setValue(T_find);
   
    findItem.addHidden("administrative-continue").setValue(knot.getId());
  }
View Full Code Here

      // The grand list of metadata options
      List metadataList = main.addList("metadataList", "form");
     
      // community name
      metadataList.addLabel(T_label_name);
      Text name = metadataList.addItem().addText("name");
      name.setSize(40);
      name.setValue(thisCommunity.getMetadata("name"));
     
      // short description
      metadataList.addLabel(T_label_short_description);
      Text short_description = metadataList.addItem().addText("short_description");
      short_description.setValue(thisCommunity.getMetadata("short_description"));
      short_description.setSize(40);
      if (short_description_error != null)
        short_description.addError(short_description_error);
     
      // introductory text
      metadataList.addLabel(T_label_introductory_text);
      TextArea introductory_text = metadataList.addItem().addTextArea("introductory_text");
      introductory_text.setValue(thisCommunity.getMetadata("introductory_text"));
View Full Code Here


                Composite addComposite = addForm.addItem().addComposite("value");
                addComposite.setLabel(T_value_label);
                TextArea addValue = addComposite.addTextArea("value");
                Text addLang = addComposite.addText("language");

                addValue.setSize(4, 35);
                addLang.setLabel(T_lang_label);
                addLang.setSize(6);

                addForm.addItem().addButton("submit_add").setValue(T_submit_add);

               
               

                // PARA: Disclaimer
                main.addPara(T_para1);

               
                Para actions = main.addPara(null,"edit-metadata-actions top" );
                actions.addButton("submit_update").setValue(T_submit_update);
                actions.addButton("submit_return").setValue(T_submit_return);
               
               

                // TABLE: Metadata
                main.addHidden("scope").setValue("*");
                int index = 1;
                Table table = main.addTable("editItemMetadata",1,1);
                table.setHead(T_head2);

                Row header = table.addRow(Row.ROLE_HEADER);
                header.addCell().addContent(T_column1);
                header.addCell().addContent(T_column2);
                header.addCell().addContent(T_column3);
                header.addCell().addContent(T_column4);

                ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
                for(DCValue value : values)
                {
                        String name = value.schema + "_" + value.element;
                        if (value.qualifier != null)
                                name += "_" + value.qualifier;

                        Row row = table.addRow(name,Row.ROLE_DATA,"metadata-value");

                        CheckBox remove = row.addCell().addCheckBox("remove_"+index);
                        remove.setLabel("remove");
                        remove.addOption(index);

                        Cell cell = row.addCell();
                        cell.addContent(name.replaceAll("_", ". "));
                        cell.addHidden("name_"+index).setValue(name);

                        // value entry cell:
                        Cell mdCell = row.addCell();
                        String fieldKey = MetadataAuthorityManager.makeFieldKey(value.schema, value.element, value.qualifier);

                        // put up just a selector when preferred choice presentation is select:
                        if (cmgr.isChoicesConfigured(fieldKey) &&
                            Params.PRESENTATION_SELECT.equals(cmgr.getPresentation(fieldKey)))
                        {
                            Select mdSelect = mdCell.addSelect("value_"+index);
                            mdSelect.setSize(1);
                            Choices cs = cmgr.getMatches(fieldKey, value.value, collectionID, 0, 0, null);
                            if (cs.defaultSelected < 0)
                                mdSelect.addOption(true, value.value, value.value);
                            for (int i = 0; i < cs.values.length; ++i)
                            {
                                mdSelect.addOption(i == cs.defaultSelected, cs.values[i].value, cs.values[i].label);
                            }
                        }
                        else
                        {
                            TextArea mdValue = mdCell.addTextArea("value_"+index);
                        mdValue.setSize(4,35);
                        mdValue.setValue(value.value);
                            boolean isAuth = MetadataAuthorityManager.getManager().isAuthorityControlled(fieldKey);
                            if (isAuth)
                            {
                                mdValue.setAuthorityControlled();
                                mdValue.setAuthorityRequired(MetadataAuthorityManager.getManager().isAuthorityRequired(fieldKey));
                                Value authValue =  mdValue.setAuthorityValue((value.authority == null)?"":value.authority, Choices.getConfidenceText(value.confidence));
                                // add the "unlock" button to auth field
                                Button unlock = authValue.addButton("authority_unlock_"+index,"ds-authority-lock");
                                unlock.setHelp(T_unlock);
                            }
                            if (ChoiceAuthorityManager.getManager().isChoicesConfigured(fieldKey))
                            {
                                mdValue.setChoices(fieldKey);
                                mdValue.setChoicesPresentation(Params.PRESENTATION_LOOKUP);
                                mdValue.setChoicesClosed(ChoiceAuthorityManager.getManager().isClosed(fieldKey));
                            }
                        }
                        Text mdLang = row.addCell().addText("language_"+index);
                        mdLang.setSize(6);
                        mdLang.setValue(value.language);

                        // Tick the index counter;
                        index++;
                }

View Full Code Here

                + "/password-login", Division.METHOD_POST, "primary");
        login.setHead(T_head1);
       
        List list = login.addList("password-login",List.TYPE_FORM);

        Text email = list.addItem().addText("login_email");
        email.setRequired();
        email.setLabel(T_email_address);
        if (previousEmail != null)
        {
            email.setValue(previousEmail);
            email.addError(T_error_bad_login);
        }
       

        Item item = list.addItem();
        Password password = item.addPassword("login_password");
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 helpful 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 helpful 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 helpful 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 helpful 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

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.