Search in sources :

Example 56 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class SelectOwner method setFunction.

public void setFunction(final Function function) {
    final Row[] rows = function.getOwners();
    final Row ouner = function.getOwner();
    listModel = new DefaultListModel();
    jList.setModel(listModel);
    boolean b = true;
    if (ouner != null) {
        for (final Row row : rows) if (ouner.equals(row)) {
            b = false;
            break;
        }
    }
    if (b && ouner != null) {
        listModel.addElement("<html><body><i><b>" + ouner.getName() + "</b></i></body></html>");
    } else
        listModel.addElement("<html><body><i><b>" + ResourceLoader.getString("owner_not_selected") + "</b></i></body></html>");
    jList.setSelectedIndex(0);
    for (final Row element : rows) listModel.addElement(element);
    if (!b)
        jList.setSelectedValue(ouner, true);
}
Also used : DefaultListModel(javax.swing.DefaultListModel) Row(com.ramussoft.pb.Row)

Example 57 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class SectorRefactor method copyOwnersFrom.

public static void copyOwnersFrom(Function function, DataPlugin dataPlugin) {
    Function par = (Function) function.getParent();
    HashSet<Function> roles = new HashSet<Function>();
    for (Sector sector : par.getSectors()) {
        if (function.equals(sector.getStart().getFunction())) {
            getEndRoles(sector, roles, dataPlugin);
            getStartRoles(sector, roles, dataPlugin);
        }
        if (function.equals(sector.getEnd().getFunction())) {
            getStartRoles(sector, roles, dataPlugin);
            getEndRoles(sector, roles, dataPlugin);
        }
    }
    Stream stream = (Stream) dataPlugin.findRowByGlobalId(function.getLink());
    Row[] owners;
    if (stream == null)
        owners = new Row[] {};
    else
        owners = stream.getAdded();
    for (Function function2 : roles) {
        stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
        if (stream == null) {
            if (owners.length > 0) {
                stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
                function2.setLink(stream.getElement().getId());
                stream.setRows(owners);
            }
        } else {
            stream.setRows(owners);
        }
    }
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) HashSet(java.util.HashSet)

Example 58 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class ModelParaleler method getRow.

private Row getRow(long rowId) {
    if (rowId < 0l)
        return null;
    Row res = rowHash.get(rowId);
    if (res == null) {
        Row row = fromDataPlugin.findRowByGlobalId(rowId);
        if (row == null)
            return null;
        Element element = row.getElement();
        if (!((row instanceof Stream) && (element.getName().equals("")))) {
            Qualifier qualifier = null;
            if (row instanceof Stream)
                qualifier = IDEF0Plugin.getBaseStreamQualifier(toEngine);
            else
                qualifier = getQualifier(element.getQualifierId());
            if (qualifier == null)
                return null;
            Element e = toEngine.getElement(element.getName(), qualifier.getId());
            if (e != null) {
                Row row2 = toDataPlugin.findRowByGlobalId(e.getId());
                rowHash.put(e.getId(), row2);
                return row2;
            }
        }
        Row r = fromDataPlugin.findRowByGlobalId(rowId);
        res = toDataPlugin.createRow(getRow(getParentRow(r)), r.isElement());
        rowHash.put(r.getElement().getId(), res);
        copyRow(r, res);
    }
    return res;
}
Also used : Element(com.ramussoft.common.Element) Stream(com.ramussoft.pb.Stream) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row)

Example 59 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class ModelParaleler method copyFunction.

private void copyFunction(NFunction source, NFunction destination) {
    long l = source.getLink();
    if (l >= 0) {
        Row row = fromDataPlugin.findRowByGlobalId(l);
        if (row != null) {
            l = getRow(row).getElement().getId();
            destination.setLink(l);
        }
    }
    // destination.setName(source.getName());
    if (source.getChildCount() > 0) {
        SectorRefactor sr = new SectorRefactor(new MovingArea(fromDataPlugin));
        sr.loadFromFunction(source, false);
        for (int i = 0; i < sr.getSectorsCount(); i++) {
            PaintSector ps = sr.getSector(i);
            PaintSector.save(ps, new DataLoader.MemoryData(), fromEngine);
            ps.setSector(getSector((NSector) ps.getSector()));
        }
    // sr.saveToFunction(destination);
    }
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) DataLoader(com.dsoft.utils.DataLoader) NSector(com.ramussoft.pb.data.negine.NSector) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Row(com.ramussoft.pb.Row)

Example 60 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class ModelParaleler method getRow.

private Row getRow(Row r) {
    if (r == fromDataPlugin.getBaseStream())
        return toDataPlugin.getBaseStream();
    if ((r == null) || (r.getElement() == null))
        return null;
    if ((function != null) && (r.equals(function.getParentRow())))
        return base;
    Row res = rowHash.get(r.getElement().getId());
    if (res == null) {
        res = toDataPlugin.createRow(getRow(getParentRow(r)), r.isElement());
        rowHash.put(r.getElement().getId(), res);
        if (r instanceof Function)
            if (!(res instanceof Function))
                System.out.println(res);
        copyRow(r, res);
    }
    return res;
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Row(com.ramussoft.pb.Row)

Aggregations

Row (com.ramussoft.pb.Row)93 Function (com.ramussoft.pb.Function)35 Stream (com.ramussoft.pb.Stream)30 Vector (java.util.Vector)28 NFunction (com.ramussoft.pb.data.negine.NFunction)19 Sector (com.ramussoft.pb.Sector)15 NRow (com.ramussoft.pb.data.negine.NRow)14 Qualifier (com.ramussoft.common.Qualifier)13 Crosspoint (com.ramussoft.pb.Crosspoint)13 NSector (com.ramussoft.pb.data.negine.NSector)13 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ArrayList (java.util.ArrayList)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 Attribute (com.ramussoft.common.Attribute)9 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)9 IOException (java.io.IOException)9 FloatPoint (com.dsoft.pb.types.FloatPoint)8 Point (com.ramussoft.pb.idef.elements.Point)8 Element (com.ramussoft.common.Element)7