Browse Source

Merge branch 'release/10.0' into final/10.0

# Conflicts:
#	designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java
final/10.0
jeo 5 years ago
parent
commit
6fabbd17b5
  1. 14
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  2. 2
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 32
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  4. 12
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 18
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  7. 72
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java
  8. 125
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java
  9. 100
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java
  10. 19
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  11. 7
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  12. 11
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  13. 24
      designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java
  14. 12
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  15. 11
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  16. 36
      designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java
  17. 6
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java
  18. 8
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  19. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  20. 25
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  21. 23
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  22. 27
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java
  23. 62
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java
  24. 25
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java
  25. 86
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java
  26. 4
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  27. 30
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java
  28. 68
      designer-realize/src/main/java/com/fr/design/present/BarCodePane.java

14
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -1,10 +1,12 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.log.FineLoggerFactory;
import com.fr.security.SecurityToolbox; import com.fr.security.SecurityToolbox;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@ -89,8 +91,14 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override @Override
public boolean checkValid(){ public boolean checkValid() {
boolean result = false;
return true; try {
result = WorkContext.getConnector().testConnection(connection);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return result;
}
return result;
} }
} }

2
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -258,7 +258,7 @@ public class MutilTempalteTabPane extends JComponent {
private String tempalteShowName(JTemplate<?, ?> template) { private String tempalteShowName(JTemplate<?, ?> template) {
String name = template.getEditingFILE().getName(); String name = template.getTemplateName();
if (!template.isSaved() && !name.endsWith(" *")) { if (!template.isSaved() && !name.endsWith(" *")) {
name += " *"; name += " *";
} }

32
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -11,15 +11,25 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
@ -27,14 +37,6 @@ import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.Window; import java.awt.Window;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
@ -244,6 +246,20 @@ abstract class UIControlPane extends JControlPane {
return; return;
} }
} }
try {
//没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame()
Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get();
for (Window window : sharedOwnerFrame.getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
// 如果有可见模态对话框,则不隐藏
return;
}
}
} catch (Exception ignore) {
//do nothing
}
// 要隐藏 先检查有没有非法输入 // 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框 // 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try { try {

12
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -59,12 +59,19 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
initListener(); initListener();
} }
private void initListener() { protected void initListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() { this.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
attributeChange();
}
});
}
}
protected void attributeChange() {
if (uiObserverListener == null) { if (uiObserverListener == null) {
return; return;
} }
@ -73,9 +80,6 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
} }
uiObserverListener.doChange(); uiObserverListener.doChange();
} }
});
}
}
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件

2
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -830,7 +830,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]"); defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]");
if (editingTemplate != null) { if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath(); String path = editingTemplate.getPath();
if (!editingTemplate.getEditingFILE().exists()) { if (!editingTemplate.getEditingFILE().exists()) {
path = FILEFactory.MEM_PREFIX + path; path = FILEFactory.MEM_PREFIX + path;
} else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) {

18
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -257,6 +257,19 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
} }
/**
* 刷新内部资源
*/
public void refreshResource() {
try {
this.template = JTemplateFactory.asIOFile(this.editingFILE);
setTarget(this.template);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/** /**
* 刷新容器 * 刷新容器
*/ */
@ -1232,4 +1245,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
public abstract String route(); public abstract String route();
public String getTemplateName(){
return getEditingFILE().getName();
}
} }

72
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java

@ -0,0 +1,72 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.form.ui.mobile.MobileFormCollapsedStyle;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/13
*/
public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane {
private static final Dimension DEFAULT_SPINNER_SIZE = new Dimension(60, 24);
private UISpinner rowSpinner;
public MobileCollapsedStyleExpandPane() {
}
@Override
protected JPanel createLinePane() {
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1) {
@Override
protected UINumberField initNumberField(){
return new UIIntNumberField();
}
};
rowSpinner.setPreferredSize(DEFAULT_SPINNER_SIZE);
JPanel panel = new JPanel();
panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From")));
panel.add(rowSpinner);
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold")));
JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
linePane.add(splitLine, BorderLayout.NORTH);
linePane.add(panel, BorderLayout.CENTER);
return linePane;
}
@Override
public void populateBean(MobileCollapsedStyle ob) {
super.populateBean(ob);
rowSpinner.setValue(((MobileFormCollapsedStyle) ob).getLineAttr().getNumber());
}
@Override
public MobileCollapsedStyle updateBean() {
MobileCollapsedStyle style = super.updateBean();
((MobileFormCollapsedStyle) style).getLineAttr().setNumber((int) rowSpinner.getValue());
return style;
}
@Override
protected MobileCollapsedStyle updateDiffBean() {
return new MobileFormCollapsedStyle();
}
}

