|
AccessRightsDialog |
|
1 /* 2 * Copyright (c) 1998-2001, The University of Sheffield. 3 * 4 * This file is part of GATE (see http://gate.ac.uk/), and is free 5 * software, licenced under the GNU Library General Public License, 6 * Version 2, June 1991 (in the distribution as file licence.html, 7 * and also available at http://gate.ac.uk/gate/licence.html). 8 * 9 * Kalina Bontcheva 19/11/2001 10 * 11 * $Id: AccessRightsDialog.java,v 1.2 2002/03/13 14:29:26 marin Exp $ 12 * 13 */ 14 15 package gate.gui; 16 17 import javax.swing.*; 18 import javax.swing.event.*; 19 import java.awt.*; 20 import java.awt.event.*; 21 import gate.security.SecurityInfo; 22 import gate.util.Out; 23 24 public class AccessRightsDialog { 25 protected static JRadioButton gr_gw = new JRadioButton(); 26 protected static JRadioButton gr_ow = new JRadioButton(); 27 protected static JRadioButton or_ow = new JRadioButton(); 28 protected static JRadioButton wr_gw = new JRadioButton(); 29 protected static ButtonGroup group; 30 31 public static boolean showDialog(Component parentComponent){ 32 gr_gw.setText("Group read/group write"); 33 gr_ow.setText("Group read/owner write"); 34 or_ow.setText("Owner read/owner write"); 35 wr_gw.setText("All read/group write"); 36 37 JPanel panel1 = new JPanel(); 38 panel1.setLayout(new BoxLayout(panel1,BoxLayout.Y_AXIS)); 39 40 group = new ButtonGroup(); 41 group.add(gr_gw); 42 group.add(gr_ow); 43 group.add(or_ow); 44 group.add(wr_gw); 45 gr_gw.setSelected(true); 46 47 panel1.add(wr_gw); 48 panel1.add(Box.createHorizontalStrut(30)); 49 panel1.add(gr_gw); 50 panel1.add(Box.createHorizontalStrut(30)); 51 panel1.add(gr_ow); 52 panel1.add(Box.createHorizontalStrut(30)); 53 panel1.add(or_ow); 54 panel1.add(Box.createHorizontalStrut(30)); 55 56 return 57 OkCancelDialog.showDialog(parentComponent, 58 panel1, 59 "Choose access mode"); 60 61 } 62 63 public static int getSelectedMode() { 64 if(gr_gw.isSelected()) 65 return SecurityInfo.ACCESS_GR_GW; 66 else if(gr_ow.isSelected()) 67 return SecurityInfo.ACCESS_GR_OW; 68 else if(or_ow.isSelected()) 69 return SecurityInfo.ACCESS_OR_OW; 70 else if(wr_gw.isSelected()) 71 return SecurityInfo.ACCESS_WR_GW; 72 73 return -1; 74 } 75 76 }
|
AccessRightsDialog |
|