Esempio n. 1
0
 public SavePanel(
     String saveTitle, ClickHandler saveClicked, String cancelTitle, ClickHandler cancelClicked) {
   if (saveTitle == null || saveTitle.trim().length() == 0)
     saveTitle = "OK"; // ClientSession.getInstance().getCaption("save");
   if (cancelTitle == null || cancelTitle.trim().length() == 0)
     cancelTitle = "Close"; // ClientSession.getInstance().getCaption("cancel");
   hl = new HLayout();
   hl.setAlign(Alignment.RIGHT);
   saveBtn = new IButton(saveTitle);
   saveBtn.addClickHandler(saveClicked);
   cancelBtn = new IButton(cancelTitle);
   cancelBtn.addClickHandler(cancelClicked);
   hl.addMember(saveBtn);
   hl.addMember(cancelBtn);
   hl.setWidth100();
   hl.setMembersMargin(10);
   hl.setHeight("30");
   Label l = new Label();
   l.setTitle("");
   l.setContents("");
   l.setWidth(0);
   hl.addMember(l);
   addMember(hl);
 }
  public Canvas getViewPanel() {

    Canvas canvas = new Canvas();

    final Label label = new Label(EXAMPLE_TEXT);
    label.setWidth(250);
    label.setPadding(10);
    label.setLeft(160);
    label.setTop(20);
    label.setBackgroundColor("white");
    label.setBorder("1px solid #c0c0c0");
    label.setCanDragReposition(true);
    label.setShowShadow(true);
    label.setShadowSoftness(10);
    label.setShadowOffset(5);
    label.setKeepInParentRect(true);

    final Slider softness = new Slider("Softness");
    softness.setMinValue(1);
    softness.setMaxValue(10);
    softness.setNumValues(11);
    softness.setShowRange(false);
    softness.setLabelWidth(20);
    softness.setValue(10);
    softness.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            softness.addValueChangedHandler(
                new ValueChangedHandler() {
                  public void onValueChanged(ValueChangedEvent event) {
                    label.setShadowSoftness(event.getValue());
                    label.updateShadow();
                  }
                });
          }
        });

    final Slider offset = new Slider("Offset");
    offset.setMinValue(0);
    offset.setMaxValue(20);
    offset.setNumValues(21);
    offset.setShowRange(false);
    offset.setLabelWidth(20);
    offset.setLeft(60);
    offset.setValue(5);

    offset.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            offset.addValueChangedHandler(
                new ValueChangedHandler() {
                  public void onValueChanged(ValueChangedEvent event) {
                    label.setShadowOffset(event.getValue());
                    label.updateShadow();
                  }
                });
          }
        });

    canvas.addChild(softness);
    canvas.addChild(offset);
    canvas.addChild(label);

    return canvas;
  }
  public Canvas getViewPanel() {

    HStack hStack = new HStack();
    hStack.setWidth(300);
    hStack.setHeight(100);
    hStack.setShowEdges(true);
    hStack.setCanAcceptDrop(true);
    hStack.setAnimateMembers(true);
    hStack.setDropLineThickness(4);

    final Label focusLabel = new Label();
    focusLabel.setID("focusLabel");
    focusLabel.setAlign(Alignment.CENTER);
    focusLabel.setTop(150);
    focusLabel.setWidth(300);
    focusLabel.setHeight(50);

    final Img bluePawn = new Img();
    bluePawn.setID("bluePawn");
    bluePawn.setLayoutAlign(Alignment.CENTER);
    bluePawn.setWidth(48);
    bluePawn.setHeight(48);
    bluePawn.setCanFocus(true);
    bluePawn.setSrc("pieces/48/pawn_blue.png");
    bluePawn.setCanDragReposition(true);
    bluePawn.setCanDrop(true);
    bluePawn.setDragAppearance(DragAppearance.TARGET);
    bluePawn.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            bluePawn.focus();
          }
        });
    bluePawn.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, bluePawn.getID(), event.getHasFocus());
          }
        });

    ComboBoxItem field1 = new ComboBoxItem();
    field1.setName("field1");
    field1.setValueMap("Option 1", "Option 2");

    DateItem field2 = new DateItem();
    field2.setName("field2");

    final DynamicForm simpleForm = new DynamicForm();
    simpleForm.setID("simpleForm");
    simpleForm.setLayoutAlign(Alignment.CENTER);
    simpleForm.setHeight(48);
    simpleForm.setFields(field1, field2);
    simpleForm.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, simpleForm.getID(), event.getHasFocus());
          }
        });

    final Img greenPawn = new Img();
    greenPawn.setID("greenPawn");
    greenPawn.setLayoutAlign(Alignment.CENTER);
    greenPawn.setWidth(48);
    greenPawn.setHeight(48);
    greenPawn.setCanFocus(true);
    greenPawn.setSrc("pieces/48/pawn_green.png");
    greenPawn.setCanDragReposition(true);
    greenPawn.setCanDrop(true);
    greenPawn.setDragAppearance(DragAppearance.TARGET);
    greenPawn.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, greenPawn.getID(), event.getHasFocus());
          }
        });

    hStack.addMember(bluePawn);
    hStack.addMember(simpleForm);
    hStack.addMember(greenPawn);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(10);
    vLayout.addMember(hStack);
    vLayout.addMember(focusLabel);

    return vLayout;
  }
