Kobi
2 months ago
85 changed files with 821 additions and 913 deletions
@ -0,0 +1,37 @@ |
|||||||
|
package com.fine.theme.light.ui; |
||||||
|
|
||||||
|
import com.formdev.flatlaf.ui.FlatComboBoxUI; |
||||||
|
|
||||||
|
import javax.swing.JComponent; |
||||||
|
import javax.swing.UIManager; |
||||||
|
import javax.swing.plaf.ComponentUI; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* {@link com.fr.design.gui.icombocheckbox.UIComboCheckBox} 的 UI 样式 |
||||||
|
* |
||||||
|
* @author lemon |
||||||
|
* @since 12.0 |
||||||
|
* Created on 2024/09/27 |
||||||
|
*/ |
||||||
|
public class FineComboCheckBoxUI extends FlatComboBoxUI { |
||||||
|
|
||||||
|
public FineComboCheckBoxUI() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建UI |
||||||
|
*/ |
||||||
|
public static ComponentUI createUI(JComponent c) { |
||||||
|
return new FineComboCheckBoxUI(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void installUI(JComponent c) { |
||||||
|
super.installUI(c); |
||||||
|
c.setBackground(UIManager.getColor("ComboCheckBox.background")); |
||||||
|
c.setBorder(UIManager.getBorder("ComboCheckBox.border")); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1 +1 @@ |
|||||||
package com.fr.design.roleAuthority;
import com.fr.base.FRContext;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader;
import com.fr.log.FineLoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色
* <p/>
* Author : daisy
* Date: 13-8-30
* Time: 下午3:42
*/
public class RoleDataWrapper implements ChildrenNodesLoader {
private List<String> rolelist = new ArrayList<String>();
private String roleTypename = null;
public RoleDataWrapper(String roleName) {
roleTypename = roleName;
}
/**
* 在此计算并获得与管理类型相对应的
*/
private void calculateRoleList() {
try {
Collections.addAll(rolelist, FRContext.getOrganizationOperator().getRoleGroup());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
//加载所有的角色列表
public ExpandMutableTreeNode[] load() {
calculateRoleList();
return this.load(this.rolelist);
}
//从workbook中读取的角色列表
public ExpandMutableTreeNode[] load(List<String> rolelist) {
this.rolelist = rolelist;
ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()];
for (int i = 0; i < res.length; i++) {
res[i] = new ExpandMutableTreeNode(rolelist.get(i));
}
return res;
}
public String getRoleTypename(){
return roleTypename;
}
} |
package com.fr.design.roleAuthority;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色
* <p/>
* Author : daisy
* Date: 13-8-30
* Time: 下午3:42
*/
public class RoleDataWrapper implements ChildrenNodesLoader {
private List<String> rolelist = new ArrayList<String>();
private String roleTypename = null;
public RoleDataWrapper(String roleName) {
roleTypename = roleName;
}
/**
* 在此计算并获得与管理类型相对应的
*/
private void calculateRoleList() {
try {
Collections.addAll(rolelist, RemoteAuthorityRepository.getInstance().getRoleGroup());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
//加载所有的角色列表
public ExpandMutableTreeNode[] load() {
calculateRoleList();
return this.load(this.rolelist);
}
//从workbook中读取的角色列表
public ExpandMutableTreeNode[] load(List<String> rolelist) {
this.rolelist = rolelist;
ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()];
for (int i = 0; i < res.length; i++) {
res[i] = new ExpandMutableTreeNode(rolelist.get(i));
}
return res;
}
public String getRoleTypename(){
return roleTypename;
}
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.fr.design.gui.storybook.components; |
||||||
|
|
||||||
|
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.storybook.StoryBoard; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
import static com.fine.swing.ui.layout.Layouts.cell; |
||||||
|
import static com.fine.swing.ui.layout.Layouts.flex; |
||||||
|
|
||||||
|
public class ComboCheckBoxStoryBoard extends StoryBoard { |
||||||
|
public ComboCheckBoxStoryBoard() { |
||||||
|
super("下拉多选框"); |
||||||
|
|
||||||
|
|
||||||
|
add( |
||||||
|
cell(new UILabel("普通状态")).with(this::h3), |
||||||
|
cell(getComboCheckBox(ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4"))), |
||||||
|
|
||||||
|
cell(new UILabel("长文字状态")).with(this::h3), |
||||||
|
cell(getComboCheckBox(ArrayUtils.toArray("测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1", |
||||||
|
"测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2", |
||||||
|
"测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3", |
||||||
|
"测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4"))), |
||||||
|
|
||||||
|
flex() |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
private UIComboCheckBox getComboCheckBox(Object[] array) { |
||||||
|
return new UIComboCheckBox(array, true) { |
||||||
|
protected void setLayoutAndAddComponents() { |
||||||
|
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
|
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
JPanel pane = getClickPane(); |
||||||
|
pane.setOpaque(false); |
||||||
|
this.add(pane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue