Java Code Examples for org.eclipse.swt.custom.CTabItem#setControl()

The following examples show how to use org.eclipse.swt.custom.CTabItem#setControl() . 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: FieldsTab.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void buildFieldsTab() {
  checkArgument( wTabFolder.getItemCount() > 0 );

  CTabItem wFieldsTab = new CTabItem( wTabFolder, SWT.NONE, wTabFolder.getItemCount() - 1 );
  wFieldsTab.setText( BaseMessages.getString( PKG, "JmsConsumerDialog.FieldsTab" ) );

  Composite wFieldsComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wFieldsComp );
  FormLayout fieldsLayout = new FormLayout();
  fieldsLayout.marginHeight = 15;
  fieldsLayout.marginWidth = 15;
  wFieldsComp.setLayout( fieldsLayout );

  FormData fieldsFormData = new FormData();
  fieldsFormData.left = new FormAttachment( 0, 0 );
  fieldsFormData.top = new FormAttachment( wFieldsComp, 0 );
  fieldsFormData.right = new FormAttachment( 100, 0 );
  fieldsFormData.bottom = new FormAttachment( 100, 0 );
  wFieldsComp.setLayoutData( fieldsFormData );

  buildFieldTable( wFieldsComp, wFieldsComp );

  wFieldsComp.layout();
  wFieldsTab.setControl( wFieldsComp );
}
 
Example 2
Source File: GamaPreferencesView.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private void buildContentsFor(final CTabItem tab, final Map<String, List<Pref>> entries) {
	final ParameterExpandBar viewer = new ParameterExpandBar(tab.getParent(), SWT.V_SCROLL);
	contents.add(viewer);
	final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
	viewer.setLayoutData(data);
	// ?
	viewer.computeSize(tab.getBounds().x, SWT.DEFAULT);
	//
	viewer.setSpacing(5);
	tab.setControl(viewer);
	for (final String groupName : entries.keySet()) {
		final ParameterExpandItem item = new ParameterExpandItem(viewer, entries.get(groupName), SWT.NONE, null);
		item.setText(groupName);
		item.setColor(new GamaColor(230, 230, 230, 255));
		final Composite compo = new Composite(viewer, SWT.NONE);
		compo.setBackground(viewer.getBackground());
		buildGroupContents(compo, entries.get(groupName), NB_DIVISIONS);
		item.setControl(compo);
		item.setHeight(compo.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
		item.setExpanded(true);
	}

}
 
Example 3
Source File: RotatedTextPageGenerator.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void buildItemContent( CTabItem item )
{
	if ( itemMap.containsKey( item ) && itemMap.get( item ) == null )
	{
		String title = tabFolder.getSelection( ).getText( );

		if ( CUSTOM_PAGE_TITLE.equals( title ) )
		{
			TabPage page = new RotatedTextCustomPage( ).getPage( );

			if ( page != null )
			{
				setPageInput( page );
				refresh( tabFolder, page, true );
				item.setControl( page.getControl( ) );
				itemMap.put( item, page );
			}
		}
	}
	else if ( itemMap.get( item ) != null )
	{
		setPageInput( itemMap.get( item ) );
		refresh( tabFolder, itemMap.get( item ), false );
	}
}
 
Example 4
Source File: BasePageGenerator.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Builds and initialize the content for each tab.
 * 
 * @param item
 */
protected void buildItemContent( CTabItem item )
{
	if ( itemMap.containsKey( item ) && itemMap.get( item ) == null )
	{
		String title = tabFolder.getSelection( ).getText( );

		TabPage page = buildTabContent( title );

		if ( page != null )
		{
			setPageInput( page );
			refresh( tabFolder, page, true );
			item.setControl( page.getControl( ) );
			itemMap.put( item, page );
		}
	}
	else if ( itemMap.get( item ) != null )
	{
		setPageInput( itemMap.get( item ) );
		refresh( tabFolder, itemMap.get( item ), false );
	}
}
 
Example 5
Source File: SearchView.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
public void addSearchTab(String title, ITab<?> view) {
	CTabItem tab = new CTabItem(searchTabs, SWT.NONE);
	tab.setText(title);

	Composite composite = view.getComposite();
	composite.setParent(searchTabs);

	tab.setControl(composite);

	searchTabs.setSelection(tab);

	// this part is a bit hacky, but there is no other way to notify the view about
	// the dispose
	tab.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			view.closed();
		}
	});
}
 
Example 6
Source File: TemplatePrintView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
CTabItem addItem(final String template, final String title, final Kontakt adressat){
	CTabItem ret = new CTabItem(ctab, SWT.NONE);
	text = new TextContainer(getViewSite());
	ret.setControl(text.getPlugin().createContainer(ctab, new ICallback() {
		public void save(){}
		
		public boolean saveAs(){
			return false;
		}
		
	}));
	Brief actBrief =
		text.createFromTemplateName(Konsultation.getAktuelleKons(), template, Brief.UNKNOWN,
			adressat, title);
	ret.setData(KEY_BRIEF, actBrief);
	ret.setData(KEY_TEXT, text);
	ret.setText(title);
	return ret;
}
 
