LAPTOP-SB56SG4Q\86185
3 years ago
44 changed files with 15342 additions and 1 deletions
Binary file not shown.
Binary file not shown.
@ -1,3 +1,6 @@
|
||||
# open-JSD-8806 |
||||
|
||||
JSD-8806 VUE日期控件 |
||||
JSD-8806 VUE日期控件\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 |
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<plugin> |
||||
<id>com.fr.plugin.hrjf.date</id> |
||||
<name><![CDATA[日期控件插件]]></name> |
||||
<active>yes</active> |
||||
<version>1.1.3</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>mqh</vendor> |
||||
<description><![CDATA[日期控件插件]]></description> |
||||
<change-notes><![CDATA[日期控件插件]]></change-notes> |
||||
<main-package>com.fr.plugin.hrjf</main-package> |
||||
<prefer-packages> |
||||
<prefer-package>com.fanruan.api</prefer-package> |
||||
</prefer-packages> |
||||
<lifecycle-monitor class="com.fr.plugin.hrjf.PluginMonitor"/> |
||||
<extra-report> |
||||
<JavaScriptFileHandler class="com.fr.plugin.hrjf.VSJSFileHandler"/> |
||||
<CssFileHandler class="com.fr.plugin.hrjf.VSCSSFileHandler"/> |
||||
</extra-report> |
||||
<extra-core> |
||||
<LocaleFinder class="com.fr.plugin.hrjf.LocaleFinder"/> |
||||
<!-- <WebService class="com.fr.plugin.hrjf.VSMapService"/>--> |
||||
</extra-core> |
||||
<extra-designer> |
||||
<FormWidgetOptionProvider class="com.fr.plugin.hrjf.provider.VueFormOptionProvider"/> |
||||
<ParameterWidgetOptionProvider class="com.fr.plugin.hrjf.provider.VueParameterWidgetOptionProvider"/> |
||||
<CellWidgetOptionProvider class="com.fr.plugin.hrjf.provider.VSCellWidgetOptionProvider"/> |
||||
</extra-designer> |
||||
<function-recorder class="com.fr.plugin.hrjf.LocaleFinder"/> |
||||
</plugin> |
@ -0,0 +1,36 @@
|
||||
/* |
||||
* Copyright (C), 2018-2020 |
||||
* Project: starter |
||||
* FileName: LocaleFinder |
||||
* Author: Louis |
||||
* Date: 2020/8/31 22:19 |
||||
*/ |
||||
package com.fr.plugin.hrjf; |
||||
|
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.intelli.record.Original; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
import com.fr.stable.fun.impl.AbstractLocaleFinder; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <LocaleFinder> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@EnableMetrics |
||||
public class LocaleFinder extends AbstractLocaleFinder { |
||||
public static final String PLUGIN_ID = "com.fr.plugin.hrjf.date"; |
||||
|
||||
@Override |
||||
@Focus(id = PLUGIN_ID, text = "Plugin-hrjf", source = Original.PLUGIN) |
||||
public String find() { |
||||
return "com/fr/plugin/hrjf/locale/lang"; |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,53 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: PluginMonitor |
||||
* Author: Louis |
||||
* Date: 2021/3/30 15:10 |
||||
*/ |
||||
package com.fr.plugin.hrjf; |
||||
|
||||
import com.fanruan.api.i18n.I18nKit; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.design.widget.Appearance; |
||||
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; |
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.hrjf.pane.VueDateEditorFormDefinePane; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
import com.fr.plugin.manage.PluginManager; |
||||
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||
|
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <PluginMonitor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class PluginMonitor extends AbstractPluginLifecycleMonitor { |
||||
|
||||
public PluginMonitor() { |
||||
} |
||||
|
||||
public static void pluginForbid(PluginMarker pluginMarker) { |
||||
PluginManager.getController().forbid(pluginMarker, pluginTaskResult -> { |
||||
}); |
||||
LogKit.error(I18nKit.getLocText("Plugin-hrjf_Licence_Expired")); |
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop(PluginContext pluginContext) { |
||||
} |
||||
|
||||
@Override |
||||
public void afterRun(PluginContext pluginContext) { |
||||
if (!pluginContext.isAvailable()) { |
||||
pluginForbid(pluginContext.getMarker()); |
||||
return; |
||||
} |
||||
// FormWidget定义日期控件外观
|
||||
FormWidgetDefinePaneFactoryBase.registerDefinePane(VueDateEditor.class, new Appearance(VueDateEditorFormDefinePane.class, "VueDateDefine")); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.plugin.hrjf; |
||||
|
||||
import com.fr.stable.fun.impl.AbstractCssFileHandler; |
||||
|
||||
public class VSCSSFileHandler extends AbstractCssFileHandler { |
||||
@Override |
||||
public String[] pathsForFiles() { |
||||
return new String[]{ |
||||
"com/fr/plugin/hrjf/css/ts.css" |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.plugin.hrjf; |
||||
|
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.stable.fun.Authorize; |
||||
import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler; |
||||
|
||||
import static com.fr.plugin.hrjf.LocaleFinder.PLUGIN_ID; |
||||
|
||||
@Authorize(callSignKey = PLUGIN_ID) |
||||
public class VSJSFileHandler extends AbstractJavaScriptFileHandler { |
||||
|
||||
public VSJSFileHandler() { |
||||
} |
||||
|
||||
@Override |
||||
public String[] pathsForFiles() { |
||||
if (!PluginContexts.currentContext().isAvailable()) { |
||||
PluginMonitor.pluginForbid(PluginContexts.currentContext().getMarker()); |
||||
return new String[]{}; |
||||
} |
||||
return new String[]{ |
||||
"/com/fr/plugin/hrjf/js/vue.js", |
||||
"/com/fr/plugin/hrjf/js/element.js", |
||||
"/com/fr/plugin/hrjf/js/vuedatetime.js" |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.plugin.hrjf; |
||||
|
||||
import com.fr.decision.webservice.v10.plugin.helper.PluginUtils; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.manage.PluginManager; |
||||
import com.fr.stable.fun.Service; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
public class VSMapService implements Service { |
||||
@Override |
||||
public String actionOP() { |
||||
return "restartInit"; |
||||
} |
||||
|
||||
@Override |
||||
public void process(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String op, String cmd) throws Exception { |
||||
PluginMarker pluginMarker = PluginUtils.createPluginMarker("com.fr.plugin.m.tree_1.0.0"); |
||||
PluginManager.getController().forbid(pluginMarker, pluginTaskResult -> { |
||||
}); |
||||
PluginManager.getController().enable(pluginMarker, pluginTaskResult -> { |
||||
}); |
||||
WebUtils.printAsJSON(httpServletResponse, new JSONObject()); |
||||
return; |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: AccessibleFormulaVueEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/26 9:09 |
||||
*/ |
||||
package com.fr.plugin.hrjf.accessibles; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.formula.FormulaFactory; |
||||
import com.fr.design.formula.UIFormula; |
||||
import com.fr.design.mainframe.widget.wrappers.FormulaWrapper; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <AccessibleFormulaVueEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class AccessibleFormulaVueEditor extends BaseAccessibleVueEditor { |
||||
private UIFormula formulaPane; |
||||
|
||||
public AccessibleFormulaVueEditor() { |
||||
super(new FormulaWrapper(), new FormulaWrapper(), true); |
||||
} |
||||
|
||||
protected void showEditorPane() { |
||||
if (this.formulaPane == null) { |
||||
this.formulaPane = FormulaFactory.createFormulaPane(); |
||||
} |
||||
|
||||
BasicDialog var1 = this.formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(this), new DialogActionAdapter() { |
||||
public void doOk() { |
||||
AccessibleFormulaVueEditor.this.setValue(AccessibleFormulaVueEditor.this.formulaPane.update()); |
||||
AccessibleFormulaVueEditor.this.fireStateChanged(); |
||||
} |
||||
}); |
||||
this.formulaPane.populate((BaseFormula) this.getValue()); |
||||
var1.setVisible(true); |
||||
} |
||||
} |
@ -0,0 +1,227 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VueAccessibleEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/25 21:58 |
||||
*/ |
||||
package com.fr.plugin.hrjf.accessibles; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.designer.properties.Decoder; |
||||
import com.fr.design.designer.properties.Encoder; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UIButtonUI; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.widget.accessibles.AccessibleEditor; |
||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||
import com.fr.design.mainframe.widget.editors.TextField; |
||||
import com.fr.design.utils.gui.GUIPaintUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import javax.swing.plaf.ButtonUI; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <VueAccessibleEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class BaseAccessibleVueEditor extends BasicPane implements AccessibleEditor { |
||||
protected Encoder encoder; |
||||
protected ITextComponent txtValue; |
||||
private ArrayList<ChangeListener> listeners = new ArrayList(); |
||||
private boolean showButton; |
||||
private Decoder decoder; |
||||
private UIButton btPopup; |
||||
|
||||
public BaseAccessibleVueEditor(Encoder var1, Decoder var2, boolean var3) { |
||||
this.showButton = var3; |
||||
this.encoder = var1; |
||||
this.decoder = var2; |
||||
this.initComponents(); |
||||
// this.txtValue.setEditable(var2 != null);
|
||||
this.txtValue.setEditable(false); |
||||
((JComponent) this.txtValue).setOpaque(true); |
||||
((JComponent) this.txtValue).setBorder(BorderFactory.createLineBorder(Color.lightGray)); |
||||
((JComponent) this.txtValue).setBackground(Color.WHITE); |
||||
} |
||||
|
||||
public static void showMessage(String var0, Component var1) { |
||||
FineJOptionPane.showMessageDialog(var1, var0, "Validation Error", 0); |
||||
} |
||||
|
||||
public void requestFocus() { |
||||
super.requestFocus(); |
||||
if (this.decoder != null) { |
||||
((JComponent) this.txtValue).requestFocus(); |
||||
} else if (this.showButton) { |
||||
this.btPopup.requestFocus(); |
||||
} |
||||
|
||||
} |
||||
|
||||
protected ITextComponent createTextField() { |
||||
return new TextField() { |
||||
public void registerChangeListener(UIObserverListener var1) { |
||||
} |
||||
|
||||
public boolean shouldResponseChangeListener() { |
||||
return false; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
||||
this.txtValue = this.createTextField(); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.txtValue.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent var1) { |
||||
BaseAccessibleVueEditor.this.txtValueActionPerformed(var1); |
||||
} |
||||
}); |
||||
this.add((JComponent) this.txtValue, "Center"); |
||||
this.setOpaque(false); |
||||
if (this.showButton) { |
||||
this.btPopup = new UIButton() { |
||||
public ButtonUI getUI() { |
||||
return new UIButtonUI() { |
||||
protected boolean isPressed(AbstractButton var1) { |
||||
return model.isArmed() && model.isPressed(); |
||||
} |
||||
|
||||
protected void doExtraPainting(UIButton var1, Graphics2D var2, int var3, int var4, String var5) { |
||||
if (this.isPressed(var1) && var1.isPressedPainted()) { |
||||
GUIPaintUtils.fillPressed(var2, 0, 0, var3, var4, var1.isRoundBorder(), var1.getRectDirection(), var1.isDoneAuthorityEdited(var5), UIConstants.COMBOBOX_BTN_PRESS); |
||||
} else if (this.isRollOver(var1)) { |
||||
GUIPaintUtils.fillRollOver(var2, 0, 0, var3, var4, var1.isRoundBorder(), var1.getRectDirection(), var1.isDoneAuthorityEdited(var5), var1.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER); |
||||
} else if (var1.isNormalPainted()) { |
||||
GUIPaintUtils.fillNormal(var2, 0, 0, var3, var4, var1.isRoundBorder(), var1.getRectDirection(), var1.isDoneAuthorityEdited(var5), var1.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL); |
||||
} |
||||
|
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
this.initPopupButton(); |
||||
this.btPopup.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent var1) { |
||||
BaseAccessibleVueEditor.this.showEditorPane(); |
||||
} |
||||
}); |
||||
this.add(this.btPopup, "East"); |
||||
} |
||||
|
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return "Base"; |
||||
} |
||||
|
||||
protected void showEditorPane() { |
||||
} |
||||
|
||||
protected void initPopupButton() { |
||||
if (!this.isComboButton()) { |
||||
this.btPopup.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); |
||||
this.btPopup.setPreferredSize(new Dimension(20, 20)); |
||||
} else { |
||||
this.btPopup.setRolloverEnabled(true); |
||||
this.btPopup.setFocusPainted(false); |
||||
this.btPopup.setPreferredSize(new Dimension(15, 19)); |
||||
this.btPopup.setBorderPainted(false); |
||||
this.btPopup.setContentAreaFilled(false); |
||||
this.btPopup.setMargin(new Insets(0, 0, 0, 0)); |
||||
this.btPopup.setIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_up.png")); |
||||
this.btPopup.setPressedIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_down.png")); |
||||
this.btPopup.setRolloverIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_over.png")); |
||||
} |
||||
|
||||
} |
||||
|
||||
protected boolean isComboButton() { |
||||
return false; |
||||
} |
||||
|
||||
private void txtValueActionPerformed(ActionEvent var1) { |
||||
try { |
||||
this.validateValue(); |
||||
this.fireStateChanged(); |
||||
} catch (ValidationException var3) { |
||||
showMessage(var3.getMessage(), this); |
||||
this.txtValue.selectAll(); |
||||
((JComponent) this.txtValue).requestFocus(); |
||||
} |
||||
|
||||
} |
||||
|
||||
public Component getEditor() { |
||||
return this; |
||||
} |
||||
|
||||
public Object getValue() { |
||||
return this.decoder.decode(this.txtValue.getText()); |
||||
} |
||||
|
||||
public void setValue(Object var1) { |
||||
if (this.encoder != null) { |
||||
this.txtValue.setText(this.encoder.encode(var1)); |
||||
} |
||||
|
||||
this.txtValue.setValue(var1); |
||||
} |
||||
|
||||
public void addChangeListener(ChangeListener var1) { |
||||
if (!this.listeners.contains(var1)) { |
||||
this.listeners.add(var1); |
||||
} |
||||
|
||||
} |
||||
|
||||
public void removeChangeListener(ChangeListener var1) { |
||||
if (this.listeners.contains(var1)) { |
||||
this.listeners.remove(var1); |
||||
} |
||||
|
||||
} |
||||
|
||||
protected void fireStateChanged() { |
||||
ChangeEvent var1 = new ChangeEvent(this); |
||||
Iterator var2 = this.listeners.iterator(); |
||||
|
||||
while (var2.hasNext()) { |
||||
ChangeListener var3 = (ChangeListener) var2.next(); |
||||
var3.stateChanged(var1); |
||||
} |
||||
|
||||
} |
||||
|
||||
public Encoder getEncoder() { |
||||
return this.encoder; |
||||
} |
||||
|
||||
public void setEncoder(Encoder var1) { |
||||
this.encoder = var1; |
||||
} |
||||
|
||||
public void validateValue() throws ValidationException { |
||||
if (this.decoder != null) { |
||||
this.decoder.validate(this.txtValue.getText()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,74 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: SsoConfig |
||||
* Author: Louis |
||||
* Date: 2021/3/30 9:38 |
||||
*/ |
||||
package com.fr.plugin.hrjf.config; |
||||
|
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.config.*; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <SsoConfig> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@Visualization(category = "Plugin-hrjf_Group") |
||||
public class SsoConfig extends DefaultConfiguration { |
||||
public static final String PLUGIN_ID = "com.fr.plugin.hrjf.date"; |
||||
|
||||
private static volatile SsoConfig config = null; |
||||
@Identifier(value = "uriBase", name = "Plugin-hrjf_Config_UriBase", description = "Plugin-hrjf_Config_UriBase_Description", status = Status.SHOW) |
||||
private final Conf<String> uriBase = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "clientId", name = "Plugin-hrjf_Config_ClientId", description = "Plugin-hrjf_Config_ClientId_Description", status = Status.SHOW) |
||||
private Conf<String> clientId = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "clientSecret", name = "Plugin-hrjf_Config_ClientSecret", description = "Plugin-hrjf_Config_ClientSecret_Description", status = Status.SHOW) |
||||
private Conf<String> clientSecret = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "frUri", name = "Plugin-hrjf_Config_FrUri", description = "Plugin-hrjf_Config_FrUri_Description", status = Status.SHOW) |
||||
private Conf<String> frUri = Holders.simple(StringKit.EMPTY); |
||||
|
||||
public static SsoConfig getInstance() { |
||||
if (config == null) { |
||||
config = ConfigContext.getConfigInstance(SsoConfig.class); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
public String getUriBase() { |
||||
return uriBase.get(); |
||||
} |
||||
|
||||
public void setUriBase(String uriBase) { |
||||
this.uriBase.set(uriBase); |
||||
} |
||||
|
||||
public String getClientId() { |
||||
return clientId.get(); |
||||
} |
||||
|
||||
public void setClientId(String clientId) { |
||||
this.clientId.set(clientId); |
||||
} |
||||
|
||||
public String getClientSecret() { |
||||
return clientSecret.get(); |
||||
} |
||||
|
||||
public void setClientSecret(String clientSecret) { |
||||
this.clientSecret.set(clientSecret); |
||||
} |
||||
|
||||
public String getFrUri() { |
||||
return frUri.get(); |
||||
} |
||||
|
||||
public void setFrUri(String frUri) { |
||||
this.frUri.set(frUri); |
||||
} |
||||
} |
@ -0,0 +1,217 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: XVueDateEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/8 11:46 |
||||
*/ |
||||
package com.fr.plugin.hrjf.creator; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fr.design.designer.creator.CRPropertyDescriptor; |
||||
import com.fr.design.designer.creator.XDirectWriteEditor; |
||||
import com.fr.design.designer.creator.XLayoutContainer; |
||||
import com.fr.design.designer.creator.XWScaleLayout; |
||||
import com.fr.design.form.util.XCreatorConstants; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.widget.editors.DateFormatEditor; |
||||
import com.fr.design.mainframe.widget.editors.WidgetValueEditor; |
||||
import com.fr.form.ui.WidgetValue; |
||||
import com.fr.form.ui.concept.data.ValueInitializer; |
||||
import com.fr.general.DateUtils; |
||||
import com.fr.plugin.hrjf.editors.ConfigurationItemEditor; |
||||
import com.fr.plugin.hrjf.editors.FirstDayOfWeekEditor; |
||||
import com.fr.plugin.hrjf.editors.ReturnTypeEditor; |
||||
import com.fr.plugin.hrjf.editors.ShowDateEditor; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.core.PropertyChangeAdapter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.beans.IntrospectionException; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <XVueDateEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class XVueDateEditor extends XDirectWriteEditor { |
||||
public static final String SHOW_DATE = "showDate"; |
||||
public static final String FIRST_DAY_OF_WEEK = "firstDayOfWeek"; |
||||
public static final String CONFIGURATION_ITEM = "configurationItem"; |
||||
public static final String DATE_FORMAT = "dateFormat"; |
||||
public static final String RETURN_FORMAT = "returnFormat"; |
||||
public static final String RETURN_TYPE = "returnType"; |
||||
public static final String DATE_SEPARATOR = "dateSeparator"; |
||||
private UITextField textField; |
||||
private LimpidButton btn; |
||||
|
||||
public XVueDateEditor(VueDateEditor dateEditor, Dimension dimension) { |
||||
super(dateEditor, dimension); |
||||
} |
||||
|
||||
/** |
||||
* 控件的属性列表 |
||||
* |
||||
* @return 此控件所用的属性列表 |
||||
* @throws IntrospectionException 异常 |
||||
*/ |
||||
@Override |
||||
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { |
||||
CRPropertyDescriptor widgetValueCRP = new CRPropertyDescriptor("widgetValue", this.data.getClass()) |
||||
.setI18NName(DesignKit.i18nText("Fine-Design_Form_Widget_Value")) |
||||
.setEditorClass(WidgetValueEditor.class) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") |
||||
.setPropertyChangeListener(new PropertyChangeAdapter() { |
||||
@Override |
||||
public void propertyChange() { |
||||
initFieldText(); |
||||
} |
||||
}); |
||||
// CRPropertyDescriptor formatTextCRP = new CRPropertyDescriptor("formatText", this.data.getClass())
|
||||
// .setI18NName(DesignKit.i18nText("Fine-Design_Report_Engine_Format"))
|
||||
// .setEditorClass(formatClass()).setRendererClass(DateCellRenderer.class)
|
||||
// .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced");
|
||||
// 日期格式
|
||||
CRPropertyDescriptor dateFormatAttr = new CRPropertyDescriptor(DATE_FORMAT, this.data.getClass()) |
||||
// .setEditorClass(VueDateFormatEditor.class)
|
||||
.setEditorClass(com.fr.plugin.hrjf.editors.DateFormatEditor.class) |
||||
.setI18NName(DesignKit.i18nText("Plugin-hrjf-Date_Format")) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"); |
||||
// 显示日期格式
|
||||
CRPropertyDescriptor showDateCRP = new CRPropertyDescriptor(SHOW_DATE, this.data.getClass()) |
||||
.setEditorClass(ShowDateEditor.class) |
||||
.setI18NName(DesignKit.i18nText("Plugin-hrjf-Design_Form_Show_Date")) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"); |
||||
// 返回格式
|
||||
CRPropertyDescriptor returnFormatCRP = new CRPropertyDescriptor(RETURN_FORMAT, this.data.getClass()) |
||||
.setEditorClass(ShowDateEditor.class) |
||||
.setI18NName(DesignKit.i18nText("Plugin-hrjf-Design_Form_Return_Format")) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"); |
||||
// 周起始日
|
||||
CRPropertyDescriptor firstDayOfWeekAttr = new CRPropertyDescriptor(FIRST_DAY_OF_WEEK, this.data.getClass()) |
||||
.setEditorClass(FirstDayOfWeekEditor.class) |
||||
.setI18NName(DesignKit.i18nText("Plugin-hrjf-Design_Form_Week_Start_Date")) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"); |
||||
// 返回类型
|
||||
CRPropertyDescriptor returnTypeAttr = new CRPropertyDescriptor(RETURN_TYPE, this.data.getClass()) |
||||
.setEditorClass(ReturnTypeEditor.class) |
||||
.setI18NName(DesignKit.i18nText("Plugin-hrjf-Design_Form_Return_Type")) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"); |
||||
// 数组拼接符
|
||||
CRPropertyDescriptor dateSeparatorCRP = new CRPropertyDescriptor(DATE_SEPARATOR, this.data.getClass()).setI18NName( |
||||
DesignKit.i18nText("Plugin-hrjf-Design_Form_Date_Separator")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, |
||||
"Fine-Design_Basic_Advanced"); |
||||
// 配置项
|
||||
CRPropertyDescriptor configurationItemCRP = new CRPropertyDescriptor(CONFIGURATION_ITEM, this.data.getClass()) |
||||
.setEditorClass(ConfigurationItemEditor.class) |
||||
.setI18NName(DesignKit.i18nText("Plugin-hrjf-Design_Form_Configuration_Item")) |
||||
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"); |
||||
|
||||
CRPropertyDescriptor[] crp = new CRPropertyDescriptor[]{widgetValueCRP, dateFormatAttr, showDateCRP, returnFormatCRP, |
||||
firstDayOfWeekAttr, returnTypeAttr, dateSeparatorCRP, configurationItemCRP}; |
||||
return ArrayUtils.addAll(super.supportedDescriptor(), crp); |
||||
} |
||||
|
||||
protected Class formatClass() { |
||||
return DateFormatEditor.class; |
||||
} |
||||
|
||||
private void initFieldText() { |
||||
VueDateEditor dateEditor = (VueDateEditor) data; |
||||
if (dateEditor.getWidgetValue() != null) { |
||||
ValueInitializer widgetValue = dateEditor.getWidgetValue(); |
||||
//控件值.toString
|
||||
String valueStr = widgetValue.toString(); |
||||
//控件值
|
||||
Object value = widgetValue.getValue(); |
||||
//格式
|
||||
String format = dateEditor.getFormatText(); |
||||
|
||||
if (value instanceof Date) { |
||||
valueStr = DateUtils.getDate2Str(format, (Date) value); |
||||
} |
||||
|
||||
//日期控件默认值
|
||||
if (StringUtils.isEmpty(valueStr)) { |
||||
valueStr = DateUtils.getDate2Str(format, new Date()); |
||||
dateEditor.setWidgetValue(new WidgetValue(new Date())); |
||||
} |
||||
textField.setText(valueStr); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void initXCreatorProperties() { |
||||
super.initXCreatorProperties(); |
||||
initFieldText(); |
||||
} |
||||
|
||||
@Override |
||||
protected JComponent initEditor() { |
||||
if (editor == null) { |
||||
editor = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
editor.add(textField = new UITextField(5), BorderLayout.CENTER); |
||||
btn = new LimpidButton(StringUtils.EMPTY, this.getIconPath(), toData().isVisible() ? FULL_OPACITY : HALF_OPACITY); |
||||
btn.setPreferredSize(new Dimension(21, 21)); |
||||
editor.add(btn, BorderLayout.EAST); |
||||
textField.setOpaque(false); |
||||
editor.setBackground(Color.WHITE); |
||||
} |
||||
return editor; |
||||
} |
||||
|
||||
@Override |
||||
protected String getIconName() { |
||||
return "date_16.png"; |
||||
} |
||||
|
||||
protected void makeVisible(boolean visible) { |
||||
btn.makeVisible(visible); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前XCreator的一个封装父容器 |
||||
* |
||||
* @param widgetName 当前组件名 |
||||
* @return 封装的父容器 |
||||
* @date 2014-11-25-下午4:47:23 |
||||
*/ |
||||
protected XLayoutContainer getCreatorWrapper(String widgetName) { |
||||
return new XWScaleLayout(); |
||||
} |
||||
|
||||
/** |
||||
* 将当前对象添加到父容器中 |
||||
* |
||||
* @param parentPanel 父容器组件 |
||||
* @date 2014-11-25-下午4:57:55 |
||||
*/ |
||||
protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight) { |
||||
this.setSize(width, minHeight); |
||||
parentPanel.add(this); |
||||
} |
||||
|
||||
/** |
||||
* 此控件在自适应布局要保持原样高度 |
||||
* |
||||
* @return 是则返回true |
||||
*/ |
||||
@Override |
||||
public boolean shouldScaleCreator() { |
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* data属性改变触发其他操作 |
||||
*/ |
||||
public void firePropertyChange() { |
||||
initFieldText(); |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ConfigurationItemEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/18 16:38 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fanruan.api.design.ui.component.UITextArea; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.widget.editors.AbstractPropertyEditor; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.event.DocumentEvent; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ConfigurationItemEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ConfigurationItemEditor extends AbstractPropertyEditor { |
||||
private static final int CONTENT_PANE_COLUMNS = 25; |
||||
private JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
private UITextArea textField = new UITextArea(5, CONTENT_PANE_COLUMNS); |
||||
|
||||
public ConfigurationItemEditor() { |
||||
this.panel.add(this.textField, "Center"); |
||||
this.textField.setBorder((Border) null); |
||||
this.textField.getDocument().addDocumentListener(new DocumentListener() { |
||||
public void removeUpdate(DocumentEvent var1) { |
||||
ConfigurationItemEditor.this.firePropertyChanged(); |
||||
} |
||||
|
||||
public void insertUpdate(DocumentEvent var1) { |
||||
ConfigurationItemEditor.this.firePropertyChanged(); |
||||
} |
||||
|
||||
public void changedUpdate(DocumentEvent var1) { |
||||
ConfigurationItemEditor.this.firePropertyChanged(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public Object getValue() { |
||||
return this.textField.getText(); |
||||
} |
||||
|
||||
public void setValue(Object var1) { |
||||
this.textField.setText((String) var1); |
||||
} |
||||
|
||||
public Component getCustomEditor() { |
||||
return this.textField; |
||||
} |
||||
|
||||
public void validateValue() throws ValidationException { |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DateFormatEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/24 16:44 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.mainframe.widget.editors.AbstractPropertyEditor; |
||||
import com.fr.plugin.hrjf.items.DateFormatItems; |
||||
import com.fr.plugin.hrjf.pane.DateFormatPane; |
||||
|
||||
import java.awt.*; |
||||
import java.beans.PropertyChangeEvent; |
||||
import java.beans.PropertyChangeListener; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DateFormatEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DateFormatEditor extends AbstractPropertyEditor { |
||||
private final DateFormatPane dateFormatPane; |
||||
|
||||
public DateFormatEditor() { |
||||
this.dateFormatPane = new DateFormatPane(); |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.dateFormatPane.addPropertyChangeListener("value", new PropertyChangeListener() { |
||||
@Override |
||||
public void propertyChange(PropertyChangeEvent evt) { |
||||
com.fr.plugin.hrjf.editors.DateFormatEditor.this.firePropertyChanged(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public void validateValue() throws ValidationException { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
String value = this.dateFormatPane.update(); |
||||
return value; |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object value) { |
||||
if (StringKit.equals(String.valueOf(value), DateFormatItems.YEAR)) { |
||||
this.dateFormatPane.populate(0, 0); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.MONTH)) { |
||||
this.dateFormatPane.populate(0, 1); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATE)) { |
||||
this.dateFormatPane.populate(0, 2); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATES)) { |
||||
this.dateFormatPane.populate(0, 3); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.WEEK)) { |
||||
this.dateFormatPane.populate(0, 4); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATERANGE)) { |
||||
this.dateFormatPane.populate(0, 5); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATERANGEWEEK)) { |
||||
this.dateFormatPane.populate(0, 6); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATERANGEMONTH)) { |
||||
this.dateFormatPane.populate(0, 7); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATETIME)) { |
||||
this.dateFormatPane.populate(1, 0); |
||||
} else if (StringKit.equals(String.valueOf(value), DateFormatItems.DATETIMERANGE)) { |
||||
this.dateFormatPane.populate(1, 1); |
||||
} else { |
||||
this.dateFormatPane.populate(0, 2); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Component getCustomEditor() { |
||||
return this.dateFormatPane; |
||||
} |
||||
} |
@ -0,0 +1,80 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DateTypeEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/15 8:53 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.mainframe.widget.editors.AbstractPropertyEditor; |
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
import java.awt.*; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DateTypeEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DateTypeEditor extends AbstractPropertyEditor { |
||||
public static final String DATE = "date"; |
||||
public static final String DATETIME = "datetime"; |
||||
private static final Map<String, String> ITEMS = new HashMap<String, String>() { |
||||
{ |
||||
put(DesignKit.i18nText("Plugin-hrjf-Date_Type_Date"), DATE); |
||||
put(DesignKit.i18nText("Plugin-hrjf-Date_Type_DateTime"), DATETIME); |
||||
} |
||||
}; |
||||
protected UIButtonGroup<String> buttonGroup; |
||||
|
||||
|
||||
public DateTypeEditor() { |
||||
this.buttonGroup = new UIButtonGroup<>(ITEMS.keySet().toArray(new String[0])); |
||||
this.initButtonGroupLookAndFeel(); |
||||
} |
||||
|
||||
@Override |
||||
public void validateValue() throws ValidationException { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
if (ComparatorUtils.equals(this.buttonGroup.getSelectedIndex(), 0)) { |
||||
return DATE; |
||||
} else if (ComparatorUtils.equals(this.buttonGroup.getSelectedIndex(), 1)) { |
||||
return DATETIME; |
||||
} else { |
||||
return DATE; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object value) { |
||||
if (StringKit.equals(String.valueOf(value), DATE)) { |
||||
this.buttonGroup.setSelectedIndex(0); |
||||
} else if (StringKit.equals(String.valueOf(value), DATETIME)) { |
||||
this.buttonGroup.setSelectedIndex(1); |
||||
} else { |
||||
this.buttonGroup.setSelectedIndex(0); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Component getCustomEditor() { |
||||
return this.buttonGroup; |
||||
} |
||||
|
||||
private void initButtonGroupLookAndFeel() { |
||||
this.buttonGroup.addActionListener(e -> DateTypeEditor.this.firePropertyChanged()); |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: FirstDayOfWeekEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/15 8:41 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
import com.fr.design.mainframe.widget.editors.ComboEditor; |
||||
import com.fr.plugin.hrjf.items.FirstDayOfWeekItems; |
||||
|
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <FirstDayOfWeekEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class FirstDayOfWeekEditor extends ComboEditor { |
||||
public FirstDayOfWeekEditor() { |
||||
this((ItemProvider) (new FirstDayOfWeekItems())); |
||||
} |
||||
|
||||
public FirstDayOfWeekEditor(ItemProvider itemProvider) { |
||||
this(itemProvider.getItems()); |
||||
} |
||||
|
||||
public FirstDayOfWeekEditor(Item[] items) { |
||||
super(items); |
||||
} |
||||
|
||||
public FirstDayOfWeekEditor(Vector<Item> items) { |
||||
super(items); |
||||
} |
||||
|
||||
public Object getValue() { |
||||
Item selectedItem = (Item) this.comboBox.getSelectedItem(); |
||||
return selectedItem.getValue(); |
||||
} |
||||
|
||||
public void setValue(Object obj) { |
||||
Item var2 = new Item("", obj); |
||||
this.comboBox.setSelectedItem(var2); |
||||
} |
||||
} |
@ -0,0 +1,79 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ReturnTypeEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/12 11:16 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.mainframe.widget.editors.AbstractPropertyEditor; |
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
import java.awt.*; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ReturnTypeEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ReturnTypeEditor extends AbstractPropertyEditor { |
||||
public static final String STRING = "string"; |
||||
public static final String DATE = "date"; |
||||
private static final Map<String, String> ITEMS = new HashMap<String, String>() { |
||||
{ |
||||
put(DesignKit.i18nText("Plugin-hrjf-Design_Form_Return_Type_String"), STRING); |
||||
put(DesignKit.i18nText("Plugin-hrjf-Design_Form_Return_Type_Date"), DATE); |
||||
} |
||||
}; |
||||
protected UIButtonGroup<String> buttonGroup; |
||||
|
||||
public ReturnTypeEditor() { |
||||
this.buttonGroup = new UIButtonGroup<>(ITEMS.keySet().toArray(new String[0])); |
||||
this.initButtonGroupLookAndFeel(); |
||||
} |
||||
|
||||
@Override |
||||
public void validateValue() throws ValidationException { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
if (ComparatorUtils.equals(this.buttonGroup.getSelectedIndex(), 0)) { |
||||
return STRING; |
||||
} else if (ComparatorUtils.equals(this.buttonGroup.getSelectedIndex(), 1)) { |
||||
return DATE; |
||||
} else { |
||||
return STRING; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object value) { |
||||
if (StringKit.equals(String.valueOf(value), STRING)) { |
||||
this.buttonGroup.setSelectedIndex(0); |
||||
} else if (StringKit.equals(String.valueOf(value), DATE)) { |
||||
this.buttonGroup.setSelectedIndex(1); |
||||
} else { |
||||
this.buttonGroup.setSelectedIndex(0); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Component getCustomEditor() { |
||||
return this.buttonGroup; |
||||
} |
||||
|
||||
private void initButtonGroupLookAndFeel() { |
||||
this.buttonGroup.addActionListener(e -> ReturnTypeEditor.this.firePropertyChanged()); |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ShowDateEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/25 16:56 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; |
||||
import com.fr.plugin.hrjf.accessibles.AccessibleFormulaVueEditor; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ShowDateEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ShowDateEditor extends AccessiblePropertyEditor { |
||||
public ShowDateEditor() { |
||||
super(new AccessibleFormulaVueEditor()); |
||||
} |
||||
} |
@ -0,0 +1,157 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ShowDateFormulaEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/29 12:01 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.editor.editor.Editor; |
||||
import com.fr.design.formula.FormulaFactory; |
||||
import com.fr.design.formula.UIFormula; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ShowDateFormulaEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ShowDateFormulaEditor extends Editor<BaseFormula> { |
||||
private BaseFormula formula; |
||||
private UITextField currentTextField; |
||||
private ShowDateFormulaEditor.ShowPaneListener listener; |
||||
|
||||
public ShowDateFormulaEditor() { |
||||
this(""); |
||||
} |
||||
|
||||
public ShowDateFormulaEditor(String var1) { |
||||
this(var1, (BaseFormula) null); |
||||
} |
||||
|
||||
public ShowDateFormulaEditor(String var1, BaseFormula var2) { |
||||
this.formula = BaseFormula.createFormulaBuilder().build(); |
||||
this.listener = new ShowDateFormulaEditor.ShowPaneListener(); |
||||
if (var2 != null) { |
||||
this.formula = var2; |
||||
} |
||||
|
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
// JPanel var3 = FRGUIPaneFactory.createBorderLayout_S_Pane();
|
||||
this.currentTextField = new UITextField(); |
||||
this.currentTextField.setText(this.formula.getContent()); |
||||
// var3.add(this.currentTextField, "Center");
|
||||
this.currentTextField.setEditable(false); |
||||
this.currentTextField.addMouseListener(this.listener); |
||||
// this.add(var3, "Center");
|
||||
this.add(this.currentTextField, "Center"); |
||||
this.setName(var1); |
||||
} |
||||
|
||||
public void setColumns(int var1) { |
||||
this.currentTextField.setColumns(var1); |
||||
} |
||||
|
||||
public void selected() { |
||||
this.showFormulaPane(); |
||||
} |
||||
|
||||
public void setEnabled(boolean var1) { |
||||
super.setEnabled(var1); |
||||
this.currentTextField.setEnabled(var1); |
||||
} |
||||
|
||||
protected void showFormulaPane() { |
||||
final UIFormula var1 = FormulaFactory.createFormulaPaneWhenReserveFormula(); |
||||
var1.populate(this.formula); |
||||
var1.showLargeWindow(SwingUtilities.getWindowAncestor(this), new DialogActionAdapter() { |
||||
public void doOk() { |
||||
ShowDateFormulaEditor.this.formula = var1.update(); |
||||
ShowDateFormulaEditor.this.setValue(ShowDateFormulaEditor.this.formula); |
||||
ShowDateFormulaEditor.this.fireStateChanged(); |
||||
} |
||||
}).setVisible(true); |
||||
} |
||||
|
||||
public BaseFormula getFormula() { |
||||
return this.formula; |
||||
} |
||||
|
||||
public UITextField getUITextField() { |
||||
return this.currentTextField; |
||||
} |
||||
|
||||
public BaseFormula getValue() { |
||||
return this.formula != null && "=".equals(this.formula.getContent()) ? null : this.formula; |
||||
} |
||||
|
||||
public void setValue(BaseFormula var1) { |
||||
if (var1 == null) { |
||||
var1 = BaseFormula.createFormulaBuilder().build(); |
||||
} |
||||
|
||||
this.formula = var1; |
||||
this.currentTextField.setText(var1.toString()); |
||||
} |
||||
|
||||
public void addDocumentListener(DocumentListener var1) { |
||||
this.currentTextField.getDocument().addDocumentListener(var1); |
||||
} |
||||
|
||||
public String getIconName() { |
||||
return "type_formula"; |
||||
} |
||||
|
||||
public boolean accept(Object var1) { |
||||
return var1 instanceof BaseFormula; |
||||
} |
||||
|
||||
public void reset() { |
||||
this.currentTextField.setText("="); |
||||
this.formula = BaseFormula.createFormulaBuilder().build(); |
||||
} |
||||
|
||||
public void clearData() { |
||||
this.reset(); |
||||
} |
||||
|
||||
public void enableEditor(boolean var1) { |
||||
this.setEnabled(var1); |
||||
this.currentTextField.setEnabled(var1); |
||||
if (!var1) { |
||||
this.currentTextField.removeMouseListener(this.listener); |
||||
} else { |
||||
int var2 = this.currentTextField.getMouseListeners().length; |
||||
|
||||
for (int var3 = 0; var3 < var2; ++var3) { |
||||
this.currentTextField.removeMouseListener(this.listener); |
||||
} |
||||
|
||||
this.currentTextField.addMouseListener(this.listener); |
||||
} |
||||
|
||||
} |
||||
|
||||
private class ShowPaneListener extends MouseAdapter { |
||||
private ShowPaneListener() { |
||||
} |
||||
|
||||
public void mousePressed(MouseEvent var1) { |
||||
if (ShowDateFormulaEditor.this.currentTextField.isEnabled()) { |
||||
ShowDateFormulaEditor.this.showFormulaPane(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DateFormatEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/15 10:10 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
import com.fr.design.mainframe.widget.editors.ComboEditor; |
||||
import com.fr.plugin.hrjf.items.DateFormatItems; |
||||
|
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DateFormatEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class VueDateFormatEditor extends ComboEditor { |
||||
public VueDateFormatEditor() { |
||||
this((ItemProvider) (new DateFormatItems())); |
||||
} |
||||
|
||||
public VueDateFormatEditor(ItemProvider itemProvider) { |
||||
this(itemProvider.getItems()); |
||||
} |
||||
|
||||
public VueDateFormatEditor(Item[] items) { |
||||
super(items); |
||||
} |
||||
|
||||
public VueDateFormatEditor(Vector<Item> items) { |
||||
super(items); |
||||
} |
||||
|
||||
public Object getValue() { |
||||
Item selectedItem = (Item) this.comboBox.getSelectedItem(); |
||||
return selectedItem.getValue(); |
||||
} |
||||
|
||||
public void setValue(Object obj) { |
||||
Item var2 = new Item("", obj); |
||||
this.comboBox.setSelectedItem(var2); |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DateTimeFormatEditor |
||||
* Author: Louis |
||||
* Date: 2021/11/15 10:54 |
||||
*/ |
||||
package com.fr.plugin.hrjf.editors; |
||||
|
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
import com.fr.design.mainframe.widget.editors.ComboEditor; |
||||
import com.fr.plugin.hrjf.items.DateTimeFormatItems; |
||||
|
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DateTimeFormatEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class VueDateTimeFormatEditor extends ComboEditor { |
||||
public VueDateTimeFormatEditor() { |
||||
this((ItemProvider) (new DateTimeFormatItems())); |
||||
} |
||||
|
||||
public VueDateTimeFormatEditor(ItemProvider itemProvider) { |
||||
this(itemProvider.getItems()); |
||||
} |
||||
|
||||
public VueDateTimeFormatEditor(Item[] items) { |
||||
super(items); |
||||
} |
||||
|
||||
public VueDateTimeFormatEditor(Vector<Item> items) { |
||||
super(items); |
||||
} |
||||
|
||||
public Object getValue() { |
||||
Item selectedItem = (Item) this.comboBox.getSelectedItem(); |
||||
return selectedItem.getValue(); |
||||
} |
||||
|
||||
public void setValue(Object obj) { |
||||
Item var2 = new Item("", obj); |
||||
this.comboBox.setSelectedItem(var2); |
||||
} |
||||
} |
@ -0,0 +1,58 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DateFormatItems |
||||
* Author: Louis |
||||
* Date: 2021/11/15 10:11 |
||||
*/ |
||||
package com.fr.plugin.hrjf.items; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DateFormatItems> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DateFormatItems implements ItemProvider { |
||||
public static final String DATE = "date"; |
||||
public static final String YEAR = "year"; |
||||
public static final String MONTH = "month"; |
||||
public static final String DATES = "dates"; |
||||
public static final String WEEK = "week"; |
||||
public static final String DATERANGE = "daterange"; |
||||
public static final String DATERANGEWEEK = "daterangeweek"; |
||||
public static final String DATERANGEMONTH = "daterangemonth"; |
||||
public static final String DATETIME = "datetime"; |
||||
public static final String DATETIMERANGE = "datetimerange"; |
||||
public static Item[] DATE_ITEMS = new Item[]{ |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_Year"), YEAR), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_Month"), MONTH), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_Date"), DATE), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_Dates"), DATES), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_Week"), WEEK), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateRange"), DATERANGE), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateRangeWeek"), DATERANGEWEEK), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateRangeMonth"), DATERANGEMONTH), |
||||
// new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateTime"), "datetime"),
|
||||
// new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateTimeRange"), "datetimerange"),
|
||||
// new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateRange"), "daterange"),
|
||||
}; |
||||
public static Item[] TIME_ITEMS = new Item[]{ |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateTime"), DATETIME), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateTimeRange"), DATETIMERANGE), |
||||
// new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateRange"), "daterange"),
|
||||
}; |
||||
|
||||
public DateFormatItems() { |
||||
} |
||||
|
||||
@Override |
||||
public Item[] getItems() { |
||||
return DATE_ITEMS; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DateTimeFormatItems |
||||
* Author: Louis |
||||
* Date: 2021/11/15 10:55 |
||||
*/ |
||||
package com.fr.plugin.hrjf.items; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DateTimeFormatItems> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DateTimeFormatItems implements ItemProvider { |
||||
public static Item[] DATETIME_ITEMS = new Item[]{ |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateTime"), "datetime"), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateTimeRange"), "datetimerange"), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Date_Format_DateRange"), "daterange"), |
||||
}; |
||||
|
||||
public DateTimeFormatItems() { |
||||
} |
||||
|
||||
@Override |
||||
public Item[] getItems() { |
||||
return DATETIME_ITEMS; |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: FirstDayOfWeekItems |
||||
* Author: Louis |
||||
* Date: 2021/11/15 8:42 |
||||
*/ |
||||
package com.fr.plugin.hrjf.items; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <FirstDayOfWeekItems> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class FirstDayOfWeekItems implements ItemProvider { |
||||
public static final int SUNDAY = 7; |
||||
public static Item[] VALUE_ITEMS = new Item[]{ |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Monday"), 1), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Tuesday"), 2), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Wednesday"), 3), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Thursday"), 4), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Friday"), 5), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Saturday"), 6), |
||||
new Item(DesignKit.i18nText("Plugin-hrjf-Week_Start_Date_Sunday"), SUNDAY), |
||||
}; |
||||
|
||||
public FirstDayOfWeekItems() { |
||||
} |
||||
|
||||
@Override |
||||
public Item[] getItems() { |
||||
return VALUE_ITEMS; |
||||
} |
||||
|
||||
public static UIComboBox getUIComboBox() { |
||||
return initUIComboBox(VALUE_ITEMS); |
||||
} |
||||
|
||||
private static UIComboBox initUIComboBox(Item[] items) { |
||||
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
||||
for (Item item : items) { |
||||
model.addElement(item); |
||||
} |
||||
return new UIComboBox(model); |
||||
} |
||||
} |
@ -0,0 +1,185 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ReturnFormatPane |
||||
* Author: Louis |
||||
* Date: 2021/11/24 16:47 |
||||
*/ |
||||
package com.fr.plugin.hrjf.pane; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.plugin.hrjf.items.DateFormatItems; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
import static com.fr.design.layout.FRGUIPaneFactory.createBorderLayout; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ReturnFormatPane> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DateFormatPane extends JPanel { |
||||
private CardLayout cardLayout; |
||||
private JPanel customPane; |
||||
private String[] tabTitles; |
||||
private UIComboBox currentFormatComboBox; |
||||
private UIComboBox dateFormatComboBox; |
||||
private UIComboBox timeFormatComboBox; |
||||
private UIButtonGroup<String> formatHeadGroup; |
||||
|
||||
public DateFormatPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(createBorderLayout()); |
||||
this.dateFormatComboBox = initUIComboBox(DateFormatItems.DATE_ITEMS); |
||||
this.dateFormatComboBox.setSelectedIndex(2); |
||||
this.dateFormatComboBox.addActionListener(e -> this.firePropertyChange("dateFormatValue", null, this.update())); |
||||
this.timeFormatComboBox = initUIComboBox(DateFormatItems.TIME_ITEMS); |
||||
this.timeFormatComboBox.setSelectedIndex(0); |
||||
this.timeFormatComboBox.addActionListener(e -> this.firePropertyChange("dateFormatValue", null, this.update())); |
||||
this.cardLayout = new CardLayout(); |
||||
this.customPane = new JPanel(cardLayout); |
||||
JPanel dateFormatPane = createFormatPane(dateFormatComboBox); |
||||
JPanel timeFormatPane = createFormatPane(timeFormatComboBox); |
||||
customPane.add(dateFormatPane, DesignKit.i18nText("Plugin-hrjf-Date_Type_Date")); |
||||
customPane.add(timeFormatPane, DesignKit.i18nText("Plugin-hrjf-Date_Type_DateTime")); |
||||
this.tabTitles = new String[]{DesignKit.i18nText("Plugin-hrjf-Date_Type_Date"), DesignKit.i18nText("Plugin-hrjf-Date_Type_DateTime")}; |
||||
this.formatHeadGroup = new UIButtonGroup<>(new String[]{DesignKit.i18nText("Plugin-hrjf-Date_Type_Date"), DesignKit.i18nText("Plugin-hrjf-Date_Type_DateTime")}); |
||||
this.formatHeadGroup.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
int newSelectedIndex = formatHeadGroup.getSelectedIndex(); |
||||
cardLayout.show(customPane, tabTitles[newSelectedIndex]); |
||||
if (newSelectedIndex == 0) { |
||||
currentFormatComboBox = dateFormatComboBox; |
||||
} else { |
||||
currentFormatComboBox = timeFormatComboBox; |
||||
} |
||||
} |
||||
}); |
||||
this.add(formatHeadGroup, BorderLayout.NORTH); |
||||
this.add(customPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JPanel createFormatPane(UIComboBox formatComboBox) { |
||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
jPanel.add(formatComboBox, BorderLayout.CENTER); |
||||
return jPanel; |
||||
} |
||||
|
||||
private UIComboBox initUIComboBox(Item[] items) { |
||||
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
||||
for (Item item : items) { |
||||
model.addElement(item); |
||||
} |
||||
return new UIComboBox(model); |
||||
} |
||||
|
||||
public void populate(String dateFormat) { |
||||
if (StringKit.equals(dateFormat, DateFormatItems.YEAR)) { |
||||
this.populate(0, 0); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.MONTH)) { |
||||
this.populate(0, 1); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATE)) { |
||||
this.populate(0, 2); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATES)) { |
||||
this.populate(0, 3); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.WEEK)) { |
||||
this.populate(0, 4); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATERANGE)) { |
||||
this.populate(0, 5); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATERANGEWEEK)) { |
||||
this.populate(0, 6); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATERANGEMONTH)) { |
||||
this.populate(0, 7); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATETIME)) { |
||||
this.populate(1, 0); |
||||
} else if (StringKit.equals(dateFormat, DateFormatItems.DATETIMERANGE)) { |
||||
this.populate(1, 1); |
||||
} else { |
||||
this.populate(0, 2); |
||||
} |
||||
} |
||||
|
||||
public void populate(int formatHead, int formatIndex) { |
||||
this.formatHeadGroup.setSelectedIndex(formatHead); |
||||
if (ComparatorUtils.equals(formatHead, 0)) { |
||||
this.cardLayout.show(this.customPane, this.tabTitles[formatHead]); |
||||
this.currentFormatComboBox = this.dateFormatComboBox; |
||||
this.dateFormatComboBox.setSelectedIndex(formatIndex); |
||||
this.timeFormatComboBox.setSelectedIndex(0); |
||||
} else if (ComparatorUtils.equals(formatHead, 1)) { |
||||
this.cardLayout.show(this.customPane, this.tabTitles[formatHead]); |
||||
this.currentFormatComboBox = this.timeFormatComboBox; |
||||
this.dateFormatComboBox.setSelectedIndex(0); |
||||
this.timeFormatComboBox.setSelectedIndex(formatIndex); |
||||
} |
||||
} |
||||
|
||||
public String update() { |
||||
if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 0)) { |
||||
return DateFormatItems.YEAR; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 1)) { |
||||
return DateFormatItems.MONTH; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 2)) { |
||||
return DateFormatItems.DATE; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 3)) { |
||||
return DateFormatItems.DATES; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 4)) { |
||||
return DateFormatItems.WEEK; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 5)) { |
||||
return DateFormatItems.DATERANGE; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 6)) { |
||||
return DateFormatItems.DATERANGEWEEK; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 7)) { |
||||
return DateFormatItems.DATERANGEMONTH; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 1) && ComparatorUtils.equals(this.timeFormatComboBox.getSelectedIndex(), 0)) { |
||||
return DateFormatItems.DATETIME; |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 1) && ComparatorUtils.equals(this.timeFormatComboBox.getSelectedIndex(), 1)) { |
||||
return DateFormatItems.DATETIMERANGE; |
||||
} else { |
||||
return DateFormatItems.DATE; |
||||
} |
||||
} |
||||
|
||||
public void update(VueDateEditor dateEditor) { |
||||
if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 0)) { |
||||
dateEditor.setDateFormat(DateFormatItems.YEAR); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 1)) { |
||||
dateEditor.setDateFormat(DateFormatItems.MONTH); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 2)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATE); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 3)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATES); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 4)) { |
||||
dateEditor.setDateFormat(DateFormatItems.WEEK); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 5)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATERANGE); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 6)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATERANGEWEEK); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 0) && ComparatorUtils.equals(this.dateFormatComboBox.getSelectedIndex(), 7)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATERANGEMONTH); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 1) && ComparatorUtils.equals(this.timeFormatComboBox.getSelectedIndex(), 0)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATETIME); |
||||
} else if (ComparatorUtils.equals(this.formatHeadGroup.getSelectedIndex(), 1) && ComparatorUtils.equals(this.timeFormatComboBox.getSelectedIndex(), 1)) { |
||||
dateEditor.setDateFormat(DateFormatItems.DATETIMERANGE); |
||||
} else { |
||||
dateEditor.setDateFormat(DateFormatItems.DATE); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,220 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ReturnFormatPane |
||||
* Author: Louis |
||||
* Date: 2021/11/29 15:01 |
||||
*/ |
||||
package com.fr.plugin.hrjf.pane; |
||||
|
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.design.editor.editor.*; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.widget.editors.DataBindingEditor; |
||||
import com.fr.design.mainframe.widget.editors.DataTableEditor; |
||||
import com.fr.design.mainframe.widget.editors.ServerDataBindingEditor; |
||||
import com.fr.design.mainframe.widget.editors.ServerDataTableEditor; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.plugin.hrjf.items.DateFormatItems; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ReturnFormatPane> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ReturnFormatPane extends JPanel { |
||||
private UIButtonGroup widgetValueHead; |
||||
private Editor[] editor; |
||||
private JPanel customPane; |
||||
private CardLayout cardLayout; |
||||
|
||||
public ReturnFormatPane() { |
||||
this.editor = createWidgetValueEditor(new int[]{1, 3}, true); |
||||
this.setLayout(new BorderLayout(0, 4)); |
||||
this.cardLayout = new CardLayout(); |
||||
this.customPane = new JPanel(this.cardLayout); |
||||
String[] editorNames = new String[this.editor.length]; |
||||
for (int i = 0; i < this.editor.length; ++i) { |
||||
this.customPane.add(this.editor[i], this.editor[i].getName()); |
||||
editorNames[i] = this.editor[i].getName(); |
||||
} |
||||
this.widgetValueHead = new UIButtonGroup(editorNames); |
||||
this.add(this.widgetValueHead, BorderLayout.NORTH); |
||||
this.add(this.customPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public static Editor createWidgetValueEditorByType(int editorType, boolean var1) { |
||||
switch (editorType) { |
||||
case 0: |
||||
return new DoubleEditor(); |
||||
case 1: |
||||
return new TextEditor(); |
||||
case 2: |
||||
return (Editor) (var1 ? new ServerDataBindingEditor() : new DataBindingEditor()); |
||||
case 3: |
||||
return new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); |
||||
case 4: |
||||
return new DateEditor(true, Toolkit.i18nText("Fine-Design_Basic_Date")); |
||||
case 5: |
||||
return new BooleanEditor(false); |
||||
case 6: |
||||
return (Editor) (var1 ? new ServerDataTableEditor() : new DataTableEditor()); |
||||
default: |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public static Editor[] createWidgetValueEditor(int[] editorTypes, boolean var1) { |
||||
Editor[] editors = new Editor[editorTypes.length]; |
||||
for (int var4 = 0; var4 < editorTypes.length; ++var4) { |
||||
editors[var4] = createWidgetValueEditorByType(editorTypes[var4], var1); |
||||
} |
||||
return editors; |
||||
} |
||||
|
||||
public void attributeChange() { |
||||
int var1 = this.widgetValueHead.getSelectedIndex(); |
||||
if (var1 == -1) { |
||||
var1 = 0; |
||||
this.widgetValueHead.setSelectedIndex(var1); |
||||
} |
||||
|
||||
if (ComparatorUtils.equals(this.editor[var1].getName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Field"))) { |
||||
this.customPane.setPreferredSize(new Dimension(100, 47)); |
||||
} else { |
||||
this.customPane.setPreferredSize(new Dimension(100, 20)); |
||||
} |
||||
|
||||
this.cardLayout.show(this.customPane, this.editor[var1].getName()); |
||||
} |
||||
|
||||
public void update(VueDateEditor dateEditor, boolean isShowDate) { |
||||
this.attributeChange(); |
||||
int selectedIndex = this.widgetValueHead.getSelectedIndex(); |
||||
Editor editor = this.editor[selectedIndex]; |
||||
Object value = editor.getValue(); |
||||
if (isShowDate) { |
||||
updateShowDate(dateEditor, value); |
||||
} else { |
||||
updateReturnFormat(dateEditor, value); |
||||
} |
||||
} |
||||
|
||||
private void updateShowDate(VueDateEditor dateEditor, Object value) { |
||||
if (value == null) { |
||||
return; |
||||
} |
||||
if (value instanceof BaseFormula) { |
||||
dateEditor.setShowDate(StringKit.EMPTY); |
||||
dateEditor.setShowDateFM((BaseFormula) value); |
||||
} else if (value instanceof String) { |
||||
dateEditor.setShowDate(String.valueOf(value)); |
||||
dateEditor.setShowDateFM(null); |
||||
} else { |
||||
dateEditor.setShowDate(String.valueOf(value)); |
||||
dateEditor.setShowDateFM(null); |
||||
} |
||||
} |
||||
|
||||
private void updateReturnFormat(VueDateEditor dateEditor, Object value) { |
||||
if (value == null) { |
||||
return; |
||||
} |
||||
if (value instanceof BaseFormula) { |
||||
dateEditor.setReturnFormat(StringKit.EMPTY); |
||||
dateEditor.setReturnFormatFM((BaseFormula) value); |
||||
} else if (value instanceof String) { |
||||
dateEditor.setReturnFormat(String.valueOf(value)); |
||||
dateEditor.setReturnFormatFM(null); |
||||
} else { |
||||
dateEditor.setReturnFormat(String.valueOf(value)); |
||||
dateEditor.setReturnFormatFM(null); |
||||
} |
||||
} |
||||
|
||||
public void populateShowDate(VueDateEditor dateEditor) { |
||||
if (StringKit.isNotBlank(dateEditor.getShowDate())) { |
||||
this.populate(dateEditor.getShowDate()); |
||||
} else if (dateEditor.getShowDateFM() != null) { |
||||
this.populate(dateEditor.getShowDateFM()); |
||||
} |
||||
} |
||||
|
||||
public void populateShowDate(Object dateFormat) { |
||||
if (dateFormat == null) { |
||||
return; |
||||
} |
||||
String str; |
||||
switch (String.valueOf(dateFormat)) { |
||||
case DateFormatItems.YEAR: |
||||
str = "yyyy"; |
||||
break; |
||||
case DateFormatItems.MONTH: |
||||
str = "yyyy-MM"; |
||||
break; |
||||
case DateFormatItems.DATE: |
||||
str = "yyyy-MM-dd"; |
||||
break; |
||||
case DateFormatItems.WEEK: |
||||
str = "yyyy-WW"; |
||||
break; |
||||
case DateFormatItems.DATERANGE: |
||||
str = "yyyy-MM-dd"; |
||||
break; |
||||
case DateFormatItems.DATERANGEWEEK: |
||||
str = "yyyy-WW"; |
||||
break; |
||||
case DateFormatItems.DATERANGEMONTH: |
||||
str = "yyyy-MM"; |
||||
break; |
||||
case DateFormatItems.DATES: |
||||
str = "yyyy-MM-dd"; |
||||
break; |
||||
case DateFormatItems.DATETIME: |
||||
str = "yyyy-MM-dd hh:mm:ss"; |
||||
break; |
||||
case DateFormatItems.DATETIMERANGE: |
||||
str = "yyyy-MM-dd hh:mm:ss"; |
||||
break; |
||||
default: |
||||
str = "yyyy-MM-dd"; |
||||
} |
||||
this.populate(str); |
||||
} |
||||
|
||||
public void populateReturnFormat(VueDateEditor dateEditor) { |
||||
if (StringKit.isNotBlank(dateEditor.getReturnFormat())) { |
||||
this.populate(dateEditor.getReturnFormat()); |
||||
} else if (dateEditor.getReturnFormatFM() != null) { |
||||
this.populate(dateEditor.getReturnFormatFM()); |
||||
} |
||||
} |
||||
|
||||
public void populate(Object value) { |
||||
for (int i = 0; i < this.editor.length; ++i) { |
||||
if (this.editor[i].accept(value)) { |
||||
this.setCardValue(i, value); |
||||
break; |
||||
} |
||||
} |
||||
this.attributeChange(); |
||||
} |
||||
|
||||
private void setCardValue(int var1, Object var2) { |
||||
this.widgetValueHead.setSelectedIndex(var1); |
||||
this.editor[var1].setValue(var2); |
||||
for (int i = 0; i < this.editor.length; ++i) { |
||||
if (var1 != i) { |
||||
this.editor[i].setValue((Object) null); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,92 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: ShowDatePane |
||||
* Author: Louis |
||||
* Date: 2021/11/28 23:22 |
||||
*/ |
||||
package com.fr.plugin.hrjf.pane; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.formula.FormulaFactory; |
||||
import com.fr.design.formula.UIFormula; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <ShowDatePane> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ShowDatePane extends JPanel { |
||||
private final UITextField currentTextField; |
||||
private BaseFormula formula; |
||||
private ShowDatePane.ShowPaneListener listener; |
||||
|
||||
public ShowDatePane() { |
||||
this.formula = BaseFormula.createFormulaBuilder().build(); |
||||
this.listener = new ShowDatePane.ShowPaneListener(); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.currentTextField = new UITextField(); |
||||
this.currentTextField.setText(this.formula.getContent()); |
||||
this.currentTextField.setEditable(false); |
||||
this.currentTextField.addMouseListener(this.listener); |
||||
this.add(this.currentTextField, "Center"); |
||||
this.setName(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); |
||||
} |
||||
|
||||
protected void showFormulaPane() { |
||||
final UIFormula reserveFormula = FormulaFactory.createFormulaPaneWhenReserveFormula(); |
||||
reserveFormula.populate(this.formula); |
||||
reserveFormula.showLargeWindow(SwingUtilities.getWindowAncestor(this), new DialogActionAdapter() { |
||||
public void doOk() { |
||||
ShowDatePane.this.formula = reserveFormula.update(); |
||||
} |
||||
}).setVisible(true); |
||||
} |
||||
|
||||
public BaseFormula update() { |
||||
return this.formula != null && "=".equals(this.formula.getContent()) ? null : this.formula; |
||||
} |
||||
|
||||
public void populate(BaseFormula value) { |
||||
if (value == null) { |
||||
value = BaseFormula.createFormulaBuilder().build(); |
||||
} |
||||
this.formula = value; |
||||
this.currentTextField.setText(value.toString()); |
||||
} |
||||
|
||||
public BaseFormula getFormula() { |
||||
return this.formula; |
||||
} |
||||
|
||||
public UITextField getUITextField() { |
||||
return this.currentTextField; |
||||
} |
||||
|
||||
public void addDocumentListener(DocumentListener var1) { |
||||
this.currentTextField.getDocument().addDocumentListener(var1); |
||||
} |
||||
|
||||
private class ShowPaneListener extends MouseAdapter { |
||||
private ShowPaneListener() { |
||||
} |
||||
|
||||
public void mousePressed(MouseEvent var1) { |
||||
if (ShowDatePane.this.currentTextField.isEnabled()) { |
||||
ShowDatePane.this.showFormulaPane(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
@ -0,0 +1,157 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VueDateEditorDefinePane |
||||
* Author: Louis |
||||
* Date: 2021/11/28 12:52 |
||||
*/ |
||||
package com.fr.plugin.hrjf.pane; |
||||
|
||||
|
||||
import com.fanruan.api.design.ui.component.UITextArea; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.DirectWriteEditorDefinePane; |
||||
import com.fr.design.widget.ui.designer.WaterMarkDictPane; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.plugin.hrjf.items.FirstDayOfWeekItems; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.beans.PropertyChangeEvent; |
||||
import java.beans.PropertyChangeListener; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <表单和参数控件设置界面类VueDateEditorDefinePane> |
||||
* 在PluginMonitor中,通过FormWidgetDefinePaneFactoryBase注册 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class VueDateEditorFormDefinePane extends DirectWriteEditorDefinePane<VueDateEditor> { |
||||
private static final int CONTENT_PANE_COLUMNS = 25; |
||||
private WaterMarkDictPane waterMarkDictPane; |
||||
private FormWidgetValuePane formWidgetValuePane; |
||||
|
||||
private DateFormatPane dateFormatPane; |
||||
private ReturnFormatPane showDatePane; |
||||
private ReturnFormatPane returnFormatPane; |
||||
private UIComboBox firstDayOfWeekComboBox; |
||||
private UIButtonGroup<String> returnTypeComboBox; |
||||
private UITextField dateSeparatorTextField; |
||||
private UITextArea configurationItemTextArea; |
||||
|
||||
public VueDateEditorFormDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "VueDate"; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
this.waterMarkDictPane = new WaterMarkDictPane(); |
||||
// 控件值
|
||||
UILabel widgetValueLabel = new UILabel(Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); |
||||
widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.formWidgetValuePane = new FormWidgetValuePane(this.creator.toData(), false); |
||||
// 类型/格式
|
||||
UILabel formatLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Date_Format")); |
||||
formatLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.dateFormatPane = new DateFormatPane(); |
||||
this.dateFormatPane.addPropertyChangeListener("dateFormatValue", new PropertyChangeListener() { |
||||
@Override |
||||
public void propertyChange(PropertyChangeEvent evt) { |
||||
VueDateEditorFormDefinePane.this.showDatePane.populateShowDate(evt.getNewValue()); |
||||
} |
||||
}); |
||||
// 显示日期格式
|
||||
UILabel showDateLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Show_Date")); |
||||
showDateLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.showDatePane = new ReturnFormatPane(); |
||||
// 返回格式
|
||||
UILabel returnFormatLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Return_Format")); |
||||
returnFormatLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.returnFormatPane = new ReturnFormatPane(); |
||||
// 周起始日
|
||||
UILabel firstDayOfWeekLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Week_Start_Date")); |
||||
firstDayOfWeekLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.firstDayOfWeekComboBox = FirstDayOfWeekItems.getUIComboBox(); |
||||
// 返回类型
|
||||
UILabel returnTypeLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Return_Type")); |
||||
returnTypeLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.returnTypeComboBox = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Basic_Date"), Toolkit.i18nText("Fine-Design_Basic_String")}); |
||||
// 数组拼接符
|
||||
UILabel dateSeparatorLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Date_Separator")); |
||||
dateSeparatorLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.dateSeparatorTextField = new UITextField(); |
||||
// 配置项
|
||||
UILabel configurationItemLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Configuration_Item")); |
||||
configurationItemLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.configurationItemTextArea = new UITextArea(5, CONTENT_PANE_COLUMNS); |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Form_Label_Name")), this.labelNameTextField}, |
||||
{widgetValueLabel, this.formWidgetValuePane}, |
||||
{formatLabel, this.dateFormatPane}, |
||||
{showDateLabel, this.showDatePane}, |
||||
{returnFormatLabel, this.returnFormatPane}, |
||||
{firstDayOfWeekLabel, this.firstDayOfWeekComboBox}, |
||||
{returnTypeLabel, this.returnTypeComboBox}, |
||||
{dateSeparatorLabel, this.dateSeparatorTextField}, |
||||
{configurationItemLabel, this.configurationItemTextArea}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Form_WaterMark")), this.waterMarkDictPane}, |
||||
{new UILabel(Toolkit.i18nText("Fine-Design_Form_Font_Size")), this.fontSizePane} |
||||
}; |
||||
double[] rowSize = new double[]{p, p, p, p, p, p, p, p, p, p, p, p, p}; |
||||
double[] columnSize = new double[]{p, f}; |
||||
int[][] rowCount = new int[][]{{1, 1}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||
JPanel componentsPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); |
||||
JPanel firstContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
firstContentPane.add(componentsPane); |
||||
return firstContentPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubDirectWriteEditorBean(VueDateEditor dateEditor) { |
||||
this.waterMarkDictPane.populate(dateEditor); |
||||
this.formWidgetValuePane.populate(dateEditor); |
||||
this.dateFormatPane.populate(dateEditor.getDateFormat()); |
||||
this.showDatePane.populateShowDate(dateEditor); |
||||
this.returnFormatPane.populateReturnFormat(dateEditor); |
||||
this.firstDayOfWeekComboBox.setSelectedItem(new Item("", dateEditor.getFirstDayOfWeek())); |
||||
this.returnTypeComboBox.setSelectedIndex(dateEditor.getReturnTypeInt()); |
||||
this.dateSeparatorTextField.setText(dateEditor.getDateSeparator()); |
||||
this.configurationItemTextArea.setText(dateEditor.getConfigurationItem()); |
||||
} |
||||
|
||||
@Override |
||||
protected VueDateEditor updateSubDirectWriteEditorBean() { |
||||
VueDateEditor dateEditor = (VueDateEditor) this.creator.toData(); |
||||
this.waterMarkDictPane.update(dateEditor); |
||||
this.formWidgetValuePane.update(dateEditor); |
||||
this.dateFormatPane.update(dateEditor); |
||||
this.showDatePane.update(dateEditor, true); |
||||
this.returnFormatPane.update(dateEditor, false); |
||||
dateEditor.setFirstDayOfWeek(this.firstDayOfWeekComboBox.getSelectedItem()); |
||||
dateEditor.setReturnType(this.returnTypeComboBox.getSelectedIndex()); |
||||
dateEditor.setDateSeparator(this.dateSeparatorTextField.getText()); |
||||
dateEditor.setConfigurationItem(this.configurationItemTextArea.getText()); |
||||
return dateEditor; |
||||
} |
||||
} |
@ -0,0 +1,135 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VueDateEditorPane |
||||
* Author: Louis |
||||
* Date: 2021/11/8 16:38 |
||||
*/ |
||||
package com.fr.plugin.hrjf.pane; |
||||
|
||||
import com.fanruan.api.design.ui.component.UITextArea; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.DirectWriteEditorDefinePane; |
||||
import com.fr.plugin.hrjf.items.FirstDayOfWeekItems; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.beans.PropertyChangeEvent; |
||||
import java.beans.PropertyChangeListener; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <单元格日期控件设置界面类VueDateEditorPane> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class VueDateEditorPane extends DirectWriteEditorDefinePane<VueDateEditor> { |
||||
private static final int CONTENT_PANE_COLUMNS = 25; |
||||
|
||||
private DateFormatPane dateFormatPane; |
||||
private ReturnFormatPane showDatePane; |
||||
private ReturnFormatPane returnFormatPane; |
||||
private UIComboBox firstDayOfWeekComboBox; |
||||
private UIButtonGroup<String> returnTypeComboBox; |
||||
private UITextField dateSeparatorTextField; |
||||
private UITextArea configurationItemTextArea; |
||||
|
||||
public VueDateEditorPane() { |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "VueDate"; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setSecondContentPane() { |
||||
// 类型/格式
|
||||
UILabel formatLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Date_Format")); |
||||
formatLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.dateFormatPane = new DateFormatPane(); |
||||
this.dateFormatPane.addPropertyChangeListener("dateFormatValue", new PropertyChangeListener() { |
||||
@Override |
||||
public void propertyChange(PropertyChangeEvent evt) { |
||||
VueDateEditorPane.this.showDatePane.populateShowDate(evt.getNewValue()); |
||||
} |
||||
}); |
||||
// 显示日期格式
|
||||
UILabel showDateLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Show_Date")); |
||||
showDateLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.showDatePane = new ReturnFormatPane(); |
||||
// 返回格式
|
||||
UILabel returnFormatLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Return_Format")); |
||||
returnFormatLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.returnFormatPane = new ReturnFormatPane(); |
||||
// 周起始日
|
||||
UILabel firstDayOfWeekLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Week_Start_Date")); |
||||
firstDayOfWeekLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.firstDayOfWeekComboBox = FirstDayOfWeekItems.getUIComboBox(); |
||||
// 返回类型
|
||||
UILabel returnTypeLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Return_Type")); |
||||
returnTypeLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.returnTypeComboBox = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Basic_Date"), Toolkit.i18nText("Fine-Design_Basic_String")}); |
||||
// 数组拼接符
|
||||
UILabel dateSeparatorLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Date_Separator")); |
||||
dateSeparatorLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.dateSeparatorTextField = new UITextField(); |
||||
// 配置项
|
||||
UILabel configurationItemLabel = new UILabel(Toolkit.i18nText("Plugin-hrjf-Design_Form_Configuration_Item")); |
||||
configurationItemLabel.setVerticalAlignment(SwingConstants.TOP); |
||||
this.configurationItemTextArea = new UITextArea(5, CONTENT_PANE_COLUMNS); |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{formatLabel, this.dateFormatPane}, |
||||
new Component[]{showDateLabel, this.showDatePane}, |
||||
new Component[]{returnFormatLabel, this.returnFormatPane}, |
||||
new Component[]{firstDayOfWeekLabel, this.firstDayOfWeekComboBox}, |
||||
new Component[]{returnTypeLabel, this.returnTypeComboBox}, |
||||
new Component[]{dateSeparatorLabel, this.dateSeparatorTextField}, |
||||
new Component[]{dateSeparatorLabel, this.dateSeparatorTextField}, |
||||
new Component[]{configurationItemLabel, this.configurationItemTextArea}, |
||||
new Component[]{this.waterMarkDictPane, null} |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubDirectWriteEditorBean(VueDateEditor dateEditor) { |
||||
this.dateFormatPane.populate(dateEditor.getDateFormat()); |
||||
this.showDatePane.populateShowDate(dateEditor); |
||||
this.returnFormatPane.populateReturnFormat(dateEditor); |
||||
this.firstDayOfWeekComboBox.setSelectedItem(new Item("", dateEditor.getFirstDayOfWeek())); |
||||
this.returnTypeComboBox.setSelectedIndex(dateEditor.getReturnTypeInt()); |
||||
this.dateSeparatorTextField.setText(dateEditor.getDateSeparator()); |
||||
this.configurationItemTextArea.setText(dateEditor.getConfigurationItem()); |
||||
} |
||||
|
||||
@Override |
||||
protected VueDateEditor updateSubDirectWriteEditorBean() { |
||||
VueDateEditor dateEditor = new VueDateEditor(); |
||||
this.dateFormatPane.update(dateEditor); |
||||
this.showDatePane.update(dateEditor, true); |
||||
this.returnFormatPane.update(dateEditor, false); |
||||
dateEditor.setFirstDayOfWeek(this.firstDayOfWeekComboBox.getSelectedItem()); |
||||
dateEditor.setReturnType(this.returnTypeComboBox.getSelectedIndex()); |
||||
dateEditor.setDateSeparator(this.dateSeparatorTextField.getText()); |
||||
dateEditor.setConfigurationItem(this.configurationItemTextArea.getText()); |
||||
return dateEditor; |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VSCellWidgetOptionProvider |
||||
* Author: Louis |
||||
* Date: 2021/11/5 16:32 |
||||
*/ |
||||
package com.fr.plugin.hrjf.provider; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.fun.impl.AbstractCellWidgetOptionProvider; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.plugin.hrjf.pane.VueDateEditorPane; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
public class VSCellWidgetOptionProvider extends AbstractCellWidgetOptionProvider { |
||||
@Override |
||||
public Class<? extends Widget> classForWidget() { |
||||
return VueDateEditor.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends BasicBeanPane<? extends Widget>> appearanceForWidget() { |
||||
return VueDateEditorPane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForWidget() { |
||||
return "com/fr/design/images/buttonicon/widget/date_16.png"; |
||||
} |
||||
|
||||
@Override |
||||
public String nameForWidget() { |
||||
return "VUE日期控件"; |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VueFormOptionProvider |
||||
* Author: Louis |
||||
* Date: 2021/11/8 11:46 |
||||
*/ |
||||
package com.fr.plugin.hrjf.provider; |
||||
|
||||
import com.fr.design.fun.impl.AbstractFormWidgetOptionProvider; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.plugin.hrjf.creator.XVueDateEditor; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
public class VueFormOptionProvider extends AbstractFormWidgetOptionProvider { |
||||
|
||||
public VueFormOptionProvider() { |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends Widget> classForWidget() { |
||||
return VueDateEditor.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<?> appearanceForWidget() { |
||||
return XVueDateEditor.class; |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForWidget() { |
||||
return "com/fr/design/images/buttonicon/widget/date_16.png"; |
||||
} |
||||
|
||||
@Override |
||||
public String nameForWidget() { |
||||
return "VUE日期控件"; |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VueParameterWidgetOptionProvider |
||||
* Author: Louis |
||||
* Date: 2021/11/5 16:32 |
||||
*/ |
||||
package com.fr.plugin.hrjf.provider; |
||||
|
||||
import com.fr.design.fun.impl.AbstractParameterWidgetOptionProvider; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.plugin.hrjf.creator.XVueDateEditor; |
||||
import com.fr.plugin.hrjf.widget.VueDateEditor; |
||||
|
||||
public class VueParameterWidgetOptionProvider extends AbstractParameterWidgetOptionProvider { |
||||
|
||||
@Override |
||||
public Class<? extends Widget> classForWidget() { |
||||
return VueDateEditor.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<?> appearanceForWidget() { |
||||
return XVueDateEditor.class; |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForWidget() { |
||||
return "com/fr/design/images/buttonicon/widget/date_16.png"; |
||||
} |
||||
|
||||
@Override |
||||
public String nameForWidget() { |
||||
return "VUE日期控件"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,591 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: VueDateEditorWidget |
||||
* Author: Louis |
||||
* Date: 2021/11/5 16:32 |
||||
*/ |
||||
package com.fr.plugin.hrjf.widget; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.base.ParameterMapNameSpace; |
||||
import com.fr.base.Utils; |
||||
import com.fr.data.core.FormatField; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.form.FormUtils; |
||||
import com.fr.form.ui.DataControl; |
||||
import com.fr.form.ui.DirectWriteEditor; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.WidgetValue; |
||||
import com.fr.form.ui.concept.data.ValueInitializer; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.DateUtils; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.hrjf.editors.DateTypeEditor; |
||||
import com.fr.plugin.hrjf.editors.ReturnTypeEditor; |
||||
import com.fr.plugin.hrjf.items.FirstDayOfWeekItems; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.CommonUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.UtilEvalError; |
||||
import com.fr.stable.core.NodeVisitor; |
||||
import com.fr.stable.script.CalculatorProvider; |
||||
import com.fr.stable.web.Repository; |
||||
import com.fr.stable.web.SessionProvider; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Collections; |
||||
import java.util.Date; |
||||
import java.util.HashSet; |
||||
|
||||
import static com.fr.plugin.hrjf.creator.XVueDateEditor.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <VueDateEditor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class VueDateEditor extends DirectWriteEditor implements DataControl { |
||||
private static final long serialVersionUID = 1406480833692359017L; |
||||
public static String oldDateTimeWidgetTag = "com.fr.report.web.ui.DateTimeEditor"; |
||||
public static String oldDateTimeFormat = "yyyy-MM-dd HH:mm"; |
||||
public static final String SHOW_DATE_FM = "showDateFM"; |
||||
public static final String RETURN_FORMAT_FM = "returnFormatFM"; |
||||
private String startDate; |
||||
private String endDate; |
||||
private BaseFormula startDateFM; |
||||
private BaseFormula endDateFM; |
||||
private String formatText = "yyyy-MM-dd"; |
||||
private boolean returnDate = false; |
||||
private ValueInitializer widgetValue = new WidgetValue(); |
||||
// 日期类型和格式
|
||||
private String dateFormat = DateTypeEditor.DATE; |
||||
// 显示日期格式
|
||||
private String showDate; |
||||
private BaseFormula showDateFM; |
||||
// 返回格式
|
||||
private String returnFormat; |
||||
private BaseFormula returnFormatFM; |
||||
// 周起始日
|
||||
private int firstDayOfWeek = FirstDayOfWeekItems.SUNDAY; |
||||
// 返回类型
|
||||
private String returnType = ReturnTypeEditor.STRING; |
||||
// 数组拼接符
|
||||
private String dateSeparator = ","; |
||||
// 配置项
|
||||
private String configurationItem = StringKit.EMPTY; |
||||
|
||||
public VueDateEditor() { |
||||
} |
||||
|
||||
@Override |
||||
public String getXType() { |
||||
return "vue_datetime"; |
||||
} |
||||
|
||||
@Override |
||||
public String getFormatText() { |
||||
return this.formatText; |
||||
} |
||||
|
||||
public void setFormatText(String formatText) { |
||||
this.formatText = formatText; |
||||
} |
||||
|
||||
@Override |
||||
public int[] getValueType() { |
||||
return new int[]{4, 3, 2}; |
||||
} |
||||
|
||||
@Override |
||||
public ValueInitializer getWidgetValue() { |
||||
return this.widgetValue; |
||||
} |
||||
|
||||
@Override |
||||
public void setWidgetValue(ValueInitializer valueInitializer) { |
||||
this.widgetValue = valueInitializer; |
||||
} |
||||
|
||||
@Override |
||||
public String[] dependence(CalculatorProvider var1) { |
||||
HashSet var2 = new HashSet(); |
||||
if (this.widgetValue != null) { |
||||
Collections.addAll(var2, this.widgetValue.dependence(var1)); |
||||
} |
||||
|
||||
Collections.addAll(var2, FormUtils.getDependence(this.getStartDate(), var1)); |
||||
Collections.addAll(var2, FormUtils.getDependence(this.getEndDate(), var1)); |
||||
return (String[]) var2.toArray(new String[var2.size()]); |
||||
} |
||||
|
||||
public Object getStartDateValue(Calculator var1) throws Exception { |
||||
if (this.startDateFM != null) { |
||||
return var1.eval(this.startDateFM); |
||||
} else { |
||||
return this.startDate != null ? DateUtils.string2Date(this.startDate, true) : null; |
||||
} |
||||
} |
||||
|
||||
public Object getEndDateValue(Calculator var1) throws Exception { |
||||
if (this.endDateFM != null) { |
||||
return var1.eval(this.endDateFM); |
||||
} else { |
||||
return this.endDate != null ? DateUtils.string2Date(this.endDate, true) : null; |
||||
} |
||||
} |
||||
|
||||
public Object getStartDate() { |
||||
if (this.startDateFM != null) { |
||||
return this.startDateFM; |
||||
} else { |
||||
return this.startDate != null ? DateUtils.string2Date(this.startDate, true) : null; |
||||
} |
||||
} |
||||
|
||||
public void setStartDate(Object var1) { |
||||
if (var1 instanceof BaseFormula) { |
||||
this.startDateFM = (BaseFormula) var1; |
||||
this.startDate = null; |
||||
} else if (var1 instanceof Date) { |
||||
this.startDateFM = null; |
||||
this.startDate = DateUtils.getDate2Str("MM/dd/yyyy", (Date) var1); |
||||
} else { |
||||
this.startDateFM = null; |
||||
this.startDate = null; |
||||
} |
||||
|
||||
} |
||||
|
||||
public Object getEndDate() { |
||||
if (this.endDateFM != null) { |
||||
return this.endDateFM; |
||||
} else { |
||||
return this.endDate != null ? DateUtils.string2Date(this.endDate, true) : null; |
||||
} |
||||
} |
||||
|
||||
public void setEndDate(Object var1) { |
||||
if (var1 instanceof BaseFormula) { |
||||
this.endDateFM = (BaseFormula) var1; |
||||
this.endDate = null; |
||||
} else if (var1 instanceof Date) { |
||||
this.endDateFM = null; |
||||
this.endDate = DateUtils.getDate2Str("MM/dd/yyyy", (Date) var1); |
||||
} else { |
||||
this.endDateFM = null; |
||||
this.endDate = null; |
||||
} |
||||
|
||||
} |
||||
|
||||
public String getStartText() { |
||||
return this.startDate; |
||||
} |
||||
|
||||
public void setStartText(String var1) { |
||||
this.startDate = var1; |
||||
} |
||||
|
||||
public String getEndText() { |
||||
return this.endDate; |
||||
} |
||||
|
||||
public void setEndText(String var1) { |
||||
this.endDate = var1; |
||||
} |
||||
|
||||
public BaseFormula getStartDateFM() { |
||||
return this.startDateFM; |
||||
} |
||||
|
||||
public void setStartDateFM(BaseFormula var1) { |
||||
this.startDateFM = var1; |
||||
} |
||||
|
||||
public BaseFormula getEndDateFM() { |
||||
return this.endDateFM; |
||||
} |
||||
|
||||
public void setEndDateFM(BaseFormula var1) { |
||||
this.endDateFM = var1; |
||||
} |
||||
|
||||
public boolean isReturnDate() { |
||||
return this.returnDate; |
||||
} |
||||
|
||||
public void setReturnDate(boolean var1) { |
||||
this.returnDate = var1; |
||||
} |
||||
|
||||
@Override |
||||
public void createValueResult(CalculatorProvider var1, JSONObject var2) { |
||||
if (this.widgetValue != null) { |
||||
var1.setAttribute(Widget.NAME, this.getWidgetName().toUpperCase()); |
||||
Object var3 = this.getWidgetValue().executeResult(var1); |
||||
if (!this.returnDate && var3 instanceof Date && this.formatText != null) { |
||||
var3 = (new SimpleDateFormat(this.formatText)).format((Date) var3); |
||||
} |
||||
|
||||
var2.put(this.widgetName.toUpperCase(), var3 == null ? "" : var3); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public String getDataBindDefaultValue(CalculatorProvider var1) { |
||||
if (this.widgetValue == null) { |
||||
this.setWidgetValue(new WidgetValue()); |
||||
} |
||||
|
||||
Object var2 = this.getWidgetValue().executeResult(var1); |
||||
if (var2 == null) { |
||||
return null; |
||||
} else { |
||||
return var2 instanceof Date && this.formatText != null ? (new SimpleDateFormat(this.formatText)).format((Date) var2) : Utils.objectToString(var2); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject createJSONConfig(Repository repository, Calculator calculator, NodeVisitor nodeVisitor) throws JSONException { |
||||
JSONObject jsonObject = super.createJSONConfig(repository, calculator, nodeVisitor); |
||||
Object var5 = jsonObject.get("value"); |
||||
if (var5 == null) { |
||||
jsonObject.remove("value"); |
||||
} else if (var5 instanceof Date) { |
||||
jsonObject.put("value", (new JSONObject()).put("date_milliseconds", ((Date) var5).getTime())); |
||||
} |
||||
|
||||
if (StringUtils.isNotEmpty(this.formatText)) { |
||||
jsonObject.put("format", this.formatText); |
||||
if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), this.formatText)) { |
||||
jsonObject.put("customFormat", true); |
||||
} |
||||
} |
||||
|
||||
if (this.startDate != null) { |
||||
jsonObject.put("startDate", this.value2Config(this.startDate, calculator)); |
||||
} else if (this.startDateFM != null) { |
||||
try { |
||||
jsonObject.put("startDate", this.value2Config(calculator.evalValue(this.startDateFM.getContent()), calculator)); |
||||
} catch (UtilEvalError var7) { |
||||
LogKit.error(var7.getMessage(), var7); |
||||
} |
||||
} |
||||
|
||||
if (this.endDate != null) { |
||||
jsonObject.put("endDate", this.value2Config(this.endDate, calculator)); |
||||
} else if (this.endDateFM != null) { |
||||
try { |
||||
jsonObject.put("endDate", this.value2Config(calculator.evalValue(this.endDateFM.getContent()), calculator)); |
||||
} catch (UtilEvalError var6) { |
||||
LogKit.error(var6.getMessage(), var6); |
||||
} |
||||
} |
||||
|
||||
if (this.returnDate) { |
||||
jsonObject.put("returnDate", true); |
||||
} |
||||
|
||||
if (StringKit.isNotBlank(this.getDateFormat())) { |
||||
jsonObject.put(DATE_FORMAT, this.getDateFormat()); |
||||
} |
||||
|
||||
try { |
||||
if (StringKit.isNotBlank(this.getShowDate())) { |
||||
jsonObject.put(SHOW_DATE, this.getShowDate()); |
||||
} |
||||
if (!CommonUtils.isNull(this.getShowDateFM())) { |
||||
jsonObject.put(SHOW_DATE, calculator.evalValue(this.getShowDateFM())); |
||||
} |
||||
if (StringKit.isNotBlank(this.getReturnFormat())) { |
||||
jsonObject.put(RETURN_FORMAT, this.getReturnFormat()); |
||||
} |
||||
if (!CommonUtils.isNull(this.getReturnFormatFM())) { |
||||
jsonObject.put(RETURN_FORMAT, calculator.evalValue(this.getReturnFormatFM())); |
||||
} |
||||
} catch (UtilEvalError e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
jsonObject.put(FIRST_DAY_OF_WEEK, this.getFirstDayOfWeek()); |
||||
|
||||
if (StringKit.isNotBlank(this.getReturnType())) { |
||||
jsonObject.put(RETURN_TYPE, this.getReturnType()); |
||||
} |
||||
|
||||
if (StringKit.isNotBlank(this.getDateSeparator())) { |
||||
jsonObject.put(DATE_SEPARATOR, this.getDateSeparator()); |
||||
} |
||||
|
||||
if (StringKit.isNotBlank(this.getConfigurationItem())) { |
||||
jsonObject.put(CONFIGURATION_ITEM, this.getConfigurationItem()); |
||||
} |
||||
|
||||
String[] var9 = this.dependence(calculator); |
||||
if (!ArrayUtils.isEmpty(var9)) { |
||||
jsonObject.put("dependence", var9); |
||||
} |
||||
|
||||
return jsonObject; |
||||
} |
||||
|
||||
@Override |
||||
public JSONArray createJSONData(SessionProvider var1, Calculator var2, HttpServletRequest var3) throws Exception { |
||||
JSONArray var4 = super.createJSONData(var1, var2, var3); |
||||
ParameterMapNameSpace var5 = ParameterMapNameSpace.create(var1.getOriginalParameterMap()); |
||||
DependenceNameSpace var6 = new DependenceNameSpace(WebUtils.getHTTPRequestParameter(var3, "dependence")); |
||||
var2.pushNameSpace(var5); |
||||
var2.pushNameSpace(var6); |
||||
JSONObject var7 = JSONObject.create(); |
||||
var7.put("startDate", this.value2Config(this.getStartDateValue(var2), var2)); |
||||
var7.put("endDate", this.value2Config(this.getEndDateValue(var2), var2)); |
||||
var4.put(var7); |
||||
var2.removeNameSpace(var5); |
||||
var2.removeNameSpace(var6); |
||||
return var4; |
||||
} |
||||
|
||||
@Override |
||||
public Object value2Config(Object var1, CalculatorProvider var2) { |
||||
String var3; |
||||
if (var1 instanceof Date) { |
||||
var3 = (new SimpleDateFormat(this.formatText)).format((Date) var1); |
||||
} else if (var1 == null) { |
||||
var3 = ""; |
||||
} else { |
||||
String var4 = Utils.objectToString(var1); |
||||
|
||||
try { |
||||
Date var5 = DateUtils.string2Date(var4, false); |
||||
var3 = (new SimpleDateFormat(this.formatText)).format(var5); |
||||
} catch (Exception var6) { |
||||
var3 = var1.toString(); |
||||
} |
||||
} |
||||
|
||||
return var3; |
||||
} |
||||
|
||||
@Override |
||||
public String[] supportedEvents() { |
||||
return new String[]{"afterinit", "afteredit", "stopedit"}; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
return obj instanceof VueDateEditor && super.equals(obj) |
||||
&& ComparatorUtils.equals(this.startDate, ((VueDateEditor) obj).startDate) |
||||
&& ComparatorUtils.equals(this.endDate, ((VueDateEditor) obj).endDate) |
||||
&& this.returnDate == ((VueDateEditor) obj).returnDate; |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
super.readXML(reader); |
||||
if (reader.isChildNode()) { |
||||
String tagName = reader.getTagName(); |
||||
if ("DateAttr".equals(tagName)) { |
||||
String var3 = null; |
||||
if ((var3 = reader.getAttrAsString("format", (String) null)) != null) { |
||||
this.setFormatText(var3); |
||||
} |
||||
|
||||
if ((var3 = reader.getAttrAsString("start", (String) null)) != null) { |
||||
this.startDate = var3; |
||||
} else if ((var3 = reader.getAttrAsString("startdatefm", (String) null)) != null) { |
||||
this.startDateFM = BaseFormula.createFormulaBuilder().build(var3); |
||||
} |
||||
|
||||
if ((var3 = reader.getAttrAsString("end", (String) null)) != null) { |
||||
this.endDate = var3; |
||||
} else if ((var3 = reader.getAttrAsString("enddatefm", (String) null)) != null) { |
||||
this.endDateFM = BaseFormula.createFormulaBuilder().build(var3); |
||||
} |
||||
this.returnDate = reader.getAttrAsBoolean("returnDate", false); |
||||
this.setShowDate(reader.getAttrAsString(SHOW_DATE, StringKit.EMPTY)); |
||||
this.setShowDateFM(BaseFormula.createFormulaBuilder().build(reader.getAttrAsString(SHOW_DATE_FM, StringKit.EMPTY))); |
||||
this.setReturnFormat(reader.getAttrAsString(RETURN_FORMAT, StringKit.EMPTY)); |
||||
this.setReturnFormatFM(BaseFormula.createFormulaBuilder().build(reader.getAttrAsString(RETURN_FORMAT_FM, StringKit.EMPTY))); |
||||
this.setFirstDayOfWeek(reader.getAttrAsInt(FIRST_DAY_OF_WEEK, FirstDayOfWeekItems.SUNDAY)); |
||||
this.setReturnType(reader.getAttrAsString(RETURN_TYPE, ReturnTypeEditor.STRING)); |
||||
this.setDateFormat(reader.getAttrAsString(DATE_FORMAT, DateTypeEditor.DATE)); |
||||
this.setDateSeparator(reader.getAttrAsString(DATE_SEPARATOR, StringKit.EMPTY)); |
||||
this.setConfigurationItem(reader.getAttrAsString(CONFIGURATION_ITEM, StringKit.EMPTY)); |
||||
} else if ("widgetValue".equals(tagName)) { |
||||
this.widgetValue = new WidgetValue(); |
||||
reader.readXMLObject(this.widgetValue); |
||||
} |
||||
} |
||||
if (ComparatorUtils.equals(reader.getAttrAsString("class", (String) null), oldDateTimeWidgetTag) && reader.getAttrAsString("format", (String) null) == null) { |
||||
this.setFormatText(oldDateTimeFormat); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
super.writeXML(writer); |
||||
writer.startTAG("DateAttr"); |
||||
if (!ComparatorUtils.equals(this.getFormatText(), this.getDefaultFormatText())) { |
||||
writer.attr("format", this.getFormatText()); |
||||
} |
||||
|
||||
if (StringUtils.isNotEmpty(this.startDate)) { |
||||
writer.attr("start", this.startDate); |
||||
} else if (this.startDateFM != null) { |
||||
writer.attr("startdatefm", this.startDateFM.getContent()); |
||||
} |
||||
|
||||
if (StringUtils.isNotEmpty(this.endDate)) { |
||||
writer.attr("end", this.endDate); |
||||
} else if (this.endDateFM != null) { |
||||
writer.attr("enddatefm", this.endDateFM.getContent()); |
||||
} |
||||
|
||||
if (this.returnDate) { |
||||
writer.attr("returnDate", true); |
||||
} |
||||
|
||||
if (StringKit.isNotBlank(this.getDateFormat())) { |
||||
writer.attr(DATE_FORMAT, this.getDateFormat()); |
||||
} |
||||
if (StringKit.isNotBlank(this.getShowDate())) { |
||||
writer.attr(SHOW_DATE, this.getShowDate()); |
||||
} |
||||
if (this.getShowDateFM() != null && StringKit.isNotBlank(this.getShowDateFM().getContent())) { |
||||
writer.attr(SHOW_DATE_FM, this.getShowDateFM().getContent()); |
||||
} |
||||
if (StringKit.isNotBlank(this.getReturnFormat())) { |
||||
writer.attr(RETURN_FORMAT, this.getReturnFormat()); |
||||
} |
||||
if (this.getReturnFormatFM() != null && StringKit.isNotBlank(this.getReturnFormatFM().getContent())) { |
||||
writer.attr(RETURN_FORMAT_FM, this.getReturnFormatFM().getContent()); |
||||
} |
||||
writer.attr(FIRST_DAY_OF_WEEK, this.getFirstDayOfWeek()); |
||||
if (StringKit.isNotBlank(this.getReturnType())) { |
||||
writer.attr(RETURN_TYPE, this.getReturnType()); |
||||
} |
||||
if (StringKit.isNotBlank(this.getDateSeparator())) { |
||||
writer.attr(DATE_SEPARATOR, this.getDateSeparator()); |
||||
} |
||||
if (StringKit.isNotBlank(this.getConfigurationItem())) { |
||||
writer.attr(CONFIGURATION_ITEM, this.getConfigurationItem()); |
||||
} |
||||
|
||||
writer.end(); |
||||
if (this.widgetValue != null) { |
||||
this.widgetValue.writeXML(writer); |
||||
} |
||||
} |
||||
|
||||
protected String getDefaultFormatText() { |
||||
return "yyyy-MM-dd"; |
||||
} |
||||
|
||||
public String getShowDate() { |
||||
return showDate; |
||||
} |
||||
|
||||
public void setShowDate(String showDate) { |
||||
this.showDate = showDate; |
||||
} |
||||
|
||||
public BaseFormula getShowDateFM() { |
||||
return showDateFM; |
||||
} |
||||
|
||||
public void setShowDateFM(BaseFormula showDateFM) { |
||||
this.showDateFM = showDateFM; |
||||
} |
||||
|
||||
public int getFirstDayOfWeek() { |
||||
return firstDayOfWeek; |
||||
} |
||||
|
||||
public void setFirstDayOfWeek(Object firstDayOfWeek) { |
||||
Item selectedItem = (Item) firstDayOfWeek; |
||||
this.firstDayOfWeek = Integer.parseInt(String.valueOf(selectedItem.getValue())); |
||||
} |
||||
|
||||
public void setFirstDayOfWeek(int firstDayOfWeek) { |
||||
this.firstDayOfWeek = firstDayOfWeek; |
||||
} |
||||
|
||||
public String getConfigurationItem() { |
||||
return configurationItem; |
||||
} |
||||
|
||||
public void setConfigurationItem(String configurationItem) { |
||||
this.configurationItem = configurationItem; |
||||
} |
||||
|
||||
public String getDateFormat() { |
||||
return dateFormat; |
||||
} |
||||
|
||||
public void setDateFormat(String dateFormat) { |
||||
this.dateFormat = dateFormat; |
||||
} |
||||
|
||||
public String getReturnFormat() { |
||||
return returnFormat; |
||||
} |
||||
|
||||
public void setReturnFormat(String returnFormat) { |
||||
this.returnFormat = returnFormat; |
||||
} |
||||
|
||||
public BaseFormula getReturnFormatFM() { |
||||
return returnFormatFM; |
||||
} |
||||
|
||||
public void setReturnFormatFM(BaseFormula returnFormatFM) { |
||||
this.returnFormatFM = returnFormatFM; |
||||
} |
||||
|
||||
public int getReturnTypeInt() { |
||||
if (StringKit.equals(this.returnType, ReturnTypeEditor.STRING)) { |
||||
return 0; |
||||
} else if (StringKit.equals(this.returnType, ReturnTypeEditor.DATE)) { |
||||
return 1; |
||||
} else { |
||||
return 0; |
||||
} |
||||
} |
||||
|
||||
public String getReturnType() { |
||||
return returnType; |
||||
} |
||||
|
||||
public void setReturnType(int returnType) { |
||||
if (ComparatorUtils.equals(returnType, 0)) { |
||||
this.returnType = ReturnTypeEditor.STRING; |
||||
} else if (ComparatorUtils.equals(returnType, 1)) { |
||||
this.returnType = ReturnTypeEditor.DATE; |
||||
} else { |
||||
this.returnType = ReturnTypeEditor.STRING; |
||||
} |
||||
} |
||||
|
||||
public void setReturnType(String returnType) { |
||||
this.returnType = returnType; |
||||
} |
||||
|
||||
public String getDateSeparator() { |
||||
return dateSeparator; |
||||
} |
||||
|
||||
public void setDateSeparator(String dateSeparator) { |
||||
this.dateSeparator = dateSeparator; |
||||
} |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,25 @@
|
||||
.el-tree-select .select-option { |
||||
display: none !important; |
||||
} |
||||
.el-tree-select-popper { |
||||
height: 400px; |
||||
overflow: auto!important; |
||||
} |
||||
.el-tree-select-popper .el-button--small { |
||||
width: 25px !important; |
||||
min-width: 25px !important; |
||||
} |
||||
.el-input--small .el-input__inner{ |
||||
min-height: 32px!important; |
||||
line-height: 32px; |
||||
} |
||||
.mb10 { |
||||
margin-bottom: 10px; |
||||
} |
||||
.no-data { |
||||
height: 32px; |
||||
line-height: 32px; |
||||
font-size: 14px; |
||||
color: #cccccc; |
||||
text-align: center; |
||||
} |
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,248 @@
|
||||
; |
||||
;(function ($) { |
||||
FR.VueDateTimeEditor = FR.extend(FR.DateTimeEditor, { |
||||
_defaultConfig: function () { |
||||
return $.extend(FR.VueDateTimeEditor.superclass._defaultConfig.apply(), { |
||||
format: "yyyy-MM-dd", |
||||
directEdit: true |
||||
}) |
||||
}, |
||||
uuid: function () { |
||||
var s = []; |
||||
var hexDigits = "0123456789abcdef"; |
||||
for (var i = 0; i < 12; i++) { |
||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); |
||||
} |
||||
var uuid = 'vue' + s.join(""); |
||||
return uuid; |
||||
}, |
||||
_init: function () { |
||||
try { |
||||
FR.VueDateTimeEditor.superclass._init.apply(this, arguments); |
||||
this._hideView(); |
||||
FR.$defaultImport('/com/fr/plugin/hrjf/css/index.min.css', 'css'); |
||||
var dom = this.element; |
||||
var id = this.options.location = this.options.location || this.uuid(); |
||||
$(dom).attr("id", id); |
||||
var d = $("#" + id) |
||||
if (d[0]) { |
||||
this._realInit(); |
||||
} else { |
||||
this._initMe(); |
||||
} |
||||
|
||||
this.editComp.keydown(function (c) { |
||||
a.editComp[0].realValue = null |
||||
}); |
||||
$(this.editComp).keyup(function () { |
||||
if ($(this).val() == a.oriText) { |
||||
return |
||||
} |
||||
a.isValidateInput(); |
||||
a.oriText = $(this).val(); |
||||
a.fireEvent(FR.Events.AFTEREDIT) |
||||
}); |
||||
} catch (e) { |
||||
console.error(e); |
||||
} |
||||
}, |
||||
onTriggerClick: function (a) { |
||||
if (!this.isEnabled()) { |
||||
return |
||||
} |
||||
if (document.activeElement != this.editComp[0]) { |
||||
this.editComp.focus() |
||||
} |
||||
if (this.isExpanded()) { |
||||
if (FR.Browser.isIE8() && this.$view.css("visibility") == "hidden") { |
||||
this.$view.css("visibility", "visible") |
||||
} else { |
||||
this.$view.show() |
||||
} |
||||
} else { |
||||
this.$view.empty(); |
||||
this._createCalendar() |
||||
} |
||||
}, |
||||
reportEdit: function () { |
||||
var that = this; |
||||
setTimeout(function () { |
||||
that.fireEvent(FR.Events.AFTEREDIT); |
||||
}, 300) |
||||
}, |
||||
_realInit: function () { |
||||
this._showView(); |
||||
$(this.element).css("overflow", "unset") |
||||
console.log("%o", this); |
||||
var opt = this.options; |
||||
var id = opt.location; |
||||
var dom = $('#' + id); |
||||
// DatePicker日期选择器属性设置
|
||||
$(dom).html("<el-date-picker v-model=\"value1\"" + |
||||
" type=\"date\" " + |
||||
" placeholder=\"选择日期\"" + |
||||
" value-format=\"timestamp\"" + |
||||
" :picker-options=\"pickerOptions\"" + |
||||
" ref=\"vueDateTime\"" + |
||||
"></el-date-picker>\n" |
||||
); |
||||
var that = this; |
||||
// var tmpValue = undefined
|
||||
// if (opt.value) {
|
||||
// var t = opt.value.split(",");
|
||||
// tmpValue = $.map(t, function (i) {
|
||||
// return i;
|
||||
// })
|
||||
// }
|
||||
// DatePicker日期选择器设置选项,后端配置项在opt中获得
|
||||
// 示例:周开始日期 firstDayOfWeek: opt.firstDayOfWeek
|
||||
var app = window.app = this.app = new Vue({ |
||||
el: dom[0], |
||||
data: { |
||||
pickerOptions: { |
||||
disabledDate(time) { |
||||
return time.getTime() > Date.now(); |
||||
}, |
||||
shortcuts: [{ |
||||
text: '今天', |
||||
onClick(picker) { |
||||
picker.$emit('pick', new Date()); |
||||
} |
||||
}, { |
||||
text: '昨天', |
||||
onClick(picker) { |
||||
const date = new Date(); |
||||
date.setTime(date.getTime() - 3600 * 1000 * 24); |
||||
picker.$emit('pick', date); |
||||
} |
||||
}, { |
||||
text: '一周前', |
||||
onClick(picker) { |
||||
const date = new Date(); |
||||
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); |
||||
picker.$emit('pick', date); |
||||
} |
||||
}], |
||||
firstDayOfWeek: opt.firstDayOfWeek |
||||
}, |
||||
value1: '', |
||||
value2: '', |
||||
}, |
||||
methods: {}, |
||||
method: { |
||||
getValue: function () { |
||||
console.info(this.$refs.vueDateTime.model) |
||||
}, |
||||
}, |
||||
mounted: function () { |
||||
} |
||||
} |
||||
) |
||||
}, |
||||
_initMe: function () { |
||||
var id = this.options.location; |
||||
var that = this; |
||||
var intc = setTimeout(function () { |
||||
var dom = $("#" + id); |
||||
|
||||
if (dom[0]) { |
||||
that._realInit(); |
||||
} else { |
||||
that._initMe(); |
||||
} |
||||
}, 100) |
||||
}, |
||||
setText: function (text) { |
||||
this.editComp.val(text); |
||||
}, |
||||
_hideView: function () { |
||||
if (FR.Browser.isIE8()) { |
||||
this.element.css("visibility", "hidden"); |
||||
} else { |
||||
this.element.hide(); |
||||
} |
||||
}, |
||||
_showView: function () { |
||||
if (FR.Browser.isIE8()) { |
||||
this.element.css("visibility", "show"); |
||||
} else { |
||||
var id = this.options.location; |
||||
$("#" + id).show(); |
||||
} |
||||
}, |
||||
setValue: function (value) { |
||||
try { |
||||
if (value) { |
||||
this.app.$refs.vueDateTime.value = value; |
||||
} |
||||
} catch (e) { |
||||
console.error(e); |
||||
} |
||||
}, |
||||
startEditing: function () { |
||||
this._showView() |
||||
}, |
||||
stopEditing: function () { |
||||
}, |
||||
getValue: function () { |
||||
if (this.app) { |
||||
console.info("vueDateTime-getValue:" + this.app.$refs.vueDateTime.value); |
||||
return this.app.$refs.vueDateTime.value; |
||||
} |
||||
return ""; |
||||
}, |
||||
}); |
||||
$.shortcut("vue_datetime", FR.VueDateTimeEditor); |
||||
})(jQuery); |
||||
(function ($) { |
||||
!(function () { |
||||
try { |
||||
var provider = BI.Providers.getProvider("report.controller.provider"); |
||||
} catch (e) { |
||||
return; |
||||
} |
||||
var ImplClass = provider.getImpl(); |
||||
var Widget = BI.inherit(ImplClass, { |
||||
mounted: function () { |
||||
this.widget = FR.createWidget(BI.extend({}, this.options, { |
||||
type: 'vue_datetime', |
||||
renderEl: this.element[0], |
||||
})); |
||||
|
||||
Widget.superclass.mounted.apply(this, arguments); |
||||
}, |
||||
isValidate:function (){ |
||||
return (this.widget && this.widget.isValidate.apply(this.widget, arguments)) |
||||
}, |
||||
focusDown: function () { |
||||
return (this.widget && this.widget.focusDown.apply(this.widget, arguments)) |
||||
}, |
||||
getValue: function () { |
||||
return (this.widget && this.widget.getValue.apply(this.widget, arguments)) |
||||
}, |
||||
reset: function () { |
||||
return (this.widget && this.widget.reset.apply(this.widget, arguments)) |
||||
}, |
||||
preGetValidation: function () { |
||||
return {result: this.isValidate.apply(this, arguments)} |
||||
}, |
||||
postGetValidation: function () { |
||||
return {result: this.isValidate.apply(this, arguments)} |
||||
}, |
||||
setInteractValue: function () { |
||||
this.widget && this.widget.setValue.apply(this.widget, arguments) |
||||
}, |
||||
setControllerValue: function () { |
||||
this.widget && this.widget.setValue.apply(this.widget, arguments) |
||||
}, |
||||
resize: function (width, height) { |
||||
this.widget && this.widget.doResize({ |
||||
width: width, height: height |
||||
}); |
||||
} |
||||
}); |
||||
Widget.xtype = "vue_datetime"; |
||||
BI.shortcut(Widget.xtype, Widget); |
||||
provider.set('vue_datetime', Widget.xtype); |
||||
})(); |
||||
})(jQuery); |
@ -0,0 +1,32 @@
|
||||
Plugin-hrjf=Vue Date Picker Plugin |
||||
Plugin-hrjf_Licence_Expired=Vue Date Picker Plugin Licence Expired |
||||
Plugin-hrjf-Date_Format=Type/Format |
||||
Plugin-hrjf-Date_Format_Year=year |
||||
Plugin-hrjf-Date_Format_Month=month |
||||
Plugin-hrjf-Date_Format_Date=date |
||||
Plugin-hrjf-Date_Format_Dates=dates |
||||
Plugin-hrjf-Date_Format_Week=week |
||||
Plugin-hrjf-Date_Format_DateRange=daterange |
||||
Plugin-hrjf-Date_Format_DateRangeWeek=daterangeweek |
||||
Plugin-hrjf-Date_Format_DateRangeMonth=daterangemonth |
||||
Plugin-hrjf-Date_Format_DateTime=datetime |
||||
Plugin-hrjf-Date_Format_DateTimeRange=datetimerange |
||||
Plugin-hrjf-Design_Form_Date_Type=Type/Format |
||||
Plugin-hrjf-Date_Type_Date=Date |
||||
Plugin-hrjf-Date_Type_DateTime=DateTime |
||||
Plugin-hrjf-Design_Form_Start_Date=Start Date |
||||
Plugin-hrjf-Design_Form_Show_Date=Show Date |
||||
Plugin-hrjf-Design_Form_Return_Format=Return Format |
||||
Plugin-hrjf-Design_Form_Week_Start_Date=Week Start Date |
||||
Plugin-hrjf-Week_Start_Date_Monday=Monday |
||||
Plugin-hrjf-Week_Start_Date_Tuesday=Tuesday |
||||
Plugin-hrjf-Week_Start_Date_Wednesday=Wednesday |
||||
Plugin-hrjf-Week_Start_Date_Thursday=Thursday |
||||
Plugin-hrjf-Week_Start_Date_Friday=Friday |
||||
Plugin-hrjf-Week_Start_Date_Saturday=Saturday |
||||
Plugin-hrjf-Week_Start_Date_Sunday=Sunday |
||||
Plugin-hrjf-Design_Form_Return_Type=Return Type |
||||
Plugin-hrjf-Design_Form_Return_Type_String=String |
||||
Plugin-hrjf-Design_Form_Return_Type_Date=Date |
||||
Plugin-hrjf-Design_Form_Date_Separator=Date Separator |
||||
Plugin-hrjf-Design_Form_Configuration_Item=Configuration Item |
@ -0,0 +1,32 @@
|
||||
Plugin-hrjf=Vue\u65E5\u671F\u9009\u62E9\u5668\u63D2\u4EF6 |
||||
Plugin-hrjf_Licence_Expired=Vue\u65E5\u671F\u9009\u62E9\u5668\u63D2\u4EF6\u8BB8\u53EF\u8FC7\u671F |
||||
Plugin-hrjf-Date_Format=\u7C7B\u578B/\u683C\u5F0F |
||||
Plugin-hrjf-Date_Format_Year=year |
||||
Plugin-hrjf-Date_Format_Month=month |
||||
Plugin-hrjf-Date_Format_Date=date |
||||
Plugin-hrjf-Date_Format_Dates=dates |
||||
Plugin-hrjf-Date_Format_Week=week |
||||
Plugin-hrjf-Date_Format_DateRange=daterange |
||||
Plugin-hrjf-Date_Format_DateRangeWeek=daterangeweek |
||||
Plugin-hrjf-Date_Format_DateRangeMonth=daterangemonth |
||||
Plugin-hrjf-Date_Format_DateTime=datetime |
||||
Plugin-hrjf-Date_Format_DateTimeRange=datetimerange |
||||
Plugin-hrjf-Design_Form_Date_Type=\u7C7B\u578B/\u683C\u5F0F |
||||
Plugin-hrjf-Date_Type_Date=\u65E5\u671F\u578B |
||||
Plugin-hrjf-Date_Type_DateTime=\u65F6\u95F4\u578B |
||||
Plugin-hrjf-Design_Form_Start_Date=\u5F00\u59CB\u65E5\u671F |
||||
Plugin-hrjf-Design_Form_Show_Date=\u663E\u793A\u683C\u5F0F |
||||
Plugin-hrjf-Design_Form_Return_Format=\u8FD4\u56DE\u683C\u5F0F |
||||
Plugin-hrjf-Design_Form_Week_Start_Date=\u5468\u8D77\u59CB\u65E5 |
||||
Plugin-hrjf-Week_Start_Date_Monday=\u5468\u4E00 |
||||
Plugin-hrjf-Week_Start_Date_Tuesday=\u5468\u4E8C |
||||
Plugin-hrjf-Week_Start_Date_Wednesday=\u5468\u4E09 |
||||
Plugin-hrjf-Week_Start_Date_Thursday=\u5468\u56DB |
||||
Plugin-hrjf-Week_Start_Date_Friday=\u5468\u4E94 |
||||
Plugin-hrjf-Week_Start_Date_Saturday=\u5468\u516D |
||||
Plugin-hrjf-Week_Start_Date_Sunday=\u5468\u65E5 |
||||
Plugin-hrjf-Design_Form_Return_Type=\u8FD4\u56DE\u7C7B\u578B |
||||
Plugin-hrjf-Design_Form_Return_Type_String=\u5B57\u7B26\u4E32 |
||||
Plugin-hrjf-Design_Form_Return_Type_Date=\u65E5\u671F |
||||
Plugin-hrjf-Design_Form_Date_Separator=\u6570\u7EC4\u62FC\u63A5\u7B26 |
||||
Plugin-hrjf-Design_Form_Configuration_Item=\u914D\u7F6E\u9879 |
Loading…
Reference in new issue