Browse Source
* commit '13960a358ac178975e78a104bc52fd1b88289837': 代码调整 代码调整 REPORT-3293 9.0设计器控件设置重画 代码修改 REPORT-3293 9.0设计器控件设置重画master
superman
7 years ago
80 changed files with 1110 additions and 1333 deletions
@ -1,10 +1,10 @@
|
||||
package com.fr.design.designer.properties; |
||||
|
||||
/** |
||||
* 将控件属性 转化成字符串 |
||||
* @since 6.5.2 |
||||
*/ |
||||
public interface Encoder<T> { |
||||
|
||||
String encode(T v); |
||||
package com.fr.design.designer.properties; |
||||
|
||||
/** |
||||
* 将控件属性 转化成字符串 |
||||
* @since 6.5.2 |
||||
*/ |
||||
public interface Encoder<T> { |
||||
|
||||
String encode(T v); |
||||
} |
@ -1,38 +1,44 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.data.Dictionary; |
||||
import com.fr.design.mainframe.widget.wrappers.DictionaryWrapper; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
|
||||
public class AccessibleDictionaryEditor extends UneditableAccessibleEditor { |
||||
|
||||
private DictionaryPane dictPane; |
||||
|
||||
public AccessibleDictionaryEditor() { |
||||
super(new DictionaryWrapper()); |
||||
} |
||||
|
||||
@Override |
||||
protected void showEditorPane() { |
||||
if (dictPane == null) { |
||||
dictPane = new DictionaryPane(); |
||||
} |
||||
|
||||
BasicDialog dlg = dictPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
Dictionary dict = dictPane.updateBean(); |
||||
setValue(dict); |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
dictPane.populateBean((Dictionary) getValue()); |
||||
dlg.setVisible(true); |
||||
} |
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import com.fr.data.Dictionary; |
||||
import com.fr.design.mainframe.widget.wrappers.DictionaryWrapper; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
|
||||
import java.awt.*; |
||||
|
||||
public class AccessibleDictionaryEditor extends UneditableAccessibleEditor { |
||||
|
||||
private DictionaryPane dictPane; |
||||
|
||||
public AccessibleDictionaryEditor() { |
||||
super(new DictionaryWrapper()); |
||||
} |
||||
|
||||
protected void setBorderVisible(){ |
||||
this.setBorder(BorderFactory.createLineBorder(Color.lightGray)); |
||||
} |
||||
|
||||
@Override |
||||
protected void showEditorPane() { |
||||
if (dictPane == null) { |
||||
dictPane = new DictionaryPane(); |
||||
} |
||||
|
||||
BasicDialog dlg = dictPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
Dictionary dict = dictPane.updateBean(); |
||||
setValue(dict); |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
dictPane.populateBean((Dictionary) getValue()); |
||||
dlg.setVisible(true); |
||||
} |
||||
} |
@ -1,41 +1,41 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.design.Exception.ValidationException; |
||||
|
||||
/** |
||||
* 属性编辑器 |
||||
* @since 6.5.2 |
||||
*/ |
||||
public interface AccessibleEditor { |
||||
|
||||
/** |
||||
* 判断输入的值是否符合要求 |
||||
* @throws ValidationException |
||||
*/ |
||||
public void validateValue() throws ValidationException; |
||||
|
||||
/** |
||||
* 获取编辑器里面的值 |
||||
*/ |
||||
public Object getValue(); |
||||
|
||||
/** |
||||
* 给编辑器设置值 |
||||
* @param v |
||||
*/ |
||||
public void setValue(Object v); |
||||
|
||||
/** |
||||
* 自定义编辑器 |
||||
* @return |
||||
*/ |
||||
public Component getEditor(); |
||||
|
||||
public void addChangeListener(ChangeListener l); |
||||
|
||||
public void removeChangeListener(ChangeListener l); |
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.design.Exception.ValidationException; |
||||
|
||||
/** |
||||
* 属性编辑器 |
||||
* @since 6.5.2 |
||||
*/ |
||||
public interface AccessibleEditor { |
||||
|
||||
/** |
||||
* 判断输入的值是否符合要求 |
||||
* @throws ValidationException |
||||
*/ |
||||
public void validateValue() throws ValidationException; |
||||
|
||||
/** |
||||
* 获取编辑器里面的值 |
||||
*/ |
||||
public Object getValue(); |
||||
|
||||
/** |
||||
* 给编辑器设置值 |
||||
* @param v |
||||
*/ |
||||
public void setValue(Object v); |
||||
|
||||
/** |
||||
* 自定义编辑器 |
||||
* @return |
||||
*/ |
||||
public Component getEditor(); |
||||
|
||||
public void addChangeListener(ChangeListener l); |
||||
|
||||
public void removeChangeListener(ChangeListener l); |
||||
} |
@ -1,193 +1,197 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.Insets; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.ArrayList; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||
import com.fr.design.mainframe.widget.editors.TextField; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.designer.properties.Decoder; |
||||
import com.fr.design.designer.properties.Encoder; |
||||
|
||||
/** |
||||
* @since 6.5.3 |
||||
*/ |
||||
public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor { |
||||
|
||||
private ArrayList<ChangeListener> listeners; |
||||
private boolean showButton; |
||||
protected Encoder encoder; |
||||
private Decoder decoder; |
||||
private UIButton btPopup; |
||||
protected ITextComponent txtValue; |
||||
|
||||
public BaseAccessibleEditor(Encoder enc, Decoder dec, boolean showBtn) { |
||||
listeners = new ArrayList<ChangeListener>(); |
||||
this.showButton = showBtn; |
||||
this.encoder = enc; |
||||
this.decoder = dec; |
||||
initComponents(); |
||||
txtValue.setEditable(dec != null); |
||||
((JComponent) txtValue).setBorder(null); |
||||
} |
||||
|
||||
@Override |
||||
public void requestFocus() { |
||||
super.requestFocus(); |
||||
if (decoder != null) { |
||||
((JComponent) txtValue).requestFocus(); |
||||
} else if (showButton) { |
||||
btPopup.requestFocus(); |
||||
} |
||||
} |
||||
|
||||
protected ITextComponent createTextField() { |
||||
return new TextField(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
||||
txtValue = createTextField(); |
||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
txtValue.addActionListener(new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
txtValueActionPerformed(evt); |
||||
} |
||||
}); |
||||
add((JComponent) txtValue, BorderLayout.CENTER); |
||||
setOpaque(false); |
||||
|
||||
if (showButton) { |
||||
btPopup = new UIButton(); |
||||
initPopupButton(); |
||||
btPopup.addActionListener(new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
showEditorPane(); |
||||
} |
||||
}); |
||||
add(btPopup, BorderLayout.EAST); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "Base"; |
||||
} |
||||
|
||||
// 显示编辑器细节
|
||||
protected void showEditorPane() { |
||||
} |
||||
|
||||
protected void initPopupButton() { |
||||
if (!isComboButton()) { |
||||
btPopup.setText("..."); |
||||
btPopup.setPreferredSize(new Dimension(20, 20)); |
||||
} else { |
||||
btPopup.setRolloverEnabled(true); |
||||
btPopup.setFocusPainted(false); |
||||
btPopup.setPreferredSize(new Dimension(15, 19)); |
||||
btPopup.setBorderPainted(false); |
||||
btPopup.setContentAreaFilled(false); |
||||
btPopup.setMargin(new Insets(0, 0, 0, 0)); |
||||
btPopup.setIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_up.png")); |
||||
btPopup.setPressedIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_down.png")); |
||||
btPopup.setRolloverIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_over.png")); |
||||
} |
||||
} |
||||
|
||||
// 有的编辑器是使用下拉框来直接选择的,这时候就把按钮显示成下拉框
|
||||
protected boolean isComboButton() { |
||||
return false; |
||||
} |
||||
|
||||
private void txtValueActionPerformed(ActionEvent evt) { |
||||
try { |
||||
validateValue(); |
||||
fireStateChanged(); |
||||
} catch (ValidationException e) { |
||||
showMessage(e.getMessage(), this); |
||||
txtValue.selectAll(); |
||||
((JComponent) txtValue).requestFocus(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Component getEditor() { |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
return decoder.decode(txtValue.getText()); |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object v) { |
||||
if(encoder != null) { |
||||
txtValue.setText(encoder.encode(v)); |
||||
} |
||||
txtValue.setValue(v); |
||||
} |
||||
|
||||
@Override |
||||
public void addChangeListener(ChangeListener l) { |
||||
if (!listeners.contains(l)) { |
||||
listeners.add(l); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void removeChangeListener(ChangeListener l) { |
||||
if (listeners.contains(l)) { |
||||
listeners.remove(l); |
||||
} |
||||
} |
||||
|
||||
protected void fireStateChanged() { |
||||
ChangeEvent e = new ChangeEvent(this); |
||||
for (ChangeListener l : listeners) { |
||||
l.stateChanged(e); |
||||
} |
||||
} |
||||
|
||||
public Encoder getEncoder() { |
||||
return encoder; |
||||
} |
||||
|
||||
public void setEncoder(Encoder encoder) { |
||||
this.encoder = encoder; |
||||
} |
||||
|
||||
@Override |
||||
public void validateValue() throws ValidationException { |
||||
if (decoder != null) { |
||||
decoder.validate(txtValue.getText()); |
||||
} |
||||
} |
||||
|
||||
public static void showMessage(String message, Component editorComponent) { |
||||
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); |
||||
} |
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.Insets; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.ArrayList; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||
import com.fr.design.mainframe.widget.editors.TextField; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.designer.properties.Decoder; |
||||
import com.fr.design.designer.properties.Encoder; |
||||
|
||||
/** |
||||
* @since 6.5.3 |
||||
*/ |
||||
public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor { |
||||
|
||||
private ArrayList<ChangeListener> listeners; |
||||
private boolean showButton; |
||||
protected Encoder encoder; |
||||
private Decoder decoder; |
||||
private UIButton btPopup; |
||||
protected ITextComponent txtValue; |
||||
|
||||
public BaseAccessibleEditor(Encoder enc, Decoder dec, boolean showBtn) { |
||||
listeners = new ArrayList<ChangeListener>(); |
||||
this.showButton = showBtn; |
||||
this.encoder = enc; |
||||
this.decoder = dec; |
||||
initComponents(); |
||||
txtValue.setEditable(dec != null); |
||||
setBorderVisible(); |
||||
} |
||||
|
||||
protected void setBorderVisible(){ |
||||
((JComponent) txtValue).setBorder(null); |
||||
} |
||||
|
||||
@Override |
||||
public void requestFocus() { |
||||
super.requestFocus(); |
||||
if (decoder != null) { |
||||
((JComponent) txtValue).requestFocus(); |
||||
} else if (showButton) { |
||||
btPopup.requestFocus(); |
||||
} |
||||
} |
||||
|
||||
protected ITextComponent createTextField() { |
||||
return new TextField(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
||||
txtValue = createTextField(); |
||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
txtValue.addActionListener(new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
txtValueActionPerformed(evt); |
||||
} |
||||
}); |
||||
add((JComponent) txtValue, BorderLayout.CENTER); |
||||
setOpaque(false); |
||||
|
||||
if (showButton) { |
||||
btPopup = new UIButton(); |
||||
initPopupButton(); |
||||
btPopup.addActionListener(new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
showEditorPane(); |
||||
} |
||||
}); |
||||
add(btPopup, BorderLayout.EAST); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "Base"; |
||||
} |
||||
|
||||
// 显示编辑器细节
|
||||
protected void showEditorPane() { |
||||
} |
||||
|
||||
protected void initPopupButton() { |
||||
if (!isComboButton()) { |
||||
btPopup.setText("..."); |
||||
btPopup.setPreferredSize(new Dimension(20, 20)); |
||||
} else { |
||||
btPopup.setRolloverEnabled(true); |
||||
btPopup.setFocusPainted(false); |
||||
btPopup.setPreferredSize(new Dimension(15, 19)); |
||||
btPopup.setBorderPainted(false); |
||||
btPopup.setContentAreaFilled(false); |
||||
btPopup.setMargin(new Insets(0, 0, 0, 0)); |
||||
btPopup.setIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_up.png")); |
||||
btPopup.setPressedIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_down.png")); |
||||
btPopup.setRolloverIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_over.png")); |
||||
} |
||||
} |
||||
|
||||
// 有的编辑器是使用下拉框来直接选择的,这时候就把按钮显示成下拉框
|
||||
protected boolean isComboButton() { |
||||
return false; |
||||
} |
||||
|
||||
private void txtValueActionPerformed(ActionEvent evt) { |
||||
try { |
||||
validateValue(); |
||||
fireStateChanged(); |
||||
} catch (ValidationException e) { |
||||
showMessage(e.getMessage(), this); |
||||
txtValue.selectAll(); |
||||
((JComponent) txtValue).requestFocus(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Component getEditor() { |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
return decoder.decode(txtValue.getText()); |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object v) { |
||||
if(encoder != null) { |
||||
txtValue.setText(encoder.encode(v)); |
||||
} |
||||
txtValue.setValue(v); |
||||
} |
||||
|
||||
@Override |
||||
public void addChangeListener(ChangeListener l) { |
||||
if (!listeners.contains(l)) { |
||||
listeners.add(l); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void removeChangeListener(ChangeListener l) { |
||||
if (listeners.contains(l)) { |
||||
listeners.remove(l); |
||||
} |
||||
} |
||||
|
||||
protected void fireStateChanged() { |
||||
ChangeEvent e = new ChangeEvent(this); |
||||
for (ChangeListener l : listeners) { |
||||
l.stateChanged(e); |
||||
} |
||||
} |
||||
|
||||
public Encoder getEncoder() { |
||||
return encoder; |
||||
} |
||||
|
||||
public void setEncoder(Encoder encoder) { |
||||
this.encoder = encoder; |
||||
} |
||||
|
||||
@Override |
||||
public void validateValue() throws ValidationException { |
||||
if (decoder != null) { |
||||
decoder.validate(txtValue.getText()); |
||||
} |
||||
} |
||||
|
||||
public static void showMessage(String message, Component editorComponent) { |
||||
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); |
||||
} |
||||
} |
@ -1,50 +1,50 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
import javax.swing.JComponent; |
||||
|
||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer; |
||||
|
||||
public class RendererField extends JComponent implements ITextComponent{ |
||||
private GenericCellRenderer renderer; |
||||
|
||||
public RendererField(GenericCellRenderer renderer) { |
||||
this.setLayout(new BorderLayout()); |
||||
this.renderer = renderer; |
||||
add(renderer, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void addActionListener(ActionListener l) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getText() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void selectAll() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setEditable(boolean editable) { |
||||
this.setEnabled(editable); |
||||
} |
||||
|
||||
@Override |
||||
public void setText(String text) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object v) { |
||||
renderer.setValue(v); |
||||
this.repaint(); |
||||
} |
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer; |
||||
|
||||
public class RendererField extends JComponent implements ITextComponent{ |
||||
private GenericCellRenderer renderer; |
||||
|
||||
public RendererField(GenericCellRenderer renderer) { |
||||
this.setLayout(new BorderLayout()); |
||||
this.renderer = renderer; |
||||
add(renderer, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void addActionListener(ActionListener l) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getText() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void selectAll() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setEditable(boolean editable) { |
||||
this.setEnabled(editable); |
||||
} |
||||
|
||||
@Override |
||||
public void setText(String text) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object v) { |
||||
renderer.setValue(v); |
||||
this.repaint(); |
||||
} |
||||
} |
@ -1,23 +1,23 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import com.fr.design.designer.properties.Encoder; |
||||
|
||||
public abstract class UneditableAccessibleEditor extends BaseAccessibleEditor { |
||||
|
||||
protected Object value; |
||||
|
||||
public UneditableAccessibleEditor(Encoder enc) { |
||||
super(enc, null, true); |
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
return value; |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object v) { |
||||
this.value = v; |
||||
super.setValue(v); |
||||
} |
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import com.fr.design.designer.properties.Encoder; |
||||
|
||||
public abstract class UneditableAccessibleEditor extends BaseAccessibleEditor { |
||||
|
||||
protected Object value; |
||||
|
||||
public UneditableAccessibleEditor(Encoder enc) { |
||||
super(enc, null, true); |
||||
} |
||||
|
||||
@Override |
||||
public Object getValue() { |
||||
return value; |
||||
} |
||||
|
||||
@Override |
||||
public void setValue(Object v) { |
||||
this.value = v; |
||||
super.setValue(v); |
||||
} |
||||
} |
@ -1,94 +1,94 @@
|
||||
package com.fr.design.mainframe.widget.renderer; |
||||
|
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JTable; |
||||
import javax.swing.UIManager; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.border.EmptyBorder; |
||||
import javax.swing.table.TableCellRenderer; |
||||
|
||||
public abstract class GenericCellRenderer extends JComponent implements TableCellRenderer { |
||||
|
||||
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); |
||||
|
||||
@Override |
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
||||
Component component = getRendererComponent(); |
||||
Color fg = null; |
||||
Color bg = null; |
||||
JTable.DropLocation dropLocation = table.getDropLocation(); |
||||
|
||||
if ((dropLocation != null) && !dropLocation.isInsertRow() |
||||
&& !dropLocation.isInsertColumn() |
||||
&& (dropLocation.getRow() == row) |
||||
&& (dropLocation.getColumn() == column)) { |
||||
fg = UIManager.getColor("Table.dropCellForeground"); |
||||
bg = UIManager.getColor("Table.dropCellBackground"); |
||||
|
||||
isSelected = true; |
||||
} |
||||
|
||||
if (isSelected) { |
||||
component.setForeground((fg == null) ? table.getSelectionForeground() : fg); |
||||
component.setBackground((bg == null) ? table.getSelectionBackground() : bg); |
||||
} else { |
||||
component.setForeground(table.getForeground()); |
||||
component.setBackground(table.getBackground()); |
||||
} |
||||
|
||||
component.setFont(table.getFont()); |
||||
|
||||
if (hasFocus) { |
||||
Border border = null; |
||||
|
||||
if (isSelected) { |
||||
border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder"); |
||||
} |
||||
|
||||
if (border == null) { |
||||
border = UIManager.getBorder("Table.focusCellHighlightBorder"); |
||||
} |
||||
|
||||
((JComponent) component).setBorder(border); |
||||
|
||||
if (!isSelected && table.isCellEditable(row, column)) { |
||||
Color col; |
||||
col = UIManager.getColor("Table.focusCellForeground"); |
||||
|
||||
if (col != null) { |
||||
component.setForeground(col); |
||||
} |
||||
|
||||
col = UIManager.getColor("Table.focusCellBackground"); |
||||
|
||||
if (col != null) { |
||||
component.setBackground(col); |
||||
} |
||||
} |
||||
} |
||||
|
||||
((JComponent) component).setBorder(getNoFocusBorder()); |
||||
|
||||
setValue(value); |
||||
|
||||
return component; |
||||
} |
||||
|
||||
private static Border getNoFocusBorder() { |
||||
if (System.getSecurityManager() != null) { |
||||
return SAFE_NO_FOCUS_BORDER; |
||||
} else { |
||||
return noFocusBorder; |
||||
} |
||||
} |
||||
|
||||
public Component getRendererComponent() { |
||||
return this; |
||||
} |
||||
|
||||
public abstract void setValue(Object value); |
||||
package com.fr.design.mainframe.widget.renderer; |
||||
|
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JTable; |
||||
import javax.swing.UIManager; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.border.EmptyBorder; |
||||
import javax.swing.table.TableCellRenderer; |
||||
|
||||
public abstract class GenericCellRenderer extends JComponent implements TableCellRenderer { |
||||
|
||||
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); |
||||
|
||||
@Override |
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
||||
Component component = getRendererComponent(); |
||||
Color fg = null; |
||||
Color bg = null; |
||||
JTable.DropLocation dropLocation = table.getDropLocation(); |
||||
|
||||
if ((dropLocation != null) && !dropLocation.isInsertRow() |
||||
&& !dropLocation.isInsertColumn() |
||||
&& (dropLocation.getRow() == row) |
||||
&& (dropLocation.getColumn() == column)) { |
||||
fg = UIManager.getColor("Table.dropCellForeground"); |
||||
bg = UIManager.getColor("Table.dropCellBackground"); |
||||
|
||||
isSelected = true; |
||||
} |
||||
|
||||
if (isSelected) { |
||||
component.setForeground((fg == null) ? table.getSelectionForeground() : fg); |
||||
component.setBackground((bg == null) ? table.getSelectionBackground() : bg); |
||||
} else { |
||||
component.setForeground(table.getForeground()); |
||||
component.setBackground(table.getBackground()); |
||||
} |
||||
|
||||
component.setFont(table.getFont()); |
||||
|
||||
if (hasFocus) { |
||||
Border border = null; |
||||
|
||||
if (isSelected) { |
||||
border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder"); |
||||
} |
||||
|
||||
if (border == null) { |
||||
border = UIManager.getBorder("Table.focusCellHighlightBorder"); |
||||
} |
||||
|
||||
((JComponent) component).setBorder(border); |
||||
|
||||
if (!isSelected && table.isCellEditable(row, column)) { |
||||
Color col; |
||||
col = UIManager.getColor("Table.focusCellForeground"); |
||||
|
||||
if (col != null) { |
||||
component.setForeground(col); |
||||
} |
||||
|
||||
col = UIManager.getColor("Table.focusCellBackground"); |
||||
|
||||
if (col != null) { |
||||
component.setBackground(col); |
||||
} |
||||
} |
||||
} |
||||
|
||||
((JComponent) component).setBorder(getNoFocusBorder()); |
||||
|
||||
setValue(value); |
||||
|
||||
return component; |
||||
} |
||||
|
||||
private static Border getNoFocusBorder() { |
||||
if (System.getSecurityManager() != null) { |
||||
return SAFE_NO_FOCUS_BORDER; |
||||
} else { |
||||
return noFocusBorder; |
||||
} |
||||
} |
||||
|
||||
public Component getRendererComponent() { |
||||
return this; |
||||
} |
||||
|
||||
public abstract void setValue(Object value); |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.widget.component; |
||||
|
||||
import com.fr.form.ui.FreeButton; |
||||
import com.fr.general.Background; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/8. |
||||
*/ |
||||
public class ButtonBackgroundPane extends BackgroundCompPane<FreeButton> { |
||||
|
||||
public ButtonBackgroundPane(){ |
||||
|
||||
} |
||||
|
||||
public void update(FreeButton freeButton){ |
||||
int selectIndex = backgroundHead.getSelectedIndex(); |
||||
if(selectIndex == 0){ |
||||
freeButton.setCustomStyle(false); |
||||
freeButton.setInitialBackground(null); |
||||
freeButton.setOverBackground(null); |
||||
freeButton.setClickBackground(null); |
||||
}else{ |
||||
freeButton.setCustomStyle(true); |
||||
freeButton.setInitialBackground((Background) initalBackgroundEditor.getValue()); |
||||
freeButton.setOverBackground((Background) overBackgroundEditor.getValue()); |
||||
freeButton.setClickBackground((Background)clickBackgroundEditor.getValue()); |
||||
} |
||||
} |
||||
|
||||
public void populate(FreeButton freeButton){ |
||||
if(!freeButton.isCustomStyle()){ |
||||
backgroundHead.setSelectedIndex(0); |
||||
initalBackgroundEditor.setValue(null); |
||||
overBackgroundEditor.setValue(null); |
||||
clickBackgroundEditor.setValue(null); |
||||
}else{ |
||||
backgroundHead.setSelectedIndex(1); |
||||
initalBackgroundEditor.setValue(freeButton.getInitialBackground()); |
||||
overBackgroundEditor.setValue(freeButton.getOverBackground()); |
||||
clickBackgroundEditor.setValue(freeButton.getClickBackground()); |
||||
} |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return "buttonBackground"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.design.widget.component; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.editor.editor.*; |
||||
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/8. |
||||
*/ |
||||
public class DateValuePane extends JPanel { |
||||
private UIHeadGroup widgetValueHead; |
||||
private Editor[] editor; |
||||
|
||||
|
||||
public DateValuePane() { |
||||
editor = new Editor[]{ |
||||
new NoneEditor(null, Inter.getLocText("None")), |
||||
new DateEditor(true, Inter.getLocText("Date")), |
||||
new FormulaEditor(Inter.getLocText("Parameter-Formula")) |
||||
}; |
||||
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); |
||||
final CardLayout cardLayout = new CardLayout(); |
||||
final JPanel customPane = new JPanel(cardLayout); |
||||
final String[] tabTitles = new String[editor.length]; |
||||
for (int i = 0; i < editor.length; i++) { |
||||
customPane.add(editor[i], editor[i].getName()); |
||||
tabTitles[i] = editor[i].getName(); |
||||
} |
||||
widgetValueHead = new UIHeadGroup(tabTitles) { |
||||
@Override |
||||
public void tabChanged(int index) { |
||||
if (ComparatorUtils.equals(tabTitles[index], Inter.getLocText("None"))) { |
||||
customPane.setVisible(false); |
||||
} else { |
||||
customPane.setVisible(true); |
||||
} |
||||
cardLayout.show(customPane, tabTitles[index]); |
||||
} |
||||
}; |
||||
this.add(widgetValueHead, BorderLayout.NORTH); |
||||
this.add(customPane, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
|
||||
public Object update() { |
||||
int index = widgetValueHead.getSelectedIndex(); |
||||
Editor e = editor[index]; |
||||
Object value = e.getValue(); |
||||
return value; |
||||
} |
||||
|
||||
public void populate(Object ob) { |
||||
for (int i = 0; i < editor.length; i++) { |
||||
if (editor[i].accept(ob)) { |
||||
setCardValue(i, ob); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void setCardValue(int i, Object object) { |
||||
widgetValueHead.setSelectedIndex(i); |
||||
editor[i].setValue(object); |
||||
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
|
||||
// 一定是最后的Editor哦.
|
||||
for (int j = 0; j < editor.length; j++) { |
||||
if (i == j) { |
||||
continue; |
||||
} |
||||
this.editor[j].setValue(null); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -1,64 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.module.DesignModuleFactory; |
||||
import com.fr.design.widget.btn.ButtonDetailPane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
import com.fr.form.ui.Widget; |
||||
|
||||
import com.fr.stable.bridge.BridgeMark; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : Richer |
||||
* Version: 6.5.6 |
||||
* Date : 11-11-15 |
||||
* Time : 下午6:29 |
||||
*/ |
||||
public class ButtonDetailPaneFactory { |
||||
private static Map<String, Class> detailMap = new HashMap<String, Class>(); |
||||
|
||||
static { |
||||
detailMap.put(Button.class.getName(), DefaultButtonDetailPane.class); |
||||
detailMap.put(FreeButton.class.getName(), FreeButtonDetailPane.class); |
||||
if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) { |
||||
detailMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class).getName(), DesignModuleFactory.getButtonDetailPaneClass()); |
||||
} |
||||
} |
||||
|
||||
public static ButtonDetailPane<Button> createButtonDetailPane(Button button) { |
||||
Class cls = detailMap.get(button.getClass().getName()); |
||||
ButtonDetailPane<Button> detailPane = null; |
||||
if (cls != null) { |
||||
try { |
||||
detailPane = (ButtonDetailPane) cls.newInstance(); |
||||
detailPane.populate(button); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
return detailPane; |
||||
} |
||||
|
||||
public static ButtonDetailPane<Button> createButtonDetailPane(Class cls, Button button) { |
||||
if (cls == null) { |
||||
return createButtonDetailPane(button); |
||||
} |
||||
Class aa = detailMap.get(cls.getName()); |
||||
ButtonDetailPane<Button> detailPane = null; |
||||
if (aa != null) { |
||||
try { |
||||
detailPane = (ButtonDetailPane) aa.newInstance(); |
||||
detailPane.populate(button == null ? detailPane.createButton() : button); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
return detailPane; |
||||
} |
||||
} |
@ -1,143 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.base.background.ImageBackground; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.style.background.BackgroundButtonPane; |
||||
import com.fr.form.ui.FreeButton; |
||||
import com.fr.general.Background; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.TitledBorder; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class ButtonSytleDefinedPane extends BasicPane { |
||||
|
||||
// private UIComboBox buttonStyleComboBox;
|
||||
// private JPanel card;
|
||||
// private CardLayout cardLayout;
|
||||
private BackgroundPane initBackgroundPane; |
||||
private BackgroundPane overBackgroundPane; |
||||
private BackgroundPane clickBackgroundPane; |
||||
private Background initBackground; |
||||
private Background overBackground; |
||||
private Background clickBackground; |
||||
|
||||
public ButtonSytleDefinedPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
JPanel buttonStylePane = new JPanel(); |
||||
buttonStylePane.setLayout(new BorderLayout()); |
||||
initBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Initial") + ":", Inter.getLocText("FR-Designer_Initial_Background_Tips")); |
||||
overBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Over") + ":", Inter.getLocText("FR-Designer_Mouse_Move_Tips")); |
||||
clickBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Click") + ":", Inter.getLocText("FR-Designer_Mouse_Click_Tips")); |
||||
|
||||
JPanel table = FRGUIPaneFactory.createYBoxEmptyBorderPane(); |
||||
table.setBorder(new TitledBorder(Inter.getLocText(new String[]{"Custom", "Form-Button", "Style"}))); |
||||
table.add(initBackgroundPane); |
||||
table.add(overBackgroundPane); |
||||
table.add(clickBackgroundPane); |
||||
buttonStylePane.add(table, BorderLayout.WEST); |
||||
|
||||
this.add(buttonStylePane, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
public void populate(FreeButton button) { |
||||
if (button == null) { |
||||
return; |
||||
} |
||||
initBackgroundPane.populate(button.getInitialBackground()); |
||||
overBackgroundPane.populate(button.getOverBackground()); |
||||
clickBackgroundPane.populate(button.getClickBackground()); |
||||
} |
||||
|
||||
public FreeButton update(FreeButton button) { |
||||
button.setCustomStyle(true); |
||||
button.setInitialBackground(initBackgroundPane.update()); |
||||
button.setOverBackground(overBackgroundPane.update()); |
||||
button.setClickBackground(clickBackgroundPane.update()); |
||||
|
||||
return button; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
class BackgroundPane extends JPanel { |
||||
private UIButton editButton; |
||||
private BackgroundButtonPane choosePane; |
||||
private Background background; |
||||
private UILabel ImagePreviewPane; |
||||
|
||||
BackgroundPane(String text, String ToolTips) { |
||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 150)); |
||||
|
||||
UILabel label = new UILabel(text); |
||||
label.setToolTipText(ToolTips); |
||||
label.setPreferredSize(new Dimension(100, 20)); |
||||
this.add(label); |
||||
|
||||
ImagePreviewPane = new UILabel(); |
||||
ImagePreviewPane.setPreferredSize(new Dimension(100, 20)); |
||||
this.add(ImagePreviewPane); |
||||
|
||||
editButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); |
||||
editButton.addActionListener(new ActionListener() { |
||||
|
||||
public void actionPerformed(ActionEvent e) { |
||||
choosePane = new BackgroundButtonPane(); |
||||
BasicDialog dlg = choosePane.showWindow(SwingUtilities |
||||
.getWindowAncestor(ButtonSytleDefinedPane.this)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
populate(choosePane.update()); |
||||
} |
||||
}); |
||||
if(BackgroundPane.this.background == null){ |
||||
BackgroundPane.this.background = new ColorBackground(); |
||||
} |
||||
choosePane.populate((Background) BackgroundPane.this.background); |
||||
dlg.setVisible(true); |
||||
} |
||||
}); |
||||
this.add(editButton); |
||||
} |
||||
|
||||
public void populate(Background background) { |
||||
this.background = background; |
||||
|
||||
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) { |
||||
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage())); |
||||
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){ |
||||
ImagePreviewPane.setIcon(null); |
||||
ImagePreviewPane.setOpaque(true); |
||||
ImagePreviewPane.setBackground(((ColorBackground) background).getColor()); |
||||
}else{ |
||||
ImagePreviewPane.setIcon(null); |
||||
ImagePreviewPane.setOpaque(false); |
||||
ImagePreviewPane.setBackground(null); |
||||
} |
||||
} |
||||
|
||||
public Background update() { |
||||
return background; |
||||
} |
||||
} |
||||
} |
@ -1,30 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-15 Time |
||||
* : 下午6:24 |
||||
*/ |
||||
public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button> { |
||||
|
||||
@Override |
||||
protected Component createCenterPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public FreeButton createButton() { |
||||
return new FreeButton(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Class classType() { |
||||
return Button.class; |
||||
} |
||||
} |
@ -1,56 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.IconDefinePane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class DefaultButtonStylePane extends BasicPane { |
||||
|
||||
private UITextField buttonNameTextField; |
||||
private IconDefinePane iconPane; |
||||
private UIComboBox buttonStyleComboBox; |
||||
|
||||
public DefaultButtonStylePane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
iconPane = new IconDefinePane(); |
||||
labelPane.add(iconPane); |
||||
Component[][] n_components = { |
||||
{ new UILabel(Inter.getLocText("Text") + ":"), buttonNameTextField = new UITextField(20) }, |
||||
{ new UILabel(Inter.getLocText("Icon") + ":"), labelPane } }; |
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(n_components, new double[]{-2, -2}, new double[]{-2, -2}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(Button button) { |
||||
buttonNameTextField.setText(button.getText()); |
||||
iconPane.populate(button.getIconName()); |
||||
} |
||||
|
||||
public Button update(Button button) { |
||||
button.setText(buttonNameTextField.getText()); |
||||
button.setIconName(iconPane.update()); |
||||
return button; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "default"; |
||||
} |
||||
|
||||
} |
@ -1,40 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
|
||||
import java.awt.*; |
||||
|
||||
public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton> { |
||||
private ButtonSytleDefinedPane stylePane; |
||||
|
||||
@Override |
||||
protected Component createCenterPane() { |
||||
return stylePane = new ButtonSytleDefinedPane(); |
||||
} |
||||
|
||||
@Override |
||||
public FreeButton createButton() { |
||||
return new FreeButton(); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(Button button) { |
||||
super.populate(button); |
||||
if(button instanceof FreeButton) { |
||||
stylePane.populate((FreeButton) button); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public FreeButton update() { |
||||
FreeButton button = super.update(); |
||||
return stylePane.update(button); |
||||
} |
||||
|
||||
@Override |
||||
public Class classType() { |
||||
return FreeButton.class; |
||||
} |
||||
} |
@ -1,43 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.general.Background; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/7. |
||||
*/ |
||||
public class MouseActionBackground { |
||||
|
||||
private Background initialBackground; |
||||
private Background overBackground; |
||||
private Background clickBackground; |
||||
|
||||
public MouseActionBackground(Background initialBackground, Background overBackground, Background clickBackground){ |
||||
this.initialBackground = initialBackground; |
||||
this.overBackground = overBackground; |
||||
this.clickBackground = clickBackground; |
||||
} |
||||
|
||||
public Background getInitialBackground() { |
||||
return initialBackground; |
||||
} |
||||
|
||||
public void setInitialBackground(Background initialBackground) { |
||||
this.initialBackground = initialBackground; |
||||
} |
||||
|
||||
public Background getOverBackground() { |
||||
return overBackground; |
||||
} |
||||
|
||||
public void setOverBackground(Background overBackground) { |
||||
this.overBackground = overBackground; |
||||
} |
||||
|
||||
public Background getClickBackground() { |
||||
return clickBackground; |
||||
} |
||||
|
||||
public void setClickBackground(Background clickBackground) { |
||||
this.clickBackground = clickBackground; |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.widget.component.BackgroundCompPane; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.Background; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/8. |
||||
*/ |
||||
public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout> { |
||||
|
||||
public TabFitLayoutBackgroundPane(){ |
||||
|
||||
} |
||||
|
||||
public void update(WTabFitLayout wTabFitLayout){ |
||||
int selectIndex = backgroundHead.getSelectedIndex(); |
||||
if(selectIndex == 0){ |
||||
wTabFitLayout.setCustomStyle(false); |
||||
wTabFitLayout.setInitialBackground(null); |
||||
wTabFitLayout.setOverBackground(null); |
||||
wTabFitLayout.setClickBackground(null); |
||||
}else{ |
||||
wTabFitLayout.setCustomStyle(true); |
||||
wTabFitLayout.setInitialBackground((Background) initalBackgroundEditor.getValue()); |
||||
wTabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue()); |
||||
wTabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue()); |
||||
} |
||||
} |
||||
|
||||
public void populate(WTabFitLayout wTabFitLayout){ |
||||
if(!wTabFitLayout.isCustomStyle()){ |
||||
backgroundHead.setSelectedIndex(0); |
||||
initalBackgroundEditor.setValue(null); |
||||
overBackgroundEditor.setValue(null); |
||||
clickBackgroundEditor.setValue(null); |
||||
}else{ |
||||
backgroundHead.setSelectedIndex(1); |
||||
initalBackgroundEditor.setValue(wTabFitLayout.getInitialBackground()); |
||||
overBackgroundEditor.setValue(wTabFitLayout.getOverBackground()); |
||||
clickBackgroundEditor.setValue(wTabFitLayout.getClickBackground()); |
||||
} |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return "tabFitBackground"; |
||||
} |
||||
|
||||
|
||||
} |
@ -1,40 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public class WidgetValueField implements WidgetValuePane{ |
||||
private UITextField dataSource; |
||||
private UITextField field; |
||||
|
||||
public WidgetValueField(){ |
||||
dataSource = new UITextField(); |
||||
field = new UITextField(); |
||||
} |
||||
|
||||
public JComponent createWidgetValuePane(){ |
||||
JPanel jPanel = new JPanel(); |
||||
jPanel.setLayout(new BorderLayout(1,7)); |
||||
jPanel.add(dataSource, BorderLayout.NORTH); |
||||
jPanel.add(field, BorderLayout.CENTER); |
||||
return jPanel; |
||||
} |
||||
|
||||
public String markTitle(){ |
||||
return Inter.getLocText("FR-Designer_Widget_Field"); |
||||
} |
||||
|
||||
public void update(){ |
||||
//todo
|
||||
} |
||||
|
||||
public void populate(){ |
||||
//todo
|
||||
} |
||||
} |
@ -1,33 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public class WidgetValueFormula implements WidgetValuePane{ |
||||
private UITextField uiTextField; |
||||
|
||||
public WidgetValueFormula(){ |
||||
uiTextField = new UITextField(); |
||||
} |
||||
|
||||
public JComponent createWidgetValuePane(){ |
||||
return uiTextField; |
||||
} |
||||
|
||||
public String markTitle(){ |
||||
return Inter.getLocText("FR-Designer_Widget_Formula"); |
||||
} |
||||
|
||||
public void update(){ |
||||
|
||||
} |
||||
|
||||
public void populate(){ |
||||
|
||||
} |
||||
} |
@ -1,17 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public interface WidgetValuePane{ |
||||
|
||||
JComponent createWidgetValuePane(); |
||||
|
||||
String markTitle(); |
||||
|
||||
void update(); |
||||
|
||||
void populate(); |
||||
} |
@ -1,33 +0,0 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public class WidgetValueString implements WidgetValuePane{ |
||||
private UITextField uiTextField; |
||||
|
||||
public WidgetValueString(){ |
||||
uiTextField = new UITextField(); |
||||
} |
||||
|
||||
public JComponent createWidgetValuePane(){ |
||||
return uiTextField; |
||||
} |
||||
|
||||
public String markTitle(){ |
||||
return Inter.getLocText("FR-Designer_Widget_String"); |
||||
} |
||||
|
||||
public void update(){ |
||||
|
||||
} |
||||
|
||||
public void populate(){ |
||||
|
||||
} |
||||
} |
@ -0,0 +1,7 @@
|
||||
//package com.fr.design.widget.ui.designer.layout;
|
||||
//
|
||||
///**
|
||||
// * Created by ibm on 2017/8/7.
|
||||
// */
|
||||
//public class ChartEditorDefinePane extends {
|
||||
//}
|
Loading…
Reference in new issue