use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class SectorNameEditor method selectRows.
protected boolean selectRows() {
final Stream tmp = getArrowRowsDialog().showModal();
if (tmp == getStream() || tmp == null)
return false;
Stream ls = lowstream;
setStream(tmp);
lowstream = ls;
jTextField.setText(tmp.getName());
return true;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class ArrowOptionstDialog method getSectorNameEditor.
private SectorNameEditor getSectorNameEditor() {
if (sectorNameEditor == null) {
sectorNameEditor = new SectorNameEditor(dataPlugin, framework, accessRules) {
@Override
protected boolean selectRows() {
final boolean res = super.selectRows();
if (res)
loadFrom(getStream());
return res;
}
@Override
public Stream getStream() {
return sectorRowsEditor.getStream();
}
};
sectorNameEditor.setDialog(this);
sectorNameEditor.setPreferredSize(new Dimension(100, 100));
}
return sectorNameEditor;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class AlternativeArrowDialog method getRowFindPanel.
/**
* This method initializes rowFindPanel
*
* @return com.dsoft.pb.frames.elements.RowFindPanel
*/
private RowFindPanel getRowFindPanel() {
if (rowFindPanel == null) {
rowFindPanel = 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(jList.getSelectedIndex(), text, wordsOrder);
}
private boolean find(final int selectedIndex, final String text, final boolean wordsOrder) {
final Stream[] streams = streamModel.getData();
for (int i = selectedIndex + 1; i < streams.length; i++) {
final Stream stream = streams[i];
if (select(text, wordsOrder, i, stream))
return true;
}
for (int i = 0; i < selectedIndex; i++) {
final Stream stream = streams[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)) {
jList.setSelectedIndex(i);
jList.ensureIndexIsVisible(i);
return true;
}
return false;
}
@Override
public void setVisible(final boolean aFlag) {
super.setVisible(aFlag);
Options.setBoolean("showFindStreamPanel", aFlag);
}
};
boolean v = Options.getBoolean("showFindStreamPanel", true);
if (!v)
rowFindPanel.setVisible(false);
else
SwingUtilities.invokeLater(new Runnable() {
public void run() {
rowFindPanel.getJTextField().requestFocus();
}
});
}
return rowFindPanel;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class ArrowOptionstDialog method showModal.
public void showModal(final PaintSector sector, MovingArea movingArea) {
isOk = false;
Options.loadOptions("select_row", this);
Options.saveOptions("select_row", this);
sectorRowsEditor.setSector(sector.getSector());
sectorNameEditor.setSector(sector.getSector());
sectorRowsEditor.setSectorNameEditor(sectorNameEditor);
getColorChooser16().setColor(sector.getColor());
getJFontChooser().setSelFont(sector.getFont());
final Stream s = sector.getStream();
loadFrom(s);
lineStyleChooser.setStroke(sector.getStroke());
sectorNameEditor.beforeShow();
Options.loadOptions("select_row", this);
setVisible(true);
if (isOk) {
((NSector) sector.getSector()).getDataPlugin().startUserTransaction();
sector.setFont(getJFontChooser().getSelFont());
sector.setColor(getColorChooser16().getColor());
sector.setStroke(lineStyleChooser.getStroke());
if (lineStyleChooser.isDefaultArrowStyle()) {
Options.setStroke("DEFAULT_ARROW_STROKE", lineStyleChooser.getStroke());
}
sector.copyVisual(Sector.VISUAL_COPY_ADDED);
sector.setShowText(sectorNameEditor.getBox().isSelected());
sector.setAlternativeText(sectorNameEditor.getAlternativeTextField().getText());
sector.getSector().setTextAligment(sectorNameEditor.getTextAligment());
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);
}
final Row[] added = stream.getAdded();
stream.setRows(sectorRowsEditor.getRows());
sector.setStream(stream, sectorNameEditor.getReplaceStreamType());
stream = sector.getStream();
stream.setRows(added);
saveTo(stream);
// sector.setStreamAddedByRefactor(false);
final Row[] rs = sectorRowsEditor.getRows();
sector.setRows(rs);
sector.createTexts();
HashSet<PaintSector> hashSet = new HashSet();
sector.getConnectedSector(hashSet);
for (PaintSector sp : hashSet) PaintSector.save(sp, new DataLoader.MemoryData(), dataPlugin.getEngine());
movingArea.getRefactor().setUndoPoint();
}
saveOption();
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class SectorNameEditor 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