use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class ArrowPainter method paintBottom.
public void paintBottom(final Graphics2D g, final int height, MovingArea area, Font bottomFont, int partNumber, int hPageCount) {
if (!area.isPrinting()) {
if (!MovingArea.DISABLE_RENDERING_HINTS) {
g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}
}
g.setFont(bottomFont);
final Font font = bottomFont;
final Function activeFunction = movingArea.getActiveFunction();
int width = movingArea.getIntOrdinate(movingArea.MOVING_AREA_WIDTH);
width /= hPageCount;
int left = 0;
if (partNumber > 0) {
left = width * partNumber;
width += 1;
}
final int x = left + width / 5;
g.drawLine(left, 0, left, height - 1);
g.drawLine(width - 1, 0, width - 1, height - 1);
g.drawRect(left, 0, width - 1, height - 1);
g.drawLine(x, 0, x, height - 1);
g.drawLine(left + width / 5 * 4, 0, left + width / 5 * 4, height - 1);
g.setFont(movingArea.getFont(g.getFont()));
String number = NUMBER + " " + movingArea.getFunctionNumber();
if (hPageCount > 1)
number += "." + (partNumber + 1);
String node = NODE_B;
final double nodeWidth = g.getFont().getStringBounds(node, g.getFontRenderContext()).getWidth();
final int nT = 5 + 4 + (int) g.getFont().getStringBounds(node, g.getFontRenderContext()).getHeight();
g.drawString(node, left + 5, nT);
g.drawString(number, left + width / 5 * 4 + 5, nT);
node = TITLE_B;
final int titleWidth = (int) g.getFont().getStringBounds(node, g.getFontRenderContext()).getWidth();
g.drawString(node, x + 5, nT);
if (activeFunction.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
node = MovingFunction.getDFDSKod((com.ramussoft.database.common.Row) activeFunction, movingArea.dataPlugin);
} else
node = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) activeFunction);
g.drawString(node, left + (int) nodeWidth + 10, nT);
node = activeFunction.getName();
if (activeFunction.equals(movingArea.dataPlugin.getBaseFunction()) && activeFunction.getDecompositionType() != MovingArea.DIAGRAM_TYPE_DFDS) {
final Vector v = movingArea.dataPlugin.getChilds(activeFunction, true);
if (v.size() > 0)
node = ((Row) v.get(0)).getName();
}
g.setFont(font);
movingArea.paintText(g, node, movingArea.getFBounds(new Rectangle(x + 10 + titleWidth, 2, x * 3 - 10 - titleWidth - 3 * left, height)), Line.CENTER_ALIGN, 1, true);
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class PaintSector method removeAther.
/**
* Перевіряє і видаляє під’єднані до сектора сектори.
*/
private void removeAther(final Crosspoint point) {
// System.out.println("Remove other "+point);
if (point != null) {
Row[] del;
if (getStream() == null)
del = new Row[] {};
else
del = getStream().getAdded();
if (!point.isDLevel()) {
final boolean start = !point.isIn(sector);
((AbstractSector) sector).removeFromParent(del, start);
}
if (point.isRemoveable()) {
PaintSector s = null;
for (int i = 0; i < movingArea.getRefactor().getSectorsCount(); i++) {
s = movingArea.getRefactor().getSector(i);
if (point.isIn(s.getSector()))
break;
}
if (s == null)
return;
try {
s.joinSector(movingArea.getRefactor().getOppozite(s, point)[0]);
} catch (Exception exception) {
exception.printStackTrace();
}
s.createTexts();
}
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class PaintSector method setCorrectRows.
public void setCorrectRows() {
final Stream s = sector.getStream();
if (s != null) {
final Row[] rows = s.getAdded();
if (rows != null) {
setRows(rows);
}
} else {
Sector[] sectors = getStart().getOppozite(sector);
boolean start = true;
if (sectors.length == 0) {
sectors = getEnd().getOppozite(sector);
start = false;
}
if (sectors.length > 0 && sectors[0].getStream() != null) {
sector.setStream(SectorRefactor.cloneStream(sectors[0].getStream(), movingArea.dataPlugin, sector), ReplaceStreamType.CHILDREN);
sector.loadRowAttributes(sectors[0], start);
}
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method fillStartFromOwners.
private static void fillStartFromOwners(Sector sector, HashSet<Row> owners, DataPlugin dataPlugin, boolean[] hasFunctionOwners) {
Crosspoint crosspoint = sector.getStart().getCrosspoint();
Function function2 = sector.getStart().getFunction();
if (function2 != null) {
if (function2.getType() != Function.TYPE_DFDS_ROLE) {
Row row = function2.getOwner();
if (row != null && !owners.contains(row)) {
owners.add(row);
hasFunctionOwners[0] = true;
}
} else {
Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
if (stream != null)
for (Row row : stream.getAdded()) {
if (row != null && !owners.contains(row))
owners.add(row);
}
}
}
if (crosspoint != null)
for (Sector sector2 : crosspoint.getOppozite(sector)) fillStartFromOwners(sector2, owners, dataPlugin, hasFunctionOwners);
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method fillEndFromOwners.
private static void fillEndFromOwners(Sector sector, HashSet<Row> owners, DataPlugin dataPlugin, boolean[] hasFunctionOwners) {
Crosspoint crosspoint = sector.getEnd().getCrosspoint();
Function function2 = sector.getEnd().getFunction();
if (function2 != null) {
if (function2.getType() != Function.TYPE_DFDS_ROLE) {
Row row = function2.getOwner();
if (row != null && !owners.contains(row)) {
owners.add(row);
hasFunctionOwners[0] = true;
}
} else {
Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
if (stream != null)
for (Row row : stream.getAdded()) {
if (row != null && !owners.contains(row))
owners.add(row);
}
}
}
if (crosspoint != null)
for (Sector sector2 : crosspoint.getOppozite(sector)) fillEndFromOwners(sector2, owners, dataPlugin, hasFunctionOwners);
}
Aggregations