use of com.servoy.j2db.IProvideTabSequence in project servoy-client by Servoy.
the class TabSequenceHelper method fromAbstractToNamed.
public void fromAbstractToNamed() {
T tableViewToInsert = null;
int largestIndexBeforeBody = -1;
T lastComponentBeforeBody = null;
LinkedHashMap<T, String> componentGroupsByTabIndex = new LinkedHashMap<T, String>();
FormController fc = runtimeContainer.getController();
Form f = fc.getForm();
Iterator<Part> parts = f.getParts();
while (parts.hasNext()) {
Part p = parts.next();
IDataRenderer dataRenderer = fc.getDataRenderers()[p.getPartType()];
if (dataRenderer != null) {
// Later we will insert it in the tab sequence.
if ((fc.getViewComponent() instanceof IProvideTabSequence) && (p.getPartType() == Part.BODY)) {
tableViewToInsert = (T) dataRenderer;
} else {
SortedMap<ISupportTabSeq, T> dataRendererComponents = abstractTabSequence.get(dataRenderer);
if (dataRendererComponents != null) {
for (ISupportTabSeq supportTabSeq : dataRendererComponents.keySet()) {
if (supportTabSeq.getTabSeq() >= 0) {
T next = dataRendererComponents.get(supportTabSeq);
String name = null;
if (supportTabSeq instanceof ISupportName)
name = ((ISupportName) supportTabSeq).getName();
componentGroupsByTabIndex.put(next, name);
if ((p.getPartType() == Part.HEADER) || (p.getPartType() == Part.TITLE_HEADER) || (p.getPartType() == Part.LEADING_GRAND_SUMMARY)) {
if (supportTabSeq.getTabSeq() >= largestIndexBeforeBody) {
lastComponentBeforeBody = next;
largestIndexBeforeBody = supportTabSeq.getTabSeq();
}
}
}
}
}
}
}
}
componentsToNames.clear();
if ((lastComponentBeforeBody == null) && (tableViewToInsert != null))
componentsToNames.put(tableViewToInsert, null);
for (T o : componentGroupsByTabIndex.keySet()) {
componentsToNames.put(o, componentGroupsByTabIndex.get(o));
if ((tableViewToInsert != null) && (lastComponentBeforeBody != null) && (o.equals(lastComponentBeforeBody)))
componentsToNames.put(tableViewToInsert, null);
}
revertComponentsToNames();
fromNamedToRuntime();
}
Aggregations