Example 7
Source File: PipelineDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParamTab() {
  // ////////////////////////
  // START OF PARAM TAB
  // /
  wParamTab = new CTabItem( wTabFolder, SWT.NONE );
  wParamTab.setText( BaseMessages.getString( PKG, "PipelineDialog.ParamTab.Label" ) );

  FormLayout paramLayout = new FormLayout();
  paramLayout.marginWidth = props.getMargin();
  paramLayout.marginHeight = props.getMargin();

  Composite wParamComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParamComp );
  wParamComp.setLayout( paramLayout );

  Label wlFields = new Label( wParamComp, SWT.RIGHT );
  wlFields.setText( BaseMessages.getString( PKG, "PipelineDialog.Parameters.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int FieldsCols = 3;
  final int FieldsRows = pipelineMeta.listParameters().length;

  ColumnInfo[] colinf = new ColumnInfo[ FieldsCols ];
  colinf[ 0 ] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "PipelineDialog.ColumnInfo.Parameter.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );
  colinf[ 1 ] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "PipelineDialog.ColumnInfo.Default.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );
  colinf[ 2 ] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "PipelineDialog.ColumnInfo.Description.Label" ),
      ColumnInfo.COLUMN_TYPE_TEXT, false );

  wParamFields =
    new TableView(
      pipelineMeta, wParamComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wParamFields.setLayoutData( fdFields );

  FormData fdDepComp = new FormData();
  fdDepComp.left = new FormAttachment( 0, 0 );
  fdDepComp.top = new FormAttachment( 0, 0 );
  fdDepComp.right = new FormAttachment( 100, 0 );
  fdDepComp.bottom = new FormAttachment( 100, 0 );
  wParamComp.setLayoutData( fdDepComp );

  wParamComp.layout();
  wParamTab.setControl( wParamComp );

  // ///////////////////////////////////////////////////////////
  // / END OF PARAM TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 8
Source File: CrosstabPageGenerator.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void buildItemContent( CTabItem item )
{
	if ( itemMap.containsKey( item ) && itemMap.get( item ) == null )
	{
		String title = tabFolder.getSelection( ).getText( );
		if ( title.equals( BINDINGTITLE ) )
		{
			bindingPage = new CrosstabBindingPage( );
			setPageInput( bindingPage );
			refresh( tabFolder, bindingPage, true );
			item.setControl( bindingPage.getControl( ) );
			itemMap.put( item, bindingPage );
		}
		else if ( title.equals( ROWAREATITLE ) )
		{
			rowAreaPage = new BaseAttributePage( );
			rowAreaPage.buildUI( item.getParent( ) );
			rowAreaPage.setCategoryProvider( RowAreaCategoryProviderFactory.getInstance( )
					.getCategoryProvider( input ) );
			setPageInput( rowAreaPage );
			refresh( tabFolder, rowAreaPage, true );
			item.setControl( rowAreaPage.getControl( ) );
			itemMap.put( item, rowAreaPage );
		}
		else if ( title.equals( COLUMNAREATITLE ) )
		{
			columnAreaPage = new BaseAttributePage( );
			columnAreaPage.buildUI( item.getParent( ) );
			columnAreaPage.setCategoryProvider( ColumnAreaCategoryProviderFactory.getInstance( )
					.getCategoryProvider( input ) );
			setPageInput( columnAreaPage );
			refresh( tabFolder, columnAreaPage, true );
			item.setControl( columnAreaPage.getControl( ) );
			itemMap.put( item, columnAreaPage );
		}
		else if ( title.equals( FILTERTITLE ) )
		{
			filterPage = new FormPage( FormPropertyDescriptor.NO_UP_DOWN,
					new CrosstabFilterHandleProvider( ),
					true,
					true );
			setPageInput( filterPage );
			refresh( tabFolder, filterPage, true );
			item.setControl( filterPage.getControl( ) );
			itemMap.put( item, filterPage );
		}
		else if ( title.equals( SORTINGTITLE ) )
		{
			sortingPage = new FormPage( FormPropertyDescriptor.NO_UP_DOWN,
					new CrosstabSortingHandleProvider( ),
					true,
					true );
			setPageInput( sortingPage );
			refresh( tabFolder, sortingPage, true );
			item.setControl( sortingPage.getControl( ) );
			itemMap.put( item, sortingPage );
		}
		else if ( title.equals( MAPTITLE ) )
		{
			mapPage = new PreviewPage( true );
			mapPage.setPreview( new MapPropertyDescriptor( true ) );
			mapPage.setProvider( new CrosstabMapDescriptorProvider( MapHandleProvider.EXPRESSION_TYPE_DATA ) );
			setPageInput( mapPage );
			refresh( tabFolder, mapPage, true );
			item.setControl( mapPage.getControl( ) );
			itemMap.put( item, mapPage );
		}
		else if ( title.equals( HIGHLIGHTSTITLE ) )
		{
			highlightsPage = new PreviewPage( true );
			highlightsPage.setPreview( new HighlightPropertyDescriptor( true ) );
			highlightsPage.setProvider( new CrosstabHighlightDescriptorProvider( HighlightHandleProvider.EXPRESSION_TYPE_DATA ) );
			setPageInput( highlightsPage );
			refresh( tabFolder, highlightsPage, true );
			item.setControl( highlightsPage.getControl( ) );
			itemMap.put( item, highlightsPage );
		}
	}
	else if ( itemMap.get( item ) != null )
	{
		setPageInput( itemMap.get( item ) );
		refresh( tabFolder, itemMap.get( item ), false );
	}
}
 
Example 9
Source File: JobDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addSettingsTab() {
  // ////////////////////////
  // START OF SETTINGS TAB///
  // /
  wSettingsTab = new CTabItem( wTabFolder, SWT.NONE );
  wSettingsTab.setText( BaseMessages.getString( PKG, "JobDialog.SettingsTab.Label" ) );

  FormLayout LogLayout = new FormLayout();
  LogLayout.marginWidth = Const.MARGIN;
  LogLayout.marginHeight = Const.MARGIN;

  Composite wSettingsComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wSettingsComp );
  wSettingsComp.setLayout( LogLayout );

  wlBatchTrans = new Label( wSettingsComp, SWT.RIGHT );
  wlBatchTrans.setText( BaseMessages.getString( PKG, "JobDialog.PassBatchID.Label" ) );
  props.setLook( wlBatchTrans );
  fdlBatchTrans = new FormData();
  fdlBatchTrans.left = new FormAttachment( 0, 0 );
  fdlBatchTrans.top = new FormAttachment( 0, margin );
  fdlBatchTrans.right = new FormAttachment( middle, -margin );
  wlBatchTrans.setLayoutData( fdlBatchTrans );
  wBatchTrans = new Button( wSettingsComp, SWT.CHECK );
  props.setLook( wBatchTrans );
  wBatchTrans.setToolTipText( BaseMessages.getString( PKG, "JobDialog.PassBatchID.Tooltip" ) );
  fdBatchTrans = new FormData();
  fdBatchTrans.left = new FormAttachment( middle, 0 );
  fdBatchTrans.top = new FormAttachment( 0, margin );
  fdBatchTrans.right = new FormAttachment( 100, 0 );
  wBatchTrans.setLayoutData( fdBatchTrans );

  // Shared objects file
  Label wlSharedObjectsFile = new Label( wSettingsComp, SWT.RIGHT );
  wlSharedObjectsFile.setText( BaseMessages.getString( PKG, "JobDialog.SharedObjectsFile.Label" ) );
  props.setLook( wlSharedObjectsFile );
  FormData fdlSharedObjectsFile = new FormData();
  fdlSharedObjectsFile.left = new FormAttachment( 0, 0 );
  fdlSharedObjectsFile.right = new FormAttachment( middle, -margin );
  fdlSharedObjectsFile.top = new FormAttachment( wBatchTrans, 4 * margin );
  wlSharedObjectsFile.setLayoutData( fdlSharedObjectsFile );
  wSharedObjectsFile = new TextVar( jobMeta, wSettingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  wlSharedObjectsFile.setToolTipText( BaseMessages.getString( PKG, "JobDialog.SharedObjectsFile.Tooltip" ) );
  wSharedObjectsFile.setToolTipText( BaseMessages.getString( PKG, "JobDialog.SharedObjectsFile.Tooltip" ) );
  props.setLook( wSharedObjectsFile );
  FormData fdSharedObjectsFile = new FormData();
  fdSharedObjectsFile.left = new FormAttachment( middle, 0 );
  fdSharedObjectsFile.top = new FormAttachment( wBatchTrans, 4 * margin );
  fdSharedObjectsFile.right = new FormAttachment( 100, 0 );
  wSharedObjectsFile.setLayoutData( fdSharedObjectsFile );
  wSharedObjectsFile.addModifyListener( new ModifyListener() {
    public void modifyText( ModifyEvent arg0 ) {
      sharedObjectsFileChanged = true;
    }
  } );

  FormData fdLogComp = new FormData();
  fdLogComp.left = new FormAttachment( 0, 0 );
  fdLogComp.top = new FormAttachment( 0, 0 );
  fdLogComp.right = new FormAttachment( 100, 0 );
  fdLogComp.bottom = new FormAttachment( 100, 0 );
  wSettingsComp.setLayoutData( fdLogComp );

  wSettingsComp.layout();
  wSettingsTab.setControl( wSettingsComp );

  // ///////////////////////////////////////////////////////////
  // / END OF LOG TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 10
Source File: EnterOptionsDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addPluginTabs() {

    // Add a new tab for every config plugin which is also a GuiPlugin
    // Then simply add the widgets on a separate tab
    //
    HopGui hopGui = HopGui.getInstance();
    PluginRegistry pluginRegistry = PluginRegistry.getInstance();

    List<IPlugin> configPlugins = pluginRegistry.getPlugins( ConfigPluginType.class );
    for ( IPlugin configPlugin : configPlugins ) {
      String guiPluginId = configPlugin.getName(); // Mapped like that in ConfigPluginType
      if ( StringUtils.isEmpty( guiPluginId ) ) {
        continue;
      }
      IPlugin guiPlugin = pluginRegistry.findPluginWithId( GuiPluginType.class, guiPluginId );
      if ( guiPlugin != null ) {
        // Load the instance
        //
        try {
          Object emptySourceData = pluginRegistry.loadClass( guiPlugin );
          Method method = emptySourceData.getClass().getMethod( "getInstance" );
          Object sourceData = method.invoke( null, null );

          // This config plugin is also a GUI plugin
          // Add a tab
          //
          CTabItem wPluginTab = new CTabItem( wTabFolder, SWT.NONE );
          wPluginTab.setText( Const.NVL( guiPlugin.getDescription(), "" ) );

          ScrolledComposite sOtherComp = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
          sOtherComp.setLayout( new FormLayout() );

          Composite wPluginsComp = new Composite( sOtherComp, SWT.NONE );
          props.setLook( wPluginsComp );
          wPluginsComp.setLayout( new FormLayout() );

          GuiCompositeWidgets compositeWidgets = new GuiCompositeWidgets( hopGui.getVariables(), 20 );
          compositeWidgets.createCompositeWidgets( sourceData, null, wPluginsComp, guiPlugin.getIds()[ 0 ], null );
          compositeWidgets.setWidgetsContents( sourceData, wPluginsComp, guiPlugin.getIds()[ 0 ] );

          wPluginsComp.pack();

          Rectangle bounds = wPluginsComp.getBounds();

          sOtherComp.setContent( wPluginsComp );
          sOtherComp.setExpandHorizontal( true );
          sOtherComp.setExpandVertical( true );
          sOtherComp.setMinWidth( bounds.width );
          sOtherComp.setMinHeight( bounds.height );

          wPluginTab.setControl( sOtherComp );

        } catch ( Exception e ) {
          new ErrorDialog( shell, "Error", "Error handling configuration options for GUI plugin " + guiPluginId, e );
        }
      }
    }


    // ///////////////////////////////////////////////////////////
    // / END OF PLUGINS TAB
    // ///////////////////////////////////////////////////////////

  }
 
Example 11
Source File: CodeDetailView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
private void addUserSpecifiedPages(String settings){
	String[] userSettings = settings.split(",");
	Map<Integer, IConfigurationElement> iceMap = new TreeMap<Integer, IConfigurationElement>();
	
	iceMap = collectNeededPages(ExtensionPointConstantsUi.DIAGNOSECODE, userSettings, iceMap);
	iceMap =
		collectNeededPages(ExtensionPointConstantsUi.VERRECHNUNGSCODE, userSettings, iceMap);
	iceMap = collectNeededPages(ExtensionPointConstantsUi.GENERICCODE, userSettings, iceMap);
	
	// add favorites tab if settings desire it
	for (int i = 0; i < userSettings.length; i++) {
		if (userSettings[i].equals("Favoriten")) {
			iceMap.put(i, null);
		}
	}
	
	for (Integer key : iceMap.keySet()) {
		IConfigurationElement ce = iceMap.get(key);
		if (ce == null) {
			new FavoritenCTabItem(ctab, SWT.None);
			continue;
		}
		
		try {
			IDetailDisplay detailDisplay =
				(IDetailDisplay) ce.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_CDD);
			CodeSelectorFactory codeSelector =
				(CodeSelectorFactory) ce.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_CSF);
			String a = ce.getAttribute(ExtensionPointConstantsUi.VERRECHNUNGSCODE_IMPC);
			ImporterPage ip = null;
			if (a != null) {
				ip = (ImporterPage) ce.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_IMPC);
				if (ip != null) {
					importers.put(detailDisplay.getTitle(), ip);
				}
			}
			
			MasterDetailsPage page = new MasterDetailsPage(ctab, codeSelector, detailDisplay);
			CTabItem ct = new CTabItem(ctab, SWT.NONE);
			ct.setText(detailDisplay.getTitle());
			ct.setControl(page);
			ct.setData(detailDisplay);
			
			CoreUiUtil.injectServices(codeSelector);
			CoreUiUtil.injectServices(detailDisplay);
		} catch (Exception ex) {
			LoggerFactory.getLogger(getClass()).error("Error creating pages", ex);
			ElexisStatus status =
				new ElexisStatus(ElexisStatus.WARNING, Hub.PLUGIN_ID, ElexisStatus.CODE_NONE,
					"Fehler beim Initialisieren von " + ce.getName(), ex,
					ElexisStatus.LOG_WARNINGS);
			StatusManager.getManager().handle(status, StatusManager.SHOW);
		}
	}
}
 
