use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class DFDSRoleOptionsDialog method onOk.
@Override
protected void onOk() {
if (!isCanOk()) {
JOptionPane.showMessageDialog(this, ResourceLoader.getString("you_should_enter_name_or_at_least_on_added_elemen"));
return;
}
if (!isOkStreamName()) {
if (JOptionPane.showConfirmDialog(this, ResourceLoader.getString("you_entered_exists_stream_continue"), ResourceLoader.getString("warning"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
return;
}
}
DFDSRole role = (DFDSRole) object;
Journaled journaled = (Journaled) dataPlugin.getEngine();
journaled.startUserTransaction();
Function function = object.getFunction();
function.setFont(fontChooser.getSelFont());
function.setBackground(backgroundColorChooser.getColor());
function.setForeground(foregroundColorChooser.getColor());
role.setAlternativeText(sectorNameEditor.getAlternativeTextField().getText());
Stream stream = sectorRowsEditor.getStream();
if (stream == null) {
stream = sectorNameEditor.findStreamByName();
if (stream == null) {
stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
}
}
final String t = sectorNameEditor.getArrowName();
if (!t.equals("")) {
if (!t.equals(stream.getName()) && sectorNameEditor.findStreamByName(stream.getName()) != null) {
stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
}
}
if (t.equals("")) {
if (!stream.isEmptyName()) {
stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
stream.setEmptyName(true);
}
} else {
stream.setName(t);
}
stream.setRows(sectorRowsEditor.getRows());
role.setStream(stream, ReplaceStreamType.SIMPLE);
// sector.setStreamAddedByRefactor(false);
final Row[] rs = sectorRowsEditor.getRows();
role.setRows(rs);
if (rs != null) {
RectangleVisualOptions ops = new RectangleVisualOptions();
ops.bounds = function.getBounds();
ops.background = function.getBackground();
ops.font = function.getFont();
ops.foreground = function.getForeground();
for (Row row : rs) if (row != null) {
IDEF0Plugin.setDefaultRectangleVisualOptions(dataPlugin.getEngine(), row.getElement(), ops);
}
}
journaled.commitUserTransaction();
setVisible(false);
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class DFDSMovingLabel method getText.
@Override
public String getText() {
if (labelText == null) {
String s = sector.getAlternativeText();
if ("".equals(s)) {
final Stream stream = sector.getStream();
if (stream != null) {
if (stream.isEmptyName()) {
Row[] rows = stream.getAdded();
StringBuilder sb = null;
for (Row row : rows) if (row != null) {
if (sb == null)
sb = new StringBuilder(row.getName());
else {
sb.append(";\n");
sb.append(row.getName());
}
String status = row.getAttachedStatus();
if (status != null) {
int i = status.indexOf('|');
if (i >= 0) {
status = status.substring(i + 1);
if (status.trim().length() == 0)
status = null;
}
}
if (status != null) {
sb.append(" (");
sb.append(status);
sb.append(')');
}
}
if (sb != null)
s = sb.toString();
} else
s = stream.getName();
}
}
labelText = s;
}
return labelText;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class StreamsEditDialog method refresh.
private void refresh() {
data = dataPlugin.getChilds(dataPlugin.getBaseStream(), true);
for (int i = data.size() - 1; i >= 0; i--) {
if (((Stream) data.get(i)).isEmptyName()) {
data.remove(i);
}
}
final Stream[] rs = data.toArray(new Stream[data.size()]);
RowFactory.sortByTitle(rs);
data.clear();
for (final Stream s : rs) {
data.add(s);
}
model.fireTableDataChanged();
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class StreamsEditDialog method getFindPanel.
private RowFindPanel getFindPanel() {
if (findPanel == null) {
findPanel = new RowFindPanel() {
@Override
public boolean find(final String text, final boolean wordsOrder) {
return find(-1, text, wordsOrder);
}
@Override
public boolean findNext(final String text, final boolean wordsOrder) {
return find(jTable.getSelectedRow(), text, wordsOrder);
}
private boolean find(final int selectedIndex, final String text, final boolean wordsOrder) {
for (int i = selectedIndex + 1; i < data.size(); i++) {
final Stream stream = (Stream) data.get(i);
if (select(text, wordsOrder, i, stream))
return true;
}
for (int i = 0; i < selectedIndex; i++) {
final Stream stream = (Stream) data.get(i);
if (select(text, wordsOrder, i, stream))
return true;
}
return false;
}
private boolean select(final String text, final boolean wordsOrder, final int i, final Stream stream) {
if (RowSetClass.isStartSame(stream, text, wordsOrder)) {
jTable.changeSelection(i, 0, false, false);
return true;
}
return false;
}
};
ResourceLoader.setJComponentsText(findPanel);
}
return findPanel;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class SectorRowsEditor method findStreamByName.
public Stream findStreamByName(final String name) {
if ("".equals(name))
return null;
final Vector<Row> streams = dataPlugin.getRecChilds(dataPlugin.getBaseStream(), true);
final int l = streams.size();
for (int i = 0; i < l; i++) {
final Stream s = (Stream) streams.get(i);
if (name.equals(s.getName()) && !s.isEmptyName())
return s;
}
return null;
}
Aggregations