Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/10.0)

* commit '6285c817c8c30912fccb173ee6b4cb8d15f53e97':
  修改enum解析
  修改一个SB写法
  REPORT-12622 文本控件支持扫码 ui部分
  单元格设置面板的预览单元格那个checkbox的值没有正确的被set到CellGUIAttr,导致值没有被write到模板。
  REPORT-12593 10.0预览单元格内容复选框失效 单元格设置面板的预览单元格那个checkbox的值没有正确的被set到CellGUIAttr,导致值没有被write到模板。
  代码修改
  代码修改
  REPORT-12391 本地打印端口号可配置=>调整代码
  REPORT-12391 本地打印端口号可配置=>设计器部分
  REPORT-10535	设计器适配功能—移动端TAB组件多样化
  改命名
  更换数组
  CHART-3206 & CHART-3374 9to10
  删除多余内容
  兼容所有版本的坐标轴刻度
  无JIRA任务 代码耦合
  REPORT-12721 HistoryTemplateListPane插件兼容
  REPORT-12721 HistoryTemplateListPane插件兼容
  REPORT-12697 mac在jni在部分系统下报签名失败
  REPORT-12161 & REPORT-10599
research/10.0
yaoh.wu 6 years ago
parent
commit
0066d0e1f3
  1. 23
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  2. 144
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java
  3. 14
      designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java
  4. 27
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  5. 4
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  6. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  7. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  8. 99
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java
  9. 193
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java
  10. 108
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java
  11. 218
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  12. 165
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java
  13. 113
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java
  14. 172
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java
  15. 55
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java
  16. 222
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java
  17. 29
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  18. 144
      designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java
  19. 50
      designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java
  20. 10
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java
  21. 13
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java
  22. 113
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  23. 5
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java
  24. 14
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java
  25. 53
      designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java
  26. 2
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java
  27. 12
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  28. 18
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java
  29. 6
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  30. 30
      designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java
  31. 19
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  32. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java
  33. 69
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  34. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  35. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  36. 47
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java
  37. 3
      designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java
  38. 50
      designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java
  39. BIN
      designer-realize/src/main/resources/com/fr/start/jni/splash.dylib

23
designer-base/src/main/java/com/fr/design/dialog/UIDialog.java

