private void InitState() {
    // title
    String sSubTitle = utils.GetResStr(R.string.titleDefaultAppointment);

    // date values
    dateStart = Calendar.getInstance();
    dateEndOn = Calendar.getInstance();

    dataRow.SetDuration(prefs.iMinutesDuration);

    // INSERT MODE
    if (GetStartMode() == StartMode.NEW) {
      sSubTitle = utils.GetResStr(R.string.titleNewAppointment);
      btnDelete.setVisibility(View.INVISIBLE);

      // initialize data
      SetStartDateByAgendaView(dateStart);
      updateStartDateTimeForNewAppointment(dateStart);
      SetStartTimeForDayAgendaView(dateStart);

      chkAllDay.setChecked(false);
      chkAlarm.setChecked(true);

      // repeat data
      iRepeatType = 0; // none
      iRepeatEvery = 1;
      dateEndOn.setTimeInMillis(0); // no end date
    }

    // EDIT MODE
    if (GetStartMode() == StartMode.EDIT) {
      sSubTitle = utils.GetResStr(R.string.titleEditAppointment);

      dateStart.setTimeInMillis(dataRow.GetStartDate().getTimeInMillis());

      btnDelete.setVisibility(View.VISIBLE);
      edSubject.setText(dataRow.GetSubject());
      chkAllDay.setChecked(dataRow.GetAllDay());
      chkAlarm.setChecked(dataRow.GetAlarm());

      // repeat data
      iRepeatType = dataRow.GetRepeat().GetRepeatTypeAsInt();
      iRepeatEvery = dataRow.GetRepeat().GetEvery();
      dateEndOn.setTimeInMillis(dataRow.GetRepeat().GetEndOnDate().getTimeInMillis());
    }

    restoreStateFromFreezeIfRequired();

    SetActivityTitle(sSubTitle);
    UpdateStartDateTimeView();

    UpdateRepeatInfo();

    // set focus to subject
    edSubject.requestFocus();
    if (GetStartMode() == StartMode.EDIT) edSubject.setSelection(edSubject.length());
  }
 @Override
 protected void restoreStateFromFreeze() {
   edSubject.setText(freeze.getString("subject"));
   chkAlarm.setChecked(freeze.getBoolean("alarm"));
   dateStart.setTimeInMillis(freeze.getLong("dateStart"));
   chkAllDay.setChecked(freeze.getBoolean("allday"));
   iRepeatType = freeze.getInt("repeatType");
   iRepeatEvery = freeze.getInt("repeatEvery");
   dateEndOn.setTimeInMillis(freeze.getLong("dateEndOn"));
 }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   // save controls state
   outState.putString("subject", edSubject.getText().toString());
   outState.putBoolean("alarm", chkAlarm.isChecked());
   outState.putLong("dateStart", dateStart.getTimeInMillis());
   outState.putBoolean("allday", chkAllDay.isChecked());
   outState.putInt("repeatType", iRepeatType);
   outState.putInt("repeatEvery", iRepeatEvery);
   outState.putLong("dateEndOn", dateEndOn.getTimeInMillis());
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    Bundle extras = CommonActivity.getIntentExtras(data);
    if (extras != null) {

      // check for repeat update
      if (ActivityAppointmentRepeat.GetActivityResult(requestCode, resultCode, extras)) {
        iRepeatType = ActivityAppointmentRepeat.getExtraRepeatType(extras);
        iRepeatEvery = ActivityAppointmentRepeat.getExtraRepeatEvery(extras);
        dateEndOn.setTimeInMillis(ActivityAppointmentRepeat.getExtraRepeatEndOnDate(extras));
        UpdateRepeatInfo();
        return;
      }

      // check for date widget edit request code
      if (requestCode == DateWidget.SELECT_DATE_REQUEST) {
        final long lDate =
            DateWidget.GetSelectedDateOnActivityResult(requestCode, resultCode, extras, dateStart);
        if (lDate != -1) {
          UpdateStartDateTimeView();
          return;
        }
      }

      // check for time widget edit request code
      if ((requestCode == TimeWidget.SELECT_TIME_REQUEST) && (resultCode == RESULT_OK)) {
        final int iHour =
            TimeWidget.GetSelectedTimeHourOnActivityResult(requestCode, resultCode, extras);
        final int iMinute =
            TimeWidget.GetSelectedTimeMinuteOnActivityResult(requestCode, resultCode, extras);
        dateStart.set(Calendar.HOUR_OF_DAY, iHour);
        dateStart.set(Calendar.MINUTE, iMinute);
        chkAllDay.setChecked(false);
        UpdateStartDateTimeView();
        return;
      }

      // get KeyboardWidget result
      if ((requestCode == KeyboardWidget.EDIT_TEXT_REQUEST) && (resultCode == RESULT_OK)) {
        String sText = KeyboardWidget.GetTextOnActivityResult(requestCode, resultCode, extras);
        edSubject.setText(sText);
        return;
      }
    }
  }
 @Override
 void updateCheckboxState(CheckBox checkBox, boolean graphObjectSelected) {
   checkBox.setChecked(graphObjectSelected);
   int visible =
       (graphObjectSelected || selectionStrategy.shouldShowCheckBoxIfUnselected())
           ? View.VISIBLE
           : View.GONE;
   checkBox.setVisibility(visible);
 }
