Esempio n. 1
0
  public void contributeTopButtons(ArrayList<ImageButton> buttons) {
    for (ImageButton ib : this.contributedButtons) {
      topButtons.removeMember(ib);
    }

    contributedButtons.clear();

    for (ImageButton button : buttons) {
      button.setMargin(0);
      // ib.setWidth(16);
      // ib.setHeight(16);
      button.setStyleName("n52_sensorweb_client_topButtons");
      topButtons.addMember(button);
    }
    this.contributedButtons.addAll(buttons);
  }
Esempio n. 2
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);

  }