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. 15
      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. 20
      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;
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.frpane.LoadingBasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
@ -27,19 +24,13 @@ public class ReportTableDataPane extends LoadingBasicPane {
@Override
protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
TableDataPaneProcessor paneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
TableDataPaneController pane = null;
if (paneProcessor != null) {
pane = paneProcessor.createServerTableDataPane(DesignModelAdapter.getCurrentModelAdapter()
);
}
tdPane = pane == null ? new TableDataPaneListPane() {
tdPane = new TableDataPaneListPane() {
@Override
public NameableCreator[] createNameableCreators() {
return TableDataCreatorProducer.getInstance().createReportTableDataCreator();
}
} : pane;
};
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 filter 文件的后缀
* @return 选择的文件的路径
* 这里换用JFileChooser会卡死,不知道为什么
*/
public String showFileChooserWithFilter(String des, String filter) {
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 {
private String[] pluginIDs;
private String result = "undo";
public UninstallExecutor(String[] pluginIDs) {
this.pluginIDs = pluginIDs;
@ -23,7 +24,7 @@ public class UninstallExecutor implements Executor {
@Override
public String getTaskFinishMessage() {
return "插件已卸载完毕,重启后生效";
return result;
}
@Override
@ -32,7 +33,7 @@ public class UninstallExecutor implements Executor {
new Command() {
@Override
public String getExecuteMessage() {
return "删除成功";
return null;
}
@Override
@ -62,6 +63,7 @@ public class UninstallExecutor implements Executor {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
result = "done";
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}

15
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.plugin.Plugin;
import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -47,7 +48,9 @@ public class UpdateOnlineExecutor implements Executor {
LoginCheckContext.fireLoginCheckListener();
}
if (StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) {
try {
for (int i = 0; i < pluginIDs.length; i++) {
try {
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]);
String id = null;
if (plugin != null) {
@ -55,7 +58,6 @@ public class UpdateOnlineExecutor implements Executor {
}
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
@ -63,6 +65,8 @@ public class UpdateOnlineExecutor implements Executor {
});
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);
}
@ -82,14 +86,16 @@ public class UpdateOnlineExecutor implements Executor {
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}
}
};
}
private void updateFileFromDisk(File fileOnDisk) {
try {
private void updateFileFromDisk(File fileOnDisk) throws Exception {
Plugin plugin = PluginHelper.readPlugin(fileOnDisk);
if (plugin == null) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
@ -106,8 +112,5 @@ public class UpdateOnlineExecutor implements Executor {
} else {
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.
* 单元格元素和悬浮元素扩展,通过实现这个接口,可以在单元格中添加更多类型的元素.
*/
public interface ElementUIProvider extends Level {
@ -14,13 +15,33 @@ public interface ElementUIProvider extends Level {
int CURRENT_LEVEL = 1;
/**
* 单元格元素编辑器
* @return 编辑器
*/
Class<?> targetCellEditorClass();
/**
* 单元格内容
* @return 单元格内容
*/
Class<?> targetObjectClass();
/**
* 右侧的快速编辑器
* @return 编辑器
*/
QuickEditor<?> quickEditor();
/**
* 插件单元格元素
* @return 插入操作类
*/
Class<? extends UpdateAction> actionForInsertCellElement();
/**
* 插入悬浮元素
* @return 插入操作类
*/
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();
}
public static BackgroundUIWrapper getBrosweWrapper(Class<? extends Background> category) {
public static BackgroundUIWrapper getBrowserWrapper(Class<? extends Background> 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.
*/
public void populate(Background background) {
BackgroundUIWrapper wrapper = BackgroundFactory.getWrapper(background == null ? null : background.getClass());
BackgroundUIWrapper wrapper = getBackgroundUIWrapper(background);
int index = wrapper.getIndex();
BackgroundDetailPane quickPane = getTabItemPane(background, index);
quickPane.populate(background);
@ -126,6 +126,10 @@ public class BackgroundPane extends BasicPane {
tabbedPane.validate();
}
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return BackgroundFactory.getWrapper(background == null ? null : background.getClass());
}
/**
* 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() {
int index = 0;
for (Class<? extends Background> key : BackgroundFactory.browserKindsOfKey()) {
BackgroundUIWrapper wrapper = BackgroundFactory.getBrosweWrapper(key);
BackgroundUIWrapper wrapper = BackgroundFactory.getBrowserWrapper(key);
wrapper.setIndex(index++);
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) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {

20
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};
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[]{null, null}
};
@ -73,7 +73,7 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
MeterReportDefinition meterDefinition = (MeterReportDefinition)definition;
if (meterDefinition.getName() != null) {
singCatePane.getUITextField().setText(meterDefinition.getName().toString());
populateSingCatePane(meterDefinition.getName().toString());
}
if (meterDefinition.getValue() != null) {
singValuePane.getUITextField().setText(meterDefinition.getValue().toString());
@ -83,12 +83,17 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
filterPane.populateBean(collection);
}
protected void populateSingCatePane(String name) {
singCatePane.getUITextField().setText(name);
}
public void updateBean(ChartCollection collection) {
if (collection != null) {
MeterReportDefinition meterDefinition = new MeterReportDefinition();
meterDefinition.setName(canBeFormula(singCatePane.getUITextField().getText()));
updateSingCatePane(meterDefinition);
meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText()));
collection.getSelectedChart().setFilterDefinition(meterDefinition);
@ -97,9 +102,18 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
}
}
protected void updateSingCatePane(MeterReportDefinition meterDefinition) {
meterDefinition.setName(canBeFormula(singCatePane.getUITextField().getText()));
}
@Override
protected String[] columnNames() {
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) {
MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition();
populateNameComponent(meter.getName());
populateNameComponent(meter);
valueBox.setSelectedItem(meter.getValue());
filterPane.populateBean(ob);
}
}
protected void populateNameComponent(String name) {
nameBox.setSelectedItem(name);
protected void populateNameComponent(MeterTableDefinition meter) {
nameBox.setSelectedItem(meter.getName());
}
/**
@ -104,7 +104,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
*/
public void updateBean(ChartCollection ob) {
if(ob != null) {
MeterTableDefinition meter = new MeterTableDefinition();
MeterTableDefinition meter = getMeterTableDefinition();
ob.getSelectedChart().setFilterDefinition(meter);
updateNameComponent(meter);
@ -114,6 +114,10 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
}
}
protected MeterTableDefinition getMeterTableDefinition(){
return new MeterTableDefinition();
}
protected void updateNameComponent(MeterTableDefinition meter) {
meter.setName(Utils.objectToString(nameBox.getSelectedItem()));
}

Loading…
Cancel
Save