Пример #6
0
 @UiHandler("loadButton")
 public void onLoadClicked(SelectEvent event) {
   archiveHandler.onLoad(
       deviceCombo.getValue(),
       getCombineDate(fromDate, fromTime),
       getCombineDate(toDate, toTime),
       !disableFilter.getValue(),
       snapToRoads.getValue(),
       new ArchiveStyle(style));
 }
Пример #7
0
    @Override
    public View getView(int position, View convertView, final ViewGroup parent) {
      final Item item = getItem(position);

      final View view;
      if (convertView != null && item.getClass().equals(convertView.getTag())) {
        view = convertView;
      } else {
        view =
            getLayoutInflater()
                .inflate(
                    item instanceof SectionItem
                        ? R.layout.catalog_manager_section_head
                        : R.layout.catalog_manager_item,
                    null);
        view.setTag(item.getClass());
      }

      if (item instanceof SectionItem) {
        ((TextView) view.findViewById(R.id.catalog_manager_section_head_title))
            .setText(((SectionItem) item).Title);
      } else /* if (item instanceof CatalogItem) */ {
        final CatalogItem catalogItem = (CatalogItem) item;

        if (myCoverManager == null) {
          view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          final int coverHeight = view.getMeasuredHeight();
          myCoverManager =
              new CoverManager(CatalogManagerActivity.this, coverHeight * 15 / 22, coverHeight);
          view.requestLayout();
        }

        final INetworkLink link = catalogItem.Tree.getLink();
        ((TextView) view.findViewById(R.id.catalog_manager_item_title)).setText(link.getTitle());
        ((TextView) view.findViewById(R.id.catalog_manager_item_subtitle))
            .setText(link.getSummary());

        final ImageView coverView = (ImageView) view.findViewById(R.id.catalog_manager_item_icon);
        if (!myCoverManager.trySetCoverImage(coverView, catalogItem.Tree)) {
          coverView.setImageResource(R.drawable.ic_list_library_books);
        }

        final CheckBox checkBox = (CheckBox) view.findViewById(R.id.catalog_manager_item_checkbox);
        checkBox.setChecked(catalogItem.IsChecked);
        checkBox.setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {
                catalogItem.IsChecked = checkBox.isChecked();
                setResultIds(catalogItem, 0);
              }
            });
      }
      return view;
    }