Esempio n. 4
0
  public CargaProductoCompra(CompraDetalle compradetalle, final Sgc_capa_web mainWindow) {

    VLayout layout = new VLayout(10);

    final DynamicForm form = new DynamicForm();
    form.setBackgroundColor("#006633");
    form.setBorder("2px");
    form.setAutoFocus(true);
    form.setNumCols(3);
    form.setWidth(500);

    Label label = new Label();
    label.setBackgroundColor("#99ffcc");
    label.setHeight(30);
    label.setWidth(500);
    label.setPadding(10);
    label.setAlign(Alignment.CENTER);
    label.setValign(VerticalAlignment.CENTER);
    label.setWrap(false);
    label.setShowEdges(true);
    label.setContents(
        "<div style='color:black;font-size:15'><b>Carga de Productos de la Compra</b></div>");

    TextItem codigoText = new TextItem("codigo");
    codigoText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}");
    codigoText.setTitle("Codigo");
    codigoText.setDisabled(true);
    codigoText.setWrapTitle(false);

    final TextItem productoText = new TextItem("producto");
    productoText.setTitle("Producto");
    productoText.setDefaultValue(new Date());
    productoText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}");
    productoText.setWrapTitle(false);

    final TextItem cantidadText = new TextItem("cantidad");
    cantidadText.setTitle("Cantidad");
    cantidadText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}");
    cantidadText.setWrapTitle(false);

    final TextItem preciocompraText = new TextItem("preciocompra");
    preciocompraText.setTitle("Precio");
    preciocompraText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}");
    preciocompraText.setWrapTitle(false);

    ButtonItem button = new ButtonItem("save", "Aceptar");
    button.setStartRow(false);
    button.setWidth(80);
    button.setIcon("approve.png");
    button.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            CompraDetalleServiceAsync service = GWT.create(CompraDetalleService.class);
            ServiceDefTarget serviceDef = (ServiceDefTarget) service;
            serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "compradetalleService");
            CompraDetalle compradetalle = new CompraDetalle();
            compradetalle.setId_producto(Integer.parseInt(form.getValueAsString("producto")));
            compradetalle.setCantidad(Integer.parseInt(form.getValueAsString("cantidad")));
            compradetalle.setPrecioCompra(
                Double.parseDouble(form.getValueAsString("preciocompra")));
            // compra.setTotalCompra(Integer.parseInt("15000"));
            if (form.getValueAsString("codigo") != null) {
              compradetalle.setIdCompDet(Integer.valueOf(form.getValueAsString("codigo")));
            }

            try {
              service.guardar(
                  compradetalle,
                  new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {
                      Window.alert(
                          "Ocurrio un error: "
                              + caught.getClass().getName()
                              + " "
                              + caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                      new CargaProductoCompra(mainWindow);
                    }
                  });
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    if (compradetalle != null) {
      codigoText.setDefaultValue(String.valueOf(compradetalle.getIdCompDet()));
      productoText.setDefaultValue(compradetalle.getId_producto());
      cantidadText.setDefaultValue(compradetalle.getCantidad());
      preciocompraText.setDefaultValue(((Object) compradetalle.getPrecioCompra()).toString());
    }

    form.setFields(codigoText, productoText, cantidadText, preciocompraText, button);
    layout.addMember(label);
    layout.addMember(form);
    mainWindow.showDialog(layout);
  }
