KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > PaneFolder


1 /*******************************************************************************
2  * Copyright (c) 2004, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.presentations;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.Iterator JavaDoc;
15 import java.util.List JavaDoc;
16
17 import org.eclipse.jface.util.Geometry;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.custom.CTabFolder;
20 import org.eclipse.swt.custom.CTabFolder2Adapter;
21 import org.eclipse.swt.custom.CTabFolderEvent;
22 import org.eclipse.swt.custom.CTabItem;
23 import org.eclipse.swt.custom.ViewForm;
24 import org.eclipse.swt.events.ControlEvent;
25 import org.eclipse.swt.events.ControlListener;
26 import org.eclipse.swt.events.DisposeEvent;
27 import org.eclipse.swt.events.DisposeListener;
28 import org.eclipse.swt.events.MouseAdapter;
29 import org.eclipse.swt.events.MouseEvent;
30 import org.eclipse.swt.events.MouseListener;
31 import org.eclipse.swt.graphics.Color;
32 import org.eclipse.swt.graphics.Point;
33 import org.eclipse.swt.graphics.Rectangle;
34 import org.eclipse.swt.widgets.Composite;
35 import org.eclipse.swt.widgets.Control;
36 import org.eclipse.ui.internal.dnd.DragUtil;
37 import org.eclipse.ui.internal.dnd.SwtUtil;
38 import org.eclipse.ui.internal.layout.SizeCache;
39 import org.eclipse.ui.internal.presentations.util.ProxyControl;
40 import org.eclipse.ui.internal.tweaklets.TabBehaviour;
41 import org.eclipse.ui.internal.tweaklets.Tweaklets;
42 import org.eclipse.ui.presentations.IStackPresentationSite;
43
44 /**
45  * This class implements the tab folders that contains can contain two toolbars
46  * and status text. Wherever possible, the toolbars are aligned with the tabs.
47  * If there is not enough room beside the tabs, the toolbars are aligned with
48  * the status text. This is the same tab folder that is used to arrange views
49  * and editors in Eclipse.
50  * <p>
51  * This is closely related to DefaultPartPresentation, but they have different
52  * responsibilities. This is essentially a CTabFolder that can manage a toolbar.
53  * It should not depend on data structures from the workbench, and its public
54  * interface should only use SWT objects or listeners. DefaultPartPresentation
55  * uses a PaneFolder to arrange views or editors. Knowledge of higher-level data
56  * structures should go there.
57  * </p>
58  * <p>
59  * Although it is not actually a control, the public interface is much like an
60  * SWT control. Implementation-wise, this is actually a combination of a
61  * CTabFolder and a ViewForm. It encapsulates the details of moving the toolbar
62  * between the CTabFolder and the ViewForm, and provides a simpler interface to
63  * the ViewForm/CTabFolder.
64  * </p>
65  * To be consistent with SWT composites, this object can deal with its children
66  * being disposed without warning. This is treated like a removal.
67  *
68  * @since 3.0
69  */

