id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
159,200
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/Util.java
|
Util.filterListToMap
|
public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
final List<? extends T> sourceList) {
if( destinationMap == null ) {
throw new NullPointerException("destinationMap should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
} else if( sourceList == null ) {
throw new NullPointerException("sourceList should not be null");
} else if( nameMapping.length != sourceList.size() ) {
throw new SuperCsvException(
String
.format(
"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)",
nameMapping.length, sourceList.size()));
}
destinationMap.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String key = nameMapping[i];
if( key == null ) {
continue; // null's in the name mapping means skip column
}
// no duplicates allowed
if( destinationMap.containsKey(key) ) {
throw new SuperCsvException(String.format("duplicate nameMapping '%s' at index %d", key, i));
}
destinationMap.put(key, sourceList.get(i));
}
}
|
java
|
public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
final List<? extends T> sourceList) {
if( destinationMap == null ) {
throw new NullPointerException("destinationMap should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
} else if( sourceList == null ) {
throw new NullPointerException("sourceList should not be null");
} else if( nameMapping.length != sourceList.size() ) {
throw new SuperCsvException(
String
.format(
"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)",
nameMapping.length, sourceList.size()));
}
destinationMap.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String key = nameMapping[i];
if( key == null ) {
continue; // null's in the name mapping means skip column
}
// no duplicates allowed
if( destinationMap.containsKey(key) ) {
throw new SuperCsvException(String.format("duplicate nameMapping '%s' at index %d", key, i));
}
destinationMap.put(key, sourceList.get(i));
}
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"filterListToMap",
"(",
"final",
"Map",
"<",
"String",
",",
"T",
">",
"destinationMap",
",",
"final",
"String",
"[",
"]",
"nameMapping",
",",
"final",
"List",
"<",
"?",
"extends",
"T",
">",
"sourceList",
")",
"{",
"if",
"(",
"destinationMap",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"destinationMap should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"nameMapping",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"nameMapping should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"sourceList",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"sourceList should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"nameMapping",
".",
"length",
"!=",
"sourceList",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"SuperCsvException",
"(",
"String",
".",
"format",
"(",
"\"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)\"",
",",
"nameMapping",
".",
"length",
",",
"sourceList",
".",
"size",
"(",
")",
")",
")",
";",
"}",
"destinationMap",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameMapping",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"String",
"key",
"=",
"nameMapping",
"[",
"i",
"]",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"continue",
";",
"// null's in the name mapping means skip column",
"}",
"// no duplicates allowed",
"if",
"(",
"destinationMap",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"SuperCsvException",
"(",
"String",
".",
"format",
"(",
"\"duplicate nameMapping '%s' at index %d\"",
",",
"key",
",",
"i",
")",
")",
";",
"}",
"destinationMap",
".",
"put",
"(",
"key",
",",
"sourceList",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}"
] |
Converts a List to a Map using the elements of the nameMapping array as the keys of the Map.
@param destinationMap
the destination Map (which is cleared before it's populated)
@param nameMapping
the keys of the Map (corresponding with the elements in the sourceList). Cannot contain duplicates.
@param sourceList
the List to convert
@param <T>
the type of the values in the map
@throws NullPointerException
if destinationMap, nameMapping or sourceList are null
@throws SuperCsvException
if nameMapping and sourceList are not the same size
|
[
"Converts",
"a",
"List",
"to",
"a",
"Map",
"using",
"the",
"elements",
"of",
"the",
"nameMapping",
"array",
"as",
"the",
"keys",
"of",
"the",
"Map",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/Util.java#L114-L146
|
159,201
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/Util.java
|
Util.filterMapToList
|
public static List<Object> filterMapToList(final Map<String, ?> map, final String[] nameMapping) {
if( map == null ) {
throw new NullPointerException("map should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
}
final List<Object> result = new ArrayList<Object>(nameMapping.length);
for( final String key : nameMapping ) {
result.add(map.get(key));
}
return result;
}
|
java
|
public static List<Object> filterMapToList(final Map<String, ?> map, final String[] nameMapping) {
if( map == null ) {
throw new NullPointerException("map should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
}
final List<Object> result = new ArrayList<Object>(nameMapping.length);
for( final String key : nameMapping ) {
result.add(map.get(key));
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"Object",
">",
"filterMapToList",
"(",
"final",
"Map",
"<",
"String",
",",
"?",
">",
"map",
",",
"final",
"String",
"[",
"]",
"nameMapping",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"map should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"nameMapping",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"nameMapping should not be null\"",
")",
";",
"}",
"final",
"List",
"<",
"Object",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
"nameMapping",
".",
"length",
")",
";",
"for",
"(",
"final",
"String",
"key",
":",
"nameMapping",
")",
"{",
"result",
".",
"add",
"(",
"map",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns a List of all of the values in the Map whose key matches an entry in the nameMapping array.
@param map
the map
@param nameMapping
the keys of the Map values to add to the List
@return a List of all of the values in the Map whose key matches an entry in the nameMapping array
@throws NullPointerException
if map or nameMapping is null
|
[
"Returns",
"a",
"List",
"of",
"all",
"of",
"the",
"values",
"in",
"the",
"Map",
"whose",
"key",
"matches",
"an",
"entry",
"in",
"the",
"nameMapping",
"array",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/Util.java#L159-L171
|
159,202
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/Util.java
|
Util.filterMapToObjectArray
|
public static Object[] filterMapToObjectArray(final Map<String, ?> values, final String[] nameMapping) {
if( values == null ) {
throw new NullPointerException("values should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
}
final Object[] targetArray = new Object[nameMapping.length];
int i = 0;
for( final String name : nameMapping ) {
targetArray[i++] = values.get(name);
}
return targetArray;
}
|
java
|
public static Object[] filterMapToObjectArray(final Map<String, ?> values, final String[] nameMapping) {
if( values == null ) {
throw new NullPointerException("values should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
}
final Object[] targetArray = new Object[nameMapping.length];
int i = 0;
for( final String name : nameMapping ) {
targetArray[i++] = values.get(name);
}
return targetArray;
}
|
[
"public",
"static",
"Object",
"[",
"]",
"filterMapToObjectArray",
"(",
"final",
"Map",
"<",
"String",
",",
"?",
">",
"values",
",",
"final",
"String",
"[",
"]",
"nameMapping",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"values should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"nameMapping",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"nameMapping should not be null\"",
")",
";",
"}",
"final",
"Object",
"[",
"]",
"targetArray",
"=",
"new",
"Object",
"[",
"nameMapping",
".",
"length",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"final",
"String",
"name",
":",
"nameMapping",
")",
"{",
"targetArray",
"[",
"i",
"++",
"]",
"=",
"values",
".",
"get",
"(",
"name",
")",
";",
"}",
"return",
"targetArray",
";",
"}"
] |
Converts a Map to an array of objects, adding only those entries whose key is in the nameMapping array.
@param values
the Map of values to convert
@param nameMapping
the keys to extract from the Map (elements in the target array will be added in this order)
@return the array of Objects
@throws NullPointerException
if values or nameMapping is null
|
[
"Converts",
"a",
"Map",
"to",
"an",
"array",
"of",
"objects",
"adding",
"only",
"those",
"entries",
"whose",
"key",
"is",
"in",
"the",
"nameMapping",
"array",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/Util.java#L184-L198
|
159,203
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/IsIncludedIn.java
|
IsIncludedIn.checkPreconditions
|
private static void checkPreconditions(final Set<Object> possibleValues) {
if( possibleValues == null ) {
throw new NullPointerException("possibleValues Set should not be null");
} else if( possibleValues.isEmpty() ) {
throw new IllegalArgumentException("possibleValues Set should not be empty");
}
}
|
java
|
private static void checkPreconditions(final Set<Object> possibleValues) {
if( possibleValues == null ) {
throw new NullPointerException("possibleValues Set should not be null");
} else if( possibleValues.isEmpty() ) {
throw new IllegalArgumentException("possibleValues Set should not be empty");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"Set",
"<",
"Object",
">",
"possibleValues",
")",
"{",
"if",
"(",
"possibleValues",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"possibleValues Set should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"possibleValues",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"possibleValues Set should not be empty\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new IsIncludedIn processor with a Set of Objects.
@param possibleValues
the Set of possible values
@throws NullPointerException
if possibleValues is null
@throws IllegalArgumentException
if possibleValues is empty
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"IsIncludedIn",
"processor",
"with",
"a",
"Set",
"of",
"Objects",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/IsIncludedIn.java#L128-L134
|
159,204
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/Truncate.java
|
Truncate.checkPreconditions
|
private static void checkPreconditions(final int maxSize, final String suffix) {
if( maxSize <= 0 ) {
throw new IllegalArgumentException(String.format("maxSize should be > 0 but was %d", maxSize));
}
if( suffix == null ) {
throw new NullPointerException("suffix should not be null");
}
}
|
java
|
private static void checkPreconditions(final int maxSize, final String suffix) {
if( maxSize <= 0 ) {
throw new IllegalArgumentException(String.format("maxSize should be > 0 but was %d", maxSize));
}
if( suffix == null ) {
throw new NullPointerException("suffix should not be null");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"int",
"maxSize",
",",
"final",
"String",
"suffix",
")",
"{",
"if",
"(",
"maxSize",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"maxSize should be > 0 but was %d\"",
",",
"maxSize",
")",
")",
";",
"}",
"if",
"(",
"suffix",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"suffix should not be null\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new Truncate processor.
@param maxSize
the maximum size of the String
@param suffix
the String to append if the input is truncated (e.g. "...")
@throws IllegalArgumentException
if {@code maxSize <= 0}
@throws NullPointerException
if suffix is null
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"Truncate",
"processor",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/Truncate.java#L128-L135
|
159,205
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/io/AbstractCsvWriter.java
|
AbstractCsvWriter.writeRow
|
protected void writeRow(final String... columns) throws IOException {
if( columns == null ) {
throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
} else if( columns.length == 0 ) {
throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
lineNumber));
}
StringBuilder builder = new StringBuilder();
for( int i = 0; i < columns.length; i++ ) {
columnNumber = i + 1; // column no used by CsvEncoder
if( i > 0 ) {
builder.append((char) preference.getDelimiterChar()); // delimiter
}
final String csvElement = columns[i];
if( csvElement != null ) {
final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
final String escapedCsv = encoder.encode(csvElement, context, preference);
builder.append(escapedCsv);
lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
}
}
builder.append(preference.getEndOfLineSymbols()); // EOL
writer.write(builder.toString());
}
|
java
|
protected void writeRow(final String... columns) throws IOException {
if( columns == null ) {
throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
} else if( columns.length == 0 ) {
throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
lineNumber));
}
StringBuilder builder = new StringBuilder();
for( int i = 0; i < columns.length; i++ ) {
columnNumber = i + 1; // column no used by CsvEncoder
if( i > 0 ) {
builder.append((char) preference.getDelimiterChar()); // delimiter
}
final String csvElement = columns[i];
if( csvElement != null ) {
final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
final String escapedCsv = encoder.encode(csvElement, context, preference);
builder.append(escapedCsv);
lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
}
}
builder.append(preference.getEndOfLineSymbols()); // EOL
writer.write(builder.toString());
}
|
[
"protected",
"void",
"writeRow",
"(",
"final",
"String",
"...",
"columns",
")",
"throws",
"IOException",
"{",
"if",
"(",
"columns",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"String",
".",
"format",
"(",
"\"columns to write should not be null on line %d\"",
",",
"lineNumber",
")",
")",
";",
"}",
"else",
"if",
"(",
"columns",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"columns to write should not be empty on line %d\"",
",",
"lineNumber",
")",
")",
";",
"}",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columns",
".",
"length",
";",
"i",
"++",
")",
"{",
"columnNumber",
"=",
"i",
"+",
"1",
";",
"// column no used by CsvEncoder",
"if",
"(",
"i",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"(",
"char",
")",
"preference",
".",
"getDelimiterChar",
"(",
")",
")",
";",
"// delimiter",
"}",
"final",
"String",
"csvElement",
"=",
"columns",
"[",
"i",
"]",
";",
"if",
"(",
"csvElement",
"!=",
"null",
")",
"{",
"final",
"CsvContext",
"context",
"=",
"new",
"CsvContext",
"(",
"lineNumber",
",",
"rowNumber",
",",
"columnNumber",
")",
";",
"final",
"String",
"escapedCsv",
"=",
"encoder",
".",
"encode",
"(",
"csvElement",
",",
"context",
",",
"preference",
")",
";",
"builder",
".",
"append",
"(",
"escapedCsv",
")",
";",
"lineNumber",
"=",
"context",
".",
"getLineNumber",
"(",
")",
";",
"// line number can increment when encoding multi-line columns",
"}",
"}",
"builder",
".",
"append",
"(",
"preference",
".",
"getEndOfLineSymbols",
"(",
")",
")",
";",
"// EOL",
"writer",
".",
"write",
"(",
"builder",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Writes one or more String columns as a line to the CsvWriter.
@param columns
the columns to write
@throws IllegalArgumentException
if columns.length == 0
@throws IOException
If an I/O error occurs
@throws NullPointerException
if columns is null
|
[
"Writes",
"one",
"or",
"more",
"String",
"columns",
"as",
"a",
"line",
"to",
"the",
"CsvWriter",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/AbstractCsvWriter.java#L174-L204
|
159,206
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/HashMapper.java
|
HashMapper.checkPreconditions
|
private static void checkPreconditions(final Map<Object, Object> mapping) {
if( mapping == null ) {
throw new NullPointerException("mapping should not be null");
} else if( mapping.isEmpty() ) {
throw new IllegalArgumentException("mapping should not be empty");
}
}
|
java
|
private static void checkPreconditions(final Map<Object, Object> mapping) {
if( mapping == null ) {
throw new NullPointerException("mapping should not be null");
} else if( mapping.isEmpty() ) {
throw new IllegalArgumentException("mapping should not be empty");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"Map",
"<",
"Object",
",",
"Object",
">",
"mapping",
")",
"{",
"if",
"(",
"mapping",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"mapping should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"mapping",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"mapping should not be empty\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new HashMapper processor.
@param mapping
the Map
@throws NullPointerException
if mapping is null
@throws IllegalArgumentException
if mapping is empty
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"HashMapper",
"processor",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/HashMapper.java#L134-L140
|
159,207
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/ParseDateTimeAbstract.java
|
ParseDateTimeAbstract.checkPreconditions
|
private static void checkPreconditions(final String dateFormat, final Locale locale) {
if( dateFormat == null ) {
throw new NullPointerException("dateFormat should not be null");
} else if( locale == null ) {
throw new NullPointerException("locale should not be null");
}
}
|
java
|
private static void checkPreconditions(final String dateFormat, final Locale locale) {
if( dateFormat == null ) {
throw new NullPointerException("dateFormat should not be null");
} else if( locale == null ) {
throw new NullPointerException("locale should not be null");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"String",
"dateFormat",
",",
"final",
"Locale",
"locale",
")",
"{",
"if",
"(",
"dateFormat",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"dateFormat should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"locale",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"locale should not be null\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new ParseDateTimeAbstract processor with date format and locale.
@param dateFormat
the date format to use
@param locale
the Locale used to parse the date
@throws NullPointerException
if dateFormat or locale is null
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"ParseDateTimeAbstract",
"processor",
"with",
"date",
"format",
"and",
"locale",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseDateTimeAbstract.java#L196-L202
|
159,208
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/StrReplace.java
|
StrReplace.checkPreconditions
|
private static void checkPreconditions(final String regex, final String replacement) {
if( regex == null ) {
throw new NullPointerException("regex should not be null");
} else if( regex.length() == 0 ) {
throw new IllegalArgumentException("regex should not be empty");
}
if( replacement == null ) {
throw new NullPointerException("replacement should not be null");
}
}
|
java
|
private static void checkPreconditions(final String regex, final String replacement) {
if( regex == null ) {
throw new NullPointerException("regex should not be null");
} else if( regex.length() == 0 ) {
throw new IllegalArgumentException("regex should not be empty");
}
if( replacement == null ) {
throw new NullPointerException("replacement should not be null");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"String",
"regex",
",",
"final",
"String",
"replacement",
")",
"{",
"if",
"(",
"regex",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"regex should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"regex",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"regex should not be empty\"",
")",
";",
"}",
"if",
"(",
"replacement",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"replacement should not be null\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new StrRegExReplace processor.
@param regex
the supplied regular expression
@param replacement
the supplied replacement text
@throws IllegalArgumentException
if regex is empty
@throws NullPointerException
if regex or replacement is null
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"StrRegExReplace",
"processor",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/StrReplace.java#L101-L111
|
159,209
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/TwoDHashMap.java
|
TwoDHashMap.get
|
public V get(final K1 firstKey, final K2 secondKey) {
// existence check on inner map
final HashMap<K2, V> innerMap = map.get(firstKey);
if( innerMap == null ) {
return null;
}
return innerMap.get(secondKey);
}
|
java
|
public V get(final K1 firstKey, final K2 secondKey) {
// existence check on inner map
final HashMap<K2, V> innerMap = map.get(firstKey);
if( innerMap == null ) {
return null;
}
return innerMap.get(secondKey);
}
|
[
"public",
"V",
"get",
"(",
"final",
"K1",
"firstKey",
",",
"final",
"K2",
"secondKey",
")",
"{",
"// existence check on inner map",
"final",
"HashMap",
"<",
"K2",
",",
"V",
">",
"innerMap",
"=",
"map",
".",
"get",
"(",
"firstKey",
")",
";",
"if",
"(",
"innerMap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"innerMap",
".",
"get",
"(",
"secondKey",
")",
";",
"}"
] |
Fetch a value from the Hashmap .
@param firstKey
first key
@param secondKey
second key
@return the element or null.
|
[
"Fetch",
"a",
"value",
"from",
"the",
"Hashmap",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/TwoDHashMap.java#L88-L95
|
159,210
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/MethodCache.java
|
MethodCache.getGetMethod
|
public Method getGetMethod(final Object object, final String fieldName) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
}
Method method = getCache.get(object.getClass().getName(), fieldName);
if( method == null ) {
method = ReflectionUtils.findGetter(object, fieldName);
getCache.set(object.getClass().getName(), fieldName, method);
}
return method;
}
|
java
|
public Method getGetMethod(final Object object, final String fieldName) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
}
Method method = getCache.get(object.getClass().getName(), fieldName);
if( method == null ) {
method = ReflectionUtils.findGetter(object, fieldName);
getCache.set(object.getClass().getName(), fieldName, method);
}
return method;
}
|
[
"public",
"Method",
"getGetMethod",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"fieldName",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"object should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"fieldName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"fieldName should not be null\"",
")",
";",
"}",
"Method",
"method",
"=",
"getCache",
".",
"get",
"(",
"object",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"fieldName",
")",
";",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"method",
"=",
"ReflectionUtils",
".",
"findGetter",
"(",
"object",
",",
"fieldName",
")",
";",
"getCache",
".",
"set",
"(",
"object",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"fieldName",
",",
"method",
")",
";",
"}",
"return",
"method",
";",
"}"
] |
Returns the getter method for field on an object.
@param object
the object
@param fieldName
the field name
@return the getter associated with the field on the object
@throws NullPointerException
if object or fieldName is null
@throws SuperCsvReflectionException
if the getter doesn't exist or is not visible
|
[
"Returns",
"the",
"getter",
"method",
"for",
"field",
"on",
"an",
"object",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/MethodCache.java#L53-L66
|
159,211
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/MethodCache.java
|
MethodCache.getSetMethod
|
public <T> Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argumentType == null ) {
throw new NullPointerException("argumentType should not be null");
}
Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName);
if( method == null ) {
method = ReflectionUtils.findSetter(object, fieldName, argumentType);
setMethodsCache.set(object.getClass(), argumentType, fieldName, method);
}
return method;
}
|
java
|
public <T> Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argumentType == null ) {
throw new NullPointerException("argumentType should not be null");
}
Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName);
if( method == null ) {
method = ReflectionUtils.findSetter(object, fieldName, argumentType);
setMethodsCache.set(object.getClass(), argumentType, fieldName, method);
}
return method;
}
|
[
"public",
"<",
"T",
">",
"Method",
"getSetMethod",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"fieldName",
",",
"final",
"Class",
"<",
"?",
">",
"argumentType",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"object should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"fieldName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"fieldName should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"argumentType",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"argumentType should not be null\"",
")",
";",
"}",
"Method",
"method",
"=",
"setMethodsCache",
".",
"get",
"(",
"object",
".",
"getClass",
"(",
")",
",",
"argumentType",
",",
"fieldName",
")",
";",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"method",
"=",
"ReflectionUtils",
".",
"findSetter",
"(",
"object",
",",
"fieldName",
",",
"argumentType",
")",
";",
"setMethodsCache",
".",
"set",
"(",
"object",
".",
"getClass",
"(",
")",
",",
"argumentType",
",",
"fieldName",
",",
"method",
")",
";",
"}",
"return",
"method",
";",
"}"
] |
Returns the setter method for the field on an object.
@param object
the object
@param fieldName
the field name
@param argumentType
the type to be passed to the setter
@param <T>
the object type
@return the setter method associated with the field on the object
@throws NullPointerException
if object, fieldName or fieldType is null
@throws SuperCsvReflectionException
if the setter doesn't exist or is not visible
|
[
"Returns",
"the",
"setter",
"method",
"for",
"the",
"field",
"on",
"an",
"object",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/MethodCache.java#L85-L100
|
159,212
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java
|
CsvBeanReader.invokeSetter
|
private static void invokeSetter(final Object bean, final Method setMethod, final Object fieldValue) {
try {
setMethod.setAccessible(true);
setMethod.invoke(bean, fieldValue);
}
catch(final Exception e) {
throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e);
}
}
|
java
|
private static void invokeSetter(final Object bean, final Method setMethod, final Object fieldValue) {
try {
setMethod.setAccessible(true);
setMethod.invoke(bean, fieldValue);
}
catch(final Exception e) {
throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e);
}
}
|
[
"private",
"static",
"void",
"invokeSetter",
"(",
"final",
"Object",
"bean",
",",
"final",
"Method",
"setMethod",
",",
"final",
"Object",
"fieldValue",
")",
"{",
"try",
"{",
"setMethod",
".",
"setAccessible",
"(",
"true",
")",
";",
"setMethod",
".",
"invoke",
"(",
"bean",
",",
"fieldValue",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
"new",
"SuperCsvReflectionException",
"(",
"String",
".",
"format",
"(",
"\"error invoking method %s()\"",
",",
"setMethod",
".",
"getName",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Invokes the setter on the bean with the supplied value.
@param bean
the bean
@param setMethod
the setter method for the field
@param fieldValue
the field value to set
@throws SuperCsvException
if there was an exception invoking the setter
|
[
"Invokes",
"the",
"setter",
"on",
"the",
"bean",
"with",
"the",
"supplied",
"value",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L133-L141
|
159,213
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java
|
CsvBeanReader.populateBean
|
private <T> T populateBean(final T resultBean, final String[] nameMapping) {
// map each column to its associated field on the bean
for( int i = 0; i < nameMapping.length; i++ ) {
final Object fieldValue = processedColumns.get(i);
// don't call a set-method in the bean if there is no name mapping for the column or no result to store
if( nameMapping[i] == null || fieldValue == null ) {
continue;
}
// invoke the setter on the bean
Method setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass());
invokeSetter(resultBean, setMethod, fieldValue);
}
return resultBean;
}
|
java
|
private <T> T populateBean(final T resultBean, final String[] nameMapping) {
// map each column to its associated field on the bean
for( int i = 0; i < nameMapping.length; i++ ) {
final Object fieldValue = processedColumns.get(i);
// don't call a set-method in the bean if there is no name mapping for the column or no result to store
if( nameMapping[i] == null || fieldValue == null ) {
continue;
}
// invoke the setter on the bean
Method setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass());
invokeSetter(resultBean, setMethod, fieldValue);
}
return resultBean;
}
|
[
"private",
"<",
"T",
">",
"T",
"populateBean",
"(",
"final",
"T",
"resultBean",
",",
"final",
"String",
"[",
"]",
"nameMapping",
")",
"{",
"// map each column to its associated field on the bean",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameMapping",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"Object",
"fieldValue",
"=",
"processedColumns",
".",
"get",
"(",
"i",
")",
";",
"// don't call a set-method in the bean if there is no name mapping for the column or no result to store",
"if",
"(",
"nameMapping",
"[",
"i",
"]",
"==",
"null",
"||",
"fieldValue",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"// invoke the setter on the bean",
"Method",
"setMethod",
"=",
"cache",
".",
"getSetMethod",
"(",
"resultBean",
",",
"nameMapping",
"[",
"i",
"]",
",",
"fieldValue",
".",
"getClass",
"(",
")",
")",
";",
"invokeSetter",
"(",
"resultBean",
",",
"setMethod",
",",
"fieldValue",
")",
";",
"}",
"return",
"resultBean",
";",
"}"
] |
Populates the bean by mapping the processed columns to the fields of the bean.
@param resultBean
the bean to populate
@param nameMapping
the name mappings
@return the populated bean
@throws SuperCsvReflectionException
if there was a reflection exception while populating the bean
|
[
"Populates",
"the",
"bean",
"by",
"mapping",
"the",
"processed",
"columns",
"to",
"the",
"fields",
"of",
"the",
"bean",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L154-L173
|
159,214
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java
|
CsvBeanReader.readIntoBean
|
private <T> T readIntoBean(final T bean, final String[] nameMapping, final CellProcessor[] processors)
throws IOException {
if( readRow() ) {
if( nameMapping.length != length() ) {
throw new IllegalArgumentException(String.format(
"the nameMapping array and the number of columns read "
+ "should be the same size (nameMapping length = %d, columns = %d)", nameMapping.length,
length()));
}
if( processors == null ) {
processedColumns.clear();
processedColumns.addAll(getColumns());
} else {
executeProcessors(processedColumns, processors);
}
return populateBean(bean, nameMapping);
}
return null; // EOF
}
|
java
|
private <T> T readIntoBean(final T bean, final String[] nameMapping, final CellProcessor[] processors)
throws IOException {
if( readRow() ) {
if( nameMapping.length != length() ) {
throw new IllegalArgumentException(String.format(
"the nameMapping array and the number of columns read "
+ "should be the same size (nameMapping length = %d, columns = %d)", nameMapping.length,
length()));
}
if( processors == null ) {
processedColumns.clear();
processedColumns.addAll(getColumns());
} else {
executeProcessors(processedColumns, processors);
}
return populateBean(bean, nameMapping);
}
return null; // EOF
}
|
[
"private",
"<",
"T",
">",
"T",
"readIntoBean",
"(",
"final",
"T",
"bean",
",",
"final",
"String",
"[",
"]",
"nameMapping",
",",
"final",
"CellProcessor",
"[",
"]",
"processors",
")",
"throws",
"IOException",
"{",
"if",
"(",
"readRow",
"(",
")",
")",
"{",
"if",
"(",
"nameMapping",
".",
"length",
"!=",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"the nameMapping array and the number of columns read \"",
"+",
"\"should be the same size (nameMapping length = %d, columns = %d)\"",
",",
"nameMapping",
".",
"length",
",",
"length",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"processors",
"==",
"null",
")",
"{",
"processedColumns",
".",
"clear",
"(",
")",
";",
"processedColumns",
".",
"addAll",
"(",
"getColumns",
"(",
")",
")",
";",
"}",
"else",
"{",
"executeProcessors",
"(",
"processedColumns",
",",
"processors",
")",
";",
"}",
"return",
"populateBean",
"(",
"bean",
",",
"nameMapping",
")",
";",
"}",
"return",
"null",
";",
"// EOF",
"}"
] |
Reads a row of a CSV file and populates the bean, using the supplied name mapping to map column values to the
appropriate fields. If processors are supplied then they are used, otherwise the raw String values will be used.
@param bean
the bean to populate
@param nameMapping
the name mapping array
@param processors
the (optional) cell processors
@return the populated bean, or null if EOF was reached
@throws IllegalArgumentException
if nameMapping.length != number of CSV columns read
@throws IOException
if an I/O error occurred
@throws NullPointerException
if bean or nameMapping are null
@throws SuperCsvConstraintViolationException
if a CellProcessor constraint failed
@throws SuperCsvException
if there was a general exception while reading/processing
@throws SuperCsvReflectionException
if there was an reflection exception while mapping the values to the bean
|
[
"Reads",
"a",
"row",
"of",
"a",
"CSV",
"file",
"and",
"populates",
"the",
"bean",
"using",
"the",
"supplied",
"name",
"mapping",
"to",
"map",
"column",
"values",
"to",
"the",
"appropriate",
"fields",
".",
"If",
"processors",
"are",
"supplied",
"then",
"they",
"are",
"used",
"otherwise",
"the",
"raw",
"String",
"values",
"will",
"be",
"used",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L259-L281
|
159,215
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Strlen.java
|
Strlen.checkAndAddLengths
|
private void checkAndAddLengths(final int... requiredLengths) {
for( final int length : requiredLengths ) {
if( length < 0 ) {
throw new IllegalArgumentException(String.format("required length cannot be negative but was %d",
length));
}
this.requiredLengths.add(length);
}
}
|
java
|
private void checkAndAddLengths(final int... requiredLengths) {
for( final int length : requiredLengths ) {
if( length < 0 ) {
throw new IllegalArgumentException(String.format("required length cannot be negative but was %d",
length));
}
this.requiredLengths.add(length);
}
}
|
[
"private",
"void",
"checkAndAddLengths",
"(",
"final",
"int",
"...",
"requiredLengths",
")",
"{",
"for",
"(",
"final",
"int",
"length",
":",
"requiredLengths",
")",
"{",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"required length cannot be negative but was %d\"",
",",
"length",
")",
")",
";",
"}",
"this",
".",
"requiredLengths",
".",
"add",
"(",
"length",
")",
";",
"}",
"}"
] |
Adds each required length, ensuring it isn't negative.
@param requiredLengths
one or more required lengths
@throws IllegalArgumentException
if a supplied length is negative
|
[
"Adds",
"each",
"required",
"length",
"ensuring",
"it",
"isn",
"t",
"negative",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Strlen.java#L119-L127
|
159,216
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/RequireSubStr.java
|
RequireSubStr.checkPreconditions
|
private static void checkPreconditions(List<String> requiredSubStrings) {
if( requiredSubStrings == null ) {
throw new NullPointerException("requiredSubStrings List should not be null");
} else if( requiredSubStrings.isEmpty() ) {
throw new IllegalArgumentException("requiredSubStrings List should not be empty");
}
}
|
java
|
private static void checkPreconditions(List<String> requiredSubStrings) {
if( requiredSubStrings == null ) {
throw new NullPointerException("requiredSubStrings List should not be null");
} else if( requiredSubStrings.isEmpty() ) {
throw new IllegalArgumentException("requiredSubStrings List should not be empty");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"List",
"<",
"String",
">",
"requiredSubStrings",
")",
"{",
"if",
"(",
"requiredSubStrings",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"requiredSubStrings List should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"requiredSubStrings",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"requiredSubStrings List should not be empty\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new RequireSubStr processor with a List of Strings.
@param requiredSubStrings
the required substrings
@throws NullPointerException
if requiredSubStrings or one of its elements is null
@throws IllegalArgumentException
if requiredSubStrings is empty
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"RequireSubStr",
"processor",
"with",
"a",
"List",
"of",
"Strings",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/RequireSubStr.java#L139-L145
|
159,217
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/RequireSubStr.java
|
RequireSubStr.checkAndAddRequiredSubStrings
|
private void checkAndAddRequiredSubStrings(final List<String> requiredSubStrings) {
for( String required : requiredSubStrings ) {
if( required == null ) {
throw new NullPointerException("required substring should not be null");
}
this.requiredSubStrings.add(required);
}
}
|
java
|
private void checkAndAddRequiredSubStrings(final List<String> requiredSubStrings) {
for( String required : requiredSubStrings ) {
if( required == null ) {
throw new NullPointerException("required substring should not be null");
}
this.requiredSubStrings.add(required);
}
}
|
[
"private",
"void",
"checkAndAddRequiredSubStrings",
"(",
"final",
"List",
"<",
"String",
">",
"requiredSubStrings",
")",
"{",
"for",
"(",
"String",
"required",
":",
"requiredSubStrings",
")",
"{",
"if",
"(",
"required",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"required substring should not be null\"",
")",
";",
"}",
"this",
".",
"requiredSubStrings",
".",
"add",
"(",
"required",
")",
";",
"}",
"}"
] |
Adds each required substring, checking that it's not null.
@param requiredSubStrings
the required substrings
@throws NullPointerException
if a required substring is null
|
[
"Adds",
"each",
"required",
"substring",
"checking",
"that",
"it",
"s",
"not",
"null",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/RequireSubStr.java#L155-L162
|
159,218
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/ForbidSubStr.java
|
ForbidSubStr.checkPreconditions
|
private static void checkPreconditions(final List<String> forbiddenSubStrings) {
if( forbiddenSubStrings == null ) {
throw new NullPointerException("forbiddenSubStrings list should not be null");
} else if( forbiddenSubStrings.isEmpty() ) {
throw new IllegalArgumentException("forbiddenSubStrings list should not be empty");
}
}
|
java
|
private static void checkPreconditions(final List<String> forbiddenSubStrings) {
if( forbiddenSubStrings == null ) {
throw new NullPointerException("forbiddenSubStrings list should not be null");
} else if( forbiddenSubStrings.isEmpty() ) {
throw new IllegalArgumentException("forbiddenSubStrings list should not be empty");
}
}
|
[
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"List",
"<",
"String",
">",
"forbiddenSubStrings",
")",
"{",
"if",
"(",
"forbiddenSubStrings",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"forbiddenSubStrings list should not be null\"",
")",
";",
"}",
"else",
"if",
"(",
"forbiddenSubStrings",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"forbiddenSubStrings list should not be empty\"",
")",
";",
"}",
"}"
] |
Checks the preconditions for creating a new ForbidSubStr processor with a List of forbidden substrings.
@param forbiddenSubStrings
the forbidden substrings
@throws NullPointerException
if forbiddenSubStrings is null
@throws IllegalArgumentException
if forbiddenSubStrings is empty
|
[
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"ForbidSubStr",
"processor",
"with",
"a",
"List",
"of",
"forbidden",
"substrings",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/ForbidSubStr.java#L138-L144
|
159,219
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/ForbidSubStr.java
|
ForbidSubStr.checkAndAddForbiddenStrings
|
private void checkAndAddForbiddenStrings(final List<String> forbiddenSubStrings) {
for( String forbidden : forbiddenSubStrings ) {
if( forbidden == null ) {
throw new NullPointerException("forbidden substring should not be null");
}
this.forbiddenSubStrings.add(forbidden);
}
}
|
java
|
private void checkAndAddForbiddenStrings(final List<String> forbiddenSubStrings) {
for( String forbidden : forbiddenSubStrings ) {
if( forbidden == null ) {
throw new NullPointerException("forbidden substring should not be null");
}
this.forbiddenSubStrings.add(forbidden);
}
}
|
[
"private",
"void",
"checkAndAddForbiddenStrings",
"(",
"final",
"List",
"<",
"String",
">",
"forbiddenSubStrings",
")",
"{",
"for",
"(",
"String",
"forbidden",
":",
"forbiddenSubStrings",
")",
"{",
"if",
"(",
"forbidden",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"forbidden substring should not be null\"",
")",
";",
"}",
"this",
".",
"forbiddenSubStrings",
".",
"add",
"(",
"forbidden",
")",
";",
"}",
"}"
] |
Adds each forbidden substring, checking that it's not null.
@param forbiddenSubStrings
the forbidden substrings
@throws NullPointerException
if a forbidden substring is null
|
[
"Adds",
"each",
"forbidden",
"substring",
"checking",
"that",
"it",
"s",
"not",
"null",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/ForbidSubStr.java#L184-L191
|
159,220
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java
|
ThreeDHashMap.get
|
public HashMap<K2, HashMap<K3, V>> get(final K1 firstKey) {
return map.get(firstKey);
}
|
java
|
public HashMap<K2, HashMap<K3, V>> get(final K1 firstKey) {
return map.get(firstKey);
}
|
[
"public",
"HashMap",
"<",
"K2",
",",
"HashMap",
"<",
"K3",
",",
"V",
">",
">",
"get",
"(",
"final",
"K1",
"firstKey",
")",
"{",
"return",
"map",
".",
"get",
"(",
"firstKey",
")",
";",
"}"
] |
Fetch the outermost Hashmap.
@param firstKey
first key
@return the the innermost hashmap
|
[
"Fetch",
"the",
"outermost",
"Hashmap",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java#L92-L94
|
159,221
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java
|
ThreeDHashMap.getAs2d
|
public TwoDHashMap<K2, K3, V> getAs2d(final K1 firstKey) {
final HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);
if( innerMap1 != null ) {
return new TwoDHashMap<K2, K3, V>(innerMap1);
} else {
return new TwoDHashMap<K2, K3, V>();
}
}
|
java
|
public TwoDHashMap<K2, K3, V> getAs2d(final K1 firstKey) {
final HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);
if( innerMap1 != null ) {
return new TwoDHashMap<K2, K3, V>(innerMap1);
} else {
return new TwoDHashMap<K2, K3, V>();
}
}
|
[
"public",
"TwoDHashMap",
"<",
"K2",
",",
"K3",
",",
"V",
">",
"getAs2d",
"(",
"final",
"K1",
"firstKey",
")",
"{",
"final",
"HashMap",
"<",
"K2",
",",
"HashMap",
"<",
"K3",
",",
"V",
">",
">",
"innerMap1",
"=",
"map",
".",
"get",
"(",
"firstKey",
")",
";",
"if",
"(",
"innerMap1",
"!=",
"null",
")",
"{",
"return",
"new",
"TwoDHashMap",
"<",
"K2",
",",
"K3",
",",
"V",
">",
"(",
"innerMap1",
")",
";",
"}",
"else",
"{",
"return",
"new",
"TwoDHashMap",
"<",
"K2",
",",
"K3",
",",
"V",
">",
"(",
")",
";",
"}",
"}"
] |
Fetch the outermost Hashmap as a TwoDHashMap.
@param firstKey
first key
@return the the innermost hashmap
|
[
"Fetch",
"the",
"outermost",
"Hashmap",
"as",
"a",
"TwoDHashMap",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java#L103-L111
|
159,222
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java
|
ThreeDHashMap.size
|
public int size(final K1 firstKey) {
// existence check on inner map
final HashMap<K2, HashMap<K3, V>> innerMap = map.get(firstKey);
if( innerMap == null ) {
return 0;
}
return innerMap.size();
}
|
java
|
public int size(final K1 firstKey) {
// existence check on inner map
final HashMap<K2, HashMap<K3, V>> innerMap = map.get(firstKey);
if( innerMap == null ) {
return 0;
}
return innerMap.size();
}
|
[
"public",
"int",
"size",
"(",
"final",
"K1",
"firstKey",
")",
"{",
"// existence check on inner map",
"final",
"HashMap",
"<",
"K2",
",",
"HashMap",
"<",
"K3",
",",
"V",
">",
">",
"innerMap",
"=",
"map",
".",
"get",
"(",
"firstKey",
")",
";",
"if",
"(",
"innerMap",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"innerMap",
".",
"size",
"(",
")",
";",
"}"
] |
Returns the number of key-value mappings in this map for the second key.
@param firstKey
the first key
@return Returns the number of key-value mappings in this map for the second key.
|
[
"Returns",
"the",
"number",
"of",
"key",
"-",
"value",
"mappings",
"in",
"this",
"map",
"for",
"the",
"second",
"key",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java#L208-L215
|
159,223
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java
|
ThreeDHashMap.size
|
public int size(final K1 firstKey, final K2 secondKey) {
// existence check on inner map
final HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);
if( innerMap1 == null ) {
return 0;
}
// existence check on inner map1
final HashMap<K3, V> innerMap2 = innerMap1.get(secondKey);
if( innerMap2 == null ) {
return 0;
}
return innerMap2.size();
}
|
java
|
public int size(final K1 firstKey, final K2 secondKey) {
// existence check on inner map
final HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);
if( innerMap1 == null ) {
return 0;
}
// existence check on inner map1
final HashMap<K3, V> innerMap2 = innerMap1.get(secondKey);
if( innerMap2 == null ) {
return 0;
}
return innerMap2.size();
}
|
[
"public",
"int",
"size",
"(",
"final",
"K1",
"firstKey",
",",
"final",
"K2",
"secondKey",
")",
"{",
"// existence check on inner map",
"final",
"HashMap",
"<",
"K2",
",",
"HashMap",
"<",
"K3",
",",
"V",
">",
">",
"innerMap1",
"=",
"map",
".",
"get",
"(",
"firstKey",
")",
";",
"if",
"(",
"innerMap1",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"// existence check on inner map1",
"final",
"HashMap",
"<",
"K3",
",",
"V",
">",
"innerMap2",
"=",
"innerMap1",
".",
"get",
"(",
"secondKey",
")",
";",
"if",
"(",
"innerMap2",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"innerMap2",
".",
"size",
"(",
")",
";",
"}"
] |
Returns the number of key-value mappings in this map for the third key.
@param firstKey
the first key
@param secondKey
the second key
@return Returns the number of key-value mappings in this map for the third key.
|
[
"Returns",
"the",
"number",
"of",
"key",
"-",
"value",
"mappings",
"in",
"this",
"map",
"for",
"the",
"third",
"key",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java#L226-L239
|
159,224
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/util/BeanInterfaceProxy.java
|
BeanInterfaceProxy.createProxy
|
public static <T> T createProxy(final Class<T> proxyInterface) {
if( proxyInterface == null ) {
throw new NullPointerException("proxyInterface should not be null");
}
return proxyInterface.cast(Proxy.newProxyInstance(proxyInterface.getClassLoader(),
new Class[] { proxyInterface }, new BeanInterfaceProxy()));
}
|
java
|
public static <T> T createProxy(final Class<T> proxyInterface) {
if( proxyInterface == null ) {
throw new NullPointerException("proxyInterface should not be null");
}
return proxyInterface.cast(Proxy.newProxyInstance(proxyInterface.getClassLoader(),
new Class[] { proxyInterface }, new BeanInterfaceProxy()));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"createProxy",
"(",
"final",
"Class",
"<",
"T",
">",
"proxyInterface",
")",
"{",
"if",
"(",
"proxyInterface",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"proxyInterface should not be null\"",
")",
";",
"}",
"return",
"proxyInterface",
".",
"cast",
"(",
"Proxy",
".",
"newProxyInstance",
"(",
"proxyInterface",
".",
"getClassLoader",
"(",
")",
",",
"new",
"Class",
"[",
"]",
"{",
"proxyInterface",
"}",
",",
"new",
"BeanInterfaceProxy",
"(",
")",
")",
")",
";",
"}"
] |
Creates a proxy object which implements a given bean interface.
@param proxyInterface
the interface the the proxy will implement
@param <T>
the proxy implementation type
@return the proxy implementation
@throws NullPointerException
if proxyInterface is null
|
[
"Creates",
"a",
"proxy",
"object",
"which",
"implements",
"a",
"given",
"bean",
"interface",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/BeanInterfaceProxy.java#L57-L63
|
159,225
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/exception/SuperCsvCellProcessorException.java
|
SuperCsvCellProcessorException.getUnexpectedTypeMessage
|
private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) {
if( expectedType == null ) {
throw new NullPointerException("expectedType should not be null");
}
String expectedClassName = expectedType.getName();
String actualClassName = (actualValue != null) ? actualValue.getClass().getName() : "null";
return String.format("the input value should be of type %s but is %s", expectedClassName, actualClassName);
}
|
java
|
private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) {
if( expectedType == null ) {
throw new NullPointerException("expectedType should not be null");
}
String expectedClassName = expectedType.getName();
String actualClassName = (actualValue != null) ? actualValue.getClass().getName() : "null";
return String.format("the input value should be of type %s but is %s", expectedClassName, actualClassName);
}
|
[
"private",
"static",
"String",
"getUnexpectedTypeMessage",
"(",
"final",
"Class",
"<",
"?",
">",
"expectedType",
",",
"final",
"Object",
"actualValue",
")",
"{",
"if",
"(",
"expectedType",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"expectedType should not be null\"",
")",
";",
"}",
"String",
"expectedClassName",
"=",
"expectedType",
".",
"getName",
"(",
")",
";",
"String",
"actualClassName",
"=",
"(",
"actualValue",
"!=",
"null",
")",
"?",
"actualValue",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
":",
"\"null\"",
";",
"return",
"String",
".",
"format",
"(",
"\"the input value should be of type %s but is %s\"",
",",
"expectedClassName",
",",
"actualClassName",
")",
";",
"}"
] |
Assembles the exception message when the value received by a CellProcessor isn't of the correct type.
@param expectedType
the expected type
@param actualValue
the value received by the CellProcessor
@return the message
@throws NullPointerException
if expectedType is null
|
[
"Assembles",
"the",
"exception",
"message",
"when",
"the",
"value",
"received",
"by",
"a",
"CellProcessor",
"isn",
"t",
"of",
"the",
"correct",
"type",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/exception/SuperCsvCellProcessorException.java#L97-L104
|
159,226
|
super-csv/super-csv
|
super-csv/src/main/java/org/supercsv/io/AbstractCsvReader.java
|
AbstractCsvReader.executeProcessors
|
protected List<Object> executeProcessors(final List<Object> processedColumns, final CellProcessor[] processors) {
Util.executeCellProcessors(processedColumns, getColumns(), processors, getLineNumber(), getRowNumber());
return processedColumns;
}
|
java
|
protected List<Object> executeProcessors(final List<Object> processedColumns, final CellProcessor[] processors) {
Util.executeCellProcessors(processedColumns, getColumns(), processors, getLineNumber(), getRowNumber());
return processedColumns;
}
|
[
"protected",
"List",
"<",
"Object",
">",
"executeProcessors",
"(",
"final",
"List",
"<",
"Object",
">",
"processedColumns",
",",
"final",
"CellProcessor",
"[",
"]",
"processors",
")",
"{",
"Util",
".",
"executeCellProcessors",
"(",
"processedColumns",
",",
"getColumns",
"(",
")",
",",
"processors",
",",
"getLineNumber",
"(",
")",
",",
"getRowNumber",
"(",
")",
")",
";",
"return",
"processedColumns",
";",
"}"
] |
Executes the supplied cell processors on the last row of CSV that was read and populates the supplied List of
processed columns.
@param processedColumns
the List to populate with processed columns
@param processors
the cell processors
@return the updated List
@throws NullPointerException
if processedColumns or processors is null
@throws SuperCsvConstraintViolationException
if a CellProcessor constraint failed
@throws SuperCsvException
if the wrong number of processors are supplied, or CellProcessor execution failed
|
[
"Executes",
"the",
"supplied",
"cell",
"processors",
"on",
"the",
"last",
"row",
"of",
"CSV",
"that",
"was",
"read",
"and",
"populates",
"the",
"supplied",
"List",
"of",
"processed",
"columns",
"."
] |
f18db724674dc1c4116e25142c1b5403ebf43e96
|
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/AbstractCsvReader.java#L202-L205
|
159,227
|
bwaldvogel/mongo-java-server
|
core/src/main/java/de/bwaldvogel/mongo/MongoServer.java
|
MongoServer.stopListenting
|
public void stopListenting() {
if (channel != null) {
log.info("closing server channel");
channel.close().syncUninterruptibly();
channel = null;
}
}
|
java
|
public void stopListenting() {
if (channel != null) {
log.info("closing server channel");
channel.close().syncUninterruptibly();
channel = null;
}
}
|
[
"public",
"void",
"stopListenting",
"(",
")",
"{",
"if",
"(",
"channel",
"!=",
"null",
")",
"{",
"log",
".",
"info",
"(",
"\"closing server channel\"",
")",
";",
"channel",
".",
"close",
"(",
")",
".",
"syncUninterruptibly",
"(",
")",
";",
"channel",
"=",
"null",
";",
"}",
"}"
] |
Closes the server socket. No new clients are accepted afterwards.
|
[
"Closes",
"the",
"server",
"socket",
".",
"No",
"new",
"clients",
"are",
"accepted",
"afterwards",
"."
] |
df0bf7cf5f51ed61cca976cea27026e79ed68d4a
|
https://github.com/bwaldvogel/mongo-java-server/blob/df0bf7cf5f51ed61cca976cea27026e79ed68d4a/core/src/main/java/de/bwaldvogel/mongo/MongoServer.java#L153-L159
|
159,228
|
bwaldvogel/mongo-java-server
|
core/src/main/java/de/bwaldvogel/mongo/backend/AbstractMongoCollection.java
|
AbstractMongoCollection.convertSelectorToDocument
|
Document convertSelectorToDocument(Document selector) {
Document document = new Document();
for (String key : selector.keySet()) {
if (key.startsWith("$")) {
continue;
}
Object value = selector.get(key);
if (!Utils.containsQueryExpression(value)) {
Utils.changeSubdocumentValue(document, key, value, (AtomicReference<Integer>) null);
}
}
return document;
}
|
java
|
Document convertSelectorToDocument(Document selector) {
Document document = new Document();
for (String key : selector.keySet()) {
if (key.startsWith("$")) {
continue;
}
Object value = selector.get(key);
if (!Utils.containsQueryExpression(value)) {
Utils.changeSubdocumentValue(document, key, value, (AtomicReference<Integer>) null);
}
}
return document;
}
|
[
"Document",
"convertSelectorToDocument",
"(",
"Document",
"selector",
")",
"{",
"Document",
"document",
"=",
"new",
"Document",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"selector",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"\"$\"",
")",
")",
"{",
"continue",
";",
"}",
"Object",
"value",
"=",
"selector",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"!",
"Utils",
".",
"containsQueryExpression",
"(",
"value",
")",
")",
"{",
"Utils",
".",
"changeSubdocumentValue",
"(",
"document",
",",
"key",
",",
"value",
",",
"(",
"AtomicReference",
"<",
"Integer",
">",
")",
"null",
")",
";",
"}",
"}",
"return",
"document",
";",
"}"
] |
convert selector used in an upsert statement into a document
|
[
"convert",
"selector",
"used",
"in",
"an",
"upsert",
"statement",
"into",
"a",
"document"
] |
df0bf7cf5f51ed61cca976cea27026e79ed68d4a
|
https://github.com/bwaldvogel/mongo-java-server/blob/df0bf7cf5f51ed61cca976cea27026e79ed68d4a/core/src/main/java/de/bwaldvogel/mongo/backend/AbstractMongoCollection.java#L499-L512
|
159,229
|
bwaldvogel/mongo-java-server
|
core/src/main/java/de/bwaldvogel/mongo/wire/BsonDecoder.java
|
BsonDecoder.decodeCString
|
String decodeCString(ByteBuf buffer) throws IOException {
int length = buffer.bytesBefore(BsonConstants.STRING_TERMINATION);
if (length < 0)
throw new IOException("string termination not found");
String result = buffer.toString(buffer.readerIndex(), length, StandardCharsets.UTF_8);
buffer.skipBytes(length + 1);
return result;
}
|
java
|
String decodeCString(ByteBuf buffer) throws IOException {
int length = buffer.bytesBefore(BsonConstants.STRING_TERMINATION);
if (length < 0)
throw new IOException("string termination not found");
String result = buffer.toString(buffer.readerIndex(), length, StandardCharsets.UTF_8);
buffer.skipBytes(length + 1);
return result;
}
|
[
"String",
"decodeCString",
"(",
"ByteBuf",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"buffer",
".",
"bytesBefore",
"(",
"BsonConstants",
".",
"STRING_TERMINATION",
")",
";",
"if",
"(",
"length",
"<",
"0",
")",
"throw",
"new",
"IOException",
"(",
"\"string termination not found\"",
")",
";",
"String",
"result",
"=",
"buffer",
".",
"toString",
"(",
"buffer",
".",
"readerIndex",
"(",
")",
",",
"length",
",",
"StandardCharsets",
".",
"UTF_8",
")",
";",
"buffer",
".",
"skipBytes",
"(",
"length",
"+",
"1",
")",
";",
"return",
"result",
";",
"}"
] |
default visibility for unit test
|
[
"default",
"visibility",
"for",
"unit",
"test"
] |
df0bf7cf5f51ed61cca976cea27026e79ed68d4a
|
https://github.com/bwaldvogel/mongo-java-server/blob/df0bf7cf5f51ed61cca976cea27026e79ed68d4a/core/src/main/java/de/bwaldvogel/mongo/wire/BsonDecoder.java#L142-L150
|
159,230
|
FasterXML/jackson-modules-java8
|
datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/InstantDeserializer.java
|
InstantDeserializer._countPeriods
|
protected int _countPeriods(String str)
{
int commas = 0;
for (int i = 0, end = str.length(); i < end; ++i) {
int ch = str.charAt(i);
if (ch < '0' || ch > '9') {
if (ch == '.') {
++commas;
} else {
return -1;
}
}
}
return commas;
}
|
java
|
protected int _countPeriods(String str)
{
int commas = 0;
for (int i = 0, end = str.length(); i < end; ++i) {
int ch = str.charAt(i);
if (ch < '0' || ch > '9') {
if (ch == '.') {
++commas;
} else {
return -1;
}
}
}
return commas;
}
|
[
"protected",
"int",
"_countPeriods",
"(",
"String",
"str",
")",
"{",
"int",
"commas",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"end",
"=",
"str",
".",
"length",
"(",
")",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"{",
"int",
"ch",
"=",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"ch",
"<",
"'",
"'",
"||",
"ch",
">",
"'",
"'",
")",
"{",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"++",
"commas",
";",
"}",
"else",
"{",
"return",
"-",
"1",
";",
"}",
"}",
"}",
"return",
"commas",
";",
"}"
] |
Helper method to find Strings of form "all digits" and "digits-comma-digits"
|
[
"Helper",
"method",
"to",
"find",
"Strings",
"of",
"form",
"all",
"digits",
"and",
"digits",
"-",
"comma",
"-",
"digits"
] |
bd093eafbd4d5216e13093b0a031e06dcbb8839b
|
https://github.com/FasterXML/jackson-modules-java8/blob/bd093eafbd4d5216e13093b0a031e06dcbb8839b/datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/InstantDeserializer.java#L253-L267
|
159,231
|
FasterXML/jackson-modules-java8
|
datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/JSR310DeserializerBase.java
|
JSR310DeserializerBase._peelDTE
|
protected DateTimeException _peelDTE(DateTimeException e) {
while (true) {
Throwable t = e.getCause();
if (t != null && t instanceof DateTimeException) {
e = (DateTimeException) t;
continue;
}
break;
}
return e;
}
|
java
|
protected DateTimeException _peelDTE(DateTimeException e) {
while (true) {
Throwable t = e.getCause();
if (t != null && t instanceof DateTimeException) {
e = (DateTimeException) t;
continue;
}
break;
}
return e;
}
|
[
"protected",
"DateTimeException",
"_peelDTE",
"(",
"DateTimeException",
"e",
")",
"{",
"while",
"(",
"true",
")",
"{",
"Throwable",
"t",
"=",
"e",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"t",
"!=",
"null",
"&&",
"t",
"instanceof",
"DateTimeException",
")",
"{",
"e",
"=",
"(",
"DateTimeException",
")",
"t",
";",
"continue",
";",
"}",
"break",
";",
"}",
"return",
"e",
";",
"}"
] |
Helper method used to peel off spurious wrappings of DateTimeException
@param e DateTimeException to peel
@return DateTimeException that does not have another DateTimeException as its cause.
|
[
"Helper",
"method",
"used",
"to",
"peel",
"off",
"spurious",
"wrappings",
"of",
"DateTimeException"
] |
bd093eafbd4d5216e13093b0a031e06dcbb8839b
|
https://github.com/FasterXML/jackson-modules-java8/blob/bd093eafbd4d5216e13093b0a031e06dcbb8839b/datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/JSR310DeserializerBase.java#L123-L133
|
159,232
|
FasterXML/jackson-modules-java8
|
datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/ser/InstantSerializerBase.java
|
InstantSerializerBase._acceptTimestampVisitor
|
@Override
protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
SerializerProvider prov = visitor.getProvider();
if ((prov != null) && useNanoseconds(prov)) {
JsonNumberFormatVisitor v2 = visitor.expectNumberFormat(typeHint);
if (v2 != null) {
v2.numberType(NumberType.BIG_DECIMAL);
}
} else {
JsonIntegerFormatVisitor v2 = visitor.expectIntegerFormat(typeHint);
if (v2 != null) {
v2.numberType(NumberType.LONG);
}
}
}
|
java
|
@Override
protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
SerializerProvider prov = visitor.getProvider();
if ((prov != null) && useNanoseconds(prov)) {
JsonNumberFormatVisitor v2 = visitor.expectNumberFormat(typeHint);
if (v2 != null) {
v2.numberType(NumberType.BIG_DECIMAL);
}
} else {
JsonIntegerFormatVisitor v2 = visitor.expectIntegerFormat(typeHint);
if (v2 != null) {
v2.numberType(NumberType.LONG);
}
}
}
|
[
"@",
"Override",
"protected",
"void",
"_acceptTimestampVisitor",
"(",
"JsonFormatVisitorWrapper",
"visitor",
",",
"JavaType",
"typeHint",
")",
"throws",
"JsonMappingException",
"{",
"SerializerProvider",
"prov",
"=",
"visitor",
".",
"getProvider",
"(",
")",
";",
"if",
"(",
"(",
"prov",
"!=",
"null",
")",
"&&",
"useNanoseconds",
"(",
"prov",
")",
")",
"{",
"JsonNumberFormatVisitor",
"v2",
"=",
"visitor",
".",
"expectNumberFormat",
"(",
"typeHint",
")",
";",
"if",
"(",
"v2",
"!=",
"null",
")",
"{",
"v2",
".",
"numberType",
"(",
"NumberType",
".",
"BIG_DECIMAL",
")",
";",
"}",
"}",
"else",
"{",
"JsonIntegerFormatVisitor",
"v2",
"=",
"visitor",
".",
"expectIntegerFormat",
"(",
"typeHint",
")",
";",
"if",
"(",
"v2",
"!=",
"null",
")",
"{",
"v2",
".",
"numberType",
"(",
"NumberType",
".",
"LONG",
")",
";",
"}",
"}",
"}"
] |
Overridden to ensure that our timestamp handling is as expected
|
[
"Overridden",
"to",
"ensure",
"that",
"our",
"timestamp",
"handling",
"is",
"as",
"expected"
] |
bd093eafbd4d5216e13093b0a031e06dcbb8839b
|
https://github.com/FasterXML/jackson-modules-java8/blob/bd093eafbd4d5216e13093b0a031e06dcbb8839b/datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/ser/InstantSerializerBase.java#L107-L123
|
159,233
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/HyperLinkUtil.java
|
HyperLinkUtil.applyHyperLinkToElement
|
public static void applyHyperLinkToElement(DynamicJasperDesign design, DJHyperLink djlink, JRDesignChart chart, String name) {
JRDesignExpression hlpe = ExpressionUtils.createAndRegisterExpression(design, name, djlink.getExpression());
chart.setHyperlinkReferenceExpression(hlpe);
chart.setHyperlinkType( HyperlinkTypeEnum.REFERENCE ); //FIXME Should this be a parameter in the future?
if (djlink.getTooltip() != null){
JRDesignExpression tooltipExp = ExpressionUtils.createAndRegisterExpression(design, "tooltip_" + name, djlink.getTooltip());
chart.setHyperlinkTooltipExpression(tooltipExp);
}
}
|
java
|
public static void applyHyperLinkToElement(DynamicJasperDesign design, DJHyperLink djlink, JRDesignChart chart, String name) {
JRDesignExpression hlpe = ExpressionUtils.createAndRegisterExpression(design, name, djlink.getExpression());
chart.setHyperlinkReferenceExpression(hlpe);
chart.setHyperlinkType( HyperlinkTypeEnum.REFERENCE ); //FIXME Should this be a parameter in the future?
if (djlink.getTooltip() != null){
JRDesignExpression tooltipExp = ExpressionUtils.createAndRegisterExpression(design, "tooltip_" + name, djlink.getTooltip());
chart.setHyperlinkTooltipExpression(tooltipExp);
}
}
|
[
"public",
"static",
"void",
"applyHyperLinkToElement",
"(",
"DynamicJasperDesign",
"design",
",",
"DJHyperLink",
"djlink",
",",
"JRDesignChart",
"chart",
",",
"String",
"name",
")",
"{",
"JRDesignExpression",
"hlpe",
"=",
"ExpressionUtils",
".",
"createAndRegisterExpression",
"(",
"design",
",",
"name",
",",
"djlink",
".",
"getExpression",
"(",
")",
")",
";",
"chart",
".",
"setHyperlinkReferenceExpression",
"(",
"hlpe",
")",
";",
"chart",
".",
"setHyperlinkType",
"(",
"HyperlinkTypeEnum",
".",
"REFERENCE",
")",
";",
"//FIXME Should this be a parameter in the future?",
"if",
"(",
"djlink",
".",
"getTooltip",
"(",
")",
"!=",
"null",
")",
"{",
"JRDesignExpression",
"tooltipExp",
"=",
"ExpressionUtils",
".",
"createAndRegisterExpression",
"(",
"design",
",",
"\"tooltip_\"",
"+",
"name",
",",
"djlink",
".",
"getTooltip",
"(",
")",
")",
";",
"chart",
".",
"setHyperlinkTooltipExpression",
"(",
"tooltipExp",
")",
";",
"}",
"}"
] |
Creates necessary objects to make a chart an hyperlink
@param design
@param djlink
@param chart
@param name
|
[
"Creates",
"necessary",
"objects",
"to",
"make",
"a",
"chart",
"an",
"hyperlink"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/HyperLinkUtil.java#L95-L104
|
159,234
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
|
Dj2JrCrosstabBuilder.setCrosstabOptions
|
private void setCrosstabOptions() {
if (djcross.isUseFullWidth()){
jrcross.setWidth(layoutManager.getReport().getOptions().getPrintableWidth());
} else {
jrcross.setWidth(djcross.getWidth());
}
jrcross.setHeight(djcross.getHeight());
jrcross.setColumnBreakOffset(djcross.getColumnBreakOffset());
jrcross.setIgnoreWidth(djcross.isIgnoreWidth());
}
|
java
|
private void setCrosstabOptions() {
if (djcross.isUseFullWidth()){
jrcross.setWidth(layoutManager.getReport().getOptions().getPrintableWidth());
} else {
jrcross.setWidth(djcross.getWidth());
}
jrcross.setHeight(djcross.getHeight());
jrcross.setColumnBreakOffset(djcross.getColumnBreakOffset());
jrcross.setIgnoreWidth(djcross.isIgnoreWidth());
}
|
[
"private",
"void",
"setCrosstabOptions",
"(",
")",
"{",
"if",
"(",
"djcross",
".",
"isUseFullWidth",
"(",
")",
")",
"{",
"jrcross",
".",
"setWidth",
"(",
"layoutManager",
".",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getPrintableWidth",
"(",
")",
")",
";",
"}",
"else",
"{",
"jrcross",
".",
"setWidth",
"(",
"djcross",
".",
"getWidth",
"(",
")",
")",
";",
"}",
"jrcross",
".",
"setHeight",
"(",
"djcross",
".",
"getHeight",
"(",
")",
")",
";",
"jrcross",
".",
"setColumnBreakOffset",
"(",
"djcross",
".",
"getColumnBreakOffset",
"(",
")",
")",
";",
"jrcross",
".",
"setIgnoreWidth",
"(",
"djcross",
".",
"isIgnoreWidth",
"(",
")",
")",
";",
"}"
] |
Sets the options contained in the DJCrosstab to the JRDesignCrosstab.
Also fits the correct width
|
[
"Sets",
"the",
"options",
"contained",
"in",
"the",
"DJCrosstab",
"to",
"the",
"JRDesignCrosstab",
".",
"Also",
"fits",
"the",
"correct",
"width"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L174-L185
|
159,235
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
|
Dj2JrCrosstabBuilder.setExpressionForPrecalculatedTotalValue
|
private void setExpressionForPrecalculatedTotalValue(
DJCrosstabColumn[] auxCols, DJCrosstabRow[] auxRows, JRDesignExpression measureExp, DJCrosstabMeasure djmeasure,
DJCrosstabColumn crosstabColumn, DJCrosstabRow crosstabRow, String meausrePrefix) {
String rowValuesExp = "new Object[]{";
String rowPropsExp = "new String[]{";
for (int i = 0; i < auxRows.length; i++) {
if (auxRows[i].getProperty()== null)
continue;
rowValuesExp += "$V{" + auxRows[i].getProperty().getProperty() +"}";
rowPropsExp += "\"" + auxRows[i].getProperty().getProperty() +"\"";
if (i+1<auxRows.length && auxRows[i+1].getProperty()!= null){
rowValuesExp += ", ";
rowPropsExp += ", ";
}
}
rowValuesExp += "}";
rowPropsExp += "}";
String colValuesExp = "new Object[]{";
String colPropsExp = "new String[]{";
for (int i = 0; i < auxCols.length; i++) {
if (auxCols[i].getProperty()== null)
continue;
colValuesExp += "$V{" + auxCols[i].getProperty().getProperty() +"}";
colPropsExp += "\"" + auxCols[i].getProperty().getProperty() +"\"";
if (i+1<auxCols.length && auxCols[i+1].getProperty()!= null){
colValuesExp += ", ";
colPropsExp += ", ";
}
}
colValuesExp += "}";
colPropsExp += "}";
String measureProperty = meausrePrefix + djmeasure.getProperty().getProperty();
String expText = "((("+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+")$P{crosstab-measure__"+measureProperty+"_totalProvider}).getValueFor( "
+ colPropsExp +", "
+ colValuesExp +", "
+ rowPropsExp
+ ", "
+ rowValuesExp
+" ))";
if (djmeasure.getValueFormatter() != null){
String fieldsMap = ExpressionUtils.getTextForFieldsFromScriptlet();
String parametersMap = ExpressionUtils.getTextForParametersFromScriptlet();
String variablesMap = ExpressionUtils.getTextForVariablesFromScriptlet();
String stringExpression = "((("+DJValueFormatter.class.getName()+")$P{crosstab-measure__"+measureProperty+"_vf}).evaluate( "
+ "("+expText+"), " + fieldsMap +", " + variablesMap + ", " + parametersMap +" ))";
measureExp.setText(stringExpression);
measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
} else {
// String expText = "((("+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+")$P{crosstab-measure__"+djmeasure.getProperty().getProperty()+"_totalProvider}).getValueFor( "
// + colPropsExp +", "
// + colValuesExp +", "
// + rowPropsExp
// + ", "
// + rowValuesExp
// +" ))";
//
log.debug("text for crosstab total provider is: " + expText);
measureExp.setText(expText);
// measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
String valueClassNameForOperation = ExpressionUtils.getValueClassNameForOperation(djmeasure.getOperation(),djmeasure.getProperty());
measureExp.setValueClassName(valueClassNameForOperation);
}
}
|
java
|
private void setExpressionForPrecalculatedTotalValue(
DJCrosstabColumn[] auxCols, DJCrosstabRow[] auxRows, JRDesignExpression measureExp, DJCrosstabMeasure djmeasure,
DJCrosstabColumn crosstabColumn, DJCrosstabRow crosstabRow, String meausrePrefix) {
String rowValuesExp = "new Object[]{";
String rowPropsExp = "new String[]{";
for (int i = 0; i < auxRows.length; i++) {
if (auxRows[i].getProperty()== null)
continue;
rowValuesExp += "$V{" + auxRows[i].getProperty().getProperty() +"}";
rowPropsExp += "\"" + auxRows[i].getProperty().getProperty() +"\"";
if (i+1<auxRows.length && auxRows[i+1].getProperty()!= null){
rowValuesExp += ", ";
rowPropsExp += ", ";
}
}
rowValuesExp += "}";
rowPropsExp += "}";
String colValuesExp = "new Object[]{";
String colPropsExp = "new String[]{";
for (int i = 0; i < auxCols.length; i++) {
if (auxCols[i].getProperty()== null)
continue;
colValuesExp += "$V{" + auxCols[i].getProperty().getProperty() +"}";
colPropsExp += "\"" + auxCols[i].getProperty().getProperty() +"\"";
if (i+1<auxCols.length && auxCols[i+1].getProperty()!= null){
colValuesExp += ", ";
colPropsExp += ", ";
}
}
colValuesExp += "}";
colPropsExp += "}";
String measureProperty = meausrePrefix + djmeasure.getProperty().getProperty();
String expText = "((("+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+")$P{crosstab-measure__"+measureProperty+"_totalProvider}).getValueFor( "
+ colPropsExp +", "
+ colValuesExp +", "
+ rowPropsExp
+ ", "
+ rowValuesExp
+" ))";
if (djmeasure.getValueFormatter() != null){
String fieldsMap = ExpressionUtils.getTextForFieldsFromScriptlet();
String parametersMap = ExpressionUtils.getTextForParametersFromScriptlet();
String variablesMap = ExpressionUtils.getTextForVariablesFromScriptlet();
String stringExpression = "((("+DJValueFormatter.class.getName()+")$P{crosstab-measure__"+measureProperty+"_vf}).evaluate( "
+ "("+expText+"), " + fieldsMap +", " + variablesMap + ", " + parametersMap +" ))";
measureExp.setText(stringExpression);
measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
} else {
// String expText = "((("+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+")$P{crosstab-measure__"+djmeasure.getProperty().getProperty()+"_totalProvider}).getValueFor( "
// + colPropsExp +", "
// + colValuesExp +", "
// + rowPropsExp
// + ", "
// + rowValuesExp
// +" ))";
//
log.debug("text for crosstab total provider is: " + expText);
measureExp.setText(expText);
// measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
String valueClassNameForOperation = ExpressionUtils.getValueClassNameForOperation(djmeasure.getOperation(),djmeasure.getProperty());
measureExp.setValueClassName(valueClassNameForOperation);
}
}
|
[
"private",
"void",
"setExpressionForPrecalculatedTotalValue",
"(",
"DJCrosstabColumn",
"[",
"]",
"auxCols",
",",
"DJCrosstabRow",
"[",
"]",
"auxRows",
",",
"JRDesignExpression",
"measureExp",
",",
"DJCrosstabMeasure",
"djmeasure",
",",
"DJCrosstabColumn",
"crosstabColumn",
",",
"DJCrosstabRow",
"crosstabRow",
",",
"String",
"meausrePrefix",
")",
"{",
"String",
"rowValuesExp",
"=",
"\"new Object[]{\"",
";",
"String",
"rowPropsExp",
"=",
"\"new String[]{\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"auxRows",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"auxRows",
"[",
"i",
"]",
".",
"getProperty",
"(",
")",
"==",
"null",
")",
"continue",
";",
"rowValuesExp",
"+=",
"\"$V{\"",
"+",
"auxRows",
"[",
"i",
"]",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
";",
"rowPropsExp",
"+=",
"\"\\\"\"",
"+",
"auxRows",
"[",
"i",
"]",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"\\\"\"",
";",
"if",
"(",
"i",
"+",
"1",
"<",
"auxRows",
".",
"length",
"&&",
"auxRows",
"[",
"i",
"+",
"1",
"]",
".",
"getProperty",
"(",
")",
"!=",
"null",
")",
"{",
"rowValuesExp",
"+=",
"\", \"",
";",
"rowPropsExp",
"+=",
"\", \"",
";",
"}",
"}",
"rowValuesExp",
"+=",
"\"}\"",
";",
"rowPropsExp",
"+=",
"\"}\"",
";",
"String",
"colValuesExp",
"=",
"\"new Object[]{\"",
";",
"String",
"colPropsExp",
"=",
"\"new String[]{\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"auxCols",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"auxCols",
"[",
"i",
"]",
".",
"getProperty",
"(",
")",
"==",
"null",
")",
"continue",
";",
"colValuesExp",
"+=",
"\"$V{\"",
"+",
"auxCols",
"[",
"i",
"]",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
";",
"colPropsExp",
"+=",
"\"\\\"\"",
"+",
"auxCols",
"[",
"i",
"]",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"\\\"\"",
";",
"if",
"(",
"i",
"+",
"1",
"<",
"auxCols",
".",
"length",
"&&",
"auxCols",
"[",
"i",
"+",
"1",
"]",
".",
"getProperty",
"(",
")",
"!=",
"null",
")",
"{",
"colValuesExp",
"+=",
"\", \"",
";",
"colPropsExp",
"+=",
"\", \"",
";",
"}",
"}",
"colValuesExp",
"+=",
"\"}\"",
";",
"colPropsExp",
"+=",
"\"}\"",
";",
"String",
"measureProperty",
"=",
"meausrePrefix",
"+",
"djmeasure",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
";",
"String",
"expText",
"=",
"\"(((\"",
"+",
"DJCRosstabMeasurePrecalculatedTotalProvider",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{crosstab-measure__\"",
"+",
"measureProperty",
"+",
"\"_totalProvider}).getValueFor( \"",
"+",
"colPropsExp",
"+",
"\", \"",
"+",
"colValuesExp",
"+",
"\", \"",
"+",
"rowPropsExp",
"+",
"\", \"",
"+",
"rowValuesExp",
"+",
"\" ))\"",
";",
"if",
"(",
"djmeasure",
".",
"getValueFormatter",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"fieldsMap",
"=",
"ExpressionUtils",
".",
"getTextForFieldsFromScriptlet",
"(",
")",
";",
"String",
"parametersMap",
"=",
"ExpressionUtils",
".",
"getTextForParametersFromScriptlet",
"(",
")",
";",
"String",
"variablesMap",
"=",
"ExpressionUtils",
".",
"getTextForVariablesFromScriptlet",
"(",
")",
";",
"String",
"stringExpression",
"=",
"\"(((\"",
"+",
"DJValueFormatter",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{crosstab-measure__\"",
"+",
"measureProperty",
"+",
"\"_vf}).evaluate( \"",
"+",
"\"(\"",
"+",
"expText",
"+",
"\"), \"",
"+",
"fieldsMap",
"+",
"\", \"",
"+",
"variablesMap",
"+",
"\", \"",
"+",
"parametersMap",
"+",
"\" ))\"",
";",
"measureExp",
".",
"setText",
"(",
"stringExpression",
")",
";",
"measureExp",
".",
"setValueClassName",
"(",
"djmeasure",
".",
"getValueFormatter",
"(",
")",
".",
"getClassName",
"(",
")",
")",
";",
"}",
"else",
"{",
"//\t\t\tString expText = \"(((\"+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+\")$P{crosstab-measure__\"+djmeasure.getProperty().getProperty()+\"_totalProvider}).getValueFor( \"",
"//\t\t\t+ colPropsExp +\", \"",
"//\t\t\t+ colValuesExp +\", \"",
"//\t\t\t+ rowPropsExp",
"//\t\t\t+ \", \"",
"//\t\t\t+ rowValuesExp",
"//\t\t\t+\" ))\";",
"//",
"log",
".",
"debug",
"(",
"\"text for crosstab total provider is: \"",
"+",
"expText",
")",
";",
"measureExp",
".",
"setText",
"(",
"expText",
")",
";",
"//\t\t\tmeasureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());",
"String",
"valueClassNameForOperation",
"=",
"ExpressionUtils",
".",
"getValueClassNameForOperation",
"(",
"djmeasure",
".",
"getOperation",
"(",
")",
",",
"djmeasure",
".",
"getProperty",
"(",
")",
")",
";",
"measureExp",
".",
"setValueClassName",
"(",
"valueClassNameForOperation",
")",
";",
"}",
"}"
] |
set proper expression text invoking the DJCRosstabMeasurePrecalculatedTotalProvider for the cell
@param auxRows
@param auxCols
@param measureExp
@param djmeasure
@param crosstabColumn
@param crosstabRow
@param meausrePrefix
|
[
"set",
"proper",
"expression",
"text",
"invoking",
"the",
"DJCRosstabMeasurePrecalculatedTotalProvider",
"for",
"the",
"cell"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L557-L629
|
159,236
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
|
Dj2JrCrosstabBuilder.getRowTotalStyle
|
private Style getRowTotalStyle(DJCrosstabRow crosstabRow) {
return crosstabRow.getTotalStyle() == null ? this.djcross.getRowTotalStyle(): crosstabRow.getTotalStyle();
}
|
java
|
private Style getRowTotalStyle(DJCrosstabRow crosstabRow) {
return crosstabRow.getTotalStyle() == null ? this.djcross.getRowTotalStyle(): crosstabRow.getTotalStyle();
}
|
[
"private",
"Style",
"getRowTotalStyle",
"(",
"DJCrosstabRow",
"crosstabRow",
")",
"{",
"return",
"crosstabRow",
".",
"getTotalStyle",
"(",
")",
"==",
"null",
"?",
"this",
".",
"djcross",
".",
"getRowTotalStyle",
"(",
")",
":",
"crosstabRow",
".",
"getTotalStyle",
"(",
")",
";",
"}"
] |
MOVED INSIDE ExpressionUtils
protected JRDesignExpression getExpressionForConditionalStyle(ConditionalStyle condition, String columExpression) {
String fieldsMap = "(("+DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentFields()";
String parametersMap = "(("+DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentParams()";
String variablesMap = "(("+DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentVariables()";
String evalMethodParams = fieldsMap +", " + variablesMap + ", " + parametersMap + ", " + columExpression;
String text = "(("+ConditionStyleExpression.class.getName()+")$P{" + JRParameter.REPORT_PARAMETERS_MAP + "}.get(\""+condition.getName()+"\"))."+CustomExpression.EVAL_METHOD_NAME+"("+evalMethodParams+")";
JRDesignExpression expression = new JRDesignExpression();
expression.setValueClass(Boolean.class);
expression.setText(text);
return expression;
}
|
[
"MOVED",
"INSIDE",
"ExpressionUtils"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L661-L663
|
159,237
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
|
Dj2JrCrosstabBuilder.registerRows
|
private void registerRows() {
for (int i = 0; i < rows.length; i++) {
DJCrosstabRow crosstabRow = rows[i];
JRDesignCrosstabRowGroup ctRowGroup = new JRDesignCrosstabRowGroup();
ctRowGroup.setWidth(crosstabRow.getHeaderWidth());
ctRowGroup.setName(crosstabRow.getProperty().getProperty());
JRDesignCrosstabBucket rowBucket = new JRDesignCrosstabBucket();
//New in JR 4.1+
rowBucket.setValueClassName(crosstabRow.getProperty().getValueClassName());
ctRowGroup.setBucket(rowBucket);
JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabRow.getProperty().getProperty()+"}", crosstabRow.getProperty().getValueClassName());
rowBucket.setExpression(bucketExp);
JRDesignCellContents rowHeaderContents = new JRDesignCellContents();
JRDesignTextField rowTitle = new JRDesignTextField();
JRDesignExpression rowTitExp = new JRDesignExpression();
rowTitExp.setValueClassName(crosstabRow.getProperty().getValueClassName());
rowTitExp.setText("$V{"+crosstabRow.getProperty().getProperty()+"}");
rowTitle.setExpression(rowTitExp);
rowTitle.setWidth(crosstabRow.getHeaderWidth());
//The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.
int auxHeight = getRowHeaderMaxHeight(crosstabRow);
// int auxHeight = crosstabRow.getHeight(); //FIXME getRowHeaderMaxHeight() must be FIXED because it breaks when 1rs row shows total and 2nd doesn't
rowTitle.setHeight(auxHeight);
Style headerstyle = crosstabRow.getHeaderStyle() == null ? this.djcross.getRowHeaderStyle(): crosstabRow.getHeaderStyle();
if (headerstyle != null){
layoutManager.applyStyleToElement(headerstyle, rowTitle);
rowHeaderContents.setBackcolor(headerstyle.getBackgroundColor());
}
rowHeaderContents.addElement(rowTitle);
rowHeaderContents.setMode( ModeEnum.OPAQUE );
boolean fullBorder = i <= 0; //Only outer most will have full border
applyCellBorder(rowHeaderContents, false, fullBorder);
ctRowGroup.setHeader(rowHeaderContents );
if (crosstabRow.isShowTotals())
createRowTotalHeader(ctRowGroup,crosstabRow,fullBorder);
try {
jrcross.addRowGroup(ctRowGroup);
} catch (JRException e) {
log.error(e.getMessage(),e);
}
}
}
|
java
|
private void registerRows() {
for (int i = 0; i < rows.length; i++) {
DJCrosstabRow crosstabRow = rows[i];
JRDesignCrosstabRowGroup ctRowGroup = new JRDesignCrosstabRowGroup();
ctRowGroup.setWidth(crosstabRow.getHeaderWidth());
ctRowGroup.setName(crosstabRow.getProperty().getProperty());
JRDesignCrosstabBucket rowBucket = new JRDesignCrosstabBucket();
//New in JR 4.1+
rowBucket.setValueClassName(crosstabRow.getProperty().getValueClassName());
ctRowGroup.setBucket(rowBucket);
JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabRow.getProperty().getProperty()+"}", crosstabRow.getProperty().getValueClassName());
rowBucket.setExpression(bucketExp);
JRDesignCellContents rowHeaderContents = new JRDesignCellContents();
JRDesignTextField rowTitle = new JRDesignTextField();
JRDesignExpression rowTitExp = new JRDesignExpression();
rowTitExp.setValueClassName(crosstabRow.getProperty().getValueClassName());
rowTitExp.setText("$V{"+crosstabRow.getProperty().getProperty()+"}");
rowTitle.setExpression(rowTitExp);
rowTitle.setWidth(crosstabRow.getHeaderWidth());
//The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.
int auxHeight = getRowHeaderMaxHeight(crosstabRow);
// int auxHeight = crosstabRow.getHeight(); //FIXME getRowHeaderMaxHeight() must be FIXED because it breaks when 1rs row shows total and 2nd doesn't
rowTitle.setHeight(auxHeight);
Style headerstyle = crosstabRow.getHeaderStyle() == null ? this.djcross.getRowHeaderStyle(): crosstabRow.getHeaderStyle();
if (headerstyle != null){
layoutManager.applyStyleToElement(headerstyle, rowTitle);
rowHeaderContents.setBackcolor(headerstyle.getBackgroundColor());
}
rowHeaderContents.addElement(rowTitle);
rowHeaderContents.setMode( ModeEnum.OPAQUE );
boolean fullBorder = i <= 0; //Only outer most will have full border
applyCellBorder(rowHeaderContents, false, fullBorder);
ctRowGroup.setHeader(rowHeaderContents );
if (crosstabRow.isShowTotals())
createRowTotalHeader(ctRowGroup,crosstabRow,fullBorder);
try {
jrcross.addRowGroup(ctRowGroup);
} catch (JRException e) {
log.error(e.getMessage(),e);
}
}
}
|
[
"private",
"void",
"registerRows",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
".",
"length",
";",
"i",
"++",
")",
"{",
"DJCrosstabRow",
"crosstabRow",
"=",
"rows",
"[",
"i",
"]",
";",
"JRDesignCrosstabRowGroup",
"ctRowGroup",
"=",
"new",
"JRDesignCrosstabRowGroup",
"(",
")",
";",
"ctRowGroup",
".",
"setWidth",
"(",
"crosstabRow",
".",
"getHeaderWidth",
"(",
")",
")",
";",
"ctRowGroup",
".",
"setName",
"(",
"crosstabRow",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
")",
";",
"JRDesignCrosstabBucket",
"rowBucket",
"=",
"new",
"JRDesignCrosstabBucket",
"(",
")",
";",
"//New in JR 4.1+",
"rowBucket",
".",
"setValueClassName",
"(",
"crosstabRow",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"ctRowGroup",
".",
"setBucket",
"(",
"rowBucket",
")",
";",
"JRDesignExpression",
"bucketExp",
"=",
"ExpressionUtils",
".",
"createExpression",
"(",
"\"$F{\"",
"+",
"crosstabRow",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
",",
"crosstabRow",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"rowBucket",
".",
"setExpression",
"(",
"bucketExp",
")",
";",
"JRDesignCellContents",
"rowHeaderContents",
"=",
"new",
"JRDesignCellContents",
"(",
")",
";",
"JRDesignTextField",
"rowTitle",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"JRDesignExpression",
"rowTitExp",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"rowTitExp",
".",
"setValueClassName",
"(",
"crosstabRow",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"rowTitExp",
".",
"setText",
"(",
"\"$V{\"",
"+",
"crosstabRow",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
")",
";",
"rowTitle",
".",
"setExpression",
"(",
"rowTitExp",
")",
";",
"rowTitle",
".",
"setWidth",
"(",
"crosstabRow",
".",
"getHeaderWidth",
"(",
")",
")",
";",
"//The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.",
"int",
"auxHeight",
"=",
"getRowHeaderMaxHeight",
"(",
"crosstabRow",
")",
";",
"//\t\t\tint auxHeight = crosstabRow.getHeight(); //FIXME getRowHeaderMaxHeight() must be FIXED because it breaks when 1rs row shows total and 2nd doesn't",
"rowTitle",
".",
"setHeight",
"(",
"auxHeight",
")",
";",
"Style",
"headerstyle",
"=",
"crosstabRow",
".",
"getHeaderStyle",
"(",
")",
"==",
"null",
"?",
"this",
".",
"djcross",
".",
"getRowHeaderStyle",
"(",
")",
":",
"crosstabRow",
".",
"getHeaderStyle",
"(",
")",
";",
"if",
"(",
"headerstyle",
"!=",
"null",
")",
"{",
"layoutManager",
".",
"applyStyleToElement",
"(",
"headerstyle",
",",
"rowTitle",
")",
";",
"rowHeaderContents",
".",
"setBackcolor",
"(",
"headerstyle",
".",
"getBackgroundColor",
"(",
")",
")",
";",
"}",
"rowHeaderContents",
".",
"addElement",
"(",
"rowTitle",
")",
";",
"rowHeaderContents",
".",
"setMode",
"(",
"ModeEnum",
".",
"OPAQUE",
")",
";",
"boolean",
"fullBorder",
"=",
"i",
"<=",
"0",
";",
"//Only outer most will have full border",
"applyCellBorder",
"(",
"rowHeaderContents",
",",
"false",
",",
"fullBorder",
")",
";",
"ctRowGroup",
".",
"setHeader",
"(",
"rowHeaderContents",
")",
";",
"if",
"(",
"crosstabRow",
".",
"isShowTotals",
"(",
")",
")",
"createRowTotalHeader",
"(",
"ctRowGroup",
",",
"crosstabRow",
",",
"fullBorder",
")",
";",
"try",
"{",
"jrcross",
".",
"addRowGroup",
"(",
"ctRowGroup",
")",
";",
"}",
"catch",
"(",
"JRException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
Register the Rowgroup buckets and places the header cells for the rows
|
[
"Register",
"the",
"Rowgroup",
"buckets",
"and",
"places",
"the",
"header",
"cells",
"for",
"the",
"rows"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L773-L835
|
159,238
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
|
Dj2JrCrosstabBuilder.registerColumns
|
private void registerColumns() {
for (int i = 0; i < cols.length; i++) {
DJCrosstabColumn crosstabColumn = cols[i];
JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup();
ctColGroup.setName(crosstabColumn.getProperty().getProperty());
ctColGroup.setHeight(crosstabColumn.getHeaderHeight());
JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();
bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName());
JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName());
bucket.setExpression(bucketExp);
ctColGroup.setBucket(bucket);
JRDesignCellContents colHeaerContent = new JRDesignCellContents();
JRDesignTextField colTitle = new JRDesignTextField();
JRDesignExpression colTitleExp = new JRDesignExpression();
colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");
colTitle.setExpression(colTitleExp);
colTitle.setWidth(crosstabColumn.getWidth());
colTitle.setHeight(crosstabColumn.getHeaderHeight());
//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.
int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn);
colTitle.setWidth(auxWidth);
Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle();
if (headerstyle != null){
layoutManager.applyStyleToElement(headerstyle,colTitle);
colHeaerContent.setBackcolor(headerstyle.getBackgroundColor());
}
colHeaerContent.addElement(colTitle);
colHeaerContent.setMode( ModeEnum.OPAQUE );
boolean fullBorder = i <= 0; //Only outer most will have full border
applyCellBorder(colHeaerContent, fullBorder, false);
ctColGroup.setHeader(colHeaerContent);
if (crosstabColumn.isShowTotals())
createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder);
try {
jrcross.addColumnGroup(ctColGroup);
} catch (JRException e) {
log.error(e.getMessage(),e);
}
}
}
|
java
|
private void registerColumns() {
for (int i = 0; i < cols.length; i++) {
DJCrosstabColumn crosstabColumn = cols[i];
JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup();
ctColGroup.setName(crosstabColumn.getProperty().getProperty());
ctColGroup.setHeight(crosstabColumn.getHeaderHeight());
JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();
bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName());
JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName());
bucket.setExpression(bucketExp);
ctColGroup.setBucket(bucket);
JRDesignCellContents colHeaerContent = new JRDesignCellContents();
JRDesignTextField colTitle = new JRDesignTextField();
JRDesignExpression colTitleExp = new JRDesignExpression();
colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");
colTitle.setExpression(colTitleExp);
colTitle.setWidth(crosstabColumn.getWidth());
colTitle.setHeight(crosstabColumn.getHeaderHeight());
//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.
int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn);
colTitle.setWidth(auxWidth);
Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle();
if (headerstyle != null){
layoutManager.applyStyleToElement(headerstyle,colTitle);
colHeaerContent.setBackcolor(headerstyle.getBackgroundColor());
}
colHeaerContent.addElement(colTitle);
colHeaerContent.setMode( ModeEnum.OPAQUE );
boolean fullBorder = i <= 0; //Only outer most will have full border
applyCellBorder(colHeaerContent, fullBorder, false);
ctColGroup.setHeader(colHeaerContent);
if (crosstabColumn.isShowTotals())
createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder);
try {
jrcross.addColumnGroup(ctColGroup);
} catch (JRException e) {
log.error(e.getMessage(),e);
}
}
}
|
[
"private",
"void",
"registerColumns",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cols",
".",
"length",
";",
"i",
"++",
")",
"{",
"DJCrosstabColumn",
"crosstabColumn",
"=",
"cols",
"[",
"i",
"]",
";",
"JRDesignCrosstabColumnGroup",
"ctColGroup",
"=",
"new",
"JRDesignCrosstabColumnGroup",
"(",
")",
";",
"ctColGroup",
".",
"setName",
"(",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
")",
";",
"ctColGroup",
".",
"setHeight",
"(",
"crosstabColumn",
".",
"getHeaderHeight",
"(",
")",
")",
";",
"JRDesignCrosstabBucket",
"bucket",
"=",
"new",
"JRDesignCrosstabBucket",
"(",
")",
";",
"bucket",
".",
"setValueClassName",
"(",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"JRDesignExpression",
"bucketExp",
"=",
"ExpressionUtils",
".",
"createExpression",
"(",
"\"$F{\"",
"+",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
",",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"bucket",
".",
"setExpression",
"(",
"bucketExp",
")",
";",
"ctColGroup",
".",
"setBucket",
"(",
"bucket",
")",
";",
"JRDesignCellContents",
"colHeaerContent",
"=",
"new",
"JRDesignCellContents",
"(",
")",
";",
"JRDesignTextField",
"colTitle",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"JRDesignExpression",
"colTitleExp",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"colTitleExp",
".",
"setValueClassName",
"(",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"colTitleExp",
".",
"setText",
"(",
"\"$V{\"",
"+",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
")",
";",
"colTitle",
".",
"setExpression",
"(",
"colTitleExp",
")",
";",
"colTitle",
".",
"setWidth",
"(",
"crosstabColumn",
".",
"getWidth",
"(",
")",
")",
";",
"colTitle",
".",
"setHeight",
"(",
"crosstabColumn",
".",
"getHeaderHeight",
"(",
")",
")",
";",
"//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.",
"int",
"auxWidth",
"=",
"calculateRowHeaderMaxWidth",
"(",
"crosstabColumn",
")",
";",
"colTitle",
".",
"setWidth",
"(",
"auxWidth",
")",
";",
"Style",
"headerstyle",
"=",
"crosstabColumn",
".",
"getHeaderStyle",
"(",
")",
"==",
"null",
"?",
"this",
".",
"djcross",
".",
"getColumnHeaderStyle",
"(",
")",
":",
"crosstabColumn",
".",
"getHeaderStyle",
"(",
")",
";",
"if",
"(",
"headerstyle",
"!=",
"null",
")",
"{",
"layoutManager",
".",
"applyStyleToElement",
"(",
"headerstyle",
",",
"colTitle",
")",
";",
"colHeaerContent",
".",
"setBackcolor",
"(",
"headerstyle",
".",
"getBackgroundColor",
"(",
")",
")",
";",
"}",
"colHeaerContent",
".",
"addElement",
"(",
"colTitle",
")",
";",
"colHeaerContent",
".",
"setMode",
"(",
"ModeEnum",
".",
"OPAQUE",
")",
";",
"boolean",
"fullBorder",
"=",
"i",
"<=",
"0",
";",
"//Only outer most will have full border",
"applyCellBorder",
"(",
"colHeaerContent",
",",
"fullBorder",
",",
"false",
")",
";",
"ctColGroup",
".",
"setHeader",
"(",
"colHeaerContent",
")",
";",
"if",
"(",
"crosstabColumn",
".",
"isShowTotals",
"(",
")",
")",
"createColumTotalHeader",
"(",
"ctColGroup",
",",
"crosstabColumn",
",",
"fullBorder",
")",
";",
"try",
"{",
"jrcross",
".",
"addColumnGroup",
"(",
"ctColGroup",
")",
";",
"}",
"catch",
"(",
"JRException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
Registers the Columngroup Buckets and creates the header cell for the columns
|
[
"Registers",
"the",
"Columngroup",
"Buckets",
"and",
"creates",
"the",
"header",
"cell",
"for",
"the",
"columns"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L864-L923
|
159,239
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
|
Dj2JrCrosstabBuilder.calculateRowHeaderMaxWidth
|
private int calculateRowHeaderMaxWidth(DJCrosstabColumn crosstabColumn) {
int auxWidth = 0;
boolean firstTime = true;
List<DJCrosstabColumn> auxList = new ArrayList<DJCrosstabColumn>(djcross.getColumns());
Collections.reverse(auxList);
for (DJCrosstabColumn col : auxList) {
if (col.equals(crosstabColumn)){
if (auxWidth == 0)
auxWidth = col.getWidth();
break;
}
if (firstTime){
auxWidth += col.getWidth();
firstTime = false;
}
if (col.isShowTotals()) {
auxWidth += col.getWidth();
}
}
return auxWidth;
}
|
java
|
private int calculateRowHeaderMaxWidth(DJCrosstabColumn crosstabColumn) {
int auxWidth = 0;
boolean firstTime = true;
List<DJCrosstabColumn> auxList = new ArrayList<DJCrosstabColumn>(djcross.getColumns());
Collections.reverse(auxList);
for (DJCrosstabColumn col : auxList) {
if (col.equals(crosstabColumn)){
if (auxWidth == 0)
auxWidth = col.getWidth();
break;
}
if (firstTime){
auxWidth += col.getWidth();
firstTime = false;
}
if (col.isShowTotals()) {
auxWidth += col.getWidth();
}
}
return auxWidth;
}
|
[
"private",
"int",
"calculateRowHeaderMaxWidth",
"(",
"DJCrosstabColumn",
"crosstabColumn",
")",
"{",
"int",
"auxWidth",
"=",
"0",
";",
"boolean",
"firstTime",
"=",
"true",
";",
"List",
"<",
"DJCrosstabColumn",
">",
"auxList",
"=",
"new",
"ArrayList",
"<",
"DJCrosstabColumn",
">",
"(",
"djcross",
".",
"getColumns",
"(",
")",
")",
";",
"Collections",
".",
"reverse",
"(",
"auxList",
")",
";",
"for",
"(",
"DJCrosstabColumn",
"col",
":",
"auxList",
")",
"{",
"if",
"(",
"col",
".",
"equals",
"(",
"crosstabColumn",
")",
")",
"{",
"if",
"(",
"auxWidth",
"==",
"0",
")",
"auxWidth",
"=",
"col",
".",
"getWidth",
"(",
")",
";",
"break",
";",
"}",
"if",
"(",
"firstTime",
")",
"{",
"auxWidth",
"+=",
"col",
".",
"getWidth",
"(",
")",
";",
"firstTime",
"=",
"false",
";",
"}",
"if",
"(",
"col",
".",
"isShowTotals",
"(",
")",
")",
"{",
"auxWidth",
"+=",
"col",
".",
"getWidth",
"(",
")",
";",
"}",
"}",
"return",
"auxWidth",
";",
"}"
] |
The max possible width can be calculated doing the sum of of the inner cells and its totals
@param crosstabColumn
@return
|
[
"The",
"max",
"possible",
"width",
"can",
"be",
"calculated",
"doing",
"the",
"sum",
"of",
"of",
"the",
"inner",
"cells",
"and",
"its",
"totals"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L930-L951
|
159,240
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/chart/dataset/AbstractDataset.java
|
AbstractDataset.getExpressionFromVariable
|
protected static JRDesignExpression getExpressionFromVariable(JRDesignVariable var){
JRDesignExpression exp = new JRDesignExpression();
exp.setText("$V{" + var.getName() + "}");
exp.setValueClass(var.getValueClass());
return exp;
}
|
java
|
protected static JRDesignExpression getExpressionFromVariable(JRDesignVariable var){
JRDesignExpression exp = new JRDesignExpression();
exp.setText("$V{" + var.getName() + "}");
exp.setValueClass(var.getValueClass());
return exp;
}
|
[
"protected",
"static",
"JRDesignExpression",
"getExpressionFromVariable",
"(",
"JRDesignVariable",
"var",
")",
"{",
"JRDesignExpression",
"exp",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"exp",
".",
"setText",
"(",
"\"$V{\"",
"+",
"var",
".",
"getName",
"(",
")",
"+",
"\"}\"",
")",
";",
"exp",
".",
"setValueClass",
"(",
"var",
".",
"getValueClass",
"(",
")",
")",
";",
"return",
"exp",
";",
"}"
] |
Generates an expression from a variable
@param var The variable from which to generate the expression
@return A expression that represents the given variable
|
[
"Generates",
"an",
"expression",
"from",
"a",
"variable"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/dataset/AbstractDataset.java#L54-L59
|
159,241
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
|
DynamicJasperHelper.generateJasperPrint
|
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, JRDataSource ds, Map<String, Object> _parameters) throws JRException {
log.info("generating JasperPrint");
JasperPrint jp;
JasperReport jr = DynamicJasperHelper.generateJasperReport(dr, layoutManager, _parameters);
jp = JasperFillManager.fillReport(jr, _parameters, ds);
return jp;
}
|
java
|
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, JRDataSource ds, Map<String, Object> _parameters) throws JRException {
log.info("generating JasperPrint");
JasperPrint jp;
JasperReport jr = DynamicJasperHelper.generateJasperReport(dr, layoutManager, _parameters);
jp = JasperFillManager.fillReport(jr, _parameters, ds);
return jp;
}
|
[
"public",
"static",
"JasperPrint",
"generateJasperPrint",
"(",
"DynamicReport",
"dr",
",",
"LayoutManager",
"layoutManager",
",",
"JRDataSource",
"ds",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"_parameters",
")",
"throws",
"JRException",
"{",
"log",
".",
"info",
"(",
"\"generating JasperPrint\"",
")",
";",
"JasperPrint",
"jp",
";",
"JasperReport",
"jr",
"=",
"DynamicJasperHelper",
".",
"generateJasperReport",
"(",
"dr",
",",
"layoutManager",
",",
"_parameters",
")",
";",
"jp",
"=",
"JasperFillManager",
".",
"fillReport",
"(",
"jr",
",",
"_parameters",
",",
"ds",
")",
";",
"return",
"jp",
";",
"}"
] |
Compiles and fills the reports design.
@param dr the DynamicReport
@param layoutManager the object in charge of doing the layout
@param ds The datasource
@param _parameters Map with parameters that the report may need
@return
@throws JRException
|
[
"Compiles",
"and",
"fills",
"the",
"reports",
"design",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L238-L247
|
159,242
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
|
DynamicJasperHelper.generateJasperPrint
|
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, Connection con, Map<String, Object> _parameters) throws JRException {
log.info("generating JasperPrint");
JasperPrint jp;
if (_parameters == null)
_parameters = new HashMap<String, Object>();
visitSubreports(dr, _parameters);
compileOrLoadSubreports(dr, _parameters, "r");
DynamicJasperDesign jd = generateJasperDesign(dr);
Map<String, Object> params = new HashMap<String, Object>();
if (!_parameters.isEmpty()) {
registerParams(jd, _parameters);
params.putAll(_parameters);
}
registerEntities(jd, dr, layoutManager);
layoutManager.applyLayout(jd, dr);
JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).setProperty(JRCompiler.COMPILER_PREFIX, DJCompilerFactory.getCompilerClassName());
//JRProperties.setProperty(JRCompiler.COMPILER_PREFIX, DJCompilerFactory.getCompilerClassName());
JasperReport jr = JasperCompileManager.compileReport(jd);
params.putAll(jd.getParametersWithValues());
jp = JasperFillManager.fillReport(jr, params, con);
return jp;
}
|
java
|
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, Connection con, Map<String, Object> _parameters) throws JRException {
log.info("generating JasperPrint");
JasperPrint jp;
if (_parameters == null)
_parameters = new HashMap<String, Object>();
visitSubreports(dr, _parameters);
compileOrLoadSubreports(dr, _parameters, "r");
DynamicJasperDesign jd = generateJasperDesign(dr);
Map<String, Object> params = new HashMap<String, Object>();
if (!_parameters.isEmpty()) {
registerParams(jd, _parameters);
params.putAll(_parameters);
}
registerEntities(jd, dr, layoutManager);
layoutManager.applyLayout(jd, dr);
JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).setProperty(JRCompiler.COMPILER_PREFIX, DJCompilerFactory.getCompilerClassName());
//JRProperties.setProperty(JRCompiler.COMPILER_PREFIX, DJCompilerFactory.getCompilerClassName());
JasperReport jr = JasperCompileManager.compileReport(jd);
params.putAll(jd.getParametersWithValues());
jp = JasperFillManager.fillReport(jr, params, con);
return jp;
}
|
[
"public",
"static",
"JasperPrint",
"generateJasperPrint",
"(",
"DynamicReport",
"dr",
",",
"LayoutManager",
"layoutManager",
",",
"Connection",
"con",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"_parameters",
")",
"throws",
"JRException",
"{",
"log",
".",
"info",
"(",
"\"generating JasperPrint\"",
")",
";",
"JasperPrint",
"jp",
";",
"if",
"(",
"_parameters",
"==",
"null",
")",
"_parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"visitSubreports",
"(",
"dr",
",",
"_parameters",
")",
";",
"compileOrLoadSubreports",
"(",
"dr",
",",
"_parameters",
",",
"\"r\"",
")",
";",
"DynamicJasperDesign",
"jd",
"=",
"generateJasperDesign",
"(",
"dr",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"!",
"_parameters",
".",
"isEmpty",
"(",
")",
")",
"{",
"registerParams",
"(",
"jd",
",",
"_parameters",
")",
";",
"params",
".",
"putAll",
"(",
"_parameters",
")",
";",
"}",
"registerEntities",
"(",
"jd",
",",
"dr",
",",
"layoutManager",
")",
";",
"layoutManager",
".",
"applyLayout",
"(",
"jd",
",",
"dr",
")",
";",
"JRPropertiesUtil",
".",
"getInstance",
"(",
"DefaultJasperReportsContext",
".",
"getInstance",
"(",
")",
")",
".",
"setProperty",
"(",
"JRCompiler",
".",
"COMPILER_PREFIX",
",",
"DJCompilerFactory",
".",
"getCompilerClassName",
"(",
")",
")",
";",
"//JRProperties.setProperty(JRCompiler.COMPILER_PREFIX, DJCompilerFactory.getCompilerClassName());",
"JasperReport",
"jr",
"=",
"JasperCompileManager",
".",
"compileReport",
"(",
"jd",
")",
";",
"params",
".",
"putAll",
"(",
"jd",
".",
"getParametersWithValues",
"(",
")",
")",
";",
"jp",
"=",
"JasperFillManager",
".",
"fillReport",
"(",
"jr",
",",
"params",
",",
"con",
")",
";",
"return",
"jp",
";",
"}"
] |
For running queries embebed in the report design
@param dr
@param layoutManager
@param con
@param _parameters
@return
@throws JRException
|
[
"For",
"running",
"queries",
"embebed",
"in",
"the",
"report",
"design"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L259-L284
|
159,243
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
|
DynamicJasperHelper.generateJRXML
|
public static void generateJRXML(DynamicReport dr, LayoutManager layoutManager, Map _parameters, String xmlEncoding, OutputStream outputStream) throws JRException {
JasperReport jr = generateJasperReport(dr, layoutManager, _parameters);
if (xmlEncoding == null)
xmlEncoding = DEFAULT_XML_ENCODING;
JRXmlWriter.writeReport(jr, outputStream, xmlEncoding);
}
|
java
|
public static void generateJRXML(DynamicReport dr, LayoutManager layoutManager, Map _parameters, String xmlEncoding, OutputStream outputStream) throws JRException {
JasperReport jr = generateJasperReport(dr, layoutManager, _parameters);
if (xmlEncoding == null)
xmlEncoding = DEFAULT_XML_ENCODING;
JRXmlWriter.writeReport(jr, outputStream, xmlEncoding);
}
|
[
"public",
"static",
"void",
"generateJRXML",
"(",
"DynamicReport",
"dr",
",",
"LayoutManager",
"layoutManager",
",",
"Map",
"_parameters",
",",
"String",
"xmlEncoding",
",",
"OutputStream",
"outputStream",
")",
"throws",
"JRException",
"{",
"JasperReport",
"jr",
"=",
"generateJasperReport",
"(",
"dr",
",",
"layoutManager",
",",
"_parameters",
")",
";",
"if",
"(",
"xmlEncoding",
"==",
"null",
")",
"xmlEncoding",
"=",
"DEFAULT_XML_ENCODING",
";",
"JRXmlWriter",
".",
"writeReport",
"(",
"jr",
",",
"outputStream",
",",
"xmlEncoding",
")",
";",
"}"
] |
Creates a jrxml file
@param dr
@param layoutManager
@param _parameters
@param xmlEncoding (default is UTF-8 )
@param outputStream
@throws JRException
|
[
"Creates",
"a",
"jrxml",
"file"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L350-L355
|
159,244
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
|
DynamicJasperHelper.registerParams
|
public static void registerParams(DynamicJasperDesign jd, Map _parameters) {
for (Object key : _parameters.keySet()) {
if (key instanceof String) {
try {
Object value = _parameters.get(key);
if (jd.getParametersMap().get(key) != null) {
log.warn("Parameter \"" + key + "\" already registered, skipping this one: " + value);
continue;
}
JRDesignParameter parameter = new JRDesignParameter();
if (value == null) //There are some Map implementations that allows nulls values, just go on
continue;
// parameter.setValueClassName(value.getClass().getCanonicalName());
Class clazz = value.getClass().getComponentType();
if (clazz == null)
clazz = value.getClass();
parameter.setValueClass(clazz); //NOTE this is very strange
//when using an array as subreport-data-source, I must pass the parameter class name like this: value.getClass().getComponentType()
parameter.setName((String) key);
jd.addParameter(parameter);
} catch (JRException e) {
//nothing to do
}
}
}
}
|
java
|
public static void registerParams(DynamicJasperDesign jd, Map _parameters) {
for (Object key : _parameters.keySet()) {
if (key instanceof String) {
try {
Object value = _parameters.get(key);
if (jd.getParametersMap().get(key) != null) {
log.warn("Parameter \"" + key + "\" already registered, skipping this one: " + value);
continue;
}
JRDesignParameter parameter = new JRDesignParameter();
if (value == null) //There are some Map implementations that allows nulls values, just go on
continue;
// parameter.setValueClassName(value.getClass().getCanonicalName());
Class clazz = value.getClass().getComponentType();
if (clazz == null)
clazz = value.getClass();
parameter.setValueClass(clazz); //NOTE this is very strange
//when using an array as subreport-data-source, I must pass the parameter class name like this: value.getClass().getComponentType()
parameter.setName((String) key);
jd.addParameter(parameter);
} catch (JRException e) {
//nothing to do
}
}
}
}
|
[
"public",
"static",
"void",
"registerParams",
"(",
"DynamicJasperDesign",
"jd",
",",
"Map",
"_parameters",
")",
"{",
"for",
"(",
"Object",
"key",
":",
"_parameters",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"key",
"instanceof",
"String",
")",
"{",
"try",
"{",
"Object",
"value",
"=",
"_parameters",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"jd",
".",
"getParametersMap",
"(",
")",
".",
"get",
"(",
"key",
")",
"!=",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"Parameter \\\"\"",
"+",
"key",
"+",
"\"\\\" already registered, skipping this one: \"",
"+",
"value",
")",
";",
"continue",
";",
"}",
"JRDesignParameter",
"parameter",
"=",
"new",
"JRDesignParameter",
"(",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"//There are some Map implementations that allows nulls values, just go on",
"continue",
";",
"//\t\t\t\t\tparameter.setValueClassName(value.getClass().getCanonicalName());",
"Class",
"clazz",
"=",
"value",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"if",
"(",
"clazz",
"==",
"null",
")",
"clazz",
"=",
"value",
".",
"getClass",
"(",
")",
";",
"parameter",
".",
"setValueClass",
"(",
"clazz",
")",
";",
"//NOTE this is very strange",
"//when using an array as subreport-data-source, I must pass the parameter class name like this: value.getClass().getComponentType()",
"parameter",
".",
"setName",
"(",
"(",
"String",
")",
"key",
")",
";",
"jd",
".",
"addParameter",
"(",
"parameter",
")",
";",
"}",
"catch",
"(",
"JRException",
"e",
")",
"{",
"//nothing to do",
"}",
"}",
"}",
"}"
] |
For every String key, it registers the object as a parameter to make it available
in the report.
@param jd
@param _parameters
|
[
"For",
"every",
"String",
"key",
"it",
"registers",
"the",
"object",
"as",
"a",
"parameter",
"to",
"make",
"it",
"available",
"in",
"the",
"report",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L462-L492
|
159,245
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
|
DynamicJasperHelper.visitSubreports
|
@SuppressWarnings("unchecked")
protected static void visitSubreports(DynamicReport dr, Map _parameters) {
for (DJGroup group : dr.getColumnsGroups()) {
//Header Subreports
for (Subreport subreport : group.getHeaderSubreports()) {
if (subreport.getDynamicReport() != null) {
visitSubreport(dr, subreport);
visitSubreports(subreport.getDynamicReport(), _parameters);
}
}
//Footer Subreports
for (Subreport subreport : group.getFooterSubreports()) {
if (subreport.getDynamicReport() != null) {
visitSubreport(dr, subreport);
visitSubreports(subreport.getDynamicReport(), _parameters);
}
}
}
}
|
java
|
@SuppressWarnings("unchecked")
protected static void visitSubreports(DynamicReport dr, Map _parameters) {
for (DJGroup group : dr.getColumnsGroups()) {
//Header Subreports
for (Subreport subreport : group.getHeaderSubreports()) {
if (subreport.getDynamicReport() != null) {
visitSubreport(dr, subreport);
visitSubreports(subreport.getDynamicReport(), _parameters);
}
}
//Footer Subreports
for (Subreport subreport : group.getFooterSubreports()) {
if (subreport.getDynamicReport() != null) {
visitSubreport(dr, subreport);
visitSubreports(subreport.getDynamicReport(), _parameters);
}
}
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"static",
"void",
"visitSubreports",
"(",
"DynamicReport",
"dr",
",",
"Map",
"_parameters",
")",
"{",
"for",
"(",
"DJGroup",
"group",
":",
"dr",
".",
"getColumnsGroups",
"(",
")",
")",
"{",
"//Header Subreports",
"for",
"(",
"Subreport",
"subreport",
":",
"group",
".",
"getHeaderSubreports",
"(",
")",
")",
"{",
"if",
"(",
"subreport",
".",
"getDynamicReport",
"(",
")",
"!=",
"null",
")",
"{",
"visitSubreport",
"(",
"dr",
",",
"subreport",
")",
";",
"visitSubreports",
"(",
"subreport",
".",
"getDynamicReport",
"(",
")",
",",
"_parameters",
")",
";",
"}",
"}",
"//Footer Subreports",
"for",
"(",
"Subreport",
"subreport",
":",
"group",
".",
"getFooterSubreports",
"(",
")",
")",
"{",
"if",
"(",
"subreport",
".",
"getDynamicReport",
"(",
")",
"!=",
"null",
")",
"{",
"visitSubreport",
"(",
"dr",
",",
"subreport",
")",
";",
"visitSubreports",
"(",
"subreport",
".",
"getDynamicReport",
"(",
")",
",",
"_parameters",
")",
";",
"}",
"}",
"}",
"}"
] |
Performs any needed operation on subreports after they are built like ensuring proper subreport with
if "fitToParentPrintableArea" flag is set to true
@param dr
@param _parameters
@throws JRException
|
[
"Performs",
"any",
"needed",
"operation",
"on",
"subreports",
"after",
"they",
"are",
"built",
"like",
"ensuring",
"proper",
"subreport",
"with",
"if",
"fitToParentPrintableArea",
"flag",
"is",
"set",
"to",
"true"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L553-L573
|
159,246
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java
|
ExpressionUtils.getDataSourceExpression
|
public static JRDesignExpression getDataSourceExpression(DJDataSource ds) {
JRDesignExpression exp = new JRDesignExpression();
exp.setValueClass(JRDataSource.class);
String dsType = getDataSourceTypeStr(ds.getDataSourceType());
String expText = null;
if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_FIELD) {
expText = dsType + "$F{" + ds.getDataSourceExpression() + "})";
} else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_PARAMETER) {
expText = dsType + REPORT_PARAMETERS_MAP + ".get( \"" + ds.getDataSourceExpression() + "\" ) )";
} else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_TYPE_SQL_CONNECTION) {
expText = dsType + REPORT_PARAMETERS_MAP + ".get( \"" + ds.getDataSourceExpression() + "\" ) )";
} else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE) {
expText = "((" + JRDataSource.class.getName() + ") $P{REPORT_DATA_SOURCE})";
}
exp.setText(expText);
return exp;
}
|
java
|
public static JRDesignExpression getDataSourceExpression(DJDataSource ds) {
JRDesignExpression exp = new JRDesignExpression();
exp.setValueClass(JRDataSource.class);
String dsType = getDataSourceTypeStr(ds.getDataSourceType());
String expText = null;
if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_FIELD) {
expText = dsType + "$F{" + ds.getDataSourceExpression() + "})";
} else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_PARAMETER) {
expText = dsType + REPORT_PARAMETERS_MAP + ".get( \"" + ds.getDataSourceExpression() + "\" ) )";
} else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_TYPE_SQL_CONNECTION) {
expText = dsType + REPORT_PARAMETERS_MAP + ".get( \"" + ds.getDataSourceExpression() + "\" ) )";
} else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE) {
expText = "((" + JRDataSource.class.getName() + ") $P{REPORT_DATA_SOURCE})";
}
exp.setText(expText);
return exp;
}
|
[
"public",
"static",
"JRDesignExpression",
"getDataSourceExpression",
"(",
"DJDataSource",
"ds",
")",
"{",
"JRDesignExpression",
"exp",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"exp",
".",
"setValueClass",
"(",
"JRDataSource",
".",
"class",
")",
";",
"String",
"dsType",
"=",
"getDataSourceTypeStr",
"(",
"ds",
".",
"getDataSourceType",
"(",
")",
")",
";",
"String",
"expText",
"=",
"null",
";",
"if",
"(",
"ds",
".",
"getDataSourceOrigin",
"(",
")",
"==",
"DJConstants",
".",
"DATA_SOURCE_ORIGIN_FIELD",
")",
"{",
"expText",
"=",
"dsType",
"+",
"\"$F{\"",
"+",
"ds",
".",
"getDataSourceExpression",
"(",
")",
"+",
"\"})\"",
";",
"}",
"else",
"if",
"(",
"ds",
".",
"getDataSourceOrigin",
"(",
")",
"==",
"DJConstants",
".",
"DATA_SOURCE_ORIGIN_PARAMETER",
")",
"{",
"expText",
"=",
"dsType",
"+",
"REPORT_PARAMETERS_MAP",
"+",
"\".get( \\\"\"",
"+",
"ds",
".",
"getDataSourceExpression",
"(",
")",
"+",
"\"\\\" ) )\"",
";",
"}",
"else",
"if",
"(",
"ds",
".",
"getDataSourceOrigin",
"(",
")",
"==",
"DJConstants",
".",
"DATA_SOURCE_TYPE_SQL_CONNECTION",
")",
"{",
"expText",
"=",
"dsType",
"+",
"REPORT_PARAMETERS_MAP",
"+",
"\".get( \\\"\"",
"+",
"ds",
".",
"getDataSourceExpression",
"(",
")",
"+",
"\"\\\" ) )\"",
";",
"}",
"else",
"if",
"(",
"ds",
".",
"getDataSourceOrigin",
"(",
")",
"==",
"DJConstants",
".",
"DATA_SOURCE_ORIGIN_REPORT_DATASOURCE",
")",
"{",
"expText",
"=",
"\"((\"",
"+",
"JRDataSource",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\") $P{REPORT_DATA_SOURCE})\"",
";",
"}",
"exp",
".",
"setText",
"(",
"expText",
")",
";",
"return",
"exp",
";",
"}"
] |
Returns the expression string required
@param ds
@return
|
[
"Returns",
"the",
"expression",
"string",
"required"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java#L101-L120
|
159,247
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java
|
ExpressionUtils.getReportConnectionExpression
|
public static JRDesignExpression getReportConnectionExpression() {
JRDesignExpression connectionExpression = new JRDesignExpression();
connectionExpression.setText("$P{" + JRDesignParameter.REPORT_CONNECTION + "}");
connectionExpression.setValueClass(Connection.class);
return connectionExpression;
}
|
java
|
public static JRDesignExpression getReportConnectionExpression() {
JRDesignExpression connectionExpression = new JRDesignExpression();
connectionExpression.setText("$P{" + JRDesignParameter.REPORT_CONNECTION + "}");
connectionExpression.setValueClass(Connection.class);
return connectionExpression;
}
|
[
"public",
"static",
"JRDesignExpression",
"getReportConnectionExpression",
"(",
")",
"{",
"JRDesignExpression",
"connectionExpression",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"connectionExpression",
".",
"setText",
"(",
"\"$P{\"",
"+",
"JRDesignParameter",
".",
"REPORT_CONNECTION",
"+",
"\"}\"",
")",
";",
"connectionExpression",
".",
"setValueClass",
"(",
"Connection",
".",
"class",
")",
";",
"return",
"connectionExpression",
";",
"}"
] |
Returns a JRDesignExpression that points to the main report connection
@return
|
[
"Returns",
"a",
"JRDesignExpression",
"that",
"points",
"to",
"the",
"main",
"report",
"connection"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java#L139-L144
|
159,248
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java
|
ExpressionUtils.getVariablesMapExpression
|
public static String getVariablesMapExpression(Collection variables) {
StringBuilder variablesMap = new StringBuilder("new " + PropertiesMap.class.getName() + "()");
for (Object variable : variables) {
JRVariable jrvar = (JRVariable) variable;
String varname = jrvar.getName();
variablesMap.append(".with(\"").append(varname).append("\",$V{").append(varname).append("})");
}
return variablesMap.toString();
}
|
java
|
public static String getVariablesMapExpression(Collection variables) {
StringBuilder variablesMap = new StringBuilder("new " + PropertiesMap.class.getName() + "()");
for (Object variable : variables) {
JRVariable jrvar = (JRVariable) variable;
String varname = jrvar.getName();
variablesMap.append(".with(\"").append(varname).append("\",$V{").append(varname).append("})");
}
return variablesMap.toString();
}
|
[
"public",
"static",
"String",
"getVariablesMapExpression",
"(",
"Collection",
"variables",
")",
"{",
"StringBuilder",
"variablesMap",
"=",
"new",
"StringBuilder",
"(",
"\"new \"",
"+",
"PropertiesMap",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\"()\"",
")",
";",
"for",
"(",
"Object",
"variable",
":",
"variables",
")",
"{",
"JRVariable",
"jrvar",
"=",
"(",
"JRVariable",
")",
"variable",
";",
"String",
"varname",
"=",
"jrvar",
".",
"getName",
"(",
")",
";",
"variablesMap",
".",
"append",
"(",
"\".with(\\\"\"",
")",
".",
"append",
"(",
"varname",
")",
".",
"append",
"(",
"\"\\\",$V{\"",
")",
".",
"append",
"(",
"varname",
")",
".",
"append",
"(",
"\"})\"",
")",
";",
"}",
"return",
"variablesMap",
".",
"toString",
"(",
")",
";",
"}"
] |
Collection of JRVariable
@param variables
@return
|
[
"Collection",
"of",
"JRVariable"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java#L263-L271
|
159,249
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java
|
ExpressionUtils.createCustomExpressionInvocationText
|
public static String createCustomExpressionInvocationText(CustomExpression customExpression, String customExpName, boolean usePreviousFieldValues) {
String stringExpression;
if (customExpression instanceof DJSimpleExpression) {
DJSimpleExpression varexp = (DJSimpleExpression) customExpression;
String symbol;
switch (varexp.getType()) {
case DJSimpleExpression.TYPE_FIELD:
symbol = "F";
break;
case DJSimpleExpression.TYPE_VARIABLE:
symbol = "V";
break;
case DJSimpleExpression.TYPE_PARAMATER:
symbol = "P";
break;
default:
throw new DJException("Invalid DJSimpleExpression, type must be FIELD, VARIABLE or PARAMETER");
}
stringExpression = "$" + symbol + "{" + varexp.getVariableName() + "}";
} else {
String fieldsMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentFields()";
if (usePreviousFieldValues) {
fieldsMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getPreviousFields()";
}
String parametersMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentParams()";
String variablesMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentVariables()";
stringExpression = "((" + CustomExpression.class.getName() + ")$P{REPORT_PARAMETERS_MAP}.get(\"" + customExpName + "\"))."
+ CustomExpression.EVAL_METHOD_NAME + "( " + fieldsMap + ", " + variablesMap + ", " + parametersMap + " )";
}
return stringExpression;
}
|
java
|
public static String createCustomExpressionInvocationText(CustomExpression customExpression, String customExpName, boolean usePreviousFieldValues) {
String stringExpression;
if (customExpression instanceof DJSimpleExpression) {
DJSimpleExpression varexp = (DJSimpleExpression) customExpression;
String symbol;
switch (varexp.getType()) {
case DJSimpleExpression.TYPE_FIELD:
symbol = "F";
break;
case DJSimpleExpression.TYPE_VARIABLE:
symbol = "V";
break;
case DJSimpleExpression.TYPE_PARAMATER:
symbol = "P";
break;
default:
throw new DJException("Invalid DJSimpleExpression, type must be FIELD, VARIABLE or PARAMETER");
}
stringExpression = "$" + symbol + "{" + varexp.getVariableName() + "}";
} else {
String fieldsMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentFields()";
if (usePreviousFieldValues) {
fieldsMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getPreviousFields()";
}
String parametersMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentParams()";
String variablesMap = "((" + DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentVariables()";
stringExpression = "((" + CustomExpression.class.getName() + ")$P{REPORT_PARAMETERS_MAP}.get(\"" + customExpName + "\"))."
+ CustomExpression.EVAL_METHOD_NAME + "( " + fieldsMap + ", " + variablesMap + ", " + parametersMap + " )";
}
return stringExpression;
}
|
[
"public",
"static",
"String",
"createCustomExpressionInvocationText",
"(",
"CustomExpression",
"customExpression",
",",
"String",
"customExpName",
",",
"boolean",
"usePreviousFieldValues",
")",
"{",
"String",
"stringExpression",
";",
"if",
"(",
"customExpression",
"instanceof",
"DJSimpleExpression",
")",
"{",
"DJSimpleExpression",
"varexp",
"=",
"(",
"DJSimpleExpression",
")",
"customExpression",
";",
"String",
"symbol",
";",
"switch",
"(",
"varexp",
".",
"getType",
"(",
")",
")",
"{",
"case",
"DJSimpleExpression",
".",
"TYPE_FIELD",
":",
"symbol",
"=",
"\"F\"",
";",
"break",
";",
"case",
"DJSimpleExpression",
".",
"TYPE_VARIABLE",
":",
"symbol",
"=",
"\"V\"",
";",
"break",
";",
"case",
"DJSimpleExpression",
".",
"TYPE_PARAMATER",
":",
"symbol",
"=",
"\"P\"",
";",
"break",
";",
"default",
":",
"throw",
"new",
"DJException",
"(",
"\"Invalid DJSimpleExpression, type must be FIELD, VARIABLE or PARAMETER\"",
")",
";",
"}",
"stringExpression",
"=",
"\"$\"",
"+",
"symbol",
"+",
"\"{\"",
"+",
"varexp",
".",
"getVariableName",
"(",
")",
"+",
"\"}\"",
";",
"}",
"else",
"{",
"String",
"fieldsMap",
"=",
"\"((\"",
"+",
"DJDefaultScriptlet",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{REPORT_SCRIPTLET}).getCurrentFields()\"",
";",
"if",
"(",
"usePreviousFieldValues",
")",
"{",
"fieldsMap",
"=",
"\"((\"",
"+",
"DJDefaultScriptlet",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{REPORT_SCRIPTLET}).getPreviousFields()\"",
";",
"}",
"String",
"parametersMap",
"=",
"\"((\"",
"+",
"DJDefaultScriptlet",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{REPORT_SCRIPTLET}).getCurrentParams()\"",
";",
"String",
"variablesMap",
"=",
"\"((\"",
"+",
"DJDefaultScriptlet",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{REPORT_SCRIPTLET}).getCurrentVariables()\"",
";",
"stringExpression",
"=",
"\"((\"",
"+",
"CustomExpression",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\")$P{REPORT_PARAMETERS_MAP}.get(\\\"\"",
"+",
"customExpName",
"+",
"\"\\\")).\"",
"+",
"CustomExpression",
".",
"EVAL_METHOD_NAME",
"+",
"\"( \"",
"+",
"fieldsMap",
"+",
"\", \"",
"+",
"variablesMap",
"+",
"\", \"",
"+",
"parametersMap",
"+",
"\" )\"",
";",
"}",
"return",
"stringExpression",
";",
"}"
] |
If you register a CustomExpression with the name "customExpName", then this will create the text needed
to invoke it in a JRDesignExpression
@param customExpName
@param usePreviousFieldValues
@return
|
[
"If",
"you",
"register",
"a",
"CustomExpression",
"with",
"the",
"name",
"customExpName",
"then",
"this",
"will",
"create",
"the",
"text",
"needed",
"to",
"invoke",
"it",
"in",
"a",
"JRDesignExpression"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/ExpressionUtils.java#L293-L327
|
159,250
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java
|
ReflectiveReportBuilder.addProperties
|
private void addProperties(final PropertyDescriptor[] _properties) throws ColumnBuilderException, ClassNotFoundException {
for (final PropertyDescriptor property : _properties) {
if (isValidProperty(property)) {
addColumn(getColumnTitle(property), property.getName(), property.getPropertyType().getName(), getColumnWidth(property));
}
}
setUseFullPageWidth(true);
}
|
java
|
private void addProperties(final PropertyDescriptor[] _properties) throws ColumnBuilderException, ClassNotFoundException {
for (final PropertyDescriptor property : _properties) {
if (isValidProperty(property)) {
addColumn(getColumnTitle(property), property.getName(), property.getPropertyType().getName(), getColumnWidth(property));
}
}
setUseFullPageWidth(true);
}
|
[
"private",
"void",
"addProperties",
"(",
"final",
"PropertyDescriptor",
"[",
"]",
"_properties",
")",
"throws",
"ColumnBuilderException",
",",
"ClassNotFoundException",
"{",
"for",
"(",
"final",
"PropertyDescriptor",
"property",
":",
"_properties",
")",
"{",
"if",
"(",
"isValidProperty",
"(",
"property",
")",
")",
"{",
"addColumn",
"(",
"getColumnTitle",
"(",
"property",
")",
",",
"property",
".",
"getName",
"(",
")",
",",
"property",
".",
"getPropertyType",
"(",
")",
".",
"getName",
"(",
")",
",",
"getColumnWidth",
"(",
"property",
")",
")",
";",
"}",
"}",
"setUseFullPageWidth",
"(",
"true",
")",
";",
"}"
] |
Adds columns for the specified properties.
@param _properties the array of <code>PropertyDescriptor</code>s to be added.
@throws ColumnBuilderException if an error occurs.
@throws ClassNotFoundException if an error occurs.
|
[
"Adds",
"columns",
"for",
"the",
"specified",
"properties",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java#L103-L110
|
159,251
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java
|
ReflectiveReportBuilder.getColumnTitle
|
private static String getColumnTitle(final PropertyDescriptor _property) {
final StringBuilder buffer = new StringBuilder();
final String name = _property.getName();
buffer.append(Character.toUpperCase(name.charAt(0)));
for (int i = 1; i < name.length(); i++) {
final char c = name.charAt(i);
if (Character.isUpperCase(c)) {
buffer.append(' ');
}
buffer.append(c);
}
return buffer.toString();
}
|
java
|
private static String getColumnTitle(final PropertyDescriptor _property) {
final StringBuilder buffer = new StringBuilder();
final String name = _property.getName();
buffer.append(Character.toUpperCase(name.charAt(0)));
for (int i = 1; i < name.length(); i++) {
final char c = name.charAt(i);
if (Character.isUpperCase(c)) {
buffer.append(' ');
}
buffer.append(c);
}
return buffer.toString();
}
|
[
"private",
"static",
"String",
"getColumnTitle",
"(",
"final",
"PropertyDescriptor",
"_property",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"String",
"name",
"=",
"_property",
".",
"getName",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"Character",
".",
"toUpperCase",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"name",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"char",
"c",
"=",
"name",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"c",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"c",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] |
Calculates a column title using camel humps to separate words.
@param _property the property descriptor.
@return the column title for the given property.
|
[
"Calculates",
"a",
"column",
"title",
"using",
"camel",
"humps",
"to",
"separate",
"words",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java#L117-L129
|
159,252
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java
|
ReflectiveReportBuilder.isValidPropertyClass
|
private static boolean isValidPropertyClass(final PropertyDescriptor _property) {
final Class type = _property.getPropertyType();
return Number.class.isAssignableFrom(type) || type == String.class || Date.class.isAssignableFrom(type) || type == Boolean.class;
}
|
java
|
private static boolean isValidPropertyClass(final PropertyDescriptor _property) {
final Class type = _property.getPropertyType();
return Number.class.isAssignableFrom(type) || type == String.class || Date.class.isAssignableFrom(type) || type == Boolean.class;
}
|
[
"private",
"static",
"boolean",
"isValidPropertyClass",
"(",
"final",
"PropertyDescriptor",
"_property",
")",
"{",
"final",
"Class",
"type",
"=",
"_property",
".",
"getPropertyType",
"(",
")",
";",
"return",
"Number",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
"||",
"type",
"==",
"String",
".",
"class",
"||",
"Date",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
"||",
"type",
"==",
"Boolean",
".",
"class",
";",
"}"
] |
Checks if a property's type is valid to be included in the report.
@param _property the property.
@return true if the property is is of a valid type.
|
[
"Checks",
"if",
"a",
"property",
"s",
"type",
"is",
"valid",
"to",
"be",
"included",
"in",
"the",
"report",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java#L145-L148
|
159,253
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java
|
ReflectiveReportBuilder.getColumnWidth
|
private static int getColumnWidth(final PropertyDescriptor _property) {
final Class type = _property.getPropertyType();
if (Float.class.isAssignableFrom(type) || Double.class.isAssignableFrom(type)) {
return 70;
} else if (type == Boolean.class) {
return 10;
} else if (Number.class.isAssignableFrom(type)) {
return 60;
} else if (type == String.class) {
return 100;
} else if (Date.class.isAssignableFrom(type)) {
return 50;
} else {
return 50;
}
}
|
java
|
private static int getColumnWidth(final PropertyDescriptor _property) {
final Class type = _property.getPropertyType();
if (Float.class.isAssignableFrom(type) || Double.class.isAssignableFrom(type)) {
return 70;
} else if (type == Boolean.class) {
return 10;
} else if (Number.class.isAssignableFrom(type)) {
return 60;
} else if (type == String.class) {
return 100;
} else if (Date.class.isAssignableFrom(type)) {
return 50;
} else {
return 50;
}
}
|
[
"private",
"static",
"int",
"getColumnWidth",
"(",
"final",
"PropertyDescriptor",
"_property",
")",
"{",
"final",
"Class",
"type",
"=",
"_property",
".",
"getPropertyType",
"(",
")",
";",
"if",
"(",
"Float",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
"||",
"Double",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"return",
"70",
";",
"}",
"else",
"if",
"(",
"type",
"==",
"Boolean",
".",
"class",
")",
"{",
"return",
"10",
";",
"}",
"else",
"if",
"(",
"Number",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"return",
"60",
";",
"}",
"else",
"if",
"(",
"type",
"==",
"String",
".",
"class",
")",
"{",
"return",
"100",
";",
"}",
"else",
"if",
"(",
"Date",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"return",
"50",
";",
"}",
"else",
"{",
"return",
"50",
";",
"}",
"}"
] |
Calculates the column width according to its type.
@param _property the property.
@return the column width.
|
[
"Calculates",
"the",
"column",
"width",
"according",
"to",
"its",
"type",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ReflectiveReportBuilder.java#L155-L170
|
159,254
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/chart/dataset/XYDataset.java
|
XYDataset.addSerie
|
public void addSerie(AbstractColumn column, StringExpression labelExpression) {
series.add(column);
seriesLabels.put(column, labelExpression);
}
|
java
|
public void addSerie(AbstractColumn column, StringExpression labelExpression) {
series.add(column);
seriesLabels.put(column, labelExpression);
}
|
[
"public",
"void",
"addSerie",
"(",
"AbstractColumn",
"column",
",",
"StringExpression",
"labelExpression",
")",
"{",
"series",
".",
"add",
"(",
"column",
")",
";",
"seriesLabels",
".",
"put",
"(",
"column",
",",
"labelExpression",
")",
";",
"}"
] |
Adds the specified serie column to the dataset with custom label expression.
@param column the serie column
@param labelExpression column the custom label expression
|
[
"Adds",
"the",
"specified",
"serie",
"column",
"to",
"the",
"dataset",
"with",
"custom",
"label",
"expression",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/dataset/XYDataset.java#L99-L102
|
159,255
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.build
|
public DynamicReport build() {
if (built) {
throw new DJBuilderException("DynamicReport already built. Cannot use more than once.");
} else {
built = true;
}
report.setOptions(options);
if (!globalVariablesGroup.getFooterVariables().isEmpty() || !globalVariablesGroup.getHeaderVariables().isEmpty() || !globalVariablesGroup.getVariables().isEmpty() || hasPercentageColumn()) {
report.getColumnsGroups().add(0, globalVariablesGroup);
}
createChartGroups();
addGlobalCrosstabs();
addSubreportsToGroups();
concatenateReports();
report.setAutoTexts(autoTexts);
return report;
}
|
java
|
public DynamicReport build() {
if (built) {
throw new DJBuilderException("DynamicReport already built. Cannot use more than once.");
} else {
built = true;
}
report.setOptions(options);
if (!globalVariablesGroup.getFooterVariables().isEmpty() || !globalVariablesGroup.getHeaderVariables().isEmpty() || !globalVariablesGroup.getVariables().isEmpty() || hasPercentageColumn()) {
report.getColumnsGroups().add(0, globalVariablesGroup);
}
createChartGroups();
addGlobalCrosstabs();
addSubreportsToGroups();
concatenateReports();
report.setAutoTexts(autoTexts);
return report;
}
|
[
"public",
"DynamicReport",
"build",
"(",
")",
"{",
"if",
"(",
"built",
")",
"{",
"throw",
"new",
"DJBuilderException",
"(",
"\"DynamicReport already built. Cannot use more than once.\"",
")",
";",
"}",
"else",
"{",
"built",
"=",
"true",
";",
"}",
"report",
".",
"setOptions",
"(",
"options",
")",
";",
"if",
"(",
"!",
"globalVariablesGroup",
".",
"getFooterVariables",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"!",
"globalVariablesGroup",
".",
"getHeaderVariables",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"!",
"globalVariablesGroup",
".",
"getVariables",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"hasPercentageColumn",
"(",
")",
")",
"{",
"report",
".",
"getColumnsGroups",
"(",
")",
".",
"add",
"(",
"0",
",",
"globalVariablesGroup",
")",
";",
"}",
"createChartGroups",
"(",
")",
";",
"addGlobalCrosstabs",
"(",
")",
";",
"addSubreportsToGroups",
"(",
")",
";",
"concatenateReports",
"(",
")",
";",
"report",
".",
"setAutoTexts",
"(",
"autoTexts",
")",
";",
"return",
"report",
";",
"}"
] |
Builds the DynamicReport object. Cannot be used twice since this produced
undesired results on the generated DynamicReport object
@return
|
[
"Builds",
"the",
"DynamicReport",
"object",
".",
"Cannot",
"be",
"used",
"twice",
"since",
"this",
"produced",
"undesired",
"results",
"on",
"the",
"generated",
"DynamicReport",
"object"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L312-L335
|
159,256
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.concatenateReports
|
protected void concatenateReports() {
if (!concatenatedReports.isEmpty()) { // dummy group for page break if needed
DJGroup globalGroup = createDummyGroup();
report.getColumnsGroups().add(0, globalGroup);
}
for (Subreport subreport : concatenatedReports) {
DJGroup globalGroup = createDummyGroup();
globalGroup.getFooterSubreports().add(subreport);
report.getColumnsGroups().add(0, globalGroup);
}
}
|
java
|
protected void concatenateReports() {
if (!concatenatedReports.isEmpty()) { // dummy group for page break if needed
DJGroup globalGroup = createDummyGroup();
report.getColumnsGroups().add(0, globalGroup);
}
for (Subreport subreport : concatenatedReports) {
DJGroup globalGroup = createDummyGroup();
globalGroup.getFooterSubreports().add(subreport);
report.getColumnsGroups().add(0, globalGroup);
}
}
|
[
"protected",
"void",
"concatenateReports",
"(",
")",
"{",
"if",
"(",
"!",
"concatenatedReports",
".",
"isEmpty",
"(",
")",
")",
"{",
"// dummy group for page break if needed",
"DJGroup",
"globalGroup",
"=",
"createDummyGroup",
"(",
")",
";",
"report",
".",
"getColumnsGroups",
"(",
")",
".",
"add",
"(",
"0",
",",
"globalGroup",
")",
";",
"}",
"for",
"(",
"Subreport",
"subreport",
":",
"concatenatedReports",
")",
"{",
"DJGroup",
"globalGroup",
"=",
"createDummyGroup",
"(",
")",
";",
"globalGroup",
".",
"getFooterSubreports",
"(",
")",
".",
"add",
"(",
"subreport",
")",
";",
"report",
".",
"getColumnsGroups",
"(",
")",
".",
"add",
"(",
"0",
",",
"globalGroup",
")",
";",
"}",
"}"
] |
Create dummy groups for each concatenated report, and in the footer of
each group adds the subreport.
|
[
"Create",
"dummy",
"groups",
"for",
"each",
"concatenated",
"report",
"and",
"in",
"the",
"footer",
"of",
"each",
"group",
"adds",
"the",
"subreport",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L387-L399
|
159,257
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.setTemplateFile
|
public DynamicReportBuilder setTemplateFile(String path, boolean importFields, boolean importVariables, boolean importParameters, boolean importDatasets) {
report.setTemplateFileName(path);
report.setTemplateImportFields(importFields);
report.setTemplateImportParameters(importParameters);
report.setTemplateImportVariables(importVariables);
report.setTemplateImportDatasets(importDatasets);
return this;
}
|
java
|
public DynamicReportBuilder setTemplateFile(String path, boolean importFields, boolean importVariables, boolean importParameters, boolean importDatasets) {
report.setTemplateFileName(path);
report.setTemplateImportFields(importFields);
report.setTemplateImportParameters(importParameters);
report.setTemplateImportVariables(importVariables);
report.setTemplateImportDatasets(importDatasets);
return this;
}
|
[
"public",
"DynamicReportBuilder",
"setTemplateFile",
"(",
"String",
"path",
",",
"boolean",
"importFields",
",",
"boolean",
"importVariables",
",",
"boolean",
"importParameters",
",",
"boolean",
"importDatasets",
")",
"{",
"report",
".",
"setTemplateFileName",
"(",
"path",
")",
";",
"report",
".",
"setTemplateImportFields",
"(",
"importFields",
")",
";",
"report",
".",
"setTemplateImportParameters",
"(",
"importParameters",
")",
";",
"report",
".",
"setTemplateImportVariables",
"(",
"importVariables",
")",
";",
"report",
".",
"setTemplateImportDatasets",
"(",
"importDatasets",
")",
";",
"return",
"this",
";",
"}"
] |
The full path of a jrxml file, or the path in the classpath of a jrxml
resource.
@param path
@return
|
[
"The",
"full",
"path",
"of",
"a",
"jrxml",
"file",
"or",
"the",
"path",
"in",
"the",
"classpath",
"of",
"a",
"jrxml",
"resource",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1003-L1010
|
159,258
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.addStyle
|
public DynamicReportBuilder addStyle(Style style) throws DJBuilderException {
if (style.getName() == null) {
throw new DJBuilderException("Invalid style. The style must have a name");
}
report.addStyle(style);
return this;
}
|
java
|
public DynamicReportBuilder addStyle(Style style) throws DJBuilderException {
if (style.getName() == null) {
throw new DJBuilderException("Invalid style. The style must have a name");
}
report.addStyle(style);
return this;
}
|
[
"public",
"DynamicReportBuilder",
"addStyle",
"(",
"Style",
"style",
")",
"throws",
"DJBuilderException",
"{",
"if",
"(",
"style",
".",
"getName",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"DJBuilderException",
"(",
"\"Invalid style. The style must have a name\"",
")",
";",
"}",
"report",
".",
"addStyle",
"(",
"style",
")",
";",
"return",
"this",
";",
"}"
] |
You can register styles object for later reference them directly. Parent
styles should be registered this way
@param style
@return
@throws DJBuilderException
|
[
"You",
"can",
"register",
"styles",
"object",
"for",
"later",
"reference",
"them",
"directly",
".",
"Parent",
"styles",
"should",
"be",
"registered",
"this",
"way"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1366-L1374
|
159,259
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.setQuery
|
public DynamicReportBuilder setQuery(String text, String language) {
this.report.setQuery(new DJQuery(text, language));
return this;
}
|
java
|
public DynamicReportBuilder setQuery(String text, String language) {
this.report.setQuery(new DJQuery(text, language));
return this;
}
|
[
"public",
"DynamicReportBuilder",
"setQuery",
"(",
"String",
"text",
",",
"String",
"language",
")",
"{",
"this",
".",
"report",
".",
"setQuery",
"(",
"new",
"DJQuery",
"(",
"text",
",",
"language",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Adds main report query.
@param text
@param language use constants from {@link DJConstants}
@return
|
[
"Adds",
"main",
"report",
"query",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1424-L1427
|
159,260
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.setProperty
|
public DynamicReportBuilder setProperty(String name, String value) {
this.report.setProperty(name, value);
return this;
}
|
java
|
public DynamicReportBuilder setProperty(String name, String value) {
this.report.setProperty(name, value);
return this;
}
|
[
"public",
"DynamicReportBuilder",
"setProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"report",
".",
"setProperty",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a property to report design, this properties are mostly used by
exporters to know if any specific configuration is needed
@param name
@param value
@return A Dynamic Report Builder
|
[
"Adds",
"a",
"property",
"to",
"report",
"design",
"this",
"properties",
"are",
"mostly",
"used",
"by",
"exporters",
"to",
"know",
"if",
"any",
"specific",
"configuration",
"is",
"needed"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1581-L1584
|
159,261
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
|
DynamicReportBuilder.setColspan
|
public DynamicReportBuilder setColspan(int colNumber, int colQuantity, String colspanTitle) {
this.setColspan(colNumber, colQuantity, colspanTitle, null);
return this;
}
|
java
|
public DynamicReportBuilder setColspan(int colNumber, int colQuantity, String colspanTitle) {
this.setColspan(colNumber, colQuantity, colspanTitle, null);
return this;
}
|
[
"public",
"DynamicReportBuilder",
"setColspan",
"(",
"int",
"colNumber",
",",
"int",
"colQuantity",
",",
"String",
"colspanTitle",
")",
"{",
"this",
".",
"setColspan",
"(",
"colNumber",
",",
"colQuantity",
",",
"colspanTitle",
",",
"null",
")",
";",
"return",
"this",
";",
"}"
] |
Set a colspan in a group of columns. First add the cols to the report
@param colNumber the index of the col
@param colQuantity the number of cols how i will take
@param colspanTitle colspan title
@return a Dynamic Report Builder
@throws ColumnBuilderException When the index of the cols is out of
bounds.
|
[
"Set",
"a",
"colspan",
"in",
"a",
"group",
"of",
"columns",
".",
"First",
"add",
"the",
"cols",
"to",
"the",
"report"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1645-L1650
|
159,262
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java
|
CrossTabColorShema.setTotalColorForColumn
|
public void setTotalColorForColumn(int column, Color color){
int map = (colors.length-1) - column;
colors[map][colors[0].length-1]=color;
}
|
java
|
public void setTotalColorForColumn(int column, Color color){
int map = (colors.length-1) - column;
colors[map][colors[0].length-1]=color;
}
|
[
"public",
"void",
"setTotalColorForColumn",
"(",
"int",
"column",
",",
"Color",
"color",
")",
"{",
"int",
"map",
"=",
"(",
"colors",
".",
"length",
"-",
"1",
")",
"-",
"column",
";",
"colors",
"[",
"map",
"]",
"[",
"colors",
"[",
"0",
"]",
".",
"length",
"-",
"1",
"]",
"=",
"color",
";",
"}"
] |
Set the color for each total for the column
@param column the number of the column (starting from 1)
@param color
|
[
"Set",
"the",
"color",
"for",
"each",
"total",
"for",
"the",
"column"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java#L82-L85
|
159,263
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java
|
CrossTabColorShema.setColorForTotal
|
public void setColorForTotal(int row, int column, Color color){
int mapC = (colors.length-1) - column;
int mapR = (colors[0].length-1) - row;
colors[mapC][mapR]=color;
}
|
java
|
public void setColorForTotal(int row, int column, Color color){
int mapC = (colors.length-1) - column;
int mapR = (colors[0].length-1) - row;
colors[mapC][mapR]=color;
}
|
[
"public",
"void",
"setColorForTotal",
"(",
"int",
"row",
",",
"int",
"column",
",",
"Color",
"color",
")",
"{",
"int",
"mapC",
"=",
"(",
"colors",
".",
"length",
"-",
"1",
")",
"-",
"column",
";",
"int",
"mapR",
"=",
"(",
"colors",
"[",
"0",
"]",
".",
"length",
"-",
"1",
")",
"-",
"row",
";",
"colors",
"[",
"mapC",
"]",
"[",
"mapR",
"]",
"=",
"color",
";",
"}"
] |
Sets the color for the big total between the column and row
@param row row index (starting from 1)
@param column column index (starting from 1)
@param color
|
[
"Sets",
"the",
"color",
"for",
"the",
"big",
"total",
"between",
"the",
"column",
"and",
"row"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java#L103-L107
|
159,264
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/StreamUtils.java
|
StreamUtils.copyThenClose
|
public static void copyThenClose(InputStream input, OutputStream output)
throws IOException {
copy(input, output);
input.close();
output.close();
}
|
java
|
public static void copyThenClose(InputStream input, OutputStream output)
throws IOException {
copy(input, output);
input.close();
output.close();
}
|
[
"public",
"static",
"void",
"copyThenClose",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"input",
",",
"output",
")",
";",
"input",
".",
"close",
"(",
")",
";",
"output",
".",
"close",
"(",
")",
";",
"}"
] |
Copies information between specified streams and then closes
both of the streams.
@throws java.io.IOException
|
[
"Copies",
"information",
"between",
"specified",
"streams",
"and",
"then",
"closes",
"both",
"of",
"the",
"streams",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/StreamUtils.java#L61-L66
|
159,265
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/SubReportBuilder.java
|
SubReportBuilder.setParameterMapPath
|
public SubReportBuilder setParameterMapPath(String path) {
subreport.setParametersExpression(path);
subreport.setParametersMapOrigin(DJConstants.SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER);
return this;
}
|
java
|
public SubReportBuilder setParameterMapPath(String path) {
subreport.setParametersExpression(path);
subreport.setParametersMapOrigin(DJConstants.SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER);
return this;
}
|
[
"public",
"SubReportBuilder",
"setParameterMapPath",
"(",
"String",
"path",
")",
"{",
"subreport",
".",
"setParametersExpression",
"(",
"path",
")",
";",
"subreport",
".",
"setParametersMapOrigin",
"(",
"DJConstants",
".",
"SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER",
")",
";",
"return",
"this",
";",
"}"
] |
defines the KEY in the parent report parameters map where to get the subreport parameters map.
@param path where to get the parameter map for the subrerpot.
@return
|
[
"defines",
"the",
"KEY",
"in",
"the",
"parent",
"report",
"parameters",
"map",
"where",
"to",
"get",
"the",
"subreport",
"parameters",
"map",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/SubReportBuilder.java#L194-L198
|
159,266
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/DynamicReport.java
|
DynamicReport.getAllFields
|
public List<ColumnProperty> getAllFields(){
ArrayList<ColumnProperty> l = new ArrayList<ColumnProperty>();
for (AbstractColumn abstractColumn : this.getColumns()) {
if (abstractColumn instanceof SimpleColumn && !(abstractColumn instanceof ExpressionColumn)) {
l.add(((SimpleColumn)abstractColumn).getColumnProperty());
}
}
l.addAll(this.getFields());
return l;
}
|
java
|
public List<ColumnProperty> getAllFields(){
ArrayList<ColumnProperty> l = new ArrayList<ColumnProperty>();
for (AbstractColumn abstractColumn : this.getColumns()) {
if (abstractColumn instanceof SimpleColumn && !(abstractColumn instanceof ExpressionColumn)) {
l.add(((SimpleColumn)abstractColumn).getColumnProperty());
}
}
l.addAll(this.getFields());
return l;
}
|
[
"public",
"List",
"<",
"ColumnProperty",
">",
"getAllFields",
"(",
")",
"{",
"ArrayList",
"<",
"ColumnProperty",
">",
"l",
"=",
"new",
"ArrayList",
"<",
"ColumnProperty",
">",
"(",
")",
";",
"for",
"(",
"AbstractColumn",
"abstractColumn",
":",
"this",
".",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"abstractColumn",
"instanceof",
"SimpleColumn",
"&&",
"!",
"(",
"abstractColumn",
"instanceof",
"ExpressionColumn",
")",
")",
"{",
"l",
".",
"add",
"(",
"(",
"(",
"SimpleColumn",
")",
"abstractColumn",
")",
".",
"getColumnProperty",
"(",
")",
")",
";",
"}",
"}",
"l",
".",
"addAll",
"(",
"this",
".",
"getFields",
"(",
")",
")",
";",
"return",
"l",
";",
"}"
] |
Collects all the fields from columns and also the fields not bounds to columns
@return List<ColumnProperty>
|
[
"Collects",
"all",
"the",
"fields",
"from",
"columns",
"and",
"also",
"the",
"fields",
"not",
"bounds",
"to",
"columns"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/DynamicReport.java#L433-L444
|
159,267
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/registration/ColumnsGroupVariablesRegistrationManager.java
|
ColumnsGroupVariablesRegistrationManager.registerValueFormatter
|
protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) {
if ( djVariable.getValueFormatter() == null){
return;
}
JRDesignParameter dparam = new JRDesignParameter();
dparam.setName(variableName + "_vf"); //value formater suffix
dparam.setValueClassName(DJValueFormatter.class.getName());
log.debug("Registering value formatter parameter for property " + dparam.getName() );
try {
getDjd().addParameter(dparam);
} catch (JRException e) {
throw new EntitiesRegistrationException(e.getMessage(),e);
}
getDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter());
}
|
java
|
protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) {
if ( djVariable.getValueFormatter() == null){
return;
}
JRDesignParameter dparam = new JRDesignParameter();
dparam.setName(variableName + "_vf"); //value formater suffix
dparam.setValueClassName(DJValueFormatter.class.getName());
log.debug("Registering value formatter parameter for property " + dparam.getName() );
try {
getDjd().addParameter(dparam);
} catch (JRException e) {
throw new EntitiesRegistrationException(e.getMessage(),e);
}
getDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter());
}
|
[
"protected",
"void",
"registerValueFormatter",
"(",
"DJGroupVariable",
"djVariable",
",",
"String",
"variableName",
")",
"{",
"if",
"(",
"djVariable",
".",
"getValueFormatter",
"(",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"JRDesignParameter",
"dparam",
"=",
"new",
"JRDesignParameter",
"(",
")",
";",
"dparam",
".",
"setName",
"(",
"variableName",
"+",
"\"_vf\"",
")",
";",
"//value formater suffix",
"dparam",
".",
"setValueClassName",
"(",
"DJValueFormatter",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"log",
".",
"debug",
"(",
"\"Registering value formatter parameter for property \"",
"+",
"dparam",
".",
"getName",
"(",
")",
")",
";",
"try",
"{",
"getDjd",
"(",
")",
".",
"addParameter",
"(",
"dparam",
")",
";",
"}",
"catch",
"(",
"JRException",
"e",
")",
"{",
"throw",
"new",
"EntitiesRegistrationException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"getDjd",
"(",
")",
".",
"getParametersWithValues",
"(",
")",
".",
"put",
"(",
"dparam",
".",
"getName",
"(",
")",
",",
"djVariable",
".",
"getValueFormatter",
"(",
")",
")",
";",
"}"
] |
Registers the parameter for the value formatter for the given variable and puts
it's implementation in the parameters map.
@param djVariable
@param variableName
|
[
"Registers",
"the",
"parameter",
"for",
"the",
"value",
"formatter",
"for",
"the",
"given",
"variable",
"and",
"puts",
"it",
"s",
"implementation",
"in",
"the",
"parameters",
"map",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/registration/ColumnsGroupVariablesRegistrationManager.java#L114-L130
|
159,268
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java
|
AbstractLayoutManager.setWhenNoDataBand
|
protected void setWhenNoDataBand() {
log.debug("setting up WHEN NO DATA band");
String whenNoDataText = getReport().getWhenNoDataText();
Style style = getReport().getWhenNoDataStyle();
if (whenNoDataText == null || "".equals(whenNoDataText))
return;
JRDesignBand band = new JRDesignBand();
getDesign().setNoData(band);
JRDesignTextField text = new JRDesignTextField();
JRDesignExpression expression = ExpressionUtils.createStringExpression("\"" + whenNoDataText + "\"");
text.setExpression(expression);
if (style == null) {
style = getReport().getOptions().getDefaultDetailStyle();
}
if (getReport().isWhenNoDataShowTitle()) {
LayoutUtils.copyBandElements(band, getDesign().getTitle());
LayoutUtils.copyBandElements(band, getDesign().getPageHeader());
}
if (getReport().isWhenNoDataShowColumnHeader())
LayoutUtils.copyBandElements(band, getDesign().getColumnHeader());
int offset = LayoutUtils.findVerticalOffset(band);
text.setY(offset);
applyStyleToElement(style, text);
text.setWidth(getReport().getOptions().getPrintableWidth());
text.setHeight(50);
band.addElement(text);
log.debug("OK setting up WHEN NO DATA band");
}
|
java
|
protected void setWhenNoDataBand() {
log.debug("setting up WHEN NO DATA band");
String whenNoDataText = getReport().getWhenNoDataText();
Style style = getReport().getWhenNoDataStyle();
if (whenNoDataText == null || "".equals(whenNoDataText))
return;
JRDesignBand band = new JRDesignBand();
getDesign().setNoData(band);
JRDesignTextField text = new JRDesignTextField();
JRDesignExpression expression = ExpressionUtils.createStringExpression("\"" + whenNoDataText + "\"");
text.setExpression(expression);
if (style == null) {
style = getReport().getOptions().getDefaultDetailStyle();
}
if (getReport().isWhenNoDataShowTitle()) {
LayoutUtils.copyBandElements(band, getDesign().getTitle());
LayoutUtils.copyBandElements(band, getDesign().getPageHeader());
}
if (getReport().isWhenNoDataShowColumnHeader())
LayoutUtils.copyBandElements(band, getDesign().getColumnHeader());
int offset = LayoutUtils.findVerticalOffset(band);
text.setY(offset);
applyStyleToElement(style, text);
text.setWidth(getReport().getOptions().getPrintableWidth());
text.setHeight(50);
band.addElement(text);
log.debug("OK setting up WHEN NO DATA band");
}
|
[
"protected",
"void",
"setWhenNoDataBand",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"setting up WHEN NO DATA band\"",
")",
";",
"String",
"whenNoDataText",
"=",
"getReport",
"(",
")",
".",
"getWhenNoDataText",
"(",
")",
";",
"Style",
"style",
"=",
"getReport",
"(",
")",
".",
"getWhenNoDataStyle",
"(",
")",
";",
"if",
"(",
"whenNoDataText",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"whenNoDataText",
")",
")",
"return",
";",
"JRDesignBand",
"band",
"=",
"new",
"JRDesignBand",
"(",
")",
";",
"getDesign",
"(",
")",
".",
"setNoData",
"(",
"band",
")",
";",
"JRDesignTextField",
"text",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"JRDesignExpression",
"expression",
"=",
"ExpressionUtils",
".",
"createStringExpression",
"(",
"\"\\\"\"",
"+",
"whenNoDataText",
"+",
"\"\\\"\"",
")",
";",
"text",
".",
"setExpression",
"(",
"expression",
")",
";",
"if",
"(",
"style",
"==",
"null",
")",
"{",
"style",
"=",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getDefaultDetailStyle",
"(",
")",
";",
"}",
"if",
"(",
"getReport",
"(",
")",
".",
"isWhenNoDataShowTitle",
"(",
")",
")",
"{",
"LayoutUtils",
".",
"copyBandElements",
"(",
"band",
",",
"getDesign",
"(",
")",
".",
"getTitle",
"(",
")",
")",
";",
"LayoutUtils",
".",
"copyBandElements",
"(",
"band",
",",
"getDesign",
"(",
")",
".",
"getPageHeader",
"(",
")",
")",
";",
"}",
"if",
"(",
"getReport",
"(",
")",
".",
"isWhenNoDataShowColumnHeader",
"(",
")",
")",
"LayoutUtils",
".",
"copyBandElements",
"(",
"band",
",",
"getDesign",
"(",
")",
".",
"getColumnHeader",
"(",
")",
")",
";",
"int",
"offset",
"=",
"LayoutUtils",
".",
"findVerticalOffset",
"(",
"band",
")",
";",
"text",
".",
"setY",
"(",
"offset",
")",
";",
"applyStyleToElement",
"(",
"style",
",",
"text",
")",
";",
"text",
".",
"setWidth",
"(",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getPrintableWidth",
"(",
")",
")",
";",
"text",
".",
"setHeight",
"(",
"50",
")",
";",
"band",
".",
"addElement",
"(",
"text",
")",
";",
"log",
".",
"debug",
"(",
"\"OK setting up WHEN NO DATA band\"",
")",
";",
"}"
] |
Creates the graphic element to be shown when the datasource is empty
|
[
"Creates",
"the",
"graphic",
"element",
"to",
"be",
"shown",
"when",
"the",
"datasource",
"is",
"empty"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L220-L252
|
159,269
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java
|
AbstractLayoutManager.ensureDJStyles
|
protected void ensureDJStyles() {
//first of all, register all parent styles if any
for (Style style : getReport().getStyles().values()) {
addStyleToDesign(style);
}
Style defaultDetailStyle = getReport().getOptions().getDefaultDetailStyle();
Style defaultHeaderStyle = getReport().getOptions().getDefaultHeaderStyle();
for (AbstractColumn column : report.getColumns()) {
if (column.getStyle() == null)
column.setStyle(defaultDetailStyle);
if (column.getHeaderStyle() == null)
column.setHeaderStyle(defaultHeaderStyle);
}
}
|
java
|
protected void ensureDJStyles() {
//first of all, register all parent styles if any
for (Style style : getReport().getStyles().values()) {
addStyleToDesign(style);
}
Style defaultDetailStyle = getReport().getOptions().getDefaultDetailStyle();
Style defaultHeaderStyle = getReport().getOptions().getDefaultHeaderStyle();
for (AbstractColumn column : report.getColumns()) {
if (column.getStyle() == null)
column.setStyle(defaultDetailStyle);
if (column.getHeaderStyle() == null)
column.setHeaderStyle(defaultHeaderStyle);
}
}
|
[
"protected",
"void",
"ensureDJStyles",
"(",
")",
"{",
"//first of all, register all parent styles if any",
"for",
"(",
"Style",
"style",
":",
"getReport",
"(",
")",
".",
"getStyles",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"addStyleToDesign",
"(",
"style",
")",
";",
"}",
"Style",
"defaultDetailStyle",
"=",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getDefaultDetailStyle",
"(",
")",
";",
"Style",
"defaultHeaderStyle",
"=",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getDefaultHeaderStyle",
"(",
")",
";",
"for",
"(",
"AbstractColumn",
"column",
":",
"report",
".",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"column",
".",
"getStyle",
"(",
")",
"==",
"null",
")",
"column",
".",
"setStyle",
"(",
"defaultDetailStyle",
")",
";",
"if",
"(",
"column",
".",
"getHeaderStyle",
"(",
")",
"==",
"null",
")",
"column",
".",
"setHeaderStyle",
"(",
"defaultHeaderStyle",
")",
";",
"}",
"}"
] |
Sets a default style for every element that doesn't have one
@throws JRException
|
[
"Sets",
"a",
"default",
"style",
"for",
"every",
"element",
"that",
"doesn",
"t",
"have",
"one"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L274-L289
|
159,270
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java
|
AbstractLayoutManager.setColumnsFinalWidth
|
protected void setColumnsFinalWidth() {
log.debug("Setting columns final width.");
float factor;
int printableArea = report.getOptions().getColumnWidth();
//Create a list with only the visible columns.
List visibleColums = getVisibleColumns();
if (report.getOptions().isUseFullPageWidth()) {
int columnsWidth = 0;
int notRezisableWidth = 0;
//Store in a variable the total with of all visible columns
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
columnsWidth += col.getWidth();
if (col.isFixedWidth())
notRezisableWidth += col.getWidth();
}
factor = (float) (printableArea - notRezisableWidth) / (float) (columnsWidth - notRezisableWidth);
log.debug("printableArea = " + printableArea
+ ", columnsWidth = " + columnsWidth
+ ", columnsWidth = " + columnsWidth
+ ", notRezisableWidth = " + notRezisableWidth
+ ", factor = " + factor);
int acumulated = 0;
int colFinalWidth;
//Select the non-resizable columns
Collection resizableColumns = CollectionUtils.select(visibleColums, new Predicate() {
public boolean evaluate(Object arg0) {
return !((AbstractColumn) arg0).isFixedWidth();
}
});
//Finally, set the new width to the resizable columns
for (Iterator iter = resizableColumns.iterator(); iter.hasNext(); ) {
AbstractColumn col = (AbstractColumn) iter.next();
if (!iter.hasNext()) {
col.setWidth(printableArea - notRezisableWidth - acumulated);
} else {
colFinalWidth = (new Float(col.getWidth() * factor)).intValue();
acumulated += colFinalWidth;
col.setWidth(colFinalWidth);
}
}
}
// If the columns width changed, the X position must be setted again.
int posx = 0;
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
col.setPosX(posx);
posx += col.getWidth();
}
}
|
java
|
protected void setColumnsFinalWidth() {
log.debug("Setting columns final width.");
float factor;
int printableArea = report.getOptions().getColumnWidth();
//Create a list with only the visible columns.
List visibleColums = getVisibleColumns();
if (report.getOptions().isUseFullPageWidth()) {
int columnsWidth = 0;
int notRezisableWidth = 0;
//Store in a variable the total with of all visible columns
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
columnsWidth += col.getWidth();
if (col.isFixedWidth())
notRezisableWidth += col.getWidth();
}
factor = (float) (printableArea - notRezisableWidth) / (float) (columnsWidth - notRezisableWidth);
log.debug("printableArea = " + printableArea
+ ", columnsWidth = " + columnsWidth
+ ", columnsWidth = " + columnsWidth
+ ", notRezisableWidth = " + notRezisableWidth
+ ", factor = " + factor);
int acumulated = 0;
int colFinalWidth;
//Select the non-resizable columns
Collection resizableColumns = CollectionUtils.select(visibleColums, new Predicate() {
public boolean evaluate(Object arg0) {
return !((AbstractColumn) arg0).isFixedWidth();
}
});
//Finally, set the new width to the resizable columns
for (Iterator iter = resizableColumns.iterator(); iter.hasNext(); ) {
AbstractColumn col = (AbstractColumn) iter.next();
if (!iter.hasNext()) {
col.setWidth(printableArea - notRezisableWidth - acumulated);
} else {
colFinalWidth = (new Float(col.getWidth() * factor)).intValue();
acumulated += colFinalWidth;
col.setWidth(colFinalWidth);
}
}
}
// If the columns width changed, the X position must be setted again.
int posx = 0;
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
col.setPosX(posx);
posx += col.getWidth();
}
}
|
[
"protected",
"void",
"setColumnsFinalWidth",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Setting columns final width.\"",
")",
";",
"float",
"factor",
";",
"int",
"printableArea",
"=",
"report",
".",
"getOptions",
"(",
")",
".",
"getColumnWidth",
"(",
")",
";",
"//Create a list with only the visible columns.",
"List",
"visibleColums",
"=",
"getVisibleColumns",
"(",
")",
";",
"if",
"(",
"report",
".",
"getOptions",
"(",
")",
".",
"isUseFullPageWidth",
"(",
")",
")",
"{",
"int",
"columnsWidth",
"=",
"0",
";",
"int",
"notRezisableWidth",
"=",
"0",
";",
"//Store in a variable the total with of all visible columns",
"for",
"(",
"Object",
"visibleColum",
":",
"visibleColums",
")",
"{",
"AbstractColumn",
"col",
"=",
"(",
"AbstractColumn",
")",
"visibleColum",
";",
"columnsWidth",
"+=",
"col",
".",
"getWidth",
"(",
")",
";",
"if",
"(",
"col",
".",
"isFixedWidth",
"(",
")",
")",
"notRezisableWidth",
"+=",
"col",
".",
"getWidth",
"(",
")",
";",
"}",
"factor",
"=",
"(",
"float",
")",
"(",
"printableArea",
"-",
"notRezisableWidth",
")",
"/",
"(",
"float",
")",
"(",
"columnsWidth",
"-",
"notRezisableWidth",
")",
";",
"log",
".",
"debug",
"(",
"\"printableArea = \"",
"+",
"printableArea",
"+",
"\", columnsWidth = \"",
"+",
"columnsWidth",
"+",
"\", columnsWidth = \"",
"+",
"columnsWidth",
"+",
"\", notRezisableWidth = \"",
"+",
"notRezisableWidth",
"+",
"\", factor = \"",
"+",
"factor",
")",
";",
"int",
"acumulated",
"=",
"0",
";",
"int",
"colFinalWidth",
";",
"//Select the non-resizable columns",
"Collection",
"resizableColumns",
"=",
"CollectionUtils",
".",
"select",
"(",
"visibleColums",
",",
"new",
"Predicate",
"(",
")",
"{",
"public",
"boolean",
"evaluate",
"(",
"Object",
"arg0",
")",
"{",
"return",
"!",
"(",
"(",
"AbstractColumn",
")",
"arg0",
")",
".",
"isFixedWidth",
"(",
")",
";",
"}",
"}",
")",
";",
"//Finally, set the new width to the resizable columns",
"for",
"(",
"Iterator",
"iter",
"=",
"resizableColumns",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"AbstractColumn",
"col",
"=",
"(",
"AbstractColumn",
")",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"col",
".",
"setWidth",
"(",
"printableArea",
"-",
"notRezisableWidth",
"-",
"acumulated",
")",
";",
"}",
"else",
"{",
"colFinalWidth",
"=",
"(",
"new",
"Float",
"(",
"col",
".",
"getWidth",
"(",
")",
"*",
"factor",
")",
")",
".",
"intValue",
"(",
")",
";",
"acumulated",
"+=",
"colFinalWidth",
";",
"col",
".",
"setWidth",
"(",
"colFinalWidth",
")",
";",
"}",
"}",
"}",
"// If the columns width changed, the X position must be setted again.",
"int",
"posx",
"=",
"0",
";",
"for",
"(",
"Object",
"visibleColum",
":",
"visibleColums",
")",
"{",
"AbstractColumn",
"col",
"=",
"(",
"AbstractColumn",
")",
"visibleColum",
";",
"col",
".",
"setPosX",
"(",
"posx",
")",
";",
"posx",
"+=",
"col",
".",
"getWidth",
"(",
")",
";",
"}",
"}"
] |
Sets the columns width by reading some report options like the
printableArea and useFullPageWidth.
columns with fixedWidth property set in TRUE will not be modified
|
[
"Sets",
"the",
"columns",
"width",
"by",
"reading",
"some",
"report",
"options",
"like",
"the",
"printableArea",
"and",
"useFullPageWidth",
".",
"columns",
"with",
"fixedWidth",
"property",
"set",
"in",
"TRUE",
"will",
"not",
"be",
"modified"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L619-L681
|
159,271
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java
|
AbstractLayoutManager.setBandsFinalHeight
|
protected void setBandsFinalHeight() {
log.debug("Setting bands final height...");
List<JRBand> bands = new ArrayList<JRBand>();
Utils.addNotNull(bands, design.getPageHeader());
Utils.addNotNull(bands, design.getPageFooter());
Utils.addNotNull(bands, design.getColumnHeader());
Utils.addNotNull(bands, design.getColumnFooter());
Utils.addNotNull(bands, design.getSummary());
Utils.addNotNull(bands, design.getBackground());
bands.addAll(((JRDesignSection) design.getDetailSection()).getBandsList());
Utils.addNotNull(bands, design.getLastPageFooter());
Utils.addNotNull(bands, design.getTitle());
Utils.addNotNull(bands, design.getPageFooter());
Utils.addNotNull(bands, design.getNoData());
for (JRGroup jrgroup : design.getGroupsList()) {
DJGroup djGroup = (DJGroup) getReferencesMap().get(jrgroup.getName());
JRDesignSection headerSection = (JRDesignSection) jrgroup.getGroupHeaderSection();
JRDesignSection footerSection = (JRDesignSection) jrgroup.getGroupFooterSection();
if (djGroup != null) {
for (JRBand headerBand : headerSection.getBandsList()) {
setBandFinalHeight((JRDesignBand) headerBand, djGroup.getHeaderHeight(), djGroup.isFitHeaderHeightToContent());
}
for (JRBand footerBand : footerSection.getBandsList()) {
setBandFinalHeight((JRDesignBand) footerBand, djGroup.getFooterHeight(), djGroup.isFitFooterHeightToContent());
}
} else {
bands.addAll(headerSection.getBandsList());
bands.addAll(footerSection.getBandsList());
}
}
for (JRBand jrDesignBand : bands) {
setBandFinalHeight((JRDesignBand) jrDesignBand);
}
}
|
java
|
protected void setBandsFinalHeight() {
log.debug("Setting bands final height...");
List<JRBand> bands = new ArrayList<JRBand>();
Utils.addNotNull(bands, design.getPageHeader());
Utils.addNotNull(bands, design.getPageFooter());
Utils.addNotNull(bands, design.getColumnHeader());
Utils.addNotNull(bands, design.getColumnFooter());
Utils.addNotNull(bands, design.getSummary());
Utils.addNotNull(bands, design.getBackground());
bands.addAll(((JRDesignSection) design.getDetailSection()).getBandsList());
Utils.addNotNull(bands, design.getLastPageFooter());
Utils.addNotNull(bands, design.getTitle());
Utils.addNotNull(bands, design.getPageFooter());
Utils.addNotNull(bands, design.getNoData());
for (JRGroup jrgroup : design.getGroupsList()) {
DJGroup djGroup = (DJGroup) getReferencesMap().get(jrgroup.getName());
JRDesignSection headerSection = (JRDesignSection) jrgroup.getGroupHeaderSection();
JRDesignSection footerSection = (JRDesignSection) jrgroup.getGroupFooterSection();
if (djGroup != null) {
for (JRBand headerBand : headerSection.getBandsList()) {
setBandFinalHeight((JRDesignBand) headerBand, djGroup.getHeaderHeight(), djGroup.isFitHeaderHeightToContent());
}
for (JRBand footerBand : footerSection.getBandsList()) {
setBandFinalHeight((JRDesignBand) footerBand, djGroup.getFooterHeight(), djGroup.isFitFooterHeightToContent());
}
} else {
bands.addAll(headerSection.getBandsList());
bands.addAll(footerSection.getBandsList());
}
}
for (JRBand jrDesignBand : bands) {
setBandFinalHeight((JRDesignBand) jrDesignBand);
}
}
|
[
"protected",
"void",
"setBandsFinalHeight",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Setting bands final height...\"",
")",
";",
"List",
"<",
"JRBand",
">",
"bands",
"=",
"new",
"ArrayList",
"<",
"JRBand",
">",
"(",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getPageHeader",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getPageFooter",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getColumnHeader",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getColumnFooter",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getSummary",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getBackground",
"(",
")",
")",
";",
"bands",
".",
"addAll",
"(",
"(",
"(",
"JRDesignSection",
")",
"design",
".",
"getDetailSection",
"(",
")",
")",
".",
"getBandsList",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getLastPageFooter",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getTitle",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getPageFooter",
"(",
")",
")",
";",
"Utils",
".",
"addNotNull",
"(",
"bands",
",",
"design",
".",
"getNoData",
"(",
")",
")",
";",
"for",
"(",
"JRGroup",
"jrgroup",
":",
"design",
".",
"getGroupsList",
"(",
")",
")",
"{",
"DJGroup",
"djGroup",
"=",
"(",
"DJGroup",
")",
"getReferencesMap",
"(",
")",
".",
"get",
"(",
"jrgroup",
".",
"getName",
"(",
")",
")",
";",
"JRDesignSection",
"headerSection",
"=",
"(",
"JRDesignSection",
")",
"jrgroup",
".",
"getGroupHeaderSection",
"(",
")",
";",
"JRDesignSection",
"footerSection",
"=",
"(",
"JRDesignSection",
")",
"jrgroup",
".",
"getGroupFooterSection",
"(",
")",
";",
"if",
"(",
"djGroup",
"!=",
"null",
")",
"{",
"for",
"(",
"JRBand",
"headerBand",
":",
"headerSection",
".",
"getBandsList",
"(",
")",
")",
"{",
"setBandFinalHeight",
"(",
"(",
"JRDesignBand",
")",
"headerBand",
",",
"djGroup",
".",
"getHeaderHeight",
"(",
")",
",",
"djGroup",
".",
"isFitHeaderHeightToContent",
"(",
")",
")",
";",
"}",
"for",
"(",
"JRBand",
"footerBand",
":",
"footerSection",
".",
"getBandsList",
"(",
")",
")",
"{",
"setBandFinalHeight",
"(",
"(",
"JRDesignBand",
")",
"footerBand",
",",
"djGroup",
".",
"getFooterHeight",
"(",
")",
",",
"djGroup",
".",
"isFitFooterHeightToContent",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"bands",
".",
"addAll",
"(",
"headerSection",
".",
"getBandsList",
"(",
")",
")",
";",
"bands",
".",
"addAll",
"(",
"footerSection",
".",
"getBandsList",
"(",
")",
")",
";",
"}",
"}",
"for",
"(",
"JRBand",
"jrDesignBand",
":",
"bands",
")",
"{",
"setBandFinalHeight",
"(",
"(",
"JRDesignBand",
")",
"jrDesignBand",
")",
";",
"}",
"}"
] |
Sets the necessary height for all bands in the report, to hold their children
|
[
"Sets",
"the",
"necessary",
"height",
"for",
"all",
"bands",
"in",
"the",
"report",
"to",
"hold",
"their",
"children"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L693-L732
|
159,272
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java
|
AbstractLayoutManager.setBandFinalHeight
|
private void setBandFinalHeight(JRDesignBand band, int currHeigth, boolean fitToContent) {
if (band != null) {
int finalHeight = LayoutUtils.findVerticalOffset(band);
//noinspection StatementWithEmptyBody
if (finalHeight < currHeigth && !fitToContent) {
//nothing
} else {
band.setHeight(finalHeight);
}
}
}
|
java
|
private void setBandFinalHeight(JRDesignBand band, int currHeigth, boolean fitToContent) {
if (band != null) {
int finalHeight = LayoutUtils.findVerticalOffset(band);
//noinspection StatementWithEmptyBody
if (finalHeight < currHeigth && !fitToContent) {
//nothing
} else {
band.setHeight(finalHeight);
}
}
}
|
[
"private",
"void",
"setBandFinalHeight",
"(",
"JRDesignBand",
"band",
",",
"int",
"currHeigth",
",",
"boolean",
"fitToContent",
")",
"{",
"if",
"(",
"band",
"!=",
"null",
")",
"{",
"int",
"finalHeight",
"=",
"LayoutUtils",
".",
"findVerticalOffset",
"(",
"band",
")",
";",
"//noinspection StatementWithEmptyBody",
"if",
"(",
"finalHeight",
"<",
"currHeigth",
"&&",
"!",
"fitToContent",
")",
"{",
"//nothing",
"}",
"else",
"{",
"band",
".",
"setHeight",
"(",
"finalHeight",
")",
";",
"}",
"}",
"}"
] |
Removes empty space when "fitToContent" is true and real height of object is
taller than current bands height, otherwise, it is not modified
@param band
@param currHeigth
@param fitToContent
|
[
"Removes",
"empty",
"space",
"when",
"fitToContent",
"is",
"true",
"and",
"real",
"height",
"of",
"object",
"is",
"taller",
"than",
"current",
"bands",
"height",
"otherwise",
"it",
"is",
"not",
"modified"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L742-L753
|
159,273
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java
|
AbstractLayoutManager.getParent
|
protected JRDesignGroup getParent(JRDesignGroup group) {
int index = realGroups.indexOf(group);
return (index > 0) ? (JRDesignGroup) realGroups.get(index - 1) : group;
}
|
java
|
protected JRDesignGroup getParent(JRDesignGroup group) {
int index = realGroups.indexOf(group);
return (index > 0) ? (JRDesignGroup) realGroups.get(index - 1) : group;
}
|
[
"protected",
"JRDesignGroup",
"getParent",
"(",
"JRDesignGroup",
"group",
")",
"{",
"int",
"index",
"=",
"realGroups",
".",
"indexOf",
"(",
"group",
")",
";",
"return",
"(",
"index",
">",
"0",
")",
"?",
"(",
"JRDesignGroup",
")",
"realGroups",
".",
"get",
"(",
"index",
"-",
"1",
")",
":",
"group",
";",
"}"
] |
Finds the parent group of the given one and returns it
@param group Group for which the parent is needed
@return The parent group of the given one. If the given one is the first one, it returns the same group
|
[
"Finds",
"the",
"parent",
"group",
"of",
"the",
"given",
"one",
"and",
"returns",
"it"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/AbstractLayoutManager.java#L1325-L1328
|
159,274
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java
|
LayoutUtils.findVerticalOffset
|
public static int findVerticalOffset(JRDesignBand band) {
int finalHeight = 0;
if (band != null) {
for (JRChild jrChild : band.getChildren()) {
JRDesignElement element = (JRDesignElement) jrChild;
int currentHeight = element.getY() + element.getHeight();
if (currentHeight > finalHeight) finalHeight = currentHeight;
}
return finalHeight;
}
return finalHeight;
}
|
java
|
public static int findVerticalOffset(JRDesignBand band) {
int finalHeight = 0;
if (band != null) {
for (JRChild jrChild : band.getChildren()) {
JRDesignElement element = (JRDesignElement) jrChild;
int currentHeight = element.getY() + element.getHeight();
if (currentHeight > finalHeight) finalHeight = currentHeight;
}
return finalHeight;
}
return finalHeight;
}
|
[
"public",
"static",
"int",
"findVerticalOffset",
"(",
"JRDesignBand",
"band",
")",
"{",
"int",
"finalHeight",
"=",
"0",
";",
"if",
"(",
"band",
"!=",
"null",
")",
"{",
"for",
"(",
"JRChild",
"jrChild",
":",
"band",
".",
"getChildren",
"(",
")",
")",
"{",
"JRDesignElement",
"element",
"=",
"(",
"JRDesignElement",
")",
"jrChild",
";",
"int",
"currentHeight",
"=",
"element",
".",
"getY",
"(",
")",
"+",
"element",
".",
"getHeight",
"(",
")",
";",
"if",
"(",
"currentHeight",
">",
"finalHeight",
")",
"finalHeight",
"=",
"currentHeight",
";",
"}",
"return",
"finalHeight",
";",
"}",
"return",
"finalHeight",
";",
"}"
] |
Finds "Y" coordinate value in which more elements could be added in the band
@param band
@return
|
[
"Finds",
"Y",
"coordinate",
"value",
"in",
"which",
"more",
"elements",
"could",
"be",
"added",
"in",
"the",
"band"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L35-L46
|
159,275
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java
|
LayoutUtils.moveBandsElemnts
|
public static void moveBandsElemnts(int yOffset, JRDesignBand band) {
if (band == null)
return;
for (JRChild jrChild : band.getChildren()) {
JRDesignElement elem = (JRDesignElement) jrChild;
elem.setY(elem.getY() + yOffset);
}
}
|
java
|
public static void moveBandsElemnts(int yOffset, JRDesignBand band) {
if (band == null)
return;
for (JRChild jrChild : band.getChildren()) {
JRDesignElement elem = (JRDesignElement) jrChild;
elem.setY(elem.getY() + yOffset);
}
}
|
[
"public",
"static",
"void",
"moveBandsElemnts",
"(",
"int",
"yOffset",
",",
"JRDesignBand",
"band",
")",
"{",
"if",
"(",
"band",
"==",
"null",
")",
"return",
";",
"for",
"(",
"JRChild",
"jrChild",
":",
"band",
".",
"getChildren",
"(",
")",
")",
"{",
"JRDesignElement",
"elem",
"=",
"(",
"JRDesignElement",
")",
"jrChild",
";",
"elem",
".",
"setY",
"(",
"elem",
".",
"getY",
"(",
")",
"+",
"yOffset",
")",
";",
"}",
"}"
] |
Moves the elements contained in "band" in the Y axis "yOffset"
@param yOffset
@param band
|
[
"Moves",
"the",
"elements",
"contained",
"in",
"band",
"in",
"the",
"Y",
"axis",
"yOffset"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L89-L97
|
159,276
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java
|
LayoutUtils.getJRDesignGroup
|
public static JRDesignGroup getJRDesignGroup(DynamicJasperDesign jd, LayoutManager layoutManager, DJGroup group) {
Map references = layoutManager.getReferencesMap();
for (Object o : references.keySet()) {
String groupName = (String) o;
DJGroup djGroup = (DJGroup) references.get(groupName);
if (group == djGroup) {
return (JRDesignGroup) jd.getGroupsMap().get(groupName);
}
}
return null;
}
|
java
|
public static JRDesignGroup getJRDesignGroup(DynamicJasperDesign jd, LayoutManager layoutManager, DJGroup group) {
Map references = layoutManager.getReferencesMap();
for (Object o : references.keySet()) {
String groupName = (String) o;
DJGroup djGroup = (DJGroup) references.get(groupName);
if (group == djGroup) {
return (JRDesignGroup) jd.getGroupsMap().get(groupName);
}
}
return null;
}
|
[
"public",
"static",
"JRDesignGroup",
"getJRDesignGroup",
"(",
"DynamicJasperDesign",
"jd",
",",
"LayoutManager",
"layoutManager",
",",
"DJGroup",
"group",
")",
"{",
"Map",
"references",
"=",
"layoutManager",
".",
"getReferencesMap",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"references",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"groupName",
"=",
"(",
"String",
")",
"o",
";",
"DJGroup",
"djGroup",
"=",
"(",
"DJGroup",
")",
"references",
".",
"get",
"(",
"groupName",
")",
";",
"if",
"(",
"group",
"==",
"djGroup",
")",
"{",
"return",
"(",
"JRDesignGroup",
")",
"jd",
".",
"getGroupsMap",
"(",
")",
".",
"get",
"(",
"groupName",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns the JRDesignGroup for the DJGroup passed
@param jd
@param layoutManager
@param group
@return
|
[
"Returns",
"the",
"JRDesignGroup",
"for",
"the",
"DJGroup",
"passed"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L122-L132
|
159,277
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java
|
ClassicLayoutManager.applyBanners
|
protected void applyBanners() {
DynamicReportOptions options = getReport().getOptions();
if (options.getFirstPageImageBanners().isEmpty() && options.getImageBanners().isEmpty()){
return;
}
/*
First create image banners for the first page only
*/
JRDesignBand title = (JRDesignBand) getDesign().getTitle();
//if there is no title band, but there are banner images for the first page, we create a title band
if (title == null && !options.getFirstPageImageBanners().isEmpty()){
title = new JRDesignBand();
getDesign().setTitle(title);
}
applyImageBannersToBand(title, options.getFirstPageImageBanners().values(), null, true);
/*
Now create image banner for the rest of the pages
*/
JRDesignBand pageHeader = (JRDesignBand) getDesign().getPageHeader();
//if there is no title band, but there are banner images for the first page, we create a title band
if (pageHeader == null && !options.getImageBanners().isEmpty()){
pageHeader = new JRDesignBand();
getDesign().setPageHeader(pageHeader);
}
JRDesignExpression printWhenExpression = null;
if (!options.getFirstPageImageBanners().isEmpty()){
printWhenExpression = new JRDesignExpression();
printWhenExpression.setValueClass(Boolean.class);
printWhenExpression.setText(EXPRESSION_TRUE_WHEN_NOT_FIRST_PAGE);
}
applyImageBannersToBand(pageHeader, options.getImageBanners().values(),printWhenExpression, true);
}
|
java
|
protected void applyBanners() {
DynamicReportOptions options = getReport().getOptions();
if (options.getFirstPageImageBanners().isEmpty() && options.getImageBanners().isEmpty()){
return;
}
/*
First create image banners for the first page only
*/
JRDesignBand title = (JRDesignBand) getDesign().getTitle();
//if there is no title band, but there are banner images for the first page, we create a title band
if (title == null && !options.getFirstPageImageBanners().isEmpty()){
title = new JRDesignBand();
getDesign().setTitle(title);
}
applyImageBannersToBand(title, options.getFirstPageImageBanners().values(), null, true);
/*
Now create image banner for the rest of the pages
*/
JRDesignBand pageHeader = (JRDesignBand) getDesign().getPageHeader();
//if there is no title band, but there are banner images for the first page, we create a title band
if (pageHeader == null && !options.getImageBanners().isEmpty()){
pageHeader = new JRDesignBand();
getDesign().setPageHeader(pageHeader);
}
JRDesignExpression printWhenExpression = null;
if (!options.getFirstPageImageBanners().isEmpty()){
printWhenExpression = new JRDesignExpression();
printWhenExpression.setValueClass(Boolean.class);
printWhenExpression.setText(EXPRESSION_TRUE_WHEN_NOT_FIRST_PAGE);
}
applyImageBannersToBand(pageHeader, options.getImageBanners().values(),printWhenExpression, true);
}
|
[
"protected",
"void",
"applyBanners",
"(",
")",
"{",
"DynamicReportOptions",
"options",
"=",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
";",
"if",
"(",
"options",
".",
"getFirstPageImageBanners",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"options",
".",
"getImageBanners",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"/*\n\t\t First create image banners for the first page only\n\t\t */",
"JRDesignBand",
"title",
"=",
"(",
"JRDesignBand",
")",
"getDesign",
"(",
")",
".",
"getTitle",
"(",
")",
";",
"//if there is no title band, but there are banner images for the first page, we create a title band",
"if",
"(",
"title",
"==",
"null",
"&&",
"!",
"options",
".",
"getFirstPageImageBanners",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"title",
"=",
"new",
"JRDesignBand",
"(",
")",
";",
"getDesign",
"(",
")",
".",
"setTitle",
"(",
"title",
")",
";",
"}",
"applyImageBannersToBand",
"(",
"title",
",",
"options",
".",
"getFirstPageImageBanners",
"(",
")",
".",
"values",
"(",
")",
",",
"null",
",",
"true",
")",
";",
"/*\n\t\t Now create image banner for the rest of the pages\n\t\t */",
"JRDesignBand",
"pageHeader",
"=",
"(",
"JRDesignBand",
")",
"getDesign",
"(",
")",
".",
"getPageHeader",
"(",
")",
";",
"//if there is no title band, but there are banner images for the first page, we create a title band",
"if",
"(",
"pageHeader",
"==",
"null",
"&&",
"!",
"options",
".",
"getImageBanners",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"pageHeader",
"=",
"new",
"JRDesignBand",
"(",
")",
";",
"getDesign",
"(",
")",
".",
"setPageHeader",
"(",
"pageHeader",
")",
";",
"}",
"JRDesignExpression",
"printWhenExpression",
"=",
"null",
";",
"if",
"(",
"!",
"options",
".",
"getFirstPageImageBanners",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"printWhenExpression",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"printWhenExpression",
".",
"setValueClass",
"(",
"Boolean",
".",
"class",
")",
";",
"printWhenExpression",
".",
"setText",
"(",
"EXPRESSION_TRUE_WHEN_NOT_FIRST_PAGE",
")",
";",
"}",
"applyImageBannersToBand",
"(",
"pageHeader",
",",
"options",
".",
"getImageBanners",
"(",
")",
".",
"values",
"(",
")",
",",
"printWhenExpression",
",",
"true",
")",
";",
"}"
] |
Create the image elements for the banners tha goes into the
title and header bands depending on the case
|
[
"Create",
"the",
"image",
"elements",
"for",
"the",
"banners",
"tha",
"goes",
"into",
"the",
"title",
"and",
"header",
"bands",
"depending",
"on",
"the",
"case"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L246-L282
|
159,278
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java
|
ClassicLayoutManager.generateTitleBand
|
protected void generateTitleBand() {
log.debug("Generating title band...");
JRDesignBand band = (JRDesignBand) getDesign().getPageHeader();
int yOffset = 0;
//If title is not present then subtitle will be ignored
if (getReport().getTitle() == null)
return;
if (band != null && !getDesign().isTitleNewPage()){
//Title and subtitle comes afer the page header
yOffset = band.getHeight();
} else {
band = (JRDesignBand) getDesign().getTitle();
if (band == null){
band = new JRDesignBand();
getDesign().setTitle(band);
}
}
JRDesignExpression printWhenExpression = new JRDesignExpression();
printWhenExpression.setValueClass(Boolean.class);
printWhenExpression.setText(EXPRESSION_TRUE_WHEN_FIRST_PAGE);
JRDesignTextField title = new JRDesignTextField();
JRDesignExpression exp = new JRDesignExpression();
if (getReport().isTitleIsJrExpression()){
exp.setText(getReport().getTitle());
}else {
exp.setText("\"" + Utils.escapeTextForExpression( getReport().getTitle()) + "\"");
}
exp.setValueClass(String.class);
title.setExpression(exp);
title.setWidth(getReport().getOptions().getPrintableWidth());
title.setHeight(getReport().getOptions().getTitleHeight());
title.setY(yOffset);
title.setPrintWhenExpression(printWhenExpression);
title.setRemoveLineWhenBlank(true);
applyStyleToElement(getReport().getTitleStyle(), title);
title.setStretchType( StretchTypeEnum.NO_STRETCH );
band.addElement(title);
JRDesignTextField subtitle = new JRDesignTextField();
if (getReport().getSubtitle() != null) {
JRDesignExpression exp2 = new JRDesignExpression();
exp2.setText("\"" + getReport().getSubtitle() + "\"");
exp2.setValueClass(String.class);
subtitle.setExpression(exp2);
subtitle.setWidth(getReport().getOptions().getPrintableWidth());
subtitle.setHeight(getReport().getOptions().getSubtitleHeight());
subtitle.setY(title.getY() + title.getHeight());
subtitle.setPrintWhenExpression(printWhenExpression);
subtitle.setRemoveLineWhenBlank(true);
applyStyleToElement(getReport().getSubtitleStyle(), subtitle);
title.setStretchType( StretchTypeEnum.NO_STRETCH );
band.addElement(subtitle);
}
}
|
java
|
protected void generateTitleBand() {
log.debug("Generating title band...");
JRDesignBand band = (JRDesignBand) getDesign().getPageHeader();
int yOffset = 0;
//If title is not present then subtitle will be ignored
if (getReport().getTitle() == null)
return;
if (band != null && !getDesign().isTitleNewPage()){
//Title and subtitle comes afer the page header
yOffset = band.getHeight();
} else {
band = (JRDesignBand) getDesign().getTitle();
if (band == null){
band = new JRDesignBand();
getDesign().setTitle(band);
}
}
JRDesignExpression printWhenExpression = new JRDesignExpression();
printWhenExpression.setValueClass(Boolean.class);
printWhenExpression.setText(EXPRESSION_TRUE_WHEN_FIRST_PAGE);
JRDesignTextField title = new JRDesignTextField();
JRDesignExpression exp = new JRDesignExpression();
if (getReport().isTitleIsJrExpression()){
exp.setText(getReport().getTitle());
}else {
exp.setText("\"" + Utils.escapeTextForExpression( getReport().getTitle()) + "\"");
}
exp.setValueClass(String.class);
title.setExpression(exp);
title.setWidth(getReport().getOptions().getPrintableWidth());
title.setHeight(getReport().getOptions().getTitleHeight());
title.setY(yOffset);
title.setPrintWhenExpression(printWhenExpression);
title.setRemoveLineWhenBlank(true);
applyStyleToElement(getReport().getTitleStyle(), title);
title.setStretchType( StretchTypeEnum.NO_STRETCH );
band.addElement(title);
JRDesignTextField subtitle = new JRDesignTextField();
if (getReport().getSubtitle() != null) {
JRDesignExpression exp2 = new JRDesignExpression();
exp2.setText("\"" + getReport().getSubtitle() + "\"");
exp2.setValueClass(String.class);
subtitle.setExpression(exp2);
subtitle.setWidth(getReport().getOptions().getPrintableWidth());
subtitle.setHeight(getReport().getOptions().getSubtitleHeight());
subtitle.setY(title.getY() + title.getHeight());
subtitle.setPrintWhenExpression(printWhenExpression);
subtitle.setRemoveLineWhenBlank(true);
applyStyleToElement(getReport().getSubtitleStyle(), subtitle);
title.setStretchType( StretchTypeEnum.NO_STRETCH );
band.addElement(subtitle);
}
}
|
[
"protected",
"void",
"generateTitleBand",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Generating title band...\"",
")",
";",
"JRDesignBand",
"band",
"=",
"(",
"JRDesignBand",
")",
"getDesign",
"(",
")",
".",
"getPageHeader",
"(",
")",
";",
"int",
"yOffset",
"=",
"0",
";",
"//If title is not present then subtitle will be ignored",
"if",
"(",
"getReport",
"(",
")",
".",
"getTitle",
"(",
")",
"==",
"null",
")",
"return",
";",
"if",
"(",
"band",
"!=",
"null",
"&&",
"!",
"getDesign",
"(",
")",
".",
"isTitleNewPage",
"(",
")",
")",
"{",
"//Title and subtitle comes afer the page header",
"yOffset",
"=",
"band",
".",
"getHeight",
"(",
")",
";",
"}",
"else",
"{",
"band",
"=",
"(",
"JRDesignBand",
")",
"getDesign",
"(",
")",
".",
"getTitle",
"(",
")",
";",
"if",
"(",
"band",
"==",
"null",
")",
"{",
"band",
"=",
"new",
"JRDesignBand",
"(",
")",
";",
"getDesign",
"(",
")",
".",
"setTitle",
"(",
"band",
")",
";",
"}",
"}",
"JRDesignExpression",
"printWhenExpression",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"printWhenExpression",
".",
"setValueClass",
"(",
"Boolean",
".",
"class",
")",
";",
"printWhenExpression",
".",
"setText",
"(",
"EXPRESSION_TRUE_WHEN_FIRST_PAGE",
")",
";",
"JRDesignTextField",
"title",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"JRDesignExpression",
"exp",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"if",
"(",
"getReport",
"(",
")",
".",
"isTitleIsJrExpression",
"(",
")",
")",
"{",
"exp",
".",
"setText",
"(",
"getReport",
"(",
")",
".",
"getTitle",
"(",
")",
")",
";",
"}",
"else",
"{",
"exp",
".",
"setText",
"(",
"\"\\\"\"",
"+",
"Utils",
".",
"escapeTextForExpression",
"(",
"getReport",
"(",
")",
".",
"getTitle",
"(",
")",
")",
"+",
"\"\\\"\"",
")",
";",
"}",
"exp",
".",
"setValueClass",
"(",
"String",
".",
"class",
")",
";",
"title",
".",
"setExpression",
"(",
"exp",
")",
";",
"title",
".",
"setWidth",
"(",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getPrintableWidth",
"(",
")",
")",
";",
"title",
".",
"setHeight",
"(",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getTitleHeight",
"(",
")",
")",
";",
"title",
".",
"setY",
"(",
"yOffset",
")",
";",
"title",
".",
"setPrintWhenExpression",
"(",
"printWhenExpression",
")",
";",
"title",
".",
"setRemoveLineWhenBlank",
"(",
"true",
")",
";",
"applyStyleToElement",
"(",
"getReport",
"(",
")",
".",
"getTitleStyle",
"(",
")",
",",
"title",
")",
";",
"title",
".",
"setStretchType",
"(",
"StretchTypeEnum",
".",
"NO_STRETCH",
")",
";",
"band",
".",
"addElement",
"(",
"title",
")",
";",
"JRDesignTextField",
"subtitle",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"if",
"(",
"getReport",
"(",
")",
".",
"getSubtitle",
"(",
")",
"!=",
"null",
")",
"{",
"JRDesignExpression",
"exp2",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"exp2",
".",
"setText",
"(",
"\"\\\"\"",
"+",
"getReport",
"(",
")",
".",
"getSubtitle",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"exp2",
".",
"setValueClass",
"(",
"String",
".",
"class",
")",
";",
"subtitle",
".",
"setExpression",
"(",
"exp2",
")",
";",
"subtitle",
".",
"setWidth",
"(",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getPrintableWidth",
"(",
")",
")",
";",
"subtitle",
".",
"setHeight",
"(",
"getReport",
"(",
")",
".",
"getOptions",
"(",
")",
".",
"getSubtitleHeight",
"(",
")",
")",
";",
"subtitle",
".",
"setY",
"(",
"title",
".",
"getY",
"(",
")",
"+",
"title",
".",
"getHeight",
"(",
")",
")",
";",
"subtitle",
".",
"setPrintWhenExpression",
"(",
"printWhenExpression",
")",
";",
"subtitle",
".",
"setRemoveLineWhenBlank",
"(",
"true",
")",
";",
"applyStyleToElement",
"(",
"getReport",
"(",
")",
".",
"getSubtitleStyle",
"(",
")",
",",
"subtitle",
")",
";",
"title",
".",
"setStretchType",
"(",
"StretchTypeEnum",
".",
"NO_STRETCH",
")",
";",
"band",
".",
"addElement",
"(",
"subtitle",
")",
";",
"}",
"}"
] |
Adds title and subtitle to the TitleBand when it applies.
If title is not present then subtitle will be ignored
|
[
"Adds",
"title",
"and",
"subtitle",
"to",
"the",
"TitleBand",
"when",
"it",
"applies",
".",
"If",
"title",
"is",
"not",
"present",
"then",
"subtitle",
"will",
"be",
"ignored"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L370-L430
|
159,279
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java
|
ClassicLayoutManager.layoutGroupFooterLabels
|
protected void layoutGroupFooterLabels(DJGroup djgroup, JRDesignGroup jgroup, int x, int y, int width, int height) {
//List footerVariables = djgroup.getFooterVariables();
DJGroupLabel label = djgroup.getFooterLabel();
//if (label == null || footerVariables.isEmpty())
//return;
//PropertyColumn col = djgroup.getColumnToGroupBy();
JRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupFooterSection());
// log.debug("Adding footer group label for group " + djgroup);
/*DJGroupVariable lmvar = findLeftMostColumn(footerVariables);
AbstractColumn lmColumn = lmvar.getColumnToApplyOperation();
int width = lmColumn.getPosX().intValue() - col.getPosX().intValue();
int yOffset = findYOffsetForGroupLabel(band);*/
JRDesignExpression labelExp;
if (label.isJasperExpression()) //a text with things like "$F{myField}"
labelExp = ExpressionUtils.createStringExpression(label.getText());
else if (label.getLabelExpression() != null){
labelExp = ExpressionUtils.createExpression(jgroup.getName() + "_labelExpression", label.getLabelExpression(), true);
} else //a simple text
//labelExp = ExpressionUtils.createStringExpression("\""+ Utils.escapeTextForExpression(label.getText())+ "\"");
labelExp = ExpressionUtils.createStringExpression("\""+ label.getText() + "\"");
JRDesignTextField labelTf = new JRDesignTextField();
labelTf.setExpression(labelExp);
labelTf.setWidth(width);
labelTf.setHeight(height);
labelTf.setX(x);
labelTf.setY(y);
//int yOffsetGlabel = labelTf.getHeight();
labelTf.setPositionType( PositionTypeEnum.FIX_RELATIVE_TO_TOP );
applyStyleToElement(label.getStyle(), labelTf);
band.addElement(labelTf);
}
|
java
|
protected void layoutGroupFooterLabels(DJGroup djgroup, JRDesignGroup jgroup, int x, int y, int width, int height) {
//List footerVariables = djgroup.getFooterVariables();
DJGroupLabel label = djgroup.getFooterLabel();
//if (label == null || footerVariables.isEmpty())
//return;
//PropertyColumn col = djgroup.getColumnToGroupBy();
JRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupFooterSection());
// log.debug("Adding footer group label for group " + djgroup);
/*DJGroupVariable lmvar = findLeftMostColumn(footerVariables);
AbstractColumn lmColumn = lmvar.getColumnToApplyOperation();
int width = lmColumn.getPosX().intValue() - col.getPosX().intValue();
int yOffset = findYOffsetForGroupLabel(band);*/
JRDesignExpression labelExp;
if (label.isJasperExpression()) //a text with things like "$F{myField}"
labelExp = ExpressionUtils.createStringExpression(label.getText());
else if (label.getLabelExpression() != null){
labelExp = ExpressionUtils.createExpression(jgroup.getName() + "_labelExpression", label.getLabelExpression(), true);
} else //a simple text
//labelExp = ExpressionUtils.createStringExpression("\""+ Utils.escapeTextForExpression(label.getText())+ "\"");
labelExp = ExpressionUtils.createStringExpression("\""+ label.getText() + "\"");
JRDesignTextField labelTf = new JRDesignTextField();
labelTf.setExpression(labelExp);
labelTf.setWidth(width);
labelTf.setHeight(height);
labelTf.setX(x);
labelTf.setY(y);
//int yOffsetGlabel = labelTf.getHeight();
labelTf.setPositionType( PositionTypeEnum.FIX_RELATIVE_TO_TOP );
applyStyleToElement(label.getStyle(), labelTf);
band.addElement(labelTf);
}
|
[
"protected",
"void",
"layoutGroupFooterLabels",
"(",
"DJGroup",
"djgroup",
",",
"JRDesignGroup",
"jgroup",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"//List footerVariables = djgroup.getFooterVariables();",
"DJGroupLabel",
"label",
"=",
"djgroup",
".",
"getFooterLabel",
"(",
")",
";",
"//if (label == null || footerVariables.isEmpty())",
"//return;",
"//PropertyColumn col = djgroup.getColumnToGroupBy();",
"JRDesignBand",
"band",
"=",
"LayoutUtils",
".",
"getBandFromSection",
"(",
"(",
"JRDesignSection",
")",
"jgroup",
".",
"getGroupFooterSection",
"(",
")",
")",
";",
"//\t\tlog.debug(\"Adding footer group label for group \" + djgroup);",
"/*DJGroupVariable lmvar = findLeftMostColumn(footerVariables);\n\t\tAbstractColumn lmColumn = lmvar.getColumnToApplyOperation();\n\t\tint width = lmColumn.getPosX().intValue() - col.getPosX().intValue();\n\n\t\tint yOffset = findYOffsetForGroupLabel(band);*/",
"JRDesignExpression",
"labelExp",
";",
"if",
"(",
"label",
".",
"isJasperExpression",
"(",
")",
")",
"//a text with things like \"$F{myField}\"",
"labelExp",
"=",
"ExpressionUtils",
".",
"createStringExpression",
"(",
"label",
".",
"getText",
"(",
")",
")",
";",
"else",
"if",
"(",
"label",
".",
"getLabelExpression",
"(",
")",
"!=",
"null",
")",
"{",
"labelExp",
"=",
"ExpressionUtils",
".",
"createExpression",
"(",
"jgroup",
".",
"getName",
"(",
")",
"+",
"\"_labelExpression\"",
",",
"label",
".",
"getLabelExpression",
"(",
")",
",",
"true",
")",
";",
"}",
"else",
"//a simple text",
"//labelExp = ExpressionUtils.createStringExpression(\"\\\"\"+ Utils.escapeTextForExpression(label.getText())+ \"\\\"\");",
"labelExp",
"=",
"ExpressionUtils",
".",
"createStringExpression",
"(",
"\"\\\"\"",
"+",
"label",
".",
"getText",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"JRDesignTextField",
"labelTf",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"labelTf",
".",
"setExpression",
"(",
"labelExp",
")",
";",
"labelTf",
".",
"setWidth",
"(",
"width",
")",
";",
"labelTf",
".",
"setHeight",
"(",
"height",
")",
";",
"labelTf",
".",
"setX",
"(",
"x",
")",
";",
"labelTf",
".",
"setY",
"(",
"y",
")",
";",
"//int yOffsetGlabel = labelTf.getHeight();",
"labelTf",
".",
"setPositionType",
"(",
"PositionTypeEnum",
".",
"FIX_RELATIVE_TO_TOP",
")",
";",
"applyStyleToElement",
"(",
"label",
".",
"getStyle",
"(",
")",
",",
"labelTf",
")",
";",
"band",
".",
"addElement",
"(",
"labelTf",
")",
";",
"}"
] |
Creates needed textfields for general label in footer groups.
@param djgroup
@param jgroup
|
[
"Creates",
"needed",
"textfields",
"for",
"general",
"label",
"in",
"footer",
"groups",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L554-L590
|
159,280
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java
|
ClassicLayoutManager.findYOffsetForGroupLabel
|
private int findYOffsetForGroupLabel(JRDesignBand band) {
int offset = 0;
for (JRChild jrChild : band.getChildren()) {
JRDesignElement elem = (JRDesignElement) jrChild;
if (elem.getKey() != null && elem.getKey().startsWith("variable_for_column_")) {
offset = elem.getY();
break;
}
}
return offset;
}
|
java
|
private int findYOffsetForGroupLabel(JRDesignBand band) {
int offset = 0;
for (JRChild jrChild : band.getChildren()) {
JRDesignElement elem = (JRDesignElement) jrChild;
if (elem.getKey() != null && elem.getKey().startsWith("variable_for_column_")) {
offset = elem.getY();
break;
}
}
return offset;
}
|
[
"private",
"int",
"findYOffsetForGroupLabel",
"(",
"JRDesignBand",
"band",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"JRChild",
"jrChild",
":",
"band",
".",
"getChildren",
"(",
")",
")",
"{",
"JRDesignElement",
"elem",
"=",
"(",
"JRDesignElement",
")",
"jrChild",
";",
"if",
"(",
"elem",
".",
"getKey",
"(",
")",
"!=",
"null",
"&&",
"elem",
".",
"getKey",
"(",
")",
".",
"startsWith",
"(",
"\"variable_for_column_\"",
")",
")",
"{",
"offset",
"=",
"elem",
".",
"getY",
"(",
")",
";",
"break",
";",
"}",
"}",
"return",
"offset",
";",
"}"
] |
Used to ensure that the general footer label will be at the same Y position as the variables in the band.
@param band
@return
|
[
"Used",
"to",
"ensure",
"that",
"the",
"general",
"footer",
"label",
"will",
"be",
"at",
"the",
"same",
"Y",
"position",
"as",
"the",
"variables",
"in",
"the",
"band",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L597-L607
|
159,281
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java
|
ClassicLayoutManager.layoutGroupSubreports
|
protected void layoutGroupSubreports(DJGroup columnsGroup, JRDesignGroup jgroup) {
log.debug("Starting subreport layout...");
JRDesignBand footerBand = (JRDesignBand) ((JRDesignSection)jgroup.getGroupFooterSection()).getBandsList().get(0);
JRDesignBand headerBand = (JRDesignBand) ((JRDesignSection)jgroup.getGroupHeaderSection()).getBandsList().get(0);
layOutSubReportInBand(columnsGroup, headerBand, DJConstants.HEADER);
layOutSubReportInBand(columnsGroup, footerBand, DJConstants.FOOTER);
}
|
java
|
protected void layoutGroupSubreports(DJGroup columnsGroup, JRDesignGroup jgroup) {
log.debug("Starting subreport layout...");
JRDesignBand footerBand = (JRDesignBand) ((JRDesignSection)jgroup.getGroupFooterSection()).getBandsList().get(0);
JRDesignBand headerBand = (JRDesignBand) ((JRDesignSection)jgroup.getGroupHeaderSection()).getBandsList().get(0);
layOutSubReportInBand(columnsGroup, headerBand, DJConstants.HEADER);
layOutSubReportInBand(columnsGroup, footerBand, DJConstants.FOOTER);
}
|
[
"protected",
"void",
"layoutGroupSubreports",
"(",
"DJGroup",
"columnsGroup",
",",
"JRDesignGroup",
"jgroup",
")",
"{",
"log",
".",
"debug",
"(",
"\"Starting subreport layout...\"",
")",
";",
"JRDesignBand",
"footerBand",
"=",
"(",
"JRDesignBand",
")",
"(",
"(",
"JRDesignSection",
")",
"jgroup",
".",
"getGroupFooterSection",
"(",
")",
")",
".",
"getBandsList",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"JRDesignBand",
"headerBand",
"=",
"(",
"JRDesignBand",
")",
"(",
"(",
"JRDesignSection",
")",
"jgroup",
".",
"getGroupHeaderSection",
"(",
")",
")",
".",
"getBandsList",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"layOutSubReportInBand",
"(",
"columnsGroup",
",",
"headerBand",
",",
"DJConstants",
".",
"HEADER",
")",
";",
"layOutSubReportInBand",
"(",
"columnsGroup",
",",
"footerBand",
",",
"DJConstants",
".",
"FOOTER",
")",
";",
"}"
] |
If there is a SubReport on a Group, we do the layout here
@param columnsGroup
@param jgroup
|
[
"If",
"there",
"is",
"a",
"SubReport",
"on",
"a",
"Group",
"we",
"do",
"the",
"layout",
"here"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L734-L742
|
159,282
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java
|
ClassicLayoutManager.sendPageBreakToBottom
|
protected void sendPageBreakToBottom(JRDesignBand band) {
JRElement[] elems = band.getElements();
JRElement aux = null;
for (JRElement elem : elems) {
if (("" + elem.getKey()).startsWith(PAGE_BREAK_FOR_)) {
aux = elem;
break;
}
}
if (aux != null)
((JRDesignElement)aux).setY(band.getHeight());
}
|
java
|
protected void sendPageBreakToBottom(JRDesignBand band) {
JRElement[] elems = band.getElements();
JRElement aux = null;
for (JRElement elem : elems) {
if (("" + elem.getKey()).startsWith(PAGE_BREAK_FOR_)) {
aux = elem;
break;
}
}
if (aux != null)
((JRDesignElement)aux).setY(band.getHeight());
}
|
[
"protected",
"void",
"sendPageBreakToBottom",
"(",
"JRDesignBand",
"band",
")",
"{",
"JRElement",
"[",
"]",
"elems",
"=",
"band",
".",
"getElements",
"(",
")",
";",
"JRElement",
"aux",
"=",
"null",
";",
"for",
"(",
"JRElement",
"elem",
":",
"elems",
")",
"{",
"if",
"(",
"(",
"\"\"",
"+",
"elem",
".",
"getKey",
"(",
")",
")",
".",
"startsWith",
"(",
"PAGE_BREAK_FOR_",
")",
")",
"{",
"aux",
"=",
"elem",
";",
"break",
";",
"}",
"}",
"if",
"(",
"aux",
"!=",
"null",
")",
"(",
"(",
"JRDesignElement",
")",
"aux",
")",
".",
"setY",
"(",
"band",
".",
"getHeight",
"(",
")",
")",
";",
"}"
] |
page breaks should be near the bottom of the band, this method used while adding subreports
which has the "start on new page" option.
@param band
|
[
"page",
"breaks",
"should",
"be",
"near",
"the",
"bottom",
"of",
"the",
"band",
"this",
"method",
"used",
"while",
"adding",
"subreports",
"which",
"has",
"the",
"start",
"on",
"new",
"page",
"option",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L864-L875
|
159,283
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java
|
CrosstabBuilder.build
|
public DJCrosstab build(){
if (crosstab.getMeasures().isEmpty()){
throw new LayoutException("Crosstabs must have at least one measure");
}
if (crosstab.getColumns().isEmpty()){
throw new LayoutException("Crosstabs must have at least one column");
}
if (crosstab.getRows().isEmpty()){
throw new LayoutException("Crosstabs must have at least one row");
}
//Ensure default dimension values
for (DJCrosstabColumn col : crosstab.getColumns()) {
if (col.getWidth() == -1 && cellWidth != -1)
col.setWidth(cellWidth);
if (col.getWidth() == -1 )
col.setWidth(DEFAULT_CELL_WIDTH);
if (col.getHeaderHeight() == -1 && columnHeaderHeight != -1)
col.setHeaderHeight(columnHeaderHeight);
if (col.getHeaderHeight() == -1)
col.setHeaderHeight(DEFAULT_COLUMN_HEADER_HEIGHT);
}
for (DJCrosstabRow row : crosstab.getRows()) {
if (row.getHeight() == -1 && cellHeight != -1)
row.setHeight(cellHeight);
if (row.getHeight() == -1 )
row.setHeight(DEFAULT_CELL_HEIGHT);
if (row.getHeaderWidth() == -1 && rowHeaderWidth != -1)
row.setHeaderWidth(rowHeaderWidth);
if (row.getHeaderWidth() == -1)
row.setHeaderWidth(DEFAULT_ROW_HEADER_WIDTH);
}
return crosstab;
}
|
java
|
public DJCrosstab build(){
if (crosstab.getMeasures().isEmpty()){
throw new LayoutException("Crosstabs must have at least one measure");
}
if (crosstab.getColumns().isEmpty()){
throw new LayoutException("Crosstabs must have at least one column");
}
if (crosstab.getRows().isEmpty()){
throw new LayoutException("Crosstabs must have at least one row");
}
//Ensure default dimension values
for (DJCrosstabColumn col : crosstab.getColumns()) {
if (col.getWidth() == -1 && cellWidth != -1)
col.setWidth(cellWidth);
if (col.getWidth() == -1 )
col.setWidth(DEFAULT_CELL_WIDTH);
if (col.getHeaderHeight() == -1 && columnHeaderHeight != -1)
col.setHeaderHeight(columnHeaderHeight);
if (col.getHeaderHeight() == -1)
col.setHeaderHeight(DEFAULT_COLUMN_HEADER_HEIGHT);
}
for (DJCrosstabRow row : crosstab.getRows()) {
if (row.getHeight() == -1 && cellHeight != -1)
row.setHeight(cellHeight);
if (row.getHeight() == -1 )
row.setHeight(DEFAULT_CELL_HEIGHT);
if (row.getHeaderWidth() == -1 && rowHeaderWidth != -1)
row.setHeaderWidth(rowHeaderWidth);
if (row.getHeaderWidth() == -1)
row.setHeaderWidth(DEFAULT_ROW_HEADER_WIDTH);
}
return crosstab;
}
|
[
"public",
"DJCrosstab",
"build",
"(",
")",
"{",
"if",
"(",
"crosstab",
".",
"getMeasures",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"LayoutException",
"(",
"\"Crosstabs must have at least one measure\"",
")",
";",
"}",
"if",
"(",
"crosstab",
".",
"getColumns",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"LayoutException",
"(",
"\"Crosstabs must have at least one column\"",
")",
";",
"}",
"if",
"(",
"crosstab",
".",
"getRows",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"LayoutException",
"(",
"\"Crosstabs must have at least one row\"",
")",
";",
"}",
"//Ensure default dimension values\r",
"for",
"(",
"DJCrosstabColumn",
"col",
":",
"crosstab",
".",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"col",
".",
"getWidth",
"(",
")",
"==",
"-",
"1",
"&&",
"cellWidth",
"!=",
"-",
"1",
")",
"col",
".",
"setWidth",
"(",
"cellWidth",
")",
";",
"if",
"(",
"col",
".",
"getWidth",
"(",
")",
"==",
"-",
"1",
")",
"col",
".",
"setWidth",
"(",
"DEFAULT_CELL_WIDTH",
")",
";",
"if",
"(",
"col",
".",
"getHeaderHeight",
"(",
")",
"==",
"-",
"1",
"&&",
"columnHeaderHeight",
"!=",
"-",
"1",
")",
"col",
".",
"setHeaderHeight",
"(",
"columnHeaderHeight",
")",
";",
"if",
"(",
"col",
".",
"getHeaderHeight",
"(",
")",
"==",
"-",
"1",
")",
"col",
".",
"setHeaderHeight",
"(",
"DEFAULT_COLUMN_HEADER_HEIGHT",
")",
";",
"}",
"for",
"(",
"DJCrosstabRow",
"row",
":",
"crosstab",
".",
"getRows",
"(",
")",
")",
"{",
"if",
"(",
"row",
".",
"getHeight",
"(",
")",
"==",
"-",
"1",
"&&",
"cellHeight",
"!=",
"-",
"1",
")",
"row",
".",
"setHeight",
"(",
"cellHeight",
")",
";",
"if",
"(",
"row",
".",
"getHeight",
"(",
")",
"==",
"-",
"1",
")",
"row",
".",
"setHeight",
"(",
"DEFAULT_CELL_HEIGHT",
")",
";",
"if",
"(",
"row",
".",
"getHeaderWidth",
"(",
")",
"==",
"-",
"1",
"&&",
"rowHeaderWidth",
"!=",
"-",
"1",
")",
"row",
".",
"setHeaderWidth",
"(",
"rowHeaderWidth",
")",
";",
"if",
"(",
"row",
".",
"getHeaderWidth",
"(",
")",
"==",
"-",
"1",
")",
"row",
".",
"setHeaderWidth",
"(",
"DEFAULT_ROW_HEADER_WIDTH",
")",
";",
"}",
"return",
"crosstab",
";",
"}"
] |
Build the crosstab. Throws LayoutException if anything is wrong
@return
|
[
"Build",
"the",
"crosstab",
".",
"Throws",
"LayoutException",
"if",
"anything",
"is",
"wrong"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L65-L107
|
159,284
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java
|
CrosstabBuilder.useMainReportDatasource
|
public CrosstabBuilder useMainReportDatasource(boolean preSorted) {
DJDataSource datasource = new DJDataSource("ds",DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE,DJConstants.DATA_SOURCE_TYPE_JRDATASOURCE);
datasource.setPreSorted(preSorted);
crosstab.setDatasource(datasource);
return this;
}
|
java
|
public CrosstabBuilder useMainReportDatasource(boolean preSorted) {
DJDataSource datasource = new DJDataSource("ds",DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE,DJConstants.DATA_SOURCE_TYPE_JRDATASOURCE);
datasource.setPreSorted(preSorted);
crosstab.setDatasource(datasource);
return this;
}
|
[
"public",
"CrosstabBuilder",
"useMainReportDatasource",
"(",
"boolean",
"preSorted",
")",
"{",
"DJDataSource",
"datasource",
"=",
"new",
"DJDataSource",
"(",
"\"ds\"",
",",
"DJConstants",
".",
"DATA_SOURCE_ORIGIN_REPORT_DATASOURCE",
",",
"DJConstants",
".",
"DATA_SOURCE_TYPE_JRDATASOURCE",
")",
";",
"datasource",
".",
"setPreSorted",
"(",
"preSorted",
")",
";",
"crosstab",
".",
"setDatasource",
"(",
"datasource",
")",
";",
"return",
"this",
";",
"}"
] |
To use main report datasource. There should be nothing else in the detail band
@param preSorted
@return
|
[
"To",
"use",
"main",
"report",
"datasource",
".",
"There",
"should",
"be",
"nothing",
"else",
"in",
"the",
"detail",
"band"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L148-L153
|
159,285
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java
|
CrosstabBuilder.addInvisibleMeasure
|
public CrosstabBuilder addInvisibleMeasure(String property, String className, String title) {
DJCrosstabMeasure measure = new DJCrosstabMeasure(property, className, DJCalculation.NOTHING, title);
measure.setVisible(false);
crosstab.getMeasures().add(measure);
return this;
}
|
java
|
public CrosstabBuilder addInvisibleMeasure(String property, String className, String title) {
DJCrosstabMeasure measure = new DJCrosstabMeasure(property, className, DJCalculation.NOTHING, title);
measure.setVisible(false);
crosstab.getMeasures().add(measure);
return this;
}
|
[
"public",
"CrosstabBuilder",
"addInvisibleMeasure",
"(",
"String",
"property",
",",
"String",
"className",
",",
"String",
"title",
")",
"{",
"DJCrosstabMeasure",
"measure",
"=",
"new",
"DJCrosstabMeasure",
"(",
"property",
",",
"className",
",",
"DJCalculation",
".",
"NOTHING",
",",
"title",
")",
";",
"measure",
".",
"setVisible",
"(",
"false",
")",
";",
"crosstab",
".",
"getMeasures",
"(",
")",
".",
"add",
"(",
"measure",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a measure to the crosstab. A crosstab can have many measures. DJ will lay out one measure above
the other.
A measure is what is shown on each intersection of a column and a row. A calculation is performed to
all occurrences in the datasource where the column and row values matches (between elements)
The only difference between the prior methods is that this method sets "visible" to false
@param property
@param className
@param title
@return
|
[
"Adds",
"a",
"measure",
"to",
"the",
"crosstab",
".",
"A",
"crosstab",
"can",
"have",
"many",
"measures",
".",
"DJ",
"will",
"lay",
"out",
"one",
"measure",
"above",
"the",
"other",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L216-L221
|
159,286
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java
|
CrosstabBuilder.setRowStyles
|
public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setRowHeaderStyle(headerStyle);
crosstab.setRowTotalheaderStyle(totalHeaderStyle);
crosstab.setRowTotalStyle(totalStyle);
return this;
}
|
java
|
public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setRowHeaderStyle(headerStyle);
crosstab.setRowTotalheaderStyle(totalHeaderStyle);
crosstab.setRowTotalStyle(totalStyle);
return this;
}
|
[
"public",
"CrosstabBuilder",
"setRowStyles",
"(",
"Style",
"headerStyle",
",",
"Style",
"totalStyle",
",",
"Style",
"totalHeaderStyle",
")",
"{",
"crosstab",
".",
"setRowHeaderStyle",
"(",
"headerStyle",
")",
";",
"crosstab",
".",
"setRowTotalheaderStyle",
"(",
"totalHeaderStyle",
")",
";",
"crosstab",
".",
"setRowTotalStyle",
"(",
"totalStyle",
")",
";",
"return",
"this",
";",
"}"
] |
Should be called after all rows have been created
@param headerStyle
@param totalStyle
@param totalHeaderStyle
@return
|
[
"Should",
"be",
"called",
"after",
"all",
"rows",
"have",
"been",
"created"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L385-L390
|
159,287
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java
|
CrosstabBuilder.setColumnStyles
|
public CrosstabBuilder setColumnStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setColumnHeaderStyle(headerStyle);
crosstab.setColumnTotalheaderStyle(totalHeaderStyle);
crosstab.setColumnTotalStyle(totalStyle);
return this;
}
|
java
|
public CrosstabBuilder setColumnStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setColumnHeaderStyle(headerStyle);
crosstab.setColumnTotalheaderStyle(totalHeaderStyle);
crosstab.setColumnTotalStyle(totalStyle);
return this;
}
|
[
"public",
"CrosstabBuilder",
"setColumnStyles",
"(",
"Style",
"headerStyle",
",",
"Style",
"totalStyle",
",",
"Style",
"totalHeaderStyle",
")",
"{",
"crosstab",
".",
"setColumnHeaderStyle",
"(",
"headerStyle",
")",
";",
"crosstab",
".",
"setColumnTotalheaderStyle",
"(",
"totalHeaderStyle",
")",
";",
"crosstab",
".",
"setColumnTotalStyle",
"(",
"totalStyle",
")",
";",
"return",
"this",
";",
"}"
] |
Should be called after all columns have been created
@param headerStyle
@param totalStyle
@param totalHeaderStyle
@return
|
[
"Should",
"be",
"called",
"after",
"all",
"columns",
"have",
"been",
"created"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L399-L404
|
159,288
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/FastReportBuilder.java
|
FastReportBuilder.addBarcodeColumn
|
public FastReportBuilder addBarcodeColumn(String title, String property,String className, int barcodeType,boolean showText, int width, boolean fixedWidth,ImageScaleMode imageScaleMode, Style style) throws ColumnBuilderException, ClassNotFoundException {
AbstractColumn column = ColumnBuilder.getNew()
.setColumnProperty(property, className)
.setWidth(width)
.setTitle(title)
.setFixedWidth(fixedWidth)
.setColumnType(ColumnBuilder.COLUMN_TYPE_BARCODE)
.setStyle(style)
.setBarcodeType(barcodeType)
.setShowText(showText)
.build();
if (style == null)
guessStyle(className, column);
addColumn(column);
return this;
}
|
java
|
public FastReportBuilder addBarcodeColumn(String title, String property,String className, int barcodeType,boolean showText, int width, boolean fixedWidth,ImageScaleMode imageScaleMode, Style style) throws ColumnBuilderException, ClassNotFoundException {
AbstractColumn column = ColumnBuilder.getNew()
.setColumnProperty(property, className)
.setWidth(width)
.setTitle(title)
.setFixedWidth(fixedWidth)
.setColumnType(ColumnBuilder.COLUMN_TYPE_BARCODE)
.setStyle(style)
.setBarcodeType(barcodeType)
.setShowText(showText)
.build();
if (style == null)
guessStyle(className, column);
addColumn(column);
return this;
}
|
[
"public",
"FastReportBuilder",
"addBarcodeColumn",
"(",
"String",
"title",
",",
"String",
"property",
",",
"String",
"className",
",",
"int",
"barcodeType",
",",
"boolean",
"showText",
",",
"int",
"width",
",",
"boolean",
"fixedWidth",
",",
"ImageScaleMode",
"imageScaleMode",
",",
"Style",
"style",
")",
"throws",
"ColumnBuilderException",
",",
"ClassNotFoundException",
"{",
"AbstractColumn",
"column",
"=",
"ColumnBuilder",
".",
"getNew",
"(",
")",
".",
"setColumnProperty",
"(",
"property",
",",
"className",
")",
".",
"setWidth",
"(",
"width",
")",
".",
"setTitle",
"(",
"title",
")",
".",
"setFixedWidth",
"(",
"fixedWidth",
")",
".",
"setColumnType",
"(",
"ColumnBuilder",
".",
"COLUMN_TYPE_BARCODE",
")",
".",
"setStyle",
"(",
"style",
")",
".",
"setBarcodeType",
"(",
"barcodeType",
")",
".",
"setShowText",
"(",
"showText",
")",
".",
"build",
"(",
")",
";",
"if",
"(",
"style",
"==",
"null",
")",
"guessStyle",
"(",
"className",
",",
"column",
")",
";",
"addColumn",
"(",
"column",
")",
";",
"return",
"this",
";",
"}"
] |
By default uses InputStream as the type of the image
@param title
@param property
@param width
@param fixedWidth
@param imageScaleMode
@param style
@return
@throws ColumnBuilderException
@throws ClassNotFoundException
|
[
"By",
"default",
"uses",
"InputStream",
"as",
"the",
"type",
"of",
"the",
"image"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/FastReportBuilder.java#L343-L361
|
159,289
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/FastReportBuilder.java
|
FastReportBuilder.addGroups
|
public FastReportBuilder addGroups(int numgroups) {
groupCount = numgroups;
for (int i = 0; i < groupCount; i++) {
GroupBuilder gb = new GroupBuilder();
PropertyColumn col = (PropertyColumn) report.getColumns().get(i);
gb.setCriteriaColumn(col);
report.getColumnsGroups().add(gb.build());
}
return this;
}
|
java
|
public FastReportBuilder addGroups(int numgroups) {
groupCount = numgroups;
for (int i = 0; i < groupCount; i++) {
GroupBuilder gb = new GroupBuilder();
PropertyColumn col = (PropertyColumn) report.getColumns().get(i);
gb.setCriteriaColumn(col);
report.getColumnsGroups().add(gb.build());
}
return this;
}
|
[
"public",
"FastReportBuilder",
"addGroups",
"(",
"int",
"numgroups",
")",
"{",
"groupCount",
"=",
"numgroups",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"groupCount",
";",
"i",
"++",
")",
"{",
"GroupBuilder",
"gb",
"=",
"new",
"GroupBuilder",
"(",
")",
";",
"PropertyColumn",
"col",
"=",
"(",
"PropertyColumn",
")",
"report",
".",
"getColumns",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"gb",
".",
"setCriteriaColumn",
"(",
"col",
")",
";",
"report",
".",
"getColumnsGroups",
"(",
")",
".",
"add",
"(",
"gb",
".",
"build",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
This method should be called after all column have been added to the report.
@param numgroups
@return
|
[
"This",
"method",
"should",
"be",
"called",
"after",
"all",
"column",
"have",
"been",
"added",
"to",
"the",
"report",
"."
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/FastReportBuilder.java#L519-L528
|
159,290
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/registration/ColumnRegistrationManager.java
|
ColumnRegistrationManager.transformEntity
|
protected Object transformEntity(Entity entity) {
PropertyColumn propertyColumn = (PropertyColumn) entity;
JRDesignField field = new JRDesignField();
ColumnProperty columnProperty = propertyColumn.getColumnProperty();
field.setName(columnProperty.getProperty());
field.setValueClassName(columnProperty.getValueClassName());
log.debug("Transforming column: " + propertyColumn.getName() + ", property: " + columnProperty.getProperty() + " (" + columnProperty.getValueClassName() +") " );
field.setDescription(propertyColumn.getFieldDescription()); //hack for XML data source
for (String key : columnProperty.getFieldProperties().keySet()) {
field.getPropertiesMap().setProperty(key, columnProperty.getFieldProperties().get(key));
}
return field;
}
|
java
|
protected Object transformEntity(Entity entity) {
PropertyColumn propertyColumn = (PropertyColumn) entity;
JRDesignField field = new JRDesignField();
ColumnProperty columnProperty = propertyColumn.getColumnProperty();
field.setName(columnProperty.getProperty());
field.setValueClassName(columnProperty.getValueClassName());
log.debug("Transforming column: " + propertyColumn.getName() + ", property: " + columnProperty.getProperty() + " (" + columnProperty.getValueClassName() +") " );
field.setDescription(propertyColumn.getFieldDescription()); //hack for XML data source
for (String key : columnProperty.getFieldProperties().keySet()) {
field.getPropertiesMap().setProperty(key, columnProperty.getFieldProperties().get(key));
}
return field;
}
|
[
"protected",
"Object",
"transformEntity",
"(",
"Entity",
"entity",
")",
"{",
"PropertyColumn",
"propertyColumn",
"=",
"(",
"PropertyColumn",
")",
"entity",
";",
"JRDesignField",
"field",
"=",
"new",
"JRDesignField",
"(",
")",
";",
"ColumnProperty",
"columnProperty",
"=",
"propertyColumn",
".",
"getColumnProperty",
"(",
")",
";",
"field",
".",
"setName",
"(",
"columnProperty",
".",
"getProperty",
"(",
")",
")",
";",
"field",
".",
"setValueClassName",
"(",
"columnProperty",
".",
"getValueClassName",
"(",
")",
")",
";",
"log",
".",
"debug",
"(",
"\"Transforming column: \"",
"+",
"propertyColumn",
".",
"getName",
"(",
")",
"+",
"\", property: \"",
"+",
"columnProperty",
".",
"getProperty",
"(",
")",
"+",
"\" (\"",
"+",
"columnProperty",
".",
"getValueClassName",
"(",
")",
"+",
"\") \"",
")",
";",
"field",
".",
"setDescription",
"(",
"propertyColumn",
".",
"getFieldDescription",
"(",
")",
")",
";",
"//hack for XML data source",
"for",
"(",
"String",
"key",
":",
"columnProperty",
".",
"getFieldProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"field",
".",
"getPropertiesMap",
"(",
")",
".",
"setProperty",
"(",
"key",
",",
"columnProperty",
".",
"getFieldProperties",
"(",
")",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"return",
"field",
";",
"}"
] |
Receives a PropertyColumn and returns a JRDesignField
|
[
"Receives",
"a",
"PropertyColumn",
"and",
"returns",
"a",
"JRDesignField"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/registration/ColumnRegistrationManager.java#L136-L150
|
159,291
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/entities/columns/PercentageColumn.java
|
PercentageColumn.getTextForExpression
|
public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {
return "new Double( $V{" + getReportName() + "_" + getGroupVariableName(childGroup) + "}.doubleValue() / $V{" + getReportName() + "_" + getGroupVariableName(type,group.getColumnToGroupBy().getColumnProperty().getProperty()) + "}.doubleValue())";
}
|
java
|
public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {
return "new Double( $V{" + getReportName() + "_" + getGroupVariableName(childGroup) + "}.doubleValue() / $V{" + getReportName() + "_" + getGroupVariableName(type,group.getColumnToGroupBy().getColumnProperty().getProperty()) + "}.doubleValue())";
}
|
[
"public",
"String",
"getTextForExpression",
"(",
"DJGroup",
"group",
",",
"DJGroup",
"childGroup",
",",
"String",
"type",
")",
"{",
"return",
"\"new Double( $V{\"",
"+",
"getReportName",
"(",
")",
"+",
"\"_\"",
"+",
"getGroupVariableName",
"(",
"childGroup",
")",
"+",
"\"}.doubleValue() / $V{\"",
"+",
"getReportName",
"(",
")",
"+",
"\"_\"",
"+",
"getGroupVariableName",
"(",
"type",
",",
"group",
".",
"getColumnToGroupBy",
"(",
")",
".",
"getColumnProperty",
"(",
")",
".",
"getProperty",
"(",
")",
")",
"+",
"\"}.doubleValue())\"",
";",
"}"
] |
Returns the formula for the percentage
@param group
@param type
@return
|
[
"Returns",
"the",
"formula",
"for",
"the",
"percentage"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/entities/columns/PercentageColumn.java#L32-L34
|
159,292
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/output/ReportWriterFactory.java
|
ReportWriterFactory.getReportWriter
|
public ReportWriter getReportWriter(final JasperPrint _jasperPrint, final String _format, final Map<JRExporterParameter,Object> _parameters) {
final JRExporter exporter = FormatInfoRegistry.getInstance().getExporter(_format);
exporter.setParameters(_parameters);
if (_jasperPrint.getPages().size() > PAGES_THRESHHOLD) {
return new FileReportWriter(_jasperPrint, exporter);
} else {
return new MemoryReportWriter(_jasperPrint, exporter);
}
}
|
java
|
public ReportWriter getReportWriter(final JasperPrint _jasperPrint, final String _format, final Map<JRExporterParameter,Object> _parameters) {
final JRExporter exporter = FormatInfoRegistry.getInstance().getExporter(_format);
exporter.setParameters(_parameters);
if (_jasperPrint.getPages().size() > PAGES_THRESHHOLD) {
return new FileReportWriter(_jasperPrint, exporter);
} else {
return new MemoryReportWriter(_jasperPrint, exporter);
}
}
|
[
"public",
"ReportWriter",
"getReportWriter",
"(",
"final",
"JasperPrint",
"_jasperPrint",
",",
"final",
"String",
"_format",
",",
"final",
"Map",
"<",
"JRExporterParameter",
",",
"Object",
">",
"_parameters",
")",
"{",
"final",
"JRExporter",
"exporter",
"=",
"FormatInfoRegistry",
".",
"getInstance",
"(",
")",
".",
"getExporter",
"(",
"_format",
")",
";",
"exporter",
".",
"setParameters",
"(",
"_parameters",
")",
";",
"if",
"(",
"_jasperPrint",
".",
"getPages",
"(",
")",
".",
"size",
"(",
")",
">",
"PAGES_THRESHHOLD",
")",
"{",
"return",
"new",
"FileReportWriter",
"(",
"_jasperPrint",
",",
"exporter",
")",
";",
"}",
"else",
"{",
"return",
"new",
"MemoryReportWriter",
"(",
"_jasperPrint",
",",
"exporter",
")",
";",
"}",
"}"
] |
Returns a ReportWriter that which will use memory or a file depending on the parameter PAGES_THRESHOLD
@param _jasperPrint
@param _format
@param _parameters
@return
|
[
"Returns",
"a",
"ReportWriter",
"that",
"which",
"will",
"use",
"memory",
"or",
"a",
"file",
"depending",
"on",
"the",
"parameter",
"PAGES_THRESHOLD"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/output/ReportWriterFactory.java#L64-L73
|
159,293
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/core/layout/HorizontalBandAlignment.java
|
HorizontalBandAlignment.buildAligment
|
public static HorizontalBandAlignment buildAligment(byte aligment){
if (aligment == RIGHT.getAlignment())
return RIGHT;
else if (aligment == LEFT.getAlignment())
return LEFT;
else if (aligment == CENTER.getAlignment())
return CENTER;
return LEFT;
}
|
java
|
public static HorizontalBandAlignment buildAligment(byte aligment){
if (aligment == RIGHT.getAlignment())
return RIGHT;
else if (aligment == LEFT.getAlignment())
return LEFT;
else if (aligment == CENTER.getAlignment())
return CENTER;
return LEFT;
}
|
[
"public",
"static",
"HorizontalBandAlignment",
"buildAligment",
"(",
"byte",
"aligment",
")",
"{",
"if",
"(",
"aligment",
"==",
"RIGHT",
".",
"getAlignment",
"(",
")",
")",
"return",
"RIGHT",
";",
"else",
"if",
"(",
"aligment",
"==",
"LEFT",
".",
"getAlignment",
"(",
")",
")",
"return",
"LEFT",
";",
"else",
"if",
"(",
"aligment",
"==",
"CENTER",
".",
"getAlignment",
"(",
")",
")",
"return",
"CENTER",
";",
"return",
"LEFT",
";",
"}"
] |
To be used with AutoText class constants ALIGMENT_LEFT, ALIGMENT_CENTER and ALIGMENT_RIGHT
@param aligment
@return
|
[
"To",
"be",
"used",
"with",
"AutoText",
"class",
"constants",
"ALIGMENT_LEFT",
"ALIGMENT_CENTER",
"and",
"ALIGMENT_RIGHT"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/HorizontalBandAlignment.java#L47-L56
|
159,294
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/webwork/DJResult.java
|
DJResult.getParametersMap
|
protected Map getParametersMap(ActionInvocation _invocation) {
Map map = (Map) _invocation.getStack().findValue(this.parameters);
if (map == null)
map = new HashMap();
return map;
}
|
java
|
protected Map getParametersMap(ActionInvocation _invocation) {
Map map = (Map) _invocation.getStack().findValue(this.parameters);
if (map == null)
map = new HashMap();
return map;
}
|
[
"protected",
"Map",
"getParametersMap",
"(",
"ActionInvocation",
"_invocation",
")",
"{",
"Map",
"map",
"=",
"(",
"Map",
")",
"_invocation",
".",
"getStack",
"(",
")",
".",
"findValue",
"(",
"this",
".",
"parameters",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"map",
"=",
"new",
"HashMap",
"(",
")",
";",
"return",
"map",
";",
"}"
] |
Returns the object pointed by the result-type parameter "parameters"
@param _invocation
@return
|
[
"Returns",
"the",
"object",
"pointed",
"by",
"the",
"result",
"-",
"type",
"parameter",
"parameters"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/webwork/DJResult.java#L146-L151
|
159,295
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/webwork/DJResult.java
|
DJResult.getLayOutManagerObj
|
protected LayoutManager getLayOutManagerObj(ActionInvocation _invocation) {
if (layoutManager == null || "".equals(layoutManager)){
LOG.warn("No valid LayoutManager, using ClassicLayoutManager");
return new ClassicLayoutManager();
}
Object los = conditionalParse(layoutManager, _invocation);
if (los instanceof LayoutManager){
return (LayoutManager) los;
}
LayoutManager lo = null;
if (los instanceof String){
if (LAYOUT_CLASSIC.equalsIgnoreCase((String) los))
lo = new ClassicLayoutManager();
else if (LAYOUT_LIST.equalsIgnoreCase((String) los))
lo = new ListLayoutManager();
else {
try {
lo = (LayoutManager) Class.forName((String) los).newInstance();
} catch (Exception e) {
LOG.warn("No valid LayoutManager: " + e.getMessage(),e);
}
}
}
return lo;
}
|
java
|
protected LayoutManager getLayOutManagerObj(ActionInvocation _invocation) {
if (layoutManager == null || "".equals(layoutManager)){
LOG.warn("No valid LayoutManager, using ClassicLayoutManager");
return new ClassicLayoutManager();
}
Object los = conditionalParse(layoutManager, _invocation);
if (los instanceof LayoutManager){
return (LayoutManager) los;
}
LayoutManager lo = null;
if (los instanceof String){
if (LAYOUT_CLASSIC.equalsIgnoreCase((String) los))
lo = new ClassicLayoutManager();
else if (LAYOUT_LIST.equalsIgnoreCase((String) los))
lo = new ListLayoutManager();
else {
try {
lo = (LayoutManager) Class.forName((String) los).newInstance();
} catch (Exception e) {
LOG.warn("No valid LayoutManager: " + e.getMessage(),e);
}
}
}
return lo;
}
|
[
"protected",
"LayoutManager",
"getLayOutManagerObj",
"(",
"ActionInvocation",
"_invocation",
")",
"{",
"if",
"(",
"layoutManager",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"layoutManager",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"No valid LayoutManager, using ClassicLayoutManager\"",
")",
";",
"return",
"new",
"ClassicLayoutManager",
"(",
")",
";",
"}",
"Object",
"los",
"=",
"conditionalParse",
"(",
"layoutManager",
",",
"_invocation",
")",
";",
"if",
"(",
"los",
"instanceof",
"LayoutManager",
")",
"{",
"return",
"(",
"LayoutManager",
")",
"los",
";",
"}",
"LayoutManager",
"lo",
"=",
"null",
";",
"if",
"(",
"los",
"instanceof",
"String",
")",
"{",
"if",
"(",
"LAYOUT_CLASSIC",
".",
"equalsIgnoreCase",
"(",
"(",
"String",
")",
"los",
")",
")",
"lo",
"=",
"new",
"ClassicLayoutManager",
"(",
")",
";",
"else",
"if",
"(",
"LAYOUT_LIST",
".",
"equalsIgnoreCase",
"(",
"(",
"String",
")",
"los",
")",
")",
"lo",
"=",
"new",
"ListLayoutManager",
"(",
")",
";",
"else",
"{",
"try",
"{",
"lo",
"=",
"(",
"LayoutManager",
")",
"Class",
".",
"forName",
"(",
"(",
"String",
")",
"los",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"No valid LayoutManager: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"lo",
";",
"}"
] |
Returns the export format indicated in the result-type parameter "layoutManager"
@param _invocation
@return
|
[
"Returns",
"the",
"export",
"format",
"indicated",
"in",
"the",
"result",
"-",
"type",
"parameter",
"layoutManager"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/webwork/DJResult.java#L185-L213
|
159,296
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java
|
ColumnBuilder.buildSimpleBarcodeColumn
|
protected AbstractColumn buildSimpleBarcodeColumn() {
BarCodeColumn column = new BarCodeColumn();
populateCommonAttributes(column);
column.setColumnProperty(columnProperty);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setScaleMode(imageScaleMode);
column.setApplicationIdentifier(applicationIdentifier);
column.setBarcodeType(barcodeType);
column.setShowText(showText);
column.setCheckSum(checkSum);
return column;
}
|
java
|
protected AbstractColumn buildSimpleBarcodeColumn() {
BarCodeColumn column = new BarCodeColumn();
populateCommonAttributes(column);
column.setColumnProperty(columnProperty);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setScaleMode(imageScaleMode);
column.setApplicationIdentifier(applicationIdentifier);
column.setBarcodeType(barcodeType);
column.setShowText(showText);
column.setCheckSum(checkSum);
return column;
}
|
[
"protected",
"AbstractColumn",
"buildSimpleBarcodeColumn",
"(",
")",
"{",
"BarCodeColumn",
"column",
"=",
"new",
"BarCodeColumn",
"(",
")",
";",
"populateCommonAttributes",
"(",
"column",
")",
";",
"column",
".",
"setColumnProperty",
"(",
"columnProperty",
")",
";",
"column",
".",
"setExpressionToGroupBy",
"(",
"customExpressionToGroupBy",
")",
";",
"column",
".",
"setScaleMode",
"(",
"imageScaleMode",
")",
";",
"column",
".",
"setApplicationIdentifier",
"(",
"applicationIdentifier",
")",
";",
"column",
".",
"setBarcodeType",
"(",
"barcodeType",
")",
";",
"column",
".",
"setShowText",
"(",
"showText",
")",
";",
"column",
".",
"setCheckSum",
"(",
"checkSum",
")",
";",
"return",
"column",
";",
"}"
] |
When creating barcode columns
@return
|
[
"When",
"creating",
"barcode",
"columns"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java#L161-L172
|
159,297
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java
|
ColumnBuilder.buildSimpleImageColumn
|
protected AbstractColumn buildSimpleImageColumn() {
ImageColumn column = new ImageColumn();
populateCommonAttributes(column);
populateExpressionAttributes(column);
column.setExpression(customExpression);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setExpressionForCalculation(customExpressionForCalculation);
column.setScaleMode(imageScaleMode);
return column;
}
|
java
|
protected AbstractColumn buildSimpleImageColumn() {
ImageColumn column = new ImageColumn();
populateCommonAttributes(column);
populateExpressionAttributes(column);
column.setExpression(customExpression);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setExpressionForCalculation(customExpressionForCalculation);
column.setScaleMode(imageScaleMode);
return column;
}
|
[
"protected",
"AbstractColumn",
"buildSimpleImageColumn",
"(",
")",
"{",
"ImageColumn",
"column",
"=",
"new",
"ImageColumn",
"(",
")",
";",
"populateCommonAttributes",
"(",
"column",
")",
";",
"populateExpressionAttributes",
"(",
"column",
")",
";",
"column",
".",
"setExpression",
"(",
"customExpression",
")",
";",
"column",
".",
"setExpressionToGroupBy",
"(",
"customExpressionToGroupBy",
")",
";",
"column",
".",
"setExpressionForCalculation",
"(",
"customExpressionForCalculation",
")",
";",
"column",
".",
"setScaleMode",
"(",
"imageScaleMode",
")",
";",
"return",
"column",
";",
"}"
] |
When creating image columns
@return
|
[
"When",
"creating",
"image",
"columns"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java#L178-L189
|
159,298
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java
|
ColumnBuilder.buildExpressionColumn
|
protected AbstractColumn buildExpressionColumn() {
ExpressionColumn column = new ExpressionColumn();
populateCommonAttributes(column);
populateExpressionAttributes(column);
column.setExpression(customExpression);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setExpressionForCalculation(customExpressionForCalculation);
return column;
}
|
java
|
protected AbstractColumn buildExpressionColumn() {
ExpressionColumn column = new ExpressionColumn();
populateCommonAttributes(column);
populateExpressionAttributes(column);
column.setExpression(customExpression);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setExpressionForCalculation(customExpressionForCalculation);
return column;
}
|
[
"protected",
"AbstractColumn",
"buildExpressionColumn",
"(",
")",
"{",
"ExpressionColumn",
"column",
"=",
"new",
"ExpressionColumn",
"(",
")",
";",
"populateCommonAttributes",
"(",
"column",
")",
";",
"populateExpressionAttributes",
"(",
"column",
")",
";",
"column",
".",
"setExpression",
"(",
"customExpression",
")",
";",
"column",
".",
"setExpressionToGroupBy",
"(",
"customExpressionToGroupBy",
")",
";",
"column",
".",
"setExpressionForCalculation",
"(",
"customExpressionForCalculation",
")",
";",
"return",
"column",
";",
"}"
] |
For creating expression columns
@return
|
[
"For",
"creating",
"expression",
"columns"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java#L195-L206
|
159,299
|
intive-FDV/DynamicJasper
|
src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java
|
ColumnBuilder.buildSimpleColumn
|
protected AbstractColumn buildSimpleColumn() {
SimpleColumn column = new SimpleColumn();
populateCommonAttributes(column);
columnProperty.getFieldProperties().putAll(fieldProperties);
column.setColumnProperty(columnProperty);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setFieldDescription(fieldDescription);
return column;
}
|
java
|
protected AbstractColumn buildSimpleColumn() {
SimpleColumn column = new SimpleColumn();
populateCommonAttributes(column);
columnProperty.getFieldProperties().putAll(fieldProperties);
column.setColumnProperty(columnProperty);
column.setExpressionToGroupBy(customExpressionToGroupBy);
column.setFieldDescription(fieldDescription);
return column;
}
|
[
"protected",
"AbstractColumn",
"buildSimpleColumn",
"(",
")",
"{",
"SimpleColumn",
"column",
"=",
"new",
"SimpleColumn",
"(",
")",
";",
"populateCommonAttributes",
"(",
"column",
")",
";",
"columnProperty",
".",
"getFieldProperties",
"(",
")",
".",
"putAll",
"(",
"fieldProperties",
")",
";",
"column",
".",
"setColumnProperty",
"(",
"columnProperty",
")",
";",
"column",
".",
"setExpressionToGroupBy",
"(",
"customExpressionToGroupBy",
")",
";",
"column",
".",
"setFieldDescription",
"(",
"fieldDescription",
")",
";",
"return",
"column",
";",
"}"
] |
For creating regular columns
@return
|
[
"For",
"creating",
"regular",
"columns"
] |
63919574cc401ae40574d13129f628e66d1682a3
|
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java#L234-L242
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.