1.1 --- a/encoder.coco.ui/build.xml Sat Sep 27 15:34:52 2008 -0700
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,8 +0,0 @@
1.4 -<?xml version="1.0" encoding="UTF-8"?>
1.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
1.6 -<!-- for some information on what you could do (e.g. targets to override). -->
1.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
1.8 -<project name="org.netbeans.modules.encoder.coco.ui" default="netbeans" basedir=".">
1.9 - <description>Builds, tests, and runs the project org.netbeans.modules.encoder.coco.ui.</description>
1.10 - <import file="../../nbbuild/templates/projectized.xml"/>
1.11 -</project>
2.1 --- a/encoder.coco.ui/manifest.mf Sat Sep 27 15:34:52 2008 -0700
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,6 +0,0 @@
2.4 -Manifest-Version: 1.0
2.5 -OpenIDE-Module: org.netbeans.modules.encoder.coco.ui
2.6 -OpenIDE-Module-Layer: org/netbeans/modules/encoder/coco/ui/layer.xml
2.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/encoder/coco/ui/Bundle.properties
2.8 -OpenIDE-Module-Install: org/netbeans/modules/encoder/coco/ui/CocoModuleInstaller.class
2.9 -OpenIDE-Module-Specification-Version: 1.0
3.1 --- a/encoder.coco.ui/nbproject/project.properties Sat Sep 27 15:34:52 2008 -0700
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,3 +0,0 @@
3.4 -javac.compilerargs=-Xlint:unchecked
3.5 -javac.source=1.5
3.6 -nbm.homepage=http://wiki.open-esb.java.net/jbiwiki/Wiki.jsp?page=COCO
4.1 --- a/encoder.coco.ui/nbproject/project.xml Sat Sep 27 15:34:52 2008 -0700
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,180 +0,0 @@
4.4 -<?xml version="1.0" encoding="UTF-8"?>
4.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
4.6 - <type>org.netbeans.modules.apisupport.project</type>
4.7 - <configuration>
4.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
4.9 - <code-name-base>org.netbeans.modules.encoder.coco.ui</code-name-base>
4.10 - <module-dependencies>
4.11 - <dependency>
4.12 - <code-name-base>com.sun.encoder</code-name-base>
4.13 - <build-prerequisite/>
4.14 - <compile-dependency/>
4.15 - <run-dependency>
4.16 - <specification-version>1.0.2</specification-version>
4.17 - </run-dependency>
4.18 - </dependency>
4.19 - <dependency>
4.20 - <code-name-base>com.sun.encoder.coco</code-name-base>
4.21 - <build-prerequisite/>
4.22 - <compile-dependency/>
4.23 - <run-dependency>
4.24 - <specification-version>1.0</specification-version>
4.25 - </run-dependency>
4.26 - </dependency>
4.27 - <dependency>
4.28 - <code-name-base>org.netbeans.soa.libs.xmlbeans</code-name-base>
4.29 - <build-prerequisite/>
4.30 - <compile-dependency/>
4.31 - <run-dependency>
4.32 - <release-version>1</release-version>
4.33 - <specification-version>1.0</specification-version>
4.34 - </run-dependency>
4.35 - </dependency>
4.36 - <dependency>
4.37 - <code-name-base>org.jdesktop.layout</code-name-base>
4.38 - <build-prerequisite/>
4.39 - <compile-dependency/>
4.40 - <run-dependency>
4.41 - <release-version>1</release-version>
4.42 - <specification-version>1.4</specification-version>
4.43 - </run-dependency>
4.44 - </dependency>
4.45 - <dependency>
4.46 - <code-name-base>org.netbeans.api.progress</code-name-base>
4.47 - <build-prerequisite/>
4.48 - <compile-dependency/>
4.49 - <run-dependency>
4.50 - <release-version>1</release-version>
4.51 - <specification-version>1.5.22</specification-version>
4.52 - </run-dependency>
4.53 - </dependency>
4.54 - <dependency>
4.55 - <code-name-base>org.netbeans.modules.encoder.ui.basic</code-name-base>
4.56 - <build-prerequisite/>
4.57 - <compile-dependency/>
4.58 - <run-dependency>
4.59 - <specification-version>1.0</specification-version>
4.60 - </run-dependency>
4.61 - </dependency>
4.62 - <dependency>
4.63 - <code-name-base>org.netbeans.modules.projectapi</code-name-base>
4.64 - <build-prerequisite/>
4.65 - <compile-dependency/>
4.66 - <run-dependency>
4.67 - <release-version>1</release-version>
4.68 - <specification-version>1.13</specification-version>
4.69 - </run-dependency>
4.70 - </dependency>
4.71 - <dependency>
4.72 - <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
4.73 - <build-prerequisite/>
4.74 - <compile-dependency/>
4.75 - <run-dependency>
4.76 - <release-version>1</release-version>
4.77 - <specification-version>1.24</specification-version>
4.78 - </run-dependency>
4.79 - </dependency>
4.80 - <dependency>
4.81 - <code-name-base>org.netbeans.modules.xml.schema.model</code-name-base>
4.82 - <build-prerequisite/>
4.83 - <compile-dependency/>
4.84 - <run-dependency>
4.85 - <release-version>1</release-version>
4.86 - <specification-version>1.1.22</specification-version>
4.87 - </run-dependency>
4.88 - </dependency>
4.89 - <dependency>
4.90 - <code-name-base>org.netbeans.modules.xml.schema.ui.basic</code-name-base>
4.91 - <build-prerequisite/>
4.92 - <compile-dependency/>
4.93 - <run-dependency>
4.94 - <release-version>1</release-version>
4.95 - <specification-version>1.2</specification-version>
4.96 - </run-dependency>
4.97 - </dependency>
4.98 - <dependency>
4.99 - <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
4.100 - <build-prerequisite/>
4.101 - <compile-dependency/>
4.102 - <run-dependency>
4.103 - <release-version>1</release-version>
4.104 - <specification-version>1.1.22</specification-version>
4.105 - </run-dependency>
4.106 - </dependency>
4.107 - <dependency>
4.108 - <code-name-base>org.openide.awt</code-name-base>
4.109 - <build-prerequisite/>
4.110 - <compile-dependency/>
4.111 - <run-dependency>
4.112 - <specification-version>6.11</specification-version>
4.113 - </run-dependency>
4.114 - </dependency>
4.115 - <dependency>
4.116 - <code-name-base>org.openide.dialogs</code-name-base>
4.117 - <build-prerequisite/>
4.118 - <compile-dependency/>
4.119 - <run-dependency>
4.120 - <specification-version>6.5.22</specification-version>
4.121 - </run-dependency>
4.122 - </dependency>
4.123 - <dependency>
4.124 - <code-name-base>org.openide.filesystems</code-name-base>
4.125 - <build-prerequisite/>
4.126 - <compile-dependency/>
4.127 - <run-dependency>
4.128 - <specification-version>6.4.22</specification-version>
4.129 - </run-dependency>
4.130 - </dependency>
4.131 - <dependency>
4.132 - <code-name-base>org.openide.io</code-name-base>
4.133 - <build-prerequisite/>
4.134 - <compile-dependency/>
4.135 - <run-dependency>
4.136 - <specification-version>1.9.22</specification-version>
4.137 - </run-dependency>
4.138 - </dependency>
4.139 - <dependency>
4.140 - <code-name-base>org.openide.loaders</code-name-base>
4.141 - <build-prerequisite/>
4.142 - <compile-dependency/>
4.143 - <run-dependency>
4.144 - <specification-version>5.9.22</specification-version>
4.145 - </run-dependency>
4.146 - </dependency>
4.147 - <dependency>
4.148 - <code-name-base>org.openide.modules</code-name-base>
4.149 - <build-prerequisite/>
4.150 - <compile-dependency/>
4.151 - <run-dependency>
4.152 - <specification-version>6.5.22</specification-version>
4.153 - </run-dependency>
4.154 - </dependency>
4.155 - <dependency>
4.156 - <code-name-base>org.openide.nodes</code-name-base>
4.157 - <build-prerequisite/>
4.158 - <compile-dependency/>
4.159 - <run-dependency>
4.160 - <specification-version>6.7.22</specification-version>
4.161 - </run-dependency>
4.162 - </dependency>
4.163 - <dependency>
4.164 - <code-name-base>org.openide.util</code-name-base>
4.165 - <build-prerequisite/>
4.166 - <compile-dependency/>
4.167 - <run-dependency>
4.168 - <specification-version>6.8.22</specification-version>
4.169 - </run-dependency>
4.170 - </dependency>
4.171 - <dependency>
4.172 - <code-name-base>org.openide.windows</code-name-base>
4.173 - <build-prerequisite/>
4.174 - <compile-dependency/>
4.175 - <run-dependency>
4.176 - <specification-version>6.5.22</specification-version>
4.177 - </run-dependency>
4.178 - </dependency>
4.179 - </module-dependencies>
4.180 - <public-packages/>
4.181 - </data>
4.182 - </configuration>
4.183 -</project>
5.1 --- a/encoder.coco.ui/src/META-INF/services/org.netbeans.modules.xml.schema.ui.basic.spi.AppInfoProvider Sat Sep 27 15:34:52 2008 -0700
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,1 +0,0 @@
5.4 -org.netbeans.modules.encoder.coco.ui.CocoEncoderAppInfoProvider
6.1 --- a/encoder.coco.ui/src/META-INF/services/org.netbeans.modules.xml.xam.spi.Validator Sat Sep 27 15:34:52 2008 -0700
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,1 +0,0 @@
6.4 -org.netbeans.modules.encoder.coco.ui.validation.ValidationProvider
7.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,4 +0,0 @@
7.4 -OpenIDE-Module-Display-Category=ESB
7.5 -OpenIDE-Module-Long-Description=\
7.6 - An implementation of XSD editor's AppInfoProvider SPI, which plugs COBOL Copybook encoder GUI extension into XSD editor
7.7 -OpenIDE-Module-Name=Encoder Editor - COCO
8.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/CocoEncoderAppInfoProvider.java Sat Sep 27 15:34:52 2008 -0700
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,43 +0,0 @@
8.4 -/*
8.5 - * The contents of this file are subject to the terms of the Common Development
8.6 - * and Distribution License (the License). You may not use this file except in
8.7 - * compliance with the License.
8.8 - *
8.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
8.10 - * or http://www.netbeans.org/cddl.txt.
8.11 -
8.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
8.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
8.14 - * If applicable, add the following below the CDDL Header, with the fields
8.15 - * enclosed by brackets [] replaced by your own identifying information:
8.16 - * "Portions Copyrighted [year] [name of copyright owner]"
8.17 - *
8.18 - * The Original Software is NetBeans. The Initial Developer of the Original
8.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
8.20 - * Microsystems, Inc. All Rights Reserved.
8.21 - */
8.22 -
8.23 -package org.netbeans.modules.encoder.coco.ui;
8.24 -
8.25 -import java.util.List;
8.26 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
8.27 -import org.netbeans.modules.xml.schema.model.SchemaModel;
8.28 -import org.netbeans.modules.xml.schema.ui.basic.spi.AppInfoProvider;
8.29 -import org.openide.nodes.Node;
8.30 -
8.31 -/**
8.32 - * <appinfo> provider that implements the COBOL Copybook encoder plug-in over
8.33 - * the XSD editor.
8.34 - *
8.35 - * @author Jun Xu
8.36 - */
8.37 -public class CocoEncoderAppInfoProvider extends AppInfoProvider {
8.38 -
8.39 - public boolean isActive(SchemaModel schemaModel) {
8.40 - return ModelUtils.isEncodedWith(schemaModel, CocoEncodingConst.STYLE);
8.41 - }
8.42 -
8.43 - public Node getNode(List<Node> nodes) {
8.44 - return null;
8.45 - }
8.46 -}
9.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/CocoEncodingConst.java Sat Sep 27 15:34:52 2008 -0700
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,34 +0,0 @@
9.4 -/*
9.5 - * The contents of this file are subject to the terms of the Common Development
9.6 - * and Distribution License (the License). You may not use this file except in
9.7 - * compliance with the License.
9.8 - *
9.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
9.10 - * or http://www.netbeans.org/cddl.txt.
9.11 -
9.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
9.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
9.14 - * If applicable, add the following below the CDDL Header, with the fields
9.15 - * enclosed by brackets [] replaced by your own identifying information:
9.16 - * "Portions Copyrighted [year] [name of copyright owner]"
9.17 - *
9.18 - * The Original Software is NetBeans. The Initial Developer of the Original
9.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
9.20 - * Microsystems, Inc. All Rights Reserved.
9.21 - */
9.22 -
9.23 -package org.netbeans.modules.encoder.coco.ui;
9.24 -
9.25 -/**
9.26 - * Class for holding COBOL Copybook encoding related constants.
9.27 - *
9.28 - * @author Jun Xu
9.29 - */
9.30 -public abstract class CocoEncodingConst {
9.31 -
9.32 - public static final String STYLE = "cocoencoder-1.0"; //NOI18N
9.33 -
9.34 - public static final String URI = "urn:com.sun:encoder-coco-1.0"; //NOI18N
9.35 -
9.36 - public static final String NAME = "COBOL Copybook Encoding"; //NOI18N
9.37 -}
10.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/CocoModuleInstaller.java Sat Sep 27 15:34:52 2008 -0700
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,138 +0,0 @@
10.4 -/*
10.5 - * HL7AIPModuleInstaller.java
10.6 - *
10.7 - * Created on February 1, 2007, 5:17 PM
10.8 - *
10.9 - * To change this template, choose Tools | Template Manager
10.10 - * and open the template in the editor.
10.11 - */
10.12 -
10.13 -package org.netbeans.modules.encoder.coco.ui;
10.14 -
10.15 -import java.beans.PropertyChangeEvent;
10.16 -import java.beans.PropertyChangeListener;
10.17 -import java.util.List;
10.18 -import javax.swing.SwingUtilities;
10.19 -import javax.xml.XMLConstants;
10.20 -import javax.xml.namespace.QName;
10.21 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
10.22 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
10.23 -import org.netbeans.modules.xml.schema.model.Annotation;
10.24 -import org.netbeans.modules.xml.schema.model.AppInfo;
10.25 -import org.netbeans.modules.xml.schema.model.Element;
10.26 -import org.netbeans.modules.xml.schema.model.ElementReference;
10.27 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
10.28 -import org.netbeans.modules.xml.schema.model.SchemaModel;
10.29 -import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
10.30 -import org.openide.modules.ModuleInstall;
10.31 -import org.openide.util.WeakListeners;
10.32 -
10.33 -/**
10.34 - * The ModuleInstall implementation of this module.
10.35 - *
10.36 - * @author Jun Xu
10.37 - */
10.38 -public class CocoModuleInstaller extends ModuleInstall {
10.39 -
10.40 - private static final SMFPropertyChangeListener mSMFPropertyChangeListener =
10.41 - new SMFPropertyChangeListener();
10.42 -
10.43 - public void restored() {
10.44 - super.restored();
10.45 - SchemaModelFactory.getDefault().addPropertyChangeListener(
10.46 - WeakListeners.propertyChange(mSMFPropertyChangeListener,
10.47 - SchemaModelFactory.getDefault()));
10.48 - }
10.49 -
10.50 - private static class SMFPropertyChangeListener implements PropertyChangeListener {
10.51 -
10.52 - private static final SchemaModelPropListener mModelPropListener =
10.53 - new SchemaModelPropListener();
10.54 -
10.55 - public void propertyChange(PropertyChangeEvent evt) {
10.56 - if (SchemaModelFactory.MODEL_LOADED_PROPERTY.equals(evt.getPropertyName())
10.57 - && (evt.getNewValue() instanceof SchemaModel)) {
10.58 - SchemaModel model = (SchemaModel) evt.getNewValue();
10.59 - model.addPropertyChangeListener(WeakListeners.propertyChange(
10.60 - mModelPropListener,
10.61 - model));
10.62 - }
10.63 - }
10.64 -
10.65 - }
10.66 -
10.67 - private static class SchemaModelPropListener implements PropertyChangeListener {
10.68 -
10.69 - private static final QName TYPE_ATTR_NAME = new QName("type"); //NOI18N
10.70 -
10.71 - public void propertyChange(PropertyChangeEvent evt) {
10.72 - if (evt.getOldValue() != null || !(evt.getNewValue() instanceof Element)
10.73 - || (evt.getNewValue() instanceof ElementReference)
10.74 - || !("content".equals(evt.getPropertyName()) //NOI18N
10.75 - || "elements".equals(evt.getPropertyName()))) { //NOI18N
10.76 - return;
10.77 - }
10.78 - final Element elem = (Element) evt.getNewValue();
10.79 - List<SchemaComponent> children;
10.80 - String tv;
10.81 - if (elem == null || elem.getModel().inSync()
10.82 - || !ModelUtils.isEncodedWith(elem.getModel(), CocoEncodingConst.STYLE)) {
10.83 - return;
10.84 - }
10.85 - boolean setTypeToString = true;
10.86 - if (((children = elem.getChildren()) != null && !children.isEmpty())
10.87 - || ((tv = elem.getAnyAttribute(TYPE_ATTR_NAME)) != null && tv.length() > 0)) {
10.88 - setTypeToString = false;
10.89 - }
10.90 - final boolean setTypeToStringFinal = setTypeToString;
10.91 - SwingUtilities.invokeLater(new Runnable() {
10.92 - public void run() {
10.93 - SchemaModel model = elem.getModel();
10.94 - if (model.inSync()) {
10.95 - return;
10.96 - }
10.97 -
10.98 - boolean startedTrans = false;
10.99 - try {
10.100 - if (!model.isIntransaction()) {
10.101 - if (!model.startTransaction()) {
10.102 - //TODO: how to handle
10.103 - }
10.104 - startedTrans = true;
10.105 - }
10.106 - processElementDefault(elem, setTypeToStringFinal);
10.107 - } finally {
10.108 - if (startedTrans) {
10.109 - model.endTransaction();
10.110 - }
10.111 - }
10.112 - }
10.113 - });
10.114 - }
10.115 -
10.116 - private void processElementDefault(Element elem, boolean setTypeToString) {
10.117 - if (setTypeToString) {
10.118 - org.w3c.dom.Element domElem = elem.getPeer();
10.119 - if (domElem != null) {
10.120 - String prefix = domElem.lookupPrefix(XMLConstants.W3C_XML_SCHEMA_NS_URI);
10.121 - String value;
10.122 - if (prefix != null && prefix.length() > 0) {
10.123 - value = prefix + ":string"; //NOI18N
10.124 - } else {
10.125 - value = "string"; //NOI18N
10.126 - }
10.127 - elem.setAnyAttribute(TYPE_ATTR_NAME, value);
10.128 - }
10.129 - }
10.130 - Annotation anno = elem.getAnnotation();
10.131 - if (anno != null) {
10.132 - return;
10.133 - }
10.134 - anno = elem.getModel().getFactory().createAnnotation();
10.135 - elem.setAnnotation(anno);
10.136 - AppInfo appInfo = elem.getModel().getFactory().createAppInfo();
10.137 - appInfo.setURI(EncodingConst.URI);
10.138 - anno.addAppInfo(appInfo);
10.139 - }
10.140 - }
10.141 -}
11.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/action/ApplyCocoEncodingAction.java Sat Sep 27 15:34:52 2008 -0700
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,312 +0,0 @@
11.4 -/*
11.5 - * The contents of this file are subject to the terms of the Common Development
11.6 - * and Distribution License (the License). You may not use this file except in
11.7 - * compliance with the License.
11.8 - *
11.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
11.10 - * or http://www.netbeans.org/cddl.txt.
11.11 -
11.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
11.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
11.14 - * If applicable, add the following below the CDDL Header, with the fields
11.15 - * enclosed by brackets [] replaced by your own identifying information:
11.16 - * "Portions Copyrighted [year] [name of copyright owner]"
11.17 - *
11.18 - * The Original Software is NetBeans. The Initial Developer of the Original
11.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11.20 - * Microsystems, Inc. All Rights Reserved.
11.21 - */
11.22 -
11.23 -package org.netbeans.modules.encoder.coco.ui.action;
11.24 -
11.25 -import java.awt.Dialog;
11.26 -import java.awt.event.ActionEvent;
11.27 -import java.awt.event.ActionListener;
11.28 -import java.io.IOException;
11.29 -import java.util.ResourceBundle;
11.30 -import javax.swing.JOptionPane;
11.31 -import javax.swing.text.Document;
11.32 -import org.netbeans.modules.encoder.coco.ui.CocoEncodingConst;
11.33 -import org.netbeans.modules.encoder.ui.basic.ApplyEncodingConfirmation;
11.34 -import org.netbeans.modules.encoder.ui.basic.ApplyEncodingException;
11.35 -import org.netbeans.modules.encoder.ui.basic.EncodingMark;
11.36 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
11.37 -import org.netbeans.modules.encoder.ui.basic.ModelVisitor;
11.38 -import org.netbeans.modules.encoder.ui.basic.ModelVisitorException;
11.39 -import org.netbeans.modules.encoder.ui.basic.ProgressDialog;
11.40 -import org.netbeans.modules.encoder.ui.basic.Utils;
11.41 -import org.netbeans.modules.xml.schema.model.SchemaModel;
11.42 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
11.43 -import org.openide.DialogDescriptor;
11.44 -import org.openide.DialogDisplayer;
11.45 -import org.openide.ErrorManager;
11.46 -import org.openide.filesystems.FileObject;
11.47 -import org.openide.loaders.DataObject;
11.48 -import org.openide.nodes.Node;
11.49 -import org.openide.util.HelpCtx;
11.50 -import org.openide.util.NbBundle;
11.51 -import org.openide.util.Utilities;
11.52 -import org.openide.util.actions.NodeAction;
11.53 -import org.openide.windows.InputOutput;
11.54 -import org.openide.windows.OutputWriter;
11.55 -import org.openide.windows.WindowManager;
11.56 -
11.57 -/**
11.58 - * Action that applies the COBOL Copybook encoding to an XSD.
11.59 - *
11.60 - * @author Jun Xu
11.61 - */
11.62 -public class ApplyCocoEncodingAction extends NodeAction {
11.63 -
11.64 - private static final ResourceBundle _bundle =
11.65 - ResourceBundle.getBundle("org/netbeans/modules/encoder/coco/ui/action/Bundle");
11.66 - private static final String PROCESS = _bundle.getString("apply_coco_enc.lbl.process");
11.67 - private static final String CANCEL = _bundle.getString("apply_coco_enc.lbl.cancel");
11.68 -
11.69 - private boolean mIsApplied = false;
11.70 -
11.71 - public static void applyCocoEncoding(final SchemaModel model,
11.72 - final boolean applyToReferenced) throws IOException, CatalogModelException {
11.73 -
11.74 - InputOutput io = Utils.getEncodingIO();
11.75 - io.select();
11.76 - final OutputWriter console = io.getOut();
11.77 - console.println(_bundle.getString("apply_coco_enc.msg.start_apply_coco_encoding"));
11.78 -
11.79 - ModelUtils.ModelStatus modelStatus =
11.80 - ModelUtils.getModelStatus(model, applyToReferenced);
11.81 -
11.82 - if (modelStatus.getTotalCharSize() > 300 * 1024) {
11.83 - int estimate = (int) ((modelStatus.getTotalCharSize() / 18000.0 / 60.0) + 0.5);
11.84 - String msg = NbBundle.getMessage(ApplyCocoEncodingAction.class,
11.85 - "apply_coco_enc.lbl.warn_big_file", estimate); //NOI18N
11.86 - int option =
11.87 - JOptionPane.showConfirmDialog(
11.88 - WindowManager.getDefault().getMainWindow(),
11.89 - msg,
11.90 - _bundle.getString("apply_coco_enc.lbl.notify_lengthy_process"),
11.91 - JOptionPane.YES_NO_OPTION);
11.92 - if (option == JOptionPane.NO_OPTION) {
11.93 - console.println(_bundle.getString("apply_coco_enc.msg.cancelled_by_user"));
11.94 - return;
11.95 - }
11.96 -
11.97 - final ProgressDialog progDialog =
11.98 - ProgressDialog.newInstance(_bundle.getString("apply_coco_enc.lbl.applying_coco_encoding"));
11.99 - new Thread(new Runnable() {
11.100 - public void run() {
11.101 -
11.102 - progDialog.getHandle().start();
11.103 - progDialog.getHandle().switchToIndeterminate();
11.104 - final ModelVisitor visitor = new ApplyCocoEncodingSync();
11.105 - try {
11.106 - ModelUtils.visitModel(model, visitor, applyToReferenced);
11.107 - } catch (CatalogModelException ex) {
11.108 - throw new RuntimeException(ex);
11.109 - } finally {
11.110 - progDialog.getHandle().finish();
11.111 - progDialog.getDialog().setVisible(false);
11.112 - }
11.113 - console.println(_bundle.getString("apply_coco_enc.msg.finished_apply_coco_encoding"));
11.114 - }
11.115 - }).start();
11.116 - progDialog.getDialog().setVisible(true);
11.117 - } else {
11.118 - ModelVisitor visitor = new ApplyCocoEncodingSync();
11.119 - ModelUtils.visitModel(model, visitor, applyToReferenced);
11.120 - console.println(_bundle.getString("apply_coco_enc.msg.finished_apply_coco_encoding"));
11.121 - }
11.122 - }
11.123 -
11.124 - protected void performAction(Node[] node) {
11.125 - try {
11.126 - Utils.getEncodingIO().getOut().reset();
11.127 - } catch (IOException ex) {
11.128 - //Ignore
11.129 - }
11.130 - showDialog(node);
11.131 - }
11.132 -
11.133 - private void showDialog(final Node[] node) {
11.134 - final ApplyEncodingConfirmation confirmPane = new ApplyEncodingConfirmation();
11.135 - confirmPane.setApplyToReferenced(true);
11.136 - DialogDescriptor dialogDescriptor =
11.137 - new DialogDescriptor(confirmPane,
11.138 - _bundle.getString("apply_coco_enc.lbl.apply_coco_encoding_title"),
11.139 - true,
11.140 - new Object[] {PROCESS, CANCEL},
11.141 - PROCESS,
11.142 - DialogDescriptor.BOTTOM_ALIGN,
11.143 - HelpCtx.DEFAULT_HELP,
11.144 - this);
11.145 - dialogDescriptor.setClosingOptions(new Object[] {PROCESS, CANCEL});
11.146 - dialogDescriptor.setButtonListener(new ActionListener() {
11.147 - public void actionPerformed(ActionEvent e) {
11.148 - String action = e.getActionCommand();
11.149 - if (action.equals(PROCESS)) {
11.150 - try {
11.151 - confirmPane.setCursor(Utilities.createProgressCursor(confirmPane));
11.152 - process(node, confirmPane.isApplyToReferenced());
11.153 - } finally {
11.154 - confirmPane.setCursor(null);
11.155 - }
11.156 - }
11.157 - }
11.158 - });
11.159 - Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
11.160 - dialog.setModal(true);
11.161 - dialog.setVisible(true);
11.162 - }
11.163 -
11.164 - private void process(final Node[] node, boolean applyToReferenced) {
11.165 - SchemaModel model = null;
11.166 - for (int nodeIndex = 0; nodeIndex < node.length; nodeIndex++) {
11.167 - try {
11.168 - model = ModelUtils.getSchemaModelFromNode(node[nodeIndex]);
11.169 - if (model == null) {
11.170 - continue;
11.171 - }
11.172 - applyCocoEncoding(model, applyToReferenced);
11.173 - } catch (IOException ex) {
11.174 - ErrorManager.getDefault().notify(ex);
11.175 - } catch (ApplyEncodingException ex) {
11.176 - ErrorManager.getDefault().notify(ex);
11.177 - } catch (CatalogModelException ex) {
11.178 - ErrorManager.getDefault().notify(ex);
11.179 - }
11.180 - }
11.181 - }
11.182 -
11.183 - public String getName() {
11.184 - if (mIsApplied) {
11.185 - return _bundle.getString("apply_coco_enc.lbl.reapply_coco_encoding");
11.186 - }
11.187 - return _bundle.getString("apply_coco_enc.lbl.apply_coco_encoding_menu");
11.188 - }
11.189 -
11.190 - public HelpCtx getHelpCtx() {
11.191 - return HelpCtx.DEFAULT_HELP;
11.192 - }
11.193 -
11.194 - protected boolean asynchronous() {
11.195 - return false;
11.196 - }
11.197 -
11.198 - protected boolean enable(Node[] node) {
11.199 - //Check if it is writable
11.200 - if (node == null || node.length == 0) {
11.201 - return false;
11.202 - }
11.203 - SchemaModel sm = null;
11.204 - try {
11.205 - sm = ModelUtils.getSchemaModelFromNode(node[0]);
11.206 - } catch (IOException ex) {
11.207 - ErrorManager.getDefault().log(ErrorManager.EXCEPTION,
11.208 - ex.toString());
11.209 - return false;
11.210 - }
11.211 - boolean writable = ModelUtils.isModelWritable(sm);
11.212 - if (!writable) {
11.213 - return false;
11.214 - }
11.215 - EncodingMark existingMark = ModelUtils.getEncodingMark(sm);
11.216 - if (existingMark != null) {
11.217 - if (CocoEncodingConst.STYLE.equals(existingMark.getStyle())) {
11.218 - //Already has COBOL Copybook encoding applied
11.219 - mIsApplied = true;
11.220 - return true;
11.221 - }
11.222 - //Already has other encoding applied
11.223 - mIsApplied = false;
11.224 - return false;
11.225 - }
11.226 - //No encoding has been applied
11.227 - mIsApplied = false;
11.228 - return true;
11.229 - }
11.230 -
11.231 - /**
11.232 - * Visitor class for applying COBOL Copybook encoding to the in-memory model
11.233 - * and with model always synchronized. For huge models, this process might
11.234 - * be very time consuming.
11.235 - */
11.236 - private static class ApplyCocoEncodingSync implements ModelVisitor {
11.237 -
11.238 - private OutputWriter mConsole = Utils.getEncodingIO().getOut();
11.239 - private boolean mSkip = false;
11.240 -
11.241 - public boolean visit(SchemaModel model) {
11.242 - if (!ModelUtils.isModelWritable(model)) {
11.243 - if (mSkip) {
11.244 - return true;
11.245 - }
11.246 - String msg = NbBundle.getMessage(ApplyCocoEncodingAction.class,
11.247 - "apply_coco_enc.lbl.read_only_model", ModelUtils.getFilePath(model)); //NOI18N
11.248 - int option =
11.249 - JOptionPane.showConfirmDialog(
11.250 - WindowManager.getDefault().getMainWindow(),
11.251 - msg,
11.252 - _bundle.getString("apply_coco_enc.lbl.read_only_model"),
11.253 - JOptionPane.YES_NO_OPTION);
11.254 - mConsole.println(
11.255 - NbBundle.getMessage(
11.256 - ApplyCocoEncodingAction.class,
11.257 - "apply_coco_enc.msg.apply_coco_enc_to", //NOI18N
11.258 - ModelUtils.getFilePath(model)));
11.259 - if (option == JOptionPane.NO_OPTION) {
11.260 - mConsole.println(_bundle.getString("apply_coco_enc.msg.cancelled_by_user"));
11.261 - return false;
11.262 - }
11.263 - mSkip = true;
11.264 - return true;
11.265 - }
11.266 -
11.267 - mConsole.println(
11.268 - NbBundle.getMessage(
11.269 - ApplyCocoEncodingAction.class,
11.270 - "apply_coco_enc.msg.apply_coco_enc_to", //NOI18N
11.271 - ModelUtils.getFilePath(model)));
11.272 - boolean transStarted = false;
11.273 - try {
11.274 - if (!model.isIntransaction()) {
11.275 - if (!model.startTransaction()) {
11.276 - //TODO how to handle???
11.277 - } else {
11.278 - transStarted = true;
11.279 - }
11.280 - }
11.281 - try {
11.282 - ModelUtils.applyEncodingMark(model, CocoEncodingConst.NAME,
11.283 - CocoEncodingConst.URI, CocoEncodingConst.STYLE);
11.284 - } catch (IOException ex) {
11.285 - throw new ModelVisitorException(ex);
11.286 - }
11.287 - ApplyCocoEncodingVisitor visitor =
11.288 - new ApplyCocoEncodingVisitor(model);
11.289 - model.getSchema().accept(visitor);
11.290 - mConsole.println(
11.291 - NbBundle.getMessage(
11.292 - ApplyCocoEncodingAction.class,
11.293 - "apply_coco_enc.msg.modified_elem_count", //NOI18N
11.294 - visitor.getElementModified()));
11.295 - } finally {
11.296 - if (transStarted) {
11.297 - model.endTransaction();
11.298 - }
11.299 - }
11.300 - return true;
11.301 - }
11.302 -
11.303 - public boolean visit(Document doc) {
11.304 - return true;
11.305 - }
11.306 -
11.307 - public boolean visit(FileObject fileObj) {
11.308 - return true;
11.309 - }
11.310 -
11.311 - public boolean visit(DataObject dataObj) {
11.312 - return true;
11.313 - }
11.314 - }
11.315 -}
12.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/action/ApplyCocoEncodingVisitor.java Sat Sep 27 15:34:52 2008 -0700
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,88 +0,0 @@
12.4 -/*
12.5 - * The contents of this file are subject to the terms of the Common Development
12.6 - * and Distribution License (the License). You may not use this file except in
12.7 - * compliance with the License.
12.8 - *
12.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
12.10 - * or http://www.netbeans.org/cddl.txt.
12.11 -
12.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
12.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
12.14 - * If applicable, add the following below the CDDL Header, with the fields
12.15 - * enclosed by brackets [] replaced by your own identifying information:
12.16 - * "Portions Copyrighted [year] [name of copyright owner]"
12.17 - *
12.18 - * The Original Software is NetBeans. The Initial Developer of the Original
12.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
12.20 - * Microsystems, Inc. All Rights Reserved.
12.21 - */
12.22 -
12.23 -package org.netbeans.modules.encoder.coco.ui.action;
12.24 -
12.25 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
12.26 -import org.netbeans.modules.xml.schema.model.Annotation;
12.27 -import org.netbeans.modules.xml.schema.model.AppInfo;
12.28 -import org.netbeans.modules.xml.schema.model.Element;
12.29 -import org.netbeans.modules.xml.schema.model.GlobalElement;
12.30 -import org.netbeans.modules.xml.schema.model.LocalElement;
12.31 -import org.netbeans.modules.xml.schema.model.SchemaModel;
12.32 -import org.netbeans.modules.xml.schema.model.visitor.DeepSchemaVisitor;
12.33 -import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor;
12.34 -
12.35 -/**
12.36 - * The visitor that applies COBOL Copybook encoding to every element declaration.
12.37 - *
12.38 - * @author Jun Xu
12.39 - */
12.40 -public class ApplyCocoEncodingVisitor extends DeepSchemaVisitor implements SchemaVisitor {
12.41 -
12.42 - private final SchemaModel mModel;
12.43 - private int mElementModified = 0;
12.44 -
12.45 - public ApplyCocoEncodingVisitor(SchemaModel rootModel) {
12.46 - mModel = rootModel;
12.47 - }
12.48 -
12.49 - public void visit(LocalElement localElement) {
12.50 - applyCocoEncoding(localElement);
12.51 - super.visit(localElement);
12.52 - }
12.53 -
12.54 - public void visit(GlobalElement globalElement) {
12.55 - applyCocoEncoding(globalElement);
12.56 - super.visit(globalElement);
12.57 - }
12.58 -
12.59 - public int getElementModified() {
12.60 - return mElementModified;
12.61 - }
12.62 -
12.63 - private void applyCocoEncoding(Element elem) {
12.64 - if (!mModel.equals(elem.getModel())) {
12.65 - return;
12.66 - }
12.67 - boolean addAnnotation = false;
12.68 - boolean found = false;
12.69 - Annotation anno = elem.getAnnotation();
12.70 - if (anno == null) {
12.71 - anno = elem.getModel().getFactory().createAnnotation();
12.72 - addAnnotation = true;
12.73 - } else {
12.74 - for (AppInfo appInfo : anno.getAppInfos()) {
12.75 - if (EncodingConst.URI.equals(appInfo.getURI())) {
12.76 - found = true;
12.77 - break;
12.78 - }
12.79 - }
12.80 - }
12.81 - if (!found) {
12.82 - AppInfo appInfo = elem.getModel().getFactory().createAppInfo();
12.83 - appInfo.setURI(EncodingConst.URI);
12.84 - anno.addAppInfo(appInfo);
12.85 - if (addAnnotation) {
12.86 - elem.setAnnotation(anno);
12.87 - }
12.88 - mElementModified++;
12.89 - }
12.90 - }
12.91 -}
13.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/action/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,34 +0,0 @@
13.4 -
13.5 -apply_coco_enc.lbl.process=Process
13.6 -
13.7 -apply_coco_enc.lbl.read_only_model=Read Only Model
13.8 -
13.9 -apply_coco_enc.lbl.reapply_coco_encoding=Reapply COBOL Copybook Encoding
13.10 -
13.11 -apply_coco_enc.lbl.applying_coco_encoding=Applying COBOL Copybook Encoding
13.12 -
13.13 -apply_coco_enc.lbl.apply_coco_encoding_title=Apply COBOL Copybook Encoding
13.14 -
13.15 -apply_coco_enc.lbl.apply_coco_encoding_menu=Apply COBOL Copybook Encoding
13.16 -
13.17 -apply_coco_enc.lbl.notify_lengthy_process=Notify Lengthy Process
13.18 -
13.19 -apply_coco_enc.lbl.cancel=Cancel
13.20 -
13.21 -apply_coco_enc.lbl.warn_big_file=The size of the XSD file(s) is over 300K. This process may\ntake from couple seconds to {0} minute(s) depending on\nvarious situation. Continue?
13.22 -
13.23 -apply_coco_enc.lbl.read_only_model=The model is read only: ''{0}''. Continue to apply COBOL Copybook encoding to other referenced schemas?
13.24 -
13.25 -apply_coco_enc.msg.finished_apply_coco_encoding=Finished applying COBOL Copybook encoding.
13.26 -
13.27 -apply_coco_enc.msg.cancelled_by_user=Process cancelled by user.
13.28 -
13.29 -apply_coco_enc.msg.start_apply_coco_encoding=Start to apply COBOL Copybook encoding...
13.30 -
13.31 -apply_coco_enc.msg.apply_coco_enc_to=Applying COBOL Copybook encoding to {0}
13.32 -
13.33 -apply_coco_enc.msg.modified_elem_count=Modified {0,number,integer} element declarations
13.34 -
13.35 -apply_coco_enc.msg.modified_cplxtype_count=Modified {0,number,integer} complex type definitions
13.36 -
13.37 -apply_coco_enc.msg.modified_simptype_count=Modified {0,number,integer} simple type definitions
14.1 Binary file encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/icon.PNG has changed
15.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/layer.xml Sat Sep 27 15:34:52 2008 -0700
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,43 +0,0 @@
15.4 -<?xml version="1.0" encoding="UTF-8"?>
15.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
15.6 -<filesystem>
15.7 - <folder name="Templates">
15.8 - <attr name="Classes/Encoder" boolvalue="true"/>
15.9 - <attr name="Encoder/GUIForms" boolvalue="true"/>
15.10 - <folder name="Encoder">
15.11 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.encoder.coco.ui.wizard.Bundle"/>
15.12 - <file name="retrieveCopybookResource">
15.13 - <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/encoder/coco/ui/wizard/xmlObject.gif"/>
15.14 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.encoder.coco.ui.wizard.Bundle"/>
15.15 - <attr name="instantiatingIterator" newvalue="org.netbeans.modules.encoder.coco.ui.wizard.RetrieveCopybookWizardIterator"/>
15.16 - <attr name="template" boolvalue="true"/>
15.17 - <attr name="templateCategory" stringvalue="XML"/>
15.18 - <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/encoder/coco/ui/wizard/retrieveCopybookResource.html"/>
15.19 - </file>
15.20 - </folder> <!-- Encoder -->
15.21 - </folder> <!-- Templates -->
15.22 - <folder name="Loaders">
15.23 - <folder name="text">
15.24 - <folder name="x-schema+xml">
15.25 - <folder name="Actions">
15.26 - <folder name="encoding">
15.27 - <file name="apply-coco.instance">
15.28 - <attr name="instanceClass" stringvalue="org.netbeans.modules.encoder.coco.ui.action.ApplyCocoEncodingAction"/>
15.29 - </file>
15.30 - <attr name="apply-coco.instance/sep-1.instance" boolvalue="true"/>
15.31 - </folder>
15.32 - </folder>
15.33 - </folder>
15.34 - <folder name="cpy">
15.35 - <folder name="Actions">
15.36 - <attr name="it-imolinfo-jbi4cics-netbeansplugin-cpy2wsdlwizard-separatorBefore.instance/coco-to-xsd.instance" boolvalue="true"/>
15.37 - <file name="coco-to-xsd.instance">
15.38 - <attr name="instanceClass" stringvalue="org.netbeans.modules.encoder.coco.ui.wizard.GenerateXSDWizardAction"/>
15.39 - </file>
15.40 - <attr name="coco-to-xsd.instance/it-imolinfo-jbi4cics-netbeansplugin-cpy2wsdlwizard-CreateWSDLAction.shadow" boolvalue="true"/>
15.41 - </folder>
15.42 - </folder>
15.43 - </folder>
15.44 - </folder>
15.45 -</filesystem>
15.46 -
16.1 Binary file encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/openIcon.PNG has changed
17.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/validation/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,16 +0,0 @@
17.4 -
17.5 -coco_validator.exp.no_top_element=COBOL Copybook Encoder - No top element has been found in current document. Encoding related metadata is not validated.
17.6 -
17.7 -coco_validator.lbl.provider_name=COBOL Copybook Encoder Validation Provider
17.8 -
17.9 -coco_validator.exp.missing_level_property=Unexpected state\: missing level property
17.10 -
17.11 -coco_validator.exp.recursive_condition=COBOL Copybook Encoder - Schema component ''{0}'' is referenced recursively.
17.12 -
17.13 -coco_validator.exp.missing_level_prop=Unexpected state\: missing level property
17.14 -
17.15 -coco_validator.exp.grp_in_grp_not_supported=Schema component ''{0}'': COBOL Copybook Encoder - Model group inside model group is not supported
17.16 -
17.17 -coco_validator.exp.too_many_levels=COBOL Copybook Encoder - Element ''{0}'': too many levels. # of levels must be no more than {1,number,integer}, current # of levels = {2,number,integer}
17.18 -
17.19 -coco_validator.exp.anytype_not_supported=COBOL Copybook Encoder - Element ''{0}'': xsd:anyType or no type is not supported
18.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/validation/CocoEncoderValidator.java Sat Sep 27 15:34:52 2008 -0700
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,377 +0,0 @@
18.4 -/*
18.5 - * The contents of this file are subject to the terms of the Common Development
18.6 - * and Distribution License (the License). You may not use this file except in
18.7 - * compliance with the License.
18.8 - *
18.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
18.10 - * or http://www.netbeans.org/cddl.txt.
18.11 -
18.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
18.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
18.14 - * If applicable, add the following below the CDDL Header, with the fields
18.15 - * enclosed by brackets [] replaced by your own identifying information:
18.16 - * "Portions Copyrighted [year] [name of copyright owner]"
18.17 - *
18.18 - * The Original Software is NetBeans. The Initial Developer of the Original
18.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
18.20 - * Microsystems, Inc. All Rights Reserved.
18.21 - */
18.22 -
18.23 -package org.netbeans.modules.encoder.coco.ui.validation;
18.24 -
18.25 -import java.util.ArrayList;
18.26 -import java.util.List;
18.27 -import java.util.ResourceBundle;
18.28 -//import org.netbeans.modules.encoder.hl7.aip.EncodingOption;
18.29 -import org.netbeans.modules.encoder.coco.ui.CocoEncodingConst;
18.30 -//import org.netbeans.modules.encoder.hl7.aip.HL7EncodingConst;
18.31 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
18.32 -import org.netbeans.modules.encoder.ui.basic.SchemaUtility;
18.33 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
18.34 -import org.netbeans.modules.encoder.ui.basic.ValidationContext;
18.35 -import org.netbeans.modules.encoder.ui.basic.ValidationException;
18.36 -import org.netbeans.modules.encoder.ui.basic.XsdBasedEncoderValidator;
18.37 -import org.netbeans.modules.xml.schema.model.All;
18.38 -import org.netbeans.modules.xml.schema.model.Choice;
18.39 -import org.netbeans.modules.xml.schema.model.Element;
18.40 -import org.netbeans.modules.xml.schema.model.ElementReference;
18.41 -import org.netbeans.modules.xml.schema.model.GlobalComplexType;
18.42 -import org.netbeans.modules.xml.schema.model.GlobalElement;
18.43 -import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
18.44 -import org.netbeans.modules.xml.schema.model.GlobalType;
18.45 -import org.netbeans.modules.xml.schema.model.GroupReference;
18.46 -import org.netbeans.modules.xml.schema.model.LocalComplexType;
18.47 -import org.netbeans.modules.xml.schema.model.LocalElement;
18.48 -import org.netbeans.modules.xml.schema.model.LocalGroupDefinition;
18.49 -import org.netbeans.modules.xml.schema.model.LocalSimpleType;
18.50 -import org.netbeans.modules.xml.schema.model.NameableSchemaComponent;
18.51 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
18.52 -import org.netbeans.modules.xml.schema.model.SchemaModel;
18.53 -import org.netbeans.modules.xml.schema.model.Sequence;
18.54 -import org.netbeans.modules.xml.schema.model.TypeContainer;
18.55 -import org.openide.util.NbBundle;
18.56 -import org.xml.sax.ErrorHandler;
18.57 -import org.xml.sax.SAXException;
18.58 -import org.xml.sax.SAXParseException;
18.59 -
18.60 -/**
18.61 - * Class that provides validation functionality for r.
18.62 - *
18.63 - * @author Jun Xu
18.64 - */
18.65 -public class CocoEncoderValidator extends XsdBasedEncoderValidator {
18.66 -
18.67 - private static final ResourceBundle _bundle =
18.68 - ResourceBundle.getBundle("org/netbeans/modules/encoder/coco/ui/validation/Bundle");
18.69 - private static final String PROP_LEVEL = "level"; //NOI18N
18.70 - //Maximum level should be 4 according to HL7 specification but in XML
18.71 - //representation the top element should not be counted in the level.
18.72 - private static final int MAX_LEVEL = 5;
18.73 -
18.74 - /** Creates a new instance of CustomEncoderValidator
18.75 - * @param model the schema model
18.76 - * @param handler a SAX error handler
18.77 - */
18.78 - public CocoEncoderValidator(SchemaModel model, ErrorHandler handler) {
18.79 - super(CocoEncodingConst.STYLE, model, handler);
18.80 - }
18.81 -
18.82 - protected void foundNoTopElements()
18.83 - throws ValidationException, SAXException {
18.84 -
18.85 - super.foundNoTopElements();
18.86 -
18.87 - _handler.warning(
18.88 - new SAXParseException(
18.89 - _bundle.getString("hl7_validator.exp.no_top_element"),
18.90 - ModelUtils.getPublicId(_model),
18.91 - null /*ModelUtils.getSystemId(_model)*/,
18.92 - -1,
18.93 - -1));
18.94 - }
18.95 -
18.96 - protected void detectedRecursiveCondition(ValidationContext context,
18.97 - SchemaComponent schemaComponent)
18.98 - throws ValidationException, SAXException {
18.99 -
18.100 - super.detectedRecursiveCondition(context, schemaComponent);
18.101 -
18.102 - String msg = NbBundle.getMessage(CocoEncoderValidator.class,
18.103 - "coco_validator.exp.recursive_condition", //NOI18N
18.104 - context.getElementNCNamePath(schemaComponent));
18.105 - _handler.error(
18.106 - new SAXParseException(
18.107 - msg,
18.108 - ModelUtils.getPublicId(schemaComponent.getModel()),
18.109 - ModelUtils.getSystemId(schemaComponent.getModel()),
18.110 - -1,
18.111 - -1));
18.112 - }
18.113 -
18.114 - protected void validate(ValidationContext context,
18.115 - GlobalElement globalElement)
18.116 - throws ValidationException, SAXException {
18.117 -
18.118 - super.validate(context, globalElement);
18.119 -
18.120 - validateLevel(context, globalElement);
18.121 - validateMetadataSyntax(context, globalElement);
18.122 - validateSupportedType(context, globalElement);
18.123 - }
18.124 -
18.125 - protected void validate(ValidationContext context,
18.126 - LocalElement localElement)
18.127 - throws ValidationException, SAXException {
18.128 -
18.129 - super.validate(context, localElement);
18.130 -
18.131 - validateLevel(context, localElement);
18.132 - validateMetadataSyntax(context, localElement);
18.133 - validateSupportedType(context, localElement);
18.134 - }
18.135 -
18.136 - protected void validate(ValidationContext context,
18.137 - GlobalComplexType globalComplexType)
18.138 - throws ValidationException, SAXException {
18.139 -
18.140 - super.validate(context, globalComplexType);
18.141 -
18.142 - validateMetadataSyntax(context, globalComplexType);
18.143 - }
18.144 -
18.145 - protected void validate(ValidationContext context,
18.146 - LocalComplexType localComplexType)
18.147 - throws ValidationException, SAXException {
18.148 -
18.149 - super.validate(context, localComplexType);
18.150 -
18.151 - validateMetadataSyntax(context, localComplexType);
18.152 - }
18.153 -
18.154 - protected void validate(ValidationContext context,
18.155 - GlobalSimpleType globalSimpleType)
18.156 - throws ValidationException, SAXException {
18.157 -
18.158 - super.validate(context, globalSimpleType);
18.159 -
18.160 - validateMetadataSyntax(context, globalSimpleType);
18.161 - }
18.162 -
18.163 - protected void validate(ValidationContext context,
18.164 - LocalSimpleType localSimpleType)
18.165 - throws ValidationException, SAXException {
18.166 -
18.167 - super.validate(context, localSimpleType);
18.168 -
18.169 - validateMetadataSyntax(context, localSimpleType);
18.170 - }
18.171 -
18.172 - protected void validate(ValidationContext context, Sequence sequence)
18.173 - throws ValidationException, SAXException {
18.174 -
18.175 - super.validate(context, sequence);
18.176 -
18.177 - checkGroupWithinGroup(context, sequence);
18.178 - }
18.179 -
18.180 - protected void validate(ValidationContext context, All all)
18.181 - throws ValidationException, SAXException {
18.182 -
18.183 - super.validate(context, all);
18.184 -
18.185 - checkGroupWithinGroup(context, all);
18.186 - }
18.187 -
18.188 - protected void validate(ValidationContext context, Choice choice)
18.189 - throws ValidationException, SAXException {
18.190 -
18.191 - super.validate(context, choice);
18.192 -
18.193 - checkGroupWithinGroup(context, choice);
18.194 - }
18.195 -
18.196 - protected void validate(ValidationContext context, GroupReference groupRef)
18.197 - throws ValidationException, SAXException {
18.198 -
18.199 - super.validate(context, groupRef);
18.200 -
18.201 - checkGroupWithinGroup(context, groupRef);
18.202 - }
18.203 -
18.204 - protected void prepareContext(ValidationContext context)
18.205 - throws ValidationException, SAXException {
18.206 - super.prepareContext(context);
18.207 -
18.208 - if (context.getPath().isEmpty()) {
18.209 - context.setProperty(PROP_LEVEL, new Integer(0));
18.210 - return;
18.211 - }
18.212 - Integer objLevel = (Integer) context.getProperty(PROP_LEVEL);
18.213 - if (objLevel == null) {
18.214 - throw new ValidationException(
18.215 - _bundle.getString("coco_validator.exp.missing_level_prop"));
18.216 - }
18.217 - SchemaComponent sc = context.getPath().get(context.getPath().size() - 1);
18.218 - if (!(sc instanceof Element) || (sc instanceof ElementReference)) {
18.219 - return;
18.220 - }
18.221 - if (!(sc instanceof NameableSchemaComponent)) {
18.222 - return;
18.223 - }
18.224 - String name = ((NameableSchemaComponent) sc).getName();
18.225 - if (name.startsWith(context.getTopElementNCName() + ".")) { //NOI18N
18.226 - //Element with name starts with top element name as prefix is
18.227 - //considered as group and will not account for level increase.
18.228 - return;
18.229 - }
18.230 - context.setProperty(PROP_LEVEL, new Integer(objLevel.intValue() + 1));
18.231 - }
18.232 -
18.233 - private void checkGroupWithinGroup(ValidationContext context,
18.234 - SchemaComponent group)
18.235 - throws ValidationException, SAXException {
18.236 - if (context.getPath().size() == 0) {
18.237 - return;
18.238 - }
18.239 - SchemaComponent sc =
18.240 - context.getPath().get(context.getPath().size() - 1);
18.241 - if ((sc instanceof LocalGroupDefinition)
18.242 - || (sc instanceof GroupReference)) {
18.243 - String name = null;
18.244 - for (int i = context.getPath().size() - 1; i >= 0; i--) {
18.245 - if (context.getPath().get(i)
18.246 - instanceof NameableSchemaComponent) {
18.247 - name = ((NameableSchemaComponent)
18.248 - context.getPath().get(i)).getName();
18.249 - sc = context.getPath().get(i);
18.250 - break;
18.251 - }
18.252 - }
18.253 - if (name == null) {
18.254 - name = ""; //NOI18N
18.255 - }
18.256 - String msg = NbBundle.getMessage(CocoEncoderValidator.class,
18.257 - "coco_validator.exp.grp_in_grp_not_supported", name); //NOI18N
18.258 -
18.259 - _handler.error(
18.260 - new SAXParseException(
18.261 - msg,
18.262 - ModelUtils.getPublicId(sc.getModel()),
18.263 - ModelUtils.getSystemId(sc.getModel()),
18.264 - -1,
18.265 - -1));
18.266 - }
18.267 - }
18.268 -
18.269 - private void validateLevel(ValidationContext context, Element elem)
18.270 - throws ValidationException, SAXException {
18.271 - Integer objLevel = (Integer) context.getProperty(PROP_LEVEL);
18.272 - if (objLevel == null) {
18.273 - throw new ValidationException(
18.274 - _bundle.getString("coco_validator.exp.missing_level_property"));
18.275 - }
18.276 - if (objLevel.intValue() < MAX_LEVEL) {
18.277 - return;
18.278 - }
18.279 - if (objLevel.intValue() > MAX_LEVEL) {
18.280 - //Already has too many levels. Don't need to do further check
18.281 - String msg =
18.282 - NbBundle.getMessage(
18.283 - CocoEncoderValidator.class,
18.284 - "coco_validator.exp.too_many_levels", //NOI18N
18.285 - context.getElementNCNamePath(elem),
18.286 - MAX_LEVEL - 1,
18.287 - objLevel.intValue());
18.288 - _handler.warning(
18.289 - new SAXParseException(
18.290 - msg,
18.291 - ModelUtils.getPublicId(elem.getModel()),
18.292 - null /*ModelUtils.getSystemId(elem.getModel())*/,
18.293 - -1,
18.294 - -1));
18.295 - return;
18.296 - }
18.297 - if (elem instanceof ElementReference) {
18.298 - return;
18.299 - }
18.300 - if (!(elem instanceof NameableSchemaComponent)) {
18.301 - return;
18.302 - }
18.303 - String name = ((NameableSchemaComponent) elem).getName();
18.304 - if (name.startsWith(context.getTopElementPrefix())) {
18.305 - //Element with name starts with top element name as prefix is
18.306 - //considered as group and will not account for level increase.
18.307 - return;
18.308 - }
18.309 - if (!(elem instanceof TypeContainer)) {
18.310 - return;
18.311 - }
18.312 - SchemaComponent type = getType(((TypeContainer) elem));
18.313 - if (type == null || (type instanceof GlobalType)
18.314 - && "escapeType".equals(((GlobalType) type).getName())) { //NOI18N
18.315 - //element representing escape sequence is allowed as the fifth level element
18.316 - return;
18.317 - }
18.318 - String msg =
18.319 - NbBundle.getMessage(
18.320 - CocoEncoderValidator.class,
18.321 - "coco_validator.exp.too_many_levels", //NOI18N
18.322 - context.getElementNCNamePath(elem),
18.323 - MAX_LEVEL - 1,
18.324 - objLevel.intValue());
18.325 - _handler.warning(
18.326 - new SAXParseException(
18.327 - msg,
18.328 - ModelUtils.getPublicId(elem.getModel()),
18.329 - null /*ModelUtils.getSystemId(elem.getModel())*/,
18.330 - -1,
18.331 - -1));
18.332 - }
18.333 -
18.334 - private void validateMetadataSyntax(ValidationContext context, SchemaComponent sc)
18.335 - throws ValidationException, SAXException {
18.336 - //TODO
18.337 -// if (sc.getAnnotation() == null) {
18.338 -// return;
18.339 -// }
18.340 -// List<SchemaComponent> path =
18.341 -// new ArrayList<SchemaComponent>(context.getPath());
18.342 -// path.add(sc);
18.343 -// path.add(sc.getAnnotation());
18.344 -// EncodingOption encodingInfo;
18.345 -// try {
18.346 -// encodingInfo =
18.347 -// EncodingOption.createFromAppInfo(path);
18.348 -// } catch (InvalidAppInfoException ex) {
18.349 -// _handler.error(
18.350 -// new SAXParseException(
18.351 -// ex.getMessage(),
18.352 -// ModelUtils.getPublicId(sc.getModel()),
18.353 -// ModelUtils.getSystemId(sc.getModel()),
18.354 -// -1,
18.355 -// -1,
18.356 -// ex));
18.357 -// }
18.358 - }
18.359 -
18.360 - private void validateSupportedType(ValidationContext context, Element elem)
18.361 - throws ValidationException, SAXException {
18.362 - if (!(elem instanceof TypeContainer)) {
18.363 - return;
18.364 - }
18.365 - if (SchemaUtility.isAnyType(getType((TypeContainer) elem))) {
18.366 - String msg =
18.367 - NbBundle.getMessage(
18.368 - CocoEncoderValidator.class,
18.369 - "coco_validator.exp.anytype_not_supported", //NOI18N
18.370 - context.getElementNCNamePath(elem));
18.371 - _handler.error(
18.372 - new SAXParseException(
18.373 - msg,
18.374 - ModelUtils.getPublicId(elem.getModel()),
18.375 - null /*ModelUtils.getSystemId(elem.getModel())*/,
18.376 - -1,
18.377 - -1));
18.378 - }
18.379 - }
18.380 -}
19.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/validation/ValidationProvider.java Sat Sep 27 15:34:52 2008 -0700
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,97 +0,0 @@
19.4 -/*
19.5 - * The contents of this file are subject to the terms of the Common Development
19.6 - * and Distribution License (the License). You may not use this file except in
19.7 - * compliance with the License.
19.8 - *
19.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
19.10 - * or http://www.netbeans.org/cddl.txt.
19.11 -
19.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
19.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
19.14 - * If applicable, add the following below the CDDL Header, with the fields
19.15 - * enclosed by brackets [] replaced by your own identifying information:
19.16 - * "Portions Copyrighted [year] [name of copyright owner]"
19.17 - *
19.18 - * The Original Software is NetBeans. The Initial Developer of the Original
19.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
19.20 - * Microsystems, Inc. All Rights Reserved.
19.21 - */
19.22 -
19.23 -package org.netbeans.modules.encoder.coco.ui.validation;
19.24 -
19.25 -import java.net.URI;
19.26 -import java.net.URISyntaxException;
19.27 -import java.util.ResourceBundle;
19.28 -import java.util.logging.Level;
19.29 -import java.util.logging.Logger;
19.30 -import javax.xml.XMLConstants;
19.31 -import javax.xml.validation.Schema;
19.32 -import javax.xml.validation.SchemaFactory;
19.33 -import org.netbeans.modules.xml.schema.model.SchemaModel;
19.34 -import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
19.35 -import org.netbeans.modules.xml.xam.Model;
19.36 -import org.netbeans.modules.xml.xam.ModelSource;
19.37 -import org.netbeans.modules.xml.xam.dom.DocumentModel;
19.38 -import org.netbeans.modules.xml.xam.locator.CatalogModel;
19.39 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
19.40 -import org.netbeans.modules.xml.xam.spi.XsdBasedValidator;
19.41 -import org.netbeans.modules.xml.xam.spi.Validator;
19.42 -import org.xml.sax.SAXException;
19.43 -
19.44 -/**
19.45 - * A validator for validating COBOL Copybook encoder metadata.
19.46 - *
19.47 - * @author Jun Xu
19.48 - */
19.49 -public class ValidationProvider extends XsdBasedValidator {
19.50 -
19.51 - private static final ResourceBundle _bundle =
19.52 - ResourceBundle.getBundle("org/netbeans/modules/encoder/coco/ui/validation/Bundle");
19.53 - private static Schema _schema;
19.54 -
19.55 - static {
19.56 - try {
19.57 - _schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema();
19.58 - } catch(SAXException ex) {
19.59 - assert false: "Error while creating compiled schema for"; //NOI18N
19.60 - }
19.61 - }
19.62 -
19.63 - protected Schema getSchema(Model model) {
19.64 - if (! (model instanceof SchemaModel)) {
19.65 - return null;
19.66 - }
19.67 -
19.68 - // This will not be used as validate(.....) method is being overridden here.
19.69 - // So just return a schema returned by newSchema().
19.70 - return _schema;
19.71 - }
19.72 -
19.73 - public String getName() {
19.74 - return _bundle.getString("coco_validator.lbl.provider_name");
19.75 - }
19.76 -
19.77 - protected void validate(Model model, Schema schema, XsdBasedValidator.Handler handler) {
19.78 - try {
19.79 - new CocoEncoderValidator((SchemaModel) model, handler).validate();
19.80 - } catch(Exception ex) {
19.81 - handler.logValidationErrors(Validator.ResultType.ERROR, ex.getMessage());
19.82 - }
19.83 - }
19.84 -
19.85 - public DocumentModel resolveResource(String systemId, Model model) {
19.86 - try {
19.87 - CatalogModel cm = (CatalogModel) model.getModelSource().getLookup()
19.88 - .lookup(CatalogModel.class);
19.89 - ModelSource ms = cm.getModelSource(new URI(systemId));
19.90 - if (ms != null) {
19.91 - return SchemaModelFactory.getDefault().getModel(ms);
19.92 - }
19.93 - } catch(URISyntaxException ex) {
19.94 - Logger.getLogger(getClass().getName()).log(Level.FINE, "resolveResource", ex); //NOI18N
19.95 - } catch(CatalogModelException ex) {
19.96 - Logger.getLogger(getClass().getName()).log(Level.FINE, "resolveResource", ex); //NOI18N
19.97 - }
19.98 - return null;
19.99 - }
19.100 -}
20.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
20.3 @@ -1,56 +0,0 @@
20.4 -# The contents of this file are subject to the terms of the Common Development
20.5 -# and Distribution License (the License). You may not use this file except in
20.6 -# compliance with the License.
20.7 -#
20.8 -# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
20.9 -# or http://www.netbeans.org/cddl.txt.
20.10 -
20.11 -#
20.12 -# The contents of this file are subject to the terms of the Common Development
20.13 -# and Distribution License (the License). You may not use this file except in
20.14 -# compliance with the License.
20.15 -#
20.16 -# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
20.17 -# or http://www.netbeans.org/cddl.txt.
20.18 -#
20.19 -# When distributing Covered Code, include this CDDL Header Notice in each file
20.20 -# and include the License file at http://www.netbeans.org/cddl.txt.
20.21 -# If applicable, add the following below the CDDL Header, with the fields
20.22 -# enclosed by brackets [] replaced by your own identifying information:
20.23 -# "Portions Copyrighted [year] [name of copyright owner]"
20.24 -#
20.25 -# The Original Software is NetBeans. The Initial Developer of the Original
20.26 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
20.27 -# Microsystems, Inc. All Rights Reserved.
20.28 -#
20.29 -
20.30 -Templates/Encoder=Encoder Definition/Metadata
20.31 -Templates/Encoder/retrieveCopybookResource=External COBOL Copybook Document(s)
20.32 -
20.33 -RetrieveCopybookVisualPanel1.jLabelSpecifySource.text=Specify the source
20.34 -RetrieveCopybookVisualPanel1.jRadioFromURL.text=From URL
20.35 -
20.36 -RetrieveCopybookVisualPanel1.jTextURL.text=http\://
20.37 -RetrieveCopybookVisualPanel1.jRadioFromURL.AccessibleContext.accessibleDescription=From URL
20.38 -RetrieveCopybookVisualPanel1.jRadioFromURL.AccessibleContext.accessibleName=From URL
20.39 -
20.40 -RetrieveCopybookVisualPanel1.jRadioFromURL.label=From &URL
20.41 -
20.42 -RetrieveCopybookVisualPanel1.jRadioFromFile.actionCommand=From &Local File System
20.43 -
20.44 -RetrieveCopybookVisualPanel1.jRadioFromFile.text=From Local File System
20.45 -
20.46 -RetrieveCopybookVisualPanel1.jTextFileLocation.text=
20.47 -
20.48 -RetrieveCopybookVisualPanel1.jButtonBrowseSource.text=Browse
20.49 -
20.50 -RetrieveCopybookVisualPanel1.jLabelSpecifyTarget.text=Specify the target
20.51 -
20.52 -RetrieveCopybookVisualPanel1.jLabelSaveToFolder.text=Save to Folder
20.53 -
20.54 -RetrieveCopybookVisualPanel1.jTextTargetFolder.text=
20.55 -
20.56 -RetrieveCopybookVisualPanel1.jButtonBrowseTarget.text=Browse
20.57 -
20.58 -RetrieveCopybookVisualPanel1.jCheckBoxOverwrite.text=Overwrite files with same name
20.59 -RetrieveCopybookVisualPanel1.name=null
21.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/GenerateXSDVisualPanel1.form Sat Sep 27 15:34:52 2008 -0700
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,234 +0,0 @@
21.4 -<?xml version="1.0" encoding="UTF-8" ?>
21.5 -
21.6 -<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
21.7 - <AuxValues>
21.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
21.9 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
21.10 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
21.11 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
21.12 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
21.13 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
21.14 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
21.15 - </AuxValues>
21.16 -
21.17 - <Layout>
21.18 - <DimensionLayout dim="0">
21.19 - <Group type="103" groupAlignment="0" attributes="0">
21.20 - <Group type="102" attributes="0">
21.21 - <EmptySpace max="-2" attributes="0"/>
21.22 - <Group type="103" groupAlignment="0" attributes="0">
21.23 - <Component id="jCheckBoxIgnore72ColBeyond" alignment="0" min="-2" max="-2" attributes="0"/>
21.24 - <Component id="jCheckBoxCheckReservedWords" alignment="0" min="-2" max="-2" attributes="0"/>
21.25 - <Component id="jCheckBoxOverwriteExisting" alignment="0" min="-2" max="-2" attributes="0"/>
21.26 - <Group type="102" alignment="1" attributes="0">
21.27 - <Group type="103" groupAlignment="0" attributes="0">
21.28 - <Component id="jLabelCopybookCodePage" alignment="0" min="-2" pref="111" max="-2" attributes="1"/>
21.29 - <Component id="jLabelDISPLAYCodePage" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
21.30 - <Component id="jLabelDISPLAY1CodePage" alignment="0" min="-2" max="-2" attributes="0"/>
21.31 - <Component id="jLabelPredecodeCoding" alignment="0" pref="138" max="32767" attributes="1"/>
21.32 - <Component id="jLabelPostencodeCoding" alignment="0" max="32767" attributes="0"/>
21.33 - <Component id="jLabelTargetNamespace" min="-2" pref="100" max="-2" attributes="0"/>
21.34 - </Group>
21.35 - <EmptySpace max="-2" attributes="0"/>
21.36 - <Group type="103" groupAlignment="1" attributes="0">
21.37 - <Component id="jComboBoxCopybookCodePage" alignment="0" pref="287" max="32767" attributes="1"/>
21.38 - <Component id="jComboBoxDISPLAYCodePage" alignment="1" pref="287" max="32767" attributes="1"/>
21.39 - <Component id="jComboBoxDISPLAY1CodePage" alignment="0" pref="287" max="32767" attributes="1"/>
21.40 - <Component id="jComboBoxPredecodeCoding" alignment="0" pref="287" max="32767" attributes="1"/>
21.41 - <Component id="jComboBoxPostencodeCoding" alignment="0" pref="287" max="32767" attributes="1"/>
21.42 - <Component id="jTextFieldTargetNamespace" alignment="1" pref="287" max="32767" attributes="0"/>
21.43 - </Group>
21.44 - </Group>
21.45 - </Group>
21.46 - <EmptySpace max="-2" attributes="0"/>
21.47 - </Group>
21.48 - </Group>
21.49 - </DimensionLayout>
21.50 - <DimensionLayout dim="1">
21.51 - <Group type="103" groupAlignment="0" attributes="0">
21.52 - <Group type="102" attributes="0">
21.53 - <EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
21.54 - <Group type="103" groupAlignment="2" attributes="0">
21.55 - <Component id="jLabelCopybookCodePage" alignment="2" min="-2" max="-2" attributes="0"/>
21.56 - <Component id="jComboBoxCopybookCodePage" alignment="2" min="-2" max="-2" attributes="0"/>
21.57 - </Group>
21.58 - <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
21.59 - <Group type="103" groupAlignment="3" attributes="0">
21.60 - <Component id="jComboBoxDISPLAYCodePage" alignment="3" min="-2" max="-2" attributes="0"/>
21.61 - <Component id="jLabelDISPLAYCodePage" alignment="3" min="-2" max="-2" attributes="0"/>
21.62 - </Group>
21.63 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
21.64 - <Group type="103" groupAlignment="3" attributes="0">
21.65 - <Component id="jComboBoxDISPLAY1CodePage" alignment="3" min="-2" max="-2" attributes="0"/>
21.66 - <Component id="jLabelDISPLAY1CodePage" alignment="3" min="-2" max="-2" attributes="0"/>
21.67 - </Group>
21.68 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
21.69 - <Group type="103" groupAlignment="3" attributes="0">
21.70 - <Component id="jComboBoxPredecodeCoding" alignment="3" min="-2" max="-2" attributes="0"/>
21.71 - <Component id="jLabelPredecodeCoding" alignment="3" min="-2" max="-2" attributes="0"/>
21.72 - </Group>
21.73 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
21.74 - <Group type="103" groupAlignment="3" attributes="0">
21.75 - <Component id="jComboBoxPostencodeCoding" alignment="3" min="-2" max="-2" attributes="0"/>
21.76 - <Component id="jLabelPostencodeCoding" alignment="3" min="-2" max="-2" attributes="0"/>
21.77 - </Group>
21.78 - <EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
21.79 - <Group type="103" groupAlignment="3" attributes="0">
21.80 - <Component id="jLabelTargetNamespace" alignment="3" min="-2" max="-2" attributes="0"/>
21.81 - <Component id="jTextFieldTargetNamespace" alignment="3" min="-2" max="-2" attributes="0"/>
21.82 - </Group>
21.83 - <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
21.84 - <Component id="jCheckBoxIgnore72ColBeyond" min="-2" max="-2" attributes="0"/>
21.85 - <EmptySpace type="separate" max="-2" attributes="0"/>
21.86 - <Component id="jCheckBoxCheckReservedWords" min="-2" max="-2" attributes="0"/>
21.87 - <EmptySpace type="separate" max="-2" attributes="0"/>
21.88 - <Component id="jCheckBoxOverwriteExisting" min="-2" max="-2" attributes="0"/>
21.89 - <EmptySpace pref="26" max="32767" attributes="0"/>
21.90 - </Group>
21.91 - </Group>
21.92 - </DimensionLayout>
21.93 - </Layout>
21.94 - <SubComponents>
21.95 - <Component class="javax.swing.JLabel" name="jLabelCopybookCodePage">
21.96 - <Properties>
21.97 - <Property name="text" type="java.lang.String" value="Copybook Code Page:"/>
21.98 - </Properties>
21.99 - </Component>
21.100 - <Component class="javax.swing.JComboBox" name="jComboBoxCopybookCodePage">
21.101 - <Properties>
21.102 - <Property name="editable" type="boolean" value="true"/>
21.103 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
21.104 - <StringArray count="4">
21.105 - <StringItem index="0" value="Item 1"/>
21.106 - <StringItem index="1" value="Item 2"/>
21.107 - <StringItem index="2" value="Item 3"/>
21.108 - <StringItem index="3" value="Item 4"/>
21.109 - </StringArray>
21.110 - </Property>
21.111 - </Properties>
21.112 - <Events>
21.113 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBoxCopybookCodePageActionPerformed"/>
21.114 - </Events>
21.115 - </Component>
21.116 - <Component class="javax.swing.JLabel" name="jLabelDISPLAYCodePage">
21.117 - <Properties>
21.118 - <Property name="text" type="java.lang.String" value="DISPLAY Code Page:"/>
21.119 - </Properties>
21.120 - </Component>
21.121 - <Component class="javax.swing.JComboBox" name="jComboBoxPredecodeCoding">
21.122 - <Properties>
21.123 - <Property name="editable" type="boolean" value="true"/>
21.124 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
21.125 - <StringArray count="4">
21.126 - <StringItem index="0" value="Item 1"/>
21.127 - <StringItem index="1" value="Item 2"/>
21.128 - <StringItem index="2" value="Item 3"/>
21.129 - <StringItem index="3" value="Item 4"/>
21.130 - </StringArray>
21.131 - </Property>
21.132 - </Properties>
21.133 - </Component>
21.134 - <Component class="javax.swing.JLabel" name="jLabelDISPLAY1CodePage">
21.135 - <Properties>
21.136 - <Property name="text" type="java.lang.String" value="DISPLAY1 Code Page:"/>
21.137 - </Properties>
21.138 - </Component>
21.139 - <Component class="javax.swing.JComboBox" name="jComboBoxDISPLAYCodePage">
21.140 - <Properties>
21.141 - <Property name="editable" type="boolean" value="true"/>
21.142 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
21.143 - <StringArray count="4">
21.144 - <StringItem index="0" value="Item 1"/>
21.145 - <StringItem index="1" value="Item 2"/>
21.146 - <StringItem index="2" value="Item 3"/>
21.147 - <StringItem index="3" value="Item 4"/>
21.148 - </StringArray>
21.149 - </Property>
21.150 - </Properties>
21.151 - </Component>
21.152 - <Component class="javax.swing.JLabel" name="jLabelPredecodeCoding">
21.153 - <Properties>
21.154 - <Property name="text" type="java.lang.String" value="Pre-decoding Char. Coding:"/>
21.155 - <Property name="toolTipText" type="java.lang.String" value="The coding tells the encoder how to convert input for decoding from the data nature that cannot be accepted by the encoder to the data nature that is acceptable by the encoder."/>
21.156 - </Properties>
21.157 - </Component>
21.158 - <Component class="javax.swing.JComboBox" name="jComboBoxDISPLAY1CodePage">
21.159 - <Properties>
21.160 - <Property name="editable" type="boolean" value="true"/>
21.161 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
21.162 - <StringArray count="4">
21.163 - <StringItem index="0" value="Item 1"/>
21.164 - <StringItem index="1" value="Item 2"/>
21.165 - <StringItem index="2" value="Item 3"/>
21.166 - <StringItem index="3" value="Item 4"/>
21.167 - </StringArray>
21.168 - </Property>
21.169 - </Properties>
21.170 - </Component>
21.171 - <Component class="javax.swing.JLabel" name="jLabelPostencodeCoding">
21.172 - <Properties>
21.173 - <Property name="text" type="java.lang.String" value="Post-encoding Char. Coding:"/>
21.174 - <Property name="toolTipText" type="java.lang.String" value="The coding tells the encoder how to convert output for encoding from the data nature that is used by the encoder to the data nature that is required by the method signature."/>
21.175 - </Properties>
21.176 - </Component>
21.177 - <Component class="javax.swing.JComboBox" name="jComboBoxPostencodeCoding">
21.178 - <Properties>
21.179 - <Property name="editable" type="boolean" value="true"/>
21.180 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
21.181 - <StringArray count="4">
21.182 - <StringItem index="0" value="Item 1"/>
21.183 - <StringItem index="1" value="Item 2"/>
21.184 - <StringItem index="2" value="Item 3"/>
21.185 - <StringItem index="3" value="Item 4"/>
21.186 - </StringArray>
21.187 - </Property>
21.188 - </Properties>
21.189 - </Component>
21.190 - <Component class="javax.swing.JCheckBox" name="jCheckBoxIgnore72ColBeyond">
21.191 - <Properties>
21.192 - <Property name="text" type="java.lang.String" value="Ignore content beyond 72 column"/>
21.193 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
21.194 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
21.195 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
21.196 - </Border>
21.197 - </Property>
21.198 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
21.199 - <Insets value="[0, 0, 0, 0]"/>
21.200 - </Property>
21.201 - </Properties>
21.202 - </Component>
21.203 - <Component class="javax.swing.JCheckBox" name="jCheckBoxCheckReservedWords">
21.204 - <Properties>
21.205 - <Property name="text" type="java.lang.String" value="Check names for reserved words"/>
21.206 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
21.207 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
21.208 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
21.209 - </Border>
21.210 - </Property>
21.211 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
21.212 - <Insets value="[0, 0, 0, 0]"/>
21.213 - </Property>
21.214 - </Properties>
21.215 - </Component>
21.216 - <Component class="javax.swing.JCheckBox" name="jCheckBoxOverwriteExisting">
21.217 - <Properties>
21.218 - <Property name="text" type="java.lang.String" value="Overwrite existing files with same name"/>
21.219 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
21.220 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
21.221 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
21.222 - </Border>
21.223 - </Property>
21.224 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
21.225 - <Insets value="[0, 0, 0, 0]"/>
21.226 - </Property>
21.227 - </Properties>
21.228 - </Component>
21.229 - <Component class="javax.swing.JLabel" name="jLabelTargetNamespace">
21.230 - <Properties>
21.231 - <Property name="text" type="java.lang.String" value="Target Namespace:"/>
21.232 - </Properties>
21.233 - </Component>
21.234 - <Component class="javax.swing.JTextField" name="jTextFieldTargetNamespace">
21.235 - </Component>
21.236 - </SubComponents>
21.237 -</Form>
22.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/GenerateXSDVisualPanel1.java Sat Sep 27 15:34:52 2008 -0700
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,296 +0,0 @@
22.4 -/*
22.5 - * The contents of this file are subject to the terms of the Common Development
22.6 - * and Distribution License (the License). You may not use this file except in
22.7 - * compliance with the License.
22.8 - *
22.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
22.10 - * or http://www.netbeans.org/cddl.txt.
22.11 - *
22.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
22.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
22.14 - * If applicable, add the following below the CDDL Header, with the fields
22.15 - * enclosed by brackets [] replaced by your own identifying information:
22.16 - * "Portions Copyrighted [year] [name of copyright owner]"
22.17 - *
22.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
22.19 - */
22.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
22.21 -
22.22 -import javax.swing.JComboBox;
22.23 -import javax.swing.JPanel;
22.24 -
22.25 -public final class GenerateXSDVisualPanel1 extends JPanel {
22.26 -
22.27 - /** Creates new form GenerateXSDVisualPanel1 */
22.28 - public GenerateXSDVisualPanel1() {
22.29 - initComponents();
22.30 - jComboBoxCopybookCodePage.setModel(new javax.swing.DefaultComboBoxModel());
22.31 - jComboBoxDISPLAY1CodePage.setModel(new javax.swing.DefaultComboBoxModel());
22.32 - jComboBoxDISPLAYCodePage.setModel(new javax.swing.DefaultComboBoxModel());
22.33 - jComboBoxPostencodeCoding.setModel(new javax.swing.DefaultComboBoxModel());
22.34 - jComboBoxPredecodeCoding.setModel(new javax.swing.DefaultComboBoxModel());
22.35 - }
22.36 -
22.37 - public String getName() {
22.38 - return "Specify Encoder Options";
22.39 - }
22.40 -
22.41 - public void setCopybookCodePageList(String[] list) {
22.42 - setComboBoxList(jComboBoxCopybookCodePage, list);
22.43 - }
22.44 -
22.45 - public void setCopybookCodePage(String cp) {
22.46 - jComboBoxCopybookCodePage.getEditor().setItem(cp);
22.47 - }
22.48 -
22.49 - public String getCopybookCodePage() {
22.50 - return jComboBoxCopybookCodePage.getEditor().getItem().toString();
22.51 - }
22.52 -
22.53 - public void setDisplayCodePageList(String[] list) {
22.54 - setComboBoxList(jComboBoxDISPLAYCodePage, list);
22.55 - }
22.56 -
22.57 - public void setDisplayCodePage(String cp) {
22.58 - jComboBoxDISPLAYCodePage.getEditor().setItem(cp);
22.59 - }
22.60 -
22.61 - public String getDisplayCodePage() {
22.62 - return jComboBoxDISPLAYCodePage.getEditor().getItem().toString();
22.63 - }
22.64 -
22.65 - public void setDisplay1CodePageList(String[] list) {
22.66 - setComboBoxList(jComboBoxDISPLAY1CodePage, list);
22.67 - }
22.68 -
22.69 - public void setDisplay1CodePage(String cp) {
22.70 - jComboBoxDISPLAY1CodePage.getEditor().setItem(cp);
22.71 - }
22.72 -
22.73 - public String getDisplay1CodePage() {
22.74 - return jComboBoxDISPLAY1CodePage.getEditor().getItem().toString();
22.75 - }
22.76 -
22.77 - public void setPredecodeCodingList(String[] list) {
22.78 - setComboBoxList(jComboBoxPredecodeCoding, list);
22.79 - }
22.80 -
22.81 - public void setPredecodeCoding(String cp) {
22.82 - jComboBoxPredecodeCoding.getEditor().setItem(cp);
22.83 - }
22.84 -
22.85 - public String getPredecodeCoding() {
22.86 - return jComboBoxPredecodeCoding.getEditor().getItem().toString();
22.87 - }
22.88 -
22.89 - public void setPostencodeCodingList(String[] list) {
22.90 - setComboBoxList(jComboBoxPostencodeCoding, list);
22.91 - }
22.92 -
22.93 - public void setPostencodeCoding(String cp) {
22.94 - jComboBoxPostencodeCoding.getEditor().setItem(cp);
22.95 - }
22.96 -
22.97 - public String getPostencodeCoding() {
22.98 - return jComboBoxPostencodeCoding.getEditor().getItem().toString();
22.99 - }
22.100 -
22.101 - public void setIgnore72ColBeyond(boolean val) {
22.102 - jCheckBoxIgnore72ColBeyond.setSelected(val);
22.103 - }
22.104 -
22.105 - public boolean getIgnore72ColBeyond() {
22.106 - return jCheckBoxIgnore72ColBeyond.isSelected();
22.107 - }
22.108 -
22.109 - public void setOverwriteExisting(boolean val) {
22.110 - jCheckBoxOverwriteExisting.setSelected(val);
22.111 - }
22.112 -
22.113 - public boolean getOverwriteExisting() {
22.114 - return jCheckBoxOverwriteExisting.isSelected();
22.115 - }
22.116 -
22.117 - public void setCheckReservedWords(boolean val) {
22.118 - jCheckBoxCheckReservedWords.setSelected(val);
22.119 - }
22.120 -
22.121 - public boolean getCheckReservedWords() {
22.122 - return jCheckBoxCheckReservedWords.isSelected();
22.123 - }
22.124 -
22.125 - public void setTargetNamespace(String val) {
22.126 - jTextFieldTargetNamespace.setText(val);
22.127 - }
22.128 -
22.129 - public String getTargetNamespace() {
22.130 - return jTextFieldTargetNamespace.getText();
22.131 - }
22.132 -
22.133 - /** This method is called from within the constructor to
22.134 - * initialize the form.
22.135 - * WARNING: Do NOT modify this code. The content of this method is
22.136 - * always regenerated by the Form Editor.
22.137 - */
22.138 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
22.139 - private void initComponents() {
22.140 -
22.141 - jLabelCopybookCodePage = new javax.swing.JLabel();
22.142 - jComboBoxCopybookCodePage = new javax.swing.JComboBox();
22.143 - jLabelDISPLAYCodePage = new javax.swing.JLabel();
22.144 - jComboBoxPredecodeCoding = new javax.swing.JComboBox();
22.145 - jLabelDISPLAY1CodePage = new javax.swing.JLabel();
22.146 - jComboBoxDISPLAYCodePage = new javax.swing.JComboBox();
22.147 - jLabelPredecodeCoding = new javax.swing.JLabel();
22.148 - jComboBoxDISPLAY1CodePage = new javax.swing.JComboBox();
22.149 - jLabelPostencodeCoding = new javax.swing.JLabel();
22.150 - jComboBoxPostencodeCoding = new javax.swing.JComboBox();
22.151 - jCheckBoxIgnore72ColBeyond = new javax.swing.JCheckBox();
22.152 - jCheckBoxCheckReservedWords = new javax.swing.JCheckBox();
22.153 - jCheckBoxOverwriteExisting = new javax.swing.JCheckBox();
22.154 - jLabelTargetNamespace = new javax.swing.JLabel();
22.155 - jTextFieldTargetNamespace = new javax.swing.JTextField();
22.156 -
22.157 - org.openide.awt.Mnemonics.setLocalizedText(jLabelCopybookCodePage, "Copybook Code Page:");
22.158 -
22.159 - jComboBoxCopybookCodePage.setEditable(true);
22.160 - jComboBoxCopybookCodePage.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
22.161 - jComboBoxCopybookCodePage.addActionListener(new java.awt.event.ActionListener() {
22.162 - public void actionPerformed(java.awt.event.ActionEvent evt) {
22.163 - jComboBoxCopybookCodePageActionPerformed(evt);
22.164 - }
22.165 - });
22.166 -
22.167 - org.openide.awt.Mnemonics.setLocalizedText(jLabelDISPLAYCodePage, "DISPLAY Code Page:");
22.168 -
22.169 - jComboBoxPredecodeCoding.setEditable(true);
22.170 - jComboBoxPredecodeCoding.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
22.171 -
22.172 - org.openide.awt.Mnemonics.setLocalizedText(jLabelDISPLAY1CodePage, "DISPLAY1 Code Page:");
22.173 -
22.174 - jComboBoxDISPLAYCodePage.setEditable(true);
22.175 - jComboBoxDISPLAYCodePage.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
22.176 -
22.177 - org.openide.awt.Mnemonics.setLocalizedText(jLabelPredecodeCoding, "Pre-decoding Char. Coding:");
22.178 - jLabelPredecodeCoding.setToolTipText("The coding tells the encoder how to convert input for decoding from the data nature that cannot be accepted by the encoder to the data nature that is acceptable by the encoder.");
22.179 -
22.180 - jComboBoxDISPLAY1CodePage.setEditable(true);
22.181 - jComboBoxDISPLAY1CodePage.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
22.182 -
22.183 - org.openide.awt.Mnemonics.setLocalizedText(jLabelPostencodeCoding, "Post-encoding Char. Coding:");
22.184 - jLabelPostencodeCoding.setToolTipText("The coding tells the encoder how to convert output for encoding from the data nature that is used by the encoder to the data nature that is required by the method signature.");
22.185 -
22.186 - jComboBoxPostencodeCoding.setEditable(true);
22.187 - jComboBoxPostencodeCoding.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
22.188 -
22.189 - org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxIgnore72ColBeyond, "Ignore content beyond 72 column");
22.190 - jCheckBoxIgnore72ColBeyond.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
22.191 - jCheckBoxIgnore72ColBeyond.setMargin(new java.awt.Insets(0, 0, 0, 0));
22.192 -
22.193 - org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxCheckReservedWords, "Check names for reserved words");
22.194 - jCheckBoxCheckReservedWords.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
22.195 - jCheckBoxCheckReservedWords.setMargin(new java.awt.Insets(0, 0, 0, 0));
22.196 -
22.197 - org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxOverwriteExisting, "Overwrite existing files with same name");
22.198 - jCheckBoxOverwriteExisting.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
22.199 - jCheckBoxOverwriteExisting.setMargin(new java.awt.Insets(0, 0, 0, 0));
22.200 -
22.201 - org.openide.awt.Mnemonics.setLocalizedText(jLabelTargetNamespace, "Target Namespace:");
22.202 -
22.203 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
22.204 - this.setLayout(layout);
22.205 - layout.setHorizontalGroup(
22.206 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
22.207 - .add(layout.createSequentialGroup()
22.208 - .addContainerGap()
22.209 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
22.210 - .add(jCheckBoxIgnore72ColBeyond)
22.211 - .add(jCheckBoxCheckReservedWords)
22.212 - .add(jCheckBoxOverwriteExisting)
22.213 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
22.214 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
22.215 - .add(jLabelCopybookCodePage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
22.216 - .add(jLabelDISPLAYCodePage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
22.217 - .add(jLabelDISPLAY1CodePage)
22.218 - .add(jLabelPredecodeCoding, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
22.219 - .add(jLabelPostencodeCoding, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
22.220 - .add(jLabelTargetNamespace, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
22.221 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
22.222 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
22.223 - .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBoxCopybookCodePage, 0, 287, Short.MAX_VALUE)
22.224 - .add(jComboBoxDISPLAYCodePage, 0, 287, Short.MAX_VALUE)
22.225 - .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBoxDISPLAY1CodePage, 0, 287, Short.MAX_VALUE)
22.226 - .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBoxPredecodeCoding, 0, 287, Short.MAX_VALUE)
22.227 - .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBoxPostencodeCoding, 0, 287, Short.MAX_VALUE)
22.228 - .add(jTextFieldTargetNamespace, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE))))
22.229 - .addContainerGap())
22.230 - );
22.231 - layout.setVerticalGroup(
22.232 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
22.233 - .add(layout.createSequentialGroup()
22.234 - .add(27, 27, 27)
22.235 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
22.236 - .add(jLabelCopybookCodePage)
22.237 - .add(jComboBoxCopybookCodePage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
22.238 - .add(9, 9, 9)
22.239 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
22.240 - .add(jComboBoxDISPLAYCodePage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
22.241 - .add(jLabelDISPLAYCodePage))
22.242 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
22.243 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
22.244 - .add(jComboBoxDISPLAY1CodePage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
22.245 - .add(jLabelDISPLAY1CodePage))
22.246 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
22.247 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
22.248 - .add(jComboBoxPredecodeCoding, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
22.249 - .add(jLabelPredecodeCoding))
22.250 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
22.251 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
22.252 - .add(jComboBoxPostencodeCoding, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
22.253 - .add(jLabelPostencodeCoding))
22.254 - .add(15, 15, 15)
22.255 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
22.256 - .add(jLabelTargetNamespace)
22.257 - .add(jTextFieldTargetNamespace, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
22.258 - .add(16, 16, 16)
22.259 - .add(jCheckBoxIgnore72ColBeyond)
22.260 - .add(18, 18, 18)
22.261 - .add(jCheckBoxCheckReservedWords)
22.262 - .add(18, 18, 18)
22.263 - .add(jCheckBoxOverwriteExisting)
22.264 - .addContainerGap(26, Short.MAX_VALUE))
22.265 - );
22.266 - }// </editor-fold>//GEN-END:initComponents
22.267 -
22.268 - private void jComboBoxCopybookCodePageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxCopybookCodePageActionPerformed
22.269 - // TODO add your handling code here:
22.270 -}//GEN-LAST:event_jComboBoxCopybookCodePageActionPerformed
22.271 -
22.272 - private void setComboBoxList(JComboBox comboBox, String[] list) {
22.273 - comboBox.removeAllItems();
22.274 - for (int i = 0; i < list.length; i++) {
22.275 - comboBox.addItem(list[i]);
22.276 - }
22.277 - comboBox.setSelectedIndex(-1);
22.278 - }
22.279 -
22.280 - // Variables declaration - do not modify//GEN-BEGIN:variables
22.281 - private javax.swing.JCheckBox jCheckBoxCheckReservedWords;
22.282 - private javax.swing.JCheckBox jCheckBoxIgnore72ColBeyond;
22.283 - private javax.swing.JCheckBox jCheckBoxOverwriteExisting;
22.284 - private javax.swing.JComboBox jComboBoxCopybookCodePage;
22.285 - private javax.swing.JComboBox jComboBoxDISPLAY1CodePage;
22.286 - private javax.swing.JComboBox jComboBoxDISPLAYCodePage;
22.287 - private javax.swing.JComboBox jComboBoxPostencodeCoding;
22.288 - private javax.swing.JComboBox jComboBoxPredecodeCoding;
22.289 - private javax.swing.JLabel jLabelCopybookCodePage;
22.290 - private javax.swing.JLabel jLabelDISPLAY1CodePage;
22.291 - private javax.swing.JLabel jLabelDISPLAYCodePage;
22.292 - private javax.swing.JLabel jLabelPostencodeCoding;
22.293 - private javax.swing.JLabel jLabelPredecodeCoding;
22.294 - private javax.swing.JLabel jLabelTargetNamespace;
22.295 - private javax.swing.JTextField jTextFieldTargetNamespace;
22.296 - // End of variables declaration//GEN-END:variables
22.297 -
22.298 -}
22.299 -
23.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/GenerateXSDWizardAction.java Sat Sep 27 15:34:52 2008 -0700
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,181 +0,0 @@
23.4 -/*
23.5 - * The contents of this file are subject to the terms of the Common Development
23.6 - * and Distribution License (the License). You may not use this file except in
23.7 - * compliance with the License.
23.8 - *
23.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
23.10 - * or http://www.netbeans.org/cddl.txt.
23.11 - *
23.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
23.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
23.14 - * If applicable, add the following below the CDDL Header, with the fields
23.15 - * enclosed by brackets [] replaced by your own identifying information:
23.16 - * "Portions Copyrighted [year] [name of copyright owner]"
23.17 - *
23.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
23.19 - */
23.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
23.21 -
23.22 -import com.sun.encoder.coco.xsdbuilder.CocoXsdBuilder;
23.23 -import com.sun.encoder.coco.xsdbuilder.CocoXsdBuilderException;
23.24 -import com.sun.encoder.coco.xsdbuilder.CocoXsdBuilderSpec;
23.25 -import java.awt.Component;
23.26 -import java.awt.Dialog;
23.27 -import java.io.File;
23.28 -import java.io.IOException;
23.29 -import java.text.MessageFormat;
23.30 -import java.util.Set;
23.31 -import javax.swing.JComponent;
23.32 -import javax.swing.JOptionPane;
23.33 -import javax.swing.JScrollPane;
23.34 -import org.openide.DialogDisplayer;
23.35 -import org.openide.ErrorManager;
23.36 -import org.openide.WizardDescriptor;
23.37 -import org.openide.cookies.EditCookie;
23.38 -import org.openide.filesystems.FileObject;
23.39 -import org.openide.filesystems.FileUtil;
23.40 -import org.openide.loaders.DataLoaderPool;
23.41 -import org.openide.loaders.DataObject;
23.42 -import org.openide.nodes.Node;
23.43 -import org.openide.util.Exceptions;
23.44 -import org.openide.util.HelpCtx;
23.45 -import org.openide.util.actions.CallableSystemAction;
23.46 -
23.47 -// An example action demonstrating how the wizard could be called from within
23.48 -import org.openide.util.actions.NodeAction;
23.49 -// your code. You can copy-paste the code below wherever you need.
23.50 -public final class GenerateXSDWizardAction extends NodeAction {
23.51 -
23.52 - private WizardDescriptor.Panel[] panels;
23.53 -
23.54 - /**
23.55 - * Initialize panels representing individual wizard's steps and sets
23.56 - * various properties for them influencing wizard appearance.
23.57 - */
23.58 - private WizardDescriptor.Panel[] getPanels() {
23.59 - if (panels == null) {
23.60 - panels = new WizardDescriptor.Panel[] {
23.61 - new GenerateXSDWizardPanel1()
23.62 - };
23.63 - String[] steps = new String[panels.length];
23.64 - for (int i = 0; i < panels.length; i++) {
23.65 - Component c = panels[i].getComponent();
23.66 - // Default step name to component name of panel. Mainly useful
23.67 - // for getting the name of the target chooser to appear in the
23.68 - // list of steps.
23.69 - steps[i] = c.getName();
23.70 - if (c instanceof JComponent) { // assume Swing components
23.71 - JComponent jc = (JComponent) c;
23.72 - // Sets step number of a component
23.73 - jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
23.74 - // Sets steps names for a panel
23.75 - jc.putClientProperty("WizardPanel_contentData", steps);
23.76 - // Turn on subtitle creation on each step
23.77 - jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
23.78 - // Show steps on the left side with the image on the background
23.79 - jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
23.80 - // Turn on numbering of all steps
23.81 - jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
23.82 - }
23.83 - }
23.84 - }
23.85 - return panels;
23.86 - }
23.87 -
23.88 - public String getName() {
23.89 - return "Generate Encoder Definition XSD...";
23.90 - }
23.91 -
23.92 - public String iconResource() {
23.93 - return null;
23.94 - }
23.95 -
23.96 - public HelpCtx getHelpCtx() {
23.97 - return HelpCtx.DEFAULT_HELP;
23.98 - }
23.99 -
23.100 - protected boolean asynchronous() {
23.101 - return false;
23.102 - }
23.103 -
23.104 - protected void performAction(Node[] activatedNodes) {
23.105 - WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
23.106 - // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
23.107 - wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
23.108 - wizardDescriptor.setTitle("Generate Encoder Definition XSD");
23.109 - DataObject dobj = activatedNodes[0].getCookie(DataObject.class);
23.110 - Set<FileObject> files = dobj.files();
23.111 - FileObject fileObj = files.iterator().next();
23.112 - File cpyFile = new File(FileUtil.toFile(fileObj).getPath());
23.113 - wizardDescriptor.putProperty(PropertyKey.CURRENT_FOLDER, fileObj.getParent());
23.114 - wizardDescriptor.putProperty(PropertyKey.CURRENT_FILE_NAME, cpyFile.getName());
23.115 - Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
23.116 - dialog.setVisible(true);
23.117 - dialog.toFront();
23.118 - boolean cancelled =
23.119 - wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
23.120 - if (!cancelled) {
23.121 - String xsdFileName = cpyFile.getAbsolutePath();
23.122 - String xsdFileNameOnly =
23.123 - xsdFileName.substring(0, xsdFileName.length() - ".cpy".length());
23.124 - xsdFileName = xsdFileNameOnly + ".xsd";
23.125 - java.io.File xsdFile = new java.io.File(xsdFileName);
23.126 - boolean overwrite =
23.127 - (Boolean) wizardDescriptor.getProperty(PropertyKey.OVERWRITE_EXIST);
23.128 - if (!overwrite) {
23.129 - int i = 1;
23.130 - while (xsdFile.exists()) {
23.131 - xsdFile = new java.io.File(xsdFileNameOnly + (i++) + ".xsd");
23.132 - }
23.133 - }
23.134 - String copybookCodePage =
23.135 - (String) wizardDescriptor.getProperty(PropertyKey.COPYBOOK_CODEPAGE);
23.136 - String displayCodePage =
23.137 - (String) wizardDescriptor.getProperty(PropertyKey.DISPLAY_CODEPAGE);
23.138 - String display1CodePage =
23.139 - (String) wizardDescriptor.getProperty(PropertyKey.DISPLAY1_CODEPAGE);
23.140 - String predecodeCoding =
23.141 - (String) wizardDescriptor.getProperty(PropertyKey.PREDECODE_CODING);
23.142 - String postencodeCoding =
23.143 - (String) wizardDescriptor.getProperty(PropertyKey.POSTENCODE_CODING);
23.144 - boolean checkReservedWords =
23.145 - (Boolean) wizardDescriptor.getProperty(PropertyKey.CHECK_RESERVED_WORDS);
23.146 - boolean ignoreCol72Beyond =
23.147 - (Boolean) wizardDescriptor.getProperty(PropertyKey.IGNORE_72_COL_BEYOND);
23.148 - String targetNamespace = (String) wizardDescriptor.getProperty(PropertyKey.TARGET_NAMESPACE);
23.149 - CocoXsdBuilderSpec spec = new CocoXsdBuilderSpec();
23.150 - spec.setCopybookLocation(cpyFile.getAbsolutePath());
23.151 - spec.setXsdLocation(xsdFile.getAbsolutePath());
23.152 - spec.setTargetNamespace(targetNamespace);
23.153 - spec.setCopybookCharEncoding(copybookCodePage);
23.154 - spec.setDisplayCharEncoding(displayCodePage);
23.155 - spec.setDisplay1CharEncoding(display1CodePage);
23.156 - spec.setPreDecodeCharCoding(predecodeCoding);
23.157 - spec.setPostEncodeCharCoding(postencodeCoding);
23.158 - spec.setCheckNamesForReservedWords(checkReservedWords);
23.159 - spec.setIgnoreContentBeyondCol72(ignoreCol72Beyond);
23.160 - CocoXsdBuilder builder = new CocoXsdBuilder(spec);
23.161 - try {
23.162 - builder.buildXsd();
23.163 - DataObject dObj =
23.164 - DataLoaderPool.getDefault().
23.165 - findDataObject(FileUtil.toFileObject(xsdFile));
23.166 - if (dObj != null) {
23.167 - EditCookie edit = (EditCookie) dObj.getCookie(EditCookie.class);
23.168 - if (edit != null) {
23.169 - edit.edit();
23.170 - }
23.171 - }
23.172 - } catch (CocoXsdBuilderException ex) {
23.173 - ErrorManager.getDefault().notify(ErrorManager.ERROR, ex);
23.174 - } catch (IOException ex) {
23.175 - ErrorManager.getDefault().notify(ErrorManager.ERROR, ex);
23.176 - }
23.177 - }
23.178 - }
23.179 -
23.180 - protected boolean enable(Node[] activatedNodes) {
23.181 - return true;
23.182 - }
23.183 -}
23.184 -
24.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/GenerateXSDWizardPanel1.java Sat Sep 27 15:34:52 2008 -0700
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,147 +0,0 @@
24.4 -/*
24.5 - * The contents of this file are subject to the terms of the Common Development
24.6 - * and Distribution License (the License). You may not use this file except in
24.7 - * compliance with the License.
24.8 - *
24.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
24.10 - * or http://www.netbeans.org/cddl.txt.
24.11 - *
24.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
24.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
24.14 - * If applicable, add the following below the CDDL Header, with the fields
24.15 - * enclosed by brackets [] replaced by your own identifying information:
24.16 - * "Portions Copyrighted [year] [name of copyright owner]"
24.17 - *
24.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
24.19 - */
24.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
24.21 -
24.22 -import java.awt.Component;
24.23 -import java.nio.charset.Charset;
24.24 -import java.util.ArrayList;
24.25 -import java.util.HashSet;
24.26 -import java.util.Iterator;
24.27 -import java.util.List;
24.28 -import java.util.Map;
24.29 -import java.util.Set;
24.30 -import javax.swing.event.ChangeEvent;
24.31 -import javax.swing.event.ChangeListener;
24.32 -import org.netbeans.modules.encoder.ui.basic.Utils;
24.33 -import org.openide.WizardDescriptor;
24.34 -import org.openide.util.HelpCtx;
24.35 -
24.36 -public class GenerateXSDWizardPanel1 implements WizardDescriptor.Panel {
24.37 -
24.38 - private static final String[] CHARSET_NAMES = Utils.getCharsetNames(false);
24.39 - private static final String[] CHARSET_NAMES_EXTRA = Utils.getCharsetNames(true);
24.40 -
24.41 - /**
24.42 - * The visual component that displays this panel. If you need to access the
24.43 - * component from this class, just use getComponent().
24.44 - */
24.45 - private GenerateXSDVisualPanel1 component;
24.46 -
24.47 - private String copybookName;
24.48 -
24.49 - // Get the visual component for the panel. In this template, the component
24.50 - // is kept separate. This can be more efficient: if the wizard is created
24.51 - // but never displayed, or not all panels are displayed, it is better to
24.52 - // create only those which really need to be visible.
24.53 - public Component getComponent() {
24.54 - if (component == null) {
24.55 - component = new GenerateXSDVisualPanel1();
24.56 - component.setCopybookCodePageList(CHARSET_NAMES);
24.57 - component.setCopybookCodePage("ASCII"); //NOI18N
24.58 - component.setDisplayCodePageList(CHARSET_NAMES);
24.59 - component.setDisplayCodePage("IBM037");
24.60 - component.setDisplay1CodePageList(CHARSET_NAMES);
24.61 - component.setPredecodeCodingList(CHARSET_NAMES_EXTRA);
24.62 - component.setPostencodeCodingList(CHARSET_NAMES_EXTRA);
24.63 - component.setCheckReservedWords(true);
24.64 - component.setIgnore72ColBeyond(true);
24.65 - component.setOverwriteExisting(true);
24.66 - }
24.67 - return component;
24.68 - }
24.69 -
24.70 - public HelpCtx getHelp() {
24.71 - // Show no Help button for this panel:
24.72 - return HelpCtx.DEFAULT_HELP;
24.73 - // If you have context help:
24.74 - // return new HelpCtx(SampleWizardPanel1.class);
24.75 - }
24.76 -
24.77 - public boolean isValid() {
24.78 - // If it is always OK to press Next or Finish, then:
24.79 - return true;
24.80 - // If it depends on some condition (form filled out...), then:
24.81 - // return someCondition();
24.82 - // and when this condition changes (last form field filled in...) then:
24.83 - // fireChangeEvent();
24.84 - // and uncomment the complicated stuff below.
24.85 - }
24.86 -
24.87 - private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
24.88 -
24.89 - public final void addChangeListener(ChangeListener l) {
24.90 - synchronized (listeners) {
24.91 - listeners.add(l);
24.92 - }
24.93 - }
24.94 -
24.95 - public final void removeChangeListener(ChangeListener l) {
24.96 - synchronized (listeners) {
24.97 - listeners.remove(l);
24.98 - }
24.99 - }
24.100 -
24.101 - protected final void fireChangeEvent() {
24.102 - Iterator<ChangeListener> it;
24.103 - synchronized (listeners) {
24.104 - it = new HashSet<ChangeListener>(listeners).iterator();
24.105 - }
24.106 - ChangeEvent ev = new ChangeEvent(this);
24.107 - while (it.hasNext()) {
24.108 - it.next().stateChanged(ev);
24.109 - }
24.110 - }
24.111 -
24.112 - // You can use a settings object to keep track of state. Normally the
24.113 - // settings object will be the WizardDescriptor, so you can use
24.114 - // WizardDescriptor.getProperty & putProperty to store information entered
24.115 - // by the user.
24.116 - public void readSettings(Object settings) {
24.117 - copybookName =
24.118 - (String) ((WizardDescriptor) settings).getProperty(
24.119 - PropertyKey.CURRENT_FILE_NAME);
24.120 - if (copybookName != null && copybookName.endsWith(".cpy")) {
24.121 - copybookName =
24.122 - copybookName.substring(
24.123 - 0, copybookName.length() - ".cpy".length());
24.124 - }
24.125 - component.setTargetNamespace(
24.126 - "http://encoder.netbeans.org/coco/" + copybookName);
24.127 - }
24.128 -
24.129 - public void storeSettings(Object settings) {
24.130 - WizardDescriptor wd = (WizardDescriptor) settings;
24.131 - wd.putProperty(PropertyKey.COPYBOOK_CODEPAGE,
24.132 - component.getCopybookCodePage());
24.133 - wd.putProperty(PropertyKey.DISPLAY_CODEPAGE,
24.134 - component.getDisplayCodePage());
24.135 - wd.putProperty(PropertyKey.DISPLAY1_CODEPAGE,
24.136 - component.getDisplay1CodePage());
24.137 - wd.putProperty(PropertyKey.PREDECODE_CODING,
24.138 - component.getPredecodeCoding());
24.139 - wd.putProperty(PropertyKey.POSTENCODE_CODING,
24.140 - component.getPostencodeCoding());
24.141 - wd.putProperty(PropertyKey.CHECK_RESERVED_WORDS,
24.142 - component.getCheckReservedWords());
24.143 - wd.putProperty(PropertyKey.IGNORE_72_COL_BEYOND,
24.144 - component.getIgnore72ColBeyond());
24.145 - wd.putProperty(PropertyKey.OVERWRITE_EXIST,
24.146 - component.getOverwriteExisting());
24.147 - wd.putProperty(PropertyKey.TARGET_NAMESPACE,
24.148 - component.getTargetNamespace());
24.149 - }
24.150 -}
25.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/PropertyKey.java Sat Sep 27 15:34:52 2008 -0700
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,75 +0,0 @@
25.4 -/*
25.5 - * The contents of this file are subject to the terms of the Common Development
25.6 - * and Distribution License (the License). You may not use this file except in
25.7 - * compliance with the License.
25.8 - *
25.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
25.10 - * or http://www.netbeans.org/cddl.txt.
25.11 - *
25.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
25.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
25.14 - * If applicable, add the following below the CDDL Header, with the fields
25.15 - * enclosed by brackets [] replaced by your own identifying information:
25.16 - * "Portions Copyrighted [year] [name of copyright owner]"
25.17 - *
25.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
25.19 - */
25.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
25.21 -
25.22 -/**
25.23 - * Constants used as the keys for identifying wizard properties.
25.24 - *
25.25 - * @author Jun Xu
25.26 - */
25.27 -public interface PropertyKey {
25.28 -
25.29 - /*************************
25.30 - * Systematic Properties *
25.31 - *************************/
25.32 - /**
25.33 - * Property key for identifying the Current Project property. The value
25.34 - * is an instance of <code>Project</code>.
25.35 - */
25.36 - static final String CURRENT_PROJECT = "current_project";
25.37 -
25.38 - /**
25.39 - * Property key for identifying the Current Folder property. The value
25.40 - * is an instance of <code>FileObject</code>.
25.41 - */
25.42 - static final String CURRENT_FOLDER = "current_folder";
25.43 -
25.44 - /**
25.45 - * Property key for identifying the Current File Name property. The value
25.46 - * is an instance of <code>java.lang.String</code>. It is only a name
25.47 - * of the file, not including any path.
25.48 - */
25.49 - static final String CURRENT_FILE_NAME = "current_file_name";
25.50 -
25.51 -
25.52 - /*****************************
25.53 - * Properties for the Panels *
25.54 - *****************************/
25.55 - static final String SOURCE_TYPE = "source_type";
25.56 -
25.57 - static final String SOURCE_LOCATION = "source_location";
25.58 -
25.59 - static final String TARGET_FOLDER = "target_folder";
25.60 -
25.61 - static final String OVERWRITE_EXIST = "overwrite_exist";
25.62 -
25.63 - static final String COPYBOOK_CODEPAGE = "copybook_codepage";
25.64 -
25.65 - static final String DISPLAY_CODEPAGE = "display_codepage";
25.66 -
25.67 - static final String DISPLAY1_CODEPAGE = "display1_codepage";
25.68 -
25.69 - static final String PREDECODE_CODING = "predecode_coding";
25.70 -
25.71 - static final String POSTENCODE_CODING = "postencode_coding";
25.72 -
25.73 - static final String TARGET_NAMESPACE = "target_namespace";
25.74 -
25.75 - static final String IGNORE_72_COL_BEYOND = "ignore_72_col_beyond";
25.76 -
25.77 - static final String CHECK_RESERVED_WORDS = "check_reserved_words";
25.78 -}
26.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/PropertyValue.java Sat Sep 27 15:34:52 2008 -0700
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,40 +0,0 @@
26.4 -/*
26.5 - * The contents of this file are subject to the terms of the Common Development
26.6 - * and Distribution License (the License). You may not use this file except in
26.7 - * compliance with the License.
26.8 - *
26.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
26.10 - * or http://www.netbeans.org/cddl.txt.
26.11 - *
26.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
26.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
26.14 - * If applicable, add the following below the CDDL Header, with the fields
26.15 - * enclosed by brackets [] replaced by your own identifying information:
26.16 - * "Portions Copyrighted [year] [name of copyright owner]"
26.17 - *
26.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
26.19 - */
26.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
26.21 -
26.22 -/**
26.23 - * Constants for enumerated property valeus.
26.24 - *
26.25 - * @author Jun Xu
26.26 - */
26.27 -public enum PropertyValue {
26.28 -
26.29 - /**
26.30 - * Source type is From URL
26.31 - */
26.32 - FROM_URL,
26.33 -
26.34 - /**
26.35 - * Source type is From File
26.36 - */
26.37 - FROM_FILE,
26.38 -
26.39 - /**
26.40 - * Unknown source type
26.41 - */
26.42 - UNKNOWN_SOURCE_TYPE
26.43 -}
27.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/RetrieveCopybookVisualPanel1.form Sat Sep 27 15:34:52 2008 -0700
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,209 +0,0 @@
27.4 -<?xml version="1.0" encoding="UTF-8" ?>
27.5 -
27.6 -<Form version="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
27.7 - <NonVisualComponents>
27.8 - <Component class="javax.swing.ButtonGroup" name="sourceTypeButtonGroup">
27.9 - </Component>
27.10 - </NonVisualComponents>
27.11 - <Properties>
27.12 - <Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
27.13 - <ResourceString bundle="org/netbeans/modules/encoder/coco/ui/retriever/Bundle.properties" key="RetrieveCopybookVisualPanel1.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
27.14 - </Property>
27.15 - </Properties>
27.16 - <AuxValues>
27.17 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
27.18 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
27.19 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
27.20 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
27.21 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
27.22 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
27.23 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
27.24 - </AuxValues>
27.25 -
27.26 - <Layout>
27.27 - <DimensionLayout dim="0">
27.28 - <Group type="103" groupAlignment="0" attributes="0">
27.29 - <Group type="102" alignment="1" attributes="0">
27.30 - <EmptySpace max="-2" attributes="0"/>
27.31 - <Group type="103" groupAlignment="1" attributes="0">
27.32 - <Component id="jLabelSpecifySource" alignment="0" min="-2" pref="104" max="-2" attributes="0"/>
27.33 - <Component id="jRadioFromURL" alignment="0" min="-2" max="-2" attributes="0"/>
27.34 - <Component id="jRadioFromFile" alignment="0" min="-2" max="-2" attributes="0"/>
27.35 - <Component id="jCheckBoxOverwrite" alignment="0" min="-2" pref="224" max="-2" attributes="0"/>
27.36 - <Group type="102" alignment="0" attributes="0">
27.37 - <Group type="103" groupAlignment="1" attributes="0">
27.38 - <Component id="jTextTargetFolder" pref="414" max="32767" attributes="1"/>
27.39 - <Component id="jTextFileLocation" alignment="1" pref="414" max="32767" attributes="1"/>
27.40 - </Group>
27.41 - <EmptySpace max="-2" attributes="0"/>
27.42 - <Component id="jLabelSaveToFolder" min="-2" max="-2" attributes="0"/>
27.43 - <EmptySpace pref="10" max="-2" attributes="0"/>
27.44 - <Group type="103" groupAlignment="1" attributes="0">
27.45 - <Component id="jButtonBrowseSource" min="-2" max="-2" attributes="0"/>
27.46 - <Component id="jButtonBrowseTarget" alignment="1" min="-2" max="-2" attributes="0"/>
27.47 - </Group>
27.48 - </Group>
27.49 - <Component id="jTextURL" alignment="0" pref="495" max="32767" attributes="1"/>
27.50 - <Group type="102" alignment="0" attributes="0">
27.51 - <Component id="jLabelSpecifyTarget" min="-2" pref="102" max="-2" attributes="0"/>
27.52 - <EmptySpace pref="393" max="32767" attributes="0"/>
27.53 - </Group>
27.54 - </Group>
27.55 - <EmptySpace max="-2" attributes="0"/>
27.56 - </Group>
27.57 - </Group>
27.58 - </DimensionLayout>
27.59 - <DimensionLayout dim="1">
27.60 - <Group type="103" groupAlignment="0" attributes="0">
27.61 - <Group type="102" alignment="0" attributes="0">
27.62 - <Component id="jLabelSpecifySource" min="-2" max="-2" attributes="0"/>
27.63 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
27.64 - <Component id="jRadioFromURL" min="-2" max="-2" attributes="0"/>
27.65 - <EmptySpace max="-2" attributes="0"/>
27.66 - <Component id="jTextURL" min="-2" max="-2" attributes="0"/>
27.67 - <EmptySpace max="-2" attributes="0"/>
27.68 - <Component id="jRadioFromFile" min="-2" max="-2" attributes="0"/>
27.69 - <EmptySpace max="-2" attributes="0"/>
27.70 - <Group type="103" groupAlignment="3" attributes="0">
27.71 - <Component id="jButtonBrowseSource" alignment="3" min="-2" max="-2" attributes="0"/>
27.72 - <Component id="jTextFileLocation" alignment="3" min="-2" max="-2" attributes="0"/>
27.73 - </Group>
27.74 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
27.75 - <Component id="jLabelSpecifyTarget" min="-2" max="-2" attributes="0"/>
27.76 - <Group type="103" groupAlignment="0" attributes="0">
27.77 - <Group type="102" attributes="0">
27.78 - <EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
27.79 - <Component id="jLabelSaveToFolder" min="-2" max="-2" attributes="0"/>
27.80 - </Group>
27.81 - <Group type="102" attributes="0">
27.82 - <EmptySpace max="-2" attributes="0"/>
27.83 - <Group type="103" groupAlignment="3" attributes="0">
27.84 - <Component id="jButtonBrowseTarget" alignment="3" min="-2" max="-2" attributes="0"/>
27.85 - <Component id="jTextTargetFolder" alignment="3" min="-2" max="-2" attributes="0"/>
27.86 - </Group>
27.87 - </Group>
27.88 - </Group>
27.89 - <EmptySpace max="-2" attributes="0"/>
27.90 - <Component id="jCheckBoxOverwrite" min="-2" max="-2" attributes="0"/>
27.91 - <EmptySpace pref="16" max="32767" attributes="0"/>
27.92 - </Group>
27.93 - </Group>
27.94 - </DimensionLayout>
27.95 - </Layout>
27.96 - <SubComponents>
27.97 - <Component class="javax.swing.JLabel" name="jLabelSpecifySource">
27.98 - <Properties>
27.99 - <Property name="text" type="java.lang.String" value="Specify Source"/>
27.100 - <Property name="name" type="java.lang.String" value="lblSpecifySource" noResource="true"/>
27.101 - </Properties>
27.102 - </Component>
27.103 - <Component class="javax.swing.JRadioButton" name="jRadioFromURL">
27.104 - <Properties>
27.105 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
27.106 - <ComponentRef name="sourceTypeButtonGroup"/>
27.107 - </Property>
27.108 - <Property name="selected" type="boolean" value="true"/>
27.109 - <Property name="text" type="java.lang.String" value="From URL"/>
27.110 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
27.111 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
27.112 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
27.113 - </Border>
27.114 - </Property>
27.115 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
27.116 - <Insets value="[0, 0, 0, 0]"/>
27.117 - </Property>
27.118 - </Properties>
27.119 - <AccessibilityProperties>
27.120 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
27.121 - <ResourceString bundle="org/netbeans/modules/encoder/coco/ui/retriever/Bundle.properties" key="RetrieveCopybookVisualPanel1.jRadioFromURL.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
27.122 - </Property>
27.123 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
27.124 - <ResourceString bundle="org/netbeans/modules/encoder/coco/ui/retriever/Bundle.properties" key="RetrieveCopybookVisualPanel1.jRadioFromURL.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
27.125 - </Property>
27.126 - </AccessibilityProperties>
27.127 - <Events>
27.128 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioFromURLActionPerformed"/>
27.129 - </Events>
27.130 - </Component>
27.131 - <Component class="javax.swing.JTextField" name="jTextURL">
27.132 - <Properties>
27.133 - <Property name="text" type="java.lang.String" value="null"/>
27.134 - </Properties>
27.135 - <Events>
27.136 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextURLActionPerformed"/>
27.137 - </Events>
27.138 - </Component>
27.139 - <Component class="javax.swing.JRadioButton" name="jRadioFromFile">
27.140 - <Properties>
27.141 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
27.142 - <ComponentRef name="sourceTypeButtonGroup"/>
27.143 - </Property>
27.144 - <Property name="text" type="java.lang.String" value="From Local File System"/>
27.145 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
27.146 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
27.147 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
27.148 - </Border>
27.149 - </Property>
27.150 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
27.151 - <Insets value="[0, 0, 0, 0]"/>
27.152 - </Property>
27.153 - </Properties>
27.154 - <Events>
27.155 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioFromFileActionPerformed"/>
27.156 - </Events>
27.157 - </Component>
27.158 - <Component class="javax.swing.JTextField" name="jTextFileLocation">
27.159 - <Properties>
27.160 - <Property name="text" type="java.lang.String" value="null"/>
27.161 - </Properties>
27.162 - <Events>
27.163 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextFileLocationActionPerformed"/>
27.164 - </Events>
27.165 - </Component>
27.166 - <Component class="javax.swing.JButton" name="jButtonBrowseSource">
27.167 - <Properties>
27.168 - <Property name="text" type="java.lang.String" value="Browse"/>
27.169 - </Properties>
27.170 - <Events>
27.171 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonBrowseSourceActionPerformed"/>
27.172 - </Events>
27.173 - </Component>
27.174 - <Component class="javax.swing.JLabel" name="jLabelSpecifyTarget">
27.175 - <Properties>
27.176 - <Property name="text" type="java.lang.String" value="Specify Target"/>
27.177 - </Properties>
27.178 - </Component>
27.179 - <Component class="javax.swing.JLabel" name="jLabelSaveToFolder">
27.180 - <Properties>
27.181 - <Property name="text" type="java.lang.String" value="null"/>
27.182 - </Properties>
27.183 - </Component>
27.184 - <Component class="javax.swing.JTextField" name="jTextTargetFolder">
27.185 - <Properties>
27.186 - <Property name="editable" type="boolean" value="false"/>
27.187 - <Property name="text" type="java.lang.String" value="null"/>
27.188 - </Properties>
27.189 - </Component>
27.190 - <Component class="javax.swing.JButton" name="jButtonBrowseTarget">
27.191 - <Properties>
27.192 - <Property name="text" type="java.lang.String" value="Browse"/>
27.193 - </Properties>
27.194 - <Events>
27.195 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonBrowseTargetActionPerformed"/>
27.196 - </Events>
27.197 - </Component>
27.198 - <Component class="javax.swing.JCheckBox" name="jCheckBoxOverwrite">
27.199 - <Properties>
27.200 - <Property name="text" type="java.lang.String" value="Overwrite existing files with same name"/>
27.201 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
27.202 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
27.203 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
27.204 - </Border>
27.205 - </Property>
27.206 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
27.207 - <Insets value="[0, 0, 0, 0]"/>
27.208 - </Property>
27.209 - </Properties>
27.210 - </Component>
27.211 - </SubComponents>
27.212 -</Form>
28.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/RetrieveCopybookVisualPanel1.java Sat Sep 27 15:34:52 2008 -0700
28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
28.3 @@ -1,327 +0,0 @@
28.4 -/*
28.5 - * RetrieveCopybookVisualPanel1.java
28.6 - *
28.7 - * Created on July 5, 2007, 2:01 PM
28.8 - */
28.9 -
28.10 -package org.netbeans.modules.encoder.coco.ui.wizard;
28.11 -
28.12 -import java.io.File;
28.13 -import java.util.HashSet;
28.14 -import java.util.Set;
28.15 -import javax.swing.JFileChooser;
28.16 -import javax.swing.JTextField;
28.17 -import javax.swing.event.ChangeEvent;
28.18 -import javax.swing.event.ChangeListener;
28.19 -import javax.swing.filechooser.FileFilter;
28.20 -import org.openide.WizardDescriptor;
28.21 -
28.22 -/**
28.23 - * The visual panel of the first step of the wizard.
28.24 - *
28.25 - * @author Jun Xu
28.26 - */
28.27 -public class RetrieveCopybookVisualPanel1 extends javax.swing.JPanel {
28.28 -
28.29 - private final RetrieveCopybookWizardPanel1 mEnclosing;
28.30 - private final Set<ChangeListener> mChangeListener;
28.31 -
28.32 - /** Creates new form RetrieveCopybookVisualPanel1 */
28.33 - public RetrieveCopybookVisualPanel1(RetrieveCopybookWizardPanel1 enclosing) {
28.34 - mEnclosing = enclosing;
28.35 - mChangeListener = new HashSet<ChangeListener>();
28.36 - initComponents();
28.37 - }
28.38 -
28.39 - @Override
28.40 - public String getName() {
28.41 - return "Specify Resource Location";
28.42 - }
28.43 -
28.44 - public void addChangeListener(ChangeListener listener) {
28.45 - synchronized(mChangeListener) {
28.46 - mChangeListener.add(listener);
28.47 - }
28.48 - }
28.49 -
28.50 - public void removeChangeListener(ChangeListener listener) {
28.51 - synchronized(mChangeListener) {
28.52 - mChangeListener.remove(listener);
28.53 - }
28.54 - }
28.55 -
28.56 - public void notifyStateChange() {
28.57 - ChangeListener[] listeners =
28.58 - mChangeListener.toArray(new ChangeListener[0]);
28.59 - ChangeEvent e = new ChangeEvent(this);
28.60 - for (int i = 0; i < listeners.length; i++) {
28.61 - listeners[i].stateChanged(e);
28.62 - }
28.63 - }
28.64 -
28.65 - public String getTargetFolder() {
28.66 - return jTextTargetFolder.getText();
28.67 - }
28.68 - /**
28.69 - * Sets the target location.
28.70 - */
28.71 - public void setTargetLocation(String targetLocation) {
28.72 - jTextTargetFolder.setText(targetLocation);
28.73 - }
28.74 -
28.75 - public PropertyValue getSourceType() {
28.76 - if (jRadioFromFile.isSelected()) {
28.77 - return PropertyValue.FROM_FILE;
28.78 - } else if (jRadioFromURL.isSelected()) {
28.79 - return PropertyValue.FROM_URL;
28.80 - }
28.81 - return PropertyValue.UNKNOWN_SOURCE_TYPE;
28.82 - }
28.83 -
28.84 - /**
28.85 - * Sets the source type.
28.86 - *
28.87 - * @param sourceType the source type. Values should be the strings
28.88 - * defined in <code>PropertyValues</code>.
28.89 - */
28.90 - public void setSourceType(PropertyValue sourceType) {
28.91 - if (PropertyValue.FROM_FILE.equals(sourceType)) {
28.92 - jTextURL.setEnabled(false);
28.93 - jTextFileLocation.setEnabled(true);
28.94 - jButtonBrowseSource.setEnabled(true);
28.95 - } else if (PropertyValue.FROM_URL.equals(sourceType)) {
28.96 - jTextURL.setEnabled(true);
28.97 - jTextFileLocation.setEnabled(false);
28.98 - jButtonBrowseSource.setEnabled(false);
28.99 - } else {
28.100 - throw new IllegalArgumentException(
28.101 - "Unknown source type: " + sourceType);
28.102 - }
28.103 - }
28.104 -
28.105 - public String getSourceLocation() {
28.106 - if (jRadioFromFile.isSelected()) {
28.107 - return jTextFileLocation.getText();
28.108 - }
28.109 - return jTextURL.getText();
28.110 - }
28.111 -
28.112 - public boolean getOverwriteExist() {
28.113 - return jCheckBoxOverwrite.isSelected();
28.114 - }
28.115 -
28.116 - /** This method is called from within the constructor to
28.117 - * initialize the form.
28.118 - * WARNING: Do NOT modify this code. The content of this method is
28.119 - * always regenerated by the Form Editor.
28.120 - */
28.121 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
28.122 - private void initComponents() {
28.123 -
28.124 - sourceTypeButtonGroup = new javax.swing.ButtonGroup();
28.125 - jLabelSpecifySource = new javax.swing.JLabel();
28.126 - jRadioFromURL = new javax.swing.JRadioButton();
28.127 - jTextURL = new javax.swing.JTextField();
28.128 - jRadioFromFile = new javax.swing.JRadioButton();
28.129 - jTextFileLocation = new javax.swing.JTextField();
28.130 - jButtonBrowseSource = new javax.swing.JButton();
28.131 - jLabelSpecifyTarget = new javax.swing.JLabel();
28.132 - jLabelSaveToFolder = new javax.swing.JLabel();
28.133 - jTextTargetFolder = new javax.swing.JTextField();
28.134 - jButtonBrowseTarget = new javax.swing.JButton();
28.135 - jCheckBoxOverwrite = new javax.swing.JCheckBox();
28.136 -
28.137 - jLabelSpecifySource.setText("Specify Source");
28.138 - jLabelSpecifySource.setName("lblSpecifySource"); // NOI18N
28.139 -
28.140 - sourceTypeButtonGroup.add(jRadioFromURL);
28.141 - jRadioFromURL.setSelected(true);
28.142 - jRadioFromURL.setText("From URL");
28.143 - jRadioFromURL.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
28.144 - jRadioFromURL.setMargin(new java.awt.Insets(0, 0, 0, 0));
28.145 - jRadioFromURL.addActionListener(new java.awt.event.ActionListener() {
28.146 - public void actionPerformed(java.awt.event.ActionEvent evt) {
28.147 - jRadioFromURLActionPerformed(evt);
28.148 - }
28.149 - });
28.150 -
28.151 - jTextURL.setText(null);
28.152 - jTextURL.addActionListener(new java.awt.event.ActionListener() {
28.153 - public void actionPerformed(java.awt.event.ActionEvent evt) {
28.154 - jTextURLActionPerformed(evt);
28.155 - }
28.156 - });
28.157 -
28.158 - sourceTypeButtonGroup.add(jRadioFromFile);
28.159 - jRadioFromFile.setText("From Local File System");
28.160 - jRadioFromFile.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
28.161 - jRadioFromFile.setMargin(new java.awt.Insets(0, 0, 0, 0));
28.162 - jRadioFromFile.addActionListener(new java.awt.event.ActionListener() {
28.163 - public void actionPerformed(java.awt.event.ActionEvent evt) {
28.164 - jRadioFromFileActionPerformed(evt);
28.165 - }
28.166 - });
28.167 -
28.168 - jTextFileLocation.setText(null);
28.169 - jTextFileLocation.addActionListener(new java.awt.event.ActionListener() {
28.170 - public void actionPerformed(java.awt.event.ActionEvent evt) {
28.171 - jTextFileLocationActionPerformed(evt);
28.172 - }
28.173 - });
28.174 -
28.175 - jButtonBrowseSource.setText("Browse");
28.176 - jButtonBrowseSource.addActionListener(new java.awt.event.ActionListener() {
28.177 - public void actionPerformed(java.awt.event.ActionEvent evt) {
28.178 - jButtonBrowseSourceActionPerformed(evt);
28.179 - }
28.180 - });
28.181 -
28.182 - jLabelSpecifyTarget.setText("Specify Target");
28.183 -
28.184 - jLabelSaveToFolder.setText(null);
28.185 -
28.186 - jTextTargetFolder.setEditable(false);
28.187 - jTextTargetFolder.setText(null);
28.188 -
28.189 - jButtonBrowseTarget.setText("Browse");
28.190 - jButtonBrowseTarget.addActionListener(new java.awt.event.ActionListener() {
28.191 - public void actionPerformed(java.awt.event.ActionEvent evt) {
28.192 - jButtonBrowseTargetActionPerformed(evt);
28.193 - }
28.194 - });
28.195 -
28.196 - jCheckBoxOverwrite.setText("Overwrite existing files with same name");
28.197 - jCheckBoxOverwrite.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
28.198 - jCheckBoxOverwrite.setMargin(new java.awt.Insets(0, 0, 0, 0));
28.199 -
28.200 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
28.201 - this.setLayout(layout);
28.202 - layout.setHorizontalGroup(
28.203 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
28.204 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
28.205 - .addContainerGap()
28.206 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
28.207 - .add(org.jdesktop.layout.GroupLayout.LEADING, jLabelSpecifySource, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 104, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
28.208 - .add(org.jdesktop.layout.GroupLayout.LEADING, jRadioFromURL)
28.209 - .add(org.jdesktop.layout.GroupLayout.LEADING, jRadioFromFile)
28.210 - .add(org.jdesktop.layout.GroupLayout.LEADING, jCheckBoxOverwrite, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
28.211 - .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
28.212 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
28.213 - .add(jTextTargetFolder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE)
28.214 - .add(jTextFileLocation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE))
28.215 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
28.216 - .add(jLabelSaveToFolder)
28.217 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
28.218 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
28.219 - .add(jButtonBrowseSource)
28.220 - .add(jButtonBrowseTarget)))
28.221 - .add(org.jdesktop.layout.GroupLayout.LEADING, jTextURL, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
28.222 - .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
28.223 - .add(jLabelSpecifyTarget, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 102, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
28.224 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 393, Short.MAX_VALUE)))
28.225 - .addContainerGap())
28.226 - );
28.227 - layout.setVerticalGroup(
28.228 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
28.229 - .add(layout.createSequentialGroup()
28.230 - .add(jLabelSpecifySource)
28.231 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
28.232 - .add(jRadioFromURL)
28.233 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
28.234 - .add(jTextURL, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
28.235 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
28.236 - .add(jRadioFromFile)
28.237 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
28.238 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
28.239 - .add(jButtonBrowseSource)
28.240 - .add(jTextFileLocation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
28.241 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
28.242 - .add(jLabelSpecifyTarget)
28.243 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
28.244 - .add(layout.createSequentialGroup()
28.245 - .add(13, 13, 13)
28.246 - .add(jLabelSaveToFolder))
28.247 - .add(layout.createSequentialGroup()
28.248 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
28.249 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
28.250 - .add(jButtonBrowseTarget)
28.251 - .add(jTextTargetFolder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
28.252 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
28.253 - .add(jCheckBoxOverwrite)
28.254 - .addContainerGap(16, Short.MAX_VALUE))
28.255 - );
28.256 -
28.257 - jRadioFromURL.getAccessibleContext().setAccessibleName(null);
28.258 - jRadioFromURL.getAccessibleContext().setAccessibleDescription(null);
28.259 - }// </editor-fold>//GEN-END:initComponents
28.260 -
28.261 -private void jTextFileLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFileLocationActionPerformed
28.262 - // TODO add your handling code here:
28.263 - notifyStateChange();
28.264 -}//GEN-LAST:event_jTextFileLocationActionPerformed
28.265 -
28.266 -private void jTextURLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextURLActionPerformed
28.267 - // TODO add your handling code here:
28.268 - notifyStateChange();
28.269 -}//GEN-LAST:event_jTextURLActionPerformed
28.270 -
28.271 -private void jButtonBrowseTargetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseTargetActionPerformed
28.272 - // TODO add your handling code here:
28.273 -
28.274 -}//GEN-LAST:event_jButtonBrowseTargetActionPerformed
28.275 -
28.276 -private void jButtonBrowseSourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseSourceActionPerformed
28.277 - // TODO add your handling code here:
28.278 - JFileChooser fileChooser = new JFileChooser();
28.279 - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
28.280 - fileChooser.setMultiSelectionEnabled(false);
28.281 - fileChooser.setFileFilter(new FileFilter() {
28.282 -
28.283 - public boolean accept(File f) {
28.284 - return f.isDirectory() || f.getName().endsWith(".cpy");
28.285 - }
28.286 -
28.287 - public String getDescription() {
28.288 - return ("COBOL Copybook file filter");
28.289 - }
28.290 -
28.291 - });
28.292 - String currentSelected = jTextFileLocation.getText();
28.293 - if (currentSelected != null && currentSelected.length() > 0) {
28.294 - fileChooser.setSelectedFile(new File(currentSelected));
28.295 - }
28.296 - if (fileChooser.showDialog(this, null) == JFileChooser.APPROVE_OPTION) {
28.297 - jTextFileLocation.setText(fileChooser.getSelectedFile().getAbsolutePath());
28.298 - }
28.299 - notifyStateChange();
28.300 -}//GEN-LAST:event_jButtonBrowseSourceActionPerformed
28.301 -
28.302 -private void jRadioFromFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioFromFileActionPerformed
28.303 - // TODO add your handling code here:
28.304 - setSourceType(PropertyValue.FROM_FILE);
28.305 - notifyStateChange();
28.306 -}//GEN-LAST:event_jRadioFromFileActionPerformed
28.307 -
28.308 -private void jRadioFromURLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioFromURLActionPerformed
28.309 - // TODO add your handling code here:
28.310 - setSourceType(PropertyValue.FROM_URL);
28.311 - notifyStateChange();
28.312 -}//GEN-LAST:event_jRadioFromURLActionPerformed
28.313 -
28.314 -
28.315 - // Variables declaration - do not modify//GEN-BEGIN:variables
28.316 - private javax.swing.JButton jButtonBrowseSource;
28.317 - private javax.swing.JButton jButtonBrowseTarget;
28.318 - private javax.swing.JCheckBox jCheckBoxOverwrite;
28.319 - private javax.swing.JLabel jLabelSaveToFolder;
28.320 - private javax.swing.JLabel jLabelSpecifySource;
28.321 - private javax.swing.JLabel jLabelSpecifyTarget;
28.322 - private javax.swing.JRadioButton jRadioFromFile;
28.323 - private javax.swing.JRadioButton jRadioFromURL;
28.324 - private javax.swing.JTextField jTextFileLocation;
28.325 - private javax.swing.JTextField jTextTargetFolder;
28.326 - private javax.swing.JTextField jTextURL;
28.327 - private javax.swing.ButtonGroup sourceTypeButtonGroup;
28.328 - // End of variables declaration//GEN-END:variables
28.329 -
28.330 -}
29.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/RetrieveCopybookWizardIterator.java Sat Sep 27 15:34:52 2008 -0700
29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
29.3 @@ -1,204 +0,0 @@
29.4 -/*
29.5 - * The contents of this file are subject to the terms of the Common Development
29.6 - * and Distribution License (the License). You may not use this file except in
29.7 - * compliance with the License.
29.8 - *
29.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
29.10 - * or http://www.netbeans.org/cddl.txt.
29.11 - *
29.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
29.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
29.14 - * If applicable, add the following below the CDDL Header, with the fields
29.15 - * enclosed by brackets [] replaced by your own identifying information:
29.16 - * "Portions Copyrighted [year] [name of copyright owner]"
29.17 - *
29.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
29.19 - */
29.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
29.21 -
29.22 -import java.io.File;
29.23 -import java.io.FileInputStream;
29.24 -import java.io.FileOutputStream;
29.25 -import java.io.IOException;
29.26 -import java.io.InputStream;
29.27 -import java.io.OutputStream;
29.28 -import java.net.URL;
29.29 -import java.util.HashSet;
29.30 -import java.util.NoSuchElementException;
29.31 -import java.util.Set;
29.32 -import javax.swing.JComponent;
29.33 -import javax.swing.event.ChangeListener;
29.34 -import org.netbeans.spi.project.ui.templates.support.Templates;
29.35 -import org.openide.WizardDescriptor;
29.36 -import org.openide.WizardDescriptor.Panel;
29.37 -import org.openide.filesystems.FileUtil;
29.38 -import org.openide.loaders.DataLoaderPool;
29.39 -import org.openide.loaders.DataObject;
29.40 -import org.openide.loaders.TemplateWizard;
29.41 -
29.42 -/**
29.43 - * The wizard iterator for retrieving external COBOL Copybooks into current
29.44 - * project.
29.45 - *
29.46 - * @author Jun Xu
29.47 - */
29.48 -public class RetrieveCopybookWizardIterator implements TemplateWizard.Iterator {
29.49 -
29.50 - private WizardDescriptor.Panel[] mPanels;
29.51 - private int mIndex;
29.52 -
29.53 - public RetrieveCopybookWizardIterator() {
29.54 - }
29.55 -
29.56 - public Set<DataObject> instantiate(TemplateWizard wiz) throws IOException {
29.57 - PropertyValue sourceType =
29.58 - (PropertyValue) wiz.getProperty(PropertyKey.SOURCE_TYPE);
29.59 - String sourceLocation =
29.60 - (String) wiz.getProperty(PropertyKey.SOURCE_LOCATION);
29.61 - File targetFolder = new File(
29.62 - (String) wiz.getProperty(PropertyKey.TARGET_FOLDER));
29.63 - boolean overwrite = (Boolean) wiz.getProperty(PropertyKey.OVERWRITE_EXIST);
29.64 - String targetFileName;
29.65 - InputStream inStream;
29.66 - if (PropertyValue.FROM_FILE.equals(sourceType)) {
29.67 - File sourceFile = new File(sourceLocation);
29.68 - targetFileName = sourceFile.getName();
29.69 - inStream = new FileInputStream(sourceFile);
29.70 - } else if (PropertyValue.FROM_URL.equals(sourceType)) {
29.71 - URL sourceURL = new URL(sourceLocation);
29.72 - targetFileName = new File(sourceURL.getPath()).getName();
29.73 - inStream = sourceURL.openStream();
29.74 - } else {
29.75 - throw new IllegalArgumentException(
29.76 - "Unknown source type: " + sourceType);
29.77 - }
29.78 - int dotPos;
29.79 - if ((dotPos = targetFileName.lastIndexOf('.')) >= 0) {
29.80 - targetFileName = targetFileName.substring(0, dotPos);
29.81 - }
29.82 - File targetFile = new File(targetFolder, targetFileName + ".cpy");
29.83 - if (!overwrite) {
29.84 - int i = 1;
29.85 - while (targetFile.exists()) {
29.86 - targetFile = new File(targetFolder, targetFileName + (i++) + ".cpy");
29.87 - }
29.88 - }
29.89 -
29.90 - importOneFile(inStream, targetFile);
29.91 -
29.92 - inStream.close();
29.93 -
29.94 - DataObject dObj = DataLoaderPool.getDefault().
29.95 - findDataObject(FileUtil.toFileObject(targetFile));
29.96 - Set<DataObject> dObjs = new HashSet<DataObject>();
29.97 - dObjs.add(dObj);
29.98 - return dObjs;
29.99 - }
29.100 -
29.101 - public void initialize(TemplateWizard wiz) {
29.102 - if (mPanels == null) {
29.103 - mPanels = new WizardDescriptor.Panel[]{
29.104 - new RetrieveCopybookWizardPanel1()};
29.105 - }
29.106 - String steps[] = createSteps(wiz);
29.107 - int delta = steps.length - mPanels.length;
29.108 - for (int i = 0; i < mPanels.length; i++) {
29.109 - if (mPanels[i].getComponent() instanceof JComponent) {
29.110 - JComponent jc = (JComponent) mPanels[i].getComponent();
29.111 - //How does this index match the steps? Somehow it just works.
29.112 - jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
29.113 - // Sets steps names for a panel
29.114 - jc.putClientProperty("WizardPanel_contentData", steps);
29.115 - // Turn on subtitle creation on each step
29.116 - jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
29.117 - // Show steps on the left side with the image on the background
29.118 - jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
29.119 - // Turn on numbering of all steps
29.120 - jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
29.121 - }
29.122 - }
29.123 - mIndex = 0;
29.124 - wiz.putProperty(PropertyKey.CURRENT_PROJECT, Templates.getProject(wiz));
29.125 - wiz.putProperty(PropertyKey.CURRENT_FOLDER, Templates.getTargetFolder(wiz));
29.126 - }
29.127 -
29.128 - public void uninitialize(TemplateWizard wiz) {
29.129 - mPanels = null;
29.130 - }
29.131 -
29.132 - @SuppressWarnings("unchecked")
29.133 - public Panel<WizardDescriptor> current() {
29.134 - return mPanels[mIndex];
29.135 - }
29.136 -
29.137 - public String name() {
29.138 - return mIndex + 1 + ". from " + mPanels.length;
29.139 - }
29.140 -
29.141 - public boolean hasNext() {
29.142 - return mIndex < mPanels.length - 1;
29.143 - }
29.144 -
29.145 - public boolean hasPrevious() {
29.146 - return mIndex > 0;
29.147 - }
29.148 -
29.149 - public void nextPanel() {
29.150 - if (!hasNext()) {
29.151 - throw new NoSuchElementException();
29.152 - }
29.153 - mIndex++;
29.154 - }
29.155 -
29.156 - public void previousPanel() {
29.157 - if (!hasPrevious()) {
29.158 - throw new NoSuchElementException();
29.159 - }
29.160 - mIndex--;
29.161 - }
29.162 -
29.163 - public void addChangeListener(ChangeListener l) {
29.164 - }
29.165 -
29.166 - public void removeChangeListener(ChangeListener l) {
29.167 - }
29.168 -
29.169 - /*
29.170 - * This code is a bit odd to be here. If someone does not know how wizard
29.171 - * framework works internally, how would he/she write the following code?
29.172 - * And why the last one of the beforeSteps is always "..."?
29.173 - */
29.174 - private String[] createSteps(WizardDescriptor wizard) {
29.175 - String[] beforeSteps = null;
29.176 - Object prop = wizard.getProperty("WizardPanel_contentData");
29.177 - if (prop != null && prop instanceof String[]) {
29.178 - beforeSteps = (String[]) prop;
29.179 - }
29.180 -
29.181 - if (beforeSteps == null) {
29.182 - beforeSteps = new String[0];
29.183 - }
29.184 -
29.185 - String[] res = new String[beforeSteps.length - 1 + mPanels.length];
29.186 - for (int i = 0; i < res.length; i++) {
29.187 - if (i < beforeSteps.length - 1) {
29.188 - res[i] = beforeSteps[i];
29.189 - } else {
29.190 - res[i] = mPanels[i - beforeSteps.length + 1].getComponent().getName();
29.191 - }
29.192 - }
29.193 - return res;
29.194 - }
29.195 -
29.196 - private void importOneFile(InputStream in, File targetFile)
29.197 - throws IOException {
29.198 - byte[] buf = new byte[1024];
29.199 - int read;
29.200 - OutputStream out = new FileOutputStream(targetFile);
29.201 - while ((read = in.read(buf)) >= 0) {
29.202 - out.write(buf, 0, read);
29.203 - }
29.204 - out.flush();
29.205 - out.close();
29.206 - }
29.207 -}
30.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/RetrieveCopybookWizardPanel1.java Sat Sep 27 15:34:52 2008 -0700
30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
30.3 @@ -1,141 +0,0 @@
30.4 -/*
30.5 - * The contents of this file are subject to the terms of the Common Development
30.6 - * and Distribution License (the License). You may not use this file except in
30.7 - * compliance with the License.
30.8 - *
30.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
30.10 - * or http://www.netbeans.org/cddl.txt.
30.11 - *
30.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
30.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
30.14 - * If applicable, add the following below the CDDL Header, with the fields
30.15 - * enclosed by brackets [] replaced by your own identifying information:
30.16 - * "Portions Copyrighted [year] [name of copyright owner]"
30.17 - *
30.18 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
30.19 - */
30.20 -package org.netbeans.modules.encoder.coco.ui.wizard;
30.21 -
30.22 -import java.awt.Component;
30.23 -import java.io.File;
30.24 -import java.net.MalformedURLException;
30.25 -import java.net.URL;
30.26 -import java.util.HashSet;
30.27 -import java.util.Iterator;
30.28 -import java.util.Set;
30.29 -import javax.swing.event.ChangeEvent;
30.30 -import javax.swing.event.ChangeListener;
30.31 -import org.openide.WizardDescriptor;
30.32 -import org.openide.filesystems.FileObject;
30.33 -import org.openide.filesystems.FileUtil;
30.34 -import org.openide.util.Exceptions;
30.35 -import org.openide.util.HelpCtx;
30.36 -
30.37 -/**
30.38 - * The wizard panel for retrieving COBOL Copybooks.
30.39 - *
30.40 - * @author Jun Xu
30.41 - */
30.42 -public class RetrieveCopybookWizardPanel1 implements WizardDescriptor.Panel,
30.43 - ChangeListener {
30.44 -
30.45 - private final RetrieveCopybookVisualPanel1 mVisualPanel;
30.46 - private WizardDescriptor mWizardDescriptor;
30.47 -
30.48 - public RetrieveCopybookWizardPanel1() {
30.49 - mVisualPanel = new RetrieveCopybookVisualPanel1(this);
30.50 - mVisualPanel.setSourceType(PropertyValue.FROM_URL);
30.51 - mVisualPanel.addChangeListener(this);
30.52 - }
30.53 -
30.54 - public Component getComponent() {
30.55 - return mVisualPanel;
30.56 - }
30.57 -
30.58 - public HelpCtx getHelp() {
30.59 - // Show no Help button for this panel:
30.60 - return HelpCtx.DEFAULT_HELP;
30.61 - }
30.62 -
30.63 - public void readSettings(Object settings) {
30.64 - mWizardDescriptor = (WizardDescriptor) settings;
30.65 - FileObject fileObj = (FileObject)
30.66 - mWizardDescriptor.getProperty(PropertyKey.CURRENT_FOLDER);
30.67 - if (fileObj != null) {
30.68 - mVisualPanel.setTargetLocation(FileUtil.toFile(fileObj).getPath());
30.69 - }
30.70 - }
30.71 -
30.72 - public void storeSettings(Object settings) {
30.73 - WizardDescriptor descriptor = (WizardDescriptor) settings;
30.74 - descriptor.putProperty(PropertyKey.SOURCE_TYPE,
30.75 - mVisualPanel.getSourceType());
30.76 - descriptor.putProperty(PropertyKey.SOURCE_LOCATION,
30.77 - mVisualPanel.getSourceLocation());
30.78 - descriptor.putProperty(PropertyKey.TARGET_FOLDER,
30.79 - mVisualPanel.getTargetFolder());
30.80 - descriptor.putProperty(PropertyKey.OVERWRITE_EXIST,
30.81 - new Boolean(mVisualPanel.getOverwriteExist()));
30.82 - }
30.83 -
30.84 - public boolean isValid() {
30.85 - String targetFolder = mVisualPanel.getTargetFolder();
30.86 - if (targetFolder == null || targetFolder.length() == 0) {
30.87 - return false;
30.88 - }
30.89 - String sourceLocation = mVisualPanel.getSourceLocation();
30.90 - if (PropertyValue.FROM_FILE.equals(mVisualPanel.getSourceType())) {
30.91 - File file = new File(sourceLocation);
30.92 - if (!file.isDirectory() && !file.isFile()) {
30.93 - return false;
30.94 - }
30.95 - if (file.isFile() && !file.getName().endsWith(".cpy")) {
30.96 - return false;
30.97 - }
30.98 - return true;
30.99 - } else if (PropertyValue.FROM_URL.equals(
30.100 - mVisualPanel.getSourceType())) {
30.101 - try {
30.102 - java.net.URL url = new java.net.URL(sourceLocation);
30.103 - String path = url.getPath();
30.104 - if (path == null || path.length() < 4
30.105 - || !path.endsWith(".cpy")) {
30.106 - return false;
30.107 - }
30.108 - } catch (MalformedURLException ex) {
30.109 - return false;
30.110 - }
30.111 - return true;
30.112 - }
30.113 - throw new IllegalArgumentException(
30.114 - "Unknown source type: " + mVisualPanel.getSourceType());
30.115 - }
30.116 -
30.117 - private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
30.118 - public final void addChangeListener(ChangeListener l) {
30.119 - synchronized (listeners) {
30.120 - listeners.add(l);
30.121 - }
30.122 - }
30.123 -
30.124 - public final void removeChangeListener(ChangeListener l) {
30.125 - synchronized (listeners) {
30.126 - listeners.remove(l);
30.127 - }
30.128 - }
30.129 -
30.130 - protected final void fireChangeEvent() {
30.131 - Iterator<ChangeListener> it;
30.132 - synchronized (listeners) {
30.133 - it = new HashSet<ChangeListener>(listeners).iterator();
30.134 - }
30.135 - ChangeEvent ev = new ChangeEvent(this);
30.136 - while (it.hasNext()) {
30.137 - it.next().stateChanged(ev);
30.138 - }
30.139 - }
30.140 -
30.141 - public void stateChanged(ChangeEvent e) {
30.142 - fireChangeEvent();
30.143 - }
30.144 -}
31.1 --- a/encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/retrieveCopybookResource.html Sat Sep 27 15:34:52 2008 -0700
31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
31.3 @@ -1,6 +0,0 @@
31.4 -<HTML>
31.5 - <BODY>
31.6 - This wizard retrieves COBOL Copybook documents from local file system or URLs into current project.
31.7 - </BODY>
31.8 -</HTML>
31.9 -
32.1 Binary file encoder.coco.ui/src/org/netbeans/modules/encoder/coco/ui/wizard/xmlObject.gif has changed
33.1 --- a/encoder.custom.aip/build.xml Sat Sep 27 15:34:52 2008 -0700
33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
33.3 @@ -1,8 +0,0 @@
33.4 -<?xml version="1.0" encoding="UTF-8"?>
33.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
33.6 -<!-- for some information on what you could do (e.g. targets to override). -->
33.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
33.8 -<project name="org.netbeans.modules.encoder.custom.aip" default="netbeans" basedir=".">
33.9 - <description>Builds, tests, and runs the project org.netbeans.modules.encoder.custom.aip.</description>
33.10 - <import file="../../nbbuild/templates/projectized.xml"/>
33.11 -</project>
34.1 --- a/encoder.custom.aip/manifest.mf Sat Sep 27 15:34:52 2008 -0700
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,7 +0,0 @@
34.4 -Manifest-Version: 1.0
34.5 -OpenIDE-Module: org.netbeans.modules.encoder.custom.aip
34.6 -OpenIDE-Module-Layer: org/netbeans/modules/encoder/custom/aip/layer.xml
34.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/encoder/custom/aip/Bundle.properties
34.8 -OpenIDE-Module-Install: org/netbeans/modules/encoder/custom/aip/CustomAIPModuleInstaller.class
34.9 -OpenIDE-Module-Specification-Version: 1.0.1
34.10 -
35.1 --- a/encoder.custom.aip/nbproject/project.properties Sat Sep 27 15:34:52 2008 -0700
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,4 +0,0 @@
35.4 -javac.compilerargs=-Xlint:unchecked
35.5 -javac.source=1.5
35.6 -license.file=../cddl.txt
35.7 -nbm.homepage=http://wiki.open-esb.java.net/jbiwiki/Wiki.jsp?page=CustomDefined
36.1 --- a/encoder.custom.aip/nbproject/project.xml Sat Sep 27 15:34:52 2008 -0700
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,162 +0,0 @@
36.4 -<?xml version="1.0" encoding="UTF-8"?>
36.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
36.6 - <type>org.netbeans.modules.apisupport.project</type>
36.7 - <configuration>
36.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
36.9 - <code-name-base>org.netbeans.modules.encoder.custom.aip</code-name-base>
36.10 - <module-dependencies>
36.11 - <dependency>
36.12 - <code-name-base>com.sun.encoder</code-name-base>
36.13 - <build-prerequisite/>
36.14 - <compile-dependency/>
36.15 - <run-dependency>
36.16 - <specification-version>1.0</specification-version>
36.17 - </run-dependency>
36.18 - </dependency>
36.19 - <dependency>
36.20 - <code-name-base>org.netbeans.soa.libs.xmlbeans</code-name-base>
36.21 - <build-prerequisite/>
36.22 - <compile-dependency/>
36.23 - <run-dependency>
36.24 - <release-version>1</release-version>
36.25 - <specification-version>1.0</specification-version>
36.26 - </run-dependency>
36.27 - </dependency>
36.28 - <dependency>
36.29 - <code-name-base>org.jdesktop.layout</code-name-base>
36.30 - <build-prerequisite/>
36.31 - <compile-dependency/>
36.32 - <run-dependency>
36.33 - <release-version>1</release-version>
36.34 - <specification-version>1.3.23</specification-version>
36.35 - </run-dependency>
36.36 - </dependency>
36.37 - <dependency>
36.38 - <code-name-base>org.netbeans.api.progress</code-name-base>
36.39 - <build-prerequisite/>
36.40 - <compile-dependency/>
36.41 - <run-dependency>
36.42 - <release-version>1</release-version>
36.43 - <specification-version>1.5.22</specification-version>
36.44 - </run-dependency>
36.45 - </dependency>
36.46 - <dependency>
36.47 - <code-name-base>com.sun.encoder.custom</code-name-base>
36.48 - <build-prerequisite/>
36.49 - <compile-dependency/>
36.50 - <run-dependency>
36.51 - <specification-version>1.0.2</specification-version>
36.52 - </run-dependency>
36.53 - </dependency>
36.54 - <dependency>
36.55 - <code-name-base>org.netbeans.modules.encoder.ui.basic</code-name-base>
36.56 - <build-prerequisite/>
36.57 - <compile-dependency/>
36.58 - <run-dependency>
36.59 - <specification-version>1.0</specification-version>
36.60 - </run-dependency>
36.61 - </dependency>
36.62 - <dependency>
36.63 - <code-name-base>org.netbeans.modules.xml.schema.model</code-name-base>
36.64 - <build-prerequisite/>
36.65 - <compile-dependency/>
36.66 - <run-dependency>
36.67 - <release-version>1</release-version>
36.68 - <specification-version>1.1.22</specification-version>
36.69 - </run-dependency>
36.70 - </dependency>
36.71 - <dependency>
36.72 - <code-name-base>org.netbeans.modules.xml.schema.ui.basic</code-name-base>
36.73 - <build-prerequisite/>
36.74 - <compile-dependency/>
36.75 - <run-dependency>
36.76 - <release-version>1</release-version>
36.77 - <specification-version>1.2</specification-version>
36.78 - </run-dependency>
36.79 - </dependency>
36.80 - <dependency>
36.81 - <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
36.82 - <build-prerequisite/>
36.83 - <compile-dependency/>
36.84 - <run-dependency>
36.85 - <release-version>1</release-version>
36.86 - <specification-version>1.1.22</specification-version>
36.87 - </run-dependency>
36.88 - </dependency>
36.89 - <dependency>
36.90 - <code-name-base>org.openide.dialogs</code-name-base>
36.91 - <build-prerequisite/>
36.92 - <compile-dependency/>
36.93 - <run-dependency>
36.94 - <specification-version>6.5.22</specification-version>
36.95 - </run-dependency>
36.96 - </dependency>
36.97 - <dependency>
36.98 - <code-name-base>org.openide.explorer</code-name-base>
36.99 - <build-prerequisite/>
36.100 - <compile-dependency/>
36.101 - <run-dependency>
36.102 - <specification-version>6.5.22</specification-version>
36.103 - </run-dependency>
36.104 - </dependency>
36.105 - <dependency>
36.106 - <code-name-base>org.openide.filesystems</code-name-base>
36.107 - <build-prerequisite/>
36.108 - <compile-dependency/>
36.109 - <run-dependency>
36.110 - <specification-version>6.4.22</specification-version>
36.111 - </run-dependency>
36.112 - </dependency>
36.113 - <dependency>
36.114 - <code-name-base>org.openide.io</code-name-base>
36.115 - <build-prerequisite/>
36.116 - <compile-dependency/>
36.117 - <run-dependency>
36.118 - <specification-version>1.9.22</specification-version>
36.119 - </run-dependency>
36.120 - </dependency>
36.121 - <dependency>
36.122 - <code-name-base>org.openide.loaders</code-name-base>
36.123 - <build-prerequisite/>
36.124 - <compile-dependency/>
36.125 - <run-dependency>
36.126 - <specification-version>5.9.22</specification-version>
36.127 - </run-dependency>
36.128 - </dependency>
36.129 - <dependency>
36.130 - <code-name-base>org.openide.modules</code-name-base>
36.131 - <build-prerequisite/>
36.132 - <compile-dependency/>
36.133 - <run-dependency>
36.134 - <specification-version>6.5.22</specification-version>
36.135 - </run-dependency>
36.136 - </dependency>
36.137 - <dependency>
36.138 - <code-name-base>org.openide.nodes</code-name-base>
36.139 - <build-prerequisite/>
36.140 - <compile-dependency/>
36.141 - <run-dependency>
36.142 - <specification-version>6.7.22</specification-version>
36.143 - </run-dependency>
36.144 - </dependency>
36.145 - <dependency>
36.146 - <code-name-base>org.openide.util</code-name-base>
36.147 - <build-prerequisite/>
36.148 - <compile-dependency/>
36.149 - <run-dependency>
36.150 - <specification-version>6.8.22</specification-version>
36.151 - </run-dependency>
36.152 - </dependency>
36.153 - <dependency>
36.154 - <code-name-base>org.openide.windows</code-name-base>
36.155 - <build-prerequisite/>
36.156 - <compile-dependency/>
36.157 - <run-dependency>
36.158 - <specification-version>6.5.22</specification-version>
36.159 - </run-dependency>
36.160 - </dependency>
36.161 - </module-dependencies>
36.162 - <public-packages/>
36.163 - </data>
36.164 - </configuration>
36.165 -</project>
37.1 --- a/encoder.custom.aip/src/META-INF/services/org.netbeans.modules.xml.schema.ui.basic.spi.AppInfoProvider Sat Sep 27 15:34:52 2008 -0700
37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
37.3 @@ -1,1 +0,0 @@
37.4 -org.netbeans.modules.encoder.custom.aip.CustomEncoderAppInfoProvider
38.1 --- a/encoder.custom.aip/src/META-INF/services/org.netbeans.modules.xml.xam.spi.Validator Sat Sep 27 15:34:52 2008 -0700
38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
38.3 @@ -1,2 +0,0 @@
38.4 -org.netbeans.modules.encoder.custom.aip.validation.ValidationProvider
38.5 -
39.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/AlignmentPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
39.3 @@ -1,58 +0,0 @@
39.4 -/*
39.5 - * The contents of this file are subject to the terms of the Common Development
39.6 - * and Distribution License (the License). You may not use this file except in
39.7 - * compliance with the License.
39.8 - *
39.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
39.10 - * or http://www.netbeans.org/cddl.txt.
39.11 -
39.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
39.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
39.14 - * If applicable, add the following below the CDDL Header, with the fields
39.15 - * enclosed by brackets [] replaced by your own identifying information:
39.16 - * "Portions Copyrighted [year] [name of copyright owner]"
39.17 - *
39.18 - * The Original Software is NetBeans. The Initial Developer of the Original
39.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
39.20 - * Microsystems, Inc. All Rights Reserved.
39.21 - */
39.22 -
39.23 -package org.netbeans.modules.encoder.custom.aip;
39.24 -
39.25 -import java.beans.PropertyEditorSupport;
39.26 -
39.27 -/**
39.28 - * The property editor for the alignment property.
39.29 - *
39.30 - * @author Jun Xu
39.31 - */
39.32 -public class AlignmentPropertyEditor extends PropertyEditorSupport {
39.33 -
39.34 - /** Creates a new instance of AlignmentPropertyEditor */
39.35 - public AlignmentPropertyEditor() {
39.36 - }
39.37 -
39.38 - @Override
39.39 - public String[] getTags() {
39.40 - return EncodingOption.alignmentTagList().toArray(new String[0]);
39.41 - }
39.42 -
39.43 - @Override
39.44 - public String getAsText() {
39.45 - return (String) getValue();
39.46 - }
39.47 -
39.48 - @Override
39.49 - public void setAsText(String text) throws IllegalArgumentException {
39.50 - setValue(text);
39.51 - }
39.52 -
39.53 - @Override
39.54 - public String getJavaInitializationString() {
39.55 - String value = (String) getValue();
39.56 - if (value == null) {
39.57 - return "null"; //NOI18N
39.58 - }
39.59 - return "\"" + value + "\""; //NOI18N
39.60 - }
39.61 -}
40.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
40.3 @@ -1,166 +0,0 @@
40.4 -OpenIDE-Module-Long-Description=\
40.5 - An implementation of XSD editor's AppInfoProvider SPI, which plugs custom encoder GUI extension into XSD editor
40.6 -OpenIDE-Module-Name=Encoder Editor - Custom
40.7 -OpenIDE-Module-Display-Category=ESB
40.8 -
40.9 -LBL_Delimiter_Set_Editor_Title=Delimiter List Editor
40.10 -
40.11 -TAG_NodeType_group=group
40.12 -TAG_NodeType_array=array
40.13 -TAG_NodeType_delimited=delimited
40.14 -TAG_NodeType_fixedLength=fixedLength
40.15 -TAG_NodeType_transient=transient
40.16 -
40.17 -TAG_Alignment_blind=blind
40.18 -TAG_Alignment_exact=exact
40.19 -TAG_Alignment_begin=begin
40.20 -TAG_Alignment_final=final
40.21 -TAG_Alignment_inter=inter
40.22 -TAG_Alignment_super=super
40.23 -TAG_Alignment_oneof=oneof
40.24 -TAG_Alignment_regex=regex
40.25 -
40.26 -TAG_Order_sequence=sequence
40.27 -TAG_Order_any=any
40.28 -TAG_Order_mixed=mixed
40.29 -
40.30 -TAG_FixedLengthType_regular=regular
40.31 -TAG_FixedLengthType_encoded=encoded
40.32 -TAG_FixedLengthType_undetermined=determined by regex match
40.33 -TAG_FixedLengthType_reversed=deducted from end
40.34 -
40.35 -TAG_UndefDataPolicy_map=map
40.36 -TAG_UndefDataPolicy_skip=skip
40.37 -TAG_UndefDataPolicy_prohibit=prohibit
40.38 -
40.39 -TAG_DelimKind_escape=escape
40.40 -TAG_DelimKind_normal=normal
40.41 -TAG_DelimKind_repeat=repeat
40.42 -TAG_DelimKind_quot_escape=quot-esc
40.43 -
40.44 -TAG_OptionMode_never=never
40.45 -TAG_OptionMode_allow=allow
40.46 -TAG_OptionMode_favor=cheer
40.47 -TAG_OptionMode_force=force
40.48 -
40.49 -TAG_TermMode_never=never
40.50 -TAG_TermMode_allow=allow
40.51 -TAG_TermMode_favor=cheer
40.52 -TAG_TermMode_force=force
40.53 -
40.54 -encoding_opt.exp.anno_must_under_elem=Annotation must be under an element declaration
40.55 -encoding_opt.exp.must_be_annotation=The last component in the path must be annotation
40.56 -
40.57 -encoding_opt.lbl.error_retrieving_delim=Error Retrieving Delimiter
40.58 -encoding_opt.lbl.delim_not_set=Delimiter Not Set
40.59 -
40.60 -encoding_opt.exp.illegal_comp_path=Illegal component path. Size < 1
40.61 -encoding_opt.exp.no_component_path=no component path
40.62 -encoding_opt.exp.delim_not_set=Element ''{0}'': Delimiter is not set
40.63 -encoding_opt.exp.zero_fixed_length=Element ''{0}'': Fixed length field has a length of zero
40.64 -encoding_opt.exp.invalid_appinfo=Element ''{0}'': Invalid custom encoder <appinfo> due to {1}
40.65 -encoding_opt.exp.io_exception=Element ''{0}'': IO Exception parsing <appinfo> due to {1}
40.66 -encoding_opt.exp.match_len_gt_fld_len=Element ''{0}'': Match length exceeds field length
40.67 -
40.68 -encoding_node.exp.no_such_mthd=No such method exception
40.69 -
40.70 -encoding_node.lbl.length=Length
40.71 -encoding_node.lbl.length_from_end=Length From End
40.72 -encoding_node.lbl.length_encoded=Encoded Field Length
40.73 -encoding_node.lbl.offset=Offset
40.74 -encoding_node.lbl.offset_encoded=Encoded Field Offset
40.75 -encoding_node.lbl.position=Position
40.76 -encoding_node.lbl.position_encoded=Encoded Field Position
40.77 -encoding_node.lbl.delimiter=Delimiter
40.78 -encoding_node.lbl.array_delimiter=Array Delimiter
40.79 -encoding_node.lbl.order=Order
40.80 -encoding_node.lbl.match=Match
40.81 -encoding_node.lbl.no_match=No Match
40.82 -encoding_node.lbl.escape_sequence=Escape Sequence
40.83 -encoding_node.lbl.fine_inherit=Fine Inherit
40.84 -encoding_node.lbl.alignment=Alignment
40.85 -encoding_node.lbl.serial_charset=Serializing Charset
40.86 -encoding_node.lbl.parsing_charset=Parsing Charset
40.87 -encoding_node.lbl.output_charset=Output Charset
40.88 -encoding_node.lbl.input_charset=Input Charset
40.89 -encoding_node.lbl.top=Top
40.90 -encoding_node.lbl.delim_list=Delimiter List
40.91 -encoding_node.lbl.node_type=Node Type
40.92 -encoding_node.lbl.fixed_length_type=Fixed Length Type
40.93 -encoding_node.lbl.encoding_style_short=Encoding Style
40.94 -encoding_node.lbl.encoding_style=Encoding Style
40.95 -encoding_node.lbl.begin_delimiter=Begin Delimiter
40.96 -encoding_node.lbl.begin_delimiter_detached=Begin Delimiter Detached
40.97 -encoding_node.lbl.undefined_data_policy=Undefined Data Policy
40.98 -encoding_node.lbl.n_of_n_min_n=NofN minN
40.99 -encoding_node.lbl.n_of_n_max_n=NofN maxN
40.100 -encoding_node.lbl.min_occ=MinOcc
40.101 -encoding_node.lbl.max_occ=MaxOcc
40.102 -encoding_node.lbl.scvngr_chars=Scavenger Chars
40.103 -encoding_node.lbl.scvngr_emit_1st=Output Scavenger 1st Char
40.104 -
40.105 -encoding_node.value.default_match=Specify Regex Here!
40.106 -encoding_node.value.unbounded=unbounded
40.107 -
40.108 -delim_tree_tab.lbl.length_short=Length
40.109 -delim_tree_tab.lbl.length=Length for embedded delimiter
40.110 -delim_tree_tab.lbl.begin_length_short=BegLength
40.111 -delim_tree_tab.lbl.begin_length=Length for embedded begin delimiter
40.112 -delim_tree_tab.lbl.offset_short=Offset
40.113 -delim_tree_tab.lbl.offset=Offset for embedded delimiter
40.114 -delim_tree_tab.lbl.begin_offset_short=BegOffset
40.115 -delim_tree_tab.lbl.begin_offset=Offset for embedded begin delimiter
40.116 -delim_tree_tab.lbl.term_mode_short=Terminator
40.117 -delim_tree_tab.lbl.term_mode=Terminator Mode
40.118 -delim_tree_tab.lbl.opt_mode_short=Optional
40.119 -delim_tree_tab.lbl.opt_mode=Optional Mode
40.120 -delim_tree_tab.lbl.precedence_short=Precedence
40.121 -delim_tree_tab.lbl.precedence=Precedence (0 to 100)
40.122 -delim_tree_tab.lbl.delim_bytes_short=Bytes
40.123 -delim_tree_tab.lbl.delim_bytes=Bytes for constant delimiter
40.124 -delim_tree_tab.lbl.begin_delim_bytes_short=BegBytes
40.125 -delim_tree_tab.lbl.begin_delim_bytes=Bytes for constant begin delimiter
40.126 -delim_tree_tab.lbl.type_short=Type
40.127 -delim_tree_tab.lbl.type=Type
40.128 -delim_tree_tab.lbl.skip_leading_short=Skip
40.129 -delim_tree_tab.lbl.skip_leading=Skip identical leading delimiters
40.130 -delim_tree_tab.lbl.collapse_short=Collapse
40.131 -delim_tree_tab.lbl.collapse=Collapse matched identical consecutive delimiters into one
40.132 -delim_tree_tab.lbl.detached_short=Detached
40.133 -delim_tree_tab.lbl.detached=Detached (non-anchored) delimiter does not have to appear at fixed position
40.134 -delim_tree_tab.lbl.begin_detached_short=BegDetached
40.135 -delim_tree_tab.lbl.begin_detached=Detached (non-anchored) begin delimiter does not have to appear at fixed position
40.136 -
40.137 -delim_set_pe.lbl.not_specified=not specified
40.138 -delim_set_pe.lbl.levels={0,number,integer} levels
40.139 -
40.140 -delim_set_form.lbl.remove_all=RemoveAll
40.141 -delim_set_form.lbl.remove=Remove
40.142 -delim_set_form.lbl.add_delim=Add Delimiter
40.143 -delim_set_form.lbl.add_level=Add Level
40.144 -
40.145 -delim_tree_root_node.lbl.level=Level
40.146 -
40.147 -delim_tree_level_node.lbl.level=Level
40.148 -
40.149 -delim_tree_delim_node.exp.no_such_mthd=No such method exception
40.150 -
40.151 -delim_tree_delim_node.lbl.delimiter=Delimiter
40.152 -delim_tree_delim_node.lbl.length=Length
40.153 -delim_tree_delim_node.lbl.begin_length=Begin Delimter Length
40.154 -delim_tree_delim_node.lbl.offset=Offset
40.155 -delim_tree_delim_node.lbl.begin_offset=Begin Delimiter Offset
40.156 -delim_tree_delim_node.lbl.term_mode=Terminator Mode
40.157 -delim_tree_delim_node.lbl.opt_mode=Optional Mode
40.158 -delim_tree_delim_node.lbl.precedence=Precedence
40.159 -delim_tree_delim_node.lbl.delim_bytes=Delimiter Bytes
40.160 -delim_tree_delim_node.lbl.begin_delim_bytes=Begin Delimiter Bytes
40.161 -delim_tree_delim_node.lbl.type=Type
40.162 -delim_tree_delim_node.lbl.skip_leading=Skip Leading
40.163 -delim_tree_delim_node.lbl.collapse=Collapse
40.164 -delim_tree_delim_node.lbl.detached=Detached
40.165 -delim_tree_delim_node.lbl.begin_detached=Begin Delimiter Detached
40.166 -
40.167 -encoding_node.lbl.encoding=encoding
40.168 -
40.169 -encoding_opt.lbl.embedded=embedded\:
41.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/CustomAIPModuleInstaller.java Sat Sep 27 15:34:52 2008 -0700
41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
41.3 @@ -1,139 +0,0 @@
41.4 -/*
41.5 - * CustomAIPModuleInstaller.java
41.6 - *
41.7 - * Created on February 1, 2007, 5:17 PM
41.8 - *
41.9 - * To change this template, choose Tools | Template Manager
41.10 - * and open the template in the editor.
41.11 - */
41.12 -
41.13 -package org.netbeans.modules.encoder.custom.aip;
41.14 -
41.15 -import java.beans.PropertyChangeEvent;
41.16 -import java.beans.PropertyChangeListener;
41.17 -import java.util.List;
41.18 -import javax.swing.SwingUtilities;
41.19 -import javax.xml.XMLConstants;
41.20 -import javax.xml.namespace.QName;
41.21 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
41.22 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
41.23 -import org.netbeans.modules.xml.schema.model.Annotation;
41.24 -import org.netbeans.modules.xml.schema.model.AppInfo;
41.25 -import org.netbeans.modules.xml.schema.model.Element;
41.26 -import org.netbeans.modules.xml.schema.model.ElementReference;
41.27 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
41.28 -import org.netbeans.modules.xml.schema.model.SchemaModel;
41.29 -import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
41.30 -import org.openide.modules.ModuleInstall;
41.31 -import org.openide.util.WeakListeners;
41.32 -
41.33 -/**
41.34 - * The ModuleInstall implementation of this module.
41.35 - *
41.36 - * @author Jun Xu
41.37 - */
41.38 -public class CustomAIPModuleInstaller extends ModuleInstall {
41.39 -
41.40 - private static final SMFPropertyChangeListener mSMFPropertyChangeListener =
41.41 - new SMFPropertyChangeListener();
41.42 -
41.43 - @Override
41.44 - public void restored() {
41.45 - super.restored();
41.46 - SchemaModelFactory.getDefault().addPropertyChangeListener(
41.47 - WeakListeners.propertyChange(mSMFPropertyChangeListener,
41.48 - SchemaModelFactory.getDefault()));
41.49 - }
41.50 -
41.51 - private static class SMFPropertyChangeListener implements PropertyChangeListener {
41.52 -
41.53 - private static final SchemaModelPropListener mModelPropListener =
41.54 - new SchemaModelPropListener();
41.55 -
41.56 - public void propertyChange(PropertyChangeEvent evt) {
41.57 - if (SchemaModelFactory.MODEL_LOADED_PROPERTY.equals(evt.getPropertyName())
41.58 - && (evt.getNewValue() instanceof SchemaModel)) {
41.59 - SchemaModel model = (SchemaModel) evt.getNewValue();
41.60 - model.addPropertyChangeListener(WeakListeners.propertyChange(
41.61 - mModelPropListener,
41.62 - model));
41.63 - }
41.64 - }
41.65 -
41.66 - }
41.67 -
41.68 - private static class SchemaModelPropListener implements PropertyChangeListener {
41.69 -
41.70 - private static final QName TYPE_ATTR_NAME = new QName("type"); //NOI18N
41.71 -
41.72 - public void propertyChange(PropertyChangeEvent evt) {
41.73 - if (evt.getOldValue() != null || !(evt.getNewValue() instanceof Element)
41.74 - || (evt.getNewValue() instanceof ElementReference)
41.75 - || !("content".equals(evt.getPropertyName()) //NOI18N
41.76 - || "elements".equals(evt.getPropertyName()))) { //NOI18N
41.77 - return;
41.78 - }
41.79 - final Element elem = (Element) evt.getNewValue();
41.80 - List<SchemaComponent> children;
41.81 - String tv;
41.82 - if (elem == null || elem.getModel().inSync()
41.83 - || !ModelUtils.isEncodedWith(elem.getModel(), CustomEncodingConst.STYLE)) {
41.84 - return;
41.85 - }
41.86 - boolean setTypeToString = true;
41.87 - if (((children = elem.getChildren()) != null && !children.isEmpty())
41.88 - || ((tv = elem.getAnyAttribute(TYPE_ATTR_NAME)) != null && tv.length() > 0)) {
41.89 - setTypeToString = false;
41.90 - }
41.91 - final boolean setTypeToStringFinal = setTypeToString;
41.92 - SwingUtilities.invokeLater(new Runnable() {
41.93 - public void run() {
41.94 - SchemaModel model = elem.getModel();
41.95 - if (model.inSync()) {
41.96 - return;
41.97 - }
41.98 -
41.99 - boolean startedTrans = false;
41.100 - try {
41.101 - if (!model.isIntransaction()) {
41.102 - if (!model.startTransaction()) {
41.103 - //TODO: how to handle
41.104 - }
41.105 - startedTrans = true;
41.106 - }
41.107 - processElementDefault(elem, setTypeToStringFinal);
41.108 - } finally {
41.109 - if (startedTrans) {
41.110 - model.endTransaction();
41.111 - }
41.112 - }
41.113 - }
41.114 - });
41.115 - }
41.116 -
41.117 - private void processElementDefault(Element elem, boolean setTypeToString) {
41.118 - if (setTypeToString) {
41.119 - org.w3c.dom.Element domElem = elem.getPeer();
41.120 - if (domElem != null) {
41.121 - String prefix = domElem.lookupPrefix(XMLConstants.W3C_XML_SCHEMA_NS_URI);
41.122 - String value;
41.123 - if (prefix != null && prefix.length() > 0) {
41.124 - value = prefix + ":string"; //NOI18N
41.125 - } else {
41.126 - value = "string"; //NOI18N
41.127 - }
41.128 - elem.setAnyAttribute(TYPE_ATTR_NAME, value);
41.129 - }
41.130 - }
41.131 - Annotation anno = elem.getAnnotation();
41.132 - if (anno != null) {
41.133 - return;
41.134 - }
41.135 - anno = elem.getModel().getFactory().createAnnotation();
41.136 - elem.setAnnotation(anno);
41.137 - AppInfo appInfo = elem.getModel().getFactory().createAppInfo();
41.138 - appInfo.setURI(EncodingConst.URI);
41.139 - anno.addAppInfo(appInfo);
41.140 - }
41.141 - }
41.142 -}
42.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/CustomEncoderAIPException.java Sat Sep 27 15:34:52 2008 -0700
42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
42.3 @@ -1,46 +0,0 @@
42.4 -/*
42.5 - * The contents of this file are subject to the terms of the Common Development
42.6 - * and Distribution License (the License). You may not use this file except in
42.7 - * compliance with the License.
42.8 - *
42.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
42.10 - * or http://www.netbeans.org/cddl.txt.
42.11 -
42.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
42.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
42.14 - * If applicable, add the following below the CDDL Header, with the fields
42.15 - * enclosed by brackets [] replaced by your own identifying information:
42.16 - * "Portions Copyrighted [year] [name of copyright owner]"
42.17 - *
42.18 - * The Original Software is NetBeans. The Initial Developer of the Original
42.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
42.20 - * Microsystems, Inc. All Rights Reserved.
42.21 - */
42.22 -
42.23 -package org.netbeans.modules.encoder.custom.aip;
42.24 -
42.25 -/**
42.26 - * The base class for all custom encoder appinfo provider related exceptions.
42.27 - *
42.28 - * @author Jun Xu
42.29 - */
42.30 -public class CustomEncoderAIPException extends Exception {
42.31 -
42.32 - private static final long serialVersionUID = 1L;
42.33 -
42.34 - public CustomEncoderAIPException() {
42.35 - super();
42.36 - }
42.37 -
42.38 - public CustomEncoderAIPException(String message) {
42.39 - super(message);
42.40 - }
42.41 -
42.42 - public CustomEncoderAIPException(String message, Throwable cause) {
42.43 - super(message, cause);
42.44 - }
42.45 -
42.46 - public CustomEncoderAIPException(Throwable cause) {
42.47 - super(cause);
42.48 - }
42.49 -}
43.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/CustomEncoderAppInfoProvider.java Sat Sep 27 15:34:52 2008 -0700
43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
43.3 @@ -1,85 +0,0 @@
43.4 -/*
43.5 - * The contents of this file are subject to the terms of the Common Development
43.6 - * and Distribution License (the License). You may not use this file except in
43.7 - * compliance with the License.
43.8 - *
43.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
43.10 - * or http://www.netbeans.org/cddl.txt.
43.11 -
43.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
43.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
43.14 - * If applicable, add the following below the CDDL Header, with the fields
43.15 - * enclosed by brackets [] replaced by your own identifying information:
43.16 - * "Portions Copyrighted [year] [name of copyright owner]"
43.17 - *
43.18 - * The Original Software is NetBeans. The Initial Developer of the Original
43.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
43.20 - * Microsystems, Inc. All Rights Reserved.
43.21 - */
43.22 -
43.23 -package org.netbeans.modules.encoder.custom.aip;
43.24 -
43.25 -import java.util.ArrayList;
43.26 -import java.util.List;
43.27 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
43.28 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
43.29 -import org.netbeans.modules.xml.schema.model.Annotation;
43.30 -import org.netbeans.modules.xml.schema.model.AppInfo;
43.31 -import org.netbeans.modules.xml.schema.model.Element;
43.32 -import org.netbeans.modules.xml.schema.model.ElementReference;
43.33 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
43.34 -import org.netbeans.modules.xml.schema.model.SchemaModel;
43.35 -import org.netbeans.modules.xml.schema.ui.basic.spi.AppInfoProvider;
43.36 -import org.openide.ErrorManager;
43.37 -import org.openide.nodes.Node;
43.38 -import org.openide.util.Lookup;
43.39 -import org.openide.util.lookup.Lookups;
43.40 -
43.41 -/**
43.42 - * <appinfo> provider that implements the custom encoder plug-in over
43.43 - * the XSD editor.
43.44 - *
43.45 - * @author Jun Xu
43.46 - */
43.47 -public class CustomEncoderAppInfoProvider extends AppInfoProvider {
43.48 -
43.49 - public boolean isActive(SchemaModel schemaModel) {
43.50 - return ModelUtils.isEncodedWith(schemaModel, CustomEncodingConst.STYLE);
43.51 - }
43.52 -
43.53 - public Node getNode(List<Node> nodes) {
43.54 - List<SchemaComponent> componentList = new ArrayList<SchemaComponent>();
43.55 - SchemaComponent comp = null;
43.56 - SchemaComponent prevComp = null;
43.57 - for (Node node : nodes) {
43.58 - comp = (SchemaComponent) node.getLookup()
43.59 - .lookup(SchemaComponent.class);
43.60 - if (comp != null && comp != prevComp) {
43.61 - componentList.add(comp);
43.62 - prevComp = comp;
43.63 - }
43.64 - }
43.65 - Annotation annotation = (Annotation) nodes.get(nodes.size() - 1)
43.66 - .getLookup().lookup(Annotation.class);
43.67 - if (!(annotation.getParent() instanceof Element)
43.68 - || annotation.getParent() instanceof ElementReference) {
43.69 - return null;
43.70 - }
43.71 - AppInfo encAppinfo = ModelUtils.getEncodingAppinfo(annotation);
43.72 - if (encAppinfo == null) {
43.73 - return null;
43.74 - }
43.75 - Lookup lookup = Lookups.singleton(encAppinfo);
43.76 - EncodingOption encodingOption = null;
43.77 - try {
43.78 - encodingOption = EncodingOption.createFromAppInfo(componentList);
43.79 - } catch (InvalidAppInfoException e) {
43.80 - ErrorManager.getDefault().notify(e);
43.81 - return null;
43.82 - }
43.83 - if (encodingOption == null) {
43.84 - return null;
43.85 - }
43.86 - return new EncodingNode(encodingOption, lookup);
43.87 - }
43.88 -}
44.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/CustomEncodingConst.java Sat Sep 27 15:34:52 2008 -0700
44.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
44.3 @@ -1,34 +0,0 @@
44.4 -/*
44.5 - * The contents of this file are subject to the terms of the Common Development
44.6 - * and Distribution License (the License). You may not use this file except in
44.7 - * compliance with the License.
44.8 - *
44.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
44.10 - * or http://www.netbeans.org/cddl.txt.
44.11 -
44.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
44.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
44.14 - * If applicable, add the following below the CDDL Header, with the fields
44.15 - * enclosed by brackets [] replaced by your own identifying information:
44.16 - * "Portions Copyrighted [year] [name of copyright owner]"
44.17 - *
44.18 - * The Original Software is NetBeans. The Initial Developer of the Original
44.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
44.20 - * Microsystems, Inc. All Rights Reserved.
44.21 - */
44.22 -
44.23 -package org.netbeans.modules.encoder.custom.aip;
44.24 -
44.25 -/**
44.26 - * Class for holding custom encoding related constants.
44.27 - *
44.28 - * @author Jun Xu
44.29 - */
44.30 -public abstract class CustomEncodingConst {
44.31 -
44.32 - public static final String STYLE = "customencoder-1.0"; //NOI18N
44.33 -
44.34 - public static final String URI = "urn:com.sun:encoder-custom-1.0"; //NOI18N
44.35 -
44.36 - public static final String NAME = "Custom Encoding"; //NOI18N
44.37 -}
45.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimKindPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
45.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
45.3 @@ -1,58 +0,0 @@
45.4 -/*
45.5 - * The contents of this file are subject to the terms of the Common Development
45.6 - * and Distribution License (the License). You may not use this file except in
45.7 - * compliance with the License.
45.8 - *
45.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
45.10 - * or http://www.netbeans.org/cddl.txt.
45.11 -
45.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
45.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
45.14 - * If applicable, add the following below the CDDL Header, with the fields
45.15 - * enclosed by brackets [] replaced by your own identifying information:
45.16 - * "Portions Copyrighted [year] [name of copyright owner]"
45.17 - *
45.18 - * The Original Software is NetBeans. The Initial Developer of the Original
45.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
45.20 - * Microsystems, Inc. All Rights Reserved.
45.21 - */
45.22 -
45.23 -package org.netbeans.modules.encoder.custom.aip;
45.24 -
45.25 -import java.beans.PropertyEditorSupport;
45.26 -
45.27 -/**
45.28 - * Property editor for the delimiter kind property.
45.29 - *
45.30 - * @author Jun Xu
45.31 - */
45.32 -public class DelimKindPropertyEditor extends PropertyEditorSupport {
45.33 -
45.34 - /** Creates a new instance of DelimKindPropertyEditor */
45.35 - public DelimKindPropertyEditor() {
45.36 - }
45.37 -
45.38 - @Override
45.39 - public String[] getTags() {
45.40 - return DelimiterOption.kindTagList().toArray(new String[0]);
45.41 - }
45.42 -
45.43 - @Override
45.44 - public String getAsText() {
45.45 - return (String) getValue();
45.46 - }
45.47 -
45.48 - @Override
45.49 - public void setAsText(String text) throws IllegalArgumentException {
45.50 - setValue(text);
45.51 - }
45.52 -
45.53 - @Override
45.54 - public String getJavaInitializationString() {
45.55 - String value = (String) getValue();
45.56 - if (value == null) {
45.57 - return "null"; //NOI18N
45.58 - }
45.59 - return "\"" + value + "\""; //NOI18N
45.60 - }
45.61 -}
46.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimLengthPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
46.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
46.3 @@ -1,33 +0,0 @@
46.4 -/*
46.5 - * DelimLengthPropertyEditor.java
46.6 - *
46.7 - * Created on January 6, 2007, 10:48 PM
46.8 - *
46.9 - * To change this template, choose Tools | Template Manager
46.10 - * and open the template in the editor.
46.11 - */
46.12 -
46.13 -package org.netbeans.modules.encoder.custom.aip;
46.14 -
46.15 -import java.beans.FeatureDescriptor;
46.16 -import java.beans.PropertyEditorSupport;
46.17 -import org.openide.explorer.propertysheet.ExPropertyEditor;
46.18 -import org.openide.explorer.propertysheet.PropertyEnv;
46.19 -
46.20 -/**
46.21 - * Property editor of the embedded delimiter length property.
46.22 - *
46.23 - * @author Jun Xu
46.24 - */
46.25 -public class DelimLengthPropertyEditor extends PropertyEditorSupport
46.26 - implements ExPropertyEditor {
46.27 -
46.28 - private static final ShortIntegerInplaceEditor mInplaceEditor =
46.29 - new ShortIntegerInplaceEditor((short) 0, (short) 100);
46.30 -
46.31 - public void attachEnv(PropertyEnv propertyEnv) {
46.32 - FeatureDescriptor desc = propertyEnv.getFeatureDescriptor();
46.33 - // Provide own InplaceEditor for editing the string value
46.34 - desc.setValue("inplaceEditor", mInplaceEditor); // NOI18N
46.35 - }
46.36 -}
47.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimOffsetPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
47.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
47.3 @@ -1,43 +0,0 @@
47.4 -/*
47.5 - * The contents of this file are subject to the terms of the Common Development
47.6 - * and Distribution License (the License). You may not use this file except in
47.7 - * compliance with the License.
47.8 - *
47.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
47.10 - * or http://www.netbeans.org/cddl.txt.
47.11 -
47.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
47.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
47.14 - * If applicable, add the following below the CDDL Header, with the fields
47.15 - * enclosed by brackets [] replaced by your own identifying information:
47.16 - * "Portions Copyrighted [year] [name of copyright owner]"
47.17 - *
47.18 - * The Original Software is NetBeans. The Initial Developer of the Original
47.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
47.20 - * Microsystems, Inc. All Rights Reserved.
47.21 - */
47.22 -
47.23 -package org.netbeans.modules.encoder.custom.aip;
47.24 -
47.25 -import java.beans.FeatureDescriptor;
47.26 -import java.beans.PropertyEditorSupport;
47.27 -import org.openide.explorer.propertysheet.ExPropertyEditor;
47.28 -import org.openide.explorer.propertysheet.PropertyEnv;
47.29 -
47.30 -/**
47.31 - * Property editor of the embedded delimiter offset property.
47.32 - *
47.33 - * @author Jun Xu
47.34 - */
47.35 -public class DelimOffsetPropertyEditor extends PropertyEditorSupport
47.36 - implements ExPropertyEditor {
47.37 -
47.38 - private static final IntegerInplaceEditor mIntegerInplaceEditor =
47.39 - new IntegerInplaceEditor(0, Integer.MAX_VALUE);
47.40 -
47.41 - public void attachEnv(PropertyEnv propertyEnv) {
47.42 - FeatureDescriptor desc = propertyEnv.getFeatureDescriptor();
47.43 - // Provide own InplaceEditor for editing the string value
47.44 - desc.setValue("inplaceEditor", mIntegerInplaceEditor); // NOI18N
47.45 - }
47.46 -}
48.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimOptionModePropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
48.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
48.3 @@ -1,60 +0,0 @@
48.4 -/*
48.5 - * The contents of this file are subject to the terms of the Common Development
48.6 - * and Distribution License (the License). You may not use this file except in
48.7 - * compliance with the License.
48.8 - *
48.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
48.10 - * or http://www.netbeans.org/cddl.txt.
48.11 -
48.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
48.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
48.14 - * If applicable, add the following below the CDDL Header, with the fields
48.15 - * enclosed by brackets [] replaced by your own identifying information:
48.16 - * "Portions Copyrighted [year] [name of copyright owner]"
48.17 - *
48.18 - * The Original Software is NetBeans. The Initial Developer of the Original
48.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
48.20 - * Microsystems, Inc. All Rights Reserved.
48.21 - */
48.22 -
48.23 -package org.netbeans.modules.encoder.custom.aip;
48.24 -
48.25 -import java.beans.PropertyEditorSupport;
48.26 -
48.27 -/**
48.28 - * Property editor for the delimiter option mode property.
48.29 - *
48.30 - * @author Jun Xu
48.31 - */
48.32 -public class DelimOptionModePropertyEditor extends PropertyEditorSupport {
48.33 -
48.34 - /**
48.35 - * Creates a new instance of DelimOptionModePropertyEditor
48.36 - */
48.37 - public DelimOptionModePropertyEditor() {
48.38 - }
48.39 -
48.40 - @Override
48.41 - public String[] getTags() {
48.42 - return DelimiterOption.optionModeTagList().toArray(new String[0]);
48.43 - }
48.44 -
48.45 - @Override
48.46 - public String getAsText() {
48.47 - return (String) getValue();
48.48 - }
48.49 -
48.50 - @Override
48.51 - public void setAsText(String text) throws IllegalArgumentException {
48.52 - setValue(text);
48.53 - }
48.54 -
48.55 - @Override
48.56 - public String getJavaInitializationString() {
48.57 - String value = (String) getValue();
48.58 - if (value == null) {
48.59 - return "null"; //NOI18N
48.60 - }
48.61 - return "\"" + value + "\""; //NOI18N
48.62 - }
48.63 -}
49.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimPrecedencePropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
49.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
49.3 @@ -1,33 +0,0 @@
49.4 -/*
49.5 - * DelimPrecedencePropertyEditor.java
49.6 - *
49.7 - * Created on January 6, 2007, 10:42 PM
49.8 - *
49.9 - * To change this template, choose Tools | Template Manager
49.10 - * and open the template in the editor.
49.11 - */
49.12 -
49.13 -package org.netbeans.modules.encoder.custom.aip;
49.14 -
49.15 -import java.beans.FeatureDescriptor;
49.16 -import java.beans.PropertyEditorSupport;
49.17 -import org.openide.explorer.propertysheet.ExPropertyEditor;
49.18 -import org.openide.explorer.propertysheet.PropertyEnv;
49.19 -
49.20 -/**
49.21 - * Property editor for the delimiter preference property.
49.22 - *
49.23 - * @author Jun Xu
49.24 - */
49.25 -public class DelimPrecedencePropertyEditor extends PropertyEditorSupport
49.26 - implements ExPropertyEditor {
49.27 -
49.28 - private static final ShortIntegerInplaceEditor mInplaceEditor =
49.29 - new ShortIntegerInplaceEditor((short) 0, (short) 100);
49.30 -
49.31 - public void attachEnv(PropertyEnv propertyEnv) {
49.32 - FeatureDescriptor desc = propertyEnv.getFeatureDescriptor();
49.33 - // Provide own InplaceEditor for editing the string value
49.34 - desc.setValue("inplaceEditor", mInplaceEditor); // NOI18N
49.35 - }
49.36 -}
50.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimTermModePropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
50.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
50.3 @@ -1,60 +0,0 @@
50.4 -/*
50.5 - * The contents of this file are subject to the terms of the Common Development
50.6 - * and Distribution License (the License). You may not use this file except in
50.7 - * compliance with the License.
50.8 - *
50.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
50.10 - * or http://www.netbeans.org/cddl.txt.
50.11 -
50.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
50.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
50.14 - * If applicable, add the following below the CDDL Header, with the fields
50.15 - * enclosed by brackets [] replaced by your own identifying information:
50.16 - * "Portions Copyrighted [year] [name of copyright owner]"
50.17 - *
50.18 - * The Original Software is NetBeans. The Initial Developer of the Original
50.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
50.20 - * Microsystems, Inc. All Rights Reserved.
50.21 - */
50.22 -
50.23 -package org.netbeans.modules.encoder.custom.aip;
50.24 -
50.25 -import java.beans.PropertyEditorSupport;
50.26 -
50.27 -/**
50.28 - * Property editor for the delimiter terninator mode property.
50.29 - *
50.30 - * @author Jun Xu
50.31 - */
50.32 -public class DelimTermModePropertyEditor extends PropertyEditorSupport {
50.33 -
50.34 - /**
50.35 - * Creates a new instance of DelimTermModePropertyEditor
50.36 - */
50.37 - public DelimTermModePropertyEditor() {
50.38 - }
50.39 -
50.40 - @Override
50.41 - public String[] getTags() {
50.42 - return DelimiterOption.termModeTagList().toArray(new String[0]);
50.43 - }
50.44 -
50.45 - @Override
50.46 - public String getAsText() {
50.47 - return (String) getValue();
50.48 - }
50.49 -
50.50 - @Override
50.51 - public void setAsText(String text) throws IllegalArgumentException {
50.52 - setValue(text);
50.53 - }
50.54 -
50.55 - @Override
50.56 - public String getJavaInitializationString() {
50.57 - String value = (String) getValue();
50.58 - if (value == null) {
50.59 - return "null"; //NOI18N
50.60 - }
50.61 - return "\"" + value + "\""; //NOI18N
50.62 - }
50.63 -}
51.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimTreeDelimiterNode.java Sat Sep 27 15:34:52 2008 -0700
51.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
51.3 @@ -1,235 +0,0 @@
51.4 -/*
51.5 - * The contents of this file are subject to the terms of the Common Development
51.6 - * and Distribution License (the License). You may not use this file except in
51.7 - * compliance with the License.
51.8 - *
51.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
51.10 - * or http://www.netbeans.org/cddl.txt.
51.11 -
51.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
51.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
51.14 - * If applicable, add the following below the CDDL Header, with the fields
51.15 - * enclosed by brackets [] replaced by your own identifying information:
51.16 - * "Portions Copyrighted [year] [name of copyright owner]"
51.17 - *
51.18 - * The Original Software is NetBeans. The Initial Developer of the Original
51.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
51.20 - * Microsystems, Inc. All Rights Reserved.
51.21 - */
51.22 -
51.23 -package org.netbeans.modules.encoder.custom.aip;
51.24 -
51.25 -import com.sun.encoder.custom.appinfo.Delimiter;
51.26 -import java.awt.Image;
51.27 -import java.beans.PropertyChangeEvent;
51.28 -import java.beans.PropertyChangeListener;
51.29 -import java.util.ResourceBundle;
51.30 -import org.openide.nodes.AbstractNode;
51.31 -import org.openide.nodes.Children;
51.32 -import org.openide.nodes.PropertySupport;
51.33 -import org.openide.nodes.Sheet;
51.34 -import org.openide.util.Lookup;
51.35 -import org.openide.util.Utilities;
51.36 -
51.37 -/**
51.38 - * The node that represents the delimiter in the delimiter tree.
51.39 - *
51.40 - * @author Jun Xu
51.41 - */
51.42 -public class DelimTreeDelimiterNode extends AbstractNode
51.43 - implements PropertyChangeListener, DelimiterSetChangeNotificationSupport {
51.44 -
51.45 - private static final ResourceBundle _bundle =
51.46 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle");
51.47 - private final DelimiterSetChangeNotifier mChangeNotifier =
51.48 - new DelimiterSetChangeNotifier();
51.49 - private final DelimiterOption mDelimOption;
51.50 -
51.51 - /** Creates a new instance of DelimTreeDelimiterNode */
51.52 - public DelimTreeDelimiterNode(Delimiter delim, Lookup lookup) {
51.53 - super(new Children.Array(), lookup);
51.54 - mDelimOption = DelimiterOption.create(delim);
51.55 - mDelimOption.addPropertyChangeListener(this);
51.56 - }
51.57 -
51.58 - @Override
51.59 - public boolean canRename() {
51.60 - return false;
51.61 - }
51.62 -
51.63 - @Override
51.64 - public boolean canCut() {
51.65 - return false;
51.66 - }
51.67 -
51.68 - @Override
51.69 - public boolean canCopy() {
51.70 - return false;
51.71 - }
51.72 -
51.73 - @Override
51.74 - public String getName() {
51.75 - return "Delimiter"; //NOI18N
51.76 - }
51.77 -
51.78 - @Override
51.79 - public String getDisplayName() {
51.80 - return _bundle.getString("delim_tree_delim_node.lbl.delimiter");
51.81 - }
51.82 -
51.83 - @Override
51.84 - public Image getIcon(int i) {
51.85 - return Utilities.loadImage("org/netbeans/modules/encoder/custom/aip/delimIcon.PNG"); //NOI18N
51.86 - }
51.87 -
51.88 - @Override
51.89 - public Image getOpenedIcon(int i) {
51.90 - return Utilities.loadImage("org/netbeans/modules/encoder/custom/aip/delimOpenIcon.PNG"); //NOI18N
51.91 - }
51.92 -
51.93 - @Override
51.94 - protected Sheet createSheet() {
51.95 - Sheet.Set propSet = Sheet.createPropertiesSet();
51.96 - try {
51.97 - //The Node Type Property
51.98 - PropertySupport.Reflection<String> kindProp =
51.99 - new PropertySupport.Reflection<String>(mDelimOption,
51.100 - String.class, "kind"); //NOI18N
51.101 - kindProp.setName("kind"); //NOI18N
51.102 - kindProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.type"));
51.103 - kindProp.setPropertyEditorClass(DelimKindPropertyEditor.class);
51.104 - propSet.put(kindProp);
51.105 -
51.106 - PropertySupport.Reflection<Short> precedenceProp =
51.107 - new PropertySupport.Reflection<Short>(mDelimOption,
51.108 - short.class, "precedence"); //NOI18N
51.109 - precedenceProp.setName("precedence"); //NOI18N
51.110 - precedenceProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.precedence"));
51.111 - precedenceProp.setPropertyEditorClass(DelimPrecedencePropertyEditor.class);
51.112 - propSet.put(precedenceProp);
51.113 -
51.114 - PropertySupport.Reflection<String> optionModeProp =
51.115 - new PropertySupport.Reflection<String>(mDelimOption,
51.116 - String.class, "optionMode"); //NOI18N
51.117 - optionModeProp.setName("optionMode"); //NOI18N
51.118 - optionModeProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.opt_mode"));
51.119 - optionModeProp.setPropertyEditorClass(DelimOptionModePropertyEditor.class);
51.120 - propSet.put(optionModeProp);
51.121 -
51.122 - PropertySupport.Reflection<String> termModeProp =
51.123 - new PropertySupport.Reflection<String>(mDelimOption,
51.124 - String.class, "termMode"); //NOI18N
51.125 - termModeProp.setName("termMode"); //NOI18N
51.126 - termModeProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.term_mode"));
51.127 - termModeProp.setPropertyEditorClass(DelimTermModePropertyEditor.class);
51.128 - propSet.put(termModeProp);
51.129 -
51.130 - PropertySupport.Reflection<String> bytesProp =
51.131 - new PropertySupport.Reflection<String>(mDelimOption,
51.132 - String.class, "bytes"); //NOI18N
51.133 - bytesProp.setName("bytes"); //NOI18N
51.134 - bytesProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.delim_bytes"));
51.135 - bytesProp.setPropertyEditorClass(DelimiterPropertyEditor.class);
51.136 - propSet.put(bytesProp);
51.137 -
51.138 - PropertySupport.Reflection<Integer> offsetProp =
51.139 - new PropertySupport.Reflection<Integer>(mDelimOption,
51.140 - int.class, "offset"); //NOI18N
51.141 - offsetProp.setName("offset"); //NOI18N
51.142 - offsetProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.offset"));
51.143 - offsetProp.setPropertyEditorClass(DelimOffsetPropertyEditor.class);
51.144 - propSet.put(offsetProp);
51.145 -
51.146 - PropertySupport.Reflection<Short> lengthProp =
51.147 - new PropertySupport.Reflection<Short>(mDelimOption,
51.148 - short.class, "length"); //NOI18N
51.149 - lengthProp.setName("length"); //NOI18N
51.150 - lengthProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.length"));
51.151 - lengthProp.setPropertyEditorClass(DelimLengthPropertyEditor.class);
51.152 - propSet.put(lengthProp);
51.153 -
51.154 - PropertySupport.Reflection<Boolean> detachedProp =
51.155 - new PropertySupport.Reflection<Boolean>(mDelimOption,
51.156 - boolean.class, "detached"); //NOI18N
51.157 - detachedProp.setName("detached"); //NOI18N
51.158 - detachedProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.detached"));
51.159 - propSet.put(detachedProp);
51.160 -
51.161 - PropertySupport.Reflection<String> beginBytesProp =
51.162 - new PropertySupport.Reflection<String>(mDelimOption,
51.163 - String.class, "beginBytes"); //NOI18N
51.164 - beginBytesProp.setName("beginBytes"); //NOI18N
51.165 - beginBytesProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.begin_delim_bytes"));
51.166 - beginBytesProp.setPropertyEditorClass(DelimiterPropertyEditor.class);
51.167 - propSet.put(beginBytesProp);
51.168 -
51.169 - PropertySupport.Reflection<Integer> beginOffsetProp =
51.170 - new PropertySupport.Reflection<Integer>(mDelimOption,
51.171 - int.class, "beginOffset"); //NOI18N
51.172 - beginOffsetProp.setName("beginOffset"); //NOI18N
51.173 - beginOffsetProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.begin_offset"));
51.174 - beginOffsetProp.setPropertyEditorClass(DelimOffsetPropertyEditor.class);
51.175 - propSet.put(beginOffsetProp);
51.176 -
51.177 - PropertySupport.Reflection<Short> beginLengthProp =
51.178 - new PropertySupport.Reflection<Short>(mDelimOption,
51.179 - short.class, "beginLength"); //NOI18N
51.180 - beginLengthProp.setName("beginLength"); //NOI18N
51.181 - beginLengthProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.begin_length"));
51.182 - beginLengthProp.setPropertyEditorClass(DelimLengthPropertyEditor.class);
51.183 - propSet.put(beginLengthProp);
51.184 -
51.185 - PropertySupport.Reflection<Boolean> beginDetachedProp =
51.186 - new PropertySupport.Reflection<Boolean>(mDelimOption,
51.187 - boolean.class, "beginDetached"); //NOI18N
51.188 - beginDetachedProp.setName("beginDetached"); //NOI18N
51.189 - beginDetachedProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.begin_detached"));
51.190 - propSet.put(beginDetachedProp);
51.191 -
51.192 - PropertySupport.Reflection<Boolean> skipLeadingProp =
51.193 - new PropertySupport.Reflection<Boolean>(mDelimOption,
51.194 - boolean.class, "skipLeading"); //NOI18N
51.195 - skipLeadingProp.setName("skipLeading"); //NOI18N
51.196 - skipLeadingProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.skip_leading"));
51.197 - propSet.put(skipLeadingProp);
51.198 -
51.199 - PropertySupport.Reflection<Boolean> collapseProp =
51.200 - new PropertySupport.Reflection<Boolean>(mDelimOption,
51.201 - boolean.class, "collapse"); //NOI18N
51.202 - collapseProp.setName("collapse"); //NOI18N
51.203 - collapseProp.setDisplayName(_bundle.getString("delim_tree_delim_node.lbl.collapse"));
51.204 - propSet.put(collapseProp);
51.205 - } catch (NoSuchMethodException e) {
51.206 - throw new RuntimeException(_bundle.getString("delim_tree_delim_node.exp.no_such_mthd"), e);
51.207 - }
51.208 - Sheet sheet = Sheet.createDefault();
51.209 - sheet.put(propSet);
51.210 - return sheet;
51.211 - }
51.212 -
51.213 - public void propertyChange(PropertyChangeEvent evt) {
51.214 - firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
51.215 - mChangeNotifier.fireDelimiterSetChangeEvent(
51.216 - evt.getSource(), evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
51.217 - }
51.218 -
51.219 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
51.220 - mChangeNotifier.addDelimiterSetChangeListener(listener);
51.221 - }
51.222 -
51.223 - public DelimiterSetChangeListener[] getDelimiterSetChangeListeners() {
51.224 - return mChangeNotifier.getDelimiterSetChangeListeners();
51.225 - }
51.226 -
51.227 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
51.228 - mChangeNotifier.removeDelimiterSetChangeListener(listener);
51.229 - }
51.230 -
51.231 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
51.232 - mChangeNotifier.addDelimiterSetChangeListener(listeners);
51.233 - }
51.234 -
51.235 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
51.236 - mChangeNotifier.removeDelimiterSetChangeListener(listeners);
51.237 - }
51.238 -}
52.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimTreeLevelNode.java Sat Sep 27 15:34:52 2008 -0700
52.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
52.3 @@ -1,111 +0,0 @@
52.4 -/*
52.5 - * The contents of this file are subject to the terms of the Common Development
52.6 - * and Distribution License (the License). You may not use this file except in
52.7 - * compliance with the License.
52.8 - *
52.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
52.10 - * or http://www.netbeans.org/cddl.txt.
52.11 -
52.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
52.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
52.14 - * If applicable, add the following below the CDDL Header, with the fields
52.15 - * enclosed by brackets [] replaced by your own identifying information:
52.16 - * "Portions Copyrighted [year] [name of copyright owner]"
52.17 - *
52.18 - * The Original Software is NetBeans. The Initial Developer of the Original
52.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
52.20 - * Microsystems, Inc. All Rights Reserved.
52.21 - */
52.22 -
52.23 -package org.netbeans.modules.encoder.custom.aip;
52.24 -
52.25 -import com.sun.encoder.custom.appinfo.DelimiterLevel;
52.26 -import java.awt.Image;
52.27 -import java.util.ResourceBundle;
52.28 -import org.openide.nodes.AbstractNode;
52.29 -import org.openide.nodes.Children;
52.30 -import org.openide.util.Lookup;
52.31 -import org.openide.util.Utilities;
52.32 -
52.33 -/**
52.34 - * The node that represents the delimiter level in the delimiter tree.
52.35 - *
52.36 - * @author Jun Xu
52.37 - */
52.38 -public class DelimTreeLevelNode extends AbstractNode
52.39 - implements DelimiterSetChangeNotificationSupport {
52.40 -
52.41 - private static final ResourceBundle _bundle =
52.42 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle");
52.43 - private final DelimiterSetChangeNotifier mChangeNotifier =
52.44 - new DelimiterSetChangeNotifier();
52.45 - private final DelimiterLevel mDelimLevel;
52.46 -
52.47 - /**
52.48 - * Creates a new instance of DelimTreeLevelNode (with empty children).
52.49 - * @param delimLevel - DelimiterLevel
52.50 - * @param children - Children
52.51 - * @param lookup - Lookup
52.52 - */
52.53 - public DelimTreeLevelNode(DelimiterLevel delimLevel, Children children, Lookup lookup) {
52.54 - super(children, lookup);
52.55 - mDelimLevel = delimLevel;
52.56 - }
52.57 -
52.58 - @Override
52.59 - public boolean canRename() {
52.60 - return false;
52.61 - }
52.62 -
52.63 - @Override
52.64 - public boolean canCut() {
52.65 - return false;
52.66 - }
52.67 -
52.68 - @Override
52.69 - public boolean canCopy() {
52.70 - return false;
52.71 - }
52.72 -
52.73 - @Override
52.74 - public Image getIcon(int i) {
52.75 - return Utilities.loadImage(
52.76 - "org/netbeans/modules/encoder/custom/aip/delimLevelIcon.PNG"); //NOI18N
52.77 - }
52.78 -
52.79 - @Override
52.80 - public Image getOpenedIcon(int i) {
52.81 - return Utilities.loadImage(
52.82 - "org/netbeans/modules/encoder/custom/aip/delimLevelOpenIcon.PNG"); //NOI18N
52.83 - }
52.84 -
52.85 - @Override
52.86 - public String getName() {
52.87 - return "Level"; //NOI18N
52.88 - }
52.89 -
52.90 - @Override
52.91 - public String getDisplayName() {
52.92 - return _bundle.getString("delim_tree_level_node.lbl.level");
52.93 - }
52.94 -
52.95 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
52.96 - mChangeNotifier.addDelimiterSetChangeListener(listener);
52.97 - }
52.98 -
52.99 - public DelimiterSetChangeListener[] getDelimiterSetChangeListeners() {
52.100 - return mChangeNotifier.getDelimiterSetChangeListeners();
52.101 - }
52.102 -
52.103 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
52.104 - mChangeNotifier.removeDelimiterSetChangeListener(listener);
52.105 - }
52.106 -
52.107 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
52.108 - mChangeNotifier.addDelimiterSetChangeListener(listeners);
52.109 - }
52.110 -
52.111 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
52.112 - mChangeNotifier.removeDelimiterSetChangeListener(listeners);
52.113 - }
52.114 -}
53.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimTreeLevelNodeChildren.java Sat Sep 27 15:34:52 2008 -0700
53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
53.3 @@ -1,107 +0,0 @@
53.4 -/*
53.5 - * The contents of this file are subject to the terms of the Common Development
53.6 - * and Distribution License (the License). You may not use this file except in
53.7 - * compliance with the License.
53.8 - *
53.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
53.10 - * or http://www.netbeans.org/cddl.txt.
53.11 -
53.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
53.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
53.14 - * If applicable, add the following below the CDDL Header, with the fields
53.15 - * enclosed by brackets [] replaced by your own identifying information:
53.16 - * "Portions Copyrighted [year] [name of copyright owner]"
53.17 - *
53.18 - * The Original Software is NetBeans. The Initial Developer of the Original
53.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
53.20 - * Microsystems, Inc. All Rights Reserved.
53.21 - */
53.22 -
53.23 -package org.netbeans.modules.encoder.custom.aip;
53.24 -
53.25 -import com.sun.encoder.custom.appinfo.Delimiter;
53.26 -import com.sun.encoder.custom.appinfo.DelimiterLevel;
53.27 -import java.util.ArrayList;
53.28 -import java.util.Collections;
53.29 -import java.util.List;
53.30 -import org.openide.nodes.Children;
53.31 -import org.openide.nodes.Node;
53.32 -import org.openide.util.lookup.Lookups;
53.33 -
53.34 -/**
53.35 - * Implementation of the Children interface of the delimiter level node.
53.36 - *
53.37 - * @author Jun Xu
53.38 - */
53.39 -public class DelimTreeLevelNodeChildren extends Children.Keys
53.40 - implements DelimiterSetChangeNotificationSupport {
53.41 -
53.42 - private final DelimiterSetChangeNotifier mChangeNotifier =
53.43 - new DelimiterSetChangeNotifier();
53.44 - private final DelimiterLevel mDelimLevel;
53.45 -
53.46 - /**
53.47 - * Creates a new instance of DelimTreeLevelNodeChildren
53.48 - * @param delimLevel - DelimiterLevel
53.49 - */
53.50 - public DelimTreeLevelNodeChildren(DelimiterLevel delimLevel) {
53.51 - mDelimLevel = delimLevel;
53.52 - }
53.53 -
53.54 - protected Node[] createNodes(Object object) {
53.55 - DelimTreeDelimiterNode node =
53.56 - new DelimTreeDelimiterNode((Delimiter) object, Lookups.singleton(object));
53.57 - node.addDelimiterSetChangeListener(getDelimiterSetChangeListeners());
53.58 - return new Node[]{node};
53.59 - }
53.60 -
53.61 - @Override
53.62 - protected void removeNotify() {
53.63 - setKeys(Collections.EMPTY_LIST);
53.64 - }
53.65 -
53.66 - @Override
53.67 - protected void addNotify() {
53.68 - List<Delimiter> keyList = new ArrayList<Delimiter>();
53.69 - for (int i = 0; i < mDelimLevel.sizeOfDelimiterArray(); i++) {
53.70 - keyList.add(mDelimLevel.getDelimiterArray(i));
53.71 - }
53.72 - setKeys(keyList);
53.73 - }
53.74 -
53.75 - @Override
53.76 - public boolean remove(final Node[] node) {
53.77 - addNotify();
53.78 - mChangeNotifier.fireDelimiterSetChangeEvent(
53.79 - mDelimLevel, "children", null, mDelimLevel.getDelimiterArray()); //NOI18N
53.80 - return true;
53.81 - }
53.82 -
53.83 - @Override
53.84 - public boolean add(Node[] node) {
53.85 - addNotify();
53.86 - mChangeNotifier.fireDelimiterSetChangeEvent(
53.87 - mDelimLevel, "children", null, mDelimLevel.getDelimiterArray()); //NOI18N
53.88 - return true;
53.89 - }
53.90 -
53.91 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
53.92 - mChangeNotifier.addDelimiterSetChangeListener(listener);
53.93 - }
53.94 -
53.95 - public DelimiterSetChangeListener[] getDelimiterSetChangeListeners() {
53.96 - return mChangeNotifier.getDelimiterSetChangeListeners();
53.97 - }
53.98 -
53.99 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
53.100 - mChangeNotifier.removeDelimiterSetChangeListener(listener);
53.101 - }
53.102 -
53.103 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
53.104 - mChangeNotifier.addDelimiterSetChangeListener(listeners);
53.105 - }
53.106 -
53.107 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
53.108 - mChangeNotifier.removeDelimiterSetChangeListener(listeners);
53.109 - }
53.110 -}
54.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimTreeRootNode.java Sat Sep 27 15:34:52 2008 -0700
54.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
54.3 @@ -1,77 +0,0 @@
54.4 -/*
54.5 - * The contents of this file are subject to the terms of the Common Development
54.6 - * and Distribution License (the License). You may not use this file except in
54.7 - * compliance with the License.
54.8 - *
54.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
54.10 - * or http://www.netbeans.org/cddl.txt.
54.11 -
54.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
54.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
54.14 - * If applicable, add the following below the CDDL Header, with the fields
54.15 - * enclosed by brackets [] replaced by your own identifying information:
54.16 - * "Portions Copyrighted [year] [name of copyright owner]"
54.17 - *
54.18 - * The Original Software is NetBeans. The Initial Developer of the Original
54.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
54.20 - * Microsystems, Inc. All Rights Reserved.
54.21 - */
54.22 -
54.23 -package org.netbeans.modules.encoder.custom.aip;
54.24 -
54.25 -import com.sun.encoder.custom.appinfo.DelimiterSet;
54.26 -import java.util.ResourceBundle;
54.27 -import org.openide.nodes.AbstractNode;
54.28 -import org.openide.nodes.Children;
54.29 -import org.openide.util.Lookup;
54.30 -
54.31 -/**
54.32 - * The node that represents the root of the delimiter tree.
54.33 - *
54.34 - * @author Jun Xu
54.35 - */
54.36 -public class DelimTreeRootNode extends AbstractNode
54.37 - implements DelimiterSetChangeNotificationSupport {
54.38 -
54.39 - private static final ResourceBundle _bundle =
54.40 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle");
54.41 - private final DelimiterSetChangeNotifier mChangeNotifier =
54.42 - new DelimiterSetChangeNotifier();
54.43 - private final DelimiterSet mDelimSet;
54.44 -
54.45 - /** Creates a new instance of DelimTreeRootNode */
54.46 - public DelimTreeRootNode(DelimiterSet delimSet, Children children, Lookup lookup) {
54.47 - super(children, lookup);
54.48 - mDelimSet = delimSet;
54.49 - }
54.50 -
54.51 - @Override
54.52 - public String getName() {
54.53 - return "Level"; //NOI18N
54.54 - }
54.55 -
54.56 - @Override
54.57 - public String getDisplayName() {
54.58 - return _bundle.getString("delim_tree_root_node.lbl.level");
54.59 - }
54.60 -
54.61 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
54.62 - mChangeNotifier.addDelimiterSetChangeListener(listener);
54.63 - }
54.64 -
54.65 - public DelimiterSetChangeListener[] getDelimiterSetChangeListeners() {
54.66 - return mChangeNotifier.getDelimiterSetChangeListeners();
54.67 - }
54.68 -
54.69 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
54.70 - mChangeNotifier.removeDelimiterSetChangeListener(listener);
54.71 - }
54.72 -
54.73 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
54.74 - mChangeNotifier.addDelimiterSetChangeListener(listeners);
54.75 - }
54.76 -
54.77 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
54.78 - mChangeNotifier.removeDelimiterSetChangeListener(listeners);
54.79 - }
54.80 -}
55.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimTreeRootNodeChildren.java Sat Sep 27 15:34:52 2008 -0700
55.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
55.3 @@ -1,113 +0,0 @@
55.4 -/*
55.5 - * The contents of this file are subject to the terms of the Common Development
55.6 - * and Distribution License (the License). You may not use this file except in
55.7 - * compliance with the License.
55.8 - *
55.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
55.10 - * or http://www.netbeans.org/cddl.txt.
55.11 -
55.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
55.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
55.14 - * If applicable, add the following below the CDDL Header, with the fields
55.15 - * enclosed by brackets [] replaced by your own identifying information:
55.16 - * "Portions Copyrighted [year] [name of copyright owner]"
55.17 - *
55.18 - * The Original Software is NetBeans. The Initial Developer of the Original
55.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
55.20 - * Microsystems, Inc. All Rights Reserved.
55.21 - */
55.22 -
55.23 -package org.netbeans.modules.encoder.custom.aip;
55.24 -
55.25 -import com.sun.encoder.custom.appinfo.DelimiterLevel;
55.26 -import com.sun.encoder.custom.appinfo.DelimiterSet;
55.27 -import java.util.ArrayList;
55.28 -import java.util.Collection;
55.29 -import java.util.Collections;
55.30 -import org.openide.nodes.Children;
55.31 -import org.openide.nodes.Node;
55.32 -import org.openide.util.lookup.Lookups;
55.33 -
55.34 -/**
55.35 - * Implementation of the Children interface of the delimiter set root node.
55.36 - *
55.37 - * @author Jun Xu
55.38 - */
55.39 -public class DelimTreeRootNodeChildren extends Children.Keys
55.40 - implements DelimiterSetChangeNotificationSupport {
55.41 -
55.42 - private final DelimiterSetChangeNotifier mChangeNotifier =
55.43 - new DelimiterSetChangeNotifier();
55.44 - private final DelimiterSet mDelimSet;
55.45 -
55.46 - /**
55.47 - * Creates a new instance of DelimTreeRootNodeChildren
55.48 - * @param delimSet DelimiterSet object.
55.49 - */
55.50 - public DelimTreeRootNodeChildren(DelimiterSet delimSet) {
55.51 - mDelimSet = delimSet;
55.52 - }
55.53 -
55.54 - protected Node[] createNodes(Object object) {
55.55 - DelimTreeLevelNodeChildren children =
55.56 - new DelimTreeLevelNodeChildren((DelimiterLevel) object);
55.57 - children.addDelimiterSetChangeListener(getDelimiterSetChangeListeners());
55.58 - DelimTreeLevelNode node =
55.59 - new DelimTreeLevelNode(
55.60 - (DelimiterLevel) object,
55.61 - children,
55.62 - Lookups.singleton(object));
55.63 - node.addDelimiterSetChangeListener(getDelimiterSetChangeListeners());
55.64 - return new Node[]{node};
55.65 - }
55.66 -
55.67 - @Override
55.68 - protected void removeNotify() {
55.69 - setKeys(Collections.EMPTY_LIST);
55.70 - }
55.71 -
55.72 - @Override
55.73 - protected void addNotify() {
55.74 - Collection<DelimiterLevel> keyList = new ArrayList<DelimiterLevel>();
55.75 - for (int i = 0; i < mDelimSet.sizeOfLevelArray(); i++) {
55.76 - keyList.add(mDelimSet.getLevelArray(i));
55.77 - }
55.78 - setKeys(keyList);
55.79 - }
55.80 -
55.81 - @Override
55.82 - public boolean remove(Node[] node) {
55.83 - addNotify();
55.84 - mChangeNotifier.fireDelimiterSetChangeEvent(
55.85 - mDelimSet, "children", null, mDelimSet.getLevelArray()); //NOI18N
55.86 - return true;
55.87 - }
55.88 -
55.89 - @Override
55.90 - public boolean add(Node[] node) {
55.91 - addNotify();
55.92 - mChangeNotifier.fireDelimiterSetChangeEvent(
55.93 - mDelimSet, "children", null, mDelimSet.getLevelArray()); //NOI18N
55.94 - return true;
55.95 - }
55.96 -
55.97 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
55.98 - mChangeNotifier.addDelimiterSetChangeListener(listener);
55.99 - }
55.100 -
55.101 - public DelimiterSetChangeListener[] getDelimiterSetChangeListeners() {
55.102 - return mChangeNotifier.getDelimiterSetChangeListeners();
55.103 - }
55.104 -
55.105 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
55.106 - mChangeNotifier.removeDelimiterSetChangeListener(listener);
55.107 - }
55.108 -
55.109 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
55.110 - mChangeNotifier.addDelimiterSetChangeListener(listeners);
55.111 - }
55.112 -
55.113 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener[] listeners) {
55.114 - mChangeNotifier.removeDelimiterSetChangeListener(listeners);
55.115 - }
55.116 -}
56.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterOption.java Sat Sep 27 15:34:52 2008 -0700
56.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
56.3 @@ -1,484 +0,0 @@
56.4 -/*
56.5 - * The contents of this file are subject to the terms of the Common Development
56.6 - * and Distribution License (the License). You may not use this file except in
56.7 - * compliance with the License.
56.8 - *
56.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
56.10 - * or http://www.netbeans.org/cddl.txt.
56.11 -
56.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
56.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
56.14 - * If applicable, add the following below the CDDL Header, with the fields
56.15 - * enclosed by brackets [] replaced by your own identifying information:
56.16 - * "Portions Copyrighted [year] [name of copyright owner]"
56.17 - *
56.18 - * The Original Software is NetBeans. The Initial Developer of the Original
56.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
56.20 - * Microsystems, Inc. All Rights Reserved.
56.21 - */
56.22 -
56.23 -package org.netbeans.modules.encoder.custom.aip;
56.24 -
56.25 -import com.sun.encoder.custom.appinfo.Delimiter;
56.26 -import java.beans.PropertyChangeEvent;
56.27 -import java.beans.PropertyChangeListener;
56.28 -import java.util.ArrayList;
56.29 -import java.util.Collections;
56.30 -import java.util.HashMap;
56.31 -import java.util.LinkedList;
56.32 -import java.util.List;
56.33 -import java.util.Map;
56.34 -import java.util.ResourceBundle;
56.35 -
56.36 -/**
56.37 - * The model of the delimiter node.
56.38 - *
56.39 - * @author Jun Xu
56.40 - */
56.41 -public final class DelimiterOption {
56.42 -
56.43 - public static final String KIND_PREFIX = "kind"; //NOI18N
56.44 - public static final String OPTION_MODE_PREFIX = "optionmode"; //NOI18N
56.45 - public static final String TERM_MODE_PREFIX = "termmode"; //NOI18N
56.46 -
56.47 - private static final Map<String, String> mReverseTextMap =
56.48 - new HashMap<String, String>();
56.49 - private static final Map<String, String> mTextMap =
56.50 - new HashMap<String, String>();
56.51 - private static List<String> mKindTagList = new ArrayList<String>();
56.52 - private static List<String> mOptionModeTagList = new ArrayList<String>();
56.53 - private static List<String> mTermModeTagList = new ArrayList<String>();
56.54 -
56.55 - static {
56.56 - ResourceBundle bundle =
56.57 - ResourceBundle.getBundle(
56.58 - DelimiterOption.class.getPackage().getName() + ".Bundle"); //NOI18N
56.59 -
56.60 - //Populate the localized text map and the tag list for the delimiter kind property
56.61 - mReverseTextMap.put(KIND_PREFIX + "_" + bundle.getString("TAG_DelimKind_normal"), "normal"); //NOI18N
56.62 - mReverseTextMap.put(KIND_PREFIX + "_" + bundle.getString("TAG_DelimKind_repeat"), "repeat"); //NOI18N
56.63 - mReverseTextMap.put(KIND_PREFIX + "_" + bundle.getString("TAG_DelimKind_escape"), "escape"); //NOI18N
56.64 - mReverseTextMap.put(KIND_PREFIX + "_" + bundle.getString("TAG_DelimKind_quot_escape"), "quot-escape"); //NOI18N
56.65 - mTextMap.put(KIND_PREFIX + "_" + "normal", bundle.getString("TAG_DelimKind_normal")); //NOI18N
56.66 - mTextMap.put(KIND_PREFIX + "_" + "repeat", bundle.getString("TAG_DelimKind_repeat")); //NOI18N
56.67 - mTextMap.put(KIND_PREFIX + "_" + "escape", bundle.getString("TAG_DelimKind_escape")); //NOI18N
56.68 - mTextMap.put(KIND_PREFIX + "_" + "quot-escape", bundle.getString("TAG_DelimKind_quot_escape")); //NOI18N
56.69 - mKindTagList.add(bundle.getString("TAG_DelimKind_normal")); //NOI18N
56.70 - mKindTagList.add(bundle.getString("TAG_DelimKind_repeat")); //NOI18N
56.71 - mKindTagList.add(bundle.getString("TAG_DelimKind_escape")); //NOI18N
56.72 - mKindTagList.add(bundle.getString("TAG_DelimKind_quot_escape")); //NOI18N
56.73 - mKindTagList = Collections.unmodifiableList(mKindTagList);
56.74 -
56.75 - //Populate the localized text map and the tag list for the optionality mode property
56.76 - mReverseTextMap.put(OPTION_MODE_PREFIX + "_" + bundle.getString("TAG_OptionMode_never"), "never"); //NOI18N
56.77 - mReverseTextMap.put(OPTION_MODE_PREFIX + "_" + bundle.getString("TAG_OptionMode_allow"), "allow"); //NOI18N
56.78 - mReverseTextMap.put(OPTION_MODE_PREFIX + "_" + bundle.getString("TAG_OptionMode_favor"), "favor"); //NOI18N
56.79 - mReverseTextMap.put(OPTION_MODE_PREFIX + "_" + bundle.getString("TAG_OptionMode_force"), "force"); //NOI18N
56.80 - mTextMap.put(OPTION_MODE_PREFIX + "_" + "never", bundle.getString("TAG_OptionMode_never")); //NOI18N
56.81 - mTextMap.put(OPTION_MODE_PREFIX + "_" + "allow", bundle.getString("TAG_OptionMode_allow")); //NOI18N
56.82 - mTextMap.put(OPTION_MODE_PREFIX + "_" + "favor", bundle.getString("TAG_OptionMode_favor")); //NOI18N
56.83 - mTextMap.put(OPTION_MODE_PREFIX + "_" + "force", bundle.getString("TAG_OptionMode_force")); //NOI18N
56.84 - mOptionModeTagList.add(bundle.getString("TAG_OptionMode_never"));
56.85 - mOptionModeTagList.add(bundle.getString("TAG_OptionMode_allow"));
56.86 - mOptionModeTagList.add(bundle.getString("TAG_OptionMode_favor"));
56.87 - mOptionModeTagList.add(bundle.getString("TAG_OptionMode_force"));
56.88 - mOptionModeTagList = Collections.unmodifiableList(mOptionModeTagList);
56.89 -
56.90 - //Populate the localized text map and the tag list for the optionality mode property
56.91 - mReverseTextMap.put(TERM_MODE_PREFIX + "_" + bundle.getString("TAG_TermMode_never"), "never"); //NOI18N
56.92 - mReverseTextMap.put(TERM_MODE_PREFIX + "_" + bundle.getString("TAG_TermMode_allow"), "allow"); //NOI18N
56.93 - mReverseTextMap.put(TERM_MODE_PREFIX + "_" + bundle.getString("TAG_TermMode_favor"), "favor"); //NOI18N
56.94 - mReverseTextMap.put(TERM_MODE_PREFIX + "_" + bundle.getString("TAG_TermMode_force"), "force"); //NOI18N
56.95 - mTextMap.put(TERM_MODE_PREFIX + "_" + "never", bundle.getString("TAG_TermMode_never")); //NOI18N
56.96 - mTextMap.put(TERM_MODE_PREFIX + "_" + "allow", bundle.getString("TAG_TermMode_allow")); //NOI18N
56.97 - mTextMap.put(TERM_MODE_PREFIX + "_" + "favor", bundle.getString("TAG_TermMode_favor")); //NOI18N
56.98 - mTextMap.put(TERM_MODE_PREFIX + "_" + "force", bundle.getString("TAG_TermMode_force")); //NOI18N
56.99 - mTermModeTagList.add(bundle.getString("TAG_TermMode_never"));
56.100 - mTermModeTagList.add(bundle.getString("TAG_TermMode_allow"));
56.101 - mTermModeTagList.add(bundle.getString("TAG_TermMode_favor"));
56.102 - mTermModeTagList.add(bundle.getString("TAG_TermMode_force"));
56.103 - mTermModeTagList = Collections.unmodifiableList(mTermModeTagList);
56.104 - }
56.105 -
56.106 - /* Bean property change listeners */
56.107 - private final List<PropertyChangeListener> propChangeListeners =
56.108 - Collections.synchronizedList(new LinkedList<PropertyChangeListener>());
56.109 -
56.110 - private final Delimiter mDelimiter;
56.111 -
56.112 - /***************************\
56.113 - * Bean property variables *
56.114 - \***************************/
56.115 -
56.116 - private String mKind = mTextMap.get(KIND_PREFIX + "_" + "normal"); //NOI18N
56.117 - private short mPrecedence = 10;
56.118 - private String mOptionMode = mTextMap.get(OPTION_MODE_PREFIX + "_" + "never"); //NOI18N
56.119 - private String mTermMode = mTextMap.get(TERM_MODE_PREFIX + "_" + "never"); //NOI18N
56.120 - private String mBytes = ""; //NOI18N
56.121 - private int mOffset = 0;
56.122 - private short mLength = 0;
56.123 - private boolean mDetached = false;
56.124 - private String mBeginBytes = ""; //NOI18N
56.125 - private int mBeginOffset = 0;
56.126 - private short mBeginLength = 0;
56.127 - private boolean mBeginDetached = false;
56.128 - private boolean mSkipLeading = false;
56.129 - private boolean mCollapse = false;
56.130 -
56.131 - /** Creates a new instance of DelimiterOption. */
56.132 - private DelimiterOption(Delimiter delim) {
56.133 - mDelimiter = delim;
56.134 - }
56.135 -
56.136 - public static DelimiterOption create(Delimiter delim) {
56.137 - DelimiterOption option = new DelimiterOption(delim);
56.138 - option.init();
56.139 - return option;
56.140 - }
56.141 -
56.142 - public static Map<String, String> textMap() {
56.143 - return mTextMap;
56.144 - }
56.145 -
56.146 - public static Map<String, String> reverseTextMap() {
56.147 - return mReverseTextMap;
56.148 - }
56.149 -
56.150 - public static List<String> kindTagList() {
56.151 - return mKindTagList;
56.152 - }
56.153 -
56.154 - public static List<String> optionModeTagList() {
56.155 - return mOptionModeTagList;
56.156 - }
56.157 -
56.158 - public static List<String> termModeTagList() {
56.159 - return mTermModeTagList;
56.160 - }
56.161 -
56.162 - /*****************************\
56.163 - * bean getters and setters *
56.164 - \*****************************/
56.165 -
56.166 - public String getKind() {
56.167 - return mKind;
56.168 - }
56.169 -
56.170 - public void setKind(String kind) {
56.171 - String old = mKind;
56.172 - mKind = kind;
56.173 - mDelimiter.setKind(
56.174 - Delimiter.Kind.Enum.forString(
56.175 - mReverseTextMap.get(KIND_PREFIX + "_" + kind))); //NOI18N
56.176 - firePropertyChange("kind", old, mKind); //NOI18N
56.177 - }
56.178 -
56.179 - public String getBytes() {
56.180 - return mBytes;
56.181 - }
56.182 -
56.183 - public void setBytes(String bytes) {
56.184 - String old = mBytes;
56.185 - mBytes = bytes;
56.186 - if (mDelimiter.getBytes() == null) {
56.187 - // no "bytes" element in XSD, so
56.188 - // we append a new empty "bytes" element
56.189 - mDelimiter.addNewBytes();
56.190 - }
56.191 - if (mDelimiter.getBytes().isSetEmbedded()) {
56.192 - // if "bytes" contains "embedded" choice element,
56.193 - // then unset it.
56.194 - mDelimiter.getBytes().unsetEmbedded();
56.195 - }
56.196 - // set the "constant" choice element under "bytes"
56.197 - mDelimiter.getBytes().setConstant(mBytes);
56.198 - int oldOffset = mOffset;
56.199 - mOffset = 0;
56.200 - short oldLength = mLength;
56.201 - mLength = 0;
56.202 - firePropertyChange("offset", oldOffset, mOffset); //NOI18N
56.203 - firePropertyChange("length", oldLength, mLength); //NOI18N
56.204 - firePropertyChange("bytes", old, mBytes); //NOI18N
56.205 - }
56.206 -
56.207 - public String getBeginBytes() {
56.208 - return mBeginBytes;
56.209 - }
56.210 -
56.211 - public void setBeginBytes(String beginBytes) {
56.212 - String oldBeginBytes = mBeginBytes;
56.213 - mBeginBytes = beginBytes;
56.214 - if (mDelimiter.getBeginBytes() == null) {
56.215 - // no "beginBytes" element in XSD, so
56.216 - // we append a new empty "beginBytes" element
56.217 - mDelimiter.addNewBeginBytes();
56.218 - }
56.219 - if (mDelimiter.getBeginBytes().isSetEmbedded()) {
56.220 - // if "beginBytes" contains "embedded" choice element,
56.221 - // then unset it.
56.222 - mDelimiter.getBeginBytes().unsetEmbedded();
56.223 - }
56.224 - // set the "constant" choice element under "beginBytes"
56.225 - mDelimiter.getBeginBytes().setConstant(mBeginBytes);
56.226 - // reset both "offset" and "length" to 0
56.227 - int oldBeginOffset = mBeginOffset;
56.228 - mBeginOffset = 0;
56.229 - short oldBeginLength = mBeginLength;
56.230 - mBeginLength = 0;
56.231 - firePropertyChange("beginOffset", oldBeginOffset, mBeginOffset); //NOI18N
56.232 - firePropertyChange("beginLength", oldBeginLength, mBeginLength); //NOI18N
56.233 - firePropertyChange("beginBytes", oldBeginBytes, mBeginBytes); //NOI18N
56.234 - }
56.235 -
56.236 - public short getPrecedence() {
56.237 - return mPrecedence;
56.238 - }
56.239 -
56.240 - public void setPrecedence(short precedence) {
56.241 - int old = mPrecedence;
56.242 - mPrecedence = precedence;
56.243 - mDelimiter.setPrecedence(mPrecedence);
56.244 - firePropertyChange("precedence", old, mPrecedence); //NOI18N
56.245 - }
56.246 -
56.247 - public boolean getSkipLeading() {
56.248 - return mSkipLeading;
56.249 - }
56.250 -
56.251 - public void setSkipLeading(boolean skipLeading) {
56.252 - boolean old = mSkipLeading;
56.253 - mSkipLeading = skipLeading;
56.254 - mDelimiter.setSkipLeading(mSkipLeading);
56.255 - firePropertyChange("skipLeading", old, mSkipLeading); //NOI18N
56.256 - }
56.257 -
56.258 - public boolean getCollapse() {
56.259 - return mCollapse;
56.260 - }
56.261 -
56.262 - public void setCollapse(boolean collpase) {
56.263 - boolean old = mCollapse;
56.264 - mCollapse = collpase;
56.265 - mDelimiter.setCollapse(mCollapse);
56.266 - firePropertyChange("collapse", old, mCollapse); //NOI18N
56.267 - }
56.268 -
56.269 - public boolean getDetached() {
56.270 - return mDetached;
56.271 - }
56.272 -
56.273 - public void setDetached(boolean detached) {
56.274 - boolean old = mDetached;
56.275 - mDetached = detached;
56.276 - if (mDetached) {
56.277 - mDelimiter.setEndAnch(false);
56.278 - } else {
56.279 - mDelimiter.unsetEndAnch();
56.280 - }
56.281 - firePropertyChange("detached", old, mDetached); //NOI18N
56.282 - }
56.283 -
56.284 - public String getOptionMode() {
56.285 - return mOptionMode;
56.286 - }
56.287 -
56.288 - public void setOptionMode(String optionMode) {
56.289 - String old = mOptionMode;
56.290 - mOptionMode = optionMode;
56.291 - mDelimiter.setOptionalMode(
56.292 - Delimiter.OptionalMode.Enum.forString(
56.293 - mReverseTextMap.get(OPTION_MODE_PREFIX + "_" + optionMode))); //NOI18N
56.294 - firePropertyChange("optionMode", old, mOptionMode); //NOI18N
56.295 - }
56.296 -
56.297 - public String getTermMode() {
56.298 - return mTermMode;
56.299 - }
56.300 -
56.301 - public void setTermMode(String termMode) {
56.302 - String old = mTermMode;
56.303 - mTermMode = termMode;
56.304 - mDelimiter.setTerminatorMode(
56.305 - Delimiter.TerminatorMode.Enum.forString(
56.306 - mReverseTextMap.get(TERM_MODE_PREFIX + "_" + termMode))); //NOI18N
56.307 - firePropertyChange("termMode", old, mTermMode); //NOI18N
56.308 - }
56.309 -
56.310 - public int getOffset() {
56.311 - return mOffset;
56.312 - }
56.313 -
56.314 - public void setOffset(int offset) {
56.315 - int old = mOffset;
56.316 - mOffset = offset;
56.317 - if (mDelimiter.getBytes() == null) {
56.318 - mDelimiter.addNewBytes();
56.319 - }
56.320 - if (mDelimiter.getBytes().isSetConstant()) {
56.321 - mDelimiter.getBytes().unsetConstant();
56.322 - }
56.323 - if (!mDelimiter.getBytes().isSetEmbedded()) {
56.324 - mDelimiter.getBytes().addNewEmbedded();
56.325 - }
56.326 - mDelimiter.getBytes().getEmbedded().setOffset(mOffset);
56.327 - String oldBytes = mBytes;
56.328 - mBytes = ""; //NOI18N
56.329 - firePropertyChange("bytes", oldBytes, mBytes); //NOI18N
56.330 - firePropertyChange("offset", old, mOffset); //NOI18N
56.331 - }
56.332 -
56.333 - public short getLength() {
56.334 - return mLength;
56.335 - }
56.336 -
56.337 - public void setLength(short length) {
56.338 - int old = mLength;
56.339 - mLength = length;
56.340 - if (mDelimiter.getBytes() == null) {
56.341 - mDelimiter.addNewBytes();
56.342 - }
56.343 - if (mDelimiter.getBytes().isSetConstant()) {
56.344 - mDelimiter.getBytes().unsetConstant();
56.345 - }
56.346 - if (!mDelimiter.getBytes().isSetEmbedded()) {
56.347 - mDelimiter.getBytes().addNewEmbedded();
56.348 - }
56.349 - mDelimiter.getBytes().getEmbedded().setLength(length);
56.350 - String oldBytes = mBytes;
56.351 - mBytes = ""; //NOI18N
56.352 - firePropertyChange("bytes", oldBytes, mBytes); //NOI18N
56.353 - firePropertyChange("length", old, mLength); //NOI18N
56.354 - }
56.355 -
56.356 - public int getBeginOffset() {
56.357 - return mBeginOffset;
56.358 - }
56.359 -
56.360 - public void setBeginOffset(int beginOffset) {
56.361 - int oldBeginOffset = mBeginOffset;
56.362 - mBeginOffset = beginOffset;
56.363 - if (mDelimiter.getBeginBytes() == null) {
56.364 - mDelimiter.addNewBeginBytes();
56.365 - }
56.366 - if (mDelimiter.getBeginBytes().isSetConstant()) {
56.367 - mDelimiter.getBeginBytes().unsetConstant();
56.368 - }
56.369 - if (!mDelimiter.getBeginBytes().isSetEmbedded()) {
56.370 - mDelimiter.getBeginBytes().addNewEmbedded();
56.371 - }
56.372 - mDelimiter.getBeginBytes().getEmbedded().setOffset(mBeginOffset);
56.373 - String oldBeginBytes = mBeginBytes;
56.374 - mBeginBytes = ""; //NOI18N
56.375 - firePropertyChange("beginBytes", oldBeginBytes, mBeginBytes); //NOI18N
56.376 - firePropertyChange("beginOffset", oldBeginOffset, mBeginOffset); //NOI18N
56.377 - }
56.378 -
56.379 - public short getBeginLength() {
56.380 - return mBeginLength;
56.381 - }
56.382 -
56.383 - public void setBeginLength(short beginLength) {
56.384 - int oldBeginLength = mBeginLength;
56.385 - mBeginLength = beginLength;
56.386 - if (mDelimiter.getBeginBytes() == null) {
56.387 - mDelimiter.addNewBeginBytes();
56.388 - }
56.389 - if (mDelimiter.getBeginBytes().isSetConstant()) {
56.390 - mDelimiter.getBeginBytes().unsetConstant();
56.391 - }
56.392 - if (!mDelimiter.getBeginBytes().isSetEmbedded()) {
56.393 - mDelimiter.getBeginBytes().addNewEmbedded();
56.394 - }
56.395 - mDelimiter.getBeginBytes().getEmbedded().setLength(beginLength);
56.396 - String oldBeginBytes = mBeginBytes;
56.397 - mBeginBytes = ""; //NOI18N
56.398 - firePropertyChange("beginBytes", oldBeginBytes, mBeginBytes); //NOI18N
56.399 - firePropertyChange("beginLength", oldBeginLength, mBeginLength); //NOI18N
56.400 - }
56.401 -
56.402 - public boolean getBeginDetached() {
56.403 - return mBeginDetached;
56.404 - }
56.405 -
56.406 - public void setBeginDetached(boolean beginDetached) {
56.407 - boolean old = mBeginDetached;
56.408 - mBeginDetached = beginDetached;
56.409 - if (mBeginDetached) {
56.410 - mDelimiter.setBeginAnch(false);
56.411 - } else {
56.412 - mDelimiter.unsetBeginAnch();
56.413 - }
56.414 - firePropertyChange("beginDetached", old, mBeginDetached); //NOI18N
56.415 - }
56.416 -
56.417 - public void addPropertyChangeListener(PropertyChangeListener listener) {
56.418 - propChangeListeners.add(listener);
56.419 - }
56.420 -
56.421 - public void removePropertyChangeListener(PropertyChangeListener listener) {
56.422 - propChangeListeners.remove(listener);
56.423 - }
56.424 -
56.425 - /** initalizes the options. */
56.426 - private void init() {
56.427 - if (mDelimiter.isSetKind()) {
56.428 - mKind = mTextMap.get(KIND_PREFIX + "_" //NOI18N
56.429 - + mDelimiter.getKind().toString());
56.430 - }
56.431 - if (mDelimiter.isSetPrecedence()) {
56.432 - mPrecedence = mDelimiter.getPrecedence();
56.433 - }
56.434 - if (mDelimiter.isSetOptionalMode()) {
56.435 - mOptionMode = mTextMap.get(OPTION_MODE_PREFIX + "_" //NOI18N
56.436 - + mDelimiter.getOptionalMode().toString());
56.437 - }
56.438 - if (mDelimiter.isSetTerminatorMode()) {
56.439 - mTermMode = mTextMap.get(TERM_MODE_PREFIX + "_" //NOI18N
56.440 - + mDelimiter.getTerminatorMode().toString());
56.441 - }
56.442 - if (mDelimiter.getBytes() != null) {
56.443 - if (mDelimiter.getBytes().isSetConstant()) {
56.444 - mBytes = mDelimiter.getBytes().getConstant();
56.445 - mOffset = 0;
56.446 - mLength = 0;
56.447 - } else if (mDelimiter.getBytes().isSetEmbedded()) {
56.448 - mOffset = mDelimiter.getBytes().getEmbedded().getOffset();
56.449 - mLength = mDelimiter.getBytes().getEmbedded().getLength();
56.450 - mBytes = ""; //NOI18N
56.451 - }
56.452 - }
56.453 - if (mDelimiter.isSetEndAnch() && !mDelimiter.getEndAnch()) {
56.454 - mDetached = true;
56.455 - }
56.456 - if (mDelimiter.isSetSkipLeading() && mDelimiter.getSkipLeading()) {
56.457 - mSkipLeading = true;
56.458 - }
56.459 - if (mDelimiter.getBeginBytes() != null) {
56.460 - if (mDelimiter.getBeginBytes().isSetConstant()) {
56.461 - mBeginBytes = mDelimiter.getBeginBytes().getConstant();
56.462 - mBeginOffset = 0;
56.463 - mBeginLength = 0;
56.464 - } else if (mDelimiter.getBeginBytes().isSetEmbedded()) {
56.465 - mBeginOffset = mDelimiter.getBeginBytes().getEmbedded().getOffset();
56.466 - mBeginLength = mDelimiter.getBeginBytes().getEmbedded().getLength();
56.467 - mBeginBytes = ""; //NOI18N
56.468 - }
56.469 - }
56.470 - if (mDelimiter.isSetBeginAnch() && !mDelimiter.getBeginAnch()) {
56.471 - mBeginDetached = true;
56.472 - }
56.473 - if (mDelimiter.isSetCollapse() && mDelimiter.getCollapse()) {
56.474 - mCollapse = true;
56.475 - }
56.476 - }
56.477 -
56.478 - private void firePropertyChange(String name, Object oldObj, Object newObj) {
56.479 - PropertyChangeListener[] pcls = (PropertyChangeListener[])
56.480 - propChangeListeners.toArray(new PropertyChangeListener[0]);
56.481 - for (int i = 0; i < pcls.length; i++) {
56.482 - pcls[i].propertyChange(
56.483 - new PropertyChangeEvent(this, name, oldObj, newObj));
56.484 - }
56.485 - }
56.486 -
56.487 -}
57.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
57.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
57.3 @@ -1,41 +0,0 @@
57.4 -/*
57.5 - * The contents of this file are subject to the terms of the Common Development
57.6 - * and Distribution License (the License). You may not use this file except in
57.7 - * compliance with the License.
57.8 - *
57.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
57.10 - * or http://www.netbeans.org/cddl.txt.
57.11 -
57.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
57.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
57.14 - * If applicable, add the following below the CDDL Header, with the fields
57.15 - * enclosed by brackets [] replaced by your own identifying information:
57.16 - * "Portions Copyrighted [year] [name of copyright owner]"
57.17 - *
57.18 - * The Original Software is NetBeans. The Initial Developer of the Original
57.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
57.20 - * Microsystems, Inc. All Rights Reserved.
57.21 - */
57.22 -
57.23 -package org.netbeans.modules.encoder.custom.aip;
57.24 -
57.25 -import java.beans.FeatureDescriptor;
57.26 -import java.beans.PropertyEditorSupport;
57.27 -import org.openide.explorer.propertysheet.ExPropertyEditor;
57.28 -import org.openide.explorer.propertysheet.PropertyEnv;
57.29 -
57.30 -/**
57.31 - *
57.32 - * @author jxu
57.33 - */
57.34 -public class DelimiterPropertyEditor extends PropertyEditorSupport
57.35 - implements ExPropertyEditor {
57.36 -
57.37 - private static final StringInplaceEditor mStringInplaceEditor = new StringInplaceEditor();
57.38 -
57.39 - public void attachEnv(PropertyEnv propertyEnv) {
57.40 - FeatureDescriptor desc = propertyEnv.getFeatureDescriptor();
57.41 - // Provide own InplaceEditor for editing the string value
57.42 - desc.setValue("inplaceEditor", mStringInplaceEditor); // NOI18N
57.43 - }
57.44 -}
58.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetChangeListener.java Sat Sep 27 15:34:52 2008 -0700
58.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
58.3 @@ -1,33 +0,0 @@
58.4 -/*
58.5 - * The contents of this file are subject to the terms of the Common Development
58.6 - * and Distribution License (the License). You may not use this file except in
58.7 - * compliance with the License.
58.8 - *
58.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
58.10 - * or http://www.netbeans.org/cddl.txt.
58.11 -
58.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
58.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
58.14 - * If applicable, add the following below the CDDL Header, with the fields
58.15 - * enclosed by brackets [] replaced by your own identifying information:
58.16 - * "Portions Copyrighted [year] [name of copyright owner]"
58.17 - *
58.18 - * The Original Software is NetBeans. The Initial Developer of the Original
58.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
58.20 - * Microsystems, Inc. All Rights Reserved.
58.21 - */
58.22 -
58.23 -package org.netbeans.modules.encoder.custom.aip;
58.24 -
58.25 -import java.beans.PropertyChangeListener;
58.26 -
58.27 -/**
58.28 - * The listener that listens all changes within a delimiter set. This is
58.29 - * useful when validation of the delimiter set is needed when any changes
58.30 - * occur.
58.31 - *
58.32 - * @author Jun Xu
58.33 - */
58.34 -public abstract class DelimiterSetChangeListener implements PropertyChangeListener {
58.35 -
58.36 -}
59.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetChangeNotificationSupport.java Sat Sep 27 15:34:52 2008 -0700
59.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
59.3 @@ -1,57 +0,0 @@
59.4 -/*
59.5 - * The contents of this file are subject to the terms of the Common Development
59.6 - * and Distribution License (the License). You may not use this file except in
59.7 - * compliance with the License.
59.8 - *
59.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
59.10 - * or http://www.netbeans.org/cddl.txt.
59.11 -
59.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
59.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
59.14 - * If applicable, add the following below the CDDL Header, with the fields
59.15 - * enclosed by brackets [] replaced by your own identifying information:
59.16 - * "Portions Copyrighted [year] [name of copyright owner]"
59.17 - *
59.18 - * The Original Software is NetBeans. The Initial Developer of the Original
59.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
59.20 - * Microsystems, Inc. All Rights Reserved.
59.21 - */
59.22 -package org.netbeans.modules.encoder.custom.aip;
59.23 -
59.24 -/**
59.25 - * A interface to enable an instance to provide delimiter set change notifications.
59.26 - *
59.27 - * @author Jun Xu
59.28 - */
59.29 -public interface DelimiterSetChangeNotificationSupport {
59.30 -
59.31 - /**
59.32 - * Adds a delimiter set change listener array.
59.33 - * @param listeners a delimiter set change listener array.
59.34 - */
59.35 - void addDelimiterSetChangeListener(DelimiterSetChangeListener listeners[]);
59.36 -
59.37 - /**
59.38 - * Adds a delimiter set change listener.
59.39 - * @param listener a delimiter set change listener.
59.40 - */
59.41 - void addDelimiterSetChangeListener(DelimiterSetChangeListener listener);
59.42 -
59.43 - /**
59.44 - * Returns all delimiter set listeners in this notifier.
59.45 - * @return a delimiter set change listener array.
59.46 - */
59.47 - DelimiterSetChangeListener[] getDelimiterSetChangeListeners();
59.48 -
59.49 - /**
59.50 - * Removes a delimiter set change listener.
59.51 - * @param listener a delimiter set change listener.
59.52 - */
59.53 - void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener);
59.54 -
59.55 - /**
59.56 - * Removes a delimiter set change listener array.
59.57 - * @param listeners a delimiter set change listener array.
59.58 - */
59.59 - void removeDelimiterSetChangeListener(DelimiterSetChangeListener listeners[]);
59.60 -}
60.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetChangeNotifier.java Sat Sep 27 15:34:52 2008 -0700
60.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
60.3 @@ -1,70 +0,0 @@
60.4 -/*
60.5 - * The contents of this file are subject to the terms of the Common Development
60.6 - * and Distribution License (the License). You may not use this file except in
60.7 - * compliance with the License.
60.8 - *
60.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
60.10 - * or http://www.netbeans.org/cddl.txt.
60.11 -
60.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
60.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
60.14 - * If applicable, add the following below the CDDL Header, with the fields
60.15 - * enclosed by brackets [] replaced by your own identifying information:
60.16 - * "Portions Copyrighted [year] [name of copyright owner]"
60.17 - *
60.18 - * The Original Software is NetBeans. The Initial Developer of the Original
60.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
60.20 - * Microsystems, Inc. All Rights Reserved.
60.21 - */
60.22 -
60.23 -package org.netbeans.modules.encoder.custom.aip;
60.24 -
60.25 -import java.beans.PropertyChangeEvent;
60.26 -import java.util.Collections;
60.27 -import java.util.LinkedList;
60.28 -import java.util.List;
60.29 -
60.30 -/**
60.31 - * A helper class to facilitate supporting delimiter set change notification.
60.32 - *
60.33 - * @author Jun Xu
60.34 - */
60.35 -public class DelimiterSetChangeNotifier
60.36 - implements DelimiterSetChangeNotificationSupport {
60.37 -
60.38 - private final List<DelimiterSetChangeListener> delimSetChangeListeners =
60.39 - Collections.synchronizedList(new LinkedList<DelimiterSetChangeListener>());
60.40 -
60.41 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listeners[]) {
60.42 - for (int i = 0; listeners != null && i < listeners.length; i++) {
60.43 - delimSetChangeListeners.add(listeners[i]);
60.44 - }
60.45 - }
60.46 -
60.47 - public void addDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
60.48 - delimSetChangeListeners.add(listener);
60.49 - }
60.50 -
60.51 - public DelimiterSetChangeListener[] getDelimiterSetChangeListeners() {
60.52 - return delimSetChangeListeners.toArray(new DelimiterSetChangeListener[0]);
60.53 - }
60.54 -
60.55 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listener) {
60.56 - delimSetChangeListeners.remove(listener);
60.57 - }
60.58 -
60.59 - public void removeDelimiterSetChangeListener(DelimiterSetChangeListener listeners[]) {
60.60 - for (int i = 0; listeners != null && i < listeners.length; i++) {
60.61 - delimSetChangeListeners.remove(listeners[i]);
60.62 - }
60.63 - }
60.64 -
60.65 - public void fireDelimiterSetChangeEvent(Object source, String propName,
60.66 - Object oldValue, Object newValue) {
60.67 - PropertyChangeEvent evt = new PropertyChangeEvent(source, propName, oldValue, newValue);
60.68 - DelimiterSetChangeListener[] listeners = getDelimiterSetChangeListeners();
60.69 - for (int i = 0; listeners != null && i < listeners.length; i++) {
60.70 - listeners[i].propertyChange(evt);
60.71 - }
60.72 - }
60.73 -}
61.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetForm.form Sat Sep 27 15:34:52 2008 -0700
61.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
61.3 @@ -1,116 +0,0 @@
61.4 -<?xml version="1.0" encoding="UTF-8" ?>
61.5 -
61.6 -<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
61.7 - <Properties>
61.8 - <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
61.9 - <Dimension value="[838, 322]"/>
61.10 - </Property>
61.11 - </Properties>
61.12 - <AuxValues>
61.13 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
61.14 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
61.15 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
61.16 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
61.17 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
61.18 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
61.19 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
61.20 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
61.21 - </AuxValues>
61.22 -
61.23 - <Layout>
61.24 - <DimensionLayout dim="0">
61.25 - <Group type="103" groupAlignment="0" attributes="0">
61.26 - <Group type="102" alignment="1" attributes="0">
61.27 - <EmptySpace max="-2" attributes="0"/>
61.28 - <Component id="delimiterTreeTableView" pref="717" max="32767" attributes="0"/>
61.29 - <EmptySpace max="-2" attributes="0"/>
61.30 - <Group type="103" groupAlignment="1" max="-2" attributes="0">
61.31 - <Component id="removeAllButton" max="32767" attributes="1"/>
61.32 - <Component id="removeButton" alignment="1" max="32767" attributes="1"/>
61.33 - <Component id="addLevelButton" alignment="1" pref="87" max="32767" attributes="1"/>
61.34 - <Component id="addDelimiterButton" alignment="1" min="-2" max="-2" attributes="1"/>
61.35 - </Group>
61.36 - <EmptySpace min="-2" max="-2" attributes="0"/>
61.37 - </Group>
61.38 - </Group>
61.39 - </DimensionLayout>
61.40 - <DimensionLayout dim="1">
61.41 - <Group type="103" groupAlignment="0" attributes="0">
61.42 - <Group type="102" alignment="0" attributes="0">
61.43 - <EmptySpace min="-2" max="-2" attributes="0"/>
61.44 - <Group type="103" groupAlignment="0" attributes="0">
61.45 - <Component id="delimiterTreeTableView" alignment="0" min="-2" pref="300" max="-2" attributes="0"/>
61.46 - <Group type="102" alignment="0" attributes="0">
61.47 - <Component id="addLevelButton" min="-2" max="-2" attributes="0"/>
61.48 - <EmptySpace max="-2" attributes="0"/>
61.49 - <Component id="addDelimiterButton" min="-2" max="-2" attributes="0"/>
61.50 - <EmptySpace max="-2" attributes="0"/>
61.51 - <Component id="removeButton" min="-2" max="-2" attributes="0"/>
61.52 - <EmptySpace max="-2" attributes="0"/>
61.53 - <Component id="removeAllButton" min="-2" max="-2" attributes="0"/>
61.54 - </Group>
61.55 - </Group>
61.56 - <EmptySpace max="32767" attributes="0"/>
61.57 - </Group>
61.58 - </Group>
61.59 - </DimensionLayout>
61.60 - </Layout>
61.61 - <SubComponents>
61.62 - <Component class="javax.swing.JButton" name="addLevelButton">
61.63 - <Properties>
61.64 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
61.65 - <ResourceString bundle="org/netbeans/modules/encoder/custom/aip/Bundle.properties" key="delim_set_form.lbl.add_level" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
61.66 - </Property>
61.67 - </Properties>
61.68 - <Events>
61.69 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addLevelButtonActionPerformed"/>
61.70 - </Events>
61.71 - </Component>
61.72 - <Component class="javax.swing.JButton" name="addDelimiterButton">
61.73 - <Properties>
61.74 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
61.75 - <ResourceString bundle="org/netbeans/modules/encoder/custom/aip/Bundle.properties" key="delim_set_form.lbl.add_delim" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
61.76 - </Property>
61.77 - </Properties>
61.78 - <Events>
61.79 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addDelimiterButtonActionPerformed"/>
61.80 - </Events>
61.81 - </Component>
61.82 - <Component class="javax.swing.JButton" name="removeButton">
61.83 - <Properties>
61.84 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
61.85 - <ResourceString bundle="org/netbeans/modules/encoder/custom/aip/Bundle.properties" key="delim_set_form.lbl.remove" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
61.86 - </Property>
61.87 - </Properties>
61.88 - <Events>
61.89 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/>
61.90 - </Events>
61.91 - </Component>
61.92 - <Component class="org.netbeans.modules.encoder.custom.aip.DelimiterTreeTableView" name="delimiterTreeTableView">
61.93 - <Properties>
61.94 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
61.95 - <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
61.96 - <EtchetBorder/>
61.97 - </Border>
61.98 - </Property>
61.99 - <Property name="horizontalScrollBarPolicy" type="int" value="30"/>
61.100 - <Property name="verticalScrollBarPolicy" type="int" value="20"/>
61.101 - <Property name="defaultActionAllowed" type="boolean" value="false"/>
61.102 - <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
61.103 - <Dimension value="[700, 300]"/>
61.104 - </Property>
61.105 - <Property name="treePreferredWidth" type="int" value="100"/>
61.106 - </Properties>
61.107 - </Component>
61.108 - <Component class="javax.swing.JButton" name="removeAllButton">
61.109 - <Properties>
61.110 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
61.111 - <ResourceString bundle="org/netbeans/modules/encoder/custom/aip/Bundle.properties" key="delim_set_form.lbl.remove_all" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
61.112 - </Property>
61.113 - </Properties>
61.114 - <Events>
61.115 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeAllButtonActionPerformed"/>
61.116 - </Events>
61.117 - </Component>
61.118 - </SubComponents>
61.119 -</Form>
62.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetForm.java Sat Sep 27 15:34:52 2008 -0700
62.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
62.3 @@ -1,366 +0,0 @@
62.4 -/*
62.5 - * The contents of this file are subject to the terms of the Common Development
62.6 - * and Distribution License (the License). You may not use this file except in
62.7 - * compliance with the License.
62.8 - *
62.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
62.10 - * or http://www.netbeans.org/cddl.txt.
62.11 -
62.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
62.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
62.14 - * If applicable, add the following below the CDDL Header, with the fields
62.15 - * enclosed by brackets [] replaced by your own identifying information:
62.16 - * "Portions Copyrighted [year] [name of copyright owner]"
62.17 - *
62.18 - * The Original Software is NetBeans. The Initial Developer of the Original
62.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
62.20 - * Microsystems, Inc. All Rights Reserved.
62.21 - */
62.22 -
62.23 -package org.netbeans.modules.encoder.custom.aip;
62.24 -
62.25 -import com.sun.encoder.custom.appinfo.Delimiter;
62.26 -import com.sun.encoder.custom.appinfo.DelimiterBytes;
62.27 -import com.sun.encoder.custom.appinfo.DelimiterLevel;
62.28 -import com.sun.encoder.custom.appinfo.DelimiterSet;
62.29 -import java.awt.event.ActionEvent;
62.30 -import java.awt.event.ActionListener;
62.31 -import java.beans.PropertyChangeEvent;
62.32 -import java.beans.PropertyVetoException;
62.33 -import javax.swing.ActionMap;
62.34 -import javax.swing.JTable;
62.35 -import javax.swing.SwingUtilities;
62.36 -import javax.swing.tree.TreeSelectionModel;
62.37 -import org.openide.explorer.ExplorerManager;
62.38 -import org.openide.explorer.ExplorerUtils;
62.39 -import org.openide.nodes.Node;
62.40 -import org.openide.util.Lookup;
62.41 -import org.openide.util.lookup.Lookups;
62.42 -
62.43 -/**
62.44 - * The view of the delimiter set property editor
62.45 - *
62.46 - * @author Jun Xu
62.47 - */
62.48 -public class DelimiterSetForm extends javax.swing.JPanel
62.49 - implements ExplorerManager.Provider, Lookup.Provider, ActionListener {
62.50 -
62.51 - private final DelimiterSet mDelimiterSet ;
62.52 - private final DelimiterSetChangeListener mDelimiterSetChangeListener =
62.53 - new DelimiterSetChangeListener() {
62.54 - public void propertyChange(PropertyChangeEvent evt) {
62.55 - if (validate(mDelimiterSet)) {
62.56 - firePropertyChange("valid", null, Boolean.TRUE); //NOI18N
62.57 - } else {
62.58 - firePropertyChange("valid", null, Boolean.FALSE); //NOI18N
62.59 - }
62.60 - }
62.61 - };
62.62 -
62.63 - private ExplorerManager mManager;
62.64 - private Lookup mLookup;
62.65 -
62.66 - /**
62.67 - * Creates new form DelimiterSetForm
62.68 - */
62.69 - public DelimiterSetForm(DelimiterSet delimSet) {
62.70 - initComponents();
62.71 - initialize(delimSet);
62.72 - mDelimiterSet = delimSet;
62.73 - }
62.74 -
62.75 - /** This method is called from within the constructor to
62.76 - * initialize the form.
62.77 - * WARNING: Do NOT modify this code. The content of this method is
62.78 - * always regenerated by the Form Editor.
62.79 - */
62.80 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
62.81 - private void initComponents() {
62.82 -
62.83 - addLevelButton = new javax.swing.JButton();
62.84 - addDelimiterButton = new javax.swing.JButton();
62.85 - removeButton = new javax.swing.JButton();
62.86 - delimiterTreeTableView = new org.netbeans.modules.encoder.custom.aip.DelimiterTreeTableView();
62.87 - removeAllButton = new javax.swing.JButton();
62.88 -
62.89 - setPreferredSize(new java.awt.Dimension(838, 322));
62.90 -
62.91 - java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle"); // NOI18N
62.92 - addLevelButton.setText(bundle.getString("delim_set_form.lbl.add_level")); // NOI18N
62.93 - addLevelButton.addActionListener(new java.awt.event.ActionListener() {
62.94 - public void actionPerformed(java.awt.event.ActionEvent evt) {
62.95 - addLevelButtonActionPerformed(evt);
62.96 - }
62.97 - });
62.98 -
62.99 - addDelimiterButton.setText(bundle.getString("delim_set_form.lbl.add_delim")); // NOI18N
62.100 - addDelimiterButton.addActionListener(new java.awt.event.ActionListener() {
62.101 - public void actionPerformed(java.awt.event.ActionEvent evt) {
62.102 - addDelimiterButtonActionPerformed(evt);
62.103 - }
62.104 - });
62.105 -
62.106 - removeButton.setText(bundle.getString("delim_set_form.lbl.remove")); // NOI18N
62.107 - removeButton.addActionListener(new java.awt.event.ActionListener() {
62.108 - public void actionPerformed(java.awt.event.ActionEvent evt) {
62.109 - removeButtonActionPerformed(evt);
62.110 - }
62.111 - });
62.112 -
62.113 - delimiterTreeTableView.setBorder(javax.swing.BorderFactory.createEtchedBorder());
62.114 - delimiterTreeTableView.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
62.115 - delimiterTreeTableView.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
62.116 - delimiterTreeTableView.setDefaultActionAllowed(false);
62.117 - delimiterTreeTableView.setPreferredSize(new java.awt.Dimension(700, 300));
62.118 - delimiterTreeTableView.setTreePreferredWidth(100);
62.119 -
62.120 - removeAllButton.setText(bundle.getString("delim_set_form.lbl.remove_all")); // NOI18N
62.121 - removeAllButton.addActionListener(new java.awt.event.ActionListener() {
62.122 - public void actionPerformed(java.awt.event.ActionEvent evt) {
62.123 - removeAllButtonActionPerformed(evt);
62.124 - }
62.125 - });
62.126 -
62.127 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
62.128 - this.setLayout(layout);
62.129 - layout.setHorizontalGroup(
62.130 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
62.131 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
62.132 - .addContainerGap()
62.133 - .add(delimiterTreeTableView, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
62.134 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
62.135 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
62.136 - .add(removeAllButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
62.137 - .add(removeButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
62.138 - .add(addLevelButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
62.139 - .add(addDelimiterButton))
62.140 - .addContainerGap())
62.141 - );
62.142 - layout.setVerticalGroup(
62.143 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
62.144 - .add(layout.createSequentialGroup()
62.145 - .addContainerGap()
62.146 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
62.147 - .add(delimiterTreeTableView, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 300, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
62.148 - .add(layout.createSequentialGroup()
62.149 - .add(addLevelButton)
62.150 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
62.151 - .add(addDelimiterButton)
62.152 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
62.153 - .add(removeButton)
62.154 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
62.155 - .add(removeAllButton)))
62.156 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
62.157 - );
62.158 - }// </editor-fold>//GEN-END:initComponents
62.159 -
62.160 - private void removeAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeAllButtonActionPerformed
62.161 - Node root = mManager.getRootContext();
62.162 - Node[] childNodes = root.getChildren().getNodes();
62.163 - DelimiterSet delimSet = (DelimiterSet) root.getLookup().lookup(DelimiterSet.class);
62.164 - delimSet.setLevelArray(new DelimiterLevel[0]);
62.165 - root.getChildren().remove(childNodes);
62.166 - try {
62.167 - mManager.setSelectedNodes(new Node[0]);
62.168 - } catch (PropertyVetoException ex) {
62.169 - }
62.170 - }//GEN-LAST:event_removeAllButtonActionPerformed
62.171 -
62.172 - private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
62.173 - Node[] selectedNodes = mManager.getSelectedNodes();
62.174 - if (selectedNodes == null || selectedNodes.length == 0) {
62.175 - return;
62.176 - }
62.177 - //Check it is delimiter level or delimiter
62.178 - DelimiterLevel level;
62.179 - level = (DelimiterLevel) selectedNodes[0].getLookup().lookup(DelimiterLevel.class);
62.180 - if (level == null) {
62.181 - //Must be a delimiter node
62.182 - Node levelNode = selectedNodes[0].getParentNode();
62.183 - level = (DelimiterLevel) levelNode.getLookup().lookup(DelimiterLevel.class);
62.184 - Node[] childNodes = levelNode.getChildren().getNodes();
62.185 - int index = -1;
62.186 - for (int i = 0; i < childNodes.length; i++) {
62.187 - if (childNodes[i] == selectedNodes[0]) {
62.188 - index = i;
62.189 - break;
62.190 - }
62.191 - }
62.192 - if (index != -1) {
62.193 - level.removeDelimiter(index);
62.194 - levelNode.getChildren().remove(new Node[]{selectedNodes[0]});
62.195 - }
62.196 - } else {
62.197 - //Must be a delimiter level node
62.198 - Node root = mManager.getRootContext();
62.199 - DelimiterSet delimSet = (DelimiterSet) root.getLookup().lookup(DelimiterSet.class);
62.200 - Node[] childNodes = root.getChildren().getNodes();
62.201 - int index = -1;
62.202 - for (int i = 0; i < childNodes.length; i++) {
62.203 - if (childNodes[i] == selectedNodes[0]) {
62.204 - index = i;
62.205 - break;
62.206 - }
62.207 - }
62.208 - if (index != -1) {
62.209 - delimSet.removeLevel(index);
62.210 - root.getChildren().remove(new Node[]{selectedNodes[0]});
62.211 - }
62.212 - }
62.213 - }//GEN-LAST:event_removeButtonActionPerformed
62.214 -
62.215 - private void addDelimiterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addDelimiterButtonActionPerformed
62.216 - Node root = mManager.getRootContext();
62.217 - DelimiterSet delimSet = (DelimiterSet) root.getLookup().lookup(DelimiterSet.class);
62.218 - Node[] selectedNodes = mManager.getSelectedNodes();
62.219 - DelimiterLevel level;
62.220 - Node levelNode;
62.221 - if (selectedNodes == null || selectedNodes.length == 0) {
62.222 - if (delimSet.sizeOfLevelArray() == 0) {
62.223 - level = delimSet.addNewLevel();
62.224 - final Node newLevelNode =
62.225 - new DelimTreeLevelNode(
62.226 - level,
62.227 - new DelimTreeLevelNodeChildren(level),
62.228 - Lookups.singleton(level));
62.229 - root.getChildren().add(new Node[]{newLevelNode});
62.230 - levelNode = newLevelNode;
62.231 - } else {
62.232 - levelNode = root.getChildren().getNodes()[root.getChildren().getNodesCount() - 1];
62.233 - level = (DelimiterLevel) levelNode.getLookup().lookup(DelimiterLevel.class);
62.234 - }
62.235 - } else {
62.236 - //Since single selection mode is used, must only one node is returned
62.237 - //Check to see if it is a delimiter level node
62.238 - level = (DelimiterLevel) selectedNodes[0].getLookup().lookup(DelimiterLevel.class);
62.239 - if (level == null) {
62.240 - //It is not a delimiter level node, then must be a delimiter node
62.241 - levelNode = selectedNodes[0].getParentNode();
62.242 - level = (DelimiterLevel) levelNode.getLookup().lookup(DelimiterLevel.class);
62.243 - } else {
62.244 - levelNode = selectedNodes[0];
62.245 - }
62.246 - }
62.247 - Delimiter newDelim = level.addNewDelimiter();
62.248 - newDelim.setKind(Delimiter.Kind.NORMAL);
62.249 - newDelim.setPrecedence((short) 10);
62.250 - newDelim.setOptionalMode(Delimiter.OptionalMode.NEVER);
62.251 - newDelim.setTerminatorMode(Delimiter.TerminatorMode.NEVER);
62.252 - newDelim.addNewBytes();
62.253 - newDelim.getBytes().setConstant(""); //NOI18N
62.254 - final Node newDelimNode =
62.255 - new DelimTreeDelimiterNode(
62.256 - newDelim,
62.257 - Lookups.singleton(newDelim));
62.258 - levelNode.getChildren().add(new Node[]{newDelimNode});
62.259 - Runnable doExpandAll = new Runnable() {
62.260 - public void run() {
62.261 - delimiterTreeTableView.expandAll();
62.262 - }
62.263 - };
62.264 - SwingUtilities.invokeLater(doExpandAll);
62.265 - }//GEN-LAST:event_addDelimiterButtonActionPerformed
62.266 -
62.267 - private void addLevelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addLevelButtonActionPerformed
62.268 - Node root = mManager.getRootContext();
62.269 - DelimiterSet delimSet = (DelimiterSet) root.getLookup().lookup(DelimiterSet.class);
62.270 - DelimiterLevel level = delimSet.addNewLevel();
62.271 - final Node newLevelNode =
62.272 - new DelimTreeLevelNode(
62.273 - level,
62.274 - new DelimTreeLevelNodeChildren(level),
62.275 - Lookups.singleton(level));
62.276 - root.getChildren().add(new Node[]{newLevelNode});
62.277 - Runnable doExpandNode = new Runnable() {
62.278 - public void run() {
62.279 - delimiterTreeTableView.expandNode(newLevelNode);
62.280 - }
62.281 - };
62.282 - SwingUtilities.invokeLater(doExpandNode);
62.283 - }//GEN-LAST:event_addLevelButtonActionPerformed
62.284 -
62.285 - public ExplorerManager getExplorerManager() {
62.286 - return mManager;
62.287 - }
62.288 -
62.289 - public Lookup getLookup() {
62.290 - return mLookup;
62.291 - }
62.292 -
62.293 - public void addNotify() {
62.294 - super.addNotify();
62.295 - ExplorerUtils.activateActions(mManager, true);
62.296 - }
62.297 - public void removeNotify() {
62.298 - ExplorerUtils.activateActions(mManager, false);
62.299 - super.removeNotify();
62.300 - }
62.301 -
62.302 - public void actionPerformed(ActionEvent e) {
62.303 -
62.304 - }
62.305 -
62.306 - private void initialize(DelimiterSet delimSet) {
62.307 - mManager = new ExplorerManager();
62.308 - ActionMap map = getActionMap();
62.309 - mLookup = ExplorerUtils.createLookup (mManager, map);
62.310 - DelimTreeRootNodeChildren children = new DelimTreeRootNodeChildren(delimSet);
62.311 - children.addDelimiterSetChangeListener(mDelimiterSetChangeListener);
62.312 - DelimTreeRootNode root =
62.313 - new DelimTreeRootNode(delimSet, children, Lookups.singleton(delimSet));
62.314 - root.addDelimiterSetChangeListener(mDelimiterSetChangeListener);
62.315 - mManager.setRootContext(root);
62.316 - delimiterTreeTableView.setRootVisible(false);
62.317 - delimiterTreeTableView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
62.318 - float ratio = delimiterTreeTableView.getFont().getSize2D() / 12;
62.319 - delimiterTreeTableView.setTreePreferredWidth((int) (ratio * 120));
62.320 - delimiterTreeTableView.setTableAutoResizeMode(JTable.AUTO_RESIZE_OFF);
62.321 - Runnable doExpandAll = new Runnable() {
62.322 - public void run() {
62.323 - delimiterTreeTableView.expandAll();
62.324 - }
62.325 - };
62.326 - SwingUtilities.invokeLater(doExpandAll);
62.327 - }
62.328 -
62.329 - private boolean validate(DelimiterSet delimSet) {
62.330 - if (delimSet == null || delimSet.sizeOfLevelArray() == 0) {
62.331 - return true;
62.332 - }
62.333 - if (!delimSet.validate()) {
62.334 - return false;
62.335 - }
62.336 - DelimiterLevel levels[] = delimSet.getLevelArray();
62.337 - Delimiter[] delims;
62.338 - DelimiterBytes delimBytes;
62.339 - for (int i = 0; i < levels.length; i++) {
62.340 - delims = levels[i].getDelimiterArray();
62.341 - for (int j = 0; j < delims.length; j++) {
62.342 - delimBytes = delims[j].getBytes();
62.343 - if (delimBytes == null) {
62.344 - return false;
62.345 - }
62.346 - if (delimBytes.isSetConstant()) {
62.347 - if (delimBytes.getConstant() == null
62.348 - || delimBytes.getConstant().length() == 0) {
62.349 - return false;
62.350 - }
62.351 - } else if (delimBytes.isSetEmbedded()) {
62.352 - if (delimBytes.getEmbedded() == null
62.353 - || delimBytes.getEmbedded().getLength() == 0) {
62.354 - return false;
62.355 - }
62.356 - }
62.357 - }
62.358 - }
62.359 - return true;
62.360 - }
62.361 -
62.362 - // Variables declaration - do not modify//GEN-BEGIN:variables
62.363 - private javax.swing.JButton addDelimiterButton;
62.364 - private javax.swing.JButton addLevelButton;
62.365 - private org.netbeans.modules.encoder.custom.aip.DelimiterTreeTableView delimiterTreeTableView;
62.366 - private javax.swing.JButton removeAllButton;
62.367 - private javax.swing.JButton removeButton;
62.368 - // End of variables declaration//GEN-END:variables
62.369 -}
63.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetProperty.java Sat Sep 27 15:34:52 2008 -0700
63.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
63.3 @@ -1,59 +0,0 @@
63.4 -/*
63.5 - * The contents of this file are subject to the terms of the Common Development
63.6 - * and Distribution License (the License). You may not use this file except in
63.7 - * compliance with the License.
63.8 - *
63.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
63.10 - * or http://www.netbeans.org/cddl.txt.
63.11 -
63.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
63.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
63.14 - * If applicable, add the following below the CDDL Header, with the fields
63.15 - * enclosed by brackets [] replaced by your own identifying information:
63.16 - * "Portions Copyrighted [year] [name of copyright owner]"
63.17 - *
63.18 - * The Original Software is NetBeans. The Initial Developer of the Original
63.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
63.20 - * Microsystems, Inc. All Rights Reserved.
63.21 - */
63.22 -
63.23 -package org.netbeans.modules.encoder.custom.aip;
63.24 -
63.25 -import java.beans.PropertyEditor;
63.26 -import java.lang.reflect.InvocationTargetException;
63.27 -import org.openide.nodes.PropertySupport;
63.28 -
63.29 -/**
63.30 - * The delimiter set property
63.31 - *
63.32 - * @author Jun Xu
63.33 - */
63.34 -public class DelimiterSetProperty extends PropertySupport.Reflection {
63.35 -
63.36 - /** Creates a new instance of DelimiterSetProperty */
63.37 - public DelimiterSetProperty(EncodingOption encodingOption, Class clazz,
63.38 - String name) throws NoSuchMethodException {
63.39 - super(encodingOption, clazz, name);
63.40 - }
63.41 -
63.42 - @Override
63.43 - public PropertyEditor getPropertyEditor() {
63.44 - return new DelimiterSetPropertyEditor((EncodingOption) instance);
63.45 - }
63.46 -
63.47 - @Override
63.48 - public boolean isDefaultValue () {
63.49 - try {
63.50 - return getValue()==null;
63.51 - } catch (IllegalArgumentException ex) {
63.52 - } catch (InvocationTargetException ex) {
63.53 - } catch (IllegalAccessException ex) {
63.54 - }
63.55 - return false;
63.56 - }
63.57 -
63.58 - @Override
63.59 - public boolean supportsDefaultValue () {
63.60 - return true;
63.61 - }
63.62 -}
64.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterSetPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
64.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
64.3 @@ -1,138 +0,0 @@
64.4 -/*
64.5 - * The contents of this file are subject to the terms of the Common Development
64.6 - * and Distribution License (the License). You may not use this file except in
64.7 - * compliance with the License.
64.8 - *
64.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
64.10 - * or http://www.netbeans.org/cddl.txt.
64.11 -
64.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
64.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
64.14 - * If applicable, add the following below the CDDL Header, with the fields
64.15 - * enclosed by brackets [] replaced by your own identifying information:
64.16 - * "Portions Copyrighted [year] [name of copyright owner]"
64.17 - *
64.18 - * The Original Software is NetBeans. The Initial Developer of the Original
64.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
64.20 - * Microsystems, Inc. All Rights Reserved.
64.21 - */
64.22 -
64.23 -package org.netbeans.modules.encoder.custom.aip;
64.24 -
64.25 -import com.sun.encoder.custom.appinfo.DelimiterSet;
64.26 -import java.awt.Component;
64.27 -import java.awt.Dialog;
64.28 -import java.awt.event.ActionEvent;
64.29 -import java.awt.event.ActionListener;
64.30 -import java.beans.FeatureDescriptor;
64.31 -import java.beans.PropertyChangeEvent;
64.32 -import java.beans.PropertyChangeListener;
64.33 -import java.beans.PropertyEditorSupport;
64.34 -import java.util.ResourceBundle;
64.35 -import javax.swing.SwingUtilities;
64.36 -import org.openide.DialogDescriptor;
64.37 -import org.openide.DialogDisplayer;
64.38 -import org.openide.ErrorManager;
64.39 -import org.openide.explorer.propertysheet.ExPropertyEditor;
64.40 -import org.openide.explorer.propertysheet.PropertyEnv;
64.41 -import org.openide.nodes.Node;
64.42 -import org.openide.util.NbBundle;
64.43 -
64.44 -/**
64.45 - * Editor for the delimiter set property
64.46 - *
64.47 - * @author Jun Xu
64.48 - */
64.49 -public class DelimiterSetPropertyEditor extends PropertyEditorSupport
64.50 - implements ExPropertyEditor {
64.51 -
64.52 - private static final ResourceBundle _bundle =
64.53 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle");
64.54 - private final EncodingOption mEncodingOption;
64.55 -
64.56 - /**
64.57 - * Creates a new instance of DerivationTypeEditor
64.58 - */
64.59 - public DelimiterSetPropertyEditor(EncodingOption encodingOption) {
64.60 - mEncodingOption = encodingOption;
64.61 - initialize(encodingOption);
64.62 - }
64.63 -
64.64 - private void initialize(EncodingOption encodingOption) {
64.65 - }
64.66 -
64.67 - public String getAsText() {
64.68 - DelimiterSet delimSet = (DelimiterSet) getValue();
64.69 - if (delimSet == null || delimSet.sizeOfLevelArray() == 0){
64.70 - return _bundle.getString("delim_set_pe.lbl.not_specified");
64.71 - }
64.72 -
64.73 - return NbBundle.getMessage(DelimiterSetPropertyEditor.class, "delim_set_pe.lbl.levels", delimSet.sizeOfLevelArray()); //NOI18N
64.74 - }
64.75 -
64.76 - public Component getCustomEditor() {
64.77 - DelimiterSet dupDelimSet = mEncodingOption.getDelimiterSet();
64.78 - if (dupDelimSet == null) {
64.79 - dupDelimSet = DelimiterSet.Factory.newInstance();
64.80 - } else {
64.81 - dupDelimSet = (DelimiterSet) dupDelimSet.copy();
64.82 - }
64.83 - final DelimiterSetForm delimSetForm =
64.84 - new DelimiterSetForm(dupDelimSet);
64.85 - final DialogDescriptor descriptor =
64.86 - new DialogDescriptor(delimSetForm,
64.87 - NbBundle.getMessage(DelimiterSetPropertyEditor.class, "LBL_Delimiter_Set_Editor_Title"), //NOI18N
64.88 - true,
64.89 - new ActionListener() {
64.90 - public void actionPerformed(ActionEvent evt) {
64.91 - if (evt.getSource().equals(DialogDescriptor.OK_OPTION)) {
64.92 - try {
64.93 - Node root = delimSetForm.getExplorerManager().getRootContext();
64.94 - DelimiterSet delimSet = (DelimiterSet) root.getLookup().lookup(DelimiterSet.class);
64.95 - if (delimSet.sizeOfLevelArray() > 0) {
64.96 - setValue(delimSet);
64.97 - } else {
64.98 - setValue(null);
64.99 - }
64.100 - } catch (IllegalArgumentException iae) {
64.101 - ErrorManager.getDefault().annotate(iae, ErrorManager.USER,
64.102 - iae.getMessage(), iae.getLocalizedMessage(),
64.103 - null, new java.util.Date());
64.104 - throw iae;
64.105 - }
64.106 - }
64.107 - }
64.108 - }
64.109 - );
64.110 -
64.111 - // enable/disable the dlg ok button depending selection
64.112 - delimSetForm.addPropertyChangeListener( new PropertyChangeListener() {
64.113 - public void propertyChange(PropertyChangeEvent evt) {
64.114 - if (evt.getPropertyName().equals("valid")) { //NOI18N
64.115 - descriptor.setValid(((Boolean)evt.getNewValue()).booleanValue());
64.116 - }
64.117 - }
64.118 - });
64.119 - Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
64.120 - dlg.setPreferredSize(
64.121 - new java.awt.Dimension(740, 450));
64.122 - SwingUtilities.invokeLater( new Runnable() {
64.123 - public void run() {
64.124 - delimSetForm.setVisible( true );
64.125 - }
64.126 - } );
64.127 - delimSetForm.setVisible( false );
64.128 - return dlg;
64.129 - }
64.130 -
64.131 -
64.132 - public boolean supportsCustomEditor() {
64.133 - return true;
64.134 - }
64.135 -
64.136 - public void attachEnv(PropertyEnv env ) {
64.137 - FeatureDescriptor desc = env.getFeatureDescriptor();
64.138 - // make this not editable
64.139 - desc.setValue("canEditAsText", Boolean.FALSE); // NOI18N
64.140 - }
64.141 -}
64.142 \ No newline at end of file
65.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/DelimiterTreeTableView.java Sat Sep 27 15:34:52 2008 -0700
65.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
65.3 @@ -1,137 +0,0 @@
65.4 -/*
65.5 - * The contents of this file are subject to the terms of the Common Development
65.6 - * and Distribution License (the License). You may not use this file except in
65.7 - * compliance with the License.
65.8 - *
65.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
65.10 - * or http://www.netbeans.org/cddl.txt.
65.11 -
65.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
65.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
65.14 - * If applicable, add the following below the CDDL Header, with the fields
65.15 - * enclosed by brackets [] replaced by your own identifying information:
65.16 - * "Portions Copyrighted [year] [name of copyright owner]"
65.17 - *
65.18 - * The Original Software is NetBeans. The Initial Developer of the Original
65.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
65.20 - * Microsystems, Inc. All Rights Reserved.
65.21 - */
65.22 -
65.23 -package org.netbeans.modules.encoder.custom.aip;
65.24 -
65.25 -import java.lang.reflect.InvocationTargetException;
65.26 -import java.util.ResourceBundle;
65.27 -import org.openide.explorer.view.TreeTableView;
65.28 -import org.openide.nodes.PropertySupport;
65.29 -
65.30 -/**
65.31 - * A tree table view for showing the delimiter list.
65.32 - *
65.33 - * @author Jun Xu
65.34 - */
65.35 -public class DelimiterTreeTableView extends TreeTableView {
65.36 -
65.37 - private static final ResourceBundle _bundle =
65.38 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle");
65.39 - private static final int COL_TYPE = 0;
65.40 - private static final int COL_PRECEDENCE = COL_TYPE + 1;
65.41 - private static final int COL_OPTIONAL_MODE = COL_PRECEDENCE + 1;
65.42 - private static final int COL_TERMINATOR_MODE = COL_OPTIONAL_MODE + 1;
65.43 - private static final int COL_BYTES = COL_TERMINATOR_MODE + 1;
65.44 - private static final int COL_OFFSET = COL_BYTES + 1;
65.45 - private static final int COL_LENGTH = COL_OFFSET + 1;
65.46 - private static final int COL_DETACHED = COL_LENGTH + 1;
65.47 - private static final int COL_BEGIN_BYTES = COL_DETACHED + 1;
65.48 - private static final int COL_BEGIN_OFFSET = COL_BEGIN_BYTES + 1;
65.49 - private static final int COL_BEGIN_LENGTH = COL_BEGIN_OFFSET + 1;
65.50 - private static final int COL_BEGIN_DETACHED = COL_BEGIN_LENGTH + 1;
65.51 - private static final int COL_SKIP_LEADING = COL_BEGIN_DETACHED + 1;
65.52 - private static final int COL_COLLAPSE = COL_SKIP_LEADING + 1;
65.53 -
65.54 - /** Creates a new instance of DelimiterTreeTableView */
65.55 - public DelimiterTreeTableView() {
65.56 - super();
65.57 - PropertySupport.ReadWrite[] props = new PropertySupport.ReadWrite[COL_COLLAPSE + 1];
65.58 - props[COL_TYPE] = new SimplePropertySupport("kind", String.class,
65.59 - _bundle.getString("delim_tree_tab.lbl.type"),
65.60 - _bundle.getString("delim_tree_tab.lbl.type_short")); //NOI18N
65.61 - props[COL_PRECEDENCE] = new SimplePropertySupport("precedence", short.class,
65.62 - _bundle.getString("delim_tree_tab.lbl.precedence"),
65.63 - _bundle.getString("delim_tree_tab.lbl.precedence_short")); //NOI18N
65.64 - props[COL_OPTIONAL_MODE] = new SimplePropertySupport("optionMode", String.class,
65.65 - _bundle.getString("delim_tree_tab.lbl.opt_mode"),
65.66 - _bundle.getString("delim_tree_tab.lbl.opt_mode_short")); //NOI18N
65.67 - props[COL_TERMINATOR_MODE] = new SimplePropertySupport("termMode", String.class,
65.68 - _bundle.getString("delim_tree_tab.lbl.term_mode"),
65.69 - _bundle.getString("delim_tree_tab.lbl.term_mode_short")); //NOI18N
65.70 - props[COL_BYTES] = new SimplePropertySupport("bytes", String.class,
65.71 - _bundle.getString("delim_tree_tab.lbl.delim_bytes"),
65.72 - _bundle.getString("delim_tree_tab.lbl.delim_bytes_short")); //NOI18N
65.73 - props[COL_OFFSET] = new SimplePropertySupport("offset", int.class,
65.74 - _bundle.getString("delim_tree_tab.lbl.offset"),
65.75 - _bundle.getString("delim_tree_tab.lbl.offset_short")); //NOI18N
65.76 - props[COL_LENGTH] = new SimplePropertySupport("length", short.class,
65.77 - _bundle.getString("delim_tree_tab.lbl.length"),
65.78 - _bundle.getString("delim_tree_tab.lbl.length_short")); //NOI18N
65.79 - props[COL_DETACHED] = new SimplePropertySupport("detached", boolean.class,
65.80 - _bundle.getString("delim_tree_tab.lbl.detached"),
65.81 - _bundle.getString("delim_tree_tab.lbl.detached_short")); //NOI18N
65.82 - props[COL_BEGIN_BYTES] = new SimplePropertySupport("beginBytes", String.class,
65.83 - _bundle.getString("delim_tree_tab.lbl.begin_delim_bytes"),
65.84 - _bundle.getString("delim_tree_tab.lbl.begin_delim_bytes_short")); //NOI18N
65.85 - props[COL_BEGIN_OFFSET] = new SimplePropertySupport("beginOffset", int.class,
65.86 - _bundle.getString("delim_tree_tab.lbl.begin_offset"),
65.87 - _bundle.getString("delim_tree_tab.lbl.begin_offset_short")); //NOI18N
65.88 - props[COL_BEGIN_LENGTH] = new SimplePropertySupport("beginLength", short.class,
65.89 - _bundle.getString("delim_tree_tab.lbl.begin_length"),
65.90 - _bundle.getString("delim_tree_tab.lbl.begin_length_short")); //NOI18N
65.91 - props[COL_BEGIN_DETACHED] = new SimplePropertySupport("beginDetached", boolean.class,
65.92 - _bundle.getString("delim_tree_tab.lbl.begin_detached"),
65.93 - _bundle.getString("delim_tree_tab.lbl.begin_detached_short")); //NOI18N
65.94 - props[COL_SKIP_LEADING] = new SimplePropertySupport("skipLeading", boolean.class,
65.95 - _bundle.getString("delim_tree_tab.lbl.skip_leading"),
65.96 - _bundle.getString("delim_tree_tab.lbl.skip_leading_short")); //NOI18N
65.97 - props[COL_COLLAPSE] = new SimplePropertySupport("collapse", boolean.class,
65.98 - _bundle.getString("delim_tree_tab.lbl.collapse"),
65.99 - _bundle.getString("delim_tree_tab.lbl.collapse_short")); //NOI18N
65.100 - setProperties(props);
65.101 -
65.102 - double ratio = getFont().getSize2D() / 12;
65.103 -
65.104 - setTableColumnPreferredWidth(COL_TYPE, (int) (ratio * 65));
65.105 - setTableColumnPreferredWidth(COL_PRECEDENCE, (int) (ratio * 68));
65.106 - setTableColumnPreferredWidth(COL_OPTIONAL_MODE, (int) (ratio * 60));
65.107 - setTableColumnPreferredWidth(COL_TERMINATOR_MODE, (int) (ratio * 65));
65.108 - setTableColumnPreferredWidth(COL_BYTES, (int) (ratio * 42));
65.109 - setTableColumnPreferredWidth(COL_OFFSET, (int) (ratio * 42));
65.110 - setTableColumnPreferredWidth(COL_LENGTH, (int) (ratio * 42));
65.111 - setTableColumnPreferredWidth(COL_DETACHED, (int) (ratio * 60));
65.112 - setTableColumnPreferredWidth(COL_BEGIN_BYTES, (int) (ratio * 60));
65.113 - setTableColumnPreferredWidth(COL_BEGIN_OFFSET, (int) (ratio * 60));
65.114 - setTableColumnPreferredWidth(COL_BEGIN_LENGTH, (int) (ratio * 65));
65.115 - setTableColumnPreferredWidth(COL_BEGIN_DETACHED, (int) (ratio * 78));
65.116 - setTableColumnPreferredWidth(COL_SKIP_LEADING, (int) (ratio * 35));
65.117 - setTableColumnPreferredWidth(COL_COLLAPSE, (int) (ratio * 50));
65.118 - }
65.119 -
65.120 - private static class SimplePropertySupport extends PropertySupport.ReadWrite {
65.121 -
65.122 - private Object mValue;
65.123 -
65.124 - public SimplePropertySupport(String name, Class clazz, String shortDesc, String displayName) {
65.125 - super(name, clazz, displayName, shortDesc);
65.126 - }
65.127 -
65.128 - public Object getValue()
65.129 - throws IllegalAccessException, InvocationTargetException {
65.130 -
65.131 - return mValue;
65.132 - }
65.133 -
65.134 - public void setValue(Object object)
65.135 - throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
65.136 -
65.137 - mValue = object;
65.138 - }
65.139 - }
65.140 -}
66.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/EncodingNode.java Sat Sep 27 15:34:52 2008 -0700
66.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
66.3 @@ -1,436 +0,0 @@
66.4 -/*
66.5 - * The contents of this file are subject to the terms of the Common Development
66.6 - * and Distribution License (the License). You may not use this file except in
66.7 - * compliance with the License.
66.8 - *
66.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
66.10 - * or http://www.netbeans.org/cddl.txt.
66.11 -
66.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
66.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
66.14 - * If applicable, add the following below the CDDL Header, with the fields
66.15 - * enclosed by brackets [] replaced by your own identifying information:
66.16 - * "Portions Copyrighted [year] [name of copyright owner]"
66.17 - *
66.18 - * The Original Software is NetBeans. The Initial Developer of the Original
66.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
66.20 - * Microsystems, Inc. All Rights Reserved.
66.21 - */
66.22 -
66.23 -package org.netbeans.modules.encoder.custom.aip;
66.24 -
66.25 -import com.sun.encoder.custom.appinfo.DelimiterSet;
66.26 -import com.sun.encoder.custom.appinfo.NodeProperties;
66.27 -import java.awt.Image;
66.28 -import java.beans.PropertyChangeEvent;
66.29 -import java.beans.PropertyChangeListener;
66.30 -import java.lang.reflect.InvocationTargetException;
66.31 -import java.util.HashSet;
66.32 -import java.util.ResourceBundle;
66.33 -import java.util.Set;
66.34 -import org.openide.nodes.AbstractNode;
66.35 -import org.openide.nodes.Children;
66.36 -import org.openide.nodes.PropertySupport;
66.37 -import org.openide.nodes.Sheet;
66.38 -import org.openide.util.Lookup;
66.39 -import org.openide.util.Utilities;
66.40 -import org.openide.util.WeakListeners;
66.41 -
66.42 -/**
66.43 - * The node implementation for displaying encoding information.
66.44 - *
66.45 - * @author Jun Xu
66.46 - */
66.47 -public class EncodingNode extends AbstractNode
66.48 - implements PropertyChangeListener {
66.49 -
66.50 - private static final ResourceBundle _bundle =
66.51 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/Bundle");
66.52 - private static final Set<String> mChangeSheetPropNames = new HashSet<String>();
66.53 - static {
66.54 - mChangeSheetPropNames.add("nodeType"); //NOI18N
66.55 - mChangeSheetPropNames.add("xmlType"); //NOI18N
66.56 - mChangeSheetPropNames.add("typeDef"); //NOI18N
66.57 - mChangeSheetPropNames.add("top"); //NOI18N
66.58 - mChangeSheetPropNames.add("fixedLengthType"); //NOI18N
66.59 - }
66.60 -
66.61 - private final EncodingOption mEncodingOption;
66.62 -
66.63 - /** Creates a new instance of EncodingInfoNode */
66.64 - public EncodingNode(EncodingOption encodingOption, Lookup lookup) {
66.65 - super(new Children.Array(), lookup);
66.66 - mEncodingOption = encodingOption;
66.67 - encodingOption.addPropertyChangeListener(
66.68 - WeakListeners.propertyChange(this, encodingOption));
66.69 - }
66.70 -
66.71 - @Override
66.72 - public String getDisplayName() {
66.73 - return _bundle.getString("encoding_node.lbl.encoding");
66.74 - }
66.75 -
66.76 - @Override
66.77 - public String getName() {
66.78 - return "encoding"; //NOI18N
66.79 - }
66.80 -
66.81 - @Override
66.82 - public boolean canRename() {
66.83 - return false;
66.84 - }
66.85 -
66.86 - @Override
66.87 - public boolean canCut() {
66.88 - return false;
66.89 - }
66.90 -
66.91 - @Override
66.92 - public boolean canCopy() {
66.93 - return false;
66.94 - }
66.95 -
66.96 - @Override
66.97 - public String getHtmlDisplayName() {
66.98 - if (mEncodingOption == null) {
66.99 - //Must be some kind of invalid XML causing this.
66.100 - //Display it using warning color
66.101 - return "<font color='!controlShadow'><i>" + getDisplayName() + "</i></font>"; //NOI18N
66.102 - }
66.103 - return null;
66.104 - }
66.105 -
66.106 - @Override
66.107 - public Image getIcon(int i) {
66.108 - return Utilities.loadImage("org/netbeans/modules/encoder/custom/aip/icon.PNG"); //NOI18N
66.109 - }
66.110 -
66.111 - @Override
66.112 - public Image getOpenedIcon(int i) {
66.113 - return Utilities.loadImage("org/netbeans/modules/encoder/custom/aip/openIcon.PNG"); //NOI18N
66.114 - }
66.115 -
66.116 - @Override
66.117 - protected Sheet createSheet() {
66.118 - Sheet sheet = Sheet.createDefault();
66.119 - Sheet.Set propSet = Sheet.createPropertiesSet();
66.120 - try {
66.121 - //The read-only encoding style property
66.122 - propSet.put(
66.123 - new EncodingStyleProperty(
66.124 - "encodingStyle", //NOI18N
66.125 - String.class,
66.126 - _bundle.getString("encoding_node.lbl.encoding_style"),
66.127 - _bundle.getString("encoding_node.lbl.encoding_style_short")));
66.128 -
66.129 - //The Node Type Property
66.130 - {
66.131 - PropertySupport.Reflection<String> prop =
66.132 - new PropertySupport.Reflection<String>(mEncodingOption,
66.133 - String.class, "nodeType"); //NOI18N
66.134 - prop.setName("nodeType"); //NOI18N
66.135 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.node_type"));
66.136 - prop.setPropertyEditorClass(NodeTypePropertyEditor.class);
66.137 - propSet.put(prop);
66.138 - }
66.139 -
66.140 - if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
66.141 -
66.142 - PropertySupport.Reflection<String> prop =
66.143 - new PropertySupport.Reflection<String>(mEncodingOption,
66.144 - String.class, "fixedLengthType"); //NOI18N
66.145 - prop.setName("fixedLengthType"); //NOI18N
66.146 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.fixed_length_type"));
66.147 - prop.setPropertyEditorClass(FixedLengthTypePropertyEditor.class);
66.148 - propSet.put(prop);
66.149 -
66.150 - if (mEncodingOption.isUndeterminedFixedLengthType()) {
66.151 - // do not show "length", "offset" or "position" fields
66.152 - } else if (mEncodingOption.isReversedFixedLengthType()) {
66.153 - PropertySupport.Reflection<Integer> prop1 =
66.154 - new PropertySupport.Reflection<Integer>(mEncodingOption,
66.155 - int.class, "length"); //NOI18N
66.156 - prop1.setName("lengthFromEnd"); //NOI18N
66.157 - prop1.setDisplayName(_bundle.getString("encoding_node.lbl.length_from_end"));
66.158 - propSet.put(prop1);
66.159 - } else if (mEncodingOption.isEncodedFixedLengthType()) {
66.160 - PropertySupport.Reflection<Integer> prop1 =
66.161 - new PropertySupport.Reflection<Integer>(mEncodingOption,
66.162 - int.class, "length"); //NOI18N
66.163 - prop1.setName("lengthEncoded"); //NOI18N
66.164 - prop1.setDisplayName(_bundle.getString("encoding_node.lbl.length_encoded"));
66.165 - propSet.put(prop1);
66.166 -
66.167 - PropertySupport.Reflection<String> prop2 =
66.168 - new PropertySupport.Reflection<String>(mEncodingOption,
66.169 - String.class, "offset"); //NOI18N
66.170 - prop2.setName("offsetEncoded"); //NOI18N
66.171 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.offset_encoded"));
66.172 - propSet.put(prop2);
66.173 -
66.174 - PropertySupport.Reflection<String> prop3 =
66.175 - new PropertySupport.Reflection<String>(mEncodingOption,
66.176 - String.class, "position"); //NOI18N
66.177 - prop3.setName("positionEncoded"); //NOI18N
66.178 - prop3.setDisplayName(_bundle.getString("encoding_node.lbl.position_encoded"));
66.179 - propSet.put(prop3);
66.180 - } else {
66.181 - PropertySupport.Reflection<Integer> prop1 =
66.182 - new PropertySupport.Reflection<Integer>(mEncodingOption,
66.183 - int.class, "length"); //NOI18N
66.184 - prop1.setName("length"); //NOI18N
66.185 - prop1.setDisplayName(_bundle.getString("encoding_node.lbl.length"));
66.186 - propSet.put(prop1);
66.187 -
66.188 - PropertySupport.Reflection<String> prop2 =
66.189 - new PropertySupport.Reflection<String>(mEncodingOption,
66.190 - String.class, "offset"); //NOI18N
66.191 - prop2.setName("offset"); //NOI18N
66.192 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.offset"));
66.193 - propSet.put(prop2);
66.194 - }
66.195 - }
66.196 -
66.197 - if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())) {
66.198 - PropertySupport.Reflection prop =
66.199 - new DelimiterSetProperty(mEncodingOption,
66.200 - DelimiterSet.class, "delimiterSet"); //NOI18N
66.201 - prop.setName("delimiterSet"); //NOI18N
66.202 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.delim_list"));
66.203 - propSet.put(prop);
66.204 - }
66.205 -
66.206 - if (mEncodingOption.testIsGlobal()) {
66.207 - //The Top Property checkbox
66.208 - PropertySupport.Reflection<Boolean> prop =
66.209 - new PropertySupport.Reflection<Boolean>(mEncodingOption,
66.210 - boolean.class, "top"); //NOI18N
66.211 - prop.setName("top"); //NOI18N
66.212 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.top"));
66.213 - propSet.put(prop);
66.214 - }
66.215 -
66.216 - if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()) {
66.217 - //The Input Character Set Property
66.218 - PropertySupport.Reflection<String> prop =
66.219 - new PropertySupport.Reflection<String>(mEncodingOption,
66.220 - String.class, "inputCharset"); //NOI18N
66.221 - prop.setName("inputCharset"); //NOI18N
66.222 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.input_charset"));
66.223 - propSet.put(prop);
66.224 -
66.225 - //The Output Character Set Property
66.226 - PropertySupport.Reflection<String> prop2 =
66.227 - new PropertySupport.Reflection<String>(mEncodingOption,
66.228 - String.class, "outputCharset"); //NOI18N
66.229 - prop2.setName("outputCharset"); //NOI18N
66.230 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.output_charset"));
66.231 - propSet.put(prop2);
66.232 - }
66.233 -
66.234 - if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()
66.235 - || NodeProperties.NodeType.FIXED_LENGTH.equals(
66.236 - mEncodingOption.xgetNodeType())) {
66.237 - //The Parsing Character Set Property
66.238 - PropertySupport.Reflection<String> prop =
66.239 - new PropertySupport.Reflection<String>(mEncodingOption,
66.240 - String.class, "parsingCharset"); //NOI18N
66.241 - prop.setName("parsingCharset"); //NOI18N
66.242 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.parsing_charset"));
66.243 - propSet.put(prop);
66.244 -
66.245 - //The Serializing Character Set Property
66.246 - PropertySupport.Reflection<String> prop2 =
66.247 - new PropertySupport.Reflection<String>(mEncodingOption,
66.248 - String.class, "serializingCharset"); //NOI18N
66.249 - prop2.setName("serializingCharset"); //NOI18N
66.250 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.serial_charset"));
66.251 - propSet.put(prop2);
66.252 - }
66.253 -
66.254 - if (!NodeProperties.NodeType.GROUP.equals(mEncodingOption.xgetNodeType())
66.255 - && mEncodingOption.testIsSimple()
66.256 - && !NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())) {
66.257 - PropertySupport.Reflection<String> prop =
66.258 - new PropertySupport.Reflection<String>(mEncodingOption,
66.259 - String.class, "alignment"); //NOI18N
66.260 - prop.setName("alignment"); //NOI18N
66.261 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.alignment"));
66.262 - prop.setPropertyEditorClass(AlignmentPropertyEditor.class);
66.263 - propSet.put(prop);
66.264 -
66.265 - PropertySupport.Reflection<String> prop2 =
66.266 - new PropertySupport.Reflection<String>(mEncodingOption,
66.267 - String.class, "match"); //NOI18N
66.268 - prop2.setName("match"); //NOI18N
66.269 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.match"));
66.270 - propSet.put(prop2);
66.271 -
66.272 - //The NoMatch (boolean) Property
66.273 - PropertySupport.Reflection<Boolean> prop3 =
66.274 - new PropertySupport.Reflection<Boolean>(mEncodingOption,
66.275 - boolean.class, "noMatch"); //NOI18N
66.276 - prop3.setName("noMatch"); //NOI18N
66.277 - prop3.setDisplayName(_bundle.getString("encoding_node.lbl.no_match"));
66.278 - propSet.put(prop3);
66.279 - }
66.280 -
66.281 - if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())
66.282 - && !mEncodingOption.testIsSimple() && !mEncodingOption.testIsChoice()) {
66.283 - PropertySupport.Reflection<String> prop =
66.284 - new PropertySupport.Reflection<String>(mEncodingOption,
66.285 - String.class, "order"); //NOI18N
66.286 - prop.setName("order"); //NOI18N
66.287 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.order"));
66.288 - prop.setPropertyEditorClass(OrderPropertyEditor.class);
66.289 - propSet.put(prop);
66.290 - }
66.291 -
66.292 - if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())
66.293 - && !mEncodingOption.testIsSimple()) {
66.294 - PropertySupport.Reflection<String> prop1 =
66.295 - new PropertySupport.Reflection<String>(mEncodingOption,
66.296 - String.class, "nOfNminN"); //NOI18N
66.297 - prop1.setName("nOfNminN"); //NOI18N
66.298 - prop1.setDisplayName(_bundle.getString("encoding_node.lbl.n_of_n_min_n"));
66.299 - propSet.put(prop1);
66.300 -
66.301 - PropertySupport.Reflection<String> prop2 =
66.302 - new PropertySupport.Reflection<String>(mEncodingOption,
66.303 - String.class, "nOfNmaxN"); //NOI18N
66.304 - prop2.setName("nOfNmaxN"); //NOI18N
66.305 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.n_of_n_max_n"));
66.306 - propSet.put(prop2);
66.307 - }
66.308 -
66.309 - if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())
66.310 - && !mEncodingOption.testIsGlobal()) {
66.311 - PropertySupport.Reflection<String> prop1 =
66.312 - new PropertySupport.Reflection<String>(mEncodingOption,
66.313 - String.class, "minOcc"); //NOI18N
66.314 - prop1.setName("minOcc"); //NOI18N
66.315 - prop1.setDisplayName(_bundle.getString("encoding_node.lbl.min_occ"));
66.316 - propSet.put(prop1);
66.317 -
66.318 - PropertySupport.Reflection<String> prop2 =
66.319 - new PropertySupport.Reflection<String>(mEncodingOption,
66.320 - String.class, "maxOcc"); //NOI18N
66.321 - prop2.setName("maxOcc"); //NOI18N
66.322 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.max_occ"));
66.323 - propSet.put(prop2);
66.324 -
66.325 - PropertySupport.Reflection<String> prop3 =
66.326 - new PropertySupport.Reflection<String>(mEncodingOption,
66.327 - String.class, "scvngrChars"); //NOI18N
66.328 - prop3.setName("scvngrChars"); //NOI18N
66.329 - prop3.setDisplayName(_bundle.getString("encoding_node.lbl.scvngr_chars"));
66.330 - propSet.put(prop3);
66.331 -
66.332 - PropertySupport.Reflection<Boolean> prop4 =
66.333 - new PropertySupport.Reflection<Boolean>(mEncodingOption,
66.334 - boolean.class, "scvngrEmit1st"); //NOI18N
66.335 - prop4.setName("scvngrEmit1st"); //NOI18N
66.336 - prop4.setDisplayName(_bundle.getString("encoding_node.lbl.scvngr_emit_1st"));
66.337 - propSet.put(prop4);
66.338 - }
66.339 -
66.340 - if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
66.341 - PropertySupport.Reflection<String> prop =
66.342 - new PropertySupport.Reflection<String>(mEncodingOption,
66.343 - String.class, "beginDelimiter"); //NOI18N
66.344 - prop.setName("beginDelimiter"); //NOI18N
66.345 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter"));
66.346 - propSet.put(prop);
66.347 - } else if (NodeProperties.NodeType.DELIMITED.equals(mEncodingOption.xgetNodeType())) {
66.348 - // reuse same real estate
66.349 - PropertySupport.Reflection<String> prop =
66.350 - new ReadOnlyBeginDelimiterProperty<String>(mEncodingOption,
66.351 - String.class, "getBeginDelimitersAsString"); //NOI18N
66.352 - prop.setName("beginDelimiter"); //NOI18N
66.353 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter"));
66.354 - propSet.put(prop);
66.355 - }
66.356 -
66.357 - if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
66.358 - PropertySupport.Reflection<Boolean> prop =
66.359 - new PropertySupport.Reflection<Boolean>(mEncodingOption,
66.360 - boolean.class, "beginDelimiterDetached"); //NOI18N
66.361 - prop.setName("beginDelimiterDetached"); //NOI18N
66.362 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter_detached"));
66.363 - propSet.put(prop);
66.364 - }
66.365 -
66.366 - if (NodeProperties.NodeType.DELIMITED.equals(mEncodingOption.xgetNodeType())) {
66.367 - PropertySupport.Reflection<String> prop =
66.368 - new ReadOnlyDelimiterProperty<String>(mEncodingOption,
66.369 - String.class, "getEndDelimitersAsString"); //NOI18N
66.370 - prop.setName("delimiter"); //NOI18N
66.371 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.delimiter"));
66.372 - propSet.put(prop);
66.373 - }
66.374 -
66.375 - if (NodeProperties.NodeType.ARRAY.equals(mEncodingOption.xgetNodeType())) {
66.376 - PropertySupport.Reflection<String> prop =
66.377 - new ReadOnlyArrayDelimiterProperty<String>(mEncodingOption,
66.378 - String.class, "getArrayDelimitersAsString"); //NOI18N
66.379 - prop.setName("arrayDelimiter"); //NOI18N
66.380 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.array_delimiter"));
66.381 - propSet.put(prop);
66.382 - }
66.383 -
66.384 - if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()) {
66.385 - //The Escape Sequence Property
66.386 - PropertySupport.Reflection<String> prop =
66.387 - new PropertySupport.Reflection<String>(mEncodingOption,
66.388 - String.class, "escapeSequence"); //NOI18N
66.389 - prop.setName("escapeSequence"); //NOI18N
66.390 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.escape_sequence"));
66.391 - propSet.put(prop);
66.392 - }
66.393 -
66.394 - if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()) {
66.395 - //The Fine Inherit Property
66.396 - PropertySupport.Reflection<Boolean> prop =
66.397 - new PropertySupport.Reflection<Boolean>(mEncodingOption,
66.398 - boolean.class, "fineInherit"); //NOI18N
66.399 - prop.setName("fineInherit"); //NOI18N
66.400 - prop.setDisplayName(_bundle.getString("encoding_node.lbl.fine_inherit"));
66.401 - propSet.put(prop);
66.402 -
66.403 - PropertySupport.Reflection<String> prop2 =
66.404 - new PropertySupport.Reflection<String>(mEncodingOption,
66.405 - String.class, "undefDataPolicy"); //NOI18N
66.406 - prop2.setName("undefDataPolicy"); //NOI18N
66.407 - prop2.setDisplayName(_bundle.getString("encoding_node.lbl.undefined_data_policy"));
66.408 - prop2.setPropertyEditorClass(UndefDataPolicyPropertyEditor.class);
66.409 - propSet.put(prop2);
66.410 - }
66.411 - } catch (NoSuchMethodException e) {
66.412 - throw new RuntimeException(_bundle.getString("encoding_node.exp.no_such_mthd"), e);
66.413 - }
66.414 - sheet.put(propSet);
66.415 - return sheet;
66.416 - }
66.417 -
66.418 - /**
66.419 - * This method gets called when a bound property is changed.
66.420 - * @param evt A PropertyChangeEvent object describing the event source
66.421 - * and the property that has changed.
66.422 - */
66.423 - public void propertyChange(PropertyChangeEvent evt) {
66.424 - if (mChangeSheetPropNames.contains(evt.getPropertyName())) {
66.425 - setSheet(createSheet());
66.426 - }
66.427 - }
66.428 -
66.429 - private static class EncodingStyleProperty<T> extends PropertySupport.ReadOnly<T> {
66.430 -
66.431 - EncodingStyleProperty(String name, Class<T> clazz, String displayName, String desc) {
66.432 - super(name, clazz, displayName, desc);
66.433 - }
66.434 -
66.435 - public T getValue() throws IllegalAccessException, InvocationTargetException {
66.436 - return (T) CustomEncodingConst.STYLE;
66.437 - }
66.438 - }
66.439 -}
67.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/EncodingOption.java Sat Sep 27 15:34:52 2008 -0700
67.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
67.3 @@ -1,1930 +0,0 @@
67.4 -/*
67.5 - * The contents of this file are subject to the terms of the Common Development
67.6 - * and Distribution License (the License). You may not use this file except in
67.7 - * compliance with the License.
67.8 - *
67.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
67.10 - * or http://www.netbeans.org/cddl.txt.
67.11 -
67.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
67.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
67.14 - * If applicable, add the following below the CDDL Header, with the fields
67.15 - * enclosed by brackets [] replaced by your own identifying information:
67.16 - * "Portions Copyrighted [year] [name of copyright owner]"
67.17 - *
67.18 - * The Original Software is NetBeans. The Initial Developer of the Original
67.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
67.20 - * Microsystems, Inc. All Rights Reserved.
67.21 - */
67.22 -
67.23 -package org.netbeans.modules.encoder.custom.aip;
67.24 -
67.25 -import com.sun.encoder.custom.appinfo.CustomEncoding;
67.26 -import com.sun.encoder.custom.appinfo.Delimiter;
67.27 -import com.sun.encoder.custom.appinfo.DelimiterLevel;
67.28 -import com.sun.encoder.custom.appinfo.DelimiterSet;
67.29 -import com.sun.encoder.custom.appinfo.NodeProperties;
67.30 -import com.sun.encoder.custom.appinfo.NodeProperties.DelimOfFixed;
67.31 -import com.sun.encoder.custom.appinfo.NodeProperties.NOfN;
67.32 -import com.sun.encoder.custom.appinfo.NodeProperties.Scvngr;
67.33 -import com.sun.encoder.runtime.provider.Misc;
67.34 -import java.beans.PropertyChangeEvent;
67.35 -import java.beans.PropertyChangeListener;
67.36 -import java.io.IOException;
67.37 -import java.io.StringReader;
67.38 -import java.util.ArrayList;
67.39 -import java.util.Collection;
67.40 -import java.util.Collections;
67.41 -import java.util.HashMap;
67.42 -import java.util.HashSet;
67.43 -import java.util.LinkedList;
67.44 -import java.util.List;
67.45 -import java.util.Map;
67.46 -import java.util.ResourceBundle;
67.47 -import java.util.Set;
67.48 -import org.apache.xmlbeans.XmlCursor;
67.49 -import org.apache.xmlbeans.XmlException;
67.50 -import org.apache.xmlbeans.XmlObject;
67.51 -import org.apache.xmlbeans.XmlOptions;
67.52 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
67.53 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
67.54 -import org.netbeans.modules.encoder.ui.basic.SchemaUtility;
67.55 -import org.netbeans.modules.encoder.ui.basic.ValidationException;
67.56 -import org.netbeans.modules.xml.schema.model.Annotation;
67.57 -import org.netbeans.modules.xml.schema.model.AppInfo;
67.58 -import org.netbeans.modules.xml.schema.model.ComplexType;
67.59 -import org.netbeans.modules.xml.schema.model.Element;
67.60 -import org.netbeans.modules.xml.schema.model.ElementReference;
67.61 -import org.netbeans.modules.xml.schema.model.GlobalElement;
67.62 -import org.netbeans.modules.xml.schema.model.LocalElement;
67.63 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
67.64 -import org.netbeans.modules.xml.schema.model.SchemaModel;
67.65 -import org.netbeans.modules.xml.schema.model.SimpleType;
67.66 -import org.openide.util.NbBundle;
67.67 -import org.openide.util.WeakListeners;
67.68 -import org.xml.sax.ErrorHandler;
67.69 -import org.xml.sax.SAXException;
67.70 -import org.xml.sax.SAXParseException;
67.71 -
67.72 -/**
67.73 - * The model of the custom encoding node.
67.74 - *
67.75 - * @author Jun Xu
67.76 - */
67.77 -public class EncodingOption {
67.78 -
67.79 - private static final ResourceBundle _bundle =
67.80 - ResourceBundle.getBundle(
67.81 - EncodingOption.class.getPackage().getName() + ".Bundle"); //NOI18N
67.82 - public static final String NODE_TYPE_PREFIX = "nodeType"; //NOI18N
67.83 - public static final String ALIGNMENT_PREFIX = "align"; //NOI18N
67.84 - public static final String ORDER_PREFIX = "order"; //NOI18N
67.85 - public static final String UNDEFINED_DATA_POLICY_PREFIX = "undefDataPolicy"; //NOI18N
67.86 - public static final String FIXED_LENGTH_TYPE_PREFIX = "fixedLengthType"; //NOI18N
67.87 - private static final String EMP = ""; //NOI18N
67.88 - private static final String UDS = "_"; //NOI18N
67.89 - private static final String MULTI_DELIM_SEPARATOR = ", "; //NOI18N
67.90 -
67.91 - private static final CustomEncoding mDefaultCustomEncoding =
67.92 - CustomEncoding.Factory.newInstance();
67.93 -
67.94 - private static final Map<String, String> mReverseTextMap =
67.95 - new HashMap<String, String>();
67.96 - private static final Map<String, String> mTextMap =
67.97 - new HashMap<String, String>();
67.98 - private static List<String> mNodeTypeTagList = new ArrayList<String>();
67.99 - private static List<String> mAlignmentTagList = new ArrayList<String>();
67.100 - private static List<String> mOrderTagList = new ArrayList<String>();
67.101 - private static List<String> mFixedLengthTypeTagList = new ArrayList<String>();
67.102 - private static List<String> mUndefDataPolicyTagList = new ArrayList<String>();
67.103 -
67.104 - static {
67.105 - //Populate the localized text map and the tag list for the node type property
67.106 - mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_group"), "group"); //NOI18N
67.107 - mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_array"), "array"); //NOI18N
67.108 - mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_delimited"), "delimited"); //NOI18N
67.109 - mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_fixedLength"), "fixedLength"); //NOI18N
67.110 - mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_transient"), "transient"); //NOI18N
67.111 - mTextMap.put(NODE_TYPE_PREFIX + UDS + "group", _bundle.getString("TAG_NodeType_group")); //NOI18N
67.112 - mTextMap.put(NODE_TYPE_PREFIX + UDS + "array", _bundle.getString("TAG_NodeType_array")); //NOI18N
67.113 - mTextMap.put(NODE_TYPE_PREFIX + UDS + "delimited", _bundle.getString("TAG_NodeType_delimited")); //NOI18N
67.114 - mTextMap.put(NODE_TYPE_PREFIX + UDS + "fixedLength", _bundle.getString("TAG_NodeType_fixedLength")); //NOI18N
67.115 - mTextMap.put(NODE_TYPE_PREFIX + UDS + "transient", _bundle.getString("TAG_NodeType_transient")); //NOI18N
67.116 - mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_group"));
67.117 - mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_array"));
67.118 - mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_delimited"));
67.119 - mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_fixedLength"));
67.120 - mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_transient"));
67.121 - mNodeTypeTagList = Collections.unmodifiableList(mNodeTypeTagList);
67.122 -
67.123 - //Populate the localized text map and the tag list for the alignment property
67.124 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_blind"), "blind"); //NOI18N
67.125 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_exact"), "exact"); //NOI18N
67.126 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_begin"), "begin"); //NOI18N
67.127 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_final"), "final"); //NOI18N
67.128 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_inter"), "inter"); //NOI18N
67.129 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_super"), "super"); //NOI18N
67.130 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_oneof"), "oneof"); //NOI18N
67.131 - mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_regex"), "regex"); //NOI18N
67.132 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "blind", _bundle.getString("TAG_Alignment_blind")); //NOI18N
67.133 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "exact", _bundle.getString("TAG_Alignment_exact")); //NOI18N
67.134 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "begin", _bundle.getString("TAG_Alignment_begin")); //NOI18N
67.135 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "final", _bundle.getString("TAG_Alignment_final")); //NOI18N
67.136 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "inter", _bundle.getString("TAG_Alignment_inter")); //NOI18N
67.137 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "super", _bundle.getString("TAG_Alignment_super")); //NOI18N
67.138 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "oneof", _bundle.getString("TAG_Alignment_oneof")); //NOI18N
67.139 - mTextMap.put(ALIGNMENT_PREFIX + UDS + "regex", _bundle.getString("TAG_Alignment_regex")); //NOI18N
67.140 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_blind"));
67.141 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_exact"));
67.142 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_begin"));
67.143 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_final"));
67.144 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_inter"));
67.145 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_super"));
67.146 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_oneof"));
67.147 - mAlignmentTagList.add(_bundle.getString("TAG_Alignment_regex"));
67.148 - mAlignmentTagList = Collections.unmodifiableList(mAlignmentTagList);
67.149 -
67.150 - //Populate the localized text map and the tag list for the order property
67.151 - mReverseTextMap.put(ORDER_PREFIX + UDS + _bundle.getString("TAG_Order_sequence"), "sequence"); //NOI18N
67.152 - mReverseTextMap.put(ORDER_PREFIX + UDS + _bundle.getString("TAG_Order_any"), "any"); //NOI18N
67.153 - mReverseTextMap.put(ORDER_PREFIX + UDS + _bundle.getString("TAG_Order_mixed"), "mixed"); //NOI18N
67.154 - mTextMap.put(ORDER_PREFIX + UDS + "sequence", _bundle.getString("TAG_Order_sequence")); //NOI18N
67.155 - mTextMap.put(ORDER_PREFIX + UDS + "any", _bundle.getString("TAG_Order_any")); //NOI18N
67.156 - mTextMap.put(ORDER_PREFIX + UDS + "mixed", _bundle.getString("TAG_Order_mixed")); //NOI18N
67.157 - mOrderTagList.add(_bundle.getString("TAG_Order_sequence"));
67.158 - mOrderTagList.add(_bundle.getString("TAG_Order_any"));
67.159 - mOrderTagList.add(_bundle.getString("TAG_Order_mixed"));
67.160 - mOrderTagList = Collections.unmodifiableList(mOrderTagList);
67.161 -
67.162 - //Populate the localized text map and the tag list for the fixedLengthType property
67.163 - mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_regular"), "regular"); //NOI18N
67.164 - mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_encoded"), "encoded"); //NOI18N
67.165 - mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_undetermined"), "undetermined"); //NOI18N
67.166 - mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_reversed"), "reversed"); //NOI18N
67.167 - mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "regular", _bundle.getString("TAG_FixedLengthType_regular")); //NOI18N
67.168 - mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "encoded", _bundle.getString("TAG_FixedLengthType_encoded")); //NOI18N
67.169 - mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "undetermined", _bundle.getString("TAG_FixedLengthType_undetermined")); //NOI18N
67.170 - mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "reversed", _bundle.getString("TAG_FixedLengthType_reversed")); //NOI18N
67.171 - mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_regular"));
67.172 - mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_encoded"));
67.173 - mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_undetermined"));
67.174 - mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_reversed"));
67.175 - mFixedLengthTypeTagList = Collections.unmodifiableList(mFixedLengthTypeTagList);
67.176 -
67.177 - //Populate the localized text map and the tag list for the undefDataPolicy property
67.178 - mReverseTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + _bundle.getString("TAG_UndefDataPolicy_map"), "map"); //NOI18N
67.179 - mReverseTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + _bundle.getString("TAG_UndefDataPolicy_skip"), "skip"); //NOI18N
67.180 - mReverseTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + _bundle.getString("TAG_UndefDataPolicy_prohibit"), "prohibit"); //NOI18N
67.181 - mTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + "map", _bundle.getString("TAG_UndefDataPolicy_map")); //NOI18N
67.182 - mTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + "skip", _bundle.getString("TAG_UndefDataPolicy_skip")); //NOI18N
67.183 - mTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + "prohibit", _bundle.getString("TAG_UndefDataPolicy_prohibit")); //NOI18N
67.184 - mUndefDataPolicyTagList.add(_bundle.getString("TAG_UndefDataPolicy_map"));
67.185 - mUndefDataPolicyTagList.add(_bundle.getString("TAG_UndefDataPolicy_skip"));
67.186 - mUndefDataPolicyTagList.add(_bundle.getString("TAG_UndefDataPolicy_prohibit"));
67.187 -
67.188 - //Populate the default NodeProperties
67.189 - mDefaultCustomEncoding.addNewNodeProperties();
67.190 - mDefaultCustomEncoding.getNodeProperties().setNodeType(
67.191 - NodeProperties.NodeType.DELIMITED);
67.192 - }
67.193 -
67.194 - /* Bean property change listeners */
67.195 - private final List<PropertyChangeListener> propChangeListeners =
67.196 - Collections.synchronizedList(new LinkedList<PropertyChangeListener>());
67.197 -
67.198 - /**
67.199 - * Component path from which the encoding options are read
67.200 - */
67.201 - private final SchemaComponent[] mComponentPath;
67.202 -
67.203 - /* Bean property variables */
67.204 - private String mNodeType = mTextMap.get(NODE_TYPE_PREFIX
67.205 - + UDS + NodeProperties.NodeType.DELIMITED);
67.206 - private boolean mTop = false;
67.207 - private String mInputCharset = EMP;
67.208 - private String mParsingCharset = EMP;
67.209 - private String mSerializingCharset = EMP;
67.210 - private String mOutputCharset = EMP;
67.211 - private DelimiterSet mDelimiterSet = null;
67.212 - private String mOrder = mTextMap.get(ORDER_PREFIX
67.213 - + UDS + NodeProperties.Order.SEQUENCE);
67.214 - private String mNOfNminN = EMP;
67.215 - private String mNOfNmaxN = EMP;
67.216 - private String mMatch = EMP;
67.217 - private boolean mNoMatch = false;
67.218 - private String mAlignment = mTextMap.get(ALIGNMENT_PREFIX
67.219 - + UDS + NodeProperties.Alignment.BLIND);
67.220 - private String mMinOcc = EMP;
67.221 - private String mMaxOcc = EMP;
67.222 - private String mScvngrChars = EMP;
67.223 - private boolean mScvngrEmit1st = false;
67.224 -
67.225 - // for a fixedLength field
67.226 - private String mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX
67.227 - + UDS + "regular"); //NOI18N
67.228 - private int mLength = 0;
67.229 - private String mOffset = EMP;
67.230 - private String mPosition = EMP;
67.231 - private String mBeginDelimiter = EMP;
67.232 - private boolean mBeginDelimiterDetached = false;
67.233 - // global
67.234 - private String mEscapeSequence = EMP;
67.235 - private boolean mFineInherit = false;
67.236 - private String mUndefDataPolicy = mTextMap.get(UNDEFINED_DATA_POLICY_PREFIX
67.237 - + UDS + NodeProperties.UndefDataPolicy.PROHIBIT);
67.238 -
67.239 - private CustomEncoding mCustomEncoding = null;
67.240 - private AppInfo mAppInfo = null;
67.241 - private PropertyChangeListener mSchemaPropChangeListener;
67.242 -
67.243 - /**
67.244 - * Creates a new instance of EncodingOption
67.245 - * @param path - a list of SchemaComponent
67.246 - */
67.247 - private EncodingOption(List<SchemaComponent> path) {
67.248 - if (path == null) {
67.249 - throw new NullPointerException(
67.250 - _bundle.getString("encoding_opt.exp.no_component_path")); //NOI18N
67.251 - }
67.252 - if (path.size() < 1) {
67.253 - throw new IllegalArgumentException(
67.254 - _bundle.getString("encoding_opt.exp.illegal_comp_path")); //NOI18N
67.255 - }
67.256 - mComponentPath = path.toArray(new SchemaComponent[0]);
67.257 - }
67.258 -
67.259 - public static EncodingOption createFromAppInfo(List<SchemaComponent> path)
67.260 - throws InvalidAppInfoException {
67.261 - return createFromAppInfo(path, true);
67.262 - }
67.263 -
67.264 - /**
67.265 - * Create EncodingOption object from AppInfo.
67.266 - *
67.267 - * @param path list of SchemaComponent.
67.268 - * @param hookUpListener whether or not to hookup listener.
67.269 - * @return created EncodingOption object from AppInfo.
67.270 - * @throws org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException
67.271 - */
67.272 - public static EncodingOption createFromAppInfo(List<SchemaComponent> path,
67.273 - boolean hookUpListener)
67.274 - throws InvalidAppInfoException {
67.275 -
67.276 - EncodingOption option = new EncodingOption(path);
67.277 - if (!option.init(hookUpListener)) {
67.278 - return null;
67.279 - }
67.280 - return option;
67.281 - }
67.282 -
67.283 - public static Map<String, String> textMap() {
67.284 - return mTextMap;
67.285 - }
67.286 -
67.287 - public static Map<String, String> reverseTextMap() {
67.288 - return mReverseTextMap;
67.289 - }
67.290 -
67.291 - public static List<String> nodeTypeTagList() {
67.292 - return mNodeTypeTagList;
67.293 - }
67.294 -
67.295 - public static List<String> alignmentTagList() {
67.296 - return mAlignmentTagList;
67.297 - }
67.298 -
67.299 - public static List<String> orderTagList() {
67.300 - return mOrderTagList;
67.301 - }
67.302 -
67.303 - public static List<String> fixedLengthTypeTagList() {
67.304 - return mFixedLengthTypeTagList;
67.305 - }
67.306 -
67.307 - public static List<String> undefDataPolicyTagList() {
67.308 - return mUndefDataPolicyTagList;
67.309 - }
67.310 -
67.311 - public String getAlignment() {
67.312 - return mAlignment;
67.313 - }
67.314 -
67.315 - public void setAlignment(String alignment) {
67.316 - String old = mAlignment;
67.317 - mAlignment = alignment;
67.318 - NodeProperties.Alignment.Enum enumAlignment =
67.319 - NodeProperties.Alignment.Enum.forString(
67.320 - mReverseTextMap.get(ALIGNMENT_PREFIX + UDS + mAlignment));
67.321 - firePropertyChange("alignment", old, mAlignment); //NOI18N
67.322 - mCustomEncoding.getNodeProperties().setAlignment(enumAlignment);
67.323 - commitToAppInfo();
67.324 - }
67.325 -
67.326 - public String getEndDelimitersAsString() {
67.327 - String delimString = null;
67.328 - try {
67.329 - delimString = computeEndDelimiters();
67.330 - } catch (InvalidAppInfoException ex) {
67.331 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.332 - }
67.333 - // ensure that end delimiter(s) exist (not null).
67.334 - if (delimString == null) {
67.335 - delimString = _bundle.getString("encoding_opt.lbl.delim_not_set"); //NOI18N
67.336 - }
67.337 - return delimString;
67.338 - }
67.339 -
67.340 - public String getBeginDelimitersAsString() {
67.341 - String delimString = null;
67.342 - try {
67.343 - delimString = computeBeginDelimiters();
67.344 - } catch (InvalidAppInfoException ex) {
67.345 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.346 - }
67.347 - if (delimString == null) {
67.348 - delimString = EMP;
67.349 - }
67.350 - return delimString;
67.351 - }
67.352 -
67.353 - public String getArrayDelimitersAsString() {
67.354 - String delimString = null;
67.355 - try {
67.356 - delimString = computeArrayDelimiters();
67.357 - } catch (InvalidAppInfoException ex) {
67.358 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.359 - }
67.360 - if (delimString == null) {
67.361 - delimString = EMP;
67.362 - }
67.363 - return delimString;
67.364 - }
67.365 -
67.366 - public DelimiterSet getDelimiterSet() {
67.367 - return mDelimiterSet;
67.368 - }
67.369 -
67.370 - public void setDelimiterSet(DelimiterSet delimiterSet) {
67.371 - DelimiterSet old = mDelimiterSet;
67.372 - mDelimiterSet = delimiterSet;
67.373 - if (delimiterSet == null) {
67.374 - if (mCustomEncoding.getNodeProperties().isSetDelimiterSet()) {
67.375 - mCustomEncoding.getNodeProperties().unsetDelimiterSet();
67.376 - }
67.377 - } else {
67.378 - mCustomEncoding.getNodeProperties().setDelimiterSet(mDelimiterSet);
67.379 - }
67.380 - commitToAppInfo();
67.381 - firePropertyChange("delimiterSet", old, mDelimiterSet); //NOI18N
67.382 - }
67.383 -
67.384 - public String getInputCharset() {
67.385 - return mInputCharset;
67.386 - }
67.387 -
67.388 - public void setInputCharset(String inputCharset) {
67.389 - String old = mInputCharset;
67.390 - mInputCharset = inputCharset;
67.391 - if (mInputCharset == null || mInputCharset.length() == 0) {
67.392 - if (mCustomEncoding.getNodeProperties().isSetInputCharset()) {
67.393 - mCustomEncoding.getNodeProperties().unsetInputCharset();
67.394 - }
67.395 - } else {
67.396 - mCustomEncoding.getNodeProperties().setInputCharset(inputCharset);
67.397 - }
67.398 - commitToAppInfo();
67.399 - firePropertyChange("inputCharset", old, mInputCharset); //NOI18N
67.400 - }
67.401 -
67.402 - public int getLength() {
67.403 - return mLength;
67.404 - }
67.405 -
67.406 - public void setLength(int length) {
67.407 - if (length < 0) {
67.408 - length *= -1;
67.409 - }
67.410 - Integer old = Integer.valueOf(mLength);
67.411 - mLength = length;
67.412 - if (isReversedFixedLengthType()) {
67.413 - mCustomEncoding.getNodeProperties().setLength(mLength * (-1));
67.414 - } else {
67.415 - mCustomEncoding.getNodeProperties().setLength(mLength);
67.416 - }
67.417 - commitToAppInfo();
67.418 - firePropertyChange("length", old, Integer.valueOf(mLength)); //NOI18N
67.419 - }
67.420 -
67.421 - public String getOffset() {
67.422 - return mOffset;
67.423 - }
67.424 -
67.425 - public void setOffset(String offset) {
67.426 - if (offset == null || offset.length() == 0) {
67.427 - mCustomEncoding.getNodeProperties().unsetOffset();
67.428 - } else {
67.429 - long l = 0;
67.430 - try {
67.431 - l = Long.parseLong(offset);
67.432 - } catch (NumberFormatException e) {
67.433 - // do nothing
67.434 - }
67.435 - if (l < 0) {
67.436 - // change to positive number instead
67.437 - l *= -1;
67.438 - }
67.439 - offset = Long.toString(l);
67.440 - mCustomEncoding.getNodeProperties().setOffset(l);
67.441 - }
67.442 - String old = mOffset;
67.443 - mOffset = offset;
67.444 - commitToAppInfo();
67.445 - firePropertyChange("offset", old, mOffset); //NOI18N
67.446 - }
67.447 -
67.448 - public String getPosition() {
67.449 - return mPosition;
67.450 - }
67.451 -
67.452 - public void setPosition(String position) {
67.453 - if (position == null || position.length() == 0) {
67.454 - mCustomEncoding.getNodeProperties().unsetPosition();
67.455 - } else {
67.456 - long l = 0;
67.457 - try {
67.458 - l = Long.parseLong(position);
67.459 - } catch (NumberFormatException e) {
67.460 - // do nothing
67.461 - }
67.462 - if (l < 0) {
67.463 - // change to positive number instead
67.464 - l *= -1;
67.465 - }
67.466 - position = Long.toString(l);
67.467 - mCustomEncoding.getNodeProperties().setPosition(l);
67.468 - }
67.469 - String old = mPosition;
67.470 - mPosition = position;
67.471 - commitToAppInfo();
67.472 - firePropertyChange("position", old, mPosition); //NOI18N
67.473 - }
67.474 -
67.475 - public String getNOfNminN() {
67.476 - return mNOfNminN;
67.477 - }
67.478 -
67.479 - public void setNOfNminN(String nOfNminN) {
67.480 - if (nOfNminN == null || nOfNminN.length() == 0) {
67.481 - if (mCustomEncoding.getNodeProperties().isSetNOfN()) {
67.482 - mCustomEncoding.getNodeProperties().getNOfN().unsetMinN();
67.483 - }
67.484 - } else {
67.485 - int l = 0;
67.486 - try {
67.487 - l = Integer.parseInt(nOfNminN);
67.488 - } catch (NumberFormatException e) {
67.489 - // do nothing
67.490 - }
67.491 - if (l < 0) {
67.492 - // change to positive number instead
67.493 - l *= -1;
67.494 - }
67.495 - nOfNminN = Integer.toString(l);
67.496 - if (!mCustomEncoding.getNodeProperties().isSetNOfN()) {
67.497 - mCustomEncoding.getNodeProperties().addNewNOfN();
67.498 - }
67.499 - mCustomEncoding.getNodeProperties().getNOfN().setMinN(l);
67.500 - }
67.501 - String old = mNOfNminN;
67.502 - mNOfNminN = nOfNminN;
67.503 - commitToAppInfo();
67.504 - firePropertyChange("nOfNminN", old, mNOfNminN); //NOI18N
67.505 - }
67.506 -
67.507 - public String getNOfNmaxN() {
67.508 - return mNOfNmaxN;
67.509 - }
67.510 -
67.511 - public void setNOfNmaxN(String nOfNmaxN) {
67.512 - if (nOfNmaxN == null || nOfNmaxN.length() == 0) {
67.513 - if (mCustomEncoding.getNodeProperties().isSetNOfN()) {
67.514 - mCustomEncoding.getNodeProperties().getNOfN().unsetMaxN();
67.515 - }
67.516 - } else {
67.517 - int l = 1;
67.518 - try {
67.519 - l = Integer.parseInt(nOfNmaxN);
67.520 - } catch (NumberFormatException e) {
67.521 - // do nothing
67.522 - }
67.523 - if (l < 0) {
67.524 - // change to positive number instead
67.525 - l *= -1;
67.526 - }
67.527 - nOfNmaxN = Integer.toString(l);
67.528 - if (!mCustomEncoding.getNodeProperties().isSetNOfN()) {
67.529 - mCustomEncoding.getNodeProperties().addNewNOfN();
67.530 - }
67.531 - mCustomEncoding.getNodeProperties().getNOfN().setMaxN(l);
67.532 - }
67.533 - String old = mNOfNmaxN;
67.534 - mNOfNmaxN = nOfNmaxN;
67.535 - commitToAppInfo();
67.536 - firePropertyChange("nOfNmaxN", old, mNOfNmaxN); //NOI18N
67.537 - }
67.538 -
67.539 - public String getMinOcc() {
67.540 - return mMinOcc;
67.541 - }
67.542 -
67.543 - public void setMinOcc(String minOcc) {
67.544 - if (minOcc == null || minOcc.length() == 0) {
67.545 - mCustomEncoding.getNodeProperties().unsetMinOcc();
67.546 - } else {
67.547 - long l = 0;
67.548 - try {
67.549 - l = Long.parseLong(minOcc);
67.550 - } catch (NumberFormatException e) {
67.551 - // do nothing
67.552 - }
67.553 - if (l < 0) {
67.554 - // change to positive number instead
67.555 - l *= -1;
67.556 - }
67.557 - minOcc = Long.toString(l);
67.558 - mCustomEncoding.getNodeProperties().setMinOcc(l);
67.559 - }
67.560 - String old = mMinOcc;
67.561 - mMinOcc = minOcc;
67.562 - commitToAppInfo();
67.563 - firePropertyChange("minOcc", old, mMinOcc); //NOI18N
67.564 - }
67.565 -
67.566 - public String getMaxOcc() {
67.567 - return mMaxOcc;
67.568 - }
67.569 -
67.570 - public void setMaxOcc(String maxOcc) {
67.571 - if (maxOcc == null || maxOcc.length() == 0
67.572 - || _bundle.getString("encoding_node.value.unbounded").equalsIgnoreCase(maxOcc)) { //NOI18N
67.573 - mCustomEncoding.getNodeProperties().unsetMaxOcc();
67.574 - } else {
67.575 - long l = 0;
67.576 - try {
67.577 - l = Long.parseLong(maxOcc);
67.578 - } catch (NumberFormatException e) {
67.579 - // do nothing
67.580 - }
67.581 - if (l < 0) {
67.582 - // change to positive number instead
67.583 - l *= -1;
67.584 - }
67.585 - maxOcc = Long.toString(l);
67.586 - mCustomEncoding.getNodeProperties().setMaxOcc(l);
67.587 - }
67.588 - String old = mMaxOcc;
67.589 - mMaxOcc = maxOcc;
67.590 - commitToAppInfo();
67.591 - firePropertyChange("maxOcc", old, mMaxOcc); //NOI18N
67.592 - }
67.593 -
67.594 - public String getScvngrChars() {
67.595 - return mScvngrChars;
67.596 - }
67.597 -
67.598 - public void setScvngrChars(String scvngrChars) {
67.599 - String old = mScvngrChars;
67.600 - mScvngrChars = scvngrChars;
67.601 - if (mScvngrChars == null || mScvngrChars.length() == 0) {
67.602 - mCustomEncoding.getNodeProperties().unsetScvngr();
67.603 - } else {
67.604 - if (!mCustomEncoding.getNodeProperties().isSetScvngr()) {
67.605 - mCustomEncoding.getNodeProperties().addNewScvngr();
67.606 - }
67.607 - mCustomEncoding.getNodeProperties().getScvngr().setChars(scvngrChars);
67.608 - }
67.609 - commitToAppInfo();
67.610 - firePropertyChange("scvngrChars", old, mScvngrChars); //NOI18N
67.611 - }
67.612 -
67.613 - public boolean isScvngrEmit1st() {
67.614 - return mScvngrEmit1st;
67.615 - }
67.616 -
67.617 - public void setScvngrEmit1st(boolean scvngrEmit1st) {
67.618 - if (!mCustomEncoding.getNodeProperties().isSetScvngr()
67.619 - || mCustomEncoding.getNodeProperties().getScvngr().getChars() == null
67.620 - || mCustomEncoding.getNodeProperties().getScvngr().getChars().length() == 0) {
67.621 - // do nothing so that as if user can not
67.622 - // check the "Output First Scavenger Character" because the
67.623 - // "Scavenger Characters" field is not set to any value yet.
67.624 - mScvngrEmit1st = false;
67.625 - return;
67.626 - }
67.627 - boolean old = mScvngrEmit1st;
67.628 - mScvngrEmit1st = scvngrEmit1st;
67.629 - mCustomEncoding.getNodeProperties().getScvngr().setEmit1St(mScvngrEmit1st);
67.630 - commitToAppInfo();
67.631 - firePropertyChange("scvngrEmit1st", old, mScvngrEmit1st); //NOI18N
67.632 - }
67.633 -
67.634 - public String getBeginDelimiter() {
67.635 - return mBeginDelimiter;
67.636 - }
67.637 -
67.638 - public void setBeginDelimiter(String beginDelimiter) {
67.639 - String old = mBeginDelimiter;
67.640 - mBeginDelimiter = beginDelimiter;
67.641 - if (mBeginDelimiter == null || mBeginDelimiter.length() == 0) {
67.642 - // if empty delimiter is set, then remove the "delimOfFixed" element
67.643 - if (mCustomEncoding.getNodeProperties().isSetDelimOfFixed()) {
67.644 - mCustomEncoding.getNodeProperties().unsetDelimOfFixed();
67.645 - }
67.646 - } else {
67.647 - if (!mCustomEncoding.getNodeProperties().isSetDelimOfFixed()) {
67.648 - mCustomEncoding.getNodeProperties().addNewDelimOfFixed();
67.649 - }
67.650 - mCustomEncoding.getNodeProperties().getDelimOfFixed().setBeginBytes(mBeginDelimiter);
67.651 - }
67.652 - commitToAppInfo();
67.653 - firePropertyChange("beginDelimiter", old, mBeginDelimiter); //NOI18N
67.654 - }
67.655 -
67.656 - public boolean isBeginDelimiterDetached() {
67.657 - return mBeginDelimiterDetached;
67.658 - }
67.659 -
67.660 - public void setBeginDelimiterDetached(boolean beginDelimiterDetached) {
67.661 - if (!mCustomEncoding.getNodeProperties().isSetDelimOfFixed()) {
67.662 - // do nothing so that as if user can not
67.663 - // check the "Begin Delimiter Detached" because the
67.664 - // "Begin Delimiter" field is not set to any value yet.
67.665 - mBeginDelimiterDetached = false;
67.666 - return;
67.667 - }
67.668 - boolean old = mBeginDelimiterDetached;
67.669 - mBeginDelimiterDetached = beginDelimiterDetached;
67.670 - mCustomEncoding.getNodeProperties().getDelimOfFixed().setBeginAnch(!mBeginDelimiterDetached);
67.671 - commitToAppInfo();
67.672 - firePropertyChange("beginDelimiterDetached", old, mBeginDelimiterDetached); //NOI18N
67.673 - }
67.674 -
67.675 - public String getMatch() {
67.676 - return mMatch;
67.677 - }
67.678 -
67.679 - public void setMatch(String match) {
67.680 - String old = mMatch;
67.681 - mMatch = match;
67.682 - if (mMatch == null || mMatch.length() == 0) {
67.683 - if (mCustomEncoding.getNodeProperties().isSetMatch()) {
67.684 - mCustomEncoding.getNodeProperties().unsetMatch();
67.685 - }
67.686 - } else {
67.687 - mCustomEncoding.getNodeProperties().setMatch(match);
67.688 - }
67.689 - commitToAppInfo();
67.690 - firePropertyChange("match", old, mMatch); //NOI18N
67.691 - }
67.692 -
67.693 - public String getEscapeSequence() {
67.694 - return mEscapeSequence;
67.695 - }
67.696 -
67.697 - public void setEscapeSequence(String escapeSequence) {
67.698 - String old = mEscapeSequence;
67.699 - mEscapeSequence = escapeSequence;
67.700 - if (mEscapeSequence == null || mEscapeSequence.length() == 0) {
67.701 - if (mCustomEncoding.getNodeProperties().isSetEscapeSequence()) {
67.702 - // if no value, then unset the "escapeSequence" element
67.703 - mCustomEncoding.getNodeProperties().unsetEscapeSequence();
67.704 - }
67.705 - } else {
67.706 - mCustomEncoding.getNodeProperties().setEscapeSequence(mEscapeSequence);
67.707 - }
67.708 - commitToAppInfo();
67.709 - firePropertyChange("escapeSequence", old, mEscapeSequence); //NOI18N
67.710 - }
67.711 -
67.712 - public boolean isFineInherit() {
67.713 - return mFineInherit;
67.714 - }
67.715 -
67.716 - public void setFineInherit(boolean fineInherit) {
67.717 - Boolean old = Boolean.valueOf(mFineInherit);
67.718 - mFineInherit = fineInherit;
67.719 - if (!mFineInherit) {
67.720 - // if false, remove the "fineInherit" element.
67.721 - mCustomEncoding.getNodeProperties().unsetFineInherit();
67.722 - } else {
67.723 - mCustomEncoding.getNodeProperties().setFineInherit(mFineInherit);
67.724 - }
67.725 - commitToAppInfo();
67.726 - firePropertyChange("fineInherit", old, Boolean.valueOf(mFineInherit)); //NOI18N
67.727 - }
67.728 -
67.729 - public String getFixedLengthType() {
67.730 - return mFixedLengthType;
67.731 - }
67.732 -
67.733 - public void setFixedLengthType(String fixedLengthType) {
67.734 - String old = mFixedLengthType;
67.735 - mFixedLengthType = fixedLengthType;
67.736 - String type = mReverseTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + mFixedLengthType);
67.737 - String regexAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.REGEX);
67.738 - String dummyMatch = _bundle.getString("encoding_node.value.default_match"); //NOI18N
67.739 - if ("regular".equals(type)) { //NOI18N
67.740 - // regular fixed length: only length and offset fields make sense
67.741 - if (mCustomEncoding.getNodeProperties().isSetPosition()) {
67.742 - mCustomEncoding.getNodeProperties().unsetPosition();
67.743 - }
67.744 - if (regexAlignment.equals(getAlignment()) && dummyMatch.equals(getMatch())) {
67.745 - setAlignment(mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND));
67.746 - setMatch(EMP);
67.747 - }
67.748 - } else if ("reversed".equals(type)) { //NOI18N
67.749 - // this means the length is deducted from the end of data
67.750 - // Only length field makes sense
67.751 - if (mCustomEncoding.getNodeProperties().isSetPosition()) {
67.752 - mCustomEncoding.getNodeProperties().unsetPosition();
67.753 - }
67.754 - if (mCustomEncoding.getNodeProperties().isSetOffset()) {
67.755 - mCustomEncoding.getNodeProperties().unsetOffset();
67.756 - }
67.757 - if (regexAlignment.equals(getAlignment()) && dummyMatch.equals(getMatch())) {
67.758 - setAlignment(mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND));
67.759 - setMatch(EMP);
67.760 - }
67.761 - } else if ("undetermined".equals(type)) { //NOI18N
67.762 - // this means this fixed length field is determined by a regular
67.763 - // expression match at runtime
67.764 - mLength = 0;
67.765 - mCustomEncoding.getNodeProperties().setLength(mLength);
67.766 - if (mCustomEncoding.getNodeProperties().isSetPosition()) {
67.767 - mCustomEncoding.getNodeProperties().unsetPosition();
67.768 - }
67.769 - if (mCustomEncoding.getNodeProperties().isSetOffset()) {
67.770 - mCustomEncoding.getNodeProperties().unsetOffset();
67.771 - }
67.772 - if (!regexAlignment.equals(getAlignment())) {
67.773 - setAlignment(regexAlignment);
67.774 - if (getMatch() == null || getMatch().length() == 0) {
67.775 - setMatch(dummyMatch);
67.776 - }
67.777 - }
67.778 - } else {
67.779 - if (regexAlignment.equals(getAlignment()) && dummyMatch.equals(getMatch())) {
67.780 - setAlignment(mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND));
67.781 - setMatch(EMP);
67.782 - }
67.783 - }
67.784 - firePropertyChange("fixedLengthType", old, mFixedLengthType); //NOI18N
67.785 - commitToAppInfo();
67.786 - }
67.787 -
67.788 - public String getUndefDataPolicy() {
67.789 - return mUndefDataPolicy;
67.790 - }
67.791 -
67.792 - public void setUndefDataPolicy(String undefDataPolicy) {
67.793 - if (undefDataPolicy == null || undefDataPolicy.length() == 0) {
67.794 - // do nothing
67.795 - return;
67.796 - }
67.797 - String old = undefDataPolicy;
67.798 - mUndefDataPolicy = undefDataPolicy;
67.799 - String policy = mReverseTextMap.get(UNDEFINED_DATA_POLICY_PREFIX + UDS + mUndefDataPolicy);
67.800 - if ("prohibit".equals(policy)) {
67.801 - mCustomEncoding.getNodeProperties().unsetUndefDataPolicy();
67.802 - } else {
67.803 - NodeProperties.UndefDataPolicy.Enum enumUndefDataPolicy =
67.804 - NodeProperties.UndefDataPolicy.Enum.forString(policy);
67.805 - mCustomEncoding.getNodeProperties().setUndefDataPolicy(enumUndefDataPolicy);
67.806 - }
67.807 - firePropertyChange("undefDataPolicy", old, mUndefDataPolicy); //NOI18N
67.808 - commitToAppInfo();
67.809 - }
67.810 -
67.811 - public String getNodeType() {
67.812 - return mNodeType;
67.813 - }
67.814 -
67.815 - public void setNodeType(String nodeType) {
67.816 - String old = mNodeType;
67.817 - mNodeType = nodeType;
67.818 - NodeProperties.NodeType.Enum enumNodeType =
67.819 - NodeProperties.NodeType.Enum.forString(
67.820 - mReverseTextMap.get(NODE_TYPE_PREFIX + UDS + mNodeType));
67.821 - mCustomEncoding.getNodeProperties().setNodeType(enumNodeType);
67.822 - if (!NodeProperties.NodeType.FIXED_LENGTH.equals(enumNodeType)) {
67.823 - if (mCustomEncoding.getNodeProperties().isSetLength()) {
67.824 - mCustomEncoding.getNodeProperties().unsetLength();
67.825 - mLength = 0;
67.826 - }
67.827 - if (!mTop) {
67.828 - if (mCustomEncoding.getNodeProperties().isSetParsingCharset()) {
67.829 - mParsingCharset = EMP;
67.830 - mCustomEncoding.getNodeProperties().unsetParsingCharset();
67.831 - }
67.832 - if (mCustomEncoding.getNodeProperties().isSetSerializingCharset()) {
67.833 - mSerializingCharset = EMP;
67.834 - mCustomEncoding.getNodeProperties().unsetSerializingCharset();
67.835 - }
67.836 - }
67.837 - }
67.838 - if (NodeProperties.NodeType.GROUP.equals(enumNodeType)
67.839 - || NodeProperties.NodeType.TRANSIENT.equals(enumNodeType)
67.840 - || !testIsSimple()) {
67.841 - if (mCustomEncoding.getNodeProperties().isSetAlignment()) {
67.842 - mAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND);
67.843 - mCustomEncoding.getNodeProperties().unsetAlignment();
67.844 - }
67.845 - if (mCustomEncoding.getNodeProperties().isSetMatch()) {
67.846 - mMatch = EMP;
67.847 - mCustomEncoding.getNodeProperties().unsetMatch();
67.848 - }
67.849 - }
67.850 - firePropertyChange("nodeType", old, mNodeType); //NOI18N
67.851 - commitToAppInfo();
67.852 - }
67.853 -
67.854 - public boolean isNoMatch() {
67.855 - return mNoMatch;
67.856 - }
67.857 -
67.858 - public void setNoMatch(boolean noMatch) {
67.859 - // if No Match is selected but there is no "Match" value, then skip
67.860 - // to make No Match not selected
67.861 - if (noMatch && (mMatch == null || mMatch.length() == 0)) {
67.862 - return;
67.863 - }
67.864 - Boolean old = Boolean.valueOf(mNoMatch);
67.865 - mNoMatch = noMatch;
67.866 - if (mNoMatch) {
67.867 - mCustomEncoding.getNodeProperties().setNoMatch(mNoMatch);
67.868 - } else {
67.869 - // remove the "noMatch" element
67.870 - mCustomEncoding.getNodeProperties().unsetNoMatch();
67.871 - }
67.872 - commitToAppInfo();
67.873 - firePropertyChange("noMatch", old, Boolean.valueOf(mNoMatch)); //NOI18N
67.874 - }
67.875 -
67.876 - public String getOrder() {
67.877 - return mOrder;
67.878 - }
67.879 -
67.880 - public void setOrder(String order) {
67.881 - String old = mOrder;
67.882 - mOrder = order;
67.883 - NodeProperties.Order.Enum enumOrder =
67.884 - NodeProperties.Order.Enum.forString(
67.885 - mReverseTextMap.get(ORDER_PREFIX + UDS + mOrder));
67.886 - firePropertyChange("order", old, mOrder); //NOI18N
67.887 - mCustomEncoding.getNodeProperties().setOrder(enumOrder);
67.888 - commitToAppInfo();
67.889 - }
67.890 -
67.891 - public String getOutputCharset() {
67.892 - return mOutputCharset;
67.893 - }
67.894 -
67.895 - public void setOutputCharset(String outputCharset) {
67.896 - String old = mOutputCharset;
67.897 - mOutputCharset = outputCharset;
67.898 - if (mOutputCharset == null || mOutputCharset.length() == 0) {
67.899 - if (mCustomEncoding.getNodeProperties().isSetOutputCharset()) {
67.900 - mCustomEncoding.getNodeProperties().unsetOutputCharset();
67.901 - }
67.902 - } else {
67.903 - mCustomEncoding.getNodeProperties().setOutputCharset(outputCharset);
67.904 - }
67.905 - commitToAppInfo();
67.906 - firePropertyChange("outputCharset", old, mOutputCharset); //NOI18N
67.907 - }
67.908 -
67.909 - public String getParsingCharset() {
67.910 - return mParsingCharset;
67.911 - }
67.912 -
67.913 - public void setParsingCharset(String parsingCharset) {
67.914 - String old = mParsingCharset;
67.915 - mParsingCharset = parsingCharset;
67.916 - if (mParsingCharset == null || mParsingCharset.length() == 0) {
67.917 - if (mCustomEncoding.getNodeProperties().isSetParsingCharset()) {
67.918 - mCustomEncoding.getNodeProperties().unsetParsingCharset();
67.919 - }
67.920 - } else {
67.921 - mCustomEncoding.getNodeProperties().setParsingCharset(parsingCharset);
67.922 - }
67.923 - commitToAppInfo();
67.924 - firePropertyChange("parsingCharset", old, mParsingCharset); //NOI18N
67.925 - }
67.926 -
67.927 - public String getSerializingCharset() {
67.928 - return mSerializingCharset;
67.929 - }
67.930 -
67.931 - public void setSerializingCharset(String serializingCharset) {
67.932 - String old = mSerializingCharset;
67.933 - mSerializingCharset = serializingCharset;
67.934 - if (mSerializingCharset == null || mSerializingCharset.length() == 0) {
67.935 - if (mCustomEncoding.getNodeProperties().isSetSerializingCharset()) {
67.936 - mCustomEncoding.getNodeProperties().unsetSerializingCharset();
67.937 - }
67.938 - } else {
67.939 - mCustomEncoding.getNodeProperties().setSerializingCharset(serializingCharset);
67.940 - }
67.941 - commitToAppInfo();
67.942 - firePropertyChange("serializingCharset", old, mSerializingCharset); //NOI18N
67.943 - }
67.944 -
67.945 - public boolean isTop() {
67.946 - return mTop;
67.947 - }
67.948 -
67.949 - public void setTop(boolean top) {
67.950 - Boolean old = Boolean.valueOf(mTop);
67.951 - mTop = top;
67.952 - mCustomEncoding.setTop(mTop);
67.953 - if (!mTop) {
67.954 - if (mCustomEncoding.getNodeProperties().isSetInputCharset()) {
67.955 - mInputCharset = EMP;
67.956 - mCustomEncoding.getNodeProperties().unsetInputCharset();
67.957 - }
67.958 - if (mCustomEncoding.getNodeProperties().isSetOutputCharset()) {
67.959 - mOutputCharset = EMP;
67.960 - mCustomEncoding.getNodeProperties().unsetOutputCharset();
67.961 - }
67.962 - if (!NodeProperties.NodeType.FIXED_LENGTH.equals(xgetNodeType())) {
67.963 - if (mCustomEncoding.getNodeProperties().isSetParsingCharset()) {
67.964 - mParsingCharset = EMP;
67.965 - mCustomEncoding.getNodeProperties().unsetParsingCharset();
67.966 - }
67.967 - if (mCustomEncoding.getNodeProperties().isSetSerializingCharset()) {
67.968 - mSerializingCharset = EMP;
67.969 - mCustomEncoding.getNodeProperties().unsetSerializingCharset();
67.970 - }
67.971 - }
67.972 - }
67.973 - commitToAppInfo();
67.974 - firePropertyChange("top", old, Boolean.valueOf(mTop)); //NOI18N
67.975 - }
67.976 -
67.977 - /**
67.978 - * Test if current "encoding" node belongs to an XSD global element.
67.979 - * @return true if current "encoding" node belongs to an XSD global element.
67.980 - */
67.981 - public boolean testIsGlobal() {
67.982 - for (int i = 0; i < mComponentPath.length; i++) {
67.983 - if (mComponentPath[i] instanceof ElementReference) {
67.984 - return false;
67.985 - }
67.986 - }
67.987 - return annotation().getParent() instanceof GlobalElement;
67.988 - }
67.989 -
67.990 - /**
67.991 - * Test if current "encoding" node belongs to a leaf node.
67.992 - * @return true if current "encoding" node belongs to a leaf node.
67.993 - */
67.994 - public boolean testIsSimple() {
67.995 - if (!(annotation().getParent() instanceof Element)) {
67.996 - return false;
67.997 - }
67.998 - return SchemaUtility.isSimpleContent((Element) annotation().getParent());
67.999 - }
67.1000 -
67.1001 - /**
67.1002 - * Test if current "encoding" node belongs to a choice node.
67.1003 - * @return true if current "encoding" node belongs to a choice node.
67.1004 - */
67.1005 - public boolean testIsChoice() {
67.1006 - if (!(annotation().getParent() instanceof Element)) {
67.1007 - return false;
67.1008 - }
67.1009 - return SchemaUtility.isChoice((Element) annotation().getParent());
67.1010 - }
67.1011 -
67.1012 - public NodeProperties.NodeType.Enum xgetNodeType() {
67.1013 - return mCustomEncoding.getNodeProperties().getNodeType();
67.1014 - }
67.1015 -
67.1016 - public boolean isReversedFixedLengthType() {
67.1017 - if (mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "reversed").equals(getFixedLengthType())) { //NOI18N)
67.1018 - return true;
67.1019 - }
67.1020 - return false;
67.1021 - }
67.1022 -
67.1023 - public boolean isEncodedFixedLengthType() {
67.1024 - if (mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "encoded").equals(getFixedLengthType())) { //NOI18N)
67.1025 - return true;
67.1026 - }
67.1027 - return false;
67.1028 - }
67.1029 -
67.1030 - public boolean isUndeterminedFixedLengthType() {
67.1031 - if (mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "undetermined").equals(getFixedLengthType())) { //NOI18N)
67.1032 - return true;
67.1033 - }
67.1034 - return false;
67.1035 - }
67.1036 -
67.1037 - public void addPropertyChangeListener(PropertyChangeListener listener) {
67.1038 - propChangeListeners.add(listener);
67.1039 - }
67.1040 -
67.1041 - public void removePropertyChangeListener(PropertyChangeListener listener) {
67.1042 - propChangeListeners.remove(listener);
67.1043 - }
67.1044 -
67.1045 - public void validate(ErrorHandler handler)
67.1046 - throws ValidationException, SAXException {
67.1047 - if (NodeProperties.NodeType.DELIMITED.equals(xgetNodeType())) {
67.1048 - //is delimited
67.1049 - String delimAsString = null;
67.1050 - try {
67.1051 - delimAsString = computeEndDelimiters();
67.1052 - } catch (InvalidAppInfoException ex) {
67.1053 - delimAsString = _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.1054 - }
67.1055 - if (delimAsString == null) {
67.1056 - handler.error(
67.1057 - new SAXParseException(
67.1058 - NbBundle.getMessage(
67.1059 - EncodingOption.class,
67.1060 - "encoding_opt.exp.delim_not_set", //NOI18N
67.1061 - SchemaUtility.getNCNamePath(mComponentPath)),
67.1062 - annotation().getModel().getSchema().getTargetNamespace(),
67.1063 - null /*ModelUtils.getFilePath(annotation().getModel())*/,
67.1064 - -1,
67.1065 - -1));
67.1066 - }
67.1067 - } else if (NodeProperties.NodeType.FIXED_LENGTH.equals(xgetNodeType())) {
67.1068 - if (getLength() == 0) {
67.1069 - handler.warning(
67.1070 - new SAXParseException(
67.1071 - NbBundle.getMessage(
67.1072 - EncodingOption.class,
67.1073 - "encoding_opt.exp.zero_fixed_length", //NOI18N
67.1074 - SchemaUtility.getNCNamePath(mComponentPath)),
67.1075 - annotation().getModel().getSchema().getTargetNamespace(),
67.1076 - null /*ModelUtils.getFilePath(annotation().getModel())*/,
67.1077 - -1,
67.1078 - -1));
67.1079 - }
67.1080 - if (mCustomEncoding.getNodeProperties().isSetAlignment()
67.1081 - && NodeProperties.Alignment.EXACT.equals(
67.1082 - mCustomEncoding.getNodeProperties().getAlignment())
67.1083 - && mMatch != null && mLength > 0
67.1084 - && Misc.str2bytes(Misc.nonPrintable(mMatch)).length > mLength) {
67.1085 - handler.error(
67.1086 - new SAXParseException(
67.1087 - NbBundle.getMessage(
67.1088 - EncodingOption.class,
67.1089 - "encoding_opt.exp.match_len_gt_fld_len", //NOI18N
67.1090 - SchemaUtility.getNCNamePath(mComponentPath)),
67.1091 - annotation().getModel().getSchema().getTargetNamespace(),
67.1092 - null /*ModelUtils.getFilePath(annotation().getModel())*/,
67.1093 - -1,
67.1094 - -1));
67.1095 - }
67.1096 - }
67.1097 - }
67.1098 -
67.1099 - /**
67.1100 - * Check to see if global 'Fine Inherit" flag is true.
67.1101 - * @return true if global 'Fine Inherit" flag is true.
67.1102 - * @throws org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException
67.1103 - */
67.1104 - private boolean testIsGlobalFineInherit() throws InvalidAppInfoException {
67.1105 - SchemaComponent comp;
67.1106 - Annotation anno;
67.1107 - CustomEncoding customEncoding;
67.1108 - // we need to find out if fine-grained inheritance global flag is set
67.1109 - boolean globalFineInheritFlag = false;
67.1110 - comp = mComponentPath[1];
67.1111 - if (comp instanceof GlobalElement) {
67.1112 - anno = ((Element) comp).getAnnotation();
67.1113 - if (anno != null) {
67.1114 - customEncoding = fetchCustomEncoding(anno, null);
67.1115 - if (customEncoding != null && customEncoding.getTop()
67.1116 - && customEncoding.isSetNodeProperties()) {
67.1117 - NodeProperties nProp = customEncoding.getNodeProperties();
67.1118 - if (nProp.isSetFineInherit()) {
67.1119 - globalFineInheritFlag = nProp.getFineInherit();
67.1120 - }
67.1121 - }
67.1122 - }
67.1123 - }
67.1124 - return globalFineInheritFlag;
67.1125 - }
67.1126 -
67.1127 - /**
67.1128 - * Return all end delimiters at the given delimiter level
67.1129 - * as a comma separate string, e.g. "], }". It returns null
67.1130 - * if there is no delimiter defined.
67.1131 - *
67.1132 - * @param delimLevel a given delimiter level
67.1133 - * @return a comma separate string, e.g. "], }"
67.1134 - */
67.1135 - private String getEndDelimitersAsString(DelimiterLevel delimLevel) {
67.1136 - String delimAsString = EMP;
67.1137 - // get all delimiters at this delimiter level
67.1138 - Delimiter[] delimArr = delimLevel.getDelimiterArray();
67.1139 - for (int i = 0; i < delimArr.length; i++) {
67.1140 - if (Delimiter.Kind.REPEAT.equals(delimArr[i].getKind())) {
67.1141 - // skip repeat/array delimiter(s)
67.1142 - continue;
67.1143 - }
67.1144 - if (!delimArr[i].isSetBytes()) {
67.1145 - continue;
67.1146 - }
67.1147 - if (delimAsString.length() > 0) {
67.1148 - // add separator due to multiple delimiters.
67.1149 - delimAsString += MULTI_DELIM_SEPARATOR;
67.1150 - }
67.1151 - if (delimArr[i].getBytes().isSetConstant()) {
67.1152 - // i.e. regular constant delimiter
67.1153 - delimAsString += delimArr[i].getBytes().getConstant();
67.1154 - } else if (delimArr[i].getBytes().isSetEmbedded()) {
67.1155 - // i.e. embedded delimiter
67.1156 - // output as e.g. "...., {embedded:10,2}"
67.1157 - delimAsString += (
67.1158 - "{" //NOI18N
67.1159 - + _bundle.getString("encoding_opt.lbl.embedded") //NOI18N
67.1160 - + delimArr[i].getBytes().getEmbedded().getOffset()
67.1161 - + "," //NOI18N
67.1162 - + delimArr[i].getBytes().getEmbedded().getLength()
67.1163 - + "}"); //NOI18N
67.1164 - }
67.1165 - }
67.1166 - if (delimAsString.length() == 0) {
67.1167 - delimAsString = null;
67.1168 - }
67.1169 - return delimAsString;
67.1170 - }
67.1171 -
67.1172 - private String getBeginDelimitersAsString(DelimiterLevel delimLevel) {
67.1173 - String delimAsString = EMP;
67.1174 - // get all delimiters at this delimiter level
67.1175 - Delimiter[] delimArr = delimLevel.getDelimiterArray();
67.1176 - for (int i = 0; i < delimArr.length; i++) {
67.1177 - if (Delimiter.Kind.REPEAT.equals(delimArr[i].getKind())) {
67.1178 - // skip repeat/array delimiter(s)
67.1179 - continue;
67.1180 - }
67.1181 - if (!delimArr[i].isSetBeginBytes()) {//CCC
67.1182 - continue;
67.1183 - }
67.1184 - if (delimAsString.length() > 0) {
67.1185 - // add separator due to multiple delimiters.
67.1186 - delimAsString += MULTI_DELIM_SEPARATOR;
67.1187 - }
67.1188 - if (delimArr[i].getBeginBytes().isSetConstant()) {//CCC
67.1189 - // i.e. regular constant delimiter
67.1190 - delimAsString += delimArr[i].getBeginBytes().getConstant();//CCC
67.1191 - } else if (delimArr[i].getBeginBytes().isSetEmbedded()) {
67.1192 - // i.e. embedded delimiter
67.1193 - // output as e.g. "...., {embedded:10,2}"
67.1194 - delimAsString += (
67.1195 - "{" //NOI18N
67.1196 - + _bundle.getString("encoding_opt.lbl.embedded") //NOI18N
67.1197 - + delimArr[i].getBeginBytes().getEmbedded().getOffset()//CCC
67.1198 - + "," //NOI18N
67.1199 - + delimArr[i].getBeginBytes().getEmbedded().getLength()//CCC
67.1200 - + "}"); //NOI18N
67.1201 - }
67.1202 - }
67.1203 - if (delimAsString.length() == 0) {
67.1204 - delimAsString = null;
67.1205 - }
67.1206 - return delimAsString;
67.1207 - }
67.1208 -
67.1209 - private String getArrayDelimitersAsString(DelimiterLevel delimLevel) {
67.1210 - String delimAsString = EMP;
67.1211 - // get all delimiters at this delimiter level
67.1212 - Delimiter[] delimArr = delimLevel.getDelimiterArray();
67.1213 - for (int i = 0; i < delimArr.length; i++) {
67.1214 - if (!Delimiter.Kind.REPEAT.equals(delimArr[i].getKind())) {//CCC
67.1215 - // skip non-repeat/array delimiter(s)
67.1216 - continue;
67.1217 - }
67.1218 - if (!delimArr[i].isSetBytes()) {
67.1219 - continue;
67.1220 - }
67.1221 - if (delimAsString.length() > 0) {
67.1222 - // add separator due to multiple delimiters.
67.1223 - delimAsString += MULTI_DELIM_SEPARATOR;
67.1224 - }
67.1225 - if (delimArr[i].getBytes().isSetConstant()) {
67.1226 - // i.e. regular constant delimiter
67.1227 - delimAsString += delimArr[i].getBytes().getConstant();
67.1228 - } else if (delimArr[i].getBytes().isSetEmbedded()) {
67.1229 - // i.e. embedded delimiter
67.1230 - // output as e.g. "...., {embedded:10,2}"
67.1231 - delimAsString += (
67.1232 - "{" //NOI18N
67.1233 - + _bundle.getString("encoding_opt.lbl.embedded") //NOI18N
67.1234 - + delimArr[i].getBytes().getEmbedded().getOffset()
67.1235 - + "," //NOI18N
67.1236 - + delimArr[i].getBytes().getEmbedded().getLength()
67.1237 - + "}"); //NOI18N
67.1238 - }
67.1239 - }
67.1240 - if (delimAsString.length() == 0) {
67.1241 - delimAsString = null;
67.1242 - }
67.1243 - return delimAsString;
67.1244 - }
67.1245 -
67.1246 - /**
67.1247 - * Compute the end delimiter value at current node.
67.1248 - * @return the computed end delimiter value.
67.1249 - */
67.1250 - private String computeEndDelimiters()
67.1251 - throws InvalidAppInfoException {
67.1252 - // Only delimited or array node needs to compute delimiter
67.1253 - if (!NodeProperties.NodeType.DELIMITED.equals(xgetNodeType())
67.1254 - && !NodeProperties.NodeType.ARRAY.equals(xgetNodeType())) {
67.1255 - return null;
67.1256 - }
67.1257 - String delimAsString = null;
67.1258 - DelimiterLevel delimLevel;
67.1259 - // Check to see if there are local delimiters defined. If so, they
67.1260 - // takes precedence,
67.1261 - if (mDelimiterSet != null) {
67.1262 - // So we get first delimiter level out of it.
67.1263 - int lvl = 0;
67.1264 - delimLevel = mDelimiterSet.getLevelArray(lvl);
67.1265 - // We get all end delimiters at the given delimiter level as
67.1266 - // comma separated string
67.1267 - delimAsString = getEndDelimitersAsString(delimLevel);
67.1268 - if (delimAsString != null) {
67.1269 - return delimAsString;
67.1270 - }
67.1271 - }
67.1272 - SchemaComponent comp;
67.1273 - Annotation anno;
67.1274 - CustomEncoding customEncoding;
67.1275 - boolean isFineInherit = testIsGlobalFineInherit();
67.1276 -
67.1277 - // Starting from (mComponentPath.length - 3) and doing bottom-up
67.1278 - // traverse up the ladder, so the current element declaration can be
67.1279 - // skipped (i.e. this will skip last 2 SchemaComponent objects in the
67.1280 - // ladder array, namely, its parent "annotation" node and its
67.1281 - // grandparent localElement node.) It traverses up the ladder, until it
67.1282 - // finds an upper hierachy element or elementReference who has
67.1283 - // annotation that has custom encoding that has node properties with
67.1284 - // delimiters defined.
67.1285 - int lvl = 0;
67.1286 - int i = mComponentPath.length - 3;
67.1287 - for (; i >= 0; i--) {
67.1288 - comp = mComponentPath[i];
67.1289 - if (!(comp instanceof Element)
67.1290 - || comp instanceof ElementReference) {
67.1291 - // skip non-element or non-elementReference, and continue to
67.1292 - // search up in the XSD structure ladder
67.1293 - continue;
67.1294 - }
67.1295 - anno = ((Element) comp).getAnnotation();
67.1296 - if (anno == null) {
67.1297 - // continue to search up, and record delimiter level number
67.1298 - lvl++;
67.1299 - continue;
67.1300 - }
67.1301 - try {
67.1302 - customEncoding = fetchCustomEncoding(anno, null);
67.1303 - } catch (InvalidAppInfoException ex) {
67.1304 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.1305 - }
67.1306 - if (customEncoding == null || !customEncoding.isSetNodeProperties()) {
67.1307 - // continue to search up, and record delimiter level number
67.1308 - lvl++;
67.1309 - continue;
67.1310 - }
67.1311 - NodeProperties nProp = customEncoding.getNodeProperties();
67.1312 - if (NodeProperties.NodeType.DELIMITED.equals(nProp.getNodeType())
67.1313 - || NodeProperties.NodeType.ARRAY.equals(nProp.getNodeType())) {
67.1314 - // record delimiter level number
67.1315 - lvl++;
67.1316 - }
67.1317 - if (!nProp.isSetDelimiterSet()) {
67.1318 - // continue to search up
67.1319 - continue;
67.1320 - }
67.1321 - if (nProp.getDelimiterSet().sizeOfLevelArray() <= lvl) {
67.1322 - // no delim Level corresponding to lvl is defined
67.1323 - if (isFineInherit) {
67.1324 - // continue to search up
67.1325 - continue;
67.1326 - } else {
67.1327 - // no delimiters defined, break loop
67.1328 - break;
67.1329 - }
67.1330 - }
67.1331 - delimLevel = nProp.getDelimiterSet().getLevelArray(lvl);
67.1332 - delimAsString = getEndDelimitersAsString(delimLevel);
67.1333 - if (delimAsString.length() == 0) {
67.1334 - delimAsString = null;
67.1335 - }
67.1336 - if (delimAsString == null && isFineInherit) {
67.1337 - // continue to search up
67.1338 - continue;
67.1339 - }
67.1340 - break;
67.1341 - } // end-- for (; i >= 0; i--)
67.1342 - return delimAsString;
67.1343 - }
67.1344 -
67.1345 - private String computeBeginDelimiters()
67.1346 - throws InvalidAppInfoException {
67.1347 - // Only delimited or array node needs to compute delimiter
67.1348 - if (!NodeProperties.NodeType.DELIMITED.equals(xgetNodeType())
67.1349 - && !NodeProperties.NodeType.ARRAY.equals(xgetNodeType())) {
67.1350 - return null;
67.1351 - }
67.1352 - String delimAsString = null;
67.1353 - DelimiterLevel delimLevel;
67.1354 - // Check to see if there are local delimiters defined. If so, they
67.1355 - // takes precedence,
67.1356 - if (mDelimiterSet != null) {
67.1357 - // So we get first delimiter level out of it.
67.1358 - int lvl = 0;
67.1359 - delimLevel = mDelimiterSet.getLevelArray(lvl);
67.1360 - // We get all end delimiters at the given delimiter level as
67.1361 - // comma separated string
67.1362 - delimAsString = getBeginDelimitersAsString(delimLevel);//CCC
67.1363 - if (delimAsString != null) {
67.1364 - return delimAsString;
67.1365 - }
67.1366 - }
67.1367 - SchemaComponent comp;
67.1368 - Annotation anno;
67.1369 - CustomEncoding customEncoding;
67.1370 - boolean isFineInherit = testIsGlobalFineInherit();
67.1371 -
67.1372 - // Starting from (mComponentPath.length - 3) and doing bottom-up
67.1373 - // traverse up the ladder, so the current element declaration can be
67.1374 - // skipped (i.e. this will skip last 2 SchemaComponent objects in the
67.1375 - // ladder array, namely, its parent "annotation" node and its
67.1376 - // grandparent localElement node.) It traverses up the ladder, until it
67.1377 - // finds an upper hierachy element or elementReference who has
67.1378 - // annotation that has custom encoding that has node properties with
67.1379 - // delimiters defined.
67.1380 - int lvl = 0;
67.1381 - int i = mComponentPath.length - 3;
67.1382 - for (; i >= 0; i--) {
67.1383 - comp = mComponentPath[i];
67.1384 - if (!(comp instanceof Element)
67.1385 - || comp instanceof ElementReference) {
67.1386 - // skip non-element or non-elementReference, and continue to
67.1387 - // search up in the XSD structure ladder
67.1388 - continue;
67.1389 - }
67.1390 - anno = ((Element) comp).getAnnotation();
67.1391 - if (anno == null) {
67.1392 - // continue to search up, and record delimiter level number
67.1393 - lvl++;
67.1394 - continue;
67.1395 - }
67.1396 - try {
67.1397 - customEncoding = fetchCustomEncoding(anno, null);
67.1398 - } catch (InvalidAppInfoException ex) {
67.1399 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.1400 - }
67.1401 - if (customEncoding == null || !customEncoding.isSetNodeProperties()) {
67.1402 - // continue to search up, and record delimiter level number
67.1403 - lvl++;
67.1404 - continue;
67.1405 - }
67.1406 - NodeProperties nProp = customEncoding.getNodeProperties();
67.1407 - if (NodeProperties.NodeType.DELIMITED.equals(nProp.getNodeType())
67.1408 - || NodeProperties.NodeType.ARRAY.equals(nProp.getNodeType())) {
67.1409 - // record delimiter level number
67.1410 - lvl++;
67.1411 - }
67.1412 - if (!nProp.isSetDelimiterSet()) {
67.1413 - // continue to search up
67.1414 - continue;
67.1415 - }
67.1416 - if (nProp.getDelimiterSet().sizeOfLevelArray() <= lvl) {
67.1417 - // no delim Level corresponding to lvl is defined
67.1418 - if (isFineInherit) {
67.1419 - // continue to search up
67.1420 - continue;
67.1421 - } else {
67.1422 - // no delimiters defined, break loop
67.1423 - break;
67.1424 - }
67.1425 - }
67.1426 - delimLevel = nProp.getDelimiterSet().getLevelArray(lvl);
67.1427 - delimAsString = getBeginDelimitersAsString(delimLevel);//CCC
67.1428 - if (delimAsString.length() == 0) {
67.1429 - delimAsString = null;
67.1430 - }
67.1431 - if (delimAsString == null && isFineInherit) {
67.1432 - // continue to search up
67.1433 - continue;
67.1434 - }
67.1435 - break;
67.1436 - } // end-- for (; i >= 0; i--)
67.1437 - return delimAsString;
67.1438 - }
67.1439 -
67.1440 - private String computeArrayDelimiters()
67.1441 - throws InvalidAppInfoException {
67.1442 - // Only delimited or array node needs to compute delimiter
67.1443 - if (!NodeProperties.NodeType.DELIMITED.equals(xgetNodeType())
67.1444 - && !NodeProperties.NodeType.ARRAY.equals(xgetNodeType())) {
67.1445 - return null;
67.1446 - }
67.1447 - String delimAsString = null;
67.1448 - DelimiterLevel delimLevel;
67.1449 - // Check to see if there are local delimiters defined. If so, they
67.1450 - // takes precedence,
67.1451 - if (mDelimiterSet != null) {
67.1452 - // So we get first delimiter level out of it.
67.1453 - int lvl = 0;
67.1454 - delimLevel = mDelimiterSet.getLevelArray(lvl);
67.1455 - // We get all end delimiters at the given delimiter level as
67.1456 - // comma separated string
67.1457 - delimAsString = getArrayDelimitersAsString(delimLevel);//CCC
67.1458 - if (delimAsString != null) {
67.1459 - return delimAsString;
67.1460 - }
67.1461 - }
67.1462 - SchemaComponent comp;
67.1463 - Annotation anno;
67.1464 - CustomEncoding customEncoding;
67.1465 - boolean isFineInherit = testIsGlobalFineInherit();
67.1466 -
67.1467 - // Starting from (mComponentPath.length - 3) and doing bottom-up
67.1468 - // traverse up the ladder, so the current element declaration can be
67.1469 - // skipped (i.e. this will skip last 2 SchemaComponent objects in the
67.1470 - // ladder array, namely, its parent "annotation" node and its
67.1471 - // grandparent localElement node.) It traverses up the ladder, until it
67.1472 - // finds an upper hierachy element or elementReference who has
67.1473 - // annotation that has custom encoding that has node properties with
67.1474 - // delimiters defined.
67.1475 - int lvl = 0;
67.1476 - int i = mComponentPath.length - 3;
67.1477 - for (; i >= 0; i--) {
67.1478 - comp = mComponentPath[i];
67.1479 - if (!(comp instanceof Element)
67.1480 - || comp instanceof ElementReference) {
67.1481 - // skip non-element or non-elementReference, and continue to
67.1482 - // search up in the XSD structure ladder
67.1483 - continue;
67.1484 - }
67.1485 - anno = ((Element) comp).getAnnotation();
67.1486 - if (anno == null) {
67.1487 - // continue to search up, and record delimiter level number
67.1488 - lvl++;
67.1489 - continue;
67.1490 - }
67.1491 - try {
67.1492 - customEncoding = fetchCustomEncoding(anno, null);
67.1493 - } catch (InvalidAppInfoException ex) {
67.1494 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
67.1495 - }
67.1496 - if (customEncoding == null || !customEncoding.isSetNodeProperties()) {
67.1497 - // continue to search up, and record delimiter level number
67.1498 - lvl++;
67.1499 - continue;
67.1500 - }
67.1501 - NodeProperties nProp = customEncoding.getNodeProperties();
67.1502 - if (NodeProperties.NodeType.DELIMITED.equals(nProp.getNodeType())
67.1503 - || NodeProperties.NodeType.ARRAY.equals(nProp.getNodeType())) {
67.1504 - // record delimiter level number
67.1505 - lvl++;
67.1506 - }
67.1507 - if (!nProp.isSetDelimiterSet()) {
67.1508 - // continue to search up
67.1509 - continue;
67.1510 - }
67.1511 - if (nProp.getDelimiterSet().sizeOfLevelArray() <= lvl) {
67.1512 - // no delim Level corresponding to lvl is defined
67.1513 - if (isFineInherit) {
67.1514 - // continue to search up
67.1515 - continue;
67.1516 - } else {
67.1517 - // no delimiters defined, break loop
67.1518 - break;
67.1519 - }
67.1520 - }
67.1521 - delimLevel = nProp.getDelimiterSet().getLevelArray(lvl);
67.1522 - delimAsString = getArrayDelimitersAsString(delimLevel);//CCC
67.1523 - if (delimAsString.length() == 0) {
67.1524 - delimAsString = null;
67.1525 - }
67.1526 - if (delimAsString == null && isFineInherit) {
67.1527 - // continue to search up
67.1528 - continue;
67.1529 - }
67.1530 - break;
67.1531 - } // end-- for (; i >= 0; i--)
67.1532 - return delimAsString;
67.1533 - }
67.1534 -
67.1535 - private Annotation annotation() {
67.1536 - // annotation is stored as last element
67.1537 - return (Annotation) mComponentPath[mComponentPath.length - 1];
67.1538 - }
67.1539 -
67.1540 - private String elementName() {
67.1541 - Element elem = (Element) annotation().getParent();
67.1542 - if (elem instanceof GlobalElement) {
67.1543 - return ((GlobalElement) elem).getName();
67.1544 - } else if (elem instanceof LocalElement) {
67.1545 - return ((LocalElement) elem).getName();
67.1546 - } else if (elem instanceof ElementReference) {
67.1547 - GlobalElement ref = ((ElementReference) elem).getRef().get();
67.1548 - return ref.getName();
67.1549 - }
67.1550 - return null;
67.1551 - }
67.1552 -
67.1553 - /**
67.1554 - * Initialize this EncodingOption object.
67.1555 - *
67.1556 - * @param hookUpListener whether or not to hookup listener.
67.1557 - * @return true if initialization was successful, false if no custom
67.1558 - * encoding info was found.
67.1559 - * @throws org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException
67.1560 - */
67.1561 - private boolean init(boolean hookUpListener)
67.1562 - throws InvalidAppInfoException {
67.1563 - SchemaComponent comp = mComponentPath[mComponentPath.length - 1];
67.1564 - if (!(comp instanceof Annotation)) {
67.1565 - throw new IllegalArgumentException(
67.1566 - _bundle.getString("encoding_opt.exp.must_be_annotation")); //NOI18N
67.1567 - }
67.1568 - CustomEncoding customEnc = null;
67.1569 - AppInfo[] appinfoReturned = new AppInfo[1];
67.1570 - customEnc = fetchCustomEncoding((Annotation) comp, appinfoReturned);
67.1571 - if (customEnc == null || !customEnc.isSetNodeProperties()) {
67.1572 - if (appinfoReturned[0] == null) {
67.1573 - return false;
67.1574 - }
67.1575 - mAppInfo = appinfoReturned[0];
67.1576 - boolean top = false;
67.1577 - if (customEnc != null && customEnc.isSetTop()
67.1578 - && customEnc.getTop()) {
67.1579 - top = true;
67.1580 - }
67.1581 - customEnc = (CustomEncoding) mDefaultCustomEncoding.copy();
67.1582 - if (top) {
67.1583 - customEnc.setTop(true);
67.1584 - }
67.1585 - } else {
67.1586 - mAppInfo = appinfoReturned[0];
67.1587 - }
67.1588 - NodeProperties nProp = customEnc.getNodeProperties();
67.1589 - mNodeType = mTextMap.get(NODE_TYPE_PREFIX + UDS
67.1590 - + nProp.getNodeType().toString());
67.1591 - if (nProp.isSetAlignment()) {
67.1592 - mAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS
67.1593 - + nProp.getAlignment().toString());
67.1594 - }
67.1595 - if (nProp.isSetOrder()) {
67.1596 - mOrder = mTextMap.get(ORDER_PREFIX + UDS
67.1597 - + nProp.getOrder().toString());
67.1598 - }
67.1599 - if (nProp.isSetNOfN()) {
67.1600 - NOfN nOfN = nProp.getNOfN();
67.1601 - if (nOfN.isSetMinN()) {
67.1602 - mNOfNminN = Integer.toString(nOfN.getMinN());
67.1603 - }
67.1604 - if (nOfN.isSetMaxN()) {
67.1605 - mNOfNmaxN = Integer.toString(nOfN.getMaxN());
67.1606 - }
67.1607 - }
67.1608 - if (nProp.isSetMinOcc()) {
67.1609 - mMinOcc = Long.toString(nProp.getMinOcc());
67.1610 - }
67.1611 - if (nProp.isSetMaxOcc()) {
67.1612 - mMaxOcc = Long.toString(nProp.getMaxOcc());
67.1613 - }
67.1614 - if (nProp.isSetScvngr()) {
67.1615 - Scvngr scvngr = nProp.getScvngr();
67.1616 - mScvngrChars = scvngr.getChars();
67.1617 - if (scvngr.isSetEmit1St()) {
67.1618 - mScvngrEmit1st = scvngr.getEmit1St();
67.1619 - }
67.1620 - }
67.1621 -
67.1622 - if (customEnc.isSetTop()) {
67.1623 - mTop = customEnc.getTop();
67.1624 - }
67.1625 - if (mTop) {
67.1626 - if (nProp.isSetInputCharset()) {
67.1627 - mInputCharset = nProp.getInputCharset();
67.1628 - }
67.1629 - if (nProp.isSetOutputCharset()) {
67.1630 - mOutputCharset = nProp.getOutputCharset();
67.1631 - }
67.1632 - }
67.1633 - if (mTop || nProp.getNodeType().intValue()
67.1634 - == NodeProperties.NodeType.INT_FIXED_LENGTH) {
67.1635 - if (nProp.isSetParsingCharset()) {
67.1636 - mParsingCharset = nProp.getParsingCharset();
67.1637 - }
67.1638 - if (nProp.isSetSerializingCharset()) {
67.1639 - mSerializingCharset = nProp.getSerializingCharset();
67.1640 - }
67.1641 - }
67.1642 - if (nProp.isSetMatch()) {
67.1643 - mMatch = nProp.getMatch();
67.1644 - }
67.1645 - //Populates the NoMatch field
67.1646 - if (nProp.isSetNoMatch()) {
67.1647 - mNoMatch = nProp.getNoMatch();
67.1648 - }
67.1649 - if (nProp.isSetLength()) {
67.1650 - mLength = nProp.getLength();
67.1651 - }
67.1652 - if (nProp.isSetOffset()) {
67.1653 - mOffset = Long.toString(nProp.getOffset());
67.1654 - }
67.1655 - if (nProp.isSetPosition()) {
67.1656 - mPosition = Long.toString(nProp.getPosition());
67.1657 - }
67.1658 - if (nProp.isSetLength()) {
67.1659 - mLength = nProp.getLength();
67.1660 - }
67.1661 - if (nProp.isSetLength() && mLength == 0) {
67.1662 - mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS
67.1663 - + "undetermined"); //NOI18N
67.1664 - } else if (nProp.isSetPosition()) { // && mPosition >= 0
67.1665 - mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS
67.1666 - + "encoded"); //NOI18N
67.1667 - } else if (nProp.isSetLength() && mLength < 0) {
67.1668 - mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS
67.1669 - + "reversed"); //NOI18N
67.1670 - mLength = mLength * (-1);
67.1671 - }
67.1672 -
67.1673 - if (nProp.isSetDelimOfFixed()) {
67.1674 - DelimOfFixed delimOfFixed = nProp.getDelimOfFixed();
67.1675 - mBeginDelimiter = delimOfFixed.getBeginBytes();
67.1676 - if (delimOfFixed.isSetBeginAnch()) {
67.1677 - mBeginDelimiterDetached = !delimOfFixed.getBeginAnch();
67.1678 - }
67.1679 - }
67.1680 - if (nProp.isSetDelimiterSet()) {
67.1681 - mDelimiterSet = nProp.getDelimiterSet();
67.1682 - }
67.1683 - mCustomEncoding = customEnc;
67.1684 - //Populates the Escape Sequence field
67.1685 - if (nProp.isSetEscapeSequence()) {
67.1686 - mEscapeSequence = nProp.getEscapeSequence();
67.1687 - }
67.1688 - //Populates the FineInherit field
67.1689 - if (nProp.isSetFineInherit()) {
67.1690 - mFineInherit = nProp.getFineInherit();
67.1691 - }
67.1692 - //Populates the UndefDataPolicy field
67.1693 - if (nProp.isSetUndefDataPolicy()) {
67.1694 - mUndefDataPolicy = mTextMap.get(UNDEFINED_DATA_POLICY_PREFIX + UDS
67.1695 - + nProp.getUndefDataPolicy().toString());
67.1696 - }
67.1697 -
67.1698 - // I guess that following lines will cause recursive loop when
67.1699 - // the AppInfo is removed from the text editing pane.
67.1700 - //if (mAppInfo == null) {
67.1701 - // commitToAppInfo();
67.1702 - //}
67.1703 -
67.1704 - if (!(((Annotation) comp).getParent() instanceof Element)) {
67.1705 - throw new IllegalArgumentException(
67.1706 - _bundle.getString("encoding_opt.exp.anno_must_under_elem")); //NOI18N
67.1707 - }
67.1708 - if (hookUpListener) {
67.1709 - Element elem = (Element) ((Annotation) comp).getParent();
67.1710 - Object xmlType = SchemaUtility.getXMLType(elem);
67.1711 - SchemaModel refModel = null;
67.1712 - if ((xmlType instanceof SimpleType)
67.1713 - || (xmlType instanceof ComplexType)) {
67.1714 - refModel = ((SchemaComponent) xmlType).getModel();
67.1715 - }
67.1716 - mSchemaPropChangeListener =
67.1717 - new SchemaPropertyChangeListener(elem, xmlType);
67.1718 - elem.getModel().addPropertyChangeListener(
67.1719 - WeakListeners.propertyChange(
67.1720 - mSchemaPropChangeListener, elem.getModel()));
67.1721 - if (refModel != null && elem.getModel() != refModel) {
67.1722 - refModel.addPropertyChangeListener(
67.1723 - WeakListeners.propertyChange(
67.1724 - mSchemaPropChangeListener, refModel));
67.1725 - }
67.1726 - }
67.1727 - return true;
67.1728 - }
67.1729 -
67.1730 - /**
67.1731 - * Gets the Custom Encoding information from the given schema Annotation.
67.1732 - * If the appinfoReturned is not null, then it will be populated with
67.1733 - * schema AppInfo objects.
67.1734 - *
67.1735 - * @param anno the schema Annotation object.
67.1736 - * @param appinfosReturned if not null, will be populated with schema
67.1737 - * AppInfo objects.
67.1738 - * @return CustomEncoding info.
67.1739 - * @throws org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException
67.1740 - */
67.1741 - private CustomEncoding fetchCustomEncoding(Annotation anno,
67.1742 - AppInfo[] appinfosReturned)
67.1743 - throws InvalidAppInfoException {
67.1744 - CustomEncoding customEncoding = null;
67.1745 - Collection<AppInfo> appinfos = anno.getAppInfos();
67.1746 - if (appinfos != null) {
67.1747 - for (AppInfo appinfo : appinfos) {
67.1748 - // ensure the appinfo's uri is expected as "urn:com.sun:encoder"
67.1749 - if (!EncodingConst.URI.equals(appinfo.getURI())) {
67.1750 - continue;
67.1751 - }
67.1752 - if (appinfosReturned != null) {
67.1753 - appinfosReturned[0] = appinfo;
67.1754 - }
67.1755 - try {
67.1756 - XmlOptions xmlOptions = new XmlOptions();
67.1757 - // set this option so that the document element is replaced
67.1758 - // with the given QName (null) when parsing.
67.1759 - xmlOptions.setLoadReplaceDocumentElement(null);
67.1760 - customEncoding = CustomEncoding.Factory.parse(
67.1761 - new StringReader(xmlFragFromAppInfo(appinfo)),
67.1762 - xmlOptions);
67.1763 - xmlOptions = new XmlOptions();
67.1764 - List errorList = new ArrayList();
67.1765 - // errorList will contain all the errors after the validate
67.1766 - // operation takes place.
67.1767 - xmlOptions.setErrorListener(errorList);
67.1768 - if (!customEncoding.validate(xmlOptions)) {
67.1769 - throw new XmlException(errorList.toString());
67.1770 - }
67.1771 - } catch (XmlException ex) {
67.1772 - throw new InvalidAppInfoException(
67.1773 - NbBundle.getMessage(
67.1774 - EncodingOption.class,
67.1775 - "encoding_opt.exp.invalid_appinfo", //NOI18N
67.1776 - SchemaUtility.getNCNamePath(mComponentPath),
67.1777 - ex.getMessage()),
67.1778 - ex);
67.1779 - } catch (IOException ex) {
67.1780 - throw new InvalidAppInfoException(
67.1781 - NbBundle.getMessage(
67.1782 - EncodingOption.class,
67.1783 - "encoding_opt.exp.io_exception", //NOI18N
67.1784 - SchemaUtility.getNCNamePath(mComponentPath),
67.1785 - ex.getMessage()),
67.1786 - ex);
67.1787 - }
67.1788 - break;
67.1789 - }
67.1790 - }
67.1791 - return customEncoding;
67.1792 - }
67.1793 -
67.1794 - private synchronized void commitToAppInfo() {
67.1795 - boolean startedTrans = false;
67.1796 - SchemaModel model = null;
67.1797 - if (mAppInfo == null) {
67.1798 - Annotation anno = annotation();
67.1799 - model = anno.getModel();
67.1800 - if (!model.isIntransaction()) {
67.1801 - if (!model.startTransaction()) {
67.1802 - // happens if failed to acquire transaction, for e.g.
67.1803 - // when model has transitioned into invalid state.
67.1804 - //TODO how to handle???
67.1805 - }
67.1806 - startedTrans = true;
67.1807 - }
67.1808 - // create a new AppInfo object
67.1809 - mAppInfo = anno.getModel().getFactory().createAppInfo();
67.1810 - anno.addAppInfo(mAppInfo);
67.1811 - mAppInfo.setURI(EncodingConst.URI);
67.1812 - } else {
67.1813 - model = mAppInfo.getModel();
67.1814 - if (!model.isIntransaction()) {
67.1815 - if (!model.startTransaction()) {
67.1816 - // happens if failed to acquire transaction, for e.g.
67.1817 - // when model has transitioned into invalid state.
67.1818 - //TODO how to handle???
67.1819 - }
67.1820 - startedTrans = true;
67.1821 - }
67.1822 - }
67.1823 - try {
67.1824 - String contentFrag = contentFragFromXmlObject(mCustomEncoding);
67.1825 - mAppInfo.setContentFragment(contentFrag);
67.1826 - } catch (IOException ex) {
67.1827 - //TODO how to handle???
67.1828 - } finally {
67.1829 - if (startedTrans) {
67.1830 - model.endTransaction();
67.1831 - }
67.1832 - }
67.1833 - }
67.1834 -
67.1835 - private void firePropertyChange(String name, Object oldObj, Object newObj) {
67.1836 - PropertyChangeListener[] pcls = (PropertyChangeListener[])
67.1837 - propChangeListeners.toArray(new PropertyChangeListener[0]);
67.1838 - for (int i = 0; i < pcls.length; i++) {
67.1839 - pcls[i].propertyChange(
67.1840 - new PropertyChangeEvent (this, name, oldObj, newObj));
67.1841 - }
67.1842 - }
67.1843 -
67.1844 - private String xmlFragFromAppInfo(AppInfo appInfo) {
67.1845 - StringBuffer sb = new StringBuffer("<xml-fragment "); //NOI18N
67.1846 - sb.append("source=\"").append(EncodingConst.URI).append("\""); //NOI18N
67.1847 - if (appInfo.getPeer() != null) {
67.1848 - String prefix = appInfo.getPeer().lookupPrefix(EncodingConst.URI);
67.1849 - if (prefix != null) {
67.1850 - sb.append(" xmlns"); //NOI18N
67.1851 - if (prefix.length() > 0) {
67.1852 - sb.append(":").append(prefix); //NOI18N
67.1853 - }
67.1854 - sb.append("=\"").append(EncodingConst.URI).append("\""); //NOI18N
67.1855 - }
67.1856 - prefix = appInfo.getPeer().lookupPrefix(CustomEncodingConst.URI);
67.1857 - if (prefix != null) {
67.1858 - sb.append(" xmlns"); //NOI18N
67.1859 - if (prefix.length() > 0) {
67.1860 - sb.append(":").append(prefix); //NOI18N
67.1861 - }
67.1862 - sb.append("=\"").append(CustomEncodingConst.URI).append("\""); //NOI18N
67.1863 - }
67.1864 - }
67.1865 - sb.append(">"); //NOI18N
67.1866 - sb.append(appInfo.getContentFragment());
67.1867 - sb.append("</xml-fragment>"); //NOI18N
67.1868 - return sb.toString();
67.1869 - }
67.1870 -
67.1871 - private String contentFragFromXmlObject(XmlObject xmlObject) {
67.1872 - XmlCursor cursor = null;
67.1873 - try {
67.1874 - cursor = xmlObject.newCursor();
67.1875 - StringBuffer buff = new StringBuffer();
67.1876 - if (!cursor.toFirstChild()) {
67.1877 - return EMP;
67.1878 - }
67.1879 - buff.append(cursor.xmlText());
67.1880 - while (cursor.toNextSibling()) {
67.1881 - buff.append(cursor.xmlText());
67.1882 - }
67.1883 - return buff.toString();
67.1884 - } finally {
67.1885 - if (cursor != null) {
67.1886 - cursor.dispose();
67.1887 - }
67.1888 - }
67.1889 - }
67.1890 -
67.1891 - private class SchemaPropertyChangeListener
67.1892 - implements PropertyChangeListener {
67.1893 -
67.1894 - private final Element mElem;
67.1895 - private final Set<SchemaModel> mModelSet = new HashSet<SchemaModel>();
67.1896 - private Object mXMLType;
67.1897 -
67.1898 - SchemaPropertyChangeListener(Element elem, Object xmlType) {
67.1899 - mElem = elem;
67.1900 - mXMLType = xmlType;
67.1901 - if (xmlType instanceof SchemaComponent) {
67.1902 - SchemaModel refModel = ((SchemaComponent) xmlType).getModel();
67.1903 - if (elem.getModel() != refModel) {
67.1904 - mModelSet.add(refModel);
67.1905 - }
67.1906 - }
67.1907 - }
67.1908 -
67.1909 - public void propertyChange(PropertyChangeEvent evt) {
67.1910 - if (mElem == evt.getSource()
67.1911 - && "type".equals(evt.getPropertyName())) { //NOI18N
67.1912 - mXMLType = evt.getNewValue();
67.1913 - if (mXMLType instanceof SchemaComponent) {
67.1914 - SchemaModel refModel = ((SchemaComponent) mXMLType).getModel();
67.1915 - if (mElem.getModel() != refModel
67.1916 - && !mModelSet.contains(refModel)) {
67.1917 - refModel.addPropertyChangeListener(
67.1918 - WeakListeners.propertyChange(
67.1919 - mSchemaPropChangeListener, refModel));
67.1920 - mModelSet.add(refModel);
67.1921 - }
67.1922 - }
67.1923 - firePropertyChange("xmlType", evt.getOldValue(), evt.getNewValue()); //NOI18N
67.1924 - return;
67.1925 - }
67.1926 - if (mXMLType != null && mXMLType == evt.getSource()
67.1927 - && "definition".equals(evt.getPropertyName())) { //NOI18N
67.1928 - firePropertyChange("typeDef", evt.getOldValue(), evt.getNewValue()); //NOI18N
67.1929 - return;
67.1930 - }
67.1931 - }
67.1932 - }
67.1933 -}
68.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/FixedLengthTypePropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
68.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
68.3 @@ -1,60 +0,0 @@
68.4 -/*
68.5 - * The contents of this file are subject to the terms of the Common Development
68.6 - * and Distribution License (the License). You may not use this file except in
68.7 - * compliance with the License.
68.8 - *
68.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
68.10 - * or http://www.netbeans.org/cddl.txt.
68.11 -
68.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
68.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
68.14 - * If applicable, add the following below the CDDL Header, with the fields
68.15 - * enclosed by brackets [] replaced by your own identifying information:
68.16 - * "Portions Copyrighted [year] [name of copyright owner]"
68.17 - *
68.18 - * The Original Software is NetBeans. The Initial Developer of the Original
68.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
68.20 - * Microsystems, Inc. All Rights Reserved.
68.21 - */
68.22 -
68.23 -package org.netbeans.modules.encoder.custom.aip;
68.24 -
68.25 -import java.beans.PropertyEditorSupport;
68.26 -
68.27 -/**
68.28 - * The property editor for the node type property.
68.29 - *
68.30 - * @author sun
68.31 - */
68.32 -public class FixedLengthTypePropertyEditor extends PropertyEditorSupport {
68.33 -
68.34 - /**
68.35 - * Creates a new instance of FixedLengthTypePropertyEditor
68.36 - */
68.37 - public FixedLengthTypePropertyEditor() {
68.38 - }
68.39 -
68.40 - @Override
68.41 - public String[] getTags() {
68.42 - return EncodingOption.fixedLengthTypeTagList().toArray(new String[0]);
68.43 - }
68.44 -
68.45 - @Override
68.46 - public String getAsText() {
68.47 - return (String) getValue();
68.48 - }
68.49 -
68.50 - @Override
68.51 - public void setAsText(String text) throws IllegalArgumentException {
68.52 - setValue(text);
68.53 - }
68.54 -
68.55 - @Override
68.56 - public String getJavaInitializationString() {
68.57 - String value = (String) getValue();
68.58 - if (value == null) {
68.59 - return "null"; //NOI18N
68.60 - }
68.61 - return "\"" + value + "\""; //NOI18N
68.62 - }
68.63 -}
69.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/IntegerInplaceEditor.java Sat Sep 27 15:34:52 2008 -0700
69.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
69.3 @@ -1,77 +0,0 @@
69.4 -/*
69.5 - * The contents of this file are subject to the terms of the Common Development
69.6 - * and Distribution License (the License). You may not use this file except in
69.7 - * compliance with the License.
69.8 - *
69.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
69.10 - * or http://www.netbeans.org/cddl.txt.
69.11 -
69.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
69.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
69.14 - * If applicable, add the following below the CDDL Header, with the fields
69.15 - * enclosed by brackets [] replaced by your own identifying information:
69.16 - * "Portions Copyrighted [year] [name of copyright owner]"
69.17 - *
69.18 - * The Original Software is NetBeans. The Initial Developer of the Original
69.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
69.20 - * Microsystems, Inc. All Rights Reserved.
69.21 - */
69.22 -
69.23 -package org.netbeans.modules.encoder.custom.aip;
69.24 -
69.25 -import java.math.BigInteger;
69.26 -import org.openide.explorer.propertysheet.InplaceEditor;
69.27 -
69.28 -/**
69.29 - * An InplaceEditor implementation for editing int values. The reason for
69.30 - * creating this implementation instead of using the default is that the
69.31 - * default one causes the container window to be closed everytime the value
69.32 - * is accepted.
69.33 - *
69.34 - * @author Jun Xu
69.35 - */
69.36 -public class IntegerInplaceEditor extends StringInplaceEditor implements InplaceEditor {
69.37 -
69.38 - private final BigInteger mMinInclusive;
69.39 - private final BigInteger mMaxInclusive;
69.40 -
69.41 - /** Creates a new instance of IntegerInplaceEditor */
69.42 - public IntegerInplaceEditor() {
69.43 - super();
69.44 - mMinInclusive = new BigInteger(new Integer(Integer.MIN_VALUE).toString());
69.45 - mMaxInclusive = new BigInteger(new Integer(Integer.MAX_VALUE).toString());
69.46 - }
69.47 -
69.48 - public IntegerInplaceEditor(int minInclusive, int maxInclusive) {
69.49 - super();
69.50 - mMinInclusive = new BigInteger(new Integer(minInclusive).toString());
69.51 - mMaxInclusive = new BigInteger(new Integer(maxInclusive).toString());
69.52 - }
69.53 -
69.54 - @Override
69.55 - public Object getValue() {
69.56 - int value;
69.57 - try {
69.58 - BigInteger rawValue = new BigInteger(mJTextField.getText());
69.59 - value = keepValueInRange(rawValue);
69.60 - } catch (NumberFormatException e) {
69.61 - if (mPropertyEditor != null) {
69.62 - setValue(mPropertyEditor.getValue());
69.63 - return mPropertyEditor.getValue();
69.64 - }
69.65 - value = keepValueInRange(BigInteger.ZERO);
69.66 - setValue(value);
69.67 - }
69.68 - return value;
69.69 - }
69.70 -
69.71 - private int keepValueInRange(BigInteger value) {
69.72 - if (value.compareTo(mMinInclusive) < 0) {
69.73 - return mMinInclusive.intValue();
69.74 - }
69.75 - if (value.compareTo(mMaxInclusive) > 0) {
69.76 - return mMaxInclusive.intValue();
69.77 - }
69.78 - return value.intValue();
69.79 - }
69.80 -}
70.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/LongInplaceEditor.java Sat Sep 27 15:34:52 2008 -0700
70.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
70.3 @@ -1,84 +0,0 @@
70.4 -/*
70.5 - * The contents of this file are subject to the terms of the Common Development
70.6 - * and Distribution License (the License). You may not use this file except in
70.7 - * compliance with the License.
70.8 - *
70.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
70.10 - * or http://www.netbeans.org/cddl.txt.
70.11 -
70.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
70.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
70.14 - * If applicable, add the following below the CDDL Header, with the fields
70.15 - * enclosed by brackets [] replaced by your own identifying information:
70.16 - * "Portions Copyrighted [year] [name of copyright owner]"
70.17 - *
70.18 - * The Original Software is NetBeans. The Initial Developer of the Original
70.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
70.20 - * Microsystems, Inc. All Rights Reserved.
70.21 - */
70.22 -
70.23 -package org.netbeans.modules.encoder.custom.aip;
70.24 -
70.25 -import org.openide.explorer.propertysheet.InplaceEditor;
70.26 -
70.27 -/**
70.28 - * An InplaceEditor implementation for editing int values. The reason for
70.29 - * creating this implementation instead of using the default is that the
70.30 - * default one causes the container window to be closed everytime the value
70.31 - * is accepted.
70.32 - *
70.33 - * @author Sun
70.34 - */
70.35 -public class LongInplaceEditor extends StringInplaceEditor implements InplaceEditor {
70.36 -
70.37 - private final Long mMinInclusive;
70.38 - private final Long mMaxInclusive;
70.39 -
70.40 - /**
70.41 - * Creates a new instance of LongInplaceEditor using default bounds of
70.42 - * Long.MIN_VALUE and Long.MAX_VALUE.
70.43 - */
70.44 - public LongInplaceEditor() {
70.45 - super();
70.46 - mMinInclusive = new Long(Long.MIN_VALUE);
70.47 - mMaxInclusive = new Long(Long.MAX_VALUE);
70.48 - }
70.49 -
70.50 - /**
70.51 - * Creates a new instance of LongInplaceEditor using bounds specified.
70.52 - * @param minInclusive - the lower bound.
70.53 - * @param maxInclusive - the upper bound.
70.54 - */
70.55 - public LongInplaceEditor(long minInclusive, long maxInclusive) {
70.56 - super();
70.57 - mMinInclusive = new Long(minInclusive);
70.58 - mMaxInclusive = new Long(maxInclusive);
70.59 - }
70.60 -
70.61 - @Override
70.62 - public Object getValue() {
70.63 - long value;
70.64 - try {
70.65 - Long rawValue = new Long(mJTextField.getText());
70.66 - value = keepValueInRange(rawValue);
70.67 - } catch (NumberFormatException e) {
70.68 - if (mPropertyEditor != null) {
70.69 - setValue(mPropertyEditor.getValue());
70.70 - return mPropertyEditor.getValue();
70.71 - }
70.72 - value = keepValueInRange(0L);
70.73 - setValue(value);
70.74 - }
70.75 - return value;
70.76 - }
70.77 -
70.78 - private long keepValueInRange(Long value) {
70.79 - if (value.compareTo(mMinInclusive) < 0) {
70.80 - return mMinInclusive.longValue();
70.81 - }
70.82 - if (value.compareTo(mMaxInclusive) > 0) {
70.83 - return mMaxInclusive.longValue();
70.84 - }
70.85 - return value.longValue();
70.86 - }
70.87 -}
71.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/NodeTypePropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
71.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
71.3 @@ -1,58 +0,0 @@
71.4 -/*
71.5 - * The contents of this file are subject to the terms of the Common Development
71.6 - * and Distribution License (the License). You may not use this file except in
71.7 - * compliance with the License.
71.8 - *
71.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
71.10 - * or http://www.netbeans.org/cddl.txt.
71.11 -
71.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
71.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
71.14 - * If applicable, add the following below the CDDL Header, with the fields
71.15 - * enclosed by brackets [] replaced by your own identifying information:
71.16 - * "Portions Copyrighted [year] [name of copyright owner]"
71.17 - *
71.18 - * The Original Software is NetBeans. The Initial Developer of the Original
71.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
71.20 - * Microsystems, Inc. All Rights Reserved.
71.21 - */
71.22 -
71.23 -package org.netbeans.modules.encoder.custom.aip;
71.24 -
71.25 -import java.beans.PropertyEditorSupport;
71.26 -
71.27 -/**
71.28 - * The property editor for the node type property.
71.29 - *
71.30 - * @author Jun Xu
71.31 - */
71.32 -public class NodeTypePropertyEditor extends PropertyEditorSupport {
71.33 -
71.34 - /** Creates a new instance of NodeTypePropertyEditor */
71.35 - public NodeTypePropertyEditor() {
71.36 - }
71.37 -
71.38 - @Override
71.39 - public String[] getTags() {
71.40 - return EncodingOption.nodeTypeTagList().toArray(new String[0]);
71.41 - }
71.42 -
71.43 - @Override
71.44 - public String getAsText() {
71.45 - return (String) getValue();
71.46 - }
71.47 -
71.48 - @Override
71.49 - public void setAsText(String text) throws IllegalArgumentException {
71.50 - setValue(text);
71.51 - }
71.52 -
71.53 - @Override
71.54 - public String getJavaInitializationString() {
71.55 - String value = (String) getValue();
71.56 - if (value == null) {
71.57 - return "null"; //NOI18N
71.58 - }
71.59 - return "\"" + value + "\""; //NOI18N
71.60 - }
71.61 -}
72.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/OrderPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
72.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
72.3 @@ -1,58 +0,0 @@
72.4 -/*
72.5 - * The contents of this file are subject to the terms of the Common Development
72.6 - * and Distribution License (the License). You may not use this file except in
72.7 - * compliance with the License.
72.8 - *
72.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
72.10 - * or http://www.netbeans.org/cddl.txt.
72.11 -
72.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
72.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
72.14 - * If applicable, add the following below the CDDL Header, with the fields
72.15 - * enclosed by brackets [] replaced by your own identifying information:
72.16 - * "Portions Copyrighted [year] [name of copyright owner]"
72.17 - *
72.18 - * The Original Software is NetBeans. The Initial Developer of the Original
72.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
72.20 - * Microsystems, Inc. All Rights Reserved.
72.21 - */
72.22 -
72.23 -package org.netbeans.modules.encoder.custom.aip;
72.24 -
72.25 -import java.beans.PropertyEditorSupport;
72.26 -
72.27 -/**
72.28 - * The property editor for the node order property.
72.29 - *
72.30 - * @author Jun Xu
72.31 - */
72.32 -public class OrderPropertyEditor extends PropertyEditorSupport {
72.33 -
72.34 - /** Creates a new instance of OrderPropertyEditor */
72.35 - public OrderPropertyEditor() {
72.36 - }
72.37 -
72.38 - @Override
72.39 - public String[] getTags() {
72.40 - return EncodingOption.orderTagList().toArray(new String[0]);
72.41 - }
72.42 -
72.43 - @Override
72.44 - public String getAsText() {
72.45 - return (String) getValue();
72.46 - }
72.47 -
72.48 - @Override
72.49 - public void setAsText(String text) throws IllegalArgumentException {
72.50 - setValue(text);
72.51 - }
72.52 -
72.53 - @Override
72.54 - public String getJavaInitializationString() {
72.55 - String value = (String) getValue();
72.56 - if (value == null) {
72.57 - return "null"; //NOI18N
72.58 - }
72.59 - return "\"" + value + "\""; //NOI18N
72.60 - }
72.61 -}
73.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/ReadOnlyArrayDelimiterProperty.java Sat Sep 27 15:34:52 2008 -0700
73.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
73.3 @@ -1,53 +0,0 @@
73.4 -/*
73.5 - * The contents of this file are subject to the terms of the Common Development
73.6 - * and Distribution License (the License). You may not use this file except in
73.7 - * compliance with the License.
73.8 - *
73.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
73.10 - * or http://www.netbeans.org/cddl.txt.
73.11 -
73.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
73.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
73.14 - * If applicable, add the following below the CDDL Header, with the fields
73.15 - * enclosed by brackets [] replaced by your own identifying information:
73.16 - * "Portions Copyrighted [year] [name of copyright owner]"
73.17 - *
73.18 - * The Original Software is NetBeans. The Initial Developer of the Original
73.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
73.20 - * Microsystems, Inc. All Rights Reserved.
73.21 - */
73.22 -
73.23 -package org.netbeans.modules.encoder.custom.aip;
73.24 -
73.25 -import java.lang.reflect.InvocationTargetException;
73.26 -import org.openide.nodes.PropertySupport;
73.27 -
73.28 -/**
73.29 - *
73.30 - * @author jxu
73.31 - */
73.32 -public class ReadOnlyArrayDelimiterProperty<T>
73.33 - extends PropertySupport.Reflection<T> {
73.34 -
73.35 - private EncodingOption mEncodingOption;
73.36 -
73.37 - /**
73.38 - * Creates a new instance of ReadOnlyDelimiterProperty
73.39 - * @param encodingOption (Bean) object to work on
73.40 - * @param clazz type of the property
73.41 - * @param getterName name of getter method
73.42 - * @throws NoSuchMethodException if the getter method cannot be found
73.43 - */
73.44 - public ReadOnlyArrayDelimiterProperty(EncodingOption encodingOption, Class clazz,
73.45 - String getterName) throws NoSuchMethodException {
73.46 - // setterName = null so as to read only
73.47 - super(encodingOption, clazz, getterName, null);
73.48 - mEncodingOption= encodingOption;
73.49 - }
73.50 -
73.51 - @Override
73.52 - public T getValue() throws IllegalAccessException, IllegalArgumentException,
73.53 - InvocationTargetException {
73.54 - return (T) mEncodingOption.getArrayDelimitersAsString();
73.55 - }
73.56 -}
74.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/ReadOnlyBeginDelimiterProperty.java Sat Sep 27 15:34:52 2008 -0700
74.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
74.3 @@ -1,53 +0,0 @@
74.4 -/*
74.5 - * The contents of this file are subject to the terms of the Common Development
74.6 - * and Distribution License (the License). You may not use this file except in
74.7 - * compliance with the License.
74.8 - *
74.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
74.10 - * or http://www.netbeans.org/cddl.txt.
74.11 -
74.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
74.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
74.14 - * If applicable, add the following below the CDDL Header, with the fields
74.15 - * enclosed by brackets [] replaced by your own identifying information:
74.16 - * "Portions Copyrighted [year] [name of copyright owner]"
74.17 - *
74.18 - * The Original Software is NetBeans. The Initial Developer of the Original
74.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
74.20 - * Microsystems, Inc. All Rights Reserved.
74.21 - */
74.22 -
74.23 -package org.netbeans.modules.encoder.custom.aip;
74.24 -
74.25 -import java.lang.reflect.InvocationTargetException;
74.26 -import org.openide.nodes.PropertySupport;
74.27 -
74.28 -/**
74.29 - *
74.30 - * @author jxu
74.31 - */
74.32 -public class ReadOnlyBeginDelimiterProperty<T>
74.33 - extends PropertySupport.Reflection<T> {
74.34 -
74.35 - private EncodingOption mEncodingOption;
74.36 -
74.37 - /**
74.38 - * Creates a new instance of ReadOnlyDelimiterProperty
74.39 - * @param encodingOption (Bean) object to work on
74.40 - * @param clazz type of the property
74.41 - * @param getterName name of getter method
74.42 - * @throws NoSuchMethodException if the getter method cannot be found
74.43 - */
74.44 - public ReadOnlyBeginDelimiterProperty(EncodingOption encodingOption, Class clazz,
74.45 - String getterName) throws NoSuchMethodException {
74.46 - // setterName = null so as to read only
74.47 - super(encodingOption, clazz, getterName, null);
74.48 - mEncodingOption= encodingOption;
74.49 - }
74.50 -
74.51 - @Override
74.52 - public T getValue() throws IllegalAccessException, IllegalArgumentException,
74.53 - InvocationTargetException {
74.54 - return (T) mEncodingOption.getBeginDelimitersAsString();
74.55 - }
74.56 -}
75.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/ReadOnlyDelimiterProperty.java Sat Sep 27 15:34:52 2008 -0700
75.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
75.3 @@ -1,53 +0,0 @@
75.4 -/*
75.5 - * The contents of this file are subject to the terms of the Common Development
75.6 - * and Distribution License (the License). You may not use this file except in
75.7 - * compliance with the License.
75.8 - *
75.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
75.10 - * or http://www.netbeans.org/cddl.txt.
75.11 -
75.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
75.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
75.14 - * If applicable, add the following below the CDDL Header, with the fields
75.15 - * enclosed by brackets [] replaced by your own identifying information:
75.16 - * "Portions Copyrighted [year] [name of copyright owner]"
75.17 - *
75.18 - * The Original Software is NetBeans. The Initial Developer of the Original
75.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
75.20 - * Microsystems, Inc. All Rights Reserved.
75.21 - */
75.22 -
75.23 -package org.netbeans.modules.encoder.custom.aip;
75.24 -
75.25 -import java.lang.reflect.InvocationTargetException;
75.26 -import org.openide.nodes.PropertySupport;
75.27 -
75.28 -/**
75.29 - *
75.30 - * @author jxu
75.31 - */
75.32 -public class ReadOnlyDelimiterProperty<T>
75.33 - extends PropertySupport.Reflection<T> {
75.34 -
75.35 - private EncodingOption mEncodingOption;
75.36 -
75.37 - /**
75.38 - * Creates a new instance of ReadOnlyDelimiterProperty
75.39 - * @param encodingOption (Bean) object to work on
75.40 - * @param clazz type of the property
75.41 - * @param getterName name of getter method
75.42 - * @throws NoSuchMethodException if the getter method cannot be found
75.43 - */
75.44 - public ReadOnlyDelimiterProperty(EncodingOption encodingOption, Class clazz,
75.45 - String getterName) throws NoSuchMethodException {
75.46 - // setterName = null so as to read only
75.47 - super(encodingOption, clazz, getterName, null);
75.48 - mEncodingOption= encodingOption;
75.49 - }
75.50 -
75.51 - @Override
75.52 - public T getValue() throws IllegalAccessException, IllegalArgumentException,
75.53 - InvocationTargetException {
75.54 - return (T) mEncodingOption.getEndDelimitersAsString();
75.55 - }
75.56 -}
76.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/ShortIntegerInplaceEditor.java Sat Sep 27 15:34:52 2008 -0700
76.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
76.3 @@ -1,91 +0,0 @@
76.4 -/*
76.5 - * The contents of this file are subject to the terms of the Common Development
76.6 - * and Distribution License (the License). You may not use this file except in
76.7 - * compliance with the License.
76.8 - *
76.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
76.10 - * or http://www.netbeans.org/cddl.txt.
76.11 -
76.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
76.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
76.14 - * If applicable, add the following below the CDDL Header, with the fields
76.15 - * enclosed by brackets [] replaced by your own identifying information:
76.16 - * "Portions Copyrighted [year] [name of copyright owner]"
76.17 - *
76.18 - * The Original Software is NetBeans. The Initial Developer of the Original
76.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
76.20 - * Microsystems, Inc. All Rights Reserved.
76.21 - */
76.22 -
76.23 -package org.netbeans.modules.encoder.custom.aip;
76.24 -
76.25 -import java.math.BigInteger;
76.26 -import org.openide.explorer.propertysheet.InplaceEditor;
76.27 -
76.28 -/**
76.29 - * An InplaceEditor implementation for editing short integer values.
76.30 - * The reason for creating this implementation instead of using the default
76.31 - * is that the default one causes the container window to be closed everytime
76.32 - * the value is accepted.
76.33 - *
76.34 - * @author Jun Xu
76.35 - */
76.36 -public class ShortIntegerInplaceEditor extends StringInplaceEditor implements InplaceEditor {
76.37 -
76.38 - private final BigInteger mMinInclusive;
76.39 - private final BigInteger mMaxInclusive;
76.40 -
76.41 - /** Creates a new instance of IntegerInplaceEditor */
76.42 - public ShortIntegerInplaceEditor() {
76.43 - super();
76.44 - mMinInclusive = new BigInteger(new Short(Short.MIN_VALUE).toString());
76.45 - mMaxInclusive = new BigInteger(new Short(Short.MAX_VALUE).toString());
76.46 - }
76.47 -
76.48 - /**
76.49 - * Creates a new instance of IntegerInplaceEditor with indicated
76.50 - * minInclusive value and maxInclusive value.
76.51 - * @param minInclusive the minimun (inclusive) value.
76.52 - * @param maxInclusive the maximum (inclusive) value.
76.53 - */
76.54 - public ShortIntegerInplaceEditor(short minInclusive, short maxInclusive) {
76.55 - super();
76.56 - mMinInclusive = new BigInteger(new Short(minInclusive).toString());
76.57 - mMaxInclusive = new BigInteger(new Short(maxInclusive).toString());
76.58 - }
76.59 -
76.60 - @Override
76.61 - public Object getValue() {
76.62 - short value;
76.63 - try {
76.64 - BigInteger rawValue = new BigInteger(mJTextField.getText());
76.65 - value = keepValueInRange(rawValue);
76.66 - } catch (NumberFormatException e) {
76.67 - if (mPropertyEditor != null) {
76.68 - setValue(mPropertyEditor.getValue());
76.69 - return mPropertyEditor.getValue();
76.70 - }
76.71 - value = keepValueInRange(BigInteger.ZERO);
76.72 - setValue(value);
76.73 - }
76.74 - return value;
76.75 - }
76.76 -
76.77 - /**
76.78 - * Keep the indicated value (as short) inside a range with max value of
76.79 - * upper bound and min value of lower bound.
76.80 - *
76.81 - * @param value to be checked.
76.82 - * @return the original short value if the value is in the range, or
76.83 - * the upper (short maximum) or lower (short minimun) bound value.
76.84 - */
76.85 - private short keepValueInRange(BigInteger value) {
76.86 - if (value.compareTo(mMinInclusive) < 0) {
76.87 - return mMinInclusive.shortValue();
76.88 - }
76.89 - if (value.compareTo(mMaxInclusive) > 0) {
76.90 - return mMaxInclusive.shortValue();
76.91 - }
76.92 - return value.shortValue();
76.93 - }
76.94 -}
77.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/StringInplaceEditor.java Sat Sep 27 15:34:52 2008 -0700
77.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
77.3 @@ -1,153 +0,0 @@
77.4 -/*
77.5 - * The contents of this file are subject to the terms of the Common Development
77.6 - * and Distribution License (the License). You may not use this file except in
77.7 - * compliance with the License.
77.8 - *
77.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
77.10 - * or http://www.netbeans.org/cddl.txt.
77.11 -
77.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
77.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
77.14 - * If applicable, add the following below the CDDL Header, with the fields
77.15 - * enclosed by brackets [] replaced by your own identifying information:
77.16 - * "Portions Copyrighted [year] [name of copyright owner]"
77.17 - *
77.18 - * The Original Software is NetBeans. The Initial Developer of the Original
77.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
77.20 - * Microsystems, Inc. All Rights Reserved.
77.21 - */
77.22 -
77.23 -package org.netbeans.modules.encoder.custom.aip;
77.24 -
77.25 -import java.awt.Component;
77.26 -import java.awt.event.ActionEvent;
77.27 -import java.awt.event.ActionListener;
77.28 -import java.awt.event.KeyEvent;
77.29 -import java.beans.PropertyEditor;
77.30 -import java.lang.reflect.InvocationTargetException;
77.31 -import java.util.Collections;
77.32 -import java.util.LinkedList;
77.33 -import java.util.List;
77.34 -import javax.swing.JComponent;
77.35 -import javax.swing.JTextField;
77.36 -import javax.swing.KeyStroke;
77.37 -import javax.swing.SwingUtilities;
77.38 -import org.openide.explorer.propertysheet.InplaceEditor;
77.39 -import org.openide.explorer.propertysheet.PropertyEnv;
77.40 -import org.openide.explorer.propertysheet.PropertyModel;
77.41 -
77.42 -/**
77.43 - * An InplaceEditor implementation for editing string values. The reason for
77.44 - * creating this implementation instead of using the default is that the
77.45 - * default one causes the container window to be closed everytime the value
77.46 - * is accepted.
77.47 - *
77.48 - * @author Jun Xu
77.49 - */
77.50 -public class StringInplaceEditor implements InplaceEditor {
77.51 -
77.52 - protected final JTextField mJTextField;
77.53 - protected PropertyEditor mPropertyEditor;
77.54 -
77.55 - private final List<ActionListener> mActionListeners =
77.56 - Collections.synchronizedList(new LinkedList<ActionListener>());
77.57 - private final ActionListener mJTextFieldActionListener =
77.58 - new ActionListener() {
77.59 - public void actionPerformed(ActionEvent e) {
77.60 - mJTextField.selectAll();
77.61 - if (mPropertyModel != null) {
77.62 - try {
77.63 - mPropertyModel.setValue(getValue());
77.64 - } catch (InvocationTargetException ex) {
77.65 - }
77.66 - }
77.67 -
77.68 - // InplaceEditor is supposed to fire the COMMAND_SUCCESS.
77.69 - // But making following notification causes the default button
77.70 - // being "clicked", which causes the container window being closed.
77.71 - //ActionListener[] listeners = mActionListeners.toArray(new ActionListener[0]);
77.72 - //ActionEvent evt = new ActionEvent(StringInplaceEditor.this, 0, COMMAND_SUCCESS);
77.73 - //for (int i = 0; i < listeners.length; i++) {
77.74 - // listeners[i].actionPerformed(evt);
77.75 - //}
77.76 - }
77.77 - };
77.78 -
77.79 - private PropertyModel mPropertyModel;
77.80 -
77.81 - /** Creates a new instance of StringInplaceEditor */
77.82 - public StringInplaceEditor() {
77.83 - mJTextField = new JTextField();
77.84 - }
77.85 -
77.86 - public void connect(PropertyEditor propertyEditor, PropertyEnv propertyEnv) {
77.87 - mPropertyEditor = propertyEditor;
77.88 - reset();
77.89 - mJTextField.addActionListener(mJTextFieldActionListener);
77.90 - SwingUtilities.invokeLater(new Runnable() {
77.91 - public void run() {
77.92 - mJTextField.selectAll();
77.93 - }
77.94 - });
77.95 - }
77.96 -
77.97 - public JComponent getComponent() {
77.98 - return mJTextField;
77.99 - }
77.100 -
77.101 - public void clear() {
77.102 - mPropertyModel = null;
77.103 - mPropertyEditor = null;
77.104 - mJTextField.removeActionListener(mJTextFieldActionListener);
77.105 - }
77.106 -
77.107 - public Object getValue() {
77.108 - return mJTextField.getText();
77.109 - }
77.110 -
77.111 - public void setValue(Object object) {
77.112 - if (object == null) {
77.113 - mJTextField.setText(""); //NOI18N
77.114 - return;
77.115 - }
77.116 - mJTextField.setText(object.toString());
77.117 - }
77.118 -
77.119 - public boolean supportsTextEntry() {
77.120 - return true;
77.121 - }
77.122 -
77.123 - public void reset() {
77.124 - if (mPropertyEditor != null) {
77.125 - setValue(mPropertyEditor.getValue());
77.126 - }
77.127 - }
77.128 -
77.129 - public void addActionListener(ActionListener actionListener) {
77.130 - mActionListeners.add(actionListener);
77.131 - }
77.132 -
77.133 - public void removeActionListener(ActionListener actionListener) {
77.134 - mActionListeners.remove(actionListener);
77.135 - }
77.136 -
77.137 - public KeyStroke[] getKeyStrokes() {
77.138 - return new KeyStroke[]{KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)};
77.139 - }
77.140 -
77.141 - public PropertyEditor getPropertyEditor() {
77.142 - return mPropertyEditor;
77.143 - }
77.144 -
77.145 - public PropertyModel getPropertyModel() {
77.146 - return mPropertyModel;
77.147 - }
77.148 -
77.149 - public void setPropertyModel(PropertyModel propertyModel) {
77.150 - mPropertyModel = propertyModel;
77.151 - }
77.152 -
77.153 - public boolean isKnownComponent(Component component) {
77.154 - return mJTextField == component;
77.155 - }
77.156 -}
78.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/UndefDataPolicyPropertyEditor.java Sat Sep 27 15:34:52 2008 -0700
78.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
78.3 @@ -1,58 +0,0 @@
78.4 -/*
78.5 - * The contents of this file are subject to the terms of the Common Development
78.6 - * and Distribution License (the License). You may not use this file except in
78.7 - * compliance with the License.
78.8 - *
78.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
78.10 - * or http://www.netbeans.org/cddl.txt.
78.11 -
78.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
78.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
78.14 - * If applicable, add the following below the CDDL Header, with the fields
78.15 - * enclosed by brackets [] replaced by your own identifying information:
78.16 - * "Portions Copyrighted [year] [name of copyright owner]"
78.17 - *
78.18 - * The Original Software is NetBeans. The Initial Developer of the Original
78.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
78.20 - * Microsystems, Inc. All Rights Reserved.
78.21 - */
78.22 -
78.23 -package org.netbeans.modules.encoder.custom.aip;
78.24 -
78.25 -import java.beans.PropertyEditorSupport;
78.26 -
78.27 -/**
78.28 - * The property editor for the undefDataPolicy property.
78.29 - *
78.30 - * @author sun
78.31 - */
78.32 -public class UndefDataPolicyPropertyEditor extends PropertyEditorSupport {
78.33 -
78.34 - /** Creates a new instance of UndefDataPolicyPropertyEditor */
78.35 - public UndefDataPolicyPropertyEditor() {
78.36 - }
78.37 -
78.38 - @Override
78.39 - public String[] getTags() {
78.40 - return EncodingOption.undefDataPolicyTagList().toArray(new String[0]);
78.41 - }
78.42 -
78.43 - @Override
78.44 - public String getAsText() {
78.45 - return (String) getValue();
78.46 - }
78.47 -
78.48 - @Override
78.49 - public void setAsText(String text) throws IllegalArgumentException {
78.50 - setValue(text);
78.51 - }
78.52 -
78.53 - @Override
78.54 - public String getJavaInitializationString() {
78.55 - String value = (String) getValue();
78.56 - if (value == null) {
78.57 - return "null"; //NOI18N
78.58 - }
78.59 - return "\"" + value + "\""; //NOI18N
78.60 - }
78.61 -}
79.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/action/ApplyCustomEncodingAction.java Sat Sep 27 15:34:52 2008 -0700
79.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
79.3 @@ -1,373 +0,0 @@
79.4 -/*
79.5 - * The contents of this file are subject to the terms of the Common Development
79.6 - * and Distribution License (the License). You may not use this file except in
79.7 - * compliance with the License.
79.8 - *
79.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
79.10 - * or http://www.netbeans.org/cddl.txt.
79.11 -
79.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
79.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
79.14 - * If applicable, add the following below the CDDL Header, with the fields
79.15 - * enclosed by brackets [] replaced by your own identifying information:
79.16 - * "Portions Copyrighted [year] [name of copyright owner]"
79.17 - *
79.18 - * The Original Software is NetBeans. The Initial Developer of the Original
79.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
79.20 - * Microsystems, Inc. All Rights Reserved.
79.21 - */
79.22 -
79.23 -package org.netbeans.modules.encoder.custom.aip.action;
79.24 -
79.25 -import java.awt.Dialog;
79.26 -import java.awt.event.ActionEvent;
79.27 -import java.awt.event.ActionListener;
79.28 -import java.io.File;
79.29 -import java.io.IOException;
79.30 -import java.util.ResourceBundle;
79.31 -import javax.swing.JOptionPane;
79.32 -import javax.swing.text.Document;
79.33 -import org.apache.xmlbeans.XmlException;
79.34 -import org.netbeans.modules.encoder.custom.aip.CustomEncodingConst;
79.35 -import org.netbeans.modules.encoder.ui.basic.ApplyEncodingConfirmation;
79.36 -import org.netbeans.modules.encoder.ui.basic.ApplyEncodingException;
79.37 -import org.netbeans.modules.encoder.ui.basic.EncodingMark;
79.38 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
79.39 -import org.netbeans.modules.encoder.ui.basic.ModelVisitor;
79.40 -import org.netbeans.modules.encoder.ui.basic.ModelVisitorException;
79.41 -import org.netbeans.modules.encoder.ui.basic.ProgressDialog;
79.42 -import org.netbeans.modules.encoder.ui.basic.Utils;
79.43 -import org.netbeans.modules.xml.schema.model.SchemaModel;
79.44 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
79.45 -import org.openide.DialogDescriptor;
79.46 -import org.openide.DialogDisplayer;
79.47 -import org.openide.ErrorManager;
79.48 -import org.openide.filesystems.FileObject;
79.49 -import org.openide.filesystems.FileUtil;
79.50 -import org.openide.loaders.DataObject;
79.51 -import org.openide.nodes.Node;
79.52 -import org.openide.util.HelpCtx;
79.53 -import org.openide.util.NbBundle;
79.54 -import org.openide.util.Utilities;
79.55 -import org.openide.util.actions.NodeAction;
79.56 -import org.openide.windows.InputOutput;
79.57 -import org.openide.windows.OutputWriter;
79.58 -import org.openide.windows.WindowManager;
79.59 -
79.60 -
79.61 -/**
79.62 - * Action that applies the custom encoding to an XSD.
79.63 - *
79.64 - * @author Jun Xu
79.65 - */
79.66 -public class ApplyCustomEncodingAction extends NodeAction {
79.67 -
79.68 - private static final ResourceBundle _bundle =
79.69 - java.util.ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/action/Bundle");
79.70 - private static final String PROCESS = _bundle.getString("apply_custom_enc.lbl.process");
79.71 - private static final String CANCEL = _bundle.getString("apply_custom_enc.lbl.cancel");
79.72 -
79.73 - private boolean mIsApplied = false;
79.74 -
79.75 - public static void applyCustomEncoding(final SchemaModel model,
79.76 - final boolean applyToReferenced) throws IOException, CatalogModelException {
79.77 -
79.78 - InputOutput io = Utils.getEncodingIO();
79.79 - io.select();
79.80 - final OutputWriter console = io.getOut();
79.81 - console.println(_bundle.getString("apply_custom_enc.msg.start_apply_custom_enc"));
79.82 -
79.83 - ModelUtils.ModelStatus modelStatus =
79.84 - ModelUtils.getModelStatus(model, applyToReferenced);
79.85 -
79.86 - if (modelStatus.getTotalCharSize() > 300 * 1024) {
79.87 - int estimate = (int) ((modelStatus.getTotalCharSize() / 18000.0 / 60.0) + 0.5);
79.88 - String msg = NbBundle.getMessage(ApplyCustomEncodingAction.class,
79.89 - "apply_custom_enc.lbl.warn_big_file", estimate); //NOI18N
79.90 - int option =
79.91 - JOptionPane.showConfirmDialog(
79.92 - WindowManager.getDefault().getMainWindow(),
79.93 - msg,
79.94 - _bundle.getString("apply_custom_enc.lbl.notify_long_proc"),
79.95 - JOptionPane.YES_NO_OPTION);
79.96 - if (option == JOptionPane.NO_OPTION) {
79.97 - console.println(_bundle.getString("apply_custom_enc.msg.cancelled_by_user"));
79.98 - return;
79.99 - }
79.100 -
79.101 - final ProgressDialog progDialog =
79.102 - ProgressDialog.newInstance(
79.103 - _bundle.getString("apply_custom_enc.lbl.applying_custom_encoding"));
79.104 - new Thread(new Runnable() {
79.105 - public void run() {
79.106 -
79.107 - progDialog.getHandle().start();
79.108 - progDialog.getHandle().switchToIndeterminate();
79.109 - final ModelVisitor visitor = new ApplyCustomEncodingSync();
79.110 - try {
79.111 - ModelUtils.visitModel(model, visitor, applyToReferenced);
79.112 - } catch (CatalogModelException ex) {
79.113 - throw new RuntimeException(ex);
79.114 - } finally {
79.115 - progDialog.getHandle().finish();
79.116 - progDialog.getDialog().setVisible(false);
79.117 - }
79.118 - console.println(_bundle.getString("apply_custom_enc.msg.finished_applying_custom_enc"));
79.119 - }
79.120 - }).start();
79.121 - progDialog.getDialog().setVisible(true);
79.122 - } else {
79.123 - ModelVisitor visitor = new ApplyCustomEncodingSync();
79.124 - ModelUtils.visitModel(model, visitor, applyToReferenced);
79.125 - console.println(_bundle.getString("apply_custom_enc.msg.finished_applying_custom_enc"));
79.126 - }
79.127 - }
79.128 -
79.129 - protected void performAction(Node[] node) {
79.130 - try {
79.131 - Utils.getEncodingIO().getOut().reset();
79.132 - } catch (IOException ex) {
79.133 - //Ignore
79.134 - }
79.135 - showDialog(node);
79.136 - }
79.137 -
79.138 - private void showDialog(final Node[] node) {
79.139 - final ApplyEncodingConfirmation confirmPane = new ApplyEncodingConfirmation();
79.140 - confirmPane.setApplyToReferenced(true);
79.141 - DialogDescriptor dialogDescriptor =
79.142 - new DialogDescriptor(confirmPane,
79.143 - _bundle.getString("apply_custom_enc.lbl.apply_custom_encoding_title"),
79.144 - true,
79.145 - new Object[] {PROCESS, CANCEL},
79.146 - PROCESS,
79.147 - DialogDescriptor.BOTTOM_ALIGN,
79.148 - HelpCtx.DEFAULT_HELP,
79.149 - this);
79.150 - dialogDescriptor.setClosingOptions(new Object[] {PROCESS, CANCEL});
79.151 - dialogDescriptor.setButtonListener(new ActionListener() {
79.152 - public void actionPerformed(ActionEvent e) {
79.153 - String action = e.getActionCommand();
79.154 - if (action.equals(PROCESS)) {
79.155 - try {
79.156 - confirmPane.setCursor(Utilities.createProgressCursor(confirmPane));
79.157 - process(node, confirmPane.isApplyToReferenced());
79.158 - } finally {
79.159 - confirmPane.setCursor(null);
79.160 - }
79.161 - }
79.162 - }
79.163 - });
79.164 - Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
79.165 - dialog.setModal(true);
79.166 - dialog.setVisible(true);
79.167 - }
79.168 -
79.169 - private void process(final Node[] node, boolean applyToReferenced) {
79.170 - SchemaModel model = null;
79.171 - for (int nodeIndex = 0; nodeIndex < node.length; nodeIndex++) {
79.172 - try {
79.173 - model = ModelUtils.getSchemaModelFromNode(node[nodeIndex]);
79.174 - if (model == null) {
79.175 - continue;
79.176 - }
79.177 - applyCustomEncoding(model, applyToReferenced);
79.178 - } catch (IOException ex) {
79.179 - ErrorManager.getDefault().notify(ex);
79.180 - } catch (ApplyEncodingException ex) {
79.181 - ErrorManager.getDefault().notify(ex);
79.182 - } catch (CatalogModelException ex) {
79.183 - ErrorManager.getDefault().notify(ex);
79.184 - }
79.185 - }
79.186 - }
79.187 -
79.188 - public String getName() {
79.189 - if (mIsApplied) {
79.190 - return _bundle.getString("apply_custom_enc.lbl.reapply_custom_encoding");
79.191 - }
79.192 - return _bundle.getString("apply_custom_enc.lbl.apply_custom_encoding_menu");
79.193 - }
79.194 -
79.195 - public HelpCtx getHelpCtx() {
79.196 - return HelpCtx.DEFAULT_HELP;
79.197 - }
79.198 -
79.199 - protected boolean asynchronous() {
79.200 - return false;
79.201 - }
79.202 -
79.203 - protected boolean enable(Node[] node) {
79.204 - //Check if it is writable
79.205 - if (node == null || node.length == 0) {
79.206 - return false;
79.207 - }
79.208 - SchemaModel sm = null;
79.209 - try {
79.210 - sm = ModelUtils.getSchemaModelFromNode(node[0]);
79.211 - } catch (IOException ex) {
79.212 - ErrorManager.getDefault().log(ErrorManager.EXCEPTION,
79.213 - ex.toString());
79.214 - return false;
79.215 - }
79.216 - boolean writable = ModelUtils.isModelWritable(sm);
79.217 - if (!writable) {
79.218 - return false;
79.219 - }
79.220 - EncodingMark existingMark = ModelUtils.getEncodingMark(sm);
79.221 - if (existingMark != null) {
79.222 - if (CustomEncodingConst.STYLE.equals(existingMark.getStyle())) {
79.223 - //Already has custom encoding applied
79.224 - mIsApplied = true;
79.225 - return true;
79.226 - }
79.227 - //Already has other encoding applied
79.228 - mIsApplied = false;
79.229 - return false;
79.230 - }
79.231 - //No encoding has been applied
79.232 - mIsApplied = false;
79.233 - return true;
79.234 - }
79.235 -
79.236 - /**
79.237 - * Visitor class for applying custom encoding to the in-memory model and
79.238 - * with model always synchronized. For huge models, this process might be
79.239 - * very time consuming.
79.240 - */
79.241 - private static class ApplyCustomEncodingSync implements ModelVisitor {
79.242 -
79.243 - private OutputWriter mConsole = Utils.getEncodingIO().getOut();
79.244 - private boolean mSkip = false;
79.245 -
79.246 - public boolean visit(SchemaModel model) {
79.247 - if (!ModelUtils.isModelWritable(model)) {
79.248 - if (mSkip) {
79.249 - return true;
79.250 - }
79.251 - String msg = NbBundle.getMessage(ApplyCustomEncodingAction.class,
79.252 - "apply_custom_enc.lbl.warn_read_only", ModelUtils.getFilePath(model)); //NOI18N
79.253 - int option =
79.254 - JOptionPane.showConfirmDialog(
79.255 - WindowManager.getDefault().getMainWindow(),
79.256 - msg,
79.257 - _bundle.getString("apply_custom_enc.lbl.read_only_model"),
79.258 - JOptionPane.YES_NO_OPTION);
79.259 - mConsole.println(
79.260 - NbBundle.getMessage(
79.261 - ApplyCustomEncodingAction.class,
79.262 - "apply_custom_enc.msg.apply_custom_enc_to", //NOI18N
79.263 - ModelUtils.getFilePath(model)));
79.264 - if (option == JOptionPane.NO_OPTION) {
79.265 - mConsole.println(
79.266 - _bundle.getString("apply_custom_enc.msg.cancelled_by_user"));
79.267 - return false;
79.268 - }
79.269 - mSkip = true;
79.270 - return true;
79.271 - }
79.272 -
79.273 - mConsole.println(
79.274 - NbBundle.getMessage(
79.275 - ApplyCustomEncodingAction.class,
79.276 - "apply_custom_enc.msg.apply_custom_enc_to", //NOI18N
79.277 - ModelUtils.getFilePath(model)));
79.278 - boolean transStarted = false;
79.279 - try {
79.280 - if (!model.isIntransaction()) {
79.281 - if (!model.startTransaction()) {
79.282 - //TODO how to handle???
79.283 - } else {
79.284 - transStarted = true;
79.285 - }
79.286 - }
79.287 - try {
79.288 - ModelUtils.applyEncodingMark(model, CustomEncodingConst.NAME,
79.289 - CustomEncodingConst.URI, CustomEncodingConst.STYLE);
79.290 - } catch (IOException ex) {
79.291 - throw new ModelVisitorException(ex);
79.292 - }
79.293 - ApplyCustomEncodingVisitor visitor =
79.294 - new ApplyCustomEncodingVisitor(model);
79.295 - model.getSchema().accept(visitor);
79.296 - mConsole.println(
79.297 - NbBundle.getMessage(
79.298 - ApplyCustomEncodingAction.class,
79.299 - "apply_custom_enc.msg.modified_elem_count", //NOI18N
79.300 - visitor.getElemModifiedCount()));
79.301 - } finally {
79.302 - if (transStarted) {
79.303 - model.endTransaction();
79.304 - }
79.305 - }
79.306 - return true;
79.307 - }
79.308 -
79.309 - public boolean visit(Document doc) {
79.310 - return true;
79.311 - }
79.312 -
79.313 - public boolean visit(FileObject fileObj) {
79.314 - return true;
79.315 - }
79.316 -
79.317 - public boolean visit(DataObject dataObj) {
79.318 - return true;
79.319 - }
79.320 - }
79.321 -
79.322 - /**
79.323 - * Visitor class for applying custom encoding to the underlying XSD files
79.324 - * instead of the in-memory model and the model might be out of sync
79.325 - * with the underlying XSD files. For huge models, this process is much
79.326 - * faster than applying to the in-memory model.
79.327 - *
79.328 - * !!! Not used for now since the synchronization between the model
79.329 - * and XSD file is even much slower than updating the model directly.
79.330 - */
79.331 - private static class ApplyCustomEncodingOffline implements ModelVisitor {
79.332 -
79.333 - private boolean mSkip = false;
79.334 -
79.335 - public boolean visit(SchemaModel model) {
79.336 - return true;
79.337 - }
79.338 -
79.339 - public boolean visit(Document doc) {
79.340 - return true;
79.341 - }
79.342 -
79.343 - public boolean visit(FileObject fileObj) {
79.344 - if (!fileObj.canWrite()) {
79.345 - if (mSkip) {
79.346 - return true;
79.347 - }
79.348 - String msg = NbBundle.getMessage(ApplyCustomEncodingAction.class,
79.349 - "apply_custom_enc.lbl.warn_read_only", FileUtil.toFile(fileObj).getAbsolutePath()); //NOI18N
79.350 - int option =
79.351 - JOptionPane.showConfirmDialog(
79.352 - WindowManager.getDefault().getMainWindow(),
79.353 - msg,
79.354 - _bundle.getString("apply_custom_enc.lbl.read_only_file"),
79.355 - JOptionPane.YES_NO_OPTION);
79.356 - if (option == JOptionPane.NO_OPTION) {
79.357 - return false;
79.358 - }
79.359 - mSkip = true;
79.360 - return true;
79.361 - }
79.362 - try {
79.363 - ApplyCustomEncodingXmlBeans.applyDetailCustomEncoding(new File(FileUtil.toFile(fileObj).getAbsolutePath()));
79.364 - } catch (XmlException ex) {
79.365 - throw new ModelVisitorException(ex);
79.366 - } catch (IOException ex) {
79.367 - throw new ModelVisitorException(ex);
79.368 - }
79.369 - return true;
79.370 - }
79.371 -
79.372 - public boolean visit(DataObject dataObj) {
79.373 - return true;
79.374 - }
79.375 - }
79.376 -}
80.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/action/ApplyCustomEncodingVisitor.java Sat Sep 27 15:34:52 2008 -0700
80.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
80.3 @@ -1,88 +0,0 @@
80.4 -/*
80.5 - * The contents of this file are subject to the terms of the Common Development
80.6 - * and Distribution License (the License). You may not use this file except in
80.7 - * compliance with the License.
80.8 - *
80.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
80.10 - * or http://www.netbeans.org/cddl.txt.
80.11 -
80.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
80.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
80.14 - * If applicable, add the following below the CDDL Header, with the fields
80.15 - * enclosed by brackets [] replaced by your own identifying information:
80.16 - * "Portions Copyrighted [year] [name of copyright owner]"
80.17 - *
80.18 - * The Original Software is NetBeans. The Initial Developer of the Original
80.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
80.20 - * Microsystems, Inc. All Rights Reserved.
80.21 - */
80.22 -
80.23 -package org.netbeans.modules.encoder.custom.aip.action;
80.24 -
80.25 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
80.26 -import org.netbeans.modules.xml.schema.model.Annotation;
80.27 -import org.netbeans.modules.xml.schema.model.AppInfo;
80.28 -import org.netbeans.modules.xml.schema.model.Element;
80.29 -import org.netbeans.modules.xml.schema.model.GlobalElement;
80.30 -import org.netbeans.modules.xml.schema.model.LocalElement;
80.31 -import org.netbeans.modules.xml.schema.model.SchemaModel;
80.32 -import org.netbeans.modules.xml.schema.model.visitor.DeepSchemaVisitor;
80.33 -import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor;
80.34 -
80.35 -/**
80.36 - * The visitor that applies custom encoding to every element declaration.
80.37 - *
80.38 - * @author Jun Xu
80.39 - */
80.40 -public class ApplyCustomEncodingVisitor extends DeepSchemaVisitor implements SchemaVisitor {
80.41 -
80.42 - private final SchemaModel mModel;
80.43 - private int mModifiedCount = 0;
80.44 -
80.45 - public ApplyCustomEncodingVisitor(SchemaModel rootModel) {
80.46 - mModel = rootModel;
80.47 - }
80.48 -
80.49 - public void visit(LocalElement localElement) {
80.50 - applyCustomEncoding(localElement);
80.51 - super.visit(localElement);
80.52 - }
80.53 -
80.54 - public void visit(GlobalElement globalElement) {
80.55 - applyCustomEncoding(globalElement);
80.56 - super.visit(globalElement);
80.57 - }
80.58 -
80.59 - public int getElemModifiedCount() {
80.60 - return mModifiedCount;
80.61 - }
80.62 -
80.63 - private void applyCustomEncoding(Element elem) {
80.64 - if (!mModel.equals(elem.getModel())) {
80.65 - return;
80.66 - }
80.67 - boolean addAnnotation = false;
80.68 - boolean found = false;
80.69 - Annotation anno = elem.getAnnotation();
80.70 - if (anno == null) {
80.71 - anno = elem.getModel().getFactory().createAnnotation();
80.72 - addAnnotation = true;
80.73 - } else {
80.74 - for (AppInfo appInfo : anno.getAppInfos()) {
80.75 - if (EncodingConst.URI.equals(appInfo.getURI())) {
80.76 - found = true;
80.77 - break;
80.78 - }
80.79 - }
80.80 - }
80.81 - if (!found) {
80.82 - AppInfo appInfo = elem.getModel().getFactory().createAppInfo();
80.83 - appInfo.setURI(EncodingConst.URI);
80.84 - anno.addAppInfo(appInfo);
80.85 - if (addAnnotation) {
80.86 - elem.setAnnotation(anno);
80.87 - }
80.88 - mModifiedCount++;
80.89 - }
80.90 - }
80.91 -}
81.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/action/ApplyCustomEncodingXmlBeans.java Sat Sep 27 15:34:52 2008 -0700
81.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
81.3 @@ -1,132 +0,0 @@
81.4 -/*
81.5 - * ApplyCustomEncodingXmlBeans.java
81.6 - *
81.7 - * Created on February 7, 2007, 3:57 PM
81.8 - *
81.9 - * To change this template, choose Tools | Template Manager
81.10 - * and open the template in the editor.
81.11 - */
81.12 -
81.13 -package org.netbeans.modules.encoder.custom.aip.action;
81.14 -
81.15 -import java.io.File;
81.16 -import java.io.IOException;
81.17 -import org.apache.xmlbeans.XmlException;
81.18 -import org.apache.xmlbeans.impl.xb.xsdschema.All;
81.19 -import org.apache.xmlbeans.impl.xb.xsdschema.AnnotationDocument;
81.20 -import org.apache.xmlbeans.impl.xb.xsdschema.AppinfoDocument;
81.21 -import org.apache.xmlbeans.impl.xb.xsdschema.ComplexRestrictionType;
81.22 -import org.apache.xmlbeans.impl.xb.xsdschema.ComplexType;
81.23 -import org.apache.xmlbeans.impl.xb.xsdschema.Element;
81.24 -import org.apache.xmlbeans.impl.xb.xsdschema.ExplicitGroup;
81.25 -import org.apache.xmlbeans.impl.xb.xsdschema.ExtensionType;
81.26 -import org.apache.xmlbeans.impl.xb.xsdschema.Group;
81.27 -import org.apache.xmlbeans.impl.xb.xsdschema.LocalElement;
81.28 -import org.apache.xmlbeans.impl.xb.xsdschema.NamedGroup;
81.29 -import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
81.30 -import org.apache.xmlbeans.impl.xb.xsdschema.TopLevelComplexType;
81.31 -import org.apache.xmlbeans.impl.xb.xsdschema.TopLevelElement;
81.32 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
81.33 -
81.34 -/**
81.35 - * Class used for applying custom encoding offline.
81.36 - *
81.37 - * @author Jun Xu
81.38 - */
81.39 -public class ApplyCustomEncodingXmlBeans {
81.40 -
81.41 - /**
81.42 - * Applies custom encoding to an XSD file.
81.43 - *
81.44 - * @param xsdFile the XSD file
81.45 - * @return returns true if the XSD file is modified, otherwise false
81.46 - */
81.47 - public static boolean applyDetailCustomEncoding(File xsdFile)
81.48 - throws XmlException, IOException {
81.49 -
81.50 - SchemaDocument schemaDoc = SchemaDocument.Factory.parse(xsdFile);
81.51 -
81.52 - NamedGroup[] modelGroups = schemaDoc.getSchema().getGroupArray();
81.53 - for (int i = 0; modelGroups != null && i < modelGroups.length; i++) {
81.54 - applyDetailCustomEncoding(modelGroups[i]);
81.55 - }
81.56 - TopLevelComplexType[] complexTypes = schemaDoc.getSchema().getComplexTypeArray();
81.57 - for (int i = 0; complexTypes != null && i < complexTypes.length; i++) {
81.58 - applyDetailCustomEncoding(complexTypes[i]);
81.59 - }
81.60 - TopLevelElement[] elemDecls = schemaDoc.getSchema().getElementArray();
81.61 - for (int i = 0; elemDecls != null && i < elemDecls.length; i++) {
81.62 - applyDetailCustomEncoding(elemDecls[i]);
81.63 - }
81.64 -
81.65 - schemaDoc.save(xsdFile);
81.66 - return true;
81.67 - }
81.68 -
81.69 - private static void applyDetailCustomEncoding(Element elemDecl) {
81.70 - if (elemDecl.isSetComplexType()) {
81.71 - applyDetailCustomEncoding(elemDecl.getComplexType());
81.72 - }
81.73 - if (!elemDecl.isSetAnnotation()) {
81.74 - elemDecl.addNewAnnotation();
81.75 - }
81.76 - AnnotationDocument.Annotation anno = elemDecl.getAnnotation();
81.77 - AppinfoDocument.Appinfo[] appinfos = anno.getAppinfoArray();
81.78 - for (int i = 0; appinfos != null && i < appinfos.length; i++) {
81.79 - if (EncodingConst.URI.equals(appinfos[i].getSource())) {
81.80 - return;
81.81 - }
81.82 - }
81.83 - anno.addNewAppinfo();
81.84 - anno.getAppinfoArray(anno.sizeOfAppinfoArray() - 1).setSource(EncodingConst.URI);
81.85 - }
81.86 -
81.87 - private static void applyDetailCustomEncoding(Group group) {
81.88 - ExplicitGroup[] sequences = group.getSequenceArray();
81.89 - for (int i = 0; sequences != null && i < sequences.length; i++) {
81.90 - applyDetailCustomEncoding(sequences[i]);
81.91 - }
81.92 - ExplicitGroup[] choices = group.getChoiceArray();
81.93 - for (int i = 0; choices != null && i < choices.length; i++) {
81.94 - applyDetailCustomEncoding(choices[i]);
81.95 - }
81.96 - All[] alls = group.getAllArray();
81.97 - for (int i = 0; alls != null && i < alls.length; i++) {
81.98 - applyDetailCustomEncoding(alls[i]);
81.99 - }
81.100 - LocalElement[] elemDecls = group.getElementArray();
81.101 - for (int i = 0; elemDecls != null && i < elemDecls.length; i++) {
81.102 - applyDetailCustomEncoding(elemDecls[i]);
81.103 - }
81.104 - }
81.105 -
81.106 - private static void applyDetailCustomEncoding(ComplexType complexType) {
81.107 - if (complexType.isSetComplexContent()) {
81.108 - if (complexType.getComplexContent().isSetExtension()) {
81.109 - ExtensionType extType = complexType.getComplexContent().getExtension();
81.110 - if (extType.isSetSequence()) {
81.111 - applyDetailCustomEncoding(extType.getSequence());
81.112 - } else if (extType.isSetChoice()) {
81.113 - applyDetailCustomEncoding(extType.getChoice());
81.114 - } else if (extType.isSetAll()) {
81.115 - applyDetailCustomEncoding(extType.getAll());
81.116 - }
81.117 - } else if (complexType.getComplexContent().isSetRestriction()) {
81.118 - ComplexRestrictionType resType = complexType.getComplexContent().getRestriction();
81.119 - if (resType.isSetSequence()) {
81.120 - applyDetailCustomEncoding(resType.getSequence());
81.121 - } else if (resType.isSetChoice()) {
81.122 - applyDetailCustomEncoding(resType.getChoice());
81.123 - } else if (resType.isSetAll()) {
81.124 - applyDetailCustomEncoding(resType.getAll());
81.125 - }
81.126 - }
81.127 - } else if (complexType.isSetSequence()) {
81.128 - applyDetailCustomEncoding(complexType.getSequence());
81.129 - } else if (complexType.isSetChoice()) {
81.130 - applyDetailCustomEncoding(complexType.getChoice());
81.131 - } else if (complexType.isSetAll()) {
81.132 - applyDetailCustomEncoding(complexType.getAll());
81.133 - }
81.134 - }
81.135 -}
82.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/action/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
82.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
82.3 @@ -1,32 +0,0 @@
82.4 -
82.5 -apply_custom_enc.lbl.process=Process
82.6 -
82.7 -apply_custom_enc.lbl.read_only_file=Read Only File
82.8 -
82.9 -apply_custom_enc.lbl.read_only_model=Read Only Model
82.10 -
82.11 -apply_custom_enc.lbl.reapply_custom_encoding=Reapply Custom Encoding
82.12 -
82.13 -apply_custom_enc.msg.finished_applying_custom_enc=Finished applying custom encoding.
82.14 -
82.15 -apply_custom_enc.lbl.applying_custom_encoding=Applying Custom Encoding
82.16 -
82.17 -apply_custom_enc.lbl.apply_custom_encoding_title=Apply Custom Encoding
82.18 -
82.19 -apply_custom_enc.lbl.apply_custom_encoding_menu=Apply Custom Encoding
82.20 -
82.21 -apply_custom_enc.msg.cancelled_by_user=Process cancelled by user.
82.22 -
82.23 -apply_custom_enc.lbl.notify_long_proc=Notify Lengthy Process
82.24 -
82.25 -apply_custom_enc.msg.start_apply_custom_enc=Start to apply custom encoding...
82.26 -
82.27 -apply_custom_enc.lbl.cancel=Cancel
82.28 -
82.29 -apply_custom_enc.lbl.warn_big_file=The size of the XSD file(s) is over 300K. This process may\ntake from couple seconds to {0,number,integer} minute(s) depending on\nvarious situation. Continue?
82.30 -
82.31 -apply_custom_enc.lbl.warn_read_only=The model is read only: ''{0}''. Continue to apply custom encoding to other referenced schemas?
82.32 -
82.33 -apply_custom_enc.msg.apply_custom_enc_to=Applying custom encoding to {0}
82.34 -
82.35 -apply_custom_enc.msg.modified_elem_count=Modified {0,number,integer} element declarations.
83.1 Binary file encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/delimIcon.PNG has changed
84.1 Binary file encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/delimLevelIcon.PNG has changed
85.1 Binary file encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/delimLevelOpenIcon.PNG has changed
86.1 Binary file encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/delimOpenIcon.PNG has changed
87.1 Binary file encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/icon.PNG has changed
88.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/layer.xml Sat Sep 27 15:34:52 2008 -0700
88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
88.3 @@ -1,19 +0,0 @@
88.4 -<?xml version="1.0" encoding="UTF-8"?>
88.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
88.6 -<filesystem>
88.7 - <folder name="Loaders">
88.8 - <folder name="text">
88.9 - <folder name="x-schema+xml">
88.10 - <folder name="Actions">
88.11 - <folder name="encoding">
88.12 - <file name="apply-custom.instance">
88.13 - <attr name="instanceClass" stringvalue="org.netbeans.modules.encoder.custom.aip.action.ApplyCustomEncodingAction"/>
88.14 - </file>
88.15 - <attr name="apply-custom.instance/sep-1.instance" boolvalue="true"/>
88.16 - </folder>
88.17 - </folder>
88.18 - </folder>
88.19 - </folder>
88.20 - </folder>
88.21 -</filesystem>
88.22 -
89.1 Binary file encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/openIcon.PNG has changed
90.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/validation/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
90.3 @@ -1,22 +0,0 @@
90.4 -
90.5 -validator.exp.no_top_element=No top element has been found in current document. Encoding related metadata is not validated.
90.6 -
90.7 -validator_provider.lbl.provider_name=Custom Encoder Validation Provider
90.8 -
90.9 -validator.exp.recursive_condition=Schema component ''{0}'' is referenced recursively. Encoding related metadata cannot be further validated for this schema component.
90.10 -
90.11 -validator.exp.wildcard_not_supported=Schema component ''{0}'': Wildcard element is not supported by this encoding style
90.12 -
90.13 -validator.exp.wildcard_not_supported_no_name=Wildcard element is not supported by this encoding style
90.14 -
90.15 -validator.exp.grp_in_grp_not_supported=Schema component ''{0}'': Model group inside model group is not supported by this encoding style
90.16 -
90.17 -validator.exp.grp_in_grp_not_supported_no_nm=Model group inside model group is not supported by this encoding style
90.18 -
90.19 -validator.exp.anytype_not_supported=Element ''{0}'': xsd:anyType or no type is not supported by this encoding style
90.20 -
90.21 -validator.exp.missing_encoding_info=Element ''{0}'': missing encoding information, default will be used
90.22 -
90.23 -validator.exp.empty_grp_not_supported=Schema component ''{0}'': Empty group is not supported by this encoding style
90.24 -
90.25 -validator.exp.empty_grp_not_supported_no_nm=Empty group is not supported by this encoding style
91.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/validation/CustomEncoderValidator.java Sat Sep 27 15:34:52 2008 -0700
91.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
91.3 @@ -1,315 +0,0 @@
91.4 -/*
91.5 - * The contents of this file are subject to the terms of the Common Development
91.6 - * and Distribution License (the License). You may not use this file except in
91.7 - * compliance with the License.
91.8 - *
91.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
91.10 - * or http://www.netbeans.org/cddl.txt.
91.11 -
91.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
91.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
91.14 - * If applicable, add the following below the CDDL Header, with the fields
91.15 - * enclosed by brackets [] replaced by your own identifying information:
91.16 - * "Portions Copyrighted [year] [name of copyright owner]"
91.17 - *
91.18 - * The Original Software is NetBeans. The Initial Developer of the Original
91.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
91.20 - * Microsystems, Inc. All Rights Reserved.
91.21 - */
91.22 -
91.23 -package org.netbeans.modules.encoder.custom.aip.validation;
91.24 -
91.25 -import java.util.ArrayList;
91.26 -import java.util.List;
91.27 -import java.util.ResourceBundle;
91.28 -import org.netbeans.modules.encoder.custom.aip.CustomEncodingConst;
91.29 -import org.netbeans.modules.encoder.custom.aip.EncodingOption;
91.30 -import org.netbeans.modules.encoder.ui.basic.SchemaUtility;
91.31 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
91.32 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
91.33 -import org.netbeans.modules.encoder.ui.basic.ValidationContext;
91.34 -import org.netbeans.modules.encoder.ui.basic.ValidationException;
91.35 -import org.netbeans.modules.encoder.ui.basic.XsdBasedEncoderValidator;
91.36 -import org.netbeans.modules.xml.schema.model.All;
91.37 -import org.netbeans.modules.xml.schema.model.AnyElement;
91.38 -import org.netbeans.modules.xml.schema.model.Choice;
91.39 -import org.netbeans.modules.xml.schema.model.Element;
91.40 -import org.netbeans.modules.xml.schema.model.GlobalElement;
91.41 -import org.netbeans.modules.xml.schema.model.GroupReference;
91.42 -import org.netbeans.modules.xml.schema.model.LocalElement;
91.43 -import org.netbeans.modules.xml.schema.model.LocalGroupDefinition;
91.44 -import org.netbeans.modules.xml.schema.model.NameableSchemaComponent;
91.45 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
91.46 -import org.netbeans.modules.xml.schema.model.SchemaModel;
91.47 -import org.netbeans.modules.xml.schema.model.Sequence;
91.48 -import org.netbeans.modules.xml.schema.model.TypeContainer;
91.49 -import org.openide.util.NbBundle;
91.50 -import org.xml.sax.ErrorHandler;
91.51 -import org.xml.sax.SAXException;
91.52 -import org.xml.sax.SAXParseException;
91.53 -
91.54 -/**
91.55 - * Class that provides validation functionality for custom encoder.
91.56 - *
91.57 - * @author Jun Xu
91.58 - */
91.59 -public class CustomEncoderValidator extends XsdBasedEncoderValidator {
91.60 -
91.61 - private static final ResourceBundle _bundle =
91.62 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/validation/Bundle");
91.63 -
91.64 - /** Creates a new instance of CustomEncoderValidator
91.65 - * @param model the schema model
91.66 - * @param handler a SAX error handler
91.67 - */
91.68 - public CustomEncoderValidator(SchemaModel model, ErrorHandler handler) {
91.69 - super(CustomEncodingConst.STYLE, model, handler);
91.70 - }
91.71 -
91.72 - @Override
91.73 - protected void foundNoTopElements()
91.74 - throws ValidationException, SAXException {
91.75 -
91.76 - super.foundNoTopElements();
91.77 -
91.78 - _handler.warning(
91.79 - new SAXParseException(
91.80 - _bundle.getString("validator.exp.no_top_element"),
91.81 - ModelUtils.getPublicId(_model),
91.82 - null /*ModelUtils.getSystemId(_model)*/,
91.83 - -1,
91.84 - -1));
91.85 - }
91.86 -
91.87 - @Override
91.88 - protected void detectedRecursiveCondition(ValidationContext context,
91.89 - SchemaComponent schemaComponent)
91.90 - throws ValidationException, SAXException {
91.91 -
91.92 - super.detectedRecursiveCondition(context, schemaComponent);
91.93 -
91.94 - String msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.95 - "validator.exp.recursive_condition", //NOI18N
91.96 - context.getElementNCNamePath(schemaComponent));
91.97 - _handler.warning(
91.98 - new SAXParseException(
91.99 - msg,
91.100 - ModelUtils.getPublicId(schemaComponent.getModel()),
91.101 - ModelUtils.getSystemId(schemaComponent.getModel()),
91.102 - -1,
91.103 - -1));
91.104 - }
91.105 -
91.106 - @Override
91.107 - protected void validate(ValidationContext context,
91.108 - GlobalElement globalElement)
91.109 - throws ValidationException, SAXException {
91.110 -
91.111 - super.validate(context, globalElement);
91.112 -
91.113 - validateElement(context, globalElement);
91.114 - }
91.115 -
91.116 - @Override
91.117 - protected void validate(ValidationContext context,
91.118 - LocalElement localElement)
91.119 - throws ValidationException, SAXException {
91.120 -
91.121 - super.validate(context, localElement);
91.122 -
91.123 - validateElement(context, localElement);
91.124 - }
91.125 -
91.126 - @Override
91.127 - protected void validate(ValidationContext context, Sequence sequence)
91.128 - throws ValidationException, SAXException {
91.129 -
91.130 - super.validate(context, sequence);
91.131 -
91.132 - validateGroup(context, sequence);
91.133 - }
91.134 -
91.135 - @Override
91.136 - protected void validate(ValidationContext context, All all)
91.137 - throws ValidationException, SAXException {
91.138 -
91.139 - super.validate(context, all);
91.140 -
91.141 - validateGroup(context, all);
91.142 - }
91.143 -
91.144 - @Override
91.145 - protected void validate(ValidationContext context, Choice choice)
91.146 - throws ValidationException, SAXException {
91.147 -
91.148 - super.validate(context, choice);
91.149 -
91.150 - validateGroup(context, choice);
91.151 - }
91.152 -
91.153 - @Override
91.154 - protected void validate(ValidationContext context, GroupReference groupRef)
91.155 - throws ValidationException, SAXException {
91.156 -
91.157 - super.validate(context, groupRef);
91.158 -
91.159 - validateGroup(context, groupRef);
91.160 - }
91.161 -
91.162 - @Override
91.163 - protected void validate(ValidationContext context, AnyElement anyElement)
91.164 - throws ValidationException, SAXException {
91.165 -
91.166 - super.validate(context, anyElement);
91.167 -
91.168 - String name = null;
91.169 - SchemaComponent sc = anyElement;
91.170 - for (int i = context.getPath().size() - 1; i >= 0; i--) {
91.171 - if (context.getPath().get(i)
91.172 - instanceof NameableSchemaComponent) {
91.173 - name = ((NameableSchemaComponent)
91.174 - context.getPath().get(i)).getName();
91.175 - sc = context.getPath().get(i);
91.176 - break;
91.177 - }
91.178 - }
91.179 - String msg;
91.180 - if (name != null) {
91.181 - msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.182 - "validator.exp.wildcard_not_supported", name); //NOI18N
91.183 - } else {
91.184 - msg = _bundle.getString("validator.exp.wildcard_not_supported_no_name");
91.185 - }
91.186 - _handler.error(
91.187 - new SAXParseException(
91.188 - msg,
91.189 - ModelUtils.getPublicId(sc.getModel()),
91.190 - ModelUtils.getSystemId(sc.getModel()),
91.191 - -1,
91.192 - -1));
91.193 - }
91.194 -
91.195 - private void validateGroup(ValidationContext context,
91.196 - SchemaComponent group)
91.197 - throws ValidationException, SAXException {
91.198 - String name = null;
91.199 - SchemaComponent sc = null;
91.200 - for (int i = context.getPath().size() - 1; i >= 0; i--) {
91.201 - if (context.getPath().get(i)
91.202 - instanceof NameableSchemaComponent) {
91.203 - name = ((NameableSchemaComponent)
91.204 - context.getPath().get(i)).getName();
91.205 - sc = context.getPath().get(i);
91.206 - break;
91.207 - }
91.208 - }
91.209 - if (group instanceof LocalGroupDefinition) {
91.210 - List<SchemaComponent> children =
91.211 - group.getChildren(SchemaComponent.class);
91.212 - if (children == null || children.isEmpty()) {
91.213 - String msg;
91.214 - if (name != null) {
91.215 - msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.216 - "validator.exp.empty_grp_not_supported", name); //NOI18N
91.217 - } else {
91.218 - msg = _bundle.getString("validator.exp.empty_grp_not_supported_no_nm");
91.219 - }
91.220 - if (sc == null) {
91.221 - sc = group;
91.222 - }
91.223 - _handler.error(
91.224 - new SAXParseException(
91.225 - msg,
91.226 - ModelUtils.getPublicId(sc.getModel()),
91.227 - ModelUtils.getSystemId(sc.getModel()),
91.228 - -1,
91.229 - -1));
91.230 - }
91.231 - }
91.232 - if (context.getPath().size() == 0) {
91.233 - return;
91.234 - }
91.235 - sc = context.getPath().get(context.getPath().size() - 1);
91.236 - if ((sc instanceof LocalGroupDefinition)
91.237 - || (sc instanceof GroupReference)) {
91.238 - String msg;
91.239 - if (name != null) {
91.240 - msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.241 - "validator.exp.grp_in_grp_not_supported", name); //NOI18N
91.242 - } else {
91.243 - msg = _bundle.getString("validator.exp.grp_in_grp_not_supported_no_nm");
91.244 - }
91.245 - _handler.error(
91.246 - new SAXParseException(
91.247 - msg,
91.248 - ModelUtils.getPublicId(sc.getModel()),
91.249 - ModelUtils.getSystemId(sc.getModel()),
91.250 - -1,
91.251 - -1));
91.252 - }
91.253 - }
91.254 -
91.255 - private void validateElement(ValidationContext context, Element elem)
91.256 - throws ValidationException, SAXException {
91.257 - String msg;
91.258 - if ((elem instanceof TypeContainer)
91.259 - && SchemaUtility.isAnyType(getType((TypeContainer) elem))) {
91.260 - msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.261 - "validator.exp.anytype_not_supported", //NOI18N
91.262 - context.getElementNCNamePath(elem));
91.263 - _handler.error(
91.264 - new SAXParseException(
91.265 - msg,
91.266 - ModelUtils.getPublicId(elem.getModel()),
91.267 - null /*ModelUtils.getSystemId(elem.getModel())*/,
91.268 - -1,
91.269 - -1));
91.270 - }
91.271 - if (elem.getAnnotation() == null) {
91.272 - msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.273 - "validator.exp.missing_encoding_info", //NOI18N
91.274 - context.getElementNCNamePath(elem));
91.275 - _handler.warning(
91.276 - new SAXParseException(
91.277 - msg,
91.278 - ModelUtils.getPublicId(elem.getModel()),
91.279 - null /*ModelUtils.getSystemId(elem.getModel())*/,
91.280 - -1,
91.281 - -1));
91.282 - return;
91.283 - }
91.284 - List<SchemaComponent> path =
91.285 - new ArrayList<SchemaComponent>(context.getPath());
91.286 - path.add(elem);
91.287 - path.add(elem.getAnnotation());
91.288 - EncodingOption encodingInfo;
91.289 - try {
91.290 - encodingInfo =
91.291 - EncodingOption.createFromAppInfo(path, false);
91.292 - } catch (InvalidAppInfoException ex) {
91.293 - _handler.error(
91.294 - new SAXParseException(
91.295 - ex.getMessage(),
91.296 - ModelUtils.getPublicId(elem.getModel()),
91.297 - null /*ModelUtils.getSystemId(elem.getModel())*/,
91.298 - -1,
91.299 - -1,
91.300 - ex));
91.301 - return;
91.302 - }
91.303 - if (encodingInfo == null) {
91.304 - msg = NbBundle.getMessage(CustomEncoderValidator.class,
91.305 - "validator.exp.missing_encoding_info", //NOI18N
91.306 - context.getElementNCNamePath(elem));
91.307 - _handler.warning(
91.308 - new SAXParseException(
91.309 - msg,
91.310 - ModelUtils.getPublicId(elem.getModel()),
91.311 - null /*ModelUtils.getSystemId(elem.getModel())*/,
91.312 - -1,
91.313 - -1));
91.314 - return;
91.315 - }
91.316 - encodingInfo.validate(_handler);
91.317 - }
91.318 -}
92.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/validation/ValidationProvider.java Sat Sep 27 15:34:52 2008 -0700
92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
92.3 @@ -1,99 +0,0 @@
92.4 -/*
92.5 - * The contents of this file are subject to the terms of the Common Development
92.6 - * and Distribution License (the License). You may not use this file except in
92.7 - * compliance with the License.
92.8 - *
92.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
92.10 - * or http://www.netbeans.org/cddl.txt.
92.11 -
92.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
92.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
92.14 - * If applicable, add the following below the CDDL Header, with the fields
92.15 - * enclosed by brackets [] replaced by your own identifying information:
92.16 - * "Portions Copyrighted [year] [name of copyright owner]"
92.17 - *
92.18 - * The Original Software is NetBeans. The Initial Developer of the Original
92.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
92.20 - * Microsystems, Inc. All Rights Reserved.
92.21 - */
92.22 -
92.23 -package org.netbeans.modules.encoder.custom.aip.validation;
92.24 -
92.25 -import java.net.URI;
92.26 -import java.net.URISyntaxException;
92.27 -import java.util.ResourceBundle;
92.28 -import java.util.logging.Level;
92.29 -import java.util.logging.Logger;
92.30 -import javax.xml.XMLConstants;
92.31 -import javax.xml.validation.Schema;
92.32 -import javax.xml.validation.SchemaFactory;
92.33 -import org.netbeans.modules.xml.schema.model.SchemaModel;
92.34 -import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
92.35 -import org.netbeans.modules.xml.xam.Model;
92.36 -import org.netbeans.modules.xml.xam.ModelSource;
92.37 -import org.netbeans.modules.xml.xam.dom.DocumentModel;
92.38 -import org.netbeans.modules.xml.xam.locator.CatalogModel;
92.39 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
92.40 -import org.netbeans.modules.xml.xam.spi.XsdBasedValidator;
92.41 -import org.netbeans.modules.xml.xam.spi.Validator;
92.42 -import org.xml.sax.SAXException;
92.43 -
92.44 -/**
92.45 - * A validator for validating custom encoder metadata.
92.46 - *
92.47 - * @author Jun Xu
92.48 - */
92.49 -public class ValidationProvider extends XsdBasedValidator {
92.50 -
92.51 - private static final ResourceBundle _bundle =
92.52 - ResourceBundle.getBundle("org/netbeans/modules/encoder/custom/aip/validation/Bundle");
92.53 - private static Schema _schema;
92.54 -
92.55 - static {
92.56 - try {
92.57 - _schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema();
92.58 - } catch(SAXException ex) {
92.59 - assert false: "Error while creating compiled schema for"; //NOI18N
92.60 - }
92.61 - }
92.62 -
92.63 - protected Schema getSchema(Model model) {
92.64 - if (! (model instanceof SchemaModel)) {
92.65 - return null;
92.66 - }
92.67 -
92.68 - // This will not be used as validate(.....) method is being overridden here.
92.69 - // So just return a schema returned by newSchema().
92.70 - return _schema;
92.71 - }
92.72 -
92.73 - public String getName() {
92.74 - return _bundle.getString("validator_provider.lbl.provider_name");
92.75 - }
92.76 -
92.77 - @Override
92.78 - protected void validate(Model model, Schema schema, XsdBasedValidator.Handler handler) {
92.79 - try {
92.80 - new CustomEncoderValidator((SchemaModel) model, handler).validate();
92.81 - } catch(Exception ex) {
92.82 - handler.logValidationErrors(Validator.ResultType.ERROR, ex.getMessage());
92.83 - }
92.84 - }
92.85 -
92.86 - @Override
92.87 - public DocumentModel resolveResource(String systemId, Model model) {
92.88 - try {
92.89 - CatalogModel cm = (CatalogModel) model.getModelSource().getLookup()
92.90 - .lookup(CatalogModel.class);
92.91 - ModelSource ms = cm.getModelSource(new URI(systemId));
92.92 - if (ms != null) {
92.93 - return SchemaModelFactory.getDefault().getModel(ms);
92.94 - }
92.95 - } catch(URISyntaxException ex) {
92.96 - Logger.getLogger(getClass().getName()).log(Level.FINE, "resolveResource", ex); //NOI18N
92.97 - } catch(CatalogModelException ex) {
92.98 - Logger.getLogger(getClass().getName()).log(Level.FINE, "resolveResource", ex); //NOI18N
92.99 - }
92.100 - return null;
92.101 - }
92.102 -}
93.1 --- a/encoder.hl7.aip/build.xml Sat Sep 27 15:34:52 2008 -0700
93.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
93.3 @@ -1,8 +0,0 @@
93.4 -<?xml version="1.0" encoding="UTF-8"?>
93.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
93.6 -<!-- for some information on what you could do (e.g. targets to override). -->
93.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
93.8 -<project name="org.netbeans.modules.encoder.hl7.aip" default="netbeans" basedir=".">
93.9 - <description>Builds, tests, and runs the project org.netbeans.modules.encoder.hl7.aip.</description>
93.10 - <import file="../../nbbuild/templates/projectized.xml"/>
93.11 -</project>
94.1 --- a/encoder.hl7.aip/manifest.mf Sat Sep 27 15:34:52 2008 -0700
94.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
94.3 @@ -1,6 +0,0 @@
94.4 -Manifest-Version: 1.0
94.5 -OpenIDE-Module: org.netbeans.modules.encoder.hl7.aip
94.6 -OpenIDE-Module-Layer: org/netbeans/modules/encoder/hl7/aip/layer.xml
94.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/encoder/hl7/aip/Bundle.properties
94.8 -OpenIDE-Module-Install: org/netbeans/modules/encoder/hl7/aip/HL7AIPModuleInstaller.class
94.9 -OpenIDE-Module-Specification-Version: 1.0.1
95.1 --- a/encoder.hl7.aip/nbproject/project.properties Sat Sep 27 15:34:52 2008 -0700
95.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
95.3 @@ -1,4 +0,0 @@
95.4 -javac.compilerargs=-Xlint:unchecked
95.5 -javac.source=1.5
95.6 -license.file=../cddl.txt
95.7 -nbm.homepage=http://wiki.open-esb.java.net/jbiwiki/Wiki.jsp?page=HL7
96.1 --- a/encoder.hl7.aip/nbproject/project.xml Sat Sep 27 15:34:52 2008 -0700
96.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
96.3 @@ -1,120 +0,0 @@
96.4 -<?xml version="1.0" encoding="UTF-8"?>
96.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
96.6 - <type>org.netbeans.modules.apisupport.project</type>
96.7 - <configuration>
96.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
96.9 - <code-name-base>org.netbeans.modules.encoder.hl7.aip</code-name-base>
96.10 - <module-dependencies>
96.11 - <dependency>
96.12 - <code-name-base>org.netbeans.api.progress</code-name-base>
96.13 - <build-prerequisite/>
96.14 - <compile-dependency/>
96.15 - <run-dependency>
96.16 - <release-version>1</release-version>
96.17 - <specification-version>1.5.22</specification-version>
96.18 - </run-dependency>
96.19 - </dependency>
96.20 - <dependency>
96.21 - <code-name-base>org.netbeans.modules.encoder.ui.basic</code-name-base>
96.22 - <build-prerequisite/>
96.23 - <compile-dependency/>
96.24 - <run-dependency>
96.25 - <specification-version>1.0</specification-version>
96.26 - </run-dependency>
96.27 - </dependency>
96.28 - <dependency>
96.29 - <code-name-base>org.netbeans.modules.xml.schema.model</code-name-base>
96.30 - <build-prerequisite/>
96.31 - <compile-dependency/>
96.32 - <run-dependency>
96.33 - <release-version>1</release-version>
96.34 - <specification-version>1.1.22</specification-version>
96.35 - </run-dependency>
96.36 - </dependency>
96.37 - <dependency>
96.38 - <code-name-base>org.netbeans.modules.xml.schema.ui.basic</code-name-base>
96.39 - <build-prerequisite/>
96.40 - <compile-dependency/>
96.41 - <run-dependency>
96.42 - <release-version>1</release-version>
96.43 - <specification-version>1.2</specification-version>
96.44 - </run-dependency>
96.45 - </dependency>
96.46 - <dependency>
96.47 - <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
96.48 - <build-prerequisite/>
96.49 - <compile-dependency/>
96.50 - <run-dependency>
96.51 - <release-version>1</release-version>
96.52 - <specification-version>1.1.22</specification-version>
96.53 - </run-dependency>
96.54 - </dependency>
96.55 - <dependency>
96.56 - <code-name-base>org.openide.dialogs</code-name-base>
96.57 - <build-prerequisite/>
96.58 - <compile-dependency/>
96.59 - <run-dependency>
96.60 - <specification-version>6.5.22</specification-version>
96.61 - </run-dependency>
96.62 - </dependency>
96.63 - <dependency>
96.64 - <code-name-base>org.openide.filesystems</code-name-base>
96.65 - <build-prerequisite/>
96.66 - <compile-dependency/>
96.67 - <run-dependency>
96.68 - <specification-version>6.4.22</specification-version>
96.69 - </run-dependency>
96.70 - </dependency>
96.71 - <dependency>
96.72 - <code-name-base>org.openide.io</code-name-base>
96.73 - <build-prerequisite/>
96.74 - <compile-dependency/>
96.75 - <run-dependency>
96.76 - <specification-version>1.9.22</specification-version>
96.77 - </run-dependency>
96.78 - </dependency>
96.79 - <dependency>
96.80 - <code-name-base>org.openide.loaders</code-name-base>
96.81 - <build-prerequisite/>
96.82 - <compile-dependency/>
96.83 - <run-dependency>
96.84 - <specification-version>5.9.22</specification-version>
96.85 - </run-dependency>
96.86 - </dependency>
96.87 - <dependency>
96.88 - <code-name-base>org.openide.modules</code-name-base>
96.89 - <build-prerequisite/>
96.90 - <compile-dependency/>
96.91 - <run-dependency>
96.92 - <specification-version>6.5.22</specification-version>
96.93 - </run-dependency>
96.94 - </dependency>
96.95 - <dependency>
96.96 - <code-name-base>org.openide.nodes</code-name-base>
96.97 - <build-prerequisite/>
96.98 - <compile-dependency/>
96.99 - <run-dependency>
96.100 - <specification-version>6.7.22</specification-version>
96.101 - </run-dependency>
96.102 - </dependency>
96.103 - <dependency>
96.104 - <code-name-base>org.openide.util</code-name-base>
96.105 - <build-prerequisite/>
96.106 - <compile-dependency/>
96.107 - <run-dependency>
96.108 - <specification-version>6.8.22</specification-version>
96.109 - </run-dependency>
96.110 - </dependency>
96.111 - <dependency>
96.112 - <code-name-base>org.openide.windows</code-name-base>
96.113 - <build-prerequisite/>
96.114 - <compile-dependency/>
96.115 - <run-dependency>
96.116 - <specification-version>6.5.22</specification-version>
96.117 - </run-dependency>
96.118 - </dependency>
96.119 - </module-dependencies>
96.120 - <public-packages/>
96.121 - </data>
96.122 - </configuration>
96.123 -</project>
97.1 --- a/encoder.hl7.aip/src/META-INF/services/org.netbeans.modules.xml.schema.ui.basic.spi.AppInfoProvider Sat Sep 27 15:34:52 2008 -0700
97.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
97.3 @@ -1,1 +0,0 @@
97.4 -org.netbeans.modules.encoder.hl7.aip.HL7EncoderAppInfoProvider
98.1 --- a/encoder.hl7.aip/src/META-INF/services/org.netbeans.modules.xml.xam.spi.Validator Sat Sep 27 15:34:52 2008 -0700
98.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
98.3 @@ -1,1 +0,0 @@
98.4 -org.netbeans.modules.encoder.hl7.aip.validation.ValidationProvider
99.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
99.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
99.3 @@ -1,30 +0,0 @@
99.4 -OpenIDE-Module-Display-Category=ESB
99.5 -OpenIDE-Module-Long-Description=\
99.6 - An implementation of XSD editor's AppInfoProvider SPI, which plugs HL7 encoder GUI extension into XSD editor
99.7 -OpenIDE-Module-Name=Encoder Editor - HL7
99.8 -
99.9 -encoding_node.lbl.encoding=encoding
99.10 -
99.11 -encoding_node.exp.no_such_mthd=No such method exception
99.12 -
99.13 -encoding_node.lbl.long_name=Long Name
99.14 -
99.15 -encoding_node.lbl.table=Table
99.16 -
99.17 -encoding_node.lbl.type=Type
99.18 -
99.19 -encoding_node.lbl.item=Item
99.20 -
99.21 -encoding_node.lbl.set_HL7_properties=Set HL7 Properties
99.22 -
99.23 -encoding_node.lbl.top=Top
99.24 -
99.25 -encoding_node.lbl.encoding_style_s=Encoding Style
99.26 -
99.27 -encoding_node.lbl.encoding_style=Encoding Style
99.28 -
99.29 -encoding_opt.exp.illegal_component_path=Illegal component path. Size < 1
99.30 -
99.31 -encoding_opt.exp.no_component_path=no component path
99.32 -
99.33 -encoding_opt.exp.invalid_appinfo=Schema component ''{0}'': Invalid HL7 encoder <appinfo>: Unrecognized element: '{'{1}'}'{2}
100.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/EncodingNode.java Sat Sep 27 15:34:52 2008 -0700
100.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
100.3 @@ -1,183 +0,0 @@
100.4 -/*
100.5 - * The contents of this file are subject to the terms of the Common Development
100.6 - * and Distribution License (the License). You may not use this file except in
100.7 - * compliance with the License.
100.8 - *
100.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
100.10 - * or http://www.netbeans.org/cddl.txt.
100.11 -
100.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
100.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
100.14 - * If applicable, add the following below the CDDL Header, with the fields
100.15 - * enclosed by brackets [] replaced by your own identifying information:
100.16 - * "Portions Copyrighted [year] [name of copyright owner]"
100.17 - *
100.18 - * The Original Software is NetBeans. The Initial Developer of the Original
100.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
100.20 - * Microsystems, Inc. All Rights Reserved.
100.21 - */
100.22 -
100.23 -package org.netbeans.modules.encoder.hl7.aip;
100.24 -
100.25 -import java.awt.Image;
100.26 -import java.beans.PropertyChangeEvent;
100.27 -import java.beans.PropertyChangeListener;
100.28 -import java.lang.reflect.InvocationTargetException;
100.29 -import java.util.HashSet;
100.30 -import java.util.ResourceBundle;
100.31 -import java.util.Set;
100.32 -import org.openide.nodes.AbstractNode;
100.33 -import org.openide.nodes.Children;
100.34 -import org.openide.nodes.PropertySupport;
100.35 -import org.openide.nodes.Sheet;
100.36 -import org.openide.util.Lookup;
100.37 -import org.openide.util.Utilities;
100.38 -import org.openide.util.WeakListeners;
100.39 -
100.40 -/**
100.41 - * The node implementation for displaying encoding information.
100.42 - *
100.43 - * @author Jun Xu
100.44 - */
100.45 -public class EncodingNode extends AbstractNode
100.46 - implements PropertyChangeListener {
100.47 -
100.48 - private static final ResourceBundle _bundle =
100.49 - ResourceBundle.getBundle("org/netbeans/modules/encoder/hl7/aip/Bundle");
100.50 - private static final Set<String> mChangeSheetPropNames = new HashSet<String>();
100.51 - static {
100.52 - mChangeSheetPropNames.add("setHL7Props"); //NOI18N
100.53 - }
100.54 -
100.55 - private final EncodingOption mEncodingOption;
100.56 -
100.57 - /** Creates a new instance of EncodingInfoNode */
100.58 - public EncodingNode(EncodingOption encodingOption, Lookup lookup) {
100.59 - super(new Children.Array(), lookup);
100.60 - mEncodingOption = encodingOption;
100.61 - encodingOption.addPropertyChangeListener(
100.62 - WeakListeners.propertyChange(this, encodingOption));
100.63 - }
100.64 -
100.65 - public String getDisplayName() {
100.66 - return _bundle.getString("encoding_node.lbl.encoding");
100.67 - }
100.68 -
100.69 - public String getName() {
100.70 - return "encoding"; //NOI18N
100.71 - }
100.72 -
100.73 - public boolean canRename() {
100.74 - return false;
100.75 - }
100.76 -
100.77 - public boolean canCut() {
100.78 - return false;
100.79 - }
100.80 -
100.81 - public boolean canCopy() {
100.82 - return false;
100.83 - }
100.84 -
100.85 - public String getHtmlDisplayName() {
100.86 - if (mEncodingOption == null) {
100.87 - //Must be some kind of invalid XML causing this.
100.88 - //Display it using warning color
100.89 - return "<font color='!controlShadow'><i>" + getDisplayName() + "</i></font>"; //NOI18N
100.90 - }
100.91 - return null;
100.92 - }
100.93 -
100.94 - public Image getIcon(int i) {
100.95 - return Utilities.loadImage("org/netbeans/modules/encoder/hl7/aip/icon.PNG"); //NOI18N
100.96 - }
100.97 -
100.98 - public Image getOpenedIcon(int i) {
100.99 - return Utilities.loadImage("org/netbeans/modules/encoder/hl7/aip/openIcon.PNG"); //NOI18N
100.100 - }
100.101 -
100.102 - protected Sheet createSheet() {
100.103 - Sheet sheet = Sheet.createDefault();
100.104 - Sheet.Set propSet = Sheet.createPropertiesSet();
100.105 - try {
100.106 - //The read-only encoding style property
100.107 - propSet.put(new EncodingStyleProperty(
100.108 - "encodingStyle", //NOI18N
100.109 - String.class,
100.110 - _bundle.getString("encoding_node.lbl.encoding_style"),
100.111 - _bundle.getString("encoding_node.lbl.encoding_style_s")));
100.112 -
100.113 - //The Node Type Property
100.114 - if (mEncodingOption.testIsGlobal()) {
100.115 - //The Top Property
100.116 - PropertySupport.Reflection topProp =
100.117 - new PropertySupport.Reflection(mEncodingOption,
100.118 - boolean.class, "top"); //NOI18N
100.119 - topProp.setName("top"); //NOI18N
100.120 - topProp.setDisplayName(_bundle.getString("encoding_node.lbl.top"));
100.121 - propSet.put(topProp);
100.122 - }
100.123 -
100.124 - if (!mEncodingOption.testIsUnderElement()) {
100.125 - PropertySupport.Reflection setHL7PropsProp =
100.126 - new PropertySupport.Reflection(mEncodingOption,
100.127 - boolean.class, "setHL7Props"); //NOI18N
100.128 - setHL7PropsProp.setName("setHL7Props"); //NOI18N
100.129 - setHL7PropsProp.setDisplayName(
100.130 - _bundle.getString("encoding_node.lbl.set_HL7_properties"));
100.131 - propSet.put(setHL7PropsProp);
100.132 - }
100.133 -
100.134 - if (mEncodingOption.isSetHL7Props()) {
100.135 - PropertySupport.Reflection itemProp =
100.136 - new PropertySupport.Reflection(mEncodingOption,
100.137 - String.class, "item"); //NOI18N
100.138 - itemProp.setName("item"); //NOI18N
100.139 - itemProp.setDisplayName(_bundle.getString("encoding_node.lbl.item"));
100.140 - propSet.put(itemProp);
100.141 -
100.142 - PropertySupport.Reflection typeProp =
100.143 - new PropertySupport.Reflection(mEncodingOption,
100.144 - String.class, "type"); //NOI18N
100.145 - typeProp.setName("type"); //NOI18N
100.146 - typeProp.setDisplayName(_bundle.getString("encoding_node.lbl.type"));
100.147 - propSet.put(typeProp);
100.148 -
100.149 - PropertySupport.Reflection tableProp =
100.150 - new PropertySupport.Reflection(mEncodingOption,
100.151 - String.class, "table"); //NOI18N
100.152 - tableProp.setName("table"); //NOI18N
100.153 - tableProp.setDisplayName(_bundle.getString("encoding_node.lbl.table"));
100.154 - propSet.put(tableProp);
100.155 -
100.156 - PropertySupport.Reflection longNameProp =
100.157 - new PropertySupport.Reflection(mEncodingOption,
100.158 - String.class, "longName"); //NOI18N
100.159 - longNameProp.setName("longName"); //NOI18N
100.160 - longNameProp.setDisplayName(_bundle.getString("encoding_node.lbl.long_name"));
100.161 - propSet.put(longNameProp);
100.162 - }
100.163 - } catch (NoSuchMethodException e) {
100.164 - throw new RuntimeException(_bundle.getString("encoding_node.exp.no_such_mthd"), e);
100.165 - }
100.166 - sheet.put(propSet);
100.167 - return sheet;
100.168 - }
100.169 -
100.170 - public void propertyChange(PropertyChangeEvent evt) {
100.171 - if (mChangeSheetPropNames.contains(evt.getPropertyName())) {
100.172 - setSheet(createSheet());
100.173 - }
100.174 - }
100.175 -
100.176 - private static class EncodingStyleProperty extends PropertySupport.ReadOnly {
100.177 -
100.178 - EncodingStyleProperty(String name, Class clazz, String displayName, String desc) {
100.179 - super(name, clazz, displayName, desc);
100.180 - }
100.181 -
100.182 - public Object getValue() throws IllegalAccessException, InvocationTargetException {
100.183 - return HL7EncodingConst.STYLE;
100.184 - }
100.185 - }
100.186 -}
101.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/EncodingOption.java Sat Sep 27 15:34:52 2008 -0700
101.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
101.3 @@ -1,333 +0,0 @@
101.4 -/*
101.5 - * The contents of this file are subject to the terms of the Common Development
101.6 - * and Distribution License (the License). You may not use this file except in
101.7 - * compliance with the License.
101.8 - *
101.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
101.10 - * or http://www.netbeans.org/cddl.txt.
101.11 -
101.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
101.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
101.14 - * If applicable, add the following below the CDDL Header, with the fields
101.15 - * enclosed by brackets [] replaced by your own identifying information:
101.16 - * "Portions Copyrighted [year] [name of copyright owner]"
101.17 - *
101.18 - * The Original Software is NetBeans. The Initial Developer of the Original
101.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
101.20 - * Microsystems, Inc. All Rights Reserved.
101.21 - */
101.22 -
101.23 -package org.netbeans.modules.encoder.hl7.aip;
101.24 -
101.25 -import java.beans.PropertyChangeEvent;
101.26 -import java.beans.PropertyChangeListener;
101.27 -import java.io.CharConversionException;
101.28 -import java.io.IOException;
101.29 -import java.util.Collection;
101.30 -import java.util.Collections;
101.31 -import java.util.HashMap;
101.32 -import java.util.LinkedList;
101.33 -import java.util.List;
101.34 -import java.util.Map;
101.35 -import java.util.ResourceBundle;
101.36 -import javax.xml.namespace.QName;
101.37 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
101.38 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
101.39 -import org.netbeans.modules.encoder.ui.basic.SchemaUtility;
101.40 -import org.netbeans.modules.xml.schema.model.Annotation;
101.41 -import org.netbeans.modules.xml.schema.model.AppInfo;
101.42 -import org.netbeans.modules.xml.schema.model.Element;
101.43 -import org.netbeans.modules.xml.schema.model.ElementReference;
101.44 -import org.netbeans.modules.xml.schema.model.GlobalElement;
101.45 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
101.46 -import org.openide.util.NbBundle;
101.47 -import org.openide.xml.XMLUtil;
101.48 -import org.w3c.dom.NodeList;
101.49 -
101.50 -/**
101.51 - * The model of the HL7 encoding node.
101.52 - *
101.53 - * @author Jun Xu
101.54 - */
101.55 -public class EncodingOption {
101.56 -
101.57 - private static final ResourceBundle _bundle =
101.58 - ResourceBundle.getBundle("org/netbeans/modules/encoder/hl7/aip/Bundle");
101.59 - private static final String[] mPropKeys = new String[] {"top", "itm", "typ", "tbl", "lnm"}; //NOI18N
101.60 - private static final QName[] mPropNames = new QName[] {
101.61 - new QName(EncodingConst.URI, EncodingConst.TOP_FLAG, "enc"), //NOI18N
101.62 - new QName(HL7EncodingConst.URI, "Item", "hl7"), //NOI18N
101.63 - new QName(HL7EncodingConst.URI, "Type", "hl7"), //NOI18N
101.64 - new QName(HL7EncodingConst.URI, "Table", "hl7"), //NOI18N
101.65 - new QName(HL7EncodingConst.URI, "LongName", "hl7") //NOI18N
101.66 - };
101.67 - private static final String KEY_TOP = mPropKeys[0];
101.68 - private static final String KEY_ITEM = mPropKeys[1];
101.69 - private static final String KEY_TYPE = mPropKeys[2];
101.70 - private static final String KEY_TABLE = mPropKeys[3];
101.71 - private static final String KEY_LONG_NAME = mPropKeys[4];
101.72 -
101.73 - private static final Map<QName, String> mName2Key = new HashMap<QName, String>();
101.74 - static {
101.75 - for (int i = 0; i < mPropNames.length; i++) {
101.76 - mName2Key.put(mPropNames[i], mPropKeys[i]);
101.77 - }
101.78 - }
101.79 -
101.80 - private final Map<String, String> mPropMap = new HashMap<String, String>();
101.81 -
101.82 - /* Bean property change listeners */
101.83 - private final List<PropertyChangeListener> propChangeListeners =
101.84 - Collections.synchronizedList(new LinkedList<PropertyChangeListener>());
101.85 -
101.86 - /* Component path from which the encoding options are read */
101.87 - private final SchemaComponent[] mComponentPath;
101.88 -
101.89 - private AppInfo mAppInfo;
101.90 -
101.91 - private boolean mSetHL7Props;
101.92 -
101.93 - /** Creates a new instance of EncodingOption */
101.94 - private EncodingOption(List<SchemaComponent> path) {
101.95 - if (path == null) {
101.96 - throw new NullPointerException(
101.97 - _bundle.getString("encoding_opt.exp.no_component_path"));
101.98 - }
101.99 - if (path.size() < 1) {
101.100 - throw new IllegalArgumentException(
101.101 - _bundle.getString("encoding_opt.exp.illegal_component_path"));
101.102 - }
101.103 - mComponentPath = path.toArray(new SchemaComponent[0]);
101.104 - }
101.105 -
101.106 - public static EncodingOption createFromAppInfo(List<SchemaComponent> path)
101.107 - throws InvalidAppInfoException {
101.108 -
101.109 - EncodingOption option = new EncodingOption(path);
101.110 - if (!option.init()) {
101.111 - return null;
101.112 - }
101.113 - return option;
101.114 - }
101.115 -
101.116 - public boolean isSetHL7Props() {
101.117 - return mSetHL7Props;
101.118 - }
101.119 -
101.120 - public void setSetHL7Props(boolean value) throws IOException {
101.121 - boolean old = mSetHL7Props;
101.122 - if (!value) {
101.123 - for (int i = 0; i < mPropNames.length; i++) {
101.124 - if ("hl7".equals(mPropNames[i].getPrefix())) { //NOI18N
101.125 - mPropMap.remove(mName2Key.get(mPropNames[i]));
101.126 - }
101.127 - }
101.128 - }
101.129 - mSetHL7Props = value;
101.130 - commitToAppInfo();
101.131 - firePropertyChange("setHL7Props", old, mSetHL7Props); //NOI18N
101.132 - }
101.133 -
101.134 - public String getItem() {
101.135 - return mPropMap.get(KEY_ITEM) == null ? "" : mPropMap.get(KEY_ITEM); //NOI18N
101.136 - }
101.137 -
101.138 - public void setItem(String item) throws IOException {
101.139 - String old = mPropMap.get(KEY_ITEM);
101.140 - mPropMap.put(KEY_ITEM, item);
101.141 - commitToAppInfo();
101.142 - firePropertyChange("item", old, item); //NOI18N
101.143 - }
101.144 -
101.145 - public String getType() {
101.146 - return mPropMap.get(KEY_TYPE) == null ? "" : mPropMap.get(KEY_TYPE); //NOI18N
101.147 - }
101.148 -
101.149 - public void setType(String type) throws IOException {
101.150 - String old = mPropMap.get(KEY_TYPE);
101.151 - mPropMap.put(KEY_TYPE, type);
101.152 - commitToAppInfo();
101.153 - firePropertyChange("type", old, mPropMap.get(KEY_TYPE)); //NOI18N
101.154 - }
101.155 -
101.156 - public String getTable() {
101.157 - return mPropMap.get(KEY_TABLE) == null ? "" : mPropMap.get(KEY_TABLE); //NOI18N
101.158 - }
101.159 -
101.160 - public void setTable(String table) throws IOException {
101.161 - String old = mPropMap.get(KEY_TABLE);
101.162 - mPropMap.put(KEY_TABLE, table);
101.163 - commitToAppInfo();
101.164 - firePropertyChange("table", old, mPropMap.get(KEY_TABLE)); //NOI18N
101.165 - }
101.166 -
101.167 - public String getLongName() {
101.168 - return mPropMap.get(KEY_LONG_NAME) == null ? "" : mPropMap.get(KEY_LONG_NAME); //NOI18N
101.169 - }
101.170 -
101.171 - public void setLongName(String longName) throws IOException {
101.172 - String old = mPropMap.get(KEY_LONG_NAME);
101.173 - mPropMap.put(KEY_LONG_NAME, longName);
101.174 - commitToAppInfo();
101.175 - firePropertyChange("longName", old, mPropMap.get(KEY_LONG_NAME)); //NOI18N
101.176 - }
101.177 -
101.178 - public boolean isTop() {
101.179 - return Boolean.valueOf(mPropMap.get(KEY_TOP)).booleanValue();
101.180 - }
101.181 -
101.182 - public void setTop(boolean top) throws IOException {
101.183 - Boolean old = Boolean.valueOf(mPropMap.get(KEY_TOP));
101.184 - mPropMap.put(KEY_TOP, Boolean.valueOf(top).toString());
101.185 - commitToAppInfo();
101.186 - firePropertyChange("top", old, Boolean.valueOf(mPropMap.get(KEY_TOP))); //NOI18N
101.187 - }
101.188 -
101.189 - public boolean testIsGlobal() {
101.190 - int count = 0;
101.191 - for (int i = 0; i < mComponentPath.length; i++) {
101.192 - if (mComponentPath[i] instanceof ElementReference) {
101.193 - return false;
101.194 - }
101.195 - }
101.196 - return annotation().getParent() instanceof GlobalElement;
101.197 - }
101.198 -
101.199 - public boolean testIsUnderElement() {
101.200 - return annotation().getParent() instanceof Element;
101.201 - }
101.202 -
101.203 - public void addPropertyChangeListener(PropertyChangeListener listener) {
101.204 - propChangeListeners.add(listener);
101.205 - }
101.206 -
101.207 - public void removePropertyChangeListener(PropertyChangeListener listener) {
101.208 - propChangeListeners.remove(listener);
101.209 - }
101.210 -
101.211 - private Annotation annotation() {
101.212 - return (Annotation) mComponentPath[mComponentPath.length - 1];
101.213 - }
101.214 -
101.215 - private boolean init() throws InvalidAppInfoException {
101.216 - mAppInfo = null;
101.217 - mPropMap.clear();
101.218 - Collection<AppInfo> appinfos = annotation().getAppInfos();
101.219 - if (appinfos != null) {
101.220 - for (AppInfo appinfo : appinfos) {
101.221 - if (!EncodingConst.URI.equals(appinfo.getURI())) {
101.222 - continue;
101.223 - }
101.224 - mAppInfo = appinfo;
101.225 - break;
101.226 - }
101.227 - }
101.228 - if (mAppInfo == null) {
101.229 - return false;
101.230 - }
101.231 - NodeList propNodes = mAppInfo.getPeer().getChildNodes();
101.232 - if (propNodes.getLength() == 0) {
101.233 - return true;
101.234 - }
101.235 - int i = 0;
101.236 - int j = 0;
101.237 - org.w3c.dom.Element elem;
101.238 - while (i < mPropNames.length) {
101.239 - innerLoop: while (j < propNodes.getLength()) {
101.240 - if (propNodes.item(j).getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) {
101.241 - j++;
101.242 - continue;
101.243 - }
101.244 - elem = (org.w3c.dom.Element) propNodes.item(j);
101.245 - if (!mPropNames[i].getNamespaceURI().equals(elem.getNamespaceURI())
101.246 - || !mPropNames[i].getLocalPart().equals(elem.getLocalName())) {
101.247 - i++;
101.248 - break innerLoop;
101.249 - }
101.250 -
101.251 - mPropMap.put(mName2Key.get(mPropNames[i]), getTextValue(elem));
101.252 - if ("hl7".equals(mPropNames[i].getPrefix())) { //NOI18N
101.253 - mSetHL7Props = true;
101.254 - }
101.255 - j++;
101.256 - i++;
101.257 - }
101.258 - if (j >= propNodes.getLength()) {
101.259 - break;
101.260 - }
101.261 - }
101.262 - if (j < propNodes.getLength()) {
101.263 - //There must be something not matched
101.264 - String msg =
101.265 - NbBundle.getMessage(
101.266 - EncodingOption.class,
101.267 - "encoding_opt.exp.invalid_appinfo", //NOI18N
101.268 - SchemaUtility.getNCNamePath(mComponentPath),
101.269 - propNodes.item(j).getNamespaceURI(),
101.270 - propNodes.item(j).getLocalName());
101.271 - throw new InvalidAppInfoException(msg);
101.272 - }
101.273 - return true;
101.274 - }
101.275 -
101.276 - private String getTextValue(org.w3c.dom.Element elem) {
101.277 - NodeList childList = elem.getChildNodes();
101.278 - if (childList == null || childList.getLength() == 0) {
101.279 - return ""; //NOI18N
101.280 - }
101.281 - for (int i = 0; i < childList.getLength(); i++) {
101.282 - if (childList.item(i).getNodeType() == org.w3c.dom.Node.TEXT_NODE) {
101.283 - if (childList.item(i).getNodeValue() == null) {
101.284 - return ""; //NOI18N
101.285 - }
101.286 - return childList.item(i).getNodeValue();
101.287 - }
101.288 - }
101.289 - return ""; //NOI18N
101.290 - }
101.291 -
101.292 - private synchronized void commitToAppInfo() throws IOException {
101.293 - if (mAppInfo == null) {
101.294 - return;
101.295 - }
101.296 - boolean startedTrans = false;
101.297 - try {
101.298 - if (!mAppInfo.getModel().isIntransaction()) {
101.299 - if (!mAppInfo.getModel().startTransaction()) {
101.300 - //TODO how to handle???
101.301 - }
101.302 - startedTrans = true;
101.303 - }
101.304 - mAppInfo.setContentFragment(contentFragment());
101.305 - } finally {
101.306 - if (startedTrans) {
101.307 - mAppInfo.getModel().endTransaction();
101.308 - }
101.309 - }
101.310 - }
101.311 -
101.312 - private void firePropertyChange(String name, Object oldObj, Object newObj) {
101.313 - PropertyChangeListener[] pcls = (PropertyChangeListener[])
101.314 - propChangeListeners.toArray(new PropertyChangeListener[0]);
101.315 - for (int i = 0; i < pcls.length; i++) {
101.316 - pcls[i].propertyChange(
101.317 - new PropertyChangeEvent (this, name, oldObj, newObj));
101.318 - }
101.319 - }
101.320 -
101.321 - private String contentFragment() throws CharConversionException {
101.322 - StringBuffer sb = new StringBuffer();
101.323 - for (int i = 0; i < mPropKeys.length; i++) {
101.324 - if (mPropMap.containsKey(mPropKeys[i])) {
101.325 - sb.append("<").append(mPropNames[i].getPrefix()); //NOI18N
101.326 - sb.append(':').append(mPropNames[i].getLocalPart()); //NOI18N
101.327 - sb.append(" xmlns:").append(mPropNames[i].getPrefix()); //NOI18N
101.328 - sb.append("=\"").append(mPropNames[i].getNamespaceURI()).append("\">"); //NOI18N
101.329 - sb.append(XMLUtil.toAttributeValue(mPropMap.get(mPropKeys[i])));
101.330 - sb.append("</").append(mPropNames[i].getPrefix()).append(':'); //NOI18N
101.331 - sb.append(mPropNames[i].getLocalPart()).append('>'); //NOI18N
101.332 - }
101.333 - }
101.334 - return sb.toString();
101.335 - }
101.336 -}
102.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/HL7AIPModuleInstaller.java Sat Sep 27 15:34:52 2008 -0700
102.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
102.3 @@ -1,138 +0,0 @@
102.4 -/*
102.5 - * HL7AIPModuleInstaller.java
102.6 - *
102.7 - * Created on February 1, 2007, 5:17 PM
102.8 - *
102.9 - * To change this template, choose Tools | Template Manager
102.10 - * and open the template in the editor.
102.11 - */
102.12 -
102.13 -package org.netbeans.modules.encoder.hl7.aip;
102.14 -
102.15 -import java.beans.PropertyChangeEvent;
102.16 -import java.beans.PropertyChangeListener;
102.17 -import java.util.List;
102.18 -import javax.swing.SwingUtilities;
102.19 -import javax.xml.XMLConstants;
102.20 -import javax.xml.namespace.QName;
102.21 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
102.22 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
102.23 -import org.netbeans.modules.xml.schema.model.Annotation;
102.24 -import org.netbeans.modules.xml.schema.model.AppInfo;
102.25 -import org.netbeans.modules.xml.schema.model.Element;
102.26 -import org.netbeans.modules.xml.schema.model.ElementReference;
102.27 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
102.28 -import org.netbeans.modules.xml.schema.model.SchemaModel;
102.29 -import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
102.30 -import org.openide.modules.ModuleInstall;
102.31 -import org.openide.util.WeakListeners;
102.32 -
102.33 -/**
102.34 - * The ModuleInstall implementation of this module.
102.35 - *
102.36 - * @author Jun Xu
102.37 - */
102.38 -public class HL7AIPModuleInstaller extends ModuleInstall {
102.39 -
102.40 - private static final SMFPropertyChangeListener mSMFPropertyChangeListener =
102.41 - new SMFPropertyChangeListener();
102.42 -
102.43 - public void restored() {
102.44 - super.restored();
102.45 - SchemaModelFactory.getDefault().addPropertyChangeListener(
102.46 - WeakListeners.propertyChange(mSMFPropertyChangeListener,
102.47 - SchemaModelFactory.getDefault()));
102.48 - }
102.49 -
102.50 - private static class SMFPropertyChangeListener implements PropertyChangeListener {
102.51 -
102.52 - private static final SchemaModelPropListener mModelPropListener =
102.53 - new SchemaModelPropListener();
102.54 -
102.55 - public void propertyChange(PropertyChangeEvent evt) {
102.56 - if (SchemaModelFactory.MODEL_LOADED_PROPERTY.equals(evt.getPropertyName())
102.57 - && (evt.getNewValue() instanceof SchemaModel)) {
102.58 - SchemaModel model = (SchemaModel) evt.getNewValue();
102.59 - model.addPropertyChangeListener(WeakListeners.propertyChange(
102.60 - mModelPropListener,
102.61 - model));
102.62 - }
102.63 - }
102.64 -
102.65 - }
102.66 -
102.67 - private static class SchemaModelPropListener implements PropertyChangeListener {
102.68 -
102.69 - private static final QName TYPE_ATTR_NAME = new QName("type"); //NOI18N
102.70 -
102.71 - public void propertyChange(PropertyChangeEvent evt) {
102.72 - if (evt.getOldValue() != null || !(evt.getNewValue() instanceof Element)
102.73 - || (evt.getNewValue() instanceof ElementReference)
102.74 - || !("content".equals(evt.getPropertyName()) //NOI18N
102.75 - || "elements".equals(evt.getPropertyName()))) { //NOI18N
102.76 - return;
102.77 - }
102.78 - final Element elem = (Element) evt.getNewValue();
102.79 - List<SchemaComponent> children;
102.80 - String tv;
102.81 - if (elem == null || elem.getModel().inSync()
102.82 - || !ModelUtils.isEncodedWith(elem.getModel(), HL7EncodingConst.STYLE)) {
102.83 - return;
102.84 - }
102.85 - boolean setTypeToString = true;
102.86 - if (((children = elem.getChildren()) != null && !children.isEmpty())
102.87 - || ((tv = elem.getAnyAttribute(TYPE_ATTR_NAME)) != null && tv.length() > 0)) {
102.88 - setTypeToString = false;
102.89 - }
102.90 - final boolean setTypeToStringFinal = setTypeToString;
102.91 - SwingUtilities.invokeLater(new Runnable() {
102.92 - public void run() {
102.93 - SchemaModel model = elem.getModel();
102.94 - if (model.inSync()) {
102.95 - return;
102.96 - }
102.97 -
102.98 - boolean startedTrans = false;
102.99 - try {
102.100 - if (!model.isIntransaction()) {
102.101 - if (!model.startTransaction()) {
102.102 - //TODO: how to handle
102.103 - }
102.104 - startedTrans = true;
102.105 - }
102.106 - processElementDefault(elem, setTypeToStringFinal);
102.107 - } finally {
102.108 - if (startedTrans) {
102.109 - model.endTransaction();
102.110 - }
102.111 - }
102.112 - }
102.113 - });
102.114 - }
102.115 -
102.116 - private void processElementDefault(Element elem, boolean setTypeToString) {
102.117 - if (setTypeToString) {
102.118 - org.w3c.dom.Element domElem = elem.getPeer();
102.119 - if (domElem != null) {
102.120 - String prefix = domElem.lookupPrefix(XMLConstants.W3C_XML_SCHEMA_NS_URI);
102.121 - String value;
102.122 - if (prefix != null && prefix.length() > 0) {
102.123 - value = prefix + ":string"; //NOI18N
102.124 - } else {
102.125 - value = "string"; //NOI18N
102.126 - }
102.127 - elem.setAnyAttribute(TYPE_ATTR_NAME, value);
102.128 - }
102.129 - }
102.130 - Annotation anno = elem.getAnnotation();
102.131 - if (anno != null) {
102.132 - return;
102.133 - }
102.134 - anno = elem.getModel().getFactory().createAnnotation();
102.135 - elem.setAnnotation(anno);
102.136 - AppInfo appInfo = elem.getModel().getFactory().createAppInfo();
102.137 - appInfo.setURI(EncodingConst.URI);
102.138 - anno.addAppInfo(appInfo);
102.139 - }
102.140 - }
102.141 -}
103.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/HL7EncoderAppInfoProvider.java Sat Sep 27 15:34:52 2008 -0700
103.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
103.3 @@ -1,88 +0,0 @@
103.4 -/*
103.5 - * The contents of this file are subject to the terms of the Common Development
103.6 - * and Distribution License (the License). You may not use this file except in
103.7 - * compliance with the License.
103.8 - *
103.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
103.10 - * or http://www.netbeans.org/cddl.txt.
103.11 -
103.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
103.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
103.14 - * If applicable, add the following below the CDDL Header, with the fields
103.15 - * enclosed by brackets [] replaced by your own identifying information:
103.16 - * "Portions Copyrighted [year] [name of copyright owner]"
103.17 - *
103.18 - * The Original Software is NetBeans. The Initial Developer of the Original
103.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
103.20 - * Microsystems, Inc. All Rights Reserved.
103.21 - */
103.22 -
103.23 -package org.netbeans.modules.encoder.hl7.aip;
103.24 -
103.25 -import java.util.ArrayList;
103.26 -import java.util.List;
103.27 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
103.28 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
103.29 -import org.netbeans.modules.xml.schema.model.Annotation;
103.30 -import org.netbeans.modules.xml.schema.model.AppInfo;
103.31 -import org.netbeans.modules.xml.schema.model.ComplexType;
103.32 -import org.netbeans.modules.xml.schema.model.Element;
103.33 -import org.netbeans.modules.xml.schema.model.ElementReference;
103.34 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
103.35 -import org.netbeans.modules.xml.schema.model.SchemaModel;
103.36 -import org.netbeans.modules.xml.schema.model.SimpleType;
103.37 -import org.netbeans.modules.xml.schema.ui.basic.spi.AppInfoProvider;
103.38 -import org.openide.ErrorManager;
103.39 -import org.openide.nodes.Node;
103.40 -import org.openide.util.Lookup;
103.41 -import org.openide.util.lookup.Lookups;
103.42 -
103.43 -/**
103.44 - * <appinfo> provider that implements the HL7 encoder plug-in over
103.45 - * the XSD editor.
103.46 - *
103.47 - * @author Jun Xu
103.48 - */
103.49 -public class HL7EncoderAppInfoProvider extends AppInfoProvider {
103.50 -
103.51 - public boolean isActive(SchemaModel schemaModel) {
103.52 - return ModelUtils.isEncodedWith(schemaModel, HL7EncodingConst.STYLE);
103.53 - }
103.54 -
103.55 - public Node getNode(List<Node> nodes) {
103.56 - List<SchemaComponent> listComponents = new ArrayList<SchemaComponent>();
103.57 - SchemaComponent comp;
103.58 - SchemaComponent prevComp = null;
103.59 - for (Node node : nodes) {
103.60 - comp = (SchemaComponent) node.getLookup().lookup(SchemaComponent.class);
103.61 - if (comp != null && comp != prevComp) {
103.62 - listComponents.add(comp);
103.63 - prevComp = comp;
103.64 - }
103.65 - }
103.66 - Annotation annotation =
103.67 - (Annotation) nodes.get(nodes.size() - 1).getLookup().lookup(Annotation.class);
103.68 - if ((!(annotation.getParent() instanceof Element)
103.69 - || annotation.getParent() instanceof ElementReference)
103.70 - && !(annotation.getParent() instanceof ComplexType)
103.71 - && !(annotation.getParent() instanceof SimpleType)) {
103.72 - return null;
103.73 - }
103.74 - AppInfo encAppinfo = ModelUtils.getEncodingAppinfo(annotation);
103.75 - if (encAppinfo == null) {
103.76 - return null;
103.77 - }
103.78 - Lookup lookup = Lookups.singleton(encAppinfo);
103.79 - EncodingOption encodingOption;
103.80 - try {
103.81 - encodingOption = EncodingOption.createFromAppInfo(listComponents);
103.82 - } catch (InvalidAppInfoException e) {
103.83 - ErrorManager.getDefault().notify(e);
103.84 - return null;
103.85 - }
103.86 - if (encodingOption == null) {
103.87 - return null;
103.88 - }
103.89 - return new EncodingNode(encodingOption, lookup);
103.90 - }
103.91 -}
104.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/HL7EncodingConst.java Sat Sep 27 15:34:52 2008 -0700
104.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
104.3 @@ -1,34 +0,0 @@
104.4 -/*
104.5 - * The contents of this file are subject to the terms of the Common Development
104.6 - * and Distribution License (the License). You may not use this file except in
104.7 - * compliance with the License.
104.8 - *
104.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
104.10 - * or http://www.netbeans.org/cddl.txt.
104.11 -
104.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
104.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
104.14 - * If applicable, add the following below the CDDL Header, with the fields
104.15 - * enclosed by brackets [] replaced by your own identifying information:
104.16 - * "Portions Copyrighted [year] [name of copyright owner]"
104.17 - *
104.18 - * The Original Software is NetBeans. The Initial Developer of the Original
104.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
104.20 - * Microsystems, Inc. All Rights Reserved.
104.21 - */
104.22 -
104.23 -package org.netbeans.modules.encoder.hl7.aip;
104.24 -
104.25 -/**
104.26 - * Class for holding HL7 encoding related constants.
104.27 - *
104.28 - * @author Jun Xu
104.29 - */
104.30 -public abstract class HL7EncodingConst {
104.31 -
104.32 - public static final String STYLE = "hl7encoder-1.0"; //NOI18N
104.33 -
104.34 - public static final String URI = "urn:com.sun:encoder-hl7-1.0"; //NOI18N
104.35 -
104.36 - public static final String NAME = "HL7 v2 Encoding"; //NOI18N
104.37 -}
105.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/action/ApplyHL7EncodingAction.java Sat Sep 27 15:34:52 2008 -0700
105.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
105.3 @@ -1,322 +0,0 @@
105.4 -/*
105.5 - * The contents of this file are subject to the terms of the Common Development
105.6 - * and Distribution License (the License). You may not use this file except in
105.7 - * compliance with the License.
105.8 - *
105.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
105.10 - * or http://www.netbeans.org/cddl.txt.
105.11 -
105.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
105.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
105.14 - * If applicable, add the following below the CDDL Header, with the fields
105.15 - * enclosed by brackets [] replaced by your own identifying information:
105.16 - * "Portions Copyrighted [year] [name of copyright owner]"
105.17 - *
105.18 - * The Original Software is NetBeans. The Initial Developer of the Original
105.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
105.20 - * Microsystems, Inc. All Rights Reserved.
105.21 - */
105.22 -
105.23 -package org.netbeans.modules.encoder.hl7.aip.action;
105.24 -
105.25 -import java.awt.Dialog;
105.26 -import java.awt.event.ActionEvent;
105.27 -import java.awt.event.ActionListener;
105.28 -import java.io.IOException;
105.29 -import java.util.ResourceBundle;
105.30 -import javax.swing.JOptionPane;
105.31 -import javax.swing.text.Document;
105.32 -import org.netbeans.modules.encoder.hl7.aip.HL7EncodingConst;
105.33 -import org.netbeans.modules.encoder.ui.basic.ApplyEncodingConfirmation;
105.34 -import org.netbeans.modules.encoder.ui.basic.ApplyEncodingException;
105.35 -import org.netbeans.modules.encoder.ui.basic.EncodingMark;
105.36 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
105.37 -import org.netbeans.modules.encoder.ui.basic.ModelVisitor;
105.38 -import org.netbeans.modules.encoder.ui.basic.ModelVisitorException;
105.39 -import org.netbeans.modules.encoder.ui.basic.ProgressDialog;
105.40 -import org.netbeans.modules.encoder.ui.basic.Utils;
105.41 -import org.netbeans.modules.xml.schema.model.SchemaModel;
105.42 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
105.43 -import org.openide.DialogDescriptor;
105.44 -import org.openide.DialogDisplayer;
105.45 -import org.openide.ErrorManager;
105.46 -import org.openide.filesystems.FileObject;
105.47 -import org.openide.loaders.DataObject;
105.48 -import org.openide.nodes.Node;
105.49 -import org.openide.util.HelpCtx;
105.50 -import org.openide.util.NbBundle;
105.51 -import org.openide.util.Utilities;
105.52 -import org.openide.util.actions.NodeAction;
105.53 -import org.openide.windows.InputOutput;
105.54 -import org.openide.windows.OutputWriter;
105.55 -import org.openide.windows.WindowManager;
105.56 -
105.57 -/**
105.58 - * Action that applies the HL7 encoding to an XSD.
105.59 - *
105.60 - * @author Jun Xu
105.61 - */
105.62 -public class ApplyHL7EncodingAction extends NodeAction {
105.63 -
105.64 - private static final ResourceBundle _bundle =
105.65 - ResourceBundle.getBundle("org/netbeans/modules/encoder/hl7/aip/action/Bundle");
105.66 - private static final String PROCESS = _bundle.getString("apply_hl7_enc.lbl.process");
105.67 - private static final String CANCEL = _bundle.getString("apply_hl7_enc.lbl.cancel");
105.68 -
105.69 - private boolean mIsApplied = false;
105.70 -
105.71 - public static void applyHL7Encoding(final SchemaModel model,
105.72 - final boolean applyToReferenced) throws IOException, CatalogModelException {
105.73 -
105.74 - InputOutput io = Utils.getEncodingIO();
105.75 - io.select();
105.76 - final OutputWriter console = io.getOut();
105.77 - console.println(_bundle.getString("apply_hl7_enc.msg.start_apply_hl7_encoding"));
105.78 -
105.79 - ModelUtils.ModelStatus modelStatus =
105.80 - ModelUtils.getModelStatus(model, applyToReferenced);
105.81 -
105.82 - if (modelStatus.getTotalCharSize() > 300 * 1024) {
105.83 - int estimate = (int) ((modelStatus.getTotalCharSize() / 18000.0 / 60.0) + 0.5);
105.84 - String msg = NbBundle.getMessage(ApplyHL7EncodingAction.class,
105.85 - "apply_hl7_enc.lbl.warn_big_file", estimate); //NOI18N
105.86 - int option =
105.87 - JOptionPane.showConfirmDialog(
105.88 - WindowManager.getDefault().getMainWindow(),
105.89 - msg,
105.90 - _bundle.getString("apply_hl7_enc.lbl.notify_lengthy_process"),
105.91 - JOptionPane.YES_NO_OPTION);
105.92 - if (option == JOptionPane.NO_OPTION) {
105.93 - console.println(_bundle.getString("apply_hl7_enc.msg.cancelled_by_user"));
105.94 - return;
105.95 - }
105.96 -
105.97 - final ProgressDialog progDialog =
105.98 - ProgressDialog.newInstance(_bundle.getString("apply_hl7_enc.lbl.applying_hl7_encoding"));
105.99 - new Thread(new Runnable() {
105.100 - public void run() {
105.101 -
105.102 - progDialog.getHandle().start();
105.103 - progDialog.getHandle().switchToIndeterminate();
105.104 - final ModelVisitor visitor = new ApplyHL7EncodingSync();
105.105 - try {
105.106 - ModelUtils.visitModel(model, visitor, applyToReferenced);
105.107 - } catch (CatalogModelException ex) {
105.108 - throw new RuntimeException(ex);
105.109 - } finally {
105.110 - progDialog.getHandle().finish();
105.111 - progDialog.getDialog().setVisible(false);
105.112 - }
105.113 - console.println(_bundle.getString("apply_hl7_enc.msg.finished_apply_hl7_encoding"));
105.114 - }
105.115 - }).start();
105.116 - progDialog.getDialog().setVisible(true);
105.117 - } else {
105.118 - ModelVisitor visitor = new ApplyHL7EncodingSync();
105.119 - ModelUtils.visitModel(model, visitor, applyToReferenced);
105.120 - console.println(_bundle.getString("apply_hl7_enc.msg.finished_apply_hl7_encoding"));
105.121 - }
105.122 - }
105.123 -
105.124 - protected void performAction(Node[] node) {
105.125 - try {
105.126 - Utils.getEncodingIO().getOut().reset();
105.127 - } catch (IOException ex) {
105.128 - //Ignore
105.129 - }
105.130 - showDialog(node);
105.131 - }
105.132 -
105.133 - private void showDialog(final Node[] node) {
105.134 - final ApplyEncodingConfirmation confirmPane = new ApplyEncodingConfirmation();
105.135 - confirmPane.setApplyToReferenced(true);
105.136 - DialogDescriptor dialogDescriptor =
105.137 - new DialogDescriptor(confirmPane,
105.138 - _bundle.getString("apply_hl7_enc.lbl.apply_hl7_encoding_title"),
105.139 - true,
105.140 - new Object[] {PROCESS, CANCEL},
105.141 - PROCESS,
105.142 - DialogDescriptor.BOTTOM_ALIGN,
105.143 - HelpCtx.DEFAULT_HELP,
105.144 - this);
105.145 - dialogDescriptor.setClosingOptions(new Object[] {PROCESS, CANCEL});
105.146 - dialogDescriptor.setButtonListener(new ActionListener() {
105.147 - public void actionPerformed(ActionEvent e) {
105.148 - String action = e.getActionCommand();
105.149 - if (action.equals(PROCESS)) {
105.150 - try {
105.151 - confirmPane.setCursor(Utilities.createProgressCursor(confirmPane));
105.152 - process(node, confirmPane.isApplyToReferenced());
105.153 - } finally {
105.154 - confirmPane.setCursor(null);
105.155 - }
105.156 - }
105.157 - }
105.158 - });
105.159 - Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
105.160 - dialog.setModal(true);
105.161 - dialog.setVisible(true);
105.162 - }
105.163 -
105.164 - private void process(final Node[] node, boolean applyToReferenced) {
105.165 - SchemaModel model = null;
105.166 - for (int nodeIndex = 0; nodeIndex < node.length; nodeIndex++) {
105.167 - try {
105.168 - model = ModelUtils.getSchemaModelFromNode(node[nodeIndex]);
105.169 - if (model == null) {
105.170 - continue;
105.171 - }
105.172 - applyHL7Encoding(model, applyToReferenced);
105.173 - } catch (IOException ex) {
105.174 - ErrorManager.getDefault().notify(ex);
105.175 - } catch (ApplyEncodingException ex) {
105.176 - ErrorManager.getDefault().notify(ex);
105.177 - } catch (CatalogModelException ex) {
105.178 - ErrorManager.getDefault().notify(ex);
105.179 - }
105.180 - }
105.181 - }
105.182 -
105.183 - public String getName() {
105.184 - if (mIsApplied) {
105.185 - return _bundle.getString("apply_hl7_enc.lbl.reapply_hl7_encoding");
105.186 - }
105.187 - return _bundle.getString("apply_hl7_enc.lbl.apply_hl7_encoding_menu");
105.188 - }
105.189 -
105.190 - public HelpCtx getHelpCtx() {
105.191 - return HelpCtx.DEFAULT_HELP;
105.192 - }
105.193 -
105.194 - protected boolean asynchronous() {
105.195 - return false;
105.196 - }
105.197 -
105.198 - protected boolean enable(Node[] node) {
105.199 - //Check if it is writable
105.200 - if (node == null || node.length == 0) {
105.201 - return false;
105.202 - }
105.203 - SchemaModel sm = null;
105.204 - try {
105.205 - sm = ModelUtils.getSchemaModelFromNode(node[0]);
105.206 - } catch (IOException ex) {
105.207 - ErrorManager.getDefault().log(ErrorManager.EXCEPTION,
105.208 - ex.toString());
105.209 - return false;
105.210 - }
105.211 - boolean writable = ModelUtils.isModelWritable(sm);
105.212 - if (!writable) {
105.213 - return false;
105.214 - }
105.215 - EncodingMark existingMark = ModelUtils.getEncodingMark(sm);
105.216 - if (existingMark != null) {
105.217 - if (HL7EncodingConst.STYLE.equals(existingMark.getStyle())) {
105.218 - //Already has HL7 encoding applied
105.219 - mIsApplied = true;
105.220 - return true;
105.221 - }
105.222 - //Already has other encoding applied
105.223 - mIsApplied = false;
105.224 - return false;
105.225 - }
105.226 - //No encoding has been applied
105.227 - mIsApplied = false;
105.228 - return true;
105.229 - }
105.230 -
105.231 - /**
105.232 - * Visitor class for applying HL7 encoding to the in-memory model and
105.233 - * with model always synchronized. For huge models, this process might be
105.234 - * very time consuming.
105.235 - */
105.236 - private static class ApplyHL7EncodingSync implements ModelVisitor {
105.237 -
105.238 - private OutputWriter mConsole = Utils.getEncodingIO().getOut();
105.239 - private boolean mSkip = false;
105.240 -
105.241 - public boolean visit(SchemaModel model) {
105.242 - if (!ModelUtils.isModelWritable(model)) {
105.243 - if (mSkip) {
105.244 - return true;
105.245 - }
105.246 - String msg = NbBundle.getMessage(ApplyHL7EncodingAction.class,
105.247 - "apply_hl7_enc.lbl.read_only_model", ModelUtils.getFilePath(model)); //NOI18N
105.248 - int option =
105.249 - JOptionPane.showConfirmDialog(
105.250 - WindowManager.getDefault().getMainWindow(),
105.251 - msg,
105.252 - _bundle.getString("apply_hl7_enc.lbl.read_only_model"),
105.253 - JOptionPane.YES_NO_OPTION);
105.254 - mConsole.println(
105.255 - NbBundle.getMessage(
105.256 - ApplyHL7EncodingAction.class,
105.257 - "apply_hl7_enc.msg.apply_hl7_enc_to", //NOI18N
105.258 - ModelUtils.getFilePath(model)));
105.259 - if (option == JOptionPane.NO_OPTION) {
105.260 - mConsole.println(_bundle.getString("apply_hl7_enc.msg.cancelled_by_user"));
105.261 - return false;
105.262 - }
105.263 - mSkip = true;
105.264 - return true;
105.265 - }
105.266 -
105.267 - mConsole.println(
105.268 - NbBundle.getMessage(
105.269 - ApplyHL7EncodingAction.class,
105.270 - "apply_hl7_enc.msg.apply_hl7_enc_to", //NOI18N
105.271 - ModelUtils.getFilePath(model)));
105.272 - boolean transStarted = false;
105.273 - try {
105.274 - if (!model.isIntransaction()) {
105.275 - if (!model.startTransaction()) {
105.276 - //TODO how to handle???
105.277 - } else {
105.278 - transStarted = true;
105.279 - }
105.280 - }
105.281 - try {
105.282 - ModelUtils.applyEncodingMark(model, HL7EncodingConst.NAME,
105.283 - HL7EncodingConst.URI, HL7EncodingConst.STYLE);
105.284 - } catch (IOException ex) {
105.285 - throw new ModelVisitorException(ex);
105.286 - }
105.287 - ApplyHL7EncodingVisitor visitor =
105.288 - new ApplyHL7EncodingVisitor(model);
105.289 - model.getSchema().accept(visitor);
105.290 - mConsole.println(
105.291 - NbBundle.getMessage(
105.292 - ApplyHL7EncodingAction.class,
105.293 - "apply_hl7_enc.msg.modified_elem_count", //NOI18N
105.294 - visitor.getElementModified()));
105.295 - mConsole.println(
105.296 - NbBundle.getMessage(
105.297 - ApplyHL7EncodingAction.class,
105.298 - "apply_hl7_enc.msg.modified_cplxtype_count", //NOI18N
105.299 - visitor.getComplexTypeModified()));
105.300 - mConsole.println(
105.301 - NbBundle.getMessage(
105.302 - ApplyHL7EncodingAction.class,
105.303 - "apply_hl7_enc.msg.modified_simptype_count", //NOI18N
105.304 - visitor.getSimpleTypeModified()));
105.305 - } finally {
105.306 - if (transStarted) {
105.307 - model.endTransaction();
105.308 - }
105.309 - }
105.310 - return true;
105.311 - }
105.312 -
105.313 - public boolean visit(Document doc) {
105.314 - return true;
105.315 - }
105.316 -
105.317 - public boolean visit(FileObject fileObj) {
105.318 - return true;
105.319 - }
105.320 -
105.321 - public boolean visit(DataObject dataObj) {
105.322 - return true;
105.323 - }
105.324 - }
105.325 -}
106.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/action/ApplyHL7EncodingVisitor.java Sat Sep 27 15:34:52 2008 -0700
106.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
106.3 @@ -1,128 +0,0 @@
106.4 -/*
106.5 - * The contents of this file are subject to the terms of the Common Development
106.6 - * and Distribution License (the License). You may not use this file except in
106.7 - * compliance with the License.
106.8 - *
106.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
106.10 - * or http://www.netbeans.org/cddl.txt.
106.11 -
106.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
106.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
106.14 - * If applicable, add the following below the CDDL Header, with the fields
106.15 - * enclosed by brackets [] replaced by your own identifying information:
106.16 - * "Portions Copyrighted [year] [name of copyright owner]"
106.17 - *
106.18 - * The Original Software is NetBeans. The Initial Developer of the Original
106.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
106.20 - * Microsystems, Inc. All Rights Reserved.
106.21 - */
106.22 -
106.23 -package org.netbeans.modules.encoder.hl7.aip.action;
106.24 -
106.25 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
106.26 -import org.netbeans.modules.xml.schema.model.Annotation;
106.27 -import org.netbeans.modules.xml.schema.model.AppInfo;
106.28 -import org.netbeans.modules.xml.schema.model.GlobalComplexType;
106.29 -import org.netbeans.modules.xml.schema.model.GlobalElement;
106.30 -import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
106.31 -import org.netbeans.modules.xml.schema.model.LocalComplexType;
106.32 -import org.netbeans.modules.xml.schema.model.LocalSimpleType;
106.33 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
106.34 -import org.netbeans.modules.xml.schema.model.SchemaModel;
106.35 -import org.netbeans.modules.xml.schema.model.visitor.DeepSchemaVisitor;
106.36 -import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor;
106.37 -
106.38 -/**
106.39 - * The visitor that applies HL7 encoding to every complex type or simple
106.40 - * type definition.
106.41 - *
106.42 - * @author Jun Xu
106.43 - */
106.44 -public class ApplyHL7EncodingVisitor extends DeepSchemaVisitor implements SchemaVisitor {
106.45 -
106.46 - private final SchemaModel mModel;
106.47 - private int mSimpleTypeModified = 0;
106.48 - private int mComplexTypeModified = 0;
106.49 - private int mElementModified = 0;
106.50 -
106.51 - public ApplyHL7EncodingVisitor(SchemaModel rootModel) {
106.52 - mModel = rootModel;
106.53 - }
106.54 -
106.55 - public void visit(GlobalElement globalElement) {
106.56 - if (applyHL7Encoding(globalElement)) {
106.57 - mElementModified++;
106.58 - }
106.59 - super.visit(globalElement);
106.60 - }
106.61 -
106.62 - public void visit(LocalSimpleType localSimpleType) {
106.63 - if (applyHL7Encoding(localSimpleType)) {
106.64 - mSimpleTypeModified++;
106.65 - }
106.66 - super.visit(localSimpleType);
106.67 - }
106.68 -
106.69 - public void visit(GlobalSimpleType globalSimpleType) {
106.70 - if (applyHL7Encoding(globalSimpleType)) {
106.71 - mSimpleTypeModified++;
106.72 - }
106.73 - super.visit(globalSimpleType);
106.74 - }
106.75 -
106.76 - public void visit(GlobalComplexType globalComplexType) {
106.77 - if (applyHL7Encoding(globalComplexType)) {
106.78 - mComplexTypeModified++;
106.79 - }
106.80 - super.visit(globalComplexType);
106.81 - }
106.82 -
106.83 - public void visit(LocalComplexType localComplexType) {
106.84 - if (applyHL7Encoding(localComplexType)) {
106.85 - mComplexTypeModified++;
106.86 - }
106.87 - super.visit(localComplexType);
106.88 - }
106.89 -
106.90 - public int getComplexTypeModified() {
106.91 - return mComplexTypeModified;
106.92 - }
106.93 -
106.94 - public int getSimpleTypeModified() {
106.95 - return mSimpleTypeModified;
106.96 - }
106.97 -
106.98 - public int getElementModified() {
106.99 - return mElementModified;
106.100 - }
106.101 -
106.102 - private boolean applyHL7Encoding(SchemaComponent component) {
106.103 - if (!mModel.equals(component.getModel())) {
106.104 - return false;
106.105 - }
106.106 - boolean addAnnotation = false;
106.107 - boolean found = false;
106.108 - Annotation anno = component.getAnnotation();
106.109 - if (anno == null) {
106.110 - anno = component.getModel().getFactory().createAnnotation();
106.111 - addAnnotation = true;
106.112 - } else {
106.113 - for (AppInfo appInfo : anno.getAppInfos()) {
106.114 - if (EncodingConst.URI.equals(appInfo.getURI())) {
106.115 - found = true;
106.116 - break;
106.117 - }
106.118 - }
106.119 - }
106.120 - if (!found) {
106.121 - AppInfo appInfo = component.getModel().getFactory().createAppInfo();
106.122 - appInfo.setURI(EncodingConst.URI);
106.123 - anno.addAppInfo(appInfo);
106.124 - if (addAnnotation) {
106.125 - component.setAnnotation(anno);
106.126 - }
106.127 - return true;
106.128 - }
106.129 - return false;
106.130 - }
106.131 -}
107.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/action/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
107.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
107.3 @@ -1,34 +0,0 @@
107.4 -
107.5 -apply_hl7_enc.lbl.process=Process
107.6 -
107.7 -apply_hl7_enc.lbl.read_only_model=Read Only Model
107.8 -
107.9 -apply_hl7_enc.lbl.reapply_hl7_encoding=Reapply HL7 Encoding
107.10 -
107.11 -apply_hl7_enc.lbl.applying_hl7_encoding=Applying HL7 Encoding
107.12 -
107.13 -apply_hl7_enc.lbl.apply_hl7_encoding_title=Apply HL7 Encoding
107.14 -
107.15 -apply_hl7_enc.lbl.apply_hl7_encoding_menu=Apply HL7 Encoding
107.16 -
107.17 -apply_hl7_enc.lbl.notify_lengthy_process=Notify Lengthy Process
107.18 -
107.19 -apply_hl7_enc.lbl.cancel=Cancel
107.20 -
107.21 -apply_hl7_enc.lbl.warn_big_file=The size of the XSD file(s) is over 300K. This process may\ntake from couple seconds to {0} minute(s) depending on\nvarious situation. Continue?
107.22 -
107.23 -apply_hl7_enc.lbl.read_only_model=The model is read only: ''{0}''. Continue to apply HL7 encoding to other referenced schemas?
107.24 -
107.25 -apply_hl7_enc.msg.finished_apply_hl7_encoding=Finished applying HL7 encoding.
107.26 -
107.27 -apply_hl7_enc.msg.cancelled_by_user=Process cancelled by user.
107.28 -
107.29 -apply_hl7_enc.msg.start_apply_hl7_encoding=Start to apply HL7 encoding...
107.30 -
107.31 -apply_hl7_enc.msg.apply_hl7_enc_to=Applying HL7 encoding to {0}
107.32 -
107.33 -apply_hl7_enc.msg.modified_elem_count=Modified {0,number,integer} element declarations
107.34 -
107.35 -apply_hl7_enc.msg.modified_cplxtype_count=Modified {0,number,integer} complex type definitions
107.36 -
107.37 -apply_hl7_enc.msg.modified_simptype_count=Modified {0,number,integer} simple type definitions
108.1 Binary file encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/icon.PNG has changed
109.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/layer.xml Sat Sep 27 15:34:52 2008 -0700
109.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
109.3 @@ -1,19 +0,0 @@
109.4 -<?xml version="1.0" encoding="UTF-8"?>
109.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
109.6 -<filesystem>
109.7 - <folder name="Loaders">
109.8 - <folder name="text">
109.9 - <folder name="x-schema+xml">
109.10 - <folder name="Actions">
109.11 - <folder name="encoding">
109.12 - <file name="apply-hl7.instance">
109.13 - <attr name="instanceClass" stringvalue="org.netbeans.modules.encoder.hl7.aip.action.ApplyHL7EncodingAction"/>
109.14 - </file>
109.15 - <attr name="apply-hl7.instance/sep-1.instance" boolvalue="true"/>
109.16 - </folder>
109.17 - </folder>
109.18 - </folder>
109.19 - </folder>
109.20 - </folder>
109.21 -</filesystem>
109.22 -
110.1 Binary file encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/openIcon.PNG has changed
111.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/validation/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
111.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
111.3 @@ -1,16 +0,0 @@
111.4 -
111.5 -hl7_validator.exp.no_top_element=HL7 Encoder - No top element has been found in current document. Encoding related metadata is not validated.
111.6 -
111.7 -hl7_validator.lbl.provider_name=HL7 Encoder Validation Provider
111.8 -
111.9 -hl7_validator.exp.missing_level_property=Unexpected state\: missing level property
111.10 -
111.11 -hl7_validator.exp.recursive_condition=HL7 Encoder - Schema component ''{0}'' is referenced recursively.
111.12 -
111.13 -hl7_validator.exp.missing_level_prop=Unexpected state\: missing level property
111.14 -
111.15 -hl7_validator.exp.grp_in_grp_not_supported=Schema component ''{0}'': HL7 Encoder - Model group inside model group is not supported
111.16 -
111.17 -hl7_validator.exp.too_many_levels=HL7 Encoder - Element ''{0}'': too many levels. # of levels must be no more than {1,number,integer}, current # of levels = {2,number,integer}
111.18 -
111.19 -hl7_validator.exp.anytype_not_supported=HL7 Encoder - Element ''{0}'': xsd:anyType or no type is not supported
112.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/validation/HL7EncoderValidator.java Sat Sep 27 15:34:52 2008 -0700
112.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
112.3 @@ -1,375 +0,0 @@
112.4 -/*
112.5 - * The contents of this file are subject to the terms of the Common Development
112.6 - * and Distribution License (the License). You may not use this file except in
112.7 - * compliance with the License.
112.8 - *
112.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
112.10 - * or http://www.netbeans.org/cddl.txt.
112.11 -
112.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
112.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
112.14 - * If applicable, add the following below the CDDL Header, with the fields
112.15 - * enclosed by brackets [] replaced by your own identifying information:
112.16 - * "Portions Copyrighted [year] [name of copyright owner]"
112.17 - *
112.18 - * The Original Software is NetBeans. The Initial Developer of the Original
112.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
112.20 - * Microsystems, Inc. All Rights Reserved.
112.21 - */
112.22 -
112.23 -package org.netbeans.modules.encoder.hl7.aip.validation;
112.24 -
112.25 -import java.util.ArrayList;
112.26 -import java.util.List;
112.27 -import java.util.ResourceBundle;
112.28 -import org.netbeans.modules.encoder.hl7.aip.EncodingOption;
112.29 -import org.netbeans.modules.encoder.hl7.aip.HL7EncodingConst;
112.30 -import org.netbeans.modules.encoder.ui.basic.InvalidAppInfoException;
112.31 -import org.netbeans.modules.encoder.ui.basic.SchemaUtility;
112.32 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
112.33 -import org.netbeans.modules.encoder.ui.basic.ValidationContext;
112.34 -import org.netbeans.modules.encoder.ui.basic.ValidationException;
112.35 -import org.netbeans.modules.encoder.ui.basic.XsdBasedEncoderValidator;
112.36 -import org.netbeans.modules.xml.schema.model.All;
112.37 -import org.netbeans.modules.xml.schema.model.Choice;
112.38 -import org.netbeans.modules.xml.schema.model.Element;
112.39 -import org.netbeans.modules.xml.schema.model.ElementReference;
112.40 -import org.netbeans.modules.xml.schema.model.GlobalComplexType;
112.41 -import org.netbeans.modules.xml.schema.model.GlobalElement;
112.42 -import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
112.43 -import org.netbeans.modules.xml.schema.model.GlobalType;
112.44 -import org.netbeans.modules.xml.schema.model.GroupReference;
112.45 -import org.netbeans.modules.xml.schema.model.LocalComplexType;
112.46 -import org.netbeans.modules.xml.schema.model.LocalElement;
112.47 -import org.netbeans.modules.xml.schema.model.LocalGroupDefinition;
112.48 -import org.netbeans.modules.xml.schema.model.LocalSimpleType;
112.49 -import org.netbeans.modules.xml.schema.model.NameableSchemaComponent;
112.50 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
112.51 -import org.netbeans.modules.xml.schema.model.SchemaModel;
112.52 -import org.netbeans.modules.xml.schema.model.Sequence;
112.53 -import org.netbeans.modules.xml.schema.model.TypeContainer;
112.54 -import org.openide.util.NbBundle;
112.55 -import org.xml.sax.ErrorHandler;
112.56 -import org.xml.sax.SAXException;
112.57 -import org.xml.sax.SAXParseException;
112.58 -
112.59 -/**
112.60 - * Class that provides validation functionality for HL7 encoder.
112.61 - *
112.62 - * @author Jun Xu
112.63 - */
112.64 -public class HL7EncoderValidator extends XsdBasedEncoderValidator {
112.65 -
112.66 - private static final ResourceBundle _bundle =
112.67 - ResourceBundle.getBundle("org/netbeans/modules/encoder/hl7/aip/validation/Bundle");
112.68 - private static final String PROP_LEVEL = "level"; //NOI18N
112.69 - //Maximum level should be 4 according to HL7 specification but in XML
112.70 - //representation the top element should not be counted in the level.
112.71 - private static final int MAX_LEVEL = 5;
112.72 -
112.73 - /** Creates a new instance of CustomEncoderValidator
112.74 - * @param model the schema model
112.75 - * @param handler a SAX error handler
112.76 - */
112.77 - public HL7EncoderValidator(SchemaModel model, ErrorHandler handler) {
112.78 - super(HL7EncodingConst.STYLE, model, handler);
112.79 - }
112.80 -
112.81 - protected void foundNoTopElements()
112.82 - throws ValidationException, SAXException {
112.83 -
112.84 - super.foundNoTopElements();
112.85 -
112.86 - _handler.warning(
112.87 - new SAXParseException(
112.88 - _bundle.getString("hl7_validator.exp.no_top_element"),
112.89 - ModelUtils.getPublicId(_model),
112.90 - null /*ModelUtils.getSystemId(_model)*/,
112.91 - -1,
112.92 - -1));
112.93 - }
112.94 -
112.95 - protected void detectedRecursiveCondition(ValidationContext context,
112.96 - SchemaComponent schemaComponent)
112.97 - throws ValidationException, SAXException {
112.98 -
112.99 - super.detectedRecursiveCondition(context, schemaComponent);
112.100 -
112.101 - String msg = NbBundle.getMessage(HL7EncoderValidator.class,
112.102 - "hl7_validator.exp.recursive_condition", //NOI18N
112.103 - context.getElementNCNamePath(schemaComponent));
112.104 - _handler.error(
112.105 - new SAXParseException(
112.106 - msg,
112.107 - ModelUtils.getPublicId(schemaComponent.getModel()),
112.108 - ModelUtils.getSystemId(schemaComponent.getModel()),
112.109 - -1,
112.110 - -1));
112.111 - }
112.112 -
112.113 - protected void validate(ValidationContext context,
112.114 - GlobalElement globalElement)
112.115 - throws ValidationException, SAXException {
112.116 -
112.117 - super.validate(context, globalElement);
112.118 -
112.119 - validateLevel(context, globalElement);
112.120 - validateMetadataSyntax(context, globalElement);
112.121 - validateSupportedType(context, globalElement);
112.122 - }
112.123 -
112.124 - protected void validate(ValidationContext context,
112.125 - LocalElement localElement)
112.126 - throws ValidationException, SAXException {
112.127 -
112.128 - super.validate(context, localElement);
112.129 -
112.130 - validateLevel(context, localElement);
112.131 - validateMetadataSyntax(context, localElement);
112.132 - validateSupportedType(context, localElement);
112.133 - }
112.134 -
112.135 - protected void validate(ValidationContext context,
112.136 - GlobalComplexType globalComplexType)
112.137 - throws ValidationException, SAXException {
112.138 -
112.139 - super.validate(context, globalComplexType);
112.140 -
112.141 - validateMetadataSyntax(context, globalComplexType);
112.142 - }
112.143 -
112.144 - protected void validate(ValidationContext context,
112.145 - LocalComplexType localComplexType)
112.146 - throws ValidationException, SAXException {
112.147 -
112.148 - super.validate(context, localComplexType);
112.149 -
112.150 - validateMetadataSyntax(context, localComplexType);
112.151 - }
112.152 -
112.153 - protected void validate(ValidationContext context,
112.154 - GlobalSimpleType globalSimpleType)
112.155 - throws ValidationException, SAXException {
112.156 -
112.157 - super.validate(context, globalSimpleType);
112.158 -
112.159 - validateMetadataSyntax(context, globalSimpleType);
112.160 - }
112.161 -
112.162 - protected void validate(ValidationContext context,
112.163 - LocalSimpleType localSimpleType)
112.164 - throws ValidationException, SAXException {
112.165 -
112.166 - super.validate(context, localSimpleType);
112.167 -
112.168 - validateMetadataSyntax(context, localSimpleType);
112.169 - }
112.170 -
112.171 - protected void validate(ValidationContext context, Sequence sequence)
112.172 - throws ValidationException, SAXException {
112.173 -
112.174 - super.validate(context, sequence);
112.175 -
112.176 - checkGroupWithinGroup(context, sequence);
112.177 - }
112.178 -
112.179 - protected void validate(ValidationContext context, All all)
112.180 - throws ValidationException, SAXException {
112.181 -
112.182 - super.validate(context, all);
112.183 -
112.184 - checkGroupWithinGroup(context, all);
112.185 - }
112.186 -
112.187 - protected void validate(ValidationContext context, Choice choice)
112.188 - throws ValidationException, SAXException {
112.189 -
112.190 - super.validate(context, choice);
112.191 -
112.192 - checkGroupWithinGroup(context, choice);
112.193 - }
112.194 -
112.195 - protected void validate(ValidationContext context, GroupReference groupRef)
112.196 - throws ValidationException, SAXException {
112.197 -
112.198 - super.validate(context, groupRef);
112.199 -
112.200 - checkGroupWithinGroup(context, groupRef);
112.201 - }
112.202 -
112.203 - protected void prepareContext(ValidationContext context)
112.204 - throws ValidationException, SAXException {
112.205 - super.prepareContext(context);
112.206 -
112.207 - if (context.getPath().isEmpty()) {
112.208 - context.setProperty(PROP_LEVEL, new Integer(0));
112.209 - return;
112.210 - }
112.211 - Integer objLevel = (Integer) context.getProperty(PROP_LEVEL);
112.212 - if (objLevel == null) {
112.213 - throw new ValidationException(
112.214 - _bundle.getString("hl7_validator.exp.missing_level_prop"));
112.215 - }
112.216 - SchemaComponent sc = context.getPath().get(context.getPath().size() - 1);
112.217 - if (!(sc instanceof Element) || (sc instanceof ElementReference)) {
112.218 - return;
112.219 - }
112.220 - if (!(sc instanceof NameableSchemaComponent)) {
112.221 - return;
112.222 - }
112.223 - String name = ((NameableSchemaComponent) sc).getName();
112.224 - if (name.startsWith(context.getTopElementNCName() + ".")) { //NOI18N
112.225 - //Element with name starts with top element name as prefix is
112.226 - //considered as group and will not account for level increase.
112.227 - return;
112.228 - }
112.229 - context.setProperty(PROP_LEVEL, new Integer(objLevel.intValue() + 1));
112.230 - }
112.231 -
112.232 - private void checkGroupWithinGroup(ValidationContext context,
112.233 - SchemaComponent group)
112.234 - throws ValidationException, SAXException {
112.235 - if (context.getPath().size() == 0) {
112.236 - return;
112.237 - }
112.238 - SchemaComponent sc =
112.239 - context.getPath().get(context.getPath().size() - 1);
112.240 - if ((sc instanceof LocalGroupDefinition)
112.241 - || (sc instanceof GroupReference)) {
112.242 - String name = null;
112.243 - for (int i = context.getPath().size() - 1; i >= 0; i--) {
112.244 - if (context.getPath().get(i)
112.245 - instanceof NameableSchemaComponent) {
112.246 - name = ((NameableSchemaComponent)
112.247 - context.getPath().get(i)).getName();
112.248 - sc = context.getPath().get(i);
112.249 - break;
112.250 - }
112.251 - }
112.252 - if (name == null) {
112.253 - name = ""; //NOI18N
112.254 - }
112.255 - String msg = NbBundle.getMessage(HL7EncoderValidator.class,
112.256 - "hl7_validator.exp.grp_in_grp_not_supported", name); //NOI18N
112.257 -
112.258 - _handler.error(
112.259 - new SAXParseException(
112.260 - msg,
112.261 - ModelUtils.getPublicId(sc.getModel()),
112.262 - ModelUtils.getSystemId(sc.getModel()),
112.263 - -1,
112.264 - -1));
112.265 - }
112.266 - }
112.267 -
112.268 - private void validateLevel(ValidationContext context, Element elem)
112.269 - throws ValidationException, SAXException {
112.270 - Integer objLevel = (Integer) context.getProperty(PROP_LEVEL);
112.271 - if (objLevel == null) {
112.272 - throw new ValidationException(
112.273 - _bundle.getString("hl7_validator.exp.missing_level_property"));
112.274 - }
112.275 - if (objLevel.intValue() < MAX_LEVEL) {
112.276 - return;
112.277 - }
112.278 - if (objLevel.intValue() > MAX_LEVEL) {
112.279 - //Already has too many levels. Don't need to do further check
112.280 - String msg =
112.281 - NbBundle.getMessage(
112.282 - HL7EncoderValidator.class,
112.283 - "hl7_validator.exp.too_many_levels", //NOI18N
112.284 - context.getElementNCNamePath(elem),
112.285 - MAX_LEVEL - 1,
112.286 - objLevel.intValue());
112.287 - _handler.warning(
112.288 - new SAXParseException(
112.289 - msg,
112.290 - ModelUtils.getPublicId(elem.getModel()),
112.291 - null /*ModelUtils.getSystemId(elem.getModel())*/,
112.292 - -1,
112.293 - -1));
112.294 - return;
112.295 - }
112.296 - if (elem instanceof ElementReference) {
112.297 - return;
112.298 - }
112.299 - if (!(elem instanceof NameableSchemaComponent)) {
112.300 - return;
112.301 - }
112.302 - String name = ((NameableSchemaComponent) elem).getName();
112.303 - if (name.startsWith(context.getTopElementPrefix())) {
112.304 - //Element with name starts with top element name as prefix is
112.305 - //considered as group and will not account for level increase.
112.306 - return;
112.307 - }
112.308 - if (!(elem instanceof TypeContainer)) {
112.309 - return;
112.310 - }
112.311 - SchemaComponent type = getType(((TypeContainer) elem));
112.312 - if (type == null || (type instanceof GlobalType)
112.313 - && "escapeType".equals(((GlobalType) type).getName())) { //NOI18N
112.314 - //element representing escape sequence is allowed as the fifth level element
112.315 - return;
112.316 - }
112.317 - String msg =
112.318 - NbBundle.getMessage(
112.319 - HL7EncoderValidator.class,
112.320 - "hl7_validator.exp.too_many_levels", //NOI18N
112.321 - context.getElementNCNamePath(elem),
112.322 - MAX_LEVEL - 1,
112.323 - objLevel.intValue());
112.324 - _handler.warning(
112.325 - new SAXParseException(
112.326 - msg,
112.327 - ModelUtils.getPublicId(elem.getModel()),
112.328 - null /*ModelUtils.getSystemId(elem.getModel())*/,
112.329 - -1,
112.330 - -1));
112.331 - }
112.332 -
112.333 - private void validateMetadataSyntax(ValidationContext context, SchemaComponent sc)
112.334 - throws ValidationException, SAXException {
112.335 - if (sc.getAnnotation() == null) {
112.336 - return;
112.337 - }
112.338 - List<SchemaComponent> path =
112.339 - new ArrayList<SchemaComponent>(context.getPath());
112.340 - path.add(sc);
112.341 - path.add(sc.getAnnotation());
112.342 - EncodingOption encodingInfo;
112.343 - try {
112.344 - encodingInfo =
112.345 - EncodingOption.createFromAppInfo(path);
112.346 - } catch (InvalidAppInfoException ex) {
112.347 - _handler.error(
112.348 - new SAXParseException(
112.349 - ex.getMessage(),
112.350 - ModelUtils.getPublicId(sc.getModel()),
112.351 - ModelUtils.getSystemId(sc.getModel()),
112.352 - -1,
112.353 - -1,
112.354 - ex));
112.355 - }
112.356 - }
112.357 -
112.358 - private void validateSupportedType(ValidationContext context, Element elem)
112.359 - throws ValidationException, SAXException {
112.360 - if (!(elem instanceof TypeContainer)) {
112.361 - return;
112.362 - }
112.363 - if (SchemaUtility.isAnyType(getType((TypeContainer) elem))) {
112.364 - String msg =
112.365 - NbBundle.getMessage(
112.366 - HL7EncoderValidator.class,
112.367 - "hl7_validator.exp.anytype_not_supported", //NOI18N
112.368 - context.getElementNCNamePath(elem));
112.369 - _handler.error(
112.370 - new SAXParseException(
112.371 - msg,
112.372 - ModelUtils.getPublicId(elem.getModel()),
112.373 - null /*ModelUtils.getSystemId(elem.getModel())*/,
112.374 - -1,
112.375 - -1));
112.376 - }
112.377 - }
112.378 -}
113.1 --- a/encoder.hl7.aip/src/org/netbeans/modules/encoder/hl7/aip/validation/ValidationProvider.java Sat Sep 27 15:34:52 2008 -0700
113.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
113.3 @@ -1,97 +0,0 @@
113.4 -/*
113.5 - * The contents of this file are subject to the terms of the Common Development
113.6 - * and Distribution License (the License). You may not use this file except in
113.7 - * compliance with the License.
113.8 - *
113.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
113.10 - * or http://www.netbeans.org/cddl.txt.
113.11 -
113.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
113.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
113.14 - * If applicable, add the following below the CDDL Header, with the fields
113.15 - * enclosed by brackets [] replaced by your own identifying information:
113.16 - * "Portions Copyrighted [year] [name of copyright owner]"
113.17 - *
113.18 - * The Original Software is NetBeans. The Initial Developer of the Original
113.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
113.20 - * Microsystems, Inc. All Rights Reserved.
113.21 - */
113.22 -
113.23 -package org.netbeans.modules.encoder.hl7.aip.validation;
113.24 -
113.25 -import java.net.URI;
113.26 -import java.net.URISyntaxException;
113.27 -import java.util.ResourceBundle;
113.28 -import java.util.logging.Level;
113.29 -import java.util.logging.Logger;
113.30 -import javax.xml.XMLConstants;
113.31 -import javax.xml.validation.Schema;
113.32 -import javax.xml.validation.SchemaFactory;
113.33 -import org.netbeans.modules.xml.schema.model.SchemaModel;
113.34 -import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
113.35 -import org.netbeans.modules.xml.xam.Model;
113.36 -import org.netbeans.modules.xml.xam.ModelSource;
113.37 -import org.netbeans.modules.xml.xam.dom.DocumentModel;
113.38 -import org.netbeans.modules.xml.xam.locator.CatalogModel;
113.39 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
113.40 -import org.netbeans.modules.xml.xam.spi.XsdBasedValidator;
113.41 -import org.netbeans.modules.xml.xam.spi.Validator;
113.42 -import org.xml.sax.SAXException;
113.43 -
113.44 -/**
113.45 - * A validator for validating HL7 encoder metadata.
113.46 - *
113.47 - * @author Jun Xu
113.48 - */
113.49 -public class ValidationProvider extends XsdBasedValidator {
113.50 -
113.51 - private static final ResourceBundle _bundle =
113.52 - ResourceBundle.getBundle("org/netbeans/modules/encoder/hl7/aip/validation/Bundle");
113.53 - private static Schema _schema;
113.54 -
113.55 - static {
113.56 - try {
113.57 - _schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema();
113.58 - } catch(SAXException ex) {
113.59 - assert false: "Error while creating compiled schema for"; //NOI18N
113.60 - }
113.61 - }
113.62 -
113.63 - protected Schema getSchema(Model model) {
113.64 - if (! (model instanceof SchemaModel)) {
113.65 - return null;
113.66 - }
113.67 -
113.68 - // This will not be used as validate(.....) method is being overridden here.
113.69 - // So just return a schema returned by newSchema().
113.70 - return _schema;
113.71 - }
113.72 -
113.73 - public String getName() {
113.74 - return _bundle.getString("hl7_validator.lbl.provider_name");
113.75 - }
113.76 -
113.77 - protected void validate(Model model, Schema schema, XsdBasedValidator.Handler handler) {
113.78 - try {
113.79 - new HL7EncoderValidator((SchemaModel) model, handler).validate();
113.80 - } catch(Exception ex) {
113.81 - handler.logValidationErrors(Validator.ResultType.ERROR, ex.getMessage());
113.82 - }
113.83 - }
113.84 -
113.85 - public DocumentModel resolveResource(String systemId, Model model) {
113.86 - try {
113.87 - CatalogModel cm = (CatalogModel) model.getModelSource().getLookup()
113.88 - .lookup(CatalogModel.class);
113.89 - ModelSource ms = cm.getModelSource(new URI(systemId));
113.90 - if (ms != null) {
113.91 - return SchemaModelFactory.getDefault().getModel(ms);
113.92 - }
113.93 - } catch(URISyntaxException ex) {
113.94 - Logger.getLogger(getClass().getName()).log(Level.FINE, "resolveResource", ex); //NOI18N
113.95 - } catch(CatalogModelException ex) {
113.96 - Logger.getLogger(getClass().getName()).log(Level.FINE, "resolveResource", ex); //NOI18N
113.97 - }
113.98 - return null;
113.99 - }
113.100 -}
114.1 --- a/encoder.ui.basic/build.xml Sat Sep 27 15:34:52 2008 -0700
114.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
114.3 @@ -1,8 +0,0 @@
114.4 -<?xml version="1.0" encoding="UTF-8"?>
114.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
114.6 -<!-- for some information on what you could do (e.g. targets to override). -->
114.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
114.8 -<project name="org.netbeans.modules.encoder.ui.basic" default="netbeans" basedir=".">
114.9 - <description>Builds, tests, and runs the project org.netbeans.modules.encoder.ui.basic.</description>
114.10 - <import file="../../nbbuild/templates/projectized.xml"/>
114.11 -</project>
115.1 --- a/encoder.ui.basic/manifest.mf Sat Sep 27 15:34:52 2008 -0700
115.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
115.3 @@ -1,6 +0,0 @@
115.4 -Manifest-Version: 1.0
115.5 -OpenIDE-Module: org.netbeans.modules.encoder.ui.basic
115.6 -OpenIDE-Module-Layer: org/netbeans/modules/encoder/ui/basic/layer.xml
115.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/encoder/ui/basic/Bundle.properties
115.8 -OpenIDE-Module-Specification-Version: 1.0.2
115.9 -
116.1 --- a/encoder.ui.basic/nbproject/project.properties Sat Sep 27 15:34:52 2008 -0700
116.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
116.3 @@ -1,2 +0,0 @@
116.4 -javac.compilerargs=-Xlint:unchecked
116.5 -javac.source=1.5
117.1 --- a/encoder.ui.basic/nbproject/project.xml Sat Sep 27 15:34:52 2008 -0700
117.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
117.3 @@ -1,145 +0,0 @@
117.4 -<?xml version="1.0" encoding="UTF-8"?>
117.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
117.6 - <type>org.netbeans.modules.apisupport.project</type>
117.7 - <configuration>
117.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
117.9 - <code-name-base>org.netbeans.modules.encoder.ui.basic</code-name-base>
117.10 - <module-dependencies>
117.11 - <dependency>
117.12 - <code-name-base>org.netbeans.soa.libs.xmlbeans</code-name-base>
117.13 - <build-prerequisite/>
117.14 - <compile-dependency/>
117.15 - <run-dependency>
117.16 - <release-version>1</release-version>
117.17 - <specification-version>1.0</specification-version>
117.18 - </run-dependency>
117.19 - </dependency>
117.20 - <dependency>
117.21 - <code-name-base>org.jdesktop.layout</code-name-base>
117.22 - <build-prerequisite/>
117.23 - <compile-dependency/>
117.24 - <run-dependency>
117.25 - <release-version>1</release-version>
117.26 - <specification-version>1.3.23</specification-version>
117.27 - </run-dependency>
117.28 - </dependency>
117.29 - <dependency>
117.30 - <code-name-base>org.netbeans.api.progress</code-name-base>
117.31 - <build-prerequisite/>
117.32 - <compile-dependency/>
117.33 - <run-dependency>
117.34 - <release-version>1</release-version>
117.35 - <specification-version>1.5.22</specification-version>
117.36 - </run-dependency>
117.37 - </dependency>
117.38 - <dependency>
117.39 - <code-name-base>org.netbeans.modules.xml.schema.model</code-name-base>
117.40 - <build-prerequisite/>
117.41 - <compile-dependency/>
117.42 - <run-dependency>
117.43 - <release-version>1</release-version>
117.44 - <specification-version>1.1.22</specification-version>
117.45 - </run-dependency>
117.46 - </dependency>
117.47 - <dependency>
117.48 - <code-name-base>org.netbeans.modules.xml.schema.ui.basic</code-name-base>
117.49 - <build-prerequisite/>
117.50 - <compile-dependency/>
117.51 - <run-dependency>
117.52 - <release-version>1</release-version>
117.53 - <specification-version>1.2</specification-version>
117.54 - </run-dependency>
117.55 - </dependency>
117.56 - <dependency>
117.57 - <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
117.58 - <build-prerequisite/>
117.59 - <compile-dependency/>
117.60 - <run-dependency>
117.61 - <release-version>1</release-version>
117.62 - <specification-version>1.1.22</specification-version>
117.63 - </run-dependency>
117.64 - </dependency>
117.65 - <dependency>
117.66 - <code-name-base>org.netbeans.modules.xml.xam.ui</code-name-base>
117.67 - <build-prerequisite/>
117.68 - <compile-dependency/>
117.69 - <run-dependency>
117.70 - <release-version>1</release-version>
117.71 - <specification-version>1.0</specification-version>
117.72 - </run-dependency>
117.73 - </dependency>
117.74 - <dependency>
117.75 - <code-name-base>org.openide.dialogs</code-name-base>
117.76 - <build-prerequisite/>
117.77 - <compile-dependency/>
117.78 - <run-dependency>
117.79 - <specification-version>6.5.22</specification-version>
117.80 - </run-dependency>
117.81 - </dependency>
117.82 - <dependency>
117.83 - <code-name-base>org.openide.filesystems</code-name-base>
117.84 - <build-prerequisite/>
117.85 - <compile-dependency/>
117.86 - <run-dependency>
117.87 - <specification-version>6.4.22</specification-version>
117.88 - </run-dependency>
117.89 - </dependency>
117.90 - <dependency>
117.91 - <code-name-base>org.openide.io</code-name-base>
117.92 - <build-prerequisite/>
117.93 - <compile-dependency/>
117.94 - <run-dependency>
117.95 - <specification-version>1.9.22</specification-version>
117.96 - </run-dependency>
117.97 - </dependency>
117.98 - <dependency>
117.99 - <code-name-base>org.openide.loaders</code-name-base>
117.100 - <build-prerequisite/>
117.101 - <compile-dependency/>
117.102 - <run-dependency>
117.103 - <specification-version>5.9.22</specification-version>
117.104 - </run-dependency>
117.105 - </dependency>
117.106 - <dependency>
117.107 - <code-name-base>org.openide.nodes</code-name-base>
117.108 - <build-prerequisite/>
117.109 - <compile-dependency/>
117.110 - <run-dependency>
117.111 - <specification-version>6.7.22</specification-version>
117.112 - </run-dependency>
117.113 - </dependency>
117.114 - <dependency>
117.115 - <code-name-base>org.openide.text</code-name-base>
117.116 - <build-prerequisite/>
117.117 - <compile-dependency/>
117.118 - <run-dependency>
117.119 - <specification-version>6.16</specification-version>
117.120 - </run-dependency>
117.121 - </dependency>
117.122 - <dependency>
117.123 - <code-name-base>org.openide.util</code-name-base>
117.124 - <build-prerequisite/>
117.125 - <compile-dependency/>
117.126 - <run-dependency>
117.127 - <specification-version>6.8.22</specification-version>
117.128 - </run-dependency>
117.129 - </dependency>
117.130 - <dependency>
117.131 - <code-name-base>org.openide.windows</code-name-base>
117.132 - <build-prerequisite/>
117.133 - <compile-dependency/>
117.134 - <run-dependency>
117.135 - <specification-version>6.5.22</specification-version>
117.136 - </run-dependency>
117.137 - </dependency>
117.138 - </module-dependencies>
117.139 - <friend-packages>
117.140 - <friend>org.netbeans.modules.encoder.coco.ui</friend>
117.141 - <friend>org.netbeans.modules.encoder.custom.aip</friend>
117.142 - <friend>org.netbeans.modules.encoder.hl7.aip</friend>
117.143 - <friend>org.netbeans.modules.encoder.ui.tester</friend>
117.144 - <package>org.netbeans.modules.encoder.ui.basic</package>
117.145 - </friend-packages>
117.146 - </data>
117.147 - </configuration>
117.148 -</project>
118.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ApplyEncodingConfirmation.form Sat Sep 27 15:34:52 2008 -0700
118.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
118.3 @@ -1,66 +0,0 @@
118.4 -<?xml version="1.0" encoding="UTF-8" ?>
118.5 -
118.6 -<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
118.7 - <AuxValues>
118.8 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
118.9 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
118.10 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
118.11 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
118.12 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
118.13 - </AuxValues>
118.14 -
118.15 - <Layout>
118.16 - <DimensionLayout dim="0">
118.17 - <Group type="103" groupAlignment="0" attributes="0">
118.18 - <Group type="102" alignment="0" attributes="0">
118.19 - <EmptySpace max="-2" attributes="0"/>
118.20 - <Group type="103" groupAlignment="0" attributes="0">
118.21 - <Group type="102" alignment="0" attributes="0">
118.22 - <Component id="descriptionLabel" min="-2" max="-2" attributes="1"/>
118.23 - <EmptySpace max="-2" attributes="0"/>
118.24 - </Group>
118.25 - <Group type="102" alignment="0" attributes="0">
118.26 - <Component id="applyToAllCheckBox" pref="362" max="32767" attributes="1"/>
118.27 - <EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
118.28 - </Group>
118.29 - </Group>
118.30 - </Group>
118.31 - </Group>
118.32 - </DimensionLayout>
118.33 - <DimensionLayout dim="1">
118.34 - <Group type="103" groupAlignment="0" attributes="0">
118.35 - <Group type="102" alignment="0" attributes="0">
118.36 - <EmptySpace max="-2" attributes="0"/>
118.37 - <Component id="applyToAllCheckBox" min="-2" max="-2" attributes="0"/>
118.38 - <EmptySpace max="-2" attributes="0"/>
118.39 - <Component id="descriptionLabel" min="-2" pref="24" max="-2" attributes="0"/>
118.40 - <EmptySpace max="32767" attributes="0"/>
118.41 - </Group>
118.42 - </Group>
118.43 - </DimensionLayout>
118.44 - </Layout>
118.45 - <SubComponents>
118.46 - <Component class="javax.swing.JCheckBox" name="applyToAllCheckBox">
118.47 - <Properties>
118.48 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
118.49 - <ResourceString bundle="org/netbeans/modules/encoder/ui/basic/Bundle.properties" key="apply_enc_conf.lbl.apply_to_ref_schemas" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
118.50 - </Property>
118.51 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
118.52 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
118.53 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
118.54 - </Border>
118.55 - </Property>
118.56 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
118.57 - <Insets value="[0, 0, 0, 0]"/>
118.58 - </Property>
118.59 - </Properties>
118.60 - </Component>
118.61 - <Component class="javax.swing.JLabel" name="descriptionLabel">
118.62 - <Properties>
118.63 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
118.64 - <ResourceString bundle="org/netbeans/modules/encoder/ui/basic/Bundle.properties" key="apply_enc_conf.lbl.warning_mod_ref_schemas" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
118.65 - </Property>
118.66 - </Properties>
118.67 - </Component>
118.68 - </SubComponents>
118.69 -</Form>
119.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ApplyEncodingConfirmation.java Sat Sep 27 15:34:52 2008 -0700
119.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
119.3 @@ -1,95 +0,0 @@
119.4 -/*
119.5 - * The contents of this file are subject to the terms of the Common Development
119.6 - * and Distribution License (the License). You may not use this file except in
119.7 - * compliance with the License.
119.8 - *
119.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
119.10 - * or http://www.netbeans.org/cddl.txt.
119.11 -
119.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
119.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
119.14 - * If applicable, add the following below the CDDL Header, with the fields
119.15 - * enclosed by brackets [] replaced by your own identifying information:
119.16 - * "Portions Copyrighted [year] [name of copyright owner]"
119.17 - *
119.18 - * The Original Software is NetBeans. The Initial Developer of the Original
119.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
119.20 - * Microsystems, Inc. All Rights Reserved.
119.21 - */
119.22 -
119.23 -package org.netbeans.modules.encoder.ui.basic;
119.24 -
119.25 -/**
119.26 - * The confirmation dialog before applying encoding settings.
119.27 - *
119.28 - * @author Jun Xu
119.29 - */
119.30 -public class ApplyEncodingConfirmation extends javax.swing.JPanel {
119.31 -
119.32 - /** Creates new form ApplyEncodingConfirmation */
119.33 - public ApplyEncodingConfirmation() {
119.34 - initComponents();
119.35 - }
119.36 -
119.37 - public boolean isApplyToReferenced() {
119.38 - return applyToAllCheckBox.isSelected();
119.39 - }
119.40 -
119.41 - public void setApplyToReferenced(boolean value) {
119.42 - applyToAllCheckBox.setSelected(value);
119.43 - }
119.44 -
119.45 - public boolean contains(int x, int y) {
119.46 - return true;
119.47 - }
119.48 -
119.49 - /** This method is called from within the constructor to
119.50 - * initialize the form.
119.51 - * WARNING: Do NOT modify this code. The content of this method is
119.52 - * always regenerated by the Form Editor.
119.53 - */
119.54 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
119.55 - private void initComponents() {
119.56 -
119.57 - applyToAllCheckBox = new javax.swing.JCheckBox();
119.58 - descriptionLabel = new javax.swing.JLabel();
119.59 -
119.60 - java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); // NOI18N
119.61 - applyToAllCheckBox.setText(bundle.getString("apply_enc_conf.lbl.apply_to_ref_schemas")); // NOI18N
119.62 - applyToAllCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
119.63 - applyToAllCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
119.64 -
119.65 - descriptionLabel.setText(bundle.getString("apply_enc_conf.lbl.warning_mod_ref_schemas")); // NOI18N
119.66 -
119.67 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
119.68 - this.setLayout(layout);
119.69 - layout.setHorizontalGroup(
119.70 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
119.71 - .add(layout.createSequentialGroup()
119.72 - .addContainerGap()
119.73 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
119.74 - .add(layout.createSequentialGroup()
119.75 - .add(descriptionLabel)
119.76 - .addContainerGap())
119.77 - .add(layout.createSequentialGroup()
119.78 - .add(applyToAllCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
119.79 - .add(60, 60, 60))))
119.80 - );
119.81 - layout.setVerticalGroup(
119.82 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
119.83 - .add(layout.createSequentialGroup()
119.84 - .addContainerGap()
119.85 - .add(applyToAllCheckBox)
119.86 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
119.87 - .add(descriptionLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
119.88 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
119.89 - );
119.90 - }// </editor-fold>//GEN-END:initComponents
119.91 -
119.92 -
119.93 - // Variables declaration - do not modify//GEN-BEGIN:variables
119.94 - private javax.swing.JCheckBox applyToAllCheckBox;
119.95 - private javax.swing.JLabel descriptionLabel;
119.96 - // End of variables declaration//GEN-END:variables
119.97 -
119.98 -}
120.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ApplyEncodingException.java Sat Sep 27 15:34:52 2008 -0700
120.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
120.3 @@ -1,42 +0,0 @@
120.4 -/*
120.5 - * The contents of this file are subject to the terms of the Common Development
120.6 - * and Distribution License (the License). You may not use this file except in
120.7 - * compliance with the License.
120.8 - *
120.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
120.10 - * or http://www.netbeans.org/cddl.txt.
120.11 -
120.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
120.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
120.14 - * If applicable, add the following below the CDDL Header, with the fields
120.15 - * enclosed by brackets [] replaced by your own identifying information:
120.16 - * "Portions Copyrighted [year] [name of copyright owner]"
120.17 - *
120.18 - * The Original Software is NetBeans. The Initial Developer of the Original
120.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
120.20 - * Microsystems, Inc. All Rights Reserved.
120.21 - */
120.22 -
120.23 -package org.netbeans.modules.encoder.ui.basic;
120.24 -
120.25 -/**
120.26 - * Since the SchemaVistor interface does not allow any checked exception being
120.27 - * thrown, the following runtime exception is used to mark any failure
120.28 - * in applying/removing encoding.
120.29 - *
120.30 - * @author Jun Xu
120.31 - */
120.32 -public class ApplyEncodingException extends RuntimeException {
120.33 -
120.34 - public ApplyEncodingException(String message, Throwable cause) {
120.35 - super(message, cause);
120.36 - }
120.37 -
120.38 - public ApplyEncodingException(String message) {
120.39 - super(message);
120.40 - }
120.41 -
120.42 - public ApplyEncodingException(Throwable cause) {
120.43 - super(cause);
120.44 - }
120.45 -}
121.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
121.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
121.3 @@ -1,66 +0,0 @@
121.4 -OpenIDE-Module-Long-Description=\
121.5 - Encoder GUI framework and utility classes used by all encoder GUI modules
121.6 -OpenIDE-Module-Name=Encoder Basic UI
121.7 -OpenIDE-Module-Display-Category=ESB
121.8 -
121.9 -xsd_based_validator.exp.null_schemaComponent=schemaComponent is null
121.10 -
121.11 -xsd_based_validator.msg.no_top_elem=found no top elements.
121.12 -
121.13 -xsd_based_validator.exp.null_error_handler=Null error handler
121.14 -
121.15 -xsd_based_validator.exp.null_schema_model=Null schema model
121.16 -
121.17 -xsd_based_validator.exp.null_style=Null style
121.18 -
121.19 -utils.encoding_action_io_pane_title=Encoding Action
121.20 -
121.21 -schema_util.exp.elem_is_null=elem is null.
121.22 -
121.23 -remove_enc_conf.lbl.deletion_confirm=All encoding related configuration will be deleted, continue?
121.24 -
121.25 -remove_enc_conf.lbl.warn_modify_ref_schemas=Note\: Checking above option may cause the referenced schemas being modified.
121.26 -
121.27 -remove_enc_conf.lbl.apply_to_ref_schemas=Apply to All Referenced Schemas
121.28 -
121.29 -remove_encoding.lbl.ro-model=Read Only Model
121.30 -
121.31 -remove_encoding.lbl.title1=Remove Encoding
121.32 -
121.33 -remove_encoding.lbl.title=Remove Encoding
121.34 -
121.35 -Finished_removing_encoding=Finished removing encoding.
121.36 -
121.37 -Removing_Encoding=Removing Encoding
121.38 -
121.39 -remove_encoding.msg.cancelled_by_user=Process cancelled by user.
121.40 -
121.41 -remove_encoding.lbl.notify_lengthy_proc=Notify Lengthy Process
121.42 -
121.43 -remove_encoding.msg.start_remove_encoding=Start to remove encoding...
121.44 -
121.45 -remove_encoding.lbl.cancel=Cancel
121.46 -
121.47 -remove_encoding.lbl.process=Process
121.48 -
121.49 -remove_encoding.lbl.warn_big_size=The size of the XSD file(s) is over 300K. This process may\ntake from couple seconds to {0,number,integer} minute(s) depending on\nvarious situation. Continue?
121.50 -
121.51 -remove_encoding.lbl.warn_readonly_model=The model is read only: ''{0}''. Continue to remove encoding from other referenced schemas?
121.52 -
121.53 -remove_encoding.msg.rmv_encoding_from=Removing encoding from {0}
121.54 -
121.55 -remove_encoding.msg.num_of_element_modified=Modified {0,number,integer} element declarations.
121.56 -
121.57 -remove_encoding.msg.num_of_cplxtyp_modified=Modified {0,number,integer} complex type definitions.
121.58 -
121.59 -remove_encoding.msg.num_of_simptyp_modified=Modified {0,number,integer} simple type definitions.
121.60 -
121.61 -encoding_action.exp.had_no_popup=Action had no popup presenter.
121.62 -
121.63 -encoding_action.lbl.action_name=Encoding
121.64 -
121.65 -encoding_action.exp.should_never_be_called=Should never be called.
121.66 -
121.67 -apply_enc_conf.lbl.warning_mod_ref_schemas=Note\: Checking the above option may cause the referenced schemas being modified.
121.68 -
121.69 -apply_enc_conf.lbl.apply_to_ref_schemas=Apply to All Referenced Schemas
122.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/EncodingAction.java Sat Sep 27 15:34:52 2008 -0700
122.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
122.3 @@ -1,142 +0,0 @@
122.4 -/*
122.5 - * The contents of this file are subject to the terms of the Common Development
122.6 - * and Distribution License (the License). You may not use this file except in
122.7 - * compliance with the License.
122.8 - *
122.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
122.10 - * or http://www.netbeans.org/cddl.txt.
122.11 -
122.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
122.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
122.14 - * If applicable, add the following below the CDDL Header, with the fields
122.15 - * enclosed by brackets [] replaced by your own identifying information:
122.16 - * "Portions Copyrighted [year] [name of copyright owner]"
122.17 - *
122.18 - * The Original Software is NetBeans. The Initial Developer of the Original
122.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
122.20 - * Microsystems, Inc. All Rights Reserved.
122.21 - */
122.22 -
122.23 -package org.netbeans.modules.encoder.ui.basic;
122.24 -
122.25 -import java.io.IOException;
122.26 -import java.util.ArrayList;
122.27 -import java.util.List;
122.28 -import java.util.ResourceBundle;
122.29 -import javax.swing.JMenu;
122.30 -import javax.swing.JMenuItem;
122.31 -import javax.swing.JPopupMenu;
122.32 -import javax.swing.JSeparator;
122.33 -import org.openide.ErrorManager;
122.34 -import org.openide.filesystems.FileObject;
122.35 -import org.openide.filesystems.Repository;
122.36 -import org.openide.loaders.DataFolder;
122.37 -import org.openide.loaders.DataObject;
122.38 -import org.openide.loaders.InstanceDataObject;
122.39 -import org.openide.nodes.Node;
122.40 -import org.openide.util.HelpCtx;
122.41 -import org.openide.util.actions.NodeAction;
122.42 -import org.openide.util.actions.Presenter;
122.43 -import org.openide.util.actions.SystemAction;
122.44 -
122.45 -/**
122.46 - * The encoding action that is displayed in the popup menu of an XSD document.
122.47 - *
122.48 - * @author Jun Xu
122.49 - */
122.50 -public class EncodingAction extends NodeAction {
122.51 - private static final long serialVersionUID = 1L;
122.52 - private static final ResourceBundle _bundle =
122.53 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); //NOI18N
122.54 -
122.55 - protected void performAction(Node[] node) {
122.56 - assert false : _bundle.getString("encoding_action.exp.should_never_be_called"); //NOI18N
122.57 - }
122.58 -
122.59 - protected boolean enable(Node[] node) {
122.60 - return true;
122.61 - }
122.62 -
122.63 - public String getName() {
122.64 - return _bundle.getString("encoding_action.lbl.action_name"); //NOI18N
122.65 - }
122.66 -
122.67 - public JMenuItem getPopupPresenter() {
122.68 - return new LazyMenu(getName());
122.69 - }
122.70 -
122.71 - public HelpCtx getHelpCtx() {
122.72 - return HelpCtx.DEFAULT_HELP;
122.73 - }
122.74 -
122.75 - /** List of system actions to be displayed within this one's toolbar or submenu. */
122.76 - private static final SystemAction[] grouped() {
122.77 -
122.78 - FileObject fo =
122.79 - Repository.getDefault().getDefaultFileSystem().findResource(
122.80 - "Loaders/text/x-schema+xml/Actions/encoding"); //NOI18N
122.81 - DataFolder df = DataFolder.findFolder(fo);
122.82 - DataObject[] dataObjs = df.getChildren();
122.83 - if (dataObjs == null || dataObjs.length == 0) {
122.84 - return new SystemAction[0];
122.85 - }
122.86 - List<SystemAction> actionList = new ArrayList<SystemAction>();
122.87 - for (int i = 0; i < dataObjs.length; i++) {
122.88 - if (dataObjs[i] instanceof InstanceDataObject) {
122.89 - Class clazz;
122.90 - try {
122.91 - clazz = ((InstanceDataObject) dataObjs[i]).instanceClass();
122.92 - } catch (ClassNotFoundException ex) {
122.93 - ErrorManager.getDefault().notify(ex);
122.94 - return new SystemAction[0];
122.95 - } catch (IOException ex) {
122.96 - ErrorManager.getDefault().notify(ex);
122.97 - return new SystemAction[0];
122.98 - }
122.99 - if (SystemAction.class.isAssignableFrom(clazz)) {
122.100 - actionList.add(SystemAction.get(clazz));
122.101 - } else if (JSeparator.class.isAssignableFrom(clazz)) {
122.102 - actionList.add(null);
122.103 - }
122.104 - }
122.105 - }
122.106 - return actionList.toArray(new SystemAction[0]);
122.107 - }
122.108 -
122.109 - /**
122.110 - * Avoids constructing submenu until it will be needed.
122.111 - */
122.112 - protected class LazyMenu extends JMenu {
122.113 - private final static long serialVersionUID = 1L;
122.114 -
122.115 - public LazyMenu(String name) {
122.116 - super(name);
122.117 - }
122.118 -
122.119 - public JPopupMenu getPopupMenu() {
122.120 - //TODO:
122.121 - //Hack: always remove all items so sub menus can be recomputed.
122.122 - removeAll();
122.123 - if (getItemCount() == 0) {
122.124 - SystemAction[] grouped = grouped();
122.125 - for (int i = 0; i < grouped.length; i++) {
122.126 - SystemAction action = grouped[i];
122.127 - if (action == null) {
122.128 - addSeparator();
122.129 - } else if (action instanceof Presenter.Popup) {
122.130 - //TODO
122.131 - //Hack: always force the enabled to be refreshed no
122.132 - //matter the model has been changed or not. The hack was
122.133 - //created because so far don't know in what condition
122.134 - //the resultchanged() event is fired.
122.135 - action.setEnabled(true);
122.136 - add(((Presenter.Popup)action).getPopupPresenter());
122.137 - } else {
122.138 - assert false : _bundle.getString("encoding_action.exp.had_no_popup") + action; //NOI18N
122.139 - }
122.140 - }
122.141 - }
122.142 - return super.getPopupMenu();
122.143 - }
122.144 - }
122.145 -}
123.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/EncodingConst.java Sat Sep 27 15:34:52 2008 -0700
123.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
123.3 @@ -1,41 +0,0 @@
123.4 -/*
123.5 - * The contents of this file are subject to the terms of the Common Development
123.6 - * and Distribution License (the License). You may not use this file except in
123.7 - * compliance with the License.
123.8 - *
123.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
123.10 - * or http://www.netbeans.org/cddl.txt.
123.11 -
123.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
123.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
123.14 - * If applicable, add the following below the CDDL Header, with the fields
123.15 - * enclosed by brackets [] replaced by your own identifying information:
123.16 - * "Portions Copyrighted [year] [name of copyright owner]"
123.17 - *
123.18 - * The Original Software is NetBeans. The Initial Developer of the Original
123.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
123.20 - * Microsystems, Inc. All Rights Reserved.
123.21 - */
123.22 -
123.23 -package org.netbeans.modules.encoder.ui.basic;
123.24 -
123.25 -/**
123.26 - * Class for holding encoding framework related constants.
123.27 - *
123.28 - * @author Jun Xu
123.29 - */
123.30 -public abstract class EncodingConst {
123.31 -
123.32 - /**
123.33 - * Constant used to indicate the source of appinfo deemed to be encoding
123.34 - * related. Also used as the namespace that governs the elements or
123.35 - * attributes that are used to describe generic encoding properties, e.g.,
123.36 - * the "top" flag.
123.37 - */
123.38 - public static final String URI = "urn:com.sun:encoder"; //NOI18N
123.39 -
123.40 - /**
123.41 - * Local name of the element that holds the value of the "top" flag
123.42 - */
123.43 - public static final String TOP_FLAG = "top"; //NOI18N
123.44 -}
124.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/EncodingMark.java Sat Sep 27 15:34:52 2008 -0700
124.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
124.3 @@ -1,67 +0,0 @@
124.4 -/*
124.5 - * The contents of this file are subject to the terms of the Common Development
124.6 - * and Distribution License (the License). You may not use this file except in
124.7 - * compliance with the License.
124.8 - *
124.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
124.10 - * or http://www.netbeans.org/cddl.txt.
124.11 -
124.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
124.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
124.14 - * If applicable, add the following below the CDDL Header, with the fields
124.15 - * enclosed by brackets [] replaced by your own identifying information:
124.16 - * "Portions Copyrighted [year] [name of copyright owner]"
124.17 - *
124.18 - * The Original Software is NetBeans. The Initial Developer of the Original
124.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
124.20 - * Microsystems, Inc. All Rights Reserved.
124.21 - */
124.22 -
124.23 -package org.netbeans.modules.encoder.ui.basic;
124.24 -
124.25 -/**
124.26 - * The instance of this class represents the encoding mark held in an XSD if it
124.27 - * has encoding style applied.
124.28 - *
124.29 - * @author Jun Xu
124.30 - */
124.31 -public class EncodingMark {
124.32 -
124.33 - /**
124.34 - * Encoding style name
124.35 - */
124.36 - private final String mName;
124.37 -
124.38 - /**
124.39 - * Encoding style namespace used in AppInfo
124.40 - */
124.41 - private final String mNamespace;
124.42 -
124.43 - /**
124.44 - * Encoding style ID
124.45 - */
124.46 - private final String mStyle;
124.47 -
124.48 - /** Creates a new instance of EncodingMark
124.49 - * @param name encoding style name, e.g. "Custom Encoding"
124.50 - * @param namespace namespace of encoding style e.g. "urn:com.sun:encoder-custom-1.0"
124.51 - * @param style encoding style ID, e.g. "customencoder-1.0"
124.52 - */
124.53 - public EncodingMark(String name, String namespace, String style) {
124.54 - mName = name;
124.55 - mNamespace = namespace;
124.56 - mStyle = style;
124.57 - }
124.58 -
124.59 - public String getName() {
124.60 - return mName;
124.61 - }
124.62 -
124.63 - public String getNamespace() {
124.64 - return mNamespace;
124.65 - }
124.66 -
124.67 - public String getStyle() {
124.68 - return mStyle;
124.69 - }
124.70 -}
125.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/InvalidAppInfoException.java Sat Sep 27 15:34:52 2008 -0700
125.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
125.3 @@ -1,46 +0,0 @@
125.4 -/*
125.5 - * The contents of this file are subject to the terms of the Common Development
125.6 - * and Distribution License (the License). You may not use this file except in
125.7 - * compliance with the License.
125.8 - *
125.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
125.10 - * or http://www.netbeans.org/cddl.txt.
125.11 -
125.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
125.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
125.14 - * If applicable, add the following below the CDDL Header, with the fields
125.15 - * enclosed by brackets [] replaced by your own identifying information:
125.16 - * "Portions Copyrighted [year] [name of copyright owner]"
125.17 - *
125.18 - * The Original Software is NetBeans. The Initial Developer of the Original
125.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
125.20 - * Microsystems, Inc. All Rights Reserved.
125.21 - */
125.22 -package org.netbeans.modules.encoder.ui.basic;
125.23 -
125.24 -/**
125.25 - * Exception thrown when invalidity in appinfo is detected during parsing
125.26 - * custom encoder related appinfo.
125.27 - *
125.28 - * @author Jun Xu
125.29 - */
125.30 -public class InvalidAppInfoException extends Exception {
125.31 -
125.32 - private static final long serialVersionUID = 1L;
125.33 -
125.34 - public InvalidAppInfoException() {
125.35 - super();
125.36 - }
125.37 -
125.38 - public InvalidAppInfoException(String message) {
125.39 - super(message);
125.40 - }
125.41 -
125.42 - public InvalidAppInfoException(String message, Throwable cause) {
125.43 - super(message, cause);
125.44 - }
125.45 -
125.46 - public InvalidAppInfoException(Throwable cause) {
125.47 - super(cause);
125.48 - }
125.49 -}
126.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ModelUtils.java Sat Sep 27 15:34:52 2008 -0700
126.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
126.3 @@ -1,461 +0,0 @@
126.4 -/*
126.5 - * The contents of this file are subject to the terms of the Common Development
126.6 - * and Distribution License (the License). You may not use this file except in
126.7 - * compliance with the License.
126.8 - *
126.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
126.10 - * or http://www.netbeans.org/cddl.txt.
126.11 -
126.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
126.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
126.14 - * If applicable, add the following below the CDDL Header, with the fields
126.15 - * enclosed by brackets [] replaced by your own identifying information:
126.16 - * "Portions Copyrighted [year] [name of copyright owner]"
126.17 - *
126.18 - * The Original Software is NetBeans. The Initial Developer of the Original
126.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
126.20 - * Microsystems, Inc. All Rights Reserved.
126.21 - */
126.22 -
126.23 -package org.netbeans.modules.encoder.ui.basic;
126.24 -
126.25 -import java.io.IOException;
126.26 -import java.net.URL;
126.27 -import java.util.ArrayList;
126.28 -import java.util.Collection;
126.29 -import java.util.HashSet;
126.30 -import java.util.Iterator;
126.31 -import java.util.List;
126.32 -import java.util.Set;
126.33 -import javax.swing.text.Document;
126.34 -import org.netbeans.modules.xml.schema.model.Annotation;
126.35 -import org.netbeans.modules.xml.schema.model.AppInfo;
126.36 -import org.netbeans.modules.xml.schema.model.GlobalElement;
126.37 -import org.netbeans.modules.xml.schema.model.Schema;
126.38 -import org.netbeans.modules.xml.schema.model.SchemaModel;
126.39 -import org.netbeans.modules.xml.schema.model.SchemaModelReference;
126.40 -import org.netbeans.modules.xml.schema.ui.basic.SchemaModelCookie;
126.41 -import org.netbeans.modules.xml.xam.Model;
126.42 -import org.netbeans.modules.xml.xam.ModelSource;
126.43 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
126.44 -import org.openide.filesystems.FileObject;
126.45 -import org.openide.filesystems.FileStateInvalidException;
126.46 -import org.openide.filesystems.FileUtil;
126.47 -import org.openide.loaders.DataObject;
126.48 -import org.openide.loaders.DataObjectNotFoundException;
126.49 -import org.openide.nodes.Node;
126.50 -import org.w3c.dom.NodeList;
126.51 -
126.52 -/**
126.53 - * A utility class.
126.54 - *
126.55 - * @author Jun Xu
126.56 - */
126.57 -public class ModelUtils {
126.58 -
126.59 - private static final String EMPTY_DOC =
126.60 - "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\"/>"; //NOI18N
126.61 -
126.62 - /**
126.63 - * Gets the schema model from a XSD node. This method is copied from
126.64 - * <code>org.netbeans.modules.xml.schema.core.actions.SchemaTransformAction</code>.
126.65 - * @param node the XSD Node instance
126.66 - * @return the schema model if the node has one, otherwise null
126.67 - */
126.68 - public static SchemaModel getSchemaModelFromNode(final Node node)
126.69 - throws IOException {
126.70 - if(node == null)
126.71 - return null;
126.72 -
126.73 - DataObject dobj = node.getCookie(DataObject.class);
126.74 - SchemaModelCookie modelCookie =
126.75 - dobj.getCookie(SchemaModelCookie.class);
126.76 -
126.77 - return modelCookie.getModel();
126.78 - }
126.79 -
126.80 - /**
126.81 - * Checks if the schema model is writable.
126.82 - * @param model the schema model
126.83 - * @return true if the model is writable
126.84 - */
126.85 - public static boolean isModelWritable(Model model) {
126.86 - if (model != null) {
126.87 - ModelSource ms = model.getModelSource();
126.88 - if (ms.isEditable()) {
126.89 - FileObject fo = (FileObject) ms.getLookup().lookup(FileObject.class);
126.90 - if (fo != null) {
126.91 - return fo.canWrite();
126.92 - }
126.93 - }
126.94 - }
126.95 - return false;
126.96 - }
126.97 -
126.98 - public static String getFilePath(Model model) {
126.99 - if (model != null) {
126.100 - ModelSource ms = model.getModelSource();
126.101 - FileObject fo = (FileObject) ms.getLookup().lookup(FileObject.class);
126.102 - if (fo != null) {
126.103 - return FileUtil.toFile(fo).getAbsolutePath();
126.104 - }
126.105 - }
126.106 - return null;
126.107 - }
126.108 -
126.109 - public static URL getFileURL(Model model) throws FileStateInvalidException {
126.110 - if (model != null) {
126.111 - ModelSource ms = model.getModelSource();
126.112 - FileObject fo = (FileObject) ms.getLookup().lookup(FileObject.class);
126.113 - if (fo != null) {
126.114 - return fo.getURL();
126.115 - }
126.116 - }
126.117 - return null;
126.118 - }
126.119 -
126.120 - public static String getPublicId(SchemaModel model) {
126.121 - return model.getSchema().getTargetNamespace();
126.122 - }
126.123 -
126.124 - public static String getSystemId(SchemaModel model) {
126.125 - URL url = null;
126.126 - String systemId;
126.127 - try {
126.128 - url = getFileURL(model);
126.129 - } catch (FileStateInvalidException ex1) {
126.130 - }
126.131 - if (url != null) {
126.132 - systemId = url.toExternalForm();
126.133 - } else {
126.134 - systemId = getFilePath(model);
126.135 - }
126.136 - return systemId;
126.137 - }
126.138 -
126.139 - public static void applyEncodingMark(SchemaModel model, String displayName,
126.140 - String namespace, String style) throws IOException {
126.141 - Schema schema = model.getSchema();
126.142 - Annotation anno = schema.getAnnotation();
126.143 - if (anno == null) {
126.144 - anno = model.getFactory().createAnnotation();
126.145 - schema.setAnnotation(anno);
126.146 - }
126.147 - for (AppInfo appInfo : anno.getAppInfos()) {
126.148 - if (EncodingConst.URI.equals(appInfo.getURI())) {
126.149 - return;
126.150 - }
126.151 - }
126.152 - AppInfo newAppInfo = model.getFactory().createAppInfo();
126.153 - newAppInfo.setURI(EncodingConst.URI);
126.154 - StringBuffer sb = new StringBuffer();
126.155 - sb.append("<enc:encoding xmlns:enc=\"").append(EncodingConst.URI).append('"'); //NOI18N
126.156 - sb.append(" name=\"").append(displayName).append('"'); //NOI18N
126.157 - sb.append(" namespace=\"").append(namespace).append('"'); //NOI18N
126.158 - sb.append(" style=\"").append(style).append("\"/>"); //NOI18N
126.159 - newAppInfo.setContentFragment(sb.toString());
126.160 - anno.addAppInfo(newAppInfo);
126.161 - }
126.162 -
126.163 - public static boolean isEncodedWith(SchemaModel model, String style) {
126.164 - EncodingMark mark = getEncodingMark(model);
126.165 - return mark != null && style.equals(mark.getStyle());
126.166 - }
126.167 -
126.168 - /**
126.169 - * Checks if the model has an encoding mark
126.170 - *
126.171 - * @param model the schema model
126.172 - * @return true if the schema model has the encoding marker, otherwise false
126.173 - */
126.174 - public static boolean hasEncodingMark(SchemaModel model) {
126.175 - Schema schema = model.getSchema();
126.176 - Annotation anno = schema.getAnnotation();
126.177 - if (anno == null) {
126.178 - return false;
126.179 - }
126.180 - for (AppInfo appInfo : anno.getAppInfos()) {
126.181 - if (EncodingConst.URI.equals(appInfo.getURI())) {
126.182 - return true;
126.183 - }
126.184 - }
126.185 - return false;
126.186 - }
126.187 -
126.188 - /**
126.189 - * Removes the encoding mark from a schema model.
126.190 - *
126.191 - * @param model the schema model
126.192 - * @return true if indeed modified something
126.193 - */
126.194 - public static boolean removeEncodingMark(SchemaModel model) {
126.195 - Schema schema = model.getSchema();
126.196 - Annotation anno = schema.getAnnotation();
126.197 - if (anno == null) {
126.198 - return false;
126.199 - }
126.200 - AppInfo[] appInfos = anno.getAppInfos().toArray(new AppInfo[0]);
126.201 - boolean modified = false;
126.202 - for (int i = 0; appInfos != null && i < appInfos.length; i++) {
126.203 - if (EncodingConst.URI.equals(appInfos[i].getURI())) {
126.204 - anno.removeAppInfo(appInfos[i]);
126.205 - modified = true;
126.206 - }
126.207 - }
126.208 - return modified;
126.209 - }
126.210 -
126.211 - public static AppInfo getEncodingAppinfo(Annotation anno) {
126.212 - Collection<AppInfo> appinfos = anno.getAppInfos();
126.213 - if (appinfos == null || appinfos.size() == 0) {
126.214 - return null;
126.215 - }
126.216 - for (AppInfo appinfo : appinfos) {
126.217 - if (EncodingConst.URI.equals(appinfo.getURI())) {
126.218 - return appinfo;
126.219 - }
126.220 - }
126.221 - return null;
126.222 - }
126.223 -
126.224 - /**
126.225 - * Gets the encoding mark of the model
126.226 - *
126.227 - * @param model the schema model
126.228 - * @return the encoding mark if the schema model has an encoding mark,
126.229 - * otherwise <code>null</code>
126.230 - */
126.231 - public static EncodingMark getEncodingMark(SchemaModel model) {
126.232 - Schema schema = model.getSchema();
126.233 - Annotation anno = schema.getAnnotation();
126.234 - if (anno == null) {
126.235 - return null;
126.236 - }
126.237 - for (AppInfo appInfo : anno.getAppInfos()) {
126.238 - if (EncodingConst.URI.equals(appInfo.getURI())) {
126.239 - NodeList nodeList =
126.240 - appInfo.getPeer().getChildNodes();
126.241 - if (nodeList == null || nodeList.getLength() == 0) {
126.242 - return null;
126.243 - }
126.244 - org.w3c.dom.Element encodingElem = null;
126.245 - for (int i = 0; i < nodeList.getLength(); i++) {
126.246 - if (nodeList.item(i).getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) {
126.247 - // Skip non-element nodes, e.g. text node (containing Character Data such as \n, spaces, etc.
126.248 - continue;
126.249 - }
126.250 - org.w3c.dom.Element elem = (org.w3c.dom.Element) nodeList.item(i);
126.251 - if (EncodingConst.URI.equals(elem.getNamespaceURI())
126.252 - && "encoding".equals(elem.getLocalName())) { //NOI18N
126.253 - encodingElem = elem;
126.254 - break;
126.255 - } else {
126.256 - String elemName = elem.getNodeName();
126.257 - int pos;
126.258 - String ns, localName;
126.259 - if ((pos = elemName.indexOf(':')) > 0) {
126.260 - ns = elem.lookupNamespaceURI(elemName.substring(0, pos));
126.261 - localName = elemName.substring(pos + 1);
126.262 - } else {
126.263 - ns = elem.lookupNamespaceURI(""); //NOI18N
126.264 - localName = elemName;
126.265 - }
126.266 - if (EncodingConst.URI.equals(ns)
126.267 - && "encoding".equals(localName)) { //NOI18N
126.268 - encodingElem = elem;
126.269 - break;
126.270 - }
126.271 - }
126.272 - }
126.273 - if (encodingElem != null) {
126.274 - return new EncodingMark(encodingElem.getAttribute("name"), //NOI18N
126.275 - encodingElem.getAttribute("namespace"), encodingElem.getAttribute("style")); //NOI18N
126.276 - }
126.277 - }
126.278 - }
126.279 - return null;
126.280 - }
126.281 -
126.282 - public static Collection<GlobalElement> getTopElements(SchemaModel model) {
126.283 - List<GlobalElement> topElements = new ArrayList<GlobalElement>();
126.284 - Schema schema = model.getSchema();
126.285 - Collection<GlobalElement> elements = schema.getElements();
126.286 - if (elements == null) {
126.287 - return topElements;
126.288 - }
126.289 - NodeList nodeList;
126.290 - for (GlobalElement element : elements) {
126.291 - Annotation anno = element.getAnnotation();
126.292 - if (anno == null) {
126.293 - continue;
126.294 - }
126.295 - Collection<AppInfo> appInfos = anno.getAppInfos();
126.296 - for (AppInfo appInfo : appInfos) {
126.297 - if (EncodingConst.URI.equals(appInfo.getURI())) {
126.298 - nodeList = appInfo.getPeer().getChildNodes();
126.299 - if (nodeList == null || nodeList.getLength() == 0) {
126.300 - break;
126.301 - }
126.302 - org.w3c.dom.Element topFlagElem = null;
126.303 - for (int i = 0; i < nodeList.getLength(); i++) {
126.304 - if (nodeList.item(i).getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) {
126.305 - continue;
126.306 - }
126.307 - org.w3c.dom.Element elem = (org.w3c.dom.Element) nodeList.item(i);
126.308 - if (EncodingConst.URI.equals(elem.getNamespaceURI())
126.309 - && EncodingConst.TOP_FLAG.equals(elem.getLocalName())) {
126.310 - topFlagElem = elem;
126.311 - break;
126.312 - } else {
126.313 - String elemName = elem.getNodeName();
126.314 - int pos;
126.315 - String ns, localName;
126.316 - if ((pos = elemName.indexOf(':')) > 0) {
126.317 - ns = elem.lookupNamespaceURI(elemName.substring(0, pos));
126.318 - localName = elemName.substring(pos + 1);
126.319 - } else {
126.320 - ns = elem.lookupNamespaceURI(""); //NOI18N
126.321 - localName = elemName;
126.322 - }
126.323 - if (EncodingConst.URI.equals(ns)
126.324 - && EncodingConst.TOP_FLAG.equals(localName)) {
126.325 - topFlagElem = elem;
126.326 - break;
126.327 - }
126.328 - }
126.329 - }
126.330 - if (topFlagElem != null) {
126.331 - nodeList = topFlagElem.getChildNodes();
126.332 - if (nodeList.getLength() > 0
126.333 - && nodeList.item(0).getNodeType() == org.w3c.dom.Node.TEXT_NODE) {
126.334 - if ("true".equals(nodeList.item(0).getNodeValue())) { //NOI18N
126.335 - topElements.add(element);
126.336 - }
126.337 - }
126.338 - }
126.339 - }
126.340 - }
126.341 - }
126.342 - return topElements;
126.343 - }
126.344 -
126.345 - public static void visitModel(SchemaModel model, ModelVisitor visitor,
126.346 - boolean includeReferenced)
126.347 - throws CatalogModelException {
126.348 - Set<SchemaModel> modelVisited = new HashSet<SchemaModel>();
126.349 - Set<SchemaModel> modelToBeVisited = new HashSet<SchemaModel>();
126.350 - modelToBeVisited.add(model);
126.351 - SchemaModel refModel;
126.352 - while (!modelToBeVisited.isEmpty()) {
126.353 - model = modelToBeVisited.iterator().next();
126.354 - if (!visitor.visit(model)) {
126.355 - break;
126.356 - }
126.357 - ModelSource source = model.getModelSource();
126.358 - if (!visitor.visit((Document) source.getLookup().lookup(Document.class))) {
126.359 - break;
126.360 - }
126.361 - FileObject fo = (FileObject) source.getLookup().lookup(FileObject.class);
126.362 - if (!visitor.visit(fo)) {
126.363 - break;
126.364 - }
126.365 - try {
126.366 - DataObject dataObj = DataObject.find(fo);
126.367 - if (!visitor.visit(dataObj)) {
126.368 - break;
126.369 - }
126.370 - } catch (DataObjectNotFoundException ex) {
126.371 - //Ignore
126.372 - }
126.373 - if (!includeReferenced) {
126.374 - break;
126.375 - }
126.376 - modelToBeVisited.remove(model);
126.377 - modelVisited.add(model);
126.378 - Collection<SchemaModelReference> refs = model.getSchema().getSchemaReferences();
126.379 - for (SchemaModelReference schemaRef : refs) {
126.380 - refModel = schemaRef.resolveReferencedModel();
126.381 - if (!modelVisited.contains(refModel)) {
126.382 - modelToBeVisited.add(refModel);
126.383 - }
126.384 - }
126.385 - }
126.386 - }
126.387 -
126.388 - public static ModelStatus getModelStatus(SchemaModel model)
126.389 - throws CatalogModelException {
126.390 - return getModelStatus(model, true);
126.391 - }
126.392 -
126.393 - public static ModelStatus getModelStatus(SchemaModel model, boolean includeReferenced)
126.394 - throws CatalogModelException {
126.395 - ModelStatusCollector msc = new ModelStatusCollector();
126.396 - visitModel(model, msc, includeReferenced);
126.397 - return msc.getModelStatus();
126.398 - }
126.399 -
126.400 - public static class ModelStatus {
126.401 - private final int mTotalCharSize;
126.402 - private final boolean mIsModified;
126.403 - private final String[] mModifiedFiles;
126.404 -
126.405 - private ModelStatus (int totalCharSize, boolean modified, String[] modifiedFiles) {
126.406 - mTotalCharSize = totalCharSize;
126.407 - mIsModified = modified;
126.408 - mModifiedFiles = modifiedFiles;
126.409 - }
126.410 -
126.411 - public int getTotalCharSize() {
126.412 - return mTotalCharSize;
126.413 - }
126.414 -
126.415 - public boolean isModified() {
126.416 - return mIsModified;
126.417 - }
126.418 -
126.419 - public String[] getModifiedFiles() {
126.420 - return mModifiedFiles;
126.421 - }
126.422 - }
126.423 -
126.424 - private static class ModelStatusCollector implements ModelVisitor {
126.425 - private int mTotalCharSize = 0;
126.426 - private boolean mIsModified = false;
126.427 - private List<String> mModifiedFiles = new ArrayList<String>();
126.428 -
126.429 - public boolean visit(SchemaModel model) {
126.430 - return true;
126.431 - }
126.432 -
126.433 - public boolean visit(Document doc) {
126.434 - mTotalCharSize += (doc == null ? 0 : doc.getLength());
126.435 - return true;
126.436 - }
126.437 -
126.438 - public boolean visit(FileObject fileObj) {
126.439 - return true;
126.440 - }
126.441 -
126.442 - public boolean visit(DataObject dataObj) {
126.443 - if (dataObj == null) {
126.444 - return true;
126.445 - }
126.446 - if (dataObj.isModified()) {
126.447 - mIsModified = true;
126.448 - Set<FileObject> files = dataObj.files();
126.449 - if (files != null) {
126.450 - Iterator<FileObject> iter = files.iterator();
126.451 - while (iter.hasNext()) {
126.452 - mModifiedFiles.add(iter.next().getNameExt());
126.453 - }
126.454 - }
126.455 - }
126.456 - return true;
126.457 - }
126.458 -
126.459 - public ModelStatus getModelStatus() {
126.460 - return new ModelStatus(mTotalCharSize, mIsModified,
126.461 - mModifiedFiles.toArray(new String[0]));
126.462 - }
126.463 - }
126.464 -}
127.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ModelVisitor.java Sat Sep 27 15:34:52 2008 -0700
127.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
127.3 @@ -1,67 +0,0 @@
127.4 -/*
127.5 - * The contents of this file are subject to the terms of the Common Development
127.6 - * and Distribution License (the License). You may not use this file except in
127.7 - * compliance with the License.
127.8 - *
127.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
127.10 - * or http://www.netbeans.org/cddl.txt.
127.11 -
127.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
127.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
127.14 - * If applicable, add the following below the CDDL Header, with the fields
127.15 - * enclosed by brackets [] replaced by your own identifying information:
127.16 - * "Portions Copyrighted [year] [name of copyright owner]"
127.17 - *
127.18 - * The Original Software is NetBeans. The Initial Developer of the Original
127.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
127.20 - * Microsystems, Inc. All Rights Reserved.
127.21 - */
127.22 -
127.23 -package org.netbeans.modules.encoder.ui.basic;
127.24 -
127.25 -import javax.swing.text.Document;
127.26 -import org.netbeans.modules.xml.schema.model.SchemaModel;
127.27 -import org.openide.filesystems.FileObject;
127.28 -import org.openide.loaders.DataObject;
127.29 -
127.30 -/**
127.31 - * Interface used to do model level visit, which only visits the model
127.32 - * specified and all the models that are reachable through direct references
127.33 - * (inlcudes, imports and redefines) or indirect references.
127.34 - *
127.35 - * @author Jun Xu
127.36 - */
127.37 -public interface ModelVisitor {
127.38 -
127.39 - /**
127.40 - * Visits the model.
127.41 - *
127.42 - * @param model the model
127.43 - * @return false if want to stop visiting, otherwise true
127.44 - */
127.45 - public boolean visit(SchemaModel model);
127.46 -
127.47 - /**
127.48 - * Visits the document of the model.
127.49 - *
127.50 - * @param doc the document
127.51 - * @return false if want to stop visiting, otherwise true
127.52 - */
127.53 - public boolean visit(Document doc);
127.54 -
127.55 - /**
127.56 - * Visits the file object of the model.
127.57 - *
127.58 - * @param fileObj the file object
127.59 - * @return false if want to stop visiting, otherwise true
127.60 - */
127.61 - public boolean visit(FileObject fileObj);
127.62 -
127.63 - /**
127.64 - * Visits the data object of the model
127.65 - *
127.66 - * @param dataObj the data object
127.67 - * @return false if want to stop visiting, otherwise true
127.68 - */
127.69 - public boolean visit(DataObject dataObj);
127.70 -}
128.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ModelVisitorException.java Sat Sep 27 15:34:52 2008 -0700
128.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
128.3 @@ -1,39 +0,0 @@
128.4 -/*
128.5 - * The contents of this file are subject to the terms of the Common Development
128.6 - * and Distribution License (the License). You may not use this file except in
128.7 - * compliance with the License.
128.8 - *
128.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
128.10 - * or http://www.netbeans.org/cddl.txt.
128.11 -
128.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
128.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
128.14 - * If applicable, add the following below the CDDL Header, with the fields
128.15 - * enclosed by brackets [] replaced by your own identifying information:
128.16 - * "Portions Copyrighted [year] [name of copyright owner]"
128.17 - *
128.18 - * The Original Software is NetBeans. The Initial Developer of the Original
128.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
128.20 - * Microsystems, Inc. All Rights Reserved.
128.21 - */
128.22 -
128.23 -package org.netbeans.modules.encoder.ui.basic;
128.24 -
128.25 -/**
128.26 - *
128.27 - * @author jxu
128.28 - */
128.29 -public class ModelVisitorException extends RuntimeException {
128.30 -
128.31 - public ModelVisitorException(String message) {
128.32 - super(message);
128.33 - }
128.34 -
128.35 - public ModelVisitorException(Throwable cause) {
128.36 - super(cause);
128.37 - }
128.38 -
128.39 - public ModelVisitorException(String message, Throwable cause) {
128.40 - super(message, cause);
128.41 - }
128.42 -}
129.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ProgressDialog.java Sat Sep 27 15:34:52 2008 -0700
129.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
129.3 @@ -1,74 +0,0 @@
129.4 -/*
129.5 - * The contents of this file are subject to the terms of the Common Development
129.6 - * and Distribution License (the License). You may not use this file except in
129.7 - * compliance with the License.
129.8 - *
129.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
129.10 - * or http://www.netbeans.org/cddl.txt.
129.11 -
129.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
129.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
129.14 - * If applicable, add the following below the CDDL Header, with the fields
129.15 - * enclosed by brackets [] replaced by your own identifying information:
129.16 - * "Portions Copyrighted [year] [name of copyright owner]"
129.17 - *
129.18 - * The Original Software is NetBeans. The Initial Developer of the Original
129.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
129.20 - * Microsystems, Inc. All Rights Reserved.
129.21 - */
129.22 -
129.23 -package org.netbeans.modules.encoder.ui.basic;
129.24 -
129.25 -import java.awt.BorderLayout;
129.26 -import java.awt.Dimension;
129.27 -import javax.swing.JComponent;
129.28 -import javax.swing.JDialog;
129.29 -import org.netbeans.api.progress.ProgressHandle;
129.30 -import org.netbeans.api.progress.ProgressHandleFactory;
129.31 -import org.openide.windows.WindowManager;
129.32 -
129.33 -/**
129.34 - * A utility for handling progress information
129.35 - *
129.36 - * @author Jun Xu
129.37 - */
129.38 -public class ProgressDialog {
129.39 -
129.40 - private final ProgressHandle mProgHandle;
129.41 - private final JDialog mDialog;
129.42 - private final JComponent mProgBar;
129.43 -
129.44 - private ProgressDialog(ProgressHandle handle, JDialog dialog, JComponent progBar) {
129.45 - mProgHandle = handle;
129.46 - mDialog = dialog;
129.47 - mProgBar = progBar;
129.48 - }
129.49 -
129.50 - public static ProgressDialog newInstance(String title) {
129.51 - ProgressHandle progHandle =
129.52 - ProgressHandleFactory.createHandle(title);
129.53 - JComponent progBar = ProgressHandleFactory.createProgressComponent(progHandle);
129.54 - progBar.setSize(new Dimension(400, 20));
129.55 - final JDialog dialog = new JDialog(
129.56 - WindowManager.getDefault().getMainWindow(), title, true);
129.57 - dialog.setLayout(new BorderLayout());
129.58 - dialog.add(progBar, BorderLayout.CENTER);
129.59 - dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
129.60 - dialog.setSize(400, 70);
129.61 - dialog.setLocationRelativeTo(null);
129.62 - return new ProgressDialog(progHandle, dialog, progBar);
129.63 - }
129.64 -
129.65 - public ProgressHandle getHandle() {
129.66 - return mProgHandle;
129.67 - }
129.68 -
129.69 - public JDialog getDialog() {
129.70 - return mDialog;
129.71 - }
129.72 -
129.73 - public JComponent getBar() {
129.74 - return mProgBar;
129.75 - }
129.76 -}
129.77 -
130.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/RemoveEncodingAction.java Sat Sep 27 15:34:52 2008 -0700
130.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
130.3 @@ -1,286 +0,0 @@
130.4 -/*
130.5 - * The contents of this file are subject to the terms of the Common Development
130.6 - * and Distribution License (the License). You may not use this file except in
130.7 - * compliance with the License.
130.8 - *
130.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
130.10 - * or http://www.netbeans.org/cddl.txt.
130.11 -
130.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
130.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
130.14 - * If applicable, add the following below the CDDL Header, with the fields
130.15 - * enclosed by brackets [] replaced by your own identifying information:
130.16 - * "Portions Copyrighted [year] [name of copyright owner]"
130.17 - *
130.18 - * The Original Software is NetBeans. The Initial Developer of the Original
130.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
130.20 - * Microsystems, Inc. All Rights Reserved.
130.21 - */
130.22 -
130.23 -package org.netbeans.modules.encoder.ui.basic;
130.24 -
130.25 -import java.awt.Dialog;
130.26 -import java.awt.event.ActionEvent;
130.27 -import java.awt.event.ActionListener;
130.28 -import java.io.IOException;
130.29 -import java.util.ResourceBundle;
130.30 -import javax.swing.JOptionPane;
130.31 -import javax.swing.text.Document;
130.32 -import org.netbeans.modules.xml.schema.model.SchemaModel;
130.33 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
130.34 -import org.openide.DialogDescriptor;
130.35 -import org.openide.DialogDisplayer;
130.36 -import org.openide.ErrorManager;
130.37 -import org.openide.filesystems.FileObject;
130.38 -import org.openide.loaders.DataObject;
130.39 -import org.openide.nodes.Node;
130.40 -import org.openide.util.HelpCtx;
130.41 -import org.openide.util.NbBundle;
130.42 -import org.openide.util.Utilities;
130.43 -import org.openide.util.actions.NodeAction;
130.44 -import org.openide.windows.InputOutput;
130.45 -import org.openide.windows.OutputWriter;
130.46 -import org.openide.windows.WindowManager;
130.47 -
130.48 -/**
130.49 - * The action that removes all encoding related AppInfo from XSD(s).
130.50 - *
130.51 - * @author Jun Xu
130.52 - */
130.53 -public class RemoveEncodingAction extends NodeAction {
130.54 -
130.55 - private static final ResourceBundle _bundle =
130.56 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); //NOI18N
130.57 - private static final String PROCESS = _bundle.getString("remove_encoding.lbl.process"); //NOI18N
130.58 - private static final String CANCEL = _bundle.getString("remove_encoding.lbl.cancel"); //NOI18N
130.59 -
130.60 - public static void removeEncoding(final SchemaModel model,
130.61 - final boolean applyToReferenced) throws IOException, CatalogModelException {
130.62 -
130.63 - InputOutput io = Utils.getEncodingIO();
130.64 - io.select();
130.65 - final OutputWriter console = io.getOut();
130.66 - console.println(_bundle.getString("remove_encoding.msg.start_remove_encoding")); //NOI18N
130.67 -
130.68 - ModelUtils.ModelStatus modelStatus =
130.69 - ModelUtils.getModelStatus(model, applyToReferenced);
130.70 -
130.71 - if (modelStatus.getTotalCharSize() > 300 * 1024) {
130.72 - int estimate = (int) ((modelStatus.getTotalCharSize() / 18000.0 / 60.0) + 0.5);
130.73 - String msg = NbBundle.getMessage(RemoveEncodingAction.class,
130.74 - "remove_encoding.lbl.warn_big_size", estimate); //NOI18N
130.75 - int option =
130.76 - JOptionPane.showConfirmDialog(
130.77 - WindowManager.getDefault().getMainWindow(),
130.78 - msg,
130.79 - _bundle.getString("remove_encoding.lbl.notify_lengthy_proc"), //NOI18N
130.80 - JOptionPane.YES_NO_OPTION);
130.81 - if (option == JOptionPane.NO_OPTION) {
130.82 - console.println(_bundle.getString("remove_encoding.msg.cancelled_by_user")); //NOI18N
130.83 - return;
130.84 - }
130.85 -
130.86 - final ProgressDialog progDialog =
130.87 - ProgressDialog.newInstance(_bundle.getString("Removing_Encoding")); //NOI18N
130.88 - new Thread(new Runnable() {
130.89 - public void run() {
130.90 -
130.91 - progDialog.getHandle().start();
130.92 - progDialog.getHandle().switchToIndeterminate();
130.93 - final ModelVisitor visitor = new RemoveEncodingSync();
130.94 - try {
130.95 - ModelUtils.visitModel(model, visitor, applyToReferenced);
130.96 - } catch (CatalogModelException ex) {
130.97 - throw new RuntimeException(ex);
130.98 - } finally {
130.99 - progDialog.getHandle().finish();
130.100 - progDialog.getDialog().setVisible(false);
130.101 - }
130.102 - console.println(_bundle.getString("Finished_removing_encoding")); //NOI18N
130.103 - }
130.104 - }).start();
130.105 - progDialog.getDialog().setVisible(true);
130.106 - } else {
130.107 - ModelVisitor visitor = new RemoveEncodingSync();
130.108 - ModelUtils.visitModel(model, visitor, applyToReferenced);
130.109 - console.println(_bundle.getString("Finished_removing_encoding")); //NOI18N
130.110 - }
130.111 - }
130.112 -
130.113 - protected void performAction(Node[] node) {
130.114 - try {
130.115 - Utils.getEncodingIO().getOut().reset();
130.116 - } catch (IOException ex) {
130.117 - //Ignore
130.118 - }
130.119 - showDialog(node);
130.120 - }
130.121 -
130.122 - private void showDialog(final Node[] node) {
130.123 - final RemoveEncodingConfirmation confirmPane = new RemoveEncodingConfirmation();
130.124 - confirmPane.setApplyToReferenced(true);
130.125 - DialogDescriptor dialogDescriptor =
130.126 - new DialogDescriptor(confirmPane,
130.127 - _bundle.getString("remove_encoding.lbl.title"), //NOI18N
130.128 - true,
130.129 - new Object[] {PROCESS, CANCEL},
130.130 - PROCESS,
130.131 - DialogDescriptor.BOTTOM_ALIGN,
130.132 - HelpCtx.DEFAULT_HELP,
130.133 - this);
130.134 - dialogDescriptor.setClosingOptions(new Object[] {PROCESS, CANCEL});
130.135 - dialogDescriptor.setButtonListener(new ActionListener() {
130.136 - public void actionPerformed(ActionEvent e) {
130.137 - String action = e.getActionCommand();
130.138 - if (action.equals(PROCESS)) {
130.139 - try {
130.140 - confirmPane.setCursor(Utilities.createProgressCursor(confirmPane));
130.141 - process(node, confirmPane.isApplyToReferenced());
130.142 - } finally {
130.143 - confirmPane.setCursor(null);
130.144 - }
130.145 - }
130.146 - }
130.147 - });
130.148 - Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
130.149 - dialog.setModal(true);
130.150 - dialog.setVisible(true);
130.151 - }
130.152 -
130.153 - private void process(final Node[] node, boolean applyToReferenced) {
130.154 - SchemaModel model = null;
130.155 - for (int nodeIndex = 0; nodeIndex < node.length; nodeIndex++) {
130.156 - try {
130.157 - model = ModelUtils.getSchemaModelFromNode(node[nodeIndex]);
130.158 - if (model == null) {
130.159 - continue;
130.160 - }
130.161 - removeEncoding(model, applyToReferenced);
130.162 - } catch (IOException ex) {
130.163 - ErrorManager.getDefault().notify(ex);
130.164 - } catch (ApplyEncodingException ex) {
130.165 - ErrorManager.getDefault().notify(ex);
130.166 - } catch (CatalogModelException ex) {
130.167 - ErrorManager.getDefault().notify(ex);
130.168 - }
130.169 - }
130.170 - }
130.171 -
130.172 - public String getName() {
130.173 - return _bundle.getString("remove_encoding.lbl.title1"); //NOI18N
130.174 - }
130.175 -
130.176 - public HelpCtx getHelpCtx() {
130.177 - return HelpCtx.DEFAULT_HELP;
130.178 - }
130.179 -
130.180 - protected boolean asynchronous() {
130.181 - return false;
130.182 - }
130.183 -
130.184 - protected boolean enable(Node[] node) {
130.185 - //Check if it is writable
130.186 - if (node == null || node.length == 0) {
130.187 - return false;
130.188 - }
130.189 - SchemaModel sm = null;
130.190 - try {
130.191 - sm = ModelUtils.getSchemaModelFromNode(node[0]);
130.192 - } catch (IOException ex) {
130.193 - ErrorManager.getDefault().log(ErrorManager.EXCEPTION,
130.194 - ex.toString());
130.195 - return false;
130.196 - }
130.197 - boolean writable = ModelUtils.isModelWritable(sm);
130.198 - if (!writable) {
130.199 - return false;
130.200 - }
130.201 - return ModelUtils.hasEncodingMark(sm);
130.202 - }
130.203 -
130.204 - /**
130.205 - * Visitor class for removing encoding to the in-memory model and
130.206 - * with model always synchronized. For huge models, this process might be
130.207 - * very time consuming.
130.208 - */
130.209 - private static class RemoveEncodingSync implements ModelVisitor {
130.210 -
130.211 - private OutputWriter mConsole = Utils.getEncodingIO().getOut();
130.212 - private boolean mSkip = false;
130.213 -
130.214 - public boolean visit(SchemaModel model) {
130.215 - if (!ModelUtils.isModelWritable(model)) {
130.216 - if (mSkip) {
130.217 - return true;
130.218 - }
130.219 - String msg = NbBundle.getMessage(RemoveEncodingAction.class,
130.220 - "remove_encoding.lbl.warn_readonly_model", //NOI18N
130.221 - ModelUtils.getFilePath(model));
130.222 - int option =
130.223 - JOptionPane.showConfirmDialog(
130.224 - WindowManager.getDefault().getMainWindow(),
130.225 - msg,
130.226 - _bundle.getString("remove_encoding.lbl.ro-model"), //NOI18N
130.227 - JOptionPane.YES_NO_OPTION);
130.228 - if (option == JOptionPane.NO_OPTION) {
130.229 - mConsole.println(
130.230 - _bundle.getString("remove_encoding.msg.cancelled_by_user")); //NOI18N
130.231 - return false;
130.232 - }
130.233 - mSkip = true;
130.234 - return true;
130.235 - }
130.236 - mConsole.println(
130.237 - NbBundle.getMessage(
130.238 - RemoveEncodingAction.class,
130.239 - "remove_encoding.msg.rmv_encoding_from", //NOI18N
130.240 - ModelUtils.getFilePath(model)));
130.241 - boolean transStarted = false;
130.242 - try {
130.243 - if (!model.isIntransaction()) {
130.244 - if (!model.startTransaction()) {
130.245 - //TODO how to handle???
130.246 - } else {
130.247 - transStarted = true;
130.248 - }
130.249 - }
130.250 - ModelUtils.removeEncodingMark(model);
130.251 - RemoveEncodingVisitor visitor =
130.252 - new RemoveEncodingVisitor(model);
130.253 - model.getSchema().accept(visitor);
130.254 - mConsole.println(
130.255 - NbBundle.getMessage(
130.256 - RemoveEncodingAction.class,
130.257 - "remove_encoding.msg.num_of_element_modified", //NOI18N
130.258 - visitor.getElementModified()));
130.259 - mConsole.println(
130.260 - NbBundle.getMessage(
130.261 - RemoveEncodingAction.class,
130.262 - "remove_encoding.msg.num_of_cplxtyp_modified", //NOI18N
130.263 - visitor.getComplexTypeModified()));
130.264 - mConsole.println(
130.265 - NbBundle.getMessage(
130.266 - RemoveEncodingAction.class,
130.267 - "remove_encoding.msg.num_of_simptyp_modified", //NOI18N
130.268 - visitor.getSimpleTypeModified()));
130.269 - } finally {
130.270 - if (transStarted) {
130.271 - model.endTransaction();
130.272 - }
130.273 - }
130.274 - return true;
130.275 - }
130.276 -
130.277 - public boolean visit(Document doc) {
130.278 - return true;
130.279 - }
130.280 -
130.281 - public boolean visit(FileObject fileObj) {
130.282 - return true;
130.283 - }
130.284 -
130.285 - public boolean visit(DataObject dataObj) {
130.286 - return true;
130.287 - }
130.288 - }
130.289 -}
131.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/RemoveEncodingConfirmation.form Sat Sep 27 15:34:52 2008 -0700
131.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
131.3 @@ -1,78 +0,0 @@
131.4 -<?xml version="1.0" encoding="UTF-8" ?>
131.5 -
131.6 -<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
131.7 - <AuxValues>
131.8 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
131.9 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
131.10 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
131.11 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
131.12 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
131.13 - </AuxValues>
131.14 -
131.15 - <Layout>
131.16 - <DimensionLayout dim="0">
131.17 - <Group type="103" groupAlignment="0" attributes="0">
131.18 - <Group type="102" attributes="0">
131.19 - <EmptySpace max="-2" attributes="0"/>
131.20 - <Group type="103" groupAlignment="0" attributes="0">
131.21 - <Group type="102" alignment="0" attributes="0">
131.22 - <Component id="warningLabel" pref="407" max="32767" attributes="0"/>
131.23 - <EmptySpace max="-2" attributes="0"/>
131.24 - </Group>
131.25 - <Group type="102" alignment="0" attributes="0">
131.26 - <Component id="applyToAllCheckBox" pref="362" max="32767" attributes="1"/>
131.27 - <EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
131.28 - </Group>
131.29 - <Group type="102" alignment="0" attributes="0">
131.30 - <Component id="descriptionLabel" min="-2" max="-2" attributes="1"/>
131.31 - <EmptySpace pref="34" max="32767" attributes="0"/>
131.32 - </Group>
131.33 - </Group>
131.34 - </Group>
131.35 - </Group>
131.36 - </DimensionLayout>
131.37 - <DimensionLayout dim="1">
131.38 - <Group type="103" groupAlignment="0" attributes="0">
131.39 - <Group type="102" alignment="1" attributes="0">
131.40 - <Component id="warningLabel" pref="28" max="32767" attributes="0"/>
131.41 - <EmptySpace max="-2" attributes="0"/>
131.42 - <Component id="applyToAllCheckBox" min="-2" max="-2" attributes="0"/>
131.43 - <EmptySpace max="-2" attributes="0"/>
131.44 - <Component id="descriptionLabel" min="-2" pref="24" max="-2" attributes="0"/>
131.45 - <EmptySpace min="-2" max="-2" attributes="0"/>
131.46 - </Group>
131.47 - </Group>
131.48 - </DimensionLayout>
131.49 - </Layout>
131.50 - <SubComponents>
131.51 - <Component class="javax.swing.JCheckBox" name="applyToAllCheckBox">
131.52 - <Properties>
131.53 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
131.54 - <ResourceString bundle="org/netbeans/modules/encoder/ui/basic/Bundle.properties" key="remove_enc_conf.lbl.apply_to_ref_schemas" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
131.55 - </Property>
131.56 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
131.57 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
131.58 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
131.59 - </Border>
131.60 - </Property>
131.61 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
131.62 - <Insets value="[0, 0, 0, 0]"/>
131.63 - </Property>
131.64 - </Properties>
131.65 - </Component>
131.66 - <Component class="javax.swing.JLabel" name="descriptionLabel">
131.67 - <Properties>
131.68 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
131.69 - <ResourceString bundle="org/netbeans/modules/encoder/ui/basic/Bundle.properties" key="remove_enc_conf.lbl.warn_modify_ref_schemas" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
131.70 - </Property>
131.71 - </Properties>
131.72 - </Component>
131.73 - <Component class="javax.swing.JLabel" name="warningLabel">
131.74 - <Properties>
131.75 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
131.76 - <ResourceString bundle="org/netbeans/modules/encoder/ui/basic/Bundle.properties" key="remove_enc_conf.lbl.deletion_confirm" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
131.77 - </Property>
131.78 - </Properties>
131.79 - </Component>
131.80 - </SubComponents>
131.81 -</Form>
132.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/RemoveEncodingConfirmation.java Sat Sep 27 15:34:52 2008 -0700
132.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
132.3 @@ -1,103 +0,0 @@
132.4 -/*
132.5 - * The contents of this file are subject to the terms of the Common Development
132.6 - * and Distribution License (the License). You may not use this file except in
132.7 - * compliance with the License.
132.8 - *
132.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
132.10 - * or http://www.netbeans.org/cddl.txt.
132.11 -
132.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
132.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
132.14 - * If applicable, add the following below the CDDL Header, with the fields
132.15 - * enclosed by brackets [] replaced by your own identifying information:
132.16 - * "Portions Copyrighted [year] [name of copyright owner]"
132.17 - *
132.18 - * The Original Software is NetBeans. The Initial Developer of the Original
132.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
132.20 - * Microsystems, Inc. All Rights Reserved.
132.21 - */
132.22 -
132.23 -package org.netbeans.modules.encoder.ui.basic;
132.24 -
132.25 -/**
132.26 - * The confirmation dialog before applying encoding settings.
132.27 - *
132.28 - * @author Jun Xu
132.29 - */
132.30 -public class RemoveEncodingConfirmation extends javax.swing.JPanel {
132.31 -
132.32 - /** Creates new form ApplyEncodingConfirmation */
132.33 - public RemoveEncodingConfirmation() {
132.34 - initComponents();
132.35 - }
132.36 -
132.37 - public boolean isApplyToReferenced() {
132.38 - return applyToAllCheckBox.isSelected();
132.39 - }
132.40 -
132.41 - public void setApplyToReferenced(boolean value) {
132.42 - applyToAllCheckBox.setSelected(value);
132.43 - }
132.44 -
132.45 - public boolean contains(int x, int y) {
132.46 - return true;
132.47 - }
132.48 -
132.49 - /** This method is called from within the constructor to
132.50 - * initialize the form.
132.51 - * WARNING: Do NOT modify this code. The content of this method is
132.52 - * always regenerated by the Form Editor.
132.53 - */
132.54 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
132.55 - private void initComponents() {
132.56 -
132.57 - applyToAllCheckBox = new javax.swing.JCheckBox();
132.58 - descriptionLabel = new javax.swing.JLabel();
132.59 - warningLabel = new javax.swing.JLabel();
132.60 -
132.61 - java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); // NOI18N
132.62 - applyToAllCheckBox.setText(bundle.getString("remove_enc_conf.lbl.apply_to_ref_schemas")); // NOI18N
132.63 - applyToAllCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
132.64 - applyToAllCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
132.65 -
132.66 - descriptionLabel.setText(bundle.getString("remove_enc_conf.lbl.warn_modify_ref_schemas")); // NOI18N
132.67 -
132.68 - warningLabel.setText(bundle.getString("remove_enc_conf.lbl.deletion_confirm")); // NOI18N
132.69 -
132.70 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
132.71 - this.setLayout(layout);
132.72 - layout.setHorizontalGroup(
132.73 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
132.74 - .add(layout.createSequentialGroup()
132.75 - .addContainerGap()
132.76 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
132.77 - .add(layout.createSequentialGroup()
132.78 - .add(warningLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
132.79 - .addContainerGap())
132.80 - .add(layout.createSequentialGroup()
132.81 - .add(applyToAllCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
132.82 - .add(60, 60, 60))
132.83 - .add(layout.createSequentialGroup()
132.84 - .add(descriptionLabel)
132.85 - .addContainerGap(34, Short.MAX_VALUE))))
132.86 - );
132.87 - layout.setVerticalGroup(
132.88 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
132.89 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
132.90 - .add(warningLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
132.91 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
132.92 - .add(applyToAllCheckBox)
132.93 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
132.94 - .add(descriptionLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
132.95 - .addContainerGap())
132.96 - );
132.97 - }// </editor-fold>//GEN-END:initComponents
132.98 -
132.99 -
132.100 - // Variables declaration - do not modify//GEN-BEGIN:variables
132.101 - private javax.swing.JCheckBox applyToAllCheckBox;
132.102 - private javax.swing.JLabel descriptionLabel;
132.103 - private javax.swing.JLabel warningLabel;
132.104 - // End of variables declaration//GEN-END:variables
132.105 -
132.106 -}
133.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/RemoveEncodingVisitor.java Sat Sep 27 15:34:52 2008 -0700
133.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
133.3 @@ -1,124 +0,0 @@
133.4 -/*
133.5 - * The contents of this file are subject to the terms of the Common Development
133.6 - * and Distribution License (the License). You may not use this file except in
133.7 - * compliance with the License.
133.8 - *
133.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
133.10 - * or http://www.netbeans.org/cddl.txt.
133.11 -
133.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
133.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
133.14 - * If applicable, add the following below the CDDL Header, with the fields
133.15 - * enclosed by brackets [] replaced by your own identifying information:
133.16 - * "Portions Copyrighted [year] [name of copyright owner]"
133.17 - *
133.18 - * The Original Software is NetBeans. The Initial Developer of the Original
133.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
133.20 - * Microsystems, Inc. All Rights Reserved.
133.21 - */
133.22 -
133.23 -package org.netbeans.modules.encoder.ui.basic;
133.24 -
133.25 -import org.netbeans.modules.xml.schema.model.Annotation;
133.26 -import org.netbeans.modules.xml.schema.model.AppInfo;
133.27 -import org.netbeans.modules.xml.schema.model.GlobalComplexType;
133.28 -import org.netbeans.modules.xml.schema.model.GlobalElement;
133.29 -import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
133.30 -import org.netbeans.modules.xml.schema.model.LocalComplexType;
133.31 -import org.netbeans.modules.xml.schema.model.LocalElement;
133.32 -import org.netbeans.modules.xml.schema.model.LocalSimpleType;
133.33 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
133.34 -import org.netbeans.modules.xml.schema.model.SchemaModel;
133.35 -import org.netbeans.modules.xml.schema.model.visitor.DeepSchemaVisitor;
133.36 -import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor;
133.37 -
133.38 -/**
133.39 - * The visitor that removes encoding information from every element declaration
133.40 - * and every type definition.
133.41 - *
133.42 - * @author Jun Xu
133.43 - */
133.44 -public class RemoveEncodingVisitor extends DeepSchemaVisitor implements SchemaVisitor {
133.45 -
133.46 - private final SchemaModel mModel;
133.47 - private int mElementModified = 0;
133.48 - private int mComplexTypeModified = 0;
133.49 - private int mSimpleTypeModified = 0;
133.50 -
133.51 - public RemoveEncodingVisitor(SchemaModel rootModel) {
133.52 - mModel = rootModel;
133.53 - }
133.54 -
133.55 - public void visit(LocalElement localElement) {
133.56 - if (removeEncoding(localElement)) {
133.57 - mElementModified++;
133.58 - }
133.59 - super.visit(localElement);
133.60 - }
133.61 -
133.62 - public void visit(GlobalElement globalElement) {
133.63 - if (removeEncoding(globalElement)) {
133.64 - mElementModified++;
133.65 - }
133.66 - super.visit(globalElement);
133.67 - }
133.68 -
133.69 - public void visit(GlobalSimpleType globalSimpleType) {
133.70 - if (removeEncoding(globalSimpleType)) {
133.71 - mSimpleTypeModified++;
133.72 - }
133.73 - super.visit(globalSimpleType);
133.74 - }
133.75 -
133.76 - public void visit(LocalSimpleType localSimpleType) {
133.77 - if (removeEncoding(localSimpleType)) {
133.78 - mSimpleTypeModified++;
133.79 - }
133.80 - super.visit(localSimpleType);
133.81 - }
133.82 -
133.83 - public void visit(GlobalComplexType globalComplexType) {
133.84 - if (removeEncoding(globalComplexType)) {
133.85 - mComplexTypeModified++;
133.86 - }
133.87 - super.visit(globalComplexType);
133.88 - }
133.89 -
133.90 - public void visit(LocalComplexType localComplexType) {
133.91 - if (removeEncoding(localComplexType)) {
133.92 - mComplexTypeModified++;
133.93 - }
133.94 - super.visit(localComplexType);
133.95 - }
133.96 -
133.97 - public int getElementModified() {
133.98 - return mElementModified;
133.99 - }
133.100 -
133.101 - public int getComplexTypeModified() {
133.102 - return mComplexTypeModified;
133.103 - }
133.104 -
133.105 - public int getSimpleTypeModified() {
133.106 - return mSimpleTypeModified;
133.107 - }
133.108 -
133.109 - private boolean removeEncoding(SchemaComponent component) {
133.110 - if (!mModel.equals(component.getModel())) {
133.111 - return false;
133.112 - }
133.113 - Annotation anno = component.getAnnotation();
133.114 - if (anno == null) {
133.115 - return false;
133.116 - }
133.117 - boolean found = false;
133.118 - AppInfo[] appInfos = anno.getAppInfos().toArray(new AppInfo[0]);
133.119 - for (int i = 0; appInfos != null && i < appInfos.length; i++) {
133.120 - if (EncodingConst.URI.equals(appInfos[i].getURI())) {
133.121 - anno.removeAppInfo(appInfos[i]);
133.122 - return true;
133.123 - }
133.124 - }
133.125 - return false;
133.126 - }
133.127 -}
134.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/SchemaUtility.java Sat Sep 27 15:34:52 2008 -0700
134.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
134.3 @@ -1,248 +0,0 @@
134.4 -/*
134.5 - * The contents of this file are subject to the terms of the Common Development
134.6 - * and Distribution License (the License). You may not use this file except in
134.7 - * compliance with the License.
134.8 - *
134.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
134.10 - * or http://www.netbeans.org/cddl.txt.
134.11 -
134.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
134.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
134.14 - * If applicable, add the following below the CDDL Header, with the fields
134.15 - * enclosed by brackets [] replaced by your own identifying information:
134.16 - * "Portions Copyrighted [year] [name of copyright owner]"
134.17 - *
134.18 - * The Original Software is NetBeans. The Initial Developer of the Original
134.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
134.20 - * Microsystems, Inc. All Rights Reserved.
134.21 - */
134.22 -
134.23 -package org.netbeans.modules.encoder.ui.basic;
134.24 -
134.25 -import java.util.List;
134.26 -import java.util.ResourceBundle;
134.27 -import javax.xml.XMLConstants;
134.28 -import javax.xml.namespace.QName;
134.29 -import org.apache.xmlbeans.SchemaType;
134.30 -import org.apache.xmlbeans.XmlBeans;
134.31 -import org.netbeans.modules.xml.schema.model.Choice;
134.32 -import org.netbeans.modules.xml.schema.model.ComplexType;
134.33 -import org.netbeans.modules.xml.schema.model.GlobalComplexType;
134.34 -import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
134.35 -import org.netbeans.modules.xml.schema.model.NameableSchemaComponent;
134.36 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
134.37 -import org.netbeans.modules.xml.schema.model.SimpleContent;
134.38 -import org.netbeans.modules.xml.schema.model.SimpleType;
134.39 -import org.netbeans.modules.xml.xam.dom.Attribute;
134.40 -import org.netbeans.modules.xml.schema.model.Element;
134.41 -import org.netbeans.modules.xml.schema.model.ElementReference;
134.42 -import org.netbeans.modules.xml.schema.model.GlobalType;
134.43 -import org.netbeans.modules.xml.schema.model.LocalType;
134.44 -import org.netbeans.modules.xml.schema.model.TypeContainer;
134.45 -
134.46 -/**
134.47 - * Schema utility class.
134.48 - *
134.49 - * @author Jun Xu
134.50 - */
134.51 -public class SchemaUtility {
134.52 -
134.53 - public static final Attribute TYPE_ATTR =
134.54 - new Attribute() {
134.55 - public Class getMemberType() {
134.56 - return null;
134.57 - }
134.58 -
134.59 - public String getName() {
134.60 - return "type"; //NOI18N
134.61 - }
134.62 -
134.63 - public Class getType() {
134.64 - return String.class;
134.65 - }
134.66 - };
134.67 -
134.68 - private static final ResourceBundle _bundle =
134.69 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); //NOI18N
134.70 -
134.71 - /**
134.72 - * Tests if the element is of simple type or a complex type with
134.73 - * simple content.
134.74 - *
134.75 - * @param elem the element declaration schema component
134.76 - */
134.77 - public static boolean isSimpleContent(Element elem) {
134.78 - if (elem == null) {
134.79 - throw new NullPointerException(
134.80 - _bundle.getString("schema_util.exp.elem_is_null")); //NOI18N
134.81 - }
134.82 - Object xmlType = getXMLType(elem);
134.83 - if (xmlType == null) {
134.84 - return false;
134.85 - }
134.86 - if (xmlType instanceof String) { //NOI18N
134.87 - if ("anyType".equals(xmlType)) {
134.88 - return false;
134.89 - }
134.90 - return true;
134.91 - }
134.92 - if (xmlType instanceof SimpleType) {
134.93 - return true;
134.94 - }
134.95 - //Must be complex type
134.96 - if (((ComplexType) xmlType).getDefinition() instanceof SimpleContent) {
134.97 - return true;
134.98 - }
134.99 - return false;
134.100 - }
134.101 -
134.102 - /**
134.103 - * Tests if an element's type contains a choice group.
134.104 - *
134.105 - * @param elem the element declaration schema component
134.106 - */
134.107 - public static boolean isChoice(Element elem) {
134.108 - if (elem == null) {
134.109 - throw new NullPointerException(
134.110 - _bundle.getString("schema_util.exp.elem_is_null")); //NOI18N
134.111 - }
134.112 - Object xmlType = getXMLType(elem);
134.113 - if (!(xmlType instanceof ComplexType)) {
134.114 - return false;
134.115 - }
134.116 - //Must be complex type
134.117 - return ((ComplexType) xmlType).getDefinition() instanceof Choice;
134.118 - }
134.119 -
134.120 - /**
134.121 - * Gets the XML type of an element declaration. The return value must be
134.122 - * one of the following:
134.123 - * <code>null</code> - either the element does not have a type or the
134.124 - * type is not resolvable
134.125 - * an instance of String - the element is of XSD built-in type (
134.126 - * the string contains the local name if the type)
134.127 - * an instance of SimpleType - the element is of simple type
134.128 - * an instance of ComplexType - the element is of complex type
134.129 - */
134.130 - public static Object getXMLType(Element elem) {
134.131 - if (elem == null) {
134.132 - throw new NullPointerException(
134.133 - _bundle.getString("schema_util.exp.elem_is_null")); //NOI18N
134.134 - }
134.135 -
134.136 - String type = elem.getAttribute(TYPE_ATTR);
134.137 - if (type == null) {
134.138 - List<SimpleType> stList = elem.getChildren(SimpleType.class);
134.139 - if (stList != null && stList.size() > 0) {
134.140 - return stList.get(0);
134.141 - }
134.142 - List<ComplexType> ctList = elem.getChildren(ComplexType.class);
134.143 - if (ctList != null && ctList.size() > 0) {
134.144 - return ctList.get(0);
134.145 - }
134.146 - //no type attribute specified and no inline simple or complex type
134.147 - return null;
134.148 - }
134.149 - String prefix = ""; //NOI18N
134.150 - int pos;
134.151 - if ((pos = type.indexOf(':')) >= 0 && type.length() > pos + 1) {
134.152 - prefix = type.substring(0, pos);
134.153 - type = type.substring(pos + 1);
134.154 - }
134.155 - if (elem.getPeer() == null) {
134.156 - return false;
134.157 - }
134.158 - String nsURI = elem.getPeer().lookupNamespaceURI(prefix);
134.159 - QName typeQName;
134.160 - if (nsURI == null || nsURI.length() == 0) {
134.161 - typeQName = new QName(type);
134.162 - } else {
134.163 - typeQName = new QName(nsURI, type);
134.164 - }
134.165 - SchemaType schemaType = XmlBeans.getBuiltinTypeSystem().findType(typeQName);
134.166 - if (schemaType != null && schemaType.isBuiltinType()) {
134.167 - //built-in type, return the type's local name
134.168 - return typeQName.getLocalPart();
134.169 - }
134.170 - GlobalSimpleType st = elem.getModel().resolve(
134.171 - typeQName.getNamespaceURI(), typeQName.getLocalPart(), GlobalSimpleType.class);
134.172 - if (st != null) {
134.173 - return st;
134.174 - }
134.175 - GlobalComplexType ct = elem.getModel().resolve(
134.176 - typeQName.getNamespaceURI(), typeQName.getLocalPart(), GlobalComplexType.class);
134.177 - if (ct != null) {
134.178 - return ct;
134.179 - }
134.180 - //not resolvable
134.181 - return null;
134.182 - }
134.183 -
134.184 - /**
134.185 - * Checks if the given element is of Any type.
134.186 - * @param elem an Element instance.
134.187 - * @return true if the given element is of Any type, or false otherwise.
134.188 - */
134.189 - public static boolean isOfAnyType(Element elem) {
134.190 - if (!(elem instanceof TypeContainer)) {
134.191 - return false;
134.192 - }
134.193 - GlobalType type = null;
134.194 - if (((TypeContainer) elem).getType() != null
134.195 - && ((TypeContainer) elem).getType().get() != null) {
134.196 - type = ((TypeContainer) elem).getType().get();
134.197 - }
134.198 - LocalType localType = ((TypeContainer) elem).getInlineType();
134.199 - if (type == null && localType == null) {
134.200 - return true;
134.201 - }
134.202 - if (type == null || !"anyType".equals(type.getName())) { //NOI18N
134.203 - return false;
134.204 - }
134.205 - if (type.getModel() == null
134.206 - || XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(
134.207 - type.getModel().getSchema().getTargetNamespace())) {
134.208 - return true;
134.209 - }
134.210 - return false;
134.211 - }
134.212 -
134.213 - public static boolean isAnyType(SchemaComponent type) {
134.214 - if (type == null) {
134.215 - return true;
134.216 - }
134.217 - if (!(type instanceof GlobalType)) {
134.218 - return false;
134.219 - }
134.220 - if (!"anyType".equals(((GlobalType) type).getName())) { //NOI18N
134.221 - return false;
134.222 - }
134.223 - if (type.getModel() == null
134.224 - || XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(
134.225 - type.getModel().getSchema().getTargetNamespace())) {
134.226 - return true;
134.227 - }
134.228 - return false;
134.229 - }
134.230 -
134.231 - public static String getNCName(SchemaComponent sc) {
134.232 - if (sc instanceof NameableSchemaComponent) {
134.233 - return ((NameableSchemaComponent) sc).getName();
134.234 - }
134.235 - return null;
134.236 - }
134.237 -
134.238 - public static String getNCNamePath(SchemaComponent[] scs) {
134.239 - if (scs == null || scs.length == 0) {
134.240 - return ""; //NOI18N
134.241 - }
134.242 - StringBuffer sb = new StringBuffer();
134.243 - for (int i = 0; i < scs.length; i++) {
134.244 - if ((scs[i] instanceof Element) && !(scs[i] instanceof ElementReference)
134.245 - && (scs[i] instanceof NameableSchemaComponent)) {
134.246 - sb.append('/').append(((NameableSchemaComponent) scs[i]).getName());
134.247 - }
134.248 - }
134.249 - return sb.toString();
134.250 - }
134.251 -}
135.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/Utils.java Sat Sep 27 15:34:52 2008 -0700
135.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
135.3 @@ -1,114 +0,0 @@
135.4 -/*
135.5 - * The contents of this file are subject to the terms of the Common Development
135.6 - * and Distribution License (the License). You may not use this file except in
135.7 - * compliance with the License.
135.8 - *
135.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
135.10 - * or http://www.netbeans.org/cddl.txt.
135.11 -
135.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
135.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
135.14 - * If applicable, add the following below the CDDL Header, with the fields
135.15 - * enclosed by brackets [] replaced by your own identifying information:
135.16 - * "Portions Copyrighted [year] [name of copyright owner]"
135.17 - *
135.18 - * The Original Software is NetBeans. The Initial Developer of the Original
135.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
135.20 - * Microsystems, Inc. All Rights Reserved.
135.21 - */
135.22 -
135.23 -package org.netbeans.modules.encoder.ui.basic;
135.24 -
135.25 -import java.awt.Component;
135.26 -import java.nio.charset.Charset;
135.27 -import java.util.ArrayList;
135.28 -import java.util.List;
135.29 -import java.util.Map;
135.30 -import java.util.ResourceBundle;
135.31 -import java.util.logging.Level;
135.32 -import java.util.logging.Logger;
135.33 -import javax.swing.JDialog;
135.34 -import javax.swing.JOptionPane;
135.35 -import org.openide.windows.IOProvider;
135.36 -import org.openide.windows.InputOutput;
135.37 -
135.38 -/**
135.39 - * Miscellaneous utility methods
135.40 - *
135.41 - * @author Jun Xu
135.42 - */
135.43 -public class Utils {
135.44 -
135.45 - private static final ResourceBundle _bundle =
135.46 - java.util.ResourceBundle.getBundle(
135.47 - "org/netbeans/modules/encoder/ui/basic/Bundle"); //NOI18N
135.48 - private static final String OUTPUT_PANE_NAME =
135.49 - _bundle.getString("utils.encoding_action_io_pane_title"); //NOI18N
135.50 -
135.51 - public static InputOutput getEncodingIO() {
135.52 - return IOProvider.getDefault().getIO(OUTPUT_PANE_NAME, false);
135.53 - }
135.54 -
135.55 - public static void notify(Object obj) {
135.56 - notify(obj, false, null, JOptionPane.INFORMATION_MESSAGE);
135.57 - }
135.58 -
135.59 - public static void notify(Object obj, boolean popupMsgBox,
135.60 - Component topComp, int messageType) {
135.61 - Level logLevel;
135.62 - if (messageType == JOptionPane.ERROR_MESSAGE) {
135.63 - logLevel = Level.SEVERE;
135.64 - } else if (messageType == JOptionPane.WARNING_MESSAGE) {
135.65 - logLevel = Level.WARNING;
135.66 - } else {
135.67 - if (obj instanceof Throwable) {
135.68 - logLevel = Level.SEVERE;
135.69 - } else {
135.70 - logLevel = Level.INFO;
135.71 - }
135.72 - }
135.73 - if (obj instanceof Throwable) {
135.74 - Logger.getLogger(Utils.class.getName()).log(
135.75 - logLevel, null, (Throwable) obj);
135.76 - } else {
135.77 - Logger.getLogger(Utils.class.getName()).log(
135.78 - logLevel, null, obj);
135.79 - }
135.80 - if (popupMsgBox) {
135.81 -
135.82 - class NarrowOptionPane extends JOptionPane {
135.83 -
135.84 - int maxCharactersPerLineCount;
135.85 -
135.86 - NarrowOptionPane(int maxCharactersPerLineCount) {
135.87 - this.maxCharactersPerLineCount = maxCharactersPerLineCount;
135.88 - }
135.89 -
135.90 - public int getMaxCharactersPerLineCount() {
135.91 - return maxCharactersPerLineCount;
135.92 - }
135.93 - }
135.94 - JOptionPane pane = new NarrowOptionPane(100);
135.95 - pane.setMessage(obj);
135.96 - pane.setMessageType(messageType);
135.97 - JDialog dialog = pane.createDialog(topComp, ""); //NOI18N
135.98 - dialog.setVisible(true);
135.99 - }
135.100 - }
135.101 -
135.102 - /**
135.103 - * Gets the list of all supported character sets plus some extra
135.104 - * coding methods that are supported by encoders.
135.105 - */
135.106 - public static String[] getCharsetNames(boolean includeExtra) {
135.107 - List<String> nameList = new ArrayList<String>();
135.108 - if (includeExtra) {
135.109 - nameList.add("base64");
135.110 - }
135.111 - Map<String, Charset> charsets = Charset.availableCharsets();
135.112 - for (String name : charsets.keySet()) {
135.113 - nameList.add(name);
135.114 - }
135.115 - return nameList.toArray(new String[0]);
135.116 - }
135.117 -}
136.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ValidationContext.java Sat Sep 27 15:34:52 2008 -0700
136.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
136.3 @@ -1,146 +0,0 @@
136.4 -/*
136.5 - * The contents of this file are subject to the terms of the Common Development
136.6 - * and Distribution License (the License). You may not use this file except in
136.7 - * compliance with the License.
136.8 - *
136.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
136.10 - * or http://www.netbeans.org/cddl.txt.
136.11 -
136.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
136.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
136.14 - * If applicable, add the following below the CDDL Header, with the fields
136.15 - * enclosed by brackets [] replaced by your own identifying information:
136.16 - * "Portions Copyrighted [year] [name of copyright owner]"
136.17 - *
136.18 - * The Original Software is NetBeans. The Initial Developer of the Original
136.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
136.20 - * Microsystems, Inc. All Rights Reserved.
136.21 - */
136.22 -
136.23 -package org.netbeans.modules.encoder.ui.basic;
136.24 -
136.25 -import java.util.ArrayList;
136.26 -import java.util.HashMap;
136.27 -import java.util.HashSet;
136.28 -import java.util.List;
136.29 -import java.util.Map;
136.30 -import java.util.Set;
136.31 -import org.netbeans.modules.xml.schema.model.Element;
136.32 -import org.netbeans.modules.xml.schema.model.ElementReference;
136.33 -import org.netbeans.modules.xml.schema.model.NameableSchemaComponent;
136.34 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
136.35 -
136.36 -/**
136.37 - * Context information that is passed in to concrete validaiton methods.
136.38 - *
136.39 - * @author Jun Xu
136.40 - */
136.41 -public class ValidationContext {
136.42 -
136.43 - public static final String PROP_TOP_ELEMENT_NCNAME = "topelemncname"; //NOI18N
136.44 - public static final String PROP_TOP_ELEMENT_PREFIX = "topelemprefix"; //NOI18N
136.45 -
136.46 - private List<SchemaComponent> _path;
136.47 - private Set<NameableSchemaComponent> _nameables;
136.48 - private Map<String, Object> _properties = new HashMap<String, Object>();
136.49 -
136.50 - /**
136.51 - * Creates a new instance of ValidationContext.
136.52 - */
136.53 - private ValidationContext() {
136.54 - }
136.55 -
136.56 - /**
136.57 - * Creates a new instance of ValidationContext.
136.58 - *
136.59 - * @param path the list if all parent schema component before
136.60 - * reaches the current schema component.
136.61 - * @param nameables all parent schema components that are nameable
136.62 - */
136.63 - private ValidationContext(List<SchemaComponent> path,
136.64 - Set<NameableSchemaComponent> nameables) {
136.65 - _path = path;
136.66 - _nameables = nameables;
136.67 - }
136.68 -
136.69 - public static ValidationContext createContext(List<SchemaComponent> path,
136.70 - Set<NameableSchemaComponent> nameables) {
136.71 - return new ValidationContext(path, nameables);
136.72 - }
136.73 -
136.74 - public List<SchemaComponent> getPath() {
136.75 - return _path;
136.76 - }
136.77 -
136.78 - public Set<NameableSchemaComponent> getNameables() {
136.79 - return _nameables;
136.80 - }
136.81 -
136.82 - public String getTopElementNCName() {
136.83 - return (String) _properties.get(PROP_TOP_ELEMENT_NCNAME);
136.84 - }
136.85 -
136.86 - public String getTopElementPrefix() {
136.87 - return (String) _properties.get(PROP_TOP_ELEMENT_PREFIX);
136.88 - }
136.89 -
136.90 - public void setTopElementNCName(String ncName) {
136.91 - _properties.put(PROP_TOP_ELEMENT_NCNAME, ncName);
136.92 - _properties.put(PROP_TOP_ELEMENT_PREFIX, ncName + ".");
136.93 - }
136.94 -
136.95 - public Object getProperty(String key) {
136.96 - return _properties.get(key);
136.97 - }
136.98 -
136.99 - public void setProperty(String key, Object value) {
136.100 - _properties.put(key, value);
136.101 - }
136.102 -
136.103 - public void removeProperty(String key) {
136.104 - _properties.remove(key);
136.105 - }
136.106 -
136.107 - /**
136.108 - * Gets a path ('/' separated) of all NC names of all elements
136.109 - */
136.110 - public String getElementNCNamePath() {
136.111 - StringBuffer sb = new StringBuffer();
136.112 - for (SchemaComponent sc : _path) {
136.113 - if ((sc instanceof Element) && !(sc instanceof ElementReference)
136.114 - && (sc instanceof NameableSchemaComponent)) {
136.115 - sb.append('/').append(((NameableSchemaComponent) sc).getName());
136.116 - }
136.117 - }
136.118 - return sb.toString();
136.119 - }
136.120 -
136.121 - /**
136.122 - * Gets a path ('/' separated) of all NC names of all elements this
136.123 - * context holds plus the one passed in.
136.124 - *
136.125 - * @param sc the last schema component in the path
136.126 - */
136.127 - public String getElementNCNamePath(SchemaComponent sc) {
136.128 - StringBuffer sb = new StringBuffer();
136.129 - for (SchemaComponent pe : _path) {
136.130 - if ((pe instanceof Element) && !(pe instanceof ElementReference)
136.131 - && (pe instanceof NameableSchemaComponent)) {
136.132 - sb.append('/').append(((NameableSchemaComponent) pe).getName());
136.133 - }
136.134 - }
136.135 - if ((sc instanceof Element) && !(sc instanceof ElementReference)
136.136 - && (sc instanceof NameableSchemaComponent)) {
136.137 - sb.append('/').append(((NameableSchemaComponent) sc).getName());
136.138 - }
136.139 - return sb.toString();
136.140 - }
136.141 -
136.142 - public ValidationContext clone() {
136.143 - ValidationContext obj = new ValidationContext();
136.144 - obj._path = new ArrayList<SchemaComponent>(_path);
136.145 - obj._nameables = new HashSet<NameableSchemaComponent>(_nameables);
136.146 - obj._properties = new HashMap<String, Object>(_properties);
136.147 - return obj;
136.148 - }
136.149 -}
137.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/ValidationException.java Sat Sep 27 15:34:52 2008 -0700
137.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
137.3 @@ -1,59 +0,0 @@
137.4 -/*
137.5 - * The contents of this file are subject to the terms of the Common Development
137.6 - * and Distribution License (the License). You may not use this file except in
137.7 - * compliance with the License.
137.8 - *
137.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
137.10 - * or http://www.netbeans.org/cddl.txt.
137.11 -
137.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
137.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
137.14 - * If applicable, add the following below the CDDL Header, with the fields
137.15 - * enclosed by brackets [] replaced by your own identifying information:
137.16 - * "Portions Copyrighted [year] [name of copyright owner]"
137.17 - *
137.18 - * The Original Software is NetBeans. The Initial Developer of the Original
137.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
137.20 - * Microsystems, Inc. All Rights Reserved.
137.21 - */
137.22 -
137.23 -package org.netbeans.modules.encoder.ui.basic;
137.24 -
137.25 -/**
137.26 - * Exception for indicating abnormal situation encountered during validation.
137.27 - * Normal validation errors (e.g., invalidity found in the document) should not
137.28 - * be fired using this exception. This exception is meant for reporting
137.29 - * severe problems occurred during validation and the whole validation process
137.30 - * should thus be stopped.
137.31 - *
137.32 - * @author Jun Xu
137.33 - */
137.34 -public class ValidationException extends Exception {
137.35 -
137.36 - /**
137.37 - * Constructs from an error message.
137.38 - *
137.39 - * @param message the error message
137.40 - */
137.41 - public ValidationException(String message) {
137.42 - super(message);
137.43 - }
137.44 -
137.45 - /**
137.46 - * Constructs from a throwable.
137.47 - * @param e the throwable
137.48 - */
137.49 - public ValidationException(Throwable e) {
137.50 - super(e);
137.51 - }
137.52 -
137.53 - /**
137.54 - * Constructs from a message and a throwable.
137.55 - *
137.56 - * @param message the error message
137.57 - * @param e the throwable
137.58 - */
137.59 - public ValidationException(String message, Throwable e) {
137.60 - super(message, e);
137.61 - }
137.62 -}
138.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/XsdBasedEncoderValidator.java Sat Sep 27 15:34:52 2008 -0700
138.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
138.3 @@ -1,535 +0,0 @@
138.4 -/*
138.5 - * The contents of this file are subject to the terms of the Common Development
138.6 - * and Distribution License (the License). You may not use this file except in
138.7 - * compliance with the License.
138.8 - *
138.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
138.10 - * or http://www.netbeans.org/cddl.txt.
138.11 -
138.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
138.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
138.14 - * If applicable, add the following below the CDDL Header, with the fields
138.15 - * enclosed by brackets [] replaced by your own identifying information:
138.16 - * "Portions Copyrighted [year] [name of copyright owner]"
138.17 - *
138.18 - * The Original Software is NetBeans. The Initial Developer of the Original
138.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
138.20 - * Microsystems, Inc. All Rights Reserved.
138.21 - */
138.22 -
138.23 -package org.netbeans.modules.encoder.ui.basic;
138.24 -
138.25 -import java.util.ArrayList;
138.26 -import java.util.Collection;
138.27 -import java.util.Collections;
138.28 -import java.util.HashMap;
138.29 -import java.util.HashSet;
138.30 -import java.util.List;
138.31 -import java.util.Map;
138.32 -import java.util.ResourceBundle;
138.33 -import java.util.Set;
138.34 -import java.util.logging.Logger;
138.35 -import javax.xml.namespace.QName;
138.36 -import org.netbeans.modules.xml.schema.model.All;
138.37 -import org.netbeans.modules.xml.schema.model.AnyElement;
138.38 -import org.netbeans.modules.xml.schema.model.Choice;
138.39 -import org.netbeans.modules.xml.schema.model.ComplexContent;
138.40 -import org.netbeans.modules.xml.schema.model.ComplexContentDefinition;
138.41 -import org.netbeans.modules.xml.schema.model.ComplexContentRestriction;
138.42 -import org.netbeans.modules.xml.schema.model.ComplexExtension;
138.43 -import org.netbeans.modules.xml.schema.model.ComplexExtensionDefinition;
138.44 -import org.netbeans.modules.xml.schema.model.ComplexType;
138.45 -import org.netbeans.modules.xml.schema.model.ComplexTypeDefinition;
138.46 -import org.netbeans.modules.xml.schema.model.Element;
138.47 -import org.netbeans.modules.xml.schema.model.ElementReference;
138.48 -import org.netbeans.modules.xml.schema.model.GlobalComplexType;
138.49 -import org.netbeans.modules.xml.schema.model.GlobalElement;
138.50 -import org.netbeans.modules.xml.schema.model.GlobalGroup;
138.51 -import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
138.52 -import org.netbeans.modules.xml.schema.model.GlobalType;
138.53 -import org.netbeans.modules.xml.schema.model.GroupReference;
138.54 -import org.netbeans.modules.xml.schema.model.LocalComplexType;
138.55 -import org.netbeans.modules.xml.schema.model.LocalElement;
138.56 -import org.netbeans.modules.xml.schema.model.LocalGroupDefinition;
138.57 -import org.netbeans.modules.xml.schema.model.LocalSimpleType;
138.58 -import org.netbeans.modules.xml.schema.model.NameableSchemaComponent;
138.59 -import org.netbeans.modules.xml.schema.model.SchemaComponent;
138.60 -import org.netbeans.modules.xml.schema.model.SchemaModel;
138.61 -import org.netbeans.modules.xml.schema.model.Sequence;
138.62 -import org.netbeans.modules.xml.schema.model.SequenceDefinition;
138.63 -import org.netbeans.modules.xml.schema.model.SimpleContent;
138.64 -import org.netbeans.modules.xml.schema.model.SimpleType;
138.65 -import org.netbeans.modules.xml.schema.model.TypeContainer;
138.66 -import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
138.67 -import org.xml.sax.ErrorHandler;
138.68 -import org.xml.sax.SAXException;
138.69 -import org.xml.sax.SAXParseException;
138.70 -
138.71 -/**
138.72 - * A generic validator for XSD based encoder implementation. With this
138.73 - * validator as base, to do local validation, the derived validator only
138.74 - * needs to overwrite some of the schema component specific
138.75 - * <code>validate</code> methods and doesn't need to worry about how the
138.76 - * navigation is done.
138.77 - *
138.78 - * @author Jun Xu
138.79 - */
138.80 -public class XsdBasedEncoderValidator {
138.81 -
138.82 - private static final ResourceBundle _bundle =
138.83 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); //NOI18N
138.84 - private static boolean _debug
138.85 - = "true".equals(System.getProperty("encoder.validator.debug")); //NOI18N
138.86 - private static Logger _logger;
138.87 - static {
138.88 - if (_debug) {
138.89 - _logger = Logger.getLogger(XsdBasedEncoderValidator.class.getName());
138.90 - }
138.91 - }
138.92 -
138.93 - protected final String _style;
138.94 - protected final SchemaModel _model;
138.95 - protected final ErrorHandler _handler;
138.96 -
138.97 - private final Map<QName, GlobalType> _globalTypeCache =
138.98 - new HashMap<QName, GlobalType>();
138.99 -
138.100 - /**
138.101 - * Creates a new instance of XsdBasedEncoderValidator.
138.102 - *
138.103 - * @param model the schema model
138.104 - * @param handler a SAX error handler
138.105 - */
138.106 - public XsdBasedEncoderValidator(String style, SchemaModel model,
138.107 - ErrorHandler handler) {
138.108 - if (style == null) {
138.109 - throw new NullPointerException(
138.110 - _bundle.getString("xsd_based_validator.exp.null_style")); //NOI18N
138.111 - }
138.112 - if (model == null) {
138.113 - throw new NullPointerException(
138.114 - _bundle.getString("xsd_based_validator.exp.null_schema_model")); //NOI18N
138.115 - }
138.116 - if (handler == null) {
138.117 - throw new NullPointerException(
138.118 - _bundle.getString("xsd_based_validator.exp.null_error_handler")); //NOI18N
138.119 - }
138.120 - _style = style;
138.121 - _model = model;
138.122 - _handler = handler;
138.123 - }
138.124 -
138.125 - /**
138.126 - * Do the validation.
138.127 - */
138.128 - public void validate() throws ValidationException, SAXException {
138.129 - if (!ModelUtils.isEncodedWith(_model, _style)) {
138.130 - return;
138.131 - }
138.132 - Collection<GlobalElement> topElements =
138.133 - ModelUtils.getTopElements(_model);
138.134 - if (topElements.isEmpty()) {
138.135 - foundNoTopElements();
138.136 - return;
138.137 - }
138.138 -
138.139 - for (GlobalElement topElem : topElements) {
138.140 - ValidationContext context =
138.141 - ValidationContext.createContext(
138.142 - new ArrayList<SchemaComponent>(),
138.143 - new HashSet<NameableSchemaComponent>());
138.144 - context.setTopElementNCName(topElem.getName());
138.145 - prepareContext(context);
138.146 - validateChild(context, topElem);
138.147 - }
138.148 - }
138.149 -
138.150 - protected void foundNoTopElements()
138.151 - throws ValidationException, SAXException {
138.152 - if (_debug) {
138.153 - _logger.info(_bundle.getString("xsd_based_validator.msg.no_top_elem")); //NOI18N
138.154 - }
138.155 - }
138.156 -
138.157 - protected void detectedRecursiveCondition(ValidationContext context,
138.158 - SchemaComponent schemaComponent)
138.159 - throws ValidationException, SAXException {
138.160 - if (_debug) {
138.161 - _logger.info("recursive condition: " + schemaComponent.toString());
138.162 - }
138.163 - }
138.164 -
138.165 - protected void validate(ValidationContext context,
138.166 - ElementReference elementRef)
138.167 - throws ValidationException, SAXException {
138.168 - if (_debug) {
138.169 - _logger.info("level: " + context.getPath().size());
138.170 - _logger.info("validate element reference: " + elementRef.toString()
138.171 - + ", ref: " + (elementRef.getRef() == null ?
138.172 - "<null>" : elementRef.getRef().getQName()));
138.173 - }
138.174 - }
138.175 -
138.176 - protected void validate(ValidationContext context,
138.177 - GlobalElement globalElement)
138.178 - throws ValidationException, SAXException {
138.179 - if (_debug) {
138.180 - _logger.info("level: " + context.getPath().size());
138.181 - _logger.info("validate global element: " + globalElement.getName());
138.182 - }
138.183 - }
138.184 -
138.185 - protected void validate(ValidationContext context,
138.186 - LocalElement localElement)
138.187 - throws ValidationException, SAXException {
138.188 - if (_debug) {
138.189 - _logger.info("level: " + context.getPath().size());
138.190 - _logger.info("validate local element: " + localElement.getName());
138.191 - }
138.192 - }
138.193 -
138.194 - protected void validate(ValidationContext context,
138.195 - GlobalComplexType globalComplexType)
138.196 - throws ValidationException, SAXException {
138.197 - if (_debug) {
138.198 - _logger.info("level: " + context.getPath().size());
138.199 - _logger.info("validate global complex type: "
138.200 - + globalComplexType.getName());
138.201 - }
138.202 - }
138.203 -
138.204 - protected void validate(ValidationContext context,
138.205 - LocalComplexType localComplexType)
138.206 - throws ValidationException, SAXException {
138.207 - if (_debug) {
138.208 - _logger.info("level: " + context.getPath().size());
138.209 - _logger.info("validate local complex type: "
138.210 - + localComplexType.toString());
138.211 - }
138.212 - }
138.213 -
138.214 - protected void validate(ValidationContext context,
138.215 - GlobalSimpleType globalSimpleType)
138.216 - throws ValidationException, SAXException {
138.217 - if (_debug) {
138.218 - _logger.info("level: " + context.getPath().size());
138.219 - _logger.info("validate global simple type: "
138.220 - + globalSimpleType.getName());
138.221 - }
138.222 - }
138.223 -
138.224 - protected void validate(ValidationContext context,
138.225 - LocalSimpleType localSimpleType)
138.226 - throws ValidationException, SAXException {
138.227 - if (_debug) {
138.228 - _logger.info("level: " + context.getPath().size());
138.229 - _logger.info("validate local simple type: "
138.230 - + localSimpleType.toString());
138.231 - }
138.232 - }
138.233 -
138.234 - protected void validate(ValidationContext context,
138.235 - Sequence sequence)
138.236 - throws ValidationException, SAXException {
138.237 - if (_debug) {
138.238 - _logger.info("level: " + context.getPath().size());
138.239 - _logger.info("validate sequence group: " + sequence.toString());
138.240 - }
138.241 - }
138.242 -
138.243 - protected void validate(ValidationContext context, All all)
138.244 - throws ValidationException, SAXException {
138.245 - if (_debug) {
138.246 - _logger.info("level: " + context.getPath().size());
138.247 - _logger.info("validate all group: " + all.toString());
138.248 - }
138.249 - }
138.250 -
138.251 - protected void validate(ValidationContext context, Choice choice)
138.252 - throws ValidationException, SAXException {
138.253 - if (_debug) {
138.254 - _logger.info("level: " + context.getPath().size());
138.255 - _logger.info("validate choice group: " + choice.toString());
138.256 - }
138.257 - }
138.258 -
138.259 - protected void validate(ValidationContext context, GroupReference groupRef)
138.260 - throws ValidationException, SAXException {
138.261 - if (_debug) {
138.262 - _logger.info("level: " + context.getPath().size());
138.263 - _logger.info("validate group reference: "
138.264 - + (groupRef.getRef() == null ?
138.265 - "<null>" : groupRef.getRef().getQName()));
138.266 - }
138.267 - }
138.268 -
138.269 - protected void validate(ValidationContext context,
138.270 - ComplexContent complexContent)
138.271 - throws ValidationException, SAXException {
138.272 - if (_debug) {
138.273 - _logger.info("level: " + context.getPath().size());
138.274 - _logger.info("validate complex content: " + complexContent.toString());
138.275 - }
138.276 - }
138.277 -
138.278 - protected void validate(ValidationContext context,
138.279 - SimpleContent simpleContent)
138.280 - throws ValidationException, SAXException {
138.281 - if (_debug) {
138.282 - _logger.info("level: " + context.getPath().size());
138.283 - _logger.info("validate simple content: " + simpleContent.toString());
138.284 - }
138.285 - }
138.286 -
138.287 - protected void validate(ValidationContext context, AnyElement anyElement)
138.288 - throws ValidationException, SAXException {
138.289 - if (_debug) {
138.290 - _logger.info("level: " + context.getPath().size());
138.291 - _logger.info("validate any element (wildcard): "
138.292 - + anyElement.toString());
138.293 - }
138.294 - }
138.295 -
138.296 - protected void validate(ValidationContext context, GlobalGroup globalGroup)
138.297 - throws ValidationException, SAXException {
138.298 - if (_debug) {
138.299 - _logger.info("level: " + context.getPath().size());
138.300 - _logger.info("validate global group: " + globalGroup.toString());
138.301 - }
138.302 - }
138.303 -
138.304 - protected void validate(ValidationContext context,
138.305 - ComplexContentRestriction ccRes)
138.306 - throws ValidationException, SAXException {
138.307 - if (_debug) {
138.308 - _logger.info("level: " + context.getPath().size());
138.309 - _logger.info("validate complex content restriction: "
138.310 - + ccRes.toString());
138.311 - }
138.312 - }
138.313 -
138.314 - protected void validate(ValidationContext context, ComplexExtension cxExt)
138.315 - throws ValidationException, SAXException {
138.316 - if (_debug) {
138.317 - _logger.info("level: " + context.getPath().size());
138.318 - _logger.info("validate complex content extension: "
138.319 - + cxExt.toString());
138.320 - }
138.321 - }
138.322 -
138.323 - protected void prepareContext(ValidationContext context)
138.324 - throws ValidationException, SAXException {
138.325 -
138.326 - }
138.327 -
138.328 - protected SchemaComponent getType(TypeContainer tContainer) {
138.329 - NamedComponentReference<? extends GlobalType> typeRef = tContainer.getType();
138.330 - if (typeRef != null) {
138.331 - GlobalType globalType = _globalTypeCache.get(typeRef.getQName());
138.332 - if (globalType != null) {
138.333 - return globalType;
138.334 - }
138.335 - globalType = typeRef.get();
138.336 - if (globalType != null) {
138.337 - _globalTypeCache.put(typeRef.getQName(), globalType);
138.338 - return globalType;
138.339 - }
138.340 - }
138.341 - return tContainer.getInlineType();
138.342 - }
138.343 -
138.344 - private void validateChild(ValidationContext context,
138.345 - SchemaComponent schemaComponent)
138.346 - throws ValidationException, SAXException {
138.347 - if (context.getNameables().contains(schemaComponent)) {
138.348 - detectedRecursiveCondition(context, schemaComponent);
138.349 - return;
138.350 - }
138.351 - ValidationContext newContext = context.clone();
138.352 - newContext.getPath().add(schemaComponent);
138.353 - if (schemaComponent instanceof NameableSchemaComponent) {
138.354 - newContext.getNameables().add(
138.355 - (NameableSchemaComponent) schemaComponent);
138.356 - }
138.357 - prepareContext(newContext);
138.358 - if (schemaComponent instanceof Element) {
138.359 - if (schemaComponent instanceof ElementReference) {
138.360 - validate(context, ((ElementReference) schemaComponent));
138.361 - } else if (schemaComponent instanceof GlobalElement) {
138.362 - validate(context, ((GlobalElement) schemaComponent));
138.363 - } else if (schemaComponent instanceof LocalElement) {
138.364 - validate(context, ((LocalElement) schemaComponent));
138.365 - }
138.366 - if (schemaComponent instanceof ElementReference) {
138.367 - validateChild(newContext,
138.368 - ((ElementReference) schemaComponent).getRef().get());
138.369 - } else if (schemaComponent instanceof TypeContainer) {
138.370 - validateChild(newContext, getType((TypeContainer) schemaComponent));
138.371 - }
138.372 - } else if (schemaComponent instanceof ComplexType) {
138.373 - if (schemaComponent instanceof GlobalComplexType) {
138.374 - validate(context, (GlobalComplexType) schemaComponent);
138.375 - } else if (schemaComponent instanceof LocalComplexType) {
138.376 - validate(context, (LocalComplexType) schemaComponent);
138.377 - }
138.378 - ComplexTypeDefinition definition =
138.379 - ((ComplexType) schemaComponent).getDefinition();
138.380 - if (definition != null) {
138.381 - validateChild(newContext, definition);
138.382 - }
138.383 - } else if (schemaComponent instanceof SimpleType) {
138.384 - if (schemaComponent instanceof GlobalSimpleType) {
138.385 - validate(context, (GlobalSimpleType) schemaComponent);
138.386 - } else if (schemaComponent instanceof LocalSimpleType) {
138.387 - validate(context, (LocalSimpleType) schemaComponent);
138.388 - }
138.389 - } else if (schemaComponent instanceof Sequence) {
138.390 - validate(context, (Sequence) schemaComponent);
138.391 - List<SequenceDefinition> content =
138.392 - ((Sequence) schemaComponent).getContent();
138.393 - for (SequenceDefinition se : content) {
138.394 - validateChild(newContext, se);
138.395 - }
138.396 - } else if (schemaComponent instanceof All) {
138.397 - validate(context, (All) schemaComponent);
138.398 - Collection<ElementReference> elemRefs =
138.399 - ((All) schemaComponent).getElementReferences();
138.400 - for (ElementReference ef : elemRefs) {
138.401 - validateChild(newContext, ef);
138.402 - }
138.403 - Collection<LocalElement> elems =
138.404 - ((All) schemaComponent).getElements();
138.405 - for (LocalElement le : elems) {
138.406 - validateChild(newContext, le);
138.407 - }
138.408 - } else if (schemaComponent instanceof Choice) {
138.409 - validate(context, (Choice) schemaComponent);
138.410 - Collection<ElementReference> elemRefs =
138.411 - ((Choice) schemaComponent).getElementReferences();
138.412 - for (ElementReference ef : elemRefs) {
138.413 - validateChild(newContext, ef);
138.414 - }
138.415 - Collection<LocalElement> elems =
138.416 - ((Choice) schemaComponent).getLocalElements();
138.417 - for (LocalElement le : elems) {
138.418 - validateChild(newContext, le);
138.419 - }
138.420 - Collection<AnyElement> anyElems =
138.421 - ((Choice) schemaComponent).getAnys();
138.422 - for (AnyElement ae : anyElems) {
138.423 - validateChild(newContext, ae);
138.424 - }
138.425 - Collection<Choice> choices =
138.426 - ((Choice) schemaComponent).getChoices();
138.427 - for (Choice ch : choices) {
138.428 - validateChild(newContext, ch);
138.429 - }
138.430 - Collection<GroupReference> groupRefs =
138.431 - ((Choice) schemaComponent).getGroupReferences();
138.432 - for (GroupReference grpRef : groupRefs) {
138.433 - validateChild(newContext, grpRef);
138.434 - }
138.435 - Collection<Sequence> sequences =
138.436 - ((Choice) schemaComponent).getSequences();
138.437 - for (Sequence sq : sequences) {
138.438 - validateChild(newContext, sq);
138.439 - }
138.440 - } else if (schemaComponent instanceof GroupReference) {
138.441 - validate(context, (GroupReference) schemaComponent);
138.442 - GlobalGroup globalGroup =
138.443 - ((GroupReference) schemaComponent).getRef().get();
138.444 - if (globalGroup != null) {
138.445 - validateChild(newContext, globalGroup);
138.446 - }
138.447 - } else if (schemaComponent instanceof ComplexContent) {
138.448 - validate(context, (ComplexContent) schemaComponent);
138.449 - ComplexContentDefinition contentDef =
138.450 - ((ComplexContent) schemaComponent).getLocalDefinition();
138.451 - if (contentDef != null) {
138.452 - validateChild(newContext, contentDef);
138.453 - }
138.454 - } else if (schemaComponent instanceof SimpleContent) {
138.455 - validate(context, (SimpleContent) schemaComponent);
138.456 - } else if (schemaComponent instanceof AnyElement) {
138.457 - validate(context, (AnyElement) schemaComponent);
138.458 - } else if (schemaComponent instanceof GlobalGroup) {
138.459 - validate(context, (GlobalGroup) schemaComponent);
138.460 - LocalGroupDefinition lgDef =
138.461 - ((GlobalGroup) schemaComponent).getDefinition();
138.462 - if (lgDef != null) {
138.463 - validateChild(newContext, lgDef);
138.464 - }
138.465 - } else if (schemaComponent instanceof ComplexContentRestriction) {
138.466 - validate(context, (ComplexContentRestriction) schemaComponent);
138.467 - GlobalComplexType gct =
138.468 - ((ComplexContentRestriction) schemaComponent).getBase().get();
138.469 - if (gct != null) {
138.470 - validateChild(newContext, gct);
138.471 - }
138.472 - ComplexTypeDefinition ctDef =
138.473 - ((ComplexContentRestriction) schemaComponent).getDefinition();
138.474 - if (ctDef != null) {
138.475 - validateChild(newContext, ctDef);
138.476 - }
138.477 - } else if (schemaComponent instanceof ComplexExtension) {
138.478 - validate(context, (ComplexExtension) schemaComponent);
138.479 - GlobalType gt =
138.480 - ((ComplexExtension) schemaComponent).getBase().get();
138.481 - if (gt != null) {
138.482 - validateChild(newContext, gt);
138.483 - }
138.484 - ComplexExtensionDefinition ceDef =
138.485 - ((ComplexExtension) schemaComponent).getLocalDefinition();
138.486 - if (ceDef != null) {
138.487 - validateChild(newContext, ceDef);
138.488 - }
138.489 - }
138.490 - }
138.491 -
138.492 - /**
138.493 - * The instance of this class can be used to record validation infoset.
138.494 - * It is half done right now and isn't used anywhere.
138.495 - */
138.496 - private static class ValidationInfoSet {
138.497 -
138.498 - private final SchemaComponent _schemaComponent;
138.499 - private final List<SchemaComponent> _path;
138.500 - private Set<SAXParseException> _validationErrors;
138.501 -
138.502 - public ValidationInfoSet(List<SchemaComponent> parentPath,
138.503 - SchemaComponent schemaComponent) {
138.504 - if (schemaComponent == null) {
138.505 - throw new NullPointerException(
138.506 - _bundle.getString("xsd_based_validator.exp.null_schemaComponent")); //NOI18N
138.507 - }
138.508 - if (parentPath == null || parentPath.isEmpty()) {
138.509 - _path = new ArrayList<SchemaComponent>();
138.510 - } else {
138.511 - _path = new ArrayList<SchemaComponent>(parentPath);
138.512 - }
138.513 - _path.add(schemaComponent);
138.514 - _schemaComponent = schemaComponent;
138.515 - }
138.516 -
138.517 - public SchemaComponent getSchemaComponent() {
138.518 - return _schemaComponent;
138.519 - }
138.520 -
138.521 - public SchemaComponent[] getPathInArray() {
138.522 - SchemaComponent[] pathArray = new SchemaComponent[_path.size()];
138.523 - _path.toArray(pathArray);
138.524 - return pathArray;
138.525 - }
138.526 -
138.527 - public boolean isValid() {
138.528 - return _validationErrors == null || _validationErrors.isEmpty();
138.529 - }
138.530 -
138.531 - public Collection<SAXParseException> getValidationErrors() {
138.532 - if (_validationErrors == null) {
138.533 - return Collections.emptySet();
138.534 - }
138.535 - return Collections.unmodifiableSet(_validationErrors);
138.536 - }
138.537 - }
138.538 -}
139.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/layer.xml Sat Sep 27 15:34:52 2008 -0700
139.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
139.3 @@ -1,29 +0,0 @@
139.4 -<?xml version="1.0" encoding="UTF-8"?>
139.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
139.6 -<filesystem>
139.7 - <folder name="Loaders">
139.8 - <folder name="text">
139.9 - <folder name="x-schema+xml">
139.10 - <folder name="Actions">
139.11 - <attr name="sep-5.instance/org-netbeans-modules-encoder-ui-basic-EncodingAction.instance" boolvalue="true"/>
139.12 - <file name="org-netbeans-modules-encoder-ui-basic-EncodingAction.instance"/>
139.13 - <attr name="org-netbeans-modules-encoder-ui-basic-EncodingAction.instance/en-sep-1.instance" boolvalue="true"/>
139.14 - <file name="en-sep-1.instance">
139.15 - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
139.16 - </file>
139.17 - <attr name="en-sep-1.instance/org-openide-actions-ToolsAction.instance" boolvalue="true"/>
139.18 - <folder name="encoding">
139.19 - <file name="sep-1.instance">
139.20 - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
139.21 - </file>
139.22 - <file name="rmv-enc.instance">
139.23 - <attr name="instanceClass" stringvalue="org.netbeans.modules.encoder.ui.basic.RemoveEncodingAction"/>
139.24 - </file>
139.25 - <attr name="sep-1.instance/rmv-enc.instance" boolvalue="true"/>
139.26 - </folder>
139.27 - </folder>
139.28 - </folder>
139.29 - </folder>
139.30 - </folder>
139.31 -</filesystem>
139.32 -
140.1 --- a/encoder.ui.tester/build.xml Sat Sep 27 15:34:52 2008 -0700
140.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
140.3 @@ -1,8 +0,0 @@
140.4 -<?xml version="1.0" encoding="UTF-8"?>
140.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
140.6 -<!-- for some information on what you could do (e.g. targets to override). -->
140.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
140.8 -<project name="org.netbeans.modules.encoder.ui.tester" default="netbeans" basedir=".">
140.9 - <description>Builds, tests, and runs the project org.netbeans.modules.encoder.ui.tester.</description>
140.10 - <import file="../../nbbuild/templates/projectized.xml"/>
140.11 -</project>
141.1 --- a/encoder.ui.tester/manifest.mf Sat Sep 27 15:34:52 2008 -0700
141.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
141.3 @@ -1,6 +0,0 @@
141.4 -Manifest-Version: 1.0
141.5 -OpenIDE-Module: org.netbeans.modules.encoder.ui.tester
141.6 -OpenIDE-Module-Layer: org/netbeans/modules/encoder/ui/tester/layer.xml
141.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/encoder/ui/tester/Bundle.properties
141.8 -OpenIDE-Module-Specification-Version: 1.0.1
141.9 -
142.1 --- a/encoder.ui.tester/nbproject/project.properties Sat Sep 27 15:34:52 2008 -0700
142.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
142.3 @@ -1,3 +0,0 @@
142.4 -javac.compilerargs=-Xlint:unchecked
142.5 -javac.source=1.5
142.6 -license.file=../cddl.txt
143.1 --- a/encoder.ui.tester/nbproject/project.xml Sat Sep 27 15:34:52 2008 -0700
143.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
143.3 @@ -1,128 +0,0 @@
143.4 -<?xml version="1.0" encoding="UTF-8"?>
143.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
143.6 - <type>org.netbeans.modules.apisupport.project</type>
143.7 - <configuration>
143.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
143.9 - <code-name-base>org.netbeans.modules.encoder.ui.tester</code-name-base>
143.10 - <module-dependencies>
143.11 - <dependency>
143.12 - <code-name-base>com.sun.encoder</code-name-base>
143.13 - <build-prerequisite/>
143.14 - <compile-dependency/>
143.15 - <run-dependency>
143.16 - <specification-version>1.0</specification-version>
143.17 - </run-dependency>
143.18 - </dependency>
143.19 - <dependency>
143.20 - <code-name-base>org.jdesktop.layout</code-name-base>
143.21 - <build-prerequisite/>
143.22 - <compile-dependency/>
143.23 - <run-dependency>
143.24 - <release-version>1</release-version>
143.25 - <specification-version>1.3.23</specification-version>
143.26 - </run-dependency>
143.27 - </dependency>
143.28 - <dependency>
143.29 - <code-name-base>org.netbeans.modules.encoder.ui.basic</code-name-base>
143.30 - <build-prerequisite/>
143.31 - <compile-dependency/>
143.32 - <run-dependency>
143.33 - <specification-version>1.0</specification-version>
143.34 - </run-dependency>
143.35 - </dependency>
143.36 - <dependency>
143.37 - <code-name-base>org.netbeans.modules.xml.schema.model</code-name-base>
143.38 - <build-prerequisite/>
143.39 - <compile-dependency/>
143.40 - <run-dependency>
143.41 - <release-version>1</release-version>
143.42 - <specification-version>1.1.22</specification-version>
143.43 - </run-dependency>
143.44 - </dependency>
143.45 - <dependency>
143.46 - <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
143.47 - <build-prerequisite/>
143.48 - <compile-dependency/>
143.49 - <run-dependency>
143.50 - <release-version>1</release-version>
143.51 - <specification-version>1.1.22</specification-version>
143.52 - </run-dependency>
143.53 - </dependency>
143.54 - <dependency>
143.55 - <code-name-base>org.netbeans.soa.libs.xmlbeans</code-name-base>
143.56 - <build-prerequisite/>
143.57 - <compile-dependency/>
143.58 - <run-dependency>
143.59 - <release-version>1</release-version>
143.60 - <specification-version>1.0</specification-version>
143.61 - </run-dependency>
143.62 - </dependency>
143.63 - <dependency>
143.64 - <code-name-base>org.openide.awt</code-name-base>
143.65 - <build-prerequisite/>
143.66 - <compile-dependency/>
143.67 - <run-dependency>
143.68 - <specification-version>7.1</specification-version>
143.69 - </run-dependency>
143.70 - </dependency>
143.71 - <dependency>
143.72 - <code-name-base>org.openide.dialogs</code-name-base>
143.73 - <build-prerequisite/>
143.74 - <compile-dependency/>
143.75 - <run-dependency>
143.76 - <specification-version>6.5.22</specification-version>
143.77 - </run-dependency>
143.78 - </dependency>
143.79 - <dependency>
143.80 - <code-name-base>org.openide.filesystems</code-name-base>
143.81 - <build-prerequisite/>
143.82 - <compile-dependency/>
143.83 - <run-dependency>
143.84 - <specification-version>6.4.22</specification-version>
143.85 - </run-dependency>
143.86 - </dependency>
143.87 - <dependency>
143.88 - <code-name-base>org.openide.io</code-name-base>
143.89 - <build-prerequisite/>
143.90 - <compile-dependency/>
143.91 - <run-dependency>
143.92 - <specification-version>1.12</specification-version>
143.93 - </run-dependency>
143.94 - </dependency>
143.95 - <dependency>
143.96 - <code-name-base>org.openide.loaders</code-name-base>
143.97 - <build-prerequisite/>
143.98 - <compile-dependency/>
143.99 - <run-dependency>
143.100 - <specification-version>5.9.22</specification-version>
143.101 - </run-dependency>
143.102 - </dependency>
143.103 - <dependency>
143.104 - <code-name-base>org.openide.nodes</code-name-base>
143.105 - <build-prerequisite/>
143.106 - <compile-dependency/>
143.107 - <run-dependency>
143.108 - <specification-version>6.7.22</specification-version>
143.109 - </run-dependency>
143.110 - </dependency>
143.111 - <dependency>
143.112 - <code-name-base>org.openide.util</code-name-base>
143.113 - <build-prerequisite/>
143.114 - <compile-dependency/>
143.115 - <run-dependency>
143.116 - <specification-version>6.8.22</specification-version>
143.117 - </run-dependency>
143.118 - </dependency>
143.119 - <dependency>
143.120 - <code-name-base>org.openide.windows</code-name-base>
143.121 - <build-prerequisite/>
143.122 - <compile-dependency/>
143.123 - <run-dependency>
143.124 - <specification-version>6.5.22</specification-version>
143.125 - </run-dependency>
143.126 - </dependency>
143.127 - </module-dependencies>
143.128 - <public-packages/>
143.129 - </data>
143.130 - </configuration>
143.131 -</project>
144.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
144.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
144.3 @@ -1,4 +0,0 @@
144.4 -OpenIDE-Module-Long-Description=\
144.5 - Encoder tester used for testing encoder at design time
144.6 -OpenIDE-Module-Name=Encoder Tester
144.7 -OpenIDE-Module-Display-Category=ESB
145.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/EncoderTestPerformer.java Sat Sep 27 15:34:52 2008 -0700
145.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
145.3 @@ -1,54 +0,0 @@
145.4 -/*
145.5 - * The contents of this file are subject to the terms of the Common Development
145.6 - * and Distribution License (the License). You may not use this file except in
145.7 - * compliance with the License.
145.8 - *
145.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
145.10 - * or http://www.netbeans.org/cddl.txt.
145.11 -
145.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
145.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
145.14 - * If applicable, add the following below the CDDL Header, with the fields
145.15 - * enclosed by brackets [] replaced by your own identifying information:
145.16 - * "Portions Copyrighted [year] [name of copyright owner]"
145.17 - *
145.18 - * The Original Software is NetBeans. The Initial Developer of the Original
145.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
145.20 - * Microsystems, Inc. All Rights Reserved.
145.21 - */
145.22 -
145.23 -package org.netbeans.modules.encoder.ui.tester;
145.24 -
145.25 -import com.sun.encoder.EncoderType;
145.26 -import java.io.File;
145.27 -import org.netbeans.modules.encoder.ui.tester.impl.EncoderTestPerformerImpl;
145.28 -
145.29 -/**
145.30 - * The encoder test performer interface.
145.31 - *
145.32 - * @author Cannis Meng, Jun Xu
145.33 - */
145.34 -public interface EncoderTestPerformer {
145.35 -
145.36 - /**
145.37 - * Performs test on an encoder represented by the XSD file.
145.38 - *
145.39 - * @param xsdFile the XSD schema model.
145.40 - * @param encoderType EncoderType object.
145.41 - */
145.42 - void performTest(File xsdFile, EncoderType encoderType);
145.43 -
145.44 - /**
145.45 - * Factory class.
145.46 - */
145.47 - public static class Factory {
145.48 -
145.49 - /**
145.50 - *
145.51 - * @return EncoderTestPerformer implementation instance.
145.52 - */
145.53 - public static EncoderTestPerformer getDefault() {
145.54 - return new EncoderTestPerformerImpl();
145.55 - }
145.56 - }
145.57 -}
146.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/EncoderTestTask.java Sat Sep 27 15:34:52 2008 -0700
146.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
146.3 @@ -1,92 +0,0 @@
146.4 -/*
146.5 - * The contents of this file are subject to the terms of the Common Development
146.6 - * and Distribution License (the License). You may not use this file except in
146.7 - * compliance with the License.
146.8 - *
146.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
146.10 - * or http://www.netbeans.org/cddl.txt.
146.11 -
146.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
146.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
146.14 - * If applicable, add the following below the CDDL Header, with the fields
146.15 - * enclosed by brackets [] replaced by your own identifying information:
146.16 - * "Portions Copyrighted [year] [name of copyright owner]"
146.17 - *
146.18 - * The Original Software is NetBeans. The Initial Developer of the Original
146.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
146.20 - * Microsystems, Inc. All Rights Reserved.
146.21 - */
146.22 -
146.23 -package org.netbeans.modules.encoder.ui.tester;
146.24 -
146.25 -import com.sun.encoder.EncoderConfigurationException;
146.26 -import com.sun.encoder.EncoderException;
146.27 -import com.sun.encoder.EncoderType;
146.28 -import java.io.File;
146.29 -import java.io.IOException;
146.30 -import javax.xml.namespace.QName;
146.31 -import javax.xml.parsers.ParserConfigurationException;
146.32 -import javax.xml.transform.TransformerConfigurationException;
146.33 -import javax.xml.transform.TransformerException;
146.34 -import org.xml.sax.SAXException;
146.35 -
146.36 -
146.37 -
146.38 -/**
146.39 - * An interface that represents encoding test task.
146.40 - *
146.41 - * @author Cannis Meng
146.42 - */
146.43 -public interface EncoderTestTask {
146.44 -
146.45 - /**
146.46 - * Decodes the input file according the the xsd meta file and
146.47 - * generate a output xml file.
146.48 - *
146.49 - * @param type encoder type.
146.50 - * @param metaFile the xsd meta file.
146.51 - * @param rootElement root element for decoding.
146.52 - * @param inputFile input file.
146.53 - * @param outputFile output file.
146.54 - * @param predecodeCoding pre-decode coding.
146.55 - * @param charBased whether or not character based.
146.56 - * @return output file.
146.57 - *
146.58 - * @throws com.sun.encoder.EncoderException
146.59 - * @throws java.io.IOException
146.60 - * @throws javax.xml.transform.TransformerConfigurationException
146.61 - * @throws javax.xml.transform.TransformerException
146.62 - * @throws com.sun.encoder.EncoderConfigurationException
146.63 - */
146.64 - File decode(EncoderType type, File metaFile, QName rootElement,
146.65 - File inputFile, File outputFile, String predecodeCoding,
146.66 - boolean charBased) throws EncoderException, IOException,
146.67 - TransformerConfigurationException, TransformerException,
146.68 - EncoderConfigurationException;
146.69 -
146.70 - /**
146.71 - * Encodes the xml file with the xsd meta file and generate the encoded
146.72 - * output file.
146.73 - *
146.74 - * @param type encoder type.
146.75 - * @param metaFile the xsd meta file.
146.76 - * @param rootElement root element for encoding.
146.77 - * @param xmlFile xml input file.
146.78 - * @param outputFile output file.
146.79 - * @param postencodeCoding post-encode coding.
146.80 - * @param charBased whether or not character based.
146.81 - * @return null.
146.82 - *
146.83 - * @throws com.sun.encoder.EncoderException
146.84 - * @throws java.io.IOException
146.85 - * @throws javax.xml.parsers.ParserConfigurationException
146.86 - * @throws org.xml.sax.SAXException
146.87 - * @throws com.sun.encoder.EncoderConfigurationException
146.88 - */
146.89 - File encode(EncoderType type, File metaFile, QName rootElement,
146.90 - File xmlFile, File outputFile, String postencodeCoding,
146.91 - boolean charBased) throws EncoderException, IOException,
146.92 - ParserConfigurationException, SAXException,
146.93 - EncoderConfigurationException;
146.94 -
146.95 -}
147.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/action/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
147.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
147.3 @@ -1,10 +0,0 @@
147.4 -
147.5 -test_encoding.exp.unable_retrieve_path=Unable to retrieve path.
147.6 -
147.7 -test_encoding.lbl.test_enc_menu_item=Test...
147.8 -
147.9 -test_encoding.exp.please_save_file=\nPlease save these files before proceeding.
147.10 -
147.11 -test_encoding.exp.file_not_saved=Following files have been modified but have not been saved\:\n\n
147.12 -
147.13 -test_encoding.exp.style_not_recognized=The encoding style ''{0}'' is not recognized in current environment. Please make sure the NetBeans module of this encoding provider is installed and active.
148.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/action/TestEncodingAction.java Sat Sep 27 15:34:52 2008 -0700
148.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
148.3 @@ -1,133 +0,0 @@
148.4 -/*
148.5 - * The contents of this file are subject to the terms of the Common Development
148.6 - * and Distribution License (the License). You may not use this file except in
148.7 - * compliance with the License.
148.8 - *
148.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
148.10 - * or http://www.netbeans.org/cddl.txt.
148.11 -
148.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
148.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
148.14 - * If applicable, add the following below the CDDL Header, with the fields
148.15 - * enclosed by brackets [] replaced by your own identifying information:
148.16 - * "Portions Copyrighted [year] [name of copyright owner]"
148.17 - *
148.18 - * The Original Software is NetBeans. The Initial Developer of the Original
148.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
148.20 - * Microsystems, Inc. All Rights Reserved.
148.21 - */
148.22 -
148.23 -package org.netbeans.modules.encoder.ui.tester.action;
148.24 -
148.25 -import com.sun.encoder.EncoderConfigurationException;
148.26 -import com.sun.encoder.EncoderFactory;
148.27 -import com.sun.encoder.EncoderType;
148.28 -import java.io.File;
148.29 -import java.io.IOException;
148.30 -import java.util.ResourceBundle;
148.31 -import javax.swing.JOptionPane;
148.32 -import org.netbeans.modules.encoder.ui.basic.EncodingMark;
148.33 -import org.netbeans.modules.encoder.ui.basic.ModelUtils;
148.34 -import org.netbeans.modules.encoder.ui.tester.EncoderTestPerformer;
148.35 -import org.netbeans.modules.xml.schema.model.SchemaModel;
148.36 -import org.netbeans.modules.xml.xam.locator.CatalogModelException;
148.37 -import org.openide.ErrorManager;
148.38 -import org.openide.nodes.Node;
148.39 -import org.openide.util.HelpCtx;
148.40 -import org.openide.util.NbBundle;
148.41 -import org.openide.util.actions.NodeAction;
148.42 -import org.openide.windows.WindowManager;
148.43 -
148.44 -/**
148.45 - * Action that tests an encoder (such as decode/encode etc.)
148.46 - *
148.47 - * @author Jun Xu
148.48 - */
148.49 -public class TestEncodingAction extends NodeAction {
148.50 -
148.51 - private static final ResourceBundle _bundle =
148.52 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/tester/action/Bundle");
148.53 -
148.54 - protected void performAction(Node[] node) {
148.55 - SchemaModel model;
148.56 - try {
148.57 - model = ModelUtils.getSchemaModelFromNode(node[0]);
148.58 - } catch (IOException e) {
148.59 - ErrorManager.getDefault().notify(e);
148.60 - return;
148.61 - }
148.62 - String xsdPath = ModelUtils.getFilePath(model);
148.63 - if (xsdPath == null) {
148.64 - ErrorManager.getDefault().notify(ErrorManager.ERROR,
148.65 - new NullPointerException(
148.66 - _bundle.getString("test_encoding.exp.unable_retrieve_path")));
148.67 - return;
148.68 - }
148.69 - ModelUtils.ModelStatus modelStatus;
148.70 - try {
148.71 - modelStatus =
148.72 - ModelUtils.getModelStatus(model, true);
148.73 - } catch (CatalogModelException ex) {
148.74 - ErrorManager.getDefault().notify(ex);
148.75 - return;
148.76 - }
148.77 - if (modelStatus.isModified()) {
148.78 - String[] dataObjs = modelStatus.getModifiedFiles();
148.79 - StringBuffer sb = new StringBuffer();
148.80 - sb.append(_bundle.getString("test_encoding.exp.file_not_saved"));
148.81 - for (int i = 0; i < dataObjs.length; i++) {
148.82 - sb.append(dataObjs[i]).append("\n"); //NOI18N
148.83 - }
148.84 - sb.append(_bundle.getString("test_encoding.exp.please_save_file"));
148.85 - JOptionPane.showMessageDialog(
148.86 - WindowManager.getDefault().getMainWindow(), sb.toString());
148.87 - return;
148.88 - }
148.89 -
148.90 - EncodingMark mark = ModelUtils.getEncodingMark(model);
148.91 - EncoderType encoderType;
148.92 - try {
148.93 - encoderType = EncoderFactory.newInstance().makeType(mark.getStyle());
148.94 - } catch (EncoderConfigurationException ex) {
148.95 - String msg =
148.96 - NbBundle.getMessage(TestEncodingAction.class,
148.97 - "test_encoding.exp.style_not_recognized", mark.getStyle()); //NOI18N
148.98 - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), msg);
148.99 - return;
148.100 - }
148.101 -
148.102 - EncoderTestPerformer testPerformer = EncoderTestPerformer.Factory.getDefault();
148.103 - testPerformer.performTest(new File(xsdPath), encoderType);
148.104 - }
148.105 -
148.106 - public String getName() {
148.107 - return _bundle.getString("test_encoding.lbl.test_enc_menu_item");
148.108 - }
148.109 -
148.110 - public HelpCtx getHelpCtx() {
148.111 - return HelpCtx.DEFAULT_HELP;
148.112 - }
148.113 -
148.114 - @Override
148.115 - protected boolean asynchronous() {
148.116 - return false;
148.117 - }
148.118 -
148.119 - protected boolean enable(Node[] node) {
148.120 - //Check if it is writable
148.121 - if (node == null || node.length == 0 || node.length > 1) {
148.122 - return false;
148.123 - }
148.124 - SchemaModel sm;
148.125 - try {
148.126 - sm = ModelUtils.getSchemaModelFromNode(node[0]);
148.127 - } catch (IOException e) {
148.128 - ErrorManager.getDefault().log(ErrorManager.EXCEPTION, e.toString());
148.129 - return false;
148.130 - }
148.131 - if (sm == null) {
148.132 - return false;
148.133 - }
148.134 - return ModelUtils.hasEncodingMark(sm);
148.135 - }
148.136 -}
149.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties Sat Sep 27 15:34:52 2008 -0700
149.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
149.3 @@ -1,86 +0,0 @@
149.4 -test_panel.name=Encoder Tester
149.5 -test_panel.description=The Encoder Tester Form to perform Decode or Encode operation
149.6 -test_panel.lbl.xml_file_does_not_exist=The xml file does not exist
149.7 -test_panel.lbl.xml_files=XML Files
149.8 -test_panel.lbl.file_does_not_exist=File does not exist
149.9 -test_panel.lbl.all_directories=All Directories
149.10 -test_panel.lbl.select_an_element=&Select an Element:
149.11 -test_panel.lbl.created_file=Created File:
149.12 -test_panel.lbl.browse1=&Browse...
149.13 -test_panel.lbl.browse2=&Browse...
149.14 -test_panel.lbl.browse3=Bro&wse...
149.15 -test_panel.lbl.output_folder=&Folder:
149.16 -test_panel.lbl.xml_source=&XML Source File:
149.17 -test_panel.lbl.input_data_file=D&ata File:
149.18 -test_panel.lbl.overwrite_output=&Overwrite Output
149.19 -test_panel.lbl.output_file_name=File &Name:
149.20 -test_panel.lbl.decode=&Decode
149.21 -test_panel.lbl.encode=&Encode
149.22 -test_panel.lbl.xsd_file=XSD File:
149.23 -test_panel.lbl.no_top_element_in_xsd=No top element is found in the XSD file.\nPlease open the XSD file and select top element(s) by enabling the "Top" property before performing a test.
149.24 -test_panel.select_an_element.name=Select an element from XSD
149.25 -test_panel.select_an_element.description=Select from XSD a top element (i.e. a global element with Top property value of true in its encoding node)
149.26 -test_panel.xsd_file.name=File name of XSD
149.27 -test_panel.xsd_file.description=File name of XML schema definition with encoding specific information
149.28 -test_panel.decode.name=Decode operation
149.29 -test_panel.decode.description=Select it to perform the "decode" (also called "deserialize", "parse", or "unmarshal") operation on text delimited data
149.30 -test_panel.encode.name=Encode operation
149.31 -test_panel.encode.description=Select it to perform the "encode" (also called "serialize", or "marshal") encoding operation on XML data source
149.32 -test_panel.lbl.from_string=Fro&m String
149.33 -test_panel.from_string.name=From String
149.34 -test_panel.from_string.description=Check it if input data for decoding is string-based (not byte-based)
149.35 -test_panel.data_file.description=The input data file to be decoded in the file system
149.36 -test_panel.input_data_file.name=Input data file
149.37 -test_panel.input_data_file.browse.name=Browse to select input data file
149.38 -test_panel.input_data_file.browse.description=Browse the file system to select the input data file
149.39 -test_panel.lbl.source_coding=So&urce Coding:
149.40 -test_panel.source_coding.description=Encoding name of input source data
149.41 -test_panel.source_coding.name=Source encoding name
149.42 -test_panel.to_string.name=To String
149.43 -test_panel.lbl.to_string=&To String
149.44 -test_panel.to_string.description=Check it if the encoding output is string-based (not byte-based)
149.45 -test_panel.xml_source_file.description=File name of input XML source data used for encoding into text content
149.46 -test_panel.xml_source_file.name=XML source file name
149.47 -
149.48 -test_panel.lbl.result_coding=&Result Coding:
149.49 -test_panel.result_coding.description=The encoding name for output data
149.50 -test_panel.result_coding.name=Result encoding name
149.51 -test_panel.input_xml_source_file.browse.name=Browse to select XML source file
149.52 -test_panel.input_xml_source_file.browse.description=Browse the file system to select XML source file
149.53 -test_panel.output_file_name.description=The output file name in the file system
149.54 -test_panell.output_file_name.name=Output file name
149.55 -test_panel.output_folder.description=The output file foder where the output file is to be created
149.56 -test_panel.output_folder.name=Output file folder
149.57 -test_panel.output_folder.browse.description=Browse the file system to select output file folder
149.58 -test_panel.output_folder.browse.name=Output file folder
149.59 -test_panel.overwrite_output.description=Check it if to overwrite output file if already exists in the file system
149.60 -test_panel.overwrite_output.name=Overwrite output file if already exists
149.61 -test_panel.created_file.description=The output file (in full path) to be created in the file system
149.62 -test_panel.created_file.name=Output file to be created
149.63 -test_panel.lbl.verbose_level=&Verbose Level:
149.64 -test_panel.verbose_level.description=JDK logging debug level to control output of debugging messages
149.65 -test_panel.verbose_level.name=Verbose level of debugging messages
149.66 -test_panel.lbl.meta_section=Meta
149.67 -test_panel.meta_section.description=Metadata Section
149.68 -test_panel.input_section.description=Input Section
149.69 -test_panel.lbl.input_section=Input
149.70 -test_panel.lbl.output_section=Output
149.71 -test_panel.output_section.description=Output Section
149.72 -test_panel.lbl.debug_section=Debug
149.73 -test_panel.debug_section.description=Debug Section
149.74 -test_panel.separator.decode_encode=Separator between Decode and Encode operations
149.75 -test_panel.separator.debug=Separator between Debug Section and other Sections
149.76 -test_panel.separator.input_output=Separator between Input Section and Output Section
149.77 -test_panel.separator.meta=Separator between Meta Section and other Sections
149.78 -
149.79 -test_task.exp.disposal_of_encoder_failed=Disposal of the encoder failed.
149.80 -test_task.lbl.no_xsd_file=No xsd file
149.81 -test_performer.lbl.enter_output_file.=Please select or enter an output file.
149.82 -test_performer.lbl.enter_process_file=Please select or enter an input file (make sure the file does exist)
149.83 -test_performer.lbl.select_top_element=Please select a top element.
149.84 -test_performer.lbl.test_encoding=Test Encoding
149.85 -test_performer.lbl.cancel=&Cancel
149.86 -test_performer.lbl.process=&Process
149.87 -test_performer.iooutputpane.title=Encoder Test [{0}]
149.88 -test_performer.process.description=Process the selected Decode or Encode test
149.89 -test_performer.cancel.description=Cancel encoding test
150.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/EncoderTestPerformerImpl.java Sat Sep 27 15:34:52 2008 -0700
150.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
150.3 @@ -1,431 +0,0 @@
150.4 -/*
150.5 - * The contents of this file are subject to the terms of the Common Development
150.6 - * and Distribution License (the License). You may not use this file except in
150.7 - * compliance with the License.
150.8 - *
150.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
150.10 - * or http://www.netbeans.org/cddl.txt.
150.11 -
150.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
150.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
150.14 - * If applicable, add the following below the CDDL Header, with the fields
150.15 - * enclosed by brackets [] replaced by your own identifying information:
150.16 - * "Portions Copyrighted [year] [name of copyright owner]"
150.17 - *
150.18 - * The Original Software is NetBeans. The Initial Developer of the Original
150.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
150.20 - * Microsystems, Inc. All Rights Reserved.
150.21 - */
150.22 -
150.23 -package org.netbeans.modules.encoder.ui.tester.impl;
150.24 -
150.25 -import com.sun.encoder.EncoderConfigurationException;
150.26 -import com.sun.encoder.EncoderException;
150.27 -import com.sun.encoder.EncoderType;
150.28 -import java.awt.Cursor;
150.29 -import java.awt.Dialog;
150.30 -import java.awt.event.ActionEvent;
150.31 -import java.awt.event.ActionListener;
150.32 -import java.io.ByteArrayOutputStream;
150.33 -import java.io.File;
150.34 -import java.io.IOException;
150.35 -import java.util.ArrayList;
150.36 -import java.util.List;
150.37 -import java.util.ResourceBundle;
150.38 -import java.util.logging.Handler;
150.39 -import java.util.logging.Level;
150.40 -import java.util.logging.Logger;
150.41 -import java.util.logging.StreamHandler;
150.42 -import java.util.prefs.BackingStoreException;
150.43 -import javax.swing.JButton;
150.44 -import javax.swing.JOptionPane;
150.45 -import javax.xml.namespace.QName;
150.46 -import javax.xml.parsers.ParserConfigurationException;
150.47 -import javax.xml.transform.TransformerConfigurationException;
150.48 -import javax.xml.transform.TransformerException;
150.49 -import org.apache.xmlbeans.XmlBoolean;
150.50 -import org.apache.xmlbeans.XmlException;
150.51 -import org.apache.xmlbeans.XmlObject;
150.52 -import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
150.53 -import org.apache.xmlbeans.impl.xb.xsdschema.TopLevelElement;
150.54 -import org.netbeans.modules.encoder.ui.basic.EncodingConst;
150.55 -import org.netbeans.modules.encoder.ui.basic.Utils;
150.56 -import org.netbeans.modules.encoder.ui.tester.EncoderTestPerformer;
150.57 -import org.netbeans.modules.encoder.ui.tester.EncoderTestTask;
150.58 -import org.openide.DialogDescriptor;
150.59 -import org.openide.DialogDisplayer;
150.60 -import org.openide.ErrorManager;
150.61 -import org.openide.awt.Mnemonics;
150.62 -import org.openide.cookies.EditCookie;
150.63 -import org.openide.filesystems.FileUtil;
150.64 -import org.openide.loaders.DataLoaderPool;
150.65 -import org.openide.loaders.DataObject;
150.66 -import org.openide.util.HelpCtx;
150.67 -import org.openide.util.NbBundle;
150.68 -import org.openide.util.Utilities;
150.69 -import org.openide.windows.IOProvider;
150.70 -import org.openide.windows.InputOutput;
150.71 -import org.openide.windows.OutputWriter;
150.72 -import org.xml.sax.SAXException;
150.73 -
150.74 -/**
150.75 - * The encoder test performer
150.76 - *
150.77 - * @author Cannis Meng
150.78 - */
150.79 -public class EncoderTestPerformerImpl implements EncoderTestPerformer, ActionListener {
150.80 -
150.81 - private static final ResourceBundle _bundle =
150.82 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/tester/impl/Bundle"); //NOI18N
150.83 - private static final String PROCESS = _bundle.getString("test_performer.lbl.process"); //NOI18N
150.84 - private static final String PROCESS_DESC = _bundle.getString("test_performer.process.description"); //NOI18N
150.85 - private static final String CANCEL = _bundle.getString("test_performer.lbl.cancel"); //NOI18N
150.86 - private static final String CANCEL_DESC = _bundle.getString("test_performer.cancel.description"); //NOI18N
150.87 - public static final String ENCODE = "Encode"; //NOI18N
150.88 - public static final String DECODE = "Decode"; //NOI18N
150.89 -
150.90 - public static final QName TOP_PROPERTY_ELEMENT = new QName(EncodingConst.URI, EncodingConst.TOP_FLAG);
150.91 - private static final XmlBoolean XML_BOOLEAN_TRUE = XmlBoolean.Factory.newValue(Boolean.TRUE);
150.92 - private static final String DEBUG_PKG_NAME = "com.sun.encoder"; //NOI18N
150.93 - private TesterPanel testerPanel;
150.94 - private DialogDescriptor dialogDescriptor;
150.95 - private Dialog dialog;
150.96 - private EncoderTestTask mEncoderTestTask;
150.97 - private File metaFile;
150.98 - private EncoderType mEncoderType;
150.99 -
150.100 - public void performTest(File xsdFile, EncoderType encoderType) {
150.101 - metaFile = xsdFile;
150.102 - mEncoderType = encoderType;
150.103 - if (mEncoderTestTask == null) {
150.104 - mEncoderTestTask = new EncoderTestTaskImpl();
150.105 - }
150.106 - showDialog();
150.107 - }
150.108 -
150.109 - private void showDialog() {
150.110 - try {
150.111 - QName[] qnames = getTopElementDecls(metaFile);
150.112 - if (qnames.length == 0) {
150.113 - // i.e. no top element(s) are selected in the XSD
150.114 - // show dialog to ask user to fix the XSD file before testing
150.115 - JOptionPane.showMessageDialog(null,
150.116 - _bundle.getString("test_panel.lbl.no_top_element_in_xsd"));
150.117 - return;
150.118 - }
150.119 - testerPanel = new TesterPanel(metaFile.getAbsolutePath());
150.120 - testerPanel.setTopElementDecls(getTopElementDecls(metaFile), null);
150.121 - } catch (XmlException ex) {
150.122 - ErrorManager.getDefault().notify(ex);
150.123 - return;
150.124 - } catch (IOException ex) {
150.125 - ErrorManager.getDefault().notify(ex);
150.126 - return;
150.127 - }
150.128 - // "Process" and "Cancel" buttons
150.129 - JButton processButton = new JButton();
150.130 - org.openide.awt.Mnemonics.setLocalizedText(processButton, PROCESS);
150.131 - processButton.setToolTipText(PROCESS_DESC);
150.132 - processButton.getAccessibleContext().setAccessibleName(PROCESS_DESC);
150.133 - processButton.getAccessibleContext().setAccessibleDescription(PROCESS_DESC);
150.134 - JButton cancelButton = new JButton();
150.135 - org.openide.awt.Mnemonics.setLocalizedText(cancelButton, CANCEL);
150.136 - cancelButton.setToolTipText(CANCEL_DESC);
150.137 - cancelButton.getAccessibleContext().setAccessibleName(CANCEL_DESC);
150.138 - cancelButton.getAccessibleContext().setAccessibleDescription(CANCEL_DESC);
150.139 - // DialogDescriptor object
150.140 - dialogDescriptor = new DialogDescriptor(
150.141 - testerPanel, // inner component of the dialog
150.142 - _bundle.getString("test_performer.lbl.test_encoding"), //NOI18N //title of the dialog
150.143 - true, //modal status
150.144 - new Object[]{processButton, cancelButton}, //array of custom options
150.145 - processButton, //default option from custom option array
150.146 - DialogDescriptor.BOTTOM_ALIGN, //specifies where to place options in the dialog
150.147 - HelpCtx.DEFAULT_HELP, //help context specifying help page
150.148 - this); //listener for the user's button presses
150.149 - dialogDescriptor.setClosingOptions(new Object[]{cancelButton});
150.150 - dialogDescriptor.setButtonListener(this);
150.151 - // the Dialog
150.152 - dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
150.153 - dialog.setModal(true);
150.154 - dialog.setVisible(true);
150.155 - }
150.156 -
150.157 - private static String stripOffMnemonics(String in) {
150.158 - if (in == null || in.length() == 0) {
150.159 - return in;
150.160 - }
150.161 - int mnemonicPosition = Mnemonics.findMnemonicAmpersand(in);
150.162 - if (mnemonicPosition < 0) {
150.163 - // i.e. no mnemonics found
150.164 - return in;
150.165 - } else if (mnemonicPosition == 0) {
150.166 - // i.e. first char is mnemonics
150.167 - return in.substring(1);
150.168 - } else if (mnemonicPosition == in.length() - 1) {
150.169 - // i.e. last char is mnemonics
150.170 - return in.substring(0, mnemonicPosition);
150.171 - } else {
150.172 - return in.substring(0, mnemonicPosition)
150.173 - + in.substring(mnemonicPosition + 1);
150.174 - }
150.175 - }
150.176 -
150.177 - public void actionPerformed(ActionEvent e) {
150.178 - String action = e.getActionCommand();
150.179 - if (action.equals(stripOffMnemonics(PROCESS))) {
150.180 - try {
150.181 - testerPanel.savePreferences();
150.182 - } catch (BackingStoreException ex) {
150.183 - //Ignore
150.184 - }
150.185 - process();
150.186 - }
150.187 - }
150.188 -
150.189 - /**
150.190 - * Gets the top level element declaractions (the declarations that define
150.191 - * messages) from an XSD file. It only search within the XSD specified,
150.192 - * not any of the referenced XSDs.
150.193 - *
150.194 - * @param xsdFile the XSD file
150.195 - */
150.196 - private QName[] getTopElementDecls(File xsdFile)
150.197 - throws XmlException, IOException {
150.198 - SchemaDocument schemaDoc = SchemaDocument.Factory.parse(xsdFile);
150.199 - if (schemaDoc.getSchema() == null) {
150.200 - return new QName[0];
150.201 - }
150.202 - String targetNS = schemaDoc.getSchema().getTargetNamespace();
150.203 - if (targetNS != null && targetNS.length() == 0) {
150.204 - targetNS = null;
150.205 - }
150.206 - TopLevelElement[] elemDecls = schemaDoc.getSchema().getElementArray();
150.207 - if (elemDecls == null || elemDecls.length == 0) {
150.208 - return new QName[0];
150.209 - }
150.210 - List<QName> topElemList = new ArrayList<QName>();
150.211 - for (int i = 0; i < elemDecls.length; i++) {
150.212 - if (!elemDecls[i].isSetAnnotation()
150.213 - || elemDecls[i].getAnnotation().sizeOfAppinfoArray() == 0) {
150.214 - continue;
150.215 - }
150.216 - final int countAppinfos = elemDecls[i].getAnnotation().sizeOfAppinfoArray();
150.217 - for (int j = 0; j < countAppinfos; j++) {
150.218 - if (!elemDecls[i].getAnnotation().getAppinfoArray(j).isSetSource()) {
150.219 - continue;
150.220 - }
150.221 - if (!EncodingConst.URI.equals(
150.222 - elemDecls[i].getAnnotation().getAppinfoArray(j).getSource())) {
150.223 - continue;
150.224 - }
150.225 - XmlObject xmlObj = elemDecls[i].getAnnotation().getAppinfoArray(j);
150.226 - XmlObject[] topProps = xmlObj.selectChildren(TOP_PROPERTY_ELEMENT);
150.227 - if (topProps == null || topProps.length == 0) {
150.228 - continue;
150.229 - }
150.230 - if (XML_BOOLEAN_TRUE.compareValue(topProps[0]) == 0) {
150.231 - if (targetNS == null) {
150.232 - topElemList.add(new QName(elemDecls[i].getName()));
150.233 - } else {
150.234 - topElemList.add(new QName(targetNS, elemDecls[i].getName()));
150.235 - }
150.236 - }
150.237 - }
150.238 - }
150.239 - return topElemList.toArray(new QName[0]);
150.240 - }
150.241 -
150.242 - private void process() {
150.243 -
150.244 - int debugLevelIndex = testerPanel.getDebugLevelIndex();
150.245 - // if debugLevel is other than "None", then output debug information
150.246 - boolean debugging = debugLevelIndex > 0;
150.247 - ByteArrayOutputStream byteArrOS = null;
150.248 - Handler logHandler = null;
150.249 - Logger logger = null;
150.250 - Level origLevel = null;
150.251 - Level currLevel = null;
150.252 -
150.253 - if (debugging) {
150.254 - if (debugLevelIndex == 1) {
150.255 - currLevel = Level.INFO;
150.256 - } else if (debugLevelIndex == 2) {
150.257 - currLevel = Level.FINE;
150.258 - } else if (debugLevelIndex == 3) {
150.259 - currLevel = Level.FINER;
150.260 - } else if (debugLevelIndex == 4) {
150.261 - currLevel = Level.FINEST;
150.262 - }
150.263 - logger = Logger.getLogger(DEBUG_PKG_NAME);
150.264 - // remember original debug level
150.265 - origLevel = logger.getLevel();
150.266 - logger.setLevel(currLevel);
150.267 -
150.268 - // craete a StreamHandler based on ByteArrayOutputStream
150.269 - byteArrOS = new ByteArrayOutputStream();
150.270 - logHandler = new StreamHandler(byteArrOS, new LogFormatter());
150.271 - logHandler.setLevel(currLevel);
150.272 - // add to logger
150.273 - logger.addHandler(logHandler);
150.274 - }
150.275 -
150.276 - //verify the input first
150.277 - QName rootElement = testerPanel.getSelectedTopElementDecl();
150.278 - if (rootElement == null) {
150.279 - JOptionPane.showMessageDialog(testerPanel,
150.280 - _bundle.getString("test_performer.lbl.select_top_element"));
150.281 - return;
150.282 - }
150.283 -
150.284 - String type = testerPanel.getActionType();
150.285 - File processFile = new File(testerPanel.getProcessFile());
150.286 -
150.287 - if (!processFile.exists()) {
150.288 - JOptionPane.showMessageDialog(testerPanel,
150.289 - _bundle.getString("test_performer.lbl.enter_process_file"));
150.290 - return;
150.291 - }
150.292 -
150.293 - String oFile = testerPanel.getOutputFile();
150.294 - File outputFile = new File(oFile);
150.295 - if (testerPanel.getOutputFileName() == null
150.296 - || testerPanel.getOutputFileName().equals("")) { //NOI18N
150.297 - //no outputfile
150.298 - JOptionPane.showMessageDialog(testerPanel,
150.299 - _bundle.getString("test_performer.lbl.enter_output_file."));
150.300 - return;
150.301 - }
150.302 -
150.303 - /**
150.304 - * if outputFile already exists and "overwrite" is unchecked, then
150.305 - * output file name is based on the given base name with "_1" suffixed
150.306 - * and with the same file extension.
150.307 - */
150.308 - if (outputFile.exists()) {
150.309 - if (!testerPanel.isOverwrite()) {
150.310 - String ext = FileUtil.getExtension(outputFile.getAbsolutePath());
150.311 - String parent = outputFile.getParent();
150.312 - String name = outputFile.getName().replaceAll("." + ext, ""); //NOI18N
150.313 - outputFile = new File(parent + File.separatorChar + name + "_1." + ext); //NOI18N
150.314 - }
150.315 - }
150.316 -
150.317 - boolean result = true;
150.318 -
150.319 - if (type.equals(ENCODE)) {
150.320 - try {
150.321 - testerPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
150.322 - mEncoderTestTask.encode(mEncoderType, metaFile, rootElement,
150.323 - processFile, outputFile, testerPanel.getPostencodeCoding(),
150.324 - testerPanel.isToString());
150.325 - } catch (IOException ex) {
150.326 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.327 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.328 - result = false;
150.329 - } catch (ParserConfigurationException ex) {
150.330 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.331 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.332 - result = false;
150.333 - } catch (EncoderException ex) {
150.334 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.335 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.336 - result = false;
150.337 - } catch (SAXException ex) {
150.338 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.339 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.340 - result = false;
150.341 - } catch (EncoderConfigurationException ex) {
150.342 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.343 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.344 - result = false;
150.345 - } finally {
150.346 - testerPanel.setCursor(null);
150.347 - }
150.348 - } else {
150.349 - try {
150.350 - testerPanel.setCursor(Utilities.createProgressCursor(testerPanel));
150.351 - mEncoderTestTask.decode(mEncoderType, metaFile, rootElement,
150.352 - processFile, outputFile, testerPanel.getPredecodeCoding(),
150.353 - testerPanel.isFromString());
150.354 - } catch (TransformerConfigurationException ex) {
150.355 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.356 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.357 - result = false;
150.358 - } catch (final TransformerException ex) {
150.359 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.360 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.361 - result = false;
150.362 - } catch (EncoderException ex) {
150.363 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.364 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.365 - result = false;
150.366 - } catch (IOException ex) {
150.367 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.368 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.369 - result = false;
150.370 - } catch (EncoderConfigurationException ex) {
150.371 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.372 - Utils.notify(ex, true, dialog, JOptionPane.ERROR_MESSAGE);
150.373 - result = false;
150.374 - } finally {
150.375 - testerPanel.setCursor(null);
150.376 - }
150.377 - }
150.378 -
150.379 - if (!result) {
150.380 - return;
150.381 - }
150.382 -
150.383 - try {
150.384 - DataObject dObj = DataLoaderPool.getDefault().
150.385 - findDataObject(FileUtil.toFileObject(outputFile));
150.386 - if (dObj != null) {
150.387 - EditCookie edit = (EditCookie) dObj.getCookie(EditCookie.class);
150.388 - if (edit != null) {
150.389 - dialog.setVisible(false);
150.390 - edit.edit();
150.391 - }
150.392 - }
150.393 - } catch (IOException ex) {
150.394 - ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
150.395 - }
150.396 -
150.397 - displayDebugMsgs(debugging, byteArrOS, logHandler, logger, origLevel);
150.398 - }
150.399 -
150.400 - private void displayDebugMsgs(boolean debugging,
150.401 - ByteArrayOutputStream byteArrOS,
150.402 - Handler logHandler,
150.403 - Logger logger,
150.404 - Level origLevel) {
150.405 - if (!debugging || logHandler == null || byteArrOS == null
150.406 - || logger == null) {
150.407 - return;
150.408 - }
150.409 - // flush the Handler.
150.410 - logHandler.flush();
150.411 - String title = NbBundle.getMessage(EncoderTestPerformerImpl.class,
150.412 - "test_performer.iooutputpane.title", metaFile.getName()); //NOI18N
150.413 - boolean newIO = true;
150.414 - InputOutput io = IOProvider.getDefault().getIO(title, newIO);
150.415 - // Ensure this I/O output pane is visible.
150.416 - io.select();
150.417 - // now writes to the output pane.
150.418 - OutputWriter writer = io.getOut();
150.419 - writer.println(byteArrOS.toString());
150.420 - try {
150.421 - byteArrOS.close();
150.422 - } catch (IOException ex) {
150.423 - // ignore
150.424 - }
150.425 -
150.426 - // make sure to close the writer of I/O output pane.
150.427 - writer.close();
150.428 - // close and remove the Handler.
150.429 - logHandler.close();
150.430 - logger.removeHandler(logHandler);
150.431 - // reset to its original logging level
150.432 - logger.setLevel(origLevel);
150.433 - }
150.434 -}
151.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/EncoderTestTaskImpl.java Sat Sep 27 15:34:52 2008 -0700
151.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
151.3 @@ -1,180 +0,0 @@
151.4 -/*
151.5 - * The contents of this file are subject to the terms of the Common Development
151.6 - * and Distribution License (the License). You may not use this file except in
151.7 - * compliance with the License.
151.8 - *
151.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
151.10 - * or http://www.netbeans.org/cddl.txt.
151.11 -
151.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
151.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
151.14 - * If applicable, add the following below the CDDL Header, with the fields
151.15 - * enclosed by brackets [] replaced by your own identifying information:
151.16 - * "Portions Copyrighted [year] [name of copyright owner]"
151.17 - *
151.18 - * The Original Software is NetBeans. The Initial Developer of the Original
151.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
151.20 - * Microsystems, Inc. All Rights Reserved.
151.21 - */
151.22 -
151.23 -package org.netbeans.modules.encoder.ui.tester.impl;
151.24 -
151.25 -import com.sun.encoder.Encoder;
151.26 -import com.sun.encoder.EncoderConfigurationException;
151.27 -import com.sun.encoder.EncoderException;
151.28 -import com.sun.encoder.EncoderFactory;
151.29 -import com.sun.encoder.EncoderProperties;
151.30 -import com.sun.encoder.EncoderType;
151.31 -import com.sun.encoder.util.UnicodeFile;
151.32 -import java.io.File;
151.33 -import java.io.FileNotFoundException;
151.34 -import java.io.FileOutputStream;
151.35 -import java.io.IOException;
151.36 -import java.io.OutputStreamWriter;
151.37 -import java.io.Writer;
151.38 -import java.util.ResourceBundle;
151.39 -import javax.xml.namespace.QName;
151.40 -import javax.xml.parsers.ParserConfigurationException;
151.41 -import javax.xml.transform.Source;
151.42 -import javax.xml.transform.TransformerConfigurationException;
151.43 -import javax.xml.transform.TransformerException;
151.44 -import javax.xml.transform.TransformerFactory;
151.45 -import javax.xml.transform.dom.DOMSource;
151.46 -import javax.xml.transform.stream.StreamResult;
151.47 -import org.netbeans.modules.encoder.ui.tester.EncoderTestTask;
151.48 -import org.xml.sax.SAXException;
151.49 -
151.50 -/**
151.51 - * An implementation of the EncoderTestTask interface
151.52 - *
151.53 - * @author Cannis Meng, Jun Xu
151.54 - */
151.55 -public class EncoderTestTaskImpl implements EncoderTestTask {
151.56 -
151.57 - private static final ResourceBundle _bundle =
151.58 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/tester/impl/Bundle");
151.59 - /**
151.60 - * Returns an Encoder instance based on specified encoder type, xsd meta
151.61 - * file and root element.
151.62 - *
151.63 - * @param type encoder type.
151.64 - * @param xsdFile the xsd meta file.
151.65 - * @param rootElement root element.
151.66 - * @return an Encoder instance.
151.67 - *
151.68 - * @throws java.io.FileNotFoundException
151.69 - * @throws com.sun.encoder.EncoderConfigurationException
151.70 - */
151.71 - public Encoder getEncoder(EncoderType type, File xsdFile, QName rootElement)
151.72 - throws FileNotFoundException, EncoderConfigurationException {
151.73 - if (xsdFile == null || !xsdFile.exists()) {
151.74 - throw new java.io.FileNotFoundException(_bundle.getString("test_task.lbl.no_xsd_file"));
151.75 - }
151.76 - String metaPath = xsdFile.getAbsolutePath();
151.77 - EncoderFactory factory = null;
151.78 - Encoder encoder = null;
151.79 - factory = EncoderFactory.newInstance();
151.80 - encoder = factory.newEncoder(type, factory.makeMeta(metaPath, rootElement));
151.81 - return encoder;
151.82 - }
151.83 -
151.84 - /**
151.85 - * Decodes the input file according the the xsd meta file and
151.86 - * generate a output xml file.
151.87 - *
151.88 - * @param type encoder type.
151.89 - * @param metaFile the xsd meta file.
151.90 - * @param rootElement root element for decoding.
151.91 - * @param inputFile input file.
151.92 - * @param outputFile output file.
151.93 - * @param predecodeCoding pre-decode coding.
151.94 - * @param charBased whether or not character based.
151.95 - * @return output file.
151.96 - *
151.97 - * @throws com.sun.encoder.EncoderException
151.98 - * @throws java.io.IOException
151.99 - * @throws javax.xml.transform.TransformerConfigurationException
151.100 - * @throws javax.xml.transform.TransformerException
151.101 - * @throws com.sun.encoder.EncoderConfigurationException
151.102 - */
151.103 - public File decode(EncoderType type, File metaFile, QName rootElement,
151.104 - File inputFile, File outputFile, String predecodeCoding,
151.105 - boolean charBased) throws EncoderException, IOException,
151.106 - TransformerConfigurationException, TransformerException,
151.107 - EncoderConfigurationException {
151.108 - Encoder encoder = null;
151.109 - Source decodedXML = null;
151.110 - Writer writer = null;
151.111 -
151.112 - encoder = getEncoder(type, metaFile, rootElement);
151.113 - EncoderProperties properties = new EncoderProperties();
151.114 - if (predecodeCoding.length() > 0) {
151.115 - properties.setPreDecodeCharCoding(predecodeCoding);
151.116 - }
151.117 - if (charBased) {
151.118 - decodedXML = encoder.decodeFromString(UnicodeFile.getText(inputFile), properties);
151.119 - } else {
151.120 - decodedXML = encoder.decodeFromBytes(TesterUtil.loadBytes(inputFile), properties);
151.121 - }
151.122 - writer = new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"); //NOI18N
151.123 -
151.124 - StreamResult sResult = new StreamResult(writer);
151.125 - TransformerFactory tf = TransformerFactory.newInstance();
151.126 - tf.newTransformer().transform(decodedXML, sResult);
151.127 -
151.128 -
151.129 - if (!encoder.dispose()) {
151.130 - throw new EncoderException(_bundle.getString("test_task.exp.disposal_of_encoder_failed"));
151.131 - }
151.132 -
151.133 - return outputFile;
151.134 - }
151.135 -
151.136 - /**
151.137 - * Encodes the xml file with the xsd meta file and generate the encoded
151.138 - * output file.
151.139 - *
151.140 - * @param type encoder type.
151.141 - * @param metaFile the xsd meta file.
151.142 - * @param rootElement root element for encoding.
151.143 - * @param xmlFile xml input file.
151.144 - * @param outputFile output file.
151.145 - * @param postencodeCoding post-encode coding.
151.146 - * @param charBased whether or not character based.
151.147 - * @return null.
151.148 - *
151.149 - * @throws com.sun.encoder.EncoderException
151.150 - * @throws java.io.IOException
151.151 - * @throws javax.xml.parsers.ParserConfigurationException
151.152 - * @throws org.xml.sax.SAXException
151.153 - * @throws com.sun.encoder.EncoderConfigurationException
151.154 - */
151.155 - public File encode(EncoderType type, File metaFile, QName rootElement,
151.156 - File xmlFile, File outputFile, String postencodeCoding,
151.157 - boolean charBased) throws EncoderException, IOException,
151.158 - ParserConfigurationException, SAXException,
151.159 - EncoderConfigurationException {
151.160 -
151.161 - Encoder encoder = getEncoder(type, metaFile, rootElement);
151.162 - EncoderProperties properties = new EncoderProperties();
151.163 - if (postencodeCoding.length() > 0) {
151.164 - properties.setPostEncodeCharCoding(postencodeCoding);
151.165 - }
151.166 - Source decodedXML;
151.167 - decodedXML = new DOMSource(TesterUtil.loadDocument(xmlFile), xmlFile.toString());
151.168 -
151.169 - //Does the encoding
151.170 - if (charBased) {
151.171 - String encodedResult =
151.172 - encoder.encodeToString(decodedXML, properties);
151.173 - UnicodeFile.setText(outputFile, encodedResult);
151.174 - } else {
151.175 - byte[] encodedResult =
151.176 - encoder.encodeToBytes(decodedXML, properties);
151.177 - //Writes the encoded result to a file
151.178 - TesterUtil.writeBytes(encodedResult, outputFile);
151.179 - }
151.180 -
151.181 - return null;
151.182 - }
151.183 -}
152.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/LogFormatter.java Sat Sep 27 15:34:52 2008 -0700
152.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
152.3 @@ -1,85 +0,0 @@
152.4 -/*
152.5 - * The contents of this file are subject to the terms of the Common Development
152.6 - * and Distribution License (the License). You may not use this file except in
152.7 - * compliance with the License.
152.8 - *
152.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
152.10 - * or http://www.netbeans.org/cddl.txt.
152.11 -
152.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
152.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
152.14 - * If applicable, add the following below the CDDL Header, with the fields
152.15 - * enclosed by brackets [] replaced by your own identifying information:
152.16 - * "Portions Copyrighted [year] [name of copyright owner]"
152.17 - *
152.18 - * The Original Software is NetBeans. The Initial Developer of the Original
152.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
152.20 - * Microsystems, Inc. All Rights Reserved.
152.21 - */
152.22 -
152.23 -package org.netbeans.modules.encoder.ui.tester.impl;
152.24 -
152.25 -
152.26 -import java.io.PrintWriter;
152.27 -import java.io.StringWriter;
152.28 -import java.util.logging.LogRecord;
152.29 -import java.util.logging.SimpleFormatter;
152.30 -
152.31 -/**
152.32 - * Special log formatter for decode/encode output in verbose mode. Compared
152.33 - * with the SimpleFormatter, it does not print timestamp and log level related
152.34 - * information.
152.35 - *
152.36 - * @author Lixin Tang
152.37 - */
152.38 -public class LogFormatter extends SimpleFormatter {
152.39 -
152.40 - /** Line separator string. This is the value of the line.separator
152.41 - * property at the moment that the SimpleFormatter was created.
152.42 - */
152.43 - private String lineSeparator = (String)
152.44 - java.security.AccessController.doPrivileged(
152.45 - new sun.security.action.GetPropertyAction("line.separator"));
152.46 -
152.47 - @Override
152.48 - public synchronized String format(final LogRecord record) {
152.49 - StringBuffer sb = new StringBuffer();
152.50 - // Minimize memory allocations here.
152.51 -// String srcClassName = record.getSourceClassName();
152.52 -// if (srcClassName != null) {
152.53 -// int dot = srcClassName.lastIndexOf(".");
152.54 -// if (dot > 0) {
152.55 -// srcClassName = srcClassName.substring(dot + 1);
152.56 -// }
152.57 -// sb.append(srcClassName);
152.58 -// } else {
152.59 -// sb.append(record.getLoggerName());
152.60 -// }
152.61 -// if (record.getSourceMethodName() != null) {
152.62 -// sb.append("#");
152.63 -// sb.append(record.getSourceMethodName()).append("()");
152.64 -// }
152.65 - /*
152.66 - String debugLevel = record.getLevel().getLocalizedName();
152.67 - sb.append(" [").append(debugLevel).append("]");
152.68 - */
152.69 -// sb.append(":");
152.70 -// sb.append(lineSeparator);
152.71 - String message = formatMessage(record);
152.72 - sb.append(message);
152.73 - sb.append(lineSeparator);
152.74 - if (record.getThrown() != null) {
152.75 - try {
152.76 - StringWriter sw = new StringWriter();
152.77 - PrintWriter pw = new PrintWriter(sw);
152.78 - record.getThrown().printStackTrace(pw);
152.79 - pw.close();
152.80 - sb.append(sw.toString());
152.81 - } catch (Exception ex) {
152.82 - //no-op
152.83 - }
152.84 - }
152.85 - sb.append(lineSeparator);
152.86 - return sb.toString();
152.87 - }
152.88 -}
153.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/TesterPanel.form Sat Sep 27 15:34:52 2008 -0700
153.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
153.3 @@ -1,954 +0,0 @@
153.4 -<?xml version="1.0" encoding="UTF-8" ?>
153.5 -
153.6 -<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
153.7 - <NonVisualComponents>
153.8 - <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
153.9 - </Component>
153.10 - </NonVisualComponents>
153.11 - <Properties>
153.12 - <Property name="focusTraversalPolicy" type="java.awt.FocusTraversalPolicy" editor="org.netbeans.modules.a11ychecker.traverse.FocusTraversalPolicyEditor">
153.13 - <SerializedValue value="-84,-19,0,5,115,114,0,59,111,114,103,46,110,101,116,98,101,97,110,115,46,109,111,100,117,108,101,115,46,97,49,49,121,99,104,101,99,107,101,114,46,116,114,97,118,101,114,115,101,46,77,121,84,114,97,118,101,114,115,97,108,80,111,108,105,99,121,-117,45,-95,-30,56,-106,56,86,2,0,3,76,0,3,101,110,100,116,0,18,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,76,0,12,115,97,118,101,100,66,117,116,116,111,110,115,116,0,18,76,106,97,118,97,47,117,116,105,108,47,86,101,99,116,111,114,59,76,0,5,115,116,97,114,116,113,0,126,0,1,120,112,112,115,114,0,16,106,97,118,97,46,117,116,105,108,46,86,101,99,116,111,114,-39,-105,125,91,-128,59,-81,1,3,0,3,73,0,17,99,97,112,97,99,105,116,121,73,110,99,114,101,109,101,110,116,73,0,12,101,108,101,109,101,110,116,67,111,117,110,116,91,0,11,101,108,101,109,101,110,116,68,97,116,97,116,0,19,91,76,106,97,118,97,47,108,97,110,103,47,79,98,106,101,99,116,59,120,112,0,0,0,0,0,0,0,0,117,114,0,19,91,76,106,97,118,97,46,108,97,110,103,46,79,98,106,101,99,116,59,-112,-50,88,-97,16,115,41,108,2,0,0,120,112,0,0,0,10,112,112,112,112,112,112,112,112,112,112,120,112"/>
153.14 - </Property>
153.15 - </Properties>
153.16 - <AccessibilityProperties>
153.17 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.18 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.19 - </Property>
153.20 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.21 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.22 - </Property>
153.23 - </AccessibilityProperties>
153.24 - <AuxValues>
153.25 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
153.26 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
153.27 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
153.28 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
153.29 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
153.30 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
153.31 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
153.32 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
153.33 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
153.34 - </AuxValues>
153.35 -
153.36 - <Layout>
153.37 - <DimensionLayout dim="0">
153.38 - <Group type="103" groupAlignment="0" attributes="0">
153.39 - <Group type="102" attributes="0">
153.40 - <EmptySpace max="-2" attributes="0"/>
153.41 - <Group type="103" groupAlignment="0" attributes="0">
153.42 - <Component id="jLabelDebug" alignment="0" min="-2" max="-2" attributes="0"/>
153.43 - <Component id="jLabelOutput" alignment="0" pref="42" max="32767" attributes="0"/>
153.44 - <Component id="jLabelInput" alignment="0" min="-2" max="-2" attributes="0"/>
153.45 - <Component id="jLabelMeta" alignment="0" min="-2" max="-2" attributes="0"/>
153.46 - </Group>
153.47 - <EmptySpace pref="6" max="32767" attributes="0"/>
153.48 - <Group type="103" groupAlignment="0" attributes="0">
153.49 - <Component id="jRadioButtonEncode" alignment="0" min="-2" max="-2" attributes="1"/>
153.50 - <Component id="jLabelXMLSourceFile" alignment="0" pref="96" max="32767" attributes="1"/>
153.51 - <Component id="jLabelResultCoding" alignment="0" pref="96" max="32767" attributes="1"/>
153.52 - <Component id="jLabelFileName" alignment="0" min="-2" max="-2" attributes="1"/>
153.53 - <Component id="jLabelFolder" alignment="0" min="-2" max="-2" attributes="0"/>
153.54 - <Component id="jLabelVerboseLevel" alignment="0" min="-2" max="-2" attributes="0"/>
153.55 - <Component id="jLabelSourceCoding" alignment="0" min="-2" max="-2" attributes="0"/>
153.56 - <Component id="jLabelDataFile" alignment="0" min="-2" max="-2" attributes="0"/>
153.57 - <Component id="jRadioButtonDecode" alignment="0" min="-2" max="-2" attributes="0"/>
153.58 - <Component id="jLabelXSDFile" alignment="0" min="-2" max="-2" attributes="1"/>
153.59 - <Component id="jLabelSelectAnElement" alignment="0" min="-2" max="-2" attributes="1"/>
153.60 - <Component id="jLabelCreatedFile" min="-2" max="-2" attributes="1"/>
153.61 - </Group>
153.62 - <EmptySpace max="-2" attributes="0"/>
153.63 - <Group type="103" groupAlignment="0" attributes="0">
153.64 - <Component id="jComboBoxResultCoding" alignment="0" pref="339" max="32767" attributes="1"/>
153.65 - <Component id="jTextFieldXMLSourceFile" alignment="0" pref="339" max="32767" attributes="1"/>
153.66 - <Component id="jCheckBoxToString" alignment="0" min="-2" max="-2" attributes="0"/>
153.67 - <Component id="jTextFieldFileName" alignment="0" pref="339" max="32767" attributes="1"/>
153.68 - <Component id="jTextFieldFolder" alignment="0" pref="339" max="32767" attributes="1"/>
153.69 - <Component id="jCheckBoxOverwriteOutput" alignment="0" min="-2" max="-2" attributes="0"/>
153.70 - <Component id="jTextFieldCreatedFile" alignment="0" pref="339" max="32767" attributes="1"/>
153.71 - <Component id="jComboBoxSourceCoding" alignment="0" pref="339" max="32767" attributes="1"/>
153.72 - <Component id="jTextFieldDataFile" alignment="0" pref="339" max="32767" attributes="1"/>
153.73 - <Component id="jCheckBoxFromString" alignment="0" min="-2" max="-2" attributes="0"/>
153.74 - <Component id="jTextFieldXSDFile" alignment="0" pref="339" max="32767" attributes="1"/>
153.75 - <Component id="jComboBoxSelectElement" alignment="0" pref="339" max="32767" attributes="1"/>
153.76 - <Component id="jComboBoxVerboseLevel" alignment="0" min="-2" pref="337" max="-2" attributes="0"/>
153.77 - </Group>
153.78 - <EmptySpace max="-2" attributes="0"/>
153.79 - <Group type="103" groupAlignment="2" attributes="0">
153.80 - <Component id="jButtonBrowseFolder" alignment="2" min="-2" max="-2" attributes="0"/>
153.81 - <Component id="jButtonBrowseXMLSourceFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.82 - <Component id="jButtonBrowseDataFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.83 - </Group>
153.84 - <EmptySpace pref="17" max="32767" attributes="0"/>
153.85 - </Group>
153.86 - <Group type="102" alignment="1" attributes="0">
153.87 - <EmptySpace max="-2" attributes="0"/>
153.88 - <Component id="jSeparatorDecodeEncode" min="-2" pref="553" max="-2" attributes="0"/>
153.89 - </Group>
153.90 - <Component id="jSeparatorMeta" alignment="0" pref="599" max="32767" attributes="0"/>
153.91 - <Component id="jSeparatorDebug" alignment="1" pref="599" max="32767" attributes="0"/>
153.92 - <Component id="jSeparatorInputOutput" alignment="1" pref="599" max="32767" attributes="0"/>
153.93 - </Group>
153.94 - </DimensionLayout>
153.95 - <DimensionLayout dim="1">
153.96 - <Group type="103" groupAlignment="0" attributes="0">
153.97 - <Group type="102" attributes="0">
153.98 - <Group type="103" groupAlignment="0" attributes="0">
153.99 - <Group type="102" alignment="0" attributes="1">
153.100 - <EmptySpace min="82" pref="82" max="82" attributes="0"/>
153.101 - <Component id="jLabelInput" min="-2" max="-2" attributes="0"/>
153.102 - </Group>
153.103 - <Group type="102" attributes="0">
153.104 - <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
153.105 - <Group type="103" groupAlignment="0" attributes="0">
153.106 - <Group type="102" alignment="0" attributes="0">
153.107 - <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
153.108 - <Group type="103" groupAlignment="3" attributes="0">
153.109 - <Component id="jLabelSelectAnElement" alignment="3" min="-2" max="-2" attributes="0"/>
153.110 - <Component id="jComboBoxSelectElement" alignment="3" min="-2" max="-2" attributes="0"/>
153.111 - </Group>
153.112 - <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
153.113 - <Group type="103" groupAlignment="3" attributes="0">
153.114 - <Component id="jLabelXSDFile" alignment="3" min="-2" max="-2" attributes="0"/>
153.115 - <Component id="jTextFieldXSDFile" alignment="3" min="-2" max="-2" attributes="0"/>
153.116 - </Group>
153.117 - </Group>
153.118 - <Component id="jLabelMeta" alignment="0" min="-2" max="-2" attributes="0"/>
153.119 - </Group>
153.120 - <EmptySpace max="-2" attributes="0"/>
153.121 - <Component id="jSeparatorMeta" min="-2" pref="2" max="-2" attributes="0"/>
153.122 - <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
153.123 - <Group type="103" groupAlignment="3" attributes="0">
153.124 - <Component id="jRadioButtonDecode" alignment="3" min="-2" max="-2" attributes="0"/>
153.125 - <Component id="jCheckBoxFromString" alignment="3" min="-2" max="-2" attributes="0"/>
153.126 - </Group>
153.127 - <EmptySpace max="-2" attributes="0"/>
153.128 - <Group type="103" groupAlignment="2" attributes="0">
153.129 - <Component id="jButtonBrowseDataFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.130 - <Component id="jTextFieldDataFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.131 - <Component id="jLabelDataFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.132 - </Group>
153.133 - <EmptySpace max="-2" attributes="0"/>
153.134 - <Group type="103" groupAlignment="0" attributes="0">
153.135 - <Group type="102" alignment="0" attributes="0">
153.136 - <Group type="103" groupAlignment="2" attributes="0">
153.137 - <Component id="jComboBoxSourceCoding" alignment="2" min="-2" max="-2" attributes="0"/>
153.138 - <Component id="jLabelSourceCoding" alignment="2" min="-2" max="-2" attributes="0"/>
153.139 - </Group>
153.140 - <EmptySpace min="-2" max="-2" attributes="0"/>
153.141 - <Component id="jSeparatorDecodeEncode" min="-2" pref="2" max="-2" attributes="0"/>
153.142 - <EmptySpace max="-2" attributes="0"/>
153.143 - <Group type="103" groupAlignment="3" attributes="0">
153.144 - <Component id="jRadioButtonEncode" alignment="3" min="-2" max="-2" attributes="0"/>
153.145 - <Component id="jCheckBoxToString" alignment="3" min="-2" max="-2" attributes="0"/>
153.146 - </Group>
153.147 - <EmptySpace max="-2" attributes="0"/>
153.148 - <Group type="103" groupAlignment="2" attributes="0">
153.149 - <Component id="jLabelXMLSourceFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.150 - <Component id="jTextFieldXMLSourceFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.151 - <Component id="jButtonBrowseXMLSourceFile" alignment="2" min="-2" max="-2" attributes="0"/>
153.152 - </Group>
153.153 - <EmptySpace max="-2" attributes="0"/>
153.154 - <Component id="jLabelResultCoding" min="-2" max="-2" attributes="0"/>
153.155 - <EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
153.156 - <Component id="jSeparatorInputOutput" min="-2" pref="2" max="-2" attributes="0"/>
153.157 - <EmptySpace max="-2" attributes="0"/>
153.158 - <Component id="jLabelOutput" min="-2" max="-2" attributes="0"/>
153.159 - <EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
153.160 - <Group type="103" groupAlignment="3" attributes="0">
153.161 - <Component id="jLabelFileName" alignment="3" min="-2" max="-2" attributes="0"/>
153.162 - <Component id="jTextFieldFileName" alignment="3" min="-2" max="-2" attributes="0"/>
153.163 - </Group>
153.164 - <EmptySpace min="-2" max="-2" attributes="0"/>
153.165 - <Group type="103" groupAlignment="2" attributes="0">
153.166 - <Component id="jButtonBrowseFolder" alignment="2" min="-2" max="-2" attributes="0"/>
153.167 - <Component id="jTextFieldFolder" alignment="2" min="-2" max="-2" attributes="0"/>
153.168 - <Component id="jLabelFolder" alignment="2" min="-2" max="-2" attributes="0"/>
153.169 - </Group>
153.170 - <EmptySpace max="-2" attributes="0"/>
153.171 - <Component id="jCheckBoxOverwriteOutput" min="-2" max="-2" attributes="0"/>
153.172 - <EmptySpace max="-2" attributes="0"/>
153.173 - <Group type="103" groupAlignment="3" attributes="0">
153.174 - <Component id="jTextFieldCreatedFile" alignment="3" min="-2" max="-2" attributes="0"/>
153.175 - <Component id="jLabelCreatedFile" alignment="3" min="-2" max="-2" attributes="0"/>
153.176 - </Group>
153.177 - <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
153.178 - <Component id="jSeparatorDebug" min="-2" max="-2" attributes="0"/>
153.179 - <Group type="103" groupAlignment="0" attributes="0">
153.180 - <Group type="102" attributes="0">
153.181 - <EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
153.182 - <Component id="jLabelDebug" min="-2" max="-2" attributes="0"/>
153.183 - </Group>
153.184 - <Group type="102" alignment="0" attributes="0">
153.185 - <EmptySpace type="separate" max="-2" attributes="0"/>
153.186 - <Group type="103" groupAlignment="3" attributes="0">
153.187 - <Component id="jLabelVerboseLevel" alignment="3" min="-2" max="-2" attributes="0"/>
153.188 - <Component id="jComboBoxVerboseLevel" alignment="3" min="-2" max="-2" attributes="0"/>
153.189 - </Group>
153.190 - </Group>
153.191 - </Group>
153.192 - </Group>
153.193 - <Group type="102" alignment="0" attributes="0">
153.194 - <EmptySpace min="-2" pref="84" max="-2" attributes="0"/>
153.195 - <Component id="jComboBoxResultCoding" min="-2" max="-2" attributes="0"/>
153.196 - </Group>
153.197 - </Group>
153.198 - </Group>
153.199 - </Group>
153.200 - <EmptySpace pref="16" max="32767" attributes="0"/>
153.201 - </Group>
153.202 - </Group>
153.203 - </DimensionLayout>
153.204 - </Layout>
153.205 - <SubComponents>
153.206 - <Component class="javax.swing.JLabel" name="jLabelXSDFile">
153.207 - <Properties>
153.208 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.209 - <ComponentRef name="jTextFieldXSDFile"/>
153.210 - </Property>
153.211 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.212 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.xsd_file" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.213 - </Property>
153.214 - </Properties>
153.215 - <AccessibilityProperties>
153.216 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.217 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.xsd_file" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.218 - </Property>
153.219 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.220 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.xsd_file" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.221 - </Property>
153.222 - </AccessibilityProperties>
153.223 - <AuxValues>
153.224 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
153.225 - </AuxValues>
153.226 - </Component>
153.227 - <Component class="javax.swing.JTextField" name="jTextFieldXSDFile">
153.228 - <Properties>
153.229 - <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
153.230 - <Color blue="f0" green="f0" red="f0" type="rgb"/>
153.231 - </Property>
153.232 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.233 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.xsd_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.234 - </Property>
153.235 - <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
153.236 - <Dimension value="[94, 19]"/>
153.237 - </Property>
153.238 - </Properties>
153.239 - <AccessibilityProperties>
153.240 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.241 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.xsd_file.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.242 - </Property>
153.243 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.244 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.xsd_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.245 - </Property>
153.246 - </AccessibilityProperties>
153.247 - </Component>
153.248 - <Component class="javax.swing.JRadioButton" name="jRadioButtonEncode">
153.249 - <Properties>
153.250 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.251 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.encode" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.252 - </Property>
153.253 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.254 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.encode.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.255 - </Property>
153.256 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
153.257 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
153.258 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
153.259 - </Border>
153.260 - </Property>
153.261 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
153.262 - <Insets value="[0, 0, 0, 0]"/>
153.263 - </Property>
153.264 - </Properties>
153.265 - <AccessibilityProperties>
153.266 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.267 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.encode.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.268 - </Property>
153.269 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.270 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.encode.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.271 - </Property>
153.272 - </AccessibilityProperties>
153.273 - <Events>
153.274 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButtonEncodeActionPerformed"/>
153.275 - </Events>
153.276 - <AuxValues>
153.277 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.278 - </AuxValues>
153.279 - </Component>
153.280 - <Component class="javax.swing.JRadioButton" name="jRadioButtonDecode">
153.281 - <Properties>
153.282 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.283 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.decode" replaceFormat="org.openide.util.NbBundle.getBundle({sourceFileName}.class).getString("{key}")"/>
153.284 - </Property>
153.285 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.286 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.decode.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.287 - </Property>
153.288 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
153.289 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
153.290 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
153.291 - </Border>
153.292 - </Property>
153.293 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
153.294 - <Insets value="[0, 0, 0, 0]"/>
153.295 - </Property>
153.296 - </Properties>
153.297 - <AccessibilityProperties>
153.298 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.299 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.decode.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.300 - </Property>
153.301 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.302 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.decode.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.303 - </Property>
153.304 - </AccessibilityProperties>
153.305 - <Events>
153.306 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButtonDecodeActionPerformed"/>
153.307 - </Events>
153.308 - <AuxValues>
153.309 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.310 - </AuxValues>
153.311 - </Component>
153.312 - <Component class="javax.swing.JTextField" name="jTextFieldXMLSourceFile">
153.313 - <Properties>
153.314 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.315 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.xml_source_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.316 - </Property>
153.317 - </Properties>
153.318 - <AccessibilityProperties>
153.319 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.320 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.xml_source_file.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.321 - </Property>
153.322 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.323 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.xml_source_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.324 - </Property>
153.325 - </AccessibilityProperties>
153.326 - </Component>
153.327 - <Component class="javax.swing.JTextField" name="jTextFieldDataFile">
153.328 - <Properties>
153.329 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.330 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.data_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.331 - </Property>
153.332 - </Properties>
153.333 - <AccessibilityProperties>
153.334 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.335 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_data_file.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.336 - </Property>
153.337 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.338 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.data_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.339 - </Property>
153.340 - </AccessibilityProperties>
153.341 - </Component>
153.342 - <Component class="javax.swing.JLabel" name="jLabelFileName">
153.343 - <Properties>
153.344 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.345 - <ComponentRef name="jTextFieldFileName"/>
153.346 - </Property>
153.347 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.348 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_file_name" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.349 - </Property>
153.350 - </Properties>
153.351 - <AccessibilityProperties>
153.352 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.353 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_file_name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.354 - </Property>
153.355 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.356 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_file_name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.357 - </Property>
153.358 - </AccessibilityProperties>
153.359 - <AuxValues>
153.360 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.361 - </AuxValues>
153.362 - </Component>
153.363 - <Component class="javax.swing.JTextField" name="jTextFieldFileName">
153.364 - <Properties>
153.365 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.366 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_file_name.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.367 - </Property>
153.368 - </Properties>
153.369 - <AccessibilityProperties>
153.370 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.371 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panell.output_file_name.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.372 - </Property>
153.373 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.374 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_file_name.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.375 - </Property>
153.376 - </AccessibilityProperties>
153.377 - </Component>
153.378 - <Component class="javax.swing.JCheckBox" name="jCheckBoxOverwriteOutput">
153.379 - <Properties>
153.380 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.381 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.overwrite_output" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.382 - </Property>
153.383 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.384 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.overwrite_output.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.385 - </Property>
153.386 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
153.387 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
153.388 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
153.389 - </Border>
153.390 - </Property>
153.391 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
153.392 - <Insets value="[0, 0, 0, 0]"/>
153.393 - </Property>
153.394 - </Properties>
153.395 - <AccessibilityProperties>
153.396 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.397 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.overwrite_output.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.398 - </Property>
153.399 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.400 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.overwrite_output.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.401 - </Property>
153.402 - </AccessibilityProperties>
153.403 - <AuxValues>
153.404 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.405 - </AuxValues>
153.406 - </Component>
153.407 - <Component class="javax.swing.JButton" name="jButtonBrowseXMLSourceFile">
153.408 - <Properties>
153.409 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.410 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.browse2" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.411 - </Property>
153.412 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.413 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_xml_source_file.browse.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.414 - </Property>
153.415 - </Properties>
153.416 - <AccessibilityProperties>
153.417 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.418 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_xml_source_file.browse.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.419 - </Property>
153.420 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.421 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_xml_source_file.browse.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.422 - </Property>
153.423 - </AccessibilityProperties>
153.424 - <Events>
153.425 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonBrowseXMLSourceFileActionPerformed"/>
153.426 - </Events>
153.427 - <AuxValues>
153.428 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.429 - </AuxValues>
153.430 - </Component>
153.431 - <Component class="javax.swing.JButton" name="jButtonBrowseDataFile">
153.432 - <Properties>
153.433 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.434 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.browse1" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.435 - </Property>
153.436 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.437 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_data_file.browse.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.438 - </Property>
153.439 - </Properties>
153.440 - <AccessibilityProperties>
153.441 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.442 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_data_file.browse.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.443 - </Property>
153.444 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.445 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_data_file.browse.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.446 - </Property>
153.447 - </AccessibilityProperties>
153.448 - <Events>
153.449 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonBrowseDataFileActionPerformed"/>
153.450 - </Events>
153.451 - <AuxValues>
153.452 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.453 - </AuxValues>
153.454 - </Component>
153.455 - <Component class="javax.swing.JLabel" name="jLabelDataFile">
153.456 - <Properties>
153.457 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.458 - <ComponentRef name="jTextFieldDataFile"/>
153.459 - </Property>
153.460 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.461 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.input_data_file" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.462 - </Property>
153.463 - </Properties>
153.464 - <AccessibilityProperties>
153.465 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.466 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.input_data_file" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.467 - </Property>
153.468 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.469 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.input_data_file" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.470 - </Property>
153.471 - </AccessibilityProperties>
153.472 - <AuxValues>
153.473 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.474 - </AuxValues>
153.475 - </Component>
153.476 - <Component class="javax.swing.JLabel" name="jLabelXMLSourceFile">
153.477 - <Properties>
153.478 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.479 - <ComponentRef name="jTextFieldXMLSourceFile"/>
153.480 - </Property>
153.481 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.482 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.xml_source" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.483 - </Property>
153.484 - </Properties>
153.485 - <AccessibilityProperties>
153.486 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.487 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.xml_source" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.488 - </Property>
153.489 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.490 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.xml_source" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.491 - </Property>
153.492 - </AccessibilityProperties>
153.493 - <AuxValues>
153.494 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.495 - </AuxValues>
153.496 - </Component>
153.497 - <Component class="javax.swing.JLabel" name="jLabelFolder">
153.498 - <Properties>
153.499 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.500 - <ComponentRef name="jTextFieldFolder"/>
153.501 - </Property>
153.502 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.503 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_folder" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.504 - </Property>
153.505 - </Properties>
153.506 - <AccessibilityProperties>
153.507 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.508 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_folder" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.509 - </Property>
153.510 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.511 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_folder" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.512 - </Property>
153.513 - </AccessibilityProperties>
153.514 - <AuxValues>
153.515 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.516 - </AuxValues>
153.517 - </Component>
153.518 - <Component class="javax.swing.JTextField" name="jTextFieldFolder">
153.519 - <Properties>
153.520 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.521 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_folder.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.522 - </Property>
153.523 - </Properties>
153.524 - <AccessibilityProperties>
153.525 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.526 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_folder.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.527 - </Property>
153.528 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.529 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_folder.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.530 - </Property>
153.531 - </AccessibilityProperties>
153.532 - </Component>
153.533 - <Component class="javax.swing.JButton" name="jButtonBrowseFolder">
153.534 - <Properties>
153.535 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.536 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.browse3" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.537 - </Property>
153.538 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.539 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_folder.browse.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.540 - </Property>
153.541 - </Properties>
153.542 - <AccessibilityProperties>
153.543 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.544 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_folder.browse.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.545 - </Property>
153.546 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.547 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_folder.browse.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.548 - </Property>
153.549 - </AccessibilityProperties>
153.550 - <Events>
153.551 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonBrowseFolderActionPerformed"/>
153.552 - </Events>
153.553 - <AuxValues>
153.554 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.555 - </AuxValues>
153.556 - </Component>
153.557 - <Component class="javax.swing.JLabel" name="jLabelCreatedFile">
153.558 - <Properties>
153.559 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.560 - <ComponentRef name="jTextFieldCreatedFile"/>
153.561 - </Property>
153.562 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.563 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.created_file" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.564 - </Property>
153.565 - </Properties>
153.566 - <AccessibilityProperties>
153.567 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.568 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.created_file" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.569 - </Property>
153.570 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.571 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.created_file" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.572 - </Property>
153.573 - </AccessibilityProperties>
153.574 - <AuxValues>
153.575 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
153.576 - </AuxValues>
153.577 - </Component>
153.578 - <Component class="javax.swing.JTextField" name="jTextFieldCreatedFile">
153.579 - <Properties>
153.580 - <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
153.581 - <Color blue="f0" green="f0" red="f0" type="rgb"/>
153.582 - </Property>
153.583 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.584 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.created_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.585 - </Property>
153.586 - </Properties>
153.587 - <AccessibilityProperties>
153.588 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.589 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.created_file.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.590 - </Property>
153.591 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.592 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.created_file.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.593 - </Property>
153.594 - </AccessibilityProperties>
153.595 - </Component>
153.596 - <Component class="javax.swing.JComboBox" name="jComboBoxSelectElement">
153.597 - <Properties>
153.598 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
153.599 - <StringArray count="4">
153.600 - <StringItem index="0" value="Item 1"/>
153.601 - <StringItem index="1" value="Item 2"/>
153.602 - <StringItem index="2" value="Item 3"/>
153.603 - <StringItem index="3" value="Item 4"/>
153.604 - </StringArray>
153.605 - </Property>
153.606 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.607 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.select_an_element.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.608 - </Property>
153.609 - </Properties>
153.610 - <AccessibilityProperties>
153.611 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.612 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.select_an_element.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.613 - </Property>
153.614 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.615 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.select_an_element.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.616 - </Property>
153.617 - </AccessibilityProperties>
153.618 - </Component>
153.619 - <Component class="javax.swing.JLabel" name="jLabelSelectAnElement">
153.620 - <Properties>
153.621 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.622 - <ComponentRef name="jComboBoxSelectElement"/>
153.623 - </Property>
153.624 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.625 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.select_an_element" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
153.626 - </Property>
153.627 - </Properties>
153.628 - <AccessibilityProperties>
153.629 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.630 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.select_an_element" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.631 - </Property>
153.632 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.633 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.select_an_element" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.634 - </Property>
153.635 - </AccessibilityProperties>
153.636 - <AuxValues>
153.637 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.638 - </AuxValues>
153.639 - </Component>
153.640 - <Component class="javax.swing.JCheckBox" name="jCheckBoxToString">
153.641 - <Properties>
153.642 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.643 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.to_string" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.644 - </Property>
153.645 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.646 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.to_string.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.647 - </Property>
153.648 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
153.649 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
153.650 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
153.651 - </Border>
153.652 - </Property>
153.653 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
153.654 - <Insets value="[0, 0, 0, 0]"/>
153.655 - </Property>
153.656 - </Properties>
153.657 - <AccessibilityProperties>
153.658 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.659 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.to_string.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.660 - </Property>
153.661 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.662 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.to_string.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.663 - </Property>
153.664 - </AccessibilityProperties>
153.665 - <AuxValues>
153.666 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.667 - </AuxValues>
153.668 - </Component>
153.669 - <Component class="javax.swing.JLabel" name="jLabelResultCoding">
153.670 - <Properties>
153.671 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.672 - <ComponentRef name="jComboBoxResultCoding"/>
153.673 - </Property>
153.674 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.675 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.result_coding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.676 - </Property>
153.677 - </Properties>
153.678 - <AccessibilityProperties>
153.679 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.680 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.result_coding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.681 - </Property>
153.682 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.683 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.result_coding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.684 - </Property>
153.685 - </AccessibilityProperties>
153.686 - <AuxValues>
153.687 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.688 - </AuxValues>
153.689 - </Component>
153.690 - <Component class="javax.swing.JComboBox" name="jComboBoxResultCoding">
153.691 - <Properties>
153.692 - <Property name="editable" type="boolean" value="true"/>
153.693 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
153.694 - <StringArray count="4">
153.695 - <StringItem index="0" value="Item 1"/>
153.696 - <StringItem index="1" value="Item 2"/>
153.697 - <StringItem index="2" value="Item 3"/>
153.698 - <StringItem index="3" value="Item 4"/>
153.699 - </StringArray>
153.700 - </Property>
153.701 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.702 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.result_coding.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.703 - </Property>
153.704 - </Properties>
153.705 - <AccessibilityProperties>
153.706 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.707 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.result_coding.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.708 - </Property>
153.709 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.710 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.result_coding.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.711 - </Property>
153.712 - </AccessibilityProperties>
153.713 - </Component>
153.714 - <Component class="javax.swing.JCheckBox" name="jCheckBoxFromString">
153.715 - <Properties>
153.716 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.717 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.from_string" replaceFormat="org.openide.util.NbBundle.getBundle({sourceFileName}.class).getString("{key}")"/>
153.718 - </Property>
153.719 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.720 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.from_string.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.721 - </Property>
153.722 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
153.723 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
153.724 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
153.725 - </Border>
153.726 - </Property>
153.727 - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
153.728 - <Insets value="[0, 0, 0, 0]"/>
153.729 - </Property>
153.730 - </Properties>
153.731 - <AccessibilityProperties>
153.732 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.733 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.from_string.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.734 - </Property>
153.735 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.736 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.from_string.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.737 - </Property>
153.738 - </AccessibilityProperties>
153.739 - <AuxValues>
153.740 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.741 - </AuxValues>
153.742 - </Component>
153.743 - <Component class="javax.swing.JLabel" name="jLabelSourceCoding">
153.744 - <Properties>
153.745 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.746 - <ComponentRef name="jComboBoxSourceCoding"/>
153.747 - </Property>
153.748 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.749 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.source_coding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.750 - </Property>
153.751 - </Properties>
153.752 - <AccessibilityProperties>
153.753 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.754 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.source_coding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.755 - </Property>
153.756 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.757 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.source_coding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.758 - </Property>
153.759 - </AccessibilityProperties>
153.760 - <AuxValues>
153.761 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.762 - </AuxValues>
153.763 - </Component>
153.764 - <Component class="javax.swing.JComboBox" name="jComboBoxSourceCoding">
153.765 - <Properties>
153.766 - <Property name="editable" type="boolean" value="true"/>
153.767 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
153.768 - <StringArray count="4">
153.769 - <StringItem index="0" value="Item 1"/>
153.770 - <StringItem index="1" value="Item 2"/>
153.771 - <StringItem index="2" value="Item 3"/>
153.772 - <StringItem index="3" value="Item 4"/>
153.773 - </StringArray>
153.774 - </Property>
153.775 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.776 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.source_coding.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.777 - </Property>
153.778 - </Properties>
153.779 - <AccessibilityProperties>
153.780 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.781 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.source_coding.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.782 - </Property>
153.783 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.784 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.source_coding.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.785 - </Property>
153.786 - </AccessibilityProperties>
153.787 - </Component>
153.788 - <Component class="javax.swing.JSeparator" name="jSeparatorMeta">
153.789 - <AccessibilityProperties>
153.790 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.791 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.meta" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.792 - </Property>
153.793 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.794 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.meta" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.795 - </Property>
153.796 - </AccessibilityProperties>
153.797 - </Component>
153.798 - <Component class="javax.swing.JSeparator" name="jSeparatorDecodeEncode">
153.799 - <AccessibilityProperties>
153.800 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.801 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.decode_encode" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.802 - </Property>
153.803 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.804 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.decode_encode" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.805 - </Property>
153.806 - </AccessibilityProperties>
153.807 - </Component>
153.808 - <Component class="javax.swing.JSeparator" name="jSeparatorInputOutput">
153.809 - <AccessibilityProperties>
153.810 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.811 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.input_output" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.812 - </Property>
153.813 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.814 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.input_output" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.815 - </Property>
153.816 - </AccessibilityProperties>
153.817 - </Component>
153.818 - <Component class="javax.swing.JSeparator" name="jSeparatorDebug">
153.819 - <AccessibilityProperties>
153.820 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.821 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.debug" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.822 - </Property>
153.823 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.824 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.separator.debug" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.825 - </Property>
153.826 - </AccessibilityProperties>
153.827 - </Component>
153.828 - <Component class="javax.swing.JLabel" name="jLabelVerboseLevel">
153.829 - <Properties>
153.830 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.831 - <ComponentRef name="jComboBoxVerboseLevel"/>
153.832 - </Property>
153.833 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.834 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.verbose_level" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.835 - </Property>
153.836 - </Properties>
153.837 - <AccessibilityProperties>
153.838 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.839 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.verbose_level" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.840 - </Property>
153.841 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.842 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.verbose_level" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.843 - </Property>
153.844 - </AccessibilityProperties>
153.845 - <AuxValues>
153.846 - <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
153.847 - </AuxValues>
153.848 - </Component>
153.849 - <Component class="javax.swing.JComboBox" name="jComboBoxVerboseLevel">
153.850 - <Properties>
153.851 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
153.852 - <StringArray count="4">
153.853 - <StringItem index="0" value="Item 1"/>
153.854 - <StringItem index="1" value="Item 2"/>
153.855 - <StringItem index="2" value="Item 3"/>
153.856 - <StringItem index="3" value="Item 4"/>
153.857 - </StringArray>
153.858 - </Property>
153.859 - <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.860 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.verbose_level.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.861 - </Property>
153.862 - </Properties>
153.863 - <AccessibilityProperties>
153.864 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.865 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.verbose_level.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.866 - </Property>
153.867 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.868 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.verbose_level.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.869 - </Property>
153.870 - </AccessibilityProperties>
153.871 - </Component>
153.872 - <Component class="javax.swing.JLabel" name="jLabelMeta">
153.873 - <Properties>
153.874 - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
153.875 - <Font name="Tahoma" size="12" style="0"/>
153.876 - </Property>
153.877 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.878 - <ComponentRef name="jLabelMeta"/>
153.879 - </Property>
153.880 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.881 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.meta_section" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.882 - </Property>
153.883 - </Properties>
153.884 - <AccessibilityProperties>
153.885 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.886 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.meta_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.887 - </Property>
153.888 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.889 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.meta_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.890 - </Property>
153.891 - </AccessibilityProperties>
153.892 - </Component>
153.893 - <Component class="javax.swing.JLabel" name="jLabelInput">
153.894 - <Properties>
153.895 - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
153.896 - <Font name="Tahoma" size="12" style="0"/>
153.897 - </Property>
153.898 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.899 - <ComponentRef name="jLabelInput"/>
153.900 - </Property>
153.901 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.902 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.input_section" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.903 - </Property>
153.904 - </Properties>
153.905 - <AccessibilityProperties>
153.906 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.907 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.908 - </Property>
153.909 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.910 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.input_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.911 - </Property>
153.912 - </AccessibilityProperties>
153.913 - </Component>
153.914 - <Component class="javax.swing.JLabel" name="jLabelOutput">
153.915 - <Properties>
153.916 - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
153.917 - <Font name="Tahoma" size="12" style="0"/>
153.918 - </Property>
153.919 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.920 - <ComponentRef name="jLabelOutput"/>
153.921 - </Property>
153.922 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.923 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.output_section" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.924 - </Property>
153.925 - </Properties>
153.926 - <AccessibilityProperties>
153.927 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.928 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.929 - </Property>
153.930 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.931 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.output_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.932 - </Property>
153.933 - </AccessibilityProperties>
153.934 - </Component>
153.935 - <Component class="javax.swing.JLabel" name="jLabelDebug">
153.936 - <Properties>
153.937 - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
153.938 - <Font name="Tahoma" size="12" style="0"/>
153.939 - </Property>
153.940 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
153.941 - <ComponentRef name="jLabelDebug"/>
153.942 - </Property>
153.943 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.944 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.lbl.debug_section" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.945 - </Property>
153.946 - </Properties>
153.947 - <AccessibilityProperties>
153.948 - <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.949 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.debug_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.950 - </Property>
153.951 - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
153.952 - <ResourceString bundle="org/netbeans/modules/encoder/ui/tester/impl/Bundle.properties" key="test_panel.debug_section.description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
153.953 - </Property>
153.954 - </AccessibilityProperties>
153.955 - </Component>
153.956 - </SubComponents>
153.957 -</Form>
154.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/TesterPanel.java Sat Sep 27 15:34:52 2008 -0700
154.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
154.3 @@ -1,1013 +0,0 @@
154.4 -/*
154.5 - * The contents of this file are subject to the terms of the Common Development
154.6 - * and Distribution License (the License). You may not use this file except in
154.7 - * compliance with the License.
154.8 - *
154.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
154.10 - * or http://www.netbeans.org/cddl.txt.
154.11 -
154.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
154.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
154.14 - * If applicable, add the following below the CDDL Header, with the fields
154.15 - * enclosed by brackets [] replaced by your own identifying information:
154.16 - * "Portions Copyrighted [year] [name of copyright owner]"
154.17 - *
154.18 - * The Original Software is NetBeans. The Initial Developer of the Original
154.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
154.20 - * Microsystems, Inc. All Rights Reserved.
154.21 - */
154.22 -
154.23 -package org.netbeans.modules.encoder.ui.tester.impl;
154.24 -
154.25 -import java.io.File;
154.26 -import java.util.ResourceBundle;
154.27 -import java.util.prefs.BackingStoreException;
154.28 -import java.util.prefs.Preferences;
154.29 -import javax.swing.JComboBox;
154.30 -import javax.swing.JFileChooser;
154.31 -import javax.swing.event.DocumentEvent;
154.32 -import javax.swing.event.DocumentListener;
154.33 -import javax.swing.filechooser.FileFilter;
154.34 -import javax.xml.namespace.QName;
154.35 -import org.netbeans.modules.encoder.ui.basic.Utils;
154.36 -import org.netbeans.modules.encoder.ui.tester.impl.EncoderTestPerformerImpl;
154.37 -import org.openide.DialogDisplayer;
154.38 -import org.openide.NotifyDescriptor;
154.39 -import org.openide.filesystems.FileUtil;
154.40 -
154.41 -/**
154.42 - * Implementation of the Encoder tester form
154.43 - *
154.44 - * @author Cannis Meng
154.45 - */
154.46 -public class TesterPanel extends javax.swing.JPanel implements DocumentListener {
154.47 -
154.48 - private static final String[] CHARSET_NAMES_EXTRA = Utils.getCharsetNames(true);
154.49 - private static final ResourceBundle _bundle =
154.50 - ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/tester/impl/Bundle");
154.51 -
154.52 - private static final String PREF_XSD_FILE = "xsd-file"; //NOI18N
154.53 - private static final String PREF_TOP_ELEM = "top-elem"; //NOI18N
154.54 - private static final String PREF_ACTION = "action"; //NOI18N
154.55 - private static final String PREF_INPUT = "in-file"; //NOI18N
154.56 - private static final String PREF_OUTPUT = "out-file"; //NOI18N
154.57 - private static final String PREF_OVERWRITE = "overwrite"; //NOI18N
154.58 - private static final String PREF_CHAR_BASED = "char_based"; //NOI18N
154.59 - private static final String PREF_DOC_CODING = "doc_coding"; //NOI18N
154.60 - private static final String ACTION_ENCODE = "encode"; //NOI18N
154.61 - private static final String ACTION_DECODE = "decode"; //NOI18N
154.62 - private static final String PREF_DEBUG_LEVEL = "debug_level"; //NOI18N
154.63 - private static final String[] DEBUG_LEVELS = new String[] {"NONE", "INFO", "FINE", "FINER", "FINEST"};
154.64 -
154.65 - private String xsdFilePath;
154.66 - private Preferences mPrefs = Preferences.userNodeForPackage(this.getClass());
154.67 -
154.68 - /** Creates new form TesterPanel */
154.69 - public TesterPanel(String xsdFile) {
154.70 - xsdFilePath = xsdFile;
154.71 - initComponents();
154.72 - buttonGroup1.add(this.jRadioButtonEncode);
154.73 - buttonGroup1.add(this.jRadioButtonDecode);
154.74 - jTextFieldXSDFile.setText(xsdFile);
154.75 - jTextFieldXSDFile.setEditable(false);
154.76 - File f = new File(xsdFile);
154.77 - jTextFieldFolder.setText(f.getParent());
154.78 - this.jTextFieldFileName.getDocument().addDocumentListener(this);
154.79 - this.jTextFieldFolder.getDocument().addDocumentListener(this);
154.80 - this.jTextFieldCreatedFile.setEditable(false);
154.81 - jRadioButtonDecode.setSelected(true);
154.82 - if (xsdFilePath != null) {
154.83 - File file = new File(xsdFilePath);
154.84 - if (file.getParent() != null) {
154.85 - jTextFieldFolder.setText(file.getParent());
154.86 - }
154.87 - }
154.88 - setComboBoxList(jComboBoxResultCoding, CHARSET_NAMES_EXTRA);
154.89 - jComboBoxResultCoding.setSelectedIndex(-1);
154.90 - setComboBoxList(jComboBoxSourceCoding, CHARSET_NAMES_EXTRA);
154.91 - jComboBoxSourceCoding.setSelectedIndex(-1);
154.92 - setComboBoxList(jComboBoxVerboseLevel, DEBUG_LEVELS);
154.93 - jComboBoxVerboseLevel.setSelectedIndex(0);
154.94 - applyPreferences();
154.95 - updateComponents();
154.96 - }
154.97 -
154.98 - private void setComboBoxList(JComboBox comboBox, String[] list) {
154.99 - comboBox.removeAllItems();
154.100 - for (int i = 0; i < list.length; i++) {
154.101 - comboBox.addItem(list[i]);
154.102 - }
154.103 - comboBox.setSelectedIndex(-1);
154.104 - }
154.105 -
154.106 - private void applyPreferences() {
154.107 - if (sameAsPreviousLaunch()) {
154.108 - String value = mPrefs.get(PREF_ACTION, null);
154.109 - if (value == null) {
154.110 - return;
154.111 - }
154.112 - if (ACTION_DECODE.equals(value)) {
154.113 - jRadioButtonDecode.setSelected(true);
154.114 - } else {
154.115 - jRadioButtonEncode.setSelected(true);
154.116 - }
154.117 - value = mPrefs.get(PREF_INPUT, null);
154.118 - if (value == null) {
154.119 - return;
154.120 - }
154.121 - if (jRadioButtonEncode.isSelected()) {
154.122 - jTextFieldXMLSourceFile.setText(value);
154.123 - value = mPrefs.get(PREF_CHAR_BASED, null);
154.124 - if (value != null) {
154.125 - jCheckBoxToString.setSelected(Boolean.valueOf(value));
154.126 - }
154.127 - value = mPrefs.get(PREF_DOC_CODING, null);
154.128 - if (value != null) {
154.129 - jComboBoxResultCoding.getEditor().setItem(value);
154.130 - }
154.131 - } else {
154.132 - jTextFieldDataFile.setText(value);
154.133 - value = mPrefs.get(PREF_CHAR_BASED, null);
154.134 - if (value != null) {
154.135 - jCheckBoxFromString.setSelected(Boolean.valueOf(value));
154.136 - }
154.137 - value = mPrefs.get(PREF_DOC_CODING, null);
154.138 - if (value != null) {
154.139 - jComboBoxSourceCoding.getEditor().setItem(value);
154.140 - }
154.141 - }
154.142 - value = mPrefs.get(PREF_OUTPUT, null);
154.143 - if (value == null) {
154.144 - return;
154.145 - }
154.146 - File outputFile = new File(value);
154.147 - if (outputFile.getName() != null) {
154.148 - int pos = outputFile.getName().lastIndexOf('.');
154.149 - if (pos >= 0) {
154.150 - jTextFieldFileName.setText(outputFile.getName().substring(0, pos));
154.151 - } else {
154.152 - jTextFieldFileName.setText(outputFile.getName());
154.153 - }
154.154 - }
154.155 - jTextFieldFolder.setText(outputFile.getParent());
154.156 - jCheckBoxOverwriteOutput.setSelected(mPrefs.getBoolean(PREF_OVERWRITE, true));
154.157 - jComboBoxVerboseLevel.setSelectedIndex(mPrefs.getInt(PREF_DEBUG_LEVEL, 0));
154.158 - }
154.159 - }
154.160 -
154.161 - public void savePreferences() throws BackingStoreException {
154.162 - mPrefs.put(PREF_XSD_FILE, xsdFilePath);
154.163 - if (this.getActionType().equals(EncoderTestPerformerImpl.DECODE)) {
154.164 - mPrefs.put(PREF_ACTION, ACTION_DECODE);
154.165 - mPrefs.putBoolean(PREF_CHAR_BASED, isFromString());
154.166 - mPrefs.put(PREF_DOC_CODING, getPredecodeCoding());
154.167 - } else {
154.168 - mPrefs.put(PREF_ACTION, ACTION_ENCODE);
154.169 - mPrefs.putBoolean(PREF_CHAR_BASED, isToString());
154.170 - mPrefs.put(PREF_DOC_CODING, getPostencodeCoding());
154.171 - }
154.172 - if (getSelectedTopElementDecl() != null) {
154.173 - mPrefs.put(PREF_TOP_ELEM, getSelectedTopElementDecl().toString());
154.174 - }
154.175 - if (getProcessFile() != null) {
154.176 - mPrefs.put(PREF_INPUT, getProcessFile());
154.177 - }
154.178 - if (getOutputFile() != null) {
154.179 - mPrefs.put(PREF_OUTPUT, getOutputFile());
154.180 - }
154.181 - mPrefs.putBoolean(PREF_OVERWRITE, isOverwrite());
154.182 - mPrefs.putInt(PREF_DEBUG_LEVEL, getDebugLevelIndex());
154.183 - mPrefs.flush();
154.184 - }
154.185 -
154.186 - private void updateComponents() {
154.187 - if (!jRadioButtonEncode.isSelected()) {
154.188 - jLabelXMLSourceFile.setEnabled(false);
154.189 - jTextFieldXMLSourceFile.setEnabled(false);
154.190 - jButtonBrowseXMLSourceFile.setEnabled(false);
154.191 - jLabelResultCoding.setEnabled(false);
154.192 - jComboBoxResultCoding.setEnabled(false);
154.193 - jCheckBoxToString.setEnabled(false);
154.194 - } else {
154.195 - jLabelXMLSourceFile.setEnabled(true);
154.196 - jTextFieldXMLSourceFile.setEnabled(true);
154.197 - jButtonBrowseXMLSourceFile.setEnabled(true);
154.198 - jLabelResultCoding.setEnabled(true);
154.199 - jComboBoxResultCoding.setEnabled(true);
154.200 - jCheckBoxToString.setEnabled(true);
154.201 - }
154.202 -
154.203 - if (!jRadioButtonDecode.isSelected()) {
154.204 - jLabelDataFile.setEnabled(false);
154.205 - jTextFieldDataFile.setEnabled(false);
154.206 - jButtonBrowseDataFile.setEnabled(false);
154.207 - jLabelSourceCoding.setEnabled(false);
154.208 - jComboBoxSourceCoding.setEnabled(false);
154.209 - jCheckBoxFromString.setEnabled(false);
154.210 - } else {
154.211 - jLabelDataFile.setEnabled(true);
154.212 - jTextFieldDataFile.setEnabled(true);
154.213 - jButtonBrowseDataFile.setEnabled(true);
154.214 - jLabelSourceCoding.setEnabled(true);
154.215 - jComboBoxSourceCoding.setEnabled(true);
154.216 - jCheckBoxFromString.setEnabled(true);
154.217 - }
154.218 -
154.219 - updateCreatedFolder();
154.220 - }
154.221 -
154.222 - private boolean sameAsPreviousLaunch() {
154.223 - String prefXsdFile = mPrefs.get(PREF_XSD_FILE, null);
154.224 - if (prefXsdFile == null) {
154.225 - return false;
154.226 - }
154.227 - return new File(xsdFilePath).equals(new File(prefXsdFile));
154.228 - }
154.229 -
154.230 - public String getOutputFileName() {
154.231 - return jTextFieldFileName.getText();
154.232 - }
154.233 -
154.234 - /**
154.235 - * Gets the generated output file in full path.
154.236 - *
154.237 - * @return output file path
154.238 - */
154.239 - public String getOutputFile() {
154.240 - return jTextFieldCreatedFile.getText();
154.241 - }
154.242 -
154.243 - /**
154.244 - * Gets the action type. ie. either encode or decode.
154.245 - *
154.246 - * @return action string
154.247 - */
154.248 - public String getActionType() {
154.249 - return jRadioButtonEncode.isSelected() ? EncoderTestPerformerImpl.ENCODE : EncoderTestPerformerImpl.DECODE;
154.250 - }
154.251 -
154.252 -
154.253 - /**
154.254 - * Gets the process file. For encode, it will be an xml file;
154.255 - * for decode, it will be any data file with the decoded string.
154.256 - *
154.257 - * @return process file full path
154.258 - */
154.259 - public String getProcessFile() {
154.260 - if (this.getActionType().equals(EncoderTestPerformerImpl.ENCODE)) {
154.261 - return jTextFieldXMLSourceFile.getText();
154.262 - } else {
154.263 - return jTextFieldDataFile.getText();
154.264 - }
154.265 - }
154.266 -
154.267 - /**
154.268 - * Overwrites the output file?
154.269 - */
154.270 - public boolean isOverwrite() {
154.271 - return jCheckBoxOverwriteOutput.isSelected();
154.272 - }
154.273 -
154.274 - /**
154.275 - * Is encoding to string?
154.276 - */
154.277 - public boolean isToString() {
154.278 - return jCheckBoxToString.isSelected();
154.279 - }
154.280 -
154.281 - /**
154.282 - * Is decoding from string?
154.283 - */
154.284 - public boolean isFromString() {
154.285 - return jCheckBoxFromString.isSelected();
154.286 - }
154.287 -
154.288 - /**
154.289 - * Gets the pre-decoding coding.
154.290 - */
154.291 - public String getPredecodeCoding() {
154.292 - Object obj = jComboBoxSourceCoding.getEditor().getItem();
154.293 - return obj == null ? "" : obj.toString(); //NOI18N
154.294 - }
154.295 -
154.296 - /**
154.297 - * Gets the post-encoding coding.
154.298 - */
154.299 - public String getPostencodeCoding() {
154.300 - Object obj = jComboBoxResultCoding.getEditor().getItem();
154.301 - return obj == null ? "" : obj.toString(); //NOI18N
154.302 - }
154.303 -
154.304 - /**
154.305 - * Returns the debug level selection index starting from 0.
154.306 - * @return the debug level selection index starting from 0.
154.307 - */
154.308 - public int getDebugLevelIndex() {
154.309 - return jComboBoxVerboseLevel.getSelectedIndex();
154.310 - }
154.311 -
154.312 - /**
154.313 - * Returns the debug level string.
154.314 - * @return the debug level string.
154.315 - */
154.316 - public String getDebugLevel() {
154.317 - return jComboBoxVerboseLevel.getSelectedItem().toString();
154.318 - }
154.319 -
154.320 - /** This method is called from within the constructor to
154.321 - * initialize the form.
154.322 - * WARNING: Do NOT modify this code. The content of this method is
154.323 - * always regenerated by the Form Editor.
154.324 - */
154.325 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
154.326 - private void initComponents() {
154.327 -
154.328 - buttonGroup1 = new javax.swing.ButtonGroup();
154.329 - jLabelXSDFile = new javax.swing.JLabel();
154.330 - jTextFieldXSDFile = new javax.swing.JTextField();
154.331 - jRadioButtonEncode = new javax.swing.JRadioButton();
154.332 - jRadioButtonDecode = new javax.swing.JRadioButton();
154.333 - jTextFieldXMLSourceFile = new javax.swing.JTextField();
154.334 - jTextFieldDataFile = new javax.swing.JTextField();
154.335 - jLabelFileName = new javax.swing.JLabel();
154.336 - jTextFieldFileName = new javax.swing.JTextField();
154.337 - jCheckBoxOverwriteOutput = new javax.swing.JCheckBox();
154.338 - jButtonBrowseXMLSourceFile = new javax.swing.JButton();
154.339 - jButtonBrowseDataFile = new javax.swing.JButton();
154.340 - jLabelDataFile = new javax.swing.JLabel();
154.341 - jLabelXMLSourceFile = new javax.swing.JLabel();
154.342 - jLabelFolder = new javax.swing.JLabel();
154.343 - jTextFieldFolder = new javax.swing.JTextField();
154.344 - jButtonBrowseFolder = new javax.swing.JButton();
154.345 - jLabelCreatedFile = new javax.swing.JLabel();
154.346 - jTextFieldCreatedFile = new javax.swing.JTextField();
154.347 - jComboBoxSelectElement = new javax.swing.JComboBox();
154.348 - jLabelSelectAnElement = new javax.swing.JLabel();
154.349 - jCheckBoxToString = new javax.swing.JCheckBox();
154.350 - jLabelResultCoding = new javax.swing.JLabel();
154.351 - jComboBoxResultCoding = new javax.swing.JComboBox();
154.352 - jCheckBoxFromString = new javax.swing.JCheckBox();
154.353 - jLabelSourceCoding = new javax.swing.JLabel();
154.354 - jComboBoxSourceCoding = new javax.swing.JComboBox();
154.355 - jSeparatorMeta = new javax.swing.JSeparator();
154.356 - jSeparatorDecodeEncode = new javax.swing.JSeparator();
154.357 - jSeparatorInputOutput = new javax.swing.JSeparator();
154.358 - jSeparatorDebug = new javax.swing.JSeparator();
154.359 - jLabelVerboseLevel = new javax.swing.JLabel();
154.360 - jComboBoxVerboseLevel = new javax.swing.JComboBox();
154.361 - jLabelMeta = new javax.swing.JLabel();
154.362 - jLabelInput = new javax.swing.JLabel();
154.363 - jLabelOutput = new javax.swing.JLabel();
154.364 - jLabelDebug = new javax.swing.JLabel();
154.365 -
154.366 - setFocusTraversalPolicy(null);
154.367 -
154.368 - jLabelXSDFile.setLabelFor(jTextFieldXSDFile);
154.369 - java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/tester/impl/Bundle"); // NOI18N
154.370 - jLabelXSDFile.setText(bundle.getString("test_panel.lbl.xsd_file")); // NOI18N
154.371 -
154.372 - jTextFieldXSDFile.setBackground(new java.awt.Color(240, 240, 240));
154.373 - jTextFieldXSDFile.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.xsd_file.description")); // NOI18N
154.374 - jTextFieldXSDFile.setPreferredSize(new java.awt.Dimension(94, 19));
154.375 -
154.376 - org.openide.awt.Mnemonics.setLocalizedText(jRadioButtonEncode, bundle.getString("test_panel.lbl.encode")); // NOI18N
154.377 - jRadioButtonEncode.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.encode.description")); // NOI18N
154.378 - jRadioButtonEncode.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
154.379 - jRadioButtonEncode.setMargin(new java.awt.Insets(0, 0, 0, 0));
154.380 - jRadioButtonEncode.addActionListener(new java.awt.event.ActionListener() {
154.381 - public void actionPerformed(java.awt.event.ActionEvent evt) {
154.382 - jRadioButtonEncodeActionPerformed(evt);
154.383 - }
154.384 - });
154.385 -
154.386 - org.openide.awt.Mnemonics.setLocalizedText(jRadioButtonDecode, org.openide.util.NbBundle.getBundle(TesterPanel.class).getString("test_panel.lbl.decode")); // NOI18N
154.387 - jRadioButtonDecode.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.decode.description")); // NOI18N
154.388 - jRadioButtonDecode.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
154.389 - jRadioButtonDecode.setMargin(new java.awt.Insets(0, 0, 0, 0));
154.390 - jRadioButtonDecode.addActionListener(new java.awt.event.ActionListener() {
154.391 - public void actionPerformed(java.awt.event.ActionEvent evt) {
154.392 - jRadioButtonDecodeActionPerformed(evt);
154.393 - }
154.394 - });
154.395 -
154.396 - jTextFieldXMLSourceFile.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.xml_source_file.description")); // NOI18N
154.397 -
154.398 - jTextFieldDataFile.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.data_file.description")); // NOI18N
154.399 -
154.400 - jLabelFileName.setLabelFor(jTextFieldFileName);
154.401 - org.openide.awt.Mnemonics.setLocalizedText(jLabelFileName, bundle.getString("test_panel.lbl.output_file_name")); // NOI18N
154.402 -
154.403 - jTextFieldFileName.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_file_name.description")); // NOI18N
154.404 -
154.405 - org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxOverwriteOutput, bundle.getString("test_panel.lbl.overwrite_output")); // NOI18N
154.406 - jCheckBoxOverwriteOutput.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.overwrite_output.description")); // NOI18N
154.407 - jCheckBoxOverwriteOutput.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
154.408 - jCheckBoxOverwriteOutput.setMargin(new java.awt.Insets(0, 0, 0, 0));
154.409 -
154.410 - org.openide.awt.Mnemonics.setLocalizedText(jButtonBrowseXMLSourceFile, bundle.getString("test_panel.lbl.browse2")); // NOI18N
154.411 - jButtonBrowseXMLSourceFile.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_xml_source_file.browse.description")); // NOI18N
154.412 - jButtonBrowseXMLSourceFile.addActionListener(new java.awt.event.ActionListener() {
154.413 - public void actionPerformed(java.awt.event.ActionEvent evt) {
154.414 - jButtonBrowseXMLSourceFileActionPerformed(evt);
154.415 - }
154.416 - });
154.417 -
154.418 - org.openide.awt.Mnemonics.setLocalizedText(jButtonBrowseDataFile, bundle.getString("test_panel.lbl.browse1")); // NOI18N
154.419 - jButtonBrowseDataFile.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_data_file.browse.description")); // NOI18N
154.420 - jButtonBrowseDataFile.addActionListener(new java.awt.event.ActionListener() {
154.421 - public void actionPerformed(java.awt.event.ActionEvent evt) {
154.422 - jButtonBrowseDataFileActionPerformed(evt);
154.423 - }
154.424 - });
154.425 -
154.426 - jLabelDataFile.setLabelFor(jTextFieldDataFile);
154.427 - org.openide.awt.Mnemonics.setLocalizedText(jLabelDataFile, bundle.getString("test_panel.lbl.input_data_file")); // NOI18N
154.428 -
154.429 - jLabelXMLSourceFile.setLabelFor(jTextFieldXMLSourceFile);
154.430 - org.openide.awt.Mnemonics.setLocalizedText(jLabelXMLSourceFile, bundle.getString("test_panel.lbl.xml_source")); // NOI18N
154.431 -
154.432 - jLabelFolder.setLabelFor(jTextFieldFolder);
154.433 - org.openide.awt.Mnemonics.setLocalizedText(jLabelFolder, bundle.getString("test_panel.lbl.output_folder")); // NOI18N
154.434 -
154.435 - jTextFieldFolder.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_folder.description")); // NOI18N
154.436 -
154.437 - org.openide.awt.Mnemonics.setLocalizedText(jButtonBrowseFolder, bundle.getString("test_panel.lbl.browse3")); // NOI18N
154.438 - jButtonBrowseFolder.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_folder.browse.description")); // NOI18N
154.439 - jButtonBrowseFolder.addActionListener(new java.awt.event.ActionListener() {
154.440 - public void actionPerformed(java.awt.event.ActionEvent evt) {
154.441 - jButtonBrowseFolderActionPerformed(evt);
154.442 - }
154.443 - });
154.444 -
154.445 - jLabelCreatedFile.setLabelFor(jTextFieldCreatedFile);
154.446 - jLabelCreatedFile.setText(bundle.getString("test_panel.lbl.created_file")); // NOI18N
154.447 -
154.448 - jTextFieldCreatedFile.setBackground(new java.awt.Color(240, 240, 240));
154.449 - jTextFieldCreatedFile.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.created_file.description")); // NOI18N
154.450 -
154.451 - jComboBoxSelectElement.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
154.452 - jComboBoxSelectElement.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.select_an_element.description")); // NOI18N
154.453 -
154.454 - jLabelSelectAnElement.setLabelFor(jComboBoxSelectElement);
154.455 - org.openide.awt.Mnemonics.setLocalizedText(jLabelSelectAnElement, bundle.getString("test_panel.lbl.select_an_element")); // NOI18N
154.456 -
154.457 - org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxToString, org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.to_string")); // NOI18N
154.458 - jCheckBoxToString.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.to_string.description")); // NOI18N
154.459 - jCheckBoxToString.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
154.460 - jCheckBoxToString.setMargin(new java.awt.Insets(0, 0, 0, 0));
154.461 -
154.462 - jLabelResultCoding.setLabelFor(jComboBoxResultCoding);
154.463 - org.openide.awt.Mnemonics.setLocalizedText(jLabelResultCoding, org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.result_coding")); // NOI18N
154.464 -
154.465 - jComboBoxResultCoding.setEditable(true);
154.466 - jComboBoxResultCoding.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
154.467 - jComboBoxResultCoding.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.result_coding.description")); // NOI18N
154.468 -
154.469 - org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxFromString, org.openide.util.NbBundle.getBundle(TesterPanel.class).getString("test_panel.lbl.from_string")); // NOI18N
154.470 - jCheckBoxFromString.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.from_string.description")); // NOI18N
154.471 - jCheckBoxFromString.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
154.472 - jCheckBoxFromString.setMargin(new java.awt.Insets(0, 0, 0, 0));
154.473 -
154.474 - jLabelSourceCoding.setLabelFor(jComboBoxSourceCoding);
154.475 - org.openide.awt.Mnemonics.setLocalizedText(jLabelSourceCoding, org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.source_coding")); // NOI18N
154.476 -
154.477 - jComboBoxSourceCoding.setEditable(true);
154.478 - jComboBoxSourceCoding.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
154.479 - jComboBoxSourceCoding.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.source_coding.description")); // NOI18N
154.480 -
154.481 - jLabelVerboseLevel.setLabelFor(jComboBoxVerboseLevel);
154.482 - org.openide.awt.Mnemonics.setLocalizedText(jLabelVerboseLevel, org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.verbose_level")); // NOI18N
154.483 -
154.484 - jComboBoxVerboseLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
154.485 - jComboBoxVerboseLevel.setToolTipText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.verbose_level.description")); // NOI18N
154.486 -
154.487 - jLabelMeta.setFont(new java.awt.Font("Tahoma", 0, 12));
154.488 - jLabelMeta.setLabelFor(jLabelMeta);
154.489 - jLabelMeta.setText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.meta_section")); // NOI18N
154.490 -
154.491 - jLabelInput.setFont(new java.awt.Font("Tahoma", 0, 12));
154.492 - jLabelInput.setLabelFor(jLabelInput);
154.493 - jLabelInput.setText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.input_section")); // NOI18N
154.494 -
154.495 - jLabelOutput.setFont(new java.awt.Font("Tahoma", 0, 12));
154.496 - jLabelOutput.setLabelFor(jLabelOutput);
154.497 - jLabelOutput.setText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.output_section")); // NOI18N
154.498 -
154.499 - jLabelDebug.setFont(new java.awt.Font("Tahoma", 0, 12));
154.500 - jLabelDebug.setLabelFor(jLabelDebug);
154.501 - jLabelDebug.setText(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.debug_section")); // NOI18N
154.502 -
154.503 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
154.504 - this.setLayout(layout);
154.505 - layout.setHorizontalGroup(
154.506 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.507 - .add(layout.createSequentialGroup()
154.508 - .addContainerGap()
154.509 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.510 - .add(jLabelDebug)
154.511 - .add(jLabelOutput, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
154.512 - .add(jLabelInput)
154.513 - .add(jLabelMeta))
154.514 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 6, Short.MAX_VALUE)
154.515 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.516 - .add(jRadioButtonEncode)
154.517 - .add(jLabelXMLSourceFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
154.518 - .add(jLabelResultCoding, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
154.519 - .add(jLabelFileName)
154.520 - .add(jLabelFolder)
154.521 - .add(jLabelVerboseLevel)
154.522 - .add(jLabelSourceCoding)
154.523 - .add(jLabelDataFile)
154.524 - .add(jRadioButtonDecode)
154.525 - .add(jLabelXSDFile)
154.526 - .add(jLabelSelectAnElement)
154.527 - .add(jLabelCreatedFile))
154.528 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.529 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.530 - .add(jComboBoxResultCoding, 0, 339, Short.MAX_VALUE)
154.531 - .add(jTextFieldXMLSourceFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
154.532 - .add(jCheckBoxToString)
154.533 - .add(jTextFieldFileName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
154.534 - .add(jTextFieldFolder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
154.535 - .add(jCheckBoxOverwriteOutput)
154.536 - .add(jTextFieldCreatedFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
154.537 - .add(jComboBoxSourceCoding, 0, 339, Short.MAX_VALUE)
154.538 - .add(jTextFieldDataFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
154.539 - .add(jCheckBoxFromString)
154.540 - .add(jTextFieldXSDFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
154.541 - .add(jComboBoxSelectElement, 0, 339, Short.MAX_VALUE)
154.542 - .add(jComboBoxVerboseLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 337, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
154.543 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.544 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
154.545 - .add(jButtonBrowseFolder)
154.546 - .add(jButtonBrowseXMLSourceFile)
154.547 - .add(jButtonBrowseDataFile))
154.548 - .addContainerGap(17, Short.MAX_VALUE))
154.549 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
154.550 - .addContainerGap()
154.551 - .add(jSeparatorDecodeEncode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 553, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
154.552 - .add(jSeparatorMeta, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
154.553 - .add(org.jdesktop.layout.GroupLayout.TRAILING, jSeparatorDebug, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
154.554 - .add(org.jdesktop.layout.GroupLayout.TRAILING, jSeparatorInputOutput, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
154.555 - );
154.556 - layout.setVerticalGroup(
154.557 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.558 - .add(layout.createSequentialGroup()
154.559 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.560 - .add(layout.createSequentialGroup()
154.561 - .add(82, 82, 82)
154.562 - .add(jLabelInput))
154.563 - .add(layout.createSequentialGroup()
154.564 - .add(6, 6, 6)
154.565 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.566 - .add(layout.createSequentialGroup()
154.567 - .add(9, 9, 9)
154.568 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.569 - .add(jLabelSelectAnElement)
154.570 - .add(jComboBoxSelectElement, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
154.571 - .add(8, 8, 8)
154.572 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.573 - .add(jLabelXSDFile)
154.574 - .add(jTextFieldXSDFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
154.575 - .add(jLabelMeta))
154.576 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.577 - .add(jSeparatorMeta, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.578 - .add(30, 30, 30)
154.579 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.580 - .add(jRadioButtonDecode)
154.581 - .add(jCheckBoxFromString))
154.582 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.583 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
154.584 - .add(jButtonBrowseDataFile)
154.585 - .add(jTextFieldDataFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.586 - .add(jLabelDataFile))
154.587 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.588 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.589 - .add(layout.createSequentialGroup()
154.590 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
154.591 - .add(jComboBoxSourceCoding, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.592 - .add(jLabelSourceCoding))
154.593 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.594 - .add(jSeparatorDecodeEncode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.595 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.596 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.597 - .add(jRadioButtonEncode)
154.598 - .add(jCheckBoxToString))
154.599 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.600 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
154.601 - .add(jLabelXMLSourceFile)
154.602 - .add(jTextFieldXMLSourceFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.603 - .add(jButtonBrowseXMLSourceFile))
154.604 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.605 - .add(jLabelResultCoding)
154.606 - .add(11, 11, 11)
154.607 - .add(jSeparatorInputOutput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.608 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.609 - .add(jLabelOutput)
154.610 - .add(11, 11, 11)
154.611 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.612 - .add(jLabelFileName)
154.613 - .add(jTextFieldFileName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
154.614 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.615 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
154.616 - .add(jButtonBrowseFolder)
154.617 - .add(jTextFieldFolder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.618 - .add(jLabelFolder))
154.619 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.620 - .add(jCheckBoxOverwriteOutput)
154.621 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154.622 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.623 - .add(jTextFieldCreatedFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.624 - .add(jLabelCreatedFile))
154.625 - .add(16, 16, 16)
154.626 - .add(jSeparatorDebug, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
154.627 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154.628 - .add(layout.createSequentialGroup()
154.629 - .add(5, 5, 5)
154.630 - .add(jLabelDebug))
154.631 - .add(layout.createSequentialGroup()
154.632 - .add(18, 18, 18)
154.633 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
154.634 - .add(jLabelVerboseLevel)
154.635 - .add(jComboBoxVerboseLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
154.636 - .add(layout.createSequentialGroup()
154.637 - .add(84, 84, 84)
154.638 - .add(jComboBoxResultCoding, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
154.639 - .addContainerGap(16, Short.MAX_VALUE))
154.640 - );
154.641 -
154.642 - jLabelXSDFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.xsd_file")); // NOI18N
154.643 - jLabelXSDFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.xsd_file")); // NOI18N
154.644 - jTextFieldXSDFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.xsd_file.name")); // NOI18N
154.645 - jTextFieldXSDFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.xsd_file.description")); // NOI18N
154.646 - jRadioButtonEncode.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.encode.name")); // NOI18N
154.647 - jRadioButtonEncode.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.encode.description")); // NOI18N
154.648 - jRadioButtonDecode.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.decode.name")); // NOI18N
154.649 - jRadioButtonDecode.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.decode.description")); // NOI18N
154.650 - jTextFieldXMLSourceFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.xml_source_file.name")); // NOI18N
154.651 - jTextFieldXMLSourceFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.xml_source_file.description")); // NOI18N
154.652 - jTextFieldDataFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_data_file.name")); // NOI18N
154.653 - jTextFieldDataFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.data_file.description")); // NOI18N
154.654 - jLabelFileName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.output_file_name")); // NOI18N
154.655 - jLabelFileName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.output_file_name")); // NOI18N
154.656 - jTextFieldFileName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panell.output_file_name.name")); // NOI18N
154.657 - jTextFieldFileName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_file_name.description")); // NOI18N
154.658 - jCheckBoxOverwriteOutput.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.overwrite_output.name")); // NOI18N
154.659 - jCheckBoxOverwriteOutput.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.overwrite_output.description")); // NOI18N
154.660 - jButtonBrowseXMLSourceFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_xml_source_file.browse.name")); // NOI18N
154.661 - jButtonBrowseXMLSourceFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_xml_source_file.browse.description")); // NOI18N
154.662 - jButtonBrowseDataFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_data_file.browse.name")); // NOI18N
154.663 - jButtonBrowseDataFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_data_file.browse.description")); // NOI18N
154.664 - jLabelDataFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.input_data_file")); // NOI18N
154.665 - jLabelDataFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.input_data_file")); // NOI18N
154.666 - jLabelXMLSourceFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.xml_source")); // NOI18N
154.667 - jLabelXMLSourceFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.xml_source")); // NOI18N
154.668 - jLabelFolder.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.output_folder")); // NOI18N
154.669 - jLabelFolder.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.output_folder")); // NOI18N
154.670 - jTextFieldFolder.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_folder.name")); // NOI18N
154.671 - jTextFieldFolder.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_folder.description")); // NOI18N
154.672 - jButtonBrowseFolder.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_folder.browse.name")); // NOI18N
154.673 - jButtonBrowseFolder.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_folder.browse.description")); // NOI18N
154.674 - jLabelCreatedFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.created_file")); // NOI18N
154.675 - jLabelCreatedFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.created_file")); // NOI18N
154.676 - jTextFieldCreatedFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.created_file.name")); // NOI18N
154.677 - jTextFieldCreatedFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.created_file.description")); // NOI18N
154.678 - jComboBoxSelectElement.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.select_an_element.name")); // NOI18N
154.679 - jComboBoxSelectElement.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.select_an_element.description")); // NOI18N
154.680 - jLabelSelectAnElement.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.select_an_element")); // NOI18N
154.681 - jLabelSelectAnElement.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.select_an_element")); // NOI18N
154.682 - jCheckBoxToString.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.to_string.name")); // NOI18N
154.683 - jCheckBoxToString.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.to_string.description")); // NOI18N
154.684 - jLabelResultCoding.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.result_coding")); // NOI18N
154.685 - jLabelResultCoding.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.result_coding")); // NOI18N
154.686 - jComboBoxResultCoding.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.result_coding.name")); // NOI18N
154.687 - jComboBoxResultCoding.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.result_coding.description")); // NOI18N
154.688 - jCheckBoxFromString.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.from_string.name")); // NOI18N
154.689 - jCheckBoxFromString.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.from_string.description")); // NOI18N
154.690 - jLabelSourceCoding.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.source_coding")); // NOI18N
154.691 - jLabelSourceCoding.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.source_coding")); // NOI18N
154.692 - jComboBoxSourceCoding.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.source_coding.name")); // NOI18N
154.693 - jComboBoxSourceCoding.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.source_coding.description")); // NOI18N
154.694 - jSeparatorMeta.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.meta")); // NOI18N
154.695 - jSeparatorMeta.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.meta")); // NOI18N
154.696 - jSeparatorDecodeEncode.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.decode_encode")); // NOI18N
154.697 - jSeparatorDecodeEncode.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.decode_encode")); // NOI18N
154.698 - jSeparatorInputOutput.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.input_output")); // NOI18N
154.699 - jSeparatorInputOutput.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.input_output")); // NOI18N
154.700 - jSeparatorDebug.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.debug")); // NOI18N
154.701 - jSeparatorDebug.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.separator.debug")); // NOI18N
154.702 - jLabelVerboseLevel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.verbose_level")); // NOI18N
154.703 - jLabelVerboseLevel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.lbl.verbose_level")); // NOI18N
154.704 - jComboBoxVerboseLevel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.verbose_level.name")); // NOI18N
154.705 - jComboBoxVerboseLevel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.verbose_level.description")); // NOI18N
154.706 - jLabelMeta.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.meta_section.description")); // NOI18N
154.707 - jLabelMeta.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.meta_section.description")); // NOI18N
154.708 - jLabelInput.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_section.description")); // NOI18N
154.709 - jLabelInput.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.input_section.description")); // NOI18N
154.710 - jLabelOutput.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_section.description")); // NOI18N
154.711 - jLabelOutput.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.output_section.description")); // NOI18N
154.712 - jLabelDebug.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.debug_section.description")); // NOI18N
154.713 - jLabelDebug.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.debug_section.description")); // NOI18N
154.714 -
154.715 - getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.name")); // NOI18N
154.716 - getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TesterPanel.class, "test_panel.description")); // NOI18N
154.717 - }// </editor-fold>//GEN-END:initComponents
154.718 -
154.719 - private void jButtonBrowseFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseFolderActionPerformed
154.720 - javax.swing.JFileChooser chooser = new javax.swing.JFileChooser();
154.721 - FileFilter fileFilter = new FileFilter() {
154.722 - public boolean accept(File file) {
154.723 - return file.isDirectory();
154.724 - }
154.725 -
154.726 - public String getDescription() {
154.727 - return _bundle.getString("test_panel.lbl.all_directories"); //NOI18N
154.728 - }
154.729 - };
154.730 - chooser.setFileFilter(fileFilter);
154.731 - String whereToLook;
154.732 - if (jTextFieldFolder.getText() != null && jTextFieldFolder.getText().length() != 0) {
154.733 - whereToLook = jTextFieldFolder.getText();
154.734 - } else {
154.735 - whereToLook = xsdFilePath;
154.736 - }
154.737 - chooser.setCurrentDirectory(new File(whereToLook));
154.738 - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
154.739 -
154.740 - File selectedFile = null;
154.741 - if ( chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION ) {
154.742 - selectedFile = chooser.getSelectedFile();
154.743 - }
154.744 - if (selectedFile != null) {
154.745 - this.jTextFieldFolder.setText(selectedFile.getAbsolutePath());
154.746 - updateCreatedFolder();
154.747 - }
154.748 -}//GEN-LAST:event_jButtonBrowseFolderActionPerformed
154.749 -
154.750 - private void jButtonBrowseDataFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseDataFileActionPerformed
154.751 - String whereToLook;
154.752 - if (jTextFieldDataFile.getText() != null && jTextFieldDataFile.getText().length() != 0) {
154.753 - whereToLook = jTextFieldDataFile.getText();
154.754 - } else {
154.755 - whereToLook = mPrefs.get(PREF_INPUT, xsdFilePath);
154.756 - }
154.757 - File selectedFile = this.getFileFromChooser(whereToLook, null);
154.758 - if (selectedFile == null) {
154.759 - return;
154.760 - }
154.761 - if (!selectedFile.exists()) {
154.762 - NotifyDescriptor desc = new NotifyDescriptor.Message(
154.763 - _bundle.getString("test_panel.lbl.file_does_not_exist"), //NOI18N
154.764 - NotifyDescriptor.ERROR_MESSAGE);
154.765 - DialogDisplayer.getDefault().notify(desc);
154.766 - return;
154.767 - }
154.768 - jTextFieldDataFile.setText(selectedFile.getAbsolutePath());
154.769 - if (jTextFieldFileName.getText() == null || jTextFieldFileName.getText().length() == 0) {
154.770 - String name = selectedFile.getName();
154.771 - name = name.indexOf('.') >= 0 ?
154.772 - name.substring(0, name.indexOf('.')) : name;
154.773 - jTextFieldFileName.setText(name);
154.774 - }
154.775 -}//GEN-LAST:event_jButtonBrowseDataFileActionPerformed
154.776 -
154.777 - private void jButtonBrowseXMLSourceFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseXMLSourceFileActionPerformed
154.778 -
154.779 - String whereToLook;
154.780 - if (jTextFieldXMLSourceFile.getText() != null && jTextFieldXMLSourceFile.getText().length() != 0) {
154.781 - whereToLook = jTextFieldXMLSourceFile.getText();
154.782 - } else {
154.783 - whereToLook = mPrefs.get(PREF_INPUT, xsdFilePath);
154.784 - }
154.785 - File selectedFile = this.getFileFromChooser(whereToLook, new String[][] {
154.786 - {"xml", _bundle.getString("test_panel.lbl.xml_files") + " (*.xml)"} //NOI18N
154.787 - });
154.788 - if (selectedFile == null) {
154.789 - return;
154.790 - }
154.791 - if (!selectedFile.exists()) {
154.792 - NotifyDescriptor desc = new NotifyDescriptor.Message(
154.793 - _bundle.getString("test_panel.lbl.xml_file_does_not_exist"), //NOI18N
154.794 - NotifyDescriptor.ERROR_MESSAGE);
154.795 - DialogDisplayer.getDefault().notify(desc);
154.796 - return;
154.797 - }
154.798 - jTextFieldXMLSourceFile.setText(selectedFile.getAbsolutePath());
154.799 - if (jTextFieldFileName.getText() == null || jTextFieldFileName.getText().length() == 0) {
154.800 - String name = selectedFile.getName();
154.801 - name = name.indexOf('.') >= 0 ?
154.802 - name.substring(0, name.indexOf('.')) : name;
154.803 - jTextFieldFileName.setText(name);
154.804 - }
154.805 -}//GEN-LAST:event_jButtonBrowseXMLSourceFileActionPerformed
154.806 -
154.807 - private void jRadioButtonDecodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonDecodeActionPerformed
154.808 - updateComponents();
154.809 -}//GEN-LAST:event_jRadioButtonDecodeActionPerformed
154.810 -
154.811 - private void jRadioButtonEncodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonEncodeActionPerformed
154.812 - updateComponents();
154.813 -}//GEN-LAST:event_jRadioButtonEncodeActionPerformed
154.814 -
154.815 - /** Open the file chooser and return the file.
154.816 - *@param oldUrl url where to start browsing
154.817 - */
154.818 - private File getFileFromChooser(String oldUrl, final String[][] extensions) {
154.819 - javax.swing.JFileChooser chooser = new javax.swing.JFileChooser();
154.820 -
154.821 - if (extensions != null) {
154.822 - FileFilter filter = new FileFilter() {
154.823 - public boolean accept(File f) {
154.824 - if (f.isDirectory()) {
154.825 - return true;
154.826 - }
154.827 -
154.828 - String extension = FileUtil.getExtension(f.getAbsolutePath());
154.829 - //String extension = getExtension(f);
154.830 - if (extension != null) {
154.831 - int size = extensions.length;
154.832 - for (int i = 0; i < size; i++) {
154.833 - if (extensions[i][0].equals(extension)) {
154.834 - return true;
154.835 - }
154.836 - }
154.837 - }
154.838 - return false;
154.839 - }
154.840 -
154.841 - public String getDescription() {
154.842 - if (extensions == null) {
154.843 - return ""; //NOI18N
154.844 - }
154.845 - StringBuffer desc = new StringBuffer();
154.846 - for (int i = 0; i < extensions.length; i++) {
154.847 - if (i > 0) {
154.848 - desc.append(", "); //NOI18N
154.849 - }
154.850 - desc.append(extensions[i][1]);
154.851 - }
154.852 - return desc.toString();
154.853 - }
154.854 - };
154.855 - chooser.setFileFilter(filter);
154.856 - }
154.857 -
154.858 - if (oldUrl!=null) {
154.859 - try {
154.860 - File file = new File(oldUrl);
154.861 - File parentDir = file.getParentFile();
154.862 - if (parentDir!=null && parentDir.exists()) {
154.863 - chooser.setCurrentDirectory(parentDir);
154.864 - }
154.865 - } catch (java.lang.IllegalArgumentException x) {
154.866 - //Ignore
154.867 - }
154.868 - }
154.869 - File selectedFile=null;
154.870 - if ( chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION ) {
154.871 - selectedFile = chooser.getSelectedFile();
154.872 - }
154.873 - return selectedFile;
154.874 - }
154.875 -
154.876 - /*
154.877 - * Get the extension of a file.
154.878 - */
154.879 - public static String getExtension(File f) {
154.880 - String ext = null;
154.881 - String s = f.getName();
154.882 - int i = s.lastIndexOf('.');
154.883 -
154.884 - if (i > 0 && i < s.length() - 1) {
154.885 - ext = s.substring(i+1).toLowerCase();
154.886 - }
154.887 - return ext;
154.888 - }
154.889 -
154.890 - private void updateCreatedFolder() {
154.891 - String expectedExtension = ""; //NOI18N
154.892 - if (getActionType().equals(EncoderTestPerformerImpl.DECODE)) {
154.893 - expectedExtension = ".xml"; //NOI18N
154.894 - } else if (getActionType().equals(EncoderTestPerformerImpl.ENCODE)) {
154.895 - expectedExtension = ".out"; //NOI18N
154.896 - }
154.897 - String folderName = jTextFieldFolder.getText().trim();
154.898 - String outputName = jTextFieldFileName.getText().trim();
154.899 -
154.900 - File f = new File(xsdFilePath);
154.901 - String createdFileName = folderName +
154.902 - ( folderName.endsWith("/") || folderName.endsWith( File.separator ) || folderName.length() == 0 ? "" : "/" ) + // NOI18N
154.903 - outputName + expectedExtension;
154.904 -
154.905 - jTextFieldCreatedFile.setText( createdFileName.replace( '/', File.separatorChar ) ); // NOI18N
154.906 - }
154.907 -
154.908 - public void insertUpdate(DocumentEvent e) {
154.909 - updateCreatedFolder();
154.910 - }
154.911 -
154.912 - public void removeUpdate(DocumentEvent e) {
154.913 - updateCreatedFolder();
154.914 - }
154.915 -
154.916 - public void changedUpdate(DocumentEvent e) {
154.917 - updateCreatedFolder();
154.918 - }
154.919 -
154.920 - public void setTopElementDecls(QName[] elements, QName select) {
154.921 - if (select == null && sameAsPreviousLaunch()) {
154.922 - String topElem = mPrefs.get(PREF_TOP_ELEM, null);
154.923 - if (topElem != null) {
154.924 - select = QName.valueOf(topElem);
154.925 - }
154.926 - }
154.927 - jComboBoxSelectElement.removeAllItems();
154.928 - DisplayQName selectDispQName = null;
154.929 - DisplayQName dispQName;
154.930 - for (int i = 0; i < elements.length; i++) {
154.931 - dispQName = new DisplayQName(elements[i]);
154.932 - if (elements[i].equals(select)) {
154.933 - selectDispQName = dispQName;
154.934 - }
154.935 - jComboBoxSelectElement.addItem(dispQName);
154.936 - }
154.937 - if (selectDispQName != null) {
154.938 - jComboBoxSelectElement.setSelectedItem(selectDispQName);
154.939 - }
154.940 - }
154.941 -
154.942 - public QName getSelectedTopElementDecl() {
154.943 - DisplayQName dispQName = (DisplayQName) jComboBoxSelectElement.getSelectedItem();
154.944 - if (dispQName == null) {
154.945 - return null;
154.946 - }
154.947 - return dispQName.getQName();
154.948 - }
154.949 -
154.950 - @Override
154.951 - public boolean contains(int x, int y) {
154.952 - return true;
154.953 - }
154.954 -
154.955 - /**
154.956 - * Used for displaying qualified name using local part.
154.957 - */
154.958 - private static class DisplayQName {
154.959 -
154.960 - private final QName mQName;
154.961 -
154.962 - public DisplayQName(QName qName) {
154.963 - mQName = qName;
154.964 - }
154.965 -
154.966 - public QName getQName() {
154.967 - return mQName;
154.968 - }
154.969 -
154.970 - @Override
154.971 - public String toString() {
154.972 - return mQName.getLocalPart();
154.973 - }
154.974 - }
154.975 -
154.976 - // Variables declaration - do not modify//GEN-BEGIN:variables
154.977 - private javax.swing.ButtonGroup buttonGroup1;
154.978 - private javax.swing.JButton jButtonBrowseDataFile;
154.979 - private javax.swing.JButton jButtonBrowseFolder;
154.980 - private javax.swing.JButton jButtonBrowseXMLSourceFile;
154.981 - private javax.swing.JCheckBox jCheckBoxFromString;
154.982 - private javax.swing.JCheckBox jCheckBoxOverwriteOutput;
154.983 - private javax.swing.JCheckBox jCheckBoxToString;
154.984 - private javax.swing.JComboBox jComboBoxResultCoding;
154.985 - private javax.swing.JComboBox jComboBoxSelectElement;
154.986 - private javax.swing.JComboBox jComboBoxSourceCoding;
154.987 - private javax.swing.JComboBox jComboBoxVerboseLevel;
154.988 - private javax.swing.JLabel jLabelCreatedFile;
154.989 - private javax.swing.JLabel jLabelDataFile;
154.990 - private javax.swing.JLabel jLabelDebug;
154.991 - private javax.swing.JLabel jLabelFileName;
154.992 - private javax.swing.JLabel jLabelFolder;
154.993 - private javax.swing.JLabel jLabelInput;
154.994 - private javax.swing.JLabel jLabelMeta;
154.995 - private javax.swing.JLabel jLabelOutput;
154.996 - private javax.swing.JLabel jLabelResultCoding;
154.997 - private javax.swing.JLabel jLabelSelectAnElement;
154.998 - private javax.swing.JLabel jLabelSourceCoding;
154.999 - private javax.swing.JLabel jLabelVerboseLevel;
154.1000 - private javax.swing.JLabel jLabelXMLSourceFile;
154.1001 - private javax.swing.JLabel jLabelXSDFile;
154.1002 - private javax.swing.JRadioButton jRadioButtonDecode;
154.1003 - private javax.swing.JRadioButton jRadioButtonEncode;
154.1004 - private javax.swing.JSeparator jSeparatorDebug;
154.1005 - private javax.swing.JSeparator jSeparatorDecodeEncode;
154.1006 - private javax.swing.JSeparator jSeparatorInputOutput;
154.1007 - private javax.swing.JSeparator jSeparatorMeta;
154.1008 - private javax.swing.JTextField jTextFieldCreatedFile;
154.1009 - private javax.swing.JTextField jTextFieldDataFile;
154.1010 - private javax.swing.JTextField jTextFieldFileName;
154.1011 - private javax.swing.JTextField jTextFieldFolder;
154.1012 - private javax.swing.JTextField jTextFieldXMLSourceFile;
154.1013 - private javax.swing.JTextField jTextFieldXSDFile;
154.1014 - // End of variables declaration//GEN-END:variables
154.1015 -
154.1016 -}
155.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/impl/TesterUtil.java Sat Sep 27 15:34:52 2008 -0700
155.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
155.3 @@ -1,84 +0,0 @@
155.4 -/*
155.5 - * The contents of this file are subject to the terms of the Common Development
155.6 - * and Distribution License (the License). You may not use this file except in
155.7 - * compliance with the License.
155.8 - *
155.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
155.10 - * or http://www.netbeans.org/cddl.txt.
155.11 -
155.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
155.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
155.14 - * If applicable, add the following below the CDDL Header, with the fields
155.15 - * enclosed by brackets [] replaced by your own identifying information:
155.16 - * "Portions Copyrighted [year] [name of copyright owner]"
155.17 - *
155.18 - * The Original Software is NetBeans. The Initial Developer of the Original
155.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
155.20 - * Microsystems, Inc. All Rights Reserved.
155.21 - */
155.22 -
155.23 -package org.netbeans.modules.encoder.ui.tester.impl;
155.24 -
155.25 -import java.io.File;
155.26 -import java.io.FileInputStream;
155.27 -import java.io.FileOutputStream;
155.28 -import java.io.IOException;
155.29 -import java.io.InputStream;
155.30 -import java.io.OutputStream;
155.31 -import javax.xml.parsers.DocumentBuilder;
155.32 -import javax.xml.parsers.DocumentBuilderFactory;
155.33 -import javax.xml.parsers.ParserConfigurationException;
155.34 -import org.w3c.dom.Document;
155.35 -import org.xml.sax.SAXException;
155.36 -
155.37 -/**
155.38 - * Encoder tester utility class
155.39 - *
155.40 - * @author Cannis Meng
155.41 - */
155.42 -public class TesterUtil {
155.43 -
155.44 - /**
155.45 - * Loads a byte array from a file
155.46 - */
155.47 - public static byte[] loadBytes(File binFile) throws IOException {
155.48 - byte[] bytes = new byte[(int) binFile.length()];
155.49 - InputStream is = null;
155.50 - try {
155.51 - is = new FileInputStream(binFile);
155.52 - is.read(bytes);
155.53 - } finally {
155.54 - if (is != null) {
155.55 - is.close();
155.56 - }
155.57 - }
155.58 - return bytes;
155.59 - }
155.60 -
155.61 - /**
155.62 - * Writes a byte array to a file
155.63 - */
155.64 - public static void writeBytes(byte[] bytes, File binFile) throws IOException {
155.65 - OutputStream os = null;
155.66 - try {
155.67 - os = new FileOutputStream(binFile);
155.68 - os.write(bytes);
155.69 - } finally {
155.70 - if (os != null) {
155.71 - os.close();
155.72 - }
155.73 - }
155.74 - }
155.75 -
155.76 - /**
155.77 - * Loads a DOM document from a file
155.78 - */
155.79 - public static Document loadDocument(File docFile)
155.80 - throws ParserConfigurationException, SAXException, IOException {
155.81 - DocumentBuilderFactory domFactory
155.82 - = DocumentBuilderFactory.newInstance();
155.83 - domFactory.setNamespaceAware(true);
155.84 - DocumentBuilder builder = domFactory.newDocumentBuilder();
155.85 - return builder.parse(docFile);
155.86 - }
155.87 -}
156.1 --- a/encoder.ui.tester/src/org/netbeans/modules/encoder/ui/tester/layer.xml Sat Sep 27 15:34:52 2008 -0700
156.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
156.3 @@ -1,19 +0,0 @@
156.4 -<?xml version="1.0" encoding="UTF-8"?>
156.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
156.6 -<filesystem>
156.7 - <folder name="Loaders">
156.8 - <folder name="text">
156.9 - <folder name="x-schema+xml">
156.10 - <folder name="Actions">
156.11 - <folder name="encoding">
156.12 - <file name="test-enc.instance">
156.13 - <attr name="instanceClass" stringvalue="org.netbeans.modules.encoder.ui.tester.action.TestEncodingAction"/>
156.14 - </file>
156.15 - <attr name="rmv-enc.instance/test-enc.instance" boolvalue="true"/>
156.16 - </folder>
156.17 - </folder>
156.18 - </folder>
156.19 - </folder>
156.20 - </folder>
156.21 -</filesystem>
156.22 -