use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method applyTransformForGroup.
public void applyTransformForGroup(Group group) {
QBounds bounds = (QBounds) group.getBounds()[0];
XMLComponent component = (XMLComponent) getComponent(bounds);
if (component.isY()) {
double yPos = bounds.getTop() + group.getTranslate().getY();
int cNumber;
for (cNumber = 0; cNumber < this.yBounds.length; cNumber++) {
if (this.yBounds[cNumber].equals(bounds))
break;
}
int number = getYNumber(yPos);
if (number >= 0) {
if ((number != cNumber) && (number != cNumber + 1)) {
List<QBounds> list = new ArrayList<QBounds>();
List<QBounds> seleted = new ArrayList<QBounds>();
for (Bounds b : group.getBounds()) {
XMLComponent component2 = (XMLComponent) getComponent(b);
if (component2.isY())
seleted.add((QBounds) b);
}
int newPos = -1;
int i = 0;
for (QBounds q : yBounds) {
if (seleted.indexOf(q) < 0) {
if (i == number)
newPos = list.size();
list.add(q);
}
i++;
}
if (newPos < 0)
newPos = list.size();
for (Bounds b : seleted) {
list.add(newPos, (QBounds) b);
newPos++;
}
this.yBounds = list.toArray(new QBounds[list.size()]);
double y = top;
for (QBounds b : yBounds) {
b.setLocation(new Point2D.Double(LEFT, y));
Component component2 = getComponent(b);
if (component2 instanceof Table)
((Table) component2).applyComlumnsSize(b, this);
y += b.getSize().getHeight();
}
}
}
} else {
if (component instanceof TableColumn) {
Table table = ((TableColumn) component).getTable();
table.applyTransformForGroup(group, this);
}
}
editor.postChanged();
}
use of com.ramussoft.reportgef.model.QBounds 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.model.QBounds in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method getYNumber.
private int getYNumber(double yPos) {
int i = 0;
double y = top;
if (yPos < 0)
return 0;
for (Bounds bounds : this.yBounds) {
if (bounds instanceof QBounds) {
QBounds qBounds = (QBounds) bounds;
double h = qBounds.getSize().getHeight();
y += h;
if (y - h / 2d > yPos)
return i;
i++;
}
}
return i;
}
use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method storeToXML.
public void storeToXML(ReportSaveXMLReader reportSaveXMLReader) throws SAXException {
for (QBounds bounds : yBounds) {
XMLComponent component = (XMLComponent) getComponent(bounds);
component.storeToXML(reportSaveXMLReader);
}
}
use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.
the class Label method paint.
@Override
public void paint(Graphics2D g, Bounds aBounds, Diagram diagram) {
QBounds bounds = (QBounds) aBounds;
label.setLocation(0, 0);
Dimension size = new Dimension((int) bounds.getSize().getWidth() - 4, (int) bounds.getSize().getHeight());
label.setPreferredSize(size);
label.setSize(label.getPreferredSize());
g.setColor(Color.black);
Line2D line = new Line2D.Double(8, getMinHeight(), getMinWidth() - 16, getMinHeight());
Stroke stroke = g.getStroke();
g.setStroke(this.stroke);
g.draw(line);
g.setStroke(stroke);
paintText(g);
}
Aggregations