Browse Source

Merge pull request #61 in BA/design from ~VITO/design:store_bug to release

* commit '83a9bdf8dd3688ee3fce8096cf17f6ccb28bc162':
  去掉多余的import
  1、减小插件商店窗体高度 2、提醒插件升级的时候使用的框体改为新版插件商店的框体
  修复提示消息在页面背部的问题
  去掉多余的判断
  把set去掉
  命名更改
  控件自定义属性tab接口
  格式化
  menuhandler的equals方法会使带参数的shortcut不进行比较,改用AbstractProvider
master
richie 9 years ago
parent
commit
b5f0bf3efc
  1. 19
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  2. 8
      designer_base/src/com/fr/design/extra/PluginManagerPane.java
  3. 2
      designer_base/src/com/fr/design/extra/PluginShopDialog.java
  4. 16
      designer_base/src/com/fr/design/fun/MenuHandler.java
  5. 18
      designer_base/src/com/fr/design/fun/WidgetAttrProvider.java
  6. 34
      designer_base/src/com/fr/design/fun/impl/AbstractMenuHandler.java
  7. 21
      designer_base/src/com/fr/design/fun/impl/AbstractWidgetAttrProvider.java
  8. 7
      designer_base/src/com/fr/start/BaseDesigner.java
  9. 37
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

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

@ -130,6 +130,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private Set<ElementUIProvider> elementUIProviders; private Set<ElementUIProvider> elementUIProviders;
private Set<WidgetAttrProvider> widgetAttrProviders;
public TableDataTreePaneProcessor getTableDataTreePaneProcessor() { public TableDataTreePaneProcessor getTableDataTreePaneProcessor() {
return tableDataTreePaneProcessor; return tableDataTreePaneProcessor;
} }
@ -736,6 +738,21 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
elementUIProviders.add((ElementUIProvider) level); elementUIProviders.add((ElementUIProvider) level);
} }
public WidgetAttrProvider[] getWidgetAttrProviders() {
if (widgetAttrProviders == null) {
return new WidgetAttrProvider[0];
}
return widgetAttrProviders.toArray(new WidgetAttrProvider[widgetAttrProviders.size()]);
}
public void addWidgetAttrProvider(Level level, PluginSimplify simplify) throws Exception {
if (widgetAttrProviders == null) {
widgetAttrProviders = new HashSet<WidgetAttrProvider>();
}
validAPILevel(level, WidgetAttrProvider.CURRENT_LEVEL, simplify.getPluginName());
widgetAttrProviders.add((WidgetAttrProvider) level);
}
/** /**
* 文件名 * 文件名
* *
@ -828,6 +845,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
setTableDataSourceOPProcessor(impl, simplify); setTableDataSourceOPProcessor(impl, simplify);
} else if (tagName.equals(ElementUIProvider.MARK_STRING)) { } else if (tagName.equals(ElementUIProvider.MARK_STRING)) {
addElementUIProvider(impl, simplify); addElementUIProvider(impl, simplify);
} else if (tagName.equals(WidgetAttrProvider.XML_TAG)) {
addWidgetAttrProvider(impl, simplify);
} }
} catch (PluginInvalidLevelException e) { } catch (PluginInvalidLevelException e) {
PluginMessage.remindUpdate(e.getMessage()); PluginMessage.remindUpdate(e.getMessage());

8
designer_base/src/com/fr/design/extra/PluginManagerPane.java

@ -47,7 +47,7 @@ public class PluginManagerPane extends BasicPane {
File file = new File(StableUtils.pathJoin(installHome, "scripts")); File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
null, this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
@ -90,7 +90,7 @@ public class PluginManagerPane extends BasicPane {
} }
}); });
} catch (PluginVerifyException e) { } catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(PluginManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false; return false;
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
@ -106,7 +106,7 @@ public class PluginManagerPane extends BasicPane {
if (get()) { if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome());
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, PluginManagerPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), Inter.getLocText("FR-Designer-Plugin_Shop_Installed"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
@ -135,7 +135,7 @@ public class PluginManagerPane extends BasicPane {
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
null, PluginManagerPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,

2
designer_base/src/com/fr/design/extra/PluginShopDialog.java

@ -10,7 +10,7 @@ import java.awt.*;
* Created by vito on 16/4/18. * Created by vito on 16/4/18.
*/ */
public class PluginShopDialog extends UIDialog { public class PluginShopDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(900, 700); private static final Dimension DEFAULT_SHOP = new Dimension(900, 690);
public PluginShopDialog(Frame frame, BasicPane pane) { public PluginShopDialog(Frame frame, BasicPane pane) {
super(frame, pane, false); super(frame, pane, false);

16
designer_base/src/com/fr/design/fun/MenuHandler.java

@ -10,7 +10,7 @@ import com.fr.stable.fun.Level;
* @since 8.0 * @since 8.0
* 设计器菜单栏插件接口 * 设计器菜单栏插件接口
*/ */
public interface MenuHandler extends Level{ public interface MenuHandler extends Level {
String MARK_STRING = "MenuHandler"; String MARK_STRING = "MenuHandler";
@ -30,47 +30,43 @@ public interface MenuHandler extends Level{
* 插入菜单的位置 * 插入菜单的位置
* *
* @param total 插入的位置 * @param total 插入的位置
*
* @return 插入位置如果想放到最后则返回-1 * @return 插入位置如果想放到最后则返回-1
*/ */
int insertPosition(int total); int insertPosition(int total);
/** /**
* 是否在插入的菜单前插入一个分割符 * 是否在插入的菜单前插入一个分割符
*
* @return 是否插入分隔符 * @return 是否插入分隔符
*/ */
boolean insertSeparatorBefore(); boolean insertSeparatorBefore();
/** /**
* 是否在插入的菜单后插入一个分割符 * 是否在插入的菜单后插入一个分割符
*
* @return 是否插入分隔符 * @return 是否插入分隔符
*/ */
boolean insertSeparatorAfter(); boolean insertSeparatorAfter();
/** /**
* 所属的分类菜单 * 所属的分类菜单
*
* @return 分类菜单名 * @return 分类菜单名
*/ */
String category(); String category();
/** /**
* 具体的菜单项内容 * 具体的菜单项内容
*
* @return 菜单项内容 * @return 菜单项内容
*/ */
ShortCut shortcut(); ShortCut shortcut();
/** /**
* 具体的菜单项内容 * 具体的菜单项内容
* @param plus 当前模板
* *
* @param plus 当前模板
* @return 菜单项内容 * @return 菜单项内容
*/ */
ShortCut shortcut(ToolBarMenuDockPlus plus); ShortCut shortcut(ToolBarMenuDockPlus plus);
/**
* 两个菜单项相等等情况
* @param obj 比较对象
* @return 相等则返回true否则返回false
*/
boolean equals(Object obj);
} }

18
designer_base/src/com/fr/design/fun/WidgetAttrProvider.java

@ -0,0 +1,18 @@
package com.fr.design.fun;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.stable.fun.Level;
/**
* Created by vito on 16/4/27.
*/
public interface WidgetAttrProvider extends Level {
String XML_TAG = "WidgetAttrProvider";
int CURRENT_LEVEL = 1;
AbstractPropertyTable createWidgetAttrTable();
String tableTitle();
}

34
designer_base/src/com/fr/design/fun/impl/AbstractMenuHandler.java

@ -3,39 +3,22 @@ package com.fr.design.fun.impl;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.general.ComparatorUtils; import com.fr.stable.fun.impl.AbstractProvider;
/** /**
* @author richie * @author richie
* @date 2015-05-13 * @date 2015-05-13
* @since 8.0 * @since 8.0
*/ */
public abstract class AbstractMenuHandler implements MenuHandler { public abstract class AbstractMenuHandler extends AbstractProvider implements MenuHandler {
public int currentAPILevel() { public int currentAPILevel() {
return CURRENT_LEVEL; return CURRENT_LEVEL;
} }
@Override
public boolean equals(Object obj) { public String mark4Provider() {
return obj instanceof AbstractMenuHandler return this.getClass().getName();
&& ComparatorUtils.equals(category(), ((AbstractMenuHandler) obj).category())
&& shortCutEquals(this, (AbstractMenuHandler)obj);
}
private boolean shortCutEquals(AbstractMenuHandler target, AbstractMenuHandler self){
ShortCut targetShortCut = target.shortcut();
ShortCut selfShortCut = self.shortcut();
if (targetShortCut == null && selfShortCut == null){
return true;
}
if (targetShortCut != null && selfShortCut != null){
return ComparatorUtils.equals(targetShortCut.getClass(), selfShortCut.getClass());
}
return false;
} }
/** /**
@ -43,9 +26,8 @@ public abstract class AbstractMenuHandler implements MenuHandler {
* 不需要选中对象, (文件, 服务器, 关于) * 不需要选中对象, (文件, 服务器, 关于)
* *
* @return 菜单Action * @return 菜单Action
*
*/ */
public ShortCut shortcut(){ public ShortCut shortcut() {
return null; return null;
} }
@ -53,11 +35,9 @@ public abstract class AbstractMenuHandler implements MenuHandler {
* 获取当前菜单对应的Action * 获取当前菜单对应的Action
* *
* @param plus 当前选中的对象(模板) * @param plus 当前选中的对象(模板)
*
* @return 菜单Action * @return 菜单Action
*
*/ */
public ShortCut shortcut(ToolBarMenuDockPlus plus){ public ShortCut shortcut(ToolBarMenuDockPlus plus) {
return null; return null;
} }
} }

21
designer_base/src/com/fr/design/fun/impl/AbstractWidgetAttrProvider.java

@ -0,0 +1,21 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.WidgetAttrProvider;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by vito on 16/4/27.
*/
public abstract class AbstractWidgetAttrProvider extends AbstractProvider implements WidgetAttrProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return this.getClass().getName();
}
}

7
designer_base/src/com/fr/start/BaseDesigner.java

@ -7,8 +7,10 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginManagerPane; import com.fr.design.extra.PluginManagerPane;
import com.fr.design.extra.PluginShopDialog;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
@ -130,7 +132,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
int r = JOptionPane.showConfirmDialog(null, text, Inter.getLocText("FR-Designer_Plugin_Should_Update_Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); int r = JOptionPane.showConfirmDialog(null, text, Inter.getLocText("FR-Designer_Plugin_Should_Update_Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (r == JOptionPane.OK_OPTION) { if (r == JOptionPane.OK_OPTION) {
final PluginManagerPane managerPane = new PluginManagerPane(); final PluginManagerPane managerPane = new PluginManagerPane();
BasicDialog dlg = managerPane.showLargeWindow(DesignerContext.getDesignerFrame(),null); UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true); dlg.setVisible(true);
} }
} }

37
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -1,12 +1,14 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.WidgetAttrProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -24,6 +26,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private WidgetPropertyTable propertyTable; private WidgetPropertyTable propertyTable;
private EventPropertyTable eventTable; private EventPropertyTable eventTable;
private List<AbstractPropertyTable> widgetPropertyTables;
private FormDesigner designer;
public static WidgetPropertyPane getInstance() { public static WidgetPropertyPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -59,12 +63,13 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
@Override @Override
public void refreshDockingView() { public void refreshDockingView() {
FormDesigner designer = this.getEditingFormDesigner(); designer = this.getEditingFormDesigner();
removeAll(); removeAll();
if(designer == null){ if (designer == null) {
clearDockingView(); clearDockingView();
return; return;
} }
widgetPropertyTables = new ArrayList<AbstractPropertyTable>();
propertyTable = new WidgetPropertyTable(designer); propertyTable = new WidgetPropertyTable(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
propertyTable.setBorder(null); propertyTable.setBorder(null);
@ -82,20 +87,36 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
tabbedPane.addTab(Inter.getLocText("Form-Properties"), psp); tabbedPane.addTab(Inter.getLocText("Form-Properties"), psp);
tabbedPane.addTab(Inter.getLocText("Form-Events"), esp); tabbedPane.addTab(Inter.getLocText("Form-Events"), esp);
WidgetAttrProvider[] widgetAttrProviders = ExtraDesignClassManager.getInstance().getWidgetAttrProviders();
for (WidgetAttrProvider widgetAttrProvider : widgetAttrProviders) {
AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
widgetPropertyTables.add(propertyTable);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
UIScrollPane uiScrollPane = new UIScrollPane(propertyTable);
uiScrollPane.setBorder(null);
tabbedPane.addTab(widgetAttrProvider.tableTitle(), uiScrollPane);
}
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
propertyTable.initPropertyGroups(null); propertyTable.initPropertyGroups(null);
eventTable.refresh(); eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer);
}
} }
public void setEditingFormDesigner(BaseFormDesigner editor) { public void setEditingFormDesigner(BaseFormDesigner editor) {
FormDesigner fd = (FormDesigner)editor; FormDesigner fd = (FormDesigner) editor;
super.setEditingFormDesigner(fd); super.setEditingFormDesigner(fd);
} }
public void clearDockingView() { public void clearDockingView() {
propertyTable = null; propertyTable = null;
eventTable = null; eventTable = null;
if (widgetPropertyTables != null) {
widgetPropertyTables.clear();
}
JScrollPane psp = new JScrollPane(); JScrollPane psp = new JScrollPane();
psp.setBorder(null); psp.setBorder(null);
this.add(psp, BorderLayout.CENTER); this.add(psp, BorderLayout.CENTER);
@ -113,7 +134,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED || evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
propertyTable.initPropertyGroups(null); propertyTable.initPropertyGroups(designer);
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) {
repaint(); repaint();
} }
@ -121,7 +142,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
return o instanceof WidgetPropertyDesignerAdapter; return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable;
} }
} }

Loading…
Cancel
Save