Browse Source

Merge branch 'release/9.0' of ssh://cloud.finedevelop.com:7999/~ju/design into release/9.0

ju 7 years ago
parent
commit
f0b4322811
  1. 3
      designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java
  2. 161
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  3. 4
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  4. 48
      designer_base/src/com/fr/design/gui/demo/ComboBoxDemo.java
  5. 17
      designer_base/src/com/fr/design/gui/demo/SwingComponentsDemo.java
  6. 335
      designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  7. 70
      designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java
  8. 1
      designer_base/src/com/fr/design/locale/designer.properties
  9. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  10. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  11. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  12. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  13. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  14. 6
      designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java
  15. 14
      designer_base/src/com/fr/env/RemoteEnv.java
  16. 24
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  17. 12
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  18. 16
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  19. 8
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  20. 11
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  21. 9
      designer_form/src/com/fr/design/mainframe/JForm.java
  22. 36
      designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java
  23. 20
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java
  24. 4
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

3
designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java

@ -17,6 +17,7 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
super(false); super(false);
} }
@Override
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(new WorkBook()); tableNameComboBox = new TableDataComboBox(new WorkBook());
tableNameComboBox.addItemListener(new ItemListener() { tableNameComboBox.addItemListener(new ItemListener() {
@ -39,7 +40,7 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name);
tableNameComboBox.setSelectedItem(wrapper); tableNameComboBox.setSelectedItem(wrapper);
tableNameComboBox.getModel().setSelectedItem(wrapper); tableNameComboBox.getModel().setSelectedItem(wrapper);
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
} }

161
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -37,8 +37,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.Objects;
import java.util.concurrent.Executors;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -50,29 +49,83 @@ import java.util.regex.Pattern;
* @since 8.0 * @since 8.0
*/ */
public class SelectedDataColumnPane extends BasicPane { public class SelectedDataColumnPane extends BasicPane {
/**
* 参数编辑器面板
*/
private UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
/**
* 参数
*/
private Parameter[] ps; private Parameter[] ps;
/**
* 数据集下拉框
*/
TableDataComboBox tableNameComboBox; TableDataComboBox tableNameComboBox;
/**
* 动态参数注入按钮
*/
private UIButton paramButton;
/**
* 数据列下拉框
*/
LazyComboBox columnNameComboBox; LazyComboBox columnNameComboBox;
/**
* 数据集下拉框和数据列下拉框监听器
*/
private ItemListener itemListener; private ItemListener itemListener;
private UIButton paramButton;
/**
* 当前编辑的模板面板用于触发保存操作
*/
private ElementCasePane casePane; private ElementCasePane casePane;
private CellElement cellElement; // 保存当前选中的 CE /**
* 保存当前选中的 CE
*/
private CellElement cellElement;
private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]");
/**
* 数据集下拉框变动后修改数据列下拉框加载状态的监听器
*/
private ItemListener loadInstantListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
columnNameComboBox.setLoaded(false);
}
}
};
public SelectedDataColumnPane() { /**
this(true, false, null); * 创建横向布局附带显示动态参数注入按钮的数据集数据列选择面板
*/
SelectedDataColumnPane() {
this(true, false);
} }
public SelectedDataColumnPane(boolean showParameterButton) { /**
this(showParameterButton, false, null); * 创建横向布局的数据集数据列选择面板
*
* @param showParameterButton 是否显示动态参数注入按钮
*/
SelectedDataColumnPane(boolean showParameterButton) {
this(showParameterButton, false);
} }
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, TemplateCellElement cellElement) { /**
* 创建数据集数据列选择面板
*
* @param showParameterButton 是否显示动态参数注入按钮
* @param verticalLayout 是否是垂直布局
*/
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout) {
if (verticalLayout) { if (verticalLayout) {
initComponentVerticalLayout(cellElement); initComponentVerticalLayout();
} else { } else {
initComponent(showParameterButton); initComponent(showParameterButton);
} }
@ -86,7 +139,7 @@ public class SelectedDataColumnPane extends BasicPane {
public void initComponent(boolean showParameterButton) { public void initComponent(boolean showParameterButton) {
initTableNameComboBox(); initTableNameComboBox();
if (showParameterButton) { if (showParameterButton) {
initWithParameterButton(); initParameterButton();
} }
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@ -126,9 +179,9 @@ public class SelectedDataColumnPane extends BasicPane {
/** /**
* 初始化竖直布局的组件 * 初始化竖直布局的组件
*/ */
private void initComponentVerticalLayout(TemplateCellElement cellElement) { private void initComponentVerticalLayout() {
initTableNameComboBox(); initTableNameComboBox();
initWithParameterButton(cellElement); initVerticalParameterButton();
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@Override @Override
public Object[] load() { public Object[] load() {
@ -156,6 +209,13 @@ public class SelectedDataColumnPane extends BasicPane {
} }
/**
* 更新面板数据
*
* @param source 数据源
* @param cellElement 单元格
* @param casePane 当前编辑的模板面板
*/
public void populate(TableDataSource source, TemplateCellElement cellElement, ElementCasePane casePane) { public void populate(TableDataSource source, TemplateCellElement cellElement, ElementCasePane casePane) {
tableNameComboBox.refresh(source); tableNameComboBox.refresh(source);
this.casePane = casePane; this.casePane = casePane;
@ -163,9 +223,8 @@ public class SelectedDataColumnPane extends BasicPane {
return; return;
} }
this.cellElement = cellElement; this.cellElement = cellElement;
if (itemListener != null) { removeListener();
removeListener(itemListener);
}
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (!(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
@ -176,9 +235,14 @@ public class SelectedDataColumnPane extends BasicPane {
columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn()));
ps = dsColumn.getParameters(); ps = dsColumn.getParameters();
addListener(itemListener); addListener();
} }
/**
* 保存数据到单元格对象中
*
* @param cellElement 单元格
*/
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement == null) { if (cellElement == null) {
return; return;
@ -187,7 +251,7 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) { if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) {
return; return;
} }
DSColumn dsColumn = null; DSColumn dsColumn;
if (value == null || !(value instanceof DSColumn)) { if (value == null || !(value instanceof DSColumn)) {
dsColumn = new DSColumn(); dsColumn = new DSColumn();
cellElement.setValue(dsColumn); cellElement.setValue(dsColumn);
@ -195,7 +259,7 @@ public class SelectedDataColumnPane extends BasicPane {
dsColumn = (DSColumn) cellElement.getValue(); dsColumn = (DSColumn) cellElement.getValue();
SimpleDSColumn simpleDSColumn = updateColumnPane(); SimpleDSColumn simpleDSColumn = updateColumnPane();
dsColumn.setDSName(simpleDSColumn.getDsName()); dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName());
dsColumn.setColumn(simpleDSColumn.getColumn()); dsColumn.setColumn(simpleDSColumn.getColumn());
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
@ -205,6 +269,7 @@ public class SelectedDataColumnPane extends BasicPane {
* 释放模板对象 * 释放模板对象
*/ */
public void release() { public void release() {
this.cellElement = null;
this.casePane = null; this.casePane = null;
this.tableNameComboBox.setModel(new DefaultComboBoxModel()); this.tableNameComboBox.setModel(new DefaultComboBoxModel());
} }
@ -214,7 +279,7 @@ public class SelectedDataColumnPane extends BasicPane {
* *
* @return 更新后的值 * @return 更新后的值
*/ */
public SimpleDSColumn updateColumnPane() { private SimpleDSColumn updateColumnPane() {
SimpleDSColumn dsColumn = new SimpleDSColumn(); SimpleDSColumn dsColumn = new SimpleDSColumn();
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem(); TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem();
if (tableDataWrappe == null) { if (tableDataWrappe == null) {
@ -224,9 +289,8 @@ public class SelectedDataColumnPane extends BasicPane {
TableDataColumn column; TableDataColumn column;
String columnExp = (String) this.columnNameComboBox.getSelectedItem(); String columnExp = (String) this.columnNameComboBox.getSelectedItem();
if (isColumnName(columnExp)) { if (isColumnName(columnExp)) {
String number = columnExp.substring(1); String number = Objects.requireNonNull(columnExp).substring(1);
Pattern pattern = Pattern.compile("[^\\d]"); if (COLUMN_NAME_PATTERN.matcher(number).find()) {
if (pattern.matcher(number).find()) {
column = TableDataColumn.createColumn(columnExp); column = TableDataColumn.createColumn(columnExp);
} else { } else {
int serialNumber = Integer.parseInt(columnExp.substring(1)); int serialNumber = Integer.parseInt(columnExp.substring(1));
@ -239,47 +303,31 @@ public class SelectedDataColumnPane extends BasicPane {
return dsColumn; return dsColumn;
} }
public void setListener(ItemListener i) {
this.itemListener = i;
}
/** /**
* 添加监听事件 * 添加监听事件
*
* @param i 监听事件
*/ */
public void addListener(ItemListener i) { private void addListener() {
itemListener = i; tableNameComboBox.addItemListener(this.itemListener);
tableNameComboBox.addItemListener(i); columnNameComboBox.addItemListener(this.itemListener);
columnNameComboBox.addItemListener(i);
} }
/** /**
* 移除监听事件 * 移除监听事件
*
* @param i 监听事件
*/ */
public void removeListener(ItemListener i) { private void removeListener() {
tableNameComboBox.removeItemListener(i); tableNameComboBox.removeItemListener(this.itemListener);
columnNameComboBox.removeItemListener(i); columnNameComboBox.removeItemListener(this.itemListener);
} }
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
final ExecutorService executorService = Executors.newSingleThreadExecutor();
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
executorService.execute(new Runnable() {
@Override
public void run() {
synchronized (columnNameComboBox) {
columnNameComboBox.loadInstant();
}
}
});
}
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); tableNameComboBox.setPreferredSize(new Dimension(100, 20));
tableNameComboBox.addItemListener(this.loadInstantListener);
} }
@Override @Override
@ -288,8 +336,8 @@ public class SelectedDataColumnPane extends BasicPane {
} }
private void initWithParameterButton() { private void initParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); editorPane = new UITableEditorPane<>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -307,10 +355,11 @@ public class SelectedDataColumnPane extends BasicPane {
}); });
} }
private void initWithParameterButton(final TemplateCellElement cellElement) { private void initVerticalParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); editorPane = new UITableEditorPane<>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection")); paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
@ -337,6 +386,6 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() != null) { if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); return this.tableNameComboBox.getSelectedItem().calculateColumnNameList();
} }
return new ArrayList<String>(); return new ArrayList<>();
} }
} }

4
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -247,9 +247,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
}; };
DSColumnBasicEditorPane() { DSColumnBasicEditorPane() {
dataPane = new SelectedDataColumnPane(true, true, cellElement); dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane(); groupPane = new ResultSetGroupDockingPane();
dataPane.addListener(dataListener); dataPane.setListener(dataListener);
groupPane.setListener(groupListener); groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {P, F}; double[] rowSize = {P}, columnSize = {P, F};

48
designer_base/src/com/fr/design/gui/demo/ComboBoxDemo.java

@ -1,34 +1,37 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.icombobox.filter.Filter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.icombobox.ComboCheckBox; import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.ExtendedComboBox; import com.fr.design.gui.icombobox.ExtendedComboBox;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.gui.icombobox.filter.Filter;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: Richer * User: Richer
@ -42,12 +45,12 @@ public class ComboBoxDemo extends JPanel {
double f = TableLayout.FILL; double f = TableLayout.FILL;
Component[][] coms = new Component[][]{ Component[][] coms = new Component[][]{
{new UILabel(Inter.getLocText("Form-ComboCheckBox")+":"), createComboCheckBox()}, {new UILabel(Inter.getLocText("Form-ComboCheckBox") + ":"), createComboCheckBox()},
{new UILabel(Inter.getLocText(new String[]{"DS-Dictionary", "Form-ComboBox"})+":"), createDictComboBox()}, {new UILabel(Inter.getLocText(new String[]{"DS-Dictionary", "Form-ComboBox"}) + ":"), createDictComboBox()},
{new UILabel(Inter.getLocText("long_data_can_not_show_fully")+":"), createExtendedComboBox()}, {new UILabel(Inter.getLocText("long_data_can_not_show_fully") + ":"), createExtendedComboBox()},
{new UILabel(Inter.getLocText(new String[]{"Filter", "Form-ComboBox"})+":"), createFilterComboBox()}, {new UILabel(Inter.getLocText(new String[]{"Filter", "Form-ComboBox"}) + ":"), createFilterComboBox()},
{new UILabel(Inter.getLocText("Form-ComboBox")+":"), createTreeComboBox()}, {new UILabel(Inter.getLocText("Form-ComboBox") + ":"), createTreeComboBox()},
{new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"})+":"), createLazyComboBox()} {new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"}) + ":"), createLazyComboBox()}
}; };
double[] rowSize = new double[coms.length]; double[] rowSize = new double[coms.length];
double[] columnSize = {p, f}; double[] columnSize = {p, f};
@ -165,6 +168,7 @@ public class ComboBoxDemo extends JPanel {
// 睡5秒 // 睡5秒
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }

