All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.jaxx.runtime.JAXXObject Maven / Gradle / Ivy

There is a newer version: 3.1.5
Show newest version
/*
 * #%L
 * JAXX :: Runtime Spi
 * %%
 * Copyright (C) 2008 - 2017 Code Lutin, Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * .
 * #L%
 */
package org.nuiton.jaxx.runtime;

import java.awt.Container;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Map;

/**
 * The JAXXObject interface is implemented by all classes
 * produced by the JAXX compiler.
 */
public interface JAXXObject extends JAXXContext, Serializable {

    /**
     * Retrieves an object defined in an XML tag by its ID.
     *
     * @param id the id of the component to retrieve
     * @return the object
     */
    Object getObjectById(String id);

    /**
     * Pretrieves the dictonary of knwon objects indexed by their ids.
     *
     * @return the dictonary of objects.
     */
    Map get$objectMap();

    /** @return the {@link JAXXContext} attached to the object */
    JAXXContext getDelegateContext();

    /** @return all the databinding registred on the jaxx object */
    JAXXBinding[] getDataBindings();

    /**
     * Register a new binding in the jaxx object.
     *
     * @param binding the binding to add
     */
    void registerDataBinding(JAXXBinding binding);

    /**
     * Apply the data bind by name and then process it.
     *
     * @param id the id of the databinding
     */
    void applyDataBinding(String id);

    /**
     * Processes a data binding by name.  Data binding names are comprised of an object ID and a property name:
     * for example, the data binding in the tag <JLabel id='label' text='{foo.getText()}'/> is
     * named "label.text".  Processing a data binding causes it to reevaluate its expression, in this
     * case foo.getText().
     *
     * @param dest the name of the data binding to run
     */
    void processDataBinding(String dest);

    /**
     * Processes a data binding by name.  Data binding names are comprised of an object ID and a property name:
     * for example, the data binding in the tag <JLabel id='label' text='{foo.getText()}'/> is
     * named "label.text".  Processing a data binding causes it to reevaluate its expression, in this
     * case foo.getText().
     *
     * @param dest  the name of the data binding to run
     * @param force flag to force binding, even if already on run
     */
    void processDataBinding(String dest, boolean force);

    /**
     * Remove a databinding by name.
     *
     * @param id the name of databinding to remove
     */
    void removeDataBinding(String id);

    /**
     * Obtain a binding given his id.
     *
     * @param bindingId the id of the binding
     * @return the binding, or {@code null} if not found.
     * @see JAXXBinding
     * @since 2.4.2
     */
    JAXXBinding getDataBinding(String bindingId);

    /**
     * All JAXXObject implements are capable of broadcasting PropertyChangeEvent, and
     * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime,
     * to trigger these events.
     *
     * @param name     the name of the property which changed
     * @param oldValue the old value of the property
     * @param newValue the new value of the property
     */
    void firePropertyChange(String name, Object oldValue, Object newValue);

    /**
     * Register a general {@link PropertyChangeListener}.
     *
     * @param listener the listener to register
     */
    void addPropertyChangeListener(PropertyChangeListener listener);

    /**
     * Register a  {@link PropertyChangeListener}. for the given {@code propertyName}.
     *
     * @param property the property name to listen
     * @param listener the listener to register
     */
    void addPropertyChangeListener(String property, PropertyChangeListener listener);

    /**
     * Unregister a general {@link PropertyChangeListener}.
     *
     * @param listener the listener to unregister
     */
    void removePropertyChangeListener(PropertyChangeListener listener);

    /**
     * Unregister a  {@link PropertyChangeListener}. for the given {@code propertyName}.
     *
     * @param property the property name to listen
     * @param listener the listener to unregister
     */
    void removePropertyChangeListener(String property, PropertyChangeListener listener);

    /**
     * Return parent's container corresponding to the Class clazz
     *
     * @param    type of container to obtain from context
     * @param clazz clazz desired
     * @return parent's container
     */
     O getParentContainer(Class clazz);

    /**
     * Return parent's container corresponding to the Class clazz
     *
     * @param    type of container to obtain from context
     * @param top   the top container
     * @param clazz desired
     * @return parent's container
     */
     O getParentContainer(Object top, Class clazz);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy