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

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


        List fl = idiv.addList("choicesList", "form", "choices-lookup");
        fl.setHead(T_results);

        // the <select> tag, and param values
        Item selectItem = fl.addItem("select", "choices-lookup");
        Select s = selectItem.addSelect("chooser", "choices-lookup");
        s.setSize(ConfigurationManager.getIntProperty("xmlui.lookup.select.size", 12));

        // parameters for javascript
        Hidden h = selectItem.addHidden("paramField");
        h.setValue(field);
        h = selectItem.addHidden("paramValue");
View Full Code Here


      }

      Row row = table.addRow();
      Cell cell = row.addCell(1,3);
      cell.addContent(T_para2);
      Select toSchema = cell.addSelect("to_schema");
      for (MetadataSchema schema : schemas)
      {
        toSchema.addOption(schema.getSchemaID(), schema.getNamespace());
      }
     
      Para buttons = moved.addPara();
      buttons.addButton("submit_move").setValue(T_submit_move);
      buttons.addButton("submit_cancel").setValue(T_submit_cancel);
View Full Code Here

    List actionsList = main.addList("actions","form");
       
    // For all of the selected groups...
    actionsList.addItem().addContent(T_actions_groupSentence);
        actionsList.addLabel(T_actions_policyGroup);
        Select groupSelect = actionsList.addItem().addSelect("group_id");
        groupSelect.setMultiple(true);
        groupSelect.setSize(15);
        for (Group group : Group.findAll(context, Group.NAME))
           groupSelect.addOption(false, group.getID(), group.getName());
       
        // Grant the ability to perform the following action...
        actionsList.addItem().addContent(T_actions_actionSentence);
        actionsList.addLabel(T_actions_policyAction);
        Select actionSelect = actionsList.addItem().addSelect("action_id");
        for( int i = 0; i < Constants.actionText.length; i++ )
            actionSelect.addOption(i, Constants.actionText[i]);
       
        // For all following object types...
        actionsList.addItem().addContent(T_actions_resourceSentence);
        actionsList.addLabel(T_actions_policyResource);
        Select resourceSelect = actionsList.addItem().addSelect("resource_id");
        resourceSelect.addOption(true, Constants.ITEM, "item");
        resourceSelect.addOption(false, Constants.BITSTREAM, "bitstream");
       
        // Across the following collections...
        actionsList.addItem().addContent(T_actions_collectionSentence);
        actionsList.addLabel(T_actions_policyCollections);
        Select collectionsSelect = actionsList.addItem().addSelect("collection_id");
        collectionsSelect.setMultiple(true);
        collectionsSelect.setSize(15);
        for (Collection collection : Collection.findAll(context))
          collectionsSelect.addOption(false, collection.getID(), collection.getMetadata("name"));
       
       
      Para buttons = main.addPara();
      buttons.addButton("submit_add").setValue(T_submit_add);
      buttons.addButton("submit_remove_all").setValue(T_submit_remove_all);
View Full Code Here

            filterComp.setLabel(T_FILTER_HEAD);
            filterComp.setHelp(T_FILTER_HELP);

//            filterComp.setLabel("");

            Select select = filterComp.addSelect("filtertype");
            //First of all add a default filter
            select.addOption("*", message("xmlui.ArtifactBrowser.SimpleSearch.filter.all"));
            //For each field found (at least one) add options

            while (field != null) {
                select.addOption(field, message("xmlui.ArtifactBrowser.SimpleSearch.filter." + field));

                field = SearchUtils.getConfig().getString("solr.search.filter.type." + ++i, null);
            }

            //Add a box so we can search for our value
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("");
View Full Code Here

         *                      The field's pre-existing values.
         */
        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

                String fieldKey = MetadataAuthorityManager.makeFieldKey(dcInput.getSchema(), dcInput.getElement(), dcInput.getQualifier());
                if (MetadataAuthorityManager.getManager().isAuthorityControlled(fieldKey))
                    throw new WingException("Field "+fieldKey+" has choice presentation of type \""+Params.PRESENTATION_SELECT+"\", it may NOT be authority-controlled.");

                // Plain old select list.
                Select select = form.addItem().addSelect(fieldName,"submit-select");

                //Setup the select field
                select.setLabel(dcInput.getLabel());
                select.setHelp(cleanHints(dcInput.getHints()));
                if (dcInput.isRequired())
                        select.setRequired();
                if (isFieldInError(fieldName))
                    if (dcInput.getWarning() != null && dcInput.getWarning().length() > 0) {
                        select.addError(dcInput.getWarning());
                    } else {
                        select.addError(T_required_field);
                    }
                if (dcInput.isRepeatable() || dcValues.length > 1)
                {
                        // Use the multiple functionality from the HTML
                        // widget instead of DRI's version.
                        select.setMultiple();
                        select.setSize(6);
                }
                else
                        select.setSize(1);

                if (readonly)
                {
                    select.setDisabled();
                }

                Choices cs = ChoiceAuthorityManager.getManager().getMatches(fieldKey, "", coll.getID(), 0, 0, null);
                if (dcValues.length == 0)
                    select.addOption(true, "", "");
                for (Choice c : cs.values)
                {
                    select.addOption(c.value, c.label);
                }

                // Setup the field's pre-selected values
                for (DCValue dcValue : dcValues)
                {
                        select.setOptionSelected(dcValue.value);
                }
        }
View Full Code Here

    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");
View Full Code Here

    edit.addLabel(T_file_label);
    edit.addItem().addXref(fileUrl, fileName);

   
    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
View Full Code Here

        main.setHead(T_head1.parameterize(item.getHandle()));

        Collection[] collections = Collection.findAuthorized(context, null, Constants.ADD);

        List list = main.addList("select-collection", List.TYPE_FORM);
        Select select = list.addItem().addSelect("collectionID");
        select.setLabel(T_collection);
        select.setHelp(T_collection_help);
       
        Collection owningCollection = item.getOwningCollection();
        if (owningCollection == null) {
            select.addOption("",T_collection_default);
        }
       
        for (Collection collection : collections)
        {
            String name = collection.getMetadata("name");
            if (name.length() > 50)
                name = name.substring(0, 47) + "...";
            select.addOption(collection.equals(owningCollection), collection.getID(), name);
        }
       
        org.dspace.app.xmlui.wing.element.Item actions = list.addItem();
        actions.addButton("submit_move").setValue(T_submit_move);
    actions.addButton("submit_cancel").setValue(T_submit_cancel);
View Full Code Here

TOP

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

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.