Exemplo n.º 1
0
    private void reset(final UploadComponentOptions options) {
      resetComponents(options);
      clear();

      final Set<String> types = components.keySet();
      currentType = types.iterator().next();

      parentCanvas = new Canvas();
      layout = new VLayout();
      final SelectItem typeItem = new SelectItem("uploadType", "Upload Type");
      typeItem.setValueMap(types.toArray(new String[types.size()]));
      typeItem.setValue(currentType);
      typeItem.setWidth(250);
      typeItem.addChangedHandler(
          new ChangedHandler() {
            public void onChanged(final ChangedEvent event) {
              currentType = typeItem.getValue().toString();
              update();
            }
          });
      final Form form =
          new Form(
              DomConstants.buildConstant(DomConstants.UPLOAD_COMPONENT_TYPE, uploadComponentNumber),
              typeItem);
      form.setPadding(0);
      form.setMargin(0);
      form.setCellSpacing(0);
      form.setCellPadding(0);

      form.setAlign(Alignment.RIGHT);
      form.setWidth(350);
      form.setHeight(20);
      final HLayout header = new HLayout();
      header.setAlign(Alignment.RIGHT);
      header.addMember(form);
      header.setHeight(20);

      layout.setAlign(Alignment.RIGHT);
      layout.addMember(header);
      layout.addMember(parentCanvas);
      layout.setGroupTitle("File Chooser");
      layout.setIsGroup(true);
      layout.setHeight("185px");
      layout.setPadding(2);
      layout.setLayoutAlign(Alignment.CENTER);
      layout.setAlign(Alignment.CENTER);

      for (final UploadComponent uploadComponent : components.values()) {
        final Canvas childCanvas = uploadComponent.get();
        childCanvas.hide();
        parentCanvas.addChild(childCanvas);
      }
      update();
      wrapperLayout.addMember(layout);
    }
Exemplo n.º 2
0
 private void update() {
   if (currentCanvas != null) {
     currentCanvas.hide();
   }
   currentComponent = components.get(currentType);
   currentCanvas = currentComponent.get();
   currentCanvas.show();
 }
Exemplo n.º 3
0
 public List<String> getNames() {
   return currentComponent.getNames();
 }
Exemplo n.º 4
0
 public boolean hasNames() {
   return currentComponent.hasNames();
 }
Exemplo n.º 5
0
 public boolean isZip() {
   return currentComponent.isZip();
 }
Exemplo n.º 6
0
 public void startUpload() {
   currentComponent.startUpload();
 }
Exemplo n.º 7
0
 public int getNumSelectedFiles() {
   return currentComponent.getNumSelectedFiles();
 }
Exemplo n.º 8
0
 public CanUpload canUpload() {
   return currentComponent.canUpload();
 }