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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java | RamlHelper.getFirstAuthorizationGrant | public static String getFirstAuthorizationGrant(RamlAction action, RamlRoot document) {
List<String> grants = getAuthorizationGrants(action, document);
if (grants.isEmpty()) {
return null;
}
return grants.get(0);
} | java | public static String getFirstAuthorizationGrant(RamlAction action, RamlRoot document) {
List<String> grants = getAuthorizationGrants(action, document);
if (grants.isEmpty()) {
return null;
}
return grants.get(0);
} | [
"public",
"static",
"String",
"getFirstAuthorizationGrant",
"(",
"RamlAction",
"action",
",",
"RamlRoot",
"document",
")",
"{",
"List",
"<",
"String",
">",
"grants",
"=",
"getAuthorizationGrants",
"(",
"action",
",",
"document",
")",
";",
"if",
"(",
"grants",
... | Returns authorization grant for provided action. It searches for
authorization grants defined for provided action, some of parent
resources or the root of the document. If authorization grants found is a
list - the method will return the first grant in the list.
@param action
action to find grant for
@param document
root raml document
@return first grant found, null otherwise | [
"Returns",
"authorization",
"grant",
"for",
"provided",
"action",
".",
"It",
"searches",
"for",
"authorization",
"grants",
"defined",
"for",
"provided",
"action",
"some",
"of",
"parent",
"resources",
"or",
"the",
"root",
"of",
"the",
"document",
".",
"If",
"au... | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java#L63-L69 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java | RamlHelper.removeDuplicates | public static List<String> removeDuplicates(List<String> list) {
return list.stream().distinct().collect(Collectors.toList());
} | java | public static List<String> removeDuplicates(List<String> list) {
return list.stream().distinct().collect(Collectors.toList());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"removeDuplicates",
"(",
"List",
"<",
"String",
">",
"list",
")",
"{",
"return",
"list",
".",
"stream",
"(",
")",
".",
"distinct",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
"... | Remove duplicates from provided list.
@param list
list with duplicates
@return list without duplicates | [
"Remove",
"duplicates",
"from",
"provided",
"list",
"."
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java#L118-L120 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java | RamlTypeHelper.getFormat | public static String getFormat(TypeDeclaration param) {
if (param == null) {
return null;
}
if (param instanceof NumberTypeDeclaration) {
return ((NumberTypeDeclaration) param).format();
}
if (param instanceof DateTimeTypeDeclaration) {
return ((DateTimeTypeDeclaration) param).format();
}
return null;
} | java | public static String getFormat(TypeDeclaration param) {
if (param == null) {
return null;
}
if (param instanceof NumberTypeDeclaration) {
return ((NumberTypeDeclaration) param).format();
}
if (param instanceof DateTimeTypeDeclaration) {
return ((DateTimeTypeDeclaration) param).format();
}
return null;
} | [
"public",
"static",
"String",
"getFormat",
"(",
"TypeDeclaration",
"param",
")",
"{",
"if",
"(",
"param",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"param",
"instanceof",
"NumberTypeDeclaration",
")",
"{",
"return",
"(",
"(",
"NumberTy... | IF it has a format defined, this will return it
@param param
The parameter to inspect
@return Format, if defined | [
"IF",
"it",
"has",
"a",
"format",
"defined",
"this",
"will",
"return",
"it"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java#L59-L71 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java | RamlTypeHelper.getDescription | public static String getDescription(TypeDeclaration type) {
if (type == null || type.description() == null) {
return null;
} else {
return type.description().value();
}
} | java | public static String getDescription(TypeDeclaration type) {
if (type == null || type.description() == null) {
return null;
} else {
return type.description().value();
}
} | [
"public",
"static",
"String",
"getDescription",
"(",
"TypeDeclaration",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"description",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".... | Safely get description from a type with null checks
@param type
The RAML TypeDeclaration to check
@return The description if defined or null if empty | [
"Safely",
"get",
"description",
"from",
"a",
"type",
"with",
"null",
"checks"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java#L152-L158 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java | RamlTypeHelper.getExample | public static String getExample(TypeDeclaration type) {
if (type == null || type.example() == null) {
return null;
} else {
return type.example().value();
}
} | java | public static String getExample(TypeDeclaration type) {
if (type == null || type.example() == null) {
return null;
} else {
return type.example().value();
}
} | [
"public",
"static",
"String",
"getExample",
"(",
"TypeDeclaration",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"example",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".",
"ex... | Safely get example from a type with null checks
@param type
The RAML TypeDeclaration to check
@return The example if defined or null if empty | [
"Safely",
"get",
"example",
"from",
"a",
"type",
"with",
"null",
"checks"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java#L167-L173 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java | RamlTypeHelper.getDisplayName | public static String getDisplayName(TypeDeclaration type) {
if (type == null || type.displayName() == null) {
return null;
} else {
return type.displayName().value();
}
} | java | public static String getDisplayName(TypeDeclaration type) {
if (type == null || type.displayName() == null) {
return null;
} else {
return type.displayName().value();
}
} | [
"public",
"static",
"String",
"getDisplayName",
"(",
"TypeDeclaration",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"displayName",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".... | Safely get Display name from a type with null checks
@param type
The RAML TypeDeclaration to check
@return The display name if defined or null if empty | [
"Safely",
"get",
"Display",
"name",
"from",
"a",
"type",
"with",
"null",
"checks"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java#L182-L188 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java | RamlTypeHelper.isRequired | public static boolean isRequired(TypeDeclaration type) {
if (type == null || type.required() == null) {
return true;
} else {
return type.required();
}
} | java | public static boolean isRequired(TypeDeclaration type) {
if (type == null || type.required() == null) {
return true;
} else {
return type.required();
}
} | [
"public",
"static",
"boolean",
"isRequired",
"(",
"TypeDeclaration",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"required",
"(",
")",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"type",
".",
"... | Safely get required from a type with null checks
@param type
The RAML TypeDeclaration to check
@return true if this parameter is required, false if optional | [
"Safely",
"get",
"required",
"from",
"a",
"type",
"with",
"null",
"checks"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java#L212-L218 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/data/ApiParameterMetadata.java | ApiParameterMetadata.isArray | public boolean isArray() {
if (type == null) {
return false;
}
return type.isArray() || List.class.isAssignableFrom(type) || Set.class.isAssignableFrom(type);
} | java | public boolean isArray() {
if (type == null) {
return false;
}
return type.isArray() || List.class.isAssignableFrom(type) || Set.class.isAssignableFrom(type);
} | [
"public",
"boolean",
"isArray",
"(",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"type",
".",
"isArray",
"(",
")",
"||",
"List",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
"||",
"Set",
"... | Quick check to see if this is an array type or not
@return true if this is an array/list or false if it's a single object | [
"Quick",
"check",
"to",
"see",
"if",
"this",
"is",
"an",
"array",
"type",
"or",
"not"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/data/ApiParameterMetadata.java#L202-L207 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.convertContentTypeToQualifier | public static String convertContentTypeToQualifier(String contentType) {
// lets start off simple since qualifers are better if they are simple
// :)
// if we have simple standard types lets add some heuristics
if (contentType.equals(MediaType.APPLICATION_JSON_VALUE)) {
return "AsJson";
}
if (contentType.equals(MediaType.APPLICATION_OCTET_STREAM_VALUE)) {
return "AsBinary";
}
if (contentType.equals(MediaType.TEXT_PLAIN_VALUE) || contentType.equals(MediaType.TEXT_HTML_VALUE)) {
return "AsText";
}
// we have a non standard type. lets see if we have a version
Matcher versionMatcher = CONTENT_TYPE_VERSION.matcher(contentType);
if (versionMatcher.find()) {
String version = versionMatcher.group(1);
if (version != null) {
return StringUtils.capitalize(version).replace(".", "_");
}
}
// if we got here we have some sort of funky content type. deal with it
int seperatorIndex = contentType.indexOf("/");
if (seperatorIndex != -1 && seperatorIndex < contentType.length()) {
String candidate = contentType.substring(seperatorIndex + 1).toLowerCase();
String out = "";
if (candidate.contains("json")) {
candidate = candidate.replace("json", "");
out += "AsJson";
}
candidate = StringUtils.deleteAny(candidate, " ,.+=-'\"\\|~`#$%^&\n\t");
if (StringUtils.hasText(candidate)) {
out = StringUtils.capitalize(candidate) + out;
}
return "_" + out;
}
return "";
} | java | public static String convertContentTypeToQualifier(String contentType) {
// lets start off simple since qualifers are better if they are simple
// :)
// if we have simple standard types lets add some heuristics
if (contentType.equals(MediaType.APPLICATION_JSON_VALUE)) {
return "AsJson";
}
if (contentType.equals(MediaType.APPLICATION_OCTET_STREAM_VALUE)) {
return "AsBinary";
}
if (contentType.equals(MediaType.TEXT_PLAIN_VALUE) || contentType.equals(MediaType.TEXT_HTML_VALUE)) {
return "AsText";
}
// we have a non standard type. lets see if we have a version
Matcher versionMatcher = CONTENT_TYPE_VERSION.matcher(contentType);
if (versionMatcher.find()) {
String version = versionMatcher.group(1);
if (version != null) {
return StringUtils.capitalize(version).replace(".", "_");
}
}
// if we got here we have some sort of funky content type. deal with it
int seperatorIndex = contentType.indexOf("/");
if (seperatorIndex != -1 && seperatorIndex < contentType.length()) {
String candidate = contentType.substring(seperatorIndex + 1).toLowerCase();
String out = "";
if (candidate.contains("json")) {
candidate = candidate.replace("json", "");
out += "AsJson";
}
candidate = StringUtils.deleteAny(candidate, " ,.+=-'\"\\|~`#$%^&\n\t");
if (StringUtils.hasText(candidate)) {
out = StringUtils.capitalize(candidate) + out;
}
return "_" + out;
}
return "";
} | [
"public",
"static",
"String",
"convertContentTypeToQualifier",
"(",
"String",
"contentType",
")",
"{",
"// lets start off simple since qualifers are better if they are simple",
"// :)",
"// if we have simple standard types lets add some heuristics",
"if",
"(",
"contentType",
".",
"eq... | Converts an http contentType into a qualifier that can be used within a
Java method
@param contentType
The content type to convert application/json
@return qualifier, example V1Html | [
"Converts",
"an",
"http",
"contentType",
"into",
"a",
"qualifier",
"that",
"can",
"be",
"used",
"within",
"a",
"Java",
"method"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L89-L132 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.extractUriParams | public static List<String> extractUriParams(String url) {
List<String> outParams = new ArrayList<>();
if (StringUtils.hasText(url)) {
String[] split = StringUtils.split(url, "/");
for (String part : split) {
int indexOfStart = part.indexOf("{");
int indexOfEnd = part.indexOf("}");
if (indexOfStart != -1 && indexOfEnd != -1 && indexOfStart < indexOfEnd) {
outParams.add(part.substring(indexOfStart + 1, indexOfEnd));
}
}
}
return outParams;
} | java | public static List<String> extractUriParams(String url) {
List<String> outParams = new ArrayList<>();
if (StringUtils.hasText(url)) {
String[] split = StringUtils.split(url, "/");
for (String part : split) {
int indexOfStart = part.indexOf("{");
int indexOfEnd = part.indexOf("}");
if (indexOfStart != -1 && indexOfEnd != -1 && indexOfStart < indexOfEnd) {
outParams.add(part.substring(indexOfStart + 1, indexOfEnd));
}
}
}
return outParams;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"extractUriParams",
"(",
"String",
"url",
")",
"{",
"List",
"<",
"String",
">",
"outParams",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"url",
")",
")",
... | Extracts a list of URI Parameters from a url
@param url
String to extract parameters from
@return A list of the uri parameters in this URL | [
"Extracts",
"a",
"list",
"of",
"URI",
"Parameters",
"from",
"a",
"url"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L141-L155 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.isValidJavaClassName | public static boolean isValidJavaClassName(String input) {
if (!StringUtils.hasText(input)) {
return false;
}
if (!Character.isJavaIdentifierStart(input.charAt(0))) {
return false;
}
if (input.length() > 1) {
for (int i = 1; i < input.length(); i++) {
if (!Character.isJavaIdentifierPart(input.charAt(i))) {
return false;
}
}
}
return true;
} | java | public static boolean isValidJavaClassName(String input) {
if (!StringUtils.hasText(input)) {
return false;
}
if (!Character.isJavaIdentifierStart(input.charAt(0))) {
return false;
}
if (input.length() > 1) {
for (int i = 1; i < input.length(); i++) {
if (!Character.isJavaIdentifierPart(input.charAt(i))) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"isValidJavaClassName",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"input",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"Character",
".",
"isJavaIdentifierStart",
"("... | Utility method to check if a string can be used as a valid class name
@param input
String to check
@return true if valid | [
"Utility",
"method",
"to",
"check",
"if",
"a",
"string",
"can",
"be",
"used",
"as",
"a",
"valid",
"class",
"name"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L164-L179 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.getAllResourcesNames | public static String getAllResourcesNames(String url, boolean singularize) {
StringBuilder stringBuilder = new StringBuilder();
if (StringUtils.hasText(url)) {
String[] resources = SLASH.split(url);
int lengthCounter = 0;
for (int i = resources.length - 1; i >= Config.getResourceTopLevelInClassNames() + 1; --i) {
if (StringUtils.hasText(resources[i])) {
String resourceName = getResourceName(resources[i], singularize);
if (Config.isReverseOrderInClassNames()) {
stringBuilder.append(resourceName);
} else {
stringBuilder.insert(0, resourceName);
}
++lengthCounter;
}
if (Config.getResourceDepthInClassNames() > 0 && lengthCounter >= Config.getResourceDepthInClassNames()) {
break;
}
}
}
return stringBuilder.toString();
} | java | public static String getAllResourcesNames(String url, boolean singularize) {
StringBuilder stringBuilder = new StringBuilder();
if (StringUtils.hasText(url)) {
String[] resources = SLASH.split(url);
int lengthCounter = 0;
for (int i = resources.length - 1; i >= Config.getResourceTopLevelInClassNames() + 1; --i) {
if (StringUtils.hasText(resources[i])) {
String resourceName = getResourceName(resources[i], singularize);
if (Config.isReverseOrderInClassNames()) {
stringBuilder.append(resourceName);
} else {
stringBuilder.insert(0, resourceName);
}
++lengthCounter;
}
if (Config.getResourceDepthInClassNames() > 0 && lengthCounter >= Config.getResourceDepthInClassNames()) {
break;
}
}
}
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"getAllResourcesNames",
"(",
"String",
"url",
",",
"boolean",
"singularize",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"url",
")",
")",
... | Attempts to infer the name of a resource from a resources's full URL.
@param url
The URL of the raml resource being parsed
@param singularize
Indicates if the resource name should be singularized or not
@return name of a resource | [
"Attempts",
"to",
"infer",
"the",
"name",
"of",
"a",
"resource",
"from",
"a",
"resources",
"s",
"full",
"URL",
"."
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L261-L284 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.singularize | public static String singularize(String target) {
// TODO we should add this as an issue in the RamlBase project and
// provide a pull request
String result = Inflector.singularize(target);
if ((target.endsWith("ss")) && (result.equals(target.substring(0, target.length() - 1)))) {
result = target;
}
return result;
} | java | public static String singularize(String target) {
// TODO we should add this as an issue in the RamlBase project and
// provide a pull request
String result = Inflector.singularize(target);
if ((target.endsWith("ss")) && (result.equals(target.substring(0, target.length() - 1)))) {
result = target;
}
return result;
} | [
"public",
"static",
"String",
"singularize",
"(",
"String",
"target",
")",
"{",
"// TODO we should add this as an issue in the RamlBase project and",
"// provide a pull request",
"String",
"result",
"=",
"Inflector",
".",
"singularize",
"(",
"target",
")",
";",
"if",
"(",... | Singularises a string. uses underlying raml parser system
@param target
name to singularize
@return singularized name | [
"Singularises",
"a",
"string",
".",
"uses",
"underlying",
"raml",
"parser",
"system"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L316-L324 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.cleanNameForJavaEnum | public static String cleanNameForJavaEnum(String enumConstant) {
if (!StringUtils.hasText(enumConstant)) {
return enumConstant;
}
List<String> nameGroups = new ArrayList<>(asList(splitByCharacterTypeCamelCase(enumConstant)));
nameGroups.removeIf(s -> containsOnly(s.replaceAll(ILLEGAL_CHARACTER_REGEX, "_"), "_"));
String enumName = upperCase(join(nameGroups, "_"));
if (isEmpty(enumName)) {
enumName = "_DEFAULT_";
} else if (Character.isDigit(enumName.charAt(0))) {
enumName = "_" + enumName;
}
return filterKeywords(enumName);
} | java | public static String cleanNameForJavaEnum(String enumConstant) {
if (!StringUtils.hasText(enumConstant)) {
return enumConstant;
}
List<String> nameGroups = new ArrayList<>(asList(splitByCharacterTypeCamelCase(enumConstant)));
nameGroups.removeIf(s -> containsOnly(s.replaceAll(ILLEGAL_CHARACTER_REGEX, "_"), "_"));
String enumName = upperCase(join(nameGroups, "_"));
if (isEmpty(enumName)) {
enumName = "_DEFAULT_";
} else if (Character.isDigit(enumName.charAt(0))) {
enumName = "_" + enumName;
}
return filterKeywords(enumName);
} | [
"public",
"static",
"String",
"cleanNameForJavaEnum",
"(",
"String",
"enumConstant",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"enumConstant",
")",
")",
"{",
"return",
"enumConstant",
";",
"}",
"List",
"<",
"String",
">",
"nameGroups",
"=... | Cleans a string with characters that are not valid as a java identifier
enum
@param enumConstant
The string to clean
@return cleaned string | [
"Cleans",
"a",
"string",
"with",
"characters",
"that",
"are",
"not",
"valid",
"as",
"a",
"java",
"identifier",
"enum"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L388-L405 | train |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.convertActionTypeToIntent | private static String convertActionTypeToIntent(RamlActionType actionType, boolean isIdInPath) {
switch (actionType) {
case DELETE:
return "delete";
case GET:
return "get";
case POST:
if (!isIdInPath) {
return "create";
}
case PUT:
return "update";
case PATCH:
return "modify";
default:
return "do";
}
} | java | private static String convertActionTypeToIntent(RamlActionType actionType, boolean isIdInPath) {
switch (actionType) {
case DELETE:
return "delete";
case GET:
return "get";
case POST:
if (!isIdInPath) {
return "create";
}
case PUT:
return "update";
case PATCH:
return "modify";
default:
return "do";
}
} | [
"private",
"static",
"String",
"convertActionTypeToIntent",
"(",
"RamlActionType",
"actionType",
",",
"boolean",
"isIdInPath",
")",
"{",
"switch",
"(",
"actionType",
")",
"{",
"case",
"DELETE",
":",
"return",
"\"delete\"",
";",
"case",
"GET",
":",
"return",
"\"g... | Attempts to convert the Http Verb into a textual representation of Intent
based on REST conventions
@param actionType
The ActionType/Http verb of the action
@param isIdInPath
True if the path contains an Id meaning that it must be an
idempotent operation, i.e. PUT
@return method name prefix | [
"Attempts",
"to",
"convert",
"the",
"Http",
"Verb",
"into",
"a",
"textual",
"representation",
"of",
"Intent",
"based",
"on",
"REST",
"conventions"
] | 6387072317cd771eb7d6f30943f556ac20dd3c84 | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L632-L649 | train |
mojohaus/buildnumber-maven-plugin | src/main/java/org/codehaus/mojo/build/AbstractScmMojo.java | AbstractScmMojo.loadInfosFromSettings | private void loadInfosFromSettings( ScmProviderRepositoryWithHost repo )
{
if ( username == null || password == null )
{
String host = repo.getHost();
int port = repo.getPort();
if ( port > 0 )
{
host += ":" + port;
}
Server server = this.settings.getServer( host );
if ( server != null )
{
setPasswordIfNotEmpty( repo, decrypt( server.getPassword(), host ) );
setUserIfNotEmpty( repo, server.getUsername() );
}
}
} | java | private void loadInfosFromSettings( ScmProviderRepositoryWithHost repo )
{
if ( username == null || password == null )
{
String host = repo.getHost();
int port = repo.getPort();
if ( port > 0 )
{
host += ":" + port;
}
Server server = this.settings.getServer( host );
if ( server != null )
{
setPasswordIfNotEmpty( repo, decrypt( server.getPassword(), host ) );
setUserIfNotEmpty( repo, server.getUsername() );
}
}
} | [
"private",
"void",
"loadInfosFromSettings",
"(",
"ScmProviderRepositoryWithHost",
"repo",
")",
"{",
"if",
"(",
"username",
"==",
"null",
"||",
"password",
"==",
"null",
")",
"{",
"String",
"host",
"=",
"repo",
".",
"getHost",
"(",
")",
";",
"int",
"port",
... | Load username password from settings. | [
"Load",
"username",
"password",
"from",
"settings",
"."
] | 17aa584066ca898b2d526e4618acae462fc9857f | https://github.com/mojohaus/buildnumber-maven-plugin/blob/17aa584066ca898b2d526e4618acae462fc9857f/src/main/java/org/codehaus/mojo/build/AbstractScmMojo.java#L152-L174 | train |
mojohaus/buildnumber-maven-plugin | src/main/java/org/codehaus/mojo/build/AbstractScmMojo.java | AbstractScmMojo.info | protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
throws ScmException
{
CommandParameters commandParameters = new CommandParameters();
// only for Git, we will make a test for shortRevisionLength parameter
if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
&& this.shortRevisionLength > 0 )
{
getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
{
getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
}
commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
}
if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
{
commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
}
return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
commandParameters );
} | java | protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
throws ScmException
{
CommandParameters commandParameters = new CommandParameters();
// only for Git, we will make a test for shortRevisionLength parameter
if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
&& this.shortRevisionLength > 0 )
{
getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
{
getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
}
commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
}
if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
{
commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
}
return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
commandParameters );
} | [
"protected",
"InfoScmResult",
"info",
"(",
"ScmRepository",
"repository",
",",
"ScmFileSet",
"fileSet",
")",
"throws",
"ScmException",
"{",
"CommandParameters",
"commandParameters",
"=",
"new",
"CommandParameters",
"(",
")",
";",
"// only for Git, we will make a test for sh... | Get info from scm.
@param repository
@param fileSet
@return
@throws ScmException
@todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and
org.apache.maven.scm.provider.svn.SvnScmProvider | [
"Get",
"info",
"from",
"scm",
"."
] | 17aa584066ca898b2d526e4618acae462fc9857f | https://github.com/mojohaus/buildnumber-maven-plugin/blob/17aa584066ca898b2d526e4618acae462fc9857f/src/main/java/org/codehaus/mojo/build/AbstractScmMojo.java#L253-L277 | train |
mojohaus/buildnumber-maven-plugin | src/main/java/org/codehaus/mojo/build/CreateMojo.java | CreateMojo.format | private String format( Object[] arguments )
{
Locale l = Locale.getDefault();
if ( locale != null )
{
String[] parts = locale.split( "_", 3 );
if ( parts.length <= 1 )
{
l = new Locale( locale );
}
else if ( parts.length == 2 )
{
l = new Locale( parts[0], parts[1] );
}
else
{
l = new Locale( parts[0], parts[1], parts[2] );
}
}
return new MessageFormat( format, l ).format( arguments );
} | java | private String format( Object[] arguments )
{
Locale l = Locale.getDefault();
if ( locale != null )
{
String[] parts = locale.split( "_", 3 );
if ( parts.length <= 1 )
{
l = new Locale( locale );
}
else if ( parts.length == 2 )
{
l = new Locale( parts[0], parts[1] );
}
else
{
l = new Locale( parts[0], parts[1], parts[2] );
}
}
return new MessageFormat( format, l ).format( arguments );
} | [
"private",
"String",
"format",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"Locale",
"l",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"if",
"(",
"locale",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"locale",
".",
"split",
"(... | Formats the given argument using the configured format template and locale.
@param arguments arguments to be formatted @ @return formatted result | [
"Formats",
"the",
"given",
"argument",
"using",
"the",
"configured",
"format",
"template",
"and",
"locale",
"."
] | 17aa584066ca898b2d526e4618acae462fc9857f | https://github.com/mojohaus/buildnumber-maven-plugin/blob/17aa584066ca898b2d526e4618acae462fc9857f/src/main/java/org/codehaus/mojo/build/CreateMojo.java#L508-L529 | train |
mojohaus/buildnumber-maven-plugin | src/main/java/org/codehaus/mojo/build/CreateMojo.java | CreateMojo.getScmBranch | public String getScmBranch()
throws MojoExecutionException
{
try
{
ScmRepository repository = getScmRepository();
ScmProvider provider = scmManager.getProviderByRepository( repository );
/* git branch can be obtained directly by a command */
if ( GitScmProviderRepository.PROTOCOL_GIT.equals( provider.getScmType() ) )
{
ScmFileSet fileSet = new ScmFileSet( scmDirectory );
return GitBranchCommand.getCurrentBranch( getLogger(),
(GitScmProviderRepository) repository.getProviderRepository(),
fileSet );
}
else if ( provider instanceof HgScmProvider )
{
/* hg branch can be obtained directly by a command */
HgOutputConsumer consumer = new HgOutputConsumer( getLogger() );
ScmResult result = HgUtils.execute( consumer, logger, scmDirectory, new String[] { "id", "-b" } );
checkResult( result );
if ( StringUtils.isNotEmpty( consumer.getOutput() ) )
{
return consumer.getOutput();
}
}
}
catch ( ScmException e )
{
getLog().warn( "Cannot get the branch information from the git repository: \n" + e.getLocalizedMessage() );
}
return getScmBranchFromUrl();
} | java | public String getScmBranch()
throws MojoExecutionException
{
try
{
ScmRepository repository = getScmRepository();
ScmProvider provider = scmManager.getProviderByRepository( repository );
/* git branch can be obtained directly by a command */
if ( GitScmProviderRepository.PROTOCOL_GIT.equals( provider.getScmType() ) )
{
ScmFileSet fileSet = new ScmFileSet( scmDirectory );
return GitBranchCommand.getCurrentBranch( getLogger(),
(GitScmProviderRepository) repository.getProviderRepository(),
fileSet );
}
else if ( provider instanceof HgScmProvider )
{
/* hg branch can be obtained directly by a command */
HgOutputConsumer consumer = new HgOutputConsumer( getLogger() );
ScmResult result = HgUtils.execute( consumer, logger, scmDirectory, new String[] { "id", "-b" } );
checkResult( result );
if ( StringUtils.isNotEmpty( consumer.getOutput() ) )
{
return consumer.getOutput();
}
}
}
catch ( ScmException e )
{
getLog().warn( "Cannot get the branch information from the git repository: \n" + e.getLocalizedMessage() );
}
return getScmBranchFromUrl();
} | [
"public",
"String",
"getScmBranch",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"ScmRepository",
"repository",
"=",
"getScmRepository",
"(",
")",
";",
"ScmProvider",
"provider",
"=",
"scmManager",
".",
"getProviderByRepository",
"(",
"repository",
... | Get the branch info for this revision from the repository. For svn, it is in svn info.
@return
@throws MojoExecutionException
@throws MojoExecutionException | [
"Get",
"the",
"branch",
"info",
"for",
"this",
"revision",
"from",
"the",
"repository",
".",
"For",
"svn",
"it",
"is",
"in",
"svn",
"info",
"."
] | 17aa584066ca898b2d526e4618acae462fc9857f | https://github.com/mojohaus/buildnumber-maven-plugin/blob/17aa584066ca898b2d526e4618acae462fc9857f/src/main/java/org/codehaus/mojo/build/CreateMojo.java#L626-L659 | train |
mojohaus/buildnumber-maven-plugin | src/main/java/org/codehaus/mojo/build/CreateMojo.java | CreateMojo.getRevision | public String getRevision()
throws MojoExecutionException
{
if ( format != null && !useScm )
{
return revision;
}
useScm = false;
try
{
return this.getScmRevision();
}
catch ( ScmException e )
{
if ( !StringUtils.isEmpty( revisionOnScmFailure ) )
{
getLog().warn( "Cannot get the revision information from the scm repository, proceeding with "
+ "revision of " + revisionOnScmFailure + " : \n" + e.getLocalizedMessage() );
setDoCheck( false );
setDoUpdate( false );
return revisionOnScmFailure;
}
throw new MojoExecutionException( "Cannot get the revision information from the scm repository : \n"
+ e.getLocalizedMessage(), e );
}
} | java | public String getRevision()
throws MojoExecutionException
{
if ( format != null && !useScm )
{
return revision;
}
useScm = false;
try
{
return this.getScmRevision();
}
catch ( ScmException e )
{
if ( !StringUtils.isEmpty( revisionOnScmFailure ) )
{
getLog().warn( "Cannot get the revision information from the scm repository, proceeding with "
+ "revision of " + revisionOnScmFailure + " : \n" + e.getLocalizedMessage() );
setDoCheck( false );
setDoUpdate( false );
return revisionOnScmFailure;
}
throw new MojoExecutionException( "Cannot get the revision information from the scm repository : \n"
+ e.getLocalizedMessage(), e );
}
} | [
"public",
"String",
"getRevision",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"format",
"!=",
"null",
"&&",
"!",
"useScm",
")",
"{",
"return",
"revision",
";",
"}",
"useScm",
"=",
"false",
";",
"try",
"{",
"return",
"this",
".",
"getSc... | Get the revision info from the repository. For svn, it is svn info
@return
@throws MojoExecutionException | [
"Get",
"the",
"revision",
"info",
"from",
"the",
"repository",
".",
"For",
"svn",
"it",
"is",
"svn",
"info"
] | 17aa584066ca898b2d526e4618acae462fc9857f | https://github.com/mojohaus/buildnumber-maven-plugin/blob/17aa584066ca898b2d526e4618acae462fc9857f/src/main/java/org/codehaus/mojo/build/CreateMojo.java#L731-L763 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.estimatedHours | public CreateIssueParams estimatedHours(BigDecimal estimatedHours) {
if (estimatedHours == null) {
parameters.add(new NameValuePair("estimatedHours", ""));
} else {
parameters.add(new NameValuePair("estimatedHours", estimatedHours.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()));
}
return this;
} | java | public CreateIssueParams estimatedHours(BigDecimal estimatedHours) {
if (estimatedHours == null) {
parameters.add(new NameValuePair("estimatedHours", ""));
} else {
parameters.add(new NameValuePair("estimatedHours", estimatedHours.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()));
}
return this;
} | [
"public",
"CreateIssueParams",
"estimatedHours",
"(",
"BigDecimal",
"estimatedHours",
")",
"{",
"if",
"(",
"estimatedHours",
"==",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"estimatedHours\"",
",",
"\"\"",
")",
")",
";",
"... | Sets the issue estimate hours.
@param estimatedHours the issue estimate hours
@return CreateIssueParams instance | [
"Sets",
"the",
"issue",
"estimate",
"hours",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L95-L102 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.actualHours | public CreateIssueParams actualHours(BigDecimal actualHours) {
if (actualHours == null) {
parameters.add(new NameValuePair("actualHours", ""));
} else {
parameters.add(new NameValuePair("actualHours", actualHours.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()));
}
return this;
} | java | public CreateIssueParams actualHours(BigDecimal actualHours) {
if (actualHours == null) {
parameters.add(new NameValuePair("actualHours", ""));
} else {
parameters.add(new NameValuePair("actualHours", actualHours.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()));
}
return this;
} | [
"public",
"CreateIssueParams",
"actualHours",
"(",
"BigDecimal",
"actualHours",
")",
"{",
"if",
"(",
"actualHours",
"==",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"actualHours\"",
",",
"\"\"",
")",
")",
";",
"}",
"else"... | Sets the issue actual hours.
@param actualHours the issue actual hours
@return CreateIssueParams instance | [
"Sets",
"the",
"issue",
"actual",
"hours",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L121-L128 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.milestoneIds | public CreateIssueParams milestoneIds(List milestoneIds) {
for (Object milestoneId : milestoneIds) {
parameters.add(new NameValuePair("milestoneId[]", milestoneId.toString()));
}
return this;
} | java | public CreateIssueParams milestoneIds(List milestoneIds) {
for (Object milestoneId : milestoneIds) {
parameters.add(new NameValuePair("milestoneId[]", milestoneId.toString()));
}
return this;
} | [
"public",
"CreateIssueParams",
"milestoneIds",
"(",
"List",
"milestoneIds",
")",
"{",
"for",
"(",
"Object",
"milestoneId",
":",
"milestoneIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"milestoneId[]\"",
",",
"milestoneId",
".",
"t... | Sets the issue milestones.
@param milestoneIds the milestone identifiers
@return CreateIssueParams instance | [
"Sets",
"the",
"issue",
"milestones",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L162-L167 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.notifiedUserIds | public CreateIssueParams notifiedUserIds(List notifiedUserIds) {
for (Object notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | java | public CreateIssueParams notifiedUserIds(List notifiedUserIds) {
for (Object notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | [
"public",
"CreateIssueParams",
"notifiedUserIds",
"(",
"List",
"notifiedUserIds",
")",
"{",
"for",
"(",
"Object",
"notifiedUserId",
":",
"notifiedUserIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"notifiedUserId[]\"",
",",
"notifiedUs... | Sets the issue notified users.
@param notifiedUserIds notified user identifiers
@return CreateIssueParams instance | [
"Sets",
"the",
"issue",
"notified",
"users",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L187-L193 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.textCustomFields | public CreateIssueParams textCustomFields(List<CustomFiledValue> customFieldValueList) {
for (CustomFiledValue customFiledValue : customFieldValueList) {
textCustomField(customFiledValue);
}
return this;
} | java | public CreateIssueParams textCustomFields(List<CustomFiledValue> customFieldValueList) {
for (CustomFiledValue customFiledValue : customFieldValueList) {
textCustomField(customFiledValue);
}
return this;
} | [
"public",
"CreateIssueParams",
"textCustomFields",
"(",
"List",
"<",
"CustomFiledValue",
">",
"customFieldValueList",
")",
"{",
"for",
"(",
"CustomFiledValue",
"customFiledValue",
":",
"customFieldValueList",
")",
"{",
"textCustomField",
"(",
"customFiledValue",
")",
";... | Sets the text type custom field with Map.
@param customFieldValueList list of the identifiers and the values of custom field
@return CreateIssueParams instance | [
"Sets",
"the",
"text",
"type",
"custom",
"field",
"with",
"Map",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L226-L231 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.multipleListCustomField | public CreateIssueParams multipleListCustomField(CustomFiledItems customFiledItems) {
for (Object id : customFiledItems.getCustomFieldItemIds()) {
parameters.add(new NameValuePair("customField_" + customFiledItems.getCustomFieldId(),
id.toString()));
}
return this;
} | java | public CreateIssueParams multipleListCustomField(CustomFiledItems customFiledItems) {
for (Object id : customFiledItems.getCustomFieldItemIds()) {
parameters.add(new NameValuePair("customField_" + customFiledItems.getCustomFieldId(),
id.toString()));
}
return this;
} | [
"public",
"CreateIssueParams",
"multipleListCustomField",
"(",
"CustomFiledItems",
"customFiledItems",
")",
"{",
"for",
"(",
"Object",
"id",
":",
"customFiledItems",
".",
"getCustomFieldItemIds",
"(",
")",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePa... | Sets the multiple list type custom field.
@param customFiledItems the custom field identifiers and custom field item identifiers
@return CreateIssueParams instance | [
"Sets",
"the",
"multiple",
"list",
"type",
"custom",
"field",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L344-L350 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java | CreateIssueParams.multipleListCustomFields | public CreateIssueParams multipleListCustomFields(List<CustomFiledItems> customFiledItemsList) {
for (CustomFiledItems customFiledItems : customFiledItemsList) {
multipleListCustomField(customFiledItems);
}
return this;
} | java | public CreateIssueParams multipleListCustomFields(List<CustomFiledItems> customFiledItemsList) {
for (CustomFiledItems customFiledItems : customFiledItemsList) {
multipleListCustomField(customFiledItems);
}
return this;
} | [
"public",
"CreateIssueParams",
"multipleListCustomFields",
"(",
"List",
"<",
"CustomFiledItems",
">",
"customFiledItemsList",
")",
"{",
"for",
"(",
"CustomFiledItems",
"customFiledItems",
":",
"customFiledItemsList",
")",
"{",
"multipleListCustomField",
"(",
"customFiledIte... | Sets the multiple list type custom field with Map.
@param customFiledItemsList list of the custom field identifiers and custom field item identifiers
@return CreateIssueParams instance | [
"Sets",
"the",
"multiple",
"list",
"type",
"custom",
"field",
"with",
"Map",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L358-L363 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java | BacklogEndPointSupport.getSharedFileEndpoint | public String getSharedFileEndpoint(Object projectIdOrKey, Object sharedFileId) throws BacklogException {
return buildEndpoint("projects/" + projectIdOrKey + "/files/" + sharedFileId);
} | java | public String getSharedFileEndpoint(Object projectIdOrKey, Object sharedFileId) throws BacklogException {
return buildEndpoint("projects/" + projectIdOrKey + "/files/" + sharedFileId);
} | [
"public",
"String",
"getSharedFileEndpoint",
"(",
"Object",
"projectIdOrKey",
",",
"Object",
"sharedFileId",
")",
"throws",
"BacklogException",
"{",
"return",
"buildEndpoint",
"(",
"\"projects/\"",
"+",
"projectIdOrKey",
"+",
"\"/files/\"",
"+",
"sharedFileId",
")",
"... | Returns the endpoint of shared file.
@param projectIdOrKey the project identifier
@param sharedFileId the shared file identifier
@return the endpoint
@throws BacklogException | [
"Returns",
"the",
"endpoint",
"of",
"shared",
"file",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java#L58-L60 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java | BacklogEndPointSupport.getWikiAttachmentEndpoint | public String getWikiAttachmentEndpoint(Object wikiId, Object attachmentId) throws BacklogException {
return buildEndpoint("wikis/" + wikiId + "/attachments/" + attachmentId);
} | java | public String getWikiAttachmentEndpoint(Object wikiId, Object attachmentId) throws BacklogException {
return buildEndpoint("wikis/" + wikiId + "/attachments/" + attachmentId);
} | [
"public",
"String",
"getWikiAttachmentEndpoint",
"(",
"Object",
"wikiId",
",",
"Object",
"attachmentId",
")",
"throws",
"BacklogException",
"{",
"return",
"buildEndpoint",
"(",
"\"wikis/\"",
"+",
"wikiId",
"+",
"\"/attachments/\"",
"+",
"attachmentId",
")",
";",
"}"... | Returns the endpoint of Wiki page's attachment file.
@param wikiId the Wiki page identifier
@param attachmentId the attachment identifier
@return the endpoint
@throws BacklogException | [
"Returns",
"the",
"endpoint",
"of",
"Wiki",
"page",
"s",
"attachment",
"file",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java#L82-L84 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/CreateWebhookParams.java | CreateWebhookParams.description | public CreateWebhookParams description(String description) {
String value = (description==null) ? "" : description;
parameters.add(new NameValuePair("description", value));
return this;
} | java | public CreateWebhookParams description(String description) {
String value = (description==null) ? "" : description;
parameters.add(new NameValuePair("description", value));
return this;
} | [
"public",
"CreateWebhookParams",
"description",
"(",
"String",
"description",
")",
"{",
"String",
"value",
"=",
"(",
"description",
"==",
"null",
")",
"?",
"\"\"",
":",
"description",
";",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"descript... | Sets the description parameter.
@param description the description identifier
@return CreateWebhookParams instance | [
"Sets",
"the",
"description",
"parameter",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateWebhookParams.java#L36-L40 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/AddPullRequestCommentParams.java | AddPullRequestCommentParams.notifiedUserIds | public AddPullRequestCommentParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", String.valueOf(notifiedUserId)));
}
return this;
} | java | public AddPullRequestCommentParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", String.valueOf(notifiedUserId)));
}
return this;
} | [
"public",
"AddPullRequestCommentParams",
"notifiedUserIds",
"(",
"List",
"<",
"Long",
">",
"notifiedUserIds",
")",
"{",
"for",
"(",
"Long",
"notifiedUserId",
":",
"notifiedUserIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"notifiedU... | Sets the notified users.
@param notifiedUserIds the notified user identifiers
@return AddPullRequestCommentParams instance | [
"Sets",
"the",
"notified",
"users",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/AddPullRequestCommentParams.java#L52-L57 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java | UpdatePullRequestParams.notifiedUserIds | public UpdatePullRequestParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | java | public UpdatePullRequestParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | [
"public",
"UpdatePullRequestParams",
"notifiedUserIds",
"(",
"List",
"<",
"Long",
">",
"notifiedUserIds",
")",
"{",
"for",
"(",
"Long",
"notifiedUserId",
":",
"notifiedUserIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"notifiedUserI... | Sets the pull request notified users.
@param notifiedUserIds notified user identifiers
@return UpdatePullRequestParams instance | [
"Sets",
"the",
"pull",
"request",
"notified",
"users",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java#L116-L122 | train |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java | UpdatePullRequestParams.attachmentIds | public UpdatePullRequestParams attachmentIds(List<Long> attachmentIds) {
for (Long attachmentId : attachmentIds) {
parameters.add(new NameValuePair("attachmentId[]", attachmentId.toString()));
}
return this;
} | java | public UpdatePullRequestParams attachmentIds(List<Long> attachmentIds) {
for (Long attachmentId : attachmentIds) {
parameters.add(new NameValuePair("attachmentId[]", attachmentId.toString()));
}
return this;
} | [
"public",
"UpdatePullRequestParams",
"attachmentIds",
"(",
"List",
"<",
"Long",
">",
"attachmentIds",
")",
"{",
"for",
"(",
"Long",
"attachmentId",
":",
"attachmentIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"attachmentId[]\"",
... | Sets the pull request attachment files.
@param attachmentIds the attachment file identifiers
@return UpdatePullRequestParams instance | [
"Sets",
"the",
"pull",
"request",
"attachment",
"files",
"."
] | 862ae0586ad808b2ec413f665b8dfc0c9a107b4e | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java#L130-L135 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeEnd | @Override
public void encodeEnd(final FacesContext context, final UIComponent component) throws IOException {
final ResponseWriter responseWriter = context.getResponseWriter();
final Sheet sheet = (Sheet) component;
// update column mappings on render
sheet.updateColumnMappings();
// sort data
sheet.sortAndFilter();
// encode markup
encodeMarkup(context, sheet, responseWriter);
// encode javascript
encodeScript(context, sheet, responseWriter);
} | java | @Override
public void encodeEnd(final FacesContext context, final UIComponent component) throws IOException {
final ResponseWriter responseWriter = context.getResponseWriter();
final Sheet sheet = (Sheet) component;
// update column mappings on render
sheet.updateColumnMappings();
// sort data
sheet.sortAndFilter();
// encode markup
encodeMarkup(context, sheet, responseWriter);
// encode javascript
encodeScript(context, sheet, responseWriter);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"final",
"ResponseWriter",
"responseWriter",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
"... | Encodes the Sheet component | [
"Encodes",
"the",
"Sheet",
"component"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L56-L72 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeMarkup | protected void encodeMarkup(final FacesContext context, final Sheet sheet, final ResponseWriter responseWriter)
throws IOException {
/*
* <div id="..." name="..." class="" style="">
*/
final String styleClass = sheet.getStyleClass();
final String clientId = sheet.getClientId(context);
final Integer width = sheet.getWidth();
final Integer height = sheet.getHeight();
String style = sheet.getStyle();
// outer div to wrapper table
responseWriter.startElement("div", null);
responseWriter.writeAttribute("id", clientId, "id");
responseWriter.writeAttribute("name", clientId, "clientId");
// note: can't use ui-datatable here because it will mess with
// handsontable cell rendering
String divclass = "ui-handsontable ui-widget";
if (styleClass != null) {
divclass = divclass + " " + styleClass;
}
if (!sheet.isValid()) {
divclass = divclass + " ui-state-error";
}
responseWriter.writeAttribute("class", divclass, "styleClass");
if (width != null) {
responseWriter.writeAttribute("style", "width: " + width + "px;", null);
}
encodeHiddenInputs(responseWriter, sheet, clientId);
encodeFilterValues(context, responseWriter, sheet, clientId);
encodeHeader(context, responseWriter, sheet);
// handsontable div
responseWriter.startElement("div", null);
responseWriter.writeAttribute("id", clientId + "_tbl", "id");
responseWriter.writeAttribute("name", clientId + "_tbl", "clientId");
responseWriter.writeAttribute("class", "handsontable-inner", "styleClass");
if (style == null) {
style = Constants.EMPTY_STRING;
}
if (width != null) {
style = style + "width: " + width + "px;";
}
if (height != null) {
style = style + "height: " + height + "px;";
}
else {
style = style + "height: 100%;";
}
if (style.length() > 0) {
responseWriter.writeAttribute("style", style, null);
}
responseWriter.endElement("div");
encodeFooter(context, responseWriter, sheet);
responseWriter.endElement("div");
} | java | protected void encodeMarkup(final FacesContext context, final Sheet sheet, final ResponseWriter responseWriter)
throws IOException {
/*
* <div id="..." name="..." class="" style="">
*/
final String styleClass = sheet.getStyleClass();
final String clientId = sheet.getClientId(context);
final Integer width = sheet.getWidth();
final Integer height = sheet.getHeight();
String style = sheet.getStyle();
// outer div to wrapper table
responseWriter.startElement("div", null);
responseWriter.writeAttribute("id", clientId, "id");
responseWriter.writeAttribute("name", clientId, "clientId");
// note: can't use ui-datatable here because it will mess with
// handsontable cell rendering
String divclass = "ui-handsontable ui-widget";
if (styleClass != null) {
divclass = divclass + " " + styleClass;
}
if (!sheet.isValid()) {
divclass = divclass + " ui-state-error";
}
responseWriter.writeAttribute("class", divclass, "styleClass");
if (width != null) {
responseWriter.writeAttribute("style", "width: " + width + "px;", null);
}
encodeHiddenInputs(responseWriter, sheet, clientId);
encodeFilterValues(context, responseWriter, sheet, clientId);
encodeHeader(context, responseWriter, sheet);
// handsontable div
responseWriter.startElement("div", null);
responseWriter.writeAttribute("id", clientId + "_tbl", "id");
responseWriter.writeAttribute("name", clientId + "_tbl", "clientId");
responseWriter.writeAttribute("class", "handsontable-inner", "styleClass");
if (style == null) {
style = Constants.EMPTY_STRING;
}
if (width != null) {
style = style + "width: " + width + "px;";
}
if (height != null) {
style = style + "height: " + height + "px;";
}
else {
style = style + "height: 100%;";
}
if (style.length() > 0) {
responseWriter.writeAttribute("style", style, null);
}
responseWriter.endElement("div");
encodeFooter(context, responseWriter, sheet);
responseWriter.endElement("div");
} | [
"protected",
"void",
"encodeMarkup",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"ResponseWriter",
"responseWriter",
")",
"throws",
"IOException",
"{",
"/*\n * <div id=\"...\" name=\"...\" class=\"\" style=\"\">\n */",
... | Encodes the HTML markup for the sheet.
@param context
@param sheet
@throws IOException | [
"Encodes",
"the",
"HTML",
"markup",
"for",
"the",
"sheet",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L81-L143 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeOptionalAttr | protected void encodeOptionalAttr(final WidgetBuilder wb, final String attrName, final String value)
throws IOException {
if (value != null) {
wb.attr(attrName, value);
}
} | java | protected void encodeOptionalAttr(final WidgetBuilder wb, final String attrName, final String value)
throws IOException {
if (value != null) {
wb.attr(attrName, value);
}
} | [
"protected",
"void",
"encodeOptionalAttr",
"(",
"final",
"WidgetBuilder",
"wb",
",",
"final",
"String",
"attrName",
",",
"final",
"String",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"wb",
".",
"attr",
"(",
"att... | Encodes an optional attribute to the widget builder specified.
@param wb the WidgetBuilder to append to
@param attrName the attribute name
@param value the value
@throws IOException | [
"Encodes",
"an",
"optional",
"attribute",
"to",
"the",
"widget",
"builder",
"specified",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L153-L158 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeInvalidData | protected void encodeInvalidData(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
wb.attr("errors", sheet.getInvalidDataValue());
} | java | protected void encodeInvalidData(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
wb.attr("errors", sheet.getInvalidDataValue());
} | [
"protected",
"void",
"encodeInvalidData",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"WidgetBuilder",
"wb",
")",
"throws",
"IOException",
"{",
"wb",
".",
"attr",
"(",
"\"errors\"",
",",
"sheet",
".",
"getInvalidDataVal... | Encodes the necessary JS to render invalid data.
@throws IOException | [
"Encodes",
"the",
"necessary",
"JS",
"to",
"render",
"invalid",
"data",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L248-L251 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeColHeaders | protected void encodeColHeaders(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
vb.appendArrayValue(column.getHeaderText(), true);
}
wb.nativeAttr("colHeaders", vb.closeVar().toString());
} | java | protected void encodeColHeaders(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
vb.appendArrayValue(column.getHeaderText(), true);
}
wb.nativeAttr("colHeaders", vb.closeVar().toString());
} | [
"protected",
"void",
"encodeColHeaders",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"WidgetBuilder",
"wb",
")",
"throws",
"IOException",
"{",
"final",
"JavascriptVarBuilder",
"vb",
"=",
"new",
"JavascriptVarBuilder",
"(",
... | Encode the column headers
@param context
@param sheet
@param wb
@throws IOException | [
"Encode",
"the",
"column",
"headers"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L261-L271 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeData | protected void encodeData(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder jsData = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsRowKeys = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsRowStyle = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsRowHeaders = new JavascriptVarBuilder(null, false);
final boolean isCustomHeader = sheet.getRowHeaderValueExpression() != null;
final List<Object> values = sheet.getSortedValues();
int row = 0;
for (final Object value : values) {
context.getExternalContext().getRequestMap().put(sheet.getVar(), value);
final String rowKey = sheet.getRowKeyValueAsString(context);
jsRowKeys.appendArrayValue(rowKey, true);
encodeRow(context, rowKey, jsData, jsRowStyle, jsStyle, jsReadOnly, sheet, row);
// In case of custom row header evaluate the value expression for every row to
// set the header
if (sheet.isShowRowHeaders() && isCustomHeader) {
final String rowHeader = sheet.getRowHeaderValueAsString(context);
jsRowHeaders.appendArrayValue(rowHeader, true);
}
row++;
}
sheet.setRowVar(context, null);
wb.nativeAttr("data", jsData.closeVar().toString());
wb.nativeAttr("styles", jsStyle.closeVar().toString());
wb.nativeAttr("rowStyles", jsRowStyle.closeVar().toString());
wb.nativeAttr("readOnlyCells", jsReadOnly.closeVar().toString());
wb.nativeAttr("rowKeys", jsRowKeys.closeVar().toString());
// add the row header as a native attribute
if (!isCustomHeader) {
wb.nativeAttr("rowHeaders", sheet.isShowRowHeaders().toString());
}
else {
wb.nativeAttr("rowHeaders", jsRowHeaders.closeVar().toString());
}
} | java | protected void encodeData(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder jsData = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsRowKeys = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsRowStyle = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsRowHeaders = new JavascriptVarBuilder(null, false);
final boolean isCustomHeader = sheet.getRowHeaderValueExpression() != null;
final List<Object> values = sheet.getSortedValues();
int row = 0;
for (final Object value : values) {
context.getExternalContext().getRequestMap().put(sheet.getVar(), value);
final String rowKey = sheet.getRowKeyValueAsString(context);
jsRowKeys.appendArrayValue(rowKey, true);
encodeRow(context, rowKey, jsData, jsRowStyle, jsStyle, jsReadOnly, sheet, row);
// In case of custom row header evaluate the value expression for every row to
// set the header
if (sheet.isShowRowHeaders() && isCustomHeader) {
final String rowHeader = sheet.getRowHeaderValueAsString(context);
jsRowHeaders.appendArrayValue(rowHeader, true);
}
row++;
}
sheet.setRowVar(context, null);
wb.nativeAttr("data", jsData.closeVar().toString());
wb.nativeAttr("styles", jsStyle.closeVar().toString());
wb.nativeAttr("rowStyles", jsRowStyle.closeVar().toString());
wb.nativeAttr("readOnlyCells", jsReadOnly.closeVar().toString());
wb.nativeAttr("rowKeys", jsRowKeys.closeVar().toString());
// add the row header as a native attribute
if (!isCustomHeader) {
wb.nativeAttr("rowHeaders", sheet.isShowRowHeaders().toString());
}
else {
wb.nativeAttr("rowHeaders", jsRowHeaders.closeVar().toString());
}
} | [
"protected",
"void",
"encodeData",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"WidgetBuilder",
"wb",
")",
"throws",
"IOException",
"{",
"final",
"JavascriptVarBuilder",
"jsData",
"=",
"new",
"JavascriptVarBuilder",
"(",
... | Encode the row data. Builds row data, style data and read only object.
@param context
@param sheet
@param wb
@throws IOException | [
"Encode",
"the",
"row",
"data",
".",
"Builds",
"row",
"data",
"style",
"data",
"and",
"read",
"only",
"object",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L426-L470 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeRow | protected JavascriptVarBuilder encodeRow(final FacesContext context, final String rowKey,
final JavascriptVarBuilder jsData, final JavascriptVarBuilder jsRowStyle,
final JavascriptVarBuilder jsStyle, final JavascriptVarBuilder jsReadOnly, final Sheet sheet,
final int rowIndex) throws IOException {
// encode rowStyle (if any)
final String rowStyleClass = sheet.getRowStyleClass();
if (rowStyleClass == null) {
jsRowStyle.appendArrayValue("null", false);
}
else {
jsRowStyle.appendArrayValue(rowStyleClass, true);
}
// data is array of array of data
final JavascriptVarBuilder jsRow = new JavascriptVarBuilder(null, false);
int renderCol = 0;
for (int col = 0; col < sheet.getColumns().size(); col++) {
final SheetColumn column = sheet.getColumns().get(col);
if (!column.isRendered()) {
continue;
}
// render data value
final String value = sheet.getRenderValueForCell(context, rowKey, col);
jsRow.appendArrayValue(value, true);
// custom style
final String styleClass = column.getStyleClass();
if (styleClass != null) {
jsStyle.appendRowColProperty(rowIndex, renderCol, styleClass, true);
}
// read only per cell
final boolean readOnly = column.isReadonlyCell();
if (readOnly) {
jsReadOnly.appendRowColProperty(rowIndex, renderCol, "true", true);
}
renderCol++;
}
// close row and append to jsData
jsData.appendArrayValue(jsRow.closeVar().toString(), false);
return jsData;
} | java | protected JavascriptVarBuilder encodeRow(final FacesContext context, final String rowKey,
final JavascriptVarBuilder jsData, final JavascriptVarBuilder jsRowStyle,
final JavascriptVarBuilder jsStyle, final JavascriptVarBuilder jsReadOnly, final Sheet sheet,
final int rowIndex) throws IOException {
// encode rowStyle (if any)
final String rowStyleClass = sheet.getRowStyleClass();
if (rowStyleClass == null) {
jsRowStyle.appendArrayValue("null", false);
}
else {
jsRowStyle.appendArrayValue(rowStyleClass, true);
}
// data is array of array of data
final JavascriptVarBuilder jsRow = new JavascriptVarBuilder(null, false);
int renderCol = 0;
for (int col = 0; col < sheet.getColumns().size(); col++) {
final SheetColumn column = sheet.getColumns().get(col);
if (!column.isRendered()) {
continue;
}
// render data value
final String value = sheet.getRenderValueForCell(context, rowKey, col);
jsRow.appendArrayValue(value, true);
// custom style
final String styleClass = column.getStyleClass();
if (styleClass != null) {
jsStyle.appendRowColProperty(rowIndex, renderCol, styleClass, true);
}
// read only per cell
final boolean readOnly = column.isReadonlyCell();
if (readOnly) {
jsReadOnly.appendRowColProperty(rowIndex, renderCol, "true", true);
}
renderCol++;
}
// close row and append to jsData
jsData.appendArrayValue(jsRow.closeVar().toString(), false);
return jsData;
} | [
"protected",
"JavascriptVarBuilder",
"encodeRow",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"String",
"rowKey",
",",
"final",
"JavascriptVarBuilder",
"jsData",
",",
"final",
"JavascriptVarBuilder",
"jsRowStyle",
",",
"final",
"JavascriptVarBuilder",
"jsStyle"... | Encode a single row.
@return the JSON row | [
"Encode",
"a",
"single",
"row",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L477-L519 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeHiddenInputs | private void encodeHiddenInputs(final ResponseWriter responseWriter, final Sheet sheet, final String clientId)
throws IOException {
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_input", "id");
responseWriter.writeAttribute("name", clientId + "_input", "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", "", null);
responseWriter.endElement("input");
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_focus", "id");
responseWriter.writeAttribute("name", clientId + "_focus", "name");
responseWriter.writeAttribute("type", "hidden", null);
if (sheet.getFocusId() == null) {
responseWriter.writeAttribute("value", "", null);
}
else {
responseWriter.writeAttribute("value", sheet.getFocusId(), null);
}
responseWriter.endElement("input");
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_selection", "id");
responseWriter.writeAttribute("name", clientId + "_selection", "name");
responseWriter.writeAttribute("type", "hidden", null);
if (sheet.getSelection() == null) {
responseWriter.writeAttribute("value", "", null);
}
else {
responseWriter.writeAttribute("value", sheet.getSelection(), null);
}
responseWriter.endElement("input");
// sort col and order if specified and supported
final int sortCol = sheet.getSortColRenderIndex();
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_sortby", "id");
responseWriter.writeAttribute("name", clientId + "_sortby", "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", sortCol, null);
responseWriter.endElement("input");
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_sortorder", "id");
responseWriter.writeAttribute("name", clientId + "_sortorder", "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", sheet.getSortOrder().toLowerCase(), null);
responseWriter.endElement("input");
} | java | private void encodeHiddenInputs(final ResponseWriter responseWriter, final Sheet sheet, final String clientId)
throws IOException {
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_input", "id");
responseWriter.writeAttribute("name", clientId + "_input", "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", "", null);
responseWriter.endElement("input");
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_focus", "id");
responseWriter.writeAttribute("name", clientId + "_focus", "name");
responseWriter.writeAttribute("type", "hidden", null);
if (sheet.getFocusId() == null) {
responseWriter.writeAttribute("value", "", null);
}
else {
responseWriter.writeAttribute("value", sheet.getFocusId(), null);
}
responseWriter.endElement("input");
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_selection", "id");
responseWriter.writeAttribute("name", clientId + "_selection", "name");
responseWriter.writeAttribute("type", "hidden", null);
if (sheet.getSelection() == null) {
responseWriter.writeAttribute("value", "", null);
}
else {
responseWriter.writeAttribute("value", sheet.getSelection(), null);
}
responseWriter.endElement("input");
// sort col and order if specified and supported
final int sortCol = sheet.getSortColRenderIndex();
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_sortby", "id");
responseWriter.writeAttribute("name", clientId + "_sortby", "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", sortCol, null);
responseWriter.endElement("input");
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_sortorder", "id");
responseWriter.writeAttribute("name", clientId + "_sortorder", "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", sheet.getSortOrder().toLowerCase(), null);
responseWriter.endElement("input");
} | [
"private",
"void",
"encodeHiddenInputs",
"(",
"final",
"ResponseWriter",
"responseWriter",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"String",
"clientId",
")",
"throws",
"IOException",
"{",
"responseWriter",
".",
"startElement",
"(",
"\"input\"",
",",
"null",
... | Encode hidden input fields
@param responseWriter
@param sheet
@param clientId
@throws IOException | [
"Encode",
"hidden",
"input",
"fields"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L529-L577 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeFooter | private void encodeFooter(final FacesContext context, final ResponseWriter responseWriter, final Sheet sheet)
throws IOException {
// footer
final UIComponent footer = sheet.getFacet("footer");
if (footer != null) {
responseWriter.startElement("div", null);
responseWriter.writeAttribute("class", "ui-datatable-footer ui-widget-header ui-corner-bottom", null);
footer.encodeAll(context);
responseWriter.endElement("div");
}
} | java | private void encodeFooter(final FacesContext context, final ResponseWriter responseWriter, final Sheet sheet)
throws IOException {
// footer
final UIComponent footer = sheet.getFacet("footer");
if (footer != null) {
responseWriter.startElement("div", null);
responseWriter.writeAttribute("class", "ui-datatable-footer ui-widget-header ui-corner-bottom", null);
footer.encodeAll(context);
responseWriter.endElement("div");
}
} | [
"private",
"void",
"encodeFooter",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"ResponseWriter",
"responseWriter",
",",
"final",
"Sheet",
"sheet",
")",
"throws",
"IOException",
"{",
"// footer",
"final",
"UIComponent",
"footer",
"=",
"sheet",
".",
"getF... | Encode the sheet footer
@param context
@param responseWriter
@param sheet
@throws IOException | [
"Encode",
"the",
"sheet",
"footer"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L664-L674 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeHeader | private void encodeHeader(final FacesContext context, final ResponseWriter responseWriter, final Sheet sheet)
throws IOException {
// header
final UIComponent header = sheet.getFacet("header");
if (header != null) {
responseWriter.startElement("div", null);
responseWriter.writeAttribute("class", "ui-datatable-header ui-widget-header ui-corner-top", null);
header.encodeAll(context);
responseWriter.endElement("div");
}
} | java | private void encodeHeader(final FacesContext context, final ResponseWriter responseWriter, final Sheet sheet)
throws IOException {
// header
final UIComponent header = sheet.getFacet("header");
if (header != null) {
responseWriter.startElement("div", null);
responseWriter.writeAttribute("class", "ui-datatable-header ui-widget-header ui-corner-top", null);
header.encodeAll(context);
responseWriter.endElement("div");
}
} | [
"private",
"void",
"encodeHeader",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"ResponseWriter",
"responseWriter",
",",
"final",
"Sheet",
"sheet",
")",
"throws",
"IOException",
"{",
"// header",
"final",
"UIComponent",
"header",
"=",
"sheet",
".",
"getF... | Encode the Sheet header
@param context
@param responseWriter
@param sheet
@throws IOException | [
"Encode",
"the",
"Sheet",
"header"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L684-L694 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeFilterValues | protected void encodeFilterValues(final FacesContext context, final ResponseWriter responseWriter,
final Sheet sheet, final String clientId) throws IOException {
int renderCol = 0;
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") != null) {
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_filter_" + renderCol, "id");
responseWriter.writeAttribute("name", clientId + "_filter_" + renderCol, "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", column.getFilterValue(), null);
responseWriter.endElement("input");
}
renderCol++;
}
} | java | protected void encodeFilterValues(final FacesContext context, final ResponseWriter responseWriter,
final Sheet sheet, final String clientId) throws IOException {
int renderCol = 0;
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") != null) {
responseWriter.startElement("input", null);
responseWriter.writeAttribute("id", clientId + "_filter_" + renderCol, "id");
responseWriter.writeAttribute("name", clientId + "_filter_" + renderCol, "name");
responseWriter.writeAttribute("type", "hidden", null);
responseWriter.writeAttribute("value", column.getFilterValue(), null);
responseWriter.endElement("input");
}
renderCol++;
}
} | [
"protected",
"void",
"encodeFilterValues",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"ResponseWriter",
"responseWriter",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"String",
"clientId",
")",
"throws",
"IOException",
"{",
"int",
"renderCol",
"=",
"0... | Encodes the filter values.
@param context
@param responseWriter
@param sheet
@throws IOException | [
"Encodes",
"the",
"filter",
"values",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L704-L723 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeSortVar | protected void encodeSortVar(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("sortBy") == null) {
vb.appendArrayValue("false", false);
}
else {
vb.appendArrayValue("true", false);
}
}
wb.nativeAttr("sortable", vb.closeVar().toString());
} | java | protected void encodeSortVar(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("sortBy") == null) {
vb.appendArrayValue("false", false);
}
else {
vb.appendArrayValue("true", false);
}
}
wb.nativeAttr("sortable", vb.closeVar().toString());
} | [
"protected",
"void",
"encodeSortVar",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"WidgetBuilder",
"wb",
")",
"throws",
"IOException",
"{",
"final",
"JavascriptVarBuilder",
"vb",
"=",
"new",
"JavascriptVarBuilder",
"(",
"... | Encodes a javascript sort var that informs the col header event of the column's sorting options. The var is an array of boolean indicating whether or not
the column is sortable.
@param context
@param sheet
@param wb
@throws IOException | [
"Encodes",
"a",
"javascript",
"sort",
"var",
"that",
"informs",
"the",
"col",
"header",
"event",
"of",
"the",
"column",
"s",
"sorting",
"options",
".",
"The",
"var",
"is",
"an",
"array",
"of",
"boolean",
"indicating",
"whether",
"or",
"not",
"the",
"column... | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L780-L797 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.decodeFilters | protected void decodeFilters(final FacesContext context, final Sheet sheet, final Map<String, String> params,
final String clientId) {
int renderCol = 0;
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") != null) {
final String value = params.get(clientId + "_filter_" + renderCol);
column.setFilterValue(value);
}
renderCol++;
}
} | java | protected void decodeFilters(final FacesContext context, final Sheet sheet, final Map<String, String> params,
final String clientId) {
int renderCol = 0;
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") != null) {
final String value = params.get(clientId + "_filter_" + renderCol);
column.setFilterValue(value);
}
renderCol++;
}
} | [
"protected",
"void",
"decodeFilters",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"final",
"String",
"clientId",
")",
"{",
"int",
"renderCol",
"=",
"0",
";"... | Decodes the filter values
@param context
@param sheet
@param params
@param clientId | [
"Decodes",
"the",
"filter",
"values"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L869-L884 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.decodeSelection | private void decodeSelection(final FacesContext context, final Sheet sheet, final String jsonSelection) {
if (LangUtils.isValueBlank(jsonSelection)) {
return;
}
try {
// data comes in: [ [row, col, oldValue, newValue] ... ]
final JSONArray array = new JSONArray(jsonSelection);
sheet.setSelectedRow(array.getInt(0));
sheet.setSelectedColumn(sheet.getMappedColumn(array.getInt(1)));
sheet.setSelectedLastRow(array.getInt(2));
sheet.setSelectedLastColumn(array.getInt(3));
sheet.setSelection(jsonSelection);
}
catch (final JSONException e) {
throw new FacesException("Failed parsing Ajax JSON message for cell selection event:" + e.getMessage(), e);
}
} | java | private void decodeSelection(final FacesContext context, final Sheet sheet, final String jsonSelection) {
if (LangUtils.isValueBlank(jsonSelection)) {
return;
}
try {
// data comes in: [ [row, col, oldValue, newValue] ... ]
final JSONArray array = new JSONArray(jsonSelection);
sheet.setSelectedRow(array.getInt(0));
sheet.setSelectedColumn(sheet.getMappedColumn(array.getInt(1)));
sheet.setSelectedLastRow(array.getInt(2));
sheet.setSelectedLastColumn(array.getInt(3));
sheet.setSelection(jsonSelection);
}
catch (final JSONException e) {
throw new FacesException("Failed parsing Ajax JSON message for cell selection event:" + e.getMessage(), e);
}
} | [
"private",
"void",
"decodeSelection",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"String",
"jsonSelection",
")",
"{",
"if",
"(",
"LangUtils",
".",
"isValueBlank",
"(",
"jsonSelection",
")",
")",
"{",
"return",
";",
... | Decodes the user Selection JSON data
@param context
@param sheet
@param jsonSelection | [
"Decodes",
"the",
"user",
"Selection",
"JSON",
"data"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L935-L952 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.decodeSubmittedValues | private void decodeSubmittedValues(final FacesContext context, final Sheet sheet, final String jsonData) {
if (LangUtils.isValueBlank(jsonData)) {
return;
}
try {
// data comes in as a JSON Object with named properties for the row and columns
// updated this is so that
// multiple updates to the same cell overwrite previous deltas prior to
// submission we don't care about
// the property names, just the values, which we'll process in turn
final JSONObject obj = new JSONObject(jsonData);
final Iterator<String> keys = obj.keys();
while (keys.hasNext()) {
final String key = keys.next();
// data comes in: [row, col, oldValue, newValue, rowKey]
final JSONArray update = obj.getJSONArray(key);
// GitHub #586 pasted more values than rows
if (update.isNull(4)) {
continue;
}
final String rowKey = update.getString(4);
final int col = sheet.getMappedColumn(update.getInt(1));
final String newValue = String.valueOf(update.get(3));
sheet.setSubmittedValue(context, rowKey, col, newValue);
}
}
catch (final JSONException ex) {
throw new FacesException("Failed parsing Ajax JSON message for cell change event:" + ex.getMessage(), ex);
}
} | java | private void decodeSubmittedValues(final FacesContext context, final Sheet sheet, final String jsonData) {
if (LangUtils.isValueBlank(jsonData)) {
return;
}
try {
// data comes in as a JSON Object with named properties for the row and columns
// updated this is so that
// multiple updates to the same cell overwrite previous deltas prior to
// submission we don't care about
// the property names, just the values, which we'll process in turn
final JSONObject obj = new JSONObject(jsonData);
final Iterator<String> keys = obj.keys();
while (keys.hasNext()) {
final String key = keys.next();
// data comes in: [row, col, oldValue, newValue, rowKey]
final JSONArray update = obj.getJSONArray(key);
// GitHub #586 pasted more values than rows
if (update.isNull(4)) {
continue;
}
final String rowKey = update.getString(4);
final int col = sheet.getMappedColumn(update.getInt(1));
final String newValue = String.valueOf(update.get(3));
sheet.setSubmittedValue(context, rowKey, col, newValue);
}
}
catch (final JSONException ex) {
throw new FacesException("Failed parsing Ajax JSON message for cell change event:" + ex.getMessage(), ex);
}
} | [
"private",
"void",
"decodeSubmittedValues",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"String",
"jsonData",
")",
"{",
"if",
"(",
"LangUtils",
".",
"isValueBlank",
"(",
"jsonData",
")",
")",
"{",
"return",
";",
"}"... | Converts the JSON data received from the in the request params into our sumitted values map. The map is cleared first.
@param jsonData the submitted JSON data
@param sheet
@param jsonData | [
"Converts",
"the",
"JSON",
"data",
"received",
"from",
"the",
"in",
"the",
"request",
"params",
"into",
"our",
"sumitted",
"values",
"map",
".",
"The",
"map",
"is",
"cleared",
"first",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L961-L991 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java | RequestParameterBuilder.paramJson | public RequestParameterBuilder paramJson(String name, Object value) throws UnsupportedEncodingException {
return paramJson(name, value, null);
} | java | public RequestParameterBuilder paramJson(String name, Object value) throws UnsupportedEncodingException {
return paramJson(name, value, null);
} | [
"public",
"RequestParameterBuilder",
"paramJson",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"paramJson",
"(",
"name",
",",
"value",
",",
"null",
")",
";",
"}"
] | Adds a request parameter to the URL without specifying a data type of the given parameter value. Parameter's value is converted to JSON notation when
adding. Furthermore, it will be encoded according to the acquired encoding.
@param name name of the request parameter
@param value value of the request parameter
@return RequestParameterBuilder updated this instance which can be reused
@throws UnsupportedEncodingException DOCUMENT_ME | [
"Adds",
"a",
"request",
"parameter",
"to",
"the",
"URL",
"without",
"specifying",
"a",
"data",
"type",
"of",
"the",
"given",
"parameter",
"value",
".",
"Parameter",
"s",
"value",
"is",
"converted",
"to",
"JSON",
"notation",
"when",
"adding",
".",
"Furthermor... | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L101-L103 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java | RequestParameterBuilder.paramJson | public RequestParameterBuilder paramJson(String name, Object value, String type) throws UnsupportedEncodingException {
String encodedJsonValue = encodeJson(value, type);
if (added || originalUrl.contains("?")) {
buffer.append("&");
}
else {
buffer.append("?");
}
buffer.append(name);
buffer.append("=");
buffer.append(encodedJsonValue);
// set a flag that at least one request parameter was added
added = true;
return this;
} | java | public RequestParameterBuilder paramJson(String name, Object value, String type) throws UnsupportedEncodingException {
String encodedJsonValue = encodeJson(value, type);
if (added || originalUrl.contains("?")) {
buffer.append("&");
}
else {
buffer.append("?");
}
buffer.append(name);
buffer.append("=");
buffer.append(encodedJsonValue);
// set a flag that at least one request parameter was added
added = true;
return this;
} | [
"public",
"RequestParameterBuilder",
"paramJson",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"String",
"type",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"encodedJsonValue",
"=",
"encodeJson",
"(",
"value",
",",
"type",
")",
";",
"if",
... | Adds a request parameter to the URL with specifying a data type of the given parameter value. Data type is sometimes required, especially for Java
generic types, because type information is erased at runtime and the conversion to JSON will not work properly. Parameter's value is converted to JSON
notation when adding. Furthermore, it will be encoded according to the acquired encoding.
@param name name of the request parameter
@param value value of the request parameter
@param type data type of the value object. Any primitive type, array, non generic or generic type is supported. Data type is sometimes required to
convert a value to a JSON representation. All data types should be fully qualified. Examples: "boolean" "int" "long[]" "java.lang.String"
"java.util.Date" "java.util.Collection<java.lang.Integer>" "java.util.Map<java.lang.String, com.durr.FooPair<java.lang.Integer,
java.util.Date>>" "com.durr.FooNonGenericClass" "com.durr.FooGenericClass<java.lang.String, java.lang.Integer>"
"com.durr.FooGenericClass<int[], com.durr.FooGenericClass<com.durr.FooNonGenericClass, java.lang.Boolean>>".
@return RequestParameterBuilder updated this instance which can be reused
@throws UnsupportedEncodingException DOCUMENT_ME | [
"Adds",
"a",
"request",
"parameter",
"to",
"the",
"URL",
"with",
"specifying",
"a",
"data",
"type",
"of",
"the",
"given",
"parameter",
"value",
".",
"Data",
"type",
"is",
"sometimes",
"required",
"especially",
"for",
"Java",
"generic",
"types",
"because",
"t... | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L120-L138 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java | RequestParameterBuilder.encodeJson | public String encodeJson(Object value, String type) throws UnsupportedEncodingException {
jsonConverter.setType(type);
String jsonValue;
if (value == null) {
jsonValue = "null";
}
else {
jsonValue = jsonConverter.getAsString(null, null, value);
}
return URLEncoder.encode(jsonValue, encoding);
} | java | public String encodeJson(Object value, String type) throws UnsupportedEncodingException {
jsonConverter.setType(type);
String jsonValue;
if (value == null) {
jsonValue = "null";
}
else {
jsonValue = jsonConverter.getAsString(null, null, value);
}
return URLEncoder.encode(jsonValue, encoding);
} | [
"public",
"String",
"encodeJson",
"(",
"Object",
"value",
",",
"String",
"type",
")",
"throws",
"UnsupportedEncodingException",
"{",
"jsonConverter",
".",
"setType",
"(",
"type",
")",
";",
"String",
"jsonValue",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{... | Convertes give value to JSON and encodes the converted value with a proper encoding. Data type is sometimes required, especially for Java generic types,
because type information is erased at runtime and the conversion to JSON will not work properly.
@param value value to be converted and encoded
@param type data type of the value object. Any primitive type, array, non generic or generic type is supported. Data type is sometimes required to
convert a value to a JSON representation. All data types should be fully qualified. Examples: "boolean" "int" "long[]" "java.lang.String"
"java.util.Date" "java.util.Collection<java.lang.Integer>" "java.util.Map<java.lang.String, com.durr.FooPair<java.lang.Integer,
java.util.Date>>" "com.durr.FooNonGenericClass" "com.durr.FooGenericClass<java.lang.String, java.lang.Integer>"
"com.durr.FooGenericClass<int[], com.durr.FooGenericClass<com.durr.FooNonGenericClass, java.lang.Boolean>>".
@return String converted and encoded value
@throws UnsupportedEncodingException DOCUMENT_ME | [
"Convertes",
"give",
"value",
"to",
"JSON",
"and",
"encodes",
"the",
"converted",
"value",
"with",
"a",
"proper",
"encoding",
".",
"Data",
"type",
"is",
"sometimes",
"required",
"especially",
"for",
"Java",
"generic",
"types",
"because",
"type",
"information",
... | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L202-L214 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java | RequestParameterBuilder.build | public String build() {
String url = buffer.toString();
if (url.length() > 2083) {
LOG.warning("URL " + url + " is longer than 2083 chars (" + buffer.length()
+ "). It may not work properly in old IE versions.");
}
return url;
} | java | public String build() {
String url = buffer.toString();
if (url.length() > 2083) {
LOG.warning("URL " + url + " is longer than 2083 chars (" + buffer.length()
+ "). It may not work properly in old IE versions.");
}
return url;
} | [
"public",
"String",
"build",
"(",
")",
"{",
"String",
"url",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"if",
"(",
"url",
".",
"length",
"(",
")",
">",
"2083",
")",
"{",
"LOG",
".",
"warning",
"(",
"\"URL \"",
"+",
"url",
"+",
"\" is longer tha... | Builds the end result.
@return String end result | [
"Builds",
"the",
"end",
"result",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L232-L241 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java | RequestParameterBuilder.reset | public RequestParameterBuilder reset() {
buffer = new StringBuilder(originalUrl);
jsonConverter.setType(null);
added = false;
return this;
} | java | public RequestParameterBuilder reset() {
buffer = new StringBuilder(originalUrl);
jsonConverter.setType(null);
added = false;
return this;
} | [
"public",
"RequestParameterBuilder",
"reset",
"(",
")",
"{",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"originalUrl",
")",
";",
"jsonConverter",
".",
"setType",
"(",
"null",
")",
";",
"added",
"=",
"false",
";",
"return",
"this",
";",
"}"
] | Resets the internal state in order to be reused.
@return RequestParameterBuilder reseted builder | [
"Resets",
"the",
"internal",
"state",
"in",
"order",
"to",
"be",
"reused",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L248-L254 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java | DynaFormRow.addControl | public DynaFormControl addControl(final Object data, final int colspan, final int rowspan) {
return addControl(data, DynaFormControl.DEFAULT_TYPE, colspan, rowspan);
} | java | public DynaFormControl addControl(final Object data, final int colspan, final int rowspan) {
return addControl(data, DynaFormControl.DEFAULT_TYPE, colspan, rowspan);
} | [
"public",
"DynaFormControl",
"addControl",
"(",
"final",
"Object",
"data",
",",
"final",
"int",
"colspan",
",",
"final",
"int",
"rowspan",
")",
"{",
"return",
"addControl",
"(",
"data",
",",
"DynaFormControl",
".",
"DEFAULT_TYPE",
",",
"colspan",
",",
"rowspan... | Adds control with given data, default type, colspan and rowspan.
@param data data object
@param colspan colspan
@param rowspan rowspan
@return DynaFormControl added control | [
"Adds",
"control",
"with",
"given",
"data",
"default",
"type",
"colspan",
"and",
"rowspan",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L82-L84 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java | DynaFormRow.addControl | public DynaFormControl addControl(final Object data, final String type, final int colspan, final int rowspan) {
final DynaFormControl dynaFormControl = new DynaFormControl(data,
type,
colspan,
rowspan,
row,
elements.size() + 1,
dynaFormModel.getControls().size() + 1,
extended);
elements.add(dynaFormControl);
dynaFormModel.getControls().add(dynaFormControl);
totalColspan = totalColspan + colspan;
return dynaFormControl;
} | java | public DynaFormControl addControl(final Object data, final String type, final int colspan, final int rowspan) {
final DynaFormControl dynaFormControl = new DynaFormControl(data,
type,
colspan,
rowspan,
row,
elements.size() + 1,
dynaFormModel.getControls().size() + 1,
extended);
elements.add(dynaFormControl);
dynaFormModel.getControls().add(dynaFormControl);
totalColspan = totalColspan + colspan;
return dynaFormControl;
} | [
"public",
"DynaFormControl",
"addControl",
"(",
"final",
"Object",
"data",
",",
"final",
"String",
"type",
",",
"final",
"int",
"colspan",
",",
"final",
"int",
"rowspan",
")",
"{",
"final",
"DynaFormControl",
"dynaFormControl",
"=",
"new",
"DynaFormControl",
"("... | Adds control with given data, type, colspan and rowspan.
@param data data object
@param type type to match the type attribute in pe:dynaFormControl
@param colspan colspan
@param rowspan rowspan
@return DynaFormControl added control | [
"Adds",
"control",
"with",
"given",
"data",
"type",
"colspan",
"and",
"rowspan",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L95-L110 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java | DynaFormRow.addLabel | public DynaFormLabel addLabel(final String value, final int colspan, final int rowspan) {
return addLabel(value, true, colspan, rowspan);
} | java | public DynaFormLabel addLabel(final String value, final int colspan, final int rowspan) {
return addLabel(value, true, colspan, rowspan);
} | [
"public",
"DynaFormLabel",
"addLabel",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"colspan",
",",
"final",
"int",
"rowspan",
")",
"{",
"return",
"addLabel",
"(",
"value",
",",
"true",
",",
"colspan",
",",
"rowspan",
")",
";",
"}"
] | Adds a label with given text, colspan and rowspan.
@param value label text
@param colspan colspan
@param rowspan rowspan
@return DynaFormLabel added label | [
"Adds",
"a",
"label",
"with",
"given",
"text",
"colspan",
"and",
"rowspan",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L164-L166 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java | DynaFormRow.addLabel | public DynaFormLabel addLabel(final String value, final boolean escape, final int colspan, final int rowspan) {
final DynaFormLabel dynaFormLabel = new DynaFormLabel(value, escape, colspan, rowspan, row, elements.size() + 1, extended);
elements.add(dynaFormLabel);
dynaFormModel.getLabels().add(dynaFormLabel);
totalColspan = totalColspan + colspan;
return dynaFormLabel;
} | java | public DynaFormLabel addLabel(final String value, final boolean escape, final int colspan, final int rowspan) {
final DynaFormLabel dynaFormLabel = new DynaFormLabel(value, escape, colspan, rowspan, row, elements.size() + 1, extended);
elements.add(dynaFormLabel);
dynaFormModel.getLabels().add(dynaFormLabel);
totalColspan = totalColspan + colspan;
return dynaFormLabel;
} | [
"public",
"DynaFormLabel",
"addLabel",
"(",
"final",
"String",
"value",
",",
"final",
"boolean",
"escape",
",",
"final",
"int",
"colspan",
",",
"final",
"int",
"rowspan",
")",
"{",
"final",
"DynaFormLabel",
"dynaFormLabel",
"=",
"new",
"DynaFormLabel",
"(",
"v... | Adds a label with given text, escape flag, colspan and rowspan.
@param value label text
@param escape boolean flag if the label text should escaped or not
@param colspan colspan
@param rowspan rowspan
@return DynaFormLabel added label | [
"Adds",
"a",
"label",
"with",
"given",
"text",
"escape",
"flag",
"colspan",
"and",
"rowspan",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L177-L185 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getColumns | private void getColumns(final UIComponent parent) {
for (final UIComponent child : parent.getChildren()) {
if (child instanceof SheetColumn) {
columns.add((SheetColumn) child);
}
}
} | java | private void getColumns(final UIComponent parent) {
for (final UIComponent child : parent.getChildren()) {
if (child instanceof SheetColumn) {
columns.add((SheetColumn) child);
}
}
} | [
"private",
"void",
"getColumns",
"(",
"final",
"UIComponent",
"parent",
")",
"{",
"for",
"(",
"final",
"UIComponent",
"child",
":",
"parent",
".",
"getChildren",
"(",
")",
")",
"{",
"if",
"(",
"child",
"instanceof",
"SheetColumn",
")",
"{",
"columns",
".",... | Grabs the UIColumn children for the parent specified.
@param parent | [
"Grabs",
"the",
"UIColumn",
"children",
"for",
"the",
"parent",
"specified",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L191-L197 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.reset | public void reset() {
resetSubmitted();
resetSort();
resetInvalidUpdates();
localValues.clear();
for (final SheetColumn c : getColumns()) {
c.setFilterValue(null);
}
} | java | public void reset() {
resetSubmitted();
resetSort();
resetInvalidUpdates();
localValues.clear();
for (final SheetColumn c : getColumns()) {
c.setFilterValue(null);
}
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"resetSubmitted",
"(",
")",
";",
"resetSort",
"(",
")",
";",
"resetInvalidUpdates",
"(",
")",
";",
"localValues",
".",
"clear",
"(",
")",
";",
"for",
"(",
"final",
"SheetColumn",
"c",
":",
"getColumns",
"(",
")... | Resets all filters, sorting and submitted values. | [
"Resets",
"all",
"filters",
"sorting",
"and",
"submitted",
"values",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L252-L260 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.setSubmittedValue | public void setSubmittedValue(final FacesContext context, final String rowKey, final int col, final String value) {
submittedValues.put(new SheetRowColIndex(rowKey, col), value);
} | java | public void setSubmittedValue(final FacesContext context, final String rowKey, final int col, final String value) {
submittedValues.put(new SheetRowColIndex(rowKey, col), value);
} | [
"public",
"void",
"setSubmittedValue",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
",",
"final",
"String",
"value",
")",
"{",
"submittedValues",
".",
"put",
"(",
"new",
"SheetRowColIndex",
"(",
"rowKey... | Updates a submitted value.
@param row
@param col
@param value | [
"Updates",
"a",
"submitted",
"value",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L269-L271 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getSubmittedValue | public String getSubmittedValue(final String rowKey, final int col) {
return submittedValues.get(new SheetRowColIndex(rowKey, col));
} | java | public String getSubmittedValue(final String rowKey, final int col) {
return submittedValues.get(new SheetRowColIndex(rowKey, col));
} | [
"public",
"String",
"getSubmittedValue",
"(",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
")",
"{",
"return",
"submittedValues",
".",
"get",
"(",
"new",
"SheetRowColIndex",
"(",
"rowKey",
",",
"col",
")",
")",
";",
"}"
] | Retrieves the submitted value for the row and col.
@param row
@param col
@return | [
"Retrieves",
"the",
"submitted",
"value",
"for",
"the",
"row",
"and",
"col",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L280-L282 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.setLocalValue | public void setLocalValue(final String rowKey, final int col, final Object value) {
localValues.put(new SheetRowColIndex(rowKey, col), value);
} | java | public void setLocalValue(final String rowKey, final int col, final Object value) {
localValues.put(new SheetRowColIndex(rowKey, col), value);
} | [
"public",
"void",
"setLocalValue",
"(",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
",",
"final",
"Object",
"value",
")",
"{",
"localValues",
".",
"put",
"(",
"new",
"SheetRowColIndex",
"(",
"rowKey",
",",
"col",
")",
",",
"value",
")",
";",... | Updates a local value.
@param rowKey
@param col
@param value | [
"Updates",
"a",
"local",
"value",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L291-L293 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getLocalValue | public Object getLocalValue(final String rowKey, final int col) {
return localValues.get(new SheetRowColIndex(rowKey, col));
} | java | public Object getLocalValue(final String rowKey, final int col) {
return localValues.get(new SheetRowColIndex(rowKey, col));
} | [
"public",
"Object",
"getLocalValue",
"(",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
")",
"{",
"return",
"localValues",
".",
"get",
"(",
"new",
"SheetRowColIndex",
"(",
"rowKey",
",",
"col",
")",
")",
";",
"}"
] | Retrieves the submitted value for the rowKey and col.
@param row
@param col
@return | [
"Retrieves",
"the",
"submitted",
"value",
"for",
"the",
"rowKey",
"and",
"col",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L302-L304 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.setRowVar | public void setRowVar(final FacesContext context, final String rowKey) {
if (context == null) {
return;
}
if (rowKey == null) {
context.getExternalContext().getRequestMap().remove(getVar());
}
else {
final Object value = getRowMap().get(rowKey);
context.getExternalContext().getRequestMap().put(getVar(), value);
}
} | java | public void setRowVar(final FacesContext context, final String rowKey) {
if (context == null) {
return;
}
if (rowKey == null) {
context.getExternalContext().getRequestMap().remove(getVar());
}
else {
final Object value = getRowMap().get(rowKey);
context.getExternalContext().getRequestMap().put(getVar(), value);
}
} | [
"public",
"void",
"setRowVar",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"String",
"rowKey",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"rowKey",
"==",
"null",
")",
"{",
"context",
".",
"getExter... | Updates the row var for iterations over the list. The var value will be updated to the value for the specified rowKey.
@param context the FacesContext against which to the row var is set. Passed for performance
@param rowKey the rowKey string | [
"Updates",
"the",
"row",
"var",
"for",
"iterations",
"over",
"the",
"list",
".",
"The",
"var",
"value",
"will",
"be",
"updated",
"to",
"the",
"value",
"for",
"the",
"specified",
"rowKey",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L312-L325 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getValueForCell | public Object getValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a local value, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (localValues.containsKey(index)) {
return localValues.get(index);
}
setRowVar(context, rowKey);
final SheetColumn column = getColumns().get(col);
return column.getValueExpression("value").getValue(context.getELContext());
} | java | public Object getValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a local value, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (localValues.containsKey(index)) {
return localValues.get(index);
}
setRowVar(context, rowKey);
final SheetColumn column = getColumns().get(col);
return column.getValueExpression("value").getValue(context.getELContext());
} | [
"public",
"Object",
"getValueForCell",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
")",
"{",
"// if we have a local value, use it",
"// note: can't check for null, as null may be the submitted value",
"final",
"SheetR... | Gets the object value of the row and col specified. If a local value exists, that is returned, otherwise the actual value is return.
@param context
@param rowKey
@param col
@return | [
"Gets",
"the",
"object",
"value",
"of",
"the",
"row",
"and",
"col",
"specified",
".",
"If",
"a",
"local",
"value",
"exists",
"that",
"is",
"returned",
"otherwise",
"the",
"actual",
"value",
"is",
"return",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L342-L353 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getRenderValueForCell | public String getRenderValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a submitted value still, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (submittedValues.containsKey(index)) {
return submittedValues.get(index);
}
final Object value = getValueForCell(context, rowKey, col);
if (value == null) {
return null;
}
final SheetColumn column = getColumns().get(col);
final Converter converter = ComponentUtils.getConverter(context, column);
if (converter == null) {
return value.toString();
}
else {
return converter.getAsString(context, this, value);
}
} | java | public String getRenderValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a submitted value still, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (submittedValues.containsKey(index)) {
return submittedValues.get(index);
}
final Object value = getValueForCell(context, rowKey, col);
if (value == null) {
return null;
}
final SheetColumn column = getColumns().get(col);
final Converter converter = ComponentUtils.getConverter(context, column);
if (converter == null) {
return value.toString();
}
else {
return converter.getAsString(context, this, value);
}
} | [
"public",
"String",
"getRenderValueForCell",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
")",
"{",
"// if we have a submitted value still, use it",
"// note: can't check for null, as null may be the submitted value",
"f... | Gets the render string for the value the given cell. Applys the available converters to convert the value.
@param context
@param rowKey
@param col
@return | [
"Gets",
"the",
"render",
"string",
"for",
"the",
"value",
"the",
"given",
"cell",
".",
"Applys",
"the",
"available",
"converters",
"to",
"convert",
"the",
"value",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L363-L385 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getRowHeaderValueAsString | protected String getRowHeaderValueAsString(final FacesContext context) {
final ValueExpression veRowHeader = getRowHeaderValueExpression();
final Object value = veRowHeader.getValue(context.getELContext());
if (value == null) {
return Constants.EMPTY_STRING;
}
else {
return value.toString();
}
} | java | protected String getRowHeaderValueAsString(final FacesContext context) {
final ValueExpression veRowHeader = getRowHeaderValueExpression();
final Object value = veRowHeader.getValue(context.getELContext());
if (value == null) {
return Constants.EMPTY_STRING;
}
else {
return value.toString();
}
} | [
"protected",
"String",
"getRowHeaderValueAsString",
"(",
"final",
"FacesContext",
"context",
")",
"{",
"final",
"ValueExpression",
"veRowHeader",
"=",
"getRowHeaderValueExpression",
"(",
")",
";",
"final",
"Object",
"value",
"=",
"veRowHeader",
".",
"getValue",
"(",
... | Gets the row header text value as a string for use in javascript
@param context
@return | [
"Gets",
"the",
"row",
"header",
"text",
"value",
"as",
"a",
"string",
"for",
"use",
"in",
"javascript"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L393-L402 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getSortedValues | public List<Object> getSortedValues() {
List<Object> filtered = getFilteredValue();
if (filtered == null || filtered.isEmpty()) {
filtered = sortAndFilter();
}
return filtered;
} | java | public List<Object> getSortedValues() {
List<Object> filtered = getFilteredValue();
if (filtered == null || filtered.isEmpty()) {
filtered = sortAndFilter();
}
return filtered;
} | [
"public",
"List",
"<",
"Object",
">",
"getSortedValues",
"(",
")",
"{",
"List",
"<",
"Object",
">",
"filtered",
"=",
"getFilteredValue",
"(",
")",
";",
"if",
"(",
"filtered",
"==",
"null",
"||",
"filtered",
".",
"isEmpty",
"(",
")",
")",
"{",
"filtered... | The sorted list of values.
@return | [
"The",
"sorted",
"list",
"of",
"values",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L409-L415 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getSortColRenderIndex | public int getSortColRenderIndex() {
final ValueExpression veSortBy = getValueExpression(PropertyKeys.sortBy.name());
if (veSortBy == null) {
return -1;
}
final String sortByExp = veSortBy.getExpressionString();
int colIdx = 0;
for (final SheetColumn column : getColumns()) {
if (!column.isRendered()) {
continue;
}
final ValueExpression veCol = column.getValueExpression(PropertyKeys.sortBy.name());
if (veCol != null) {
if (veCol.getExpressionString().equals(sortByExp)) {
return colIdx;
}
}
colIdx++;
}
return -1;
} | java | public int getSortColRenderIndex() {
final ValueExpression veSortBy = getValueExpression(PropertyKeys.sortBy.name());
if (veSortBy == null) {
return -1;
}
final String sortByExp = veSortBy.getExpressionString();
int colIdx = 0;
for (final SheetColumn column : getColumns()) {
if (!column.isRendered()) {
continue;
}
final ValueExpression veCol = column.getValueExpression(PropertyKeys.sortBy.name());
if (veCol != null) {
if (veCol.getExpressionString().equals(sortByExp)) {
return colIdx;
}
}
colIdx++;
}
return -1;
} | [
"public",
"int",
"getSortColRenderIndex",
"(",
")",
"{",
"final",
"ValueExpression",
"veSortBy",
"=",
"getValueExpression",
"(",
"PropertyKeys",
".",
"sortBy",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"veSortBy",
"==",
"null",
")",
"{",
"return",
"-",
"... | Gets the rendered col index of the column corresponding to the current sortBy. This is used to keep track of the current sort column in the page.
@return | [
"Gets",
"the",
"rendered",
"col",
"index",
"of",
"the",
"column",
"corresponding",
"to",
"the",
"current",
"sortBy",
".",
"This",
"is",
"used",
"to",
"keep",
"track",
"of",
"the",
"current",
"sort",
"column",
"in",
"the",
"page",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L422-L444 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.sortAndFilter | public List<Object> sortAndFilter() {
final List filteredList = getFilteredValue();
filteredList.clear();
rowMap = new HashMap<>();
rowNumbers = new HashMap<>();
final Collection<?> values = (Collection<?>) getValue();
if (values == null || values.isEmpty()) {
return filteredList;
}
remapRows();
boolean filters = false;
for (final SheetColumn col : getColumns()) {
if (!LangUtils.isValueBlank(col.getFilterValue())) {
filters = true;
break;
}
}
final FacesContext context = FacesContext.getCurrentInstance();
final Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
final String var = getVar();
if (filters) {
// iterate and add those matching the filters
for (final Object obj : values) {
requestMap.put(var, obj);
if (matchesFilter(obj)) {
filteredList.add(obj);
}
}
}
else {
filteredList.addAll(values);
}
final ValueExpression veSortBy = getValueExpression(PropertyKeys.sortBy.name());
if (veSortBy != null) {
Collections.sort(filteredList, new BeanPropertyComparator(veSortBy, var, convertSortOrder(), null,
isCaseSensitiveSort(), Locale.ENGLISH, getNullSortOrder()));
}
// map filtered rows
remapFilteredList(filteredList);
return filteredList;
} | java | public List<Object> sortAndFilter() {
final List filteredList = getFilteredValue();
filteredList.clear();
rowMap = new HashMap<>();
rowNumbers = new HashMap<>();
final Collection<?> values = (Collection<?>) getValue();
if (values == null || values.isEmpty()) {
return filteredList;
}
remapRows();
boolean filters = false;
for (final SheetColumn col : getColumns()) {
if (!LangUtils.isValueBlank(col.getFilterValue())) {
filters = true;
break;
}
}
final FacesContext context = FacesContext.getCurrentInstance();
final Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
final String var = getVar();
if (filters) {
// iterate and add those matching the filters
for (final Object obj : values) {
requestMap.put(var, obj);
if (matchesFilter(obj)) {
filteredList.add(obj);
}
}
}
else {
filteredList.addAll(values);
}
final ValueExpression veSortBy = getValueExpression(PropertyKeys.sortBy.name());
if (veSortBy != null) {
Collections.sort(filteredList, new BeanPropertyComparator(veSortBy, var, convertSortOrder(), null,
isCaseSensitiveSort(), Locale.ENGLISH, getNullSortOrder()));
}
// map filtered rows
remapFilteredList(filteredList);
return filteredList;
} | [
"public",
"List",
"<",
"Object",
">",
"sortAndFilter",
"(",
")",
"{",
"final",
"List",
"filteredList",
"=",
"getFilteredValue",
"(",
")",
";",
"filteredList",
".",
"clear",
"(",
")",
";",
"rowMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"rowNumbers"... | Sorts and filters the data | [
"Sorts",
"and",
"filters",
"the",
"data"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L505-L552 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getRowKeyValue | @Override
protected Object getRowKeyValue(final FacesContext context) {
final ValueExpression veRowKey = getValueExpression(PropertyKeys.rowKey.name());
if (veRowKey == null) {
throw new RuntimeException("RowKey required on sheet!");
}
final Object value = veRowKey.getValue(context.getELContext());
if (value == null) {
throw new RuntimeException("RowKey must resolve to non-null value for updates to work properly");
}
return value;
} | java | @Override
protected Object getRowKeyValue(final FacesContext context) {
final ValueExpression veRowKey = getValueExpression(PropertyKeys.rowKey.name());
if (veRowKey == null) {
throw new RuntimeException("RowKey required on sheet!");
}
final Object value = veRowKey.getValue(context.getELContext());
if (value == null) {
throw new RuntimeException("RowKey must resolve to non-null value for updates to work properly");
}
return value;
} | [
"@",
"Override",
"protected",
"Object",
"getRowKeyValue",
"(",
"final",
"FacesContext",
"context",
")",
"{",
"final",
"ValueExpression",
"veRowKey",
"=",
"getValueExpression",
"(",
"PropertyKeys",
".",
"rowKey",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"veR... | Gets the rowKey for the current row
@param context the faces context
@return a row key value or null if the expression is not set | [
"Gets",
"the",
"rowKey",
"for",
"the",
"current",
"row"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L598-L609 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getRowKeyValueAsString | protected String getRowKeyValueAsString(final Object key) {
final String result = key.toString();
return "r_" + StringUtils.deleteWhitespace(result);
} | java | protected String getRowKeyValueAsString(final Object key) {
final String result = key.toString();
return "r_" + StringUtils.deleteWhitespace(result);
} | [
"protected",
"String",
"getRowKeyValueAsString",
"(",
"final",
"Object",
"key",
")",
"{",
"final",
"String",
"result",
"=",
"key",
".",
"toString",
"(",
")",
";",
"return",
"\"r_\"",
"+",
"StringUtils",
".",
"deleteWhitespace",
"(",
"result",
")",
";",
"}"
] | Gets the row key value as a String suitable for use in javascript rendering.
@param context
@return | [
"Gets",
"the",
"row",
"key",
"value",
"as",
"a",
"String",
"suitable",
"for",
"use",
"in",
"javascript",
"rendering",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L617-L620 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.convertSortOrder | protected SortOrder convertSortOrder() {
final String sortOrder = getSortOrder();
if (sortOrder == null) {
return SortOrder.UNSORTED;
}
else {
final SortOrder result = SortOrder.valueOf(sortOrder.toUpperCase(Locale.ENGLISH));
return result;
}
} | java | protected SortOrder convertSortOrder() {
final String sortOrder = getSortOrder();
if (sortOrder == null) {
return SortOrder.UNSORTED;
}
else {
final SortOrder result = SortOrder.valueOf(sortOrder.toUpperCase(Locale.ENGLISH));
return result;
}
} | [
"protected",
"SortOrder",
"convertSortOrder",
"(",
")",
"{",
"final",
"String",
"sortOrder",
"=",
"getSortOrder",
"(",
")",
";",
"if",
"(",
"sortOrder",
"==",
"null",
")",
"{",
"return",
"SortOrder",
".",
"UNSORTED",
";",
"}",
"else",
"{",
"final",
"SortOr... | Convert to PF SortOrder enum since we are leveraging PF sorting code.
@return | [
"Convert",
"to",
"PF",
"SortOrder",
"enum",
"since",
"we",
"are",
"leveraging",
"PF",
"sorting",
"code",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L637-L646 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.validate | @Override
public void validate(final FacesContext context) {
// iterate over submitted values and attempt to convert to the proper
// data type. For successful values, remove from submitted and add to
// local values map. for failures, add a conversion message and leave in
// the submitted state
final Iterator<Entry<SheetRowColIndex, String>> entries = submittedValues.entrySet().iterator();
final boolean hadBadUpdates = !getInvalidUpdates().isEmpty();
getInvalidUpdates().clear();
while (entries.hasNext()) {
final Entry<SheetRowColIndex, String> entry = entries.next();
final SheetColumn column = getColumns().get(entry.getKey().getColIndex());
final String newValue = entry.getValue();
final String rowKey = entry.getKey().getRowKey();
final int col = entry.getKey().getColIndex();
setRowVar(context, rowKey);
// attempt to convert new value from string to correct object type
// based on column converter. Use PF util as helper
final Converter converter = ComponentUtils.getConverter(context, column);
// assume string value if converter not found
Object newValueObj = newValue;
if (converter != null) {
try {
newValueObj = converter.getAsObject(context, this, newValue);
}
catch (final ConverterException e) {
// add offending cell to list of bad updates
// and to a StringBuilder for error messages (so we have one
// message for the component)
setValid(false);
FacesMessage message = e.getFacesMessage();
if (message == null) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage());
}
context.addMessage(this.getClientId(context), message);
final String messageText = message.getDetail();
getInvalidUpdates()
.add(new SheetInvalidUpdate(getRowKeyValue(context), col, column, newValue, messageText));
continue;
}
}
// value is fine, no further validations (again, not to be confused
// with validators. until we have a "required" or something like
// that, nothing else to do).
setLocalValue(rowKey, col, newValueObj);
// process validators on column
column.setValue(newValueObj);
try {
column.validate(context);
}
finally {
column.resetValue();
}
entries.remove();
}
setRowVar(context, null);
final boolean newBadUpdates = !getInvalidUpdates().isEmpty();
final String errorMessage = getErrorMessage();
if (hadBadUpdates || newBadUpdates) {
// update the bad data var if partial request
if (context.getPartialViewContext().isPartialRequest()) {
renderBadUpdateScript(context);
}
}
if (newBadUpdates && errorMessage != null) {
final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage);
context.addMessage(null, message);
}
} | java | @Override
public void validate(final FacesContext context) {
// iterate over submitted values and attempt to convert to the proper
// data type. For successful values, remove from submitted and add to
// local values map. for failures, add a conversion message and leave in
// the submitted state
final Iterator<Entry<SheetRowColIndex, String>> entries = submittedValues.entrySet().iterator();
final boolean hadBadUpdates = !getInvalidUpdates().isEmpty();
getInvalidUpdates().clear();
while (entries.hasNext()) {
final Entry<SheetRowColIndex, String> entry = entries.next();
final SheetColumn column = getColumns().get(entry.getKey().getColIndex());
final String newValue = entry.getValue();
final String rowKey = entry.getKey().getRowKey();
final int col = entry.getKey().getColIndex();
setRowVar(context, rowKey);
// attempt to convert new value from string to correct object type
// based on column converter. Use PF util as helper
final Converter converter = ComponentUtils.getConverter(context, column);
// assume string value if converter not found
Object newValueObj = newValue;
if (converter != null) {
try {
newValueObj = converter.getAsObject(context, this, newValue);
}
catch (final ConverterException e) {
// add offending cell to list of bad updates
// and to a StringBuilder for error messages (so we have one
// message for the component)
setValid(false);
FacesMessage message = e.getFacesMessage();
if (message == null) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage());
}
context.addMessage(this.getClientId(context), message);
final String messageText = message.getDetail();
getInvalidUpdates()
.add(new SheetInvalidUpdate(getRowKeyValue(context), col, column, newValue, messageText));
continue;
}
}
// value is fine, no further validations (again, not to be confused
// with validators. until we have a "required" or something like
// that, nothing else to do).
setLocalValue(rowKey, col, newValueObj);
// process validators on column
column.setValue(newValueObj);
try {
column.validate(context);
}
finally {
column.resetValue();
}
entries.remove();
}
setRowVar(context, null);
final boolean newBadUpdates = !getInvalidUpdates().isEmpty();
final String errorMessage = getErrorMessage();
if (hadBadUpdates || newBadUpdates) {
// update the bad data var if partial request
if (context.getPartialViewContext().isPartialRequest()) {
renderBadUpdateScript(context);
}
}
if (newBadUpdates && errorMessage != null) {
final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage);
context.addMessage(null, message);
}
} | [
"@",
"Override",
"public",
"void",
"validate",
"(",
"final",
"FacesContext",
"context",
")",
"{",
"// iterate over submitted values and attempt to convert to the proper",
"// data type. For successful values, remove from submitted and add to",
"// local values map. for failures, add a conv... | Converts each submitted value into a local value and stores it back in the hash. If all values convert without error, then the component is valid, and we
can proceed to the processUpdates. | [
"Converts",
"each",
"submitted",
"value",
"into",
"a",
"local",
"value",
"and",
"stores",
"it",
"back",
"in",
"the",
"hash",
".",
"If",
"all",
"values",
"convert",
"without",
"error",
"then",
"the",
"component",
"is",
"valid",
"and",
"we",
"can",
"proceed"... | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L652-L728 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.saveState | @Override
public Object saveState(final FacesContext context) {
final Object values[] = new Object[8];
values[0] = super.saveState(context);
values[1] = submittedValues;
values[2] = localValues;
values[3] = invalidUpdates;
values[4] = columnMapping;
values[5] = getFilteredValue();
values[6] = rowMap;
values[7] = rowNumbers;
return values;
} | java | @Override
public Object saveState(final FacesContext context) {
final Object values[] = new Object[8];
values[0] = super.saveState(context);
values[1] = submittedValues;
values[2] = localValues;
values[3] = invalidUpdates;
values[4] = columnMapping;
values[5] = getFilteredValue();
values[6] = rowMap;
values[7] = rowNumbers;
return values;
} | [
"@",
"Override",
"public",
"Object",
"saveState",
"(",
"final",
"FacesContext",
"context",
")",
"{",
"final",
"Object",
"values",
"[",
"]",
"=",
"new",
"Object",
"[",
"8",
"]",
";",
"values",
"[",
"0",
"]",
"=",
"super",
".",
"saveState",
"(",
"context... | Saves the state of the submitted and local values and the bad updates. | [
"Saves",
"the",
"state",
"of",
"the",
"submitted",
"and",
"local",
"values",
"and",
"the",
"bad",
"updates",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L770-L782 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.restoreState | @Override
public void restoreState(final FacesContext context, final Object state) {
if (state == null) {
return;
}
final Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
final Object restoredSubmittedValues = values[1];
final Object restoredLocalValues = values[2];
final Object restoredInvalidUpdates = values[3];
final Object restoredColMappings = values[4];
final Object restoredSortedList = values[5];
final Object restoredRowMap = values[6];
final Object restoredRowNumbers = values[7];
if (restoredSubmittedValues == null) {
submittedValues.clear();
}
else {
submittedValues = (Map<SheetRowColIndex, String>) restoredSubmittedValues;
}
if (restoredLocalValues == null) {
localValues.clear();
}
else {
localValues = (Map<SheetRowColIndex, Object>) restoredLocalValues;
}
if (restoredInvalidUpdates == null) {
getInvalidUpdates().clear();
}
else {
invalidUpdates = (List<SheetInvalidUpdate>) restoredInvalidUpdates;
}
if (restoredColMappings == null) {
columnMapping = null;
}
else {
columnMapping = (Map<Integer, Integer>) restoredColMappings;
}
if (restoredSortedList == null) {
getFilteredValue().clear();
}
else {
setFilteredValue((List<Object>) restoredSortedList);
}
if (restoredRowMap == null) {
rowMap = null;
}
else {
rowMap = (Map<String, Object>) restoredRowMap;
}
if (restoredRowNumbers == null) {
rowNumbers = null;
}
else {
rowNumbers = (Map<String, Integer>) restoredRowNumbers;
}
} | java | @Override
public void restoreState(final FacesContext context, final Object state) {
if (state == null) {
return;
}
final Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
final Object restoredSubmittedValues = values[1];
final Object restoredLocalValues = values[2];
final Object restoredInvalidUpdates = values[3];
final Object restoredColMappings = values[4];
final Object restoredSortedList = values[5];
final Object restoredRowMap = values[6];
final Object restoredRowNumbers = values[7];
if (restoredSubmittedValues == null) {
submittedValues.clear();
}
else {
submittedValues = (Map<SheetRowColIndex, String>) restoredSubmittedValues;
}
if (restoredLocalValues == null) {
localValues.clear();
}
else {
localValues = (Map<SheetRowColIndex, Object>) restoredLocalValues;
}
if (restoredInvalidUpdates == null) {
getInvalidUpdates().clear();
}
else {
invalidUpdates = (List<SheetInvalidUpdate>) restoredInvalidUpdates;
}
if (restoredColMappings == null) {
columnMapping = null;
}
else {
columnMapping = (Map<Integer, Integer>) restoredColMappings;
}
if (restoredSortedList == null) {
getFilteredValue().clear();
}
else {
setFilteredValue((List<Object>) restoredSortedList);
}
if (restoredRowMap == null) {
rowMap = null;
}
else {
rowMap = (Map<String, Object>) restoredRowMap;
}
if (restoredRowNumbers == null) {
rowNumbers = null;
}
else {
rowNumbers = (Map<String, Integer>) restoredRowNumbers;
}
} | [
"@",
"Override",
"public",
"void",
"restoreState",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Object",
"state",
")",
"{",
"if",
"(",
"state",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"Object",
"values",
"[",
"]",
"=",
"(",
"Obj... | Restores the state for the submitted, local and bad values. | [
"Restores",
"the",
"state",
"for",
"the",
"submitted",
"local",
"and",
"bad",
"values",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L787-L851 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getMappedColumn | public int getMappedColumn(final int renderCol) {
if (columnMapping == null || renderCol == -1) {
return renderCol;
}
else {
final Integer result = columnMapping.get(renderCol);
if (result == null) {
throw new IllegalArgumentException("Invalid index " + renderCol);
}
return result;
}
} | java | public int getMappedColumn(final int renderCol) {
if (columnMapping == null || renderCol == -1) {
return renderCol;
}
else {
final Integer result = columnMapping.get(renderCol);
if (result == null) {
throw new IllegalArgumentException("Invalid index " + renderCol);
}
return result;
}
} | [
"public",
"int",
"getMappedColumn",
"(",
"final",
"int",
"renderCol",
")",
"{",
"if",
"(",
"columnMapping",
"==",
"null",
"||",
"renderCol",
"==",
"-",
"1",
")",
"{",
"return",
"renderCol",
";",
"}",
"else",
"{",
"final",
"Integer",
"result",
"=",
"colum... | Maps the rendered column index to the real column index.
@param renderCol the rendered index
@return the mapped index | [
"Maps",
"the",
"rendered",
"column",
"index",
"to",
"the",
"real",
"column",
"index",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L929-L940 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getRenderIndexFromRealIdx | public int getRenderIndexFromRealIdx(final int realIdx) {
if (columnMapping == null || realIdx == -1) {
return realIdx;
}
for (final Entry<Integer, Integer> entry : columnMapping.entrySet()) {
if (entry.getValue().equals(realIdx)) {
return entry.getKey();
}
}
return realIdx;
} | java | public int getRenderIndexFromRealIdx(final int realIdx) {
if (columnMapping == null || realIdx == -1) {
return realIdx;
}
for (final Entry<Integer, Integer> entry : columnMapping.entrySet()) {
if (entry.getValue().equals(realIdx)) {
return entry.getKey();
}
}
return realIdx;
} | [
"public",
"int",
"getRenderIndexFromRealIdx",
"(",
"final",
"int",
"realIdx",
")",
"{",
"if",
"(",
"columnMapping",
"==",
"null",
"||",
"realIdx",
"==",
"-",
"1",
")",
"{",
"return",
"realIdx",
";",
"}",
"for",
"(",
"final",
"Entry",
"<",
"Integer",
",",... | Provides the render column index based on the real index
@param realIdx
@return | [
"Provides",
"the",
"render",
"column",
"index",
"based",
"on",
"the",
"real",
"index"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L948-L960 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.updateColumnMappings | public void updateColumnMappings() {
columnMapping = new HashMap<>();
int realIdx = 0;
int renderCol = 0;
for (final SheetColumn column : getColumns()) {
if (column.isRendered()) {
columnMapping.put(renderCol, realIdx);
renderCol++;
}
realIdx++;
}
} | java | public void updateColumnMappings() {
columnMapping = new HashMap<>();
int realIdx = 0;
int renderCol = 0;
for (final SheetColumn column : getColumns()) {
if (column.isRendered()) {
columnMapping.put(renderCol, realIdx);
renderCol++;
}
realIdx++;
}
} | [
"public",
"void",
"updateColumnMappings",
"(",
")",
"{",
"columnMapping",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"int",
"realIdx",
"=",
"0",
";",
"int",
"renderCol",
"=",
"0",
";",
"for",
"(",
"final",
"SheetColumn",
"column",
":",
"getColumns",
"("... | Updates the column mappings based on the rendered attribute | [
"Updates",
"the",
"column",
"mappings",
"based",
"on",
"the",
"rendered",
"attribute"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L965-L976 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getInvalidDataValue | public String getInvalidDataValue() {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, true);
for (final SheetInvalidUpdate sheetInvalidUpdate : getInvalidUpdates()) {
final Object rowKey = sheetInvalidUpdate.getInvalidRowKey();
final int col = getRenderIndexFromRealIdx(sheetInvalidUpdate.getInvalidColIndex());
final String rowKeyProperty = this.getRowKeyValueAsString(rowKey);
vb.appendProperty(rowKeyProperty + "_c" + col,
sheetInvalidUpdate.getInvalidMessage().replace("'", "'"), true);
}
return vb.closeVar().toString();
} | java | public String getInvalidDataValue() {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, true);
for (final SheetInvalidUpdate sheetInvalidUpdate : getInvalidUpdates()) {
final Object rowKey = sheetInvalidUpdate.getInvalidRowKey();
final int col = getRenderIndexFromRealIdx(sheetInvalidUpdate.getInvalidColIndex());
final String rowKeyProperty = this.getRowKeyValueAsString(rowKey);
vb.appendProperty(rowKeyProperty + "_c" + col,
sheetInvalidUpdate.getInvalidMessage().replace("'", "'"), true);
}
return vb.closeVar().toString();
} | [
"public",
"String",
"getInvalidDataValue",
"(",
")",
"{",
"final",
"JavascriptVarBuilder",
"vb",
"=",
"new",
"JavascriptVarBuilder",
"(",
"null",
",",
"true",
")",
";",
"for",
"(",
"final",
"SheetInvalidUpdate",
"sheetInvalidUpdate",
":",
"getInvalidUpdates",
"(",
... | Generates the bad data var value for this sheet.
@return | [
"Generates",
"the",
"bad",
"data",
"var",
"value",
"for",
"this",
"sheet",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L1029-L1039 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.renderRowUpdateScript | public void renderRowUpdateScript(final FacesContext context, final Set<String> dirtyRows) {
final String jsVar = resolveWidgetVar();
final StringBuilder eval = new StringBuilder();
for (final String rowKey : dirtyRows) {
setRowVar(context, rowKey);
final int rowIndex = rowNumbers.get(rowKey);
// data is array of array of data
final JavascriptVarBuilder jsRow = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder(null, true);
int renderCol = 0;
for (int col = 0; col < getColumns().size(); col++) {
final SheetColumn column = getColumns().get(col);
if (!column.isRendered()) {
continue;
}
// render data value
final String value = getRenderValueForCell(context, rowKey, col);
jsRow.appendArrayValue(value, true);
// custom style
final String styleClass = column.getStyleClass();
if (styleClass != null) {
jsStyle.appendRowColProperty(rowIndex, renderCol, styleClass, true);
}
// read only per cell
final boolean readOnly = column.isReadonlyCell();
if (readOnly) {
jsReadOnly.appendRowColProperty(rowIndex, renderCol, "true", true);
}
renderCol++;
}
eval.append("PF('").append(jsVar).append("')");
eval.append(".updateData('");
eval.append(rowIndex);
eval.append("',");
eval.append(jsRow.closeVar().toString());
eval.append(",");
eval.append(jsStyle.closeVar().toString());
eval.append(",");
eval.append(jsReadOnly.closeVar().toString());
eval.append(");");
}
eval.append("PF('").append(jsVar).append("')").append(".redraw();");
PrimeFaces.current().executeScript(eval.toString());
} | java | public void renderRowUpdateScript(final FacesContext context, final Set<String> dirtyRows) {
final String jsVar = resolveWidgetVar();
final StringBuilder eval = new StringBuilder();
for (final String rowKey : dirtyRows) {
setRowVar(context, rowKey);
final int rowIndex = rowNumbers.get(rowKey);
// data is array of array of data
final JavascriptVarBuilder jsRow = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder(null, true);
int renderCol = 0;
for (int col = 0; col < getColumns().size(); col++) {
final SheetColumn column = getColumns().get(col);
if (!column.isRendered()) {
continue;
}
// render data value
final String value = getRenderValueForCell(context, rowKey, col);
jsRow.appendArrayValue(value, true);
// custom style
final String styleClass = column.getStyleClass();
if (styleClass != null) {
jsStyle.appendRowColProperty(rowIndex, renderCol, styleClass, true);
}
// read only per cell
final boolean readOnly = column.isReadonlyCell();
if (readOnly) {
jsReadOnly.appendRowColProperty(rowIndex, renderCol, "true", true);
}
renderCol++;
}
eval.append("PF('").append(jsVar).append("')");
eval.append(".updateData('");
eval.append(rowIndex);
eval.append("',");
eval.append(jsRow.closeVar().toString());
eval.append(",");
eval.append(jsStyle.closeVar().toString());
eval.append(",");
eval.append(jsReadOnly.closeVar().toString());
eval.append(");");
}
eval.append("PF('").append(jsVar).append("')").append(".redraw();");
PrimeFaces.current().executeScript(eval.toString());
} | [
"public",
"void",
"renderRowUpdateScript",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Set",
"<",
"String",
">",
"dirtyRows",
")",
"{",
"final",
"String",
"jsVar",
"=",
"resolveWidgetVar",
"(",
")",
";",
"final",
"StringBuilder",
"eval",
"=",
"new"... | Adds eval scripts to the ajax response to update the rows dirtied by the most recent successful update request.
@param context the FacesContext
@param dirtyRows the set of dirty rows | [
"Adds",
"eval",
"scripts",
"to",
"the",
"ajax",
"response",
"to",
"update",
"the",
"rows",
"dirtied",
"by",
"the",
"most",
"recent",
"successful",
"update",
"request",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L1047-L1095 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.renderBadUpdateScript | public void renderBadUpdateScript(final FacesContext context) {
final String widgetVar = resolveWidgetVar();
final String invalidValue = getInvalidDataValue();
StringBuilder sb = new StringBuilder("PF('" + widgetVar + "')");
sb.append(".cfg.errors=");
sb.append(invalidValue);
sb.append(";");
sb.append("PF('" + widgetVar + "')");
sb.append(".ht.render();");
PrimeFaces.current().executeScript(sb.toString());
sb = new StringBuilder();
sb.append("PF('").append(widgetVar).append("')");
sb.append(".sheetDiv.removeClass('ui-state-error')");
if (!getInvalidUpdates().isEmpty()) {
sb.append(".addClass('ui-state-error')");
}
PrimeFaces.current().executeScript(sb.toString());
} | java | public void renderBadUpdateScript(final FacesContext context) {
final String widgetVar = resolveWidgetVar();
final String invalidValue = getInvalidDataValue();
StringBuilder sb = new StringBuilder("PF('" + widgetVar + "')");
sb.append(".cfg.errors=");
sb.append(invalidValue);
sb.append(";");
sb.append("PF('" + widgetVar + "')");
sb.append(".ht.render();");
PrimeFaces.current().executeScript(sb.toString());
sb = new StringBuilder();
sb.append("PF('").append(widgetVar).append("')");
sb.append(".sheetDiv.removeClass('ui-state-error')");
if (!getInvalidUpdates().isEmpty()) {
sb.append(".addClass('ui-state-error')");
}
PrimeFaces.current().executeScript(sb.toString());
} | [
"public",
"void",
"renderBadUpdateScript",
"(",
"final",
"FacesContext",
"context",
")",
"{",
"final",
"String",
"widgetVar",
"=",
"resolveWidgetVar",
"(",
")",
";",
"final",
"String",
"invalidValue",
"=",
"getInvalidDataValue",
"(",
")",
";",
"StringBuilder",
"sb... | Adds eval scripts to update the bad data array in the sheet to render validation failures produced by the most recent ajax update attempt.
@param context the FacesContext | [
"Adds",
"eval",
"scripts",
"to",
"update",
"the",
"bad",
"data",
"array",
"in",
"the",
"sheet",
"to",
"render",
"validation",
"failures",
"produced",
"by",
"the",
"most",
"recent",
"ajax",
"update",
"attempt",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L1102-L1120 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.appendUpdateEvent | public void appendUpdateEvent(final Object rowKey, final int colIndex, final Object rowData, final Object oldValue,
final Object newValue) {
updates.add(new SheetUpdate(rowKey, colIndex, rowData, oldValue, newValue));
} | java | public void appendUpdateEvent(final Object rowKey, final int colIndex, final Object rowData, final Object oldValue,
final Object newValue) {
updates.add(new SheetUpdate(rowKey, colIndex, rowData, oldValue, newValue));
} | [
"public",
"void",
"appendUpdateEvent",
"(",
"final",
"Object",
"rowKey",
",",
"final",
"int",
"colIndex",
",",
"final",
"Object",
"rowData",
",",
"final",
"Object",
"oldValue",
",",
"final",
"Object",
"newValue",
")",
"{",
"updates",
".",
"add",
"(",
"new",
... | Appends an update event | [
"Appends",
"an",
"update",
"event"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L1125-L1128 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java | SheetBase.getHeight | public Integer getHeight() {
final Object result = getStateHelper().eval(PropertyKeys.height);
if (result == null) {
return null;
}
// this will handle any type so long as its convertable to integer
return Integer.valueOf(result.toString());
} | java | public Integer getHeight() {
final Object result = getStateHelper().eval(PropertyKeys.height);
if (result == null) {
return null;
}
// this will handle any type so long as its convertable to integer
return Integer.valueOf(result.toString());
} | [
"public",
"Integer",
"getHeight",
"(",
")",
"{",
"final",
"Object",
"result",
"=",
"getStateHelper",
"(",
")",
".",
"eval",
"(",
"PropertyKeys",
".",
"height",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// this ... | The height of the sheet. Note this is applied to the inner div which is why it is recommend you use this property instead of a style class.
@return | [
"The",
"height",
"of",
"the",
"sheet",
".",
"Note",
"this",
"is",
"applied",
"to",
"the",
"inner",
"div",
"which",
"is",
"why",
"it",
"is",
"recommend",
"you",
"use",
"this",
"property",
"instead",
"of",
"a",
"style",
"class",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java#L701-L708 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java | SheetBase.setFilteredValue | public void setFilteredValue(final java.util.List _filteredValue) {
getStateHelper().put(PropertyKeys.filteredValue, _filteredValue);
} | java | public void setFilteredValue(final java.util.List _filteredValue) {
getStateHelper().put(PropertyKeys.filteredValue, _filteredValue);
} | [
"public",
"void",
"setFilteredValue",
"(",
"final",
"java",
".",
"util",
".",
"List",
"_filteredValue",
")",
"{",
"getStateHelper",
"(",
")",
".",
"put",
"(",
"PropertyKeys",
".",
"filteredValue",
",",
"_filteredValue",
")",
";",
"}"
] | Sets the filtered list.
@param _filteredValue the List to store | [
"Sets",
"the",
"filtered",
"list",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java#L741-L743 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java | SheetBase.getStyle | public String getStyle() {
final Object result = getStateHelper().eval(PropertyKeys.style, null);
if (result == null) {
return null;
}
return result.toString();
} | java | public String getStyle() {
final Object result = getStateHelper().eval(PropertyKeys.style, null);
if (result == null) {
return null;
}
return result.toString();
} | [
"public",
"String",
"getStyle",
"(",
")",
"{",
"final",
"Object",
"result",
"=",
"getStateHelper",
"(",
")",
".",
"eval",
"(",
"PropertyKeys",
".",
"style",
",",
"null",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}... | The style value
@return the style value | [
"The",
"style",
"value"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java#L769-L775 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java | SheetBase.getSortOrder | public String getSortOrder() {
// if we have a toggled sort in our state, use it
final String result = (String) getStateHelper().eval(PropertyKeys.sortOrder, SortOrder.ASCENDING.toString());
return result;
} | java | public String getSortOrder() {
// if we have a toggled sort in our state, use it
final String result = (String) getStateHelper().eval(PropertyKeys.sortOrder, SortOrder.ASCENDING.toString());
return result;
} | [
"public",
"String",
"getSortOrder",
"(",
")",
"{",
"// if we have a toggled sort in our state, use it",
"final",
"String",
"result",
"=",
"(",
"String",
")",
"getStateHelper",
"(",
")",
".",
"eval",
"(",
"PropertyKeys",
".",
"sortOrder",
",",
"SortOrder",
".",
"AS... | The sort direction
@return | [
"The",
"sort",
"direction"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java#L854-L858 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java | SheetBase.setSortOrder | public void setSortOrder(final java.lang.String sortOrder) {
// when updating, make sure we store off the original so it may be
// restored
final String orig = (String) getStateHelper().get(PropertyKeys.origSortOrder);
if (orig == null) {
// do not call getSortOrder as it defaults to ascending, we want
// null
// if this is the first call and there is no previous value.
getStateHelper().put(PropertyKeys.origSortOrder, getStateHelper().eval(PropertyKeys.sortOrder));
}
getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
} | java | public void setSortOrder(final java.lang.String sortOrder) {
// when updating, make sure we store off the original so it may be
// restored
final String orig = (String) getStateHelper().get(PropertyKeys.origSortOrder);
if (orig == null) {
// do not call getSortOrder as it defaults to ascending, we want
// null
// if this is the first call and there is no previous value.
getStateHelper().put(PropertyKeys.origSortOrder, getStateHelper().eval(PropertyKeys.sortOrder));
}
getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
} | [
"public",
"void",
"setSortOrder",
"(",
"final",
"java",
".",
"lang",
".",
"String",
"sortOrder",
")",
"{",
"// when updating, make sure we store off the original so it may be",
"// restored",
"final",
"String",
"orig",
"=",
"(",
"String",
")",
"getStateHelper",
"(",
"... | Update the sort direction
@param sortOrder | [
"Update",
"the",
"sort",
"direction"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java#L865-L876 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java | SheetBase.getErrorMessage | public String getErrorMessage() {
final Object result = getStateHelper().eval(PropertyKeys.errorMessage);
if (result == null) {
return null;
}
return result.toString();
} | java | public String getErrorMessage() {
final Object result = getStateHelper().eval(PropertyKeys.errorMessage);
if (result == null) {
return null;
}
return result.toString();
} | [
"public",
"String",
"getErrorMessage",
"(",
")",
"{",
"final",
"Object",
"result",
"=",
"getStateHelper",
"(",
")",
".",
"eval",
"(",
"PropertyKeys",
".",
"errorMessage",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | The error message to display when the sheet is in error.
@return | [
"The",
"error",
"message",
"to",
"display",
"when",
"the",
"sheet",
"is",
"in",
"error",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetBase.java#L883-L889 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/slideout/SlideOutRenderer.java | SlideOutRenderer.encodeHandle | private void encodeHandle(final FacesContext context, final SlideOut slideOut) throws IOException {
final ResponseWriter writer = context.getResponseWriter();
String styleClass = SlideOut.HANDLE_CLASS;
if (slideOut.getHandleStyleClass() != null) {
styleClass = styleClass + " " + slideOut.getHandleStyleClass();
}
writer.startElement("a", null);
writer.writeAttribute("id", getHandleId(context, slideOut), null);
if (slideOut.getHandleStyle() != null) {
writer.writeAttribute("style", slideOut.getHandleStyle(), "style");
}
writer.writeAttribute("class", styleClass, "styleClass");
// icon
encodeIcon(context, slideOut);
// handle text
if (slideOut.getTitle() != null) {
writer.writeText(slideOut.getTitle(), "title");
}
writer.endElement("a");
} | java | private void encodeHandle(final FacesContext context, final SlideOut slideOut) throws IOException {
final ResponseWriter writer = context.getResponseWriter();
String styleClass = SlideOut.HANDLE_CLASS;
if (slideOut.getHandleStyleClass() != null) {
styleClass = styleClass + " " + slideOut.getHandleStyleClass();
}
writer.startElement("a", null);
writer.writeAttribute("id", getHandleId(context, slideOut), null);
if (slideOut.getHandleStyle() != null) {
writer.writeAttribute("style", slideOut.getHandleStyle(), "style");
}
writer.writeAttribute("class", styleClass, "styleClass");
// icon
encodeIcon(context, slideOut);
// handle text
if (slideOut.getTitle() != null) {
writer.writeText(slideOut.getTitle(), "title");
}
writer.endElement("a");
} | [
"private",
"void",
"encodeHandle",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"SlideOut",
"slideOut",
")",
"throws",
"IOException",
"{",
"final",
"ResponseWriter",
"writer",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"String",
"styleClass... | HTML markup for the tab handle. | [
"HTML",
"markup",
"for",
"the",
"tab",
"handle",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/slideout/SlideOutRenderer.java#L102-L126 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/slideout/SlideOutRenderer.java | SlideOutRenderer.encodeIcon | private void encodeIcon(final FacesContext context, final SlideOut slideOut) throws IOException {
if (slideOut.getIcon() == null) {
return;
}
// fontawesome icons are OK but themeroller we need to add styles
String icon = slideOut.getIcon().trim();
if (icon.startsWith("ui")) {
icon = "ui-icon " + icon + " ui-slideouttab-icon";
}
// <i class="ui-icon fa fa-television"></i>
final ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", null);
writer.writeAttribute("class", icon, null);
writer.endElement("span");
writer.write(" ");
} | java | private void encodeIcon(final FacesContext context, final SlideOut slideOut) throws IOException {
if (slideOut.getIcon() == null) {
return;
}
// fontawesome icons are OK but themeroller we need to add styles
String icon = slideOut.getIcon().trim();
if (icon.startsWith("ui")) {
icon = "ui-icon " + icon + " ui-slideouttab-icon";
}
// <i class="ui-icon fa fa-television"></i>
final ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", null);
writer.writeAttribute("class", icon, null);
writer.endElement("span");
writer.write(" ");
} | [
"private",
"void",
"encodeIcon",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"SlideOut",
"slideOut",
")",
"throws",
"IOException",
"{",
"if",
"(",
"slideOut",
".",
"getIcon",
"(",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// fontawesome ic... | HTML markup for the tab handle icon if defined. | [
"HTML",
"markup",
"for",
"the",
"tab",
"handle",
"icon",
"if",
"defined",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/slideout/SlideOutRenderer.java#L131-L148 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java | DynaFormModel.createRegularRow | public DynaFormRow createRegularRow() {
final DynaFormRow dynaFormRow = new DynaFormRow(regularRows.size() + 1, false, this);
regularRows.add(dynaFormRow);
return dynaFormRow;
} | java | public DynaFormRow createRegularRow() {
final DynaFormRow dynaFormRow = new DynaFormRow(regularRows.size() + 1, false, this);
regularRows.add(dynaFormRow);
return dynaFormRow;
} | [
"public",
"DynaFormRow",
"createRegularRow",
"(",
")",
"{",
"final",
"DynaFormRow",
"dynaFormRow",
"=",
"new",
"DynaFormRow",
"(",
"regularRows",
".",
"size",
"(",
")",
"+",
"1",
",",
"false",
",",
"this",
")",
";",
"regularRows",
".",
"add",
"(",
"dynaFor... | Creates a new regular row.
@return {@link DynaFormRow} | [
"Creates",
"a",
"new",
"regular",
"row",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java#L69-L74 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java | DynaFormModel.createExtendedRow | public DynaFormRow createExtendedRow() {
if (extendedRows == null) {
extendedRows = new ArrayList<DynaFormRow>();
}
final DynaFormRow dynaFormRow = new DynaFormRow(extendedRows.size() + 1, true, this);
extendedRows.add(dynaFormRow);
return dynaFormRow;
} | java | public DynaFormRow createExtendedRow() {
if (extendedRows == null) {
extendedRows = new ArrayList<DynaFormRow>();
}
final DynaFormRow dynaFormRow = new DynaFormRow(extendedRows.size() + 1, true, this);
extendedRows.add(dynaFormRow);
return dynaFormRow;
} | [
"public",
"DynaFormRow",
"createExtendedRow",
"(",
")",
"{",
"if",
"(",
"extendedRows",
"==",
"null",
")",
"{",
"extendedRows",
"=",
"new",
"ArrayList",
"<",
"DynaFormRow",
">",
"(",
")",
";",
"}",
"final",
"DynaFormRow",
"dynaFormRow",
"=",
"new",
"DynaForm... | Creates a new extended row.
@return {@link DynaFormRow} | [
"Creates",
"a",
"new",
"extended",
"row",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java#L81-L90 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java | DynaFormModel.removeRegularRow | public void removeRegularRow(final DynaFormRow rowToBeRemoved) {
final int idx = rowToBeRemoved != null ? regularRows.indexOf(rowToBeRemoved) : -1;
if (idx >= 0) {
removeRow(regularRows, rowToBeRemoved, idx);
}
} | java | public void removeRegularRow(final DynaFormRow rowToBeRemoved) {
final int idx = rowToBeRemoved != null ? regularRows.indexOf(rowToBeRemoved) : -1;
if (idx >= 0) {
removeRow(regularRows, rowToBeRemoved, idx);
}
} | [
"public",
"void",
"removeRegularRow",
"(",
"final",
"DynaFormRow",
"rowToBeRemoved",
")",
"{",
"final",
"int",
"idx",
"=",
"rowToBeRemoved",
"!=",
"null",
"?",
"regularRows",
".",
"indexOf",
"(",
"rowToBeRemoved",
")",
":",
"-",
"1",
";",
"if",
"(",
"idx",
... | Removes the passed regular row.
@param rowToBeRemoved {@link DynaFormRow} to be removed | [
"Removes",
"the",
"passed",
"regular",
"row",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java#L97-L102 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java | DynaFormModel.removeExtendedRow | public void removeExtendedRow(final DynaFormRow rowToBeRemoved) {
final int idx = rowToBeRemoved != null ? extendedRows.indexOf(rowToBeRemoved) : -1;
if (idx >= 0) {
removeRow(extendedRows, rowToBeRemoved, idx);
}
} | java | public void removeExtendedRow(final DynaFormRow rowToBeRemoved) {
final int idx = rowToBeRemoved != null ? extendedRows.indexOf(rowToBeRemoved) : -1;
if (idx >= 0) {
removeRow(extendedRows, rowToBeRemoved, idx);
}
} | [
"public",
"void",
"removeExtendedRow",
"(",
"final",
"DynaFormRow",
"rowToBeRemoved",
")",
"{",
"final",
"int",
"idx",
"=",
"rowToBeRemoved",
"!=",
"null",
"?",
"extendedRows",
".",
"indexOf",
"(",
"rowToBeRemoved",
")",
":",
"-",
"1",
";",
"if",
"(",
"idx",... | Removes the passed extended row.
@param rowToBeRemoved {@link DynaFormRow} to be removed | [
"Removes",
"the",
"passed",
"extended",
"row",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormModel.java#L125-L130 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java | JavascriptVarBuilder.appendRowColProperty | public JavascriptVarBuilder appendRowColProperty(final int row, final int col, final String propertyValue, final boolean quoted) {
return appendProperty("r" + row + "_c" + col, propertyValue, quoted);
} | java | public JavascriptVarBuilder appendRowColProperty(final int row, final int col, final String propertyValue, final boolean quoted) {
return appendProperty("r" + row + "_c" + col, propertyValue, quoted);
} | [
"public",
"JavascriptVarBuilder",
"appendRowColProperty",
"(",
"final",
"int",
"row",
",",
"final",
"int",
"col",
",",
"final",
"String",
"propertyValue",
",",
"final",
"boolean",
"quoted",
")",
"{",
"return",
"appendProperty",
"(",
"\"r\"",
"+",
"row",
"+",
"... | appends a property with the name "rYY_cXX" where YY is the row and XX is he column.
@param row
@param col
@param propertyValue
@param quoted
@return | [
"appends",
"a",
"property",
"with",
"the",
"name",
"rYY_cXX",
"where",
"YY",
"is",
"the",
"row",
"and",
"XX",
"is",
"he",
"column",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java#L95-L97 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java | JavascriptVarBuilder.appendText | public JavascriptVarBuilder appendText(final String value, final boolean quoted) {
if (quoted) {
sb.append("\"");
if (value != null) {
sb.append(EscapeUtils.forJavaScript(value));
}
sb.append("\"");
}
else if (value != null) {
sb.append(value);
}
return this;
} | java | public JavascriptVarBuilder appendText(final String value, final boolean quoted) {
if (quoted) {
sb.append("\"");
if (value != null) {
sb.append(EscapeUtils.forJavaScript(value));
}
sb.append("\"");
}
else if (value != null) {
sb.append(value);
}
return this;
} | [
"public",
"JavascriptVarBuilder",
"appendText",
"(",
"final",
"String",
"value",
",",
"final",
"boolean",
"quoted",
")",
"{",
"if",
"(",
"quoted",
")",
"{",
"sb",
".",
"append",
"(",
"\"\\\"\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"sb... | Appends text to the var string
@param value the value to append
@param quoted if true, the value is quoted and escaped.
@return this builder | [
"Appends",
"text",
"to",
"the",
"var",
"string"
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java#L106-L118 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java | JavascriptVarBuilder.closeVar | public JavascriptVarBuilder closeVar() {
if (isObject) {
sb.append("}");
}
else {
sb.append("]");
}
if (isVar) {
sb.append(";");
}
return this;
} | java | public JavascriptVarBuilder closeVar() {
if (isObject) {
sb.append("}");
}
else {
sb.append("]");
}
if (isVar) {
sb.append(";");
}
return this;
} | [
"public",
"JavascriptVarBuilder",
"closeVar",
"(",
")",
"{",
"if",
"(",
"isObject",
")",
"{",
"sb",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"\"]\"",
")",
";",
"}",
"if",
"(",
"isVar",
")",
"{",
"sb",
"."... | Closes the array or object.
@return | [
"Closes",
"the",
"array",
"or",
"object",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java#L137-L149 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetColumn.java | SheetColumn.getHeaderText | public String getHeaderText() {
final Object result = getStateHelper().eval(PropertyKeys.headerText, null);
if (result == null) {
return null;
}
return result.toString();
} | java | public String getHeaderText() {
final Object result = getStateHelper().eval(PropertyKeys.headerText, null);
if (result == null) {
return null;
}
return result.toString();
} | [
"public",
"String",
"getHeaderText",
"(",
")",
"{",
"final",
"Object",
"result",
"=",
"getStateHelper",
"(",
")",
".",
"eval",
"(",
"PropertyKeys",
".",
"headerText",
",",
"null",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"null",
... | The fixed column count.
@return | [
"The",
"fixed",
"column",
"count",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetColumn.java#L209-L215 | train |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetColumn.java | SheetColumn.isReadonlyCell | public Boolean isReadonlyCell() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.readonlyCell, Boolean.FALSE).toString());
} | java | public Boolean isReadonlyCell() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.readonlyCell, Boolean.FALSE).toString());
} | [
"public",
"Boolean",
"isReadonlyCell",
"(",
")",
"{",
"return",
"Boolean",
".",
"valueOf",
"(",
"getStateHelper",
"(",
")",
".",
"eval",
"(",
"PropertyKeys",
".",
"readonlyCell",
",",
"Boolean",
".",
"FALSE",
")",
".",
"toString",
"(",
")",
")",
";",
"}"... | Flag indicating whether this cell is read only. the var reference will be available.
@return true if read only, otherwise false | [
"Flag",
"indicating",
"whether",
"this",
"cell",
"is",
"read",
"only",
".",
"the",
"var",
"reference",
"will",
"be",
"available",
"."
] | afdbca591f60f47898e3517e1e939bc2f63d5355 | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetColumn.java#L249-L251 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.