Пример #8
0
        @Override
        public void handle(ActionEvent event) {
          if (event.getSource() instanceof CheckBox) {
            for (Entry<String, CheckBox> entry : propertiesCb.entrySet()) {
              CheckBox cb = entry.getValue();
              String propertyName = entry.getKey();

              if (cb.isSelected()) {
                propertiesTf.get(propertyName).setDisable(false);
              } else {
                propertiesTf.get(propertyName).setDisable(true);
              }
            }
          }
        }
  public void SaveData() {
    // check date if no repeat
    if ((iRepeatType == 0) && (DateBeforeNow(dateStart))) return;

    dataRow.SetSubject(edSubject.getText().toString());
    dataRow.SetStartDate(dateStart);
    dataRow.SetAllDay(chkAllDay.isChecked());
    dataRow.SetAlarm(chkAlarm.isChecked());

    // set repeat type
    RepeatData rd = dataRow.GetRepeat();
    rd.SetRepeatTypeAsInt(iRepeatType);
    rd.SetEvery(iRepeatEvery);
    rd.SetEndOnDate(dateEndOn.getTimeInMillis());

    if (SaveDataToTable(dataTable)) CloseActivity(dataTable);
  }
 private void UpdateStartDateTimeView() {
   btnStartDate.setText(AnCalDateUtils.formatMediumDate(this, dateStart));
   if (chkAllDay.isChecked()) {
     btnStartTime.setText(utils.GetResStr(R.string.labNoTime));
   } else {
     btnStartTime.setText(AnCalDateUtils.formatTime(this, dateStart));
   }
 }
Пример #11
0
  public void newFile() {
    infoTa.setText("");
    selectProviderCb.setValue(providers.get(0).getName());
    weightTf.setText("0.0");

    for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
      String propertyName = entry.getKey();
      TextField tf = entry.getValue();
      CheckBox cb = propertiesCb.get(propertyName);

      tf.setText("0.0");
      tf.setDisable(true);
      cb.setSelected(false);
    }

    file = null;
    mainStage.setTitle("unknown");
  }
Пример #12
0
  public void open(File f) {
    Properties open = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream(f);
      open.load(input);

      selectProviderCb.setValue(open.getProperty("provider"));
      selectGrainCb.setValue(open.getProperty("grain"));
      weightTf.setText(open.getProperty("weight"));
      infoTa.setText(open.getProperty("info"));

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        String propertyName = entry.getKey();
        TextField tf = entry.getValue();
        CheckBox cb = propertiesCb.get(propertyName);

        tf.setText(open.getProperty(propertyName));
        if (open.getProperty(propertyName + "_ENABLED").equals("ON")) {
          tf.setDisable(false);
          cb.setSelected(true);
        } else {
          tf.setDisable(true);
          cb.setSelected(false);
        }
      }

      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу открыть файл");
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
  public void setFddObjectModel(FddObjectModel fddObjectModel) {
    logger.entry();
    if (fddObjectModel != null) {
      fddObjectModel
          .getInteractionClasses()
          .values()
          .stream()
          .forEach(
              (value) -> {
                interactions.add(new InteractionState(value));
              });
      InteractionTableView.setItems(interactions);
      interactions.forEach(
          (interaction) -> {
            interaction
                .onProperty()
                .addListener(
                    (observable, oldValue, newValue) -> {
                      if (!newValue) {
                        cb.setSelected(false);
                      } else if (interactions.stream().allMatch(a -> a.isOn())) {
                        cb.setSelected(true);
                      }
                    });
          });
      InteractionTableColumn.setCellValueFactory(new PropertyValueFactory<>("interactionName"));
      CheckTableColumn.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<InteractionState, Boolean>, ObservableValue<Boolean>>() {
            @Override
            public ObservableValue<Boolean> call(
                TableColumn.CellDataFeatures<InteractionState, Boolean> param) {
              return param.getValue().onProperty();
            }
          });

      CheckTableColumn.setCellFactory(CheckBoxTableCell.forTableColumn(CheckTableColumn));
      cb.setUserData(CheckTableColumn);
      cb.setOnAction(
          (ActionEvent event) -> {
            CheckBox cb1 = (CheckBox) event.getSource();
            TableColumn tc = (TableColumn) cb1.getUserData();
            InteractionTableView.getItems()
                .stream()
                .forEach(
                    (item) -> {
                      item.setOn(cb1.isSelected());
                    });
          });
      CheckTableColumn.setGraphic(cb);
    }
    logger.exit();
  }
