Ejemplo n.º 1
0
  /**
   * Descripción de Método
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    this.setLayout(mainLayout);
    this.add(splitPane, BorderLayout.CENTER);
    splitPane.setOpaque(false);
    graphPanel.setLayout(graphLayout);

    //

    splitPane.add(graphPanel, JSplitPane.LEFT);
    splitPane.add(cardPanel, JSplitPane.RIGHT);
    splitPane.setBorder(null);
    splitPane.setName("gc_splitPane");

    //

    cardPanel.setLayout(cardLayout);
    cardPanel.add(srPane, "srPane"); // Sequence Important!
    cardPanel.add(mrPane, "mrPane");
    cardPanel.setBorder(null);
    cardPanel.setName("gc_cardPanel");

    // single row (w/o xPane it would be centered)

    srPane.setBorder(null);
    srPane.setName("gc_srPane");
    srPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    srPane.add(vPane, JSplitPane.TOP);
    srPane.setTopComponent(vPane);
    vPane.getViewport().add(xPanel, null);
    xPanel.add(vPanel);
    vPane.setBorder(null);
    xPanel.setLayout(xLayout);
    xPanel.setName("gc_xPanel");
    xLayout.setAlignment(FlowLayout.LEFT);
    xLayout.setHgap(0);
    xLayout.setVgap(0);

    // multi-row

    mrPane.setBorder(null);
    mrPane.getViewport().add(vTable, null);
    mrPane.setName("gc_mrPane");

    //

    graphPanel.setBorder(null);
    graphPanel.setName("gc_graphPanel");
    srPane.setDividerLocation(200);
  } // jbInit
Ejemplo n.º 2
0
 /**
  * This method initializes cCustomerDataPanel
  *
  * @return org.compiere.swing.CPanel
  */
 private CPanel getCCustomerDataPanel() {
   if (cCustomerDataPanel == null) {
     GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
     gridBagConstraints5.fill = java.awt.GridBagConstraints.HORIZONTAL;
     gridBagConstraints5.gridy = 2;
     gridBagConstraints5.weightx = 1.0;
     gridBagConstraints5.anchor = java.awt.GridBagConstraints.WEST;
     gridBagConstraints5.insets = new java.awt.Insets(7, 5, 0, 0);
     gridBagConstraints5.gridx = 1;
     GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
     gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL;
     gridBagConstraints4.gridy = 1;
     gridBagConstraints4.weightx = 1.0;
     gridBagConstraints4.anchor = java.awt.GridBagConstraints.WEST;
     gridBagConstraints4.insets = new java.awt.Insets(7, 5, 0, 0);
     gridBagConstraints4.gridx = 1;
     GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
     gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
     gridBagConstraints3.gridy = 0;
     gridBagConstraints3.weightx = 1.0;
     gridBagConstraints3.insets = new java.awt.Insets(0, 5, 0, 0);
     gridBagConstraints3.gridx = 1;
     GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
     gridBagConstraints2.gridx = 0;
     gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
     gridBagConstraints2.insets = new java.awt.Insets(7, 0, 0, 0);
     gridBagConstraints2.gridy = 2;
     cAddressLabel = new CLabel();
     cAddressLabel.setText(MSG_ADDRESS);
     GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
     gridBagConstraints1.gridx = 0;
     gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
     gridBagConstraints1.insets = new java.awt.Insets(7, 0, 0, 0);
     gridBagConstraints1.gridy = 1;
     cIdentificationLabel = new CLabel();
     cIdentificationLabel.setText(MSG_CUSTOMER_IDENTIFICATION_NUMBER);
     GridBagConstraints gridBagConstraints = new GridBagConstraints();
     gridBagConstraints.gridx = 0;
     gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
     gridBagConstraints.gridy = 0;
     cNameLabel = new CLabel();
     cNameLabel.setText(MSG_NAME);
     cCustomerDataPanel = new CPanel();
     cCustomerDataPanel.setLayout(new GridBagLayout());
     cCustomerDataPanel.setBorder(
         javax.swing.BorderFactory.createCompoundBorder(
             javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED),
             javax.swing.BorderFactory.createEmptyBorder(0, 5, 5, 5)));
     cCustomerDataPanel.add(cNameLabel, gridBagConstraints);
     cCustomerDataPanel.add(cIdentificationLabel, gridBagConstraints1);
     cCustomerDataPanel.add(cAddressLabel, gridBagConstraints2);
     cCustomerDataPanel.add(getCNameText(), gridBagConstraints3);
     cCustomerDataPanel.add(getCIdentificationText(), gridBagConstraints4);
     cCustomerDataPanel.add(getCAddressText(), gridBagConstraints5);
   }
   return cCustomerDataPanel;
 }