Example 12
Source File: LaborView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(final Composite parent){
	setTitleImage(Images.IMG_VIEW_LABORATORY.getImage());
	
	tabFolder = new CTabFolder(parent, SWT.TOP);
	tabFolder.setLayout(new FillLayout());
	
	final CTabItem resultsTabItem = new CTabItem(tabFolder, SWT.NULL);
	resultsTabItem.setText("Resultate");
	resultsComposite = new LaborResultsComposite(tabFolder, SWT.NONE);
	resultsTabItem.setControl(resultsComposite);
	
	final CTabItem ordersTabItem = new CTabItem(tabFolder, SWT.NULL);
	ordersTabItem.setText("Verordnungen");
	ordersComposite = new LaborOrdersComposite(tabFolder, SWT.NONE);
	ordersTabItem.setControl(ordersComposite);
	
	tabFolder.setSelection(0);
	tabFolder.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			resultsComposite.reload();
			ordersComposite.reload();
		}
	});
	makeActions();
	menu = new ViewMenus(getViewSite());
	menu.createMenu(newAction, backAction, fwdAction, printAction, importAction, xmlAction);
	// Orders
	final LaborOrderPulldownMenuCreator menuCreator =
		new LaborOrderPulldownMenuCreator(parent.getShell());
	if (menuCreator.getSelected() != null) {
		IAction dropDownAction = menuCreator.getAction();
		
		IActionBars actionBars = getViewSite().getActionBars();
		IToolBarManager toolbar = actionBars.getToolBarManager();
		
		toolbar.add(dropDownAction);
		
		// Set data
		dropDownAction.setText(menuCreator.getSelected().getText());
		dropDownAction.setToolTipText(menuCreator.getSelected().getToolTipText());
		dropDownAction.setImageDescriptor(menuCreator.getSelected().getImageDescriptor());
	}
	// Importers
	IToolBarManager tm = getViewSite().getActionBars().getToolBarManager();
	List<IAction> importers =
		Extensions.getClasses(
			Extensions.getExtensions(ExtensionPointConstantsUi.LABORDATENIMPORT),
			"ToolbarAction", //$NON-NLS-1$ //$NON-NLS-2$
			false);
	for (IAction ac : importers) {
		tm.add(ac);
	}
	if (importers.size() > 0) {
		tm.add(new Separator());
	}
	tm.add(refreshAction);
	tm.add(newColumnAction);
	tm.add(newAction);
	tm.add(backAction);
	tm.add(fwdAction);
	tm.add(expandAllAction);
	tm.add(collapseAllAction);
	tm.add(printAction);
	
	// register event listeners
	ElexisEventDispatcher.getInstance().addListeners(eeli_labitem, eeli_laborder,
		eeli_labresult, eeli_pat);
	Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
	if ((act != null && act != resultsComposite.getPatient())) {
		resultsComposite.selectPatient(act);
	}
	getSite().getPage().addPartListener(udpateOnVisible);
}
 
