use of com.dsoft.pb.idef.elements.Status in project ramus by Vitaliy-Yakovchuk.
the class StatusPlugin method getAttributeConverter.
@Override
public AttributeConverter getAttributeConverter() {
return new SimpleAttributeConverter() {
@Override
protected Object toObject(Persistent persistent) {
StatusPersistent p = (StatusPersistent) persistent;
return new Status(p.getType(), p.getOtherName());
}
@Override
protected Persistent toPersistent(Object value) {
StatusPersistent p = new StatusPersistent();
Status s = (Status) value;
p.setOtherName(s.getAtherName());
p.setType(s.getType());
return p;
}
};
}
use of com.dsoft.pb.idef.elements.Status in project ramus by Vitaliy-Yakovchuk.
the class NFunction method setDefaultValues.
public void setDefaultValues() {
boolean inTransaction = false;
if (engine instanceof Journaled) {
inTransaction = ((Journaled) engine).isUserTransactionStarted();
if (!inTransaction)
((Journaled) engine).startUserTransaction();
}
setSectorData(new byte[0]);
setBackground(Options.getColor("DEFAULD_FUNCTIONAL_BLOCK_COLOR", Color.white));
setForeground(Options.getColor("DEFAULD_FUNCTIONAL_BLOCK_TEXT_COLOR", Color.black));
setBounds(new FRectangle(IDEFPanel.DEFAULT_X, IDEFPanel.DEFAULT_Y, IDEFPanel.DEFAULT_WIDTH * 1.2, IDEFPanel.DEFAULT_HEIGHT * 1.2));
setFont(Options.getFont("DEFAULT_FUNCTIONAL_BLOCK_FONT", new Font("Dialog", 0, 10)));
setStatus(new Status());
if (engine instanceof Journaled)
if (!inTransaction)
((Journaled) engine).commitUserTransaction();
}
use of com.dsoft.pb.idef.elements.Status in project ramus by Vitaliy-Yakovchuk.
the class IDLImporter method importFromIDL.
public void importFromIDL(InputStream in) throws IOException {
Vector<Row> streams = plugin.getRecChilds(plugin.getBaseStream(), true);
for (Row r : streams) {
Stream stream = (Stream) r;
if (!stream.isEmptyName()) {
this.streams.put(stream.getName(), stream);
}
}
reader = new InputStreamReader(in, encoding);
length = reader.read(buff);
while (true) {
String line = readLine();
if (line == null)
return;
switch(position) {
case KIT:
if (starts(MODELC, line)) {
String name = valueOf(line);
try {
base.setName(name);
} catch (Exception e) {
}
plugin.getBaseFunctionQualifier().setName(name);
plugin.getEngine().updateQualifier(plugin.getBaseFunctionQualifier());
loadFonts(line);
} else if (starts(PROJECT_NAME, line)) {
String name = valueOf(line);
plugin.getBaseFunction().getProjectOptions().setProjectName(name);
} else if (starts(AUTHOR, line)) {
String name = valueOf(line);
plugin.getBaseFunction().getProjectOptions().setProjectAutor(name);
} else if (starts(DIAGRAM_GRAPHICC, line)) {
position = DIAGRAM_GRAPHIC;
String name = line.substring(DIAGRAM_GRAPHICC.length() + 1);
Function f = getFunction(name);
functions.add(f);
boxes.clear();
segments.clear();
}
break;
case DIAGRAM_GRAPHIC:
if (starts(TITLE, line)) {
String name = valueOf(line);
try {
getFunction().setName(name);
} catch (Exception e) {
}
} else if (starts(STATUS, line)) {
String name = line.substring(STATUS.length() + 1);
int typeOf = Status.typeOf(name);
Status status = getFunction().getStatus();
status.setType(typeOf);
if (typeOf < 0) {
status.setOtherName(name);
status.setType(Status.OTHER);
}
getFunction().setStatus(getFunction().getStatus());
} else if (starts(BOXC, line)) {
box = new Box();
box.index = Integer.parseInt(getLastWord(line));
boxes.add(box);
position = BOX;
} else if (starts(ENDDIAGRAM, line)) {
position = KIT;
createSegments();
functions.remove(functions.size() - 1);
} else if (starts("ARROWSEG", line)) {
position = ARROWSEG;
seg = new Arrowseg();
seg.index = Integer.parseInt(line.substring("ARROWSEG".length() + 1));
segments.add(seg);
}
break;
case BOX:
if (starts(NAME, line)) {
String name = valueOf(line);
box.name = name;
} else if (starts(BOX_COORDINATES, line)) {
box.coordinates = line.substring(BOX_COORDINATES.length() + 1);
} else if (starts(DETAIL_REFERENCE, line)) {
box.reference = line.substring(DETAIL_REFERENCE.length() + 1);
} else if (starts(ENDBOX, line)) {
addBox();
position = DIAGRAM_GRAPHIC;
}
break;
case ARROWSEG:
if (starts(SOURCE, line)) {
seg.source = line.substring(SOURCE.length() + 1);
} else if (starts(PATH, line)) {
seg.path = line.substring(PATH.length() + 1);
} else if (starts(LABAL_COORDINATES, line)) {
seg.coordinates = line.substring(LABAL_COORDINATES.length() + 1);
} else if (starts(LABEL, line)) {
seg.label = valueOf(line);
} else if (starts(SQUIGGLE_COORDINATES, line)) {
seg.squiggleCoordinates = line.substring(SQUIGGLE_COORDINATES.length() + 1);
} else if (starts(SINK, line)) {
seg.sink = line.substring(SINK.length() + 1);
} else if (starts("ENDSEG", line)) {
position = DIAGRAM_GRAPHIC;
}
break;
}
}
}
use of com.dsoft.pb.idef.elements.Status in project ramus by Vitaliy-Yakovchuk.
the class DataLoader method readStatus.
public static Status readStatus(final InputStream stream) throws IOException {
final Status res = new Status();
res.setType(stream.read());
if (res.getType() == Status.OTHER)
res.setOtherName(readString(stream));
return res;
}
use of com.dsoft.pb.idef.elements.Status in project ramus by Vitaliy-Yakovchuk.
the class StatusPanel method getStatus.
/**
* @return Returns the status.
*/
public Status getStatus() {
final Status status = new Status();
for (int i = 0; i < 5; i++) if (getButton(i).isSelected())
status.setType(i);
if (status.getType() == Status.OTHER) {
String s = getJTextField().getText();
if (s.equals(""))
s = null;
status.setOtherName(s);
}
return status;
}
Aggregations