use of org.apache.cayenne.modeler.action.LoadDbSchemaAction 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.action.LoadDbSchemaAction in project cayenne by apache.
the class DbImportView method buildForm.
private void buildForm() {
FormLayout buttonPanelLayout = new FormLayout(BUTTON_PANEL_LAYOUT);
DefaultFormBuilder buttonBuilder = new DefaultFormBuilder(buttonPanelLayout);
buttonBuilder.append(draggableTreePanel.getMoveButton());
buttonBuilder.append(draggableTreePanel.getMoveInvertButton());
FormLayout layout = new FormLayout(MAIN_LAYOUT);
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.append(treeToolbar, ALL_LINE_SPAN);
FormLayout headerLayout = new FormLayout(HEADER_LAYOUT);
DefaultFormBuilder reverseEngineeringHeaderBuilder = new DefaultFormBuilder(headerLayout);
JLabel importLabel = new JLabel("Database Import Configuration");
importLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
reverseEngineeringHeaderBuilder.append(importLabel);
builder.append(reverseEngineeringHeaderBuilder.getPanel());
DefaultFormBuilder databaseHeaderBuilder = new DefaultFormBuilder(headerLayout);
JLabel schemaLabel = new JLabel("Database Schema");
schemaLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
databaseHeaderBuilder.append(schemaLabel);
LoadDbSchemaAction loadDbSchemaAction = projectController.getApplication().getActionManager().getAction(LoadDbSchemaAction.class);
loadDbSchemaAction.setDraggableTreePanel(draggableTreePanel);
loadDbSchemaButton = (CayenneAction.CayenneToolbarButton) loadDbSchemaAction.buildButton(0);
loadDbSchemaButton.setShowingText(false);
loadDbSchemaButton.setText("Refresh DB Schema");
treeToolbar.add(loadDbSchemaButton);
ReverseEngineeringAction reverseEngineeringAction = projectController.getApplication().getActionManager().getAction(ReverseEngineeringAction.class);
reverseEngineeringAction.setView(this);
CayenneAction.CayenneToolbarButton reverseEngineeringButton = (CayenneAction.CayenneToolbarButton) reverseEngineeringAction.buildButton(0);
reverseEngineeringButton.setShowingText(true);
reverseEngineeringButton.setText("Run Import");
JPanel reverseEngineeringButtonPanel = new JPanel();
reverseEngineeringButtonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
reverseEngineeringButtonPanel.add(reverseEngineeringButton);
treeToolbar.addSeparator();
treeToolbar.add(reverseEngineeringButtonPanel);
builder.append("");
builder.append(databaseHeaderBuilder.getPanel());
builder.append(treePanel);
builder.append(buttonBuilder.getPanel());
builder.append(draggableTreePanel);
loadDbSchemaProgress = new JProgressBar();
reverseEngineeringProgress = new JProgressBar();
loadDbSchemaProgress.setIndeterminate(true);
loadDbSchemaProgress.setVisible(false);
reverseEngineeringProgress.setIndeterminate(true);
reverseEngineeringProgress.setVisible(false);
FormLayout progressLayout = new FormLayout(PROGRESS_PANEL_LAYOUT, "fill:10dlu");
DefaultFormBuilder progressBarBuilder = new DefaultFormBuilder(progressLayout);
progressBarBuilder.append(reverseEngineeringProgress);
progressBarBuilder.append(loadDbSchemaProgress);
builder.append(progressBarBuilder.getPanel(), ALL_LINE_SPAN);
createAdvancedOptionsHiderPanel(builder);
builder.append(configPanel, ALL_LINE_SPAN);
this.setLayout(new BorderLayout());
add(builder.getPanel(), BorderLayout.CENTER);
}
Aggregations