本文整理了Java中org.eclipse.swt.widgets.Button.getStyle()
方法的一些代码示例,展示了Button.getStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getStyle()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Button
类名称:Button
方法名:getStyle
暂无
代码示例来源:origin: pentaho/pentaho-kettle
if ( control instanceof Button ) {
Button b = (Button) control;
if ( ( b.getStyle() & SWT.PUSH ) != 0 ) {
return;
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
private static ButtonDelegateLCA getLCADelegate( final Widget widget ) {
ButtonDelegateLCA result;
int style = ( ( Button )widget ).getStyle();
if( ( style & SWT.CHECK ) != 0 ) {
result = CHECK;
} else if( ( style & SWT.PUSH ) != 0 ) {
result = PUSH;
} else if( ( style & SWT.RADIO ) != 0 ) {
result = RADIO;
} else {
result = PUSH;
}
return result;
}
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks.ui
protected void setWidgetValue(String propertyName, int flag, Button button) {
if ((button.getStyle() & SWT.CHECK) == SWT.CHECK || (button.getStyle() & SWT.RADIO) == SWT.RADIO) {
boolean checked = dataModel.getBooleanProperty(propertyName);
if (button.getSelection() != checked) {
button.setSelection(checked);
}
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public Size getCheckSize( Button button ) {
if( ( button.getStyle() & SWT.RADIO ) != 0) {
return getCssImageSize( "Button-RadioIcon", "background-image", button );
}
if( ( button.getStyle() & SWT.CHECK ) != 0) {
return getCssImageSize( "Button-CheckIcon", "background-image", button );
}
return ZERO;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public Size getArrowSize( Button button ) {
if( ( button.getStyle() & SWT.ARROW ) != 0) {
return getCssImageSize( "Button-ArrowIcon", "background-image", button );
}
return ZERO;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Sets the state of the "Example" widgets.
*/
@Override
void setExampleWidgetState () {
super.setExampleWidgetState ();
if (arrowButton.getSelection ()) {
upButton.setEnabled (true);
centerButton.setEnabled (false);
downButton.setEnabled (true);
} else {
upButton.setEnabled (false);
centerButton.setEnabled (true);
downButton.setEnabled (false);
}
upButton.setSelection ((button1.getStyle () & SWT.UP) != 0);
downButton.setSelection ((button1.getStyle () & SWT.DOWN) != 0);
pushButton.setSelection ((button1.getStyle () & SWT.PUSH) != 0);
checkButton.setSelection ((button1.getStyle () & SWT.CHECK) != 0);
radioButton.setSelection ((button1.getStyle () & SWT.RADIO) != 0);
toggleButton.setSelection ((button1.getStyle () & SWT.TOGGLE) != 0);
arrowButton.setSelection ((button1.getStyle () & SWT.ARROW) != 0);
flatButton.setSelection ((button1.getStyle () & SWT.FLAT) != 0);
wrapButton.setSelection ((button1.getStyle () & SWT.WRAP) != 0);
borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public void handleNotifySelection( Button button, JsonObject properties ) {
Event event = createSelectionEvent( SWT.Selection, properties );
if( ( button.getStyle() & SWT.RADIO ) != 0 && !button.getSelection() ) {
event.time = -1;
}
button.notifyListeners( SWT.Selection, event );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
public static void writeWrap( Button button ) throws IOException {
boolean wrap = ( button.getStyle() & SWT.WRAP ) != 0;
if( wrap ) {
JSWriter writer = JSWriter.getWriterFor( button );
writer.set( "wrap", new Boolean( true ) );
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor
/**
* Attaches the given layout specification to the <code>component</code>.
*
* @param component the component
* @param horizontalAlignment horizontal alignment
* @param grabExcessHorizontalSpace grab excess horizontal space
* @param verticalAlignment vertical alignment
* @param grabExcessVerticalSpace grab excess vertical space
*/
private void setGridData(Control component, int horizontalAlignment, boolean grabExcessHorizontalSpace, int verticalAlignment, boolean grabExcessVerticalSpace) {
GridData gd;
if (component instanceof Button && (((Button)component).getStyle() & SWT.PUSH) != 0) {
SWTUtil.setButtonDimensionHint((Button)component);
gd= (GridData)component.getLayoutData();
} else {
gd= new GridData();
component.setLayoutData(gd);
gd.horizontalAlignment= horizontalAlignment;
gd.grabExcessHorizontalSpace= grabExcessHorizontalSpace;
}
gd.verticalAlignment= verticalAlignment;
gd.grabExcessVerticalSpace= grabExcessVerticalSpace;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor
/**
* Attaches the given layout specification to the <code>component</code>.
*
* @param component the component
* @param horizontalAlignment horizontal alignment
* @param grabExcessHorizontalSpace grab excess horizontal space
* @param verticalAlignment vertical alignment
* @param grabExcessVerticalSpace grab excess vertical space
*/
private void setGridData(Control component, int horizontalAlignment, boolean grabExcessHorizontalSpace, int verticalAlignment, boolean grabExcessVerticalSpace) {
GridData gd;
if (component instanceof Button && (((Button)component).getStyle() & SWT.PUSH) != 0) {
SWTUtil.setButtonDimensionHint((Button)component);
gd= (GridData)component.getLayoutData();
} else {
gd= new GridData();
component.setLayoutData(gd);
gd.horizontalAlignment= horizontalAlignment;
gd.grabExcessHorizontalSpace= grabExcessHorizontalSpace;
}
gd.verticalAlignment= verticalAlignment;
gd.grabExcessVerticalSpace= grabExcessVerticalSpace;
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent (Event event) {
Control [] children = gRadio.getChildren ();
for (int j=0; j<children.length; j++) {
Control child = children [j];
if (child instanceof Button) {
Button button = (Button) child;
if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
}
}
Button button = (Button) event.widget;
button.setSelection (true);
int mode = Integer.parseInt((String)button.getData("iMode"));
selected_button[0] = button;
setModeText.run();
//linkLabel.setText( MessageText.getString(messTexts[mode]) );
linkLabel.setData( links[mode] );
/*
if(mode == 1){
linkLabel1.setText( MessageText.getString(messTexts[3]) );
linkLabel1.setData( links[3] );
} else{
linkLabel1.setText( "" );
linkLabel1.setData( "" );
}
*/
COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode")));
}
};
代码示例来源:origin: org.eclipse/org.eclipse.ui.workbench.texteditor
/**
* Attaches the given layout specification to the <code>component</code>.
*
* @param component the component
* @param horizontalAlignment horizontal alignment
* @param grabExcessHorizontalSpace grab excess horizontal space
* @param verticalAlignment vertical alignment
* @param grabExcessVerticalSpace grab excess vertical space
*/
private void setGridData(Control component, int horizontalAlignment, boolean grabExcessHorizontalSpace, int verticalAlignment, boolean grabExcessVerticalSpace) {
GridData gd;
if (component instanceof Button && (((Button)component).getStyle() & SWT.PUSH) != 0) {
SWTUtil.setButtonDimensionHint((Button)component);
gd= (GridData)component.getLayoutData();
} else {
gd= new GridData();
component.setLayoutData(gd);
gd.horizontalAlignment= horizontalAlignment;
gd.grabExcessHorizontalSpace= grabExcessHorizontalSpace;
}
gd.verticalAlignment= verticalAlignment;
gd.grabExcessVerticalSpace= grabExcessVerticalSpace;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
static void writeAlignment( final Button button ) throws IOException {
if( ( button.getStyle() & SWT.ARROW ) == 0 ) {
Integer newValue = new Integer( button.getAlignment() );
Integer defValue = DEFAULT_ALIGNMENT;
if( WidgetLCAUtil.hasChanged( button, PROP_ALIGNMENT, newValue, defValue ) )
{
JSWriter writer = JSWriter.getWriterFor( button );
String value;
switch( newValue.intValue() ) {
case SWT.LEFT:
value = "left";
break;
case SWT.CENTER:
value = "center";
break;
case SWT.RIGHT:
value = "right";
break;
default:
value = "left";
break;
}
writer.set( JS_PROP_HORIZONTAL_CHILDREN_ALIGN, value );
}
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
static void writeText( final Button button ) throws IOException {
JSWriter writer = JSWriter.getWriterFor( button );
String text = button.getText();
if( WidgetLCAUtil.hasChanged( button, Props.TEXT, text, null ) ) {
text = WidgetLCAUtil.escapeText( text, true );
if( ( button.getStyle() & SWT.WRAP ) != 0 ) {
text = WidgetLCAUtil.replaceNewLines( text, "<br/>" );
}
writer.set( "text", text.equals( "" ) ? null : text );
}
}
代码示例来源:origin: org.eclipse.e4.ui.css/swt
protected String computeAttributeType() {
Widget widget = getWidget();
if (widget instanceof Button) {
Button button = (Button) widget;
int style = button.getStyle();
if ((style | SWT.RADIO) == style)
return "radio";
if ((style | SWT.CHECK) == style)
return "checkbox";
return "button";
}
if (widget instanceof Text) {
Text text = (Text) widget;
if ((text.getStyle() & SWT.PASSWORD) != 0)
return "password";
else if ((text.getStyle() & SWT.MULTI) != 0)
return "";
else
return "text";
}
return "";
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent (Event event) {
Control [] children = gRadio.getChildren ();
for (int j=0; j<children.length; j++) {
Control child = children [j];
if (child instanceof Button) {
Button button = (Button) child;
if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
}
}
Button button = (Button) event.widget;
button.setSelection (true);
int mode = Integer.parseInt((String)button.getData("iMode"));
text[0] = MessageText.getString("ConfigView.section.mode." + (String)button.getData("sMode"));
labl.setText(text[0]);
linkLabel.setText( MessageText.getString(messTexts[mode]) );
linkLabel.setData( links[mode] );
if(mode == 1){
linkLabel1.setText( MessageText.getString(messTexts[3]) );
linkLabel1.setData( links[3] );
} else{
linkLabel1.setText( "" );
linkLabel1.setData( "" );
}
COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode")));
}
};
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
protected String computeAttributeType() {
Widget widget = getWidget();
if (widget instanceof Button) {
Button button = (Button) widget;
int style = button.getStyle();
if ((style | SWT.RADIO) == style) {
return "radio";
}
if ((style | SWT.CHECK) == style) {
return "checkbox";
}
return "button";
}
if (widget instanceof Text) {
Text text = (Text) widget;
if ((text.getStyle() & SWT.PASSWORD) != 0) {
return "password";
} else if ((text.getStyle() & SWT.MULTI) != 0) {
return "";
} else {
return "text";
}
}
return "";
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor
if (fMnemonicButtonMap.containsKey(mnemonic)) {
Button button= fMnemonicButtonMap.get(mnemonic);
if ((fFindField.isFocusControl() || fReplaceField.isFocusControl() || (button.getStyle() & SWT.PUSH) != 0)
&& button.isEnabled()) {
Event event= new Event();
event.type= SWT.Selection;
event.stateMask= e.stateMask;
if ((button.getStyle() & SWT.RADIO) != 0) {
Composite buttonParent= button.getParent();
if (buttonParent != null) {
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
void renderInitialization( final Button button ) throws IOException {
JSWriter writer = JSWriter.getWriterFor( button );
boolean isToggle = ( button.getStyle() & SWT.TOGGLE ) != 0;
Object[] args = isToggle ? PARAM_TOGGLE : PARAM_PUSH;
writer.newWidget( QX_TYPE, args );
ControlLCAUtil.writeStyleFlags( button );
WidgetLCAUtil.writeStyleFlag( button, SWT.PUSH, "PUSH" );
WidgetLCAUtil.writeStyleFlag( button, SWT.FLAT, "FLAT" );
WidgetLCAUtil.writeStyleFlag( button, SWT.TOGGLE, "TOGGLE" );
ButtonLCAUtil.writeWrap( button );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
if( ( button.getStyle() & SWT.PUSH ) == 0 ) {
return;
内容来源于网络,如有侵权,请联系作者删除!