17
designer_base/src/com/fr/design/gui/demo/SwingComponentsDemo.java

@ -1,16 +1,15 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -19,10 +18,10 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Time: 下午4:54 * Time: 下午4:54
*/ */
public class SwingComponentsDemo extends JFrame { public class SwingComponentsDemo extends JFrame {
public SwingComponentsDemo() { private SwingComponentsDemo() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
init(); init();
JPanel contentPane = (JPanel)getContentPane(); JPanel contentPane = (JPanel) getContentPane();
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); contentPane.setLayout(FRGUIPaneFactory.createBorderLayout());
JTabbedPane tab = new JTabbedPane(); JTabbedPane tab = new JTabbedPane();
contentPane.add(tab, BorderLayout.CENTER); contentPane.add(tab, BorderLayout.CENTER);
@ -40,12 +39,12 @@ public class SwingComponentsDemo extends JFrame {
public static void main(String[] args) { public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
JFrame f = new SwingComponentsDemo(); JFrame f = new SwingComponentsDemo();
f.setSize(500, 500); f.setSize(500, 500);
f.setVisible(true); f.setVisible(true);
GUICoreUtils.centerWindow(f); GUICoreUtils.centerWindow(f);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
} }
}); });
} }

335
designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java

@ -3,209 +3,190 @@
*/ */
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.Dimension; import com.fr.general.FRLogger;
import java.util.ArrayList; import com.fr.general.Inter;
import java.util.List;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.basic.BasicComboPopup; import java.awt.Dimension;
import java.util.concurrent.ExecutionException;
import com.fr.general.Inter;
/** /**
* @author richer * @author richer
* @version 2018年2月6日14点43分 by @yaoh.wu
* @since 6.5.5 创建于2011-6-15 延迟加载的下拉框 * @since 6.5.5 创建于2011-6-15 延迟加载的下拉框
*/ */
public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener { public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener {
protected boolean loaded = false;
private List<EventListener> ls = new ArrayList<EventListener>(); private static final int NUM = 80;
private Object initialSelected = null; private static final String[] PENDING_CONTENT = new String[]{"", Inter.getLocText("Loading") + "..."};
private static final int NUM=80;
/**
public static final Object PENDING = new Object() { * 是否加载完成
*/
@Override protected boolean loaded = false;
public String toString() {
return Inter.getLocText("Loading") + "..."; /**
} * 初始化选项
}; */
private Object initialSelected = null;
public LazyComboBox() {
super();
this.setEditor(new FilterComboBoxEditor()); protected LazyComboBox() {
addPopupMenuListener(this); super();
// updateUI(); this.setEditor(new FilterComboBoxEditor());
} addPopupMenuListener(this);
}
public void setLoaded(boolean loaded) {
this.loaded = loaded; public void setLoaded(boolean loaded) {
} this.loaded = loaded;
}
public abstract Object[] load();
/**
public void setSelectedItem(Object anObject) { * 加载下拉框中的选项
initialSelected = anObject; *
if (loaded) { * @return 下拉框中的选项
super.setSelectedItem(anObject); */
} else { public abstract Object[] load();
setModel(new DefaultComboBoxModel(new Object[] { anObject })); @Override
super.setSelectedItem(anObject); public void setSelectedItem(Object anObject) {
} initialSelected = anObject;
} if (loaded) {
super.setSelectedItem(anObject);
/** } else {
* 通过调用该方法在点击下拉框按钮之前就加载好数据,不需要出现loading了 this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject}));
*/ super.setSelectedItem(anObject);
public void loadInstant() { }
setLoaded(true); }
loadList();
} @Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (loaded) { if (loaded) {
return; return;
} }
DefaultComboBoxModel loadingModel = new DefaultComboBoxModel(new String[]{"", Inter.getLocText("Loading") + "..."}); DefaultComboBoxModel<String> loadingModel = new DefaultComboBoxModel<>(PENDING_CONTENT);
LazyComboBox.this.setModel(loadingModel); this.setModel(loadingModel);
new SwingWorker<Void, Void>() { new SwingWorker<Object[], Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Object[] doInBackground() {
final Object selectedObj = getSelectedItem(); return load();
loadList();
return null;
} }
@Override @Override
public void done() { public void done() {
LazyComboBox.this.updateUI(); try {
LazyComboBox.this.fireEvent(); LazyComboBox.this.loadList(get());
} catch (InterruptedException | ExecutionException exception) {
FRLogger.getLogger().debug(exception.getMessage());
}
LazyComboBox.this.showPopup(); LazyComboBox.this.showPopup();
} }
}.execute(); }.execute();
}
/**
* 加载下拉列表
*/
public void loadList() {
DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(load());
model.setSelectedItem(initialSelected);
this.setModel(model);
this.selectedItemReminder = initialSelected;
loaded = true;
} }
/** /**
* 计算加载下拉列表 * 加载下拉列表
*/ *
public void loadList() { * @param contents 下拉列表内容
DefaultComboBoxModel model = new DefaultComboBoxModel(load()); */
private void loadList(Object[] contents) {
DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(contents);
model.setSelectedItem(initialSelected); model.setSelectedItem(initialSelected);
LazyComboBox.this.setModel(model); this.setModel(model);
LazyComboBox.this.selectedItemReminder = initialSelected ; this.selectedItemReminder = initialSelected;
loaded = true; loaded = true;
} }
@Override @Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
} }
@Override @Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
} }
public void addClickListener(EventListener l) { @Override
if (ls == null) { public Dimension getPreferredSize() {
ls = new ArrayList<LazyComboBox.EventListener>(); Dimension dim = super.getPreferredSize();
} dim.width = NUM;
ls.add(l); return dim;
} }
public void fireEvent() { class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
for (int i = 0, n = ls.size(); i < n; i++) { private Object item;
ls.get(i).fireEvent(); private volatile boolean filtering = false;
} private volatile boolean setting = false;
}
public FilterComboBoxEditor() {
@Override super();
public Dimension getPreferredSize() { textField.getDocument().addDocumentListener(this);
Dimension dim = super.getPreferredSize(); }
dim.width = NUM;
return dim; @Override
} public void setItem(Object item) {
if (filtering) {
private static class LazyPopMenu extends BasicComboPopup { return;
}
public LazyPopMenu(final JComboBox combo) { this.item = item;
super(combo); this.setting = true;
LazyComboBox comboc = (LazyComboBox) combo; textField.setSetting(true);
comboc.addClickListener(new EventListener() { String newText = (item == null) ? "" : item.toString();
textField.setText(newText);
@Override textField.setSetting(false);
public void fireEvent() { this.setting = false;
LazyPopMenu.this.show(); }
combo.showPopup();
} @Override
}); public Object getItem() {
} return this.item;
} }
private interface EventListener { @Override
void fireEvent(); public void insertUpdate(DocumentEvent e) {
} handleChange();
}
class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private Object item; @Override
private volatile boolean filtering = false; public void removeUpdate(DocumentEvent e) {
private volatile boolean setting = false; handleChange();
}
public FilterComboBoxEditor() {
super(); @Override
textField.getDocument().addDocumentListener(this); public void changedUpdate(DocumentEvent e) {
} handleChange();
}
public void setItem(Object item) {
if (filtering) { void handleChange() {
return; if (setting) {
} return;
this.item = item; }
filtering = true;
this.setting = true; String xx = textField.getText();
textField.setSetting(true); LazyComboBox.this.setSelectedItem(xx);
String newText = (item == null) ? "" : item.toString(); this.item = textField.getText();
textField.setText(newText);
textField.setSetting(false); setPopupVisible(true);
this.setting = false; filtering = false;
} }
}
public Object getItem() {
return this.item;
}
public void insertUpdate(DocumentEvent e) {
handleChange();
}
public void removeUpdate(DocumentEvent e) {
handleChange();
}
public void changedUpdate(DocumentEvent e) {
handleChange();
}
protected void handleChange() {
if (setting) {
return;
}
filtering = true;
String xx = textField.getText();
LazyComboBox.this.setSelectedItem(xx);
this.item = textField.getText();
setPopupVisible(true);
filtering = false;
}
}
} }

