Browse Source

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

feature/big-screen
Maksim 5 years ago
parent
commit
022e0a01a0
  1. 59
      designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  3. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
  4. 77
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  5. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 16
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  7. 41
      designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java
  8. 10
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  9. 9
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  10. 2
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  11. 2
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  12. 45
      designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java
  13. 3
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  14. 30
      designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java
  15. 77
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java
  16. 2
      designer-realize/src/main/java/com/fr/grid/CellElementPainter.java
  17. 8
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  18. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

59
designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java

@ -0,0 +1,59 @@
package com.fr.common.detect;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.web.WebSocketConfig;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/10
*/
public class CommonPortDetector {
private static final CommonPortDetector INSTANCE = new CommonPortDetector();
private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector"));
public static CommonPortDetector getInstance() {
return INSTANCE;
}
public void execute() {
service.submit(new Runnable() {
@Override
public void run() {
detectTomcatPort();
detectWebSocketPort();
}
});
}
private void detectTomcatPort() {
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort();
if (checkPort(port)) {
FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port);
}
}
private void detectWebSocketPort() {
Integer[] ports = WebSocketConfig.getInstance().getPort();
for (int port : ports) {
if (checkPort(port)) {
FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port);
}
}
}
private boolean checkPort(int port) {
try (Socket socket = new Socket("localhost", port)) {
return true;
} catch (Exception e) {
return false;
}
}
}

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -69,7 +69,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper;
if (!ComparatorUtils.equals(tempName, selected.getName())) {
if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
rename(selected.getName(), tempName);
}

11
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java

@ -33,9 +33,16 @@ public class TableDataManagerPane extends LoadingBasicPane {
);
}
tableDataPane = pane == null ? new TableDataPaneListPane() {
public void rename(String oldName, String newName) {
@Override
public void rename(final String oldName, final String newName) {
super.rename(oldName, newName);
renameConnection(oldName, newName);
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() {
renameConnection(oldName, newName);
return null;
}
}.execute();
}
} : pane;
container.add(tableDataPane.getPanel(), BorderLayout.CENTER);

77
designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java

