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

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


        {
            Para jumpForm = jump.addPara();

            // Create a select list to choose a month
            jumpForm.addContent(T_jump_select);
            Select month = jumpForm.addSelect(BrowseParams.MONTH);
            month.addOption(false, "-1", T_choose_month);
            for (int i = 1; i <= 12; i++)
            {
                month.addOption(false, String.valueOf(i), DCDate.getMonthName(i, Locale
                        .getDefault()));
            }

            // Create a select list to choose a year
            Select year = jumpForm.addSelect(BrowseParams.YEAR);
            year.addOption(false, "-1", T_choose_year);
            int currentYear = DCDate.getCurrent().getYear();
            int i = currentYear;

            // Calculate where to move from 1, 5 to 10 year jumps
            int oneYearBreak = ((currentYear - ONE_YEAR_LIMIT) / 5) * 5;
            int fiveYearBreak = ((currentYear - FIVE_YEAR_LIMIT) / 10) * 10;
            int tenYearBreak = (currentYear - TEN_YEAR_LIMIT);
            do
            {
                year.addOption(false, String.valueOf(i), String.valueOf(i));

                if (i <= fiveYearBreak)
                {
                    i -= 10;
                }
View Full Code Here


                // Only generate the list if we have multiple columns
                if (sortOptions.size() > 1)
                {
                    controlsForm.addContent(T_sort_by);
                    Select sortSelect = controlsForm.addSelect(BrowseParams.SORT_BY);

                    for (SortOption so : sortOptions)
                    {
                        sortSelect.addOption(so.equals(info.getSortOption()), so.getNumber(),
                                message("xmlui.ArtifactBrowser.ConfigurableBrowse.sort_by." + so.getName()));
                    }
                }
            }
            catch (SortException se)
            {
                throw new WingException("Unable to get sort options", se);
            }
        }

        // Create a control to changing ascending / descending order
        controlsForm.addContent(T_order);
        Select orderSelect = controlsForm.addSelect(BrowseParams.ORDER);
        orderSelect.addOption("ASC".equals(params.scope.getOrder()), "ASC", T_order_asc);
        orderSelect.addOption("DESC".equals(params.scope.getOrder()), "DESC", T_order_desc);

        // Create a control for the number of records to display
        controlsForm.addContent(T_rpp);
        Select rppSelect = controlsForm.addSelect(BrowseParams.RESULTS_PER_PAGE);
        for (int i = 5; i <= 100; i += 5)
        {
            rppSelect.addOption((i == info.getResultsPerPage()), i, Integer.toString(i));
        }

        // Create a control for the number of authors per item to display
        // FIXME This is currently disabled, as the supporting functionality
        // is not currently present in xmlui
View Full Code Here

        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 typically 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 helpful 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 actually 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, ");
View Full Code Here

        // LIST: add new metadata
        List addForm = main.addList("addItemMetadata",List.TYPE_FORM);
        addForm.setHead(T_head1);

                Select addName = addForm.addItem().addSelect("field");
                addName.setLabel(T_name_label);
                MetadataField[] fields = MetadataField.findAll(context);
                for (MetadataField field : fields)
                {
                        int fieldID = field.getFieldID();
                        MetadataSchema schema = MetadataSchema.find(context, field.getSchemaID());
                        String name = schema.getName() +"."+field.getElement();
                        if (field.getQualifier() != null)
                        {
                            name += "." + field.getQualifier();
                        }

                        addName.addOption(fieldID, name);
                }
                if (previousFieldID != null)
                {
                    addName.setOptionSelected(previousFieldID);
                }


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

            // LIST: upload form
            List upload = div.addList("submit-upload-new", List.TYPE_FORM);
            upload.setHead(T_head1);

            int bundleCount = 0; // record how many bundles we are able to upload too.
            Select select = upload.addItem().addSelect("bundle");
            select.setLabel(T_bundle_label);

            // Get the list of bundles to allow the user to upload too. Either use the default
            // or one supplied from the dspace.cfg.
            String bundleString = ConfigurationManager.getProperty("xmlui.bundle.upload");
            if (bundleString == null || bundleString.length() == 0)
            {
                bundleString = DEFAULT_BUNDLE_LIST;
            }
            String[] parts = bundleString.split(",");
            for (String part : parts)
            {
                if (addBundleOption(item, select, part.trim()))
                {
                    bundleCount++;
                }
            }
            select.setOptionSelected("ORIGINAL");

            if (bundleCount == 0) {
                select.setDisabled();
            }


            File file = upload.addItem().addFile("file");
            file.setLabel(T_file_label);
