forked from fanruan/design
Browse Source
* commit '5ed311f92a8b4ad89d8ebb1dce4abae4db864b4b': 无JIRA任务 组件共享异步加载组件 无JIRA任务 严格限制dialog的交互之后ctrl z撤销之前必须先关闭帮助弹框,这边就直接删掉了 无JIRA任务 组件共享的一些交互改进和验收的bug修改master
8 changed files with 231 additions and 76 deletions
@ -0,0 +1,13 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
/** |
||||
* Coder: zack |
||||
* Date: 2016/11/3 |
||||
* Time: 10:43 |
||||
*/ |
||||
public interface HelpDialogHandler { |
||||
/** |
||||
* 销毁 |
||||
*/ |
||||
void destroyHelpDialog(); |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
/** |
||||
* 帮助信息的面板由于需要滚动条所以采用了很挫的dialog做,dialog很多情况下不能主动关闭,这边控制一下 |
||||
* Coder: zack |
||||
* Date: 2016/11/2 |
||||
* Time: 16:34 |
||||
*/ |
||||
public class HelpDialogManager { |
||||
private static HelpDialogManager THIS; |
||||
private HelpDialogHandler handler; |
||||
|
||||
private HelpDialogManager() { |
||||
|
||||
} |
||||
|
||||
public HelpDialogHandler getPane() { |
||||
return handler; |
||||
} |
||||
|
||||
public void setPane(HelpDialogHandler dialog) { |
||||
if (dialog == this.handler) { |
||||
return; |
||||
} |
||||
//只允许一个dialog存在
|
||||
if (this.handler != null) { |
||||
handler.destroyHelpDialog(); |
||||
} |
||||
this.handler = dialog; |
||||
} |
||||
|
||||
public static HelpDialogManager getInstance() { |
||||
if (THIS == null) { |
||||
THIS = new HelpDialogManager(); |
||||
} |
||||
return THIS; |
||||
} |
||||
|
||||
public void destroyDialog() { |
||||
if (handler != null) { |
||||
handler.destroyHelpDialog(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,97 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.icon.IconPathConstants; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created with IntelliJ IDEA. |
||||
* User: zx |
||||
* Date: 14-7-24 |
||||
* Time: 上午9:09 |
||||
*/ |
||||
public class CoverPane extends JPanel { |
||||
|
||||
private UIButton editButton; |
||||
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); |
||||
|
||||
public CoverPane() { |
||||
setLayout(getCoverLayout()); |
||||
setBackground(null); |
||||
setOpaque(false); |
||||
|
||||
editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(60, 24); |
||||
} |
||||
}; |
||||
editButton.setBorderPainted(false); |
||||
editButton.setExtraPainted(false); |
||||
editButton.setBackground(new Color(176, 196, 222)); |
||||
add(editButton); |
||||
} |
||||
|
||||
public AlphaComposite getComposite() { |
||||
return composite; |
||||
} |
||||
|
||||
public void setComposite(AlphaComposite composite) { |
||||
this.composite = composite; |
||||
} |
||||
|
||||
public UIButton getEditButton() { |
||||
return editButton; |
||||
} |
||||
|
||||
public void setEditButton(UIButton editButton) { |
||||
this.editButton = editButton; |
||||
} |
||||
|
||||
protected LayoutManager getCoverLayout() { |
||||
return new LayoutManager() { |
||||
|
||||
@Override |
||||
public void removeLayoutComponent(Component comp) { |
||||
} |
||||
|
||||
@Override |
||||
public Dimension preferredLayoutSize(Container parent) { |
||||
return parent.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension minimumLayoutSize(Container parent) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void layoutContainer(Container parent) { |
||||
int width = parent.getParent().getWidth(); |
||||
int height = parent.getParent().getHeight(); |
||||
int preferWidth = editButton.getPreferredSize().width; |
||||
int preferHeight = editButton.getPreferredSize().height; |
||||
editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); |
||||
} |
||||
|
||||
@Override |
||||
public void addLayoutComponent(String name, Component comp) { |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
public void paint(Graphics g) { |
||||
Graphics2D g2d = (Graphics2D) g; |
||||
Composite oldComposite = g2d.getComposite(); |
||||
g2d.setComposite(composite); |
||||
g2d.setColor(Color.white); |
||||
g2d.fillRect(0, 0, getWidth(), getHeight()); |
||||
g2d.setComposite(oldComposite); |
||||
super.paint(g); |
||||
} |
||||
} |
Loading…
Reference in new issue