Browse Source

Merge branch 'feature/big-screen' of ssh://code.fineres.com:7999/~zheng/C-design into feature/big-screen

feature/10.0
shine 3 years ago
parent
commit
f78f1c8c82
  1. 3
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 8
      designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 13
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  5. 7
      designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java
  6. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  7. 18
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  8. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  9. 18
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  10. 5
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  11. 6
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  12. 84
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  13. 86
      designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

3
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -390,9 +390,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
File envHome = new File(userHome + File.separator + "." + ProductConstants.APP_NAME + version);
if (!envHome.exists()) {
StableUtils.mkdirs(envHome);
}
return envHome.getAbsolutePath();
}

8
designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java

@ -12,6 +12,9 @@ import java.awt.Toolkit;
* Number Field.
*/
public class EditTextField extends UIGridTextField {
private static final String I18NProperty = "i18n";
private int maxLength = 24;
public EditTextField() {
@ -38,7 +41,11 @@ public class EditTextField extends UIGridTextField {
}
class TextDocument extends PlainDocument {
private Object defaultI18NProperty;
public TextDocument() {
defaultI18NProperty = getProperty(I18NProperty);
}
@Override
@ -48,6 +55,7 @@ public class EditTextField extends UIGridTextField {
Toolkit.getDefaultToolkit().beep();
return;
}
putProperty(I18NProperty, defaultI18NProperty);
super.insertString(offset, s, a);
}
}

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

@ -47,6 +47,7 @@ import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
@ -1071,7 +1072,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public boolean isOldDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isHigherThanCurrent(xmlDesignerVersion)) {
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", StringUtils.parseVersion(xmlDesignerVersion));
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
return true;

13
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -425,4 +425,17 @@ public class DesignUtils {
return true;
}
/**
* FR25.0版本出来需要进行适配下
*
* @param xmlDesignerVersion
* @return
*/
public static String parseVersion(String xmlDesignerVersion) {
if (StringUtils.isNotEmpty(xmlDesignerVersion)) {
return String.valueOf(xmlDesignerVersion.charAt(0) - 'A');
}
return xmlDesignerVersion;
}
}

7
designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java

@ -3,6 +3,7 @@ package com.fr.design.utils;
import com.fr.general.ComparatorUtils;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.net.ServerSocket;
@ -29,4 +30,10 @@ public class DesignUtilsTest extends TestCase {
assertTrue(DesignUtils.isPortOccupied());
}
@Test
public void testParseVersion() {
Assert.assertEquals("10", DesignUtils.parseVersion("KAA"));
Assert.assertEquals("11", DesignUtils.parseVersion("LAA"));
}
}

7
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -221,6 +221,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
String lastPlotID = chart.getID();
boolean chartTypeChange = false;
try {
AbstractChartTypePane selectedPane = (AbstractChartTypePane) getSelectedPane();
ChartProvider newDefaultChart = (ChartProvider) ChartTypeManager.getInstanceWithCheck().getCharts(selectedPane.getPlotID())[0].clone();
@ -230,13 +231,16 @@ public class ChartTypePane extends AbstractChartAttrPane {
editingCollection.removeNameObject(editingCollection.getSelectedIndex());
editingCollection.addChart(newDefaultChart);
chart = newDefaultChart;
chartTypeChange = true;
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
//这一步会替换plot
String id = chart.getID();
((AbstractChartTypePane) getSelectedPane()).updateBean(chart);
if (inForm) {
chartTypeChange = chartTypeChange || !ComparatorUtils.equals(id, chart.getID());
if (inForm && chartTypeChange) {
chart.resetAttrInForm();
}
reLayoutEditPane(chart, lastPlotID);
@ -464,5 +468,6 @@ public class ChartTypePane extends AbstractChartAttrPane {
public void registerChartEditPane(ChartEditPane currentEditPane) {
this.editPane = currentEditPane;
this.inForm = editPane.isInForm();
buttonPane.refreshChartInForm(inForm);
}
}

18
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -799,10 +799,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer);
popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog());
popup.setRelativeBounds(bounds);
try {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer);
boolean needShowing = selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog();
// 当不可见时,且可以设置为可见状态,才去设置为可见
// 避免已经是可见状态时,重复设置可见,造成闪屏
if (!popup.isVisible() && needShowing) {
popup.setVisible(true);
} else if (!needShowing) {
popup.setVisible(false);
}
popup.setRelativeBounds(bounds);
} catch (Exception ignored) {
}
}
});
}

