Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Print large Diagram(GEF interaction with print)
Print large Diagram [message #652061] Wed, 02 February 2011 09:55 Go to next message
tenor  is currently offline tenor
Messages: 57
Registered: October 2010
Member
I have GUI screens,which will have different layouts for print and screen.
How i should be able to have suitably scaled graphics to be printed on large size paper , i have snippets(3 and 4), are those sufficient?
Multi tab print, how it can be done ie not only current tab under focus, the tabs which are out of focus, those too should be printed out.
First and foremost, what needs to be decided ie Form Factor, ie paper size will determine what what things?
How to integrate google swt with the screen code which i have,mostly gef, ie who should call google swt code ie will it come from
screen code?
PrintLogicAction -- How to do it? [message #653121 is a reply to message #652061] Tue, 08 February 2011 10:05 Go to previous message
tenor  is currently offline tenor
Messages: 57
Registered: October 2010
Member
I am trying to print GEF screen but not making any progress?
This piece of line is Ok ? ie

viewer.setEditPartFactory(new XXXEditPartFactory(context));

1.Pls guide how to go about it, as i have put a command and handler(but that too is greyed out ie print command)
2.How to run PrintlogicAction from GEF example and debug?



public class PrintTLD extends AbstractHandler implements IHandler {

private OspContext context;
private App aps;
protected App getContents() {
return aps;
}

@Override
public void addHandlerListener(IHandlerListener handlerListener) {
// TODO Auto-generated method stub

}

@Override
public void dispose() {
// TODO Auto-generated method stub

}

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
int style = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell().getStyle();
Shell shell = new Shell((style & SWT.MIRRORED) != 0 ? SWT.RIGHT_TO_LEFT
: SWT.NONE);
WorkbenchPart workbenchPart = (WorkbenchPart) HandlerUtil.getActivePart(event);
if (workbenchPart instanceof XXXViewPart){
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(shell);
viewer.setEditDomain(new DefaultEditDomain(null));
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setEditPartFactory(new XXXEditPartFactory(context));
viewer.setContents(getContents());
viewer.flush();

int printMode = new PrintModeDialog(shell).open();
if (printMode == -1)
return null ;
PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
PrinterData data = dialog.open();
if (data != null) {
PrintGraphicalViewerOperation op = new PrintGraphicalViewerOperation(
new Printer(data), viewer);
op.setPrintMode(printMode);
op.run(XXXViewPart.class.getName());
}else {
MessageDialog.openError(shell, "Cannot proceed", "Select the APP part before proceeding.");
}


}
return null;
}

@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return false;
}

@Override
public boolean isHandled() {
// TODO Auto-generated method stub
return false;
}

@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
// TODO Auto-generated method stub

}

}
Previous Topic:Scalable Line within a gef figure
Next Topic:Obstacle-avoiding Manhattan router
Goto Forum:
  


Current Time: Wed Apr 16 09:40:43 EDT 2014

Powered by FUDForum. Page generated in 0.02837 seconds