* @return
*/
protected JComponent getMainPanel(boolean withAutoSaveFunction) {
// one or more?
if (headers.size() == 1) {
return new YScrollPane(headers.entrySet().iterator().next().getValue().getPanelFromBuilder(withAutoSaveFunction));
} else {
// build basics
// get elements
Object[] keys = headers.keySet().toArray();
Arrays.sort(keys);
LinkedList<Object> obj = new LinkedList<Object>(Arrays.asList(keys));
// build order
LinkedList<String> erg = new LinkedList<String>();
String cid;
int sort;
while (obj.size() > 0) {
sort = headers.get(obj.get(0)).getSorting();
cid = (String) obj.get(0);
// add all elements
for (final Object key : obj) {
if (headers.get(key).getSorting() < sort) {
sort = headers.get(key).getSorting();
cid = (String) key;
}
}
// remove it
erg.add(cid);
obj.remove(cid);
}
JPanel p = new JPanel(new GridLayout(erg.size(), 1));
// add all elements
for (final Object key : erg) {
p.add(headers.get(key).getPane(withAutoSaveFunction));
}
return new YScrollPane(p);
}
}