@ -6,6 +6,7 @@ import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
@ -36,20 +37,23 @@ import java.text.SimpleDateFormat;
* @author zhou
* @since 2012-5-24上午10:57:00
*/
public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver {
public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final long serialVersionUID = 724330854437726751L;
private static final int LABLE_X = 4;
private static final int LABLE_Y = 18;
private static final int LABLE_DELTA_WIDTH = 8;
private static final int LABLE_HEIGHT = 15; //标签背景的范围
private static final int LABEL_X = 4;
private static final int LABEL_Y = 18;
private static final int LABEL_DELTA_WIDTH = 8;
private static final int LABEL_HEIGHT = 15; //标签背景的范围
private static final int CURRENCY_FLAG_POINT = 6;
private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0,30,0,0);
private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0, 30, 0, 0);
private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC,
FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT};
private static final Integer[] TYPES = new Integer[]{
FormatContents.NULL, FormatContents.NUMBER,
FormatContents.CURRENCY, FormatContents.PERCENT,
FormatContents.SCIENTIFIC, FormatContents.DATE,
FormatContents.TIME, FormatContents.TEXT};
private static final Integer[] DATETYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME,};
private static final Integer[] DATE_TYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME};
private Format format;
@ -61,7 +65,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
private JPanel centerPane;
private JPanel formatFontPane;
private FRFontPane frFontPane;
private boolean isRightFormate;
private boolean isRightFormat;
private boolean isDate = false;
private GlobalNameListener globalNameListener = null;
@ -78,7 +82,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4));
iniSampleLable();
initSampleLabel();
contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override
public Dimension getPreferredSize() {
@ -108,7 +112,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
frFontPane = new FRFontPane();
UILabel font = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT);
UILabel font = new UILabel(Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT);
JPanel fontPane = new JPanel(new BorderLayout());
fontPane.add(font, BorderLayout.NORTH);
@ -136,7 +140,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{centerPane, null},
new Component[]{fontPane, frFontPane},
};
@ -155,24 +159,24 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
};
}
private void iniSampleLable() {
Border innterborder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);
Font tmpFont = null;
Border border = BorderFactory.createTitledBorder(innterborder, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"), TitledBorder.LEFT, 0, tmpFont, UIConstants.LINE_COLOR);
private void initSampleLabel() {
Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);
String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR);
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) {
@Override
public void paint(Graphics g) {
super.paint(g);
int width = getWidth();
Color orignal = g.getColor();
Color original = g.getColor();
g.setColor(getBackground());
g.fillRect(LABLE_X, LABLE_Y, width - LABLE_DELTA_WIDTH, LABLE_HEIGHT);
g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT);
g.setColor(UIConstants.LINE_COLOR);
FontMetrics cellFM = g.getFontMetrics();
int textWidth = cellFM.stringWidth(getText());
GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26);
g.setColor(orignal);
g.setColor(original);
}
};
sampleLabel.setHorizontalAlignment(UILabel.CENTER);
@ -197,7 +201,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
* @return 标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text");
return Toolkit.i18nText("Fine-Design_Report_Text");
}
/**
@ -212,13 +216,9 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
if (format instanceof CoreDecimalFormat) {
// check all value
String pattern = ((CoreDecimalFormat) format).toPattern();
boolean isCurrency1 = (pattern.length() > 0 && pattern.charAt(0) == '¤');
boolean isCurrency2 = (pattern.length() > 0 && pattern.charAt(0) == '$');
boolean isCurrency = isCurrency1 || isCurrency2;
boolean isCurrency4 = (pattern.length() > CURRENCY_FLAG_POINT && ComparatorUtils.equals(pattern.substring(0, CURRENCY_FLAG_POINT), "#,##0;"));
if (isCurrency || isCurrency4) {
if (isCurrencyFormatStyle(pattern)) {
setPatternComboBoxAndList(FormatContents.CURRENCY, pattern);
} else if (pattern.endsWith("%")) {
} else if (pattern.indexOf("%") > 0) {
setPatternComboBoxAndList(FormatContents.PERCENT, pattern);
} else if (pattern.indexOf("E") > 0) {
setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern);
@ -238,6 +238,17 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
}
}
private boolean isCurrencyFormatStyle(String pattern) {
if (pattern.length() == 0) {
return false;
}
if (pattern.charAt(0) == '¤' || pattern.charAt(0) == '$') {
return true;
}
return pattern.length() > CURRENCY_FLAG_POINT && pattern.startsWith("#,##0;");
}
/**
* 判断是否是数组有模式
@ -273,7 +284,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
if (getFormatContents() == FormatContents.TEXT) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
}
if (isRightFormate) {
if (isRightFormat) {
if (StringUtils.isNotEmpty(patternString)) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
}
@ -292,7 +303,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
this.sampleLabel.setText(FormatField.getInstance().getFormatValue());
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground"));
try {
isRightFormate = true;
isRightFormat = true;
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return;
}
@ -300,7 +311,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
} catch (Exception e) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage());
isRightFormate = false;
isRightFormat = false;
}
}
@ -401,8 +412,8 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
this.isDate = isDate;
this.typeComboBox.setSelectedIndex(0);
if (isDate) {
for (int i = 0; i < DATETYPES.length; i++) {
this.typeComboBox.addItem(DATETYPES[i]);
for (int i = 0; i < DATE_TYPES.length; i++) {
this.typeComboBox.addItem(DATE_TYPES[i]);
}
for (int i = 0; i < TYPES.length; i++) {
this.typeComboBox.removeItemAt(1);
@ -411,7 +422,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
for (int i = 0; i < TYPES.length; i++) {
this.typeComboBox.addItem(TYPES[i]);
}
for (int i = 0; i < DATETYPES.length; i++) {
for (int i = 0; i < DATE_TYPES.length; i++) {
this.typeComboBox.removeItemAt(1);
}
}

7
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -40,6 +40,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.MacOsAddListenerAction;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
@ -316,6 +317,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// window close listener.
this.addWindowListeners(getFrameListeners());
addMacOsListener();
this.addComponentListener(new ComponentAdapter() {
@Override
@ -523,6 +526,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
private void addMacOsListener() {
OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT);
}
protected ArrayList<WindowListener> getFrameListeners() {
ArrayList<WindowListener> arrayList = new ArrayList<>();

16
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -684,21 +684,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
this.dispose();
//模版重命名
boolean success = false;
// 提醒保存文件
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true);
// 只有一个文件未保存时
if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) {
int choose = saveSomeTempaltePane.saveLastOneTemplate();
if (choose != JOptionPane.CANCEL_OPTION) {
success = selectedOperation.rename(fnf, path, newPath);
}
} else {
if (saveSomeTempaltePane.showSavePane()) {
success = selectedOperation.rename(fnf, path, newPath);
}
}
boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) {
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);

41
designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java

@ -0,0 +1,41 @@
package com.fr.design.os.impl;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.support.OSBasedAction;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/13
*/
public class MacOsAddListenerAction implements OSBasedAction {
@Override
public void execute(final Object... objects) {
try {
Class app = Class.forName("com.apple.eawt.Application");
Class handler = Class.forName("com.apple.eawt.QuitHandler");
Object instance = Proxy.newProxyInstance(handler.getClassLoader(), new Class[]{handler},
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method,
Object[] args) throws Throwable {
if ("handleQuitRequestWith".equals(method.getName())) {
DesignerFrame designerFrame = (DesignerFrame) objects[0];
designerFrame.exit();
}
return null;
}
});
Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", instance);
} catch (ClassNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}

