Esempio n. 1
0
 /** Create new Account and Charge */
 private void createNew() {
   log.info("");
   //  Get Input
   String value = valueField.getText();
   if (value.length() == 0) {
     valueField.setBackground(AdempierePLAF.getFieldBackground_Error());
     return;
   }
   String name = nameField.getText();
   if (name.length() == 0) {
     nameField.setBackground(AdempierePLAF.getFieldBackground_Error());
     return;
   }
   //  Create Element
   int C_ElementValue_ID = createElementValue(value, name, isExpense.isSelected());
   if (C_ElementValue_ID == 0) {
     ADialog.error(m_WindowNo, panel, "ChargeNotCreated", name);
     return;
   }
   //  Create Charge
   int C_Charge_ID = createCharge(name, C_ElementValue_ID);
   if (C_Charge_ID == 0) {
     ADialog.error(m_WindowNo, panel, "ChargeNotCreated", name);
     return;
   }
   ADialog.info(m_WindowNo, panel, "ChargeCreated", name);
 } //  createNew
Esempio n. 2
0
 /**
  * Set Background based on editable / mandatory / error
  *
  * @param error if true, set background to error color, otherwise mandatory/editable
  */
 @Override
 public void setBackground(boolean error) {
   if (error) setBackground(AdempierePLAF.getFieldBackground_Error());
   else if (!isReadWrite()) setBackground(AdempierePLAF.getFieldBackground_Inactive());
   else if (isMandatory()) setBackground(AdempierePLAF.getFieldBackground_Mandatory());
   else setBackground(AdempierePLAF.getFieldBackground_Normal());
 } //  setBackground
 /**
  * Set Background based on editable / mandatory / error
  *
  * @param error if true, set background to error color, otherwise mandatory/editable
  */
 public void setBackground(boolean error) {
   Color c = null;
   if (error) c = AdempierePLAF.getFieldBackground_Error();
   else if (!m_rw) c = AdempierePLAF.getFieldBackground_Inactive();
   else if (m_mandatory) c = AdempierePLAF.getFieldBackground_Mandatory();
   else c = AdempierePLAF.getFieldBackground_Normal();
   setBackground(c);
 } //  setBackground
Esempio n. 4
0
 /**
  * Set Status Line
  *
  * @param text text
  * @param error error
  */
 public void setStatusLine(String text, boolean error) {
   mt_error = error;
   mt_text = text;
   if (mt_error) statusLine.setForeground(AdempierePLAF.getTextColor_Issue());
   else statusLine.setForeground(AdempierePLAF.getTextColor_OK());
   statusLine.setText(" " + mt_text);
   //
   Thread.yield();
 } //	setStatusLine
 /** Update Display with Connection info */
 public void setDisplay() {
   m_text.setText(getDisplay());
   if (m_value == null) return;
   //  Text
   if (m_value.isAppsServerOK(false) || m_value.isDatabaseOK()) {
     m_text.setForeground(AdempierePLAF.getTextColor_OK());
     setBackground(false);
     if (!m_value.isAppsServerOK(false))
       m_server.setBackground(AdempierePLAF.getFieldBackground_Error());
     if (!m_value.isDatabaseOK()) m_db.setBackground(AdempierePLAF.getFieldBackground_Error());
   } else {
     m_text.setForeground(AdempierePLAF.getTextColor_Issue());
     setBackground(true);
   }
 } //  setDisplay
 /**
  * ************************************************************************ Test Method
  *
  * @param args
  */
 public static void main(String[] args) {
   //	System.out.println("CConnectionEditor");
   JFrame frame = new JFrame("CConnectionEditor");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.getRootPane().getContentPane().add(new CConnectionEditor());
   AdempierePLAF.showCenterScreen(frame);
 } //  main