Ejemplo n.º 3
0
 /**
  * This method initializes cCustomerDataPanel
  *
  * @return org.compiere.swing.CPanel
  */
 private CPanel getCMainPanel() {
   if (cMainPanel == null) {
     cMainPanel = new CPanel();
     cMainPanel.setLayout(new BorderLayout());
     cMainPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
     cMainPanel.add(getCCmdPanel(), java.awt.BorderLayout.EAST);
     cMainPanel.add(getCCustomerDataPanel(), java.awt.BorderLayout.CENTER);
   }
   return cMainPanel;
 }
Ejemplo n.º 4
0
 /**
  * This method initializes cCommandPanel
  *
  * @return org.compiere.swing.CPanel
  */
 private CPanel getCCmdPanel() {
   if (cCmdPanel == null) {
     cCmdPanel = new CPanel();
     cCmdPanel.setPreferredSize(new java.awt.Dimension(BUTTON_PANEL_WIDTH, 36));
     cCmdPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0));
     cCmdPanel.add(getCOkButton(), null);
     cCmdPanel.add(getCClearButton(), null);
     cCmdPanel.add(getCCancelButton(), null);
   }
   return cCmdPanel;
 }
Ejemplo n.º 5
0
 /**
  * Static component init.
  *
  * <pre>
  *  - panel
  *      - northPanel
  *          - parameterPanel
  *          - toolBar
  *      - gridController
  *      - confirmPanel
  *  - statusBar
  *  </pre>
  *
  * @throws Exception
  */
 void jbInit() throws Exception {
   // [ 1707303 ] Account Combination Form(VAccountDialog) translation issue
   titledBorder =
       new TitledBorder(
           BorderFactory.createEtchedBorder(Color.white, new Color(134, 134, 134)),
           Msg.getMsg(Env.getCtx(), "Parameter"));
   //
   panelLayout.setHgap(5);
   panelLayout.setVgap(5);
   northLayout.setHgap(5);
   northLayout.setVgap(5);
   //
   parameterPanel.setLayout(parameterLayout);
   parameterPanel.setBorder(titledBorder);
   northPanel.setLayout(northLayout);
   toolBar.setOrientation(JToolBar.VERTICAL);
   toolBar.setBorder(null);
   toolBar.setRequestFocusEnabled(false);
   toolBar.setBorderPainted(false);
   toolBar.setMargin(new Insets(5, 5, 5, 5));
   bSave.setIcon(new ImageIcon(ResourceFinder.getResource("images/Save24.gif")));
   bSave.setMargin(new Insets(2, 2, 2, 2));
   bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AccountNewUpdate"));
   bSave.addActionListener(this);
   bRefresh.setIcon(new ImageIcon(ResourceFinder.getResource("images/Refresh24.gif")));
   bRefresh.setMargin(new Insets(2, 2, 2, 2));
   bRefresh.setToolTipText(Msg.getMsg(Env.getCtx(), "Refresh"));
   bRefresh.addActionListener(this);
   bIgnore.setIcon(new ImageIcon(ResourceFinder.getResource("images/Ignore24.gif")));
   bIgnore.setMargin(new Insets(2, 2, 2, 2));
   bIgnore.setToolTipText(Msg.getMsg(Env.getCtx(), "Ignore"));
   bIgnore.addActionListener(this);
   //
   toolBar.addSeparator();
   toolBar.add(bRefresh, null);
   toolBar.add(bIgnore, null);
   toolBar.add(bSave, null);
   //
   getContentPane().add(panel);
   panel.setLayout(panelLayout);
   panel.add(confirmPanel, BorderLayout.SOUTH);
   panel.add(northPanel, BorderLayout.NORTH);
   northPanel.add(parameterPanel, BorderLayout.CENTER);
   northPanel.add(toolBar, BorderLayout.EAST);
   //
   this.getContentPane().add(statusBar, BorderLayout.SOUTH);
   confirmPanel.addActionListener(this);
 } //	jbInit