10
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -73,6 +73,16 @@ public enum SupportOSImpl implements SupportOS {
public boolean support() {
return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM;
}
},
/**
* mac下dock栏右键退出
*/
DOCK_QUIT {
@Override
public boolean support() {
return OperatingSystem.isMacos();
}
}
}

9
designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java

@ -17,6 +17,7 @@ import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FloatEditor;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -24,6 +25,8 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.ArrayList;
import java.util.Date;
@ -103,6 +106,12 @@ public class ParameterInputPane extends BasicPane {
contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane));
//add editor to parameter hashtable.
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
this.editorNameMap.put(textF, parameter.getName());
nameAddedList.add(parameter.getName());
}

2
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -701,7 +701,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
}
jobs = new NameSubmitJob[dmlConfig.getSubmitJobCount()];
for (int i = 0; i < jobs.length; i++) {
jobs[i] = dmlConfig.getSubmitJob(i);
jobs[i] = dmlConfig.getNameSubmitJob(i);
}
condition = dmlConfig.getCondition();
UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected());

2
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -3,6 +3,7 @@
*/
package com.fr.start;
import com.fr.common.detect.CommonPortDetector;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus;
@ -76,6 +77,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
public void on(Event event, Null param) {
EventDispatcher.stopListen(this);
collectUserInformation();
CommonPortDetector.getInstance().execute();
}
});
}

45
designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java

@ -0,0 +1,45 @@
package com.fr.common.detect;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import junit.framework.TestCase;
import org.junit.Assert;
import java.io.IOException;
import java.net.ServerSocket;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/10
*/
public class CommonPortDetectorTest extends TestCase {
private ServerSocket serverSocket;
@Override
public void setUp() throws Exception {
serverSocket = new ServerSocket(55555);
new Thread(new Runnable() {
@Override
public void run() {
try {
serverSocket.accept();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}).start();
}
public void testCheckPort() {
CommonPortDetector detector = CommonPortDetector.getInstance();
boolean access = Reflect.on(detector).call("checkPort", 55555).get();
Assert.assertTrue(access);
}
@Override
public void tearDown() throws Exception {
serverSocket.close();
}
}

3
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -5,6 +5,7 @@ import com.fr.base.PaperSize;
import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.actions.FormMobileAttrAction;
import com.fr.design.actions.TemplateParameterAction;
@ -12,6 +13,7 @@ import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.export.EmbeddedFormExportExportAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction;
@ -587,6 +589,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable);
}
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}

30
designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java