3
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -321,9 +321,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
FormDesigner designer = editingMouseListener.getDesigner();
if (e.getButton() == MouseEvent.BUTTON1 &&
(e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)) {
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e);
//切换设计器
designer.switchTab(component);
designer.switchTab(this);
}
}

18
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -34,6 +34,7 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import javax.swing.BorderFactory;
@ -645,16 +646,15 @@ public class EditingMouseListener extends MouseInputAdapter {
selectionModel.selectACreatorAtMouseEvent(e);
refreshTopXCreator();
XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators();
// 放到事件队尾执行
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (XCreator xCreator : xCreators) {
xCreator.setSelected(!e.isShiftDown() && !e.isControlDown());
if (ArrayUtils.getLength(xCreators) == 1) {
// 放到事件队尾执行
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
xCreators[0].setSelected(!e.isShiftDown() && !e.isControlDown());
}
}
});
});
}
} else if (clickedNonCardButton && uneditedTab && responseTabLayout(oldCreator, e)) {
// do nothing
} else {

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

@ -182,7 +182,10 @@ 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)));
JavaScriptResourceInfo.PathNode pathNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.WEB_CONFIG, Toolkit.i18nText(actionLocaleName));
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo().addFirstPathNode(pathNode);
javaScriptActionPane.setResourceInfo(javaScriptResourceInfo);
this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean());

6
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -156,11 +156,15 @@ public class DesignerSocketIO {
private static String[] getSocketUri() throws IOException {
Workspace current = WorkContext.getCurrent();
URL url = new URL(current.getPath());
Integer[] ports = current.get(SocketInfoOperator.class).getPort();
Integer[] ports = WebSocketConfig.getInstance().getAvailablePorts();
WorkspaceConnection connection = current.getConnection();
// 服务器配置https webSocket可能是wss也可能是ws webSocket的协议可以单独配置
WebSocketProtocol webSocketProtocol = WebSocketConfig.getInstance().getProtocol();
currentProtocol = webSocketProtocol == WebSocketProtocol.PLAIN ? HTTP : HTTPS;
if (WebSocketConfig.getInstance().isUsingProxy()) {
// 如果配置了代理服务器跟随服务器协议
currentProtocol = url.getProtocol();
}
String[] result = new String[ports.length];
for (int i = 0; i < ports.length; i++) {
result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s",

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

@ -519,7 +519,10 @@ 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()));
JavaScriptResourceInfo.PathNode pathNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.WIDGET, ((Button) widget).getText());
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo().addFirstPathNode(pathNode);
javaScriptPane.setResourceInfo(javaScriptResourceInfo);
javaScriptPane.setPreferredSize(new Dimension(750, 500));
BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this));
@ -539,27 +542,28 @@ public class EditToolBar extends BasicPane {
}
};
/**
* 更新
* @param widget 对应组件
*/
public void populate(Widget widget) {
this.widget = widget;
card.show(centerPane, "none");
if (widget instanceof Button) {
populateDefault();
}
if (widget instanceof Export) {
populateExport();
} else if (widget instanceof AppendColumnRow) {
populateAppendColumnRow();
} else if (widget instanceof Submit) {
populateSubmit();
} else if (widget instanceof CustomToolBarButton) {
populateCustomToolBarButton();
} else if (widget instanceof Email) {
populateEmail();
}
/**
* 更新
*
* @param widget 对应组件
*/
public void populate(Widget widget) {
this.widget = widget;
card.show(centerPane, "none");
if (widget instanceof Button) {
populateDefault();
}
if (widget instanceof Export) {
populateExport();
} else if (widget instanceof AppendColumnRow) {
populateAppendColumnRow();
} else if (widget instanceof Submit) {
populateSubmit();
} else if (widget instanceof CustomToolBarButton) {
populateCustomToolBarButton();
} else if (widget instanceof Email) {
populateEmail();
}
Set<ExtraButtonToolBarProvider> extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG);
for (ExtraButtonToolBarProvider provider : extraButtonSet) {
@ -572,21 +576,22 @@ public class EditToolBar extends BasicPane {
count.setValue(((AppendColumnRow) widget).getCount());
}
private void populateExport(){
card.show(centerPane, "export");
Export export = (Export) widget;
this.pdf.setSelected(export.isPdfAvailable());
this.excelP.setSelected(export.isExcelPAvailable());
this.excelO.setSelected(export.isExcelOAvailable());
this.excelS.setSelected(export.isExcelSAvailable());
this.word.setSelected(export.isWordAvailable());
this.image.setSelected(export.isImageAvailable());
if(exportToolBarProviders != null){
for(int i=0; i<exportToolBarProviders.length; i++){
exportToolBarProviders[i].populate();;
}
}
}
private void populateExport() {
card.show(centerPane, "export");
Export export = (Export) widget;
this.pdf.setSelected(export.isPdfAvailable());
this.excelP.setSelected(export.isExcelPAvailable());
this.excelO.setSelected(export.isExcelOAvailable());
this.excelS.setSelected(export.isExcelSAvailable());
this.word.setSelected(export.isWordAvailable());
this.image.setSelected(export.isImageAvailable());
if (exportToolBarProviders != null) {
for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].populate();
;
}
}
}
private void populateEmail() {
card.show(centerPane, EMAIL);
@ -694,7 +699,10 @@ public class EditToolBar extends BasicPane {
if (customToolBarButton.getJSImpl() == null) {
this.javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText()));
JavaScriptResourceInfo.PathNode pathNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText());
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo().addFirstPathNode(pathNode);
javaScriptPane.setResourceInfo(javaScriptResourceInfo);
customToolBarButton.setJSImpl(this.javaScriptPane.updateBean());
}

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

