
org.efaps.ui.wicket.components.date.UnnestedDatePickers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of efaps-webapp Show documentation
Show all versions of efaps-webapp Show documentation
eFaps WebApp provides a web interface as the User Interface for eFaps
which can be easily expanded and altered.
/*
* Copyright 2003 - 2011 The eFaps Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Revision: $Rev: 6104 $
* Last Changed: $Date: 2011-02-01 17:48:21 -0500 (Tue, 01 Feb 2011) $
* Last Changed By: $Author: [email protected] $
*/
package org.efaps.ui.wicket.components.date;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.AjaxRequestTarget.IJavascriptResponse;
import org.apache.wicket.ajax.AjaxRequestTarget.IListener;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.WebComponent;
/**
* Component is used to contain the DatPickers in case that the picker
* must not be nested in the html dom.
*
* @author The eFaps Team
* @version $Id: UnnestedDatePickers.java 6104 2011-02-01 22:48:21Z [email protected] $
*/
public class UnnestedDatePickers
extends WebComponent implements IListener
{
/**
* Needed for serialization.
*/
private static final long serialVersionUID = 1L;
/**
* Pickers contained in this component.
*/
private final List pickers = new ArrayList();
/**
* @param _wicketId wicket id
*/
public UnnestedDatePickers(final String _wicketId)
{
super(_wicketId);
setOutputMarkupId(true);
}
/**
* Replace the content with our own markup.
*
* @param _markupStream MarkupSream
* @param _openTag Open tag
* @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
* org.apache.wicket.markup.ComponentTag)
*/
@Override
protected void onComponentTagBody(final MarkupStream _markupStream,
final ComponentTag _openTag)
{
final StringBuilder html = new StringBuilder();
for (final DatePickerBehavior picker : this.pickers) {
html.append(picker.getTagBody());
}
replaceComponentTagBody(_markupStream, _openTag, html);
}
/**
* Add a picker to this Component.
* @param _picker picker to add
* @return this
*/
public UnnestedDatePickers addPicker(final DatePickerBehavior _picker)
{
this.pickers.add(_picker);
return this;
}
/**
* The component will be update in any case if registered as listener
* by one of the pickers.
*
* @param _map map
* @param _target AjaxRequestTarget
* @see org.apache.wicket.ajax.AjaxRequestTarget.IListener#onBeforeRespond(java.util.Map,
* org.apache.wicket.ajax.AjaxRequestTarget)
*/
@Override
public void onBeforeRespond(final Map _map,
final AjaxRequestTarget _target)
{
_target.addComponent(this);
}
@Override
public void onAfterRespond(final Map _map,
final IJavascriptResponse _response)
{
// implemented to comply to interface api, but not used
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy