|
|
|
@ -7,12 +7,15 @@ import com.fr.design.constants.LayoutConstants;
|
|
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
|
import com.fr.design.editor.ValueEditorPane; |
|
|
|
|
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.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
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.general.DateUtils; |
|
|
|
|
import com.fr.general.Inter; |
|
|
|
@ -34,6 +37,10 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
private UIComboBox dateFormatComboBox; |
|
|
|
|
private ValueEditorPane startDv; |
|
|
|
|
private ValueEditorPane endDv; |
|
|
|
|
private WaterMarkDictPane waterMarkDictPane; |
|
|
|
|
private FormWidgetValuePane formWidgetValuePane; |
|
|
|
|
private UISpinner fontSizePane; |
|
|
|
|
private UIHeadGroup formatHeader; |
|
|
|
|
|
|
|
|
|
public DateEditorDefinePane(XCreator xCreator) { |
|
|
|
|
super(xCreator); |
|
|
|
@ -48,6 +55,8 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
@Override |
|
|
|
|
protected JPanel setFirstContentPane() { |
|
|
|
|
waterMarkDictPane = new WaterMarkDictPane(); |
|
|
|
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
|
|
|
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
|
|
|
|
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
|
|
|
|
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("String"), Inter.getLocText("Date")}); |
|
|
|
@ -57,7 +66,8 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); |
|
|
|
|
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
|
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); |
|
|
|
|
|
|
|
|
|
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane("示例"); |
|
|
|
|
previewPane.add(sampleLabel); |
|
|
|
|
// content pane
|
|
|
|
|
String[] arr = getDateFormateArray(); |
|
|
|
|
dateFormatComboBox = new UIComboBox(arr); |
|
|
|
@ -68,33 +78,41 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
JPanel secondPanel = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"),dateFormatComboBox,sampleLabel}, FlowLayout.LEFT, 5); |
|
|
|
|
secondPanel.setPreferredSize(new Dimension(220,30)); |
|
|
|
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
|
|
|
|
|
|
|
|
|
initFormatHeader(); |
|
|
|
|
|
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox }, |
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane}, |
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox}, |
|
|
|
|
new Component[]{null, sampleLabel}, |
|
|
|
|
new Component[]{null, previewPane}, |
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv}, |
|
|
|
|
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}, |
|
|
|
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
double[] rowSize = {p, p,p,p,p}; |
|
|
|
|
double[] rowSize = {p, p, p, p, p, p, p, p, p, p}; |
|
|
|
|
double[] columnSize = {p, f}; |
|
|
|
|
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; |
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); |
|
|
|
|
|
|
|
|
|
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
|
|
|
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
|
|
|
|
|
|
|
|
return panel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel setSecondContentPane(){ |
|
|
|
|
return null; |
|
|
|
|
protected void initFormatHeader() { |
|
|
|
|
String [] tabTitles = getDateFormateArray(); |
|
|
|
|
formatHeader = new UIHeadGroup(tabTitles){ |
|
|
|
|
protected void tabChanged(int newSelectedIndex) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String[] getDateFormateArray() { |
|
|
|
|
return FormatField.getInstance().getDateFormatArray(); |
|
|
|
|
} |
|
|
|
@ -137,10 +155,10 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
@Override |
|
|
|
|
protected void populateSubDirectWriteEditorBean(DateEditor e) { |
|
|
|
|
String formatText = e.getFormatText(); |
|
|
|
|
// dateFormatComboBox.setSelectedItem(formatText);
|
|
|
|
|
//
|
|
|
|
|
// returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
|
|
|
|
|
dateFormatComboBox.setSelectedItem(formatText); |
|
|
|
|
|
|
|
|
|
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0); |
|
|
|
|
formWidgetValuePane.populate(e); |
|
|
|
|
populateStartEnd(e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -150,7 +168,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
|
|
|
|
|
ob.setFormatText(this.getSimpleDateFormat().toPattern()); |
|
|
|
|
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1); |
|
|
|
|
|
|
|
|
|
formWidgetValuePane.update(ob); |
|
|
|
|
updateStartEnd(ob); |
|
|
|
|
|
|
|
|
|
return ob; |
|
|
|
@ -158,6 +176,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 初始起止日期 |
|
|
|
|
* |
|
|
|
|
* @param dateWidgetEditor 日期控件 |
|
|
|
|
*/ |
|
|
|
|
public void populateStartEnd(DateEditor dateWidgetEditor) { |
|
|
|
@ -179,6 +198,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 更新日期控件的起止日期 |
|
|
|
|
* |
|
|
|
|
* @param dateWidgetEditor 日期控件 |
|
|
|
|
*/ |
|
|
|
|
public void updateStartEnd(DateEditor dateWidgetEditor) { |
|
|
|
|