You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Container.java 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.data;
  5. import java.io.Serializable;
  6. import java.util.Collection;
  7. /**
  8. * <p>
  9. * A specialized set of identified Items. Basically the Container is a set of
  10. * Items, but it imposes certain constraints on its contents. These constraints
  11. * state the following:
  12. * </p>
  13. *
  14. * <ul>
  15. * <li>All Items in the Container must include the same number of Properties
  16. * <li>All Items in the Container must include the same Property ID sets (see
  17. * {@link Item#getItemPropertyIds()}).
  18. * <li>all Properties in the Items corresponding to the same Property ID must
  19. * have the same data type.
  20. * <li>All Items within a container are uniquely identified by their non-null
  21. * ids
  22. * </ul>
  23. *
  24. * <p>
  25. * The Container can be visualized as a representation of a relational database
  26. * table. Each Item in the Container represents a row in the table, and all
  27. * cells in a column (identified by a Property ID) have the same data type. Note
  28. * that as with the cells in a database table, no Property in a Container may be
  29. * empty, though they may contain <code>null</code> values.
  30. * </p>
  31. *
  32. * <p>
  33. * Note that though uniquely identified, the Items in a Container are not
  34. * neccessarily {@link Container.Ordered ordered}or {@link Container.Indexed
  35. * indexed}.
  36. * </p>
  37. *
  38. * <p>
  39. * <img src=doc-files/Container_full.gif>
  40. * </p>
  41. *
  42. * <p>
  43. * The Container interface is split to several subinterfaces so that a class can
  44. * implement only the ones it needs.
  45. * </p>
  46. *
  47. * @author IT Mill Ltd
  48. * @version
  49. * @VERSION@
  50. * @since 3.0
  51. */
  52. public interface Container extends Serializable {
  53. /**
  54. * Gets the Item with the given Item ID from the Container. If the Container
  55. * does not contain the requested Item, <code>null</code> is returned.
  56. *
  57. * @param itemId
  58. * ID of the Item to retrieve
  59. * @return the Item with the given ID or <code>null</code> if the Item is
  60. * not found in the Container
  61. */
  62. public Item getItem(Object itemId);
  63. /**
  64. * Gets the ID's of all Properties stored in the Container. The ID's are
  65. * returned as a unmodifiable collection.
  66. *
  67. * @return unmodifiable collection of Property IDs
  68. */
  69. public Collection<?> getContainerPropertyIds();
  70. /**
  71. * Gets the ID's of all Items stored in the Container. The ID's are returned
  72. * as a unmodifiable collection.
  73. *
  74. * @return unmodifiable collection of Item IDs
  75. */
  76. public Collection<?> getItemIds();
  77. /**
  78. * Gets the Property identified by the given itemId and propertyId from the
  79. * Container. If the Container does not contain the Property,
  80. * <code>null</code> is returned.
  81. *
  82. * @param itemId
  83. * ID of the Item which contains the Property
  84. * @param propertyId
  85. * ID of the Property to retrieve
  86. * @return Property with the given ID or <code>null</code>
  87. */
  88. public Property getContainerProperty(Object itemId, Object propertyId);
  89. /**
  90. * Gets the data type of all Properties identified by the given Property ID.
  91. *
  92. * @param propertyId
  93. * ID identifying the Properties
  94. * @return data type of the Properties
  95. */
  96. public Class<?> getType(Object propertyId);
  97. /**
  98. * Gets the number of Items in the Container.
  99. *
  100. * @return number of Items in the Container
  101. */
  102. public int size();
  103. /**
  104. * Tests if the Container contains the specified Item
  105. *
  106. * @param itemId
  107. * ID the of Item to be tested
  108. * @return boolean indicating if the Container holds the specified Item
  109. */
  110. public boolean containsId(Object itemId);
  111. /**
  112. * Creates a new Item with the given ID into the Container. The new
  113. * <p>
  114. * Item is returned, and it is ready to have its Properties modified.
  115. * Returns <code>null</code> if the operation fails or the Container already
  116. * contains a Item with the given ID.
  117. * </p>
  118. *
  119. * <p>
  120. * This functionality is optional.
  121. * </p>
  122. *
  123. * @param itemId
  124. * ID of the Item to be created
  125. * @return Created new Item, or <code>null</code> in case of a failure
  126. */
  127. public Item addItem(Object itemId) throws UnsupportedOperationException;
  128. /**
  129. * Creates a new Item into the Container, and assign it an automatic ID.
  130. *
  131. * <p>
  132. * The new ID is returned, or <code>null</code> if the operation fails.
  133. * After a successful call you can use the {@link #getItem(Object ItemId)
  134. * <code>getItem</code>}method to fetch the Item.
  135. * </p>
  136. *
  137. * <p>
  138. * This functionality is optional.
  139. * </p>
  140. *
  141. * @return ID of the newly created Item, or <code>null</code> in case of a
  142. * failure
  143. */
  144. public Object addItem() throws UnsupportedOperationException;
  145. /**
  146. * Removes the Item identified by <code>ItemId</code> from the Container.
  147. * This functionality is optional.
  148. *
  149. * @param itemId
  150. * ID of the Item to remove
  151. * @return <code>true</code> if the operation succeeded, <code>false</code>
  152. * if not
  153. */
  154. public boolean removeItem(Object itemId)
  155. throws UnsupportedOperationException;
  156. /**
  157. * Adds a new Property to all Items in the Container. The Property ID, data
  158. * type and default value of the new Property are given as parameters.
  159. *
  160. * This functionality is optional.
  161. *
  162. * @param propertyId
  163. * ID of the Property
  164. * @param type
  165. * Data type of the new Property
  166. * @param defaultValue
  167. * The value all created Properties are initialized to
  168. * @return <code>true</code> if the operation succeeded, <code>false</code>
  169. * if not
  170. */
  171. public boolean addContainerProperty(Object propertyId, Class<?> type,
  172. Object defaultValue) throws UnsupportedOperationException;
  173. /**
  174. * Removes a Property specified by the given Property ID from the Container.
  175. * Note that the Property will be removed from all Items in the Container.
  176. *
  177. * This functionality is optional.
  178. *
  179. * @param propertyId
  180. * ID of the Property to remove
  181. * @return <code>true</code> if the operation succeeded, <code>false</code>
  182. * if not
  183. */
  184. public boolean removeContainerProperty(Object propertyId)
  185. throws UnsupportedOperationException;
  186. /**
  187. * Removes all Items from the Container.
  188. *
  189. * <p>
  190. * Note that Property ID and type information is preserved. This
  191. * functionality is optional.
  192. * </p>
  193. *
  194. * @return <code>true</code> if the operation succeeded, <code>false</code>
  195. * if not
  196. */
  197. public boolean removeAllItems() throws UnsupportedOperationException;
  198. /**
  199. * Interface for Container classes whose Items can be traversed in order.
  200. */
  201. public interface Ordered extends Container {
  202. /**
  203. * Gets the ID of the Item following the Item that corresponds to
  204. * <code>itemId</code>. If the given Item is the last or not found in
  205. * the Container, <code>null</code> is returned.
  206. *
  207. * @param itemId
  208. * ID of an Item in the Container
  209. * @return ID of the next Item or <code>null</code>
  210. */
  211. public Object nextItemId(Object itemId);
  212. /**
  213. * Gets the ID of the Item preceding the Item that corresponds to
  214. * <code>itemId</code>. If the given Item is the first or not found in
  215. * the Container, <code>null</code> is returned.
  216. *
  217. * @param itemId
  218. * ID of an Item in the Container
  219. * @return ID of the previous Item or <code>null</code>
  220. */
  221. public Object prevItemId(Object itemId);
  222. /**
  223. * Gets the ID of the first Item in the Container.
  224. *
  225. * @return ID of the first Item in the Container
  226. */
  227. public Object firstItemId();
  228. /**
  229. * Gets the ID of the last Item in the Container..
  230. *
  231. * @return ID of the last Item in the Container
  232. */
  233. public Object lastItemId();
  234. /**
  235. * Tests if the Item corresponding to the given Item ID is the first
  236. * Item in the Container.
  237. *
  238. * @param itemId
  239. * ID of an Item in the Container
  240. * @return <code>true</code> if the Item is first in the Container,
  241. * <code>false</code> if not
  242. */
  243. public boolean isFirstId(Object itemId);
  244. /**
  245. * Tests if the Item corresponding to the given Item ID is the last Item
  246. * in the Container.
  247. *
  248. * @return <code>true</code> if the Item is last in the Container,
  249. * <code>false</code> if not
  250. */
  251. public boolean isLastId(Object itemId);
  252. /**
  253. * Adds new item after the given item.
  254. * <p>
  255. * Adding an item after null item adds the item as first item of the
  256. * ordered container.
  257. * </p>
  258. *
  259. * @param previousItemId
  260. * Id of the previous item in ordered container.
  261. * @return Returns item id the the created new item or null if the
  262. * operation fails.
  263. */
  264. public Object addItemAfter(Object previousItemId)
  265. throws UnsupportedOperationException;
  266. /**
  267. * Adds new item after the given item.
  268. * <p>
  269. * Adding an item after null item adds the item as first item of the
  270. * ordered container.
  271. * </p>
  272. *
  273. * @param previousItemId
  274. * Id of the previous item in ordered container.
  275. * @param newItemId
  276. * Id of the new item to be added.
  277. * @return Returns new item or null if the operation fails.
  278. */
  279. public Item addItemAfter(Object previousItemId, Object newItemId)
  280. throws UnsupportedOperationException;
  281. }
  282. /** Interface for Container classes whose Items can be sorted. */
  283. public interface Sortable extends Ordered {
  284. /**
  285. * Sort method.
  286. *
  287. * Sorts the container items.
  288. *
  289. * @param propertyId
  290. * Array of container property IDs, which values are used to
  291. * sort the items in container as primary, secondary, ...
  292. * sorting criterion. All of the item IDs must be in the
  293. * collection returned by
  294. * <code>getSortableContainerPropertyIds</code>
  295. * @param ascending
  296. * Array of sorting order flags corresponding to each
  297. * property ID used in sorting. If this array is shorter than
  298. * propertyId array, ascending order is assumed for items
  299. * where the order is not specified. Use <code>true</code> to
  300. * sort in ascending order, <code>false</code> to use
  301. * descending order.
  302. */
  303. void sort(Object[] propertyId, boolean[] ascending);
  304. /**
  305. * Gets the container property IDs, which can be used to sort the item.
  306. *
  307. * @return The sortable field ids.
  308. */
  309. Collection<?> getSortableContainerPropertyIds();
  310. }
  311. /** Interface for Container classes whose Items can be indexed. */
  312. public interface Indexed extends Ordered {
  313. /**
  314. * Gets the index of the Item corresponding to the itemId. The following
  315. * is <code>true</code> for the returned index: 0 <= index < size().
  316. *
  317. * @param itemId
  318. * ID of an Item in the Container
  319. * @return index of the Item, or -1 if the Container does not include
  320. * the Item
  321. */
  322. public int indexOfId(Object itemId);
  323. /**
  324. * Gets the ID of an Item by an index number.
  325. *
  326. * @param index
  327. * Index of the requested id in the Container
  328. * @return ID of the Item in the given index
  329. */
  330. public Object getIdByIndex(int index);
  331. /**
  332. * Adds new item at given index.
  333. * <p>
  334. * The indexes of the item currently in the given position and all the
  335. * following items are incremented.
  336. * </p>
  337. *
  338. * @param index
  339. * Index to add the new item.
  340. * @return Returns item id the the created new item or null if the
  341. * operation fails.
  342. */
  343. public Object addItemAt(int index) throws UnsupportedOperationException;
  344. /**
  345. * Adds new item at given index.
  346. * <p>
  347. * The indexes of the item currently in the given position and all the
  348. * following items are incremented.
  349. * </p>
  350. *
  351. * @param index
  352. * Index to add the new item.
  353. * @param newItemId
  354. * Id of the new item to be added.
  355. * @return Returns new item or null if the operation fails.
  356. */
  357. public Item addItemAt(int index, Object newItemId)
  358. throws UnsupportedOperationException;
  359. }
  360. /**
  361. * <p>
  362. * Interface for <code>Container</code> classes whose Items can be arranged
  363. * hierarchically. This means that the Items in the container belong in a
  364. * tree-like structure, with the following quirks:
  365. * </p>
  366. *
  367. * <ul>
  368. * <li>The Item structure may have more than one root elements
  369. * <li>The Items in the hierarchy can be declared explicitly to be able or
  370. * unable to have children.
  371. * </ul>
  372. */
  373. public interface Hierarchical extends Container {
  374. /**
  375. * Gets the IDs of all Items that are children of the specified Item.
  376. * The returned collection is unmodifiable.
  377. *
  378. * @param itemId
  379. * ID of the Item whose children the caller is interested in
  380. * @return An unmodifiable {@link java.util.Collection collection}
  381. * containing the IDs of all other Items that are children in
  382. * the container hierarchy
  383. */
  384. public Collection<?> getChildren(Object itemId);
  385. /**
  386. * Gets the ID of the parent Item of the specified Item.
  387. *
  388. * @param itemId
  389. * ID of the Item whose parent the caller wishes to find out.
  390. * @return the ID of the parent Item. Will be <code>null</code> if the
  391. * specified Item is a root element.
  392. */
  393. public Object getParent(Object itemId);
  394. /**
  395. * Gets the IDs of all Items in the container that don't have a parent.
  396. * Such items are called <code>root</code> Items. The returned
  397. * collection is unmodifiable.
  398. *
  399. * @return An unmodifiable {@link java.util.Collection collection}
  400. * containing IDs of all root elements of the container
  401. */
  402. public Collection<?> rootItemIds();
  403. /**
  404. * <p>
  405. * Sets the parent of an Item. The new parent item must exist and be
  406. * able to have children. (
  407. * <code>{@link #areChildrenAllowed(Object)} == true</code> ). It is
  408. * also possible to detach a node from the hierarchy (and thus make it
  409. * root) by setting the parent <code>null</code>.
  410. * </p>
  411. *
  412. * <p>
  413. * This operation is optional.
  414. * </p>
  415. *
  416. * @param itemId
  417. * ID of the item to be set as the child of the Item
  418. * identified with <code>newParentId</code>
  419. * @param newParentId
  420. * ID of the Item that's to be the new parent of the Item
  421. * identified with <code>itemId</code>
  422. * @return <code>true</code> if the operation succeeded,
  423. * <code>false</code> if not
  424. */
  425. public boolean setParent(Object itemId, Object newParentId)
  426. throws UnsupportedOperationException;
  427. /**
  428. * Tests if the Item with given ID can have children.
  429. *
  430. * @param itemId
  431. * ID of the Item in the container whose child capability is
  432. * to be tested
  433. * @return <code>true</code> if the specified Item exists in the
  434. * Container and it can have children, <code>false</code> if
  435. * it's not found from the container or it can't have children.
  436. */
  437. public boolean areChildrenAllowed(Object itemId);
  438. /**
  439. * <p>
  440. * Sets the given Item's capability to have children. If the Item
  441. * identified with <code>itemId</code> already has children and
  442. * <code>{@link #areChildrenAllowed(Object)}</code> is false this method
  443. * fails and <code>false</code> is returned.
  444. * </p>
  445. * <p>
  446. * The children must be first explicitly removed with
  447. * {@link #setParent(Object itemId, Object newParentId)}or
  448. * {@link com.vaadin.data.Container#removeItem(Object itemId)}.
  449. * </p>
  450. *
  451. * <p>
  452. * This operation is optional. If it is not implemented, the method
  453. * always returns <code>false</code>.
  454. * </p>
  455. *
  456. * @param itemId
  457. * ID of the Item in the container whose child capability is
  458. * to be set
  459. * @param areChildrenAllowed
  460. * boolean value specifying if the Item can have children or
  461. * not
  462. * @return <code>true</code> if the operation succeeded,
  463. * <code>false</code> if not
  464. */
  465. public boolean setChildrenAllowed(Object itemId,
  466. boolean areChildrenAllowed)
  467. throws UnsupportedOperationException;
  468. /**
  469. * Tests if the Item specified with <code>itemId</code> is a root Item.
  470. * The hierarchical container can have more than one root and must have
  471. * at least one unless it is empty. The {@link #getParent(Object itemId)}
  472. * method always returns <code>null</code> for root Items.
  473. *
  474. * @param itemId
  475. * ID of the Item whose root status is to be tested
  476. * @return <code>true</code> if the specified Item is a root,
  477. * <code>false</code> if not
  478. */
  479. public boolean isRoot(Object itemId);
  480. /**
  481. * <p>
  482. * Tests if the Item specified with <code>itemId</code> has child Items
  483. * or if it is a leaf. The {@link #getChildren(Object itemId)} method
  484. * always returns <code>null</code> for leaf Items.
  485. * </p>
  486. *
  487. * <p>
  488. * Note that being a leaf does not imply whether or not an Item is
  489. * allowed to have children.
  490. * </p>
  491. * .
  492. *
  493. * @param itemId
  494. * ID of the Item to be tested
  495. * @return <code>true</code> if the specified Item has children,
  496. * <code>false</code> if not (is a leaf)
  497. */
  498. public boolean hasChildren(Object itemId);
  499. }
  500. /**
  501. * Interface is implemented by containers that allow reducing their visible
  502. * contents with set of filters.
  503. *
  504. * When a set of filters are set, only items that match the filters are
  505. * included in the visible contents of the container. Still new items that
  506. * do not match filters can be added to the container. Multiple filters can
  507. * be added and the container remembers the state of the filters. When
  508. * multiple filters are added, all filters must match for an item to be
  509. * visible in the container.
  510. *
  511. * When an {@link com.vaadin.data.Ordered} or
  512. * {@link com.vaadin.data.Indexed} container is filtered, all
  513. * operations of these interfaces should only use the filtered contents and
  514. * the filtered indices to the container.
  515. *
  516. * Adding items (if supported) to a filtered
  517. * {@link com.vaadin.data.Ordered} or
  518. * {@link com.vaadin.data.Indexed} container should insert them
  519. * immediately after the indicated visible item. The unfiltered position of
  520. * items added at index 0, at index
  521. * {@link com.vaadin.data.Container#size()} or at an undefined
  522. * position is up to the implementation.
  523. *
  524. * @since 5.0
  525. */
  526. public interface Filterable extends Container, Serializable {
  527. /**
  528. * Add a filter for given property.
  529. *
  530. * Only items where given property for which toString() contains or
  531. * starts with given filterString are visible in the container.
  532. *
  533. * @param propertyId
  534. * Property for which the filter is applied to.
  535. * @param filterString
  536. * String that must match contents of the property
  537. * @param ignoreCase
  538. * Determine if the casing can be ignored when comparing
  539. * strings.
  540. * @param onlyMatchPrefix
  541. * Only match prefixes; no other matches are included.
  542. */
  543. public void addContainerFilter(Object propertyId, String filterString,
  544. boolean ignoreCase, boolean onlyMatchPrefix);
  545. /** Remove all filters from all properties. */
  546. public void removeAllContainerFilters();
  547. /** Remove all filters from given property. */
  548. public void removeContainerFilters(Object propertyId);
  549. }
  550. /**
  551. * Interface implemented by viewer classes capable of using a Container as a
  552. * data source.
  553. */
  554. public interface Viewer extends Serializable {
  555. /**
  556. * Sets the Container that serves as the data source of the viewer.
  557. *
  558. * @param newDataSource
  559. * The new data source Item
  560. */
  561. public void setContainerDataSource(Container newDataSource);
  562. /**
  563. * Gets the Container serving as the data source of the viewer.
  564. *
  565. * @return data source Container
  566. */
  567. public Container getContainerDataSource();
  568. }
  569. /**
  570. * <p>
  571. * Interface implemented by the editor classes supporting editing the
  572. * Container. Implementing this interface means that the Container serving
  573. * as the data source of the editor can be modified through it.
  574. * </p>
  575. * <p>
  576. * Note that not implementing the <code>Container.Editor</code> interface
  577. * does not restrict the class from editing the Container contents
  578. * internally.
  579. * </p>
  580. */
  581. public interface Editor extends Container.Viewer, Serializable {
  582. }
  583. /* Contents change event */
  584. /**
  585. * An <code>Event</code> object specifying the Container whose Item set has
  586. * changed.
  587. */
  588. public interface ItemSetChangeEvent extends Serializable {
  589. /**
  590. * Gets the Property where the event occurred.
  591. *
  592. * @return source of the event
  593. */
  594. public Container getContainer();
  595. }
  596. /** Container Item set change listener interface. */
  597. public interface ItemSetChangeListener extends Serializable {
  598. /**
  599. * Lets the listener know a Containers Item set has changed.
  600. *
  601. * @param event
  602. * change event text
  603. */
  604. public void containerItemSetChange(Container.ItemSetChangeEvent event);
  605. }
  606. /**
  607. * The interface for adding and removing <code>ItemSetChangeEvent</code>
  608. * listeners. By implementing this interface a class explicitly announces
  609. * that it will generate a <code>ItemSetChangeEvent</code> when its contents
  610. * are modified.
  611. * <p>
  612. * Note: The general Java convention is not to explicitly declare that a
  613. * class generates events, but to directly define the
  614. * <code>addListener</code> and <code>removeListener</code> methods. That
  615. * way the caller of these methods has no real way of finding out if the
  616. * class really will send the events, or if it just defines the methods to
  617. * be able to implement an interface.
  618. * </p>
  619. */
  620. public interface ItemSetChangeNotifier extends Serializable {
  621. /**
  622. * Adds an Item set change listener for the object.
  623. *
  624. * @param listener
  625. * listener to be added
  626. */
  627. public void addListener(Container.ItemSetChangeListener listener);
  628. /**
  629. * Removes the Item set change listener from the object.
  630. *
  631. * @param listener
  632. * listener to be removed
  633. */
  634. public void removeListener(Container.ItemSetChangeListener listener);
  635. }
  636. /* Property set change event */
  637. /**
  638. * An <code>Event</code> object specifying the Container whose Property set
  639. * has changed.
  640. */
  641. public interface PropertySetChangeEvent extends Serializable {
  642. /**
  643. * Retrieves the Container whose contents have been modified.
  644. *
  645. * @return Source Container of the event.
  646. */
  647. public Container getContainer();
  648. }
  649. /**
  650. * The listener interface for receiving <code>PropertySetChangeEvent</code>
  651. * objects.
  652. */
  653. public interface PropertySetChangeListener extends Serializable {
  654. /**
  655. * Notifies this listener that the Containers contents has changed.
  656. *
  657. * @param event
  658. * Change event.
  659. */
  660. public void containerPropertySetChange(
  661. Container.PropertySetChangeEvent event);
  662. }
  663. /**
  664. * <p>
  665. * The interface for adding and removing <code>PropertySetChangeEvent</code>
  666. * listeners. By implementing this interface a class explicitly announces
  667. * that it will generate a <code>PropertySetChangeEvent</code> when its
  668. * contents are modified.
  669. * </p>
  670. * <p>
  671. * Note that the general Java convention is not to explicitly declare that a
  672. * class generates events, but to directly define the
  673. * <code>addListener</code> and <code>removeListener</code> methods. That
  674. * way the caller of these methods has no real way of finding out if the
  675. * class really will send the events, or if it just defines the methods to
  676. * be able to implement an interface.
  677. * </p>
  678. */
  679. public interface PropertySetChangeNotifier extends Serializable {
  680. /**
  681. * Registers a new Property set change listener for this Container.
  682. *
  683. * @param listener
  684. * The new Listener to be registered
  685. */
  686. public void addListener(Container.PropertySetChangeListener listener);
  687. /**
  688. * Removes a previously registered Property set change listener.
  689. *
  690. * @param listener
  691. * Listener to be removed
  692. */
  693. public void removeListener(Container.PropertySetChangeListener listener);
  694. }
  695. }