Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/snap/view/CustomViewOwner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package snap.view;

/**
* Helper class to create custom ViewOwners with novel interpretations.
*/
public abstract class CustomViewOwner extends ViewOwner {

/**
* Creates the top level view for this owner.
* <br><br>
* API Note: If you want the vanilla interaction of this class, return {@code default_createUI();}
*/
@Override
abstract protected View createUI();

/**
* Initializes the UI panel.
* <br><br>
* API Note: If you want the vanilla interaction of this class, return {@code default_initUI();}
*/
@Override
abstract protected void initUI();

/**
* Reset UI controls.
* <br><br>
* API Note: If you want the vanilla interaction of this class, return {@code default_resetUI();}
*/
@Override
abstract protected void resetUI();

/**
* Respond to UI controls.
* <br><br>
* API Note: If you want the vanilla interaction of this class, return {@code default_respondUI(ViewEvent);}
* @param anEvent Any event that has been caught by this ViewOwner.
*/
@Override
abstract protected void respondUI(ViewEvent anEvent);

/**
* Default implementation of {@link ViewOwner#createUI()}
* @return View loaded from snp file of the same name as the class.
*/
final protected View default_createUI() {return super.createUI();}

/**
* Default implementation of {@link ViewOwner#initUI()}
*/
final protected void default_initUI() {super.initUI();}

/**
* Default implementation of {@link ViewOwner#resetUI()}
*/
final protected void default_resetUI() {super.resetUI();}

/**
* Default implementation of {@link ViewOwner#respondUI(ViewEvent)}
* @param anEvent An event which has been captured by the view.
*/
final protected void default_respondUI(ViewEvent anEvent) {super.respondUI(anEvent);}
}