/** * Reload the list of the connected clients and * show the dialog when the connection or the creation was successful. */ public void update(Observable source, final Object parameter) { if(parameter == ServerMng.UPDATE_LIST){ ConnectionInfo[] clients = model.getConnectedUsers(); if(clients != null) users.setListData(clients); else users.setListData(new String[] {""}); } else if( parameter == ServerMng.CONNECTED ) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { setVisible(true); } }); Dispatcher.initialize( progress ); } }
public void actionPerformed(ActionEvent e) { // Check whether all the required fields are present if (view.checkNonEmpty("name")) { if (model.getEditAuthor() == null) { // Save new author Task task = model.saveAuthor(); task.setPostTaskAction( new PostTaskAction() { public void afterStopped(Object value) { model.searchAuthor(false); try { model.processResults(model.getCurrentFirstRow(), model.getDisplayRows()); } catch (RemoteException ex) { logger.error( "RemoteException caught while processing search results. Details: " + ex.getMessage()); ex.printStackTrace(); DefaultExceptionHandler.handle(view, ex); return; } catch (DBLayerException ex) { logger.error( "RemoteException caught while processing search results. Details: " + ex.getMessage()); ex.printStackTrace(); DefaultExceptionHandler.handle(view, ex); return; } model.reloadCache(); } }); Dispatcher.getDispatcher().dispatch(task, view, false); } else { // Edit existing author Task task = model.editAuthor(); task.setPostTaskAction( new PostTaskAction() { public void afterStopped(Object value) { model.searchAuthor(false); try { model.processResults(model.getCurrentFirstRow(), model.getDisplayRows()); } catch (RemoteException ex) { logger.error( "RemoteException caught while processing search results. Details: " + ex.getMessage()); ex.printStackTrace(); DefaultExceptionHandler.handle(view, ex); return; } catch (DBLayerException ex) { logger.error( "RemoteException caught while processing search results. Details: " + ex.getMessage()); ex.printStackTrace(); DefaultExceptionHandler.handle(view, ex); return; } model.reloadCache(); } }); Dispatcher.getDispatcher().dispatch(task, view, false); } // Close the add dialog when save finished view.close(); } }