use of com.ramussoft.reportgef.Component in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method loadFromYComponents.
public void loadFromYComponents(List<XMLComponent> yComponents) {
List<Component> components = new ArrayList<Component>();
List<Bounds> allBounds = new ArrayList<Bounds>();
List<QBounds> yBounds = new ArrayList<QBounds>();
double y = top;
for (int i = 0; i < yComponents.size(); i++) {
Component component = yComponents.get(i);
((XMLComponent) component).setWidth(width);
QBounds bounds = new QBounds();
bounds.setLocation(new Point2D.Double(LEFT, y));
bounds.setComponentType(((XMLComponent) component).getTypeName());
bounds.setPosition(allBounds.size());
bounds.setBackground(component.getDefaultBackground());
bounds.setFont(component.getDefaultFont());
bounds.setFontColor(component.getDefaultFontColor());
bounds.setForeground(component.getDefaultForeground());
bounds.setSize(new Dimension2DImpl(component.getMinWidth(), component.getMinHeight()));
components.add(component);
yBounds.add(bounds);
y += bounds.getSize().getHeight();
allBounds.add(bounds);
if (component instanceof Table) {
Table table = (Table) component;
TableColumn[] columns = table.getColumns();
QBounds[] bounds2 = new QBounds[columns.length];
for (int j = 0; j < columns.length; j++) {
TableColumn column = columns[j];
column.setWidth(width);
QBounds cBounds = new QBounds();
bounds2[j] = cBounds;
cBounds.setComponentType(((XMLComponent) column).getTypeName());
cBounds.setPosition(allBounds.size());
cBounds.setBackground(column.getDefaultBackground());
cBounds.setFont(column.getDefaultFont());
cBounds.setFontColor(column.getDefaultFontColor());
cBounds.setForeground(column.getDefaultForeground());
cBounds.setSize(new Dimension2DImpl(column.getMinWidth(), column.getMinHeight()));
components.add(column);
allBounds.add(cBounds);
}
table.applyComlumnsSize(bounds, bounds2);
}
}
this.components = components.toArray(new Component[components.size()]);
this.bounds = new Bounds[allBounds.size()];
for (int i = 0; i < this.bounds.length; i++) this.bounds[i] = allBounds.get(i);
this.yBounds = new QBounds[yBounds.size()];
for (int i = 0; i < this.yBounds.length; i++) this.yBounds[i] = yBounds.get(i);
}
use of com.ramussoft.reportgef.Component in project ramus by Vitaliy-Yakovchuk.
the class Table method applyTransformForGroup.
public void applyTransformForGroup(Group group, Diagram diagram) {
List<TableColumn> list = new ArrayList<TableColumn>();
for (Bounds bounds : group.getBounds()) {
Component component = diagram.getComponent(bounds);
if ((component instanceof TableColumn) && (((TableColumn) component).getTable().equals(this)))
list.add((TableColumn) component);
}
if (list.size() <= 0)
return;
int index = getNewIndex(group.getTranslate().getX(), list.get(0), diagram);
if (index < 0)
return;
int realIndex = -1;
List<TableColumn> columns = new ArrayList<TableColumn>();
for (int i = 0; i < this.columns.length; i++) {
TableColumn column = this.columns[i];
if (list.indexOf(column) < 0) {
if (i == index)
realIndex = columns.size();
columns.add(column);
}
}
if (realIndex < 0)
realIndex = columns.size();
for (TableColumn column : list) {
columns.add(realIndex, column);
realIndex++;
}
this.columns = columns.toArray(new TableColumn[columns.size()]);
applyComlumnsSize((QBounds) diagram.getBounds(this), diagram);
}
Aggregations