本文整理汇总了Java中org.eclipse.nebula.widgets.cdatetime.CDateTime.setPattern方法的典型用法代码示例。如果您正苦于以下问题:Java CDateTime.setPattern方法的具体用法?Java CDateTime.setPattern怎么用?Java CDateTime.setPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.nebula.widgets.cdatetime.CDateTime
的用法示例。
在下文中一共展示了CDateTime.setPattern方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBinding
import org.eclipse.nebula.widgets.cdatetime.CDateTime; //导入方法依赖的package包/类
public Binding createBinding(Composite parent, boolean createLabel, DetailProviderParameter p) {
FormToolkit toolkit = p.getDetailFormToolkit();
EObject target = p.getTarget();
IItemPropertyDescriptor pd = p.getPropertyDescriptor();
EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
if (feature == null) {
return null;
}
boolean isEditable = pd.canSetProperty(target);
if (createLabel) {
EMFDetailUtils.createLabel(parent, toolkit, target, pd);
}
CDateTime cdt = new CDateTime(parent, CDT.BORDER | CDT.TAB_FIELDS | CDT.SPINNER);
cdt.setPattern(formatPattern);
cdt.setTimeZone("GMT");
cdt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cdt.setEnabled(isEditable);
EMFDetailUtils.bindControlViability(p, new Control[] {cdt});
DurationUpdateValueStrategy targetToModel = new DurationUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
DurationUpdateValueStrategy modelToTarget = new DurationUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
return EMFDetailUtils.bindEMFUndoable(p, new CDateTimeObservableValue(cdt), targetToModel, modelToTarget);
}
示例2: createBinding
import org.eclipse.nebula.widgets.cdatetime.CDateTime; //导入方法依赖的package包/类
public Binding createBinding(Composite parent, boolean createLabel, DetailProviderParameter p) {
FormToolkit toolkit = p.getDetailFormToolkit();
EObject target = p.getTarget();
IItemPropertyDescriptor pd = p.getPropertyDescriptor();
EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
if (feature == null) {
return null;
}
boolean isEditable = pd.canSetProperty(target);
if (createLabel) {
EMFDetailUtils.createLabel(parent, toolkit, target, pd);
}
CDateTime cdt = new CDateTime(parent, CDT.BORDER |
CDT.TAB_FIELDS |
CDT.SPINNER);
if (useTimeFormat) {
cdt.setPattern(TIME_FORMAT_PATTERN);
} else {
cdt.setPattern(DATE_FORMAT_PATTERN);
}
cdt.setTimeZone("GMT");
cdt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cdt.setEnabled(isEditable);
toolkit.adapt(cdt, true, true);
EMFDetailUtils.bindControlViability(p, new Control[] {cdt});
return EMFDetailUtils.bindEMFUndoable(p, new CDateTimeObservableValue(cdt));
}