@ -55,29 +55,31 @@ public class WidgetEventPane extends UIListGroupControlPane {
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class)
};
};
}
@Override
public void saveSettings() {
@Override
public void saveSettings() {
CellWidgetPropertyPane.getInstance().update(selection);
}
@Override
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event");
}
public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane {
private ElementCasePane epane;
private ElementCasePane epane;
// 反射会用到
public WidgetEventListenerUpdatePane() {
this(null);
}
public WidgetEventListenerUpdatePane(ElementCasePane epane){
this.epane = epane;
super.initComponents();
}
public WidgetEventListenerUpdatePane(ElementCasePane epane) {
this.epane = epane;
super.initComponents();
}
/**
* 根据有无单元格创建 DBManipulationPane
@ -88,41 +90,41 @@ public class WidgetEventPane extends UIListGroupControlPane {
return jTemplate.createDBManipulationPaneInWidget();
}
@Override
protected JavaScriptActionPane createJavaScriptActionPane() {
return new JavaScriptActionPane() {
@Override
protected JavaScriptActionPane createJavaScriptActionPane() {
return new JavaScriptActionPane() {
@Override
protected DBManipulationPane createDBManipulationPane() {
if(epane == null && DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
return autoCreateDBManipulationInWidgetEventPane();
}
@Override
protected DBManipulationPane createDBManipulationPane() {
if (epane == null && DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
return autoCreateDBManipulationInWidgetEventPane();
}
return new SmartInsertDBManipulationInWidgetEventPane(epane);
}
return new SmartInsertDBManipulationInWidgetEventPane(epane);
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Callback_Function");
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Callback_Function");
}
@Override
protected boolean isForm() {
return false;
}
@Override
protected boolean isForm() {
return false;
}
protected String[] getDefaultArgs() {
return new String[0];
}
};
}
protected String[] getDefaultArgs() {
return new String[0];
}
};
}
@Override
protected boolean supportCellAction() {
return false;
}
@Override
protected boolean supportCellAction() {
return false;
}
}
}
public void populate(Widget widget) {
if (widget == null) {
@ -191,7 +193,13 @@ public class WidgetEventPane extends UIListGroupControlPane {
public void wrapperListener(Listener listener) {
if (listener.getAction() instanceof Commit2DBJavaScript) {
Commit2DBJavaScript commit2DBJavaScript = (Commit2DBJavaScript) listener.getAction();
commit2DBJavaScript.setJsResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName()));
JavaScriptResourceInfo.PathNode widgetNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName());
JavaScriptResourceInfo.PathNode EventNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.EVENT, listener.getName());
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo()
.addFirstPathNode(EventNode)
.addFirstPathNode(widgetNode);
commit2DBJavaScript.setJsResourceInfo(javaScriptResourceInfo);
}
}

Loading…
Cancel
Save