70 public final class PaneFolder {
71     // Tab folder and associated proxy controls
72
private CTabFolder tabFolder;
73
74     private Control titleAreaProxy;
75
76     // View form and associated proxy controls
77
private ViewForm viewForm;
78
79     private ProxyControl contentProxy;
80
81     private ProxyControl viewFormTopLeftProxy;
82
83     private ProxyControl viewFormTopRightProxy;
84
85     private ProxyControl viewFormTopCenterProxy;
86
87     // Cached sizes of the top-right and top-center controls
88
private SizeCache topRightCache = new SizeCache();
89
90     private SizeCache topCenterCache = new SizeCache();
91
92     private SizeCache topLeftCache = new SizeCache();
93
94     private boolean putTrimOnTop = true;
95
96     // HACK: Sometimes the topright control isn't resized when
97
// CTabFolder.setBounds is called.
98
// We use the following data structures to detect if this has happened and
99
// force a layout when necessary.
100
private boolean topRightResized = false;
101
102     private boolean useTopRightOptimization = false;
103
104     private int lastWidth = 0;
105
106     // END OF HACK
107

108     private DisposeListener tabFolderDisposeListener = new DisposeListener() {
109         /*
110          * (non-Javadoc)
111          *
112          * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
113          */

114         public void widgetDisposed(DisposeEvent e) {
115             PaneFolder.this.widgetDisposed();
116         }
117     };
118
119     /**
120      * Listens for its children being disposed, and removes them if this happens
121      * (although this may indicate a programming error, this behavior is
122      * consistent with SWT composites).
123      */

124     private DisposeListener prematureDisposeListener = new DisposeListener() {
125
126         public void widgetDisposed(DisposeEvent e) {
127             Control disposedControl = (Control) e.widget;
128
129             if (isDisposed()) {
130                 return;
131             }
132
133             // Probably unnecessary, but it can't hurt garbage collection
134
disposedControl.removeDisposeListener(this);
135
136             if (disposedControl == topLeftCache.getControl()) {
137                 setTopLeft(null);
138             }
139
140             if (disposedControl == topRightCache.getControl()) {
141                 setTopRight(null);
142             }
143
144             if (disposedControl == topCenterCache.getControl()) {
145                 setTopCenter(null);
146             }
147         }
148
149     };
150
151     /**
152      * List of PaneFolderButtonListener
153      */

154     private List JavaDoc buttonListeners = new ArrayList JavaDoc(1);
155
156     private int state = IStackPresentationSite.STATE_RESTORED;
157
158     /**
159      * State of the folder at the last mousedown event. This is used to prevent
160      * a mouseup over the minimize or maximize buttons from undoing a state
161      * change that was caused by the mousedown.
162      */

163     private int mousedownState = -1;
164
165     // CTabFolder listener
166
private CTabFolder2Adapter expandListener = new CTabFolder2Adapter() {
167         public void minimize(CTabFolderEvent event) {
168             event.doit = false;
169             notifyButtonListeners(IStackPresentationSite.STATE_MINIMIZED);
170         }
171
172         public void restore(CTabFolderEvent event) {
173             event.doit = false;
174             notifyButtonListeners(IStackPresentationSite.STATE_RESTORED);
175         }
176
177         public void maximize(CTabFolderEvent event) {
178             event.doit = false;
179             notifyButtonListeners(IStackPresentationSite.STATE_MAXIMIZED);
180         }
181
182         /*
183          * (non-Javadoc)
184          *
185          * @see org.eclipse.swt.custom.CTabFolder2Adapter#close(org.eclipse.swt.custom.CTabFolderEvent)
186          */

187         public void close(CTabFolderEvent event) {
188             event.doit = false;
189             notifyCloseListeners((CTabItem) event.item);
190         }
191
192         public void showList(CTabFolderEvent event) {
193             notifyShowListeners(event);
194         }
195
196     };
197
198     private MouseListener mouseListener = new MouseAdapter() {
199         public void mouseDown(MouseEvent e) {
200             mousedownState = getState();
201         }
202
203         public void mouseDoubleClick(MouseEvent e) {
204         }
205     };
206
207     private boolean showButtons = true;
208     private boolean minimizeVisible = false;
209     private boolean maximizeVisible = false;
210
211     /**
212      * Make sure we don't recursively enter the layout() code.
213      */

214     private boolean inLayout = false;
215
216     private int tabPosition;
217
218     /**
219      * Creates a pane folder. This will create exactly one child control in the
220      * given parent.
221      *
222      * @param parent
223      * @param flags
224      */

225     public PaneFolder(Composite parent, int flags) {
226         // Initialize tab folder
227
{
228             tabFolder = new CTabFolder(parent, flags);
229             
230             tabFolder.setMRUVisible(((TabBehaviour)Tweaklets.get(TabBehaviour.KEY)).enableMRUTabVisibility());
231
232             // Create a proxy control to measure the title area of the tab folder
233
titleAreaProxy = new Composite(tabFolder, SWT.NO_BACKGROUND);
234             titleAreaProxy.setVisible(false);
235             titleAreaProxy.addControlListener(new ControlListener() {
236                 public void controlMoved(ControlEvent e) {
237                     topRightResized = true;
238                 }
239
240                 public void controlResized(ControlEvent e) {
241                     topRightResized = true;
242
243                     // bug 101683 - we need to do a layout of the PaneFolder
244
// when the title area proxy is resized.
245
if (!inLayout && !PaneFolder.this.isDisposed()
246                             && viewForm!=null && contentProxy!=null) {
247                         PaneFolder.this.aboutToResize();
248                         PaneFolder.this.layout(false);
249                     }
250                 }
251             });
252             tabFolder.setTopRight(titleAreaProxy, SWT.FILL);
253
254             tabFolder.addCTabFolder2Listener(expandListener);
255
256             tabFolder.addMouseListener(mouseListener);
257
258             tabFolder.addDisposeListener(tabFolderDisposeListener);
259         }
260
261         // Initialize view form
262
{
263             viewForm = new ViewForm(tabFolder, SWT.NO_BACKGROUND);
264
265             // Only attach these to the viewForm when there's actually a control
266
// to display
267
viewFormTopLeftProxy = new ProxyControl(viewForm);
268             viewFormTopCenterProxy = new ProxyControl(viewForm);
269             viewFormTopRightProxy = new ProxyControl(viewForm);
270
271             contentProxy = new ProxyControl(viewForm);
272             viewForm.setContent(contentProxy.getControl());
273         }
274     }
275
276     /**
277      * Returns the title area (the empty region to the right of the tabs), in
278      * the tab folder's coordinate system.
279      *
280      * @return the title area (the empty region to the right of the tabs)
281      */

282     public Rectangle getTitleArea() {
283         return titleAreaProxy.getBounds();
284     }
285
286     /**
287      * Return the main control for this pane folder
288      *
289      * @return
290      */

291     public Composite getControl() {
292         return tabFolder;
293     }
294
295     public void flushTopCenterSize() {
296         topCenterCache.flush();
297         viewForm.changed(new Control[] {viewFormTopCenterProxy.getControl()});
298     }
299     
300     /**
301      * Sets the top-center control (usually a toolbar), or null if none. Note
302      * that the control can have any parent.
303      *
304      * @param topCenter
305      * the top-center control or null if none
306      */

307     public void setTopCenter(Control topCenter) {
308         if (topCenter == topCenterCache.getControl()) {
309             return;
310         }
311
312         removeDisposeListener(topCenterCache.getControl());
313
314         topCenterCache.setControl(topCenter);
315         
316         if (putTrimOnTop) {
317             viewFormTopCenterProxy.setTarget(null);
318         } else {
319             viewFormTopCenterProxy.setTarget(topCenterCache);
320         }
321         
322         viewForm.changed(new Control[] {viewFormTopCenterProxy.getControl()});
323         
324         if (topCenter != null) {
325             topCenter.addDisposeListener(prematureDisposeListener);
326         
327             if (!putTrimOnTop) {
328                 if (!viewForm.isDisposed()) {
329                     viewForm.setTopCenter(viewFormTopCenterProxy.getControl());
330                 }
331             }
332         } else {
333             if (!putTrimOnTop) {
334                 if (!viewForm.isDisposed()) {
335                     viewForm.setTopCenter(null);
336                 }
337             }
338         }
339     }
340
341     /**
342      * Sets the top-right control (usually a dropdown), or null if none
343      *
344      * @param topRight
345      */

346     public void setTopRight(Control topRight) {
347         if (topRightCache.getControl() == topRight) {
348             return;
349         }
350
351         removeDisposeListener(topRightCache.getControl());
352
353         topRightCache.setControl(topRight);
354         
355         if (putTrimOnTop) {
356             viewFormTopRightProxy.setTarget(null);
357         } else {
358             viewFormTopRightProxy.setTarget(topRightCache);
359         }
360         
361         if (topRight != null) {
362             topRight.addDisposeListener(prematureDisposeListener);
363             if (!putTrimOnTop) {
364                 
365                 viewForm.setTopRight(viewFormTopRightProxy.getControl());
366             }
367         } else {
368             if (!putTrimOnTop) {
369                 viewForm.setTopRight(null);
370             }
371         }
372     }
373
374     /**
375      * Sets the top-left control (usually a title label), or null if none
376      *
377      * @param topLeft
378      */

379     public void setTopLeft(Control topLeft) {
380         if (topLeftCache.getControl() == topLeft) {
381             return;
382         }
383
384         removeDisposeListener(topLeftCache.getControl());
385
386         topLeftCache.setControl(topLeft);
387         // The top-left control always goes directly in the ViewForm
388
if (topLeft != null) {
389             topLeft.addDisposeListener(prematureDisposeListener);
390             viewFormTopLeftProxy.setTarget(topLeftCache);
391             viewForm.setTopLeft(viewFormTopLeftProxy.getControl());
392         } else {
393             viewFormTopLeftProxy.setTarget(null);
394             viewForm.setTopLeft(null);
395         }
396     }
397
398     /**
399      * Optimization: calling this method immediately before setting the
400      * control's bounds will allow for improved caching.
401      */

402     public void aboutToResize() {
403         useTopRightOptimization = true;
404         topRightResized = false;
405         lastWidth = getControl().getBounds().width;
406     }
407
408     /**
409      * Cause the folder to hide or show its
410      * Minimize and Maximize affordances.
411      *
412      * @param show
413      * <code>true</code> - the min/max buttons are visible.
414      * @since 3.3
415      */

416     public void showMinMax(boolean show) {
417         showButtons = show;
418         setMaximizeVisible(show);
419         setMinimizeVisible(show);
420         layout(true);
421     }
422     
423     public void layout(boolean flushCache) {
424         if (inLayout) {
425             return;
426         }
427         
428         inLayout = true;
429         try {
430             
431             viewForm.setLayoutDeferred(true);
432     
433             tabFolder.setMinimizeVisible(showButtons && minimizeVisible);
434             tabFolder.setMaximizeVisible(showButtons && maximizeVisible);
435     
436             // Flush the cached sizes if necessary
437
if (flushCache) {
438                 topLeftCache.flush();
439                 topRightCache.flush();
440                 topCenterCache.flush();
441             }
442     
443             // HACK: Force the tab folder to do a layout, since it doesn't always
444
// resize its title area each time setBounds is called.
445
if (!(useTopRightOptimization && (topRightResized || lastWidth == getControl()
446                     .getBounds().width))) {
447                 // If we can't use the optimization, then we need to force a layout
448
// of the tab folder
449
tabFolder.setTopRight(titleAreaProxy, SWT.FILL);
450             }
451             useTopRightOptimization = false;
452             // END OF HACK
453

454             Rectangle titleArea = DragUtil.getDisplayBounds(titleAreaProxy);
455     
456             Point topRightSize = topRightCache
457                     .computeSize(SWT.DEFAULT, SWT.DEFAULT);
458             Point topCenterSize = topCenterCache.computeSize(SWT.DEFAULT,
459                     SWT.DEFAULT);
460     
461             // Determine if there is enough room for the trim in the title area
462
int requiredWidth = topRightSize.x + topCenterSize.x;
463             int requiredHeight = Math.max(topRightSize.y, topCenterSize.y);
464     
465             boolean lastTrimOnTop = putTrimOnTop;
466             putTrimOnTop = (titleArea.width >= requiredWidth && titleArea.height >= requiredHeight);
467     
468             Control topRight = topRightCache.getControl();
469             Control topCenter = topCenterCache.getControl();
470     
471             if (putTrimOnTop) {
472                 // Try to avoid calling setTop* whenever possible, since this will
473
// trigger a layout
474
// of the viewForm.
475
if (!lastTrimOnTop) {
476                     // Arrange controls in the title bar
477
viewFormTopCenterProxy.setTarget(null);
478                     viewFormTopRightProxy.setTarget(null);
479                     viewForm.setTopCenter(null);
480                     viewForm.setTopRight(null);
481                 }
482     
483                 Rectangle topRightArea = new Rectangle(titleArea.x
484                         + titleArea.width - topRightSize.x, titleArea.y
485                         + (titleArea.height - topRightSize.y) / 2, topRightSize.x,
486                         topRightSize.y);
487     
488                 if (topRight != null) {
489                     topRight.setBounds(Geometry.toControl(topRight.getParent(),
490                             topRightArea));
491                 }
492     
493                 if (topCenter != null) {
494                     Rectangle topCenterArea = new Rectangle(topRightArea.x
495                             - topCenterSize.x, titleArea.y
496                             + (titleArea.height - topCenterSize.y) / 2,
497                             topCenterSize.x, topCenterSize.y);
498     
499                     Rectangle localCoords = Geometry.toControl(topCenter
500                             .getParent(), topCenterArea);
501                     
502                     topCenter.setBounds(localCoords);
503                 }
504             } else {
505                 if (lastTrimOnTop) {
506                     if (topCenter != null) {
507                         viewFormTopCenterProxy.setTarget(topCenterCache);
508                         viewForm.setTopCenter(viewFormTopCenterProxy.getControl());
509                     }
510     
511                     if (topRight != null) {
512                         viewFormTopRightProxy.setTarget(topRightCache);
513                         viewForm.setTopRight(viewFormTopRightProxy.getControl());
514                     }
515                 }
516             }
517     
518             Rectangle newBounds = tabFolder.getClientArea();
519             viewForm.setBounds(newBounds);
520         } finally {
521             viewForm.setLayoutDeferred(false);
522             inLayout = false;
523         }
524
525         viewFormTopRightProxy.layout();
526         viewFormTopLeftProxy.layout();
527         viewFormTopCenterProxy.layout();
528     }
529
530     public Composite getContentParent() {
531         return viewForm;
532     }
533
534     public void setContent(Control newContent) {
535         viewForm.setContent(newContent);
536     }
537
538     /**
539      * Returns the current state of the folder (as shown on the button icons)
540      *
541      * @return one of the IStackPresentationSite.STATE_* constants
542      */

543     public int getState() {
544         return state;
545     }
546
547     /**
548      * @param buttonId
549      * one of the IStackPresentationSite.STATE_* constants
550      */

551     protected void notifyButtonListeners(int buttonId) {
552         if (mousedownState == getState()) {
553             Iterator JavaDoc iter = buttonListeners.iterator();
554
555             while (iter.hasNext()) {
556                 PaneFolderButtonListener listener = (PaneFolderButtonListener) iter
557                         .next();
558
559                 listener.stateButtonPressed(buttonId);
560             }
561         }
562     }
563
564     public Control getContent() {
565         return viewForm.getContent();
566     }
567
568     /**
569      * Notifies all listeners that the user clicked on the chevron
570      *
571      * @param tabItem
572      */

573     protected void notifyShowListeners(CTabFolderEvent event) {
574         Iterator JavaDoc iter = buttonListeners.iterator();
575
576         while (iter.hasNext()) {
577             PaneFolderButtonListener listener = (PaneFolderButtonListener) iter
578                     .next();
579
580             listener.showList(event);
581         }
582     }
583
584     /**
585      * Notifies all listeners that the close button was pressed
586      *
587      * @param tabItem
588      */

589     protected void notifyCloseListeners(CTabItem tabItem) {
590         Iterator JavaDoc iter = buttonListeners.iterator();
591
592         while (iter.hasNext()) {
593             PaneFolderButtonListener listener = (PaneFolderButtonListener) iter
594                     .next();
595
596             listener.closeButtonPressed(tabItem);
597         }
598     }
599
600     /**
601      * Sets the state that will be shown on the CTabFolder's buttons
602      *
603      * @param state
604      * one of the IStackPresentationSite.STATE_* constants
605      */

606     public void setState(int state) {
607         this.state = state;
608
609         tabFolder.setMinimized(state == IStackPresentationSite.STATE_MINIMIZED);
610         tabFolder.setMaximized(state == IStackPresentationSite.STATE_MAXIMIZED);
611     }
612
613     public void addButtonListener(PaneFolderButtonListener listener) {
614         buttonListeners.add(listener);
615     }
616
617     public void removeButtonListener(PaneFolderButtonListener listener) {
618         buttonListeners.remove(listener);
619     }
620
621     public void setTabPosition(int newTabPosition) {
622         tabPosition = newTabPosition;
623         tabFolder.setTabPosition(tabPosition);
624     }
625
626     public int getTabPosition() {
627         return tabPosition;
628     }
629
630     public boolean isDisposed() {
631         return tabFolder == null || tabFolder.isDisposed();
632     }
633
634     public CTabItem createItem(int style, int index) {
635         return new CTabItem(tabFolder, style, index);
636     }
637
638     public Point computeMinimumSize() {
639         Point result = Geometry.getSize(tabFolder.computeTrim(0, 0, 0, 0));
640
641         // Add some space for the minimize and maximize buttons plus a tab.
642
// Right now this isn't exposed from SWT as API, so we just add 50
643
// pixels.
644
result.x += 100;
645         return result;
646     }
647
648     /**
649      * Removes the dispose listener from the given control, unless the given
650      * control is null or disposed.
651      *
652      * @param oldControl
653      * control to detach the dispose listener from
654      */

655     private void removeDisposeListener(Control oldControl) {
656         if (!SwtUtil.isDisposed(oldControl)) {
657             oldControl.removeDisposeListener(prematureDisposeListener);
658         }
659     }
660
661     private void widgetDisposed() {
662         removeDisposeListener(topCenterCache.getControl());
663         topCenterCache.setControl(null);
664         removeDisposeListener(topRightCache.getControl());
665         topRightCache.setControl(null);
666         removeDisposeListener(topLeftCache.getControl());
667         topLeftCache.setControl(null);
668     }
669
670     public Point getChevronLocation() {
671         // get the last visible item
672
int numItems = tabFolder.getItemCount();
673         CTabItem item = null, tempItem = null;
674         for (int i = 0; i < numItems; i++) {
675             tempItem = tabFolder.getItem(i);
676             if (tempItem.isShowing()) {
677                 item = tempItem;
678             }
679         }
680
681         // if we have no visible tabs, abort.
682
if (item == null) {
683             return new Point(0, 0);
684         }
685
686         Rectangle itemBounds = item.getBounds();
687         int x = itemBounds.x + itemBounds.width;
688         int y = itemBounds.y + itemBounds.height;
689         return new Point(x, y);
690     }
691
692     ///////////////////////////////////////////////////////////////////////////////////////
693
// The remainder of the methods in this class redirect directly to
694
// CTabFolder methods
695

696     public void setSelection(int selection) {
697         tabFolder.setSelection(selection);
698     }
699
700     /**
701      * @param i
702      * @param j
703      * @param k
704      * @param l
705      * @return
706      */

707     public Rectangle computeTrim(int i, int j, int k, int l) {
708         return tabFolder.computeTrim(i, j, k, l);
709     }
710
711     /**
712      * @param b
713      */

714     public void setUnselectedCloseVisible(boolean b) {
715         tabFolder.setUnselectedCloseVisible(b);
716     }
717
718     /**
719      * @param fgColor
720      */

721     public void setSelectionForeground(Color fgColor) {
722         tabFolder.setSelectionForeground(fgColor);
723     }
724
725     /**
726      * @param bgColors
727      * @param percentages
728      * @param vertical
729      */

730     public void setSelectionBackground(Color[] bgColors, int[] percentages,
731             boolean vertical) {
732         tabFolder.setSelectionBackground(bgColors, percentages, vertical);
733     }
734
735     public CTabItem getItem(int idx) {
736         return tabFolder.getItem(idx);
737     }
738
739     public int getSelectionIndex() {
740         return tabFolder.getSelectionIndex();
741     }
742
743     public int getTabHeight() {
744         return tabFolder.getTabHeight();
745     }
746
747     public int indexOf(CTabItem toFind) {
748         return tabFolder.indexOf(toFind);
749     }
750
751     public void setTabHeight(int height) {
752         tabFolder.setTabHeight(height);
753     }
754
755     /**
756      * @return
757      */

758     public int getItemCount() {
759         return tabFolder.getItemCount();
760     }
761
762     /**
763      * @return
764      */

765     public CTabItem[] getItems() {
766         return tabFolder.getItems();
767     }
768
769     public CTabItem getItem(Point toGet) {
770         return tabFolder.getItem(toGet);
771     }
772
773     public CTabItem getSelection() {
774         return tabFolder.getSelection();
775     }
776
777     /**
778      * @param isVisible
779      */

780     public void setMinimizeVisible(boolean isVisible) {
781         tabFolder.setMinimizeVisible(isVisible);
782         minimizeVisible = isVisible;
783     }
784
785     /**
786      * Changes the minimum number of characters to display in a pane folder tab.
787      * This control how much information will be displayed to the user.
788      *
789      * @param count
790      * The number of characters to display in the tab folder; this
791      * value should be a positive integer.
792      * @see org.eclipse.swt.custom.CTabFolder#setMinimumCharacters(int)
793      * @since 3.1
794      */

795     public void setMinimumCharacters(int count) {
796         tabFolder.setMinimumCharacters(count);
797     }
798
799     /**
800      * @param isVisible
801      */

802     public void setMaximizeVisible(boolean isVisible) {
803         tabFolder.setMaximizeVisible(isVisible);
804         maximizeVisible = isVisible;
805     }
806
807     /**
808      * @param traditionalTab
809      */

810     public void setSimpleTab(boolean traditionalTab) {
811         tabFolder.setSimple(traditionalTab);
812     }
813
814     /**
815      * @param b
816      */

817     public void setUnselectedImageVisible(boolean b) {
818         tabFolder.setUnselectedImageVisible(b);
819     }
820
821     /**
822      * @param b
823      */

824     public void setSingleTab(boolean b) {
825         tabFolder.setSingle(b);
826     }
827
828     public void hideTitle() {
829         tabFolder.setTabHeight(0);
830     }
831     
832     public ViewForm getViewForm() {
833         return viewForm;
834     }
835
836     /**
837      * Propogate the visibility change requests to the proxy controls. When
838      * their target is null, they no longer get visibility updates. Currently
839      * this only propagates the changes to the ProxyControls held by this
840      * folder.
841      *
842      * @param visible
843      * <code>true</code> - it's visible.
844      * @since 3.2
845      */

846     public void setVisible(boolean visible) {
847         contentProxy.setVisible(visible);
848         viewFormTopCenterProxy.setVisible(visible);
849         viewFormTopLeftProxy.setVisible(visible);
850         viewFormTopRightProxy.setVisible(visible);
851     }
852 }
853
Popular Tags