Package org.jallinone.system.importdata.java

Examples of org.jallinone.system.importdata.java.SelectableFieldVO


    }
    catch (Exception ex) {
    }

    // check for grid content...
    SelectableFieldVO vo = null;
    boolean atLeastOne = false;
    for(int i=0;i< frame.getGrid().getVOListTableModel().getRowCount();i++) {
      vo = (SelectableFieldVO)frame.getGrid().getVOListTableModel().getObjectForRow(i);
      if (vo.isSelected()) {
        atLeastOne = true;
        if ((processVO.getFileFormatSYS23().equals("XLS") ||
             processVO.getFileFormatSYS23().equals("CSV1") ||
             processVO.getFileFormatSYS23().equals("CSV2")) &&
            vo.getField().getPosSYS24()==null)
          return new ErrorResponse("A mandatory column is empty.");
        if (processVO.getFileFormatSYS23().equals("TXT") &&
            (vo.getField().getStartPosSYS24()==null ||
             vo.getField().getEndPosSYS24()==null))
          return new ErrorResponse("A mandatory column is empty.");
      }
    }
    if (!atLeastOne)
      return new ErrorResponse("you must select at least one column");
View Full Code Here


            delimiters.add(new Integer(e.getX()));
          repaint();
        }
        else if (SwingUtilities.isRightMouseButton(e) &&
                 PreviewPanel.this.grid.getSelectedRow()!=-1) {
          SelectableFieldVO vo = (SelectableFieldVO)PreviewPanel.this.grid.getVOListTableModel().getObjectForRow(PreviewPanel.this.grid.getSelectedRow());
          int x1 = 0;
          int x2 = getWidth();
          int del = -1;
          int pos = -1;
          for(int i=0;i<delimiters.size();i++) {
            del = ((Integer)delimiters.get(i)).intValue();
            if (del<e.getX() && x1<del)
              x1 = del;
            else if (del>e.getX()&& del<x2)
              x2 = del;
          }
          if (x1!=-1 && x2!=-1) {
            vo.setSelected(true);

            if ("TXT".equals(fileFormat)) {
              vo.getField().setStartPosSYS24(new BigDecimal(x1/7+1));
              vo.getField().setEndPosSYS24(new BigDecimal(x2/7));
              if(PreviewPanel.this.grid.getSelectedRow()+1<PreviewPanel.this.grid.getVOListTableModel().getRowCount()) {
                PreviewPanel.this.grid.setRowSelectionInterval(PreviewPanel.this.grid.getSelectedRow()+1,PreviewPanel.this.grid.getSelectedRow()+1);
              }
            }
            else {
              if (x1==0) {
                vo.getField().setPosSYS24(new BigDecimal(1));
                if(PreviewPanel.this.grid.getSelectedRow()+1<PreviewPanel.this.grid.getVOListTableModel().getRowCount()) {
                  PreviewPanel.this.grid.setRowSelectionInterval(PreviewPanel.this.grid.getSelectedRow()+1,PreviewPanel.this.grid.getSelectedRow()+1);
                }
              }
              else
                for(int i=1;i<delimiters.size();i++) {
                  if (((Integer)delimiters.get(i-1)).intValue()==x1 &&
                      ((Integer)delimiters.get(i)).intValue()==x2) {
                    vo.getField().setPosSYS24(new BigDecimal(i+1));
                    if(PreviewPanel.this.grid.getSelectedRow()+1<PreviewPanel.this.grid.getVOListTableModel().getRowCount()) {
                      PreviewPanel.this.grid.setRowSelectionInterval(PreviewPanel.this.grid.getSelectedRow()+1,PreviewPanel.this.grid.getSelectedRow()+1);
                    }
                    break;
                  }
View Full Code Here

   * @param oldValue old cell value (before cell editing)
   * @param newValue new cell value (just edited)
   * @return <code>true</code> if cell value is valid, <code>false</code> otherwise
   */
  public boolean validateCell(int rowNumber,String attributeName,Object oldValue,Object newValue) {
    SelectableFieldVO vo = (SelectableFieldVO)frame.getGrid().getVOListTableModel().getObjectForRow(rowNumber);
    ETLProcessVO processVO = (ETLProcessVO)frame.getMainPanel().getVOModel().getValueObject();
    if ("TXT".equals(processVO.getFileFormatSYS23()) &&
        attributeName.equals("field.startPosSYS24") &&
        newValue!=null &&
        vo.getField().getEndPosSYS24()!=null &&
        ((Number)newValue).intValue()>vo.getField().getEndPosSYS24().intValue())
      return false;
    if ("TXT".equals(processVO.getFileFormatSYS23()) &&
        attributeName.equals("field.endPosSYS24") &&
        newValue!=null &&
        vo.getField().getStartPosSYS24()!=null &&
        ((Number)newValue).intValue()<vo.getField().getStartPosSYS24().intValue())
      return false;
    if (attributeName.equals("selected") && Boolean.FALSE.equals(newValue)) {
      vo.getField().setStartPosSYS24(null);
      vo.getField().setEndPosSYS24(null);
      vo.getField().setPosSYS24(null);
    }
    return true;
  }
View Full Code Here

   * @param row selected row index
   * @param attributeName attribute name that identifies the selected grid column
   * @return <code>true</code> if the selected cell is editable, <code>false</code> otherwise
   */
  public boolean isCellEditable(GridControl grid,int row,String attributeName) {
    SelectableFieldVO vo = (SelectableFieldVO)grid.getVOListTableModel().getObjectForRow(row);
    ETLProcessVO processVO = (ETLProcessVO)frame.getMainPanel().getVOModel().getValueObject();
    if (attributeName.equals("selected"))
      return true;
    if (vo.isSelected()) {
      if (("XLS".equals(processVO.getFileFormatSYS23()) ||
           "CSV1".equals(processVO.getFileFormatSYS23()) ||
           "CSV2".equals(processVO.getFileFormatSYS23())) &&
          attributeName.equals("field.posSYS24"))
        return true;
View Full Code Here

   * @param attributeName attribute name related to the column currently selected
   * @param value object contained in the selected cell
   * @return background color of the selected cell
   */
  public Color getBackgroundColor(int row,String attributeName,Object value) {
    SelectableFieldVO vo = (SelectableFieldVO)frame.getGrid().getVOListTableModel().getObjectForRow(row);
    ETLProcessVO processVO = (ETLProcessVO)frame.getMainPanel().getVOModel().getValueObject();
    if (vo.isRequired()) {
      Color c = new Color(200,100,100);
      if ("XLS".equals(processVO.getFileFormatSYS23()) && attributeName.equals("field.posSYS24") && value==null)
        return c;
      else if ("CSV1".equals(processVO.getFileFormatSYS23()) && attributeName.equals("field.posSYS24") && value==null)
        return c;
View Full Code Here

          vo = (ETLProcessFieldVO) vos.get(i);
          map.put(new FieldEntry(vo.getLanguageCodeSYS24(),vo.getFieldNameSYS24()), vo);
        }

        ArrayList rows = new ArrayList();
        SelectableFieldVO selVO = null;
        ImportDescriptorVO impVO = (ImportDescriptorVO) Class.forName(processVO.getClassNameSYS23()).newInstance();
        FieldEntry pk = null;
        for (int i = 0; i < impVO.getFields().length; i++) {
          pk = new FieldEntry(ApplicationConsts.JOLLY, impVO.getFields()[i]);
          if (map.containsKey(pk)) {
            vo = (ETLProcessFieldVO) map.get(pk);

            selVO = new SelectableFieldVO();
            selVO.setField(vo);
            selVO.setSelected(true);
            selVO.setLabel(p.getProperty(impVO.getLabels()[i]));
            selVO.setRequired(impVO.getRequiredFields().contains(impVO.getFields()[i]));
            rows.add(selVO);
          }
          else {
            vo = new ETLProcessFieldVO();
            vo.setFieldNameSYS24(impVO.getFields()[i]);
            vo.setLanguageCodeSYS24(ApplicationConsts.JOLLY);
            vo.setProgressiveSys23SYS24(processVO.getProgressiveSYS23());

            selVO = new SelectableFieldVO();
            selVO.setField(vo);
            selVO.setSelected(false);
            selVO.setLabel(p.getProperty(impVO.getLabels()[i]));
            selVO.setRequired(impVO.getRequiredFields().contains(impVO.
                getFields()[i]));
            rows.add(selVO);
          }
        } // end for

        // retrieve supported languages...
        res = langsBean.loadLanguages( serverLanguageId,username);
        if (res.isError())
          throw new Exception(res.getErrorMessage());
        java.util.List langsVO = ( (VOListResponse) res).getRows();

        // for each progressive SYS10 x language...
        Iterator it = impVO.getProgressiveSys10Fields().keySet().iterator();
        String field = null;
        LanguageVO langVO = null;
        while(it.hasNext()) {
          field = it.next().toString();
          for(int i=0;i<langsVO.size();i++) {
            langVO = (LanguageVO)langsVO.get(i);
            pk = new FieldEntry(langVO.getLanguageCodeSYS09(),field);
            if (map.containsKey(pk)) {
              vo = (ETLProcessFieldVO)map.get(new FieldEntry(langVO.getLanguageCodeSYS09(),field));

              selVO = new SelectableFieldVO();
              selVO.setField(vo);
              selVO.setSelected(true);
              selVO.setLabel(
                p.getProperty((String)impVO.getProgressiveSys10Fields().get(field))+
                " "+
                langVO.getDescriptionSYS09()
              );
              selVO.setRequired(impVO.getRequiredFields().contains(field));
              rows.add(selVO);
            }
            else {
              vo = new ETLProcessFieldVO();
              vo.setFieldNameSYS24(field);
              vo.setLanguageCodeSYS24(langVO.getLanguageCodeSYS09());
              vo.setProgressiveSys23SYS24(processVO.getProgressiveSYS23());

              selVO = new SelectableFieldVO();
              selVO.setField(vo);
              selVO.setSelected(false);
              selVO.setLabel(
                p.getProperty((String)impVO.getProgressiveSys10Fields().get(field))+
                " "+
                langVO.getDescriptionSYS09()
              );
              selVO.setRequired(impVO.getRequiredFields().contains(field));
              rows.add(selVO);
            }
          }

        } // end while on descriptions...

        // if a hierarchy level has been defined, create an object for each supported language...
        if (processVO.getProgressiveHIE02()!=null) {
          field = impVO.getHierarchyField();

          for(int i=0;i<langsVO.size();i++) {
            langVO = (LanguageVO)langsVO.get(i);
            pk = new FieldEntry(langVO.getLanguageCodeSYS09(),field);

            if (map.containsKey(pk)) {
              vo = (ETLProcessFieldVO)map.get(pk);

              selVO = new SelectableFieldVO();
              selVO.setField(vo);
              selVO.setSelected(true);
              selVO.setLabel(
                  p.getProperty("hierarchy") +
                  " " +
                  langVO.getDescriptionSYS09()
                  );
              selVO.setRequired(impVO.getRequiredFields().contains(field));
              rows.add(selVO);
            }
            else {

              vo = new ETLProcessFieldVO();
              vo.setFieldNameSYS24(field);
              vo.setLanguageCodeSYS24(langVO.getLanguageCodeSYS09());
              vo.setProgressiveSys23SYS24(processVO.getProgressiveSYS23());

              selVO = new SelectableFieldVO();
              selVO.setField(vo);
              selVO.setSelected(false);
              selVO.setLabel(
                p.getProperty("hierarchy")+
                " "+
                langVO.getDescriptionSYS09()
              );
              selVO.setRequired(impVO.getRequiredFields().contains(field));
              rows.add(selVO);
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.jallinone.system.importdata.java.SelectableFieldVO

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.