private void collectRelationalFields( Section section, final HashSet<String> list ) { while ( section != null ) { if ( section instanceof AbstractReportDefinition ) { return; } if ( section instanceof RelationalGroup ) { final RelationalGroup group = (RelationalGroup) section; list.addAll( group.getFields() ); } section = section.getParentSection(); } }
public List<SortConstraint> getSortingConstraint() { return mapFields( getFields() ); } }
/** * Adds a field to the group. The field names must correspond to the column names in the report's TableModel. * * @param name * the field name (null not permitted). * @throws NullPointerException * if the name is null */ public void addField( final String name ) { if ( name == null ) { throw new NullPointerException( "Group.addField(...): name is null." ); } final ArrayList<String> fieldsList = new ArrayList<String>( getFields() ); fieldsList.add( name ); Collections.sort( fieldsList ); setFieldsArray( fieldsList.toArray( new String[fieldsList.size()] ) ); }
/** * Returns a string representation of the group (useful for debugging). * * @return A string. */ public String toString() { final StringBuilder b = new StringBuilder( 120 ); b.append( "org.pentaho.reporting.engine.classic.core.RelationalGroup={Name='" ); b.append( getName() ); b.append( "', GeneratedName=" ); b.append( getGeneratedName() ); b.append( "', fields=" ); b.append( getFields() ); b.append( "} " ); return b.toString(); }
@Test public void testSetFields() { List<String> fields = new ArrayList<String>(); fields.add( "test_field" ); group.setFields( fields ); assertThat( (String[]) group.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.GROUP_FIELDS ), is( equalTo( new String[] { "test_field" } ) ) ); assertThat( group.getFields(), is( equalTo( fields ) ) ); }
XmlWriterSupport.OPEN ); final List fields = g.getFields(); if ( fields.isEmpty() == false ) { writer.writeTag( ExtParserModule.NAMESPACE, ReportDescriptionWriter.FIELDS_TAG, XmlWriterSupport.OPEN );
public void testCreate() throws Exception { final RelationalGroup g1 = new RelationalGroup(); assertNotNull( g1.clone() ); assertNotNull( g1.getFields() ); assertNotNull( g1.getFooter() ); assertNotNull( g1.getHeader() ); assertNotNull( g1.getName() ); assertNotNull( g1.toString() ); }