Commit 08376811 by Nepxion

增加图形化灰度发布功能

parent 15d085d0
......@@ -45,6 +45,7 @@ import com.nepxion.discovery.console.desktop.entity.RouterEntity;
import com.nepxion.discovery.console.desktop.icon.ConsoleIconFactory;
import com.nepxion.discovery.console.desktop.locale.ConsoleLocale;
import com.nepxion.discovery.console.desktop.workspace.topology.AbstractTopology;
import com.nepxion.discovery.console.desktop.workspace.topology.LocationEntity;
import com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntity;
import com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType;
import com.nepxion.swing.action.JSecurityAction;
......@@ -63,10 +64,7 @@ import com.nepxion.swing.textfield.JBasicTextField;
public class RouterTopology extends AbstractTopology {
private static final long serialVersionUID = 1L;
private int nodeStartX = 100;
private int nodeStartY = 150;
private int nodeHorizontalGap = 200;
private int nodeVerticalGap = 0;
private LocationEntity nodeLocationEntity = new LocationEntity(100, 150, 200, 0);
private TopologyEntity serviceNodeEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, true);
......@@ -197,7 +195,7 @@ public class RouterTopology extends AbstractTopology {
private TNode addNode(RouterEntity routerEntity, int index) {
String nodeName = getNodeName(routerEntity);
TNode node = createNode(nodeName, serviceNodeEntity, index, nodeStartX, nodeStartY, nodeHorizontalGap, nodeVerticalGap);
TNode node = createNode(nodeName, serviceNodeEntity, nodeLocationEntity, index);
node.setUserObject(routerEntity);
dataBox.addElement(node);
......
......@@ -49,6 +49,7 @@ import com.nepxion.discovery.console.desktop.icon.ConsoleIconFactory;
import com.nepxion.discovery.console.desktop.locale.ConsoleLocale;
import com.nepxion.discovery.console.desktop.util.UIUtil;
import com.nepxion.discovery.console.desktop.workspace.topology.AbstractTopology;
import com.nepxion.discovery.console.desktop.workspace.topology.LocationEntity;
import com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntity;
import com.nepxion.discovery.console.desktop.workspace.topology.TopologyEntityType;
import com.nepxion.swing.action.JSecurityAction;
......@@ -74,15 +75,8 @@ import com.nepxion.swing.textfield.number.JNumberTextField;
public class ServiceTopology extends AbstractTopology {
private static final long serialVersionUID = 1L;
private int groupStartX = 120;
private int groupStartY = 200;
private int groupHorizontalGap = 280;
private int groupVerticalGap = 0;
private int nodeStartX = 0;
private int nodeStartY = 0;
private int nodeHorizontalGap = 120;
private int nodeVerticalGap = 100;
private LocationEntity groupLocationEntity = new LocationEntity(120, 200, 280, 0);
private LocationEntity nodeLocationEntity = new LocationEntity(0, 0, 120, 100);
private TopologyEntity serviceGroupEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, true);
private TopologyEntity serviceNodeEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, false);
......@@ -183,7 +177,7 @@ public class ServiceTopology extends AbstractTopology {
int count = groupLocationMap.size();
String groupName = getGroupName(serviceId, instances.size(), null);
TGroup group = createGroup(groupName, serviceGroupEntity, count, groupStartX, groupStartY, groupHorizontalGap, groupVerticalGap);
TGroup group = createGroup(groupName, serviceGroupEntity, groupLocationEntity, count);
group.setGroupType(TGroupType.ELLIPSE_GROUP_TYPE.getType());
group.setUserObject(serviceId);
......@@ -199,11 +193,11 @@ public class ServiceTopology extends AbstractTopology {
TNode node = null;
if (StringUtils.isNotEmpty(plugin)) {
node = createNode(nodeName, serviceNodeEntity, i, nodeStartX, nodeStartY, nodeHorizontalGap, nodeVerticalGap);
node = createNode(nodeName, serviceNodeEntity, nodeLocationEntity, i);
node.putClientProperty("plugin", plugin);
group.putClientProperty("plugin", plugin);
} else {
node = createNode(nodeName, notServiceNodeEntity, i, nodeStartX, nodeStartY, nodeHorizontalGap, nodeVerticalGap);
node = createNode(nodeName, notServiceNodeEntity, nodeLocationEntity, i);
node.putClientProperty("plugin", "");
group.putClientProperty("plugin", "");
}
......@@ -989,15 +983,15 @@ public class ServiceTopology extends AbstractTopology {
}
public void setToUI() {
groupStartXTextField.setText(groupStartX + "");
groupStartYTextField.setText(groupStartY + "");
groupHorizontalGapTextField.setText(groupHorizontalGap + "");
groupVerticalGapTextField.setText(groupVerticalGap + "");
nodeStartXTextField.setText(nodeStartX + "");
nodeStartYTextField.setText(nodeStartY + "");
nodeHorizontalGapTextField.setText(nodeHorizontalGap + "");
nodeVerticalGapTextField.setText(nodeVerticalGap + "");
groupStartXTextField.setText(groupLocationEntity.getStartX() + "");
groupStartYTextField.setText(groupLocationEntity.getStartY() + "");
groupHorizontalGapTextField.setText(groupLocationEntity.getHorizontalGap() + "");
groupVerticalGapTextField.setText(groupLocationEntity.getVerticalGap() + "");
nodeStartXTextField.setText(nodeLocationEntity.getStartX() + "");
nodeStartYTextField.setText(nodeLocationEntity.getStartY() + "");
nodeHorizontalGapTextField.setText(nodeLocationEntity.getHorizontalGap() + "");
nodeVerticalGapTextField.setText(nodeLocationEntity.getVerticalGap() + "");
}
public boolean setFromUI() {
......@@ -1024,14 +1018,15 @@ public class ServiceTopology extends AbstractTopology {
return false;
}
ServiceTopology.this.groupStartX = groupStartX;
ServiceTopology.this.groupStartY = groupStartY;
ServiceTopology.this.groupHorizontalGap = groupHorizontalGap;
ServiceTopology.this.groupVerticalGap = groupVerticalGap;
ServiceTopology.this.nodeStartX = nodeStartX;
ServiceTopology.this.nodeStartY = nodeStartY;
ServiceTopology.this.nodeHorizontalGap = nodeHorizontalGap;
ServiceTopology.this.nodeVerticalGap = nodeVerticalGap;
groupLocationEntity.setStartX(groupStartX);
groupLocationEntity.setStartY(groupStartY);
groupLocationEntity.setHorizontalGap(groupHorizontalGap);
groupLocationEntity.setVerticalGap(groupVerticalGap);
nodeLocationEntity.setStartX(nodeStartX);
nodeLocationEntity.setStartY(nodeStartY);
nodeLocationEntity.setHorizontalGap(nodeHorizontalGap);
nodeLocationEntity.setVerticalGap(nodeVerticalGap);
return true;
}
......
......@@ -231,16 +231,21 @@ public abstract class AbstractTopology extends JPanel {
linkAutoHideRadioButtonMenuItem.setSelected(hide);
}
protected TGroup createGroup(String name, TopologyEntity entity, int index, int startX, int startY, int horizontalGap, int verticalGap) {
String image = entity.getImage();
Point location = new Point(entity.isHorizontalPile() ? startX + index * horizontalGap : startX, entity.isHorizontalPile() ? startY : startY + index * verticalGap);
protected TGroup createGroup(String name, TopologyEntity topologyEntity, LocationEntity locationEntity, int index) {
String image = topologyEntity.getImage();
int startX = locationEntity.getStartX();
int startY = locationEntity.getStartY();
int horizontalGap = locationEntity.getHorizontalGap();
int verticalGap = locationEntity.getVerticalGap();
Point location = new Point(topologyEntity.isHorizontalPile() ? startX + index * horizontalGap : startX, topologyEntity.isHorizontalPile() ? startY : startY + index * verticalGap);
return createGroup(name, image, location);
}
protected TGroup createGroup(String name, TopologyEntity entity) {
String image = entity.getImage();
Point location = entity.getLocation();
protected TGroup createGroup(String name, TopologyEntity topologyEntity) {
String image = topologyEntity.getImage();
Point location = topologyEntity.getLocation();
return createGroup(name, image, location);
}
......@@ -255,16 +260,21 @@ public abstract class AbstractTopology extends JPanel {
return group;
}
protected TNode createNode(String name, TopologyEntity entity, int index, int startX, int startY, int horizontalGap, int verticalGap) {
String image = entity.getImage();
Point location = new Point(entity.isHorizontalPile() ? startX + index * horizontalGap : startX, entity.isHorizontalPile() ? startY : startY + index * verticalGap);
protected TNode createNode(String name, TopologyEntity topologyEntity, LocationEntity locationEntity, int index) {
String image = topologyEntity.getImage();
int startX = locationEntity.getStartX();
int startY = locationEntity.getStartY();
int horizontalGap = locationEntity.getHorizontalGap();
int verticalGap = locationEntity.getVerticalGap();
Point location = new Point(topologyEntity.isHorizontalPile() ? startX + index * horizontalGap : startX, topologyEntity.isHorizontalPile() ? startY : startY + index * verticalGap);
return createNode(name, image, location);
}
protected TNode createNode(String name, TopologyEntity entity) {
String image = entity.getImage();
Point location = entity.getLocation();
protected TNode createNode(String name, TopologyEntity topologyEntity) {
String image = topologyEntity.getImage();
Point location = topologyEntity.getLocation();
return createNode(name, image, location);
}
......
package com.nepxion.discovery.console.desktop.workspace.topology;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
public class LocationEntity {
private int startX;
private int startY;
private int horizontalGap;
private int verticalGap;
public LocationEntity(int startX, int startY, int horizontalGap, int verticalGap) {
this.startX = startX;
this.startY = startY;
this.horizontalGap = horizontalGap;
this.verticalGap = verticalGap;
}
public int getStartX() {
return startX;
}
public void setStartX(int startX) {
this.startX = startX;
}
public int getStartY() {
return startY;
}
public void setStartY(int startY) {
this.startY = startY;
}
public int getHorizontalGap() {
return horizontalGap;
}
public void setHorizontalGap(int horizontalGap) {
this.horizontalGap = horizontalGap;
}
public int getVerticalGap() {
return verticalGap;
}
public void setVerticalGap(int verticalGap) {
this.verticalGap = verticalGap;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment