use of com.ramussoft.pb.data.negine.NFunction in project ramus by Vitaliy-Yakovchuk.
the class IDEFPanel method modelProperties.
private void modelProperties() {
Qualifier qualifier = ((NFunction) movingArea.getActiveFunction()).getQualifier();
if (qualifier.isSystem()) {
qualifier = dataPlugin.getBaseFunctionQualifier();
}
ModelPropertiesDialog dialog = new ModelPropertiesDialog(framework, qualifier, dataPlugin.getEngine(), dataPlugin.getAccessRules());
dialog.setVisible(true);
}
use of com.ramussoft.pb.data.negine.NFunction in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method loadFromFunction.
/**
* Метод, який завантажує секторну структуру функціонального блоку, якщо
* інформація вже раніше була завантажена з функціонального блоку, то вона
* автоматично в нього зберігається.
*
* @param function Функціональний блок, з якого завантажаться дані.
* @param save Параметр, який вказує, чи зберігати останню завантажену
* функцію.
*/
public void loadFromFunction(final Function function, final boolean save) {
if (save && this.function != null)
saveToFunction(this.function);
sectors.clear();
texts.clear();
this.function = function;
if (function == null)
return;
((NFunction) function).clearSectorsBuffer();
final byte[] bs = function.getSectorData();
if (bs == null)
return;
final ByteArrayInputStream in = new ByteArrayInputStream(bs);
try {
final DataLoader.MemoryData memoryData = new DataLoader.MemoryData();
// read version
final int ver = DataLoader.readInteger(in);
this.loadVersion = ver;
if (ver < 2 && ver > 0) {
int n = DataLoader.readInteger(in);
for (int i = 0; i < n; i++) {
final PaintSector sector = PaintSector.loadFromStream(in, ver, movingArea, memoryData, getDataPlugin());
if (sector != null)
addSector(sector);
}
} else {
for (Sector sector : function.getSectors()) {
final PaintSector paintSector = PaintSector.loadFromSector(ver, movingArea, memoryData, getDataPlugin(), sector);
if (paintSector != null) {
if (sector.getCreateState() == Sector.STATE_IN)
createInPaintPart(sector);
else if (sector.getCreateState() == Sector.STATE_OUT)
createOutPaintPart(sector);
else
addSector(paintSector);
}
}
}
int n = DataLoader.readInteger(in);
for (int i = 0; i < n; i++) {
final MovingText text = movingArea.createText();
text.setFont(DataLoader.readFont(in, memoryData));
text.setColor(DataLoader.readColor(in, memoryData));
text.setBounds(DataLoader.readFRectangle(in));
text.setText(DataLoader.readString(in));
texts.add(text);
}
in.close();
HashSet<PaintSector> hashSet = new HashSet<PaintSector>();
for (int i = 0; i < getSectorsCount(); i++) {
getSector(i).createTexts(hashSet);
}
} catch (final IOException e) {
e.printStackTrace();
}
}
use of com.ramussoft.pb.data.negine.NFunction in project ramus by Vitaliy-Yakovchuk.
the class ArrowPainter method paintLink.
public void paintLink(Graphics2D g, FloatPoint point, int type, Function inner, Function outer) {
long innerQ = ((NFunction) inner).getQualifierId();
long outerQ = ((NFunction) outer).getQualifierId();
String text = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) outer);
String letter = outer.getProjectOptions().getDeligate().getModelLetter();
if (outer.getParentRow().getName().equals("F_BASE_FUNCTIONS")) {
if (letter == null)
text = "A-0";
else
text = letter + "-0";
}
if (innerQ != outerQ) {
if (letter == null || "A".equals(letter))
text = movingArea.getDataPlugin().getEngine().getQualifier(outerQ).getName() + "/" + text;
}
tunnelLength = movingArea.getIDoubleOrdinate(TUNNEL_LENGTH) * 1;
g.setStroke(ArrowPainter.THIN_STROKE);
g.setStroke(new BasicStroke(0.5f));
double x = movingArea.getIDoubleOrdinate(point.getX());
double y = movingArea.getIDoubleOrdinate(point.getY());
double helf = tunnelLength / 2;
switch(type) {
case MovingPanel.BOTTOM:
{
g.draw(new Ellipse2D.Double(x - helf, y, tunnelLength, tunnelLength));
boolean left = point.getX() < movingArea.CLIENT_WIDTH / 2;
if (!left) {
movingArea.paintText(g, text, new FRectangle(point.getX() + TUNNEL_LENGTH, 0, movingArea.CLIENT_WIDTH - point.getX() - TUNNEL_WIDTH * 10, movingArea.CLIENT_HEIGHT), Line.LEFT_ALIGN, true);
} else {
movingArea.paintText(g, text, new FRectangle(0, 0, point.getX() - TUNNEL_LENGTH, movingArea.CLIENT_HEIGHT), Line.RIGHT_ALIGN, true);
}
}
break;
case MovingPanel.TOP:
{
g.draw(new Ellipse2D.Double(x - helf, y - tunnelLength, tunnelLength, tunnelLength));
boolean left = point.getX() < movingArea.CLIENT_WIDTH / 2;
if (!left) {
movingArea.paintText(g, text, new FRectangle(point.getX() + TUNNEL_LENGTH, 0, movingArea.CLIENT_WIDTH - point.getX() - TUNNEL_WIDTH * 10, movingArea.CLIENT_HEIGHT), Line.LEFT_ALIGN, 2, true);
} else {
movingArea.paintText(g, text, new FRectangle(0, 0, point.getX() - TUNNEL_LENGTH, movingArea.CLIENT_HEIGHT), Line.RIGHT_ALIGN, 2, true);
}
}
break;
case MovingPanel.RIGHT:
{
g.draw(new Ellipse2D.Double(x, y - helf, tunnelLength, tunnelLength));
boolean top = point.getY() < movingArea.CLIENT_HEIGHT / 2;
if (!top) {
movingArea.paintText(g, text, new FRectangle(2, point.getY() + tunnelLength / 2, movingArea.CLIENT_WIDTH * 0.20, movingArea.CLIENT_HEIGHT - point.getY() - tunnelLength / 2), Line.LEFT_ALIGN, 0, true);
} else {
movingArea.paintText(g, text, new FRectangle(2, 0, movingArea.CLIENT_WIDTH * 0.20, point.getY() - tunnelLength / 2), Line.LEFT_ALIGN, 2, true);
}
}
break;
case MovingPanel.LEFT:
{
g.draw(new Ellipse2D.Double(x - tunnelLength, y - helf, tunnelLength, tunnelLength));
boolean top = point.getY() < movingArea.CLIENT_HEIGHT / 2;
if (!top) {
movingArea.paintText(g, text, new FRectangle(movingArea.CLIENT_WIDTH * 0.80, point.getY() + tunnelLength / 2, movingArea.CLIENT_WIDTH * 0.20 - 2, movingArea.CLIENT_HEIGHT - point.getY() - tunnelLength / 2), Line.RIGHT_ALIGN, 0, true);
} else {
movingArea.paintText(g, text, new FRectangle(movingArea.CLIENT_WIDTH * 0.80, 0, movingArea.CLIENT_WIDTH * 0.20 - 2, point.getY() - tunnelLength / 2), Line.RIGHT_ALIGN, 2, true);
}
}
break;
}
}
use of com.ramussoft.pb.data.negine.NFunction in project ramus by Vitaliy-Yakovchuk.
the class ModelParaleler method loadFromParalel.
public void loadFromParalel(boolean importAll, List<Qualifier> selected) {
List<Attribute> tAttrs = toEngine.getAttributes();
List<Attribute> fAttrs = fromEngine.getAttributes();
for (Attribute f : fAttrs) for (Attribute t : tAttrs) if ((f.getName().equals(t.getName())) && (f.getAttributeType().equals(t.getAttributeType())))
attrHash.put(f.getId(), t);
List<Qualifier> fList = fromEngine.getQualifiers();
List<Qualifier> tList = toEngine.getQualifiers();
for (Qualifier f : fList) if (!IDEF0Plugin.isFunction(f))
for (Qualifier t : tList) if (!IDEF0Plugin.isFunction(t))
if (f.getName().equals(t.getName()))
qHash.put(f.getId(), t);
Vector<Row> fRows = fromDataPlugin.getRecChilds(null, false);
Vector<Row> tRows = toDataPlugin.getRecChilds(null, false);
for (Row f : fRows) for (Row t : tRows) if (f.getName().equals(t.getName())) {
rowHash.put(f.getElement().getId(), t);
Vector<Row> fCRows = fromDataPlugin.getRecChilds(f, true);
Vector<Row> tCRows = toDataPlugin.getRecChilds(t, true);
for (Row fc : fCRows) for (Row tc : tCRows) if (fc.getName().equals(tc.getName()))
rowHash.put(fc.getElement().getId(), tc);
}
if (importAll) {
createAllRows();
}
for (Qualifier qualifier : selected) {
fromDataPlugin = NDataPluginFactory.getDataPlugin(qualifier, fromEngine, fromDataPlugin.getAccessRules());
Qualifier baseFunction = toEngine.createQualifier();
baseFunction.setName(qualifier.getName());
IDEF0Plugin.installFunctionAttributes(baseFunction, toEngine);
toDataPlugin = NDataPluginFactory.getDataPlugin(baseFunction, toEngine, toDataPlugin.getAccessRules());
base = toDataPlugin.getBaseFunction();
List<Attribute> list = getAttributes(qualifier.getAttributes());
for (Attribute a : list) if (baseFunction.getAttributes().indexOf(a) < 0)
baseFunction.getAttributes().add(a);
Attribute forName = fromEngine.getAttribute(qualifier.getAttributeForName());
if (forName != null)
baseFunction.setAttributeForName(getAttribute(forName).getId());
toEngine.updateQualifier(baseFunction);
if (fromDataPlugin.getBaseFunction().getChildCount() > 0) {
function = (Function) fromDataPlugin.getBaseFunction().getChildAt(0);
Vector<Row> childs = fromDataPlugin.getRecChilds(function, true);
childs.add(0, function);
for (Row row : childs) {
NFunction dest = (NFunction) getRow(row);
showMessageAnimation(dest.toString());
}
NFunction func = (NFunction) getRow(function);
createSectorsOnUpperLevel(func);
}
}
}
use of com.ramussoft.pb.data.negine.NFunction in project ramus by Vitaliy-Yakovchuk.
the class DFDSNamePanel method compile.
private void compile(DFDSName name) {
Row row = dataPlugin.findRowByGlobalId(element.getId());
if (row instanceof Function) {
Function function = (NFunction) row;
dataPlugin.compileDFDSName(name, function);
}
}
Aggregations