Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~plough/10-design into release/10.0

master
plough 7 years ago
parent
commit
3befb0d8ea
  1. 10
      designer-base/src/com/fr/design/DesignerEnvManager.java
  2. 14
      designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java
  3. 3
      designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java
  4. 7
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 30
      designer-realize/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  6. 88
      designer-realize/src/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  7. 5
      designer-realize/src/com/fr/design/webattr/WriteToolBarPane.java
  8. 5
      designer-realize/src/com/fr/design/webattr/WriteWebSettingPane.java
  9. 6
      designer-realize/src/com/fr/design/widget/WidgetEventPane.java
  10. 3
      designer-realize/src/com/fr/start/module/DesignerActivator.java

10
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -35,10 +35,12 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.AuthException;
import javax.swing.*; import javax.swing.SwingWorker;
import javax.swing.SwingWorker.StateValue; import javax.swing.SwingWorker.StateValue;
import java.awt.*; import java.awt.Color;
import java.awt.Rectangle;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
@ -530,7 +532,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (isCurrentEnvDefault()) { if (isCurrentEnvDefault()) {
return; return;
} }
try {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig())); WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()));
} catch (AuthException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
/** /**

14
designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java

@ -10,7 +10,6 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.TemplatePane;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
@ -20,6 +19,8 @@ import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.AuthException;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -103,7 +104,16 @@ public class SwitchExistEnv extends MenuDef {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
final String envName = getName(); final String envName = getName();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() { Workspace workspace;
try {
workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
} catch (AuthException exception) {
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"}));
return;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override @Override
public void success() { public void success() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName); DesignerEnvManager.getEnvManager().setCurEnvName(envName);

3
designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -2,6 +2,7 @@ package com.fr.design.env;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.AuthException;
import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceClient;
/** /**
@ -9,7 +10,7 @@ import com.fr.workspace.connect.WorkspaceClient;
*/ */
public class DesignerWorkspaceGenerator { public class DesignerWorkspaceGenerator {
public static Workspace generate(DesignerWorkspaceInfo config) { public static Workspace generate(DesignerWorkspaceInfo config) throws AuthException {
if (config == null || config.getType() == null) { if (config == null || config.getType() == null) {
return null; return null;

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

@ -719,7 +719,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
Workspace workspace = WorkContext.getCurrent(); Workspace workspace = WorkContext.getCurrent();
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
defaultTitleSB.append(info.getName()).append("@").append(envName).append("[").append(workspace.getDescription()).append("]");
String username = null;
if (info != null){
username = info.getName();
}
defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]");
if (editingTemplate != null) { if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath(); String path = editingTemplate.getEditingFILE().getPath();
if (!editingTemplate.getEditingFILE().exists()) { if (!editingTemplate.getEditingFILE().exists()) {

30
designer-realize/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -131,6 +131,36 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
} }
public void update(Selection selection) {
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) {
return;
}
final CellSelection finalCS = (CellSelection) selection;
final TemplateElementCase tplEC = ePane.getEditingElementCase();
final Widget cellWidget = cellEditorDefPane.update();
if(finalCS.isSelectedOneCell(ePane)){
if(tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow())== null){//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement);
}
setCellWidget(cellWidget, cellElement);
}else{
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
// p:最后把这个cellEditorDef设置到CellGUIAttr.
TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement;
try {
setCellWidget((Widget)cellWidget.clone(), templateCellElement);
} catch (CloneNotSupportedException e) {
FRContext.getLogger().error("InternalError: " + e.getMessage());
}
}
});
}
if(DesignerContext.getDesignerFrame().getSelectedJTemplate() != null){
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
}
private void setCellWidget(Widget cellWidget, TemplateCellElement cellElement){ private void setCellWidget(Widget cellWidget, TemplateCellElement cellElement){
if (cellWidget instanceof NoneWidget) { if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null); cellElement.setWidget(null);

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

@ -0,0 +1,88 @@
package com.fr.design.mainframe.socketio;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.third.guava.base.Optional;
import com.fr.third.guava.primitives.Ints;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient;
import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
public class DesignerSocketIO {
private static Optional<Socket> socketIO = Optional.absent();
private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override
public void call(Object... objects) {
try {
LogRecordTime[] logRecordTimes = LogUtils.readXMLLogRecords(new ByteArrayInputStream((byte[]) objects[0]));
for (LogRecordTime logRecordTime : logRecordTimes) {
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
};
public static void close() {
if (socketIO.isPresent()) {
socketIO.get().close();
socketIO = Optional.absent();
}
}
public static void update() {
Workspace current = WorkContext.getCurrent();
if (current.isLocal()) {
return;
}
try {
String uri = getSocketUri(current);
socketIO = Optional.of(IO.socket(new URI(uri)));
socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog);
socketIO.get().connect();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static String getSocketUri(Workspace current) throws IOException {
URL url = new URL(current.getPath());
int port = getPort(current);
return String.format("http://%s:%s%s?%s=%s",
url.getHost(),
port,
WorkspaceConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
RemoteCallClient.getInstance().getToken());
}
private static int getPort(Workspace current) throws IOException {
String url = current.getPath() + WorkspaceConstants.CONTROLLER_PREFIX + WorkspaceConstants.CONTROLLER_SOCKETIO_PORT;
try {
String portStr = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(portStr);
return Ints.tryParse(jsonObject.optString("data"));
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
}

5
designer-realize/src/com/fr/design/webattr/WriteToolBarPane.java

@ -155,7 +155,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
webContent = new WebWrite(); webContent = new WebWrite();
} }
WebWrite webWrite = (WebWrite) webContent; WebWrite webWrite = (WebWrite) webContent;
if (webWrite.getSelectedColor() != null) { if (webWrite.isEditRowColor()) {
colorBox.setSelected(true); colorBox.setSelected(true);
colorButton.setColor(webWrite.getSelectedColor()); colorButton.setColor(webWrite.getSelectedColor());
} else { } else {
@ -205,9 +205,10 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
} }
if (colorBox.isSelected()) { if (colorBox.isSelected()) {
webWrite.setEditRowColor(true);
webWrite.setSelectedColor(colorButton.getColor()); webWrite.setSelectedColor(colorButton.getColor());
} else { } else {
webWrite.setSelectedColor(null); webWrite.setEditRowColor(false);
} }
webWrite.setUnloadCheck(unloadCheck.isSelected()); webWrite.setUnloadCheck(unloadCheck.isSelected());

5
designer-realize/src/com/fr/design/webattr/WriteWebSettingPane.java

@ -120,7 +120,7 @@ public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
if (webWrite == null) { if (webWrite == null) {
webWrite = new WebWrite(); webWrite = new WebWrite();
} }
if (webWrite.getSelectedColor() != null) { if (webWrite.isEditRowColor()) {
colorBox.setSelected(true); colorBox.setSelected(true);
colorButton.setColor(webWrite.getSelectedColor()); colorButton.setColor(webWrite.getSelectedColor());
} else { } else {
@ -148,9 +148,10 @@ public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
protected WebWrite updateSubWebSettingBean() { protected WebWrite updateSubWebSettingBean() {
WebWrite webWrite = new WebWrite(); WebWrite webWrite = new WebWrite();
if (colorBox.isSelected()) { if (colorBox.isSelected()) {
webWrite.setEditRowColor(true);
webWrite.setSelectedColor(colorButton.getColor()); webWrite.setSelectedColor(colorButton.getColor());
} else { } else {
webWrite.setSelectedColor(null); webWrite.setEditRowColor(false);
} }
if (topRadioButton.isSelected()) { if (topRadioButton.isSelected()) {
webWrite.setSheetPosition(Constants.TOP); webWrite.setSheetPosition(Constants.TOP);

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

@ -18,6 +18,7 @@ import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
@ -34,9 +35,12 @@ import javax.swing.*;
public class WidgetEventPane extends ObjectUIControlPane { public class WidgetEventPane extends ObjectUIControlPane {
private Selection selection;
public WidgetEventPane(ElementCasePane pane) { public WidgetEventPane(ElementCasePane pane) {
super(pane); super(pane);
this.setNameListEditable(false); this.setNameListEditable(false);
selection = pane.getSelection();
setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0)); setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
} }
@ -57,7 +61,7 @@ public class WidgetEventPane extends ObjectUIControlPane {
@Override @Override
public void saveSettings() { public void saveSettings() {
CellWidgetPropertyPane.getInstance().update(); CellWidgetPropertyPane.getInstance().update(selection);
} }
@Override @Override

3
designer-realize/src/com/fr/start/module/DesignerActivator.java

@ -50,6 +50,7 @@ import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.loghandler.DesignerLogImpl; import com.fr.design.mainframe.loghandler.DesignerLogImpl;
import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.ParameterPropertyPane;
@ -123,6 +124,7 @@ public class DesignerActivator extends Activator implements Prepare {
designerModuleStart(); designerModuleStart();
preLoadPane(); preLoadPane();
loadLogAppender(); loadLogAppender();
DesignerSocketIO.update();
} }
private void loadLogAppender() { private void loadLogAppender() {
@ -400,6 +402,7 @@ public class DesignerActivator extends Activator implements Prepare {
@Override @Override
public void stop() { public void stop() {
unloadLogAppender(); unloadLogAppender();
DesignerSocketIO.close();
} }
@Override @Override

Loading…
Cancel
Save