|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.station.toolbar.layout.PlaceholderToolbarGrid<D,S,P>
D
- the kind of object that should be treated as Dockable
S
- the kind of object that should be treated as DockStation
P
- the type of item which represents a Dockable
public abstract class PlaceholderToolbarGrid<D,S,P extends bibliothek.gui.dock.station.support.PlaceholderListItem<D>>
A PlaceholderToolbarGrid
behaves like a list of PlaceholderList
s.
Constructor Summary | |
---|---|
PlaceholderToolbarGrid()
|
Method Summary | |
---|---|
void |
addPlaceholder(int column,
int line,
bibliothek.util.Path placeholder)
Stores the placeholder placeholder in the designated column. |
protected Iterator<bibliothek.gui.dock.station.support.PlaceholderList<D,S,P>> |
allColumns()
Gets an iterator over all columns, including the columns with no content. |
void |
bind()
Informs this grid that it is actually used and that it should be allowed to add observers to various resources. |
void |
clear()
Removes all content from this grid. |
protected Iterator<bibliothek.gui.dock.station.support.PlaceholderList<D,S,P>> |
columns()
Gets an iterator over all non-empty columns. |
protected abstract bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> |
createColumn()
Creates one column. |
protected abstract GridPlaceholderList<D,S,P> |
createGrid()
Creates a new GridPlaceholderList . |
protected abstract void |
fill(D dockable,
bibliothek.gui.dock.station.support.ConvertedPlaceholderListItem item)
Called by toMap(Map) , this method should read persistent data
from dockable and write that data into item . |
void |
fromMap(bibliothek.gui.dock.station.support.PlaceholderMap map)
Replaces the content of this grid by a map that was written earlier using toMap() or toMap(Map) . |
void |
fromMap(bibliothek.gui.dock.station.support.PlaceholderMap map,
Map<Integer,D> identifiers,
PlaceholderToolbarGridConverter<D,P> converter)
|
P |
get(D dockable)
Gets the item that represents dockable |
P |
get(int index)
Gets the index 'th item of this grid. |
P |
get(bibliothek.util.Path placeholder)
Searches the item which is at the location of placeholder . |
int |
getColumn(D dockable)
Tells in which non-empty column dockable is. |
protected bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> |
getColumn(int index)
Gets the non-empty column with index index . |
int |
getColumn(bibliothek.util.Path placeholder)
Gets the index of the first column that contains placeholder
. |
Iterator<P> |
getColumnContent(int index)
Gets an iterator over the contents of the index 'th non-empty
column. |
int |
getColumnCount()
Gets the number of columns that are currently stored in this grid. |
int |
getLine(D dockable)
Tells at which position dockable is within its column. |
int |
getLine(int column,
D dockable)
Tells at which position dockable is within the column
column |
int |
getLine(int column,
bibliothek.util.Path placeholder)
Tells at which line placeholder appears in the column
column . |
int |
getLine(bibliothek.util.Path placeholder)
Tells at which line placeholder apperas in the first column
that contains placeholder . |
int |
getLineCount(int column)
Tells how many items are currently stored at the non-empty column with index column . |
protected abstract Set<bibliothek.util.Path> |
getPlaceholders(D dockable)
Gets all placeholders that are associated with dockable . |
bibliothek.gui.dock.station.support.PlaceholderStrategy |
getStrategy()
Gets the PlaceholderStrategy that is currently used by this grid. |
int |
getTotalColumnCount()
Gets the total number of columns, this includes empty columns. |
boolean |
hasPlaceholder(bibliothek.util.Path placeholder)
Tells whether this PlaceholderToolbarGrid knows a column which
contains the placeholder placeholder , this includes empty
columns. |
protected void |
init()
Initializes all fields of this object. |
void |
insert(int column,
int line,
P item)
Adds the item item to the non-empty column
column into position line . |
void |
insert(int columnIndex,
P item)
Adds the item item to a new column, the new column will have
the index columnIndex . |
void |
insert(int columnIndex,
P item,
boolean reuse)
Adds the item item to a new column, the new column will have
the index columnIndex . |
void |
insertPlaceholder(int column,
int line,
bibliothek.util.Path placeholder)
Inserts placeholder into column column at line . |
Iterator<P> |
items()
Gets an iterator that visits all items of this grid. |
void |
move(int sourceColumn,
int sourceLine,
int destinationColumn,
int destinationLine,
bibliothek.gui.dock.station.support.PlaceholderList.Level destinationLevel)
Moves the item at sourceColumn/sourceLine to
destinationColumn/destinationLine . |
protected abstract void |
onInserted()
Called if all columns were inserted at the same time. |
protected abstract void |
onInserted(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column,
int index)
Called if a new column column was added to this grid. |
protected abstract void |
onInserted(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column,
int columnIndex,
P item,
int itemIndex)
Called if item was added to the column column . |
protected abstract void |
onRemoved()
Called if all columns were removed from this grid |
protected abstract void |
onRemoved(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column,
int index)
Called if the column column was removed from this grid. |
protected abstract void |
onRemoved(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column,
int columnIndex,
P item,
int itemIndex)
Called if item was removed to the column column . |
boolean |
put(bibliothek.util.Path placeholder,
P item)
Tries to put item into this list at location
placeholder . |
boolean |
remove(P item)
Removes item from this grid, but leaves a placeholder for
the item. |
void |
removePlaceholder(bibliothek.util.Path placeholder)
Removes all occurences of placeholder . |
void |
setStrategy(bibliothek.gui.dock.station.support.PlaceholderStrategy strategy)
Sets the PlaceholderStrategy which is to be used by this grid. |
int |
size()
Gets the total count of items stored in this grid. |
bibliothek.gui.dock.station.support.PlaceholderMap |
toMap()
Converts this grid into a PlaceholderMap , if possible any
Dockable is converted into a placeholder. |
bibliothek.gui.dock.station.support.PlaceholderMap |
toMap(Map<D,Integer> identifiers)
Converts this grid into a PlaceholderMap using
identifiers to remember which Dockable was a which
position. |
void |
unbind()
Informs this grid that it is no longer used and that is should remove any observers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlaceholderToolbarGrid()
Method Detail |
---|
protected void init()
protected abstract bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> createColumn()
protected abstract GridPlaceholderList<D,S,P> createGrid()
GridPlaceholderList
.
protected abstract Set<bibliothek.util.Path> getPlaceholders(D dockable)
dockable
.
dockable
- some element used by this grid
protected abstract void onInserted(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column, int columnIndex, P item, int itemIndex)
item
was added to the column column
.
column
- a visible columncolumnIndex
- the index of the columnitem
- a new item of column
itemIndex
- the index of the new itemprotected abstract void onRemoved(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column, int columnIndex, P item, int itemIndex)
item
was removed to the column column
.
column
- a visible columncolumnIndex
- the index of the columnitem
- the removed item of column
itemIndex
- the index the item had before removingprotected abstract void onInserted(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column, int index)
column
was added to this grid. The column may not contain any elements when
this method is called.
column
- the new columnindex
- the index of the new columnprotected abstract void onRemoved(bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> column, int index)
column
was removed from this grid. The column may still contain elements when it
is removed.
column
- the removed columnindex
- the index the column had before it was removedprotected abstract void onInserted()
protected abstract void onRemoved()
public void clear()
public void insert(int column, int line, P item)
item
to the non-empty column
column
into position line
. This method may add
a new column in order to store item
.
column
- the column in which to store item
line
- the index within column
item
- the item to store, not null
IllegalArgumentException
- if item
is null
IllegalStateException
- if there is no PlaceholderStrategy
setpublic void insert(int columnIndex, P item)
item
to a new column, the new column will have
the index columnIndex
. If columnIndex
is out of
bounds, then the new column will be added as near as possible to the
preferred position. This method will try to reuse an empty column, if one
is available at the desired location.
columnIndex
- the column to additem
- the item to store, not null
public void insert(int columnIndex, P item, boolean reuse)
item
to a new column, the new column will have
the index columnIndex
. If columnIndex
is out of
bounds, then the new column will be added as near as possible to the
preferred position.
columnIndex
- the column to additem
- the item to store, not null
reuse
- if false
then a new column will be built in any
case, if true
then this grid tries to reuse an
existing yet empty column if possiblepublic void move(int sourceColumn, int sourceLine, int destinationColumn, int destinationLine, bibliothek.gui.dock.station.support.PlaceholderList.Level destinationLevel)
sourceColumn/sourceLine
to
destinationColumn/destinationLine
. The operation behaves as
if the item would first be removed from the source position, and
afterwards inserted at the destination position.
sourceColumn
- the column in which to find the item, only includes non-empty
columnssourceLine
- the line in the column in which to find the itemdestinationColumn
- the column in which to insert the itemdestinationLine
- the line at which to insert the itemdestinationLevel
- the level at which to find destinationColumn
,
will be converted to an index from PlaceholderList.Level.BASE
IllegalArgumentException
- if any index is out of boundspublic boolean put(bibliothek.util.Path placeholder, P item)
item
into this list at location
placeholder
. If there is already an element at
placeholder
, then the old item is silenlty removed and the
new item inserted. This method may create a new non-empty column if
necessary.
placeholder
- the name of the itemitem
- the item to insert
true
if insertion was a success, false
otherwisepublic void addPlaceholder(int column, int line, bibliothek.util.Path placeholder)
placeholder
in the designated column.
column
- the column in which to add placeholder
, only
includes non-empty columnsline
- the line in which to add placeholder
placeholder
- the placeholder to storepublic void insertPlaceholder(int column, int line, bibliothek.util.Path placeholder)
placeholder
into column column
at line
. This
method may create a new column if column
is as big as the grid.
column
- the column into which to insert placeholder
, includes
empty columns.line
- the line into which to insert placeholder
placeholder
- the new placeholder, not null
public boolean remove(P item)
item
from this grid, but leaves a placeholder for
the item.
item
- the item to remove
true
if item
was found and removedpublic void removePlaceholder(bibliothek.util.Path placeholder)
placeholder
.
placeholder
- the placeholder to removepublic int getColumn(D dockable)
dockable
is.
dockable
- the item to search
-1
if not foundpublic int getColumn(bibliothek.util.Path placeholder)
placeholder
.
placeholder
- the placeholder to search
placeholder
or -1 if not
found, this includes empty columnspublic int getLine(D dockable)
dockable
is within its column.
dockable
- the item to search
dockable
public int getLine(int column, D dockable)
dockable
is within the column
column
column
- the index of the non-empty column to searchdockable
- the item to search
dockable
public int getLine(bibliothek.util.Path placeholder)
placeholder
apperas in the first column
that contains placeholder
. This includes empty columns.
placeholder
- the placeholder to search
placeholder
was foundpublic int getLine(int column, bibliothek.util.Path placeholder)
placeholder
appears in the column
column
.
column
- the index of the column, this includes empty columnsplaceholder
- the placeholder to search
placeholder
was not foundpublic boolean hasPlaceholder(bibliothek.util.Path placeholder)
PlaceholderToolbarGrid
knows a column which
contains the placeholder placeholder
, this includes empty
columns.
placeholder
- the placeholder to search
true
if placeholder
was foundpublic int size()
public P get(int index)
index
'th item of this grid.
index
- the index of the item
IllegalArgumentException
- if index
is not validpublic P get(D dockable)
dockable
dockable
- the dockable to search
dockable
or
null
if not foundpublic P get(bibliothek.util.Path placeholder)
placeholder
.
placeholder
- some placeholder that may or may not be known to this grid
placeholder
or null
either
if placeholder
was not found or if there is no item
storedprotected Iterator<bibliothek.gui.dock.station.support.PlaceholderList<D,S,P>> allColumns()
protected Iterator<bibliothek.gui.dock.station.support.PlaceholderList<D,S,P>> columns()
public Iterator<P> items()
public int getColumnCount()
public int getLineCount(int column)
column
.
column
- the index of a non-empty column
public int getTotalColumnCount()
public Iterator<P> getColumnContent(int index)
index
'th non-empty
column.
index
- the index of the non-empty column
protected bibliothek.gui.dock.station.support.PlaceholderList<D,S,P> getColumn(int index)
index
. Subclasses should not modify the returned list.
index
- the index of the column
null
if no such column
existspublic void bind()
public void unbind()
public void setStrategy(bibliothek.gui.dock.station.support.PlaceholderStrategy strategy)
PlaceholderStrategy
which is to be used by this grid.
strategy
- the new strategy, can be null
public bibliothek.gui.dock.station.support.PlaceholderStrategy getStrategy()
PlaceholderStrategy
that is currently used by this grid.
null
protected abstract void fill(D dockable, bibliothek.gui.dock.station.support.ConvertedPlaceholderListItem item)
toMap(Map)
, this method should read persistent data
from dockable
and write that data into item
.
dockable
- the dockable to readitem
- the item to write intopublic bibliothek.gui.dock.station.support.PlaceholderMap toMap(Map<D,Integer> identifiers)
PlaceholderMap
using
identifiers
to remember which Dockable
was a which
position.
identifiers
- identifiers for all children of the DockStation
using
this grid
public void fromMap(bibliothek.gui.dock.station.support.PlaceholderMap map, Map<Integer,D> identifiers, PlaceholderToolbarGridConverter<D,P> converter)
public bibliothek.gui.dock.station.support.PlaceholderMap toMap()
PlaceholderMap
, if possible any
Dockable
is converted into a placeholder.
public void fromMap(bibliothek.gui.dock.station.support.PlaceholderMap map)
toMap()
or toMap(Map)
.
map
- the map to read, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |