KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > r33 > 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.r33;
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 import org.eclipse.ui.presentations.StackPresentation;
44
45 /**
46  * This class implements the tab folders that contains can contain two toolbars
47  * and status text. Wherever possible, the toolbars are aligned with the tabs.
48  * If there is not enough room beside the tabs, the toolbars are aligned with
49  * the status text. This is the same tab folder that is used to arrange views
50  * and editors in Eclipse.
51  * <p>
52  * This is closely related to DefaultPartPresentation, but they have different
53  * responsibilities. This is essentially a CTabFolder that can manage a toolbar.
54  * It should not depend on data structures from the workbench, and its public
55  * interface should only use SWT objects or listeners. DefaultPartPresentation
56  * uses a PaneFolder to arrange views or editors. Knowledge of higher-level data
57  * structures should go there.
58  * </p>
59  * <p>
60  * Although it is not actually a control, the public interface is much like an
61  * SWT control. Implementation-wise, this is actually a combination of a
62  * CTabFolder and a ViewForm. It encapsulates the details of moving the toolbar
63  * between the CTabFolder and the ViewForm, and provides a simpler interface to
64  * the ViewForm/CTabFolder.
65  * </p>
66  * To be consistent with SWT composites, this object can deal with its children
67  * being disposed without warning. This is treated like a removal.
68  *
69  * @since 3.0
70  */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

548     public int getState() {
549         return state;
550     }
551
552     /**
553      * @param buttonId
554      * one of the IStackPresentationSite.STATE_* constants
555      */

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

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

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

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

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

701     public void setSelection(int selection) {
702         tabFolder.setSelection(selection);
703     }
704
705     /**
706      * @param i
707      * @param j
708      * @param k
709      * @param l
710      * @return
711      */

712     public Rectangle computeTrim(int i, int j, int k, int l) {
713         return tabFolder.computeTrim(i, j, k, l);
714     }
715
716     /**
717      * @param b
718      */

719     public void setUnselectedCloseVisible(boolean b) {
720         tabFolder.setUnselectedCloseVisible(b);
721     }
722
723     /**
724      * @param fgColor
725      */

726     public void setSelectionForeground(Color fgColor) {
727         tabFolder.setSelectionForeground(fgColor);
728     }
729
730     
731     /**
732      * Set the selection gradient with the activation state.
733      * @param bgColors
734      * @param percentages
735      * @param vertical
736      * @param activationState one of the {@link StackPresentation} AS constants.
737      */

738     public void setSelectionBackground(Color[] bgColors, int[] percentages, boolean vertical) {
739         tabFolder.setSelectionBackground(bgColors, percentages, vertical);
740     }
741
742     public CTabItem getItem(int idx) {
743         return tabFolder.getItem(idx);
744     }
745
746     public int getSelectionIndex() {
747         return tabFolder.getSelectionIndex();
748     }
749
750     public int getTabHeight() {
751         return tabFolder.getTabHeight();
752     }
753
754     public int indexOf(CTabItem toFind) {
755         return tabFolder.indexOf(toFind);
756     }
757
758     public void setTabHeight(int height) {
759         tabFolder.setTabHeight(height);
760     }
761
762     /**
763      * @return
764      */

765     public int getItemCount() {
766         return tabFolder.getItemCount();
767     }
768
769     /**
770      * @return
771      */

772     public CTabItem[] getItems() {
773         return tabFolder.getItems();
774     }
775
776     public CTabItem getItem(Point toGet) {
777         return tabFolder.getItem(toGet);
778     }
779
780     public CTabItem getSelection() {
781         return tabFolder.getSelection();
782     }
783
784     /**
785      * @param isVisible
786      */

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

802     public void setMinimumCharacters(int count) {
803         tabFolder.setMinimumCharacters(count);
804     }
805
806     /**
807      * @param isVisible
808      */

809     public void setMaximizeVisible(boolean isVisible) {
810         tabFolder.setMaximizeVisible(isVisible);
811         maximizeVisible = isVisible;
812     }
813
814     /**
815      * @param traditionalTab
816      */

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

824     public void setUnselectedImageVisible(boolean b) {
825         tabFolder.setUnselectedImageVisible(b);
826     }
827
828     /**
829      * @param b
830      */

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

853     public void setVisible(boolean visible) {
854         contentProxy.setVisible(visible);
855         viewFormTopCenterProxy.setVisible(visible);
856         viewFormTopLeftProxy.setVisible(visible);
857         viewFormTopRightProxy.setVisible(visible);
858     }
859 }
860
Popular Tags