123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- /*
- @ITMillApache2LicenseForJavaFiles@
- */
-
- package com.itmill.toolkit.terminal;
-
- import java.util.EventObject;
-
- /**
- * Interface implemented by all classes that can be painted. Classes
- * implementing this interface know how to output themselves to a UIDL stream
- * and that way describing to the terminal how it should be displayed in the UI.
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 3.0
- */
- public interface Paintable extends java.util.EventListener {
-
- /**
- * <p>
- * Paints the paintable into a UIDL stream. This method creates the UIDL
- * sequence describing it and outputs it to the given UIDL stream.
- * </p>
- *
- * <p>
- * It is called when the contents of the component should be painted in
- * response to the component first being shown or having been altered so
- * that its visual representation is changed.
- * </p>
- *
- * @param target
- * the target UIDL stream where the component should paint
- * itself to.
- * @throws PaintException
- * if the paint operation failed.
- */
- public void paint(PaintTarget target) throws PaintException;
-
- /**
- * Requests that the paintable should be repainted as soon as possible.
- */
- public void requestRepaint();
-
- /**
- * Repaint request event is thrown when the paintable needs to be repainted.
- * This is typically done when the <code>paint</code> method would return
- * dissimilar UIDL from the previous call of the method.
- */
- public class RepaintRequestEvent extends EventObject {
-
- /**
- * Serial generated by eclipse.
- */
- private static final long serialVersionUID = 3256725095530442805L;
-
- /**
- * Constructs a new event.
- *
- * @param source
- * the paintable needing repaint.
- */
- public RepaintRequestEvent(Paintable source) {
- super(source);
- }
-
- /**
- * Gets the paintable needing repainting.
- *
- * @return Paintable for which the <code>paint</code> method will
- * return dissimilar UIDL from the previous call of the method.
- */
- public Paintable getPaintable() {
- return (Paintable) getSource();
- }
- }
-
- /**
- * Listens repaint requests. The <code>repaintRequested</code> method is
- * called when the paintable needs to be repainted. This is typically done
- * when the <code>paint</code> method would return dissimilar UIDL from
- * the previous call of the method.
- */
- public interface RepaintRequestListener {
-
- /**
- * Receives repaint request events.
- *
- * @param event
- * the repaint request event specifying the paintable
- * source.
- */
- public void repaintRequested(RepaintRequestEvent event);
- }
-
- /**
- * Adds repaint request listener. In order to assure that no repaint
- * requests are missed, the new repaint listener should paint the paintable
- * right after adding itself as listener.
- *
- * @param listener
- * the listener to be added.
- */
- public void addListener(RepaintRequestListener listener);
-
- /**
- * Removes repaint request listener.
- *
- * @param listener
- * the listener to be removed.
- */
- public void removeListener(RepaintRequestListener listener);
-
- /**
- * Request sending of repaint events on any further visible changes.
- * Normally the paintable only send up to one repaint request for listeners
- * after paint as the paintable as the paintable assumes that the listeners
- * already know about the repaint need. This method resets the assumtion.
- * Paint implicitly does the assumtion reset functionality implemented by
- * this method.
- * <p>
- * This method is normally used only by the terminals to note paintables
- * about implicit repaints (painting the component without actually invoking
- * paint method).
- * </p>
- */
- public void requestRepaintRequests();
- }
|