xiaoxia 8 years ago
parent
commit
09e6478811
  1. 18
      designer/src/com/fr/design/actions/ElementCaseAction.java
  2. 36
      designer/src/com/fr/design/actions/SelectionListenerAction.java
  3. 56
      designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java
  4. 3
      designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
  5. 3
      designer/src/com/fr/design/actions/file/export/PDFExportAction.java
  6. 9
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  7. 27
      designer_base/src/com/fr/design/actions/UpdateAction.java
  8. 2
      designer_base/src/com/fr/design/extra/QQLoginWebBridge.java
  9. 11
      designer_base/src/com/fr/design/menu/MenuDef.java
  10. 2
      designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

18
designer/src/com/fr/design/actions/ElementCaseAction.java

@ -10,24 +10,10 @@ import com.fr.grid.selection.Selection;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
public abstract class ElementCaseAction extends TemplateComponentAction<ElementCasePane> {
public abstract class ElementCaseAction extends SelectionListenerAction {
protected ElementCaseAction(ElementCasePane t) {
super(t);
t.addSelectionChangeListener(new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
update();
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
Selection selection = getEditingComponent().getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
//样式处理
getEditingComponent().setCellNeedTOFormat(cellselection);
}
}
}
});
t.addSelectionChangeListener(createSelectionListener());
}
}

36
designer/src/com/fr/design/actions/SelectionListenerAction.java

@ -0,0 +1,36 @@
package com.fr.design.actions;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
/**
* Created by daniel on 2016/10/10.
*/
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> {
protected SelectionListenerAction(ElementCasePane elementCasePane) {
super(elementCasePane);
}
protected SelectionListener createSelectionListener () {
return new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
update();
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
Selection selection = getEditingComponent().getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
//样式处理
getEditingComponent().setCellNeedTOFormat(cellselection);
}
}
}
};
}
}

56
designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java

