Browse Source

alphafine bug fix 设置搜索

master
XiaXiang 8 years ago
parent
commit
28c21627b5
  1. 11
      designer/src/com/fr/design/actions/report/ReportEngineAttrAction.java
  2. 9
      designer/src/com/fr/design/actions/report/ReportPageSetupAction.java
  3. 5
      designer/src/com/fr/design/actions/report/ReportWebAttrAction.java
  4. 8
      designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java
  5. 5
      designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java
  6. 8
      designer/src/com/fr/design/webattr/EditReportServerParameterPane.java
  7. 11
      designer/src/com/fr/design/webattr/ReportWebAttrPane.java
  8. 2
      designer/src/com/fr/design/webattr/ReportWriteAttrPane.java
  9. 90
      designer_base/src/com/fr/design/actions/UpdateAction.java
  10. 6
      designer_base/src/com/fr/design/actions/server/ConnectionListAction.java
  11. 25
      designer_base/src/com/fr/design/gui/frpane/LoadingBasicPane.java

11
designer/src/com/fr/design/actions/report/ReportEngineAttrAction.java

@ -1,13 +1,12 @@
package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.LayerReportPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
@ -19,10 +18,8 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/reportEngineAttr.png"));
WorkSheetDesigner jws = getEditingComponent();
if (jws != null) {
this.setSearchText(new LayerReportPane(jws.getTemplateReport()));
}
this.setSearchText(new LayerReportPane(null));
}
private boolean isChange;

9
designer/src/com/fr/design/actions/report/ReportPageSetupAction.java

@ -3,19 +3,18 @@
*/
package com.fr.design.actions.report;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.PageSetupPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.report.TemplateReport;
import javax.swing.*;
/**
* PageSetup action.
*/

5
designer/src/com/fr/design/actions/report/ReportWebAttrAction.java

