Example #1
0
  protected Canvas defaultView() {
    EnhancedVLayout vLayout = new EnhancedVLayout();
    vLayout.setWidth100();

    // TODO: Help icon.
    TitleBar titleBar = new TitleBar(MSG.view_testTop_title());
    vLayout.addMember(titleBar);

    Label label = new Label(MSG.view_testTop_description());
    label.setPadding(10);
    vLayout.addMember(label);

    return vLayout;
  }
Example #2
0
  @Override
  protected LocatableVLayout defaultView() {
    LocatableVLayout vLayout = new LocatableVLayout(this.extendLocatorId("Default"));
    vLayout.setWidth100();

    // TODO: Help icon.
    TitleBar titleBar = new TitleBar(this, MSG.common_title_help());
    vLayout.addMember(titleBar);

    Label label = new Label(MSG.view_helpTop_description());
    label.setPadding(10);
    vLayout.addMember(label);

    return vLayout;
  }
 private Label createPDFLabel() {
   Label toPDF = new Label(i18n.toPDF());
   toPDF.setWrap(false);
   toPDF.setAutoFit(true);
   toPDF.setPadding(3);
   toPDF.setWidth100();
   toPDF.setStyleName("n52_sensorweb_client_exportEntry");
   toPDF.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           controller.exportTo(ExportType.PDF_ALL_IN_ONE);
           exportMenu.hide();
         }
       });
   return toPDF;
 }
  private Label buildSecondaryMenuOption(final String title, boolean selected) {
    Label tmp = new Label(title);
    tmp.setTitle(title);
    tmp.setWrap(false);
    tmp.setValign(VerticalAlignment.BOTTOM);
    tmp.setAlign(Alignment.CENTER);
    tmp.setPadding(10);
    tmp.setShowRollOver(true);
    tmp.setCursor(Cursor.POINTER);

    String style;

    if (selected) {
      style = "secondaryMenuText-selected";
      selectedSecondaryMenuOption = tmp;
    } else {
      style = "secondaryMenuText";
    }
    tmp.setBaseStyle(style);

    tmp.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            Object o = event.getSource();
            if (o instanceof Label) {
              Label lbl = (Label) o;
              if (!lbl.getTitle().equals(selectedSecondaryMenuOption.getTitle())) {
                selectedSecondaryMenuOption.setBaseStyle("secondaryMenuText");
                lbl.setBaseStyle("secondaryMenuText-selected");
                selectedSecondaryMenuOption = lbl;
                BLCMain.setCurrentPageKey(lbl.getTitle());
                buildHistoryNewItem(
                    lbl.getTitle(), BLCLaunch.getSelectedModule(History.getToken()), null);
              }
            }
          }
        });

    return tmp;
  }
  private Label buildPrimaryMenuOption(final Module module, boolean selected) {
    Label tmp = new Label(module.getModuleTitle());
    tmp.setValign(VerticalAlignment.CENTER);
    tmp.setHeight(30);
    tmp.setAlign(Alignment.CENTER);
    tmp.setWrap(false);
    tmp.setPadding(0);
    tmp.setShowRollOver(true);
    tmp.setCursor(Cursor.POINTER);

    final String style;
    if (selected) {
      style = "primaryMenuText-selected";
    } else {
      style = "primaryMenuText";
    }

    tmp.setBaseStyle(style);

    tmp.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            Object o = event.getSource();
            if (o instanceof Label) {
              final Label lbl = (Label) o;
              if (!"primaryMenuText-selected".equals(lbl.getBaseStyle())) {
                selectPrimaryMenu(module.getModuleKey());
                lbl.setBaseStyle("primaryMenuText-selected");
                BLCMain.setCurrentModuleKey(module.getModuleKey());
                buildSecondaryMenu(null, module.getModuleKey());
                AppController.getInstance()
                    .go(canvas, module.getPages(), null, module.getModuleKey(), false);
              }
            }
          }
        });

    return tmp;
  }
  public Canvas getViewPanel() {
    Label label =
        new Label(
            "Staging: <span style=\"color: green; font-weight: bold;\">Normal</span><br/>"
                + "Production: <span style=\"color: green; font-weight: bold;\">Normal</span><br/>"
                + "Development: <span style=\"color: green; font-weight: bold;\">Normal</span>");
    label.setHeight100();
    label.setPadding(5);
    label.setValign(VerticalAlignment.TOP);

    Window window = new Window();
    window.setTitle("Minimizing a window");
    window.setWidth(300);
    window.setHeight(85);
    window.setCanDragResize(true);
    window.addItem(label);

    Canvas canvasMain = new Canvas();
    canvasMain.addChild(window);

    return canvasMain;
  }
  public Canvas getSearchCanvas() {
    final VLayout mainLayout = new VLayout(20);
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.setPadding(5);

    Label titleBar = new Label(MESSAGES.geometricSearchWidgetFreeDrawingSearchTitle());
    titleBar.setBackgroundColor("#E0E9FF");
    titleBar.setWidth100();
    titleBar.setHeight(20);
    titleBar.setPadding(5);

    HLayout geomsButtonBar = new HLayout();
    geomsButtonBar.setWidth100();
    geomsButtonBar.setAutoHeight();
    geomsButtonBar.setMembersMargin(10);
    HLayout actionsButtonBar = new HLayout();
    actionsButtonBar.setWidth100();
    actionsButtonBar.setAutoHeight();
    actionsButtonBar.setMembersMargin(10);

    btnPoint = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPoint());
    btnPoint.setIcon(WidgetLayout.iconPointCreate);
    btnPoint.setWidth(
        btnPoint.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPoint.setActionType(SelectionType.RADIO);
    btnPoint.setRadioGroup("drawType");
    btnPoint.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPoint();
          }
        });

    btnLine = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingLine());
    btnLine.setIcon(WidgetLayout.iconLineCreate);
    btnLine.setWidth(
        btnLine.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnLine.setActionType(SelectionType.RADIO);
    btnLine.setRadioGroup("drawType");
    btnLine.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawLine();
          }
        });

    btnPolygon = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPolygon());
    btnPolygon.setIcon(WidgetLayout.iconPolygonCreate);
    btnPolygon.setWidth(
        btnPolygon.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPolygon.setActionType(SelectionType.RADIO);
    btnPolygon.setRadioGroup("drawType");
    btnPolygon.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPolygon();
          }
        });

    btnUndo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingUndo());
    btnUndo.setIcon(WidgetLayout.iconUndo);
    btnUndo.setWidth(
        btnUndo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnUndo.setDisabled(true);
    btnUndo.setShowDisabledIcon(false);
    btnUndo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onUndo();
          }
        });

    btnRedo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingRedo());
    btnRedo.setIcon(WidgetLayout.iconRedo);
    btnRedo.setWidth(
        btnRedo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnRedo.setDisabled(true);
    btnRedo.setShowDisabledIcon(false);
    btnRedo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onRedo();
          }
        });

    frmBuffer = new DynamicForm();
    frmBuffer.setWidth100();
    spiBuffer = new SpinnerItem();
    spiBuffer.setTitle(MESSAGES.geometricSearchWidgetBufferLabel());
    spiBuffer.setDefaultValue(5);
    spiBuffer.setMin(0);
    spiBuffer.setWidth(60);
    spiBuffer.addChangedHandler(
        new ChangedHandler() {
          public void onChanged(ChangedEvent event) {
            updateView();
          }
        });
    frmBuffer.setFields(spiBuffer);

    // ----------------------------------------------------------

    geomsButtonBar.addMember(btnPoint);
    geomsButtonBar.addMember(btnLine);
    geomsButtonBar.addMember(btnPolygon);

    actionsButtonBar.addMember(btnUndo);
    actionsButtonBar.addMember(btnRedo);

    mainLayout.addMember(titleBar);
    mainLayout.addMember(geomsButtonBar);
    mainLayout.addMember(actionsButtonBar);
    mainLayout.addMember(frmBuffer);

    return mainLayout;
  }
  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;
  }
Example #9
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);
  }
Example #10
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);
  }