@ -8,19 +8,27 @@ import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.NameStyle;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.actions.SelectionListenerAction;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.design.style.StylePane;
import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinHelper;
import java.awt.event.ActionEvent;
import java.awt.*;
import java.awt.event.*;
import java.util.Iterator;
public class GlobalStyleMenuDef extends MenuDef {
@ -35,6 +43,36 @@ public class GlobalStyleMenuDef extends MenuDef {
this.setIconPath("/com/fr/design/images/m_web/style.png");
}
protected ContainerListener getContainerListener() {
return containerListener;
}
private ContainerListener containerListener = new ContainerListener() {
@Override
public void componentAdded(ContainerEvent e) {
}
@Override
public void componentRemoved(ContainerEvent e) {
Component c = e.getChild();
c.dispatchEvent(new MenuDeleteEvent(c));
}
};
private class MenuDeleteEvent extends UpdateAction.ComponentRemoveEvent {
public MenuDeleteEvent(Component source) {
super(source);
}
@Override
public void release(SelectionListener listener) {
ePane.removeSelectionChangeListener(listener);
}
}
/**
* 更新菜单项
*/
@ -46,8 +84,7 @@ public class GlobalStyleMenuDef extends MenuDef {
while (iterator.hasNext()) {
String name = (String) iterator.next();
NameStyle nameStyle = NameStyle.getInstance(name);
UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
UpdateAction.UseMenuItem useMenuItem =new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
useMenuItem.setNameStyle(nameStyle);
createdMenu.add(useMenuItem);
}
@ -113,7 +150,9 @@ public class GlobalStyleMenuDef extends MenuDef {
}
public static class GlobalStyleSelection extends ElementCaseAction {
public static class GlobalStyleSelection extends SelectionListenerAction {
private NameStyle nameStyle;
@ -149,5 +188,14 @@ public class GlobalStyleMenuDef extends MenuDef {
stylePane.updateGlobalStyle(getEditingComponent());
return true;
}
public UseMenuItem createUseMenuItem() {
UseMenuItem useMenuItem = super.createUseMenuItem();
SelectionListener listener = createSelectionListener();
getEditingComponent().addSelectionChangeListener(listener);
useMenuItem.setSelectionListener(listener);
return useMenuItem;
}
}
}

3
designer/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -5,6 +5,7 @@ package com.fr.design.actions.file.export;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction;
import com.fr.design.gui.iprogressbar.FRProgressBar;
@ -139,7 +140,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter;
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter
|| exporter instanceof PDFExporter || exporter instanceof WordExporter) {
|| exporter instanceof PDFExporter || exporter instanceof PDFStreamExporter || exporter instanceof WordExporter) {
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)

3
designer/src/com/fr/design/actions/file/export/PDFExportAction.java

@ -10,6 +10,7 @@ import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.Inter;
import com.fr.io.exporter.Exporter;
import com.fr.io.exporter.PDFExporter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
/**
* Export pdf
@ -28,7 +29,7 @@ public class PDFExportAction extends AbstractExportAction {
@Override
protected Exporter getExporter() {
return new PDFExporter();
return new PDFStreamExporter();
}
@Override

9
designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -77,12 +77,11 @@ public class UserInfoPane extends BasicPane{
@Override
public void run() {
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
String loginResult = LoginWebBridge.getHelper().login(username, password);
if (loginResult.equals(LOGININ)) {
markSignIn(username);
}else {
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)){
markUnSignIn();
} else {
markSignIn(username);
}
}
});

27
designer_base/src/com/fr/design/actions/UpdateAction.java

@ -12,10 +12,13 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UICheckBoxMenuItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.menu.ShortCut;
import com.fr.design.selection.SelectionListener;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.ContainerEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Iterator;
@ -321,12 +324,24 @@ public abstract class UpdateAction extends ShortCut implements Action {
toolBar.add(this.createToolBarComponent());
}
public abstract static class ComponentRemoveEvent extends ComponentEvent {
private static int EVENT_DELETE= 3001;
public ComponentRemoveEvent(Component source) {
super(source, EVENT_DELETE);
}
public abstract void release(SelectionListener listener);
}
/**
* 全局style的菜单
*/
public static class UseMenuItem extends UIMenuItem {
private NameStyle nameStyle;
private SelectionListener listener;
public UseMenuItem(Action action) {
super(action);
@ -337,6 +352,18 @@ public abstract class UpdateAction extends ShortCut implements Action {
super(text, icon);
}
protected void processEvent(AWTEvent e) {
if (e instanceof ComponentRemoveEvent) {
((ComponentRemoveEvent) e).release(listener);
return;
}
super.processEvent(e);
}
public void setSelectionListener(SelectionListener listener) {
this.listener = listener;
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);

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

@ -117,7 +117,7 @@ public class QQLoginWebBridge {
//账号没有QQ授权
closeQQWindow();
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding")));
}catch (Exception exp) {
}
}

11
designer_base/src/com/fr/design/menu/MenuDef.java

@ -13,9 +13,7 @@ import javax.swing.*;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;
@ -164,11 +162,18 @@ public class MenuDef extends ShortCut {
createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath));
}
createdJMenu.addMenuListener(menuDefListener);
ContainerListener listener = getContainerListener();
if(listener != null){
createdJMenu.getPopupMenu().addContainerListener(listener);
}
}
return createdJMenu;
}
protected ContainerListener getContainerListener() {
return null;
}
/**
* 生成 JPopupMenu
* @return 弹出菜单

2
designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

@ -192,7 +192,7 @@ public class FormParaWidgetPane extends JPanel{
}
labelPane.add(label,BorderLayout.CENTER);
reportPane.add(labelPane,BorderLayout.SOUTH);
reportPane.setPreferredSize(new Dimension((int)jComponent.getPreferredSize().getWidth(),(int)reportPane.getPreferredSize().getHeight()));
reportPane.setPreferredSize(new Dimension((int)reportPane.getPreferredSize().getWidth(),(int)reportPane.getPreferredSize().getHeight()));
return reportPane;
}

Loading…
Cancel
Save