Create the field view.
@param screenFieldClass The screen field Class
@param The model to create a view for.
@return The new view for this model.
506697
public ScreenFieldView getViewClassForModel(Class<?> screenFieldClass)
    {
        while (screenFieldClass != null)
        {
            String strModelClassName = screenFieldClass.getName();
            String strViewClassName = null;
            if (ENABLE_CACHE)
                strViewClassName = m_classCache.getProperty(strModelClassName);   // Name in cache?
            if (strViewClassName == null)
                strViewClassName = this.getViewClassNameFromModelClassName(strModelClassName);
            if (strViewClassName != null)
            {   // Great, found the class name. Try to instantiate the class.
            	ScreenFieldView view = (ScreenFieldView)ClassServiceUtility.getClassService().makeObjectFromClassName(strViewClassName);	// Ignore class not found
                if (view != null)
                {
                    if (ENABLE_CACHE)
                        m_classCache.setProperty(strModelClassName, strViewClassName);  // Success - cache the name for later
                    return view;
                }
            }
            screenFieldClass = screenFieldClass.getSuperclass();
        }
        return null;
    }
1018115
public static Field getFieldFromClass(String field, Class<? extends Object> clazz) {
        try {
            return clazz.getDeclaredField(field);
        } catch (Exception e) {
            try {
                return clazz.getField(field);
            } catch (Exception ex) {
            }
        }
        return null;
    }
712074
public void setupSFields()
    {
        BaseField field = this.getMainRecord().getField(ProgramControl.PROJECT_NAME);
        field.setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), this, ScreenConstants.DEFAULT_DISPLAY);
        
        SCannedBox button = new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, ProgramControl.SET_DEFAULT_COMMAND, Constants.SUBMIT, ProgramControl.SET_DEFAULT_COMMAND, null);
        
        field.setHidden(true);
        super.setupSFields();
        field.setHidden(false);
    }
1000105
public Converter getFieldConverter()
    {
        for (int i = 0; ; i++)
        {
            Object ojbComponent = this.getField().getComponent(i);
            if (ojbComponent == null)
                break;
            if (ojbComponent instanceof ScreenComponent)
            {
                Converter conv = (Converter)((ScreenComponent)ojbComponent).getConverter();
                if ((conv != null) && (conv.getField() == this.getField()))
                    return conv;   // Since there is a converter in front of this field, return the converter
            }
        }
        return this;
    }
1062925
private Optional<MapPositionSetter> createField(final Class<?> beanClass, final String fieldName) {
        
        final String positionFieldName = fieldName + "Position";
        
        final Field positionField;
        try {
            positionField = beanClass.getDeclaredField(positionFieldName);
            positionField.setAccessible(true);
            
        } catch (NoSuchFieldException | SecurityException e) {
            return Optional.empty();
        }
        
        if(!Map.class.isAssignableFrom(positionField.getType())) {
            return Optional.empty();
        }
        
        final ParameterizedType type = (ParameterizedType) positionField.getGenericType();
        final Class<?> keyType = (Class<?>) type.getActualTypeArguments()[0];
        final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[1];
        
        if(keyType.equals(String.class) && valueType.equals(CellPosition.class)) {
            
            return Optional.of(new MapPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                   try {
                       Map<String, CellPosition> positionMapObj = (Map<String, CellPosition>) positionField.get(beanObj);
                       if(positionMapObj == null) {
                           positionMapObj = new LinkedHashMap<>();
                           positionField.set(beanObj, positionMapObj);
                       }
                       
                       positionMapObj.put(key, position);
                       
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
            
        } else if(keyType.equals(String.class) && valueType.equals(Point.class)) {
            
            return Optional.of(new MapPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        Map<String, Point> positionMapObj = (Map<String, Point>) positionField.get(beanObj);
                        if(positionMapObj == null) {
                            positionMapObj = new LinkedHashMap<>();
                            positionField.set(beanObj, positionMapObj);
                        }
                        
                        
                        positionMapObj.put(key, position.toPoint());
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
            
        } else if(keyType.equals(String.class) && valueType.equals(CellAddress.class)) {
            
            return Optional.of(new MapPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        Map<String, CellAddress> positionMapObj = (Map<String, CellAddress>) positionField.get(beanObj);
                        if(positionMapObj == null) {
                            positionMapObj = new LinkedHashMap<>();
                            positionField.set(beanObj, positionMapObj);
                        }
                        
                        
                        positionMapObj.put(key, position.toCellAddress());
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
        
        }
        
        return Optional.empty();
    }
1032066
public void setupSFields()
    {
        Converter fieldConverter = this.getScreenRecord().getField(UserScreenRecord.STATUS_LINE);
        new SStaticText(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, fieldConverter, ScreenConstants.DONT_DISPLAY_FIELD_DESC);
        this.getRecord(UserScreenRecord.USER_SCREEN_RECORD_FILE).getField(UserScreenRecord.USER).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        Converter converter = new HashSHAConverter(this.getScreenRecord().getField(UserScreenRecord.PASSWORD));
        converter = new FieldLengthConverter(converter, 20);
        converter.setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(UserScreenRecord.USER_SCREEN_RECORD_FILE).getField(UserScreenRecord.SAVEUSER).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        SCannedBox loginButton = new SCannedBox(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.LOGIN);
        loginButton.setRequestFocusEnabled(true);
        BaseApplication application = (BaseApplication)this.getTask().getApplication();
        String strDesc = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(UserEntryScreen.CREATE_NEW_USER);
        String strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserEntryScreen.class.getName());
        new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.DONT_SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, strCommand, MenuConstants.FORM + "Tip");
        this.setDefaultButton(loginButton);
    }
419604
public void setupSFields()
    {
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.CODE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.NAME).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.COMMENT).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.SEQUENCE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.PART_ID).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.CLASS_PROJECT_ID).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.CODE_TYPE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.RECURSIVE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.EXCLUDE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(Packages.PACKAGES_FILE).getField(Packages.MANUAL).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
    }
