From e6b7436f4cd88c5a4bf2e31d73b26b6641bb572c Mon Sep 17 00:00:00 2001
From: Jumper Chen Notice that the encoding of the Locale dependent file (*.properties)
- * is assumed to be UTF-8. If it is not the case, please refer to
+ * is assumed to be UTF-8. If it is not the case, please refer to
* ZK Configuration Reference
* for more information.
* Specify the library property of Note that fellow components are looked up first, then the space owner
* ancestors
- * since 3.5.2, the controller would be assigned as a variable of the given idspace
+ * since 3.5.2, the controller would be assigned as a variable of the given idspace
* per the naming convention composed of the idspace id and controller Class name. e.g.
- * if the idspace id is "xwin" and the controller class is
+ * if the idspace id is "xwin" and the controller class is
* org.zkoss.MyController, then the variable name would be "xwin$MyController" This is useful in writing controller code in MVC design practice. You
* can wire the components into the controller object per the
* component's id and do whatever you like. Since 3.6.0, for Groovy or other environment that
* '$' is not applicable, you can invoke {@link #wireFellows(IdSpace,Object,char)}
* to use '_' as the separator.
- *
+ *
* @param idspace the id space to be bound
* @param controller the controller Java object to be injected the fellow components.
*/
@@ -104,35 +104,35 @@ public static final void wireFellows(IdSpace idspace, Object controller, char se
new ConventionWire(controller, separator, ignoreZScript, ignoreXel).wireFellows(idspace);
}
- /** Wire accessible variable objects of the specified component into a
- * controller Java object. This implementation checks the
- * setXxx() method names first then the field names. If a setXxx() method
- * name matches the name of the resolved variable object with correct
- * argument type and the associated field value is null, then the method is
- * called with the resolved variable object as the argument.
- * If no proper setXxx() method then search the
+ /** Wire accessible variable objects of the specified component into a
+ * controller Java object. This implementation checks the
+ * setXxx() method names first then the field names. If a setXxx() method
+ * name matches the name of the resolved variable object with correct
+ * argument type and the associated field value is null, then the method is
+ * called with the resolved variable object as the argument.
+ * If no proper setXxx() method then search the
* field name of the controller object. If the field name matches the name
* of the resolved variable object with correct field type and null field
* value, the field is then assigned the resolved variable object.
- * The controller would be assigned as a variable of the given component
* per the naming convention composed of the component id and controller Class name. e.g.
- * if the component id is "xwin" and the controller class is
+ * if the component id is "xwin" and the controller class is
* org.zkoss.MyController, then the variable name would be "xwin$MyController" This is useful in writing controller code in MVC design practice. You
- * can wire the embedded objects, components, and accessible variables into
- * the controller object per the components' id and variables' name and do
+ * can wire the embedded objects, components, and accessible variables into
+ * the controller object per the components' id and variables' name and do
* whatever you like.
* Since 3.6.0, for Groovy or other environment that
* '$' is not applicable, you can invoke {@link #wireVariables(Component,Object,char)}
* to use '_' as the separator.
- *
+ *
* @param comp the reference component to wire variables
- * @param controller the controller Java object to be injected the
+ * @param controller the controller Java object to be injected the
* accessible variable objects.
* @see org.zkoss.zk.ui.util.GenericAutowireComposer
*/
@@ -164,34 +164,34 @@ public static final void wireVariables(Component comp, Object controller, char s
new ConventionWire(controller, separator, ignoreZScript, ignoreXel).wireVariables(comp);
}
- /** Wire accessible variables of the specified page into a
- * controller Java object. This implementation checks the
- * setXxx() method names first then the field names. If a setXxx() method
- * name matches the name of the resolved variable object with correct
- * argument type and the associated field value is null, then the method is
- * called with the resolved variable object as the argument.
- * If no proper setXxx() method then search the
+ /** Wire accessible variables of the specified page into a
+ * controller Java object. This implementation checks the
+ * setXxx() method names first then the field names. If a setXxx() method
+ * name matches the name of the resolved variable object with correct
+ * argument type and the associated field value is null, then the method is
+ * called with the resolved variable object as the argument.
+ * If no proper setXxx() method then search the
* field name of the controller object. If the field name matches the name
* of the resolved variable object with correct field type and null field
- * value, the field is then assigned the resolved variable object.org.zkoss.util.resource.LabelLoader.class
@@ -109,7 +109,9 @@ public Object filter(Object key, Object value) {
* @since 8.6.0
*/
protected Object handleMissingLabel(Object key) {
- log.debug("The key of [{}] is not found in labels!", key);
+ if (log.isDebugEnabled()) {
+ log.debug("The key of [{}] is not found in labels!", key);
+ }
return null;
}
@@ -220,7 +222,7 @@ private final Map
The controller would be assigned as a variable of the given page + *
The controller would be assigned as a variable of the given page * per the naming convention composed of the page id and controller Class name. e.g. - * if the page id is "xpage" and the controller class is + * if the page id is "xpage" and the controller class is * org.zkoss.MyController, then the variable name would be "xpage$MyController"
* *Since 3.0.8, if the method name of field name matches the ZK implicit - * object name, ZK implicit object will be wired in, too.
+ * object name, ZK implicit object will be wired in, too. *This is useful in writing controller code in MVC design practice. You - * can wire the embedded objects, components, and accessible variables into - * the controller object per the component's id and variable name and do + * can wire the embedded objects, components, and accessible variables into + * the controller object per the component's id and variable name and do * whatever you like. *
- * + * *Since 3.6.0, for Groovy or other environment that * '$' is not applicable, you can invoke {@link #wireVariables(Page,Object,char)} * to use '_' as the separator. - * + * * @param page the reference page to wire variables * @param controller the controller Java object to be injected the fellow components. */ @@ -360,8 +360,8 @@ private static String composerNameByClass(String id, Class cls, char separator) return id + separator + (j >= 0 ? clsname.substring(j + 1) : clsname); } - /**Wire implicit variables of the specified component into a controller Java object. - * + /**Wire implicit variables of the specified component into a controller Java object. + * * @param comp the component * @param controller the controller object */ @@ -369,27 +369,27 @@ public static final void wireImplicit(Component comp, Object controller) { new ConventionWire(controller, '$', true, true).wireImplicit(comp); } - /**
Adds forward conditions to myid source component so onXxx source - * event received by - * myid component can be forwarded to the specified target - * component with the target event name onXxx$myid.
- *The controller is a POJO file with onXxx$myid methods (the event handler - * codes). This utility method search such onXxx$myid methods and adds - * forward condition to the source myid component looked up by - * {@link Component#getAttributeOrFellow} of the specified component, so you - * don't have to specify in zul file the "forward" attribute one by one. - * If the source component cannot be looked up or the object looked up is + /**
Adds forward conditions to myid source component so onXxx source + * event received by + * myid component can be forwarded to the specified target + * component with the target event name onXxx$myid.
+ *The controller is a POJO file with onXxx$myid methods (the event handler + * codes). This utility method search such onXxx$myid methods and adds + * forward condition to the source myid component looked up by + * {@link Component#getAttributeOrFellow} of the specified component, so you + * don't have to specify in zul file the "forward" attribute one by one. + * If the source component cannot be looked up or the object looked up is * not a component, this method will log the error and ignore it. *
- *Cascaded '$' will add Forwards cascadedly. E.g. define method - * onClick$btn$w1 in window w2. This method will add a forward on the button + *
Cascaded '$' will add Forwards cascadedly. E.g. define method + * onClick$btn$w1 in window w2. This method will add a forward on the button * "btn.onClick=w1.onClick$btn" and add another forward on the window w1 * "w1.onClick$btn=w2.onClick$btn$w1"
- * + * *Since 3.6.0, for Groovy or other environment that * '$' is not applicable, you can invoke {@link #addForwards(Component,Object,char)} * to use '_' as the separator. - * + * * @param comp the targetComponent * @param controller the controller code with onXxx$myid event handler methods */ @@ -428,7 +428,9 @@ public static void addForwards(Component comp, Object controller, char separator } if (srccomp == null || !(srccomp instanceof Component)) { if (log.isDebugEnabled()) - log.debug("Cannot find the associated component to forward event: " + mdname); + log.debug( + "Cannot find the associated component to forward event: {}", + mdname); break; } else { ((Component) srccomp).addForward(srcevt, xcomp, mdname); diff --git a/zk/src/main/java/org/zkoss/zk/ui/util/GenericAutowireComposer.java b/zk/src/main/java/org/zkoss/zk/ui/util/GenericAutowireComposer.java index 0524357ff97..5e0b26dda0b 100644 --- a/zk/src/main/java/org/zkoss/zk/ui/util/GenericAutowireComposer.java +++ b/zk/src/main/java/org/zkoss/zk/ui/util/GenericAutowireComposer.java @@ -1,8 +1,8 @@ /* GenericAutowireComposer.java Purpose: - + Description: - + History: Jun 11, 2008 10:56:06 AM, Created by henrichen @@ -39,27 +39,27 @@ import org.zkoss.zk.ui.event.SerializableEventListener; /** - *
A skeletal composer that you can extend and write intuitive onXxx + *
A skeletal composer that you can extend and write intuitive onXxx * event handler methods with "auto-wired" accessible variable objects such - * as implicit objects, components, and external resolvable variables in a ZK - * zuml page. This class will registers onXxx events to the supervised - * component and wire all accessible variable objects to this composer by - * calling setXxx() method or set xxx field value directly per the variable - * name. Since 3.0.7, this composer has wired all implicit objects - * such as self, spaceOwner, page, desktop, session, application, - * componentScope, spaceScope, pageScope, desktopScope, sessionScope, - * applicationScope, and requestScope, so you can use them directly. Besides - * that, it also provides alert(String message) method, so you can call alert() - * without problems. Since 3.5.2, the composer itself would be assigned as an - * attribute of the supervised component per the naming convention of - * the component id and composer class name or of component id and "composer". - * e.g. If the component id is "mywin" and the composer class is org.zkoss.MyComposer, - * then the composer can be referenced by the variable name of "mywin$MyController" or + * as implicit objects, components, and external resolvable variables in a ZK + * zuml page. This class will registers onXxx events to the supervised + * component and wire all accessible variable objects to this composer by + * calling setXxx() method or set xxx field value directly per the variable + * name. Since 3.0.7, this composer has wired all implicit objects + * such as self, spaceOwner, page, desktop, session, application, + * componentScope, spaceScope, pageScope, desktopScope, sessionScope, + * applicationScope, and requestScope, so you can use them directly. Besides + * that, it also provides alert(String message) method, so you can call alert() + * without problems. Since 3.5.2, the composer itself would be assigned as an + * attribute of the supervised component per the naming convention of + * the component id and composer class name or of component id and "composer". + * e.g. If the component id is "mywin" and the composer class is org.zkoss.MyComposer, + * then the composer can be referenced by the variable name of "mywin$MyController" or * "mywin$composer". Notice that the '$' separator can be changed to other character * such as '_' for Groovy or other environment that '$' is not applicable. Simply * extends this class and calling {@link #GenericAutowireComposer(char separator)} * constructor with proper separator character.
- * + * *Alternatives: in most cases, you don't extend from {@link GenericAutowireComposer} directly. * Rather, you can extend from one of the following skeletons. *
Notice that since this composer kept references to the components, single * instance composer object cannot be shared by multiple components.
- * - *The following is an example. The onOK event listener is registered into + * + *
The following is an example. The onOK event listener is registered into * the target window, and the Textbox component with id name "mytextbox" is - * injected into the "mytextbox" field automatically (so you can use - * mytextbox variable directly in onOK). The "value" property of "mytextbox" + * injected into the "mytextbox" field automatically (so you can use + * mytextbox variable directly in onOK). The "value" property of "mytextbox" * is assigned with composer's getTitle(), i.e. "ZK".
- * + * *
* MyComposer.java
- *
+ *
* public class MyComposer extends GenericAutowireComposer {
* private Textbox mytextbox;
- *
+ *
* public void onOK() {
* mytextbox.setValue("Enter Pressed");
* alert("Hi!");
@@ -95,9 +95,9 @@
* return "ZK";
* }
* }
- *
+ *
* test.zul
- *
+ *
* <window id="mywin" apply="MyComposer">
* <textbox id="mytextbox" value="${mywin$composer.title}"/>
* </window>
@@ -111,7 +111,7 @@
* <textbox id="mytextbox" value="${mc.title}"/>
* </window>
*
- *
+ *
* @author henrichen
* @since 3.0.6
* @see ConventionWires
@@ -123,7 +123,7 @@ public abstract class GenericAutowireComposerIn other words, whether to ignore variables defined in ZSCRIPT and XEL depends
* on the library variables called org.zkoss.zk.ui.composer.autowire.zscript
* and org.zkoss.zk.ui.composer.autowire.xel
.
- * Furthermore, if not specified, their values are default to false, i.e.,
+ * Furthermore, if not specified, their values are default to false, i.e.,
* they shall
If you want to control whether to wire ZSCRIPT's or XEL's variable * explicitly, you could use @@ -234,7 +234,7 @@ protected GenericAutowireComposer() { *
In other words, whether to ignore variables defined in ZSCRIPT and XEL depends
* on the library variables called org.zkoss.zk.ui.composer.autowire.zscript
* and org.zkoss.zk.ui.composer.autowire.xel
.
- * Furthermore, if not specified, their values are default to false, i.e.,
+ * Furthermore, if not specified, their values are default to false, i.e.,
* they shall
If you want to control whether to wire ZSCRIPT's or XEL's variable
* explicitly, you could use
@@ -294,9 +294,9 @@ protected Page getPage() {
}
/**
- * Auto wire accessible variables of the specified component into a
- * controller Java object; a subclass that
- * override this method should remember to call super.doAfterCompose(comp)
+ * Auto wire accessible variables of the specified component into a
+ * controller Java object; a subclass that
+ * override this method should remember to call super.doAfterCompose(comp)
* or it will not work.
*/
public void doAfterCompose(T comp) throws Exception {
@@ -320,7 +320,7 @@ public void onEvent(CreateEvent event) throws Exception {
}
/** Shortcut to call Messagebox.show(String).
- * @since 3.0.7
+ * @since 3.0.7
*/
private static Method _alert;
@@ -336,7 +336,9 @@ protected void alert(String m) {
_alert.invoke(null, new Object[] { m });
return; //done
} catch (Throwable ex) {
- log.debug("Failed to invoke org.zkoss.zul.Messagebox", ex);
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to invoke org.zkoss.zul.Messagebox", ex);
+ }
//Ignore
}
}
@@ -344,12 +346,12 @@ protected void alert(String m) {
org.zkoss.zk.ui.util.Clients.alert(m);
}
- //ComponentCloneListener
- /** Internal use only. Call-back method of CloneComposerListener. You shall
- * not call this method directly. Clone this Composer when its applied
+ //ComponentCloneListener
+ /** Internal use only. Call-back method of CloneComposerListener. You shall
+ * not call this method directly. Clone this Composer when its applied
* component is cloned.
* @param comp the clone of the applied component
- * @return A clone of this Composer.
+ * @return A clone of this Composer.
* @since 3.5.2
*/
public Object willClone(Component comp) {
@@ -361,7 +363,7 @@ public Object willClone(Component comp) {
composerClone = (Composer) Classes.newInstance(getClass(), null);
exec.setAttribute(COMPOSER_CLONE + idcode, composerClone);
- //cannot call doAfterCompose directly because the clone
+ //cannot call doAfterCompose directly because the clone
//component might not be attach to Page yet
comp.addEventListener(ON_CLONE_DO_AFTER_COMPOSE, new CloneDoAfterCompose());
Events.postEvent(new Event(ON_CLONE_DO_AFTER_COMPOSE, comp, composerClone));
diff --git a/zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java b/zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java
index 79143df7bf5..ed81201d495 100644
--- a/zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java
+++ b/zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java
@@ -1,9 +1,9 @@
/* BinderImpl.java
Purpose:
-
+
Description:
-
+
History:
Jul 29, 2011 6:08:51 PM, Created by henrichen
@@ -175,7 +175,7 @@ public class BinderImpl implements Binder, BinderCtrl, Serializable {
private static final Map In WEB-INF/zk.xml, add following lines:
* Default exception handler.
+ * Default exception handler.
* This implementation simply rollback the transaction. Application developer might want to extends this class and override
- * this method to do other things like compensate for any permanent changes
- * during the conversation, and finally restart business conversation...
+ *
+ * Application developer might want to extends this class and override
+ * this method to do other things like compensate for any permanent changes
+ * during the conversation, and finally restart business conversation...
* what can be done here depends on the applications design. The query string might contain servlet path and other parts.
* This method starts the searching from the first '?'.
@@ -219,7 +219,7 @@ private static final int next(StringBuffer sb, char cc, int j) {
*
* @param str The query string like xxx?xxx=xxx&xxx=xxx or null.
* @param name The get parameter name.
- * @param value The value associated with the get parameter name.
+ * @param value The value associated with the get parameter name.
* @return The new or result query string with your name/value.
* @see #addToQueryString
*/
@@ -357,7 +357,7 @@ public static final StringBuffer removeFromQueryString(StringBuffer sb, String n
* It resolves "*" contained in URI, if any, to the proper Locale,
* and the browser code.
* Refer to {@link Servlets#locate(ServletContext, ServletRequest, String, Locator)}
- * for details.
+ * for details.
*
* In additions, if uri starts with "/", the context path, e.g.,
* /zkdemo, is prefixed.
@@ -384,7 +384,7 @@ public static final StringBuffer removeFromQueryString(StringBuffer sb, String n
* To do that, you can implement {@link URLEncoder}, and then
* specify the class with the library property called
*
* <listener>
@@ -49,8 +49,11 @@ public void cleanup(Execution exec, Execution parent, List errs) throws Exceptio
if (parent == null) {
try {
if (errs == null || errs.isEmpty()) {
- log.debug("JPA: Committing the database transaction: " + exec + " for entityManager:"
- + JpaUtil.getEntityManager());
+ if (log.isDebugEnabled()) {
+ log.debug(
+ "JPA: Committing the database transaction: {} for entityManager:{}",
+ exec, JpaUtil.getEntityManager());
+ }
JpaUtil.getEntityManager().getTransaction().commit();
} else {
final Throwable ex = (Throwable) errs.get(0);
@@ -58,12 +61,17 @@ public void cleanup(Execution exec, Execution parent, List errs) throws Exceptio
}
} finally {
if (JpaUtil.getEntityManager().isOpen()) {
- log.debug("JPA: close a database transaction: " + exec + " for entityManager:"
- + JpaUtil.getEntityManager());
+ if (log.isDebugEnabled()) {
+ log.debug(
+ "JPA: close a database transaction: {} for entityManager:{}",
+ exec, JpaUtil.getEntityManager());
+ }
JpaUtil.getEntityManager().close();
- } else
- log.debug("JPA: the database transaction is not open: " + exec + " for entityManager:"
- + JpaUtil.getEntityManager());
+ } else if (log.isDebugEnabled()) {
+ log.debug(
+ "JPA: the database transaction is not open: {} for entityManager:{}",
+ exec, JpaUtil.getEntityManager());
+ }
}
}
}
@@ -72,21 +80,24 @@ public void cleanup(Execution exec, Execution parent, List errs) throws Exceptio
public void init(Execution exec, Execution parent) throws Exception {
if (parent == null) {
- log.debug("JPA: Starting a database transaction: " + exec + " for entityManager:"
- + JpaUtil.getEntityManager());
+ if (log.isDebugEnabled()) {
+ log.debug(
+ "JPA: Starting a database transaction: {} for entityManager:{}",
+ exec, JpaUtil.getEntityManager());
+ }
JpaUtil.getEntityManager().getTransaction().begin();
}
}
/**
- *
org.zkoss.web.servlet.http.URLEncoder
.
- * When {@link #encodeURL} encodes an URL, it will invoke
+ * When {@link #encodeURL} encodes an URL, it will invoke
* {@link URLEncoder#encodeURL} such you can do customized encoding,
* such as insert a special prefix.
*
@@ -464,7 +464,7 @@ private static final String encodeURL0(ServletContext ctx, ServletRequest reques
if (newctx != null) {
ctx = newctx;
} else if (log.isDebugEnabled()) {
- log.debug("Context not found: " + ctxroot);
+ log.debug("Context not found: {}", ctxroot);
}
ctxpathSpecified = true;
} else if (Https.isIncluded(request) || Https.isForwarded(request)) {
@@ -476,7 +476,8 @@ private static final String encodeURL0(ServletContext ctx, ServletRequest reques
if (j >= 0) {
uri = pgpath.substring(0, j + 1) + uri;
} else {
- log.warn("The current page doesn't contain '/':" + pgpath);
+ log.warn("The current page doesn't contain '/':{}",
+ pgpath);
}
}
}
@@ -525,7 +526,7 @@ private static final String encodeURL0(ServletContext ctx, ServletRequest reques
* To do that, you can implement {@link URLEncoder}, and then
* specify the class with the library property called
* org.zkoss.web.servlet.http.URLEncoder
.
- * When {@link #encodeURL} encodes an URL, it will invoke
+ * When {@link #encodeURL} encodes an URL, it will invoke
* {@link URLEncoder#encodeURL} such you can do customized encoding,
* such as insert a special prefix.
*
diff --git a/zweb/src/main/java/org/zkoss/web/servlet/http/Https.java b/zweb/src/main/java/org/zkoss/web/servlet/http/Https.java
index 4868dfce674..c382c6e384c 100644
--- a/zweb/src/main/java/org/zkoss/web/servlet/http/Https.java
+++ b/zweb/src/main/java/org/zkoss/web/servlet/http/Https.java
@@ -752,7 +752,7 @@ private static int[] parseRange(String range) {
} catch (Throwable ex) { //ignore
}
if (log.isDebugEnabled())
- log.debug("Failed to parse Range: " + range);
+ log.debug("Failed to parse Range: {}", range);
return null;
}
}
diff --git a/zweb/src/main/java/org/zkoss/web/util/resource/ExtendletLoader.java b/zweb/src/main/java/org/zkoss/web/util/resource/ExtendletLoader.java
index ab166359e48..4aebe6f94b2 100644
--- a/zweb/src/main/java/org/zkoss/web/util/resource/ExtendletLoader.java
+++ b/zweb/src/main/java/org/zkoss/web/util/resource/ExtendletLoader.java
@@ -1,9 +1,9 @@
/* ExtendletLoader.java
Purpose:
-
+
Description:
-
+
History:
Wed May 28 17:01:32 2008, Created by tomyeh
@@ -103,7 +103,7 @@ public long getLastModified(String src) {
public V load(String src) throws Exception {
if (log.isDebugEnabled())
- log.debug("Parse " + src);
+ log.debug("Parse {}", src);
final String path = getRealPath(src);
InputStream is = null;
if (getCheckPeriod() >= 0) {
@@ -116,7 +116,7 @@ public V load(String src) throws Exception {
is = real.openStream();
}
} catch (Throwable ex) {
- log.warn("Unable to read from URL: " + path, ex);
+ log.warn("Unable to read from URL: {}", path, ex);
}
}
diff --git a/zweb/src/main/java/org/zkoss/web/util/resource/ResourceLoader.java b/zweb/src/main/java/org/zkoss/web/util/resource/ResourceLoader.java
index 63f483550a9..2ca97870412 100644
--- a/zweb/src/main/java/org/zkoss/web/util/resource/ResourceLoader.java
+++ b/zweb/src/main/java/org/zkoss/web/util/resource/ResourceLoader.java
@@ -1,9 +1,9 @@
/* ResourceLoader.java
Purpose:
-
+
Description:
-
+
History:
Tue Aug 30 18:31:26 2005, Created by tomyeh
@@ -99,12 +99,12 @@ public V load(ResourceInfo src) throws Exception {
if (!src.file.exists() && src.extra != null
&& ((ServletContextLocator) src.extra).getResourceAsStream(src.path) == null) {
if (log.isDebugEnabled())
- log.debug("Not found: " + src.file);
+ log.debug("Not found: {}", src.file);
return null; //File not found
}
if (log.isDebugEnabled())
- log.debug("Loading " + src.file);
+ log.debug("Loading {}", src.file);
try {
return parse(src.path, src.file, src.extra);
} catch (FileNotFoundException ex) {