How to call a Birt Viewer in the application [message #191143] |
Wed, 20 September 2006 04:12  |
Eclipse User |
|
|
|
Originally posted by: m.luo.cosmit.de
Hi, I've got the following problem.
I want to call the Birt Viewer in my application, so that i can show a
report in the Viewer. The Code is:
.....
browser= new Browser(lParent, SWT.NONE);
.....
WebViewer.startup(browser);
WebViewer.display(reportName, WebViewer.HTML, true);
.....
But i've got Exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/core/runtime/CoreException
at test.TestRun.run(TestRun.java:56)
at test.TestRun.main(TestRun.java:117)
The similar code in RCP example "Birt RCP Viewer" is ok, but dosen't work in
my application.
Has someone met such a problem?
|
|
|
|
Re: How to call a Birt Viewer in the application [message #191741 is a reply to message #191143] |
Mon, 25 September 2006 05:19   |
Eclipse User |
|
|
|
Originally posted by: luoman_2000.hotmail.ccom
hi Jason,
I have only wrote a normal test-program, it isn't a RPC application. So i
drop needed plugins as external JARS. The Code is as follows:
import org.eclipse.birt.report.viewer.utilities.WebViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
public class TestRun {
private transient Text reportLocation = null;
private transient Button browseFolderButton = null;
private Composite lParent;
private GridData gridData;
private Browser browser;
private ProgressBar progressBar;
public TestRun() {
}
public void run() {
Display d = new Display();
lParent = new Shell(d);
lParent.setLayout(new GridLayout());
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gridData = gd;
Group reportGroup = new Group(lParent, SWT.SHADOW_IN);
reportGroup.setText("Select report:");
GridLayout layout = new GridLayout(2, false);
reportGroup.setLayout(layout);
gd = new GridData(GridData.FILL_HORIZONTAL);
reportGroup.setLayoutData(gd);
gd = new GridData();
gd.horizontalSpan = 2;
Label label = new Label(reportGroup, SWT.NONE);
label.setText("Full Path:");
label.setLayoutData(gd);
reportLocation = new Text(reportGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
reportLocation.setLayoutData(gd);
reportLocation.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
}
});
browseFolderButton = new Button(reportGroup, SWT.RIGHT);
browseFolderButton.setText("..."); //$NON-NLS-1$
browseFolderButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(reportLocation.getShell());
String[] extension = { "*.rptdesign" };
dialog.setFilterExtensions(extension);
if (reportLocation.getText() != null
&& reportLocation.getText().trim().length() > 0) {
dialog.setFilterPath(reportLocation.getText());
}
String selectedLocation = dialog.open();
if (selectedLocation != null) {
reportLocation.setText(selectedLocation);
}
}
});
Button showReport = new Button(reportGroup, SWT.PUSH);
showReport.setText("Run Report");
showReport.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
try {
WebViewer.display(reportLocation.getText(), WebViewer.HTML,
true);
} catch (RuntimeException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
browser = new Browser(lParent, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
browser.setLayoutData(gd);
browser.addLocationListener(new LocationAdapter() {
public void changed(final LocationEvent e) {
progressBar.setVisible(false);
}
public void changing(final LocationEvent e) {
progressBar.setVisible(true);
}
});
gd = new GridData(GridData.END, GridData.CENTER, false, false);
gd.heightHint = 10;
gd.widthHint = 100;
progressBar = new ProgressBar(lParent, SWT.INDETERMINATE);
progressBar.setLayoutData(gd);
progressBar.setVisible(false);
((Shell)lParent).open();
while (!lParent.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
WebViewer.startup(browser);
}
public static void main(String[] args) {
TestRun t = new TestRun();
t.run();
}
}
When I run the program, there is the exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/core/runtime/CoreException
How to call a viewer in the normal application to show the rptdesign file?
Thanks and Regards,
Luo
|
|
|
Re: How to call a Birt Viewer in the application [message #192695 is a reply to message #191741] |
Tue, 26 September 2006 13:51  |
Eclipse User |
|
|
|
Any chance I can get you to send me the project?
Thanks
Jason
"Luo" <luoman_2000@hotmail.ccom> wrote in message
news:ef86tu$9pj$1@utils.eclipse.org...
> hi Jason,
> I have only wrote a normal test-program, it isn't a RPC application. So i
> drop needed plugins as external JARS. The Code is as follows:
>
> import org.eclipse.birt.report.viewer.utilities.WebViewer;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.browser.Browser;
> import org.eclipse.swt.browser.LocationAdapter;
> import org.eclipse.swt.browser.LocationEvent;
> import org.eclipse.swt.browser.LocationListener;
> import org.eclipse.swt.browser.ProgressEvent;
> import org.eclipse.swt.browser.ProgressListener;
> import org.eclipse.swt.browser.StatusTextEvent;
> import org.eclipse.swt.browser.StatusTextListener;
> import org.eclipse.swt.events.ModifyEvent;
> import org.eclipse.swt.events.ModifyListener;
> import org.eclipse.swt.events.SelectionAdapter;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.events.SelectionListener;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Event;
> import org.eclipse.swt.widgets.FileDialog;
> import org.eclipse.swt.widgets.Group;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Listener;
> import org.eclipse.swt.widgets.ProgressBar;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Text;
> import org.eclipse.swt.widgets.ToolBar;
> import org.eclipse.swt.widgets.ToolItem;
>
> public class TestRun {
>
> private transient Text reportLocation = null;
> private transient Button browseFolderButton = null;
> private Composite lParent;
> private GridData gridData;
> private Browser browser;
> private ProgressBar progressBar;
>
> public TestRun() {
> }
>
> public void run() {
> Display d = new Display();
> lParent = new Shell(d);
> lParent.setLayout(new GridLayout());
> GridData gd = new GridData(GridData.FILL_HORIZONTAL);
> gridData = gd;
> Group reportGroup = new Group(lParent, SWT.SHADOW_IN);
> reportGroup.setText("Select report:");
> GridLayout layout = new GridLayout(2, false);
> reportGroup.setLayout(layout);
> gd = new GridData(GridData.FILL_HORIZONTAL);
> reportGroup.setLayoutData(gd);
>
> gd = new GridData();
> gd.horizontalSpan = 2;
>
> Label label = new Label(reportGroup, SWT.NONE);
> label.setText("Full Path:");
>
> label.setLayoutData(gd);
>
> reportLocation = new Text(reportGroup, SWT.BORDER);
> gd = new GridData(GridData.FILL_HORIZONTAL);
> reportLocation.setLayoutData(gd);
> reportLocation.addModifyListener(new ModifyListener() {
>
> public void modifyText(ModifyEvent e) {
>
> }
>
> });
>
> browseFolderButton = new Button(reportGroup, SWT.RIGHT);
> browseFolderButton.setText("..."); //$NON-NLS-1$
> browseFolderButton.addSelectionListener(new SelectionAdapter() {
>
>
> public void widgetSelected(SelectionEvent e) {
> FileDialog dialog = new FileDialog(reportLocation.getShell());
> String[] extension = { "*.rptdesign" };
> dialog.setFilterExtensions(extension);
> if (reportLocation.getText() != null
> && reportLocation.getText().trim().length() > 0) {
>
> dialog.setFilterPath(reportLocation.getText());
>
> }
>
> String selectedLocation = dialog.open();
> if (selectedLocation != null) {
> reportLocation.setText(selectedLocation);
> }
> }
>
> });
>
> Button showReport = new Button(reportGroup, SWT.PUSH);
> showReport.setText("Run Report");
>
> showReport.addSelectionListener(new SelectionListener() {
>
>
> public void widgetSelected(SelectionEvent e) {
> try {
> WebViewer.display(reportLocation.getText(), WebViewer.HTML,
> true);
> } catch (RuntimeException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> }
>
>
> public void widgetDefaultSelected(SelectionEvent e) {
>
> }
> });
>
> browser = new Browser(lParent, SWT.NONE);
> gd = new GridData(GridData.FILL_BOTH);
> gd.horizontalSpan = 2;
> browser.setLayoutData(gd);
> browser.addLocationListener(new LocationAdapter() {
>
> public void changed(final LocationEvent e) {
> progressBar.setVisible(false);
> }
>
> public void changing(final LocationEvent e) {
> progressBar.setVisible(true);
> }
> });
>
> gd = new GridData(GridData.END, GridData.CENTER, false, false);
> gd.heightHint = 10;
> gd.widthHint = 100;
> progressBar = new ProgressBar(lParent, SWT.INDETERMINATE);
> progressBar.setLayoutData(gd);
> progressBar.setVisible(false);
> ((Shell)lParent).open();
>
> while (!lParent.isDisposed()) {
> if (!d.readAndDispatch())
> d.sleep();
> }
> d.dispose();
>
>
> WebViewer.startup(browser);
> }
>
>
> public static void main(String[] args) {
>
> TestRun t = new TestRun();
> t.run();
> }
>
> }
>
> When I run the program, there is the exception:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/eclipse/core/runtime/CoreException
>
> How to call a viewer in the normal application to show the rptdesign file?
>
> Thanks and Regards,
>
> Luo
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.45000 seconds