70
designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java

@ -4,12 +4,13 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.ListCellRenderer;
import javax.swing.plaf.ComboBoxUI; import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import java.awt.*; import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -112,8 +113,6 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
public void setRenderer(ListCellRenderer aRenderer) { public void setRenderer(ListCellRenderer aRenderer) {
if (aRenderer instanceof UIComboBoxRenderer) { if (aRenderer instanceof UIComboBoxRenderer) {
super.setRenderer(aRenderer); super.setRenderer(aRenderer);
} else {
//throw new IllegalArgumentException("Must be UIComboBoxRenderer");
} }
} }
@ -121,13 +120,15 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
return null; return null;
} }
@Override
public void setGlobalName(String name) { public void setGlobalName(String name) {
comboBoxName = name; comboBoxName = name;
} }
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);//加5的原因在于:render里,每一个项前面了空了一格,要多几像素 //加5的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);
} }
/** /**
@ -144,70 +145,53 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
} }
/** /**
* *
*/ */
@Override
public void updateUI() { public void updateUI() {
setUI(getUIComboBoxUI()); setUI(getUIComboBoxUI());
} }
/** /**
* * @param listener 观察者监听事件
* @param listener 观察者监听事件 */
*/ @Override
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener; uiObserverListener = listener;
} }
public void removeChangeListener(){ public void removeChangeListener() {
uiObserverListener = null; uiObserverListener = null;
} }
public UIObserverListener getUiObserverListener(){ public UIObserverListener getUiObserverListener() {
return uiObserverListener; return uiObserverListener;
} }
/** /**
* @return * @return 是否响应变更事件
*/ */
@Override
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
/** /**
* * @param listener 观察者监听事件
* @param listener 观察者监听事件 */
*/ @Override
public void registerNameListener(GlobalNameListener listener) { public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener; globalNameListener = listener;
} }
/**
*
* @return
*/
public boolean shouldResponseNameListener() {
return true;
}
/** /**
* @param args * @return 是否响应名称事件
*/ */
public static void main(String... args) { @Override
LayoutManager layoutManager = null; public boolean shouldResponseNameListener() {
JFrame jf = new JFrame("test"); return true;
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(layoutManager);
UIComboBox bb = new UIComboBox(new String[]{"", "jerry", "kunsnat", "richer"});
bb.setEditable(true);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
} }

