Package org.jallinone.sqltool.java

Examples of org.jallinone.sqltool.java.TableVO


      ArrayList mainTables = new ArrayList();
      StringTokenizer st = new StringTokenizer(vo.getMainTablesSYS16(),",");
      while(st.hasMoreTokens())
        mainTables.add(st.nextToken());

      TableVO tableVO = new TableVO(vo.getSql(),mainTables,true);
      Response res = ClientUtils.getData("getQueryInfo",tableVO);
      if (res.isError()) {
        JOptionPane.showMessageDialog(
          MDIFrame.getInstance(),
          ClientSettings.getInstance().getResources().getResource(res.getErrorMessage()),
          ClientSettings.getInstance().getResources().getResource("Error"),
          JOptionPane.WARNING_MESSAGE
        );
        return;
      }

      tableVO = (TableVO)((VOResponse)res).getVo();
      DefaultListModel model = new DefaultListModel();
      ArrayList tables = tableVO.getAllTables();
      for(int i=0;i<tables.size();i++)
        model.addElement(tables.get(i));

      tablesList.setModel(model);
      tablesList.revalidate();
View Full Code Here


      while(st.hasMoreTokens()) {
        tables.add(st.nextToken());
      }

      // retrieve query info...
      TableVO tableVO = new TableVO(vo.getSql(),tables,true);
      res = ClientUtils.getData("getQueryInfo",tableVO);
      if (res.isError()) {
        JOptionPane.showMessageDialog(
          MDIFrame.getInstance(),
          ClientSettings.getInstance().getResources().getResource(res.getErrorMessage()),
          ClientSettings.getInstance().getResources().getResource("Error"),
          JOptionPane.WARNING_MESSAGE
        );
        return;
      }
      tableVO = (TableVO)((VOResponse)res).getVo();
      ColumnVO colVO = null;
      CustomColumnVO customColVO = null;
      boolean found;
      Hashtable whereParamColNames = new Hashtable(); // collection of <columnname,index in where> related to where params...
      boolean paramsRequired = false; // flag used to disable auto data loading...
      ArrayList paramsDefined = new ArrayList(); // input controls defined in filter panel; used to auto set filter panel height into the split pane...
      int count = 0;
      for(int i=0;i<customCols.size();i++) {
        customColVO = (CustomColumnVO)customCols.get(i);

        found = false;
        for(int j=0;j<tableVO.getColumns().size();j++) {
          colVO = (ColumnVO)tableVO.getColumns().get(j);
          if (customColVO.getColumnNameSYS22().equals(colVO.getColumnName())) {
            found = true;
            break;
          }
        }

        if (!found && customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_WHERE)) {
          // parameter in where clause...
          colVO = new ColumnVO(tableVO);
          colVO.setColumnName(customColVO.getColumnNameSYS22());
          colVO.setAttributeName(customColVO.getColumnNameSYS22());
          colVO.setColumnHeaderName(customColVO.getColumnNameSYS22());
          colVO.setColumnType(ApplicationConsts.TYPE_TEXT);
          colVO.setColumnSize(new BigDecimal(255));
          whereParamColNames.put(colVO.getAttributeName(),new Integer(count));
          whereParamsFilled.put(new Integer(count),new Boolean(false));
          count++;
          found = true;
        }

        if (!found)
          continue;

        if (customColVO.isIsParamRequiredSYS22())
          paramsRequired = true;
        if (customColVO.isIsParamSYS22()) {
          if (paramsDefined.size()==0) {
            // add filter panel title...
            TitledBorder titledBorder1 = new TitledBorder(ClientSettings.getInstance().getResources().getResource("filter conditions"));
            titledBorder1.setTitleColor(Color.blue);
            filterPanel.setBorder(titledBorder1);
          }

          // define label + input control for filter panel...
          LabelControl label = new LabelControl();
          label.setText(colVO.getColumnHeaderName());
          InputControl inputControl = null;
          if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_TEXT) ||
              customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_WHERE)) {
            inputControl = new TextControl();
            inputControl.setAttributeName(colVO.getAttributeName());
            if (colVO.getColumnSize().intValue()>10)
              ((TextControl)inputControl).setColumns(Math.min(30,colVO.getColumnSize().intValue()));
            ((TextControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
            ((TextControl)inputControl).setValue(customColVO.getDefaultValueTextSYS22());
            ((TextControl)inputControl).setMaxCharacters(colVO.getColumnSize().intValue());
          }
          else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_NUM)) {
            inputControl = new NumericControl();
            inputControl.setAttributeName(colVO.getAttributeName());
            if (colVO.getColumnSize().intValue()>10)
              ((NumericControl)inputControl).setColumns(Math.min(30,colVO.getColumnSize().intValue()));
            ((NumericControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
            ((NumericControl)inputControl).setValue(customColVO.getDefaultValueNumSYS22());
            ((NumericControl)inputControl).setMaxValue(Math.pow(10d,colVO.getColumnSize().doubleValue()));
            if (colVO.getColumnDec()!=null)
              ((NumericControl)inputControl).setDecimals(colVO.getColumnDec().intValue());
          }
          else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_DATE)) {
            inputControl = new DateControl();
            inputControl.setAttributeName(colVO.getAttributeName());
            ((DateControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
            ((DateControl)inputControl).setValue(customColVO.getDefaultValueNumSYS22());
            if (customColVO.getDefaultValueDateSYS22()!=null &&
                customColVO.getDefaultValueDateSYS22().equals(Boolean.TRUE))
              ((DateControl)inputControl).setValue(new java.sql.Date(System.currentTimeMillis()));
          }
          else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_ENUM) &&
                   customColVO.getConstraintValuesSYS22()!=null &&
                   customColVO.getConstraintValuesSYS22().length()>0) {
            inputControl = new ComboBoxControl();
            inputControl.setAttributeName(colVO.getAttributeName());
            ((ComboBoxControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
            ((ComboBoxControl)inputControl).setValue(customColVO.getDefaultValueNumSYS22());
            ArrayList domainValues = new ArrayList();
            StringTokenizer stt = new StringTokenizer(customColVO.getConstraintValuesSYS22(),",");
            String token = null;
            Domain domain = new Domain(colVO.getColumnName());
            while(stt.hasMoreTokens()) {
              token = stt.nextToken();
              domain.addDomainPair(token,token);
            }
            ((ComboBoxControl)inputControl).setDomain(domain);
          }

          // add label + input control to filter panel...
          filterPanel.add(label,       new GridBagConstraints(0, paramsDefined.size(), 1, 1, 0.0, 0.0
                  ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
          filterPanel.add((JComponent)inputControl,       new GridBagConstraints(1, paramsDefined.size(), 1, 1, 1.0, 0.0
                  ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));

          paramsDefined.add(inputControl);
        }
        colVO.setColumnVisible(customColVO.isColumnVisibleSYS22());
        if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_PROG)) {
          colVO.setProgressive(true);
          colVO.setColumnRequired(false);
        }
        if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_TEXT))
          colVO.setDefaultValue(customColVO.getDefaultValueTextSYS22());
        else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_NUM))
          colVO.setDefaultValue(customColVO.getDefaultValueNumSYS22());
        else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_DATE) &&
                 customColVO.getDefaultValueDateSYS22()!=null &&
                 customColVO.getDefaultValueDateSYS22().equals(Boolean.TRUE))
          colVO.setDefaultValue(new java.sql.Date(System.currentTimeMillis()));
        else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_ENUM) &&
                 customColVO.getConstraintValuesSYS22()!=null &&
                 customColVO.getConstraintValuesSYS22().length()>0) {
          ArrayList domainValues = new ArrayList();
          StringTokenizer stt = new StringTokenizer(customColVO.getConstraintValuesSYS22(),",");
          while(stt.hasMoreTokens())
            domainValues.add(stt.nextToken());
          colVO.setColumnValues(domainValues);
        }
      }


      // create grid panel...
      panel = new TablePanel(tableVO,tableVO.getMainTables().size()==0,!paramsRequired && vo.getAutoLoadDataSYS16());
      splitPane.add(panel, JSplitPane.BOTTOM);
      if (paramsDefined.size()>0)
        splitPane.setDividerLocation((paramsDefined.size()>5?0:150)+Math.min(paramsDefined.size()*30,300));
      else if (vo.getNoteSYS16()!=null && vo.getNoteSYS16().trim().length()>0)
        splitPane.setDividerLocation(150);