125
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java

@ -0,0 +1,125 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.ModeButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
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.layout.VerticalFlowLayout;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.mobile.CollapseState;
import com.fr.form.ui.mobile.MobileChartCollapsedStyle;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/13
*/
public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle> {
private UICheckBox showButtonCheck;
private NewColorSelectBox buttonColorBox;
private UITextField foldedTextFiled;
private UITextField unfoldedTextFiled;
private ModeButtonGroup<CollapseState> buttonGroup;
public MobileCollapsedStylePane() {
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null);
VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10);
layout.setAlignLeft(true);
this.setBorder(titledBorder);
this.setLayout(layout);
this.add(createLinePane());
this.add(createSettingPane());
}
private JPanel createSettingPane() {
JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
UILabel showButtonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
showButtonCheck = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right"));
UILabel buttonColorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color"));
buttonColorBox = new NewColorSelectBox(137);
UILabel foldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint"));
foldedTextFiled = new UITextField();
UILabel unfoldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint"));
unfoldedTextFiled = new UITextField();
UILabel defaultStateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State"));
buttonGroup = new ModeButtonGroup<>();
UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold"));
foldedButton.setSelected(true);
UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold"));
buttonGroup.put(CollapseState.FOLDED, foldedButton);
buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton);
JPanel flowLeftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
flowLeftPane.add(foldedButton);
flowLeftPane.add(unfoldedButton);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] colSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][] {
new Component[] {showButtonLabel, showButtonCheck},
new Component[] {buttonColorLabel, buttonColorBox},
new Component[] {foldedLabel, foldedTextFiled},
new Component[] {unfoldedLabel, unfoldedTextFiled},
new Component[] {defaultStateLabel, flowLeftPane},
};
JPanel buttonPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
settingPane.add(splitLine, BorderLayout.NORTH);
settingPane.add(buttonPane, BorderLayout.CENTER);
return settingPane;
}
protected JPanel createLinePane() {
return FRGUIPaneFactory.createBorderLayout_S_Pane();
}
@Override
public void populateBean(MobileCollapsedStyle ob) {
showButtonCheck.setSelected(ob.getCollapseButton().isShowButton());
buttonColorBox.setSelectObject(ob.getCollapseButton().getButtonColor());
foldedTextFiled.setText(ob.getCollapseButton().getFoldedHint());
unfoldedTextFiled.setText(ob.getCollapseButton().getUnfoldedHint());
buttonGroup.setSelectButton(ob.getCollapseButton().getDefaultState());
}
@Override
public MobileCollapsedStyle updateBean() {
MobileCollapsedStyle style = updateDiffBean();
style.getCollapseButton().setShowButton(showButtonCheck.isSelected());
style.getCollapseButton().setButtonColor(buttonColorBox.getSelectObject());
style.getCollapseButton().setFoldedHint(foldedTextFiled.getText());
style.getCollapseButton().setUnfoldedHint(unfoldedTextFiled.getText());
style.getCollapseButton().setDefaultState(buttonGroup.getCurrentSelected());
return style;
}
protected MobileCollapsedStyle updateDiffBean() {
return new MobileChartCollapsedStyle();
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand");
}
}

100
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java

