Package org.jwall.web.policy

Examples of org.jwall.web.policy.Header


            return this;
        }


        if( arg1.getType() == TreeNode.HEADER_NODE ){
            Header p = (Header) arg1;

            StringBuffer s = new StringBuffer("<html>");
            if( p.isInherited() ){
                setInheritanceColors();
                s.append("<i>");
            }

            s.append( "Header: <b>"+p.getName()+"</b>");

            s.append(", Regexp: <b>" + p.getRegexp() + "</b>");

            if( p.isRequired() )
                s.append(", Required: <b>"+p.isRequired()+"</b>");

            setText( s.toString() );
            setIcon( WebPolicyEditor.getIcon(p) );

            if( p.isInherited() )
                s.append("</i>");

            s.append("</html>");
            return this;
        }

        if( arg1.getType() == TreeNode.COOKIE_NODE ){
            Cookie c = (Cookie) arg1;

            StringBuffer s = new StringBuffer("<html>Cookie: <b>" + c.getName() + "</b>");
            s.append(", Regexp: <b>" + c.getRegexp() + "</b>" );
            if( c.isRequired() )
                s.append(", Required: <b>" + c.isRequired() + "</b>");

            s.append("</html>");
            setText( s.toString() );
            setIcon( WebPolicyEditor.getIcon( c ) );
            return this;
        }

        if( arg1.getType() == TreeNode.PARAMETER_NODE ){
            Parameter p = (Parameter) arg1;

            StringBuffer s = new StringBuffer("<html>");

            if( p.isInherited() ){
                setInheritanceColors();
                s.append( "<i>" );
            }

            s.append("Parameter: <b>"+p.getName()+"</b>");

            if( p.getRegexp().startsWith("$") )
                s.append(", Type: <b>" + p.getRegexp() + "</b>");
            else
                s.append(", Regexp: <b>" + p.getRegexp() + "</b>");

            if( p.isRequired() )
                s.append(", Required: <b>"+p.isRequired()+"</b>");

            if( p.getScope() != null  )
                s.append(", Scope: <b>"+p.getScope()+"</b>");

            if( p.isInherited() ){
                s.append( "</i>" );
            }
            s.append("</html>");
            setText( s.toString() );
            setIcon( WebPolicyEditor.getIcon(p) );
View Full Code Here


      return c;
    }

    if (nodeType == TreeNode.HEADER_NODE) {
      Header h = (Header) node;
      h.setName(name.getText());
      h.setRegexp(value.getText());
      h.setRequired(required.isSelected());

      return h;
    }

    if (nodeType == TreeNode.LIMIT_NODE) {
View Full Code Here

      p.add(name);
    }

    if (node.getType() == TreeNode.HEADER_NODE) {

      Header param = (Header) node;
      JLabel l1 = new JLabel("Header: ");
      l1.setFont(f);
      l1.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(l1);

      String v = param.getName();
      name = new JTextField(v, v.length() + 2);
      name.addKeyListener(this);
      name.setFont(f);
      name.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(name);

      JLabel l2 = new JLabel("Regexp: ");
      l2.setFont(f);
      l2.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(l2);

      v = param.getRegexp();
      value = new JTextField(v, v.length() + 4);
      value.addKeyListener(this);
      value.setFont(f);
      value.setAlignmentY(Component.CENTER_ALIGNMENT);
      value.addFocusListener(this);
      p.add(value);

      required.setOpaque(true);
      required.setContentAreaFilled(false);
      required.addKeyListener(this);
      required.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(required);
      p.setFont(new Font("Monospaced", Font.PLAIN, 13));

    }

    if (node.getType() == TreeNode.COOKIE_NODE) {

      Cookie param = (Cookie) node;
      JLabel l1 = new JLabel("Cookie: ");
      l1.setFont(f);
      l1.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(l1);

      String v = param.getName();
      name = new JTextField(v, v.length() + 2);
      name.addKeyListener(this);
      name.setFont(f);
      name.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(name);

      JLabel l2 = new JLabel("Regexp: ");
      l2.setFont(f);
      l2.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(l2);

      v = param.getRegexp();
      value = new JTextField(v, v.length() + 4);
      value.addKeyListener(this);
      value.setFont(f);
      value.setAlignmentY(Component.CENTER_ALIGNMENT);
      value.addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent evt) {
          value.selectAll();
        }

        public void focusLost(FocusEvent ev) {
          hideSelectionDialog();
        }
      });
      p.add(value);

      required.setOpaque(true);
      required.setContentAreaFilled(false);
      required.addKeyListener(this);
      required.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(required);
      p.setFont(new Font("Monospaced", Font.PLAIN, 13));

    }

    if (node.getType() == TreeNode.PARAMETER_NODE) {

      scopes = new String[] { "any", "body", "header" };
      this.scope = new JComboBox(scopes);
      Parameter param = (Parameter) node;
      JLabel l1 = new JLabel("Parameter: ");
      l1.setFont(f);
      l1.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(l1);

      String v = param.getName();
      name = new JTextField(v, v.length() + 2);
      name.addKeyListener(this);
      name.setFont(f);
      name.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(name);

      JLabel l2 = new JLabel("Type: ");
      l2.setFont(f);
      l2.setAlignmentY(Component.CENTER_ALIGNMENT);
      p.add(l2);

      v = param.getRegexp();
      value = new JTextField(v, v.length() + 4);
      value.addKeyListener(this);
      value.addFocusListener(this);
      value.setFont(f);
      value.setAlignmentY(Component.CENTER_ALIGNMENT);
View Full Code Here

        jtree.startEditingAtPath(new TreePath(PolicyTreeModel
            .getPath(param)));
      }

      if (AbstractTreeAction.TREE_INSERT_HEADER == e.getActionCommand()) {
        Header header = new Header();
        header.setName("h1");
        header.setRegexp(".{0,255}");
        header.setRequired(false);
        node.add(header);
        rmodel.notify(node);

        jtree.startEditingAtPath(new TreePath(PolicyTreeModel
            .getPath(header)));
View Full Code Here

TOP

Related Classes of org.jwall.web.policy.Header

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.