private void buildFooter() {
    bottomBar = new ToolStrip();
    bottomBar.setBackgroundImage(GWT.getModuleBaseURL() + "admin/images/header_bg.png");
    bottomBar.setHeight(30);
    bottomBar.setWidth100();
    status = new Label();
    status.setWrap(false);
    bottomBar.addSpacer(6);

    bottomBar.addMember(status);
    bottomBar.addFill();
    bottomBar.addMember(BLCMain.NON_MODAL_PROGRESS);
    bottomBar.addSpacer(5);

    addMember(bottomBar);
  }
예제 #2
0
 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;
  }
예제 #5
0
  public void build(DataSource entityDataSource, DataSource... additionalDataSources) {
    VLayout leftVerticalLayout = new VLayout();
    leftVerticalLayout.setID("customerLeftVerticalLayout");
    leftVerticalLayout.setHeight100();
    leftVerticalLayout.setWidth("50%");
    leftVerticalLayout.setShowResizeBar(true);

    listDisplay =
        new DynamicEntityListView(
            BLCMain.getMessageManager().getString("customerListTitle"),
            entityDataSource,
            false,
            false);
    leftVerticalLayout.addMember(listDisplay);

    dynamicFormDisplay =
        new DynamicFormView(
            BLCMain.getMessageManager().getString("customerDetailsTitle"), entityDataSource);
    dynamicFormDisplay.setWidth("50%");
    ToolStrip toolbar = dynamicFormDisplay.getToolbar();
    toolbar.addFill();
    Label label = new Label();
    label.setContents(BLCMain.getMessageManager().getString("resetPasswordPrompt"));
    label.setWrap(false);
    toolbar.addMember(label);

    updateLoginButton = new ToolStripButton();
    updateLoginButton.setIcon(
        GWT.getModuleBaseURL() + "sc/skins/Enterprise/images/headerIcons/settings.png");
    updateLoginButton.setDisabled(true);
    toolbar.addButton(updateLoginButton);
    toolbar.addSpacer(6);

    addMember(leftVerticalLayout);
    addMember(dynamicFormDisplay);
  }
  public SplashWindow(String backgroundImage, String version) {
    setShowShadow(true);
    setBackgroundImage(backgroundImage);
    setShowEdges(false);
    setWidth(447);
    setHeight(257);
    setShowMinimizeButton(false);
    setShowTitle(false);
    setShowHeader(false);
    setIsModal(true);
    centerInPage();
    setShowCloseButton(false);
    VLayout layout = new VLayout();
    VLayout spacer = new VLayout();
    spacer.setHeight(90);
    layout.addMember(spacer);
    HLayout versionLayout = new HLayout();
    versionLayout.setAlign(Alignment.LEFT);
    versionLayout.setHeight(15);
    HLayout spacer3 = new HLayout();
    spacer3.setWidth(25);
    versionLayout.addMember(spacer3);
    VLayout temp = new VLayout(5);
    Label versionLabel =
        new Label(
            "Core Version: "
                + BLCMain.getMessageManager().getString("openAdminVersion")
                + "/"
                + BLCMain.getMessageManager().getString("buildDate"));
    versionLabel.setWrap(false);
    versionLabel.setStyleName("versionStyle");
    versionLabel.setHeight(15);
    temp.addMember(versionLabel);

    buildDateLabel = new Label(" ");
    buildDateLabel.setWrap(false);
    buildDateLabel.setStyleName("versionStyle");
    buildDateLabel.setHeight(15);

    temp.addMember(buildDateLabel);
    versionLayout.addMember(temp);
    layout.addMember(versionLayout);
    VLayout spacer2 = new VLayout();
    spacer2.setHeight(10);
    layout.addMember(spacer2);
    HLayout progressLayout = new HLayout();
    progressLayout.setAlign(Alignment.CENTER);
    simpleProgress = new SimpleProgress(24);
    simpleProgress.setWidth(417);
    progressLayout.addMember(simpleProgress);
    layout.addMember(progressLayout);
    setBorder("1px solid #3b4726");
    addItem(layout);

    KeyIdentifier escapeKey = new KeyIdentifier();
    escapeKey.setKeyName(KeyNames.ESC);
    Page.registerKey(
        escapeKey,
        new KeyCallback() {
          public void execute(String keyName) {
            SplashWindow.this.hide();
          }
        });
  }
예제 #7
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);
  }
