Browse Source

合代码冲突

research/11.0
neil 5 years ago
parent
commit
7483d9d7c6
  1. 101
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

101
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -11,7 +11,6 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
@ -131,13 +130,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit"));
switchMode(PropertyMode.REPORT); switchMode(PropertyMode.REPORT);
setContainerWidth(CONTAINER_WIDTH); setContainerWidth(CONTAINER_WIDTH);
initPluginPane(); initPluginPane();
listenPlugin(); listenPlugin();
} }
private void listenPlugin() { private void listenPlugin() {
PluginFilter filter = new PluginFilter() { PluginFilter filter = new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
@ -151,18 +150,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void on(PluginEvent event) { public void on(PluginEvent event) {
PluginContext context = event.getContext(); PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime(); PluginRuntime runtime = context.getRuntime();
final Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG); Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
// UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题 for (PropertyItemPaneProvider provider : providers) {
// 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住 addPropertyItem(provider);
UIUtil.invokeLaterIfNeeded(new Runnable() { }
@Override updateAllPropertyPane();
public void run() { }
for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider);
}
updateAllPropertyPane();
}
}); }
}, filter); }, filter);
PluginListenerRegistration.getInstance().listen( PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop, PluginEventType.BeforeStop,
@ -171,22 +164,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void on(PluginEvent event) { public void on(PluginEvent event) {
PluginContext context = event.getContext(); PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime(); PluginRuntime runtime = context.getRuntime();
final Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG); Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
UIUtil.invokeLaterIfNeeded(new Runnable() { for (PropertyItemPaneProvider provider : providers) {
@Override removePropertyItem(provider);
public void run() {
for (PropertyItemPaneProvider provider : providers) { }
removePropertyItem(provider); updateAllPropertyPane();
}
updateAllPropertyPane();
}
});
} }
}, filter); }, filter);
} }
private void removePropertyItem(PropertyItemPaneProvider provider) { private void removePropertyItem(PropertyItemPaneProvider provider) {
propertyItemMap.remove(provider.key()); propertyItemMap.remove(provider.key());
String replaceKey = provider.replaceKey(); String replaceKey = provider.replaceKey();
if (replaceKey == null) { if (replaceKey == null) {
@ -197,18 +186,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
replaceItem.setReplace(false); replaceItem.setReplace(false);
} }
} }
private void initPluginPane() { private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) { for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider); addPropertyItem(provider);
} }
} }
private void addPropertyItem(PropertyItemPaneProvider provider) { private void addPropertyItem(PropertyItemPaneProvider provider) {
String key = provider.key(); String key = provider.key();
PropertyItemBean itemBean = provider.getItem(); PropertyItemBean itemBean = provider.getItem();
PropertyItem propertyItem = new PropertyItem(itemBean.getName(), PropertyItem propertyItem = new PropertyItem(itemBean.getName(),
@ -223,7 +212,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.addActionListener(buttonListener); button.addActionListener(buttonListener);
} }
propertyItemMap.put(key, propertyItem); propertyItemMap.put(key, propertyItem);
String replaceKey = provider.replaceKey(); String replaceKey = provider.replaceKey();
if (replaceKey == null) { if (replaceKey == null) {
return; return;
@ -232,11 +221,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (replaceItem != null) { if (replaceItem != null) {
replaceItem.setReplace(true); replaceItem.setReplace(true);
} }
} }
private void initPropertyItemList() { private void initPropertyItemList() {
propertyItemMap = new LinkedHashMap<>(); // 有序map propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素 // 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"),
@ -251,7 +240,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
"floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置 // 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"),
"widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
// 条件属性 // 条件属性
@ -485,30 +474,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void replaceAuthorityEditionPane(JComponent pane) { public void replaceAuthorityEditionPane(JComponent pane) {
propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane); propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
} }
public JComponent getAuthorityEditionPane() { public JComponent getAuthorityEditionPane() {
return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane(); return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
} }
public void replaceConfiguredRolesPane(JComponent pane) { public void replaceConfiguredRolesPane(JComponent pane) {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
} }
public void replaceKeyPane(final String key, final JComponent pane) { public void replaceKeyPane(String key, JComponent pane) {
//需要放到 ui 线程中处理 propertyItemMap.get(key).replaceContentPane(pane);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
propertyItemMap.get(key).replaceContentPane(pane);
}
});
} }
public JComponent getConfiguredRolesPane() { public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
} }
public void addParameterPane(JComponent paraPane) { public void addParameterPane(JComponent paraPane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
} }
@ -670,8 +653,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
private final Color selectedBtnBackground = new Color(0xF5F5F7); private final Color selectedBtnBackground = new Color(0xF5F5F7);
private Color originBtnBackground; private Color originBtnBackground;
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes); this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes);
} }
@ -722,12 +705,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void setVisible(boolean isVisible) { public void setVisible(boolean isVisible) {
this.isVisible = isVisible; this.isVisible = isVisible;
} }
public void setReplace(boolean replace) { public void setReplace(boolean replace) {
this.replace = replace; this.replace = replace;
} }
public boolean isEnabled() { public boolean isEnabled() {
return isEnabled; return isEnabled;
} }
@ -737,16 +720,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
this.isEnabled = isEnabled; this.isEnabled = isEnabled;
button.setEnabled(isEnabled); button.setEnabled(isEnabled);
} }
public void setIconBaseDir(String iconBaseDir) { public void setIconBaseDir(String iconBaseDir) {
this.iconBaseDir = iconBaseDir; this.iconBaseDir = iconBaseDir;
} }
private String getIconBaseDir() { private String getIconBaseDir() {
return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir; return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir;
} }
private void initPropertyPanel() { private void initPropertyPanel() {
propertyPanel = new JPanel(); propertyPanel = new JPanel();
propertyPanel.setBackground(Color.pink); propertyPanel.setBackground(Color.pink);
@ -827,7 +810,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
private String getBtnIconUrl() { private String getBtnIconUrl() {
return getIconBaseDir() + btnIconName + iconSuffix; return getIconBaseDir() + btnIconName + iconSuffix;
} }

Loading…
Cancel
Save