Example 13
Source File: TransExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( transExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromTrans( null ); // null = force reload of data on disk
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  TransExecutorParameters parameters = transExecutorMeta.getParameters();
  wTransExecutorParameters =
    new TableView( transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, false, lsModParams, props, false );
  props.setLook( wTransExecutorParameters );
  FormData fdTransExecutors = new FormData();
  fdTransExecutors.left = new FormAttachment( 0, 0 );
  fdTransExecutors.right = new FormAttachment( 100, 0 );
  fdTransExecutors.top = new FormAttachment( 0, 0 );
  fdTransExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wTransExecutorParameters.setLayoutData( fdTransExecutors );
  wTransExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  parameterTableHelper.setParameterTableView( wTransExecutorParameters );
  parameterTableHelper.setUpDisabledListeners();
  // Add disabled listeners to columns
  parameterColumns[0].setDisabledListener( parameterTableHelper.getVarDisabledListener() );
  parameterColumns[1].setDisabledListener( parameterTableHelper.getFieldDisabledListener() );
  parameterColumns[2].setDisabledListener( parameterTableHelper.getInputDisabledListener() );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wTransExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
    // Check disable listeners to shade fields gray
    parameterTableHelper.checkTableOnOpen( tableItem, i );
  }
  wTransExecutorParameters.setRowNums();
  wTransExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.top = new FormAttachment( wTransExecutorParameters, 15 );
  fdInheritAll.left = new FormAttachment( 0, 0 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( transExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}
 
Example 14
Source File: JobExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( jobExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromJob( null ); // null : reload file
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  JobExecutorParameters parameters = jobExecutorMeta.getParameters();
  wJobExecutorParameters =
    new TableView(
      transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, lsModParams, props );
  props.setLook( wJobExecutorParameters );
  FormData fdJobExecutors = new FormData();
  fdJobExecutors.left = new FormAttachment( 0, 0 );
  fdJobExecutors.right = new FormAttachment( 100, 0 );
  fdJobExecutors.top = new FormAttachment( 0, 0 );
  fdJobExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wJobExecutorParameters.setLayoutData( fdJobExecutors );
  wJobExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  parameterTableHelper.setParameterTableView( wJobExecutorParameters );
  parameterTableHelper.setUpDisabledListeners();
  // Add disabled listeners to columns
  parameterColumns[0].setDisabledListener( parameterTableHelper.getVarDisabledListener() );
  parameterColumns[1].setDisabledListener( parameterTableHelper.getFieldDisabledListener() );
  parameterColumns[2].setDisabledListener( parameterTableHelper.getInputDisabledListener() );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wJobExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
    // Check disable listeners to shade fields gray
    parameterTableHelper.checkTableOnOpen( tableItem, i );
  }
  wJobExecutorParameters.setRowNums();
  wJobExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.left = new FormAttachment( 0, 0 );
  fdInheritAll.top = new FormAttachment( wJobExecutorParameters, 15 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( jobExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}
 
Example 15
Source File: TextFileInputDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addFiltersTabs() {
  // Filters tab...
  //
  wFilterTab = new CTabItem( wTabFolder, SWT.NONE );
  wFilterTab.setText( BaseMessages.getString( PKG, "TextFileInputDialog.FilterTab.TabTitle" ) );

  FormLayout FilterLayout = new FormLayout();
  FilterLayout.marginWidth = Const.FORM_MARGIN;
  FilterLayout.marginHeight = Const.FORM_MARGIN;

  wFilterComp = new Composite( wTabFolder, SWT.NONE );
  wFilterComp.setLayout( FilterLayout );
  props.setLook( wFilterComp );

  final int FilterRows = input.getFilter().length;

  ColumnInfo[] colinf =
      new ColumnInfo[] { new ColumnInfo( BaseMessages.getString( PKG,
          "TextFileInputDialog.FilterStringColumn.Column" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), new ColumnInfo(
              BaseMessages.getString( PKG, "TextFileInputDialog.FilterPositionColumn.Column" ),
              ColumnInfo.COLUMN_TYPE_TEXT, false ), new ColumnInfo( BaseMessages.getString( PKG,
                  "TextFileInputDialog.StopOnFilterColumn.Column" ), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO ),
        new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.FilterPositiveColumn.Column" ),
            ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO ) };

  colinf[2].setToolTip( BaseMessages.getString( PKG, "TextFileInputDialog.StopOnFilterColumn.Tooltip" ) );
  colinf[3].setToolTip( BaseMessages.getString( PKG, "TextFileInputDialog.FilterPositiveColumn.Tooltip" ) );

  wFilter = new TableView( transMeta, wFilterComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FilterRows, lsMod, props );

  fdFilter = new FormData();
  fdFilter.left = new FormAttachment( 0, 0 );
  fdFilter.top = new FormAttachment( 0, 0 );
  fdFilter.right = new FormAttachment( 100, 0 );
  fdFilter.bottom = new FormAttachment( 100, 0 );
  wFilter.setLayoutData( fdFilter );

  fdFilterComp = new FormData();
  fdFilterComp.left = new FormAttachment( 0, 0 );
  fdFilterComp.top = new FormAttachment( 0, 0 );
  fdFilterComp.right = new FormAttachment( 100, 0 );
  fdFilterComp.bottom = new FormAttachment( 100, 0 );
  wFilterComp.setLayoutData( fdFilterComp );

  wFilterComp.layout();
  wFilterTab.setControl( wFilterComp );
}
 
Example 16
Source File: UserDefinedJavaClassDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addTargetTab() {
  targetTab = new CTabItem( wTabFolder, SWT.NONE );
  targetTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Target.Title" ) );
  targetTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Target.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  targetTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.TargetTransforms.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int nrRows = input.getTargetTransformDefinitions().size();
  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.TransformTag" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.TransformName" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, nextTransformNames ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.TransformDescription" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wTargetTransforms =
    new TableView(
      pipelineMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, nrRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wTargetTransforms.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );
}
 
Example 17
Source File: JobExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {
  final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
  wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Title" ) );
  wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Tooltip" ) );

  ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
  scrolledComposite.setLayout( new FillLayout() );

  Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
  props.setLook( wInputComposite );

  FormLayout tabLayout = new FormLayout();
  tabLayout.marginWidth = 15;
  tabLayout.marginHeight = 15;
  wInputComposite.setLayout( tabLayout );

  wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFilesTarget );
  wlResultFilesTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFilesTarget.Label" ) );
  FormData fdlResultFilesTarget = new FormData();
  fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
  fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

  wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFilesTarget );
  wResultFilesTarget.addModifyListener( lsMod );
  FormData fdResultFilesTarget = new FormData();
  fdResultFilesTarget.width = 250;
  fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
  fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
  wResultFilesTarget.setLayoutData( fdResultFilesTarget );

  // ResultFileNameField
  //
  wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFileNameField );
  wlResultFileNameField.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFileNameField.Label" ) );
  FormData fdlResultFileNameField = new FormData();
  fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
  fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFileNameField.setLayoutData( fdlResultFileNameField );

  wResultFileNameField = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFileNameField );
  wResultFileNameField.addModifyListener( lsMod );
  FormData fdResultFileNameField = new FormData();
  fdResultFileNameField.width = 250;
  fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
  fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
  wResultFileNameField.setLayoutData( fdResultFileNameField );

  wInputComposite.pack();
  Rectangle bounds = wInputComposite.getBounds();

  scrolledComposite.setContent( wInputComposite );
  scrolledComposite.setExpandHorizontal( true );
  scrolledComposite.setExpandVertical( true );
  scrolledComposite.setMinWidth( bounds.width );
  scrolledComposite.setMinHeight( bounds.height );

  wTab.setControl( scrolledComposite );
  wTabFolder.setSelection( wTab );
}
 
