Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/gui4j/dflt/UserInformation.java


1   package org.gui4j.dflt;
2   
3   import org.gui4j.util.Translator;
4   
5   /**
6    * Kann verwendet werden um in der Applikation den Programmablaug 
7    * zu unterbrechen um den Benutzer über ein Problem zu informieren.
8    * Wird insbesondere von Gui4j verwendet für die Validierung von
9    * Eingabewerten.
10   */
11  public class UserInformation extends RuntimeException
12  {
13    private final String informationTag;
14    private final Object[] informationArgs;
15    
16    /**
17     * Constructor for UserInformation.
18     * @param informationTag
19     * @param informationArgs
20     */
21    public UserInformation(String informationTag, Object[] informationArgs)
22    {
23      super(informationTag);
24      this.informationTag = informationTag;
25      this.informationArgs = informationArgs;
26    }
27      
28      public UserInformation(String informationTag)
29      {
30          this(informationTag,null);
31      }
32  
33    public UserInformation(String informationTag, Object[] informationArgs, Throwable cause)
34    {
35      super(informationTag, cause);
36      this.informationTag = informationTag;
37      this.informationArgs = informationArgs;
38    }
39    
40      /**
41       * Liefert den übersetzten Text zurück
42       * @param translator
43       * @return String
44       */
45    public String getInformationMessage(Translator translator)
46    {
47      return translator.translate(informationTag, informationArgs);
48    }
49      
50      public Object[] getInformationArgs() {
51          return informationArgs;
52      }
53  
54      public String getInformationTag() {
55          return informationTag;
56      }
57  
58      public String toString()
59      {
60          return getClass().getName() + "[" + informationTag + ", " + informationArgs.length + "]";
61      }
62  
63  }