@Override protected Control addAdditionalComponentIfNeed( int middle, int margin, Composite wFileComp, Composite topComp ) { // Run this as a command instead? wlFileIsCommand = new Label( wFileComp, SWT.RIGHT ); wlFileIsCommand .setText( BaseMessages.getString( textFileOutputLegacyMetaClass, "TextFileOutputLegacyDialog.FileIsCommand.Label" ) ); props.setLook( wlFileIsCommand ); fdlFileIsCommand = new FormData(); fdlFileIsCommand.left = new FormAttachment( 0, 0 ); fdlFileIsCommand.top = new FormAttachment( topComp, margin ); fdlFileIsCommand.right = new FormAttachment( middle, -margin ); wlFileIsCommand.setLayoutData( fdlFileIsCommand ); wFileIsCommand = new Button( wFileComp, SWT.CHECK ); props.setLook( wFileIsCommand ); fdFileIsCommand = new FormData(); fdFileIsCommand.left = new FormAttachment( middle, 0 ); fdFileIsCommand.top = new FormAttachment( topComp, margin ); fdFileIsCommand.right = new FormAttachment( 100, 0 ); wFileIsCommand.setLayoutData( fdFileIsCommand ); wFileIsCommand.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { input.setChanged(); enableParentFolder(); } } ); return wlFileIsCommand; }
wlDesc = new Label( shell, SWT.NONE ); wlDesc.setText( message ); props.setLook( wlDesc ); fdlDesc = new FormData(); fdlDesc.left = new FormAttachment( 0, 0 ); fdlDesc.top = new FormAttachment( 0, margin ); wlDesc.setLayoutData( fdlDesc ); wDesc = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.PASSWORD ); wDesc.setText( "" ); props.setLook( wDesc ); fdDesc = new FormData(); fdDesc.left = new FormAttachment( 0, 0 ); fdDesc.top = new FormAttachment( wlDesc, margin ); fdDesc.right = new FormAttachment( 100, 0 ); fdDesc.bottom = new FormAttachment( 100, -50 ); wDesc.setLayoutData( fdDesc ); fdOK.left = new FormAttachment( 33, 0 ); fdOK.bottom = new FormAttachment( 100, 0 ); fdCancel.left = new FormAttachment( 66, 0 ); fdCancel.bottom = new FormAttachment( 100, 0 ); fdOK.left = new FormAttachment( 50, 0 ); fdOK.bottom = new FormAttachment( 100, 0 ); if ( !display.readAndDispatch() ) { display.sleep();
searchText = new Text( sShell, SWT.SINGLE | SWT.BORDER ); FormData frmData = new FormData(); frmData.left = new FormAttachment( 0, 70 ); frmData.top = new FormAttachment( 12, 0 ); frmData.width = 178; searchText.setLayoutData( frmData ); Label lblFind = new Label( sShell, SWT.LEFT ); lblFind.setText( BaseMessages.getString( PKG, "Widget.Styled.Comp.Find.Title" ) ); frmData = new FormData(); frmData.right = new FormAttachment( searchText, -8 ); frmData.top = new FormAttachment( 12, 0 ); lblFind.setLayoutData( frmData ); btnNext = new Button( sShell, SWT.PUSH ); btnNext.setText( BaseMessages.getString( PKG, "Widget.Styled.Comp.FindNext" ) ); btnNext.setEnabled( false ); frmData = new FormData(); frmData.left = new FormAttachment( searchText, 7 ); frmData.width = 81; frmData.height = 23; frmData.top = new FormAttachment( 9, 0 ); frmData.left = new FormAttachment( searchText, 7 ); frmData.width = 81; frmData.height = 23; frmData.top = new FormAttachment( btnNext, 6 ); frmData.left = new FormAttachment( 5, 0 );
formLayout.marginHeight = 15; shell.setLayout( formLayout ); Image image = display.getSystemImage( SWT.ICON_WARNING ); Label wIcon = new Label( shell, SWT.NONE ); props.setLook( wIcon ); wIcon.setImage( image ); FormData fdIcon = new FormData(); fdIcon.left = new FormAttachment( 0, 0 ); fdIcon.top = new FormAttachment( 0, 0 ); fdIcon.right = new FormAttachment( 0, image.getBounds().width ); fdIcon.bottom = new FormAttachment( 0, image.getBounds().height ); wIcon.setLayoutData( fdIcon ); fdcMessage.left = new FormAttachment( wIcon, 15 ); fdcMessage.top = new FormAttachment( 0 ); fdcMessage.right = new FormAttachment( 100 ); wcMessage.setLayoutData( fdcMessage ); FormData fdlNo = new FormData(); fdlNo.width = 70; fdlNo.top = new FormAttachment( wcMessage, 30 ); fdlNo.right = new FormAttachment( 100 ); fdlYes.top = new FormAttachment( wcMessage, 30 ); fdlYes.right = new FormAttachment( wbNo, -10 );
public void open() { display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); formLayout.marginHeight = Const.FORM_MARGIN; shell.setText( BaseMessages.getString( PKG, "RepositoryImportDialog.Title" ) ); wLabel = new Label( shell, SWT.LEFT ); props.setLook( wLabel ); fdLabel.left = new FormAttachment( 0, 0 ); fdLabel.top = new FormAttachment( 0, 0 ); fdLabel.right = new FormAttachment( 100, 0 ); wLabel.setLayoutData( fdLabel ); wClose = new Button( shell, SWT.PUSH ); wClose.setText( BaseMessages.getString( PKG, "System.Button.Close" ) ); wClose.setEnabled( false ); fdLogging.left = new FormAttachment( 0, 0 ); fdLogging.top = new FormAttachment( wLabel, Const.MARGIN ); fdLogging.right = new FormAttachment( 100, 0 ); fdLogging.bottom = new FormAttachment( wClose, -Const.MARGIN ); wLogging.setLayoutData( fdLogging );
props.setLook( shell ); Label wlImage = new Label( shell, SWT.NONE ); wlImage.setImage( GUIResource.getInstance().getImageWarning32() ); FormData fdWarnImage = new FormData(); fdWarnImage.left = new FormAttachment( 0, 15 ); fdWarnImage.top = new FormAttachment( 0, 15 ); fdWarnImage.height = 32; fdWarnImage.width = 32; wlImage.setLayoutData( fdWarnImage ); props.setLook( wlImage ); fdMessage.left = new FormAttachment( wlImage, 15, SWT.RIGHT ); fdMessage.right = new FormAttachment( 100, -15 ); fdMessage.top = new FormAttachment( wlImage, 0, SWT.TOP ); Button spacer = new Button( shell, SWT.NONE ); FormData fdSpacer = new FormData(); fdSpacer.right = new FormAttachment( 100, 0 ); fdSpacer.bottom = new FormAttachment( 100, -15 ); fdSpacer.left = new FormAttachment( 100, -11 ); fdSpacer.top = new FormAttachment( wlMessage, 15, SWT.BOTTOM ); spacer.setLayoutData( fdSpacer ); spacer.setVisible( false ); props.setLook( spacer ); fdButton.right = new FormAttachment( attachTo, -Const.MARGIN, SWT.LEFT ); fdButton.bottom = new FormAttachment( attachTo, 0, SWT.BOTTOM );
private void placeControl( Shell pShell, String text, Control control, Control under ) { int middle = props.getMiddlePct(); int margin = Const.MARGIN; Label label = new Label( pShell, SWT.RIGHT ); label.setText( text ); props.setLook( label ); FormData formDataLabel = new FormData(); formDataLabel.left = new FormAttachment( 0, 0 ); if ( under != null ) { formDataLabel.top = new FormAttachment( under, margin ); } else { formDataLabel.top = new FormAttachment( 0, 0 ); } formDataLabel.right = new FormAttachment( middle, 0 ); label.setLayoutData( formDataLabel ); props.setLook( control ); FormData formDataControl = new FormData(); formDataControl.left = new FormAttachment( middle, 0 ); if ( under != null ) { formDataControl.top = new FormAttachment( under, margin ); } else { formDataControl.top = new FormAttachment( 0, 0 ); } formDataControl.right = new FormAttachment( 100, 0 ); control.setLayoutData( formDataControl ); }
private Text createLine( ModifyListener lsMod, String lableText, Control prevControl ) { // Value line Label lable = new Label( shell, SWT.RIGHT ); lable.setText( lableText ); props.setLook( lable ); FormData lableFormData = new FormData(); lableFormData.left = new FormAttachment( 0, 0 ); lableFormData.right = new FormAttachment( props.getMiddlePct(), -Const.MARGIN ); // In case it is the first control if ( prevControl != null ) { lableFormData.top = new FormAttachment( prevControl, Const.MARGIN ); } else { lableFormData.top = new FormAttachment( 0, Const.MARGIN ); } lable.setLayoutData( lableFormData ); Text control = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( control ); control.addModifyListener( lsMod ); FormData widgetFormData = new FormData(); widgetFormData.left = new FormAttachment( props.getMiddlePct(), 0 ); // In case it is the first control if ( prevControl != null ) { widgetFormData.top = new FormAttachment( prevControl, Const.MARGIN ); } else { widgetFormData.top = new FormAttachment( 0, Const.MARGIN ); } widgetFormData.right = new FormAttachment( 100, 0 ); control.setLayoutData( widgetFormData ); return control; }
Label label = new Label( perfComposite, SWT.CENTER ); label.setText( BaseMessages.getString( PKG, "TransLog.Dialog.PerformanceMonitoringNotEnabled.Message" ) ); label.setBackground( perfComposite.getBackground() ); label.setFont( GUIResource.getInstance().getFontMedium() ); fdLabel.left = new FormAttachment( 5, 0 ); fdLabel.right = new FormAttachment( 95, 0 ); fdLabel.top = new FormAttachment( 5, 0 ); label.setLayoutData( fdLabel ); Button button = new Button( perfComposite, SWT.CENTER ); button.setText( BaseMessages.getString( PKG, "TransLog.Dialog.PerformanceMonitoring.Button" ) ); button.setBackground( perfComposite.getBackground() ); button.setFont( GUIResource.getInstance().getFontMedium() ); fdButton.left = new FormAttachment( 40, 0 ); fdButton.right = new FormAttachment( 60, 0 ); fdButton.top = new FormAttachment( label, 5 ); button.setLayoutData( fdButton );
public Condition open() { Shell parent = getParent(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); shell.setText( BaseMessages.getString( PKG, "EnterConditionDialog.Title" ) ); shell.setImage( GUIResource.getInstance().getImageLogoSmall() ); wOK = new Button( shell, SWT.PUSH ); wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); wCancel = new Button( shell, SWT.PUSH ); wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) ); fdCond.left = new FormAttachment( 0, 0 ); // To the right of the label fdCond.top = new FormAttachment( 0, 0 ); fdCond.right = new FormAttachment( 100, 0 ); fdCond.bottom = new FormAttachment( 100, -50 ); wCond.setLayoutData( fdCond ); Display display = parent.getDisplay(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
public LabelText( Composite composite, int textStyle, String labelText, String toolTipText, int middle, int margin ) { super( composite, SWT.NONE ); props.setLook( this ); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = 0; formLayout.marginHeight = 0; this.setLayout( formLayout ); wText = new Text( this, textStyle ); FormData fdText = new FormData(); fdText.left = new FormAttachment( middle, margin ); fdText.right = new FormAttachment( 100, 0 ); wText.setLayoutData( fdText ); wText.setToolTipText( toolTipText ); wLabel = new Label( this, SWT.RIGHT ); props.setLook( wLabel ); wLabel.setText( labelText ); FormData fdLabel = new FormData(); fdLabel.left = new FormAttachment( 0, 0 ); fdLabel.right = new FormAttachment( middle, 0 ); fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER ); wLabel.setLayoutData( fdLabel ); wLabel.setToolTipText( toolTipText ); }
this.setLayout( formLayout ); Button button = new Button( this, SWT.PUSH ); PropsUI.getInstance().setLook( button ); button.setText( "..." ); FormData fdButton = new FormData(); fdButton.top = new FormAttachment( 0, 0 ); fdButton.right = new FormAttachment( 100, 0 ); fdButton.height = 25; fdButton.width = 30; button.setLayoutData( fdButton ); if ( selectionListener != null ) { button.addSelectionListener( selectionListener ); wText = new Text( this, flags ); controlDecoration = new ControlDecoration( wText, SWT.CENTER | SWT.RIGHT, this ); Image image = GUIResource.getInstance().getImageVariable(); wText.addModifyListener( modifyListenerTooltipText ); wText.addKeyListener( controlSpaceKeyAdapter ); fdText.top = new FormAttachment( 0, 0 ); fdText.left = new FormAttachment( 0, 0 ); fdText.right = new FormAttachment( button, -image.getBounds().width ); wText.setLayoutData( fdText );
for ( JmsProvider.ConnectionType type : JmsProvider.ConnectionType.values() ) { Button connectionButton = new Button( wConnectionGroup, SWT.RADIO ); connectionButton.setText( type.toString() ); fdbConnType.left = new FormAttachment( 0, 0 ); if ( previous == null ) { fdbConnType.top = new FormAttachment( 0, 0 ); } else { fdbConnType.top = new FormAttachment( previous, 10 ); connectionButton.setLayoutData( fdbConnType ); connectionButton.addSelectionListener( new SelectionListener() { Label environmentSeparator = new Label( wConnectionGroup, SWT.SEPARATOR | SWT.VERTICAL ); fdenvironmentSeparator.top = new FormAttachment( 0, 0 ); fdenvironmentSeparator.left = new FormAttachment( widestWidget, 15 ); fdenvironmentSeparator.bottom = new FormAttachment( 100, 0 ); environmentSeparator.setLayoutData( fdenvironmentSeparator );
protected Button createSettingsButton( Composite p, String text, String title, Control top, SelectionAdapter sa ) { Button button = new Button( p, SWT.CHECK ); button.setText( BaseMessages.getString( PKG, text ) ); button.setToolTipText( BaseMessages.getString( PKG, title ) ); props.setLook( button ); FormData fd = new FormData(); fd.left = new FormAttachment( 0, Const.MARGIN * 2 ); if ( top == null ) { fd.top = new FormAttachment( 0, 10 ); } else { fd.top = new FormAttachment( top, 5 ); } fd.right = new FormAttachment( 100, 0 ); button.setLayoutData( fd ); button.addSelectionListener( sa ); return button; }
private void setWarningText( String message, int maxTextWidth ) { description = new Text( shell, SWT.MULTI | SWT.LEFT | SWT.WRAP | SWT.NO_FOCUS | SWT.HIDE_SELECTION ); description.setText( message ); description.setEditable( false ); FormData fdlDesc = new FormData(); fdlDesc.left = new FormAttachment( warningIcon, margin ); // Text should be right of the icon and at the top fdlDesc.top = new FormAttachment( 0, 0 ); fdlDesc.width = maxTextWidth; description.setLayoutData( fdlDesc ); props.setLook( description ); }
private static Button newButton( final Composite parent ) { Button button = new Button( parent, SWT.PUSH ); button.setImage( GUIResource.getInstance().getImageHelpWeb() ); button.setText( BaseMessages.getString( PKG, "System.Button.Help" ) ); button.setToolTipText( BaseMessages.getString( PKG, "System.Tooltip.Help" ) ); FormData fdButton = new FormData(); fdButton.left = new FormAttachment( 0, 0 ); fdButton.bottom = new FormAttachment( 100, 0 ); button.setLayoutData( fdButton ); return button; }
private void setCloseButton() { closeButton = new Button( shell, SWT.PUSH ); closeButton.setText( BaseMessages.getString( PKG, "System.Button.Close" ) ); FormData fdbutton = new FormData(); fdbutton.right = new FormAttachment( 100, 0 ); //Button should below the link and separated by 30 fdbutton.top = new FormAttachment( link, padding ); fdbutton.height = padding; closeButton.setLayoutData( fdbutton ); props.setLook( closeButton ); // Add listeners closeButton.addListener( SWT.Selection, new Listener() { public void handleEvent( Event e ) { close(); } } ); }
/** * @param factory * factory to use. */ protected void buildLogFileLine( final PluginWidgetFactory factory ) { final Control topControl = this.wFastLoadPath; this.wlLogFile = factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.LogFile.Label" ) ); this.props.setLook( this.wlLogFile ); this.wlLogFile.setLayoutData( factory.createLabelLayoutData( topControl ) ); this.wbLogFile = factory.createPushButton( BaseMessages.getString( PKG, "TeraFastDialog.Browse.Button" ) ); this.props.setLook( this.wbLogFile ); FormData formData = factory.createControlLayoutData( topControl ); formData.left = null; this.wbLogFile.setLayoutData( formData ); this.wLogFile = factory.createSingleTextVarLeft(); this.props.setLook( this.wLogFile ); formData = factory.createControlLayoutData( topControl ); formData.right = new FormAttachment( this.wbLogFile, -factory.getMargin() ); this.wLogFile.setLayoutData( formData ); }
private void setWarningIcon( Display display ) { warningIcon = new Label( shell, SWT.NONE ); Image image = display.getSystemImage( SWT.ICON_WARNING ); warningIcon.setImage( image ); props.setLook( warningIcon ); FormData fdIcon = new FormData(); fdIcon.left = new FormAttachment( 0, 0 ); fdIcon.top = new FormAttachment( 0, 0 ); fdIcon.right = new FormAttachment( 0, image.getBounds().width ); fdIcon.bottom = new FormAttachment( 0, image.getBounds().height ); //icon should be at the top left corner warningIcon.setLayoutData( fdIcon ); }
wTest = new Button( wIndexGroup, SWT.PUSH ); wTest.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestIndex.Label" ) ); wTest.setToolTipText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestIndex.Tooltip" ) ); wTest.addListener( SWT.Selection, new Listener() { fdIndexGroup.left = new FormAttachment( 0, Const.MARGIN ); fdIndexGroup.top = new FormAttachment( wStepname, Const.MARGIN ); fdIndexGroup.right = new FormAttachment( 100, -Const.MARGIN ); wIndexGroup.setLayoutData( fdIndexGroup );