Ignore:
Timestamp:
07/06/13 03:51:11 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add proper exception passing between communication sides:

if exception occur during handling client request, it is
automatically passed as comment to error response.

it may be used to snoop communication between peers

  • fix algorithm choosing text controls in GUI
  • allow GUI testing in virtual frame buffer (xvfb)

FEST had some problem with xvfb but workaround was found

supports tab-completion based on requests history

CHANGELOG:
Further improve handling of exceptions in GUI.

Add StatusBar? implementing ExceptionResultHandler?.

Make completion processing asynchronous.

Minor changes.

Improve completion in console.

Improve history in InteractiveConsole?.

First working version of DirectConsole?.

Minor changes.

Make Connection.address non final.

It is more suitable to use in configuration.

Improvement of consoles.

Improve PopupMenu? and closing of FrameJoinable?.

Fix BrowserTest?.

Found bug with FEST running under xvfb.

JButtonFixture.click() is not working under xvfb.
GuiTest? has wrapper which uses JButton.doClick() directly.

Store CompositeParam? param in TreeNode?.

Simplify ClientSideManagedConnection? connecting.

There is now connectedFunctor needed, ApplicationRequests? can be
send right after creation. They are buffered until the version
and features are negotiated.

Narow down interface of ClientSideManagedConnection?.

Allow that connection specialization send only
ApplicationRequests?.

Improve policy of text control choosing.

Change name of Genotype in BrowserTest?.

Make BrowserTest? change name of Genotype.

Minor change.

First working draft of TrackConsole?.

Simplify Consoles.

More improvements with gui joinables.

Unify initialization on gui joinables.

More rework of Frame based entities.

Refactorize structure of JFrames based entities.

Extract GuiTest? from BrowserBaseTest?.

Reorganize Console classes structure.

Add Collection view to JoinableCollection?.

Configure timeout in testing.

Minor changes.

Rework connections hierarchy.

Add Mode to the get operation.

Make get and set in Tree take PrimitiveParam?.

Unify naming of operations.

Make RunAt? use the given ExceptionHandler?.

It wraps the virtual runAt() method call with
try-catch passing exception to handler.

Force RunAt? to include ExceptionHandler?.

Improve ClientAtServer?.

Minor change.

Another sweep with FindBugs?.

Rename Instance to Tree.

Minor changes.

Minor changes.

Further clarify semantics of Futures.

Add FutureHandler?.

FutureHandler? is refinement of Future, that proxifies
exception handling to ExceptionResultHandler? given
at construction time.

Remove StateFunctor? (use Future<Void> instead).

Make Connection use Future<Void>.

Unparametrize *ResponseFuture?.

Remove StateCallback? not needed anymore.

Distinguish between sides of ResponseFuture?.

Base ResponseCallback? on Future (now ResponseFuture?).

Make asynchronous store taking Future for flags.

