Пример #1
0
 /**
  * Set Context including contained elements
  *
  * @param newCtx context
  */
 public void setCtx(Properties newCtx) {
   ctx = newCtx;
   for (int i = 0; i < Tabs.size(); i++) {
     GridTabVO tab = (GridTabVO) Tabs.get(i);
     tab.setCtx(newCtx);
   }
 } //  setCtx
Пример #2
0
 /**
  * Clone
  *
  * @param windowNo no
  * @return WindowVO
  */
 public GridWindowVO clone(int windowNo) {
   GridWindowVO clone = null;
   try {
     clone = new GridWindowVO(ctx, windowNo);
     clone.AD_Window_ID = AD_Window_ID;
     clone.AD_Window_UU = AD_Window_UU;
     clone.Name = Name;
     clone.Description = Description;
     clone.Help = Help;
     clone.WindowType = WindowType;
     clone.AD_Image_ID = AD_Image_ID;
     clone.AD_Color_ID = AD_Color_ID;
     clone.IsReadWrite = IsReadWrite;
     clone.WinWidth = WinWidth;
     clone.WinHeight = WinHeight;
     clone.IsSOTrx = IsSOTrx;
     Env.setContext(ctx, windowNo, "IsSOTrx", clone.IsSOTrx);
     clone.AD_Table_ID = AD_Table_ID;
     Env.setContext(ctx, windowNo, "BaseTable_ID", clone.AD_Table_ID);
     //
     clone.Tabs = new ArrayList<GridTabVO>();
     for (int i = 0; i < Tabs.size(); i++) {
       GridTabVO tab = Tabs.get(i);
       GridTabVO cloneTab = tab.clone(clone.ctx, windowNo);
       if (cloneTab == null) return null;
       clone.Tabs.add(cloneTab);
     }
   } catch (Exception e) {
     clone = null;
   }
   return clone;
 } //	clone
Пример #3
0
  /**
   * Create Window Tabs
   *
   * @param mWindowVO Window Value Object
   * @return true if tabs were created
   */
  private static boolean createTabs(GridWindowVO mWindowVO) {
    mWindowVO.Tabs = new ArrayList<GridTabVO>();

    String sql = GridTabVO.getSQL(mWindowVO.ctx);
    int TabNo = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      //	create statement
      pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, mWindowVO.AD_Window_ID);
      rs = pstmt.executeQuery();
      boolean firstTab = true;
      while (rs.next()) {
        if (mWindowVO.AD_Table_ID == 0) mWindowVO.AD_Table_ID = rs.getInt("AD_Table_ID");
        //  Create TabVO
        GridTabVO mTabVO =
            GridTabVO.create(
                mWindowVO,
                TabNo,
                rs,
                mWindowVO.WindowType.equals(WINDOWTYPE_QUERY), //  isRO
                mWindowVO.WindowType.equals(WINDOWTYPE_TRX)); //  onlyCurrentRows
        if (mTabVO == null && firstTab) break; // 	don't continue if first tab is null
        if (mTabVO != null) {
          if (!mTabVO.IsReadOnly && "N".equals(mWindowVO.IsReadWrite)) mTabVO.IsReadOnly = true;
          mWindowVO.Tabs.add(mTabVO);
          TabNo++; //  must be same as mWindow.getTab(x)
          firstTab = false;
        }
      }
    } catch (SQLException e) {
      CLogger.get().log(Level.SEVERE, "createTabs", e);
      return false;
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }

    //  No Tabs
    if (TabNo == 0 || mWindowVO.Tabs.size() == 0) {
      CLogger.get()
          .log(Level.SEVERE, "No Tabs - AD_Window_ID=" + mWindowVO.AD_Window_ID + " - " + sql);
      return false;
    }

    //	Put base table of window in ctx (for VDocAction)
    Env.setContext(mWindowVO.ctx, mWindowVO.WindowNo, "BaseTable_ID", mWindowVO.AD_Table_ID);
    return true;
  } //  createTabs