Biblioteca Java - Blame information for rev 32

Subversion Repositories:
Rev:
Rev Author Line No. Line
32 mihai 1 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>ElevatorUI.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">JaCoCoverage analysis of project &quot;ElevatorCurs&quot; (powered by JaCoCo from EclEmma)</a> &gt; <a href="index.source.html" class="el_package">elevatorcurs.ui</a> &gt; <span class="el_source">ElevatorUI.java</span></div><h1>ElevatorUI.java</h1><pre class="source lang-java linenums">/*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 package elevatorcurs.ui;
7  
8 import elevatorcurs.model.Elevator;
9 import java.util.Observable;
10 import java.util.Observer;
11  
12 /**
13  *
14  * @author Mihai Hulea mihai.hulea@aut.utcluj.ro
15  */
16 public class ElevatorUI extends javax.swing.JFrame implements Observer{
17  
18     ElevatorMVCController ctrl;
19     /**
20      * Creates new form ElevatorUI
21      */
22 <span class="nc" id="L22">    public ElevatorUI() {</span>
23 <span class="nc" id="L23">        initComponents();</span>
24 <span class="nc" id="L24">    }</span>
25  
26     public void initControler(ElevatorMVCController c){
27 <span class="nc" id="L27">        this.ctrl = c;</span>
28 <span class="nc" id="L28">    }</span>
29  
30     /**
31      * This method is called from within the constructor to initialize the form.
32      * WARNING: Do NOT modify this code. The content of this method is always
33      * regenerated by the Form Editor.
34      */
35     @SuppressWarnings(&quot;unchecked&quot;)
36     // &lt;editor-fold defaultstate=&quot;collapsed&quot; desc=&quot;Generated Code&quot;&gt;//GEN-BEGIN:initComponents
37     private void initComponents() {
38  
39 <span class="nc" id="L39">        jButton1 = new javax.swing.JButton();</span>
40 <span class="nc" id="L40">        jButton2 = new javax.swing.JButton();</span>
41 <span class="nc" id="L41">        jButton3 = new javax.swing.JButton();</span>
42 <span class="nc" id="L42">        jButton4 = new javax.swing.JButton();</span>
43 <span class="nc" id="L43">        jScrollPane1 = new javax.swing.JScrollPane();</span>
44 <span class="nc" id="L44">        jTextArea1 = new javax.swing.JTextArea();</span>
45  
46 <span class="nc" id="L46">        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);</span>
47  
48 <span class="nc" id="L48">        jButton1.setText(&quot;Floor 3&quot;);</span>
49 <span class="nc" id="L49">        jButton1.addActionListener(new java.awt.event.ActionListener() {</span>
50             public void actionPerformed(java.awt.event.ActionEvent evt) {
51 <span class="nc" id="L51">                jButton1ActionPerformed(evt);</span>
52 <span class="nc" id="L52">            }</span>
53         });
54  
55 <span class="nc" id="L55">        jButton2.setText(&quot;Floor 2&quot;);</span>
56 <span class="nc" id="L56">        jButton2.addActionListener(new java.awt.event.ActionListener() {</span>
57             public void actionPerformed(java.awt.event.ActionEvent evt) {
58 <span class="nc" id="L58">                jButton2ActionPerformed(evt);</span>
59 <span class="nc" id="L59">            }</span>
60         });
61  
62 <span class="nc" id="L62">        jButton3.setText(&quot;Floor 1&quot;);</span>
63 <span class="nc" id="L63">        jButton3.addActionListener(new java.awt.event.ActionListener() {</span>
64             public void actionPerformed(java.awt.event.ActionEvent evt) {
65 <span class="nc" id="L65">                jButton3ActionPerformed(evt);</span>
66 <span class="nc" id="L66">            }</span>
67         });
68  
69 <span class="nc" id="L69">        jButton4.setText(&quot;Floor 0&quot;);</span>
70 <span class="nc" id="L70">        jButton4.addActionListener(new java.awt.event.ActionListener() {</span>
71             public void actionPerformed(java.awt.event.ActionEvent evt) {
72 <span class="nc" id="L72">                jButton4ActionPerformed(evt);</span>
73 <span class="nc" id="L73">            }</span>
74         });
75  
76 <span class="nc" id="L76">        jTextArea1.setColumns(20);</span>
77 <span class="nc" id="L77">        jTextArea1.setRows(5);</span>
78 <span class="nc" id="L78">        jScrollPane1.setViewportView(jTextArea1);</span>
79  
80 <span class="nc" id="L80">        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());</span>
81 <span class="nc" id="L81">        getContentPane().setLayout(layout);</span>
82 <span class="nc" id="L82">        layout.setHorizontalGroup(</span>
83             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
84             .addGroup(layout.createSequentialGroup()
85                 .addContainerGap()
86                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
87                     .addComponent(jButton4)
88                     .addComponent(jButton1)
89                     .addComponent(jButton2)
90                     .addComponent(jButton3))
91                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
92                 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE)
93                 .addContainerGap())
94         );
95 <span class="nc" id="L95">        layout.setVerticalGroup(</span>
96             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
97             .addGroup(layout.createSequentialGroup()
98                 .addContainerGap()
99                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100                     .addComponent(jScrollPane1)
101                     .addGroup(layout.createSequentialGroup()
102                         .addComponent(jButton1)
103                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
104                         .addComponent(jButton2)
105                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
106                         .addComponent(jButton3)
107                         .addGap(15, 15, 15)
108                         .addComponent(jButton4)
109                         .addGap(0, 0, Short.MAX_VALUE)))
110                 .addContainerGap())
111         );
112  
113 <span class="nc" id="L113">        pack();</span>
114 <span class="nc" id="L114">    }// &lt;/editor-fold&gt;//GEN-END:initComponents</span>
115  
116     private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
117 <span class="nc" id="L117">        ctrl.executeFloorCommand(0);</span>
118 <span class="nc" id="L118">    }//GEN-LAST:event_jButton4ActionPerformed</span>
119  
120     private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
121 <span class="nc" id="L121">        ctrl.executeFloorCommand(1);</span>
122 <span class="nc" id="L122">    }//GEN-LAST:event_jButton3ActionPerformed</span>
123  
124     private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
125 <span class="nc" id="L125">        ctrl.executeFloorCommand(2);</span>
126 <span class="nc" id="L126">    }//GEN-LAST:event_jButton2ActionPerformed</span>
127  
128     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
129 <span class="nc" id="L129">        ctrl.executeFloorCommand(3);</span>
130 <span class="nc" id="L130">    }//GEN-LAST:event_jButton1ActionPerformed</span>
131  
132     /**
133      * @param args the command line arguments
134      */
135     public static void main(String args[]) {
136         /* Set the Nimbus look and feel */
137         //&lt;editor-fold defaultstate=&quot;collapsed&quot; desc=&quot; Look and feel setting code (optional) &quot;&gt;
138         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
139          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
140          */
141         try {
142 <span class="nc bnc" id="L142" title="All 2 branches missed.">            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {</span>
143 <span class="nc bnc" id="L143" title="All 2 branches missed.">                if (&quot;Nimbus&quot;.equals(info.getName())) {</span>
144 <span class="nc" id="L144">                    javax.swing.UIManager.setLookAndFeel(info.getClassName());</span>
145 <span class="nc" id="L145">                    break;</span>
146                 }
147             }
148 <span class="nc" id="L148">        } catch (ClassNotFoundException ex) {</span>
149 <span class="nc" id="L149">            java.util.logging.Logger.getLogger(ElevatorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);</span>
150 <span class="nc" id="L150">        } catch (InstantiationException ex) {</span>
151 <span class="nc" id="L151">            java.util.logging.Logger.getLogger(ElevatorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);</span>
152 <span class="nc" id="L152">        } catch (IllegalAccessException ex) {</span>
153 <span class="nc" id="L153">            java.util.logging.Logger.getLogger(ElevatorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);</span>
154 <span class="nc" id="L154">        } catch (javax.swing.UnsupportedLookAndFeelException ex) {</span>
155 <span class="nc" id="L155">            java.util.logging.Logger.getLogger(ElevatorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);</span>
156 <span class="nc" id="L156">        }</span>
157         //&lt;/editor-fold&gt;
158  
159         /* Create and display the form */
160 <span class="nc" id="L160">        java.awt.EventQueue.invokeLater(new Runnable() {</span>
161             public void run() {
162 <span class="nc" id="L162">                new ElevatorUI().setVisible(true);</span>
163 <span class="nc" id="L163">            }</span>
164         });
165 <span class="nc" id="L165">    }</span>
166  
167     // Variables declaration - do not modify//GEN-BEGIN:variables
168     private javax.swing.JButton jButton1;
169     private javax.swing.JButton jButton2;
170     private javax.swing.JButton jButton3;
171     private javax.swing.JButton jButton4;
172     private javax.swing.JScrollPane jScrollPane1;
173     private javax.swing.JTextArea jTextArea1;
174     // End of variables declaration//GEN-END:variables
175  
176     @Override
177     public void update(Observable o, Object arg) {
178 <span class="nc" id="L178">        this.jTextArea1.insert(((Elevator)arg).toString()+&quot;\n&quot;, 1);</span>
179 <span class="nc" id="L179">    }</span>
180 }
181 </pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>