Пример #14
0
  public void GUISetup() {
    // set up GUI
    String[] outputs = MidiBus.availableOutputs();
    String[] inputs = MidiBus.availableInputs();

    controlP5 = new ControlP5(this);
    programlabel = controlP5.addTextlabel("programlabel", "Programs", 350, 65);
    Radio programs = controlP5.addRadio("programs", 350, 80);
    programs.deactivateAll();
    programs.add("on", 1);
    programs.add("off", 2);
    programs.add("oscillate", 0);
    programs.add("fade", 4);
    programs.add("random", 3);

    midioutlabel = controlP5.addTextlabel("midioutlabel", "MIDI Outputs", 200, 65);
    Radio midioutdevices = controlP5.addRadio("midioutdevices", 200, 80);
    midioutdevices.deactivateAll();
    for (int i = 0; i < (outputs.length - 1); i++) {
      midioutdevices.add(outputs[i], i);
    }

    midiinlabel = controlP5.addTextlabel("midiinlabel", "MIDI Inputs", 100, 65);
    Radio midiindevices = controlP5.addRadio("midiindevices", 100, 80);
    midiindevices.deactivateAll();
    for (int i = 0; i < (inputs.length - 1); i++) {
      midiindevices.add(inputs[i], i);
    }

    options = controlP5.addTextlabel("options", "Options", 10, 65);
    optionsbox = controlP5.addCheckBox("optionsbox", 10, 80);
    optionsbox.setItemsPerRow(3);
    optionsbox.setSpacingColumn(30);
    optionsbox.setSpacingRow(10);
    optionsbox.addItem("notes -> cc", 0);

    heading = controlP5.addTextlabel("heading", "grmnygrmny.lightarray", 200, 20);
  }