@ -0,0 +1,100 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.general.ComparatorUtils;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/13
*/
public class MobileComboBoxDialogEditor extends BasicPane {
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400);
private static final Dimension COMBOX_DIMENSION = new Dimension(135,20);
private static final String NONE = Toolkit.i18nText("Fine-Design_Mobile_Collapse_None");
private static final String CUSTOM = Toolkit.i18nText("Fine-Design_Mobile_Collapse_Custom");
private MobileCollapsedStyle style;
private MobileCollapsedStylePane stylePane;
private UIComboBox comboBox;
private ActionListener listener;
public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) {
this.stylePane = stylePane;
this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM});
this.comboBox.setPreferredSize(COMBOX_DIMENSION);
this.comboBox.setSelectedItem(NONE);
listener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (ComparatorUtils.equals(MobileComboBoxDialogEditor.this.comboBox.getSelectedItem(), CUSTOM)) {
showEditorPane();
}
}
};
this.comboBox.addActionListener(listener);
this.add(comboBox);
}
public boolean isSelectedCustom() {
return ComparatorUtils.equals(CUSTOM, this.comboBox.getSelectedItem());
}
public void setSelected(boolean selectedCustom) {
this.comboBox.removeActionListener(listener);
this.comboBox.setSelectedItem(selectedCustom ? CUSTOM : NONE);
this.comboBox.addActionListener(listener);
}
private void showEditorPane() {
stylePane.setPreferredSize(DEFAULT_DIMENSION);
BasicDialog dialog = stylePane.showWindow(SwingUtilities.getWindowAncestor(this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
MobileCollapsedStyle style = stylePane.updateBean();
style.setCollapsedWork(true);
setStyle(style);
MobileComboBoxDialogEditor.this.firePropertyChanged();
}
});
stylePane.populateBean(getStyle());
dialog.setVisible(true);
}
protected void firePropertyChanged() {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
public MobileCollapsedStyle getStyle() {
return style;
}
public void setStyle(MobileCollapsedStyle style) {
this.style = style;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

19
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -1,12 +1,19 @@
package com.fr.design.os.impl; package com.fr.design.os.impl;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
import com.fr.stable.os.Arch; import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.SupportOS; import com.fr.stable.os.support.SupportOS;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.Locale;
/** /**
* @author pengda * @author pengda
* @date 2019/10/9 * @date 2019/10/9
@ -44,10 +51,18 @@ public enum SupportOSImpl implements SupportOS {
@Override @Override
public boolean support() { public boolean support() {
boolean isLocalEnv = WorkContext.getCurrent().isLocal(); boolean isLocalEnv = WorkContext.getCurrent().isLocal();
boolean isChineseEnv = GeneralContext.isChineseEnv();
boolean isLinux = OperatingSystem.isLinux(); boolean isLinux = OperatingSystem.isLinux();
// 远程设计和非中文环境以及Linux环境,都不生效 // 远程设计和非中文环境以及Linux环境,都不生效
return isLocalEnv && isChineseEnv && !isLinux; return isLocalEnv && !isLinux && isPushByConf();
}
private boolean isPushByConf() {
String resp = CloudCenter.getInstance().acquireUrlByKind("update.push.conf");
if (StringUtils.isEmpty(resp)) {
return Locale.CHINA.equals(GeneralContext.getLocale());
}
JSONObject jo = JSONFactory.createJSON(JSON.OBJECT, resp);
return jo.getBoolean(GeneralContext.getLocale().toString());
} }
}, },
/** /**

7
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -17,6 +17,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.license.exception.RegistEditionException;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.base.Strings; import com.fr.third.guava.base.Strings;
@ -220,6 +221,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
updateHttpsConfigPanel(); updateHttpsConfigPanel();
remoteWorkspaceURL.setHttps(isHttps); remoteWorkspaceURL.setHttps(isHttps);
// reset下url,将勾选状态是否htpps加到url里
remoteWorkspaceURL.resetUrl();
fillRemoteEnvURLField(); fillRemoteEnvURLField();
fillIndividualField(); fillIndividualField();
} }
@ -561,6 +565,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection); return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection);
} catch (WorkspaceAuthException ignored) { } catch (WorkspaceAuthException ignored) {
return AUTH_FAILED; return AUTH_FAILED;
} catch (RegistEditionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw e;
} }
} }

11
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -1,6 +1,5 @@
package com.fr.start.server; package com.fr.start.server;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
@ -15,6 +14,7 @@ import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleException;
import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.webresources.StandardRoot;
import java.io.File; import java.io.File;
import java.util.HashSet; import java.util.HashSet;
@ -63,10 +63,11 @@ public class FineEmbedServerActivator extends Activator {
// 设置解码uri使用的字符编码 // 设置解码uri使用的字符编码
tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8); tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8);
String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); String docBase = new File(WorkContext.getCurrent().getPath()).getParent();
//内置的上下文是自己定的,这里把WEB_APP_NAME一并设置了,否则下面appName是/null
ProductConstants.setWebAppName(ProductConstants.getAppFolderName()); //内置的上下文使用工程目录比如webroot
String appName = "/" + FRContext.getCommonOperator().getAppName(); String contextPath = "/" + ProductConstants.getAppFolderName();
Context context = tomcat.addContext(appName, docBase); final Context context = tomcat.addContext(contextPath, docBase);
context.setResources(new StandardRoot(context));
Tomcat.initWebappDefaults(context); Tomcat.initWebappDefaults(context);
//覆盖tomcat的WebAppClassLoader //覆盖tomcat的WebAppClassLoader
context.setLoader(new FRTomcatLoader()); context.setLoader(new FRTomcatLoader());

24
designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java

@ -0,0 +1,24 @@
package com.fr.design.os.impl;
import com.fr.general.GeneralContext;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.util.Locale;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/1/16
*/
public class SupportOSImplTest extends TestCase {
@Test
public void testAutoPush() {
Assert.assertTrue(SupportOSImpl.AUTOPUSHUPDATE.support());
GeneralContext.setLocale(Locale.TAIWAN);
Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support());
}
}

12
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -13,8 +13,11 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
@ -590,4 +593,13 @@ public class XWAbsoluteLayout extends XLayoutContainer {
public boolean isSupportShared() { public boolean isSupportShared() {
return true; return true;
} }
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) {
return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)};
} else {
return super.getWidgetPropertyUIProviders();
}
}
} }

