use of com.ramussoft.pb.Stream 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.Stream in project ramus by Vitaliy-Yakovchuk.
the class PaintSector method setChangeOptions.
/**
* Метод, який викликається після зміни початку чи кінця сектора.
*
* @param point Точка, яка була змінена.
*/
private void setChangeOptions(final Point point) {
setSectorPoints();
createTexts();
PaintSector[] sectors;
Stream stream = null;
if (getStart() != null) {
sectors = movingArea.getRefactor().getOppozite(this, getStart());
for (final PaintSector element : sectors) if (stream == null && element.getStream() != null) {
stream = element.getStream();
break;
}
}
if (stream == null && getEnd() != null) {
sectors = movingArea.getRefactor().getOppozite(this, getStart());
for (final PaintSector element : sectors) if (stream == null && element.getStream() != null) {
stream = element.getStream();
break;
}
}
if (stream != null && getSector().getStream() == null)
setStream(stream, ReplaceStreamType.CHILDREN);
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method fixNoNameBug.
private void fixNoNameBug(Crosspoint crosspoint, Sector sector) {
if (crosspoint != null) {
if (crosspoint.isDLevel()) {
Sector[] oppozite = crosspoint.getOppozite(sector);
if (oppozite.length == 1) {
Sector opp = oppozite[0];
Stream s = opp.getStream();
((NSector) sector).setThisStream(s);
}
}
}
}
use of com.ramussoft.pb.Stream 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.Stream 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