Browse Source

Merge remote-tracking branch 'remotes/origin/release/9.0'

paul 7 years ago
parent
commit
cff86213b7
  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. 11
      designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java
  5. 5
      designer_base/src/com/fr/design/data/datapane/ChoosePane.java
  6. 2
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  7. 6
      designer_base/src/com/fr/design/file/MutilTempalteTabPane.java
  8. 48
      designer_base/src/com/fr/design/gui/demo/ComboBoxDemo.java
  9. 17
      designer_base/src/com/fr/design/gui/demo/SwingComponentsDemo.java
  10. 13
      designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java
  11. 137
      designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  12. 48
      designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java
  13. 1
      designer_base/src/com/fr/design/locale/designer.properties
  14. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  15. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  16. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  17. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  18. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  19. 65
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  20. 7
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java
  21. 37
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTabBackgroundEditor.java
  22. 40
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTabPaneBackgroundEditor.java
  23. 95
      designer_base/src/com/fr/design/style/background/BackgroundCardSwitchButtonPane.java
  24. 3
      designer_base/src/com/fr/design/utils/DesignUtils.java
  25. 16
      designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java
  26. 12
      designer_base/src/com/fr/env/RemoteEnv.java
  27. 25
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  28. 184
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  29. 18
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  30. 8
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  31. 64
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  32. 8
      designer_form/src/com/fr/design/mainframe/ComponentTree.java
  33. 7
      designer_form/src/com/fr/design/mainframe/JForm.java
  34. 43
      designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java
  35. 6
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java
  36. 28
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java
  37. 2
      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;
public SelectedDataColumnPane() { private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]");
this(true, false, null);
/**
* 数据集下拉框变动后修改数据列下拉框加载状态的监听器
*/
private ItemListener loadInstantListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
columnNameComboBox.setLoaded(false);
}
}
};
/**
* 创建横向布局附带显示动态参数注入按钮的数据集数据列选择面板
*/
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};

11
designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java

@ -36,6 +36,9 @@ import java.util.logging.Level;
public class SwitchExistEnv extends MenuDef { public class SwitchExistEnv extends MenuDef {
// 标志开始切换环境
private static boolean isSwitching = false;
public SwitchExistEnv() { public SwitchExistEnv() {
this.setMenuKeySet(KeySetUtils.SWITCH_ENV); this.setMenuKeySet(KeySetUtils.SWITCH_ENV);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
@ -101,6 +104,7 @@ public class SwitchExistEnv extends MenuDef {
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
isSwitching = true;
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
Env selectedEnv = envManager.getEnv(this.getName()); Env selectedEnv = envManager.getEnv(this.getName());
try { try {
@ -117,13 +121,18 @@ public class SwitchExistEnv extends MenuDef {
return; return;
} }
SignIn.signIn(selectedEnv); SignIn.signIn(selectedEnv);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged(); fireDSChanged();
} catch (Exception em) { } catch (Exception em) {
FRContext.getLogger().error(em.getMessage(), em); FRContext.getLogger().error(em.getMessage(), em);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
TemplatePane.getInstance().editItems(); TemplatePane.getInstance().editItems();
} finally {
isSwitching = false;
}
} }
} }
public static boolean isSwitching() {
return isSwitching;
} }
} }

5
designer_base/src/com/fr/design/data/datapane/ChoosePane.java

@ -466,10 +466,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
protected String getTableName() { protected String getTableName() {
String tableName = ""; String tableName = "";
Object obj = this.tableNameComboBox.getSelectedItem(); Object obj = this.tableNameComboBox.getSelectedItemObject();
if (obj == null) {
obj = this.tableNameComboBox.getSelectedItem();
if (obj == null) { if (obj == null) {
obj = this.tableNameComboBox.getEditor().getItem(); obj = this.tableNameComboBox.getEditor().getItem();
} }
}
if (obj instanceof TreePath) { if (obj instanceof TreePath) {
Object tp = ((ExpandMutableTreeNode) ((TreePath) obj).getLastPathComponent()).getUserObject(); Object tp = ((ExpandMutableTreeNode) ((TreePath) obj).getLastPathComponent()).getUserObject();
if (tp instanceof TableProcedure) { if (tp instanceof TableProcedure) {

2
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -23,7 +23,7 @@ public class GetPluginFromStoreExecutor implements Executor {
private String scope; private String scope;
public GetPluginFromStoreExecutor(JSONObject info) { public GetPluginFromStoreExecutor(JSONObject info) {
this.category = info.optString("category"); this.category = info.optString("categories");
this.fee = info.optString("fee"); this.fee = info.optString("fee");
this.seller = info.optString("seller"); this.seller = info.optString("seller");
this.scope = info.optString("scope"); this.scope = info.optString("scope");

6
designer_base/src/com/fr/design/file/MutilTempalteTabPane.java

@ -370,7 +370,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
templateStartX += realWidth; templateStartX += realWidth;
} }
if (!DesignerMode.isVcsMode()) {
paintListDown(g2d, maxWidth); paintListDown(g2d, maxWidth);
}
paintUnderLine(templateStartX, maxWidth, g2d); paintUnderLine(templateStartX, maxWidth, g2d);
} }
@ -549,7 +551,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2);
int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP;
int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2;
if (!DesignerMode.isVcsMode()) {
closeIcon.paintIcon(this, g2d, closePosition, closeY); closeIcon.paintIcon(this, g2d, closePosition, closeY);
}
return closePosition; return closePosition;
} }
@ -605,7 +609,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2);
int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2;
int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP;
if (!DesignerMode.isVcsMode()) {
closeIcon.paintIcon(this, g2d, closePosition, closeY); closeIcon.paintIcon(this, g2d, closePosition, closeY);
}
return closePosition; return closePosition;
} }

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);
} }
}); });
} }

13
designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -57,6 +57,7 @@ public class FRTreeComboBox extends UIComboBox {
// richer:下拉展示用的tree // richer:下拉展示用的tree
protected JTree tree; protected JTree tree;
private boolean onlyLeafSelectable = true; private boolean onlyLeafSelectable = true;
private Object selectedObject = null;
public FRTreeComboBox() { public FRTreeComboBox() {
this(new JTree()); this(new JTree());
@ -162,6 +163,7 @@ public class FRTreeComboBox extends UIComboBox {
} }
public void setSelectedItem(Object o) { public void setSelectedItem(Object o) {
selectedObject = o;
if (o instanceof String) { if (o instanceof String) {
this.setSelectedItemString((String) o); this.setSelectedItemString((String) o);
return; return;
@ -174,6 +176,10 @@ public class FRTreeComboBox extends UIComboBox {
} }
} }
public Object getSelectedItemObject() {
return selectedObject;
}
private boolean validTreePath(String treePath){ private boolean validTreePath(String treePath){
return StringUtils.isNotEmpty(treePath) && treePath.charAt(0) == '[' && treePath.endsWith("]"); return StringUtils.isNotEmpty(treePath) && treePath.charAt(0) == '[' && treePath.endsWith("]");
} }
@ -183,12 +189,7 @@ public class FRTreeComboBox extends UIComboBox {
if (validTreePath(temp)) { if (validTreePath(temp)) {
temp = temp.substring(2, temp.length() - 1); temp = temp.substring(2, temp.length() - 1);
String[] selectedtable = temp.split(","); String[] selectedtable = temp.split(",");
String table = selectedtable[selectedtable.length - 1].trim(); return selectedtable[selectedtable.length - 1].trim();
if (table.contains(".")) {
String[] temp2 = table.split("\\.");
table = temp2[temp2.length - 1].trim();
}
return table;
} }
return ""; return "";
} }

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

@ -3,105 +3,115 @@
*/ */
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 {
private static final int NUM = 80;
private static final String[] PENDING_CONTENT = new String[]{"", Inter.getLocText("Loading") + "..."};
/**
* 是否加载完成
*/
protected boolean loaded = false; protected boolean loaded = false;
private List<EventListener> ls = new ArrayList<EventListener>();
/**
* 初始化选项
*/
private Object initialSelected = null; private Object initialSelected = null;
private static final int NUM=80;
public static final Object PENDING = new Object() {
@Override protected LazyComboBox() {
public String toString() {
return Inter.getLocText("Loading") + "...";
}
};
public LazyComboBox() {
super(); super();
this.setEditor(new FilterComboBoxEditor()); this.setEditor(new FilterComboBoxEditor());
addPopupMenuListener(this); addPopupMenuListener(this);
// updateUI();
} }
public void setLoaded(boolean loaded) { public void setLoaded(boolean loaded) {
this.loaded = loaded; this.loaded = loaded;
} }
/**
* 加载下拉框中的选项
*
* @return 下拉框中的选项
*/
public abstract Object[] load(); public abstract Object[] load();
@Override
public void setSelectedItem(Object anObject) { public void setSelectedItem(Object anObject) {
initialSelected = anObject; initialSelected = anObject;
if (loaded) { if (loaded) {
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} else { } else {
this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject}));
setModel(new DefaultComboBoxModel(new Object[] { anObject }));
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} }
} }
/**
* 通过调用该方法在点击下拉框按钮之前就加载好数据,不需要出现loading了
*/
public void loadInstant() {
setLoaded(true);
loadList();
}
@Override @Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 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;
} }
/** /**
* 计算加载下拉列表 * 加载下拉列表
*
* @param contents 下拉列表内容
*/ */
public void loadList() { private void loadList(Object[] contents) {
DefaultComboBoxModel model = new DefaultComboBoxModel(load()); 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;
} }
@ -115,19 +125,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
} }
public void addClickListener(EventListener l) {
if (ls == null) {
ls = new ArrayList<LazyComboBox.EventListener>();
}
ls.add(l);
}
public void fireEvent() {
for (int i = 0, n = ls.size(); i < n; i++) {
ls.get(i).fireEvent();
}
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -135,26 +132,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
return dim; return dim;
} }
private static class LazyPopMenu extends BasicComboPopup {
public LazyPopMenu(final JComboBox combo) {
super(combo);
LazyComboBox comboc = (LazyComboBox) combo;
comboc.addClickListener(new EventListener() {
@Override
public void fireEvent() {
LazyPopMenu.this.show();
combo.showPopup();
}
});
}
}
private interface EventListener {
void fireEvent();
}
class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener { class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private Object item; private Object item;
private volatile boolean filtering = false; private volatile boolean filtering = false;
@ -165,12 +142,12 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
textField.getDocument().addDocumentListener(this); textField.getDocument().addDocumentListener(this);
} }
@Override
public void setItem(Object item) { public void setItem(Object item) {
if (filtering) { if (filtering) {
return; return;
} }
this.item = item; this.item = item;
this.setting = true; this.setting = true;
textField.setSetting(true); textField.setSetting(true);
String newText = (item == null) ? "" : item.toString(); String newText = (item == null) ? "" : item.toString();
@ -179,23 +156,27 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
this.setting = false; this.setting = false;
} }
@Override
public Object getItem() { public Object getItem() {
return this.item; return this.item;
} }
@Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
protected void handleChange() { void handleChange() {
if (setting) { if (setting) {
return; return;
} }

48
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);
} }
/** /**
@ -147,68 +148,51 @@ 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 是否响应名称事件
* @return
*/ */
@Override
public boolean shouldResponseNameListener() { public boolean shouldResponseNameListener() {
return true; return true;
} }
/**
* @param args
*/
public static void main(String... args) {
LayoutManager layoutManager = null;
JFrame jf = new JFrame("test");
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

65
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -11,13 +11,18 @@ import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.*; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -53,27 +58,25 @@ import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.*; import java.awt.dnd.DnDConstants;
import java.awt.event.*; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -95,7 +98,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>(); private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>();
private ToolBarMenuDock ad; //顶部日志+登陆按钮
private static final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
private static ToolBarMenuDock ad;
private DesktopCardPane centerTemplateCardPane; private DesktopCardPane centerTemplateCardPane;
@ -313,41 +319,39 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
protected void initMenuPane() { protected void initMenuPane() {
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); menuPane.add(initNorthEastPane(), BorderLayout.EAST);
basePane.add(menuPane, BorderLayout.NORTH); basePane.add(menuPane, BorderLayout.NORTH);
this.resetToolkitByPlus(null); this.resetToolkitByPlus(null);
} }
/** /**
* @param ad
* @return * @return
*/ */
protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { protected JPanel initNorthEastPane() {
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
//优先级为-1,保证最后全面刷新一次 //优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane();
DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv()); DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv());
} }
}, new PluginFilter() { }, new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return !SwitchExistEnv.isSwitching()
return context.contain(PluginModule.ExtraDesign); && context.contain(PluginModule.ExtraDesign);
} }
}); });
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane();
return northEastPane; return northEastPane;
} }
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { public static void refreshNorthEastPane() {
northEastPane.removeAll(); northEastPane.removeAll();
northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
northEastPane.add(LogMessageBar.getInstance()); northEastPane.add(LogMessageBar.getInstance());
@ -711,7 +715,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param env 环境 * @param env 环境
*/ */
public void refreshEnv(Env env) { public void refreshEnv(Env env) {
this.setTitle(); this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView(); DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

7
designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java

@ -18,7 +18,7 @@ public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
@Override @Override
protected void showEditorPane() { protected void showEditorPane() {
choosePane = new BackgroundButtonPane(); choosePane = initBackgroundPane();
choosePane.setPreferredSize(new Dimension(600, 400)); choosePane.setPreferredSize(new Dimension(600, 400));
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this)); BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() { dlg.addDialogActionListener(new DialogActionAdapter() {
@ -32,4 +32,9 @@ public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground()); choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground());
dlg.setVisible(true); dlg.setVisible(true);
} }
protected BackgroundButtonPane initBackgroundPane(){
return new BackgroundButtonPane();
}
} }

37
designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTabBackgroundEditor.java

@ -1,40 +1,17 @@
package com.fr.design.mainframe.widget.accessibles; package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.background.ColorBackground; import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.style.background.BackgroundCardSwitchButtonPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;
import com.fr.design.style.background.BackgroundTabPane;
import com.fr.general.Background;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
/** /**
* @author kerry * @author kerry
* @date 2018/1/17 * @date 2018/1/29
*/ */
public class AccessibleTabBackgroundEditor extends UneditableAccessibleEditor { public class AccessibleTabBackgroundEditor extends AccessibleImgBackgroundEditor {
private BackgroundTabPane choosePane;
public AccessibleTabBackgroundEditor() { public AccessibleTabBackgroundEditor() {
super(new BackgroundWrapper()); super();
} }
@Override @Override
protected void showEditorPane() { protected BackgroundButtonPane initBackgroundPane(){
choosePane = new BackgroundTabPane(); return new BackgroundCardSwitchButtonPane();
choosePane.setPreferredSize(new Dimension(600, 400));
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
setValue(choosePane.update());
fireStateChanged();
}
});
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground());
dlg.setVisible(true);
} }
} }

