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

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


        Row controlsRow = controlsTable.addRow(Row.ROLE_DATA);

        // Create a control for the number of records to display
        Cell rppCell = controlsRow.addCell();
        rppCell.addContent(T_rpp);
        Select rppSelect = rppCell.addSelect("rpp");
        for (int i : RESULTS_PER_PAGE_PROGRESSION)
        {
            rppSelect.addOption((i == getParameterRpp()), i, Integer.toString(i));
        }

        Cell sortCell = controlsRow.addCell();
        try
        {
            // Create a drop down of the different sort columns available
            sortCell.addContent(T_sort_by);
            Select sortSelect = sortCell.addSelect("sort_by");
            sortSelect.addOption(false, 0, T_sort_by_relevance);
            for (SortOption so : SortOption.getSortOptions())
            {
                if (so.isVisible())
                {
                    sortSelect.addOption((so.getNumber() == getParameterSortBy()), so.getNumber(),
                            message("xmlui.ArtifactBrowser.AbstractSearch.sort_by." + so.getName()));
                }
            }
        }
        catch (SortException se)
        {
            throw new WingException("Unable to get sort options", se);
        }

        // Create a control to changing ascending / descending order
        Cell orderCell = controlsRow.addCell();
        orderCell.addContent(T_order);
        Select orderSelect = orderCell.addSelect("order");
        orderSelect.addOption(SortOption.ASCENDING.equals(getParameterOrder()), SortOption.ASCENDING, T_order_asc);
        orderSelect.addOption(SortOption.DESCENDING.equals(getParameterOrder()), SortOption.DESCENDING, T_order_desc);

        // 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
        //if (isItemBrowse(info))
View Full Code Here


         *                      The field's pre-existing values.
         */
        private void renderDropdownField(List form, String fieldName, DCInput dcInput, DCValue[] dcValues, boolean readonly) throws WingException
        {
                // 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);
                }
               
                if (readonly)
                {
                    select.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 value   = pairs.get(i+1);
                        select.addOption(value,display);
                }
               
                // Setup the field's pre-selected values
                for (DCValue dcValue : dcValues)
                {
                        select.setOptionSelected(dcValue.value);
                }
        }