Esempio n. 5
0
  public ListaVentas(final Sgc_capa_web mainWindow) {

    String PATH_IMG = "/sgc_capa_web/images/";
    VLayout layout = new VLayout(10);
    layout.setBackgroundColor("#006633");
    final ListGrid facturaGrid = new ListGrid();

    facturaGrid.setWidth(500);
    facturaGrid.setHeight(224);
    facturaGrid.setShowAllRecords(true);
    facturaGrid.setAlternateRecordStyles(true);
    facturaGrid.setShowEdges(true);
    facturaGrid.setBorder("0px");
    facturaGrid.setBodyStyleName("normal");
    facturaGrid.setLeaveScrollbarGap(false);
    facturaGrid.setBackgroundColor("#99ffcc");

    /*-Buscar ------------------------------*/
    DynamicForm buscarFields = new DynamicForm();
    // buscarFields.setBackgroundColor("#99ffcc");
    buscarFields.setItemLayout(FormLayoutType.ABSOLUTE);

    final TextItem codigoText = new TextItem("codigo");
    codigoText.setWrapTitle(false);
    codigoText.setLeft(10);
    codigoText.setWidth(43);
    codigoText.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            if ("Enter".equals(event.getKeyName())) {
              /* buscar por el campo correspondiente */
              if (codigoText.getValue() != null) {

                Factura factura = new Factura();
                factura.setId(Integer.parseInt(codigoText.getValue().toString()));
                listar(facturaGrid, factura, "codigo");
              }
            }
          }
        });

    ButtonItem buscarButton = new ButtonItem("find", "");
    buscarButton.setIcon("view.png");
    buscarButton.setWidth(50);
    buscarButton.setLeft(443);
    buscarButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            /* buscar por el campo correspondiente */
            Factura factura = new Factura();

            if (codigoText.getValue() != null)
              factura.setId(Integer.parseInt(codigoText.getValue().toString()));
            /*if(nombreusuarioText.getValue() != null)
            cliente.setNombreusuario(nombreusuarioText.getValue().toString());*/
            listar(facturaGrid, factura, "nombre");
          }
        });

    buscarFields.setFields(codigoText, buscarButton);
    /*--------------------------------------*/

    ListGridField codigoField = new ListGridField("codigo", "Codigo");
    ListGridField fechaField = new ListGridField("fecha", "Fecha");
    ListGridField numeroField = new ListGridField("numero", "Numero");
    ListGridField pendienteField = new ListGridField("pendiente", "Pendiente");
    ListGridField saldoField = new ListGridField("saldo", "Saldo");
    ListGridField editarField = new ListGridField("edit", "Editar");
    ListGridField borrarField = new ListGridField("remove", "Borrar");

    codigoField.setAlign(Alignment.CENTER);
    editarField.setAlign(Alignment.CENTER);
    borrarField.setAlign(Alignment.CENTER);

    editarField.setType(ListGridFieldType.IMAGE);
    borrarField.setType(ListGridFieldType.IMAGE);

    editarField.setImageURLPrefix(PATH_IMG);
    borrarField.setImageURLPrefix(PATH_IMG);

    editarField.setImageURLSuffix(".png");
    borrarField.setImageURLSuffix(".png");

    facturaGrid.addCellClickHandler(
        new CellClickHandler() {
          @Override
          public void onCellClick(CellClickEvent event) {
            ListGridRecord record = event.getRecord();
            int col = event.getColNum();
            if (col > 4) {

              Factura factura = new Factura();
              factura.setId(record.getAttributeAsInt("codigo"));
              factura.setFecha(record.getAttributeAsDate("fecha"));
              factura.setNumero(Integer.parseInt(record.getAttribute("numero")));
              factura.setPendiente(record.getAttribute("pendiente"));
              factura.setSaldo(Double.parseDouble(record.getAttribute("saldo")));

              if (col == 5) {
                /* Editar */

                new VentaDetalle(factura, mainWindow);

              } else {
                /* Borrar */

                FacturaServiceAsync service = GWT.create(FacturaService.class);
                ServiceDefTarget serviceDef = (ServiceDefTarget) service;
                serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "facturaService");
                try {
                  service.eliminar(
                      record.getAttributeAsInt("codigo"),
                      new AsyncCallback<Void>() {

                        @Override
                        public void onFailure(Throwable caught) {
                          Window.alert(
                              "Ocurrio un error y no se puedo eliminar (objeto referenciado)"); // "
                          // +
                          // caught.getClass().getName() + " " + caught.getMessage()) ;
                        }

                        @Override
                        public void onSuccess(Void result) {
                          new ListaVentas(mainWindow);
                        }
                      });
                } catch (NumberFormatException e) {
                  e.printStackTrace();
                } catch (Exception e) {
                  e.printStackTrace();
                }
              }
            }
          }
        });

    codigoField.setWidth(50);
    fechaField.setWidth(180);
    numeroField.setWidth(50);
    pendienteField.setWidth(50);
    saldoField.setWidth(50);
    facturaGrid.setFields(
        codigoField, fechaField, numeroField, pendienteField, saldoField, editarField, borrarField);
    facturaGrid.setCanResizeFields(true);

    ButtonItem button = new ButtonItem("add", "Agregar");
    button.setStartRow(false);
    button.setWidth(80);
    button.setIcon("add.png");
    button.setAlign(Alignment.CENTER);
    button.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            new VentaDetalle(mainWindow);
          }
        });

    listar(facturaGrid, new Factura(), "nombre");

    Label label = new Label();
    label.setBackgroundColor("#99ffcc");
    label.setHeight(30);
    label.setWidth(500);
    label.setPadding(10);
    label.setAlign(Alignment.CENTER);
    label.setValign(VerticalAlignment.CENTER);
    label.setWrap(false);
    label.setShowEdges(true);
    label.setContents("<div style='color:black;font-size:15'><b>Lista de Ventas</b></div>");

    layout.addMember(label);
    layout.addMember(buscarFields);
    layout.addMember(facturaGrid);

    DynamicForm form = new DynamicForm();
    // form.setBackgroundColor("#99ffcc");
    form.setWidth(300);
    form.setItems(button);
    layout.addMember(form);
    mainWindow.showDialog(layout);
  }
