-
Notifications
You must be signed in to change notification settings - Fork 22
/
MTable.java
190 lines (161 loc) · 4.28 KB
/
MTable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*******************************************************************************
* Copyright (c) 2017 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;
import java.awt.Color;
import java.util.Collections;
import java.util.List;
/**
* Interface that represents a table that can be inserted in a word document.
*
* @author ldelaigue
*/
public interface MTable extends MElement {
/**
* Empty {@link MTable}.
*/
// CHECKSTYLE:OFF
MTable EMPTY = new MTable() {
@Override
public void setLabel(String label) {
// nothing to do here
}
@Override
public List<MRow> getRows() {
return Collections.emptyList();
}
@Override
public String getLabel() {
return "";
}
@Override
public int getColumnsCount() {
return 0;
}
@Override
public String getStyleID() {
return null;
}
@Override
public void setStyleID(String styleID) {
// nothing to do here
}
};
// CHECKSTYLE:ON
/**
* Interface that represents a table row, whose label can be used as row header.
*
* @author ldelaigue
*/
public interface MRow {
/**
* The row's defined cells (i.e. non-empty cells). A row may have no cell at all, or may not have a cell for each column of its
* table.
*
* @return The row's defined cells.
*/
List<MCell> getCells();
}
/**
* Interface that represents a table cell.
*
* @author ldelaigue
*/
public interface MCell extends MElementContainer {
/**
* Vertical alignement.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
enum VAlignment {
/**
* Both.
*/
BOTH,
/**
* Bottom.
*/
BOTTOM,
/**
* Center.
*/
CENTER,
/**
* Top.
*/
TOP
}
/**
* Gets the background {@link Color}.
*
* @return the background {@link Color} if any, <code>null</code> otherwise
*/
Color getBackgroundColor();
/**
* Sets the background {@link Color}.
*
* @param color
* the new background {@link Color}
*/
void setBackgroundColor(Color color);
/**
* Gets the {@link VAlignment vertical alignment}.
*
* @return the {@link VAlignment vertical alignment}
*/
VAlignment getVAlignment();
/**
* Sets the {@link VAlignment vertical alignment}.
*
* @param alignement
* the new {@link VAlignment vertical alignment}
*/
void setVAlignment(VAlignment alignement);
}
/**
* Tha table rows.
*
* @return All the table rows.
*/
List<MRow> getRows();
/**
* Returns the columns count.
*
* @return the columns count.
*/
int getColumnsCount();
/**
* The table label (caption).
*
* @return The table label, <code>null</code> if the table has no caption.
*/
String getLabel();
/**
* Sets the table label (caption).
*
* @param label
* the new table label (caption)
*/
void setLabel(String label);
/**
* Gets the style ID. Note to be used the style ID should already be used in the document.
*
* @return the style ID
*/
String getStyleID();
/**
* Sets the style ID. Note to be used the style ID should already be used in the document.
*
* @param styleID
* the new style ID
*/
void setStyleID(String styleID);
}