@ -73,7 +73,7 @@ public abstract class UIDialog extends JDialog {
}
this.setName(pane.title4PopupWindow());
this.setModal(true);
this.pack();
GUICoreUtils.centerWindow(this);
}
@ -90,12 +90,10 @@ public abstract class UIDialog extends JDialog {
//取消
addCancelButton(buttonsPane);
this.getRootPane().setDefaultButton(okButton);
return controlPane;
}
protected void addCustomButton(JPanel buttonsPane){
protected void addCustomButton(JPanel buttonsPane) {
}
@ -110,6 +108,18 @@ public abstract class UIDialog extends JDialog {
doCancel();
}
});
JPanel defaultPane = (JPanel) this.getContentPane();
InputMap inputMapAncestor = defaultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap actionMap = defaultPane.getActionMap();
// transfer focus to CurrentEditor
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "dialogOK");
actionMap.put("dialogOK", new AbstractAction() {
public void actionPerformed(ActionEvent evt) {
doOK();
}
});
}
private void addOkButton(JPanel buttonsPane) {
@ -130,7 +140,6 @@ public abstract class UIDialog extends JDialog {
* 添加监听器
*
* @param l 监听器
*
*/
public void addDialogActionListener(DialogActionListener l) {
listeners.add(l);
@ -138,7 +147,6 @@ public abstract class UIDialog extends JDialog {
/**
* 清除所有监听器
*
*/
public void clearDialogActionListeners() {
listeners.clear();
@ -146,7 +154,6 @@ public abstract class UIDialog extends JDialog {
/**
* 确定操作
*
*/
public void doOK() {
try {
@ -177,7 +184,6 @@ public abstract class UIDialog extends JDialog {
/**
* 取消操作
*
*/
public void doCancel() {
@ -224,7 +230,6 @@ public abstract class UIDialog extends JDialog {
/**
* 检测结果是否合法
*
*/
public abstract void checkValid() throws Exception;

144
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java

@ -1,16 +1,154 @@
package com.fr.design.file;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import java.util.List;
/**
* 历史模板缓存
*
* <p>
* 为可能存在的插件做兼容处理
*
* @see HistoryTemplateListCache
* @deprecated use HistoryTemplateListCache instead
*/
@Deprecated
public class HistoryTemplateListPane {
public static HistoryTemplateListCache getInstance() {
public class HistoryTemplateListPane implements CallbackEvent {
private static volatile HistoryTemplateListPane THIS;
public static HistoryTemplateListPane getInstance() {
if (THIS == null) {
synchronized (HistoryTemplateListPane.class) {
if (THIS == null) {
THIS = new HistoryTemplateListPane();
}
}
}
return THIS;
}
private static HistoryTemplateListCache instead() {
return HistoryTemplateListCache.getInstance();
}
/**
* 关闭选择的文件
*
* @param selected 选择的
*/
public void closeSelectedReport(JTemplate<?, ?> selected) {
instead().closeSelectedReport(selected);
}
/**
* 临时关闭选择的文件
*
* @param selected 选择的
*/
public void closeVirtualSelectedReport(JTemplate<?, ?> selected) {
instead().closeVirtualSelectedReport(selected);
}
public JTemplate<?, ?> getCurrentEditingTemplate() {
return instead().getCurrentEditingTemplate();
}
public void setCurrentEditingTemplate(JTemplate<?, ?> jt) {
instead().setCurrentEditingTemplate(jt);
}
/**
* 添加历史记录
*/
public void addHistory() {
instead().addHistory();
}
public List<JTemplate<?, ?>> getHistoryList() {
return instead().getHistoryList();
}
/**
* 清空历史记录
*/
public void removeAllHistory() {
instead().removeAllHistory();
}
public int getHistoryCount() {
return instead().getHistoryCount();
}
public JTemplate<?, ?> get(int index) {
return instead().get(index);
}
public JTemplate<?, ?> getTemplate(int index) {
return instead().getTemplate(index);
}
/**
* 获取模板的index
*
* @param jt 模板
* @return 位置
*/
public int contains(JTemplate<?, ?> jt) {
return instead().contains(jt);
}
/**
* 判断是否打开过该模板
*
* @param filename 文件名
* @return 文件位置
*/
public int contains(String filename) {
return instead().contains(filename);
}
/**
* 是否是当前编辑的文件
*
* @param filename 文件名
* @return 是则返回TRUE
*/
public boolean isCurrentEditingFile(String filename) {
return instead().isCurrentEditingFile(filename);
}
@Override
public void callback() {
instead().callback();
}
/**
* 打开new模板的同时关闭old模板,优先关已保存的先打开的
*/
public void closeOverLineTemplate() {
instead().closeOverLineTemplate();
}
public void deleteFile(FileNodeFILE file) {
instead().deleteFile(file);
}
public boolean rename(FILE tplFile, String from, String to) {
return instead().rename(tplFile, from, to);
}
}

14
designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java

@ -10,32 +10,36 @@ import com.fr.stable.fun.mark.Mutable;
*/
public interface ConnectionProvider extends Mutable {
public static final String XML_TAG = "ConnectionProvider";
String XML_TAG = "ConnectionProvider";
// 2016-12-14 1 -> 2 , 增加connection.feature方法导致不兼容.
int CURRENT_LEVEL = 2;
/**
* 数据连接弹出菜单的名字
*
* @return 名字
*/
public String nameForConnection();
String nameForConnection();
/**
* 数据连接弹出菜单的图标
*
* @return 图标路径
*/
public String iconPathForConnection();
String iconPathForConnection();
/**
* 数据连接的类型
*
* @return 连接类型
*/
public Class<? extends com.fr.data.impl.Connection> classForConnection();
Class<? extends com.fr.data.impl.Connection> classForConnection();
/**
* 数据连接的设计界面
*
* @return 设计界面
*/
public Class<? extends BasicBeanPane<? extends Connection>> appearanceForConnection();
Class<? extends BasicBeanPane<? extends Connection>> appearanceForConnection();
}

27
designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java

@ -28,6 +28,7 @@ import java.util.ArrayList;
public class JSContentPane extends BasicPane {
private RSyntaxTextArea contentTextArea;
private UILabel funNameLabel;
private AutoCompletion ac;
private int titleWidth = 180;
@ -78,14 +79,6 @@ public class JSContentPane extends BasicPane {
contentTextArea.setCodeFoldingEnabled(true);
contentTextArea.setAntiAliasingEnabled(true);
CompletionProvider provider = createCompletionProvider();
AutoCompletion ac = new AutoCompletion(provider);
String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts();
ac.setTriggerKey(convert2KeyStroke(shortCuts));
ac.install(contentTextArea);
UIScrollPane sp = new UIScrollPane(contentTextArea);
this.add(sp, BorderLayout.CENTER);
@ -104,13 +97,31 @@ public class JSContentPane extends BasicPane {
}
public void populate(String js) {
if (ac == null) {
CompletionProvider provider = createCompletionProvider();
ac = new AutoCompletion(provider);
String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts();
ac.setTriggerKey(convert2KeyStroke(shortCuts));
ac.install(contentTextArea);
}
this.contentTextArea.setText(js);
}
public String update() {
if (ac != null) {
this.ac.uninstall();
ac = null;
}
return this.contentTextArea.getText();
}
public void reset() {
this.contentTextArea.setText(null);
}
public void setFunctionTitle(String[] args) {
funNameLabel.setText(createFunctionTitle(args));
}

4
designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java

@ -138,6 +138,9 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
public void populateBean(JavaScriptImpl javaScriptImpl) {
if (javaScriptImpl == null) {
javaScriptImpl = new JavaScriptImpl();
jsPane.reset();
}else{
jsPane.populate(javaScriptImpl.getContent());
}
int rowCount = javaScriptImpl.getJSImportSize();
@ -147,7 +150,6 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
}
importedJsPane.populate(value);
parameterPane.populate(javaScriptImpl.getParameters());
jsPane.populate(javaScriptImpl.getContent());
if (itemNameTextField != null) {
itemNameTextField.setText(javaScriptImpl.getItemName());

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

@ -155,6 +155,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// 右边的虚线
private DottedLine rightDottedLine;
//用于判断设计器是否打开了
private boolean designerOpened = false;
private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth());
private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight());
@ -351,7 +354,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
public void addDesignerOpenedListener(DesignerOpenedListener listener) {
designerOpenedListenerList.add(listener);
if (!designerOpened) {
designerOpenedListenerList.add(listener);
}
}
/**
@ -362,6 +367,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
for (DesignerOpenedListener listener : designerOpenedListenerList) {
listener.designerOpened();
}
designerOpened = true;
//使用完清除监听
designerOpenedListenerList.clear();
}
protected DesktopCardPane getCenterTemplateCardPane() {

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

@ -780,7 +780,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
((JTemplateActionListener) listeners[i + 1]).templateClosed(this);
}
}
this.undoState = null;
this.repaint(30);
}

99
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java

@ -0,0 +1,99 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import java.awt.BasicStroke;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane {
public DefaultMobileStyleDefinePane(WCardTagLayout tagLayout) {
super(tagLayout);
}
@Override
public void populateBean(MobileTemplateStyle ob) {
updatePreviewPane();
}
protected void createConfigPane() {
}
@Override
protected void initDefaultConfig() {
}
@Override
public MobileTemplateStyle updateSubStyle() {
return null;
}
@Override
public MobileTemplateStyle updateBean() {
return new DefaultMobileTemplateStyle();
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new DefaultMobileTemplateStyle();
}
@Override
protected String title4PopupWindow() {
return null;
}
protected MobileTemplatePreviewPane createPreviewPane() {
return new DefaultStylePreviewPane();
}
public class DefaultStylePreviewPane extends MobileTemplatePreviewPane {
public DefaultStylePreviewPane() {
this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR);
}
public void repaint() {
super.repaint();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Dimension dimension = this.getSize();
int panelWidth = dimension.width;
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();
g2d.setFont(frFont);
int fontHeight = fm.getHeight();
int ascentHeight = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String widgetName = cardSwitchButton.getText();
int width = fm.stringWidth(widgetName);
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight);
if (i == 0) {
g2d.setStroke(new BasicStroke(2.0f));
g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1);
}
g2d.translate(eachWidth, 0);
}
}
}
}

193
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java

@ -0,0 +1,193 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper;
import com.fr.base.IconManager;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.DownMenuStyle;
import com.fr.general.cardtag.mobile.LineDescription;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.util.ArrayList;
public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
private LinePane splitLinePane;
private TabIconConfigPane initIconConfigPane;
private TabIconConfigPane selectIconConfigPane;
public DownMenuStyleDefinePane(WCardTagLayout tagLayout) {
super(tagLayout);
}
protected void createExtraConfPane(JPanel centerPane) {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
UITitleSplitLine iconSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"), 520);
iconSplitLine.setPreferredSize(new Dimension(520, 20));
centerPane.add(iconSplitLine);
initIconConfigPane = new TabIconConfigPane(getTagLayout().getWidgetCount());
selectIconConfigPane = new TabIconConfigPane(getTagLayout().getWidgetCount());
UILabel initIconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Initial_Icon"));
UILabel selectIconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Icon"));
initIconLabel.setPreferredSize(new Dimension(55, 20));
selectIconLabel.setPreferredSize(new Dimension(55, 20));
JPanel initIconContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initIconLabel, initIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
JPanel selectIconContainePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectIconLabel, selectIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
initIconContainPane.setPreferredSize(new Dimension(240, 50));
selectIconContainePane.setPreferredSize(new Dimension(240, 50));
panel.add(initIconContainPane);
panel.add(selectIconContainePane);
UITitleSplitLine splitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
splitLinePane = new LinePane();
splitLinePane.addLineChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
centerPane.add(panel);
centerPane.add(splitLine);
centerPane.add(splitLinePane);
}
@Override
protected void initDefaultConfig() {
this.initialColorBox.setSelectObject(DownMenuStyle.DEFAULT_INITIAL_COLOR);
this.fontConfPane.populate(DownMenuStyle.DEFAULT_TAB_FONT.getFont());
this.selectColorBox.setSelectObject(DownMenuStyle.DEFAULT_SELECT_COLOR);
this.selectFontColor.setColor(DownMenuStyle.DEFAULT_SELECT_FONT_COLOR);
this.splitLinePane.populate(DownMenuStyle.DEFAULT_SPLIT_LINE);
}
@Override
protected MobileTemplatePreviewPane createPreviewPane() {
return new DownMenuStylePreviewPane();
}
@Override
public void populateBean(MobileTemplateStyle ob) {
super.populateBean(ob);
DownMenuStyle downMenuStyle = (DownMenuStyle) ob;
splitLinePane.populate(downMenuStyle.getSplitLine());
ArrayList<String> initialIconNames = new ArrayList<String>();
ArrayList<String> selectIconNames = new ArrayList<String>();
for (int i = 0; i < getTagLayout().getWidgetCount(); i++) {
CardSwitchButton cardSwitchButton = (CardSwitchButton) getTagLayout().getWidget(i);
initialIconNames.add(cardSwitchButton.getInitIconName());
selectIconNames.add(cardSwitchButton.getSelectIconName());
}
initIconConfigPane.populate(initialIconNames);
selectIconConfigPane.populate(selectIconNames);
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new DownMenuStyle();
}
@Override
public MobileTemplateStyle updateStyleWithSelectConf() {
DownMenuStyle downMenuStyle = new DownMenuStyle();
downMenuStyle.setSplitLine(splitLinePane.update());
ArrayList<String> initialIconNames = initIconConfigPane.update();
ArrayList<String> selectIconNames = selectIconConfigPane.update();
for (int i = 0; i < getTagLayout().getWidgetCount(); i++) {
CardSwitchButton cardSwitchButton = (CardSwitchButton) getTagLayout().getWidget(i);
cardSwitchButton.setInitIconName(initialIconNames.get(i));
cardSwitchButton.setSelectIconName(selectIconNames.get(i));
}
return downMenuStyle;
}
@Override
protected String title4PopupWindow() {
return null;
}
public class DownMenuStylePreviewPane extends MobileTemplatePreviewPane {
private static final int ICON_OFFSET = 16;
private static final int GAP = 6;
private static final String PAINT_ICON = "fund_white";
private LineDescription splitLine;
public DownMenuStylePreviewPane() {
this.setBackground(Color.decode("#3888EE"));
}
public void repaint() {
super.repaint();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Color selectFontColor = this.getTabFontConfig().getSelectColor();
Dimension dimension = this.getSize();
int panelWidth = dimension.width;
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();
g2d.setFont(frFont);
int fontHeight = fm.getHeight();
int ascent = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground());
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String widgetName = cardSwitchButton.getText();
int width = fm.stringWidth(widgetName);
if(i == 0){
Color oldColor = g2d.getColor();
g2d.setColor(this.getSelectColor());
g2d.fillRect(0, 0 ,eachWidth, panelHeight);
g2d.setColor(oldColor);
}
String iconName = PAINT_ICON;
g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null);
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent);
Stroke oldStroke = g2d.getStroke();
if (splitLine.getLineStyle() != 0) {
g2d.setColor(splitLine.getColor());
g2d.setStroke(GraphHelper.getStroke(splitLine.getLineStyle()));
g2d.drawLine(eachWidth, 0, eachWidth, panelHeight);
}
g2d.setStroke(oldStroke);
g2d.translate(eachWidth, 0);
}
}
public void populateConfig(MobileTemplateStyle templateStyle) {
super.populateConfig(templateStyle);
this.splitLine = ((DownMenuStyle) templateStyle).getSplitLine();
}
}
}

108
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java

@ -0,0 +1,108 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.general.cardtag.mobile.LineDescription;
import com.fr.stable.CoreConstants;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class LinePane extends JPanel {
private LineComboBox lineStyle;
private NewColorSelectBox lineColor;
private EventListenerList lineChangeListener = new EventListenerList();
public LinePane() {
init();
}
private void init() {
this.setLayout(new VerticalFlowLayout(FlowLayout.CENTER, 0, 10));
this.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
UILabel lineLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style"));
UILabel colorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors"));
lineLabel.setPreferredSize(new Dimension(55, 20));
colorLabel.setPreferredSize(new Dimension(55, 20));
lineStyle = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
lineStyle.setPreferredSize(new Dimension(152, 20));
lineColor = new NewColorSelectBox(137);
lineStyle.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
fireLineStateChanged();
}
});
lineColor.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
fireLineStateChanged();
}
});
this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{lineLabel, lineStyle}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM));
this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{colorLabel, lineColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM));
}
public LineDescription update() {
LineDescription lineDescription = new LineDescription();
lineDescription.setColor(lineColor.getSelectObject());
lineDescription.setLineStyle(lineStyle.getSelectedLineStyle());
return lineDescription;
}
public void populate(LineDescription lineDescription) {
lineStyle.setSelectedLineStyle(lineDescription.getLineStyle());
lineColor.setSelectObject(lineDescription.getColor());
}
/**
* 添加监听
*
* @param changeListener 监听列表
*/
public void addLineChangeListener(ChangeListener changeListener) {
lineChangeListener.add(ChangeListener.class, changeListener);
}
/**
* 移除监听
* Removes an old ColorChangeListener.
*
* @param changeListener 监听列表
*/
public void removeLineChangeListener(ChangeListener changeListener) {
lineChangeListener.remove(ChangeListener.class, changeListener);
}
/**
* 颜色状态改变
*/
public void fireLineStateChanged() {
Object[] listeners = lineChangeListener.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
}

218
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -0,0 +1,218 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.MobileTabFontConfPane;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
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.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<MobileTemplateStyle> {
private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")};
private UIComboBox custom;
protected NewColorSelectBox initialColorBox;
protected MobileTabFontConfPane fontConfPane;
private JPanel centerPane;
protected MobileTemplatePreviewPane previewPane;
private WCardTagLayout tagLayout;
public MobileTemplatePreviewPane getPreviewPane() {
return previewPane;
}
public MobileTemplateStyleDefinePane(WCardTagLayout tagLayout) {
this.tagLayout = tagLayout;
init();
}
public WCardTagLayout getTagLayout() {
return tagLayout;
}
protected void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
previewPane = createPreviewPane();
previewPane.setPreferredSize(new Dimension(500, 60));
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE));
northPane.setBorder(titledBorder);
northPane.setPreferredSize(new Dimension(500, 83));
northPane.add(previewPane, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH);
createConfigPane();
}
protected void createConfigPane() {
JPanel configPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE));
configPane.setBorder(titledBorder);
centerPane = createCenterPane();
custom = new UIComboBox(TAB_STYLES);
custom.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean isCustom = custom.getSelectedIndex() == 1;
centerPane.setVisible(isCustom);
updatePreviewPane();
}
});
centerPane.setVisible(false);
custom.setPreferredSize(new Dimension(157, 20));
final JPanel scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
BasicScrollPane basicScrollPane = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return scrollPanel;
}
};
configPane.add(basicScrollPane, BorderLayout.CENTER);
this.add(configPane, BorderLayout.CENTER);
JPanel outPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
outPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20));
UILabel tabStyleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Style"));
tabStyleLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tabStyleLabel, custom}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel.setPreferredSize(new Dimension(200, 20));
outPanel.add(jPanel);
scrollPanel.add(outPanel, BorderLayout.NORTH);
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520);
backgroundSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(backgroundSplit);
centerPane.add(createBackgroundConfPane());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520);
fontSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(fontSplit);
centerPane.add(createFontConfPane());
createExtraConfPane(centerPane);
scrollPanel.add(centerPane, BorderLayout.CENTER);
initDefaultConfig();
}
protected JPanel createCenterPane() {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
return panel;
}
protected JPanel createBackgroundConfPane() {
initialColorBox = new NewColorSelectBox(137);
initialColorBox.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
UILabel fillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill"));
fillLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{fillLabel, initialColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel.setPreferredSize(new Dimension(240, 20));
initialColorBox.setPreferredSize(new Dimension(157, 20));
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
return jPanel;
}
protected JPanel createFontConfPane() {
fontConfPane = new MobileTabFontConfPane();
fontConfPane.addFontChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
UILabel initCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char"));
initCharLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel3 = GUICoreUtils.createBoxFlowInnerContainerPane(5, 0);
jPanel3.add(initCharLabel);
jPanel3.add(fontConfPane);
jPanel3.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
return jPanel3;
}
protected void createExtraConfPane(JPanel centerPane) {
}
protected abstract void initDefaultConfig();
protected abstract MobileTemplatePreviewPane createPreviewPane();
@Override
public void populateBean(MobileTemplateStyle ob) {
centerPane.setVisible(ob.isCustom());
custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"));
initialColorBox.setSelectObject(ob.getInitialColor());
fontConfPane.populate(ob.getTabFontConfig().getFont());
updatePreviewPane();
}
@Override
public MobileTemplateStyle updateBean() {
if (custom.getSelectedIndex() == 0) {
return getDefaultTemplateStyle();
}
MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(custom.getSelectedIndex() == 1);
ob.setInitialColor(initialColorBox.getSelectObject());
TabFontConfig config = ob.getTabFontConfig();
config.setFont(fontConfPane.update());
return ob;
}
protected abstract MobileTemplateStyle getDefaultTemplateStyle();
public void updatePreviewPane() {
previewPane.populateConfig(updateBean());
previewPane.setBackground(previewPane.getInitialColor());
previewPane.repaint();
}
public abstract MobileTemplateStyle updateSubStyle();
@Override
protected String title4PopupWindow() {
return null;
}
}

