Skip to content

Commit 9030f34

Browse files
Copy Rung issue
1 parent 242bf5f commit 9030f34

File tree

3 files changed

+35
-28
lines changed

3 files changed

+35
-28
lines changed

src/main/java/org/grandviewtech/constants/ApplicationConstant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ public class ApplicationConstant
3535
public static int SECTION_HEIGHT = 100;
3636
public static int MAX_CELL = 10;
3737
public static int CUSTOM_BORDER_HEIGTH_OFFSET = 2;
38-
final public static String VERSION = "V 10.7";
38+
final public static String VERSION = "V 10.8";
3939
}

src/main/java/org/grandviewtech/entity/bo/ClipBoard.java

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ public static ClipBoard getInstance()
5353
return ClipBoardInstanceFactory.instance;
5454
}
5555

56-
private static JLabel selection = new JLabel("SELECTION : OFF ");
57-
private static CLIPBOARD_ACTION clipboardAction = CLIPBOARD_ACTION.DEFUALT;
58-
public static JLabel cutLabel;
59-
public static JLabel copyLabel;
60-
public static JLabel pasteLabel;
56+
private static JLabel selection = new JLabel("SELECTION : OFF ");
57+
private static CLIPBOARD_ACTION clipboardAction = CLIPBOARD_ACTION.DEFUALT;
58+
public static JLabel cutLabel;
59+
public static JLabel copyLabel;
60+
public static JLabel pasteLabel;
6161

62-
private static boolean isControlKeyActive = false;
62+
private static boolean isControlKeyActive = false;
6363

64-
private static String clipBoardType;
65-
private static List<Rung> copiedTempRung = new ArrayList<Rung>();
66-
private static List<Rung> copiedRung = new ArrayList<Rung>();
67-
private static List<ColumnScreen> tempData = new ArrayList<ColumnScreen>();
68-
private static List<ColumnScreen> copiedCell = new ArrayList<ColumnScreen>();
64+
private static String clipBoardType;
65+
private static List<Rung> copiedTempRung = new ArrayList<Rung>();
66+
private static List<Rung> copiedRung = new ArrayList<Rung>();
67+
private static List<ColumnScreen> tempData = new ArrayList<ColumnScreen>();
68+
private static List<ColumnScreen> copiedCell = new ArrayList<ColumnScreen>();
6969

70-
private static int currentRowNumber;
71-
private static int currentColumnNumber;
70+
private static int currentRowNumber;
71+
private static int currentColumnNumber;
7272

7373
public static String getClipBoardType()
7474
{
@@ -116,21 +116,24 @@ public static void addCopiedRung()
116116
{
117117
for (Rung rung : copiedTempRung)
118118
{
119-
int rowNumber = rung.getRowNumber();
120-
RowScreen rowScreen = SCREEN.getRow(rowNumber);
121-
if (clipboardAction == CLIPBOARD_ACTION.COPY)
119+
if (copiedRung.contains(rung) == false)
122120
{
123-
rowScreen.setBackground(java.awt.Color.GREEN);
121+
int rowNumber = rung.getRowNumber();
122+
RowScreen rowScreen = SCREEN.getRow(rowNumber);
123+
if (clipboardAction == CLIPBOARD_ACTION.COPY)
124+
{
125+
rowScreen.setBackground(java.awt.Color.GREEN);
126+
}
127+
else if (clipboardAction == CLIPBOARD_ACTION.CUT)
128+
{
129+
rowScreen.setBackground(java.awt.Color.RED);
130+
}
131+
else
132+
{
133+
rowScreen.setBackground(java.awt.Color.RED);
134+
}
135+
copiedRung.add(rung);
124136
}
125-
else if (clipboardAction == CLIPBOARD_ACTION.CUT)
126-
{
127-
rowScreen.setBackground(java.awt.Color.RED);
128-
}
129-
else
130-
{
131-
rowScreen.setBackground(java.awt.Color.RED);
132-
}
133-
copiedRung.add(rung);
134137
}
135138
}
136139

src/main/java/org/grandviewtech/userinterface/listeners/RungListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,16 @@ public void mouseClicked(MouseEvent mouseEvent)
5858
editMenu.removeAll();
5959
open();
6060
editMenu.show(rung, rung.getX() + 22, rung.getY());
61+
//
6162
}
62-
ClipBoard.addTempRung(rung);
63+
6364
if (ClipBoard.isControlKeyActive() == false)
6465
{
6566
rung.setBackground(Color.GREEN);
6667
}
68+
69+
ClipBoard.addTempRung(rung);
70+
6771
}
6872

6973
@Override

0 commit comments

Comments
 (0)