Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

feature/10.0
xiqiu 3 years ago
parent
commit
3ec75314cd
  1. 116
      designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java
  3. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneProvider.java
  5. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  6. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  7. 1
      designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java
  8. 76
      designer-base/src/main/java/com/fr/design/gui/itextfield/UIPositiveAndNegativeIntNumberField.java
  9. 18
      designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java
  10. 11
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  11. 48
      designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java
  12. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java
  13. 39
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java
  14. 10
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  15. 8
      designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java
  16. 9
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  17. 3
      designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java
  18. 34
      designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

116
designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java

@ -6,7 +6,11 @@ import com.fr.design.gui.itable.TableSorter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.OperatingSystem;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
@ -40,27 +44,104 @@ public class CopyableJTable extends SortableJTable {
int commandKeyCode = 157;
//选中单元格的背景色
Color selectBackGround = new Color(54, 133, 242, 63);
Color headerBackGround = new Color(229, 229, 229);
boolean mouseDrag = false;
boolean headerSelect = false;
DefaultTableCellRenderer tableHeaderCellRenderer = new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (isChoose(row, column)) {
comp.setBackground(selectBackGround);
} else {
comp.setBackground(headerBackGround);
}
return comp;
}
};
public CopyableJTable(TableSorter tableModel) {
super(tableModel);
initListener();
this.getTableHeader().setDefaultRenderer(tableHeaderCellRenderer);
}
private void initListener() {
CopyableJTable self = this;
this.getTableHeader().addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (mouseDrag) {
headerSelect = true;
int column = getColumn(e);
self.updateEndPoint(-1, column);
self.getTableHeader().repaint();
}
}
@Override
public void mouseExited(MouseEvent e) {
if (mouseDrag) {
headerSelect = false;
}
}
@Override
public void mouseClicked(MouseEvent e) {
headerSelect = true;
int column = getColumn(e);
if (column != -1) {
self.clearPoint();
self.addPoint(-1, column);
self.updateStartPoint(-1, column);
self.updateEndPoint(-1, column);
self.refreshTable();
}
}
private int getColumn(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
return viewColumn;
}
});
this.getTableHeader().addMouseMotionListener(new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
mouseDrag = false;
}
@Override
public void mouseDragged(MouseEvent e) {
self.clearPoint();
self.updateStartPoint(-1, -1);
self.updateEndPoint(-1, -1);
self.refreshTable();
}
});
this.addMouseMotionListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseDragged(MouseEvent evt) {
mouseDrag = true;
int row = self.rowAtPoint(evt.getPoint());
int col = self.columnAtPoint(evt.getPoint());
if (self.updateEndPoint(row, col)) {
self.repaint();
self.refreshTable();
}
}
public void mouseMoved(MouseEvent e) {
mouseDrag = false;
}
});
this.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
headerSelect = false;
int row = self.rowAtPoint(e.getPoint());
int col = self.columnAtPoint(e.getPoint());
if (!self.isControlDown) {
@ -74,7 +155,7 @@ public class CopyableJTable extends SortableJTable {
self.addPoint(row, col);
self.updateEndPoint(row, col);
self.repaint();
self.refreshTable();
}
});
@ -129,6 +210,8 @@ public class CopyableJTable extends SortableJTable {
private boolean updateEndPoint(int row, int col) {
if (headerSelect && row != -1)
return false;
if (endRow != row || endCol != col) {
endRow = row;
endCol = col;
@ -157,13 +240,12 @@ public class CopyableJTable extends SortableJTable {
private void copy() {
FineLoggerFactory.getLogger().info("copy cell value");
java.util.List<java.util.List<Object>> table = new ArrayList<>();
if ((startRow != endRow || startCol != endCol) &&
Math.min(startRow, endRow) > -1 && Math.min(startCol, endCol) > -1) {
if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) {
for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) {
table.add(new ArrayList<>());
for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) {
Object text = this.getValueAt(i, j);
table.get(i - Math.min(startRow, endRow)).add(text);
Object text = this.getTableValue(i, j);
table.get(table.size() - 1).add(text);
}
}
} else if (pointList.size() > 0) {
@ -176,8 +258,8 @@ public class CopyableJTable extends SortableJTable {
table.add(new ArrayList<>());
currentRow++;
}
Object text = this.getValueAt(point.x, point.y);
table.get(currentRow - startRow).add(text);
Object text = this.getTableValue(point.x, point.y);
table.get(table.size() - 1).add(text);
}
}
@ -186,6 +268,24 @@ public class CopyableJTable extends SortableJTable {
clip.setContents(tText, null);
}
private Object getTableValue(int row, int col) {
Object value = null;
if (col > -1) {
if (row > -1) {
value = this.getValueAt(row, col);
} else if (row == -1) {
col = columnModel.getColumn(col).getModelIndex();
value = this.getModel().getColumnName(col);
}
}
return value;
}
private void refreshTable() {
this.repaint();
this.getTableHeader().repaint();
}
private boolean isChoose(int row, int col) {
if (row >= Math.min(startRow, endRow) && row <= Math.max(startRow, endRow)) {
if (col >= Math.min(startCol, endCol) && col <= Math.max(startCol, endCol)) {

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java

@ -10,6 +10,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
@ -77,6 +78,9 @@ class JControlUpdatePane extends JPanel {
}
card.show(cardPane, String.valueOf(i));
try {
if (ob2Populate instanceof Listener) {
listControlPane.wrapperListener((Listener) ob2Populate);
}
updatePanes[i].populateBean(ob2Populate);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -103,6 +107,9 @@ class JControlUpdatePane extends JPanel {
if (pane != null && pane.isVisible()) {
Object bean = pane.updateBean();
try {
if (bean instanceof Listener) {
listControlPane.wrapperListener((Listener) bean);
}
if (bean instanceof RemoteDesignerWorkspaceInfo) {
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName());
String remindTime = info.getRemindTime();

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
@ -417,4 +418,10 @@ public abstract class JListControlPane extends JControlPane implements ListContr
public JControlUpdatePane getControlUpdatePane() {
return (JControlUpdatePane) controlUpdatePane;
}
@Override
public void wrapperListener(Listener listener){
}
}

3
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneProvider.java

@ -3,6 +3,7 @@ package com.fr.design.gui.controlpane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.form.event.Listener;
import com.fr.stable.Nameable;
import javax.swing.DefaultListModel;
@ -32,4 +33,6 @@ public interface ListControlPaneProvider extends UnrepeatedNameHelper {
void showSelectPane();
void showEditPane();
ShortCut4JControlPane[] getShorts();
void wrapperListener(Listener listener);
}

7
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.form.event.Listener;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
@ -314,4 +315,10 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
public JNameEdList getNameableList() {
return nameableList;
}
@Override
public void wrapperListener(Listener listener){
}
}

7
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -391,7 +391,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
@Override
public Nameable[] update() {
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>();
List<Nameable> res = new ArrayList<Nameable>();
getControlUpdatePane().update();
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator();
while (iterator.hasNext()) {
@ -516,6 +516,11 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
return StringUtils.EMPTY;
}
@Override
public void wrapperListener(Listener listener){
}
private class ListWrapperPane extends JPanel {
private UINameEdList nameEdList;

1
designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java

@ -12,6 +12,7 @@ import java.awt.Toolkit;
* Date: 13-3-29
* Time: 下午12:02
* To change this template use File | Settings | File Templates.
* fanglei: 这个类名字虽然叫整数输入框但是里面的业务仅支持输入正整数由于被引用的地方太多无法更改知道就行
*/
public class UIIntNumberField extends UINumberField {
public void setFieldDocument() {

76
designer-base/src/main/java/com/fr/design/gui/itextfield/UIPositiveAndNegativeIntNumberField.java

@ -0,0 +1,76 @@
package com.fr.design.gui.itextfield;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.Toolkit;
public class UIPositiveAndNegativeIntNumberField extends UINumberField {
private static final long serialVersionUID = 4946379346015964509L;
public void setFieldDocument() {
setDocument(createNumberDocument());
}
public class NumberDocument extends PlainDocument {
private static final long serialVersionUID = 1024213269275179172L;
public NumberDocument() {
}
public boolean checkString(int offset, String s, String str) {
String strNew = str.substring(0, offset) + s + str.substring(offset, getLength());
return isMinusSignOnly(strNew) || (isIntNumber(strNew) && isInputIllegalNumber(strNew) && !isOverMaxOrMinValue(strNew));
}
public void insertString(int offset, String s, AttributeSet a) throws BadLocationException {
String str = getText(0, getLength());
if (!checkString(offset, s, str)) {
Toolkit.getDefaultToolkit().beep();
return;
}
setisContentChanged(true);
super.insertString(offset, s, a);
}
private boolean isMinusSignOnly(String s) {
return s.contains("-") && s.length() == 1;
}
/**
* 输入字符是否是不合法数字
* @param s 输入的字符串
* @return 是否不合法
*/
private boolean isInputIllegalNumber(String s) {
try {
Integer.parseInt(s);
} catch (Exception e) {
return false;
}
return true;
}
private boolean isIntNumber(String s) {
boolean result = true;
for (int i = 0; i < s.length(); i++) {
String ch = s.charAt(i) + "";
if (!ch.matches("^[0-9\\-]+$")) {
result = false;
}
}
return result;
}
private boolean isOverMaxOrMinValue(String s) {
int value = Integer.parseInt(s);
return (value < getMinValue() || value > getMaxValue());
}
}
public NumberDocument createNumberDocument() {
return new NumberDocument();
}
}

18
designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java

@ -1,16 +1,17 @@
package com.fr.design.javascript;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.CommitTabbedPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.js.Commit2DBJavaScript;
import com.fr.write.DBManipulation;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@ -25,6 +26,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 构造函数控件事件的提交入库面板
*
* @param javaScriptActionPane JS提交面板对象
* @param dbManipulationPaneList 提交入库的提交面板列表
*/
@ -55,7 +57,6 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
btPane.add(addCallbackButton);
}
/**
* 更新DBManipulationPane
*/
@ -79,6 +80,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 新建DBManipulationPane
*
* @return 新建的DBManipulationPane
*/
public DBManipulationPane createDBManipulationPane() {
@ -91,6 +93,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 窗口名称
*
* @return 返回窗口名称
*/
public String title4PopupWindow() {
@ -131,11 +134,15 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 更新数据层JavaBean
*
* @return 返回JavaBean
*/
public Commit2DBJavaScript updateBean() {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript();
if (javaScriptActionPane.getResourceInfo() != null) {
commit2dbJavaScript.setJsResourceInfo(javaScriptActionPane.getResourceInfo());
}
List dbmaniList = new ArrayList();
for(int i = 0; i < this.dbmPaneList.size(); i++){
DBManipulationPane dbmpane =(DBManipulationPane)this.dbmPaneList.get(i);
@ -154,6 +161,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 判断是否是能接受的数据类型
*
* @param ob 对象
* @return 返回是否是能接受的数据类型
*/

11
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -12,6 +12,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.ui.WebContentUtils;
import com.fr.js.JavaScript;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -29,6 +30,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
private List contentDBManiPane;
private JavaScriptResourceInfo resourceInfo;
private JavaScript call = null;
public JavaScriptActionPane() {
@ -75,6 +78,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
}
public JavaScriptResourceInfo getResourceInfo() {
return resourceInfo;
}
public void setResourceInfo(JavaScriptResourceInfo resourceInfo) {
this.resourceInfo = resourceInfo;
}
/**
* 生成回调函数的按钮
*

48
designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java

@ -8,16 +8,23 @@ import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground;
import com.fr.chart.chartglyph.Marker;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.ConfigHelper;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.plugin.chart.ConfigHelper;
import javax.swing.*;
import java.awt.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* Combobox for selecting marker.
@ -53,32 +60,39 @@ public class MarkerComboBox extends UIComboBox {
* CellRenderer.
*/
class MarkerCellRenderer extends UIComboBoxRenderer {
private Marker marker = null;
private boolean isSelected = false;
public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
this.marker = (Marker) value;
this.isSelected = isSelected;
return this;
String text = null;
if (marker != null) {
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M);
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M);
if (isAutoMarker || isNullMarker) {
text = isNullMarker
? Toolkit.i18nText("Fine-Design_Report_None")
: Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
}
}
JLabel comp = (JLabel) super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus);
return comp;
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setColor(Color.black);
g2d.setFont(FRContext.getDefaultValues().getFRFont());
if (marker != null) {
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M);
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M);
if (isAutoMarker || isNullMarker) {
String text = isNullMarker
?Toolkit.i18nText("Fine-Design_Report_None")
:Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
paintTextMarker(g2d, d, text);
super.paint(g);
} else {
g2d.setColor(Color.black);
if (marker.getBackground() == null) {
marker.setBackground(ColorBackground.getInstance(Color.black));
}
@ -100,8 +114,6 @@ public class MarkerComboBox extends UIComboBox {
return getPreferredSize();
}
private Marker marker = null;
private boolean isSelected = false;
private void paintTextMarker(Graphics2D g2d, Dimension d, String text) {
g2d.setColor(Color.black);

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java

@ -1,12 +1,9 @@
package com.fr.van.chart.designer.component;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.FRFont;
import com.fr.plugin.chart.type.LineType;
import com.fr.stable.Constants;
@ -14,8 +11,6 @@ import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
@ -37,9 +32,9 @@ public class LineTypeComboBox extends UIComboBox {
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.lineType = (LineType) value;
comp.setText(null);
value = lineType == LineType.NONE ? Toolkit.i18nText("Fine-Design_Report_None") : null;
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
return comp;
}
@ -51,14 +46,6 @@ public class LineTypeComboBox extends UIComboBox {
g2d.setColor(getForeground());
switch (this.lineType) {
case NONE:
FRFont font = FRContext.getDefaultValues().getFRFont();
int resolution = ScreenResolution.getScreenResolution();
Font rfont = font.applyResolutionNP(resolution);
g2d.setFont(rfont);
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
GraphHelper.drawString(g2d, Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent());
break;
case SOLID:
GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2);
break;

39
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.widget.ui;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UIPositiveAndNegativeIntNumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
@ -26,6 +26,8 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class FormMultiWidgetCardPane extends FormWidgetCardPane {
private MultiSelectionArrangement arrangement;
@ -129,20 +131,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
TableLayout.PREFERRED,
TableLayout.FILL
};
UITextField horizontalSpacingNumberField = new UIIntNumberField();
horizontalSpacingNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(horizontalSpacingNumberField.getText(), false);
}
});
UITextField verticalSpacingNumberField = new UIIntNumberField();
verticalSpacingNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(verticalSpacingNumberField.getText(), true);
}
});
UITextField horizontalSpacingNumberField = createIntNumberField(false);
UITextField verticalSpacingNumberField = createIntNumberField(true);
Component[][] components = new Component[][] {
new Component[] {
new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_spacing.png")),
@ -157,6 +147,25 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane);
}
private UIPositiveAndNegativeIntNumberField createIntNumberField(boolean isVertical) {
final UIPositiveAndNegativeIntNumberField intNumberField = new UIPositiveAndNegativeIntNumberField();
intNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(intNumberField.getText(), isVertical);
}
});
intNumberField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
distributionDoChange(intNumberField.getText(), isVertical);
}
}
});
return intNumberField;
}
private void distributionDoChange(String text, boolean isVertical) {
if (StableUtils.isNumber(text)) {
if (isVertical) {

10
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -15,6 +15,8 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.event.Listener;
import com.fr.js.JavaScript;
import com.fr.report.web.util.ReportEngineEventMapping;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -44,6 +46,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
private Listener listener;
JavaScriptActionPane javaScriptActionPane;
public ListenerEditPane() {
this.initComponents(new String[0]);
}
@ -87,7 +91,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 提交入库
List dbManiList = new ArrayList();
dbManiList.add(autoCreateDBManipulationPane());
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.createDefaultJavaScriptActionPane(),
javaScriptActionPane = JavaScriptActionPane.createDefaultJavaScriptActionPane();
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(javaScriptActionPane,
dbManiList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件
@ -176,9 +181,12 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override
public Listener updateBean() {
String actionLocaleName = ReportEngineEventMapping.getLocaleName(listener.getEventName());
javaScriptActionPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WEB_CONFIG, Toolkit.i18nText(actionLocaleName)));
this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean());
return this.listener;
}
}

8
designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java

@ -296,9 +296,15 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
if (toolBarManager.length == 0) {
return;
}
ToolBar resultToolbar = new ToolBar();
for (int i = 0; i < toolBarManager.length; i++) {
toolBarPane.populateBean(toolBarManager[i].getToolBar());
ToolBar toolBar = toolBarManager[i].getToolBar();
for (int j = 0; j < toolBar.getWidgetSize(); j++) {
Widget widget = toolBar.getWidget(j);
resultToolbar.addWidget(widget);
}
}
toolBarPane.populateBean(resultToolbar);
}

