use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class IDEF0Object method onProcessEndBoundsChange.
public void onProcessEndBoundsChange(List<PaintSector> notToMove) {
final FRectangle oldRec = function.getBounds();
super.onProcessEndBoundsChange();
function.setBounds(new FRectangle(myBounds));
final SectorRefactor refactor = movingArea.getRefactor();
MemoryData memoryData = new MemoryData();
List<PaintSector> list = new ArrayList<PaintSector>();
for (int i = 0; i < refactor.getSectorsCount(); i++) {
PaintSector sector = refactor.getSector(i);
boolean con = false;
if (notToMove != null)
for (PaintSector ps : notToMove) {
if (ps.getSector().equals(sector.getSector())) {
con = true;
break;
}
}
if (con)
continue;
setAddedSectorPos(oldRec, sector, list);
}
for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) function).getEngine());
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method setTransparent.
/**
* Змінює прозорість напису для активного сектора.
*/
public void setTransparent() {
final PaintSector sector = ((PaintSector.Pin) activeObject).getSector();
sector.setTransparent(!sector.isTransparent());
startUserTransaction();
PaintSector.save(sector, new MemoryData(), dataPlugin.getEngine());
refactor.setUndoPoint();
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method joinArrows.
public void joinArrows() {
List<Row> rows = mouseSelection.getSelectedArrowsAddedRows();
Row[] array = rows.toArray(new Row[rows.size()]);
startUserTransaction();
List<MovingLabel> pss = new ArrayList<MovingLabel>();
for (int i = 1; i < mouseSelection.getLabels().size(); i++) pss.add(mouseSelection.getLabels().get(i));
mouseSelection.getLabels().removeAll(pss);
for (MovingLabel ml : pss) ml.getSector().remove();
PaintSector sector = mouseSelection.getLabels().get(0).getSector();
Stream stream = sector.getStream();
if (stream == null) {
stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
stream.setRows(array);
sector.setStream(stream, ReplaceStreamType.SIMPLE);
}
sector.setRows(array);
sector.createTexts();
HashSet<PaintSector> hashSet = new HashSet();
sector.getConnectedSector(hashSet);
for (PaintSector sp : hashSet) PaintSector.save(sp, new DataLoader.MemoryData(), dataPlugin.getEngine());
getRefactor().setUndoPoint();
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method processMouse.
/**
* Медод, який обробляє натискання на кнопці миші, якщо стан панелі
* відображення змінює певні атрибути, то вони змінюються.
*
* @param e Пораметри натискання миші.
*/
protected void processMouse(final MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3)
return;
final int x = e.getX();
final int y = e.getY();
final double dX = getDoubleOrdinate(x);
final double dY = getDoubleOrdinate(y);
int type = Function.TYPE_OPERATION;
if (getState() == FUNCTION_ADDING_STATE && getActiveObject() == null) {
if (isOut(dX, LEFT_PART, CLIENT_WIDTH) || isOut(dY, TOP_PART, CLIENT_HEIGHT))
return;
if (!canAddOnContext()) {
JOptionPane.showMessageDialog(this, ResourceLoader.getString("you_can_not_add_more_then_one_f"));
return;
}
addInOutObject(dX, dY, type);
} else if (getState() == EXTERNAL_REFERENCE_ADDING_STATE && getActiveObject() == null) {
if (isOut(dX, LEFT_PART, CLIENT_WIDTH) || isOut(dY, TOP_PART, CLIENT_HEIGHT))
return;
addInOutObject(dX, dY, Function.TYPE_EXTERNAL_REFERENCE);
} else if (getState() == DATA_STORE_ADDING_STATE && getActiveObject() == null) {
if (isOut(dX, LEFT_PART, CLIENT_WIDTH) || isOut(dY, TOP_PART, CLIENT_HEIGHT))
return;
addInOutObject(dX, dY, Function.TYPE_DATA_STORE);
} else if (getState() == DFDS_ROLE_ADDING_STATE && getActiveObject() == null) {
if (isOut(dX, LEFT_PART, CLIENT_WIDTH) || isOut(dY, TOP_PART, CLIENT_HEIGHT))
return;
addInOutObject(dX, dY, Function.TYPE_DFDS_ROLE);
} else if (getChangingState() == ARROW_CHANGING_STATE) {
final PaintSector.Pin activePin = getPin(e.getX(), e.getY());
if (activePin == null)
addArrowToArea(dX, dY);
else {
PaintSector sector = activePin.getSector();
if ((sector.isPart()) && (sector.isSelEnd() || sector.isSelStart())) {
if (activeObject instanceof PaintSector.Pin) {
final PaintSector.Pin pin = (PaintSector.Pin) activeObject;
if (pin.getSector().isSelEnd() || pin.getSector().isSelStart()) {
setActiveObject(null);
refactor.setSector(pin.getSector());
if (pin.getSector().isSelEnd()) {
setState(END_POINT_CHANGING_ADD);
} else if (pin.getSector().isSelStart()) {
setState(START_POINT_CHANGING_ADD);
}
panel.getFramework().put(CURRENT_MOVING_AREA, this);
}
}
} else {
if (getPointChangingType() == SectorRefactor.TYPE_START) {
if (sector.isPart() && activePin.getSector().getStart() == null)
return;
} else {
if (activePin.getSector().isPart() && activePin.getSector().getEnd() == null)
return;
}
final SectorRefactor.PerspectivePoint pp = new SectorRefactor.PerspectivePoint();
pp.type = getPointChangingType();
pp.pin = activePin;
pp.x = getDoubleOrdinate(e.getX());
pp.y = getDoubleOrdinate(e.getY());
refactor.setPoint(pp);
doSector();
}
}
} else if (getChangingState() == TILDA_ADDING_STATE) {
final PaintSector.Pin activePin = getPin(e.getX(), e.getY());
if (activePin != null) {
startUserTransaction();
List<PaintSector> ps = activePin.getSector().setTildaPos(getDoubleOrdinate(e.getX()), getDoubleOrdinate(e.getY()));
for (PaintSector s : ps) PaintSector.save(s, new MemoryData(), dataPlugin.getEngine());
refactor.setUndoPoint();
}
} else if (getChangingState() == TEXT_ADDING_STATE) {
final MovingText text = createText();
cancelAdding();
refactor.addText(text);
text.setBounds(dX, dY, text.getBounds().getWidth(), text.getBounds().getHeight());
text.setFont(Options.getFont("DEFAULT_TEXT_FONT", new Font("Arial", 0, 10)));
text.setColor(Options.getColor("DEFAULT_TEXT_COLOR", Color.black));
startUserTransaction();
refactor.setUndoPoint();
} else {
if (activeObject instanceof PaintSector.Pin) {
final PaintSector.Pin pin = (PaintSector.Pin) activeObject;
if (pin.getSector().isSelEnd() || pin.getSector().isSelStart()) {
setActiveObject(null);
refactor.setSector(pin.getSector());
if (pin.getSector().isSelEnd()) {
setState(END_POINT_CHANGING);
} else if (pin.getSector().isSelStart()) {
setState(START_POINT_CHANGING);
}
panel.getFramework().put(CURRENT_MOVING_AREA, this);
}
}
}
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method setShowTilda.
/**
* Робить так, що показується тільда на активному секторі.
*/
public void setShowTilda() {
startUserTransaction();
final PaintSector sector = ((PaintSector.Pin) activeObject).getSector();
sector.setShowTilda(!sector.isShowTilda());
PaintSector.save(sector, new MemoryData(), getDataPlugin().getEngine());
refactor.setUndoPoint();
}
Aggregations