neil 9 years ago
parent
commit
dcd5e53264
  1. 13
      designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java
  2. 1
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  3. 6
      designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java
  4. 111
      designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java
  5. 21
      designer_base/src/com/fr/design/fun/ElementUIProvider.java
  6. 2
      designer_base/src/com/fr/design/style/background/BackgroundFactory.java
  7. 6
      designer_base/src/com/fr/design/style/background/BackgroundPane.java
  8. 6
      designer_base/src/com/fr/design/style/background/BackgroundPane4Browser.java
  9. 30
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  10. 12
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

13
designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java

@ -4,9 +4,6 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -27,19 +24,13 @@ public class ReportTableDataPane extends LoadingBasicPane {
@Override @Override
protected void initComponents(JPanel container) { protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout()); container.setLayout(FRGUIPaneFactory.createBorderLayout());
TableDataPaneProcessor paneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor(); tdPane = new TableDataPaneListPane() {
TableDataPaneController pane = null;
if (paneProcessor != null) {
pane = paneProcessor.createServerTableDataPane(DesignModelAdapter.getCurrentModelAdapter()
);
}
tdPane = pane == null ? new TableDataPaneListPane() {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return TableDataCreatorProducer.getInstance().createReportTableDataCreator(); return TableDataCreatorProducer.getInstance().createReportTableDataCreator();
} }
} : pane; };
container.add(tdPane.getPanel(), BorderLayout.CENTER); container.add(tdPane.getPanel(), BorderLayout.CENTER);
} }