165
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java

@ -0,0 +1,165 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.SliderStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
private NewColorSelectBox initDotColor;
private NewColorSelectBox selectDotColor;
public SliderStyleDefinePane(WCardTagLayout tagLayout) {
super(tagLayout);
}
@Override
public void populateBean(MobileTemplateStyle ob) {
super.populateBean(ob);
SliderStyle sliderStyle = (SliderStyle) ob;
initDotColor.setSelectObject(sliderStyle.getInitDotColor());
selectDotColor.setSelectObject(sliderStyle.getSelectDotColor());
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new SliderStyle();
}
@Override
public MobileTemplateStyle updateSubStyle() {
SliderStyle sliderStyle = new SliderStyle();
sliderStyle.setInitDotColor(initDotColor.getSelectObject());
sliderStyle.setSelectDotColor(selectDotColor.getSelectObject());
return sliderStyle;
}
protected void createExtraConfPane(JPanel centerPane) {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
UITitleSplitLine dotIndicator = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Dot_Indicator"), 520);
dotIndicator.setPreferredSize(new Dimension(520, 20));
centerPane.add(dotIndicator);
initDotColor = new NewColorSelectBox(137);
initDotColor.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
selectDotColor = new NewColorSelectBox(137);
selectDotColor.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
UILabel initColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill"));
UILabel selectColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill"));
initColor.setPreferredSize(new Dimension(55, 20));
selectColor.setPreferredSize(new Dimension(55, 20));
JPanel initDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initColor, initDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
initDotColorPane.setPreferredSize(new Dimension(240, 20));
selectDotColorPane.setPreferredSize(new Dimension(240, 20));
panel.add(initDotColorPane);
panel.add(selectDotColorPane);
centerPane.add(panel);
}
@Override
protected void initDefaultConfig() {
this.initialColorBox.setSelectObject(SliderStyle.DEFAULT_INITIAL_COLOR);
this.fontConfPane.populate(SliderStyle.DEFAULT_TAB_FONT.getFont());
initDotColor.setSelectObject(SliderStyle.DEFAULT_INITIAL_DOT_COLOR);
selectDotColor.setSelectObject(SliderStyle.DEFAULT_SELECT_DOT_COLOR);
}
@Override
protected MobileTemplatePreviewPane createPreviewPane() {
return new SliderStylePreviewPane();
}
@Override
protected String title4PopupWindow() {
return null;
}
public class SliderStylePreviewPane extends MobileTemplatePreviewPane {
private static final int CIRCLE_SIZE = 6;
private static final int GAP = 4;
private static final int OFFSET_X = 10;
private Color initDotColor;
private Color selectDotColor;
public SliderStylePreviewPane() {
}
public void repaint() {
super.repaint();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Dimension dimension = this.getSize();
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = this.getTabFontConfig().getFont();
g2d.setFont(frFont);
g2d.setColor(frFont.getForeground());
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
int fontHeight = fm.getHeight();
int ascent = fm.getAscent();
g2d.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Title"), OFFSET_X, (panelHeight - fontHeight - GAP - CIRCLE_SIZE) / 2 + ascent);
WCardTagLayout cardTagLayout = SliderStyleDefinePane.this.getTagLayout();
g2d.translate(OFFSET_X, (panelHeight + fontHeight + GAP - CIRCLE_SIZE) / 2);
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
if (i == 0) {
g2d.setColor(selectDotColor);
g2d.fillOval(0, 0, CIRCLE_SIZE, CIRCLE_SIZE);
g2d.translate(CIRCLE_SIZE + GAP, 0);
continue;
}
g2d.setColor(initDotColor);
g2d.fillOval(0, 0, CIRCLE_SIZE, CIRCLE_SIZE);
g2d.translate(CIRCLE_SIZE + GAP, 0);
}
}
public void populateConfig(MobileTemplateStyle templateStyle) {
super.populateConfig(templateStyle);
this.initDotColor = ((SliderStyle) templateStyle).getInitDotColor();
this.selectDotColor = ((SliderStyle) templateStyle).getSelectDotColor();
}
}
}

