Browse Source

无jira任务 代码质量

newui
vito 10 months ago
parent
commit
5f3b2401ae
  1. 5
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  2. 13
      designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java
  3. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  4. 3
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java
  5. 43
      designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java

5
designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java

@ -54,6 +54,11 @@ public interface ParameterDesignerProvider {
return 0; return 0;
} }
/**
* 参数界面工具栏
*
* @return 工具栏组件
*/
JComponent[] toolbarPanes4Form(); JComponent[] toolbarPanes4Form();
JComponent[] toolBarButton4Form(); JComponent[] toolBarButton4Form();

13
designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java

@ -27,13 +27,13 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* Created with IntelliJ IDEA.
* User: zx
* Date: 14-7-8
* Time: 上午10:09
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*
* @author zx
* @since 7.0
* Created on 14-7-8
* Time: 上午10:09
*/ */
public class FormParaPane extends UIToolbar { public class FormParaPane extends UIToolbar {
private static final int TOOLTIP_X = 5; private static final int TOOLTIP_X = 5;
@ -57,6 +57,9 @@ public class FormParaPane extends UIToolbar {
}, context -> context.contain(PluginModule.ExtraDesign)); }, context -> context.contain(PluginModule.ExtraDesign));
} }
/**
* 单例不合适下次重构
*/
public static FormParaPane getInstance(FormDesigner designer) { public static FormParaPane getInstance(FormDesigner designer) {
if (THIS == null) { if (THIS == null) {
THIS = new FormParaPane(); THIS = new FormParaPane();

4
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -61,7 +61,11 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* 参数面板控件工具栏
*
* @author null * @author null
* @since 7.0
* Created on 2008
*/ */
public class FormParaWidgetPane extends UIToolbar { public class FormParaWidgetPane extends UIToolbar {
private static FormParaWidgetPane THIS; private static FormParaWidgetPane THIS;

3
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java

@ -35,6 +35,9 @@ public class FormWidgetPopWindow extends JWindow {
this.setSize(pane.getPreferredSize()); this.setSize(pane.getPreferredSize());
} }
/**
* 展示提示
*/
public void showToolTip(int xAbs, int yAbs, WidgetOption[] options) { public void showToolTip(int xAbs, int yAbs, WidgetOption[] options) {
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
this.setLocation(xAbs, yAbs); this.setLocation(xAbs, yAbs);

43
designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java

@ -19,15 +19,18 @@ import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener; import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource; import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter; import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
/* /**
*august: 控件按钮 * 控件按钮
*
* @author august
* @since 7.0
* Created on 2008
*/ */
public class ToolBarButton extends UIButton implements MouseListener, MouseMotionListener, Serializable { public class ToolBarButton extends UIButton implements MouseListener, MouseMotionListener, Serializable {
@ -46,25 +49,36 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE);
} }
/**
* 获取控件配置
*
* @return 控件配置
*/
public WidgetOption getNameOption() { public WidgetOption getNameOption() {
return this.no; return this.no;
} }
/**
* 设置控件配置
*
* @param no 控件配置
*/
public void setNameOption(WidgetOption no) { public void setNameOption(WidgetOption no) {
this.no = no; this.no = no;
} }
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (e.getClickCount() >= 2) {
}
}
}
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
lastPressEvent = e; lastPressEvent = e;
} }
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
} }
@ -105,7 +119,10 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
} }
public class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { /**
* 拖放拖动手势侦听器
*/
public static class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener {
private DragSource source; private DragSource source;
public DragAndDropDragGestureListener(ToolBarButton tt, int actions) { public DragAndDropDragGestureListener(ToolBarButton tt, int actions) {
@ -113,6 +130,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
source.createDefaultDragGestureRecognizer(tt, actions, this); source.createDefaultDragGestureRecognizer(tt, actions, this);
} }
@Override
public void dragGestureRecognized(DragGestureEvent dge) { public void dragGestureRecognized(DragGestureEvent dge) {
ToolBarButton toolBarButton = (ToolBarButton) dge.getComponent(); ToolBarButton toolBarButton = (ToolBarButton) dge.getComponent();
if (toolBarButton != null) { if (toolBarButton != null) {
@ -122,13 +140,12 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
} }
} }
@Override
public void dragEnter(DragSourceDragEvent dragSourceDragEvent) {
}
} }
public class DragAndDropTransferable implements Transferable { /**
* 拖放转换器
*/
public static class DragAndDropTransferable implements Transferable {
private Widget widget; private Widget widget;
public DragAndDropTransferable(Widget widget) { public DragAndDropTransferable(Widget widget) {
@ -137,10 +154,12 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")}; DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")};
@Override
public DataFlavor[] getTransferDataFlavors() { public DataFlavor[] getTransferDataFlavors() {
return flavors; return flavors;
} }
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) { public boolean isDataFlavorSupported(DataFlavor flavor) {
for (DataFlavor df : flavors) { for (DataFlavor df : flavors) {
if (ComparatorUtils.equals(df, flavor)) { if (ComparatorUtils.equals(df, flavor)) {

Loading…
Cancel
Save