use of net.sf.sdedit.ui.PanelPaintDevice in project abstools by abstools.
the class UserInterfaceImpl method isDiagramBlank.
public boolean isDiagramBlank() {
Tab tab = currentTab();
if (tab == null) {
return true;
}
Diagram diagram = tab.getDiagram();
if (diagram != null) {
return ((PanelPaintDevice) diagram.getPaintDevice()).isBlank();
}
return true;
}
use of net.sf.sdedit.ui.PanelPaintDevice in project abstools by abstools.
the class Tab method renderDiagram.
void renderDiagram() {
PanelPaintDevice paintDevice = new PanelPaintDevice(true);
for (PanelPaintDeviceListener listener : ppdListeners) {
paintDevice.addListener(listener);
}
TextHandler textHandler = new TextHandler(getCode());
Diagram diagram = new Diagram(configuration.getDataObject(), textHandler, paintDevice);
DiagramError newError = null;
try {
diagram.generate();
} catch (RuntimeException e) {
newError = new FatalError(textHandler, e);
} catch (DiagramError e) {
newError = e;
}
synchronized (diagramStack) {
diagramStack.addLast(diagram);
synchronized (this) {
error = newError;
}
}
}
use of net.sf.sdedit.ui.PanelPaintDevice in project abstools by abstools.
the class Tab method scrollToCurrentDrawable.
private void scrollToCurrentDrawable() {
int begin = textArea.getCurrentLineBegin();
Diagram diagram = getDiagram();
if (diagram != null) {
PanelPaintDevice ppd = (PanelPaintDevice) diagram.getPaintDevice();
Drawable drawable = diagram.getDrawableForState(begin);
if (drawable instanceof Arrow) {
Arrow arrow = (Arrow) drawable;
Point textPosition = arrow.getTextPosition();
int x = textPosition != null ? textPosition.x : arrow.getLeft();
float xratio = 1F * x / ppd.getWidth();
int y = drawable.getTop();
float yratio = 1F * y / ppd.getHeight();
zoomPane.scrollToPosition(xratio, yratio);
} else {
if (drawable != null) {
int x = drawable.getLeft();
float xratio = 1F * x / ppd.getWidth();
int y = drawable.getTop();
float yratio = 1F * y / ppd.getHeight();
zoomPane.scrollToPosition(xratio, yratio);
} else {
int caret = textArea.getCaretPosition();
if (textArea.getText().substring(caret).trim().length() == 0) {
zoomPane.scrollToBottom();
}
}
}
}
}
use of net.sf.sdedit.ui.PanelPaintDevice in project abstools by abstools.
the class UserInterfaceImpl method fullScreen.
public void fullScreen() {
if (fullScreen == null) {
errorMessage("Full-screen mode is not supported\nby your graphics environment.");
return;
}
Diagram diag = getDiagram();
if (diag != null) {
PanelPaintDevice ppd = (PanelPaintDevice) diag.getPaintDevice();
setVisible(false);
fullScreen.display(ppd.getPanel());
fullScreen.getZoomPane().fitSize();
}
}
Aggregations