下面列出了org.eclipse.swt.widgets.Text#setVisible ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void createControl(UI_POSITION position, Composite parent) {
// We add controls only to the BOTTOM position.
if (position == UI_POSITION.BOTTOM) {
portLabel = new Label(parent, SWT.NONE);
portLabel.setVisible(false);
portLabel.setText(Messages.getString("NEW_SERVER_DIALOG_PORT"));
portText = new Text(parent, SWT.SINGLE | SWT.BORDER);
portText.setVisible(false);
portText.setText(String.valueOf(LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT));
portText.addVerifyListener(new PortChangeMonitor());
portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
Image errorImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
portDecoration = new ControlDecoration(portText, SWT.LEFT | SWT.TOP);
portDecoration.setDescriptionText(Messages.getString("NEW_SERVER_DIALOG_INVALID_PORT_VALUE"));
portDecoration.setImage(errorImage);
portDecoration.hide();
}
}
public void setVisible(boolean visible, Composite parent) {
Label labelControl = getLabelControl(parent);
Text textControl = getTextControl(parent);
labelControl.setVisible(visible);
textControl.setVisible(visible);
Object layoutData = labelControl.getLayoutData();
if (layoutData instanceof GridData) {
((GridData) layoutData).exclude = !visible;
}
layoutData = textControl.getLayoutData();
if (layoutData instanceof GridData) {
((GridData) layoutData).exclude = !visible;
}
}
public CompositeForCodeTab(final Composite parent, final int style, final Answer answer) {
super(parent, style);
// Non-editable text box containing answer value
final Text txtBoxAnswers = new Text(this, SWT.BORDER);
txtBoxAnswers.setBounds(5, 5, 210, 25);
txtBoxAnswers.setEditable(false);
txtBoxAnswers.setText(answer.getValue());
// Code dependency text field
final Text txtValue = new Text(this, SWT.BORDER);
txtValue.setBounds(220, 5, 200, 25);
txtValue.setVisible(true);
final CodeDependency codeDependency = new CodeDependency();
if (answer.getCodeDependencies() != null) {
for (final CodeDependency cd : answer.getCodeDependencies()) {
if (cd.getValue() != null) {
txtValue.setText(cd.getValue());
codeDependency.setValue(txtValue.getText());
}
}
}
txtValue.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(final FocusEvent e) {
codeDependency.setValue(txtValue.getText());
}
});
final ArrayList<CodeDependency> codeDependencies = new ArrayList<CodeDependency>();
codeDependencies.add(codeDependency);
answer.setCodeDependencies(codeDependencies);
}
@Override
public void initComposite() {
final Text dummy = CompositeFactory.createNumText(dialog, this, "", 50);
dummy.setVisible(false);
createEditTable(this);
}
private void setRowVisibility(int index, Text expression1, Text expression2) {
expression1.setVisible(aggregateOperators[index].getParameterCount() > 0);
if (!expression1.getVisible())
expression1.setText("");
expression2.setVisible(aggregateOperators[index].getParameterCount() > 1);
if (!expression2.getVisible())
expression2.setText("");
}
@Override
public void initComposite() {
GridLayout layout = new GridLayout();
layout.numColumns = 2;
this.setLayout(layout);
Text dummy = CompositeFactory.createNumText(dialog, this, "", 50);
dummy.setVisible(false);
this.createEditTable(this);
}
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
tabFolder = new TabFolder(container, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
TabItem ui_LayoutItem = new TabItem(tabFolder, SWT.NONE);
ui_LayoutItem.setText(Messages.AddFeatureDialog_UI);
TableViewer UIViewer = createTable(tabFolder, ui_LayoutItem);
UIViewer.setInput(getFeatureByType(Messages.AddFeatureDialog_THREE));
TabItem navigationMenuItem = new TabItem(tabFolder, SWT.NONE);
navigationMenuItem.setText(Messages.AddFeatureDialog_VIDEO);
TableViewer videoViewer = createTable(tabFolder, navigationMenuItem);
videoViewer.setInput(getFeatureByType(Messages.AddFeatureDialog_FOUR));
TabItem extendedItem = new TabItem(tabFolder, SWT.NONE);
extendedItem.setText(Messages.AddFeatureDialog_3RD);
TableViewer _3rdItemViewer = createTable(tabFolder, extendedItem);
_3rdItemViewer.setInput(getFeatureByType(Messages.AddFeatureDialog_FIVE));
TabItem open_sdk_Item = new TabItem(tabFolder, SWT.NONE);
open_sdk_Item.setText(Messages.AddFeatureDialog_CUSTOM);
TableViewer customViewer = createTable(tabFolder, open_sdk_Item);
customViewer.setInput(getFeatureByType(Messages.AddFeatureDialog_EIGHT));
TabItem deviceAccessItem = new TabItem(tabFolder, SWT.NONE);
deviceAccessItem.setText(Messages.AddFeatureDialog_INTERACTION);
TableViewer InteractionViewer = createTable(tabFolder, deviceAccessItem);
InteractionViewer.setInput(getFeatureByType(Messages.AddFeatureDialog_TWO));
TabItem cloud_ServerItem = new TabItem(tabFolder, SWT.NONE);
cloud_ServerItem.setText(Messages.AddFeatureDialog_CLOUDSERVER);
TableViewer cloud_ServerViewer = createTable(tabFolder, cloud_ServerItem);
cloud_ServerViewer.setInput(getFeatureByType(Messages.AddFeatureDialog_NINE));
Composite composite = new Composite(container, SWT.NONE);
composite.setLayout(new GridLayout(4, false));
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
lblParamkey = new Label(composite, SWT.NONE);
lblParamkey.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblParamkey.setText(" urlScheme");
lblParamkey.setVisible(false);
text_urlScheme = new Text(composite, SWT.BORDER);
text_urlScheme.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
text_urlScheme.setVisible(false);
lblParamvalue = new Label(composite, SWT.NONE);
lblParamvalue.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblParamvalue.setText(" apiKey");
lblParamvalue.setVisible(false);
text_apiKey = new Text(composite, SWT.BORDER);
text_apiKey.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
text_apiKey.setVisible(false);
return container;
}
public JobHistoryLogTab( CTabFolder tabFolder, LogTableInterface logTable ) {
super( tabFolder, SWT.NONE );
setLogTable( logTable );
setText( logTable.getLogTableType() );
Composite logTableComposite = new Composite( tabFolder, SWT.NONE );
logTableComposite.setLayout( new FormLayout() );
spoon.props.setLook( logTableComposite );
setControl( logTableComposite );
SashForm sash = new SashForm( logTableComposite, SWT.VERTICAL );
sash.setLayout( new FillLayout() );
FormData fdSash = new FormData();
fdSash.left = new FormAttachment( 0, 0 ); // First one in the left top corner
fdSash.top = new FormAttachment( 0, 0 );
fdSash.right = new FormAttachment( 100, 0 );
fdSash.bottom = new FormAttachment( 100, 0 );
sash.setLayoutData( fdSash );
logDisplayTableView = createJobLogTableView( sash );
if ( logTable.getLogField() != null ) {
logDisplayText = new Text( sash, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY );
spoon.props.setLook( logDisplayText );
logDisplayText.setVisible( true );
FormData fdText = new FormData();
fdText.left = new FormAttachment( 0, 0 );
fdText.top = new FormAttachment( 0, 0 );
fdText.right = new FormAttachment( 100, 0 );
fdText.bottom = new FormAttachment( 100, 0 );
logDisplayText.setLayoutData( fdText );
sash.setWeights( new int[] { 70, 30, } );
} else {
logDisplayText = null;
sash.setWeights( new int[] { 100, } );
}
}
public TransHistoryLogTab( CTabFolder tabFolder, LogTableInterface logTable ) {
super( tabFolder, SWT.NONE );
setLogTable( logTable );
setText( logTable.getLogTableType() );
Composite logTableComposite = new Composite( tabFolder, SWT.NONE );
logTableComposite.setLayout( new FormLayout() );
spoon.props.setLook( logTableComposite );
setControl( logTableComposite );
SashForm sash = new SashForm( logTableComposite, SWT.VERTICAL );
sash.setLayout( new FillLayout() );
FormData fdSash = new FormData();
fdSash.left = new FormAttachment( 0, 0 ); // First one in the left top corner
fdSash.top = new FormAttachment( 0, 0 );
fdSash.right = new FormAttachment( 100, 0 );
fdSash.bottom = new FormAttachment( 100, 0 );
sash.setLayoutData( fdSash );
logDisplayTableView = createTransLogTableView( sash );
if ( logTable.getLogField() != null ) {
logDisplayText = new Text( sash, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY );
spoon.props.setLook( logDisplayText );
logDisplayText.setVisible( true );
FormData fdText = new FormData();
fdText.left = new FormAttachment( 0, 0 );
fdText.top = new FormAttachment( 0, 0 );
fdText.right = new FormAttachment( 100, 0 );
fdText.bottom = new FormAttachment( 100, 0 );
logDisplayText.setLayoutData( fdText );
sash.setWeights( new int[] { 70, 30, } );
} else {
logDisplayText = null;
sash.setWeights( new int[] { 100, } );
}
}