Example 18
Source File: ElasticSearchBulkDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addServersTab() {
  wServersTab = new CTabItem( wTabFolder, SWT.NONE );
  wServersTab.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.ServersTab.TabTitle" ) );

  FormLayout serversLayout = new FormLayout();
  serversLayout.marginWidth = Const.FORM_MARGIN;
  serversLayout.marginHeight = Const.FORM_MARGIN;

  Composite wServersComp = new Composite( wTabFolder, SWT.NONE );
  wServersComp.setLayout( serversLayout );
  props.setLook( wServersComp );

  // Test button
  wTestCl = new Button( wServersComp, SWT.PUSH );
  wTestCl.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestCluster.Label" ) );
  wTestCl.setToolTipText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestCluster.Tooltip" ) );

  wTestCl.addListener( SWT.Selection, new Listener() {

    public void handleEvent( Event arg0 ) {
      test( TestType.CLUSTER );
    }
  } );

  setButtonPositions( new Button[]{wTestCl}, Const.MARGIN, null );

  ColumnInfo[] columnsMeta = new ColumnInfo[2];
  columnsMeta[0] =
          new ColumnInfo( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.ServersTab.Address.Column" ),
                  ColumnInfo.COLUMN_TYPE_TEXT, false );
  columnsMeta[0].setUsingVariables( true );
  columnsMeta[1] =
          new ColumnInfo( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.ServersTab.Port.Column" ),
                  ColumnInfo.COLUMN_TYPE_TEXT, true );

  wServers =
          new TableView( transMeta, wServersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columnsMeta, 1, lsMod,
                  props );
  FormData fdServers = new FormData();
  fdServers.left = new FormAttachment( 0, Const.MARGIN );
  fdServers.top = new FormAttachment( 0, Const.MARGIN );
  fdServers.right = new FormAttachment( 100, -Const.MARGIN );
  fdServers.bottom = new FormAttachment( wTestCl, -Const.MARGIN );
  wServers.setLayoutData( fdServers );

  FormData fdServersComp = new FormData();
  fdServersComp.left = new FormAttachment( 0, 0 );
  fdServersComp.top = new FormAttachment( 0, 0 );
  fdServersComp.right = new FormAttachment( 100, 0 );
  fdServersComp.bottom = new FormAttachment( 100, 0 );
  wServersComp.setLayoutData( fdServersComp );
  wServersComp.layout();
  wServersTab.setControl( wServersComp );
}
 