113
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java

@ -0,0 +1,113 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.MobileTabFontConfPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
public abstract class StyleDefinePaneWithSelectConf extends MobileTemplateStyleDefinePane {
protected NewColorSelectBox selectColorBox;
protected UIColorButton selectFontColor;
public StyleDefinePaneWithSelectConf(WCardTagLayout tagLayout) {
super(tagLayout);
}
protected JPanel createBackgroundConfPane() {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
initialColorBox = new NewColorSelectBox(137);
initialColorBox.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
selectColorBox = new NewColorSelectBox(137);
selectColorBox.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
UILabel initFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill"));
UILabel selectFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill"));
initFillLabel.setPreferredSize(new Dimension(55, 20));
selectFillLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initFillLabel, initialColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
JPanel jPanel3 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectFillLabel, selectColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel2.setPreferredSize(new Dimension(240, 20));
jPanel3.setPreferredSize(new Dimension(240, 20));
panel.add(jPanel2);
panel.add(jPanel3);
return panel;
}
protected JPanel createFontConfPane() {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
fontConfPane = new MobileTabFontConfPane();
fontConfPane.addFontChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
selectFontColor = new UIColorButton();
selectFontColor.addColorChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
UILabel initCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char"));
initCharLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel3 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initCharLabel, fontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel3.setPreferredSize(new Dimension(500, 20));
UILabel selectCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Select_Char"));
selectCharLabel.setPreferredSize(new Dimension(55, 20));
selectFontColor.setPreferredSize(new Dimension(20, 20));
JPanel jPanel4 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectCharLabel, selectFontColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
JPanel jPanel5 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
jPanel5.setPreferredSize(new Dimension(500, 20));
jPanel5.add(jPanel4);
panel.add(jPanel3);
panel.add(jPanel5);
return panel;
}
@Override
public MobileTemplateStyle updateSubStyle() {
MobileTemplateStyle mobileTemplateStyle = updateStyleWithSelectConf();
mobileTemplateStyle.setSelectColor(selectColorBox.getSelectObject());
mobileTemplateStyle.getTabFontConfig().setSelectColor(selectFontColor.getColor());
return mobileTemplateStyle;
}
protected abstract MobileTemplateStyle updateStyleWithSelectConf();
@Override
public void populateBean(MobileTemplateStyle mobileTemplateStyle) {
super.populateBean(mobileTemplateStyle);
selectColorBox.setSelectObject(mobileTemplateStyle.getSelectColor());
selectFontColor.setColor(mobileTemplateStyle.getTabFontConfig().getSelectColor());
}
}

172
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java