View Full Code Here

       }
       if (!registering && !ConfigurationManager.getBooleanProperty("xmlui.user.editmetadata", true))
           phone.setDisabled();
       
       // Language
       Select lang = identity.addItem().addSelect("language");
       lang.setLabel(T_language);
       if (supportedLocales.length > 0)
       {
           for (Locale lc : supportedLocales)
           {
               lang.addOption(lc.toString(), lc.getDisplayName());
           }
       }
       else
       {
           lang.addOption(I18nUtil.DEFAULTLOCALE.toString(), I18nUtil.DEFAULTLOCALE.getDisplayName());
       }
       lang.setOptionSelected((defaultLanguage == null || defaultLanguage.equals("")) ?
                              I18nUtil.DEFAULTLOCALE.toString() : defaultLanguage);
       if (!registering && !ConfigurationManager.getBooleanProperty("xmlui.user.editmetadata", true))
           lang.setDisabled();

       // Subscriptions
       if (!registering)
       {
           List subscribe = form.addList("subscriptions",List.TYPE_FORM);
           subscribe.setHead(T_subscriptions);
          
           subscribe.addItem(T_subscriptions_help);
          
           Collection[] currentList = Subscribe.getSubscriptions(context, context.getCurrentUser());
           Collection[] possibleList = Collection.findAll(context);
          
           Select subscriptions = subscribe.addItem().addSelect("subscriptions");
           subscriptions.setLabel(T_email_subscriptions);
           subscriptions.setHelp("");
           subscriptions.enableAddOperation();
           subscriptions.enableDeleteOperation();
          
           subscriptions.addOption(-1,T_select_collection);
           for (Collection possible : possibleList)
           {
                   String name = possible.getMetadata("name");
                   if (name.length() > 50)
                           name = name.substring(0, 47) + "...";
                   subscriptions.addOption(possible.getID(), name);
           }
                  
           for (Collection collection: currentList)
                   subscriptions.addInstance().setOptionSelected(collection.getID());
       }
      
      
       if (allowSetPassword)
       {
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 typicaly unsuited towards being used inline");
   
        unsuited.addPara("Below are a list of embedded fields that are normally considered useless in an inline context. This is because there widgets normally cross multiple lines making them hard to render inline. However these are all legal, but perhaps not advisable, and in some circumstances may be needed.");
   
       
        // Text Area Field
        p = unsuited.addPara();
    p.addContent("This is a 'Text Area' field, ");
        TextArea textArea = p.addTextArea("textarea");
        textArea.setLabel("Text Area");
        if (help)
          textArea.setHelp("This is helpfull text.");
        if (error)
          textArea.addError("This field is in error.");
        textArea.setValue("This is the raw value");
        p.addContent(", embedded in a paragraph.");
       
        // Multi-option Checkbox field
        p = unsuited.addPara();
    p.addContent("This is a multi-option 'CheckBox' field, ");
        checkBox = p.addCheckBox("fruit");
        if (help)
          checkBox.setHelp("Select all the fruits that you like to eat");
        if (error)
          checkBox.addError("You are incorrect you actualy do like Tootse Rolls.");
        checkBox.setLabel("fruits");
        checkBox.addOption("apple","Apples");
        checkBox.addOption(true,"orange","Oranges");
        checkBox.addOption("pear","Pears");
        checkBox.addOption("tootsie","Tootsie Roll");
        checkBox.addOption(true,"cherry","Cherry");
        p.addContent(", embedded in a paragraph.");
       
        // multi-option Radio field
        p = unsuited.addPara();
    p.addContent("This is a multi-option 'Radio' field, ");
        Radio radio = p.addRadio("sex");
        radio.setLabel("Football colors");        
        if (help)
          radio.setHelp("Select the colors of the best (college) football team.");
        if (error)
          radio.addError("Error, Maroon & White is the only acceptable answer.");
        radio.addOption("ut","Burnt Orange & White");
        radio.addOption(true,"tamu","Maroon & White");
        radio.addOption("ttu","Tech Red & Black");
        radio.addOption("baylor","Green & Gold");
        radio.addOption("rice","Blue & Gray");
        radio.addOption("uh","Scarlet Red & Albino White");
        p.addContent(", embedded in a paragraph.");

        // Select (multiple)
        p = unsuited.addPara();
    p.addContent("This is multiple 'Select' field, ");
        select = p.addSelect("multi-select");
        select.setLabel("Select (multiple)");
        select.setMultiple();
        select.setSize(4);
        if (help)
          select.setHelp("Select one or more options");
        if (error)
          select.addError("This field is in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");
        select.setOptionSelected("three");
        select.setOptionSelected("five");
        p.addContent(", embedded in a paragraph.");
       
        // Composite
        p = unsuited.addPara();
    p.addContent("This is a 'Composite' field of two text fields, ");
View Full Code Here

    if (SystemwideAlerts.getMessage() == null)
      message.setValue(T_alerts_message_default);
    else
      message.setValue(SystemwideAlerts.getMessage());
   
    Select countdown = form.addItem().addSelect("countdown");
    countdown.setLabel(T_alerts_countdown_label);
   
    countdown.addOption(0,T_alerts_countdown_none);
    countdown.addOption(5,T_alerts_countdown_5);
    countdown.addOption(15,T_alerts_countdown_15);
    countdown.addOption(30,T_alerts_countdown_30);
    countdown.addOption(60,T_alerts_countdown_60);
   
    // Is there a current count down active?
    if (SystemwideAlerts.isAlertActive() && SystemwideAlerts.getCountDownToo() - System.currentTimeMillis() > 0)
      countdown.addOption(true,-1,T_alerts_countdown_keep);
    else
      countdown.setOptionSelected(0);
   
    Select restrictsessions = form.addItem().addSelect("restrictsessions");
    restrictsessions.setLabel(T_alerts_session_label);
    restrictsessions.addOption(SystemwideAlerts.STATE_ALL_SESSIONS,T_alerts_session_all_sessions);
    restrictsessions.addOption(SystemwideAlerts.STATE_CURRENT_SESSIONS,T_alerts_session_current_sessions);
    restrictsessions.addOption(SystemwideAlerts.STATE_ONLY_ADMINISTRATIVE_SESSIONS,T_alerts_session_only_administrative);
    restrictsessions.setOptionSelected(SystemwideAlerts.getRestrictSessions());
   
    form.addItem(T_alerts_session_note);
   
   
    Item actions = form.addItem();
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);
    file.setHelp(T_file_help);
View Full Code Here

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

        {
            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;
                else if (i <= oneYearBreak)
                    i -= 5;
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)
                    {
                        if (so.isVisible())
                        {
                            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 : RESULTS_PER_PAGE_PROGRESSION)
        {
            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
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.