use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.
the class Table method applyComlumnsSize.
public void applyComlumnsSize(QBounds tableBound, Diagram diagram) {
double width = getMinWidth();
double w = width / columns.length;
double x = tableBound.getLocation().getX();
for (TableColumn tableColumn : columns) {
QBounds bounds = (QBounds) diagram.getBounds(tableColumn);
Dimension2D size = bounds.getSize();
size.setSize(w, size.getHeight());
bounds.setLocation(new Point2D.Double(x, getColumnYLocation(tableBound, size)));
tableColumn.setWidth(w);
x += w;
}
}
use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.
the class Table method getNewIndex.
private int getNewIndex(double tX, TableColumn tableColumn, Diagram diagram) {
QBounds qBounds = (QBounds) diagram.getBounds(tableColumn);
double width = getMinWidth();
double w = width / columns.length;
double x = qBounds.getLocation().getX() - XMLDiagram.LEFT + tX;
double index;
for (index = 0; index < columns.length; index++) {
if (w * index > x) {
int i = (int) index;
if (columns[i].equals(tableColumn))
return -1;
if ((i > 0) && (columns[i - 1].equals(tableColumn))) {
return -1;
}
return i;
}
}
int i = (int) index;
if (i < columns.length)
if (columns[i].equals(tableColumn))
return -1;
if ((i > 0) && (columns[i - 1].equals(tableColumn))) {
return -1;
}
return i;
}
use of com.ramussoft.reportgef.model.QBounds 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