Package org.compiere.util

Examples of org.compiere.util.ValueNamePair


   *  PaymentRule changed - load DocumentNo, NoPayments,
   *  enable/disable EFT, Print
   */
  private void loadPaymentRuleInfo()
  {
    ValueNamePair pp = (ValueNamePair)fPaymentRule.getSelectedItem();
    if (pp == null)
      return;
    String PaymentRule = pp.getValue();

    log.info("PaymentRule=" + PaymentRule);
    fNoPayments.setText(" ");
   
    int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
View Full Code Here


    try
    {
      PreparedStatement pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, bi.C_BankAccount_ID);
      ResultSet rs = pstmt.executeQuery();
      ValueNamePair vp = null;
      while (rs.next())
      {
        vp = new ValueNamePair(rs.getString(2), rs.getString(3));   //  returns also not active
        data.add(vp);
      }
      rs.close();
      pstmt.close();
    }
View Full Code Here

          mouse_clicked(e,false);
      }
    });

    //  fill Drill Options (Name, TableName)
    comboDrill.addItem(new ValueNamePair (null,""));
    String sql = "SELECT t.AD_Table_ID, t.TableName, e.PrintName, NULLIF(e.PO_PrintName,e.PrintName) "
      + "FROM AD_Column c "
      + " INNER JOIN AD_Column used ON (c.ColumnName=used.ColumnName)"
      + " INNER JOIN AD_Table t ON (used.AD_Table_ID=t.AD_Table_ID AND t.IsView='N' AND t.AD_Table_ID <> c.AD_Table_ID)"
      + " INNER JOIN AD_Column cKey ON (t.AD_Table_ID=cKey.AD_Table_ID AND cKey.IsKey='Y')"
      + " INNER JOIN AD_Element e ON (cKey.ColumnName=e.ColumnName) "
      + "WHERE c.AD_Table_ID=? AND c.IsKey='Y' "
      + "ORDER BY 3";
    boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Element");
    if (trl)
      sql = "SELECT t.AD_Table_ID, t.TableName, et.PrintName, NULLIF(et.PO_PrintName,et.PrintName) "
        + "FROM AD_Column c"
        + " INNER JOIN AD_Column used ON (c.ColumnName=used.ColumnName)"
        + " INNER JOIN AD_Table t ON (used.AD_Table_ID=t.AD_Table_ID AND t.IsView='N' AND t.AD_Table_ID <> c.AD_Table_ID)"
        + " INNER JOIN AD_Column cKey ON (t.AD_Table_ID=cKey.AD_Table_ID AND cKey.IsKey='Y')"
        + " INNER JOIN AD_Element e ON (cKey.ColumnName=e.ColumnName)"
        + " INNER JOIN AD_Element_Trl et ON (e.AD_Element_ID=et.AD_Element_ID) "
        + "WHERE c.AD_Table_ID=? AND c.IsKey='Y'"
        + " AND et.AD_Language=? "
        + "ORDER BY 3";
    try
    {
      PreparedStatement pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, m_reportEngine.getPrintFormat().getAD_Table_ID());
      if (trl)
        pstmt.setString(2, Env.getAD_Language(Env.getCtx()));
      ResultSet rs = pstmt.executeQuery();
      while (rs.next())
      {
        String tableName = rs.getString(2);
        String name = rs.getString(3);
        String poName = rs.getString(4);
        if (poName != null)
          name += "/" + poName;
        comboDrill.addItem(new ValueNamePair (tableName, name));
      }
      rs.close();
      pstmt.close();
    }
    catch (SQLException e)
View Full Code Here

   *  Translate base table entry, will be copied to trl tables if not multi-lingual
   */
  private void cmd_translate()
  {
    ArrayList<ValueNamePair> list = new ArrayList<ValueNamePair>();
    ValueNamePair pp = null;
    String sql = "SELECT Name, AD_Language FROM AD_Language WHERE IsSystemLanguage='Y' ORDER BY 1";
    try
    {
      PreparedStatement pstmt = DB.prepareStatement(sql, null);
      ResultSet rs = pstmt.executeQuery();
      while (rs.next())
        list.add(new ValueNamePair (rs.getString(2), rs.getString(1)));
      rs.close();
      pstmt.close();
    }
    catch (SQLException e)
    {
      log.log(Level.SEVERE, sql, e);
    }
    if (list.size() == 0)
    {
      ADialog.warn(m_WindowNo, this, "NoTranslation");
      return;
    }

    //  Dialog
    String title = Msg.getMsg(Env.getCtx(), "PrintFormatTrl", true);
    String message = Msg.getMsg(Env.getCtx(), "PrintFormatTrl", false);
    int choice = JOptionPane.showOptionDialog
      (this, message, title,
      JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE, null,
      list.toArray(), null);
    if (choice == JOptionPane.CLOSED_OPTION)
      return;
    //
    pp = (ValueNamePair)list.get(choice);
    String AD_Language = pp.getValue();
    int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID();
    log.config(AD_Language + " - AD_PrintFormat_ID=" + AD_PrintFormat_ID);
    StringBuffer sb = new StringBuffer();
    //  English
    if (Language.isBaseLanguage (AD_Language))
View Full Code Here

        if (header == null || header.length() == 0)
          continue;
      }
      if (field.isKey())
        header += (" (ID)");
      ValueNamePair pp = new ValueNamePair(columnName, header);
    //  System.out.println(pp + " = " + field);
      items.add(pp);
    }
    columnValueNamePairs = new ValueNamePair[items.size()];
    items.toArray(columnValueNamePairs);
View Full Code Here

      Object selected = columns.getSelectedItem();
      if (selected != null)
      {
        if (selected instanceof ValueNamePair)
        {
          ValueNamePair column = (ValueNamePair)selected;
          columnName = column.getValue();
        }
        else
        {
          columnName = selected.toString();
        }
View Full Code Here

  private void raiseError(String string, String sql) throws Exception {
   
    // DB.rollback(false, get_TrxName());
    String msg = string;
    ValueNamePair pp = CLogger.retrieveError();
    if (pp != null)
      msg = pp.getName() + " - ";
    msg += sql;
    throw new AdempiereUserError(msg);
  }
View Full Code Here

TOP

Related Classes of org.compiere.util.ValueNamePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.