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; |
package com.fr.design.designer.properties; |
||||||
|
|
||||||
/** |
/** |
||||||
* 将控件属性 转化成字符串 |
* 将控件属性 转化成字符串 |
||||||
* @since 6.5.2 |
* @since 6.5.2 |
||||||
*/ |
*/ |
||||||
public interface Encoder<T> { |
public interface Encoder<T> { |
||||||
|
|
||||||
String encode(T v); |
String encode(T v); |
||||||
} |
} |
@ -1,38 +1,44 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import javax.swing.SwingUtilities; |
import javax.swing.*; |
||||||
|
|
||||||
import com.fr.data.Dictionary; |
import com.fr.data.Dictionary; |
||||||
import com.fr.design.mainframe.widget.wrappers.DictionaryWrapper; |
import com.fr.design.mainframe.widget.wrappers.DictionaryWrapper; |
||||||
import com.fr.design.present.dict.DictionaryPane; |
import com.fr.design.present.dict.DictionaryPane; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
|
|
||||||
public class AccessibleDictionaryEditor extends UneditableAccessibleEditor { |
import java.awt.*; |
||||||
|
|
||||||
private DictionaryPane dictPane; |
public class AccessibleDictionaryEditor extends UneditableAccessibleEditor { |
||||||
|
|
||||||
public AccessibleDictionaryEditor() { |
private DictionaryPane dictPane; |
||||||
super(new DictionaryWrapper()); |
|
||||||
} |
public AccessibleDictionaryEditor() { |
||||||
|
super(new DictionaryWrapper()); |
||||||
@Override |
} |
||||||
protected void showEditorPane() { |
|
||||||
if (dictPane == null) { |
protected void setBorderVisible(){ |
||||||
dictPane = new DictionaryPane(); |
this.setBorder(BorderFactory.createLineBorder(Color.lightGray)); |
||||||
} |
} |
||||||
|
|
||||||
BasicDialog dlg = dictPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
@Override |
||||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
protected void showEditorPane() { |
||||||
|
if (dictPane == null) { |
||||||
@Override |
dictPane = new DictionaryPane(); |
||||||
public void doOk() { |
} |
||||||
Dictionary dict = dictPane.updateBean(); |
|
||||||
setValue(dict); |
BasicDialog dlg = dictPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||||
fireStateChanged(); |
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||||
} |
|
||||||
}); |
@Override |
||||||
dictPane.populateBean((Dictionary) getValue()); |
public void doOk() { |
||||||
dlg.setVisible(true); |
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; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import java.awt.Component; |
import java.awt.Component; |
||||||
|
|
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
|
|
||||||
import com.fr.design.Exception.ValidationException; |
import com.fr.design.Exception.ValidationException; |
||||||
|
|
||||||
/** |
/** |
||||||
* 属性编辑器 |
* 属性编辑器 |
||||||
* @since 6.5.2 |
* @since 6.5.2 |
||||||
*/ |
*/ |
||||||
public interface AccessibleEditor { |
public interface AccessibleEditor { |
||||||
|
|
||||||
/** |
/** |
||||||
* 判断输入的值是否符合要求 |
* 判断输入的值是否符合要求 |
||||||
* @throws ValidationException |
* @throws ValidationException |
||||||
*/ |
*/ |
||||||
public void validateValue() throws ValidationException; |
public void validateValue() throws ValidationException; |
||||||
|
|
||||||
/** |
/** |
||||||
* 获取编辑器里面的值 |
* 获取编辑器里面的值 |
||||||
*/ |
*/ |
||||||
public Object getValue(); |
public Object getValue(); |
||||||
|
|
||||||
/** |
/** |
||||||
* 给编辑器设置值 |
* 给编辑器设置值 |
||||||
* @param v |
* @param v |
||||||
*/ |
*/ |
||||||
public void setValue(Object v); |
public void setValue(Object v); |
||||||
|
|
||||||
/** |
/** |
||||||
* 自定义编辑器 |
* 自定义编辑器 |
||||||
* @return |
* @return |
||||||
*/ |
*/ |
||||||
public Component getEditor(); |
public Component getEditor(); |
||||||
|
|
||||||
public void addChangeListener(ChangeListener l); |
public void addChangeListener(ChangeListener l); |
||||||
|
|
||||||
public void removeChangeListener(ChangeListener l); |
public void removeChangeListener(ChangeListener l); |
||||||
} |
} |
@ -1,193 +1,197 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
||||||
import java.awt.Component; |
import java.awt.Component; |
||||||
import java.awt.Dimension; |
import java.awt.Dimension; |
||||||
import java.awt.Insets; |
import java.awt.Insets; |
||||||
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
||||||
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
|
|
||||||
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
||||||
|
|
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
|
|
||||||
import javax.swing.JComponent; |
import javax.swing.JComponent; |
||||||
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
||||||
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.design.Exception.ValidationException; |
import com.fr.design.Exception.ValidationException; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||||
import com.fr.design.mainframe.widget.editors.TextField; |
import com.fr.design.mainframe.widget.editors.TextField; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.designer.properties.Decoder; |
import com.fr.design.designer.properties.Decoder; |
||||||
import com.fr.design.designer.properties.Encoder; |
import com.fr.design.designer.properties.Encoder; |
||||||
|
|
||||||
/** |
/** |
||||||
* @since 6.5.3 |
* @since 6.5.3 |
||||||
*/ |
*/ |
||||||
public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor { |
public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor { |
||||||
|
|
||||||
private ArrayList<ChangeListener> listeners; |
private ArrayList<ChangeListener> listeners; |
||||||
private boolean showButton; |
private boolean showButton; |
||||||
protected Encoder encoder; |
protected Encoder encoder; |
||||||
private Decoder decoder; |
private Decoder decoder; |
||||||
private UIButton btPopup; |
private UIButton btPopup; |
||||||
protected ITextComponent txtValue; |
protected ITextComponent txtValue; |
||||||
|
|
||||||
public BaseAccessibleEditor(Encoder enc, Decoder dec, boolean showBtn) { |
public BaseAccessibleEditor(Encoder enc, Decoder dec, boolean showBtn) { |
||||||
listeners = new ArrayList<ChangeListener>(); |
listeners = new ArrayList<ChangeListener>(); |
||||||
this.showButton = showBtn; |
this.showButton = showBtn; |
||||||
this.encoder = enc; |
this.encoder = enc; |
||||||
this.decoder = dec; |
this.decoder = dec; |
||||||
initComponents(); |
initComponents(); |
||||||
txtValue.setEditable(dec != null); |
txtValue.setEditable(dec != null); |
||||||
((JComponent) txtValue).setBorder(null); |
setBorderVisible(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
protected void setBorderVisible(){ |
||||||
public void requestFocus() { |
((JComponent) txtValue).setBorder(null); |
||||||
super.requestFocus(); |
} |
||||||
if (decoder != null) { |
|
||||||
((JComponent) txtValue).requestFocus(); |
@Override |
||||||
} else if (showButton) { |
public void requestFocus() { |
||||||
btPopup.requestFocus(); |
super.requestFocus(); |
||||||
} |
if (decoder != null) { |
||||||
} |
((JComponent) txtValue).requestFocus(); |
||||||
|
} else if (showButton) { |
||||||
protected ITextComponent createTextField() { |
btPopup.requestFocus(); |
||||||
return new TextField(); |
} |
||||||
} |
} |
||||||
|
|
||||||
private void initComponents() { |
protected ITextComponent createTextField() { |
||||||
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
return new TextField(); |
||||||
txtValue = createTextField(); |
} |
||||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
|
private void initComponents() { |
||||||
txtValue.addActionListener(new ActionListener() { |
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
||||||
|
txtValue = createTextField(); |
||||||
@Override |
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
public void actionPerformed(ActionEvent evt) { |
|
||||||
txtValueActionPerformed(evt); |
txtValue.addActionListener(new ActionListener() { |
||||||
} |
|
||||||
}); |
@Override |
||||||
add((JComponent) txtValue, BorderLayout.CENTER); |
public void actionPerformed(ActionEvent evt) { |
||||||
setOpaque(false); |
txtValueActionPerformed(evt); |
||||||
|
} |
||||||
if (showButton) { |
}); |
||||||
btPopup = new UIButton(); |
add((JComponent) txtValue, BorderLayout.CENTER); |
||||||
initPopupButton(); |
setOpaque(false); |
||||||
btPopup.addActionListener(new ActionListener() { |
|
||||||
|
if (showButton) { |
||||||
@Override |
btPopup = new UIButton(); |
||||||
public void actionPerformed(ActionEvent evt) { |
initPopupButton(); |
||||||
showEditorPane(); |
btPopup.addActionListener(new ActionListener() { |
||||||
} |
|
||||||
}); |
@Override |
||||||
add(btPopup, BorderLayout.EAST); |
public void actionPerformed(ActionEvent evt) { |
||||||
} |
showEditorPane(); |
||||||
} |
} |
||||||
|
}); |
||||||
@Override |
add(btPopup, BorderLayout.EAST); |
||||||
protected String title4PopupWindow() { |
} |
||||||
return "Base"; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
// 显示编辑器细节
|
protected String title4PopupWindow() { |
||||||
protected void showEditorPane() { |
return "Base"; |
||||||
} |
} |
||||||
|
|
||||||
protected void initPopupButton() { |
// 显示编辑器细节
|
||||||
if (!isComboButton()) { |
protected void showEditorPane() { |
||||||
btPopup.setText("..."); |
} |
||||||
btPopup.setPreferredSize(new Dimension(20, 20)); |
|
||||||
} else { |
protected void initPopupButton() { |
||||||
btPopup.setRolloverEnabled(true); |
if (!isComboButton()) { |
||||||
btPopup.setFocusPainted(false); |
btPopup.setText("..."); |
||||||
btPopup.setPreferredSize(new Dimension(15, 19)); |
btPopup.setPreferredSize(new Dimension(20, 20)); |
||||||
btPopup.setBorderPainted(false); |
} else { |
||||||
btPopup.setContentAreaFilled(false); |
btPopup.setRolloverEnabled(true); |
||||||
btPopup.setMargin(new Insets(0, 0, 0, 0)); |
btPopup.setFocusPainted(false); |
||||||
btPopup.setIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_up.png")); |
btPopup.setPreferredSize(new Dimension(15, 19)); |
||||||
btPopup.setPressedIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_down.png")); |
btPopup.setBorderPainted(false); |
||||||
btPopup.setRolloverIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_over.png")); |
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) { |
protected boolean isComboButton() { |
||||||
try { |
return false; |
||||||
validateValue(); |
} |
||||||
fireStateChanged(); |
|
||||||
} catch (ValidationException e) { |
private void txtValueActionPerformed(ActionEvent evt) { |
||||||
showMessage(e.getMessage(), this); |
try { |
||||||
txtValue.selectAll(); |
validateValue(); |
||||||
((JComponent) txtValue).requestFocus(); |
fireStateChanged(); |
||||||
} |
} catch (ValidationException e) { |
||||||
} |
showMessage(e.getMessage(), this); |
||||||
|
txtValue.selectAll(); |
||||||
@Override |
((JComponent) txtValue).requestFocus(); |
||||||
public Component getEditor() { |
} |
||||||
return this; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public Component getEditor() { |
||||||
public Object getValue() { |
return this; |
||||||
return decoder.decode(txtValue.getText()); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public Object getValue() { |
||||||
public void setValue(Object v) { |
return decoder.decode(txtValue.getText()); |
||||||
if(encoder != null) { |
} |
||||||
txtValue.setText(encoder.encode(v)); |
|
||||||
} |
@Override |
||||||
txtValue.setValue(v); |
public void setValue(Object v) { |
||||||
} |
if(encoder != null) { |
||||||
|
txtValue.setText(encoder.encode(v)); |
||||||
@Override |
} |
||||||
public void addChangeListener(ChangeListener l) { |
txtValue.setValue(v); |
||||||
if (!listeners.contains(l)) { |
} |
||||||
listeners.add(l); |
|
||||||
} |
@Override |
||||||
} |
public void addChangeListener(ChangeListener l) { |
||||||
|
if (!listeners.contains(l)) { |
||||||
@Override |
listeners.add(l); |
||||||
public void removeChangeListener(ChangeListener l) { |
} |
||||||
if (listeners.contains(l)) { |
} |
||||||
listeners.remove(l); |
|
||||||
} |
@Override |
||||||
} |
public void removeChangeListener(ChangeListener l) { |
||||||
|
if (listeners.contains(l)) { |
||||||
protected void fireStateChanged() { |
listeners.remove(l); |
||||||
ChangeEvent e = new ChangeEvent(this); |
} |
||||||
for (ChangeListener l : listeners) { |
} |
||||||
l.stateChanged(e); |
|
||||||
} |
protected void fireStateChanged() { |
||||||
} |
ChangeEvent e = new ChangeEvent(this); |
||||||
|
for (ChangeListener l : listeners) { |
||||||
public Encoder getEncoder() { |
l.stateChanged(e); |
||||||
return encoder; |
} |
||||||
} |
} |
||||||
|
|
||||||
public void setEncoder(Encoder encoder) { |
public Encoder getEncoder() { |
||||||
this.encoder = encoder; |
return encoder; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
public void setEncoder(Encoder encoder) { |
||||||
public void validateValue() throws ValidationException { |
this.encoder = encoder; |
||||||
if (decoder != null) { |
} |
||||||
decoder.validate(txtValue.getText()); |
|
||||||
} |
@Override |
||||||
} |
public void validateValue() throws ValidationException { |
||||||
|
if (decoder != null) { |
||||||
public static void showMessage(String message, Component editorComponent) { |
decoder.validate(txtValue.getText()); |
||||||
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); |
} |
||||||
} |
} |
||||||
|
|
||||||
|
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; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import java.awt.*; |
||||||
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
||||||
|
|
||||||
import javax.swing.JComponent; |
import javax.swing.*; |
||||||
|
|
||||||
import com.fr.design.mainframe.widget.editors.ITextComponent; |
import com.fr.design.mainframe.widget.editors.ITextComponent; |
||||||
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer; |
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer; |
||||||
|
|
||||||
public class RendererField extends JComponent implements ITextComponent{ |
public class RendererField extends JComponent implements ITextComponent{ |
||||||
private GenericCellRenderer renderer; |
private GenericCellRenderer renderer; |
||||||
|
|
||||||
public RendererField(GenericCellRenderer renderer) { |
public RendererField(GenericCellRenderer renderer) { |
||||||
this.setLayout(new BorderLayout()); |
this.setLayout(new BorderLayout()); |
||||||
this.renderer = renderer; |
this.renderer = renderer; |
||||||
add(renderer, BorderLayout.CENTER); |
add(renderer, BorderLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void addActionListener(ActionListener l) { |
public void addActionListener(ActionListener l) { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String getText() { |
public String getText() { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void selectAll() { |
public void selectAll() { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void setEditable(boolean editable) { |
public void setEditable(boolean editable) { |
||||||
this.setEnabled(editable); |
this.setEnabled(editable); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void setText(String text) { |
public void setText(String text) { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void setValue(Object v) { |
public void setValue(Object v) { |
||||||
renderer.setValue(v); |
renderer.setValue(v); |
||||||
this.repaint(); |
this.repaint(); |
||||||
} |
} |
||||||
} |
} |
@ -1,23 +1,23 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import com.fr.design.designer.properties.Encoder; |
import com.fr.design.designer.properties.Encoder; |
||||||
|
|
||||||
public abstract class UneditableAccessibleEditor extends BaseAccessibleEditor { |
public abstract class UneditableAccessibleEditor extends BaseAccessibleEditor { |
||||||
|
|
||||||
protected Object value; |
protected Object value; |
||||||
|
|
||||||
public UneditableAccessibleEditor(Encoder enc) { |
public UneditableAccessibleEditor(Encoder enc) { |
||||||
super(enc, null, true); |
super(enc, null, true); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Object getValue() { |
public Object getValue() { |
||||||
return value; |
return value; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void setValue(Object v) { |
public void setValue(Object v) { |
||||||
this.value = v; |
this.value = v; |
||||||
super.setValue(v); |
super.setValue(v); |
||||||
} |
} |
||||||
} |
} |
@ -1,94 +1,94 @@ |
|||||||
package com.fr.design.mainframe.widget.renderer; |
package com.fr.design.mainframe.widget.renderer; |
||||||
|
|
||||||
import java.awt.Color; |
import java.awt.Color; |
||||||
import java.awt.Component; |
import java.awt.Component; |
||||||
|
|
||||||
import javax.swing.JComponent; |
import javax.swing.JComponent; |
||||||
import javax.swing.JTable; |
import javax.swing.JTable; |
||||||
import javax.swing.UIManager; |
import javax.swing.UIManager; |
||||||
import javax.swing.border.Border; |
import javax.swing.border.Border; |
||||||
import javax.swing.border.EmptyBorder; |
import javax.swing.border.EmptyBorder; |
||||||
import javax.swing.table.TableCellRenderer; |
import javax.swing.table.TableCellRenderer; |
||||||
|
|
||||||
public abstract class GenericCellRenderer extends JComponent implements TableCellRenderer { |
public abstract class GenericCellRenderer extends JComponent implements TableCellRenderer { |
||||||
|
|
||||||
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); |
||||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); |
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
||||||
Component component = getRendererComponent(); |
Component component = getRendererComponent(); |
||||||
Color fg = null; |
Color fg = null; |
||||||
Color bg = null; |
Color bg = null; |
||||||
JTable.DropLocation dropLocation = table.getDropLocation(); |
JTable.DropLocation dropLocation = table.getDropLocation(); |
||||||
|
|
||||||
if ((dropLocation != null) && !dropLocation.isInsertRow() |
if ((dropLocation != null) && !dropLocation.isInsertRow() |
||||||
&& !dropLocation.isInsertColumn() |
&& !dropLocation.isInsertColumn() |
||||||
&& (dropLocation.getRow() == row) |
&& (dropLocation.getRow() == row) |
||||||
&& (dropLocation.getColumn() == column)) { |
&& (dropLocation.getColumn() == column)) { |
||||||
fg = UIManager.getColor("Table.dropCellForeground"); |
fg = UIManager.getColor("Table.dropCellForeground"); |
||||||
bg = UIManager.getColor("Table.dropCellBackground"); |
bg = UIManager.getColor("Table.dropCellBackground"); |
||||||
|
|
||||||
isSelected = true; |
isSelected = true; |
||||||
} |
} |
||||||
|
|
||||||
if (isSelected) { |
if (isSelected) { |
||||||
component.setForeground((fg == null) ? table.getSelectionForeground() : fg); |
component.setForeground((fg == null) ? table.getSelectionForeground() : fg); |
||||||
component.setBackground((bg == null) ? table.getSelectionBackground() : bg); |
component.setBackground((bg == null) ? table.getSelectionBackground() : bg); |
||||||
} else { |
} else { |
||||||
component.setForeground(table.getForeground()); |
component.setForeground(table.getForeground()); |
||||||
component.setBackground(table.getBackground()); |
component.setBackground(table.getBackground()); |
||||||
} |
} |
||||||
|
|
||||||
component.setFont(table.getFont()); |
component.setFont(table.getFont()); |
||||||
|
|
||||||
if (hasFocus) { |
if (hasFocus) { |
||||||
Border border = null; |
Border border = null; |
||||||
|
|
||||||
if (isSelected) { |
if (isSelected) { |
||||||
border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder"); |
border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder"); |
||||||
} |
} |
||||||
|
|
||||||
if (border == null) { |
if (border == null) { |
||||||
border = UIManager.getBorder("Table.focusCellHighlightBorder"); |
border = UIManager.getBorder("Table.focusCellHighlightBorder"); |
||||||
} |
} |
||||||
|
|
||||||
((JComponent) component).setBorder(border); |
((JComponent) component).setBorder(border); |
||||||
|
|
||||||
if (!isSelected && table.isCellEditable(row, column)) { |
if (!isSelected && table.isCellEditable(row, column)) { |
||||||
Color col; |
Color col; |
||||||
col = UIManager.getColor("Table.focusCellForeground"); |
col = UIManager.getColor("Table.focusCellForeground"); |
||||||
|
|
||||||
if (col != null) { |
if (col != null) { |
||||||
component.setForeground(col); |
component.setForeground(col); |
||||||
} |
} |
||||||
|
|
||||||
col = UIManager.getColor("Table.focusCellBackground"); |
col = UIManager.getColor("Table.focusCellBackground"); |
||||||
|
|
||||||
if (col != null) { |
if (col != null) { |
||||||
component.setBackground(col); |
component.setBackground(col); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
((JComponent) component).setBorder(getNoFocusBorder()); |
((JComponent) component).setBorder(getNoFocusBorder()); |
||||||
|
|
||||||
setValue(value); |
setValue(value); |
||||||
|
|
||||||
return component; |
return component; |
||||||
} |
} |
||||||
|
|
||||||
private static Border getNoFocusBorder() { |
private static Border getNoFocusBorder() { |
||||||
if (System.getSecurityManager() != null) { |
if (System.getSecurityManager() != null) { |
||||||
return SAFE_NO_FOCUS_BORDER; |
return SAFE_NO_FOCUS_BORDER; |
||||||
} else { |
} else { |
||||||
return noFocusBorder; |
return noFocusBorder; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
public Component getRendererComponent() { |
public Component getRendererComponent() { |
||||||
return this; |
return this; |
||||||
} |
} |
||||||
|
|
||||||
public abstract void setValue(Object value); |
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