/[classpath]/classpath/javax/swing/table/JTableHeader.java
ViewVC logotype

Diff of /classpath/javax/swing/table/JTableHeader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Sat Jul 31 23:47:30 2004 UTC revision 1.5 by mark, Sat Sep 4 21:14:06 2004 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing.table;  package javax.swing.table;
40    
41    import java.awt.event.FocusEvent;
42    import java.awt.event.FocusListener;
43    import java.awt.Color;
44    import java.awt.Cursor;
45    import java.awt.Dimension;
46    import java.awt.Font;
47    import java.awt.FontMetrics;
48    import java.awt.Point;
49    import java.awt.Rectangle;
50    import java.beans.PropertyChangeEvent;
51    import java.beans.PropertyChangeListener;
52    import java.util.Locale;
53    
54    import javax.accessibility.Accessible;
55    import javax.accessibility.AccessibleAction;
56    import javax.accessibility.AccessibleComponent;
57    import javax.accessibility.AccessibleContext;
58    import javax.accessibility.AccessibleSelection;
59    import javax.accessibility.AccessibleStateSet;
60    import javax.accessibility.AccessibleRole;
61    import javax.accessibility.AccessibleText;
62    import javax.accessibility.AccessibleValue;
63  import javax.swing.JComponent;  import javax.swing.JComponent;
64  import javax.swing.JTable;  import javax.swing.JTable;
65    import javax.swing.UIManager;
66    import javax.swing.plaf.TableHeaderUI;
67    
68  public class JTableHeader extends JComponent  public class JTableHeader extends JComponent
69  {  {
70    protected class AccessibleJTableHeader    protected class AccessibleJTableHeader extends AccessibleJComponent
71      {
72        protected class AccessibleJTableHeaderEntry extends AccessibleContext
73          implements Accessible, AccessibleComponent
74        {
75          public void addFocusListener(FocusListener l)
76          {
77            throw new Error("not implemented");
78          }
79          public void addPropertyChangeListener(PropertyChangeListener l)
80          {
81            throw new Error("not implemented");
82          }
83          public boolean contains(Point p)
84          {
85            throw new Error("not implemented");
86          }
87          public AccessibleAction getAccessibleAction()
88          {
89            throw new Error("not implemented");
90          }
91          public Accessible getAccessibleAt(Point p)
92          {
93            throw new Error("not implemented");
94          }
95          public Accessible getAccessibleChild(int i)
96          {
97            throw new Error("not implemented");
98          }
99          public int getAccessibleChildrenCount()
100          {
101            throw new Error("not implemented");
102          }
103          public AccessibleComponent getAccessibleComponent()
104          {
105            throw new Error("not implemented");
106          }
107          public AccessibleContext getAccessibleContext()
108          {
109            throw new Error("not implemented");
110          }
111          public String getAccessibleDescription()
112    {    {
113      protected class AccessibleJTableHeaderEntry          throw new Error("not implemented");
114          }
115          public int getAccessibleIndexInParent()
116          {
117            throw new Error("not implemented");
118          }
119          public String getAccessibleName()
120      {      {
121            throw new Error("not implemented");
122      }      }
123          public AccessibleRole getAccessibleRole()
124          {
125            throw new Error("not implemented");
126          }
127          public AccessibleSelection getAccessibleSelection()
128          {
129            throw new Error("not implemented");
130          }
131          public AccessibleStateSet getAccessibleStateSet()
132          {
133            throw new Error("not implemented");
134          }
135          public AccessibleText getAccessibleText()
136          {
137            throw new Error("not implemented");
138          }
139          public AccessibleValue getAccessibleValue()
140          {
141            throw new Error("not implemented");
142          }
143          public Color getBackground()
144          {
145            throw new Error("not implemented");
146          }
147          public Rectangle getBounds()
148          {
149            throw new Error("not implemented");
150          }
151          public Cursor getCursor()
152          {
153            throw new Error("not implemented");
154          }
155          public Font getFont()
156          {
157            throw new Error("not implemented");
158          }
159          public FontMetrics getFontMetrics(Font f)
160          {
161            throw new Error("not implemented");
162          }
163          public Color getForeground()
164          {
165            throw new Error("not implemented");
166          }
167          public Locale getLocale()
168          {
169            throw new Error("not implemented");
170          }
171          public Point getLocation()
172          {
173            throw new Error("not implemented");
174          }
175          public Point getLocationOnScreen()
176          {
177            throw new Error("not implemented");
178          }
179          public Dimension getSize()
180          {
181            throw new Error("not implemented");
182          }
183          public boolean isEnabled()
184          {
185            throw new Error("not implemented");
186          }
187          public boolean isFocusTraversable()
188          {
189            throw new Error("not implemented");
190          }
191          public boolean isShowing()
192          {
193            throw new Error("not implemented");
194          }
195          public boolean isVisible()
196          {
197            throw new Error("not implemented");
198          }
199          public void removeFocusListener(FocusListener l)
200          {
201            throw new Error("not implemented");
202          }
203          public void removePropertyChangeListener(PropertyChangeListener l)
204          {
205            throw new Error("not implemented");
206          }
207          public void requestFocus()
208          {
209            throw new Error("not implemented");
210          }
211          public void setAccessibleDescription(String s)
212          {
213            throw new Error("not implemented");
214          }
215          public void setAccessibleName(String s)
216          {
217            throw new Error("not implemented");
218          }
219          public void setBackground(Color c)
220          {
221            throw new Error("not implemented");
222          }
223          public void setBounds(Rectangle r)
224          {
225            throw new Error("not implemented");
226          }
227          public void setCursor(Cursor c)
228          {
229            throw new Error("not implemented");
230          }
231          public void setEnabled(boolean b)
232          {
233            throw new Error("not implemented");
234          }
235          public void setFont(Font f)
236          {
237            throw new Error("not implemented");
238          }
239          public void setForeground(Color c)
240          {
241            throw new Error("not implemented");
242          }
243          public void setLocation(Point p)
244          {
245            throw new Error("not implemented");
246          }
247          public void setSize(Dimension d)
248          {
249            throw new Error("not implemented");
250          }
251          public void setVisible(boolean b)
252          {
253            throw new Error("not implemented");
254          }
255        };
256    }    }
257    
258    private static final long serialVersionUID = 5144633983372967710L;    private static final long serialVersionUID = 5144633983372967710L;
259    
260    protected TableColumnModel columnModel;    /**
261    protected TableColumn draggedColumn;     * The accessibleContext property.
262    protected int draggedDistance;     */
263    protected boolean reorderingAllowed;    AccessibleContext accessibleContext;
264    protected boolean resizingAllowed;  
265    protected TableColumn resizingColumn;    /**
266    protected JTable table;     * The columnModel property.
267    protected boolean updateTableInRealTime;     */
268      TableColumnModel columnModel;
269    
270      /**
271       * The draggedColumn property.
272       */
273      TableColumn draggedColumn;
274    
275      /**
276       * The draggedDistance property.
277       */
278      int draggedDistance;
279    
280      /**
281       * The opaque property.
282       */
283      boolean opaque;
284    
285      /**
286       * The reorderingAllowed property.
287       */
288      boolean reorderingAllowed;
289    
290      /**
291       * The resizingAllowed property.
292       */
293      boolean resizingAllowed;
294    
295      /**
296       * The resizingColumn property.
297       */
298      TableColumn resizingColumn;
299    
300      /**
301       * The table property.
302       */
303      JTable table;
304    
305      /**
306       * The updateTableInRealTime property.
307       */
308      boolean updateTableInRealTime;
309    
310      TableCellRenderer cellRenderer;
311    
312    public JTableHeader()    public JTableHeader()
313    {    {
# Line 68  public class JTableHeader extends JCompo Line 316  public class JTableHeader extends JCompo
316    
317    public JTableHeader(TableColumnModel cm)    public JTableHeader(TableColumnModel cm)
318    {    {
319      super();      accessibleContext = new AccessibleJTableHeader();
320        columnModel = cm == null ? createDefaultTableColumnModel() : cm;
321      this.columnModel = cm == null ? createDefaultColumnModel() : cm;      draggedColumn = null;
322        draggedDistance = 0;
323        opaque = true;
324        reorderingAllowed = true;
325        resizingAllowed = true;
326        resizingColumn = null;
327        table = null;
328        updateTableInRealTime = true;
329        cellRenderer = createDefaultRenderer();
330        updateUI();
331    }    }
332    
333    protected TableColumnModel createDefaultColumnModel()    protected TableColumnModel createDefaultTableColumnModel()
334    {    {
335      return new DefaultTableColumnModel();      return new DefaultTableColumnModel();
336    }    }
337    
338    
339      /**
340       * Get the value of the {@link #accessibleContext} property.
341       *
342       * @return The current value of the property
343       */
344      public AccessibleContext getAccessibleContext()
345      {
346        return accessibleContext;
347      }
348    
349      /**
350       * Get the value of the {@link #columnModel} property.
351       *
352       * @return The current value of the property
353       */
354      public TableColumnModel getColumnModel()
355      {
356        return columnModel;
357      }
358    
359      /**
360       * Get the value of the {@link #draggedColumn} property.
361       *
362       * @return The current value of the property
363       */
364      public TableColumn getDraggedColumn()
365      {
366        return draggedColumn;
367      }
368    
369      /**
370       * Get the value of the {@link #draggedDistance} property.
371       *
372       * @return The current value of the property
373       */
374      public int getDraggedDistance()
375      {
376        return draggedDistance;
377      }
378    
379      /**
380       * Get the value of the {@link #reorderingAllowed} property.
381       *
382       * @return The current value of the property
383       */
384      public boolean getReorderingAllowed()
385      {
386        return reorderingAllowed;
387      }
388    
389      /**
390       * Get the value of the {@link #resizingAllowed} property.
391       *
392       * @return The current value of the property
393       */
394      public boolean getResizingAllowed()
395      {
396        return resizingAllowed;
397      }
398    
399      /**
400       * Get the value of the {@link #resizingColumn} property.
401       *
402       * @return The current value of the property
403       */
404      public TableColumn getResizingColumn()
405      {
406        return resizingColumn;
407      }
408    
409      /**
410       * Get the value of the {@link #table} property.
411       *
412       * @return The current value of the property
413       */
414      public JTable getTable()
415      {
416        return table;
417      }
418    
419      /**
420       * Get the value of the {@link #updateTableInRealTime} property.
421       *
422       * @return The current value of the property
423       */
424      public boolean getUpdateTableInRealTime()
425      {
426        return updateTableInRealTime;
427      }
428    
429      /**
430       * Get the value of the {@link #opaque} property.
431       *
432       * @return The current value of the property
433       */
434      public boolean isOpaque()
435      {
436        return opaque;
437      }
438    
439      /**
440       * Set the value of the {@link #columnModel} property.
441       *
442       * @param c The new value of the property
443       */
444      public void setColumnModel(TableColumnModel c)
445      {
446        columnModel = c;
447      }
448    
449      /**
450       * Set the value of the {@link #draggedColumn} property.
451       *
452       * @param d The new value of the property
453       */
454      public void setDraggedColumn(TableColumn d)
455      {
456        draggedColumn = d;
457      }
458    
459      /**
460       * Set the value of the {@link #draggedDistance} property.
461       *
462       * @param d The new value of the property
463       */
464      public void setDraggedDistance(int d)
465      {
466        draggedDistance = d;
467      }
468    
469      /**
470       * Set the value of the {@link #opaque} property.
471       *
472       * @param o The new value of the property
473       */
474      public void setOpaque(boolean o)
475      {
476        opaque = o;
477      }
478    
479      /**
480       * Set the value of the {@link #reorderingAllowed} property.
481       *
482       * @param r The new value of the property
483       */
484      public void setReorderingAllowed(boolean r)
485      {
486        reorderingAllowed = r;
487      }
488    
489      /**
490       * Set the value of the {@link #resizingAllowed} property.
491       *
492       * @param r The new value of the property
493       */
494      public void setResizingAllowed(boolean r)
495      {
496        resizingAllowed = r;
497      }
498    
499      /**
500       * Set the value of the {@link #resizingColumn} property.
501       *
502       * @param r The new value of the property
503       */
504      public void setResizingColumn(TableColumn r)
505      {
506        resizingColumn = r;
507      }
508    
509      /**
510       * Set the value of the {@link #table} property.
511       *
512       * @param t The new value of the property
513       */
514      public void setTable(JTable t)
515      {
516        table = t;
517      }
518    
519      /**
520       * Set the value of the {@link #updateTableInRealTime} property.
521       *
522       * @param u The new value of the property
523       */
524      public void setUpdateTableInRealTime(boolean u)
525      {
526        updateTableInRealTime = u;
527      }
528    
529      protected TableCellRenderer createDefaultRenderer()
530      {
531        return new DefaultTableCellRenderer();
532      }
533    
534      public TableCellRenderer getDefaultRenderer()
535      {
536        return cellRenderer;
537      }
538    
539      public Rectangle getHeaderRect(int column)
540      {
541        Rectangle r = getTable().getCellRect(-1, column, true);
542        r.height = getHeight();
543        return r;
544      }
545    
546      protected String paramString()
547      {
548        return "JTableHeader";
549      }
550    
551      // UI support
552    
553      public String getUIClassID()
554      {
555        return "TableHeaderUI";
556      }
557    
558      public TableHeaderUI getUI()
559      {
560        return (TableHeaderUI) ui;
561      }
562    
563      public void setUI(TableHeaderUI u)
564      {
565        super.setUI(u);
566      }
567    
568      public void updateUI()
569      {
570        setUI((TableHeaderUI) UIManager.getUI(this));
571      }
572    
573  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26