Merge remote-tracking branch 'origin/GP-1-dragonmacher-placheholder-is-showing-fix'

This commit is contained in:
Ryan Kurtz
2024-12-02 06:27:12 -05:00
4 changed files with 24 additions and 18 deletions
@@ -167,7 +167,7 @@ class ComponentNode extends Node {
void add(ComponentPlaceholder placeholder) { void add(ComponentPlaceholder placeholder) {
windowPlaceholders.add(placeholder); windowPlaceholders.add(placeholder);
placeholder.setNode(this); placeholder.setNode(this);
if (placeholder.isShowing()) { if (placeholder.isActive()) {
top = placeholder; top = placeholder;
invalidate(); invalidate();
} }
@@ -185,7 +185,7 @@ class ComponentNode extends Node {
return; // this node has been disconnected. return; // this node has been disconnected.
} }
if (placeholder.isShowing()) { if (placeholder.isActive()) {
if (top == placeholder) { if (top == placeholder) {
top = null; top = null;
} }
@@ -212,7 +212,7 @@ class ComponentNode extends Node {
* @param keepEmptyPlaceholder flag indicating to keep a placeholder placeholder object. * @param keepEmptyPlaceholder flag indicating to keep a placeholder placeholder object.
*/ */
void remove(ComponentPlaceholder placeholder, boolean keepEmptyPlaceholder) { void remove(ComponentPlaceholder placeholder, boolean keepEmptyPlaceholder) {
if (placeholder.isShowing()) { if (placeholder.isActive()) {
placeholder.show(false); placeholder.show(false);
if (top == placeholder) { if (top == placeholder) {
top = null; top = null;
@@ -241,9 +241,7 @@ class ComponentNode extends Node {
Iterator<ComponentPlaceholder> it = list.iterator(); Iterator<ComponentPlaceholder> it = list.iterator();
while (it.hasNext()) { while (it.hasNext()) {
ComponentPlaceholder placeholder = it.next(); ComponentPlaceholder placeholder = it.next();
if (placeholder.isShowing()) { placeholder.close();
placeholder.close();
}
} }
} }
@@ -404,7 +402,7 @@ class ComponentNode extends Node {
@Override @Override
void populateActiveComponents(List<ComponentPlaceholder> list) { void populateActiveComponents(List<ComponentPlaceholder> list) {
for (ComponentPlaceholder placeholder : windowPlaceholders) { for (ComponentPlaceholder placeholder : windowPlaceholders) {
if (placeholder.isShowing()) { if (placeholder.isActive()) {
list.add(placeholder); list.add(placeholder);
} }
} }
@@ -508,7 +506,7 @@ class ComponentNode extends Node {
elem.setAttribute("NAME", placeholder.getName()); elem.setAttribute("NAME", placeholder.getName());
elem.setAttribute("OWNER", placeholder.getOwner()); elem.setAttribute("OWNER", placeholder.getOwner());
elem.setAttribute("TITLE", placeholder.getTitle()); elem.setAttribute("TITLE", placeholder.getTitle());
elem.setAttribute("ACTIVE", "" + placeholder.isShowing()); elem.setAttribute("ACTIVE", "" + placeholder.isActive());
elem.setAttribute("GROUP", placeholder.getGroup()); elem.setAttribute("GROUP", placeholder.getGroup());
elem.setAttribute("INSTANCE_ID", Long.toString(placeholder.getInstanceID())); elem.setAttribute("INSTANCE_ID", Long.toString(placeholder.getInstanceID()));
root.addContent(elem); root.addContent(elem);
@@ -516,13 +514,10 @@ class ComponentNode extends Node {
return root; return root;
} }
//
// Tabbed pane listener methods
//
@Override @Override
boolean contains(ComponentPlaceholder placeholder) { boolean contains(ComponentPlaceholder placeholder) {
for (ComponentPlaceholder ph : windowPlaceholders) { for (ComponentPlaceholder ph : windowPlaceholders) {
if (ph.isShowing() && ph.equals(placeholder)) { if (ph.isActive() && ph.equals(placeholder)) {
return true; return true;
} }
} }
@@ -136,10 +136,21 @@ public class ComponentPlaceholder {
} }
/** /**
* Returns true if the component is not hidden * Returns true if the component is showing and visible to the user.
* @return true if showing * @return true if showing
* @see #isActive()
*/ */
boolean isShowing() { boolean isShowing() {
return isShowing && comp != null && comp.isShowing();
}
/**
* Returns true if this provider wants to be showing and has a component provider, regardless
* of whether the provider is showing to the user.
* @return true if active
* @see #isShowing()
*/
boolean isActive() {
return isShowing && componentProvider != null; return isShowing && componentProvider != null;
} }
@@ -829,7 +829,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
return; return;
} }
if (!placeholder.isShowing()) { if (!placeholder.isActive()) {
showComponent(placeholder, true, false); showComponent(placeholder, true, false);
} }
@@ -946,7 +946,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
return; return;
} }
if (visibleState == placeholder.isShowing()) { if (visibleState == placeholder.isActive()) {
if (visibleState) { if (visibleState) {
movePlaceholderToFront(placeholder, shouldEmphasize); movePlaceholderToFront(placeholder, shouldEmphasize);
setNextFocusPlaceholder(placeholder); setNextFocusPlaceholder(placeholder);
@@ -63,7 +63,7 @@ class PlaceholderManager {
restoredPlaceholder.showHeader(false); restoredPlaceholder.showHeader(false);
} }
if (defaultPlaceholder.isShowing() != restoredPlaceholder.isShowing()) { if (defaultPlaceholder.isActive() != restoredPlaceholder.isActive()) {
if (restoredPlaceholder.isShowing()) { if (restoredPlaceholder.isShowing()) {
provider.componentShown(); provider.componentShown();
} }