Esempio n. 6
0
  /**
   * Creates this property editor.
   *
   * @param contents Contents view form.
   */
  public MixinValueEditor(Contents contents) {
    super(TITLE);
    this.contents = contents;

    setWidth(WIDTH);
    setHeight(HEIGHT);

    Columns h1 = new Columns(Align.CENTER, Align.CENTER);
    h1.setHeight(15);

    Label l1 = new Label();
    l1.setWidth(150);
    l1.setContents("Mixin Types");

    Label l2 = new Label();
    l2.setWidth(100);
    l2.setContents("");

    Label l3 = new Label();
    l3.setWidth(150);
    l3.setContents("Node's types");

    h1.addMember(l1);
    h1.addMember(l2);
    h1.addMember(l3);

    addMember(h1);

    Columns layout = new Columns(Align.CENTER, Align.CENTER);
    layout.setWidth100();

    mixTypes.setMultiple(true);
    mixTypes.setMultipleAppearance(MultipleAppearance.GRID);
    mixTypes.setWidth(150);
    mixTypes.setHeight(200);

    selectedTypes.setMultiple(true);
    selectedTypes.setMultipleAppearance(MultipleAppearance.GRID);
    selectedTypes.setWidth(150);
    selectedTypes.setHeight(200);

    DynamicForm f1 = new DynamicForm();
    f1.setItems(mixTypes);
    f1.setWidth(150);
    f1.setHeight(200);

    DynamicForm f2 = new DynamicForm();
    f2.setItems(selectedTypes);
    f2.setWidth(150);
    f2.setHeight(200);

    VLayout buttons = new VLayout();
    buttons.setLayoutAlign(Alignment.CENTER);
    buttons.setDefaultLayoutAlign(Alignment.CENTER);
    buttons.setAlign(Alignment.CENTER);
    buttons.setLayoutAlign(VerticalAlignment.CENTER);
    buttons.setWidth(50);

    layout.addMember(f1);
    layout.addMember(buttons);
    layout.addMember(f2);

    Button b1 = new Button(">>");
    b1.setWidth(30);
    b1.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            allTypes = remove(allTypes, mixTypes.getValueAsString());
            nodeTypes = add(nodeTypes, mixTypes.getValueAsString());
            updateLists();
          }
        });

    Button b2 = new Button("<<");
    b2.setWidth(30);
    b2.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            nodeTypes = remove(nodeTypes, selectedTypes.getValueAsString());
            allTypes = add(allTypes, selectedTypes.getValueAsString());
            updateLists();
          }
        });

    buttons.addMember(b1);
    buttons.addMember(b2);

    addMember(layout);

    Columns h3 = new Columns(Align.RIGHT, Align.CENTER);
    h3.setHeight(50);

    Button okButton = new Button("OK");
    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            onConfirm(null);
            hide();
          }
        });

    Button cancelButton = new Button("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            hide();
          }
        });

    h3.addMember(okButton);
    h3.addMember(cancelButton);

    addMember(h3);
  }
  public RepositoryNameView(final Console console) {
    super();
    setStyleName("repository");
    setLayoutAlign(Alignment.CENTER);
    setLayoutAlign(VerticalAlignment.CENTER);
    setDefaultLayoutAlign(Alignment.CENTER);
    setDefaultLayoutAlign(VerticalAlignment.CENTER);

    setHeight(55);
    setWidth100();

    Img logo = new Img();
    logo.setSrc("icons/attach.png");

    logo.setHeight(55);
    logo.setWidth(45);
    logo.setValign(VerticalAlignment.CENTER);

    HLayout panel0 = new HLayout();

    HLayout panel1 = new HLayout();

    panel1.setLayoutAlign(Alignment.RIGHT);
    panel1.setDefaultLayoutAlign(Alignment.RIGHT);
    panel1.setAlign(Alignment.RIGHT);
    HLayout panel = new HLayout();

    //            panel.setAlign(Alignment.LEFT);
    panel.setLayoutAlign(VerticalAlignment.CENTER);
    panel.setDefaultLayoutAlign(VerticalAlignment.CENTER);

    label.setStyleName("repository-caption");
    label.setWidth("100%");
    label.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showRepositories();
          }
        });
    label.setBorder("1 px solid black");
    label.setValign(VerticalAlignment.CENTER);

    Label explore = new Label("<b>Explore</b>");
    explore.setAlign(Alignment.RIGHT);
    explore.setBorder("1ps solid green");
    explore.setAutoFit(true);
    explore.setStyleName("tab-label");
    explore.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showContent();
          }
        });

    Label nodeTypes = new Label("<b>NodeTypes</b>");
    nodeTypes.setAlign(Alignment.RIGHT);
    nodeTypes.setAutoFit(true);
    nodeTypes.setStyleName("tab-label");
    nodeTypes.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showNodeTypes();
          }
        });

    Label descriptor = new Label("<b>Descriptor</b>");
    descriptor.setAlign(Alignment.RIGHT);
    descriptor.setAutoFit(true);
    descriptor.setStyleName("tab-label");
    descriptor.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showRepositoryInfo();
          }
        });

    Label query = new Label("<b>Query</b>");
    query.setAlign(Alignment.RIGHT);
    query.setAutoFit(true);
    query.setStyleName("tab-label");
    query.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showQuery();
          }
        });

    panel.addMember(logo);
    panel.addMember(label);

    panel1.addMember(explore);
    panel1.addMember(new Spacer(10));
    panel1.addMember(nodeTypes);
    panel1.addMember(new Spacer(10));
    panel1.addMember(descriptor);
    panel1.addMember(new Spacer(10));
    panel1.addMember(query);
    panel1.setHeight(55);

    panel0.setWidth("70%");
    panel0.setHeight(55);

    panel0.addMember(panel);
    panel0.addMember(panel1);

    addMember(new Strut(10));
    addMember(panel0);
    addMember(new Strut(10));
    setVisible(false);
  }
