use of com.ramussoft.reportgef.Component in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method createNewBounds.
public QBounds createNewBounds(String componentName) {
QBounds bounds = new QBounds();
double y = top;
for (QBounds bounds2 : this.yBounds) {
y += bounds2.getSize().getHeight();
}
bounds.setLocation(new Point2D.Double(LEFT, y));
bounds.setComponentType(componentName);
bounds.setPosition(this.bounds.length);
Component component = framework.createComponent(this, bounds);
bounds.setBackground(component.getDefaultBackground());
bounds.setFont(component.getDefaultFont());
bounds.setFontColor(component.getDefaultFontColor());
bounds.setForeground(component.getDefaultForeground());
bounds.setSize(new Dimension2DImpl(component.getMinWidth(), component.getMinHeight()));
add(bounds, component);
return new QBounds();
}
use of com.ramussoft.reportgef.Component in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method removeSelectedComponents.
public void removeSelectedComponents() {
Bounds[] bounds = editor.getSelection().getBounds();
List<Integer> list = new ArrayList<Integer>();
for (Bounds bounds2 : bounds) {
int index = getIndexOfBounds(bounds2);
list.add(index);
Component component = components[index];
if (component instanceof Table) {
for (TableColumn column : ((Table) component).getColumns()) {
list.add(getIndexOfComponent(column));
}
}
}
List<Bounds> bounds2 = new ArrayList<Bounds>();
List<QBounds> yBounds = new ArrayList<QBounds>();
List<Component> components = new ArrayList<Component>();
for (int i = 0; i < this.components.length; i++) {
if (list.indexOf(i) < 0) {
bounds2.add(this.bounds[i]);
components.add(this.components[i]);
}
}
this.bounds = bounds2.toArray(new Bounds[bounds2.size()]);
this.components = components.toArray(new Component[components.size()]);
for (QBounds qBounds : this.yBounds) {
if (bounds2.indexOf(qBounds) >= 0) {
yBounds.add(qBounds);
}
}
this.yBounds = yBounds.toArray(new QBounds[yBounds.size()]);
editor.getSelection().setBounds(new Bounds[] {});
double y = top;
for (int i = 0; i < this.components.length; i++) {
if (((XMLComponent) this.components[i]).isY()) {
QBounds e = (QBounds) this.bounds[i];
e.setLocation(new Point2D.Double(e.getLocation().getX(), y));
yBounds.add(e);
y += e.getSize().getHeight();
if (this.components[i] instanceof Table) {
Table table = (Table) this.components[i];
table.removeComlumntIfNeed(components, this);
}
}
}
}
use of com.ramussoft.reportgef.Component in project ramus by Vitaliy-Yakovchuk.
the class GEFComponent method updateBounds.
public void updateBounds(Bounds[] bounds) {
for (int i = 0; i < bounds.length; i++) {
if (bounds[i] instanceof QBounds) {
QBounds qBounds = (QBounds) bounds[i];
Component component = diagram.getComponent(qBounds);
double width = qBounds.getSize().getWidth();
double height = qBounds.getSize().getHeight();
if (!component.isResizeableX()) {
width = component.getMinWidth();
}
if (!component.isResizeableY()) {
height = component.getMinHeight();
}
qBounds.getSize().setSize(width, height);
}
}
}
use of com.ramussoft.reportgef.Component 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.Component in project ramus by Vitaliy-Yakovchuk.
the class XMLDiagram method paintGroup.
@Override
public void paintGroup(Graphics2D g, Group selection) {
super.paintGroup(g, selection);
Bounds[] bounds = selection.getBounds();
g.setComposite(instance);
if (bounds.length > 0) {
Component component = getComponent(bounds[0]);
try {
if (((XMLComponent) component).isY())
paintYShow(g, selection.getTranslate().getY(), bounds[0]);
else
paintXShow(g, selection.getTranslate().getX(), bounds[0]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Aggregations