public void writeFieldResources(String strClassName)
    {
    	boolean bResourceListBundle = ResourceTypeField.LIST_RESOURCE_BUNDLE.equals(this.getRecord(ProgramControl.PROGRAM_CONTROL_FILE).getField(ProgramControl.RESOURCE_TYPE).toString());
        Record recClassInfo = this.getMainRecord();
        String strPackage = this.getPackage(bResourceListBundle ? CodeType.RESOURCE_CODE : CodeType.RESOURCE_PROPERTIES);
    // Now, write the field resources (descriptions)
        FieldStuff fieldStuff = new FieldStuff();
        String strBaseClass = "ListResourceBundle";
        String strClassSuffix = "Resources";
        boolean bResourceOnlyFile = false;
        if (RESOURCE_CLASS.equals(recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).toString()))
            bResourceOnlyFile = true;     // Resource only class
        if (bResourceOnlyFile)
            if (strClassName.endsWith(strClassSuffix))
                strClassSuffix = "";
        if (!bResourceListBundle)
        	strClassSuffix += ".properties";
        
        this.writeHeading(strClassName + strClassSuffix, strPackage, bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES);
        if (bResourceListBundle)
        {
	        m_StreamOut.writeit("package " + strPackage + ";\n\n");
	
	        m_StreamOut.writeit("import java.util.*;\n\n");
	        m_StreamOut.writeit("public class "+ strClassName + strClassSuffix + " extends " + strBaseClass + "\n");
	        m_StreamOut.writeit("{\n");
	        m_StreamOut.setTabs(+1);
	        m_StreamOut.writeit("public Object[][] getContents()\n");
	        m_StreamOut.writeit("{\n");
	        m_StreamOut.writeit("\treturn contents;\n");
	        m_StreamOut.writeit("}\n");
	
	        m_StreamOut.writeit("\n");
	        m_StreamOut.writeit("// To Localize this, just change the strings in the second column\n");
	        m_StreamOut.writeit("protected static final Object[][] contents =\n");
	        m_StreamOut.writeit("{\n");
	        m_StreamOut.setTabs(-1);
        }
        int count = 0;
        try   {
            Record recFieldData = this.getRecord(FieldData.FIELD_DATA_FILE);
            if (!bResourceOnlyFile)
            {
                recFieldData.close();
                while (recFieldData.hasNext())
                {
                    recFieldData.next();

                    this.getFieldData(fieldStuff, false);

                    {
                        if (bResourceListBundle)
                            if (count > 0)
                                m_StreamOut.writeit(",");
                        if (count > 0)
                            m_StreamOut.writeit("\n");
                        if (fieldStuff.strFieldDesc.equals("null"))
                            fieldStuff.strFieldDesc = fieldStuff.strFieldName;
                        if (bResourceListBundle)
                        	m_StreamOut.writeit("\t\t{\"" + ResourcesUtilities.fixPropertyKey(fieldStuff.strFieldName) + "\", " + ResourcesUtilities.fixPropertyValue(fieldStuff.strFieldDesc, bResourceListBundle) + "}");
                        else
                        	m_StreamOut.writeit(ResourcesUtilities.fixPropertyKey(fieldStuff.strFieldName) + "=" + ResourcesUtilities.fixPropertyValue(fieldStuff.strFieldDesc, bResourceListBundle));
                        count++;
                    }
                }
    // Now write out the tips
                this.readRecordClass(strClassName);     // Return the record to the original position
            }
            String strTipSuffix = DBConstants.TIP;
            if (bResourceOnlyFile)
                strTipSuffix = "";

            recFieldData.close();
            while (recFieldData.hasNext())
            {
                recFieldData.next();
                String strPre = DBConstants.BLANK;
                if (recFieldData.getField(FieldData.FIELD_NAME).getString().equals(recFieldData.getField(FieldData.BASE_FIELD_NAME).getString()))
                	if (recFieldData.getField(FieldData.FIELD_DESC_VERTICAL).getLength() == 0)
                	{
                        if (bResourceListBundle)
                        	strPre = "//";
                        else
                        	strPre = "# ";
                	}

                this.getFieldData(fieldStuff, false);

                if (fieldStuff.strFieldTip != null)
                {
                    if (bResourceListBundle)
                        if (count > 0)
                            m_StreamOut.writeit(",");
                    if (count > 0)
                        m_StreamOut.writeit("\n");

                    if (bResourceListBundle)
                    	m_StreamOut.writeit(strPre + "\t\t{\"" + ResourcesUtilities.fixPropertyKey(fieldStuff.strFieldName + strTipSuffix) + "\", " + ResourcesUtilities.fixPropertyValue(fieldStuff.strFieldTip, bResourceListBundle) + "}");
                    else
                    	m_StreamOut.writeit(strPre + ResourcesUtilities.fixPropertyKey(fieldStuff.strFieldName + strTipSuffix) + "=" + ResourcesUtilities.fixPropertyValue(fieldStuff.strFieldTip, bResourceListBundle));
                    count++;
                }
            }

            if (bResourceListBundle)
            {
	            m_StreamOut.writeit("\n");
	            m_StreamOut.setTabs(+1);
	            m_StreamOut.writeit("// END OF MATERIAL TO LOCALIZE\n");
	            m_StreamOut.writeit("};\n");
            }
            recFieldData.close();
            this.writeEndCode(bResourceListBundle);
        } catch (DBException ex)   {
            ex.printStackTrace();
        }
        this.readRecordClass(strClassName);     // Return the record to the original position
     }
