Examples of IForm


Examples of org.apache.tapestry.IForm

     * checking {@link Form#isRewinding()}.
     */

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

        if (form.wasPrerendered(writer, this))
            return;

        // 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();

        // If the cycle is rewinding, but the form containing this field is not,
        // then there's no point in doing more work.

        if (!rewinding && cycle.isRewinding())
            return;

        // Used whether rewinding or not.

        String name = form.getElementId(this);

        if (rewinding)
        {
            if (!isDisabled())
            {
View Full Code Here

Examples of org.apache.tapestry.IForm

     * jumps right to the field when the page loads).
     */

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

        if (form.wasPrerendered(writer, this))
            return;

        IValidationDelegate delegate = form.getDelegate();
        IValidator validator = getValidator();

        if (validator == null)
            throw Tapestry.createRequiredParameterException(this, "validator");

View Full Code Here

Examples of org.apache.tapestry.IForm

        // If not wrapped by a Body, then do nothing.

        if (pageRenderSupport == null)
            return;

        IForm form = Form.get(cycle);

        String formName = form.getName();
        String textFieldName = getName();

        String fullName = "document." + formName + "." + textFieldName;

        pageRenderSupport.addInitializationScript(fullName + ".focus();");
View Full Code Here

Examples of org.apache.tapestry.IForm

    protected void processValidatorScript(String scriptPath, IRequestCycle cycle,
            IFormComponent field, Map symbols)
    {
        IEngine engine = field.getPage().getEngine();
        IScriptSource source = engine.getScriptSource();
        IForm form = field.getForm();

        Map finalSymbols = (symbols == null) ? new HashMap() : symbols;

        finalSymbols.put(FIELD_SYMBOL, field);
        finalSymbols.put(FORM_SYMBOL, form);
        finalSymbols.put(VALIDATOR_SYMBOL, this);

        Resource location = new ClasspathResource(engine.getClassResolver(), scriptPath);

        IScript script = source.getScript(location);

        // If there's an error, report it against the field (this validator object doesn't
        // have a location).

        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, field);

        script.execute(cycle, pageRenderSupport, finalSymbols);

        String functionName = (String) finalSymbols.get(FUNCTION_SYMBOL);

        form.addEventHandler(FormEventType.SUBMIT, functionName);
    }
View Full Code Here

Examples of org.apache.tapestry.IForm

     *          The event that started it all.
     */
    public void invokeFormListeners(FormSupport formSupport, final IRequestCycle cycle,
            BrowserEvent event)
    {
        IForm component = formSupport.getForm();
        String id = component.getId();
       
        List listeners = getFormEvents(id, event);
       
        for (int i=0; i < listeners.size(); i++) {
            EventBoundListener eventListener = (EventBoundListener)listeners.get(i);
           
            final IComponent container =
                (component.getContainer() == null) ? component : component.getContainer();
           
            final IActionListener listener =
                container.getListeners().getListener(eventListener.getMethodName());
           
            // defer execution until after form is done rewinding
            component.addDeferredRunnable(new Runnable()
            {
                public void run()
                {
                    _invoker.invokeListener(listener, container, cycle);
                }
View Full Code Here

Examples of org.apache.tapestry.IForm

public abstract class ImageSubmit extends Submit
{
    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        if (form.wasPrerendered(writer, this))
            return;

        boolean rewinding = form.isRewinding();

        String nameOverride = getNameOverride();

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

        setName(name);
View Full Code Here

Examples of org.apache.tapestry.IForm

public abstract class Upload extends AbstractFormComponent
{
    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        if (form.wasPrerendered(writer, this))
            return;

        String name = form.getElementId(this);

        if (form.isRewinding())
        {
            if (!isDisabled())
            {
                IUploadFile file = getDecoder().getFileUpload(name);

                setFile(file);
            }

            return;
        }

        // Force the form to use the correct encoding type for
        // file uploads.

        form.setEncodingType("multipart/form-data");

        writer.beginEmpty("input");
        writer.attribute("type", "file");
        writer.attribute("name", name);
View Full Code Here

Examples of org.apache.tapestry.IForm

     * submitted (by checking {@link IForm#isRewinding()}.
     */

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

        if (form.wasPrerendered(writer, this))
            return;

        if (cycle.getAttribute(ATTRIBUTE_NAME) != null)
            throw new ApplicationRuntimeException(Tapestry.getMessage("Select.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);

        if (_rewinding)
        {
View Full Code Here

Examples of org.apache.tapestry.IForm

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        if (cycle.isRewinding())
            return;

        IForm form = TapestryUtils.getForm(cycle, this);

        IFormComponent field = getField();

        if (field != null)
            form.prerenderField(writer, field, getLocation());

        String displayName = getDisplayName();

        if (displayName == null)
        {
            if (field == null)
                throw Tapestry.createRequiredParameterException(this, "field");

            displayName = field.getDisplayName();

            if (displayName == null)
                throw new BindingException(ValidMessages.noDisplayName(this, field), this, null,
                        getBinding("field"), null);
        }

        IValidationDelegate delegate = form.getDelegate();

        delegate.writeLabelPrefix(field, writer, cycle);

        writer.print(displayName, getRaw());
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);

        if (form.wasPrerendered(writer, this))
            return;

        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())
        {
            PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);

            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, pageRenderSupport, 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("&nbsp;");

            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.getParameter(name);
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.