@ -0,0 +1,172 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper;
import com.fr.base.IconManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
public class TabIconConfigPane extends JPanel {
private UIButton editIconButton;
private String curIconName;
private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
public TabIconConfigPane(int count) {
initComp(count);
}
public void initComp(int count) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(editIconButton);
editIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final CustomIconPane cip = new CustomIconPane();
BasicDialog editDialog = cip.showWindow(DesignerContext.getDesignerFrame());
editDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
curIconName = cip.update();
setShowIconImage();
TabIconConfigPane.this.repaint();
}
});
editDialog.setVisible(true);
}
});
editIconButton.setEnabled(false);
this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel();
northPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
for (int i = 0; i < count; i++) {
IconButton iconButton = new IconButton("");
northPane.add(iconButton);
iconButtons.add(iconButton);
}
this.add(northPane, BorderLayout.NORTH);
}
public void setShowIconImage() {
selectIconButton.setIconName(curIconName);
}
public void populate(ArrayList<String> iconArr) {
for (int i = 0; i < iconButtons.size(); i++) {
iconButtons.get(i).setIconName(iconArr.get(i));
}
}
public ArrayList<String> update() {
ArrayList<String> iconNames = new ArrayList<String>();
for (int i = 0; i < iconButtons.size(); i++) {
iconNames.add(iconButtons.get(i).getIconName());
}
return iconNames;
}
private class IconButton extends JToggleButton implements ActionListener {
private String iconName;
private Image iconImage = null;
private static final int ICON_BUTTON_SIZE = 20;
private static final int ICON_X = 2;
private static final int ICON_Y = 2;
public IconButton(String name) {
this.iconName = name;
this.addActionListener(this);
this.setBackground(Color.WHITE);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name);
}
@Override
public void updateUI() {
setUI(new BasicButtonUI() {
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
}
});
}
public String getIconName() {
return iconName;
}
public void setIconName(String iconName) {
this.iconName = iconName;
this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
// carl:这里缩放显示 16 × 16
if (iconImage != null) {
g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null);
}
if (this.iconName != null && ComparatorUtils.equals(this, selectIconButton)) {
g2d.setPaint(Color.decode("#419BF9"));
} else {
g2d.setPaint(Color.decode("#D9DADD"));
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, 20, 20), Constants.LINE_MEDIUM);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE);
}
public void actionPerformed(ActionEvent evt) {
selectIconButton = this;
editIconButton.setEnabled(true);
TabIconConfigPane.this.repaint();// repaint
}
@Override
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
}
}

55
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java

@ -0,0 +1,55 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle;
import com.fr.general.cardtag.mobile.DownMenuStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.SliderStyle;
import com.fr.general.cardtag.mobile.UpMenuStyle;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import java.util.HashMap;
import java.util.Map;
public class TemplateStyleDefinePaneFactory {
private static Map<String, StyleDefinePaneUI> defineMap = new HashMap<String, StyleDefinePaneUI>();
static {
defineMap.put(DefaultMobileTemplateStyle.STYLE_NAME, new StyleDefinePaneUI(DefaultMobileStyleDefinePane.class));
defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class));
defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class));
defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class));
}
public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) {
StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style);
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = styleDefinePaneUI.getaClass();
if (clazz == null) {
}
BasicBeanPane<MobileTemplateStyle> quickPane = null;
try {
quickPane = Reflect.on(clazz).create(tagLayout).get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return quickPane;
}
private static class StyleDefinePaneUI {
private Class<? extends BasicBeanPane<MobileTemplateStyle>> aClass;
public StyleDefinePaneUI(Class<? extends BasicBeanPane<MobileTemplateStyle>> aClass) {
this.aClass = aClass;
}
public Class<? extends BasicBeanPane<MobileTemplateStyle>> getaClass() {
return aClass;
}
public void setaClass(Class<? extends BasicBeanPane<MobileTemplateStyle>> aClass) {
this.aClass = aClass;
}
}
}

222
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java

@ -0,0 +1,222 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.LineDescription;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.UpMenuStyle;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
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.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Stroke;
public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
private UIRadioButton gapFix;
private UIRadioButton titleWidthFix;
private LinePane bottomBorderPane;
private LinePane underLinePane;
public UpMenuStyleDefinePane(WCardTagLayout tagLayout) {
super(tagLayout);
}
protected JPanel createCenterPane() {
JPanel panel = super.createCenterPane();
UILabel displayGap = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Display_Gap"));
displayGap.setPreferredSize(new Dimension(55, 20));
gapFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Gap_Fix"));
titleWidthFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Title_Width_Fix"));
ButtonGroup buttonGroup = new ButtonGroup();
titleWidthFix.setSelected(true);
buttonGroup.add(gapFix);
gapFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
titleWidthFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
buttonGroup.add(titleWidthFix);
gapFix.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
titleWidthFix.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
JPanel flowLeft = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
flowLeft.add(gapFix);
flowLeft.add(titleWidthFix);
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{displayGap, flowLeft}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 15, 20));
centerPane.setPreferredSize(new Dimension(500, 20));
JPanel outerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
outerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0));
outerPane.add(centerPane, BorderLayout.CENTER);
panel.add(outerPane);
return panel;
}
protected void createExtraConfPane(JPanel centerPane) {
bottomBorderPane = new LinePane();
underLinePane = new LinePane();
bottomBorderPane.addLineChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
underLinePane.addLineChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updatePreviewPane();
}
});
UITitleSplitLine titleSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520);
titleSplitLine.setPreferredSize(new Dimension(520, 20));
centerPane.add(titleSplitLine);
centerPane.add(bottomBorderPane);
UITitleSplitLine titleUnderLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Under_Line"), 520);
titleUnderLine.setPreferredSize(new Dimension(520, 20));
centerPane.add(titleUnderLine);
centerPane.add(underLinePane);
}
@Override
protected void initDefaultConfig() {
this.initialColorBox.setSelectObject(UpMenuStyle.DEFAULT_INITIAL_COLOR);
this.fontConfPane.populate(UpMenuStyle.DEFAULT_TAB_FONT.getFont());
this.selectColorBox.setSelectObject(UpMenuStyle.DEFAULT_SELECT_COLOR);
this.selectFontColor.setColor(UpMenuStyle.DEFAULT_SELECT_FONT_COLOR);
this.bottomBorderPane.populate(UpMenuStyle.DEFAULT_BOTTOM_BORDER);
this.underLinePane.populate(UpMenuStyle.DEFAULT_UNDER_LINE);
}
@Override
protected MobileTemplatePreviewPane createPreviewPane() {
return new UpMenuStylePreviewPane();
}
@Override
public void populateBean(MobileTemplateStyle ob) {
super.populateBean(ob);
UpMenuStyle style = (UpMenuStyle) ob;
gapFix.setSelected(style.isGapFix());
titleWidthFix.setSelected(style.isTitleWidthFix());
bottomBorderPane.populate(style.getBottomBorder());
underLinePane.populate(style.getUnderline());
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new UpMenuStyle();
}
@Override
public MobileTemplateStyle updateStyleWithSelectConf() {
UpMenuStyle style = new UpMenuStyle();
style.setGapFix(gapFix.isSelected());
style.setTitleWidthFix(titleWidthFix.isSelected());
style.setBottomBorder(bottomBorderPane.update());
style.setUnderline(underLinePane.update());
return style;
}
@Override
protected String title4PopupWindow() {
return null;
}
public class UpMenuStylePreviewPane extends MobileTemplatePreviewPane {
private LineDescription bottomBorder;
private LineDescription underLine;
private boolean isGapFix;
public UpMenuStylePreviewPane() {
this.setBackground(Color.WHITE);
}
public void repaint() {
super.repaint();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Color selectFontColor = this.getTabFontConfig().getSelectColor();
Dimension dimension = this.getSize();
int panelWidth = dimension.width;
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update();
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();
g2d.setFont(frFont);
int fontHeight = fm.getHeight();
int ascentHeight = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground());
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String widgetName = cardSwitchButton.getText();
int width = fm.stringWidth(widgetName);
if(i == 0){
Color oldColor = g2d.getColor();
g2d.setColor(this.getSelectColor());
g2d.fillRect(0, 0 ,eachWidth, panelHeight);
g2d.setColor(oldColor);
}
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight);
Stroke oldStroke = g2d.getStroke();
if (i == 0) {
g2d.setColor(this.underLine.getColor());
g2d.setStroke(GraphHelper.getStroke(underLine.getLineStyle()));
int underLineX = this.isGapFix ? (eachWidth - width) / 2 : 0;
int underLineWidth = this.isGapFix ? width : eachWidth;
g2d.drawLine(underLineX, panelHeight - 1, underLineX + underLineWidth, panelHeight - 1);
}
if (bottomBorder.getLineStyle() != 0) {
g2d.setColor(bottomBorder.getColor());
g2d.setStroke(GraphHelper.getStroke(bottomBorder.getLineStyle()));
g2d.drawLine(eachWidth, 0, eachWidth, panelHeight);
}
g2d.setStroke(oldStroke);
g2d.translate(eachWidth, 0);
}
}
public void populateConfig(MobileTemplateStyle templateStyle) {
super.populateConfig(templateStyle);
this.bottomBorder = ((UpMenuStyle) templateStyle).getBottomBorder();
this.underLine = ((UpMenuStyle) templateStyle).getUnderline();
this.isGapFix = ((UpMenuStyle) templateStyle).isGapFix();
}
}
}

