Skip to content

Commit 256e477

Browse files
committed
Fix import table with row and column annotations. Rename get/set color to from/to clipboard. Use display value when syncing colors.
1 parent c32a2ae commit 256e477

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

org.gitools.ui.app/src/main/java/org/gitools/ui/app/fileimport/wizard/text/reader/TableReaderAssistant.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void fillMatrixAndAnnotations(IMatrix matrix, AnnotationMatrix rowAnnMatr
6868
}
6969
if (hasColAnnotation()) {
7070
for (int i = 0; i < colAnnFields.length; i++) {
71-
rowAnnMatrix.setAnnotation(currentColId, colAnnFieldNames[i], colAnnFields[i]);
71+
colAnnMatrix.setAnnotation(currentColId, colAnnFieldNames[i], colAnnFields[i]);
7272
}
7373
}
7474
}
@@ -126,14 +126,14 @@ public void updateAnnotationNames() {
126126
int[] idx = profile.getRowAnnotationColumns();
127127
this.rowAnnFieldNames = new String[idx.length];
128128
for (int i = 0; i < idx.length; i++) {
129-
rowAnnFieldNames[i] = fileHeaders.get(i).toString();
129+
rowAnnFieldNames[i] = fileHeaders.get(idx[i]).toString();
130130
}
131131
}
132132
if (hasColAnnotation()) {
133133
int[] idx = profile.getColumnAnnotationColumns();
134134
this.colAnnFieldNames = new String[idx.length];
135135
for (int i = 0; i < idx.length; i++) {
136-
colAnnFieldNames[i] = fileHeaders.get(i).toString();
136+
colAnnFieldNames[i] = fileHeaders.get(idx[i]).toString();
137137
}
138138
}
139139
}

org.gitools.ui.app/src/main/java/org/gitools/ui/app/heatmap/header/wizard/coloredlabels/ColoredLabelsGroupsPage.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
package org.gitools.ui.app.heatmap.header.wizard.coloredlabels;
2323

2424
import org.gitools.heatmap.header.ColoredLabel;
25+
import org.gitools.ui.core.utils.FileChoose;
26+
import org.gitools.ui.core.utils.FileChooserUtils;
2527
import org.gitools.ui.platform.wizard.AbstractWizardPage;
2628
import org.gitools.utils.color.ColorRegistry;
2729

@@ -38,19 +40,19 @@
3840

3941
public class ColoredLabelsGroupsPage extends AbstractWizardPage {
4042

41-
private void setSync() {
43+
private void runToClipboard() {
4244
ColorRegistry cr = ColorRegistry.get();
4345
for (ColoredLabel cl : getColoredLabels()) {
44-
cr.registerId(cl.getValue(), cl.getColor());
46+
cr.registerId(cl.getDisplayedLabel(), cl.getColor());
4547
}
4648
}
4749

48-
private void sync() {
50+
private void runFromClipboard() {
4951
java.util.List<ColoredLabel> oldList = getColoredLabels();
5052
java.util.List<ColoredLabel> newList = new ArrayList<>();
5153
ColorRegistry cr = ColorRegistry.get();
5254
for (ColoredLabel cl : oldList) {
53-
newList.add(new ColoredLabel(cl.getValue(), cl.getDisplayedLabel(), cr.getColor(cl.getValue(), cl.getColor())));
55+
newList.add(new ColoredLabel(cl.getValue(), cl.getDisplayedLabel(), cr.getColor(cl.getDisplayedLabel(), cl.getColor())));
5456
}
5557
setColoredLabels(newList);
5658
}
@@ -289,16 +291,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
289291
}
290292
});
291293

292-
syncBtn.setText("Get colors");
293-
syncBtn.setToolTipText("Get value-color relations with other heatmaps whithin the current Gitools instance");
294+
syncBtn.setText("From clipboard");
295+
syncBtn.setToolTipText("Apply display-color relations from Gitools clipboard");
294296
syncBtn.addActionListener(new java.awt.event.ActionListener() {
295297
public void actionPerformed(java.awt.event.ActionEvent evt) {
296298
syncBtnActionPerformed(evt);
297299
}
298300
});
299301

300-
syncBtn1.setText("Set colors");
301-
syncBtn1.setToolTipText("Set value-color relations so other heatmaps can sync");
302+
syncBtn1.setText("To clipboard");
303+
syncBtn1.setToolTipText("Copy display-color relations to Gitools clipboard");
302304
syncBtn1.addActionListener(new java.awt.event.ActionListener() {
303305
public void actionPerformed(java.awt.event.ActionEvent evt) {
304306
syncBtn1ActionPerformed(evt);
@@ -327,7 +329,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
327329
.addComponent(removeBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
328330
.addComponent(syncBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
329331
.addComponent(tableAddBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
330-
.addComponent(syncBtn1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))
332+
.addComponent(syncBtn1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
331333
);
332334
layout.setVerticalGroup(
333335
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -361,17 +363,18 @@ private void removeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
361363
}//GEN-LAST:event_removeBtnActionPerformed
362364

363365
private void syncBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syncBtnActionPerformed
364-
sync();
366+
runFromClipboard();
365367
}//GEN-LAST:event_syncBtnActionPerformed
366368

367369
private void syncBtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syncBtn1ActionPerformed
368-
setSync();
370+
runToClipboard();
369371
}//GEN-LAST:event_syncBtn1ActionPerformed
370372

371373

372374
// Variables declaration - do not modify//GEN-BEGIN:variables
373375
private javax.swing.JScrollPane jScrollPane2;
374376
private javax.swing.JButton removeBtn;
377+
private javax.swing.JButton importBtn;
375378
private javax.swing.JButton syncBtn;
376379
private javax.swing.JButton syncBtn1;
377380
private javax.swing.JTable table;

0 commit comments

Comments
 (0)