Browse Source

REPORT-44644 设计器接口开放

feature/big-screen
hades 4 years ago
parent
commit
6e033eae85
  1. 14
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 43
      designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java
  3. 19
      designer-base/src/main/java/com/fr/design/fun/TemplateTreeDefineProcessor.java
  4. 23
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java
  5. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java
  6. 36
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

14
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -4,7 +4,9 @@
package com.fr.design.file;
import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.TemplateTreeDefineProcessor;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
@ -27,8 +29,8 @@ import com.fr.workspace.server.lock.TplOperator;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
@ -87,6 +89,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
}
@Override
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
TemplateTreeDefineProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TemplateTreeDefineProcessor.XML_TAG);
if (processor != null) {
processor.rightClickAction(e);
}
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (toolBarStateChangeListener != null) {

43
designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java

@ -0,0 +1,43 @@
package com.fr.design.fun;
import com.fr.file.filetree.FileNodes;
import com.fr.stable.fun.mark.Immutable;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.lock.TplOperator;
/**
* 本地资源操作插件接口
*
* @author hades
* @version 10.0
* Created by hades on 2020/12/22
*/
public interface LocalResourceProvider extends Immutable {
String XML_TAG = "LocalResourceProvider";
int CURRENT_LEVEL = 1;
/**
* eg: FineWorkResource
*
* @return 目录/文件的操作方式
*/
WorkResource createResource();
/**
* eg: LocalFileNodes
*
* @return 构建目录树的方式
*/
FileNodes createFileNodes();
/**
* eg:LocalTplOperator
*
* 模板操作 关闭/打开等操作
*/
TplOperator createTplOperator();
}

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

@ -0,0 +1,19 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Immutable;
import java.awt.event.MouseEvent;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/14
*/
public interface TemplateTreeDefineProcessor extends Immutable {
String XML_TAG = "TemplateTreeDefineProcessor";
int CURRENT_LEVEL = 1;
void rightClickAction(MouseEvent mouseEvent);
}

23
designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.LocalResourceProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/22
*/
@API(level = LocalResourceProvider.CURRENT_LEVEL)
public abstract class AbstractLocalResourceProvider implements LocalResourceProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TemplateTreeDefineProcessor;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/21
*/
@API(level = TemplateTreeDefineProcessor.CURRENT_LEVEL)
public abstract class AbstractTemplateTreeDefineProcessor implements TemplateTreeDefineProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

36
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -17,8 +17,8 @@ import com.fr.design.file.FileToolbarStateChangeListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.LocalResourceProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuHighLight;
@ -34,10 +34,13 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
@ -46,6 +49,8 @@ import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
@ -53,6 +58,11 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.resource.FineWorkResource;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.lock.LocalTplOperator;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
@ -98,6 +108,30 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE);
}
});
PluginFilter filter = pluginContext -> pluginContext.contain(PluginModule.ExtraDesign, LocalResourceProvider.XML_TAG);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterStop, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
FineObjectPool.getInstance().getLocalPool().put(WorkResource.class, FineWorkResource.getInstance());
FineObjectPool.getInstance().getLocalPool().put(FileNodes.class, new LocalFileNodes());
FineObjectPool.getInstance().getLocalPool().put(TplOperator.class, new LocalTplOperator());
UIUtil.invokeLaterIfNeeded(() -> DesignerFrameFileDealerPane.getInstance().refresh());
}
}, filter);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
LocalResourceProvider provider = ExtraDesignClassManager.getInstance().getSingle(LocalResourceProvider.XML_TAG);
if (provider != null) {
FineObjectPool.getInstance().getLocalPool().put(WorkResource.class, provider.createResource());
FineObjectPool.getInstance().getLocalPool().put(FileNodes.class, provider.createFileNodes());
FineObjectPool.getInstance().getLocalPool().put(TplOperator.class, provider.createTplOperator());
UIUtil.invokeLaterIfNeeded(() -> DesignerFrameFileDealerPane.getInstance().refresh());
}
}
}, filter);
}
private List<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>();

Loading…
Cancel
Save