diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index 7a4f24ea68..09b03c1837 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.designer.EditingState; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; @@ -11,6 +12,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.Inter; import com.fr.grid.Grid; import com.fr.main.impl.WorkBook; +import com.fr.poly.PolyDesigner; import com.fr.report.report.TemplateReport; import javax.swing.*; @@ -45,9 +47,6 @@ public class ReportComponentComposite extends JComponent { private JSliderPane jSliderContainer; - private boolean isCtrl = false; - - /** * Constructor with workbook.. */ @@ -66,29 +65,10 @@ public class ReportComponentComposite extends JComponent { jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); } - KeyListener showValSpinnerKeyListener = new KeyListener() { - @Override - public void keyTyped(KeyEvent e) { - - } - - @Override - public void keyPressed(KeyEvent e) { - if (e.isControlDown()) { - isCtrl = true; - } - } - - @Override - public void keyReleased(KeyEvent e) { - isCtrl = false; - } - }; - MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isCtrl) { + if (InputEventBaseOnOS.isControlDown(e)) { int dir = e.getWheelRotation(); int old_resolution = (int) jSliderContainer.getShowVal().getValue(); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); @@ -149,12 +129,12 @@ public class ReportComponentComposite extends JComponent { } if (centerCardPane.editingComponet.elementCasePane == null) { + centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener); return; } Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid(); this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); - this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener); if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { grid.requestFocus(); diff --git a/designer/src/com/fr/design/mainframe/ReportFloatPane.java b/designer/src/com/fr/design/mainframe/ReportFloatPane.java index b7fead91aa..9f579f4f96 100644 --- a/designer/src/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer/src/com/fr/design/mainframe/ReportFloatPane.java @@ -62,7 +62,7 @@ public class ReportFloatPane extends JPanel { new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane}, }; JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 15)); + leftTopPane.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 15)); this.add(leftTopPane, BorderLayout.NORTH); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 6b1113f358..83945d324e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -16,15 +16,13 @@ import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.model.SearchResult; -import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane; -import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; -import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; -import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane; +import com.fr.design.mainframe.alphafine.preview.*; import com.fr.design.mainframe.alphafine.search.manager.*; import com.fr.form.main.Form; import com.fr.form.main.FormIO; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.http.HttpClient; import com.fr.io.TemplateWorkBookIO; @@ -75,6 +73,7 @@ public class AlphaFineDialog extends UIDialog { private JPanel searchResultPane; private Point pressedPoint; private UIScrollPane leftSearchResultPane; + private JPanel defaultPane; private JPanel rightSearchResultPane; private AlphaFineList searchResultList; private SearchListModel searchListModel; @@ -299,15 +298,10 @@ public class AlphaFineDialog extends UIDialog { leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane = new JPanel(); rightSearchResultPane.setBackground(Color.WHITE); - UILabel splitLine = new UILabel(); - splitLine.setBackground(AlphaFineConstants.GRAY); - splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); - searchResultPane.add(splitLine, BorderLayout.CENTER); searchResultPane.add(rightSearchResultPane, BorderLayout.EAST); UILabel splitLabel = new UILabel(); - splitLabel.setBackground(AlphaFineConstants.GRAY); splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1)); searchResultPane.add(splitLabel, BorderLayout.NORTH); add(searchResultPane, BorderLayout.SOUTH); @@ -344,6 +338,32 @@ public class AlphaFineDialog extends UIDialog { */ private void fireStopLoading() { searchListModel.resetState(); + replaceLeftPane(); + } + + /** + * 刷新容器 + */ + private void refreshContainer() { + validate(); + repaint(); + revalidate(); + } + + /** + * 重置结果面板 + */ + private void replaceLeftPane() { + if (searchListModel.getSize() == 0 && defaultPane == null) { + defaultPane = new NoResultPane(Inter.getLocText("FR-Designer-AlphaFine_NO_Result"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/no_result.png")); + searchResultPane.remove(leftSearchResultPane); + searchResultPane.add(defaultPane, BorderLayout.WEST); + } else if (searchListModel.getSize() > 0 && defaultPane != null) { + searchResultPane.remove(defaultPane); + defaultPane = null; + searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); + } + refreshContainer(); } /** @@ -534,7 +554,7 @@ public class AlphaFineDialog extends UIDialog { break; case ACTION: rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new ActionPreviewPane()); + rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png"))); validate(); repaint(); break; @@ -625,7 +645,6 @@ public class AlphaFineDialog extends UIDialog { */ private void initGlobalListener() { initAWTEventListener(); - initMouseListener(); } /** @@ -912,6 +931,8 @@ public class AlphaFineDialog extends UIDialog { if (getSelectedIndex() == 1) { searchTextField.requestFocus(); } + } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + searchTextField.requestFocus(); } } }); diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/no_result.png b/designer/src/com/fr/design/mainframe/alphafine/images/no_result.png new file mode 100644 index 0000000000..cd3d803af0 Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/no_result.png differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java deleted file mode 100644 index c7286850f8..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.mainframe.alphafine.preview; - - -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.general.IOUtils; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; - - -/** - * Created by XiaXiang on 2017/5/5. - */ -public class ActionPreviewPane extends JPanel { - private static final Font NAME = new Font("Song_TypeFace", 0, 14); - - public ActionPreviewPane() { - setLayout(new BorderLayout()); - setBackground(null); - setBorder(BorderFactory.createEmptyBorder(135, 0, 0, 0)); - UILabel image = new UILabel(); - image.setPreferredSize(new Dimension(150, 111)); - image.setHorizontalAlignment(SwingConstants.CENTER); - image.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - image.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png")); - UILabel description = new UILabel(Inter.getLocText("FR-Designer_NoResult")); - description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(NAME); - description.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - description.setHorizontalAlignment(SwingConstants.CENTER); - this.add(image, BorderLayout.CENTER); - this.add(description, BorderLayout.SOUTH); - } - -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java new file mode 100644 index 0000000000..67157aee2f --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -0,0 +1,31 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.general.FRFont; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by XiaXiang on 2017/8/14. + */ +public class NoResultPane extends JPanel { + public NoResultPane(String title, Icon icon) { + setLayout(new BorderLayout()); + setBackground(Color.white); + setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + UILabel image = new UILabel(); + image.setPreferredSize(new Dimension(150, 111)); + image.setHorizontalAlignment(SwingConstants.CENTER); + image.setIcon(icon); + image.setBorder(BorderFactory.createEmptyBorder(100,0,0,0)); + UILabel description = new UILabel(title); + description.setForeground(AlphaFineConstants.MEDIUM_GRAY); + description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14)); + description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); + description.setHorizontalAlignment(SwingConstants.CENTER); + add(image, BorderLayout.CENTER); + add(description, BorderLayout.SOUTH); + } +} diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 3756b03aec..14135a2b23 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -74,15 +74,13 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { if (!AlphaFineHelper.getFilterResult().contains(object)) { result.add(object); } - } - if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { + if (result.size() == 0) { + return lessModelList; + } + if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"))); - if (result.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(result); - } + lessModelList.addAll(result); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION)); lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -97,4 +95,4 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { public SearchResult getMoreSearchResult() { return moreModelList; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java index ebabc9aa23..7067dd17c9 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java @@ -76,13 +76,12 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { searchResult.add(cellModel); } } - if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { + if (searchResult.size() == 0) { + return lessModelList; + } + if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"))); - if (searchResult.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(searchResult); - } + lessModelList.addAll(searchResult); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.DOCUMENT)); lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -114,4 +113,4 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { return moreModelList; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java index 21f2b5fc40..d67d434bda 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java @@ -100,13 +100,12 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } - if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { + if (result.size() == 0) { + return lessModelList; + } + if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"))); - if (result.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(result); - } + lessModelList.addAll(result); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE)); lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -248,4 +247,4 @@ public class FileSearchManager implements AlphaFineSearchProcessor { public void setContainFrm(boolean containFrm) { isContainFrm = containFrm; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java index 5855168d7b..04c5074ef3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java @@ -109,13 +109,12 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { searchResult.add(cellModel); } } - if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"))); - if (searchResult.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(searchResult); - } + if (searchResult.size() == 0) { + return this.lessModelList; + } + if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"))); + lessModelList.addAll(searchResult); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN)); lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -142,4 +141,4 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { public SearchResult getMoreSearchResult() { return this.moreModelList; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java index f091cbe8aa..a79f64af4e 100644 --- a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.form; import com.fr.base.DynamicUnitList; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -40,7 +41,6 @@ public class FormReportComponentComposite extends JComponent implements TargetMo private FormTabPane sheetNameTab; private JPanel hbarContainer; private JSliderPane jSliderContainer; - private boolean isCtrl = false; public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { this.jForm = jform; @@ -52,33 +52,13 @@ public class FormReportComponentComposite extends JComponent implements TargetMo jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); - this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener); elementCaseDesigner.addTargetModifiedListener(this); } - KeyListener showValSpinnerKeyListener = new KeyListener() { - @Override - public void keyTyped(KeyEvent e) { - - } - - @Override - public void keyPressed(KeyEvent e) { - if (e.isControlDown()) { - isCtrl = true; - } - } - - @Override - public void keyReleased(KeyEvent e) { - isCtrl = false; - } - }; - MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isCtrl) { + if (InputEventBaseOnOS.isControlDown(e)) { int dir = e.getWheelRotation(); int old_resolution = (int) jSliderContainer.getShowVal().getValue(); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); diff --git a/designer/src/com/fr/grid/GridColumn.java b/designer/src/com/fr/grid/GridColumn.java index 165a5727a9..b6644df91d 100644 --- a/designer/src/com/fr/grid/GridColumn.java +++ b/designer/src/com/fr/grid/GridColumn.java @@ -68,11 +68,11 @@ public class GridColumn extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!reportPane.isColumnHeaderVisible()) { return new Dimension(0, 0); } - return new Dimension(super.getPreferredSize().width, GraphHelper.getFontMetrics(this.getFont()).getHeight() + SIZE_ADJUST); + return new Dimension(super.getPreferredSize().width, (int) (GraphHelper.getFontMetrics(this.getFont()).getHeight() * time + SIZE_ADJUST)); } } \ No newline at end of file diff --git a/designer/src/com/fr/grid/GridColumnUI.java b/designer/src/com/fr/grid/GridColumnUI.java index 227de31941..9712821682 100644 --- a/designer/src/com/fr/grid/GridColumnUI.java +++ b/designer/src/com/fr/grid/GridColumnUI.java @@ -48,6 +48,9 @@ public class GridColumnUI extends ComponentUI { Grid gird = reportPane.getGrid(); // size Dimension size = gridColumn.getSize(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + g2d.setFont(gridColumn.getFont().deriveFont(gridColumn.getFont().getSize2D() * time)); + ElementCase elementCase = reportPane.getEditingElementCase(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCase); int horizontalValue = gird.getHorizontalValue(); @@ -77,7 +80,7 @@ public class GridColumnUI extends ComponentUI { g2d.setPaint(gridColumn.getSeparatorLineColor()); GraphHelper.drawLine(g2d, 0, 0, 0, size.getHeight()); double tmpWidth2 = 0; - drawColumn(horizontalBeginValue, horizontalEndValue, columnWidthList, tmpWidth2, reportPane, g2d, gridColumn); + drawColumn(horizontalBeginValue, horizontalEndValue, columnWidthList, tmpWidth2, reportPane, g2d, gridColumn, size); // 画上边的边框线. g2d.setColor(gridColumn.getSeparatorLineColor()); GraphHelper.drawLine(g2d, 0, 0, tmpWidth2, 0); @@ -85,14 +88,13 @@ public class GridColumnUI extends ComponentUI { private void drawColumn(int horizontalBeginValue, int horizontalEndValue, DynamicUnitList columnWidthList, double tmpWidth2, - ElementCasePane reportPane, Graphics2D g2d, GridColumn gridColumn) { + ElementCasePane reportPane, Graphics2D g2d, GridColumn gridColumn, Dimension size) { // draw column. boolean isSelectedBounds; double tmpWidth1 = 0; double tmpIncreaseWidth = 0; ElementCase elementCase = reportPane.getEditingElementCase(); - Dimension size = gridColumn.getSize(); // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); LineMetrics fm = gridColumn.getFont().getLineMetrics("", fontRenderContext); @@ -158,8 +160,9 @@ public class GridColumnUI extends ComponentUI { columnContent += "(FR)"; } } + float time = (float)resolution/ScreenResolution.getScreenResolution(); - double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth(); + double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth() * time; // if (stringWidth > tmpIncreaseWidth) { // paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent); // } else { @@ -203,8 +206,8 @@ public class GridColumnUI extends ComponentUI { g2d.setPaint(UIManager.getColor("controlShadow")); } } - - GraphHelper.drawString(g2d, columnContent, tmpWidth1 + (tmpIncreaseWidth - stringWidth) / 2, fmAscent + GridHeader.SIZE_ADJUST / 2 + 1); + GraphHelper.drawString(g2d, columnContent, tmpWidth1 + (tmpIncreaseWidth - stringWidth) / 2, + (gridColumn.getSize().height/2 + g2d.getFont().getSize2D()/2)); } diff --git a/designer/src/com/fr/grid/GridCorner.java b/designer/src/com/fr/grid/GridCorner.java index a3f79b9331..91891fd44d 100644 --- a/designer/src/com/fr/grid/GridCorner.java +++ b/designer/src/com/fr/grid/GridCorner.java @@ -12,6 +12,7 @@ import java.awt.geom.Rectangle2D; import javax.swing.event.MouseInputListener; import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; import com.fr.design.mainframe.ElementCasePane; /** @@ -37,7 +38,7 @@ public class GridCorner extends BaseGridComponent { Graphics2D g2d = (Graphics2D) g; ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); //size Dimension size = this.getSize(); Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); @@ -50,7 +51,7 @@ public class GridCorner extends BaseGridComponent { GraphHelper.fill(g2d, rect2D); } - paintArc(g2d, size); + paintArc(g2d, size, time); //画左边的边框线. g2d.setColor(reportPane.getGridColumn().getSeparatorLineColor()); @@ -85,15 +86,15 @@ public class GridCorner extends BaseGridComponent { } - private void paintArc(Graphics2D g2d, Dimension size) { + private void paintArc(Graphics2D g2d, Dimension size, float time) { g2d.setColor(Color.gray); - int width = size.width - 16; + int width = (int) (size.width - (16 * time)); int avgWidth = width / 3; - int height = size.height - 8; + int height = (int) (size.height - (8 * time)); int avgHeight = height / 3; for (int i = 0; i < 3; i ++) { for (int j = 0; j < 3; j ++) { - GraphHelper.fillArc(g2d, 8 + i * avgWidth, 4 + j * avgHeight, 3, 3, 0, 360); + GraphHelper.fillArc(g2d, (8 * time) + (i * avgWidth), (4 * time) + (j * avgHeight), 3, 3, 0, 360); } } } diff --git a/designer/src/com/fr/grid/GridMouseAdapter.java b/designer/src/com/fr/grid/GridMouseAdapter.java index 147155e43d..fc88714adc 100644 --- a/designer/src/com/fr/grid/GridMouseAdapter.java +++ b/designer/src/com/fr/grid/GridMouseAdapter.java @@ -807,9 +807,11 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous * @param e */ public void mouseWheelMoved(MouseWheelEvent e) { - ElementCasePane reportPane = grid.getElementCasePane(); - if (reportPane.isHorizontalScrollBarVisible()) { - reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); + if (!InputEventBaseOnOS.isControlDown(e)) { + ElementCasePane reportPane = grid.getElementCasePane(); + if (reportPane.isHorizontalScrollBarVisible()) { + reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); + } } } diff --git a/designer/src/com/fr/grid/GridRow.java b/designer/src/com/fr/grid/GridRow.java index c80d08a4ec..70679b91bc 100644 --- a/designer/src/com/fr/grid/GridRow.java +++ b/designer/src/com/fr/grid/GridRow.java @@ -65,13 +65,13 @@ public class GridRow extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!(reportPane.isRowHeaderVisible())) { return new Dimension(0, 0); } int maxCharNumber = this.caculateMaxCharNumber(reportPane); - return new Dimension(maxCharNumber * GraphHelper.getFontMetrics(this.getFont()).charWidth('M'), super.getPreferredSize().height); + return new Dimension((int) (maxCharNumber * GraphHelper.getFontMetrics(this.getFont()).charWidth('M') * time), super.getPreferredSize().height); } /** diff --git a/designer/src/com/fr/grid/GridRowUI.java b/designer/src/com/fr/grid/GridRowUI.java index 4c0694a21a..016cfe6378 100644 --- a/designer/src/com/fr/grid/GridRowUI.java +++ b/designer/src/com/fr/grid/GridRowUI.java @@ -46,6 +46,9 @@ public class GridRowUI extends ComponentUI { ElementCasePane reportPane = gridRow.getElementCasePane(); // size Dimension size = gridRow.getSize(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + g2d.setFont(gridRow.getFont().deriveFont(gridRow.getFont().getSize2D() * time)); + ElementCase elementCase = reportPane.getEditingElementCase(); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCase); int verticalValue = reportPane.getGrid().getVerticalValue(); @@ -152,10 +155,10 @@ public class GridRowUI extends ComponentUI { , ElementCase elementCase, Dimension size, double tmpHeight1) { // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); - - float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent(); - double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth(); - double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent() * time; + double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth() * time; + double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight() * time; if (isSelectedBounds) { g2d.setColor(gridRow.getSelectedForeground()); } else { diff --git a/designer/src/com/fr/poly/PolyDesigner.java b/designer/src/com/fr/poly/PolyDesigner.java index aa416fc86f..0c700a7bf5 100644 --- a/designer/src/com/fr/poly/PolyDesigner.java +++ b/designer/src/com/fr/poly/PolyDesigner.java @@ -7,6 +7,7 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.edit.CopyAction; @@ -51,10 +52,7 @@ import com.fr.stable.unit.UnitRectangle; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; +import java.awt.event.*; import java.util.ArrayList; import java.util.List; @@ -98,7 +96,6 @@ public class PolyDesigner extends ReportComponent(visibleModes); initModes(visibleModes, enableModes); } @@ -576,11 +563,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } -// private void refreshContainer() { -// propertyPanel.validate(); -// propertyPanel.repaint(); -// propertyPanel.revalidate(); -// } private String getBtnIconUrl() { return ICON_BASE_DIR + btnIconName + iconSuffix; } @@ -594,6 +576,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + public void setTabButtonSelected() { + resetPropertyIcons(); + iconSuffix = ICON_SUFFIX_SELECTED; + button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); + button.setBackground(selectedBtnBackground); + button.setOpaque(true); + } + private void initButton() { button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { public Dimension getPreferredSize() { @@ -614,11 +604,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } else { popupFixedPane(); } - resetPropertyIcons(); - iconSuffix = ICON_SUFFIX_SELECTED; - button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); - button.setBackground(selectedBtnBackground); - button.setOpaque(true); + setTabButtonSelected(); } }); } @@ -655,7 +641,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 弹出对话框 public void popupDialog() { -// setIsPoppedOut(true); if (isPoppedOut) { return; } @@ -667,15 +652,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { popupDialog.adjustLocation(); popupDialog.setVisible(true); } -// initContentPane(); -// refreshContainer(); removeItem(this); } public void popToFrame() { if (isPoppedOut) { isPoppedOut = false; -// popupDialog.dispose(); popupDialog.setVisible(false); initContentPane(); onResize(); @@ -892,7 +874,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { container.add(popupToolPane, BorderLayout.NORTH); container.add(contentPane, BorderLayout.CENTER); setSize(CONTENT_WIDTH, POPUP_DEFAULT_HEIGHT); -// validate(); adjustLocation(); initListener(); diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 5d0cefed2e..17d9d6e364 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -379,10 +379,9 @@ public abstract class ToolBarMenuDock { // shortCuts.add(new ForumAction()); } shortCuts.add(SeparatorDef.DEFAULT); - shortCuts.add(new AboutAction()); - shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new AlphaFineAction()); - + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new AboutAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java b/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java index d28d6a3bd1..4b25c3436f 100644 --- a/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java +++ b/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java @@ -137,6 +137,8 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName())); if (this.database == null) { + this.keyColumnPane.updateUpButton(); + this.valueDictPane.updateUpButton(); return; } @@ -187,6 +189,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i } dbDict.setKeyColumnIndex(keyColumnIndex); dbDict.setKeyColumnName(keyColumnName); + }else { + this.keyColumnPane.updateUpButton(); + this.valueDictPane.updateUpButton(); } Object value = this.valueDictPane.update(); if (value instanceof Integer) { diff --git a/designer_base/src/com/fr/design/style/AbstractSelectBox.java b/designer_base/src/com/fr/design/style/AbstractSelectBox.java index 58d1ec13d6..f354c164f8 100644 --- a/designer_base/src/com/fr/design/style/AbstractSelectBox.java +++ b/designer_base/src/com/fr/design/style/AbstractSelectBox.java @@ -38,12 +38,10 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent.setEmptyBackground(); displayComponent.setBorder(new TriggleLineBorder()); triggleButton = new UIToggleButton(UIConstants.ARROW_DOWN_ICON); - triggleButton.setRoundBorder(true, Constants.LEFT); - triggleButton.setPreferredSize(new Dimension(21, 20)); + triggleButton.setPreferredSize(new Dimension(20, 20)); JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); displayPane.add(displayComponent, BorderLayout.CENTER); - displayComponent.setPreferredSize(new Dimension(preWidth, displayPane.getPreferredSize().height)); displayComponent.addMouseListener(mouseListener); @@ -59,7 +57,6 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou } public void ancestorRemoved(AncestorEvent evt) { - hidePopupMenu(); } public void ancestorMoved(AncestorEvent event) { @@ -74,8 +71,6 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent.setEnabled(enabled); triggleButton.setEnabled(enabled); } - - @Override public JPanel initWindowPane(double preWidth) { @@ -88,8 +83,8 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(UIConstants.LINE_COLOR); - g2d.drawRoundRect(0, 0, this.getWidth() , this.getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + g2d.setColor(UIConstants.POP_DIALOG_BORDER); + g2d.drawRoundRect(0, 0, this.getWidth() - 1 , this.getHeight() - 1, 4, 4); triggleButton.setSelected(isPopupVisible()); } @@ -105,15 +100,12 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou private class TriggleLineBorder extends AbstractBorder { private static final long serialVersionUID = 1065857667981063530L; - protected Insets borderInsets = new Insets(0, 0, 0, 1); + protected Insets borderInsets = new Insets(0, 0, 0, 0); public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { g.translate(x, y); - g.setColor(UIConstants.LINE_COLOR); - g.drawLine(3, 0, w-2, 0); - g.drawLine(3, h - 1, w-2, h - 1); - g.drawLine(w - 1, 0, w - 1, h); + g.setColor(UIConstants.POP_DIALOG_BORDER); g.translate(-x, -y); } diff --git a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java index 434f60d9c7..b6f52e1998 100644 --- a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java +++ b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java @@ -19,7 +19,7 @@ public class GUIPaintUtils { if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR); } else { - g2d.setColor(UIConstants.TITLED_BORDER_COLOR); + g2d.setColor(UIConstants.POP_DIALOG_BORDER); } if (isRound) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index 12188f2da0..e35657c23b 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/designer_form/src/com/fr/design/mainframe/FormArea.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; @@ -50,7 +51,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private double START_VALUE = DEFAULT_SLIDER; private int resolution = ScreenResolution.getScreenResolution(); private double screenValue; - private boolean isCtrl = false; public FormScrollBar getHorScrollBar() { return horScrollBar; @@ -86,35 +86,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent { } this.setFocusTraversalKeysEnabled(false); this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); - this.designer.addKeyListener(showValSpinnerKeyListener); this.setOpaque(true); this.setBackground(Color.WHITE); } - - KeyListener showValSpinnerKeyListener = new KeyListener() { - @Override - public void keyTyped(KeyEvent e) { - - } - - @Override - public void keyPressed(KeyEvent e) { - if (e.isControlDown()) { - isCtrl = true; - } - } - - @Override - public void keyReleased(KeyEvent e) { - isCtrl = false; - } - }; - MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isCtrl) { + if (InputEventBaseOnOS.isControlDown(e)) { int dir = e.getWheelRotation(); int old_resolution = (int) slidePane.getShowVal().getValue(); slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN));