X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.slc.client.ui.dist%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fdist%2Fwizards%2FChooseRightsPage.java;fp=eclipse%2Fplugins%2Forg.argeo.slc.client.ui.dist%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fdist%2Fwizards%2FChooseRightsPage.java;h=0000000000000000000000000000000000000000;hb=651d33e13bfa9a7b46464be412023ee747e612e8;hp=251ea6126c3615ffdff8b0c8a37deb277dedc1a0;hpb=868102c0f0220e12eca836b6ec9b3a2b9a3441e4;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/wizards/ChooseRightsPage.java b/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/wizards/ChooseRightsPage.java deleted file mode 100644 index 251ea6126..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/wizards/ChooseRightsPage.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.argeo.slc.client.ui.dist.wizards; - -import java.util.regex.Pattern; - -import javax.jcr.security.Privilege; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ChooseRightsPage extends WizardPage implements ModifyListener { - - // This page widget - private Text groupNameTxt; - private Combo authorizationCmb; - - // Define acceptable chars for the technical name - private static Pattern p = Pattern.compile("^[A-Za-z0-9]+$"); - - // USABLE SHORTCUTS - protected final static String[] validAuthType = { Privilege.JCR_READ, - Privilege.JCR_WRITE, Privilege.JCR_ALL }; - - public ChooseRightsPage() { - super("Main"); - setTitle("Manange authorizations on the current workspace"); - } - - public void createControl(Composite parent) { - // specify subject - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(2, false)); - Label lbl = new Label(composite, SWT.LEAD); - lbl.setText("Group or user name (no blank, no special chars)"); - lbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - groupNameTxt = new Text(composite, SWT.LEAD | SWT.BORDER); - groupNameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false)); - if (groupNameTxt != null) - groupNameTxt.addModifyListener(this); - - // Choose rigths - new Label(composite, SWT.NONE).setText("Choose corresponding rights"); - authorizationCmb = new Combo(composite, SWT.BORDER | SWT.V_SCROLL); - authorizationCmb.setItems(validAuthType); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - authorizationCmb.setLayoutData(gd); - - authorizationCmb.select(0); - - // Compulsory - setControl(composite); - } - - protected String getGroupName() { - return groupNameTxt.getText(); - } - - protected String getAuthTypeStr() { - return authorizationCmb.getItem(authorizationCmb.getSelectionIndex()); - } - - private static boolean match(String s) { - return p.matcher(s).matches(); - } - - public void modifyText(ModifyEvent event) { - String message = checkComplete(); - if (message != null) - setMessage(message, WizardPage.ERROR); - else { - setMessage("Complete", WizardPage.INFORMATION); - setPageComplete(true); - } - } - - /** @return error message or null if complete */ - protected String checkComplete() { - String groupStr = groupNameTxt.getText(); - if (groupStr == null || "".equals(groupStr)) - return "Please enter the name of the corresponding group."; - // Remove regexp check for the time being. - // else if (!match(groupStr)) - // return - // "Please use only alphanumerical chars for the short technical name."; - return null; - } -}