PL-8237 Introduce non-recursive variant of Component.isVisible and Component.isEnabled

This commit is contained in:
Daniil Tsarev 2016-12-08 13:55:09 +04:00
parent d1c7b5e7ef
commit bc84b964f7
9 changed files with 96 additions and 2 deletions

View File

@ -218,6 +218,16 @@ public abstract class DesktopAbstractComponent<C extends JComponent>
}
}
@Override
public boolean isVisibleItself() {
return visible;
}
@Override
public boolean isEnabledItself() {
return enabled;
}
@Override
public void requestFocus() {
SwingUtilities.invokeLater(() ->

View File

@ -323,6 +323,16 @@ public class DesktopPopupButton extends DesktopAbstractActionsHolderComponent<JB
public void setVisible(boolean visible) {
}
@Override
public boolean isVisibleItself() {
return DesktopPopupButton.this.isVisibleItself();
}
@Override
public boolean isEnabledItself() {
return action.isEnabled();
}
@Override
public void requestFocus() {
}

View File

@ -1131,6 +1131,16 @@ public class DesktopWindow implements Window, Component.Disposable,
throw new UnsupportedOperationException();
}
@Override
public boolean isVisibleItself() {
return true;
}
@Override
public boolean isEnabledItself() {
return panel.isEnabled();
}
@Override
public void requestFocus() {
}

View File

@ -138,6 +138,16 @@ public class AbstractFrame implements Frame, Frame.Wrapper, Component.Wrapper, C
frame.setVisible(visible);
}
@Override
public boolean isVisibleItself() {
return frame.isVisibleItself();
}
@Override
public boolean isEnabledItself() {
return frame.isEnabledItself();
}
@Override
public void requestFocus() {
frame.requestFocus();

View File

@ -72,16 +72,30 @@ public interface Component {
/** INTERNAL. Managed by debug Id system. */
void setDebugId(String id);
/** Is component in enabled state? */
/**
* Are the component and its parent enabled?
*/
boolean isEnabled();
/** Set component enabled state */
void setEnabled(boolean enabled);
/** Is component visible? */
/**
* Are the component and its parent visible?
*/
boolean isVisible();
/** Set component visibility */
void setVisible(boolean visible);
/**
* Is the component visible regardless of the parent?
*/
boolean isVisibleItself();
/**
* Is the component enabled regardless of the parent?
*/
boolean isEnabledItself();
/** Set focus to this component */
void requestFocus();

View File

@ -736,6 +736,16 @@ public interface Table<E extends Entity>
throw new UnsupportedOperationException();
}
@Override
public boolean isVisibleItself() {
throw new UnsupportedOperationException();
}
@Override
public boolean isEnabledItself() {
throw new UnsupportedOperationException();
}
@Override
public void requestFocus() {
}

View File

@ -218,6 +218,16 @@ public class ParamWrapper implements Component.HasValue {
public void setVisible(boolean visible) {
}
@Override
public boolean isVisibleItself() {
throw new UnsupportedOperationException();
}
@Override
public boolean isEnabledItself() {
throw new UnsupportedOperationException();
}
@Override
public void requestFocus() {
}

View File

@ -886,6 +886,16 @@ public class WebWindow implements Window, Component.Wrapper,
throw new UnsupportedOperationException();
}
@Override
public boolean isVisibleItself() {
return true;
}
@Override
public boolean isEnabledItself() {
return component.isEnabled();
}
@Override
public void requestFocus() {
}

View File

@ -208,6 +208,16 @@ public abstract class WebAbstractComponent<T extends com.vaadin.ui.AbstractCompo
getComposition().setVisible(visible);
}
@Override
public boolean isVisibleItself() {
return component.isVisible();
}
@Override
public boolean isEnabledItself() {
return component.isEnabled();
}
@Override
public String getIcon() {
return icon;