Skip to content

Commit

Permalink
#7 add delete button for circles
Browse files Browse the repository at this point in the history
  • Loading branch information
raycarter committed Apr 20, 2017
1 parent 34a0d0b commit eedec8c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
28 changes: 25 additions & 3 deletions src/main/java/gui/configdialog/elements/CDialogCircle.java
Expand Up @@ -64,6 +64,9 @@ public class CDialogCircle extends ConfigDialogElement

// add the circles to canvas
private JButton addToChartButton;

// delete the circles from canvas
private JButton deleteFromChartButton;

private JComboBox cb;

Expand Down Expand Up @@ -94,6 +97,8 @@ public void buildPanel()
Messages.getString("EditIndividualAttributeTypeDialog.19")); //$NON-NLS-1$
addToChartButton = new JButton(
Messages.getString("ConfigDialog.50"));
deleteFromChartButton = new JButton(
Messages.getString("ConfigDialog.51"));
if (circleAttrib == null)
circleAttrib = net.getHintergrund().getCircleAttribute();

Expand Down Expand Up @@ -173,6 +178,13 @@ public void actionPerformed(ActionEvent e) {
getFinalSetting().set();
}
});
deleteFromChartButton.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {
((SettingCircle)getFinalSetting()).delete();
}
});

JLabel attLabel = new JLabel(
Messages.getString("CDialogActorPie.Col0"));
Expand Down Expand Up @@ -238,19 +250,29 @@ public void actionPerformed(ActionEvent e) {
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 4;
gbc.gridy = 0;
gbc.weightx = 0.2;
gbc.weightx = 0.1;
gbc.gridwidth = 1;
gbc.insets = new Insets(10, 0, 0, 5);
layout.setConstraints(addToChartButton, gbc);
dialogPanel.add(addToChartButton);

gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 5;
gbc.gridy = 0;
gbc.weightx = 0.1;
gbc.gridwidth = 1;
gbc.insets = new Insets(10, 0, 0, 5);
layout.setConstraints(deleteFromChartButton, gbc);
dialogPanel.add(deleteFromChartButton);

/* Previewwindow to display current circles */
gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 5;
gbc.gridwidth = 6;
gbc.weightx = 5.0;
gbc.weighty = 5.0;
gbc.insets = new Insets(10, 10, 10, 10);
Expand All @@ -263,7 +285,7 @@ public void actionPerformed(ActionEvent e) {
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 5;
gbc.gridwidth = 6;
gbc.weightx = 5.0;
gbc.weighty = 2.5;
gbc.insets = new Insets(10, 10, 10, 10);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gui/configdialog/elements/CDialogSector.java
Expand Up @@ -242,7 +242,7 @@ public void actionPerformed(ActionEvent e)
@Override
public void actionPerformed(ActionEvent e)
{
getFinalSetting().delete();
((SettingSector)getFinalSetting()).delete();
}
});

Expand Down
Expand Up @@ -13,5 +13,4 @@
public interface ConfigDialogSetting
{
public void set();
public void delete();
}
18 changes: 18 additions & 0 deletions src/main/java/gui/configdialog/settings/SettingCircle.java
Expand Up @@ -74,4 +74,22 @@ public void set()
// }
// }
}

/**
* delete circles from map
*
*/
public void delete()
{
BackgroundInfo bgConfig = net.getHintergrund();
bgConfig.setNumCircles(0);
// bgConfig.setCirclesLabel(label);
VennMakerView v = VennMaker.getInstance().getViewOfNetwork(net);
if(v != null)
{
v.updateView();
v.updateSectorAndCircleAttributes();
}
bgConfig.setCircleAttribute(circleAttr);
}
}
1 change: 0 additions & 1 deletion src/main/java/gui/configdialog/settings/SettingSector.java
Expand Up @@ -73,7 +73,6 @@ public void set()
* delete sectors from map
*
*/
@Override
public void delete()
{
net.getHintergrund().setNumSectors(0);
Expand Down

0 comments on commit eedec8c

Please sign in to comment.