Browse Source

Merge branch 'release/9.0' of http://www.finedevelop.com:2015/scm/~plough/design into release/9.0

master
plough 7 years ago
parent
commit
ba39fa911d
  1. 39
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  2. 5
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  3. 2
      designer_base/src/com/fr/design/locale/designer.properties
  4. 2
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  5. 2
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  6. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  7. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  8. 2
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  9. 39
      designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java
  10. 4
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java

39
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -2,6 +2,7 @@ package com.fr.quickeditor;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.iscrollbar.UIScrollBar;
@ -11,6 +12,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
@ -20,8 +22,6 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -51,6 +51,8 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
/*占位label*/ /*占位label*/
protected static UILabel emptyLabel = new UILabel(); protected static UILabel emptyLabel = new UILabel();
private int currentSelectedIndex;
static { static {
emptyLabel.setPreferredSize(new Dimension(60, 20)); emptyLabel.setPreferredSize(new Dimension(60, 20));
} }
@ -119,10 +121,10 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
cellLabel.setPreferredSize(new Dimension(60, 20)); cellLabel.setPreferredSize(new Dimension(60, 20));
UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content")); UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content"));
insertContentLabel.setPreferredSize(new Dimension(60, 20)); insertContentLabel.setPreferredSize(new Dimension(60, 20));
UIComboBox cellElementEditButton = initCellElementEditComboBox(); UIComboBox cellElementEditComboBox = initCellElementEditComboBox();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()}, new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()},
new Component[]{insertContentLabel, cellElementEditButton}, new Component[]{insertContentLabel, cellElementEditComboBox},
}; };
JPanel topContent = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); JPanel topContent = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
topContent.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0)); topContent.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
@ -136,6 +138,10 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
* @return UIButton * @return UIButton
*/ */
private UIComboBox initCellElementEditComboBox() { private UIComboBox initCellElementEditComboBox() {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate == null) {
return comboBox = new UIComboBox();
}
final String[] items = getDefaultComboBoxItems(); final String[] items = getDefaultComboBoxItems();
comboBox = new UIComboBox(items); comboBox = new UIComboBox(items);
final Object comboBoxSelected = getComboBoxSelected(); final Object comboBoxSelected = getComboBoxSelected();
@ -144,33 +150,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
} else { } else {
comboBox.setSelectedIndex(1); comboBox.setSelectedIndex(1);
} }
comboBox.addPopupMenuListener(new PopupMenuListener() { currentSelectedIndex = comboBox.getSelectedIndex();
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (cellInsertActions == null) {
cellInsertActions = ActionFactory.createCellInsertAction(ElementCasePane.class, tc);
}
// 这边重新获取是因为要根据JTemplate做一个过滤
ArrayList<String> arrayList = new ArrayList<String>();
for (UpdateAction action : cellInsertActions) {
arrayList.add(action.getMenuKeySet().getMenuKeySetName());
}
comboBox.setModel(new DefaultComboBoxModel<>(arrayList.toArray(new String[arrayList.size()])));
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
comboBox.addActionListener(new ActionListener() { comboBox.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
cellInsertActions = ActionFactory.createCellInsertAction(ElementCasePane.class, tc);
selectedIndex = comboBox.getSelectedIndex(); selectedIndex = comboBox.getSelectedIndex();
cellInsertActions[selectedIndex].actionPerformed(e); cellInsertActions[selectedIndex].actionPerformed(e);
comboBox.setSelectedIndex(currentSelectedIndex);
} }
}); });
return comboBox; return comboBox;

