Browse Source

REPORT-1384 增加控件管理中的按钮颜色设置

master
kerry 8 years ago
parent
commit
e21a7e997d
  1. 29
      designer/src/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java
  2. 6
      designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java
  3. 1
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

29
designer/src/com/fr/design/widget/ui/btn/ButtonSytleDefinedPane.java

@ -1,12 +1,13 @@
package com.fr.design.widget.ui.btn; package com.fr.design.widget.ui.btn;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import com.fr.base.background.ColorBackground;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -18,7 +19,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.frpane.ImgChoosePane; import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.form.ui.FreeButton; import com.fr.form.ui.FreeButton;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -84,7 +85,7 @@ public class ButtonSytleDefinedPane extends BasicPane {
class BackgroundPane extends JPanel { class BackgroundPane extends JPanel {
private UIButton editButton; private UIButton editButton;
private ImgChoosePane choosePane; private BackgroundButtonPane choosePane;
private Background background; private Background background;
private UILabel ImagePreviewPane; private UILabel ImagePreviewPane;
@ -106,7 +107,7 @@ public class ButtonSytleDefinedPane extends BasicPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (choosePane == null) { if (choosePane == null) {
choosePane = new ImgChoosePane(); choosePane = new BackgroundButtonPane();
} }
BasicDialog dlg = choosePane.showWindow(SwingUtilities BasicDialog dlg = choosePane.showWindow(SwingUtilities
.getWindowAncestor(ButtonSytleDefinedPane.this)); .getWindowAncestor(ButtonSytleDefinedPane.this));
@ -116,7 +117,10 @@ public class ButtonSytleDefinedPane extends BasicPane {
populate(choosePane.update()); populate(choosePane.update());
} }
}); });
choosePane.populate((ImageBackground) BackgroundPane.this.background); if(BackgroundPane.this.background == null){
BackgroundPane.this.background = new ColorBackground();
}
choosePane.populate((Background) BackgroundPane.this.background);
dlg.setVisible(true); dlg.setVisible(true);
} }
}); });
@ -125,15 +129,22 @@ public class ButtonSytleDefinedPane extends BasicPane {
public void populate(Background background) { public void populate(Background background) {
this.background = background; this.background = background;
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) { if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage())); ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage()));
} else { } 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.setIcon(null);
ImagePreviewPane.setOpaque(false);
ImagePreviewPane.setBackground(null);
} }
} }
public ImageBackground update() { public Background update() {
return (ImageBackground) background; return background;
} }
} }
} }

6
designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java

@ -4,6 +4,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import java.util.HashMap;
/** /**
* Created by ibm on 2017/1/5. * Created by ibm on 2017/1/5.
*/ */
@ -50,4 +52,8 @@ public class BackgroundButtonPane extends BackgroundPane {
return quickPane; return quickPane;
} }
public void populate(Background background) {
cacheMap = new HashMap<>();
super.populate(background);
}
} }

1
designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

@ -31,6 +31,7 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
} }
private void initComponents() { private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.setPreferredSize(new Dimension(600, 341)); advancedPane.setPreferredSize(new Dimension(600, 341));
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();

Loading…
Cancel
Save