11
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -16,7 +16,10 @@ import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
@ -512,4 +515,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
return true; return true;
} }
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) {
return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)};
} else {
return super.getWidgetPropertyUIProviders();
}
}
} }

36
designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java

@ -0,0 +1,36 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.MobileBookMarkDefinePane;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class MobileBooKMarkUsePropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public MobileBooKMarkUsePropertyUI(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new MobileBookMarkDefinePane(xCreator);
}
@Override
public String tableTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr");
}
}

6
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java

@ -14,16 +14,10 @@ public class UIBoundSpinner extends UISpinner{
public UIBoundSpinner(double minValue, double maxValue, double dierta) { public UIBoundSpinner(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta); super(minValue, maxValue, dierta);
initComponents();
} }
public UIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) { public UIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue); super(minValue, maxValue, dierta, defaultValue);
initComponents();
}
private void initComponents() {
setTextField(value);
} }
@Override @Override

8
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -26,10 +26,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
@Override @Override
public void initBoundPane() { public void initBoundPane() {
x = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); x = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d);
y = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); y = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d);
width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d);
height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d);
x.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); x.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
y.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); y.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -56,8 +56,8 @@ public class WidgetBoundPane extends BasicPane {
} }
public void initBoundPane() { public void initBoundPane() {
width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d);
height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d);
width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
if (creator.acceptType(XWCardLayout.class)) { if (creator.acceptType(XWCardLayout.class)) {

25
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -20,7 +20,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.mobile.ui.MobileCollapsedStylePane;
import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor;
import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -49,6 +53,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
private UILabel tipLabel; private UILabel tipLabel;
private UICheckBox allowFullCheckBox;//允许全屏 private UICheckBox allowFullCheckBox;//允许全屏
private UICheckBox functionalWhenUnactivatedCheckBox;//组件未激活时可使用组件内功能 private UICheckBox functionalWhenUnactivatedCheckBox;//组件未激活时可使用组件内功能
private MobileComboBoxDialogEditor mobileCollapsedStyleEditor;
public ChartEditorDefinePane(XCreator xCreator) { public ChartEditorDefinePane(XCreator xCreator) {
this.xCreator = xCreator; this.xCreator = xCreator;
@ -102,10 +107,17 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
updateTipLabel(); updateTipLabel();
allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen"));
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true);
mobileCollapsedStyleEditor = new MobileComboBoxDialogEditor(new MobileCollapsedStylePane()) {
@Override
protected void firePropertyChanged() {
ChartEditorDefinePane.this.update();
}
};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand")), mobileCollapsedStyleEditor},
new Component[] {tipLabel, null}, new Component[] {tipLabel, null},
new Component[] {allowFullCheckBox, null}, new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null} new Component[] {functionalWhenUnactivatedCheckBox, null}
@ -113,9 +125,9 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p,f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -186,6 +198,10 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
} }
} }
}); });
MobileCollapsedStyle style = ((ChartEditor) xCreator.toData()).getMobileCollapsedStyle();
this.mobileCollapsedStyleEditor.setStyle(style);
this.mobileCollapsedStyleEditor.setSelected(style.isCollapsedWork());
} }
@Override @Override
@ -200,6 +216,11 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected()); mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
} }
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
if (style != null) {
((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style);
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom());
}
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
} }
} }