Пример #15
0
  @UiHandler("gpxButton")
  public void onGPXClicked(SelectionEvent<Item> event) {
    if (deviceCombo.getValue() == null) {
      new AlertMessageBox(i18n.error(), i18n.errFillFields()).show();
    } else {
      DateTimeFormat jsonTimeFormat =
          ApplicationContext.getInstance().getFormatterUtil().getRequestTimeFormat();

      Window.open(
          "/traccar/export/gpx"
              + "?deviceId="
              + (deviceCombo.getValue() == null ? null : deviceCombo.getValue().getId())
              + "&from="
              + jsonTimeFormat.format(getCombineDate(fromDate, fromTime)).replaceFirst("\\+", "%2B")
              + "&to="
              + jsonTimeFormat.format(getCombineDate(toDate, toTime)).replaceFirst("\\+", "%2B")
              + "&filter="
              + !disableFilter.getValue()
              + "&snapToRoads="
              + snapToRoads.getValue(),
          "_blank",
          null);
    }
  }
  private void InitViews() {
    edSubject = (TouchEdit) findViewById(R.id.edAppointmentSubject);
    edSubject.setOnOpenKeyboard(
        new TouchEdit.OnOpenKeyboard() {
          public void OnOpenKeyboardEvent() {
            KeyboardWidget.Open(ActivityAppointment.this, edSubject.getText().toString());
          }
        });

    btnStartDate = (Button) findViewById(R.id.btnAppointmentStartDate);
    btnStartTime = (Button) findViewById(R.id.btnAppointmentStartTime);
    chkAllDay = (CheckBox) findViewById(R.id.chkAppointmentAllDay);
    chkAlarm = (CheckBox) findViewById(R.id.chkAppointmentAlarm);

    btnRepeatSelect = (Button) findViewById(R.id.btnRepeatSelect);
    btnRepeatSelect.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            OpenRepeatDialog();
          }
        });

    btnSave = (ImageButton) findViewById(R.id.btnAppointmentSave);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            SaveData();
          }
        });

    btnDelete = (ImageButton) findViewById(R.id.btnAppointmentDelete);
    btnDelete.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            DeleteData();
          }
        });

    btnStartDate.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            DateWidget.Open(ActivityAppointment.this, false, dateStart, prefs.iFirstDayOfWeek);
          }
        });

    btnStartTime.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            TimeWidget.Open(
                ActivityAppointment.this,
                false,
                prefs.b24HourMode,
                dateStart.get(Calendar.HOUR_OF_DAY),
                dateStart.get(Calendar.MINUTE));
          }
        });

    chkAllDay.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            UpdateStartDateTimeView();
          }
        });
  }
  public void showOrder(Order order) {
    currentOrder = order;
    valueList = currentOrder.getOrderValues();
    editFields = new ArrayList<EditText>();

    if (mainLayout != null) {

      Button saveButton = (Button) getActivity().findViewById(R.id.saveButton);
      saveButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              saveOrder(currentOrder);
              fragmentListener.saveOrderButtonClicked();
            }
          });

      CheckBox execStateCheckBox = (CheckBox) getActivity().findViewById(R.id.execStateCheckBox);
      execStateCheckBox.setChecked(currentOrder.getExecState());
      execStateCheckBox.setOnCheckedChangeListener(
          new CheckBox.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              currentOrder.setExecState(isChecked);
              valueList.put("execState", isChecked);
            }
          });

      EditText clientNameEdit = (EditText) mainLayout.findViewById(R.id.clientNameEdit);
      clientNameEdit.setOnKeyListener(onTextChanged);
      clientNameEdit.setOnFocusChangeListener(onFocusLost);
      clientNameEdit.setText(currentOrder.getClientName());
      clientNameEdit.setTag("clientName");
      editFields.add(clientNameEdit);

      EditText clientPhoneEdit = (EditText) mainLayout.findViewById(R.id.clientPhoneEdit);
      clientPhoneEdit.setOnKeyListener(onTextChanged);
      clientPhoneEdit.setOnFocusChangeListener(onFocusLost);
      clientPhoneEdit.setText(currentOrder.getClientPhone());
      clientPhoneEdit.setTag("clientPhone");
      editFields.add(clientPhoneEdit);

      EditText carMakerEdit = (EditText) mainLayout.findViewById(R.id.carMakerEdit);
      carMakerEdit.setOnKeyListener(onTextChanged);
      carMakerEdit.setOnFocusChangeListener(onFocusLost);
      carMakerEdit.setText(currentOrder.getCarMaker());
      carMakerEdit.setTag("carMaker");
      editFields.add(carMakerEdit);

      EditText colorCodeEdit = (EditText) mainLayout.findViewById(R.id.colorCodeEdit);
      colorCodeEdit.setOnKeyListener(onTextChanged);
      colorCodeEdit.setOnFocusChangeListener(onFocusLost);
      colorCodeEdit.setText(currentOrder.getColorCode());
      colorCodeEdit.setTag("colorCode");
      editFields.add(colorCodeEdit);

      EditText volumeBaseEdit = (EditText) mainLayout.findViewById(R.id.volumeBaseEdit);
      volumeBaseEdit.setOnKeyListener(onTextChanged);
      volumeBaseEdit.setOnFocusChangeListener(onFocusLost);
      volumeBaseEdit.setFilters(new InputFilter[] {new RealNumberInputFilter()});
      volumeBaseEdit.setText(currentOrder.getVolumeBase().toString());
      volumeBaseEdit.setTag("volumeBase");
      editFields.add(volumeBaseEdit);

      EditText volumeAdditionEdit = (EditText) mainLayout.findViewById(R.id.volumeAdditionEdit);
      volumeAdditionEdit.setOnKeyListener(onTextChanged);
      volumeAdditionEdit.setOnFocusChangeListener(onFocusLost);
      volumeAdditionEdit.setFilters(new InputFilter[] {new RealNumberInputFilter()});
      volumeAdditionEdit.setText(currentOrder.getVolumeAddition().toString());
      volumeAdditionEdit.setTag("volumeAddition");
      editFields.add(volumeAdditionEdit);

      EditText orderDateEdit = (EditText) mainLayout.findViewById(R.id.orderDateEdit);
      orderDateEdit.setOnKeyListener(onTextChanged);
      orderDateEdit.setOnFocusChangeListener(onFocusLost);
      orderDateEdit.setFilters(new InputFilter[] {new DateInputFilter()});
      orderDateEdit.setText(currentOrder.getOrderDate().toString());
      orderDateEdit.setTag("orderDate");
      editFields.add(orderDateEdit);

      EditText execDateEdit = (EditText) mainLayout.findViewById(R.id.execDateEdit);
      execDateEdit.setOnKeyListener(onTextChanged);
      execDateEdit.setOnFocusChangeListener(onFocusLost);
      execDateEdit.setFilters(new InputFilter[] {new DateInputFilter()});
      execDateEdit.setText(currentOrder.getExecDate().toString());
      execDateEdit.setTag("execDate");
      editFields.add(execDateEdit);

      NumberKeyListener realKeyListener =
          new NumberKeyListener() {
            @Override
            protected char[] getAcceptedChars() {
              return new char[] {'.', ',', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
            }

            @Override
            public int getInputType() {
              return TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_DECIMAL;
            }
          };
      volumeBaseEdit.setKeyListener(realKeyListener);
      volumeAdditionEdit.setKeyListener(realKeyListener);
    }
  }
