Skip to content

Commit

Permalink
Fixed bug in Edit (Block) Description; started on GoFBP support
Browse files Browse the repository at this point in the history
  • Loading branch information
jpaulm committed Dec 2, 2021
1 parent 397ba69 commit 5764d26
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 62 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -47,7 +47,7 @@ allprojects { project ->
}
}
*/
version = '3.0.6'
version = '3.1.0'

group = 'com.jpaulmorrison'

Expand Down
Binary file modified build/distributions/drawfbp-3.0.6.tar
Binary file not shown.
Binary file modified build/distributions/drawfbp-3.0.6.zip
Binary file not shown.
Binary file modified build/libs/drawfbp-3.0.6-javadoc.jar
Binary file not shown.
Binary file modified build/libs/drawfbp-3.0.6-sources.jar
Binary file not shown.
Binary file modified build/libs/drawfbp-3.0.6.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion build/scripts/drawfbp
Expand Up @@ -80,7 +80,7 @@ case "`uname`" in
;;
esac

CLASSPATH=$APP_HOME/lib/drawfbp-3.0.6.jar:$APP_HOME/lib/javaGeom-0.11.1.jar:$APP_HOME/lib/javahelp-2.0.05.jar
CLASSPATH=$APP_HOME/lib/drawfbp-3.1.0.jar:$APP_HOME/lib/javaGeom-0.11.1.jar:$APP_HOME/lib/javahelp-2.0.05.jar


# Determine the Java command to use to start the JVM.
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/drawfbp.bat
Expand Up @@ -67,7 +67,7 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\lib\drawfbp-3.0.6.jar;%APP_HOME%\lib\javaGeom-0.11.1.jar;%APP_HOME%\lib\javahelp-2.0.05.jar
set CLASSPATH=%APP_HOME%\lib\drawfbp-3.1.0.jar;%APP_HOME%\lib\javaGeom-0.11.1.jar;%APP_HOME%\lib\javahelp-2.0.05.jar


@rem Execute drawfbp
Expand Down
1 change: 1 addition & 0 deletions build/tmp/compileJava/source-classes-mapping.txt
Expand Up @@ -83,6 +83,7 @@ com/jpaulmorrison/graphics/DrawFBP.java
com.jpaulmorrison.graphics.DrawFBP$EscapeAction
com.jpaulmorrison.graphics.DrawFBP$ExeFilter
com.jpaulmorrison.graphics.DrawFBP$FBPFilter
com.jpaulmorrison.graphics.DrawFBP$GoFileFilter
com.jpaulmorrison.graphics.DrawFBP$ImageFilter
com.jpaulmorrison.graphics.DrawFBP$ImagePanel
com.jpaulmorrison.graphics.DrawFBP$JSFilter
Expand Down
2 changes: 1 addition & 1 deletion build/tmp/jar/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Implementation-Title: DrawFBP
Implementation-Version: 3.0.6
Implementation-Version: 3.1.0
Class-Path: javaGeom-0.11.1.jar javahelp-2.0.05.jar
Main-Class: com.jpaulmorrison.graphics.DrawFBP