5
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -73,6 +73,7 @@ public class ActionFactory {
/** /**
* 注册图表的 地图资源 * 注册图表的 地图资源
*
* @param action 地图资源action * @param action 地图资源action
*/ */
public static void registerChartMapEditorAction(UpdateAction action) { public static void registerChartMapEditorAction(UpdateAction action) {
@ -229,18 +230,20 @@ public class ActionFactory {
public static MenuKeySet[] createCellInsertActionName() { public static MenuKeySet[] createCellInsertActionName() {
List<MenuKeySet> actionNames = new ArrayList<>(); List<MenuKeySet> actionNames = new ArrayList<>();
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
for (Class<?> clazz : actionClasses) { for (Class<?> clazz : actionClasses) {
if (clazz == null) { if (clazz == null) {
continue; continue;
} }
if (jTemplate.acceptToolbarItem(clazz)) {
try { try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor();
actionNames.add(c.newInstance().getMenuKeySet()); actionNames.add(c.newInstance().getMenuKeySet());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
} }
}
return actionNames.toArray(new MenuKeySet[actionNames.size()]); return actionNames.toArray(new MenuKeySet[actionNames.size()]);
} }

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

@ -2130,3 +2130,5 @@ FR-Designer-AlphaFine_NO_Result=no search result
FR-Designer-Download_Online_Sources= FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=Select Color FR-Designer_Select_Color=Select Color
FR-Designer-Basic_Dynamic_Parameter_Injection=Injection FR-Designer-Basic_Dynamic_Parameter_Injection=Injection
FR-Designer_Label=
FR-Designer_Widgetname=Widget Name

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

@ -2126,3 +2126,5 @@ FR-Designer-AlphaFine_NO_Result=no search result
FR-Designer-Download_Online_Sources= FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=Select Color FR-Designer_Select_Color=Select Color
FR-Designer-Basic_Dynamic_Parameter_Injection=Injection FR-Designer-Basic_Dynamic_Parameter_Injection=Injection
FR-Designer_Label=Label
FR-Designer_Widgetname=Widget Name

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

@ -2124,3 +2124,5 @@ FR-Designer_Mobile-Height-Limit=
FR-Designer-Download_Online_Sources= FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color= FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection=\ FR-Designer-Basic_Dynamic_Parameter_Injection=\
FR-Designer_Label=\u30E9\u30D9\u30EBa
FR-Designer_Widgetname=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u540D

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

@ -2125,3 +2125,5 @@ FR-Designer_Mobile-Height-Limit=
FR-Designer-Download_Online_Sources= FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color= FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection= FR-Designer-Basic_Dynamic_Parameter_Injection=
FR-Designer_Label=\uB808\uC774\uBE14
FR-Designer_Widgetname=\uC18C\uD504\uD2B8\uC6E8\uC5B4\uC81C\uC5B4\uC774\uB984

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

@ -2137,3 +2137,5 @@ FR-Designer-AlphaFine_NO_Result=\u65E0\u641C\u7D22\u7ED3\u679C
FR-Designer-Download_Online_Sources=\u56FE\u8868\u9700\u8981\u4E0B\u8F7D\u6700\u65B0\u7684\u8D44\u6E90\u6587\u4EF6\uFF0C\u662F\u5426\u5B89\u88C5\uFF1F FR-Designer-Download_Online_Sources=\u56FE\u8868\u9700\u8981\u4E0B\u8F7D\u6700\u65B0\u7684\u8D44\u6E90\u6587\u4EF6\uFF0C\u662F\u5426\u5B89\u88C5\uFF1F
FR-Designer_Select_Color=\u9009\u62E9\u989C\u8272 FR-Designer_Select_Color=\u9009\u62E9\u989C\u8272
FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165 FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165
FR-Designer_Label=\u6807\u7B7E
FR-Designer_Widgetname=\u63A7\u4EF6\u540D

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

@ -2129,3 +2129,5 @@ FR-Designer-AlphaFine_NO_Result=\u7121\u641C\u7D22\u7D50\u679C
FR-Designer-Download_Online_Sources= FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color= FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165 FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165
FR-Designer_Label=\u6A19\u7C3D
FR-Designer_Widgetname=\u63A7\u5236\u9805\u540D

39
designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java

@ -36,33 +36,37 @@ import java.util.EventObject;
*/ */
class MobileParaWidgetTable extends JTable { class MobileParaWidgetTable extends JTable {
private final int WIDGET_NAME_COLUMN = 1;
private FormDesigner designer; private FormDesigner designer;
private String[][] cellData; private String[][] cellData;
private String[] headers = {Inter.getLocText("Form-Widget_Name")}; private String[] headers = {Inter.getLocText("FR-Designer_Label"), Inter.getLocText("FR-Designer_Widgetname")};
private static final int WIDGET_TABLE_ROW_HEIGHT = 22; private static final int WIDGET_TABLE_ROW_HEIGHT = 22;
private static final int UITEXTFIELD_WIDTH = 40; private static final int UITEXTFIELD_WIDTH = 0;
private static final int GAP = 11;
private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件 private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件
private int selectedRow = -1; private int selectedRow = -1;
private int selectedColumn = -1; private int selectedColumn = -1;
private int GAP = 11;
private boolean draging = false; private boolean draging = false;
MobileParaWidgetTable(FormDesigner designer) { private void init(FormDesigner designer) {
this.designer = designer; this.designer = designer;
this.cellData = getData(); this.cellData = getData();
this.setTableProperties(); this.setTableProperties();
this.setDefaultEditor(Object.class, new MobileCellEditor()); this.setDefaultEditor(Object.class, new MobileCellEditor());
TableModel defaultModel = new BeanTableModel(); this.setModel(new BeanTableModel());
this.setModel(defaultModel); this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
this.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
TableColumn tc = this.getColumn(this.getColumnName(0)); TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setMinWidth(UITEXTFIELD_WIDTH);
tc.setMaxWidth(UITEXTFIELD_WIDTH);
tc.setPreferredWidth(UITEXTFIELD_WIDTH); tc.setPreferredWidth(UITEXTFIELD_WIDTH);
this.repaint(); this.repaint();
this.setDefaultRenderer(Object.class, new MobileWidgetTableCellRenderer()); this.setDefaultRenderer(Object.class, new MobileWidgetTableCellRenderer());
refreshData(); refreshData();
this.addMouseListener(mouseAdapter); this.addMouseListener(mouseAdapter);
this.addMouseMotionListener(mouseAdapter); this.addMouseMotionListener(mouseAdapter);
}
MobileParaWidgetTable(FormDesigner designer) {
init(designer);
add(moveComponent); add(moveComponent);
} }
@ -140,7 +144,9 @@ class MobileParaWidgetTable extends JTable {
*/ */
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
int width = getColumnModel().getColumn(0).getWidth(); int width = getColumnModel().getColumn(1).getWidth();
//如果点击选中的是第二列,就可以拖动
if (selectedColumn == 1) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
draging = true; draging = true;
moveComponent.setText(getValueAt(selectedRow, selectedColumn).toString()); moveComponent.setText(getValueAt(selectedRow, selectedColumn).toString());
@ -150,14 +156,15 @@ class MobileParaWidgetTable extends JTable {
moveComponent.setForeground(Color.lightGray); moveComponent.setForeground(Color.lightGray);
moveComponent.setBorder(BorderFactory.createLineBorder(Color.lightGray)); moveComponent.setBorder(BorderFactory.createLineBorder(Color.lightGray));
} }
}
/** /**
* 设置鼠标单击时处理的事件 * 设置鼠标单击时处理的事件单击第二列的控件列表进入控件属性表
* @param e * @param e
*/ */
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (getSelectedRow() != -1 && getSelectedColumn() == 0) { if (getSelectedRow() != -1 && getSelectedColumn() == 1) {
String widgetName = cellData[getSelectedRow()][getSelectedColumn()]; String widgetName = cellData[getSelectedRow()][getSelectedColumn()];
if (StringUtils.isNotEmpty(widgetName)) { if (StringUtils.isNotEmpty(widgetName)) {
int count = getEditingDesigner().getParaComponent().getComponentCount(); int count = getEditingDesigner().getParaComponent().getComponentCount();
@ -222,7 +229,7 @@ class MobileParaWidgetTable extends JTable {
private String[][] getData() { private String[][] getData() {
XLayoutContainer paraContainer = designer.getParaComponent(); XLayoutContainer paraContainer = designer.getParaComponent();
if (paraContainer == null || !paraContainer.acceptType(XWParameterLayout.class)) { if (paraContainer == null || !paraContainer.acceptType(XWParameterLayout.class)) {
return new String[0][1]; return new String[0][0];
} }
WParameterLayout para = (WParameterLayout) (paraContainer.toData()); WParameterLayout para = (WParameterLayout) (paraContainer.toData());
@ -342,7 +349,7 @@ class MobileParaWidgetTable extends JTable {
} }
Object[] rowValue = cellData[row]; Object[] rowValue = cellData[row];
if (column > -1 && column < rowValue.length) { if (column > -1 && column < rowValue.length) {
return cellData[row][WIDGET_NAME_COLUMN]; return cellData[row][column];
} }
return null; return null;
} }
@ -363,10 +370,10 @@ class MobileParaWidgetTable extends JTable {
return; return;
} }
if (aValue == null) { if (aValue == null) {
cellData[row][WIDGET_NAME_COLUMN] = null; cellData[row][column] = null;
return; return;
} }
cellData[row][WIDGET_NAME_COLUMN] = aValue.toString(); cellData[row][column] = aValue.toString();
} }
/** /**
@ -377,7 +384,7 @@ class MobileParaWidgetTable extends JTable {
* @return 是否可编辑 * @return 是否可编辑
*/ */
public boolean isCellEditable(int row, int column) { public boolean isCellEditable(int row, int column) {
return false; return column != 1;
} }
} }

4
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java

@ -1,8 +1,8 @@
package com.fr.design.widget.ui.designer.btn; package com.fr.design.widget.ui.designer.btn;
import com.fr.data.Dictionary;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
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;
@ -67,6 +67,7 @@ public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends Field
protected void populateSubFieldEditorBean(T e) { protected void populateSubFieldEditorBean(T e) {
this.buttonGroupDictPane.populate(e); this.buttonGroupDictPane.populate(e);
formWidgetValuePane.populate(e); formWidgetValuePane.populate(e);
dictionaryEditor.setValue(e.getDictionary());
populateSubButtonGroupBean(e); populateSubButtonGroupBean(e);
} }
@ -79,6 +80,7 @@ public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends Field
T e = updateSubButtonGroupBean(); T e = updateSubButtonGroupBean();
this.buttonGroupDictPane.update(e); this.buttonGroupDictPane.update(e);
formWidgetValuePane.update(e); formWidgetValuePane.update(e);
e.setDictionary((Dictionary) dictionaryEditor.getValue());
return e; return e;
} }

Loading…
Cancel
Save