forked from fanruan/design
Browse Source
* commit '3d8ece2c7ff736201019eec8fe0e333b940d68ec': (28 commits) KERNEL-418 更新升级重构 KERNEL-418 更新升级重构 MOBILE-23325 【单选按钮样式】图文按钮:上传图片后,移动端图片显示很模糊 KERNEL-418 更新升级重构 无jira任务,sonar问题修复 无jira任务,sonar问题修复 KERNEL-418 更新升级重构 KERNEL-418 更新升级重构 CHART-10233 插件超链 CHART-10233 CHART-10233 超链面板 CHART-10233 代码质量 KERNEL-418 更新升级重构 KERNEL-418 更新升级重构 CHART-10233 代码质量 CHART-10233 超链面板 REPORT-21689 水印密度最小值限制,根据交互提供的内容补充 REPORT-21689 水印密度最小值限制,根据交互提供的内容补充 KERNEL-418 更新升级重构 KERNEL-418 更新升级重构 ...persist/11.0
Wim.Zhai
5 years ago
29 changed files with 986 additions and 569 deletions
@ -0,0 +1,79 @@
|
||||
package com.fr.design.update.actions; |
||||
|
||||
import com.fr.decision.update.backup.Recover; |
||||
import com.fr.decision.update.data.UpdateConstants; |
||||
import com.fr.decision.update.exception.UpdateException; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.CommonUtils; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.project.ProjectConstants; |
||||
import com.fr.workspace.WorkContext; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author Bryant |
||||
* @version 10.0 |
||||
* Created by Bryant on 2019-10-09 |
||||
*/ |
||||
public class RecoverForDesigner implements Recover { |
||||
|
||||
@Override |
||||
public boolean recover() { |
||||
try{ |
||||
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNERBACKUPPATH), |
||||
StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME)); |
||||
return true; |
||||
} catch (IOException ignore) { |
||||
FineLoggerFactory.getLogger().error("Recover error for designer"); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean backup() { |
||||
String installHome = StableUtils.getInstallHome(); |
||||
//jar包备份文件的目录为"backup/"+jar包当前版本号
|
||||
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, (GeneralUtils.readBuildNO())); |
||||
backupFilesFromInstallEnv(todayBackupDir); |
||||
backupFilesFromInstallLib(installHome, todayBackupDir); |
||||
try { |
||||
File file = new File(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOADPATH)); |
||||
CommonUtils.mkdirs(file); |
||||
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME), |
||||
StableUtils.pathJoin(installHome, UpdateConstants.DESIGNERBACKUPPATH)); |
||||
return true; |
||||
}catch (IOException e) { |
||||
UpdateException exception = new UpdateException("Backup Exception for designer" + e.getMessage()); |
||||
FineLoggerFactory.getLogger().error(exception.getMessage(),exception); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
private void backupFilesFromInstallEnv(String todayBackupDir) { |
||||
try { |
||||
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH))); |
||||
IOUtils.copyFilesInDirByPath( |
||||
StableUtils.pathJoin(WorkContext.getCurrent().getPath(),ProjectConstants.LIB_NAME), |
||||
StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH)); |
||||
} catch (IOException e) { |
||||
UpdateException exception = new UpdateException(e.getMessage()); |
||||
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in env failed"); |
||||
} |
||||
} |
||||
|
||||
private void backupFilesFromInstallLib(String installHome, String todayBackupDir) { |
||||
try { |
||||
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH))); |
||||
IOUtils.copyFilesInDirByPath( |
||||
StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME), |
||||
StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH)); |
||||
} catch (IOException e) { |
||||
UpdateException exception = new UpdateException(e.getMessage()); |
||||
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in install failed"); |
||||
} |
||||
} |
||||
} |
@ -1,60 +0,0 @@
|
||||
package com.fr.design.update.domain; |
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/21. |
||||
*/ |
||||
|
||||
|
||||
import java.awt.Color; |
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 更新升级的常量 |
||||
*/ |
||||
public interface UpdateConstants { |
||||
|
||||
String APPS_FOLDER_NAME = "webapps"; |
||||
|
||||
int CONNECTION_TIMEOUT = 1000 * 5; |
||||
Color BAR_COLOR = new Color(0x3384F0); |
||||
|
||||
String CHANGELOG_X_START = "2018-07-11"; |
||||
|
||||
String DEFAULT_APP_NAME = "FineReport"; |
||||
String DOWNLOAD_DIR = "update"; |
||||
String DESIGNER_BACKUP_DIR = "designerbackup"; |
||||
|
||||
String UPDATE_CACHE_CONFIG_X = "updateCacheConfig10"; |
||||
String UPDATE_CACHE_INFO_X = "updateCacheInfo10"; |
||||
|
||||
|
||||
int BYTE = 153600; |
||||
|
||||
List<String> JARS_FOR_SERVER_X = Collections.unmodifiableList(Arrays.asList(new String[]{ |
||||
"fine-activator-10.0.jar", |
||||
"fine-core-10.0.jar", |
||||
"fine-report-engine-10.0.jar", |
||||
"fine-decision-10.0.jar", |
||||
"fine-decision-report-10.0.jar", |
||||
"fine-schedule-10.0.jar", |
||||
"fine-schedule-report-10.0.jar", |
||||
"fine-swift-log-adaptor-10.0.jar", |
||||
"fine-webui-10.0.jar", |
||||
"fine-datasource-10.0.jar", |
||||
"fine-third-10.0.jar", |
||||
"fine-accumulator-10.0.jar" |
||||
})); |
||||
|
||||
List<String> JARS_FOR_DESIGNER_X = Collections.unmodifiableList(Arrays.asList(new String[]{ |
||||
"fine-report-designer-10.0.jar", |
||||
"aspectjrt.jar" |
||||
})); |
||||
|
||||
|
||||
List<String> LOG_TYPE = Collections.unmodifiableList(Arrays.asList(new String[]{ |
||||
"REPORT", "MOBILE", "CHART", "PFC", "BI" |
||||
})); |
||||
|
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.update.ui.dialog; |
||||
|
||||
import com.fr.design.RestartHelper; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StableUtils; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
public class RestoreResultDialogTest { |
||||
|
||||
@Test |
||||
public void testDeletePreviousPropertyFile() { |
||||
File moveFile = new File(RestartHelper.MOVE_FILE); |
||||
File recordFile = new File(RestartHelper.RECORD_FILE); |
||||
try { |
||||
StableUtils.makesureFileExist(moveFile); |
||||
StableUtils.makesureFileExist(recordFile); |
||||
Assert.assertTrue(RestoreResultDialog.deletePreviousPropertyFile()); |
||||
} catch (IOException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(),e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,207 @@
|
||||
package com.fr.design.chartx.component; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.chart.web.ChartHyperPoplink; |
||||
import com.fr.chart.web.ChartHyperRelateCellLink; |
||||
import com.fr.chart.web.ChartHyperRelateFloatLink; |
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.chart.javascript.ChartEmailPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.fun.HyperlinkProvider; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.UIListControlPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itoolbar.UIToolbar; |
||||
import com.fr.design.hyperlink.ReportletHyperlinkPane; |
||||
import com.fr.design.hyperlink.WebHyperlinkPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.javascript.JavaScriptImplPane; |
||||
import com.fr.design.javascript.ParameterJavaScriptPane; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.js.EmailJavaScript; |
||||
import com.fr.js.FormHyperlinkProvider; |
||||
import com.fr.js.JavaScript; |
||||
import com.fr.js.JavaScriptImpl; |
||||
import com.fr.js.NameJavaScript; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.js.ParameterJavaScript; |
||||
import com.fr.js.ReportletHyperlink; |
||||
import com.fr.js.WebHyperlink; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2019-09-25 |
||||
*/ |
||||
public class HyperLinkPane extends UIListControlPane implements UIObserver { |
||||
|
||||
private Map<String, BaseFormula> hyperLinkEditorMap; |
||||
|
||||
private UIObserverListener uiObserverListener; |
||||
|
||||
public HyperLinkPane() { |
||||
super(); |
||||
this.setBorder(null); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
List<NameableCreator> creators = new ArrayList<NameableCreator>(); |
||||
|
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), |
||||
ReportletHyperlink.class, ReportletHyperlinkPane.class)); |
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), EmailJavaScript.class, NewChartEmailPane.class)); |
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Web"), |
||||
WebHyperlink.class, WebHyperlinkPane.class)); |
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Dynamic_Parameters"), |
||||
ParameterJavaScript.class, ParameterJavaScriptPane.class)); |
||||
creators.add(new NameObjectCreator("JavaScript", JavaScriptImpl.class, JavaScriptImplPane.class)); |
||||
|
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), |
||||
ChartHyperPoplink.class, ChartHyperPoplinkPane.class)); |
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Cell"), |
||||
ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.class)); |
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Float"), |
||||
ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class)); |
||||
|
||||
FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); |
||||
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"), |
||||
hyperlink.getClass(), FormHyperlinkPane.class)); |
||||
|
||||
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); |
||||
for (HyperlinkProvider provider : providers) { |
||||
NameableCreator nc = provider.createHyperlinkCreator(); |
||||
creators.add(nc); |
||||
} |
||||
|
||||
return creators.toArray(new NameableCreator[creators.size()]); |
||||
} |
||||
|
||||
public BasicBeanPane createPaneByCreators(NameableCreator creator) { |
||||
Constructor<? extends BasicBeanPane> constructor; |
||||
try { |
||||
constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class); |
||||
return constructor.newInstance(hyperLinkEditorMap, false); |
||||
|
||||
} catch (InstantiationException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} catch (IllegalAccessException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} catch (NoSuchMethodException e) { |
||||
return super.createPaneByCreators(creator); |
||||
} catch (InvocationTargetException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void registerChangeListener(UIObserverListener listener) { |
||||
uiObserverListener = listener; |
||||
} |
||||
|
||||
@Override |
||||
public boolean shouldResponseChangeListener() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel getLeftTopPane(UIToolbar topToolBar) { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
double[] columnSize = {f, e}; |
||||
double[] rowSize = {p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(getAddItemText()), topToolBar}, |
||||
}; |
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
@Override |
||||
public void saveSettings() { |
||||
if (isPopulating) { |
||||
return; |
||||
} |
||||
uiObserverListener.doChange(); |
||||
} |
||||
|
||||
public void update(NameJavaScriptGroup nameGroup) { |
||||
|
||||
Nameable[] nameables = update(); |
||||
|
||||
nameGroup.clear(); |
||||
|
||||
for (int i = 0; i < nameables.length; i++) { |
||||
JavaScript javaScript = (JavaScript) ((NameObject) nameables[i]).getObject(); |
||||
String name = nameables[i].getName(); |
||||
NameJavaScript nameJava = new NameJavaScript(name, javaScript); |
||||
nameGroup.addNameHyperlink(nameJava); |
||||
} |
||||
|
||||
} |
||||
|
||||
public void populate(NameJavaScriptGroup nameGroup, Map<String, BaseFormula> hyperLinkEditorMap) { |
||||
|
||||
this.hyperLinkEditorMap = hyperLinkEditorMap; |
||||
|
||||
List<NameObject> nameObjects = new ArrayList<NameObject>(); |
||||
|
||||
for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) { |
||||
NameJavaScript javaScript = nameGroup.getNameHyperlink(i); |
||||
if (javaScript != null && javaScript.getJavaScript() != null) { |
||||
JavaScript script = javaScript.getJavaScript(); |
||||
nameObjects.add(new NameObject(javaScript.getName(), script)); |
||||
} |
||||
} |
||||
|
||||
this.populate(nameObjects.toArray(new NameObject[nameObjects.size()])); |
||||
doLayout(); |
||||
} |
||||
|
||||
/** |
||||
* 弹出列表的标题. |
||||
* |
||||
* @return 返回标题字符串. |
||||
*/ |
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Report_Hyperlink"); |
||||
} |
||||
|
||||
@Override |
||||
protected String getAddItemText() { |
||||
return Toolkit.i18nText("Fine-Design_Basic_Add_Hyperlink"); |
||||
} |
||||
|
||||
//邮箱
|
||||
public static class NewChartEmailPane extends ChartEmailPane { |
||||
@Override |
||||
protected boolean needRenamePane() { |
||||
return false; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue