Browse Source

alphafine bug fix

master
XiaXiang 8 years ago
parent
commit
be32292bbd
  1. 6
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 16
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  3. 2
      designer/src/com/fr/start/Designer.java
  4. 9
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java
  5. 17
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java
  6. 1
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java
  7. 2
      designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java

6
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -122,8 +122,6 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
// lastUpdateTime = System.currentTimeMillis();
// waitingForSearch = true;
doSearch(searchTextField.getText());
}
});
@ -590,7 +588,7 @@ public class AlphaFineDialog extends UIDialog {
if (SwingUtilities.isLeftMouseButton(k)) {
Point p = k.getLocationOnScreen();
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds();
Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize());
Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize());
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) {
AlphaFineDialog.this.dispose();
forceOpen = false;
@ -614,7 +612,7 @@ public class AlphaFineDialog extends UIDialog {
KeyEvent e = (KeyEvent) event;
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore();
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString())) {
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFinePane.getAlphaFinePane().isVisible()) {
doClickAction();
}

16
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,12 +1,12 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -20,7 +20,7 @@ import java.awt.event.ActionListener;
public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane;
public static AlphaFinePane createAlphaFinePane() {
public static AlphaFinePane getAlphaFinePane() {
if (alphaFinePane == null) {
alphaFinePane = new AlphaFinePane();
}
@ -32,8 +32,8 @@ public class AlphaFinePane extends BasicPane {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
}
UIButton refreshButton = new UIButton();
refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Alphafine"));
refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("AlphaFine"));
refreshButton.set4ToolbarButton();
this.add(refreshButton);
refreshButton.addActionListener(new ActionListener() {
@ -42,11 +42,17 @@ public class AlphaFinePane extends BasicPane {
AlphaFineHelper.showAlphaFineDialog(false);
}
});
AlphaFineContext.addAlphafineContextListener(new AlphaFineListener() {
AlphaFineContext.addAlphaFineListener(new AlphaFineListener() {
@Override
public void showDialog() {
AlphaFineHelper.showAlphaFineDialog(true);
}
@Override
public void setEnable(boolean isEnable) {
alphaFinePane.setVisible(isEnable);
}
});
}

2
designer/src/com/fr/start/Designer.java

@ -346,7 +346,7 @@ public class Designer extends BaseDesigner {
* @return 面板组件
*/
public Component createAlphafinePane() {
return AlphaFinePane.createAlphaFinePane();
return AlphaFinePane.getAlphaFinePane();
}

9
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
@ -49,11 +50,15 @@ public class AlphaFineAction extends UpdateAction {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final AlphaFineConfigPane alphaFineConfigPane = new AlphaFineConfigPane();
alphaFineConfigPane.populate(DesignerEnvManager.getEnvManager().getAlphaFineConfigManager());
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (!FRContext.isChineseEnv()) {
manager.setSearchOnLine(false);
}
alphaFineConfigPane.populate(manager);
DialogActionListener dialogActionListener = new DialogActionAdapter() {
public void doOk() {
alphaFineConfigPane.update();
designerFrame.refreshToolbar();
AlphaFineContext.fireAlphaFineEnable(manager.isEnabled());
}
};
BasicDialog basicDialog = alphaFineConfigPane.showMediumWindow(designerFrame, dialogActionListener);

17
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java

@ -7,23 +7,30 @@ import java.util.List;
* Created by XiaXiang on 2017/5/27.
*/
public class AlphaFineContext {
private static List<AlphaFineListener> fireLoginContextListener = new ArrayList<AlphaFineListener>();
private static List<AlphaFineListener> fireAlphaFineListener = new ArrayList<AlphaFineListener>();
/**
* 触发AlphaFine弹窗
*/
public static void fireAlphaFineContextListener() {
for (AlphaFineListener l : fireLoginContextListener) {
public static void fireAlphaFineShowDialog() {
for (AlphaFineListener l : fireAlphaFineListener) {
l.showDialog();
}
}
public static void fireAlphaFineEnable(boolean isEnable) {
for (AlphaFineListener l : fireAlphaFineListener) {
l.setEnable(isEnable);
}
}
/**
* 添加一个弹出AlphaFine的监听事件
*
* @param l AlphaFine框弹出监听事件
*/
public static void addAlphafineContextListener(AlphaFineListener l) {
fireLoginContextListener.add(l);
public static void addAlphaFineListener(AlphaFineListener l) {
fireAlphaFineListener.add(l);
}
}

1
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java

@ -5,4 +5,5 @@ package com.fr.design.actions.help.alphafine;
*/
public interface AlphaFineListener {
void showDialog();
void setEnable(boolean isEnable);
}

2
designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java

@ -63,7 +63,7 @@ public class RemindPane extends JPanel {
public void mousePressed(MouseEvent e) {
manager.setOperateCount(0);
dialog.dispose();
AlphaFineContext.fireAlphaFineContextListener();
AlphaFineContext.fireAlphaFineShowDialog();
}
});

Loading…
Cancel
Save