40
designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTabPaneBackgroundEditor.java

@ -0,0 +1,40 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.background.ColorBackground;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;
import com.fr.design.style.background.BackgroundTabPane;
import com.fr.general.Background;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
/**
* @author kerry
* @date 2018/1/17
*/
public class AccessibleTabPaneBackgroundEditor extends UneditableAccessibleEditor {
private BackgroundTabPane choosePane;
public AccessibleTabPaneBackgroundEditor() {
super(new BackgroundWrapper());
}
@Override
protected void showEditorPane() {
choosePane = new BackgroundTabPane();
choosePane.setPreferredSize(new Dimension(600, 400));
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
setValue(choosePane.update());
fireStateChanged();
}
});
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground());
dlg.setVisible(true);
}
}

95
designer_base/src/com/fr/design/style/background/BackgroundCardSwitchButtonPane.java

@ -0,0 +1,95 @@
package com.fr.design.style.background;
import com.fr.base.background.ColorBackground;
import com.fr.base.background.GradientBackground;
import com.fr.base.background.ImageBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.design.style.background.impl.ColorBackgroundPane;
import com.fr.design.style.background.impl.ImageBackgroundPane;
import com.fr.design.style.background.impl.NullBackgroundPane;
import com.fr.general.Background;
import com.fr.general.Inter;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author kerry
* @date 2018/1/29
*/
public class BackgroundCardSwitchButtonPane extends BackgroundButtonPane {
private static Map<Class<? extends Background>, BackgroundUIWrapper> cardSwitchButton = new LinkedHashMap<>();
static {
registerCardSwitchBtnBackground(cardSwitchButton);
}
private static void registerCardSwitchBtnBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ColorBackground.class, BackgroundUIWrapper.create()
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color")));
map.put(ImageBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image")));
map.put(GradientBackground.class, BackgroundUIWrapper.create()
.setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Gradient_Color")));
}
public BackgroundCardSwitchButtonPane() {
super();
}
@Override
protected void initTabPane() {
int index = 0;
for (Class<? extends Background> key : cardSwitchButton.keySet()) {
BackgroundUIWrapper wrapper = cardSwitchButton.get(key);
wrapper.setIndex(index++);
tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
}
}
@Override
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return cardSwitchButton.get(background == null ? null : background.getClass());
}
@Override
protected BackgroundDetailPane getTabItemPane(Background background, int index) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {
BackgroundUIWrapper uiWrapper = getBackgroundUIWrapper(background);
quickPane = BackgroundFactory.createByWrapper(uiWrapper);
quickPane.addChangeListener(backgroundChangeListener);
cacheMap.put(index, quickPane);
}
tabbedPane.setComponentAt(index, quickPane);
tabbedPane.setSelectedIndex(index);
return quickPane;
}
@Override
protected BackgroundDetailPane getTabItemPaneByIndex(int index) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {
quickPane = createDetailPaneByIndex(index);
tabbedPane.setComponentAt(index, quickPane);
cacheMap.put(index, quickPane);
quickPane.addChangeListener(backgroundChangeListener);
}
return quickPane;
}
public BackgroundDetailPane createDetailPaneByIndex(int index) {
for (BackgroundUIWrapper wrapper : cardSwitchButton.values()) {
if (wrapper.getIndex() == index) {
return BackgroundFactory.createByWrapper(wrapper);
}
}
return new NullBackgroundPane();
}
}

