org.jhotdraw8.draw.inspector.Inspector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jhotdraw8.draw Show documentation
Show all versions of org.jhotdraw8.draw Show documentation
JHotDraw8 Drawing Framework
The newest version!
/*
* @(#)Inspector.java
* Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
*/
package org.jhotdraw8.draw.inspector;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.scene.Node;
import org.jspecify.annotations.Nullable;
/**
* Interface for inspectors.
*
* @param the subject type
* @author Werner Randelshofer
*/
public interface Inspector {
/**
* The name of the {@link #subjectProperty}.
*/
String SUBJECT_PROPERTY = "subject";
/**
* The name of the {@link #showingProperty}.
*/
String SHOWING_PROPERTY = "showing";
ObjectProperty subjectProperty();
default void setSubject(@Nullable S s) {
subjectProperty().set(s);
}
default @Nullable S getSubject() {
return subjectProperty().get();
}
Node getNode();
/**
* Whether this inspector is showing.
*
* An inspector that is not showing should not consume CPU resources.
*
* This property is set by parent nodes in the scene graph,, for example
* depending on whether this inspector is in a collapsed pane.
*
* @return true if this inspector is showing.
*/
BooleanProperty showingProperty();
default boolean isShowing() {
return showingProperty().get();
}
default void setShowing(boolean newValue) {
showingProperty().set(newValue);
}
}