View Full Code Here


  public TablePanel(String sql,ArrayList mainTables,boolean convertColumnHeaders,boolean disableGrid,boolean autoLoadData) {
    try {
      grid.setAutoLoadData(autoLoadData);
      tableVO = new TableVO(sql,mainTables,convertColumnHeaders);
      Response res = ClientUtils.getData("getQueryInfo",tableVO);
      if (res.isError())
        JOptionPane.showMessageDialog(
          MDIFrame.getInstance(),
          ClientSettings.getInstance().getResources().getResource(res.getErrorMessage()),
View Full Code Here

          fk = (ForeignKeyVO)fks.get(vo.getColumnName());
          ((CodLookupColumn)col).setEnableCodBox(fk.getFkFieldNames().size()==1);

          // retrieve primary key table infos...
          String sql = "select * from "+fk.getPkTableName();
          TableVO auxVO = new TableVO(sql,new ArrayList(),false);
          Response res = ClientUtils.getData("getQueryInfo",auxVO);
          if (res.isError())
            JOptionPane.showMessageDialog(
              MDIFrame.getInstance(),
              ClientSettings.getInstance().getResources().getResource(res.getErrorMessage()),
View Full Code Here

      Map filteredColumns,
      ArrayList currentSortedColumns,
      ArrayList currentSortedVersusColumns,
      Class valueObjectType,
      Map otherGridParams) {
    TableVO tableVO = tablePanel.getTableVO();
    ArrayList rows = tableVO.getColumns();
    return new VOListResponse(rows,false,rows.size());
  }
View Full Code Here

TOP

Related Classes of org.jallinone.sqltool.java.TableVO

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.