KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > docking > DockingContainer


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * DockingContainer.java
28  *
29  * Created on January 25, 2006, 5:22 PM
30  *
31  */

32
33 package it.businesslogic.ireport.gui.docking;
34
35 import it.businesslogic.ireport.gui.event.TabPaneChangedEvent;
36 import it.businesslogic.ireport.gui.event.TabPaneChangedListener;
37 import java.awt.Component JavaDoc;
38 import java.awt.Dimension JavaDoc;
39 import java.awt.datatransfer.DataFlavor JavaDoc;
40 import java.awt.datatransfer.Transferable JavaDoc;
41 import java.awt.dnd.DnDConstants JavaDoc;
42 import java.awt.dnd.DropTarget JavaDoc;
43 import java.awt.dnd.DropTargetContext JavaDoc;
44 import java.awt.dnd.DropTargetDragEvent JavaDoc;
45 import java.awt.dnd.DropTargetDropEvent JavaDoc;
46 import java.awt.dnd.DropTargetEvent JavaDoc;
47 import java.awt.dnd.DropTargetListener JavaDoc;
48 import java.awt.event.ActionEvent JavaDoc;
49 import java.awt.event.ActionListener JavaDoc;
50 import java.beans.PropertyChangeListener JavaDoc;
51 import java.util.HashMap JavaDoc;
52 import java.util.Vector JavaDoc;
53 import javax.swing.Icon JavaDoc;
54 import javax.swing.JButton JavaDoc;
55 import javax.swing.JPanel JavaDoc;
56 import javax.swing.JSplitPane JavaDoc;
57 import it.businesslogic.ireport.util.I18n;
58
59 /**
60  *
61  * @author gtoffoli
62  */

