]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - jcr/org.argeo.cms.ui/src/org/argeo/eclipse/ui/jcr/RowColumnLabelProvider.java
70c71efeaa0d4eb4a10115ba166af8bfaa6b0e36
1 package org
.argeo
.eclipse
.ui
.jcr
;
3 import javax
.jcr
.RepositoryException
;
4 import javax
.jcr
.query
.Row
;
6 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
7 import org
.eclipse
.swt
.graphics
.Color
;
8 import org
.eclipse
.swt
.graphics
.Font
;
9 import org
.eclipse
.swt
.graphics
.Image
;
11 /** Simplifies writing JCR-based column label provider. */
12 public class RowColumnLabelProvider
extends ColumnLabelProvider
{
13 private static final long serialVersionUID
= -6586692836928505358L;
15 protected String
getRowText(Row row
) throws RepositoryException
{
16 return super.getText(row
);
19 protected String
getRowToolTipText(Row row
) throws RepositoryException
{
20 return super.getToolTipText(row
);
23 protected Image
getRowImage(Row row
) throws RepositoryException
{
24 return super.getImage(row
);
27 protected Font
getRowFont(Row row
) throws RepositoryException
{
28 return super.getFont(row
);
31 public Color
getRowBackground(Row row
) throws RepositoryException
{
32 return super.getBackground(row
);
35 public Color
getRowForeground(Row row
) throws RepositoryException
{
36 return super.getForeground(row
);
40 public String
getText(Object element
) {
42 if (element
instanceof Row
)
43 return getRowText((Row
) element
);
45 throw new IllegalArgumentException("Unsupported element type " + element
.getClass());
46 } catch (RepositoryException e
) {
47 throw new IllegalStateException("Repository exception when accessing " + element
, e
);
52 public Image
getImage(Object element
) {
54 if (element
instanceof Row
)
55 return getRowImage((Row
) element
);
57 throw new IllegalArgumentException("Unsupported element type " + element
.getClass());
58 } catch (RepositoryException e
) {
59 throw new IllegalStateException("Repository exception when accessing " + element
, e
);
64 public String
getToolTipText(Object element
) {
66 if (element
instanceof Row
)
67 return getRowToolTipText((Row
) element
);
69 throw new IllegalArgumentException("Unsupported element type " + element
.getClass());
70 } catch (RepositoryException e
) {
71 throw new IllegalStateException("Repository exception when accessing " + element
, e
);
76 public Font
getFont(Object element
) {
78 if (element
instanceof Row
)
79 return getRowFont((Row
) element
);
81 throw new IllegalArgumentException("Unsupported element type " + element
.getClass());
82 } catch (RepositoryException e
) {
83 throw new IllegalStateException("Repository exception when accessing " + element
, e
);
88 public Color
getBackground(Object element
) {
90 if (element
instanceof Row
)
91 return getRowBackground((Row
) element
);
93 throw new IllegalArgumentException("Unsupported element type " + element
.getClass());
94 } catch (RepositoryException e
) {
95 throw new IllegalStateException("Repository exception when accessing " + element
, e
);
100 public Color
getForeground(Object element
) {
102 if (element
instanceof Row
)
103 return getRowForeground((Row
) element
);
105 throw new IllegalArgumentException("Unsupported element type " + element
.getClass());
106 } catch (RepositoryException e
) {
107 throw new IllegalStateException("Repository exception when accessing " + element
, e
);