From: <wu...@us...> - 2008-02-22 12:47:03
|
Revision: 53 http://davinspector.svn.sourceforge.net/davinspector/?rev=53&view=rev Author: wuest Date: 2008-02-22 04:46:54 -0800 (Fri, 22 Feb 2008) Log Message: ----------- Completed and corrected Comments and package description. Added TableCellRenderer for PluginConfigurationDialog. Implemented configuring of the plugins for server and client. Modified Paths: -------------- trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java trunk/DAVInspector/src/de/dlr/davinspector/ui/package.html Added Paths: ----------- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableCellRenderer.java Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-02-21 10:33:17 UTC (rev 52) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-02-22 12:46:54 UTC (rev 53) @@ -1,7 +1,7 @@ /* * AboutDialog.java * - * TODO: wues_ha Enter comment! + * The about dialog displays information about the program. * * Created: 16.01.2008 Jochen Wuest <joc...@dl...> * Changed: @@ -40,7 +40,7 @@ import de.dlr.davinspector.common.Util; /** - * TODO: wues_ha: Enter comment! + * The about dialog displays information about the program. * * @version $LastChangedRevision$ * @author Jochen Wuest @@ -60,7 +60,7 @@ /** * */ - private JButton jButton = null; + private JButton jButtonOk = null; /** * @@ -75,12 +75,12 @@ /** * */ - private JLabel jLabel1 = null; + private JLabel jLabelAppIcon = null; /** * */ - private JLabel jLabel = null; + private JLabel jLabelAppName = null; /** * @param owner Parent Frame @@ -109,7 +109,7 @@ if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); - jContentPane.add(getJButton(), BorderLayout.SOUTH); + jContentPane.add(getJButtonOk(), BorderLayout.SOUTH); jContentPane.add(getJTextPane(), BorderLayout.CENTER); jContentPane.add(getJPanel(), BorderLayout.NORTH); } @@ -117,8 +117,7 @@ } /** - * TODO: wues_ha: Enter comment! - * + * This method closes the window. */ public void closeWindow() { this.setVisible(false); @@ -130,17 +129,17 @@ * * @return javax.swing.JButton */ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setText("Ok"); - jButton.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeWindow(); } }); } - return jButton; + return jButtonOk; } /** @@ -166,19 +165,14 @@ */ private JPanel getJPanel() { if (jPanel == null) { - //ImageIcon iiLogo = createImageIcon("icons/davinspector_trans.gif", ""); - //JLabel logo = new JLabel(iiLogo); - //logo.setHorizontalAlignment(AbstractButton.CENTER); - //jPanel.add(logo, BorderLayout.NORTH); - - jLabel = new JLabel(); - jLabel.setText(" " + Constant.APP_TITLE); - jLabel1 = new JLabel(); - jLabel1.setIcon(UIResource.getIcon(UIResource.ICON_APP32)); + jLabelAppName = new JLabel(); + jLabelAppName.setText(" " + Constant.APP_TITLE); + jLabelAppIcon = new JLabel(); + jLabelAppIcon.setIcon(UIResource.getIcon(UIResource.ICON_APP32)); jPanel = new JPanel(); jPanel.setLayout(new BorderLayout()); - jPanel.add(jLabel1, BorderLayout.WEST); - jPanel.add(jLabel, BorderLayout.CENTER); + jPanel.add(jLabelAppIcon, BorderLayout.WEST); + jPanel.add(jLabelAppName, BorderLayout.CENTER); } return jPanel; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java 2008-02-21 10:33:17 UTC (rev 52) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java 2008-02-22 12:46:54 UTC (rev 53) @@ -1,7 +1,7 @@ /* * ConfigurationDialog.java * - * TODO: wues_ha Enter comment! + * Displays the configuration dialog to configure the application. * * Created: 19.12.2007 Jochen Wuest <joc...@dl...> * Changed: @@ -42,7 +42,7 @@ import de.dlr.davinspector.configuration.Configuration; /** - * TODO: wues_ha: Enter comment! + * Displays the configuration dialog to configure the application. * * @version $LastChangedRevision$ * @author Jochen Wuest @@ -53,52 +53,66 @@ * */ private static final long serialVersionUID = 1L; + /** * */ private JPanel jContentPane = null; + /** * */ private JLabel jLabelServerPort = null; + /** * */ private JLabel jLabelClientAddress = null; + /** * */ private JLabel jLabelClientPort = null; + /** * */ private JLabel jLabelServerAddress = null; + /** * */ private JButton jButtonCancel = null; + /** * */ private JTextField jTextFieldClientPort = null; + /** * */ private JTextField jTextFieldServerPort = null; + /** * */ private JTextField jTextFieldServerAddress = null; + /** * */ private JTextField jTextFieldClientAddress = null; + /** * */ private JButton jButtonOk = null; + /** - * @param owner Owner of the Dialog. + * Constructor of the configuration dialog. + * + * @param owner Frame */ public ConfigurationDialog(Frame owner) { super(owner); @@ -158,7 +172,7 @@ } /** - * This method initializes jButton. + * This method initializes jButtonCancel. * * @return javax.swing.JButton */ @@ -178,8 +192,7 @@ } /** - * TODO: wues_ha: Enter comment! - * + * This method closes the window. */ public void closeWindow() { this.setVisible(false); @@ -187,8 +200,7 @@ } /** - * TODO: wues_ha: Enter comment! - * + * This method saves the current configuration. */ public void saveConfiguration() { Configuration config = new Configuration(); @@ -197,62 +209,63 @@ config.setServerAddress(jTextFieldServerAddress.getText()); config.setServerPort(jTextFieldServerPort.getText()); config.storeConfiguration(); - // TODO: aktualisierung proxy!! ### + // TODO: refresh/restart the relay with the new configuration } /** - * This method initializes jTextField. + * This method initializes jTextFieldClientPort. * * @return javax.swing.JTextField */ private JTextField getJTextFieldClientPort() { if (jTextFieldClientPort == null) { jTextFieldClientPort = new JTextField(); - jTextFieldClientPort.setText("8888"); + jTextFieldClientPort.setText(String.valueOf(Constant.RELAY_CLIENTPORT)); } return jTextFieldClientPort; } /** - * This method initializes jTextField1. + * This method initializes jTextFieldServerPort. * * @return javax.swing.JTextField */ private JTextField getJTextFieldServerPort() { if (jTextFieldServerPort == null) { jTextFieldServerPort = new JTextField(); - jTextFieldServerPort.setText("8080"); + jTextFieldServerPort.setText(String.valueOf(Constant.RELAY_SERVERPORT)); } return jTextFieldServerPort; } /** - * This method initializes jTextField2. + * This method initializes jTextFieldServerAddress. * * @return javax.swing.JTextField */ private JTextField getJTextFieldServerAddress() { if (jTextFieldServerAddress == null) { jTextFieldServerAddress = new JTextField(); - jTextFieldServerAddress.setText("localhost"); + jTextFieldServerAddress.setText(Constant.RELAY_SERVERADDRESS); } return jTextFieldServerAddress; } /** - * This method initializes jTextField3. + * This method initializes jTextFieldClientAddress. * * @return javax.swing.JTextField */ private JTextField getJTextFieldClientAddress() { if (jTextFieldClientAddress == null) { jTextFieldClientAddress = new JTextField(); + jTextFieldClientAddress.setText(Constant.RELAY_CLIENTADDRESS); } return jTextFieldClientAddress; } /** - * This method initializes jButton1. + * This method initializes jButtonOk. * * @return javax.swing.JButton */ @@ -270,5 +283,4 @@ } return jButtonOk; } - } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-02-21 10:33:17 UTC (rev 52) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-02-22 12:46:54 UTC (rev 53) @@ -1,7 +1,7 @@ /* * MainController.java * - * TODO: wues_ha Enter comment! + * This class is the controller for the relay model. * * Created: 29.01.2008 Jochen Wuest <joc...@dl...> * Changed: @@ -30,7 +30,7 @@ /** - * TODO: wues_ha: Enter comment! + * This class is the controller for the relay model. * * @version $LastChangedRevision$ * @author Jochen W\xFCst @@ -40,21 +40,21 @@ /** * */ - private IRelayModel relay; + private IRelayModel myRelay; /** * */ - private MainView view; + private MainView myView; /** - * TODO: wues_ha: enter comment! + * Constructor of the MainController. * * @param model RelayModelInterface */ public MainController(IRelayModel model) { - relay = model; - view = new MainView(this, relay); + myRelay = model; + myView = new MainView(this, myRelay); } /** @@ -64,7 +64,7 @@ */ public void startRelay() { Configuration config = new Configuration(); - relay.startRelay(config, System.out, System.err); + myRelay.startRelay(config, System.out, System.err); } /** @@ -73,7 +73,7 @@ * @see de.dlr.DAVInspector.UI.IMainController#stopRelay() */ public void stopRelay() { - relay.stopRelay(); + myRelay.stopRelay(); } /** @@ -82,7 +82,7 @@ * @see de.dlr.DAVInspector.UI.IMainController#writeToClient(java.lang.String) */ public void writeToClient(String data) { - relay.writeToClient(data); + myRelay.writeToClient(data); } /** @@ -91,6 +91,6 @@ * @see de.dlr.DAVInspector.UI.IMainController#writeToServer(java.lang.String) */ public void writeToServer(String data) { - relay.writeToServer(data); + myRelay.writeToServer(data); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-02-21 10:33:17 UTC (rev 52) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-02-22 12:46:54 UTC (rev 53) @@ -1,7 +1,7 @@ /* * MainView.java * - * TODO: wues_ha Enter comment! + * The main window of the application. * * Created: 09.11.2007 Jochen Wuest <joc...@dl...> * Changed: @@ -50,236 +50,234 @@ import javax.swing.JTable; import javax.swing.JTextPane; import javax.swing.JToggleButton; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.common.Util; import de.dlr.davinspector.history.HistoryTableCellRenderer; import de.dlr.davinspector.history.HistoryTableModel; +import de.dlr.davinspector.history.INewMessageListener; +import de.dlr.davinspector.history.IRefreshMessageListener; +import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.MessageEvent; import de.dlr.davinspector.plugin.IPlugin; -import de.dlr.davinspector.plugin.IPlugin.PlugInType; import de.dlr.davinspector.plugin.IViewPlugin; import de.dlr.davinspector.plugin.PluginManager; -import de.dlr.davinspector.relay.IClientListener; import de.dlr.davinspector.relay.IRelayModel; -import de.dlr.davinspector.relay.IServerListener; /** - * TODO: wues_ha: Enter comment! - * TODO: aktualisierung auf server und clientseite verbessern. + * The main window of the application. * * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class MainView implements IClientListener, IServerListener { +public class MainView implements INewMessageListener, IRefreshMessageListener { /** - * + * Position of the horizontal divider. (float, middle) */ private static final double DIVIDER_HORZ = 0.5; /** - * + * Position of the vertical divider. (pixel) */ private static final int DIVIDER_VERT = 450; /** - * + * Relay model. */ - private IRelayModel relay; + private IRelayModel myRelay; + /** - * + * Controller. */ - private IMainController controller; + private IMainController myController; /** - * + * Main window. */ - private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="115,38" + private JFrame jFrame = null; /** - * + * Content pane. */ private JPanel jContentPane = null; + /** - * + * Horizontal splitter. */ - private JSplitPane jSplitPane = null; + private JSplitPane jSplitPaneHorizontal = null; + /** - * + * Button "send to server". */ private JButton jBtnSendToServer = null; + /** - * + * Menu bar. */ private JMenuBar jJMenuBar = null; + /** - * + * File menu. */ - private JMenu jMenu = null; + private JMenu jMenuFile = null; + /** - * + * Menu item "exit". */ - private JMenuItem jMenuItem = null; + private JMenuItem jMenuItemExit = null; + /** - * + * View menu. */ - private JMenu jMenu1 = null; + private JMenu jMenuView = null; + /** - * + * Menu item "clear all". */ - private JMenuItem jMenuItem1 = null; + private JMenuItem jMenuItemClearAll = null; + /** - * + * Button "send to client". */ private JButton jBtnSendToClient = null; + /** - * + * Menu item "clear left". */ - private JMenuItem jMenuItem2 = null; + private JMenuItem jMenuItemClearLeft = null; + /** - * + * Menu item "clear right". */ - private JMenuItem jMenuItem3 = null; + private JMenuItem jMenuItemClearRight = null; + /** - * + * Client text pane. */ private JTextPane jTextPaneClientRaw = null; /** - * + * Client tab pane. */ - private String clientHeader = ""; // @jve:decl-index=0: - /** - * - */ - private String clientBody = ""; // @jve:decl-index=0: - /** - * - */ - private String serverHeader = ""; // @jve:decl-index=0: - /** - * - */ - private String serverBody = ""; // @jve:decl-index=0: - - /** - * - */ private JTabbedPane jTabbedPaneClient = null; + /** - * + * Scroll pane for client text pane. */ private JScrollPane jScrollPaneClientRaw = null; /** - * + * Help menu. */ - private JMenu jMenu2 = null; + private JMenu jMenuHelp = null; /** - * + * Menu item "configure". */ - private JMenuItem jMenuItem4 = null; + private JMenuItem jMenuItemConfigure = null; /** - * + * Server tab pane. */ private JTabbedPane jTabbedPaneServer = null; /** - * + * Scroll pane for server text pane. */ - private JScrollPane getJScrollPaneServerRaw = null; + private JScrollPane jScrollPaneServerRaw = null; /** - * + * Server text pane. */ private JTextPane jTextPaneServerRaw = null; /** - * + * Menu item "aboout". */ - private JMenuItem jMenuItem5 = null; + private JMenuItem jMenuItemAbout = null; /** - * + * Plugin menu. */ - private JMenu jMenu3 = null; + private JMenu jMenuPlugins = null; /** - * + * Menu item "configure plugins". */ - private JMenuItem jMenuItem6 = null; + private JMenuItem jMenuItemConfigurePlugins = null; /** - * + * Configuration dialog. */ - private ConfigurationDialog configDialog = null; + private ConfigurationDialog myConfigDialog = null; /** - * + * Plugin configuration dialog. */ - private PluginConfigurationDialog pluginConfigDialog = null; + private PluginConfigurationDialog myPluginConfigurationDialog = null; /** - * + * Vertical Splitter. */ - private JSplitPane jSplitPane1 = null; + private JSplitPane jSplitPaneVertical = null; /** - * + * Panel containing the history table. */ - private JPanel jPanel = null; + private JPanel jPanelHistory = null; /** - * + * Panel containing the control buttons for the relay. (left and right) */ - private JPanel jPanel1 = null; + private JPanel jPanelButtonBar = null; /** - * + * Panel containing the control buttons for the relay. (middle) */ - private JPanel jPanel2 = null; + private JPanel jPanelToggleButtonBar = null; /** - * + * This table displays the history. */ - private JTable jTable = null; + private JTable jTableHistory = null; /** - * + * Scroll pane for history. */ - private JScrollPane jScrollPane = null; + private JScrollPane jScrollPaneTableHistory = null; /** - * + * Table model for History. */ - private HistoryTableModel myTableModel; + private HistoryTableModel myHistoryTableModel; /** - * + * About dialog. */ - private AboutDialog aboutDialog; + private AboutDialog myAboutDialog; /** - * + * Toggle button for starting and stopping the relay. */ - private JToggleButton jToggleButton = null; + private JToggleButton jToggleButtonRelay = null; /** - * + * Current state of the relay. */ - private Boolean relayActive = false; + private Boolean myRelayIsActive = false; /** - * + * Toggle button for controlling the auto mode. */ - private JToggleButton jToggleButton1 = null; + private JToggleButton jToggleButtonAutomode = null; /** - * + * Plugin manager. */ - private PluginManager pluginManager = null; + private PluginManager myPluginManager = null; /** * Action: Exit program. @@ -299,7 +297,7 @@ }; /** - * Action: TODO: description. + * Action: Send data to the server. */ private Action sendToServerAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -310,14 +308,13 @@ } public void actionPerformed(ActionEvent e) { - updateMessages(jTextPaneClientRaw.getText(), true); - controller.writeToServer(jTextPaneClientRaw.getText()); + myController.writeToServer(jTextPaneClientRaw.getText()); jTextPaneClientRaw.setText(""); } }; /** - * Action: TODO: description. + * Action: Send data to the client. */ private Action sendToClientAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -328,14 +325,13 @@ } public void actionPerformed(ActionEvent e) { - updateMessages(jTextPaneServerRaw.getText(), false); - controller.writeToClient(jTextPaneServerRaw.getText()); + myController.writeToClient(jTextPaneServerRaw.getText()); jTextPaneServerRaw.setText(""); } }; /** - * Action: TODO: description. + * Action: Open configuration dialog. */ private Action configureAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -346,15 +342,15 @@ } public void actionPerformed(ActionEvent e) { - if (configDialog == null) { - configDialog = new ConfigurationDialog(jFrame); + if (myConfigDialog == null) { + myConfigDialog = new ConfigurationDialog(jFrame); } - configDialog.setVisible(true); + myConfigDialog.setVisible(true); } }; /** - * Action: TODO: description. + * Action: Open plugin configuration dialog. */ private Action configurePluginsAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -365,16 +361,16 @@ } public void actionPerformed(ActionEvent e) { - if (pluginConfigDialog == null) { - pluginConfigDialog = new PluginConfigurationDialog(jFrame); + if (myPluginConfigurationDialog == null) { + myPluginConfigurationDialog = new PluginConfigurationDialog(jFrame, myPluginManager); } - pluginConfigDialog.addPlugins(pluginManager.getAvailablePlugins()); - pluginConfigDialog.setVisible(true); + myPluginConfigurationDialog.addPlugins(myPluginManager.getAvailablePlugins()); + myPluginConfigurationDialog.setVisible(true); } }; /** - * Action: TODO: description. + * Action: Open about dialog. */ private Action aboutAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -385,15 +381,15 @@ } public void actionPerformed(ActionEvent e) { - if (aboutDialog == null) { - aboutDialog = new AboutDialog(jFrame); + if (myAboutDialog == null) { + myAboutDialog = new AboutDialog(jFrame); } - aboutDialog.setVisible(true); + myAboutDialog.setVisible(true); } }; /** - * Action: TODO: description. + * Action: Start or stop the relay. */ private Action relayAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -405,26 +401,26 @@ public void actionPerformed(ActionEvent e) { - if (relayActive) { + if (myRelayIsActive) { putValue(Action.NAME, "Start Relay"); putValue(Action.SHORT_DESCRIPTION, "Start the relay."); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_START)); // TODO: Move to ctrl - relayActive = false; - controller.stopRelay(); + myRelayIsActive = false; + myController.stopRelay(); } else { putValue(Action.NAME, "Stop Relay"); putValue(Action.SHORT_DESCRIPTION, "Stop the relay."); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_STOP)); // TODO: Move to ctrl - controller.startRelay(); - relayActive = true; + myController.startRelay(); + myRelayIsActive = true; } } }; /** - * Action: TODO: description. + * Action: Clear content of left raw pane. */ private Action clearLeftAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -440,7 +436,7 @@ }; /** - * Action: TODO: description. + * Action: Clear content of right raw pane. */ private Action clearRightAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -456,7 +452,7 @@ }; /** - * Action: TODO: description. + * Action: Clear content of both raw panes. */ private Action clearAllAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -473,7 +469,7 @@ }; /** - * Action: TODO: description. + * Action: Enable or disable automode. */ private Action automodeAction = new AbstractAction() { static final long serialVersionUID = 1L; @@ -489,22 +485,24 @@ }; /** - * TODO: wues_ha: enter comment! - * @param ctrl MainControllerInterface - * @param model RelayModelInterface + * Constructor of MainView. Initializes the GUI elements, + * loads the plugins and registers listeners. + * + * @param controller MainControllerInterface + * @param relay RelayModelInterface */ - public MainView(IMainController ctrl, IRelayModel model) { + public MainView(IMainController controller, IRelayModel relay) { Util.setUIDesign(); - relay = model; - controller = ctrl; + myRelay = relay; + myController = controller; + + myRelay.getMessageHistory().addNewMessageListener(this); + myRelay.getMessageHistory().addRefreshMessageListener(this); - relay.registerClientListener((IClientListener) this); - relay.registerServerListener((IServerListener) this); + myPluginManager = PluginManager.getInstance(); + myPluginManager.loadAllPlugins(); - pluginManager = PluginManager.getInstance(); - pluginManager.loadAllPlugins(); - jFrame = getJFrame(); jFrame.pack(); jFrame.setVisible(true); @@ -513,28 +511,6 @@ } /** - * {@inheritDoc} - * - * @see de.dlr.DAVInspector.Relay.IClientListener#updateClient(java.lang.String) - */ - public void updateClient(String data) { -// System.out.println("CU " + data); - jTextPaneClientRaw.setText(data); - updateMessages(data, false); - } - - /** - * {@inheritDoc} - * - * @see de.dlr.DAVInspector.Relay.IServerListener#updateServer(java.lang.String) - */ - public void updateServer(String data) { -// System.out.println("SU " + data); - jTextPaneServerRaw.setText(data); - updateMessages(data, true); - } - - /** * This method initializes jFrame. * * @return javax.swing.JFrame @@ -542,7 +518,6 @@ private JFrame getJFrame() { if (jFrame == null) { jFrame = new JFrame(); - // jFrame.setIconImage(createImageIcon("icons/davinspector.gif", "")); jFrame.setSize(new Dimension(Constant.UI_MAIN_WINDOW_WIDTH, Constant.UI_MAIN_WINDOW_HEIGHT)); jFrame.setContentPane(getJContentPane()); jFrame.setJMenuBar(getJJMenuBar()); @@ -550,7 +525,6 @@ jFrame.setIconImage(UIResource.getIcon(UIResource.ICON_APP32).getImage()); jFrame.addWindowListener(new java.awt.event.WindowAdapter() { - public void windowOpened(java.awt.event.WindowEvent e) { // windowOpened() } @@ -564,8 +538,6 @@ return jFrame; } - - /** * This method initializes jContentPane. * @@ -576,12 +548,12 @@ jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); jContentPane.setPreferredSize(new Dimension(Constant.UI_MAIN_WINDOW_WIDTH, Constant.UI_MAIN_WINDOW_HEIGHT)); - jContentPane.add(getJSplitPane1(), BorderLayout.CENTER); - jContentPane.add(getJPanel1(), BorderLayout.NORTH); + jContentPane.add(getJSplitPaneVertical(), BorderLayout.CENTER); + jContentPane.add(getJPanelButtonBar(), BorderLayout.NORTH); jContentPane.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent e) { - //resize - jSplitPane.setDividerLocation(DIVIDER_HORZ); + // resize + jSplitPaneHorizontal.setDividerLocation(DIVIDER_HORZ); } }); } @@ -589,131 +561,56 @@ } /** - * This method initializes jSplitPane. + * {@inheritDoc} * - * @return javax.swing.JSplitPane + * @see de.dlr.davinspector.history.INewMessageListener#newMessage(de.dlr.davinspector.history.MessageEvent) */ - private JSplitPane getJSplitPane() { - if (jSplitPane == null) { - jSplitPane = new JSplitPane(); - jSplitPane.setLeftComponent(getJTabbedPaneClient()); - jSplitPane.setRightComponent(getJTabbedPaneServer()); - jSplitPane.setDividerLocation(DIVIDER_HORZ); - } - return jSplitPane; + public void newMessage(MessageEvent newMessageEvent) { + Message msg = newMessageEvent.getMessage(); + updateMessage(msg); } - + /** - * This method initializes jButton. + * {@inheritDoc} * - * @return javax.swing.JButton + * @see de.dlr.davinspector.history.IRefreshMessageListener#refreshMessage(de.dlr.davinspector.history.MessageEvent) */ - private JButton getJButtonSendToServer() { - if (jBtnSendToServer == null) { - jBtnSendToServer = new JButton(sendToServerAction); - jBtnSendToServer.setHorizontalTextPosition(AbstractButton.LEADING); - } - return jBtnSendToServer; + public void refreshMessage(MessageEvent refreshMessageEvent) { + Message msg = refreshMessageEvent.getMessage(); + updateMessage(msg); } /** - * This method initializes jJMenuBar. - * - * @return javax.swing.JMenuBar + * This method refreshes the content of the raw views and the loaded plugins. + * + * @param message Message */ - private JMenuBar getJJMenuBar() { - if (jJMenuBar == null) { - jJMenuBar = new JMenuBar(); - jJMenuBar.add(getJMenu()); - jJMenuBar.add(getJMenu1()); - jJMenuBar.add(getJMenu3()); - jJMenuBar.add(getJMenu2()); - } - return jJMenuBar; + private void updateMessage(Message message) { + if (message.getMessageType().equals(Message.MessageType.Request)) { + jTextPaneClientRaw.setText(message.getData()); + myPluginManager.updateActivePluginsClient(message); + } else { + jTextPaneServerRaw.setText(message.getData()); + myPluginManager.updateActivePluginsServer(message); + } } /** - * This method initializes jMenu. + * This method initializes jBtnSendToServer. * - * @return javax.swing.JMenu + * @return javax.swing.JButton */ - private JMenu getJMenu() { - if (jMenu == null) { - jMenu = new JMenu(); - jMenu.setText("File"); - jMenu.setMnemonic(KeyEvent.VK_F); - jMenu.add(getJMenuItem4()); - jMenu.add(getJMenuItem()); + private JButton getJButtonSendToServer() { + if (jBtnSendToServer == null) { + jBtnSendToServer = new JButton(sendToServerAction); + jBtnSendToServer.setHorizontalTextPosition(AbstractButton.LEADING); } - return jMenu; + return jBtnSendToServer; } - + /** - * This method initializes jMenuItem. + * This method initializes jBtnSendToClient. * - * @return javax.swing.JMenuItem - */ - private JMenuItem getJMenuItem() { - if (jMenuItem == null) { - jMenuItem = new JMenuItem(); - jMenuItem.setAction(exitAction); - } - return jMenuItem; - } - - /** - * This method initializes jMenu1. - * - * @return javax.swing.JMenu - */ - private JMenu getJMenu1() { - if (jMenu1 == null) { - jMenu1 = new JMenu(); - jMenu1.setText("View"); - jMenu1.setMnemonic(KeyEvent.VK_V); - jMenu1.add(getJMenuItem1()); - jMenu1.add(getJMenuItem2()); - jMenu1.add(getJMenuItem3()); - } - return jMenu1; - } - - /** - * TODO: wues_ha: Enter comment! - * - * @param data Data - * @param tC Boolean Client to Server - */ - private void updateMessages(String data, Boolean tC) { - // store Message - - // update history table - //myTableModel.addRow(new Object[]{msg.getClientToSever(), msg.getId(), msg.getTimestamp(), msg.getSize()}); - //myTableModel.fireTableDataChanged(); - - //update plugins - List<IPlugin> plugged = pluginManager.getAvailablePlugins(); - for (Iterator<IPlugin> iterator = plugged.iterator(); iterator.hasNext();) { - IPlugin plugin = (IPlugin) iterator.next(); - plugin.update(data); - } - } - - /** - * This method initializes jMenuItem1. - * - * @return javax.swing.JMenuItem - */ - private JMenuItem getJMenuItem1() { - if (jMenuItem1 == null) { - jMenuItem1 = new JMenuItem(clearAllAction); - } - return jMenuItem1; - } - - /** - * This method initializes jButton1. - * * @return javax.swing.JButton */ private JButton getJButtonSendToClient() { @@ -725,414 +622,416 @@ } /** - * This method initializes jMenuItem2. + * This method initializes jTextPaneClientRaw. * - * @return javax.swing.JMenuItem + * @return javax.swing.JTextPane */ - private JMenuItem getJMenuItem2() { - if (jMenuItem2 == null) { - jMenuItem2 = new JMenuItem(clearLeftAction); + private JTextPane getJTextPaneClientRaw() { + if (jTextPaneClientRaw == null) { + jTextPaneClientRaw = new JTextPane(); + jTextPaneClientRaw.setText(""); + jTextPaneClientRaw.setEditable(true); + jTextPaneClientRaw.setBackground(SystemColor.info); } - return jMenuItem2; + return jTextPaneClientRaw; } - /** - * This method initializes jMenuItem3. + /** + * This method initializes jTabbedPaneClient. * - * @return javax.swing.JMenuItem + * @return javax.swing.JTabbedPane */ - private JMenuItem getJMenuItem3() { - if (jMenuItem3 == null) { - jMenuItem3 = new JMenuItem(clearRightAction); + private JTabbedPane getJTabbedPaneClient() { + if (jTabbedPaneClient == null) { + jTabbedPaneClient = new JTabbedPane(); + jTabbedPaneClient.addTab("Raw", null, getJScrollPaneClientRaw(), null); + + //update plugins + if (myPluginManager != null) { + List<IPlugin> plugged = myPluginManager.getActivePluginsClient(); + for (Iterator<IPlugin> iterator = plugged.iterator(); iterator.hasNext();) { + IPlugin plugin = (IPlugin) iterator.next(); + IViewPlugin viewPlugin = (IViewPlugin) plugin; + JScrollPane jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(viewPlugin.getUI()); + jTabbedPaneClient.addTab(viewPlugin.getName(), null, jScrollPane, null); + } + } } - return jMenuItem3; + return jTabbedPaneClient; } /** - * TODO: wues_ha: Enter comment! + * This method initializes jScrollPaneClientRaw. * - * @return String Body of the message + * @return javax.swing.JScrollPane */ - public String getClientBody() { - return clientBody; + private JScrollPane getJScrollPaneClientRaw() { + if (jScrollPaneClientRaw == null) { + jScrollPaneClientRaw = new JScrollPane(); + jScrollPaneClientRaw.setVisible(false); + jScrollPaneClientRaw.setViewportView(getJTextPaneClientRaw()); + } + return jScrollPaneClientRaw; } /** - * TODO: wues_ha: Enter comment! + * This method initializes jTabbedPaneServer. * - * @return String Header of the message + * @return javax.swing.JTabbedPane. */ - public String getClientHeader() { - return clientHeader; - } + private JTabbedPane getJTabbedPaneServer() { + if (jTabbedPaneServer == null) { + jTabbedPaneServer = new JTabbedPane(); + jTabbedPaneServer.addTab("Raw", null, getJScrollPaneServerRaw(), null); - /** - * TODO: wues_ha: Enter comment! - * - * @return String Body of the message - */ - public String getServerBody() { - return serverBody; + //update plugins + if (myPluginManager != null) { + List<IPlugin> plugged = myPluginManager.getActivePluginsServer(); + for (Iterator<IPlugin> iterator = plugged.iterator(); iterator.hasNext();) { + IPlugin plugin = (IPlugin) iterator.next(); + IViewPlugin viewPlugin = (IViewPlugin) plugin; + JScrollPane jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(viewPlugin.getUI()); + jTabbedPaneServer.addTab(viewPlugin.getName(), null, jScrollPane, null); + } + } + } + return jTabbedPaneServer; } /** - * TODO: wues_ha: Enter comment! + * This method initializes getJScrollPaneServerRaw. * - * @return String Header of the message + * @return javax.swing.JScrollPane */ - public String getServerHeader() { - return serverHeader; + private JScrollPane getJScrollPaneServerRaw() { + if (jScrollPaneServerRaw == null) { + jScrollPaneServerRaw = new JScrollPane(); + jScrollPaneServerRaw.setViewportView(getJTextPaneServerRaw()); + } + return jScrollPaneServerRaw; } /** - * TODO: wues_ha: Enter comment! + * This method initializes jTextPaneServerRaw. * - * @param raw String raw input + * @return javax.swing.JTextPane */ - public void setRawInputClient(String raw) { - clientBody = getBody(raw); - clientHeader = getHeader(raw); - /* - if (containsBody(raw)) { - clientBody = getBody(raw); - clientHeader = getHeader(raw); - } else { - clientBody = ""; - clientHeader = raw; + private JTextPane getJTextPaneServerRaw() { + if (jTextPaneServerRaw == null) { + jTextPaneServerRaw = new JTextPane(); + jTextPaneServerRaw.setBackground(SystemColor.info); } - */ + return jTextPaneServerRaw; } /** - * TODO: wues_ha: Enter comment! + * This method initializes jJMenuBar. * - * @param raw String raw input + * @return javax.swing.JMenuBar */ - public void setRawInputServer(String raw) { - serverBody = getBody(raw); - serverHeader = getHeader(raw); + private JMenuBar getJJMenuBar() { + if (jJMenuBar == null) { + jJMenuBar = new JMenuBar(); + jJMenuBar.add(getJMenuFile()); + jJMenuBar.add(getJMenuView()); + jJMenuBar.add(getJMenuPlugins()); + jJMenuBar.add(getJMenuHelp()); + } + return jJMenuBar; } /** - * TODO: wues_ha: Enter comment! + * This method initializes jMenuFile. * - * @param input String containig http packet - * @return String with body + * @return javax.swing.JMenu */ - private String getBody(String input) { - String result = ""; - - // HTTP/1.1 HTTP/1.0 HTTP/0.9 - // TODO: split input into different HTTP messages - //String[] httpMessages = input.split("HTTP/[1.1|1.0|0.9]{1}"); - - // TODO: nur die erste Nachricht wird angezeigt - //input = httpMessages[0]; - - String[] s = input.split("\r\n\r\n"); - for (int i = 1; i < s.length; i++) { - result = s[i]; + private JMenu getJMenuFile() { + if (jMenuFile == null) { + jMenuFile = new JMenu(); + jMenuFile.setText("File"); + jMenuFile.setMnemonic(KeyEvent.VK_F); + jMenuFile.add(getJMenuItemConfigure()); + jMenuFile.add(getJMenuItemExit()); } - - - // detect and process chunked data - // split the input in the different chunks. - // each chunk starts with the length of the chunk in hex. - String[] lines = result.split("(\r\n[0-9a-fA-F]+\r\n)"); - result = ""; - for (int i = 0; i < lines.length; i++) { - result += lines[i]; - } - - return result; + return jMenuFile; } /** - * TODO: wues_ha: Enter comment! + * This method initializes jMenuItemExit. * - * @param input String containing http packet - * @return String with headers + * @return javax.swing.JMenuItem */ - private String getHeader(String input) { - String[] s = input.split("\r\n\r\n"); - return s[0]; + private JMenuItem getJMenuItemExit() { + if (jMenuItemExit == null) { + jMenuItemExit = new JMenuItem(); + jMenuItemExit.setAction(exitAction); + } + return jMenuItemExit; } /** - * This method initializes jTextPane. + * This method initializes jMenuView. * - * @return javax.swing.JTextPane + * @return javax.swing.JMenu */ - private JTextPane getJTextPaneClientRaw() { - if (jTextPaneClientRaw == null) { - jTextPaneClientRaw = new JTextPane(); - jTextPaneClientRaw.setText(""); - jTextPaneClientRaw.setEditable(true); - jTextPaneClientRaw.setBackground(SystemColor.info); + private JMenu getJMenuView() { + if (jMenuView == null) { + jMenuView = new JMenu(); + jMenuView.setText("View"); + jMenuView.setMnemonic(KeyEvent.VK_V); + jMenuView.add(getJMenuItemClearAll()); + jMenuView.add(getJMenuItemClearLeft()); + jMenuView.add(getJMenuItemClearRight()); } - return jTextPaneClientRaw; + return jMenuView; } - /** - * This method initializes jTabbedPane1. - * - * @return javax.swing.JTabbedPane - */ - private JTabbedPane getJTabbedPaneClient() { - if (jTabbedPaneClient == null) { - jTabbedPaneClient = new JTabbedPane(); - jTabbedPaneClient.addTab("Raw", null, getJScrollPaneClientRaw(), null); - - //update plugins - // TODO: load only chosen plugins - if (pluginManager != null) { - List<IPlugin> plugged = pluginManager.getAvailablePlugins(); - for (Iterator<IPlugin> iterator = plugged.iterator(); iterator.hasNext();) { - IPlugin plugin = (IPlugin) iterator.next(); - if (plugin.getType() == PlugInType.VIEW_GENERAL || plugin.getType() == PlugInType.VIEW_CLIENT) { - IViewPlugin viewPlugin = (IViewPlugin) plugin; - JScrollPane jSP = new JScrollPane(); - jSP.setViewportView(viewPlugin.getUI()); - jTabbedPaneClient.addTab(viewPlugin.getName(), null, jSP, null); - } - } - } - } - return jTabbedPaneClient; - } - /** - * This method initializes jScrollPane. + * This method initializes jMenuItemClearAll. * - * @return javax.swing.JScrollPane + * @return javax.swing.JMenuItem */ - private JScrollPane getJScrollPaneClientRaw() { - if (jScrollPaneClientRaw == null) { - jScrollPaneClientRaw = new JScrollPane(); - jScrollPaneClientRaw.setVisible(false); - jScrollPaneClientRaw.setViewportView(getJTextPaneClientRaw()); + private JMenuItem getJMenuItemClearAll() { + if (jMenuItemClearAll == null) { + jMenuItemClearAll = new JMenuItem(clearAllAction); } - return jScrollPaneClientRaw; + return jMenuItemClearAll; } /** - * This method initializes jMenu2. + * This method initializes jMenuItemClearLeft. * - * @return javax.swing.JMenu + * @return javax.swing.JMenuItem */ - private JMenu getJMenu2() { - if (jMenu2 == null) { - jMenu2 = new JMenu(); - jMenu2.setText("Help"); - jMenu2.setMnemonic(KeyEvent.VK_HELP); - jMenu2.add(getJMenuItem5()); + private JMenuItem getJMenuItemClearLeft() { + if (jMenuItemClearLeft == null) { + jMenuItemClearLeft = new JMenuItem(clearLeftAction); } - return jMenu2; + return jMenuItemClearLeft; } /** - * This method initializes jMenuItem4. + * This method initializes jMenuItemClearRight. * * @return javax.swing.JMenuItem */ - private JMenuItem getJMenuItem4() { - if (jMenuItem4 == null) { - jMenuItem4 = new JMenuItem(configureAction); + private JMenuItem getJMenuItemClearRight() { + if (jMenuItemClearRight == null) { + jMenuItemClearRight = new JMenuItem(clearRightAction); } - return jMenuItem4; + return jMenuItemClearRight; } /** - * This method initializes jTabbedPane. + * This method initializes jMenuHelp. * - * @return javax.swing.JTabbedPane. + * @return javax.swing.JMenu */ - private JTabbedPane getJTabbedPaneServer() { - if (jTabbedPaneServer == null) { - jTabbedPaneServer = new JTabbedPane(); - jTabbedPaneServer.addTab("Raw", null, getJScrollPaneServerRaw(), null); + private JMenu getJMenuHelp() { + if (jMenuHelp == null) { + jMenuHelp = new JMenu(); + jMenuHelp.setText("Help"); + jMenuHelp.setMnemonic(KeyEvent.VK_HELP); + jMenuHelp.add(getJMenuItemAbout()); } - return jTabbedPaneServer; + return jMenuHelp; } /** - * This method initializes jScrollPane1. + * This method initializes jMenuItemConfigure. * - * @return javax.swing.JScrollPane + * @return javax.swing.JMenuItem */ - private JScrollPane getJScrollPaneServerRaw() { - if (getJScrollPaneServerRaw == null) { - getJScrollPaneServerRaw = new JScrollPane(); - getJScrollPaneServerRaw.setViewportView(getJTextPaneServerRaw()); + private JMenuItem getJMenuItemConfigure() { + if (jMenuItemConfigure == null) { + jMenuItemConfigure = new JMenuItem(configureAction); } - return getJScrollPaneServerRaw; + return jMenuItemConfigure; } /** - * This method initializes jTextPane1. + * This method initializes jMenuItemAbout. * - * @return javax.swing.JTextPane + * @return javax.swing.JMenuItem */ - private JTextPane getJTextPaneServerRaw() { - if (jTextPaneServerRaw == null) { - jTextPaneServerRaw = new JTextPane(); - jTextPaneServerRaw.setBackground(SystemColor.info); + private JMenuItem getJMenuItemAbout() { + if (jMenuItemAbout == null) { + jMenuItemAbout = new JMenuItem(aboutAction); } - return jTextPaneServerRaw; + return jMenuItemAbout; } /** - * This method initializes jMenuItem5. + * This method initializes jMenuPlugins. * - * @return javax.swing.JMenuItem + * @return javax.swing.JMenu */ - private JMenuItem getJMenuItem5() { - if (jMenuItem5 == null) { - jMenuItem5 = new JMenuItem(aboutAction); + private JMenu getJMenuPlugins() { + if (jMenuPlugins == null) { + jMenuPlugins = new JMenu(); + jMenuPlugins.setText("Plugins"); + jMenuPlugins.add(getJMenuItemConfigurePlugins()); } - return jMenuItem5; + return jMenuPlugins; } /** - * This method initializes jMenu3. + * This method initializes jMenuItemConfigurePlugins. * - * @return javax.swing.JMenu + * @return javax.swing.JMenuItem. */ - private JMenu getJMenu3() { - if (jMenu3 == null) { - jMenu3 = new JMenu(); - jMenu3.setText("Plugins"); - jMenu3.add(getJMenuItem6()); + private JMenuItem getJMenuItemConfigurePlugins() { + if (jMenuItemConfigurePlugins == null) { + jMenuItemConfigurePlugins = new JMenuItem(configurePluginsAction); } - return jMenu3; + return jMenuItemConfigurePlugins; } /** - * This method initializes jMenuItem6. + * This method initializes jSplitPaneHorizontal. * - * @return javax.swing.JMenuItem. + * @return javax.swing.JSplitPane */ - private JMenuItem getJMenuItem6() { - if (jMenuItem6 == null) { - jMenuItem6 = new JMenuItem(configurePluginsAction); + private JSplitPane getJSplitPaneHorizontal() { + if (jSplitPaneHorizontal == null) { + jSplitPaneHorizontal = new JSplitPane(); + jSplitPaneHorizontal.setLeftComponent(getJTabbedPaneClient()); + jSplitPaneHorizontal.setRightComponent(getJTabbedPaneServer()); + jSplitPaneHorizontal.setDividerLocation(DIVIDER_HORZ); } - return jMenuItem6; + return jSplitPaneHorizontal; } /** - * This method initializes jSplitPane1. + * This method initializes jSplitPaneVertical. * * @return javax.swing.JSplitPane */ - private JSplitPane getJSplitPane1() { - if (jSplitPane1 == null) { - jSplitPane1 = new JSplitPane(); - jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); - jSplitPane1.setDividerLocation(DIVIDER_VERT); - jSplitPane1.setBottomComponent(getJPanel()); - jSplitPane1.setTopComponent(getJSplitPane()); + private JSplitPane getJSplitPaneVertical() { + if (jSplitPaneVertical == null) { + jSplitPaneVertical = new JSplitPane(); + jSplitPaneVertical.setOrientation(JSplitPane.VERTICAL_SPLIT); + jSplitPaneVertical.setDividerLocation(DIVIDER_VERT); + jSplitPaneVertical.setBottomComponent(getJPanelHistory()); + jSplitPaneVertical.setTopComponent(getJSplitPaneHorizontal()); } - return jSplitPane1; + return jSplitPaneVertical; } /** - * This method initializes jPanel. + * This method initializes jPanelHistory. * * @return javax.swing.JPanel */ - private JPanel getJPanel() { - if (jPanel == null) { - jPanel = new JPanel(); - jPanel.setLayout(new BorderLayout()); - jPanel.add(getJScrollPane(), BorderLayout.CENTER); + private JPanel getJPanelHistory() { + if (jPanelHistory == null) { + jPanelHistory = new JPanel(); + jPanelHistory.setLayout(new BorderLayout()); + jPanelHistory.add(getJScrollPaneTableHistory(), BorderLayout.CENTER); } - return jPanel; + return jPanelHistory; } /** - * This method initializes jPanel1. + * This method initializes jPanelButtonBar. * * @return javax.swing.JPanel */ - private JPanel getJPanel1() { - if (jPanel1 == null) { - jPanel1 = new JPanel(); - jPanel1.setLayout(new BorderLayout()); - jPanel1.add(getJButtonSendToServer(), BorderLayout.WEST); - jPanel1.add(getJPanel2(), BorderLayout.CENTER); - jPanel1.add(getJButtonSendToClient(), BorderLayout.EAST); + private JPanel getJPanelButtonBar() { + if (jPanelButtonBar == null) { + jPanelButtonBar = new JPanel(); + jPanelButtonBar.setLayout(new BorderLayout()); + jPanelButtonBar.add(getJButtonSendToServer(), BorderLayout.WEST); + jPanelButtonBar.add(getJPanelToggleButtonBar(), BorderLayout.CENTER); + jPanelButtonBar.add(getJButtonSendToClient(), BorderLayout.EAST); } - return jPanel1; + return jPanelButtonBar; } /** - * This method initializes jPanel2. + * This method initializes jPanelToggleButtonBar. * * @return javax.swing.JPanel */ - private JPanel getJPanel2() { - if (jPanel2 == null) { - jPanel2 = new JPanel(); - jPanel2.setLayout(new GridBagLayout()); - jPanel2.add(getJToggleButton()); - jPanel2.add(getJToggleButton1(), null); + private JPanel getJPanelToggleButtonBar() { + if (jPanelToggleButtonBar == null) { + jPanelToggleButtonBar = new JPanel(); + jPanelToggleButtonBar.setLayout(new GridBagLayout()); + jPanelToggleButtonBar.add(getJToggleButtonRelay()); + jPanelToggleButtonBar.add(getJToggleButtonAutomode(), null); } - return jPanel2; + return jPanelToggleButtonBar; } /** - * This method initializes jTable. + * This method initializes jTableHistory. * * @return javax.swing.JTable */ - private JTable getJTable() { + private JTable getJTableHistory() { - if (jTable == null) { - myTableModel = new HistoryTableModel(); + if (jTableHistory == null) { + myHistoryTableModel = new HistoryTableModel(); + // TODO: getMessageHistory restructure model/relay + myRelay.getMessageHistory().addNewMessageListener(myHistoryTableModel); - jTable = new JTable(myTableModel); - jTable.setShowGrid(true); - jTable.setAutoCreateRowSorter(true); + jTableHistory = new JTable(myHistoryTableModel); + jTableHistory.setShowGrid(true); + jTableHistory.setAutoCreateRowSorter(true); + jTableHistory.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent event) { + if (event.getValueIsAdjusting()) { + return; + } + int rowIndex = jTableHistory.getSelectedRow(); + if (rowIndex >= 0 && rowIndex < jTableHistory.getRowCount()) { + int id = (Integer) jTableHistory.getValueAt(rowIndex, 1); + myRelay.getMessageHistory().loadMessageByID(id); + } + } + }); - jTable.setDefaultRenderer(Object.class, new HistoryTableCellRenderer()); + jTableHistory.setDefaultRenderer(Object.class, new HistoryTableCellRenderer()); } - return jTable; + return jTableHistory; } /** - * This method initializes jScrollPane. + * This method initializes jScrollPaneTableHistory. * * @return javax.swing.JScrollPane */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJTable()); + private JScrollPane getJScrollPaneTableHistory() { + if (jScrollPaneTableHistory == null) { + jScrollPaneTableHistory = new JScrollPane(); + jScrollPaneTableHistory.setViewportView(getJTableHistory()); } - return jScrollPane; + return jScrollPaneTableHistory; } /** - * This method initializes jToggleButton. + * This method initializes jToggleButtonRelay. * * @return javax.swing.JToggleButton */ - private JToggleButton getJToggleButton() { - if (jToggleButton == null) { - jToggleButton = new JToggleButton(relayAction); + private JToggleButton getJToggleButtonRelay() { + if (jToggleButtonRelay == null) { + jToggleButtonRelay = new JToggleButton(relayAction); } - return jToggleButton; + return jToggleButtonRelay; } /** - * This method initializes jToggleButton1. + * This method initializes jToggleButtonAutomode. * * @return javax.swing.JToggleButton */ - private JToggleButton getJToggleButton1() { - if (jToggleButton1 == null) { - jToggleButton1 = new JToggleButton(automodeAction); + private JToggleButton getJToggleButtonAutomode() { + if (jToggleButtonAutomode == null) { + jToggleButtonAutomode = new JToggleButton(automodeAction); } - return jToggleButton1; + return jToggleButtonAutomode; } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java 2008-02-21 10:33:17 UTC (rev 52) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java 2008-02-22 12:46:54 UTC (rev 53) @@ -1,7 +1,7 @@ /* * PluginConfigurationDialog.java * - * TODO: wues_ha Enter comment! + * Displays the configuration dialog to configure the plugins. * * Created: 10.01.2008 Jochen Wuest <joc...@dl...> * Changed: @@ -28,7 +28,10 @@ import java.awt.BorderLayout; import java.awt.Frame; import java.awt.Window; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Vector; import javax.swing.JButton; import javax.swing.JDialog; @@ -39,9 +42,10 @@ import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.common.Util; import de.dlr.davinspector.plugin.IPlugin; +import de.dlr.davinspector.plugin.PluginManager; /** - * TODO: wues_ha: Enter comment! + * Displays the configuration dialog to configure the plugins. * * @version $LastChangedRevision$ * @author Jochen Wuest @@ -52,53 +56,92 @@ * */ private static final long serialVersionUID = 1L; + /** * */ private JPanel jContentPane = null; + /** * */ private JScrollPane jScrollPane = null; + /** * */ - private JPanel jPanel1 = null; + private JPanel jPanelButtonBar = null; + /** * */ private JTable jTable = null; + /** * */ - private JButton jButton = null; + private JButton jButtonCancel = null; + /** * */ - private JButton jButton1 = null; + private JButton jButtonOk = null; + + /** + * Stores the availability of a plugin for client and server. + */ + private Map<String, Boolean[]> myAvailablePlugins = new HashMap<String, Boolean[]>(); + + /** + * The plugin manager. + */ + private PluginManager myPluginManager = null; /** - * + * Table model of the plugin configuration table. */ private PluginConfigurationTableModel myTableModel; - + /... [truncated message content] |