View Javadoc

1   /*
2    * Copyright (c) 2003-2008 by Cosylab d. d.
3    *
4    * This file is part of CosyBeans-Common.
5    *
6    * CosyBeans-Common is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * CosyBeans-Common is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with CosyBeans-Common.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package com.cosylab.gui.components;
21  
22  import java.awt.Color;
23  import java.awt.Dimension;
24  import java.awt.GridBagConstraints;
25  import java.awt.GridBagLayout;
26  import java.awt.Insets;
27  import java.awt.event.ActionEvent;
28  import java.awt.event.ComponentAdapter;
29  import java.awt.event.ComponentEvent;
30  import java.awt.event.ComponentListener;
31  import java.beans.Beans;
32  
33  import javax.swing.AbstractAction;
34  import javax.swing.JComponent;
35  import javax.swing.JLabel;
36  import javax.swing.JPanel;
37  import javax.swing.TransferHandler;
38  
39  import com.cosylab.application.state.State;
40  import com.cosylab.application.state.StateFactory;
41  import com.cosylab.application.state.StateOriginator;
42  import com.cosylab.gui.components.customizer.AbstractCustomizerPanel;
43  import com.cosylab.gui.components.util.ColorHelper;
44  import com.cosylab.gui.components.util.CosyTransferHandler;
45  import com.cosylab.gui.components.util.CosyUIElements;
46  import com.cosylab.gui.components.util.PopupManageable;
47  import com.cosylab.gui.components.util.PopupManager;
48  import com.cosylab.gui.components.util.ScreenCapturer;
49  
50  
51  /**
52   * A container for simple displayers is able to display a small dispalyer
53   * component  together with an optional title in a vertical or horizontal
54   * resizable layout. It also supports
55   * <code>com.cosylab.gui.components.util.PopupManager</code> and
56   * <code>com.cosylab.gui.components.customizer.Customizer</code>.
57   *
58   * @author <a href="mailto:jernej.kamenik@cosylab.com">Jernej Kamenik</a>
59   * @version $id$
60   */
61  public abstract class AbstractDisplayerPanel extends JPanel
62  	implements PopupManageable, StateOriginator 
63  {
64  	private static final long serialVersionUID = 1L;
65  
66  	/** Lays out the components horizontaly. */
67  	public static final int HORIZONTAL_LAYOUT = 0;
68  
69  	/** Lays out componetns vertically */
70  	public static final int VERTICAL_LAYOUT = 1;
71  
72  	
73  	/**
74  	 * Lays out components either horizontally or vertically according to the
75  	 * space available
76  	 */
77  	public static final int DYNAMIC_LAYOUT = 2;
78  	private ComponentListener resizeListener;
79  	private AbstractCustomizerPanel customizer;
80  	private PopupManager popupManager;
81  	private boolean popupEnabled;
82  	private ResizableTextLabel titleLabel;
83  	private String title;
84  	private boolean enhanced;
85  	private boolean resizable;
86  	private int minTitleFontSize = 0;
87  	private int maxTitleFontSize = Integer.MAX_VALUE;
88  	private boolean titleVisible;
89  	private int layoutOrientation = DYNAMIC_LAYOUT;
90  
91  	/**
92  	 * Constructs AbstractDisplayerPanel already containing the
93  	 * <code>valueComponent</code>.
94  	 */
95  	public AbstractDisplayerPanel()
96  	{
97  		this(null, false, DYNAMIC_LAYOUT, true, true, true, 1, Integer.MAX_VALUE);
98  	}
99  
100 	/**
101 	 * Constructs AbstractDisplayerPanel already containing the
102 	 * <code>valueComponent</code> with inital values. It is cheap to set
103 	 * values now, since component is not in AWT containment.
104 	 *
105 	 * @param title initial value
106 	 * @param titleVisible initial value
107 	 * @param layoutOrientation initial value
108 	 * @param resizable initial value
109 	 * @param enabled initial value
110 	 * @param enchanced initial value
111 	 * @param minTitleFontSize initial value
112 	 * @param maxTitleFontSize initial value
113 	 */
114 	public AbstractDisplayerPanel(String title, boolean titleVisible,
115 	    int layoutOrientation, boolean resizable, boolean enabled,
116 	    boolean enchanced, int minTitleFontSize, int maxTitleFontSize)
117 	{
118 		super();
119 
120 		setBackground(ColorHelper.getCosyControl());
121 		setBorder(new CosyUIElements.PanelFlushBorder());
122 		setPreferredSize(new Dimension(200, 50));
123 		setMinimumSize(new Dimension(200, 50));
124 		setLayout(new GridBagLayout());
125 
126 		//RT#4567 fix
127 		addComponentListener(new ComponentAdapter() {
128 				public void componentResized(ComponentEvent e)
129 				{
130 					layoutDisplayer();
131 				}
132 			});
133 
134 		//end fix
135 		setTitle(title);
136 		setTitleVisible(titleVisible);
137 		setLayoutOrientation(layoutOrientation);
138 		setResizable(resizable);
139 		setEnabled(enabled);
140 		setEnhanced(enchanced);
141 		setTitleMinimumFontSize(minTitleFontSize);
142 		setTitleMaximumFontSize(maxTitleFontSize);
143 		setPopupEnabled(true);
144 	}
145 
146 	/**
147 	 * Loads the default
148 	 * <code>com.cosylab.gui.components.customizer.Customizer</code> for this
149 	 * displayer and returns it.
150 	 *
151 	 * @return the Customizer intance for this displayer
152 	 */
153 	public AbstractCustomizerPanel getCustomizer()
154 	{
155 		if (customizer == null) {
156 			customizer = AbstractCustomizerPanel.findCustomizer(this);
157 		}
158 
159 		return customizer;
160 	}
161 
162 	/**
163 	 * Overriden to disable subcomponents.
164 	 *
165 	 * @param enabled if the component is to be enabled
166 	 */
167 	public void setEnabled(boolean enabled)
168 	{
169 		if (enabled == isEnabled()) {
170 			return;
171 		}
172 
173 		super.setEnabled(enabled);
174 		internalSetEnabled();
175 	}
176 
177 	/**
178 	 * Sets the enhanced property of the displayer panel
179 	 *
180 	 * @param b whether to render in enhanced mode
181 	 */
182 	public void setEnhanced(boolean b)
183 	{
184 		if (enhanced == b) {
185 			return;
186 		}
187 
188 		enhanced = b;
189 		internalSetEnhanced();
190 		firePropertyChange("enhanced", !b, b);
191 	}
192 
193 	/**
194 	 * Determines whether the displayer panel is to be rendered enhanced.
195 	 *
196 	 * @return true if diaplayer panel is enhanced
197 	 */
198 	public boolean isEnhanced()
199 	{
200 		return enhanced;
201 	}
202 
203 	/**
204 	 * Sets the orientation tag determining how the title and value components
205 	 * should be layed out inside the panel.
206 	 *
207 	 * @param i layout tag, valid values are <code>HORIZONTAL_LAYOUT</code>,
208 	 *        <code>VERTICAL_LAYOUT</code>, <code>DYNAMIC_LAYOUT</code>
209 	 *
210 	 * @throws IllegalArgumentException if no applicable parameter is supplied
211 	 *
212 	 * @see #getLayoutOrientation()
213 	 */
214 	public void setLayoutOrientation(int i)
215 	{
216 		if (i == layoutOrientation) {
217 			return;
218 		}
219 
220 		if (i != HORIZONTAL_LAYOUT && i != VERTICAL_LAYOUT
221 		    && i != DYNAMIC_LAYOUT) {
222 			throw new IllegalArgumentException();
223 		}
224 
225 		int oldVal = layoutOrientation;
226 
227 		layoutOrientation = i;
228 
229 		if (i == DYNAMIC_LAYOUT) {
230 			addComponentListener(getResizeListener());
231 		} else if (oldVal == DYNAMIC_LAYOUT) {
232 			removeComponentListener(getResizeListener());
233 		}
234 
235 		layoutDisplayer();
236 		firePropertyChange("layoutOrientation", oldVal, i);
237 	}
238 
239 	/**
240 	 * <p>
241 	 * Returns the current layout orientation setting.
242 	 * </p>
243 	 * 
244 	 * <p>
245 	 * Possible values are:
246 	 * 
247 	 * <ul>
248 	 * <li>
249 	 * <code>#HORIZONTAL_LAYOUT</code> - the title and value components are
250 	 * displayed side by side horizontally
251 	 * </li>
252 	 * <li>
253 	 * <code>#VERTICAL_LAYOUT</code> - the title and value components are
254 	 * displayed vertically, title above the value
255 	 * </li>
256 	 * <li>
257 	 * <code>#DYNAMIC_LAYOUT</code> - the orientation of the components inside
258 	 * the panel is determined dynamically on the basisi of the components
259 	 * preferred sizes so as to most affectivelly fill up the space available.
260 	 * </li>
261 	 * </ul>
262 	 * </p>
263 	 *
264 	 * @return int
265 	 */
266 	public int getLayoutOrientation()
267 	{
268 		return layoutOrientation;
269 	}
270 
271 	/**
272 	 * Returns popum manager for adding popup actions.
273 	 *
274 	 * @see com.cosylab.gui.components.util.PopupManageable#getPopupManager()
275 	 */
276 	public PopupManager getPopupManager()
277 	{
278 		if (popupManager == null) {
279 			popupManager = new PopupManager(this, false);
280 			popupManager.addAction(new AbstractAction("Preferences...") {
281 				private static final long serialVersionUID = 1L;
282 					public void actionPerformed(ActionEvent e)
283 					{
284 						getCustomizer().showDialog();
285 					}
286 				});
287 			popupManager.addAction(new AbstractAction("Capture screen..."){
288 				private static final long serialVersionUID = 1L;
289 
290 				public void actionPerformed(ActionEvent e){
291 				   	ScreenCapturer sc = new ScreenCapturer(AbstractDisplayerPanel.this);
292 					sc.showScreenDialog();
293 				   }
294 			});
295 		}
296 
297 		return popupManager;
298 	}
299 	
300 	/**
301 	 * Return true if the popup menu is enabled or false otherwise.
302 	 * 
303 	 * @return true if popup is enabled
304 	 */
305 	public boolean isPopupEnabled() {
306 		return popupEnabled;
307 	}
308 	
309 	/**
310 	 * Enables or disables the popup menu.
311 	 * 
312 	 * @param enabled true if enable or false if disableds
313 	 */
314 	public void setPopupEnabled(boolean enabled) {
315 		if (popupEnabled == enabled) return;
316 		popupEnabled = enabled;
317 		if (enabled) {
318 			getValueComponent().addMouseListener(getPopupManager().getMouseHook());
319 			addMouseListener(getPopupManager().getMouseHook());
320 			getTitleComponent().addMouseListener(getPopupManager().getMouseHook());
321 		} else {
322 			getValueComponent().removeMouseListener(getPopupManager().getMouseHook());
323 			removeMouseListener(getPopupManager().getMouseHook());
324 			getTitleComponent().removeMouseListener(getPopupManager().getMouseHook());
325 		}		
326 		firePropertyChange("popupEnabled",!popupEnabled,popupEnabled);
327 	}
328 
329 	/**
330 	 * Sets the resizability of the title and value components of the panel.
331 	 *
332 	 * @param b wether the title and value components should adjust their sizes
333 	 *        in accord with the size of the panel.
334 	 *
335 	 * @see #isResizable()
336 	 */
337 	public void setResizable(boolean b)
338 	{
339 		if (resizable == b) {
340 			return;
341 		}
342 
343 		resizable = b;
344 		internalSetResizable();
345 		layoutDisplayer();
346 		firePropertyChange("resizable", !b, b);
347 	}
348 
349 	/**
350 	 * <p>
351 	 * Determines wether the components inside the panel should resize together
352 	 * with the panel or should maintain their preferred sizes.
353 	 * </p>
354 	 * 
355 	 * <p>
356 	 * When disabled, the size of the components inside the panel is determined
357 	 * according to the <i>preferred size</i> of the panel.
358 	 * </p>
359 	 *
360 	 * @return <code>true</code> if the title and value components resize
361 	 *         accordingly with the size of the panel, <code>false</code>
362 	 *         otherwise.
363 	 */
364 	public boolean isResizable()
365 	{
366 		return resizable;
367 	}
368 
369 	/**
370 	 * Sets the state to the component.
371 	 *
372 	 * @param state to set.
373 	 *
374 	 * @see com.cosylab.application.state.StateOriginator#setState(com.cosylab.application.state.State)
375 	 */
376 	public void setState(State state)
377 	{
378 		setTitle(state.getString("title", getTitle()));
379 		setResizable(state.getBoolean("resizable", isResizable()));
380 		setTitleVisible(state.getBoolean("titleVisible", isTitleVisible()));
381 		setLayoutOrientation(state.getInt("layoutOrientation",
382 		        getLayoutOrientation()));
383 	}
384 
385 	/**
386 	 * Returns the current state of the component.
387 	 *
388 	 * @return current state.
389 	 *
390 	 * @see com.cosylab.application.state.StateOriginator#getState()
391 	 */
392 	public State getState()
393 	{
394 		State state = StateFactory.createState();
395 
396 		state.putBoolean("resizable", isResizable());
397 		state.putString("title", getTitle());
398 		state.putBoolean("titleVisible", isTitleVisible());
399 		state.putInt("layoutOrientation", getLayoutOrientation());
400 
401 		return state;
402 	}
403 
404 	/**
405 	 * Sets the title to be displayed beside the value component.
406 	 *
407 	 * @param value title String to be displayed
408 	 */
409 	public void setTitle(String value)
410 	{
411 		String oldVal = title;
412 		title = value;
413 		internalSetTitle();
414 		layoutDisplayer();
415 		firePropertyChange("title", oldVal, value);
416 	}
417 
418 	/**
419 	 * Returns the title displayed beside the value component.
420 	 *
421 	 * @return title displayed
422 	 */
423 	public String getTitle()
424 	{
425 		return title;
426 	}
427 
428 	/**
429 	 * Adds or removes the Title displayed beside the value component.
430 	 *
431 	 * @param b wether the title should be displayed or not.
432 	 */
433 	public void setTitleVisible(boolean b)
434 	{
435 		if (b == titleVisible) {
436 			return;
437 		}
438 
439 		titleVisible = b;
440 		layoutDisplayer();
441 		firePropertyChange("titleVisible", !b, b);
442 	}
443 
444 	/**
445 	 * Determines wether the title of this component is displayed beside the
446 	 * value component.
447 	 *
448 	 * @return <code>true</code> if the title is displayed and
449 	 *         <code>false</code> if not.
450 	 */
451 	public boolean isTitleVisible()
452 	{
453 		return titleVisible;
454 	}
455 
456 	private ComponentListener getResizeListener()
457 	{
458 		if (resizeListener == null) {
459 			resizeListener = new ComponentAdapter() {
460 						public void componentResized(ComponentEvent e)
461 						{
462 							layoutDisplayer();
463 						}
464 					};
465 		}
466 
467 		return resizeListener;
468 	}
469 
470 	/**
471 	 * Returns the component to display the title of thi displayer. This method
472 	 * is used by the <code>#DisplayerLayout</code>.
473 	 *
474 	 * @return component displaying the title
475 	 */
476 	protected JLabel getTitleComponent()
477 	{
478 		if (titleLabel == null) {
479 			titleLabel = new ResizableTextLabel();
480 			titleLabel.setHorizontalAlignment(JLabel.CENTER);
481 			titleLabel.setEnabled(isEnabled());
482 			titleLabel.setEnhanced(isEnhanced());
483 			titleLabel.setResizable(isResizable());
484 			titleLabel.setMaximumFontSize(maxTitleFontSize);
485 			titleLabel.setMinimumFontSize(minTitleFontSize);
486 			internalSetTitle();
487 		}
488 
489 		return titleLabel;
490 	}
491 
492 	/**
493 	 * Should return the component to display the value of this displayer. This
494 	 * method is called inside the constructor to add the
495 	 * <code>valueComponent</code> to the AbstractDisplayerPanel. Subclasses
496 	 * should thus use lazy initialization inside  this method.
497 	 *
498 	 * @return the value component of the AbstractDisplayerPanel.
499 	 */
500 	protected abstract JComponent getValueComponent();
501 
502 	protected void internalSetEnabled()
503 	{
504 		if (titleLabel != null) {
505 			titleLabel.setEnabled(isEnabled());
506 		}
507 	}
508 
509 	protected void internalSetEnhanced()
510 	{
511 		if (titleLabel != null) {
512 			titleLabel.setEnhanced(isEnhanced());
513 		}
514 	}
515 
516 	protected void internalSetResizable()
517 	{
518 		if (titleLabel != null) {
519 			titleLabel.setResizable(isResizable());
520 		}
521 	}
522 
523 	protected void internalSetTitle()
524 	{
525 		if (titleLabel == null) {
526 			return;
527 		}
528 
529 		String value = title;
530 
531 		if (value == null && Beans.isDesignTime()) {
532 			value = "<title>";
533 		}
534 
535 		//if (value == null) {
536 		//	value = "";
537 		//}
538 		titleLabel.setText(value);
539 	}
540 
541 	/**
542 	 * Lays out the displayer according to the set layout orientation.
543 	 */
544 	protected void layoutDisplayer()
545 	{
546 		if (isTitleVisible() && getTitle() != null && getTitle().length() > 0) {
547 			//if (getTitleComponent().getParent()!=this) {
548 				layoutValueAndTitle();
549 			//}
550 		} else {
551 			//if (getTitleComponent().getParent()==this) {
552 				layoutValue();
553 			//}
554 		}
555 	}
556 
557 	protected void layoutValue()
558 	{
559 		removeAll();
560 		Insets insets = new Insets(getSize().height * 3 / 100,
561 			    getSize().width * 3 / 100, getSize().height * 3 / 100,
562 			    getSize().width * 3 / 100);
563 		int fill = (isResizable() ? GridBagConstraints.BOTH
564 			: GridBagConstraints.NONE);
565 
566 		add(getValueComponent(),
567 		    new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER,
568 		        fill, insets, 0, 0));
569 	}
570 
571 	protected void layoutValueAndTitle()
572 	{
573 		removeAll();
574 	
575 		Insets insets = !isResizable() ? new Insets(2, 2, 2, 2)
576 			: new Insets(getSize().height * 3 / 100, getSize().width * 3 / 100,
577 			    getSize().height * 3 / 100, getSize().width * 3 / 100);
578 
579 		//		Insets insets = new Insets(2, 2, 2, 2);
580 		int fill = (isResizable() ? GridBagConstraints.BOTH
581 			: GridBagConstraints.NONE);
582 		double w = isResizable() ? 1.0 : 0.0;
583 	
584 
585 		if (1. * (getSize().height) / (getTitleComponent().getPreferredSize().height
586 		    + getValueComponent().getPreferredSize().height) > 1. * (getSize().width) / (getTitleComponent()
587 		    .getPreferredSize().width
588 		    + getValueComponent().getPreferredSize().width)
589 		    && getLayoutOrientation() == AbstractDisplayerPanel.DYNAMIC_LAYOUT
590 		    || getLayoutOrientation() == AbstractDisplayerPanel.VERTICAL_LAYOUT) {
591 			add(getTitleComponent(),
592 			    new GridBagConstraints(1, 1, 1, 1, w, w,
593 			        GridBagConstraints.CENTER, fill, insets, 0, 0));
594 			add(getValueComponent(),
595 			    new GridBagConstraints(1, 2, 1, 1, w, w * 1.2,
596 			        GridBagConstraints.CENTER, fill, insets, 0, 0));			
597 		} else {
598 			add(getTitleComponent(),
599 			    new GridBagConstraints(1, 1, 1, 1, w, w,
600 			        GridBagConstraints.EAST, fill, insets, 0, 0));
601 			add(getValueComponent(),
602 			    new GridBagConstraints(2, 1, 1, 1, w * 1.2, w,
603 			        GridBagConstraints.WEST, fill, insets, 0, 0));
604 		}
605 	}
606 
607 	/**
608 	 * Returns the maximum font size allowed.
609 	 *
610 	 * @return
611 	 */
612 	public int getTitleMaximumFontSize()
613 	{
614 		return maxTitleFontSize;
615 	}
616 
617 	/**
618 	 * Returns the minimum font size allowed.
619 	 *
620 	 * @return
621 	 */
622 	public int getTitleMinimumFontSize()
623 	{
624 		return minTitleFontSize;
625 	}
626 
627 	/**
628 	 * Sets the maximum title font size allowed.
629 	 *
630 	 * @param max
631 	 */
632 	public void setTitleMaximumFontSize(int max)
633 	{
634 		if (max == maxTitleFontSize) {
635 			return;
636 		}
637 
638 		int oldValue = maxTitleFontSize;
639 		maxTitleFontSize = max;
640 		layoutDisplayer();
641 		if (titleLabel!=null) titleLabel.setMaximumFontSize(maxTitleFontSize);
642 		firePropertyChange(AbstractDisplayerPanelCustomizer.MAX_TITLE_FONT_SIZE,
643 		    oldValue, max);
644 	}
645 
646 	/**
647 	 * Sets the minimum title font size allowed.
648 	 *
649 	 * @param min
650 	 */
651 	public void setTitleMinimumFontSize(int min)
652 	{
653 		if (min == minTitleFontSize) {
654 			return;
655 		}
656 
657 		int oldValue = minTitleFontSize;
658 		minTitleFontSize = min;
659 		layoutDisplayer();
660 		if (titleLabel!=null) titleLabel.setMinimumFontSize(minTitleFontSize);
661 		firePropertyChange(AbstractDisplayerPanelCustomizer.MIN_TITLE_FONT_SIZE,
662 		    oldValue, min);
663 	}
664 	
665     /* (non-Javadoc)
666      * @see javax.swing.JComponent#setTransferHandler(javax.swing.TransferHandler)
667      */
668     @Override
669     public void setTransferHandler(TransferHandler newHandler) {
670     	super.setTransferHandler(newHandler);
671     	CosyTransferHandler.registerTransferHandler(this,newHandler,new JComponent[]{getTitleComponent()});
672     }
673 
674     /**
675 	 * Enables/disables mouse dragging. Dragging can only be enabled if
676 	 * this component uses CosyTransferHandler.
677 	 * 
678 	 * @param enabled
679 	 */
680     public void setDragEnabled(boolean enabled) {
681     	if (isDragEnabled() == enabled) return;
682 		if (getTransferHandler() instanceof CosyTransferHandler) {
683 			if (((CosyTransferHandler)getTransferHandler()).isExportEnabled() == enabled) return;
684 			
685 			((CosyTransferHandler)getTransferHandler()).setExportEnabled(enabled, this);
686 		}
687 		firePropertyChange("dragEnabled", !enabled, enabled);
688 	}
689 	
690     /**
691 	 * Returns true if drag is enabled.
692 	 * 
693 	 * @return true if drag is enabled
694 	 */
695 	public boolean isDragEnabled() {
696 		if (getTransferHandler() instanceof CosyTransferHandler) {
697 			return ((CosyTransferHandler)getTransferHandler()).isExportEnabled();
698 		} else {
699 			return getTransferHandler() != null;
700 		}
701 	}
702 	
703 	/**
704 	 * Enable/disable the mouse drop. Drop can only be enabled if this component uses
705 	 * CosyTransferHandler.
706 	 * 
707 	 * @param enabled
708 	 */
709 	public void setDropEnabled(boolean enabled) {
710 		if (isDropEnabled() == enabled) return;
711 		if (getTransferHandler() instanceof CosyTransferHandler) {
712 			if (((CosyTransferHandler)getTransferHandler()).isReceiveEnabled() == enabled) return;
713 			
714 			((CosyTransferHandler)getTransferHandler()).setReceiveEnabled(enabled, this);
715 		}
716 		
717 		firePropertyChange("dropEnabled", !enabled, enabled);
718 	}
719 	
720 	/**
721 	 * Returns true if drop is enabled.
722 	 * 
723 	 * @return true if drop is enabled
724 	 */
725 	public boolean isDropEnabled() {
726 		if (getTransferHandler() instanceof CosyTransferHandler) {
727 			return ((CosyTransferHandler)getTransferHandler()).isReceiveEnabled();
728 		} else {
729 			return getTransferHandler() != null;
730 		}
731 	}
732 	
733 	/*
734 	 * (non-Javadoc)
735 	 * @see javax.swing.JComponent#setBackground(java.awt.Color)
736 	 */
737 	@Override
738 	public void setBackground(Color bg) {
739 		super.setBackground(bg);
740 		getValueComponent().setBackground(bg);
741 		getTitleComponent().setBackground(bg);
742 	}
743 	
744 	/*
745 	 * (non-Javadoc)
746 	 * @see javax.swing.JComponent#setForeground(java.awt.Color)
747 	 */
748 	@Override
749 	public void setForeground(Color fg) {
750 		super.setForeground(fg);
751 		getValueComponent().setForeground(fg);
752 		getTitleComponent().setForeground(fg);
753 	}
754 
755 
756 }
757 
758 /* __oOo__ */