Browse Source

REPORT-11403 @Sung:查询结果出来的横向滚动条位置偏上了

调整高度
final/10.0
alex.sung 6 years ago
parent
commit
3847e66b0b
  1. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 17
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -735,7 +735,7 @@ public class AlphaFineDialog extends UIDialog {
if (!isCancelled() && rightSearchResultPane != null) { if (!isCancelled() && rightSearchResultPane != null) {
rightSearchResultPane.removeAll(); rightSearchResultPane.removeAll();
try { try {
rightSearchResultPane.add(new RobotPreviewPane((selectedValue).getName(), get())); rightSearchResultPane.add(new RobotPreviewPane(selectedValue, get()));
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("get hot item content error: " + e.getMessage()); FineLoggerFactory.getLogger().error("get hot item content error: " + e.getMessage());
} catch (ExecutionException e) { } catch (ExecutionException e) {

17
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java

@ -4,6 +4,8 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
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.RobotModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -28,13 +30,14 @@ import java.net.URL;
*/ */
public class RobotPreviewPane extends JPanel { public class RobotPreviewPane extends JPanel {
private static final int TITLE_AREA_HEIGHT = 30; private static final int TITLE_AREA_HEIGHT = 15;
private static final int HOT_TITLE_AREA_HEIGHT = 30;
public RobotPreviewPane(String title, String content) { public RobotPreviewPane(AlphaCellModel model, String content) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
UITextArea titleArea = new UITextArea(title); UITextArea titleArea = new UITextArea(model.getName());
titleArea.setBorder(null); titleArea.setBorder(null);
titleArea.setEditable(false); titleArea.setEditable(false);
titleArea.setForeground(AlphaFineConstants.BLUE); titleArea.setForeground(AlphaFineConstants.BLUE);
@ -74,9 +77,13 @@ public class RobotPreviewPane extends JPanel {
}); });
editorPane.setEditable(false); editorPane.setEditable(false);
UIScrollPane jScrollPane = new UIScrollPane(editorPane); UIScrollPane jScrollPane = new UIScrollPane(editorPane);
jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 30, 0));
jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white)); jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white));
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT)); if (((RobotModel) model).isHotItemModel()) {
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - HOT_TITLE_AREA_HEIGHT));
} else {
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT));
}
add(jScrollPane, BorderLayout.CENTER); add(jScrollPane, BorderLayout.CENTER);
} }
} }

Loading…
Cancel
Save