63 public class DockingContainer extends javax.swing.JPanel JavaDoc implements TabPaneChangedListener, ActionListener JavaDoc {
64     
65     public static final int INSERT_MODE_SHAREDPOSTION = 0;
66     public static final int INSERT_MODE_NEWPOSITION = 1;
67     
68     private int oldWidth = 0;
69     private boolean compressed = false;
70     
71     private Vector JavaDoc panelViews = new Vector JavaDoc();
72     private Vector JavaDoc tabPanes = new Vector JavaDoc();
73     private int positions = 0;
74     
75     private DropTarget JavaDoc dropTarget;
76     private DropTargetListener JavaDoc dtListener;
77   
78     public static final int POSITION_RIGHT = 0;
79     public static final int POSITION_LEFT = 1;
80     
81     private int position = POSITION_LEFT;
82     
83     private int preferredDividerLocation = -1;
84     private int realCurrentSize = 0;
85     
86     /** Creates new form DockingContainer */
87     public DockingContainer() {
88         this(POSITION_LEFT);
89     }
90     
91     
92     public DockingContainer(int position) {
93         initComponents();
94         
95         this.setSize(new Dimension JavaDoc(200,100));
96         this.setPreferredSize(new Dimension JavaDoc(200,100));
97         
98         
99         this.dtListener = new DTListener();
100         // component, ops, listener, accepting
101

102         this.setDropTarget( new DropTarget JavaDoc(this,
103             DnDConstants.ACTION_MOVE,
104             new DTListener()));
105        this.setBorder(null);
106        applyI18n();
107        
108     }
109        
110     
111     private JButton JavaDoc createButton(PanelView pv)
112     {
113         
114         JButton JavaDoc jButton = new JButton JavaDoc();
115         
116         Icon JavaDoc icon = new VTextIcon(jButton1,pv.getName(), (getPosition() == POSITION_LEFT) ? VTextIcon.ROTATE_LEFT : VTextIcon.ROTATE_RIGHT);
117         jButton.setIcon( icon );
118         jButton.setPreferredSize( new Dimension JavaDoc(20, icon.getIconHeight()+ 28));
119         jButton.setMinimumSize( new Dimension JavaDoc(20, icon.getIconHeight()+ 28));
120         
121         jButton.setActionCommand( pv.getId()+"" );
122         jButton.addActionListener( this );
123         
124        return jButton;
125     }
126     
127     public void actionPerformed(ActionEvent JavaDoc e) {
128     
129         // Button pressed...
130
String JavaDoc s= e.getActionCommand();
131         try {
132         PanelView pv = getPanelViewById( Integer.parseInt( s ));
133         
134         pv.setMinimized(false);
135         pv.setPosition( positions);
136         
137         recreateAll();
138         } catch (Exception JavaDoc ex) {
139         
140             ex.printStackTrace();
141         }
142         
143     }
144     
145     /**
146      * Add a component under the other
147      *
148      */

149     public void addPanel(String JavaDoc name, Component JavaDoc component, boolean closable)
150     {
151         insertPanel(positions, name, component, closable);
152         
153     }
154     /*
155     public void addDropTarget(Component comp)
156     {
157         System.out.println( comp );
158         if (comp.getDropTarget() == null)
159         {
160             comp.setDropTarget( this.getDropTarget() );
161         }
162         
163         if (comp instanceof JComponent)
164         {
165             JComponent component = (JComponent)comp;
166             if (component.getDropTarget() == null)
167             {
168                 component.setDropTarget( this.getDropTarget() );
169             }
170
171             for (int i=0; i<component.getComponentCount(); ++i)
172             {
173                 addDropTarget( component.getComponent(i) );
174             }
175         }
176     }
177      */

178     
179     public boolean contains(Component JavaDoc c)
180     {
181         for (int i=0; i<getPanelViews().size(); ++i)
182         {
183             PanelView pv = (PanelView)getPanelViews().elementAt(i);
184             if (pv.getComponent() == c)
185             {
186                 return true;
187             }
188         }
189         
190         return false;
191     }
192     
193     /**
194      * Returns the panel view containing the Component c.
195      * Null if the component is not found.
196      *
197      */

198     public PanelView getPanelView(Component JavaDoc c)
199     {
200         for (int i=0; i<getPanelViews().size(); ++i)
201         {
202             PanelView pv = (PanelView)getPanelViews().elementAt(i);
203             if (pv.getComponent() == c)
204             {
205                 return pv;
206             }
207         }
208         
209         return null;
210     }
211     
212     /**
213      * Returns the panel view containing the Component c.
214      * Null if the component is not found.
215      *
216      */

217     public PanelView getPanelViewById(int id)
218     {
219         for (int i=0; i<getPanelViews().size(); ++i)
220         {
221             PanelView pv = (PanelView)getPanelViews().elementAt(i);
222             if (pv.getId() == id)
223             {
224                 return pv;
225             }
226         }
227         
228         return null;
229     }
230     
231     public void insertPanel(int position, String JavaDoc name, Component JavaDoc component, int insertMode, boolean closable)
232     {
233         if (component == null) return;
234         if (name == null) name = "Panel";
235         
236         // Check if the component is already present somewhere...
237
for (int i=0; i<getPanelViews().size(); ++i)
238         {
239             PanelView pv = (PanelView)getPanelViews().elementAt(i);
240             if (pv.getComponent() == component)
241             {
242                 return;
243             }
244         }
245         
246         //addDropTarget( component );
247

248         //if (component.getDropTarget() == null)
249
//{
250
// component.setDropTarget(new DropTarget(component, new GenericDragTargetListener()));
251
//}
252

253         //System.out.println("Added panel " + name + " at position " + position);
254
if (position >= positions)
255         {
256             position = positions;
257             positions++;
258         }
259         else if (insertMode == INSERT_MODE_NEWPOSITION)
260         {
261             for (int i=0; i<getPanelViews().size(); ++i)
262             {
263                 PanelView pv = (PanelView)getPanelViews().elementAt(i);
264
265                 if (pv.getPosition() >= position)
266                 {
267                     pv.setPosition( pv.getPosition()+1 );
268                 }
269             }
270             positions++;
271         }
272
273         panelViews.add( new PanelView(name, component, position, closable) );
274         recreateAll();
275         
276     }
277     /**
278      * Add a component at position
279      *
280      */

281     public void insertPanel(int position, String JavaDoc name, Component JavaDoc component, boolean closable)
282     {
283         insertPanel(position, name, component, INSERT_MODE_NEWPOSITION, closable);
284     }
285     
286     /**
287      * Add a component at position
288      *
289      */

290     public void removePanel(Component JavaDoc component)
291     {
292         
293         int position = -1;
294         for (int i=0; i<getPanelViews().size(); ++i)
295         {
296             PanelView pv = (PanelView)getPanelViews().elementAt(i);
297             
298             if (pv.getComponent() == component)
299             {
300                 position = pv.getPosition();
301                 //System.out.println("removing panel " + pv.getName() + " at position " + pv.getPosition());
302
getPanelViews().remove(pv);
303                 break;
304             }
305         }
306         
307         
308         
309         // If "position" is not used, normalize all...
310
if (position >= 0)
311         {
312             boolean found = false;
313             for (int i=0; i<getPanelViews().size(); ++i)
314             {
315                 PanelView pv = (PanelView)getPanelViews().elementAt(i);
316                 if (pv.isMinimized()) continue;
317                 if (pv.getPosition() == position)
318                 {
319                     found = true;
320                     break;
321                 }
322             }
323             
324             if (!found)
325             {
326                 for (int i=0; i<getPanelViews().size(); ++i)
327                 {
328                     PanelView pv = (PanelView)getPanelViews().elementAt(i);
329                     if (pv.isMinimized()) continue;
330                     if (pv.getPosition() > position)
331                     {
332                         pv.setPosition( pv.getPosition()-1);
333                     }
334                 }
335                 positions--;
336             }
337             recreateAll();
338         }
339         this.updateUI();
340     }
341     
342     
343     private void normalizePositions()
344     {
345         // 1. Find the number of different positions....
346
HashMap JavaDoc map = new HashMap JavaDoc();
347         int differentPositions = 0;
348         
349         for (int i=0; i<getPanelViews().size(); ++i)
350         {
351             PanelView pv = (PanelView)getPanelViews().elementAt(i);
352             if (pv.isMinimized()) continue;
353             map.put(new Integer JavaDoc(pv.getPosition()),"");
354         }
355         
356         differentPositions = map.size();
357         
358         for (int k=0; k<differentPositions; ++k)
359         {
360             
361             while (getPanelCount(k) == 0)
362             {
363                 // position = position -1 for all panels with position >= k
364
downPosition(k);
365             }
366         }
367         
368         this.positions = differentPositions;
369     }
370     
371     /* if position > minimumPosition -> position = position - 1;
372      *
373      */

374     private void downPosition(int minimumPosition)
375     {
376         for (int i=0; i<getPanelViews().size(); ++i)
377         {
378             PanelView pv = (PanelView)getPanelViews().elementAt(i);
379             if (pv.isMinimized()) continue;
380             if (pv.getPosition() > minimumPosition)
381             {
382                 pv.setPosition( pv.getPosition()-1);
383             }
384         }
385     }
386     
387     
388     /**
389      * Use this panelView to describe the panel to move. Only component and name are used
390      * to move the component in the newPosition
391      * panelView.component is removed then inserted again in newPosition with label panelView.name
392      */

393     public void moveComponent(PanelView panelView, int newPosition)
394     {
395         moveComponent(panelView, newPosition, INSERT_MODE_NEWPOSITION);
396     }
397     
398     /**
399      * Use this panelView to describe the panel to move. Only component and name are used
400      * to move the component in the newPosition
401      * panelView.component is removed then inserted again in newPosition with label panelView.name
402      */

403     public void moveComponent(PanelView panelView, int newPosition, int mode)
404     {
405         removePanel(panelView.getComponent());
406         insertPanel(newPosition,panelView.getName(), panelView.getComponent(), mode, panelView.isClosable());
407     }
408     
409     /**
410      * Use this panelView to describe the panel to move. Only component and name are used
411      * to move the component in the newPosition
412      * panelView.component is removed then inserted again in newPosition with label panelView.name
413      */

414     public void mergePosition(int newPosition)
415     {
416         if (positions == 1) return;
417         if (newPosition >= positions) return;
418         if ( newPosition == 0 && positions>1) newPosition=1;
419         for (int i=0; i<getPanelViews().size(); ++i)
420         {
421             PanelView pv = (PanelView)getPanelViews().elementAt(i);
422             
423             if (pv.isMinimized()) continue;
424             
425             if (pv.getPosition() >= newPosition)
426             {
427                 pv.setPosition( pv.getPosition()-1);
428             }
429             
430         }
431         
432         positions--;
433         recreateAll();
434     }
435     
436     
437     
438     public void recreateAll()
439     {
440         this.removeAll();
441         
442         
443         jPanel1.removeAll();
444         
445         int numPositions = positions;
446         
447         normalizePositions();
448                         
449         if (positions > 0)
450         {
451             if (compressed)
452             {
453                 compressed = false;
454                 this.setSize(getOldWidth(), 1);
455             }
456             
457             
458             tabPanes.removeAllElements();
459             Vector JavaDoc tabbedPanes = new Vector JavaDoc();
460             if (positions == 0) return;
461         
462             add( addComponents(0),java.awt.BorderLayout.CENTER);
463             this.updateUI();
464         }
465         else
466         {
467             compressed = true;
468             setOldWidth( getSize().width);
469             this.setSize(0, 1);
470         }
471         
472         int minimizedButton = 0;
473         for (int i=0; i<getPanelViews().size(); ++i)
474         {
475             PanelView pv = (PanelView)getPanelViews().elementAt(i);
476             if (pv.isMinimized())
477             {
478                 JButton JavaDoc b = createButton(pv);
479                 java.awt.GridBagConstraints JavaDoc gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
480                 gridBagConstraints.gridx = 0;
481                 gridBagConstraints.weightx = 1.0;
482                 gridBagConstraints.weighty = 0;
483                 jPanel1.add(b,gridBagConstraints);
484                 minimizedButton++;
485             }
486         }
487         
488         if (minimizedButton > 0)
489         {
490             java.awt.GridBagConstraints JavaDoc gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
491             gridBagConstraints.gridx = 0;
492             gridBagConstraints.weightx = 1.0;
493             gridBagConstraints.weighty = 1.0;
494             jPanel1.add(new JPanel JavaDoc(), gridBagConstraints);
495             add( jPanel1, (getPosition() == POSITION_LEFT) ? java.awt.BorderLayout.WEST : java.awt.BorderLayout.EAST);
496         }
497         
498         if (this.getParent() != null &&
499             this.getParent() instanceof JSplitPane JavaDoc)
500         {
501             JSplitPane JavaDoc sp = (JSplitPane JavaDoc)this.getParent();
502             int currentWidth = realCurrentSize;
503             if (positions == 0)
504             {
505                 
506                 //this.setPreferredSize(new Dimension(24,0));
507

508                 if (getPosition() == POSITION_LEFT)
509                 {
510                     sp.setDividerLocation( jPanel1.getWidth() );
511                 }
512                 else
513                 {
514                     
515                     //sp.setDividerLocation(1.0);
516
this.setSize(new Dimension JavaDoc(24,0));
517                     sp.setDividerLocation( (int)(sp.getBounds().getWidth())-sp.getDividerSize()- 24 );
518                 }
519             }
520             else
521             {
522                 int width = currentWidth;
523                 if (width <= 150 + 24)
524                 {
525                     width = 150+ 24;
526                 }
527                 //this.setPreferredSize(new Dimension(width,0));
528
//this.setSize(new Dimension(width,0));
529
//this.setMinimumSize(new Dimension(width,0));
530
if (getPosition() == POSITION_LEFT)
531                 {
532                     sp.setDividerLocation( width );
533                 }
534                 else
535                 {
536                     sp.setDividerLocation( getPreferredDividerLocation() - ( width - currentWidth));
537                     
538                     
539                     //sp.setDividerLocation();
540
//sp.setDividerLocation( sp.getWidth() - width );
541
}
542             }
543
544             sp.updateUI();
545
546         }
547         this.updateUI();
548     }
549     
550     public void setSelectedComponent(Component JavaDoc component)
551     {
552         for (int i=0; i<tabPanes.size(); ++i)
553         {
554             JDraggableTabbedPane tab = (JDraggableTabbedPane)tabPanes.get(i);
555                         
556             try {
557                tab.setSelectedComponent( component );
558                break;
559             } catch (Exception JavaDoc ex) {}
560         }
561     }
562     
563     public Component JavaDoc addComponents(int pos)
564     {
565         
566         JDraggableTabbedPane jTabbedPane = new JDraggableTabbedPane();
567         jTabbedPane.setPosition(pos);
568         jTabbedPane.setOrientation( getPosition());
569         jTabbedPane.setDockingContainer(this);
570         jTabbedPane.addTabPaneChangedListener( this );
571         
572         tabPanes.add(jTabbedPane);
573         
574                 
575         for (int i=0; i<getPanelViews().size(); ++i)
576         {
577             PanelView pv = (PanelView)getPanelViews().elementAt(i);
578             if (pv.isMinimized()) continue;
579             if (pv.getPosition() == pos)
580             {
581                 jTabbedPane.addTab(pv.getName(), pv.getComponent(), pv.isClosable());
582             }
583             
584             //System.out.println("Adding " + pv.getName() + " on position " + pos + "/" + positions);
585
}
586         
587         if (pos < positions-1)
588         {
589             javax.swing.JSplitPane JavaDoc jSplitPane = new javax.swing.JSplitPane JavaDoc();
590             jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
591             jSplitPane.setBorder(null);
592             //jSplitPane.setDividerSize(6);
593

594             jSplitPane.setResizeWeight( 1.0/(positions-pos));
595             jSplitPane.setLeftComponent(jTabbedPane);
596             jSplitPane.setRightComponent( addComponents(pos+1) );
597             jSplitPane.setDividerSize(5);
598             return jSplitPane;
599         }
600         else
601         {
602             return jTabbedPane;
603         }
604     }
605     
606     
607     public Vector JavaDoc getPanelViews() {
608         return panelViews;
609     }
610     
611     public int getPanelCount(int position)
612     {
613         int p_number = 0;
614         for (int i=0; i<getPanelViews().size(); ++i)
615         {
616             PanelView pv = (PanelView)getPanelViews().elementAt(i);
617             if (pv.isMinimized()) continue;
618             if (pv.getPosition() == position)
619             {
620                 p_number++;
621             }
622         }
623         
624         return p_number;
625     }
626
627     public void setPanelViews(Vector JavaDoc panelViews) {
628         this.panelViews = panelViews;
629     }
630
631     public int getOldWidth() {
632         return oldWidth;
633     }
634
635     public void setOldWidth(int oldWidth) {
636         this.oldWidth = oldWidth;
637     }
638
639     public boolean isCompressed() {
640         return compressed;
641     }
642
643     public void setCompressed(boolean compressed) {
644         this.compressed = compressed;
645     }
646     
647     /** This method is called from within the constructor to
648      * initialize the form.
649      * WARNING: Do NOT modify this code. The content of this method is
650      * always regenerated by the Form Editor.
651      */

652     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
653
private void initComponents() {
654         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
655
656         jPanel1 = new javax.swing.JPanel JavaDoc();
657         jButton1 = new javax.swing.JButton JavaDoc();
658
659         setLayout(new java.awt.BorderLayout JavaDoc());
660
661         addComponentListener(new java.awt.event.ComponentAdapter JavaDoc() {
662             public void componentResized(java.awt.event.ComponentEvent JavaDoc evt) {
663                 formComponentResized(evt);
664             }
665         });
666
667         jPanel1.setLayout(new java.awt.GridBagLayout JavaDoc());
668
669         jPanel1.setPreferredSize(new java.awt.Dimension JavaDoc(24, 10));
670         jButton1.setBorder(null);
671         jButton1.setBorderPainted(false);
672         jButton1.setFocusPainted(false);
673         jButton1.setFocusable(false);
674         jButton1.setMaximumSize(new java.awt.Dimension JavaDoc(33, 500));
675         jButton1.setMinimumSize(new java.awt.Dimension JavaDoc(33, 100));
676         jButton1.setPreferredSize(new java.awt.Dimension JavaDoc(33, 100));
677         jButton1.setRequestFocusEnabled(false);
678         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
679         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
680         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
681         gridBagConstraints.weightx = 1.0;
682         gridBagConstraints.weighty = 1.0;
683         jPanel1.add(jButton1, gridBagConstraints);
684
685         add(jPanel1, java.awt.BorderLayout.WEST);
686
687     }// </editor-fold>//GEN-END:initComponents
688

689     private void formComponentResized(java.awt.event.ComponentEvent JavaDoc evt) {//GEN-FIRST:event_formComponentResized
690

691         realCurrentSize = (int)evt.getComponent().getSize().getWidth();
692         //System.out.println("Current size: " + );
693
}//GEN-LAST:event_formComponentResized
694

695     public void tabPaneChanged(TabPaneChangedEvent evt) {
696         
697         if (evt.getOperation() == evt.CLOSED)
698         {
699             this.removePanel( evt.getTabComponent() );
700             
701         }
702         else if (evt.getOperation() == evt.MINIMIZED)
703         {
704             // Look for the right panel view..
705
PanelView pv = getPanelView(evt.getTabComponent());
706             pv.setMinimized(true);
707             recreateAll();
708         }
709         
710     }
711     
712     
713     // Variables declaration - do not modify//GEN-BEGIN:variables
714
private javax.swing.JButton JavaDoc jButton1;
715     private javax.swing.JPanel JavaDoc jPanel1;
716     // End of variables declaration//GEN-END:variables
717

718 class DTListener implements DropTargetListener JavaDoc {
719
720
721
722     /**
723      * start "drag under" feedback on component
724      * invoke acceptDrag or rejectDrag based on isDragOk
725      */

726     public void dragEnter(DropTargetDragEvent JavaDoc e) {
727       e.acceptDrag(e.getDropAction());
728     }
729
730     /**
731      * continue "drag under" feedback on component
732      * invoke acceptDrag or rejectDrag based on isDragOk
733      */

734     public void dragOver(DropTargetDragEvent JavaDoc e) {
735       e.acceptDrag(e.getDropAction());
736     }
737     
738     public void dropActionChanged(DropTargetDragEvent JavaDoc e) {
739     }
740     
741     public void dragExit(DropTargetEvent JavaDoc e) {
742     }
743
744     /**
745      * perform action from getSourceActions on
746      * the transferrable
747      * invoke acceptDrop or rejectDrop
748      * invoke dropComplete
749      * if its a local (same JVM) transfer, use StringTransferable.localStringFlavor
750      * find a match for the flavor
751      * check the operation
752      * get the transferable according to the chosen flavor
753      * do the transfer
754      */

755     public void drop(DropTargetDropEvent JavaDoc dtde) {
756         try {
757            
758             DropTargetContext JavaDoc context = dtde.getDropTargetContext();
759
760             Transferable JavaDoc tr = dtde.getTransferable();
761
762             DataFlavor JavaDoc[] df = tr.getTransferDataFlavors();
763
764             if (df[0].getHumanPresentableName().equals("it.businesslogic.ireport.gui.docking.PanelView"))
765             {
766                 java.awt.datatransfer.DataFlavor JavaDoc myFlavor = new java.awt.datatransfer.DataFlavor JavaDoc(it.businesslogic.ireport.gui.docking.PanelView.class, it.businesslogic.ireport.gui.docking.PanelView.class.getName());
767                 it.businesslogic.ireport.gui.docking.PanelView panelView = (it.businesslogic.ireport.gui.docking.PanelView)tr.getTransferData( myFlavor );
768                 
769                 if (DockingContainer.this != null)
770                 {
771                     if (panelView.getDockingContainer() != DockingContainer.this)
772                     {
773                         panelView.getDockingContainer().removePanel(panelView.getComponent());
774                         DockingContainer.this.insertPanel(0, panelView.getName(), panelView.getComponent(), panelView.isClosable());
775                     }
776                 }
777             }
778            
779             context.dropComplete(true);
780         } catch (Exception JavaDoc ex)
781         {
782             ex.printStackTrace();
783         }
784     }
785
786
787   }
788
789     public int getPosition() {
790         return position;
791     }
792
793     public void setPosition(int position) {
794         this.position = position;
795     }
796
797     public int getPreferredDividerLocation() {
798         return preferredDividerLocation;
799     }
800
801     public void setPreferredDividerLocation(int preferredDividerLocation) {
802         this.preferredDividerLocation = preferredDividerLocation;
803     }
804
805     public void applyI18n(){
806                 // Start autogenerated code ----------------------
807
// End autogenerated code ----------------------
808

809     }
810 }
811
Popular Tags