Java Code Examples for org.eclipse.swt.browser.Browser#setLayoutData()

The following examples show how to use org.eclipse.swt.browser.Browser#setLayoutData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AboutDialog.java    From http4e with Apache License 2.0 7 votes vote down vote up
protected Control createDialogArea( Composite parent){
   Composite composite = (Composite) super.createDialogArea(parent);

   Browser browser = new Browser(composite, SWT.NONE);
   browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

   try {
      String html = new String(ResourceUtils.getBundleResourceBytes(CoreConstants.PLUGIN_UI, "resources/about.html"));
      html = html.replaceAll("currentYear", ""+Calendar.getInstance().get(Calendar.YEAR));
      browser.setText(html);

   } catch (Exception e) {
      setErrorMessage(e.getLocalizedMessage());
   }
   return composite;
}
 
Example 2
Source File: HtmlBrowserEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent);
	parent.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmp = new Composite(parent, SWT.BORDER);
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(cmp);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(cmp);
	
	browser = new Browser(cmp, SWT.NONE);
	browser.setLayoutData(new GridData(GridData.FILL_BOTH));
	browser.setUrl(htmlUrl);

	browser.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDown(MouseEvent e) {
			getSite().getPart().setFocus();
			super.mouseDown(e);
		}
	});
}
 
Example 3
Source File: HtmlBrowserEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent);
	parent.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmp = new Composite(parent, SWT.BORDER);
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(cmp);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(cmp);
	
	browser = new Browser(cmp, SWT.NONE);
	browser.setLayoutData(new GridData(GridData.FILL_BOTH));
	browser.setUrl(htmlUrl);

	browser.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDown(MouseEvent e) {
			getSite().getPart().setFocus();
			super.mouseDown(e);
		}
	});
}
 
Example 4
Source File: StaticHTMLViewer.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void createBrowserSection( Composite parent )
{
	browserContainer = toolkit.createComposite( parent );
	browserContainer.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.horizontalSpacing = 0;
	layout.verticalSpacing = 0;
	layout.numColumns = 1;
	browserContainer.setLayout( layout );

	browser = new Browser( browserContainer, SWT.NONE );
	browser.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	browser.addLocationListener( new ReportLocationListener( this ) );
	sashForm.setMaximizedControl( browserContainer );
}
 
Example 5
Source File: HtmlDialog.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
   Composite c = (Composite) super.createDialogArea(parent);
   b = new Browser(c, SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
   b.setLayoutData(gd);
   b.setText(html);
   b.setSize(500, 500);
   if (listener != null) {
      b.addLocationListener(listener);
   }
   b.setMenu(pageOverviewGetPopup());

   return c;
}
 
Example 6
Source File: BrowserInputDialog.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = (Composite) super.createDialogArea(parent);
	Browser browser = new Browser(ret, SWT.NONE);
	browser.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	browser.setUrl(url);
	Label lbtext = new Label(ret, SWT.NONE);
	lbtext.setText(text);
	input = new Text(ret, SWT.BORDER);
	input.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	return ret;
}
 
Example 7
Source File: CreateXMPPAccountWizardPage.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void performHelp() {
  Shell shell = new Shell(getShell());
  shell.setText("Saros XMPP Accounts");
  shell.setLayout(new GridLayout());
  shell.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

  Browser browser = new Browser(shell, SWT.NONE);
  browser.setUrl("https://www.saros-project.org/documentation/setup-xmpp.html");
  browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

  shell.open();
}
 