4 changes: 2 additions & 2 deletions build/tmp/javadoc/javadoc.options
@@ -1,10 +1,10 @@
-Xdoclint:none
-classpath 'C:\\Users\\Paul\\Documents\\GitHub\\drawfbp\\build\\classes\\java\\main;C:\\Users\\Paul\\Documents\\GitHub\\drawfbp\\build\\resources\\main;C:\\Users\\Paul\\.gradle\\caches\\modules-2\\files-2.1\\math.geom2d\\javaGeom\\0.11.1\\5951b33da14e56c9e2b1f741b9ba3531401393b6\\javaGeom-0.11.1.jar;C:\\Users\\Paul\\.gradle\\caches\\modules-2\\files-2.1\\javax.help\\javahelp\\2.0.05\\ca70822c47a67fc3a11670270567c2d01566dae1\\javahelp-2.0.05.jar'
-d 'C:\\Users\\Paul\\Documents\\GitHub\\drawfbp\\build\\docs\\javadoc'
-doctitle 'drawfbp 3.0.6 API'
-doctitle 'drawfbp 3.1.0 API'
-notimestamp
-quiet
-windowtitle 'drawfbp 3.0.6 API'
-windowtitle 'drawfbp 3.1.0 API'
'C:\\Users\\Paul\\Documents\\GitHub\\drawfbp\\src\\main\\java\\com\\jpaulmorrison\\graphics\\AInPort.java'
'C:\\Users\\Paul\\Documents\\GitHub\\drawfbp\\src\\main\\java\\com\\jpaulmorrison\\graphics\\AOutPort.java'
'C:\\Users\\Paul\\Documents\\GitHub\\drawfbp\\src\\main\\java\\com\\jpaulmorrison\\graphics\\Arrow.java'
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.jpaulmorrison</groupId>
<artifactId>drawfbp</artifactId>
<version>3.0.6</version>
<version>3.1.0</version>
<name>DrawFBP</name>
<description>Diagramming Tool for Flow-Based Programming</description>
<url>https://github.com/jpaulm/drawfbp</url>
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/jpaulmorrison/graphics/Arrow.java
Expand Up @@ -790,8 +790,7 @@ public void actionPerformed(ActionEvent e) {
diag.oldArrow = this;
diag.delTouchingArrows(this);
diag.arrows.remove(Integer.valueOf(id));
return;
/*

Arrow arr = new Arrow(diag);

// try reusing id
Expand All @@ -808,8 +807,7 @@ public void actionPerformed(ActionEvent e) {
//driver.currentArrow = arr;

return;
*/


} if (s.equals("Drag Tail")) {
//tailMarked = true;
driver.tailMark = new Point(fromX, fromY);
Expand Down
36 changes: 21 additions & 15 deletions src/main/java/com/jpaulmorrison/graphics/Block.java
Expand Up @@ -204,7 +204,7 @@ void draw(Graphics g) {


if (desc != null) {
//// String str[] = centreDesc();
String str[] = centreDesc();
int x = cx - textWidth / 2;
int y = cy - textHeight / 2 + driver.gFontHeight - 6;
if (this instanceof ProcessBlock) {
Expand Down Expand Up @@ -1564,8 +1564,10 @@ void buildBlockPopupMenu() {
menuItem.addActionListener(this);
diag.actionList.add(menuItem);
diag.actionList.addSeparator();
JMenuItem menuItem1b = new JMenuItem(
"Choose Component/Subnet Class");
String chComp = "Choose Component/Subnet";
if (driver.currNotn.lang != driver.langs[DrawFBP.Lang.GO])
chComp += " Class";
JMenuItem menuItem1b = new JMenuItem(chComp);
menuItem1b.addActionListener(this);
diag.actionList.add(menuItem1b);
JMenuItem menuItem2b = new JMenuItem("Display Full Class Name");
Expand All @@ -1577,7 +1579,8 @@ void buildBlockPopupMenu() {

boolean b = driver.currNotn != null &&
(driver.currNotn.lang == driver.langs[DrawFBP.Lang.JAVA] ||
driver.currNotn.lang == driver.langs[DrawFBP.Lang.CSHARP]);
driver.currNotn.lang == driver.langs[DrawFBP.Lang.CSHARP] ||
driver.currNotn.lang == driver.langs[DrawFBP.Lang.GO]);
menuItem1b.setEnabled(b);
//menuItem3b.setEnabled(driver.currNotn != null &&
// driver.currNotn.lang == driver.langs[DrawFBP.Lang.JAVA]);
Expand Down Expand Up @@ -1650,7 +1653,7 @@ public void actionPerformed(ActionEvent e) {
if (width < 12)
width = 12;
buildSideRects();
//centreDesc();
centreDesc();

for (Arrow arrow : diag.arrows.values()) {
if (arrow.fromId == id && arrow.fromY == arrow.toY) // i.e.
Expand Down Expand Up @@ -1737,11 +1740,13 @@ public void actionPerformed(ActionEvent e) {
return;
}

if (s.equals("Choose Component/Subnet Class")) {
if (s.startsWith("Choose Component/Subnet")) {

try {
if (driver.currNotn == driver.notations[DrawFBP.Notation.JAVA_FBP])
selectJavaClass();
else if (driver.currNotn == driver.notations[DrawFBP.Notation.GO_FBP])
selectNonJavaSource();
else {
if (driver.currNotn == driver.notations[DrawFBP.Notation.JSON] &&
driver.fbpJsonFile == null) {
Expand Down Expand Up @@ -2000,7 +2005,7 @@ of the enclosure also becomes the title of the subnet diagram (shown in bold und

boolean editDescription(int option) {

final JTextArea area = new JTextArea(4, 3);
JTextArea area = new JTextArea(4, 3);
JScrollPane pane = new JScrollPane(area);

area.setText(desc);
Expand Down Expand Up @@ -2067,22 +2072,23 @@ public void run() {
/*
* Solve double buffering first!
*
*/
//int w = driver.buffer.getWidth();
//int h = driver.buffer.getHeight();
int w = driver.buffer.getWidth();
int h = driver.buffer.getHeight();
driver.buffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
//driver.buffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
/*
driver.osg = (Graphics2D) driver.buffer.getGraphics();
diag.area.repaint();
*/
//centreDesc();
buildSideRects();
*/

diag.changed = true;

//driver.repaint();
diag.area.repaint();
driver.repaint();
//diag.area.repaint();

return true;
}
Expand Down
46 changes: 31 additions & 15 deletions src/main/java/com/jpaulmorrison/graphics/CodeManager.java
Expand Up @@ -267,6 +267,7 @@ boolean genCode() {
styles[k + 7] = packageNameStyle;
styles[k + 8] = normalStyle;

int blkIndex = 0;

for (Block block : diag.blocks.values()) {

Expand All @@ -287,7 +288,8 @@ boolean genCode() {
error = true;


if (block.component == null && block.compName == null) {
if (block.component == null && block.compName == null &&
driver.curDiag.lang != driver.langs[DrawFBP.Lang.GO] ) {
MyOptionPane.showMessageDialog(driver,
"Class name missing for '" + s + "' - diagram needs to be updated",
MyOptionPane.WARNING_MESSAGE);
Expand Down Expand Up @@ -587,26 +589,40 @@ boolean genCode() {
return true;
}

String genComp(String name, String className /*, String lang */) {
String genComp(String name, String className) {
String compName = "";
if (className == null)
className = "????";
compName = "????";

if (lang == driver.langs[Lang.JAVA]) {
//if (!(className.equals("\"Invalid class\"")))
if (!(className.endsWith(".class")))
className += ".class";
return "component(\"" + name + "\"," + className + ")";
compName = className + ".class";
return "component(\"" + name + "\"," + compName + ")";
}
else {
className.replace("\\", "/");
int i = className.lastIndexOf("/");
if (lang != driver.langs[Lang.CSHARP]) {
int j = className.lastIndexOf(".");
i = Math.max(i, j);
}
className = className.substring(i + 1);
return "Component(\"" + name + "\", typeof(" + className + "))";
if (lang == driver.langs[Lang.CSHARP]) {
compName = className.replace("\\", "/");
int i = compName.lastIndexOf("/");
int j = compName.lastIndexOf(".");
i = Math.max(i, j);
compName = compName.substring(i + 1);
return "Component(\"" + name + "\", typeof(" + compName + "))";
}
if (lang == driver.langs[Lang.GO]) {
compName = className.replace("\\", "/");
int i = compName.lastIndexOf("components/");
compName = compName.substring(i + 11);
compName = compName.replace("/", ".").
substring(0, compName.length() - 3);
String lc = name.toLowerCase();
return lc + " := net.NewProc(\"" + name +
"\", &" + compName + "{})";
}
compName = className.replace("\\", "/");
int i = compName.lastIndexOf("/");

compName = compName.substring(i + 1);
return "Component(\"" + name + "\", typeof(" + compName + "))";

}

String genConnect(Arrow arrow) {
Expand Down
25 changes: 8 additions & 17 deletions src/main/java/com/jpaulmorrison/graphics/DrawFBP.java
Expand Up @@ -2362,7 +2362,7 @@ else if (selRB == but[BUT_REPORT]) {
//block.calcEdges();
// diag.maxBlockNo++;
// block.id = diag.maxBlockNo;
diag.blocks.put(Integer.valueOf(block.id), block);
//diag.blocks.put(Integer.valueOf(block.id), block);
// diag.changed = true;
//selBlock = block;
// selArrowP = null;
Expand Down Expand Up @@ -5121,6 +5121,11 @@ boolean nearpln(int xp, int yp, Arrow arr) {
for (Bend bend : arr.bends) {
x2 = bend.x;
y2 = bend.y;
Point2D pb = new Point2D(x2, y2);
if (p.distance(pb) <= 40 ) {
res = true;
break;
}

line = new Line2D(x1, y1, x2, y2);
try {
Expand Down Expand Up @@ -5153,21 +5158,8 @@ boolean nearpln(int xp, int yp, Arrow arr) {
}
if (d >= 40.0)
return false;

}
// boolean res = false;

// System.out.println(d);

// if (d >= 40.0) {
// detArr = null;
// detArrSegNo = -1;
// arr.highlightedSeg = -1;
// }
// else {
// detArr = arr;
// detArrSegNo = segNo;


if (arr.shapeList == null || arr.shapeList.size() <= seg)
return false;

Expand All @@ -5176,8 +5168,7 @@ boolean nearpln(int xp, int yp, Arrow arr) {
arr.highlightedSeg = seg;

res = sh.contains(xp, yp);
// }


return res;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jpaulmorrison/graphics/MyOptionPane.java
Expand Up @@ -73,7 +73,7 @@ static Object showInputDialog(Component f, Object message, String title, int ms
if (selValue instanceof Integer && ((Integer) selValue).intValue() == CANCEL_OPTION)
return null;
Object o = pane.getInputValue();
if (selValue instanceof Float)
if (selValue instanceof Float || selValue instanceof String)
return selValue;
else
return o;
Expand Down
@@ -1,14 +1,14 @@
/*
* Copyright (C) J.P. Morrison, Enterprises, Ltd. 2009,..., 2020 All Rights Reserved.
* Copyright (C) J.P. Morrison, Enterprises, Ltd. 2009,..., 2021 All Rights Reserved.
*/
package com.jpaulmorrison.graphics;

public final class VersionAndTimestamp {

static String version = "3.0.7";
static String version = "3.1.0";


static String date = "Aug. 22, 2021";
static String date = "Dec. 2, 2021";


static String getVersion() {
Expand Down

0 comments on commit 5764d26

Please sign in to comment.