1095586
public static ScreenComponent createScreenComponent(String componentType, ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String,Object> properties)
    {
        String screenFieldClass = null;
        if (!componentType.contains("."))
            screenFieldClass = ScreenModel.BASE_PACKAGE + componentType;
        else if (componentType.startsWith("."))
            screenFieldClass = DBConstants.ROOT_PACKAGE + componentType.substring(1);
        else
            screenFieldClass = componentType;
        ScreenComponent screenField = (ScreenComponent)ClassServiceUtility.getClassService().makeObjectFromClassName(screenFieldClass);
        if (screenField == null)
        {
            Utility.getLogger().warning("Screen component not found " + componentType);
            screenField = (ScreenComponent)ClassServiceUtility.getClassService().makeObjectFromClassName(ScreenModel.BASE_PACKAGE + ScreenModel.EDIT_TEXT);
        }
        screenField.init(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
        return screenField;
    }
220860
private Optional<MapLabelSetter> createField(final Class<?> beanClass, final String fieldName) {
        
        final String labelFieldName = fieldName + "Label";
        
        final Field labelField;
        try {
            labelField = beanClass.getDeclaredField(labelFieldName);
            labelField.setAccessible(true);
            
        } catch (NoSuchFieldException | SecurityException e) {
            return Optional.empty();
        }
        
        if(!Map.class.isAssignableFrom(labelField.getType())) {
            return Optional.empty();
        }
        
        final ParameterizedType type = (ParameterizedType) labelField.getGenericType();
        final Class<?> keyType = (Class<?>) type.getActualTypeArguments()[0];
        final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[1];
        
        if(keyType.equals(String.class) && valueType.equals(String.class)) {
            
            return Optional.of(new MapLabelSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final String label, final String key) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notEmpty(label, "label");
                    
                   try {
                       Map<String, String> labelMapObj = (Map<String, String>) labelField.get(beanObj);
                       if(labelMapObj == null) {
                           labelMapObj = new LinkedHashMap<>();
                           labelField.set(beanObj, labelMapObj);
                       }
                       
                       
                       labelMapObj.put(key, label);
                       
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access label field.", e);
                    }
                }
            });
            
        }
        
        return Optional.empty();
    }