23
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -16,8 +16,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.mobile.ui.MobileCollapsedStyleExpandPane;
import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -51,6 +54,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private UICheckBox allowFullCheckBox; private UICheckBox allowFullCheckBox;
private UICheckBox functionalWhenUnactivatedCheckBox; private UICheckBox functionalWhenUnactivatedCheckBox;
private MobileComboBoxDialogEditor mobileCollapsedStyleEditor;
public ElementCaseDefinePane(XCreator xCreator) { public ElementCaseDefinePane(XCreator xCreator) {
this.xCreator = xCreator; this.xCreator = xCreator;
@ -90,9 +94,17 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true);
mobileCollapsedStyleEditor = new MobileComboBoxDialogEditor(new MobileCollapsedStyleExpandPane()) {
@Override
protected void firePropertyChanged() {
ElementCaseDefinePane.this.update();
}
};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("展开收起")), mobileCollapsedStyleEditor},
new Component[] {heightRestrictCheckBox, null}, new Component[] {heightRestrictCheckBox, null},
new Component[] {allowFullCheckBox, null}, new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null}, new Component[] {functionalWhenUnactivatedCheckBox, null},
@ -100,9 +112,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
}; };
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -144,6 +156,8 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent()); this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent());
this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen()); this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen());
this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated()); this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated());
this.mobileCollapsedStyleEditor.setStyle(elementCaseEditor.getMobileCollapsedStyle());
this.mobileCollapsedStyleEditor.setSelected(elementCaseEditor.getMobileCollapsedStyle().isCollapsedWork());
} }
@Override @Override
@ -172,6 +186,11 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
case "functionalWhenUnactivatedCheckBox": case "functionalWhenUnactivatedCheckBox":
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected()); ((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
} }
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
if (style != null) {
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom());
((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style);
}
} }
private void setGlobalNames() { private void setGlobalNames() {

27
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java

@ -53,7 +53,7 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
public void initPropertyGroups(Object source) { public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark")); this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false);
this.bookMarkNameField = new UITextField() { this.bookMarkNameField = new UITextField() {
@Override @Override
protected void initListener() { protected void initListener() {
@ -85,15 +85,37 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
this.useBookMarkCheck.addChangeListener(new ChangeListener() { this.useBookMarkCheck.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
bookMarkNamePane.setVisible(MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected()); boolean selected = MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected();
Widget widget = MobileAdvanceDefinePane.this.xCreator.toData();
MobileBookMark bookMark = widget.getMobileBookMark();
bookMarkNamePane.setVisible(selected);
if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) {
String name = widget.getWidgetName();
MobileAdvanceDefinePane.this.bookMarkNameField.setText(name);
bookMark.setBookMarkName(name);
}
} }
}); });
bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark());
contentPane.add(useBookMarkPane, BorderLayout.NORTH); contentPane.add(useBookMarkPane, BorderLayout.NORTH);
contentPane.add(bookMarkNamePane, BorderLayout.CENTER); contentPane.add(bookMarkNamePane, BorderLayout.CENTER);
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, contentPane); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, contentPane);
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapPane.add(uiExpandablePane, BorderLayout.NORTH); wrapPane.add(uiExpandablePane, BorderLayout.NORTH);
this.add(wrapPane, BorderLayout.NORTH); this.add(wrapPane, BorderLayout.NORTH);
initData();
}
private void initData() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
String bookMarkName = bookMark.getBookMarkName();
if (StringUtils.isEmpty(bookMarkName)) {
String widgetName = xCreator.toData().getWidgetName();
this.bookMarkNameField.setText(widgetName);
bookMark.setBookMarkName(widgetName);
} else {
this.bookMarkNameField.setText(bookMarkName);
}
} }
private void bindListeners2Widgets() { private void bindListeners2Widgets() {
@ -139,6 +161,7 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); bookMark.setUseBookMark(this.useBookMarkCheck.isSelected());
String newBookMarkName = this.bookMarkNameField.getText(); String newBookMarkName = this.bookMarkNameField.getText();
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) {
return; return;
} }

62
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java

@ -0,0 +1,62 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class MobileBookMarkDefinePane extends MobileWidgetDefinePane {
private XCreator xCreator;
private MobileBookMarkUsePane mobileBookMarkUsePane;
public MobileBookMarkDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.mobileBookMarkUsePane = new MobileBookMarkUsePane();
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, mobileBookMarkUsePane);
panel.add(uiExpandablePane);
this.add(panel, BorderLayout.NORTH);
}
private void bindListeners2Widgets() {
reInitAllListeners();
AttributeChangeListener changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
this.addAttributeChangeListener(changeListener);
}
private void reInitAllListeners() {
initListener(this);
}
@Override
public void populate(FormDesigner designer) {
this.mobileBookMarkUsePane.populate(xCreator);
this.bindListeners2Widgets();
}
@Override
public void update() {
this.mobileBookMarkUsePane.update(xCreator);
}
}

