Browse Source
* commit '942cf831409066a9d2b07db41ef23630dceac7e1': REPORT-4634 组件叠加体验优化=>5 支持 delete 和 backspace 删除组件 REPORT-4634 组件叠加体验优化=>4缩略图=>调整代码 REPORT-4634 组件叠加体验优化=>4缩略图=>修复删除组件后,预览框不消失的bug REPORT-4634 组件叠加体验优化=>4缩略图=>完成缩略图显示 REPORT-4634 组件叠加体验优化=>4缩略图=>缩略图框架 REPORT-4634 组件叠加体验优化=>3=>icon 替换 REPORT-4634 组件叠加体验优化=>3=>处理操作置灰的情况 REPORT-4634 组件叠加体验优化=>3=>右键菜单支持 REPORT-4634 组件叠加体验优化=>3=>上移、下移、置顶、置底 REPORT-4634 组件叠加体验优化=>3=>增加4个按钮、快捷键 REPORT-4634 组件叠加体验优化=>2=>修复点击控件树的npe问题 REPORT-4634 组件叠加体验优化=>2=>调整交互和视觉 REPORT-4634 组件叠加体验优化=>2=>修复添加控件,控件树不刷新的问题 REPORT-4634 组件叠加体验优化=>1=>tabpane 点击控件树退出编辑(tabpane的实现有点奇怪,先不管) REPORT-4634 组件叠加体验优化=>1=>控件树中点击图表块自身、绝对布局自身,可退出编辑状态 REPORT-4634 组件叠加体验优化=>1=>点击控件时,控件树的选项跟着变化 REPORT-4634 组件叠加体验优化=>1=>点击控件树退出绝对布局编辑 REPORT-4634 组件叠加体验优化=>1、2 初步框架master
superman
7 years ago
31 changed files with 634 additions and 138 deletions
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 278 B |
@ -0,0 +1,59 @@ |
|||||||
|
package com.fr.design.designer.beans.actions; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.designer.beans.events.DesignerEvent; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.mainframe.FormSelection; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.InputEvent; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
|
||||||
|
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||||
|
|
||||||
|
/** |
||||||
|
* 下移一层(控件树内) |
||||||
|
* Created by plough on 2017/12/4. |
||||||
|
*/ |
||||||
|
|
||||||
|
public class MoveDownAction extends FormEditAction { |
||||||
|
|
||||||
|
public MoveDownAction(FormDesigner t) { |
||||||
|
super(t); |
||||||
|
this.setName(Inter.getLocText("FR-Designer_Move_Down")); |
||||||
|
this.setMnemonic('T'); |
||||||
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); |
||||||
|
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
FormSelection selection = designer.getSelectionModel().getSelection(); |
||||||
|
XCreator creator = selection.getSelectedCreator(); |
||||||
|
Container container = creator.getParent(); |
||||||
|
int targetIndex = container.getComponentZOrder(creator) + 1; |
||||||
|
if (targetIndex >= container.getComponentCount()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
container.setComponentZOrder(creator, targetIndex); |
||||||
|
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
this.setEnabled(false); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.setEnabled(designer.isCurrentComponentMovableDown()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
package com.fr.design.designer.beans.actions; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.designer.beans.events.DesignerEvent; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.mainframe.FormSelection; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.InputEvent; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
|
||||||
|
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||||
|
|
||||||
|
/** |
||||||
|
* 置于底层(控件树内) |
||||||
|
* Created by plough on 2017/12/4. |
||||||
|
*/ |
||||||
|
|
||||||
|
public class MoveToBottomAction extends FormEditAction { |
||||||
|
|
||||||
|
public MoveToBottomAction(FormDesigner t) { |
||||||
|
super(t); |
||||||
|
this.setName(Inter.getLocText("FR-Designer_Move_To_Bottom")); |
||||||
|
this.setMnemonic('T'); |
||||||
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png")); |
||||||
|
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
FormSelection selection = designer.getSelectionModel().getSelection(); |
||||||
|
XCreator creator = selection.getSelectedCreator(); |
||||||
|
Container container = creator.getParent(); |
||||||
|
int targetIndex = container.getComponentCount() - 1; |
||||||
|
if (container.getComponentZOrder(creator) >= targetIndex) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
container.setComponentZOrder(creator, targetIndex); |
||||||
|
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
this.setEnabled(false); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.setEnabled(designer.isCurrentComponentMovableDown()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.fr.design.designer.beans.actions; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.designer.beans.events.DesignerEvent; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.mainframe.FormSelection; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.InputEvent; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
|
||||||
|
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||||
|
|
||||||
|
/** |
||||||
|
* 置于顶层(控件树内) |
||||||
|
* Created by plough on 2017/12/4. |
||||||
|
*/ |
||||||
|
|
||||||
|
public class MoveToTopAction extends FormEditAction { |
||||||
|
|
||||||
|
public MoveToTopAction(FormDesigner t) { |
||||||
|
super(t); |
||||||
|
this.setName(Inter.getLocText("FR-Designer_Move_To_Top")); |
||||||
|
this.setMnemonic('T'); |
||||||
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png")); |
||||||
|
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
FormSelection selection = designer.getSelectionModel().getSelection(); |
||||||
|
XCreator creator = selection.getSelectedCreator(); |
||||||
|
Container container = creator.getParent(); |
||||||
|
if (container.getComponentZOrder(creator) == 0) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
container.setComponentZOrder(creator, 0); |
||||||
|
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
this.setEnabled(false); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.setEnabled(designer.isCurrentComponentMovableUp()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.fr.design.designer.beans.actions; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.designer.beans.events.DesignerEvent; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.mainframe.FormSelection; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
|
||||||
|
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||||
|
|
||||||
|
/** |
||||||
|
* 同级上移一层(控件树内) |
||||||
|
* Created by plough on 2017/12/4. |
||||||
|
*/ |
||||||
|
|
||||||
|
public class MoveUpAction extends FormEditAction { |
||||||
|
|
||||||
|
public MoveUpAction(FormDesigner t) { |
||||||
|
super(t); |
||||||
|
this.setName(Inter.getLocText("FR-Designer_Move_Up")); |
||||||
|
this.setMnemonic('T'); |
||||||
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); |
||||||
|
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
FormSelection selection = designer.getSelectionModel().getSelection(); |
||||||
|
XCreator creator = selection.getSelectedCreator(); |
||||||
|
Container container = creator.getParent(); |
||||||
|
int targetIndex = container.getComponentZOrder(creator) - 1; |
||||||
|
if (targetIndex < 0) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
container.setComponentZOrder(creator, targetIndex); |
||||||
|
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
FormDesigner designer = getEditingComponent(); |
||||||
|
if (designer == null) { |
||||||
|
this.setEnabled(false); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.setEnabled(designer.isCurrentComponentMovableUp()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue