/** * initialize the main screen * * @param screen */ public void setScreen(final MainScreen screen) { this._screen = screen; addActions(); /* * wire panels */ // Tables panel DatasourcesPresenter ds = new DatasourcesPresenter(_eventBus); ds.setSources(_model.getSources()); ds.setTables(_model.getTables()); ds.setPanel(screen.getDatasourcesPanel()); // Schema panel SchemaPresenter sp = new SchemaPresenter(_eventBus); sp.setPanels(screen.getDimensionPanel(), screen.getMeauresPanel()); // ToolsLibrary panel ToolsPresenter tp = new ToolsPresenter(_eventBus); tp.setPanel(screen.getToolsPanel()); tp.setFactories(Arrays.asList(ToolsLibrary.factories)); // set up the main workspace Workspace workspace = new Workspace(); screen.setWorkspace(workspace); WorkspacePresenter presenter = new WorkspacePresenter(_eventBus, _model); presenter.setView(workspace); // do something? // selectWorkspace(); }
/** selectWorkspace */ public void selectWorkspace() { ObjectProperty<String> selection = _screen.selectWorkspace(_workspaces); selection.addListener( new ChangeListener<String>() { @Override public void changed( ObservableValue<? extends String> arg0, String oldVal, String newVal) {} }); }
private void addActions() { _screen .onAddDatasource() .set( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { final DatatableWizard wizard = new DatatableWizard(); wizard.setItems(_model.getSources()); wizard.setSelectedSource(_model.getSelectedDatasource()); ObjectProperty<Table> selection = wizard.show(_screen.getWindow()); // wizard.getDataSources() selection.addListener( new ChangeListener<Table>() { @Override public void changed( ObservableValue<? extends Table> arg0, Table oldVal, Table newVal) { _model.getTables().add(newVal); _model.setSelectedDatasource(wizard.getSelectedSource()); } }); } }); _screen .onSelectWorkspace() .set( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { // TODO Auto-generated method stub selectWorkspace(); } }); _screen .onSave() .set( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { save(); } }); _screen .onQuit() .set( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { quit(); } }); }