25
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java

@ -29,7 +29,7 @@ import java.awt.*;
public class MobileBookMarkSettingPane extends BasicPane { public class MobileBookMarkSettingPane extends BasicPane {
private AccessibleMobileBookMarkStyleEditor mobileBookMarkStyleEditor; private AccessibleMobileBookMarkStyleEditor mobileBookMarkStyleEditor;
private UICheckBox showHierarchicalBookmarksCheck; private MobileBookMarkUsePane showBookMarkPane;
public MobileBookMarkSettingPane() { public MobileBookMarkSettingPane() {
initComponent(); initComponent();
@ -38,30 +38,13 @@ public class MobileBookMarkSettingPane extends BasicPane {
private void initComponent() { private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.mobileBookMarkStyleEditor = new AccessibleMobileBookMarkStyleEditor(new MobileBookMarkStylePane()); this.mobileBookMarkStyleEditor = new AccessibleMobileBookMarkStyleEditor(new MobileBookMarkStylePane());
this.showHierarchicalBookmarksCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true);
JPanel booKMarkPane = TableLayoutHelper.createGapTableLayoutPane( JPanel booKMarkPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText( new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Mobile_BookMark_Style")), this.mobileBookMarkStyleEditor}}, "Fine-Design_Mobile_BookMark_Style")), this.mobileBookMarkStyleEditor}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE
); );
UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint")); this.showBookMarkPane = new MobileBookMarkUsePane();
hintLabel.setForeground(Color.GRAY);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {f};
int[][] rowCount = {{1}, {1}};
Component[][] components = new Component[][]{
new Component[]{this.showHierarchicalBookmarksCheck},
new Component[]{hintLabel}
};
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount,
IntervalConstants.INTERVAL_L1,
IntervalConstants.INTERVAL_L1);
showBookMarkPane.setBorder(
BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
wrapPane.add(booKMarkPane, BorderLayout.NORTH); wrapPane.add(booKMarkPane, BorderLayout.NORTH);
wrapPane.add(showBookMarkPane, BorderLayout.CENTER); wrapPane.add(showBookMarkPane, BorderLayout.CENTER);
this.add(wrapPane, BorderLayout.CENTER); this.add(wrapPane, BorderLayout.CENTER);
@ -75,13 +58,13 @@ public class MobileBookMarkSettingPane extends BasicPane {
public void populate(XCreator xCreator) { public void populate(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
this.mobileBookMarkStyleEditor.setValue(wSortLayout.getMobileBookMarkStyle()); this.mobileBookMarkStyleEditor.setValue(wSortLayout.getMobileBookMarkStyle());
this.showHierarchicalBookmarksCheck.setSelected(wSortLayout.isShowBookmarks()); this.showBookMarkPane.populate(xCreator);
} }
public void update(XCreator xCreator) { public void update(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
wSortLayout.setMobileBookMarkStyle((MobileBookMarkStyle) mobileBookMarkStyleEditor.getValue()); wSortLayout.setMobileBookMarkStyle((MobileBookMarkStyle) mobileBookMarkStyleEditor.getValue());
wSortLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected()); this.showBookMarkPane.update(xCreator);
} }

86
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java

@ -0,0 +1,86 @@
package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.container.WLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class MobileBookMarkUsePane extends BasicPane {
private UICheckBox showHierarchicalBookmarksCheck;
public MobileBookMarkUsePane() {
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.showHierarchicalBookmarksCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true) {
@Override
protected void initListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
attributeChange();
}
});
}
};
UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint"));
hintLabel.setForeground(Color.GRAY);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {f};
int[][] rowCount = {{1}, {1}};
Component[][] components = new Component[][]{
new Component[]{this.showHierarchicalBookmarksCheck},
new Component[]{hintLabel}
};
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount,
IntervalConstants.INTERVAL_L1,
IntervalConstants.INTERVAL_L1);
showBookMarkPane.setBorder(
BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
wrapPane.add(showBookMarkPane, BorderLayout.CENTER);
this.add(showBookMarkPane, BorderLayout.CENTER);
}
public void populate(XCreator xCreator) {
WLayout wLayout = ((WLayout) xCreator.toData());
this.showHierarchicalBookmarksCheck.setSelected(wLayout.isShowBookmarks());
}
public void update(XCreator xCreator) {
WLayout wLayout = ((WLayout) xCreator.toData());
wLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected());
}
@Override
protected String title4PopupWindow() {
return "MobileBookMarkUsePane";
}
}