@ -3,8 +3,8 @@
*/
package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.actions.JWorkBookAction;
@ -16,7 +16,6 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.webattr.ReportWebAttrPane;
import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook;
import com.fr.base.ConfigManagerProvider;
import java.awt.event.ActionEvent;
@ -31,7 +30,7 @@ public class ReportWebAttrAction extends JWorkBookAction {
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/webreportattribute.png"));
this.setSearchText(new ReportWebAttrPane());
this.setSearchText(new ReportWebAttrPane().getAllComponents());
}
/**

8
designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java

@ -1,15 +1,13 @@
package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.LayerReportPane;
import com.fr.design.webattr.ReportWriteAttrPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
@ -23,6 +21,8 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/reportWriteAttr.png"));
this.setSearchText(new ReportWriteAttrPane(null).getAllComponents());
}
// ben:用来判断是否update

5
designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -3,8 +3,8 @@
*/
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
@ -15,7 +15,6 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -29,7 +28,7 @@ public class ServerConfigManagerAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/edit.png"));
this.setSearchText(new EditReportServerParameterPane());
this.setSearchText(new EditReportServerParameterPane().getAllComponents());
}
/**

8
designer/src/com/fr/design/webattr/EditReportServerParameterPane.java

@ -4,6 +4,7 @@
package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
@ -12,7 +13,6 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr;
@ -33,17 +33,17 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
//TODO 表单
// private FormToolBarPane formPane;
private WriteToolBarPane writePane;
private ReportWebAttr webAttr ;
private ReportWebAttr webAttr;
private WebCssPane cssPane;
private WebJsPane jsPane;
private ErrorTemplatePane errorTemplatePane;
@Override
protected void initComponents(JPanel container) {
protected synchronized void initComponents(JPanel container) {
JPanel defaultPane = container;
defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout());

11
designer/src/com/fr/design/webattr/ReportWebAttrPane.java

@ -3,18 +3,17 @@
*/
package com.fr.design.webattr;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundPane;
import com.fr.design.style.background.BackgroundPane4Browser;
import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane;
import com.fr.web.attr.ReportWebAttr;
import javax.swing.*;
import java.awt.*;
/**
* ReportWebAttr Dialog
*/
@ -37,7 +36,7 @@ public class ReportWebAttrPane extends LoadingBasicPane {
@Override
protected void initComponents(JPanel container) {
protected synchronized void initComponents(JPanel container) {
JPanel defaultPane = container;
defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout());

2
designer/src/com/fr/design/webattr/ReportWriteAttrPane.java

@ -25,7 +25,7 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
}
@Override
protected void initComponents(JPanel container) {
protected synchronized void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
final UITabbedPane tabbedPane = new UITabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
container.add(tabbedPane, BorderLayout.CENTER);

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

@ -6,23 +6,22 @@ package com.fr.design.actions;
import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.design.constants.UIConstants;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.constants.UIConstants;
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 org.apache.batik.apps.svgbrowser.JPEGOptionPanel;
import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
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;
@ -56,6 +55,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
private String searchText = StringUtils.EMPTY;
/**
* Constructor
*/
@ -434,10 +435,7 @@ public abstract class UpdateAction extends ShortCut implements Action {
}
public void setSearchText(JPanel panel) {
if (panel instanceof LoadingBasicPane) {
((LoadingBasicPane) panel).initForSearch();
}
this.searchText = getComponentTexts(panel, new StringBuffer());
this.searchText = getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer());
}
@ -450,59 +448,97 @@ public abstract class UpdateAction extends ShortCut implements Action {
}
/**
* 遍历面板中所有控件,获取text用于alphafine的action搜索
* 遍历面板中所有控件,获取text用于alphafine的action搜索,考虑分词拼音首字母检索
* @param panel
* @param stringBuffer
* @param separator
* @param text
* @param pinyin
* @param shortPinyin
* @return
*/
public String getComponentTexts(JPanel panel, StringBuffer stringBuffer) {
public String getComponentTexts(JPanel panel, String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin) {
Border border = panel.getBorder();
if (border instanceof TitledBorder) {
stringBuffer.append(((TitledBorder) border).getTitle());
String title = ((TitledBorder) border).getTitle();
text.append(title).append(separator);
pinyin.append(PinyinHelper.convertToPinyinString(title, "", PinyinFormat.WITHOUT_TONE)).append(separator);
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
}
Component[] components = panel.getComponents();
for (Component component : components) {
if (component instanceof JPanel) {
getComponentTexts((JPanel) component, stringBuffer);
getComponentTexts((JPanel) component, separator, text, pinyin, shortPinyin);
} else if (component instanceof JScrollPane) {
Component childComponent = ((JScrollPane) component).getViewport().getView();
if (childComponent instanceof JPanel) {
getComponentTexts((JPanel) childComponent, stringBuffer);
getComponentTexts((JPanel) childComponent, separator, text, pinyin, shortPinyin);
}
} else if (component instanceof JLabel) {
stringBuffer.append(((JLabel) component).getText());
String title = ((JLabel) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JCheckBox) {
stringBuffer.append(((JCheckBox) component).getText());
String title = ((JCheckBox) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JButton) {
stringBuffer.append(((JButton) component).getText());
String title = ((JButton) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JRadioButton) {
stringBuffer.append(((JRadioButton) component).getText());
String title = ((JRadioButton) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JComboBox) {
for (int i = 0; i < ((JComboBox) component).getItemCount(); i++) {
stringBuffer.append(((JComboBox) component).getItemAt(i));
text.append(((JComboBox) component).getItemAt(i));
String title = String.valueOf(((JComboBox) component).getItemAt(i));
handleSearchText(separator, text, pinyin, shortPinyin, title);
}
} else if (component instanceof JTabbedPane) {
getTabPaneTexts(stringBuffer, (JTabbedPane) component);
getTabPaneTexts((JTabbedPane) component, separator, text, pinyin, shortPinyin);
}
}
return String.valueOf(stringBuffer);
return String.valueOf(text.append(pinyin).append(shortPinyin));
}
/**
* 递归遍历tabbedPane
* @param stringBuffer
* @param component
* @param separator
* @param text
* @param pinyin
* @param shortPinyin
*/
private void getTabPaneTexts(StringBuffer stringBuffer, JTabbedPane component) {
private synchronized void getTabPaneTexts(JTabbedPane component, String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin) {
for (int i = 0; i < component.getTabCount(); i++) {
stringBuffer.append(component.getTitleAt(i));
Component tabComponent = component.getComponentAt(i);
String title = component.getTitleAt(i);
handleSearchText(separator, text, pinyin, shortPinyin, title);
Component tabComponent = component.getComponentAt(i);
if (tabComponent instanceof JPanel) {
getComponentTexts((JPanel) tabComponent, stringBuffer);
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin);
} else if (tabComponent instanceof JTabbedPane) {
getTabPaneTexts(stringBuffer, (JTabbedPane) tabComponent);
getTabPaneTexts((JTabbedPane) tabComponent, separator, text, pinyin, shortPinyin);
}
}
}
/**
* 将text,pinyin,pinyin首字母拼接到一起
* @param separator
* @param text
* @param pinyin
* @param shortPinyin
* @param title
*/
private void handleSearchText(String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin, String title) {
if (StringUtils.isBlank(title)) {
return;
}
text.append(title).append(separator);
pinyin.append(PinyinHelper.convertToPinyinString(title, "", PinyinFormat.WITHOUT_TONE));
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
}
}

6
designer_base/src/com/fr/design/actions/server/ConnectionListAction.java

@ -1,6 +1,5 @@
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable;
@ -9,6 +8,7 @@ import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
@ -16,6 +16,7 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -31,7 +32,8 @@ public class ConnectionListAction extends UpdateAction {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
this.setSearchText(new DatabaseConnectionPane.JDBC());
}
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {

25
designer_base/src/com/fr/design/gui/frpane/LoadingBasicPane.java

@ -3,19 +3,14 @@
*/
package com.fr.design.gui.frpane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* @author richer
@ -46,6 +41,7 @@ public abstract class LoadingBasicPane extends BasicPane {
}.execute();
}
private void initCards() {
card = new CardLayout();
setLayout(card);
@ -75,10 +71,13 @@ public abstract class LoadingBasicPane extends BasicPane {
}
/**
* 为了alphafine搜索需要初始化的时候加载一次组件
* 为了alphafine搜索使用预加载面板控件获取全部控件的信息
* @return
*/
public void initForSearch() {
initComponents(new JPanel());
public JPanel getAllComponents() {
JPanel panel = new JPanel();
initComponents(panel);
return panel;
}
/**

Loading…
Cancel
Save