File Source: DummyInputWindow.java

         /* 
    P/P   *  Method: com.dmdirc.addons.ui_dummy.DummyInputWindow__static_init
          */
     1  /*
     2   * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
     3   *
     4   * Permission is hereby granted, free of charge, to any person obtaining a copy
     5   * of this software and associated documentation files (the "Software"), to deal
     6   * in the Software without restriction, including without limitation the rights
     7   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     8   * copies of the Software, and to permit persons to whom the Software is
     9   * furnished to do so, subject to the following conditions:
    10   *
    11   * The above copyright notice and this permission notice shall be included in
    12   * all copies or substantial portions of the Software.
    13   *
    14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    20   * SOFTWARE.
    21   */
    22  
    23  package com.dmdirc.addons.ui_dummy;
    24  
    25  import com.dmdirc.WritableFrameContainer;
    26  import com.dmdirc.commandparser.parsers.CommandParser;
    27  import com.dmdirc.config.ConfigManager;
    28  import com.dmdirc.ui.input.InputHandler;
    29  import com.dmdirc.ui.interfaces.InputWindow;
    30  import com.dmdirc.util.StringTranscoder;
    31  
    32  import java.beans.PropertyVetoException;
    33  import java.nio.charset.Charset;
    34  import java.util.Arrays;
    35  
    36  /**
    37   * Dummy input window, used for testing.
    38   */
         /* 
    P/P   *  Method: FrameContainer getContainer()
          * 
          *  Postconditions:
          *    return_value == this.container
          *    init'ed(return_value)
          */
    39  public class DummyInputWindow implements InputWindow {
    40      
    41      /** Window title. */
    42      private String title;
    43      /** Are we visible? */
    44      private boolean visible;
    45      /** are we maximised? */
    46      private boolean maximised;
    47      /** Our container. */
    48      private final WritableFrameContainer container;
    49      /** Our command parser. */
    50      private final CommandParser commandParser;
    51      
    52      /** 
    53       * Instantiates a new DummyInputWindow.
    54       * 
    55       * @param owner Parent window
    56       * @param commandParser Parent command parser
    57       */
    58      public DummyInputWindow(final WritableFrameContainer owner, 
                     /* 
    P/P               *  Method: void com.dmdirc.addons.ui_dummy.DummyInputWindow(WritableFrameContainer, CommandParser)
                      * 
                      *  Postconditions:
                      *    this.commandParser == commandParser
                      *    init'ed(this.commandParser)
                      *    this.container == owner
                      *    init'ed(this.container)
                      */
    59              final CommandParser commandParser) {
    60          this.container = owner;
    61          this.commandParser = commandParser;
    62      }
    63      
    64      /** {@inheritDoc} */
    65      @Override
    66      public CommandParser getCommandParser() {
                 /* 
    P/P           *  Method: CommandParser getCommandParser()
                  * 
                  *  Postconditions:
                  *    return_value == this.commandParser
                  *    init'ed(return_value)
                  */
    67          return commandParser;
    68      }
    69      
    70      /** {@inheritDoc} */
    71      @Override
    72      public InputHandler getInputHandler() {
                 /* 
    P/P           *  Method: InputHandler getInputHandler()
                  * 
                  *  Postconditions:
                  *    return_value == &new DummyInputHandler(getInputHandler#1)
                  *    new DummyInputHandler(getInputHandler#1) num objects == 1
                  */
    73          return new DummyInputHandler(new DummyInputField(), null, this);
    74      }
    75      
    76      /** {@inheritDoc} */
    77      @Override
    78      public void setAwayIndicator(final boolean isAway) {
    79          // Do nothing
             /* 
    P/P       *  Method: void setAwayIndicator(bool)
              */
    80      }
    81      
    82      /** {@inheritDoc} */
    83      @Override
    84      public void addLine(final String messageType, final Object... args) {
                 /* 
    P/P           *  Method: void addLine(String, Object[])
                  * 
                  *  Presumptions:
                  *    java.lang.System.out != null
                  */
    85          System.out.println("DummyInputWindow.addLine(" + messageType + ", " + Arrays.toString(args) + ")");
    86      }
    87      
    88      /** {@inheritDoc} */
    89      @Override
    90      public void addLine(final StringBuffer messageType, final Object... args) {
                 /* 
    P/P           *  Method: void addLine(StringBuffer, Object[])
                  * 
                  *  Preconditions:
                  *    messageType != null
                  */
    91          addLine(messageType.toString(), args);
    92      }
    93      
    94      /** {@inheritDoc} */
    95      @Override
    96      public void addLine(final String line, final boolean timestamp) {
                 /* 
    P/P           *  Method: void addLine(String, bool)
                  *    addLine fails for all possible inputs
                  */
    97          throw new UnsupportedOperationException("Not supported yet.");
    98      }
    99      
   100      /** {@inheritDoc} */
   101      @Override
   102      public void clear() {
                 /* 
    P/P           *  Method: void clear()
                  *    clear fails for all possible inputs
                  */
   103          throw new UnsupportedOperationException("Not supported yet.");
   104      }
   105      
   106      /** {@inheritDoc} */
   107      @Override
   108      public ConfigManager getConfigManager() {
                 /* 
    P/P           *  Method: ConfigManager getConfigManager()
                  * 
                  *  Postconditions:
                  *    return_value == &new ConfigManager(getConfigManager#1)
                  *    new ConfigManager(getConfigManager#1) num objects == 1
                  */
   109          return new ConfigManager("dummy", "dummy", "dummy");
   110      }
   111      
   112      /** {@inheritDoc} */
   113      @Override
   114      public WritableFrameContainer getContainer() {
                 /* 
    P/P           *  Method: WritableFrameContainer getContainer()
                  * 
                  *  Postconditions:
                  *    return_value == this.container
                  *    init'ed(return_value)
                  */
   115          return container;
   116      }
   117      
   118      /** {@inheritDoc} */
   119      @Override
   120      public boolean isVisible() {
                 /* 
    P/P           *  Method: bool isVisible()
                  * 
                  *  Preconditions:
                  *    init'ed(this.visible)
                  * 
                  *  Postconditions:
                  *    return_value == this.visible
                  *    init'ed(return_value)
                  */
   121          return visible;
   122      }
   123      
   124      /** {@inheritDoc} */
   125      @Override
   126      public void setVisible(final boolean isVisible) {
                 /* 
    P/P           *  Method: void setVisible(bool)
                  * 
                  *  Postconditions:
                  *    this.visible == isVisible
                  *    init'ed(this.visible)
                  */
   127          visible = isVisible;
   128      }
   129      
   130      /** {@inheritDoc} */
   131      @Override
   132      public String getTitle() {
                 /* 
    P/P           *  Method: String getTitle()
                  * 
                  *  Preconditions:
                  *    init'ed(this.title)
                  * 
                  *  Postconditions:
                  *    return_value == this.title
                  *    init'ed(return_value)
                  */
   133          return title;
   134      }
   135      
   136      /** {@inheritDoc} */
   137      @Override
   138      public boolean isMaximum() {
                 /* 
    P/P           *  Method: bool isMaximum()
                  * 
                  *  Preconditions:
                  *    init'ed(this.maximised)
                  * 
                  *  Postconditions:
                  *    return_value == this.maximised
                  *    init'ed(return_value)
                  */
   139          return maximised;
   140      }
   141      
   142      /** 
   143       * {@inheritDoc} 
   144       * 
   145       * @param b maximised or not
   146       */
   147      public void setMaximum(final boolean b) {
                 /* 
    P/P           *  Method: void setMaximum(bool)
                  * 
                  *  Postconditions:
                  *    this.maximised == b
                  *    init'ed(this.maximised)
                  */
   148          maximised = b;
   149      }
   150      
   151      /** {@inheritDoc} */
   152      @Override
   153      public void setTitle(final String title) {
                 /* 
    P/P           *  Method: void setTitle(String)
                  * 
                  *  Postconditions:
                  *    this.title == title
                  *    init'ed(this.title)
                  */
   154          this.title = title;
   155      }
   156      
   157      /** {@inheritDoc} */
   158      @Override
   159      public void open() {
   160          // Do nothing
             /* 
    P/P       *  Method: void open()
              */
   161      }
   162      
   163      /** {@inheritDoc} */
   164      @Override
   165      public StringTranscoder getTranscoder() {
                 /* 
    P/P           *  Method: StringTranscoder getTranscoder()
                  * 
                  *  Postconditions:
                  *    return_value == &new StringTranscoder(getTranscoder#1)
                  *    new StringTranscoder(getTranscoder#1) num objects == 1
                  */
   166          return new StringTranscoder(Charset.defaultCharset());
   167      }
   168  
   169      /** {@inheritDoc} */
   170      @Override
   171      public void close() {
                 /* 
    P/P           *  Method: void close()
                  * 
                  *  Preconditions:
                  *    this.container != null
                  */
   172          container.windowClosing();
   173      }
   174  
   175      /** {@inheritDoc} */
   176      @Override
   177      public void restore() {
   178          // Do nothing
             /* 
    P/P       *  Method: void restore()
              */
   179      }
   180  
   181      /** {@inheritDoc} */
   182      @Override
   183      public void maximise() {
   184          // Do nothing
             /* 
    P/P       *  Method: void maximise()
              */
   185      }
   186  
   187      /** {@inheritDoc} */
   188      @Override
   189      public void toggleMaximise() {
   190          // Do nothing
             /* 
    P/P       *  Method: void toggleMaximise()
              */
   191      }
   192  
   193      /** {@inheritDoc} */
   194      @Override
   195      public void minimise() {
   196          // Do nothing
             /* 
    P/P       *  Method: void minimise()
              */
   197      }
   198  
   199      /** {@inheritDoc} */
   200      @Override
   201      public void activateFrame() {
   202          // Do nothing
             /* 
    P/P       *  Method: void activateFrame()
              */
   203      }
   204      
   205  }








SofCheck Inspector Build Version : 2.17854
DummyInputWindow.java 2009-Jun-25 01:54:24
DummyInputWindow.class 2009-Sep-02 17:04:15