Package org.apache.tapestry

Examples of org.apache.tapestry.IComponent


    {
        Inspector inspector = (Inspector) getPage();

        inspector.selectComponent(componentId);

        IComponent newComponent = inspector.getInspectedComponent();

        // If the component is not a BaseComponent then it won't have
        // a template, so switch to the specification view.

        if (!(newComponent instanceof BaseComponent))
View Full Code Here


    public ILink getLink(IRequestCycle cycle, Object parameter)
    {
        Defense.isAssignable(parameter, IComponent.class, "parameter");

        IComponent component = (IComponent) parameter;

        Map parameters = new HashMap();

        parameters.put(ServiceConstants.SERVICE, SERVICE_NAME);
        parameters.put(ServiceConstants.PAGE, component.getPage().getPageName());
        parameters.put(ServiceConstants.COMPONENT, component.getIdPath());

        return _linkFactory.constructLink(cycle, parameters, true);
    }
View Full Code Here

    {
        String pageName = cycle.getParameter(ServiceConstants.PAGE);
        String componentId = cycle.getParameter(ServiceConstants.COMPONENT);

        IPage page = cycle.getPage(pageName);
        IComponent component = page.getNestedComponent(componentId);

        try
        {
            IChartProvider provider = (IChartProvider) component;

            Chart chart = provider.getChart();

            OutputStream output = _response.getOutputStream(new ContentType("image/jpeg"));

            // I've seen a few bits of wierdness (including a JVM crash) inside this code.
            // Hopefully, its a multi-threading problem that can be resolved
            // by synchronizing.

            synchronized (this)
            {
                JPEGEncoder13.encode(chart, 1.0f, output);
            }
        }
        catch (ClassCastException ex)
        {
            _exceptionReporter.reportRequestException("Component " + component.getExtendedId()
                    + " does not implement IChartProvider.", ex);

            return;
        }
        catch (Throwable ex)
View Full Code Here

     *            the description of the column model to be generated
     * @return a table column model based on the provided description
     */
    protected ITableColumnModel generateTableColumnModel(String strDesc)
    {
        IComponent objColumnSettingsContainer = getColumnSettingsContainer();
        IAdvancedTableColumnSource objColumnSource = getColumnSource();

        return getModelSource().generateTableColumnModel(objColumnSource,
                strDesc, this, objColumnSettingsContainer);
    }
View Full Code Here

    {
        if (_sortedComponents != null)
            return _sortedComponents;

        Inspector inspector = (Inspector) getPage();
        IComponent inspectedComponent = inspector.getInspectedComponent();

        // Get a Map of the components and simply return null if there
        // are none.

        Map components = inspectedComponent.getComponents();

        _sortedComponents = new ArrayList(components.values());

        Collections.sort(_sortedComponents, new ComponentComparitor());
View Full Code Here

     *
     **/

    public String getComponentType()
    {
        IComponent container = _component.getContainer();

        IComponentSpecification containerSpecification = container.getSpecification();

        String id = _component.getId();
        IContainedComponent contained = containerSpecification.getComponent(id);

        // Temporary:  An implicit component will not be in the containing
View Full Code Here

    private static class ComponentComparitor implements Comparator
    {
        public int compare(Object left, Object right)
        {
            IComponent leftComponent;
            String leftId;
            IComponent rightComponent;
            String rightId;

            if (left == right)
                return 0;

            leftComponent = (IComponent) left;
            rightComponent = (IComponent) right;

            leftId = leftComponent.getId();
            rightId = rightComponent.getId();

            return leftId.compareTo(rightId);
        }
View Full Code Here

    {
        if (IJSONRender.class.isInstance(render)
                && IComponent.class.isInstance(render))
        {
            IJSONRender json = (IJSONRender) render;
            IComponent component = (IComponent) render;
           
            if (!_parts.contains(component.getId()))
            {
                render.render(_nullWriter, cycle);
                return;
            }
           
View Full Code Here

    private void applyChange(IPage page, PropertyChange change)
    {
        String idPath = change.getComponentPath();

        IComponent component = (idPath == null) ? page : page.getNestedComponent(idPath);

        PropertyUtils.write(component, change.getPropertyName(), change.getNewValue());
    }
View Full Code Here

        PropertyUtils.write(component, change.getPropertyName(), change.getNewValue());
    }

    public void observeChange(ObservedChangeEvent event)
    {
        IComponent component = event.getComponent();
        String propertyName = event.getPropertyName();

        if (_locked)
        {
            _log.error(RecordMessages.recorderLocked(propertyName, component), null, null);
            return;
        }

        PropertyPersistenceStrategy strategy = findStrategy(component, propertyName);

        if (strategy != null)
            strategy.store(_pageName, component.getIdPath(), propertyName, event.getNewValue());
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IComponent

Copyright © 2018 www.massapicom. 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.