3
designer_base/src/com/fr/design/utils/DesignUtils.java

@ -9,6 +9,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.*; import com.fr.general.*;
@ -181,7 +182,7 @@ public class DesignUtils {
// 更新CurrentEnv于FRContext & DesignerEnvManager // 更新CurrentEnv于FRContext & DesignerEnvManager
FRContext.setCurrentEnv(env); FRContext.setCurrentEnv(env);
DesignerFrame.refreshNorthEastPane();
refreshDesignerFrame(env); refreshDesignerFrame(env);
// 当换了运行环境,重置服务器,让它下次预览时重启 // 当换了运行环境,重置服务器,让它下次预览时重启
if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) { if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) {

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

@ -31,9 +31,7 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel headLabel = createUILable(); UILabel headLabel = createUILable();
initalBackgroundEditor = new AccessibleImgBackgroundEditor(); initBackgroundEditor();
overBackgroundEditor = new AccessibleImgBackgroundEditor();
clickBackgroundEditor = new AccessibleImgBackgroundEditor();
String [] titles = new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_Custom")}; String [] titles = new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_Custom")};
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -44,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));
@ -57,6 +55,16 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
} }
protected void initBackgroundEditor(){
initalBackgroundEditor = new AccessibleImgBackgroundEditor();
overBackgroundEditor = 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"));
} }

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

@ -2205,20 +2205,8 @@ public class RemoteEnv extends AbstractEnv {
@Override @Override
public String getSharePath() { public String getSharePath() {
try {
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; return StringUtils.EMPTY;
} }
}
public void doWhenServerShutDown() { public void doWhenServerShutDown() {

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

@ -1,7 +1,6 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
@ -17,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{
@ -81,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();
@ -121,6 +125,7 @@ public class XCardAddButton extends XButton{
this.cardLayout = borderLayout.getCardPart(); this.cardLayout = borderLayout.getCardPart();
} }
@Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -149,11 +154,14 @@ 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));
titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout); XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout);
titleButton.setCustomStyle(true);
titleButton.setShowButton(true); titleButton.setShowButton(true);
showButton.setBackupParent(tagLayout); showButton.setBackupParent(tagLayout);
this.tagLayout.setCurrentCard(titleButton); this.tagLayout.setCurrentCard(titleButton);
@ -171,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;

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