29
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -148,6 +148,9 @@ public abstract class ToolBarMenuDock {
};
private static final String FINEREPORT = "FineReport";
private static final int MENUBAR_HEIGHT = 22;
private static final List<PluginEventListener> PLUGIN_LISTENERS = new ArrayList<>();
private MenuDef[] menus;
private ToolBarDef toolBarDef;
private List<UpdateActionModel> shortCutsList;
@ -218,6 +221,8 @@ public abstract class ToolBarMenuDock {
}
public MenuDef[] menus(final ToolBarMenuDockPlus plus) {
//删除之前创建的插件菜单监听
clearPluginListeners();
java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
// 添加文件菜单
menuList.add(createFileMenuDef(plus));
@ -248,6 +253,15 @@ public abstract class ToolBarMenuDock {
return menuList.toArray(new MenuDef[menuList.size()]);
}
//清空监听
private static synchronized void clearPluginListeners() {
for (PluginEventListener listener : PLUGIN_LISTENERS) {
GeneralContext.stopListenPlugin(listener);
}
PLUGIN_LISTENERS.clear();
}
/**
* 获取所有actionmodel
*
@ -644,7 +658,7 @@ public abstract class ToolBarMenuDock {
}
};
GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() {
PluginEventListener beforeStop = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
@ -652,8 +666,9 @@ public abstract class ToolBarMenuDock {
Set<MenuHandler> menuHandlers = runtime.get(MenuHandler.MARK_STRING);
removeExtraMenus(menuDef, anchor, action, menuHandlers);
}
}, filter);
GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() {
};
PluginEventListener afterRun = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
@ -662,7 +677,13 @@ public abstract class ToolBarMenuDock {
Set<MenuHandler> menuHandlers = runtime.get(MenuHandler.MARK_STRING);
addExtraMenus(menuDef, anchor, action, menuHandlers);
}
}, filter);
};
GeneralContext.listenPlugin(PluginEventType.BeforeStop, beforeStop, filter);
GeneralContext.listenPlugin(PluginEventType.AfterRun, afterRun, filter);
PLUGIN_LISTENERS.add(afterRun);
PLUGIN_LISTENERS.add(beforeStop);
}
private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set<MenuHandler> set) {

144
designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java

@ -0,0 +1,144 @@
package com.fr.design.mainframe.widget;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.general.FRFont;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Vector;
public class MobileTabFontConfPane extends JPanel {
private static final Icon[] ITALIC_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")};
private static final Icon[] BOLD_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")};
private EventListenerList fontChangeListener = new EventListenerList();
private UIComboBox fontFamily;
private UIComboBox fontSize;
private UIToggleButton bold;
private UIColorButton color;
private UIToggleButton italic;
public MobileTabFontConfPane() {
super();
init();
}
private void init() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
fontFamily = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
Vector<Integer> integerList = new Vector<Integer>();
for (int i = 1; i < 100; i++) {
integerList.add(i);
}
fontFamily.setPreferredSize(new Dimension(152, 20));
fontSize = new UIComboBox(integerList);
color = new UIColorButton();
bold = new UIToggleButton(BOLD_ICONS, true);
italic = new UIToggleButton(ITALIC_ICONS, true);
fontFamily.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
fireFontStateChanged();
}
});
fontSize.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
fireFontStateChanged();
}
});
bold.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
fireFontStateChanged();
}
});
italic.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
fireFontStateChanged();
}
});
color.addColorChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
fireFontStateChanged();
}
});
this.add(fontFamily);
this.add(fontSize);
this.add(color);
this.add(bold);
this.add(italic);
}
public FRFont update() {
String family = (String) fontFamily.getSelectedItem();
int size = (int) fontSize.getSelectedItem();
int style = Font.PLAIN;
style += this.bold.isSelected() ? Font.BOLD : Font.PLAIN;
style += this.italic.isSelected() ? Font.ITALIC : Font.PLAIN;
FRFont frFont = FRFont.getInstance(family, style, size, color.getColor());
return frFont;
}
public void populate(FRFont frFont) {
fontFamily.setSelectedItem(frFont.getFamily());
fontSize.setSelectedItem(frFont.getSize());
color.setColor(frFont.getForeground());
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
}
/**
* 添加监听
*
* @param changeListener 监听列表
*/
public void addFontChangeListener(ChangeListener changeListener) {
fontChangeListener.add(ChangeListener.class, changeListener);
}
/**
* 移除监听
* Removes an old ColorChangeListener.
*
* @param changeListener 监听列表
*/
public void removeFontChangeListener(ChangeListener changeListener) {
fontChangeListener.remove(ChangeListener.class, changeListener);
}
/**
* 颜色状态改变
*/
public void fireFontStateChanged() {
Object[] listeners = fontChangeListener.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
}

50
designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java

@ -0,0 +1,50 @@
package com.fr.design.mainframe.widget;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRFont;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
public class UITitleSplitLine extends JPanel {
private static final Color LINE_COLOR = Color.decode("#E0E0E1");
private static final Color TITLE_COLOR = Color.decode("#333334");
private static final FRFont TITLE_FONT = FRFont.getInstance("PingFangSC-Regular", 0, 12.0F);
private static final int OFFSETX = 10;
private static final int OFFSET = 3;
private Color color;
private UILabel label;
private int width;
public UITitleSplitLine(String title, int width) {
this(title, LINE_COLOR, width);
}
public UITitleSplitLine(String title, Color color, int width) {
super();
this.color = color;
this.width = width;
this.label = new UILabel(title);
}
public void paint(Graphics g) {
super.paint(g);
Dimension size = label.getPreferredSize();
int labelH = size.height;
g.setColor(color);
g.drawLine(0, labelH / 2, OFFSETX, labelH / 2);
g.drawLine(OFFSETX + size.width + OFFSET * 2, labelH / 2, width, labelH / 2);
g.translate(OFFSETX + OFFSET, 0);
label.setFont(TITLE_FONT);
label.setForeground(TITLE_COLOR);
label.setSize(size.width, size.height);
label.paint(g);
g.translate(-OFFSETX - OFFSET, 0);
}
}

10
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java

@ -0,0 +1,10 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.dialog.BasicPane;
public abstract class AbstractTemplateStylePane<T> extends BasicPane {
public abstract void populate(T ob);
public abstract T update();
}

13
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java

@ -2,7 +2,6 @@ package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.design.mainframe.widget.wrappers.TemplateStyleWrapper;
import javax.swing.SwingUtilities;
@ -15,18 +14,16 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor {
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400);
private TemplateStylePane stylePane;
private AbstractTemplateStylePane stylePane;
public AccessibleTemplateStyleEditor() {
public AccessibleTemplateStyleEditor(AbstractTemplateStylePane stylePane) {
super(new TemplateStyleWrapper());
this.stylePane = stylePane;
}
@Override
protected void showEditorPane() {
if (stylePane == null) {
stylePane = new TemplateStylePane();
stylePane.setPreferredSize(DEFAULT_DIMENSION);
}
stylePane.setPreferredSize(DEFAULT_DIMENSION);
BasicDialog dlg = stylePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@ -36,7 +33,7 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor {
fireStateChanged();
}
});
stylePane.populate((TemplateStyle) getValue());
stylePane.populate(getValue());
dlg.setVisible(true);
}
}

113
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java

