Example #1
0
  /**
   * Constructor de la clase ...
   *
   * @param re
   */
  public Viewer(ReportEngine re) {
    super();
    log.info("");
    m_WindowNo = Env.createWindowNo(this);
    m_reportEngine = re;
    m_AD_Table_ID = re.getPrintFormat().getAD_Table_ID();

    if (!MRole.getDefault().isCanReport(m_AD_Table_ID)) {
      ADialog.error(m_WindowNo, this, "AccessCannotReport", m_reportEngine.getName());
      this.dispose();
    }

    m_isCanExport = MRole.getDefault().isCanExport(m_AD_Table_ID);

    try {
      m_viewPanel = re.getView();
      m_ctx = m_reportEngine.getCtx();
      jbInit();
      dynInit();

      if (!m_viewPanel.isArchivable()) {
        log.warning("Cannot archive Document");
      }

      AEnv.showCenterScreen(this);
    } catch (Exception e) {
      log.log(Level.SEVERE, "Viewer", e);
      ADialog.error(m_WindowNo, this, "LoadError", e.getLocalizedMessage());
      this.dispose();
    }
  } // Viewer
Example #2
0
  /**
   * Descripción de Método
   *
   * @param AD_PrintFormat_ID
   */
  private void fillComboReport(int AD_PrintFormat_ID) {
    comboReport.removeActionListener(this);
    comboReport.removeAllItems();

    KeyNamePair selectValue = null;

    // fill Report Options

    String sql =
        MRole.getDefault()
            .addAccessSQL(
                "SELECT AD_PrintFormat_ID, Name, Description "
                    + "FROM AD_PrintFormat "
                    + "WHERE AD_Table_ID=? AND IsActive='Y' "
                    + "ORDER BY Name",
                "AD_PrintFormat",
                MRole.SQL_NOTQUALIFIED,
                MRole.SQL_RO);
    int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID();

    try {
      PreparedStatement pstmt = DB.prepareStatement(sql);

      pstmt.setInt(1, AD_Table_ID);

      ResultSet rs = pstmt.executeQuery();

      while (rs.next()) {
        KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));

        comboReport.addItem(pp);

        if (rs.getInt(1) == AD_PrintFormat_ID) {
          selectValue = pp;
        }
      }

      rs.close();
      pstmt.close();
    } catch (SQLException e) {
      log.log(Level.SEVERE, "", e);
    }

    StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(m_ctx, "NewReport")).append(" **");
    KeyNamePair pp = new KeyNamePair(-1, sb.toString());

    // comboReport.addItem( pp );

    if (selectValue != null) {
      comboReport.setSelectedItem(selectValue);
    }

    comboReport.addActionListener(this);
  } // fillComboReport
Example #3
0
 public void onMenu(ContextMenuEvent evt) {
   if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent())) {
     actionRefresh();
   } else if (WEditorPopupMenu.ZOOM_EVENT.equals(evt.getContextEvent())) {
     actionZoom();
   } else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent())) {
     if (MRole.getDefault().isShowPreference())
       ValuePreference.start(this.getGridField(), getValue());
     return;
   } else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent())) {
     WFieldRecordInfo.start(mField);
   }
 }
Example #4
0
  /**
   * Descripción de Método
   *
   * @param query
   */
  private void executeDrill(MQuery query) {
    int AD_Table_ID = AReport.getAD_Table_ID(query.getTableName());

    if (!MRole.getDefault().isCanReport(AD_Table_ID)) {
      ADialog.error(m_WindowNo, this, "AccessCannotReport", query.getTableName());

      return;
    }

    if (AD_Table_ID != 0) {
      new AReport(AD_Table_ID, null, query);
    } else {
      log.warning("No Table found for " + query.getWhereClause(true));
    }
  } // executeDrill
Example #5
0
 /**
  * ************************************************************************ Load Resources. called
  * from variable constructor
  *
  * @return Array with resources
  */
 private KeyNamePair[] getResources() {
   if (m_lookup.size() == 0) {
     String sql =
         MRole.getDefault()
             .addAccessSQL(
                 "SELECT r.S_Resource_ID, r.Name, r.IsActive," //	1..3
                     + "uom.C_UOM_ID,uom.UOMSymbol " //	4..5
                     + "FROM S_Resource r, S_ResourceType rt, C_UOM uom "
                     + "WHERE r.S_ResourceType_ID=rt.S_ResourceType_ID AND rt.C_UOM_ID=uom.C_UOM_ID",
                 "r",
                 MRole.SQL_FULLYQUALIFIED,
                 MRole.SQL_RO);
     try {
       PreparedStatement pstmt = DB.prepareStatement(sql, null);
       ResultSet rs = pstmt.executeQuery();
       while (rs.next()) {
         StringBuffer sb = new StringBuffer(rs.getString(2));
         if (!"Y".equals(rs.getString(3))) sb.insert(0, '~').append('~'); // 	inactive marker
         //	Key		S_Resource_ID/Name
         KeyNamePair key = new KeyNamePair(rs.getInt(1), sb.toString());
         //	Value	C_UOM_ID/Name
         KeyNamePair value = new KeyNamePair(rs.getInt(4), rs.getString(5).trim());
         m_lookup.put(key, value);
       }
       rs.close();
       pstmt.close();
     } catch (SQLException e) {
       log.log(Level.SEVERE, sql, e);
     }
   }
   //	Convert to Array
   KeyNamePair[] retValue = new KeyNamePair[m_lookup.size()];
   m_lookup.keySet().toArray(retValue);
   Arrays.sort(retValue);
   return retValue;
 } //	getResources
Example #6
0
  /** Descripción de Método */
  private void initLocator() {
    log.fine("");

    // Load Warehouse

    String sql = "SELECT M_Warehouse_ID, Name FROM M_Warehouse";

    if (m_only_Warehouse_ID != 0) {
      sql += " WHERE M_Warehouse_ID=" + m_only_Warehouse_ID;
    }

    String SQL =
        MRole.getDefault().addAccessSQL(sql, "M_Warehouse", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO)
            + " ORDER BY 2";

    try {
      PreparedStatement pstmt = DB.prepareStatement(SQL);
      ResultSet rs = pstmt.executeQuery();

      while (rs.next()) {
        fWarehouse.addItem(new KeyNamePair(rs.getInt(1), rs.getString(2)));
      }

      rs.close();
      pstmt.close();
    } catch (SQLException e) {
      log.log(Level.SEVERE, "warehouse", e);
    }

    log.fine("Warehouses=" + fWarehouse.getItemCount());

    // Load existing Locators

    m_mLocator.fillComboBox(m_mandatory, true, true, false);
    log.fine(m_mLocator.toString());
    fLocator.setModel(m_mLocator);
    fLocator.setValue(m_M_Locator_ID);
    fLocator.addActionListener(this);
    displayLocator();

    //

    fCreateNew.setSelected(false);
    fCreateNew.addActionListener(this);
    enableNew();

    //

    fWarehouse.addActionListener(this);
    fX.addKeyListener(this);
    fY.addKeyListener(this);
    fZ.addKeyListener(this);

    // Guarda el ID de la ubicación con la cual se invocó el constructor
    // de este diálogo. Este ID se utiliza en caso de cancelar el diálogo
    // para recuperar el valor que tenía previamente el ID de ubicación.
    m_OriginalLocatorID = m_M_Locator_ID;

    // Update UI

    pack();
  } // initLocator