id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
152,300
mbenson/uelbox
src/main/java/uelbox/UEL.java
UEL.join
public static String join(final char trigger, final String... expressions) { Validate.notEmpty(expressions); final StringBuilder buf = new StringBuilder(); for (String expression : expressions) { final String stripped = strip(expression); if (expression.isEmpty()) { continue; } final int len = buf.length(); if (len > 0) { final int end = len - 1; final char last = buf.charAt(end); final char first = stripped.charAt(0); switch (first) { case DOT: case LBRACK: if (last == DOT) { buf.deleteCharAt(end); } break; default: if (last != DOT) { buf.append(DOT); } break; } } buf.append(stripped); } return embed(buf.toString(), trigger); }
java
public static String join(final char trigger, final String... expressions) { Validate.notEmpty(expressions); final StringBuilder buf = new StringBuilder(); for (String expression : expressions) { final String stripped = strip(expression); if (expression.isEmpty()) { continue; } final int len = buf.length(); if (len > 0) { final int end = len - 1; final char last = buf.charAt(end); final char first = stripped.charAt(0); switch (first) { case DOT: case LBRACK: if (last == DOT) { buf.deleteCharAt(end); } break; default: if (last != DOT) { buf.append(DOT); } break; } } buf.append(stripped); } return embed(buf.toString(), trigger); }
[ "public", "static", "String", "join", "(", "final", "char", "trigger", ",", "final", "String", "...", "expressions", ")", "{", "Validate", ".", "notEmpty", "(", "expressions", ")", ";", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "expression", ":", "expressions", ")", "{", "final", "String", "stripped", "=", "strip", "(", "expression", ")", ";", "if", "(", "expression", ".", "isEmpty", "(", ")", ")", "{", "continue", ";", "}", "final", "int", "len", "=", "buf", ".", "length", "(", ")", ";", "if", "(", "len", ">", "0", ")", "{", "final", "int", "end", "=", "len", "-", "1", ";", "final", "char", "last", "=", "buf", ".", "charAt", "(", "end", ")", ";", "final", "char", "first", "=", "stripped", ".", "charAt", "(", "0", ")", ";", "switch", "(", "first", ")", "{", "case", "DOT", ":", "case", "LBRACK", ":", "if", "(", "last", "==", "DOT", ")", "{", "buf", ".", "deleteCharAt", "(", "end", ")", ";", "}", "break", ";", "default", ":", "if", "(", "last", "!=", "DOT", ")", "{", "buf", ".", "append", "(", "DOT", ")", ";", "}", "break", ";", "}", "}", "buf", ".", "append", "(", "stripped", ")", ";", "}", "return", "embed", "(", "buf", ".", "toString", "(", ")", ",", "trigger", ")", ";", "}" ]
Join expressions using the specified trigger character. @param trigger @param expressions @return String
[ "Join", "expressions", "using", "the", "specified", "trigger", "character", "." ]
b0c2df2c738295bddfd3c16a916e67c9c7c512ef
https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L202-L237
152,301
mbenson/uelbox
src/main/java/uelbox/UEL.java
UEL.coerceToType
public static <T> T coerceToType(ELContext context, Class<T> toType, Object object) { @SuppressWarnings("unchecked") T result = (T) getExpressionFactory(context).coerceToType(object, toType); return result; }
java
public static <T> T coerceToType(ELContext context, Class<T> toType, Object object) { @SuppressWarnings("unchecked") T result = (T) getExpressionFactory(context).coerceToType(object, toType); return result; }
[ "public", "static", "<", "T", ">", "T", "coerceToType", "(", "ELContext", "context", ",", "Class", "<", "T", ">", "toType", ",", "Object", "object", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "result", "=", "(", "T", ")", "getExpressionFactory", "(", "context", ")", ".", "coerceToType", "(", "object", ",", "toType", ")", ";", "return", "result", ";", "}" ]
Use EL specification coercion facilities to coerce an object to the specified type. @param context @param toType @param object @return T @throws ELException if the coercion fails.
[ "Use", "EL", "specification", "coercion", "facilities", "to", "coerce", "an", "object", "to", "the", "specified", "type", "." ]
b0c2df2c738295bddfd3c16a916e67c9c7c512ef
https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L248-L252
152,302
js-lib-com/transaction.hibernate
src/main/java/js/transaction/hibernate/HqlQueryImpl.java
HqlQueryImpl.query
private org.hibernate.Query query(String hql, Class<?>... type) { org.hibernate.Query q = session.createQuery(hql); for(int i = 0; i < positionedParameters.length; i++) { q.setParameter(i, positionedParameters[i]); } for(Map.Entry<String, Object> entry : namedParameters.entrySet()) { Object value = entry.getValue(); if(Types.isArray(value)) { Object[] parameter = (Object[])value; if(parameter.length == 0) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else if(Types.isCollection(value)) { Collection<?> parameter = (Collection<?>)value; if(parameter.isEmpty()) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else { q.setParameter(entry.getKey(), value); } } if(offset > 0) { q.setFirstResult(offset); } if(rowsCount > 0) { q.setMaxResults(rowsCount); } if(type.length > 0) { q.setResultTransformer(Transformers.aliasToBean(type[0])); } return q; }
java
private org.hibernate.Query query(String hql, Class<?>... type) { org.hibernate.Query q = session.createQuery(hql); for(int i = 0; i < positionedParameters.length; i++) { q.setParameter(i, positionedParameters[i]); } for(Map.Entry<String, Object> entry : namedParameters.entrySet()) { Object value = entry.getValue(); if(Types.isArray(value)) { Object[] parameter = (Object[])value; if(parameter.length == 0) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else if(Types.isCollection(value)) { Collection<?> parameter = (Collection<?>)value; if(parameter.isEmpty()) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else { q.setParameter(entry.getKey(), value); } } if(offset > 0) { q.setFirstResult(offset); } if(rowsCount > 0) { q.setMaxResults(rowsCount); } if(type.length > 0) { q.setResultTransformer(Transformers.aliasToBean(type[0])); } return q; }
[ "private", "org", ".", "hibernate", ".", "Query", "query", "(", "String", "hql", ",", "Class", "<", "?", ">", "...", "type", ")", "{", "org", ".", "hibernate", ".", "Query", "q", "=", "session", ".", "createQuery", "(", "hql", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "positionedParameters", ".", "length", ";", "i", "++", ")", "{", "q", ".", "setParameter", "(", "i", ",", "positionedParameters", "[", "i", "]", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "namedParameters", ".", "entrySet", "(", ")", ")", "{", "Object", "value", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "Types", ".", "isArray", "(", "value", ")", ")", "{", "Object", "[", "]", "parameter", "=", "(", "Object", "[", "]", ")", "value", ";", "if", "(", "parameter", ".", "length", "==", "0", ")", "{", "throw", "new", "HibernateException", "(", "String", ".", "format", "(", "\"Invalid named parameter |%s|. Empty array.\"", ",", "entry", ".", "getKey", "(", ")", ")", ")", ";", "}", "q", ".", "setParameterList", "(", "entry", ".", "getKey", "(", ")", ",", "parameter", ")", ";", "}", "else", "if", "(", "Types", ".", "isCollection", "(", "value", ")", ")", "{", "Collection", "<", "?", ">", "parameter", "=", "(", "Collection", "<", "?", ">", ")", "value", ";", "if", "(", "parameter", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "HibernateException", "(", "String", ".", "format", "(", "\"Invalid named parameter |%s|. Empty list.\"", ",", "entry", ".", "getKey", "(", ")", ")", ")", ";", "}", "q", ".", "setParameterList", "(", "entry", ".", "getKey", "(", ")", ",", "parameter", ")", ";", "}", "else", "{", "q", ".", "setParameter", "(", "entry", ".", "getKey", "(", ")", ",", "value", ")", ";", "}", "}", "if", "(", "offset", ">", "0", ")", "{", "q", ".", "setFirstResult", "(", "offset", ")", ";", "}", "if", "(", "rowsCount", ">", "0", ")", "{", "q", ".", "setMaxResults", "(", "rowsCount", ")", ";", "}", "if", "(", "type", ".", "length", ">", "0", ")", "{", "q", ".", "setResultTransformer", "(", "Transformers", ".", "aliasToBean", "(", "type", "[", "0", "]", ")", ")", ";", "}", "return", "q", ";", "}" ]
Create Hibernate query object and initialize it from this helper properties. @param hql query string expressed in HQL. @return newly created Hibernate query object.
[ "Create", "Hibernate", "query", "object", "and", "initialize", "it", "from", "this", "helper", "properties", "." ]
3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6
https://github.com/js-lib-com/transaction.hibernate/blob/3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6/src/main/java/js/transaction/hibernate/HqlQueryImpl.java#L220-L257
152,303
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/AbstractMatrix.java
AbstractMatrix.getInstance
public static AbstractMatrix getInstance(int rows, int cols, Class<?> cls) { return new AbstractMatrix(rows, Array.newInstance(cls, rows*cols)); }
java
public static AbstractMatrix getInstance(int rows, int cols, Class<?> cls) { return new AbstractMatrix(rows, Array.newInstance(cls, rows*cols)); }
[ "public", "static", "AbstractMatrix", "getInstance", "(", "int", "rows", ",", "int", "cols", ",", "Class", "<", "?", ">", "cls", ")", "{", "return", "new", "AbstractMatrix", "(", "rows", ",", "Array", ".", "newInstance", "(", "cls", ",", "rows", "*", "cols", ")", ")", ";", "}" ]
Returns new DoubleMatrix initialized to zeroes. @param rows @param cols @return
[ "Returns", "new", "DoubleMatrix", "initialized", "to", "zeroes", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/AbstractMatrix.java#L65-L68
152,304
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/AbstractMatrix.java
AbstractMatrix.swapRows
public void swapRows(int r1, int r2, Object tmp) { int col = columns(); System.arraycopy(array, col * r1, tmp, 0, col); System.arraycopy(array, col * r2, array, col * r1, col); System.arraycopy(tmp, 0, array, col * r2, col); }
java
public void swapRows(int r1, int r2, Object tmp) { int col = columns(); System.arraycopy(array, col * r1, tmp, 0, col); System.arraycopy(array, col * r2, array, col * r1, col); System.arraycopy(tmp, 0, array, col * r2, col); }
[ "public", "void", "swapRows", "(", "int", "r1", ",", "int", "r2", ",", "Object", "tmp", ")", "{", "int", "col", "=", "columns", "(", ")", ";", "System", ".", "arraycopy", "(", "array", ",", "col", "*", "r1", ",", "tmp", ",", "0", ",", "col", ")", ";", "System", ".", "arraycopy", "(", "array", ",", "col", "*", "r2", ",", "array", ",", "col", "*", "r1", ",", "col", ")", ";", "System", ".", "arraycopy", "(", "tmp", ",", "0", ",", "array", ",", "col", "*", "r2", ",", "col", ")", ";", "}" ]
Swaps row r1 and r2 possibly using tmp @param r1 @param r2 @param tmp double [columns]
[ "Swaps", "row", "r1", "and", "r2", "possibly", "using", "tmp" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/AbstractMatrix.java#L164-L170
152,305
FitLayout/classify
src/main/java/org/fit/layout/classify/VisualClassifier.java
VisualClassifier.classifyTree
public void classifyTree(Area root, FeatureExtractor features) { if (classifier != null) { System.out.print("tree visual classification..."); testRoot = root; this.features = features; //create a new empty set with the same header as the training set testset = new Instances(trainset, 0); //create an empty mapping mapping = new HashMap<Area, Instance>(); //fill the set with the data recursivelyExtractAreaData(testRoot); System.out.println("done"); } }
java
public void classifyTree(Area root, FeatureExtractor features) { if (classifier != null) { System.out.print("tree visual classification..."); testRoot = root; this.features = features; //create a new empty set with the same header as the training set testset = new Instances(trainset, 0); //create an empty mapping mapping = new HashMap<Area, Instance>(); //fill the set with the data recursivelyExtractAreaData(testRoot); System.out.println("done"); } }
[ "public", "void", "classifyTree", "(", "Area", "root", ",", "FeatureExtractor", "features", ")", "{", "if", "(", "classifier", "!=", "null", ")", "{", "System", ".", "out", ".", "print", "(", "\"tree visual classification...\"", ")", ";", "testRoot", "=", "root", ";", "this", ".", "features", "=", "features", ";", "//create a new empty set with the same header as the training set", "testset", "=", "new", "Instances", "(", "trainset", ",", "0", ")", ";", "//create an empty mapping", "mapping", "=", "new", "HashMap", "<", "Area", ",", "Instance", ">", "(", ")", ";", "//fill the set with the data", "recursivelyExtractAreaData", "(", "testRoot", ")", ";", "System", ".", "out", ".", "println", "(", "\"done\"", ")", ";", "}", "}" ]
Classifies the areas in an area tree. @param root the root node of the area tree
[ "Classifies", "the", "areas", "in", "an", "area", "tree", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/VisualClassifier.java#L56-L71
152,306
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/builder/ImageFilterQueryBuilder.java
ImageFilterQueryBuilder.getImagesWithFileNameSubquery
private Subquery<ImageFile> getImagesWithFileNameSubquery(final String filename, final FilterStringLogic searchLogic) { final CriteriaBuilder criteriaBuilder = getCriteriaBuilder(); final Subquery<ImageFile> subQuery = getCriteriaQuery().subquery(ImageFile.class); final Root<LanguageImage> root = subQuery.from(LanguageImage.class); subQuery.select(root.get("imageFile").as(ImageFile.class)); // Create the Condition for the subquery final Predicate imageIdMatch = criteriaBuilder.equal(getRootPath().get("imageFileId"), root.get("imageFile").get("imageFileId")); final Predicate filenameMatch; if (searchLogic == FilterStringLogic.MATCHES) { filenameMatch = criteriaBuilder.equal(root.get("originalFileName"), filename); } else { filenameMatch = criteriaBuilder.like(criteriaBuilder.lower(root.get("originalFileName").as(String.class)), '%' + cleanLikeCondition(filename).toLowerCase() + '%'); } subQuery.where(criteriaBuilder.and(imageIdMatch, filenameMatch)); return subQuery; }
java
private Subquery<ImageFile> getImagesWithFileNameSubquery(final String filename, final FilterStringLogic searchLogic) { final CriteriaBuilder criteriaBuilder = getCriteriaBuilder(); final Subquery<ImageFile> subQuery = getCriteriaQuery().subquery(ImageFile.class); final Root<LanguageImage> root = subQuery.from(LanguageImage.class); subQuery.select(root.get("imageFile").as(ImageFile.class)); // Create the Condition for the subquery final Predicate imageIdMatch = criteriaBuilder.equal(getRootPath().get("imageFileId"), root.get("imageFile").get("imageFileId")); final Predicate filenameMatch; if (searchLogic == FilterStringLogic.MATCHES) { filenameMatch = criteriaBuilder.equal(root.get("originalFileName"), filename); } else { filenameMatch = criteriaBuilder.like(criteriaBuilder.lower(root.get("originalFileName").as(String.class)), '%' + cleanLikeCondition(filename).toLowerCase() + '%'); } subQuery.where(criteriaBuilder.and(imageIdMatch, filenameMatch)); return subQuery; }
[ "private", "Subquery", "<", "ImageFile", ">", "getImagesWithFileNameSubquery", "(", "final", "String", "filename", ",", "final", "FilterStringLogic", "searchLogic", ")", "{", "final", "CriteriaBuilder", "criteriaBuilder", "=", "getCriteriaBuilder", "(", ")", ";", "final", "Subquery", "<", "ImageFile", ">", "subQuery", "=", "getCriteriaQuery", "(", ")", ".", "subquery", "(", "ImageFile", ".", "class", ")", ";", "final", "Root", "<", "LanguageImage", ">", "root", "=", "subQuery", ".", "from", "(", "LanguageImage", ".", "class", ")", ";", "subQuery", ".", "select", "(", "root", ".", "get", "(", "\"imageFile\"", ")", ".", "as", "(", "ImageFile", ".", "class", ")", ")", ";", "// Create the Condition for the subquery", "final", "Predicate", "imageIdMatch", "=", "criteriaBuilder", ".", "equal", "(", "getRootPath", "(", ")", ".", "get", "(", "\"imageFileId\"", ")", ",", "root", ".", "get", "(", "\"imageFile\"", ")", ".", "get", "(", "\"imageFileId\"", ")", ")", ";", "final", "Predicate", "filenameMatch", ";", "if", "(", "searchLogic", "==", "FilterStringLogic", ".", "MATCHES", ")", "{", "filenameMatch", "=", "criteriaBuilder", ".", "equal", "(", "root", ".", "get", "(", "\"originalFileName\"", ")", ",", "filename", ")", ";", "}", "else", "{", "filenameMatch", "=", "criteriaBuilder", ".", "like", "(", "criteriaBuilder", ".", "lower", "(", "root", ".", "get", "(", "\"originalFileName\"", ")", ".", "as", "(", "String", ".", "class", ")", ")", ",", "'", "'", "+", "cleanLikeCondition", "(", "filename", ")", ".", "toLowerCase", "(", ")", "+", "'", "'", ")", ";", "}", "subQuery", ".", "where", "(", "criteriaBuilder", ".", "and", "(", "imageIdMatch", ",", "filenameMatch", ")", ")", ";", "return", "subQuery", ";", "}" ]
Create a Subquery to check if a image has a specific filename. @param filename The Value that the property tag should have. @return A subquery that can be used in an exists statement to see if a topic has a property tag with the specified value.
[ "Create", "a", "Subquery", "to", "check", "if", "a", "image", "has", "a", "specific", "filename", "." ]
2bb23430adab956737d0301cd2ea933f986dd85b
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/builder/ImageFilterQueryBuilder.java#L91-L109
152,307
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.connectionClosed
protected void connectionClosed(IoSession session) { this.connected = false; this._disconnect(); log.info("Connection lost to aggregator at {}:{}", this.host, Integer.valueOf(this.port)); while (this.stayConnected) { try { Thread.sleep(this.connectionRetryDelay); } catch (InterruptedException ie) { // Ignored } log.warn("Reconnecting to aggregator at {}:{}", this.host, Integer.valueOf(this.port)); if (this.connect(this.connectionTimeout)) { return; } log.warn("Failed to reconnect to aggregator at {}:{}", this.host, Integer.valueOf(this.port)); } this.finishConnection(); }
java
protected void connectionClosed(IoSession session) { this.connected = false; this._disconnect(); log.info("Connection lost to aggregator at {}:{}", this.host, Integer.valueOf(this.port)); while (this.stayConnected) { try { Thread.sleep(this.connectionRetryDelay); } catch (InterruptedException ie) { // Ignored } log.warn("Reconnecting to aggregator at {}:{}", this.host, Integer.valueOf(this.port)); if (this.connect(this.connectionTimeout)) { return; } log.warn("Failed to reconnect to aggregator at {}:{}", this.host, Integer.valueOf(this.port)); } this.finishConnection(); }
[ "protected", "void", "connectionClosed", "(", "IoSession", "session", ")", "{", "this", ".", "connected", "=", "false", ";", "this", ".", "_disconnect", "(", ")", ";", "log", ".", "info", "(", "\"Connection lost to aggregator at {}:{}\"", ",", "this", ".", "host", ",", "Integer", ".", "valueOf", "(", "this", ".", "port", ")", ")", ";", "while", "(", "this", ".", "stayConnected", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "this", ".", "connectionRetryDelay", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "// Ignored", "}", "log", ".", "warn", "(", "\"Reconnecting to aggregator at {}:{}\"", ",", "this", ".", "host", ",", "Integer", ".", "valueOf", "(", "this", ".", "port", ")", ")", ";", "if", "(", "this", ".", "connect", "(", "this", ".", "connectionTimeout", ")", ")", "{", "return", ";", "}", "log", ".", "warn", "(", "\"Failed to reconnect to aggregator at {}:{}\"", ",", "this", ".", "host", ",", "Integer", ".", "valueOf", "(", "this", ".", "port", ")", ")", ";", "}", "this", ".", "finishConnection", "(", ")", ";", "}" ]
Called when the connection to the aggregator closes. @param session the connection that closed.
[ "Called", "when", "the", "connection", "to", "the", "aggregator", "closes", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L535-L558
152,308
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.handshakeReceived
protected void handshakeReceived(IoSession session, HandshakeMessage handshakeMessage) { log.debug("Received {}", handshakeMessage); this.receivedHandshake = handshakeMessage; Boolean handshakeCheck = this.checkHandshake(); if (handshakeCheck == null) { return; } if (Boolean.FALSE.equals(handshakeCheck)) { log.warn("Handshakes did not match."); this._disconnect(); } if (Boolean.TRUE.equals(handshakeCheck)) { SubscriptionMessage msg = this.generateGenericSubscriptionMessage(); this.session.write(msg); this.connected = true; } }
java
protected void handshakeReceived(IoSession session, HandshakeMessage handshakeMessage) { log.debug("Received {}", handshakeMessage); this.receivedHandshake = handshakeMessage; Boolean handshakeCheck = this.checkHandshake(); if (handshakeCheck == null) { return; } if (Boolean.FALSE.equals(handshakeCheck)) { log.warn("Handshakes did not match."); this._disconnect(); } if (Boolean.TRUE.equals(handshakeCheck)) { SubscriptionMessage msg = this.generateGenericSubscriptionMessage(); this.session.write(msg); this.connected = true; } }
[ "protected", "void", "handshakeReceived", "(", "IoSession", "session", ",", "HandshakeMessage", "handshakeMessage", ")", "{", "log", ".", "debug", "(", "\"Received {}\"", ",", "handshakeMessage", ")", ";", "this", ".", "receivedHandshake", "=", "handshakeMessage", ";", "Boolean", "handshakeCheck", "=", "this", ".", "checkHandshake", "(", ")", ";", "if", "(", "handshakeCheck", "==", "null", ")", "{", "return", ";", "}", "if", "(", "Boolean", ".", "FALSE", ".", "equals", "(", "handshakeCheck", ")", ")", "{", "log", ".", "warn", "(", "\"Handshakes did not match.\"", ")", ";", "this", ".", "_disconnect", "(", ")", ";", "}", "if", "(", "Boolean", ".", "TRUE", ".", "equals", "(", "handshakeCheck", ")", ")", "{", "SubscriptionMessage", "msg", "=", "this", ".", "generateGenericSubscriptionMessage", "(", ")", ";", "this", ".", "session", ".", "write", "(", "msg", ")", ";", "this", ".", "connected", "=", "true", ";", "}", "}" ]
Called when a handshake message is received from the aggregator. @param session the session on which the message arrived. @param handshakeMessage the received message.
[ "Called", "when", "a", "handshake", "message", "is", "received", "from", "the", "aggregator", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L590-L608
152,309
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.generateGenericSubscriptionMessage
protected SubscriptionMessage generateGenericSubscriptionMessage() { SubscriptionMessage subMessage = new SubscriptionMessage(); subMessage.setRules(this.rules); subMessage.setMessageType(SubscriptionMessage.SUBSCRIPTION_MESSAGE_ID); return subMessage; }
java
protected SubscriptionMessage generateGenericSubscriptionMessage() { SubscriptionMessage subMessage = new SubscriptionMessage(); subMessage.setRules(this.rules); subMessage.setMessageType(SubscriptionMessage.SUBSCRIPTION_MESSAGE_ID); return subMessage; }
[ "protected", "SubscriptionMessage", "generateGenericSubscriptionMessage", "(", ")", "{", "SubscriptionMessage", "subMessage", "=", "new", "SubscriptionMessage", "(", ")", ";", "subMessage", ".", "setRules", "(", "this", ".", "rules", ")", ";", "subMessage", ".", "setMessageType", "(", "SubscriptionMessage", ".", "SUBSCRIPTION_MESSAGE_ID", ")", ";", "return", "subMessage", ";", "}" ]
Creates a generic subscription message with the rules defined within this interface. @return the new message.
[ "Creates", "a", "generic", "subscription", "message", "with", "the", "rules", "defined", "within", "this", "interface", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L644-L651
152,310
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.solverSampleReceived
protected void solverSampleReceived(IoSession session, SampleMessage sampleMessage) { for (SampleListener listener : this.sampleListeners) { listener.sampleReceived(this, sampleMessage); } }
java
protected void solverSampleReceived(IoSession session, SampleMessage sampleMessage) { for (SampleListener listener : this.sampleListeners) { listener.sampleReceived(this, sampleMessage); } }
[ "protected", "void", "solverSampleReceived", "(", "IoSession", "session", ",", "SampleMessage", "sampleMessage", ")", "{", "for", "(", "SampleListener", "listener", ":", "this", ".", "sampleListeners", ")", "{", "listener", ".", "sampleReceived", "(", "this", ",", "sampleMessage", ")", ";", "}", "}" ]
Called when a sample is received from the aggregator. @param session the session the sample was received on. @param sampleMessage the received sample.
[ "Called", "when", "a", "sample", "is", "received", "from", "the", "aggregator", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L661-L666
152,311
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.subscriptionRequestSent
protected void subscriptionRequestSent(IoSession session, SubscriptionMessage subscriptionMessage) { this.sentSubscription = subscriptionMessage; log.info("Sent {}", subscriptionMessage); }
java
protected void subscriptionRequestSent(IoSession session, SubscriptionMessage subscriptionMessage) { this.sentSubscription = subscriptionMessage; log.info("Sent {}", subscriptionMessage); }
[ "protected", "void", "subscriptionRequestSent", "(", "IoSession", "session", ",", "SubscriptionMessage", "subscriptionMessage", ")", "{", "this", ".", "sentSubscription", "=", "subscriptionMessage", ";", "log", ".", "info", "(", "\"Sent {}\"", ",", "subscriptionMessage", ")", ";", "}" ]
Called after a subscription request message is sent to the aggregator. @param session the session on which the message was sent. @param subscriptionMessage the sent message.
[ "Called", "after", "a", "subscription", "request", "message", "is", "sent", "to", "the", "aggregator", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L722-L727
152,312
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.subscriptionResponseReceived
protected void subscriptionResponseReceived(IoSession session, SubscriptionMessage subscriptionMessage) { log.info("Received {}", subscriptionMessage); this.receivedSubscription = subscriptionMessage; if (this.sentSubscription == null) { log.error( "Protocol error: Received a subscription response without sending a request.\n{}", subscriptionMessage); this._disconnect(); return; } if (!this.sentSubscription.equals(this.receivedSubscription)) { log.info( "Server did not fully accept subscription request.\nOriginal:\n{}\nAmended\n{}", this.sentSubscription, this.receivedSubscription); } for (ConnectionListener listener : this.connectionListeners) { listener.subscriptionReceived(this, subscriptionMessage); } }
java
protected void subscriptionResponseReceived(IoSession session, SubscriptionMessage subscriptionMessage) { log.info("Received {}", subscriptionMessage); this.receivedSubscription = subscriptionMessage; if (this.sentSubscription == null) { log.error( "Protocol error: Received a subscription response without sending a request.\n{}", subscriptionMessage); this._disconnect(); return; } if (!this.sentSubscription.equals(this.receivedSubscription)) { log.info( "Server did not fully accept subscription request.\nOriginal:\n{}\nAmended\n{}", this.sentSubscription, this.receivedSubscription); } for (ConnectionListener listener : this.connectionListeners) { listener.subscriptionReceived(this, subscriptionMessage); } }
[ "protected", "void", "subscriptionResponseReceived", "(", "IoSession", "session", ",", "SubscriptionMessage", "subscriptionMessage", ")", "{", "log", ".", "info", "(", "\"Received {}\"", ",", "subscriptionMessage", ")", ";", "this", ".", "receivedSubscription", "=", "subscriptionMessage", ";", "if", "(", "this", ".", "sentSubscription", "==", "null", ")", "{", "log", ".", "error", "(", "\"Protocol error: Received a subscription response without sending a request.\\n{}\"", ",", "subscriptionMessage", ")", ";", "this", ".", "_disconnect", "(", ")", ";", "return", ";", "}", "if", "(", "!", "this", ".", "sentSubscription", ".", "equals", "(", "this", ".", "receivedSubscription", ")", ")", "{", "log", ".", "info", "(", "\"Server did not fully accept subscription request.\\nOriginal:\\n{}\\nAmended\\n{}\"", ",", "this", ".", "sentSubscription", ",", "this", ".", "receivedSubscription", ")", ";", "}", "for", "(", "ConnectionListener", "listener", ":", "this", ".", "connectionListeners", ")", "{", "listener", ".", "subscriptionReceived", "(", "this", ",", "subscriptionMessage", ")", ";", "}", "}" ]
Called when a subscription response is received from the aggregator. @param session the session on which message was received. @param subscriptionMessage the received message.
[ "Called", "when", "a", "subscription", "response", "is", "received", "from", "the", "aggregator", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L737-L759
152,313
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java
SolverAggregatorInterface.exceptionCaught
protected void exceptionCaught(IoSession session, Throwable cause) { log.error("Unhandled exception for: " + String.valueOf(session), cause); if (this.disconnectOnException) { this._disconnect(); } }
java
protected void exceptionCaught(IoSession session, Throwable cause) { log.error("Unhandled exception for: " + String.valueOf(session), cause); if (this.disconnectOnException) { this._disconnect(); } }
[ "protected", "void", "exceptionCaught", "(", "IoSession", "session", ",", "Throwable", "cause", ")", "{", "log", ".", "error", "(", "\"Unhandled exception for: \"", "+", "String", ".", "valueOf", "(", "session", ")", ",", "cause", ")", ";", "if", "(", "this", ".", "disconnectOnException", ")", "{", "this", ".", "_disconnect", "(", ")", ";", "}", "}" ]
Called when an exception occurs on the session @param session the session on which the exception occurred @param cause the exception
[ "Called", "when", "an", "exception", "occurs", "on", "the", "session" ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorInterface.java#L827-L832
152,314
schwa-lab/libschwa-java
src/main/java/org/schwa/dr/DocSchema.java
DocSchema.getStore
public StoreSchema getStore(final String name) { for (StoreSchema store : storeSchemas) if (store.getName().equals(name)) return store; return null; }
java
public StoreSchema getStore(final String name) { for (StoreSchema store : storeSchemas) if (store.getName().equals(name)) return store; return null; }
[ "public", "StoreSchema", "getStore", "(", "final", "String", "name", ")", "{", "for", "(", "StoreSchema", "store", ":", "storeSchemas", ")", "if", "(", "store", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "return", "store", ";", "return", "null", ";", "}" ]
Returns the schema for the stores on this annotation class whose name matches the provided name. This method returns null if no field matches.
[ "Returns", "the", "schema", "for", "the", "stores", "on", "this", "annotation", "class", "whose", "name", "matches", "the", "provided", "name", ".", "This", "method", "returns", "null", "if", "no", "field", "matches", "." ]
83a2330e212bbc0fcd62be12453424736d997f41
https://github.com/schwa-lab/libschwa-java/blob/83a2330e212bbc0fcd62be12453424736d997f41/src/main/java/org/schwa/dr/DocSchema.java#L69-L74
152,315
kaeluka/spencer-instrumentation
src/main/java/NativeInterface.java
NativeInterface.modify
public static void modify( int calleeValKind, Object callee, String calleeClass, String fieldName, int callerValKind, Object caller, String callerClass) { System.err.println("modify( "+ valAndValKindToString(callee, calleeClass, calleeValKind)+ " . "+fieldName+", "+ // "calleeClass="+calleeClass+", "+ "caller="+valAndValKindToString(caller, callerClass, callerValKind)+", "+ // "callerClass="+callerClass+", "+ ")"); }
java
public static void modify( int calleeValKind, Object callee, String calleeClass, String fieldName, int callerValKind, Object caller, String callerClass) { System.err.println("modify( "+ valAndValKindToString(callee, calleeClass, calleeValKind)+ " . "+fieldName+", "+ // "calleeClass="+calleeClass+", "+ "caller="+valAndValKindToString(caller, callerClass, callerValKind)+", "+ // "callerClass="+callerClass+", "+ ")"); }
[ "public", "static", "void", "modify", "(", "int", "calleeValKind", ",", "Object", "callee", ",", "String", "calleeClass", ",", "String", "fieldName", ",", "int", "callerValKind", ",", "Object", "caller", ",", "String", "callerClass", ")", "{", "System", ".", "err", ".", "println", "(", "\"modify( \"", "+", "valAndValKindToString", "(", "callee", ",", "calleeClass", ",", "calleeValKind", ")", "+", "\" . \"", "+", "fieldName", "+", "\", \"", "+", "//\t\t\t\t\"calleeClass=\"+calleeClass+\", \"+", "\"caller=\"", "+", "valAndValKindToString", "(", "caller", ",", "callerClass", ",", "callerValKind", ")", "+", "\", \"", "+", "//\t\t\t\t\"callerClass=\"+callerClass+\", \"+", "\")\"", ")", ";", "}" ]
an object WRITES a primitive field of another object
[ "an", "object", "WRITES", "a", "primitive", "field", "of", "another", "object" ]
b01661aed192be3fa6ae780fd59a33207f758765
https://github.com/kaeluka/spencer-instrumentation/blob/b01661aed192be3fa6ae780fd59a33207f758765/src/main/java/NativeInterface.java#L238-L253
152,316
jbundle/jbundle
thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/message/CalendarMessageListener.java
CalendarMessageListener.getPrice
public void getPrice(BaseMessage message) { String strPrice = (String)message.get("hotelRate"); System.out.println("Price: " + strPrice); /** LineItem lineItem = m_productItem.getLineItem(); if (!(lineItem instanceof TourLineItem)) return; try { double dPrive = ((TourLineItem)lineItem).getPrice(); } catch (RemoteException ex) { ex.printStackTrace(); } */ String strItem = (String)message.get("correlationID"); int iHash = -1; try { iHash = Integer.parseInt(strItem); } catch (NumberFormatException ex) { } if (iHash != -1) { CalendarProduct m_productItem = null; for (int i = 0; i < m_model.getRowCount(); i++) { if (m_model.getItem(i).hashCode() == iHash) m_productItem = (CalendarProduct)m_model.getItem(i); } if (m_productItem != null) m_productItem.setStatus(m_productItem.getStatus() & ~(1 << 2)); } }
java
public void getPrice(BaseMessage message) { String strPrice = (String)message.get("hotelRate"); System.out.println("Price: " + strPrice); /** LineItem lineItem = m_productItem.getLineItem(); if (!(lineItem instanceof TourLineItem)) return; try { double dPrive = ((TourLineItem)lineItem).getPrice(); } catch (RemoteException ex) { ex.printStackTrace(); } */ String strItem = (String)message.get("correlationID"); int iHash = -1; try { iHash = Integer.parseInt(strItem); } catch (NumberFormatException ex) { } if (iHash != -1) { CalendarProduct m_productItem = null; for (int i = 0; i < m_model.getRowCount(); i++) { if (m_model.getItem(i).hashCode() == iHash) m_productItem = (CalendarProduct)m_model.getItem(i); } if (m_productItem != null) m_productItem.setStatus(m_productItem.getStatus() & ~(1 << 2)); } }
[ "public", "void", "getPrice", "(", "BaseMessage", "message", ")", "{", "String", "strPrice", "=", "(", "String", ")", "message", ".", "get", "(", "\"hotelRate\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Price: \"", "+", "strPrice", ")", ";", "/**\n LineItem lineItem = m_productItem.getLineItem();\n if (!(lineItem instanceof TourLineItem))\n return;\n try {\n double dPrive = ((TourLineItem)lineItem).getPrice();\n } catch (RemoteException ex) {\n ex.printStackTrace();\n }\n*/", "String", "strItem", "=", "(", "String", ")", "message", ".", "get", "(", "\"correlationID\"", ")", ";", "int", "iHash", "=", "-", "1", ";", "try", "{", "iHash", "=", "Integer", ".", "parseInt", "(", "strItem", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "}", "if", "(", "iHash", "!=", "-", "1", ")", "{", "CalendarProduct", "m_productItem", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_model", ".", "getRowCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "m_model", ".", "getItem", "(", "i", ")", ".", "hashCode", "(", ")", "==", "iHash", ")", "m_productItem", "=", "(", "CalendarProduct", ")", "m_model", ".", "getItem", "(", "i", ")", ";", "}", "if", "(", "m_productItem", "!=", "null", ")", "m_productItem", ".", "setStatus", "(", "m_productItem", ".", "getStatus", "(", ")", "&", "~", "(", "1", "<<", "2", ")", ")", ";", "}", "}" ]
Get the price of this product.
[ "Get", "the", "price", "of", "this", "product", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/message/CalendarMessageListener.java#L51-L84
152,317
nleva/GwtEventBus
SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java
Bus.listen
public <A> void listen(Class<A> key, VoidEvent<A> value) { map.wire(key, value); }
java
public <A> void listen(Class<A> key, VoidEvent<A> value) { map.wire(key, value); }
[ "public", "<", "A", ">", "void", "listen", "(", "Class", "<", "A", ">", "key", ",", "VoidEvent", "<", "A", ">", "value", ")", "{", "map", ".", "wire", "(", "key", ",", "value", ")", ";", "}" ]
Add void listener @param key - object class @param value - event listener @param <A> - event listener
[ "Add", "void", "listener" ]
a3b593febf0454a112d18765543b081a13add888
https://github.com/nleva/GwtEventBus/blob/a3b593febf0454a112d18765543b081a13add888/SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java#L110-L112
152,318
nleva/GwtEventBus
SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java
Bus.getBy
static public Bus getBy(String busName){ if(busName==null) return get(); Bus bus = busMap.get(busName); if(bus==null) { bus=new Bus(); busMap.put(busName, bus); } return bus; }
java
static public Bus getBy(String busName){ if(busName==null) return get(); Bus bus = busMap.get(busName); if(bus==null) { bus=new Bus(); busMap.put(busName, bus); } return bus; }
[ "static", "public", "Bus", "getBy", "(", "String", "busName", ")", "{", "if", "(", "busName", "==", "null", ")", "return", "get", "(", ")", ";", "Bus", "bus", "=", "busMap", ".", "get", "(", "busName", ")", ";", "if", "(", "bus", "==", "null", ")", "{", "bus", "=", "new", "Bus", "(", ")", ";", "busMap", ".", "put", "(", "busName", ",", "bus", ")", ";", "}", "return", "bus", ";", "}" ]
Get bus instance by name @param busName bus name @return event bus
[ "Get", "bus", "instance", "by", "name" ]
a3b593febf0454a112d18765543b081a13add888
https://github.com/nleva/GwtEventBus/blob/a3b593febf0454a112d18765543b081a13add888/SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java#L142-L152
152,319
nleva/GwtEventBus
SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java
Bus.getBy
static public Bus getBy(Class<?> busName){ if(busName==null) return get(); return getBy(busName.getName()); }
java
static public Bus getBy(Class<?> busName){ if(busName==null) return get(); return getBy(busName.getName()); }
[ "static", "public", "Bus", "getBy", "(", "Class", "<", "?", ">", "busName", ")", "{", "if", "(", "busName", "==", "null", ")", "return", "get", "(", ")", ";", "return", "getBy", "(", "busName", ".", "getName", "(", ")", ")", ";", "}" ]
Get bus instance by class name @param busName bus name @return event bus
[ "Get", "bus", "instance", "by", "class", "name" ]
a3b593febf0454a112d18765543b081a13add888
https://github.com/nleva/GwtEventBus/blob/a3b593febf0454a112d18765543b081a13add888/SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java#L158-L163
152,320
nleva/GwtEventBus
SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java
Bus.getBy
static public Bus getBy(Object busName){ if(busName==null) return get(); return getBy(busName.getClass()); }
java
static public Bus getBy(Object busName){ if(busName==null) return get(); return getBy(busName.getClass()); }
[ "static", "public", "Bus", "getBy", "(", "Object", "busName", ")", "{", "if", "(", "busName", "==", "null", ")", "return", "get", "(", ")", ";", "return", "getBy", "(", "busName", ".", "getClass", "(", ")", ")", ";", "}" ]
Get bus instance by object class name @param busName bus name @return event bus
[ "Get", "bus", "instance", "by", "object", "class", "name" ]
a3b593febf0454a112d18765543b081a13add888
https://github.com/nleva/GwtEventBus/blob/a3b593febf0454a112d18765543b081a13add888/SimpleEventBus/src/main/java/ru/sendto/gwt/client/util/Bus.java#L169-L174
152,321
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/filter/CompareFileFilter.java
CompareFileFilter.setOwner
public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; if ((m_strFieldNameToCheck != null) && (m_strFieldNameToCheck.length() > 0)) if ((m_fldToCheck == null) || (m_fldToCheck.getFieldName() == null) || (m_fldToCheck.getFieldName().length() == 0)) m_fldToCheck = this.getOwner().getField(m_strFieldNameToCheck); // If you have the fieldname, but not the field, get the field. if (m_fldToCompare != null) if (m_fldToCompare.getRecord() != this.getOwner()) m_fldToCompare.addListener(new FieldRemoveBOnCloseHandler(this)); if (m_fldToCheck != null) if (m_fldToCheck.getRecord() != this.getOwner()) // If field is not in this file, remember to remove it m_fldToCheck.addListener(new FieldRemoveBOnCloseHandler(this)); //x this.getOwner().close(); // Must requery after setting dependent fields! }
java
public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; if ((m_strFieldNameToCheck != null) && (m_strFieldNameToCheck.length() > 0)) if ((m_fldToCheck == null) || (m_fldToCheck.getFieldName() == null) || (m_fldToCheck.getFieldName().length() == 0)) m_fldToCheck = this.getOwner().getField(m_strFieldNameToCheck); // If you have the fieldname, but not the field, get the field. if (m_fldToCompare != null) if (m_fldToCompare.getRecord() != this.getOwner()) m_fldToCompare.addListener(new FieldRemoveBOnCloseHandler(this)); if (m_fldToCheck != null) if (m_fldToCheck.getRecord() != this.getOwner()) // If field is not in this file, remember to remove it m_fldToCheck.addListener(new FieldRemoveBOnCloseHandler(this)); //x this.getOwner().close(); // Must requery after setting dependent fields! }
[ "public", "void", "setOwner", "(", "ListenerOwner", "owner", ")", "{", "super", ".", "setOwner", "(", "owner", ")", ";", "if", "(", "owner", "==", "null", ")", "return", ";", "if", "(", "(", "m_strFieldNameToCheck", "!=", "null", ")", "&&", "(", "m_strFieldNameToCheck", ".", "length", "(", ")", ">", "0", ")", ")", "if", "(", "(", "m_fldToCheck", "==", "null", ")", "||", "(", "m_fldToCheck", ".", "getFieldName", "(", ")", "==", "null", ")", "||", "(", "m_fldToCheck", ".", "getFieldName", "(", ")", ".", "length", "(", ")", "==", "0", ")", ")", "m_fldToCheck", "=", "this", ".", "getOwner", "(", ")", ".", "getField", "(", "m_strFieldNameToCheck", ")", ";", "// If you have the fieldname, but not the field, get the field.", "if", "(", "m_fldToCompare", "!=", "null", ")", "if", "(", "m_fldToCompare", ".", "getRecord", "(", ")", "!=", "this", ".", "getOwner", "(", ")", ")", "m_fldToCompare", ".", "addListener", "(", "new", "FieldRemoveBOnCloseHandler", "(", "this", ")", ")", ";", "if", "(", "m_fldToCheck", "!=", "null", ")", "if", "(", "m_fldToCheck", ".", "getRecord", "(", ")", "!=", "this", ".", "getOwner", "(", ")", ")", "// If field is not in this file, remember to remove it", "m_fldToCheck", ".", "addListener", "(", "new", "FieldRemoveBOnCloseHandler", "(", "this", ")", ")", ";", "//x this.getOwner().close(); // Must requery after setting dependent fields!", "}" ]
Set the field or file that owns this listener. Besides inherited, this method closes the owner record. @param owner My owner.
[ "Set", "the", "field", "or", "file", "that", "owns", "this", "listener", ".", "Besides", "inherited", "this", "method", "closes", "the", "owner", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/CompareFileFilter.java#L184-L200
152,322
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/client/protocol/messages/IdSearchResponseMessage.java
IdSearchResponseMessage.getMessageLength
public int getMessageLength() { int length = 1; if (this.matchingIds != null) { for (String id : this.matchingIds) { try { length += 4; length += id.getBytes("UTF-16BE").length; } catch (UnsupportedEncodingException uee) { log.error("Unable to encode UTF-16BE String: {}", uee); } } } return length; }
java
public int getMessageLength() { int length = 1; if (this.matchingIds != null) { for (String id : this.matchingIds) { try { length += 4; length += id.getBytes("UTF-16BE").length; } catch (UnsupportedEncodingException uee) { log.error("Unable to encode UTF-16BE String: {}", uee); } } } return length; }
[ "public", "int", "getMessageLength", "(", ")", "{", "int", "length", "=", "1", ";", "if", "(", "this", ".", "matchingIds", "!=", "null", ")", "{", "for", "(", "String", "id", ":", "this", ".", "matchingIds", ")", "{", "try", "{", "length", "+=", "4", ";", "length", "+=", "id", ".", "getBytes", "(", "\"UTF-16BE\"", ")", ".", "length", ";", "}", "catch", "(", "UnsupportedEncodingException", "uee", ")", "{", "log", ".", "error", "(", "\"Unable to encode UTF-16BE String: {}\"", ",", "uee", ")", ";", "}", "}", "}", "return", "length", ";", "}" ]
Gets the length of this message when encoded according to the Client-World Model protocol. @return the length, in bytes, of the encoded form of this message
[ "Gets", "the", "length", "of", "this", "message", "when", "encoded", "according", "to", "the", "Client", "-", "World", "Model", "protocol", "." ]
a850e8b930c6e9787c7cad30c0de887858ca563d
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/protocol/messages/IdSearchResponseMessage.java#L55-L69
152,323
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/calendar/CalendarRecordItem.java
CalendarRecordItem.getRelativeSField
public int getRelativeSField(int iSFieldSeq) { Convert lastField = null; for (int i = 0; i < m_gridScreen.getSFieldCount(); i++) { Convert field = m_gridScreen.getSField(i).getConverter(); if (field != null) field = field.getField(); if (m_gridScreen.getSField(i) instanceof ToolScreen) field = null; if ((field != null) && (field != lastField)) iSFieldSeq--; // Skip controls that belong to the previous field lastField = field; if (iSFieldSeq < 0) return i; } return m_gridScreen.getSFieldCount() - 1; // Never }
java
public int getRelativeSField(int iSFieldSeq) { Convert lastField = null; for (int i = 0; i < m_gridScreen.getSFieldCount(); i++) { Convert field = m_gridScreen.getSField(i).getConverter(); if (field != null) field = field.getField(); if (m_gridScreen.getSField(i) instanceof ToolScreen) field = null; if ((field != null) && (field != lastField)) iSFieldSeq--; // Skip controls that belong to the previous field lastField = field; if (iSFieldSeq < 0) return i; } return m_gridScreen.getSFieldCount() - 1; // Never }
[ "public", "int", "getRelativeSField", "(", "int", "iSFieldSeq", ")", "{", "Convert", "lastField", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_gridScreen", ".", "getSFieldCount", "(", ")", ";", "i", "++", ")", "{", "Convert", "field", "=", "m_gridScreen", ".", "getSField", "(", "i", ")", ".", "getConverter", "(", ")", ";", "if", "(", "field", "!=", "null", ")", "field", "=", "field", ".", "getField", "(", ")", ";", "if", "(", "m_gridScreen", ".", "getSField", "(", "i", ")", "instanceof", "ToolScreen", ")", "field", "=", "null", ";", "if", "(", "(", "field", "!=", "null", ")", "&&", "(", "field", "!=", "lastField", ")", ")", "iSFieldSeq", "--", ";", "// Skip controls that belong to the previous field", "lastField", "=", "field", ";", "if", "(", "iSFieldSeq", "<", "0", ")", "return", "i", ";", "}", "return", "m_gridScreen", ".", "getSFieldCount", "(", ")", "-", "1", ";", "// Never", "}" ]
This is lame. @param iSFieldSeq The screen field sequence. @return The relative sequence.
[ "This", "is", "lame", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/calendar/CalendarRecordItem.java#L296-L315
152,324
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/progress/FileCopyProgressMonitor.java
FileCopyProgressMonitor.main
public static void main(final String[] args) { // This runs in the "main" thread (outside the EDT) // Initialize the L&F in a thread safe way Utils4Swing.initSystemLookAndFeel(); // Create an cancel tracker final Cancelable cancelable = new CancelableVolatile(); // Create the monitor dialog final FileCopyProgressMonitor monitor = new FileCopyProgressMonitor(cancelable, "Copy Test", 10); // Make the UI visible monitor.open(); try { // Dummy loop to simulate copy... for (int i = 0; i < 10; i++) { // Check if the user canceled the copy process if (cancelable.isCanceled()) { break; } // Create a dummy source and target name... final int n = i + 1; final String fileName = "file" + n + ".jar"; final int fileSize = n * 10; final String sourceFilename = "http://www.fuin.org/demo-app/" + fileName; final String targetFilename = "/program files/demo app/" + fileName; // Update the UI with names, count and filesize monitor.updateFile(sourceFilename, targetFilename, n, fileSize); // Simulate copying a file // Normally this would be done with a // "FileCopyProgressInputStream" for (int j = 0; j < fileSize; j++) { // Update the lower progress bar monitor.updateByte(j + 1); // Sleep to simulate slow copy... sleep(100); } } } finally { // Hide the UI monitor.close(); } }
java
public static void main(final String[] args) { // This runs in the "main" thread (outside the EDT) // Initialize the L&F in a thread safe way Utils4Swing.initSystemLookAndFeel(); // Create an cancel tracker final Cancelable cancelable = new CancelableVolatile(); // Create the monitor dialog final FileCopyProgressMonitor monitor = new FileCopyProgressMonitor(cancelable, "Copy Test", 10); // Make the UI visible monitor.open(); try { // Dummy loop to simulate copy... for (int i = 0; i < 10; i++) { // Check if the user canceled the copy process if (cancelable.isCanceled()) { break; } // Create a dummy source and target name... final int n = i + 1; final String fileName = "file" + n + ".jar"; final int fileSize = n * 10; final String sourceFilename = "http://www.fuin.org/demo-app/" + fileName; final String targetFilename = "/program files/demo app/" + fileName; // Update the UI with names, count and filesize monitor.updateFile(sourceFilename, targetFilename, n, fileSize); // Simulate copying a file // Normally this would be done with a // "FileCopyProgressInputStream" for (int j = 0; j < fileSize; j++) { // Update the lower progress bar monitor.updateByte(j + 1); // Sleep to simulate slow copy... sleep(100); } } } finally { // Hide the UI monitor.close(); } }
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "// This runs in the \"main\" thread (outside the EDT)\r", "// Initialize the L&F in a thread safe way\r", "Utils4Swing", ".", "initSystemLookAndFeel", "(", ")", ";", "// Create an cancel tracker\r", "final", "Cancelable", "cancelable", "=", "new", "CancelableVolatile", "(", ")", ";", "// Create the monitor dialog\r", "final", "FileCopyProgressMonitor", "monitor", "=", "new", "FileCopyProgressMonitor", "(", "cancelable", ",", "\"Copy Test\"", ",", "10", ")", ";", "// Make the UI visible\r", "monitor", ".", "open", "(", ")", ";", "try", "{", "// Dummy loop to simulate copy...\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "10", ";", "i", "++", ")", "{", "// Check if the user canceled the copy process\r", "if", "(", "cancelable", ".", "isCanceled", "(", ")", ")", "{", "break", ";", "}", "// Create a dummy source and target name...\r", "final", "int", "n", "=", "i", "+", "1", ";", "final", "String", "fileName", "=", "\"file\"", "+", "n", "+", "\".jar\"", ";", "final", "int", "fileSize", "=", "n", "*", "10", ";", "final", "String", "sourceFilename", "=", "\"http://www.fuin.org/demo-app/\"", "+", "fileName", ";", "final", "String", "targetFilename", "=", "\"/program files/demo app/\"", "+", "fileName", ";", "// Update the UI with names, count and filesize\r", "monitor", ".", "updateFile", "(", "sourceFilename", ",", "targetFilename", ",", "n", ",", "fileSize", ")", ";", "// Simulate copying a file\r", "// Normally this would be done with a\r", "// \"FileCopyProgressInputStream\"\r", "for", "(", "int", "j", "=", "0", ";", "j", "<", "fileSize", ";", "j", "++", ")", "{", "// Update the lower progress bar\r", "monitor", ".", "updateByte", "(", "j", "+", "1", ")", ";", "// Sleep to simulate slow copy...\r", "sleep", "(", "100", ")", ";", "}", "}", "}", "finally", "{", "// Hide the UI\r", "monitor", ".", "close", "(", ")", ";", "}", "}" ]
Main method to test the monitor. Only for testing purposes. @param args Not used.
[ "Main", "method", "to", "test", "the", "monitor", ".", "Only", "for", "testing", "purposes", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/progress/FileCopyProgressMonitor.java#L363-L414
152,325
jbundle/jbundle
thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/JCalendarScreen.java
JCalendarScreen.free
public void free() { CalendarPanel panel = (CalendarPanel)JBasePanel.getSubScreen(this, CalendarPanel.class); if (panel != null) panel.free(); super.free(); }
java
public void free() { CalendarPanel panel = (CalendarPanel)JBasePanel.getSubScreen(this, CalendarPanel.class); if (panel != null) panel.free(); super.free(); }
[ "public", "void", "free", "(", ")", "{", "CalendarPanel", "panel", "=", "(", "CalendarPanel", ")", "JBasePanel", ".", "getSubScreen", "(", "this", ",", "CalendarPanel", ".", "class", ")", ";", "if", "(", "panel", "!=", "null", ")", "panel", ".", "free", "(", ")", ";", "super", ".", "free", "(", ")", ";", "}" ]
Free the sub=components.
[ "Free", "the", "sub", "=", "components", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/JCalendarScreen.java#L76-L82
152,326
jbundle/jbundle
thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/JCalendarScreen.java
JCalendarScreen.getCalendarModel
public CalendarModel getCalendarModel(FieldTable table) { if (m_model == null) if (table != null) m_model = new CalendarThinTableModel(table); return m_model; }
java
public CalendarModel getCalendarModel(FieldTable table) { if (m_model == null) if (table != null) m_model = new CalendarThinTableModel(table); return m_model; }
[ "public", "CalendarModel", "getCalendarModel", "(", "FieldTable", "table", ")", "{", "if", "(", "m_model", "==", "null", ")", "if", "(", "table", "!=", "null", ")", "m_model", "=", "new", "CalendarThinTableModel", "(", "table", ")", ";", "return", "m_model", ";", "}" ]
Get the calendar model. Override this to supply the calendar model. The default listener wraps the table in a CalendarThinTableModel.
[ "Get", "the", "calendar", "model", ".", "Override", "this", "to", "supply", "the", "calendar", "model", ".", "The", "default", "listener", "wraps", "the", "table", "in", "a", "CalendarThinTableModel", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/JCalendarScreen.java#L88-L94
152,327
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java
ParamDispatcher.propertyChange
public void propertyChange(PropertyChangeEvent evt) { String strProperty = evt.getPropertyName(); if (this.isValidProperty(strProperty)) { Object objCurrentValue = this.get(strProperty); if (evt.getNewValue() != objCurrentValue) { m_strCurrentProperty = strProperty; // Eliminate the chance of echos if (evt.getNewValue() != null) this.put(strProperty, evt.getNewValue()); else this.remove(strProperty); //x this.firePropertyChange(strProperty, evt.getOldValue(), evt.getNewValue()); // Propogate the property change if (propertyChange != null) propertyChange.firePropertyChange(evt); m_strCurrentProperty = null; } } }
java
public void propertyChange(PropertyChangeEvent evt) { String strProperty = evt.getPropertyName(); if (this.isValidProperty(strProperty)) { Object objCurrentValue = this.get(strProperty); if (evt.getNewValue() != objCurrentValue) { m_strCurrentProperty = strProperty; // Eliminate the chance of echos if (evt.getNewValue() != null) this.put(strProperty, evt.getNewValue()); else this.remove(strProperty); //x this.firePropertyChange(strProperty, evt.getOldValue(), evt.getNewValue()); // Propogate the property change if (propertyChange != null) propertyChange.firePropertyChange(evt); m_strCurrentProperty = null; } } }
[ "public", "void", "propertyChange", "(", "PropertyChangeEvent", "evt", ")", "{", "String", "strProperty", "=", "evt", ".", "getPropertyName", "(", ")", ";", "if", "(", "this", ".", "isValidProperty", "(", "strProperty", ")", ")", "{", "Object", "objCurrentValue", "=", "this", ".", "get", "(", "strProperty", ")", ";", "if", "(", "evt", ".", "getNewValue", "(", ")", "!=", "objCurrentValue", ")", "{", "m_strCurrentProperty", "=", "strProperty", ";", "// Eliminate the chance of echos", "if", "(", "evt", ".", "getNewValue", "(", ")", "!=", "null", ")", "this", ".", "put", "(", "strProperty", ",", "evt", ".", "getNewValue", "(", ")", ")", ";", "else", "this", ".", "remove", "(", "strProperty", ")", ";", "//x this.firePropertyChange(strProperty, evt.getOldValue(), evt.getNewValue()); // Propogate the property change", "if", "(", "propertyChange", "!=", "null", ")", "propertyChange", ".", "firePropertyChange", "(", "evt", ")", ";", "m_strCurrentProperty", "=", "null", ";", "}", "}", "}" ]
This method gets called when a bound property is changed. Propogate the event to all listeners. @param evt A PropertyChangeEvent object describing the event source and the property that has changed.
[ "This", "method", "gets", "called", "when", "a", "bound", "property", "is", "changed", ".", "Propogate", "the", "event", "to", "all", "listeners", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java#L77-L96
152,328
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java
ParamDispatcher.getProperties
public Map<String,Object> getProperties() { Map<String,Object> properties = new Hashtable<String,Object>(); ParamDispatcher params = this; for (Enumeration<String> e = params.keys() ; e.hasMoreElements() ;) { String strKey = e.nextElement(); String strValue = params.get(strKey).toString(); properties.put(strKey, strValue); } return properties; }
java
public Map<String,Object> getProperties() { Map<String,Object> properties = new Hashtable<String,Object>(); ParamDispatcher params = this; for (Enumeration<String> e = params.keys() ; e.hasMoreElements() ;) { String strKey = e.nextElement(); String strValue = params.get(strKey).toString(); properties.put(strKey, strValue); } return properties; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getProperties", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "ParamDispatcher", "params", "=", "this", ";", "for", "(", "Enumeration", "<", "String", ">", "e", "=", "params", ".", "keys", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "strKey", "=", "e", ".", "nextElement", "(", ")", ";", "String", "strValue", "=", "params", ".", "get", "(", "strKey", ")", ".", "toString", "(", ")", ";", "properties", ".", "put", "(", "strKey", ",", "strValue", ")", ";", "}", "return", "properties", ";", "}" ]
Get the current parameters for this screen. Convert the params to strings and place them in a properties object.
[ "Get", "the", "current", "parameters", "for", "this", "screen", ".", "Convert", "the", "params", "to", "strings", "and", "place", "them", "in", "a", "properties", "object", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java#L101-L112
152,329
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java
ParamDispatcher.isValidProperty
public boolean isValidProperty(String strProperty) { if (m_rgstrValidParams != null) { for (int i = 0; i < m_rgstrValidParams.length; i++) { if (m_rgstrValidParams[i].equalsIgnoreCase(strProperty)) { // Valid property if (m_strCurrentProperty != strProperty) { return true; // Valid property } } } } return false; // Not a valid property }
java
public boolean isValidProperty(String strProperty) { if (m_rgstrValidParams != null) { for (int i = 0; i < m_rgstrValidParams.length; i++) { if (m_rgstrValidParams[i].equalsIgnoreCase(strProperty)) { // Valid property if (m_strCurrentProperty != strProperty) { return true; // Valid property } } } } return false; // Not a valid property }
[ "public", "boolean", "isValidProperty", "(", "String", "strProperty", ")", "{", "if", "(", "m_rgstrValidParams", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_rgstrValidParams", ".", "length", ";", "i", "++", ")", "{", "if", "(", "m_rgstrValidParams", "[", "i", "]", ".", "equalsIgnoreCase", "(", "strProperty", ")", ")", "{", "// Valid property", "if", "(", "m_strCurrentProperty", "!=", "strProperty", ")", "{", "return", "true", ";", "// Valid property", "}", "}", "}", "}", "return", "false", ";", "// Not a valid property", "}" ]
This method gets called when a bound property is changed. Propagate the event to all listeners. @param evt A PropertyChangeEvent object describing the event source and the property that has changed.
[ "This", "method", "gets", "called", "when", "a", "bound", "property", "is", "changed", ".", "Propagate", "the", "event", "to", "all", "listeners", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java#L118-L134
152,330
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java
ParamDispatcher.firePropertyChange
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (propertyChange != null) propertyChange.firePropertyChange(propertyName, oldValue, newValue); }
java
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (propertyChange != null) propertyChange.firePropertyChange(propertyName, oldValue, newValue); }
[ "public", "void", "firePropertyChange", "(", "String", "propertyName", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "if", "(", "propertyChange", "!=", "null", ")", "propertyChange", ".", "firePropertyChange", "(", "propertyName", ",", "oldValue", ",", "newValue", ")", ";", "}" ]
The firePropertyChange method was generated to support the propertyChange field. @param propertyName The property name. @param oldValue The old value. @param newValue The new value.
[ "The", "firePropertyChange", "method", "was", "generated", "to", "support", "the", "propertyChange", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java#L149-L153
152,331
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Angle.java
Angle.add
public Angle add(Angle angle, boolean clockwice) { if (clockwice) { return new Angle(normalizeToFullAngle(value + angle.value)); } else { return new Angle(normalizeToFullAngle(value - angle.value)); } }
java
public Angle add(Angle angle, boolean clockwice) { if (clockwice) { return new Angle(normalizeToFullAngle(value + angle.value)); } else { return new Angle(normalizeToFullAngle(value - angle.value)); } }
[ "public", "Angle", "add", "(", "Angle", "angle", ",", "boolean", "clockwice", ")", "{", "if", "(", "clockwice", ")", "{", "return", "new", "Angle", "(", "normalizeToFullAngle", "(", "value", "+", "angle", ".", "value", ")", ")", ";", "}", "else", "{", "return", "new", "Angle", "(", "normalizeToFullAngle", "(", "value", "-", "angle", ".", "value", ")", ")", ";", "}", "}" ]
Add angle clockwise or counter clockwice. @param angle @return Returns a new Angle
[ "Add", "angle", "clockwise", "or", "counter", "clockwice", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Angle.java#L127-L137
152,332
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Angle.java
Angle.turn
public Angle turn(Angle angle) { if (angle.getRadians() < Math.PI) { return add(angle, true); } else { return add(angle.toHalfAngle(), false); } }
java
public Angle turn(Angle angle) { if (angle.getRadians() < Math.PI) { return add(angle, true); } else { return add(angle.toHalfAngle(), false); } }
[ "public", "Angle", "turn", "(", "Angle", "angle", ")", "{", "if", "(", "angle", ".", "getRadians", "(", ")", "<", "Math", ".", "PI", ")", "{", "return", "add", "(", "angle", ",", "true", ")", ";", "}", "else", "{", "return", "add", "(", "angle", ".", "toHalfAngle", "(", ")", ",", "false", ")", ";", "}", "}" ]
Turn angle clockwise or counter clockwice. If &lt; 180 turns clockwice. If &ge; 180 turns counter clockwice 360 - angle @param angle @return Returns a new Angle
[ "Turn", "angle", "clockwise", "or", "counter", "clockwice", ".", "If", "&lt", ";", "180", "turns", "clockwice", ".", "If", "&ge", ";", "180", "turns", "counter", "clockwice", "360", "-", "angle" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Angle.java#L144-L154
152,333
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Angle.java
Angle.inSector
public final boolean inSector(Angle start, Angle end) { if (start.clockwise(end)) { return !clockwise(start) && clockwise(end); } else { return clockwise(start) && !clockwise(end); } }
java
public final boolean inSector(Angle start, Angle end) { if (start.clockwise(end)) { return !clockwise(start) && clockwise(end); } else { return clockwise(start) && !clockwise(end); } }
[ "public", "final", "boolean", "inSector", "(", "Angle", "start", ",", "Angle", "end", ")", "{", "if", "(", "start", ".", "clockwise", "(", "end", ")", ")", "{", "return", "!", "clockwise", "(", "start", ")", "&&", "clockwise", "(", "end", ")", ";", "}", "else", "{", "return", "clockwise", "(", "start", ")", "&&", "!", "clockwise", "(", "end", ")", ";", "}", "}" ]
Sector is less than 180 degrees delimited by start and end @param start @param end @return If this is between start - end
[ "Sector", "is", "less", "than", "180", "degrees", "delimited", "by", "start", "and", "end" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Angle.java#L168-L178
152,334
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Angle.java
Angle.difference
public static final Angle difference(Angle a1, Angle a2) { return new Angle(normalizeToHalfAngle(angleDiff(a1.value, a2.value))); }
java
public static final Angle difference(Angle a1, Angle a2) { return new Angle(normalizeToHalfAngle(angleDiff(a1.value, a2.value))); }
[ "public", "static", "final", "Angle", "difference", "(", "Angle", "a1", ",", "Angle", "a2", ")", "{", "return", "new", "Angle", "(", "normalizeToHalfAngle", "(", "angleDiff", "(", "a1", ".", "value", ",", "a2", ".", "value", ")", ")", ")", ";", "}" ]
The difference between two angles @param a1 @param a2 @return New Angle representing the difference
[ "The", "difference", "between", "two", "angles" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Angle.java#L197-L200
152,335
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Angle.java
Angle.clockwise
public static final boolean clockwise(Angle angle1, Angle angle2) { return clockwise(angle1.value, angle2.value); }
java
public static final boolean clockwise(Angle angle1, Angle angle2) { return clockwise(angle1.value, angle2.value); }
[ "public", "static", "final", "boolean", "clockwise", "(", "Angle", "angle1", ",", "Angle", "angle2", ")", "{", "return", "clockwise", "(", "angle1", ".", "value", ",", "angle2", ".", "value", ")", ";", "}" ]
10 is clockwise from 340 @param angle1 @param angle2 @return true if angle2 is clockwise from angle1
[ "10", "is", "clockwise", "from", "340" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Angle.java#L221-L224
152,336
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Angle.java
Angle.signed
public static final double signed(double angle) { angle = normalizeToFullAngle(angle); if (angle > Math.PI) { return angle - FULL_CIRCLE; } else { return angle; } }
java
public static final double signed(double angle) { angle = normalizeToFullAngle(angle); if (angle > Math.PI) { return angle - FULL_CIRCLE; } else { return angle; } }
[ "public", "static", "final", "double", "signed", "(", "double", "angle", ")", "{", "angle", "=", "normalizeToFullAngle", "(", "angle", ")", ";", "if", "(", "angle", ">", "Math", ".", "PI", ")", "{", "return", "angle", "-", "FULL_CIRCLE", ";", "}", "else", "{", "return", "angle", ";", "}", "}" ]
Convert full angle to signed angle -180 - 180. 340 -&gt; -20 @param angle @return
[ "Convert", "full", "angle", "to", "signed", "angle", "-", "180", "-", "180", ".", "340", "-", "&gt", ";", "-", "20" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Angle.java#L348-L359
152,337
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/AuthUtil.java
AuthUtil.getUserInfo
public static UserInfo getUserInfo(final String userId) { if (userId == null) { throw new IllegalArgumentException("null userName"); } try { Class<?> accessor = Class.forName("com.sap.security.um.service.UserManagementAccessor"); if (accessor != null) { Object users = MethodUtils.invokeExactStaticMethod(accessor, "getUserProvider", null); if (users != null) { Object user = MethodUtils.invokeExactMethod(users, "getUser", userId); if (user != null) { // get user name and email return new User( userId, (String) MethodUtils.invokeExactMethod(user, "getAttribute", "firstname"), (String) MethodUtils.invokeExactMethod(user, "getAttribute", "lastname"), (String) MethodUtils.invokeExactMethod(user, "getAttribute", "email")); } } } } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { log.warn(e.getMessage()); } return new User(userId, "", "", ""); }
java
public static UserInfo getUserInfo(final String userId) { if (userId == null) { throw new IllegalArgumentException("null userName"); } try { Class<?> accessor = Class.forName("com.sap.security.um.service.UserManagementAccessor"); if (accessor != null) { Object users = MethodUtils.invokeExactStaticMethod(accessor, "getUserProvider", null); if (users != null) { Object user = MethodUtils.invokeExactMethod(users, "getUser", userId); if (user != null) { // get user name and email return new User( userId, (String) MethodUtils.invokeExactMethod(user, "getAttribute", "firstname"), (String) MethodUtils.invokeExactMethod(user, "getAttribute", "lastname"), (String) MethodUtils.invokeExactMethod(user, "getAttribute", "email")); } } } } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { log.warn(e.getMessage()); } return new User(userId, "", "", ""); }
[ "public", "static", "UserInfo", "getUserInfo", "(", "final", "String", "userId", ")", "{", "if", "(", "userId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"null userName\"", ")", ";", "}", "try", "{", "Class", "<", "?", ">", "accessor", "=", "Class", ".", "forName", "(", "\"com.sap.security.um.service.UserManagementAccessor\"", ")", ";", "if", "(", "accessor", "!=", "null", ")", "{", "Object", "users", "=", "MethodUtils", ".", "invokeExactStaticMethod", "(", "accessor", ",", "\"getUserProvider\"", ",", "null", ")", ";", "if", "(", "users", "!=", "null", ")", "{", "Object", "user", "=", "MethodUtils", ".", "invokeExactMethod", "(", "users", ",", "\"getUser\"", ",", "userId", ")", ";", "if", "(", "user", "!=", "null", ")", "{", "// get user name and email", "return", "new", "User", "(", "userId", ",", "(", "String", ")", "MethodUtils", ".", "invokeExactMethod", "(", "user", ",", "\"getAttribute\"", ",", "\"firstname\"", ")", ",", "(", "String", ")", "MethodUtils", ".", "invokeExactMethod", "(", "user", ",", "\"getAttribute\"", ",", "\"lastname\"", ")", ",", "(", "String", ")", "MethodUtils", ".", "invokeExactMethod", "(", "user", ",", "\"getAttribute\"", ",", "\"email\"", ")", ")", ";", "}", "}", "}", "}", "catch", "(", "ClassNotFoundException", "|", "NoSuchMethodException", "|", "IllegalAccessException", "|", "InvocationTargetException", "e", ")", "{", "log", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "new", "User", "(", "userId", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "}" ]
never returns null
[ "never", "returns", "null" ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/AuthUtil.java#L15-L42
152,338
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.method
public Predictor method(int method, int startPage) { input.add(new CommandLine<>(METHOD, 5, method, startPage)); return this; }
java
public Predictor method(int method, int startPage) { input.add(new CommandLine<>(METHOD, 5, method, startPage)); return this; }
[ "public", "Predictor", "method", "(", "int", "method", ",", "int", "startPage", ")", "{", "input", ".", "add", "(", "new", "CommandLine", "<>", "(", "METHOD", ",", "5", ",", "method", ",", "startPage", ")", ")", ";", "return", "this", ";", "}" ]
The METHOD command defines the analysis task to be performed for a particular system configuration. @param method @return
[ "The", "METHOD", "command", "defines", "the", "analysis", "task", "to", "be", "performed", "for", "a", "particular", "system", "configuration", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L146-L150
152,339
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.execute
public Predictor execute(KRun krun) { input.add(new CommandLine<>(EXECUTE, 5, krun.ordinal())); return this; }
java
public Predictor execute(KRun krun) { input.add(new CommandLine<>(EXECUTE, 5, krun.ordinal())); return this; }
[ "public", "Predictor", "execute", "(", "KRun", "krun", ")", "{", "input", ".", "add", "(", "new", "CommandLine", "<>", "(", "EXECUTE", ",", "5", ",", "krun", ".", "ordinal", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
The EXECUTE command causes the program to perform the indicated analysis task for the currently defined system configuration. @param krun @return
[ "The", "EXECUTE", "command", "causes", "the", "program", "to", "perform", "the", "indicated", "analysis", "task", "for", "the", "currently", "defined", "system", "configuration", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L171-L175
152,340
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.time
public Predictor time(int ihro, int ihre, int ihrs, boolean ut) { input.add(new CommandLine<>(TIME, 5, ihro, ihre, ihrs, ut ? 1 : -1)); return this; }
java
public Predictor time(int ihro, int ihre, int ihrs, boolean ut) { input.add(new CommandLine<>(TIME, 5, ihro, ihre, ihrs, ut ? 1 : -1)); return this; }
[ "public", "Predictor", "time", "(", "int", "ihro", ",", "int", "ihre", ",", "int", "ihrs", ",", "boolean", "ut", ")", "{", "input", ".", "add", "(", "new", "CommandLine", "<>", "(", "TIME", ",", "5", ",", "ihro", ",", "ihre", ",", "ihrs", ",", "ut", "?", "1", ":", "-", "1", ")", ")", ";", "return", "this", ";", "}" ]
The TIME command indicates the time of day for which the analysis and predictions are to be performed. @param ihro indicates the starting hour in universal time or in local mean time at the transmitter. @param ihre indicates the ending hour in universal time or in local mean time at the transmitter. @param ihrs indicates the hourly increment. The hourly increment is added to the starting hour to determine the next hour. This incremental process continues until the ending hour is reached. @param ut indicates that the specified time is universal time or local mean time. @return
[ "The", "TIME", "command", "indicates", "the", "time", "of", "day", "for", "which", "the", "analysis", "and", "predictions", "are", "to", "be", "performed", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L205-L209
152,341
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.month
public Predictor month(int nyear, Month... months) { Object[] arr = new Object[months.length + 1]; arr[0] = nyear; int index = 1; for (Month m : months) { arr[index++] = Double.valueOf(m.getValue()); } input.add(new CommandLine<>(MONTH, 5, arr)); return this; }
java
public Predictor month(int nyear, Month... months) { Object[] arr = new Object[months.length + 1]; arr[0] = nyear; int index = 1; for (Month m : months) { arr[index++] = Double.valueOf(m.getValue()); } input.add(new CommandLine<>(MONTH, 5, arr)); return this; }
[ "public", "Predictor", "month", "(", "int", "nyear", ",", "Month", "...", "months", ")", "{", "Object", "[", "]", "arr", "=", "new", "Object", "[", "months", ".", "length", "+", "1", "]", ";", "arr", "[", "0", "]", "=", "nyear", ";", "int", "index", "=", "1", ";", "for", "(", "Month", "m", ":", "months", ")", "{", "arr", "[", "index", "++", "]", "=", "Double", ".", "valueOf", "(", "m", ".", "getValue", "(", ")", ")", ";", "}", "input", ".", "add", "(", "new", "CommandLine", "<>", "(", "MONTH", ",", "5", ",", "arr", ")", ")", ";", "return", "this", ";", "}" ]
The MONTH command indicates the year and months for which the analysis and prediction are to be performed. @param nyear indicates the year, but has no effect on the program calculations. @param months The program analysis and predictions are performed for each of the months the user specifies. The desired month can be specified in any order. @return
[ "The", "MONTH", "command", "indicates", "the", "year", "and", "months", "for", "which", "the", "analysis", "and", "prediction", "are", "to", "be", "performed", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L222-L233
152,342
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.sunspot
public Predictor sunspot(double... sunspot) { CommandLine<Double> line = new CommandLine<>(SUNSPOT, 5); for (double s : sunspot) { line.add(s); } input.add(line); return this; }
java
public Predictor sunspot(double... sunspot) { CommandLine<Double> line = new CommandLine<>(SUNSPOT, 5); for (double s : sunspot) { line.add(s); } input.add(line); return this; }
[ "public", "Predictor", "sunspot", "(", "double", "...", "sunspot", ")", "{", "CommandLine", "<", "Double", ">", "line", "=", "new", "CommandLine", "<>", "(", "SUNSPOT", ",", "5", ")", ";", "for", "(", "double", "s", ":", "sunspot", ")", "{", "line", ".", "add", "(", "s", ")", ";", "}", "input", ".", "add", "(", "line", ")", ";", "return", "this", ";", "}" ]
The sunspot command line indicates the sunspot numbers of the solar activity period of interest and is the 12-month smoothed mean for each of the months specified. @param sunspot @return
[ "The", "sunspot", "command", "line", "indicates", "the", "sunspot", "numbers", "of", "the", "solar", "activity", "period", "of", "interest", "and", "is", "the", "12", "-", "month", "smoothed", "mean", "for", "each", "of", "the", "months", "specified", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L243-L252
152,343
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.label
public Predictor label(String itran, String ircvr) { input.add(new CommandLine<>(LABEL, 20, itran, ircvr)); return this; }
java
public Predictor label(String itran, String ircvr) { input.add(new CommandLine<>(LABEL, 20, itran, ircvr)); return this; }
[ "public", "Predictor", "label", "(", "String", "itran", ",", "String", "ircvr", ")", "{", "input", ".", "add", "(", "new", "CommandLine", "<>", "(", "LABEL", ",", "20", ",", "itran", ",", "ircvr", ")", ")", ";", "return", "this", ";", "}" ]
The LABEL command contains alphanumeric information used to describe the system location on both the input and output. @param itran is an array of 20 alphanumeric characters used to describe the transmitter location. @param ircvr is an array of 20 alphanumeric characters used to describe the receiver location. @return
[ "The", "LABEL", "command", "contains", "alphanumeric", "information", "used", "to", "describe", "the", "system", "location", "on", "both", "the", "input", "and", "output", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L264-L268
152,344
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.circuit
public Predictor circuit(Location transmitter, Location receiver, boolean shorter) { this.receiverLocation = receiver; input.add(new CommandLine<>(CIRCUIT, 5, Math.abs(transmitter.getLatitude()), transmitter.getLatitudeNS(), Math.abs(transmitter.getLongitude()), transmitter.getLongitudeWE(), Math.abs(receiver.getLatitude()), receiver.getLatitudeNS(), Math.abs(receiver.getLongitude()), receiver.getLongitudeWE(), shorter ? 0 : 1 )); return this; }
java
public Predictor circuit(Location transmitter, Location receiver, boolean shorter) { this.receiverLocation = receiver; input.add(new CommandLine<>(CIRCUIT, 5, Math.abs(transmitter.getLatitude()), transmitter.getLatitudeNS(), Math.abs(transmitter.getLongitude()), transmitter.getLongitudeWE(), Math.abs(receiver.getLatitude()), receiver.getLatitudeNS(), Math.abs(receiver.getLongitude()), receiver.getLongitudeWE(), shorter ? 0 : 1 )); return this; }
[ "public", "Predictor", "circuit", "(", "Location", "transmitter", ",", "Location", "receiver", ",", "boolean", "shorter", ")", "{", "this", ".", "receiverLocation", "=", "receiver", ";", "input", ".", "add", "(", "new", "CommandLine", "<>", "(", "CIRCUIT", ",", "5", ",", "Math", ".", "abs", "(", "transmitter", ".", "getLatitude", "(", ")", ")", ",", "transmitter", ".", "getLatitudeNS", "(", ")", ",", "Math", ".", "abs", "(", "transmitter", ".", "getLongitude", "(", ")", ")", ",", "transmitter", ".", "getLongitudeWE", "(", ")", ",", "Math", ".", "abs", "(", "receiver", ".", "getLatitude", "(", ")", ")", ",", "receiver", ".", "getLatitudeNS", "(", ")", ",", "Math", ".", "abs", "(", "receiver", ".", "getLongitude", "(", ")", ")", ",", "receiver", ".", "getLongitudeWE", "(", ")", ",", "shorter", "?", "0", ":", "1", ")", ")", ";", "return", "this", ";", "}" ]
The CIRCUIT command contains the geographic coordinates of the transmitter and receiver and a variable to indicate the user's choice between shorter or longer great circle paths from the transmitter to the receiver. @param transmitter @param receiver @param shorter @return
[ "The", "CIRCUIT", "command", "contains", "the", "geographic", "coordinates", "of", "the", "transmitter", "and", "receiver", "and", "a", "variable", "to", "indicate", "the", "user", "s", "choice", "between", "shorter", "or", "longer", "great", "circle", "paths", "from", "the", "transmitter", "to", "the", "receiver", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L281-L296
152,345
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java
Predictor.frequency
public Predictor frequency(double... frel) { frequencies = frel; CommandLine<Double> line = new CommandLine<>(FREQUENCY, 5); for (double f : frel) { line.add(f); } input.add(line); return this; }
java
public Predictor frequency(double... frel) { frequencies = frel; CommandLine<Double> line = new CommandLine<>(FREQUENCY, 5); for (double f : frel) { line.add(f); } input.add(line); return this; }
[ "public", "Predictor", "frequency", "(", "double", "...", "frel", ")", "{", "frequencies", "=", "frel", ";", "CommandLine", "<", "Double", ">", "line", "=", "new", "CommandLine", "<>", "(", "FREQUENCY", ",", "5", ")", ";", "for", "(", "double", "f", ":", "frel", ")", "{", "line", ".", "add", "(", "f", ")", ";", "}", "input", ".", "add", "(", "line", ")", ";", "return", "this", ";", "}" ]
The FREQUENCY complement command line contains up to 11 user-defined frequencies that are used in the calculation. @param frel FREL is the array of up to 11 user-defined frequencies in megahertz. @return
[ "The", "FREQUENCY", "complement", "command", "line", "contains", "up", "to", "11", "user", "-", "defined", "frequencies", "that", "are", "used", "in", "the", "calculation", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/itshfbc/Predictor.java#L355-L365
152,346
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/buglinks/BugLinkStrategyFactory.java
BugLinkStrategyFactory.create
public <T extends BaseBugLinkStrategy<?>> T create(final BugLinkType type, final String serverUrl, final Object... additionalArgs) { // Check that the internals are registered if (!internalsRegistered) { registerInternals(); } if (map.containsKey(type)) { try { final SortedSet<Helper> helpers = map.get(type); T helper = null; for (final Helper definedHelper : helpers) { if (definedHelper.useHelper(serverUrl)) { helper = (T) definedHelper.getHelperClass().newInstance(); break; } } if (helper != null) { helper.initialise(serverUrl, additionalArgs); } return helper; } catch (Exception e) { throw new RuntimeException(e); } } else { return null; } }
java
public <T extends BaseBugLinkStrategy<?>> T create(final BugLinkType type, final String serverUrl, final Object... additionalArgs) { // Check that the internals are registered if (!internalsRegistered) { registerInternals(); } if (map.containsKey(type)) { try { final SortedSet<Helper> helpers = map.get(type); T helper = null; for (final Helper definedHelper : helpers) { if (definedHelper.useHelper(serverUrl)) { helper = (T) definedHelper.getHelperClass().newInstance(); break; } } if (helper != null) { helper.initialise(serverUrl, additionalArgs); } return helper; } catch (Exception e) { throw new RuntimeException(e); } } else { return null; } }
[ "public", "<", "T", "extends", "BaseBugLinkStrategy", "<", "?", ">", ">", "T", "create", "(", "final", "BugLinkType", "type", ",", "final", "String", "serverUrl", ",", "final", "Object", "...", "additionalArgs", ")", "{", "// Check that the internals are registered", "if", "(", "!", "internalsRegistered", ")", "{", "registerInternals", "(", ")", ";", "}", "if", "(", "map", ".", "containsKey", "(", "type", ")", ")", "{", "try", "{", "final", "SortedSet", "<", "Helper", ">", "helpers", "=", "map", ".", "get", "(", "type", ")", ";", "T", "helper", "=", "null", ";", "for", "(", "final", "Helper", "definedHelper", ":", "helpers", ")", "{", "if", "(", "definedHelper", ".", "useHelper", "(", "serverUrl", ")", ")", "{", "helper", "=", "(", "T", ")", "definedHelper", ".", "getHelperClass", "(", ")", ".", "newInstance", "(", ")", ";", "break", ";", "}", "}", "if", "(", "helper", "!=", "null", ")", "{", "helper", ".", "initialise", "(", "serverUrl", ",", "additionalArgs", ")", ";", "}", "return", "helper", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}" ]
Create a strategy instance to be used for the specified type and server url. @param type The type of strategy to get (eg JIRA, BUGZILLA, etc...) @param serverUrl The url that the bug links should be used against. @param additionalArgs Any additional arguments that are needed to instantiate/configure the strategy. @param <T> @return A registered strategy, or an internal/default helper if no registered strategies exist.
[ "Create", "a", "strategy", "instance", "to", "be", "used", "for", "the", "specified", "type", "and", "server", "url", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/buglinks/BugLinkStrategyFactory.java#L59-L88
152,347
tvesalainen/util
util/src/main/java/org/vesalainen/util/OSProcess.java
OSProcess.call
public static final int call(Path cwd, Map<String,String> env, String... args) throws IOException, InterruptedException { if (args.length == 1) { args = args[0].split("[ ]+"); } String cmd = Arrays.stream(args).collect(Collectors.joining(" ")); JavaLogging.getLogger(OSProcess.class).info("call: %s", cmd); ProcessBuilder builder = new ProcessBuilder(args); if (cwd != null) { builder.directory(cwd.toFile()); } if (env != null) { Map<String, String> environment = builder.environment(); environment.clear(); environment.putAll(env); } Process process = builder.start(); Thread stdout = new Thread(new ProcessLogger(cmd, process.getInputStream(), Level.INFO)); stdout.start(); Thread stderr = new Thread(new ProcessLogger(cmd, process.getErrorStream(), Level.WARNING)); stderr.start(); return process.waitFor(); }
java
public static final int call(Path cwd, Map<String,String> env, String... args) throws IOException, InterruptedException { if (args.length == 1) { args = args[0].split("[ ]+"); } String cmd = Arrays.stream(args).collect(Collectors.joining(" ")); JavaLogging.getLogger(OSProcess.class).info("call: %s", cmd); ProcessBuilder builder = new ProcessBuilder(args); if (cwd != null) { builder.directory(cwd.toFile()); } if (env != null) { Map<String, String> environment = builder.environment(); environment.clear(); environment.putAll(env); } Process process = builder.start(); Thread stdout = new Thread(new ProcessLogger(cmd, process.getInputStream(), Level.INFO)); stdout.start(); Thread stderr = new Thread(new ProcessLogger(cmd, process.getErrorStream(), Level.WARNING)); stderr.start(); return process.waitFor(); }
[ "public", "static", "final", "int", "call", "(", "Path", "cwd", ",", "Map", "<", "String", ",", "String", ">", "env", ",", "String", "...", "args", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "args", ".", "length", "==", "1", ")", "{", "args", "=", "args", "[", "0", "]", ".", "split", "(", "\"[ ]+\"", ")", ";", "}", "String", "cmd", "=", "Arrays", ".", "stream", "(", "args", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "\" \"", ")", ")", ";", "JavaLogging", ".", "getLogger", "(", "OSProcess", ".", "class", ")", ".", "info", "(", "\"call: %s\"", ",", "cmd", ")", ";", "ProcessBuilder", "builder", "=", "new", "ProcessBuilder", "(", "args", ")", ";", "if", "(", "cwd", "!=", "null", ")", "{", "builder", ".", "directory", "(", "cwd", ".", "toFile", "(", ")", ")", ";", "}", "if", "(", "env", "!=", "null", ")", "{", "Map", "<", "String", ",", "String", ">", "environment", "=", "builder", ".", "environment", "(", ")", ";", "environment", ".", "clear", "(", ")", ";", "environment", ".", "putAll", "(", "env", ")", ";", "}", "Process", "process", "=", "builder", ".", "start", "(", ")", ";", "Thread", "stdout", "=", "new", "Thread", "(", "new", "ProcessLogger", "(", "cmd", ",", "process", ".", "getInputStream", "(", ")", ",", "Level", ".", "INFO", ")", ")", ";", "stdout", ".", "start", "(", ")", ";", "Thread", "stderr", "=", "new", "Thread", "(", "new", "ProcessLogger", "(", "cmd", ",", "process", ".", "getErrorStream", "(", ")", ",", "Level", ".", "WARNING", ")", ")", ";", "stderr", ".", "start", "(", ")", ";", "return", "process", ".", "waitFor", "(", ")", ";", "}" ]
Call os process and waits it's execution. @param args Either command and arguments in single string or command and arguments as separate strings. <p> call("netstat -an") is same as call("netstat", "-an") @param cwd Current Working Directory @param env Environment @param args @return @throws IOException @throws InterruptedException
[ "Call", "os", "process", "and", "waits", "it", "s", "execution", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OSProcess.java#L63-L88
152,348
PeachTech/peachweb-peachproxy-java
src/main/java/com/peachfuzzer/web/api/PeachProxy.java
PeachProxy.sessionSetup
public void sessionSetup(String project, String profile) throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>sessionSetup"); try { HttpResponse<JsonNode> ret = null; try { ret = Unirest .post(String.format("%s/api/sessions", _api)) .queryString("project", project) .queryString("profile", profile) .header(_token_header, _api_token) .asJson(); } catch (UnirestException ex) { Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex); throw new PeachApiException( String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionSetup: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error, /api/sessions returned status code of %s: %s", ret.getStatus(), ret.getStatusText()); throw new PeachApiException(errorMsg, null); } _jobid = ret.getBody().getObject().getString("SessionId"); _proxyUrl = ret.getBody().getObject().getString("ProxyUrl"); verifyProxyAccess(); } finally { revertUnirestProxy(); } }
java
public void sessionSetup(String project, String profile) throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>sessionSetup"); try { HttpResponse<JsonNode> ret = null; try { ret = Unirest .post(String.format("%s/api/sessions", _api)) .queryString("project", project) .queryString("profile", profile) .header(_token_header, _api_token) .asJson(); } catch (UnirestException ex) { Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex); throw new PeachApiException( String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionSetup: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error, /api/sessions returned status code of %s: %s", ret.getStatus(), ret.getStatusText()); throw new PeachApiException(errorMsg, null); } _jobid = ret.getBody().getObject().getString("SessionId"); _proxyUrl = ret.getBody().getObject().getString("ProxyUrl"); verifyProxyAccess(); } finally { revertUnirestProxy(); } }
[ "public", "void", "sessionSetup", "(", "String", "project", ",", "String", "profile", ")", "throws", "PeachApiException", "{", "stashUnirestProxy", "(", ")", ";", "if", "(", "_debug", ")", "System", ".", "out", ".", "println", "(", "\">>sessionSetup\"", ")", ";", "try", "{", "HttpResponse", "<", "JsonNode", ">", "ret", "=", "null", ";", "try", "{", "ret", "=", "Unirest", ".", "post", "(", "String", ".", "format", "(", "\"%s/api/sessions\"", ",", "_api", ")", ")", ".", "queryString", "(", "\"project\"", ",", "project", ")", ".", "queryString", "(", "\"profile\"", ",", "profile", ")", ".", "header", "(", "_token_header", ",", "_api_token", ")", ".", "asJson", "(", ")", ";", "}", "catch", "(", "UnirestException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PeachProxy", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error contacting Peach API\"", ",", "ex", ")", ";", "throw", "new", "PeachApiException", "(", "String", ".", "format", "(", "\"Error, exception contacting Peach API: %s\"", ",", "ex", ".", "getMessage", "(", ")", ")", ",", "ex", ")", ";", "}", "if", "(", "ret", "==", "null", ")", "{", "throw", "new", "PeachApiException", "(", "\"Error, in Proxy.sessionSetup: ret was null\"", ",", "null", ")", ";", "}", "if", "(", "ret", ".", "getStatus", "(", ")", "!=", "200", ")", "{", "String", "errorMsg", "=", "String", ".", "format", "(", "\"Error, /api/sessions returned status code of %s: %s\"", ",", "ret", ".", "getStatus", "(", ")", ",", "ret", ".", "getStatusText", "(", ")", ")", ";", "throw", "new", "PeachApiException", "(", "errorMsg", ",", "null", ")", ";", "}", "_jobid", "=", "ret", ".", "getBody", "(", ")", ".", "getObject", "(", ")", ".", "getString", "(", "\"SessionId\"", ")", ";", "_proxyUrl", "=", "ret", ".", "getBody", "(", ")", ".", "getObject", "(", ")", ".", "getString", "(", "\"ProxyUrl\"", ")", ";", "verifyProxyAccess", "(", ")", ";", "}", "finally", "{", "revertUnirestProxy", "(", ")", ";", "}", "}" ]
Start a Peach API Security job. This will start a new job with associated proxy. Once the call returns the proxy is ready to accept traffic. Expected call flow: sessionSetup(...) Loop until finished: testSetup(...) testCase(...) testTeardown(...) suiteTeardown(...) sessionTeardown(...) @param project Name of project to start (e.g. "FlaskRestTarget") @param profile Name of profile to start (e.g. "Quick") @throws PeachApiException
[ "Start", "a", "Peach", "API", "Security", "job", "." ]
0ca274b0d1668fb4be0fed7e247394438374de58
https://github.com/PeachTech/peachweb-peachproxy-java/blob/0ca274b0d1668fb4be0fed7e247394438374de58/src/main/java/com/peachfuzzer/web/api/PeachProxy.java#L239-L284
152,349
PeachTech/peachweb-peachproxy-java
src/main/java/com/peachfuzzer/web/api/PeachProxy.java
PeachProxy.sessionTeardown
public void sessionTeardown() throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>sessionTeardown"); try { HttpResponse<String> ret = null; try { ret = Unirest .delete(String.format("%s/api/sessions/%s", _api, _jobid)) .header(_token_header, _api_token) .asString(); } catch (UnirestException ex) { Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex); throw new PeachApiException( String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s", ret.getStatus(), ret.getStatusText()); throw new PeachApiException(errorMsg, null); } } finally { revertUnirestProxy(); } }
java
public void sessionTeardown() throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>sessionTeardown"); try { HttpResponse<String> ret = null; try { ret = Unirest .delete(String.format("%s/api/sessions/%s", _api, _jobid)) .header(_token_header, _api_token) .asString(); } catch (UnirestException ex) { Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex); throw new PeachApiException( String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s", ret.getStatus(), ret.getStatusText()); throw new PeachApiException(errorMsg, null); } } finally { revertUnirestProxy(); } }
[ "public", "void", "sessionTeardown", "(", ")", "throws", "PeachApiException", "{", "stashUnirestProxy", "(", ")", ";", "if", "(", "_debug", ")", "System", ".", "out", ".", "println", "(", "\">>sessionTeardown\"", ")", ";", "try", "{", "HttpResponse", "<", "String", ">", "ret", "=", "null", ";", "try", "{", "ret", "=", "Unirest", ".", "delete", "(", "String", ".", "format", "(", "\"%s/api/sessions/%s\"", ",", "_api", ",", "_jobid", ")", ")", ".", "header", "(", "_token_header", ",", "_api_token", ")", ".", "asString", "(", ")", ";", "}", "catch", "(", "UnirestException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PeachProxy", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error contacting Peach API\"", ",", "ex", ")", ";", "throw", "new", "PeachApiException", "(", "String", ".", "format", "(", "\"Error, exception contacting Peach API: %s\"", ",", "ex", ".", "getMessage", "(", ")", ")", ",", "ex", ")", ";", "}", "if", "(", "ret", "==", "null", ")", "{", "throw", "new", "PeachApiException", "(", "\"Error, in Proxy.sessionTearDown: ret was null\"", ",", "null", ")", ";", "}", "if", "(", "ret", ".", "getStatus", "(", ")", "!=", "200", ")", "{", "String", "errorMsg", "=", "String", ".", "format", "(", "\"Error, DELETE /api/sessions/{jobid} returned status code of %s: %s\"", ",", "ret", ".", "getStatus", "(", ")", ",", "ret", ".", "getStatusText", "(", ")", ")", ";", "throw", "new", "PeachApiException", "(", "errorMsg", ",", "null", ")", ";", "}", "}", "finally", "{", "revertUnirestProxy", "(", ")", ";", "}", "}" ]
Stop testing job and destroy proxy. This will stop the current testing job and destroy the proxy. @throws PeachApiException
[ "Stop", "testing", "job", "and", "destroy", "proxy", "." ]
0ca274b0d1668fb4be0fed7e247394438374de58
https://github.com/PeachTech/peachweb-peachproxy-java/blob/0ca274b0d1668fb4be0fed7e247394438374de58/src/main/java/com/peachfuzzer/web/api/PeachProxy.java#L373-L411
152,350
lightblueseas/vintage-time
src/main/java/de/alpharogroup/date/DateExtensions.java
DateExtensions.getAllDatePatterns
public static Map<String, Object> getAllDatePatterns() throws IllegalAccessException { final Field[] fields = DatePatterns.class.getFields(); final Map<String, Object> patterns = new HashMap<>(fields.length); for (final Field field : fields) { patterns.put(field.getName(), field.get(field.getName())); } return patterns; }
java
public static Map<String, Object> getAllDatePatterns() throws IllegalAccessException { final Field[] fields = DatePatterns.class.getFields(); final Map<String, Object> patterns = new HashMap<>(fields.length); for (final Field field : fields) { patterns.put(field.getName(), field.get(field.getName())); } return patterns; }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "getAllDatePatterns", "(", ")", "throws", "IllegalAccessException", "{", "final", "Field", "[", "]", "fields", "=", "DatePatterns", ".", "class", ".", "getFields", "(", ")", ";", "final", "Map", "<", "String", ",", "Object", ">", "patterns", "=", "new", "HashMap", "<>", "(", "fields", ".", "length", ")", ";", "for", "(", "final", "Field", "field", ":", "fields", ")", "{", "patterns", ".", "put", "(", "field", ".", "getName", "(", ")", ",", "field", ".", "get", "(", "field", ".", "getName", "(", ")", ")", ")", ";", "}", "return", "patterns", ";", "}" ]
Returns a map with all date patterns from the Interface DatePatterns. As key is the name from the pattern. @return Returns a Map with all date patterns from the Interface DatePatterns. @throws IllegalAccessException is thrown when an application tries to reflectively create an instance
[ "Returns", "a", "map", "with", "all", "date", "patterns", "from", "the", "Interface", "DatePatterns", ".", "As", "key", "is", "the", "name", "from", "the", "pattern", "." ]
fbf201e679d9f9b92e7b5771f3eea1413cc2e113
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/DateExtensions.java#L77-L86
152,351
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.createPageControl
private Control createPageControl( Composite parent ) { Composite composite = new Composite( parent, SWT.NONE ); composite.setLayout( new GridLayout( 1, false ) ); GridData gridData = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL ); composite.setLayoutData( gridData ); Label fieldLabel = new Label( composite, SWT.NONE ); fieldLabel.setText( "&Query Text:" ); m_queryTextField = new Text( composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL ); GridData data = new GridData( GridData.FILL_HORIZONTAL ); data.heightHint = 100; m_queryTextField.setLayoutData( data ); m_queryTextField.addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { validateData(); } } ); setPageComplete( false ); return composite; }
java
private Control createPageControl( Composite parent ) { Composite composite = new Composite( parent, SWT.NONE ); composite.setLayout( new GridLayout( 1, false ) ); GridData gridData = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL ); composite.setLayoutData( gridData ); Label fieldLabel = new Label( composite, SWT.NONE ); fieldLabel.setText( "&Query Text:" ); m_queryTextField = new Text( composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL ); GridData data = new GridData( GridData.FILL_HORIZONTAL ); data.heightHint = 100; m_queryTextField.setLayoutData( data ); m_queryTextField.addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { validateData(); } } ); setPageComplete( false ); return composite; }
[ "private", "Control", "createPageControl", "(", "Composite", "parent", ")", "{", "Composite", "composite", "=", "new", "Composite", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "composite", ".", "setLayout", "(", "new", "GridLayout", "(", "1", ",", "false", ")", ")", ";", "GridData", "gridData", "=", "new", "GridData", "(", "GridData", ".", "HORIZONTAL_ALIGN_FILL", "|", "GridData", ".", "VERTICAL_ALIGN_FILL", ")", ";", "composite", ".", "setLayoutData", "(", "gridData", ")", ";", "Label", "fieldLabel", "=", "new", "Label", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "fieldLabel", ".", "setText", "(", "\"&Query Text:\"", ")", ";", "m_queryTextField", "=", "new", "Text", "(", "composite", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "V_SCROLL", "|", "SWT", ".", "H_SCROLL", ")", ";", "GridData", "data", "=", "new", "GridData", "(", "GridData", ".", "FILL_HORIZONTAL", ")", ";", "data", ".", "heightHint", "=", "100", ";", "m_queryTextField", ".", "setLayoutData", "(", "data", ")", ";", "m_queryTextField", ".", "addModifyListener", "(", "new", "ModifyListener", "(", ")", "{", "public", "void", "modifyText", "(", "ModifyEvent", "e", ")", "{", "validateData", "(", ")", ";", "}", "}", ")", ";", "setPageComplete", "(", "false", ")", ";", "return", "composite", ";", "}" ]
Creates custom control for user-defined query text.
[ "Creates", "custom", "control", "for", "user", "-", "defined", "query", "text", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L89-L116
152,352
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.initializeControl
private void initializeControl( ) { /* * To optionally restore the designer state of the previous design session, use * getInitializationDesignerState(); */ // Restores the last saved data set design DataSetDesign dataSetDesign = getInitializationDesign(); if( dataSetDesign == null ) return; // nothing to initialize String queryText = dataSetDesign.getQueryText(); if( queryText == null ) return; // nothing to initialize // initialize control m_queryTextField.setText( queryText ); validateData(); setMessage( DEFAULT_MESSAGE ); /* * To optionally honor the request for an editable or * read-only design session, use * isSessionEditable(); */ }
java
private void initializeControl( ) { /* * To optionally restore the designer state of the previous design session, use * getInitializationDesignerState(); */ // Restores the last saved data set design DataSetDesign dataSetDesign = getInitializationDesign(); if( dataSetDesign == null ) return; // nothing to initialize String queryText = dataSetDesign.getQueryText(); if( queryText == null ) return; // nothing to initialize // initialize control m_queryTextField.setText( queryText ); validateData(); setMessage( DEFAULT_MESSAGE ); /* * To optionally honor the request for an editable or * read-only design session, use * isSessionEditable(); */ }
[ "private", "void", "initializeControl", "(", ")", "{", "/* \n * To optionally restore the designer state of the previous design session, use\n * getInitializationDesignerState(); \n */", "// Restores the last saved data set design", "DataSetDesign", "dataSetDesign", "=", "getInitializationDesign", "(", ")", ";", "if", "(", "dataSetDesign", "==", "null", ")", "return", ";", "// nothing to initialize", "String", "queryText", "=", "dataSetDesign", ".", "getQueryText", "(", ")", ";", "if", "(", "queryText", "==", "null", ")", "return", ";", "// nothing to initialize", "// initialize control", "m_queryTextField", ".", "setText", "(", "queryText", ")", ";", "validateData", "(", ")", ";", "setMessage", "(", "DEFAULT_MESSAGE", ")", ";", "/*\n * To optionally honor the request for an editable or\n * read-only design session, use\n * isSessionEditable();\n */", "}" ]
Initializes the page control with the last edited data set design.
[ "Initializes", "the", "page", "control", "with", "the", "last", "edited", "data", "set", "design", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L121-L147
152,353
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.validateData
private void validateData( ) { boolean isValid = ( m_queryTextField != null && getQueryText() != null && getQueryText().trim().length() > 0 ); if( isValid ) setMessage( DEFAULT_MESSAGE ); else setMessage( "Requires input value.", ERROR ); setPageComplete( isValid ); }
java
private void validateData( ) { boolean isValid = ( m_queryTextField != null && getQueryText() != null && getQueryText().trim().length() > 0 ); if( isValid ) setMessage( DEFAULT_MESSAGE ); else setMessage( "Requires input value.", ERROR ); setPageComplete( isValid ); }
[ "private", "void", "validateData", "(", ")", "{", "boolean", "isValid", "=", "(", "m_queryTextField", "!=", "null", "&&", "getQueryText", "(", ")", "!=", "null", "&&", "getQueryText", "(", ")", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", ";", "if", "(", "isValid", ")", "setMessage", "(", "DEFAULT_MESSAGE", ")", ";", "else", "setMessage", "(", "\"Requires input value.\"", ",", "ERROR", ")", ";", "setPageComplete", "(", "isValid", ")", ";", "}" ]
Validates the user-defined value in the page control exists and not a blank text. Set page message accordingly.
[ "Validates", "the", "user", "-", "defined", "value", "in", "the", "page", "control", "exists", "and", "not", "a", "blank", "text", ".", "Set", "page", "message", "accordingly", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L201-L212
152,354
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.savePage
private void savePage( DataSetDesign dataSetDesign ) { // save user-defined query text String queryText = getQueryText(); dataSetDesign.setQueryText( queryText ); // obtain query's current runtime metadata, and maps it to the dataSetDesign IConnection customConn = null; try { // instantiate your custom ODA runtime driver class /* Note: You may need to manually update your ODA runtime extension's * plug-in manifest to export its package for visibility here. */ IDriver customDriver = new org.orienteer.birt.orientdb.impl.Driver(); // obtain and open a live connection customConn = customDriver.getConnection( null ); java.util.Properties connProps = DesignSessionUtil.getEffectiveDataSourceProperties( getInitializationDesign().getDataSourceDesign() ); customConn.open( connProps ); // update the data set design with the // query's current runtime metadata updateDesign( dataSetDesign, customConn, queryText ); } catch( OdaException e ) { // not able to get current metadata, reset previous derived metadata dataSetDesign.setResultSets( null ); dataSetDesign.setParameters( null ); e.printStackTrace(); } finally { closeConnection( customConn ); } }
java
private void savePage( DataSetDesign dataSetDesign ) { // save user-defined query text String queryText = getQueryText(); dataSetDesign.setQueryText( queryText ); // obtain query's current runtime metadata, and maps it to the dataSetDesign IConnection customConn = null; try { // instantiate your custom ODA runtime driver class /* Note: You may need to manually update your ODA runtime extension's * plug-in manifest to export its package for visibility here. */ IDriver customDriver = new org.orienteer.birt.orientdb.impl.Driver(); // obtain and open a live connection customConn = customDriver.getConnection( null ); java.util.Properties connProps = DesignSessionUtil.getEffectiveDataSourceProperties( getInitializationDesign().getDataSourceDesign() ); customConn.open( connProps ); // update the data set design with the // query's current runtime metadata updateDesign( dataSetDesign, customConn, queryText ); } catch( OdaException e ) { // not able to get current metadata, reset previous derived metadata dataSetDesign.setResultSets( null ); dataSetDesign.setParameters( null ); e.printStackTrace(); } finally { closeConnection( customConn ); } }
[ "private", "void", "savePage", "(", "DataSetDesign", "dataSetDesign", ")", "{", "// save user-defined query text", "String", "queryText", "=", "getQueryText", "(", ")", ";", "dataSetDesign", ".", "setQueryText", "(", "queryText", ")", ";", "// obtain query's current runtime metadata, and maps it to the dataSetDesign", "IConnection", "customConn", "=", "null", ";", "try", "{", "// instantiate your custom ODA runtime driver class", "/* Note: You may need to manually update your ODA runtime extension's\n * plug-in manifest to export its package for visibility here.\n */", "IDriver", "customDriver", "=", "new", "org", ".", "orienteer", ".", "birt", ".", "orientdb", ".", "impl", ".", "Driver", "(", ")", ";", "// obtain and open a live connection", "customConn", "=", "customDriver", ".", "getConnection", "(", "null", ")", ";", "java", ".", "util", ".", "Properties", "connProps", "=", "DesignSessionUtil", ".", "getEffectiveDataSourceProperties", "(", "getInitializationDesign", "(", ")", ".", "getDataSourceDesign", "(", ")", ")", ";", "customConn", ".", "open", "(", "connProps", ")", ";", "// update the data set design with the ", "// query's current runtime metadata", "updateDesign", "(", "dataSetDesign", ",", "customConn", ",", "queryText", ")", ";", "}", "catch", "(", "OdaException", "e", ")", "{", "// not able to get current metadata, reset previous derived metadata", "dataSetDesign", ".", "setResultSets", "(", "null", ")", ";", "dataSetDesign", ".", "setParameters", "(", "null", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "closeConnection", "(", "customConn", ")", ";", "}", "}" ]
Saves the user-defined value in this page, and updates the specified dataSetDesign with the latest design definition.
[ "Saves", "the", "user", "-", "defined", "value", "in", "this", "page", "and", "updates", "the", "specified", "dataSetDesign", "with", "the", "latest", "design", "definition", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L229-L268
152,355
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.updateDesign
private void updateDesign( DataSetDesign dataSetDesign, IConnection conn, String queryText ) throws OdaException { IQuery query = conn.newQuery( null ); query.prepare( queryText ); // TODO a runtime driver might require a query to first execute before // its metadata is available // query.setMaxRows( 1 ); // query.executeQuery(); try { IResultSetMetaData md = query.getMetaData(); updateResultSetDesign( md, dataSetDesign ); } catch( OdaException e ) { // no result set definition available, reset previous derived metadata dataSetDesign.setResultSets( null ); e.printStackTrace(); } // proceed to get parameter design definition try { IParameterMetaData paramMd = query.getParameterMetaData(); updateParameterDesign( paramMd, dataSetDesign ); } catch( OdaException ex ) { // no parameter definition available, reset previous derived metadata dataSetDesign.setParameters( null ); ex.printStackTrace(); } /* * See DesignSessionUtil for more convenience methods * to define a data set design instance. */ }
java
private void updateDesign( DataSetDesign dataSetDesign, IConnection conn, String queryText ) throws OdaException { IQuery query = conn.newQuery( null ); query.prepare( queryText ); // TODO a runtime driver might require a query to first execute before // its metadata is available // query.setMaxRows( 1 ); // query.executeQuery(); try { IResultSetMetaData md = query.getMetaData(); updateResultSetDesign( md, dataSetDesign ); } catch( OdaException e ) { // no result set definition available, reset previous derived metadata dataSetDesign.setResultSets( null ); e.printStackTrace(); } // proceed to get parameter design definition try { IParameterMetaData paramMd = query.getParameterMetaData(); updateParameterDesign( paramMd, dataSetDesign ); } catch( OdaException ex ) { // no parameter definition available, reset previous derived metadata dataSetDesign.setParameters( null ); ex.printStackTrace(); } /* * See DesignSessionUtil for more convenience methods * to define a data set design instance. */ }
[ "private", "void", "updateDesign", "(", "DataSetDesign", "dataSetDesign", ",", "IConnection", "conn", ",", "String", "queryText", ")", "throws", "OdaException", "{", "IQuery", "query", "=", "conn", ".", "newQuery", "(", "null", ")", ";", "query", ".", "prepare", "(", "queryText", ")", ";", "// TODO a runtime driver might require a query to first execute before", "// its metadata is available", "// query.setMaxRows( 1 );", "// query.executeQuery();", "try", "{", "IResultSetMetaData", "md", "=", "query", ".", "getMetaData", "(", ")", ";", "updateResultSetDesign", "(", "md", ",", "dataSetDesign", ")", ";", "}", "catch", "(", "OdaException", "e", ")", "{", "// no result set definition available, reset previous derived metadata", "dataSetDesign", ".", "setResultSets", "(", "null", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "// proceed to get parameter design definition", "try", "{", "IParameterMetaData", "paramMd", "=", "query", ".", "getParameterMetaData", "(", ")", ";", "updateParameterDesign", "(", "paramMd", ",", "dataSetDesign", ")", ";", "}", "catch", "(", "OdaException", "ex", ")", "{", "// no parameter definition available, reset previous derived metadata", "dataSetDesign", ".", "setParameters", "(", "null", ")", ";", "ex", ".", "printStackTrace", "(", ")", ";", "}", "/*\n * See DesignSessionUtil for more convenience methods\n * to define a data set design instance. \n */", "}" ]
Updates the given dataSetDesign with the queryText and its derived metadata obtained from the ODA runtime connection.
[ "Updates", "the", "given", "dataSetDesign", "with", "the", "queryText", "and", "its", "derived", "metadata", "obtained", "from", "the", "ODA", "runtime", "connection", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L274-L315
152,356
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.updateResultSetDesign
private void updateResultSetDesign( IResultSetMetaData md, DataSetDesign dataSetDesign ) throws OdaException { ResultSetColumns columns = DesignSessionUtil.toResultSetColumnsDesign( md ); ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE .createResultSetDefinition(); // resultSetDefn.setName( value ); // result set name resultSetDefn.setResultSetColumns( columns ); // no exception in conversion; go ahead and assign to specified dataSetDesign dataSetDesign.setPrimaryResultSet( resultSetDefn ); dataSetDesign.getResultSets().setDerivedMetaData( true ); }
java
private void updateResultSetDesign( IResultSetMetaData md, DataSetDesign dataSetDesign ) throws OdaException { ResultSetColumns columns = DesignSessionUtil.toResultSetColumnsDesign( md ); ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE .createResultSetDefinition(); // resultSetDefn.setName( value ); // result set name resultSetDefn.setResultSetColumns( columns ); // no exception in conversion; go ahead and assign to specified dataSetDesign dataSetDesign.setPrimaryResultSet( resultSetDefn ); dataSetDesign.getResultSets().setDerivedMetaData( true ); }
[ "private", "void", "updateResultSetDesign", "(", "IResultSetMetaData", "md", ",", "DataSetDesign", "dataSetDesign", ")", "throws", "OdaException", "{", "ResultSetColumns", "columns", "=", "DesignSessionUtil", ".", "toResultSetColumnsDesign", "(", "md", ")", ";", "ResultSetDefinition", "resultSetDefn", "=", "DesignFactory", ".", "eINSTANCE", ".", "createResultSetDefinition", "(", ")", ";", "// resultSetDefn.setName( value ); // result set name", "resultSetDefn", ".", "setResultSetColumns", "(", "columns", ")", ";", "// no exception in conversion; go ahead and assign to specified dataSetDesign", "dataSetDesign", ".", "setPrimaryResultSet", "(", "resultSetDefn", ")", ";", "dataSetDesign", ".", "getResultSets", "(", ")", ".", "setDerivedMetaData", "(", "true", ")", ";", "}" ]
Updates the specified data set design's result set definition based on the specified runtime metadata. @param md runtime result set metadata instance @param dataSetDesign data set design instance to update @throws OdaException
[ "Updates", "the", "specified", "data", "set", "design", "s", "result", "set", "definition", "based", "on", "the", "specified", "runtime", "metadata", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L324-L338
152,357
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.updateParameterDesign
private void updateParameterDesign( IParameterMetaData paramMd, DataSetDesign dataSetDesign ) throws OdaException { DataSetParameters paramDesign = DesignSessionUtil.toDataSetParametersDesign( paramMd, DesignSessionUtil.toParameterModeDesign( IParameterMetaData.parameterModeIn ) ); // no exception in conversion; go ahead and assign to specified dataSetDesign dataSetDesign.setParameters( paramDesign ); if( paramDesign == null ) return; // no parameter definitions; done with update paramDesign.setDerivedMetaData( true ); // TODO replace below with data source specific implementation; // hard-coded parameter's default value for demo purpose /* if( paramDesign.getParameterDefinitions().size() > 0 ) { ParameterDefinition paramDef = (ParameterDefinition) paramDesign.getParameterDefinitions().get( 0 ); if( paramDef != null ) paramDef.setDefaultScalarValue( "dummy default value" ); } */ }
java
private void updateParameterDesign( IParameterMetaData paramMd, DataSetDesign dataSetDesign ) throws OdaException { DataSetParameters paramDesign = DesignSessionUtil.toDataSetParametersDesign( paramMd, DesignSessionUtil.toParameterModeDesign( IParameterMetaData.parameterModeIn ) ); // no exception in conversion; go ahead and assign to specified dataSetDesign dataSetDesign.setParameters( paramDesign ); if( paramDesign == null ) return; // no parameter definitions; done with update paramDesign.setDerivedMetaData( true ); // TODO replace below with data source specific implementation; // hard-coded parameter's default value for demo purpose /* if( paramDesign.getParameterDefinitions().size() > 0 ) { ParameterDefinition paramDef = (ParameterDefinition) paramDesign.getParameterDefinitions().get( 0 ); if( paramDef != null ) paramDef.setDefaultScalarValue( "dummy default value" ); } */ }
[ "private", "void", "updateParameterDesign", "(", "IParameterMetaData", "paramMd", ",", "DataSetDesign", "dataSetDesign", ")", "throws", "OdaException", "{", "DataSetParameters", "paramDesign", "=", "DesignSessionUtil", ".", "toDataSetParametersDesign", "(", "paramMd", ",", "DesignSessionUtil", ".", "toParameterModeDesign", "(", "IParameterMetaData", ".", "parameterModeIn", ")", ")", ";", "// no exception in conversion; go ahead and assign to specified dataSetDesign", "dataSetDesign", ".", "setParameters", "(", "paramDesign", ")", ";", "if", "(", "paramDesign", "==", "null", ")", "return", ";", "// no parameter definitions; done with update", "paramDesign", ".", "setDerivedMetaData", "(", "true", ")", ";", "// TODO replace below with data source specific implementation;", "// hard-coded parameter's default value for demo purpose", "/*\n if( paramDesign.getParameterDefinitions().size() > 0 )\n {\n ParameterDefinition paramDef = \n (ParameterDefinition) paramDesign.getParameterDefinitions().get( 0 );\n if( paramDef != null )\n paramDef.setDefaultScalarValue( \"dummy default value\" );\n }\n */", "}" ]
Updates the specified data set design's parameter definition based on the specified runtime metadata. @param paramMd runtime parameter metadata instance @param dataSetDesign data set design instance to update @throws OdaException
[ "Updates", "the", "specified", "data", "set", "design", "s", "parameter", "definition", "based", "on", "the", "specified", "runtime", "metadata", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L347-L373
152,358
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java
CustomDataSetWizardPage.closeConnection
private void closeConnection( IConnection conn ) { try { if( conn != null && conn.isOpen() ) conn.close(); } catch ( OdaException e ) { // ignore e.printStackTrace(); } }
java
private void closeConnection( IConnection conn ) { try { if( conn != null && conn.isOpen() ) conn.close(); } catch ( OdaException e ) { // ignore e.printStackTrace(); } }
[ "private", "void", "closeConnection", "(", "IConnection", "conn", ")", "{", "try", "{", "if", "(", "conn", "!=", "null", "&&", "conn", ".", "isOpen", "(", ")", ")", "conn", ".", "close", "(", ")", ";", "}", "catch", "(", "OdaException", "e", ")", "{", "// ignore", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Attempts to close given ODA connection.
[ "Attempts", "to", "close", "given", "ODA", "connection", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb.ui/src/org/orienteer/birt/orientdb/ui/impl/CustomDataSetWizardPage.java#L378-L390
152,359
exKAZUu/GameAIArena
src/main/java/net/exkazuu/gameaiarena/api/Point2.java
Point2.getManhattanDistance
public int getManhattanDistance(Point2 that) { return Math.abs(x - that.x) + Math.abs(y - that.y); }
java
public int getManhattanDistance(Point2 that) { return Math.abs(x - that.x) + Math.abs(y - that.y); }
[ "public", "int", "getManhattanDistance", "(", "Point2", "that", ")", "{", "return", "Math", ".", "abs", "(", "x", "-", "that", ".", "x", ")", "+", "Math", ".", "abs", "(", "y", "-", "that", ".", "y", ")", ";", "}" ]
Returns the manhattan distance between this and specified points. @param that the point to calculate the manhattan distance @return the manhattan distance between this and specified points
[ "Returns", "the", "manhattan", "distance", "between", "this", "and", "specified", "points", "." ]
66894c251569fb763174654d6c262c5176dfcf48
https://github.com/exKAZUu/GameAIArena/blob/66894c251569fb763174654d6c262c5176dfcf48/src/main/java/net/exkazuu/gameaiarena/api/Point2.java#L136-L138
152,360
exKAZUu/GameAIArena
src/main/java/net/exkazuu/gameaiarena/api/Point2.java
Point2.move
@Deprecated public Point2 move(Direction4 direction) { return new Point2(x + direction.dx, y + direction.dy); }
java
@Deprecated public Point2 move(Direction4 direction) { return new Point2(x + direction.dx, y + direction.dy); }
[ "@", "Deprecated", "public", "Point2", "move", "(", "Direction4", "direction", ")", "{", "return", "new", "Point2", "(", "x", "+", "direction", ".", "dx", ",", "y", "+", "direction", ".", "dy", ")", ";", "}" ]
This method is deprecated so please use move method in Direction4. Returns the moved location from this position with the specified direction. @param direction the specified direction to move @return the moved location
[ "This", "method", "is", "deprecated", "so", "please", "use", "move", "method", "in", "Direction4", ".", "Returns", "the", "moved", "location", "from", "this", "position", "with", "the", "specified", "direction", "." ]
66894c251569fb763174654d6c262c5176dfcf48
https://github.com/exKAZUu/GameAIArena/blob/66894c251569fb763174654d6c262c5176dfcf48/src/main/java/net/exkazuu/gameaiarena/api/Point2.java#L157-L160
152,361
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlRecord.java
XmlRecord.setupField
public BaseField setupField(int iFieldSeq) { BaseField field = null; if (iFieldSeq == DBConstants.MAIN_FIELD) field = new CounterField(this, "ID", Constants.DEFAULT_FIELD_LENGTH, null, null); return field; }
java
public BaseField setupField(int iFieldSeq) { BaseField field = null; if (iFieldSeq == DBConstants.MAIN_FIELD) field = new CounterField(this, "ID", Constants.DEFAULT_FIELD_LENGTH, null, null); return field; }
[ "public", "BaseField", "setupField", "(", "int", "iFieldSeq", ")", "{", "BaseField", "field", "=", "null", ";", "if", "(", "iFieldSeq", "==", "DBConstants", ".", "MAIN_FIELD", ")", "field", "=", "new", "CounterField", "(", "this", ",", "\"ID\"", ",", "Constants", ".", "DEFAULT_FIELD_LENGTH", ",", "null", ",", "null", ")", ";", "return", "field", ";", "}" ]
Add this field in the Record's field sequence..
[ "Add", "this", "field", "in", "the", "Record", "s", "field", "sequence", ".." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlRecord.java#L94-L100
152,362
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlRecord.java
XmlRecord.setupKey
public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == DBConstants.MAIN_KEY_FIELD) { keyArea = this.makeIndex(DBConstants.UNIQUE, DBConstants.PRIMARY_KEY); keyArea.addKeyField(DBConstants.MAIN_FIELD, DBConstants.ASCENDING); } return keyArea; }
java
public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == DBConstants.MAIN_KEY_FIELD) { keyArea = this.makeIndex(DBConstants.UNIQUE, DBConstants.PRIMARY_KEY); keyArea.addKeyField(DBConstants.MAIN_FIELD, DBConstants.ASCENDING); } return keyArea; }
[ "public", "KeyArea", "setupKey", "(", "int", "iKeyArea", ")", "{", "KeyArea", "keyArea", "=", "null", ";", "if", "(", "iKeyArea", "==", "DBConstants", ".", "MAIN_KEY_FIELD", ")", "{", "keyArea", "=", "this", ".", "makeIndex", "(", "DBConstants", ".", "UNIQUE", ",", "DBConstants", ".", "PRIMARY_KEY", ")", ";", "keyArea", ".", "addKeyField", "(", "DBConstants", ".", "MAIN_FIELD", ",", "DBConstants", ".", "ASCENDING", ")", ";", "}", "return", "keyArea", ";", "}" ]
Add this key area description to the Record..
[ "Add", "this", "key", "area", "description", "to", "the", "Record", ".." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlRecord.java#L104-L113
152,363
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/sort/CSNodeSorter.java
CSNodeSorter.findEntry
private static <T extends Node> Map.Entry<CSNodeWrapper, T> findEntry(Map<CSNodeWrapper, T> map, Integer id) { if (id == null) return null; for (final Map.Entry<CSNodeWrapper, T> entry : map.entrySet()) { if (entry.getKey().getNextNode() != null && entry.getKey().getNextNode().getId().equals(id)) { return entry; } } return null; }
java
private static <T extends Node> Map.Entry<CSNodeWrapper, T> findEntry(Map<CSNodeWrapper, T> map, Integer id) { if (id == null) return null; for (final Map.Entry<CSNodeWrapper, T> entry : map.entrySet()) { if (entry.getKey().getNextNode() != null && entry.getKey().getNextNode().getId().equals(id)) { return entry; } } return null; }
[ "private", "static", "<", "T", "extends", "Node", ">", "Map", ".", "Entry", "<", "CSNodeWrapper", ",", "T", ">", "findEntry", "(", "Map", "<", "CSNodeWrapper", ",", "T", ">", "map", ",", "Integer", "id", ")", "{", "if", "(", "id", "==", "null", ")", "return", "null", ";", "for", "(", "final", "Map", ".", "Entry", "<", "CSNodeWrapper", ",", "T", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getKey", "(", ")", ".", "getNextNode", "(", ")", "!=", "null", "&&", "entry", ".", "getKey", "(", ")", ".", "getNextNode", "(", ")", ".", "getId", "(", ")", ".", "equals", "(", "id", ")", ")", "{", "return", "entry", ";", "}", "}", "return", "null", ";", "}" ]
Find the entry, how has a next node that matches a specified by a node id. @param map The map to find the entry from. @param id The next node ID of to find in the map @return The Entry value where the key matches the node id otherwise null.
[ "Find", "the", "entry", "how", "has", "a", "next", "node", "that", "matches", "a", "specified", "by", "a", "node", "id", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/sort/CSNodeSorter.java#L68-L78
152,364
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/sort/CSNodeSorter.java
CSNodeSorter.findLastEntry
private static <T extends Node> Map.Entry<CSNodeWrapper, T> findLastEntry(Map<CSNodeWrapper, T> map) { Map.Entry<CSNodeWrapper, T> nodeEntry = null; // Find the initial entry for (final Map.Entry<CSNodeWrapper, T> entry : map.entrySet()) { if (entry.getKey().getNextNode() == null) { nodeEntry = entry; break; } } return nodeEntry; }
java
private static <T extends Node> Map.Entry<CSNodeWrapper, T> findLastEntry(Map<CSNodeWrapper, T> map) { Map.Entry<CSNodeWrapper, T> nodeEntry = null; // Find the initial entry for (final Map.Entry<CSNodeWrapper, T> entry : map.entrySet()) { if (entry.getKey().getNextNode() == null) { nodeEntry = entry; break; } } return nodeEntry; }
[ "private", "static", "<", "T", "extends", "Node", ">", "Map", ".", "Entry", "<", "CSNodeWrapper", ",", "T", ">", "findLastEntry", "(", "Map", "<", "CSNodeWrapper", ",", "T", ">", "map", ")", "{", "Map", ".", "Entry", "<", "CSNodeWrapper", ",", "T", ">", "nodeEntry", "=", "null", ";", "// Find the initial entry", "for", "(", "final", "Map", ".", "Entry", "<", "CSNodeWrapper", ",", "T", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getKey", "(", ")", ".", "getNextNode", "(", ")", "==", "null", ")", "{", "nodeEntry", "=", "entry", ";", "break", ";", "}", "}", "return", "nodeEntry", ";", "}" ]
Finds the initial entry for the unordered map. @param map The unordered map. @return The initial entry to start sorting the map from.
[ "Finds", "the", "initial", "entry", "for", "the", "unordered", "map", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/sort/CSNodeSorter.java#L86-L98
152,365
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.checkSecurity
public boolean checkSecurity(JBasePanel baseScreen) { if ((this.getApplication() == null) || (baseScreen == null)) return true; // Never int iErrorCode = baseScreen.checkSecurity(this.getApplication()); if (iErrorCode == Constants.READ_ACCESS) { int iLevel = Constants.LOGIN_USER; try { iLevel = Integer.parseInt(this.getProperty(Params.SECURITY_LEVEL)); // This is my current login level } catch (NumberFormatException ex) { } if (iLevel == Constants.LOGIN_USER) iErrorCode = Constants.AUTHENTICATION_REQUIRED; // For now, thin security is manual (No read access control) else if (iLevel == Constants.LOGIN_AUTHENTICATED) iErrorCode = Constants.ACCESS_DENIED; // If they only are allowed read access, don't let them access this screen (for now) } if (iErrorCode == Constants.NORMAL_RETURN) return true; // Success if (iErrorCode == Constants.ACCESS_DENIED) { String strMessage = this.getApplication().getSecurityErrorText(iErrorCode); JOptionPane.showConfirmDialog(this, strMessage, strMessage, JOptionPane.OK_CANCEL_OPTION); return false; } String strDisplay = null; if ((iErrorCode == Constants.LOGIN_REQUIRED) || (iErrorCode == Constants.AUTHENTICATION_REQUIRED)) { iErrorCode = onLogonDialog(); if (iErrorCode == JOptionPane.CANCEL_OPTION) return false; // User clicked the cancel button if (iErrorCode == Constants.NORMAL_RETURN) return true; // Success strDisplay = this.getLastError(iErrorCode); } else strDisplay = this.getLastError(iErrorCode); // Display the error message and return! JOptionPane.showConfirmDialog(this, strDisplay, "Error", JOptionPane.OK_CANCEL_OPTION); return false; // Not successful }
java
public boolean checkSecurity(JBasePanel baseScreen) { if ((this.getApplication() == null) || (baseScreen == null)) return true; // Never int iErrorCode = baseScreen.checkSecurity(this.getApplication()); if (iErrorCode == Constants.READ_ACCESS) { int iLevel = Constants.LOGIN_USER; try { iLevel = Integer.parseInt(this.getProperty(Params.SECURITY_LEVEL)); // This is my current login level } catch (NumberFormatException ex) { } if (iLevel == Constants.LOGIN_USER) iErrorCode = Constants.AUTHENTICATION_REQUIRED; // For now, thin security is manual (No read access control) else if (iLevel == Constants.LOGIN_AUTHENTICATED) iErrorCode = Constants.ACCESS_DENIED; // If they only are allowed read access, don't let them access this screen (for now) } if (iErrorCode == Constants.NORMAL_RETURN) return true; // Success if (iErrorCode == Constants.ACCESS_DENIED) { String strMessage = this.getApplication().getSecurityErrorText(iErrorCode); JOptionPane.showConfirmDialog(this, strMessage, strMessage, JOptionPane.OK_CANCEL_OPTION); return false; } String strDisplay = null; if ((iErrorCode == Constants.LOGIN_REQUIRED) || (iErrorCode == Constants.AUTHENTICATION_REQUIRED)) { iErrorCode = onLogonDialog(); if (iErrorCode == JOptionPane.CANCEL_OPTION) return false; // User clicked the cancel button if (iErrorCode == Constants.NORMAL_RETURN) return true; // Success strDisplay = this.getLastError(iErrorCode); } else strDisplay = this.getLastError(iErrorCode); // Display the error message and return! JOptionPane.showConfirmDialog(this, strDisplay, "Error", JOptionPane.OK_CANCEL_OPTION); return false; // Not successful }
[ "public", "boolean", "checkSecurity", "(", "JBasePanel", "baseScreen", ")", "{", "if", "(", "(", "this", ".", "getApplication", "(", ")", "==", "null", ")", "||", "(", "baseScreen", "==", "null", ")", ")", "return", "true", ";", "// Never", "int", "iErrorCode", "=", "baseScreen", ".", "checkSecurity", "(", "this", ".", "getApplication", "(", ")", ")", ";", "if", "(", "iErrorCode", "==", "Constants", ".", "READ_ACCESS", ")", "{", "int", "iLevel", "=", "Constants", ".", "LOGIN_USER", ";", "try", "{", "iLevel", "=", "Integer", ".", "parseInt", "(", "this", ".", "getProperty", "(", "Params", ".", "SECURITY_LEVEL", ")", ")", ";", "// This is my current login level", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "}", "if", "(", "iLevel", "==", "Constants", ".", "LOGIN_USER", ")", "iErrorCode", "=", "Constants", ".", "AUTHENTICATION_REQUIRED", ";", "// For now, thin security is manual (No read access control)", "else", "if", "(", "iLevel", "==", "Constants", ".", "LOGIN_AUTHENTICATED", ")", "iErrorCode", "=", "Constants", ".", "ACCESS_DENIED", ";", "// If they only are allowed read access, don't let them access this screen (for now)", "}", "if", "(", "iErrorCode", "==", "Constants", ".", "NORMAL_RETURN", ")", "return", "true", ";", "// Success", "if", "(", "iErrorCode", "==", "Constants", ".", "ACCESS_DENIED", ")", "{", "String", "strMessage", "=", "this", ".", "getApplication", "(", ")", ".", "getSecurityErrorText", "(", "iErrorCode", ")", ";", "JOptionPane", ".", "showConfirmDialog", "(", "this", ",", "strMessage", ",", "strMessage", ",", "JOptionPane", ".", "OK_CANCEL_OPTION", ")", ";", "return", "false", ";", "}", "String", "strDisplay", "=", "null", ";", "if", "(", "(", "iErrorCode", "==", "Constants", ".", "LOGIN_REQUIRED", ")", "||", "(", "iErrorCode", "==", "Constants", ".", "AUTHENTICATION_REQUIRED", ")", ")", "{", "iErrorCode", "=", "onLogonDialog", "(", ")", ";", "if", "(", "iErrorCode", "==", "JOptionPane", ".", "CANCEL_OPTION", ")", "return", "false", ";", "// User clicked the cancel button", "if", "(", "iErrorCode", "==", "Constants", ".", "NORMAL_RETURN", ")", "return", "true", ";", "// Success", "strDisplay", "=", "this", ".", "getLastError", "(", "iErrorCode", ")", ";", "}", "else", "strDisplay", "=", "this", ".", "getLastError", "(", "iErrorCode", ")", ";", "// Display the error message and return!", "JOptionPane", ".", "showConfirmDialog", "(", "this", ",", "strDisplay", ",", "\"Error\"", ",", "JOptionPane", ".", "OK_CANCEL_OPTION", ")", ";", "return", "false", ";", "// Not successful", "}" ]
This is just for convenience. A simple way to change or set the screen for this applet. The old screen is removed and the new screen is added. This method is also used to switch a sub-screen to a new sub-screen. @param parent The (optional) parent to add this screen to (BaseApplet keeps track of the parent). @param baseScreen The new top screen to add. @param strCommandToPush Optional command to push on the stack to re-display this screen.
[ "This", "is", "just", "for", "convenience", ".", "A", "simple", "way", "to", "change", "or", "set", "the", "screen", "for", "this", "applet", ".", "The", "old", "screen", "is", "removed", "and", "the", "new", "screen", "is", "added", ".", "This", "method", "is", "also", "used", "to", "switch", "a", "sub", "-", "screen", "to", "a", "new", "sub", "-", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L352-L396
152,366
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.onLogonDialog
public int onLogonDialog() { String strDisplay = "Login required"; strDisplay = this.getTask().getString(strDisplay); for (int i = 1; i < 3; i++) { String strUserName = this.getProperty(Params.USER_NAME); Frame frame = ScreenUtil.getFrame(this); LoginDialog dialog = new LoginDialog(frame, true, strDisplay, strUserName); if (frame != null) ScreenUtil.centerDialogInFrame(dialog, frame); dialog.setVisible(true); int iOption = dialog.getReturnStatus(); if (iOption == LoginDialog.NEW_USER_OPTION) iOption = this.createNewUser(dialog); if (iOption != JOptionPane.OK_OPTION) return iOption; // Canceled dialog = You don't get in. strUserName = dialog.getUserName(); String strPassword = dialog.getPassword(); try { byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING); bytes = Base64.encodeSHA(bytes); char[] chars = Base64.encode(bytes); strPassword = new String(chars); } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } String strDomain = this.getProperty(Params.DOMAIN); int iSuccess = this.getApplication().login(this, strUserName, strPassword, strDomain); if (iSuccess == Constants.NORMAL_RETURN) { // If they want to save the user... save it in a muffin. if (this.getApplication().getMuffinManager() != null) if (this.getApplication().getMuffinManager().isServiceAvailable()) { if (dialog.getSaveState() == true) this.getApplication().getMuffinManager().setMuffin(Params.USER_ID, this.getApplication().getProperty(Params.USER_ID)); // Set muffin to current user. else this.getApplication().getMuffinManager().setMuffin(Params.USER_ID, null); // Set muffin to current user. } return iSuccess; } // Otherwise, continue looping (3 times) } return this.setLastError(strDisplay); }
java
public int onLogonDialog() { String strDisplay = "Login required"; strDisplay = this.getTask().getString(strDisplay); for (int i = 1; i < 3; i++) { String strUserName = this.getProperty(Params.USER_NAME); Frame frame = ScreenUtil.getFrame(this); LoginDialog dialog = new LoginDialog(frame, true, strDisplay, strUserName); if (frame != null) ScreenUtil.centerDialogInFrame(dialog, frame); dialog.setVisible(true); int iOption = dialog.getReturnStatus(); if (iOption == LoginDialog.NEW_USER_OPTION) iOption = this.createNewUser(dialog); if (iOption != JOptionPane.OK_OPTION) return iOption; // Canceled dialog = You don't get in. strUserName = dialog.getUserName(); String strPassword = dialog.getPassword(); try { byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING); bytes = Base64.encodeSHA(bytes); char[] chars = Base64.encode(bytes); strPassword = new String(chars); } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } String strDomain = this.getProperty(Params.DOMAIN); int iSuccess = this.getApplication().login(this, strUserName, strPassword, strDomain); if (iSuccess == Constants.NORMAL_RETURN) { // If they want to save the user... save it in a muffin. if (this.getApplication().getMuffinManager() != null) if (this.getApplication().getMuffinManager().isServiceAvailable()) { if (dialog.getSaveState() == true) this.getApplication().getMuffinManager().setMuffin(Params.USER_ID, this.getApplication().getProperty(Params.USER_ID)); // Set muffin to current user. else this.getApplication().getMuffinManager().setMuffin(Params.USER_ID, null); // Set muffin to current user. } return iSuccess; } // Otherwise, continue looping (3 times) } return this.setLastError(strDisplay); }
[ "public", "int", "onLogonDialog", "(", ")", "{", "String", "strDisplay", "=", "\"Login required\"", ";", "strDisplay", "=", "this", ".", "getTask", "(", ")", ".", "getString", "(", "strDisplay", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "3", ";", "i", "++", ")", "{", "String", "strUserName", "=", "this", ".", "getProperty", "(", "Params", ".", "USER_NAME", ")", ";", "Frame", "frame", "=", "ScreenUtil", ".", "getFrame", "(", "this", ")", ";", "LoginDialog", "dialog", "=", "new", "LoginDialog", "(", "frame", ",", "true", ",", "strDisplay", ",", "strUserName", ")", ";", "if", "(", "frame", "!=", "null", ")", "ScreenUtil", ".", "centerDialogInFrame", "(", "dialog", ",", "frame", ")", ";", "dialog", ".", "setVisible", "(", "true", ")", ";", "int", "iOption", "=", "dialog", ".", "getReturnStatus", "(", ")", ";", "if", "(", "iOption", "==", "LoginDialog", ".", "NEW_USER_OPTION", ")", "iOption", "=", "this", ".", "createNewUser", "(", "dialog", ")", ";", "if", "(", "iOption", "!=", "JOptionPane", ".", "OK_OPTION", ")", "return", "iOption", ";", "// Canceled dialog = You don't get in.", "strUserName", "=", "dialog", ".", "getUserName", "(", ")", ";", "String", "strPassword", "=", "dialog", ".", "getPassword", "(", ")", ";", "try", "{", "byte", "[", "]", "bytes", "=", "strPassword", ".", "getBytes", "(", "Base64", ".", "DEFAULT_ENCODING", ")", ";", "bytes", "=", "Base64", ".", "encodeSHA", "(", "bytes", ")", ";", "char", "[", "]", "chars", "=", "Base64", ".", "encode", "(", "bytes", ")", ";", "strPassword", "=", "new", "String", "(", "chars", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "String", "strDomain", "=", "this", ".", "getProperty", "(", "Params", ".", "DOMAIN", ")", ";", "int", "iSuccess", "=", "this", ".", "getApplication", "(", ")", ".", "login", "(", "this", ",", "strUserName", ",", "strPassword", ",", "strDomain", ")", ";", "if", "(", "iSuccess", "==", "Constants", ".", "NORMAL_RETURN", ")", "{", "// If they want to save the user... save it in a muffin.", "if", "(", "this", ".", "getApplication", "(", ")", ".", "getMuffinManager", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getApplication", "(", ")", ".", "getMuffinManager", "(", ")", ".", "isServiceAvailable", "(", ")", ")", "{", "if", "(", "dialog", ".", "getSaveState", "(", ")", "==", "true", ")", "this", ".", "getApplication", "(", ")", ".", "getMuffinManager", "(", ")", ".", "setMuffin", "(", "Params", ".", "USER_ID", ",", "this", ".", "getApplication", "(", ")", ".", "getProperty", "(", "Params", ".", "USER_ID", ")", ")", ";", "// Set muffin to current user.", "else", "this", ".", "getApplication", "(", ")", ".", "getMuffinManager", "(", ")", ".", "setMuffin", "(", "Params", ".", "USER_ID", ",", "null", ")", ";", "// Set muffin to current user.", "}", "return", "iSuccess", ";", "}", "// Otherwise, continue looping (3 times)", "}", "return", "this", ".", "setLastError", "(", "strDisplay", ")", ";", "}" ]
Display the logon dialog and login. @return
[ "Display", "the", "logon", "dialog", "and", "login", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L401-L448
152,367
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.onChangePassword
public int onChangePassword() { String strDisplay = "Login required"; strDisplay = this.getTask().getString(strDisplay); for (int i = 1; i < 3; i++) { String strUserName = this.getProperty(Params.USER_NAME); Frame frame = ScreenUtil.getFrame(this); ChangePasswordDialog dialog = new ChangePasswordDialog(frame, true, strDisplay, strUserName); ScreenUtil.centerDialogInFrame(dialog, frame); dialog.setVisible(true); int iOption = dialog.getReturnStatus(); if (iOption != JOptionPane.OK_OPTION) return iOption; // Canceled dialog = You don't get in. strUserName = dialog.getUserName(); String strPassword = dialog.getCurrentPassword(); String strNewPassword = dialog.getNewPassword(); try { byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING); bytes = Base64.encodeSHA(bytes); char[] chars = Base64.encode(bytes); strPassword = new String(chars); bytes = strNewPassword.getBytes(Base64.DEFAULT_ENCODING); bytes = Base64.encodeSHA(bytes); chars = Base64.encode(bytes); strNewPassword = new String(chars); } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } int errorCode = this.getApplication().createNewUser(this, strUserName, strPassword, strNewPassword); if (errorCode == Constants.NORMAL_RETURN) return errorCode; } return this.setLastError(strDisplay); }
java
public int onChangePassword() { String strDisplay = "Login required"; strDisplay = this.getTask().getString(strDisplay); for (int i = 1; i < 3; i++) { String strUserName = this.getProperty(Params.USER_NAME); Frame frame = ScreenUtil.getFrame(this); ChangePasswordDialog dialog = new ChangePasswordDialog(frame, true, strDisplay, strUserName); ScreenUtil.centerDialogInFrame(dialog, frame); dialog.setVisible(true); int iOption = dialog.getReturnStatus(); if (iOption != JOptionPane.OK_OPTION) return iOption; // Canceled dialog = You don't get in. strUserName = dialog.getUserName(); String strPassword = dialog.getCurrentPassword(); String strNewPassword = dialog.getNewPassword(); try { byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING); bytes = Base64.encodeSHA(bytes); char[] chars = Base64.encode(bytes); strPassword = new String(chars); bytes = strNewPassword.getBytes(Base64.DEFAULT_ENCODING); bytes = Base64.encodeSHA(bytes); chars = Base64.encode(bytes); strNewPassword = new String(chars); } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } int errorCode = this.getApplication().createNewUser(this, strUserName, strPassword, strNewPassword); if (errorCode == Constants.NORMAL_RETURN) return errorCode; } return this.setLastError(strDisplay); }
[ "public", "int", "onChangePassword", "(", ")", "{", "String", "strDisplay", "=", "\"Login required\"", ";", "strDisplay", "=", "this", ".", "getTask", "(", ")", ".", "getString", "(", "strDisplay", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "3", ";", "i", "++", ")", "{", "String", "strUserName", "=", "this", ".", "getProperty", "(", "Params", ".", "USER_NAME", ")", ";", "Frame", "frame", "=", "ScreenUtil", ".", "getFrame", "(", "this", ")", ";", "ChangePasswordDialog", "dialog", "=", "new", "ChangePasswordDialog", "(", "frame", ",", "true", ",", "strDisplay", ",", "strUserName", ")", ";", "ScreenUtil", ".", "centerDialogInFrame", "(", "dialog", ",", "frame", ")", ";", "dialog", ".", "setVisible", "(", "true", ")", ";", "int", "iOption", "=", "dialog", ".", "getReturnStatus", "(", ")", ";", "if", "(", "iOption", "!=", "JOptionPane", ".", "OK_OPTION", ")", "return", "iOption", ";", "// Canceled dialog = You don't get in.", "strUserName", "=", "dialog", ".", "getUserName", "(", ")", ";", "String", "strPassword", "=", "dialog", ".", "getCurrentPassword", "(", ")", ";", "String", "strNewPassword", "=", "dialog", ".", "getNewPassword", "(", ")", ";", "try", "{", "byte", "[", "]", "bytes", "=", "strPassword", ".", "getBytes", "(", "Base64", ".", "DEFAULT_ENCODING", ")", ";", "bytes", "=", "Base64", ".", "encodeSHA", "(", "bytes", ")", ";", "char", "[", "]", "chars", "=", "Base64", ".", "encode", "(", "bytes", ")", ";", "strPassword", "=", "new", "String", "(", "chars", ")", ";", "bytes", "=", "strNewPassword", ".", "getBytes", "(", "Base64", ".", "DEFAULT_ENCODING", ")", ";", "bytes", "=", "Base64", ".", "encodeSHA", "(", "bytes", ")", ";", "chars", "=", "Base64", ".", "encode", "(", "bytes", ")", ";", "strNewPassword", "=", "new", "String", "(", "chars", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "int", "errorCode", "=", "this", ".", "getApplication", "(", ")", ".", "createNewUser", "(", "this", ",", "strUserName", ",", "strPassword", ",", "strNewPassword", ")", ";", "if", "(", "errorCode", "==", "Constants", ".", "NORMAL_RETURN", ")", "return", "errorCode", ";", "}", "return", "this", ".", "setLastError", "(", "strDisplay", ")", ";", "}" ]
Display the change password dialog and change the password. @return
[ "Display", "the", "change", "password", "dialog", "and", "change", "the", "password", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L478-L517
152,368
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.changeSubScreen
public boolean changeSubScreen(Container parent, JBasePanel baseScreen, String strCommandToPush, int options) { if ((parent == null) || (parent == this)) parent = m_parent; boolean bScreenChange = false; if (!this.checkSecurity(baseScreen)) { baseScreen.free(); return false; } this.freeSubComponents(parent); if (parent.getComponentCount() > 0) { // Remove all the old components parent.removeAll(); bScreenChange = true; } JComponent screen = baseScreen; if (!(parent.getLayout() instanceof BoxLayout)) parent.setLayout(new BorderLayout()); // If default layout, use box layout! screen = baseScreen.setupNewScreen(baseScreen); screen.setMinimumSize(new Dimension(100, 100)); screen.setAlignmentX(LEFT_ALIGNMENT); screen.setAlignmentY(TOP_ALIGNMENT); parent.add(screen); if (bScreenChange) { this.invalidate(); this.validate(); this.repaint(); baseScreen.resetFocus(); } if (parent == m_parent) { if (strCommandToPush == null) strCommandToPush = baseScreen.getScreenCommand(); if (strCommandToPush != null) if ((options & Constants.DONT_PUSH_HISTORY) == 0) this.pushHistory(strCommandToPush, ((options & Constants.DONT_PUSH_TO_BROWSER) == Constants.PUSH_TO_BROWSER)); } return true; // Success }
java
public boolean changeSubScreen(Container parent, JBasePanel baseScreen, String strCommandToPush, int options) { if ((parent == null) || (parent == this)) parent = m_parent; boolean bScreenChange = false; if (!this.checkSecurity(baseScreen)) { baseScreen.free(); return false; } this.freeSubComponents(parent); if (parent.getComponentCount() > 0) { // Remove all the old components parent.removeAll(); bScreenChange = true; } JComponent screen = baseScreen; if (!(parent.getLayout() instanceof BoxLayout)) parent.setLayout(new BorderLayout()); // If default layout, use box layout! screen = baseScreen.setupNewScreen(baseScreen); screen.setMinimumSize(new Dimension(100, 100)); screen.setAlignmentX(LEFT_ALIGNMENT); screen.setAlignmentY(TOP_ALIGNMENT); parent.add(screen); if (bScreenChange) { this.invalidate(); this.validate(); this.repaint(); baseScreen.resetFocus(); } if (parent == m_parent) { if (strCommandToPush == null) strCommandToPush = baseScreen.getScreenCommand(); if (strCommandToPush != null) if ((options & Constants.DONT_PUSH_HISTORY) == 0) this.pushHistory(strCommandToPush, ((options & Constants.DONT_PUSH_TO_BROWSER) == Constants.PUSH_TO_BROWSER)); } return true; // Success }
[ "public", "boolean", "changeSubScreen", "(", "Container", "parent", ",", "JBasePanel", "baseScreen", ",", "String", "strCommandToPush", ",", "int", "options", ")", "{", "if", "(", "(", "parent", "==", "null", ")", "||", "(", "parent", "==", "this", ")", ")", "parent", "=", "m_parent", ";", "boolean", "bScreenChange", "=", "false", ";", "if", "(", "!", "this", ".", "checkSecurity", "(", "baseScreen", ")", ")", "{", "baseScreen", ".", "free", "(", ")", ";", "return", "false", ";", "}", "this", ".", "freeSubComponents", "(", "parent", ")", ";", "if", "(", "parent", ".", "getComponentCount", "(", ")", ">", "0", ")", "{", "// Remove all the old components", "parent", ".", "removeAll", "(", ")", ";", "bScreenChange", "=", "true", ";", "}", "JComponent", "screen", "=", "baseScreen", ";", "if", "(", "!", "(", "parent", ".", "getLayout", "(", ")", "instanceof", "BoxLayout", ")", ")", "parent", ".", "setLayout", "(", "new", "BorderLayout", "(", ")", ")", ";", "// If default layout, use box layout!", "screen", "=", "baseScreen", ".", "setupNewScreen", "(", "baseScreen", ")", ";", "screen", ".", "setMinimumSize", "(", "new", "Dimension", "(", "100", ",", "100", ")", ")", ";", "screen", ".", "setAlignmentX", "(", "LEFT_ALIGNMENT", ")", ";", "screen", ".", "setAlignmentY", "(", "TOP_ALIGNMENT", ")", ";", "parent", ".", "add", "(", "screen", ")", ";", "if", "(", "bScreenChange", ")", "{", "this", ".", "invalidate", "(", ")", ";", "this", ".", "validate", "(", ")", ";", "this", ".", "repaint", "(", ")", ";", "baseScreen", ".", "resetFocus", "(", ")", ";", "}", "if", "(", "parent", "==", "m_parent", ")", "{", "if", "(", "strCommandToPush", "==", "null", ")", "strCommandToPush", "=", "baseScreen", ".", "getScreenCommand", "(", ")", ";", "if", "(", "strCommandToPush", "!=", "null", ")", "if", "(", "(", "options", "&", "Constants", ".", "DONT_PUSH_HISTORY", ")", "==", "0", ")", "this", ".", "pushHistory", "(", "strCommandToPush", ",", "(", "(", "options", "&", "Constants", ".", "DONT_PUSH_TO_BROWSER", ")", "==", "Constants", ".", "PUSH_TO_BROWSER", ")", ")", ";", "}", "return", "true", ";", "// Success", "}" ]
Change the sub-screen. @param parent @param baseScreen @param strCommandToPush @param options @return
[ "Change", "the", "sub", "-", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L526-L570
152,369
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.loadImageIcon
public ImageIcon loadImageIcon(String filename, String description) { filename = Util.getImageFilename(filename, "buttons"); URL url = null; if (this.getApplication() != null) url = this.getApplication().getResourceURL(filename, this); if (url == null) { // Not a resource, try reading it from the disk. try { return new ImageIcon(filename, description); } catch (Exception ex) { // File not found - try a fully qualified URL. ex.printStackTrace(); return null; } } return new ImageIcon(url, description); }
java
public ImageIcon loadImageIcon(String filename, String description) { filename = Util.getImageFilename(filename, "buttons"); URL url = null; if (this.getApplication() != null) url = this.getApplication().getResourceURL(filename, this); if (url == null) { // Not a resource, try reading it from the disk. try { return new ImageIcon(filename, description); } catch (Exception ex) { // File not found - try a fully qualified URL. ex.printStackTrace(); return null; } } return new ImageIcon(url, description); }
[ "public", "ImageIcon", "loadImageIcon", "(", "String", "filename", ",", "String", "description", ")", "{", "filename", "=", "Util", ".", "getImageFilename", "(", "filename", ",", "\"buttons\"", ")", ";", "URL", "url", "=", "null", ";", "if", "(", "this", ".", "getApplication", "(", ")", "!=", "null", ")", "url", "=", "this", ".", "getApplication", "(", ")", ".", "getResourceURL", "(", "filename", ",", "this", ")", ";", "if", "(", "url", "==", "null", ")", "{", "// Not a resource, try reading it from the disk.", "try", "{", "return", "new", "ImageIcon", "(", "filename", ",", "description", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "// File not found - try a fully qualified URL.", "ex", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}", "return", "new", "ImageIcon", "(", "url", ",", "description", ")", ";", "}" ]
Get this image. @param filename The filename of this image (if no path, assumes images/buttons; if not ext assumes .gif). @param description The image description. @return The image.
[ "Get", "this", "image", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L655-L671
152,370
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.setBackgroundColor
public void setBackgroundColor(Color colorBackground) { m_colorBackground = colorBackground; if (m_parent != null) { JTiledImage panel = (JTiledImage)JBasePanel.getSubScreen(this, JTiledImage.class); if (panel != null) panel.setBackground(colorBackground); } }
java
public void setBackgroundColor(Color colorBackground) { m_colorBackground = colorBackground; if (m_parent != null) { JTiledImage panel = (JTiledImage)JBasePanel.getSubScreen(this, JTiledImage.class); if (panel != null) panel.setBackground(colorBackground); } }
[ "public", "void", "setBackgroundColor", "(", "Color", "colorBackground", ")", "{", "m_colorBackground", "=", "colorBackground", ";", "if", "(", "m_parent", "!=", "null", ")", "{", "JTiledImage", "panel", "=", "(", "JTiledImage", ")", "JBasePanel", ".", "getSubScreen", "(", "this", ",", "JTiledImage", ".", "class", ")", ";", "if", "(", "panel", "!=", "null", ")", "panel", ".", "setBackground", "(", "colorBackground", ")", ";", "}", "}" ]
Set the background image's color. @param colorBackground The color to set the background.
[ "Set", "the", "background", "image", "s", "color", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L792-L801
152,371
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.nameToColor
public static Color nameToColor(String strColor) { final Object[][] obj = { {"black", Color.black}, {"blue", Color.blue}, {"cyan", Color.cyan}, {"darkGray", Color.darkGray}, {"gray", Color.gray}, {"green", Color.green}, {"lightGray", Color.lightGray}, {"magenta", Color.magenta}, {"orange", Color.orange}, {"pink", Color.pink}, {"red", Color.red}, {"white", Color.white}, {"yellow", Color.yellow} }; // Not static, because this method is usually not called. for (int i = 0; i < obj.length; i++) { if (strColor.equalsIgnoreCase((String)obj[i][0])) return (Color)obj[i][1]; } try { return Color.decode(strColor); } catch (NumberFormatException ex) { } return null; }
java
public static Color nameToColor(String strColor) { final Object[][] obj = { {"black", Color.black}, {"blue", Color.blue}, {"cyan", Color.cyan}, {"darkGray", Color.darkGray}, {"gray", Color.gray}, {"green", Color.green}, {"lightGray", Color.lightGray}, {"magenta", Color.magenta}, {"orange", Color.orange}, {"pink", Color.pink}, {"red", Color.red}, {"white", Color.white}, {"yellow", Color.yellow} }; // Not static, because this method is usually not called. for (int i = 0; i < obj.length; i++) { if (strColor.equalsIgnoreCase((String)obj[i][0])) return (Color)obj[i][1]; } try { return Color.decode(strColor); } catch (NumberFormatException ex) { } return null; }
[ "public", "static", "Color", "nameToColor", "(", "String", "strColor", ")", "{", "final", "Object", "[", "]", "[", "]", "obj", "=", "{", "{", "\"black\"", ",", "Color", ".", "black", "}", ",", "{", "\"blue\"", ",", "Color", ".", "blue", "}", ",", "{", "\"cyan\"", ",", "Color", ".", "cyan", "}", ",", "{", "\"darkGray\"", ",", "Color", ".", "darkGray", "}", ",", "{", "\"gray\"", ",", "Color", ".", "gray", "}", ",", "{", "\"green\"", ",", "Color", ".", "green", "}", ",", "{", "\"lightGray\"", ",", "Color", ".", "lightGray", "}", ",", "{", "\"magenta\"", ",", "Color", ".", "magenta", "}", ",", "{", "\"orange\"", ",", "Color", ".", "orange", "}", ",", "{", "\"pink\"", ",", "Color", ".", "pink", "}", ",", "{", "\"red\"", ",", "Color", ".", "red", "}", ",", "{", "\"white\"", ",", "Color", ".", "white", "}", ",", "{", "\"yellow\"", ",", "Color", ".", "yellow", "}", "}", ";", "// Not static, because this method is usually not called.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "obj", ".", "length", ";", "i", "++", ")", "{", "if", "(", "strColor", ".", "equalsIgnoreCase", "(", "(", "String", ")", "obj", "[", "i", "]", "[", "0", "]", ")", ")", "return", "(", "Color", ")", "obj", "[", "i", "]", "[", "1", "]", ";", "}", "try", "{", "return", "Color", ".", "decode", "(", "strColor", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "}", "return", "null", ";", "}" ]
Convert this color string to the Color object. @param strColor Name of the color (ie., gray or 0xFFFFCF or #FFFFCF). @return The java color object (or null).
[ "Convert", "this", "color", "string", "to", "the", "Color", "object", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L825-L852
152,372
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.doAction
public boolean doAction(String strAction, int iOptions) { if (Constants.BACK.equalsIgnoreCase(strAction)) { String strPrevAction = this.popHistory(1, false); // Current screen strAction = this.popHistory(1, false); // Last screen if (strAction != null) // I don't back up into the browser history if the user hit the java back button. { // If that wasn't the first screen, redo pop and update the browser this time this.pushHistory(strAction, false); strAction = this.popHistory(1, true); } if (strAction != null) { iOptions = iOptions | Constants.DONT_PUSH_TO_BROWSER; // Don't push the back command if (!Constants.BACK.equalsIgnoreCase(strAction)) // Never (prevent endless recursion) return this.doAction(strAction, iOptions); } else if (strPrevAction != null) this.pushHistory(strPrevAction, false); // If top of stack, leave it alone. } if (Constants.HELP.equalsIgnoreCase(strAction)) { String strPrevAction = this.popHistory(1, true); // Current screen this.pushHistory(strPrevAction, ((iOptions & Constants.DONT_PUSH_TO_BROWSER) == Constants.PUSH_TO_BROWSER)); // If top of stack, leave it alone. if ((strPrevAction != null) && (strPrevAction.length() > 0) && (strPrevAction.charAt(0) != '?')) strPrevAction = "?" + strPrevAction; String strURL = Util.addURLParam(strPrevAction, Params.HELP, Constants.BLANK); iOptions = this.getHelpPageOptions(iOptions); return this.getApplication().showTheDocument(strURL, this, iOptions); } if (strAction != null) if (strAction.indexOf('=') != -1) { Map<String,Object> properties = new Hashtable<String,Object>(); Util.parseArgs(properties, strAction); String strApplet = (String)properties.get(Params.APPLET); if (strApplet != null) { this.setProperties(properties); if (!this.addSubPanels(null, iOptions)) return false; // If error, return false this.popHistory(1, false); // Pop the default command, the action command is better. this.pushHistory(UrlUtil.propertiesToUrl(properties), false); // Since it was pushed to the browser on addSubPanels return true; // Command handled } } if (Util.isURL(strAction)) this.getApplication().showTheDocument(strAction, this, ThinMenuConstants.EXTERNAL_LINK); return false; }
java
public boolean doAction(String strAction, int iOptions) { if (Constants.BACK.equalsIgnoreCase(strAction)) { String strPrevAction = this.popHistory(1, false); // Current screen strAction = this.popHistory(1, false); // Last screen if (strAction != null) // I don't back up into the browser history if the user hit the java back button. { // If that wasn't the first screen, redo pop and update the browser this time this.pushHistory(strAction, false); strAction = this.popHistory(1, true); } if (strAction != null) { iOptions = iOptions | Constants.DONT_PUSH_TO_BROWSER; // Don't push the back command if (!Constants.BACK.equalsIgnoreCase(strAction)) // Never (prevent endless recursion) return this.doAction(strAction, iOptions); } else if (strPrevAction != null) this.pushHistory(strPrevAction, false); // If top of stack, leave it alone. } if (Constants.HELP.equalsIgnoreCase(strAction)) { String strPrevAction = this.popHistory(1, true); // Current screen this.pushHistory(strPrevAction, ((iOptions & Constants.DONT_PUSH_TO_BROWSER) == Constants.PUSH_TO_BROWSER)); // If top of stack, leave it alone. if ((strPrevAction != null) && (strPrevAction.length() > 0) && (strPrevAction.charAt(0) != '?')) strPrevAction = "?" + strPrevAction; String strURL = Util.addURLParam(strPrevAction, Params.HELP, Constants.BLANK); iOptions = this.getHelpPageOptions(iOptions); return this.getApplication().showTheDocument(strURL, this, iOptions); } if (strAction != null) if (strAction.indexOf('=') != -1) { Map<String,Object> properties = new Hashtable<String,Object>(); Util.parseArgs(properties, strAction); String strApplet = (String)properties.get(Params.APPLET); if (strApplet != null) { this.setProperties(properties); if (!this.addSubPanels(null, iOptions)) return false; // If error, return false this.popHistory(1, false); // Pop the default command, the action command is better. this.pushHistory(UrlUtil.propertiesToUrl(properties), false); // Since it was pushed to the browser on addSubPanels return true; // Command handled } } if (Util.isURL(strAction)) this.getApplication().showTheDocument(strAction, this, ThinMenuConstants.EXTERNAL_LINK); return false; }
[ "public", "boolean", "doAction", "(", "String", "strAction", ",", "int", "iOptions", ")", "{", "if", "(", "Constants", ".", "BACK", ".", "equalsIgnoreCase", "(", "strAction", ")", ")", "{", "String", "strPrevAction", "=", "this", ".", "popHistory", "(", "1", ",", "false", ")", ";", "// Current screen", "strAction", "=", "this", ".", "popHistory", "(", "1", ",", "false", ")", ";", "// Last screen", "if", "(", "strAction", "!=", "null", ")", "// I don't back up into the browser history if the user hit the java back button.", "{", "// If that wasn't the first screen, redo pop and update the browser this time", "this", ".", "pushHistory", "(", "strAction", ",", "false", ")", ";", "strAction", "=", "this", ".", "popHistory", "(", "1", ",", "true", ")", ";", "}", "if", "(", "strAction", "!=", "null", ")", "{", "iOptions", "=", "iOptions", "|", "Constants", ".", "DONT_PUSH_TO_BROWSER", ";", "// Don't push the back command", "if", "(", "!", "Constants", ".", "BACK", ".", "equalsIgnoreCase", "(", "strAction", ")", ")", "// Never (prevent endless recursion)", "return", "this", ".", "doAction", "(", "strAction", ",", "iOptions", ")", ";", "}", "else", "if", "(", "strPrevAction", "!=", "null", ")", "this", ".", "pushHistory", "(", "strPrevAction", ",", "false", ")", ";", "// If top of stack, leave it alone.", "}", "if", "(", "Constants", ".", "HELP", ".", "equalsIgnoreCase", "(", "strAction", ")", ")", "{", "String", "strPrevAction", "=", "this", ".", "popHistory", "(", "1", ",", "true", ")", ";", "// Current screen", "this", ".", "pushHistory", "(", "strPrevAction", ",", "(", "(", "iOptions", "&", "Constants", ".", "DONT_PUSH_TO_BROWSER", ")", "==", "Constants", ".", "PUSH_TO_BROWSER", ")", ")", ";", "// If top of stack, leave it alone.", "if", "(", "(", "strPrevAction", "!=", "null", ")", "&&", "(", "strPrevAction", ".", "length", "(", ")", ">", "0", ")", "&&", "(", "strPrevAction", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", ")", "strPrevAction", "=", "\"?\"", "+", "strPrevAction", ";", "String", "strURL", "=", "Util", ".", "addURLParam", "(", "strPrevAction", ",", "Params", ".", "HELP", ",", "Constants", ".", "BLANK", ")", ";", "iOptions", "=", "this", ".", "getHelpPageOptions", "(", "iOptions", ")", ";", "return", "this", ".", "getApplication", "(", ")", ".", "showTheDocument", "(", "strURL", ",", "this", ",", "iOptions", ")", ";", "}", "if", "(", "strAction", "!=", "null", ")", "if", "(", "strAction", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "Util", ".", "parseArgs", "(", "properties", ",", "strAction", ")", ";", "String", "strApplet", "=", "(", "String", ")", "properties", ".", "get", "(", "Params", ".", "APPLET", ")", ";", "if", "(", "strApplet", "!=", "null", ")", "{", "this", ".", "setProperties", "(", "properties", ")", ";", "if", "(", "!", "this", ".", "addSubPanels", "(", "null", ",", "iOptions", ")", ")", "return", "false", ";", "// If error, return false", "this", ".", "popHistory", "(", "1", ",", "false", ")", ";", "// Pop the default command, the action command is better.", "this", ".", "pushHistory", "(", "UrlUtil", ".", "propertiesToUrl", "(", "properties", ")", ",", "false", ")", ";", "// Since it was pushed to the browser on addSubPanels", "return", "true", ";", "// Command handled", "}", "}", "if", "(", "Util", ".", "isURL", "(", "strAction", ")", ")", "this", ".", "getApplication", "(", ")", ".", "showTheDocument", "(", "strAction", ",", "this", ",", "ThinMenuConstants", ".", "EXTERNAL_LINK", ")", ";", "return", "false", ";", "}" ]
Do some applet-wide action. For example, submit or reset. Pass this action down to all the JBaseScreens. Remember to override this method to send the actual data! @param iOptions Extra command options
[ "Do", "some", "applet", "-", "wide", "action", ".", "For", "example", "submit", "or", "reset", ".", "Pass", "this", "action", "down", "to", "all", "the", "JBaseScreens", ".", "Remember", "to", "override", "this", "method", "to", "send", "the", "actual", "data!" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L859-L910
152,373
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.getHelpPageOptions
public int getHelpPageOptions(int iOptions) { String strPreference = this.getProperty(ThinMenuConstants.USER_HELP_DISPLAY); if ((strPreference == null) || (strPreference.length() == 0)) strPreference = this.getProperty(ThinMenuConstants.HELP_DISPLAY); if (this.getHelpView() == null) if (ThinMenuConstants.HELP_PANE.equalsIgnoreCase(strPreference)) strPreference = null; if ((strPreference == null) || (strPreference.length() == 0)) { //if (this.getAppletScreen() != null) // strPreference = MenuConstants.HELP_WEB; //else if ((applet.getHelpView() != null) && (applet.getHelpView().getBaseApplet() == applet)) strPreference = ThinMenuConstants.HELP_PANE; //else // strPreference = MenuConstants.HELP_WINDOW; } if (ThinMenuConstants.HELP_WEB.equalsIgnoreCase(strPreference)) iOptions = ThinMenuConstants.HELP_WEB_OPTION; else if (ThinMenuConstants.HELP_PANE.equalsIgnoreCase(strPreference)) iOptions = ThinMenuConstants.HELP_PANE_OPTION; else if (ThinMenuConstants.HELP_WINDOW.equalsIgnoreCase(strPreference)) iOptions = ThinMenuConstants.HELP_WINDOW_OPTION; else iOptions = ThinMenuConstants.HELP_PANE_OPTION; // Default return iOptions; }
java
public int getHelpPageOptions(int iOptions) { String strPreference = this.getProperty(ThinMenuConstants.USER_HELP_DISPLAY); if ((strPreference == null) || (strPreference.length() == 0)) strPreference = this.getProperty(ThinMenuConstants.HELP_DISPLAY); if (this.getHelpView() == null) if (ThinMenuConstants.HELP_PANE.equalsIgnoreCase(strPreference)) strPreference = null; if ((strPreference == null) || (strPreference.length() == 0)) { //if (this.getAppletScreen() != null) // strPreference = MenuConstants.HELP_WEB; //else if ((applet.getHelpView() != null) && (applet.getHelpView().getBaseApplet() == applet)) strPreference = ThinMenuConstants.HELP_PANE; //else // strPreference = MenuConstants.HELP_WINDOW; } if (ThinMenuConstants.HELP_WEB.equalsIgnoreCase(strPreference)) iOptions = ThinMenuConstants.HELP_WEB_OPTION; else if (ThinMenuConstants.HELP_PANE.equalsIgnoreCase(strPreference)) iOptions = ThinMenuConstants.HELP_PANE_OPTION; else if (ThinMenuConstants.HELP_WINDOW.equalsIgnoreCase(strPreference)) iOptions = ThinMenuConstants.HELP_WINDOW_OPTION; else iOptions = ThinMenuConstants.HELP_PANE_OPTION; // Default return iOptions; }
[ "public", "int", "getHelpPageOptions", "(", "int", "iOptions", ")", "{", "String", "strPreference", "=", "this", ".", "getProperty", "(", "ThinMenuConstants", ".", "USER_HELP_DISPLAY", ")", ";", "if", "(", "(", "strPreference", "==", "null", ")", "||", "(", "strPreference", ".", "length", "(", ")", "==", "0", ")", ")", "strPreference", "=", "this", ".", "getProperty", "(", "ThinMenuConstants", ".", "HELP_DISPLAY", ")", ";", "if", "(", "this", ".", "getHelpView", "(", ")", "==", "null", ")", "if", "(", "ThinMenuConstants", ".", "HELP_PANE", ".", "equalsIgnoreCase", "(", "strPreference", ")", ")", "strPreference", "=", "null", ";", "if", "(", "(", "strPreference", "==", "null", ")", "||", "(", "strPreference", ".", "length", "(", ")", "==", "0", ")", ")", "{", "//if (this.getAppletScreen() != null)", "//\tstrPreference = MenuConstants.HELP_WEB;", "//else if ((applet.getHelpView() != null) && (applet.getHelpView().getBaseApplet() == applet))", "strPreference", "=", "ThinMenuConstants", ".", "HELP_PANE", ";", "//else", "//\tstrPreference = MenuConstants.HELP_WINDOW;", "}", "if", "(", "ThinMenuConstants", ".", "HELP_WEB", ".", "equalsIgnoreCase", "(", "strPreference", ")", ")", "iOptions", "=", "ThinMenuConstants", ".", "HELP_WEB_OPTION", ";", "else", "if", "(", "ThinMenuConstants", ".", "HELP_PANE", ".", "equalsIgnoreCase", "(", "strPreference", ")", ")", "iOptions", "=", "ThinMenuConstants", ".", "HELP_PANE_OPTION", ";", "else", "if", "(", "ThinMenuConstants", ".", "HELP_WINDOW", ".", "equalsIgnoreCase", "(", "strPreference", ")", ")", "iOptions", "=", "ThinMenuConstants", ".", "HELP_WINDOW_OPTION", ";", "else", "iOptions", "=", "ThinMenuConstants", ".", "HELP_PANE_OPTION", ";", "// Default", "return", "iOptions", ";", "}" ]
Get the display preference for the help window. @return
[ "Get", "the", "display", "preference", "for", "the", "help", "window", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L915-L941
152,374
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.makeRemoteSession
public RemoteSession makeRemoteSession(RemoteSession parentSessionObject, String strSessionClass) { RemoteTask server = (RemoteTask)this.getRemoteTask(); try { synchronized (server) { // In case this is called from another task if (parentSessionObject == null) return (RemoteSession)server.makeRemoteSession(strSessionClass); else return (RemoteSession)parentSessionObject.makeRemoteSession(strSessionClass); } } catch (RemoteException ex) { ex.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } return null; }
java
public RemoteSession makeRemoteSession(RemoteSession parentSessionObject, String strSessionClass) { RemoteTask server = (RemoteTask)this.getRemoteTask(); try { synchronized (server) { // In case this is called from another task if (parentSessionObject == null) return (RemoteSession)server.makeRemoteSession(strSessionClass); else return (RemoteSession)parentSessionObject.makeRemoteSession(strSessionClass); } } catch (RemoteException ex) { ex.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } return null; }
[ "public", "RemoteSession", "makeRemoteSession", "(", "RemoteSession", "parentSessionObject", ",", "String", "strSessionClass", ")", "{", "RemoteTask", "server", "=", "(", "RemoteTask", ")", "this", ".", "getRemoteTask", "(", ")", ";", "try", "{", "synchronized", "(", "server", ")", "{", "// In case this is called from another task", "if", "(", "parentSessionObject", "==", "null", ")", "return", "(", "RemoteSession", ")", "server", ".", "makeRemoteSession", "(", "strSessionClass", ")", ";", "else", "return", "(", "RemoteSession", ")", "parentSessionObject", ".", "makeRemoteSession", "(", "strSessionClass", ")", ";", "}", "}", "catch", "(", "RemoteException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Create this session with this class name at the remote server. @param parentSessionObject The (optional) parent session. @param strSessionClass The class name of the remote session to create. @return The new remote session (or null if not found).
[ "Create", "this", "session", "with", "this", "class", "name", "at", "the", "remote", "server", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1166-L1183
152,375
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.popHistory
public String popHistory(int quanityToPop, boolean bPopFromBrowser) { String strHistory = null; for (int i = 0; i < quanityToPop; i++) { strHistory = null; if (m_vHistory != null) if (m_vHistory.size() > 0) strHistory = (String)m_vHistory.remove(m_vHistory.size() - 1); } if (bPopFromBrowser) this.popBrowserHistory(quanityToPop, strHistory != null, this.getStatusText(Constants.INFORMATION)); // Let browser know about the new screen return strHistory; }
java
public String popHistory(int quanityToPop, boolean bPopFromBrowser) { String strHistory = null; for (int i = 0; i < quanityToPop; i++) { strHistory = null; if (m_vHistory != null) if (m_vHistory.size() > 0) strHistory = (String)m_vHistory.remove(m_vHistory.size() - 1); } if (bPopFromBrowser) this.popBrowserHistory(quanityToPop, strHistory != null, this.getStatusText(Constants.INFORMATION)); // Let browser know about the new screen return strHistory; }
[ "public", "String", "popHistory", "(", "int", "quanityToPop", ",", "boolean", "bPopFromBrowser", ")", "{", "String", "strHistory", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "quanityToPop", ";", "i", "++", ")", "{", "strHistory", "=", "null", ";", "if", "(", "m_vHistory", "!=", "null", ")", "if", "(", "m_vHistory", ".", "size", "(", ")", ">", "0", ")", "strHistory", "=", "(", "String", ")", "m_vHistory", ".", "remove", "(", "m_vHistory", ".", "size", "(", ")", "-", "1", ")", ";", "}", "if", "(", "bPopFromBrowser", ")", "this", ".", "popBrowserHistory", "(", "quanityToPop", ",", "strHistory", "!=", "null", ",", "this", ".", "getStatusText", "(", "Constants", ".", "INFORMATION", ")", ")", ";", "// Let browser know about the new screen", "return", "strHistory", ";", "}" ]
Pop this command off the history stack. @param quanityToPop The number of commands to pop off the stack @param bPopFromBrowser Pop them off the browser stack also? NOTE: The params are different from the next call.
[ "Pop", "this", "command", "off", "the", "history", "stack", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1261-L1273
152,376
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.popBrowserHistory
public void popBrowserHistory(int quanityToPop, boolean bCommandHandledByJava, String browserTitle) { if (this.getBrowserManager() != null) this.getBrowserManager().popBrowserHistory(quanityToPop, bCommandHandledByJava, this.getStatusText(Constants.INFORMATION)); // Let browser know about the new screen }
java
public void popBrowserHistory(int quanityToPop, boolean bCommandHandledByJava, String browserTitle) { if (this.getBrowserManager() != null) this.getBrowserManager().popBrowserHistory(quanityToPop, bCommandHandledByJava, this.getStatusText(Constants.INFORMATION)); // Let browser know about the new screen }
[ "public", "void", "popBrowserHistory", "(", "int", "quanityToPop", ",", "boolean", "bCommandHandledByJava", ",", "String", "browserTitle", ")", "{", "if", "(", "this", ".", "getBrowserManager", "(", ")", "!=", "null", ")", "this", ".", "getBrowserManager", "(", ")", ".", "popBrowserHistory", "(", "quanityToPop", ",", "bCommandHandledByJava", ",", "this", ".", "getStatusText", "(", "Constants", ".", "INFORMATION", ")", ")", ";", "// Let browser know about the new screen", "}" ]
Pop commands off the browser stack. @param quanityToPop The number of commands to pop off the stack @param bCommandHandledByJava If I say false, the browser will do a 'back', otherwise, it just pops to top command(s)
[ "Pop", "commands", "off", "the", "browser", "stack", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1279-L1283
152,377
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.getInitialCommand
public String getInitialCommand(boolean bIncludeAppletCommands) { String strCommand = Constants.BLANK; if (bIncludeAppletCommands) { if (this.getProperty(Params.APPLET) != null) strCommand = Util.addURLParam(strCommand, Params.APPLET, this.getProperty(Params.APPLET)); else if (this.getProperty("code") != null) strCommand = Util.addURLParam(strCommand, Params.APPLET, this.getProperty("code")); else strCommand = Util.addURLParam(strCommand, Params.APPLET, this.getClass().getName()); if (this.getProperty("webStartPropertiesFile") != null) strCommand = Util.addURLParam(strCommand, "webStartPropertiesFile", this.getProperty("webStartPropertiesFile")); else { if (this.getProperty("jnlpjars") != null) strCommand = Util.addURLParam(strCommand, "jnlpjars", this.getProperty("jnlpjars")); if (this.getProperty("jnlpextensions") != null) strCommand = Util.addURLParam(strCommand, "jnlpextensions", this.getProperty("jnlpextensions")); if (this.getProperty(ScreenUtil.BACKGROUND_COLOR) != null) strCommand = Util.addURLParam(strCommand, ScreenUtil.BACKGROUND_COLOR, this.getProperty(ScreenUtil.BACKGROUND_COLOR)); if (this.getProperty(Params.BACKGROUND) != null) strCommand = Util.addURLParam(strCommand, Params.BACKGROUND, this.getProperty(Params.BACKGROUND)); if (this.getProperty("webStart") != null) strCommand = Util.addURLParam(strCommand, "webStart", this.getProperty("webStart")); } if (this.getProperty(Params.USER_ID) != null) strCommand = Util.addURLParam(strCommand, Params.USER_ID, this.getProperty(Params.USER_ID)); if (this.getProperty(Params.USER_NAME) != null) strCommand = Util.addURLParam(strCommand, Params.USER_NAME, this.getProperty(Params.USER_NAME)); } if ((this.getProperty(Params.SCREEN) != null) && (this.getProperty(Params.SCREEN).length() > 0)) strCommand = Util.addURLParam(strCommand, Params.SCREEN, this.getProperty(Params.SCREEN)); if (strCommand.length() == 0) { String strMenu = this.getProperty(Params.MENU); if (strMenu == null) strMenu = Constants.BLANK; strCommand = Util.addURLParam(strCommand, Params.MENU, strMenu); } return strCommand; }
java
public String getInitialCommand(boolean bIncludeAppletCommands) { String strCommand = Constants.BLANK; if (bIncludeAppletCommands) { if (this.getProperty(Params.APPLET) != null) strCommand = Util.addURLParam(strCommand, Params.APPLET, this.getProperty(Params.APPLET)); else if (this.getProperty("code") != null) strCommand = Util.addURLParam(strCommand, Params.APPLET, this.getProperty("code")); else strCommand = Util.addURLParam(strCommand, Params.APPLET, this.getClass().getName()); if (this.getProperty("webStartPropertiesFile") != null) strCommand = Util.addURLParam(strCommand, "webStartPropertiesFile", this.getProperty("webStartPropertiesFile")); else { if (this.getProperty("jnlpjars") != null) strCommand = Util.addURLParam(strCommand, "jnlpjars", this.getProperty("jnlpjars")); if (this.getProperty("jnlpextensions") != null) strCommand = Util.addURLParam(strCommand, "jnlpextensions", this.getProperty("jnlpextensions")); if (this.getProperty(ScreenUtil.BACKGROUND_COLOR) != null) strCommand = Util.addURLParam(strCommand, ScreenUtil.BACKGROUND_COLOR, this.getProperty(ScreenUtil.BACKGROUND_COLOR)); if (this.getProperty(Params.BACKGROUND) != null) strCommand = Util.addURLParam(strCommand, Params.BACKGROUND, this.getProperty(Params.BACKGROUND)); if (this.getProperty("webStart") != null) strCommand = Util.addURLParam(strCommand, "webStart", this.getProperty("webStart")); } if (this.getProperty(Params.USER_ID) != null) strCommand = Util.addURLParam(strCommand, Params.USER_ID, this.getProperty(Params.USER_ID)); if (this.getProperty(Params.USER_NAME) != null) strCommand = Util.addURLParam(strCommand, Params.USER_NAME, this.getProperty(Params.USER_NAME)); } if ((this.getProperty(Params.SCREEN) != null) && (this.getProperty(Params.SCREEN).length() > 0)) strCommand = Util.addURLParam(strCommand, Params.SCREEN, this.getProperty(Params.SCREEN)); if (strCommand.length() == 0) { String strMenu = this.getProperty(Params.MENU); if (strMenu == null) strMenu = Constants.BLANK; strCommand = Util.addURLParam(strCommand, Params.MENU, strMenu); } return strCommand; }
[ "public", "String", "getInitialCommand", "(", "boolean", "bIncludeAppletCommands", ")", "{", "String", "strCommand", "=", "Constants", ".", "BLANK", ";", "if", "(", "bIncludeAppletCommands", ")", "{", "if", "(", "this", ".", "getProperty", "(", "Params", ".", "APPLET", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "APPLET", ",", "this", ".", "getProperty", "(", "Params", ".", "APPLET", ")", ")", ";", "else", "if", "(", "this", ".", "getProperty", "(", "\"code\"", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "APPLET", ",", "this", ".", "getProperty", "(", "\"code\"", ")", ")", ";", "else", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "APPLET", ",", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "if", "(", "this", ".", "getProperty", "(", "\"webStartPropertiesFile\"", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "\"webStartPropertiesFile\"", ",", "this", ".", "getProperty", "(", "\"webStartPropertiesFile\"", ")", ")", ";", "else", "{", "if", "(", "this", ".", "getProperty", "(", "\"jnlpjars\"", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "\"jnlpjars\"", ",", "this", ".", "getProperty", "(", "\"jnlpjars\"", ")", ")", ";", "if", "(", "this", ".", "getProperty", "(", "\"jnlpextensions\"", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "\"jnlpextensions\"", ",", "this", ".", "getProperty", "(", "\"jnlpextensions\"", ")", ")", ";", "if", "(", "this", ".", "getProperty", "(", "ScreenUtil", ".", "BACKGROUND_COLOR", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "ScreenUtil", ".", "BACKGROUND_COLOR", ",", "this", ".", "getProperty", "(", "ScreenUtil", ".", "BACKGROUND_COLOR", ")", ")", ";", "if", "(", "this", ".", "getProperty", "(", "Params", ".", "BACKGROUND", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "BACKGROUND", ",", "this", ".", "getProperty", "(", "Params", ".", "BACKGROUND", ")", ")", ";", "if", "(", "this", ".", "getProperty", "(", "\"webStart\"", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "\"webStart\"", ",", "this", ".", "getProperty", "(", "\"webStart\"", ")", ")", ";", "}", "if", "(", "this", ".", "getProperty", "(", "Params", ".", "USER_ID", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "USER_ID", ",", "this", ".", "getProperty", "(", "Params", ".", "USER_ID", ")", ")", ";", "if", "(", "this", ".", "getProperty", "(", "Params", ".", "USER_NAME", ")", "!=", "null", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "USER_NAME", ",", "this", ".", "getProperty", "(", "Params", ".", "USER_NAME", ")", ")", ";", "}", "if", "(", "(", "this", ".", "getProperty", "(", "Params", ".", "SCREEN", ")", "!=", "null", ")", "&&", "(", "this", ".", "getProperty", "(", "Params", ".", "SCREEN", ")", ".", "length", "(", ")", ">", "0", ")", ")", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "SCREEN", ",", "this", ".", "getProperty", "(", "Params", ".", "SCREEN", ")", ")", ";", "if", "(", "strCommand", ".", "length", "(", ")", "==", "0", ")", "{", "String", "strMenu", "=", "this", ".", "getProperty", "(", "Params", ".", "MENU", ")", ";", "if", "(", "strMenu", "==", "null", ")", "strMenu", "=", "Constants", ".", "BLANK", ";", "strCommand", "=", "Util", ".", "addURLParam", "(", "strCommand", ",", "Params", ".", "MENU", ",", "strMenu", ")", ";", "}", "return", "strCommand", ";", "}" ]
Get the original screen params. @param bIncludeAppletCommands Include the initial applet commands? @return
[ "Get", "the", "original", "screen", "params", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1309-L1350
152,378
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.cleanCommand
public String cleanCommand(String command) { if (command == null) return command; Map<String,Object> properties = Util.parseArgs(null, command); properties.remove(Params.APPLET); properties.remove("code"); properties.remove("jnlpjars"); properties.remove("jnlpextensions"); properties.remove(ScreenUtil.BACKGROUND_COLOR); properties.remove(Params.BACKGROUND); return Util.propertiesToUrl(properties); }
java
public String cleanCommand(String command) { if (command == null) return command; Map<String,Object> properties = Util.parseArgs(null, command); properties.remove(Params.APPLET); properties.remove("code"); properties.remove("jnlpjars"); properties.remove("jnlpextensions"); properties.remove(ScreenUtil.BACKGROUND_COLOR); properties.remove(Params.BACKGROUND); return Util.propertiesToUrl(properties); }
[ "public", "String", "cleanCommand", "(", "String", "command", ")", "{", "if", "(", "command", "==", "null", ")", "return", "command", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "Util", ".", "parseArgs", "(", "null", ",", "command", ")", ";", "properties", ".", "remove", "(", "Params", ".", "APPLET", ")", ";", "properties", ".", "remove", "(", "\"code\"", ")", ";", "properties", ".", "remove", "(", "\"jnlpjars\"", ")", ";", "properties", ".", "remove", "(", "\"jnlpextensions\"", ")", ";", "properties", ".", "remove", "(", "ScreenUtil", ".", "BACKGROUND_COLOR", ")", ";", "properties", ".", "remove", "(", "Params", ".", "BACKGROUND", ")", ";", "return", "Util", ".", "propertiesToUrl", "(", "properties", ")", ";", "}" ]
Clean the javascript command for java use.
[ "Clean", "the", "javascript", "command", "for", "java", "use", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1354-L1366
152,379
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.onAbout
public boolean onAbout() { Application application = this.getApplication(); application.getResources(null, true); // Set the resource bundle to default String strTitle = this.getString(ThinMenuConstants.ABOUT); String strMessage = this.getString("Copyright"); JOptionPane.showMessageDialog(ScreenUtil.getFrame(this), strMessage, strTitle, JOptionPane.INFORMATION_MESSAGE); return true; }
java
public boolean onAbout() { Application application = this.getApplication(); application.getResources(null, true); // Set the resource bundle to default String strTitle = this.getString(ThinMenuConstants.ABOUT); String strMessage = this.getString("Copyright"); JOptionPane.showMessageDialog(ScreenUtil.getFrame(this), strMessage, strTitle, JOptionPane.INFORMATION_MESSAGE); return true; }
[ "public", "boolean", "onAbout", "(", ")", "{", "Application", "application", "=", "this", ".", "getApplication", "(", ")", ";", "application", ".", "getResources", "(", "null", ",", "true", ")", ";", "// Set the resource bundle to default", "String", "strTitle", "=", "this", ".", "getString", "(", "ThinMenuConstants", ".", "ABOUT", ")", ";", "String", "strMessage", "=", "this", ".", "getString", "(", "\"Copyright\"", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "ScreenUtil", ".", "getFrame", "(", "this", ")", ",", "strMessage", ",", "strTitle", ",", "JOptionPane", ".", "INFORMATION_MESSAGE", ")", ";", "return", "true", ";", "}" ]
Throw up a dialog box to show "about" info. @return true.
[ "Throw", "up", "a", "dialog", "box", "to", "show", "about", "info", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1609-L1617
152,380
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.setScreenProperties
public void setScreenProperties(PropertyOwner propertyOwner, Map<String,Object> properties) { Frame frame = ScreenUtil.getFrame(this); ScreenUtil.updateLookAndFeel((Frame)frame, propertyOwner, properties); Color colorBackgroundNew = ScreenUtil.getColor(ScreenUtil.BACKGROUND_COLOR, propertyOwner, properties); if (colorBackgroundNew != null) this.setBackgroundColor(colorBackgroundNew); }
java
public void setScreenProperties(PropertyOwner propertyOwner, Map<String,Object> properties) { Frame frame = ScreenUtil.getFrame(this); ScreenUtil.updateLookAndFeel((Frame)frame, propertyOwner, properties); Color colorBackgroundNew = ScreenUtil.getColor(ScreenUtil.BACKGROUND_COLOR, propertyOwner, properties); if (colorBackgroundNew != null) this.setBackgroundColor(colorBackgroundNew); }
[ "public", "void", "setScreenProperties", "(", "PropertyOwner", "propertyOwner", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "Frame", "frame", "=", "ScreenUtil", ".", "getFrame", "(", "this", ")", ";", "ScreenUtil", ".", "updateLookAndFeel", "(", "(", "Frame", ")", "frame", ",", "propertyOwner", ",", "properties", ")", ";", "Color", "colorBackgroundNew", "=", "ScreenUtil", ".", "getColor", "(", "ScreenUtil", ".", "BACKGROUND_COLOR", ",", "propertyOwner", ",", "properties", ")", ";", "if", "(", "colorBackgroundNew", "!=", "null", ")", "this", ".", "setBackgroundColor", "(", "colorBackgroundNew", ")", ";", "}" ]
Change the screen properties to these properties. @param propertyOwner The properties to change to.
[ "Change", "the", "screen", "properties", "to", "these", "properties", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1665-L1672
152,381
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.setupLookAndFeel
@SuppressWarnings({ "unchecked", "rawtypes" }) public void setupLookAndFeel(PropertyOwner propertyOwner) { Map<String,Object> properties = null; if (propertyOwner == null) propertyOwner = this.retrieveUserProperties(Params.SCREEN); if (propertyOwner == null) { // Thin only RemoteTask task = (RemoteTask)this.getApplication().getRemoteTask(null, null, false); if (task != null) { try { properties = (Map)task.doRemoteAction(Params.RETRIEVE_USER_PROPERTIES, properties); } catch (Exception ex) { ex.printStackTrace(); } } } String backgroundName = null; if (propertyOwner != null) if (propertyOwner.getProperty(Params.BACKGROUNDCOLOR) != null) backgroundName = propertyOwner.getProperty(Params.BACKGROUNDCOLOR); if (backgroundName == null) if (properties != null) backgroundName = (String)properties.get(Params.BACKGROUNDCOLOR); if (backgroundName != null) this.setBackgroundColor(BaseApplet.nameToColor(backgroundName)); Container top = this; while (top.getParent() != null) { top = top.getParent(); } ScreenUtil.updateLookAndFeel(top, propertyOwner, properties); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public void setupLookAndFeel(PropertyOwner propertyOwner) { Map<String,Object> properties = null; if (propertyOwner == null) propertyOwner = this.retrieveUserProperties(Params.SCREEN); if (propertyOwner == null) { // Thin only RemoteTask task = (RemoteTask)this.getApplication().getRemoteTask(null, null, false); if (task != null) { try { properties = (Map)task.doRemoteAction(Params.RETRIEVE_USER_PROPERTIES, properties); } catch (Exception ex) { ex.printStackTrace(); } } } String backgroundName = null; if (propertyOwner != null) if (propertyOwner.getProperty(Params.BACKGROUNDCOLOR) != null) backgroundName = propertyOwner.getProperty(Params.BACKGROUNDCOLOR); if (backgroundName == null) if (properties != null) backgroundName = (String)properties.get(Params.BACKGROUNDCOLOR); if (backgroundName != null) this.setBackgroundColor(BaseApplet.nameToColor(backgroundName)); Container top = this; while (top.getParent() != null) { top = top.getParent(); } ScreenUtil.updateLookAndFeel(top, propertyOwner, properties); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "setupLookAndFeel", "(", "PropertyOwner", "propertyOwner", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "null", ";", "if", "(", "propertyOwner", "==", "null", ")", "propertyOwner", "=", "this", ".", "retrieveUserProperties", "(", "Params", ".", "SCREEN", ")", ";", "if", "(", "propertyOwner", "==", "null", ")", "{", "// Thin only", "RemoteTask", "task", "=", "(", "RemoteTask", ")", "this", ".", "getApplication", "(", ")", ".", "getRemoteTask", "(", "null", ",", "null", ",", "false", ")", ";", "if", "(", "task", "!=", "null", ")", "{", "try", "{", "properties", "=", "(", "Map", ")", "task", ".", "doRemoteAction", "(", "Params", ".", "RETRIEVE_USER_PROPERTIES", ",", "properties", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "String", "backgroundName", "=", "null", ";", "if", "(", "propertyOwner", "!=", "null", ")", "if", "(", "propertyOwner", ".", "getProperty", "(", "Params", ".", "BACKGROUNDCOLOR", ")", "!=", "null", ")", "backgroundName", "=", "propertyOwner", ".", "getProperty", "(", "Params", ".", "BACKGROUNDCOLOR", ")", ";", "if", "(", "backgroundName", "==", "null", ")", "if", "(", "properties", "!=", "null", ")", "backgroundName", "=", "(", "String", ")", "properties", ".", "get", "(", "Params", ".", "BACKGROUNDCOLOR", ")", ";", "if", "(", "backgroundName", "!=", "null", ")", "this", ".", "setBackgroundColor", "(", "BaseApplet", ".", "nameToColor", "(", "backgroundName", ")", ")", ";", "Container", "top", "=", "this", ";", "while", "(", "top", ".", "getParent", "(", ")", "!=", "null", ")", "{", "top", "=", "top", ".", "getParent", "(", ")", ";", "}", "ScreenUtil", ".", "updateLookAndFeel", "(", "top", ",", "propertyOwner", ",", "properties", ")", ";", "}" ]
Get the screen properties and set up the look and feel. @param propertyOwner The screen properties (if null, I will look them up).
[ "Get", "the", "screen", "properties", "and", "set", "up", "the", "look", "and", "feel", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1677-L1710
152,382
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/menu/JBaseMenuScreen.java
JBaseMenuScreen.getGBConstraints
public GridBagConstraints getGBConstraints() { if (m_gbconstraints == null) m_gbconstraints = new GridBagConstraints(); else { // Set back to default values m_gbconstraints.gridx = GridBagConstraints.RELATIVE; m_gbconstraints.gridy = GridBagConstraints.RELATIVE; m_gbconstraints.gridwidth = 1; m_gbconstraints.gridheight = 1; m_gbconstraints.weightx = 0; m_gbconstraints.weighty = 0; m_gbconstraints.anchor = GridBagConstraints.CENTER; m_gbconstraints.fill = GridBagConstraints.NONE; m_gbconstraints.insets.bottom = 0; m_gbconstraints.insets.left = 0; m_gbconstraints.insets.right = 0; m_gbconstraints.insets.top = 0; m_gbconstraints.ipadx = 0; m_gbconstraints.ipady = 0; } return m_gbconstraints; }
java
public GridBagConstraints getGBConstraints() { if (m_gbconstraints == null) m_gbconstraints = new GridBagConstraints(); else { // Set back to default values m_gbconstraints.gridx = GridBagConstraints.RELATIVE; m_gbconstraints.gridy = GridBagConstraints.RELATIVE; m_gbconstraints.gridwidth = 1; m_gbconstraints.gridheight = 1; m_gbconstraints.weightx = 0; m_gbconstraints.weighty = 0; m_gbconstraints.anchor = GridBagConstraints.CENTER; m_gbconstraints.fill = GridBagConstraints.NONE; m_gbconstraints.insets.bottom = 0; m_gbconstraints.insets.left = 0; m_gbconstraints.insets.right = 0; m_gbconstraints.insets.top = 0; m_gbconstraints.ipadx = 0; m_gbconstraints.ipady = 0; } return m_gbconstraints; }
[ "public", "GridBagConstraints", "getGBConstraints", "(", ")", "{", "if", "(", "m_gbconstraints", "==", "null", ")", "m_gbconstraints", "=", "new", "GridBagConstraints", "(", ")", ";", "else", "{", "// Set back to default values", "m_gbconstraints", ".", "gridx", "=", "GridBagConstraints", ".", "RELATIVE", ";", "m_gbconstraints", ".", "gridy", "=", "GridBagConstraints", ".", "RELATIVE", ";", "m_gbconstraints", ".", "gridwidth", "=", "1", ";", "m_gbconstraints", ".", "gridheight", "=", "1", ";", "m_gbconstraints", ".", "weightx", "=", "0", ";", "m_gbconstraints", ".", "weighty", "=", "0", ";", "m_gbconstraints", ".", "anchor", "=", "GridBagConstraints", ".", "CENTER", ";", "m_gbconstraints", ".", "fill", "=", "GridBagConstraints", ".", "NONE", ";", "m_gbconstraints", ".", "insets", ".", "bottom", "=", "0", ";", "m_gbconstraints", ".", "insets", ".", "left", "=", "0", ";", "m_gbconstraints", ".", "insets", ".", "right", "=", "0", ";", "m_gbconstraints", ".", "insets", ".", "top", "=", "0", ";", "m_gbconstraints", ".", "ipadx", "=", "0", ";", "m_gbconstraints", ".", "ipady", "=", "0", ";", "}", "return", "m_gbconstraints", ";", "}" ]
Get standard GridBagConstraints. The grid bag constrain is reset to the original value in this method. @return The grid bag constraints.
[ "Get", "standard", "GridBagConstraints", ".", "The", "grid", "bag", "constrain", "is", "reset", "to", "the", "original", "value", "in", "this", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/menu/JBaseMenuScreen.java#L75-L97
152,383
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/menu/JBaseMenuScreen.java
JBaseMenuScreen.getMenuIcon
public String getMenuIcon(FieldList record) { FieldInfo field = record.getField("IconResource"); String strIcon = null; if (field != null) { strIcon = field.toString(); if ((strIcon != null) && (strIcon.length() > 0)) return strIcon; } field = record.getField("Type"); if ((field != null) && (!field.isNull())) { strIcon = field.toString(); if ((strIcon != null) && (strIcon.length() > 0)) { strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1); return strIcon; } } return Constants.BLANK; }
java
public String getMenuIcon(FieldList record) { FieldInfo field = record.getField("IconResource"); String strIcon = null; if (field != null) { strIcon = field.toString(); if ((strIcon != null) && (strIcon.length() > 0)) return strIcon; } field = record.getField("Type"); if ((field != null) && (!field.isNull())) { strIcon = field.toString(); if ((strIcon != null) && (strIcon.length() > 0)) { strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1); return strIcon; } } return Constants.BLANK; }
[ "public", "String", "getMenuIcon", "(", "FieldList", "record", ")", "{", "FieldInfo", "field", "=", "record", ".", "getField", "(", "\"IconResource\"", ")", ";", "String", "strIcon", "=", "null", ";", "if", "(", "field", "!=", "null", ")", "{", "strIcon", "=", "field", ".", "toString", "(", ")", ";", "if", "(", "(", "strIcon", "!=", "null", ")", "&&", "(", "strIcon", ".", "length", "(", ")", ">", "0", ")", ")", "return", "strIcon", ";", "}", "field", "=", "record", ".", "getField", "(", "\"Type\"", ")", ";", "if", "(", "(", "field", "!=", "null", ")", "&&", "(", "!", "field", ".", "isNull", "(", ")", ")", ")", "{", "strIcon", "=", "field", ".", "toString", "(", ")", ";", "if", "(", "(", "strIcon", "!=", "null", ")", "&&", "(", "strIcon", ".", "length", "(", ")", ">", "0", ")", ")", "{", "strIcon", "=", "strIcon", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "strIcon", ".", "substring", "(", "1", ")", ";", "return", "strIcon", ";", "}", "}", "return", "Constants", ".", "BLANK", ";", "}" ]
Get the menu icon. @param record The menu record. @return The icon filename for this menu item.
[ "Get", "the", "menu", "icon", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/menu/JBaseMenuScreen.java#L158-L179
152,384
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/menu/JBaseMenuScreen.java
JBaseMenuScreen.getMenuLink
public String getMenuLink(FieldList record) { FieldInfo field = record.getField("Type"); if ((field != null) && (!field.isNull())) { String strType = field.toString(); String strParams = record.getField("Params").toString(); if (strParams == null) strParams = Constants.BLANK; else if (strParams.length() > 0) strParams = '&' + strParams; if ((strType != null) && (strType.length() > 0)) { String strProgram = record.getField("Program").toString(); if (strType.equalsIgnoreCase(Params.MENU)) { field = record.getField("ID"); String strID = field.toString(); return '?' + strType + '=' + strID + strParams; } else if (strType.equalsIgnoreCase("applet")) { return '?' + strType + '=' + strProgram + strParams; } else if (strType.equalsIgnoreCase("link")) { strParams = strProgram; if (((strParams.indexOf('.') < strParams.indexOf('/')) && (strParams.indexOf('.') != -1)) || ((strParams.indexOf('/') == -1) && (strParams.indexOf(':') == -1))) strParams = "http://" + strParams; // Default command = html link return strParams; } } } return this.getMenuName(record); // Command = name }
java
public String getMenuLink(FieldList record) { FieldInfo field = record.getField("Type"); if ((field != null) && (!field.isNull())) { String strType = field.toString(); String strParams = record.getField("Params").toString(); if (strParams == null) strParams = Constants.BLANK; else if (strParams.length() > 0) strParams = '&' + strParams; if ((strType != null) && (strType.length() > 0)) { String strProgram = record.getField("Program").toString(); if (strType.equalsIgnoreCase(Params.MENU)) { field = record.getField("ID"); String strID = field.toString(); return '?' + strType + '=' + strID + strParams; } else if (strType.equalsIgnoreCase("applet")) { return '?' + strType + '=' + strProgram + strParams; } else if (strType.equalsIgnoreCase("link")) { strParams = strProgram; if (((strParams.indexOf('.') < strParams.indexOf('/')) && (strParams.indexOf('.') != -1)) || ((strParams.indexOf('/') == -1) && (strParams.indexOf(':') == -1))) strParams = "http://" + strParams; // Default command = html link return strParams; } } } return this.getMenuName(record); // Command = name }
[ "public", "String", "getMenuLink", "(", "FieldList", "record", ")", "{", "FieldInfo", "field", "=", "record", ".", "getField", "(", "\"Type\"", ")", ";", "if", "(", "(", "field", "!=", "null", ")", "&&", "(", "!", "field", ".", "isNull", "(", ")", ")", ")", "{", "String", "strType", "=", "field", ".", "toString", "(", ")", ";", "String", "strParams", "=", "record", ".", "getField", "(", "\"Params\"", ")", ".", "toString", "(", ")", ";", "if", "(", "strParams", "==", "null", ")", "strParams", "=", "Constants", ".", "BLANK", ";", "else", "if", "(", "strParams", ".", "length", "(", ")", ">", "0", ")", "strParams", "=", "'", "'", "+", "strParams", ";", "if", "(", "(", "strType", "!=", "null", ")", "&&", "(", "strType", ".", "length", "(", ")", ">", "0", ")", ")", "{", "String", "strProgram", "=", "record", ".", "getField", "(", "\"Program\"", ")", ".", "toString", "(", ")", ";", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "Params", ".", "MENU", ")", ")", "{", "field", "=", "record", ".", "getField", "(", "\"ID\"", ")", ";", "String", "strID", "=", "field", ".", "toString", "(", ")", ";", "return", "'", "'", "+", "strType", "+", "'", "'", "+", "strID", "+", "strParams", ";", "}", "else", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "\"applet\"", ")", ")", "{", "return", "'", "'", "+", "strType", "+", "'", "'", "+", "strProgram", "+", "strParams", ";", "}", "else", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "\"link\"", ")", ")", "{", "strParams", "=", "strProgram", ";", "if", "(", "(", "(", "strParams", ".", "indexOf", "(", "'", "'", ")", "<", "strParams", ".", "indexOf", "(", "'", "'", ")", ")", "&&", "(", "strParams", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", ")", "||", "(", "(", "strParams", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", "&&", "(", "strParams", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", ")", ")", "strParams", "=", "\"http://\"", "+", "strParams", ";", "// Default command = html link", "return", "strParams", ";", "}", "}", "}", "return", "this", ".", "getMenuName", "(", "record", ")", ";", "// Command = name", "}" ]
Get the menu command to send to handle command. @param record The menu record. @return The command for this menu item.
[ "Get", "the", "menu", "command", "to", "send", "to", "handle", "command", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/menu/JBaseMenuScreen.java#L185-L221
152,385
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/FileExtensions.java
FileExtensions.download
public static byte[] download(final URI uri) throws IOException { final File tmpFile = new File(uri); return ReadFileExtensions.toByteArray(tmpFile); }
java
public static byte[] download(final URI uri) throws IOException { final File tmpFile = new File(uri); return ReadFileExtensions.toByteArray(tmpFile); }
[ "public", "static", "byte", "[", "]", "download", "(", "final", "URI", "uri", ")", "throws", "IOException", "{", "final", "File", "tmpFile", "=", "new", "File", "(", "uri", ")", ";", "return", "ReadFileExtensions", ".", "toByteArray", "(", "tmpFile", ")", ";", "}" ]
Downloads Data from the given URI. @param uri The URI from where to download. @return Returns a byte array or null. @throws IOException Signals that an I/O exception has occurred.
[ "Downloads", "Data", "from", "the", "given", "URI", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/FileExtensions.java#L59-L63
152,386
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/FileExtensions.java
FileExtensions.getAbsolutPathWithoutFilename
public static String getAbsolutPathWithoutFilename(final File file) { final String absolutePath = file.getAbsolutePath(); int lastSlash_index = absolutePath.lastIndexOf("/"); if (lastSlash_index < 0) { lastSlash_index = absolutePath.lastIndexOf("\\"); } return absolutePath.substring(0, lastSlash_index + 1); }
java
public static String getAbsolutPathWithoutFilename(final File file) { final String absolutePath = file.getAbsolutePath(); int lastSlash_index = absolutePath.lastIndexOf("/"); if (lastSlash_index < 0) { lastSlash_index = absolutePath.lastIndexOf("\\"); } return absolutePath.substring(0, lastSlash_index + 1); }
[ "public", "static", "String", "getAbsolutPathWithoutFilename", "(", "final", "File", "file", ")", "{", "final", "String", "absolutePath", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "int", "lastSlash_index", "=", "absolutePath", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "if", "(", "lastSlash_index", "<", "0", ")", "{", "lastSlash_index", "=", "absolutePath", ".", "lastIndexOf", "(", "\"\\\\\"", ")", ";", "}", "return", "absolutePath", ".", "substring", "(", "0", ",", "lastSlash_index", "+", "1", ")", ";", "}" ]
Gets the absolut path without the filename. @param file the file. @return 's the absolut path without filename.
[ "Gets", "the", "absolut", "path", "without", "the", "filename", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/FileExtensions.java#L72-L81
152,387
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/FileExtensions.java
FileExtensions.getCurrentAbsolutPathWithoutDotAndSlash
public static String getCurrentAbsolutPathWithoutDotAndSlash() { final File currentAbsolutPath = new File("."); return currentAbsolutPath.getAbsolutePath().substring(0, currentAbsolutPath.getAbsolutePath().length() - 2); }
java
public static String getCurrentAbsolutPathWithoutDotAndSlash() { final File currentAbsolutPath = new File("."); return currentAbsolutPath.getAbsolutePath().substring(0, currentAbsolutPath.getAbsolutePath().length() - 2); }
[ "public", "static", "String", "getCurrentAbsolutPathWithoutDotAndSlash", "(", ")", "{", "final", "File", "currentAbsolutPath", "=", "new", "File", "(", "\".\"", ")", ";", "return", "currentAbsolutPath", ".", "getAbsolutePath", "(", ")", ".", "substring", "(", "0", ",", "currentAbsolutPath", ".", "getAbsolutePath", "(", ")", ".", "length", "(", ")", "-", "2", ")", ";", "}" ]
Gets the current absolut path without the dot and slash. @return 's the current absolut path without the dot and slash.
[ "Gets", "the", "current", "absolut", "path", "without", "the", "dot", "and", "slash", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/FileExtensions.java#L88-L93
152,388
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/FileExtensions.java
FileExtensions.isOpen
public static boolean isOpen(final File file) throws IOException { boolean open = false; FileLock lock = null; try (RandomAccessFile fileAccess = new RandomAccessFile(file.getAbsolutePath(), "rw")) { lock = fileAccess.getChannel().tryLock(); if (lock == null) { open = true; } else { lock.release(); } } return open; }
java
public static boolean isOpen(final File file) throws IOException { boolean open = false; FileLock lock = null; try (RandomAccessFile fileAccess = new RandomAccessFile(file.getAbsolutePath(), "rw")) { lock = fileAccess.getChannel().tryLock(); if (lock == null) { open = true; } else { lock.release(); } } return open; }
[ "public", "static", "boolean", "isOpen", "(", "final", "File", "file", ")", "throws", "IOException", "{", "boolean", "open", "=", "false", ";", "FileLock", "lock", "=", "null", ";", "try", "(", "RandomAccessFile", "fileAccess", "=", "new", "RandomAccessFile", "(", "file", ".", "getAbsolutePath", "(", ")", ",", "\"rw\"", ")", ")", "{", "lock", "=", "fileAccess", ".", "getChannel", "(", ")", ".", "tryLock", "(", ")", ";", "if", "(", "lock", "==", "null", ")", "{", "open", "=", "true", ";", "}", "else", "{", "lock", ".", "release", "(", ")", ";", "}", "}", "return", "open", ";", "}" ]
Not yet implemented. Checks if the given file is open. @param file The file to check. @return Return true if the file is open otherwise false. @throws IOException Signals that an I/O exception has occurred.
[ "Not", "yet", "implemented", ".", "Checks", "if", "the", "given", "file", "is", "open", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/FileExtensions.java#L151-L168
152,389
tvesalainen/util
util/src/main/java/org/vesalainen/nio/DynamicByteBuffer.java
DynamicByteBuffer.create
public static MappedByteBuffer create(MapMode mapMode, int maxSize) throws IOException { Path tmp = Files.createTempFile("dynBB", "tmp"); try (FileChannel fc = FileChannel.open(tmp, READ, WRITE, CREATE, DELETE_ON_CLOSE)) { return fc.map(MapMode.READ_WRITE, 0, maxSize); } }
java
public static MappedByteBuffer create(MapMode mapMode, int maxSize) throws IOException { Path tmp = Files.createTempFile("dynBB", "tmp"); try (FileChannel fc = FileChannel.open(tmp, READ, WRITE, CREATE, DELETE_ON_CLOSE)) { return fc.map(MapMode.READ_WRITE, 0, maxSize); } }
[ "public", "static", "MappedByteBuffer", "create", "(", "MapMode", "mapMode", ",", "int", "maxSize", ")", "throws", "IOException", "{", "Path", "tmp", "=", "Files", ".", "createTempFile", "(", "\"dynBB\"", ",", "\"tmp\"", ")", ";", "try", "(", "FileChannel", "fc", "=", "FileChannel", ".", "open", "(", "tmp", ",", "READ", ",", "WRITE", ",", "CREATE", ",", "DELETE_ON_CLOSE", ")", ")", "{", "return", "fc", ".", "map", "(", "MapMode", ".", "READ_WRITE", ",", "0", ",", "maxSize", ")", ";", "}", "}" ]
Creates dynamically growing ByteBuffer upto maxSize. ByteBuffer is created by mapping a temporary file @param mapMode @param maxSize @return @throws IOException
[ "Creates", "dynamically", "growing", "ByteBuffer", "upto", "maxSize", ".", "ByteBuffer", "is", "created", "by", "mapping", "a", "temporary", "file" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/DynamicByteBuffer.java#L55-L62
152,390
tvesalainen/util
util/src/main/java/org/vesalainen/nio/DynamicByteBuffer.java
DynamicByteBuffer.create
public static ByteBuffer create(Path path, int maxSize) throws IOException { try (FileChannel fc = FileChannel.open(path, READ, WRITE, CREATE)) { return fc.map(FileChannel.MapMode.READ_WRITE, 0, maxSize); } }
java
public static ByteBuffer create(Path path, int maxSize) throws IOException { try (FileChannel fc = FileChannel.open(path, READ, WRITE, CREATE)) { return fc.map(FileChannel.MapMode.READ_WRITE, 0, maxSize); } }
[ "public", "static", "ByteBuffer", "create", "(", "Path", "path", ",", "int", "maxSize", ")", "throws", "IOException", "{", "try", "(", "FileChannel", "fc", "=", "FileChannel", ".", "open", "(", "path", ",", "READ", ",", "WRITE", ",", "CREATE", ")", ")", "{", "return", "fc", ".", "map", "(", "FileChannel", ".", "MapMode", ".", "READ_WRITE", ",", "0", ",", "maxSize", ")", ";", "}", "}" ]
Creates dynamically growing ByteBuffer upto maxSize for named file. @param path @param maxSize @return @throws IOException
[ "Creates", "dynamically", "growing", "ByteBuffer", "upto", "maxSize", "for", "named", "file", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/DynamicByteBuffer.java#L70-L76
152,391
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/scan/DateOffsetScanListener.java
DateOffsetScanListener.formatDate
public String formatDate(Date date, int type) { String string = null; if (type == DBConstants.DATE_TIME_FORMAT) string = XmlUtilities.dateTimeFormat.format(date); else if (type == DBConstants.DATE_ONLY_FORMAT) string = XmlUtilities.dateFormat.format(date); else if (type == DBConstants.TIME_ONLY_FORMAT) string = XmlUtilities.timeFormat.format(date); return string; }
java
public String formatDate(Date date, int type) { String string = null; if (type == DBConstants.DATE_TIME_FORMAT) string = XmlUtilities.dateTimeFormat.format(date); else if (type == DBConstants.DATE_ONLY_FORMAT) string = XmlUtilities.dateFormat.format(date); else if (type == DBConstants.TIME_ONLY_FORMAT) string = XmlUtilities.timeFormat.format(date); return string; }
[ "public", "String", "formatDate", "(", "Date", "date", ",", "int", "type", ")", "{", "String", "string", "=", "null", ";", "if", "(", "type", "==", "DBConstants", ".", "DATE_TIME_FORMAT", ")", "string", "=", "XmlUtilities", ".", "dateTimeFormat", ".", "format", "(", "date", ")", ";", "else", "if", "(", "type", "==", "DBConstants", ".", "DATE_ONLY_FORMAT", ")", "string", "=", "XmlUtilities", ".", "dateFormat", ".", "format", "(", "date", ")", ";", "else", "if", "(", "type", "==", "DBConstants", ".", "TIME_ONLY_FORMAT", ")", "string", "=", "XmlUtilities", ".", "timeFormat", ".", "format", "(", "date", ")", ";", "return", "string", ";", "}" ]
FormatDate Method.
[ "FormatDate", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/DateOffsetScanListener.java#L196-L206
152,392
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java
ScreenField.fieldToControl
public void fieldToControl() { if (this.getConverter() != null) { Object objValue = this.getScreenFieldView().getFieldState(); if (this.getScreenFieldView().getControl() != null) this.getScreenFieldView().setComponentState(this.getScreenFieldView().getControl(), objValue); } }
java
public void fieldToControl() { if (this.getConverter() != null) { Object objValue = this.getScreenFieldView().getFieldState(); if (this.getScreenFieldView().getControl() != null) this.getScreenFieldView().setComponentState(this.getScreenFieldView().getControl(), objValue); } }
[ "public", "void", "fieldToControl", "(", ")", "{", "if", "(", "this", ".", "getConverter", "(", ")", "!=", "null", ")", "{", "Object", "objValue", "=", "this", ".", "getScreenFieldView", "(", ")", ".", "getFieldState", "(", ")", ";", "if", "(", "this", ".", "getScreenFieldView", "(", ")", ".", "getControl", "(", ")", "!=", "null", ")", "this", ".", "getScreenFieldView", "(", ")", ".", "setComponentState", "(", "this", ".", "getScreenFieldView", "(", ")", ".", "getControl", "(", ")", ",", "objValue", ")", ";", "}", "}" ]
Move the field's value to the control.
[ "Move", "the", "field", "s", "value", "to", "the", "control", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L194-L202
152,393
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java
ScreenField.setupControlDesc
public void setupControlDesc() { if (m_screenParent == null) return; String strDisplay = m_converterField.getFieldDesc(); if ((strDisplay != null) && (strDisplay.length() > 0)) { ScreenLocation descLocation = m_screenParent.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR); new SStaticString(descLocation, m_screenParent, strDisplay); } }
java
public void setupControlDesc() { if (m_screenParent == null) return; String strDisplay = m_converterField.getFieldDesc(); if ((strDisplay != null) && (strDisplay.length() > 0)) { ScreenLocation descLocation = m_screenParent.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR); new SStaticString(descLocation, m_screenParent, strDisplay); } }
[ "public", "void", "setupControlDesc", "(", ")", "{", "if", "(", "m_screenParent", "==", "null", ")", "return", ";", "String", "strDisplay", "=", "m_converterField", ".", "getFieldDesc", "(", ")", ";", "if", "(", "(", "strDisplay", "!=", "null", ")", "&&", "(", "strDisplay", ".", "length", "(", ")", ">", "0", ")", ")", "{", "ScreenLocation", "descLocation", "=", "m_screenParent", ".", "getNextLocation", "(", "ScreenConstants", ".", "FIELD_DESC", ",", "ScreenConstants", ".", "DONT_SET_ANCHOR", ")", ";", "new", "SStaticString", "(", "descLocation", ",", "m_screenParent", ",", "strDisplay", ")", ";", "}", "}" ]
Create the description for this control.
[ "Create", "the", "description", "for", "this", "control", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L436-L446
152,394
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java
ScreenField.printScreen
public void printScreen(PrintWriter out, ResourceBundle reg) throws DBException { this.getScreenFieldView().printScreen(out, reg); }
java
public void printScreen(PrintWriter out, ResourceBundle reg) throws DBException { this.getScreenFieldView().printScreen(out, reg); }
[ "public", "void", "printScreen", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "throws", "DBException", "{", "this", ".", "getScreenFieldView", "(", ")", ".", "printScreen", "(", "out", ",", "reg", ")", ";", "}" ]
Display the result in html table format. @param out The http output stream. @param reg The resource bundle @exception DBException File exception.
[ "Display", "the", "result", "in", "html", "table", "format", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L659-L663
152,395
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java
ScreenField.getInputType
public String getInputType(String strViewType) { if (strViewType == null) strViewType = this.getParentScreen().getViewFactory().getViewSubpackage(); BaseField field = null; if (this.getConverter() != null) field = (BaseField)this.getConverter().getField(); String strFieldType = "textbox"; // Html textbox if (field != null) strFieldType = field.getInputType(strViewType); else { if (this instanceof SPasswordField) { if (ScreenModel.HTML_TYPE.equalsIgnoreCase(strViewType)) strFieldType = "password"; else //if (TopScreen.XML_TYPE.equalsIgnoreCase(strViewType)) strFieldType = "secret"; } else if (this instanceof SNumberText) { if (ScreenModel.HTML_TYPE.equalsIgnoreCase(strViewType)) strFieldType = "float"; } } return strFieldType; }
java
public String getInputType(String strViewType) { if (strViewType == null) strViewType = this.getParentScreen().getViewFactory().getViewSubpackage(); BaseField field = null; if (this.getConverter() != null) field = (BaseField)this.getConverter().getField(); String strFieldType = "textbox"; // Html textbox if (field != null) strFieldType = field.getInputType(strViewType); else { if (this instanceof SPasswordField) { if (ScreenModel.HTML_TYPE.equalsIgnoreCase(strViewType)) strFieldType = "password"; else //if (TopScreen.XML_TYPE.equalsIgnoreCase(strViewType)) strFieldType = "secret"; } else if (this instanceof SNumberText) { if (ScreenModel.HTML_TYPE.equalsIgnoreCase(strViewType)) strFieldType = "float"; } } return strFieldType; }
[ "public", "String", "getInputType", "(", "String", "strViewType", ")", "{", "if", "(", "strViewType", "==", "null", ")", "strViewType", "=", "this", ".", "getParentScreen", "(", ")", ".", "getViewFactory", "(", ")", ".", "getViewSubpackage", "(", ")", ";", "BaseField", "field", "=", "null", ";", "if", "(", "this", ".", "getConverter", "(", ")", "!=", "null", ")", "field", "=", "(", "BaseField", ")", "this", ".", "getConverter", "(", ")", ".", "getField", "(", ")", ";", "String", "strFieldType", "=", "\"textbox\"", ";", "// Html textbox", "if", "(", "field", "!=", "null", ")", "strFieldType", "=", "field", ".", "getInputType", "(", "strViewType", ")", ";", "else", "{", "if", "(", "this", "instanceof", "SPasswordField", ")", "{", "if", "(", "ScreenModel", ".", "HTML_TYPE", ".", "equalsIgnoreCase", "(", "strViewType", ")", ")", "strFieldType", "=", "\"password\"", ";", "else", "//if (TopScreen.XML_TYPE.equalsIgnoreCase(strViewType))", "strFieldType", "=", "\"secret\"", ";", "}", "else", "if", "(", "this", "instanceof", "SNumberText", ")", "{", "if", "(", "ScreenModel", ".", "HTML_TYPE", ".", "equalsIgnoreCase", "(", "strViewType", ")", ")", "strFieldType", "=", "\"float\"", ";", "}", "}", "return", "strFieldType", ";", "}" ]
Get the rich text type for this control. @return The type (Such as HTML, Date, etc... very close to HTML control names).
[ "Get", "the", "rich", "text", "type", "for", "this", "control", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L891-L917
152,396
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/ServletMessage.java
ServletMessage.sendMessage
public InputStream sendMessage(Properties args, int method) throws IOException { // Set this up any way you want -- POST can be used for all calls, // but request headers cannot be set in JDK 1.0.2 so the query // string still must be used to pass arguments. if (method == GET) { URL url = new URL(servlet.toExternalForm() + "?" + toEncodedString(args)); return url.openStream(); } else { URLConnection conn = servlet.openConnection(); conn.setDoOutput(true); conn.setUseCaches(false); // POST the request data (html form encoded) PrintStream out = new PrintStream(conn.getOutputStream()); if (args != null && args.size() > 0) { out.print(toEncodedString(args)); } out.close(); // ESSENTIAL for this to work! // Read the POST response data return conn.getInputStream(); } }
java
public InputStream sendMessage(Properties args, int method) throws IOException { // Set this up any way you want -- POST can be used for all calls, // but request headers cannot be set in JDK 1.0.2 so the query // string still must be used to pass arguments. if (method == GET) { URL url = new URL(servlet.toExternalForm() + "?" + toEncodedString(args)); return url.openStream(); } else { URLConnection conn = servlet.openConnection(); conn.setDoOutput(true); conn.setUseCaches(false); // POST the request data (html form encoded) PrintStream out = new PrintStream(conn.getOutputStream()); if (args != null && args.size() > 0) { out.print(toEncodedString(args)); } out.close(); // ESSENTIAL for this to work! // Read the POST response data return conn.getInputStream(); } }
[ "public", "InputStream", "sendMessage", "(", "Properties", "args", ",", "int", "method", ")", "throws", "IOException", "{", "// Set this up any way you want -- POST can be used for all calls,", "// but request headers cannot be set in JDK 1.0.2 so the query", "// string still must be used to pass arguments.", "if", "(", "method", "==", "GET", ")", "{", "URL", "url", "=", "new", "URL", "(", "servlet", ".", "toExternalForm", "(", ")", "+", "\"?\"", "+", "toEncodedString", "(", "args", ")", ")", ";", "return", "url", ".", "openStream", "(", ")", ";", "}", "else", "{", "URLConnection", "conn", "=", "servlet", ".", "openConnection", "(", ")", ";", "conn", ".", "setDoOutput", "(", "true", ")", ";", "conn", ".", "setUseCaches", "(", "false", ")", ";", "// POST the request data (html form encoded)", "PrintStream", "out", "=", "new", "PrintStream", "(", "conn", ".", "getOutputStream", "(", ")", ")", ";", "if", "(", "args", "!=", "null", "&&", "args", ".", "size", "(", ")", ">", "0", ")", "{", "out", ".", "print", "(", "toEncodedString", "(", "args", ")", ")", ";", "}", "out", ".", "close", "(", ")", ";", "// ESSENTIAL for this to work!", "// Read the POST response data", "return", "conn", ".", "getInputStream", "(", ")", ";", "}", "}" ]
Send the request. Return the input stream with the response if the request succeeds. @param args the arguments to send to the servlet @param method GET or POST @exception IOException if error sending request @return the response from the servlet to this message
[ "Send", "the", "request", ".", "Return", "the", "input", "stream", "with", "the", "response", "if", "the", "request", "succeeds", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/ServletMessage.java#L68-L96
152,397
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/ServletMessage.java
ServletMessage.toEncodedString
public String toEncodedString(Properties args) { StringBuffer sb = new StringBuffer(); try { if (args != null) { String sep = ""; Enumeration<?> names = args.propertyNames(); while (names.hasMoreElements()) { String name = (String)names.nextElement(); sb.append(sep).append(URLEncoder.encode(name, Constants.URL_ENCODING)).append("=").append( URLEncoder.encode(args.getProperty(name), Constants.URL_ENCODING)); sep = "&"; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return sb.toString(); }
java
public String toEncodedString(Properties args) { StringBuffer sb = new StringBuffer(); try { if (args != null) { String sep = ""; Enumeration<?> names = args.propertyNames(); while (names.hasMoreElements()) { String name = (String)names.nextElement(); sb.append(sep).append(URLEncoder.encode(name, Constants.URL_ENCODING)).append("=").append( URLEncoder.encode(args.getProperty(name), Constants.URL_ENCODING)); sep = "&"; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return sb.toString(); }
[ "public", "String", "toEncodedString", "(", "Properties", "args", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "try", "{", "if", "(", "args", "!=", "null", ")", "{", "String", "sep", "=", "\"\"", ";", "Enumeration", "<", "?", ">", "names", "=", "args", ".", "propertyNames", "(", ")", ";", "while", "(", "names", ".", "hasMoreElements", "(", ")", ")", "{", "String", "name", "=", "(", "String", ")", "names", ".", "nextElement", "(", ")", ";", "sb", ".", "append", "(", "sep", ")", ".", "append", "(", "URLEncoder", ".", "encode", "(", "name", ",", "Constants", ".", "URL_ENCODING", ")", ")", ".", "append", "(", "\"=\"", ")", ".", "append", "(", "URLEncoder", ".", "encode", "(", "args", ".", "getProperty", "(", "name", ")", ",", "Constants", ".", "URL_ENCODING", ")", ")", ";", "sep", "=", "\"&\"", ";", "}", "}", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands. @return the URLEncoded string with name=value pairs
[ "Encode", "the", "arguments", "in", "the", "property", "set", "as", "a", "URL", "-", "encoded", "string", ".", "Multiple", "name", "=", "value", "pairs", "are", "separated", "by", "ampersands", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/ServletMessage.java#L103-L120
152,398
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/MultipleTableFieldConverter.java
MultipleTableFieldConverter.getTargetField
public Converter getTargetField(Record record) { if (record == null) { BaseTable currentTable = m_recMerge.getTable().getCurrentTable(); if (currentTable == null) currentTable = m_recMerge.getTable(); // First time only record = currentTable.getRecord(); } Converter field = null; if (fieldName != null) field = record.getField(fieldName); // Get the current field else field = record.getField(m_iFieldSeq); // Get the current field if ((m_iSecondaryFieldSeq != -1) || (secondaryFieldName != null)) if (field instanceof ReferenceField) if (((ReferenceField)field).getRecord() != null) if (((ReferenceField)field).getRecord().getTable() != null) // Make sure this isn't being called in free() { // Special case - field in the secondary file Record recordSecond = ((ReferenceField)field).getReferenceRecord(); if (recordSecond != null) { if (secondaryFieldName != null) field = recordSecond.getField(secondaryFieldName); else field = recordSecond.getField(m_iSecondaryFieldSeq); } } return field; }
java
public Converter getTargetField(Record record) { if (record == null) { BaseTable currentTable = m_recMerge.getTable().getCurrentTable(); if (currentTable == null) currentTable = m_recMerge.getTable(); // First time only record = currentTable.getRecord(); } Converter field = null; if (fieldName != null) field = record.getField(fieldName); // Get the current field else field = record.getField(m_iFieldSeq); // Get the current field if ((m_iSecondaryFieldSeq != -1) || (secondaryFieldName != null)) if (field instanceof ReferenceField) if (((ReferenceField)field).getRecord() != null) if (((ReferenceField)field).getRecord().getTable() != null) // Make sure this isn't being called in free() { // Special case - field in the secondary file Record recordSecond = ((ReferenceField)field).getReferenceRecord(); if (recordSecond != null) { if (secondaryFieldName != null) field = recordSecond.getField(secondaryFieldName); else field = recordSecond.getField(m_iSecondaryFieldSeq); } } return field; }
[ "public", "Converter", "getTargetField", "(", "Record", "record", ")", "{", "if", "(", "record", "==", "null", ")", "{", "BaseTable", "currentTable", "=", "m_recMerge", ".", "getTable", "(", ")", ".", "getCurrentTable", "(", ")", ";", "if", "(", "currentTable", "==", "null", ")", "currentTable", "=", "m_recMerge", ".", "getTable", "(", ")", ";", "// First time only", "record", "=", "currentTable", ".", "getRecord", "(", ")", ";", "}", "Converter", "field", "=", "null", ";", "if", "(", "fieldName", "!=", "null", ")", "field", "=", "record", ".", "getField", "(", "fieldName", ")", ";", "// Get the current field", "else", "field", "=", "record", ".", "getField", "(", "m_iFieldSeq", ")", ";", "// Get the current field", "if", "(", "(", "m_iSecondaryFieldSeq", "!=", "-", "1", ")", "||", "(", "secondaryFieldName", "!=", "null", ")", ")", "if", "(", "field", "instanceof", "ReferenceField", ")", "if", "(", "(", "(", "ReferenceField", ")", "field", ")", ".", "getRecord", "(", ")", "!=", "null", ")", "if", "(", "(", "(", "ReferenceField", ")", "field", ")", ".", "getRecord", "(", ")", ".", "getTable", "(", ")", "!=", "null", ")", "// Make sure this isn't being called in free()", "{", "// Special case - field in the secondary file", "Record", "recordSecond", "=", "(", "(", "ReferenceField", ")", "field", ")", ".", "getReferenceRecord", "(", ")", ";", "if", "(", "recordSecond", "!=", "null", ")", "{", "if", "(", "secondaryFieldName", "!=", "null", ")", "field", "=", "recordSecond", ".", "getField", "(", "secondaryFieldName", ")", ";", "else", "field", "=", "recordSecond", ".", "getField", "(", "m_iSecondaryFieldSeq", ")", ";", "}", "}", "return", "field", ";", "}" ]
Get the target field in this record.
[ "Get", "the", "target", "field", "in", "this", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/MultipleTableFieldConverter.java#L170-L199
152,399
krotscheck/data-file-reader
data-file-reader-csv/src/main/java/net/krotscheck/dfr/csv/CSVDataEncoder.java
CSVDataEncoder.writeToOutput
@Override protected void writeToOutput(final Map<String, Object> row) throws IOException { if (writer == null) { CsvMapper mapper = new CsvMapper(); mapper.disable(SerializationFeature.CLOSE_CLOSEABLE); mapper.getFactory() .configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); CsvSchema schema = buildCsvSchema(row); writer = mapper.writer(schema); writer.writeValue(getWriter(), row.keySet()); } writer.writeValue(getWriter(), row.values()); }
java
@Override protected void writeToOutput(final Map<String, Object> row) throws IOException { if (writer == null) { CsvMapper mapper = new CsvMapper(); mapper.disable(SerializationFeature.CLOSE_CLOSEABLE); mapper.getFactory() .configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); CsvSchema schema = buildCsvSchema(row); writer = mapper.writer(schema); writer.writeValue(getWriter(), row.keySet()); } writer.writeValue(getWriter(), row.values()); }
[ "@", "Override", "protected", "void", "writeToOutput", "(", "final", "Map", "<", "String", ",", "Object", ">", "row", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "CsvMapper", "mapper", "=", "new", "CsvMapper", "(", ")", ";", "mapper", ".", "disable", "(", "SerializationFeature", ".", "CLOSE_CLOSEABLE", ")", ";", "mapper", ".", "getFactory", "(", ")", ".", "configure", "(", "JsonGenerator", ".", "Feature", ".", "AUTO_CLOSE_TARGET", ",", "false", ")", ";", "CsvSchema", "schema", "=", "buildCsvSchema", "(", "row", ")", ";", "writer", "=", "mapper", ".", "writer", "(", "schema", ")", ";", "writer", ".", "writeValue", "(", "getWriter", "(", ")", ",", "row", ".", "keySet", "(", ")", ")", ";", "}", "writer", ".", "writeValue", "(", "getWriter", "(", ")", ",", "row", ".", "values", "(", ")", ")", ";", "}" ]
Write a row to the destination. @param row The row to write. @throws java.io.IOException Exception thrown when there's problems writing to the output.
[ "Write", "a", "row", "to", "the", "destination", "." ]
b9a85bd07dc9f9b8291ffbfb6945443d96371811
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-csv/src/main/java/net/krotscheck/dfr/csv/CSVDataEncoder.java#L47-L61