9
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

@ -38,6 +38,7 @@ import com.fr.report.web.button.write.AppendColumnRow;
import com.fr.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.Box;
@ -322,6 +323,7 @@ public class EditToolBar extends BasicPane {
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
@ -517,6 +519,8 @@ public class EditToolBar extends BasicPane {
if (javaScriptPane == null || ((CustomToolBarButton) widget).getJSImpl() == null) {
javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, ((Button) widget).getText()));
javaScriptPane.setPreferredSize(new Dimension(750, 500));
BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@ -672,7 +676,8 @@ public class EditToolBar extends BasicPane {
export.setImageAvailable(this.image.isSelected());
if (exportToolBarProviders != null) {
for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].update();;
exportToolBarProviders[i].update();
;
}
}
}
@ -689,6 +694,8 @@ public class EditToolBar extends BasicPane {
if (customToolBarButton.getJSImpl() == null) {
this.javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText()));
customToolBarButton.setJSImpl(this.javaScriptPane.updateBean());
}
}

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

@ -14,7 +14,6 @@ import com.fr.design.widget.ui.BasicWidgetPropertySettingPane;
import com.fr.form.event.Listener;
import com.fr.form.ui.Widget;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -166,7 +165,7 @@ public class CellWidgetCardPane extends BasicPane {
}
widgetPropertyPane.update(widget);
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners();
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(widget);
widget.clearListeners();
for (Listener l : listener) {
widget.addListener(l);

34
designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

@ -1,29 +1,30 @@
package com.fr.design.widget;
import java.lang.reflect.Constructor;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.UIListGroupControlPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListGroupControlPane;
import com.fr.design.gui.frpane.ListenerUpdatePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.JavaScriptActionPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.form.event.Listener;
import com.fr.form.ui.Widget;
import com.fr.grid.selection.Selection;
import com.fr.general.NameObject;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.Commit2DBJavaScript;
import com.fr.stable.AssistUtils;
import com.fr.stable.Nameable;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.*;
import javax.swing.BorderFactory;
import java.lang.reflect.Constructor;
public class WidgetEventPane extends UIListGroupControlPane {
private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1);
@ -32,6 +33,8 @@ public class WidgetEventPane extends UIListGroupControlPane {
private ElementCasePane object;
private Widget targetWidget;
public WidgetEventPane(ElementCasePane pane) {
this.object = pane;
if (pane != null) {
@ -125,14 +128,17 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (widget == null) {
return;
}
this.targetWidget = widget;
refreshPane(widget, EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class));
}
/**
* 更新
*
* @return 监听器
*/
public Listener[] updateListeners() {
public Listener[] updateListeners(Widget widget) {
this.targetWidget = widget;
Nameable[] res = this.update();
Listener[] res_array = new Listener[res.length];
for (int i = 0, len = res.length; i < len; i++) {
@ -181,6 +187,14 @@ public class WidgetEventPane extends UIListGroupControlPane {
}
}
@Override
public void wrapperListener(Listener listener) {
if (listener.getAction() instanceof Commit2DBJavaScript) {
Commit2DBJavaScript commit2DBJavaScript = (Commit2DBJavaScript) listener.getAction();
commit2DBJavaScript.setJsResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName()));
}
}
protected String getWrapperLabelText() {
return Toolkit.i18nText("Fine-Design_Report_Event");
}

Loading…
Cancel
Save