예제 #8
0
  private HLayout createSearchLayout() {
    HLayout searchLayout = new HLayout();

    searchLayout.setWidth100();
    searchLayout.setHeight(20);
    searchLayout.setMembersMargin(15);

    i_searchForm = new DynamicForm();
    i_searchForm.setWidth(250);
    i_searchForm.setHeight100();
    i_searchForm.setAlign(Alignment.LEFT);
    i_searchForm.setAutoFocus(true);

    i_searchTextItem = new TextItem();
    i_searchTextItem.setTitle("Search");
    i_searchTextItem.setWidth(200);
    i_searchTextItem.setHint(SEARCH_HINT);
    i_searchTextItem.setShowHintInField(true);
    i_searchTextItem.setCanFocus(true);
    i_searchTextItem.setSelectOnFocus(true);

    i_searchTextItem.addKeyUpHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            event.getKeyName();

            // ignore the arrow keys
            if (isValidSearchText()) {
              i_searchListGrid.getData(i_searchTextItem.getValueAsString());
              i_addButton.setDisabled(true);
            }
          }
        });

    i_searchForm.setFields(i_searchTextItem);

    // add button to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout buttonVlayout = new VLayout();
    buttonVlayout.setWidth(40);
    buttonVlayout.setAlign(VerticalAlignment.CENTER);
    buttonVlayout.setMargin(2);

    i_clearButton = new IButton(CLEAR_BUTTON_TITLE);
    i_clearButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            i_searchTextItem.setValue("");
            i_rowsRetrievedLabel.setContents("");
            i_searchListGrid.clearData();
            i_addButton.setDisabled(true);
          }
        });
    buttonVlayout.addMember(i_clearButton);

    // add Label to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout labelVlayout = new VLayout();
    labelVlayout.setWidth(100);
    labelVlayout.setAlign(VerticalAlignment.BOTTOM);
    labelVlayout.setMargin(2);

    i_rowsRetrievedLabel = new Label();
    i_rowsRetrievedLabel.setWrap(false);
    i_rowsRetrievedLabel.setWidth100();
    i_rowsRetrievedLabel.setHeight(23);

    labelVlayout.addMember(i_rowsRetrievedLabel);

    searchLayout.addMember(i_searchForm);
    searchLayout.addMember(buttonVlayout);
    searchLayout.addMember(labelVlayout);

    return searchLayout;
  }
예제 #9
0
파일: ListaVentas.java 프로젝트: bau88/TPPW
  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);
  }
  @Override
  protected void onDraw() {
    try {
      super.onDraw();

      for (Canvas child : contents.getMembers()) {
        contents.removeChild(child);
      }

      // Title
      this.titleCanvas = new HTMLFlow();
      setTitleString(this.titleString);

      if (showTitle) {
        titleLayout = new LocatableHLayout(contents.extendLocatorId("Title"));
        titleLayout.setAutoHeight();
        titleLayout.setAlign(VerticalAlignment.BOTTOM);
        titleLayout.setMembersMargin(4);
        contents.addMember(titleLayout, 0);
      }

      if (null != carouselDetails) {
        contents.addMember(carouselDetails);
      }

      if (filterForm.hasContent()) {
        contents.addMember(filterForm);
      }

      contents.addMember(carouselHolder);

      // Footer

      // A second toolstrip that optionally appears before the main footer - it will contain extra
      // widgets.
      // This is hidden from view unless extra widgets are actually added to the carousel above the
      // main footer.
      this.footerExtraWidgets =
          new LocatableToolStrip(contents.extendLocatorId("FooterExtraWidgets"));
      footerExtraWidgets.setPadding(5);
      footerExtraWidgets.setWidth100();
      footerExtraWidgets.setMembersMargin(15);
      footerExtraWidgets.hide();
      contents.addMember(footerExtraWidgets);

      this.footer = new LocatableToolStrip(contents.extendLocatorId("Footer"));
      footer.setPadding(5);
      footer.setWidth100();
      footer.setMembersMargin(15);
      contents.addMember(footer);

      // The ListGrid has been created and configured
      // Now give subclasses a chance to configure the carousel
      configureCarousel();

      Label carouselInfo = new Label();
      carouselInfo.setWrap(false);
      setCarouselInfo(carouselInfo);

      if (showTitle) {
        drawTitle();
      }

      if (showFooter) {
        drawFooter();
      }
    } catch (Exception e) {
      CoreGUI.getErrorHandler().handleError(MSG.view_table_drawFail(this.toString()), e);
    }
  }