View Full Code Here

          // noop
        }
        if (!FlowCurationUtils.groups.isEmpty())
        {
          curationTaskList.addLabel(T_taskgroup_label_name); //needs to check for >=1 group configured
            Select groupSelect = curationTaskList.addItem().addSelect("select_curate_group");
            groupSelect = FlowCurationUtils.getGroupSelectOptions(groupSelect);
            groupSelect.setSize(1);
            groupSelect.setRequired();
            groupSelect.setEvtBehavior("submitOnChange");
            if (curateGroup.equals(""))
            {
              curateGroup = (String) (FlowCurationUtils.groups.keySet().iterator().next());
            }
            groupSelect.setOptionSelected(curateGroup);
        }
        curationTaskList.addLabel(T_label_name);
        Select taskSelect = curationTaskList.addItem().addSelect("curate_task");
        taskSelect = FlowCurationUtils.getTaskSelectOptions(taskSelect, curateGroup);
        taskSelect.setSize(1);
        taskSelect.setRequired();
     

            // need submit_curate_task and submit_return
      Para buttonList = main.addPara();
            buttonList.addButton("submit_curate_task").setValue(T_submit_perform);
View Full Code Here

        addWorkflowItemInformation(div, item, request);

        Para scorePara = div.addPara();
        scorePara.addContent(T_score_help);
        Select scoreSelect = scorePara.addSelect("score");
        for(int i = 0; i <= 100; i+=10){
            scoreSelect.addOption(i, i + "%");
        }
        scorePara.addButton("submit_score").setValue(T_score_button);


        div.addPara().addButton("submit_leave").setValue(T_cancel_submit);
View Full Code Here

          // noop
        }
        if (!FlowCurationUtils.groups.isEmpty())
        {
          curationTaskList.addLabel(T_taskgroup_label_name); //needs to check for >=1 group configured
            Select groupSelect = curationTaskList.addItem().addSelect("select_curate_group");
            groupSelect = FlowCurationUtils.getGroupSelectOptions(groupSelect);
            groupSelect.setSize(1);
            groupSelect.setRequired();
            groupSelect.setEvtBehavior("submitOnChange");
            if (curateGroup.equals(""))
            {
              curateGroup = (String) (FlowCurationUtils.groups.keySet().iterator().next());
            }
            groupSelect.setOptionSelected(curateGroup);
        }
        curationTaskList.addLabel(T_label_name);
        Select taskSelect = curationTaskList.addItem().addSelect("curate_task");
        taskSelect = FlowCurationUtils.getTaskSelectOptions(taskSelect, curateGroup);
        taskSelect.setSize(1);
        taskSelect.setRequired();
       
        // need submit_curate_task and submit_return
      Para buttonList = main.addPara();
        buttonList.addButton("submit_curate_task").setValue(T_submit_perform);
        buttonList.addButton("submit_queue_task").setValue(T_submit_queue);
View Full Code Here

                {
                  // noop
                }
                if (!FlowCurationUtils.groups.isEmpty())
                {
                    Select groupSelect = form.addItem().addSelect("select_curate_group");
                    groupSelect = FlowCurationUtils.getGroupSelectOptions(groupSelect);
                    groupSelect.setLabel(T_taskgroup_label_name);
                    groupSelect.setSize(1);
                    groupSelect.setRequired();
                    groupSelect.setEvtBehavior("submitOnChange");
                    if (curateGroup.equals(""))
                    {
                      curateGroup = (String) (FlowCurationUtils.groups.keySet().iterator().next());
                    }
                    groupSelect.setOptionSelected(curateGroup);
                }
                Select taskSelect = form.addItem().addSelect("curate_task");
                taskSelect = FlowCurationUtils.getTaskSelectOptions(taskSelect, curateGroup);
                taskSelect.setLabel(T_task_label_name);
                taskSelect.setSize(1);
                taskSelect.setRequired();
                if(taskSelected!=null)
                {   
                    taskSelect.setOptionSelected(taskSelected);
                }
               
                // Buttons: 'curate' and 'queue'
                Para buttonList = div.addPara();
                buttonList.addButton("submit_curate_task").setValue(T_submit_perform);
View Full Code Here

        Division div = body.addInteractiveDivision("select-collection",actionURL,Division.METHOD_POST,"primary submission");
        div.setHead(T_submission_head);
       
        List list = div.addList("select-collection", List.TYPE_FORM);
        list.setHead(T_head);      
        Select select = list.addItem().addSelect("handle");
        select.setAutofocus("autofocus");
        select.setLabel(T_collection);
        select.setHelp(T_collection_help);
       
        select.addOption("",T_collection_default);
      CollectionDropDown.CollectionPathEntry[] collectionPaths = CollectionDropDown.annotateWithPaths(collections);
        for (CollectionDropDown.CollectionPathEntry entry : collectionPaths)
        {
            select.addOption(entry.collection.getHandle(), entry.path);
        }
       
        Button submit = list.addItem().addButton("submit");
        submit.setValue(T_submit_next);
    }
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.