@ -5,7 +5,6 @@ package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
@ -34,9 +33,19 @@ import com.fr.general.Inter;
import com.fr.general.cardtag.TemplateStyle; import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.unit.PT; import com.fr.stable.unit.PT;
import javax.swing.*; import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicLabelUI; import javax.swing.plaf.basic.BasicLabelUI;
import java.awt.*; import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList; import java.util.ArrayList;
@ -62,11 +71,8 @@ public class XCardSwitchButton extends XButton {
private static final int MIN_SIZE = 1; private static final int MIN_SIZE = 1;
// 删除按钮识别区域偏移量 // 删除按钮识别区域偏移量
private static final int RIGHT_OFFSET = 15; private static final int CLOSE_ICON_RIGHT_OFFSET = 15;
private static final int TOP_OFFSET = 15; private static final int CLOSE_ICON_TOP_OFFSET = 15;
//这边先不计算button的高度,涉及到layout那边的整体高度,先用之前的固定高度
private static final int DEFAULT_BUTTON_HEIGHT = 36;
// tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量 // tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量
private static final int FONT_SIZE_ADJUST = 2; private static final int FONT_SIZE_ADJUST = 2;
@ -74,13 +80,12 @@ public class XCardSwitchButton extends XButton {
//文字竖排时用来计算文字大小 //文字竖排时用来计算文字大小
private static final int RESLUTION = 120; private static final int RESLUTION = 120;
private static final int DOTSLINESPACE = 6;
private XWCardLayout cardLayout; private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout; private XWCardTagLayout tagLayout;
private Background selectBackground; private Background selectBackground;
private boolean isCustomStyle;
private UILabel label; private UILabel label;
private Icon closeIcon = MOUSE_CLOSE; private Icon closeIcon = MOUSE_CLOSE;
@ -101,14 +106,6 @@ public class XCardSwitchButton extends XButton {
this.cardLayout = cardLayout; this.cardLayout = cardLayout;
} }
public boolean isCustomStyle() {
return isCustomStyle;
}
public void setCustomStyle(boolean customStyle) {
isCustomStyle = customStyle;
}
public Background getSelectBackground() { public Background getSelectBackground() {
return selectBackground; return selectBackground;
} }
@ -157,8 +154,7 @@ public class XCardSwitchButton extends XButton {
} }
//获取当前tab的index //获取当前tab的index
XCardSwitchButton button = this; CardSwitchButton currentButton = (CardSwitchButton) this.toData();
CardSwitchButton currentButton = (CardSwitchButton) button.toData();
int index = currentButton.getIndex(); int index = currentButton.getIndex();
int maxIndex = cardLayout.getComponentCount() - 1; int maxIndex = cardLayout.getComponentCount() - 1;
@ -169,8 +165,7 @@ public class XCardSwitchButton extends XButton {
deleteTabLayout(selectionModel, designer); deleteTabLayout(selectionModel, designer);
return; return;
} }
deleteCard(button,index); deleteCard(this, index);
this.tagLayout.adjustComponentWidth();
designer.fireTargetModified(); designer.fireTargetModified();
LayoutUtils.layoutRootContainer(designer.getRootComponent()); LayoutUtils.layoutRootContainer(designer.getRootComponent());
FormHierarchyTreePane.getInstance().refreshRoot(); FormHierarchyTreePane.getInstance().refreshRoot();
@ -222,7 +217,7 @@ public class XCardSwitchButton extends XButton {
} }
//删除card,同时修改其他switchbutton和tabfit的index //删除card,同时修改其他switchbutton和tabfit的index
private void deleteCard(XCardSwitchButton button,int index){ private void deleteCard(XCardSwitchButton button, int index){
String titleName = button.getContentLabel().getText(); String titleName = button.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”", int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”",
Inter.getLocText("FR-Designer_ConfirmDialog_Title"), JOptionPane.YES_NO_OPTION); Inter.getLocText("FR-Designer_ConfirmDialog_Title"), JOptionPane.YES_NO_OPTION);
@ -292,18 +287,18 @@ public class XCardSwitchButton extends XButton {
int width = button.getWidth(); int width = button.getWidth();
// 鼠标进入按钮右侧删除图标区域 // 鼠标进入按钮右侧删除图标区域
double recX = position.getX() + titlePoint.getX() + (width - RIGHT_OFFSET); double recX = position.getX() + titlePoint.getX() + (width - CLOSE_ICON_RIGHT_OFFSET);
double recY = position.getY() + titlePoint.getY() + TOP_OFFSET; double recY = position.getY() + titlePoint.getY() + CLOSE_ICON_TOP_OFFSET;
return (recX < ex && ex < recX + RIGHT_OFFSET && ey < recY && ey > position.getY()); return (recX < ex && ex < recX + CLOSE_ICON_RIGHT_OFFSET && ey < recY && ey > position.getY());
} }
//将当前switchButton改为选中状态 //将当前switchButton改为选中状态
private void changeButtonState(int index){ private void changeButtonState(int index) {
for(int i=0;i<this.tagLayout.getComponentCount();i++){ for (int i = 0; i < this.tagLayout.getComponentCount(); i++) {
XCardSwitchButton temp = (XCardSwitchButton) tagLayout.getComponent(i); XCardSwitchButton temp = (XCardSwitchButton) tagLayout.getComponent(i);
CardSwitchButton tempButton = (CardSwitchButton) temp.toData(); CardSwitchButton tempButton = (CardSwitchButton) temp.toData();
tempButton.setShowButton(tempButton.getIndex()==index); tempButton.setShowButton(tempButton.getIndex() == index);
} }
} }
@ -311,8 +306,10 @@ public class XCardSwitchButton extends XButton {
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
drawBackground(); CardSwitchButton button = (CardSwitchButton) this.toData();
drawTitle(); WidgetTitle widgetTitle = getWidgetTitle();
drawBackground(button, widgetTitle);
drawTitle(button, widgetTitle);
Dimension panelSize = this.getContentLabel().getSize(); Dimension panelSize = this.getContentLabel().getSize();
this.getContentBackground().paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight())); this.getContentBackground().paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight()));
drawCloseIcon(g2d); drawCloseIcon(g2d);
@ -320,62 +317,45 @@ public class XCardSwitchButton extends XButton {
//画删除图标 //画删除图标
private void drawCloseIcon(Graphics2D g2d){ private void drawCloseIcon(Graphics2D g2d){
closeIcon.paintIcon(this, g2d,this.getWidth()-LEFT_GAP,0); closeIcon.paintIcon(this, g2d, this.getWidth() - LEFT_GAP, 0);
} }
//画背景 //画背景
private void drawBackground(){ private void drawBackground(CardSwitchButton button, WidgetTitle widgetTitle){
CardSwitchButton button = (CardSwitchButton)this.toData(); Background background = widgetTitle.getBackground();
Background currentBackground; TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle();
currentBackground = this.getSelectBackground(); //获取当前tab的index
//这边就是button的背景图片,图片的是image,默认的是color,所以不应该是针对null的判断 CardSwitchButton currentButton = (CardSwitchButton) this.toData();
String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULT_TYPE; int index = currentButton.getIndex();
if (type.equals(COLOR_BACKGROUND_TYPE) || type.equals(DEFAULT_TYPE)) { XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
ColorBackground background; WTabFitLayout wTabFitLayout = tabFitLayout.getWTabFitLayout();
if(button.isShowButton()){ Background initialBackground = wTabFitLayout.getInitialBackground();
this.rebuid(); Background selectBackground = wTabFitLayout.getClickBackground();
background = ColorBackground.getInstance(CHOOSED_GRAL); if (button.isShowButton()) {
this.setContentBackground(background); this.setContentBackground(selectBackground == null ? templateStyle.getSelectBackground() : selectBackground);
}else{ } else {
this.rebuid(); this.setContentBackground(initialBackground == null ? background : initialBackground);
background = ColorBackground.getInstance(NORMAL_GRAL);
this.setContentBackground(background);
}
} }
} }
//画标题 //画标题
private void drawTitle() { private void drawTitle(CardSwitchButton button, WidgetTitle widgetTitle) {
CardSwitchButton button = (CardSwitchButton) this.toData();
String titleText = button.getText(); String titleText = button.getText();
this.setButtonText(titleText); this.setButtonText(titleText);
if (this.cardLayout == null) { FRFont font = widgetTitle.getFrFont();
initRelateLayout();
}
LayoutBorderStyle style = this.cardLayout.toData().getBorderStyle();
// 标题部分
WidgetTitle title = style.getTitle();
FRFont font = title.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
label.setForeground(font.getForeground()); label.setForeground(font.getForeground());
Background background = title.getBackground();
TemplateStyle templateStyle = ((WCardTagLayout)tagLayout.toData()).getTemplateStyle();
Background selectBackground = templateStyle.getSelectBackground();
if (background != null) {
if(button.isShowButton() && selectBackground != null){
this.setContentBackground(selectBackground);
}else if (button.isShowButton() && selectBackground == null){
background = ColorBackground.getInstance(CHOOSED_GRAL);
this.setContentBackground(background);
} else {
this.setContentBackground(background);
} }
private WidgetTitle getWidgetTitle() {
if (this.cardLayout == null) {
initRelateLayout();
} }
LayoutBorderStyle style = this.cardLayout.toData().getBorderStyle();
return style.getTitle();
} }
//删除tab布局 //删除tab布局
@ -444,10 +424,12 @@ public class XCardSwitchButton extends XButton {
return new CardSwitchBtnLabel(); return new CardSwitchBtnLabel();
} }
public class CardSwitchBtnLabel extends UILabel{ public class CardSwitchBtnLabel extends UILabel {
public CardSwitchBtnLabel(){
public CardSwitchBtnLabel() {
updateUI(); updateUI();
} }
@Override @Override
public void updateUI() { public void updateUI() {
setUI(new CardSwitchBtnLabelUI()); setUI(new CardSwitchBtnLabelUI());
@ -455,27 +437,35 @@ public class XCardSwitchButton extends XButton {
} }
public class CardSwitchBtnLabelUI extends BasicLabelUI{ public class CardSwitchBtnLabelUI extends BasicLabelUI {
private static final int DOT_COUNT = 3;
private static final String DOT = ".";
private static final int DOTS_LINESPACE = 6;
private static final int DOTS_HEIGHT = 10;
@Override @Override
public void paint(Graphics g, JComponent c) public void paint(Graphics g, JComponent c) {
{ WCardTagLayout wCardTagLayout = (WCardTagLayout) tagLayout.toData();
Graphics2D g2d = (Graphics2D)g; if (ComparatorUtils.equals(wCardTagLayout.getTextDirection(), WTabTextDirection.TEXT_VER_DIRECTION)) {
CardSwitchButton button = (CardSwitchButton) XCardSwitchButton.this.toData(); //绘制文本竖排展示
paintVerticalText(g);
} else {
super.paint(g, c);
}
}
private void paintVerticalText(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int width = XCardSwitchButton.this.getWidth(); int width = XCardSwitchButton.this.getWidth();
int height= XCardSwitchButton.this.getHeight(); int height = XCardSwitchButton.this.getHeight();
CardSwitchButton button = (CardSwitchButton) XCardSwitchButton.this.toData();
String titleText = button.getText(); String titleText = button.getText();
LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); java.util.List verticalTextList = new ArrayList();
WidgetTitle title = style.getTitle(); StringBuilder titleStringBuf = new StringBuilder();
WidgetTitle title = getWidgetTitle();
FRFont font = title.getFrFont(); FRFont font = title.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), font.getSize() + FONT_SIZE_ADJUST);
FontMetrics fm = GraphHelper.getFontMetrics(newFont); FontMetrics fm = GraphHelper.getFontMetrics(newFont);
WCardTagLayout wCardTagLayout = (WCardTagLayout) tagLayout.toData();
StringBuilder titleStringBuf = new StringBuilder();
//竖向处理
if(ComparatorUtils.equals(wCardTagLayout.getTextDirection(), WTabTextDirection.TEXT_VER_DIRECTION)){
java.util.List verticalTextList = new ArrayList();
for (int i = 0; i < titleText.length(); i++) { for (int i = 0; i < titleText.length(); i++) {
titleStringBuf.append(titleText.charAt(i)); titleStringBuf.append(titleText.charAt(i));
verticalTextList.add(titleStringBuf.substring(0, titleStringBuf.length())); verticalTextList.add(titleStringBuf.substring(0, titleStringBuf.length()));
@ -491,22 +481,18 @@ public class XCardSwitchButton extends XButton {
GraphHelper.drawString(g2d, paint_str, (width - fm.stringWidth(paint_str)) / 2, textY); GraphHelper.drawString(g2d, paint_str, (width - fm.stringWidth(paint_str)) / 2, textY);
textY += textHeight; textY += textHeight;
textY += PT.pt2pix(0, RESLUTION); textY += PT.pt2pix(0, RESLUTION);
if (textY > height - textHeight && i < verticalTextList.size()-1) { if (textY > height - textHeight && i < verticalTextList.size() - 1) {
textY -= 10; textY -= DOTS_HEIGHT;
paintDots(g2d, textY, (width - fm.stringWidth(paint_str)) / 2); paintDots(g2d, textY, (width - fm.stringWidth(paint_str)) / 2);
break; break;
} }
} }
}else{
super.paint(g, c);
}
} }
public void paintDots(Graphics2D g2d, int startY, int startX){ public void paintDots(Graphics2D g2d, int startY, int startX) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < DOT_COUNT; i++) {
String paint_str = "."; GraphHelper.drawString(g2d, DOT, startX, startY);
GraphHelper.drawString(g2d, paint_str, startX, startY); startY += DOTS_LINESPACE;
startY += DOTSLINESPACE;//
startY += PT.pt2pix(0, RESLUTION); startY += PT.pt2pix(0, RESLUTION);
} }
} }

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

