|
|
@ -7,6 +7,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.share.collect.ComponentCollector; |
|
|
|
import com.fr.design.mainframe.share.collect.ComponentCollector; |
|
|
|
import com.fr.design.mainframe.share.ui.widgetfilter.FilterConfigPane; |
|
|
|
import com.fr.design.mainframe.share.ui.widgetfilter.FilterConfigPane; |
|
|
|
import com.fr.design.mainframe.share.util.OnlineShopUtils; |
|
|
|
import com.fr.design.mainframe.share.util.OnlineShopUtils; |
|
|
@ -21,6 +22,7 @@ import javax.swing.UIManager; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.FontMetrics; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Point; |
|
|
|
import java.awt.Point; |
|
|
@ -54,7 +56,6 @@ public class EmbedPane extends JPanel { |
|
|
|
private JPanel initCenterPane(OnlineEmbedFilterShowPane showPane) { |
|
|
|
private JPanel initCenterPane(OnlineEmbedFilterShowPane showPane) { |
|
|
|
JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
jPanel.setBackground(Color.WHITE); |
|
|
|
jPanel.setBackground(Color.WHITE); |
|
|
|
jPanel.setPreferredSize(new Dimension(200, 200)); |
|
|
|
|
|
|
|
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
|
|
|
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
|
|
|
|
|
|
|
|
|
|
|
FilterConfigPane filterConfigPane = new FilterConfigPane(OnlineShopUtils.getEmbPaneShowFilterTypeInfos(), false) { |
|
|
|
FilterConfigPane filterConfigPane = new FilterConfigPane(OnlineShopUtils.getEmbPaneShowFilterTypeInfos(), false) { |
|
|
@ -65,9 +66,9 @@ public class EmbedPane extends JPanel { |
|
|
|
}; |
|
|
|
}; |
|
|
|
UIButton searchBtn = initSearchBtn(filterConfigPane, showPane); |
|
|
|
UIButton searchBtn = initSearchBtn(filterConfigPane, showPane); |
|
|
|
filterConfigPane.setBorder(null); |
|
|
|
filterConfigPane.setBorder(null); |
|
|
|
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip")); |
|
|
|
JPanel tipPane = getFilterTipPane(); |
|
|
|
tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
|
|
|
tipPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
|
|
|
jPanel.add(tipLabel, BorderLayout.NORTH); |
|
|
|
jPanel.add(tipPane, BorderLayout.NORTH); |
|
|
|
jPanel.add(filterConfigPane, BorderLayout.CENTER); |
|
|
|
jPanel.add(filterConfigPane, BorderLayout.CENTER); |
|
|
|
JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
southPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
|
|
|
southPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
|
|
@ -79,6 +80,43 @@ public class EmbedPane extends JPanel { |
|
|
|
return jPanel; |
|
|
|
return jPanel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel getFilterTipPane() { |
|
|
|
|
|
|
|
String remark = Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip"); |
|
|
|
|
|
|
|
UILabel label = new UILabel(); |
|
|
|
|
|
|
|
label.setSize(new Dimension(212, 30)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//用THML标签进行拼接,以实现自动换行
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder("<html>"); |
|
|
|
|
|
|
|
char[] chars = remark.toCharArray(); |
|
|
|
|
|
|
|
//获取字体计算大小
|
|
|
|
|
|
|
|
FontMetrics fontMetrics = label.getFontMetrics(label.getFont()); |
|
|
|
|
|
|
|
int start = 0; |
|
|
|
|
|
|
|
int len = 0; |
|
|
|
|
|
|
|
while (start + len < remark.length()) { |
|
|
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
len++; |
|
|
|
|
|
|
|
if (start + len > remark.length()) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
if (fontMetrics.charsWidth(chars, start, len) |
|
|
|
|
|
|
|
> label.getWidth()) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
builder.append(chars, start, len - 1).append("<br/>"); |
|
|
|
|
|
|
|
start = start + len - 1; |
|
|
|
|
|
|
|
len = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//拼接剩余部分
|
|
|
|
|
|
|
|
builder.append(chars, start, remark.length() - start); |
|
|
|
|
|
|
|
builder.append("</html>"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
label.setText(builder.toString()); |
|
|
|
|
|
|
|
jPanel.add(label); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return jPanel; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private UIButton initSearchBtn(FilterConfigPane filterConfigPane, OnlineEmbedFilterShowPane showPane) { |
|
|
|
private UIButton initSearchBtn(FilterConfigPane filterConfigPane, OnlineEmbedFilterShowPane showPane) { |
|
|
|
UIButton searchBtn = new UIButton(Toolkit.i18nText("Fine-Design_Share_Online_Query_Recommend_Component")); |
|
|
|
UIButton searchBtn = new UIButton(Toolkit.i18nText("Fine-Design_Share_Online_Query_Recommend_Component")); |
|
|
|
searchBtn.setUI(new UIButtonUI() { |
|
|
|
searchBtn.setUI(new UIButtonUI() { |
|
|
@ -86,7 +124,7 @@ public class EmbedPane extends JPanel { |
|
|
|
protected void paintBorder(Graphics g, UIButton b) { |
|
|
|
protected void paintBorder(Graphics g, UIButton b) { |
|
|
|
Color oldColor = g.getColor(); |
|
|
|
Color oldColor = g.getColor(); |
|
|
|
g.setColor(SEARCH_BUTTON_COLOR); |
|
|
|
g.setColor(SEARCH_BUTTON_COLOR); |
|
|
|
g.drawRoundRect(0, 0, b.getWidth() - 4, b.getHeight() - 4, 2, 2); |
|
|
|
g.drawRoundRect(2, 2, b.getWidth() - 4, b.getHeight() - 4, 2, 2); |
|
|
|
g.setColor(oldColor); |
|
|
|
g.setColor(oldColor); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -96,7 +134,7 @@ public class EmbedPane extends JPanel { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
String filterStr = filterConfigPane.assembleFilter(); |
|
|
|
String filterStr = filterConfigPane.assembleFilter(); |
|
|
|
if (StringUtils.isEmpty(filterStr)) { |
|
|
|
if (StringUtils.isEmpty(filterStr)) { |
|
|
|
FineJOptionPane.showMessageDialog(EmbedPane.this, |
|
|
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
|
|
|
Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Warning_Tip"), |
|
|
|
Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Warning_Tip"), |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), WARNING_MESSAGE, |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), WARNING_MESSAGE, |
|
|
|
UIManager.getIcon("OptionPane.warningIcon")); |
|
|
|
UIManager.getIcon("OptionPane.warningIcon")); |
|
|
|