Esempio n. 7
0
  /**
   * Return centered, white Check Box
   *
   * @param table
   * @param value
   * @param isSelected
   * @param hasFocus
   * @param row
   * @param col
   * @return Component
   */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    //  Background & Foreground
    Color bg = AdempierePLAF.getFieldBackground_Normal();
    //  Selected is white on blue in Windows
    if (isSelected && !hasFocus) bg = table.getSelectionBackground();
    //  row not selected or field has focus
    else {
      //  Inactive Background
      if (!table.isCellEditable(row, col)) bg = AdempierePLAF.getFieldBackground_Inactive();
    }
    //  Set Color
    m_check.setBackground(bg);

    //  Value
    setValue(value);
    return m_check;
  } //	getTableCellRendererComponent
Esempio n. 8
0
 /**
  * Static Init
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   statusLine.setBorder(BorderFactory.createEtchedBorder());
   statusLine.setText("statusLine");
   statusLine.setOpaque(false);
   statusDB.setForeground(Color.blue);
   statusDB.setBorder(BorderFactory.createEtchedBorder());
   statusDB.setText("#");
   statusDB.setOpaque(false);
   statusDB.addMouseListener(new StatusBar_mouseAdapter(this));
   this.setLayout(mainLayout);
   infoLine.setFont(AdempierePLAF.getFont_Label());
   infoLine.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary2()));
   infoLine.setHorizontalAlignment(SwingConstants.CENTER);
   infoLine.setHorizontalTextPosition(SwingConstants.CENTER);
   infoLine.setText("info");
   mainLayout.setHgap(2);
   mainLayout.setVgap(2);
   this.add(statusLine, BorderLayout.CENTER);
   this.add(statusDB, BorderLayout.EAST);
   this.add(infoLine, BorderLayout.NORTH);
 } //	jbInit
Esempio n. 9
0
  /** Static Setup - add fields to parameterPanel */
  private void statInit() {
    labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
    fieldValue.setBackground(AdempierePLAF.getInfoBackground());
    fieldValue.addActionListener(this);

    labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
    fieldName.setBackground(AdempierePLAF.getInfoBackground());
    fieldName.addActionListener(this);

    labelUPC.setText(Msg.translate(Env.getCtx(), "UPC"));
    fieldUPC.setBackground(AdempierePLAF.getInfoBackground());
    fieldUPC.addActionListener(this);

    labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
    fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
    fieldSKU.addActionListener(this);

    labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
    pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());

    labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
    pickPriceList.setBackground(AdempierePLAF.getInfoBackground());

    labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
    pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());

    // @Trifon
    labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
    pickAS.setBackground(AdempierePLAF.getInfoBackground());

    m_InfoPAttributeButton.setMargin(new Insets(2, 2, 2, 2));
    m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
    m_InfoPAttributeButton.addActionListener(this);

    labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
    fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
    fieldVendor.addActionListener(this);

    //	Line 1
    parameterPanel.setLayout(new ALayout());
    parameterPanel.add(labelValue, new ALayoutConstraint(0, 0));
    parameterPanel.add(fieldValue, null);
    parameterPanel.add(labelUPC, null);
    parameterPanel.add(fieldUPC, null);
    parameterPanel.add(labelWarehouse, null);
    parameterPanel.add(pickWarehouse, null);
    parameterPanel.add(m_InfoPAttributeButton);
    //	Line 2
    parameterPanel.add(labelName, new ALayoutConstraint(1, 0));
    parameterPanel.add(fieldName, null);
    parameterPanel.add(labelSKU, null);
    parameterPanel.add(fieldSKU, null);
    parameterPanel.add(labelVendor, null);
    parameterPanel.add(fieldVendor, null);

    // Line 3
    parameterPanel.add(labelPriceList, new ALayoutConstraint(2, 0));
    parameterPanel.add(pickPriceList, null);
    parameterPanel.add(labelProductCategory, null);
    parameterPanel.add(pickProductCategory, null);
    parameterPanel.add(labelAS, null); // @Trifon
    parameterPanel.add(pickAS, null); // @Trifon

    //	Product Attribute Instance
    m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
    confirmPanel.addButton(m_PAttributeButton);
    m_PAttributeButton.addActionListener(this);
    m_PAttributeButton.setEnabled(false);

    // Begin - fer_luck @ centuryon
    // add taskpane
    fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
    fieldDescription.setEditable(false);
    fieldDescription.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100));

    warehouseStockPanel.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
    warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
    warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
    warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251, 0, 0));

    ColumnInfo[] s_layoutWarehouse =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "QtyAllocated"), "sum(QtyAllocated)", Double.class)
        };
    /** From Clause */
    String s_sqlFrom = " M_PRODUCT_STOCK_V ";
    /** Where Clause */
    String s_sqlWhere = "Value = ?";
    m_sqlWarehouse =
        warehouseTbl.prepareTable(
            s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
    m_sqlWarehouse += " Group By Warehouse, documentnote ";
    warehouseTbl.setRowSelectionAllowed(true);
    warehouseTbl.setMultiSelection(false);
    warehouseTbl.addMouseListener(this);
    warehouseTbl.getSelectionModel().addListSelectionListener(this);
    warehouseTbl.setShowTotals(true);
    warehouseTbl.autoSize();

    ColumnInfo[] s_layoutSubstitute =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "Value"),
              "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
              String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)
        };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
    m_sqlSubstitute =
        substituteTbl.prepareTable(
            s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    substituteTbl.setRowSelectionAllowed(false);
    substituteTbl.setMultiSelection(false);
    substituteTbl.addMouseListener(this);
    substituteTbl.getSelectionModel().addListSelectionListener(this);
    substituteTbl.autoSize();

    ColumnInfo[] s_layoutRelated =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "Value"),
              "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
              String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)
        };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
    m_sqlRelated =
        relatedTbl.prepareTable(
            s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    relatedTbl.setRowSelectionAllowed(false);
    relatedTbl.setMultiSelection(false);
    relatedTbl.addMouseListener(this);
    relatedTbl.getSelectionModel().addListSelectionListener(this);
    relatedTbl.autoSize();

    // Available to Promise Tab
    m_tableAtp.setRowSelectionAllowed(false);
    m_tableAtp.setMultiSelection(false);

    CTabbedPane jTab = new CTabbedPane();
    jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
    jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
    jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
    jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
    jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
    jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
    jTab.addChangeListener(this);
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.add(jTab);

    warehouseStockPanel.setCollapsed(true);
    warehouseStockPanel.add(tablePanel);
    this.addonPanel.add(warehouseStockPanel);

    this.p_table.addKeyListener(
        new KeyAdapter() {
          public void keyReleased(KeyEvent ke) {
            int row = ((MiniTable) ke.getSource()).getSelectedRow();
            refresh(
                ((MiniTable) ke.getSource()).getValueAt(row, 2),
                new BigDecimal(pickWarehouse.getValue().toString()).intValue(),
                new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
          }
        });

    this.p_table.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent me) {
            int row = ((MiniTable) me.getSource()).getSelectedRow();
            refresh(
                ((MiniTable) me.getSource()).getValueAt(row, 2),
                new BigDecimal(pickWarehouse.getValue().toString()).intValue(),
                new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
          }
        });
    // End - fer_luck @ centuryon
  } //	statInit
