| 1 | // Copyright 2004-2007 Jean-Francois Poilpret |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package net.sourceforge.hivegui.table; |
| 16 | |
| 17 | import javax.swing.table.TableCellRenderer; |
| 18 | |
| 19 | import org.apache.hivemind.impl.BaseLocatable; |
| 20 | import org.apache.hivemind.util.ToStringBuilder; |
| 21 | |
| 22 | /** |
| 23 | * @author Jean-Francois Poilpret |
| 24 | */ |
| 25 | public class ColumnContribution extends BaseLocatable |
| 26 | { |
| 27 | public void setProperty(String property) |
| 28 | { |
| 29 | _property = property; |
| 30 | } |
| 31 | public String getProperty() |
| 32 | { |
| 33 | return _property; |
| 34 | } |
| 35 | |
| 36 | public void setType(Class type) |
| 37 | { |
| 38 | _type = type; |
| 39 | } |
| 40 | public Class getType() |
| 41 | { |
| 42 | return _type; |
| 43 | } |
| 44 | |
| 45 | public void setEditable(boolean editable) |
| 46 | { |
| 47 | _editable = editable; |
| 48 | } |
| 49 | public boolean isEditable() |
| 50 | { |
| 51 | return _editable; |
| 52 | } |
| 53 | |
| 54 | public void setRenderer(TableCellRenderer renderer) |
| 55 | { |
| 56 | _renderer = renderer; |
| 57 | } |
| 58 | public TableCellRenderer getRenderer() |
| 59 | { |
| 60 | return _renderer; |
| 61 | } |
| 62 | |
| 63 | public void setMinWidth(int minWidth) |
| 64 | { |
| 65 | _minWidth = minWidth; |
| 66 | } |
| 67 | public int getMinWidth() |
| 68 | { |
| 69 | return _minWidth; |
| 70 | } |
| 71 | |
| 72 | public void setMaxWidth(int maxWidth) |
| 73 | { |
| 74 | _maxWidth = maxWidth; |
| 75 | } |
| 76 | public int getMaxWidth() |
| 77 | { |
| 78 | return _maxWidth; |
| 79 | } |
| 80 | |
| 81 | public void setPreferredWidth(int preferredWidth) |
| 82 | { |
| 83 | _preferredWidth = preferredWidth; |
| 84 | } |
| 85 | public int getPreferredWidth() |
| 86 | { |
| 87 | return _preferredWidth; |
| 88 | } |
| 89 | |
| 90 | @Override public String toString() |
| 91 | { |
| 92 | ToStringBuilder builder = new ToStringBuilder(this); |
| 93 | builder.append("property", _property); |
| 94 | builder.append("type", _type); |
| 95 | builder.append("editable", _editable); |
| 96 | builder.append("minWidth", _minWidth); |
| 97 | builder.append("maxWidth", _maxWidth); |
| 98 | builder.append("preferredWidth", _preferredWidth); |
| 99 | return builder.toString(); |
| 100 | } |
| 101 | |
| 102 | private String _property; |
| 103 | private Class _type = String.class; |
| 104 | private boolean _editable; |
| 105 | private TableCellRenderer _renderer; |
| 106 | private int _minWidth = -1; |
| 107 | private int _maxWidth = -1; |
| 108 | private int _preferredWidth = -1; |
| 109 | } |