Author: abelevich
Date: 2008-03-11 08:25:36 -0400 (Tue, 11 Mar 2008)
New Revision: 6681
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
Log:
add desc, format code
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java
===================================================================
---
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java 2008-03-11
12:23:57 UTC (rev 6680)
+++
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java 2008-03-11
12:25:36 UTC (rev 6681)
@@ -9,7 +9,9 @@
import org.ajax4jsf.util.SelectUtils;
/**
+ * UI implementation of ComboBox component
* @author Anton Belevich
+ * @since 3.2.0
*
*/
public class UIInplaceSelect extends UISelectOne{
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
---
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-03-11
12:23:57 UTC (rev 6680)
+++
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-03-11
12:25:36 UTC (rev 6681)
@@ -23,8 +23,9 @@
import org.richfaces.component.UIInplaceSelect;
/**
+ * InplaceSelect base renderer implementation
* @author Anton Belevich
- *
+ * @since 3.2.0
*/
public class InplaceSelectBaseRenderer extends ComboBoxBaseRenderer{
@@ -33,96 +34,92 @@
private static final String CONTROLS_FACET = "controls";
- @Override
- protected void doDecode(FacesContext context, UIComponent component) {
- UIInplaceSelect inplaceInput = null;
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ UIInplaceSelect inplaceInput = null;
- if (component instanceof UIInplaceSelect) {
- inplaceInput = (UIInplaceSelect) component;
- } else {
- if (logger.isDebugEnabled()) {
- logger.debug("No decoding necessary since the component "
- + component.getId() +
- " is not an instance or a sub class of UIInplaceSelect");
- }
- return;
- }
-
- if (InputUtils.isDisabled(inplaceInput) || InputUtils.isReadOnly(inplaceInput)) {
- if (logger.isDebugEnabled()) {
- logger.debug(("No decoding necessary since the component "
- + component.getId() + " is disabled"));
- }
- }
-
- String clientId = component.getClientId(context);
- if (clientId == null) {
- throw new NullPointerException("component " +
inplaceInput.getClientId(context) + " client id is NULL" );
- }
-
- clientId = clientId + "inplaceValue";
- Map request = context.getExternalContext().getRequestParameterMap();
- if (request.containsKey(clientId)) {
- String newValue = (String)request.get(clientId);
- inplaceInput.setSubmittedValue(newValue);
- }
+ if (component instanceof UIInplaceSelect) {
+ inplaceInput = (UIInplaceSelect) component;
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("No decoding necessary since the component " + component.getId()
+ " is not an instance or a sub class of UIInplaceSelect");
+ }
+ return;
}
-
- @Override
- public Object getConvertedValue(FacesContext context, UIComponent component, Object
submittedValue) throws ConverterException {
- UIInplaceSelect select = null;
- Converter converter = null;
- if (component instanceof UIInplaceSelect) {
- select = (UIInplaceSelect)component;
- converter = select.getConverter();
- }
- return getConvertedValue(context, component, submittedValue, converter);
+
+ if (InputUtils.isDisabled(inplaceInput) || InputUtils.isReadOnly(inplaceInput)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(("No decoding necessary since the component " +
component.getId() + " is disabled"));
+ }
}
-
- public void encodeItems(FacesContext context, UIComponent component) throws IOException
{
- List values = new ArrayList();
- ResponseWriter writer = context.getResponseWriter();
-
- List <SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
- if(!selectItems.isEmpty()) {
- for (Iterator <SelectItem> iterator = selectItems.iterator();
iterator.hasNext();) {
- SelectItem selectItem = iterator.next();
- String value = getConvertedStringValue(context, component, selectItem.getValue());
- values.add(value);
- encodeSuggestion(writer, component, value, RICH_INPLACE_SELECT_CLASSES);
- }
- }
- setValuesList(values);
+
+ String clientId = component.getClientId(context);
+ if (clientId == null) {
+ throw new NullPointerException("component " +
inplaceInput.getClientId(context) + " client id is NULL");
}
-
- public void encodeControlsFacet(FacesContext context, UIComponent component) throws
IOException {
- UIComponent facet = component.getFacet(CONTROLS_FACET);
- if ((facet != null) && (facet.isRendered())) {
- renderChild(context, facet);
- }
+
+ clientId = clientId + "inplaceValue";
+ Map request = context.getExternalContext().getRequestParameterMap();
+ if (request.containsKey(clientId)) {
+ String newValue = (String) request.get(clientId);
+ inplaceInput.setSubmittedValue(newValue);
}
-
- public boolean isControlsFacetExists(FacesContext context, UIComponent component) {
- UIComponent facet = component.getFacet(CONTROLS_FACET);
- if (facet != null && facet.isRendered()) {
- return true;
- }
- return false;
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object
submittedValue) throws ConverterException {
+ UIInplaceSelect select = null;
+ Converter converter = null;
+ if (component instanceof UIInplaceSelect) {
+ select = (UIInplaceSelect) component;
+ converter = select.getConverter();
}
+ return getConvertedValue(context, component, submittedValue, converter);
+ }
-
- @Override
- protected String getConvertedStringValue(FacesContext context, UIComponent component,
Object value) {
- UIInplaceSelect select = null;
- Converter converter = null;
- if (component instanceof UIInplaceSelect) {
- select = (UIInplaceSelect)component;
- converter = select.getConverter();
- }
- return getConvertedStringValue(context, component, value, converter);
+ public void encodeItems(FacesContext context, UIComponent component) throws
IOException {
+ List values = new ArrayList();
+ ResponseWriter writer = context.getResponseWriter();
+
+ List<SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
+ if (!selectItems.isEmpty()) {
+ for (Iterator<SelectItem> iterator = selectItems.iterator();
iterator.hasNext();) {
+ SelectItem selectItem = iterator.next();
+ String value = getConvertedStringValue(context, component, selectItem.getValue());
+ values.add(value);
+ encodeSuggestion(writer, component, value, RICH_INPLACE_SELECT_CLASSES);
+ }
}
-
- protected Class <? extends UIComponent> getComponentClass() {
- return UIInplaceSelect.class;
+ setValuesList(values);
+ }
+
+ public void encodeControlsFacet(FacesContext context, UIComponent component) throws
IOException {
+ UIComponent facet = component.getFacet(CONTROLS_FACET);
+ if ((facet != null) && (facet.isRendered())) {
+ renderChild(context, facet);
}
+ }
+
+ public boolean isControlsFacetExists(FacesContext context, UIComponent component) {
+ UIComponent facet = component.getFacet(CONTROLS_FACET);
+ if (facet != null && facet.isRendered()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected String getConvertedStringValue(FacesContext context, UIComponent component,
Object value) {
+ UIInplaceSelect select = null;
+ Converter converter = null;
+ if (component instanceof UIInplaceSelect) {
+ select = (UIInplaceSelect) component;
+ converter = select.getConverter();
+ }
+ return getConvertedStringValue(context, component, value, converter);
+ }
+
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIInplaceSelect.class;
+ }
}