org.grinvin.gui.components

Class InvariantListComponent

Implemented Interfaces:
AcceptsInvariant, HasAccessControl, HasSelectableValues

public class InvariantListComponent
extends JList
implements AcceptsInvariant, HasAccessControl, HasSelectableValues

List component with entries of type Invariant. Provides drag support for invariants. Dropping is not allowed.

Field Summary

protected static LocalTransferHandler
TRANSFER_HANDLER

Constructor Summary

InvariantListComponent(InvariantListModel model)
InvariantListComponent(InvariantListModel model, int dragOperations, int dropOperations)
Creates a new instance of InvariantListComponent

Method Summary

AcceptsInvariant.Reason
acceptsInvariant(InvariantValue> clazz)
Check whether invariants that return this type can be accepted.
Reason
acceptsInvariant(Invariant invariant)
Check whether the invariant can be accepted.
Reason
addInvariant(Invariant invariant)
Accept an invariant.
void
deleteSelectedElements()
Delete currently selected elements.
int
getDragOperations()
int
getDropOperations()
boolean
isReadOnly()
void
setIsReadOnly(boolean isReadOnly)
void
setPaintWatermark(boolean paintWatermark)
Configure whether to paint the watermark or not.
protected @Override
void paintComponent(Graphics g)
Adds a watermark to the list.

Field Details

TRANSFER_HANDLER

protected static final LocalTransferHandler TRANSFER_HANDLER

Constructor Details

InvariantListComponent

public InvariantListComponent(InvariantListModel model)

InvariantListComponent

public InvariantListComponent(InvariantListModel model,
                              int dragOperations,
                              int dropOperations)
Creates a new instance of InvariantListComponent

Method Details

acceptsInvariant

public AcceptsInvariant.Reason acceptsInvariant(InvariantValue> clazz)
Check whether invariants that return this type can be accepted. This is used to determine if an invariant created by an invariant factory can be accepted, without the need to create that invariant.
Specified by:
acceptsInvariant in interface AcceptsInvariant

acceptsInvariant

public Reason acceptsInvariant(Invariant invariant)
Check whether the invariant can be accepted.
Specified by:
acceptsInvariant in interface AcceptsInvariant

addInvariant

public Reason addInvariant(Invariant invariant)
Accept an invariant.
Specified by:
addInvariant in interface AcceptsInvariant

deleteSelectedElements

public void deleteSelectedElements()
Delete currently selected elements.

getDragOperations

public int getDragOperations()
Specified by:
getDragOperations in interface HasAccessControl

getDropOperations

public int getDropOperations()
Specified by:
getDropOperations in interface HasAccessControl

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface HasAccessControl

setIsReadOnly

public void setIsReadOnly(boolean isReadOnly)

setPaintWatermark

public void setPaintWatermark(boolean paintWatermark)

void paintComponent

protected @Override void paintComponent(Graphics g)
Adds a watermark to the list.