Esempio n. 10
0
  /** Initialize */
  @Override
  public void init() {
    //	Content
    MigLayout layout = new MigLayout("ins 0 0", "[fill|fill|fill|fill]", "[nogrid]unrel[||]");
    setLayout(layout);

    Font bigFont = AdempierePLAF.getFont_Field().deriveFont(16f);

    String buttonSize = "w 50!, h 50!,";
    // NEW
    f_bNew = createButtonAction("New", KeyStroke.getKeyStroke(KeyEvent.VK_F2, Event.F2));
    add(f_bNew, buttonSize);

    // EDIT
    f_bEdit = createButtonAction("Edit", null);
    add(f_bEdit, buttonSize);
    f_bEdit.setEnabled(false);

    // HISTORY
    f_history = createButtonAction("History", null);
    add(f_history, buttonSize);

    // CANCEL
    f_process = createButtonAction("Cancel", null);
    add(f_process, buttonSize);
    f_process.setEnabled(false);

    // PAYMENT
    f_cashPayment = createButtonAction("Payment", null);
    f_cashPayment.setActionCommand("Cash");
    add(f_cashPayment, buttonSize);
    f_cashPayment.setEnabled(false);

    // PRINT
    f_print = createButtonAction("Print", null);
    add(f_print, buttonSize);
    f_print.setEnabled(false);

    // Settings
    f_bSettings = createButtonAction("Preference", null);
    add(f_bSettings, buttonSize);

    //
    f_logout = createButtonAction("Logout", null);
    add(f_logout, buttonSize + ", gapx 25, wrap");

    // DOC NO
    add(new CLabel(Msg.getMsg(Env.getCtx(), "DocumentNo")), "");

    f_DocumentNo = new CTextField("");
    f_DocumentNo.setName("DocumentNo");
    f_DocumentNo.setEditable(false);
    add(f_DocumentNo, "growx, pushx");

    CLabel lNet = new CLabel(Msg.translate(Env.getCtx(), "SubTotal"));
    add(lNet, "");
    f_net = new JFormattedTextField(DisplayType.getNumberFormat(DisplayType.Amount));
    f_net.setHorizontalAlignment(JTextField.TRAILING);
    f_net.setEditable(false);
    f_net.setFocusable(false);
    lNet.setLabelFor(f_net);
    add(f_net, "wrap, growx, pushx");
    f_net.setValue(Env.ZERO);
    //

    /*
    	// BPARTNER
    	f_bSearch = createButtonAction ("BPartner", KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.SHIFT_MASK+Event.CTRL_MASK));
    	add (f_bSearch,buttonSize + ", spany 2");
    */

    /*
     * f_name.setName("Name");
    f_name.addActionListener(this);
    f_name.addFocusListener(this);
    add (f_name, "wrap");
    */

    // SALES REP
    add(new CLabel(Msg.translate(Env.getCtx(), "SalesRep_ID")), "");
    f_RepName = new CTextField("");
    f_RepName.setName("SalesRep");
    f_RepName.setEditable(false);
    add(f_RepName, "growx, pushx");

    CLabel lTax = new CLabel(Msg.translate(Env.getCtx(), "TaxAmt"));
    add(lTax);
    f_tax = new JFormattedTextField(DisplayType.getNumberFormat(DisplayType.Amount));
    f_tax.setHorizontalAlignment(JTextField.TRAILING);
    f_tax.setEditable(false);
    f_tax.setFocusable(false);
    lTax.setLabelFor(f_tax);
    add(f_tax, "wrap, growx, pushx");
    f_tax.setValue(Env.ZERO);
    //

    /*
    	f_location = new CComboBox();
    	add (f_location, " wrap");
    */

    // BP
    add(new CLabel(Msg.translate(Env.getCtx(), "C_BPartner_ID")), "");
    f_name = new CTextField();
    f_name.setEditable(false);
    f_name.setName("Name");
    add(f_name, "growx, pushx");

    //
    CLabel lTotal = new CLabel(Msg.translate(Env.getCtx(), "GrandTotal"));
    lTotal.setFont(bigFont);
    add(lTotal, "");
    f_total = new JFormattedTextField(DisplayType.getNumberFormat(DisplayType.Amount));
    f_total.setHorizontalAlignment(JTextField.TRAILING);
    f_total.setFont(bigFont);
    f_total.setEditable(false);
    f_total.setFocusable(false);
    lTotal.setLabelFor(f_total);
    add(f_total, "growx, pushx");
    f_total.setValue(Env.ZERO);
    /*
    //
    f_user = new CComboBox();
    add (f_user, "skip 1");
    */
  } //	init
Esempio n. 11
0
 /**
  * Set Background
  *
  * @param error Error
  */
 public void setBackground(boolean error) {
   if (error) setBackground(AdempierePLAF.getFieldBackground_Error());
   else if (!m_readWrite) setBackground(AdempierePLAF.getFieldBackground_Inactive());
   else if (m_mandatory) setBackground(AdempierePLAF.getFieldBackground_Mandatory());
   else setBackground(AdempierePLAF.getInfoBackground());
 } //	setBackground