Browse Source

REPORT-79093 运营产品化二期(遗留)

1、格式化代码
feature/x
Link.Zhao 2 years ago
parent
commit
8db8b207d2
  1. 46
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 17
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java
  3. 15
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java
  4. 3
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java
  5. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java
  6. 3
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java
  7. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java
  8. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java
  9. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java

46
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -29,6 +29,7 @@ import java.util.Stack;
*/
public class AlphaFineConfigManager implements XMLable {
public static final String COMMA = ",";
private static final long serialVersionUID = -8170289826729582122L;
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
/**
@ -91,27 +92,20 @@ public class AlphaFineConfigManager implements XMLable {
* 是否提醒
*/
private boolean needRemind = true;
/**
* 产品动态
*/
private boolean productDynamics = true;
/**
* 模板商城是否展示
* */
*/
private boolean showTemplateShop = true;
/**
* tab页排序
* 默认排序动态模板商城帮助文档插件中心功能我的模板
* */
*/
private String[] tabOrder;
public static final String COMMA = ",";
private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO;
@ -207,7 +201,7 @@ public class AlphaFineConfigManager implements XMLable {
if (ComparatorUtils.equals(reader.getTagName(), "history")) {
String tmpVal = reader.getElementValue();
if (tmpVal != null) {
tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY);
tmpVal = tmpVal.replace("[", StringUtils.EMPTY).replace("]", StringUtils.EMPTY);
Stack<String> stack = new SizedStack<>(3);
String[] historyList = tmpVal.split(",");
for (String history : historyList) {
@ -231,7 +225,7 @@ public class AlphaFineConfigManager implements XMLable {
if (ComparatorUtils.equals(reader.getTagName(), "readId")) {
String tmpVal = reader.getElementValue();
if (tmpVal != null) {
tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY);
tmpVal = tmpVal.replace("[", StringUtils.EMPTY).replace("]", StringUtils.EMPTY);
String[] idArr = tmpVal.split(",");
Set<Long> setId = new HashSet<>();
for (String id : idArr) {
@ -329,7 +323,7 @@ public class AlphaFineConfigManager implements XMLable {
/**
* 返回默认排序
* */
*/
private String getDefaultTabOrder() {
return AlphaFineConstants.PRODUCT_NEWS + COMMA + AlphaFineConstants.TEMPLATE_SHOP + COMMA + AlphaFineConstants.HELP + COMMA + AlphaFineConstants.PLUGIN + COMMA + AlphaFineConstants.FUNCTION + COMMA + AlphaFineConstants.MY_TEMPLATES;
}
@ -350,14 +344,14 @@ public class AlphaFineConfigManager implements XMLable {
this.containDocument = containDocument;
}
public void setContainMyTemplate(boolean containMyTemplate) {
this.containMyTemplate = containMyTemplate;
}
public boolean isContainMyTemplate() {
return containMyTemplate;
}
public void setContainMyTemplate(boolean containMyTemplate) {
this.containMyTemplate = containMyTemplate;
}
public boolean isContainTemplate() {
return containTemplate;
}
@ -478,6 +472,10 @@ public class AlphaFineConfigManager implements XMLable {
return productDynamics && FRContext.isChineseEnv();
}
public void setProductDynamics(boolean productDynamics) {
this.productDynamics = productDynamics;
}
public boolean hasTemplateShop() {
return showTemplateShop && FRContext.isChineseEnv();
}
@ -486,13 +484,9 @@ public class AlphaFineConfigManager implements XMLable {
this.showTemplateShop = showTemplateShop;
}
public void setProductDynamics(boolean productDynamics) {
this.productDynamics = productDynamics;
}
/**
* 返回tab显示顺序
* */
*/
public String[] getTabOrder() {
if (tabOrder == null) {
tabOrder = getDefaultTabOrder().split(COMMA);
@ -500,9 +494,13 @@ public class AlphaFineConfigManager implements XMLable {
return tabOrder;
}
public void setTabOrder(String[] tabOrder) {
this.tabOrder = tabOrder;
}
/**
* getTabOrder的tostring
* */
*/
public String getTabOrderString() {
StringBuilder sb = new StringBuilder();
for (String s : getTabOrder()) {
@ -510,8 +508,4 @@ public class AlphaFineConfigManager implements XMLable {
}
return sb.toString();
}
public void setTabOrder(String[] tabOrder) {
this.tabOrder = tabOrder;
}
}

17
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java

@ -24,10 +24,11 @@ import java.util.Map;
import java.util.function.Function;
/**
* alphafine设置 - 搜索范围 - 自定义排序 - 弹出面板
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine设置 - 搜索范围 - 自定义排序 - 弹出面板
*/
public class CustomSortPane extends JPanel {
@ -78,7 +79,7 @@ public class CustomSortPane extends JPanel {
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"));
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"));
top.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, 0);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
@ -87,7 +88,7 @@ public class CustomSortPane extends JPanel {
});
bottom.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
@ -96,8 +97,8 @@ public class CustomSortPane extends JPanel {
});
up.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1);
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
@ -105,7 +106,7 @@ public class CustomSortPane extends JPanel {
});
down.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
@ -157,7 +158,7 @@ public class CustomSortPane extends JPanel {
// 计算当前排序
String[] newOrder = new String[currentTabOrder.length];
Component[] components =sortItemPane.getComponents();
Component[] components = sortItemPane.getComponents();
for (String s : exTab.keySet()) {
newOrder[exTab.get(s)] = s;
}
@ -165,7 +166,7 @@ public class CustomSortPane extends JPanel {
int t = 0;
for (int i = 0; i < newOrder.length; i++) {
if (StringUtils.isEmpty(newOrder[i])) {
newOrder[i] = ((MenuLabel)components[t++]).getText();
newOrder[i] = ((MenuLabel) components[t++]).getText();
}
}
parentPane.setCurrentOrder(newOrder);

15
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java

@ -13,10 +13,11 @@ import java.awt.event.MouseListener;
import java.util.function.Function;
/**
* 菜单选项label
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* 菜单选项label
*/
public class MenuLabel extends UILabel {
@ -27,7 +28,7 @@ public class MenuLabel extends UILabel {
private static final int WIDTH = 147;
private MenuLabelPane parentMenu;
private Function function;
private final Function function;
private boolean selected;
public MenuLabel(String text, Function function) {
@ -46,11 +47,15 @@ public class MenuLabel extends UILabel {
public void setUI(LabelUI ui) {
super.setUI(ui);
this.setBackground(BACKGROUND_COLOR);
this.setBorder(BorderFactory.createEmptyBorder(2,10,1,10));
this.setBorder(BorderFactory.createEmptyBorder(2, 10, 1, 10));
this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
this.setFont(DesignUtils.getDefaultGUIFont().applySize(12));
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
if (selected) {
parentMenu.setNoneSelected();
@ -63,10 +68,6 @@ public class MenuLabel extends UILabel {
}
}
public boolean isSelected() {
return selected;
}
MouseListener createMouseListener() {
return new MouseAdapter() {
@Override

3
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java

@ -5,10 +5,11 @@ import java.awt.FlowLayout;
import java.util.List;
/**
* 简单菜单面板
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* 简单菜单面板
*/
public class MenuLabelPane extends JPanel {

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java

@ -12,10 +12,11 @@ import java.awt.event.MouseEvent;
import java.util.List;
/**
* alphaFine - 推荐搜索词标签
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/19
* alphaFine - 推荐搜索词标签
*/
public class RecommendSearchLabel extends JPanel {
@ -36,7 +37,7 @@ public class RecommendSearchLabel extends JPanel {
/**
* 推荐搜索词绑定alphaFine搜索事件
* */
*/
public class SearchKeyLabel extends JLabel {
String searchKey;

3
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java

@ -20,10 +20,11 @@ import java.util.ArrayList;
import java.util.List;
/**
* alphafine - 搜索提示面板
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine - 搜索提示面板
*/
public class SearchHintPane extends JPanel {

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java

@ -11,10 +11,11 @@ import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* alphaFine - 默认展示页面
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphaFine - 默认展示页面
*/
public class DefaultContentPane extends JPanel {
@ -25,7 +26,7 @@ public class DefaultContentPane extends JPanel {
public DefaultContentPane(CellType cellType, AlphaFineFrame parentWindow) {
this.setLayout(new BorderLayout());
this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE);
this.searchWorkerManager = new SearchWorkerManager(
this.searchWorkerManager = new SearchWorkerManager(
cellType,
searchTextBean -> SearchProviderRegistry.getSearchProvider(cellType).getDefaultResult(),
parentWindow,

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java

@ -16,24 +16,24 @@ import java.util.ArrayList;
import java.util.List;
/**
* alphafine插件默认页
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine插件默认页
*/
public class DefaultPluginContentPane extends DefaultContentPane {
private static final String[] HINTS = CloudCenter.getInstance().acquireConf("alphafine.plugin.recommend", "JS,API,JSON").split(",");
// 左边展示内容,右边展示搜索提示
private SearchWorkerManager searchWorkerManager;
private CellType cellType;
private static final String[] HINTS = CloudCenter.getInstance().acquireConf("alphafine.plugin.recommend", "JS,API,JSON").split(",");
public DefaultPluginContentPane(CellType cellType, AlphaFineFrame parentWindow) {
super();
this.setLayout(new BorderLayout());
this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE);
new SwingWorker<Boolean, Void>(){
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
add(new SearchLoadingPane());
@ -53,7 +53,7 @@ public class DefaultPluginContentPane extends DefaultContentPane {
for (String s : HINTS) {
searchKeys.add(s);
}
searchWorkerManager = new SearchWorkerManager(
searchWorkerManager = new SearchWorkerManager(
cellType,
searchTextBean -> SearchProviderRegistry.getSearchProvider(cellType).getDefaultResult(),
parentWindow,

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java

@ -10,10 +10,11 @@ import java.util.HashMap;
import java.util.Map;
/**
* alphafine搜索提供者注册到这里
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine搜索提供者注册到这里
*/
public class SearchProviderRegistry {
private static Map<CellType, AlphaFineSearchProvider> map;
@ -27,7 +28,7 @@ public class SearchProviderRegistry {
/**
* 根据celltype获得对应searchProvider
* */
*/
public static AlphaFineSearchProvider getSearchProvider(CellType cellType) {
return map.get(cellType);
}

Loading…
Cancel
Save