Examples of IForm


Examples of org.apache.tapestry.IForm

                throw new BindingException(msg, this, null, getBinding("field"), null);
            }
        }

        IForm form = Form.get(cycle);

        if (form == null)
        {
            String msg = Tapestry.getMessage("FieldLabel.must-be-contained-by-form");

            throw new ApplicationRuntimeException(msg, this, null, null);
        }

        IValidationDelegate delegate = form.getDelegate();

        if (delegate == null)
        {
            String msg =
                Tapestry.format("FieldLabel.no-delegate", getExtendedId(), form.getExtendedId());

            throw new ApplicationRuntimeException(msg, this, null, null);
        }

        delegate.writeLabelPrefix(field, writer, cycle);
View Full Code Here

Examples of org.apache.tapestry.IForm

        _script = source.getScript(location);
    }

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        String name = form.getElementId(this);

        String format = getFormat();

        if (format == null)
            format = "dd MMM yyyy";

        SimpleDateFormat formatter = new SimpleDateFormat(format, getPage().getLocale());

        boolean disabled = isDisabled();

        if (!cycle.isRewinding())
        {
            Body body = Body.get(cycle);

            if (body == null)
                throw new ApplicationRuntimeException(
                    Tapestry.format("must-be-contained-by-body", "DatePicker"),
                    this,
                    null,
                    null);

            Locale locale = getPage().getLocale();
            DateFormatSymbols dfs = new DateFormatSymbols(locale);
            Calendar cal = Calendar.getInstance(locale);

            Date value = getValue();

            Map symbols = new HashMap();

            symbols.put(SYM_NAME, name);
            symbols.put(SYM_FORMAT, format);
            symbols.put(SYM_INCL_WEEK, getIncludeWeek() ? Boolean.TRUE : Boolean.FALSE);

            symbols.put(SYM_MONTHNAMES, makeStringList(dfs.getMonths(), 0, 12));
            symbols.put(SYM_SHORT_MONTHNAMES, makeStringList(dfs.getShortMonths(), 0, 12));
            symbols.put(SYM_WEEKDAYNAMES, makeStringList(dfs.getWeekdays(), 1, 8));
            symbols.put(SYM_SHORT_WEEKDAYNAMES, makeStringList(dfs.getShortWeekdays(), 1, 8));
            symbols.put(SYM_FIRSTDAYINWEEK, new Integer(cal.getFirstDayOfWeek() - 1));
            symbols.put(SYM_MINDAYSINFIRSTWEEK, new Integer(cal.getMinimalDaysInFirstWeek()));
            symbols.put(SYM_FORMNAME, form.getName());
            symbols.put(SYM_VALUE, value);

            _script.execute(cycle, body, symbols);

            writer.beginEmpty("input");
            writer.attribute("type", "text");
            writer.attribute("name", name);
            writer.attribute("title", formatter.toLocalizedPattern());

            if (value != null)
                writer.attribute("value", formatter.format(value));

            if (disabled)
                writer.attribute("disabled", "disabled");

            renderInformalParameters(writer, cycle);
           
            writer.printRaw(" ");

            if (!disabled)
            {
                writer.begin("a");
                writer.attribute("href", (String) symbols.get(SYM_BUTTONONCLICKHANDLER));
            }

            IAsset icon = getIcon();

            writer.beginEmpty("img");
            writer.attribute("src", icon.buildURL(cycle));
            writer.attribute("border", 0);

            if (!disabled)
                writer.end(); // <a>

        }

        if (form.isRewinding())
        {
            if (disabled)
                return;

            String textValue = cycle.getRequestContext().getParameter(name);
View Full Code Here

Examples of org.apache.tapestry.IForm

     *
     **/

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        if (cycle.getAttribute(ATTRIBUTE_NAME) != null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("RadioGroup.may-not-nest"),
                this,
                null,
                null);

        // It isn't enough to know whether the cycle in general is rewinding, need to know
        // specifically if the form which contains this component is rewinding.

        _rewinding = form.isRewinding();

        // Used whether rewinding or not.

        String name = form.getElementId(this);

        cycle.setAttribute(ATTRIBUTE_NAME, this);

        // When rewinding, find out which (if any) radio was selected by
        // the user.
View Full Code Here

Examples of org.apache.tapestry.IForm

     *
     **/

    public IForm getForm(IRequestCycle cycle)
    {
        IForm result = Form.get(cycle);

        if (result == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("AbstractFormComponent.must-be-contained-by-form"),
                this,
                null,
                null);

        setForm(result);

        IValidationDelegate delegate = result.getDelegate();

        if (delegate != null)
            delegate.setFormComponent(this);

        return result;
View Full Code Here

Examples of org.apache.tapestry.IForm

     *
     **/

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);
   
        // It isn't enough to know whether the cycle in general is rewinding, need to know
        // specifically if the form which contains this component is rewinding.

        boolean rewinding = form.isRewinding();

        // Used whether rewinding or not.

        String name = form.getElementId(this);

        if (rewinding)
        {
          if (!isDisabled())
              setValue(cycle.getRequestContext().getParameter(name));
View Full Code Here

Examples of org.apache.tapestry.IForm

    public abstract IBinding getSelectedBinding();

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        boolean rewinding = form.isRewinding();

        String nameOverride = getNameOverride();

        String name =
            nameOverride == null ? form.getElementId(this) : form.getElementId(this, nameOverride);

        if (rewinding)
        {
            // If disabled, do nothing.
View Full Code Here

Examples of org.apache.tapestry.IForm

public abstract class FormConditional extends AbstractFormComponent
{

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        boolean cycleRewinding = cycle.isRewinding();

        // If the cycle is rewinding, but not this particular form,
        // then do nothing (don't even render the body).

        if (cycleRewinding && !form.isRewinding())
            return;

        String name = form.getElementId(this);

        boolean condition = getCondition(cycle, form, name);

        // call listener
        IActionListener listener = getListener();
View Full Code Here

Examples of org.apache.tapestry.IForm

     * binding and render's its wrapped elements.
     */
    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        // form may be null if component is not located in a form
        IForm form = (IForm) cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE);

        // If the cycle is rewinding, but not this particular form,
        // then do nothing (don't even render the body).
        boolean cycleRewinding = cycle.isRewinding();
        if (cycleRewinding && form != null && !form.isRewinding())
            return;

        // Get the data to be iterated upon. Store in form if needed.
        Iterator dataSource = getData(cycle, form);

View Full Code Here

Examples of org.apache.tapestry.IForm

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        boolean cycleRewinding = cycle.isRewinding();

        // form may be null if component is not located in a form
        IForm form = (IForm) cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE);

        // If the cycle is rewinding, but not this particular form,
        // then do nothing (don't even render the body).
        if (cycleRewinding && form != null && !form.isRewinding())
            return;

        // get the condition. work with a hidden field if necessary
        _conditionValue = evaluateCondition(cycle, form, cycleRewinding);
        _rendering = true;
View Full Code Here

Examples of org.apache.tapestry.IForm

     */
    protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        boolean disabled = isDisabled();

        IForm form = getForm();
        String name = getName();

        if (!disabled)
        {
            PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.