use of org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode in project cayenne by apache.
the class TreeToolbarPanel method lockButtons.
void lockButtons() {
if ((reverseEngineeringTree.getLastSelectedPathComponent() != null) && (!isLabelSelected())) {
DbImportTreeNode selectedNode = ((DbImportTreeNode) reverseEngineeringTree.getLastSelectedPathComponent());
DbImportTreeNode parentNode = (DbImportTreeNode) selectedNode.getParent();
if (parentNode != null) {
lockButtons(parentNode.getUserObject());
} else {
unlockButtons();
}
} else {
changeToolbarButtonsState(true);
editButton.setEnabled(false);
deleteButton.setEnabled(false);
}
if (reverseEngineeringTree.getSelectionPaths() != null) {
if (reverseEngineeringTree.getSelectionPaths().length > 1) {
changeToolbarButtonsState(false);
deleteButton.setEnabled(true);
}
}
}
use of org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode in project cayenne by apache.
the class DbImportTree method packNextFilter.
private void packNextFilter(FilterContainer filterContainer, DbImportTreeNode root, BiFunction<FilterContainer, DbImportTreeNode, Void> processor) {
DbImportTreeNode container = findNodeInParent(root, filterContainer);
if (container != null) {
container.setLoaded(true);
} else {
if (!filterContainer.getIncludeTables().isEmpty()) {
container = root;
} else {
return;
}
}
processor.apply(filterContainer, container);
}
use of org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode in project cayenne by apache.
the class DbImportTree method update.
public void update(ReverseEngineering reverseEngineering, BiFunction<FilterContainer, DbImportTreeNode, Void> processor) {
DbImportModel model = (DbImportModel) this.getModel();
DbImportTreeNode root = (DbImportTreeNode) model.getRoot();
Collection<Catalog> catalogs = reverseEngineering.getCatalogs();
if (!catalogs.isEmpty()) {
catalogs.forEach(catalog -> {
Collection<Schema> schemas = catalog.getSchemas();
if (!schemas.isEmpty()) {
DbImportTreeNode currentRoot = findNodeInParent(root, catalog);
schemas.forEach(schema -> packNextFilter(schema, currentRoot, processor));
} else {
packNextFilter(catalog, root, processor);
}
});
} else if (!reverseEngineering.getSchemas().isEmpty()) {
reverseEngineering.getSchemas().forEach(schema -> packNextFilter(schema, root, processor));
} else if (!reverseEngineering.getIncludeTables().isEmpty()) {
Schema schema = new Schema();
schema.getIncludeTables().addAll(reverseEngineering.getIncludeTables());
packNextFilter(schema, root, processor);
}
}
use of org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode in project cayenne by apache.
the class DbImportTree method translateReverseEngineeringToTree.
public void translateReverseEngineeringToTree(ReverseEngineering reverseEngineering, boolean isTransferable) {
this.isTransferable = isTransferable;
this.reverseEngineering = reverseEngineering;
DbImportModel model = (DbImportModel) this.getModel();
DbImportTreeNode root = (DbImportTreeNode) model.getRoot();
root.removeAllChildren();
root.setUserObject(reverseEngineering);
printCatalogs(reverseEngineering.getCatalogs(), root);
printSchemas(reverseEngineering.getSchemas(), root);
printIncludeTables(reverseEngineering.getIncludeTables(), root);
printParams(reverseEngineering.getExcludeTables(), root);
printParams(reverseEngineering.getIncludeColumns(), root);
printParams(reverseEngineering.getExcludeColumns(), root);
printParams(reverseEngineering.getIncludeProcedures(), root);
printParams(reverseEngineering.getExcludeProcedures(), root);
model.reload();
}
use of org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode in project cayenne by apache.
the class DbImportTree method printIncludeTables.
private void printIncludeTables(Collection<IncludeTable> collection, DbImportTreeNode parent) {
for (IncludeTable includeTable : collection) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(includeTable) : new TransferableNode(includeTable);
if (!node.getSimpleNodeName().equals("")) {
if (isTransferable && includeTable.getIncludeColumns().isEmpty() && includeTable.getExcludeColumns().isEmpty()) {
printParams(Collections.singletonList(new IncludeColumn("Loading...")), node);
}
printParams(includeTable.getIncludeColumns(), node);
printParams(includeTable.getExcludeColumns(), node);
parent.add(node);
}
}
}
Aggregations