1
designer_base/src/com/fr/design/locale/designer.properties

@ -2167,3 +2167,4 @@ FR-Designer_Tab_Menu_Style=Menu Style
FR-Designer_Tab_Pentagon_Style=Pentagon Style FR-Designer_Tab_Pentagon_Style=Pentagon Style
FR-Designer_Tab_Trapezoid_Style=Trapezoid Style FR-Designer_Tab_Trapezoid_Style=Trapezoid Style
FR-Designer_Tab_Display_Position=Display Position FR-Designer_Tab_Display_Position=Display Position
FR-Designer_Background_Select=Select Background

1
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2166,3 +2166,4 @@ FR-Designer_Tab_Menu_Style=Menu Style
FR-Designer_Tab_Pentagon_Style=Pentagon Style FR-Designer_Tab_Pentagon_Style=Pentagon Style
FR-Designer_Tab_Trapezoid_Style=Trapezoid Style FR-Designer_Tab_Trapezoid_Style=Trapezoid Style
FR-Designer_Tab_Display_Position=Display Position FR-Designer_Tab_Display_Position=Display Position
FR-Designer_Background_Select=Select Background

1
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2167,3 +2167,4 @@ FR-Designer_Tab_Menu_Style=
FR-Designer_Tab_Pentagon_Style= FR-Designer_Tab_Pentagon_Style=
FR-Designer_Tab_Trapezoid_Style= FR-Designer_Tab_Trapezoid_Style=
FR-Designer_Tab_Display_Position= FR-Designer_Tab_Display_Position=
FR-Designer_Background_Select=