@ -9,9 +9,13 @@ import com.fr.general.GeneralUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StableUtils;
import java.awt.*;
public class NewPresentAction extends PresentCheckBoxAction {
private String itemName = null;
@ -28,10 +32,28 @@ public class NewPresentAction extends PresentCheckBoxAction {
if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) {
CellElementPropertyPane.getInstance().GoToPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Present"), this.itemName);
} else {
TemplateCellElement ce = getSelectedCellElement();
// 只有原来ce设置了形态的情况下才有undo操作
if (ce != null && ce.getPresent() != null) {
ce.setPresent(null);
ElementCasePane ePane = this.getEditingComponent();
TemplateElementCase elementCase = ePane.getEditingElementCase();
Selection sel = ePane.getSelection();
if (sel instanceof CellSelection) {
CellSelection cs = (CellSelection) sel;
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x;
int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement);
} else if (cellElement.getPresent() != null) {
cellElement.setPresent(null);
}
}
}
}
return true;
} else {
return false;

77
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java

@ -1,22 +1,18 @@
package com.fr.design.mainframe.messagecollect.solid;
import com.fr.analysis.cloud.solid.SolidRecordExecutor;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.security.JwtUtils;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.CommonUtils;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants.REQUEST_SUBJECT;
import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants.TIME_OUT;
/**
* 设计器固化信息回传类
* Created by alex sung on 2019/8/22.
@ -24,9 +20,6 @@ import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants
public class SolidCollector {
private static final String CONTENT_URL = "/v10/collect/solid";
private static final String DELETE_URL = "/v10/collect/solid/delete";
private static final String UNLOCK_URL = "/v10/collect/solid/unlock";
private static final String ATTR_CIPHER_TEXT = "cipherText";
private static final String ATTR_SIGNATURE = "signature";
private static final String SOLID_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.solid");
@ -53,27 +46,22 @@ public class SolidCollector {
}
FineLoggerFactory.getLogger().info("start to get solid content from server...");
try {
String content = requestContent();
if (StringUtils.isNotEmpty(content)) {
String cipherText = JSONFactory.createJSON(JSON.OBJECT, content).optString("data");
if(StringUtils.isNotEmpty(cipherText)){
Map<String, Object> params = new HashMap<>();
params.put(ATTR_CIPHER_TEXT, cipherText);
params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature()));
HttpToolbox.post(SOLID_UPLOAD_URL, params);
String cipherText = requestContent();
if (StringUtils.isNotEmpty(cipherText)) {
Map<String, Object> params = new HashMap<>();
params.put(ATTR_CIPHER_TEXT, cipherText);
params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature()));
HttpToolbox.post(SOLID_UPLOAD_URL, params);
String deleteUrl = WorkContext.getCurrent().getPath() + DELETE_URL;
HttpToolbox.post(deleteUrl, getParams());
}
deleteSolidFile();
}
FineLoggerFactory.getLogger().info("send solid content to cloud center success.");
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage(), e);
} finally {
String unlockUrl = WorkContext.getCurrent().getPath() + UNLOCK_URL;
try {
HttpToolbox.post(unlockUrl, getParams());
} catch (IOException e) {
unlockSolidFile();
} catch (Exception e) {
FineLoggerFactory.getLogger().warn(e.getMessage(), e);
}
}
@ -81,17 +69,42 @@ public class SolidCollector {
/**
* 获取服务端固化文件内容
*
* @return 回传内容
*/
public String requestContent() throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put("token", JwtUtils.createDefaultJWT(REQUEST_SUBJECT, TIME_OUT));
return HttpToolbox.get(WorkContext.getCurrent().getPath() + CONTENT_URL, params);
private String requestContent() throws Exception {
return WorkContext.getCurrent().get(SolidRecordExecutor.class, new ExceptionHandler<String>() {
@Override
public String callHandler(RPCInvokerExceptionInfo info) {
FineLoggerFactory.getLogger().error(info.getException().getMessage(), info.getException());
return StringUtils.EMPTY;
}
}).feedBackTask(StringUtils.EMPTY);
}
private Map<String, Object> getParams() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("token", JwtUtils.createDefaultJWT(REQUEST_SUBJECT, TIME_OUT));
return params;
/**
* 删除服务端固化文件
*/
private void deleteSolidFile() throws Exception {
WorkContext.getCurrent().get(SolidRecordExecutor.class, new ExceptionHandler<Void>() {
@Override
public Void callHandler(RPCInvokerExceptionInfo info) {
FineLoggerFactory.getLogger().error(info.getException().getMessage(), info.getException());
return null;
}
}).deleteSolidFile();
}
/**
* unlock
*/
private void unlockSolidFile() throws Exception {
WorkContext.getCurrent().get(SolidRecordExecutor.class, new ExceptionHandler<Void>() {
@Override
public Void callHandler(RPCInvokerExceptionInfo info) {
FineLoggerFactory.getLogger().error(info.getException().getMessage(), info.getException());
return null;
}
}).unlockSolidFile();
}
}

2
designer-realize/src/main/java/com/fr/grid/CellElementPainter.java

@ -9,7 +9,7 @@ import com.fr.report.core.PaintUtils;
import com.fr.report.elementcase.ElementCase;
public class CellElementPainter {
public void paintBackground(Graphics2D g2d, ElementCase report, CellElement ce, int width, int height) {
public void paintBackground(Graphics2D g2d, ElementCase report, CellElement ce, double width, double height) {
Style.paintBackground(g2d, ce.getStyle(), width, height);
}

8
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -497,12 +497,12 @@ public class GridUI extends ComponentUI {
paintCellElementRectangleList.add(this.tmpRectangle.clone());
int cellWidth = (int) this.tmpRectangle.getWidth();
int cellHeight = (int) this.tmpRectangle.getHeight();
double cellWidth = this.tmpRectangle.getWidth();
double cellHeight = this.tmpRectangle.getHeight();
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight);
painter.paintContent(g2d, report, tmpCellElement, cellWidth, cellHeight, resolution);
painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1);
painter.paintContent(g2d, report, tmpCellElement, (int) cellWidth, (int) cellHeight, resolution);
// denny_Grid: 注意下面还要减一, 因为上面translate时加一
g2d.translate(-this.tmpRectangle.getX() - 1, -this.tmpRectangle.getY() - 1);
paintAuthorityCell(g2d, tmpCellElement);

5
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -24,6 +24,7 @@ import com.fr.record.analyzer.Metrics;
import com.fr.stable.BuildContext;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.DesignerProcessType;
import com.fr.start.OemHandler;
import com.fr.start.ServerStarter;
@ -91,6 +92,10 @@ public class DesignerStartup extends Activator {
}
};
dialog.setVisible(true);
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId(),
DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage(),
StringUtils.EMPTY);
FineLoggerFactory.getLogger().error(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId() + ": " + DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage());
}
DesignerExiter.getInstance().execute();
return;

Loading…
Cancel
Save