Example 19
Source File: JmsProducerDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void buildOptionsTab() {
  CTabItem wOptionsTab = new CTabItem( wTabFolder, SWT.NONE );
  wOptionsTab.setText( BaseMessages.getString( PKG, "JmsDialog.Options.Tab" ) );

  Composite wOptionsComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wOptionsComp );
  FormLayout optionsLayout = new FormLayout();
  optionsLayout.marginHeight = 15;
  optionsLayout.marginWidth = 15;
  wOptionsComp.setLayout( optionsLayout );

  FormData fdOptionsComp = new FormData();
  fdOptionsComp.left = new FormAttachment( 0, 0 );
  fdOptionsComp.top = new FormAttachment( 0, 0 );
  fdOptionsComp.right = new FormAttachment( 100, 0 );
  wOptionsComp.setLayoutData( fdOptionsComp );

  ColumnInfo[] columns = getOptionsColumns();

  int fieldCount = 1;

  optionsTable = new TableView(
    transMeta,
    wOptionsComp,
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
    columns,
    fieldCount,
    false,
    lsMod,
    props,
    false
  );

  optionsTable.setSortable( false );
  optionsTable.getTable().addListener( SWT.Resize, event -> {
    Table table = (Table) event.widget;
    table.getColumn( 1 ).setWidth( 215 );
    table.getColumn( 2 ).setWidth( 215 );
  } );

  populateOptionsTable();

  FormData fdData = new FormData();
  fdData.left = new FormAttachment( 0, 0 );
  fdData.top = new FormAttachment( 0, 0 );
  fdData.right = new FormAttachment( 100, 0 );
  fdData.bottom = new FormAttachment( 100, 0 );
  fdData.width = INPUT_WIDTH + 10;

  // resize the columns to fit the data in them
  stream( optionsTable.getTable().getColumns() ).forEach( column -> {
    if ( column.getWidth() > 0 ) {
      // don't pack anything with a 0 width, it will resize it to make it visible (like the index column)
      column.setWidth( 120 );
    }
  } );

  // don't let any rows get deleted or added (this does not affect the read-only state of the cells)
  optionsTable.setReadonly( true );
  optionsTable.setLayoutData( fdData );

  wOptionsComp.layout();
  wOptionsTab.setControl( wOptionsComp );
}
 
