Browse Source
Merge in DESIGN/design from ~STARRYI/design:release-merge-to-final to final/11.0 * commit '9af28428108042d7fbf92688dd5887b7e63f1cfe': REPORT-61108 【视觉验收】--主题获取 REPORT-61267 【FR11】【组件背景分离】组件复用-组件标题图案的“图案相对位置”切换不生效了,只有在重新上传图案的时候才生效;“位置”也不生效new-design
starryi
3 years ago
12 changed files with 168 additions and 67 deletions
@ -0,0 +1,49 @@ |
|||||||
|
package com.fr.design.mainframe.share.ui.actions; |
||||||
|
|
||||||
|
import com.fr.design.gui.imenu.UIMenuItem; |
||||||
|
import com.fr.design.mainframe.share.ui.constants.ColorConstants; |
||||||
|
|
||||||
|
import javax.swing.Action; |
||||||
|
import javax.swing.BorderFactory; |
||||||
|
import javax.swing.SwingConstants; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.awt.Insets; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Starryi |
||||||
|
* @version 1.0 |
||||||
|
* Created by Starryi on 2021/10/20 |
||||||
|
*/ |
||||||
|
public class SharedComponentMenuItem extends UIMenuItem { |
||||||
|
public SharedComponentMenuItem(Action action) { |
||||||
|
super(action); |
||||||
|
setBackground(ColorConstants.BACKGROUND); |
||||||
|
setUI(new SharedComponentMenuItemUI()); |
||||||
|
setHorizontalAlignment(SwingConstants.LEFT); |
||||||
|
setVerticalAlignment(SwingConstants.CENTER); |
||||||
|
setBorder(BorderFactory.createEmptyBorder()); |
||||||
|
setIcon(null); |
||||||
|
setIconTextGap(4); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Dimension getPreferredSize() { |
||||||
|
Dimension dimension = super.getPreferredSize(); |
||||||
|
return new Dimension(dimension.width, dimension.height + 8); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Dimension getMinimumSize() { |
||||||
|
return new Dimension(0, 0); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Insets getInsets() { |
||||||
|
return new Insets(0, 0, 0, 0); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getText() { |
||||||
|
return super.getText().trim(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.fr.design.mainframe.share.ui.actions; |
||||||
|
|
||||||
|
import com.fr.design.actions.UpdateAction; |
||||||
|
import com.fr.design.gui.imenu.UIMenuItem; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Starryi |
||||||
|
* @version 1.0 |
||||||
|
* Created by Starryi on 2021/10/20 |
||||||
|
*/ |
||||||
|
public abstract class SharedComponentPopupAction extends UpdateAction { |
||||||
|
@Override |
||||||
|
public UIMenuItem createMenuItem() { |
||||||
|
Object object = this.getValue(SharedComponentMenuItem.class.getName()); |
||||||
|
if (object == null) { |
||||||
|
SharedComponentMenuItem menuItem = newSharedComponentMenuItem(); |
||||||
|
// 设置名字用作单元测
|
||||||
|
menuItem.setName(getName()); |
||||||
|
setPressedIcon4Button(menuItem); |
||||||
|
setDisabledIcon4Button(menuItem); |
||||||
|
object = menuItem; |
||||||
|
|
||||||
|
this.putValue(SharedComponentMenuItem.class.getName(), object); |
||||||
|
} |
||||||
|
return (SharedComponentMenuItem) object; |
||||||
|
} |
||||||
|
|
||||||
|
protected SharedComponentMenuItem newSharedComponentMenuItem() { |
||||||
|
return new SharedComponentMenuItem(this); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.fr.design.mainframe.share.ui.actions; |
||||||
|
|
||||||
|
import com.fr.design.gui.imenu.UIPopupMenu; |
||||||
|
|
||||||
|
import javax.swing.BorderFactory; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.awt.Insets; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Starryi |
||||||
|
* @version 1.0 |
||||||
|
* Created by Starryi on 2021/10/20 |
||||||
|
*/ |
||||||
|
public class SharedComponentPopupMenu extends UIPopupMenu { |
||||||
|
public SharedComponentPopupMenu() { |
||||||
|
setBorder(BorderFactory.createEmptyBorder()); |
||||||
|
setRadius(2); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Insets getInsets() { |
||||||
|
return new Insets(2, 2, 2, 2); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Dimension getMinimumSize() { |
||||||
|
Dimension dimension = super.getMinimumSize(); |
||||||
|
dimension.width = 0; |
||||||
|
dimension.height = 0; |
||||||
|
return dimension; |
||||||
|
} |
||||||
|
} |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 49 KiB |
Loading…
Reference in new issue