Ejemplo n.º 6
0
  /**
   * Add Product
   *
   * @param element panel
   * @param product product
   */
  private void addProduct(CPanel element, MProduct product) {
    Insets ii = new Insets(2, 4, 2, 4);
    int M_Product_ID = product.getM_Product_ID();
    CPanel pe = new CPanel();
    pe.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
    pe.setLayout(new GridBagLayout());

    //	Product Value - Price
    pe.add(
        new JLabel(product.getValue()),
        new GridBagConstraints(
            0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
    String formatted = "";
    if (m_M_PriceList_Version_ID != 0) {
      MProductPrice pp =
          MProductPrice.get(Env.getCtx(), m_M_PriceList_Version_ID, M_Product_ID, null);
      if (pp != null) {
        BigDecimal price = pp.getPriceStd();
        formatted = m_price.format(price);
      } else formatted = "-";
    }
    pe.add(
        new JLabel(formatted, JLabel.RIGHT),
        new GridBagConstraints(
            1, 0, 1, 1, .5, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, ii, 0, 0));

    //	Product Name - Qty
    pe.add(
        new JLabel(product.getName()),
        new GridBagConstraints(
            0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
    formatted = "";
    if (m_M_Warehouse_ID != 0) {
      BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
      if (qty == null) formatted = "-";
      else formatted = m_qty.format(qty);
    }
    pe.add(
        new JLabel(formatted, JLabel.RIGHT),
        new GridBagConstraints(
            1, 1, 1, 1, .5, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
    //
    element.add(pe);
  } //	addProduct
Ejemplo n.º 7
0
 /**
  * Static Init
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   CompiereColor.setBackground(panel);
   newBorder = new TitledBorder("");
   accountBorder = new TitledBorder("");
   mainPanel.setLayout(mainLayout);
   newPanel.setBorder(newBorder);
   newPanel.setLayout(newLayout);
   newBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeNewAccount"));
   valueLabel.setText(Msg.translate(Env.getCtx(), "Value"));
   isExpense.setSelected(true);
   isExpense.setText(Msg.getMsg(Env.getCtx(), "Expense"));
   nameLabel.setText(Msg.translate(Env.getCtx(), "Name"));
   nameField.setColumns(20);
   valueField.setColumns(10);
   newButton.setText(
       Msg.getMsg(Env.getCtx(), "Create") + " " + Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
   newButton.addActionListener(this);
   accountPanel.setBorder(accountBorder);
   accountPanel.setLayout(accountLayout);
   accountBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeFromAccount"));
   accountButton.setText(
       Msg.getMsg(Env.getCtx(), "Create")
           + " "
           + Msg.getMsg(Env.getCtx(), "From")
           + " "
           + Msg.getElement(Env.getCtx(), "Account_ID"));
   accountButton.addActionListener(this);
   accountOKPanel.setLayout(accountOKLayout);
   accountOKLayout.setAlignment(FlowLayout.RIGHT);
   confirmPanel.setActionListener(this);
   //
   mainPanel.add(newPanel, BorderLayout.NORTH);
   newPanel.add(
       valueLabel,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.EAST,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 5),
           0,
           0));
   newPanel.add(
       valueField,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(5, 0, 5, 5),
           0,
           0));
   newPanel.add(
       nameLabel,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.EAST,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 5),
           0,
           0));
   newPanel.add(
       nameField,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(5, 0, 5, 5),
           0,
           0));
   newPanel.add(
       isExpense,
       new GridBagConstraints(
           2,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 5),
           0,
           0));
   newPanel.add(
       newButton,
       new GridBagConstraints(
           2,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 5),
           0,
           0));
   mainPanel.add(accountPanel, BorderLayout.CENTER);
   accountPanel.add(accountOKPanel, BorderLayout.SOUTH);
   accountOKPanel.add(accountButton, null);
   accountPanel.add(dataPane, BorderLayout.CENTER);
   dataPane.getViewport().add(dataTable, null);
 } //  jbInit
Ejemplo n.º 8
0
  /**
   * Get Grid Element
   *
   * @param xValue X value
   * @param yValue Y value
   * @return Panel with Info
   */
  private CPanel getGridElement(MAttributeValue xValue, MAttributeValue yValue) {
    CPanel element = new CPanel();
    element.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
    element.setLayout(new BoxLayout(element, BoxLayout.Y_AXIS));

    String sql = "SELECT * FROM M_Product WHERE IsActive='Y'";
    //	Product Attributes
    if (xValue != null)
      sql +=
          " AND M_AttributeSetInstance_ID IN "
              + "(SELECT M_AttributeSetInstance_ID "
              + "FROM M_AttributeInstance "
              + "WHERE M_Attribute_ID="
              + xValue.getM_Attribute_ID()
              + " AND M_AttributeValue_ID="
              + xValue.getM_AttributeValue_ID()
              + ")";
    if (yValue != null)
      sql +=
          " AND M_AttributeSetInstance_ID IN "
              + "(SELECT M_AttributeSetInstance_ID "
              + "FROM M_AttributeInstance "
              + "WHERE M_Attribute_ID="
              + yValue.getM_Attribute_ID()
              + " AND M_AttributeValue_ID="
              + yValue.getM_AttributeValue_ID()
              + ")";
    sql = MRole.getDefault().addAccessSQL(sql, "M_Product", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
    PreparedStatement pstmt = null;
    int noProducts = 0;
    try {
      pstmt = DB.prepareStatement(sql, null);
      ResultSet rs = pstmt.executeQuery();
      while (rs.next()) {
        MProduct product = new MProduct(Env.getCtx(), rs, null);
        addProduct(element, product);
        noProducts++;
      }
      rs.close();
      pstmt.close();
      pstmt = null;
    } catch (Exception e) {
      log.log(Level.SEVERE, sql, e);
    }
    try {
      if (pstmt != null) pstmt.close();
      pstmt = null;
    } catch (Exception e) {
      pstmt = null;
    }

    int mode = modeCombo.getSelectedIndex();
    //	No Products
    if (noProducts == 0 && mode == MODE_VIEW) {
      //	CButton button = ConfirmPanel.createNewButton(true);
      //	button.addActionListener(this);
      //	element.add(button);
    } else //	Additional Elements
    {
      if (mode == MODE_PRICE) {
        //	Price Field
      } else if (mode == MODE_PO) {
        //	Qty Field
      }
    }
    return element;
  } //	getGridElement
Ejemplo n.º 9
0
  void jbInit() throws Exception {

    // criando os labels
    executar.setText("Executar(F5)");
    executar.setToolTipText("Executa Comando SQL");
    exportar.setText("Exportar");
    exportar.setToolTipText("Exporta Consulta para arquivo CSV");

    // /adicionando as bordas
    painelSuperior.setBorder(BorderFactory.createTitledBorder("COMANDO SQL"));
    painelInferior.setBorder(BorderFactory.createTitledBorder("ERROS"));
    scrollPane.setBorder(BorderFactory.createTitledBorder("RESULTADO"));
    painelPrincipal.setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
    caixaLista.setPreferredSize(new Dimension(100, 20));

    // layout do painel

    painelPrincipal.setLayout(borderLayout);
    painelSuperior.setLayout(gridBaglayout);
    painelInferior.setLayout(gridBaglayout);
    painelSuperiorDireito.setLayout(gridBaglayout);
    painelSuperiorEsquerdo.setLayout(gridBaglayout);
    painelPrincipal.add(scrollPane, BorderLayout.CENTER);
    painelPrincipal.add(painelSuperior, BorderLayout.NORTH);
    painelPrincipal.add(painelInferior, BorderLayout.SOUTH);

    painelSuperior.add(
        painelSuperiorEsquerdo,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    painelSuperior.add(
        painelSuperiorDireito,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    painelSuperior.add(
        caixaLista,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    // adicionando paineis no painel principal

    painelSuperiorEsquerdo.add(
        barraRolagem,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    painelSuperiorDireito.add(
        executar,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    painelSuperiorDireito.add(
        exportar,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    // ////////////////////Panel inferio
    painelInferior.add(
        erroSQL,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    // adicionando componentes no painel

    barraRolagem.getViewport().add(comandoSQL, null);
    // comandoSQL.setEditable(false);

    erroSQL.setEnabled(false);
    // adicionando componentes eventos variados

    painelPrincipal.addKeyListener(this);
    executar.addActionListener(this);
    exportar.addActionListener(this);
    comandoSQL.addKeyListener(this);
    caixaLista.addItemListener(this);

    painelPrincipal.repaint();
  }