Example 20
Source File: TextFileInputDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addFieldsTabs() {
  // Fields tab...
  //
  wFieldsTab = new CTabItem( wTabFolder, SWT.NONE );
  wFieldsTab.setText( BaseMessages.getString( PKG, "TextFileInputDialog.FieldsTab.TabTitle" ) );

  FormLayout fieldsLayout = new FormLayout();
  fieldsLayout.marginWidth = Const.FORM_MARGIN;
  fieldsLayout.marginHeight = Const.FORM_MARGIN;

  wFieldsComp = new Composite( wTabFolder, SWT.NONE );
  wFieldsComp.setLayout( fieldsLayout );
  props.setLook( wFieldsComp );

  wGet = new Button( wFieldsComp, SWT.PUSH );
  wGet.setText( BaseMessages.getString( PKG, "System.Button.GetFields" ) );
  fdGet = new FormData();
  fdGet.left = new FormAttachment( 50, 0 );
  fdGet.bottom = new FormAttachment( 100, 0 );
  wGet.setLayoutData( fdGet );

  wMinWidth = new Button( wFieldsComp, SWT.PUSH );
  wMinWidth.setText( BaseMessages.getString( PKG, "TextFileInputDialog.MinWidth.Button" ) );
  wMinWidth.setToolTipText( BaseMessages.getString( PKG, "TextFileInputDialog.MinWidth.Tooltip" ) );
  wMinWidth.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      input.setChanged();
    }
  } );
  setButtonPositions( new Button[] { wGet, wMinWidth }, margin, null );

  final int FieldsRows = input.getInputFields().length;

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.NameColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.TypeColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.FormatColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_FORMAT, 2 ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.PositionColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.LengthColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.PrecisionColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.CurrencyColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.DecimalColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.GroupColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.NullIfColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.IfNullColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.TrimTypeColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.RepeatColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString( PKG, "System.Combo.Yes" ),
        BaseMessages.getString( PKG, "System.Combo.No" ) }, true ) };

  colinf[ 12 ].setToolTip( BaseMessages.getString( PKG, "TextFileInputDialog.RepeatColumn.Tooltip" ) );

  wFields = new TableView( pipelineMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props );

  fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( 0, 0 );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( wGet, -margin );
  wFields.setLayoutData( fdFields );

  fdFieldsComp = new FormData();
  fdFieldsComp.left = new FormAttachment( 0, 0 );
  fdFieldsComp.top = new FormAttachment( 0, 0 );
  fdFieldsComp.right = new FormAttachment( 100, 0 );
  fdFieldsComp.bottom = new FormAttachment( 100, 0 );
  wFieldsComp.setLayoutData( fdFieldsComp );

  wFieldsComp.layout();
  wFieldsTab.setControl( wFieldsComp );
}