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

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


       // Email
       identity.addLabel(T_email_address);
       identity.addItem(email);
      
       // First name
       Text firstName = identity.addItem().addText("first_name");
       firstName.setAutofocus("autofocus");
       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);
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.setAutofocus("autofocus");
    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

        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 helpful 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("This is helpful 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 helpful 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 helpful 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 helpful 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 actually do like Tootsie 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 already 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 interests = list.addList("interests",List.TYPE_FORM);
        interests.setHead("Interests");
       
        CheckBox interest = interests.addItem().addCheckBox("interests");
        interest.setLabel("Interests");
        if (help)
        {
            interest.setHelp("Select all topics which are of interest to you.");
        }
        if (error)
        {
            interest.addError("Your interests are in error?");
        }
        interest.addOption("DL","Digital Libraries");
        interest.addOption("HT","Hypertexts");
        interest.addOption("IM","Information Managment");
        interest.addOption("ID","Information Discovery");
        interest.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)
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.setAutofocus("autofocus");
    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

      
       forgot.addPara(T_para1);
      
       List form = forgot.addList("form",List.TYPE_FORM);
      
       Text email = form.addItem().addText("email");
       email.setRequired();
       email.setAutofocus("autofocus");
       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);
      
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.setAutofocus("autofocus");
        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

      
       register.addPara(T_para2);
      
       List form = register.addList("form",List.TYPE_FORM);
      
       Text email = form.addItem().addText("email");
       email.setRequired();
       email.setAutofocus("autofocus");
       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);
      
View Full Code Here

        // NOTE: the "spinner" indicator image gets added in the XSLT.

        // the text input(s)
        Item ti = fl.addItem("textFields", "choices-lookup");
        Composite textItem = ti.addComposite("textFieldsComp", "choices-lookup");
        Text t1 = textItem.addText("text1", "choices-lookup");
        if (isName)
        {
            Text t2 = textItem.addText("text2", "choices-lookup");
            DCPersonName dp = new DCPersonName(value);
            t1.setValue(dp.getLastName());
            t2.setValue(dp.getFirstNames());
            if (isFieldMessage(field, "help.last"))
            {
                Message m = getFieldMessage(field, "help.last");
                t1.setLabel(m);
                t1.setHelp(m);
            }
            else
            {
                String m = getFieldLabel(field, "help.last");
                t1.setLabel(m);
                t1.setHelp(m);
            }
            if (isFieldMessage(field, "help.first"))
            {
                Message m = getFieldMessage(field, "help.first");
                t2.setLabel(m);
                t2.setHelp(m);
            }
            else
            {
                String m = getFieldLabel(field, "help.first");
                t2.setLabel(m);
                t2.setHelp(m);
            }
        }
        else
        {
            t1.setValue(value);
View Full Code Here

       
        itemRequest.addPara(T_para1);
               
        List form = itemRequest.addList("form",List.TYPE_FORM);
       
        Text subj = form.addItem().addText("subject");
        subj.setLabel(T_subject);
        subj.setValue(subject);
        subj.setSize(60);
        TextArea message = form.addItem().addTextArea("message");
        message.setSize(20, 0);
        message.setLabel(T_message);
        message.setValue(parameters.getParameter("message",messageTemplate));
        form.addItem().addHidden("decision").setValue(parameters.getParameter("decision",""));
View Full Code Here

       
        itemRequest.addPara(T_para1);
               
        List form = itemRequest.addList("form",List.TYPE_FORM);
       
        Text name = form.addItem().addText("name");
        name.setLabel(T_name);
        name.setValue(parameters.getParameter("name",""));
       
        Text mail = form.addItem().addText("email");
        mail.setLabel(T_email);
        mail.setValue(parameters.getParameter("email",""));
       
        if(request.getParameter("openAccess")!=null){
      if(StringUtils.isEmpty(parameters.getParameter("name", ""))){
        name.addError(T_name_error);
      }
      if(StringUtils.isEmpty(parameters.getParameter("email", ""))){
        mail.addError(T_email_error);
      }
    }
       // mail.setValue(parameters.getParameter("mail",""));
        form.addItem().addHidden("isSent").setValue("true");
        form.addItem().addButton("openAccess").setValue(T_changeToOpen);
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.