use of org.jowidgets.api.widgets.ITabItem in project jo-client-platform by jo-source.
the class BeanTabFolderImpl method addTab.
private void addTab() {
final int newTabIndex = tabFolder.getItems().size();
final ITabItem tabItem = tabFolder.addItem(BPF.tabItem());
final IBeanTab<BEAN_TYPE> beanTab = beanTabFactory.createTab(tabItem);
beanTabs.put(Integer.valueOf(newTabIndex), beanTab);
}
use of org.jowidgets.api.widgets.ITabItem in project jo-client-platform by jo-source.
the class BeanTabFolderImpl method updateFromModel.
@SuppressWarnings("unchecked")
private void updateFromModel() {
model.removeBeanSelectionListener(modelSelectionListener);
tabFolder.removeTabFolderListener(tabFolderSelectionListener);
final int tabsToAdd = model.getSize() - tabFolder.getItems().size();
if (tabsToAdd < 0) {
for (int i = 0; i < -tabsToAdd; i++) {
final int removeIndex = tabFolder.getItems().size() - 1;
tabFolder.removeItem(removeIndex);
beanTabs.remove(Integer.valueOf(removeIndex));
}
} else {
for (int i = 0; i < tabsToAdd; i++) {
addTab();
}
}
for (int i = 0; i < model.getSize(); i++) {
final IBeanProxy<BEAN_TYPE> bean = model.getBean(i);
final ITabItem item = tabFolder.getItem(i);
bean.addPropertyChangeListener(renderLabelListener);
for (final Entry<ITypedKey, RenderLabelCustomPropertiesListener> entry : renderLabelCustomPropertiesListeners.entrySet()) {
bean.addCustomPropertyListener(entry.getKey(), entry.getValue());
}
final IBeanTab<BEAN_TYPE> beanTab = beanTabs.get(Integer.valueOf(i));
beanTab.setBean(bean);
renderLabel(item, bean);
}
tabFolder.addTabFolderListener(tabFolderSelectionListener);
model.addBeanSelectionListener(modelSelectionListener);
if (tabFolder.getItems().size() > 0) {
final Integer selectionIndex = model.getSelectionIndex();
if (selectionIndex != null) {
if (selectionIndex.intValue() < tabFolder.getItems().size()) {
tabFolder.setSelectedItem(selectionIndex.intValue());
} else {
model.setSelection(tabFolder.getSelectedIndex());
}
} else {
model.setSelection(tabFolder.getSelectedIndex());
}
}
}
use of org.jowidgets.api.widgets.ITabItem in project jo-client-platform by jo-source.
the class BeanGraphSettingsDialog method initializeTabFolder.
private BeanGraphAttributeListImpl initializeTabFolder(final int filterTabIndex) {
tabFolder = add(BPF.tabFolder().setTabsCloseable(false), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
final ITabItem itemGroupFilter = tabFolder.addItem(BPF.tabItem());
itemGroupFilter.setText("GroupFilter");
itemGroupFilter.setLayout(MigLayoutFactory.growingInnerCellLayout());
final IScrollComposite contentGroup = itemGroupFilter.add(BPF.scrollComposite(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
contentGroup.setLayout(MigLayoutFactory.growingInnerCellLayout());
// final ITabItem itemRelationFilter = tabFolder.addItem(BPF.tabItem());
// itemRelationFilter.setText("RelationFilter");
// itemRelationFilter.setLayout(MigLayoutFactory.growingInnerCellLayout());
// final IScrollComposite contentRelations = itemRelationFilter.add(
// BPF.scrollComposite(),
// MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
// contentRelations.setLayout(MigLayoutFactory.growingInnerCellLayout());
// beanGraphAttributeListImplRelations = new BeanGraphAttributeListImpl(vis, contentRelations.add(
// BPF.composite(),
// "aligny top, growx, w 0::, h 0::"), edgeVisibilityMap, FilterType.RELATIONS);
final IComposite content = contentGroup.add(BPF.composite(), "aligny top, growx, w 0::, h 0::");
final BeanGraphAttributeListImpl beanGraphAttributeListImplGroup = new BeanGraphAttributeListImpl(vis, content, groupVisibilityMap, FilterType.GROUPS, groupColorMap);
tabFolder.setSelectedItem((getFilterTabByIndex(filterTabIndex) != null) ? getFilterTabByIndex(filterTabIndex).getIndex() : 0);
return beanGraphAttributeListImplGroup;
}
Aggregations