Implement storeValue in ObjectInstance?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/gui/MainFrame.java

    r88 r97  
    11package com.framsticks.gui;
    22
    3 import com.framsticks.gui.windows.console.ConsoleFrame;
    4 import com.framsticks.util.swing.MenuConstructor;
    5 import org.apache.log4j.Logger;
    6 
    7 import javax.swing.*;
    8 import javax.swing.border.TitledBorder;
    9 import java.awt.*;
    103import java.awt.event.ActionEvent;
    11 import java.awt.event.ActionListener;
    124import java.awt.event.KeyEvent;
    135import java.awt.event.WindowAdapter;
    146import java.awt.event.WindowEvent;
     7
     8import javax.swing.AbstractAction;
     9import javax.swing.JButton;
     10import javax.swing.KeyStroke;
     11import javax.swing.WindowConstants;
     12
     13import org.apache.log4j.Logger;
     14
     15import com.framsticks.util.swing.MenuConstructor;
    1516
    1617/**
     
    2829         */
    2930        public MainFrame(final Browser browser) {
    30                 super("framsticks", browser);
     31                super(browser);
     32                setTitle("framsticks");
    3133                log.debug("creating main frame");
    3234
     
    3537
    3638        @Override
    37         public void configure() {
    38                 super.configure();
     39        protected void initializeGui() {
     40                super.initializeGui();
    3941
    4042                new MenuConstructor(fileMenu)
     
    4244                                @Override
    4345                                public void actionPerformed(ActionEvent actionEvent) {
    44                                         showConsoleFrame();
     46                                        // showConsoleFrame();
    4547                                }
    4648                        })
     
    145147        // }
    146148
    147         public void setSimulationRunning(final boolean run) {
    148                 assert isActive();
    149                 /*
    150                 remoteInstance.invokeLater(new Runnable() {
    151                         @Override
    152                         public void run() {
    153                                 remoteInstance.setRunning(run);
    154                         }
    155                 });
    156                 */
    157         }
    158 
    159         /**
    160          * Creates panel with start, step, stop buttons.
    161          */
    162         @Override
    163         protected JPanel createLeftTopPanel() {
    164                 assert isActive();
    165                 Dimension buttonDimension = new Dimension(45, 45);
    166 
    167                 JPanel panel = new JPanel();
    168 
    169                 stop = new JButton(ImageProvider.loadImage(ImageProvider.SIM_STOP));
    170                 stop.addActionListener(new ActionListener() {
    171 
    172                         public void actionPerformed(ActionEvent e) {
    173                                 setSimulationRunning(false);
    174                         }
    175 
    176                 });
    177 
    178                 stop.setPreferredSize(buttonDimension);
    179                 stop.setToolTipText("Simulation Stop");
    180                 stop.setEnabled(false);
    181 
    182                 step = new JButton(ImageProvider.loadImage(ImageProvider.SIM_STEP));
    183                 /*
    184                 step.addActionListener(new ActionListener() {
    185 
    186                         public void actionPerformed(ActionEvent e) {
    187                                 connection.send(new CallQuery().setMethod("step").setPath("/simulator"));
    188                         }
    189 
    190                 });
    191                 */
    192 
    193                 step.setPreferredSize(buttonDimension);
    194                 step.setToolTipText("Simulation Step");
    195 
    196                 start = new JButton(ImageProvider.loadImage(ImageProvider.SIM_START));
    197                 start.addActionListener(new ActionListener() {
    198 
    199                         public void actionPerformed(ActionEvent e) {
    200                                 setSimulationRunning(true);
    201                         }
    202 
    203                 });
    204 
    205                 start.setPreferredSize(buttonDimension);
    206                 start.setToolTipText("Start Simulation");
    207 
    208                 JPanel buttonPanel = new JPanel();
    209                 buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
    210                 buttonPanel.add(Box.createHorizontalStrut(5));
    211                 buttonPanel.add(stop);
    212                 buttonPanel.add(Box.createHorizontalStrut(10));
    213                 buttonPanel.add(step);
    214                 buttonPanel.add(Box.createHorizontalStrut(10));
    215                 buttonPanel.add(start);
    216                 buttonPanel.add(Box.createHorizontalStrut(5));
    217 
    218                 buttonPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory
    219                                 .createRaisedBevelBorder(), "Simulation Control",
    220                                 TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION
    221                                 ));
    222 
    223                 panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
    224                 panel.add(Box.createHorizontalGlue());
    225                 panel.add(buttonPanel);
    226                 panel.add(Box.createHorizontalGlue());
    227                 return panel;
    228         }
     149
     150        // /**
     151        //  * Creates panel with start, step, stop buttons.
     152        //  */
     153        // @Override
     154        // protected JPanel createLeftTopPanel() {
     155        //      assert isActive();
     156        //      Dimension buttonDimension = new Dimension(45, 45);
     157
     158        //      JPanel panel = new JPanel();
     159
     160        //      stop = new JButton(ImageProvider.loadImage(ImageProvider.SIM_STOP));
     161        //      stop.addActionListener(new ActionListener() {
     162
     163        //              public void actionPerformed(ActionEvent e) {
     164        //                      setSimulationRunning(false);
     165        //              }
     166
     167        //      });
     168
     169        //      stop.setPreferredSize(buttonDimension);
     170        //      stop.setToolTipText("Simulation Stop");
     171        //      stop.setEnabled(false);
     172
     173        //      step = new JButton(ImageProvider.loadImage(ImageProvider.SIM_STEP));
     174        //      /*
     175        //      step.addActionListener(new ActionListener() {
     176
     177        //              public void actionPerformed(ActionEvent e) {
     178        //                      connection.send(new CallQuery().setMethod("step").setPath("/simulator"));
     179        //              }
     180
     181        //      });
     182        //      */
     183
     184        //      step.setPreferredSize(buttonDimension);
     185        //      step.setToolTipText("Simulation Step");
     186
     187        //      start = new JButton(ImageProvider.loadImage(ImageProvider.SIM_START));
     188        //      start.addActionListener(new ActionListener() {
     189
     190        //              public void actionPerformed(ActionEvent e) {
     191        //                      setSimulationRunning(true);
     192        //              }
     193
     194        //      });
     195
     196        //      start.setPreferredSize(buttonDimension);
     197        //      start.setToolTipText("Start Simulation");
     198
     199        //      JPanel buttonPanel = new JPanel();
     200        //      buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
     201        //      buttonPanel.add(Box.createHorizontalStrut(5));
     202        //      buttonPanel.add(stop);
     203        //      buttonPanel.add(Box.createHorizontalStrut(10));
     204        //      buttonPanel.add(step);
     205        //      buttonPanel.add(Box.createHorizontalStrut(10));
     206        //      buttonPanel.add(start);
     207        //      buttonPanel.add(Box.createHorizontalStrut(5));
     208
     209        //      buttonPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory
     210        //                      .createRaisedBevelBorder(), "Simulation Control",
     211        //                      TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION
     212        //                      ));
     213
     214        //      panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
     215        //      panel.add(Box.createHorizontalGlue());
     216        //      panel.add(buttonPanel);
     217        //      panel.add(Box.createHorizontalGlue());
     218        //      return panel;
     219        // }
    229220
    230221        /**
     
    233224        private void setFrameProperties() {
    234225                assert isActive();
    235                 swing.setMinimumSize(swing.getPreferredSize());
    236                 swing.setSize(swing.getPreferredSize());
    237                 swing.setMaximumSize(screenDimension);
    238                 swing.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    239 
    240                 swing.setIconImage(ImageProvider.loadImage(ImageProvider.LOGO)
     226                getSwing().setMinimumSize(getSwing().getPreferredSize());
     227                getSwing().setSize(getSwing().getPreferredSize());
     228                getSwing().setMaximumSize(screenDimension);
     229                getSwing().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
     230
     231                getSwing().setIconImage(ImageProvider.loadImage(ImageProvider.LOGO)
    241232                                .getImage());
    242233
    243234
    244                 swing.addWindowListener(new WindowAdapter() {
     235                getSwing().addWindowListener(new WindowAdapter() {
    245236                        public void windowClosing(WindowEvent e) {
    246237                                assert isActive();
     
    251242                                */
    252243                                onWindowClosing();
    253                                 swing.dispose();
     244                                getSwing().dispose();
    254245                        }
    255246                });
    256247        }
    257248
    258         public ConsoleFrame showConsoleFrame() {
    259                 assert isActive();
    260                 /*
    261                 ConsoleFrame consoleFrame = new ConsoleFrame(connection);
    262                 consoleFrame.show(MainFrame.this);
    263                 return consoleFrame;
    264                 */
    265                 return null;
    266         }
     249        // public ConsoleFrame showConsoleFrame() {
     250        //      assert isActive();
     251        //      /*
     252        //      ConsoleFrame consoleFrame = new ConsoleFrame(connection);
     253        //      consoleFrame.show(MainFrame.this);
     254        //      return consoleFrame;
     255        //      */
     256        //      return null;
     257        // }
    267258
    268259        /**
     
    271262        private void disconnect() {
    272263                assert isActive();
    273                 //remoteInstance.disconnect();
    274264                browser.clear();
    275265                onWindowClosing();
    276                 statusBar.setText("You are disconnected");
     266                // statusBar.setText("You are disconnected");
    277267        }
    278268
Note: See TracChangeset for help on using the changeset viewer.