Esempio n. 8
0
  //    private final MapServiceInfoAsync mapServiceInfo = GWT.create(MapServiceInfo.class);
  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  public Authorization(final AsyncCallback<String> callback) {
    super(WINDOW_TITLE, WIDTH, HEIGHT, callback);

    this.setShowMinimizeButton(false);

    VLayout layout = new VLayout();
    layout.layoutChildren(null);

    accountForm = new DynamicForm();
    accountForm.setWidth100();
    accountForm.setPadding(5);
    //        backGround.setBorder("1px solid #ff0");
    TextItem login = new TextItem(CONTROL_LOGIN);
    login.setTitle(CAPTION_LOGIN);
    PasswordItem password = new PasswordItem(CONTROL_PASSWORD);
    password.setTitle(CAPTION_PASSWORD);

    password.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent keyPressEvent) {
            //                com.google.gwt.user.client.Window.alert("" +
            // keyPressEvent.getKeyName());
            if (keyPressEvent.getKeyName().equalsIgnoreCase("ENTER")) onOkClick();
          }
        });

    accountForm.setFields(login, password);

    Label linkRegistration = null;
    if (GWTViewer.config.withRegistration()) {
      linkRegistration = new Label();
      linkRegistration.setAlign(Alignment.RIGHT);
      linkRegistration.setStyleName(CSS_LABEL_LINK);
      linkRegistration.setHeight(20);
      linkRegistration.setWidth(265);
      linkRegistration.setContents(REGISTRATION);

      linkRegistration.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              callback.onSuccess(CMD_REGISTRATION);
              closeForm();
            }
          });
    }
    labelException = new Label();
    labelException.setAlign(Alignment.CENTER);
    labelException.setStyleName(CSS_LABEL_ERROR);
    labelException.setHeight(35);
    labelException.setWidth100();
    labelException.setMargin(5);
    //       labelException.setBorder("1px solid #0aa");
    labelException.setContents("");

    HLayout controlPanel = new HLayout();
    controlPanel.setHeight("30px");
    controlPanel.setLayoutLeftMargin(55);

    Button btnOk = null;
    btnOk = new Button("Ok");
    btnOk.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onOkClick();
          }
        });
    Button btnClose = new Button(CAPTION_CLOSE);
    btnClose.setTop(10);
    btnClose.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            closeForm();
          }
        });
    controlPanel.addMember(btnOk);
    controlPanel.addMember(btnClose);

    layout.addMember(accountForm);
    if (linkRegistration != null) layout.addMember(linkRegistration);
    layout.addMember(labelException);
    layout.addMember(controlPanel);
    addItem(layout);
  }
Esempio n. 9
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);

  }