Пример #18
0
  public void addBody(Body body)
      throws SAXException, WingException, UIException, SQLException, IOException,
          AuthorizeException {
    // If we are actually editing information of an uploaded file,
    // then display that body instead!
    if (this.editFile != null) {
      editFile.addBody(body);
      return;
    }

    // Get a list of all files in the original bundle
    Item item = submission.getItem();
    Collection collection = submission.getCollection();
    String actionURL =
        contextPath + "/handle/" + collection.getHandle() + "/submit/" + knot.getId() + ".continue";
    boolean disableFileEditing =
        (submissionInfo.isInWorkflow())
            && !ConfigurationManager.getBooleanProperty("workflow", "reviewer.file-edit");
    Bundle[] bundles = item.getBundles("ORIGINAL");
    Bitstream[] bitstreams = new Bitstream[0];
    if (bundles.length > 0) {
      bitstreams = bundles[0].getBitstreams();
    }

    // Part A:
    //  First ask the user if they would like to upload a new file (may be the first one)
    Division div =
        body.addInteractiveDivision(
            "submit-upload", actionURL, Division.METHOD_MULTIPART, "primary submission");
    div.setHead(T_submission_head);
    addSubmissionProgressList(div);

    List upload = null;
    if (!disableFileEditing) {
      // Only add the upload capabilities for new item submissions
      upload = div.addList("submit-upload-new", List.TYPE_FORM);
      upload.setHead(T_head);
      addRioxxVersionSection(upload, item);

      File file = upload.addItem().addFile("file");
      file.setLabel(T_file);
      file.setHelp(T_file_help);
      file.setRequired();

      // if no files found error was thrown by processing class, display it!
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_NO_FILES_ERROR) {
        file.addError(T_file_error);
      }

      // if an upload error was thrown by processing class, display it!
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_UPLOAD_ERROR) {
        file.addError(T_upload_error);
      }

      // if virus checking was attempted and failed in error then let the user know
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) {
        file.addError(T_virus_checker_error);
      }

      // if virus checking was attempted and a virus found then let the user know
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_CONTAINS_VIRUS) {
        file.addError(T_virus_error);
      }

      Text description = upload.addItem().addText("description");
      description.setLabel(T_description);
      description.setHelp(T_description_help);

      Button uploadSubmit = upload.addItem().addButton("submit_upload");
      uploadSubmit.setValue(T_submit_upload);
    }

    make_sherpaRomeo_submission(item, div);

    // Part B:
    //  If the user has already uploaded files provide a list for the user.
    if (bitstreams.length > 0 || disableFileEditing) {
      Table summary = div.addTable("submit-upload-summary", (bitstreams.length * 2) + 2, 7);
      summary.setHead(T_head2);

      Row header = summary.addRow(Row.ROLE_HEADER);
      header.addCellContent(T_column0); // primary bitstream
      header.addCellContent(T_column1); // select checkbox
      header.addCellContent(T_column2); // file name
      header.addCellContent(T_column3); // size
      header.addCellContent(T_column4); // description
      header.addCellContent(T_column5); // format
      header.addCellContent(T_column6); // edit button

      for (Bitstream bitstream : bitstreams) {
        int id = bitstream.getID();
        String name = bitstream.getName();
        String url = makeBitstreamLink(item, bitstream);
        long bytes = bitstream.getSize();
        String desc = bitstream.getDescription();
        String algorithm = bitstream.getChecksumAlgorithm();
        String checksum = bitstream.getChecksum();

        Row row = summary.addRow();

        // Add radio-button to select this as the primary bitstream
        Radio primary = row.addCell().addRadio("primary_bitstream_id");
        primary.addOption(String.valueOf(id));

        // If this bitstream is already marked as the primary bitstream
        // mark it as such.
        if (bundles[0].getPrimaryBitstreamID() == id) {
          primary.setOptionSelected(String.valueOf(id));
        }

        if (!disableFileEditing) {
          // Workflow users can not remove files.
          CheckBox remove = row.addCell().addCheckBox("remove");
          remove.setLabel("remove");
          remove.addOption(id);
        } else {
          row.addCell();
        }

        row.addCell().addXref(url, name);
        row.addCellContent(bytes + " bytes");
        if (desc == null || desc.length() == 0) {
          row.addCellContent(T_unknown_name);
        } else {
          row.addCellContent(desc);
        }

        BitstreamFormat format = bitstream.getFormat();
        if (format == null) {
          row.addCellContent(T_unknown_format);
        } else {
          int support = format.getSupportLevel();
          Cell cell = row.addCell();
          cell.addContent(format.getMIMEType());
          cell.addContent(" ");
          switch (support) {
            case 1:
              cell.addContent(T_supported);
              break;
            case 2:
              cell.addContent(T_known);
              break;
            case 3:
              cell.addContent(T_unsupported);
              break;
          }
        }

        Button edit = row.addCell().addButton("submit_edit_" + id);
        edit.setValue(T_submit_edit);

        Row checksumRow = summary.addRow();
        checksumRow.addCell();
        Cell checksumCell = checksumRow.addCell(null, null, 0, 6, null);
        checksumCell.addHighlight("bold").addContent(T_checksum);
        checksumCell.addContent(" ");
        checksumCell.addContent(algorithm + ":" + checksum);
      }

      if (!disableFileEditing) {
        // Workflow users can not remove files.
        Row actionRow = summary.addRow();
        actionRow.addCell();
        Button removeSeleceted =
            actionRow.addCell(null, null, 0, 6, null).addButton("submit_remove_selected");
        removeSeleceted.setValue(T_submit_remove);
      }

      upload = div.addList("submit-upload-new-part2", List.TYPE_FORM);
    }

    // Part C:
    // add standard control/paging buttons
    addControlButtons(upload);
  }