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

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


        Text bitstreamName = edit.addItem().addText("bitstreamName");
        bitstreamName.setLabel(T_filename_label);
        bitstreamName.setHelp(T_filename_help);
        bitstreamName.setValue(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());

        // EMBARGO FIELD
        // if AdvancedAccessPolicy=false: add Embargo Fields.
        if(!isAdvancedFormEnabled){
            AccessStepUtil asu = new AccessStepUtil(context);
            // if the item is embargoed default value will be displayed.
            asu.addEmbargoDateSimpleForm(bitstream, edit, -1);
            asu.addReason(null, edit, -1);
        }

    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


        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 countdown 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

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

        Collection[] collections = Collection.findAuthorizedOptimized(context, 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) + "...";
            }

            // Only add the item if it isn't already the owner
            if (!item.isOwningCollection(collection))
            {
                select.addOption(collection.equals(owningCollection), collection.getID(), CollectionDropDown.collectionPath(collection));
            }
        }
       
        org.dspace.app.xmlui.wing.element.Item actions = list.addItem();
        CheckBox inheritPolicies = actions.addCheckBox("inheritPolicies");
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 (Metadatum 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 weird looking -1.
                        if (dcDate.getDay() == -1)
                        {
View Full Code Here

         *                      The field's pre-existing values.
         */
        private void renderQualdropField(List form, String fieldName, DCInput dcInput, Metadatum[] 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 (Metadatum 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

                {
                    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 (Metadatum dcValue : dcValues)
                {
                        select.setOptionSelected(dcValue.value);
                }
        }
View Full Code Here

         *                      The field's pre-existing values.
         */
        private void renderDropdownField(List form, String fieldName, DCInput dcInput, Metadatum[] 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 (Metadatum dcValue : dcValues)
                {
                        select.setOptionSelected(dcValue.value);
                }
        }
View Full Code Here

          edit.addLabel(T_format_detected);
          edit.addItem(guessedFormat.getShortDescription());
        }
       
        // System supported formats
        Select format = edit.addItem().addSelect("format");
        format.setLabel(T_format_selected);
       
        format.addOption(-1,T_format_default);
        for (BitstreamFormat bitstreamFormat : bitstreamFormats)
        {
          String supportLevel = "Unknown";
          if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
            {
                supportLevel = "known";
            }
          else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
            {
                supportLevel = "Supported";
            }
          String name = bitstreamFormat.getShortDescription()+" ("+supportLevel+")";
          int id = bitstreamFormat.getID();
      
          format.addOption(id,name);
        }
        if (currentFormat != null)
        {
          format.setOptionSelected(currentFormat.getID());
        }
        else if (guessedFormat != null)
        {
          format.setOptionSelected(guessedFormat.getID());
        }
        else
        {
          format.setOptionSelected(-1);
        }
       
        edit.addItem(T_info2);
       
        // User supplied format
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

      String selectedLicense = request.getParameter("licenseclass_chooser");
      List list = div.addList("licenseclasslist", List.TYPE_FORM);
      list.addItem(T_info1);
      list.setHead(T_head);
      list.addItem().addHidden("button_required");
      Select selectList = list.addItem().addSelect("licenseclass_chooser");
      selectList.setLabel(T_license);
      selectList.setEvtBehavior("submitOnChange");
      Iterator<CCLicense> iterator = cclookup.getLicenses(ccLocale).iterator();
      // build select List - first choice always 'choose a license', last always 'No license'
      selectList.addOption(T_select_change.getKey(), T_select_change);
      while (iterator.hasNext()) {
          CCLicense cclicense = iterator.next();
          selectList.addOption(cclicense.getLicenseId(), cclicense.getLicenseName());
            if (selectedLicense != null && selectedLicense.equals(cclicense.getLicenseId()))
          {
              selectList.setOptionSelected(cclicense.getLicenseId());
          }
      }
      selectList.addOption(T_no_license.getKey(), T_no_license);
      if (selectedLicense  !=  null) {
        // output the license fields chooser for the license class type
        if (cclookup.getLicenseFields(selectedLicense, ccLocale) == null ) {
          // do nothing
        }
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.