juhaoyu 8 years ago
parent
commit
25b825d083
  1. 3
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  2. 4
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  3. 13
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  4. 3
      designer/src/com/fr/design/mainframe/bbs/BBSConstants.java
  5. 3
      designer_base/src/com/fr/design/dialog/InformationWarnPane.java
  6. 5
      designer_base/src/com/fr/design/extra/QQLoginWebPane.java
  7. 11
      designer_base/src/com/fr/design/gui/UILookAndFeel.java
  8. 14
      designer_base/src/com/fr/design/gui/autocomplete/TipUtil.java
  9. 6
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java

3
designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -4,6 +4,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.stable.resource.ResourceLoader;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -33,7 +34,7 @@ public class ContentCellRender implements ListCellRenderer<Object> {
AlphaCellModel model = (AlphaCellModel) value; AlphaCellModel model = (AlphaCellModel) value;
name.setText(model.getName()); name.setText(model.getName());
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
name.setIcon(new ImageIcon(getClass().getResource(iconUrl))); name.setIcon(new ImageIcon(ResourceLoader.getResource(iconUrl, getClass())));
name.setFont(AlphaFineConstants.MEDIUM_FONT); name.setFont(AlphaFineConstants.MEDIUM_FONT);
name.setForeground(AlphaFineConstants.BLACK); name.setForeground(AlphaFineConstants.BLACK);
name.setVerticalTextPosition(SwingConstants.CENTER); name.setVerticalTextPosition(SwingConstants.CENTER);

4
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -3,6 +3,8 @@ package com.fr.design.mainframe.alphafine.cell.render;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.stable.resource.ResourceLoader;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -35,7 +37,7 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.add(this.more, BorderLayout.EAST); panel.add(this.more, BorderLayout.EAST);
} }
if (moreModel.isLoading()) { if (moreModel.isLoading()) {
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif")); ImageIcon imageIcon = new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/loading.gif", getClass()));
//设置cell的加载动画 //设置cell的加载动画
imageIcon.setImageObserver(list); imageIcon.setImageObserver(list);

