List of usage examples for com.vaadin.ui AbstractLayout getData
public Object getData()
From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableInfoPanel.java
License:Open Source License
public TableInfoPanel(final org.jumpmind.db.model.Table table, final String user, final IDb db, final Settings settings, SqlExplorer explorer, String selectedTabCaption) { this.explorer = explorer; setSizeFull();/*from ww w. j av a2 s.c o m*/ tabSheet = CommonUiUtils.createTabSheet(); tabSheet.setImmediate(true); tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() { private static final long serialVersionUID = 1L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { selectedCaption = tabSheet.getTab(tabSheet.getSelectedTab()).getCaption(); if (tabSheet.getSelectedTab() instanceof AbstractLayout) { AbstractLayout layout = (AbstractLayout) tabSheet.getSelectedTab(); if (selectedCaption.equals("Data") && layout.getData() != null && layout.getData().equals(true)) { refreshData(table, user, db, settings, false); } else if (layout.getData() != null && layout.getData() instanceof AbstractMetaDataTableCreator) { populate((VerticalLayout) layout); } } else if (tabSheet.getSelectedTab() instanceof AceEditor && ((AceEditor) tabSheet.getSelectedTab()).getData().equals(true)) { populateSource(table, db, (AceEditor) tabSheet.getSelectedTab()); } } }); addComponent(tabSheet); JdbcSqlTemplate sqlTemplate = (JdbcSqlTemplate) db.getPlatform().getSqlTemplate(); tabSheet.addTab(create(new ColumnMetaDataTableCreator(sqlTemplate, table, settings)), "Columns"); tabSheet.addTab(create(new PrimaryKeyMetaDataTableCreator(sqlTemplate, table, settings)), "Primary Keys"); tabSheet.addTab(create(new IndexMetaDataTableCreator(sqlTemplate, table, settings)), "Indexes"); if (db.getPlatform().getDatabaseInfo().isForeignKeysSupported()) { tabSheet.addTab(create(new ImportedKeysMetaDataTableCreator(sqlTemplate, table, settings)), "Imported Keys"); tabSheet.addTab(create(new ExportedKeysMetaDataTableCreator(sqlTemplate, table, settings)), "Exported Keys"); } refreshData(table, user, db, settings, true); AceEditor editor = new AceEditor(); editor.setData(true); tabSheet.addTab(editor, "Source"); Iterator<Component> i = tabSheet.iterator(); while (i.hasNext()) { Component component = i.next(); Tab tab = tabSheet.getTab(component); if (tab.getCaption().equals(selectedTabCaption)) { tabSheet.setSelectedTab(component); break; } } }