1
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2167,3 +2167,4 @@ FR-Designer_Tab_Menu_Style=
FR-Designer_Tab_Pentagon_Style= FR-Designer_Tab_Pentagon_Style=
FR-Designer_Tab_Trapezoid_Style= FR-Designer_Tab_Trapezoid_Style=
FR-Designer_Tab_Display_Position= FR-Designer_Tab_Display_Position=
FR-Designer_Background_Select=

1
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2167,3 +2167,4 @@ FR-Designer_Tab_Menu_Style=\u83DC\u5355\u5F0F
FR-Designer_Tab_Pentagon_Style=\u4E94\u8FB9\u5F62 FR-Designer_Tab_Pentagon_Style=\u4E94\u8FB9\u5F62
FR-Designer_Tab_Trapezoid_Style=\u68AF\u5F62 FR-Designer_Tab_Trapezoid_Style=\u68AF\u5F62
FR-Designer_Tab_Display_Position=\u663E\u793A\u4F4D\u7F6E FR-Designer_Tab_Display_Position=\u663E\u793A\u4F4D\u7F6E
FR-Designer_Background_Select=\u9009\u4E2D\u80CC\u666F

1
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2166,3 +2166,4 @@ FR-Designer_Tab_Menu_Style=\u83DC\u55AE\u5F0F
FR-Designer_Tab_Pentagon_Style=\u4E94\u908A\u5F62 FR-Designer_Tab_Pentagon_Style=\u4E94\u908A\u5F62
FR-Designer_Tab_Trapezoid_Style=\u68AF\u5F62 FR-Designer_Tab_Trapezoid_Style=\u68AF\u5F62
FR-Designer_Tab_Display_Position=\u986F\u793A\u4F4D\u7F6E FR-Designer_Tab_Display_Position=\u986F\u793A\u4F4D\u7F6E
FR-Designer_Background_Select=\u9078\u4E2D\u80CC\u666F

