|
|
@ -1,11 +1,14 @@ |
|
|
|
package com.fr.design.gui.controlpane; |
|
|
|
package com.fr.design.gui.controlpane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.light.ui.FineButtonBorder; |
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIStyle; |
|
|
|
|
|
|
|
import com.formdev.flatlaf.ui.FlatUIUtils; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; |
|
|
|
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; |
|
|
|
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; |
|
|
|
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.itoolbar.UIToolBarUI; |
|
|
|
|
|
|
|
import com.fr.design.gui.itoolbar.UIToolbar; |
|
|
|
import com.fr.design.gui.itoolbar.UIToolbar; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
@ -46,15 +49,15 @@ import java.awt.event.MouseMotionListener; |
|
|
|
import java.awt.event.WindowAdapter; |
|
|
|
import java.awt.event.WindowAdapter; |
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created by plough on 2017/7/21. |
|
|
|
* Created by plough on 2017/7/21. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class UIControlPane extends JControlPane { |
|
|
|
public abstract class UIControlPane extends JControlPane { |
|
|
|
private UIToolbar topToolBar; |
|
|
|
private UIToolbar topToolBar; |
|
|
|
protected Window popupEditDialog; |
|
|
|
protected Window popupEditDialog; |
|
|
|
private static final int TOP_TOOLBAR_HEIGHT = 20; |
|
|
|
|
|
|
|
private static final int TOP_TOOLBAR_WIDTH = 156; // 可能因为用了tablelayout,要比其他地方多一个像素,看起来才正常
|
|
|
|
|
|
|
|
private static final int TOP_TOOLBAR_WIDTH_SHORT = 76; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIControlPane() { |
|
|
|
UIControlPane() { |
|
|
|
super(); |
|
|
|
super(); |
|
|
@ -135,40 +138,26 @@ public abstract class UIControlPane extends JControlPane { |
|
|
|
leftContentPane.add(toolBarPane, BorderLayout.NORTH); |
|
|
|
leftContentPane.add(toolBarPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
// 顶部标签及add按钮
|
|
|
|
// 顶部标签及add按钮
|
|
|
|
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() { |
|
|
|
topToolBar = new UIToolbar(); |
|
|
|
@Override |
|
|
|
|
|
|
|
public void paint(Graphics g, JComponent c) { |
|
|
|
|
|
|
|
Graphics2D g2 = (Graphics2D) g; |
|
|
|
|
|
|
|
g2.setColor(UIConstants.SELECT_TAB); |
|
|
|
|
|
|
|
g2.fillRect(0, 0, c.getWidth(), c.getHeight()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
topToolBar.setBorder(null); |
|
|
|
|
|
|
|
topToolBar.setLayout(new BorderLayout()); |
|
|
|
topToolBar.setLayout(new BorderLayout()); |
|
|
|
ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); |
|
|
|
ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); |
|
|
|
addItem.intoJToolBar(topToolBar); |
|
|
|
addItem.intoJToolBar(topToolBar); |
|
|
|
JPanel leftTopPane = getLeftTopPane(topToolBar); |
|
|
|
JPanel leftTopPane = getLeftTopPane(topToolBar); |
|
|
|
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); |
|
|
|
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); |
|
|
|
leftPane.add(leftTopPane, BorderLayout.NORTH); |
|
|
|
leftPane.add(leftTopPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
return leftPane; |
|
|
|
return leftPane; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected JPanel getLeftTopPane(UIToolbar topToolBar) { |
|
|
|
protected JPanel getLeftTopPane(UIToolbar topToolBar) { |
|
|
|
UILabel addItemLabel = FRWidgetFactory.createLineWrapLabel(getAddItemText()); |
|
|
|
return row(10, |
|
|
|
|
|
|
|
cell(FRWidgetFactory.createLineWrapLabel(getAddItemText())), |
|
|
|
topToolBar.setPreferredSize( |
|
|
|
cell(topToolBar).with(it -> { |
|
|
|
new Dimension( |
|
|
|
it.setBorderPainted(true); |
|
|
|
isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT, |
|
|
|
it.setBorder(new FineButtonBorder()); |
|
|
|
TOP_TOOLBAR_HEIGHT |
|
|
|
it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); |
|
|
|
)); |
|
|
|
}).weight(1.0) |
|
|
|
JPanel toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
).getComponent(); |
|
|
|
toolBarPane.add(topToolBar, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
leftTopPane.add(toolBarPane, BorderLayout.EAST); |
|
|
|
|
|
|
|
leftTopPane.add(addItemLabel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
return leftTopPane; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -179,7 +168,6 @@ public abstract class UIControlPane extends JControlPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected ShortCut4JControlPane[] createShortcuts() { |
|
|
|
protected ShortCut4JControlPane[] createShortcuts() { |
|
|
|
// return AbstractShortCutFactory.getInstance(this).createNewShortCuts();
|
|
|
|
|
|
|
|
return shortCutFactory.createShortCuts(); |
|
|
|
return shortCutFactory.createShortCuts(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -219,8 +207,7 @@ public abstract class UIControlPane extends JControlPane { |
|
|
|
editPaneWrapper.add(editPane, BorderLayout.CENTER); |
|
|
|
editPaneWrapper.add(editPane, BorderLayout.CENTER); |
|
|
|
editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); |
|
|
|
editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); |
|
|
|
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); |
|
|
|
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); |
|
|
|
setSize(WIDTH, HEIGHT); |
|
|
|
setSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT))); |
|
|
|
// pack();
|
|
|
|
|
|
|
|
this.setVisible(false); |
|
|
|
this.setVisible(false); |
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
} |
|
|
|
} |
|
|
@ -386,6 +373,7 @@ public abstract class UIControlPane extends JControlPane { |
|
|
|
contentPane.setBackground(originColor); |
|
|
|
contentPane.setBackground(originColor); |
|
|
|
contentPane.setLayout(new BorderLayout()); |
|
|
|
contentPane.setLayout(new BorderLayout()); |
|
|
|
titleLabel = new UILabel(title); |
|
|
|
titleLabel = new UILabel(title); |
|
|
|
|
|
|
|
FineUIStyle.setStyle(titleLabel, FineUIStyle.LABEL_BOLD); |
|
|
|
contentPane.add(titleLabel, BorderLayout.WEST); |
|
|
|
contentPane.add(titleLabel, BorderLayout.WEST); |
|
|
|
contentPane.setBorder(new EmptyBorder(5, 14, 6, 0)); |
|
|
|
contentPane.setBorder(new EmptyBorder(5, 14, 6, 0)); |
|
|
|
|
|
|
|
|
|
|
|