130 changed files with 2691 additions and 827 deletions
@ -0,0 +1,102 @@
|
||||
package com.fr.design.report.mobile; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.mobile.ElementCaseMobileAttr; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/8. |
||||
*/ |
||||
public class ReportMobileTemplateSettingsPane extends BasicBeanPane<ElementCaseMobileAttr> { |
||||
|
||||
private UICheckBox mobileCanvasSizeCheck; // 设置为手机模版画布大小
|
||||
|
||||
public ReportMobileTemplateSettingsPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); |
||||
|
||||
JPanel contentPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
||||
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, 0, 0)); |
||||
|
||||
contentPane.add(getMobileCanvasSizeCheckPane(), BorderLayout.CENTER); |
||||
|
||||
borderPane.add(contentPane); |
||||
this.add(borderPane); |
||||
} |
||||
|
||||
private JPanel getMobileCanvasSizeCheckPane() { |
||||
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
||||
mobileCanvasSizeCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Canvas_Size")); |
||||
panel.add(mobileCanvasSizeCheck, BorderLayout.NORTH); |
||||
panel.add(getCanvasDescPane(), BorderLayout.CENTER); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); |
||||
return panel; |
||||
} |
||||
|
||||
private JPanel getCanvasDescPane() { |
||||
|
||||
UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Match_Desc")); |
||||
UILabel desc2 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_In_Desc")); |
||||
UILabel desc3 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_Out_Desc")); |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{desc1, null}, |
||||
new Component[]{desc2, null}, |
||||
new Component[]{desc3, null} |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L7, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0)); |
||||
return panel; |
||||
} |
||||
|
||||
private UILabel createDescLabel(String desc) { |
||||
UILabel label = new UILabel(desc); |
||||
label.setForeground(Color.gray); |
||||
return label; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ElementCaseMobileAttr ob) { |
||||
if (ob == null) { |
||||
ob = new ElementCaseMobileAttr(); |
||||
} |
||||
mobileCanvasSizeCheck.setSelected(ob.isMobileCanvasSize()); |
||||
} |
||||
|
||||
@Override |
||||
public ElementCaseMobileAttr updateBean() { |
||||
ElementCaseMobileAttr mobileAttr = new ElementCaseMobileAttr(); |
||||
mobileAttr.setMobileCanvasSize(mobileCanvasSizeCheck.isSelected()); |
||||
return mobileAttr; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ElementCaseMobileAttr mobileAttr) { |
||||
if(mobileAttr != null) { |
||||
mobileAttr.setMobileCanvasSize(mobileCanvasSizeCheck.isSelected()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Template_Settings"); |
||||
} |
||||
} |
@ -1 +1 @@
|
||||
package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*;
/**
* Author : daisy
* Date: 13-8-30
* Time: 上午10:12
*/
public class AllowAuthorityEditAction extends TemplateComponentAction {
public AllowAuthorityEditAction(TargetComponent t) {
super(t);
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png"));
}
/**
* 撤销
*/
public void prepare4Undo() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState();
}
/**
* 执行动作
*
* @return 是否执行成功
*/
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc == null) {
return false;
}
cleanAuthorityCondition();
//进入时是格式刷则取消格式刷
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
tc.cancelFormat();
}
BaseUtils.setAuthorityEditing(true);
ReportAndFSManagePane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance());
DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY);
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane());
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//画虚线
return true;
}
/**
* 进入权限编辑之前将权限编辑界面重置一下工具栏
*/
private void cleanAuthorityCondition() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
opendedTemplate.get(i).cleanAuthorityUndo();
}
}
} |
||||
package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*;
/**
* Author : daisy
* Date: 13-8-30
* Time: 上午10:12
*/
public class AllowAuthorityEditAction extends TemplateComponentAction {
public AllowAuthorityEditAction(TargetComponent t) {
super(t);
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png"));
}
/**
* 撤销
*/
public void prepare4Undo() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState();
}
/**
* 执行动作
*
* @return 是否执行成功
*/
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc == null) {
return false;
}
cleanAuthorityCondition();
//进入时是格式刷则取消格式刷
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
tc.cancelFormat();
}
DesignerMode.setMode(DesignerMode.AUTHORITY);
ReportAndFSManagePane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance());
DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY);
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane());
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//画虚线
return true;
}
/**
* 进入权限编辑之前将权限编辑界面重置一下工具栏
*/
private void cleanAuthorityCondition() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
opendedTemplate.get(i).cleanAuthorityUndo();
}
}
} |
@ -0,0 +1,467 @@
|
||||
package com.fr.design.gui.controlpane; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.design.gui.ilist.UIList; |
||||
import com.fr.design.gui.itoolbar.UIToolBarUI; |
||||
import com.fr.design.gui.itoolbar.UIToolbar; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.design.menu.ToolBarDef; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.stable.StringUtils; |
||||
import sun.swing.DefaultLookup; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.event.ListSelectionEvent; |
||||
import javax.swing.event.ListSelectionListener; |
||||
import java.awt.*; |
||||
import java.awt.event.*; |
||||
import java.util.Arrays; |
||||
import java.util.Comparator; |
||||
|
||||
/** |
||||
* 简单列表面板 |
||||
* Created by plough on 2018/2/1. |
||||
*/ |
||||
public class UISimpleListControlPane extends BasicPane { |
||||
public static final String LIST_NAME = "UISimpleControl_List"; |
||||
|
||||
protected UIList nameList; |
||||
protected String selectedName; |
||||
private ShortCut4JControlPane[] shorts; |
||||
private ToolBarDef toolbarDef; |
||||
private UIToolbar toolBar; |
||||
|
||||
public UISimpleListControlPane() { |
||||
initComponentPane(); |
||||
} |
||||
|
||||
public ShortCut4JControlPane[] getShorts() { |
||||
return shorts; |
||||
} |
||||
|
||||
protected void initComponentPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.add(getContentPane(), BorderLayout.CENTER); |
||||
this.checkButtonEnabled(); |
||||
} |
||||
|
||||
protected JPanel getContentPane() { |
||||
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
|
||||
JPanel listPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
initListPane(listPane); |
||||
contentPane.add(listPane, BorderLayout.CENTER); |
||||
|
||||
shorts = this.createShortcuts(); |
||||
if (ArrayUtils.isEmpty(shorts)) { |
||||
return contentPane; |
||||
} |
||||
|
||||
toolbarDef = new ToolBarDef(); |
||||
for (ShortCut4JControlPane sj : shorts) { |
||||
toolbarDef.addShortCut(sj.getShortCut()); |
||||
} |
||||
toolBar = ToolBarDef.createJToolBar(); |
||||
toolBar.setUI(new UIToolBarUI(){ |
||||
@Override |
||||
public void paint(Graphics g, JComponent c) { |
||||
Graphics2D g2 = (Graphics2D) g; |
||||
g2.setColor(Color.WHITE); |
||||
g2.fillRect(0, 0, c.getWidth(), c.getHeight()); |
||||
} |
||||
}); |
||||
toolbarDef.updateToolBar(toolBar); |
||||
// 封装一层,加边框
|
||||
JPanel toolBarPane = new JPanel(new BorderLayout()); |
||||
toolBarPane.add(toolBar, BorderLayout.CENTER); |
||||
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, UIConstants.RULER_LINE_COLOR)); |
||||
|
||||
listPane.add(toolBarPane, BorderLayout.NORTH); |
||||
|
||||
return contentPane; |
||||
} |
||||
|
||||
protected ShortCut4JControlPane[] createShortcuts() { |
||||
return new ShortCut4JControlPane[]{ |
||||
moveUpItemShortCut(), |
||||
moveDownItemShortCut(), |
||||
sortItemShortCut(), |
||||
}; |
||||
} |
||||
|
||||
protected void initListPane(JPanel listPane) { |
||||
nameList = createJNameList(); |
||||
nameList.setName(LIST_NAME); |
||||
nameList.setSelectionBackground(UIConstants.ATTRIBUTE_PRESS); |
||||
listPane.add(new UIScrollPane(nameList), BorderLayout.CENTER); |
||||
|
||||
|
||||
nameList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
||||
nameList.addMouseListener(listMouseListener); |
||||
nameList.addListSelectionListener(new ListSelectionListener() { |
||||
public void valueChanged(ListSelectionEvent evt) { |
||||
// richie:避免多次update和populate大大降低效率
|
||||
if (!evt.getValueIsAdjusting()) { |
||||
UISimpleListControlPane.this.checkButtonEnabled(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public UIList createJNameList() { |
||||
UIList nameList = new UIList(new DefaultListModel()) { |
||||
@Override |
||||
public int locationToIndex(Point location) { |
||||
int index = super.locationToIndex(location); |
||||
if (index != -1 && !getCellBounds(index, index).contains(location)) { |
||||
return -1; |
||||
} |
||||
else { |
||||
return index; |
||||
} |
||||
} |
||||
}; |
||||
nameList.setCellRenderer(new NameableListCellRenderer(this)); |
||||
return nameList; |
||||
} |
||||
|
||||
protected ShortCut4JControlPane moveUpItemShortCut() { |
||||
return new NormalEnableShortCut(new MoveUpItemAction()); |
||||
} |
||||
|
||||
protected ShortCut4JControlPane moveDownItemShortCut() { |
||||
return new NormalEnableShortCut(new MoveDownItemAction()); |
||||
} |
||||
|
||||
protected ShortCut4JControlPane sortItemShortCut() { |
||||
return new NormalEnableShortCut(new SortItemAction()); |
||||
} |
||||
|
||||
public Nameable[] update() { |
||||
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>(); |
||||
DefaultListModel listModel = (DefaultListModel) this.nameList.getModel(); |
||||
for (int i = 0, len = listModel.getSize(); i < len; i++) { |
||||
res.add(((ListModelElement) listModel.getElementAt(i)).wrapper); |
||||
} |
||||
|
||||
return res.toArray(new Nameable[res.size()]); |
||||
} |
||||
|
||||
public void populate(Nameable[] nameableArray) { |
||||
DefaultListModel listModel = (DefaultListModel) this.nameList.getModel(); |
||||
listModel.removeAllElements(); |
||||
if (ArrayUtils.isEmpty(nameableArray)) { |
||||
return; |
||||
} |
||||
|
||||
listModel.setSize(nameableArray.length); |
||||
for (int i = 0; i < nameableArray.length; i++) { |
||||
listModel.set(i, new ListModelElement(nameableArray[i])); |
||||
} |
||||
if (listModel.size() > 0 || this.nameList.getSelectedIndex() != 0) { |
||||
this.nameList.setSelectedIndex(0); |
||||
} |
||||
this.checkButtonEnabled(); |
||||
} |
||||
|
||||
/** |
||||
* 根据name,选中UINameEdList中的item |
||||
*/ |
||||
public void setSelectedName(String name) { |
||||
DefaultListModel listModel = (DefaultListModel) this.nameList.getModel(); |
||||
for (int i = 0, len = listModel.getSize(); i < len; i++) { |
||||
Nameable item = ((ListModelElement) listModel.getElementAt(i)).wrapper; |
||||
if (ComparatorUtils.equals(name, item.getName())) { |
||||
this.nameList.setSelectedIndex(i); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取选中的名字 |
||||
*/ |
||||
public String getSelectedName() { |
||||
ListModelElement el = (ListModelElement) this.nameList.getSelectedValue(); |
||||
|
||||
return el == null ? null : el.wrapper.getName(); |
||||
} |
||||
|
||||
protected DefaultListModel getModel() { |
||||
return (DefaultListModel) this.nameList.getModel(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
/* |
||||
* 上移Item |
||||
*/ |
||||
private class MoveUpItemAction extends UpdateAction { |
||||
public MoveUpItemAction() { |
||||
this.setName(Inter.getLocText("Utils-Move_Up")); |
||||
this.setMnemonic('U'); |
||||
this.setSmallIcon(BaseUtils |
||||
.readIcon("/com/fr/design/images/control/up.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
int selectedIndex = nameList.getSelectedIndex(); |
||||
if (selectedIndex == -1) { |
||||
return; |
||||
} |
||||
|
||||
// 上移
|
||||
if (selectedIndex > 0) { |
||||
DefaultListModel listModel = (DefaultListModel) nameList.getModel(); |
||||
|
||||
Object prevObj = listModel.get(selectedIndex - 1); |
||||
Object currentObj = listModel.get(selectedIndex); |
||||
listModel.set(selectedIndex - 1, currentObj); |
||||
listModel.set(selectedIndex, prevObj); |
||||
|
||||
nameList.setSelectedIndex(selectedIndex - 1); |
||||
nameList.ensureIndexIsVisible(selectedIndex - 1); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* 下移Item |
||||
*/ |
||||
private class MoveDownItemAction extends UpdateAction { |
||||
public MoveDownItemAction() { |
||||
this.setName(Inter.getLocText("Utils-Move_Down")); |
||||
this.setMnemonic('D'); |
||||
this.setSmallIcon(BaseUtils |
||||
.readIcon("/com/fr/design/images/control/down.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
int selectedIndex = nameList.getSelectedIndex(); |
||||
if (selectedIndex == -1) { |
||||
return; |
||||
} |
||||
|
||||
if (selectedIndex < nameList.getModel().getSize() - 1) { |
||||
DefaultListModel listModel = (DefaultListModel) nameList.getModel(); |
||||
|
||||
Object nextObj = listModel.get(selectedIndex + 1); |
||||
Object currentObj = listModel.get(selectedIndex); |
||||
listModel.set(selectedIndex + 1, currentObj); |
||||
listModel.set(selectedIndex, nextObj); |
||||
|
||||
nameList.setSelectedIndex(selectedIndex + 1); |
||||
nameList.ensureIndexIsVisible(selectedIndex + 1); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private class SortItemAction extends UpdateAction { |
||||
private boolean isAtoZ = false; |
||||
|
||||
public SortItemAction() { |
||||
this.setName(Inter.getLocText("FR-Action_Sort")); |
||||
this.setMnemonic('S'); |
||||
this.setSmallIcon(BaseUtils |
||||
.readIcon("/com/fr/design/images/control/sortAsc.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
// p:选中的值.
|
||||
Object selectedValue = nameList.getSelectedValue(); |
||||
|
||||
DefaultListModel listModel = (DefaultListModel) nameList.getModel(); |
||||
if (listModel.getSize() <= 0) { |
||||
return; |
||||
} |
||||
Nameable[] nameableArray = new Nameable[listModel.getSize()]; |
||||
|
||||
for (int i = 0; i < listModel.getSize(); i++) { |
||||
nameableArray[i] = ((ListModelElement) listModel.getElementAt(i)).wrapper; |
||||
} |
||||
|
||||
// p:排序.
|
||||
if (isAtoZ) { // 升序
|
||||
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
||||
@Override |
||||
public int compare(Nameable o1, Nameable o2) { |
||||
return ComparatorUtils.compare(o2.getName(), o1.getName()); |
||||
} |
||||
}; |
||||
isAtoZ = !isAtoZ; |
||||
Arrays.sort(nameableArray, nameableComparator); |
||||
} else { // 降序
|
||||
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() { |
||||
@Override |
||||
public int compare(Nameable o1, Nameable o2) { |
||||
return ComparatorUtils.compare(o1.getName(), o2 |
||||
.getName()); |
||||
} |
||||
}; |
||||
isAtoZ = !isAtoZ; |
||||
Arrays.sort(nameableArray, nameableComparator); |
||||
} |
||||
|
||||
for (int i = 0; i < nameableArray.length; i++) { |
||||
listModel.set(i, new ListModelElement(nameableArray[i])); |
||||
} |
||||
|
||||
// p:需要选中以前的那个值.
|
||||
if (selectedValue != null) { |
||||
nameList.setSelectedValue(selectedValue, true); |
||||
} |
||||
|
||||
checkButtonEnabled(); |
||||
// p:需要repaint.
|
||||
nameList.repaint(); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* UIList的鼠标事件 |
||||
*/ |
||||
private MouseListener listMouseListener = new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
JList list = (JList) e.getSource(); |
||||
if (list.locationToIndex(e.getPoint()) == -1 && !e.isShiftDown() |
||||
&& !isMenuShortcutKeyDown(e)) { |
||||
list.clearSelection(); |
||||
} |
||||
} |
||||
|
||||
private boolean isMenuShortcutKeyDown(InputEvent event) { |
||||
return (event.getModifiers() & Toolkit.getDefaultToolkit() |
||||
.getMenuShortcutKeyMask()) != 0; |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 检查按钮可用状态 Check button enabled. |
||||
*/ |
||||
public void checkButtonEnabled() { |
||||
for (ShortCut4JControlPane sj : getShorts()) { |
||||
sj.checkEnable(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置选中项 |
||||
* |
||||
* @param index 选中项的序列号 |
||||
*/ |
||||
public void setSelectedIndex(int index) { |
||||
nameList.setSelectedIndex(index); |
||||
} |
||||
|
||||
|
||||
public class NormalEnableShortCut extends ShortCut4JControlPane { |
||||
public NormalEnableShortCut(ShortCut shortCut) { |
||||
this.shortCut = shortCut; |
||||
} |
||||
|
||||
/** |
||||
* 检查是否可用 |
||||
*/ |
||||
@Override |
||||
public void checkEnable() { |
||||
this.shortCut.setEnabled(getModel() |
||||
.getSize() > 0 |
||||
&& UISimpleListControlPane.this.nameList.getSelectedIndex() != -1); |
||||
} |
||||
} |
||||
|
||||
|
||||
private class NameableListCellRenderer extends |
||||
JPanel implements ListCellRenderer { |
||||
|
||||
private UILabel label; |
||||
private UISimpleListControlPane listControlPane; |
||||
private Color initialLabelForeground; |
||||
|
||||
public NameableListCellRenderer(UISimpleListControlPane listControlPane) { |
||||
super(); |
||||
this.listControlPane = listControlPane; |
||||
initComponents(); |
||||
setOpaque(true); |
||||
setBorder(getNoFocusBorder()); |
||||
setName("List.cellRenderer"); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
label = new UILabel(); |
||||
label.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 0)); |
||||
initialLabelForeground = label.getForeground(); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(label, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private Border getNoFocusBorder() { |
||||
return BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LIST_ITEM_SPLIT_LINE); |
||||
} |
||||
|
||||
private void setText(String t) { |
||||
label.setText(t); |
||||
} |
||||
|
||||
@Override |
||||
public Component getListCellRendererComponent(JList list, Object value, |
||||
int index, boolean isSelected, boolean cellHasFocus) { |
||||
setComponentOrientation(list.getComponentOrientation()); |
||||
|
||||
Color bg = null; |
||||
Color fg = null; |
||||
|
||||
JList.DropLocation dropLocation = list.getDropLocation(); |
||||
if (dropLocation != null |
||||
&& !dropLocation.isInsert() |
||||
&& dropLocation.getIndex() == index) { |
||||
|
||||
bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground"); |
||||
fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground"); |
||||
|
||||
isSelected = true; |
||||
} |
||||
|
||||
if (isSelected) { |
||||
setBackground(bg == null ? list.getSelectionBackground() : bg); |
||||
setForeground(fg == null ? list.getSelectionForeground() : fg); |
||||
label.setForeground(Color.WHITE); |
||||
} |
||||
else { |
||||
setBackground(list.getBackground()); |
||||
setForeground(list.getForeground()); |
||||
label.setForeground(initialLabelForeground); |
||||
} |
||||
|
||||
setText((value == null) ? StringUtils.EMPTY : value.toString()); |
||||
|
||||
setEnabled(list.isEnabled()); |
||||
setFont(list.getFont()); |
||||
|
||||
if (value instanceof ListModelElement) { |
||||
Nameable wrappee = ((ListModelElement) value).wrapper; |
||||
this.setText(wrappee.getName()); |
||||
} |
||||
|
||||
return this; |
||||
} |
||||
} |
||||
} |
@ -1 +1,36 @@
|
||||
package com.fr.design.icon;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date: 12-12-18
* Time: 上午9:42
* 用于保存所有图标路径的类
*/
public class IconPathConstants {
private IconPathConstants() {
}
public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png";
public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png";
public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png";
public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png";
public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png";
public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png";
public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png";
public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png";
public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png";
public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png";
public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png";
public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png";
public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png";
public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png";
public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png";
public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png";
public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png";
public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png";
} |
||||
package com.fr.design.icon; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : Richer |
||||
* Version: 6.5.6 |
||||
* Date: 12-12-18 |
||||
* Time: 上午9:42 |
||||
* 用于保存所有图标路径的类 |
||||
*/ |
||||
public class IconPathConstants { |
||||
private IconPathConstants() { |
||||
|
||||
} |
||||
|
||||
public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; |
||||
|
||||
public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; |
||||
public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; |
||||
public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; |
||||
public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; |
||||
public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; |
||||
public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; |
||||
public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; |
||||
public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; |
||||
public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; |
||||
public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; |
||||
public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; |
||||
public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png"; |
||||
public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; |
||||
public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; |
||||
public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; |
||||
public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; |
||||
public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png"; |
||||
public static final String EDIT_ICON_PATH = "/com/fr/design/images/control/newEdit.png"; |
||||
} |
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 442 B |
@ -0,0 +1,38 @@
|
||||
package com.fr.design.designer.properties.mobile; |
||||
|
||||
import com.fr.design.designer.creator.XChartEditor; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XElementCase; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||
import com.fr.design.widget.ui.designer.mobile.ChartEditorDefinePane; |
||||
import com.fr.design.widget.ui.designer.mobile.ElementCaseDefinePane; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/18. |
||||
*/ |
||||
public class ChartEditorPropertyUI extends AbstractWidgetPropertyUIProvider { |
||||
|
||||
private XCreator xCreator; |
||||
|
||||
public ChartEditorPropertyUI(XChartEditor xChartEditor) { |
||||
this.xCreator = xChartEditor; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractPropertyTable createWidgetAttrTable() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BasicPane createWidgetAttrPane() { |
||||
return new ChartEditorDefinePane(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
public String tableTitle() { |
||||
return Inter.getLocText("FR-Designer_Mobile-Attr"); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.designer.properties.mobile; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XWAbsoluteBodyLayout; |
||||
import com.fr.design.designer.creator.XWFitLayout; |
||||
import com.fr.design.designer.creator.XWParameterLayout; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||
import com.fr.design.widget.ui.designer.mobile.BodyMobileDefinePane; |
||||
import com.fr.design.widget.ui.designer.mobile.ParaMobileDefinePane; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by Administrator on 2016/5/16/0016. |
||||
*/ |
||||
public class ParaMobilePropertyUI extends AbstractWidgetPropertyUIProvider { |
||||
|
||||
private XCreator xCreator; |
||||
|
||||
public ParaMobilePropertyUI(XWParameterLayout xwParameterLayout) { |
||||
this.xCreator = xwParameterLayout; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractPropertyTable createWidgetAttrTable() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BasicPane createWidgetAttrPane() { |
||||
return new ParaMobileDefinePane(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
public String tableTitle() { |
||||
return Inter.getLocText("FR-Designer_Mobile-Attr"); |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue