Browse Source

REPORT-19557 ToolbarItemProvider接口需要支持表单报表块

feature/big-screen
zack 5 years ago
parent
commit
23d2e69bb4
  1. 19
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  2. 6
      designer-base/src/main/java/com/fr/design/fun/ToolbarItemProvider.java
  3. 10
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractToolbarItem.java
  4. 3
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java

19
designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java

@ -43,7 +43,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
private static ExtraDesignClassManager classManager = new ExtraDesignClassManager();
private Set<ShortCut> shortCuts = new CloseableContainedSet<>(HashSet.class);
public static ExtraDesignClassManager getInstance() {
return classManager;
}
@ -114,13 +114,28 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
}
/**
* 获取插件注册的工具栏按钮严格区分决策报表与普通模板
* @return
*/
public WidgetOption[] getStrictWebWidgetOptions() {
return createWebWidgetOptions(true);
}
public WidgetOption[] getWebWidgetOptions() {
return createWebWidgetOptions(false);
}
private WidgetOption[] createWebWidgetOptions(boolean filterByTemplateType) {
Set<ToolbarItemProvider> set = getArray(ToolbarItemProvider.XML_TAG);
if (set.isEmpty()) {
return new WidgetOption[0];
}
List<WidgetOption> list = new ArrayList<>();
for (ToolbarItemProvider provider : set) {
if (filterByTemplateType && !provider.accept()) {
continue;
}
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(),
IOUtils.readIcon(provider.iconPathForWidget()),
@ -132,7 +147,6 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
}
public Map<Class<? extends Widget>, Class<?>> getFormWidgetOptionsMap() {
Set<FormWidgetOptionProvider> set = getArray(FormWidgetOptionProvider.XML_TAG);
Map<Class<? extends Widget>, Class<?>> map = new HashMap<>();
@ -170,7 +184,6 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
}
public WidgetOption[] getCellWidgetOptions() {
Set<CellWidgetOptionProvider> set = getArray(CellWidgetOptionProvider.XML_TAG);
if (set.isEmpty()) {

6
designer-base/src/main/java/com/fr/design/fun/ToolbarItemProvider.java

@ -36,4 +36,10 @@ public interface ToolbarItemProvider extends Mutable {
*/
String nameForWidget();
/**
* 当前编辑的模板类型决策报表 or cpt是否支持
* @return 支持返回true,否则false
*/
boolean accept();
}

10
designer-base/src/main/java/com/fr/design/fun/impl/AbstractToolbarItem.java

@ -1,6 +1,9 @@
package com.fr.design.fun.impl;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
@ -10,6 +13,7 @@ import com.fr.stable.fun.mark.API;
@API(level = ToolbarItemProvider.CURRENT_LEVEL)
public abstract class AbstractToolbarItem extends AbstractProvider implements ToolbarItemProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@ -18,4 +22,10 @@ public abstract class AbstractToolbarItem extends AbstractProvider implements To
public String mark4Provider() {
return getClass().getName();
}
@Override
public boolean accept() {
JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return currentTemplate.isJWorkBook() || currentTemplate instanceof JVirtualTemplate;
}
}

3
designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption;
@ -52,6 +53,8 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit
List<WidgetOption> defaultOptions = Arrays.asList(FormWebWidgetConstants.getFormElementCaseToolBarInstance());
List<WidgetOption> options = new ArrayList<WidgetOption>();
options.addAll(defaultOptions);
WidgetOption[] widgetOptions = ExtraDesignClassManager.getInstance().getStrictWebWidgetOptions();
options.addAll(Arrays.asList(widgetOptions));
return options.toArray(new WidgetOption[options.size()]);
}

Loading…
Cancel
Save