The new method can be used to access for example inner tabs in a + multiview window.
+TopComponent
, adds notification
* about the change to its WindowManager.TopComponentManager
. */
@@ -1394,6 +1388,17 @@
this.nodeName = nodeName;
}
+ /**
+ * Retrieves sub-components this TopComponent contains.
+ *
+ * @return Array of internal sub-components. The default implementation
+ * returns null.
+ * @since 6.52
+ */
+ public SubComponent[] getSubComponents() {
+ return null;
+ }
+
/** Each top component that wishes to be cloned should implement
* this interface, so CloneAction can check it and call the cloneComponent
* method.
@@ -1539,6 +1544,62 @@
public void removePropertyChangeListener(PropertyChangeListener l);
}
+ /**
+ * Representation of a visual sub-component displayed in a TopComponent,
+ * for example sub-tabs in a multiview window.
+ *
+ * @see #getSubComponents()
+ * @since 6.52
+ */
+ public static abstract class SubComponent {
+ private final String displayName;
+ private final String description;
+ private boolean active;
+
+ /**
+ * C'tor
+ * @param displayName Subcomponent's display name.
+ * @param active True if the given sub-component is currently active,
+ * e.g. multiview sub-tab is selected.
+ */
+ public SubComponent( String displayName, boolean active ) {
+ this( displayName, null, active );
+ }
+
+ /**
+ * C'tor
+ * @param displayName Subcomponent's display name.
+ * @param description Short description to show in a tooltip.
+ * @param active True if the given sub-component is currently active,
+ * e.g. multiview sub-tab is selected.
+ */
+ public SubComponent( String displayName, String description, boolean active ) {
+ this.displayName = displayName;
+ this.description = description;
+ this.active = active;
+ }
+
+ /**
+ * @return True if this sub-component is the active/selected one.
+ */
+ public final boolean isActive() {
+ return active;
+ }
+
+ public final String getDescription() {
+ return description;
+ }
+
+ public final String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * Make this sub-component the active/selected one.
+ */
+ public abstract void activate();
+ }
+
private class AttentionGetter implements ActionListener {
Timer timer = null;