1
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -153,6 +153,7 @@ public class PluginWebBridge {
* @param des 过滤文件描述 * @param des 过滤文件描述
* @param filter 文件的后缀 * @param filter 文件的后缀
* @return 选择的文件的路径 * @return 选择的文件的路径
* 这里换用JFileChooser会卡死,不知道为什么
*/ */
public String showFileChooserWithFilter(String des, String filter) { public String showFileChooserWithFilter(String des, String filter) {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();

6
designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java

@ -16,6 +16,7 @@ import javax.swing.*;
public class UninstallExecutor implements Executor { public class UninstallExecutor implements Executor {
private String[] pluginIDs; private String[] pluginIDs;
private String result = "undo";
public UninstallExecutor(String[] pluginIDs) { public UninstallExecutor(String[] pluginIDs) {
this.pluginIDs = pluginIDs; this.pluginIDs = pluginIDs;
@ -23,7 +24,7 @@ public class UninstallExecutor implements Executor {
@Override @Override
public String getTaskFinishMessage() { public String getTaskFinishMessage() {
return "插件已卸载完毕,重启后生效"; return result;
} }
@Override @Override
@ -32,7 +33,7 @@ public class UninstallExecutor implements Executor {
new Command() { new Command() {
@Override @Override
public String getExecuteMessage() { public String getExecuteMessage() {
return "删除成功"; return null;
} }
@Override @Override
@ -62,6 +63,7 @@ public class UninstallExecutor implements Executor {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
result = "done";
if (rv == JOptionPane.OK_OPTION) { if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart(); RestartHelper.restart();
} }

111
designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java

@ -10,6 +10,7 @@ import com.fr.design.extra.Process;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -43,44 +44,50 @@ public class UpdateOnlineExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
if(StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())){ if (StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if(StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())){ if (StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) {
for (int i = 0; i < pluginIDs.length; i++) { try {
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]); for (int i = 0; i < pluginIDs.length; i++) {
String id = null; try {
if (plugin != null) { Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]);
id = plugin.getId(); String id = null;
} if (plugin != null) {
String username = DesignerEnvManager.getEnvManager().getBBSName(); id = plugin.getId();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
} }
}); String username = DesignerEnvManager.getEnvManager().getBBSName();
updateFileFromDisk(PluginHelper.getDownloadTempFile()); String password = DesignerEnvManager.getEnvManager().getBBSPassword();
process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%"); PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
} catch (Exception e) { @Override
FRContext.getLogger().error(e.getMessage(), e); public void process(Double integer) {
}
});
updateFileFromDisk(PluginHelper.getDownloadTempFile());
process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%");
} catch (PluginVerifyException e) {
throw e;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} }
} int rv = JOptionPane.showOptionDialog(
int rv = JOptionPane.showOptionDialog( null,
null, Inter.getLocText("FR-Designer-Plugin_Update_Successful"),
Inter.getLocText("FR-Designer-Plugin_Update_Successful"), Inter.getLocText("FR-Designer-Plugin_Warning"),
Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.YES_NO_OPTION,
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE,
JOptionPane.INFORMATION_MESSAGE, null,
null, new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"),
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")
Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later") },
}, null
null );
); if (rv == JOptionPane.OK_OPTION) {
if (rv == JOptionPane.OK_OPTION) { RestartHelper.restart();
RestartHelper.restart(); }
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }
@ -88,26 +95,22 @@ public class UpdateOnlineExecutor implements Executor {
}; };
} }
private void updateFileFromDisk(File fileOnDisk) { private void updateFileFromDisk(File fileOnDisk) throws Exception {
try { Plugin plugin = PluginHelper.readPlugin(fileOnDisk);
Plugin plugin = PluginHelper.readPlugin(fileOnDisk); if (plugin == null) {
if (plugin == null) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); return;
return; }
} Plugin oldPlugin = PluginLoader.getLoader().getPluginById(plugin.getId());
Plugin oldPlugin = PluginLoader.getLoader().getPluginById(plugin.getId()); if (oldPlugin != null) {
if (oldPlugin != null) { String[] files = PluginHelper.uninstallPlugin(FRContext.getCurrentEnv(), oldPlugin);
String[] files = PluginHelper.uninstallPlugin(FRContext.getCurrentEnv(), oldPlugin); PluginHelper.installPluginFromUnzippedTempDir(FRContext.getCurrentEnv(), plugin, new After() {
PluginHelper.installPluginFromUnzippedTempDir(FRContext.getCurrentEnv(), plugin, new After() { @Override
@Override public void done() {
public void done() { }
} });
}); } else {
} else { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }

21
designer_base/src/com/fr/design/fun/ElementUIProvider.java

@ -7,6 +7,7 @@ import com.fr.stable.fun.Level;
/** /**
* Created by richie on 16/4/25. * Created by richie on 16/4/25.
* 单元格元素和悬浮元素扩展,通过实现这个接口,可以在单元格中添加更多类型的元素.
*/ */
public interface ElementUIProvider extends Level { public interface ElementUIProvider extends Level {
@ -14,13 +15,33 @@ public interface ElementUIProvider extends Level {
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
/**
* 单元格元素编辑器
* @return 编辑器
*/
Class<?> targetCellEditorClass(); Class<?> targetCellEditorClass();
/**
* 单元格内容
* @return 单元格内容
*/
Class<?> targetObjectClass(); Class<?> targetObjectClass();
/**
* 右侧的快速编辑器
* @return 编辑器
*/
QuickEditor<?> quickEditor(); QuickEditor<?> quickEditor();
/**
* 插件单元格元素
* @return 插入操作类
*/
Class<? extends UpdateAction> actionForInsertCellElement(); Class<? extends UpdateAction> actionForInsertCellElement();
/**
* 插入悬浮元素
* @return 插入操作类
*/
Class<? extends UpdateAction> actionForInsertFloatElement(); Class<? extends UpdateAction> actionForInsertFloatElement();
} }

2
designer_base/src/com/fr/design/style/background/BackgroundFactory.java

@ -87,7 +87,7 @@ public class BackgroundFactory {
return browser.keySet(); return browser.keySet();
} }
public static BackgroundUIWrapper getBrosweWrapper(Class<? extends Background> category) { public static BackgroundUIWrapper getBrowserWrapper(Class<? extends Background> category) {
return browser.get(category); return browser.get(category);
} }

6
designer_base/src/com/fr/design/style/background/BackgroundPane.java

@ -117,7 +117,7 @@ public class BackgroundPane extends BasicPane {
* Populate background. * Populate background.
*/ */
public void populate(Background background) { public void populate(Background background) {
BackgroundUIWrapper wrapper = BackgroundFactory.getWrapper(background == null ? null : background.getClass()); BackgroundUIWrapper wrapper = getBackgroundUIWrapper(background);
int index = wrapper.getIndex(); int index = wrapper.getIndex();
BackgroundDetailPane quickPane = getTabItemPane(background, index); BackgroundDetailPane quickPane = getTabItemPane(background, index);
quickPane.populate(background); quickPane.populate(background);
@ -126,6 +126,10 @@ public class BackgroundPane extends BasicPane {
tabbedPane.validate(); tabbedPane.validate();
} }
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return BackgroundFactory.getWrapper(background == null ? null : background.getClass());
}
/** /**
* Update background. * Update background.
*/ */

6
designer_base/src/com/fr/design/style/background/BackgroundPane4Browser.java

@ -16,12 +16,16 @@ public class BackgroundPane4Browser extends BackgroundPane {
protected void initTabPane() { protected void initTabPane() {
int index = 0; int index = 0;
for (Class<? extends Background> key : BackgroundFactory.browserKindsOfKey()) { for (Class<? extends Background> key : BackgroundFactory.browserKindsOfKey()) {
BackgroundUIWrapper wrapper = BackgroundFactory.getBrosweWrapper(key); BackgroundUIWrapper wrapper = BackgroundFactory.getBrowserWrapper(key);
wrapper.setIndex(index++); wrapper.setIndex(index++);
tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
} }
} }
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return BackgroundFactory.getBrowserWrapper(background == null ? null : background.getClass());
}
protected BackgroundDetailPane getTabItemPane(Background background, int index) { protected BackgroundDetailPane getTabItemPane(Background background, int index) {
BackgroundDetailPane quickPane = cacheMap.get(index); BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) { if (quickPane == null) {

30
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java

@ -46,7 +46,7 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
double[] rowSize = { p, p, p}; double[] rowSize = { p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(CATENAME), singCatePane = new TinyFormulaPane()}, new Component[]{new UILabel(CATENAME), getSingCatePane()},
new Component[]{new UILabel(NVALUE), singValuePane = new TinyFormulaPane()}, new Component[]{new UILabel(NVALUE), singValuePane = new TinyFormulaPane()},
new Component[]{null, null} new Component[]{null, null}
}; };
@ -73,7 +73,7 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
MeterReportDefinition meterDefinition = (MeterReportDefinition)definition; MeterReportDefinition meterDefinition = (MeterReportDefinition)definition;
if (meterDefinition.getName() != null) { if (meterDefinition.getName() != null) {
singCatePane.getUITextField().setText(meterDefinition.getName().toString()); populateSingCatePane(meterDefinition.getName().toString());
} }
if (meterDefinition.getValue() != null) { if (meterDefinition.getValue() != null) {
singValuePane.getUITextField().setText(meterDefinition.getValue().toString()); singValuePane.getUITextField().setText(meterDefinition.getValue().toString());
@ -82,13 +82,18 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
filterPane.populateBean(collection); filterPane.populateBean(collection);
} }
public void updateBean(ChartCollection collection) { protected void populateSingCatePane(String name) {
singCatePane.getUITextField().setText(name);
}
public void updateBean(ChartCollection collection) {
if (collection != null) { if (collection != null) {
MeterReportDefinition meterDefinition = new MeterReportDefinition(); MeterReportDefinition meterDefinition = new MeterReportDefinition();
meterDefinition.setName(canBeFormula(singCatePane.getUITextField().getText())); updateSingCatePane(meterDefinition);
meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText())); meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText()));
collection.getSelectedChart().setFilterDefinition(meterDefinition); collection.getSelectedChart().setFilterDefinition(meterDefinition);
@ -96,10 +101,19 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
filterPane.updateBean(collection); filterPane.updateBean(collection);
} }
} }
@Override protected void updateSingCatePane(MeterReportDefinition meterDefinition) {
meterDefinition.setName(canBeFormula(singCatePane.getUITextField().getText()));
}
@Override
protected String[] columnNames() { protected String[] columnNames() {
return new String[]{"", ""}; return new String[]{"", ""};
} }
protected Component getSingCatePane() {
return singCatePane = new TinyFormulaPane();
}
} }

