예제 #1
0
 private static Layout getParentCanvas(final UploadComponentOptions options) {
   final Layout canvas = new Layout();
   canvas.setWidth100();
   canvas.setHeight100();
   return canvas;
 }
예제 #2
0
    HtmlUploadComponentImpl(final UploadComponentOptions options, final boolean zip) {
      this.zip = zip;
      if (zip) {
        types = "*.zip";
        typesDescription = "Zip";
      } else {
        types = options.getTypes() == null ? null : options.getTypes();
        typesDescription =
            options.getTypesDescription() == null ? null : options.getTypesDescription();
      }
      this.options = options;
      if (isMultiple()) {
        formPanel.setHeight("125px");
        scrollPanel.setHeight("125px");
        formPanel.setWidth("320px");
        scrollPanel.setWidth("320px");
      } else {
        formPanel.setHeight("30px");
        scrollPanel.setHeight("30px");
        formPanel.setWidth("310px");
        scrollPanel.setWidth("310px");
      }

      panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

      formPanel.setWidget(scrollPanel);
      formPanel.setAction(GWT.getHostPageBaseURL() + "fileupload?zip=" + zip);
      formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
      formPanel.setMethod(FormPanel.METHOD_POST);
      formPanel.addSubmitHandler(
          new SubmitHandler() {
            public void onSubmit(final SubmitEvent submitEvent) {}
          });
      formPanel.addSubmitCompleteHandler(
          new SubmitCompleteHandler() {
            public void onSubmitComplete(final SubmitCompleteEvent completeEvent) {
              System.out.println("Submit complete " + completeEvent.getResults());
              final String result = completeEvent.getResults();
              try {
                final List<FileSource> fileSources = toFileSources(result);
                options.getCompletionCallback().onSuccess(fileSources);
              } catch (final Exception e) {
                options.getCompletionCallback().onFailure(e);
              }
            }
          });
      final Layout parent = getParentCanvas(options);
      // final String parentPreix;
      // if(isZip) {
      //  parentPrefix = DomConstants.UPLOAD_PANEL_ZIP;
      // } else {
      //  parentPrefix = DomConstants.UPLOAD_PANEL_PLAIN;
      // }

      parent.setWidth100();
      if (debug) {
        parent.setBorder("1px solid pink");
      }
      parent.setAlign(VerticalAlignment.CENTER);
      parent.setLayoutAlign(VerticalAlignment.CENTER);
      final Layout wrapperLayout = new VLayout();
      // wrapperLayout.setHeight100();
      wrapperLayout.setWidth100();
      if (isMultiple()) {
        wrapperLayout.setHeight("140px");
      } else {
        wrapperLayout.setHeight("30px");
      }
      if (debug) {
        wrapperLayout.setBorder("1px solid blue");
      }
      wrapperLayout.setAlign(VerticalAlignment.CENTER);
      wrapperLayout.setLayoutAlign(VerticalAlignment.CENTER);
      /*
       * wrapperLayout.setGroupTitle(isMultiple() ? "File(s)" : (zip ? "Zip File" : "File"));
       * wrapperLayout.setIsGroup(true);
       * wrapperLayout.setPadding(15);
       * wrapperLayout.setLayoutAlign(Alignment.CENTER);
       * wrapperLayout.setAlign(Alignment.CENTER);
       */
      if (isMultiple()) {
        final Label addLabel =
            SmartUtils.smartParagraph(
                "<span style=\"color:blue;cursor:pointer; text-decoration: underline;\">Add Upload</span>");
        addLabel.addClickHandler(
            new ClickHandler() {
              public void onClick(final ClickEvent clickEvent) {
                addFileUploadWidget();
              }
            });
        wrapperLayout.addMember(addLabel);
      }
      wrapperLayout.addMember(formPanel);
      parent.addMember(wrapperLayout);
      // parent.setLayoutAlign(Alignment.CENTER);
      // parent.setAlign(Alignment.CENTER);
      addFileUploadWidget();
      setWidget(parent);
      parent.addDrawHandler(
          new DrawHandler() {

            public void onDraw(DrawEvent event) {
              if (zip) {
                parent.getDOM().addClassName(DomConstants.UPLOAD_PANEL_ZIP);
              } else {
                parent.getDOM().addClassName(DomConstants.UPLOAD_PANEL_PLAIN);
              }
            }
          });
    }
