|
|
@ -7,12 +7,15 @@ import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
import com.fr.design.editor.ValueEditorPane; |
|
|
|
import com.fr.design.editor.ValueEditorPane; |
|
|
|
import com.fr.design.editor.ValueEditorPaneFactory; |
|
|
|
import com.fr.design.editor.ValueEditorPaneFactory; |
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIHeadGroup; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
|
|
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
|
|
|
import com.fr.form.ui.DateEditor; |
|
|
|
import com.fr.form.ui.DateEditor; |
|
|
|
import com.fr.general.DateUtils; |
|
|
|
import com.fr.general.DateUtils; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
@ -29,217 +32,234 @@ import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { |
|
|
|
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { |
|
|
|
private UIComboBox returnTypeComboBox; |
|
|
|
private UIComboBox returnTypeComboBox; |
|
|
|
private UILabel sampleLabel;// preview
|
|
|
|
private UILabel sampleLabel;// preview
|
|
|
|
private UIComboBox dateFormatComboBox; |
|
|
|
private UIComboBox dateFormatComboBox; |
|
|
|
private ValueEditorPane startDv; |
|
|
|
private ValueEditorPane startDv; |
|
|
|
private ValueEditorPane endDv; |
|
|
|
private ValueEditorPane endDv; |
|
|
|
|
|
|
|
private WaterMarkDictPane waterMarkDictPane; |
|
|
|
public DateEditorDefinePane(XCreator xCreator) { |
|
|
|
private FormWidgetValuePane formWidgetValuePane; |
|
|
|
super(xCreator); |
|
|
|
private UISpinner fontSizePane; |
|
|
|
} |
|
|
|
private UIHeadGroup formatHeader; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DateEditorDefinePane(XCreator xCreator) { |
|
|
|
@Override |
|
|
|
super(xCreator); |
|
|
|
public String title4PopupWindow() { |
|
|
|
} |
|
|
|
return "Date"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String title4PopupWindow() { |
|
|
|
protected JPanel setFirstContentPane() { |
|
|
|
return "Date"; |
|
|
|
waterMarkDictPane = new WaterMarkDictPane(); |
|
|
|
} |
|
|
|
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
|
|
|
@Override |
|
|
|
returnTypeComboBox = new UIComboBox(new String[] { Inter.getLocText("String"), Inter.getLocText("Date") }); |
|
|
|
protected JPanel setFirstContentPane() { |
|
|
|
returnTypeComboBox.setPreferredSize(new Dimension(70, 20)); |
|
|
|
waterMarkDictPane = new WaterMarkDictPane(); |
|
|
|
// sample pane
|
|
|
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
|
|
|
sampleLabel = new UILabel(""); |
|
|
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
|
|
|
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); |
|
|
|
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
|
|
|
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); |
|
|
|
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("String"), Inter.getLocText("Date")}); |
|
|
|
|
|
|
|
returnTypeComboBox.setPreferredSize(new Dimension(70, 20)); |
|
|
|
// content pane
|
|
|
|
// sample pane
|
|
|
|
String[] arr = getDateFormateArray(); |
|
|
|
sampleLabel = new UILabel(""); |
|
|
|
dateFormatComboBox = new UIComboBox(arr); |
|
|
|
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); |
|
|
|
dateFormatComboBox.setPreferredSize(new Dimension(150,20)); |
|
|
|
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
dateFormatComboBox.addActionListener(new ActionListener(){ |
|
|
|
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); |
|
|
|
public void actionPerformed(ActionEvent e){ |
|
|
|
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane("示例"); |
|
|
|
refreshPreviewLabel(); |
|
|
|
previewPane.add(sampleLabel); |
|
|
|
} |
|
|
|
// content pane
|
|
|
|
|
|
|
|
String[] arr = getDateFormateArray(); |
|
|
|
}); |
|
|
|
dateFormatComboBox = new UIComboBox(arr); |
|
|
|
JPanel secondPanel = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"),dateFormatComboBox,sampleLabel}, FlowLayout.LEFT, 5); |
|
|
|
dateFormatComboBox.setPreferredSize(new Dimension(150, 20)); |
|
|
|
secondPanel.setPreferredSize(new Dimension(220,30)); |
|
|
|
dateFormatComboBox.addActionListener(new ActionListener() { |
|
|
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
refreshPreviewLabel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
}); |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox }, |
|
|
|
initFormatHeader(); |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox}, |
|
|
|
|
|
|
|
new Component[]{null, sampleLabel}, |
|
|
|
double f = TableLayout.FILL; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv}, |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv}, |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
}; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane}, |
|
|
|
double[] rowSize = {p, p,p,p,p}; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox}, |
|
|
|
double[] columnSize = {p,f}; |
|
|
|
new Component[]{null, previewPane}, |
|
|
|
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv}, |
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); |
|
|
|
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv}, |
|
|
|
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane}, |
|
|
|
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}, |
|
|
|
return panel; |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
protected JPanel setSecondContentPane(){ |
|
|
|
double[] rowSize = {p, p, p, p, p, p, p, p, p, p}; |
|
|
|
return null; |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
} |
|
|
|
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
private String[] getDateFormateArray() { |
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
|
|
|
return FormatField.getInstance().getDateFormatArray(); |
|
|
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return panel; |
|
|
|
protected JPanel initStartEndDatePane() { |
|
|
|
} |
|
|
|
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
|
|
|
|
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":")); |
|
|
|
protected void initFormatHeader() { |
|
|
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
String [] tabTitles = getDateFormateArray(); |
|
|
|
rangePane.add(startDv); |
|
|
|
formatHeader = new UIHeadGroup(tabTitles){ |
|
|
|
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":")); |
|
|
|
protected void tabChanged(int newSelectedIndex) { |
|
|
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
|
|
|
|
rangePane.add(endDv); |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
return rangePane; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String[] getDateFormateArray() { |
|
|
|
|
|
|
|
return FormatField.getInstance().getDateFormatArray(); |
|
|
|
private void refreshPreviewLabel() { |
|
|
|
} |
|
|
|
String text = (String) dateFormatComboBox.getSelectedItem(); |
|
|
|
|
|
|
|
if (text != null && text.length() > 0) { |
|
|
|
protected JPanel initStartEndDatePane() { |
|
|
|
try { |
|
|
|
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text); |
|
|
|
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":")); |
|
|
|
String sample = simpleDateFormat.format(new Date()); |
|
|
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
Color c = Color.black; |
|
|
|
rangePane.add(startDv); |
|
|
|
if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) { |
|
|
|
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":")); |
|
|
|
sample += " " + Inter.getLocText("DateFormat-Custom_Warning"); |
|
|
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
c = Color.red; |
|
|
|
rangePane.add(endDv); |
|
|
|
} |
|
|
|
|
|
|
|
this.sampleLabel.setText(sample); |
|
|
|
return rangePane; |
|
|
|
this.sampleLabel.setForeground(c); |
|
|
|
} |
|
|
|
} catch (Exception exp) { |
|
|
|
|
|
|
|
this.sampleLabel.setForeground(Color.red); |
|
|
|
|
|
|
|
this.sampleLabel.setText(exp.getMessage()); |
|
|
|
private void refreshPreviewLabel() { |
|
|
|
} |
|
|
|
String text = (String) dateFormatComboBox.getSelectedItem(); |
|
|
|
} else { |
|
|
|
if (text != null && text.length() > 0) { |
|
|
|
this.sampleLabel.setText(new Date().toString()); |
|
|
|
try { |
|
|
|
} |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text); |
|
|
|
} |
|
|
|
String sample = simpleDateFormat.format(new Date()); |
|
|
|
|
|
|
|
Color c = Color.black; |
|
|
|
@Override |
|
|
|
if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) { |
|
|
|
protected void populateSubDirectWriteEditorBean(DateEditor e) { |
|
|
|
sample += " " + Inter.getLocText("DateFormat-Custom_Warning"); |
|
|
|
String formatText = e.getFormatText(); |
|
|
|
c = Color.red; |
|
|
|
// dateFormatComboBox.setSelectedItem(formatText);
|
|
|
|
} |
|
|
|
//
|
|
|
|
this.sampleLabel.setText(sample); |
|
|
|
// returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
|
|
|
|
this.sampleLabel.setForeground(c); |
|
|
|
|
|
|
|
} catch (Exception exp) { |
|
|
|
populateStartEnd(e); |
|
|
|
this.sampleLabel.setForeground(Color.red); |
|
|
|
} |
|
|
|
this.sampleLabel.setText(exp.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
} else { |
|
|
|
protected DateEditor updateSubDirectWriteEditorBean() { |
|
|
|
this.sampleLabel.setText(new Date().toString()); |
|
|
|
DateEditor ob = new DateEditor(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
ob.setFormatText(this.getSimpleDateFormat().toPattern()); |
|
|
|
|
|
|
|
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1); |
|
|
|
@Override |
|
|
|
|
|
|
|
protected void populateSubDirectWriteEditorBean(DateEditor e) { |
|
|
|
updateStartEnd(ob); |
|
|
|
String formatText = e.getFormatText(); |
|
|
|
|
|
|
|
dateFormatComboBox.setSelectedItem(formatText); |
|
|
|
return ob; |
|
|
|
|
|
|
|
} |
|
|
|
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0); |
|
|
|
|
|
|
|
formWidgetValuePane.populate(e); |
|
|
|
/** |
|
|
|
populateStartEnd(e); |
|
|
|
* 初始起止日期 |
|
|
|
} |
|
|
|
* @param dateWidgetEditor 日期控件 |
|
|
|
|
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void populateStartEnd(DateEditor dateWidgetEditor) { |
|
|
|
protected DateEditor updateSubDirectWriteEditorBean() { |
|
|
|
Formula startFM = dateWidgetEditor.getStartDateFM(); |
|
|
|
DateEditor ob = new DateEditor(); |
|
|
|
Formula endFM = dateWidgetEditor.getEndDateFM(); |
|
|
|
|
|
|
|
if (startFM != null) { |
|
|
|
ob.setFormatText(this.getSimpleDateFormat().toPattern()); |
|
|
|
startDv.populate(startFM); |
|
|
|
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1); |
|
|
|
} else { |
|
|
|
formWidgetValuePane.update(ob); |
|
|
|
String startStr = dateWidgetEditor.getStartText(); |
|
|
|
updateStartEnd(ob); |
|
|
|
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true)); |
|
|
|
|
|
|
|
} |
|
|
|
return ob; |
|
|
|
if (endFM != null) { |
|
|
|
} |
|
|
|
endDv.populate(endFM); |
|
|
|
|
|
|
|
} else { |
|
|
|
/** |
|
|
|
String endStr = dateWidgetEditor.getEndText(); |
|
|
|
* 初始起止日期 |
|
|
|
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true)); |
|
|
|
* |
|
|
|
} |
|
|
|
* @param dateWidgetEditor 日期控件 |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public void populateStartEnd(DateEditor dateWidgetEditor) { |
|
|
|
/** |
|
|
|
Formula startFM = dateWidgetEditor.getStartDateFM(); |
|
|
|
* 更新日期控件的起止日期 |
|
|
|
Formula endFM = dateWidgetEditor.getEndDateFM(); |
|
|
|
* @param dateWidgetEditor 日期控件 |
|
|
|
if (startFM != null) { |
|
|
|
*/ |
|
|
|
startDv.populate(startFM); |
|
|
|
public void updateStartEnd(DateEditor dateWidgetEditor) { |
|
|
|
} else { |
|
|
|
Object startObject = startDv.update(); |
|
|
|
String startStr = dateWidgetEditor.getStartText(); |
|
|
|
Object endObject = endDv.update(); |
|
|
|
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true)); |
|
|
|
// wei : 对公式的处理
|
|
|
|
} |
|
|
|
Calculator cal = null; |
|
|
|
if (endFM != null) { |
|
|
|
if (startObject instanceof Formula) { |
|
|
|
endDv.populate(endFM); |
|
|
|
cal = Calculator.createCalculator(); |
|
|
|
} else { |
|
|
|
Formula startFormula = (Formula) startObject; |
|
|
|
String endStr = dateWidgetEditor.getEndText(); |
|
|
|
try { |
|
|
|
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true)); |
|
|
|
startFormula.setResult(cal.evalValue(startFormula.getContent())); |
|
|
|
} |
|
|
|
} catch (UtilEvalError e) { |
|
|
|
} |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
startObject = startFormula.getResult(); |
|
|
|
* 更新日期控件的起止日期 |
|
|
|
dateWidgetEditor.setStartDateFM(startFormula); |
|
|
|
* |
|
|
|
dateWidgetEditor.setStartText(null); |
|
|
|
* @param dateWidgetEditor 日期控件 |
|
|
|
} else { |
|
|
|
*/ |
|
|
|
try { |
|
|
|
public void updateStartEnd(DateEditor dateWidgetEditor) { |
|
|
|
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)startObject)); |
|
|
|
Object startObject = startDv.update(); |
|
|
|
} catch(ClassCastException e) { |
|
|
|
Object endObject = endDv.update(); |
|
|
|
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
|
|
|
|
// wei : 对公式的处理
|
|
|
|
} |
|
|
|
Calculator cal = null; |
|
|
|
} |
|
|
|
if (startObject instanceof Formula) { |
|
|
|
if (endObject instanceof Formula) { |
|
|
|
cal = Calculator.createCalculator(); |
|
|
|
cal = Calculator.createCalculator(); |
|
|
|
Formula startFormula = (Formula) startObject; |
|
|
|
Formula endFormula = (Formula) endObject; |
|
|
|
try { |
|
|
|
try { |
|
|
|
startFormula.setResult(cal.evalValue(startFormula.getContent())); |
|
|
|
endFormula.setResult(cal.evalValue(endFormula.getContent())); |
|
|
|
} catch (UtilEvalError e) { |
|
|
|
} catch (UtilEvalError e) { |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
startObject = startFormula.getResult(); |
|
|
|
endObject = endFormula.getResult(); |
|
|
|
dateWidgetEditor.setStartDateFM(startFormula); |
|
|
|
dateWidgetEditor.setEndDateFM(endFormula); |
|
|
|
dateWidgetEditor.setStartText(null); |
|
|
|
dateWidgetEditor.setEndText(null); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
try { |
|
|
|
try { |
|
|
|
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date) startObject)); |
|
|
|
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)endObject)); |
|
|
|
} catch (ClassCastException e) { |
|
|
|
} catch(ClassCastException e) { |
|
|
|
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (endObject instanceof Formula) { |
|
|
|
} |
|
|
|
cal = Calculator.createCalculator(); |
|
|
|
|
|
|
|
Formula endFormula = (Formula) endObject; |
|
|
|
private SimpleDateFormat getSimpleDateFormat() { |
|
|
|
try { |
|
|
|
String text = (String) dateFormatComboBox.getSelectedItem(); |
|
|
|
endFormula.setResult(cal.evalValue(endFormula.getContent())); |
|
|
|
SimpleDateFormat simpleDateFormat; |
|
|
|
} catch (UtilEvalError e) { |
|
|
|
if (text != null && text.length() > 0) { |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
try { |
|
|
|
} |
|
|
|
simpleDateFormat = new SimpleDateFormat(text); |
|
|
|
endObject = endFormula.getResult(); |
|
|
|
this.sampleLabel.setText(simpleDateFormat.format(new Date())); |
|
|
|
dateWidgetEditor.setEndDateFM(endFormula); |
|
|
|
} catch (Exception exp) { |
|
|
|
dateWidgetEditor.setEndText(null); |
|
|
|
simpleDateFormat = new SimpleDateFormat(""); |
|
|
|
} else { |
|
|
|
} |
|
|
|
try { |
|
|
|
} else { |
|
|
|
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date) endObject)); |
|
|
|
simpleDateFormat = new SimpleDateFormat(""); |
|
|
|
} catch (ClassCastException e) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return simpleDateFormat; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private SimpleDateFormat getSimpleDateFormat() { |
|
|
|
|
|
|
|
String text = (String) dateFormatComboBox.getSelectedItem(); |
|
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat; |
|
|
|
|
|
|
|
if (text != null && text.length() > 0) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
simpleDateFormat = new SimpleDateFormat(text); |
|
|
|
|
|
|
|
this.sampleLabel.setText(simpleDateFormat.format(new Date())); |
|
|
|
|
|
|
|
} catch (Exception exp) { |
|
|
|
|
|
|
|
simpleDateFormat = new SimpleDateFormat(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
simpleDateFormat = new SimpleDateFormat(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return simpleDateFormat; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |