use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.
the class AbstractOrgTabPanel method initLayout.
private void initLayout() {
final IModel<List<ITab>> tabModel = new LoadableModel<>(true) {
private static final long serialVersionUID = 1L;
@Override
protected List<ITab> load() {
LOGGER.debug("Loading org. roots for tabs for tabbed panel.");
roots = loadOrgRoots();
final List<ITab> tabs = new ArrayList<>();
for (PrismObject<OrgType> root : roots) {
final String oid = root.getOid();
tabs.add(new AbstractTab(createTabTitle(root)) {
private static final long serialVersionUID = 1L;
private final int tabId = tabs.size();
@Override
public WebMarkupContainer getPanel(String panelId) {
add(new AjaxEventBehavior("load") {
private static final long serialVersionUID = 1L;
protected void onEvent(final AjaxRequestTarget target) {
OrgStructurePanelStorage usersStorage = getOrgStructurePanelStorage();
if (usersStorage != null) {
usersStorage.setSelectedTabId(tabId);
}
}
});
Panel panel = createTreePanel(panelId, new Model<>(oid), getPageBase());
panel.setOutputMarkupId(true);
return panel;
}
});
}
LOGGER.debug("Tab count is {}", tabs.size());
return tabs;
}
};
List<ITab> tabsList = tabModel.getObject();
OrgStructurePanelStorage orgStructurePanelStorage = getOrgStructurePanelStorage();
int selectedTab = 0;
if (orgStructurePanelStorage != null) {
selectedTab = orgStructurePanelStorage.getSelectedTabId() == -1 ? 0 : orgStructurePanelStorage.getSelectedTabId();
if (tabsList == null || (selectedTab > tabsList.size() - 1)) {
orgStructurePanelStorage.setSelectedTabId(0);
}
}
AjaxTabbedPanel<ITab> tabbedPanel = new AjaxTabbedPanel<>(ID_TABS, tabModel.getObject(), new Model<>(selectedTab), null) {
private static final long serialVersionUID = 1L;
@Override
public TabbedPanel<ITab> setSelectedTab(int index) {
changeTabPerformed(index);
return super.setSelectedTab(index);
}
};
tabbedPanel.setOutputMarkupId(true);
if (tabsList == null || tabsList.size() == 0) {
tabbedPanel.setVisible(false);
}
add(tabbedPanel);
}
use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.
the class ResourceConfigurationPanel method createConfigurationTabs.
private List<ITab> createConfigurationTabs() {
List<ITab> tabs = new ArrayList<>();
getObjectDetailsModels().getConfigurationModel().reset();
PrismContainerWrapper<ConnectorConfigurationType> configuration = getObjectDetailsModels().getConfigurationModelObject();
if (configuration == null) {
return new ArrayList<>();
}
PrismContainerValueWrapper<ConnectorConfigurationType> configurationValue;
try {
configurationValue = configuration.getValue();
} catch (SchemaException e) {
LOGGER.error("Cannot get value for connector configuration, {}", e.getMessage(), e);
getSession().error("A problem occurred while getting value for connector configuration, " + e.getMessage());
return null;
}
for (final PrismContainerWrapper<?> wrapper : configurationValue.getContainers()) {
String tabName = wrapper.getDisplayName();
tabs.add(new AbstractTab(new Model<>(tabName)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer getPanel(String panelId) {
return new SingleContainerPanel<>(panelId, Model.of(wrapper), wrapper.getTypeName());
}
});
}
return tabs;
}
use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.
the class ConfigurationStep method createConfigurationTabs.
private List<ITab> createConfigurationTabs() {
List<ITab> tabs = new ArrayList<>();
PrismContainerWrapper<ConnectorConfigurationType> configuration = configurationModel.getObject();
if (configuration == null) {
return new ArrayList<>();
}
PrismContainerValueWrapper<ConnectorConfigurationType> configurationValue;
try {
configurationValue = configuration.getValue();
} catch (SchemaException e) {
LOGGER.error("Cannot get value for conenctor configuration, {}", e.getMessage(), e);
getSession().error("A problem occurred while getting value for connector configuration, " + e.getMessage());
return null;
}
for (final PrismContainerWrapper<?> wrapper : configurationValue.getContainers()) {
String tabName = wrapper.getDisplayName();
tabs.add(new AbstractTab(new Model<>(tabName)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer getPanel(String panelId) {
return new SingleContainerPanel<>(panelId, Model.of(wrapper), wrapper.getTypeName());
}
});
}
return tabs;
}
use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.
the class PageValuePolicy method initTabs.
private void initTabs(MidpointForm mainForm) {
List<ITab> tabs = new ArrayList<>();
PageBase baseParameter = this;
tabs.add(new AbstractTab(createStringResource("PageValuePolicy.basic")) {
@Override
public WebMarkupContainer getPanel(String panelId) {
return new ValuePolicyBasicPanel(panelId, valuePolicyModel);
}
});
// tabs.add(new AbstractTab(createStringResource("PageValuePolicy.stringPolicy")) {
// @Override
// public WebMarkupContainer getPanel(String panelId) {
// return new ValuePolicyStringPoliciesPanel(panelId,mainForm,valuePolicyModel,baseParameter);
// }
// });
TabbedPanel tabPanel = WebComponentUtil.createTabPanel(ID_TAB_PANEL, this, tabs, null);
mainForm.add(tabPanel);
}
Aggregations