4
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -80,6 +80,7 @@ import com.fr.design.selection.QuickEditor;
import com.fr.design.selection.Selectedable; import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.grid.GridColumn; import com.fr.grid.GridColumn;
@ -117,7 +118,6 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.Adjustable; import java.awt.Adjustable;
import java.awt.Dimension; import java.awt.Dimension;
@ -857,7 +857,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
// Guaranteed to return a non-null array // Guaranteed to return a non-null array
final Object[] listeners = listenerList.getListenerList(); final Object[] listeners = listenerList.getListenerList();
SwingUtilities.invokeLater(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
// Process the listeners last to first, notifying // Process the listeners last to first, notifying

30
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java

@ -645,22 +645,6 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_SMALL); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_SMALL);
} }
// private JPanel populateWidgetCheckPane() {
// double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
// Component[][] components = new Component[][]{
// new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Cell"), SwingConstants.LEFT), cellElementVisibleCheckBoxes},
// new Component[]{null, newValue},
// new Component[]{null, valueEditor},
// new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Widget"), SwingConstants.LEFT), widgetVisible},
// new Component[]{null, widgetAvailable}
// };
// double[] rowSize = {p, p, p, p, p};
// double[] columnSize = {p, f};
// int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
// }
private JPanel populateWidgetCheckPane() { private JPanel populateWidgetCheckPane() {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -705,20 +689,6 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
} }
// private JPanel populatCellCheckPane() {
// double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
// Component[][] components = new Component[][]{
// new Component[]{cellElementVisibleCheckBoxes},
// new Component[]{newValue},
// new Component[]{valueEditor}
// };
// double[] rowSize = {p, p, p};
// double[] columnSize = {f};
// int[][] rowCount = {{1}, {1}, {1}};
// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
// }
private JPanel populatCellCheckPane() { private JPanel populatCellCheckPane() {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;

68
designer-realize/src/main/java/com/fr/design/present/BarCodePane.java

@ -48,17 +48,17 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private UIComboBox typeComboBox; private UIComboBox typeComboBox;
private UISpinner barWidthSpinner; private UISpinner barWidthSpinner;
private UISpinner barHeightSpinner; private UISpinner barHeightSpinner;
private UISpinner RCodesizespinner; private UISpinner sizeSpinner;
private UICheckBox drawingTextCheckBox; private UICheckBox drawingTextCheckBox;
private UIComboBox RCodeVersionComboBox; private UIComboBox versionComboBox;
private UIComboBox RCodeErrorCorrectComboBox; private UIComboBox errorCorrectComboBox;
private UILabel typeSetLabel; private UILabel typeSetLabel;
private String testText = "12345"; private String testText = "12345";
public BarCodePane() { public BarCodePane() {
this.initComponents(); this.initComponents();
addlistener(); addListener();
} }
private void initComponents() { private void initComponents() {
@ -73,9 +73,9 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
borderPane.add(barCodePreviewPane, BorderLayout.CENTER); borderPane.add(barCodePreviewPane, BorderLayout.CENTER);
setTypeComboBox(); setTypeComboBox();
setSome(); setSome();
RCodesizespinner = new UISpinner(1,6,1,2); sizeSpinner = new UISpinner(1,6,1,2);
RCodeVersionComboBox = new UIComboBox(); versionComboBox = new UIComboBox();
RCodeErrorCorrectComboBox = new UIComboBox(); errorCorrectComboBox = new UIComboBox();
typeSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT); typeSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT);
initVersionComboBox(); initVersionComboBox();
initErrorCorrectComboBox(); initErrorCorrectComboBox();
@ -169,31 +169,34 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Version"), UILabel.LEFT); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Version"), UILabel.LEFT);
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize());
RCodeVersionComboBox.setPreferredSize(new Dimension(155,20)); versionComboBox.setPreferredSize(new Dimension(155,20));
RCodeErrorCorrectComboBox.setPreferredSize(new Dimension(155,20)); errorCorrectComboBox.setPreferredSize(new Dimension(155,20));
RCodesizespinner.setPreferredSize(new Dimension(155,20)); sizeSpinner.setPreferredSize(new Dimension(155,20));
Component[][] components_special = new Component[][]{ Component[][] components_special = new Component[][]{
new Component[]{uiLabel, RCodeVersionComboBox}, new Component[]{uiLabel, versionComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), RCodeErrorCorrectComboBox}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), errorCorrectComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), RCodesizespinner} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), sizeSpinner}
}; };
JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE);
return specialPane; return specialPane;
} }
private void addlistener() { private void addListener() {
RCodesizespinner.addChangeListener(new ChangeListener() { sizeSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
repaintPreviewBarCode(); repaintPreviewBarCode();
} }
}); });
RCodeVersionComboBox.addItemListener(new ItemListener() { versionComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
repaintPreviewBarCode(); repaintPreviewBarCode();
} }
}); });
RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { errorCorrectComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
repaintPreviewBarCode(); repaintPreviewBarCode();
} }
@ -204,6 +207,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
} }
}); });
this.barHeightSpinner.addChangeListener(new ChangeListener() { this.barHeightSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
repaintPreviewBarCode(); repaintPreviewBarCode();
} }
@ -217,24 +221,21 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
} }
@Override @Override
/**
*
*/
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Highlight_Barcode"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Highlight_Barcode");
} }
private void initVersionComboBox() { private void initVersionComboBox() {
String[] array = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Auto_Choose"), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; String[] array = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Auto_Choose"), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"};
initcombobox(this.RCodeVersionComboBox, array, 0); initCombobox(this.versionComboBox, array, 0);
} }
private void initErrorCorrectComboBox() { private void initErrorCorrectComboBox() {
String[] array = {"L" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "7%", "M" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "15%", "Q" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "25%", "H" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "30%"}; String[] array = {"L" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "7%", "M" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "15%", "Q" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "25%", "H" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "30%"};
initcombobox(this.RCodeErrorCorrectComboBox, array, 1); initCombobox(this.errorCorrectComboBox, array, 1);
} }
private void initcombobox(UIComboBox combobox, String[] array, int index) { private void initCombobox(UIComboBox combobox, String[] array, int index) {
combobox.removeAllItems(); combobox.removeAllItems();
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {
combobox.addItem(array[i]); combobox.addItem(array[i]);
@ -257,6 +258,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
/** /**
* *
*/ */
@Override
public void reset() { public void reset() {
populateBean(new BarcodePresent()); populateBean(new BarcodePresent());
} }
@ -269,10 +271,14 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
} }
this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType())); this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType()));
this.typeComboBox.setSelectedIndex(barcodeAttr.getType()); this.typeComboBox.setSelectedIndex(barcodeAttr.getType());
this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth()) * 10); if (barcodeAttr.getType() == NUM16) {
this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); this.versionComboBox.setSelectedIndex(barcodeAttr.getRCodeVersion());
this.errorCorrectComboBox.setSelectedIndex(barcodeAttr.getRCodeErrorCorrect());
this.sizeSpinner.setValue(barcodeAttr.getRcodeDrawPix());
}
this.barWidthSpinner.setValue(barcodeAttr.getBarWidth() * 10);
this.barHeightSpinner.setValue(barcodeAttr.getBarHeight());
this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText());
this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix()));
this.repaintPreviewBarCode(); this.repaintPreviewBarCode();
} }
@ -280,12 +286,12 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
public BarcodePresent updateBean() { public BarcodePresent updateBean() {
BarcodeAttr barcodeAttr = new BarcodeAttr(); BarcodeAttr barcodeAttr = new BarcodeAttr();
if ((typeComboBox.getSelectedIndex() == NUM16)) { if ((typeComboBox.getSelectedIndex() == NUM16)) {
barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); barcodeAttr.setRCodeVersion(this.versionComboBox.getSelectedIndex());
barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); barcodeAttr.setRCodeErrorCorrect(this.errorCorrectComboBox.getSelectedIndex());
barcodeAttr.setRcodeDrawPix((int) this.RCodesizespinner.getValue()); barcodeAttr.setRcodeDrawPix((int) this.sizeSpinner.getValue());
} }
barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); barcodeAttr.setType(this.typeComboBox.getSelectedIndex());
barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); barcodeAttr.setBarWidth(this.barWidthSpinner.getValue() / 10);
barcodeAttr.setBarHeight((int) this.barHeightSpinner.getValue()); barcodeAttr.setBarHeight((int) this.barHeightSpinner.getValue());
barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected());
return new BarcodePresent(barcodeAttr); return new BarcodePresent(barcodeAttr);
@ -303,7 +309,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private Object obj; private Object obj;
public BarCodePreviewPane() { public BarCodePreviewPane() {
// setBackground(Color.WHITE);
} }
/** /**

Loading…
Cancel
Save