use of org.apache.cayenne.modeler.dialog.db.load.TransferableNode in project cayenne by apache.
the class DbImportTree method createTreeExpandListener.
private void createTreeExpandListener() {
TreeExpansionListener treeExpansionListener = new TreeExpansionListener() {
@Override
public void treeExpanded(TreeExpansionEvent event) {
TreePath path = event.getPath();
Object lastPathComponent = path.getLastPathComponent();
if (!(lastPathComponent instanceof TransferableNode)) {
return;
}
DbImportTreeNode node = (DbImportTreeNode) lastPathComponent;
if ((node.isIncludeTable() || node.isSchema() || node.isCatalog()) && !node.isLoaded()) {
// reload tables and columns action.
LoadDbSchemaAction action = Application.getInstance().getActionManager().getAction(LoadDbSchemaAction.class);
action.performAction(null, path);
}
}
@Override
public void treeCollapsed(TreeExpansionEvent event) {
}
};
this.addTreeExpansionListener(treeExpansionListener);
}
use of org.apache.cayenne.modeler.dialog.db.load.TransferableNode in project cayenne by apache.
the class DbImportTree method printSchemas.
private void printSchemas(Collection<Schema> schemas, DbImportTreeNode parent) {
for (Schema schema : schemas) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(schema) : new TransferableNode(schema);
if (!"".equals(node.getSimpleNodeName())) {
if (isTransferable && schema.getIncludeTables().isEmpty() && schema.getExcludeTables().isEmpty()) {
printParams(Collections.singletonList(new IncludeTable("Loading...")), node);
}
printChildren(schema, node);
parent.add(node);
}
}
}
use of org.apache.cayenne.modeler.dialog.db.load.TransferableNode in project cayenne by apache.
the class DbImportTree method printCatalogs.
private void printCatalogs(Collection<Catalog> catalogs, DbImportTreeNode parent) {
for (Catalog catalog : catalogs) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(catalog) : new TransferableNode(catalog);
if (!"".equals(node.getSimpleNodeName())) {
if (isTransferable && catalog.getSchemas().isEmpty() && catalog.getIncludeTables().isEmpty() && catalog.getExcludeTables().isEmpty()) {
printParams(Collections.singletonList(new IncludeTable("Loading...")), node);
}
printSchemas(catalog.getSchemas(), node);
printChildren(catalog, node);
parent.add(node);
}
}
}
use of org.apache.cayenne.modeler.dialog.db.load.TransferableNode in project cayenne by apache.
the class DbImportView method initFormElements.
private void initFormElements() {
DbImportTreeNode root = new DbImportTreeNode(new ReverseEngineering());
DbImportTreeNode draggableTreeRoot = new DbImportTreeNode(new ReverseEngineering());
DbImportTree reverseEngineeringTree = new DbImportTree(root);
DbImportTree draggableTree = new DbImportTree(new TransferableNode(draggableTreeRoot));
DbImportModel model = new DbImportModel(root);
model.setCanBeCleaned(true);
DbImportModel draggableTreeModel = new DbImportModel(draggableTreeRoot);
draggableTreeModel.setCanBeCleaned(false);
draggableTree.setRootVisible(false);
draggableTree.setShowsRootHandles(true);
draggableTree.setModel(draggableTreeModel);
reverseEngineeringTree.setRootVisible(false);
reverseEngineeringTree.setModel(model);
reverseEngineeringTree.setShowsRootHandles(true);
draggableTreePanel = new DraggableTreePanel(projectController, draggableTree, reverseEngineeringTree);
treeToolbar = new TreeToolbarPanel(projectController, reverseEngineeringTree, draggableTreePanel);
treePanel = new ReverseEngineeringTreePanel(projectController, reverseEngineeringTree, draggableTree);
treePanel.setTreeToolbar(treeToolbar);
model.setDbSchemaTree(draggableTree);
draggableTreeModel.setDbSchemaTree(draggableTree);
((ColorTreeRenderer) draggableTreePanel.getSourceTree().getCellRenderer()).setReverseEngineeringTree(reverseEngineeringTree);
configPanel = new ReverseEngineeringConfigPanel(projectController, this);
configPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
configPanel.setVisible(false);
}
use of org.apache.cayenne.modeler.dialog.db.load.TransferableNode in project cayenne by apache.
the class PrintTablesBiFunction method apply.
@Override
public Void apply(FilterContainer filterContainer, DbImportTreeNode root) {
DbImportModel model = (DbImportModel) dbImportTree.getModel();
boolean isTransferable = dbImportTree.isTransferable();
if (root.getChildCount() != 0) {
root.removeAllChildren();
}
Collection<IncludeTable> includeTables = filterContainer.getIncludeTables();
for (IncludeTable includeTable : includeTables) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(includeTable) : new TransferableNode(includeTable);
if (isTransferable && includeTable.getIncludeColumns().isEmpty() && includeTable.getExcludeColumns().isEmpty()) {
dbImportTree.printParams(Collections.singletonList(new IncludeColumn("Loading...")), node);
}
root.add(node);
dbImportTree.packColumns(includeTable, node);
}
model.reload(root);
return null;
}
Aggregations