1 /*
2  * aTunes
3  * Copyright (C) Alex Aranda, Sylvain Gaudard and contributors
4  *
5  * See http://www.atunes.org/wiki/index.php?title=Contributing for information about contributors
6  *
7  * http://www.atunes.org
8  * http://sourceforge.net/projects/atunes
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  */
20 
21 package net.sourceforge.atunes.gui;
22 
23 import javax.swing.JLabel;
24 import javax.swing.JTable;
25 
26 import net.sourceforge.atunes.model.IControlsBuilder;
27 
28 /**
29  * Cell renderer to apply component orientation
30  *
31  * @author alex
32  *
33  */
34 public class ComponentOrientationTableCellRendererCode extends
35 		AbstractTableCellRendererCode<JLabel, Object> {
36 
37 	private IControlsBuilder controlsBuilder;
38 
39 	/**
40 	 * @param controlsBuilder
41 	 */
setControlsBuilder(final IControlsBuilder controlsBuilder)42 	public void setControlsBuilder(final IControlsBuilder controlsBuilder) {
43 		this.controlsBuilder = controlsBuilder;
44 	}
45 
46 	@Override
getComponent(final JLabel superComponent, final JTable t, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column)47 	public JLabel getComponent(final JLabel superComponent, final JTable t,
48 			final Object value, final boolean isSelected,
49 			final boolean hasFocus, final int row, final int column) {
50 		this.controlsBuilder.applyComponentOrientation(superComponent);
51 		return superComponent;
52 	}
53 }