本文整理了Java中org.eclipse.swt.widgets.DateTime.getStyle()
方法的一些代码示例,展示了DateTime.getStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.getStyle()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.DateTime
类名称:DateTime
方法名:getStyle
暂无
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Sets the state of the "Example" widgets.
*/
@Override
void setExampleWidgetState () {
super.setExampleWidgetState ();
dateButton.setSelection ((dateTime1.getStyle () & SWT.DATE) != 0);
timeButton.setSelection ((dateTime1.getStyle () & SWT.TIME) != 0);
calendarButton.setSelection ((dateTime1.getStyle () & SWT.CALENDAR) != 0);
shortButton.setSelection ((dateTime1.getStyle () & SWT.SHORT) != 0);
mediumButton.setSelection ((dateTime1.getStyle () & SWT.MEDIUM) != 0);
longButton.setSelection ((dateTime1.getStyle () & SWT.LONG) != 0);
if ((dateTime1.getStyle() & SWT.DATE) != 0) {
dropDownButton.setEnabled(true);
dropDownButton.setSelection ((dateTime1.getStyle () & SWT.DROP_DOWN) != 0);
} else {
dropDownButton.setSelection(false);
dropDownButton.setEnabled(false);
}
if ((dateTime1.getStyle() & SWT.CALENDAR) != 0 || (dateTime1.getStyle() & SWT.DROP_DOWN) != 0) {
weekNumbersButton.setEnabled(true);
} else {
weekNumbersButton.setEnabled(false);
weekNumbersButton.setSelection(false);
}
borderButton.setSelection ((dateTime1.getStyle () & SWT.BORDER) != 0);
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
void renderInitialization( final DateTime dateTime )
throws IOException
{
JSWriter writer = JSWriter.getWriterFor( dateTime );
String style = "";
if( ( dateTime.getStyle() & SWT.SHORT ) != 0 ) {
style = "short";
} else if( ( dateTime.getStyle() & SWT.MEDIUM ) != 0 ) {
style = "medium";
} else if( ( dateTime.getStyle() & SWT.LONG ) != 0 ) {
style = "long";
}
Object[] args = new Object[]{
style
};
writer.newWidget( "org.eclipse.swt.widgets.DateTimeTime", args );
ControlLCAUtil.writeStyleFlags( dateTime );
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding
@Override
protected void doSetValue(Object source, Object value) {
if (value == null) {
// ignore null, since it cannot be applied to the DateTimeWidget
return;
}
DateTime dateTime = (DateTime) source;
Calendar cal = (Calendar) calendar.get();
cal.setTime((Date) value);
if ((dateTime.getStyle() & SWT.TIME) != 0) {
dateTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal
.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
} else {
dateTime.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH));
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding
@Override
protected Object doGetValue(Object source) {
DateTime dateTime = (DateTime) source;
Calendar cal = (Calendar) calendar.get();
cal.clear();
if ((dateTime.getStyle() & SWT.TIME) != 0) {
cal.set(Calendar.HOUR_OF_DAY, dateTime.getHours());
cal.set(Calendar.MINUTE, dateTime.getMinutes());
cal.set(Calendar.SECOND, dateTime.getSeconds());
} else {
cal.set(Calendar.YEAR, dateTime.getYear());
cal.set(Calendar.MONTH, dateTime.getMonth());
cal.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
}
return cal.getTime();
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
void renderInitialization( final DateTime dateTime )
throws IOException
{
IDateTimeAdapter dateTimeAdapter
= DateTimeLCAUtil.getDateTimeAdapter( dateTime );
JSWriter writer = JSWriter.getWriterFor( dateTime );
String style = "";
if( ( dateTime.getStyle() & SWT.SHORT ) != 0 ) {
style = "short";
} else if( ( dateTime.getStyle() & SWT.MEDIUM ) != 0 ) {
style = "medium";
} else if( ( dateTime.getStyle() & SWT.LONG ) != 0 ) {
style = "long";
}
DateTimeLCAUtil.initCellSize( dateTime );
Object[] args = new Object[]{
style,
dateTimeAdapter.getMonthNames(),
dateTimeAdapter.getWeekdayShortNames()
};
writer.newWidget( "org.eclipse.swt.widgets.DateTimeCalendar", args );
ControlLCAUtil.writeStyleFlags( dateTime );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
void renderInitialization( final DateTime dateTime )
throws IOException
{
IDateTimeAdapter dateTimeAdapter
= DateTimeLCAUtil.getDateTimeAdapter( dateTime );
JSWriter writer = JSWriter.getWriterFor( dateTime );
String style = "";
if( ( dateTime.getStyle() & SWT.SHORT ) != 0 ) {
style = "short";
} else if( ( dateTime.getStyle() & SWT.MEDIUM ) != 0 ) {
style = "medium";
} else if( ( dateTime.getStyle() & SWT.LONG ) != 0 ) {
style = "long";
}
if( ( dateTime.getStyle() & SWT.DROP_DOWN ) != 0 ) {
style += "drop_down";
}
DateTimeLCAUtil.initCellSize( dateTime );
Object[] args = new Object[]{
style,
dateTimeAdapter.getMonthNames(),
dateTimeAdapter.getWeekdayNames(),
dateTimeAdapter.getWeekdayShortNames(),
dateTimeAdapter.getDateSeparator(),
dateTimeAdapter.getDatePattern()
};
writer.newWidget( "org.eclipse.swt.widgets.DateTimeDate", args );
ControlLCAUtil.writeStyleFlags( dateTime );
}
内容来源于网络,如有侵权,请联系作者删除!