Package org.omnaest.i18nbinder.internal.XLSFile

Examples of org.omnaest.i18nbinder.internal.XLSFile.TableRow


    assertEquals( 6 + 1, tableRowList.size() );
   
    //
    int index = 0;
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "File", "Property key", "", "de_DE", "en_US" ), tableRow );
    }
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "my.property.key1", "", "wert1", "value1" ), tableRow.subList( 1, tableRow.size() ) );
    }
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "my.property.key2", "", "wert2", "value2" ), tableRow.subList( 1, tableRow.size() ) );
    }
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "my.property.key9", "value9", "", "" ), tableRow.subList( 1, tableRow.size() ) );
    }
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "my.property.key1", "", "wert1", "value1" ), tableRow.subList( 1, tableRow.size() ) );
    }
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "my.property.key3", "", "", "value3" ), tableRow.subList( 1, tableRow.size() ) );
    }
    {
      TableRow tableRow = tableRowList.get( index++ );
      assertEquals( Arrays.asList( "my.property.key4", "", "wert4", "" ), tableRow.subList( 1, tableRow.size() ) );
    }
  }
View Full Code Here


    //
    String propertyKey = "new.key";
    List<String> propertyValueList = Arrays.asList( "new.value" );
   
    //
    TableRow tableRow = new TableRow();
    tableRow.addAll( tableRowList.get( tableRowList.size() - 1 ) );
    tableRow.set( 1, propertyKey );
    tableRow.set( 2, propertyValueList.get( 0 ) );
    xlsFile.getTableRowList().add( tableRow );
   
    //
    xlsFile.setFile( this.xlsFile );
    xlsFile.store();
   
    //
    ModifierHelper.writeXLSFileContentToPropertyFiles( xlsFile.getFile(), null, new LocaleFilter(), true,
                                                       useJavaStyleUnicodeEscaping );
   
    //
    String locale = tableRowList.get( 0 ).get( 2 );
    String propertyFileName = tableRow.get( 0 ).replaceAll( Pattern.quote( "{locale}" ), locale );
    PropertyFile propertyFile = new PropertyFile( propertyFileName );
   
    //
    assertTrue( propertyFile.getFile().exists() );
   
    //
    propertyFile.load();
    PropertyFileContent propertyFileContent = propertyFile.getPropertyFileContent();
   
    //
    assertTrue( propertyFileContent.hasPropertyKeyAndValueList( propertyKey, propertyValueList ) );
   
    //clean up
    {
      //
      propertyFileName = tableRow.get( 0 ).replaceAll( Pattern.quote( "{locale}" ), "" );
      propertyFile = new PropertyFile( propertyFileName );
      propertyFile.load();
      propertyFile.getPropertyFileContent().getPropertyMap().remove( propertyKey );
      propertyFile.store();
     
      //
      propertyFileName = tableRow.get( 0 ).replaceAll( Pattern.quote( "{locale}" ), "de_DE" );
      propertyFile = new PropertyFile( propertyFileName );
      propertyFile.load();
      propertyFile.getPropertyFileContent().getPropertyMap().remove( propertyKey );
      propertyFile.store();
    }
View Full Code Here

     
      //
      List<String> localeList = new ArrayList<String>();
      {
        //
        TableRow tableRow = tableRowList.get( 0 );
        localeList.addAll( tableRow.subList( 2, tableRow.size() ) );
        localeList.remove( null );
       
        //
        for ( String locale : new ArrayList<String>( localeList ) )
        {
          if ( !localeFilter.isLocaleAccepted( locale ) )
          {
            localeList.remove( locale );
          }
        }
      }
     
      //  
      FilenameToPropertyKeyToValueMap filenameToPropertyKeyToValueMap = new FilenameToPropertyKeyToValueMap();
      for ( TableRow tableRow : tableRowList.subList( 1, tableRowList.size() ) )
      {
        //
        String fileNameLocaleIndependent = tableRow.get( 0 );
        String propertyKey = tableRow.get( 1 );
       
        //
        ModifierHelper.logger.info( "Processing: " + fileNameLocaleIndependent + " " + propertyKey );
       
        //
        int index = 2;
        for ( String locale : localeList )
        {
          //
          try
          {
            //
            String value = tableRow.get( index++ );
           
            //
            String fileName = fileNameLocaleIndependent.replaceAll( Pattern.quote( GROUPING_PATTERN_REPLACEMENT_PATTERN_STRING ),
                                                                    locale );
           
View Full Code Here

        List<TableRow> tableRowList = xlsFile.getTableRowList();
       
        //titles
        {
          //
          TableRow tableRow = new TableRow();
          tableRow.add( "File" );
          tableRow.add( "Property key" );
          tableRow.addAll( localeList );
         
          //
          tableRowList.add( tableRow );
        }
       
        //
        for ( FileGroupToPropertiesAdapter fileGroupToPropertiesAdapter : fileGroupToPropertiesAdapterList )
        {
          //
          String fileGroupIdentifier = fileGroupToPropertiesAdapter.getFileGroup().getFileGroupIdentifier();
         
          //
          ModifierHelper.logger.info( "Processing: " + fileGroupIdentifier );
         
          //
          List<String> propertyKeyList = new ArrayList<String>( fileGroupToPropertiesAdapter.determinePropertyKeySet() );
          Collections.sort( propertyKeyList );
          for ( String propertyKey : propertyKeyList )
          {
            //
            TableRow tableRow = new TableRow();
            tableRow.add( fileGroupIdentifier );
            tableRow.add( propertyKey );
           
            //
            for ( String locale : localeList )
            {
              //
              String value = fileGroupToPropertiesAdapter.resolvePropertyValue( propertyKey, locale );
             
              //
              value = StringUtils.defaultString( value );
             
              //
              tableRow.add( value );
            }
           
            //
            tableRowList.add( tableRow );
          }
View Full Code Here

TOP

Related Classes of org.omnaest.i18nbinder.internal.XLSFile.TableRow

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.