* commit '6cd4789af4b2945dd27b504df76ffc345848d2b3': (156 commits) REPORT-6662 替换tab和tabpane控件树图标 无JIRA任务,代码规范 无JIRA任务,代码规范 无JIRA任务,使用策略模式重构代码 REPORT-6662 交互验收后问题 REPORT-6558 组件叠加优化交互验收=>顶部工具栏中的按钮状态,与右侧控件树的按钮状态一致;form,body,不可编辑 REPORT-6645 参数面板里的bug2=>参数一个一个加会导致参数面板和body结构出问题 REPORT-6645 参数面板里的bug2=>参数面板内的控件不允许调整顺序;修复一个bug REPORT-6645 参数面板里的bug2=>tab切换后显示不出参数;选中参数面板里的控件时,未生成参数显示不出来 无 REPORT-6644 新功能交互验收问题 REPORT-6645 参数面板里的bug2=>如果有未生成的参数,在模板参数删除这参数的时候,上面会有一段空白的 REPORT-6645 参数面板里的bug2 REPORT-6443 控件树消失问题=>减少对其他地方的影响 REPORT-6558 组件叠加优化交互验收 REPORT-6626 绝对布局下组件复制粘贴后属性设置有问题 REPORT-6575 REPORT-6575 REPORT-6270 & REPORT-6443 参数面板里的相关bug(问题2、3);控件树消失问题 REPORT-6575 ...
@ -0,0 +1,13 @@
|
||||
package com.fr.design.event; |
||||
|
||||
import java.util.EventListener; |
||||
|
||||
/** |
||||
* Created by plough on 2018/1/19. |
||||
*/ |
||||
public interface DesignerOpenedListener extends EventListener { |
||||
/** |
||||
* Invoked when the target of the listener has changed the rpt content. |
||||
*/ |
||||
public void designerOpened(); |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Aftermath; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
/** |
||||
* 左上角目录树上边工具条的插件接口 |
||||
* Created by hzzz on 2017/11/30. |
||||
*/ |
||||
public interface TemplateTreeShortCutProvider extends Mutable, Aftermath { |
||||
String XML_TAG = "TemplateTreeShortCut"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.fun.TemplateTreeShortCutProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* 左上角目录树上边工具条的插件接口 |
||||
* Created by hzzz on 2017/11/30. |
||||
*/ |
||||
@API(level = TemplateTreeShortCutProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractTemplateTreeShortCutProvider extends UpdateAction implements TemplateTreeShortCutProvider { |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
|
||||
@Override |
||||
public void process() { |
||||
} |
||||
|
||||
@Override |
||||
public void undo() { |
||||
} |
||||
} |
@ -0,0 +1,280 @@
|
||||
package com.fr.design.gui.imenu; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.utils.gui.GUIPaintUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import java.awt.*; |
||||
|
||||
public class UIHeadMenu extends UIMenu { |
||||
private static final float REC = 8f; |
||||
private JPopupMenu popupMenu; |
||||
|
||||
public UIHeadMenu(String name) { |
||||
super(name); |
||||
} |
||||
|
||||
public JPopupMenu getPopupMenu() { |
||||
ensurePopupMenuCreated(); |
||||
popupMenu.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||
popupMenu.setBorder(new Border() { |
||||
|
||||
@Override |
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { |
||||
Graphics2D g2d = (Graphics2D) g; |
||||
int rec = (int) REC; |
||||
GUIPaintUtils.paintShapeBorder(g2d, x, y, width, height, rec); |
||||
if (!(UIHeadMenu.this.getParent() instanceof JPopupMenu)) { |
||||
g.setColor(UIConstants.NORMAL_BACKGROUND); |
||||
g.drawLine(1, 0, UIHeadMenu.this.getWidth() - 2, 0); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean isBorderOpaque() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public Insets getBorderInsets(Component c) { |
||||
return new Insets(5, 2, 10, 10); |
||||
} |
||||
}); |
||||
return popupMenu; |
||||
} |
||||
|
||||
protected void ensurePopupMenuCreated() { |
||||
if (popupMenu == null) { |
||||
this.popupMenu = new JPopupMenu() { |
||||
@Override |
||||
protected void paintComponent(Graphics g) { |
||||
Graphics2D g2d = (Graphics2D) g; |
||||
float wdith = getWidth(); |
||||
float heigth = getHeight(); |
||||
|
||||
Shape shape = GUIPaintUtils.paintShape(g2d, wdith, heigth, REC); |
||||
g2d.setClip(shape); |
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
||||
super.paintComponent(g2d); |
||||
} |
||||
}; |
||||
popupMenu.setInvoker(this); |
||||
popupListener = createWinListener(popupMenu); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
*画界面 |
||||
*/ |
||||
@Override |
||||
public void updateUI() { |
||||
setUI(new UIMenuUI()); |
||||
} |
||||
|
||||
/** |
||||
* 判断popupmeu是否隐藏 |
||||
* @return 如果隐藏 返回true |
||||
*/ |
||||
public boolean isPopupMenuVisible() { |
||||
ensurePopupMenuCreated(); |
||||
return popupMenu.isVisible(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置popupmenu位置 |
||||
* @param x |
||||
* @param y |
||||
*/ |
||||
public void setMenuLocation(int x, int y) { |
||||
super.setMenuLocation(x, y); |
||||
if (popupMenu != null) { |
||||
popupMenu.setLocation(x, y); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 向popupmenu添加 JMenuItem |
||||
* @param menuItem 菜单项 |
||||
* @return 菜单项 |
||||
*/ |
||||
public JMenuItem add(JMenuItem menuItem) { |
||||
ensurePopupMenuCreated(); |
||||
return popupMenu.add(menuItem); |
||||
} |
||||
|
||||
/** |
||||
* 添加组件 |
||||
* @param c 组件 |
||||
* @return 组件 |
||||
*/ |
||||
public Component add(Component c) { |
||||
ensurePopupMenuCreated(); |
||||
popupMenu.add(c); |
||||
return c; |
||||
} |
||||
|
||||
/** |
||||
* 向指定位置添加组件 |
||||
* @param c 组件 |
||||
* @param index 位置 |
||||
* @return 组件 |
||||
*/ |
||||
public Component add(Component c, int index) { |
||||
ensurePopupMenuCreated(); |
||||
popupMenu.add(c, index); |
||||
return c; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加分隔符 |
||||
*/ |
||||
public void addSeparator() { |
||||
ensurePopupMenuCreated(); |
||||
popupMenu.addSeparator(); |
||||
} |
||||
|
||||
/** |
||||
* 添加menuitem到指定位置 |
||||
* @param s 字符 |
||||
* @param pos 位置 |
||||
*/ |
||||
public void insert(String s, int pos) { |
||||
if (pos < 0) { |
||||
throw new IllegalArgumentException("index less than zero."); |
||||
} |
||||
|
||||
ensurePopupMenuCreated(); |
||||
popupMenu.insert(new JMenuItem(s), pos); |
||||
} |
||||
|
||||
/** |
||||
* 添加么会特么到指定位置 |
||||
* @param mi 菜单项 |
||||
* @param pos 位置 |
||||
* @return 菜单项 |
||||
*/ |
||||
public JMenuItem insert(JMenuItem mi, int pos) { |
||||
if (pos < 0) { |
||||
throw new IllegalArgumentException("index less than zero."); |
||||
} |
||||
ensurePopupMenuCreated(); |
||||
popupMenu.insert(mi, pos); |
||||
return mi; |
||||
} |
||||
|
||||
/** |
||||
* 添加到指定位置 |
||||
* @param a 事件 |
||||
* @param pos 位置 |
||||
* @return 菜单项 |
||||
*/ |
||||
public JMenuItem insert(Action a, int pos) { |
||||
if (pos < 0) { |
||||
throw new IllegalArgumentException("index less than zero."); |
||||
} |
||||
|
||||
ensurePopupMenuCreated(); |
||||
JMenuItem mi = new JMenuItem(a); |
||||
mi.setHorizontalTextPosition(JButton.TRAILING); |
||||
mi.setVerticalTextPosition(JButton.CENTER); |
||||
popupMenu.insert(mi, pos); |
||||
return mi; |
||||
} |
||||
|
||||
/** |
||||
* 添加分隔符到指定位置 |
||||
* @param index 指定位置 |
||||
*/ |
||||
public void insertSeparator(int index) { |
||||
if (index < 0) { |
||||
throw new IllegalArgumentException("index less than zero."); |
||||
} |
||||
|
||||
ensurePopupMenuCreated(); |
||||
popupMenu.insert(new JPopupMenu.Separator(), index); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 移除 |
||||
* @param item 菜单项 |
||||
*/ |
||||
public void remove(JMenuItem item) { |
||||
if (popupMenu != null) { |
||||
popupMenu.remove(item); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 移除指定位置菜单项 |
||||
* @param pos 指定位置 |
||||
*/ |
||||
public void remove(int pos) { |
||||
if (pos < 0) { |
||||
throw new IllegalArgumentException("index less than zero."); |
||||
} |
||||
if (pos > getItemCount()) { |
||||
throw new IllegalArgumentException("index greater than the number of items."); |
||||
} |
||||
if (popupMenu != null) { |
||||
popupMenu.remove(pos); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 移除组件 |
||||
* @param c 组件 |
||||
*/ |
||||
public void remove(Component c) { |
||||
if (popupMenu != null) { |
||||
popupMenu.remove(c); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 移除所有 |
||||
*/ |
||||
public void removeAll() { |
||||
if (popupMenu != null) { |
||||
popupMenu.removeAll(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 组件总数 |
||||
* @return 组件总数 |
||||
*/ |
||||
public int getMenuComponentCount() { |
||||
return (popupMenu == null) ? 0 : popupMenu.getComponentCount(); |
||||
} |
||||
|
||||
/** |
||||
* 指定位置组件 |
||||
* @param n 指定位置 |
||||
* @return 组件 |
||||
*/ |
||||
public Component getMenuComponent(int n) { |
||||
return (popupMenu == null) ? null : popupMenu.getComponent(n); |
||||
} |
||||
|
||||
/** |
||||
* 所有组件 |
||||
* @return 所有组件 |
||||
*/ |
||||
public Component[] getMenuComponents() { |
||||
return (popupMenu == null) ? new Component[0] : popupMenu.getComponents(); |
||||
} |
||||
|
||||
/** |
||||
* 得到子元素 |
||||
* @return 子元素 |
||||
*/ |
||||
public MenuElement[] getSubElements() { |
||||
return popupMenu == null ? new MenuElement[0] : new MenuElement[]{popupMenu}; |
||||
} |
||||
|
||||
|
||||
} |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 167 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 273 B |
@ -0,0 +1,271 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.file.HistoryTemplateListPane; |
||||
import com.fr.design.gui.frpane.HyperlinkGroupPane; |
||||
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; |
||||
import com.fr.design.gui.imenu.UIMenuItem; |
||||
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; |
||||
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.design.menu.ToolBarDef; |
||||
import com.fr.file.FILE; |
||||
import com.fr.file.FileNodeFILE; |
||||
import com.fr.stable.OperatingSystem; |
||||
import com.fr.stable.project.ProjectConstants; |
||||
|
||||
import javax.swing.*; |
||||
import java.io.File; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Author : MoMeak |
||||
* Date: 17-11-20 |
||||
* 极简模式模板----for减少堆内存引用 |
||||
* 其他参数都去掉,只保留触发重新激活的文件路径 |
||||
*/ |
||||
public class JVirtualTemplate extends JTemplate { |
||||
|
||||
private FILE editingFILE = null; |
||||
|
||||
public JVirtualTemplate(FILE editingFILE) { |
||||
setEditingFILE(editingFILE); |
||||
} |
||||
|
||||
public String getFullPathName() { |
||||
String editingFileName = getEditingFILE().getPath(); |
||||
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) { |
||||
editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName; |
||||
} |
||||
editingFileName = OperatingSystem.isWindows() ? editingFileName.replaceAll("/", "\\\\") : editingFileName.replaceAll("\\\\", "/"); |
||||
return editingFileName; |
||||
} |
||||
|
||||
/** |
||||
* 得到正在编辑的FILE |
||||
* |
||||
* @return |
||||
*/ |
||||
public FILE getEditingFILE() { |
||||
return this.editingFILE; |
||||
} |
||||
|
||||
/** |
||||
* 正在编辑的FILE |
||||
* |
||||
* @return |
||||
*/ |
||||
public void setEditingFILE(FILE editingFILE) { |
||||
this.editingFILE = editingFILE; |
||||
} |
||||
|
||||
@Override |
||||
public void refreshEastPropertiesPane() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public TargetComponent getCurrentElementCasePane() { |
||||
return null; |
||||
} |
||||
|
||||
public JComponent getCurrentReportComponentPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public TemplateProcessInfo getProcessInfo() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void setJTemplateResolution(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public int getJTemplateResolution() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
protected JComponent createCenterPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void removeTemplateSelection() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void refreshContainer() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void removeParameterPaneSelection() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setScale(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public int getScale() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int selfAdaptUpdate() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
protected DesignModelAdapter createDesignModel() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public UIMenuItem[] createMenuItem4Preview() { |
||||
return new UIMenuItem[0]; |
||||
} |
||||
|
||||
@Override |
||||
protected BaseUndoState<?> createUndoState() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String suffix() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void copy() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean paste() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean cut() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public AuthorityEditPane createAuthorityEditPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ToolBarMenuDockPlus getToolBarMenuDockPlus() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JPanel getEastUpPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JPanel getEastDownPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ToolBarDef[] toolbars4Target() { |
||||
return new ToolBarDef[0]; |
||||
} |
||||
|
||||
@Override |
||||
public JPanel[] toolbarPanes4Form() { |
||||
return new JPanel[0]; |
||||
} |
||||
|
||||
@Override |
||||
public ShortCut[] shortcut4TemplateMenu() { |
||||
return new ShortCut[0]; |
||||
} |
||||
|
||||
@Override |
||||
public ShortCut[] shortCuts4Authority() { |
||||
return new ShortCut[0]; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent[] toolBarButton4Form() { |
||||
return new JComponent[0]; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent toolBar4Authority() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int getToolBarHeight() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isJWorkBook() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void activeJTemplate(int index, JTemplate jt) { |
||||
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); |
||||
historyList.set(index, jt); |
||||
DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt); |
||||
} |
||||
|
||||
@Override |
||||
public void activeOldJTemplate() { |
||||
DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); |
||||
} |
||||
|
||||
@Override |
||||
public void activeNewJTemplate() { |
||||
DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); |
||||
} |
||||
|
||||
@Override |
||||
public void closeOverLineTemplate(int index) { |
||||
} |
||||
|
||||
@Override |
||||
public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { |
||||
return null; |
||||
} |
||||
|
||||
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void setAuthorityMode(boolean isUpMode) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Icon getIcon() { |
||||
if (getFullPathName().endsWith("cpt")) { |
||||
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png"); |
||||
} else { |
||||
return BaseUtils.readIcon("/com/fr/web/images/form/new_form3.png"); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void applyUndoState(BaseUndoState baseUndoState) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.stable.CodeUtils; |
||||
|
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Calendar; |
||||
|
||||
/** |
||||
* Created by hzzz on 2017/12/4. |
||||
*/ |
||||
public class SiteCenterToken { |
||||
|
||||
public static String generateToken() { |
||||
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); |
||||
return CodeUtils.md5Encode(date, "", "MD5"); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.mainframe.toolbar; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.file.NewTemplatePane; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by hzzz on 2017/12/26. |
||||
*/ |
||||
public class ToolBarNewTemplatePane extends NewTemplatePane { |
||||
|
||||
private static final ToolBarNewTemplatePane instance = new ToolBarNewTemplatePane(); |
||||
|
||||
private ToolBarNewTemplatePane() { |
||||
} |
||||
|
||||
public static NewTemplatePane getInstance() { |
||||
return instance; |
||||
} |
||||
|
||||
@Override |
||||
public Icon getNew() { |
||||
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); |
||||
} |
||||
|
||||
@Override |
||||
public Icon getMouseOverNew() { |
||||
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); |
||||
} |
||||
|
||||
@Override |
||||
public Icon getMousePressNew() { |
||||
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.design.mainframe.toolbar; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.edit.RedoAction; |
||||
import com.fr.design.actions.edit.UndoAction; |
||||
import com.fr.design.actions.file.ExitDesignerAction; |
||||
import com.fr.design.actions.file.PreferenceAction; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.MenuDef; |
||||
import com.fr.design.menu.SeparatorDef; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.ArrayUtils; |
||||
|
||||
/** |
||||
* Created by hzzz on 2017/12/28. |
||||
*/ |
||||
public class VcsScene { |
||||
|
||||
public static MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { |
||||
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_File"), 'F'); |
||||
|
||||
ShortCut[] scs = new ShortCut[0]; |
||||
if (!ArrayUtils.isEmpty(scs)) { |
||||
menuDef.addShortCut(scs); |
||||
} |
||||
|
||||
scs = plus.shortcut4FileMenu(); |
||||
if (!ArrayUtils.isEmpty(scs)) { |
||||
menuDef.addShortCut(SeparatorDef.DEFAULT); |
||||
menuDef.addShortCut(scs); |
||||
menuDef.addShortCut(SeparatorDef.DEFAULT); |
||||
} |
||||
|
||||
if (!BaseUtils.isAuthorityEditing()) { |
||||
menuDef.addShortCut(new PreferenceAction()); |
||||
} |
||||
|
||||
menuDef.addShortCut(new ExitDesignerAction()); |
||||
return menuDef; |
||||
} |
||||
|
||||
public static ShortCut[] shortcut4FileMenu(JTemplate jTemplate) { |
||||
return new ShortCut[]{new UndoAction(jTemplate), new RedoAction(jTemplate)}; |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper; |
||||
import com.fr.design.style.background.BackgroundTabPane; |
||||
import com.fr.general.Background; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
import java.awt.Dimension; |
||||
|
||||
/** |
||||
* @author kerry |
||||
* @date 2018/1/17 |
||||
*/ |
||||
public class AccessibleTabBackgroundEditor extends UneditableAccessibleEditor { |
||||
private BackgroundTabPane choosePane; |
||||
|
||||
public AccessibleTabBackgroundEditor() { |
||||
super(new BackgroundWrapper()); |
||||
} |
||||
|
||||
@Override |
||||
protected void showEditorPane() { |
||||
choosePane = new BackgroundTabPane(); |
||||
choosePane.setPreferredSize(new Dimension(600, 400)); |
||||
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
setValue(choosePane.update()); |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground()); |
||||
dlg.setVisible(true); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.cardtag.TemplateStyle; |
||||
import com.fr.design.mainframe.widget.wrappers.TemplateStyleWrapper; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
import java.awt.Dimension; |
||||
|
||||
/** |
||||
* Created by kerry on 2017/11/23. |
||||
*/ |
||||
public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor { |
||||
|
||||
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); |
||||
|
||||
private TemplateStylePane stylePane; |
||||
|
||||
public AccessibleTemplateStyleEditor() { |
||||
super(new TemplateStyleWrapper()); |
||||
} |
||||
|
||||
@Override |
||||
protected void showEditorPane() { |
||||
if (stylePane == null) { |
||||
stylePane = new TemplateStylePane(); |
||||
stylePane.setPreferredSize(DEFAULT_DIMENSION); |
||||
} |
||||
BasicDialog dlg = stylePane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
setValue(stylePane.update()); |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
stylePane.populate((TemplateStyle) getValue()); |
||||
dlg.setVisible(true); |
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import com.fr.general.cardtag.BannerTemplateStyle; |
||||
import com.fr.general.cardtag.BookMarkTemplateStyle; |
||||
import com.fr.general.cardtag.CardTemplateStyle; |
||||
import com.fr.general.cardtag.DefaultTemplateStyle; |
||||
import com.fr.general.cardtag.MenuTemplateStyle; |
||||
import com.fr.general.cardtag.PentagonTemplateStyle; |
||||
import com.fr.general.cardtag.TrapezoidTemplateStyle; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.cardtag.TemplateStyle; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.DefaultListCellRenderer; |
||||
import javax.swing.DefaultListModel; |
||||
import javax.swing.JList; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.ListCellRenderer; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* Created by kerry on 2017/11/23. |
||||
*/ |
||||
public class TemplateStylePane extends BasicPane { |
||||
private DefaultListModel listModel; |
||||
private JList styleList; |
||||
private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle()); |
||||
|
||||
public TemplateStylePane(){ |
||||
init(); |
||||
} |
||||
|
||||
public void init(){ |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
listModel = new DefaultListModel(); |
||||
listModel.addElement(new DefaultTemplateStyle()); |
||||
listModel.addElement(new CardTemplateStyle()); |
||||
listModel.addElement(new BannerTemplateStyle()); |
||||
listModel.addElement(new BookMarkTemplateStyle()); |
||||
listModel.addElement(new MenuTemplateStyle()); |
||||
listModel.addElement(new PentagonTemplateStyle()); |
||||
listModel.addElement(new TrapezoidTemplateStyle()); |
||||
styleList = new JList(listModel); |
||||
styleList.setCellRenderer(render); |
||||
|
||||
JPanel westPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
westPane.add(styleList, BorderLayout.CENTER); |
||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
westPane.setPreferredSize(new Dimension(100, 500)); |
||||
centerPane.setPreferredSize(new Dimension(300, 500)); |
||||
centerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Preview"), null)); |
||||
centerPane.add(previewPane); |
||||
styleList.addMouseListener(new MouseAdapter() { |
||||
public void mouseClicked(MouseEvent e) { |
||||
previewPane.repaint((TemplateStyle) styleList.getSelectedValue()); |
||||
} |
||||
}); |
||||
this.add(westPane, BorderLayout.WEST); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
} |
||||
public static ListCellRenderer render = new DefaultListCellRenderer() { |
||||
@Override |
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||
|
||||
if (value instanceof TemplateStyle) { |
||||
TemplateStyle l = (TemplateStyle) value; |
||||
this.setText(l.toString()); |
||||
} |
||||
return this; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Tab_Style_Template"); |
||||
} |
||||
|
||||
public void populate(TemplateStyle templateStyle) { |
||||
previewPane.repaint(templateStyle); |
||||
for(int i = 0; i< listModel.getSize(); i++){ |
||||
if((listModel.getElementAt(i).toString()).equals(templateStyle.toString())){ |
||||
styleList.setSelectedIndex(i); |
||||
return; |
||||
} |
||||
} |
||||
styleList.setSelectedIndex(0); |
||||
} |
||||
|
||||
public TemplateStyle update() { |
||||
return (TemplateStyle) styleList.getSelectedValue(); |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.design.mainframe.widget.accessibles; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.cardtag.TemplateStyle; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.Image; |
||||
|
||||
/** |
||||
* Created by kerry on 2017/12/11. |
||||
*/ |
||||
public class TemplateStylePreviewPane extends JPanel { |
||||
|
||||
private static final int WIDTH = 540; |
||||
private static final int HEIGHT = 400; |
||||
private static final int OFFSETY = 50; |
||||
|
||||
private TemplateStyle templateStyle; |
||||
|
||||
public TemplateStylePreviewPane(TemplateStyle templateStyle){ |
||||
this.templateStyle = templateStyle; |
||||
} |
||||
|
||||
public void repaint (TemplateStyle templateStyle){ |
||||
this.templateStyle = templateStyle; |
||||
super.repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void paint(Graphics g) { |
||||
super.paint(g); |
||||
Graphics2D g2d = (Graphics2D) g.create(); |
||||
Image image = BaseUtils.readImage(templateStyle.getPreview()); |
||||
g2d.drawImage(image, 0, OFFSETY, WIDTH, HEIGHT, null); |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.mainframe.widget.wrappers; |
||||
|
||||
import com.fr.design.Exception.ValidationException; |
||||
import com.fr.design.designer.properties.Decoder; |
||||
import com.fr.design.designer.properties.Encoder; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* Created by kerry on 2017/11/23. |
||||
*/ |
||||
public class TemplateStyleWrapper implements Encoder, Decoder { |
||||
@Override |
||||
public String encode(Object v) { |
||||
if (v == null) { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
return v.toString(); |
||||
} |
||||
|
||||
@Override |
||||
public Object decode(String txt) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void validate(String txt) throws ValidationException { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,88 @@
|
||||
package com.fr.design.style.background; |
||||
|
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.base.background.GradientBackground; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.style.background.gradient.GradientBackgroundPane; |
||||
import com.fr.design.style.background.impl.ColorBackgroundPane; |
||||
import com.fr.design.style.background.impl.NullBackgroundPane; |
||||
import com.fr.general.Background; |
||||
import com.fr.general.Inter; |
||||
|
||||
import java.util.LinkedHashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author kerry |
||||
* @date 2018/1/17 |
||||
*/ |
||||
public class BackgroundTabPane extends BackgroundPane { |
||||
|
||||
private static Map<Class<? extends Background>, BackgroundUIWrapper> tabpane = new LinkedHashMap<>(); |
||||
|
||||
static { |
||||
registerTabpaneBackground(tabpane); |
||||
} |
||||
|
||||
|
||||
private static void registerTabpaneBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) { |
||||
map.put(null, BackgroundUIWrapper.create() |
||||
.setType(NullBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Null"))); |
||||
map.put(ColorBackground.class, BackgroundUIWrapper.create() |
||||
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color"))); |
||||
map.put(GradientBackground.class, BackgroundUIWrapper.create() |
||||
.setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Gradient_Color"))); |
||||
|
||||
} |
||||
|
||||
public BackgroundTabPane() { |
||||
super(); |
||||
} |
||||
|
||||
protected void initTabPane() { |
||||
int index = 0; |
||||
for (Class<? extends Background> key : tabpane.keySet()) { |
||||
BackgroundUIWrapper wrapper = tabpane.get(key); |
||||
wrapper.setIndex(index++); |
||||
tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); |
||||
} |
||||
} |
||||
|
||||
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) { |
||||
return tabpane.get(background == null ? null : background.getClass()); |
||||
} |
||||
|
||||
protected BackgroundDetailPane getTabItemPane(Background background, int index) { |
||||
BackgroundDetailPane quickPane = cacheMap.get(index); |
||||
if (quickPane == null) { |
||||
BackgroundUIWrapper uiWrapper = getBackgroundUIWrapper(background); |
||||
quickPane = BackgroundFactory.createByWrapper(uiWrapper); |
||||
quickPane.addChangeListener(backgroundChangeListener); |
||||
cacheMap.put(index, quickPane); |
||||
} |
||||
tabbedPane.setComponentAt(index, quickPane); |
||||
tabbedPane.setSelectedIndex(index); |
||||
return quickPane; |
||||
} |
||||
|
||||
protected BackgroundDetailPane getTabItemPaneByIndex(int index) { |
||||
BackgroundDetailPane quickPane = cacheMap.get(index); |
||||
if (quickPane == null) { |
||||
quickPane = createDetailPaneByIndex(index); |
||||
tabbedPane.setComponentAt(index, quickPane); |
||||
cacheMap.put(index, quickPane); |
||||
quickPane.addChangeListener(backgroundChangeListener); |
||||
} |
||||
return quickPane; |
||||
} |
||||
|
||||
public BackgroundDetailPane createDetailPaneByIndex(int index) { |
||||
for (BackgroundUIWrapper wrapper : tabpane.values()) { |
||||
if (wrapper.getIndex() == index) { |
||||
return BackgroundFactory.createByWrapper(wrapper); |
||||
} |
||||
} |
||||
return new NullBackgroundPane(); |
||||
} |
||||
|
||||
} |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 15 KiB |