use of doc.mathobjects.RectangleObject in project OpenNotebook by jaltekruse.
the class DocMouseListener method mousePressed.
@Override
public void mousePressed(MouseEvent e) {
docPanel.requestFocus();
draggingDot = false;
PointInDocument clickedPt = docPanel.panelPt2DocPt(e.getX(), e.getY());
MathObject objToPlace = docPanel.getObjToPlace();
if (docPanel.isPlacingObject()) {
objToPlace.setxPos(clickedPt.getxPos());
objToPlace.setyPos(clickedPt.getyPos());
objToPlace.setWidth(1);
objToPlace.setHeight(1);
objToPlace.setParentContainer(docPanel.getDoc().getPage(clickedPt.getPage()));
objToPlace.getParentContainer().addObject(objToPlace);
docPanel.repaintDoc();
docPanel.updateObjectToolFrame();
objPlacementRequiresMouseDrag = true;
docPanel.setFocusedObject(objToPlace);
return;
} else if (detectResizeOrMove(e)) {
// resize dot or the selected object
return;
} else if (clickedPt.isOutSidePage()) {
// click was outside of page
if (docPanel.isPlacingObject()) {
docPanel.getNotebookPanel().objHasBeenPlaced();
docPanel.ungroupTempGroup();
}
} else {
// create a box to select multiple objects
if (!docPanel.isInStudentMode()) {
docPanel.ungroupTempGroup();
RectangleObject rect = new RectangleObject(docPanel.getDoc().getPage(clickedPt.getPage()));
rect.setxPos(clickedPt.getxPos());
rect.setyPos(clickedPt.getyPos());
rect.setWidth(1);
rect.setHeight(1);
docPanel.setSelectionRect(rect);
selectionRectRequiresMouseDrag = true;
}
}
}
use of doc.mathobjects.RectangleObject in project OpenNotebook by jaltekruse.
the class OldReader method startElement.
@Override
public void startElement(String uri, String name, String qName, Attributes atts) {
boolean justAddedObject = false;
if (qName.equals("OpenNotebookDoc")) {
doc = new Document(atts.getValue(Document.FILENAME));
doc.setAuthor(atts.getValue(Document.AUTHOR));
}
if (doc != null) {
if (qName.equals("Page")) {
page = new Page(doc);
doc.addPage(page);
return;
}
if (page != null) {
if (mObj != null) {
readAttribute(uri, name, qName, atts);
}
if (qName.equals("AnswerBox")) {
mObj = new AnswerBoxObject(page);
justAddedObject = true;
}
if (qName.equals("CubeObject")) {
mObj = new CubeObject(page);
justAddedObject = true;
} else if (qName.equals("ExpressionObject")) {
mObj = new ExpressionObject(page);
justAddedObject = true;
} else if (qName.equals("GraphObject")) {
mObj = new GraphObject(page);
justAddedObject = true;
} else if (qName.equals("NumberLineObject")) {
mObj = new NumberLineObject(page);
justAddedObject = true;
} else if (qName.equals("OvalObject")) {
mObj = new OvalObject(page);
justAddedObject = true;
} else if (qName.equals("ParallelogramObject")) {
mObj = new ParallelogramObject(page);
justAddedObject = true;
} else if (qName.equals("RectangleObject")) {
mObj = new RectangleObject(page);
justAddedObject = true;
} else if (qName.equals("TextObject")) {
mObj = new TextObject(page);
justAddedObject = true;
} else if (qName.equals("TrapezoidObject")) {
mObj = new TrapezoidObject(page);
justAddedObject = true;
} else if (qName.equals("TriangleObject")) {
mObj = new TriangleObject(page);
justAddedObject = true;
}
if (justAddedObject) {
if (page != null) {
page.addObject(mObj);
}
}
}
}
}
Aggregations