Example 8
Source File: ShowHelpDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = createShell( parent );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );

  FormLayout formLayout = new FormLayout();

  shell.setLayout( formLayout );
  shell.setText( dialogTitle );

  //Set Images
  setImages();

  // Canvas
  wBrowser = new Browser( shell, SWT.NONE );
  props.setLook( wBrowser );

  // Browser canvas
  FormData fdBrowser = new FormData();
  fdBrowser.top = new FormAttachment( 0, TOOLBAR_HEIGHT );
  fdBrowser.bottom = new FormAttachment( 100, 0 );
  fdBrowser.right = new FormAttachment( 100, 0 );
  fdBrowser.left = new FormAttachment( 0, 0 );
  wBrowser.setLayoutData( fdBrowser );
  wBrowser.setUrl( url );

  // Left toolbar (back, forward, refresh, home)
  toolbarLeft = new ToolBar( shell, SWT.WRAP );
  FormData fdToolbarLeft = new FormData();
  fdToolbarLeft.top = new FormAttachment( 0, MARGIN );
  toolbarLeft.setLayoutData( fdToolbarLeft );
  toolbarLeft.setCursor( cursorEnabled );
  toolbarLeft.setBackground( toolbarLeft.getParent().getBackground() );

  tltmBack = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmBack.setImage( imageBackEnabled );
  tltmBack.setDisabledImage( imageBackDisabled );
  tltmBack.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Back" ) );
  tltmBack.setEnabled( false );

  tltmForward = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmForward.setImage( imageForwardEnabled );
  tltmForward.setDisabledImage( imageForwardDisabled );
  tltmForward.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Forward" ) );
  tltmForward.setEnabled( false );

  tltmRefresh = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmRefresh.setImage( imageRefreshEnabled );
  tltmRefresh.setDisabledImage( imageRefreshDisabled );
  tltmRefresh.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Refresh" ) );
  tltmRefresh.setEnabled( true );

  tltmHome = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmHome.setImage( imageHomeEnabled );
  tltmHome.setDisabledImage( imageHomeDisabled );
  tltmHome.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Home" ) );
  tltmHome.setEnabled( true );

  // Right toolbar (print)
  toolbarRight = new ToolBar( shell, SWT.WRAP );
  FormData fdToolbarRight = new FormData();
  fdToolbarRight.top = new FormAttachment( 0, MARGIN );
  fdToolbarRight.right = new FormAttachment( 100, -1 * TOOL_ITEM_SPACING );
  toolbarRight.setLayoutData( fdToolbarRight );
  toolbarRight.setCursor( cursorEnabled );
  toolbarRight.setBackground( toolbarRight.getParent().getBackground() );

  // URL toolbar element
  textURL = new Text( shell, SWT.BORDER );
  FormData fdText = new FormData();
  fdText.top = new FormAttachment( 0, MARGIN );
  fdText.right = new FormAttachment( toolbarRight, -1 * TOOL_ITEM_SPACING );
  fdText.left = new FormAttachment( toolbarLeft, TOOL_ITEM_SPACING );
  textURL.setLayoutData( fdText );
  textURL.setForeground( new Color( display, 101, 101, 101 ) );

  tltmPrint = new ToolItem( toolbarRight, SWT.PUSH );
  tltmPrint.setImage( imagePrintEnabled );
  tltmPrint.setDisabledImage( imagePrintDisabled );
  tltmPrint.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Print" ) );
  tltmPrint.setEnabled( true );

  setUpListeners();

  // Specs are 760/530, but due to rendering differences, we need to adjust the actual hgt/wdt used
  BaseStepDialog.setSize( shell, 755, 538, true );
  shell.setMinimumSize( 515, 408 );

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
}
 
Example 9
Source File: Regression_128590_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_128590_svg siv = new Regression_128590_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = showTooltip_BarChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}
	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 10
Source File: Regression_117876_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117876_svg siv = new Regression_117876_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = toggleVisibility_MeterChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 11
Source File: Regression_136069_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = BarChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 12
Source File: Regression_131658_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = createMeterChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 13
Source File: Regression_141706_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = showTooltip_BarChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 14
Source File: Regression_117865_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117865_svg siv = new Regression_117865_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = toggleVisibility_PieChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 15
Source File: Regression_145144_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117865_svg siv = new Regression_117865_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = highlight_BarChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 16
Source File: Regression_131260_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = showTooltip_BarChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 17
Source File: Regression_132620_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_132620_svg siv = new Regression_132620_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = toggleVisibility_BarChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 18
Source File: Regression_117511_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = BarChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 19
Source File: Regression_145712_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117865_svg siv = new Regression_117865_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = showTooltip_AreaChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 20
Source File: SvgInteractivityViewer.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = InteractivityCharts.createSVGHSChart( );
				break;
			case 1 :
				cm = InteractivityCharts.createSTChart( );
				break;
			case 2 :
				cm = InteractivityCharts.createTVChart( );
				break;
			case 3 :
				cm = InteractivityCharts.createURChart( );
				break;
		}
		
		try
		{
			
			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build( idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );
			
			idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}