@ -34,6 +34,8 @@ import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
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.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;
@ -227,12 +229,9 @@ public class XWCardLayout extends XLayoutContainer {
private XCardSwitchButton initFirstButton(String widgetName, XWCardTagLayout xTag){ private XCardSwitchButton initFirstButton(String widgetName, XWCardTagLayout xTag){
CardSwitchButton firstBtn = new CardSwitchButton(widgetName); CardSwitchButton firstBtn = new CardSwitchButton(widgetName);
firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0); firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0);
firstBtn.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
firstBtn.setCustomStyle(true);
xTag.setCurrentCard(firstBtn); xTag.setCurrentCard(firstBtn);
XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag); XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag);
xFirstBtn.setBackupParent(xTag); xFirstBtn.setBackupParent(xTag);
return xFirstBtn; return xFirstBtn;
} }
@ -497,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);

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

@ -1,7 +1,6 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
@ -22,7 +21,6 @@ import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; 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.Background; import com.fr.general.Background;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -104,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; // 不要菜单
@ -212,41 +214,32 @@ public class XWTabFitLayout extends XWFitLayout {
return crPropertyDescriptors; return crPropertyDescriptors;
} }
private void checkButonType() { public void checkButonType() {
if (this.xCardSwitchButton == null) { WTabFitLayout wTabFitLayout = ((WTabFitLayout) data);
//假如为空,默认获取第一个tab的cardBtn属性 XCardSwitchButton xCardSwitchButton = this.getxCardSwitchButton();
try { if(xCardSwitchButton == null){
xCardSwitchButton = (XCardSwitchButton) ((XWCardMainBorderLayout) this.getTopLayout()).getTitlePart().getTagPart().getComponent(0); initRelateSwitchButton();
}catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
}
return;
} }
boolean isStyle = ((WTabFitLayout) data).isCustomStyle();
Background bg;
bg = ColorBackground.getInstance(NORMAL_GRAL);
CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData(); CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData();
boolean isStyle = wTabFitLayout.isCustomStyle();
Background initialBackground = wTabFitLayout.getInitialBackground();
Background overBackground = wTabFitLayout.getOverBackground();
Background clickBackground = wTabFitLayout.getClickBackground();
if (!isStyle) { if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false); cardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg);
cardSwitchButton.setInitialBackground(null); cardSwitchButton.setInitialBackground(null);
cardSwitchButton.setClickBackground(null); cardSwitchButton.setClickBackground(null);
cardSwitchButton.setOverBackground(null); cardSwitchButton.setOverBackground(null);
} else { } else {
Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true); cardSwitchButton.setCustomStyle(true);
if (this.initialBackground != null){ if (initialBackground != null){
this.xCardSwitchButton.setSelectBackground(this.initialBackground); cardSwitchButton.setInitialBackground(initialBackground);
cardSwitchButton.setInitialBackground(this.initialBackground);
} }
if (this.overBackground != null){ if (overBackground != null){
cardSwitchButton.setOverBackground(this.overBackground); cardSwitchButton.setOverBackground(overBackground);
} }
if (this.clickBackground != null) { if (clickBackground != null) {
cardSwitchButton.setClickBackground(this.clickBackground); cardSwitchButton.setClickBackground(clickBackground);
} }
} }
} }
@ -607,24 +600,9 @@ public class XWTabFitLayout extends XWFitLayout {
XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent(); XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent();
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) cardLayout.getBackupParent(); XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) cardLayout.getBackupParent();
XWCardTitleLayout titleLayout = mainLayout.getTitlePart(); XWCardTitleLayout titleLayout = mainLayout.getTitlePart();
// //放置tab按钮的tagLayout //放置tab按钮的tagLayout
XWCardTagLayout tagLayout = titleLayout.getTagPart(); XWCardTagLayout tagLayout = titleLayout.getTagPart();
tagLayout.setTabsAndAdjust(); tagLayout.setTabsAndAdjust();
initialBackground = ((WTabFitLayout) data).getInitialBackground();
overBackground = ((WTabFitLayout) data).getOverBackground();
clickBackground = ((WTabFitLayout)data).getClickBackground();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
if(initialBackground != null){
xCardSwitchButton.setSelectBackground(initialBackground);
cardSwitchButton.setInitialBackground(initialBackground);
}
if(overBackground != null){
cardSwitchButton.setOverBackground(overBackground);
}
if(clickBackground != null){
cardSwitchButton.setClickBackground(clickBackground);
}
} }
public void setCardSwitchBtnSize(){ public void setCardSwitchBtnSize(){

8
designer_form/src/com/fr/design/mainframe/ComponentTree.java

@ -20,6 +20,8 @@ import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Point; import java.awt.Point;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -56,6 +58,12 @@ public class ComponentTree extends JTree {
ComponetTreeMouseListener componetTreeMouseListener = new ComponetTreeMouseListener(this); ComponetTreeMouseListener componetTreeMouseListener = new ComponetTreeMouseListener(this);
this.addMouseMotionListener(componetTreeMouseListener); this.addMouseMotionListener(componetTreeMouseListener);
this.addMouseListener(componetTreeMouseListener); this.addMouseListener(componetTreeMouseListener);
this.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
designer.dispatchEvent(e);
}
});
} }
public FormDesigner getDesigner() { public FormDesigner getDesigner() {

7
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 {
if (this.index == FORM_TAB) {
//JForm的target重置 //JForm的target重置
this.setTarget((Form) u.getForm().clone()); this.setTarget((Form) u.getForm().clone());
if (this.index == FORM_TAB) {
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);

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

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer.component; 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.widget.component.BackgroundCompPane; import com.fr.design.widget.component.BackgroundCompPane;
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;
@ -15,33 +16,47 @@ public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout
} }
public void update(WTabFitLayout wTabFitLayout){ @Override
protected void initBackgroundEditor(){
initalBackgroundEditor = new AccessibleTabBackgroundEditor();
overBackgroundEditor = new AccessibleTabBackgroundEditor();
clickBackgroundEditor = new AccessibleTabBackgroundEditor();
}
@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){
wTabFitLayout.setCustomStyle(false); tabFitLayout.setCustomStyle(false);
wTabFitLayout.setInitialBackground(null); tabFitLayout.setInitialBackground(null);
wTabFitLayout.setOverBackground(null); tabFitLayout.setOverBackground(null);
wTabFitLayout.setClickBackground(null); tabFitLayout.setClickBackground(null);
}else{ }else{
wTabFitLayout.setCustomStyle(true); tabFitLayout.setCustomStyle(true);
wTabFitLayout.setInitialBackground((Background) initalBackgroundEditor.getValue()); tabFitLayout.setInitialBackground((Background) initalBackgroundEditor.getValue());
wTabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue()); tabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue());
wTabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue()); tabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue());
} }
switchCard(); switchCard();
} }
public void populate(WTabFitLayout wTabFitLayout){ @Override
if(!wTabFitLayout.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(wTabFitLayout.getInitialBackground()); initalBackgroundEditor.setValue(tabFitLayout.getInitialBackground());
overBackgroundEditor.setValue(wTabFitLayout.getOverBackground()); overBackgroundEditor.setValue(tabFitLayout.getOverBackground());
clickBackgroundEditor.setValue(wTabFitLayout.getClickBackground()); clickBackgroundEditor.setValue(tabFitLayout.getClickBackground());
} }
switchCard(); switchCard();
} }

