labss.generator
Class ComputedSlot
java.lang.Object
|
+--labss.generator.ComputedSlot
- All Implemented Interfaces:
- java.lang.Cloneable, ISlot
- public abstract class ComputedSlot
- extends java.lang.Object
- implements ISlot
Implementazione astratta di ISlot adatta per definire computed slot.
La classe può essere estesa più in generale per implementare slot di tipo foglia.
Un computed slot è una sottoclasse di ComputedSlot e può essere creato
e usato al volo con un codice del tipo:
frame.setSlot("slotName", new ComputedSlot() {
public void export(Writer w, IContext c) throws IOException {
// comportamento definito dal cliente
}
});
Il metodo definito dal cliente dispone di un Writer
e
di un IContext
; ecco alcune cose che si possono fare:
w.write("text"); // scrivere una stringa
c.get("slotName").export(w, c); // scrivere il valore di uno slot
StringWriter sw = new StringWriter();
c.get("slotName").export(sw, c); // scrivere su una stringa il valore di uno slot
Iterator i = c.get("slotName").iterator();
while (i.hasNext()) {
ISlot slot = (ISlot)i.next();
// eseguire del codice su tutti i figli di uno slot
}
- Author:
- Riccardo Solmi
Method Summary |
java.lang.Object |
clone()
Ritorna se stesso. |
java.util.Iterator |
iterator()
Ritorna un iteratore vuoto. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface labss.generator.ISlot |
export |
ComputedSlot
public ComputedSlot()
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Ritorna se stesso.
- Specified by:
clone
in interface ISlot
- Overrides:
clone
in class java.lang.Object
- Returns:
- una copia dello slot
- Throws:
java.lang.CloneNotSupportedException
iterator
public java.util.Iterator iterator()
- Ritorna un iteratore vuoto.
- Specified by:
iterator
in interface ISlot
- Returns:
- un Iterator standard
- See Also:
ISlot.iterator()