@ -0,0 +1,113 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle;
import com.fr.general.cardtag.mobile.DownMenuStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.SliderStyle;
import com.fr.general.cardtag.mobile.UpMenuStyle;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTemplateStyle> {
private static final List<String> STYLE_LIST = new ArrayList<String>();
static {
STYLE_LIST.add(DefaultMobileTemplateStyle.STYLE_NAME);
STYLE_LIST.add(UpMenuStyle.STYLE_NAME);
STYLE_LIST.add(DownMenuStyle.STYLE_NAME);
STYLE_LIST.add(SliderStyle.STYLE_NAME);
}
private DefaultListModel listModel;
private JList styleList;
private Map<String, BasicBeanPane<MobileTemplateStyle>> map = new HashMap<>();
private JPanel right;
private CardLayout card;
public MobileTemplateStylePane(WCardTagLayout tagLayout){
init(tagLayout);
}
public void init(WCardTagLayout tagLayout){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
listModel = new DefaultListModel();
card = new CardLayout();
right = FRGUIPaneFactory.createCardLayout_S_Pane();
right.setLayout(card);
for(String style : STYLE_LIST){
listModel.addElement(style);
BasicBeanPane<MobileTemplateStyle> styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style, tagLayout);
map.put(style, styleBasicBeanPane);
right.add(style, styleBasicBeanPane);
}
styleList = new JList(listModel);
styleList.setCellRenderer(render);
JPanel westPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
westPane.add(styleList, BorderLayout.CENTER);
westPane.setPreferredSize(new Dimension(100, 500));
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane.setPreferredSize(new Dimension(500, 500));
attrConfPane.add(right, BorderLayout.CENTER);
centerPane.add(attrConfPane, BorderLayout.CENTER);
styleList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
String selectedValue = (String)styleList.getSelectedValue();
card.show(right, selectedValue);
}
});
this.add(westPane, BorderLayout.WEST);
this.add(centerPane, BorderLayout.CENTER);
}
public static ListCellRenderer render = new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof MobileTemplateStyle) {
MobileTemplateStyle l = (MobileTemplateStyle) value;
this.setText(l.toString());
}
return this;
}
};
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template");
}
public void populate(MobileTemplateStyle templateStyle) {
for(int i = 0; i< listModel.getSize(); i++){
if((listModel.getElementAt(i)).equals(templateStyle.getStyle())){
styleList.setSelectedIndex(i);
map.get(templateStyle.getStyle()).populateBean(templateStyle);
card.show(right, templateStyle.getStyle());
return;
}
}
styleList.setSelectedIndex(0);
}
public MobileTemplateStyle update() {
return map.get(styleList.getSelectedValue()).updateBean();
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java

@ -21,16 +21,17 @@ import javax.swing.ListCellRenderer;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Created by kerry on 2017/11/23.
*/
public class TemplateStylePane extends BasicPane {
public class TemplateStylePane extends AbstractTemplateStylePane<TemplateStyle> {
private DefaultListModel listModel;
private JList styleList;
private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle());
private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle(), new Rectangle(0, 50, 540, 400));
public TemplateStylePane(){
init();

14
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java

@ -1,26 +1,23 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.BaseUtils;
import com.fr.general.cardtag.TemplateStyle;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
/**
* Created by kerry on 2017/12/11.
*/
public class TemplateStylePreviewPane extends JPanel {
private static final int WIDTH = 540;
private static final int HEIGHT = 400;
private static final int OFFSETY = 50;
private Rectangle rectangle;
private TemplateStyle templateStyle;
public TemplateStylePreviewPane(TemplateStyle templateStyle){
public TemplateStylePreviewPane(TemplateStyle templateStyle, Rectangle rectangle){
this.templateStyle = templateStyle;
this.rectangle = rectangle;
}
public void repaint (TemplateStyle templateStyle){
@ -32,7 +29,6 @@ public class TemplateStylePreviewPane extends JPanel {
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g.create();
Image image = BaseUtils.readImage(templateStyle.getPreview());
g2d.drawImage(image, 0, OFFSETY, WIDTH, HEIGHT, null);
templateStyle.paintPreview(g2d, rectangle);
}
}

53
designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java

@ -0,0 +1,53 @@
package com.fr.design.mainframe.widget.preview;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import javax.swing.JPanel;
import java.awt.Color;
public abstract class MobileTemplatePreviewPane extends JPanel {
private Color initialColor;
private Color selectColor;
private TabFontConfig tabFontConfig = new TabFontConfig();
public Color getInitialColor() {
return initialColor;
}
public void setInitialColor(Color initialColor) {
this.initialColor = initialColor;
}
public Color getSelectColor() {
return selectColor;
}
public void setSelectColor(Color selectColor) {
this.selectColor = selectColor;
}
public TabFontConfig getTabFontConfig() {
return tabFontConfig;
}
public void setTabFontConfig(TabFontConfig tabFontConfig) {
this.tabFontConfig = tabFontConfig;
}
public MobileTemplatePreviewPane(){
}
public void populateConfig(MobileTemplateStyle templateStyle){
this.setInitialColor(templateStyle.getInitialColor());
this.setBackground(templateStyle.getInitialColor());
this.setSelectColor(templateStyle.getSelectColor());
this.setTabFontConfig(templateStyle.getTabFontConfig());
}
public void repaint (){
super.repaint();
}
}

2
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java

@ -95,7 +95,7 @@ public class ColorSelectDetailPane extends BasicPane {
public void stateChanged(ChangeEvent e) {
ColorSelectionModel model = (ColorSelectionModel) e.getSource();
colorChooserPreview.setMyColor(model.getSelectedColor());
colorChooserPreview.paint(colorChooserPreview.getGraphics());
colorChooserPreview.repaint();
}
});
previewPanel.add(colorChooserPreview);

12
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -526,6 +526,18 @@ public abstract class GUICoreUtils{
return leftPane;
}
/**
* 创建一个靠左流式布局流式内嵌
*
* @return JPanel对象
*/
public static JPanel createBoxFlowInnerContainerPane(int hgap, int vgap) {
JPanel jp = new JPanel();
jp.setLayout(new FlowLayout(FlowLayout.LEFT, hgap, vgap));
return jp;
}
/**
* 生成一个以流式布局为布局的面板
* @param comps 面板中的组件以及布局的参数后3位参数可选分别表示对齐方式水平间隙垂直间隙

18
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java

@ -2,8 +2,8 @@ package com.fr.design.mainframe.chart.gui.style.axis;
import com.fr.base.BaseFormula;
import com.fr.base.Utils;
import com.fr.chart.base.AxisUnitType;
import com.fr.chart.base.ChartBaseUtils;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.NumberAxis;
@ -78,7 +78,7 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
axisLineStylePane = new ChartAxisLineStylePane();
zeroPane = aliagnZero4Second();
axisReversed = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed"));
unitCombox = new UIComboBox(ChartConstants.UNIT_I18N_VALUES);
unitCombox = new UIComboBox(AxisUnitType.getI18NValues());
formatPane = new FormatPaneWithOutFont();
axisLabelPane = new ChartAxisLabelPane();
dataPane = createDataDefinePane();
@ -257,10 +257,10 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
axisLineStylePane.update(axis);
axis.setAxisReversed(this.axisReversed.isSelected());
String unitValue = Utils.objectToString(unitCombox.getSelectedItem());
if(ComparatorUtils.equals(unitValue, ChartConstants.UNIT_I18N_VALUES[0])) {
if(ComparatorUtils.equals(unitValue, AxisUnitType.UNIT_NONE.toLocaleString())) {
unitValue = null;
}
numberAxis.setShowUnit(ChartConstants.getUnitValueFromKey(unitValue));
numberAxis.setShowUnit(AxisUnitType.parse(unitValue));
if(numberAxis.isSurpportAxisTitle()) {
updateAxisTitle(numberAxis);
}
@ -378,11 +378,13 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
axisLineStylePane.populate(axis);
axisReversed.setSelected(axis.hasAxisReversed());
String unitKey = numberAxis.getShowUnit();
if(StringUtils.isBlank(unitKey)) {
unitKey = ChartConstants.UNIT_I18N_KEYS[0];
String unitKey;
if(numberAxis.getShowUnit() != null) {
unitKey = numberAxis.getShowUnit().getStringType();
}else{
unitKey = AxisUnitType.UNIT_NONE.getStringType();
}
unitCombox.setSelectedItem(ChartConstants.getUnitKey2Value(unitKey));
unitCombox.setSelectedItem(AxisUnitType.parse(unitKey).toLocaleString());
if(numberAxis.isSurpportAxisTitle()) {
populateAxisTitle(axis);

6
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -16,9 +16,11 @@ import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWHorizontalBoxLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.properties.mobile.TabMobilePropertyUI;
import com.fr.design.form.layout.FRFlowLayout;
import com.fr.design.form.layout.FRHorizontalLayout;
import com.fr.design.form.layout.FRVerticalLayout;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
@ -328,6 +330,10 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
return ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION);
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new TabMobilePropertyUI(this)};
}
/**
* data属性改变触发其他操作

30
designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java

@ -0,0 +1,30 @@
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.TabMobileWidgetDefinePane;
public class TabMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public TabMobilePropertyUI(XCreator xCreator){
this.xCreator = xCreator;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new TabMobileWidgetDefinePane(xCreator);
}
@Override
public String tableTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr");
}
}

19
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -28,7 +28,7 @@ import java.util.Set;
* 控件属性表绘制
* Modified by fanglei
*/
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
private static final int PADDING = 10;
private static final int PADDING_M = 12;
@ -108,11 +108,10 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
*/
private void initTables() {
formWidgetCardPane.populate();
eventTable.refresh();
if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.initPropertyGroups(designer);
extraPane.populate(designer);
}
}
if (widgetPropertyTables != null) {
@ -222,7 +221,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")
};
final CardLayout tabbedPane = new CardLayout();
final CardLayout tabbedPane = new CardLayout();
final JPanel center = new JPanel(tabbedPane);
center.add(formWidgetCardPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Properties"));
center.add(eventTable, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"));
@ -232,6 +231,16 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
tabsHeaderIconPane = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
//切换的时候再populate
if (index == 1) {
eventTable.refresh();
} else if (index == 2) {
if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.populate(designer);
}
}
}
tabbedPane.show(center, tabTitles[index]);
}
};
@ -292,7 +301,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) {
formWidgetCardPane.populate();
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED){
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
// 防止多次触发
if (lastAffectedCreator != null && lastAffectedCreator == evt.getAffectedCreator()) {
return;

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -15,6 +15,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleTabPaneBackgroundEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.TemplateStylePane;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WTabDisplayPosition;
@ -51,7 +52,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
this.setLayout(FRGUIPaneFactory.createBorderLayout());
backgroundEditor = new AccessibleTabPaneBackgroundEditor();
templateStyleEditor = new AccessibleTemplateStyleEditor();
templateStyleEditor = new AccessibleTemplateStyleEditor(new TemplateStylePane());
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};

69
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

@ -0,0 +1,69 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private XCreator xCreator;
private AccessibleTemplateStyleEditor templateStyleEditor;
private AttributeChangeListener changeListener;
public TabMobileWidgetDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
}
private void bindListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
}
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"));
templateStyleEditor = new AccessibleTemplateStyleEditor(new MobileTemplateStylePane((WCardTagLayout) xCreator.toData()));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{label, templateStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
this.add(jPanel, BorderLayout.CENTER);
}
@Override
public void populate(FormDesigner designer) {
templateStyleEditor.setValue(((WCardTagLayout)xCreator.toData()).getMobileTemplateStyle());
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
}
@Override
public void update() {
((WCardTagLayout)xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
}
}

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