216894
private Optional<ArrayPositionSetter> createField(final Class<?> beanClass, final String fieldName) {
        
        final String positionFieldName = fieldName + "Position";
        
        final Field positionField;
        try {
            positionField = beanClass.getDeclaredField(positionFieldName);
            positionField.setAccessible(true);
            
        } catch (NoSuchFieldException | SecurityException e) {
            return Optional.empty();
        }
        
        if(!List.class.isAssignableFrom(positionField.getType())) {
            return Optional.empty();
        }
        
        final ParameterizedType type = (ParameterizedType) positionField.getGenericType();
        final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[0];
        
        if(valueType.equals(CellPosition.class)) {
            
            return Optional.of(new ArrayPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                   try {
                       List<CellPosition> positionListObj = (List<CellPosition>) positionField.get(beanObj);
                       if(positionListObj == null) {
                           positionListObj = new ArrayList<>();
                           positionField.set(beanObj, positionListObj);
                       }
                       
                       Utils.addListWithIndex(positionListObj, position, index);
                       
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
            
        } else if(valueType.equals(Point.class)) {
            
            return Optional.of(new ArrayPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        List<Point> positionListObj = (List<Point>) positionField.get(beanObj);
                        if(positionListObj == null) {
                            positionListObj = new ArrayList<>();
                            positionField.set(beanObj, positionListObj);
                        }
                        
                        
                        Utils.addListWithIndex(positionListObj, position.toPoint(), index);
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
            
        } else if(valueType.equals(CellAddress.class)) {
            
            return Optional.of(new ArrayPositionSetter() {
                
                @SuppressWarnings("unchecked")
                @Override
                public void set(final Object beanObj, final CellPosition position, final int index) {
                    ArgUtils.notNull(beanObj, "beanObj");
                    ArgUtils.notNull(position, "position");
                    
                    try {
                        List<CellAddress> positionListObj = (List<CellAddress>) positionField.get(beanObj);
                        if(positionListObj == null) {
                            positionListObj = new ArrayList<>();
                            positionField.set(beanObj, positionListObj);
                        }
                        
                        Utils.addListWithIndex(positionListObj, position.toCellAddress(), index);
                        
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new RuntimeException("fail access position field.", e);
                    }
                }
            });
        
        }
        
        return Optional.empty();
    }
715082
@Override
    public Screen createScreen(Config config)
    {
        Check.notNull(config);

        return new ScreenHeadless(config);
    }
203486
public void printScreenFieldData(ScreenComponent sField, PrintWriter out, int iPrintOptions)
    {
        ((ScreenField)sField).printData(out, iPrintOptions);
    }
1235283
public void setupSFields()
    {
        Converter converter = new FieldLengthConverter(this.getRecord(Resource.RESOURCE_FILE).getField(Resource.CODE), 30);
        new SEditText(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this,converter, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ResourceScreenRecord.RESOURCE_SCREEN_RECORD_FILE).getField(ResourceScreenRecord.LANGUAGE).setupDefaultView(this.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ResourceScreenRecord.RESOURCE_SCREEN_RECORD_FILE).getField(ResourceScreenRecord.LOCALE).setupDefaultView(this.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
    }
787830
public void setupSFields()
    {
        this.getRecord(ClassProject.CLASS_PROJECT_FILE).getField(ClassProject.NAME).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassProject.CLASS_PROJECT_FILE).getField(ClassProject.DESCRIPTION).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassProject.CLASS_PROJECT_FILE).getField(ClassProject.PROJECT_PATH).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassProject.CLASS_PROJECT_FILE).getField(ClassProject.THIN_PROJECT_PATH).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassProject.CLASS_PROJECT_FILE).getField(ClassProject.RES_PROJECT_PATH).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassProject.CLASS_PROJECT_FILE).getField(ClassProject.PACKAGE_NAME).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
    }
1186565
public FieldResult<EntityResult<T>> getOrCreateFieldResult()
   {
      List<Node> nodeList = childNode.get("field-result");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FieldResultImpl<EntityResult<T>>(this, "field-result", childNode, nodeList.get(0));
      }
      return createFieldResult();
   }
199428
public void displayField()                  // init this field override for other value
    {
        if (m_vScreenField == null)
            return;
        for (Enumeration<Object> e = m_vScreenField.elements() ; e.hasMoreElements() ;) { 
            ScreenComponent sField = (ScreenComponent)e.nextElement();
            sField.fieldToControl();    // Display using the new value(s)
        }
    }
42183
public void setupSFields()
    {
        this.getRecord(ClassInfoScreenRecord.CLASS_INFO_SCREEN_RECORD_FILE).getField(ClassInfoScreenRecord.CLASS_PROJECT_ID).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassInfoScreenRecord.CLASS_INFO_SCREEN_RECORD_FILE).getField(ClassInfoScreenRecord.NAME).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
        this.getRecord(ClassInfoScreenRecord.CLASS_INFO_SCREEN_RECORD_FILE).getField(ClassInfoScreenRecord.PACKAGE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
    }