Browse Source

报表块共享按钮接口

master
zack 8 years ago
parent
commit
5ec25e6264
  1. 24
      designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java
  2. 23
      designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java
  3. 19
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  4. 24
      designer_base/src/com/fr/design/mainframe/JTemplate.java

24
designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.stable.fun.mark.Mutable;
/**
* 设计器面板最上方的按钮接口保存赋值撤销同级
* Coder: zack
* Date: 2016/9/22
* Time: 15:40
*/
public interface DesignerFrameUpButtonProvider extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "DesignerFrameUpButtonProvider";
/**
* 根据当前的设计状态返回最上层工具按钮
* @param menuState 现在设计器的设计状态
* @return 按钮
*/
UIButton[] getUpButtons(int menuState);
}

23
designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.stable.fun.mark.API;
/**
* Coder: zack
* Date: 2016/9/22
* Time: 15:50
*/
@API(level = DesignerFrameUpButtonProvider.CURRENT_LEVEL)
public abstract class AbstractDsinFrameUpButtonProvider implements DesignerFrameUpButtonProvider {
@Override
public UIButton[] getUpButtons(int menuState) {
return new UIButton[0];
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

19
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -465,9 +465,28 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//添加分享按钮 //添加分享按钮
addShareButton(); addShareButton();
//添加插件中的按钮
addExtraButtons();
return combineUp; return combineUp;
} }
private void addExtraButtons(){
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(jt == null){
return;
}
UIButton[] extraButtons = jt.createExtraButtons();
for (int i = 0; i < extraButtons.length; i++) {
combineUp.add(extraButtons[i]);
}
if (extraButtons.length > 0) {
combineUp.addSeparator(new Dimension(2, 16));
}
}
private void addShareButton(){ private void addShareButton(){
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(jt == null){ if(jt == null){

24
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -8,8 +8,8 @@ import com.fr.base.io.IOFile;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.TableDataSourceAction; import com.fr.design.actions.TableDataSourceAction;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.edit.RedoAction; import com.fr.design.actions.edit.RedoAction;
import com.fr.design.actions.edit.UndoAction; import com.fr.design.actions.edit.UndoAction;
import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveAsTemplateAction;
@ -19,6 +19,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.InformationWarnPane; import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
@ -37,9 +38,12 @@ import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.MemFILE; import com.fr.file.MemFILE;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -51,6 +55,7 @@ import java.awt.*;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -505,6 +510,9 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public boolean saveShareFile(){ public boolean saveShareFile(){
return true; return true;
} }
public Widget getSelectElementCase(){
return new NoneWidget();
}
protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){ protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){
return new FILEChooserPane(true, isShowLoc); return new FILEChooserPane(true, isShowLoc);
@ -957,4 +965,18 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public boolean acceptToolbarItem(Class clazz) { public boolean acceptToolbarItem(Class clazz) {
return true; return true;
} }
/**
* 加载插件中的按钮
* @return 按钮组
*/
public UIButton[] createExtraButtons() {
Set<DesignerFrameUpButtonProvider> providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG);
UIButton[] uiButtons = new UIButton[0];
for (DesignerFrameUpButtonProvider provider : providers) {
uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState()));
}
return uiButtons;
}
} }
Loading…
Cancel
Save