@ -596,7 +596,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* @return 是则返回true
*/
public boolean isSelectedOneCell() {
return selection.isSelectedOneCell(this);
return (selection == null) ? false : selection.isSelectedOneCell(this);
}
/**

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -427,7 +427,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
}
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preview"))) {
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))) {
cellGUIAttr.setPreviewContent(previewCellContent.isSelected());
}

47
designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java

@ -3,7 +3,10 @@ package com.fr.design.webattr.printsettings;
import com.fr.base.print.NativePrintAttr;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
@ -17,21 +20,20 @@ import java.awt.Component;
* Created by plough on 2018/10/31.
*/
public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane {
private static final int PRINT_PORT_FIELD_COLUMNS = 8;
// 服务器配置面板特有的组件
private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址
private UITextField customUrlFieldWin;
private UITextField customUrlFieldMac;
private UINumberField printPortField; // 打印软件端口号
@Override
JPanel createHeaderPane(Component... comps) {
Component[] newComps = {
getDownloadUrlSettingPane()
};
Component[] allComps = new Component[comps.length + newComps.length];
Component[] allComps = new Component[comps.length + 1];
System.arraycopy(comps, 0, allComps, 0, comps.length);
System.arraycopy(newComps, 0, allComps, comps.length, newComps.length);
allComps[comps.length] = getExtraSettingPane();
JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0));
@ -48,6 +50,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText());
nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText());
}
nativePrintAttr.setPrintPort((int) printPortField.getValue());
}
@Override
@ -55,21 +58,43 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl());
customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac());
customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin());
printPortField.setValue(nativePrintAttr.getPrintPort());
}
private JPanel getDownloadUrlSettingPane() {
// 服务器配置中,特有的设置面板
private JPanel getExtraSettingPane() {
// 软件下载地址
defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"));
JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true);
downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
JPanel downloadTipPane = getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": ");
downloadTipPane.setBorder(BorderFactory.createEmptyBorder(0, 0, -6, 0));
// 打印软件端口号
UILabel printPortTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Native_Print_Port") + ": ");
JPanel printPortFiledPane = getPrintPortFieldPane();
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] rowSize = {p, p};
double[] columnSize = {p, p};
Component[][] components = {
{getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane}
{
downloadTipPane, downloadUrlSettingCheckPane
}, {
printPortTip, printPortFiledPane
}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0);
}
private JPanel getPrintPortFieldPane() {
printPortField = new UIIntNumberField();
printPortField.setMaxValue(NativePrintAttr.MAX_PRINT_PORT_VALUE);
printPortField.setColumns(PRINT_PORT_FIELD_COLUMNS);
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(printPortField);
return panel;
}
private JPanel getCustomUrlSettingPane() {
@ -85,7 +110,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
{new UILabel("macOS: "), customUrlFieldMac}
};
JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
return urlSettingPane;
}
}

3
designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java

@ -4,7 +4,9 @@ import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.ScanCodeMobilePane;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import java.util.HashMap;
@ -18,6 +20,7 @@ public class WidgetMobilePaneFactory {
static {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class);
mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class);
mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
}

50
designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java

@ -0,0 +1,50 @@
package com.fr.design.widget.ui.mobile;
import com.fr.base.mobile.MobileScanCodeAttr;
import com.fr.base.mobile.ScanCodeState;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
public class ScanCodeMobilePane extends WidgetMobilePane {
private UICheckBox appScanCodeCheck;
protected void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(getMobileSettingPane(), BorderLayout.NORTH);
}
private UIExpandablePane getMobileSettingPane() {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true);
appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
panel.add(appScanCodeCheck);
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(panel, BorderLayout.NORTH);
return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panelWrapper);
}
@Override
public void populate(Widget widget) {
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr();
ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState();
appScanCodeCheck.setSelected(scanCodeState.getState());
}
@Override
public void update(Widget widget) {
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr();
mobileScanCodeAttr.setScanCodeState(ScanCodeState.parse(appScanCodeCheck.isSelected()));
}
}

BIN
designer-realize/src/main/resources/com/fr/start/jni/splash.dylib

Binary file not shown.
Loading…
Cancel
Save