6
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java

@ -2,8 +2,6 @@ package com.fr.design.widget.ui.designer.layout;
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;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -15,8 +13,6 @@ import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
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.WCardTitleLayout;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -56,7 +52,7 @@ public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBord
setCarousel = new UICheckBox(Inter.getLocText("FR-Designer_setCarousel")); setCarousel = new UICheckBox(Inter.getLocText("FR-Designer_setCarousel"));
IntervalPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{ IntervalPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{
new UILabel(Inter.getLocText("FR-Designer_carouselInterval")), carouselInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); new UILabel(Inter.getLocText("FR-Designer_carouselInterval")), carouselInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
IntervalPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); IntervalPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L6));
jPanel.add(setCarousel, BorderLayout.NORTH); jPanel.add(setCarousel, BorderLayout.NORTH);
jPanel.add(IntervalPane, BorderLayout.CENTER); jPanel.add(IntervalPane, BorderLayout.CENTER);
setCarousel.addActionListener(new ActionListener() { setCarousel.addActionListener(new ActionListener() {

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

@ -1,7 +1,8 @@
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.mainframe.widget.accessibles.AccessibleTabBackgroundEditor; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.mainframe.widget.accessibles.AccessibleTabPaneBackgroundEditor;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.cardtag.TemplateStyle; import com.fr.general.cardtag.TemplateStyle;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
@ -35,7 +36,7 @@ import java.awt.Component;
* Created by kerry on 2017/11/16. * Created by kerry on 2017/11/16.
*/ */
public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout> { public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout> {
private AccessibleTabBackgroundEditor backgroundEditor; private AccessibleTabPaneBackgroundEditor backgroundEditor;
private FRFontPane frFontPane; private FRFontPane frFontPane;
private UIButtonGroup displayPositionGroup; private UIButtonGroup displayPositionGroup;
private UIButtonGroup textDirectionGroup; private UIButtonGroup textDirectionGroup;
@ -49,7 +50,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
backgroundEditor = new AccessibleTabBackgroundEditor(); backgroundEditor = new AccessibleTabPaneBackgroundEditor();
templateStyleEditor = new AccessibleTemplateStyleEditor(); templateStyleEditor = new AccessibleTemplateStyleEditor();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -59,7 +60,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font")); UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font"));
fontLabel.setVerticalAlignment(SwingConstants.TOP); fontLabel.setVerticalAlignment(SwingConstants.TOP);
frFontPane = new FRFontPane(){ frFontPane = new FRFontPane() {
protected JPanel createRightPane() { protected JPanel createRightPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -73,7 +74,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
} }
}; };
displayPositionGroup = new UIButtonGroup(WTabDisplayPosition.getStringArray()){ displayPositionGroup = new UIButtonGroup(WTabDisplayPosition.getStringArray()) {
@Override @Override
public boolean shouldResponseNameListener() { public boolean shouldResponseNameListener() {
return true; return true;
@ -105,7 +106,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
public void populateBean(WCardTagLayout ob) { public void populateBean(WCardTagLayout ob) {
//标题背景和字体属性设置在WCardLayout上做兼容 //标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout(); XLayoutContainer topLayout = creator.getTopLayout();
LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout)topLayout).getCardPart().toData().getBorderStyle(); LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle();
displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType()); displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType());
textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType()); textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType());
@ -121,22 +122,27 @@ 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();
boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType(); boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType();
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Tab_Style_Template"))){ if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Tab_Style_Template"))) {
layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex())); layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex()));
textDirectionGroup.setSelectedIndex(isHori? WTabTextDirection.TEXT_HORI_DERECTION.getType():WTabTextDirection.TEXT_VER_DIRECTION.getType()); textDirectionGroup.setSelectedIndex(isHori ? WTabTextDirection.TEXT_HORI_DERECTION.getType() : WTabTextDirection.TEXT_VER_DIRECTION.getType());
layout.setHgap(isHori ? WCardTagLayout.DESIGNER_DEFAULT_GAP : 0);
layout.setVgap(isHori ? 0 : WCardTagLayout.DESIGNER_DEFAULT_GAP);
} }
layout.setTextDirection(WTabTextDirection.parse(textDirectionGroup.getSelectedIndex())); layout.setTextDirection(WTabTextDirection.parse(textDirectionGroup.getSelectedIndex()));
TemplateStyle templateStyle = (TemplateStyle) templateStyleEditor.getValue(); TemplateStyle templateStyle = (TemplateStyle) templateStyleEditor.getValue();
if(!ComparatorUtils.equals(layout.getTemplateStyle(), templateStyle)){ if (!ComparatorUtils.equals(layout.getTemplateStyle(), templateStyle)) {
backgroundEditor.setValue(templateStyle.getDefaultBackground()); backgroundEditor.setValue(templateStyle.getDefaultBackground());
layoutBorderStyle.getTitle().setBackground(templateStyle.getDefaultBackground()); layoutBorderStyle.getTitle().setBackground(templateStyle.getDefaultBackground());
//重置内部tab的默认背景
xCardLayout.resetTabBackground(templateStyle);
layout.setTemplateStyle(templateStyle); layout.setTemplateStyle(templateStyle);
}else{ } else {
layoutBorderStyle.getTitle().setBackground((Background) backgroundEditor.getValue()); layoutBorderStyle.getTitle().setBackground((Background) backgroundEditor.getValue());
} }

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

@ -78,12 +78,12 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
@Override @Override
public void populateBean(WTabFitLayout ob) { public void populateBean(WTabFitLayout ob) {
borderStyle.populate(ob);
paddingBoundPane.populate(ob); paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval()); componentInterval.setValue(ob.getCompInterval());
if(ob.getCurrentCard() == null){ if(ob.getCurrentCard() == null){
ob.setCurrentCard(getRelateSwitchButton(ob)); ob.setCurrentCard(getRelateSwitchButton(ob));
} }
borderStyle.populate(ob);
titleField.setText(ob.getCurrentCard().getText()); titleField.setText(ob.getCurrentCard().getText());
} }

Loading…
Cancel
Save