@Override public void setPage(int i) { if (selectStatus == SelectOptions.TXT) { if (attrib != null) { for (int j = 0; j < attrib.size(); j++) { ObjAttribute s = attrib.get(j); if (s.getSelectStatus() != 0) { s.setPage(i); break; } } } } else { super.setPage(i); } }
@Override public void adjustShapeOrPosition(int x, int y) { if (selectStatus == SelectOptions.START) { Point currPt = new Point(x, y); double temp; double max = 1000000; for (int i = 0; i < 36; i++) { temp = currPt.distanceSq(startBorderPts.get(i)); if (temp < max) { startStateIndex = i; max = temp; } } startPt.setLocation( startBorderPts.get(startStateIndex).getX(), startBorderPts.get(startStateIndex).getY()); if (stub) { angle = getAngle(startPt, startState.getRealCenter(myPage)); pageS.setLocation( new Point( (int) (startPt.getX() + len * Math.cos(angle)), (int) (startPt.getY() - len * Math.sin(angle)))); } } if (selectStatus == SelectOptions.STARTCTRL) startCtrlPt.setLocation(x, y); if (selectStatus == SelectOptions.ENDCTRL) endCtrlPt.setLocation(x, y); if (selectStatus == SelectOptions.END) { Point currPt = new Point(x, y); double temp; double max = 1000000; for (int i = 0; i < 36; i++) { temp = currPt.distanceSq(endBorderPts.get(i)); if (temp < max) { endStateIndex = i; max = temp; } } endPt.setLocation( endBorderPts.get(endStateIndex).getX(), endBorderPts.get(endStateIndex).getY()); } if (selectStatus == SelectOptions.PAGES) { pageS.setLocation(pageS.getX() + x - xTemp, pageS.getY() + y - yTemp); xTemp = x; yTemp = y; if (stub) { angle = getAngle(pageS, startState.getRealCenter(myPage)); int index = 36 - (int) Math.round((angle / (Math.PI * 2)) * 36); if (index > 35) index -= 36; startStateIndex = index; startPt = startBorderPts.get(index); len = (int) startPt.distance(pageS); } } if (selectStatus == SelectOptions.PAGESC) pageSC.setLocation(x, y); if (selectStatus == SelectOptions.PAGEEC) pageEC.setLocation(x, y); if (selectStatus == SelectOptions.PAGEE) { pageE.setLocation(pageE.getX() + x - xTemp, pageE.getY() + y - yTemp); xTemp = x; yTemp = y; } if (selectStatus == SelectOptions.TXT) { if (attrib != null) { for (int i = 0; i < attrib.size(); i++) { ObjAttribute s = attrib.get(i); if (s.getSelectStatus() != 0) { s.adjustShapeOrPosition(x, y); break; } } } } if (startState.getPage() == endState.getPage()) curve.setCurve( startPt.getX(), startPt.getY(), startCtrlPt.getX(), startCtrlPt.getY(), endCtrlPt.getX(), endCtrlPt.getY(), endPt.getX(), endPt.getY()); if (selectStatus != SelectOptions.ALL) modified = true; }