Browse Source

Merge pull request #76 in BA/design from ~ZACK/design:master to master

* commit '47f779ac70e6533140a33f1be080fc2690554de2':
  修改方法名
  修改
  格式化一下
  删除不需要的变量
  修改
  控件属性传递插件接口
master
superman 9 years ago
parent
commit
a4588353ab
  1. 23
      designer/src/com/fr/design/widget/WidgetPane.java
  2. 12
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  3. 22
      designer_base/src/com/fr/design/fun/WidgetDesignHandler.java
  4. 11
      designer_base/src/com/fr/design/fun/impl/AbstractWidgetDesignHandler.java

23
designer/src/com/fr/design/widget/WidgetPane.java

@ -1,19 +1,20 @@
package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.WidgetDesignHandler;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button;
import com.fr.form.ui.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.design.widget.btn.ButtonConstants;
import javax.swing.*;
import java.awt.*;
@ -61,16 +62,22 @@ public class WidgetPane extends BasicPane implements ItemListener {
/**
* 状态改变
*
* @param e 事件对象
*/
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
Widget oldWidget = update();
Widget selectedItem = editorTypeComboBox.getCellWidget();
WidgetDesignHandler handler = ExtraDesignClassManager.getInstance().getWidgetDesignHandler();
if (handler != null) {
handler.transferWidgetProperties(oldWidget, selectedItem);
}
if (e.getItem() instanceof Item && ((Item) e.getItem()).getValue() instanceof WidgetConfig) {
populate(editorTypeComboBox.getCellWidget());
populate(selectedItem);
return;
}
if (shouldFireSelectedEvent) {
Widget selectedItem = editorTypeComboBox.getCellWidget();
populateWidgetConfig(selectedItem);
}
}
@ -109,9 +116,9 @@ public class WidgetPane extends BasicPane implements ItemListener {
public Widget update() {
return cellEditorCardPane.update();
}
protected void populateWidgetConfig(Widget widget) {
cellEditorCardPane.populate(widget);
cellEditorCardPane.populate(widget);
}
@ -190,12 +197,13 @@ public class WidgetPane extends BasicPane implements ItemListener {
}
private WidgetOption[] getWidgetOptions() {
return (WidgetOption[])ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions());
return (WidgetOption[]) ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions());
}
}
/**
* 校验
*
* @throws Exception 抛出异常
*/
public void checkValid() throws Exception {
@ -222,6 +230,7 @@ public class WidgetPane extends BasicPane implements ItemListener {
/**
* 转化成字符串形式
*
* @return 返回字符串
*/
public String toString() {

12
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -132,6 +132,16 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private Set<WidgetAttrProvider> widgetAttrProviders;
private WidgetDesignHandler widgetDesignHandler;
public WidgetDesignHandler getWidgetDesignHandler() {
return widgetDesignHandler;
}
public void setWidgetDesignHandler(Level level, PluginSimplify simplify) throws Exception {
widgetDesignHandler = (WidgetDesignHandler) level;
}
public TableDataTreePaneProcessor getTableDataTreePaneProcessor() {
return tableDataTreePaneProcessor;
}
@ -847,6 +857,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addElementUIProvider(impl, simplify);
} else if (tagName.equals(WidgetAttrProvider.XML_TAG)) {
addWidgetAttrProvider(impl, simplify);
} else if (tagName.equals(WidgetDesignHandler.XML_TAG)) {
setWidgetDesignHandler(impl, simplify);
}
} catch (PluginInvalidLevelException e) {
PluginMessage.remindUpdate(e.getMessage());

22
designer_base/src/com/fr/design/fun/WidgetDesignHandler.java

@ -0,0 +1,22 @@
package com.fr.design.fun;
import com.fr.form.ui.Widget;
import com.fr.stable.fun.Level;
/**
* Coder: zack
* Date: 2016/5/12
* Time: 10:37
*/
public interface WidgetDesignHandler extends Level {
String XML_TAG = "WidgetDesignHandler";
int CURRENT_LEVEL = 1;
/**
* 传递控件共有属性
*
* @param oldWidget 老控件
* @param newWidget 新控件
*/
void transferWidgetProperties(Widget oldWidget, Widget newWidget);
}

11
designer_base/src/com/fr/design/fun/impl/AbstractWidgetDesignHandler.java

@ -0,0 +1,11 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.WidgetDesignHandler;
/**
* Coder: zack
* Date: 2016/5/12
* Time: 10:41
*/
public abstract class AbstractWidgetDesignHandler implements WidgetDesignHandler {
}
Loading…
Cancel
Save