Exemple #1
0
    public boolean stopCellEditing() {
      ConflictCell pc = (ConflictCell) graph.getEditingCell();
      Conflict conflict = (Conflict) pc.getUserObject();

      conflict.setTopic(topic.getText());
      conflict.setViewpoints(new String[] {vp1.getDescription(), vp2.getDescription()});
      return super.stopCellEditing();
    }
Exemple #2
0
    public RealCellEditor() {

      Box box = Box.createVerticalBox();

      box.add(Box.createVerticalStrut(10));

      // Add main title
      JLabel conflictLabel = new JLabel("Konflikt / debatt");
      conflictLabel.setAlignmentX(0);
      conflictLabel.setFont(conflictLabel.getFont().deriveFont((float) 15));
      JPanel labelPanel = new JPanel();
      labelPanel.add(conflictLabel);
      box.add(labelPanel);

      box.add(Box.createVerticalStrut(15));

      // Add help text
      JLabel helpLabel =
          new JLabel(
              "<html><center>Her kan du beskrive en konflikt<br> eller en debatt med ulike<br>synspunkter og argumenter.</center></html>");
      helpLabel.setFont(conflictLabel.getFont().deriveFont((float) 11));
      JPanel helpPanel = new JPanel();
      helpPanel.add(helpLabel);
      box.add(helpPanel);

      box.add(Box.createVerticalStrut(15));

      // Add topic with label
      JPanel tp = new JPanel();
      tp.setLayout(new FlowLayout(FlowLayout.CENTER));

      JPanel wrap = new JPanel();
      wrap.add(topic);
      tp.add(wrap);
      wrap.setBorder(BorderFactory.createTitledBorder("Sentralt spørsmål eller tema:"));

      box.add(tp);
      box.add(Box.createVerticalStrut(10));

      JPanel vps = new JPanel(new GridLayout(1, 2));

      // Add viewpoints
      vp1.setBorder(BorderFactory.createTitledBorder("Synspunkt:"));
      vp1.setTextBackground(new Color(208, 255, 217));

      vp2.setBorder(BorderFactory.createTitledBorder("Motstridende synspunkt:"));
      vp2.setTextBackground(new Color(255, 216, 207));
      vps.add(vp1);
      vps.add(vp2);

      box.add(Box.createVerticalStrut(5));
      box.add(vps);
      editorComponent.setLayout(new GridLayout(1, 1));
      editorComponent.add(box);
    }
Exemple #3
0
    public Component getGraphCellEditorComponent(JGraph graph, Object value, boolean isSelected) {

      ConflictCell cc = (ConflictCell) editingCell;
      Conflict c = (Conflict) cc.getUserObject();

      topic.setText(c.getTopic());

      vp1.setDescription(c.getViewpoints()[0]);
      vp2.setDescription(c.getViewpoints()[1]);

      return editorComponent;
    }