Changeset 5718 for trunk


Ignore:
Timestamp:
2003-10-23T11:00:44+13:00 (21 years ago)
Author:
jmt12
Message:

Added the ability to designate a dialog as editable or read-only. This allows the 'expanding' of extracted metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/EditorDialog.java

    r5564 r5718  
    5252    extends ModalDialog
    5353    implements ActionListener {
    54     /** The cancel, and I don't want the text I've typed, button. */
     54   /** Is this dialog editable? */
     55   private boolean editable = true;
     56   /** The cancel, and I don't want the text I've typed, button. */
    5557    private JButton cancel = null;
    5658    /** The ok, I'll save what I've just typed in, button. */
     
    9193    text = new JTextArea(value);
    9294    text.setCaretPosition(value.length());
    93     text.setEditable(true);
     95    text.setEditable(editable);
    9496    text.setLineWrap(true);
    95     text.setWrapStyleWord(true);
     97    text.setWrapStyleWord(false);
    9698    Dictionary.setTooltip(text, "MetaEdit.Value_Field_Tooltip");
    9799
     
    100102    Dictionary.setBoth(cancel, "General.Cancel", "General.Pure_Cancel_Tooltip");
    101103    ok = new JButton();
    102     ok.setMnemonic(KeyEvent.VK_0);
     104    ok.setMnemonic(KeyEvent.VK_O);
    103105    Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip");
    104106
     
    110112    JPanel button_pane = new JPanel();
    111113    button_pane.setLayout(new GridLayout(1,2));
    112     button_pane.add(ok);
    113     button_pane.add(cancel);
     114    if(editable) {
     115       button_pane.add(ok);
     116       button_pane.add(cancel);
     117    }
     118    else {
     119       button_pane.add(new JPanel());
     120       button_pane.add(ok);
     121    }
    114122         
    115123    JPanel content_pane = (JPanel) getContentPane();
     
    123131    return result;
    124132    }
     133
     134   /** Specify if this text dialog should be editable or readonly
     135    * @param editable true to allow editing, false otherwise
     136    */
     137   public void setEditable(boolean editable) {
     138      if(text == null) {
     139     this.editable = editable;
     140      }
     141      else {
     142     text.setEditable(editable);
     143      }
     144   }
    125145}
Note: See TracChangeset for help on using the changeset viewer.