public void writeFieldResources ( String strClassName ) { boolean bResourceListBundle = ResourceTypeField . LIST_RESOURCE_BUNDLE . equals ( this . getRecord ( ProgramControl . PROGRAM_CONTROL_FILE ) . getField ( ProgramControl . RESOURCE_TYPE ) . toString ( ) ) ; Record recClassInfo = this . getMainRecord ( ) ; String strPackage = this . getPackage ( bResourceListBundle ? CodeType . RESOURCE_CODE : CodeType . RESOURCE_PROPERTIES ) ; FieldStuff fieldStuff = new FieldStuff ( ) ; String strBaseClass = "ListResourceBundle" ; String strClassSuffix = "Resources" ; boolean bResourceOnlyFile = false ; if ( RESOURCE_CLASS . equals ( recClassInfo . getField ( ClassInfo . BASE_CLASS_NAME ) . toString ( ) ) ) bResourceOnlyFile = true ; if ( bResourceOnlyFile ) if ( strClassName . endsWith ( strClassSuffix ) ) strClassSuffix = "" ; if ( ! bResourceListBundle ) strClassSuffix += ".properties" ; this . writeHeading ( strClassName + strClassSuffix , strPackage , bResourceListBundle ? ClassProject . CodeType . RESOURCE_CODE : ClassProject . CodeType . RESOURCE_PROPERTIES ) ; if ( bResourceListBundle ) { m_StreamOut . writeit ( "package " + strPackage + ";\n\n" ) ; m_StreamOut . writeit ( "import java.util.*;\n\n" ) ; m_StreamOut . writeit ( "public class " + strClassName + strClassSuffix + " extends " + strBaseClass + "\n" ) ; m_StreamOut . writeit ( "{\n" ) ; m_StreamOut . setTabs ( + 1 ) ; m_StreamOut . writeit ( "public Object[][] getContents()\n" ) ; m_StreamOut . writeit ( "{\n" ) ; m_StreamOut . writeit ( "\treturn contents;\n" ) ; m_StreamOut . writeit ( "}\n" ) ; m_StreamOut . writeit ( "\n" ) ; m_StreamOut . writeit ( "// To Localize this, just change the strings in the second column\n" ) ; m_StreamOut . writeit ( "protected static final Object[][] contents =\n" ) ; m_StreamOut . writeit ( "{\n" ) ; m_StreamOut . setTabs ( - 1 ) ; } int count = 0 ; try { Record recFieldData = this . getRecord ( FieldData . FIELD_DATA_FILE ) ; if ( ! bResourceOnlyFile ) { recFieldData . close ( ) ; while ( recFieldData . hasNext ( ) ) { recFieldData . next ( ) ; this . getFieldData ( fieldStuff , false ) ; { if ( bResourceListBundle ) if ( count > 0 ) m_StreamOut . writeit ( "," ) ; if ( count > 0 ) m_StreamOut . writeit ( "\n" ) ; if ( fieldStuff . strFieldDesc . equals ( "null" ) ) fieldStuff . strFieldDesc = fieldStuff . strFieldName ; if ( bResourceListBundle ) m_StreamOut . writeit ( "\t\t{\"" + ResourcesUtilities . fixPropertyKey ( fieldStuff . strFieldName ) + "\", " + ResourcesUtilities . fixPropertyValue ( fieldStuff . strFieldDesc , bResourceListBundle ) + "}" ) ; else m_StreamOut . writeit ( ResourcesUtilities . fixPropertyKey ( fieldStuff . strFieldName ) + "=" + ResourcesUtilities . fixPropertyValue ( fieldStuff . strFieldDesc , bResourceListBundle ) ) ; count ++ ; } } this . readRecordClass ( strClassName ) ; } String strTipSuffix = DBConstants . TIP ; if ( bResourceOnlyFile ) strTipSuffix = "" ; recFieldData . close ( ) ; while ( recFieldData . hasNext ( ) ) { recFieldData . next ( ) ; String strPre = DBConstants . BLANK ; if ( recFieldData . getField ( FieldData . FIELD_NAME ) . getString ( ) . equals ( recFieldData . getField ( FieldData . BASE_FIELD_NAME ) . getString ( ) ) ) if ( recFieldData . getField ( FieldData . FIELD_DESC_VERTICAL ) . getLength ( ) == 0 ) { if ( bResourceListBundle ) strPre = "//" ; else strPre = "# " ; } this . getFieldData ( fieldStuff , false ) ; if ( fieldStuff . strFieldTip != null ) { if ( bResourceListBundle ) if ( count > 0 ) m_StreamOut . writeit ( "," ) ; if ( count > 0 ) m_StreamOut . writeit ( "\n" ) ; if ( bResourceListBundle ) m_StreamOut . writeit ( strPre + "\t\t{\"" + ResourcesUtilities . fixPropertyKey ( fieldStuff . strFieldName + strTipSuffix ) + "\", " + ResourcesUtilities . fixPropertyValue ( fieldStuff . strFieldTip , bResourceListBundle ) + "}" ) ; else m_StreamOut . writeit ( strPre + ResourcesUtilities . fixPropertyKey ( fieldStuff . strFieldName + strTipSuffix ) + "=" + ResourcesUtilities . fixPropertyValue ( fieldStuff . strFieldTip , bResourceListBundle ) ) ; count ++ ; } } if ( bResourceListBundle ) { m_StreamOut . writeit ( "\n" ) ; m_StreamOut . setTabs ( + 1 ) ; m_StreamOut . writeit ( "// END OF MATERIAL TO LOCALIZE\n" ) ; m_StreamOut . writeit ( "};\n" ) ; } recFieldData . close ( ) ; this . writeEndCode ( bResourceListBundle ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } this . readRecordClass ( strClassName ) ; }
Write the resource file for this record class