12
designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

@ -88,15 +88,15 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) { if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) {
MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition(); MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition();
populateNameComponent(meter.getName()); populateNameComponent(meter);
valueBox.setSelectedItem(meter.getValue()); valueBox.setSelectedItem(meter.getValue());
filterPane.populateBean(ob); filterPane.populateBean(ob);
} }
} }
protected void populateNameComponent(String name) { protected void populateNameComponent(MeterTableDefinition meter) {
nameBox.setSelectedItem(name); nameBox.setSelectedItem(meter.getName());
} }
/** /**
@ -104,7 +104,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
*/ */
public void updateBean(ChartCollection ob) { public void updateBean(ChartCollection ob) {
if(ob != null) { if(ob != null) {
MeterTableDefinition meter = new MeterTableDefinition(); MeterTableDefinition meter = getMeterTableDefinition();
ob.getSelectedChart().setFilterDefinition(meter); ob.getSelectedChart().setFilterDefinition(meter);
updateNameComponent(meter); updateNameComponent(meter);
@ -114,6 +114,10 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
} }
} }
protected MeterTableDefinition getMeterTableDefinition(){
return new MeterTableDefinition();
}
protected void updateNameComponent(MeterTableDefinition meter) { protected void updateNameComponent(MeterTableDefinition meter) {
meter.setName(Utils.objectToString(nameBox.getSelectedItem())); meter.setName(Utils.objectToString(nameBox.getSelectedItem()));
} }

Loading…
Cancel
Save