6
designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java

@ -42,7 +42,7 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initalBackgroundEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initalBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundEditor}, new Component[]{getClickLabel(), clickBackgroundEditor},
}; };
panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
@ -61,6 +61,10 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
clickBackgroundEditor = new AccessibleImgBackgroundEditor(); clickBackgroundEditor = new AccessibleImgBackgroundEditor();
} }
protected UILabel getClickLabel(){
return new UILabel(Inter.getLocText("FR-Designer_Background-Click"));
}
protected UILabel createUILable(){ protected UILabel createUILable(){
return new UILabel(Inter.getLocText("FR-Designer_Background")); return new UILabel(Inter.getLocText("FR-Designer_Background"));
} }

14
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -2205,19 +2205,7 @@ public class RemoteEnv extends AbstractEnv {
@Override @Override
public String getSharePath() { public String getSharePath() {
try { return StringUtils.EMPTY;
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_get_share_path");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
HttpClient client = createHttpMethod(para);
InputStream input = execute4InputStream(client);
return stream2String(input);
} catch (Exception e) {
return StringUtils.EMPTY;
}
} }
public void doWhenServerShutDown() { public void doWhenServerShutDown() {

24
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -16,9 +16,13 @@ import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.cardtag.DefaultTemplateStyle;
import javax.swing.*;
import java.awt.*; import javax.swing.Icon;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
public class XCardAddButton extends XButton{ public class XCardAddButton extends XButton{
@ -80,7 +84,8 @@ public class XCardAddButton extends XButton{
* @param e 点击事件 * @param e 点击事件
* *
*/ */
public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ @Override
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
designer.fireTargetModified(); designer.fireTargetModified();
@ -120,7 +125,8 @@ public class XCardAddButton extends XButton{
this.cardLayout = borderLayout.getCardPart(); this.cardLayout = borderLayout.getCardPart();
} }
public void paintComponent(Graphics g) { @Override
public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
drawAddIcon(g2d); drawAddIcon(g2d);
@ -148,8 +154,13 @@ public class XCardAddButton extends XButton{
String cardLayoutName = cardLayout.toData().getWidgetName(); String cardLayoutName = cardLayout.toData().getWidgetName();
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName); CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName);
WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData();
if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){
titleButton.setInitialBackground(layout.getTemplateStyle().getTabDefaultBackground());
titleButton.setCustomStyle(true);
}
//设置标题 //设置标题
titleButton.setText(getTabTitleName()); titleButton.setText(getTabTitleName(layout));
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout); XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout);
titleButton.setShowButton(true); titleButton.setShowButton(true);
showButton.setBackupParent(tagLayout); showButton.setBackupParent(tagLayout);
@ -168,8 +179,7 @@ public class XCardAddButton extends XButton{
} }
//新增时去tabFitLayout名字中最大的Index+1,防止重名 //新增时去tabFitLayout名字中最大的Index+1,防止重名
private String getTabTitleName(){ private String getTabTitleName(WCardTagLayout layout){
WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData();
int size = layout.getWidgetCount(); int size = layout.getWidgetCount();
String prefix = Inter.getLocText("FR-Designer_Title"); String prefix = Inter.getLocText("FR-Designer_Title");
String newTextName = prefix + size; String newTextName = prefix + size;

12
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -324,11 +324,15 @@ public class XCardSwitchButton extends XButton {
private void drawBackground(CardSwitchButton button, WidgetTitle widgetTitle){ private void drawBackground(CardSwitchButton button, WidgetTitle widgetTitle){
Background background = widgetTitle.getBackground(); Background background = widgetTitle.getBackground();
TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle(); TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle();
Background initialBackground = button.getInitialBackground(); //获取当前tab的index
Background defaultSelectBackground = templateStyle.getSelectBackground(); CardSwitchButton currentButton = (CardSwitchButton) this.toData();
//todo 这边先这么改,之后会加一个选中背景设置再做调整 int index = currentButton.getIndex();
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
WTabFitLayout wTabFitLayout = tabFitLayout.getWTabFitLayout();
Background initialBackground = wTabFitLayout.getInitialBackground();
Background selectBackground = wTabFitLayout.getClickBackground();
if (button.isShowButton()) { if (button.isShowButton()) {
this.setContentBackground(defaultSelectBackground); this.setContentBackground(selectBackground == null ? templateStyle.getSelectBackground() : selectBackground);
} else { } else {
this.setContentBackground(initialBackground == null ? background : initialBackground); this.setContentBackground(initialBackground == null ? background : initialBackground);
} }

16
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -31,8 +31,11 @@ import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -493,4 +496,17 @@ public class XWCardLayout extends XLayoutContainer {
initStyle(); initStyle();
} }
public void resetTabBackground(TemplateStyle templateStyle){
for (int i = 0; i < this.getXCreatorCount(); i++) {
XWTabFitLayout xCreator = (XWTabFitLayout)this.getXCreator(i);
WTabFitLayout wTabFitLayout = (WTabFitLayout)xCreator.toData();
boolean defaultStyle = ComparatorUtils.equals(templateStyle.getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE);
wTabFitLayout.setInitialBackground(defaultStyle ? null : templateStyle.getTabDefaultBackground());
wTabFitLayout.setOverBackground(null);
wTabFitLayout.setClickBackground(null);
wTabFitLayout.setCustomStyle(!defaultStyle);
xCreator.checkButonType();
}
}
} }

8
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -30,6 +30,7 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.cardtag.DefaultTemplateStyle;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
@ -132,7 +133,14 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard); WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard);
fitLayout.setTabNameIndex(getTabNameIndex()); fitLayout.setTabNameIndex(getTabNameIndex());
XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension()); XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension());
WCardTagLayout layout = (WCardTagLayout) this.toData();
if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){
fitLayout.setInitialBackground(layout.getTemplateStyle().getTabDefaultBackground());
fitLayout.setCustomStyle(true);
}
tabFitLayout.setxCardSwitchButton((XCardSwitchButton)this.getComponent(0)); tabFitLayout.setxCardSwitchButton((XCardSwitchButton)this.getComponent(0));
tabFitLayout.checkButonType();
tabFitLayout.setBackupParent(cardLayout); tabFitLayout.setBackupParent(cardLayout);
cardLayout.add(tabFitLayout, widgetName); cardLayout.add(tabFitLayout, widgetName);
this.cardLayout.toData().setShowIndex(index); this.cardLayout.toData().setShowIndex(index);

11
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -102,6 +102,10 @@ public class XWTabFitLayout extends XWFitLayout {
super(widget, initSize); super(widget, initSize);
} }
public WTabFitLayout getWTabFitLayout(){
return (WTabFitLayout)data;
}
@Override @Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单 return UIPopupMenu.EMPTY; // 不要菜单
@ -210,8 +214,12 @@ public class XWTabFitLayout extends XWFitLayout {
return crPropertyDescriptors; return crPropertyDescriptors;
} }
private void checkButonType() { public void checkButonType() {
WTabFitLayout wTabFitLayout = ((WTabFitLayout) data); WTabFitLayout wTabFitLayout = ((WTabFitLayout) data);
XCardSwitchButton xCardSwitchButton = this.getxCardSwitchButton();
if(xCardSwitchButton == null){
initRelateSwitchButton();
}
CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData(); CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData();
boolean isStyle = wTabFitLayout.isCustomStyle(); boolean isStyle = wTabFitLayout.isCustomStyle();
Background initialBackground = wTabFitLayout.getInitialBackground(); Background initialBackground = wTabFitLayout.getInitialBackground();
@ -586,6 +594,7 @@ public class XWTabFitLayout extends XWFitLayout {
@Override @Override
public void firePropertyChange(){ public void firePropertyChange(){
checkButonType();
//根据字体长度设置tab宽度 //根据字体长度设置tab宽度
setCardSwitchBtnSize(); setCardSwitchBtnSize();
XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent(); XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent();

9
designer_form/src/com/fr/design/mainframe/JForm.java

@ -544,9 +544,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
protected void applyUndoState(FormUndoState u) { protected void applyUndoState(FormUndoState u) {
try { try {
//JForm的target重置
this.setTarget((Form) u.getForm().clone());
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
//JForm的target重置
this.setTarget((Form) u.getForm().clone());
JForm.this.refreshRoot(); JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
//撤销的时候要重新选择的body布局 //撤销的时候要重新选择的body布局
@ -554,9 +554,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea(); refreshToolArea();
} else { } else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target.
Form undoForm = (Form) u.getForm().clone();
String widgetName = this.formDesign.getElementCaseContainerName(); String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样 //这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = getTarget().getElementCaseByName(widgetName); FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
this.reportComposite.setSelectedWidget(dataTable); this.reportComposite.setSelectedWidget(dataTable);
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable); formDesign.setElementCase(dataTable);

36
designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java

@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer.component;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.widget.accessibles.AccessibleTabBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTabBackgroundEditor;
import com.fr.design.widget.component.BackgroundCompPane; import com.fr.design.widget.component.BackgroundCompPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -24,33 +23,40 @@ public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout
clickBackgroundEditor = new AccessibleTabBackgroundEditor(); clickBackgroundEditor = new AccessibleTabBackgroundEditor();
} }
public void update(CardSwitchButton cardSwitchButton){ @Override
protected UILabel getClickLabel(){
return new UILabel(Inter.getLocText("FR-Designer_Background_Select"));
}
@Override
public void update(WTabFitLayout tabFitLayout){
int selectIndex = backgroundHead.getSelectedIndex(); int selectIndex = backgroundHead.getSelectedIndex();
if(selectIndex == 0){ if(selectIndex == 0){
cardSwitchButton.setCustomStyle(false); tabFitLayout.setCustomStyle(false);
cardSwitchButton.setInitialBackground(null); tabFitLayout.setInitialBackground(null);
cardSwitchButton.setOverBackground(null); tabFitLayout.setOverBackground(null);
cardSwitchButton.setClickBackground(null); tabFitLayout.setClickBackground(null);
}else{ }else{
cardSwitchButton.setCustomStyle(true); tabFitLayout.setCustomStyle(true);
cardSwitchButton.setInitialBackground((Background) initalBackgroundEditor.getValue()); tabFitLayout.setInitialBackground((Background) initalBackgroundEditor.getValue());
cardSwitchButton.setOverBackground((Background) overBackgroundEditor.getValue()); tabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue());
cardSwitchButton.setClickBackground((Background)clickBackgroundEditor.getValue()); tabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue());
} }
switchCard(); switchCard();
} }
public void populate(CardSwitchButton cardSwitchButton){ @Override
if(!cardSwitchButton.isCustomStyle()){ public void populate(WTabFitLayout tabFitLayout){
if(!tabFitLayout.isCustomStyle()){
backgroundHead.setSelectedIndex(0); backgroundHead.setSelectedIndex(0);
initalBackgroundEditor.setValue(null); initalBackgroundEditor.setValue(null);
overBackgroundEditor.setValue(null); overBackgroundEditor.setValue(null);
clickBackgroundEditor.setValue(null); clickBackgroundEditor.setValue(null);
}else{ }else{
backgroundHead.setSelectedIndex(1); backgroundHead.setSelectedIndex(1);
initalBackgroundEditor.setValue(cardSwitchButton.getInitialBackground()); initalBackgroundEditor.setValue(tabFitLayout.getInitialBackground());
overBackgroundEditor.setValue(cardSwitchButton.getOverBackground()); overBackgroundEditor.setValue(tabFitLayout.getOverBackground());
clickBackgroundEditor.setValue(cardSwitchButton.getClickBackground()); clickBackgroundEditor.setValue(tabFitLayout.getClickBackground());
} }
switchCard(); switchCard();
} }

20
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -1,10 +1,9 @@
package com.fr.design.widget.ui.designer.layout; package com.fr.design.widget.ui.designer.layout;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.mainframe.widget.accessibles.AccessibleTabPaneBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTabPaneBackgroundEditor;
import com.fr.form.ui.CardSwitchButton;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.general.cardtag.TemplateStyle; import com.fr.general.cardtag.TemplateStyle;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
@ -123,7 +122,8 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
public WCardTagLayout updateBean() { public WCardTagLayout updateBean() {
//标题背景和字体属性设置在WCardLayout上做兼容 //标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout(); XLayoutContainer topLayout = creator.getTopLayout();
LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle(); XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart();
LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle();
FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont();
layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont)); layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont));
WCardTagLayout layout = (WCardTagLayout) creator.toData(); WCardTagLayout layout = (WCardTagLayout) creator.toData();
@ -140,7 +140,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
backgroundEditor.setValue(templateStyle.getDefaultBackground()); backgroundEditor.setValue(templateStyle.getDefaultBackground());
layoutBorderStyle.getTitle().setBackground(templateStyle.getDefaultBackground()); layoutBorderStyle.getTitle().setBackground(templateStyle.getDefaultBackground());
//重置内部tab的默认背景 //重置内部tab的默认背景
resetTabBackground(layout, templateStyle); xCardLayout.resetTabBackground(templateStyle);
layout.setTemplateStyle(templateStyle); layout.setTemplateStyle(templateStyle);
} else { } else {
layoutBorderStyle.getTitle().setBackground((Background) backgroundEditor.getValue()); layoutBorderStyle.getTitle().setBackground((Background) backgroundEditor.getValue());
@ -148,16 +148,4 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
return layout; return layout;
} }
private void resetTabBackground(WCardTagLayout layout, TemplateStyle templateStyle) {
for (int i = 0, len = layout.getWidgetCount(); i < len; i++) {
CardSwitchButton button = layout.getSwitchButton(i);
//兼容默认样式
boolean defaultStyle = ComparatorUtils.equals(templateStyle.getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE);
button.setInitialBackground(defaultStyle ? null : templateStyle.getTabDefaultBackground());
button.setOverBackground(null);
button.setClickBackground(null);
button.setCustomStyle(true);
}
}
} }

4
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -83,7 +83,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
if(ob.getCurrentCard() == null){ if(ob.getCurrentCard() == null){
ob.setCurrentCard(getRelateSwitchButton(ob)); ob.setCurrentCard(getRelateSwitchButton(ob));
} }
borderStyle.populate(ob.getCurrentCard()); borderStyle.populate(ob);
titleField.setText(ob.getCurrentCard().getText()); titleField.setText(ob.getCurrentCard().getText());
} }
@ -118,7 +118,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
@Override @Override
public WTabFitLayout updateBean() { public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData(); WTabFitLayout layout = (WTabFitLayout) creator.toData();
borderStyle.update(layout.getCurrentCard()); borderStyle.update(layout);
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Layout-Padding"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Layout-Padding"))) {
paddingBoundPane.update(layout); paddingBoundPane.update(layout);
} }

Loading…
Cancel
Save