예제 #3
0
  public void generateLegend() {

    // TODO cleanup/extract method(s)

    setWidth("365px"); // TODO make configurable (Legend width)
    // setWidth("27%");
    setHeight100();
    setMargin(2);
    setMinWidth(220);
    // setOverflow(Overflow.CLIP_H);

    this.topButtons = new HLayout();
    this.topButtons.setTabIndex(-1);
    this.topButtons.setHeight(1);
    this.topButtons.setAlign(Alignment.RIGHT);
    this.topButtons.setReverseOrder(true);

    ImageButton us =
        new ImageButton("us_lang", "../img/icons/gb.png", i18n.usLang(), i18n.usLangExtended());
    View.getView().registerTooltip(us);
    ImageButton de =
        new ImageButton("de_lang", "../img/icons/de.png", i18n.deLang(), i18n.deLangExtended());
    View.getView().registerTooltip(de);
    ImageButton ttips =
        new ImageButton("ttips", "../img/icons/comment.png", i18n.ttips(), i18n.ttipsExtended());
    View.getView().registerTooltip(ttips);
    ImageButton help =
        new ImageButton("help", "../img/icons/help.png", i18n.help(), i18n.helpExtended());
    View.getView().registerTooltip(help);
    ImageButton logger =
        new ImageButton("logger", "../img/icons/report.png", i18n.logger(), i18n.loggerExtended());
    View.getView().registerTooltip(logger);

    ImageButton impressum =
        new ImageButton(
            "impressum", "../img/icons/information.png", i18n.Impressum(), i18n.Impressum());

    Label imprint = new Label(i18n.Impressum());
    imprint.setTooltip(i18n.Impressum());
    imprint.setStyleName("label");
    imprint.setWidth(60);

    View.getView().registerTooltip(impressum);
    View.getView().switchDetailedTooltips();

    imprint.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            new Impressum().show();
          }
        });

    help.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            String helpUrl = GWT.getHostPageBaseURL() + i18n.helpPath();
            Window.open(helpUrl, "", "");
          }
        });

    // this.topButtons.addMember(us);
    // this.topButtons.addMember(de);
    // this.topButtons.addMember(ttips);
    // this.topButtons.addMember(help);
    // this.topButtons.addMember(logger);
    // this.topButtons.addMember(imprint);

    addMember(this.topButtons);

    // Button addTS = new Button(I18N.sosClient.addNewTimeseries());
    // addTS.setIcon("../img/icons/chart_curve_add_new.png");

    // ImageButton addTS = new ImageButton("addTSLegend",
    // "../img/icons/chart_curve_add_new.png",
    // I18N.sosClient.picker(),
    // I18N.sosClient.pickerExtended());
    // View.getInstance().registerTooltip(addTS);

    // addTS.addClickHandler(new ClickHandler() {
    // public void onClick(ClickEvent evt) {
    // StationSelector.getInst().show();
    // }
    // });

    // addTS.setPadding(2);
    // addTS.setSize("32px", "32px");
    // addTS.setAlign(Alignment.CENTER);

    // Label addTSLabel = new Label(I18N.sosClient.addNewTimeseries());
    // addTSLabel.setHeight(20);
    // addTSLabel.setWidth100();
    // addTSLabel.setPadding(8);
    // addTSLabel.setStyleName("legendAddBoxLabel");
    // addTSLabel.setCursor(Cursor.HAND);
    // addTSLabel.setAlign(Alignment.CENTER);

    // HLayout add = new HLayout();
    // add.setStyleName("legendAddBox");
    // add.setAutoHeight();
    // add.addMember(addTS);
    // add.addMember(addTSLabel);
    // add.addClickHandler(new ClickHandler() {
    // public void onClick(ClickEvent event) {
    // StationSelector.getInst().show();
    // }
    // });

    // zip-export CSV
    // this.exportZipCSV =
    // new ImageButton("diagExportZipCSV", "../img/icons/folder_csv.png", i18nManager.i18nSOSClient
    // .exportZipCSV(), i18nManager.i18nSOSClient.exportZipCSVExtended());

    // View.getInstance().registerTooltip(this.exportZipCSV);

    // zip-export XLS
    // this.exportPDFallInOne =
    // new ImageButton("diagExportPDFallIneOne", "../img/icons/page_white_acrobat_add.png",
    // i18nManager.i18nSOSClient.exportPDFallInOne(),
    // i18nManager.i18nSOSClient.exportPDFallInOneExtended());
    // View.getInstance().registerTooltip(this.exportPDFallInOne);

    Button exportZipCSV = new Button(i18n.csv());
    exportZipCSV.setIcon("../img/icons/table.png");
    exportZipCSV.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            controller.exportTo(ExportType.CSV_ZIP);
          }
        });

    Button exportPDFallInOne = new Button(i18n.pdf());
    exportPDFallInOne.setStyleName("input");
    exportPDFallInOne.setIcon("../img/icons/page_white_acrobat_add.png");
    exportPDFallInOne.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            controller.exportTo(ExportType.PDF_ALL_IN_ONE);
          }
        });

    createExportLoadingSpinner();

    HStack menuStack = new HStack();
    // menuStack.setAlign(Alignment.CENTER);
    menuStack.setHeight100();
    Label space = new Label();
    Label addTS = createAddTimeSeriesLabelButton();
    exportButton = createExportLabelButton();
    sesTabButton = createSESTabLabelButton();
    space.setWidth("1%");
    exportButton.setWidth("20%");
    exportLoadingSpinner.setTop(5);
    exportLoadingSpinner.setWidth("2%");
    menuStack.addMember(addTS);
    menuStack.addMember(space);
    if (ClientUtils.isSesEnabled()) {
      addTS.setWidth("38%");
      sesTabButton.setWidth("35%");
      menuStack.addMember(sesTabButton);
      menuStack.addMember(space);
    } else {
      addTS.setWidth("75%");
    }

    menuStack.addMember(exportButton);
    menuStack.addMember(exportLoadingSpinner);
    setExportButtonActiv(false);

    VStack vMenuStack = new VStack();
    vMenuStack.addMember(menuStack);
    vMenuStack.setHeight(28);
    addMember(vMenuStack);

    // create export menu
    createExportMenu();
    addChild(exportMenu);

    VStack separator = new VStack();
    separator.setHeight("3px");
    addMember(separator);

    this.legend = new VStack();
    this.legend.setOverflow(Overflow.AUTO);
    this.legend.setHeight("*");
    this.legend.setShowResizeBar(true);
    addMember(this.legend);
    // this.intro = new HTMLFlow(I18N.sosClient.intro());
    // this.legend.addMember(this.intro);

    addMember(separator);

    Layout layout = new Layout();
    layout.addMember(createMapContent());
    layout.setWidth100();
    layout.setHeight("40%");
    addMember(layout);

    // this.footer = new HLayout();
    // this.footer.setTabIndex( -1);
    // addMember(this.footer);

  }