13
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -10,8 +10,8 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender;
import com.fr.design.mainframe.alphafine.cell.model.*; import com.fr.design.mainframe.alphafine.cell.model.*;
import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender;
import com.fr.design.mainframe.alphafine.listener.ComponentHandler; import com.fr.design.mainframe.alphafine.listener.ComponentHandler;
import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter;
import com.fr.design.mainframe.alphafine.model.SearchListModel; import com.fr.design.mainframe.alphafine.model.SearchListModel;
@ -36,6 +36,7 @@ import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.resource.ResourceLoader;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
@ -45,7 +46,7 @@ import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
@ -82,7 +83,7 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.setBorderPainted(false); searchTextField.setBorderPainted(false);
searchTextField.initKeyListener(this); searchTextField.initKeyListener(this);
JPanel topPane = new JPanel(new BorderLayout()); JPanel topPane = new JPanel(new BorderLayout());
UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); UILabel iconLabel = new UILabel(new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png", getClass())));
iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE);
iconLabel.setOpaque(true); iconLabel.setOpaque(true);
iconLabel.setBackground(Color.white); iconLabel.setBackground(Color.white);
@ -98,7 +99,7 @@ public class AlphaFineDialog extends UIDialog {
}; };
closeButton.setContentAreaFilled(false); closeButton.setContentAreaFilled(false);
closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE);
closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png"))); closeButton.setIcon(new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png", getClass())));
closeButton.set4ToolbarButton(); closeButton.set4ToolbarButton();
closeButton.addActionListener(new ActionListener() { closeButton.addActionListener(new ActionListener() {
@Override @Override
@ -371,7 +372,7 @@ public class AlphaFineDialog extends UIDialog {
bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl()));
} catch (IOException e) { } catch (IOException e) {
try { try {
bufferedImage = ImageIO.read(getClass().getResource("/com/fr/design/mainframe/alphafine/images/default_product.png")); bufferedImage = ImageIO.read(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/default_product.png", getClass()));
} catch (IOException e1) { } catch (IOException e1) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
@ -417,7 +418,7 @@ public class AlphaFineDialog extends UIDialog {
private void showDefaultPreviewPane() { private void showDefaultPreviewPane() {
rightSearchResultPane.removeAll(); rightSearchResultPane.removeAll();
UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); UILabel label = new UILabel(new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/opening.gif", getClass())));
label.setBorder(BorderFactory.createEmptyBorder(120,0,0,0)); label.setBorder(BorderFactory.createEmptyBorder(120,0,0,0));
rightSearchResultPane.add(label, BorderLayout.CENTER); rightSearchResultPane.add(label, BorderLayout.CENTER);
validate(); validate();

3
designer/src/com/fr/design/mainframe/bbs/BBSConstants.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.resource.ResourceLoader;
import java.util.Properties; import java.util.Properties;
@ -43,7 +44,7 @@ public class BBSConstants {
if (PROP == null) { if (PROP == null) {
PROP = new Properties(); PROP = new Properties();
try { try {
PROP.load(BBSConstants.class.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties")); PROP.load(ResourceLoader.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties", BBSConstants.class));
} catch (Exception e) { } catch (Exception e) {
} }
} }

3
designer_base/src/com/fr/design/dialog/InformationWarnPane.java

@ -25,6 +25,7 @@ import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.resource.ResourceLoader;
public class InformationWarnPane extends JPanel{ public class InformationWarnPane extends JPanel{
private UITextArea moreText; private UITextArea moreText;
@ -42,7 +43,7 @@ public class InformationWarnPane extends JPanel{
this.title = title; this.title = title;
this.setLayout(null); this.setLayout(null);
this.setBounds(5,5,410,130); this.setBounds(5,5,410,130);
UILabel image = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/images/buttonicon/warn.png"))); UILabel image = new UILabel(new ImageIcon(ResourceLoader.getResource("/com/fr/design/images/buttonicon/warn.png", getClass())));
image.setBounds(10, 25, 80, 80); image.setBounds(10, 25, 80, 80);
UITextArea warnLabel = new UITextArea(infor); UITextArea warnLabel = new UITextArea(infor);
warnLabel.setLineWrap(true); warnLabel.setLineWrap(true);

5
designer_base/src/com/fr/design/extra/QQLoginWebPane.java

@ -5,6 +5,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.stable.resource.ResourceLoader;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
@ -74,7 +75,7 @@ public class QQLoginWebPane extends JFXPanel {
try { try {
primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setScene(new Scene(layout)); primaryStage.setScene(new Scene(layout));
webView.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm()); webView.getScene().getStylesheets().add(ResourceLoader.getResource("modal-dialog.css", getClass()).toExternalForm());
primaryStage.initStyle(StageStyle.UTILITY); primaryStage.initStyle(StageStyle.UTILITY);
primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT)); primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT));
primaryStage.setX(0); primaryStage.setX(0);
@ -193,7 +194,7 @@ public class QQLoginWebPane extends JFXPanel {
); );
configDrag(dialog); configDrag(dialog);
// style and show the dialog. // style and show the dialog.
dialog.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm()); dialog.getScene().getStylesheets().add(ResourceLoader.getResource("modal-dialog.css", getClass()).toExternalForm());
dialog.setOnCloseRequest(new EventHandler<WindowEvent>() { dialog.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override @Override
public void handle(WindowEvent event) { public void handle(WindowEvent event) {

11
designer_base/src/com/fr/design/gui/UILookAndFeel.java

@ -3,10 +3,12 @@ package com.fr.design.gui;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.borders.*; import com.fr.design.gui.borders.*;
import com.fr.design.gui.frpane.UIBasicOptionPaneUI; import com.fr.design.gui.frpane.UIBasicOptionPaneUI;
import com.fr.design.gui.ibutton.UIBasicButtonUI;
import com.fr.design.gui.ibutton.UIButtonBorder; import com.fr.design.gui.ibutton.UIButtonBorder;
import com.fr.design.gui.ibutton.UIRadioButtonMenuItemUI; import com.fr.design.gui.ibutton.UIRadioButtonMenuItemUI;
import com.fr.design.gui.ibutton.UIRadioButtonUI; import com.fr.design.gui.ibutton.UIRadioButtonUI;
import com.fr.design.gui.icheckbox.UICheckBoxUI; import com.fr.design.gui.icheckbox.UICheckBoxUI;
import com.fr.design.gui.icombobox.UIBasicComboBoxUI;
import com.fr.design.gui.icontainer.UIScrollPaneBorder; import com.fr.design.gui.icontainer.UIScrollPaneBorder;
import com.fr.design.gui.icontainer.UIScrollPaneUI; import com.fr.design.gui.icontainer.UIScrollPaneUI;
import com.fr.design.gui.icontainer.UITableScrollPaneBorder; import com.fr.design.gui.icontainer.UITableScrollPaneBorder;
@ -16,6 +18,7 @@ import com.fr.design.gui.imenu.UIPopupMenuBorder;
import com.fr.design.gui.imenu.UIPopupMenuSeparatorUI; import com.fr.design.gui.imenu.UIPopupMenuSeparatorUI;
import com.fr.design.gui.iprogressbar.UIProgressBarBorder; import com.fr.design.gui.iprogressbar.UIProgressBarBorder;
import com.fr.design.gui.iprogressbar.UIProgressBarUI; import com.fr.design.gui.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.iscrollbar.UIBasicScrollBarUI;
import com.fr.design.gui.ispinner.UISpinnerUI; import com.fr.design.gui.ispinner.UISpinnerUI;
import com.fr.design.gui.isplitpanedivider.UISplitPaneUI; import com.fr.design.gui.isplitpanedivider.UISplitPaneUI;
import com.fr.design.gui.itable.UIBasicTableUI; import com.fr.design.gui.itable.UIBasicTableUI;
@ -23,10 +26,8 @@ import com.fr.design.gui.itoolbar.UIToolBarBorder;
import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI; import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI;
import com.fr.design.gui.itooltip.UIToolTipBorder; import com.fr.design.gui.itooltip.UIToolTipBorder;
import com.fr.design.gui.itree.UITreeUI; import com.fr.design.gui.itree.UITreeUI;
import com.fr.design.gui.iscrollbar.UIBasicScrollBarUI;
import com.fr.design.gui.icombobox.UIBasicComboBoxUI;
import com.fr.design.gui.ibutton.UIBasicButtonUI;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.stable.resource.ResourceLoader;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
@ -187,8 +188,8 @@ public class UILookAndFeel extends MetalLookAndFeel {
if (url == null) { if (url == null) {
// Another try // Another try
url = UILookAndFeel.class.getResource( url = ResourceLoader.getResource(
"com/fr/design/images/lookandfeel/" + fileName); "com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class);
if (url == null) { if (url == null) {
FRLogger.getLogger().error("Icon directory could not be resolved."); FRLogger.getLogger().error("Icon directory could not be resolved.");

14
designer_base/src/com/fr/design/gui/autocomplete/TipUtil.java

@ -8,16 +8,14 @@
*/ */
package com.fr.design.gui.autocomplete; package com.fr.design.gui.autocomplete;
import java.awt.Color; import com.fr.stable.resource.ResourceLoader;
import java.awt.Font;
import java.awt.SystemColor; import javax.swing.*;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.JEditorPane;
import javax.swing.UIManager;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.text.html.HTMLDocument; import javax.swing.text.html.HTMLDocument;
import java.awt.*;
import java.net.URL;
/** /**
@ -167,7 +165,7 @@ class TipUtil {
doc.getStyleSheet().addRule( doc.getStyleSheet().addRule(
"a { color: " + Util.getHexString(linkFG) + "; }"); "a { color: " + Util.getHexString(linkFG) + "; }");
URL url = TipUtil.class.getResource("bullet_black.png"); URL url = ResourceLoader.getResource("bullet_black.png", TipUtil.class);
if (url!=null) { if (url!=null) {
doc.getStyleSheet().addRule( doc.getStyleSheet().addRule(
"ul { list-style-image: '" + url.toString() + "'; }"); "ul { list-style-image: '" + url.toString() + "'; }");

6
designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.type;
import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.resource.ResourceLoader;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -14,7 +15,7 @@ public class ChartImagePane extends ChartSelectDemoPane {
public boolean isDoubleClicked = false; public boolean isDoubleClicked = false;
public ChartImagePane(String iconPath, String tipName) {// 建立太复杂? 耗费内存.. public ChartImagePane(String iconPath, String tipName) {// 建立太复杂? 耗费内存..
UILabel image = new UILabel(new ImageIcon(getClass().getResource(iconPath))); UILabel image = new UILabel(new ImageIcon(ResourceLoader.getResource(iconPath, getClass())));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(image, BorderLayout.CENTER); this.add(image, BorderLayout.CENTER);
addMouseListener(this); addMouseListener(this);
@ -28,7 +29,8 @@ public class ChartImagePane extends ChartSelectDemoPane {
} }
private void constructImagePane(String fullIconPath, String tipName, boolean isDrawRightLine){ private void constructImagePane(String fullIconPath, String tipName, boolean isDrawRightLine){
UILabel image = new UILabel(new ImageIcon(getClass().getResource(fullIconPath)));
UILabel image = new UILabel(new ImageIcon(ResourceLoader.getResource(fullIconPath, getClass())));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(image, BorderLayout.CENTER); this.add(image, BorderLayout.CENTER);
addMouseListener(this); addMouseListener(this);

Loading…
Cancel
Save