001: /*******************************************************************************
002: * Copyright (c) 2004, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal.presentations.r33;
011:
012: import java.util.ArrayList;
013: import java.util.Iterator;
014: import java.util.List;
015:
016: import org.eclipse.jface.util.Geometry;
017: import org.eclipse.swt.SWT;
018: import org.eclipse.swt.custom.CTabFolder;
019: import org.eclipse.swt.custom.CTabFolder2Adapter;
020: import org.eclipse.swt.custom.CTabFolderEvent;
021: import org.eclipse.swt.custom.CTabItem;
022: import org.eclipse.swt.custom.ViewForm;
023: import org.eclipse.swt.events.ControlEvent;
024: import org.eclipse.swt.events.ControlListener;
025: import org.eclipse.swt.events.DisposeEvent;
026: import org.eclipse.swt.events.DisposeListener;
027: import org.eclipse.swt.events.MouseAdapter;
028: import org.eclipse.swt.events.MouseEvent;
029: import org.eclipse.swt.events.MouseListener;
030: import org.eclipse.swt.graphics.Color;
031: import org.eclipse.swt.graphics.Point;
032: import org.eclipse.swt.graphics.Rectangle;
033: import org.eclipse.swt.widgets.Composite;
034: import org.eclipse.swt.widgets.Control;
035: import org.eclipse.ui.internal.dnd.DragUtil;
036: import org.eclipse.ui.internal.dnd.SwtUtil;
037: import org.eclipse.ui.internal.layout.SizeCache;
038: import org.eclipse.ui.internal.presentations.util.ProxyControl;
039: import org.eclipse.ui.internal.tweaklets.TabBehaviour;
040: import org.eclipse.ui.internal.tweaklets.Tweaklets;
041: import org.eclipse.ui.presentations.IStackPresentationSite;
042: import org.eclipse.ui.presentations.StackPresentation;
043:
044: /**
045: * This class implements the tab folders that contains can contain two toolbars
046: * and status text. Wherever possible, the toolbars are aligned with the tabs.
047: * If there is not enough room beside the tabs, the toolbars are aligned with
048: * the status text. This is the same tab folder that is used to arrange views
049: * and editors in Eclipse.
050: * <p>
051: * This is closely related to DefaultPartPresentation, but they have different
052: * responsibilities. This is essentially a CTabFolder that can manage a toolbar.
053: * It should not depend on data structures from the workbench, and its public
054: * interface should only use SWT objects or listeners. DefaultPartPresentation
055: * uses a PaneFolder to arrange views or editors. Knowledge of higher-level data
056: * structures should go there.
057: * </p>
058: * <p>
059: * Although it is not actually a control, the public interface is much like an
060: * SWT control. Implementation-wise, this is actually a combination of a
061: * CTabFolder and a ViewForm. It encapsulates the details of moving the toolbar
062: * between the CTabFolder and the ViewForm, and provides a simpler interface to
063: * the ViewForm/CTabFolder.
064: * </p>
065: * To be consistent with SWT composites, this object can deal with its children
066: * being disposed without warning. This is treated like a removal.
067: *
068: * @since 3.0
069: */
070: public final class PaneFolder {
071: // Tab folder and associated proxy controls
072: private CTabFolder tabFolder;
073:
074: private Control titleAreaProxy;
075:
076: // View form and associated proxy controls
077: private ViewForm viewForm;
078:
079: private ProxyControl contentProxy;
080:
081: private ProxyControl viewFormTopLeftProxy;
082:
083: private ProxyControl viewFormTopRightProxy;
084:
085: private ProxyControl viewFormTopCenterProxy;
086:
087: // Cached sizes of the top-right and top-center controls
088: private SizeCache topRightCache = new SizeCache();
089:
090: private SizeCache topCenterCache = new SizeCache();
091:
092: private SizeCache topLeftCache = new SizeCache();
093:
094: private boolean putTrimOnTop = true;
095:
096: // HACK: Sometimes the topright control isn't resized when
097: // CTabFolder.setBounds is called.
098: // We use the following data structures to detect if this has happened and
099: // 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 buttonListeners = new ArrayList(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
231: .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
300: .getControl() });
301: }
302:
303: /**
304: * Sets the top-center control (usually a toolbar), or null if none. Note
305: * that the control can have any parent.
306: *
307: * @param topCenter
308: * the top-center control or null if none
309: */
310: public void setTopCenter(Control topCenter) {
311: if (topCenter == topCenterCache.getControl()) {
312: return;
313: }
314:
315: removeDisposeListener(topCenterCache.getControl());
316:
317: topCenterCache.setControl(topCenter);
318:
319: if (putTrimOnTop) {
320: viewFormTopCenterProxy.setTarget(null);
321: } else {
322: viewFormTopCenterProxy.setTarget(topCenterCache);
323: }
324:
325: viewForm.changed(new Control[] { viewFormTopCenterProxy
326: .getControl() });
327:
328: if (topCenter != null) {
329: topCenter.addDisposeListener(prematureDisposeListener);
330:
331: if (!putTrimOnTop) {
332: if (!viewForm.isDisposed()) {
333: viewForm.setTopCenter(viewFormTopCenterProxy
334: .getControl());
335: }
336: }
337: } else {
338: if (!putTrimOnTop) {
339: if (!viewForm.isDisposed()) {
340: viewForm.setTopCenter(null);
341: }
342: }
343: }
344: }
345:
346: /**
347: * Sets the top-right control (usually a dropdown), or null if none
348: *
349: * @param topRight
350: */
351: public void setTopRight(Control topRight) {
352: if (topRightCache.getControl() == topRight) {
353: return;
354: }
355:
356: removeDisposeListener(topRightCache.getControl());
357:
358: topRightCache.setControl(topRight);
359:
360: if (putTrimOnTop) {
361: viewFormTopRightProxy.setTarget(null);
362: } else {
363: viewFormTopRightProxy.setTarget(topRightCache);
364: }
365:
366: if (topRight != null) {
367: topRight.addDisposeListener(prematureDisposeListener);
368: if (!putTrimOnTop) {
369:
370: viewForm
371: .setTopRight(viewFormTopRightProxy.getControl());
372: }
373: } else {
374: if (!putTrimOnTop) {
375: viewForm.setTopRight(null);
376: }
377: }
378: }
379:
380: /**
381: * Sets the top-left control (usually a title label), or null if none
382: *
383: * @param topLeft
384: */
385: public void setTopLeft(Control topLeft) {
386: if (topLeftCache.getControl() == topLeft) {
387: return;
388: }
389:
390: removeDisposeListener(topLeftCache.getControl());
391:
392: topLeftCache.setControl(topLeft);
393: // The top-left control always goes directly in the ViewForm
394: if (topLeft != null) {
395: topLeft.addDisposeListener(prematureDisposeListener);
396: viewFormTopLeftProxy.setTarget(topLeftCache);
397: viewForm.setTopLeft(viewFormTopLeftProxy.getControl());
398: } else {
399: viewFormTopLeftProxy.setTarget(null);
400: viewForm.setTopLeft(null);
401: }
402: }
403:
404: /**
405: * Optimization: calling this method immediately before setting the
406: * control's bounds will allow for improved caching.
407: */
408: public void aboutToResize() {
409: useTopRightOptimization = true;
410: topRightResized = false;
411: lastWidth = getControl().getBounds().width;
412: }
413:
414: /**
415: * Cause the folder to hide or show its Minimize and Maximize affordances.
416: *
417: * @param show
418: * <code>true</code> - the min/max buttons are visible.
419: * @since 3.3
420: */
421: public void showMinMax(boolean show) {
422: showButtons = show;
423: setMaximizeVisible(show);
424: setMinimizeVisible(show);
425: layout(true);
426: }
427:
428: public void layout(boolean flushCache) {
429: if (inLayout) {
430: return;
431: }
432:
433: inLayout = true;
434: try {
435:
436: viewForm.setLayoutDeferred(true);
437:
438: tabFolder
439: .setMinimizeVisible(showButtons && minimizeVisible);
440: tabFolder
441: .setMaximizeVisible(showButtons && maximizeVisible);
442:
443: // Flush the cached sizes if necessary
444: if (flushCache) {
445: topLeftCache.flush();
446: topRightCache.flush();
447: topCenterCache.flush();
448: }
449:
450: // HACK: Force the tab folder to do a layout, since it doesn't
451: // always
452: // resize its title area each time setBounds is called.
453: if (!(useTopRightOptimization && (topRightResized || lastWidth == getControl()
454: .getBounds().width))) {
455: // If we can't use the optimization, then we need to force a
456: // layout
457: // of the tab folder
458: tabFolder.setTopRight(titleAreaProxy, SWT.FILL);
459: }
460: useTopRightOptimization = false;
461: // END OF HACK
462:
463: Rectangle titleArea = DragUtil
464: .getDisplayBounds(titleAreaProxy);
465:
466: Point topRightSize = topRightCache.computeSize(SWT.DEFAULT,
467: SWT.DEFAULT);
468: Point topCenterSize = topCenterCache.computeSize(
469: SWT.DEFAULT, SWT.DEFAULT);
470:
471: // Determine if there is enough room for the trim in the title area
472: int requiredWidth = topRightSize.x + topCenterSize.x;
473: int requiredHeight = Math.max(topRightSize.y,
474: topCenterSize.y);
475:
476: boolean lastTrimOnTop = putTrimOnTop;
477: putTrimOnTop = (titleArea.width >= requiredWidth && titleArea.height >= requiredHeight);
478:
479: Control topRight = topRightCache.getControl();
480: Control topCenter = topCenterCache.getControl();
481:
482: if (putTrimOnTop) {
483: // Try to avoid calling setTop* whenever possible, since this
484: // will
485: // trigger a layout
486: // of the viewForm.
487: if (!lastTrimOnTop) {
488: // Arrange controls in the title bar
489: viewFormTopCenterProxy.setTarget(null);
490: viewFormTopRightProxy.setTarget(null);
491: viewForm.setTopCenter(null);
492: viewForm.setTopRight(null);
493: }
494:
495: Rectangle topRightArea = new Rectangle(titleArea.x
496: + titleArea.width - topRightSize.x, titleArea.y
497: + (titleArea.height - topRightSize.y) / 2,
498: topRightSize.x, topRightSize.y);
499:
500: if (topRight != null) {
501: topRight.setBounds(Geometry.toControl(topRight
502: .getParent(), topRightArea));
503: }
504:
505: if (topCenter != null) {
506: Rectangle topCenterArea = new Rectangle(
507: topRightArea.x - topCenterSize.x,
508: titleArea.y
509: + (titleArea.height - topCenterSize.y)
510: / 2, topCenterSize.x,
511: topCenterSize.y);
512:
513: Rectangle localCoords = Geometry.toControl(
514: topCenter.getParent(), topCenterArea);
515:
516: topCenter.setBounds(localCoords);
517: }
518: } else {
519: // always reset since the toolbar may have changed size...
520: if (topCenter != null) {
521: viewFormTopCenterProxy.setTarget(topCenterCache);
522: viewForm.setTopCenter(viewFormTopCenterProxy
523: .getControl());
524: }
525:
526: if (topRight != null) {
527: viewFormTopRightProxy.setTarget(topRightCache);
528: viewForm.setTopRight(viewFormTopRightProxy
529: .getControl());
530: }
531: }
532:
533: Rectangle newBounds = tabFolder.getClientArea();
534: viewForm.setBounds(newBounds);
535: } finally {
536: viewForm.setLayoutDeferred(false);
537: inLayout = false;
538: }
539:
540: viewFormTopRightProxy.layout();
541: viewFormTopLeftProxy.layout();
542: viewFormTopCenterProxy.layout();
543: }
544:
545: public Composite getContentParent() {
546: return viewForm;
547: }
548:
549: public void setContent(Control newContent) {
550: viewForm.setContent(newContent);
551: }
552:
553: /**
554: * Returns the current state of the folder (as shown on the button icons)
555: *
556: * @return one of the IStackPresentationSite.STATE_* constants
557: */
558: public int getState() {
559: return state;
560: }
561:
562: /**
563: * @param buttonId
564: * one of the IStackPresentationSite.STATE_* constants
565: */
566: protected void notifyButtonListeners(int buttonId) {
567: if (mousedownState == getState()) {
568: Iterator iter = buttonListeners.iterator();
569:
570: while (iter.hasNext()) {
571: PaneFolderButtonListener listener = (PaneFolderButtonListener) iter
572: .next();
573:
574: listener.stateButtonPressed(buttonId);
575: }
576: }
577: }
578:
579: public Control getContent() {
580: return viewForm.getContent();
581: }
582:
583: /**
584: * Notifies all listeners that the user clicked on the chevron
585: *
586: * @param tabItem
587: */
588: protected void notifyShowListeners(CTabFolderEvent event) {
589: Iterator iter = buttonListeners.iterator();
590:
591: while (iter.hasNext()) {
592: PaneFolderButtonListener listener = (PaneFolderButtonListener) iter
593: .next();
594:
595: listener.showList(event);
596: }
597: }
598:
599: /**
600: * Notifies all listeners that the close button was pressed
601: *
602: * @param tabItem
603: */
604: protected void notifyCloseListeners(CTabItem tabItem) {
605: Iterator iter = buttonListeners.iterator();
606:
607: while (iter.hasNext()) {
608: PaneFolderButtonListener listener = (PaneFolderButtonListener) iter
609: .next();
610:
611: listener.closeButtonPressed(tabItem);
612: }
613: }
614:
615: /**
616: * Sets the state that will be shown on the CTabFolder's buttons
617: *
618: * @param state
619: * one of the IStackPresentationSite.STATE_* constants
620: */
621: public void setState(int state) {
622: this .state = state;
623:
624: tabFolder
625: .setMinimized(state == IStackPresentationSite.STATE_MINIMIZED);
626: tabFolder
627: .setMaximized(state == IStackPresentationSite.STATE_MAXIMIZED);
628: }
629:
630: public void addButtonListener(PaneFolderButtonListener listener) {
631: buttonListeners.add(listener);
632: }
633:
634: public void removeButtonListener(PaneFolderButtonListener listener) {
635: buttonListeners.remove(listener);
636: }
637:
638: public void setTabPosition(int newTabPosition) {
639: tabPosition = newTabPosition;
640: tabFolder.setTabPosition(tabPosition);
641: }
642:
643: public int getTabPosition() {
644: return tabPosition;
645: }
646:
647: public boolean isDisposed() {
648: return tabFolder == null || tabFolder.isDisposed();
649: }
650:
651: public CTabItem createItem(int style, int index) {
652: return new CTabItem(tabFolder, style, index);
653: }
654:
655: public Point computeMinimumSize() {
656: Point result = Geometry.getSize(tabFolder.computeTrim(0, 0, 0,
657: 0));
658:
659: // Add some space for the minimize and maximize buttons plus a tab.
660: // Right now this isn't exposed from SWT as API, so we just add 50
661: // pixels.
662: result.x += 100;
663: return result;
664: }
665:
666: /**
667: * Removes the dispose listener from the given control, unless the given
668: * control is null or disposed.
669: *
670: * @param oldControl
671: * control to detach the dispose listener from
672: */
673: private void removeDisposeListener(Control oldControl) {
674: if (!SwtUtil.isDisposed(oldControl)) {
675: oldControl.removeDisposeListener(prematureDisposeListener);
676: }
677: }
678:
679: private void widgetDisposed() {
680: removeDisposeListener(topCenterCache.getControl());
681: topCenterCache.setControl(null);
682: removeDisposeListener(topRightCache.getControl());
683: topRightCache.setControl(null);
684: removeDisposeListener(topLeftCache.getControl());
685: topLeftCache.setControl(null);
686: }
687:
688: public Point getChevronLocation() {
689: // get the last visible item
690: int numItems = tabFolder.getItemCount();
691: CTabItem item = null, tempItem = null;
692: for (int i = 0; i < numItems; i++) {
693: tempItem = tabFolder.getItem(i);
694: if (tempItem.isShowing()) {
695: item = tempItem;
696: }
697: }
698:
699: // if we have no visible tabs, abort.
700: if (item == null) {
701: return new Point(0, 0);
702: }
703:
704: Rectangle itemBounds = item.getBounds();
705: int x = itemBounds.x + itemBounds.width;
706: int y = itemBounds.y + itemBounds.height;
707: return new Point(x, y);
708: }
709:
710: // /////////////////////////////////////////////////////////////////////////////////////
711: // The remainder of the methods in this class redirect directly to
712: // CTabFolder methods
713:
714: public void setSelection(int selection) {
715: tabFolder.setSelection(selection);
716: }
717:
718: /**
719: * @param i
720: * @param j
721: * @param k
722: * @param l
723: * @return
724: */
725: public Rectangle computeTrim(int i, int j, int k, int l) {
726: return tabFolder.computeTrim(i, j, k, l);
727: }
728:
729: /**
730: * @param b
731: */
732: public void setUnselectedCloseVisible(boolean b) {
733: tabFolder.setUnselectedCloseVisible(b);
734: }
735:
736: /**
737: * @param fgColor
738: */
739: public void setSelectionForeground(Color fgColor) {
740: tabFolder.setSelectionForeground(fgColor);
741: }
742:
743: /**
744: * Set the selection gradient with the activation state.
745: * @param bgColors
746: * @param percentages
747: * @param vertical
748: * @param activationState one of the {@link StackPresentation} AS constants.
749: */
750: public void setSelectionBackground(Color[] bgColors,
751: int[] percentages, boolean vertical) {
752: tabFolder.setSelectionBackground(bgColors, percentages,
753: vertical);
754: }
755:
756: public CTabItem getItem(int idx) {
757: return tabFolder.getItem(idx);
758: }
759:
760: public int getSelectionIndex() {
761: return tabFolder.getSelectionIndex();
762: }
763:
764: public int getTabHeight() {
765: return tabFolder.getTabHeight();
766: }
767:
768: public int indexOf(CTabItem toFind) {
769: return tabFolder.indexOf(toFind);
770: }
771:
772: public void setTabHeight(int height) {
773: tabFolder.setTabHeight(height);
774: }
775:
776: /**
777: * @return
778: */
779: public int getItemCount() {
780: return tabFolder.getItemCount();
781: }
782:
783: /**
784: * @return
785: */
786: public CTabItem[] getItems() {
787: return tabFolder.getItems();
788: }
789:
790: public CTabItem getItem(Point toGet) {
791: return tabFolder.getItem(toGet);
792: }
793:
794: public CTabItem getSelection() {
795: return tabFolder.getSelection();
796: }
797:
798: /**
799: * @param isVisible
800: */
801: public void setMinimizeVisible(boolean isVisible) {
802: tabFolder.setMinimizeVisible(isVisible);
803: minimizeVisible = isVisible;
804: }
805:
806: /**
807: * Changes the minimum number of characters to display in a pane folder tab.
808: * This control how much information will be displayed to the user.
809: *
810: * @param count
811: * The number of characters to display in the tab folder; this
812: * value should be a positive integer.
813: * @see org.eclipse.swt.custom.CTabFolder#setMinimumCharacters(int)
814: * @since 3.1
815: */
816: public void setMinimumCharacters(int count) {
817: tabFolder.setMinimumCharacters(count);
818: }
819:
820: /**
821: * @param isVisible
822: */
823: public void setMaximizeVisible(boolean isVisible) {
824: tabFolder.setMaximizeVisible(isVisible);
825: maximizeVisible = isVisible;
826: }
827:
828: /**
829: * @param traditionalTab
830: */
831: public void setSimpleTab(boolean traditionalTab) {
832: tabFolder.setSimple(traditionalTab);
833: }
834:
835: /**
836: * @param b
837: */
838: public void setUnselectedImageVisible(boolean b) {
839: tabFolder.setUnselectedImageVisible(b);
840: }
841:
842: /**
843: * @param b
844: */
845: public void setSingleTab(boolean b) {
846: tabFolder.setSingle(b);
847: }
848:
849: public void hideTitle() {
850: tabFolder.setTabHeight(0);
851: }
852:
853: public ViewForm getViewForm() {
854: return viewForm;
855: }
856:
857: /**
858: * Propogate the visibility change requests to the proxy controls. When
859: * their target is null, they no longer get visibility updates. Currently
860: * this only propagates the changes to the ProxyControls held by this
861: * folder.
862: *
863: * @param visible
864: * <code>true</code> - it's visible.
865: * @since 3.2
866: */
867: public void setVisible(boolean visible) {
868: contentProxy.setVisible(visible);
869: viewFormTopCenterProxy.setVisible(visible);
870: viewFormTopLeftProxy.setVisible(visible);
871: viewFormTopRightProxy.setVisible(visible);
872: }
873: }
|