[NETBEANS-1867] Asciidoc cleanup for numbered lists and sections (#443)
* Numbered lists
* cnd and javaee
* websvc and java
* webclient
* ide
* about/community/participate
diff --git a/netbeans.apache.org/src/content/about/history.asciidoc b/netbeans.apache.org/src/content/about/history.asciidoc
index 3aab839..3eebe2d 100644
--- a/netbeans.apache.org/src/content/about/history.asciidoc
+++ b/netbeans.apache.org/src/content/about/history.asciidoc
@@ -33,7 +33,9 @@
Development Environment) in Java.
Xelfi was the first Java IDE written in Java, with its first pre-releases in
-1997. Xelfi was a fun project to work on, especially since the Java IDE space
+
+[start=1997]
+. Xelfi was a fun project to work on, especially since the Java IDE space
was uncharted territory at that time.
image::nb-history-1.png[caption="", title="Here you see the original group of students who constituted the original NetBeans Team"]
diff --git a/netbeans.apache.org/src/content/about/index.asciidoc b/netbeans.apache.org/src/content/about/index.asciidoc
index 0f9084d..a10b432 100644
--- a/netbeans.apache.org/src/content/about/index.asciidoc
+++ b/netbeans.apache.org/src/content/about/index.asciidoc
@@ -79,7 +79,7 @@
keyboard shortcuts; window management, and so on.
[.feature]
---
+---
image::gephi-metrics-small.png[role="left", link="gephi-metrics.png"]
---
diff --git a/netbeans.apache.org/src/content/community/mailing-lists.asciidoc b/netbeans.apache.org/src/content/community/mailing-lists.asciidoc
index 8ef9e14..5f515ab 100644
--- a/netbeans.apache.org/src/content/community/mailing-lists.asciidoc
+++ b/netbeans.apache.org/src/content/community/mailing-lists.asciidoc
@@ -35,7 +35,7 @@
[[users]]
-=== Users list
+== Users list
Use this list to ask questions about the usage of the NetBeans IDE, whether
for Java, JavaScript, C/C++, or any other language or technology, whether as user of NetBeans IDE or developer on top of the NetBeans Platform.
@@ -51,7 +51,7 @@
- +++ <a href="https://lists.apache.org/list.html?users@netbeans.apache.org">Pony mail archive</a> +++
[[dev]]
-=== Dev list
+== Dev list
Specifically for those committed to working on the development of Apache
NetBeans itself, as well as those committed to promoting and documenting it,
@@ -64,7 +64,7 @@
- +++ <a href="https://lists.apache.org/list.html?dev@netbeans.apache.org">Pony mail archive</a> +++
[[netcat]]
-=== NetCAT list
+== NetCAT list
Specifically for those involved in the NetBeans Community Acceptance Testing (NetCAT) program.
@@ -75,7 +75,7 @@
- +++ <a href="https://lists.apache.org/list.html?netcat@netbeans.apache.org">Pony mail archive</a> +++
[[announce]]
-=== Announce list
+== Announce list
Receive announcements only, e.g., when a new release is made available, i.e.,
for those who do not want to get much traffic though want to keep up with the
@@ -88,7 +88,7 @@
- link:http://mail-archives.apache.org/mod_mbox/netbeans-announce/[See the Apache mailing list archive]
[[commits]]
-=== Commits list
+== Commits list
Receive GitHub commit messages whenever a commit is done.
@@ -99,7 +99,7 @@
- +++ <a href="https://lists.apache.org/list.html?commits@netbeans.apache.org">Pony mail archive</a> +++
[[notifications]]
-=== Notifications list
+== Notifications list
Receive GitHub notifications whenever someone adds a comment to an issue and whenever a new pull request is opened or closed.
diff --git a/netbeans.apache.org/src/content/download/index.asciidoc b/netbeans.apache.org/src/content/download/index.asciidoc
old mode 100755
new mode 100644
diff --git a/netbeans.apache.org/src/content/download/nb100/index.asciidoc b/netbeans.apache.org/src/content/download/nb100/index.asciidoc
old mode 100755
new mode 100644
diff --git a/netbeans.apache.org/src/content/download/nb111/nb111.asciidoc b/netbeans.apache.org/src/content/download/nb111/nb111.asciidoc
index 5a43d87..0c04754 100644
--- a/netbeans.apache.org/src/content/download/nb111/nb111.asciidoc
+++ b/netbeans.apache.org/src/content/download/nb111/nb111.asciidoc
@@ -91,7 +91,9 @@
1. Unzip link:https://archive.apache.org/dist/netbeans/netbeans/11.1/netbeans-11.1-source.zip[netbeans-11.1-source.zip]
in a directory of your liking.
-2. `cd` to that directory, and then run `ant` to build the Apache NetBeans IDE.
+
+[start=2]
+. `cd` to that directory, and then run `ant` to build the Apache NetBeans IDE.
Once built you can run the IDE by typing `./nbbuild/netbeans/bin/netbeans`
== Community approval
diff --git a/netbeans.apache.org/src/content/download/nb112/nb112.asciidoc b/netbeans.apache.org/src/content/download/nb112/nb112.asciidoc
index d56fed7..73e407f 100644
--- a/netbeans.apache.org/src/content/download/nb112/nb112.asciidoc
+++ b/netbeans.apache.org/src/content/download/nb112/nb112.asciidoc
@@ -88,9 +88,15 @@
1. Unzip link:https://www.apache.org/dyn/closer.cgi/netbeans/netbeans/11.2/netbeans-11.2-source.zip[netbeans-11.2-source.zip]
in a directory of your liking.
-2. `cd` to that directory, and then run `ant build` to build the Apache NetBeans IDE.
-3. A zip of the IDE will be built inside `nbbuild`. Unzip this in a place of your choosing.
-4. Inside the unzipped IDE run `./bin/netbeans` (Linux / macOS) or `./bin/netbeans.exe` (Windows).
+
+[start=2]
+. `cd` to that directory, and then run `ant build` to build the Apache NetBeans IDE.
+
+[start=3]
+. A zip of the IDE will be built inside `nbbuild`. Unzip this in a place of your choosing.
+
+[start=4]
+. Inside the unzipped IDE run `./bin/netbeans` (Linux / macOS) or `./bin/netbeans.exe` (Windows).
== Community approval
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos.asciidoc
index ecaa451..9e36b08 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos.asciidoc
@@ -37,27 +37,6 @@
Note that the tips in this article mostly apply to projects from existing source or from an existing binary. For projects that are created and managed by the IDE code assistance configuration is not necessary.
-=== Contents
-
-image::images/netbeans-stamp-80-74-73.png[title="Content on this page applies to the NetBeans IDE 8.0/7.4/7.3"]
-
-|===
-|- |<<questionmark,What To Do When Your Project Has a Question Mark in the Projects Window or a #include Directive is Underlined in Red>>
-
-|- |<<analyzer, Configuring Build Analyzer for Code Assistance>>
-
-|- |<<multiplatform,Configuring Code Assistance for a Multi-Platform Project>>
-
-|- |<<cannotbuild,Configuring Code Assistance When You Cannot Build the Project>>
-
-|- |<<definitiondeclaration,When a Hyperlink Goes to a Function Definition and When to a Declaration>>
-
-|- |<<namespace,Finding All Definitions of a Namespace>>
-
-|- |<<declaration,Seeing the Declaration Name of a Declaration Made in a Macro>>
-|===
-
-
== What To Do When Your Project Has a Question Mark in the Projects Window
If your project has a question mark in the Projects window, or an ``#include`` directive is underlined in red, then your project has unresolved include directives. The IDE uses an internal parser that is used by Code Assistance features (Code Completion, Classes window, Navigator window, etc). The markings mean that this parser cannot resolve some ``#include`` directives, because the IDE project has an incorrect configuration. This might happen if the project was created from existing sources without help from debugging information or if, for example, the source files included new libraries since the IDE project was created.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ja.asciidoc
index f7f0e12..527625c 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ja.asciidoc
@@ -37,27 +37,6 @@
この記事のヒントは、主に既存のソースまたは既存のバイナリからのプロジェクトに適用されます。IDEのコード支援で作成および管理されているプロジェクトについては、構成は必要ありません。
-=== 内容
-
-image::images/netbeans-stamp-80-74-73.png[title="このページの内容は、NetBeans IDE 8.0/7.4/7.3に適用されます"]
-
-|===
-|- |<<questionmark,プロジェクトの「プロジェクト」ウィンドウに疑問符がある、または#includeディレクティブに赤い下線が付いている場合の処置>>
-
-|- |<<analyzer,コード支援に対するビルド・アナライザの構成>>
-
-|- |<<multiplatform,マルチプラットフォーム・プロジェクトに対するコード支援の構成>>
-
-|- |<<cannotbuild,プロジェクトをビルドできない場合のコード支援の構成>>
-
-|- |<<definitiondeclaration,ハイパーリンクが関数定義に移動する場合と宣言に移動する場合>>
-
-|- |<<namespace,名前空間のすべての定義の検索>>
-
-|- |<<declaration,マクロ内で作成された宣言の宣言名の表示>>
-|===
-
-
== プロジェクトの「プロジェクト」ウィンドウに疑問符がある場合の処置
プロジェクトの「プロジェクト」ウィンドウに疑問符があるか、 ``#include`` ディレクティブに赤い下線が付いている場合、プロジェクトに未解決のincludeディレクティブがあります。IDEは、コード支援機能(コード補完、「クラス」ウィンドウ、「ナビゲータ」ウィンドウなど)によって使用される内部パーサーを使用します。このマークは、IDEプロジェクトの構成が間違っているために、このパーサーが一部の ``#include`` ディレクティブを解決できないことを意味します。この状況は、プロジェクトがデバッグ情報からの支援なしに既存のソースから作成された場合、またはソース・ファイルにIDEプロジェクトの作成以降の新規ライブラリが含まれていた場合などに発生することがあります。
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_pt_BR.asciidoc
index 7b128b3..04bc093 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_pt_BR.asciidoc
@@ -36,27 +36,6 @@
Observe que as dicas deste artigo aplicam-se principalmente a projetos de código-fonte existente ou de um binário existente. Para projetos que são criados e gerenciados pela assistência ao código IDE, a configuração não é necessária.
-
-
-image::images/netbeans-stamp-80-74-73.png[title="O conteúdo desta página aplica-se ao NetBeans IDE 8.0/7.4/7.3"]
-
-|===
-|- |<<questionmark,O que Fazer quando seu Projeto Tem um Ponto de Interrogação na Janela Projetos ou uma Diretiva #include é Sublinhada em Vermelho >>
-
-|- |<<analyzer, Configurando o Analisador de Código para a Assistência ao Código>>
-
-|- |<<multiplatform,Configurando a Assistência ao Código para um Projeto Multiplataforma>>
-
-|- |<<cannotbuild,Configurando a Assistência ao Código Quando Você não Consegue Construir o Projeto>>
-
-|- |<<definitiondeclaration,Quando um Hiperlink vai para uma Definição de Função e Quando vai para uma Declaração>>
-
-|- |<<namespace,Encontrando Todas as Definições de um Namespace>>
-
-|- |<<declaration,Vendo o Nome de Declaração de uma Declaração Feita em uma Macro>>
-|===
-
-
== O que Fazer quando seu Projeto Tem um Ponto de Interrogação na Janela Projetos
Se seu projeto tem um ponto de interrogação na janela projetos ou uma diretiva ``#include`` está sublinhada em vermelho, então seu projeto tem políticas include não resolvidas. O IDE usa o parser interno que é usado por funcionalidades de Assistência ao Código (Autocompletar Código, janela Classes, janela Navegador etc.). As marcações significam que esse parser não conseguiu resolver algumas diretivas ``#include`` , pois o projeto IDE tem uma configuração incorreta. Isso pode ter ocorrido se o projeto tiver sido criado de fontes existentes sem a ajuda de informações de depuração ou se, por exemplo, os arquivos de origem tiverem incluído novas bibliotecas desde a criação do projeto IDE.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ru.asciidoc
index d42e7b4..97f9445 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_ru.asciidoc
@@ -38,25 +38,6 @@
-image::images/netbeans-stamp-80-74-73.png[title="Содержимое этой страницы применимо к IDE NetBeans 8.0/7.4/7.3"]
-
-|===
-|- |<<questionmark,Что делать, если в окне проекта стоит вопросительный знак или директива #include подчеркнута красным>>
-
-|- |<<analyzer, Настройка встроенного анализатора для помощи при работе с кодом>>
-
-|- |<<multiplatform,Настройка помощника при работе с кодом для проектов на базе нескольких платформ>>
-
-|- |<<cannotbuild,Настройка помощника при работе с кодом в случаях, когда не удается создать проект>>
-
-|- |<<definitiondeclaration,В каких случаях гиперссылка связана с определением функции, а в каких – с объявлением>>
-
-|- |<<namespace,Поиск всех определений пространства имен>>
-
-|- |<<declaration,Просмотр имени объявления, сделанного в макросе>>
-|===
-
-
== Что делать, если проект помечен вопросительным знаком в окне проектов
Если в окне проекта стоит вопросительный знак или директива ``#include`` подчеркнута красным, то ваш проект имеет неразрешенные директивы #include. В среде IDE применяется внутренний синтаксический анализатор, который используется функциями помощника при работе с кодом (автозавершение кода, окно классов, окно переходов и т. д.). Эта отметка означает, что этот анализатор не может решить некоторые директивы ``#include`` , потому что проект IDE имеет неправильную конфигурацию. Это может произойти, если проект был создан на основе существующих исходных кодов без информации об отладке или если, например, исходные файлы включали новые библиотеки, когда проект IDE был уже создан.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_zh_CN.asciidoc
index 153d05f..fec3dbb 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/HowTos_zh_CN.asciidoc
@@ -38,24 +38,6 @@
-image::images/netbeans-stamp-80-74-73.png[title="此页上的内容适用于 NetBeans IDE 8.0/7.4/7.3"]
-
-|===
-|- |<<questionmark,如果“项目”窗口中显示带有问号的项目或 #include 指令带有红色下划线该怎么办>>
-
-|- |<<analyzer, 为代码帮助配置构建分析器>>
-
-|- |<<multiplatform,为多平台项目配置代码帮助>>
-
-|- |<<cannotbuild,无法构建项目时配置代码帮助>>
-
-|- |<<definitiondeclaration,超链接何时转至函数定义以及声明>>
-
-|- |<<namespace,查找名称空间的所有定义>>
-
-|- |<<declaration,查看在宏中所作声明的声明名称>>
-|===
-
== 如果“项目”窗口中显示带有问号的项目该怎么办
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux.asciidoc
index a54e971..8264f85 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux.asciidoc
@@ -35,26 +35,6 @@
The tutorial is specific to Linux.
-
-=== Contents
-
-image::images/netbeans-stamp-80-74.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-|===
-|- |<<requirements,Requirements>>
-
-|- |<<modules, Setting Up Your Environment for the Tutorial>>
-
-|- |<<javaproject,Setting Up the Java Application Project>>
-
-|- |<<c-library, Setting Up a New C/C++ Dynamic Library Project>>
-
-|- |<<running,Building and Running the Application >>
-
-|- |<<next,Next Steps >>
-|===
-
-
== Requirements
*To follow this tutorial, you need the following software and resources.*
@@ -93,12 +73,20 @@
1. Choose File > New Project. Select the Java category and Java Application project type. Click Next.
image::images/jni-new-project-java.png[]
-2. In the Project Name field, type ``JNIDemoJava`` .
-3. You can change the Project Location to any directory on your computer, but here we use the default NetBeansProjects in the user directory.
-4. Leave the Create Main Class checkbox selected and change the Main class name to ``jnidemojava.Main`` .
+
+[start=2]
+. In the Project Name field, type ``JNIDemoJava`` .
+
+[start=3]
+. You can change the Project Location to any directory on your computer, but here we use the default NetBeansProjects in the user directory.
+
+[start=4]
+. Leave the Create Main Class checkbox selected and change the Main class name to ``jnidemojava.Main`` .
image::images/jni-new-java-app.png[]
-5. Click Finish.
+
+[start=5]
+. Click Finish.
The IDE creates the ``NetBeansProjects/JNIDemoJava`` project folder.
@@ -113,8 +101,12 @@
new Main().nativePrint();
----
-3. Notice the indicator in the left margin showing an error and lightbulb. Click on the indicator, and you are prompted with a shortcut to create the method ``nativePrint`` .
-4. Click on this shortcut and the IDE inserts the following code:
+
+[start=3]
+. Notice the indicator in the left margin showing an error and lightbulb. Click on the indicator, and you are prompted with a shortcut to create the method ``nativePrint`` .
+
+[start=4]
+. Click on this shortcut and the IDE inserts the following code:
[source,java]
----
@@ -123,14 +115,18 @@
throw new UnsupportedOperationException("Not supported yet");
}
----
-5. Delete the line
+
+[start=5]
+. Delete the line
[source,java]
----
throw new UnsupportedOperationException("Not supported yet");
----
-6. Modify the ``nativePrint()`` method by inserting the ``native`` keyword into the method signature so that it now looks as follows:
+
+[start=6]
+. Modify the ``nativePrint()`` method by inserting the ``native`` keyword into the method signature so that it now looks as follows:
[source,java]
----
@@ -153,7 +149,9 @@
private native void nativePrint();
}
----
-7. Right-click the project name and select Clean and Build. The project should build successfully.
+
+[start=7]
+. Right-click the project name and select Clean and Build. The project should build successfully.
=== Creating the Native Library Header File
@@ -172,7 +170,9 @@
A ``JNIDemoJava.h`` C header file is generated in the NetBeansProjects directory. This file is required to provide a correct function declaration for the native implementation of the ``nativePrint()`` method. You will need it later when you create the C part of this application.
-3. Switch back to the NetBeans IDE window.
+
+[start=3]
+. Switch back to the NetBeans IDE window.
*Summary*
@@ -187,9 +187,15 @@
1. Choose File > New Project. Under Categories, select C/C++. Under Projects, select C/C++ Dynamic Library. Click Next.
image::images/jni-new-project-c.png[]
-2. In the Project Name field, type ``JNIDemoCdl`` .
-3. In the Project Location field, use the same location that you used for the Java application project, ``NetBeansProjects`` . The location should be shown as the default value.
-4. Accept the defaults for all other fields and click Finish.
+
+[start=2]
+. In the Project Name field, type ``JNIDemoCdl`` .
+
+[start=3]
+. In the Project Location field, use the same location that you used for the Java application project, ``NetBeansProjects`` . The location should be shown as the default value.
+
+[start=4]
+. Accept the defaults for all other fields and click Finish.
The IDE creates the ``NetBeansProjects/JNIDemoCdl`` project folder.
@@ -206,13 +212,19 @@
These settings are required to enable references to the Java ``jni.h`` library from your C code.
-7. Find the Compilation Line area of the C Compiler options. Click in the text field of the Additional Options property and type ``-shared -m32`` . image::images/jni-project-properties-cmd-options.png[]
+
+[start=7]
+. Find the Compilation Line area of the C Compiler options. Click in the text field of the Additional Options property and type ``-shared -m32`` . image::images/jni-project-properties-cmd-options.png[]
The ``-shared`` option tells the compiler to generate a dynamic library.
The ``-m32`` option tells the compiler to create a 32-bit binary. By default on 64-bit systems the compiled binaries are 64-bit, which causes a lot of problems with 32-bit JDKs.
-8. Click the Linker category in the left panel.
-9. Click the Output text field, and replace the string
+
+[start=8]
+. Click the Linker category in the left panel.
+
+[start=9]
+. Click the Output text field, and replace the string
[source,java]
----
@@ -228,7 +240,9 @@
----
to simplify the path of the resulting shared object file. This will make the file easer to reference from Java.
image::images/jni-project-properties-linker.png[]
-10. Click OK. The defined settings are saved.
+
+[start=10]
+. Click OK. The defined settings are saved.
=== Adding a Header File
@@ -263,8 +277,12 @@
}
----
-3. Save the ``JNIDemo.c`` file.
-4. Right-click the ``JNIDemoCdl`` project node and choose Build. The Output window displays ``BUILD SUCCESSFUL (total time 171ms)`` or similar.
+
+[start=3]
+. Save the ``JNIDemo.c`` file.
+
+[start=4]
+. Right-click the ``JNIDemoCdl`` project node and choose Build. The Output window displays ``BUILD SUCCESSFUL (total time 171ms)`` or similar.
*Summary*
@@ -290,7 +308,9 @@
----
Replace _full-path-to-NetBeansProjects-dir_ with the path to your NetBeansProjects directory, which should be something similar to ``/home/_username_/NetBeansProjects``
-3. Save the ``Main.java`` file.
+
+[start=3]
+. Save the ``Main.java`` file.
=== Running the JNIDemoJava Application
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ja.asciidoc
index f72a9c5..468ee0e 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ja.asciidoc
@@ -36,25 +36,6 @@
このチュートリアルはLinuxに固有です。
-=== 内容
-
-image::images/netbeans-stamp-80-74.png[title="このページの内容は、NetBeans IDE 7.4および8.0に適用されます"]
-
-|===
-|- |<<requirements,要件>>
-
-|- |<<modules, 環境をチュートリアル用に設定>>
-
-|- |<<javaproject,Javaアプリケーション・プロジェクトの設定>>
-
-|- |<<c-library, 新規C/C++動的ライブラリ・プロジェクトの設定>>
-
-|- |<<running,アプリケーションのビルドと実行>>
-
-|- |<<next,次の手順>>
-|===
-
-
== 要件
*このチュートリアルに従うには、次のソフトウェアとリソースが必要です。*
@@ -93,12 +74,20 @@
1. 「ファイル」>「新規プロジェクト」を選択します。「Java」カテゴリおよび「Javaアプリケーション」プロジェクト・タイプを選択します。「次」をクリックします。
image::images/jni-new-project-java.png[]
-2. 「プロジェクト名」フィールドに「 ``JNIDemoJava`` 」と入力します。
-3. 「プロジェクトの場所」はコンピュータ上の任意のディレクトリに変更できますが、ここではユーザー・ディレクトリ内のデフォルトのNetBeansProjectsを使用します。
-4. 「メイン・クラスの作成」チェックボックスは選択したままにし、メイン・クラス名を ``jnidemojava.Main`` に変更します。
+
+[start=2]
+. 「プロジェクト名」フィールドに「 ``JNIDemoJava`` 」と入力します。
+
+[start=3]
+. 「プロジェクトの場所」はコンピュータ上の任意のディレクトリに変更できますが、ここではユーザー・ディレクトリ内のデフォルトのNetBeansProjectsを使用します。
+
+[start=4]
+. 「メイン・クラスの作成」チェックボックスは選択したままにし、メイン・クラス名を ``jnidemojava.Main`` に変更します。
image::images/jni-new-java-app.png[]
-5. 「終了」をクリックします。
+
+[start=5]
+. 「終了」をクリックします。
IDEによって、 ``NetBeansProjects/JNIDemoJava`` プロジェクト・フォルダが作成されます。
@@ -113,8 +102,12 @@
new Main().nativePrint();
----
-3. エラーおよび電球を表示するインジケータが左マージンに示されるのがわかります。インジケータをクリックすると、メソッド ``nativePrint`` を作成することを求めるショートカットが表示されます。
-4. このショートカットをクリックすると、IDEは次のコードを挿入します。
+
+[start=3]
+. エラーおよび電球を表示するインジケータが左マージンに示されるのがわかります。インジケータをクリックすると、メソッド ``nativePrint`` を作成することを求めるショートカットが表示されます。
+
+[start=4]
+. このショートカットをクリックすると、IDEは次のコードを挿入します。
[source,java]
----
@@ -123,14 +116,18 @@
throw new UnsupportedOperationException("Not supported yet");
}
----
-5. 次の行を削除します。
+
+[start=5]
+. 次の行を削除します。
[source,java]
----
throw new UnsupportedOperationException("Not supported yet");
----
-6. ``native`` キーワードをメソッド署名に挿入して ``nativePrint()`` メソッドを変更し、次のようになるようにします。
+
+[start=6]
+. ``native`` キーワードをメソッド署名に挿入して ``nativePrint()`` メソッドを変更し、次のようになるようにします。
[source,java]
----
@@ -153,7 +150,9 @@
private native void nativePrint();
}
----
-7. プロジェクト名を右クリックし、「消去してビルド」を選択します。プロジェクトは正常にビルドされます。
+
+[start=7]
+. プロジェクト名を右クリックし、「消去してビルド」を選択します。プロジェクトは正常にビルドされます。
=== ネイティブ・ライブラリ・ヘッダー・ファイルの作成
@@ -172,7 +171,9 @@
``JNIDemoJava.h`` Cヘッダー・ファイルがNetBeansProjectsディレクトリに生成されます。このファイルは ``nativePrint()`` メソッドのネイティブ実装のための正しい関数宣言を提供するために必要です。後でこのアプリケーションのC部分を作成するとき、これが必要になります。
-3. NetBeans IDEウィンドウに戻ります。
+
+[start=3]
+. NetBeans IDEウィンドウに戻ります。
*サマリー*
@@ -187,9 +188,15 @@
1. 「ファイル」>「新規プロジェクト」を選択します。「カテゴリ」から「C/C++」を選択します。「プロジェクト」から「C/C++動的ライブラリ」を選択します。「次」をクリックします。
image::images/jni-new-project-c.png[]
-2. 「プロジェクト名」フィールドに「 ``JNIDemoCdl`` 」と入力します。
-3. 「プロジェクトの場所」フィールドには、Javaアプリケーション・プロジェクトに使用したのと同じ場所である ``NetBeansProjects`` を使用します。この場所はデフォルト値として表示されます。
-4. 他のすべてのフィールドはデフォルトを受け入れて、「終了」をクリックします。
+
+[start=2]
+. 「プロジェクト名」フィールドに「 ``JNIDemoCdl`` 」と入力します。
+
+[start=3]
+. 「プロジェクトの場所」フィールドには、Javaアプリケーション・プロジェクトに使用したのと同じ場所である ``NetBeansProjects`` を使用します。この場所はデフォルト値として表示されます。
+
+[start=4]
+. 他のすべてのフィールドはデフォルトを受け入れて、「終了」をクリックします。
IDEは ``NetBeansProjects/JNIDemoCdl`` プロジェクト・フォルダを作成します。
@@ -206,13 +213,19 @@
これらの設定は、CコードからJava ``jni.h`` ライブラリへの参照を有効にするために必要です。
-7. 「Cコンパイラ」オプションの「コンパイル行」領域を見つけます。「追加のオプション」プロパティのテキスト・フィールド内をクリックし、 ``-shared -m32`` と入力します。image::images/jni-project-properties-cmd-options.png[]
+
+[start=7]
+. 「Cコンパイラ」オプションの「コンパイル行」領域を見つけます。「追加のオプション」プロパティのテキスト・フィールド内をクリックし、 ``-shared -m32`` と入力します。image::images/jni-project-properties-cmd-options.png[]
``-shared`` オプションは、動的ライブラリを生成することをコンパイラに指定します。
``-m32`` オプションは、32ビット・バイナリを作成することをコンパイラに指定します。64ビット・システムのデフォルトでは、コンパイルされたバイナリは64ビットで、このことは32ビットJDKで多くの問題を引き起こします。
-8. 左パネルの「リンカー」カテゴリをクリックします。
-9. 「出力」テキスト・フィールドをクリックして置換します。次の文字列を:
+
+[start=8]
+. 左パネルの「リンカー」カテゴリをクリックします。
+
+[start=9]
+. 「出力」テキスト・フィールドをクリックして置換します。次の文字列を:
[source,java]
----
@@ -228,7 +241,9 @@
----
結果の共有オブジェクト・ファイルのパスが簡素化されます。これで、Javaからファイルを参照しやすくなります。
image::images/jni-project-properties-linker.png[]
-10. 「OK」をクリックします。定義された設定が保存されます。
+
+[start=10]
+. 「OK」をクリックします。定義された設定が保存されます。
=== ヘッダー・ファイルの追加
@@ -263,8 +278,12 @@
}
----
-3. ``JNIDemo.c`` ファイルを保存します。
-4. 「 ``JNIDemoCdl`` 」プロジェクト・ノードを右クリックし、「ビルド」を選択します。「出力」ウィンドウに ``BUILD SUCCESSFUL (total time 171ms)`` (または類似する文)が表示されます。
+
+[start=3]
+. ``JNIDemo.c`` ファイルを保存します。
+
+[start=4]
+. 「 ``JNIDemoCdl`` 」プロジェクト・ノードを右クリックし、「ビルド」を選択します。「出力」ウィンドウに ``BUILD SUCCESSFUL (total time 171ms)`` (または類似する文)が表示されます。
*サマリー*
@@ -290,7 +309,9 @@
----
_full-path-to-NetBeansProjects-dir_を、NetBeansProjectsディレクトリへのパス( ``/home/_username_/NetBeansProjects`` に類似したもの)に置き換えます。
-3. ``Main.java`` ファイルを保存します。
+
+[start=3]
+. ``Main.java`` ファイルを保存します。
=== JNIDemoJavaアプリケーションの実行
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_pt_BR.asciidoc
index 933d088..d4172e3 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_pt_BR.asciidoc
@@ -36,24 +36,6 @@
Este tutorial é específico para o Linux.
-
-image::images/netbeans-stamp-80-74.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.4 e 8.0"]
-
-|===
-|- |<<requirements,Requisitos>>
-
-|- |<<modules, Configurando seu Ambiente para o Tutorial>>
-
-|- |<<javaproject,Configurando o Projeto de Aplicação Java>>
-
-|- |<<c-library, Configurando um Novo Projeto de Biblioteca Dinâmica C/C++>>
-
-|- |<<running,Construindo e Executando a Aplicação>>
-
-|- |<<next,Próximas Etapas>>
-|===
-
-
== Requisitos
*Para seguir este tutorial, são necessários os recursos e o software a seguir.*
@@ -92,12 +74,20 @@
1. Escolha Arquivo > Novo Projeto. Selecione a categoria Java e o tipo de projeto de Aplicação Java. Clique em Próximo.
image::images/jni-new-project-java.png[]
-2. No campo Nome do Projeto, digite ``JNIDemoJava`` .
-3. Você pode alterar a Localização do Projeto para qualquer diretório em seu computador, mas aqui nós usamos o NetBeansProjects default no diretório do usuário.
-4. Deixe a caixa de seleção Criar Classe Principal selecionada e altere o nome da classe Principal para ``jnidemojava.Main`` .
+
+[start=2]
+. No campo Nome do Projeto, digite ``JNIDemoJava`` .
+
+[start=3]
+. Você pode alterar a Localização do Projeto para qualquer diretório em seu computador, mas aqui nós usamos o NetBeansProjects default no diretório do usuário.
+
+[start=4]
+. Deixe a caixa de seleção Criar Classe Principal selecionada e altere o nome da classe Principal para ``jnidemojava.Main`` .
image::images/jni-new-java-app.png[]
-5. Clique em Finalizar.
+
+[start=5]
+. Clique em Finalizar.
O IDE cria a pasta do projeto ``NetBeansProjects/JNIDemoJava`` .
@@ -112,8 +102,12 @@
new Main().nativePrint();
----
-3. Observe que o indicador na margem esquerda está mostrando um erro e uma lâmpada. Clique no indicador; será solicitado que você crie um atalho para criar o método ``nativePrint`` .
-4. Clique neste atalho e o IDE insere o seguinte código:
+
+[start=3]
+. Observe que o indicador na margem esquerda está mostrando um erro e uma lâmpada. Clique no indicador; será solicitado que você crie um atalho para criar o método ``nativePrint`` .
+
+[start=4]
+. Clique neste atalho e o IDE insere o seguinte código:
[source,java]
----
@@ -122,14 +116,18 @@
throw new UnsupportedOperationException("Not supported yet");
}
----
-5. Deletar a linha
+
+[start=5]
+. Deletar a linha
[source,java]
----
throw new UnsupportedOperationException("Not supported yet");
----
-6. Modifique o método ``nativePrint()`` , inserindo a palavra-chave ``native`` na assinatura do método para que pareça como segue:
+
+[start=6]
+. Modifique o método ``nativePrint()`` , inserindo a palavra-chave ``native`` na assinatura do método para que pareça como segue:
[source,java]
----
@@ -152,7 +150,9 @@
private native void nativePrint();
}
----
-7. Clique com o botão direito do mouse no nome do projeto e selecione Limpar e Construir. O projeto deve ser construído com êxito.
+
+[start=7]
+. Clique com o botão direito do mouse no nome do projeto e selecione Limpar e Construir. O projeto deve ser construído com êxito.
=== Criando o Arquivo de Cabeçalho da Biblioteca Nativa
@@ -171,7 +171,9 @@
Um arquivo de cabeçalho C ``JNIDemoJava.h`` é gerado no diretório NetBeansProjects. O arquivo é necessário para fornecer a declaração de função correta para a implementação nativa do método ``nativePrint()`` . Você precisar do mesmo mais tarde ao criar a parte C desta aplicação.
-3. Alterne de volta para a janela do NetBeans IDE.
+
+[start=3]
+. Alterne de volta para a janela do NetBeans IDE.
*Resumo*
@@ -186,9 +188,15 @@
1. Escolha Arquivo > Novo Projeto. Em Categorias, selecione C/C++. Em Projetos, selecione Biblioteca Dinâmica C/C++. Clique em Próximo.
image::images/jni-new-project-c.png[]
-2. No campo Nome do Projeto, digite ``JNIDemoCdl`` .
-3. No campo Localização do Projeto, use a mesma localização usada para o projeto da aplicação Java, ``NetBeansProjects`` . A localização deve ser mostrada como o valor default.
-4. Aceite os defaults de todos os outros campos e clique em Finalizar.
+
+[start=2]
+. No campo Nome do Projeto, digite ``JNIDemoCdl`` .
+
+[start=3]
+. No campo Localização do Projeto, use a mesma localização usada para o projeto da aplicação Java, ``NetBeansProjects`` . A localização deve ser mostrada como o valor default.
+
+[start=4]
+. Aceite os defaults de todos os outros campos e clique em Finalizar.
O IDE cria a pasta do projeto ``NetBeansProjects/JNIDemoCdl`` .
@@ -205,13 +213,19 @@
Essas definições são necessárias para ativar as referências à biblioteca ``jni.h`` do Java de seu código C.
-7. Localize a área de Linha de Compilação das opções do Compilador C. Clique no campo de texto da propriedade Opções Adicionais e tipo ``-shared -m32`` . image::images/jni-project-properties-cmd-options.png[]
+
+[start=7]
+. Localize a área de Linha de Compilação das opções do Compilador C. Clique no campo de texto da propriedade Opções Adicionais e tipo ``-shared -m32`` . image::images/jni-project-properties-cmd-options.png[]
A opção ``-shared`` informa ao compilador para gerar uma biblioteca dinâmica.
A opção ``-m32`` informa ao compilador para criar um binário de 32 bits. Por default, em sistema de 64 bits, os binários compilados são de 64 bits, o que causa muitos problemas com JDKs de 32 bits.
-8. Clique na categoria Vinculador no painel esquerdo.
-9. Clique no campo de texto Saída e substitua a string
+
+[start=8]
+. Clique na categoria Vinculador no painel esquerdo.
+
+[start=9]
+. Clique no campo de texto Saída e substitua a string
[source,java]
----
@@ -227,7 +241,9 @@
----
para simplificar o caminho do arquivo de objeto compartilhado resultante. Isso fará com que seja mais fácil referenciar o arquivo a partir do Java.
image::images/jni-project-properties-linker.png[]
-10. Clique em OK. As definições definidas são salvas.
+
+[start=10]
+. Clique em OK. As definições definidas são salvas.
=== Adicionando um Arquivo de Cabeçalho
@@ -262,8 +278,12 @@
}
----
-3. Salve o arquivo ``JNIDemo.c`` .
-4. Clique com o botão direito do mouse no nó de projeto ``JNIDemoCdl`` e escolha Construir. A janela de Saída exibe ``BUILD SUCCESSFUL (tempo total 171ms)`` ou semelhante.
+
+[start=3]
+. Salve o arquivo ``JNIDemo.c`` .
+
+[start=4]
+. Clique com o botão direito do mouse no nó de projeto ``JNIDemoCdl`` e escolha Construir. A janela de Saída exibe ``BUILD SUCCESSFUL (tempo total 171ms)`` ou semelhante.
*Resumo*
@@ -289,7 +309,9 @@
----
Substitua _full-path-to-NetBeansProjects-dir_ pelo caminho em seu diretório NetBeansProjects, que deve ser algo semelhante a ``/home/_username_/NetBeansProjects``
-3. Salve o arquivo ``Main.java`` .
+
+[start=3]
+. Salve o arquivo ``Main.java`` .
=== Executando a Aplicação JNIDemoJava
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ru.asciidoc
index adc9802..599cd3e 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_ru.asciidoc
@@ -36,24 +36,6 @@
Этот учебный курс создан для Linux.
-
-image::images/netbeans-stamp-80-74.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.4 и 8.0"]
-
-|===
-|- |<<requirements,Требования>>
-
-|- |<<modules, Настройка среды для учебного курса>>
-
-|- |<<javaproject,Настройка проекта приложения Java>>
-
-|- |<<c-library, Настройка нового проекта динамической библиотеки на языке C/C++>>
-
-|- |<<running,Сборка и запуск приложения>>
-
-|- |<<next,Следующие действия>>
-|===
-
-
== Требования
*Для работы с этим учебным курсом требуется следующее программное обеспечение и ресурсы.*
@@ -92,12 +74,20 @@
1. Выберите команду "Файл" > "Новый проект". Выберите категорию "Java" и тип проекта "Приложение Java". Нажмите 'Далее'.
image::images/jni-new-project-java.png[]
-2. В поле "Имя проекта" введите ``JNIDemoJava`` .
-3. В качестве местоположения проекта можно указать любой каталог на компьютере. В этом примере используется папка по умолчанию "NetBeansProjects" в каталоге пользователя.
-4. Не снимая флажок 'Создать основной класс', измените имя основного класса на ``jnidemojava.Main`` .
+
+[start=2]
+. В поле "Имя проекта" введите ``JNIDemoJava`` .
+
+[start=3]
+. В качестве местоположения проекта можно указать любой каталог на компьютере. В этом примере используется папка по умолчанию "NetBeansProjects" в каталоге пользователя.
+
+[start=4]
+. Не снимая флажок 'Создать основной класс', измените имя основного класса на ``jnidemojava.Main`` .
image::images/jni-new-java-app.png[]
-5. Нажмите 'Готово'.
+
+[start=5]
+. Нажмите 'Готово'.
В среде IDE будет создана папка проекта ``NetBeansProjects/JNIDemoJava`` .
@@ -112,8 +102,12 @@
new Main().nativePrint();
----
-3. В поле слева появится индикатор в виде лампочки, сообщающий об ошибке. Щелкните индикатор. Отобразится ярлык для создания метода ``nativePrint`` .
-4. Щелкните этот ярлык, после чего будет вставлен следующий код:
+
+[start=3]
+. В поле слева появится индикатор в виде лампочки, сообщающий об ошибке. Щелкните индикатор. Отобразится ярлык для создания метода ``nativePrint`` .
+
+[start=4]
+. Щелкните этот ярлык, после чего будет вставлен следующий код:
[source,java]
----
@@ -122,14 +116,18 @@
throw new UnsupportedOperationException("Not supported yet");
}
----
-5. Удалите строку
+
+[start=5]
+. Удалите строку
[source,java]
----
throw new UnsupportedOperationException("Not supported yet");
----
-6. Измените метод ``nativePrint()`` : вставьте ключевое слово ``native`` в подпись метода, чтобы она выглядела следующим образом:
+
+[start=6]
+. Измените метод ``nativePrint()`` : вставьте ключевое слово ``native`` в подпись метода, чтобы она выглядела следующим образом:
[source,java]
----
@@ -152,7 +150,9 @@
private native void nativePrint();
}
----
-7. Правой кнопкой мыши щелкните имя проекта и выберите пункт "Очистить и собрать". После этого проект должен успешно собраться.
+
+[start=7]
+. Правой кнопкой мыши щелкните имя проекта и выберите пункт "Очистить и собрать". После этого проект должен успешно собраться.
=== Создание файла заголовка библиотеки в машинном коде
@@ -171,7 +171,9 @@
В каталоге NetBeansProjects будет создан файл заголовка на языке C ``JNIDemoJava.h`` . Этот файл требуется для того, чтобы обеспечить предоставление правильного объявления функции для реализации метода ``nativePrint()`` в машинном коде. Он понадобится позже при создании части приложения на языке C.
-3. Переключение обратно в окно IDE NetBeans.
+
+[start=3]
+. Переключение обратно в окно IDE NetBeans.
*Заключение*
@@ -186,9 +188,15 @@
1. Выберите команду "Файл" > "Новый проект". В окне "Категории" выберите C/C++. В окне "Проекты" выберите "Динамическая библиотека C/C++". Нажмите кнопку "Далее".
image::images/jni-new-project-c.png[]
-2. В поле "Имя проекта" введите ``JNIDemoCdl`` .
-3. В поле "Местоположение проекта" укажите то же местоположение, которое было использовано для проекта приложения Java – ``NetBeansProjects`` . Это местоположение должно отобразиться по умолчанию.
-4. Оставьте данные во всех остальных полях без изменения и нажмите 'Готово'.
+
+[start=2]
+. В поле "Имя проекта" введите ``JNIDemoCdl`` .
+
+[start=3]
+. В поле "Местоположение проекта" укажите то же местоположение, которое было использовано для проекта приложения Java – ``NetBeansProjects`` . Это местоположение должно отобразиться по умолчанию.
+
+[start=4]
+. Оставьте данные во всех остальных полях без изменения и нажмите 'Готово'.
В среде IDE будет создана папка проекта ``NetBeansProjects/JNIDemoCdl`` .
@@ -205,13 +213,19 @@
Эти параметры требуются для включения ссылок на библиотеку Java ``jni.h`` из кода C.
-7. Найдите область 'Строка компиляции' в параметрах компилятора C. Щелкните текстовое поле в свойстве 'Дополнительные параметры' и введите ``-shared -m32`` . image::images/jni-project-properties-cmd-options.png[]
+
+[start=7]
+. Найдите область 'Строка компиляции' в параметрах компилятора C. Щелкните текстовое поле в свойстве 'Дополнительные параметры' и введите ``-shared -m32`` . image::images/jni-project-properties-cmd-options.png[]
Параметр ``-shared`` указывает создание динамической библиотеки.
Параметр ``-m32`` указывает создание двоичного файла для 32-разрядных платформ. По умолчанию в 64-разрядных системах компилируются двоичные файлы для 64-разрядных платформ, что приводит к возникновению множества проблем в 32-разрядных JDK.
-8. Перейдите в категорию "Компоновщик" на левой панели.
-9. Поставьте курсор в текстовое поле "Вывод" и замените строку
+
+[start=8]
+. Перейдите в категорию "Компоновщик" на левой панели.
+
+[start=9]
+. Поставьте курсор в текстовое поле "Вывод" и замените строку
[source,java]
----
@@ -227,7 +241,9 @@
----
чтобы упростить путь к созданному файлу совместно используемого объекта. Это поможет упростить процесс создания ссылки из Java.
image::images/jni-project-properties-linker.png[]
-10. Нажмите кнопку "ОК". Определенные параметры сохранены.
+
+[start=10]
+. Нажмите кнопку "ОК". Определенные параметры сохранены.
=== Добавление файла заголовка
@@ -262,8 +278,12 @@
}
----
-3. Сохраните файл ``JNIDemo.c`` .
-4. Щелкните правой кнопкой мыши узел проекта ``JNIDemoCdl`` и выберите 'Собрать'. В окне 'Результаты' отображается следующее (или аналогичное) сообщение: ``СБОРКА УСПЕШНО ЗАВЕРШЕНА (общее время: 171 мс)`` .
+
+[start=3]
+. Сохраните файл ``JNIDemo.c`` .
+
+[start=4]
+. Щелкните правой кнопкой мыши узел проекта ``JNIDemoCdl`` и выберите 'Собрать'. В окне 'Результаты' отображается следующее (или аналогичное) сообщение: ``СБОРКА УСПЕШНО ЗАВЕРШЕНА (общее время: 171 мс)`` .
*Заключение*
@@ -289,7 +309,9 @@
----
Замените _full-path-to-NetBeansProjects-dir_ путем к каталогу NetBeansProjects, который должен иметь следующий (или аналогичный) вид: ``/home/_username_/NetBeansProjects``
-3. Сохраните файл ``Main.java`` .
+
+[start=3]
+. Сохраните файл ``Main.java`` .
=== Запуск приложения JNIDemoJava
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_zh_CN.asciidoc
index 1d24027..e75b463 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/beginning-jni-linux_zh_CN.asciidoc
@@ -36,24 +36,6 @@
本教程特定于 Linux。
-
-image::images/netbeans-stamp-80-74.png[title="此页上的内容适用于 NetBeans IDE 7.4 和 8.0"]
-
-|===
-|- |<<requirements,要求>>
-
-|- |<<modules, 为教程设置环境>>
-
-|- |<<javaproject,设置 Java 应用程序项目>>
-
-|- |<<c-library, 设置新的 C/C++ 动态库项目>>
-
-|- |<<running,构建和运行应用程序>>
-
-|- |<<next,后续步骤>>
-|===
-
-
== 要求
*要学习本教程,您需要具备以下软件和资源。*
@@ -92,12 +74,20 @@
1. 选择 "File"(文件)> "New Project"(新建项目)。选择 "Java" 类别和 "Java Application"(Java 应用程序)项目类型。单击 "Next"(下一步)。
image::images/jni-new-project-java.png[]
-2. 在 "Project Name"(项目名称)字段中,键入 ``JNIDemoJava`` 。
-3. 您可以将 "Project Location"(项目位置)更改为计算机上的任何目录,但在这里,我们使用用户目录中默认的 NetBeansProjects。
-4. 让 "Create Main Class"(创建主类)复选框保持选中状态,然后将主类名更改为 ``jnidemojava.Main`` 。
+
+[start=2]
+. 在 "Project Name"(项目名称)字段中,键入 ``JNIDemoJava`` 。
+
+[start=3]
+. 您可以将 "Project Location"(项目位置)更改为计算机上的任何目录,但在这里,我们使用用户目录中默认的 NetBeansProjects。
+
+[start=4]
+. 让 "Create Main Class"(创建主类)复选框保持选中状态,然后将主类名更改为 ``jnidemojava.Main`` 。
image::images/jni-new-java-app.png[]
-5. 单击 "Finish"(完成)。
+
+[start=5]
+. 单击 "Finish"(完成)。
IDE 将创建 ``NetBeansProjects/JNIDemoJava`` 项目文件夹。
@@ -112,8 +102,12 @@
new Main().nativePrint();
----
-3. 请注意左旁注中显示错误和灯泡的指示符。单击该指示符,系统将会提示您一个快捷键,用于创建方法 ``nativePrint`` 。
-4. 单击此快捷键,IDE 将会插入以下代码:
+
+[start=3]
+. 请注意左旁注中显示错误和灯泡的指示符。单击该指示符,系统将会提示您一个快捷键,用于创建方法 ``nativePrint`` 。
+
+[start=4]
+. 单击此快捷键,IDE 将会插入以下代码:
[source,java]
----
@@ -122,14 +116,18 @@
throw new UnsupportedOperationException("Not supported yet");
}
----
-5. 删除以下行
+
+[start=5]
+. 删除以下行
[source,java]
----
throw new UnsupportedOperationException("Not supported yet");
----
-6. 通过将 ``native`` 关键字插入方法签名中来修改 ``nativePrint()`` 方法,使其现在看起来如下所示:
+
+[start=6]
+. 通过将 ``native`` 关键字插入方法签名中来修改 ``nativePrint()`` 方法,使其现在看起来如下所示:
[source,java]
----
@@ -152,7 +150,9 @@
private native void nativePrint();
}
----
-7. 右键单击项目名称,然后选择 "Clean and Build"(清理并构建)。项目应该成功构建。
+
+[start=7]
+. 右键单击项目名称,然后选择 "Clean and Build"(清理并构建)。项目应该成功构建。
=== 创建本机库头文件
@@ -171,7 +171,9 @@
``JNIDemoJava.h`` C 头文件是在 NetBeansProjects 目录中生成的。需要此文件才能为 ``nativePrint()`` 方法的本机实现提供正确的函数声明。您在以后创建此应用程序的 C 部分时需要用到它。
-3. 切换回 NetBeans IDE 窗口。
+
+[start=3]
+. 切换回 NetBeans IDE 窗口。
*小结*
@@ -186,9 +188,15 @@
1. 选择 "File"(文件)> "New Project"(新建项目)。在 "Categories"(类别)下,选择 "C/C++"。在 "Projects"(项目)下,选择 "C/C++ Dynamic Library"(C/C++ 动态库)。单击 "Next"(下一步)。
image::images/jni-new-project-c.png[]
-2. 在 "Project Name"(项目名称)字段中,键入 ``JNIDemoCdl`` 。
-3. 在 "Project Location"(项目位置)字段中,使用 Java 应用程序项目所用的相同位置,即 ``NetBeansProjects`` 。该位置应显示为默认值。
-4. 接受所有其他字段的默认值,然后单击 "Finish"(完成)。
+
+[start=2]
+. 在 "Project Name"(项目名称)字段中,键入 ``JNIDemoCdl`` 。
+
+[start=3]
+. 在 "Project Location"(项目位置)字段中,使用 Java 应用程序项目所用的相同位置,即 ``NetBeansProjects`` 。该位置应显示为默认值。
+
+[start=4]
+. 接受所有其他字段的默认值,然后单击 "Finish"(完成)。
IDE 将创建 ``NetBeansProjects/JNIDemoCdl`` 项目文件夹。
@@ -205,13 +213,19 @@
从 C 代码中启用对 Java ``jni.h`` 库的引用时需要这些设置。
-7. 找到 "C Compiler"(C 编译器)选项的 "Compilation Line"(编译行)区域。单击 "Additional Options"(其他选项)属性的文本字段,然后键入 ``-shared -m32`` 。image::images/jni-project-properties-cmd-options.png[]
+
+[start=7]
+. 找到 "C Compiler"(C 编译器)选项的 "Compilation Line"(编译行)区域。单击 "Additional Options"(其他选项)属性的文本字段,然后键入 ``-shared -m32`` 。image::images/jni-project-properties-cmd-options.png[]
``-shared`` 选项用于通知编译器生成动态库。
``-m32`` 选项用于通知编译器创建 32 位二进制文件。默认情况下,在 64 位系统上,已编译二进制文件是 64 位的,这会导致很多与 32 位 JDK 相关的问题。
-8. 单击左面板中的 "Linker"(链接器)类别。
-9. 单击 "Output"(输出)文本字段,然后将字符串
+
+[start=8]
+. 单击左面板中的 "Linker"(链接器)类别。
+
+[start=9]
+. 单击 "Output"(输出)文本字段,然后将字符串
[source,java]
----
@@ -227,7 +241,9 @@
----
以简化生成的共享对象文件的路径。这将简化从 Java 引用文件的过程。
image::images/jni-project-properties-linker.png[]
-10. 单击 "OK"(确定)。此时将保存已定义的设置。
+
+[start=10]
+. 单击 "OK"(确定)。此时将保存已定义的设置。
=== 添加头文件
@@ -262,8 +278,12 @@
}
----
-3. 保存 ``JNIDemo.c`` 文件。
-4. 右键单击 ``JNIDemoCdl`` 项目节点,然后选择 "Build"(构建)。"Output"(输出)窗口将显示 ``BUILD SUCCESSFUL (total time 171ms)`` (构建成功(总时间为 171 毫秒))或类似内容。
+
+[start=3]
+. 保存 ``JNIDemo.c`` 文件。
+
+[start=4]
+. 右键单击 ``JNIDemoCdl`` 项目节点,然后选择 "Build"(构建)。"Output"(输出)窗口将显示 ``BUILD SUCCESSFUL (total time 171ms)`` (构建成功(总时间为 171 毫秒))或类似内容。
*小结*
@@ -289,7 +309,9 @@
----
将 _full-path-to-NetBeansProjects-dir_ 替换为 NetBeansProjects 目录的路径,该路径应类似于 ``/home/_username_/NetBeansProjects``
-3. 保存 ``Main.java`` 文件。
+
+[start=3]
+. 保存 ``Main.java`` 文件。
=== 运行 JNIDemoJava 应用程序
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test.asciidoc
index 5cf91d4..9cc76ea 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test.asciidoc
@@ -33,35 +33,6 @@
March 2014_ [Revision number: V8.0-1]
-=== Contents
-
-image::images/netbeans-stamp-80-74.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-|===
-|- |<<requirements,Requirements>>
-
-|- |<<intro,Introduction>>
-
-|- |<<cunit,Install the CUnit Testing Framework>>
-
-|- |<<project,Create the Project for the Tutorial>>
-
-|- |<<addtest,Add CUnit Tests to the NetBeans Managed Project>>
-
-|- |<<runtest,Run the CUnit Test>>
-
-|- |<<addmore, Add Another CUnit Test>>
-
-|- |<<debug,Debug a Test>>
-
-|- |<<addsimple,Add a Simple Test>>
-
-|- |<<editsimple,Edit the Simple Test>>
-
-|- |<<commandline,Run Tests From the Command Line>>
-|===
-
-
== Requirements
*To follow this tutorial, you need the following software.*
@@ -130,7 +101,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. Configure, build, and install CUinit from /tmp as follows:
+
+[start=3]
+. Configure, build, and install CUinit from /tmp as follows:
[source,shell]
----
@@ -173,7 +146,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. Configure, build, and install CUinit from /tmp as follows:
+
+[start=3]
+. Configure, build, and install CUinit from /tmp as follows:
[source,shell]
----
@@ -203,7 +178,9 @@
$ tar xvf CUnit-2.1-2-src.tar
$ cd ./CUnit-2.1-2
----
-4. Find the Unix path to MinGW using the mount command.
+
+[start=4]
+. Find the Unix path to MinGW using the mount command.
[source,shell]
----
@@ -221,7 +198,9 @@
*C:\MinGW on /mingw type user (binmode)*
----
The last line in bold above shows the Unix path is /mingw. Your system may report something different, so make a note of it because you need to specify the path in the next command.
-5. Configure the Makefile with the following command.
+
+[start=5]
+. Configure the Makefile with the following command.
If your MinGW is not in /mingw, be sure to specify the appropriate Unix location of your MinGW with the --prefix= option.
[source,shell]
@@ -234,7 +213,9 @@
config.status: executing libtool commands
----
-6. Build the library for CUnit:
+
+[start=6]
+. Build the library for CUnit:
[source,shell]
----
@@ -248,7 +229,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-7. Install the CUnit library into C:/MinGW/include/CUnit, C:/MinGW/share/CUnit and C:/MinGW/doc/CUnit by running make install:
+
+[start=7]
+. Install the CUnit library into C:/MinGW/include/CUnit, C:/MinGW/share/CUnit and C:/MinGW/doc/CUnit by running make install:
[source,shell]
----
@@ -263,7 +246,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-8. If you use Java 7 update 21, 25, or 40 you must perform the following workaround due to link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+issue 236867+] in order to get CUnit and this tutorial to work.
+
+[start=8]
+. If you use Java 7 update 21, 25, or 40 you must perform the following workaround due to link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+issue 236867+] in order to get CUnit and this tutorial to work.
1. Go to Tools > Options > C/C++ > Build Tools and select the MinGW tool collection.
2. Change the Make Command entry to make.exe without a complete path.
@@ -295,10 +280,16 @@
2. In the project wizard, click C/C++ and then select C/C++ Application.
3. In the New C/C++ Application dialog box, select Create Main file and select the C language. Accept the defaults for all other options.
image::images/c-unit-new-project.png[]
-4. Click Finish, and the Cpp_Application__x_ project is created.
-5. In the Projects window, open the Source Files folder and double-click the `main.c` file to open it in the editor. The file's content is similar to that shown here:
+
+[start=4]
+. Click Finish, and the Cpp_Application__x_ project is created.
+
+[start=5]
+. In the Projects window, open the Source Files folder and double-click the `main.c` file to open it in the editor. The file's content is similar to that shown here:
image::images/c-unit-mainc-initial.png[]
-6. To give the program something to do, replace the code in the `main.c` file with the following code to create a simple factorial calculator:
+
+[start=6]
+. To give the program something to do, replace the code in the `main.c` file with the following code to create a simple factorial calculator:
[source,c]
----
@@ -331,8 +322,12 @@
The file should look as follows after editing:
image::images/c-unit-mainc-edited.png[]
-7. Save the file by pressing Ctrl+S.
-8. Build and run the project to make sure it works by clicking the Run button in the IDE toolbar.
+
+[start=7]
+. Save the file by pressing Ctrl+S.
+
+[start=8]
+. Build and run the project to make sure it works by clicking the Run button in the IDE toolbar.
The output should look similar to the following if you enter 8 as the integer:
image::images/c-unit-output-factorial.png[]
@@ -350,15 +345,25 @@
A wizard opens to help you create the test.
-2. In the wizard's Select Elements window, click the checkbox for the `main` function. This causes all the functions within `main` to also be selected. In this program, there is only one other function, `factorial()`.
-3. Click Next.
-4. Keep the default name New CUnit Test and click Finish.
+
+[start=2]
+. In the wizard's Select Elements window, click the checkbox for the `main` function. This causes all the functions within `main` to also be selected. In this program, there is only one other function, `factorial()`.
+
+[start=3]
+. Click Next.
+
+[start=4]
+. Keep the default name New CUnit Test and click Finish.
The New CUnit Test node is displayed under the Test Files folder.
The New CUnit Test folder contains the template files for the test. You can add new files to the folder the same way you add source files to a project, by right-clicking the folder.
-5. Expand the New CUnit Test folder, and see that it contains a file `newcunittest.c` which should be open in the source editor.
-6. In the `newcunittest.c` file, notice the `#include "CUnit/Basic.h"` statement to access the CUnit library. The `newcunittest.c` file contains an automatically generated test function, `testFactorial`, for the `factorial()` function of `main.c`.
+
+[start=5]
+. Expand the New CUnit Test folder, and see that it contains a file `newcunittest.c` which should be open in the source editor.
+
+[start=6]
+. In the `newcunittest.c` file, notice the `#include "CUnit/Basic.h"` statement to access the CUnit library. The `newcunittest.c` file contains an automatically generated test function, `testFactorial`, for the `factorial()` function of `main.c`.
image::images/c-unit-includes.png[]
@@ -380,12 +385,20 @@
If you do not see the Test Results window, open it by choosing Window > IDE Tools > Test Results or by pressing Alt+Shift+R.
image::images/c-unit-run-test-orig.png[]
-2. Notice that the Test Results window is split into two panels.
+
+[start=2]
+. Notice that the Test Results window is split into two panels.
The right panel displays the console output from the tests. The left panel displays a summary of the passed and failed tests and the description of failed tests.
-3. In the Test Results window, double-click the node `testFactorial caused an ERROR` to jump to the `testFactorial` function in the source editor.
+
+[start=3]
+. In the Test Results window, double-click the node `testFactorial caused an ERROR` to jump to the `testFactorial` function in the source editor.
If you look at the function you can see that it does not actually test anything, but merely asserts that the unit test failed by setting CU_ASSERT(0). The condition evaluates to 0, which is equivalent to FALSE, so the CUnit framework interprets this as a test failure.
-4. Change the line CU_ASSERT(0) to CU_ASSERT(1) and save the file (Ctrl+S).
-5. Run the test again by right-clicking the New CUnit Test folder and selecting Test.
+
+[start=4]
+. Change the line CU_ASSERT(0) to CU_ASSERT(1) and save the file (Ctrl+S).
+
+[start=5]
+. Run the test again by right-clicking the New CUnit Test folder and selecting Test.
The Test Results window should indicate that the test passed.
image::images/c-unit-run-test-pass.png[]
@@ -394,10 +407,16 @@
1. Create a generic CUnit test template by right-clicking the Test Files folder and selecting New CUnit Test.
image::images/c-unit-new-cunit-test.png[]
-2. Name the test My CUnit Test and the test file name `mycunittest` and click Finish.
+
+[start=2]
+. Name the test My CUnit Test and the test file name `mycunittest` and click Finish.
image::images/c-unit-create-mycunittest.png[]
-3. A new test folder called My CUnit Test is created and it contains a `mycunittest.c` file, which opens in the editor.
-4. Examine the `mycunittest.c` test file and see that it contains two tests. test1 will pass because it evaluates to TRUE, and test2 will fail because it evaluates to FALSE since 2*2 does not equal 5.
+
+[start=3]
+. A new test folder called My CUnit Test is created and it contains a `mycunittest.c` file, which opens in the editor.
+
+[start=4]
+. Examine the `mycunittest.c` test file and see that it contains two tests. test1 will pass because it evaluates to TRUE, and test2 will fail because it evaluates to FALSE since 2*2 does not equal 5.
[source,java]
----
@@ -411,12 +430,20 @@
CU_ASSERT(2*2 == 5);
}
----
-5. Run the test as before and you should see:
+
+[start=5]
+. Run the test as before and you should see:
image::images/c-unit-run-mytest1.png[]
-6. Run all the tests from the IDE main menu by selecting Run > Test Project (Cpp_Application__x_) and see that both test suites run and display their success and failure in the Test Results window.
-7. Mouse over the failed test to see more information about the failure.
+
+[start=6]
+. Run all the tests from the IDE main menu by selecting Run > Test Project (Cpp_Application__x_) and see that both test suites run and display their success and failure in the Test Results window.
+
+[start=7]
+. Mouse over the failed test to see more information about the failure.
image::images/c-unit-test-fail-annotation.png[]
-8. Click the buttons in the left margin of the Test Results window to show and hide tests that pass or fail.
+
+[start=8]
+. Click the buttons in the left margin of the Test Results window to show and hide tests that pass or fail.
== Debug My CUnit Test
@@ -429,9 +456,13 @@
The debugger toolbar is displayed.
-2. Click the Step Into button to execute the program one statement at a time with each click of the button.
+
+[start=2]
+. Click the Step Into button to execute the program one statement at a time with each click of the button.
image::images/c-unit-debug-icons.png[]
-3. Open the Call Stack window by selecting Window > Debugging > Call Stack so you can watch the function calls as you step through the test.
+
+[start=3]
+. Open the Call Stack window by selecting Window > Debugging > Call Stack so you can watch the function calls as you step through the test.
== Add a Simple Test
@@ -440,15 +471,23 @@
1. In the Projects window, right-click the ``main.c`` source file and select Create Test > New C Simple Test.
image::images/c-unit-mainc-new-simple-test.png[]
-2. In the wizard's Select Elements window, click the checkbox for the ``main`` function, then click Next.
+
+[start=2]
+. In the wizard's Select Elements window, click the checkbox for the ``main`` function, then click Next.
image::images/c-unit-mainc-new-simple-test-select.png[]
-3. In the Name and Location window, keep the default name New C Simple Test and click Finish.
+
+[start=3]
+. In the Name and Location window, keep the default name New C Simple Test and click Finish.
The New C Simple Test node is displayed under the Test Files folder.
-4. Expand the New C Simple Test folder, and see that it contains a file `newsimpletest.c`. This file should be open in the source editor.
+
+[start=4]
+. Expand the New C Simple Test folder, and see that it contains a file `newsimpletest.c`. This file should be open in the source editor.
image::images/c-unit-mainc-new-simple-test-folder.png[]
-5. Notice the `newsimpletest.c` file contains an automatically generated test function, `testFactorial`, for the `factorial()` function of `main.c`, just as with the CUnit test.
+
+[start=5]
+. Notice the `newsimpletest.c` file contains an automatically generated test function, `testFactorial`, for the `factorial()` function of `main.c`, just as with the CUnit test.
image::images/c-unit-mainc-new-simple-test-code.png[]
The ``if`` statement should test a condition that, if true, indicates that the test failed. The ``%%TEST_FAILED%%`` token triggers display of the graphical indicator of test failures in the Test Results window. The ``if`` statement in the generated test sets the condition to be true by setting it to 1, so the test always fails when you run it unmodified.
@@ -459,7 +498,9 @@
The ``message`` option enables you to make the test print out a message about the test failure.
-6. Run the test to see that it generates a failure shown in the Test Results window.
+
+[start=6]
+. Run the test to see that it generates a failure shown in the Test Results window.
Next you edit the test file to see tests that pass.
@@ -483,7 +524,9 @@
The `main` function must also be modified to call the new test function.
-2. In the `main` function, copy the lines:
+
+[start=2]
+. In the `main` function, copy the lines:
[source,java]
----
@@ -493,7 +536,9 @@
printf("%%TEST_FINISHED%% time=0 testFactorial (newsimpletest)\n");
----
-3. Paste the lines immediately below the ones you copied, and change the name `testFactorial` to `testNew` in the pasted lines. There are three occurrences that need to be changed.
+
+[start=3]
+. Paste the lines immediately below the ones you copied, and change the name `testFactorial` to `testNew` in the pasted lines. There are three occurrences that need to be changed.
The complete `newsimpletest.c` file should look as follows:
[source,c]
@@ -545,7 +590,9 @@
----
-4. In the Projects window, run the test by right-clicking New C Simple Test and choosing Test.
+
+[start=4]
+. In the Projects window, run the test by right-clicking New C Simple Test and choosing Test.
The Test Results should look as follows:
image::images/c-unit-simpletest-results.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ja.asciidoc
index e9657d0..24c12ab 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ja.asciidoc
@@ -34,33 +34,6 @@
-image::images/netbeans-stamp-80-74.png[title="このページの内容は、NetBeans IDE 7.4および8.0に適用されます"]
-
-|===
-|- |<<requirements,要件>>
-
-|- |<<intro,概要>>
-
-|- |<<cunit,CUnitテスト・フレームワークのインストール>>
-
-|- |<<project,チュートリアル用のプロジェクトの作成>>
-
-|- |<<addtest,CUnitテストのNetBeans管理対象プロジェクトへの追加>>
-
-|- |<<runtest,CUnitテストの実行>>
-
-|- |<<addmore,別のCUnitテストの追加>>
-
-|- |<<debug,テストのデバッグ>>
-
-|- |<<addsimple,簡易テストの追加>>
-
-|- |<<editsimple,簡易テストの編集>>
-
-|- |<<commandline,コマンドラインからのテストの実行>>
-|===
-
-
== 要件
*このチュートリアルに従うには、次のソフトウェアが必要です。*
@@ -128,7 +101,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. 次のようにCUinitを/tmpから構成、ビルドおよびインストールします。
+
+[start=3]
+. 次のようにCUinitを/tmpから構成、ビルドおよびインストールします。
[source,shell]
----
@@ -171,7 +146,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. 次のようにCUinitを/tmpから構成、ビルドおよびインストールします。
+
+[start=3]
+. 次のようにCUinitを/tmpから構成、ビルドおよびインストールします。
[source,shell]
----
@@ -201,7 +178,9 @@
$ tar xvf CUnit-2.1-2-src.tar
$ cd ./CUnit-2.1-2
----
-4. mountコマンドを使用して、MinGWへのUNIXパスを検索します。
+
+[start=4]
+. mountコマンドを使用して、MinGWへのUNIXパスを検索します。
[source,shell]
----
@@ -219,7 +198,9 @@
*C:\MinGW on /mingw type user (binmode)*
----
前述の太字の最終行は、UNIXパスが/mingwであることを示しています。システムでは異なる結果が示される場合があるため、これを書き留めておいてください。これは、次のコマンドでパスを指定する必要があるためです。
-5. 次のコマンドを使用して、Makefileを構成します。
+
+[start=5]
+. 次のコマンドを使用して、Makefileを構成します。
MinGWが/mingw内にない場合は、必ず、該当するMinGWのUNIXロケーションを、--prefix=オプションを使用して指定します。
[source,shell]
@@ -232,7 +213,9 @@
config.status: executing libtool commands
----
-6. CUnitのライブラリをビルドします。
+
+[start=6]
+. CUnitのライブラリをビルドします。
[source,shell]
----
@@ -246,7 +229,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-7. make installを実行して、CUnitライブラリをC:/MinGW/include/CUnit、C:/MinGW/share/CUnitおよびC:/MinGW/doc/CUnit内にインストールします。
+
+[start=7]
+. make installを実行して、CUnitライブラリをC:/MinGW/include/CUnit、C:/MinGW/share/CUnitおよびC:/MinGW/doc/CUnit内にインストールします。
[source,shell]
----
@@ -261,7 +246,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-8. Java 7アップデート21、25または40を使用する場合、CUnitを取得してこのチュートリアルを機能させるために、link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+issue 236867+]の原因による次の回避策を実行する必要があります。
+
+[start=8]
+. Java 7アップデート21、25または40を使用する場合、CUnitを取得してこのチュートリアルを機能させるために、link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+issue 236867+]の原因による次の回避策を実行する必要があります。
1. 「ツール」>「オプション」>「C/C++」>「ビルド・ツール」と選択して、MinGWツール・コレクションを選択します。
2. Makeコマンド・エントリを、完全パスのないmake.exeに変更します。
@@ -293,10 +280,16 @@
2. プロジェクト・ウィザードで、「C/C++」をクリックしてから「C/C++アプリケーション」を選択します。
3. 「新規C/C++アプリケーション」ダイアログ・ボックスで、「mainファイルの作成」を選択してから、C言語を選択します。他のすべてのオプションはデフォルトを受け入れます。
image::images/c-unit-new-project.png[]
-4. 「終了」をクリックするとCpp_Application__x_プロジェクトが作成されます。
-5. 「プロジェクト」ウィンドウで、「ソース・ファイル」フォルダを開いて`main.c`ファイルをダブルクリックし、エディタでそのファイルを開きます。ファイルの内容はここに示す内容と同様です。
+
+[start=4]
+. 「終了」をクリックするとCpp_Application__x_プロジェクトが作成されます。
+
+[start=5]
+. 「プロジェクト」ウィンドウで、「ソース・ファイル」フォルダを開いて`main.c`ファイルをダブルクリックし、エディタでそのファイルを開きます。ファイルの内容はここに示す内容と同様です。
image::images/c-unit-mainc-initial.png[]
-6. プログラムに処理を与えるには、`main.c`ファイル内のコードを次のコードに置き換えて、単純な階乗カリキュレータを作成します。
+
+[start=6]
+. プログラムに処理を与えるには、`main.c`ファイル内のコードを次のコードに置き換えて、単純な階乗カリキュレータを作成します。
[source,c]
----
@@ -329,8 +322,12 @@
ファイルは編集後に次のようになります。
image::images/c-unit-mainc-edited.png[]
-7. [Ctrl]+[S]を押してファイルを保存します。
-8. IDEツールバーの「実行」ボタンをクリックすることで、機能することを確かめるためにプロジェクトをビルドおよび実行します。
+
+[start=7]
+. [Ctrl]+[S]を押してファイルを保存します。
+
+[start=8]
+. IDEツールバーの「実行」ボタンをクリックすることで、機能することを確かめるためにプロジェクトをビルドおよび実行します。
出力は、8を整数として入力した場合、次のようになります。
image::images/c-unit-output-factorial.png[]
@@ -348,15 +345,25 @@
テストを作成するためのウィザードが開かれます。
-2. ウィザードの「要素を選択」ウィンドウで、`main`関数のチェックボックスをクリックします。これによって、`main`内の関数もすべて選択されます。このプログラムでは、他の関数は`factorial()`の1つだけです。
-3. 「次」をクリックします。
-4. デフォルト名の新規CUnitテストを保持して、「終了」をクリックします。
+
+[start=2]
+. ウィザードの「要素を選択」ウィンドウで、`main`関数のチェックボックスをクリックします。これによって、`main`内の関数もすべて選択されます。このプログラムでは、他の関数は`factorial()`の1つだけです。
+
+[start=3]
+. 「次」をクリックします。
+
+[start=4]
+. デフォルト名の新規CUnitテストを保持して、「終了」をクリックします。
「新規CUnitテスト」ノードが「テスト・ファイル」フォルダの下に表示されます。
「新規CUnitテスト」フォルダにはテストのテンプレート・ファイルが含まれます。ソース・ファイルをプロジェクトに追加するのと同じように、フォルダを右クリックすることで新しいファイルをフォルダに追加できます。
-5. 「新規CUnitテスト」フォルダを展開すると、`newcunittest.c`ファイルが含まれていることが示され、ソース・エディタに表示されます。
-6. `newcunittest.c`ファイルで、CUnitライブラリにアクセスするための`#include "CUnit/Basic.h"`文に注意します。`newcunittest.c`ファイルには、`main.c`の`factorial()`関数に対して自動生成されたテスト関数、`testFactorial`が含まれます。
+
+[start=5]
+. 「新規CUnitテスト」フォルダを展開すると、`newcunittest.c`ファイルが含まれていることが示され、ソース・エディタに表示されます。
+
+[start=6]
+. `newcunittest.c`ファイルで、CUnitライブラリにアクセスするための`#include "CUnit/Basic.h"`文に注意します。`newcunittest.c`ファイルには、`main.c`の`factorial()`関数に対して自動生成されたテスト関数、`testFactorial`が含まれます。
image::images/c-unit-includes.png[]
@@ -378,12 +385,20 @@
「テスト結果」ウィンドウが表示されない場合、「ウィンドウ」→「IDEツール」→「テスト結果」を選択するか、[Alt]+[Shift]+[R]を押して開きます。
image::images/c-unit-run-test-orig.png[]
-2. 「テスト結果」ウィンドウが2つのパネルに分割されていることに注意してください。
+
+[start=2]
+. 「テスト結果」ウィンドウが2つのパネルに分割されていることに注意してください。
右側のパネルにはテストからのコンソール出力が表示されます。左側のパネルには、成功したテストと失敗したテスト、さらに失敗したテストの詳細のサマリーが表示されます。
-3. 「テスト結果」ウィンドウで、`testFactorial caused an ERROR`ノードをダブルクリックして、ソース・エディタの`testFactorial`関数にジャンプします。
+
+[start=3]
+. 「テスト結果」ウィンドウで、`testFactorial caused an ERROR`ノードをダブルクリックして、ソース・エディタの`testFactorial`関数にジャンプします。
関数を参照すると、実際には何かがテストされたのではなく、CU_ASSERT(0)の設定によって単体テストが失敗したと単純にアサーションしていることが示されます。条件は0に評価され、これはFALSEに相当するため、CUnitフレームワークではこれがテストの失敗として解釈されます。
-4. CU_ASSERT(0)行をCU_ASSERT(1)に変更して、ファイルを保存します([Ctrl]+[S])。
-5. 「新規CUnitテスト」フォルダを右クリックして「テスト」を選択することで、テストを再実行します。
+
+[start=4]
+. CU_ASSERT(0)行をCU_ASSERT(1)に変更して、ファイルを保存します([Ctrl]+[S])。
+
+[start=5]
+. 「新規CUnitテスト」フォルダを右クリックして「テスト」を選択することで、テストを再実行します。
「テスト結果」ウィンドウにテストが成功したことが示されます。
image::images/c-unit-run-test-pass.png[]
@@ -392,10 +407,16 @@
1. 「テスト・ファイル」フォルダを右クリックして新規CUnitテストを選択することで、汎用CUnitテスト・テンプレートを作成します。
image::images/c-unit-new-cunit-test.png[]
-2. テストはMy CUnit Test、テスト・ファイル名は`mycunittest`という名前を付けて「終了」をクリックします。
+
+[start=2]
+. テストはMy CUnit Test、テスト・ファイル名は`mycunittest`という名前を付けて「終了」をクリックします。
image::images/c-unit-create-mycunittest.png[]
-3. My CUnit Testという新規テスト・フォルダが作成されて、そのフォルダには`mycunittest.c`ファイルが含まれ、エディタに表示されます。
-4. `mycunittest.c`テスト・ファイルを調べると、2つのテストが含まれています。test1はTRUEに評価されるため、成功します。test2は、2*2が5と等しくないためFALSEに評価されて失敗します。
+
+[start=3]
+. My CUnit Testという新規テスト・フォルダが作成されて、そのフォルダには`mycunittest.c`ファイルが含まれ、エディタに表示されます。
+
+[start=4]
+. `mycunittest.c`テスト・ファイルを調べると、2つのテストが含まれています。test1はTRUEに評価されるため、成功します。test2は、2*2が5と等しくないためFALSEに評価されて失敗します。
[source,java]
----
@@ -409,12 +430,20 @@
CU_ASSERT(2*2 == 5);
}
----
-5. 前と同じようにテストを実行すると次のように表示されます。
+
+[start=5]
+. 前と同じようにテストを実行すると次のように表示されます。
image::images/c-unit-run-mytest1.png[]
-6. 「実行」>「プロジェクトのテスト」(Cpp_Application__x_)を選択してIDEメイン・メニューからすべてのテストを実行します。両方のテスト・スイートが実行され、「テスト結果」ウィンドウに成功および失敗が表示されるのを確認します。
-7. 失敗の詳細を表示するには、失敗したテストの上にマウスを移動します。
+
+[start=6]
+. 「実行」>「プロジェクトのテスト」(Cpp_Application__x_)を選択してIDEメイン・メニューからすべてのテストを実行します。両方のテスト・スイートが実行され、「テスト結果」ウィンドウに成功および失敗が表示されるのを確認します。
+
+[start=7]
+. 失敗の詳細を表示するには、失敗したテストの上にマウスを移動します。
image::images/c-unit-test-fail-annotation.png[]
-8. 「テスト結果」ウィンドウの左マージンのボタンをクリックして、成功または失敗したテストを表示または非表示にします。
+
+[start=8]
+. 「テスト結果」ウィンドウの左マージンのボタンをクリックして、成功または失敗したテストを表示または非表示にします。
== My CUnit Testのデバッグ
@@ -427,9 +456,13 @@
デバッガ・ツールバーが表示されます。
-2. 「ステップ・イン」ボタンをクリックして、ボタンをクリックするたびに1回で1行、プログラムを実行します。
+
+[start=2]
+. 「ステップ・イン」ボタンをクリックして、ボタンをクリックするたびに1回で1行、プログラムを実行します。
image::images/c-unit-debug-icons.png[]
-3. 「ウィンドウ」>「デバッグ」>「呼出しスタック」を選択して「呼出しスタック」ウィンドウを開きます。これによって、テストの進行に従った関数の呼出しを参照できます。
+
+[start=3]
+. 「ウィンドウ」>「デバッグ」>「呼出しスタック」を選択して「呼出しスタック」ウィンドウを開きます。これによって、テストの進行に従った関数の呼出しを参照できます。
== 簡易テストの追加
@@ -438,15 +471,23 @@
1. 「プロジェクト」ウィンドウで、 ``main.c`` ソース・ファイルを右クリックし、「テストを作成」>新規C簡易テストを選択します。
image::images/c-unit-mainc-new-simple-test.png[]
-2. ウィザードの「要素を選択」ウィンドウで、 ``main`` 関数のチェックボックスをクリックしてから、「次」をクリックします。
+
+[start=2]
+. ウィザードの「要素を選択」ウィンドウで、 ``main`` 関数のチェックボックスをクリックしてから、「次」をクリックします。
image::images/c-unit-mainc-new-simple-test-select.png[]
-3. 「名前と場所」ウィンドウで、デフォルト名の新規C簡易テストを保持して、「終了」をクリックします。
+
+[start=3]
+. 「名前と場所」ウィンドウで、デフォルト名の新規C簡易テストを保持して、「終了」をクリックします。
「新規C簡易テスト」ノードが「テスト・ファイル」フォルダの下に表示されます。
-4. 「新規C簡易テスト」フォルダを展開すると、`newsimpletest.c`ファイルが含まれていることが示されます。このファイルはソース・エディタで開かれます。
+
+[start=4]
+. 「新規C簡易テスト」フォルダを展開すると、`newsimpletest.c`ファイルが含まれていることが示されます。このファイルはソース・エディタで開かれます。
image::images/c-unit-mainc-new-simple-test-folder.png[]
-5. `newsimpletest.c`ファイルには、CUnitと同様に、`main.c`の`factorial()`関数に対して自動生成されたテスト関数、`testFactorial`が含まれることに注意してください。
+
+[start=5]
+. `newsimpletest.c`ファイルには、CUnitと同様に、`main.c`の`factorial()`関数に対して自動生成されたテスト関数、`testFactorial`が含まれることに注意してください。
image::images/c-unit-mainc-new-simple-test-code.png[]
``if`` 文は、trueの場合は、テストが失敗したことを示す条件をテストする必要があります。 ``%%TEST_FAILED%%`` トークンは、「テスト結果」ウィンドウでのテスト失敗のグラフィカル・インジケータの表示をトリガーします。生成されたテスト内の ``if`` 文は、1に設定することで条件をtrueに設定するため、未変更のまま実行するとテストは常に失敗します。
@@ -457,7 +498,9 @@
``message`` オプションを使用すると、テスト失敗に関するメッセージをテストで出力できます。
-6. テストを実行し、「テスト結果」ウィンドウに表示される失敗が生成されることを確認します。
+
+[start=6]
+. テストを実行し、「テスト結果」ウィンドウに表示される失敗が生成されることを確認します。
次に、成功したテストを参照するためにテスト・ファイルを編集します。
@@ -481,7 +524,9 @@
新規テスト関数を呼び出すように、`main`関数も変更する必要があります。
-2. `main`関数で、次の行をコピーします。
+
+[start=2]
+. `main`関数で、次の行をコピーします。
[source,java]
----
@@ -491,7 +536,9 @@
printf("%%TEST_FINISHED%% time=0 testFactorial (newsimpletest)\n");
----
-3. その行を、コピーした行のすぐ下に貼り付けて、貼り付けられた行で`testFactorial`を`testNew`に名前を変更します。変更が必要な箇所は3箇所あります。
+
+[start=3]
+. その行を、コピーした行のすぐ下に貼り付けて、貼り付けられた行で`testFactorial`を`testNew`に名前を変更します。変更が必要な箇所は3箇所あります。
完全な`newsimpletest.c`ファイルは次のようになります。
[source,c]
@@ -543,7 +590,9 @@
----
-4. 「プロジェクト」ウィンドウで、新規C簡易テストを右クリックして「テスト」を選択することで、テストを実行します。
+
+[start=4]
+. 「プロジェクト」ウィンドウで、新規C簡易テストを右クリックして「テスト」を選択することで、テストを実行します。
テスト結果は次のようになります。
image::images/c-unit-simpletest-results.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_pt_BR.asciidoc
index 164a7a5..2a449ff 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_pt_BR.asciidoc
@@ -34,33 +34,6 @@
-image::images/netbeans-stamp-80-74.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.4 e 8.0"]
-
-|===
-|- |<<requirements,Requisitos>>
-
-|- |<<intro,Introdução>>
-
-|- |<<cunit,Instalar o Framework de Teste CUnit>>
-
-|- |<<project,Criar o Projeto para o Tutorial>>
-
-|- |<<addtest,Adicionar Testes de CUnit ao Projeto Gerenciado do NetBeans>>
-
-|- |<<runtest,Executar o Teste CUnit>>
-
-|- |<<addmore, Adicionar Outro Teste CUnit>>
-
-|- |<<debug,Depurar um Teste>>
-
-|- |<<addsimple,Adicionar um Teste Simples>>
-
-|- |<<editsimple,Editar o Teste Simples>>
-
-|- |<<commandline,Executar Testes da Linha de Comandos>>
-|===
-
-
== Requisitos
*Para seguir este tutorial, você precisa do software a seguir.*
@@ -129,7 +102,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. Configure, crie e instale CUinit de /tmp, como segue:
+
+[start=3]
+. Configure, crie e instale CUinit de /tmp, como segue:
[source,shell]
----
@@ -172,7 +147,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. Configure, crie e instale CUinit de /tmp, como segue:
+
+[start=3]
+. Configure, crie e instale CUinit de /tmp, como segue:
[source,shell]
----
@@ -202,7 +179,9 @@
$ tar xvf CUnit-2.1-2-src.tar
$ cd ./CUnit-2.1-2
----
-4. Localize o caminho do Unix para MinGW usando o comando mount.
+
+[start=4]
+. Localize o caminho do Unix para MinGW usando o comando mount.
[source,shell]
----
@@ -220,7 +199,9 @@
*C:\MinGW on /mingw type user (binmode)*
----
A última linha em negrito acima mostra que o caminho UNIX é /mingw. Seu sistema pode reportar algo diferente, então anote porque talvez você precise especificar o caminho no próximo comando.
-5. Configure o Makefile com o seguinte comando.
+
+[start=5]
+. Configure o Makefile com o seguinte comando.
Se seu MinGW não estiver em /mingw, certifique-se de especificar a localização de Unix apropriada de seu MinGW com a opção --prefix=.
[source,shell]
@@ -233,7 +214,9 @@
config.status: executing libtool commands
----
-6. Crie a biblioteca para CUnit:
+
+[start=6]
+. Crie a biblioteca para CUnit:
[source,shell]
----
@@ -247,7 +230,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-7. Instale a biblioteca CUnit em C:/MinGW/include/CUnit, C:/MinGW/share/CUnit e C:/MinGW/doc/CUnit executando make install:
+
+[start=7]
+. Instale a biblioteca CUnit em C:/MinGW/include/CUnit, C:/MinGW/share/CUnit e C:/MinGW/doc/CUnit executando make install:
[source,shell]
----
@@ -262,7 +247,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-8. Se usar a atualização 21, 25 ou 40 de Java execute a seguinte solução em decorrência do link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+problema 236867+] para obter CUnit e este tuturial funcionar.
+
+[start=8]
+. Se usar a atualização 21, 25 ou 40 de Java execute a seguinte solução em decorrência do link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+problema 236867+] para obter CUnit e este tuturial funcionar.
1. Vá para Ferramentas > Opções > C/C++ > Ferramentas de Construção e selecione o conjunto de ferramentas MinGW.
2. Altere a entrada do Comando Make para make.exe sem um caminho completo.
@@ -294,10 +281,16 @@
2. No assistente do projeto, clique em C/C++ e, em seguida, selecione a Aplicação C/C++.
3. Na caixa de diálogo Nova Aplicação C/C++, selecione Criar Arquivo Principal e selecione a linguagem C. Aceite os defaults para todas as outras opções.
image::images/c-unit-new-project.png[]
-4. Clique em Finalizar e o projeto Cpp_Application__x_ será criado.
-5. Na janela Projetos, abra a pasta Arquivos de Origem e clique duas vezes no arquivo `main.c` para abri-lo no editor. O conteúdo do arquivo é semelhante ao mostrado aqui:
+
+[start=4]
+. Clique em Finalizar e o projeto Cpp_Application__x_ será criado.
+
+[start=5]
+. Na janela Projetos, abra a pasta Arquivos de Origem e clique duas vezes no arquivo `main.c` para abri-lo no editor. O conteúdo do arquivo é semelhante ao mostrado aqui:
image::images/c-unit-mainc-initial.png[]
-6. Para fornecer algo para o programa fazer, substitua o código no arquivo `main.c` pelo seguinte código para criar uma calculadora fatorial simples:
+
+[start=6]
+. Para fornecer algo para o programa fazer, substitua o código no arquivo `main.c` pelo seguinte código para criar uma calculadora fatorial simples:
[source,c]
----
@@ -330,8 +323,12 @@
O arquivo deve parecer com o seguinte após a edição:
image::images/c-unit-mainc-edited.png[]
-7. Salve o arquivo pressionando Ctrl+S.
-8. Construa e execute o projeto para certificar-se de que ele funciona, clicando no botão Executar na barra de ferramentas IDE.
+
+[start=7]
+. Salve o arquivo pressionando Ctrl+S.
+
+[start=8]
+. Construa e execute o projeto para certificar-se de que ele funciona, clicando no botão Executar na barra de ferramentas IDE.
A saída deve ser semelhante ao seguinte, se você inserir 8 como inteiro:
image::images/c-unit-output-factorial.png[]
@@ -349,15 +346,25 @@
Um assistente é aberto para ajudá-lo a criar o teste.
-2. Na janela Selecionar Elementos do assistente, clique na caixa de seleção da função `principal`. Isso faz com que todas as funções dentro da `principal` também sejam selecionadas. Neste programa, há só uma outra função, `factorial()`.
-3. Clique em Próximo.
-4. Mantenha o nome default Novo Teste CUnit e clique em Finalizar.
+
+[start=2]
+. Na janela Selecionar Elementos do assistente, clique na caixa de seleção da função `principal`. Isso faz com que todas as funções dentro da `principal` também sejam selecionadas. Neste programa, há só uma outra função, `factorial()`.
+
+[start=3]
+. Clique em Próximo.
+
+[start=4]
+. Mantenha o nome default Novo Teste CUnit e clique em Finalizar.
O nó Novo Teste CUnit é exibido na pasta Arquivos de Teste.
A pasta Novo Teste CUnit contém os arquivos do modelo para o teste. Você pode adicionar novos arquivos à pasta da mesma forma que você adiciona arquivos em um projeto, clicando com o botão direito do mouse na pasta.
-5. Expanda a pasta Novo Teste CUnit e veja se ela contém um arquivo `newcunittest.c` que deve ser aberto no editor de origem.
-6. No arquivo `newcunittest.c`, observe a instrução `#include "CUnit/Basic.h"` para acessar a biblioteca CUnit. O arquivo `newcunittest.c` contém uma função de teste gerada automaticamente, `testFactorial`, para a função `factorial()` de `main.c`.
+
+[start=5]
+. Expanda a pasta Novo Teste CUnit e veja se ela contém um arquivo `newcunittest.c` que deve ser aberto no editor de origem.
+
+[start=6]
+. No arquivo `newcunittest.c`, observe a instrução `#include "CUnit/Basic.h"` para acessar a biblioteca CUnit. O arquivo `newcunittest.c` contém uma função de teste gerada automaticamente, `testFactorial`, para a função `factorial()` de `main.c`.
image::images/c-unit-includes.png[]
@@ -379,12 +386,20 @@
Caso não veja a janela Resultados do Teste, abra-a escolhendo Janela > Ferramentas IDE > Resultados de Teste, ou pressionando Alt+Shift+R.
image::images/c-unit-run-test-orig.png[]
-2. Observe que a janela Resultados do Teste é dividida em dois painéis.
+
+[start=2]
+. Observe que a janela Resultados do Teste é dividida em dois painéis.
O painel direito exibe a saída da console dos testes. O painel esquerdo exibe um resumo de testes com falha e aprovados e a descrição de testes com falha.
-3. Na janela Resultados do Teste, clique duas vezes no nó `testFactorial causou um ERRO` para ir direto para a função `testFactorial` no editor de origem.
+
+[start=3]
+. Na janela Resultados do Teste, clique duas vezes no nó `testFactorial causou um ERRO` para ir direto para a função `testFactorial` no editor de origem.
Se observar a função você verificará que ela não testa nada, mas simplesmente afirma que o teste da unidade falhou, definindo CU_ASSERT(0). A condição é avaliada como 0 que é equivalente a FALSO, dessa forma, o framework CUnit interpreta isso como uma falha de teste.
-4. Altere a linha CU_ASSERT(0) para CU_ASSERT(1) e salve o arquivo (Ctrl+S).
-5. Execute o teste novamente clicando com o botão direito na pasta Novo Teste CUnit e selecionando Testar.
+
+[start=4]
+. Altere a linha CU_ASSERT(0) para CU_ASSERT(1) e salve o arquivo (Ctrl+S).
+
+[start=5]
+. Execute o teste novamente clicando com o botão direito na pasta Novo Teste CUnit e selecionando Testar.
A janela Resultados do Teste deve indicar que o teste foi aprovado.
image::images/c-unit-run-test-pass.png[]
@@ -393,10 +408,16 @@
1. Crie um modelo de teste CUnit genérico clicando com o botão direito na pasta Arquivos de Teste e selecionando Novo Teste CUnit.
image::images/c-unit-new-cunit-test.png[]
-2. Chame o teste Meu Teste CUnit e o nome do arquivo de teste `mycunittest` e clique em Finalizar.
+
+[start=2]
+. Chame o teste Meu Teste CUnit e o nome do arquivo de teste `mycunittest` e clique em Finalizar.
image::images/c-unit-create-mycunittest.png[]
-3. Uma nova pasta de teste chamada Meu Teste CUnit foi criada e contém um arquivo `mycunittest.c` que é aberto no editor.
-4. Examine o arquivo de teste `mycunittest.c` e veja se ele contém dois testes. O teste1 passará porque foi avaliado como VERDADEIRO, e o teste2 falhará porque foi avaliado como FALSO, pois 2*2 não é igual a 5.
+
+[start=3]
+. Uma nova pasta de teste chamada Meu Teste CUnit foi criada e contém um arquivo `mycunittest.c` que é aberto no editor.
+
+[start=4]
+. Examine o arquivo de teste `mycunittest.c` e veja se ele contém dois testes. O teste1 passará porque foi avaliado como VERDADEIRO, e o teste2 falhará porque foi avaliado como FALSO, pois 2*2 não é igual a 5.
[source,java]
----
@@ -410,12 +431,20 @@
CU_ASSERT(2*2 == 5);
}
----
-5. Execute o teste como antes e você deverá ver:
+
+[start=5]
+. Execute o teste como antes e você deverá ver:
image::images/c-unit-run-mytest1.png[]
-6. Execute todos os testes do menu principal IDE selecionando Executar > Testar Projeto (Cpp_Application__x_) e veja quais conjuntos de testes foram executados e exiba o êxito e a falha na janela Resultados do Teste.
-7. Passe o mouse sobre o teste com falha para ver mais informações sobre a falha.
+
+[start=6]
+. Execute todos os testes do menu principal IDE selecionando Executar > Testar Projeto (Cpp_Application__x_) e veja quais conjuntos de testes foram executados e exiba o êxito e a falha na janela Resultados do Teste.
+
+[start=7]
+. Passe o mouse sobre o teste com falha para ver mais informações sobre a falha.
image::images/c-unit-test-fail-annotation.png[]
-8. Clique nos botões na margem esquerda da janela Resultados do Teste para mostrar e ocultar os testes que passaram ou falharam.
+
+[start=8]
+. Clique nos botões na margem esquerda da janela Resultados do Teste para mostrar e ocultar os testes que passaram ou falharam.
== Depurar Meu Teste CUnit
@@ -428,9 +457,13 @@
A barra de ferramentas do depurador será exibida.
-2. Clique no botão Step Into para executar a instrução de um programa cada vez que clicar no botão
+
+[start=2]
+. Clique no botão Step Into para executar a instrução de um programa cada vez que clicar no botão
image::images/c-unit-debug-icons.png[]
-3. Abra a janela Pilha de Chamada selecionando Janela > Depurando > Pilha de Chamada, assim você pode verificar as chamadas de função, conforme percorre pelo teste.
+
+[start=3]
+. Abra a janela Pilha de Chamada selecionando Janela > Depurando > Pilha de Chamada, assim você pode verificar as chamadas de função, conforme percorre pelo teste.
== Adicionar um Teste Simples
@@ -439,15 +472,23 @@
1. Na janela Projetos, clique com o botão direito do mouse no arquivo de origem ``main.c`` e selecione Criar Teste > Novo Teste Simples C.
image::images/c-unit-mainc-new-simple-test.png[]
-2. Na janela Selecionar Elementos do assistente, clique na caixa de seleção da função ``main`` , em seguida, clique em Próximo.
+
+[start=2]
+. Na janela Selecionar Elementos do assistente, clique na caixa de seleção da função ``main`` , em seguida, clique em Próximo.
image::images/c-unit-mainc-new-simple-test-select.png[]
-3. Na janela Nome e Local, mantenha o nome default Novo Teste Simples C e clique em Finalizar.
+
+[start=3]
+. Na janela Nome e Local, mantenha o nome default Novo Teste Simples C e clique em Finalizar.
O nó Novo Teste Simples C é exibido na pasta Testar Arquivos.
-4. Expanda a pasta Novo Teste Simples C e veja se ela contém um arquivo `newsimpletest.c`. Este arquivo deve ser aberto no editor de código-fonte.
+
+[start=4]
+. Expanda a pasta Novo Teste Simples C e veja se ela contém um arquivo `newsimpletest.c`. Este arquivo deve ser aberto no editor de código-fonte.
image::images/c-unit-mainc-new-simple-test-folder.png[]
-5. Observe que o arquivo `newsimpletest.c` contém uma função de teste gerada automaticamente, `testFactorial`, para a função `factorial()` de `main.c`, como no teste CUnit.
+
+[start=5]
+. Observe que o arquivo `newsimpletest.c` contém uma função de teste gerada automaticamente, `testFactorial`, para a função `factorial()` de `main.c`, como no teste CUnit.
image::images/c-unit-mainc-new-simple-test-code.png[]
A instrução ``if`` deve testar uma condição que, se verdadeira, indica que o teste falhou. O token ``%%TEST_FAILED%%`` aciona a exibição do indicador gráfico de falhas de teste na janela Resultados do Teste. A instrução ``if`` no teste gerado defina a condição como verdadeira, definindo-a como 1, dessa forma o teste sempre falha quando você executá-lo sem modificação.
@@ -458,7 +499,9 @@
A opção ``message`` permite que você imprima um teste sobre a falha no teste.
-6. Execute o teste para ver se ele gera uma falha mostrada na janela Resultados do Teste.
+
+[start=6]
+. Execute o teste para ver se ele gera uma falha mostrada na janela Resultados do Teste.
Em seguida, você edita o arquivo de teste para ver os testes aprovados.
@@ -482,7 +525,9 @@
A função `main` também deve ser modificada para chamar a nova função de teste.
-2. Na função `main`, copie as linhas:
+
+[start=2]
+. Na função `main`, copie as linhas:
[source,java]
----
@@ -492,7 +537,9 @@
printf("%%TEST_FINISHED%% time=0 testFactorial (newsimpletest)\n");
----
-3. Cole as linhas logo abaixo das linhas copiadas e altere o nome `testFactorial` para `testNew` nas linhas coladas. Há três ocorrências que precisam ser alteradas.
+
+[start=3]
+. Cole as linhas logo abaixo das linhas copiadas e altere o nome `testFactorial` para `testNew` nas linhas coladas. Há três ocorrências que precisam ser alteradas.
O arquivo concluído `newsimpletest.c` deve parecer com o seguinte:
[source,c]
@@ -544,7 +591,9 @@
----
-4. Na janela Projetos, execute o teste clicando com o botão direito do mouse em Novo Teste Simples C e escolhendo Testar.
+
+[start=4]
+. Na janela Projetos, execute o teste clicando com o botão direito do mouse em Novo Teste Simples C e escolhendo Testar.
Os Resultados do Teste devem parecer com o seguinte:
image::images/c-unit-simpletest-results.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ru.asciidoc
index 144b2de..5782739 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_ru.asciidoc
@@ -34,33 +34,6 @@
-image::images/netbeans-stamp-80-74.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.4 и 8.0"]
-
-|===
-|- |<<requirements,Требования>>
-
-|- |<<intro,Введение>>
-
-|- |<<cunit,Установка инфраструктуры тестирования CUnit>>
-
-|- |<<project,Создание проекта для учебного курса>>
-
-|- |<<addtest,Добавление тестов CUnit в управляемый проект NetBeans>>
-
-|- |<<runtest,Выполнение теста CUnit>>
-
-|- |<<addmore, Добавление еще одного теста CUnit>>
-
-|- |<<debug,Отладка теста>>
-
-|- |<<addsimple,Добавление простого тeста>>
-
-|- |<<editsimple,Изменение простого теста>>
-
-|- |<<commandline,Выполнение тестов в интерфейсе командной строки>>
-|===
-
-
== Требования
*Для работы с этим учебным курсом требуется программное обеспечение, указанное ниже.*
@@ -129,7 +102,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. Создайте конфигурацию, выполните сборку и установку CUnit из каталога /tmp следующим образом:
+
+[start=3]
+. Создайте конфигурацию, выполните сборку и установку CUnit из каталога /tmp следующим образом:
[source,shell]
----
@@ -172,7 +147,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. Создайте конфигурацию, выполните сборку и установку CUnit из каталога /tmp следующим образом:
+
+[start=3]
+. Создайте конфигурацию, выполните сборку и установку CUnit из каталога /tmp следующим образом:
[source,shell]
----
@@ -202,7 +179,9 @@
$ tar xvf CUnit-2.1-2-src.tar
$ cd ./CUnit-2.1-2
----
-4. Найдите путь Unix к MinGW с помощью команды mount.
+
+[start=4]
+. Найдите путь Unix к MinGW с помощью команды mount.
[source,shell]
----
@@ -220,7 +199,9 @@
*C:\MinGW on /mingw type user (binmode)*
----
В последней строке, выделенной полужирным шрифтом, показан путь Unix: /mingw. Система может выдать и другой результат. Запишите этот путь, так как его потребуется указать в следующей команде.
-5. Создайте конфигурацию Makefile с помощью следующей команды.
+
+[start=5]
+. Создайте конфигурацию Makefile с помощью следующей команды.
Если оболочка MinGW расположена на пути, отличном от /mingw, обязательно укажите соответствующее местосположение MinGW в Unix с помощью параметра --prefix=.
[source,shell]
@@ -233,7 +214,9 @@
config.status: executing libtool commands
----
-6. Выполните сборку библиотеки для CUnit:
+
+[start=6]
+. Выполните сборку библиотеки для CUnit:
[source,shell]
----
@@ -247,7 +230,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-7. Установите библиотеку CUnit в каталоги C:/MinGW/include/CUnit, C:/MinGW/share/CUnit и C:/MinGW/doc/CUnit с помощью команды make install:
+
+[start=7]
+. Установите библиотеку CUnit в каталоги C:/MinGW/include/CUnit, C:/MinGW/share/CUnit и C:/MinGW/doc/CUnit с помощью команды make install:
[source,shell]
----
@@ -262,7 +247,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-8. Если вы используете версию Java 7 Update 21, 25 или 40, необходимо применить временное решение link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+проблемы 236867+], чтобы использовать CUnit для выполнения заданий этого практического руководства.
+
+[start=8]
+. Если вы используете версию Java 7 Update 21, 25 или 40, необходимо применить временное решение link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+проблемы 236867+], чтобы использовать CUnit для выполнения заданий этого практического руководства.
1. Перейдите в раздел Сервис > Параметры > C/C++ > Средства сборки и выберите набор средств MinGW.
2. Измените запись комынды make на make.exe без указания полного пути.
@@ -294,10 +281,16 @@
2. В мастере создания проектов выберите 'C/C++', а затем 'Приложение C/C++'.
3. В диалоговом окне 'Создание приложения C/C++' выберите 'Создать основной файл', затем выберите язык C. Оставьте все остальные настройки по умолчанию без изменения.
image::images/c-unit-new-project.png[]
-4. Нажмите 'Готово'. В результате будет создан проект Cpp_Application__x_.
-5. В окне 'Проекты' откройте папку 'Исходные файлы' и дважды щелкните файл `main.c`, чтобы открыть его в редакторе. Содержимое файла будет выглядеть примерно так, как показано на рисунке:
+
+[start=4]
+. Нажмите 'Готово'. В результате будет создан проект Cpp_Application__x_.
+
+[start=5]
+. В окне 'Проекты' откройте папку 'Исходные файлы' и дважды щелкните файл `main.c`, чтобы открыть его в редакторе. Содержимое файла будет выглядеть примерно так, как показано на рисунке:
image::images/c-unit-mainc-initial.png[]
-6. Чтобы дать программе задачу, замените код в файле `main.c` на следующий код. В результате получится простая программа вычисления факториала:
+
+[start=6]
+. Чтобы дать программе задачу, замените код в файле `main.c` на следующий код. В результате получится простая программа вычисления факториала:
[source,c]
----
@@ -330,8 +323,12 @@
После редактирования файл принимает следующий вид:
image::images/c-unit-mainc-edited.png[]
-7. Сохраните файл нажатием клавиш Ctrl+S.
-8. Выполните сборку и запуск проекта, чтобы проверить его работоспособность. Для этого нажмите кнопку 'Выполнить' на панели инструментов IDE.
+
+[start=7]
+. Сохраните файл нажатием клавиш Ctrl+S.
+
+[start=8]
+. Выполните сборку и запуск проекта, чтобы проверить его работоспособность. Для этого нажмите кнопку 'Выполнить' на панели инструментов IDE.
Если в качестве целого числа указать 8, должен получиться следующий результат:
image::images/c-unit-output-factorial.png[]
@@ -349,15 +346,25 @@
Открывается мастер создания тестов.
-2. В окне 'Выбор элементов' установите флажок напротив функции `main`. В результате будут выбраны все функции в файле `main`. В нашей программе есть только одна функция - `factorial()`.
-3. Нажмите 'Далее'.
-4. Оставьте заданное по умолчанию имя New CUnit Test без изменения и нажмите 'Готово'.
+
+[start=2]
+. В окне 'Выбор элементов' установите флажок напротив функции `main`. В результате будут выбраны все функции в файле `main`. В нашей программе есть только одна функция - `factorial()`.
+
+[start=3]
+. Нажмите 'Далее'.
+
+[start=4]
+. Оставьте заданное по умолчанию имя New CUnit Test без изменения и нажмите 'Готово'.
В структуре папки 'Файлы тестов' появляется новый узел New CUnit Test.
Папка New CUnit Test содержит следующие шаблоны файлов для теста. В эту папку можно добавлять новые файлы тем же способом, каким вы добавляете исходные файлы в проект - с помощью команды в контекстном меню папки.
-5. Разверните структуру папки New CUnit Test. В этой структуре должен присутствовать файл `newcunittest.c`. Откройте этот файл в редакторе.
-6. В файле `newcunittest.c` обратите внимание на оператор `#include "CUnit/Basic.h"`, предназначенный для обращения к библиотеке CUnit. Файл `newcunittest.c` содержит автоматически генерируемую тестовую функцию `testFactorial` для функции `factorial()` в основном файле `main.c`.
+
+[start=5]
+. Разверните структуру папки New CUnit Test. В этой структуре должен присутствовать файл `newcunittest.c`. Откройте этот файл в редакторе.
+
+[start=6]
+. В файле `newcunittest.c` обратите внимание на оператор `#include "CUnit/Basic.h"`, предназначенный для обращения к библиотеке CUnit. Файл `newcunittest.c` содержит автоматически генерируемую тестовую функцию `testFactorial` для функции `factorial()` в основном файле `main.c`.
image::images/c-unit-includes.png[]
@@ -379,12 +386,20 @@
Если окно 'Результаты теста' не отображается, откройте его самостоятельно. Для этого выберите Окно > Средства IDE > Результаты теста или нажмите сочетание клавиш Alt+Shift+R.
image::images/c-unit-run-test-orig.png[]
-2. Окно 'Результаты теста разделено на две части.
+
+[start=2]
+. Окно 'Результаты теста разделено на две части.
В правой части отображаются консольные выходные данные тестов. В левой части отображается сводная информация о пройденных и непройденных тестах, а также описание непройденных тестов.
-3. В окне 'Результаты теста дважды щелкните узел `testFactorial caused an ERROR` для перехода к функции `testFactorial` в редакторе исходного кода.
+
+[start=3]
+. В окне 'Результаты теста дважды щелкните узел `testFactorial caused an ERROR` для перехода к функции `testFactorial` в редакторе исходного кода.
Очевидно, что эта функция сама по себе ничего не проверяет, а только подтверждает, что модульный тест не пройден, задавая параметр CU_ASSERT(0). Значение условия равно 0, что эквивалентно значению FALSE, поэтому инфраструктура CUnit интерпретирует это значение как неуспешный результат теста.
-4. Измените строку CU_ASSERT(0) на CU_ASSERT(1) и сохраните файл (Ctrl+S).
-5. Запустите тест повторно, щелкнув правой кнопкой мыши папку New CUnit Test и выбрав 'Тест'.
+
+[start=4]
+. Измените строку CU_ASSERT(0) на CU_ASSERT(1) и сохраните файл (Ctrl+S).
+
+[start=5]
+. Запустите тест повторно, щелкнув правой кнопкой мыши папку New CUnit Test и выбрав 'Тест'.
В окне 'Результаты теста выводятся данные, указывающие на то, что тест пройден.
image::images/c-unit-run-test-pass.png[]
@@ -393,10 +408,16 @@
1. Создайте общий шаблон теста CUnit. Для этого щелкните правой кнопкой мыши папку 'Файлы тестов' и выберите 'Создать тест CUnit'.
image::images/c-unit-new-cunit-test.png[]
-2. Назовите тест My CUnit Test (имя файла должно иметь вид `mycunittest`) и нажмите 'Готово'.
+
+[start=2]
+. Назовите тест My CUnit Test (имя файла должно иметь вид `mycunittest`) и нажмите 'Готово'.
image::images/c-unit-create-mycunittest.png[]
-3. Создается новая папка теста My CUnit Test. Эта папка содержит файл `mycunittest.c`, который открывается в редакторе.
-4. Изучите файл теста `mycunittest.c`. Этот файл содержит два теста. Тест с именем test1 будет пройден, поскольку имеет значение TRUE, а тест с именем test2 завершится с ошибкой, поскольку имеет значение FALSE (2*2 не равно 5).
+
+[start=3]
+. Создается новая папка теста My CUnit Test. Эта папка содержит файл `mycunittest.c`, который открывается в редакторе.
+
+[start=4]
+. Изучите файл теста `mycunittest.c`. Этот файл содержит два теста. Тест с именем test1 будет пройден, поскольку имеет значение TRUE, а тест с именем test2 завершится с ошибкой, поскольку имеет значение FALSE (2*2 не равно 5).
[source,java]
----
@@ -410,12 +431,20 @@
CU_ASSERT(2*2 == 5);
}
----
-5. Выполните тест так же, как предыдущий. Отобразится следующий результат:
+
+[start=5]
+. Выполните тест так же, как предыдущий. Отобразится следующий результат:
image::images/c-unit-run-mytest1.png[]
-6. Выполните все тесты. Для этого в главном меню IDE выберите Запуск > Тестировать проект (Cpp_Application__x_). Будут выполнены оба набора тестов, и результаты их выполнения (успешные и неуспешные) отобразятся в окне 'Результаты теста'.
-7. Наведите указатель мыши на непройденный тест, чтобы просмотреть сведения об ошибке.
+
+[start=6]
+. Выполните все тесты. Для этого в главном меню IDE выберите Запуск > Тестировать проект (Cpp_Application__x_). Будут выполнены оба набора тестов, и результаты их выполнения (успешные и неуспешные) отобразятся в окне 'Результаты теста'.
+
+[start=7]
+. Наведите указатель мыши на непройденный тест, чтобы просмотреть сведения об ошибке.
image::images/c-unit-test-fail-annotation.png[]
-8. С помощью кнопок в левой части окна 'Результаты теста' можно показать или скрыть пройденные или непройденные тесты.
+
+[start=8]
+. С помощью кнопок в левой части окна 'Результаты теста' можно показать или скрыть пройденные или непройденные тесты.
== Отладка теста My CUnit Test
@@ -428,9 +457,13 @@
Отображается панель инструментов отладчика.
-2. Нажмите кнопку 'Шаг с заходом' для пошагового выполнения программы. При каждом нажатии этой кнопки выполняется один оператор.
+
+[start=2]
+. Нажмите кнопку 'Шаг с заходом' для пошагового выполнения программы. При каждом нажатии этой кнопки выполняется один оператор.
image::images/c-unit-debug-icons.png[]
-3. Откройте окно 'Стек вызовов' (Окно > Отладка > Стек вызовов), чтобы просматривать вызовы функций во время пошагового выполнения теста.
+
+[start=3]
+. Откройте окно 'Стек вызовов' (Окно > Отладка > Стек вызовов), чтобы просматривать вызовы функций во время пошагового выполнения теста.
== Добавление простого тeста
@@ -439,15 +472,23 @@
1. В окне 'Проекты' щелкните правой кнопкой мыши исходный файл ``main.c`` и выберите Создать тест > Создать простой тест C.
image::images/c-unit-mainc-new-simple-test.png[]
-2. В окне 'Выбор элементов' мастера создания тестов установите флажок напротив функции ``main`` и нажмите 'Далее'.
+
+[start=2]
+. В окне 'Выбор элементов' мастера создания тестов установите флажок напротив функции ``main`` и нажмите 'Далее'.
image::images/c-unit-mainc-new-simple-test-select.png[]
-3. В полях 'Имя' и 'Местоположение' оставьте заданное по умолчанию имя New C Simple Test и нажмите 'Готово'.
+
+[start=3]
+. В полях 'Имя' и 'Местоположение' оставьте заданное по умолчанию имя New C Simple Test и нажмите 'Готово'.
В структуре папки 'Файлы тестов' появляется новый узел New C Simple Test.
-4. Разверните структуру папки New C Simple. Эта папка должна содержать файл `newsimpletest.c`. Откройте этот файл в редакторе исходного кода.
+
+[start=4]
+. Разверните структуру папки New C Simple. Эта папка должна содержать файл `newsimpletest.c`. Откройте этот файл в редакторе исходного кода.
image::images/c-unit-mainc-new-simple-test-folder.png[]
-5. Аналогично тесту CUnit файл `newsimpletest.c` содержит автоматически генерируемую тестовую функцию `testFactorial` для функции `factorial()` основного файла `main.c`.
+
+[start=5]
+. Аналогично тесту CUnit файл `newsimpletest.c` содержит автоматически генерируемую тестовую функцию `testFactorial` для функции `factorial()` основного файла `main.c`.
image::images/c-unit-mainc-new-simple-test-code.png[]
Оператор ``if`` должен проверять условие. Если условие имеет значение true, тест считается непройденным. Маркер ``%%TEST_FAILED%%`` инициирует отображение графического обозначения неуспешного выполнения тестов в окне 'Результаты теста'. Оператор ``if`` в созданном тесте задает для условия значение true (1), поэтому при запуске этого теста без предварительного редактирования он всегда будет неуспешным.
@@ -458,7 +499,9 @@
Параметр ``message`` позволяет выводить сообщение о неуспешном результате теста.
-6. Выполните тест. В окне 'Результаты теста' должен отобразиться неуспешный результат.
+
+[start=6]
+. Выполните тест. В окне 'Результаты теста' должен отобразиться неуспешный результат.
Теперь необходимо отредактировать файл теста, чтобы посмотреть успешное выполнение тестов.
@@ -482,7 +525,9 @@
Функцию `main` также необходимо изменить, чтобы она могла вызывать новую тестовую функцию.
-2. Скопируйте следующие строки в функции `main`:
+
+[start=2]
+. Скопируйте следующие строки в функции `main`:
[source,java]
----
@@ -492,7 +537,9 @@
printf("%%TEST_FINISHED%% time=0 testFactorial (newsimpletest)\n");
----
-3. Вставьте скопированные строки сразу под исходными и измените в скопированных строках имя `testFactorial` на `testNew`. Во всем файле необходимо изменить три вхождения.
+
+[start=3]
+. Вставьте скопированные строки сразу под исходными и измените в скопированных строках имя `testFactorial` на `testNew`. Во всем файле необходимо изменить три вхождения.
Готовый файл `newsimpletest.c` выглядит следующим образом:
[source,c]
@@ -544,7 +591,9 @@
----
-4. В окне 'Проекты' запустите тест, щелкнув правой кнопкой мыши папку New C Simple Test и выбрав 'Тест'.
+
+[start=4]
+. В окне 'Проекты' запустите тест, щелкнув правой кнопкой мыши папку New C Simple Test и выбрав 'Тест'.
В окне 'Результаты теста' должны отобразиться следующие данные:
image::images/c-unit-simpletest-results.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_zh_CN.asciidoc
index caec98a..1cae5de 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/c-unit-test_zh_CN.asciidoc
@@ -34,33 +34,6 @@
-image::images/netbeans-stamp-80-74.png[title="此页上的内容适用于 NetBeans IDE 7.4 和 8.0"]
-
-|===
-|- |<<requirements,要求>>
-
-|- |<<intro,简介>>
-
-|- |<<cunit,安装 CUnit 测试框架>>
-
-|- |<<project,为教程创建项目>>
-
-|- |<<addtest,将 CUnit 测试添加到 NetBeans 管理的项目中>>
-
-|- |<<runtest,运行 CUnit 测试>>
-
-|- |<<addmore, 添加其他 CUnit 测试>>
-
-|- |<<debug,调试测试>>
-
-|- |<<addsimple,添加简单测试>>
-
-|- |<<editsimple,编辑简单测试>>
-
-|- |<<commandline,从命令行运行测试>>
-|===
-
-
== 要求
*要学习本教程,您需要具备以下软件。*
@@ -129,7 +102,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. 从 /tmp 配置、构建和安装 CUinit,如下所示:
+
+[start=3]
+. 从 /tmp 配置、构建和安装 CUinit,如下所示:
[source,shell]
----
@@ -172,7 +147,9 @@
$ bunzip2 CUnit-2.1-2-src.tar.bz2
$ tar -xvf CUnit-2.1-2-src.tar
----
-3. 从 /tmp 配置、构建和安装 CUinit,如下所示:
+
+[start=3]
+. 从 /tmp 配置、构建和安装 CUinit,如下所示:
[source,shell]
----
@@ -202,7 +179,9 @@
$ tar xvf CUnit-2.1-2-src.tar
$ cd ./CUnit-2.1-2
----
-4. 使用 mount 命令查找 MinGW 的 Unix 路径。
+
+[start=4]
+. 使用 mount 命令查找 MinGW 的 Unix 路径。
[source,shell]
----
@@ -220,7 +199,9 @@
*C:\MinGW on /mingw type user (binmode)*
----
上面粗体显示的最后一行显示 Unix 路径为 /mingw。您的系统可能会报告不同的路径,因此请记下该路径,因为您需要在下一条命令中指定该路径。
-5. 使用以下命令配置 Makefile。
+
+[start=5]
+. 使用以下命令配置 Makefile。
如果您的 MinGW 不在 /mingw 中,请确保使用 --prefix= 选项为 MinGW 指定适当的 Unix 位置。
[source,shell]
@@ -233,7 +214,9 @@
config.status: executing libtool commands
----
-6. 为 CUnit 构建库:
+
+[start=6]
+. 为 CUnit 构建库:
[source,shell]
----
@@ -247,7 +230,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-7. 通过运行 make install 将 CUnit 库安装到 C:/MinGW/include/CUnit、C:/MinGW/share/CUnit 和 C:/MinGW/doc/CUnit:
+
+[start=7]
+. 通过运行 make install 将 CUnit 库安装到 C:/MinGW/include/CUnit、C:/MinGW/share/CUnit 和 C:/MinGW/doc/CUnit:
[source,shell]
----
@@ -262,7 +247,9 @@
make[1]: Leaving directory 'c/distr/CUnit-2.1-2'
$
----
-8. 如果使用 Java 7 update 21、25 或 40,则必须执行以下解决方法来解决link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+问题 236867+],以使 CUnit 和本教程工作。
+
+[start=8]
+. 如果使用 Java 7 update 21、25 或 40,则必须执行以下解决方法来解决link:https://netbeans.org/bugzilla/show_bug.cgi?id=236867[+问题 236867+],以使 CUnit 和本教程工作。
1. 转到“工具”>“选项”> "C/C++" >“构建工具”,然后选择 MinGW 工具集合。
2. 将 Make 命令条目更改为不含完整路径的 make.exe。
@@ -294,10 +281,16 @@
2. 在项目向导中,单击 "C/C++",然后选择 "C/C++ Application"(C/C++ 应用程序)。
3. 在 "New C/C++ Application"(新建 C/C++ 应用程序)对话框中,选择 "Create Main File"(创建主文件)并选择 "C language"(C 语言)。接受所有其他选项的默认值。
image::images/c-unit-new-project.png[]
-4. 单击 "Finish"(完成)后,将创建 Cpp_Application__x_ 项目。
-5. 在 "Projects"(项目)窗口中,打开 "Source Files"(源文件)文件夹并双击 `main.c` 文件以将其在编辑器中打开。此文件的内容类似于此处所示的内容:
+
+[start=4]
+. 单击 "Finish"(完成)后,将创建 Cpp_Application__x_ 项目。
+
+[start=5]
+. 在 "Projects"(项目)窗口中,打开 "Source Files"(源文件)文件夹并双击 `main.c` 文件以将其在编辑器中打开。此文件的内容类似于此处所示的内容:
image::images/c-unit-mainc-initial.png[]
-6. 要使该程序执行某种操作,请将 `main.c` 文件中的代码替换为以下代码以创建简单的阶乘计算器:
+
+[start=6]
+. 要使该程序执行某种操作,请将 `main.c` 文件中的代码替换为以下代码以创建简单的阶乘计算器:
[source,c]
----
@@ -330,8 +323,12 @@
编辑后此文件应看起来如下所示:
image::images/c-unit-mainc-edited.png[]
-7. 通过按 Ctrl+S 组合键保存此文件。
-8. 通过单击 IDE 工具栏中的 "Run"(运行)按钮,构建并运行项目以确保其工作。
+
+[start=7]
+. 通过按 Ctrl+S 组合键保存此文件。
+
+[start=8]
+. 通过单击 IDE 工具栏中的 "Run"(运行)按钮,构建并运行项目以确保其工作。
如果输入 8 作为整数,则输出应看起来类似于以下内容:
image::images/c-unit-output-factorial.png[]
@@ -349,15 +346,25 @@
将打开一个向导以帮助您创建测试。
-2. 在该向导的 "Select Elements"(选择元素)窗口中,单击 `main` 函数对应的复选框。这将导致同时选中 `main` 内的所有函数。在此程序中,仅另外存在一个 `factorial()` 函数。
-3. 单击 "Next"(下一步)。
-4. 保留默认名称 "New CUnit Test"(新 CUnit 测试)并单击 "Finish"(完成)。
+
+[start=2]
+. 在该向导的 "Select Elements"(选择元素)窗口中,单击 `main` 函数对应的复选框。这将导致同时选中 `main` 内的所有函数。在此程序中,仅另外存在一个 `factorial()` 函数。
+
+[start=3]
+. 单击 "Next"(下一步)。
+
+[start=4]
+. 保留默认名称 "New CUnit Test"(新 CUnit 测试)并单击 "Finish"(完成)。
"New CUnit Test"(新 CUnit 测试)节点将显示在 "Test Files"(测试文件)文件夹下。
"New CUnit Test"(新 CUnit 测试)文件夹包含该测试的模板文件。可通过右键单击该文件夹以将源文件添加到项目的相同方式将新文件添加到该文件夹。
-5. 展开 "New CUnit Test"(新 CUnit 测试)文件夹,可以看到它包含一个应在源代码编辑器中打开的文件 `newcunittest.c`。
-6. 在 `newcunittest.c` 文件中包含 `#include "CUnit/Basic.h"` 语句用于访问 CUnit 库。`newcunittest.c` 文件包含一个自动生成的测试函数 `testFactorial`,该函数属于 `main.c` 的 `factorial()` 函数。
+
+[start=5]
+. 展开 "New CUnit Test"(新 CUnit 测试)文件夹,可以看到它包含一个应在源代码编辑器中打开的文件 `newcunittest.c`。
+
+[start=6]
+. 在 `newcunittest.c` 文件中包含 `#include "CUnit/Basic.h"` 语句用于访问 CUnit 库。`newcunittest.c` 文件包含一个自动生成的测试函数 `testFactorial`,该函数属于 `main.c` 的 `factorial()` 函数。
image::images/c-unit-includes.png[]
@@ -379,12 +386,20 @@
如果您看不到 "Test Results"(测试结果)窗口,请通过选择 "Window"(窗口)> "IDE Tools"(IDE 工具)> "Test Results"(测试结果)或通过按 Alt+Shift+R 组合键来打开该窗口。
image::images/c-unit-run-test-orig.png[]
-2. 请注意,"Test Results"(测试结果)窗口拆分为两个面板。
+
+[start=2]
+. 请注意,"Test Results"(测试结果)窗口拆分为两个面板。
右侧面板显示测试的控制台输出。左侧面板显示通过的测试和失败的测试的概要以及失败的测试的描述。
-3. 在 "Test Results"(测试结果)窗口中,双击节点 `testFactorial caused an ERROR` 以跳至源代码编辑器中的 `testFactorial` 函数。
+
+[start=3]
+. 在 "Test Results"(测试结果)窗口中,双击节点 `testFactorial caused an ERROR` 以跳至源代码编辑器中的 `testFactorial` 函数。
如果查看该函数,您会看到它实际上并没有测试任何内容,而只是通过设置 CU_ASSERT(0) 断言单元测试失败。此条件求值为 0,这等效于 FALSE,因此 CUnit 框架将此解释为测试失败。
-4. 将 CU_ASSERT(0) 行更改为 CU_ASSERT(1) 并保存文件 (Ctrl+S)。
-5. 通过右键单击 "New CUnit Test"(新 CUnit 测试)文件夹并选择 "Test"(测试),再次运行测试。
+
+[start=4]
+. 将 CU_ASSERT(0) 行更改为 CU_ASSERT(1) 并保存文件 (Ctrl+S)。
+
+[start=5]
+. 通过右键单击 "New CUnit Test"(新 CUnit 测试)文件夹并选择 "Test"(测试),再次运行测试。
"Test Results"(测试结果)窗口应指示测试已通过。
image::images/c-unit-run-test-pass.png[]
@@ -393,10 +408,16 @@
1. 通过右键单击 "Test Files"(测试文件)文件夹并选择 "New CUnit Test"(新 CUnit 测试),创建通用 CUnit 测试模板。
image::images/c-unit-new-cunit-test.png[]
-2. 将测试命名为 "My CUnit Test"(我的 CUnit 测试)并将测试文件名命名为 `mycunittest`,然后单击 "Finish"(完成)。
+
+[start=2]
+. 将测试命名为 "My CUnit Test"(我的 CUnit 测试)并将测试文件名命名为 `mycunittest`,然后单击 "Finish"(完成)。
image::images/c-unit-create-mycunittest.png[]
-3. 将创建一个名为 "My CUnit Test"(我的 CUnit 测试)的新测试文件夹,该文件夹中包含在编辑器中打开的 `mycunittest.c` 文件。
-4. 检查 `mycunittest.c` 测试文件,可以看到该文件包含两个测试。test1 将因求值为 TRUE 而通过,而 test2 将因求值为 FALSE 而失败,因为 2*2 不等于 5。
+
+[start=3]
+. 将创建一个名为 "My CUnit Test"(我的 CUnit 测试)的新测试文件夹,该文件夹中包含在编辑器中打开的 `mycunittest.c` 文件。
+
+[start=4]
+. 检查 `mycunittest.c` 测试文件,可以看到该文件包含两个测试。test1 将因求值为 TRUE 而通过,而 test2 将因求值为 FALSE 而失败,因为 2*2 不等于 5。
[source,java]
----
@@ -410,12 +431,20 @@
CU_ASSERT(2*2 == 5);
}
----
-5. 像以前一样运行测试,您应该会看到:
+
+[start=5]
+. 像以前一样运行测试,您应该会看到:
image::images/c-unit-run-mytest1.png[]
-6. 通过选择 "Run"(运行)> "Test Project (Cpp_Application__x_)"(测试项目 (Cpp_Application_x))从 IDE 主菜单运行所有测试,您会看到两个测试套件都运行,并在 "Test Results"(测试结果)窗口中显示其成功和失败情况。
-7. 将鼠标放在失败的测试上方可查看有关失败情况的详细信息。
+
+[start=6]
+. 通过选择 "Run"(运行)> "Test Project (Cpp_Application__x_)"(测试项目 (Cpp_Application_x))从 IDE 主菜单运行所有测试,您会看到两个测试套件都运行,并在 "Test Results"(测试结果)窗口中显示其成功和失败情况。
+
+[start=7]
+. 将鼠标放在失败的测试上方可查看有关失败情况的详细信息。
image::images/c-unit-test-fail-annotation.png[]
-8. 单击 "Test Results"(测试结果)窗口左旁注中的按钮可显示和隐藏通过或失败的测试。
+
+[start=8]
+. 单击 "Test Results"(测试结果)窗口左旁注中的按钮可显示和隐藏通过或失败的测试。
== 调试我的 CUnit 测试
@@ -428,9 +457,13 @@
将显示调试器工具栏。
-2. 单击 "Step Into"(步入)按钮将执行程序,每单击一次此按钮将会执行一条语句。
+
+[start=2]
+. 单击 "Step Into"(步入)按钮将执行程序,每单击一次此按钮将会执行一条语句。
image::images/c-unit-debug-icons.png[]
-3. 通过选择 "Window"(窗口)> "Debugging"(调试)> "Call Stack"(调用堆栈)打开 "Call Stack"(调用堆栈)窗口,以便您可以在逐步执行测试时观看函数调用情况。
+
+[start=3]
+. 通过选择 "Window"(窗口)> "Debugging"(调试)> "Call Stack"(调用堆栈)打开 "Call Stack"(调用堆栈)窗口,以便您可以在逐步执行测试时观看函数调用情况。
== 添加简单测试
@@ -439,15 +472,23 @@
1. 在 "Projects"(项目)窗口中,右键单击 ``main.c`` 源文件,然后选择 "Create Test"(创建测试)> "New C Simple Test"(新 C 简单测试)。
image::images/c-unit-mainc-new-simple-test.png[]
-2. 在向导的 "Select Elements"(选择元素)窗口中,单击 ``main`` 函数对应的复选框,然后单击 "Next"(下一步)。
+
+[start=2]
+. 在向导的 "Select Elements"(选择元素)窗口中,单击 ``main`` 函数对应的复选框,然后单击 "Next"(下一步)。
image::images/c-unit-mainc-new-simple-test-select.png[]
-3. 在 "Name and Location"(名称和位置)窗口中,保留默认名称 "New C Simple Test"(新 C 简单测试)并单击 "Finish"(完成)。
+
+[start=3]
+. 在 "Name and Location"(名称和位置)窗口中,保留默认名称 "New C Simple Test"(新 C 简单测试)并单击 "Finish"(完成)。
"New C Simple Test"(新 C 简单测试)节点将显示在 "Test Files"(测试文件)文件夹下。
-4. 展开 "New C Simple Test"(新 C 简单测试)文件夹,可以看到它包含文件 `newsimpletest.c`。此文件应在源代码编辑器中打开。
+
+[start=4]
+. 展开 "New C Simple Test"(新 C 简单测试)文件夹,可以看到它包含文件 `newsimpletest.c`。此文件应在源代码编辑器中打开。
image::images/c-unit-mainc-new-simple-test-folder.png[]
-5. 注意 `newsimpletest.c` 文件包含一个自动生成的测试函数 `testFactorial`,该函数属于 `main.c` 的 `factorial()` 函数,就像 CUnit 测试一样。
+
+[start=5]
+. 注意 `newsimpletest.c` 文件包含一个自动生成的测试函数 `testFactorial`,该函数属于 `main.c` 的 `factorial()` 函数,就像 CUnit 测试一样。
image::images/c-unit-mainc-new-simple-test-code.png[]
``if`` 语句应测试一个条件,如果该条件为 true,则指示测试失败。 ``%%TEST_FAILED%%`` 标记触发在 "Test Results"(测试结果)窗口中显示测试失败的图形指示符。生成的测试中的 ``if`` 语句通过将条件设置为 1 来将其设置为 true,这样在无修改情况下运行时测试始终失败。
@@ -458,7 +499,9 @@
使用 ``message`` 选项可以使测试输出有关测试失败的消息。
-6. 运行测试以查看其是否生成 "Test Results"(测试结果)窗口中显示的失败。
+
+[start=6]
+. 运行测试以查看其是否生成 "Test Results"(测试结果)窗口中显示的失败。
接下来,编辑测试文件以查看通过的测试。
@@ -482,7 +525,9 @@
`main` 函数也必须经过修改才能调用新测试函数。
-2. 在 `main` 函数中,复制以下行:
+
+[start=2]
+. 在 `main` 函数中,复制以下行:
[source,java]
----
@@ -492,7 +537,9 @@
printf("%%TEST_FINISHED%% time=0 testFactorial (newsimpletest)\n");
----
-3. 在您复制的行正下方粘贴这些行,并在粘贴的行中将名称 `testFactorial` 更改为 `testNew`。出现了三处需要更改。
+
+[start=3]
+. 在您复制的行正下方粘贴这些行,并在粘贴的行中将名称 `testFactorial` 更改为 `testNew`。出现了三处需要更改。
完整的 `newsimpletest.c` 文件应如下所示:
[source,c]
@@ -544,7 +591,9 @@
----
-4. 在 "Projects"(项目)窗口中,通过右键单击 "New C Simple Test"(新 C 简单测试)并选择 "Test"(测试)来运行测试。
+
+[start=4]
+. 在 "Projects"(项目)窗口中,通过右键单击 "New C Simple Test"(新 C 简单测试)并选择 "Test"(测试)来运行测试。
测试结果应如下所示:
image::images/c-unit-simpletest-results.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/cpp-vcs.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/cpp-vcs.asciidoc
index a2d5fbe..17208d8 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/cpp-vcs.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/cpp-vcs.asciidoc
@@ -35,21 +35,6 @@
Starting with NetBeans IDE 7.3 storing NetBeans C/C++ projects (mostly projects from existing code and projects from binary) under version control systems (VCS) became less tricky. This article covers the details of storing NetBeans C/C++ projects under VCS in NetBeans IDE.
-=== Contents
-
-image::images/netbeans-stamp-80-74-73.png[title="Content on this page applies to the NetBeans IDE 7.3 and more recent"]
-
-* <<requirements,Requirements>>
-* <<issue,VCS Controlled Project Issues Resolved in NetBeans IDE>>
-* <<unfriendly,VCS Unfriendly Project Data Storage>>
-* <<compiler,Compiler Options>>
-* <<variables,Environment Variables List>>
-* <<cannotbuild,Configuring Code Assistance When You Cannot Build the Project>>
-* <<macros,Transient Macros>>
-* <<prj,Managed Projects>>
-* <<info,More Information about C/C++/Fortran Support>>
-
-
== Requirements
*To follow this tutorial, you need the following software.*
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/debugging.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/debugging.asciidoc
index 67b3e20..0ea72e6 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/debugging.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/debugging.asciidoc
@@ -35,23 +35,6 @@
The following short tutorial takes you through some of the features for debugging a C or C++ project in NetBeans IDE.
-=== Contents
-
-image::images/netbeans-stamp-80-74.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-|===
-|- |<<requirements,Requirements>>
-
-|- |<<project, Creating the Sample Project>>
-
-|- |<<breakpoints, Creating Breakpoints>>
-
-|- |<<starting,Starting a Debugging Session>>
-
-|- |<<inspecting,Inspecting the State of the Application>>
-|===
-
-
== Requirements
*To follow this tutorial, you need the following software and resources.*
@@ -86,10 +69,16 @@
1. In the ``Quote_1`` project, open the ``quote.cc`` file.
2. Set a line breakpoint by clicking in the left margin of the Source Editor window next to line 171 ( ``response = readChar("Enter disk module type: (S for single disks, R for RAID; Q - exit)", 'S');`` ). The line is highlighted in red to indicate that the breakpoint is set.
image::images/line_breakpoint1.png[]
-3. You could remove the breakpoint by clicking on the icon in the left margin.
-4. Choose Window > Debugging > Breakpoints to open the Breakpoints window. Your line breakpoint is listed under the C/C++ node.
+
+[start=3]
+. You could remove the breakpoint by clicking on the icon in the left margin.
+
+[start=4]
+. Choose Window > Debugging > Breakpoints to open the Breakpoints window. Your line breakpoint is listed under the C/C++ node.
image::images/line_breakpoint2.png[]
-5. Expand the C/C++ node to see your breakpoint.
+
+[start=5]
+. Expand the C/C++ node to see your breakpoint.
image::images/line_breakpoint2_expand.png[]
@@ -100,11 +89,17 @@
3. In the Breakpoint Type list, select Function.
4. Type the function name ``Customer::GetDiscount`` in the Function Name text field. Click OK.
image::images/function_breakpoint1.png[]
-5. Your function breakpoint is set and is added to the list in the Breakpoints window.
+
+[start=5]
+. Your function breakpoint is set and is added to the list in the Breakpoints window.
image::images/function_breakpoint2.png[]
-6. Click the Select Breakpoint Groups button in the left margin to organize the breakpoints into different groups and select Type.
+
+[start=6]
+. Click the Select Breakpoint Groups button in the left margin to organize the breakpoints into different groups and select Type.
image::images/group_breakpoint_type.png[]
-7. Expand the File:Line and Function groups to display your breakpoints.
+
+[start=7]
+. Expand the File:Line and Function groups to display your breakpoints.
image::images/breakpoint_types.png[]
@@ -115,7 +110,9 @@
1. Start a debugging session for the ``Quote_1`` project by clicking the Debug Project button image::images/debugbutton.png[] or by choosing Debug > Debug Project.
The debugger starts and the application runs. The debug toolbar is displayed.
image::images/debugger_toolbar.png[]
-2. Open the Sessions window by choosing Window > Debugging > Sessions.
+
+[start=2]
+. Open the Sessions window by choosing Window > Debugging > Sessions.
The debugging session is shown in this window.
@@ -127,30 +124,52 @@
The application stops at the Customer::GetDiscount function breakpoint you set earlier and the customer.cc file opens in the editor at the line where the funtion is called. The Breakpoints window lists the two breakpoints you set earlier. The green program counter arrow appears on top of the breakpoint icon of the function breakpoint.
image::images/function_breakpoint3.png[]
-3. Click the tab for the Call Stack window or choose Window > Debugging > Call Stack. The call stack shows three frames.
+
+[start=3]
+. Click the tab for the Call Stack window or choose Window > Debugging > Call Stack. The call stack shows three frames.
image::images/call_stack.png[]
-4. Open the Variables window and note that one variable is displayed.
-5. Click the expand icons to expand the structure.
+
+[start=4]
+. Open the Variables window and note that one variable is displayed.
+
+[start=5]
+. Click the expand icons to expand the structure.
image::images/local_variables1.png[]
-6. Click the Continue button in the toolbar.
+
+[start=6]
+. Click the Continue button in the toolbar.
The ``GetDiscount`` function is executed, printing the customer discount to the Output (Debug) window. Then you are prompted for input.
-7. Enter the input in response to the prompts.
+
+[start=7]
+. Enter the input in response to the prompts.
The program stops at the next breakpoint, the line breakpoint you set earlier. In the ``quote.cc`` file, the green program counter arrow appears on top of the breakpoint icon indicating the line on which the program is stopped.
image::images/line_breakpoint3.png[]
-8. Click the Variables tab and note the long list of variables.
+
+[start=8]
+. Click the Variables tab and note the long list of variables.
image::images/local_variables2.png[]
-9. Click the Call Stack tab and note that there is now one frame in the stack.
-10. Choose Window > Debugging > Registers.
+
+[start=9]
+. Click the Call Stack tab and note that there is now one frame in the stack.
+
+[start=10]
+. Choose Window > Debugging > Registers.
The Registers window opens, displaying the current contents of the registers.
image::images/registers.png[]
-11. Choose Window > Debugging > Disassembly.
+
+[start=11]
+. Choose Window > Debugging > Disassembly.
The Disassembly window opens, displaying the assembly instructions for the current source file.
image::images/disassembly.png[]
-12. Click the Continue button in the toolbar and continue entering input in response to the prompts in the Output window until the program is completed.
-13. When you press Enter to exit the program, your debug session ends. To end the debug session before the execution of the program was complete, you could click the Finish Debugger Session button in the toolbar or choose Debug > Finish Debugger Session.
+
+[start=12]
+. Click the Continue button in the toolbar and continue entering input in response to the prompts in the Output window until the program is completed.
+
+[start=13]
+. When you press Enter to exit the program, your debug session ends. To end the debug session before the execution of the program was complete, you could click the Finish Debugger Session button in the toolbar or choose Debug > Finish Debugger Session.
== See Also
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ja.asciidoc
index aa18411..7ba8605 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ja.asciidoc
@@ -35,23 +35,6 @@
この短いチュートリアルでは、NetBeans IDEのC/C++プロジェクトをデバッグするための機能の一部を学ぶことができます。
-=== 内容
-
-image::images/netbeans-stamp-80-74.png[title="このページの内容は、NetBeans IDE 7.4および8.0に適用されます"]
-
-|===
-|- |<<requirements,要件>>
-
-|- |<<project,サンプル・プロジェクトの作成>>
-
-|- |<<breakpoints,ブレークポイントの作成>>
-
-|- |<<starting,デバッグ・セッションの開始>>
-
-|- |<<inspecting,アプリケーションの状態の検査>>
-|===
-
-
== 要件
*このチュートリアルに従うには、次のソフトウェアとリソースが必要です。*
@@ -86,10 +69,16 @@
1. ``Quote_1`` プロジェクトの ``quote.cc`` ファイルを開きます。
2. 行171 ( ``response=readChar("Enter disk module type: (S for single disks, R for RAID; Q - exit)", 'S');`` )の横の、「ソース・エディタ」ウィンドウの左マージンをクリックすることによって行ブレークポイントを設定します。赤く強調表示されている行は、ブレークポイントが設定されていることを示します。
image::images/line_breakpoint1.png[]
-3. ブレークポイントは、左マージン内のアイコンをクリックすることによって除去できます。
-4. 「ウィンドウ」>「デバッグ」>「ブレークポイント」を選択し、「ブレークポイント」ウィンドウを開きます。行ブレークポイントがC/C++ノードの下に一覧表示されます。
+
+[start=3]
+. ブレークポイントは、左マージン内のアイコンをクリックすることによって除去できます。
+
+[start=4]
+. 「ウィンドウ」>「デバッグ」>「ブレークポイント」を選択し、「ブレークポイント」ウィンドウを開きます。行ブレークポイントがC/C++ノードの下に一覧表示されます。
image::images/line_breakpoint2.png[]
-5. 行ブレークポイントを表示するには、C/C++ノードを拡張します。
+
+[start=5]
+. 行ブレークポイントを表示するには、C/C++ノードを拡張します。
image::images/line_breakpoint2_expand.png[]
@@ -100,11 +89,17 @@
3. 「ブレークポイント・タイプ」リストで、「関数」を選択します。
4. 「関数名」テキスト・フィールドに「 ``Customer::GetDiscount`` 」を入力します。「OK」をクリックします。
image::images/function_breakpoint1.png[]
-5. 関数ブレークポイントが設定され、「ブレークポイント」ウィンドウの一覧に追加されます。
+
+[start=5]
+. 関数ブレークポイントが設定され、「ブレークポイント」ウィンドウの一覧に追加されます。
image::images/function_breakpoint2.png[]
-6. 左マージンで「ブレークポイント・グループを選択」ボタンをクリックしてブレークポイントを各種グループに編成し、「タイプ」を選択します。
+
+[start=6]
+. 左マージンで「ブレークポイント・グループを選択」ボタンをクリックしてブレークポイントを各種グループに編成し、「タイプ」を選択します。
image::images/group_breakpoint_type.png[]
-7. ブレークポイントを表示するには、「ファイル:行」および「関数」グループを拡張します。
+
+[start=7]
+. ブレークポイントを表示するには、「ファイル:行」および「関数」グループを拡張します。
image::images/breakpoint_types.png[]
@@ -115,7 +110,9 @@
1. 「プロジェクトをデバッグ」ボタンimage::images/debugbutton.png[]をクリックして ``Quote_1`` プロジェクトのデバッグ・セッションを開始するか、「デバッグ」>「プロジェクトをデバッグ」を選択します。
デバッガが起動し、アプリケーションが実行されます。デバッグ・ツールバーが表示されます。
image::images/debugger_toolbar.png[]
-2. 「ウィンドウ」>「デバッグ」>「セッション」を選択して「セッション」ウィンドウを開きます。
+
+[start=2]
+. 「ウィンドウ」>「デバッグ」>「セッション」を選択して「セッション」ウィンドウを開きます。
開いたウィンドウにデバッグ・セッションが表示されます。
@@ -127,30 +124,52 @@
アプリケーションは、前に設定したCustomer::GetDiscount関数ブレークポイントで停止し、customer.ccファイルがエディタ内の関数が呼び出された行で開かれます。「ブレークポイント」ウィンドウに、前に設定した2つのブレークポイントが表示されます。関数ブレークポイントのブレークポイント・アイコンの上に、緑色のプログラム・カウンタの矢印が表示されます。
image::images/function_breakpoint3.png[]
-3. 「呼出しスタック」ウィンドウのタブをクリックするか、「ウィンドウ」>「デバッグ」>「呼出しスタック」を選択します。コール・スタックに3つのフレームが表示されます。
+
+[start=3]
+. 「呼出しスタック」ウィンドウのタブをクリックするか、「ウィンドウ」>「デバッグ」>「呼出しスタック」を選択します。コール・スタックに3つのフレームが表示されます。
image::images/call_stack.png[]
-4. 「変数」ウィンドウを開いて、変数が1つ表示されていることを確認します。
-5. 展開アイコンをクリックし、構造を展開します。
+
+[start=4]
+. 「変数」ウィンドウを開いて、変数が1つ表示されていることを確認します。
+
+[start=5]
+. 展開アイコンをクリックし、構造を展開します。
image::images/local_variables1.png[]
-6. ツールバーにある「続行」ボタンをクリックします。
+
+[start=6]
+. ツールバーにある「続行」ボタンをクリックします。
``GetDiscount`` 関数が実行され、「出力」(デバッグ)ウィンドウに顧客の割引額が表示されます。その後、入力が求められます。
-7. このプロンプトに対して入力を行います。
+
+[start=7]
+. このプロンプトに対して入力を行います。
次のブレークポイント、すなわち前に設定した行ブレークポイントでプログラムが停止します。 ``quote.cc`` ファイルでは、プログラムが停止した行を示すブレークポイントのアイコンの上に、緑色のプログラム・カウンタの矢印が表示されます。
image::images/line_breakpoint3.png[]
-8. 「変数」タブをクリックし、変数の一覧を確認します。
+
+[start=8]
+. 「変数」タブをクリックし、変数の一覧を確認します。
image::images/local_variables2.png[]
-9. 「コール・スタック」タブをクリックし、スタック内にフレームが1つあることを確認します。
-10. 「ウィンドウ」>「デバッグ」>「レジスタ」を選択します。
+
+[start=9]
+. 「コール・スタック」タブをクリックし、スタック内にフレームが1つあることを確認します。
+
+[start=10]
+. 「ウィンドウ」>「デバッグ」>「レジスタ」を選択します。
「レジスタ」ウィンドウが開き、現在のレジスタの内容が表示されます。
image::images/registers.png[]
-11. 「ウィンドウ」>「デバッグ」>「逆アセンブリ」を選択します。
+
+[start=11]
+. 「ウィンドウ」>「デバッグ」>「逆アセンブリ」を選択します。
「逆アセンブリ」ウィンドウが開き、現在のソース・ファイルのアセンブリ命令が表示されます。
image::images/disassembly.png[]
-12. ツールバーにある「続行」ボタンをクリックし、プログラムが完了するまで、「出力」ウィンドウのプロンプトに対応して入力を続けます。
-13. [Enter]を押してプログラムを終了するとデバッグ・セッションが終了します。プログラムの実行が完了する前にデバッグ・セッションを終了するには、ツールバーで「デバッガ・セッションを終了」ボタンをクリックするか、「デバッグ」>「デバッガ・セッションを終了」を選択します。
+
+[start=12]
+. ツールバーにある「続行」ボタンをクリックし、プログラムが完了するまで、「出力」ウィンドウのプロンプトに対応して入力を続けます。
+
+[start=13]
+. [Enter]を押してプログラムを終了するとデバッグ・セッションが終了します。プログラムの実行が完了する前にデバッグ・セッションを終了するには、ツールバーで「デバッガ・セッションを終了」ボタンをクリックするか、「デバッグ」>「デバッガ・セッションを終了」を選択します。
== 関連項目
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_pt_BR.asciidoc
index 50fad74..7a181ae 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_pt_BR.asciidoc
@@ -35,22 +35,6 @@
O breve tutorial a seguir o guia por algumas funcionalidades de depuração de um projeto C ou C++ no NetBeans IDE.
-
-image::images/netbeans-stamp-80-74.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.4 e 8.0"]
-
-|===
-|- |<<requirements,Requisitos>>
-
-|- |<<project,Criando o Projeto de Amostra>>
-
-|- |<<breakpoints,Criando Pontos de Interrupção>>
-
-|- |<<starting,Iniciando uma Sessão de Depuração>>
-
-|- |<<inspecting,Inspecionando o Estado da Aplicação>>
-|===
-
-
== Requisitos
*Para seguir este tutorial, são necessários os recursos e o software a seguir.*
@@ -85,10 +69,16 @@
1. No projeto ``Quote_1`` , abra o arquivo ``quote.cc`` .
2. Defina um ponto de interrupção clicando na margem esquerda da janela Editor de código-fonte ao lado da linha 171 ( ``response = readChar("Digite o tipo do módulo do disco: (S para discos únicos, R para RAID; Q - sair)", 'S');`` ). A linha é realçada em vermelho para indicar que o ponto de interrupção está definido.
image::images/line_breakpoint1.png[]
-3. Você pode remover o ponto de interrupção, clicando no ícone na margem esquerda.
-4. Escolha Janela > Depuração > Pontos de Interrupção para abrir a janela Pontos de interrupção. Seu ponto de interrupção de linha é listado no nó C/C++.
+
+[start=3]
+. Você pode remover o ponto de interrupção, clicando no ícone na margem esquerda.
+
+[start=4]
+. Escolha Janela > Depuração > Pontos de Interrupção para abrir a janela Pontos de interrupção. Seu ponto de interrupção de linha é listado no nó C/C++.
image::images/line_breakpoint2.png[]
-5. Expanda o nó C/C++ para ver seu ponto de interrupção.
+
+[start=5]
+. Expanda o nó C/C++ para ver seu ponto de interrupção.
image::images/line_breakpoint2_expand.png[]
@@ -99,11 +89,17 @@
3. Na lista Tipo de Ponto de Interrupção, selecione Função.
4. Digite o nome da função ``Customer::GetDiscount`` no campo de texto Nome da Função. Clique em OK.
image::images/function_breakpoint1.png[]
-5. Seu ponto de interrupção da função é definido e adicionado à lista na janela Pontos de Interrupção.
+
+[start=5]
+. Seu ponto de interrupção da função é definido e adicionado à lista na janela Pontos de Interrupção.
image::images/function_breakpoint2.png[]
-6. Clique no botão Selecionar Grupos de Ponto de Interrupção na margem esquerda para organizar os pontos de interrupção em diferentes grupos e selecione Tipo.
+
+[start=6]
+. Clique no botão Selecionar Grupos de Ponto de Interrupção na margem esquerda para organizar os pontos de interrupção em diferentes grupos e selecione Tipo.
image::images/group_breakpoint_type.png[]
-7. Expanda os grupos de Arquivo:Linha e Função para exibir seus pontos de interrupção.
+
+[start=7]
+. Expanda os grupos de Arquivo:Linha e Função para exibir seus pontos de interrupção.
image::images/breakpoint_types.png[]
@@ -114,7 +110,9 @@
1. Inicie uma sessão de depuração para o projeto ``Quote_1`` clicando no botão Depurar Projeto image::images/debugbutton.png[] ou escolhendo Depurar > Depurar Projeto.
O depurador é iniciado e a aplicação é executada. A barra de ferramentas do depurador é exibida.
image::images/debugger_toolbar.png[]
-2. Abra a janela Sessões escolhendo Janela > Depuração > Sessões.
+
+[start=2]
+. Abra a janela Sessões escolhendo Janela > Depuração > Sessões.
A sessão de depuração é mostrada nessa janela.
@@ -126,30 +124,52 @@
A aplicação é interrompida no ponto final da função Customer::GetDiscount definida anteriormente e o arquivo customer.cc é aberto no editor, na linha em que a função é chamada. A janela Pontos de Interrupção lista os dois pontos de interrupção que você definiu anteriormente. A seta do contador de programas verde será exibida na parte superior do ícone do ponto de interrupção da função.
image::images/function_breakpoint3.png[]
-3. Clique na guia da janela Pilha de Chamadas ou selecione Janela > Depurando > Pilha de Chamadas. A pilha de chamadas mostra três quadros.
+
+[start=3]
+. Clique na guia da janela Pilha de Chamadas ou selecione Janela > Depurando > Pilha de Chamadas. A pilha de chamadas mostra três quadros.
image::images/call_stack.png[]
-4. Abra a janela Variáveis e observe que uma variável é exibida.
-5. Clique no ícones Expandir para expandir a estrutura.
+
+[start=4]
+. Abra a janela Variáveis e observe que uma variável é exibida.
+
+[start=5]
+. Clique no ícones Expandir para expandir a estrutura.
image::images/local_variables1.png[]
-6. Clique no botão Continuar na barra de ferramentas.
+
+[start=6]
+. Clique no botão Continuar na barra de ferramentas.
A função ``GetDiscount`` é executada, imprimindo o desconto do cliente na janela de Saída (Depuração). Em seguida, é solicitado que você faça a entrada.
-7. Insira a entrada em resposta aos prompts.
+
+[start=7]
+. Insira a entrada em resposta aos prompts.
O programa para no próximo ponto de interrupção, o ponto de interrupção de linha definido anteriormente. No arquivo ``quote.cc`` , a seta verde do contador de programa aparece sobre o ícone do ponto de interrupção indicando a linha em que o programa é parado.
image::images/line_breakpoint3.png[]
-8. Clique na guia Variáveis e observe a longa lista de variáveis.
+
+[start=8]
+. Clique na guia Variáveis e observe a longa lista de variáveis.
image::images/local_variables2.png[]
-9. Clique na guia Pilha de Chamadas e observe que há somente um quadro na pilha.
-10. Escolha Janela > Depuração > Registros.
+
+[start=9]
+. Clique na guia Pilha de Chamadas e observe que há somente um quadro na pilha.
+
+[start=10]
+. Escolha Janela > Depuração > Registros.
A janela Registros se abre, exibindo o conteúdo atual dos registros.
image::images/registers.png[]
-11. Escolha Janela > Depuração > Desmontar.
+
+[start=11]
+. Escolha Janela > Depuração > Desmontar.
A janela Desmontar é aberta, exibindo as instruções de montagem do arquivo de código-fonte atual.
image::images/disassembly.png[]
-12. Clique no botão Continuar na barra de ferramentas e continue inserindo entradas em resposta aos prompts na janela de Saída até que o programa seja concluído.
-13. Quando você pressiona Enter para sair do programa, sua sessão de depuração termina. Para terminar a sessão de depuração antes que a execução do programa seja concluída, você pode clicar no botão Finalizar Sessão do Depurador na barra de ferramentas ou escolher Depurar > Finalizar Sessão do Depurador.
+
+[start=12]
+. Clique no botão Continuar na barra de ferramentas e continue inserindo entradas em resposta aos prompts na janela de Saída até que o programa seja concluído.
+
+[start=13]
+. Quando você pressiona Enter para sair do programa, sua sessão de depuração termina. Para terminar a sessão de depuração antes que a execução do programa seja concluída, você pode clicar no botão Finalizar Sessão do Depurador na barra de ferramentas ou escolher Depurar > Finalizar Sessão do Depurador.
== Consulte Também
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ru.asciidoc
index 6938559..6b313ca 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_ru.asciidoc
@@ -35,22 +35,6 @@
В этом кратком практическом руководстве рассматриваются некоторые аспекты отладки проектов C или C++ в IDE NetBeans.
-
-image::images/netbeans-stamp-80-74.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.4 и 8.0"]
-
-|===
-|- |<<requirements,Требования>>
-
-|- |Создание примера проекта
-
-|- |<<breakpoints, Создание точек останова>>
-
-|- |<<starting,Запуск сеанса отладки>>
-
-|- |<<inspecting,Проверка состояния приложения>>
-|===
-
-
== Требования
*Для работы с этим учебным курсом требуется следующее программное обеспечение и ресурсы.*
@@ -85,10 +69,16 @@
1. В проекте ``Quote_1`` откройте файл ``quote.cc`` .
2. Установите точку останова на строке, щелкнув левое поле окна редактора исходного кода рядом со строкой 171 ( ``response = readChar("Enter disk module type: (S for single disks, R for RAID; Q - exit)", 'S');`` ). Строка будет выделена красным цветом, что обозначает установку точки останова.
image::images/line_breakpoint1.png[]
-3. Чтобы удалить точку останова, щелкните значок в левом поле.
-4. Выберите "Окно" > "Отладка" > "Точки останова", чтобы открыть окно точек останова. Линейная точка останова находится в списке под узлом C/C++.
+
+[start=3]
+. Чтобы удалить точку останова, щелкните значок в левом поле.
+
+[start=4]
+. Выберите "Окно" > "Отладка" > "Точки останова", чтобы открыть окно точек останова. Линейная точка останова находится в списке под узлом C/C++.
image::images/line_breakpoint2.png[]
-5. Разверните узел C/C++, чтобы стала видна точка останова.
+
+[start=5]
+. Разверните узел C/C++, чтобы стала видна точка останова.
image::images/line_breakpoint2_expand.png[]
@@ -99,11 +89,17 @@
3. В списке 'Тип точки останова' выберите 'Функция'.
4. Введите имя функции ``Customer::GetDiscount`` в текстовом поле "Имя функции". Нажмите кнопку "ОК".
image::images/function_breakpoint1.png[]
-5. Точка останова на функции установлена и добавлена в список в окне "Точки останова".
+
+[start=5]
+. Точка останова на функции установлена и добавлена в список в окне "Точки останова".
image::images/function_breakpoint2.png[]
-6. Нажмите кнопку 'Выбрать группы точек останова' в левой части окна, чтобы объединить точки останова в различные группы и выбрать тип.
+
+[start=6]
+. Нажмите кнопку 'Выбрать группы точек останова' в левой части окна, чтобы объединить точки останова в различные группы и выбрать тип.
image::images/group_breakpoint_type.png[]
-7. Разверните группы 'Файл:Строка' и 'Функция', чтобы стали видны точки останова.
+
+[start=7]
+. Разверните группы 'Файл:Строка' и 'Функция', чтобы стали видны точки останова.
image::images/breakpoint_types.png[]
@@ -114,7 +110,9 @@
1. Начните сеанс отладки для проекта ``Quote_1`` . Для этого нажмите кнопку 'Отладить проект' image::images/debugbutton.png[] или выберите Отладка > Отладить проект.
Запускается отладчик и приложение выполняется. Отображается панель инструментов отладчика.
image::images/debugger_toolbar.png[]
-2. Откройте окно "Сеансы": для этого выберите "Окно" > "Отладка" > "Сеансы".
+
+[start=2]
+. Откройте окно "Сеансы": для этого выберите "Окно" > "Отладка" > "Сеансы".
Сеанс отладки показан в этом окне.
@@ -126,30 +124,52 @@
Приложение останавливается на ранее заданной точке останова функции Customer::GetDiscount, и в редакторе открывается файл customer.cc с фокусом в строке, где вызывается данная функция. В окне 'Точки останова' отобразятся две точки останова, установленные ранее. Зеленая стрелка счетчика программы отображается поверх значка точки останова функции.
image::images/function_breakpoint3.png[]
-3. Нажмите на вкладку, чтобы открыть окно 'Стек вызовов' или выберите Окно > Отладка > Стек вызовов. В стеке вызовов отображаются три окна.
+
+[start=3]
+. Нажмите на вкладку, чтобы открыть окно 'Стек вызовов' или выберите Окно > Отладка > Стек вызовов. В стеке вызовов отображаются три окна.
image::images/call_stack.png[]
-4. Откройте окно "Переменные", в которой отображается одна переменная.
-5. Щелкните значок 'Развернуть', чтобы развернуть структуру.
+
+[start=4]
+. Откройте окно "Переменные", в которой отображается одна переменная.
+
+[start=5]
+. Щелкните значок 'Развернуть', чтобы развернуть структуру.
image::images/local_variables1.png[]
-6. Нажмите кнопку "Продолжить" на панели инструментов.
+
+[start=6]
+. Нажмите кнопку "Продолжить" на панели инструментов.
Будет выполнена функция ``GetDiscount`` , и результаты скидки для клиента появятся в окне 'Результаты (Отладка)'. После этого отобразится запрос на ввод данных.
-7. Введите данные после отображения запроса.
+
+[start=7]
+. Введите данные после отображения запроса.
Программа остановится в следующей точке останова – в заданной ранее точке останова на строке. В файле ``quote.cc`` вверху значка точки останова отобразится зеленая стрелка счетчика команд, обозначающая строку, на которой остановлена программа.
image::images/line_breakpoint3.png[]
-8. Перейдите на вкладку "Переменные", в которой отобразится длинный список переменных.
+
+[start=8]
+. Перейдите на вкладку "Переменные", в которой отобразится длинный список переменных.
image::images/local_variables2.png[]
-9. Перейдите на вкладку "Стек вызовов", в которой теперь отобразится одно окно в стеке.
-10. Выберите "Окно" > "Отладка" > "Регистры".
+
+[start=9]
+. Перейдите на вкладку "Стек вызовов", в которой теперь отобразится одно окно в стеке.
+
+[start=10]
+. Выберите "Окно" > "Отладка" > "Регистры".
Откроется окно "Регистры", отображающее текущее содержимое регистров.
image::images/registers.png[]
-11. Выберите "Окно" > "Отладка" > "Дисассемблер".
+
+[start=11]
+. Выберите "Окно" > "Отладка" > "Дисассемблер".
Откроется окно "Дисассемблер", отображающее команды ассемблера для текущего файла исходного кода.
image::images/disassembly.png[]
-12. Нажмите кнопку 'Продолжить'; на панели инструментов и продолжите вводить данные в ответ на запросы в окно вывода, пока программа не будет завершена.
-13. Когда вы нажимаете Enter, чтобы выйти из программы, сеанс отладки завершается. Чтобы завершить сеанс отладки до завершения выполнения программы, можно нажать кнопку 'Завершить сеанс отладчика' на панели инструментов или выбрать Отладка > Завершить сеанс отладчика.
+
+[start=12]
+. Нажмите кнопку 'Продолжить'; на панели инструментов и продолжите вводить данные в ответ на запросы в окно вывода, пока программа не будет завершена.
+
+[start=13]
+. Когда вы нажимаете Enter, чтобы выйти из программы, сеанс отладки завершается. Чтобы завершить сеанс отладки до завершения выполнения программы, можно нажать кнопку 'Завершить сеанс отладчика' на панели инструментов или выбрать Отладка > Завершить сеанс отладчика.
== См. также
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_zh_CN.asciidoc
index 7eabc07..4d2b71f 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/debugging_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/debugging_zh_CN.asciidoc
@@ -35,22 +35,6 @@
下面的简明教程将为您介绍 NetBeans IDE 中用于调试 C 或 C++ 项目的一些功能。
-
-image::images/netbeans-stamp-80-74.png[title="此页上的内容适用于 NetBeans IDE 7.4 和 8.0"]
-
-|===
-|- |<<requirements,要求>>
-
-|- |<<project,创建样例项目>>
-
-|- |<<breakpoints,创建断点>>
-
-|- |<<starting,启动调试会话>>
-
-|- |<<inspecting,检查应用程序状态>>
-|===
-
-
== 要求
*要学习本教程,您需要具备以下软件和资源。*
@@ -85,10 +69,16 @@
1. 在 ``Quote_1`` 项目中,打开 ``quote.cc`` 文件。
2. 在源代码编辑器窗口靠近 171 行 ( ``response = readChar("Enter disk module type: (S for single disks, R for RAID; Q - exit)", 'S');`` ) 的左旁注中单击,设置一个行断点。该行将以红色突出显示,表明断点已设置。
image::images/line_breakpoint1.png[]
-3. 您可以通过单击位于左旁注中的图标来删除断点。
-4. 选择 "Window"(窗口)> "Debugging"(调试)> "Breakpoints"(断点)打开 "Breakpoints"(断点)窗口。在 C/C++ 节点下列出您的行断点。
+
+[start=3]
+. 您可以通过单击位于左旁注中的图标来删除断点。
+
+[start=4]
+. 选择 "Window"(窗口)> "Debugging"(调试)> "Breakpoints"(断点)打开 "Breakpoints"(断点)窗口。在 C/C++ 节点下列出您的行断点。
image::images/line_breakpoint2.png[]
-5. 展开 C/C++ 节点可查看您的断点。
+
+[start=5]
+. 展开 C/C++ 节点可查看您的断点。
image::images/line_breakpoint2_expand.png[]
@@ -99,11 +89,17 @@
3. 在 "Breakpoint Type"(断点类型)列表中,选择 "Function"(函数)。
4. 在 "Function Name"(函数名)文本字段中键入函数名 ``Customer::GetDiscount`` 。单击 "OK"(确定)。
image::images/function_breakpoint1.png[]
-5. 函数断点已设置,并且已添加到 "Breakpoints"(断点)窗口列表中。
+
+[start=5]
+. 函数断点已设置,并且已添加到 "Breakpoints"(断点)窗口列表中。
image::images/function_breakpoint2.png[]
-6. 单击左旁注中的 "Select Breakpoint Groups"(选择断点组)按钮以将断点组织到不同的组,然后选择 "Type"(类型)。
+
+[start=6]
+. 单击左旁注中的 "Select Breakpoint Groups"(选择断点组)按钮以将断点组织到不同的组,然后选择 "Type"(类型)。
image::images/group_breakpoint_type.png[]
-7. 展开 "File:Line"(文件:行)和 "Function"(函数)组以显示您的断点。
+
+[start=7]
+. 展开 "File:Line"(文件:行)和 "Function"(函数)组以显示您的断点。
image::images/breakpoint_types.png[]
@@ -114,7 +110,9 @@
1. 通过单击 "Debug Project"(调试项目)按钮 image::images/debugbutton.png[] 或通过选择 "Debug"(调试)> "Debug Project"(调试项目),为 ``Quote_1`` 项目启动调试会话。
此时将启动调节器,并运行应用程序。显示调试工具栏。
image::images/debugger_toolbar.png[]
-2. 选择 "Window"(窗口)> "Debugging"(调试)> "Sessions"(会话)打开 "Sessions"(会话)窗口。
+
+[start=2]
+. 选择 "Window"(窗口)> "Debugging"(调试)> "Sessions"(会话)打开 "Sessions"(会话)窗口。
调试会话将显示在此窗口中。
@@ -126,30 +124,52 @@
该应用程序将在您先前设置的 Customer::GetDiscount 函数断点处停止,并且 customer.cc 文件将在编辑器中调用该函数的行中打开。此时 "Breakpoints"(断点)窗口会列出先前设置的两个断点。函数断点的断点图标顶端会出现绿色程序计数器箭头。
image::images/function_breakpoint3.png[]
-3. 单击 "Call Stack"(调用堆栈)窗口的标签,或者选择 "Window"(窗口)> "Debugging"(调试)> "Call Stack"(调用堆栈)。此时调用堆栈将显示三个框架。
+
+[start=3]
+. 单击 "Call Stack"(调用堆栈)窗口的标签,或者选择 "Window"(窗口)> "Debugging"(调试)> "Call Stack"(调用堆栈)。此时调用堆栈将显示三个框架。
image::images/call_stack.png[]
-4. 打开 "Variables"(变量)窗口,此时您看到显示了一个变量。
-5. 单击展开图标以展开此结构。
+
+[start=4]
+. 打开 "Variables"(变量)窗口,此时您看到显示了一个变量。
+
+[start=5]
+. 单击展开图标以展开此结构。
image::images/local_variables1.png[]
-6. 单击工具栏中的 "Continue"(继续)按钮。
+
+[start=6]
+. 单击工具栏中的 "Continue"(继续)按钮。
此时将执行 ``GetDiscount`` 函数,同时在 "Output (Debug)"(输出(调试))窗口中显示客户折扣。此时系统会提示输入信息。
-7. 按照提示输入信息。
+
+[start=7]
+. 按照提示输入信息。
程序会在下一个断点(即先前设置的行断点)处停止。在 ``quote.cc`` 文件中,断点图标顶端会出现绿色程序计数器箭头,指示程序暂停在哪一行。
image::images/line_breakpoint3.png[]
-8. 单击 "Variables"(变量)标签,注意会显示局部变量的详细列表。
+
+[start=8]
+. 单击 "Variables"(变量)标签,注意会显示局部变量的详细列表。
image::images/local_variables2.png[]
-9. 单击 "Call Stack"(调用堆栈)标签,注意此时堆栈中有一个框架。
-10. 选择 "Window"(窗口)> "Debugging"(调试)> "Registers"(注册)。
+
+[start=9]
+. 单击 "Call Stack"(调用堆栈)标签,注意此时堆栈中有一个框架。
+
+[start=10]
+. 选择 "Window"(窗口)> "Debugging"(调试)> "Registers"(注册)。
此时将打开 "Registers"(注册)窗口,其中显示注册的当前内容。
image::images/registers.png[]
-11. 选择 "Window"(窗口)> "Debugging"(调试)> "Disassembly"(反汇编)。
+
+[start=11]
+. 选择 "Window"(窗口)> "Debugging"(调试)> "Disassembly"(反汇编)。
此时将打开 "Disassembly"(反汇编)窗口,其中显示当前源文件的汇编指令。
image::images/disassembly.png[]
-12. 单击工具栏中的 "Continue"(继续)按钮,并继续按照提示在 "Output"(输出)窗口中输入信息,直到程序完成。
-13. 按 Enter 键退出程序后,调试会话便会结束。要在程序执行完毕以前结束调试会话,可以在工具栏中单击 "Finish Debugger Session"(完成调试器会话)按钮,或者选择 "Debug"(调试)> "Finish Debugger Session"(完成调试器会话)。
+
+[start=12]
+. 单击工具栏中的 "Continue"(继续)按钮,并继续按照提示在 "Output"(输出)窗口中输入信息,直到程序完成。
+
+[start=13]
+. 按 Enter 键退出程序后,调试会话便会结束。要在程序执行完毕以前结束调试会话,可以在工具栏中单击 "Finish Debugger Session"(完成调试器会话)按钮,或者选择 "Debug"(调试)> "Finish Debugger Session"(完成调试器会话)。
== 另请参见
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment.asciidoc
index 58aff50..cbaf9ab 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment.asciidoc
@@ -101,9 +101,15 @@
The Add Tool Collection dialog box opens.
image::images/add-collection.png[]
-3. In the Add New Tool Collection dialog box, type the directory path for the tool collection's executable files in the Base Directory field, or use the Browse button to navigate to the directory, which is usually called ``bin`` .
-4. The Tool Collection Family and Tool Collection Name are filled in automatically for valid paths. You can specify a different name to display in the IDE for the collection. If you change the Tool Collection Family, make sure that the family you specify is correct for the collection or the compiler flags might not be valid.
-5. Click OK.
+
+[start=3]
+. In the Add New Tool Collection dialog box, type the directory path for the tool collection's executable files in the Base Directory field, or use the Browse button to navigate to the directory, which is usually called ``bin`` .
+
+[start=4]
+. The Tool Collection Family and Tool Collection Name are filled in automatically for valid paths. You can specify a different name to display in the IDE for the collection. If you change the Tool Collection Family, make sure that the family you specify is correct for the collection or the compiler flags might not be valid.
+
+[start=5]
+. Click OK.
The new tool collection is added to the Tool Collection list.
@@ -120,7 +126,9 @@
4. Select a collection from the Tool Collection dropdown list.
image::images/select-collection.png[]
-5. Click OK.
+
+[start=5]
+. Click OK.
The next time you build the project, the selected tool collection will be used.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ja.asciidoc
index 3dbd81b..3f124b4 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ja.asciidoc
@@ -101,9 +101,15 @@
ツール・コレクションの追加ダイアログ・ボックスが開きます。
image::images/add-collection.png[]
-3. 「新規ツール・コレクションの追加」ダイアログ・ボックスで、「ベース・ディレクトリ」フィールドにツール・コレクションの実行可能ファイルのディレクトリ・パスを入力するか、「参照」ボタンを使用してディレクトリ(通常は ``bin`` と呼ばれている)に移動します。
-4. 「ツール・コレクション・ファミリ」と「ツール・コレクション名」は、有効なパスに対して自動的に入力されます。IDEで表示する別の名前をコレクションに指定することもできます。ツール・コレクション・ファミリを変更する場合は、指定するファミリがコレクションに適切であることを確認してください。適切ではなかった場合、コンパイラのフラグが有効にならない可能性があります。
-5. 「OK」をクリックします。
+
+[start=3]
+. 「新規ツール・コレクションの追加」ダイアログ・ボックスで、「ベース・ディレクトリ」フィールドにツール・コレクションの実行可能ファイルのディレクトリ・パスを入力するか、「参照」ボタンを使用してディレクトリ(通常は ``bin`` と呼ばれている)に移動します。
+
+[start=4]
+. 「ツール・コレクション・ファミリ」と「ツール・コレクション名」は、有効なパスに対して自動的に入力されます。IDEで表示する別の名前をコレクションに指定することもできます。ツール・コレクション・ファミリを変更する場合は、指定するファミリがコレクションに適切であることを確認してください。適切ではなかった場合、コンパイラのフラグが有効にならない可能性があります。
+
+[start=5]
+. 「OK」をクリックします。
ツール・コレクションのリストに新規ツール・コレクションが追加されます。
@@ -120,7 +126,9 @@
4. 「ツール・コレクション」ドロップダウン・リストからコレクションを選択します。
image::images/select-collection.png[]
-5. 「OK」をクリックします。
+
+[start=5]
+. 「OK」をクリックします。
次回プロジェクトをビルドするときに、選択したツール・コレクションが使用されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_pt_BR.asciidoc
index b4c232f..92ea4bd 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_pt_BR.asciidoc
@@ -101,9 +101,15 @@
A caixa de diálogo Adicionar Coleção de Ferramentas é aberta.
image::images/add-collection.png[]
-3. Na caixa de diálogo Adicionar Nova Coleção de Ferramentas, digite o caminho do diretório dos arquivos executáveis da coleção de ferramentas no campo Diretório base ou use o botão Procurar para ir até o diretório, que geralmente é chamado ``bin`` .
-4. Os campos Família de Coleções de Ferramentas e Nome da Coleção de ferramentas são preenchidos automaticamente com caminhos válidos. Você pode especificar um nome diferente para exibir no IDE para a coleção. Se você alterar a Família de Coleções de Ferramentas, certifique-se de que a família especificada seja a correta para a coleção; caso contrário, os flags do compilador talvez não sejam válidos.
-5. Clique em OK.
+
+[start=3]
+. Na caixa de diálogo Adicionar Nova Coleção de Ferramentas, digite o caminho do diretório dos arquivos executáveis da coleção de ferramentas no campo Diretório base ou use o botão Procurar para ir até o diretório, que geralmente é chamado ``bin`` .
+
+[start=4]
+. Os campos Família de Coleções de Ferramentas e Nome da Coleção de ferramentas são preenchidos automaticamente com caminhos válidos. Você pode especificar um nome diferente para exibir no IDE para a coleção. Se você alterar a Família de Coleções de Ferramentas, certifique-se de que a família especificada seja a correta para a coleção; caso contrário, os flags do compilador talvez não sejam válidos.
+
+[start=5]
+. Clique em OK.
A nova coleção de ferramentas é adicionada à lista de Coleção de Ferramentas.
@@ -120,7 +126,9 @@
4. Selecione uma coleção na lista drop-down Coleção de Ferramentas.
image::images/select-collection.png[]
-5. Clique em OK.
+
+[start=5]
+. Clique em OK.
Na próxima vez que o projeto for construído, será usada a coleção de ferramentas selecionada.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ru.asciidoc
index 43eaceb..1f58491 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_ru.asciidoc
@@ -101,9 +101,15 @@
Открывается диалоговое окно 'Добавление набора средств'.
image::images/add-collection.png[]
-3. В диалоговом окне 'Добавление набора средств' в поле 'Базовый каталог' введите путь к каталогу с исполняемыми файлами набора средств или нажмите кнопку 'Обзор' для перехода в этот каталог, который обычно называется ``bin`` .
-4. Поля "Семейство наборов средств" и "Имя набора средств" для действительных путей заполняются автоматически. Вы можете указать другое имя, которое будет отображаться для набора в IDE. Если вы хотите изменить семейство наборов средств, убедитесь, что указанное семейство совместимо с набором средств, иначе флаги компилятора могут быть интерпретированы неверно.
-5. Нажмите кнопку "ОК".
+
+[start=3]
+. В диалоговом окне 'Добавление набора средств' в поле 'Базовый каталог' введите путь к каталогу с исполняемыми файлами набора средств или нажмите кнопку 'Обзор' для перехода в этот каталог, который обычно называется ``bin`` .
+
+[start=4]
+. Поля "Семейство наборов средств" и "Имя набора средств" для действительных путей заполняются автоматически. Вы можете указать другое имя, которое будет отображаться для набора в IDE. Если вы хотите изменить семейство наборов средств, убедитесь, что указанное семейство совместимо с набором средств, иначе флаги компилятора могут быть интерпретированы неверно.
+
+[start=5]
+. Нажмите кнопку "ОК".
Новый набор средств добавляется в список 'Наборы средств'.
@@ -120,7 +126,9 @@
4. Выберите набор из списка 'Наборы средств'.
image::images/select-collection.png[]
-5. Нажмите кнопку "ОК".
+
+[start=5]
+. Нажмите кнопку "ОК".
При следующей сборке проекта будет использоваться выбранный набор средств.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_zh_CN.asciidoc
index ba4561f..7e73aa5 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/development-environment_zh_CN.asciidoc
@@ -101,9 +101,15 @@
此时将打开 "Add Tool Collection"(添加工具集合)对话框。
image::images/add-collection.png[]
-3. 在 "Add New Tool Collection"(添加新工具集合)对话框的 "Base Directory"(基目录)字段中,键入该工具集合的可执行文件的目录路径,或使用 "Browse"(浏览)按钮导航至该目录(通常称为 ``bin`` )。
-4. 如果路径有效,将自动填充 "Tool Collection Family"(工具集合系列)和 "Tool Collection Name"(工具集合名称)。可以为集合指定在 IDE 中显示的不同名称。如果更改 "Tool Collection Family"(工具集合系列),请确保您指定的系列是该集合的正确系列,否则编译器标志可能无效。
-5. 单击 "OK"(确定)。
+
+[start=3]
+. 在 "Add New Tool Collection"(添加新工具集合)对话框的 "Base Directory"(基目录)字段中,键入该工具集合的可执行文件的目录路径,或使用 "Browse"(浏览)按钮导航至该目录(通常称为 ``bin`` )。
+
+[start=4]
+. 如果路径有效,将自动填充 "Tool Collection Family"(工具集合系列)和 "Tool Collection Name"(工具集合名称)。可以为集合指定在 IDE 中显示的不同名称。如果更改 "Tool Collection Family"(工具集合系列),请确保您指定的系列是该集合的正确系列,否则编译器标志可能无效。
+
+[start=5]
+. 单击 "OK"(确定)。
新工具集合将添加到 "Tool Collection"(工具集合)列表中。
@@ -120,7 +126,9 @@
4. 从 "Tool Collection"(工具集合)下拉列表中选择一个集合。
image::images/select-collection.png[]
-5. 单击 "OK"(确定)。
+
+[start=5]
+. 单击 "OK"(确定)。
下次构建项目时,将使用选定的工具集合。
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing.asciidoc
index 0508506..1821d00 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing.asciidoc
@@ -35,23 +35,6 @@
The following short tutorial takes you through some of the features for navigating and editing the source files in a C or C++ project in NetBeans IDE.
-=== Contents
-
-image::images/netbeans-stamp-80-74.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-|===
-|- |<<requirements,Requirements>>
-
-|- |<<project,Creating the Sample Project>>
-
-|- |<<editing,Editing C and C++ Source Files>>
-
-|- |<<navigating,Navigating C and C++ Source Files>>
-
-|- |<<nextsteps,Next Steps>>
-|===
-
-
== Requirements
*To follow this tutorial, you need the following software and resources.*
@@ -95,7 +78,9 @@
4. Select the C++ language from the Language drop-down list because the Quote project uses C++.
5. Select the style you want to set from the Style drop-down list.
image::images/formatting_style.png[]
-6. Modify the style properties as desired.
+
+[start=6]
+. Modify the style properties as desired.
=== Folding Blocks of Code in C and C++ Files
@@ -121,8 +106,12 @@
7. Click on an occurrence of the ``Customer`` class.
8. All of the occurrences of the ``Customer`` class in the file are highlighted with a yellow background. The right margin also shows markings that indicate points where an occurrence is located in the file. The markings let you see how many occurrences there are without scrolling through the file. You can click the markings to jump to the occurrences that they represent.
image::images/highlighting1.png[]
-9. To easily navigate between the occurrences, press Alt+Down to go to the next occurrence, and press Alt+Up to go to the previous occurrence.
-10. Open the ``customer.h`` file, located in the Headers folder, and notice that class names are again highlighted in bold.
+
+[start=9]
+. To easily navigate between the occurrences, press Alt+Down to go to the next occurrence, and press Alt+Up to go to the previous occurrence.
+
+[start=10]
+. Open the ``customer.h`` file, located in the Headers folder, and notice that class names are again highlighted in bold.
image::images/highlighting2.png[]
@@ -136,14 +125,24 @@
2. On the first blank line of the ``quote.cc`` , type a capital C and press Ctrl-Space. The code completion box displays a short list that includes the ``Cpu`` and ``Customer`` classes. A documentation window also opens but displays "No documentation found" because the project source does not include documentation for its code.
3. Expand the list of items by pressing Ctrl-Space again.
image::images/code_completion1.png[]
-4. Use your arrow keys or mouse to highlight a standard library function such as ``calloc`` from the list, and the documentation window displays the man page for that function if the man page is accessible to the IDE.
+
+[start=4]
+. Use your arrow keys or mouse to highlight a standard library function such as ``calloc`` from the list, and the documentation window displays the man page for that function if the man page is accessible to the IDE.
image::images/code-completion-documentation.png[]
-5. Select the ``Customer`` class and press Enter.
-6. Complete the new instance of the ``Customer`` class by typing " ``andrew;`` ". On the next line, type the letter ``a`` and press Ctrl-Space twice. The code completion box displays a list of choices starting with the letter ``a`` , such as method arguments, class fields, and global names, that are accessible from the current context.
+
+[start=5]
+. Select the ``Customer`` class and press Enter.
+
+[start=6]
+. Complete the new instance of the ``Customer`` class by typing " ``andrew;`` ". On the next line, type the letter ``a`` and press Ctrl-Space twice. The code completion box displays a list of choices starting with the letter ``a`` , such as method arguments, class fields, and global names, that are accessible from the current context.
image::images/code_completion2.png[]
-7. Double-click the ``andrew`` option to accept it and type a period after it. Press Ctrl-Space and you are provided with a list of the public methods and fields of the ``Customer`` class.
+
+[start=7]
+. Double-click the ``andrew`` option to accept it and type a period after it. Press Ctrl-Space and you are provided with a list of the public methods and fields of the ``Customer`` class.
image::images/code_completion3.png[]
-8. Delete the code you have added.
+
+[start=8]
+. Delete the code you have added.
=== Adding Source Code Documentation
@@ -152,15 +151,27 @@
1. In the ``quote.cc`` file, place your cursor on line 75, or the line above the line
``int readNumberOf(const char* item, int min, int max) {``
-2. Type a slash and two asterisks and press Enter. The editor inserts a Doxygen-formatted comment for the ``readNumberOf`` class.
+
+[start=2]
+. Type a slash and two asterisks and press Enter. The editor inserts a Doxygen-formatted comment for the ``readNumberOf`` class.
image::images/doxygen_comment.png[]
-3. Add some descriptive text to each of the @param lines and save the file.
+
+[start=3]
+. Add some descriptive text to each of the @param lines and save the file.
image::images/doxygen_comment_edited.png[]
-4. Click the ``readNumberOf`` class to highlight it in yellow, and click one of the occurrences marks on the right to jump to a location where the class is used.
-5. Click the ``readNumberOf`` class in the line you jumped to, and press Ctrl-Shift-Space to show the documentation that you just added for the parameters.
+
+[start=4]
+. Click the ``readNumberOf`` class to highlight it in yellow, and click one of the occurrences marks on the right to jump to a location where the class is used.
+
+[start=5]
+. Click the ``readNumberOf`` class in the line you jumped to, and press Ctrl-Shift-Space to show the documentation that you just added for the parameters.
image::images/doxygen_displayed.png[]
-6. Click anywhere else in the file to close the documentation window, and click on the ``readNumberOf`` class again.
-7. Choose Source > Show Documentation to open the documentation window for the class again.
+
+[start=6]
+. Click anywhere else in the file to close the documentation window, and click on the ``readNumberOf`` class again.
+
+[start=7]
+. Choose Source > Show Documentation to open the documentation window for the class again.
=== Using Code Templates
@@ -200,17 +211,27 @@
* Choose Edit > Find In Projects.
* Right-click a project in the Projects window and choose Find.
* Press Ctrl+Shift+F.
-2. In the Find In Projects dialog box, select the Default Search tab or the Grep tab. The Grep tab uses the ``grep`` utility, which provides a faster search, especially for remote projects.
+
+[start=2]
+. In the Find In Projects dialog box, select the Default Search tab or the Grep tab. The Grep tab uses the ``grep`` utility, which provides a faster search, especially for remote projects.
image::images/find_in_projects.png[]
-3. In the Grep tab, type the text or regular expression for which you want to search, specify the search scope and file name pattern, and select the check box Open in New Tab so you can save multiple searches in separate tabs.
-4. Click Find.
+
+[start=3]
+. In the Grep tab, type the text or regular expression for which you want to search, specify the search scope and file name pattern, and select the check box Open in New Tab so you can save multiple searches in separate tabs.
+
+[start=4]
+. Click Find.
The Search Results tab lists the files in which the text or regular expression is found.
Buttons in the left margin enable you to change your view of the search results.
image::images/find_in_projects2.png[]
-5. Click the Expand/Collapse button to collapse the list of files so only the filenames are shown. Click the other buttons to show the search results as a directory tree or as a list of files. These options are useful when you perform a search across multiple projects.
-6. Double-click one of the items in the list and the IDE takes you to the corresponding location in the source editor.
+
+[start=5]
+. Click the Expand/Collapse button to collapse the list of files so only the filenames are shown. Click the other buttons to show the search results as a directory tree or as a list of files. These options are useful when you perform a search across multiple projects.
+
+[start=6]
+. Double-click one of the items in the list and the IDE takes you to the corresponding location in the source editor.
== Navigating C and C++ Source Files
@@ -226,7 +247,9 @@
2. Expand the ``Quote_1`` node in the Classes window. All classes in the project are listed.
3. Expand the ``Customer`` class.
image::images/classes_window.png[]
-4. Double-click the ``name`` variable to open the ``customer.h`` header file.
+
+[start=4]
+. Double-click the ``name`` variable to open the ``customer.h`` header file.
=== Using the Navigator Window
@@ -236,8 +259,12 @@
1. Click anywhere in the ``quote.cc`` file in the Editor window.
2. A compact view of the file is displayed in the Navigator window.
image::images/navigator_window.png[]
-3. To navigate to an element of the file, double-click the element in the Navigator window and the cursor in the Editor window moves to that element.
-4. Right-click in the Navigator to choose a different way to sort the elements, or group the items, or filter them.
+
+[start=3]
+. To navigate to an element of the file, double-click the element in the Navigator window and the cursor in the Editor window moves to that element.
+
+[start=4]
+. Right-click in the Navigator to choose a different way to sort the elements, or group the items, or filter them.
To find out what the icons in the Navigator represent, open the IDE online help by choosing Help > Help Contents, and search for "navigator icons" in the help window.
@@ -250,7 +277,9 @@
2. In the Find Usages dialog box, click Find.
3. The Usages window opens and displays all of the usages of the ``Customer`` class in the source files of the project.
image::images/usages_window.png[]
-4. Click the arrow buttons in the left margin to step through the occurrences and show them in the Editor, or change between logical and physical view. You can also filter the information using a second column of buttons in the left margin.
+
+[start=4]
+. Click the arrow buttons in the left margin to step through the occurrences and show them in the Editor, or change between logical and physical view. You can also filter the information using a second column of buttons in the left margin.
=== Using the Call Graph
@@ -263,10 +292,16 @@
If you do not see all the functions as shown here, click the third button on the left side of the Call Graph window to show "who is called from this function."
-3. Expand the ``endl`` node to display the functions called by that function. Notice the graph is updated to show the functions called by ``endl`` as well.
-4. Click the second button, called Bring Into Focus, on the left side of the window to focus on the ``endl`` function, then click the fourth button Who Calls this Function to view all the functions that call the ``endl`` function.
+
+[start=3]
+. Expand the ``endl`` node to display the functions called by that function. Notice the graph is updated to show the functions called by ``endl`` as well.
+
+[start=4]
+. Click the second button, called Bring Into Focus, on the left side of the window to focus on the ``endl`` function, then click the fourth button Who Calls this Function to view all the functions that call the ``endl`` function.
image::images/call_graph2.png[]
-5. Expand some of the nodes in the tree to see more functions.
+
+[start=5]
+. Expand some of the nodes in the tree to see more functions.
image::images/call_graph3.png[]
@@ -276,17 +311,31 @@
1. In the ``cpu.cc`` file of the ``Quote_1`` project, mouse over line 37 while pressing Ctrl. The ``ComputeSupportMetric`` function is highlighted and an annotation displays information about the function.
image::images/hyperlinks1.png[]
-2. Click the hyperlink and the editor jumps to the definition of the function.
+
+[start=2]
+. Click the hyperlink and the editor jumps to the definition of the function.
image::images/hyperlinks2.png[]
-3. Mouse over the definition while pressing Ctrl, and click the hyperlink. The editor jumps to the declaration of the function in the ``cpu.h`` header file.
+
+[start=3]
+. Mouse over the definition while pressing Ctrl, and click the hyperlink. The editor jumps to the declaration of the function in the ``cpu.h`` header file.
image::images/hyperlinks3.png[]
-4. Click the left arrow in the editor toolbar (second button from the left) and the editor jumps back to the definition in ``cpu.cc`` .
-5. Hover the mouse cursor over the green circle in the left margin and see the annotation that indicates that this method overrides another method.
+
+[start=4]
+. Click the left arrow in the editor toolbar (second button from the left) and the editor jumps back to the definition in ``cpu.cc`` .
+
+[start=5]
+. Hover the mouse cursor over the green circle in the left margin and see the annotation that indicates that this method overrides another method.
image::images/overide_annotation.png[]
-6. Click the green circle to go to the overridden method and you jump to the ``module.h`` header file, which shows a gray circle in the margin to indicate the method is overridden.
-7. Click the gray circle and the editor displays a list of methods that override this method.
+
+[start=6]
+. Click the green circle to go to the overridden method and you jump to the ``module.h`` header file, which shows a gray circle in the margin to indicate the method is overridden.
+
+[start=7]
+. Click the gray circle and the editor displays a list of methods that override this method.
image::images/overridden_by_list.png[]
-8. Click the ``Cpu::ComputeSupportMetric`` item and you jump back to the declaration of the method in the ``cpu.h`` header file.
+
+[start=8]
+. Click the ``Cpu::ComputeSupportMetric`` item and you jump back to the declaration of the method in the ``cpu.h`` header file.
=== Using the Includes Hierarchy
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ja.asciidoc
index 4718418..013163a 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ja.asciidoc
@@ -35,23 +35,6 @@
このチュートリアルでは、NetBeans IDEのC/C++プロジェクトのソース・ファイルを編集およびナビゲートするための機能の一部を学ぶことができます。
-=== 内容
-
-image::images/netbeans-stamp-80-74.png[title="このページの内容は、NetBeans IDE 7.4および8.0に適用されます"]
-
-|===
-|- |<<requirements,要件>>
-
-|- |<<project,サンプル・プロジェクトの作成>>
-
-|- |<<editing,C/C++ソース・ファイルの編集>>
-
-|- |<<navigating,C/C++ソース・ファイルのナビゲート>>
-
-|- |<<nextsteps,次の手順>>
-|===
-
-
== 要件
*このチュートリアルに従うには、次のソフトウェアとリソースが必要です。*
@@ -94,7 +77,9 @@
4. QuoteプロジェクトはC++を使用するため、「言語」ドロップダウン・リストから「C++」を選択します。
5. 設定するスタイルを「スタイル」ドロップダウン・リストから選択します。
image::images/formatting_style.png[]
-6. 必要に応じて、スタイルのプロパティを変更します。
+
+[start=6]
+. 必要に応じて、スタイルのプロパティを変更します。
=== C/C++ファイルのコード・ブロックの折りたたみ
@@ -120,8 +105,12 @@
7. ``Customer`` クラスの出現箇所をクリックします。
8. ファイル内にある ``Customer`` クラスのすべての出現箇所が、黄色の背景で強調表示されます。右マージンにも、ファイル内の出現箇所を示すマークが表示されます。このマークにより、ファイルをスクロールしなくても、出現箇所がどのくらいあるかを確認できます。マークをクリックすると、それが示す出現箇所へジャンプできます。
image::images/highlighting1.png[]
-9. 出現箇所の間を簡単に移動するには、[Alt]+[Down]を押すと次の出現箇所に移動し、[Alt]+[Up]を押すと前の出現箇所に移動します。
-10. ヘッダー・フォルダにある ``customer.h`` ファイルを開くと、ここでもクラス名が太字で強調表示されているのが確認できます。
+
+[start=9]
+. 出現箇所の間を簡単に移動するには、[Alt]+[Down]を押すと次の出現箇所に移動し、[Alt]+[Up]を押すと前の出現箇所に移動します。
+
+[start=10]
+. ヘッダー・フォルダにある ``customer.h`` ファイルを開くと、ここでもクラス名が太字で強調表示されているのが確認できます。
image::images/highlighting2.png[]
@@ -135,14 +124,24 @@
2. ``quote.cc`` の最初の空白行で、大文字のCを入力して[Ctrl]-[Space]を押します。コード補完ボックスに、 ``Cpu`` および ``Customer`` クラスを含む候補一覧が表示されます。ドキュメント・ウィンドウも開きますが、そのコードのドキュメントがプロジェクト・ソースに含まれていないため、ドキュメントが見つからないというメッセージが表示されます。
3. 再度[Ctrl]-[Space]を押して、項目の一覧を展開します。
image::images/code_completion1.png[]
-4. 矢印キーまたはマウスを使用してリストから ``calloc`` などの標準ライブラリ関数を強調表示すると、IDEがマニュアル・ページにアクセスできる場合は、ドキュメント・ウィンドウにその関数のマニュアル・ページが表示されます。
+
+[start=4]
+. 矢印キーまたはマウスを使用してリストから ``calloc`` などの標準ライブラリ関数を強調表示すると、IDEがマニュアル・ページにアクセスできる場合は、ドキュメント・ウィンドウにその関数のマニュアル・ページが表示されます。
image::images/code-completion-documentation.png[]
-5. ``Customer`` クラスを選択し、[Enter]キーを押します。
-6. 「 ``andrew;`` 」を入力して、 ``Customer`` クラスの新しいインスタンスを完了させます。次の行で、文字「 ``a`` 」を入力し、[Ctrl]-[Space]を2回押します。コード補完ボックスに、文字「 ``a`` 」から始まる、現在のコンテキストからアクセス可能なメソッド引数、クラス・フィールド、グローバル名などの選択肢が一覧表示されます。
+
+[start=5]
+. ``Customer`` クラスを選択し、[Enter]キーを押します。
+
+[start=6]
+. 「 ``andrew;`` 」を入力して、 ``Customer`` クラスの新しいインスタンスを完了させます。次の行で、文字「 ``a`` 」を入力し、[Ctrl]-[Space]を2回押します。コード補完ボックスに、文字「 ``a`` 」から始まる、現在のコンテキストからアクセス可能なメソッド引数、クラス・フィールド、グローバル名などの選択肢が一覧表示されます。
image::images/code_completion2.png[]
-7. ``andrew`` オプションをダブルクリックして受け入れ、その後にピリオド1つを入力します。[Ctrl]-[Space]を押すと、 ``Customer`` クラスのpublicメソッドおよびフィールドの一覧が自動的に表示されます。
+
+[start=7]
+. ``andrew`` オプションをダブルクリックして受け入れ、その後にピリオド1つを入力します。[Ctrl]-[Space]を押すと、 ``Customer`` クラスのpublicメソッドおよびフィールドの一覧が自動的に表示されます。
image::images/code_completion3.png[]
-8. 追加したコードを削除します。
+
+[start=8]
+. 追加したコードを削除します。
=== ソース・コード・ドキュメントの追加
@@ -151,15 +150,27 @@
1. ``quote.cc`` ファイルの75行目(次に示す行の上の行)にカーソルを置きます。
``int readNumberOf(const char* item, int min, int max){``
-2. スラッシュおよび2つのアスタリスクを入力して、[Enter]を押します。エディタによって、 ``readNumberOf`` クラスにDoxygen形式のコメントが挿入されます。
+
+[start=2]
+. スラッシュおよび2つのアスタリスクを入力して、[Enter]を押します。エディタによって、 ``readNumberOf`` クラスにDoxygen形式のコメントが挿入されます。
image::images/doxygen_comment.png[]
-3. それぞれの@paramの行に説明文を追加して、ファイルを保存します。
+
+[start=3]
+. それぞれの@paramの行に説明文を追加して、ファイルを保存します。
image::images/doxygen_comment_edited.png[]
-4. 黄色で強調表示されている ``readNumberOf`` クラスをクリックし、次に右にある出現箇所のマークの1つをクリックして、このクラスが使用されている場所へジャンプします。
-5. ジャンプした行で ``readNumberOf`` クラスをクリックして[Ctrl]-[Shift]-[Space]を押すと、追加したパラメータのドキュメントが表示されます。
+
+[start=4]
+. 黄色で強調表示されている ``readNumberOf`` クラスをクリックし、次に右にある出現箇所のマークの1つをクリックして、このクラスが使用されている場所へジャンプします。
+
+[start=5]
+. ジャンプした行で ``readNumberOf`` クラスをクリックして[Ctrl]-[Shift]-[Space]を押すと、追加したパラメータのドキュメントが表示されます。
image::images/doxygen_displayed.png[]
-6. ファイル内のどこかをクリックしてドキュメント・ウィンドウを閉じ、再度 ``readNumberOf`` クラスをクリックします。
-7. 「ソース」>「ドキュメントを表示」を選択して、クラスのドキュメント・ウィンドウを再度開きます。
+
+[start=6]
+. ファイル内のどこかをクリックしてドキュメント・ウィンドウを閉じ、再度 ``readNumberOf`` クラスをクリックします。
+
+[start=7]
+. 「ソース」>「ドキュメントを表示」を選択して、クラスのドキュメント・ウィンドウを再度開きます。
=== コード・テンプレートの使用方法
@@ -199,17 +210,27 @@
* 「編集」>「プロジェクト内を検索」を選択します。
* 「プロジェクト」ウィンドウでプロジェクトを右クリックし、「検索」を選択します。
* [Ctrl]+[Shift]+[F]を押します。
-2. 「プロジェクト内を検索」ダイアログ・ボックスで、「デフォルト検索」タブまたは「Grep」タブを選択します。「Grep」タブでは、特にリモート・プロジェクトに対して高速検索を提供する ``grep`` ユーティリティが使用されます。
+
+[start=2]
+. 「プロジェクト内を検索」ダイアログ・ボックスで、「デフォルト検索」タブまたは「Grep」タブを選択します。「Grep」タブでは、特にリモート・プロジェクトに対して高速検索を提供する ``grep`` ユーティリティが使用されます。
image::images/find_in_projects.png[]
-3. 「Grep」タブで、検索するテキストまたは正規表現を入力し、検索範囲およびファイル名パターンを指定して、複数の検索を別々のタブで保存できるように「新しいタブで開く」チェックボックスを選択します。
-4. 「検索」をクリックします。
+
+[start=3]
+. 「Grep」タブで、検索するテキストまたは正規表現を入力し、検索範囲およびファイル名パターンを指定して、複数の検索を別々のタブで保存できるように「新しいタブで開く」チェックボックスを選択します。
+
+[start=4]
+. 「検索」をクリックします。
「検索結果」タブには、該当のテキストまたは正規表現が検出されたファイルが一覧表示されます。
左マージンのボタンを使用すると、検索結果の表示を変更できます。
image::images/find_in_projects2.png[]
-5. ファイル名のみが表示されるようにファイルのリストを縮小する場合は、展開/縮小ボタンをクリックします。検索結果をディレクトリ・ツリーまたはファイルのリストとして表示するには、他のボタンをクリックします。これらのオプションは、複数のプロジェクトにわたる検索を実行するときに役立ちます。
-6. リスト内のアイテムの1つをダブルクリックすると、IDEではソース・エディタ内の該当する場所まで移動できます。
+
+[start=5]
+. ファイル名のみが表示されるようにファイルのリストを縮小する場合は、展開/縮小ボタンをクリックします。検索結果をディレクトリ・ツリーまたはファイルのリストとして表示するには、他のボタンをクリックします。これらのオプションは、複数のプロジェクトにわたる検索を実行するときに役立ちます。
+
+[start=6]
+. リスト内のアイテムの1つをダブルクリックすると、IDEではソース・エディタ内の該当する場所まで移動できます。
== C/C++ソース・ファイルのナビゲート
@@ -225,7 +246,9 @@
2. 「クラス」ウィンドウで「 ``Quote_1`` 」ノードを展開します。プロジェクト内のすべてのクラスが一覧表示されます。
3. ``Customer`` クラスを展開します。
image::images/classes_window.png[]
-4. ``name`` 変数をダブルクリックし、 ``customer.h`` ヘッダー・ファイルを開きます。
+
+[start=4]
+. ``name`` 変数をダブルクリックし、 ``customer.h`` ヘッダー・ファイルを開きます。
=== 「ナビゲータ」ウィンドウの使用
@@ -235,8 +258,12 @@
1. 「エディタ」ウィンドウで ``quote.cc`` ファイルの任意の場所をクリックします。
2. ファイルが縮小表示され、「ナビゲータ」ウィンドウに表示されます。
image::images/navigator_window.png[]
-3. ファイルの要素へ移動するには、「ナビゲータ」ウィンドウで要素をダブルクリックすると、「エディタ」ウィンドウでカーソルがその要素へ移動します。
-4. 「ナビゲータ」で右クリックすると、要素のソート、項目のグループ化やフィルタの方法を別の方法に変更できます。
+
+[start=3]
+. ファイルの要素へ移動するには、「ナビゲータ」ウィンドウで要素をダブルクリックすると、「エディタ」ウィンドウでカーソルがその要素へ移動します。
+
+[start=4]
+. 「ナビゲータ」で右クリックすると、要素のソート、項目のグループ化やフィルタの方法を別の方法に変更できます。
@@ -248,7 +275,9 @@
2. 「使用状況を検索」ダイアログ・ボックスで、「検索」をクリックします。
3. 「使用状況」ウィンドウが開き、プロジェクトのソース・ファイル内での ``Customer`` クラスの使用状況がすべて表示されます。
image::images/usages_window.png[]
-4. 左マージンの矢印ボタンをクリックして表示項目を移動し、エディタで表示するか、論理ビューおよび物理ビュー間を変更します。左マージンの2列目のボタンを使用して、情報をフィルタリングすることもできます。
+
+[start=4]
+. 左マージンの矢印ボタンをクリックして表示項目を移動し、エディタで表示するか、論理ビューおよび物理ビュー間を変更します。左マージンの2列目のボタンを使用して、情報をフィルタリングすることもできます。
=== コール・グラフの使用
@@ -261,10 +290,16 @@
ここに示すようにすべての関数が表示されない場合は、「コール・グラフ」ウィンドウの左側の3つ目のボタンをクリックして、「この関数のコール先」を表示します。
-3. ``endl`` ノードを展開し、その関数によってコールされる関数を表示します。グラフも更新され、 ``endl`` によってコールされる関数が表示されます。
-4. ウィンドウの左側の2つ目のボタン、「フォーカス」をクリックして ``endl`` 関数にフォーカスを置いてから、4つ目のボタンの「関数の呼出し元」をクリックして ``endl`` 関数をコールするすべての関数を表示します。
+
+[start=3]
+. ``endl`` ノードを展開し、その関数によってコールされる関数を表示します。グラフも更新され、 ``endl`` によってコールされる関数が表示されます。
+
+[start=4]
+. ウィンドウの左側の2つ目のボタン、「フォーカス」をクリックして ``endl`` 関数にフォーカスを置いてから、4つ目のボタンの「関数の呼出し元」をクリックして ``endl`` 関数をコールするすべての関数を表示します。
image::images/call_graph2.png[]
-5. ツリー内のノードの一部を展開すると、より多くの関数が表示されます。
+
+[start=5]
+. ツリー内のノードの一部を展開すると、より多くの関数が表示されます。
image::images/call_graph3.png[]
@@ -274,17 +309,31 @@
1. ``Quote_1`` プロジェクトの ``cpu.cc`` ファイルで、Ctrlキーを押しながら行37にマウス・ポインタを置きます。 ``ComputeSupportMetric`` 関数が強調表示され、関数についての情報が注釈に表示されます。
image::images/hyperlinks1.png[]
-2. ハイパーリンクをクリックすると、エディタがその関数の定義にジャンプします。
+
+[start=2]
+. ハイパーリンクをクリックすると、エディタがその関数の定義にジャンプします。
image::images/hyperlinks2.png[]
-3. Ctrlキーを押しながら定義にマウスを置き、ハイパーリンクをクリックします。エディタが、 ``cpu.h`` ヘッダー・ファイル内のその関数の宣言にジャンプします。
+
+[start=3]
+. Ctrlキーを押しながら定義にマウスを置き、ハイパーリンクをクリックします。エディタが、 ``cpu.h`` ヘッダー・ファイル内のその関数の宣言にジャンプします。
image::images/hyperlinks3.png[]
-4. エディタ・ツールバーの左向き矢印(左から2番目のボタン)をクリックすると、エディタは ``cpu.cc`` 内の定義へジャンプして戻ります。
-5. 左マージンにある緑色の円の上にマウスを置くと、このメソッドが別のメソッドをオーバーライドすることを示す注釈が表示されます。
+
+[start=4]
+. エディタ・ツールバーの左向き矢印(左から2番目のボタン)をクリックすると、エディタは ``cpu.cc`` 内の定義へジャンプして戻ります。
+
+[start=5]
+. 左マージンにある緑色の円の上にマウスを置くと、このメソッドが別のメソッドをオーバーライドすることを示す注釈が表示されます。
image::images/overide_annotation.png[]
-6. オーバーライドされているメソッドに移動するには、緑色の円をクリックします。 ``module.h`` ヘッダー・ファイルにジャンプし、メソッドがオーバーライドされていることを示す灰色の円がマージンに表示されます。
-7. 灰色の円をクリックすると、エディタはこのメソッドをオーバーライドするメソッドの一覧を表示します。
+
+[start=6]
+. オーバーライドされているメソッドに移動するには、緑色の円をクリックします。 ``module.h`` ヘッダー・ファイルにジャンプし、メソッドがオーバーライドされていることを示す灰色の円がマージンに表示されます。
+
+[start=7]
+. 灰色の円をクリックすると、エディタはこのメソッドをオーバーライドするメソッドの一覧を表示します。
image::images/overridden_by_list.png[]
-8. ``Cpu::ComputeSupportMetric`` の項目をクリックすると、 ``cpu.h`` ヘッダー・ファイル内のメソッドの宣言へジャンプして戻ります。
+
+[start=8]
+. ``Cpu::ComputeSupportMetric`` の項目をクリックすると、 ``cpu.h`` ヘッダー・ファイル内のメソッドの宣言へジャンプして戻ります。
=== インクルードの階層の使用
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_pt_BR.asciidoc
index 24fbc3d..52cb35c 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_pt_BR.asciidoc
@@ -36,21 +36,6 @@
-image::images/netbeans-stamp-80-74.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.4 e 8.0"]
-
-|===
-|- |<<requirements,Requisitos>>
-
-|- |<<project,Criando o Projeto de Amostra>>
-
-|- |<<editing,Editando Arquivos de Código-fonte C e C++>>
-
-|- |<<navigating,Navegando em Arquivos de Código-fonte C e C++>>
-
-|- |<<nextsteps,Próximas Etapas>>
-|===
-
-
== Requisitos
*Para seguir este tutorial, são necessários os recursos e o software a seguir.*
@@ -94,7 +79,9 @@
4. Selecione a linguagem C++ da lista drop-down Linguagem, pois o projeto Quote utiliza C++.
5. Selecione o estilo que deseja definir na lista drop-down Estilo.
image::images/formatting_style.png[]
-6. Modifique as propriedades de estilo, conforme desejado.
+
+[start=6]
+. Modifique as propriedades de estilo, conforme desejado.
=== Dobrando Blocos de Código em Arquivos C e C++
@@ -120,8 +107,12 @@
7. Clique em uma ocorrência da classe ``Cliente`` .
8. Toas as ocorrências da classe ``Cliente`` no arquivo estão realçadas com um fundo amarelo. A margem da direita também mostra marcações que indicam pontos onde uma ocorrência está localizada no arquivo. As marcações permitem a visualização de quantas ocorrências existem sem rolar o arquivo. É possível clicar nas marcações para saltar às ocorrências que elas representam.
image::images/highlighting1.png[]
-9. Para navegar facilmente entre as ocorrências, pressione as teclas Alt+Seta para baixo para ir para a próxima ocorrência e Alt+Seta para cima para ir para a ocorrência anterior.
-10. Abra o arquivo ``customer.h`` , localizado na pasta Cabeçalho e observe que nomes de método estão novamente realçados em negrito.
+
+[start=9]
+. Para navegar facilmente entre as ocorrências, pressione as teclas Alt+Seta para baixo para ir para a próxima ocorrência e Alt+Seta para cima para ir para a ocorrência anterior.
+
+[start=10]
+. Abra o arquivo ``customer.h`` , localizado na pasta Cabeçalho e observe que nomes de método estão novamente realçados em negrito.
image::images/highlighting2.png[]
@@ -135,14 +126,24 @@
2. Na primeira linha em branco do ``quote.cc`` , digite a letra C em maiúsculo e pressione Ctrl-Espaço. A caixa de autocompletar código exibe uma pequena lista que inclui as classes ``Cpu`` e ``Cliente`` . Uma janela de documentação também aparece, mas exibe "Nenhuma documentação encontrada" porque a fonte do projeto não inclui documentação para esse código.
3. Expanda a lista de itens pressionando Ctrl-Espaço novamente.
image::images/code_completion1.png[]
-4. Utilize as teclas de seta ou o mouse para realçar uma função de biblioteca padrão como ``calloc`` e a janela da documentação exibe a página do manual para essa função se a página do manual está acessível para o IDE.
+
+[start=4]
+. Utilize as teclas de seta ou o mouse para realçar uma função de biblioteca padrão como ``calloc`` e a janela da documentação exibe a página do manual para essa função se a página do manual está acessível para o IDE.
image::images/code-completion-documentation.png[]
-5. Selecione a classe ``Cliente`` e pressione Enter.
-6. Complete a nova instância da classe ``Cliente`` digitando " ``andrew;`` ". Na próxima linha, digite a letra ``a`` e pressione Ctrl-Espaço. A caixa de autocompletar código exibe uma lista de opções começando com a letra ``a`` , tais como argumentos de método, campos de classe e nomes globais, que podem ser acessados no menu de contexto.
+
+[start=5]
+. Selecione a classe ``Cliente`` e pressione Enter.
+
+[start=6]
+. Complete a nova instância da classe ``Cliente`` digitando " ``andrew;`` ". Na próxima linha, digite a letra ``a`` e pressione Ctrl-Espaço. A caixa de autocompletar código exibe uma lista de opções começando com a letra ``a`` , tais como argumentos de método, campos de classe e nomes globais, que podem ser acessados no menu de contexto.
image::images/code_completion2.png[]
-7. Clique duas vezes na opção ``andrew`` para aceitá-la e digite um ponto depois dela. Pressione Ctrl + Espaço e você receberá automaticamente uma lista dos métodos e campos públicos da classe ``Cliente`` .
+
+[start=7]
+. Clique duas vezes na opção ``andrew`` para aceitá-la e digite um ponto depois dela. Pressione Ctrl + Espaço e você receberá automaticamente uma lista dos métodos e campos públicos da classe ``Cliente`` .
image::images/code_completion3.png[]
-8. Delete o código que você adicionou.
+
+[start=8]
+. Delete o código que você adicionou.
=== Adicionando Documentação de Códigos-fonte
@@ -151,15 +152,27 @@
1. No arquivo ``quote.cc`` , coloque o cursor na linha 75 ou na linha abaixo da linha
``int readNumberOf(const char* item, int mín, int máx) {``
-2. Digite uma barra e dois asteriscos e pressione Enter. O editor insere um comentário doxygen-formatado para a classe ``readnumberof`` .
+
+[start=2]
+. Digite uma barra e dois asteriscos e pressione Enter. O editor insere um comentário doxygen-formatado para a classe ``readnumberof`` .
image::images/doxygen_comment.png[]
-3. Adicione algum texto descritivo para cada uma das linhas @param e salve o arquivo.
+
+[start=3]
+. Adicione algum texto descritivo para cada uma das linhas @param e salve o arquivo.
image::images/doxygen_comment_edited.png[]
-4. Enquanto a classe ``readNumberOf`` ainda está realçada em amarelo, clique em um dos marcadores de ocorrência na direita para saltar para o local onde a classe é utilizada.
-5. Clique na classe ``readNumberOf`` na linha para qual você saltou e pressione Ctrl-Shift-Espaço para mostrar a documentação recentemente adicionada aos parâmetros.
+
+[start=4]
+. Enquanto a classe ``readNumberOf`` ainda está realçada em amarelo, clique em um dos marcadores de ocorrência na direita para saltar para o local onde a classe é utilizada.
+
+[start=5]
+. Clique na classe ``readNumberOf`` na linha para qual você saltou e pressione Ctrl-Shift-Espaço para mostrar a documentação recentemente adicionada aos parâmetros.
image::images/doxygen_displayed.png[]
-6. Clique em qualquer lugar no arquivo para finalizar a janela de documentação, e clique na classe ``readNumberOf`` .
-7. Escolha Código-fonte > Mostrar Documentação para abrir novamente a janela de documentação da classe.
+
+[start=6]
+. Clique em qualquer lugar no arquivo para finalizar a janela de documentação, e clique na classe ``readNumberOf`` .
+
+[start=7]
+. Escolha Código-fonte > Mostrar Documentação para abrir novamente a janela de documentação da classe.
=== Usando Modelos de Código
@@ -199,17 +212,27 @@
* Escolha Editar >Localizar nos Projetos.
* Clique com o botão direito do mouse no projeto na janela Projetos e escolha Localizar.
* Pressione Ctrl+Shift+F.
-2. Na caixa de diálogo Localizar nos Projetos, selecione a guia de Pesquisa Default ou a guia Grep. A guia Grep usa o utilitário ``grep`` , que fornece uma pesquisa mais rápida, principalmente para projetos remoto.
+
+[start=2]
+. Na caixa de diálogo Localizar nos Projetos, selecione a guia de Pesquisa Default ou a guia Grep. A guia Grep usa o utilitário ``grep`` , que fornece uma pesquisa mais rápida, principalmente para projetos remoto.
image::images/find_in_projects.png[]
-3. Na guia Grep, digite o texto ou expressão regular que você deseja pesquisar, especifique o escopo da pesquisa e o padrão de nome do arquivo e marque a caixa de seleção Abrir em Nova Guia, de forma que você possa salvar várias pesquisas em guias separadas.
-4. Clique em Localizar.
+
+[start=3]
+. Na guia Grep, digite o texto ou expressão regular que você deseja pesquisar, especifique o escopo da pesquisa e o padrão de nome do arquivo e marque a caixa de seleção Abrir em Nova Guia, de forma que você possa salvar várias pesquisas em guias separadas.
+
+[start=4]
+. Clique em Localizar.
A guia Resultados da Pesquisa lista os arquivos em que o texto ou expressão regular é encontrado.
Os botões da margem esquerda permitem que você altere sua view dos resultados da pesquisa.
image::images/find_in_projects2.png[]
-5. Clique no botão Expandir/Contrair para contrair a lista de arquivos, de forma que só os nomes de arquivo sejam mostrados. Clique nos outros botões para mostrar os resultados da pesquisa, como uma árvore de diretório ou uma lista de arquivos. Estas opções são úteis quando você executa uma pesquisa em vários projetos.
-6. Clique duas vezes em um dos itens da lista e o IDE o conduzirá para o local correspondente no editor de código-fonte.
+
+[start=5]
+. Clique no botão Expandir/Contrair para contrair a lista de arquivos, de forma que só os nomes de arquivo sejam mostrados. Clique nos outros botões para mostrar os resultados da pesquisa, como uma árvore de diretório ou uma lista de arquivos. Estas opções são úteis quando você executa uma pesquisa em vários projetos.
+
+[start=6]
+. Clique duas vezes em um dos itens da lista e o IDE o conduzirá para o local correspondente no editor de código-fonte.
== Navegando em Arquivos de Código-fonte C e C++
@@ -225,7 +248,9 @@
2. Expanda o nó ``Quote_1`` na janela Classes. São listadas todas as classes do projeto.
3. Expanda a classe ``Cliente`` .
image::images/classes_window.png[]
-4. Clique duas vezes na variável ``name`` para abrir o arquivo de cabeçalho ``customer.h`` .
+
+[start=4]
+. Clique duas vezes na variável ``name`` para abrir o arquivo de cabeçalho ``customer.h`` .
=== Usando a Janela Navegador
@@ -235,8 +260,12 @@
1. Clique em qualquer parte do arquivo ``quote.cc`` na janela Editor.
2. Uma view compacta do arquivo é exibida na janela Navegador.
image::images/navigator_window.png[]
-3. Para navegar para um elemento do arquivo, clique duas vezes no elemento na janela Navegador e o cursor na janela Editor se move para esse elemento.
-4. Clique com o botão direito no Navegador para escolher uma maneira diferente para classificar os elementos, agrupar os itens ou filtrá-los.
+
+[start=3]
+. Para navegar para um elemento do arquivo, clique duas vezes no elemento na janela Navegador e o cursor na janela Editor se move para esse elemento.
+
+[start=4]
+. Clique com o botão direito no Navegador para escolher uma maneira diferente para classificar os elementos, agrupar os itens ou filtrá-los.
Para descobrir o que os ícones no Navegador representam, abra a ajuda on-line do IDE escolhendo Ajuda > Conteúdo de Ajuda e busque por "ícones de navegação" na janela de ajuda.
@@ -249,7 +278,9 @@
2. Na caixa de diálogo Localizar Usos, clique em Localizar.
3. A janela Usos se abre e exibe todos os usos da classe ``Cliente`` nos arquivos de código-fonte do projeto.
image::images/usages_window.png[]
-4. Clique nos botões de seta na margem esquerda para percorrer as ocorrências e mostrá-las no Editor, ou altere entre view lógica e física. Você também pode filtrar as informações usando uma segunda coluna dos botões na margem esquerda.
+
+[start=4]
+. Clique nos botões de seta na margem esquerda para percorrer as ocorrências e mostrá-las no Editor, ou altere entre view lógica e física. Você também pode filtrar as informações usando uma segunda coluna dos botões na margem esquerda.
=== Usando o Gráfico de Chamada
@@ -262,10 +293,16 @@
Se não for possível visualizar todas as funções mostradas aqui, clique no terceiro botão no lado esquerdo da janela Gráfico de Chamada para mostrar "quem é chamado para essa função."
-3. Expanda o nó ``endl`` para exibir as funções chamadas por tal função. Observe que o gráfico é atualizado para mostrar as funções chamadas por ``endl`` também.
-4. Clique no segundo botão, chamado Trazer para o Foco no lado esquerdo da janela para focar na função ``endl`` e, em seguida, clique no quarto botão Quem Chama esta Função para exibir todas as funções que chamam a função ``endl`` .
+
+[start=3]
+. Expanda o nó ``endl`` para exibir as funções chamadas por tal função. Observe que o gráfico é atualizado para mostrar as funções chamadas por ``endl`` também.
+
+[start=4]
+. Clique no segundo botão, chamado Trazer para o Foco no lado esquerdo da janela para focar na função ``endl`` e, em seguida, clique no quarto botão Quem Chama esta Função para exibir todas as funções que chamam a função ``endl`` .
image::images/call_graph2.png[]
-5. Expanda alguns nós da árvore para ver mais funções.
+
+[start=5]
+. Expanda alguns nós da árvore para ver mais funções.
image::images/call_graph3.png[]
@@ -275,17 +312,31 @@
1. No arquivo ``cpu.cc`` do projeto ``Quote_1`` , mova o mouse sobre a linha 37 enquanto o Ctrl estiver pressionado. A função ``ComputeSupportMetric`` está realçada e uma anotação exibe informações sobre a função.
image::images/hyperlinks1.png[]
-2. Clique no hiperlink e o editor saltará para a definição da função.
+
+[start=2]
+. Clique no hiperlink e o editor saltará para a definição da função.
image::images/hyperlinks2.png[]
-3. Mova o mouse sobre a definição quanto o Ctrl estiver pressionado e clique no hiperlink. O editor salta para a declaração da função no arquivo de cabeçalho ``cpu.h`` .
+
+[start=3]
+. Mova o mouse sobre a definição quanto o Ctrl estiver pressionado e clique no hiperlink. O editor salta para a declaração da função no arquivo de cabeçalho ``cpu.h`` .
image::images/hyperlinks3.png[]
-4. Clique na seta da esquerda na barra de ferramentas do editor (segundo botão da esquerda) e o editor salta de volta para a definição no ``cpu.cc`` .
-5. Passe o cursor do mouse sobre o círculo verde na margem esquerda e veja a anotação que indica que este método substitui qualquer outro método.
+
+[start=4]
+. Clique na seta da esquerda na barra de ferramentas do editor (segundo botão da esquerda) e o editor salta de volta para a definição no ``cpu.cc`` .
+
+[start=5]
+. Passe o cursor do mouse sobre o círculo verde na margem esquerda e veja a anotação que indica que este método substitui qualquer outro método.
image::images/overide_annotation.png[]
-6. Ao clicar no círculo verde para ir para o método substituído, você salta para o arquivo de cabeçalho ``module.h`` , que mostra um círculo cinza na margem para indicar que o método está substituído.
-7. Um clique no círculo cinza e o editor exibe uma lista de métodos que substituíram esse método.
+
+[start=6]
+. Ao clicar no círculo verde para ir para o método substituído, você salta para o arquivo de cabeçalho ``module.h`` , que mostra um círculo cinza na margem para indicar que o método está substituído.
+
+[start=7]
+. Um clique no círculo cinza e o editor exibe uma lista de métodos que substituíram esse método.
image::images/overridden_by_list.png[]
-8. Ao clicar no item ``Cpu::ComputeSupportMetric`` , você salta de volta para a declaração do método no arquivo de cabeçalho ``cpu.h`` .
+
+[start=8]
+. Ao clicar no item ``Cpu::ComputeSupportMetric`` , você salta de volta para a declaração do método no arquivo de cabeçalho ``cpu.h`` .
=== Utilizando a Hierarquia de Inclusão
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ru.asciidoc
index 8c9f71b..556032a 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_ru.asciidoc
@@ -35,22 +35,6 @@
В этом кратком практическом руководстве описываются некоторые возможности навигации по исходным файлам и редактирования этих файлов в проекте C или C++ в среде IDE NetBeans.
-
-image::images/netbeans-stamp-80-74.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.4 и 8.0"]
-
-|===
-|- |<<requirements,Требования>>
-
-|- |Создание примера проекта
-
-|- |<<editing,Изменение исходных файлов на языке C и C++>>
-
-|- |<<navigating,Переход по исходным файлам на C и C++>>
-
-|- |<<nextsteps,Следующие действия>>
-|===
-
-
== Требования
*Для работы с этим учебным курсом требуется следующее программное обеспечение и ресурсы.*
@@ -94,7 +78,9 @@
4. Выберите в раскрывающемся списке "Язык" язык C++, поскольку в проекте Quote используется язык C++.
5. Выберите в раскрывающемся списке "Стиль" необходимый стиль.
image::images/formatting_style.png[]
-6. Измените свойства стиля требуемым образом.
+
+[start=6]
+. Измените свойства стиля требуемым образом.
=== Свертывание блоков кода в файлах C и C++
@@ -120,8 +106,12 @@
7. Щелкните вхождение класса ``Customer`` .
8. Все вхождения класса ``Customer`` в файле будут выделены желтым цветом. В правом поле также отображаются отметки, указывающие расположение вхождений в файле. Отметки позволяют оценить число вхождений в файле без прокручивания. Чтобы перейти ко вхождению, следует щелкнуть необходимую отметку.
image::images/highlighting1.png[]
-9. Для легкого перехода между вхождениями нажимайте клавиши Alt+Down, чтобы перейти к следующему вхождению, и Alt+Up, чтобы перейти к предыдущему вхождению.
-10. Откройте файл ``customer.h`` , расположенный в папке "Headers", и обратите внимание, что имена методов снова выделены жирным.
+
+[start=9]
+. Для легкого перехода между вхождениями нажимайте клавиши Alt+Down, чтобы перейти к следующему вхождению, и Alt+Up, чтобы перейти к предыдущему вхождению.
+
+[start=10]
+. Откройте файл ``customer.h`` , расположенный в папке "Headers", и обратите внимание, что имена методов снова выделены жирным.
image::images/highlighting2.png[]
@@ -135,14 +125,24 @@
2. Введите в первой пустой строчке файла ``quote.cc`` заглавную латинскую букву "C" и нажмите сочетание клавиш CTRL+ПРОБЕЛ. Появится окно автозавершения кода с небольшим списком, включающем классы ``Cpu`` и ``Customer`` . Также отобразится окно документации с сообщением "Документация не найдена", поскольку исходный код проекта не содержит документации по коду.
3. Разверните список элементов, снова нажав CTRL+ПРОБЕЛ.
image::images/code_completion1.png[]
-4. Используйте клавиши со стрелками или кнопки мыши для выделения стандартной функции библиотеки (например, ``calloc`` ) из списка. В окне документации появится страница системной справки для этой функции, если эта страница доступна для среды IDE.
+
+[start=4]
+. Используйте клавиши со стрелками или кнопки мыши для выделения стандартной функции библиотеки (например, ``calloc`` ) из списка. В окне документации появится страница системной справки для этой функции, если эта страница доступна для среды IDE.
image::images/code-completion-documentation.png[]
-5. Выберите класс ``Customer`` и нажмите ENTER.
-6. Заполните новый экземпляр класса ``Customer`` , введя текст ``andrew;`` . Введите в следующей строке латинскую букву ``a`` и нажмите CTRL+ПРОБЕЛ. Появится окно автозавершения кода со списком возможных элементов с начальной буквой ``a`` , например аргументы метода, поля класса и глобальные имена, доступные в текущем контексте.
+
+[start=5]
+. Выберите класс ``Customer`` и нажмите ENTER.
+
+[start=6]
+. Заполните новый экземпляр класса ``Customer`` , введя текст ``andrew;`` . Введите в следующей строке латинскую букву ``a`` и нажмите CTRL+ПРОБЕЛ. Появится окно автозавершения кода со списком возможных элементов с начальной буквой ``a`` , например аргументы метода, поля класса и глобальные имена, доступные в текущем контексте.
image::images/code_completion2.png[]
-7. Дважды щелкните параметр ``andrew`` , чтобы принять его и ввести после него точку. Нажмите Ctrl-пробел, и будет выведен список общедоступных методов и полей класса ``Customer`` .
+
+[start=7]
+. Дважды щелкните параметр ``andrew`` , чтобы принять его и ввести после него точку. Нажмите Ctrl-пробел, и будет выведен список общедоступных методов и полей класса ``Customer`` .
image::images/code_completion3.png[]
-8. Удалите добавленный код.
+
+[start=8]
+. Удалите добавленный код.
=== Добавление документации к исходному коду
@@ -151,15 +151,27 @@
1. Наведите курсор в файле ``quote.cc`` на строку 75 или на строку, расположенную выше.
``int readNumberOf(const char* item, int min, int max) {``
-2. Введите косую черту и две звездочки, а затем нажмите ENTER. Редактор вставляет комментарий, отформатированный по синтаксису Doxygen, для класса ``readNumberOf`` .
+
+[start=2]
+. Введите косую черту и две звездочки, а затем нажмите ENTER. Редактор вставляет комментарий, отформатированный по синтаксису Doxygen, для класса ``readNumberOf`` .
image::images/doxygen_comment.png[]
-3. Добавьте текст описания в каждую строку аннотации @param и сохраните файл.
+
+[start=3]
+. Добавьте текст описания в каждую строку аннотации @param и сохраните файл.
image::images/doxygen_comment_edited.png[]
-4. Щелкните класс ``readNumberOf`` для выделения его желтым и щелкните одну из отметок вхождений справа для перехода к области использования класса.
-5. Щелкните класс ``readNumberOf`` в строке, к которой выполнен переход, и нажмите сочетание клавиш CTRL+SHIFT+ПРОБЕЛ для отображения документации, добавленной для параметров.
+
+[start=4]
+. Щелкните класс ``readNumberOf`` для выделения его желтым и щелкните одну из отметок вхождений справа для перехода к области использования класса.
+
+[start=5]
+. Щелкните класс ``readNumberOf`` в строке, к которой выполнен переход, и нажмите сочетание клавиш CTRL+SHIFT+ПРОБЕЛ для отображения документации, добавленной для параметров.
image::images/doxygen_displayed.png[]
-6. Щелкните в любом месте файла, чтобы закрыть окно документации, а затем щелкните класс ``readNumberOf`` повторно.
-7. Выберите "Исходный код" > "Показать документацию", чтобы снова открыть окно документации для класса.
+
+[start=6]
+. Щелкните в любом месте файла, чтобы закрыть окно документации, а затем щелкните класс ``readNumberOf`` повторно.
+
+[start=7]
+. Выберите "Исходный код" > "Показать документацию", чтобы снова открыть окно документации для класса.
=== Использование шаблонов кода
@@ -199,17 +211,27 @@
* Выберите 'Правка' > 'Найти в проектах'
* Щелкните правой кнопкой мыши проект в окне "Проекты" и выберите команду "Найти".
* Нажмите Ctrl+Shift+F.
-2. В диалоговом окне "Найти в проектах" перейдите на вкладку "Список по умолчанию" или на вкладку "Grep". На вкладке 'Grep' используется служебная программа ``grep`` , обеспечивающая более быстрый поиск, особенно для удаленных проектов.
+
+[start=2]
+. В диалоговом окне "Найти в проектах" перейдите на вкладку "Список по умолчанию" или на вкладку "Grep". На вкладке 'Grep' используется служебная программа ``grep`` , обеспечивающая более быстрый поиск, особенно для удаленных проектов.
image::images/find_in_projects.png[]
-3. На вкладке Grep введите искомый текст или регулярное выражение, укажите область поиска и шаблон имени файла и установите флажок 'Открыть в новой вкладке'. Это позволит сохранить несколько результатов поиска на отдельных вкладках.
-4. Нажмите 'Найти'.
+
+[start=3]
+. На вкладке Grep введите искомый текст или регулярное выражение, укажите область поиска и шаблон имени файла и установите флажок 'Открыть в новой вкладке'. Это позволит сохранить несколько результатов поиска на отдельных вкладках.
+
+[start=4]
+. Нажмите 'Найти'.
На вкладке 'Результаты поиска' перечислены файлы, в которых найдены текст или регулярные выражения.
С помощью кнопок в левой части окна можно изменить представление результатов поиска.
image::images/find_in_projects2.png[]
-5. Нажмите кнопку 'Развернуть/Свернуть', чтобы свернуть список файлов. При этом будут отображаться только имена файлов. Другие кнопки предназначены для отображения результатов поиска в виде дерева каталогов или в виде списка файлов. Эти функции удобно использовать при поиске по нескольким проектам.
-6. Дважды щелкните один из элементов в списке. Среда IDE перемещает вас на соответствующую позицию в редакторе исходного кода.
+
+[start=5]
+. Нажмите кнопку 'Развернуть/Свернуть', чтобы свернуть список файлов. При этом будут отображаться только имена файлов. Другие кнопки предназначены для отображения результатов поиска в виде дерева каталогов или в виде списка файлов. Эти функции удобно использовать при поиске по нескольким проектам.
+
+[start=6]
+. Дважды щелкните один из элементов в списке. Среда IDE перемещает вас на соответствующую позицию в редакторе исходного кода.
== Переход по исходным файлам на C и C++
@@ -225,7 +247,9 @@
2. Разверните узел ``Quote_1`` в окне классов. Выводится список всех классов проекта.
3. Разверните класс ``Customer`` .
image::images/classes_window.png[]
-4. Дважды щелкните переменную ``name`` , чтобы открыть файл заголовка ``customer.h`` .
+
+[start=4]
+. Дважды щелкните переменную ``name`` , чтобы открыть файл заголовка ``customer.h`` .
=== Использование окна навигатора
@@ -235,8 +259,12 @@
1. Щелкните в любом месте окна редактора файла ``quote.cc`` .
2. В окне навигатора отобразится компактное представление файла.
image::images/navigator_window.png[]
-3. Для перехода к определенному элементу файла дважды щелкните его в окне навигатора, а курсор в окне редактора переместится к этому элементу.
-4. Щелкните правой кнопкой мыши в окне навигатора, чтобы выбрать другой способ сортировки элементов, группировку элементов или их фильтрацию.
+
+[start=3]
+. Для перехода к определенному элементу файла дважды щелкните его в окне навигатора, а курсор в окне редактора переместится к этому элементу.
+
+[start=4]
+. Щелкните правой кнопкой мыши в окне навигатора, чтобы выбрать другой способ сортировки элементов, группировку элементов или их фильтрацию.
Для получения сведений о назначении значков в окне навигатора воспользуйтесь интерактивной справкой по среде IDE. Для этого выберите команду "Справка" > "Содержание справки" и введите в поле поиска окна справки "значки навигатора".
@@ -249,7 +277,9 @@
2. Нажмите в диалоговом окне "Найти случаи использования" кнопку "Найти".
3. Появится окно "Случаи использования" со случаями использования класса ``Customer`` в исходных файлах проекта.
image::images/usages_window.png[]
-4. Кнопки со стрелками в левой части окна предназначены для перехода между вхождениями и их отображения в редакторе, а также для переключения представления с логического на физическое и наоборот. Также можно фильтровать данные с помощью второго вертикального ряда кнопок в левой части окна.
+
+[start=4]
+. Кнопки со стрелками в левой части окна предназначены для перехода между вхождениями и их отображения в редакторе, а также для переключения представления с логического на физическое и наоборот. Также можно фильтровать данные с помощью второго вертикального ряда кнопок в левой части окна.
=== Работа с графиком вызовов
@@ -262,10 +292,16 @@
Если отображаются не все функции, приведенные на рисунке выше, нажмите в окне "Граф вызовов" третью кнопку слева для вывода элементов, вызванных из данной функции.
-3. Разверните узел ``endl`` для отображения функций, вызванных этой функцией. Обратите внимание, что график обновляется для дополнительного вывода функций, вызванных функцией ``endl`` .
-4. Нажмите вторую кнопку 'Фокусировать' в левой части окна для перемещения фокуса к функции ``endl`` , затем нажмите четвертую кнопку 'Кто вызывает эту функцию', чтобы просмотреть все функции, вызывающие функцию ``endl`` .
+
+[start=3]
+. Разверните узел ``endl`` для отображения функций, вызванных этой функцией. Обратите внимание, что график обновляется для дополнительного вывода функций, вызванных функцией ``endl`` .
+
+[start=4]
+. Нажмите вторую кнопку 'Фокусировать' в левой части окна для перемещения фокуса к функции ``endl`` , затем нажмите четвертую кнопку 'Кто вызывает эту функцию', чтобы просмотреть все функции, вызывающие функцию ``endl`` .
image::images/call_graph2.png[]
-5. Разверните несколько узлов дерева для просмотра большего числа функций.
+
+[start=5]
+. Разверните несколько узлов дерева для просмотра большего числа функций.
image::images/call_graph3.png[]
@@ -275,17 +311,31 @@
1. В файле ``cpu.cc`` проекта ``Quote_1`` наведите курсор мыши на строку 37, нажав клавишу CTRL. Функция ``ComputeSupportMetric`` будет выделена, а в аннотации будут выведены сведения о данной функции.
image::images/hyperlinks1.png[]
-2. Щелкните гиперссылку, и в окне редактора будет выполнен переход к определению функции.
+
+[start=2]
+. Щелкните гиперссылку, и в окне редактора будет выполнен переход к определению функции.
image::images/hyperlinks2.png[]
-3. Наведите курсор на определение, нажав клавишу CTRL, и щелкните ссылку. В редакторе будет выполнен переход к объявлению функции в файле заголовка ``cpu.h`` .
+
+[start=3]
+. Наведите курсор на определение, нажав клавишу CTRL, и щелкните ссылку. В редакторе будет выполнен переход к объявлению функции в файле заголовка ``cpu.h`` .
image::images/hyperlinks3.png[]
-4. Нажмите на панели редактора стрелку влево (вторая кнопка слева), и редактор снова перейдет к определению в файле ``cpu.cc`` .
-5. Наведите курсор мыши на зеленый круг в левом поле и просмотрите аннотацию, указывающую, что данный метод переопределяет другой метод.
+
+[start=4]
+. Нажмите на панели редактора стрелку влево (вторая кнопка слева), и редактор снова перейдет к определению в файле ``cpu.cc`` .
+
+[start=5]
+. Наведите курсор мыши на зеленый круг в левом поле и просмотрите аннотацию, указывающую, что данный метод переопределяет другой метод.
image::images/overide_annotation.png[]
-6. Щелкните зеленый круг для перехода к переопределенному методу: будет выполнен переход к файлу заголовка ``module.h`` . В это файле на полях отображается серый круг, указывающий на то, что метод переопределен.
-7. Щелкните серый круг, и в окне редактора появится список методов, переопределяющих этот метод.
+
+[start=6]
+. Щелкните зеленый круг для перехода к переопределенному методу: будет выполнен переход к файлу заголовка ``module.h`` . В это файле на полях отображается серый круг, указывающий на то, что метод переопределен.
+
+[start=7]
+. Щелкните серый круг, и в окне редактора появится список методов, переопределяющих этот метод.
image::images/overridden_by_list.png[]
-8. Щелкните элемент ``Cpu::ComputeSupportMetric`` для обратного перехода к объявлению метода в файле заголовка ``cpu.h`` .
+
+[start=8]
+. Щелкните элемент ``Cpu::ComputeSupportMetric`` для обратного перехода к объявлению метода в файле заголовка ``cpu.h`` .
=== Работа с иерархией Includes
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_zh_CN.asciidoc
index 53800f6..518a9d2 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/navigating-editing_zh_CN.asciidoc
@@ -35,22 +35,6 @@
下面的简明教程介绍了 NetBeans IDE 中用于导航和编辑 C 或 C++ 项目源文件的一些功能。
-
-image::images/netbeans-stamp-80-74.png[title="此页上的内容适用于 NetBeans IDE 7.4 和 8.0"]
-
-|===
-|- |<<requirements,要求>>
-
-|- |<<project,创建样例项目>>
-
-|- |<<editing,编辑 C 和 C++ 源文件>>
-
-|- |<<navigating,导航 C 和 C++ 源文件>>
-
-|- |<<nextsteps,后续步骤>>
-|===
-
-
== 要求
*要学习本教程,您需要具备以下软件和资源。*
@@ -94,7 +78,9 @@
4. 从 "Language"(语言)下拉列表中选择 "C++" 语言,因为 "Quote"(报价)项目使用 C++。
5. 从 "Style"(样式)下拉列表中选择要设置的样式。
image::images/formatting_style.png[]
-6. 按您的想法修改样式属性。
+
+[start=6]
+. 按您的想法修改样式属性。
=== 折叠 C 和 C++ 文件中的代码块
@@ -120,8 +106,12 @@
7. 单击某个出现的 ``Customer`` 类。
8. 文件中出现的所有 ``Customer`` 类都将以黄色背景突出显示。右旁注还会显示一些标记,以指示文件中出现该类的位置。通过这些标记,您无需滚动查看整个文件,便可了解文件中存在多少该类。单击标记,可以跳转至它们所指示的实例位置。
image::images/highlighting1.png[]
-9. 要在实例之间轻松地进行导航,请按 Alt+向下方向键转至下一个实例,或者按 Alt+向上方向键转至上一个实例。
-10. 打开位于 "Headers"(头)文件夹中的 ``customer.h`` 文件,您会看到类名同样以粗体突出显示。
+
+[start=9]
+. 要在实例之间轻松地进行导航,请按 Alt+向下方向键转至下一个实例,或者按 Alt+向上方向键转至上一个实例。
+
+[start=10]
+. 打开位于 "Headers"(头)文件夹中的 ``customer.h`` 文件,您会看到类名同样以粗体突出显示。
image::images/highlighting2.png[]
@@ -135,14 +125,24 @@
2. 在 ``quote.cc`` 的第一个空行上,键入大写字母 C,然后按 Ctrl-空格组合键。代码完成框会显示一个简短列表,其中包含 ``Cpu`` 和 ``Customer`` 类。文档窗口也会打开,但显示 "No documentation found"(找不到文档),因为项目源文件中不包括其代码的文档。
3. 再次按 Ctrl-空格键以展开项目列表。
image::images/code_completion1.png[]
-4. 使用方向键或鼠标突出显示列表中的某个标准库函数(例如 ``calloc`` );如果 IDE 可以访问该函数的手册页,则文档窗口便会显示该手册页。
+
+[start=4]
+. 使用方向键或鼠标突出显示列表中的某个标准库函数(例如 ``calloc`` );如果 IDE 可以访问该函数的手册页,则文档窗口便会显示该手册页。
image::images/code-completion-documentation.png[]
-5. 选择 ``Customer`` 类,并按 Enter 键。
-6. 键入 ``andrew;`` ,完成新的 ``Customer`` 类实例。在下一行中,键入字母 ``a`` 并按 Ctrl-空格键两次。代码完成框显示以字母 ``a`` 开头的选择列表,例如可从当前上下文访问的方法参数、类字段和全局名。
+
+[start=5]
+. 选择 ``Customer`` 类,并按 Enter 键。
+
+[start=6]
+. 键入 ``andrew;`` ,完成新的 ``Customer`` 类实例。在下一行中,键入字母 ``a`` 并按 Ctrl-空格键两次。代码完成框显示以字母 ``a`` 开头的选择列表,例如可从当前上下文访问的方法参数、类字段和全局名。
image::images/code_completion2.png[]
-7. 双击 ``andrew`` 选项接受它,并在其后键入一个句点。按 Ctrl-空格键,将显示 ``Customer`` 类的公共方法和字段的列表。
+
+[start=7]
+. 双击 ``andrew`` 选项接受它,并在其后键入一个句点。按 Ctrl-空格键,将显示 ``Customer`` 类的公共方法和字段的列表。
image::images/code_completion3.png[]
-8. 删除添加的代码。
+
+[start=8]
+. 删除添加的代码。
=== 添加源代码文档
@@ -151,15 +151,27 @@
1. 在 ``quote.cc`` 文件中,将光标置于第 75 行或该行的上一行
``int readNumberOf(const char* item, int min, int max) {``
-2. 键入一个正斜杠和两个星号,然后按 Enter 键。编辑器会为 ``readNumberOf`` 类插入一条 Doxygen 格式的注释。
+
+[start=2]
+. 键入一个正斜杠和两个星号,然后按 Enter 键。编辑器会为 ``readNumberOf`` 类插入一条 Doxygen 格式的注释。
image::images/doxygen_comment.png[]
-3. 在每个 @param 行中添加一些描述性文本,然后保存该文件。
+
+[start=3]
+. 在每个 @param 行中添加一些描述性文本,然后保存该文件。
image::images/doxygen_comment_edited.png[]
-4. 单击 ``readNumberOf`` 类以便以黄色突出显示,然后单击右侧的某一实例标记以跳至使用该类的位置。
-5. 单击所跳转到的行中的 ``readNumberOf`` 类,然后按 Ctrl-Shift-空格键以显示刚才为参数添加的文档。
+
+[start=4]
+. 单击 ``readNumberOf`` 类以便以黄色突出显示,然后单击右侧的某一实例标记以跳至使用该类的位置。
+
+[start=5]
+. 单击所跳转到的行中的 ``readNumberOf`` 类,然后按 Ctrl-Shift-空格键以显示刚才为参数添加的文档。
image::images/doxygen_displayed.png[]
-6. 单击该文件中的任意其他位置以关闭文档窗口,然后再次单击 ``readNumberOf`` 类。
-7. 选择 "Source"(源)> "Show Documentation"(显示文档)以再次打开该类的文档窗口。
+
+[start=6]
+. 单击该文件中的任意其他位置以关闭文档窗口,然后再次单击 ``readNumberOf`` 类。
+
+[start=7]
+. 选择 "Source"(源)> "Show Documentation"(显示文档)以再次打开该类的文档窗口。
=== 使用代码模板
@@ -199,17 +211,27 @@
* 选择 "Edit"(编辑)> "Find In Projects"(在项目中查找)。
* 在 "Projects"(项目)窗口中右键单击项目,然后选择 "Find"(查找)。
* 按 Ctrl+Shift+F 组合键。
-2. 在 "Find In Projects"(在项目中查找)对话框中,选择 "Default Search"(默认搜索)标签或 "Grep" 标签。"Grep" 标签使用 ``grep`` 实用程序,该实用程序提供较快的搜索,尤其适用于远程项目。
+
+[start=2]
+. 在 "Find In Projects"(在项目中查找)对话框中,选择 "Default Search"(默认搜索)标签或 "Grep" 标签。"Grep" 标签使用 ``grep`` 实用程序,该实用程序提供较快的搜索,尤其适用于远程项目。
image::images/find_in_projects.png[]
-3. 在 "Grep" 标签中,键入要搜索的文本或正则表达式,指定搜索范围和文件名模式,然后选中 "Open in New Tab"(在新标签中打开)复选框,这样您就可以在单独的标签中保存多个搜索。
-4. 单击 "Find"(查找)。
+
+[start=3]
+. 在 "Grep" 标签中,键入要搜索的文本或正则表达式,指定搜索范围和文件名模式,然后选中 "Open in New Tab"(在新标签中打开)复选框,这样您就可以在单独的标签中保存多个搜索。
+
+[start=4]
+. 单击 "Find"(查找)。
"Search Results"(搜索结果)标签会列出已在其中找到相应文本或正则表达式的文件。
使用左旁注中的按钮可以更改搜索结果的视图。
image::images/find_in_projects2.png[]
-5. 单击 "Expand/Collapse"(展开/折叠)按钮可折叠文件列表,以便只显示文件名。单击其他按钮可以目录树形式或文件列表形式显示搜索结果。这些选项在跨多个项目执行搜索时非常有用。
-6. 双击列表中的某一项,IDE 将转到源代码编辑器中的对应位置。
+
+[start=5]
+. 单击 "Expand/Collapse"(展开/折叠)按钮可折叠文件列表,以便只显示文件名。单击其他按钮可以目录树形式或文件列表形式显示搜索结果。这些选项在跨多个项目执行搜索时非常有用。
+
+[start=6]
+. 双击列表中的某一项,IDE 将转到源代码编辑器中的对应位置。
== 导航 C 和 C++ 源文件
@@ -225,7 +247,9 @@
2. 展开 "Classes"(类)窗口中的 ``Quote_1`` 节点。项目中所有类都会被列出。
3. 展开 ``Customer`` 类。
image::images/classes_window.png[]
-4. 双击 ``name`` 变量打开 ``customer.h`` 头文件。
+
+[start=4]
+. 双击 ``name`` 变量打开 ``customer.h`` 头文件。
=== 使用 "Navigator"(导航器)窗口
@@ -235,8 +259,12 @@
1. 在编辑器窗口中单击 ``quote.cc`` 文件中的任意位置。
2. 文件的紧凑视图就会在 "Navigator"(导航器)窗口中显示出来。
image::images/navigator_window.png[]
-3. 要导航至文件的一个元素,可以在 "Navigator"(导航器)窗口中双击该元素,编辑器窗口中的光标就会移动到这个元素处。
-4. 在 "Navigator"(导航器)中单击鼠标右键以选择其他元素排序方式、项目分组方式或过滤方式。
+
+[start=3]
+. 要导航至文件的一个元素,可以在 "Navigator"(导航器)窗口中双击该元素,编辑器窗口中的光标就会移动到这个元素处。
+
+[start=4]
+. 在 "Navigator"(导航器)中单击鼠标右键以选择其他元素排序方式、项目分组方式或过滤方式。
要了解 "Navigator"(导航器)中的各个图标所表示的内容,请选择 "Help"(帮助)> "Help Contents"(帮助内容)以打开 IDE 联机帮助,然后在帮助窗口中搜索“导航器图标”。
@@ -249,7 +277,9 @@
2. 在 "Find Usages"(查找使用实例)对话框中,单击 "Find"(查找)。
3. 此时 "Usages"(使用实例)窗口会打开并显示项目源文件中的 ``Customer`` 类。
image::images/usages_window.png[]
-4. 单击左旁注中的箭头按钮以逐一浏览各个实例并将其显示在编辑器中,或者在逻辑和物理视图之间更改。您也可以使用左旁注中的第二列按钮对信息进行过滤。
+
+[start=4]
+. 单击左旁注中的箭头按钮以逐一浏览各个实例并将其显示在编辑器中,或者在逻辑和物理视图之间更改。您也可以使用左旁注中的第二列按钮对信息进行过滤。
=== 使用调用图形
@@ -262,10 +292,16 @@
如果此处未显示所有函数,请单击 "Call Graph"(调用图形)窗口左侧的第三个按钮,以显示“从该函数调用的函数”。
-3. 展开 ``endl`` 节点以显示该函数所调用的函数。请注意,图形也会更新以显示由 ``endl`` 调用的函数。
-4. 单击窗口左侧的第二个按钮 "Bring Into Focus"(聚焦)以将焦点放在 ``endl`` 函数上,然后单击第四个按钮 "Who Calls this Function"(此函数的调用者)以查看调用 ``endl`` 函数的所有函数。
+
+[start=3]
+. 展开 ``endl`` 节点以显示该函数所调用的函数。请注意,图形也会更新以显示由 ``endl`` 调用的函数。
+
+[start=4]
+. 单击窗口左侧的第二个按钮 "Bring Into Focus"(聚焦)以将焦点放在 ``endl`` 函数上,然后单击第四个按钮 "Who Calls this Function"(此函数的调用者)以查看调用 ``endl`` 函数的所有函数。
image::images/call_graph2.png[]
-5. 展开树中的某些节点以查看更多函数。
+
+[start=5]
+. 展开树中的某些节点以查看更多函数。
image::images/call_graph3.png[]
@@ -275,17 +311,31 @@
1. 在 ``Quote_1`` 项目的 ``cpu.cc`` 文件中,按住 Ctrl 键的同时将鼠标悬停在第 37 行上。此时会突出显示 ``ComputeSupportMetric`` 函数,并且还会显示一个包含该函数相关信息的标注。
image::images/hyperlinks1.png[]
-2. 单击超链接,编辑器会跳转至函数定义。
+
+[start=2]
+. 单击超链接,编辑器会跳转至函数定义。
image::images/hyperlinks2.png[]
-3. 在按住 Ctrl 键的同时,将鼠标悬停在其定义上,然后单击超链接。编辑器会跳转至 ``cpu.h`` 头文件中的函数声明。
+
+[start=3]
+. 在按住 Ctrl 键的同时,将鼠标悬停在其定义上,然后单击超链接。编辑器会跳转至 ``cpu.h`` 头文件中的函数声明。
image::images/hyperlinks3.png[]
-4. 单击编辑器工具栏中的左箭头(从左侧算起的第二个按钮),编辑器会跳回 ``cpu.cc`` 中的定义。
-5. 将鼠标光标悬停在左旁注中的绿色圆圈上,此时会显示标注,指示此方法覆盖了其他方法。
+
+[start=4]
+. 单击编辑器工具栏中的左箭头(从左侧算起的第二个按钮),编辑器会跳回 ``cpu.cc`` 中的定义。
+
+[start=5]
+. 将鼠标光标悬停在左旁注中的绿色圆圈上,此时会显示标注,指示此方法覆盖了其他方法。
image::images/overide_annotation.png[]
-6. 单击绿色圆圈以转至覆盖的方法,此时会跳转至 ``module.h`` 头文件,该文件的旁注中显示了指示方法已覆盖的灰色圆圈。
-7. 单击灰色圆圈,编辑器会显示覆盖此方法的方法列表。
+
+[start=6]
+. 单击绿色圆圈以转至覆盖的方法,此时会跳转至 ``module.h`` 头文件,该文件的旁注中显示了指示方法已覆盖的灰色圆圈。
+
+[start=7]
+. 单击灰色圆圈,编辑器会显示覆盖此方法的方法列表。
image::images/overridden_by_list.png[]
-8. 单击 ``Cpu::ComputeSupportMetric`` 项,此时会跳转回 ``cpu.h`` 头文件中的方法声明。
+
+[start=8]
+. 单击 ``Cpu::ComputeSupportMetric`` 项,此时会跳转回 ``cpu.h`` 头文件中的方法声明。
=== 使用包含分层结构
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart.asciidoc
index 6190aa9..83ff824 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart.asciidoc
@@ -77,8 +77,12 @@
2. In the wizard, select the C/C++ category.
3. The wizard gives you a choice of several types of new projects. Select C/C++ Application and click Next.
image::images/creating_application.png[]
-4. Create a new C/C++ Application project from the wizard using the defaults. You can choose the name of the project and the location of the project.
-5. Click Finish to exit the wizard.
+
+[start=4]
+. Create a new C/C++ Application project from the wizard using the defaults. You can choose the name of the project and the location of the project.
+
+[start=5]
+. Click Finish to exit the wizard.
A project is created with logical folders. A logical folder is not a directory. It is a way for you to organize your files and does not reflect where the files are physically stored on disk. Files added to logical folders are automatically part of the project and are compiled when you build the project.
@@ -91,7 +95,9 @@
1. Select the Files tab. This window shows the physical view of your project. It displays files and folders as they are stored on disk.
image::images/files_tab.png[]
-2. Select the Projects tab. This window shows the logical view of your project.
+
+[start=2]
+. Select the Projects tab. This window shows the logical view of your project.
image::images/projects_tab.png[]
Most commands that you run on a project are available in the Projects tab, not the Files tab.
@@ -116,7 +122,9 @@
image::images/adding_files.png[]
-3. Click Finish.
+
+[start=3]
+. Click Finish.
The ``newfile.cpp`` file is created on disk in the directory specified in the wizard and added to the Source Files folder. You can add any kind of file to this folder, not only source files.
@@ -216,7 +224,9 @@
6. In the Project Properties dialog box, select the Run node.
7. In the Run Command text field, type 1111 2222 3333. Click OK.
image::images/setting_arguments.png[]
-8. Right-click the project node and choose Run.The application runs. Your arguments are displayed in the Output window.
+
+[start=8]
+. Right-click the project node and choose Run.The application runs. Your arguments are displayed in the Output window.
== Creating a C/C++ Project With Existing Sources
@@ -234,16 +244,30 @@
Extract the pthreads library in your Windows user directory.
-2. Download the ``loki-0.1.7`` library from link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +].
-3. Uncompress ``loki-0.1.7`` in a directory of your choice.
-4. Open the New Project wizard by choosing File > New Project.
-5. Select the C/C++ category.
-6. Select C/C++ Project With Existing Sources and click Next.
-7. On the Select Mode page, click the Browse button. In the Select Project Folder dialog box, navigate to the directory where you saved ``loki-0.1.7`` . Select the ``loki-0.1.7`` directory. Click Select.
+
+[start=2]
+. Download the ``loki-0.1.7`` library from link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +].
+
+[start=3]
+. Uncompress ``loki-0.1.7`` in a directory of your choice.
+
+[start=4]
+. Open the New Project wizard by choosing File > New Project.
+
+[start=5]
+. Select the C/C++ category.
+
+[start=6]
+. Select C/C++ Project With Existing Sources and click Next.
+
+[start=7]
+. On the Select Mode page, click the Browse button. In the Select Project Folder dialog box, navigate to the directory where you saved ``loki-0.1.7`` . Select the ``loki-0.1.7`` directory. Click Select.
image::images/existing_sources_project1.png[]
-8. Use the default Configuration Mode, Automatic. Click Finish.
+
+[start=8]
+. Use the default Configuration Mode, Automatic. Click Finish.
The project is created and opened in the Projects tab, and the IDE automatically runs the Clean and Build actions specified in the existing Makefile. The project is also automatically configured for code assistance.
@@ -263,8 +287,12 @@
The root directory for the source files from which the binary was built is filled in automatically. By default, only the source files from which the binary was built are included in the project. By default, dependencies are included in the project. The shared libraries required by the project are automatically listed.
image::images/binary_project.png[]
-5. Click Next.
-6. On the Project Name and Location page, you can choose the name and location of the project. Click Finish.
+
+[start=5]
+. Click Next.
+
+[start=6]
+. On the Project Name and Location page, you can choose the name and location of the project. Click Finish.
=== Building and Rebuilding Your Project
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ja.asciidoc
index 212ca16..2280da8 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ja.asciidoc
@@ -76,8 +76,12 @@
2. ウィザードで「C/C++」カテゴリを選択します。
3. このウィザードでは、新規プロジェクトのタイプをいくつかの中から選択できます。「C/C++アプリケーション」を選択して「次」をクリックします。
image::images/creating_application.png[]
-4. ウィザードのデフォルトの値を使用して、新しいC/C++アプリケーション・プロジェクトを作成します。プロジェクトの名前と場所を選択できます。
-5. 「終了」をクリックしてウィザードを終了します。
+
+[start=4]
+. ウィザードのデフォルトの値を使用して、新しいC/C++アプリケーション・プロジェクトを作成します。プロジェクトの名前と場所を選択できます。
+
+[start=5]
+. 「終了」をクリックしてウィザードを終了します。
論理フォルダを持つプロジェクトが作成されます。論理フォルダはディレクトリではありません。ユーザーがファイルを編成する1つの手段であり、ファイルが物理的に格納されているディスク上の場所を反映しているわけではありません。論理フォルダに追加されたファイルは、自動的にプロジェクトの構成要素となり、プロジェクトのビルド時にコンパイルされます。
@@ -90,7 +94,9 @@
1. 「ファイル」タブを選択します。次のウィンドウはプロジェクトの物理ビューを示しています。このビューには、ディスクに格納されているとおりにファイルおよびフォルダが表示されます。
image::images/files_tab.png[]
-2. 「プロジェクト」タブを選択します。次のウィンドウはプロジェクトの論理ビューを示しています。
+
+[start=2]
+. 「プロジェクト」タブを選択します。次のウィンドウはプロジェクトの論理ビューを示しています。
image::images/projects_tab.png[]
プロジェクトで実行するコマンドのほとんどは、「ファイル」タブではなく「プロジェクト」タブで使用できます。
@@ -115,7 +121,9 @@
image::images/adding_files.png[]
-3. 「終了」をクリックします。
+
+[start=3]
+. 「終了」をクリックします。
ディスク上の、ウィザードで指定したディレクトリに ``newfile.cpp`` ファイルが作成されて、「ソース・ファイル」フォルダに追加されます。このフォルダには、ソース・ファイルのみでなく任意の種類のファイルを追加できます。
@@ -215,7 +223,9 @@
6. 「プロジェクト・プロパティ」ダイアログ・ボックスで「実行」ノードを選択します。
7. 「コマンドの実行」テキスト・フィールドに「1111 2222 3333」を入力します。「OK」をクリックします。
image::images/setting_arguments.png[]
-8. プロジェクトのノードを右クリックし、「実行」を選択します。アプリケーションが実行されます。「出力」ウィンドウに引数が表示されます。
+
+[start=8]
+. プロジェクトのノードを右クリックし、「実行」を選択します。アプリケーションが実行されます。「出力」ウィンドウに引数が表示されます。
== 既存のソースを使用したC/C++プロジェクトの作成
@@ -233,16 +243,30 @@
Windowsユーザー・ディレクトリにPthreadsライブラリを抽出します。
-2. link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +]から ``loki-0.1.7`` ライブラリをダウンロードします。
-3. 適当なディレクトリに ``loki-0.1.7`` を展開します。
-4. 「ファイル」>「新規プロジェクト」を選択して、新規プロジェクト・ウィザードを開きます。
-5. 「C/C++」カテゴリを選択します。
-6. 「既存のソースを使用するC/C++プロジェクト」を選択して「次」をクリックします。
-7. モードを選択ページで「参照」ボタンをクリックします。「プロジェクト・フォルダを選択」ダイアログ・ボックスで ``loki-0.1.7`` の保存先ディレクトリに移動します。 ``loki-0.1.7`` ディレクトリを選択します。「選択」をクリックします。
+
+[start=2]
+. link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +]から ``loki-0.1.7`` ライブラリをダウンロードします。
+
+[start=3]
+. 適当なディレクトリに ``loki-0.1.7`` を展開します。
+
+[start=4]
+. 「ファイル」>「新規プロジェクト」を選択して、新規プロジェクト・ウィザードを開きます。
+
+[start=5]
+. 「C/C++」カテゴリを選択します。
+
+[start=6]
+. 「既存のソースを使用するC/C++プロジェクト」を選択して「次」をクリックします。
+
+[start=7]
+. モードを選択ページで「参照」ボタンをクリックします。「プロジェクト・フォルダを選択」ダイアログ・ボックスで ``loki-0.1.7`` の保存先ディレクトリに移動します。 ``loki-0.1.7`` ディレクトリを選択します。「選択」をクリックします。
image::images/existing_sources_project1.png[]
-8. デフォルトの構成モードの「自動」を使用します。「終了」をクリックします。
+
+[start=8]
+. デフォルトの構成モードの「自動」を使用します。「終了」をクリックします。
プロジェクトが作成されて「プロジェクト」タブで開かれ、既存のMakefileで指定した「消去してビルド」アクションがIDEで自動的に実行されます。このプロジェクトは、コード支援用にも自動的に構成されます。
@@ -262,8 +286,12 @@
バイナリがビルドされたソース・ファイルのルート・ディレクトリは自動的に入力されます。デフォルトでは、プロジェクトに含まれるのは、バイナリがビルドされたソース・ファイルのみです。デフォルトでは、プロジェクトに依存性が含まれます。プロジェクトで必要な共有ライブラリは自動的に一覧表示されます。
image::images/binary_project.png[]
-5. 「次」をクリックします。
-6. 「プロジェクトの名前と場所」ページで、プロジェクトの名前と場所を選択できます。「終了」をクリックします。
+
+[start=5]
+. 「次」をクリックします。
+
+[start=6]
+. 「プロジェクトの名前と場所」ページで、プロジェクトの名前と場所を選択できます。「終了」をクリックします。
=== プロジェクトのビルドと再ビルド
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_pt_BR.asciidoc
index 99e22cd..e770ebc 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_pt_BR.asciidoc
@@ -77,8 +77,12 @@
2. No assistente, selecione a categoria C/C++.
3. O assistente fornece a escolha de diversos tipos de novos projetos. Selecione Aplicação C/C++ e clique em Próximo.
image::images/creating_application.png[]
-4. Crie um novo projeto de Aplicação C/C++ no assistente usando os defaults. É possível escolher o nome do projeto e a localização do projeto.
-5. Clique em Finalizar para sair do assistente.
+
+[start=4]
+. Crie um novo projeto de Aplicação C/C++ no assistente usando os defaults. É possível escolher o nome do projeto e a localização do projeto.
+
+[start=5]
+. Clique em Finalizar para sair do assistente.
Um projeto é criado com pastas lógicas. A pasta lógica não é um diretório. Trata-se de uma forma de organizar os arquivos e não reflete onde os arquivos estão armazenados fisicamente. Os arquivos adicionados a pastas lógicas são automaticamente parte do projeto e são construídos quando você constrói o projeto.
@@ -91,7 +95,9 @@
1. Selecione a guia Arquivos. Esta janela exibe a view física do projeto. Isso exibe os arquivos e as pastas conforme eles estão armazenados no disco.
image::images/files_tab.png[]
-2. Selecione a guia Projetos. Esta janela exibe a view lógica do projeto.
+
+[start=2]
+. Selecione a guia Projetos. Esta janela exibe a view lógica do projeto.
image::images/projects_tab.png[]
A maioria dos comandos que são executados em um projeto estão disponíveis na guia de Projetos, não na guia Arquivos.
@@ -116,7 +122,9 @@
image::images/adding_files.png[]
-3. Clique em Finalizar.
+
+[start=3]
+. Clique em Finalizar.
O arquivo ``newfile.cpp`` é criado no disco no diretório especificado no assistente e adicionado à pasta Arquivos de Código-fonte. É possível adicionar qualquer tipo de arquivo a essa pasta, não somente arquivos de código-fonte.
@@ -216,7 +224,9 @@
6. Na caixa de diálogo Propriedades do projeto, selecione o nó Executar.
7. No campo de texto Executar Comando, digite 1111 2222 3333. Clique em OK.
image::images/setting_arguments.png[]
-8. Clique com o botão direito no nó do projeto e escolha Executar. A aplicação é executada. Seus argumentos são exibidos na janela de Saída.
+
+[start=8]
+. Clique com o botão direito no nó do projeto e escolha Executar. A aplicação é executada. Seus argumentos são exibidos na janela de Saída.
== Criando um Projeto C/C++ com Códigos-fonte Existentes
@@ -234,16 +244,30 @@
Extraia a biblioteca pthreads no diretório de usuário do Windows.
-2. Faça o download da biblioteca ``loki-0.1.7`` em link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +].
-3. Descompacte ``loki-0.1.7`` em um diretório da sua escolha.
-4. Abra o assistente para Novo Projeto em Arquivo > Novo Projeto.
-5. Selecione a categoria C/C++.
-6. Selecione Projeto C/C++ com Códigos-fonte Existentes e clique em Próximo.
-7. Na página Selecionar Modo, clique no botão Procurar. Na caixa de diálogo Selecionar Pasta do Projeto, vá ao diretório no qual salvou ``loki-0.1.7`` . Selecione o diretório ``loki-0.1.7`` . Clique em Selecionar.
+
+[start=2]
+. Faça o download da biblioteca ``loki-0.1.7`` em link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +].
+
+[start=3]
+. Descompacte ``loki-0.1.7`` em um diretório da sua escolha.
+
+[start=4]
+. Abra o assistente para Novo Projeto em Arquivo > Novo Projeto.
+
+[start=5]
+. Selecione a categoria C/C++.
+
+[start=6]
+. Selecione Projeto C/C++ com Códigos-fonte Existentes e clique em Próximo.
+
+[start=7]
+. Na página Selecionar Modo, clique no botão Procurar. Na caixa de diálogo Selecionar Pasta do Projeto, vá ao diretório no qual salvou ``loki-0.1.7`` . Selecione o diretório ``loki-0.1.7`` . Clique em Selecionar.
image::images/existing_sources_project1.png[]
-8. Utilize o Modo de Configuração default, Automático. Clique em Finalizar.
+
+[start=8]
+. Utilize o Modo de Configuração default, Automático. Clique em Finalizar.
O projeto é criado e aberto na guia Projeto, e o IDE executa automaticamente as ações Limpar e Construir especificadas no Makefile existente. O projeto também é automaticamente configurado para a assistência ao código.
@@ -263,8 +287,12 @@
O diretório-raiz para os arquivos de origem do qual o binário foi construído é preenchido automaticamente. Por default, apenas os arquivos de código-fonte do qual o binário foi construída são incluídos no projeto. Por default, as dependências são incluídas no projeto. As bibliotecas compartilhadas necessárias pelo projeto são automaticamente listadas.
image::images/binary_project.png[]
-5. Clique em Próximo.
-6. Na página Nome do Projeto e Localização, você pode escolher o nome e a localização do projeto. Clique em Finalizar.
+
+[start=5]
+. Clique em Próximo.
+
+[start=6]
+. Na página Nome do Projeto e Localização, você pode escolher o nome e a localização do projeto. Clique em Finalizar.
=== Construindo e Reconstruindo o Projeto
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ru.asciidoc
index c41070a..b83d72e 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_ru.asciidoc
@@ -77,8 +77,12 @@
2. Выберите категорию "C/C++" в мастере.
3. Мастер предлагает возможность выбора типа нового проекта. Выберите параметр "Приложение на C/C++" и нажмите кнопку "Далее".
image::images/creating_application.png[]
-4. Создайте в мастере новый проект "Приложение C/C++", используя параметры по умолчанию. Название проекта и его расположение выбираются разработчиком.
-5. Для выхода из мастера нажмите кнопку "Готово".
+
+[start=4]
+. Создайте в мастере новый проект "Приложение C/C++", используя параметры по умолчанию. Название проекта и его расположение выбираются разработчиком.
+
+[start=5]
+. Для выхода из мастера нажмите кнопку "Готово".
Проект создается с логическими папками. Логическая папка не является каталогом. Она представляет собой способ упорядочения файлов и не отражает физическое расположение файлов на диске. Добавленные в логические папки файлы автоматически становятся частью проекта и компилируются при сборке проекта.
@@ -91,7 +95,9 @@
1. Перейдите на вкладку "Файлы". В этом окне содержится физическое представление проекта. В нем отображается расположение файлов и папок на диске.
image::images/files_tab.png[]
-2. Перейдите на вкладку "Проекты". В этом окне содержится логическое представление проекта.
+
+[start=2]
+. Перейдите на вкладку "Проекты". В этом окне содержится логическое представление проекта.
image::images/projects_tab.png[]
Большинство команд, выполняемых в проекте, доступны на вкладке "Проекты", а не на вкладке "Файлы".
@@ -116,7 +122,9 @@
image::images/adding_files.png[]
-3. Нажмите кнопку 'Готово'.
+
+[start=3]
+. Нажмите кнопку 'Готово'.
Файл ``newfile.cpp`` создается на диске в каталоге, указанном в мастере, а также добавляется в папку "Исходные файлы". В эту папку можно добавлять любые файлы, а не только файлы исходного кода.
@@ -216,7 +224,9 @@
6. В диалоговом окне "Свойства проекта" выберите узел "Запуск".
7. В текстовом поле "Выполнить команду" введите текст "1111 2222 3333". Нажмите кнопку "ОК".
image::images/setting_arguments.png[]
-8. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить". Приложение будет выполнено. Аргументы отображаются в окне вывода.
+
+[start=8]
+. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить". Приложение будет выполнено. Аргументы отображаются в окне вывода.
== Создание проекта C/C++ с существующим исходным кодом
@@ -234,16 +244,30 @@
Распакуйте библиотеку pthreads в пользовательском каталоге Windows.
-2. Загрузите библиотеку ``loki-0.1.7`` с сайта link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +].
-3. Разархивируйте каталог ``loki-0.1.7`` в выбранный каталог.
-4. Откройте мастер "Новый проект" с помощью команды FIle ("Файл") > New Project ("Новый проект").
-5. Выберите категорию "C/C++".
-6. Выберите элемент "Проект C/C++ с существующими исходными кодами" и нажмите кнопку "Далее".
-7. На странице "Выбрать режим" нажмите кнопку "Обзор". В диалоговом окне "Выбрать папку проекта" перейдите в каталог, в котором сохранен каталог ``loki-0.1.7`` . Выберите каталог ``loki-0.1.7`` . Нажмите кнопку "Выбрать".
+
+[start=2]
+. Загрузите библиотеку ``loki-0.1.7`` с сайта link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +].
+
+[start=3]
+. Разархивируйте каталог ``loki-0.1.7`` в выбранный каталог.
+
+[start=4]
+. Откройте мастер "Новый проект" с помощью команды FIle ("Файл") > New Project ("Новый проект").
+
+[start=5]
+. Выберите категорию "C/C++".
+
+[start=6]
+. Выберите элемент "Проект C/C++ с существующими исходными кодами" и нажмите кнопку "Далее".
+
+[start=7]
+. На странице "Выбрать режим" нажмите кнопку "Обзор". В диалоговом окне "Выбрать папку проекта" перейдите в каталог, в котором сохранен каталог ``loki-0.1.7`` . Выберите каталог ``loki-0.1.7`` . Нажмите кнопку "Выбрать".
image::images/existing_sources_project1.png[]
-8. Используйте режим "Режим настройки" по умолчанию – значение "Автоматически". Нажмите кнопку 'Готово'.
+
+[start=8]
+. Используйте режим "Режим настройки" по умолчанию – значение "Автоматически". Нажмите кнопку 'Готово'.
Проект создается и открывается на вкладке "Проекты", а среда IDE автоматически запускает действия "Очистка"и "Сборка", указанные в существующем файле Make. Проект также автоматически настраивается для вспомогательных функций кода.
@@ -263,8 +287,12 @@
Корневой каталог для исходных файлов, с помощью которых был создан двоичный файл, заполняется автоматически. По умолчанию в проект включаются только исходные файлы, с помощью которых был создан двоичный файл. По умолчанию в проект включаются зависимости. Общие библиотеки, необходимые для проекта. указываются автоматически.
image::images/binary_project.png[]
-5. Нажмите кнопку "Далее".
-6. На странице 'Имя и местоположение' можно выбрать имя и местоположение проекта Нажмите кнопку 'Готово'.
+
+[start=5]
+. Нажмите кнопку "Далее".
+
+[start=6]
+. На странице 'Имя и местоположение' можно выбрать имя и местоположение проекта Нажмите кнопку 'Готово'.
=== Сборка и пересборка проекта
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_zh_CN.asciidoc
index aeda5b8..82bc311 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/quickstart_zh_CN.asciidoc
@@ -77,8 +77,12 @@
2. 在向导中,选择 "C/C++" 类别。
3. 该向导提供了多种类型的新项目供您选择。选择 "C/C++ Application"(C/C++ 应用程序),然后单击 "Next"(下一步)。
image::images/creating_application.png[]
-4. 通过向导并使用默认设置来创建一个 "C/C++ Application"(C/C++ 应用程序)项目。您可以选择项目的名称和位置。
-5. 单击 "Finish"(完成)退出向导。
+
+[start=4]
+. 通过向导并使用默认设置来创建一个 "C/C++ Application"(C/C++ 应用程序)项目。您可以选择项目的名称和位置。
+
+[start=5]
+. 单击 "Finish"(完成)退出向导。
现已创建了一个具有逻辑文件夹的项目。逻辑文件夹不是目录。它是一种组织文件的方式,并不反映文件在磁盘上的物理存储位置。添加到逻辑文件夹的文件将自动成为项目的一部分,并且在构建项目时进行编译。
@@ -91,7 +95,9 @@
1. 选择 "Files"(文件)标签。该窗口显示项目的物理视图。它按原样体现磁盘上存储的文件和文件夹。
image::images/files_tab.png[]
-2. 选择 "Projects"(项目)标签。该窗口显示项目的逻辑视图。
+
+[start=2]
+. 选择 "Projects"(项目)标签。该窗口显示项目的逻辑视图。
image::images/projects_tab.png[]
对项目运行的多数命令包含在 "Projects"(项目)标签中,而不是包含在 "Files"(文件)标签中。
@@ -116,7 +122,9 @@
image::images/adding_files.png[]
-3. 单击 "Finish"(完成)。
+
+[start=3]
+. 单击 "Finish"(完成)。
``newfile.cpp`` 文件随即在向导中指定的磁盘目录下创建,并添加到 "Source Files"(源文件)文件夹中。您可以在此文件夹中添加任何类型的文件,而不仅仅是源文件。
@@ -216,7 +224,9 @@
6. 在 "Project Properties"(项目属性)对话框中,选择 "Run"(运行)节点。
7. 在 "Run Command"(运行命令)文本字段中,键入 1111 2222 3333。单击 "OK"(确定)。
image::images/setting_arguments.png[]
-8. 右键单击项目节点,然后选择 "Run"(运行)。此时将运行应用程序。参数将显示在 "Output"(输出)窗口中。
+
+[start=8]
+. 右键单击项目节点,然后选择 "Run"(运行)。此时将运行应用程序。参数将显示在 "Output"(输出)窗口中。
== 创建基于现有源代码的 C/C++ 项目
@@ -234,16 +244,30 @@
将 Pthreads 库解压缩到您的 Windows 用户目录中。
-2. 从 link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +] 下载 ``loki-0.1.7`` 库。
-3. 将 ``loki-0.1.7`` 解压缩到您所选的目录中。
-4. 选择“文件”>“新建项目”以打开新建项目向导。
-5. 选择 "C/C++" 类别。
-6. 选择 "C/C++ Project With Existing Sources"(基于现有源代码的 C/C++ 项目),然后单击 "Next"(下一步)。
-7. 在 "Select Mode"(选择模式)页上,单击 "Browse"(浏览)按钮。在 "Select Project Folder"(选择项目文件夹)对话框中,导航至保存 ``loki-0.1.7`` 的目录。选择 ``loki-0.1.7`` 目录。单击 "Select"(选择)按钮。
+
+[start=2]
+. 从 link:http://sourceforge.net/projects/loki-lib[+ ``http://sourceforge.net/projects/loki-lib`` +] 下载 ``loki-0.1.7`` 库。
+
+[start=3]
+. 将 ``loki-0.1.7`` 解压缩到您所选的目录中。
+
+[start=4]
+. 选择“文件”>“新建项目”以打开新建项目向导。
+
+[start=5]
+. 选择 "C/C++" 类别。
+
+[start=6]
+. 选择 "C/C++ Project With Existing Sources"(基于现有源代码的 C/C++ 项目),然后单击 "Next"(下一步)。
+
+[start=7]
+. 在 "Select Mode"(选择模式)页上,单击 "Browse"(浏览)按钮。在 "Select Project Folder"(选择项目文件夹)对话框中,导航至保存 ``loki-0.1.7`` 的目录。选择 ``loki-0.1.7`` 目录。单击 "Select"(选择)按钮。
image::images/existing_sources_project1.png[]
-8. 使用默认的配置模式("Automatic"(自动))。单击 "Finish"(完成)。
+
+[start=8]
+. 使用默认的配置模式("Automatic"(自动))。单击 "Finish"(完成)。
此时会在 "Projects"(项目)标签中创建并打开该项目,并且 IDE 会自动运行现有 Makefile 中指定的 "Clean and Build"(清理并构建)操作。此外,还将自动配置该项目以获取代码帮助。
@@ -263,8 +287,12 @@
将会自动填充所构建二进制文件基于的源文件的根目录。默认情况下,项目中仅包含所构建二进制文件基于的源文件。默认情况下,项目中包含依赖关系。将自动列出项目所需的共享库。
image::images/binary_project.png[]
-5. 单击 "Next"(下一步)。
-6. 在 "Project Name and Location"(项目名称和位置)页上,可以选择项目的名称和位置。单击 "Finish"(完成)。
+
+[start=5]
+. 单击 "Next"(下一步)。
+
+[start=6]
+. 在 "Project Name and Location"(项目名称和位置)页上,可以选择项目的名称和位置。单击 "Finish"(完成)。
=== 构建和重新构建项目
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes.asciidoc
index 1938324..5b3b77a 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes.asciidoc
@@ -17,8 +17,6 @@
// under the License.
//
-image::images/netbeans-stamp-80-74-73.png[title="Content on this page applies to the NetBeans IDE 7.3 and 7.4 and 8.0"]
-
= Modes of C/C++ Remote Development in the IDE
:jbake-type: tutorial
:jbake-tags: tutorials
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ja.asciidoc
index 709c5a9..3a8f7db 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ja.asciidoc
@@ -17,8 +17,6 @@
// under the License.
//
-image::images/netbeans-stamp-80-74-73.png[title="このページの内容は、NetBeans IDE 7.3、7.4および8.0に適用されます"]
-
= IDEでのC/C++リモート開発のモード
:jbake-type: tutorial
:jbake-tags: tutorials
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_pt_BR.asciidoc
index b3860e2..1c7dd32 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_pt_BR.asciidoc
@@ -17,8 +17,6 @@
// under the License.
//
-image::images/netbeans-stamp-80-74-73.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.3, 7.4 e 8.0"]
-
= Modos de Desenvolvimento Remoto de C/C++ no IDE
:jbake-type: tutorial
:jbake-tags: tutorials
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ru.asciidoc
index 73af1e6..b8a031e 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_ru.asciidoc
@@ -17,8 +17,6 @@
// under the License.
//
-image::images/netbeans-stamp-80-74-73.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.3, 7.4 и 8.0"]
-
= Режимы удаленной разработки C/C++ в IDE
:jbake-type: tutorial
:jbake-tags: tutorials
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_zh_CN.asciidoc
index e66313b..0f5aaec 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remote-modes_zh_CN.asciidoc
@@ -17,8 +17,6 @@
// under the License.
//
-image::images/netbeans-stamp-80-74-73.png[title="此页上的内容适用于 NetBeans IDE 7.3、7.4 和 8.0"]
-
= IDE 中的 C/C++ 远程开发模式
:jbake-type: tutorial
:jbake-tags: tutorials
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial.asciidoc
index 06e3712..0e8cdc2 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial.asciidoc
@@ -34,27 +34,6 @@
This document describes how to use remote development features of the NetBeans IDE with C/C++/Fortran projects.
-=== Contents
-
-image::images/netbeans-stamp-80-74-73.png[title="Content on this page applies to the NetBeans IDE 7.3 and 7.4 and 8.0"]
-
-|===
-|- |<<intro,Introduction>>
-
-|- |<<concepts,Remote Development Concepts>>
-
-|- |<<system,Setting Up the System>>
-
-|- |<<setup,Setting Up the IDE>>
-
-|- |<<workflow,Building a Local Project on a Remote Host>>
-
-|- |<<terminal,Starting a Terminal Session on the Remote Host>>
-
-|- |<<tips,Remote Development Tips>>
-|===
-
-
== Requirements
*To follow this tutorial, you need the following software.*
@@ -173,17 +152,17 @@
To connect to SMB/CIFS (Windows) servers and shared folders, enter the server address in one of these forms:
-[quote]
+[source, bash]
----
-`smb://_DNSname/sharename_
-smb://_IPaddress/sharename_`
+smb://_DNSname/sharename_
+smb://_IPaddress/sharename_
----
You are prompted to enter the username and password for the shared folder. See link:http://support.apple.com/kb/ht1568[+How to Connect to Windows File Sharing (SMB)+] in the Apple knowledge base for more information.
To connect to an NFS server, type the server name and path to the NFS shared folder in one of these forms:
-[quote]
+[source,bash]
----
`nfs://_servername/path/to/share/_
nfs://_IPaddress/path/to/share_`
@@ -224,26 +203,44 @@
1. Open the Services window by choosing Window > Services.
2. Right-click the C/C++ Build Hosts node and select Add New Host.
image::images/remotedev-add-host.png[]In the New Remote Host Setup dialog box, the IDE discovers your local network's hosts. The host names are added to a table in the dialog box, and a green indicator tells you if they are running the SSH server.
-3. Double-click the name of the server you want, or type the server name directly in the Hostname field. Click Next.
+
+[start=3]
+. Double-click the name of the server you want, or type the server name directly in the Hostname field. Click Next.
image::images/remotedev-setup-host.png[]
-4. On the Setup Host screen, type the username that you use to log in to the remote host, and select an authentication method. For this tutorial, select Password and click Next.image::images/remotedev-setup-host-auth.png[]
+
+[start=4]
+. On the Setup Host screen, type the username that you use to log in to the remote host, and select an authentication method. For this tutorial, select Password and click Next.image::images/remotedev-setup-host-auth.png[]
If you want to use ssh keys, you must set them up outside the IDE first. Then you can specify the location to the ssh keys in the IDE, and the IDE can use the keys to make the ssh connection to the remote build host.
-5. After a connection is made to the server, enter your password in the Authentication dialog box.
-6. Optionally, click Remember Password to have the IDE encrypt and store the password on your local disk so you do not have to enter it each time the IDE connects to the remote host.
+
+[start=5]
+. After a connection is made to the server, enter your password in the Authentication dialog box.
+
+[start=6]
+. Optionally, click Remember Password to have the IDE encrypt and store the password on your local disk so you do not have to enter it each time the IDE connects to the remote host.
The IDE configures the remote host and looks for tool collections on the remote host.
-7. When the host is successfully configured, a summary page shows information about the remote host: the platform, hostname, user name to log in, and the tool collections that were found.
+
+[start=7]
+. When the host is successfully configured, a summary page shows information about the remote host: the platform, hostname, user name to log in, and the tool collections that were found.
image::images/remotedev-setup-host-summary.png[]
-8. At the bottom of the summary page, two more options are displayed. If more than one tool collection was found, you can select one of the collections to be the Default Tool Collection.
-9. For the Access project files via option:
+
+[start=8]
+. At the bottom of the summary page, two more options are displayed. If more than one tool collection was found, you can select one of the collections to be the Default Tool Collection.
+
+[start=9]
+. For the Access project files via option:
* Select Automatic Copying if your client system and the remote build host do not have shared access to the project files. When you select Automatic Copying, the project files will be copied to your home directory on the server using the sftp command. This is known as simple remote development.
* Select System level file sharing if the client and server have access to the same folder. This is known as shared or mixed remote development.
* Select SFTP (on NetBeans 7.4 and 8.0 only) to use secure file transfer protocol to copy the project files to the remote host. Similar to Automatic Copying.
-10. Click Finish to complete the wizard.
-11. In the Services window, the new remote host is shown under the C/C++ Build Hosts node. Expand the node for the new host and you should have one or more tool collections in the Tool Collections list.
+
+[start=10]
+. Click Finish to complete the wizard.
+
+[start=11]
+. In the Services window, the new remote host is shown under the C/C++ Build Hosts node. Expand the node for the new host and you should have one or more tool collections in the Tool Collections list.
image::images/remotedev-remote-toolchain.png[]
@@ -269,15 +266,25 @@
If you want to use shared source files, make sure that the Project Location you specify is a path shared with the remote server.
-3. Select the new remote host for the Build Host. The Tool Collection list is updated to show the available tools on the remote host.
+
+[start=3]
+. Select the new remote host for the Build Host. The Tool Collection list is updated to show the available tools on the remote host.
image::images/remotedev-new-project.png[]
-4. Click Finish to create the project.
+
+[start=4]
+. Click Finish to create the project.
The Welcome_1 project opens in the Projects window.
-5. Place your mouse cursor over the name of the project in the Projects window to see that a tooltip shows the project location and the remote host that it is configured to build on.
-6. Click the Build button on the toolbar or right-click the Welcome_1 project node and choose Build. The sample project will be built remotely on the selected build host.
-7. Open the source file ``welcome.cc`` .
+
+[start=5]
+. Place your mouse cursor over the name of the project in the Projects window to see that a tooltip shows the project location and the remote host that it is configured to build on.
+
+[start=6]
+. Click the Build button on the toolbar or right-click the Welcome_1 project node and choose Build. The sample project will be built remotely on the selected build host.
+
+[start=7]
+. Open the source file ``welcome.cc`` .
In the following screenshot you can see that code assistance is working when you press Ctrl-Space with the cursor on the ``argc`` symbol to see.
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ja.asciidoc
index e4b77cf..66c8c41 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ja.asciidoc
@@ -33,28 +33,6 @@
このドキュメントでは、C/C++/FortranプロジェクトにおけるNetBeans IDEのリモート開発機能の使用方法を示します。
-
-=== 内容
-
-image::images/netbeans-stamp-80-74-73.png[title="このページの内容は、NetBeans IDE 7.3、7.4および8.0に適用されます"]
-
-|===
-|- |<<intro,概要>>
-
-|- |<<concepts,リモート開発の概念>>
-
-|- |<<system,システムの設定>>
-
-|- |<<setup,IDEの設定>>
-
-|- |<<workflow,リモート・ホストでのローカル・プロジェクトのビルド>>
-
-|- |<<terminal,リモート・ホストでのターミナル・セッションの開始>>
-
-|- |<<tips,リモート開発のヒント>>
-|===
-
-
== 要件
*このチュートリアルに従うには、次のソフトウェアが必要です。*
@@ -172,7 +150,7 @@
SMB/CIFS (Windows)サーバーおよび共有フォルダに接続するには、次のいずれかの形式でサーバー・アドレスを入力します。
-[quote]
+[source,bash]
----
`smb://_DNSname/sharename_
smb://_IPaddress/sharename_`
@@ -182,7 +160,7 @@
NFSサーバーに接続するには、次のいずれかの形式でサーバー名およびNFS共有フォルダのパスを入力します。
-[quote]
+[source,bash]
----
`nfs://_servername/path/to/share/_
nfs://_IPaddress/path/to/share_`
@@ -223,26 +201,44 @@
1. 「ウィンドウ」>「サービス」と選択して、「サービス」ウィンドウを開きます。
2. 「C/C++ビルド・ホスト」ノードを右クリックして、「新規ホストの追加」を選択します。
image::images/remotedev-add-host.png[]「新規リモート・ホストのセットアップ」ダイアログ・ボックスで、IDEがローカル・ネットワークのホストを検出します。ホスト名はこのダイアログ・ボックスの表に追加され、緑色のインジケータはSSHサーバーを実行しているかどうかを示します。
-3. 使用するサーバー名をダブルクリックするか、「ホスト名」フィールドにサーバー名を直接入力します。「次」をクリックします。
+
+[start=3]
+. 使用するサーバー名をダブルクリックするか、「ホスト名」フィールドにサーバー名を直接入力します。「次」をクリックします。
image::images/remotedev-setup-host.png[]
-4. 「ホストのセットアップ」画面に、リモート・ホストへのログインに使用するユーザー名を入力し、認証方法を選択します。このチュートリアルでは、「パスワード」を選択して「次」をクリックします。image::images/remotedev-setup-host-auth.png[]
+
+[start=4]
+. 「ホストのセットアップ」画面に、リモート・ホストへのログインに使用するユーザー名を入力し、認証方法を選択します。このチュートリアルでは、「パスワード」を選択して「次」をクリックします。image::images/remotedev-setup-host-auth.png[]
SSHキーを使用する場合は、まずIDEの外部で設定されている必要があります。そうするとIDEでSSHキーの場所を指定できるようになり、IDEがそのキーを使用してリモート・ビルド・ホストへのSSH接続を行えるようになります。
-5. サーバーに接続されたら、「認証」ダイアログ・ボックスにパスワードを入力します。
-6. オプションで「パスワードの記憶」をクリックすると、IDEによってパスワードが暗号化されてローカル・ディスクに保存され、IDEがリモート・ホストに接続するたびにパスワードを入力する必要がなくなります。
+
+[start=5]
+. サーバーに接続されたら、「認証」ダイアログ・ボックスにパスワードを入力します。
+
+[start=6]
+. オプションで「パスワードの記憶」をクリックすると、IDEによってパスワードが暗号化されてローカル・ディスクに保存され、IDEがリモート・ホストに接続するたびにパスワードを入力する必要がなくなります。
IDEによってリモート・ホストが構成され、リモート・ホスト上のツール・コレクションが検索されます。
-7. ホストが正常に構成された場合、サマリー・ページに、プラットフォーム、ホスト名、ログインに使用されるユーザー名、および見つかったツール・コレクションなどのリモート・ホストに関する情報が示されます。
+
+[start=7]
+. ホストが正常に構成された場合、サマリー・ページに、プラットフォーム、ホスト名、ログインに使用されるユーザー名、および見つかったツール・コレクションなどのリモート・ホストに関する情報が示されます。
image::images/remotedev-setup-host-summary.png[]
-8. サマリー・ページの最下部に、2つのオプションが表示されます。複数のツール・コレクションが見つかった場合、それらのコレクションのうちの1つを「デフォルト・ツール・コレクション」として選択できます。
-9. 次のオプションによるプロジェクト・ファイルへのアクセスの場合:
+
+[start=8]
+. サマリー・ページの最下部に、2つのオプションが表示されます。複数のツール・コレクションが見つかった場合、それらのコレクションのうちの1つを「デフォルト・ツール・コレクション」として選択できます。
+
+[start=9]
+. 次のオプションによるプロジェクト・ファイルへのアクセスの場合:
* クライアント・システムとリモート・ビルド・ホストにプロジェクト・ファイルへの共有アクセスがない場合は、「自動コピー」を選択します。「自動コピー」を選択した場合、プロジェクト・ファイルは、sftpコマンドを使用して、サーバー上の自分のホーム・ディレクトリにコピーされます。これは、単純リモート開発と呼ばれます。
* クライアントとサーバーに、同一のフォルダへのアクセス権がある場合、システム・レベル・ファイル共有を選択します。これは、共有または混合リモート開発と呼ばれます。
* Secure File Transfer Protocolを使用してプロジェクト・ファイルをリモート・ホストにコピーするには、SFTP (NetBeans 7.4および8.0のみ)を選択します。自動コピーと同じです。
-10. 「終了」をクリックしてウィザードを完了します。
-11. 「サービス」ウィンドウで、「C/C++ビルド・ホスト」ノードの下に新しいリモート・ホストが表示されています。新しいホストのノードを展開すると、「ツール・コレクション」の一覧に1つまたは複数のツール・コレクションが表示されます。
+
+[start=10]
+. 「終了」をクリックしてウィザードを完了します。
+
+[start=11]
+. 「サービス」ウィンドウで、「C/C++ビルド・ホスト」ノードの下に新しいリモート・ホストが表示されています。新しいホストのノードを展開すると、「ツール・コレクション」の一覧に1つまたは複数のツール・コレクションが表示されます。
image::images/remotedev-remote-toolchain.png[]
@@ -268,15 +264,25 @@
共有ソース・ファイルを使用する場合、「プロジェクトの場所」として、リモート・サーバーで共有されているパスを指定していることを確認してください。
-3. 「ビルド・ホスト」に、新しいリモート・ホストを選択します。「ツール・コレクション」の一覧が更新され、リモート・ホストで使用できるツールが表示されます。
+
+[start=3]
+. 「ビルド・ホスト」に、新しいリモート・ホストを選択します。「ツール・コレクション」の一覧が更新され、リモート・ホストで使用できるツールが表示されます。
image::images/remotedev-new-project.png[]
-4. 「終了」をクリックしてプロジェクトを作成します。
+
+[start=4]
+. 「終了」をクリックしてプロジェクトを作成します。
「プロジェクト」ウィンドウでWelcome_1プロジェクトが開かれます。
-5. 「プロジェクト」ウィンドウでプロジェクト名の上にカーソルを置くと、プロジェクトの場所と、プロジェクトがビルドされるように構成されたリモート・ホストがツールチップに表示されます。
-6. ツールバーで「ビルド」ボタンをクリックするかWelcome_1プロジェクト・ノードを右クリックして、「ビルド」を選択します。サンプル・プロジェクトが、選択したビルド・ホストでリモートでビルドされます。
-7. ソース・ファイルの ``welcome.cc`` を開きます。
+
+[start=5]
+. 「プロジェクト」ウィンドウでプロジェクト名の上にカーソルを置くと、プロジェクトの場所と、プロジェクトがビルドされるように構成されたリモート・ホストがツールチップに表示されます。
+
+[start=6]
+. ツールバーで「ビルド」ボタンをクリックするかWelcome_1プロジェクト・ノードを右クリックして、「ビルド」を選択します。サンプル・プロジェクトが、選択したビルド・ホストでリモートでビルドされます。
+
+[start=7]
+. ソース・ファイルの ``welcome.cc`` を開きます。
次のスクリーンショットでは、表示する ``argc`` シンボルの上にカーソルを置いて[Ctrl]+[Space]キーを押したときに、コード支援サポートが機能することを確認できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_pt_BR.asciidoc
index c0b9dd0..f6a5213 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_pt_BR.asciidoc
@@ -34,26 +34,6 @@
Este documento descreve como usar os recursos de desenvolvimento remoto do NetBeans IDE com projetos C/C++/Fortran.
-
-image::images/netbeans-stamp-80-74-73.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.3, 7.4 e 8.0"]
-
-|===
-|- |<<intro,Introdução>>
-
-|- |<<concepts,Conceitos de Desenvolvimento Remoto>>
-
-|- |<<system,Configurando o Sistema>>
-
-|- |<<setup,Configurando o IDE>>
-
-|- |<<workflow,Construindo um Projeto Local em um Host Remoto>>
-
-|- |<<terminal,Iniciando uma Sessão do Terminal no Host Remoto>>
-
-|- |<<tips,Dicas de Desenvolvimento Remoto>>
-|===
-
-
== Requisitos
*Para seguir este tutorial, você precisa do software a seguir.*
@@ -172,7 +152,7 @@
Para conectar aos servidores SMB/CIFS (Windows) e às pastas compartilhadas, insira o endereço do servidor em um destes forms:
-[quote]
+[source,bash]
----
`smb://_DNSname/sharename_
smb://_IPaddress/sharename_`
@@ -182,7 +162,7 @@
Para conectar ao servidor NFS, digite o nome e o caminho do servidor para as pastas compartilhadas do NFS em um destes forms:
-[quote]
+[source,bash]
----
`nfs://_servername/path/to/share/_
nfs://_IPaddress/path/to/share_`
@@ -223,26 +203,44 @@
1. Abra a janela Serviços selecionando Janela > Serviços.
2. Clique com o botão direito no nó Hosts de Compilação C/C++ e selecione Adicionar Novo Host.
image::images/remotedev-add-host.png[]Na caixa de diálogo Nova Configuração de Host Remoto, o IDE descobre seus hosts de rede local. Os nomes de host são adicionados a uma tabela na caixa de diálogo e um indicador verde informa se estiverem em execução no servidor SSH.
-3. Clique duas vezes no nome do servidor desejado, ou digite o nome do servidor diretamente no campo Nome do host. Clique em Próximo.
+
+[start=3]
+. Clique duas vezes no nome do servidor desejado, ou digite o nome do servidor diretamente no campo Nome do host. Clique em Próximo.
image::images/remotedev-setup-host.png[]
-4. Na tela Configurar Host, digite o nome do usuário que você utiliza para efetuar o log-in no host remoto, e selecione um método de autenticação. Para este tutorial, selecione Senha e clique em Próximo.image::images/remotedev-setup-host-auth.png[]
+
+[start=4]
+. Na tela Configurar Host, digite o nome do usuário que você utiliza para efetuar o log-in no host remoto, e selecione um método de autenticação. Para este tutorial, selecione Senha e clique em Próximo.image::images/remotedev-setup-host-auth.png[]
Caso deseje utilizar as teclas ssh, será necessário configurá-las primeiro fora do IDE. Então, será possível especificar a localização para as teclas ssh no IDE, e utilizar as teclas para fazer a conexão ssh ao host de compilação remoto.
-5. Após ter sido feita a conexão ao servidor, insira a senha na caixa de diálogo Autenticação.
-6. Outra opção é clicar em Lembrar Senha para que o IDE seja criptografado e salve a senha no disco local, de forma que não seja necessário inseri-la cada vez que o IDE se conectar a um host remoto.
+
+[start=5]
+. Após ter sido feita a conexão ao servidor, insira a senha na caixa de diálogo Autenticação.
+
+[start=6]
+. Outra opção é clicar em Lembrar Senha para que o IDE seja criptografado e salve a senha no disco local, de forma que não seja necessário inseri-la cada vez que o IDE se conectar a um host remoto.
O IDE configura o host remoto e procura por coleções de ferramentas no host remoto.
-7. Quando o host é configurado com êxito, uma página de resumo exibe informações sobre o host remoto: a plataforma, o nome da máquina, o nome de usuário utilizado para log-in e as coleções de ferramentas encontradas.
+
+[start=7]
+. Quando o host é configurado com êxito, uma página de resumo exibe informações sobre o host remoto: a plataforma, o nome da máquina, o nome de usuário utilizado para log-in e as coleções de ferramentas encontradas.
image::images/remotedev-setup-host-summary.png[]
-8. Na parte inferior da página de resumo são exibidas duas opções adicionais. Caso sejam encontradas mais de uma coleção de ferramentas, é possível selecionar uma das coleções para ser a Coleção de Ferramentas Default.
-9. Para os arquivos do projeto de Acesso por meio da opção:
+
+[start=8]
+. Na parte inferior da página de resumo são exibidas duas opções adicionais. Caso sejam encontradas mais de uma coleção de ferramentas, é possível selecionar uma das coleções para ser a Coleção de Ferramentas Default.
+
+[start=9]
+. Para os arquivos do projeto de Acesso por meio da opção:
* Selecione Cópia Automática se seu sistema de cliente e o host de compilação remota não tiverem acesso compartilhado aos arquivos do projeto. Quando você selecionar a opção Cópia Automática, os arquivos do projeto serão copiados no diretório home do servidor usando o comando sftp. Isso é conhecido como o desenvolvimento remoto simples.
* Selecione compartilhamento do arquivo em nível de sistema se o cliente e o servidor tiverem acesso à mesma pasta. Isso é conhecido como desenvolvimento remoto compartilhado ou misto.
* Selecione SFTP (somente no NetBeans 7.4 e 8.0) para usar o protocolo de transferência segura de arquivo a fim de copiar os arquivos do projeto no host remoto. Semelhante à Cópia Automática.
-10. Clique em Finalizar para concluir o assistente.
-11. Na janela Serviços, o novo host remoto é exibido sob o nó Hosts de Compilação C/C++. Expanda o nó para o novo host e deverá obter uma ou mais coleções de ferramentas na lista Coleções de Ferramentas.
+
+[start=10]
+. Clique em Finalizar para concluir o assistente.
+
+[start=11]
+. Na janela Serviços, o novo host remoto é exibido sob o nó Hosts de Compilação C/C++. Expanda o nó para o novo host e deverá obter uma ou mais coleções de ferramentas na lista Coleções de Ferramentas.
image::images/remotedev-remote-toolchain.png[]
@@ -268,15 +266,25 @@
Caso queira utilizar os arquivos de origem compartilhados, certifique-se de que a Localização do Projeto especificada seja um caminho compartilhado com o servidor remoto.
-3. Selecione o novo host remoto para o Host de Compilação. A lista Coleção de Ferramentas é atualizada para mostrar as ferramentas disponíveis no host remoto.
+
+[start=3]
+. Selecione o novo host remoto para o Host de Compilação. A lista Coleção de Ferramentas é atualizada para mostrar as ferramentas disponíveis no host remoto.
image::images/remotedev-new-project.png[]
-4. Clique em Finalizar para criar o projeto.
+
+[start=4]
+. Clique em Finalizar para criar o projeto.
O projeto Welcome_1 é aberto na janela Projetos.
-5. Coloque o cursor do mouse no nome do projeto na janela Projetos para ver se uma dica de ferramenta exibe a localização do projeto e o host remoto que está configurado para construção.
-6. Clique no botão Construir na barra de ferramentas ou clique com o botão direito do mouse no nó do projeto Welcome_1 e escolha Construir. O projeto de amostra será construído remotamente no host do host de compilação selecionado.
-7. Abra o arquivo do código-fonte ``welcome.cc`` .
+
+[start=5]
+. Coloque o cursor do mouse no nome do projeto na janela Projetos para ver se uma dica de ferramenta exibe a localização do projeto e o host remoto que está configurado para construção.
+
+[start=6]
+. Clique no botão Construir na barra de ferramentas ou clique com o botão direito do mouse no nó do projeto Welcome_1 e escolha Construir. O projeto de amostra será construído remotamente no host do host de compilação selecionado.
+
+[start=7]
+. Abra o arquivo do código-fonte ``welcome.cc`` .
Na tela a seguir você pode ver se a assistência ao código está funcionando quando você pressionar Ctrl-Espaço com o cursor no símbolo ``argc`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ru.asciidoc
index 42cfc16..266b82b 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_ru.asciidoc
@@ -35,25 +35,6 @@
-image::images/netbeans-stamp-80-74-73.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.3, 7.4 и 8.0"]
-
-|===
-|- |<<intro,Введение>>
-
-|- |<<concepts,Ключевые понятия удаленной разработки>>
-
-|- |<<system,Настройка системы>>
-
-|- |<<setup,Настройка среды IDE>>
-
-|- |<<workflow,Создание локального проекта на удаленном узле>>
-
-|- |<<terminal,Запуск сеанса работы с терминалом на удаленном узле>>
-
-|- |<<tips,Рекомендации по удаленной разработке>>
-|===
-
-
== Требования
*Для работы с этим учебным курсом требуется программное обеспечение, указанное ниже.*
@@ -172,7 +153,7 @@
Для подключения к серверам SMB/CIFS (Windows) и папкам совместного доступа введите адрес сервера в одной из следующих форм:
-[quote]
+[source,bash]
----
`smb://_DNSname/sharename_
smb://_IPaddress/sharename_`
@@ -182,7 +163,7 @@
Для подключения к серверу NFS введите имя сервера и путь к папке совместного доступа NFS в одной из следующих форм:
-[quote]
+[source,bash]
----
`nfs://_servername/path/to/share/_
nfs://_IPaddress/path/to/share_`
@@ -223,26 +204,44 @@
1. Откройте окно "Службы", выбрав меню "Окно" > "Службы".
2. Щелкните правой кнопкой мыши узел 'Узлы сборки C/C++' и выберите 'Добавить новый узел'.
image::images/remotedev-add-host.png[]В диалоговом окне 'Настройка нового удаленного узла' среда IDE обнаруживает узлы локальной сети. Имена узлов добавляются в таблицу в диалоговом окне. Зеленый индикатор указывает на то, что на этих узлах запущен сервер SSH.
-3. Дважды щелкните имя требуемого сервера или введите его имя непосредственно в поле "Имя сервера". Нажмите кнопку "Далее".
+
+[start=3]
+. Дважды щелкните имя требуемого сервера или введите его имя непосредственно в поле "Имя сервера". Нажмите кнопку "Далее".
image::images/remotedev-setup-host.png[]
-4. Введите в окне "Настройка узла" имя пользователя и пароль, используемые для входа на удаленный узел, и выберите метод проверки подлинности. При работе с данным учебным курсом выберите "Пароль" и нажмите кнопку "Далее".image::images/remotedev-setup-host-auth.png[]
+
+[start=4]
+. Введите в окне "Настройка узла" имя пользователя и пароль, используемые для входа на удаленный узел, и выберите метод проверки подлинности. При работе с данным учебным курсом выберите "Пароль" и нажмите кнопку "Далее".image::images/remotedev-setup-host-auth.png[]
Для использования ключей ssh сначала необходимо настроить их вне среды IDE. Затем можно указать местоположение ключей ssh в среде IDE, и IDE сможет использовать эти ключи для установки подключения к удаленному узлу сборки по протоколу ssh.
-5. После установки подключения к серверу введите пароль в диалоговом окне "Проверка подлинности".
-6. Дополнительно можно щелкнуть "Запомнить пароль" для выполнения в среде IDE шифрования и сохранения пароля на локальном диске, чтобы ввод пароля не требовался при каждом подключении среды IDE к удаленному узлу.
+
+[start=5]
+. После установки подключения к серверу введите пароль в диалоговом окне "Проверка подлинности".
+
+[start=6]
+. Дополнительно можно щелкнуть "Запомнить пароль" для выполнения в среде IDE шифрования и сохранения пароля на локальном диске, чтобы ввод пароля не требовался при каждом подключении среды IDE к удаленному узлу.
Среда IDE настраивает удаленный узел и выполняет поиск наборов средств удаленного узла.
-7. После успешной настройки узла на странице общих сведений выводится информация об удаленном узле: платформа, имя узла, имя пользователя для входа, а также найденные наборы средств.
+
+[start=7]
+. После успешной настройки узла на странице общих сведений выводится информация об удаленном узле: платформа, имя узла, имя пользователя для входа, а также найденные наборы средств.
image::images/remotedev-setup-host-summary.png[]
-8. В нижней части страницы общих сведений отображаются еще два параметра. Если найдено несколько наборов средств, выберите один из них для определения его как набора средств по умолчанию.
-9. Настройка параметров доступа к файлам проекта:
+
+[start=8]
+. В нижней части страницы общих сведений отображаются еще два параметра. Если найдено несколько наборов средств, выберите один из них для определения его как набора средств по умолчанию.
+
+[start=9]
+. Настройка параметров доступа к файлам проекта:
* Если для клиента и удаленного узла сборки не настроен общий доступ к файлам проекта, выберите параметр 'Автоматическое копирование'. Если выбран параметр 'Автоматическое копирование', файлы проекта будут копироваться в домашний каталог на сервере с помощью команды sftp. Этот режим называется простой удаленной разработкой.
* Если для клиента и сервера настроена общая папка, выберите параметр 'Совместное использование файлов на уровне системы'. Этот режим называется совместной или комбинированной удаленной разработкой.
* Выберите SFTP (только в NetBeans 7.4 и 8.0) для использования безопасного протокола передачи файлов при копировании файлов проекта на удаленный узел. Аналогично функции 'Автоматическое копирование'.
-10. Для выхода из мастера нажмите кнопку "Готово".
-11. В окне 'Службы' новый удаленный узел отображается в структуре узла 'Узлы сборки C/C++'. Разверните новый узел: список "Наборы средств" должен содержать один или несколько наборов средств.
+
+[start=10]
+. Для выхода из мастера нажмите кнопку "Готово".
+
+[start=11]
+. В окне 'Службы' новый удаленный узел отображается в структуре узла 'Узлы сборки C/C++'. Разверните новый узел: список "Наборы средств" должен содержать один или несколько наборов средств.
image::images/remotedev-remote-toolchain.png[]
@@ -268,15 +267,25 @@
Если вы хотите использовать общие исходные файлы, убедитесь, что в поле 'Местоположение проекта' указан путь к папке, доступной для удаленного сервера.
-3. В списке 'Узел сборки' выберите новый удаленный узел. Список наборов средств будет обновлен для отображения доступных средств удаленного узла.
+
+[start=3]
+. В списке 'Узел сборки' выберите новый удаленный узел. Список наборов средств будет обновлен для отображения доступных средств удаленного узла.
image::images/remotedev-new-project.png[]
-4. Для создания проекта нажмите кнопку "Готово".
+
+[start=4]
+. Для создания проекта нажмите кнопку "Готово".
Проект Welcome_1 открывается в окне 'Проекты'.
-5. Наведите указатель мыши на имя проекта в окне 'Проекты'. Отобразится всплывающая подсказка с информацией о расположении проекта и удаленном узле сборки, выбранном для этого проекта.
-6. Нажмите кнопку 'Собрать' на панели инструментов или щелкните узел проекта Welcome_1 правой кнопкой мыши и выберите 'Собрать'. Тестовый проект будет собран удаленно на выбранном узле сборки.
-7. Откройте исходный файл ``welcome.cc`` .
+
+[start=5]
+. Наведите указатель мыши на имя проекта в окне 'Проекты'. Отобразится всплывающая подсказка с информацией о расположении проекта и удаленном узле сборки, выбранном для этого проекта.
+
+[start=6]
+. Нажмите кнопку 'Собрать' на панели инструментов или щелкните узел проекта Welcome_1 правой кнопкой мыши и выберите 'Собрать'. Тестовый проект будет собран удаленно на выбранном узле сборки.
+
+[start=7]
+. Откройте исходный файл ``welcome.cc`` .
На иллюстрации показано, как работают функции 'Помощь при работе с кодом' при нажатии сочетания клавиш Ctrl-Space и установленном фокусе на символе ``argc`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_zh_CN.asciidoc
index 0246d7a..ab2778f 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/remotedev-tutorial_zh_CN.asciidoc
@@ -34,26 +34,6 @@
本文档介绍如何将 NetBeans IDE 的远程开发功能用于 C/C++/Fortran 项目。
-
-image::images/netbeans-stamp-80-74-73.png[title="此页上的内容适用于 NetBeans IDE 7.3、7.4 和 8.0"]
-
-|===
-|- |<<intro,简介>>
-
-|- |<<concepts,远程开发概念>>
-
-|- |<<system,设置系统>>
-
-|- |<<setup,设置 IDE>>
-
-|- |<<workflow,在远程主机上构建本地项目>>
-
-|- |<<terminal,在远程主机上启动终端会话>>
-
-|- |<<tips,远程开发提示>>
-|===
-
-
== 要求
*要学习本教程,您需要具备以下软件。*
@@ -172,7 +152,7 @@
要连接到 SMB/CIFS (Windows) 服务器和共享文件夹,请采用以下一种形式输入服务器地址:
-[quote]
+[source,bash]
----
`smb://_DNSname/sharename_
smb://_IPaddress/sharename_`
@@ -182,7 +162,7 @@
要连接到 NFS 服务器,请采用以下一种形式键入服务器名称和 NFS 共享文件夹的路径:
-[quote]
+[source,bash]
----
`nfs://_servername/path/to/share/_
nfs://_IPaddress/path/to/share_`
@@ -223,26 +203,44 @@
1. 选择 "Window"(窗口)> "Services"(服务)以打开 "Services"(服务)窗口。
2. 右键单击 "C/C++ Build Hosts"(C/C++ 构建主机)节点,然后选择 "Add New Host"(添加新主机)。
image::images/remotedev-add-host.png[]在 "New Remote Host Setup"(新建远程主机设置)对话框中,IDE 将会发现本地网络上的主机。主机名将添加到该对话框的表中,并且显示一个绿色指示符,指示这些主机是否正在运行 SSH 服务器。
-3. 双击所需服务器的名称,或者直接在 "Hostname"(主机名)字段中键入服务器名称。单击 "Next"(下一步)。
+
+[start=3]
+. 双击所需服务器的名称,或者直接在 "Hostname"(主机名)字段中键入服务器名称。单击 "Next"(下一步)。
image::images/remotedev-setup-host.png[]
-4. 在 "Setup Host"(设置主机)屏幕上,键入要用来登录到远程主机的用户名,然后选择验证方法。对于此教程,请选择 "Password"(口令),然后单击 "Next"(下一步)。image::images/remotedev-setup-host-auth.png[]
+
+[start=4]
+. 在 "Setup Host"(设置主机)屏幕上,键入要用来登录到远程主机的用户名,然后选择验证方法。对于此教程,请选择 "Password"(口令),然后单击 "Next"(下一步)。image::images/remotedev-setup-host-auth.png[]
如果要使用 ssh 密钥,必须首先在 IDE 外部设置它们。然后,您可以在 IDE 中指定 ssh 密钥的位置,这样,IDE 便可以使用这些密钥与远程构建主机建立 ssh 连接。
-5. 连接到服务器后,在 "Authentication"(验证)对话框中输入口令。
-6. (可选)单击 "Remember Password"(记住口令)以使 IDE 对口令加密并将其存储在本地磁盘上,这样,您便不必在 IDE 每次连接到远程主机时都输入口令。
+
+[start=5]
+. 连接到服务器后,在 "Authentication"(验证)对话框中输入口令。
+
+[start=6]
+. (可选)单击 "Remember Password"(记住口令)以使 IDE 对口令加密并将其存储在本地磁盘上,这样,您便不必在 IDE 每次连接到远程主机时都输入口令。
IDE 将配置远程主机,并在远程主机上查找工具集合。
-7. 在成功配置主机后,"Summary"(概要)页将显示有关远程主机的信息:平台、主机名、用于登录的用户名以及找到的工具集合。
+
+[start=7]
+. 在成功配置主机后,"Summary"(概要)页将显示有关远程主机的信息:平台、主机名、用于登录的用户名以及找到的工具集合。
image::images/remotedev-setup-host-summary.png[]
-8. 在 "Summary"(概要)页底部,将显示另外两个选项。如果找到多个工具集合,则可以选择其中一个集合作为默认工具集合。
-9. 对于项目文件访问方式选项:
+
+[start=8]
+. 在 "Summary"(概要)页底部,将显示另外两个选项。如果找到多个工具集合,则可以选择其中一个集合作为默认工具集合。
+
+[start=9]
+. 对于项目文件访问方式选项:
* 如果客户端系统和远程构建主机不具有对项目文件的共享访问权限,则选择 "Automatic Copying"(自动复制)。在选择 "Automatic Copying"(自动复制)时,将使用 sftp 命令将项目文件复制到服务器上的主目录。这称为简单远程开发。
* 如果客户端和服务器具有对相同文件夹的访问权限,则选择 "System level file sharing"(系统级别文件共享)。这称为共享或混合远程开发。
* 选择 "SFTP"(仅在 NetBeans 7.4 和 8.0 上)可使用安全文件传输协议将项目文件复制到远程主机。类似于自动复制。
-10. 单击 "Finish"(完成)以完成向导。
-11. 在 "Services"(服务)窗口中的 "C/C++ Build Hosts"(C/C++ 构建主机)节点下,将显示新的远程主机。展开新主机的节点,"Tool Collection"(工具集合)列表中应该有一个或多个工具集合。
+
+[start=10]
+. 单击 "Finish"(完成)以完成向导。
+
+[start=11]
+. 在 "Services"(服务)窗口中的 "C/C++ Build Hosts"(C/C++ 构建主机)节点下,将显示新的远程主机。展开新主机的节点,"Tool Collection"(工具集合)列表中应该有一个或多个工具集合。
image::images/remotedev-remote-toolchain.png[]
@@ -268,15 +266,25 @@
如果要使用共享源文件,请确保指定的项目位置是与远程服务器共享的路径。
-3. 在 "Build Host"(构建主机)中选择新的远程主机。将会更新 "Tool Collection"(工具集合)列表,以显示远程主机上的可用工具。
+
+[start=3]
+. 在 "Build Host"(构建主机)中选择新的远程主机。将会更新 "Tool Collection"(工具集合)列表,以显示远程主机上的可用工具。
image::images/remotedev-new-project.png[]
-4. 单击 "Finish"(完成)以创建项目。
+
+[start=4]
+. 单击 "Finish"(完成)以创建项目。
Welcome_1 项目在 "Projects"(项目)窗口中打开。
-5. 将鼠标光标放在 "Projects"(项目)窗口中的项目名称之上会看到一个工具提示,显示项目位置以及配置为要在其上构建此项目的远程主机。
-6. 单击工具栏上的 "Build"(构建)按钮,或者右键单击 "Welcome_1" 项目节点并选择 "Build"(构建)。将在所选构建主机上远程构建该样例项目。
-7. 打开源文件 ``welcome.cc`` 。
+
+[start=5]
+. 将鼠标光标放在 "Projects"(项目)窗口中的项目名称之上会看到一个工具提示,显示项目位置以及配置为要在其上构建此项目的远程主机。
+
+[start=6]
+. 单击工具栏上的 "Build"(构建)按钮,或者右键单击 "Welcome_1" 项目节点并选择 "Build"(构建)。将在所选构建主机上远程构建该样例项目。
+
+[start=7]
+. 打开源文件 ``welcome.cc`` 。
在下面的屏幕快照中,将光标置于 ``argc`` 符号上,同时按 Ctrl-空格键时,您会看到代码帮助正常使用。
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain.asciidoc
index b39e46c..606bcf3 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain.asciidoc
@@ -95,7 +95,9 @@
-J-Dcnd.toolchain.personality.create_shadow=true
----
-4. Start the IDE, choose Tools > Options, and select C/C++ in the top pane of the Options window.
+
+[start=4]
+. Start the IDE, choose Tools > Options, and select C/C++ in the top pane of the Options window.
The IDE creates a directory containing "shadow" versions of the tool collection descriptors in your NetBeans user directory:
@@ -144,8 +146,12 @@
The descriptors in this directory take precedence over the official versions in the _IDE-HOME_ directory. You should delete the tool descriptors in your user directory that you do not want the IDE to use.
-5. Remove the ``-J-Dcnd.toolchain.personality.create_shadow=true`` flag from the ``_IDE-HOME_/etc/netbeans.conf`` so the IDE does not create shadow descriptors again.
-6. Restart the IDE to use the modified tool descriptor when you are finished making changes.
+
+[start=5]
+. Remove the ``-J-Dcnd.toolchain.personality.create_shadow=true`` flag from the ``_IDE-HOME_/etc/netbeans.conf`` so the IDE does not create shadow descriptors again.
+
+[start=6]
+. Restart the IDE to use the modified tool descriptor when you are finished making changes.
== Creating a Custom Tool Collection
@@ -160,16 +166,32 @@
1. Make sure your NetBeans installation includes the NetBeans Plugin Development module.
Choose Tools > Plugins and click the Installed tab. If the NetBeans Plugin Development module is not installed, click the Available Plugins tab and install the module. You can find it quickly by typing "plugin" in the Search box.
-2. Create a new NetBeans module by choosing File > New Project. On the Choose Project page of the New Project wizard, select the category NetBeans Modules and the project Module in the first step of the wizard. Click Next.
-3. On the Name and Location page, type the project name, for example ``mytoolchain`` and leave all other fields as is. Click Next.
-4. On the Basic Module Configuration page, type ``org.myhome.mytoolchain`` for Code Name Base, which defines the unique string identifying the module you are creating. The code name base is also used as the main package of the module.
-5. Do not select the "Generate OSGi Bundle" checkbox, since you will be using the default NetBeans module system, rather than OSGi.
-6. Click Finish. The IDE creates a new project named mytoolchain.
-7. In the Projects tab, right click the mytoolchain project node and select New > Other.
-8. In the New File wizard, select the category Module Development and the file type XML Layer, then click Next and click Finish.
+
+[start=2]
+. Create a new NetBeans module by choosing File > New Project. On the Choose Project page of the New Project wizard, select the category NetBeans Modules and the project Module in the first step of the wizard. Click Next.
+
+[start=3]
+. On the Name and Location page, type the project name, for example ``mytoolchain`` and leave all other fields as is. Click Next.
+
+[start=4]
+. On the Basic Module Configuration page, type ``org.myhome.mytoolchain`` for Code Name Base, which defines the unique string identifying the module you are creating. The code name base is also used as the main package of the module.
+
+[start=5]
+. Do not select the "Generate OSGi Bundle" checkbox, since you will be using the default NetBeans module system, rather than OSGi.
+
+[start=6]
+. Click Finish. The IDE creates a new project named mytoolchain.
+
+[start=7]
+. In the Projects tab, right click the mytoolchain project node and select New > Other.
+
+[start=8]
+. In the New File wizard, select the category Module Development and the file type XML Layer, then click Next and click Finish.
The IDE creates ``layer.xml`` under the Source Packages node, inside the main package ``org.myhome.mytoolchain`` and opens ``layer.xml`` in the editor.
-9. If the file contains a ``<filesystem/>`` tag, replace it with opening and closing ``filesystem`` tags: ``<filesystem>``
+
+[start=9]
+. If the file contains a ``<filesystem/>`` tag, replace it with opening and closing ``filesystem`` tags: ``<filesystem>``
[source,xml]
----
@@ -177,7 +199,9 @@
``</filesystem>``
----
-10. Copy and paste the following text in ``layer.xml`` inside the ``filesystem`` tag:
+
+[start=10]
+. Copy and paste the following text in ``layer.xml`` inside the ``filesystem`` tag:
[source,xml]
----
@@ -233,16 +257,24 @@
</folder>
----
-11. Open the ``Bundle.properties`` file and add the following string:
+
+[start=11]
+. Open the ``Bundle.properties`` file and add the following string:
``CND/ToolChains/GNU_tuned=My GNU Tuned Tool Collection``
-12. Create the subpackage ``toolchain`` by right-clicking the ``org.myhome.mytoolchain`` package under Source Packages and selecting New > Java Package. Replace the default package name ``newpackage`` with ``toolchain`` and click Finish. The IDE creates the subpackage ``org.myhome.mytoolchain.toolchain`` .
-13. Create a new file by right-clicking the ``org.myhome.mytoolchain.toolchain`` subpackage and selecting New > Empty File. Name the file ``GNU_tuned_flavor.xml`` and click Finish.
+
+[start=12]
+. Create the subpackage ``toolchain`` by right-clicking the ``org.myhome.mytoolchain`` package under Source Packages and selecting New > Java Package. Replace the default package name ``newpackage`` with ``toolchain`` and click Finish. The IDE creates the subpackage ``org.myhome.mytoolchain.toolchain`` .
+
+[start=13]
+. Create a new file by right-clicking the ``org.myhome.mytoolchain.toolchain`` subpackage and selecting New > Empty File. Name the file ``GNU_tuned_flavor.xml`` and click Finish.
If you do not see Empty File as an option, select Other and then in the New File wizard, select the category Other and the file type Empty File and click Next.
This file is the tool collection descriptor for the new tool collection.
-14. Copy and paste the following text in ``GNU_tuned_flavor.xml`` :
+
+[start=14]
+. Copy and paste the following text in ``GNU_tuned_flavor.xml`` :
[source,xml]
----
@@ -254,8 +286,12 @@
</toolchaindefinition>
----
-15. Create another new file by right-clicking the ``org.myhome.mytoolchain.toolchain`` subpackage and selecting New > Empty File. Name the file ``GNU_tuned_cpp.xml`` and click Next.
-16. Copy and paste the following text in ``GNU_tuned_cpp.xml`` :
+
+[start=15]
+. Create another new file by right-clicking the ``org.myhome.mytoolchain.toolchain`` subpackage and selecting New > Empty File. Name the file ``GNU_tuned_cpp.xml`` and click Next.
+
+[start=16]
+. Copy and paste the following text in ``GNU_tuned_cpp.xml`` :
[source,xml]
----
@@ -286,24 +322,40 @@
The Unit Test folders might not exist.
-17. In the Projects window, right-click the ``mytoolchain`` project node and choose Run. The module is built and installed in a new instance of the IDE, which is the default target platform of modules. The target platform opens so that you can try out the new module.
-18. In the running module, choose Tools > Options, select C/C++ from the top pane of the Options window, and select the Build Tools tab.
-19. If the new tool collection (GNU_tuned) is not shown, click Restore Default. Click Yes to continue when prompted to rescan your environment.
+
+[start=17]
+. In the Projects window, right-click the ``mytoolchain`` project node and choose Run. The module is built and installed in a new instance of the IDE, which is the default target platform of modules. The target platform opens so that you can try out the new module.
+
+[start=18]
+. In the running module, choose Tools > Options, select C/C++ from the top pane of the Options window, and select the Build Tools tab.
+
+[start=19]
+. If the new tool collection (GNU_tuned) is not shown, click Restore Default. Click Yes to continue when prompted to rescan your environment.
The IDE shows the new tool collection:
image::images/options.png[title="Options panel"]
-20. Create a new C/C++ sample project ``Welcome`` by selecting File > New Project > Samples > C/C++ > Welcome.
-21. Right-click the project node and choose Properties. In the Project Properties dialog box, select the Build node, set the Tool Collection to your GNU_tuned tool collection and click OK.
-22. Build the project. Note that the compiler has flags ``-g3 -gdwarf-2``
+
+[start=20]
+. Create a new C/C++ sample project ``Welcome`` by selecting File > New Project > Samples > C/C++ > Welcome.
+
+[start=21]
+. Right-click the project node and choose Properties. In the Project Properties dialog box, select the Build node, set the Tool Collection to your GNU_tuned tool collection and click OK.
+
+[start=22]
+. Build the project. Note that the compiler has flags ``-g3 -gdwarf-2``
[source,java]
----
g++ -c -g3 -gdwarf-2 -MMD -MP -MF build/Debug/GNU_tuned-Solaris-x86/welcome.o.d -o build/Debug/GNU_tuned-Solaris-x86/welcome.o welcome.cc
----
-23. In the Project Properties dialog box, select the GNU tool collection and click OK.
-24. Build the project again, and compare the compile line in the output window:
+
+[start=23]
+. In the Project Properties dialog box, select the GNU tool collection and click OK.
+
+[start=24]
+. Build the project again, and compare the compile line in the output window:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ja.asciidoc
index 9105171..0ebda01 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ja.asciidoc
@@ -95,7 +95,9 @@
-J-Dcnd.toolchain.personality.create_shadow=true
----
-4. IDEを起動して「ツール」>「オプション」を選択し、「オプション」ウィンドウの上のペインで「C/C++」を選択します。
+
+[start=4]
+. IDEを起動して「ツール」>「オプション」を選択し、「オプション」ウィンドウの上のペインで「C/C++」を選択します。
ツール・コレクション・ディスクリプタの「シャドウ」バージョンが含まれるディレクトリがNetBeansユーザー・ディレクトリ内に作成されます。
@@ -144,8 +146,12 @@
このディレクトリのディスクリプタは、_IDE-HOME_ディレクトリ内の正式バージョンよりも優先されます。IDEで使用しないユーザー・ディレクトリ内のツール・ディスクリプタは削除する必要があります。
-5. ``-J-Dcnd.toolchain.personality.create_shadow=true`` フラグを ``_IDE-HOME_/etc/netbeans.conf`` から削除して、IDEがシャドウ・ディスクリプタを再度作成しないようにします。
-6. 変更作業が終了したら、変更されたツール・ディスクリプタが使用されるようにするため、IDEを再起動します。
+
+[start=5]
+. ``-J-Dcnd.toolchain.personality.create_shadow=true`` フラグを ``_IDE-HOME_/etc/netbeans.conf`` から削除して、IDEがシャドウ・ディスクリプタを再度作成しないようにします。
+
+[start=6]
+. 変更作業が終了したら、変更されたツール・ディスクリプタが使用されるようにするため、IDEを再起動します。
== カスタム・ツール・コレクションの作成
@@ -160,16 +166,32 @@
1. NetBeansインストールにNetBeansプラグイン開発モジュールが含まれていることを確認してください。
「ツール」>「プラグイン」と選択して、「インストール済み」タブをクリックします。NetBeansプラグイン開発モジュールがインストールされていない場合は、「使用可能なプラグイン」タブをクリックして、モジュールをインストールします。検索ボックスに「プラグイン」と入力すると、すばやく探すことができます。
-2. 「ファイル」>「新規プロジェクト」を選択して、新規NetBeansモジュールを作成します。新規プロジェクト・ウィザードのプロジェクトを選択ページで、ウィザードの最初のステップとして、カテゴリに「NetBeansモジュール」、プロジェクトに「モジュール」を選択します。「次」をクリックします。
-3. 名前と場所ページで、プロジェクト名を入力し(「 ``mytoolchain`` 」など)、その他のフィールドはそのままにします。「次」をクリックします。
-4. 「基本モジュール構成」ページで、「コード名ベース」に ``org.myhome.mytoolchain`` と入力します。これは、作成中のモジュールを識別する一意の文字列を定義します。コード名ベースは、モジュールのメイン・パッケージとしても使用されます。
-5. OSGiではなくデフォルトのNetBeansモジュール・システムを使用することになるため、「OSGiバンドルを生成」チェックボックスは選択しないでください。
-6. 「終了」をクリックします。IDEではmytoolchainという新規プロジェクトが作成されます。
-7. 「プロジェクト」タブで、mytoolchainプロジェクト・ノードを右クリックし、「新規」>「その他」を選択します。
-8. 新規ファイル・ウィザードで、カテゴリ「モジュールの開発」およびファイル・タイプ「XMLレイヤー」を選択してから、「次」をクリックして「終了」をクリックします。
+
+[start=2]
+. 「ファイル」>「新規プロジェクト」を選択して、新規NetBeansモジュールを作成します。新規プロジェクト・ウィザードのプロジェクトを選択ページで、ウィザードの最初のステップとして、カテゴリに「NetBeansモジュール」、プロジェクトに「モジュール」を選択します。「次」をクリックします。
+
+[start=3]
+. 名前と場所ページで、プロジェクト名を入力し(「 ``mytoolchain`` 」など)、その他のフィールドはそのままにします。「次」をクリックします。
+
+[start=4]
+. 「基本モジュール構成」ページで、「コード名ベース」に ``org.myhome.mytoolchain`` と入力します。これは、作成中のモジュールを識別する一意の文字列を定義します。コード名ベースは、モジュールのメイン・パッケージとしても使用されます。
+
+[start=5]
+. OSGiではなくデフォルトのNetBeansモジュール・システムを使用することになるため、「OSGiバンドルを生成」チェックボックスは選択しないでください。
+
+[start=6]
+. 「終了」をクリックします。IDEではmytoolchainという新規プロジェクトが作成されます。
+
+[start=7]
+. 「プロジェクト」タブで、mytoolchainプロジェクト・ノードを右クリックし、「新規」>「その他」を選択します。
+
+[start=8]
+. 新規ファイル・ウィザードで、カテゴリ「モジュールの開発」およびファイル・タイプ「XMLレイヤー」を選択してから、「次」をクリックして「終了」をクリックします。
IDEでは、メイン・パッケージ ``org.myhome.mytoolchain`` 内のソース・パッケージ・ノードの下に ``layer.xml`` が作成され、エディタで ``layer.xml`` が開かれます。
-9. ファイルに ``<filesystem/>`` タグが含まれている場合は、そのタグを開始および終了の ``filesystem`` タグに置き換えます。 ``<filesystem>``
+
+[start=9]
+. ファイルに ``<filesystem/>`` タグが含まれている場合は、そのタグを開始および終了の ``filesystem`` タグに置き換えます。 ``<filesystem>``
[source,xml]
----
@@ -177,7 +199,9 @@
``</filesystem>``
----
-10. ``filesystem`` タグ内に、 ``layer.xml`` の次のテキストをコピーして貼り付けます。
+
+[start=10]
+. ``filesystem`` タグ内に、 ``layer.xml`` の次のテキストをコピーして貼り付けます。
[source,xml]
----
@@ -233,16 +257,24 @@
</folder>
----
-11. ``Bundle.properties`` ファイルを開き、次の文字列を追加します。
+
+[start=11]
+. ``Bundle.properties`` ファイルを開き、次の文字列を追加します。
``CND/ToolChains/GNU_tuned=My GNU Tuned Tool Collection``
-12. ソース・パッケージの下の ``org.myhome.mytoolchain`` パッケージを右クリックし、「新規」>「Javaパッケージ」を選択してサブパッケージ ``toolchain`` を作成します。デフォルト・パッケージ名の ``newpackage`` を ``toolchain`` に置き換えて、「終了」をクリックします。IDEではサブパッケージ ``org.myhome.mytoolchain.toolchain`` が作成されます。
-13. ``org.myhome.mytoolchain.toolchain`` サブパッケージを右クリックして「新規」>「空のファイル」を選択することで、新規ファイルを作成します。ファイルに ``GNU_tuned_flavor.xml`` という名前を付けて、「終了」をクリックします。
+
+[start=12]
+. ソース・パッケージの下の ``org.myhome.mytoolchain`` パッケージを右クリックし、「新規」>「Javaパッケージ」を選択してサブパッケージ ``toolchain`` を作成します。デフォルト・パッケージ名の ``newpackage`` を ``toolchain`` に置き換えて、「終了」をクリックします。IDEではサブパッケージ ``org.myhome.mytoolchain.toolchain`` が作成されます。
+
+[start=13]
+. ``org.myhome.mytoolchain.toolchain`` サブパッケージを右クリックして「新規」>「空のファイル」を選択することで、新規ファイルを作成します。ファイルに ``GNU_tuned_flavor.xml`` という名前を付けて、「終了」をクリックします。
「空のファイル」がオプションとして表示されない場合、「その他」を選択してから新規ファイル・ウィザードで、カテゴリ「その他」およびファイル・タイプ「空のファイル」を選択して「次」をクリックします。
このファイルは、新規ツール・コレクションのツール・コレクション・ディスクリプタです。
-14. ``GNU_tuned_flavor.xml`` 内に、次のテキストをコピーして貼り付けます。
+
+[start=14]
+. ``GNU_tuned_flavor.xml`` 内に、次のテキストをコピーして貼り付けます。
[source,xml]
----
@@ -254,8 +286,12 @@
</toolchaindefinition>
----
-15. ``org.myhome.mytoolchain.toolchain`` サブパッケージを右クリックして「新規」>「空のファイル」を選択することで、別のファイルを作成します。ファイルに ``GNU_tuned_cpp.xml`` という名前を付けて、「次」をクリックします。
-16. ``GNU_tuned_cpp.xml`` 内に、次のテキストをコピーして貼り付けます。
+
+[start=15]
+. ``org.myhome.mytoolchain.toolchain`` サブパッケージを右クリックして「新規」>「空のファイル」を選択することで、別のファイルを作成します。ファイルに ``GNU_tuned_cpp.xml`` という名前を付けて、「次」をクリックします。
+
+[start=16]
+. ``GNU_tuned_cpp.xml`` 内に、次のテキストをコピーして貼り付けます。
[source,xml]
----
@@ -286,24 +322,40 @@
「単体テスト」フォルダが存在しない場合があります。
-17. 「プロジェクト」ウィンドウで、「 ``mytoolchain`` 」プロジェクト・ノードを右クリックし、「実行」を選択します。モジュールがビルドされ、IDEの新しいインスタンス(モジュールのデフォルト・ターゲット・プラットフォーム)にインストールされます。ターゲット・プラットフォームが開き、新規モジュールを試すことができます。
-18. 実行中のモジュールで、「ツール」>「オプション」を選択し、「オプション」ウィンドウの上ペインで「C/C++」を選択して、「ビルド・ツール」タブを選択します。
-19. 新規ツール・コレクション(GNU_tuned)が表示されない場合は、「デフォルトに戻す」をクリックします。環境を再スキャンするように求められた場合、「はい」をクリックして続行します。
+
+[start=17]
+. 「プロジェクト」ウィンドウで、「 ``mytoolchain`` 」プロジェクト・ノードを右クリックし、「実行」を選択します。モジュールがビルドされ、IDEの新しいインスタンス(モジュールのデフォルト・ターゲット・プラットフォーム)にインストールされます。ターゲット・プラットフォームが開き、新規モジュールを試すことができます。
+
+[start=18]
+. 実行中のモジュールで、「ツール」>「オプション」を選択し、「オプション」ウィンドウの上ペインで「C/C++」を選択して、「ビルド・ツール」タブを選択します。
+
+[start=19]
+. 新規ツール・コレクション(GNU_tuned)が表示されない場合は、「デフォルトに戻す」をクリックします。環境を再スキャンするように求められた場合、「はい」をクリックして続行します。
新規ツール・コレクションが表示されます。
image::images/options.png[title="オプション・パネル"]
-20. 「ファイル」>「新規プロジェクト」>「サンプル」>「C/C++」>「Welcome」を選択して、新規C/C++サンプル・プロジェクト ``Welcome`` を作成します。
-21. プロジェクト・ノードを右クリックし、「プロパティ」を選択します。「プロジェクト・プロパティ」ダイアログ・ボックスで「ビルド」ノードを選択し、「ツール・コレクション」をGNU_tunedツール・コレクションに設定して、「OK」をクリックします。
-22. プロジェクトをビルドします。コンパイラに ``-g3 -gdwarf-2`` というフラグがあります。
+
+[start=20]
+. 「ファイル」>「新規プロジェクト」>「サンプル」>「C/C++」>「Welcome」を選択して、新規C/C++サンプル・プロジェクト ``Welcome`` を作成します。
+
+[start=21]
+. プロジェクト・ノードを右クリックし、「プロパティ」を選択します。「プロジェクト・プロパティ」ダイアログ・ボックスで「ビルド」ノードを選択し、「ツール・コレクション」をGNU_tunedツール・コレクションに設定して、「OK」をクリックします。
+
+[start=22]
+. プロジェクトをビルドします。コンパイラに ``-g3 -gdwarf-2`` というフラグがあります。
[source,java]
----
g++ -c -g3 -gdwarf-2 -MMD -MP -MF build/Debug/GNU_tuned-Solaris-x86/welcome.o.d -o build/Debug/GNU_tuned-Solaris-x86/welcome.o welcome.cc
----
-23. 「プロジェクト・プロパティ」ダイアログ・ボックスでGNUツール・コレクションを選択して、「OK」をクリックします。
-24. プロジェクトを再ビルドし、「出力」ウィンドウでコンパイル行を比較します。
+
+[start=23]
+. 「プロジェクト・プロパティ」ダイアログ・ボックスでGNUツール・コレクションを選択して、「OK」をクリックします。
+
+[start=24]
+. プロジェクトを再ビルドし、「出力」ウィンドウでコンパイル行を比較します。
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_pt_BR.asciidoc
index 28ac331..c89d90e 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_pt_BR.asciidoc
@@ -95,7 +95,9 @@
-J-Dcnd.toolchain.personality.create_shadow=true
----
-4. Inicie o IDE, escolha Ferramentas > Opções e selecione C/C++ na parte superior do painel da janela Opções.
+
+[start=4]
+. Inicie o IDE, escolha Ferramentas > Opções e selecione C/C++ na parte superior do painel da janela Opções.
O IDE cria um diretório que contém versões de "sombra" dos descritores da coleção de ferramentas no diretório do usuário NetBeans:
@@ -144,8 +146,12 @@
Os descritores deste diretório têm prioridade em relação às versões oficiais no diretório _IDE-HOME_. Você deve deletar os descritores de ferramenta que você não deseja que o IDE use, em seu diretório do usuário.
-5. Remova o flag ``-J-Dcnd.toolchain.personality.create_shadow=true`` do ``_IDE-HOME_/etc/netbeans.conf`` , de forma que o IDE não crie descritores de sombra novamente.
-6. Reinicie o IDE para usar o descritor de ferramentas modificado quando terminar de fazer as alterações.
+
+[start=5]
+. Remova o flag ``-J-Dcnd.toolchain.personality.create_shadow=true`` do ``_IDE-HOME_/etc/netbeans.conf`` , de forma que o IDE não crie descritores de sombra novamente.
+
+[start=6]
+. Reinicie o IDE para usar o descritor de ferramentas modificado quando terminar de fazer as alterações.
== Criando uma Coleção de Ferramentas Personalizada
@@ -160,16 +166,32 @@
1. Certifique-se de que sua instalação do NetBeans inclua o módulo de Desenvolvimento de Plug-in do NetBeans.
Escolha Ferramentas > Plug-ins e clique na guia Instalados. Se o módulo Desenvolvimento de Plug-in do NetBeans não estiver instalado, clique na guia Plug-ins Disponíveis e instale o módulo. É possível encontrá-lo rapidamente digitando "plug-in" na caixa Pesquisar.
-2. Crie um novo módulo NetBeans escolhendo Arquivo > Novo Projeto. Na página Escolher Projeto do assistente de Novo Projeto, selecione a categoria Módulos NetBeans e o projeto Módulo na primeira etapa do assistente. Clique em Próximo.
-3. Na página Nome e Localização, digite o nome do projeto, por exemplo ``mytoolchain`` e deixe todos os campos como estão. Clique em Próximo.
-4. Na página Configuração Básica do Módulo, digite ``org.myhome.mytoolchain`` para Base do Nome do Código, que define a string exclusiva que identifica o módulo que você está criando. A base do nome do código também é usada como o pacote principal do módulo.
-5. Não marque a caixa de seleção "Gerar Pacote OSGi", pois você usará o sistema de módulos do NetBeans default, em vez do OSGi.
-6. Clique em Finalizar. O IDE cria um novo projeto chamado mytoolchain.
-7. Na guia Projetos, clique com o botão direito do mouse no nó do projeto mytoolchain e selecione Novo > Outros.
-8. No assistente Novo Arquivo, selecione a categoria Desenvolvimento do Módulo e o tipo de arquivo Camada XML. Em seguida, clique em Próximo e em Finalizar.
+
+[start=2]
+. Crie um novo módulo NetBeans escolhendo Arquivo > Novo Projeto. Na página Escolher Projeto do assistente de Novo Projeto, selecione a categoria Módulos NetBeans e o projeto Módulo na primeira etapa do assistente. Clique em Próximo.
+
+[start=3]
+. Na página Nome e Localização, digite o nome do projeto, por exemplo ``mytoolchain`` e deixe todos os campos como estão. Clique em Próximo.
+
+[start=4]
+. Na página Configuração Básica do Módulo, digite ``org.myhome.mytoolchain`` para Base do Nome do Código, que define a string exclusiva que identifica o módulo que você está criando. A base do nome do código também é usada como o pacote principal do módulo.
+
+[start=5]
+. Não marque a caixa de seleção "Gerar Pacote OSGi", pois você usará o sistema de módulos do NetBeans default, em vez do OSGi.
+
+[start=6]
+. Clique em Finalizar. O IDE cria um novo projeto chamado mytoolchain.
+
+[start=7]
+. Na guia Projetos, clique com o botão direito do mouse no nó do projeto mytoolchain e selecione Novo > Outros.
+
+[start=8]
+. No assistente Novo Arquivo, selecione a categoria Desenvolvimento do Módulo e o tipo de arquivo Camada XML. Em seguida, clique em Próximo e em Finalizar.
O IDE cria ``layer.xml`` no nó Pacotes de Código-fonte, no pacote principal ``org.myhome.mytoolchain`` e abre ``layer.xml`` no editor.
-9. Se o arquivo contiver uma tag ``<filesystem/>`` , substitua-a pelas tags ``filesystem`` de abertura e fechamento: ``<filesystem>``
+
+[start=9]
+. Se o arquivo contiver uma tag ``<filesystem/>`` , substitua-a pelas tags ``filesystem`` de abertura e fechamento: ``<filesystem>``
[source,xml]
----
@@ -177,7 +199,9 @@
``</filesystem>``
----
-10. Copie e cole o texto seguinte dentro da tag ``layer.xml`` na tag ``filesystem`` :
+
+[start=10]
+. Copie e cole o texto seguinte dentro da tag ``layer.xml`` na tag ``filesystem`` :
[source,xml]
----
@@ -233,16 +257,24 @@
</folder>
----
-11. Abra o arquivo ``Bundle.properties`` e adicione a seguinte string:
+
+[start=11]
+. Abra o arquivo ``Bundle.properties`` e adicione a seguinte string:
``CND/ToolChains/GNU_tuned=My GNU Tuned Tool Collection``
-12. Crie um subpacote ``toolchain`` clicando com o botão direito do mouse no pacote ``org.myhome.mytoolchain`` em Pacotes de Código-fonte e selecionando Novo > Pacote Java. Substitua o nome do pacote default ``newpackage`` por ``toolchain`` e clique em Finalizar. O IDE cria o subpacote ``org.myhome.mytoolchain.toolchain`` .
-13. Crie um novo arquivo, clicando com o botão direito do mouse no subpacote ``org.myhome.mytoolchain.toolchain`` e selecionando Novo > Arquivo Vazio. Chame o projeto de ``GNU_tuned_flavor.xml`` e clique em Finalizar.
+
+[start=12]
+. Crie um subpacote ``toolchain`` clicando com o botão direito do mouse no pacote ``org.myhome.mytoolchain`` em Pacotes de Código-fonte e selecionando Novo > Pacote Java. Substitua o nome do pacote default ``newpackage`` por ``toolchain`` e clique em Finalizar. O IDE cria o subpacote ``org.myhome.mytoolchain.toolchain`` .
+
+[start=13]
+. Crie um novo arquivo, clicando com o botão direito do mouse no subpacote ``org.myhome.mytoolchain.toolchain`` e selecionando Novo > Arquivo Vazio. Chame o projeto de ``GNU_tuned_flavor.xml`` e clique em Finalizar.
Se você não visualizar Arquivo Vazio como uma opção, selecione Outros e, no assistente Novo Arquivo, selecione a categoria Outros e o tipo de arquivo Arquivo Vazio e clique em Próximo.
Este arquivo é o descritor de coleção de ferramentas para a nova coleção de ferramentas.
-14. Copie e cole o texto seguinte em ``GNU_tuned_flavor.xml`` :
+
+[start=14]
+. Copie e cole o texto seguinte em ``GNU_tuned_flavor.xml`` :
[source,xml]
----
@@ -254,8 +286,12 @@
</toolchaindefinition>
----
-15. Crie outro arquivo novo, clicando com o botão direito do mouse no subpacote ``org.myhome.mytoolchain.toolchain`` e selecionando Novo > Arquivo Vazio. Chame o projeto de ``GNU_tuned_cpp.xml`` e clique em Próximo.
-16. Copie e cole o texto seguinte em ``GNU_tuned_cpp.xml`` :
+
+[start=15]
+. Crie outro arquivo novo, clicando com o botão direito do mouse no subpacote ``org.myhome.mytoolchain.toolchain`` e selecionando Novo > Arquivo Vazio. Chame o projeto de ``GNU_tuned_cpp.xml`` e clique em Próximo.
+
+[start=16]
+. Copie e cole o texto seguinte em ``GNU_tuned_cpp.xml`` :
[source,xml]
----
@@ -286,24 +322,40 @@
As pastas Teste de Unidade talvez não exista.
-17. Na janela Projetos, clique com o botão direito do mouse no nó do projeto ``mytoolchain`` e escolha Executar. O módulo é construído e instalado em uma nova instância do IDE, que é a plataforma de destino default dos módulos. A plataforma de destino se abre, de modo que você possa experimentar o novo módulo.
-18. No módulo em execução, escolha Ferramentas > Opções, selecione C/C++ na parte superior do painel da janela Opções e selecione a guia Ferramentas de Construção.
-19. Se a nova coleção de ferramentas (GNU_tuned) não for exibida, clique em Restaurar Default. Clique em Sim para continuar quando solicitado para verificar novamente seu ambiente.
+
+[start=17]
+. Na janela Projetos, clique com o botão direito do mouse no nó do projeto ``mytoolchain`` e escolha Executar. O módulo é construído e instalado em uma nova instância do IDE, que é a plataforma de destino default dos módulos. A plataforma de destino se abre, de modo que você possa experimentar o novo módulo.
+
+[start=18]
+. No módulo em execução, escolha Ferramentas > Opções, selecione C/C++ na parte superior do painel da janela Opções e selecione a guia Ferramentas de Construção.
+
+[start=19]
+. Se a nova coleção de ferramentas (GNU_tuned) não for exibida, clique em Restaurar Default. Clique em Sim para continuar quando solicitado para verificar novamente seu ambiente.
O IDE mostra a nova coleção de ferramentas:
image::images/options.png[title="Painel Opções"]
-20. Crie um novo projeto C/C++ de amostra ``Bem-Vindo`` selecionando Arquivo > Novo Projeto > Amostras > C/C++ > Bem-Vindo.
-21. Clique com o botão direito do mouse no nó do projeto e escolha Propriedades. Na caixa de diálogo Propriedades do Projeto, selecione o nó Construir, defina a Coleção de Ferramentas como a coleção de ferramentas GNU_tuned e clique em OK.
-22. Construa o projeto. Observe que o compilador tem os flags ``-g3 -gdwarf-2``
+
+[start=20]
+. Crie um novo projeto C/C++ de amostra ``Bem-Vindo`` selecionando Arquivo > Novo Projeto > Amostras > C/C++ > Bem-Vindo.
+
+[start=21]
+. Clique com o botão direito do mouse no nó do projeto e escolha Propriedades. Na caixa de diálogo Propriedades do Projeto, selecione o nó Construir, defina a Coleção de Ferramentas como a coleção de ferramentas GNU_tuned e clique em OK.
+
+[start=22]
+. Construa o projeto. Observe que o compilador tem os flags ``-g3 -gdwarf-2``
[source,java]
----
g++ -c -g3 -gdwarf-2 -MMD -MP -MF build/Debug/GNU_tuned-Solaris-x86/welcome.o.d -o build/Debug/GNU_tuned-Solaris-x86/welcome.o welcome.cc
----
-23. Na caixa de diálogo Propriedades do Projeto, selecione a coleção de ferramentas GNU e clique em OK.
-24. Construa o projeto novamente e compare a linha compilada na janela de saída:
+
+[start=23]
+. Na caixa de diálogo Propriedades do Projeto, selecione a coleção de ferramentas GNU e clique em OK.
+
+[start=24]
+. Construa o projeto novamente e compare a linha compilada na janela de saída:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ru.asciidoc
index 6b5f9cd..d13df73 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_ru.asciidoc
@@ -95,7 +95,9 @@
-J-Dcnd.toolchain.personality.create_shadow=true
----
-4. Запустите среду IDE, выберите "Сервис" > "Параметры", затем в верхней панели окна параметров выберите "C/C++".
+
+[start=4]
+. Запустите среду IDE, выберите "Сервис" > "Параметры", затем в верхней панели окна параметров выберите "C/C++".
IDE создает 'теневые' версии дескрипторов наборов средств в каталоге пользователя NetBeans:
@@ -144,8 +146,12 @@
Дескрипторы, находящиеся в этом каталоге, имеют более высокий приоритет по сравнению с официальными версиями в каталоге _IDE-HOME_. Если вы не хотите, чтобы в среде IDE использовались некоторые дескрипторы средств, удалите их из своего каталога пользователя.
-5. Удалите флаг ``-J-Dcnd.toolchain.personality.create_shadow=true`` из файла ``_IDE-HOME_/etc/netbeans.conf`` , чтобы в среде IDE больше не создавались теневые копии дескрипторов.
-6. Перед использованием измененного дескриптора средств необходимо перезапустить IDE.
+
+[start=5]
+. Удалите флаг ``-J-Dcnd.toolchain.personality.create_shadow=true`` из файла ``_IDE-HOME_/etc/netbeans.conf`` , чтобы в среде IDE больше не создавались теневые копии дескрипторов.
+
+[start=6]
+. Перед использованием измененного дескриптора средств необходимо перезапустить IDE.
== [[Создание пользовательского набора средств]]
@@ -160,16 +166,32 @@
1. Убедитесь, что в состав установленного экземпляра NetBeans входит модуль NetBeans Plugin Development.
Выберите Сервис > Подключаемые модули и перейдите на вкладку 'Установленные'. Если модуль разработки подключаемых модулей NetBeans не установлен, перейдите на вкладку "Доступные подключаемые модули" и установите модуль. Его можно быстро найти путем ввода текста "plugin" в окне поиска.
-2. Создайте новый модуль NetBeans путем выбора "Файл" > "Создать проект". На странице "Выбор проекта" в мастере создания нового проекта выберите категорию "Модули NetBeans" и в первом шаге мастера укажите проект "Модуль". Нажмите кнопку "Далее".
-3. На странице "Имя и местоположение" введите имя проекта, например, ``mytoolchain`` , а в остальных полях оставьте значения по умолчанию. Нажмите кнопку "Далее".
-4. На странице 'Основные настройки модуля' в поле 'Основа имени кода ' введите ``org.myhome.mytoolchain`` . Это имя определяет уникальный строковый ресурс для идентификации создаваемого модуля. Основа имени кода также используется в качестве основного пакета модуля.
-5. Не устанавливайте флажок 'Создать пакет OSGi', так как в этом примере будет использоваться стандартная система модулей NetBeans, а не OSGi.
-6. Нажмите кнопку "Готово". IDE создает новый проект с именем mytoolchain.
-7. На вкладке 'Проекты' щелкните узел проекта mytoolchain правой кнопкой мыши и выберите Создать > Другое.
-8. В мастере создания файлов выберите категорию 'Разработка модулей' и тип файла 'Слой XML', затем нажмите 'Далее' и 'Готово'.
+
+[start=2]
+. Создайте новый модуль NetBeans путем выбора "Файл" > "Создать проект". На странице "Выбор проекта" в мастере создания нового проекта выберите категорию "Модули NetBeans" и в первом шаге мастера укажите проект "Модуль". Нажмите кнопку "Далее".
+
+[start=3]
+. На странице "Имя и местоположение" введите имя проекта, например, ``mytoolchain`` , а в остальных полях оставьте значения по умолчанию. Нажмите кнопку "Далее".
+
+[start=4]
+. На странице 'Основные настройки модуля' в поле 'Основа имени кода ' введите ``org.myhome.mytoolchain`` . Это имя определяет уникальный строковый ресурс для идентификации создаваемого модуля. Основа имени кода также используется в качестве основного пакета модуля.
+
+[start=5]
+. Не устанавливайте флажок 'Создать пакет OSGi', так как в этом примере будет использоваться стандартная система модулей NetBeans, а не OSGi.
+
+[start=6]
+. Нажмите кнопку "Готово". IDE создает новый проект с именем mytoolchain.
+
+[start=7]
+. На вкладке 'Проекты' щелкните узел проекта mytoolchain правой кнопкой мыши и выберите Создать > Другое.
+
+[start=8]
+. В мастере создания файлов выберите категорию 'Разработка модулей' и тип файла 'Слой XML', затем нажмите 'Далее' и 'Готово'.
IDE создает файл ``layer.xml`` в структуре узла 'Исходные пакеты' внутри основного пакета ``org.myhome.mytoolchain`` и открывает файл ``layer.xml`` в редакторе.
-9. Если файл содержит тег ``<filesystem/>`` , замените его парными тегами ``filesystem`` : ``<filesystem>``
+
+[start=9]
+. Если файл содержит тег ``<filesystem/>`` , замените его парными тегами ``filesystem`` : ``<filesystem>``
[source,xml]
----
@@ -177,7 +199,9 @@
``</filesystem>``
----
-10. Скопируйте и вставьте следующий текст в файл ``layer.xml`` внутри тега ``filesystem`` :
+
+[start=10]
+. Скопируйте и вставьте следующий текст в файл ``layer.xml`` внутри тега ``filesystem`` :
[source,xml]
----
@@ -233,16 +257,24 @@
</folder>
----
-11. Откройте файл ``Bundle.properties`` и добавьте следующую строку:
+
+[start=11]
+. Откройте файл ``Bundle.properties`` и добавьте следующую строку:
``CND/ToolChains/GNU_tuned=My GNU Tuned Tool Collection``
-12. Создайте подпакет ``toolchain`` . Для этого щелкните правой кнопкой мыши пакет ``org.myhome.mytoolchain`` в структуре узла 'Исходные пакеты' и выберите Создать > Пакет Java. Замените заданное по умолчанию имя пакета ``newpackage`` на ``toolchain`` и нажмите 'Готово'. IDE создает подпакет ``org.myhome.mytoolchain.toolchain`` .
-13. Создайте новый файл. Щелкните правой кнопкой мыши подпакет ``org.myhome.mytoolchain.toolchain`` и выберите Создать > Пустой файл. Назовите файл ``GNU_tuned_flavor.xml`` и нажмите 'Готово'.
+
+[start=12]
+. Создайте подпакет ``toolchain`` . Для этого щелкните правой кнопкой мыши пакет ``org.myhome.mytoolchain`` в структуре узла 'Исходные пакеты' и выберите Создать > Пакет Java. Замените заданное по умолчанию имя пакета ``newpackage`` на ``toolchain`` и нажмите 'Готово'. IDE создает подпакет ``org.myhome.mytoolchain.toolchain`` .
+
+[start=13]
+. Создайте новый файл. Щелкните правой кнопкой мыши подпакет ``org.myhome.mytoolchain.toolchain`` и выберите Создать > Пустой файл. Назовите файл ``GNU_tuned_flavor.xml`` и нажмите 'Готово'.
Если в меню отсутствует пункт 'Пустой файл', выберите 'Другие'. Затем в мастере создания файлов выберите категорию 'Другие', тип файла 'Пустой файл' и нажмите 'Далее'.
Этот файл является дескриптором для нового набора средств.
-14. Скопируйте следующий текст в ``GNU_tuned_flavor.xml`` :
+
+[start=14]
+. Скопируйте следующий текст в ``GNU_tuned_flavor.xml`` :
[source,xml]
----
@@ -254,8 +286,12 @@
</toolchaindefinition>
----
-15. Создайте еще один файл. Щелкните правой кнопкой мыши подпакет ``org.myhome.mytoolchain.toolchain`` и выберите Создать > Пустой файл. Назовите файл ``GNU_tuned_cpp.xml`` и нажмите кнопку Next ("Далее").
-16. Скопируйте следующий текст в ``GNU_tuned_cpp.xml`` :
+
+[start=15]
+. Создайте еще один файл. Щелкните правой кнопкой мыши подпакет ``org.myhome.mytoolchain.toolchain`` и выберите Создать > Пустой файл. Назовите файл ``GNU_tuned_cpp.xml`` и нажмите кнопку Next ("Далее").
+
+[start=16]
+. Скопируйте следующий текст в ``GNU_tuned_cpp.xml`` :
[source,xml]
----
@@ -286,24 +322,40 @@
Папки 'Тест модуля' могут отсутствовать.
-17. В окне 'Проекты' щелкните правой кнопкой мыши узел проекта ``mytoolchain`` и выберите 'Выполнить'. В новом экземпляре среды IDE будет создан и установлен модуль, представляющий собой целевую платформу по умолчанию для модулей. Откроется целевая платформа для тестирования нового модуля.
-18. В выполняемом модуле выберите "Сервис" > "Параметры", затем в верхней панели окна параметров выберите "C/C++" и перейдите на вкладку "Средства сборки".
-19. Если новый набор средств (GNU_tuned) не отображается, нажмите кнопку "Восстановить параметры по умолчанию". В запросе на повторный поиск в среде нажмите кнопку "Да" для продолжения работы.
+
+[start=17]
+. В окне 'Проекты' щелкните правой кнопкой мыши узел проекта ``mytoolchain`` и выберите 'Выполнить'. В новом экземпляре среды IDE будет создан и установлен модуль, представляющий собой целевую платформу по умолчанию для модулей. Откроется целевая платформа для тестирования нового модуля.
+
+[start=18]
+. В выполняемом модуле выберите "Сервис" > "Параметры", затем в верхней панели окна параметров выберите "C/C++" и перейдите на вкладку "Средства сборки".
+
+[start=19]
+. Если новый набор средств (GNU_tuned) не отображается, нажмите кнопку "Восстановить параметры по умолчанию". В запросе на повторный поиск в среде нажмите кнопку "Да" для продолжения работы.
В среде IDE появится новый набор средств:
image::images/options.png[title="Панель 'Параметры'"]
-20. Создайте новый пример проекта C/C++ ``Welcome`` путем выбора "Файл" > "Создать проект" > "Примеры" > "C/C++" > "Welcome".
-21. Щелкните правой кнопкой узел проекта и выберите команду "Свойства". В диалоговом окне "Свойства проекта" выберите узел "Сборка", укажите набор средств GNU_tuned, затем нажмите кнопку "OK" .
-22. Выполните сборку проекта. Убедитесь, что для компилятора установлены флаги ``-g3 -gdwarf-2``
+
+[start=20]
+. Создайте новый пример проекта C/C++ ``Welcome`` путем выбора "Файл" > "Создать проект" > "Примеры" > "C/C++" > "Welcome".
+
+[start=21]
+. Щелкните правой кнопкой узел проекта и выберите команду "Свойства". В диалоговом окне "Свойства проекта" выберите узел "Сборка", укажите набор средств GNU_tuned, затем нажмите кнопку "OK" .
+
+[start=22]
+. Выполните сборку проекта. Убедитесь, что для компилятора установлены флаги ``-g3 -gdwarf-2``
[source,java]
----
g++ -c -g3 -gdwarf-2 -MMD -MP -MF build/Debug/GNU_tuned-Solaris-x86/welcome.o.d -o build/Debug/GNU_tuned-Solaris-x86/welcome.o welcome.cc
----
-23. В диалоговом окне "Свойства проекта" выберите набор средств GNU и нажмите кнопку "ОК".
-24. Выполните повторную сборку проекта и сравните строку компиляции со строкой в окне вывода:
+
+[start=23]
+. В диалоговом окне "Свойства проекта" выберите набор средств GNU и нажмите кнопку "ОК".
+
+[start=24]
+. Выполните повторную сборку проекта и сравните строку компиляции со строкой в окне вывода:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_zh_CN.asciidoc
index b57b08e..fb5d253 100644
--- a/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/cnd/toolchain_zh_CN.asciidoc
@@ -95,7 +95,9 @@
-J-Dcnd.toolchain.personality.create_shadow=true
----
-4. 启动 IDE,选择“工具”>“选项”,然后在“选项”窗口的顶部窗格中选择 "C/C++"。
+
+[start=4]
+. 启动 IDE,选择“工具”>“选项”,然后在“选项”窗口的顶部窗格中选择 "C/C++"。
IDE 将在 NetBeans 用户目录中创建包含工具集合描述符的“影子”版本的目录:
@@ -144,8 +146,12 @@
此目录中的描述符优先于 _IDE-HOME_ 目录中的正式版本。您应删除用户目录中不希望 IDE 使用的工具描述符。
-5. 从 ``_IDE-HOME_/etc/netbeans.conf`` 中删除 ``-J-Dcnd.toolchain.personality.create_shadow=true`` 标志,这样 IDE 就不会再次创建影子描述符。
-6. 完成更改后,重新启动 IDE 以使用修改后的工具描述符。
+
+[start=5]
+. 从 ``_IDE-HOME_/etc/netbeans.conf`` 中删除 ``-J-Dcnd.toolchain.personality.create_shadow=true`` 标志,这样 IDE 就不会再次创建影子描述符。
+
+[start=6]
+. 完成更改后,重新启动 IDE 以使用修改后的工具描述符。
== 创建定制工具集合
@@ -160,16 +166,32 @@
1. 确保您的 NetBeans 安装包含 NetBeans 插件开发模块。
选择“工具”>“插件”,然后单击“已安装”标签。如果未安装 Netbeans 插件开发模块,请单击“可用插件”标签并安装该模块。可以在搜索框中键入“插件”以快速找到该插件。
-2. 选择“文件”>“新建项目”以创建新的 NetBeans 模块。在新建项目向导的“选择项目”页中,在向导的第一步中选择“NetBeans 模块”类别和“模块”项目。单击 "Next"(下一步)。
-3. 在“名称和位置”页中键入项目名称(如 ``mytoolchain`` ),并将所有其他字段保持不变。单击 "Next"(下一步)。
-4. 在“基本模块配置”页上,键入 ``org.myhome.mytoolchain`` 作为代码名称基,它定义用于标识创建的模块的唯一字符串。代码名称基也用作模块的主包。
-5. 请勿选中“生成 OSGi 包”复选框,因为您将使用默认 NetBeans 模块系统而不是 OSGi。
-6. 单击 "Finish"(完成)。IDE 将创建名为 mytoolchain 的新项目。
-7. 在“项目”标签中,右键单击 "mytoolchain" 项目节点并选择“新建”>“其他”。
-8. 在“新建文件”向导中,选择类别“模块开发”和文件类型“XML 层”,然后单击“下一步”并单击“完成”。
+
+[start=2]
+. 选择“文件”>“新建项目”以创建新的 NetBeans 模块。在新建项目向导的“选择项目”页中,在向导的第一步中选择“NetBeans 模块”类别和“模块”项目。单击 "Next"(下一步)。
+
+[start=3]
+. 在“名称和位置”页中键入项目名称(如 ``mytoolchain`` ),并将所有其他字段保持不变。单击 "Next"(下一步)。
+
+[start=4]
+. 在“基本模块配置”页上,键入 ``org.myhome.mytoolchain`` 作为代码名称基,它定义用于标识创建的模块的唯一字符串。代码名称基也用作模块的主包。
+
+[start=5]
+. 请勿选中“生成 OSGi 包”复选框,因为您将使用默认 NetBeans 模块系统而不是 OSGi。
+
+[start=6]
+. 单击 "Finish"(完成)。IDE 将创建名为 mytoolchain 的新项目。
+
+[start=7]
+. 在“项目”标签中,右键单击 "mytoolchain" 项目节点并选择“新建”>“其他”。
+
+[start=8]
+. 在“新建文件”向导中,选择类别“模块开发”和文件类型“XML 层”,然后单击“下一步”并单击“完成”。
IDE 将在主包 ``org.myhome.mytoolchain`` 内部的“源包”节点下创建 ``layer.xml`` 并在编辑器中打开 ``layer.xml`` 。
-9. 如果此文件包含 ``<filesystem/>`` 标记,请将其替换为开始和结束的 ``filesystem`` 标记: ``<filesystem>``
+
+[start=9]
+. 如果此文件包含 ``<filesystem/>`` 标记,请将其替换为开始和结束的 ``filesystem`` 标记: ``<filesystem>``
[source,xml]
----
@@ -177,7 +199,9 @@
``</filesystem>``
----
-10. 复制以下文本并粘贴在 ``filesystem`` 标记内部的 ``layer.xml`` 中:
+
+[start=10]
+. 复制以下文本并粘贴在 ``filesystem`` 标记内部的 ``layer.xml`` 中:
[source,xml]
----
@@ -233,16 +257,24 @@
</folder>
----
-11. 打开 ``Bundle.properties`` 文件,并添加以下字符串:
+
+[start=11]
+. 打开 ``Bundle.properties`` 文件,并添加以下字符串:
``CND/ToolChains/GNU_tuned=My GNU Tuned Tool Collection``
-12. 创建 ``toolchain`` 子包:右键单击“源包”下的 ``org.myhome.mytoolchain`` 包,然后选择“新建”>“Java 包”。将默认包名 ``newpackage`` 替换为 ``toolchain`` ,然后单击“完成”。IDE 将创建 ``org.myhome.mytoolchain.toolchain`` 子包。
-13. 创建新文件:右键单击 ``org.myhome.mytoolchain.toolchain`` 子包,然后选择“新建”>“空文件”。将文件命名为 ``GNU_tuned_flavor.xml`` ,然后单击“完成”。
+
+[start=12]
+. 创建 ``toolchain`` 子包:右键单击“源包”下的 ``org.myhome.mytoolchain`` 包,然后选择“新建”>“Java 包”。将默认包名 ``newpackage`` 替换为 ``toolchain`` ,然后单击“完成”。IDE 将创建 ``org.myhome.mytoolchain.toolchain`` 子包。
+
+[start=13]
+. 创建新文件:右键单击 ``org.myhome.mytoolchain.toolchain`` 子包,然后选择“新建”>“空文件”。将文件命名为 ``GNU_tuned_flavor.xml`` ,然后单击“完成”。
如果您看不到“空文件”选项,请选择“其他”,然后在“新建文件”向导中选择类别“其他”和文件类型“空文件”,再单击“下一步”。
此文件是新工具集合的工具集合描述符。
-14. 复制以下文本并粘贴在 ``GNU_tuned_flavor.xml`` 中:
+
+[start=14]
+. 复制以下文本并粘贴在 ``GNU_tuned_flavor.xml`` 中:
[source,xml]
----
@@ -254,8 +286,12 @@
</toolchaindefinition>
----
-15. 创建另一个新文件:右键单击 ``org.myhome.mytoolchain.toolchain`` 子包,然后选择“新建”>“空文件”。将文件命名为 ``GNU_tuned_cpp.xml`` ,然后单击“下一步”。
-16. 复制以下文本并粘贴在 ``GNU_tuned_cpp.xml`` 中:
+
+[start=15]
+. 创建另一个新文件:右键单击 ``org.myhome.mytoolchain.toolchain`` 子包,然后选择“新建”>“空文件”。将文件命名为 ``GNU_tuned_cpp.xml`` ,然后单击“下一步”。
+
+[start=16]
+. 复制以下文本并粘贴在 ``GNU_tuned_cpp.xml`` 中:
[source,xml]
----
@@ -286,24 +322,40 @@
单元测试文件夹可能不存在。
-17. 在“项目”窗口中,右键单击 ``mytoolchain`` 项目节点并选择“运行主项目”。将构建该模块,并将其安装在 IDE(模块的默认目标平台)的新实例中。此时将打开目标平台,您可以在其中试用新模块。
-18. 在运行的模块中,选择“工具”>“选项”,从“选项”窗口的顶部窗格中选择 "C/C++",然后选择“构建工具”标签。
-19. 如果未显示新工具集合 (GNU_tuned),请单击“恢复默认值”。在提示重新扫描环境时,单击“是”继续。
+
+[start=17]
+. 在“项目”窗口中,右键单击 ``mytoolchain`` 项目节点并选择“运行主项目”。将构建该模块,并将其安装在 IDE(模块的默认目标平台)的新实例中。此时将打开目标平台,您可以在其中试用新模块。
+
+[start=18]
+. 在运行的模块中,选择“工具”>“选项”,从“选项”窗口的顶部窗格中选择 "C/C++",然后选择“构建工具”标签。
+
+[start=19]
+. 如果未显示新工具集合 (GNU_tuned),请单击“恢复默认值”。在提示重新扫描环境时,单击“是”继续。
IDE 将显示新的工具集合:
image::images/options.png[title=""Options"(选项)面板"]
-20. 选择“文件”>“新建项目”>“样例”> "C/C++" > "Welcome" 以创建新的 C/C++ 样例项目 ``Welcome`` 。
-21. 右键单击项目节点,然后选择 "Properties"(属性)。在“项目属性”对话框中,选择“构建”节点,将“工具集合”设置为 GNU_tuned 工具集合,然后单击“确定”。
-22. 构建项目。请注意,编译器具有 ``-g3 -gdwarf-2`` 标志:
+
+[start=20]
+. 选择“文件”>“新建项目”>“样例”> "C/C++" > "Welcome" 以创建新的 C/C++ 样例项目 ``Welcome`` 。
+
+[start=21]
+. 右键单击项目节点,然后选择 "Properties"(属性)。在“项目属性”对话框中,选择“构建”节点,将“工具集合”设置为 GNU_tuned 工具集合,然后单击“确定”。
+
+[start=22]
+. 构建项目。请注意,编译器具有 ``-g3 -gdwarf-2`` 标志:
[source,java]
----
g++ -c -g3 -gdwarf-2 -MMD -MP -MF build/Debug/GNU_tuned-Solaris-x86/welcome.o.d -o build/Debug/GNU_tuned-Solaris-x86/welcome.o welcome.cc
----
-23. 在“项目属性”对话框中,选择 GNU 工具集合,然后单击“确定”。
-24. 重新构建项目,并在输出窗口中比较编译行:
+
+[start=23]
+. 在“项目属性”对话框中,选择 GNU 工具集合,然后单击“确定”。
+
+[start=24]
+. 重新构建项目,并在输出窗口中比较编译行:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/contributing.asciidoc b/netbeans.apache.org/src/content/kb/docs/contributing.asciidoc
index 7f489b2..a0d2b2e 100644
--- a/netbeans.apache.org/src/content/kb/docs/contributing.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/contributing.asciidoc
@@ -51,7 +51,7 @@
image::images/contributing-link.png[title="Click the 'See this page in GitHub' link to edit a page"]
-[start=2]
+
1. You will then be redirected to GitHub. Once there click the "Edit this file" button.
image::images/contributing-button.png[title="Edit button in GitHub"]
@@ -239,11 +239,11 @@
Now we have a paragraph here, or an image or whatever
-[start=3]
+
. This is the third item
----
-<1>: Note that since we have a `[start=3]` preamble, we don't add a number before the dot, this is, we write `. This is the third item` and not `3. This is the third item`. By doing so we avoid this link:https://github.com/asciidoctor/asciidoctor/issues/3252[asciidoctor warning].
+<1>: Note that since we have a `
=== Admonitions (notes, tips)
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/NetBeans_DTrace_GUI_Plugin_0_4.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/NetBeans_DTrace_GUI_Plugin_0_4.asciidoc
index 83370ff..94cdee1 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/NetBeans_DTrace_GUI_Plugin_0_4.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/NetBeans_DTrace_GUI_Plugin_0_4.asciidoc
@@ -105,12 +105,12 @@
image::../../../images_www/articles/ide/dtracegui/install60.1.png[title="Available Plugins tab"]
-[start=4]
+
. In the NetBeans IDE Installer window, click Next.
image::../../../images_www/articles/ide/dtracegui/install60.2.png[title="NetBeans IDE Installer"]
-[start=5]
+
. Accept the License Agreement and click Install.
. Click Finish.
. Close the Plugins window.
@@ -151,7 +151,7 @@
image::../../../images_www/articles/ide/dtracegui/Screenshot2.png[]
-[start=3]
+
. The newly created (empty) ``hello.d`` script appear in the Editor window.
. Enter the code for new D script in the Editor window and save the file. The following example shows the DTrace code for the ``hello.d`` script.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/clearcase.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/clearcase.asciidoc
index 81e19bf..041027a 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/clearcase.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/clearcase.asciidoc
@@ -69,7 +69,7 @@
image::images/cc-options-small.jpg[role="left", link="images/cc-options.jpg"]
--
-[start=3]
+
1. In the Specify the ``cleartool`` Executable Path text field, either type in the path to the executable file or click Browse to navigate to it on your system.
2. Click OK, then restart the IDE to allow changes to take effect.
@@ -107,7 +107,7 @@
Now that your project is created, you can synchronize it with a ClearCase server using the IDE's Add to Source Control command:
-[start=4]
+
1. Right-click the project node in the Projects window and choose Add to source control. The Add dialog opens listing all new view-private files which are not automatically ignored by the IDE:
[.feature]
@@ -115,7 +115,7 @@
image::images/add-dialog-small.jpg[role="left", link="images/add-dialog.jpg"]
--
-[start=2]
+
1. Type in a message in the Describing Message text area. Alternatively, click the Recent Messages ( image::images/recent-msgs.png[] ) icon located in the upper right corner to view and select from a list of messages that you have previously used.
2. After specifying actions for individual files, click Add. The IDE's status bar, located in the bottom right of the interface, displays as the Add action takes place. Upon a successful Add, versioning badges disappear in the Projects, Files and Favorites windows, and the color encoding of checked-in files becomes black.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ja.asciidoc
index 3fa1d3f..fb36d04 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ja.asciidoc
@@ -87,8 +87,12 @@
image::images/cc-options-small.jpg[role="left", link="images/cc-options.jpg"]
--
-3. 「 ``cleartool`` 実行可能ファイルのパスを指定」テキスト・フィールドに、実行可能ファイルのパスを入力するか、または「参照」をクリックしてシステム上のその場所まで移動します。
-4. 「OK」をクリックしてIDEを再起動すると、変更が有効になります。
+
+[start=3]
+. 「 ``cleartool`` 実行可能ファイルのパスを指定」テキスト・フィールドに、実行可能ファイルのパスを入力するか、または「参照」をクリックしてシステム上のその場所まで移動します。
+
+[start=4]
+. 「OK」をクリックしてIDEを再起動すると、変更が有効になります。
*注意: *詳細は、link:http://versioncontrol.netbeans.org/clearcase/install.html[+NetBeans ClearCase統合設定およびリリース・ノート+]を参照してください。
@@ -134,8 +138,12 @@
image::images/add-dialog-small.jpg[role="left", link="images/add-dialog.jpg"]
--
-2. 「説明メッセージ」テキスト領域にメッセージを入力します。または、右上隅にある「最近のメッセージ」(image::images/recent-msgs.png[])アイコンをクリックして、以前使用したメッセージのリストを表示して選択します。
-3. 個々のファイルのアクションを指定して「追加」をクリックします。「追加」アクションが実行されると、インタフェースの右下にあるIDEのステータス・バーが表示されます。追加に成功すると、「プロジェクト」、「ファイル」および「お気に入り」ウィンドウのバージョン管理バッジが消え、チェックイン・ファイルの色分けが黒に戻ります。
+
+[start=2]
+. 「説明メッセージ」テキスト領域にメッセージを入力します。または、右上隅にある「最近のメッセージ」(image::images/recent-msgs.png[])アイコンをクリックして、以前使用したメッセージのリストを表示して選択します。
+
+[start=3]
+. 個々のファイルのアクションを指定して「追加」をクリックします。「追加」アクションが実行されると、インタフェースの右下にあるIDEのステータス・バーが表示されます。追加に成功すると、「プロジェクト」、「ファイル」および「お気に入り」ウィンドウのバージョン管理バッジが消え、チェックイン・ファイルの色分けが黒に戻ります。
*注意: *「追加」ダイアログで、「追加」アクションから個々のファイルを除外するかどうかを指定できます。これを行うには、選択したファイルの「アクション」列をクリックしてドロップダウン・リストから「追加しない」を選択します。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_pt_BR.asciidoc
index 5cb90b1..704e147 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_pt_BR.asciidoc
@@ -87,8 +87,12 @@
image::images/cc-options-small.jpg[role="left", link="images/cc-options.jpg"]
--
-3. No campo de texto Especificar o Caminho do Executável da ``cleartool`` , digite o caminho do arquivo executável ou clique em Explorar para navegar para ele em seu sistema.
-4. Clique em OK, reinicie IDE para permitir que as alterações tenham efeito.
+
+[start=3]
+. No campo de texto Especificar o Caminho do Executável da ``cleartool`` , digite o caminho do arquivo executável ou clique em Explorar para navegar para ele em seu sistema.
+
+[start=4]
+. Clique em OK, reinicie IDE para permitir que as alterações tenham efeito.
*Observação: *Para obter mais informações, consulte link:http://versioncontrol.netbeans.org/clearcase/install.html[+Notas da Release e Configuração de Integração de ClearCase do NetBeans+].
@@ -134,8 +138,12 @@
image::images/add-dialog-small.jpg[role="left", link="images/add-dialog.jpg"]
--
-2. Digite uma mensagem na área de texto Descrevendo a Mensagem. Se preferir, clique no ícone de Mensagens Recentes (image::images/recent-msgs.png[]) localizado no canto superior direito para ver e selecionar de uma lista de mensagens que você usou anteriormente existente.
-3. Depois de especificar ações para arquivos individuais, clique em Adicionar. A barra de status do IDE, localizada na parte inferior direita da interface, é exibida conforme a ação Adicionar acontecer. Com uma adição bem-sucedida, os emblemas de controle de versão desaparecem nas janelas Projetos, Arquivos e Favoritos, e a codificação de cor dos arquivos submetidos a check-in fica em preto.
+
+[start=2]
+. Digite uma mensagem na área de texto Descrevendo a Mensagem. Se preferir, clique no ícone de Mensagens Recentes (image::images/recent-msgs.png[]) localizado no canto superior direito para ver e selecionar de uma lista de mensagens que você usou anteriormente existente.
+
+[start=3]
+. Depois de especificar ações para arquivos individuais, clique em Adicionar. A barra de status do IDE, localizada na parte inferior direita da interface, é exibida conforme a ação Adicionar acontecer. Com uma adição bem-sucedida, os emblemas de controle de versão desaparecem nas janelas Projetos, Arquivos e Favoritos, e a codificação de cor dos arquivos submetidos a check-in fica em preto.
*Observação: *Na caixa de diálogo Adicionar, é possível especificar se arquivos individuais devem ser excluídos da ação Adicionar. Para fazê-lo, clique na coluna Ação de um arquivo selecionado e escolha Não adicionar, na lista drop-down.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ru.asciidoc
index 7122b93..65e9d59 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_ru.asciidoc
@@ -87,8 +87,12 @@
image::images/cc-options-small.jpg[role="left", link="images/cc-options.jpg"]
--
-3. В текстовом поле Specify the ``cleartool`` Executable Path ("Указать путь исполнения cleartool") введите путь к исполняемому файлу, либо нажмите кнопку Browse ("Обзор") для перехода к нему в дереве каталогов.
-4. Нажмите кнопку "ОК" и перезапустите среду IDE, чтобы изменения вступили в силу.
+
+[start=3]
+. В текстовом поле Specify the ``cleartool`` Executable Path ("Указать путь исполнения cleartool") введите путь к исполняемому файлу, либо нажмите кнопку Browse ("Обзор") для перехода к нему в дереве каталогов.
+
+[start=4]
+. Нажмите кнопку "ОК" и перезапустите среду IDE, чтобы изменения вступили в силу.
*Примечание. * Дополнительные сведения приведены в документе link:http://versioncontrol.netbeans.org/clearcase/install.html[+Настройка интеграции ClearCase в среде IDE NetBeans и заметки о выпуске+].
@@ -134,8 +138,12 @@
image::images/add-dialog-small.jpg[role="left", link="images/add-dialog.jpg"]
--
-2. Введите сообщение в текстовую область Describing Message ("Сообщение с описанием"), В качестве альтернативы щелкните значок 'Последние сообщения' ( image::images/recent-msgs.png[] ), расположенный в правом верхнем углу, чтобы просмотреть и выбрать необходимое из ранее использованного списка сообщений.
-3. После указания действий для отдельных файлов нажмите кнопку Add ("Добавить"). При выполнении действия добавления отобразится строка состояния среды IDE, расположенная в нижнем правом углу интерфейса. После успешного добавления значки контроля версий исчезнут в окнах Projects ("Проекты"), Files ("Файлы") и Favorites ("Избранное"), и цвет возвращенных после изменения файлов изменится на черный.
+
+[start=2]
+. Введите сообщение в текстовую область Describing Message ("Сообщение с описанием"), В качестве альтернативы щелкните значок 'Последние сообщения' ( image::images/recent-msgs.png[] ), расположенный в правом верхнем углу, чтобы просмотреть и выбрать необходимое из ранее использованного списка сообщений.
+
+[start=3]
+. После указания действий для отдельных файлов нажмите кнопку Add ("Добавить"). При выполнении действия добавления отобразится строка состояния среды IDE, расположенная в нижнем правом углу интерфейса. После успешного добавления значки контроля версий исчезнут в окнах Projects ("Проекты"), Files ("Файлы") и Favorites ("Избранное"), и цвет возвращенных после изменения файлов изменится на черный.
*Примечание. *В диалоговом окне 'Добавить' можно указать, следует ли исключить отдельные файлы из действия 'Добавить'. Чтобы сделать это, щелкните столбец Action ("Действие") выбранного файла и выберите Do not Add ("Не добавлять") из раскрывающегося списка.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_zh_CN.asciidoc
index 94e66aa..3a329e6 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/clearcase_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/clearcase_zh_CN.asciidoc
@@ -87,8 +87,12 @@
image::images/cc-options-small.jpg[role="left", link="images/cc-options.jpg"]
--
-3. 在 "Specify the ``cleartool`` Executable Path"(指定 cleartool 可执行文件路径)文本字段中,输入可执行文件的路径或者单击 "Browse"(浏览)在系统中找到它。
-4. 单击 "OK"(确定),然后重新启动 IDE,使更改生效。
+
+[start=3]
+. 在 "Specify the ``cleartool`` Executable Path"(指定 cleartool 可执行文件路径)文本字段中,输入可执行文件的路径或者单击 "Browse"(浏览)在系统中找到它。
+
+[start=4]
+. 单击 "OK"(确定),然后重新启动 IDE,使更改生效。
*注:*更多信息请参见 link:http://versioncontrol.netbeans.org/clearcase/install.html[+NetBeans ClearCase 集成设置和发行说明+]。
@@ -134,8 +138,12 @@
image::images/add-dialog-small.jpg[role="left", link="images/add-dialog.jpg"]
--
-2. 在 "Describing Message"(描述消息)文本区输入消息。或者,单击右上角的 "Recent Messages"(近期的消息)(image::images/recent-msgs.png[]) 图标,以便在以前使用过的消息列表中进行查看和选择。
-3. 指定各个文件的操作后,单击 "Add"(添加)。执行添加操作时,将在界面右下方显示 IDE 的状态栏。成功添加后,版本控制标记就会从 "Projects"(项目)、"Files"(文件)和 "Favorites"(收藏夹)窗口中消失,并且检入文件的颜色编码会变成黑色。
+
+[start=2]
+. 在 "Describing Message"(描述消息)文本区输入消息。或者,单击右上角的 "Recent Messages"(近期的消息)(image::images/recent-msgs.png[]) 图标,以便在以前使用过的消息列表中进行查看和选择。
+
+[start=3]
+. 指定各个文件的操作后,单击 "Add"(添加)。执行添加操作时,将在界面右下方显示 IDE 的状态栏。成功添加后,版本控制标记就会从 "Projects"(项目)、"Files"(文件)和 "Favorites"(收藏夹)窗口中消失,并且检入文件的颜色编码会变成黑色。
*注:*可以在 "Add"(添加)对话框中指定是否把某些文件排除在 "Add"(添加)操作之外。为此,单击选定文件的 "Action"(操作)列,从下拉列表中选择 "Do not Add"(不添加)。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/cvs.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/cvs.asciidoc
index 5865296..cb9b8a4 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/cvs.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/cvs.asciidoc
@@ -57,7 +57,7 @@
NOTE: The IDE's drop-down menus are context-sensitive, i.e., the available options depend on the item currently selected. Therefore, if you are already working within a CVS project, you can choose Versioning > Checkout from the main menu.
-[start=2]
+
1. In the first panel of the wizard, enter the location of the repository as can be defined by `CVSROOT`:
The IDE supports a number of `CVSROOT` formats, depending on whether the CVS repository is local or remote, and what method you are using to connect to it:
@@ -82,7 +82,7 @@
For more help with accessing local repositories, see: link:http://wiki.netbeans.org/wiki/view/FaqHowToAccessLocalCVS[+How can I access local repositories?+]
-[start=3]
+
1. In the Modules to Checkout panel of the wizard, specify the module that you want to check out in the Module field. If you do not know the name of the module you want to check out, click the Browse button to view the repository's contents. From the Browse CVS Module dialog that appears, select any of the listed modules and click OK. Your selection is then added to the Module field:
[.feature]
@@ -90,7 +90,7 @@
image::images/cvs-checkout-small.png[role="left", link="images/cvs-checkout.png"]
--
-[start=4]
+
1. In the Branch text field, enter the name of the branch to checkout. You can click the Browse button to open the Browse Tags dialog box to search for available branches and tags. If you do not specify a branch or tag, the _trunk_ is checked out.
2. In the Local Folder field, enter a location on your computer where you want files to be checked out to, then click Finish to initiate the CVS check out. The IDE checks out the specified sources and the IDE's status bar displays in the lower right corner, indicating progress of the files downloading from the repository to your local directory. You can also view files as they are being checked out from the Output window (Ctrl-4).
@@ -113,7 +113,7 @@
image::images/folder-to-import-small.png[role="left", link="images/folder-to-import.png"]
--
-[start=4]
+
1. In the Import Message text area, enter a description of the project you are importing into the repository.
2. Specify the location in the repository where you want to import the project by typing in the path in the Repository Folder text field. Alternatively, click the Browse button to navigate to a specific location in the repository. Click Finish to initiate the import. The IDE uploads the project files to the repository and the Output window opens to display the progress.
@@ -215,7 +215,7 @@
image::images/cvs-options-small.png[role="left", link="images/cvs-options.png"]
--
-[start=3]
+
1. Click the Add Variable button to the right of the Status Label Format text field. In the Add Variable dialog that displays, select the `{revision}` variable, then click OK. The revision variable is added to the status label Format text field.
2. To reformat status labels so that only status and revision display to the right of files, rearrange the contents of the status label Format text field to the following:
@@ -373,13 +373,13 @@
NOTE: Make sure your <<fileStatus,file status labels>> are activated (choose View > Show Versioning Labels from the main menu).
-[start=2]
+
1. Edit files, add files, delete files. Commit all changes.
2. When the new feature is ready, switch back to the trunk. You must be working in the target branch (i.e., trunk in this case) when wanting to perform a merge between two branches. Right-click the project node and choose CVS > Switch to Branch. In the dialog that displays, select Switch to Trunk and click Switch.
The IDE switches your target repository location to the trunk. In the Projects window, note that file status labels automatically update to reflect your new working location.
-[start=4]
+
1. To perform the merge, right-click the project node and choose CVS > Merge Changes from Branch. In the dialog that displays, note that the Merge Changes Into Working Branch field contains `Trunk`, indicating your current working location.
In the dialog, specify the following criteria:
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/cvs_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/cvs_ja.asciidoc
index c081aea..9d8b1ba 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/cvs_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/cvs_ja.asciidoc
@@ -73,7 +73,9 @@
1. NetBeans IDEで、メイン・メニューから「チーム」>「CVS」>「チェックアウト」を選択します。チェックアウト・ウィザードが開きます。
*注意: *IDEのドロップダウン・メニューはコンテキスト依存です。つまり、使用可能なオプションは現在選択されている項目によって異なります。そのため、すでにCVSプロジェクト内で作業している場合、メイン・メニューから「バージョン管理」>「チェックアウト」を選択できます。
-2. ウィザードの最初のパネルで、`CVSROOT`で定義できるリポジトリの場所を入力します。
+
+[start=2]
+. ウィザードの最初のパネルで、`CVSROOT`で定義できるリポジトリの場所を入力します。
IDEでは、CVSリポジトリがローカルかリモートか、およびそれに接続するために使用する方法に応じて、多くの`CVSROOT`形式をサポートしています。
@@ -97,7 +99,7 @@
ローカル・リポジトリへのアクセスに関する詳細は、link:http://wiki.netbeans.org/wiki/view/FaqHowToAccessLocalCVS[+ローカル・リポジトリにアクセスする方法+]を参照してください。
-[start=3]
+
1. ウィザードの「チェックアウトするモジュール」パネルで、「モジュール」フィールドにチェックアウトするモジュールを指定します。チェックアウトするモジュールの名前がわからない場合、「参照」ボタンをクリックして、リポジトリの内容を表示します。表示された「CVSモジュールを参照」ダイアログから、表示されているいずれかのモジュールを選択し、「OK」をクリックします。これで、選択が「モジュール」フィールドに追加されます。
[.feature]
@@ -105,7 +107,7 @@
image::images/cvs-checkout-small.png[role="left", link="images/cvs-checkout.png"]
--
-[start=4]
+
1. 「分岐」テキスト・フィールドで、チェックアウトする分岐の名前を入力します。「参照」ボタンをクリックすると、「タグを参照」ダイアログ・ボックスが開き、使用可能な分岐とタグを検索できます。分岐とタグのどちらも指定しなかった場合は、_トランク_がチェックアウトされます。
2. 「ローカル・フォルダ」フィールドで、ファイルのチェックアウト先にするコンピュータ上の場所を入力し、「終了」をクリックして、CVSチェックアウトを開始します。IDEによって指定されたソースがチェックアウトされ、右下隅のIDEのステータス・バーに、リポジトリからローカル・ディレクトリへのファイルのダウンロードの進捗状況が示されます。チェックアウト中のファイルを、「出力」ウィンドウから表示することもできます(Ctrl-4)。
@@ -129,7 +131,7 @@
image::images/folder-to-import-small.png[role="left", link="images/folder-to-import.png"]
--
-[start=4]
+
1. 「インポート・メッセージ」テキスト領域に、リポジトリにインポートしようとしているプロジェクトの説明を入力します。
2. 「リポジトリ・フォルダ」テキスト・フィールドにパスを入力して、プロジェクトをインポートするリポジトリ内の場所を指定します。または、「参照」ボタンをクリックして、リポジトリ内の特定の場所に移動します。「終了」をクリックして、インポートを開始します。IDEによってプロジェクト・ファイルがリポジトリにアップロードされ、「出力」ウィンドウが開き、進捗状況が表示されます。
@@ -236,7 +238,7 @@
image::images/cvs-options-small.png[role="left", link="images/cvs-options.png"]
--
-[start=3]
+
1. 「ステータス・ラベル形式」テキスト・フィールドの右側の「変数を追加」ボタンをクリックします。表示される「変数を追加」ダイアログで`{revision}`変数を選択し、「OK」をクリックします。「ステータス・ラベル形式」テキスト・フィールドに、リビジョン変数が追加されます。
2. ファイルの右側にステータスとリビジョンのみが表示されるようにステータス・ラベルを再フォーマットするには、「ステータス・ラベル形式」テキスト・フィールドの内容を次のように再整理します。
@@ -401,13 +403,13 @@
*注意: *<<fileStatus,ファイル・ステータス・ラベル>>がアクティブ化されていることを確認してください(メイン・メニューから「表示」>「バージョン・ラベルを表示」を選択)。
-[start=2]
+
1. ファイルを編集し、ファイルを追加し、ファイルを削除します。すべての変更をコミットします。
2. 新しい機能の準備ができたら、トランクに戻ります。2つの分岐間でマージを実行する場合、ターゲット分岐(この例ではトランク)で作業している必要があります。プロジェクト・ノードを右クリックし、「CVS」>「分岐に切替え」を選択します。表示されるダイアログで、「トランクに切替え」を選択し、「切替え」をクリックします。
IDEによってターゲット・リポジトリの場所がトランクに切り替えられます。「プロジェクト」ウィンドウで、ファイル・ステータス・ラベルが新しい作業場所を反映するように自動的に更新されます。
-[start=4]
+
1. マージを実行するには、プロジェクト・ノードを右クリックし、「CVS」>「分岐での変更をマージ」を選択します。表示されるダイアログで、作業中の分岐に変更をマージ・フィールドに`Trunk`が含まれ、現在の作業場所が示されています。
ダイアログで、次の条件を指定します。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/cvs_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/cvs_pt_BR.asciidoc
index faf9075..1f23471 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/cvs_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/cvs_pt_BR.asciidoc
@@ -73,7 +73,9 @@
1. No NetBeans IDE, escolha Equipe > CVS > Check-out no menu principal. O assistente de Check-out é aberto.
NOTE: os menus drop-down do IDE se adaptam ao contexto, ou seja, as opções disponíveis dependem do item selecionado. Portanto, se você já estiver trabalhando dentro de um projeto CVS, poderá escolher Controle de Versão > Check-out no menu principal.
-2. No primeiro painel do assistente, insira a localização do repositório, que pode ser definido por `CVSROOT`:
+
+[start=2]
+. No primeiro painel do assistente, insira a localização do repositório, que pode ser definido por `CVSROOT`:
O IDE suporta diversos formatos de `CVSROOT`, dependendo se o repositório CVS for local ou remoto, e qual método está sendo usado para se conectar ao mesmo:
@@ -97,7 +99,7 @@
Para obter ajuda sobre como acessar repositórios locais, consulte: link:http://wiki.netbeans.org/wiki/view/FaqHowToAccessLocalCVS[+Como posso acessar repositórios locais?+]
-[start=3]
+
1. No painel Módulos para Check-out do assistente, especifique o módulo cujo check-out deseja no campo Módulo. Caso não saiba o nome do módulo ao qual deseja fazer check-out, clique no botão Procurar para exibir o conteúdo do repositório. Na caixa de diálogo Procurar por Módulo CVS, selecione quaisquer dos módulos listados e clique em OK. Sua seleção é então adicionada no campo Módulo:
[.feature]
@@ -105,7 +107,7 @@
image::images/cvs-checkout-small.png[role="left", link="images/cvs-checkout.png"]
--
-[start=4]
+
1. No campo de texto Ramificação, insira o nome da ramificação para check-out. Clique no botão Procurar para abrir a caixa de diálogo Procurar Tags e pesquise as ramificações e tags disponíveis. Caso você não especifique uma ramificação ou uma tag, o _trunk_ será submetido a check-out.
2. No campo Pasta Local, insira um local em seu computador onde deseja fazer check-out dos arquivos e, em seguida, clique em Finalizar para iniciar o check-out de CVS. O IDE faz check-out dos códigos-fonte especificado e a barra de status do IDE indica o andamento do download dos arquivos do repositório para seu diretório de trabalho local. Você também pode exibir os arquivos que estão sendo submetidos a check-out na janela de Saída (Ctrl-4).
@@ -129,7 +131,7 @@
image::images/folder-to-import-small.png[role="left", link="images/folder-to-import.png"]
--
-[start=4]
+
1. Na área de texto Importar Mensagem, insira uma descrição do projeto que está importando no repositório.
2. Especifique a localização no repositório onde deseja importar o projeto ao digitar o caminho no campo de texto Pasta do Repositório. Se preferir, clique no botão Procurar para navegar para uma localização específica no repositório. Clique em Finalizar para iniciar a importação. O IDE fará upload dos arquivos do projeto para o repositório e a janela de Saída será aberta e exibirá o andamento.
@@ -236,7 +238,7 @@
image::images/cvs-options-small.png[role="left", link="images/cvs-options.png"]
--
-[start=3]
+
1. Clique no botão Adicionar Variável à direita do campo de texto Formato do Label de Status. Na caixa de diálogo Adicionar Variável que é exibida, selecione a variável `{revision}` e clique em OK. A variável revision é adicionada ao campo de texto Formato do label de status.
2. Para reformatar os labels de status de forma que somente o seletor de status e de revisão seja exibido à direita dos arquivos, reorganize o conteúdo do campo de texto Formato do label de status para o seguinte:
@@ -401,13 +403,13 @@
NOTE: certifique-se de que os <<fileStatus,labels de status de arquivo>> estejam ativados (selecione Exibir > Mostrar Labels de Controle de Versão a partir do menu principal).
-[start=2]
+
1. Editar arquivos, adicionar arquivos, deletar arquivos. Confirmar todas as alterações.
2. Quando a nova funcionalidade estiver pronta, alterne de volta para o tronco. Você precisa estar trabalhando na ramificação de destino (ou seja, o tronco neste caso) ao desejar executar uma mesclagem entre as duas ramificações. Clique com o botão direito do mouse no nó do projeto e escolha CVS > Alternar para a Ramificação. Na caixa de diálogo que é exibida, selecione Alternar para o Tronco e clique em Alternar.
O IDE alterna a localização do repositório de destino para o tronco. Na janela Projetos, observe que os labels de status do arquivo são automaticamente atualizados para refletir seu novo local de trabalho.
-[start=4]
+
1. Para executar a mesclagem, clique com o botão direito do mouse no nó do projeto e escolha CVS > Mesclar Alterações da Ramificação. Na caixa de diálogo que é exibida, observe que o campo Mesclar Alterações para Ramificação de Trabalho contém `Tronco`, indicando sua localização de trabalho atual.
Na caixa de diálogo, especifique os seguintes critérios:
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/cvs_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/cvs_ru.asciidoc
index bb3d986..ea5a46c 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/cvs_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/cvs_ru.asciidoc
@@ -73,7 +73,9 @@
1. В IDE NetBeans в главном меню выберите 'Группа' > 'CVS' > 'Извлечь'. Откроется мастер взятия для изменения.
*Примечание. *Раскрывающееся меню IDE являются контекстно-зависимыми, т.е. доступные параметры зависят от текущего выбранного элемента. Поэтому, если вы уже работаете в проектом с использованием CVS, в главном меню можно выбрать "Контроль версий" > "Взятие для изменения".
-2. На первой панели мастера введите местоположение репозитория, которое может быть определено переменной `CVSROOT`:
+
+[start=2]
+. На первой панели мастера введите местоположение репозитория, которое может быть определено переменной `CVSROOT`:
Среда IDE поддерживает несколько форматов `CVSROOT`, которые зависят от того, является ли репозиторий CVS локальным или удаленным, и от того, какой метод используется для подключения к нему.
@@ -97,7 +99,7 @@
Для получения дополнительной информации о доступе к локальным репозиториям см. страницу link:http://wiki.netbeans.org/wiki/view/FaqHowToAccessLocalCVS[+How can I access local repositories? (Как получить доступ к локальным репозиториям?)+]
-[start=3]
+
1. На панели "Модули для взятия" мастера укажите модуль, который необходимо взять для изменения, в поле "Модуль". Если название модуля неизвестно, нажмите кнопку "Обзор" для просмотра содержимого репозитория. В появившемся диалоговом окне "Выбор модуля CVS" выберите модуль из списка и нажмите кнопку "ОК". Выбранный модуль будет добавлен в поле "Модуль".
[.feature]
@@ -105,7 +107,7 @@
image::images/cvs-checkout-small.png[role="left", link="images/cvs-checkout.png"]
--
-[start=4]
+
1. В текстовом поле "Ветвь" введите имя ветви для получения. Можно также нажать кнопку "Обзор" для открытия диалогового окна "Выбор тега" и поиска доступных ветвей и тегов. Если ветвь или тег не будут указаны, будет выполнено получение _главной ветви_.
2. В поле "Локальная папка" введите местоположение на своем компьютере, в которое необходимо сохранить взятые файлы, затем нажмите кнопку "Готово", чтобы начать процесс взятия файлов для изменения в CVS. Среда IDE берёт указанные исходные файлы для изменения. Строка состояния среды IDE в правом нижнем углу показывает состояние загрузки файлов из репозитория в локальный каталог. Также можно просмотреть получаемые файлы в окне "Вывод" (Ctrl-4).
@@ -129,7 +131,7 @@
image::images/folder-to-import-small.png[role="left", link="images/folder-to-import.png"]
--
-[start=4]
+
1. В текстовом блоке "Сообщение импорта" введите описание проекта, импортируемого в репозиторий.
2. Укажите местоположение в репозитории, куда необходимо импортировать проект, введя путь в текстовом поле "Папка репозитория". Можно также нажать кнопку "Обзор" и перейти к определенному местоположению в репозитории. Чтобы начать процесс импорта, нажмите "Готово". Среда IDE выгружает файлы проекта в репозиторий, а в открывшемся окне вывода отображается состояние импорта.
@@ -236,7 +238,7 @@
image::images/cvs-options-small.png[role="left", link="images/cvs-options.png"]
--
-[start=3]
+
1. Нажмите кнопку "Добавить переменную" справа от текстового поля "Формат ярлыка состояния". В открывшемся диалоговом окне" Добавление переменной" выберите переменную`{revision}` и нажмите "ОК". Переменная revision добавляется в текстовое поле "Формат ярлыка состояния".
2. Чтобы изменить формат ярлыка состояния так, чтобы справа от файлов отображались только состояние и номер редакции, измените порядок значений в текстовом поле "Формат ярлыка состояния" следующим образом:
@@ -401,13 +403,13 @@
*Примечание. *Убедитесь в том, что <<fileStatus,ярлыки состояния файлов>> включены (в главном меню выберите "Вид" > "Показать ярлыки версий").
-[start=2]
+
1. Измените, добавьте и удалите файлы. Зафиксируйте изменения.
2. Когда новая функция будет готова, перейдите назад в главную ветвь. Для выполнения операции слияния между двумя ветвями необходимо, чтобы вы работали в целевой ветви (в данном случае, главной ветви). Щелкните узел проекта правой кнопкой мыши и выберите "CVS" > "Переключиться на ветвь". В открывшемся диалоговом окне выберите "Переключиться на главную ветвь" и нажмите кнопку "Переключить".
Среда IDE переключит целевое местоположение в репозитории на главную ветвь. В окне 'Проекты' обратите внимание, что метки состояния автоматически обновляются для отражения нового рабочего местоположения.
-[start=4]
+
1. Для выполнения слияния щелкните правой кнопкой мыши узел проекта и выберите CVS > 'Слияние изменений из ветви'. Обратите внимание, что в открывшемся диалоговом окне в поле "Слить изменения в текущую ветвь" выбрано значение `Главная ветвь`, указывающее на ваше текущее рабочее местоположение.
В диалоговом окне укажите следующие критерии.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/cvs_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/cvs_zh_CN.asciidoc
index 5e64fab..4bc142f 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/cvs_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/cvs_zh_CN.asciidoc
@@ -74,7 +74,7 @@
*注:*IDE 的下拉菜单是与上下文相关的,即可用选项取决于当前选定的项。因此,如果您已在使用 CVS 项目,则可以从主菜单中选择 "Versioning"(版本控制)> "Checkout"(检出)。
-[start=2]
+
1. 在向导的第一个面板中,输入由 `CVSROOT` 定义的资源库位置。
IDE 支持多种 `CVSROOT` 格式,这取决于 CVS 资源库是本地还是远程的,以及连接该资源库所用的方法:
@@ -99,7 +99,7 @@
如需获得访问本地资源库的更多帮助,请参见:link:http://wiki.netbeans.org/wiki/view/FaqHowToAccessLocalCVS[+如何访问本地资源库?+]
-[start=3]
+
1. 在向导的 "Modules to Checkout"(要检出的模块)面板的 "Module"(模块)字段中,指定要检出的模块。如果不知道要检出的模块的名称,请单击 "Browse"(浏览)按钮,以查看资源库的内容。在显示的 "Browse CVS Module"(浏览 CVS 模块)对话框中,选择任意已列出的模块,然后单击 "OK"(确定)。此后会将所选内容添加到 "Module"(模块)字段中:
[.feature]
@@ -107,7 +107,7 @@
image::images/cvs-checkout-small.png[role="left", link="images/cvs-checkout.png"]
--
-[start=4]
+
1. 在 "Branch"(分支)文本字段中,输入要检出的分支的名称。您可以单击 "Browse"(浏览)按钮打开 "Browse Tags"(浏览标记)对话框,以搜索可用的分支和标记。如果未指定分支或标记,则会检出_主干_。
2. 在 "Local Folder"(本地文件夹)字段中,输入计算机上要将文件检出到的位置,然后单击 "Finish"(完成),以启动 CVS 检出。IDE 将检出指定的源,而在右下角显示其状态栏,指示文件从资源库下载到本地目录的进度。此外,也可以在 "Output"(输出)窗口(Ctrl-4 组合键)中查看正在检出的文件。
@@ -131,7 +131,7 @@
image::images/folder-to-import-small.png[role="left", link="images/folder-to-import.png"]
--
-[start=4]
+
1. 在 "Import Message"(导入消息)文本区域中,输入要导入资源库中的项目的描述。
2. 在 "Repository Folder"(资源库文件夹)文本字段中键入路径,以指定资源库中要导入项目的位置。或者,单击 "Browse"(浏览)按钮,以导航至资源库中的特定位置。单击 "Finish"(完成)以启动导入操作。IDE 会将项目文件上载到资源库中,并打开 "Output"(输出)窗口以显示进度。
@@ -238,7 +238,7 @@
image::images/cvs-options-small.png[role="left", link="images/cvs-options.png"]
--
-[start=3]
+
1. 单击 "Status Label Format"(状态标签格式)文本字段右侧的 "Add Variable"(添加变量)按钮。在显示的 "Add Variable"(添加变量)对话框中,选择 `{revision}` 变量,然后单击 "OK"(确定)。此时修订版本变量将添加到 "Status Label Format"(状态标签格式)文本字段中。
2. 要重新设置状态标签的格式,以在文件右侧仅显示状态和修订版本,可按下列顺序重新排列 "Status Label Format"(状态标签格式)文本字段的内容:
@@ -403,13 +403,13 @@
*注:*确保激活了<<fileStatus,文件状态标签>>(从主菜单中选择 "View"(视图)> "Show Versioning Labels"(显示版本控制标签))。
-[start=2]
+
1. 编辑文件,添加文件,删除文件。提交所有更改。
2. 新功能准备就绪后,切换回主干。如果要在两个分支之间进行合并,使用的必须是目标分支(即,在这种情况下为主干)。右键单击项目节点,然后选择 "CVS" > "Switch to Branch"(切换到分支)。在显示的对话框中,选择 "Switch to Trunk"(切换到主干),然后单击 "Switch"(切换)。
IDE 会将目标资源库位置切换至主干。在 "Projects"(项目)窗口中,注意文件状态标签会自动更新,以反映新的工作位置。
-[start=4]
+
1. 要进行合并,请右键单击项目节点,然后选择 "CVS" > "Merge Changes from Branch"(合并分支中的更改)。在显示的对话框中,您会看到 "Merge Changes Into Working Branch"(将更改合并到工作分支)字段中包含 `Trunk`,这指示当前工作位置。
在该对话框中,指定以下条件:
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/git.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/git.asciidoc
index a3a61bb..7b84a10 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/git.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/git.asciidoc
@@ -43,7 +43,7 @@
--
image::images/initialize-git-repo-small.png[role="left", link="images/initialize-git-repo.png"]
--
-[start=3]
+
1. Specify the path to the repository you are going to store your versioned files in the ``Initialize a Git Repository `` dialog box or click Browse and browse for the directory required.
2. Click OK.
@@ -67,7 +67,7 @@
--
image::images/clone-wizard-small.png[role="left", link="images/clone-wizard.png"]
--
-[start=2]
+
1. At the Repository page, specify the path to a Git repository location, user name and password (you can save them for the future if required).
2. (Optional) Click Proxy Configuration to display the Options dialog box and set the proxy server settings. Click OK when finished.
3. Click Next to switch to the next step of the wizard.
@@ -82,7 +82,8 @@
``origin`` is the default alias of the repository being cloned. It is a recommended value.
* Leave the Scan for NetBeans Projects after Clone checkbox selected to activate after-scanning right after the clone finishes. (The plugin searches for NetBeans projects in the cloned resources and offers to open the found projects.)
-[start=7]
+
+[start=1]
1. Click Finish.
After a Git repository is cloned, the metadata ``.git`` folder is created inside the folder you selected in the wizard.
@@ -101,25 +102,25 @@
* Enter the passphrase for the key file, for example, ``abcd``.
* (Optional) Select the Save Passphrase option if required.
-[start=6]
-1. (*Applies if using SSH-agent or Pageant for automated SSH access to the Git server.*) Leave the Private Key File and Passphrase fields empty to get authenticated access from the IDE to the Git server via correctly configured SSH-agent or Pageant.
-2. (Optional) Click Proxy Configuration to display the Options dialog box and set the proxy server settings. Click OK when finished.
+
+. (*Applies if using SSH-agent or Pageant for automated SSH access to the Git server.*) Leave the Private Key File and Passphrase fields empty to get authenticated access from the IDE to the Git server via correctly configured SSH-agent or Pageant.
+. (Optional) Click Proxy Configuration to display the Options dialog box and set the proxy server settings. Click OK when finished.
[.feature]
--
image::images/github-repo-small.png[role="left", link="images/github-repo.png"]
--
-[start=8]
-1. Click Next.
-2. At the Remote Branches page, select the repository branch(es) to be fetched (downloaded) to your local repository, for example ``master`` .
+
+. Click Next.
+. At the Remote Branches page, select the repository branch(es) to be fetched (downloaded) to your local repository, for example ``master`` .
[.feature]
--
image::images/github-branches-small.png[role="left", link="images/github-branches.png"]
--
-[start=10]
-1. Click Next.
-2. At the Destination Directory page, specify the following:
+
+. Click Next.
+. At the Destination Directory page, specify the following:
* In the Parent Directory field, the path to the directory intended for the cloned repository on your hard drive (alternatively, click the Browse button and navigate to the directory).
The Parent Directory field is pre-filled with the path to the default ``NetBeansProjects`` directory where all NetBeans projects are stored.
* In the Clone Name field, the name of the local folder where the original project will be cloned to.
@@ -133,12 +134,12 @@
--
image::images/github-destination-small.png[role="left", link="images/github-destination.png"]
--
-[start=12]
+
1. Click Finish.
After the repository is cloned, the Clone Completed message displays.
image::images/clone-completed.png[]
-[start=13]
+
1. Choose the desired option.
=== Adding Files to a Git Repository
@@ -154,22 +155,36 @@
1. In the Projects window, right-click the file you want to add.
-2. In the context menu, choose ``Git`` > ``Add`` . This adds the file contents to the Index before you commit it.
-3. In the Projects window, right-click the file you want to commit.
+[start=2]
+. In the context menu, choose ``Git`` > ``Add`` . This adds the file contents to the Index before you commit it.
-4. In the Commit dialog box, select the Changes between HEAD and Index ( image::images/changes-head-index.png[] ) toggle button. This displays the list of files that are already staged.
-5. Commit the file(s) as described in the <<committing,Committing Sources to a Repository>> section below.
+[start=3]
+. In the Projects window, right-click the file you want to commit.
+
+
+[start=4]
+. In the Commit dialog box, select the Changes between HEAD and Index ( image::images/changes-head-index.png[] ) toggle button. This displays the list of files that are already staged.
+
+
+[start=5]
+. Commit the file(s) as described in the <<committing,Committing Sources to a Repository>> section below.
|
1. In the Projects window, right-click the file you want to commit.
-2. In the context menu, choose ``Git`` > ``Commit`` .
-3. In the Commit dialog box, select the Select the Changes between HEAD and Working Tree (image::images/changes-head-wt.png[]) toggle button. This displays the list of files that are not staged.
+[start=2]
+. In the context menu, choose ``Git`` > ``Commit`` .
-4. Commit the file(s) as described in the <<committing,Committing Sources to a Repository>> section below.
+
+[start=3]
+. In the Commit dialog box, select the Select the Changes between HEAD and Working Tree (image::images/changes-head-wt.png[]) toggle button. This displays the list of files that are not staged.
+
+
+[start=4]
+. Commit the file(s) as described in the <<committing,Committing Sources to a Repository>> section below.
|===
@@ -409,7 +424,7 @@
The ``Revert Modifications`` dialog box displays.
image::images/revert.png[]
-[start=3]
+
1. Specify additional options (e.g., ``Revert only Uncommitted Changes in Index to HEAD`` ) .
2. Click Revert.
@@ -456,13 +471,13 @@
* ``Update Issue`` section intended for tracking issues related to the change being committed.
NOTE: You need to install the JIRA or Subversion plugin to start tracking issues in the IDE.
-[start=3]
+
1. Type in a commit message in the ``Commit Message`` text area. Alternatively, you can do any of the following:
* click the ``Recent Messages`` ( image::images/recent-msgs.png[] ) icon located in the upper right corner to view and select from a list of messages that you have previously used,
* click the ``Load Template`` (image::images/msg-template.png[]) icon located in the upper right corner to select a message template.
-[start=4]
-1. After specifying actions for individual files, click ``Commit`` .
+
+. After specifying actions for individual files, click ``Commit`` .
The IDE executes the commit and stores your snapshots to the repository. The IDE's status bar, located in the bottom right of the interface, displays as the commit action takes place. Upon a successful commit, versioning badges disappear in the ``Projects`` , ``Files`` and ``Favorites`` windows, and the color coding of committed files returns to black.
== Working with Branches
@@ -491,7 +506,7 @@
--
image::images/create-branch-small.png[role="left", link="images/create-branch.png"]
--
-[start=3]
+
1. In the Branch Name field, enter the name of the branch being created.
2. Type a specific revision of the selected item by entering a commit ID, existing branch, or tag name in the Revision field or press Select to view the list of revisions maintained in the repository.
3. (Optional) In the Select Revision dialog box, expand Branches and choose the branch required, specify the commit ID in the adjacent list, and press Select.
@@ -516,12 +531,12 @@
--
image::images/chkout-rev-small.png[role="left", link="images/chkout-rev.png"]
--
-[start=2]
+
1. Specify the revision required by entering a commit ID, existing branch, or tag name in the Revision field or press Select to view the list of revisions maintained in the repository.
2. Skip if you did not press Select in the previous step. In the Select Revision dialog box, expand Branches and choose the branch required, specify the commit ID in the adjacent list if required, and press Select.
NOTE: If the specified revision refers to a valid commit that is not marked with a branch name, your HEAD becomes detached and you are no longer on any branch.
-[start=4]
+
1. Review the Commit ID, Author, Message fields information specific to the revision being checked out.
2. To create a new branch out of the checked out revision, choose the Checkout as New Branch option and enter the name in the Branch Name field.
3. Press Checkout to check out revision.
@@ -538,14 +553,14 @@
--
image::images/chkout-path-small.png[role="left", link="images/chkout-path.png"]
--
-[start=2]
+
1. Choose the Update Index with Entries from the Selected Revision option.
If selected, the Index is updated with the state in the selected revision prior to the checkout itself (i.e., the selected files both in the Working Tree and Index are updated).
-[start=3]
-1. Specify the revision required by entering a commit ID, existing branch, or tag name in the Revision field or press Select to view the list of revisions maintained in the repository.
-2. Skip if you did not press Select in the previous step. In the Select Revision dialog box, expand Branches and choose the branch required, specify the revision number in the adjacent list if required, and press Select.
-3. Press Checkout to complete the checkout.
+
+. Specify the revision required by entering a commit ID, existing branch, or tag name in the Revision field or press Select to view the list of revisions maintained in the repository.
+. Skip if you did not press Select in the previous step. In the Select Revision dialog box, expand Branches and choose the branch required, specify the revision number in the adjacent list if required, and press Select.
+. Press Checkout to complete the checkout.
=== Merging
@@ -558,7 +573,7 @@
--
image::images/merge-small.png[role="left", link="images/merge.png"]
--
-[start=2]
+
1. Specify the revision required by entering a commit ID, existing branch, or tag name in the Revision field or press Select to view the list of revisions maintained in the repository.
2. Skip if you did not press Select in the previous step. In the Select Revision dialog box, expand Branches and choose the branch required, specify the commit ID in the adjacent list if required, and press Select.
3. Press Merge.
@@ -576,7 +591,7 @@
2. In the Git Repository Browser, choose the branch to be deleted.
NOTE: The branch must be inactive, i.e. not currently checked out into the Working Tree.
-[start=3]
+
1. Right-click the selected branch and choose Delete Branch from the popup menu.
2. In the Delete Branch dialog box, press OK to confirm the branch deletion.
The branch is removed from the local repository as well as the Git Repository Browser.
@@ -602,7 +617,7 @@
--
image::images/fetch-small.png[role="left", link="images/fetch.png"]
--
-[start=2]
+
1. At the Remote Repository page of the wizard, select either the Configured repository (to use the path to the repository configured earlier) or Specify Git Repository Location option (to define the path to a remote repository that has not been accessed yet, its name, login, password, and proxy configuration if required) and click Next.
2. At the Remote Branches page of the wizard, choose the branches to fetch changes from and click Finish.
A local copy of a remote branch is created. The selected branch are updated in the ``Branches`` > ``Remote`` directory in the Git Repository Browser.
@@ -620,7 +635,7 @@
--
image::images/pull-small.png[role="left", link="images/pull.png"]
--
-[start=2]
+
1. At the Remote Repository page of the wizard, select either the Configured repository (to use the path to the repository configured earlier) or Specify Git Repository Location option (to define the path to a remote repository that has not been accessed yet, its name, and login and password if required) and click Next.
2. At the Remote Branches page of the wizard, choose the branches to be pulled changes from and click Finish.
Your local repository is synchronized with the origin repository.
@@ -638,7 +653,7 @@
--
image::images/push-small.png[role="left", link="images/push.png"]
--
-[start=2]
+
1. At the Remote Repository page of the wizard, select either the Configured repository (to use the path to the repository configured earlier) or Specify Git Repository Location option (to define the path to a remote repository that has not been accessed yet, its name, and login and password if required) and click Next.
2. At the Select Local Branches page, choose the branch(es) to push your edits to and click Next.
3. At the Update Local References page, choose the branch(es) to be updated in the Remotes directory of your local repository and click Finish.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/git_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/git_ja.asciidoc
index fedf24f..fe7e884 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/git_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/git_ja.asciidoc
@@ -85,7 +85,7 @@
image::images/initialize-git-repo-small.png[role="left", link="images/initialize-git-repo.png"]
--
-[start=3]
+
1. 「 ``Gitリポジトリの初期化`` 」ダイアログ・ボックスで、バージョン管理されるファイルの保存先リポジトリへのパスを指定するか、「参照」をクリックして、必要なディレクトリを参照します。
2. 「OK」をクリックします。
@@ -112,7 +112,7 @@
image::images/clone-wizard-small.png[role="left", link="images/clone-wizard.png"]
--
-[start=2]
+
1. リポジトリ・ページで、Gitリポジトリの場所へのパス、ユーザー名、およびパスワードを指定します(必要に応じて、今後のためにそれらを保存できます)。
2. (オプション)「プロキシ構成」をクリックし、「オプション」ダイアログ・ボックスを表示して、プロキシ・サーバー設定を設定します。終了したら「OK」をクリックします。
3. 「次」をクリックして、ウィザードの次のステップに切り替えます。
@@ -127,8 +127,8 @@
``origin`` はクローンするリポジトリのデフォルトのエイリアスです。これは推奨される値です。
* 「クローン後にNetBeansプロジェクトをスキャン」チェックボックスを選択されたままにして、クローンの終了直後に、事後スキャンをアクティブ化します。(プラグインはクローンされたリソースでNetBeansプロジェクトを検索し、見つかったプロジェクトを開くように提案します。)
-[start=7]
-1. 「終了」をクリックします。
+
+. 「終了」をクリックします。
Gitリポジトリのクローン後、ウィザードで選択したフォルダ内にメタデータ ``.git`` フォルダが作成されます。
@@ -144,38 +144,39 @@
4. 「秘密/公開鍵」オプションを選択します。
5. (*Gitサーバーへの自動化されたSSHアクセスにSSHエージェントまたはPageantを使用中の場合はスキップします。*)SSH秘密鍵およびパス・フレーズを使用してGitサーバーにアクセスするには次の手順を実行します。
+
[start=1]
1. 鍵ファイルへのパス、たとえば ``C:\Users\key`` などを指定します。
*注意:* OpenSSH秘密鍵形式が必要です。Microsoft Windowsに対応のPuTTYgenで生成された鍵は、IDEを使用する前に、OpenSSH形式に変換する必要があります。
-[start=2]
-1. 鍵ファイルのパス・フレーズ、たとえば ``abcd`` などを入力します。
-[start=3]
-1. (オプション)必要に応じて、「パス・フレーズを保存」オプションを選択します。
+. 鍵ファイルのパス・フレーズ、たとえば ``abcd`` などを入力します。
-[start=6]
-1. (*Gitサーバーへの自動化されたSSHアクセスにSSHエージェントまたはPageantを使用中の場合に適用されます。*)正しく構成されたSSHエージェントまたはPageant経由でIDEからGitサーバーへの認証されたアクセスを得るには、「秘密鍵ファイル」および「パス・フレーズ」フィールドを空のままにします。
-2. (オプション)「プロキシ構成」をクリックし、「オプション」ダイアログ・ボックスを表示して、プロキシ・サーバー設定を設定します。終了したら「OK」をクリックします。
+
+. (オプション)必要に応じて、「パス・フレーズを保存」オプションを選択します。
+
+
+. (*Gitサーバーへの自動化されたSSHアクセスにSSHエージェントまたはPageantを使用中の場合に適用されます。*)正しく構成されたSSHエージェントまたはPageant経由でIDEからGitサーバーへの認証されたアクセスを得るには、「秘密鍵ファイル」および「パス・フレーズ」フィールドを空のままにします。
+. (オプション)「プロキシ構成」をクリックし、「オプション」ダイアログ・ボックスを表示して、プロキシ・サーバー設定を設定します。終了したら「OK」をクリックします。
[.feature]
--
image::images/github-repo-small.png[role="left", link="images/github-repo.png"]
--
-[start=8]
-1. 「次」をクリックします。
-2. リモート分岐ページで、ローカル・リポジトリにフェッチ(ダウンロード)するリポジトリ分岐、たとえば ``master`` などを選択します。
+
+. 「次」をクリックします。
+. リモート分岐ページで、ローカル・リポジトリにフェッチ(ダウンロード)するリポジトリ分岐、たとえば ``master`` などを選択します。
[.feature]
--
image::images/github-branches-small.png[role="left", link="images/github-branches.png"]
--
-[start=10]
-1. 「次」をクリックします。
-2. 出力先ディレクトリ・ページで、次を指定します。
+
+. 「次」をクリックします。
+. 出力先ディレクトリ・ページで、次を指定します。
* 「親ディレクトリ」フィールドでは、ハード・ドライブ上にクローンされるリポジトリ用のディレクトリへのパス(または、「参照」ボタンをクリックし、ディレクトリに移動する)。
「親ディレクトリ」フィールドには、すべてのNetBeansプロジェクトが格納されるデフォルトの ``NetBeansProjects`` ディレクトリへのパスが事前入力されています。
* 「クローン名」フィールドの、元のプロジェクトをクローンするローカル・フォルダの名前。
@@ -190,13 +191,13 @@
image::images/github-destination-small.png[role="left", link="images/github-destination.png"]
--
-[start=12]
+
1. 「終了」をクリックします。
リポジトリがクローンされると、「クローン完了」メッセージが表示されます。
image::images/clone-completed.png[]
-[start=13]
+
1. 目的のオプションを選択します。
@@ -214,11 +215,11 @@
1. 「プロジェクト」ウィンドウで、追加するファイルを右クリックします。
2. コンテキスト・メニューで「 ``Git`` 」>「 ``追加`` 」を選択します。
これにより、コミットする前に、ファイルの内容が索引に追加されます。
-[start=3]
+
1. 「プロジェクト」ウィンドウで、コミットするファイルを右クリックします。
2. 「コミット」ダイアログ・ボックスで、「HEADと索引間の変更」(image::images/changes-head-index.png[])トグル・ボタンを選択します。
これにより、すでにステージングされているファイルの一覧が表示されます。
-[start=5]
+
1. 下の<<committing,リポジトリへソースのコミット>>の項で説明するように、ファイルをコミットします。
|
@@ -226,7 +227,9 @@
2. コンテキスト・メニューで、「 ``Git`` 」>「 ``コミット`` 」を選択します。
3. 「コミット」ダイアログ・ボックスで、「索引と作業ツリー間の変更」(image::images/changes-head-wt.png[])トグル・ボタンを選択します。
これにより、ステージングされていないファイルの一覧が表示されます。
-4. 下の<<committing,リポジトリへソースのコミット>>の項で説明するように、ファイルをコミットします。
+
+[start=4]
+. 下の<<committing,リポジトリへソースのコミット>>の項で説明するように、ファイルをコミットします。
|===
@@ -462,7 +465,7 @@
image::images/revert.png[]
-[start=3]
+
1. 追加のオプション(「 ``索引のコミットされていない変更のみをHEADに戻す`` 」など)を指定します。
2. 「元に戻す」をクリックします。
@@ -509,13 +512,13 @@
*注意*: IDEで問題のトラックを開始するには、JIRAまたはSubversionプラグインをインストールする必要があります。
-[start=3]
+
1. 「 ``コミット・メッセージ`` 」テキスト領域にコミット・メッセージを入力します。または、次のいずれかを実行できます。
* 右上隅にある「 ``最近のメッセージ`` 」(image::images/recent-msgs.png[])アイコンをクリックして、以前使用したメッセージのリストを表示して選択します。
* 右上隅にある「 ``テンプレートをロード`` 」(image::images/msg-template.png[])アイコンをクリックして、メッセージ・テンプレートを選択します。
-[start=4]
-1. 個々のファイルのアクションを指定して「 ``コミット`` 」をクリックします。
+
+. 個々のファイルのアクションを指定して「 ``コミット`` 」をクリックします。
IDEによってコミットが実行され、スナップショットがリポジトリに保存されます。コミット・アクションが実行されると、インタフェースの右下にあるIDEのステータス・バーが表示されます。コミットに成功すると、「 ``プロジェクト`` 」、「 ``ファイル`` 」および「 ``お気に入り`` 」ウィンドウのバージョン管理バッジが消え、コミットされたファイルの色分けが黒に戻ります。
@@ -547,7 +550,7 @@
image::images/create-branch-small.png[role="left", link="images/create-branch.png"]
--
-[start=3]
+
1. 「分岐名」フィールドで、作成する分岐の名前を入力します。
2. コミットID、既存の分岐、またはタグ名を「リビジョン」フィールドに入力して、選択した項目の特定のリビジョンを入力するか、「選択」を押して、リポジトリで管理されているリビジョンの一覧を表示します。
3. (オプション)「リビジョンを選択」ダイアログ・ボックスで、「分岐」を展開し、必要な分岐を選択して、隣接する一覧のコミットIDを指定し、「選択」を押します。
@@ -574,13 +577,13 @@
image::images/chkout-rev-small.png[role="left", link="images/chkout-rev.png"]
--
-[start=2]
+
1. コミットID、既存の分岐またはタグ名を「リビジョン」フィールドに入力して、必要なリビジョンを指定するか、「選択」を押して、リポジトリで管理されているリビジョンの一覧を表示します。
2. 前のステップで「選択」を押さなかった場合、スキップします。「リビジョンを選択」ダイアログ・ボックスで、「分岐」を展開し、必要な分岐を選択して、必要に応じて、隣接する一覧のコミットIDを指定し、「選択」を押します。
*注意:* 指定したリビジョンが分岐名でマークされていない有効なコミットを表している場合、HEADがデタッチされ、分岐上にいなくなります。
-[start=4]
+
1. チェックアウトされるリビジョンに固有の「コミットID」、「作成者」、「メッセージ」フィールド情報を確認します。
2. チェックアウトしたリビジョンから新しい分岐を作成するには、「新しい分岐としてチェックアウト」オプションを選択し、「分岐名」フィールドに名前を入力します。
3. 「チェックアウト」を押して、リビジョンをチェックアウトします。
@@ -598,12 +601,18 @@
image::images/chkout-path-small.png[role="left", link="images/chkout-path.png"]
--
-[start=2]
+
1. 「選択されたリビジョンからのエントリで索引を更新」オプションを選択します。
選択した場合、チェックアウト前に選択したリビジョンの状態で索引が更新されます(作業ツリーと索引の両方の選択したファイルが更新されます)。
-2. コミットID、既存の分岐またはタグ名を「リビジョン」フィールドに入力して、必要なリビジョンを指定するか、「選択」を押して、リポジトリで管理されているリビジョンの一覧を表示します。
-3. 前のステップで「選択」を押さなかった場合、スキップします。「リビジョンを選択」ダイアログ・ボックスで、「分岐」を展開し、必要な分岐を選択して、必要に応じて、隣接する一覧のリビジョン番号を指定し、「選択」を押します。
-4. 「チェックアウト」を押して、チェックアウトを完了します。
+
+[start=2]
+. コミットID、既存の分岐またはタグ名を「リビジョン」フィールドに入力して、必要なリビジョンを指定するか、「選択」を押して、リポジトリで管理されているリビジョンの一覧を表示します。
+
+[start=3]
+. 前のステップで「選択」を押さなかった場合、スキップします。「リビジョンを選択」ダイアログ・ボックスで、「分岐」を展開し、必要な分岐を選択して、必要に応じて、隣接する一覧のリビジョン番号を指定し、「選択」を押します。
+
+[start=4]
+. 「チェックアウト」を押して、チェックアウトを完了します。
=== マージ
@@ -618,7 +627,7 @@
image::images/merge-small.png[role="left", link="images/merge.png"]
--
-[start=2]
+
1. コミットID、既存の分岐またはタグ名を「リビジョン」フィールドに入力して、必要なリビジョンを指定するか、「選択」を押して、リポジトリで管理されているリビジョンの一覧を表示します。
2. 前のステップで「選択」を押さなかった場合、スキップします。「リビジョンを選択」ダイアログ・ボックスで、「分岐」を展開し、必要な分岐を選択して、必要に応じて、隣接する一覧のコミットIDを指定し、「選択」を押します。
3. 「マージ」を押します。
@@ -638,7 +647,7 @@
*注意:* 分岐は非アクティブである、つまり現在作業ツリーにチェックアウトされていない必要があります。
-[start=3]
+
1. 選択した分岐を右クリックし、ポップアップ・メニューから「分岐を削除」を選択します。
2. 「分岐を削除」ダイアログ・ボックスで、「OK」を押して、分岐の削除を確認します。
分岐がローカル・リポジトリとGitリポジトリ・ブラウザから除去されます。
@@ -667,7 +676,7 @@
image::images/fetch-small.png[role="left", link="images/fetch.png"]
--
-[start=2]
+
1. ウィザードのリモート・リポジトリ・ページで、構成済のリポジトリ(以前に構成されたリポジトリへのパスを使用する)または「Gitリポジトリの場所を指定」オプション(必要に応じて、まだアクセスされていないリモート・リポジトリへのパス、その名前、ログイン、パスワード、およびプロキシ構成を定義する)を選択し、「次」をクリックします。
2. ウィザードのリモート分岐ページで、変更をフェッチする分岐を選択し、「終了」をクリックします。
リモート分岐のローカル・コピーが作成されます。Gitリポジトリ・ブラウザの「 ``分岐`` 」>「 ``リモート`` 」ディレクトリで、選択した分岐が更新されます。
@@ -687,7 +696,7 @@
image::images/pull-small.png[role="left", link="images/pull.png"]
--
-[start=2]
+
1. ウィザードのリモート・リポジトリ・ページで、構成済のリポジトリ(以前に構成されたリポジトリへのパスを使用する)または「Gitリポジトリの場所を指定」オプション(必要に応じて、まだアクセスされていないリモート・リポジトリへのパス、その名前、ログインとパスワードを定義する)を選択し、「次」をクリックします。
2. ウィザードのリモート分岐ページで、変更がプルされる分岐を選択し、「終了」をクリックします。
ローカル・リポジトリが元のリポジトリと同期されます。
@@ -705,7 +714,7 @@
image::images/push-small.png[role="left", link="images/push.png"]
--
-[start=2]
+
1. ウィザードのリモート・リポジトリ・ページで、構成済のリポジトリ(以前に構成されたリポジトリへのパスを使用する)または「Gitリポジトリの場所を指定」オプション(必要に応じて、まだアクセスされていないリモート・リポジトリへのパス、その名前、ログインとパスワードを定義する)を選択し、「次」をクリックします。
2. ローカル分岐を選択ページで、編集をプッシュする分岐を選択し、「次」をクリックします。
3. ローカル参照を更新ページで、ローカル・リポジトリの「リモート」ディレクトリ内の更新する分岐を選択し、「終了」をクリックします。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/git_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/git_pt_BR.asciidoc
index 34c040d..28dba3e 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/git_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/git_pt_BR.asciidoc
@@ -64,7 +64,7 @@
image::images/initialize-git-repo-small.png[role="left", link="images/initialize-git-repo.png"]
--
-[start=3]
+
1. Especifique o caminho para o repositório em que você armazenará seus arquivos com controle de versão na caixa de diálogo ``Inicializar Repositório do Git`` ou clique em Procurar e navegue para o diretório necessário.
2. Clique em OK.
@@ -91,7 +91,7 @@
image::images/clone-wizard-small.png[role="left", link="images/clone-wizard.png"]
--
-[start=2]
+
1. Na página Repositório, especifique o caminho da localização do repositório Git, o nome de usuário e senha (você pode salvá-los para uso futura se necessário).
2. (Opcional) Clique em Configuração de Proxy para exibir a caixa de diálogo Opções e especificar as definições do servidor proxy. Clique em OK quando finalizar.
3. Clique em Próximo para ir para a próxima etapa do assistente.
@@ -105,7 +105,9 @@
* No campo Nome Remoto, o nome que representa o repositório original sendo clonado.
``origin`` é o apelido default do repositório sendo clonado. Esse é o valor recomendado.
* Deixe selecionada a caixa de seleção Varrer por projetos do NetBeans após clonar para ativar a pós-varredura assim que a clonagem finalizar. (O plug-in pesquisa projetos NetBeans nos recursos clonados e se oferece para abrir os projetos encontrados).
-6. Clique em Finalizar.
+
+[start=6]
+. Clique em Finalizar.
Após o repositório do Git ser clonado, a pasta de metadados ``.git`` é criada dentro da pasta selecionada no assistente.
@@ -121,34 +123,35 @@
4. Selecione a opção Chave privada/pública.
5. (*Ignorar se usar o agente SSH ou Pageant para acesso SSH automatizado para o servidor Git.*) Conclua as seguintes etapas para acessar o servidor Git usando a chave SSH privada e uma frase-senha:
+
[start=1]
1. Especifique o caminho para o arquivo da chave, por exemplo ``C:\Users\key`` .
NOTE: o formato da chave privada openssh é necessário. Chaves geradas por PuTTYgen para Microsoft Windows deve ser convertido para o formato openssh antes de usá-los no IDE.
-[start=2]
-1. Insira a senha para o arquivo da chave, por exemplo ``abcd`` .
-2. (Opcional) Selecione a opção Salvar Senha, se necessário.
-[start=6]
-1. (*Aplica-se se usar o agente SSH ou Pageant para acesso de SSH automatizado para o servidor Git.*) Deixe os campos Arquivo de Chave Privada e Frase-Senha vazios para obter acesso autenticado do IDE para o servidor Git, por meior de agente SSH ou Pageant configurado.
-2. (Opcional) Clique em Configuração de Proxy para exibir a caixa de diálogo Opções e especificar as definições do servidor proxy. Clique em OK quando finalizar.
+. Insira a senha para o arquivo da chave, por exemplo ``abcd`` .
+. (Opcional) Selecione a opção Salvar Senha, se necessário.
+
+
+. (*Aplica-se se usar o agente SSH ou Pageant para acesso de SSH automatizado para o servidor Git.*) Deixe os campos Arquivo de Chave Privada e Frase-Senha vazios para obter acesso autenticado do IDE para o servidor Git, por meior de agente SSH ou Pageant configurado.
+. (Opcional) Clique em Configuração de Proxy para exibir a caixa de diálogo Opções e especificar as definições do servidor proxy. Clique em OK quando finalizar.
[.feature]
--
image::images/github-repo-small.png[role="left", link="images/github-repo.png"]
--
-[start=8]
-1. Clique em Próximo.
-2. Na página Ramificações Remotas, selecione as ramificações de repositório a serem extraídas (por download) para seu repositório local; por exemplo, ``master`` .
+
+. Clique em Próximo.
+. Na página Ramificações Remotas, selecione as ramificações de repositório a serem extraídas (por download) para seu repositório local; por exemplo, ``master`` .
[.feature]
--
image::images/github-branches-small.png[role="left", link="images/github-branches.png"]
--
-[start=10]
+
. Clique em Próximo.
. Na página Diretório de Destino, especifique o seguinte:
* No campo Diretório-Pai, o caminho do diretório desejado para o repositório clonado em seu disco rígido (alternativamente, clique no botão Procurar e navegue para o diretório).
@@ -165,13 +168,13 @@
image::images/github-destination-small.png[role="left", link="images/github-destination.png"]
--
-[start=12]
+
. Clique em Finalizar.
Após o repositório ter sido clonado, a mensagem Clonagem Concluída é exibida.
image::images/clone-completed.png[]
-[start=13]
+
. Escolha a opção desejada.
@@ -197,7 +200,9 @@
2. No menu de contexto, escolha ``Git`` > ``Confirmar`` .
3. Na caixa de diálogo Confirmar, marque Selecionar as Alterações entre o botão de alternância Índice e Árvore de Trabalho (image::images/changes-head-wt.png[]).
Isso exibe uma lista dos arquivos que não estão em armazenamento temporário.
-4. Confirme os arquivos como descrito na seção <<committing,Confirmando Código-fonte em um Repositório>> abaixo.
+
+[start=4]
+. Confirme os arquivos como descrito na seção <<committing,Confirmando Código-fonte em um Repositório>> abaixo.
|===
@@ -433,7 +438,7 @@
image::images/revert.png[]
-[start=3]
+
. Especificar opções adicionais (por exemplo, ``Reverter Somente as Alterações Não Confirmadas no Índice para o HEAD`` ) .
. Clique em Reverter.
@@ -480,7 +485,7 @@
*Observação*: é preciso instalar o plug-in JIRA ou Subversion para iniciar o rastreamento de problemas no IDE.
-[start=3]
+
. Digite uma mensagem de confirmação na área de texto ``Mensagem de Confirmação`` . Alternativamente, você pode executar um dos seguintes procedimentos:
* clique no ícone ``Mensagens Recentes`` (image::images/recent-msgs.png[]) localizado no canto superior direito para ver e selecionar de uma lista de mensagens que você usou anteriormente existente.
* Clique no ícone ``Carregar Modelo`` (image::images/msg-template.png[]) localizado no canto superior direito para selecionar um modelo de mensagem.
@@ -516,7 +521,7 @@
image::images/create-branch-small.png[role="left", link="images/create-branch.png"]
--
-[start=3]
+
. No campo Nome da Ramificação, insira o nome da ramificação que está sendo criada.
. Especifique a revisão necessária ao inserir um ID de confirmação, ramificação existente, ou nome da tag no campo Revisão, ou pressione Selecionar para exibir uma lista das revisões mantidas no repositório.
. (Opcional) Na caixa de diálogo Selecionar Revisão, expanda Ramificações e escolha a ramificação necessária, especifique o ID de confirmar na lista adjacente e pressione Selecionar.
@@ -543,13 +548,13 @@
image::images/chkout-rev-small.png[role="left", link="images/chkout-rev.png"]
--
-[start=2]
+
. Especifique a revisão necessária ao inserir um ID de confirmação, uma ramificação existente ou o nome da tag no campo Revisão, ou pressione Selecionar para exibir uma lista das revisões mantidas no repositório.
. Ignore se você não pressionou Selecionar na etapa anterior. Na caixa de diálogo Selecionar Revisão, expanda Ramificações e escolha a ramificação necessária, especifique o ID de confirmação na lista adjacente, se necessário, e pressione Selecionar.
NOTE: se a revisão especificada se refere a uma confirmação válida que não esteja marcada com um nome de ramificação, seu HEAD se torna desanexado e você não mais está em nenhum ramificação.
-[start=4]
+
. Reveja as informações dos campos ID de Confirmação, Autor e Mensagem específicos da revisão cujo check-out está sendo feito.
. Para criar uma nova ramificação da versão submetida a check-out, escolha a opção Efetuar Check-out como uma Nova Ramificação e insira o nome no campo Nome da Ramificação.
. Pressione Check-out para fazer check-out da revisão.
@@ -567,7 +572,7 @@
image::images/chkout-path-small.png[role="left", link="images/chkout-path.png"]
--
-[start=2]
+
. Escolha a opção Atualizar Índice com Entradas da Revisão Selecionada.
Caso selecionado, o Índice é atualizado com o estado da revisão selecionada antes do check-out do arquivo (ou seja, os arquivos selecionados na Árvore de Trabalho e Índice são atualizados).
. Especifique a revisão necessária ao inserir um ID de confirmação, uma ramificação existente ou o nome da tag no campo Revisão, ou pressione Selecionar para exibir uma lista das revisões mantidas no repositório.
@@ -587,7 +592,7 @@
image::images/merge-small.png[role="left", link="images/merge.png"]
--
-[start=2]
+
. Especifique a revisão necessária ao inserir um ID de confirmação, uma ramificação existente ou o nome da tag no campo Revisão, ou pressione Selecionar para exibir uma lista das revisões mantidas no repositório.
. Ignore se você não pressionou Selecionar na etapa anterior. Na caixa de diálogo Selecionar Revisão, expanda Ramificações e escolha a ramificação necessária, especifique o ID de confirmação na lista adjacente, se necessário, e pressione Selecionar.
. Pressione Mesclar.
@@ -607,7 +612,7 @@
NOTE: a ramificação precisa estar inativa, ou seja, não deve ter tido check-out na Árvore de Trabalho.
-[start=3]
+
. Clique com o botão direito do mouse na ramificação selecionada e escolha Deletar Ramificação a partir do menu pop-up.
. Na caixa de diálogo Deletar Ramificação, pressione OK para confirmar a exclusão da ramificação.
A ramificação é removida do repositório local, assim como do Browser de Repositório Git.
@@ -636,7 +641,7 @@
image::images/fetch-small.png[role="left", link="images/fetch.png"]
--
-[start=2]
+
. Na página Repositório Remoto do assistente, selecione a opção Repositório configurado (para usar o caminho para o repositório anteriormente configurado) ou a opção Especificar Local do Repositório Git (para definir o caminho para um repositório remoto que ainda não foi acessado, seu nome, e login e senha, e qualquer configuração de proxy necessária) e clique em Próximo.
. Na página Ramificações Remotas do assistente, escolha as ramificações para obter as alterações e clique em Finalizar.
Uma cópia local da ramificação remota é criada. A ramificação selecionada é atualizada no diretório ``Ramificações`` > ``Remotas`` no Browser de Repositório Git.
@@ -656,7 +661,7 @@
image::images/pull-small.png[role="left", link="images/pull.png"]
--
-[start=2]
+
. Na página Repositório Remoto do assistente, selecione a opção Repositório configurado (para usar o caminho do repositório anteriormente configurado) ou Especificar a Localização do Repositório Git: (para definir o caminho de um repositório remoto que ainda não foi acessado, seu nome, log-in e senha, se necessário) e clique em Próximo.
. Na página Ramificações Remotas do assistente, escolha as ramificações a serem extraídas com as alterações e clique em Finalizar.
Seu repositório local é sincronizado com o repositório de origem.
@@ -674,7 +679,7 @@
image::images/push-small.png[role="left", link="images/push.png"]
--
-[start=2]
+
. Na página Repositório Remoto do assistente, selecione a opção Repositório configurado (para usar o caminho do repositório anteriormente configurado) ou Especificar a Localização do Repositório Git: (para definir o caminho de um repositório remoto que ainda não foi acessado, seu nome, log-in e senha, se necessário) e clique em Próximo.
. Na página Selecionar Ramificações Locais, escolha as ramificações de onde serão extraídas suas edições e clique em Próximo.
. Na página Atualizar Referências Locais, escolha as ramificações a serem atualizadas no diretório Remoto de seu repositório local e clique em Finalizar.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/git_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/git_ru.asciidoc
index adb458f..b47f00b 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/git_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/git_ru.asciidoc
@@ -64,7 +64,7 @@
image::images/initialize-git-repo-small.png[role="left", link="images/initialize-git-repo.png"]
--
-[start=3]
+
. В диалоговом окне ``Инициализировать репозиторий Git `` укажите путь к репозиторию, в котором будут храниться файлы с контролем версий, или щелкните "Обзор" и выберите требуемый каталог.
. Нажмите кнопку "ОК".
@@ -91,7 +91,7 @@
image::images/clone-wizard-small.png[role="left", link="images/clone-wizard.png"]
--
-[start=2]
+
. На странице "Репозиторий" укажите путь к местоположению репозитория Git, имя пользователя и пароль (при необходимости эти данные можно сохранить для использования в дальнейшем).
. (Не обязательно) Щелкните "Настройка прокси" для отображения диалогового окна "Параметры" и установите настройки сервера прокси. По завершении нажмите кнопку "ОК".
. Нажмите кнопку "Далее" для перехода к следующему действию мастера.
@@ -106,7 +106,7 @@
По умолчанию для клонируемого репозитория используется псевдоним ``origin`` . Рекомендуется использовать это значение.
* Оставьте установленным флажок "Поиск проектов Netbeans после клонирования", чтобы поиск проектов выполнялся непосредственно после окончания клонирования. (Этот подключаемый модуль выполняет поиск проектов NetBeans в клонированных ресурсах и предлагает открыть обнаруженные проекты.)
-[start=7]
+
. Нажмите кнопку "Завершить".
По завершении клонирования репозитория Git создается папка ``.git`` с метаданными в папке, выбранной на соответствующем шаге мастера.
@@ -136,7 +136,7 @@
image::images/github-repo-small.png[role="left", link="images/github-repo.png"]
--
-[start=8]
+
. Нажмите кнопку "Далее".
. На странице "Удаленные ветви" выберите ветвь(и) репозитория, которую(ые) требуется загрузить (или из которых надо загрузить изменения) в локальный репозиторий, например ``master`` .
@@ -145,7 +145,7 @@
image::images/github-branches-small.png[role="left", link="images/github-branches.png"]
--
-[start=10]
+
. Нажмите кнопку "Далее".
. На странице "Целевой каталог" укажите следующие данные.
* В поле "Родительский каталог" введите путь к каталогу на жестком диске, выбранному для размещения клонированного репозитория (или нажмите кнопку "Обзор" и выберите требуемый каталог).
@@ -162,13 +162,13 @@
image::images/github-destination-small.png[role="left", link="images/github-destination.png"]
--
-[start=12]
+
. Нажмите кнопку "Завершить".
По завершении клонирования репозитория отображается сообщение "Клонирование завершено".
image::images/clone-completed.png[]
-[start=13]
+
. Выберите требуемый параметр.
@@ -194,7 +194,9 @@
2. В контекстном меню выберите ``Git`` > ``Зафиксировать`` .
3. В диалоговом окне 'Фикировать' выберите кнопку переключения 'Выбрать изменения' для взаимных изменений между индексом и рабочим деревом ( image::images/changes-head-wt.png[] ).
Отобразится список файлов, еще не помещенных на подготовку.
-4. Выполните фиксацию файлов, как описано ниже в разделе <<committing,Фиксация исходных кодов в репозитории>>.
+
+[start=4]
+. Выполните фиксацию файлов, как описано ниже в разделе <<committing,Фиксация исходных кодов в репозитории>>.
|===
@@ -431,7 +433,7 @@
image::images/revert.png[]
-[start=3]
+
. Укажите дополнительные параметры (например, ``Откатить в индексе только изменения, незафиксированные в HEAD`` ) .
. Щелкните "Откатить".
@@ -478,7 +480,7 @@
NOTE: Для запуска в среде IDE режима отслеживания проблем требуется установить подключаемый модуль для JIRA или Subversion.
-[start=3]
+
. Введите сообщение о фиксации в текстовую область ``Сообщение о фиксации`` . Можно также выполнить любое из следующих действий.
* щелкните значок ``Последние сообщения`` ( image::images/recent-msgs.png[] ), расположенный в правом верхнем углу, чтобы просмотреть и выбрать необходимое из ранее использованного списка сообщений.
* щелкните значок ``Загрузить шаблон`` ( image::images/msg-template.png[] ), расположенный в правом верхнем углу, чтобы выбрать шаблон сообщения.
@@ -514,7 +516,7 @@
image::images/create-branch-small.png[role="left", link="images/create-branch.png"]
--
-[start=3]
+
. В поле "Имя ветви" введите имя создаваемой ветви.
. Введите конкретную редакцию выбранного элемента. Для этого введите в поле "Редакция" идентификатор фиксации, существующую ветвь или имя тега, или нажмите кнопку "Выбрать" для просмотра списка редакций, обслуживаемых в репозитории.
. (Не обязательно) В диалоговом окне "Выбор редакции" раскройте "Ветви" и выберите требуемую ветвь; укажите идентификатор фиксации в соседнем списке и нажмите кнопку "Выбрать".
@@ -541,13 +543,13 @@
image::images/chkout-rev-small.png[role="left", link="images/chkout-rev.png"]
--
-[start=2]
+
. Чтобы указать требуемую редакцию, введите в поле "Редакция" идентификатор фиксации, существующую ветвь или имя тега, или же нажмите кнопку "Выбрать" для просмотра списка редакций, обслуживаемых в репозитории.
. Пропустите этот шаг, если в предыдущем шаге не нажимали кнопку "Выбрать". В диалоговом окне "Выбор редакции" раскройте "Ветви" и выберите требуемую ветвь. Если требуется, в соседнем списке укажите идентификатор фиксации и нажмите кнопку "Выбрать".
NOTE: Если указанный выпуск относится к допустимой фиксации, которая не отмечены именем ветви, HEAD отключается и пользователь бльше не принадлежит ветви.
-[start=4]
+
. В полях "Идентификатор фиксации", "Автор", "Сообщение" просмотрите информацию, относящуюся к извлекаемой редакции.
. Для создания новой ветви на основе извлеченной редакции выберите параметр "Извлечь в качестве новой ветви" и введите имя поле "Имя ветви".
. Для извлечения редакции нажмите кнопку "Извлечь".
@@ -565,7 +567,7 @@
image::images/chkout-path-small.png[role="left", link="images/chkout-path.png"]
--
-[start=2]
+
. Выберите вариант "Обновить индекс записями из выбранной редакции".
При выборе этого варианта индекс обновляется в соответствии с состоянием из выбранной редакции, прежде чем выполнять свое извлечение. Это означает, что выбранные файлы обновляются как в рабочем дереве, так и в индексе.
. Чтобы указать требуемую редакцию, введите в поле "Редакция" идентификатор фиксации, существующую ветвь или имя тега, или же нажмите кнопку "Выбрать" для просмотра списка редакций, обслуживаемых в репозитории.
@@ -585,7 +587,7 @@
image::images/merge-small.png[role="left", link="images/merge.png"]
--
-[start=2]
+
. Чтобы указать требуемую редакцию, введите в поле "Редакция" идентификатор фиксации, существующую ветвь или имя тега, или же нажмите кнопку "Выбрать" для просмотра списка редакций, обслуживаемых в репозитории.
. Пропустите этот шаг, если в предыдущем шаге не нажимали кнопку "Выбрать". В диалоговом окне "Выбор редакции" раскройте "Ветви" и выберите требуемую ветвь. Если требуется, в соседнем списке укажите идентификатор фиксации и нажмите кнопку "Выбрать".
. Нажмите "Слияние".
@@ -605,7 +607,7 @@
NOTE: Ветвь должна быть неактивной, т.е. в настоящее время не изъята в рабочее дерево.
-[start=3]
+
. Щелкните выбранную ветвь правой кнопкой мыши и во всплывающем меню выберите "Удалить ветвь".
. В диалоговом окне "Удаление ветви" нажмите кнопку "ОК" для подтверждения удаления.
Ветвь удаляется из локального репозитория и из браузера репозитория Git.
@@ -634,7 +636,7 @@
image::images/fetch-small.png[role="left", link="images/fetch.png"]
--
-[start=2]
+
. На странице мастера "Удаленный репозиторий" выберите репозиторий "Настроенный" (для использования настроенного ранее пути к репозиторию) или вариант "Указать местоположение репозитория Git" (чтобы определить путь к удаленному репозиторию, доступ к которому еще не осуществлялся, его имя, имя для входа, пароль и, если требуется, настройки прокси) и щелкните "Далее".
. На странице мастера "Удаленные ветви" выберите ветви для загрузки из них изменений и щелкните "Готово".
Создается локальная копия удаленной ветви. Выбранная ветвь обновляется в каталоге ``Ветви`` > ``Удаленная`` в браузере репозитория Git.
@@ -654,7 +656,7 @@
image::images/pull-small.png[role="left", link="images/pull.png"]
--
-[start=2]
+
. На странице мастера "Удаленный репозиторий" выберите репозиторий "Настроенный" (для использования настроенного ранее пути к репозиторию) или вариант "Указать местоположение репозитория Git" (чтобы определить путь к удаленному репозиторию, доступ к которому еще не осуществлялся, его имя и, если требуется, имя для входа и пароль) и щелкните "Далее".
. На странице мастера "Удаленные ветви" выберите ветви для загрузки из них изменений со слиянием с активной ветвью и нажмите кнопку "Готово".
Локальный репозиторий синхронизируется с исходным репозиторием.
@@ -672,7 +674,7 @@
image::images/push-small.png[role="left", link="images/push.png"]
--
-[start=2]
+
. На странице мастера "Удаленный репозиторий" выберите репозиторий "Настроенный" (для использования настроенного ранее пути к репозиторию) или вариант "Указать местоположение репозитория Git" (чтобы определить путь к удаленному репозиторию, доступ к которому еще не осуществлялся, его имя и, если требуется, имя для входа и пароль) и щелкните "Далее".
. На странице мастера "Выбор локальных ветвей" выберите ветви, в которые следует выгрузить изменения, и щелкните "Далее".
. На странице "Обновление локальных ссылок" выберите ветви, которые требуется обновить в каталоге "Удаленные" локального репозитория, и нажмите кнопку "Готово".
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/git_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/git_zh_CN.asciidoc
index ea859f8..86f3ce7 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/git_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/git_zh_CN.asciidoc
@@ -64,7 +64,7 @@
image::images/initialize-git-repo-small.png[role="left", link="images/initialize-git-repo.png"]
--
-[start=3]
+
. 在 ``Initialize a Git Repository `` (初始化 Git 资源库)对话框中,指定将存储版本控制文件的资源库路径,或者单击 "Browse"(浏览)以浏览到所需的目录。
. 单击 "OK"(确定)。
@@ -91,7 +91,7 @@
image::images/clone-wizard-small.png[role="left", link="images/clone-wizard.png"]
--
-[start=2]
+
. 在 "Repository"(资源库)页,指定 Git 资源库位置路径、用户名和口令(可以将其保存,供日后需要时使用)。
. (可选)单击 "Proxy Configuration"(代理配置)以显示 "Options"(选项)对话框,然后设置代理服务器设置。完成后,单击 "OK"(确定)。
. 单击 "Next"(下一步)以切换到该向导的下一个步骤。
@@ -127,7 +127,7 @@
.. 输入密钥文件的密码短语,例如 ``abcd`` 。
.. (可选)选中 "Save Passphrase"(保存密码短语)选项(如有必要)。
-[start=6]
+
. (*使用 SSH-agent 或 Pageant 对 Git 服务器进行自动化 SSH 访问时适用。*)将 "Private Key File"(私有密钥文件)和 "Passphrase"(密码短语)字段留空可通过正确配置的 SSH-agent 或 Pageant 获取从 IDE 到 Git 服务器的经过验证的访问。
. (可选)单击 "Proxy Configuration"(代理配置)以显示 "Options"(选项)对话框,然后设置代理服务器设置。完成后,单击 "OK"(确定)。
@@ -136,7 +136,7 @@
image::images/github-repo-small.png[role="left", link="images/github-repo.png"]
--
-[start=8]
+
. 单击 "Next"(下一步)。
. 在 "Remote Branches"(远程分支)页,选择要获取(下载)到本地资源库的资源库分支,例如 ``master`` 。
@@ -145,7 +145,7 @@
image::images/github-branches-small.png[role="left", link="images/github-branches.png"]
--
-[start=10]
+
. 单击 "Next"(下一步)。
. 在 "Destination Directory"(目标目录)页上,请指定以下内容:
* 在 "Parent Directory"(父目录)字段中,指定用于硬盘驱动器上克隆资源库的目录路径(或者,单击 "Browse"(浏览)按钮,导航至该目录)。
@@ -162,13 +162,13 @@
image::images/github-destination-small.png[role="left", link="images/github-destination.png"]
--
-[start=12]
+
. 单击 "Finish"(完成)。
克隆了资源库后,将会显示 "Clone Completed"(克隆完毕)消息。
image::images/clone-completed.png[]
-[start=13]
+
. 选择所需的选项。
@@ -186,17 +186,25 @@
1. 在 "Projects"(项目)窗口中,右键单击要添加的文件。
2. 在上下文菜单中,选择 ``Git`` > ``Add`` (添加)。
此时,文件内容先添加到索引中,然后再进行提交。
-3. 在 "Projects"(项目)窗口中,右键单击要提交的文件。
-4. 在 "Commit"(提交)对话框中,选择 "Changes between HEAD and Index"(HEAD 和索引之间的更改)(image::images/changes-head-index.png[]) 开启/关闭按钮。
+
+[start=3]
+. 在 "Projects"(项目)窗口中,右键单击要提交的文件。
+
+[start=4]
+. 在 "Commit"(提交)对话框中,选择 "Changes between HEAD and Index"(HEAD 和索引之间的更改)(image::images/changes-head-index.png[]) 开启/关闭按钮。
此时将显示已缓存的文件列表。
-5. 按下面的<<committing,将源文件提交到资源库>>部分所述,提交这些文件。
+
+[start=5]
+. 按下面的<<committing,将源文件提交到资源库>>部分所述,提交这些文件。
|
1. 在 "Projects"(项目)窗口中,右键单击要提交的文件。
2. 在上下文菜单中,选择 ``Git`` > ``Commit`` (提交)。
3. 在 "Commit"(提交)对话框中,选择 "Changes between Index and Working Tree"(索引和工作树之间的更改)(image::images/changes-head-wt.png[]) 开启/关闭按钮。
此时将显示未缓存的文件列表。
-4. 按下面的<<committing,将源文件提交到资源库>>部分所述,提交这些文件。
+
+[start=4]
+. 按下面的<<committing,将源文件提交到资源库>>部分所述,提交这些文件。
|===
@@ -432,7 +440,7 @@
image::images/revert.png[]
-[start=3]
+
. 指定其他选项(例如, ``Revert only Uncommitted Changes in Index to HEAD`` (仅将索引中的未提交更改还原为 HEAD))。
. 单击 "Revert"(还原)。
@@ -479,7 +487,7 @@
*注*:您需要安装 JIRA 或 Subversion 插件才能开始在 IDE 中跟踪问题。
-[start=3]
+
. 在 ``Commit Message`` (提交消息)文本区域中键入提交消息。此外,也可以执行以下任一操作:
* 单击右上角的 ``Recent Messages`` (近期的消息)(image::images/recent-msgs.png[]) 图标,以便在以前使用过的消息列表中进行查看和选择。
* 单击右上角的 ``Load Template`` (加载模板)(image::images/msg-template.png[]) 图标,以便选择消息模板。
@@ -515,7 +523,7 @@
image::images/create-branch-small.png[role="left", link="images/create-branch.png"]
--
-[start=3]
+
. 在 "Branch Name"(分支名称)字段中,输入要创建的分支的名称。
. 在 "Revision"(修订版本)字段中输入提交 ID、现有分支或标记名称,即可键入选定项的特定修订版本,也可以按 "Select"(选择)来查看在资源库中维护的修订版本列表。
. (可选)在 "Select Revision"(选择修订版本)对话框中,展开 "Branches"(分支),选择所需的分支,并在相邻列表中指定提交 ID,然后按 "Select"(选择)。
@@ -542,13 +550,13 @@
image::images/chkout-rev-small.png[role="left", link="images/chkout-rev.png"]
--
-[start=2]
+
. 在 "Revision"(修订版本)字段中输入提交 ID、现有分支或标记名称,即可指定所需的修订版本,也可以按 "Select"(选择)来查看在资源库中维护的修订版本列表。
. 如果您未在上一步中按 "Select"(选择)则跳过。在 "Select Revision"(选择修订版本)对话框中,展开 "Branches"(分支),选择所需的分支,并根据需要在相邻列表中指定提交 ID,然后按 "Select"(选择)。
*注:*如果指定的修订版本引用了未使用分支名称标记的有效提交,则 HEAD 将断开连接,而您将不再位于任何分支上。
-[start=4]
+
. 检查特定于要检出的修订版本的 "Commit ID"(提交 ID)、"Author"(作者)和 "Message"(消息)字段信息。
. 要在已检出修订版本之外创建新分支,请选择 "Checkout as New Branch"(检出为新分支)选项,然后在 "Branch Name"(分支名称)字段中输入相应名称。
. 按 "Checkout"(检出)以检出修订版本。
@@ -566,7 +574,7 @@
image::images/chkout-path-small.png[role="left", link="images/chkout-path.png"]
--
-[start=2]
+
. 选中 "Update Index with Entries from the Selected Revision"(使用选定修订版本中的条目更新索引)选项。
如果选择此选项,将在自行检出之前使用所选修订版本中的状态更新索引(即更新工作树和索引中的所选文件)。
. 在 "Revision"(修订版本)字段中输入提交 ID、现有分支或标记名称,即可指定所需的修订版本,也可以按 "Select"(选择)来查看在资源库中维护的修订版本列表。
@@ -586,7 +594,7 @@
image::images/merge-small.png[role="left", link="images/merge.png"]
--
-[start=2]
+
. 在 "Revision"(修订版本)字段中输入提交 ID、现有分支或标记名称,即可指定所需的修订版本,也可以按 "Select"(选择)来查看在资源库中维护的修订版本列表。
. 如果您未在上一步中按 "Select"(选择)则跳过。在 "Select Revision"(选择修订版本)对话框中,展开 "Branches"(分支),选择所需的分支,并根据需要在相邻列表中指定提交 ID,然后按 "Select"(选择)。
. 按 "Merge"(合并)。
@@ -606,7 +614,7 @@
*注:*分支必须处于非活动状态,即当前未检出到工作树中。
-[start=3]
+
. 右键单击选定的分支,然后从弹出式菜单中选择“删除分支”。
. 在“删除分支”对话框中,按“确定”以确认删除分支。
此时将从本地资源库以及 Git 资源库浏览器中删除分支。
@@ -635,7 +643,7 @@
image::images/fetch-small.png[role="left", link="images/fetch.png"]
--
-[start=2]
+
. 在该向导的 "Remote Repository"(远程资源库)页,选择 "Configured repository"(已配置的资源库)(以使用先前配置的资源库路径)或 "Specify Git Repository Location"(指定 Git 资源库位置)选项(以根据需要定义尚未访问的远程资源库路径及其名称、登录信息、口令和代理配置),然后单击 "Next"(下一步)。
. 在该向导的 "Remote Branches"(远程分支)页,选择要从中获取更改的分支,然后单击 "Finish"(完成)。
此时将创建远程分支的本地副本。并且,将在 Git 资源库浏览器的 ``Branches`` (分支)> ``Remote`` (远程)目录中更新选定分支。
@@ -655,7 +663,7 @@
image::images/pull-small.png[role="left", link="images/pull.png"]
--
-[start=2]
+
. 在该向导的 "Remote Repository"(远程资源库)页,选择 "Configured repository"(已配置的资源库)(以使用先前配置的资源库路径)或 "Specify Git Repository Location"(指定 Git 资源库位置)选项(以根据需要定义尚未访问的远程资源库路径及其名称、登录信息和口令),然后单击 "Next"(下一步)。
. 在该向导的 "Remote Branches"(远程分支)页,选择要从中提取更改的分支,然后单击 "Finish"(完成)。
此时,您的本地资源库将与原始资源库保持同步。
@@ -673,7 +681,7 @@
image::images/push-small.png[role="left", link="images/push.png"]
--
-[start=2]
+
. 在该向导的 "Remote Repository"(远程资源库)页,选择 "Configured repository"(已配置的资源库)(以使用先前配置的资源库路径)或 "Specify Git Repository Location"(指定 Git 资源库位置)选项(以根据需要定义尚未访问的远程资源库路径及其名称、登录信息和口令),然后单击 "Next"(下一步)。
. 在 "Select Local Branches"(选择本地分支)页,选择要向其推入编辑内容的分支,然后单击 "Next"(下一步)。
. 在 "Update Local References"(更新本地引用)页,选择要在本地资源库的 "Remotes"(远程)目录中更新的分支,然后单击 "Finish"(完成)。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server.asciidoc
index 565afa6..b671784 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server.asciidoc
@@ -50,17 +50,35 @@
1. Right-click the downloaded installation file (for example, ``mysql-installer-community-5.6.14.0.msi`` ) and click Run.
The MySQL Installer starts.
-2. On the Welcome panel, select Install MySQL Products.
-3. On the License Information panel, review the license agreement, click the acceptance checkbox, and click Next.
-4. On the Find latest products panel, click Execute.
+
+[start=2]
+. On the Welcome panel, select Install MySQL Products.
+
+[start=3]
+. On the License Information panel, review the license agreement, click the acceptance checkbox, and click Next.
+
+[start=4]
+. On the Find latest products panel, click Execute.
When the operation is complete, click Next.
-5. On the Setup Type panel, choose the Custom option and click Next.
-6. On the Feature Selection panel, ensure MySQL Server 5.6.x is selected, and click Next.
-7. On the Check Requirements panel, click Next.
-8. On the Installation panel, click Execute.
+
+[start=5]
+. On the Setup Type panel, choose the Custom option and click Next.
+
+[start=6]
+. On the Feature Selection panel, ensure MySQL Server 5.6.x is selected, and click Next.
+
+[start=7]
+. On the Check Requirements panel, click Next.
+
+[start=8]
+. On the Installation panel, click Execute.
When the server installation is completed successfully, the information message appears on the Installation panel. Click Next.
-9. On the Configuration panel, click Next.
-10. At the first MySQL Server Configuration page (1/3), set the following options:
+
+[start=9]
+. On the Configuration panel, click Next.
+
+[start=10]
+. At the first MySQL Server Configuration page (1/3), set the following options:
* *Server Configuration Type*. Select the Development Machine option.
* *Enable TCP/IP Networking*. Ensure the checkbox is selected and specify the options below:
* *Port Number*. Specify the connection port. The default setting is 3306 - leave it unchanged if there is not special reason to change it.
@@ -71,7 +89,7 @@
Click Next.
-[start=11]
+
. At the second MySQL Server Configuration page (2/3), set the following options:
* *Root Account Password*.
* *MySQL Root Password*. Enter the root user's password.
@@ -83,7 +101,7 @@
Click Next.
-[start=12]
+
. At the third MySQL Server Configuration page (3/3), set the following options:
* *Windows Service Name*. Specify a Windows Service Name to be used for the MySQL server instance.
* *Start the MySQL Server at System Startup*. Leave the checkbox selected if the MySQL server is required to automatically start at system startup time.
@@ -92,7 +110,7 @@
* *Custom User*. An existing user account recommended for advanced scenarios.
Click Next.
-[start=13]
+
. At the Configuration Overview page, click Next.
. When the configuration is completed successfully, the information message appears on the Complete panel. Click Finish.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ja.asciidoc
index eb2d0c8..f442b8e 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ja.asciidoc
@@ -60,17 +60,35 @@
1. ダウンロードしたインストール・ファイル( ``mysql-installer-community-5.6.14.0.msi`` など)を右クリックし、「実行」をクリックします。
MySQLインストーラが起動します。
-2. 「ようこそ」パネルで、MySQL製品のインストールを選択します。
-3. ライセンス情報パネルでライセンス契約を確認し、同意のチェックボックスをクリックして、「次」をクリックします。
-4. 「最新製品の検索」パネルで、「実行」をクリックします。
+
+[start=2]
+. 「ようこそ」パネルで、MySQL製品のインストールを選択します。
+
+[start=3]
+. ライセンス情報パネルでライセンス契約を確認し、同意のチェックボックスをクリックして、「次」をクリックします。
+
+[start=4]
+. 「最新製品の検索」パネルで、「実行」をクリックします。
操作が完了したら、「次」をクリックします。
-5. 「Setup Type」パネルで「Custom」オプションを選択し、「Next」をクリックします。
-6. 「機能の選択」パネルで、MySQL Server 5.6.xが選択されていることを確認し、「次」をクリックします。
-7. 「要件の確認」パネルで、「次」をクリックします。
-8. 「インストール」パネルで、「実行」をクリックします。
+
+[start=5]
+. 「Setup Type」パネルで「Custom」オプションを選択し、「Next」をクリックします。
+
+[start=6]
+. 「機能の選択」パネルで、MySQL Server 5.6.xが選択されていることを確認し、「次」をクリックします。
+
+[start=7]
+. 「要件の確認」パネルで、「次」をクリックします。
+
+[start=8]
+. 「インストール」パネルで、「実行」をクリックします。
サーバーのインストールが正常に完了すると、「インストール」パネルに情報メッセージが表示されます。「次」をクリックします。
-9. 「構成」パネルで、「次」をクリックします。
-10. 最初の「MySQLサーバーの構成」ページ(1/3)で、次のオプションを設定します。
+
+[start=9]
+. 「構成」パネルで、「次」をクリックします。
+
+[start=10]
+. 最初の「MySQLサーバーの構成」ページ(1/3)で、次のオプションを設定します。
* *サーバー構成タイプ*。「開発マシン」オプションを選択します。
* *TCP/IPネットワークの有効化*。チェックボックスが選択されていることを確認し、次のオプションを指定します。
* *ポート番号*。接続ポートを指定します。特に変更する理由がない場合は、デフォルトの設定である3306を変更しないままにします。
@@ -80,7 +98,9 @@
*注意:* このオプションは、MySQLサーバーで使用するポートに対してファイアウォールをオフにするネットワーク・オプションの設定パネルを取得するため、選択する必要があります。
「次」をクリックします。
-11. 2番目の「MySQLサーバーの構成」ページ(2/3)で、次のオプションを設定します。
+
+[start=11]
+. 2番目の「MySQLサーバーの構成」ページ(2/3)で、次のオプションを設定します。
* *ルート・アカウントのパスワード*。
* *MySQLルートのパスワード*。ルート・ユーザーのパスワードを入力します。
* *パスワードの繰返し*。ルート・ユーザーのパスワードを再入力します。
@@ -90,7 +110,7 @@
* *MySQLユーザー・アカウント*。「ユーザーの追加」をクリックしてユーザー・アカウントを作成します。MySQLユーザー詳細ダイアログ・ボックスで、ユーザー名、データベース・ロールおよびパスワード( ``!phpuser`` など)を入力します。「OK」をクリックします。
「次」をクリックします。
-[start=12]
+
. 3番目の「MySQLサーバーの構成」ページ(3/3)で、次のオプションを設定します。
* *Windowsサービス名*。MySQLサーバー・インスタンスに使用するWindowsサービス名を指定します。
* *システム起動時にMySQLサーバーを起動する*。MySQLサーバーをシステム起動時に自動的に起動する必要がある場合は、チェックボックスを選択したままにします。
@@ -98,7 +118,7 @@
* *標準システム・アカウント*。ほとんどのシナリオにお薦めします。
* *カスタム・ユーザー*。高度なシナリオに推奨される既存のユーザー・アカウントです。
「次」をクリックします。
-[start=13]
+
. 構成概要ページで、「次」をクリックします。
. 構成が正常に完了すると、「完了」パネルに情報メッセージが表示されます。「終了」をクリックします。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_pt_BR.asciidoc
index d94c912..c0f13a7 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_pt_BR.asciidoc
@@ -56,17 +56,35 @@
1. Clique com o botão direito do mouse no arquivo de instalação transferido por download (por exemplo, ``mysql-installer-community-5.6.10.0.msi`` ) e clique em Executar.
O Instalador do MySQL é iniciado.
-2. No painel de Boas-Vindas, selecione Instalar Produtos MySQL.
-3. No painel Informações da Licença, examine o contrato de licença, clique na caixa de seleção de aceitação e clique em Próximo.
-4. No painel Localizar produtos mais recentes, clique em Executar.
+
+[start=2]
+. No painel de Boas-Vindas, selecione Instalar Produtos MySQL.
+
+[start=3]
+. No painel Informações da Licença, examine o contrato de licença, clique na caixa de seleção de aceitação e clique em Próximo.
+
+[start=4]
+. No painel Localizar produtos mais recentes, clique em Executar.
Quando a operação for concluída, clique em Próximo.
-5. No painel Tipo de Configuração, escolha a opção Personalizada e clique em Próximo.
-6. No painel Seleção de Funcionalidade, verifique se MySQL Server 5.6.x foi selecionado e clique em Próximo.
-7. No painel Verificar Requisitos, clique em Próximo.
-8. No painel Instalação, clique em Executar.
+
+[start=5]
+. No painel Tipo de Configuração, escolha a opção Personalizada e clique em Próximo.
+
+[start=6]
+. No painel Seleção de Funcionalidade, verifique se MySQL Server 5.6.x foi selecionado e clique em Próximo.
+
+[start=7]
+. No painel Verificar Requisitos, clique em Próximo.
+
+[start=8]
+. No painel Instalação, clique em Executar.
Quando a instalação do servidor é concluída com sucesso, a mensagem de informações é exibida no painel Instalação. Clique em Próximo.
-9. No painel Configuração, clique em Próximo.
-10. Na primeira página Configuração do Servidor MySQL (1/3), consulte as opções a seguir:
+
+[start=9]
+. No painel Configuração, clique em Próximo.
+
+[start=10]
+. Na primeira página Configuração do Servidor MySQL (1/3), consulte as opções a seguir:
* *Tipo de Configuração do Servidor*. Selecione a opção Máquina de Desenvolvimento.
* *Ativar Rede de TCP/IP*. Verifique se a caixa de seleção foi selecionada e especifique as opções abaixo:
* *Número da Porta*. Especifique a porta de conexão. A definição default é 3306 - não altere-a se não houver um motivo especial para isso.
@@ -76,7 +94,9 @@
*Observação:* a escolha desta opção é necessária para se chegar ao painel para definir as opções de rede onde você desativará o firewall da porta usada pelo servidor MySQL.
Clique em Próximo.
-11. Na segunda página Configuração do Servidor MySQL (2/3), consulte as opções a seguir:
+
+[start=11]
+. Na segunda página Configuração do Servidor MySQL (2/3), consulte as opções a seguir:
* *Senha da Conta Root*.
* *Senha Root de MySQL*. Informe senha para o usuário root.
* *Repita a Senha*. Digite novamente a senha root do usuário.
@@ -85,7 +105,7 @@
* *Contas do Usuário MySQL*. Clique em Adicionar Usuário para criar uma conta do usuário. Na caixa de diálogo Detalhes de Usuário do MySQL, insira um nome de usuário, uma função do banco de dados e uma senha (por exemplo, ``!phpuser`` ). Clique em OK.
Clique em Próximo.
-[start=12]
+
. Na terceira página Configuração do Servidor MySQL (3/3), consulte as opções a seguir:
* *Nome do Serviço Windows*. Especifique um Nome do Serviço Windows para ser usado para a instância do servidor do MySQL.
* *Inicie o MySQL na Inicialização do Sistema*. Deixe a caixa de seleção marcada se for necessário iniciar o servidor MySQL automaticamente no tempo de inicialização do sistema.
@@ -93,7 +113,7 @@
* *Conta Padrão do Sistema*. Recomendada para a maioria dos cenários.
* *Usuário Personalizado*. Uma conta de usuário existente recomendada para cenários avançados.
Clique em Próximo.
-[start=13]
+
. Na página Visão Geral da Configuração, clique em Próximo.
. Quando a configuração do servidor for concluída com sucesso, a mensagem de informações será exibida no painel Concluir. Clique em Finalizar.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ru.asciidoc
index dd31c3e..b96521a 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_ru.asciidoc
@@ -56,17 +56,35 @@
1. Щелкните правой кнопкой мыши загруженный установочный файл (например, ``mysql-installer-community-5.6.14.0.msi`` ) и выберите пункт 'Выполнить'.
Запустится программа установки MySQL.
-2. На панели приветствия выберите 'Установить продукты MySQL'.
-3. На панели информации о лицензии ознакомьтесь с лицензионным соглашением, установите флажок принятия и нажмите кнопку 'Далее'.
-4. На панели 'Найти последние продукты' нажмите кнопку 'Выполнить'.
+
+[start=2]
+. На панели приветствия выберите 'Установить продукты MySQL'.
+
+[start=3]
+. На панели информации о лицензии ознакомьтесь с лицензионным соглашением, установите флажок принятия и нажмите кнопку 'Далее'.
+
+[start=4]
+. На панели 'Найти последние продукты' нажмите кнопку 'Выполнить'.
После завершения операции нажмите кнопку 'Далее'.
-5. На панели "Тип настройки" выберите параметр "Пользовательская", а затем нажмите кнопку "Далее".
-6. На панели 'Выбор компонентов обеспечения' убедитесь, что выбран MySQL Server 5.6.x, и нажмите кнопку 'Далее'.
-7. На панели 'Проверить требования' нажмите кнопку 'Далее'.
-8. На панели 'Установка' нажмите кнопку 'Выполнить'.
+
+[start=5]
+. На панели "Тип настройки" выберите параметр "Пользовательская", а затем нажмите кнопку "Далее".
+
+[start=6]
+. На панели 'Выбор компонентов обеспечения' убедитесь, что выбран MySQL Server 5.6.x, и нажмите кнопку 'Далее'.
+
+[start=7]
+. На панели 'Проверить требования' нажмите кнопку 'Далее'.
+
+[start=8]
+. На панели 'Установка' нажмите кнопку 'Выполнить'.
После успешного завершения установки сервера на панели 'Установка' отображается информационное сообщение. Нажмите кнопку "Далее".
-9. На странице 'Настройка' нажмите кнопку 'Далее'.
-10. На первой странице конфигурации сервера MySQL (1/3) установите следующие параметры:
+
+[start=9]
+. На странице 'Настройка' нажмите кнопку 'Далее'.
+
+[start=10]
+. На первой странице конфигурации сервера MySQL (1/3) установите следующие параметры:
* *Тип конфигурации сервера*. Выберите вариант 'Компьютер для разработки'.
* *Включите поддержку сети TCP/IP*. Убедитесь, что флажок установлен, и задайте следующие параметры ниже:
* *Номер порта*. Укажите порт подключения. По умолчанию установлено значение 3306; не следует изменять его без необходимости.
@@ -76,7 +94,9 @@
*Примечание.* При выборе этого параметра необходимо перейти к панели для установки параметров сети, где будет отключен брандмауэр для порта, используемого сервером MySQL.
Нажмите кнопку "Далее".
-11. На второй странице конфигурации сервера MySQL (2/3) установите следующие параметры:
+
+[start=11]
+. На второй странице конфигурации сервера MySQL (2/3) установите следующие параметры:
* *Пароль учетной записи root*.
* *Пароль root для MySQL*. Введите пароль пользователя root.
* *Повторите ввод пароля*. Повторно введите пароль пользователя root.
@@ -85,7 +105,7 @@
* *Учетные записи пользователя MySQL*. Нажмите кнопку 'Добавить пользователя' для создания учетной записи пользователя. В диалоговом окне 'Сведения о пользователе MySQL' введите имя пользователя, роль базы данных и пароль (например, ``!phpuser`` ). Нажмите кнопку "ОК".
Нажмите кнопку "Далее".
-[start=12]
+
. На третьей странице конфигурации сервера MySQL (3/3) установите следующие параметры:
* *Имя службы Windows*. Укажите имя службы Windows, которая будет использоваться для экземпляра сервера MySQL.
* *Запустите сервер MySQL при запуске системы*. Не снимайте этот флажок, если сервер MySQL требуется для автоматического запуска при запуске системы.
@@ -93,7 +113,7 @@
* *Стандартная системная учетная запись*. Рекомендуется для большинства сценариев.
* *Нестандартный пользователь*. Существующая учетная запись пользователя рекомендуется для сложных сценариев.
Нажмите кнопку "Далее".
-[start=13]
+
. На странице 'Обзор конфигурации' нажмите кнопку 'Далее'.
. После успешного завершения настройки на панели 'Завершение' появляется информационное сообщение. Нажмите кнопку "Завершить".
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_zh_CN.asciidoc
index 5ef58f1..6cf48a4 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/install-and-configure-mysql-server_zh_CN.asciidoc
@@ -56,17 +56,35 @@
1. 右键单击下载的安装文件(例如 ``mysql-installer-community-5.6.14.0.msi`` )并单击“运行”。
MySQL 安装程序将启动。
-2. 在“欢迎”面板上,选择“安装 MySQL 产品”。
-3. 在“许可证信息”面板上,查看许可证协议,单击接受复选框,然后单击“下一步”。
-4. 在“查找最新产品”面板上,单击“执行”。
+
+[start=2]
+. 在“欢迎”面板上,选择“安装 MySQL 产品”。
+
+[start=3]
+. 在“许可证信息”面板上,查看许可证协议,单击接受复选框,然后单击“下一步”。
+
+[start=4]
+. 在“查找最新产品”面板上,单击“执行”。
操作完成后,单击“下一步”。
-5. 在“安装类型”面板上,选择“定制”选项,然后单击“下一步”。
-6. 在“功能选择”面板上,确保选中 MySQL 服务器 5.6.x,然后单击“下一步”。
-7. 在“检查要求”面板上,单击“下一步”。
-8. 在“安装”面板上,单击“执行”。
+
+[start=5]
+. 在“安装类型”面板上,选择“定制”选项,然后单击“下一步”。
+
+[start=6]
+. 在“功能选择”面板上,确保选中 MySQL 服务器 5.6.x,然后单击“下一步”。
+
+[start=7]
+. 在“检查要求”面板上,单击“下一步”。
+
+[start=8]
+. 在“安装”面板上,单击“执行”。
当服务器安装成功完成时,信息消息将显示在“安装”面板上。单击“下一步”。
-9. 在“配置”面板上,单击“下一步”。
-10. 在“MySQL 服务器配置”的第一页 (1/3) 上,设置以下选项:
+
+[start=9]
+. 在“配置”面板上,单击“下一步”。
+
+[start=10]
+. 在“MySQL 服务器配置”的第一页 (1/3) 上,设置以下选项:
* *服务器配置类型*。选择“开发计算机”选项。
* *启用 TCP/IP 联网*。确保选中该复选框并指定以下选项:
* *端口号*。指定连接端口。默认设置为 3306 - 如果没有特殊理由更改此设置,请保留其不变。
@@ -76,7 +94,9 @@
*注:*必须选择此选项,才能到达设置网络选项的面板,您将在其中对 MySQL 服务器使用的端口关闭防火墙。
单击“下一步”。
-11. 在“MySQL 服务器配置”的第二页 (2/3) 上,设置以下选项:
+
+[start=11]
+. 在“MySQL 服务器配置”的第二页 (2/3) 上,设置以下选项:
* *超级用户帐户口令*。
* *MySQL 超级用户口令*。输入超级用户的口令。
* *重复口令*。重新键入超级用户的口令。
@@ -85,7 +105,7 @@
* *MySQL 用户帐户*。单击“添加用户”创建用户帐户。在“MySQL 用户详细信息”对话框中,输入用户名、数据库角色和口令(例如 ``!phpuser`` )。单击“确定”。
单击“下一步”。
-[start=12]
+
. 在“MySQL 服务器配置”的第三页 (3/3) 上,设置以下选项:
* *Windows 服务名称*。指定要用于 MySQL 服务器实例的 Windows 服务名称。
* *在系统启动时启动 MySQL 服务器*。如果需要 MySQL 服务器在系统启动时自动启动,则保留该复选框为选中状态。
@@ -93,7 +113,7 @@
* *标准系统帐户*。多数情况下推荐使用。
* *定制用户*。高级情况下推荐使用现有用户帐户。
单击“下一步”。
-[start=13]
+
. 在“配置概览”页上,单击“下一步”。
. 当配置成功完成时,信息消息将显示在“完成”面板上。单击“完成”。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/java-db.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/java-db.asciidoc
index 018f829..ab80575 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/java-db.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/java-db.asciidoc
@@ -76,9 +76,15 @@
1. In the Services window, right-click the Java DB node and choose Start Server. Note the following output in the Output window, indicating that the server has started:
image::images/output-start-db.png[]
-2. Right-click the Java DB node and choose Create Database to open the Create Java DB Database dialog.
-3. Type ``contact`` for the Database Name.
-4. Type ``nbuser`` for the User Name and Password. Click OK.
+
+[start=2]
+. Right-click the Java DB node and choose Create Database to open the Create Java DB Database dialog.
+
+[start=3]
+. Type ``contact`` for the Database Name.
+
+[start=4]
+. Type ``nbuser`` for the User Name and Password. Click OK.
image::images/javadb-createdb.png[]
NOTE: The Database Location is the default location set during installation of Java DB from GlassFish. If you installed Java DB separately, this location might be different.
@@ -105,11 +111,11 @@
NOTE: You will also see the `sample [app on APP]` database connection that is the default database schema.
-[start=2]
+
. Right-click the *contact* database connection node ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ) and choose Connect.
The connection node icon appears whole ( image:images/connection-node-icon.png[]), signifying that the connection was successful.
-[start=3]
+
. Create a convenient display name for the database by right-clicking the database connection node ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ) and choosing Rename. Type ``Contact DB`` in the text field and click OK.
@@ -125,15 +131,25 @@
1. Expand the ``Contact DB`` connection node and note that there are several schema subnodes. The app schema is the only schema that applies to this tutorial. Right-click the APP node and choose Set as Default Schema.
-2. Expand the APP node and note that there are three subfolders: Tables, Views and Procedures. Right-click the Tables node and choose Create Table to open the Create Table dialog box.
-3. In the Table Name text field, type ``FRIENDS`` .
-4. Click Add Column. The Add Column dialog box appears.
-5. For Column Name, enter ``id`` . For Data Type, select ``INTEGER`` from the drop-down list.
-6. Under Constraints, select the Primary Key checkbox to specify that this column is the primary key for your table. All tables found in relational databases must contain a primary key. Note that when you select the Primary Key check box, the Index and Unique check boxes are also automatically selected and the Null check box is deselected. This is because primary keys are used to identify a unique row in the database, and by default are used as the table index. Because all rows must be identified, primary keys cannot contain a ``Null`` value.
+
+[start=2]
+. Expand the APP node and note that there are three subfolders: Tables, Views and Procedures. Right-click the Tables node and choose Create Table to open the Create Table dialog box.
+
+[start=3]
+. In the Table Name text field, type ``FRIENDS`` .
+
+[start=4]
+. Click Add Column. The Add Column dialog box appears.
+
+[start=5]
+. For Column Name, enter ``id`` . For Data Type, select ``INTEGER`` from the drop-down list.
+
+[start=6]
+. Under Constraints, select the Primary Key checkbox to specify that this column is the primary key for your table. All tables found in relational databases must contain a primary key. Note that when you select the Primary Key check box, the Index and Unique check boxes are also automatically selected and the Null check box is deselected. This is because primary keys are used to identify a unique row in the database, and by default are used as the table index. Because all rows must be identified, primary keys cannot contain a ``Null`` value.
image::images/add-column.png[]
-[start=7]
+
. Repeat this procedure now by specifying fields as shown in the table below:
@@ -164,7 +180,7 @@
image::images/create-table-friends.png[]
-[start=9]
+
. When you are sure that your Create Table dialog contains the same specifications as those shown above, click OK. The IDE generates the ``FRIENDS`` table in the database, and you can see a new ``FRIENDS`` table node (image:images/table-node.png[]) display under the Tables node. Beneath the table node the columns (fields) are listed, starting with the primary key (image:images/primary-key-icon.png[]).
image::images/friends-table.png[]
@@ -190,12 +206,12 @@
NOTE: Statements and queries formed in the SQL Editor are parsed in Structured Query Language. SQL adheres to strict syntax rules which you should be familiar with when working in the IDE's editor. SQL syntax can also differ depending on the database management system. See the link:http://www.oracle.com/technetwork/java/javadb/documentation/index.html[+JavaDB Reference Manual+] for specific guidelines.
-[start=3]
+
. Click the Run SQL (image:images/run-sql-button.png[]) button in the task bar at the top of the editor (Ctrl-Shift-E) to execute the query. In the Output window (Ctrl-4), a message displays indicating that the statement was successfully executed.
image::images/run-query.png[]
-[start=4]
+
. To verify changes, right-click the ``Contact DB`` connection node in the Services window and choose Refresh. This updates the Runtime UI component to the current status of the specified database. This step is necessary when running queries from the SQL Editor in NetBeans IDE. Note that the new COLLEAGUES table node (image:images/table-node.png[]) now displays under Tables in the Services window.
@@ -223,7 +239,7 @@
While you are typing, you can use the SQL Editor code completion.
-[start=3]
+
. Right-click inside the SQL Editor and choose Run Statement. The Output window displays a message indicating that the statement was successfully executed.
. To verify that the new record has been added to the ``FRIENDS`` table, right-click the ``FRIENDS`` table node in the Services window and choose View Data.
@@ -237,7 +253,9 @@
1. Right-click the ``FRIENDS`` table node and choose View Data (if you have not done this at the last step of the previous section).
2. Click the Insert Record(s) ( ``Alt-I`` ) button to add a row.
The Insert Records dialog box appears.
-3. Click in each cell and enter records. Note that for the cells with Date data type, you can choose a date from the calendar. Click OK when you are done.
+
+[start=3]
+. Click in each cell and enter records. Note that for the cells with Date data type, you can choose a date from the calendar. Click OK when you are done.
image::images/insert-records.png[]
@@ -263,12 +281,12 @@
Alternatively, you can copy the contents of link:https://netbeans.org/project_downloads/usersguide/colleagues.sql[+colleagues.sql+] and then open the SQL editor and paste the contents of the file into the SQL editor.
-[start=3]
+
. Make sure your connection to ``Contact DB `` is selected from the Connection drop-down box in the tool bar at the top of the editor.
image::images/conn-drop-down.png[]
-[start=4]
+
. Click the Run SQL (image::images/run-sql-button.png[]) button in the SQL Editor's task bar. The script is executed against the selected database, and any feedback is generated in the Output window.
. To verify changes, right-click the ``Contact DB `` connection node in the Services window and choose Refresh. Note that the new ``COLLEAGUES`` table from the SQL script now displays as a table node under ``contact`` in the Services window.
. To view the data contained in the new tables, right-click the ``COLLEAGUES`` table and choose View Data. In this manner, you can also compare the tabular data with the data contained in the SQL script to see that they match.
@@ -283,12 +301,12 @@
image::images/grab-structure.png[]
-[start=3]
+
. In the Grab Table dialog that opens, specify a location on your computer to save the grab file that will be created. Click Save.
The grab file records the table definition of the selected table.
-[start=4]
+
. Expand the APP schema node under the ``Contact DB`` database connection, right-click the Tables node and choose Recreate Table to open the Recreate Table dialog box.
. In the Recreate Table dialog box, navigate to the location where you saved the ``CUSTOMER`` grab file and click Open to open the Name the Table dialog box.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/java-db_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/java-db_ja.asciidoc
index 673ceb3..f1327ec 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/java-db_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/java-db_ja.asciidoc
@@ -97,7 +97,7 @@
image::images/output-start-db.png[]
-[start=2]
+
. 「Java DB」ノードを右クリックし、「データベースを作成」を選択して、「Java DBデータベースを作成」ダイアログを開きます。
. 「データベース名」に「 ``contact`` 」と入力します。
. 「ユーザー名」および「パスワード」に「 ``nbuser`` 」と入力します。「OK」をクリックします。
@@ -128,12 +128,12 @@
*注意:*デフォルトのデータベース・スキーマである`sample [app on APP]`データベース接続を表示することもできます。
-[start=2]
+
. *contact*データベース接続ノード( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` )を右クリックし、「接続」を選択します。
接続ノード・アイコン全体(image:images/connection-node-icon.png[])が表示され、これは接続が成功したことを示します。
-[start=3]
+
. データベース接続ノード( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` )を右クリックし、「名前変更」を選択して、データベースのわかりやすい表示名を作成します。テキスト・フィールドに「 ``Contact DB`` 」と入力し、「OK」をクリックします。
@@ -156,7 +156,7 @@
image::images/add-column.png[]
-[start=7]
+
. この手順を繰り返し、次の表に示すようにフィールドを指定します。
|===
@@ -186,7 +186,7 @@
image::images/create-table-friends.png[]
-[start=9]
+
. 「表を作成」ダイアログが上に示す指定と同じになっていることを確認したら、「OK」をクリックします。IDEによって、データベースに ``FRIENDS`` 表が生成されて、「表」ノードの下に新しい ``FRIENDS`` 表ノード(image::images/table-node.png[])の表示を確認できます。表ノードの下に、主キー(image::images/primary-key-icon.png[])で開始する各列(各フィールド)が一覧表示されます。
image::images/friends-table.png[]
@@ -212,7 +212,7 @@
*注意: *SQLエディタで作成した文および問合せは、SQL (Structured Query Language)で構文解析されます。SQLは厳密な構文ルールに準拠しています。IDEのエディタで作業をするときは、これらのルールを理解しておいてください。SQL構文はまた、データベース管理システムによって異なることがあります。具体的なガイドラインについては、link:http://www.oracle.com/technetwork/java/javadb/documentation/index.html[+Java DB Reference Manual+]を参照してください。
-[start=3]
+
. エディタ([Ctrl]-[Shift]-[E])の上部にあるタスク・バーの「SQLの実行」(image::images/run-sql-button.png[])ボタンをクリックし、問合せを実行します。「出力」ウィンドウ([Ctrl]-[4])に、文の実行に成功したことを示すメッセージが表示されます。
image::images/run-query.png[]
@@ -244,7 +244,7 @@
入力中はSQLエディタのコード補完を使用できます。
-[start=3]
+
. SQLエディタ内を右クリックし、「文を実行」を選択します。「出力」ウィンドウに、文の実行に成功したことを示すメッセージが表示されます。
. ``FRIENDS`` 表に新しいレコードが追加されたことを確認するには、「サービス」ウィンドウで「 ``FRIENDS`` 」表ノードを右クリックし、「データを表示」を選択します。
@@ -258,7 +258,9 @@
1. 「 ``FRIENDS`` 」表ノードを右クリックして、「データを表示」を選択します(前の項の最後のステップで実行しなかった場合)。
2. 「レコードを挿入( ``Alt+I`` )」ボタンをクリックして、行を追加します。
「レコードを挿入」ダイアログ・ボックスが表示されます。
-3. 各セルでクリックして、レコードを入力します。Dateデータ型のセルでは、カレンダから日付を選択できます。完了したら、「OK」をクリックします。
+
+[start=3]
+. 各セルでクリックして、レコードを入力します。Dateデータ型のセルでは、カレンダから日付を選択できます。完了したら、「OK」をクリックします。
image::images/insert-records.png[]
@@ -284,12 +286,12 @@
または、link:https://netbeans.org/project_downloads/usersguide/colleagues.sql[+colleagues.sql+]の内容をコピーし、SQLエディタを開いてその中にファイルの内容を貼り付けます。
-[start=3]
+
. エディタの最上部のツールバーにある「接続」ドロップダウン・ボックスで ``Contact DB`` への接続が選択されていることを確認します。
image::images/conn-drop-down.png[]
-[start=4]
+
. SQLエディタのタスク・バーにある「SQLの実行」(image::images/run-sql-button.png[])ボタンをクリックします。選択したデータベースに対してスクリプトが実行され、「出力」ウィンドウにフィード・バックが生成されます。
. 変更内容を確認するには、「サービス」ウィンドウで「 ``Contact DB`` 」接続ノードを右クリックし、「リフレッシュ」を選択します。SQLスクリプトからの新しい ``COLLEAGUES`` 表が、「サービス」ウィンドウの「 ``contact`` 」の下に表ノードとして表示されます。
. 新しい表に含まれているデータを表示するには、 ``COLLEAGUES`` 表を右クリックして「データを表示」を選択します。このように、表形式のデータとSQLスクリプトに含まれるデータとを比較して、一致しているかどうかを確認することもできます。
@@ -304,18 +306,18 @@
image::images/grab-structure.png[]
-[start=3]
+
. 開いた「表を保存」ダイアログで、作成される保存(grab)ファイルを保存するコンピュータの場所を指定します。「保存」をクリックします。
保存ファイルには、選択した表の表定義が記録されます。
-[start=4]
+
. ``Contact DB`` データベース接続の下にある「APP」スキーマ・ノードを展開し、「表」ノードを右クリックして「表を再作成」を選択し、「表を再作成」ダイアログ・ボックスを開きます。
. 「表を再作成」ダイアログ・ボックスで、 ``CUSTOMER`` 保存ファイルを保存した場所に移動して「開く」をクリックし、「表に名前を付ける」ダイアログ・ボックスを開きます。
image::images/recreate-table.png[]
-[start=6]
+
. ここで表の名前を変更したり、表定義を編集したりできます。そうしない場合、「OK」をクリックすると、 ``contact`` データベースにすぐに表が作成されます。「 ``Contact DB`` 」接続ノードの下に「 ``CUSTOMER`` 」表ノードが新しく表示されます。
image::images/new-customer-node.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/java-db_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/java-db_pt_BR.asciidoc
index 868613a..b46e873 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/java-db_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/java-db_pt_BR.asciidoc
@@ -86,7 +86,7 @@
image::images/output-start-db.png[]
-[start=2]
+
. Clique com o botão direito do mouse no nó do Java DB e escolha Criar Banco de Dados para abrir a caixa de diálogo de criação do Banco de Dados do Java DB.
. Insira ``contato`` para o Nome do Banco de Dados.
. Digite ``nbuser`` para o Nome de Usuário e a Senha. Clique em OK.
@@ -117,12 +117,12 @@
*Observação.* Você também visualizará a conexão do banco de dados `amostra [app em app]` que é o esquema do banco de dados default.
-[start=2]
+
. Clique com o botão direito do mouse no nó da conexão do banco de dados *contact*( ``jdbc:derby://localhost:1527/contact [nbuser em NBUSER]`` ) e escolha Conectar.
O ícone do nó da conexão aparecerá em todo (image:images/connection-node-icon.png[]), significando que a conexão foi bem-sucedida.
-[start=3]
+
. Crie um nome de exibição conveniente para o banco de dados clicando com o botão direito do mouse no nó da conexão do banco de dados ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ) e selecione Renomear. Digite ``BD de Contato`` no campo de texto e clique em Ok.
@@ -138,15 +138,25 @@
1. Expanda o nó de conexão ``BD de Contato`` e observe que existem vários subnós do esquema. O esquema app é o único esquema que se aplica a este tutorial. Clique com o botão direito do mouse no nó APP e escolha Definir como Esquema Default.
-2. Expanda o nó APP e observe que existem três subpastas: Tabelas, Views e Procedimentos. Clique com o botão direito no nó Tabelas e escolha Criar Tabela para abrir a caixa de diálogo Criar Tabela.
-3. No campo de texto Nome da Tabela, digite ``AMIGOS`` .
-4. Clique em Adicionar Coluna. A caixa de diálogo Adicionar Coluna é exibida.
-5. Para Nome de Coluna, insira ``id`` . Para Tipo de Dados, selecione ``INTEIRO`` da lista drop-down.
-6. Em Restrições, marque a caixa de seleção Chave Primária para especificar que essa coluna é a chave primária da tabela. Todas as tabelas de bancos de dados relacionais devem conter uma chave primária. Observe que quando você marca a caixa de seleção Chave Primária, as caixas de seleção Índice e Exclusivo são automaticamente marcadas e a caixa de seleção Nulo é desmarcada. Isso ocorre porque as chaves primárias são usadas para identificar uma linha exclusiva no banco de dados e por default são usadas como o índice da tabela. Como todas as linhas devem ser identificadas, as chaves primárias não podem conter um valor ``Nulo`` .
+
+[start=2]
+. Expanda o nó APP e observe que existem três subpastas: Tabelas, Views e Procedimentos. Clique com o botão direito no nó Tabelas e escolha Criar Tabela para abrir a caixa de diálogo Criar Tabela.
+
+[start=3]
+. No campo de texto Nome da Tabela, digite ``AMIGOS`` .
+
+[start=4]
+. Clique em Adicionar Coluna. A caixa de diálogo Adicionar Coluna é exibida.
+
+[start=5]
+. Para Nome de Coluna, insira ``id`` . Para Tipo de Dados, selecione ``INTEIRO`` da lista drop-down.
+
+[start=6]
+. Em Restrições, marque a caixa de seleção Chave Primária para especificar que essa coluna é a chave primária da tabela. Todas as tabelas de bancos de dados relacionais devem conter uma chave primária. Observe que quando você marca a caixa de seleção Chave Primária, as caixas de seleção Índice e Exclusivo são automaticamente marcadas e a caixa de seleção Nulo é desmarcada. Isso ocorre porque as chaves primárias são usadas para identificar uma linha exclusiva no banco de dados e por default são usadas como o índice da tabela. Como todas as linhas devem ser identificadas, as chaves primárias não podem conter um valor ``Nulo`` .
image::images/add-column.png[]
-[start=7]
+
. Repita este procedimento agora especificando campos conforme exibido na tabela abaixo:
|===
@@ -176,7 +186,7 @@
image::images/create-table-friends.png[]
-[start=9]
+
. Quando tiver certeza que a caixa de diálogo Criar Tabela contém as mesmas especificações que as exibidas acima, clique em OK. O IDE gera a tabela ``AMIGOS`` no banco de dados, e você pode ver um novo nó da tabela ``AMIGOS`` (image:images/table-node.png[]) são exibidos no nó de Tabelas. Sob o nó da tabela as colunas (campos) são listadas, iniciando com a chave primária (image:images/primary-key-icon.png[]).
image::images/friends-table.png[]
@@ -202,12 +212,12 @@
NOTE: instruções e consultas formadas no Editor SQL faz parse em SQL. A linguagem SQL utiliza regras de sintaxe estritas com as quais você deve estar familiarizado ao trabalhar no editor do IDE. A sintaxe do SQL também pode diferir dependendo do sistema de gerenciamento de banco de dados. Consulte o link:http://www.oracle.com/technetwork/java/javadb/documentation/index.html[+Manual de Referência do JavaDB+] para obter instruções específicas.
-[start=3]
+
. Clique no botão Executar SQL (image:images/run-sql-button.png[]) na barra de tarefas na parte superior do editor (Ctrl-Shift-E) para executar a consulta. Na janela de Saída (Ctrl-4), uma mensagem é exibida indicando que uma instrução foi executada com êxito.
image::images/run-query.png[]
-[start=4]
+
. Para verificar as alterações, clique com o botão direito no nó de conexão ``BD de Contato `` na janela Serviços e escolha Atualizar. Isso atualiza o componente UI de Runtime para o status atual do banco de dados especificado. Esta etapa é necessária ao executar consultas do Editor SQL no NetBeans IDE. Observe que o novo nó da tabela COLEGAS (image:images/table-node.png[]) é exibida agora em Tabelas na janela Serviços.
@@ -235,7 +245,7 @@
Enquanto estiver digitando, é possível utilizar a funcionalidade autocompletar código do Editor SQL.
-[start=3]
+
. Clique com o botão direito do mouse no Editor SQL e escolha Executar Instrução. A janela de Saída exibe uma mensagem indicando que uma instrução foi executada com êxito.
. Para verificar se o novo registro foi adicionado à tabela ``AMIGOS`` , clique com o botão direito do mouse no nó da tabela ``AMIGOS`` na janela Serviços e escolha Exibir Dados.
@@ -249,7 +259,9 @@
1. Clique com o botão direito no nó da tabela ``AMIGOS`` e escolha Exibir Dados (se não tiver feito isso na última etapa da seção anterior).
2. Clique no botão Inserir Registro(s) ( ``Alt-I`` ) para adicionar uma linha.
A caixa de diálogo Inserir Registros aparece.
-3. Clique em cada célula e insira registros. Observe que para células com tipo de dados Data, é possível escolher uma data do calendário. Clique em OK quando tiver acabado.
+
+[start=3]
+. Clique em cada célula e insira registros. Observe que para células com tipo de dados Data, é possível escolher uma data do calendário. Clique em OK quando tiver acabado.
image::images/insert-records.png[]
@@ -275,12 +287,12 @@
Se preferir, copie o conteúdo de link:https://netbeans.org/project_downloads/usersguide/colleagues.sql[+colleagues.sql+] e, depois abra o editor SQL e cole o conteúdo do arquivo no editor SQL.
-[start=3]
+
. Certifique-se que sua conexão com ``BD de Contato`` esteja selecionada na caixa drop-down Conexão na barra de ferramentas na parte superior do editor.
image::images/conn-drop-down.png[]
-[start=4]
+
. Clique no botão Executar SQL (image::images/run-sql-button.png[]) na barra de tarefas do Editor SQL. O script é executado no banco de dados selecionado e qualquer feedback é gerado na janela de Saída.
. Para verificar as alterações, clique com o botão direito no nó de conexão ``BD de Contato `` na janela Serviços e escolha Atualizar. Observe que a nova tabela ``COLEGAS`` do script SQL agora é exibida como um nó de tabela em ``contact`` na janela Serviços.
. Para exibir os dados contidos nas novas tabelas, clique com o botão direito na tabela ``COLEGAS`` e escolha Exibir Dados. Dessa maneira, você também pode comparar os dados tabulares com os dados contidos no script SQL para ver se eles coincidem.
@@ -295,18 +307,18 @@
image::images/grab-structure.png[]
-[start=3]
+
. Na caixa de diálogo Obter Tabela exibida, especifique um local no computador para salvar o arquivo obtido que será criado. Clique em Salvar.
O arquivo obtido registra a definição de tabela da tabela selecionada.
-[start=4]
+
. Expanda o nó do esquema APP na conexão do banco de dados ``BD de Contato`` , clique no nó Tabelas e escolha Recriar Tabela para abrir a caixa de diálogo Recriar Tabela.
. Na caixa de diálogo Recriar Tabela, navegue até o local no qual você salvou o arquivo de obtenção ``CLIENTE`` e clique em Abrir para abrir a caixa de diálogo Nome da Tabela.
image::images/recreate-table.png[]
-[start=6]
+
. Neste ponto, é possível alterar o nome da tabela ou editar a definição da tabela. Do contrário, clique em OK para criar imediatamente a tabela no banco de dados ``contact`` . Um novo nó de tabela ``CLIENTE`` é exibido abaixo do nó de conexão BD de ``Contato`` .
image::images/new-customer-node.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/java-db_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/java-db_ru.asciidoc
index b60b403..96d0241 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/java-db_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/java-db_ru.asciidoc
@@ -95,9 +95,15 @@
1. В окне 'Службы' щелкните правой кнопкой мыши узел Java DB и выберите 'Запустить сервер'. Обратите внимание на следующую информацию, выведенную в окне "Вывод" и сообщающую о запуске сервера:
image::images/output-start-db.png[]
-2. Правой кнопкой мыши щелкните узел Java DB и выберите "Создать базу данных", чтобы открыть диалоговое окно "Создание базы данных DB".
-3. В качестве имени базы данных введите ``contact`` .
-4. В качестве имени пользователя и пароля введите ``nbuser`` . Нажмите кнопку "ОК".
+
+[start=2]
+. Правой кнопкой мыши щелкните узел Java DB и выберите "Создать базу данных", чтобы открыть диалоговое окно "Создание базы данных DB".
+
+[start=3]
+. В качестве имени базы данных введите ``contact`` .
+
+[start=4]
+. В качестве имени пользователя и пароля введите ``nbuser`` . Нажмите кнопку "ОК".
image::images/javadb-createdb.png[]
*Примечание.* Поле "Расположение базы данных" указан путь по умолчанию, определенный во время установки Java DB из GlassFish. Если база данных Java DB установлена отдельно, это местоположение может быть другим.
@@ -124,11 +130,13 @@
*Примечание.* Также отобразится соединение с базой данных `образец [app on APP]`, которое является схемой базы данных по умолчанию.
-[start=2]
+
. Щелкните правой кнопкой мыши узел подключения к базе данных *контактов* ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ) и выберите команду "Подключить".
Отобразится весь значок узла подключения ( image::images/connection-node-icon.png[]), что означает, что соединение установлено успешно.
-3. Задайте удобное отображаемое имя для базы данных, щелкнув правой кнопкой мыши узел подключения к базе данных ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ) и выберите 'Переименовать'. В текстовом поле введите ``Contact DB`` и нажмите кнопку "ОК".
+
+[start=3]
+. Задайте удобное отображаемое имя для базы данных, щелкнув правой кнопкой мыши узел подключения к базе данных ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ) и выберите 'Переименовать'. В текстовом поле введите ``Contact DB`` и нажмите кнопку "ОК".
== Создание таблиц
@@ -143,15 +151,25 @@
1. Разверните узел подключения ``Contact DB`` и обратите внимание, что он имеет несколько подузлов. В этом учебном курсе рассматривается схема "app". Щелкните правой кнопкой мыши узел "APP" и выберите "Установить как схему по умолчанию".
-2. Разверните узел APP и обратите внимание, что он имеет три подкаталога: "Таблицы", "Представления" и "Процедуры". Правой кнопкой мыши щелкните узел 'Таблицы' и выберите 'Создать таблицу', чтобы открыть диалоговое окно 'Создание таблицы'.
-3. Введите ``FRIENDS`` в текстовое поле "Имя таблицы".
-4. Нажмите кнопку "Добавить столбец". Появится диалоговое окно "Добавить столбец".
-5. В поле "Имя столбца" введите ``id`` . В поле "Тип данных" выберите элемент ``INTEGER`` в раскрывающемся списке.
-6. При определенных обстоятельствах может потребоваться установить флажок "Первичный ключ" для указания того, что данный столбец является первичным ключом для таблицы. Все таблицы, созданные в реляционных базах данных, должны содержать первичный ключ. Обратите внимание, что при выборе флажка "Первичный ключ" выполняется автоматическая установка флажков "Индекс" и "Уникальный", а флажок "Значение отсутствует" при этом снимается. Это объясняется тем, что первичные ключи используются для определения уникальной строки базы данных и по умолчанию применяются как индекс таблицы. Поскольку все строки должны быть определены, первичные ключи не могут иметь значение ``Null`` .
+
+[start=2]
+. Разверните узел APP и обратите внимание, что он имеет три подкаталога: "Таблицы", "Представления" и "Процедуры". Правой кнопкой мыши щелкните узел 'Таблицы' и выберите 'Создать таблицу', чтобы открыть диалоговое окно 'Создание таблицы'.
+
+[start=3]
+. Введите ``FRIENDS`` в текстовое поле "Имя таблицы".
+
+[start=4]
+. Нажмите кнопку "Добавить столбец". Появится диалоговое окно "Добавить столбец".
+
+[start=5]
+. В поле "Имя столбца" введите ``id`` . В поле "Тип данных" выберите элемент ``INTEGER`` в раскрывающемся списке.
+
+[start=6]
+. При определенных обстоятельствах может потребоваться установить флажок "Первичный ключ" для указания того, что данный столбец является первичным ключом для таблицы. Все таблицы, созданные в реляционных базах данных, должны содержать первичный ключ. Обратите внимание, что при выборе флажка "Первичный ключ" выполняется автоматическая установка флажков "Индекс" и "Уникальный", а флажок "Значение отсутствует" при этом снимается. Это объясняется тем, что первичные ключи используются для определения уникальной строки базы данных и по умолчанию применяются как индекс таблицы. Поскольку все строки должны быть определены, первичные ключи не могут иметь значение ``Null`` .
image::images/add-column.png[]
-[start=7]
+
. Теперь повторите эту процедуру, определив поля, как показано на таблице ниже.
|===
@@ -179,7 +197,9 @@
* *дата включения в список контактов;*
* *адрес электронной почты.*
image::images/create-table-friends.png[]
-9.
+
+[start=9]
+.
Если диалоговое окно "Создание таблицы" содержит значения, идентичные вышеописанным, нажмите кнопку "ОК". В IDE создается таблица ``FRIENDS`` в базе данных и отображается новый узел таблицы ``FRIENDS`` (image::images/table-node.png[]) ниже узла 'Таблицы'. Под узлом таблицы перечислены столбцы (поля), начиная с первичного ключа (image::images/primary-key-icon.png[]).
image::images/friends-table.png[]
@@ -205,12 +225,12 @@
*Примечание * Операторы и запросы, сформированные в редакторе SQL, анализируются в соответствии с нормами языка структурированных запросов (Structured Query Language, SQL). Для SQL характерны строгие синтаксические правила, применяемые также при работе с редактором среды IDE. Синтаксис SQL также может быть различаться в зависимости от системы управления базами данных. Дополнительные сведения приведены в link:http://www.oracle.com/technetwork/java/javadb/documentation/index.html[+Справочном пособии по JavaDB+].
-[start=3]
+
. Нажмите кнопку 'Выполнить SQL' (image::images/run-sql-button.png[]) на панели задач в верхней части редактора (Ctrl-Shift-E) для выполнения запроса. В окне "Вывод" (CTRL+4) будет выведено сообщение об успешном выполнении оператора.
image::images/run-query.png[]
-[start=4]
+
. Для проверки изменений щелкните правой кнопкой мыши узел подключения ``Contact DB`` в окне 'Службы' и выберите 'Обновить'. В результате этого действия будет произведено обновление компонента пользовательского интерфейса среды выполнения до текущего состояния указанной базы данных. Этот шаг необходим при запуске запросов из редактора SQL в IDE NetBeans. Обратите внимание, что новый зузел таблицы COLLEAGUES (image::images/table-node.png[]) теперь отображается ниже 'Таблицы' в окне 'Службы'.
@@ -238,7 +258,7 @@
При вводе можно использовать функцию автозавершения кода редактора SQL.
-[start=3]
+
. Щелкните правой кнопкой мыши в пространстве внутри редактора SQL и выберите команду "Выполнить оператор". В окне "Вывод" появится сообщение об успешном выполнении оператора.
. Чтобы убедиться, что новая запись была добавлена к таблице ``FRIENDS`` щелкните правой кнопкой мыши узел таблицы ``FRIENDS`` в окне 'Службы' и выберите 'Просмотреть данные'.
@@ -252,7 +272,9 @@
1. Щелкните правой кнопкой мыши узел таблицы ``FRIENDS`` и выберите "Просмотреть данные" (если просмотр не был выполнен в последнем действии предыдущего раздела).
2. Нажмите кнопку "Вставить записи" ( ``ALT+I`` ) для добавления строки.
Появится диалоговое окно "Вставить записи".
-3. Щелкните каждую ячейку и введите записи. Обратите внимание, что для ячеек с типом данных срока можно выбрать дату из календаря. Нажмите кнопку "ОК" после выполнения действия.
+
+[start=3]
+. Щелкните каждую ячейку и введите записи. Обратите внимание, что для ячеек с типом данных срока можно выбрать дату из календаря. Нажмите кнопку "ОК" после выполнения действия.
image::images/insert-records.png[]
@@ -278,12 +300,12 @@
В качестве альтернативы вы можете скопировать содержимое link:https://netbeans.org/project_downloads/usersguide/colleagues.sql[+colleagues.sql+], а затем открыть редактор SQL и вставить содержимое файла в редактор SQL.
-[start=3]
+
. Убедитесь, что подключение к базе данных ``Contact DB`` в раскрывающемся списке "Подключение" на панели инструментов в верхней части редактора выбрано.
image::images/conn-drop-down.png[]
-[start=4]
+
. Нажмите кнопку 'Выполнить SQL' (image::images/run-sql-button.png[]) на панели инструментов редактора SQL. Сценарий будет выполнен для выбранной базы данных, возвращаемые данные будут выведены в окне "Вывод".
. Для проверки изменений щелкните правой кнопкой мыши узел подключения ``Contact DB`` в окне 'Службы' и выберите 'Обновить'. Обратите внимание, что новая таблица ``COLLEAGUES`` сценария SQL теперь отображена в виде узла таблицы ``contact`` в окне "Службы".
. Для просмотра данных. содержащихся в новой таблице, щелкните правой кнопкой мыши таблицу ``COLLEAGUES`` и выберите 'Просмотреть данные'. Таким образом можно сравнить данные в таблицах с данными сценария SQL, чтобы убедиться в их соответствии.
@@ -297,18 +319,18 @@
image::images/grab-structure.png[]
-[start=3]
+
. В открывшемся диалоговом окне "Сохранение таблицы" укажите путь для сохранения создаваемого файла захвата на компьютере. Нажмите кнопку "Сохранить".
Определение выбранной таблицы будет записано в файл захвата.
-[start=4]
+
. Разверните узел схемы APP в подключении к базе данных ``Contact DB`` , щелкните правой кнопкой мыши узел 'Таблицы' и выберите 'Повторно создайте таблицу', чтобы открыть открыть диалоговое окно 'Повторно создайте таблицу'.
. В открывшемся диалоговом окне "Восстановление таблицы" перейдите по пути хранения файла захвата ``CUSTOMER`` , скопируйте файл и нажмите кнопку "Открыть", чтобы открыть диалоговое окно 'Именование таблицы'.
image::images/recreate-table.png[]
-[start=6]
+
. В выведенном окне можно изменить имя таблицы или отредактировать ее определение. Для немедленного создания таблицы в базе данных ``contact`` нажмите кнопку "ОК". Узел таблицы ``CUSTOMER`` отобразится под узлом подключения к базе данных ``Contact DB`` .
image::images/new-customer-node.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/java-db_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/java-db_zh_CN.asciidoc
index 1aa2912..2ef1271 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/java-db_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/java-db_zh_CN.asciidoc
@@ -95,9 +95,15 @@
1. 在 "Services"(服务)窗口中,右键单击 "Java DB" 节点,然后选择 "Start Server"(启动服务器)。请注意 "Output"(输出)窗口中的以下输出内容,该内容指示服务器已经启动:
image::images/output-start-db.png[]
-2. 右键单击 "Java DB" 节点,然后选择 "Create Database"(创建数据库),以打开 "Create Java DB Database"(创建 Java DB 数据库)对话框。
-3. 键入 ``contact`` 作为数据库名称。
-4. 键入 ``nbuser`` 作为用户名和口令。单击 "OK"(确定)。
+
+[start=2]
+. 右键单击 "Java DB" 节点,然后选择 "Create Database"(创建数据库),以打开 "Create Java DB Database"(创建 Java DB 数据库)对话框。
+
+[start=3]
+. 键入 ``contact`` 作为数据库名称。
+
+[start=4]
+. 键入 ``nbuser`` 作为用户名和口令。单击 "OK"(确定)。
image::images/javadb-createdb.png[]
*注:*"Database Location"(数据库位置)是从 GlassFish 安装 Java DB 期间设置的默认位置。如果单独安装了 Java DB,则此位置可能会有所不同。
@@ -124,12 +130,12 @@
*注:*您还将看到作为默认数据库方案的 `sample [app on APP]` 数据库连接。
-[start=2]
+
. 右键单击 *contact* 数据库连接节点 ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ),然后选择 "Connect"(连接)。
"connection node"(连接节点)图标将完全显示出来 (image::images/connection-node-icon.png[]),这表示连接成功。
-[start=3]
+
. 为数据库创建适当的显示名称,方法是右键单击数据库连接节点 ( ``jdbc:derby://localhost:1527/contact [nbuser on NBUSER]`` ),然后选择 "Rename"(重命名)。在文本字段中键入 ``Contact DB`` ,然后单击 "OK"(确定)。
@@ -145,13 +151,25 @@
1. 展开 ``Contact DB`` 连接节点,您会看到其中有若干方案子节点。app 方案是适用于本教程的唯一方案。右键单击 APP 节点,然后选择 "Set as Default Schema."(设置为默认方案)。
-2. 展开 APP 节点,请注意,该节点下面有三个子文件夹:"Tables"(表)、"Views"(视图)和 "Procedures"(过程)。右键单击 "Tables"(表)节点,然后选择 "Create Table"(创建表)以打开 "Create Table"(创建表)对话框。
-3. 在 "Table Name"(表名称)文本字段中,键入 ``FRIENDS`` 。
-4. 单击 "Add Column"(添加列)。随即出现 "Add Column"(添加列)对话框。
-5. 在列的 "Name"(名称)中,输入 ``id`` 。对于数据 "Type"(类型),从下拉列表中选择 ``INTEGER`` 。
-6. 在 "Constraints"(约束)下,选中 "Primary Key"(主键)复选框以将此列指定为表的主键。关系数据库中的所有表都必须包含主键。请注意,在选中 "Primary Key"(主键)复选框时,还将会自动选中 "Index"(索引)和 "Unique"(唯一)复选框,而 "Null"(空值)复选框则会取消选中。这是因为主键用于标识数据库中的唯一行,并且默认情况下用作表索引。由于必须标识所有行,因此主键不能包含 ``空`` 值。
+
+[start=2]
+. 展开 APP 节点,请注意,该节点下面有三个子文件夹:"Tables"(表)、"Views"(视图)和 "Procedures"(过程)。右键单击 "Tables"(表)节点,然后选择 "Create Table"(创建表)以打开 "Create Table"(创建表)对话框。
+
+[start=3]
+. 在 "Table Name"(表名称)文本字段中,键入 ``FRIENDS`` 。
+
+[start=4]
+. 单击 "Add Column"(添加列)。随即出现 "Add Column"(添加列)对话框。
+
+[start=5]
+. 在列的 "Name"(名称)中,输入 ``id`` 。对于数据 "Type"(类型),从下拉列表中选择 ``INTEGER`` 。
+
+[start=6]
+. 在 "Constraints"(约束)下,选中 "Primary Key"(主键)复选框以将此列指定为表的主键。关系数据库中的所有表都必须包含主键。请注意,在选中 "Primary Key"(主键)复选框时,还将会自动选中 "Index"(索引)和 "Unique"(唯一)复选框,而 "Null"(空值)复选框则会取消选中。这是因为主键用于标识数据库中的唯一行,并且默认情况下用作表索引。由于必须标识所有行,因此主键不能包含 ``空`` 值。
image::images/add-column.png[]
-7. 接下来,重复执行此过程,以便指定下表中所示的字段:
+
+[start=7]
+. 接下来,重复执行此过程,以便指定下表中所示的字段:
|===
@@ -180,7 +198,7 @@
image::images/create-table-friends.png[]
-[start=9]
+
. 在确保 "Create Table"(创建表)对话框包含与上图所示相同的内容后,单击 "OK"(确定)。IDE 会在数据库中生成 ``FRIENDS`` 表,并且您可以看到 "Tables"(表)节点下显示一个新的 ``FRIENDS`` 表节点 (image::images/table-node.png[])。在表节点下将列出从主键 (image::images/primary-key-icon.png[]) 开始的各个列 (字段)。
image::images/friends-table.png[]
@@ -206,12 +224,12 @@
*请注:*SQL 编辑器中形成的语句和查询将以结构化查询语言进行解析。SQL 遵循严格的语法规则,在 IDE 的编辑器中工作时应先熟悉一下这些规则。根据不同的数据库管理系统,SQL 语法也会有所不同。有关详细的准则,请参见《link:http://www.oracle.com/technetwork/java/javadb/documentation/index.html[+JavaDB 参考手册+]》。
-[start=3]
+
. 单击编辑器顶部任务栏中的 "Run SQL"(运行 SQL)(image::images/run-sql-button.png[]) 按钮(Ctrl-Shift-E 组合键)以执行查询。在 "Output"(输出)窗口(Ctrl-4 组合键)中,将显示一条消息,指示已成功执行该语句。
image::images/run-query.png[]
-[start=4]
+
. 要验证更改,请在 "Services"(服务)窗口中右键单击 ``Contact DB`` 连接节点,然后选择 "Refresh"(刷新)。此操作会将运行时 UI 组件更新为指定数据库的当前状态。当从 NetBeans IDE 中的 SQL 编辑器运行查询时,必须执行此步骤。您会看到,现在新的 COLLEAGUES 表节点 (image::images/table-node.png[]) 显示在 "Services"(服务)窗口中的 "Tables"(表)下。
@@ -239,7 +257,7 @@
键入时可以使用 SQL 编辑器代码完成。
-[start=3]
+
. 在 SQL 编辑器中单击鼠标右键,然后选择 "Run Statement"(运行语句)。"Output"(输出)窗口将显示一条消息,指示已成功执行该语句。
. 要验证是否已将新记录添加到 ``FRIENDS`` 表中,请在 "Services"(服务)窗口中右键单击 ``FRIENDS`` 表节点,然后选择 "View Data"(查看数据)。
@@ -254,7 +272,7 @@
2. 单击 "Insert Record"(插入记录)( ``Alt-I`` ) 按钮以添加一行。
即会显示 "Insert Record"(插入记录)对话框。
-[start=3]
+
. 单击每个单元并输入记录。注意,对于“日期”数据类型的单元,可以从日历中选择一个日期。完成后单击 "OK"(确定)。
image::images/insert-records.png[]
@@ -281,12 +299,12 @@
或者,也可以复制 link:https://netbeans.org/project_downloads/usersguide/colleagues.sql[+colleagues.sql+] 的内容,打开 SQL 编辑器,然后将该文件的内容粘贴到 SQL 编辑器。
-[start=3]
+
. 确保从编辑器顶部工具栏的 "Connection"(连接)下拉框中选择了连接到 ``Contact DB`` 。
image::images/conn-drop-down.png[]
-[start=4]
+
. 单击 "SQL Editor"(SQL 编辑器)任务栏中的 "Run SQL"(运行 SQL)(image::images/run-sql-button.png[]) 按钮。将对选定的数据库执行该脚本,并在 "Output"(输出)窗口中生成任何反馈。
. 要验证更改,请在 "Services"(服务)窗口中右键单击 ``Contact DB`` 连接节点,然后选择 "Refresh"(刷新)。请注意,在 "Services"(服务)窗口中的 ``contact`` 下面将显示通过 SQL 脚本创建的新 ``COLLEAGUES`` 表的表节点。
. 要查看新表中包含的数据,请右键单击 ``COLLEAGUES`` 表并选择 "View Data"(查看数据)。通过这种方法,还可以将表格数据与 SQL 脚本中包含的数据进行比较,以查看它们是否匹配。
@@ -302,18 +320,18 @@
image::images/grab-structure.png[]
-[start=3]
+
. 在打开的 "Grab Table"(抓取表)对话框中,指定计算机上的某一位置,以保存将要创建的抓取文件。单击 "Save"(保存)。
抓取文件记录选定表的定义。
-[start=4]
+
. 展开 ``Contact DB`` 数据库连接下的 "APP schema"(APP 方案)节点,右键单击 "Tables"(表)节点,然后选择 "Recreate Table"(重新创建表)以打开 "Recreate Table"(重新创建表)对话框。
. 在 "Recreate Table"(重新创建表)对话框中,导航到 ``CUSTOMER`` 抓取文件的保存位置,然后单击 "Open"(打开)以便打开 "Name the Table"(命名表)对话框。
image::images/recreate-table.png[]
-[start=6]
+
. 此时,可以更改表名称或编辑表定义。否则,请单击 "OK"(确定),以在 ``contact`` 数据库中立即创建表。 ``Contact`` DB 连接节点下将显示新的 ``CUSTOMER`` 表节点。
image::images/new-customer-node.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues.asciidoc
index 026b1d6..4a95d54 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues.asciidoc
@@ -45,7 +45,7 @@
hgext.mq =
----
-[start=3]
+
. Save the file.
== Creating a Patch
@@ -60,7 +60,7 @@
image::images/create-patch-small.png[role="left", link="images/create-patch.png"]
--
-[start=2]
+
. Specify the name for a patch in the Patch Name text field.
. Provide the description of a patch in the Patch Message field.
Alternatively, choose either of the following options and click OK afterwards:
@@ -69,7 +69,7 @@
NOTE: The provided description of a patch will be used as a commit message when <<finish,turning the patch into a permanent changeset>>.
-[start=4]
+
. Select files to be included into the patch in the Files To Include In Patch table.
. (Optional) Specify information pertinent to an issue related to the created patch using the fields of the Update Issue area.
. Click Create Patch.
@@ -87,7 +87,7 @@
image::images/refresh-patch-small.png[role="left", link="images/refresh-patch.png"]
--
-[start=2]
+
. Provide the description of a patch in the Patch Message field.
Alternatively, choose either of the following options and click OK afterwards:
* click the Recent Messages button (image::images/recent.png[]) to select a message from a list of most recent commit messages
@@ -95,7 +95,7 @@
NOTE: The provided description of a patch will be used as a commit message when <<finish,turning the patch into a permanent changeset>>.
-[start=3]
+
. Select files to be included into the patch in the Files To Include In Patch table.
. (Optional) In the Update Issue area, specify information pertinent to an issue related to the changes being committed.
. Click Refresh Patch.
@@ -113,7 +113,7 @@
image::images/qdiff-small.png[role="left", link="images/qdiff.png"]
--
-[start=2]
+
. Review and revise differences found in the compared files using either Graphical or Textual Diff Viewer.
NOTE: The Graphical Diff Viewer highlights changes in the files using the following color encoding.
@@ -151,7 +151,7 @@
NOTE: Names of applied patches display in bold. Choose ``Team`` > ``Queues`` > ``Pop All Patches`` to remove the applied patches from the top of the stack and update the working directory to undo the effects of the applied patches.
-[start=2]
+
. Select the required patch and click Go.
The IDE applies the changes contained in the selected patch to the chosen project, file, or folder.
@@ -167,12 +167,12 @@
image::images/finish-patches.png[]
-[start=2]
+
. Select the name of a patch to be finished in the patches field.
NOTE: All patches in the series before the selected patch will also be finished.
-[start=3]
+
. Click Finish Patches.
The IDE turns all applied patches up to the selected patch into regular changesets.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ja.asciidoc
index 3d6ef16..7091285 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ja.asciidoc
@@ -78,7 +78,7 @@
hgext.mq =
----
-[start=3]
+
. ファイルを保存します。
@@ -96,7 +96,7 @@
image::images/create-patch-small.png[role="left", link="images/create-patch.png"]
--
-[start=2]
+
. 「パッチ名」テキスト・フィールドにパッチの名前を指定します。
. 「パッチ・メッセージ」フィールドにパッチの説明を入力します。
または、次のオプションのいずれかを選択し、その後に「OK」をクリックします。
@@ -105,7 +105,7 @@
*注意:* 入力したパッチの説明は、<<finish,パッチを永久変更セットに変更>>するときにコミット・メッセージとして使用されます。
-[start=4]
+
. 「パッチに含めるファイル」表で、パッチに含めるファイルを選択します。
. (オプション)「問題を更新」領域のフィールドを使用して、作成したパッチに関連した問題に関する情報を指定します。
. 「パッチの作成」をクリックします。
@@ -126,7 +126,7 @@
image::images/refresh-patch-small.png[role="left", link="images/refresh-patch.png"]
--
-[start=2]
+
. 「パッチ・メッセージ」フィールドにパッチの説明を入力します。
または、次のオプションのいずれかを選択し、その後に「OK」をクリックします。
* 「最近のメッセージ」ボタン(image::images/recent.png[])をクリックし、最近のコミット・メッセージのリストからメッセージを選択します。
@@ -134,7 +134,7 @@
*注意:* 入力したパッチの説明は、<<finish,パッチを永久変更セットに変更>>するときにコミット・メッセージとして使用されます。
-[start=3]
+
. 「パッチに含めるファイル」表で、パッチに含めるファイルを選択します。
. (オプション)「問題を更新」領域で、コミットする変更に関連した問題に関する情報を指定します。
. 「パッチのリフレッシュ」をクリックします。
@@ -155,7 +155,7 @@
image::images/qdiff-small.png[role="left", link="images/qdiff.png"]
--
-[start=2]
+
. グラフィカルな差分ビューアまたはテキスト形式の差分ビューアを使用して、比較ファイルで検出された相違を確認および置換します。
*注意:* グラフィカルな差分ビューアは、次の色分けを使用してファイル内の変更を強調表示します。
@@ -198,7 +198,7 @@
* 適用されているパッチの名前は太字で表示されます。
* スタックの上部から適用済パッチを除去して作業ディレクトリを更新し、適用済パッチが影響しないようにするには、「 ``チーム`` 」>「 ``キュー`` 」>「 ``すべてのパッチのポップ`` 」を選択します。
-[start=2]
+
. 必要なパッチを選択して「移動」をクリックします。
選択したパッチに含まれている変更が、選択したプロジェクト、ファイルまたはフォルダに適用されます。
@@ -217,12 +217,12 @@
image::images/finish-patches.png[]
-[start=2]
+
. パッチ・フィールドで終了するパッチの名前を選択します。
*注意:* 選択したパッチの前にあるシリーズのすべてのパッチも終了されます。
-[start=3]
+
. 「パッチの終了」をクリックします。
選択したパッチまでのすべての適用済パッチが通常の変更セットに変更されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_pt_BR.asciidoc
index 047ad25..5e973fe 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_pt_BR.asciidoc
@@ -62,7 +62,7 @@
hgext.mq =
----
-[start=3]
+
. Salve o arquivo.
@@ -80,7 +80,7 @@
image::images/create-patch-small.png[role="left", link="images/create-patch.png"]
--
-[start=2]
+
. Especifique o nome de um patch no campo de texto Nome do Patch.
. Forneça a descrição de um patch no campo Mensagem do Patch.
Se preferir, escolha uma das seguintes opções e clique em OK posteriormente:
@@ -89,7 +89,7 @@
NOTE: A descrição fornecida de um patch será usada como uma mensagem de confirmação ao <<finish,transformar o patch em um conjunto de alterações permanente>>.
-[start=4]
+
. Selecione os arquivos a serem incluídos no patch na tabela Arquivos a Serem Incluídos no Patch.
. (Opcional) Especifique informações pertinentes a um problema relacionado ao patch criado usando os campos da área Atualizar Problema.
. Clique em Criar Patch.
@@ -110,7 +110,7 @@
image::images/refresh-patch-small.png[role="left", link="images/refresh-patch.png"]
--
-[start=2]
+
. Forneça a descrição de um patch no campo Mensagem do Patch.
Se preferir, escolha uma das seguintes opções e clique em OK posteriormente:
* clique no botão Mensagens Recentes (image::images/recent.png[]) para selecionar uma mensagem de uma lista de mensagens de confirmação mais recentes
@@ -118,7 +118,7 @@
NOTE: A descrição fornecida de um patch será usada como uma mensagem de confirmação ao <<finish,transformar o patch em um conjunto de alterações permanente>>.
-[start=3]
+
. Selecione os arquivos a serem incluídos no patch na tabela Arquivos a Serem Incluídos no Patch.
. (Opcional) Na área Atualizar Problema, especifique as informações pertinentes a um problema relacionado às alterações que estão sendo confirmadas.
. Clique em Atualizar Patch.
@@ -137,7 +137,7 @@
image::images/qdiff-small.png[role="left", link="images/qdiff.png"]
--
-[start=2]
+
. Revise as diferenças encontradas nos arquivos comparados usando o Visualizador de Diferenças Textual ou Gráfico.
NOTE: O Visualizador Gráfico de Diferenciação é alterado nos arquivos usando a seguinte codificação colorida.
@@ -181,7 +181,7 @@
* Nomes de patches aplicados são exibidos em negrito.
* Escolha ``Equipe`` > ``Filas`` > ``Exibir Todos os Patches`` para remover os patches aplicados na parte superior da pilha e atualizar o diretório de trabalho para desfazer os efeitos de os patches aplicados.
-[start=2]
+
. Selecione o patch necessário e clique em Ir.
O IDE aplica as alterações contidas no patch selecionado para o projeto escolhido, arquivo ou pasta.
@@ -200,12 +200,12 @@
image::images/finish-patches.png[]
-[start=2]
+
. Selecione o nome de um patch a ser finalizado no campo Patches.
NOTE: todos os patches da série antes do patch selecionado também serão finalizados.
-[start=3]
+
. Clique em Finalizar Patches.
O IDE transforma todos os patches aplicados até o patch selecionado em conjuntos de alterações regulares.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ru.asciidoc
index 9d570a4..f9fce50 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_ru.asciidoc
@@ -61,7 +61,7 @@
[extensions]
hgext.mq =
----
-[start=3]
+
. Сохраните файл.
@@ -79,7 +79,7 @@
image::images/create-patch-small.png[role="left", link="images/create-patch.png"]
--
-[start=2]
+
. Укажите имя исправления в текстовом поле 'Имя исправления'.
. Укажите описание исправления в поле 'Сообщение исправления'.
В качестве альтернативы выберите один из следующих вариантов и нажмите ОК:
@@ -88,7 +88,7 @@
NOTE: Предоставленное описание исправления будет использовано как сообщение фиксации при <<finish,преобразовании исправление в повтоянный набор изменений>>.
-[start=4]
+
. Выберите файлы для включения в исправления в таблице 'Файлы для включения в исправление'.
. (Необязательно) Укажите данные, связанные с ошибкой созданного исправления с помощью полей области 'Ошибка обновления'.
. Нажмите кнопку "Создать исправление".
@@ -109,7 +109,7 @@
image::images/refresh-patch-small.png[role="left", link="images/refresh-patch.png"]
--
-[start=2]
+
. Укажите описание исправления в поле 'Сообщение исправления'.
В качестве альтернативы выберите один из следующих вариантов и нажмите ОК:
* нажмите кнопку 'Последние сообщения' (image::images/recent.png[]), чтобы выбрать сообщение из списка последних сообщений фиксации
@@ -117,7 +117,7 @@
NOTE: Предоставленное описание исправления будет использовано как сообщение фиксации при <<finish,преобразовании исправление в повтоянный набор изменений>>.
-[start=3]
+
. Выберите файлы для включения в исправления в таблице 'Файлы для включения в исправление'.
. (Необязательно) В области 'Ошибка обновления' укажите данные, связанные с ошибкой фиксации изменений.
. Щелкните 'Обновить исправление'.
@@ -138,7 +138,7 @@
image::images/qdiff-small.png[role="left", link="images/qdiff.png"]
--
-[start=2]
+
. Просмотрите и откорректируйте различия, найденные в сравненных файлах с помощью графического или текстового средства просмотра различий.
NOTE: Графическое представление различий выделяет изменения в файлах с помощью следующих цветовых кодов.
@@ -179,7 +179,7 @@
* Имена отображенных примененных исправлений, выделенных полужирным.
* Выберите ``Группа`` > ``Queues`` > ``Откат всех исправлений`` , чтобы удалить примененные исправления из верхней части стека, обновить рабочий каталог и отменить изменения, внесенные установленными исправлениями.
-[start=2]
+
. Выберите необходимое исправление и щелкните 'Перейти'.
В IDE применяются изменения, содержащиеся в выбранном исправлении выбранного проекта, файла или папки.
@@ -198,12 +198,12 @@
image::images/finish-patches.png[]
-[start=2]
+
. Выберите имя исправления, которое будет завершено в поле исправлений.
NOTE: Все исправления в серии до выбранного исправления также будет завершены.
-[start=3]
+
. Щелкните 'Завершить исправления'.
IDE преобразует все примененные изменения вплоть до выбранного исправления в стандартные наборы изменений.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_zh_CN.asciidoc
index b2dd008..e2412a2 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial-queues_zh_CN.asciidoc
@@ -63,7 +63,7 @@
hgext.mq =
----
-[start=3]
+
. 保存该文件。
@@ -81,7 +81,7 @@
image::images/create-patch-small.png[role="left", link="images/create-patch.png"]
--
-[start=2]
+
. 在 "Patch Name"(补丁程序名)文本字段中指定补丁程序的名称。
. 在 "Patch Message"(补丁程序消息)字段中提供补丁程序的说明。
此外,还可选择以下选项之一,然后单击 "OK"(确定):
@@ -90,7 +90,7 @@
NOTE: <<finish,将补丁程序转到永久更改集>>时,提供的补丁程序说明将用作提交消息。
-[start=4]
+
. 在 "Files To Include In Patch"(要包含在补丁程序中的文件)表中选择要包含在补丁程序中的文件。
. (可选) 使用 "Update Issue"(更新问题)区域中的字段指定与已创建补丁程序有关的问题的相关信息。
. 单击 "Create Patch"(创建补丁程序)。
@@ -111,7 +111,7 @@
image::images/refresh-patch-small.png[role="left", link="images/refresh-patch.png"]
--
-[start=2]
+
. 在 "Patch Message"(补丁程序消息)字段中提供补丁程序的说明。
此外,还可选择以下选项之一,然后单击 "OK"(确定):
* 单击 "Recent Messages"(近期的消息)按钮 (image::images/recent.png[]) 可从最近提交的消息列表中选择消息
@@ -119,7 +119,7 @@
NOTE: <<finish,将补丁程序转到永久更改集>>时,提供的补丁程序说明将用作提交消息。
-[start=3]
+
. 在 "Files To Include In Patch"(要包含在补丁程序中的文件)表中选择要包含在补丁程序中的文件。
. (可选)在 "Update Issue"(更新问题)区域中,指定与所提交更改有关的问题的相关信息。
. 单击 "Refresh Patch"(刷新补丁程序)。
@@ -140,7 +140,7 @@
image::images/qdiff-small.png[role="left", link="images/qdiff.png"]
--
-[start=2]
+
. 检查并修订使用图形化比较查看器或文本式比较查看器在所比较文件中发现的差异。
NOTE: 图形化比较查看器使用以下颜色编码来突出显示文件中的更改。
@@ -183,7 +183,7 @@
* 已应用补丁程序的名称以粗体显示。
* 选择 ``Team`` (团队开发)> ``Queues`` (队列)> ``Pop All Patches`` (弹出所有补丁程序)可从堆栈顶层删除已应用补丁程序,并更新工作目录以撤消所应用补丁程序的效果。
-[start=2]
+
. 选择所需的补丁程序,然后单击 "Go"(开始)。
IDE 将所选补丁程序中包含的更改应用到所选项目、文件或文件夹。
@@ -202,12 +202,12 @@
image::images/finish-patches.png[]
-[start=2]
+
. 在补丁程序字段中选择要完成的补丁程序的名称。
NOTE: 还将完成系列中位于所选补丁程序之前的所有补丁程序。
-[start=3]
+
. 单击 "Finish Patches"(完成补丁程序)。
IDE 会将所选补丁程序及该补丁程序之前的所有已应用补丁程序转入常规更改集中。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial.asciidoc
index f86e66b..7cbaa3a 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial.asciidoc
@@ -51,7 +51,7 @@
image::images/options-dialog-small.png[role="left", link="images/options-dialog.png"]
--
-[start=3]
+
. In the Mercurial Executable Path text field, either type in the path to the executable file or click Browse to navigate to it on your system. Note that you need not _include_ the Mercurial executable file in the path.
. Click OK.
@@ -94,7 +94,7 @@
NOTE: The IDE's drop-down menus are context-sensitive, i.e. the available options depend on the item currently selected. Therefore, if you are already working within a Mercurial project, you can choose ``Team`` > ``Remote`` > ``Clone Other`` from the main menu.
-[start=2]
+
. In Repository URL, enter the path to the repository (e.g. ``http://hg.netbeans.org/main`` ).
. In the User and Password fields that the Clone wizard displays, enter your netbeans.org username and password.
@@ -103,7 +103,7 @@
image::images/clone-username-small.png[role="left", link="images/clone-username.png"]
--
-[start=4]
+
. If you are using a proxy, be sure to click the Proxy Configuration button and enter any required information in the Options dialog box. When you are certain your connection settings to the repository are correct, click Next.
. In the second step, click Change to the right of the Default Push Path field. The Change Push Path dialog box opens.
@@ -112,7 +112,7 @@
image::images/clone-push-small.png[role="left", link="images/clone-push.png"]
--
-[start=6]
+
. Modify your default push entry by adding your NetBeans username and password and changing the protocol to ``https`` .
. Click Set Path. The Change Push Path dialog box closes.
. Click Next to pass to the third step of the wizard.
@@ -125,7 +125,7 @@
NOTE: If you are running Windows, be careful of the path length that you specify; i.e., ``C:\Documents and Settings\myName\My Documents\NetBeans\etc\etc`` can cause an unsuccessful clone due to very long file paths. Try using ``C:\`` instead.
-[start=10]
+
. Leave the Scan for NetBeans Projects after Checkout option selected, then click Finish to initiate the check out action.
The IDE checks out the specified sources and the IDE's status bar indicates the progress of the files downloading from the repository to your local working directory. You can also view files as they are being checked out from the Output window (Ctrl-4 on Windows/Command-4 on OS X).
@@ -146,7 +146,7 @@
image::images/repositoryrootpath.png[role="left", link="images/repositoryrootpath.png"]
--
-[start=2]
+
. Specify the repository folder in which you want to place the project in the repository. A folder containing the name of your project is suggested for you in the Root Path text field by default.
. Click OK to initiate the Mercurial initialize action.
Upon clicking OK, the IDE uploads the project files to the repository.
@@ -164,7 +164,7 @@
image::images/status-small.png[role="left", link="images/status.png"]
--
-[start=4]
+
. Choose ``Mercurial`` > ``Commit`` from the project's right-click menu to commit these project files to the Mercurial repository. The Commit - [ProjectName] dialog box opens.
[.feature]
@@ -172,7 +172,7 @@
image::images/commit-dialog-small.png[role="left", link="images/commit-dialog.png"]
--
-[start=5]
+
. Type your message in the Commit Message text area and click Commit.
NOTE: The committed files are placed together with the ``.hg`` directory in the Mercurial repository directory. The commit details are available in the IDE Output window (Ctrl-4 on Windows/Command-4 on OS X).
@@ -380,7 +380,7 @@
image::images/mercurial-merge-small.png[role="left", link="images/mercurial-merge.png"]
--
-[start=4]
+
. Click Merge. The IDE incorporates any differences found between the repository revisions and your local copy of the file. If merge conflicts occur, the file's status is updated to <<resolving,Merge Conflict>> to indicate this.
NOTE: After merging revisions to your local working copy, you must still commit changes using the Commit command in order for them to be added to the repository.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ja.asciidoc
index fd4b1d7..4eede44 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ja.asciidoc
@@ -85,7 +85,7 @@
image::images/options-dialog-small.png[role="left", link="images/options-dialog.png"]
--
-[start=3]
+
. 「Mercurial実行可能ファイル・パス」テキスト・フィールドに、実行可能ファイルのパスを入力するか、または「参照」をクリックしてシステム上のその場所まで移動します。パスにMercurial実行可能ファイルを_含める_必要はありません。
. 「OK」をクリックします。
@@ -132,7 +132,7 @@
*注意: *IDEのドロップダウン・メニューはコンテキスト依存です。つまり、使用可能なオプションは現在選択されている項目によって異なります。そのため、すでにMercurialプロジェクト内で作業している場合、メイン・メニューから「 ``チーム`` 」>「 ``リモート`` 」>「 ``他をクローン`` 」を選択できます。
-[start=2]
+
. 「リポジトリURL」に、リポジトリのパス( ``http://hg.netbeans.org/main`` など)を入力します。
. クローン・ウィザードに表示される「ユーザー」および「パスワード」フィールドに、netbeans.orgユーザー名およびパスワードを入力します。
@@ -141,7 +141,7 @@
image::images/clone-username-small.png[role="left", link="images/clone-username.png"]
--
-[start=4]
+
. プロキシを使用している場合は、「プロキシ構成」ボタンをクリックし、「オプション」ダイアログ・ボックスに必要な情報を入力します。リポジトリへの接続設定が正しいことを確認したら、「次」をクリックします。
. 2番目のステップで、「デフォルトのプッシュ・パス」フィールドの右側の「変更」をクリックします。「プッシュ・パスの変更」ダイアログ・ボックスが開きます。
@@ -150,7 +150,7 @@
image::images/clone-push-small.png[role="left", link="images/clone-push.png"]
--
-[start=6]
+
. NetBeansユーザー名とパスワードを追加し、プロトコルを ``https`` に変更して、デフォルトのプッシュ・エントリを変更します。
. 「パスを設定」をクリックします。「プッシュ・パスの変更」ダイアログ・ボックスが閉じます。
. 「次」をクリックして、ウィザードの3番目の手順に移動します。
@@ -163,7 +163,7 @@
*注意:* Windowsを実行している場合、指定するパスの長さに注意してください。つまり、 ``C:\Documents and Settings\myName\My Documents\NetBeans\etc\etc`` は、ファイルのパスが非常に長いため、クローンが成功しないことがあります。かわりに ``C:\`` を使用してみてください。
-[start=10]
+
. 「チェックアウト後にNetBeansプロジェクトをスキャン」オプションを選択されたままにし、「終了」をクリックしてチェックアウト・アクションを開始します。
IDEによって指定したソースがチェックアウトされ、リポジトリからローカルの作業用ディレクトリへのファイルのダウンロードの進捗状況がIDEのステータス・バーに示されます。チェックアウト中のファイルを、「出力」ウィンドウから表示することもできます(Windowsでは[Ctrl]-[4]、OS Xでは[Command]-[4])。
@@ -185,7 +185,7 @@
image::images/repositoryrootpath.png[role="left", link="images/repositoryrootpath.png"]
--
-[start=2]
+
. リポジトリ内でプロジェクトを配置するリポジトリ・フォルダを指定します。「ルート・パス」テキスト・フィールドには、デフォルトで、プロジェクトの名前を含むフォルダが自動的に提案されます。
. 「OK」をクリックし、Mercurial初期化アクションを開始します。
「OK」をクリックすると、IDEによりプロジェクト・ファイルがリポジトリにアップロードされます。
@@ -203,7 +203,7 @@
image::images/status-small.png[role="left", link="images/status.png"]
--
-[start=4]
+
. プロジェクトの右クリック・メニューから「 ``Mercurial`` 」>「 ``コミット`` 」を選択し、これらのプロジェクト・ファイルをMercurialリポジトリにコミットします。「コミット - [プロジェクト名]」ダイアログ・ボックスが開きます。
[.feature]
@@ -211,7 +211,7 @@
image::images/commit-dialog-small.png[role="left", link="images/commit-dialog.png"]
--
-[start=5]
+
. 「コミット・メッセージ」テキスト領域にメッセージを入力し、「コミット」をクリックします。
*注意:* コミットされたファイルが、 ``.hg`` ディレクトリと一緒にMercurialリポジトリ・ディレクトリに配置されます。コミットの詳細は、IDEの「出力」ウィンドウから表示することもできます(Windowsでは[Ctrl]-[4]、OS Xでは[Command]-[4])。
@@ -429,7 +429,7 @@
image::images/mercurial-merge-small.png[role="left", link="images/mercurial-merge.png"]
--
-[start=4]
+
. 「マージ」をクリックします。IDEによって、リポジトリ・リビジョンとファイルのローカル・コピー間に検出されたすべての相違が取り込まれます。マージ競合が発生した場合、ファイルのステータスはこれを示すために「<<resolving,競合をマージ>>」に更新されます。
*注意:* リビジョンをローカル作業コピーにマージした後、それらをリポジトリに追加するには、「コミット」コマンドを使用して、変更をコミットする必要があります。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_pt_BR.asciidoc
index 3380b19..688ecad 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_pt_BR.asciidoc
@@ -51,7 +51,7 @@
image::images/options-dialog-small.png[role="left", link="images/options-dialog.png"]
--
-[start=3]
+
. No campo de texto do Caminho do Executável do Mercurial, digite o caminho do arquivo executável ou clique em Explorar para navegar até ele em seu sistema. Observe que não é necessário _incluir_o arquivo executável Mercurial no caminho.
. Clique em OK.
@@ -98,7 +98,7 @@
NOTE: os menus drop-down do IDE se adaptam ao contexto, ou seja, as opções disponíveis dependem do item selecionado no momento. Portanto, se você já estiver trabalhando dentro de um projeto Mercurial, poderá escolher ``Equipe`` > ``Remoto`` > ``Clonar Outros`` no menu principal.
-[start=2]
+
. No URK do repositório, insira o caminho para o repositório (e.g. ``http://hg.netbeans.org/main`` ).
. Nos campos Senha e Usuário que o assistente exibe, insira o nome de usuário e senha do netbeans.org.
@@ -107,7 +107,7 @@
image::images/clone-username-small.png[role="left", link="images/clone-username.png"]
--
-[start=4]
+
. Caso esteja usando um proxy, certifique-se de clicar no botão Configuração de Proxy e insira quaisquer informações solicitadas na caixa de diálogo Opções. Quando tiver certeza de que suas definições de conexão estão corretas, clique em Próximo.
. No segundo passo, clique em Alterar ao lado direito do campo do Caminho de Expansão Default. A caixa de diálogo de Alterar Caminho de Expansão é aberta.
@@ -116,7 +116,7 @@
image::images/clone-push-small.png[role="left", link="images/clone-push.png"]
--
-[start=6]
+
. Modifique a entrada de expansão default ao adicionar o nome de usuário e senha do NetBeans e modificar o protocolo para ``https`` .
. Clique em Definir Caminho. A caixa de diálogo Alterar Caminho de Expansão é fechada.
. Clique em Próximo para ir para a próxima etapa do assistente.
@@ -129,7 +129,7 @@
NOTE: se estiver usando o Windows, tome cuidado com o tamanho do caminho que especificar, isto é, ``C:\Documents and Settings\myName\My Documents\NetBeans\etc\etc`` pode causar uma falha na clonagem devido a um caminho muito longo. Tente usar ``C:\`` .
-[start=10]
+
. Deixe selecionada a opção Procurar por Projetos do NetBeans após Check-out e, em seguida, clique em Finalizar para iniciar a ação de check-out.
O IDE faz check-out dos códigos-fonte especificados, e a barra de status do IDE indica o andamento do download dos arquivos do repositório no seu diretório de trabalho local. Você também pode exibir os arquivos que estão tendo check-out na janela de Saída (Ctrl-4 no Windows/Commandd-4 no OS X).
@@ -151,7 +151,7 @@
image::images/repositoryrootpath.png[role="left", link="images/repositoryrootpath.png"]
--
-[start=2]
+
. Especifique a pasta de repositório em que deseja colocar o projeto no repositório. Uma pasta contendo o nome do seu projeto é sugerida para você por default no campo de texto do Caminho-Raiz.
. Clique em OK para iniciar a ação de inicialização do Mercurial.
Ao clicar em OK, o IDE faz upload dos arquivos do projeto para o repositório.
@@ -169,7 +169,7 @@
image::images/status-small.png[role="left", link="images/status.png"]
--
-[start=4]
+
. Selecione ``Mercurial`` > ``Confirmar`` no menu de contexto para confirmar esses arquivos de projeto para o repositório do Mercurial. A caixa de diálogo Confirmar - [ProjectName] é aberta.
[.feature]
@@ -177,7 +177,7 @@
image::images/commit-dialog-small.png[role="left", link="images/commit-dialog.png"]
--
-[start=5]
+
. Digite sua mensagem na área de texto Confirmar Mensagem e clique em Confirmar.
NOTE: os arquivos confirmados são colocados no diretório ``.hg`` do repositório do Mercurial. Os detalhes de confirmação estão disponíveis na janela de Saída do IDE (Ctrl-4 no Windows/Command-4 no OS X).
@@ -391,7 +391,7 @@
image::images/mercurial-merge-small.png[role="left", link="images/mercurial-merge.png"]
--
-[start=4]
+
. Clique em Mesclar. O IDE incorpora quaisquer diferenças constatadas entre a versão de revisão do repositório e a cópia local do arquivo. Se ocorrerem conflitos de mesclagem, o status do arquivo será atualizado em <<resolving,Conflito de Mesclagem>> para indicar o fato.
NOTE: depois de mesclar as alterações do arquivo com o diretório de trabalho local, ainda é necessário confirmar as alterações usando o comando Confirmar para poder adicionar as alterações ao repositório.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ru.asciidoc
index b1f8c44..e909cbb 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_ru.asciidoc
@@ -68,7 +68,7 @@
image::images/options-dialog-small.png[role="left", link="images/options-dialog.png"]
--
-[start=3]
+
. В текстовом поле "Путь к исполняемому файлу Mercurial" введите путь к исполняемому файлу или щелкните "Обзор", чтобы выбрать его в системе. Обратите внимание, что исполняемый файл Mercurial не _включен_ в путь.
. Нажмите кнопку "ОК".
@@ -114,7 +114,7 @@
NOTE: Раскрывающееся меню IDE являются контекстно-зависимыми, т.е. доступные параметры зависят от текущего выбранного элемента. Поэтому, если вы уже работаете с проектом Mercurial, можно выбрать ``Контроль версий`` > ``Регистрация`` > ``Клонировать другое`` в главном меню.
-[start=2]
+
. В поле "URL-адрес репозитория" введите путь к репозиторию (например, ``http://hg.netbeans.org/main`` ).
. В полях "Пользователь" и "Пароль" мастера клонирования введите имя пользователя и пароль netbeans.org.
@@ -123,7 +123,7 @@
image::images/clone-username-small.png[role="left", link="images/clone-username.png"]
--
-[start=4]
+
. Если используется прокси, необходимо нажать кнопку "Настройка прокси" и ввести всю необходимую информацию в диалоговом окне "Параметры". Если вы не уверены в правильности параметров подключения к репозиторию, нажмите кнопку "Далее".
. Во втором действии щелкните "Изменить" справа от поля "Default Push Path" (Путь выгрузки изменений по умолчанию) . Откроется диалоговое окно "Изменить путь выгрузки изменений".
@@ -132,7 +132,7 @@
image::images/clone-push-small.png[role="left", link="images/clone-push.png"]
--
-[start=6]
+
. Изменить элемент выгрузки изменений по умолчанию, добавив имя пользователя и пароль NetBeans и выбрав протокол ``https`` .
. Щелкните "Установить путь". Диалоговое окно "Изменить путь выгрузки изменений" закроется.
. Щелкните "Далее", чтобы перейти к третьему шагу мастера.
@@ -145,7 +145,7 @@
NOTE: При работе в Windows, обращайте особое внимание на указываемую длину, т.е. такой путь как ``C:\Documents and Settings\myName\My Documents\NetBeans\etc\etc`` может привести к ошибке клонирования из-за очень длинных путей к файлам. Вместо этого попробуйте использовать ``C:\`` .
-[start=10]
+
. Оставьте установленным флажок "Поиск проектов Netbeans после выгрузки", затем нажмите "Готово", чтобы инициировать действие взятия.
Среда IDE берёт указанные исходные коды для изменения, а в строке состояния IDE отображается ход выполнения загрузки файлов из репозитория в локальный рабочий каталог. Также можно просмотреть файлы и их изъятие в окне 'Выходные данные' (Ctrl-4 в Windows/Command-4 в OS X).
@@ -167,7 +167,7 @@
image::images/repositoryrootpath.png[role="left", link="images/repositoryrootpath.png"]
--
-[start=2]
+
. Укажите папку репозитория, в которую необходимо разместить проект в репозитории. По умолчанию в текстовом поле "Корневой путь" предлагается папка, содержащая имя проекта.
. Нажмите "ОК", чтобы инициировать действие инициализации Mercurial.
При нажатии кнопки ОК среда IDE загружает файлы проекта в репозиторий.
@@ -185,7 +185,7 @@
image::images/status-small.png[role="left", link="images/status.png"]
--
-[start=4]
+
. Выберите ``Mercurial`` > ``Фиксировать`` в контекстом меню проекта, чтобы зафиксировать файлы проекта в репозитории Mercurial. Фиксация - Открывается диалоговое окно [имя_проекта].
[.feature]
@@ -193,7 +193,7 @@
image::images/commit-dialog-small.png[role="left", link="images/commit-dialog.png"]
--
-[start=5]
+
. Введите сообщение в текстовую область "Сообщение о фиксации" и щелкните "Фиксация".
NOTE: Фиксированные файлы помещаются вместе с каталогом ``.hg`` в каталог репозитория Mercurial. Сведения о фиксации можно получить в окне IDE 'Выходные данные' (Ctrl-4 в Windows/Command-4 в OS X).
@@ -408,7 +408,7 @@
image::images/mercurial-merge-small.png[role="left", link="images/mercurial-merge.png"]
--
-[start=4]
+
. Щелкните "Слить". Среда IDE объединяет все найденные различия между редакциями репозитория и локальной копией файла. При возникновении конфликтов слияния устанавливается состояние файла <<resolving,Конфликт слияния>> для указания на это.
NOTE: После слияния изменений с локальной рабочей копией, все равно необходимо зафиксировать изменения, используя команду Commit для того, чтобы они были добавлены в репозиторий.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_zh_CN.asciidoc
index 60011cd..2ed65d1 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mercurial_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mercurial_zh_CN.asciidoc
@@ -85,7 +85,7 @@
image::images/options-dialog-small.png[role="left", link="images/options-dialog.png"]
--
-[start=3]
+
. 在 "Mercurial Executable Path"(Mercurial 可执行文件路径)文本字段中,输入可执行文件的路径,或者单击 "Browse"(浏览)在系统中找到它。请注意,您不需要将 Mercurial 可执行文件_包含_在路径中。
. 单击 "OK"(确定)。
@@ -131,7 +131,7 @@
NOTE: IDE 的下拉菜单是与上下文相关的,即可用选项取决于当前选定的项。因此,如果已在使用 Mercurial 项目,则可以从主菜单中选择 ``Team`` (团队开发)> ``Remote`` (远程)> ``Clone Other`` (克隆其他)。
-[start=2]
+
. 在 "Repository URL"(资源库 URL)中,输入资源库的路径(例如 ``http://hg.netbeans.org/main`` )。
. 在克隆向导显示的 "User"(用户)和 "Password"(口令)字段中,输入 netbeans.org 用户名和口令。
@@ -140,7 +140,7 @@
image::images/clone-username-small.png[role="left", link="images/clone-username.png"]
--
-[start=4]
+
. 如果要使用代理,请务必单击 "Proxy Configuration"(代理配置)按钮,然后在 "Options"(选项)对话框中输入所有必要的信息。如果确定资源库的连接设置正确无误,请单击 "Next"(下一步)。
. 在第二步中,单击 "Default Push Path"(默认推入路径)字段右侧的 "Change"(更改)。"Change Push Path"(更改推入路径)对话框打开。
@@ -149,7 +149,7 @@
image::images/clone-push-small.png[role="left", link="images/clone-push.png"]
--
-[start=6]
+
. 添加 NetBeans 用户名和口令,并将协议更改为 ``https`` ,以修改默认推入项。
. 单击 "Set Path"(设置路径)。此时将关闭 "Change Push Path"(更改推入路径)对话框。
. 单击 "Next"(下一步)以转到该向导的第三步。
@@ -162,7 +162,7 @@
NOTE: 如果运行的是 Windows,请留意指定的路径长度;即 ``C:\Documents and Settings\myName\My Documents\NetBeans\etc\etc`` ,克隆可能会因文件路径过长而失败。请试着改用 ``C:\`` 。
-[start=10]
+
. 将 "Scan for NetBeans Projects after Checkout"(在检出后扫描 Netbeans 项目)选项保持选中状态,然后单击 "Finish"(完成),以启动检出操作。
IDE 将检出选定的源,并且 IDE 的状态栏会显示将文件从资源库下载到本地工作目录的进度。您还可以在 "Output"(输出)窗口(在 Windows 上按 Ctrl-4 组合键;在 OS X 上按 Command-4 组合键)中查看正要检出的文件。
@@ -184,7 +184,7 @@
image::images/repositoryrootpath.png[role="left", link="images/repositoryrootpath.png"]
--
-[start=2]
+
. 在资源库中指定用来放置项目的资源库文件夹。默认情况下,建议您在 "Root Path"(根路径)文本字段中,键入包含项目名称的文件夹。
. 单击 "OK"(确定)以启动 Mercurial 初始化操作。
单击 "OK"(确定)后,IDE 会将项目文件上载到资源库。
@@ -202,7 +202,7 @@
image::images/status-small.png[role="left", link="images/status.png"]
--
-[start=4]
+
. 右键单击项目,然后从弹出式菜单中选择 ``Mercurial`` > ``Commit`` (提交),以便将这些项目文件提交到 Mercurial 资源库中。此时将打开 "Commit - [ProjectName]"(提交 - [项目名称])对话框。
[.feature]
@@ -210,7 +210,7 @@
image::images/commit-dialog-small.png[role="left", link="images/commit-dialog.png"]
--
-[start=5]
+
. 在 "Commit Message"(提交消息)文本区域中键入消息,然后单击 "Commit"(提交)。
NOTE: 提交的文件连同 ``.hg`` 目录一起放在 Mercurial 资源库目录中。IDE 的 "Output"(输出)窗口(在 Windows 上按 Ctrl-4 组合键;在 OS X 上按 Command-4 组合键)中提供了详细提交信息。
@@ -428,7 +428,7 @@
image::images/mercurial-merge-small.png[role="left", link="images/mercurial-merge.png"]
--
-[start=4]
+
. 单击 "Merge"(合并)。IDE 将在资源库修订版本之间发现的所有差异与本地文件副本进行合并。如果发生合并冲突,则文件的状态会更新为 <<resolving,Merge Conflict>>(合并冲突),以说明这一情况。
NOTE: 将修订版本合并到本地工作副本后,仍须使用 "Commit"(提交)命令提交更改,以便将它们添加到资源库中。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mysql.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mysql.asciidoc
index 24a7fb5..0bbe90e 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mysql.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mysql.asciidoc
@@ -43,44 +43,44 @@
image::images/mysql-props1.png[]
-[start=2]
+
. Confirm that the server host name and port are correct.
Notice that the IDE enters `localhost` as the default server host name and `3306` as the default server port number.
-[start=3]
+
. Enter the Administrator user name (if not displayed).
NOTE: You need administrative access to be able to create and remove databases.
-[start=4]
+
. Enter the Administrator password. The default is set to blank.
NOTE: A blank password can also be a password.
-[start=5]
+
. Click the Admin Properties tab at the top of the dialog box.
The Admin Properties tab is then displayed, allowing you to enter information for controlling the MySQL Server.
-[start=6]
+
. In the Path/URL to admin tool field, type or browse to the location of your MySQL Administration application such as the MySQL Admin Tool, PhpMyAdmin, or other web-based administration tools.
NOTE: `mysqladmin` is the MySQL admin tool found in the `bin` folder of the MySQL installation directory. It is a command-line tool and not ideal for use with the IDE.
Type any arguments for the admin tool in the Arguments field.
-[start=7]
+
. In the Path to start command, type or browse to the location of the MySQL start command. To find the start command, look for `mysqld` in the `bin` folder of the MySQL installation directory.
NOTE: The recommended binary for Unix and NetWare is `mysql_safe`. The start command may also vary if MySQL was installed as part of an AMP installation.
Type any arguments for the start command in the Arguments field.
-[start=8]
+
. In the Path to stop command field, type or browse to the location of the MySQL stop command. This is usually the path to `mysqladmin` in the `bin` folder of the MySQL installation directory. If the command is `mysqladmin`, in the Arguments field, type `-u root stop` to grant `root` permissions for stopping the server.
-[start=9]
+
. When finished, the Admin Properties tab should resemble the following figure. If you are satified with your configuration, click OK.
image::images/mysql-props2.png[]
@@ -105,19 +105,19 @@
The Create MySQL Database dialog box opens.
-[start=2]
+
. In the Create MySQL Database dialog box, type the name of the new database. We will use `MyNewDatabase` for this tutorial. Leave the checkbox unselected at this time.
image::images/create-db-dbx.png[]
NOTE: You can also grant full access to a given user. By default, only the admin user has the permissions to perform certain commands. The drop down list lets you assign these permissions to a specified user.
-[start=3]
+
. Click OK.
The new database appears under the MySQL Server node in the Services window.
-[start=4]
+
. Right-click the new database node and choose Connect in the popup menu to open the connection to the database.
Database connections that are open are represented by a complete connection node (image::images/connection-node-icon.png[]) in the Services window.
@@ -158,12 +158,12 @@
NOTE: Queries formed in the SQL Editor are parsed in Structured Query Language (SQL). SQL adheres to strict syntax rules which you should be familiar with when working in the IDE's Editor. Upon running a query, feedback from the SQL engine is generated in the Output window indicating whether execution was successful or not.
-[start=4]
+
. To execute the query, either click the Run SQL (image::images/run-sql-button.png[]) button in the task bar at the top (Ctrl-Shift-E), or right-click within the SQL Editor and choose Run Statement. The IDE generates the ``Counselor`` table in the database, and you receive a message similar to the following in the Output window.
image::images/create-counselor-query.png[]
-[start=5]
+
. To verify changes, right-click the Tables node in the Database Explorer and choose Refresh. The Refresh option updates the Database Explorer's UI component to the current status of the specified database. Note that the new ``Counselor`` table node (image:images/table-node.png[]) now displays under Tables in the Database explorer. If you expand the table node you can see the columns (fields) you created, starting with the primary key (image:images/primary-key-icon.png[]).
image::images/counselor-table.png[]
@@ -180,7 +180,7 @@
image::images/add-column-dialog.png[]
-[start=5]
+
. Select the Primary Key check box in the Add Column dialog box. You are specifying the primary key for your table. All tables found in relational databases must contain a primary key. Note that when you select the Key check box, the Index and Unique check boxes are also automatically selected and the Null check box is deselected. This is because primary keys are used to identify a unique row in the database, and by default form the table index. Because all rows need to be identified, primary keys cannot contain a Null value.
. Repeat this procedure by adding the remaining columns, as shown in the following table.
@@ -221,7 +221,7 @@
VALUES (1, 'Ricky', '"The Dragon"', 'Steamboat','334 612-5678', 'r_steamboat@ifpwafcad.com', '1996-01-01')
----
-[start=3]
+
. To execute the query, right-click within the SQL Editor and choose Run Statement. In the Output window, you can see a message indicating that the query was successfully executed.
. To verify that the new record has been added to the ``Counselor`` table, in the Database Explorer, right-click the ``Counselor`` table node and choose View Data. A new SQL Editor pane opens in the main window. When you choose View Data, a query to select all the data from the table is automatically generated in the upper region of the SQL Editor. The results of the statement are displayed in a table view in the lower region. In this example, the ``Counselor`` table displays. Note that a new row has been added with the data you just supplied from the SQL query.
@@ -248,7 +248,7 @@
image::images/connection-drop-down.png[]
-[start=3]
+
. Click the Run SQL (image::images/run-sql-button.png[]) button in the SQL Editor's task bar. The script is executed against the selected database, and any feedback is generated in the Output window.
. To verify changes, right-click the ``MyNewDatabase`` connection node in the Runtime window and choose Refresh. The Refresh option updates the Database Explorer's UI component to the current status of the specified database. Note that the two new tables from the SQL script now display as a table nodes under ``MyNewDatabase`` in the Database Explorer.
. Choose View Data from the right-click menu of a selected table node to see the data contained in the new tables. In this manner, you can compare the tabular data with the data contained in the SQL script to see that they match.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mysql_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mysql_ja.asciidoc
index b4bd0c3..7a468c7 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mysql_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mysql_ja.asciidoc
@@ -59,38 +59,38 @@
image::images/mysql-props1.png[]
-[start=2]
+
. サーバー・ホスト名とポートが正しいことを確認します。
IDEによって、デフォルトのサーバー・ホスト名に「`localhost`」が入力され、デフォルトのサーバー・ポート番号に「`3306`」が入力されます。
-[start=3]
+
. 管理者ユーザー名を入力します(表示されない場合)。
NOTE: データベースを作成したり除去するには管理者アクセスが必要です。
-[start=4]
+
. 管理者のパスワードを入力します。デフォルトでは空白に設定されています。
NOTE: 空白のパスワードも有効です。
-[start=5]
+
. ダイアログ・ボックスの最上部にある「管理プロパティ」タブをクリックします。
「管理プロパティ」タブが表示され、MySQLサーバーを管理するための情報を入力できます。
-[start=6]
+
. 「管理ツールのパスまたはURL」フィールドにMySQL管理ツール、PhpMyAdmin、またはその他のWebベース管理ツールなどのMySQL管理アプリケーションの場所を入力するか、参照して選択します。
NOTE: `mysqladmin`は、MySQLのインストール・ディレクトリの`bin`フォルダにあるMySQL管理ツールです。これはコマンド行ツールであり、IDEでの使用には適していません。
管理ツールに引数を付ける場合は、「引数」フィールドに引数を入力します。
-[start=7]
+
. 「起動コマンドのパス」には、MySQL起動コマンドの場所を入力するか、参照して選択します。起動コマンドを探すには、MySQLインストール・ディレクトリの`bin`フォルダにある`mysqld`を探します。
NOTE: UnixおよびNetWare用の推奨バイナリは`mysql_safe`です。MySQLがAMPインストールの一部としてインストールされた場合、起動コマンドも異なる場合があります。
起動コマンドに引数を付ける場合は、「引数」フィールドに引数を入力します。
-[start=8]
+
. 「停止コマンドのパス」フィールドには、MySQL停止コマンドの場所を入力するか、参照して選択します。これは通常、MySQLインストール・ディレクトリの`bin`フォルダにある`mysqladmin`のパスです。コマンドが`mysqladmin`の場合、「引数」フィールドに「`-u root stop`」と入力し、`root`にサーバーを停止する権限を許可します。
. 終了すると、「管理プロパティ」タブは次の図のようになります。構成に問題がなければ、「OK」をクリックします。
@@ -116,17 +116,17 @@
「MySQLデータベースの作成」ダイアログ・ボックスが開きます。
-[start=2]
+
. 「MySQLデータベースの作成」ダイアログ・ボックスで、新しいデータベースの名前を入力します。このチュートリアル用に`MyNewDatabase`を使用します。この時点では、チェックボックスは選択解除したままにしておきます。 image:images/create-db-dbx.png[]
NOTE: 特定のユーザーにフル・アクセスを許可することもできます。デフォルトでは、管理ユーザーのみが、特定のコマンドを実行するための権限を持っています。ドロップダウン・リストで、指定したユーザーにそれらの権限を割り当てることができます。
-[start=3]
+
. 「OK」をクリックします。
「サービス」ウィンドウの「MySQLサーバー」ノードの下に新しいデータベースが表示されます。
-[start=4]
+
. 新規データベース・ノードを右クリックし、ポップアップ・メニューで「接続」を選択してデータベースへの接続を開きます。
開かれている状態のデータベース接続は、「サービス」ウィンドウの完全接続ノード(image:images/connection-node-icon.png[])によって表されます。
@@ -164,12 +164,12 @@
NOTE: SQLエディタで作成した文および問合せは、SQL (Structured Query Language)で構文解析されます。SQLは厳密な構文ルールに準拠しています。IDEのエディタで作業をするときは、これらのルールを理解しておいてください。問合せを実行すると、SQLエンジンからのフィード・バックが「出力」ウィンドウに生成され、実行に成功したかどうかが示されます。
-[start=4]
+
. 問合せを実行するには、最上部のタスクバーにある「SQLの実行」(image:images/run-sql-button.png[])ボタン([Ctrl]-[Shift]-[E])、またはSQLエディタ内を右クリックして「文の実行」を選択します。IDEによって、データベースに ``Counselor`` 表が生成され、「出力」ウィンドウに次のようなメッセージが表示されます。
image::images/create-counselor-query.png[]
-[start=5]
+
. 変更内容を確認するには、データベース・エクスプローラで「表」ノードを右クリックし、「リフレッシュ」を選択します。「リフレッシュ」オプションは、指定したデータベースの現在のステータスにあわせてデータベース・エクスプローラのUIコンポーネントを更新します。データベース・エクスプローラの「表」の下に、新しい ``Counselor`` 表ノード(image:images/table-node.png[])が表示されていることに注意してください。表ノードを展開すると、主キー(image:images/primary-key-icon.png[])で開始する作成済の各列(フィールド)が表示されます。
image::images/counselor-table.png[]
@@ -184,7 +184,7 @@
image::images/add-column-dialog.png[]
-[start=5]
+
. 「列を追加」ダイアログ・ボックスの「主キー」チェックボックスを選択します。表の主キーを指定します。リレーショナル・データベースにあるすべての表に、主キーを含める必要があります。「キー」チェックボックスを選択すると、「索引」および「一意」チェックボックスが自動的に選択され、「Null」チェックボックスが選択解除されます。これは、主キーを使用してデータベース内の行を一意に識別するためです。デフォルトでは、主キーは表の索引を形成します。すべての行が識別される必要があるため、主キーにNull値を含むことはできません。
. 次の表に示すように、残りの列を追加して、この手順を繰り返します。
@@ -223,7 +223,7 @@
INSERT INTO Counselor
VALUES (1, 'Ricky', '"The Dragon"', 'Steamboat','334 612-5678', 'r_steamboat@ifpwafcad.com', '1996-01-01')
----
-[start=3]
+
. 問合せを実行するには、SQLエディタ内を右クリックし、「文を実行」を選択します。「出力」ウィンドウで、問合せの実行に成功したことを示すメッセージを確認できます。
. ``Counselor`` 表に新しいレコードが追加されたことを確認するには、データベース・エクスプローラで「 ``Counselor`` 」表ノードを右クリックし、「データを表示」を選択します。メイン・ウィンドウに新しいSQLエディタ・ペインが開きます。「データを表示」を選択すると、表からすべてのデータを選択する問合せがSQLエディタの上部領域に自動的に生成されます。下部領域の表ビューに文の実行結果が表示されます。この例では、 ``Counselor`` 表が表示されます。SQL問合せから提供されたデータを使用して、新しい行が追加されています。
@@ -250,7 +250,7 @@
image::images/connection-drop-down.png[]
-[start=3]
+
. SQLエディタのタスク・バーにある「SQLの実行」(image:images/run-sql-button.png[])ボタンをクリックします。選択したデータベースに対してスクリプトが実行され、「出力」ウィンドウにフィード・バックが生成されます。
. 変更内容を確認するには、「実行時」ウィンドウで「 ``MyNewDatabase`` 」接続ノードを右クリックし、「リフレッシュ」を選択します。「リフレッシュ」オプションは、指定したデータベースの現在のステータスにあわせてデータベース・エクスプローラのUIコンポーネントを更新します。SQLスクリプトからの2つの新しい表が、データベース・エクスプローラの ``MyNewDatabase`` の下に表ノードとして表示されます。
. 選択されている表ノードの右クリック・メニューから「データを表示」を選択し、新しい表に含まれているデータを表示します。このようにして、表形式のデータとSQLスクリプトに含まれるデータを比較して、両者が同じかどうかを確認できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mysql_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mysql_pt_BR.asciidoc
index 0c467f0..73c043c 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mysql_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mysql_pt_BR.asciidoc
@@ -58,41 +58,41 @@
image::images/mysql-props1.png[]
-[start=2]
+
. Confirme se o nome e a porta do host do servidor estão corretos.
Observe que o IDE insere `localhost` como o nome de host de servidor default e `3306` como o número de porta de servidor default.
-[start=3]
+
. Insira o nome de usuário Administrador (se não estiver exibido).
NOTE: você precisa de acesso administrativo para poder criar e remover bancos de dados.
-[start=4]
+
. Insira a senha do Administrador. O default é definido como em branco.
NOTE: uma senha em branco também pode ser uma senha.
-[start=5]
+
. Clique na guia Propriedades de Admin na parte superior da caixa de diálogo.
A guia Propriedades de Admin é então exibida, permitindo que você insira informações para controlar o servidor MySQL.
-[start=6]
+
. No campo Caminho/URL para ferramenta admin, digite ou navegue para o local da aplicação de administração do MySQL como a Ferramenta admin de MySQL, PhpMyAdmin, ou outras ferramentas de administração baseadas na Web.
NOTE: `mysqladmin` é a ferramenta de administração do MySQL encontrada na pasta `bin` do diretório de instalação do MySQL. Ela é uma ferramenta de linha de comandos e não é ideal para uso com o IDE.
Digite argumentos para a ferramenta admin no campo Argumentos.
-[start=7]
+
. Em Caminho para o comando iniciar, digite a localização do comando iniciar do MySQL ou navegue até ele. Para encontrar o comando iniciar, procure `mysqld` na pasta `bin` do diretório de instalação do MySQL.
NOTE: o binário recomendado para Unix e NetWare é ` mysql_safe`. O comando iniciar também pode variar se o MySQL tiver sido instalado como parte de uma instalação AMP.
Digite argumentos para o comando iniciar no campo Argumentos.
-[start=8]
+
. No campo Caminho para o comando interromper, digite a localização do comando Interromper do MySQL ou navegue até ele. Geralmente, é o caminho para o `mysqladmin` na pasta `bin` do diretório de instalação do MySQL. Se o comando for `mysqladmin`, no campo Argumentos, digite `-u root stop` para conceder permissões `root` para interromper o servidor.
. Quando você terminar, a guia Propriedades de Admin deverá ter aparência similar à seguinte figura. Se estiver satisfeito com a configuração, clique em OK.
@@ -117,17 +117,17 @@
1. Na janela Serviços do IDE, clique com o botão direito do mouse no nó Servidor MySQL e escolha Criar Banco de Dados.
A caixa de diálogo Criar Banco de Dados MySQL é aberta.
-[start=2]
+
. Na caixa de diálogo Criar Banco de Dados MySQL, digite o nome do novo banco de dados. Será utilizado `MyNewDatabase` para este tutorial. Deixe a caixa de seleção desmarcada neste momento. image:images/create-db-dbx.png[]
NOTE: também é possível conceder acesso total a um determinado usuário. Por default, somente o usuário admin possui as permissões para realizar determinados comandos. A lista drop-down permite que você designe essas permissões a um usuário específico.
-[start=3]
+
. Clique em OK.
O novo banco de dados é exibido no nó do Servidor MySQL na janela Serviços.
-[start=4]
+
. Clique com o botão direito do mouse no novo nó do banco de dados e escolha Conectar no menu pop-up para abrir a conexão para o banco de dados.
As conexões do banco de dados que estão abertas são representadas por um nó de conexão completo (image:images/connection-node-icon.png[]) na janela Serviços.
@@ -164,12 +164,12 @@
----
NOTE: consultas formadas no Editor SQL faz parsing em SQL. A linguagem SQL utiliza regras de sintaxe estritas com as quais você deve estar familiarizado ao trabalhar no editor do IDE. Na execução de uma consulta, um feedback do mecanismo SQL é gerado na janela de Saída indicando se a execução foi ou não bem-sucedida.
-[start=4]
+
. Para executar a consulta, clique no botão Executar SQL (image:images/run-sql-button.png[]) na barra de tarefas na parte superior (Ctrl-Shift-E), ou clique com o botão direito do mouse dentro do Editor de SQL e escolha Executar Instrução. O IDE gera a tabela ``Consultor`` no banco de dados, e você recebe uma mensagem similar à seguinte na janela de Saída.
image::images/create-counselor-query.png[]
-[start=5]
+
. Para verificar as alterações, clique com o botão direito do mouse no nó Tabelas no Explorador do Banco de Dados Explorer e escolha Atualizar. A opção Atualizar atualiza o componente UI do Explorador do Banco de Dados para o status atual do banco de dados especificado. Observe que o novo nó da tabela ``Consultor`` (image:images/table-node.png[]) é exibido agora em Tabelas no Explorador do Banco de Dados. Se você expandir o nó da tabela você pode ver as colunas (campos) você criou, iniciando com a chave primária (image:images/primary-key-icon.png[]).
image::images/counselor-table.png[]
@@ -184,7 +184,7 @@
image::images/add-column-dialog.png[]
-[start=5]
+
. Marque a caixa de seleção Chave Primária na caixa de diálogo Adicionar Coluna. Você está especificando a chave primária da tabela. Todas as tabelas de bancos de dados relacionais devem conter uma chave primária. Observe que quando a caixa de seleção Chave é marcada, as caixas de seleção Índice e Exclusivo são automaticamente marcadas e a caixa de seleção Nulo é desmarcada. Isso ocorre porque as chaves primárias são usadas para identificar uma linha exclusiva no banco de dados e por default formam o índice da tabela. Como todas as linhas precisam ser identificadas, as chaves primárias não podem conter um valor Nulo.
. Repita esse procedimento adicionando as colunas remanescentes, como exibido na tabela a seguir.
@@ -223,7 +223,7 @@
VALUES (1, 'Ricky', '"The Dragon"', 'Steamboat','334 612-5678', 'r_steamboat@ifpwafcad.com', '1996-01-01')
----
-[start=3]
+
. Para executar a consulta, clique com o botão direito do mouse no Editor SQL e escolha Executar Instrução. Na janela de Saída, você pode ver uma mensagem indicando que a consulta foi executada com êxito.
. Para verificar se o novo registro foi adicionado à tabela ``Consultor`` , no Explorador do Banco de Dados, clique com o botão direito do mouse no nó da tabela ``Consultor`` e escolha Exibir Dados. Um novo painel Editor SQL é aberto na janela principal. Quando você escolhe Exibir Dados, é gerada automaticamente na região superior do Editor SQL uma consulta para selecionar todos os dados da tabela. Os resultados da instrução são exibidos em uma view em tabela na região inferior. Neste exemplo, a tabela ``Consultor`` é exibida. Observe que uma nova linha foi adicionada com os dados que você acabou de fornecer da consulta SQL.
@@ -251,7 +251,7 @@
image::images/connection-drop-down.png[]
-[start=3]
+
. Clique no botão Executar SQL (image:images/run-sql-button.png[]) na barra de tarefas do Editor SQL. O script é executado no banco de dados selecionado e qualquer feedback é gerado na janela de Saída.
. Para verificar as alterações, clique com o botão direito do mouse no nó da conexão de ``MyNewDatabase`` na janela Runtime e escolha Atualizar. A opção Atualizar atualiza o componente UI do Explorador do Banco de Dados para o status atual do banco de dados especificado. Observe que as duas novas tabelas do script SQL agora são exibidas como nós de tabela em ``MyNewDatabase`` no Explorador do Banco de Dados.
. Escolha Exibir Dados do menu de contexto de um nó de tabela selecionada para ver os dados contidos nas novas tabelas. Dessa maneira, você pode comparar os dados tabulares com os dados contidos no script SQL para ver se eles coincidem.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mysql_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mysql_ru.asciidoc
index 925421c..134b839 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mysql_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mysql_ru.asciidoc
@@ -59,41 +59,41 @@
image::images/mysql-props1.png[]
-[start=2]
+
. Убедитесь, что имя узла и порт сервера указаны правильно.
Обратите внимание, что среда IDE вводит `localhost` как имя узла сервера по умолчанию и `3306` как номер порта сервера по умолчанию.
-[start=3]
+
. Введите имя администратора (если оно не отображается).
NOTE: Необходим доступ с правами администратора, чтобы иметь возможность создавать и удалять базы данных.
-[start=4]
+
. Введите пароль администратора. По умолчанию установлено пустое значение.
NOTE: Пустой пароль является допустимым.
-[start=5]
+
. Нажмите вкладку "Свойства администратора" в верхней части диалогового окна.
Отобразится соответствующая вкладка, предоставляющая возможность ввода сведений для управления сервером MySQL.
-[start=6]
+
. В поле "Путь/URL-адрес к средству администрирования" введите путь к средству администрирования MySQL (например, MySQL Admin Tool, PhpMyAdmin или другому подходящему веб-средству) или найдите его при помощи кнопки "Обзор".
NOTE: `mysqladmin` является инструментов администрирования MySQL, который находится в папке `bin` каталога установки MySQL. Это средство командной строки не подходит для использования в среде IDE.
Введите аргументы для средства администрирования в соответствующее поле.
-[start=7]
+
. В поле "Путь к команде запуска" введите соответствующий путь MySQL или найдите его при помощи кнопки "Обзор". Для получения команды запуска найдите файл `mysqld` в папке `bin` каталога установки MySQL.
NOTE: Рекомендуемый двоичный файл для Unix и NetWare: `mysql_safe`. Также может потребоваться другая команда запуска при установке MySQL в составе установки AMP.
Введите значение аргументов для команды запуска в соответствующее поле.
-[start=8]
+
. В поле "Путь к команде остановки" введите путь к команде остановки MySQL или найдите его при помощи кнопки "Обзор". Обычно требуется ввести путь к файлу `mysqladmin` в папке `bin` каталога установки MySQL. При использовании команды `mysqladmin` введите `-u root stop` в поле "Аргументы" для получения прав пользователя `root` на остановку сервера.
. На рисунке ниже изображен внешний вид вкладки "Свойства администратора" по завершении настройки. Если настройка выполнена корректно, нажмите кнопку "ОК".
@@ -119,17 +119,17 @@
Откроется диалоговое окно "Создание базы данных MySQL".
-[start=2]
+
. В диалоговом окне "Создание базы данных MySQL" введите имя новой базы данных. В этом учебном курсе используется имя `MyNewDatabase`. Не устанавливайте флажок. image:images/create-db-dbx.png[]
NOTE: Также определенному пользователю можно предоставить полный доступ. По умолчанию только администратор обладает правами на выполнение определенных команд. Раскрывающийся список позволяет присваивать эти права определенным пользователям.
-[start=3]
+
. Нажмите кнопку "ОК".
В узле "Сервер MySQL" окна "Службы" будет выведена новая база данных.
-[start=4]
+
. Щелкните узел новой базы данных правой кнопкой мыши и выберите 'Подключение', чтобы установить соединение с базой данных.
Открытые подключения к базе данных отображаются в узле 'Установленные подключения' (image:images/connection-node-icon.png[]) в окне 'Службы'.
@@ -167,12 +167,12 @@
NOTE: Запросы, сформированные в редакторе SQL, анализируются в соответствии с нормами языка структурированных запросов (Structured Query Language, SQL). Для SQL характерны строгие синтаксические правила, применяемые также при работе с редактором среды IDE. После выполнения запроса в окне 'Вывод' будет создан отклик от механизма SQL, указывающий на успешность выполнения или ошибку.
-[start=4]
+
. Чтобы выполнить запрос нажмите кнопку 'Выполнить SQL' (image:images/run-sql-button.png[]) на панели задач в верхней части (Ctrl-Shift-E) или щелкните правой кнопкой мыши в редакторе SQL Editor и выберите 'Выполнить оператор'. В среде IDE будет создана таблица базы данных ``Counselor`` , а в окне "Вывод" появится сообщение, подобное сообщению на рисунке ниже.
image::images/create-counselor-query.png[]
-[start=5]
+
. Для проверки изменений щелкните правой кнопкой мыши узел 'Таблицы' в проводнике баз данных и выберите 'Обновить'. При выборе пункта "Обновить" компоненты интерфейса пользователя в проводнике данных будут приведены в соответствие с текущим состоянием указанной базы данных. Обратите внимание, что новый узел таблицы ``Counselor`` (image:images/table-node.png[]) теперь отображается ниже 'Таблицы' в проводнике баз данных. Если развернуть узел таблицы, можно увидеть созданные столбцы (поля), начинающиеся с первичным ключом (image:images/primary-key-icon.png[]).
image::images/counselor-table.png[]
@@ -187,7 +187,7 @@
image::images/add-column-dialog.png[]
-[start=5]
+
. Установите флажок Primary Key ("Первичный ключ") в диалоговом окне Add Column. В этом действии выполняется определение первичного ключа таблицы. Все таблицы, созданные в реляционных базах данных, должны содержать первичный ключ. Обратите внимание, что при выборе флажка "Ключ" выполняется автоматическая установка флажков "Индекс" и "Уникальный", при этом отменяется выбор флажка "Значение отсутствует". Это объясняется тем, что первичные ключи применяются для определения уникальной строки базы данных и по умолчанию используются в индексе таблицы. Поскольку все строки должны иметь уникальный идентификатор, первичные ключи не могут иметь значение Null.
. Повторите эту процедуру, добавив оставшиеся столбцы, как показано в следующей таблице.
@@ -227,7 +227,7 @@
VALUES (1, 'Ricky', '"The Dragon"', 'Steamboat','334 612-5678', 'r_steamboat@ifpwafcad.com', '1996-01-01')
----
-[start=3]
+
. Чтобы выполнить запрос щелкните правой кнопкой мыши в редакторе SQL Editor и выберите 'Выполнить оператор'. В окне "Вывод" будет выведено сообщение об успешном выполнении запроса.
. Чтобы убедиться, что новая запись добавлена к таблице ``Counselor`` в проводнике баз данных щелкните правой кнопкой мыши узел таблицы ``Counselor`` и выберите 'Просмотреть данные'. В главном окне редактора SQL откроется новая панель. При выборе команды "Просмотреть данные" в верхней части окна редактора SQL автоматически создается запрос на выбор всех данных таблицы. Результаты выполнения оператора отображаются в представлении таблицы в нижней части окна. В рассматриваемом примере будет отображена таблица ``Counselor`` . Обратите внимание, что новая строка была добавлена с данными, предоставленными в запросе SQL.
@@ -254,7 +254,7 @@
image::images/connection-drop-down.png[]
-[start=3]
+
. Нажмите кнопку 'Выполнить SQL' (image:images/run-sql-button.png[]) на панели инструментов редактора SQL. Сценарий будет выполнен для выбранной базы данных, возвращаемые данные будут выведены в окне "Вывод".
. Чтобы проверить изменения щелкните правой кнопкой мыши узел подключения ``MyNewDatabase`` в окне 'Среда выполнения' и выберите 'Обновить'. При выборе пункта "Обновить" компоненты интерфейса пользователя в проводнике данных будут приведены в соответствие с текущим состоянием указанной базы данных. Обратите внимание, что две новые таблицы из сценария SQL теперь отображаются как узлы таблицы в базе данных ``MyNewDatabase`` обозревателя баз данных.
. Выберите 'Просмотреть данные' в контекстном меню выбранного узла таблицы для просмотра данных, содержащихся в новых таблицах. Таким образом можно сравнить данные в таблицах с данными сценария SQL, чтобы убедиться в их соответствии.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/mysql_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/mysql_zh_CN.asciidoc
index 4b8fd80..19551f4 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/mysql_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/mysql_zh_CN.asciidoc
@@ -58,40 +58,40 @@
image::images/mysql-props1.png[]
-[start=2]
+
. 确认服务器主机名和端口正确无误。
请注意,IDE 将输入 `localhost` 作为默认服务器主机名,并输入 `3306` 作为默认服务器端口号。
-[start=3]
+
. 输入管理员用户名(如果未显示)。
NOTE: 您需要具备管理访问权限才能创建和删除数据库。
-[start=4]
+
. 输入 Administrator 作为口令。默认值设为空。
NOTE: 空口令也可以是口令。
-[start=5]
+
. 单击该对话框顶部的 "Admin Properties"(管理属性)标签。
随后将显示 "Admin Properties"(管理属性)标签,允许输入用来控制 MySQL 服务器的信息。
-[start=6]
+
. 在 "Path/URL to admin tool"(管理工具的路径/URL)字段中,键入或浏览至 MySQL 管理应用程序(如 MySQL 管理工具、PhpMyAdmin 或其他基于 Web 的管理工具)的位置。
NOTE: `mysqladmin` 是 MySQl 管理工具,可在 MySQL 安装目录的 `bin` 文件夹中找到。它是命令行工具,用在 IDE 中并不理想。
在 "Arguments"(参数)字段中键入管理工具的参数。
-[start=7]
+
. 在 "Path to start command"(启动命令的路径)中,键入或浏览至 MySQL 启动命令的位置。要找到启动命令,请在 MySQL 安装目录的 `bin` 文件夹中查找 `mysqld`。
NOTE: 对于 Unix 和 NetWare,建议使用二进制文件 `mysql_safe`。此外,如果安装 AMP 时已安装了 MySQL,则启动命令可能也会有所不同。
在 "Arguments"(参数)字段中键入启动命令的参数。
-[start=8]
+
. 在 "Path to stop command"(停止命令的路径)字段中,键入或浏览至 MySQL 停止命令的位置。该位置通常是指向 MySQL 安装目录的 `bin` 文件夹中 `mysqladmin` 的路径。如果该命令为 `mysqladmin`,请在 "Arguments"(参数)字段中键入 `-u root stop`,以便授予停止服务器的 `root` 权限。
. 完成后,"Admin Properties"(管理属性)标签应如下图所示。如果您对配置感到满意,请单击 "OK"(确定)。
@@ -116,17 +116,17 @@
1. 在 IDE 的 "Services"(服务)窗口中,右键单击 MySQL 服务器节点并选择 "Create Database"(创建数据库)。
"Create MySQL Database"(创建 MySQL 数据库)对话框打开。
-[start=2]
+
. 在"Create MySQL Database"(创建 MySQL 数据库)对话框中,键入新数据库的名称。对于本教程,我们将使用 `MyNewDatabase`。此时将该复选框保留为取消选中状态。 image:images/create-db-dbx.png[]
NOTE: 您还可以向给定用户授予完全访问权限。默认情况下,只有管理员用户具备执行某些命令的权限。通过该下拉列表,可以将这些权限指定给指定的用户。
-[start=3]
+
. 单击 "OK"(确定)。
新的数据库就会出现在 "Services"(服务)窗口的 MySQL 服务器节点下。
-[start=4]
+
. 右键单击新数据库节点,然后在弹出菜单中选择 "Connect"(连接)以打开与数据库的连接。
打开的数据库连接由 "Services"(服务)窗口中的一个完整连接节点 (image:images/connection-node-icon.png[]) 表示。
@@ -164,12 +164,12 @@
NOTE: 在 SQL 编辑器中形成的查询采用结构化查询语言 (SQL) 进行解析。SQL 遵循严格的语法规则,在 IDE 的编辑器中工作时应先熟悉一下这些规则。运行查询时,在 "Output"(输出)窗口中生成来自 SQL 引擎的反馈,表明执行是否成功。
-[start=4]
+
. 要执行查询,请单击顶部任务栏中的 "Run SQL"(运行 SQL)(image:images/run-sql-button.png[]) 按钮(Ctrl-Shift-E 组合键),或者在 SQL 编辑器中右键单击并选择 "Run Statement"(运行语句)。IDE 在数据库中生成 ``Counselor`` 表,并且您将收到一条与 "Output"(输出)窗口中的以下内容类似的消息。
image::images/create-counselor-query.png[]
-[start=5]
+
. 要验证更改,请右键单击数据库资源管理器中的 "Tables"(表)节点,然后选择 "Refresh"(刷新)。"Refresh"(刷新)选项用于将数据库资源管理器的 UI 组件更新为指定数据库的当前状态。请注意,此时新的 ``Counselor`` 表节点 (image:images/table-node.png[]) 将显示在数据库资源管理器中的 "Tables"(表)下。如果展开表节点,则可以看到所创建的列 (字段),它们以主键开头 (image:images/primary-key-icon.png[])。
image::images/counselor-table.png[]
@@ -184,7 +184,7 @@
image::images/add-column-dialog.png[]
-[start=5]
+
. 在 "Add Column"(添加列)对话框中,选中 "Primary Key"(主键)复选框。这将为表指定主键。关系数据库中的所有表都必须包含主键。请注意,在选中 "Key"(键)复选框时,也将会自动选中 "Index"(索引)和 "Unique"(唯一)复选框,而 "Null"(空值)复选框则会被取消选中。这是因为主键用于标识数据库中的唯一行,且默认情况下主键可以构成表索引。由于需要标识所有行,因此主键不能包含空值。
. 通过添加其余的列来重复此过程,如下表所示。
@@ -224,7 +224,7 @@
VALUES (1, 'Ricky', '"The Dragon"', 'Steamboat','334 612-5678', 'r_steamboat@ifpwafcad.com', '1996-01-01')
----
-[start=3]
+
. 要执行该查询,请在 SQL 编辑器中单击鼠标右键,然后选择 "Run Statement"(运行语句)。在 "Output"(输出)窗口中,可以看到一条消息,表明已成功执行该查询。
. 要验证是否已将新记录添加到 ``Counselor`` 表中,请在数据库资源管理器中右键单击 ``Counselor`` 表节点并选择 "View Data"(查看数据)。一个新的 SQL 编辑器窗格在主窗口中打开。选择 "View Data"(查看数据)时,在 SQL 编辑器上面的区域中自动生成用于从表中选择所有数据的查询。该语句的结果显示在下面区域中的一个表视图中。在此示例中,将显示 ``Counselor`` 表。请注意,新行中已经添加了刚刚通过 SQL 查询获得的数据。
@@ -251,7 +251,7 @@
image::images/connection-drop-down.png[]
-[start=3]
+
. 单击 "SQL Editor"(SQL 编辑器)任务栏中的 "Run SQL"(运行 SQL)(image:images/run-sql-button.png[]) 按钮。将对选定的数据库执行该脚本,并在 "Output"(输出)窗口中生成任何反馈。
. 要验证更改,请右键单击 "Runtime"(运行时)窗口中的 ``MyNewDatabase`` 连接节点,然后选择 "Refresh"(刷新)。"Refresh"(刷新)选项用于将数据库资源管理器的 UI 组件更新为指定数据库的当前状态。请注意,从 SQL 脚本生成的两个新表现在数据库资源管理器中的 ``MyNewDatabase`` 下显示为表节点。
. 从选定表节点的右击菜单中选择 "View Data"(查看数据),以查看新表中包含的数据。可以采用此方式对表格数据与 SQL 脚本中包含的数据进行比较,以便查看它们是否匹配。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db.asciidoc
index 9241c8d..9b2c9e6 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db.asciidoc
@@ -70,7 +70,7 @@
image::images/new-connection.png[]
-[start=3]
+
. In the New Connection wizard, select Oracle Thin in the Driver dropdown list.
. Click Add and locate the ``ojdbc6.jar`` file that you previously downloaded. Click Next.
. In the Customize Connection panel of the wizard, enter the following values and click Next.
@@ -99,14 +99,14 @@
|Password |Enter the password for the selected username.
|===
-[start=6]
+
. Click Test Connection to confirm that the IDE is able to connect to the database. Click Next.
If the attempt is successful, the message "Connection succeeded" is displayed in the wizard.
image::images/customize-conn.png[]
-[start=7]
+
. Select ``HR`` in the Select Schema dropdown list. Click Finish.
NOTE: You need to unlock the HR schema before you can access it in NetBeans. Unlocking the HR database is described in the Oracle Database XE link:http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25610/toc.htm[+Getting Started tutorial+].
@@ -134,7 +134,7 @@
image::images/execute.png[]
-[start=2]
+
. To create a new user, enter the following command in the SQL Editor window and click the Run SQL button on the toolbar.
image::images/create-user.png[]
@@ -150,7 +150,7 @@
This command creates a new user ``jim`` with the password ``mypassword`` . The default tablespace is ``users`` and the allocated space is unlimited.
-[start=3]
+
. The next step is to grant the ``jim`` user account privileges to do actions in the database. We need to allow the user to connect to the database, create and modify tables in user's default tablespace, and access the ``Employees`` table in the sample ``hr`` database.
In real life, a database administrator creates custom roles and fine tunes privileges for each role. However, for the purpose of our tutorial, we can use a predefined role, such as ``CONNECT`` . For more information about roles and privileges, see link:http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/toc.htm[+Oracle Database Security Guide+].
@@ -183,14 +183,14 @@
image::images/hr-view.png[]
-[start=4]
+
. Right-click the ``Departments`` table node and select Grab Structure. Save the ``.grab`` file on your disk.
. Expand the ``JIM`` schema, right-click the ``Tables`` node and choose Recreate Table.
Point to the ``.grab`` file that you created.
image::images/recreate.png[]
-[start=6]
+
. Review the SQL script that will be used to create the table. Click OK.
image::images/nametable.png[]
@@ -206,7 +206,7 @@
image::images/insert-rec.png[]
-[start=3]
+
. Type in the fields to enter the data. Click OK.
For example, you can enter the following values taken from the original ``DEPARTMENTS`` table.
@@ -257,27 +257,27 @@
To open the Favorites window, click Window > Favorites in the main menu (press Ctrl-3). The _USER_HOME_ directory is listed in the Favorites window by default.
-[start=3]
+
. Right-click the ``locations.sql`` file and choose Run File.
image::images/run-file.png[]
NOTE: If more than one database connection is registered with the IDE, the IDE might prompt you to select the correct connection.
-[start=4]
+
. In the Services window, right-click the Tables node and choose Refresh in the popup menu.
You can see that the ``Locations`` table with data was added to the ``JIM`` schema.
image::images/second-table.png[]
-[start=5]
+
. Right-click the Locations table node and choose View Data to see the table contents. You will see the contents of the Locations table.
You can insert new records and modify existing data directly in this view window.
image::images/view-data1.png[]
-[start=6]
+
. Next, we run a query to display information from two tables: Departments and Locations.
In our case, we will use a simple "natural join", because both tables have the same "location_id" column that holds values of the same data type. This join selects only the rows that have equal values in the matching location_id column.
@@ -307,10 +307,18 @@
* To add a record, click the Insert Records image::images/row-add.png[] icon and insert new data in the Insert Records window that opens. Click the Show SQL button to see the SQL code for this operation. The table will be automatically updated with the new records.
* To modify a record, double-click directly inside any cell in the GUI View of a table and type the new value. Until the change is committed, the modified text is shown in green. To commit your changes, click the Commit Changes image::images/row-commit.png[] icon. To cancel changes, click the Cancel Edits image::images/row-commit.png[] icon.
* To delete a row, select it and click the Delete Selected Records image::images/row-commit.png[] icon.
-2. *Keep Prior Tabs*. Click the Keep Prior Tabs image::images/keepoldresulttabs.png[] icon on the SQL Editor toolbar to keep the windows with the results of previous queries open. This can be helpful if you want to compare the results of several queries.
-3. *SQL History* (Ctrl-Alt-Shift-H). Use the SQL History image::images/sql-history.png[] icon on the SQL Editor toolbar to view all SQL statements that you ran for each of the database connections. Choose the connection from the drop-down list, find the SQL statement that you need and click Insert to place the statement to the SQL Command window.
-4. *Connection list*. If you have several database connections and you need to quickly switch between them in the SQL Editor, use the Connections drop-down list.
-5. *Run SQL Statements*. To run the entire statement that is currently in the SQL Command window, click the Run SQL image::images/runsql.png[]icon. If you want to run only a part of SQL, select it in the SQL Command window, right-click the selection and choose Run Selection. In this case, only the selected part will be executed.
+
+[start=2]
+. *Keep Prior Tabs*. Click the Keep Prior Tabs image::images/keepoldresulttabs.png[] icon on the SQL Editor toolbar to keep the windows with the results of previous queries open. This can be helpful if you want to compare the results of several queries.
+
+[start=3]
+. *SQL History* (Ctrl-Alt-Shift-H). Use the SQL History image::images/sql-history.png[] icon on the SQL Editor toolbar to view all SQL statements that you ran for each of the database connections. Choose the connection from the drop-down list, find the SQL statement that you need and click Insert to place the statement to the SQL Command window.
+
+[start=4]
+. *Connection list*. If you have several database connections and you need to quickly switch between them in the SQL Editor, use the Connections drop-down list.
+
+[start=5]
+. *Run SQL Statements*. To run the entire statement that is currently in the SQL Command window, click the Run SQL image::images/runsql.png[]icon. If you want to run only a part of SQL, select it in the SQL Command window, right-click the selection and choose Run Selection. In this case, only the selected part will be executed.
@@ -324,7 +332,7 @@
*Important: *If there is no such line in ``php.ini`` , look in the extensions folder for the OCI 8 extension file. If there is no OCI 8 extension file in your extensions folder, see link:http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html[+Installing PHP and the Oracle Instant Client for Linux and Windows+] for information about downloading and installing OCI 8.
-[start=4]
+
. Restart Apache. (Windows users should restart their computer.)
. Run ``phpinfo()`` . If you successfully enabled OCI 8, an OCI 8 section appears in ``phpinfo()`` output.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ja.asciidoc
index 2816353..15a85ee 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ja.asciidoc
@@ -74,7 +74,7 @@
image::images/new-connection.png[]
-[start=3]
+
. 新規接続ウィザードで、「ドライバ」ドロップダウン・リストの「Oracle Thin」を選択します。
. 「追加」をクリックし、前にダウンロードした ``ojdbc6.jar`` ファイルを見つけます。「次」をクリックします。
. ウィザードの「接続をカスタマイズ」パネルで、次の値を入力して、「次」をクリックします。
@@ -103,14 +103,14 @@
|パスワード |選択したユーザー名のパスワードを入力します。
|===
-[start=6]
+
. 「接続をテスト」をクリックし、IDEがデータベースに接続できることを確認します。「次」をクリックします。
成功した場合、ウィザードにメッセージ「接続に成功しました」が表示されます。
image::images/customize-conn.png[]
-[start=7]
+
. 「スキーマを選択」ドロップダウン・リストの「 ``HR`` 」を選択します。「終了」をクリックします。
NOTE: NetBeansでHRスキーマにアクセスする前に、それをロック解除する必要があります。HRデータベースのロック解除については、Oracle Database XElink:http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25610/toc.htm[+入門チュートリアル+]で説明されています。
@@ -138,7 +138,7 @@
image::images/execute.png[]
-[start=2]
+
. 新しいユーザーを作成するには、SQLエディタ・ウィンドウで次のコマンドを入力し、ツールバーの「SQLの実行」ボタンをクリックします。
image::images/create-user.png[]
@@ -151,7 +151,7 @@
このコマンドは、新規ユーザー ``jim`` をパスワード ``mypassword`` で作成します。デフォルトの表領域は ``users`` で、割り当てられる領域は無制限です。
-[start=3]
+
. 次のステップは、 ``jim`` ユーザー・アカウントに、データベースのアクションを実行する権限を与えることです。ユーザーがデータベースに接続し、ユーザーのデフォルトの表領域で表を作成して変更し、サンプル ``hr`` データベースの ``Employees`` 表にアクセスできるようにする必要があります。
実際には、データベース管理者がカスタム・ロールを作成し、各ロールの権限を微調整します。ただし、チュートリアルの目的のため、 ``CONNECT`` などの定義済のロールを使用できます。ロールと権限の詳細は、link:http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/toc.htm[+Oracle Databaseセキュリティ・ガイド+]を参照してください。
@@ -187,14 +187,14 @@
image::images/hr-view.png[]
-[start=4]
+
. 「 ``Departments`` 」表ノードを右クリックし、「構造を保存」を選択します。ディスクに ``.grab`` ファイルを保存します。
. ``JIM`` スキーマを展開し、「 ``表`` 」ノードを右クリックして、「表を再作成」を選択します。
作成した ``.grab`` ファイルをポイントします。
image::images/recreate.png[]
-[start=6]
+
. 表の作成に使用するSQLスクリプトを確認します。「OK」をクリックします。
image::images/nametable.png[]
@@ -209,7 +209,7 @@
image::images/insert-rec.png[]
-[start=3]
+
. フィールドにデータを入力します。「OK」をクリックします。
たとえば、元の ``DEPARTMENTS`` 表から取得した次の値を入力できます。
@@ -261,28 +261,28 @@
「お気に入り」ウィンドウを開くには、メイン・メニューの「ウィンドウ」>「お気に入り」をクリックします(Ctrl-3キーを押します)。デフォルトで、「お気に入り」ウィンドウに_USER_HOME_ディレクトリが表示されます。
-[start=3]
+
. ``locations.sql`` ファイルを右クリックし、「ファイルを実行」を選択します。
image::images/run-file.png[]
NOTE: IDEに複数のデータベース接続が登録されている場合は、IDEによって正しい接続を選択するように求められます。
-[start=4]
+
. 「サービス」ウィンドウで、「表」ノードを右クリックし、ポップアップ・メニューの「リフレッシュ」を選択します。
データを含む ``Locations`` 表が ``JIM`` スキーマに追加されたことがわかります。
image::images/second-table.png[]
-[start=5]
+
. 「Locations」表ノードを右クリックし、「データを表示」を選択して、表の内容を確認します。「Locations」表の内容を確認します。
この表示ウィンドウで直接、新しいレコードを挿入したり、既存のデータを変更したりできます。
image::images/view-data1.png[]
-[start=6]
+
. 次に、DepartmentsとLocationsの2つの表の情報を表示する問合せを実行します。
この例では、両方の表に同じデータ型の値を保持する同じ「location_id」列があるため、単純な「自然結合」を使用します。この結合では、一致するlocation_id列に等しい値を持つ行のみが選択されます。
@@ -313,10 +313,18 @@
* レコードを追加するには、「レコードを挿入」(image:images/row-add.png[])アイコンをクリックし、開いた「レコードを挿入」ウィンドウに新しいデータを挿入します。「SQLを表示」ボタンをクリックして、この操作のSQLコードを表示します。表が新しいレコードで自動的に更新されます。
* レコードを変更するには、表のGUIビューの任意のセル内を直接ダブルクリックし、新しい値を入力します。変更がコミットされるまで、変更したテキストは緑で表示されます。変更内容をコミットするには、「変更をコミット」(image:images/row-commit.png[])アイコンをクリックします。変更内容を取り消すには、「編集の取消」(image:images/row-commit.png[])アイコンをクリックします。
* 行を削除するには、行を選択して「選択したレコードを削除」(image:images/row-commit.png[])アイコンをクリックします。
-2. *前のタブの保持*。SQLエディタ・ツールバーの「前のタブの保持」(image:images/keepoldresulttabs.png[])アイコンをクリックし、前の問合せの結果を開いた状態でウィンドウを保持します。これは、複数の問合せの結果を比較する場合に役立つことがあります。
-3. *SQL履歴*(Ctrl-Alt-Shift-H)。SQLエディタツールバーの「SQL履歴」(image:images/sql-history.png[])アイコンを使用して、各データベース接続に対して実行したすべてのSQL文を表示します。ドロップダウン・リストから接続を選択し、必要なSQL文を見つけて、「挿入」をクリックし、「SQLコマンド」ウィンドウに文を配置します。
-4. *接続の一覧*。複数のデータベース接続があり、SQLエディタでそれらをすばやく切り替える必要がある場合、「接続」ドロップダウン・リストを使用します。
-5. *SQL文の実行*。SQLコマンド・ウィンドウに現在ある文全体を実行するには、「SQLの実行」(image:images/runsql.png[])アイコンをクリックします。SQLの一部のみを実行する場合は、「SQLコマンド」ウィンドウでその部分を選択し、選択を右クリックして、「セクションを実行」を選択します。この場合、選択した部分のみが実行されます。
+
+[start=2]
+. *前のタブの保持*。SQLエディタ・ツールバーの「前のタブの保持」(image:images/keepoldresulttabs.png[])アイコンをクリックし、前の問合せの結果を開いた状態でウィンドウを保持します。これは、複数の問合せの結果を比較する場合に役立つことがあります。
+
+[start=3]
+. *SQL履歴*(Ctrl-Alt-Shift-H)。SQLエディタツールバーの「SQL履歴」(image:images/sql-history.png[])アイコンを使用して、各データベース接続に対して実行したすべてのSQL文を表示します。ドロップダウン・リストから接続を選択し、必要なSQL文を見つけて、「挿入」をクリックし、「SQLコマンド」ウィンドウに文を配置します。
+
+[start=4]
+. *接続の一覧*。複数のデータベース接続があり、SQLエディタでそれらをすばやく切り替える必要がある場合、「接続」ドロップダウン・リストを使用します。
+
+[start=5]
+. *SQL文の実行*。SQLコマンド・ウィンドウに現在ある文全体を実行するには、「SQLの実行」(image:images/runsql.png[])アイコンをクリックします。SQLの一部のみを実行する場合は、「SQLコマンド」ウィンドウでその部分を選択し、選択を右クリックして、「セクションを実行」を選択します。この場合、選択した部分のみが実行されます。
@@ -330,7 +338,7 @@
*重要: * ``php.ini`` にそのような行がない場合、拡張フォルダでOCI 8拡張ファイルを探してください。拡張フォルダにOCI 8拡張ファイルがない場合、OCI 8のダウンロードとインストールについては、link:http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html[+LinuxおよびWindowsへのPHPおよびOracle Instant Clientのインストール+]を参照してください。
-[start=4]
+
. Apacheを再起動します。(Windowsユーザーはコンピュータを再起動するようにしてください。)
. ``phpinfo()`` を実行します。OCI 8を正常に有効にすると、 ``phpinfo()`` の出力にOCI 8セクションが表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_pt_BR.asciidoc
index 3bd1c37..38a3cf6 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_pt_BR.asciidoc
@@ -74,7 +74,7 @@
image::images/new-connection.png[]
-[start=3]
+
. No assistente Nova Conexão, selecione Oracle Thin na lista drop-down Driver.
. Clique em Adicionar e encontre o arquivo ``ojdbc6.jar`` que foi submetido a download anteriormente. Clique em Próximo.
. No painel Personalizar Conexão do assistente, insira os seguintes valores e clique em Próximo.
@@ -103,14 +103,14 @@
|Password |Insira a senha para o nome de usuário selecionado.
|===
-[start=6]
+
. Clique em Testar Conexão para confirmar que o IDE pode se conectar ao banco de dados. Clique em Próximo.
Se a tentativa obtiver êxito, a mensagem "Conexão com êxito" será exibida no assistente.
image::images/customize-conn.png[]
-[start=7]
+
. Selecione ``HR`` na lista drop-down Selecionar Esquema. Clique em Finalizar.
NOTE: É necessário desbloquear o esquema HR antes de poder acessá-lo no NetBeans. O desbloqueio do banco de dados HR é descrito no link:http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25610/toc.htm[+Tutorial de Introdução+] do Oracle Database XE.
@@ -138,7 +138,7 @@
image::images/execute.png[]
-[start=2]
+
. Para criar um novo usuário, insira o seguinte comando na janela Editor SQL e clique no botão Executar SQL na barra de ferramentas.
image::images/create-user.png[]
@@ -150,7 +150,7 @@
Esse comando cria um novo usuário ``jim`` com a senha ``mypassword`` . O tablespace default é ``users`` e o espaço alocado é ilimitado.
-[start=3]
+
. A próxima etapa é conceder privilégios à conta de usuário ``jim`` para executar ações no banco de dados. Precisamos permitir que o usuário se conecte ao banco de dados, crie e modifique tabelas no espaço de tabela default do usuário e acesse a tabela ``Employees`` na amostra do banco de dados ``hr`` .
Em um contexto real, um administrador de banco de dados cria atribuições personalizadas e privilégios de ajuste para cada atribuição. No entanto, para o propósito do nosso tutorial, podemos usar uma atribuição predefinida, como ``CONNECT`` . Para obter mais informações sobre atribuições e privilégios, consulte o link:http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/toc.htm[+Oracle Database Security Guide+].
@@ -186,14 +186,14 @@
image::images/hr-view.png[]
-[start=4]
+
. Clique com o botão direito do mouse no nó da tabela ``Departamentos`` e selecione Obter Estrutura. Salve o arquivo ``.grab`` no disco.
. Expanda o esquema ``JIM`` , clique com o botão direito do mouse no nó ``Tabelas`` e escolha Recriar Tabela.
Aponte para o arquivo ``.grab`` que você criou.
image::images/recreate.png[]
-[start=6]
+
. Revise o documento SQL que será usado para criar a tabela. Clique em OK.
image::images/nametable.png[]
@@ -209,7 +209,7 @@
image::images/insert-rec.png[]
-[start=3]
+
. Digite nos campos para inserir os dados. Clique em OK.
Por exemplo, é possível inserir os seguintes valores retirados da tabela ``DEPARTAMENTOS`` original.
@@ -260,27 +260,27 @@
Para abrir a janela Favoritos, clique em Janela > Favoritos no menu principal (pressione Ctrl-3). O diretório _USER_HOME_ está listado na janela Favoritos por default.
-[start=3]
+
. Clique com o botão direito do mouse no arquivo ``locations.sql`` e selecione Executar Arquivo.
image::images/run-file.png[]
NOTE: Se mais de uma conexão de banco de dados estiver registrada no IDE, o IDE pode solicitar que você selecionar a conexão correta.
-[start=4]
+
. Na janela Serviços, clique com o botão direito no nó Tabelas e selecione Atualizar no menu pop-up.
É possível ver que a tabela ``Localizações`` com os dados foi adicionada ao esquema ``JIM`` .
image::images/second-table.png[]
-[start=5]
+
. Clique com o botão direito do mouse no nó da tabela Localizações e selecione Exibir Dados para ver o conteúdo da tabela. Você verá o conteúdo da tabela Localizações.
É possível inserir novos registros e modificar os dados existentes diretamente nessa janela.
image::images/view-data1.png[]
-[start=6]
+
. Em seguida, executamos uma consulta para exibir informações de duas tabelas: Departamentos e Localizações.
No nosso caso, usaremos uma “junção natural” simples, pois ambas tabelas têm a mesma coluna “location_id” que guarda valores do mesmo tipo de dados. Essa junção seleciona somente as linhas que possuem valores iguais na coluna location_id correspondente.
@@ -311,10 +311,18 @@
* Para adicionar um registro, clique no ícone Inserir Registros image:images/row-add.png[] e insira novos dados na janela Inserir Registros que é aberta. Clique no botão Exibir SQL para ver o código SQL para essa operação. A tabela será atualizada automaticamente com os novos registros.
* Para modificar um registro, clique duas vezes diretamente dentro de qualquer célula na View da GUI de uma tabela e digite o novo valor. Até que a modificação seja confirmada, o texto modificado é mostrado em verde. Para confirmar suas alterações, clique no ícone Confirmar Alterações image:images/row-commit.png[]. Para cancelar as alterações, clique no ícone Cancelar Edições image:images/row-commit.png[].
* Para deletar uma linha, selecione-a e clique no ícone Deletar Registros Selecionados image:images/row-commit.png[].
-2. *Manter Guias Anteriores*. Clique no ícone Manter Guias Anteriores image:images/keepoldresulttabs.png[] na barra de ferramentas do Editor de SQL para manter as janelas com os resultados de consultas anteriores abertas. Isso pode ser útil caso deseje comparar os resultados de várias consultas.
-3. *Histórico SQL* (Ctrl-Alt-Shift-H). Usar o ícone do Histórico SQL image:images/sql-history.png[] na barra de ferramentas do Editor de SQL para exibir todas as instruções SQL que você executou para cada uma das conexões de banco de dados. Escolha a conexão na lista drop-down, encontre a instrução SQL que você precisa e clique em Inserir para colocar a instrução na janela Comando SQL.
-4. *Lista de conexões*. Se você tem muitas conexões aos bancos de dados e precisa alternar rapidamente entre eles no Editor SQL, use a lista drop-down Conexões.
-5. *Executar Instruções SQL*. Para executar a instrução inteira que está atualmente na janela de Comando SQL, clique no ícone Executar SQL image:images/runsql.png[]. Se você desejar executar somente uma parte do SQL, selecione-a na janela Comando SQL, clique com o botão direito do mouse na seleção e selecione Executar Seleção. Nesse caso, somente a parte selecionada será executada.
+
+[start=2]
+. *Manter Guias Anteriores*. Clique no ícone Manter Guias Anteriores image:images/keepoldresulttabs.png[] na barra de ferramentas do Editor de SQL para manter as janelas com os resultados de consultas anteriores abertas. Isso pode ser útil caso deseje comparar os resultados de várias consultas.
+
+[start=3]
+. *Histórico SQL* (Ctrl-Alt-Shift-H). Usar o ícone do Histórico SQL image:images/sql-history.png[] na barra de ferramentas do Editor de SQL para exibir todas as instruções SQL que você executou para cada uma das conexões de banco de dados. Escolha a conexão na lista drop-down, encontre a instrução SQL que você precisa e clique em Inserir para colocar a instrução na janela Comando SQL.
+
+[start=4]
+. *Lista de conexões*. Se você tem muitas conexões aos bancos de dados e precisa alternar rapidamente entre eles no Editor SQL, use a lista drop-down Conexões.
+
+[start=5]
+. *Executar Instruções SQL*. Para executar a instrução inteira que está atualmente na janela de Comando SQL, clique no ícone Executar SQL image:images/runsql.png[]. Se você desejar executar somente uma parte do SQL, selecione-a na janela Comando SQL, clique com o botão direito do mouse na seleção e selecione Executar Seleção. Nesse caso, somente a parte selecionada será executada.
@@ -328,7 +336,7 @@
*Importante: *Se não houver tal linha no ``php.ini`` , procure na pasta de extensões pelo arquivo de extensão OCI 8. Se não houver o arquivo de extensão OCI 8 na pasta de extensões, consulte link:http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html[+Instalando PHP e o Oracle Instant Client para Linux e Windows+] para obter mais informações sobre o download e a instalação do OCI 8.
-[start=4]
+
. Reinicie o Apache. (Usuários do Windows devem reiniciar seus computadores.)
. Executar ``phpinfo()`` . Se você ativou a extensão OCI 8 com êxito, uma seção da OCI 8 aparecerá na saída de ``phpinfo()`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ru.asciidoc
index 64ec98b..f7c3ff0 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_ru.asciidoc
@@ -74,7 +74,7 @@
image::images/new-connection.png[]
-[start=3]
+
. В мастере создания подключений выберите Oracle Thin из раскрывающегося списка Driver ("Драйвер").
. Нажмите кнопку Add ("Добавить") и найдите ранее загруженный файл ``ojdbc6.jar`` . Нажмите кнопку "Далее".
. На панели Customize Connection ("Настроить подключение") мастера введите следующие значения и нажмите кнопку Next ("Далее").
@@ -103,14 +103,14 @@
|Пароль |Введите пароль для выбранного имени пользователя.
|===
-[start=6]
+
. Щелкните Test Connection ("Проверить подключение"), чтобы убедиться в наличии у среды IDE возможности подключиться к базе данных. Нажмите кнопку "Далее".
Если попытка будет успешна, в мастере отобразиться сообщение Connection succeeded ("Подключение успешно").
image::images/customize-conn.png[]
-[start=7]
+
. Выберите ``HR`` в раскрывающемся списке Select Schema ("Выбор схемы"). Нажмите кнопку "Завершить".
NOTE: До получения доступа к NetBeans необходимо разблокировать схему HR. Разблокирование базы данных HR описано в link:http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25610/toc.htm[+Руководстве по началу работы+] с базой данных Oracle XE.
@@ -138,7 +138,7 @@
image::images/execute.png[]
-[start=2]
+
. Чтобы создать нового пользователя, введите приведенную ниже команду в окне редактора SQL и нажмите кнопку Run SQL ("Выполнить SQL") на панели инструментов.
image::images/create-user.png[]
@@ -150,7 +150,7 @@
В результате выполнения данной команды будет создан новый пользователь ``jim`` с паролем ``mypassword`` . Табличным пространством по умолчанию является ``users`` , а выделенное пространство не ограничено.
-[start=3]
+
. Следующий этап – предоставить ``jim`` права учетной записи пользователя на выполнение действий с базой данных. Необходимо разрешить пользователю подключаться к базе данных, создавать и изменять таблицы в табличном пространстве пользователя по умолчанию и выполнять доступ к таблице ``Employees`` в примере базы данных ``hr`` .
На практике администратор базы данных обычно создает особые роли и аккуратно настраивает полномочия для каждой из них. Но в целях нашего учебного курса мы можем использовать заранее определенную роль, такую как ``CONNECT`` . Дополнительные сведения о ролях и полномочиях приведены в документе link:http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/toc.htm[+Oracle Database Security Guide ("Руководство по безопасности базы данных Oracle")+].
@@ -186,14 +186,14 @@
image::images/hr-view.png[]
-[start=4]
+
. Щелкните правой кнопкой мыши узел таблицы ``Departments`` и выберите Grab Structure ("Копировать структуру"). Сохраните файл ``.grab`` у себя на диске.
. Раверните схему ``JIM`` , щелкните правой кнопкой мыши узел ``Таблицы`` и выберите 'Повторно создать таблицу'.
Укажите на созданный файл ``.grab`` .
image::images/recreate.png[]
-[start=6]
+
. Проверьте сценарий SQL, который будет использован для создания данной таблицы. Нажмите кнопку "ОК".
image::images/nametable.png[]
@@ -208,7 +208,7 @@
image::images/insert-rec.png[]
-[start=3]
+
. Введите данные в поля для них. Нажмите кнопку "ОК".
Например, можно ввести следующие значения из исходной таблицы ``DEPARTMENTS`` .
@@ -259,27 +259,27 @@
Чтобы открыть окно избранного, выберите Window ("Окно") > Favorites ("Избранное") в главном меню (нажмите Ctrl-3). Каталог _USER_HOME_ приводится в окне избранного по умолчанию.
-[start=3]
+
. Щелкните файл ``locations.sql`` правой кнопкой мыши и выберите Run File ("Запустить файл").
image::images/run-file.png[]
NOTE: Если зарегистрировано более одного соединения с базой данных в IDE, в IDE может отобразиться запрос на выбор правильного подключения.
-[start=4]
+
. В окне 'Службы' щелкните правой кнопкой мыши узел 'Таблицы' и выберите 'Обновить' во всплывающем меню.
Можно будет увидеть, что таблица ``Locations`` с данными была добавлена к схеме ``JIM`` .
image::images/second-table.png[]
-[start=5]
+
. Щелкните правой кнопкой мыши узел таблицы Locations и выберите View Data ("Просмотр данных") для просмотра содержимого таблицы. Можно будет увидеть содержимое таблицы Locations.
В этом окне просмотра можно напрямую вставлять новые записи и изменять существующие данные.
image::images/view-data1.png[]
-[start=6]
+
. Далее мы выполним запрос для просмотра информации из двух таблиц Departments и Locations.
В этом случае мы используем простое "естественное слияние", поскольку столбец "location_id" обеих таблиц одинаков и содержит значения одного типа данных. Этот тип слияния выбирает только строки, имеющие одинаковые значения в соответствующем столбце location_id.
@@ -309,10 +309,18 @@
* Чтобы добавить запись, щелкните значок 'Вставить записи' image:images/row-add.png[] и вставьте новые данные в открывшееся окно 'Вставка записей'. Нажмите кнопку Show SQL ("Показать SQL"), чтобы просмотреть код SQL для данной операции. Таблица будет автоматически обновлена со включением новых записей.
* Чтобы изменить запись, дважды щелкните внутри любой ячейки в представлении графического интерфейса таблицы и введите новое значение. Пока изменение не зафиксировано, измененный текст выделяется зеленым цветом. Для фиксации изменений щелкните значок 'Фиксировать изменения' image:images/row-commit.png[]. Для отмены изменений щелкните значок 'Отменить правки' image:images/row-commit.png[] icon.
* Чтобы удалить строку, выделите ее и щелкните значок 'Удалить выбранные записи' image:images/row-commit.png[].
-2. *Сохранение предыдущих вкладок* Щелкните значок 'Сохранить предыдущие вкладки' image:images/keepoldresulttabs.png[] на панели инструментов редактора SQL, чтобы держать окна с результатами предыдущих запросов открытыми. Это может быть полезно, если необходимо сравнить результаты нескольких запросов.
-3. *Журнал SQL* (Ctrl-Alt-Shift-H). С помощью значка 'Хронология SQL' image:images/sql-history.png[] на панели инструментов редактора SQL можно просмотреть все операторы SQL, запущенные для каждого из соединений с базой данных. Выберите подключение из раскрывающегося списка, найдите необходимый оператор SQL и щелкните Insert ("Вставить") для помещения оператора в окно команд SQL.
-4. *Список подключений*. При наличии нескольких подключений к базам данных и необходимости быстро переключаться между ними в редакторе SQL используйте раскрывающийся список Connections ("Подключения").
-5. *Выполнение операторов SQL*. Для выполнения всего оператора, в настоящее время находящегося в окне 'Команды SQL' щелкните значок 'Выполнить SQL' image:images/runsql.png[]. Если необходимо запустить только часть SQL, выберите ее в окне 'Команды SQL', щелкните правой кнопкой мыши выбранное и выберите 'Выполнить выбранное'. В данном случае будет выполнена только выбранная часть.
+
+[start=2]
+. *Сохранение предыдущих вкладок* Щелкните значок 'Сохранить предыдущие вкладки' image:images/keepoldresulttabs.png[] на панели инструментов редактора SQL, чтобы держать окна с результатами предыдущих запросов открытыми. Это может быть полезно, если необходимо сравнить результаты нескольких запросов.
+
+[start=3]
+. *Журнал SQL* (Ctrl-Alt-Shift-H). С помощью значка 'Хронология SQL' image:images/sql-history.png[] на панели инструментов редактора SQL можно просмотреть все операторы SQL, запущенные для каждого из соединений с базой данных. Выберите подключение из раскрывающегося списка, найдите необходимый оператор SQL и щелкните Insert ("Вставить") для помещения оператора в окно команд SQL.
+
+[start=4]
+. *Список подключений*. При наличии нескольких подключений к базам данных и необходимости быстро переключаться между ними в редакторе SQL используйте раскрывающийся список Connections ("Подключения").
+
+[start=5]
+. *Выполнение операторов SQL*. Для выполнения всего оператора, в настоящее время находящегося в окне 'Команды SQL' щелкните значок 'Выполнить SQL' image:images/runsql.png[]. Если необходимо запустить только часть SQL, выберите ее в окне 'Команды SQL', щелкните правой кнопкой мыши выбранное и выберите 'Выполнить выбранное'. В данном случае будет выполнена только выбранная часть.
@@ -326,7 +334,7 @@
*Важно!* Если в ``php.ini`` нет такой строки, поищите в папке расширений файл расширения OCI 8. В случае отсутствия файла расширения OCI 8 в папке расширений информацию о загрузке и установке OCI 8 можно найти в документе link:http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html[+Installing PHP and the Oracle Instant Client for Linux and Windows ("Установка PHP и Oracle Instant Client для Linux и Windows")+].
-[start=4]
+
. Перезапустите Apache. (Пользователям Windows следует перезагрузить компьютер).
. Выполните ``phpinfo()`` . Если OCI 8 успешно включен, раздел OCI 8 появится в выводе ``phpinfo()`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_zh_CN.asciidoc
index 737d093..eb36bca 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/oracle-db_zh_CN.asciidoc
@@ -75,7 +75,7 @@
image::images/new-connection.png[]
-[start=3]
+
. 在新建连接向导中,从 "Driver"(驱动程序)下拉列表中选择 "Oracle Thin"。
. 单击 "Add"(添加),然后找到以前下载的文件 ``ojdbc6.jar`` 。单击 "Next"(下一步)。
. 在该向导的 "Customize Connection"(定制连接)面板中输入以下值,然后单击 "Next"(下一步)。
@@ -104,14 +104,14 @@
|Password |输入与选定用户名相对应的口令。
|===
-[start=6]
+
. 单击 "Test Connection"(测试连接),以确认 IDE 能否连接到数据库。单击 "Next"(下一步)。
如果尝试成功,则会在向导中显示 "Connection succeeded"(连接成功)消息。
image::images/customize-conn.png[]
-[start=7]
+
. 在 "Select Schema"(选择方案)下拉列表中选择 ``HR`` 。单击 "Finish"(完成)。
NOTE: 您需要解锁 HR 方案,然后才能在 NetBeans 中访问它。解锁 HR 数据库在 Oracle Database XE link:http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25610/toc.htm[+使用入门教程+]中进行了介绍。
@@ -139,7 +139,7 @@
image::images/execute.png[]
-[start=2]
+
. 要创建新用户,请在 "SQL Editor"(SQL 编辑器)窗口中输入以下命令,然后单击工具栏上的 "Run SQL"(运行 SQL)按钮。
image::images/create-user.png[]
@@ -152,7 +152,7 @@
该命令可创建新用户 ``jim`` ,口令为 ``mypassword`` 。默认表空间为 ``users`` ,且分配的空间不受限制。
-[start=3]
+
. 下一步是为 ``jim`` 用户帐户授予在数据库中执行操作的权限。我们需要允许该用户连接到数据库,在用户默认表空间中创建和修改表以及访问 ``hr`` 样例数据库中的 ``Employees`` 表。
实际上,数据库管理员可创建定制角色,并微调每个角色的权限。但就本教程而言,我们可以使用预定义的角色,例如 ``CONNECT`` 。有关角色和权限的详细信息,请参见 link:http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/toc.htm[+Oracle 数据库安全指南+]。
@@ -188,14 +188,14 @@
image::images/hr-view.png[]
-[start=4]
+
. 右键单击 ``Departments`` 表节点,然后选择 "Grab Structure"(抓取结构)。将 ``.grab`` 文件保存到磁盘上。
. 展开 ``JIM`` 方案,右键单击 ``Tables`` (表)节点,然后选择 "Recreate Table"(重新创建表)。
指向您创建的 ``.grab`` 文件。
image::images/recreate.png[]
-[start=6]
+
. 查看用于创建表的 SQL 脚本。单击 "OK"(确定)。
image::images/nametable.png[]
@@ -211,7 +211,7 @@
image::images/insert-rec.png[]
-[start=3]
+
. 在字段中以键入方式输入数据。单击 "OK"(确定)。
例如,可以输入从原始 ``DEPARTMENTS`` 表中提取的以下值。
@@ -262,27 +262,27 @@
要打开 "Favorites"(收藏夹)窗口,请在主菜单中单击 "Window"(窗口)> "Favorites"(收藏夹)(按 Ctrl-3 组合键)。默认情况下,将在 "Favorites"(收藏夹)窗口中列出 _USER_HOME_ 目录。
-[start=3]
+
. 右键单击 ``locations.sql`` 文件,然后选择 "Run File"(运行文件)。
image::images/run-file.png[]
NOTE: 如果有多个数据库连接注册到 IDE,则 IDE 可能会提示您选择正确的连接。
-[start=4]
+
. 在 "Services"(服务)窗口中,右键单击 "Tables"(表)节点,然后在弹出式菜单中选择 "Refresh"(刷新)。
您可以看到在 ``JIM`` 方案中添加了包含数据的 ``Locations`` 表。
image::images/second-table.png[]
-[start=5]
+
. 右键单击 Locations 表节点,然后选择 "View Data"(查看数据)以查看表内容。您将看到 Locations 表的内容。
您可以直接在此视图窗口中插入新记录和修改现有数据。
image::images/view-data1.png[]
-[start=6]
+
. 接下来,我们运行一个查询以显示以下两个表中的信息:Departments 和 Locations。
在本示例中,我们使用简单的“自然合并”,因为两个表具有相同的 "location_id" 列,其中保存了相同数据类型的值。这种合并仅选择在匹配 location_id 列中具有相等值的行。
@@ -313,10 +313,18 @@
* 要添加记录,请单击 "Insert Records"(插入记录)image:images/row-add.png[] 图标并在打开的 "Insert Records"(插入记录)窗口中插入新数据。单击 "Show SQL"(显示 SQL)按钮以查看该操作的 SQL 代码。该表将使用新记录自动更新。
* 要修改记录,请在表的 GUI 视图中的任何单元格内直接双击,然后键入新值。在提交更改之前,将使用绿色显示修改的文本。要提交更改,请单击 "Commit Changes"(提交更改)image:images/row-commit.png[] 图标。要取消更改,请单击 "Cancel Edits"(取消编辑)image:images/row-commit.png[] 图标。
* 要删除行,请选择该行并单击 "Delete Selected Records"(删除选定的记录)image:images/row-commit.png[] 图标。
-2. *保留先前的标签*。在 SQL 编辑器工具栏上单击 "Keep Prior Tabs"(保留先前的标签)image:images/keepoldresulttabs.png[] 图标以保留打开以前查询结果的窗口。如果要比较多个查询的结果,这可能很有用。
-3. *SQL 历史记录*(Ctrl-Alt-Shift-H 组合键)。使用 SQL 编辑器工具栏上的 "SQL History"(SQL 历史记录)image:images/sql-history.png[] 图标可查看已为每个数据库连接运行的所有 SQL 语句。从下拉列表中选择该连接,查找所需的 SQL 语句,然后单击 "Insert"(插入)将该语句放在 "SQL Command"(SQL 命令)窗口中。
-4. *连接列表*。如果有多个数据库连接,并需要在 SQL 编辑器中快速切换这几个连接,请使用 "Connections"(连接)下拉列表。
-5. *运行 SQL 语句*。要运行当前 "SQL Command"(SQL 命令)窗口中的完整语句,请单击 "Run SQL"(运行 SQL)image:images/runsql.png[] 图标。如果您希望只运行 SQL 语句的一部分,请在 "SQL Command"(SQL 命令)窗口中将其选中,右键单击所选内容,然后选择 "Run Selection"(运行选择)。在这种情况下,仅执行所选的部分。
+
+[start=2]
+. *保留先前的标签*。在 SQL 编辑器工具栏上单击 "Keep Prior Tabs"(保留先前的标签)image:images/keepoldresulttabs.png[] 图标以保留打开以前查询结果的窗口。如果要比较多个查询的结果,这可能很有用。
+
+[start=3]
+. *SQL 历史记录*(Ctrl-Alt-Shift-H 组合键)。使用 SQL 编辑器工具栏上的 "SQL History"(SQL 历史记录)image:images/sql-history.png[] 图标可查看已为每个数据库连接运行的所有 SQL 语句。从下拉列表中选择该连接,查找所需的 SQL 语句,然后单击 "Insert"(插入)将该语句放在 "SQL Command"(SQL 命令)窗口中。
+
+[start=4]
+. *连接列表*。如果有多个数据库连接,并需要在 SQL 编辑器中快速切换这几个连接,请使用 "Connections"(连接)下拉列表。
+
+[start=5]
+. *运行 SQL 语句*。要运行当前 "SQL Command"(SQL 命令)窗口中的完整语句,请单击 "Run SQL"(运行 SQL)image:images/runsql.png[] 图标。如果您希望只运行 SQL 语句的一部分,请在 "SQL Command"(SQL 命令)窗口中将其选中,右键单击所选内容,然后选择 "Run Selection"(运行选择)。在这种情况下,仅执行所选的部分。
@@ -330,7 +338,7 @@
*重要说明:*如果 ``php.ini`` 中没有这些行,请在 extensions 文件夹中查找 OCI 8 扩展文件。如果 extensions 文件夹中没有 OCI 8 扩展文件,请参见link:http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html[+在 Linux 和 Windows 中安装 PHP 和 Oracle Instant Client+] 以了解 OCI 8 的下载和安装信息。
-[start=4]
+
. 重新启动 Apache。(Windows 用户应重新启动计算机。)
. 运行 ``phpinfo()`` 。如果成功启用了 OCI 8,则会在 ``phpinfo()`` 输出中显示 OCI 8 部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/subversion.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/subversion.asciidoc
index 80af928..172a101 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/subversion.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/subversion.asciidoc
@@ -67,7 +67,7 @@
image::images/svn-options-small.png[role="left", link="images/svn-options.png"]
--
-[start=3]
+
. In the Specify the SVN Home Folder text field, either type in the path to the executable file or click Browse to navigate to it on your system. Note that you need not _include_ the Subversion executable file in the path.
. Click OK, then restart the IDE to allow changes to take effect.
@@ -109,7 +109,7 @@
NOTE: The IDE's drop-down menus are context-sensitive, i.e. the available options depend on the item currently selected. Therefore, if you are already working within a Subversion project, you can choose Versioning > Checkout from the main menu.
-[start=2]
+
. In the first panel of the wizard, enter a URL that contains the connection protocol and location of the repository you want to connect to.
The IDE supports the following protocol types:
@@ -134,7 +134,7 @@
For more help with `svn+ssh`, see: link:http://wiki.netbeans.org/wiki/view/FaqSubversionSSH[+How do I set up SSH with Subversion?+]
-[start=3]
+
. If you are using a proxy, be sure to click the Proxy Configuration button and enter any required information. When you are certain your connection settings to the repository are correct, click Next.
. In the Folders to Checkout panel of the wizard, specify the folder that you want to check out in the Repository Folder(s) field. If you do not know the name of the folder you want to check out, click the Browse button to view all folders currently maintained in the repository. From the Browse Repository Folders dialog that appears, select any of the listed folders and click OK. The selected folder is then added to the Repository Folder(s) field ('MyProject' entered in screen capture below):
@@ -143,7 +143,7 @@
image::images/checkout-small.png[role="left", link="images/checkout.png"]
--
-[start=5]
+
. Enter a Revision number in the Repository Revision field, otherwise leave it empty, implying that you want to check out the folder _HEAD_, or most recent revision.
. In the Local Folder field, enter a location on your computer where you want files to be checked out to. Leave the Scan for NetBeans Projects after Checkout option selected, then click Finish to initiate the check out action. The IDE checks out the specified sources and the IDE's status bar indicates the progress of the files downloading from the repository to your local working directory. You can also view files as they are being checked out from the Output window (Ctrl-4 on Windows/Cmd-4 on OS X).
@@ -432,7 +432,7 @@
image::images/svn-merge-small.png[role="left", link="images/svn-merge.png"]
--
-[start=4]
+
. Click Merge. The IDE incorporates any differences found between the branch revisions and your local copy of the file. If merge conflicts occur, the file's status is updated to <<resolving,Merge Conflict>> to indicate this.
NOTE: After merging revisions to your local working copy, you must still commit changes using the Commit command in order for them to be added to the repository.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/subversion_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/subversion_ja.asciidoc
index 9ccc23c..295c8d6 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/subversion_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/subversion_ja.asciidoc
@@ -96,8 +96,12 @@
image::images/svn-options-small.png[role="left", link="images/svn-options.png"]
--
-3. 「SVNホーム・フォルダを指定」テキスト・フィールドに、実行可能ファイルのパスを入力するか、または「参照」をクリックしてシステム上のその場所まで移動します。パスにSubversion実行可能ファイルを_含める_必要はありません。
-4. 「OK」をクリックしてIDEを再起動すると、変更が有効になります。
+
+[start=3]
+. 「SVNホーム・フォルダを指定」テキスト・フィールドに、実行可能ファイルのパスを入力するか、または「参照」をクリックしてシステム上のその場所まで移動します。パスにSubversion実行可能ファイルを_含める_必要はありません。
+
+[start=4]
+. 「OK」をクリックしてIDEを再起動すると、変更が有効になります。
=== 接続先のリポジトリがあることの確認
@@ -141,7 +145,9 @@
1. NetBeans IDEで、メイン・メニューから「チーム」>「Subversion」>「チェックアウト」を選択します。チェックアウト・ウィザードが開きます。
*注意: *IDEのドロップダウン・メニューはコンテキスト依存です。つまり、使用可能なオプションは現在選択されている項目によって異なります。そのため、すでにSubversionプロジェクト内で作業している場合、メイン・メニューから「バージョン管理」>「チェックアウト」を選択できます。
-2. ウィザードの最初のパネルで、接続プロトコルと接続先のリポジトリの場所を含むURLを入力します。
+
+[start=2]
+. ウィザードの最初のパネルで、接続プロトコルと接続先のリポジトリの場所を含むURLを入力します。
IDEは、次のプロトコルのタイプをサポートしています。
@@ -164,15 +170,19 @@
*注意: *`https`で証明書認証を実装しようとする場合は、link:http://wiki.netbeans.org/wiki/view/FaqSslUserCert[+ユーザー証明書認証を使用してSubversionリポジトリに接続する方法+]を参照してください。
`svn+ssh`の詳細は、link:http://wiki.netbeans.org/wiki/view/FaqSubversionSSH[+SubversionでのSSHの設定方法+]を参照してください。
-3. プロキシを使用している場合は、「プロキシ構成」ボタンをクリックし、必要な情報を入力します。リポジトリへの接続設定が正しいことを確認したら、「次」をクリックします。
-4. ウィザードの「チェックアウトするフォルダ」パネルで、「リポジトリ・フォルダ」フィールドにチェックアウトするフォルダを指定します。チェックアウトするフォルダの名前がわからない場合、「参照」ボタンをクリックして、リポジトリに現在保持されているすべてのフォルダを表示します。表示された「リポジトリ・フォルダを参照」ダイアログから、表示されているいずれかのフォルダを選択し、「OK」をクリックします。これで、選択したフォルダが「リポジトリ・フォルダ」フィールドに追加されます(下のスクリーン・ショットでは「MyProject」が入力されています)。
+
+[start=3]
+. プロキシを使用している場合は、「プロキシ構成」ボタンをクリックし、必要な情報を入力します。リポジトリへの接続設定が正しいことを確認したら、「次」をクリックします。
+
+[start=4]
+. ウィザードの「チェックアウトするフォルダ」パネルで、「リポジトリ・フォルダ」フィールドにチェックアウトするフォルダを指定します。チェックアウトするフォルダの名前がわからない場合、「参照」ボタンをクリックして、リポジトリに現在保持されているすべてのフォルダを表示します。表示された「リポジトリ・フォルダを参照」ダイアログから、表示されているいずれかのフォルダを選択し、「OK」をクリックします。これで、選択したフォルダが「リポジトリ・フォルダ」フィールドに追加されます(下のスクリーン・ショットでは「MyProject」が入力されています)。
[.feature]
--
image::images/checkout-small.png[role="left", link="images/checkout.png"]
--
-[start=5]
+
. 「リポジトリ・リビジョン」フィールドにリビジョン番号を入力するか、空のままにして、フォルダ_HEAD_または最新リビジョンをチェックアウトすることを示します。
. 「ローカル・フォルダ」フィールドで、ファイルのチェックアウト先にするコンピュータ上の場所を入力します。「チェックアウト後にNetBeansプロジェクトをスキャン」オプションを選択されたままにし、「終了」をクリックしてチェックアウト・アクションを開始します。IDEによって指定したソースがチェックアウトされ、リポジトリからローカルの作業用ディレクトリへのファイルのダウンロードの進捗状況がIDEのステータス・バーに示されます。チェックアウト中のファイルを、「出力」ウィンドウから表示することもできます(Windowsでは[Ctrl]-[4]、OS Xでは[Cmd]-[4])。
@@ -475,7 +485,7 @@
image::images/svn-merge-small.png[role="left", link="images/svn-merge.png"]
--
-[start=4]
+
. 「マージ」をクリックします。IDEによって、分岐リビジョンとファイルのローカル・コピー間に検出されたすべての相違が取り込まれます。マージ競合が発生した場合、ファイルのステータスはこれを示すために「<<resolving,競合をマージ>>」に更新されます。
*注意:* リビジョンをローカル作業コピーにマージした後、それらをリポジトリに追加するには、「コミット」コマンドを使用して、変更をコミットする必要があります。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/subversion_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/subversion_pt_BR.asciidoc
index 13b18b1..f85c1dc 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/subversion_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/subversion_pt_BR.asciidoc
@@ -92,8 +92,12 @@
image::images/svn-options-small.png[role="left", link="images/svn-options.png"]
--
-3. No campo de texto Especificar a Pasta Home do SVN, digite o caminho do arquivo executável ou clique em Procurar para navegar até ele em seu sistema. Observe que não é necessário _incluir_o arquivo executável Subversion no caminho.
-4. Clique em OK, reinicie IDE para permitir que as alterações tenham efeito.
+
+[start=3]
+. No campo de texto Especificar a Pasta Home do SVN, digite o caminho do arquivo executável ou clique em Procurar para navegar até ele em seu sistema. Observe que não é necessário _incluir_o arquivo executável Subversion no caminho.
+
+[start=4]
+. Clique em OK, reinicie IDE para permitir que as alterações tenham efeito.
=== Certificando-se de que você tenha um Repositório ao qual se Conectar
@@ -137,7 +141,9 @@
1. No NetBeans IDE, selecione Equipe > Subversion > Check-out no menu principal. O assistente de Check-out é aberto.
NOTE: os menus drop-down do IDE se adaptam ao contexto, ou seja, as opções disponíveis dependem do item atualmente selecionado. Portanto, se você já estiver trabalhando dentro de um projeto Subversion, poderá escolher Controle de Versão > Check-out no menu principal.
-2. No primeiro painel do assistente, insira um URL que contenha o protocolo e o local de conexão do repositório que deseja se conectar.
+
+[start=2]
+. No primeiro painel do assistente, insira um URL que contenha o protocolo e o local de conexão do repositório que deseja se conectar.
O IDE suporta os seguintes tipos de protocolo:
@@ -160,15 +166,19 @@
NOTE: se estiver tentando implementar uma autenticação certificada com `https`, consulte: link:http://wiki.netbeans.org/wiki/view/FaqSslUserCert[+Como conectar-se a um repositório do Subversion usando uma autenticação certificada por usuário?+]
Para mais ajuda com `svn+ssh`, consulte: link:http://wiki.netbeans.org/wiki/view/FaqSubversionSSH[+Como ajustar o SSH com o Subversion?+]
-3. Caso esteja usando um proxy, certifique-se de clicar no botão Configuração de Proxy e insira quaisquer informações solicitadas. Quando tiver certeza de que suas definições de conexão estão corretas, clique em Próximo.
-4. No painel Pastas para Check-out do assistente, especifique a pasta para a qual deseja fazer check-out no campo Pasta(s) do Repositório. Caso não saiba o nome da pasta para a qual deseja fazer check-out, clique no botão Procurar para exibir todas as pastas mantidas atualmente no repositório. Na caixa de diálogo Procurar nas Pastas do Repositório, selecione quaisquer uma das pastas listadas e clique em OK. A pasta selecionada é adicionada ao campo Pastas do Repositório ('MyProject' inserido na captura de tela abaixo):
+
+[start=3]
+. Caso esteja usando um proxy, certifique-se de clicar no botão Configuração de Proxy e insira quaisquer informações solicitadas. Quando tiver certeza de que suas definições de conexão estão corretas, clique em Próximo.
+
+[start=4]
+. No painel Pastas para Check-out do assistente, especifique a pasta para a qual deseja fazer check-out no campo Pasta(s) do Repositório. Caso não saiba o nome da pasta para a qual deseja fazer check-out, clique no botão Procurar para exibir todas as pastas mantidas atualmente no repositório. Na caixa de diálogo Procurar nas Pastas do Repositório, selecione quaisquer uma das pastas listadas e clique em OK. A pasta selecionada é adicionada ao campo Pastas do Repositório ('MyProject' inserido na captura de tela abaixo):
[.feature]
--
image::images/checkout-small.png[role="left", link="images/checkout.png"]
--
-[start=5]
+
. Insira um número de Revisão no campo Revisão do Repositório ou deixe-o em branco, para indicar que deseja fazer check-out da pasta _HEAD_, ou insira a revisão mais recente.
. No campo Pasta Local, insira um local em seu computador para onde deseja fazer check-out dos arquivos. Deixe selecionada a opção Procurar por Projetos do NetBeans após Check-out e, em seguida, clique em Finalizar para iniciar a ação de check-out. O IDE faz check-out dos códigos-fonte especificados e a barra de status do IDE indica o andamento do download dos arquivos do repositório para seu diretório de trabalho local. Você também pode exibir os arquivos que estão tendo check-out na janela de Saída (Ctrl-4 no Windows/Cmd-4 no OS X).
@@ -471,7 +481,7 @@
image::images/svn-merge-small.png[role="left", link="images/svn-merge.png"]
--
-[start=4]
+
. Clique em Mesclar. O IDE incorpora quaisquer diferenças constatadas entre a versão de revisão da ramificação e a cópia local do arquivo. Se ocorrerem conflitos de mesclagem, o status do arquivo será atualizado em <<resolving,Conflito de Mesclagem>> para indicar o fato.
NOTE: depois de mesclar as alterações do arquivo com o diretório de trabalho local, ainda é necessário confirmar as alterações usando o comando Confirmar para poder adicionar as alterações ao repositório.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/subversion_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/subversion_ru.asciidoc
index 7e7dd1f..daa6aef 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/subversion_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/subversion_ru.asciidoc
@@ -96,8 +96,12 @@
image::images/svn-options-small.png[role="left", link="images/svn-options.png"]
--
-3. В текстовом поле Specify the SVN Home Folder ("Указать домашний каталог SVN") следует либо ввести путь к исполнимому файлу, либо нажать кнопку "Обзор" и найти этот путь в системе. Заметим, что нет нужды _включать_ в строку пути исполнимый файл Subversion.
-4. Нажмите кнопку "ОК" и перезапустите среду IDE, чтобы изменения вступили в силу.
+
+[start=3]
+. В текстовом поле Specify the SVN Home Folder ("Указать домашний каталог SVN") следует либо ввести путь к исполнимому файлу, либо нажать кнопку "Обзор" и найти этот путь в системе. Заметим, что нет нужды _включать_ в строку пути исполнимый файл Subversion.
+
+[start=4]
+. Нажмите кнопку "ОК" и перезапустите среду IDE, чтобы изменения вступили в силу.
=== Проверка наличия репозитория для подключения
@@ -141,7 +145,9 @@
1. В IDE NetBeans в главном меню выберите 'Группа' > 'Subversion' > 'Извлечь'. Откроется мастер взятия для изменения.
NOTE: Раскрывающееся меню IDE являются контекстно-зависимыми, то есть доступные параметры зависят от текущего выбранного элемента. Таким образом, во время работы с проектом в Subversion можно выбрать элемент Versioning ("Контроль версий") > Checkout ("Извлечь") в главном меню.
-2. На первой панели мастера введите URL-адрес, который содержит протокол подключения и путь к репозиторию, к которому необходимо подключиться.
+
+[start=2]
+. На первой панели мастера введите URL-адрес, который содержит протокол подключения и путь к репозиторию, к которому необходимо подключиться.
В среде IDE поддерживаются следующие типы протоколов:
@@ -165,7 +171,7 @@
Дополнительные сведения с `svn+ssh` см. в разделе link:http://wiki.netbeans.org/wiki/view/FaqSubversionSSH[+Настройка SSH с использованием Subversion?+]
-[start=3]
+
. При использовании прокси необходимо нажать кнопку Proxy Configuration ("Настройка прокси-сервера") и ввести всю необходимую информацию. Если вы не уверены в правильности параметров подключения к репозиторию, нажмите кнопку "Далее".
. В поле Repository Folder(s) ("Каталог (-и) репозитория") панели Folders to Checkout ("Каталоги для извлечения") мастера настройте каталог, который необходимо взять для изменения. Если имя каталога, который необходимо взять для изменения, неизвестно, нажмите кнопку Browse ("Обзор"), чтобы просмотреть каталоги, которые хранятся в репозитории. В диалоговом окне Browse Repository Folders ("Обзор каталогов репозитория") выберите любой из перечисленных каталогов и нажмите кнопку "ОК". Выбранный каталог потом добавляется в поле Repository Folder(s) ('Каталог (-и) репозитория') (каталог 'MyProject&' на снимке экрана ниже).
@@ -174,7 +180,7 @@
image::images/checkout-small.png[role="left", link="images/checkout.png"]
--
-[start=5]
+
. Введите номер редакции в поле "Редакция репозитория" или оставьте его пустым, что приведет к взятию для изменения каталога _HEAD_ или более поздних редакций.
. В поле Local Folder ("Локальный каталог") введите путь к каталогу на компьютере, куда необходимо извлечь файлы. Оставьте установленным флажок "Поиск проектов Netbeans после выгрузки", затем нажмите "Готово", чтобы инициировать действие взятия. Среда IDE берёт указанные исходные коды для изменения, а в строке состояния IDE отображается ход выполнения загрузки файлов из репозитория в локальный рабочий каталог. Также можно просмотреть файлы и их изъятие в окне 'Выходные данные' (Ctrl-4 в Windows/Cmd-4 в OS X).
@@ -477,7 +483,7 @@
image::images/svn-merge-small.png[role="left", link="images/svn-merge.png"]
--
-[start=4]
+
. Щелкните "Слить". Среда IDE объединит все различия, которые будут найдены между редакциями ветви и локальной копией файла. При возникновении конфликтов слияния устанавливается состояние файла <<resolving,Конфликт слияния>> для указания на это.
NOTE: После слияния изменений с локальной рабочей копией, все равно необходимо зафиксировать изменения, используя команду Commit для того, чтобы они были добавлены в репозиторий.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/subversion_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/subversion_zh_CN.asciidoc
index 9c243f1..f786d74 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/subversion_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/subversion_zh_CN.asciidoc
@@ -93,7 +93,7 @@
image::images/svn-options-small.png[role="left", link="images/svn-options.png"]
--
-[start=3]
+
. 在 "Specify the SVN Home Folder"(指定 SVN 主文件夹)文本字段中,键入可执行文件的路径,或单击 "Browse"(浏览)在系统中找到它。请注意,您不需要将 Subversion 可执行文件_包含_在路径中。
. 单击 "OK"(确定),然后重新启动 IDE,使更改生效。
@@ -140,7 +140,7 @@
NOTE: IDE 的下拉菜单是与上下文相关的,即可用选项取决于当前选定的项。因此,如果您已在使用 Subversion 项目,则可以从主菜单中选择 "Versioning"(版本控制)> "Checkout"(检出)。
-[start=2]
+
. 在向导的第一个面板中输入 URL,其中包含要连接到的资源库的连接协议和位置。
IDE 支持以下协议类型:
@@ -165,7 +165,7 @@
如需 `svn+ssh` 的更多帮助,请参见link:http://wiki.netbeans.org/wiki/view/FaqSubversionSSH[+如何设置 SSH 以使用 Subversion?+]
-[start=3]
+
. 如果要使用代理,请务必单击 "Proxy Configuration"(代理配置)按钮,然后输入所需的信息。如果确定资源库的连接设置正确无误,请单击 "Next"(下一步)。
. 在向导的 "Folders to Checkout"(要检出的文件夹)面板中,在 "Repository Folder"(资源库文件夹)字段中指定要检出的文件夹。如果要检出的文件夹名未知,请单击 "Browse"(浏览)按钮,以查看资源库中当前保留的所有文件夹。在显示的 "Browse Repository Folders"(浏览资源库文件夹)对话框中,选择任何已列出的文件夹,然后单击 "OK"(确定)。然后会将选定文件夹添加到 "Repository Folder(s)"(资源库文件夹)字段(在以下屏幕快照中输入了 "MyProject"):
@@ -174,7 +174,7 @@
image::images/checkout-small.png[role="left", link="images/checkout.png"]
--
-[start=5]
+
. 在 "Repository Revision"(资源库修订)字段中输入修订版本号,否则保留为空,表示您要检出文件夹 _HEAD_ 或最新修订版本。
. 在 "Local Folder"(本地文件夹)字段中,输入计算机上文件要检出到的位置。将 "Scan for NetBeans Projects after Checkout"(在检出后扫描 Netbeans 项目)选项保持选中状态,然后单击 "Finish"(完成),以启动检出操作。IDE 将检出选定的源,并且 IDE 的状态栏会显示将文件从资源库下载到本地工作目录的进度。您还可以在 "Output"(输出)窗口(在 Windows 上按 Ctrl-4 组合键;在 OS X 上按 Cmd-4 组合键)中查看正要检出的文件。
@@ -477,7 +477,7 @@
image::images/svn-merge-small.png[role="left", link="images/svn-merge.png"]
--
-[start=4]
+
. 单击 "Merge"(合并)。IDE 会将分支修订版本与本地文件副本之间发现的所有差异进行合并。如果发生合并冲突,则文件的状态会更新为 <<resolving,Merge Conflict>>(合并冲突),以说明这一情况。
NOTE: 将修订版本合并到本地工作副本后,仍须使用 "Commit"(提交)命令提交更改,以便将它们添加到资源库中。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/team-servers.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/team-servers.asciidoc
index fd8b3ea..59b7b12 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/team-servers.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/team-servers.asciidoc
@@ -72,14 +72,14 @@
image::images/team-plugin.png[title="Team Server plugin selected in Plugins manager"]
-[start=3]
+
. Click Install in the Plugins manager and step through the plugin installation process.
After the Team Server plugin is installed, you can add a new team server instance. The plugin also enabled the Team Dashboard which provides an overview of team projects that you create, open or join.
NOTE: You might need to install additional plugins that are required by the Team Server plugin and restart the IDE.
-[start=4]
+
. Choose Team > Team Server > Add Team Server in the main menu to open the New Team Server dialog box.
. Type the Name and URL of the Team Server. Click Add.
@@ -112,25 +112,25 @@
Alternatively, you can open a Team Server project in the Team Dashboard and then click *get* under the project's Sources node in the Team Dashboard.
-[start=2]
+
. In the Get Sources from Team Server wizard, click Browse to specify the project repository.
image::images/get-sources.png[title="Get Sources from Team Server dialog"]
-[start=3]
+
. In the Browse Team Projects dialog, type a search term and then click Search.
image::images/browse-projects.png[title="Browse Team Projects dialog"]
The IDE searches the Team Server instance for projects containing the search terms and displays the results in the dialog box.
-[start=4]
+
. Select a project from the list. Click OK.
. To select a specific folder in the repository, click Browse next to the Folder to Get dropdown list and select a folder in the Browse Repository Folders dialog.
image::images/folder-to-get.png[title="Browse Repository Folders dialog"]
-[start=6]
+
. Specify a location on your local system for the local repository of the sources. Click Get From Team Server.
When you click Get From Team Server, the IDE will create a local repository and retrieve the sources of the project.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ja.asciidoc
index 72d08e5..c936a9e 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ja.asciidoc
@@ -74,14 +74,14 @@
image::images/team-plugin.png[title="プラグイン・マネージャで選択されたTeam Serverプラグイン"]
-[start=3]
+
. プラグイン・マネージャの「インストール」をクリックして、プラグインのインストール処理を進めます。
Team Serverプラグインがインストールされたら、新しいチーム・サーバー・インスタンスを追加できます。プラグインによって、作成する、開く、または参加するチーム・プロジェクトの概要を表示するチーム・ダッシュボードも有効になります。
NOTE: Team Serverプラグインで必要な追加プラグインをインストールして、IDEを再起動する必要がある場合があります。
-[start=4]
+
. メイン・メニューから「チーム」>チーム・サーバー>チーム・サーバーを追加を選択して、「新規チーム・サーバー」ダイアログ・ボックスを開きます。
. チーム・サーバーの名前とURLを入力します。「追加」をクリックします。
@@ -113,25 +113,25 @@
または、チーム・ダッシュボードでチーム・サーバー・プロジェクトを開き、チーム・ダッシュボードのプロジェクトの「ソース」ノードの下の「*取得*」をクリックします。
-[start=2]
+
. チーム・サーバーからソースを取得ウィザードで、「参照」をクリックして、プロジェクト・リポジトリを指定します。
image::images/get-sources.png[title="「チーム・サーバーからソースを取得」ダイアログ"]
-[start=3]
+
. 「チーム・プロジェクトを参照」ダイアログで、検索用語を入力し、「検索」をクリックします。
image::images/browse-projects.png[title="「チーム・プロジェクトを参照」ダイアログ"]
IDEによって、チーム・サーバー・インスタンスで、検索用語を含むプロジェクトが検索され、その結果がダイアログ・ボックスに表示されます。
-[start=4]
+
. 一覧からプロジェクトを選択します。「OK」をクリックします。
. リポジトリ内の特定のフォルダを選択するには、「取得するフォルダ」ドロップダウン・リストの横の「参照」をクリックし、「リポジトリ・フォルダを参照」ダイアログでフォルダを選択します。
image::images/folder-to-get.png[title="「リポジトリ・フォルダを参照」ダイアログ"]
-[start=6]
+
. ローカル・システム上のソースのローカル・リポジトリの場所を指定します。「チーム・サーバーから取得」をクリックします。
「チーム・サーバーから取得」をクリックすると、IDEによってローカル・リポジトリが作成され、プロジェクトのソースが取得されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_pt_BR.asciidoc
index 296ae97..44d9c8a 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_pt_BR.asciidoc
@@ -72,14 +72,14 @@
image::images/team-plugin.png[title="Plug-in Servidor de Equipe selecionado no Gerenciador de plug-ins"]
-[start=3]
+
. Clique em Instalar no Gerenciador de plug-ins e acompanhe o processo de instalação do plug-in.
Depois que o plug-in Servidor de Equipe estiver instalado, é possível adicionar uma nova instância do servidor de equipe. O plug-in também ativou o Painel de Equipe, que fornece uma visão geral dos projetos da equipe que você cria, abre ou participa.
NOTE: Pode ser necessário instalar plug-ins adicionais que são exigidos pelo plug-in Servidor de Equipe e reiniciar o IDE.
-[start=4]
+
. Escolha Equipe > Servidor de Equipe > Adicionar Servidor da Equipe no menu principal para abrir a caixa de diálogo Novo Servidor de Equipe.
. Digite o Nome e o URL do Servidor de Equipe. Clique em Add.
@@ -111,19 +111,19 @@
Alternativamente, é possível abrir um projeto do Servidor de Equipe no Painel de Equipe e, a seguir, clicar em *obter* no nó Códigos-fonte do projeto no Painel de Equipe.
-[start=2]
+
. No assistente Obter Códigos-fonte do Servidor de Equipe, clique em Procurar para especificar o repositório do projeto.
image::images/get-sources.png[title="Obter Códigos-fonte da caixa de diálogo do Servidor de Equipe"]
-[start=3]
+
. Na caixa de diálogo Procurar Projetos da Equipe, digite um termo de pesquisa e clique em Pesquisar.
image::images/browse-projects.png[title="Caixa de diálogo Procurar Projetos da Equipe"]
O IDE pesquisa a instância do Servidor de Equipe em busca de projetos que contenham os termos da pesquisa e exibe os resultados na caixa de diálogo.
-[start=4]
+
. Selecione um projeto na lista. Clique em OK.
. Para selecionar uma pasta específica no repositório, clique em Procurar ao lado da lista drop-down Pasta a Obter e selecione uma pasta na caixa de diálogo Procurar nas Pastas do Repositório.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ru.asciidoc
index c1c2787..607b713 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_ru.asciidoc
@@ -74,14 +74,14 @@
image::images/team-plugin.png[title="Подключаемый модуль 'Сервер групповой работы' выбрав в диспетчере подключаемых модулей"]
-[start=3]
+
. Нажмите кнопку "Установить" в диспетчере подключаемых модулей и выполните указания программы.
После установки подключаемого модуля Team Server можно добавить новый экземпляр сервера групповой работы. Модуль также поддерживает панель совместной работы, предоставляющую обзор проектов, к которым пользователь присоединяется, а также которые он создает или открывает.
NOTE: Возможно, потребуется установить дополнительные подключаемые модули, необходимые для подключаемого модуля Team Server, и перезапустить IDE.
-[start=4]
+
. Выберите 'Группа > Сервер групповой работы > Добавить сервер групповой работы' в главном меню. В результате откроется диалоговое окно 'Добавление сервера групповой работы'.
. Введите имя и URL-адрес сервера групповой работы. Нажмите кнопку "Добавить". Нажмите кнопку "Add".
@@ -113,25 +113,25 @@
Можно также открыть проект сервера групповой работы на инструментальной панели совместной работы и нажать кнопку *Получить* под узлом "Исходные файлы проекта" на панели наблюдения.
-[start=2]
+
. Нажмите в мастере получения исходных файлов кнопку "Обзор" для указания репозитория проекта.
image::images/get-sources.png[title="Получение ресурсов для диалогового окна "Добавление сервера групповой работы"."]
-[start=3]
+
. В диалоговом окне "Обзор командных проектов" введите ключевое слово для поиска и нажмите кнопку "Поиск".
image::images/browse-projects.png[title="Диалоговое окно "Обзор проектов групповой работы"."]
Среда IDE выполняет поиск проектов в экземпляре сервера групповой работы, содержащих запрос, а затем выводит результаты в диалоговом окне.
-[start=4]
+
. Выберите проект из списка. Нажмите кнопку "ОК".
. Чтобы выбрать проект из репозитория, нажмите кнопку "Обзор" рядом с раскрывающимся списком папки назначения и выберите папку в диалоговом окне "Обзор папок репозитория".
image::images/folder-to-get.png[title="Диалоговое окно 'Обзор папок репозитория'"]
-[start=6]
+
. Укажите местоположение в локальной системе для локального репозитория исходных файлов. Нажмите кнопку "Получить с сервера групповой работы".
При нажатии кнопки "Получить с сервера групповой работы" среда IDE создает локальный репозиторий и получает исходные файлы проекта.
diff --git a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_zh_CN.asciidoc
index a8ecdb7..6f43368 100644
--- a/netbeans.apache.org/src/content/kb/docs/ide/team-servers_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/ide/team-servers_zh_CN.asciidoc
@@ -74,14 +74,14 @@
image::images/team-plugin.png[title="在 "Plugins"(插件)管理器中选择 "Team Server"(团队开发服务器)"]
-[start=3]
+
. 在插件管理器中单击 "Install"(安装),然后逐步完成插件安装过程。
在安装团队开发服务器插件后,您可以添加新的团队开发服务器实例。该插件还会启用团队开发控制板,后者概述了您创建、打开或合并的团队开发项目。
NOTE: 您可能需要安装团队开发服务器插件所需的其他插件并重新启动 IDE。
-[start=4]
+
. 在主菜单中选择 "Team"(团队开发)> "Team Server"(团队开发服务器)> "Add Team Server"(添加团队开发服务器),以打开 "New Team Server"(新建团队开发服务器)对话框。
. 键入团队开发服务器的名称和 URL。单击 "ADD"(添加)。
@@ -114,25 +114,25 @@
此外,您也可以在团队开发控制板中打开一个团队开发服务器项目,然后在团队开发控制板中的项目 "Sources"(源)节点下面单击 *get*。
-[start=2]
+
. 在 "Get Sources from Team Server"(从团队开发服务器获取源代码)向导中,单击 "Browse"(浏览)以指定项目资源库。
image::images/get-sources.png[title=""Get Sources from Team Server"(从团队开发服务器获取源代码)对话框"]
-[start=3]
+
. 在 "Browse Team Projects"(浏览团队开发项目)对话框中,键入一个搜索词,然后单击 "Search"(搜索)。
image::images/browse-projects.png[title=""Browse Team Projects"(浏览团队开发项目)对话框"]
IDE 将在团队开发服务器实例中搜索包含搜索词的项目,并在对话框中显示结果。
-[start=4]
+
. 从列表中选择一个项目。单击 "OK"(确定)。
. 要在资源库中选择特定的文件夹,请单击 "Folder to Get"(要获取的文件夹)下拉列表旁边的 "Browse"(浏览),然后在 "Browse Repository Folders"(浏览资源库文件夹)对话框中选择一个文件夹。
image::images/folder-to-get.png[title=""Browse Repository Folders"(浏览资源库文件夹)对话框"]
-[start=6]
+
. 在本地系统上指定源代码的本地资源库位置。单击 "Get From Team Server"(从团队开发服务器获取)。
在单击 "Get From Team Server"(从团队开发服务器获取)时,IDE 将创建一个本地资源库并获取项目的源代码。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom.asciidoc
index a6891fe..38966be 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom.asciidoc
@@ -64,13 +64,13 @@
-[start=3]
+
. Right-click the AnnProcessor project node in the Projects window and choose Properties.
-[start=4]
+
. In the Sources category, confirm that either JDK 6 or JDK 7 are specified as the source/binary format.
-[start=5]
+
. Select the Libraries tab and confirm that the Java platform is set to either JDK 1.6 or JDK 1.7. Click OK to close the Project Properties window.
In this exercise you will create two Java packages and one Java class in each of the packages.
@@ -85,13 +85,13 @@
-[start=4]
+
. Right-click the ``ann`` Java package and choose New > Java class.
-[start=5]
+
. Type ``Handleable`` for the Class Name. Click Finish.
-[start=6]
+
. Modify the new ``Handleable.java`` file to make the following changes. Save the file.
[source,java]
@@ -112,13 +112,13 @@
-[start=7]
+
. Right-click the ``proc`` Java package and choose New > Java class.
-[start=8]
+
. Type ``HandleableProcessor`` for the Class Name. Click Finish.
-[start=9]
+
. Modify the ``HandleableProcessor.java`` class to add the following code. Save your changes.
NOTE: The value of ``@SupportedSourceVersion`` will depend upon the version of the JDK that you are using and will be either ``(SourceVersion.RELEASE_7)`` or ``(SourceVersion.RELEASE_6)`` .
@@ -336,7 +336,7 @@
-[start=10]
+
. Build the project by right-clicking the ``AnnProcessor`` project and choosing Build.
@@ -352,10 +352,10 @@
-[start=4]
+
. Open the Project Properties window and confirm that either JDK 6 or JDK 7 are selected as the source/binary format in the Sources panel and that the Java platform is set to JDK 1.6 or JDK 1.7 in the Libraries panel.
-[start=5]
+
. Modify the ``Main.java`` class to add the following code. Save your changes.
[source,java]
@@ -389,10 +389,10 @@
-[start=6]
+
. Right-click the ``Demo`` project node in the Projects window, choose Properties, then select the Libraries category in the Project Properties window.
-[start=7]
+
. In the Compile tab, click Add Project and locate the ``AnnProcessor`` project.
image::images/demo-properties-compile.png[title="Compile tab in Libraries category of the project's Properties window"]
@@ -401,10 +401,10 @@
-[start=8]
+
. Select the Compiling category in the Project Properties window and select the Enable Annotation Processing and Enable Annotation Processing in Editor checkboxes.
-[start=9]
+
. Specify the annotation processor to run by click the Add button next to the Annotation Processors text area and typing * ``proc.HandleableProcessor`` * in the Annotation Processor FQN field.
image::images/demo-processor-fqn.png[title="Annotation Processor FQN dialog box"]
@@ -415,14 +415,14 @@
-[start=10]
+
. Click OK in the Properties window.
NOTE: In the ``Main.java`` file you might still see compilation errors. This is because the IDE cannot yet find the ``MainExtras.java`` file that declares the ``handleStuff`` method. The ``MainExtras.java`` file will be generated after you build the Demo project for the first time. If Compile On Save is enabled for you project, the IDE compiled the project when you saved ``Main.java`` .
-[start=11]
+
. Right-click the Demo project and choose Build.
After you build the project, if you look at the project in the Projects window you can see a new ``Generated Sources`` node with the ``demo/MainExtras.java`` file.
@@ -447,7 +447,7 @@
-[start=12]
+
. Right-click the Demo project and choose Run.
When you click Run you should see the following in the Output window. The Demo project compiles and prints the message.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ja.asciidoc
index cd643ee..23b6e8d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ja.asciidoc
@@ -65,13 +65,13 @@
「終了」をクリックすると、IDEによってクラス・ライブラリ・プロジェクトが作成され、そのプロジェクトが「プロジェクト」ウィンドウに表示されます。
-[start=3]
+
. 「プロジェクト」ウィンドウで「AnnProcessor」プロジェクト・ノードを右クリックし、「プロパティ」を選択します。
-[start=4]
+
. 「ソース」カテゴリで、ソース/バイナリ形式としてJDK 6またはJDK 7が指定されていることを確認します。
-[start=5]
+
. 「ライブラリ」タブを選択し、「Javaプラットフォーム」がJDK 1.6またはJDK 1.7またはに設定されていることを確認します。「OK」をクリックして、「プロジェクト・プロパティ」ウィンドウを閉じます。
この課題では、2つのJavaパッケージを作成し、各パッケージ内に1つのJavaクラスを作成します。
@@ -84,13 +84,13 @@
image::images/packages.png[title="注釈プロセッサのプロジェクトの構造。"]
-[start=4]
+
. 「 ``ann`` 」Javaパッケージを右クリックし、「新規」>「Javaクラス」を選択します。
-[start=5]
+
. 「クラス名」に「* ``Handleable`` *」と入力します。「終了」をクリックします。
-[start=6]
+
. 新しい ``Handleable.java`` ファイルを編集して、次の変更を加えます。ファイルを保存します。
[source,java]
@@ -110,13 +110,13 @@
ここで、 ``Handleable`` 注釈を処理する注釈プロセッサのコードを追加する必要があります。
-[start=7]
+
. 「* ``proc`` *」Javaパッケージを右クリックし、「新規」>「Javaクラス」を選択します。
-[start=8]
+
. 「クラス名」に「* ``HandleableProcessor`` *」と入力します。「終了」をクリックします。
-[start=9]
+
. ``HandleableProcessor.java`` クラスを変更して次のコードを追加します。変更を保存します。
*注意:* ``@SupportedSourceVersion`` (*太字*)の値は使用しているJDKのバージョンによって異なり、 ``(SourceVersion.RELEASE_7)`` または ``(SourceVersion.RELEASE_6)`` になります。
@@ -333,7 +333,7 @@
*}
----
-[start=10]
+
. 「 ``AnnProcessor`` 」プロジェクトを右クリックし、「ビルド」を選択することによってプロジェクトをビルドします。
@@ -346,10 +346,10 @@
3. 「メイン・クラスの作成」フィールドに「* ``demo.Main`` *」と入力します。「終了」をクリックします。
image::images/demo-project-wizard.png[title="新規プロジェクト・ウィザードでのDemoプロジェクトの作成。"]
-[start=4]
+
. 「プロジェクト・プロパティ」ウィンドウを開き、「ソース」パネルでソース/バイナリ形式としてJDK 6またはJDK 7が選択されていること、および「ライブラリ」パネルで「Javaプラットフォーム」がJDK 1.6またはJDK 1.7に設定されていることを確認します。
-[start=5]
+
. ``Main.java`` クラスを変更して次のコードを追加します。変更を保存します。
[source,java]
@@ -382,20 +382,20 @@
``Main.java`` コードを保存した後、IDEによって複数のコンパイル・エラーが報告されたことが表示されます。これは、まだこのプロジェクトに注釈プロセッサが追加されていないためです。
-[start=6]
+
. 「プロジェクト・プロパティ」ウィンドウで ``「Demo」`` プロジェクト・ノードを右クリックし、「プロパティ」を選択した後、「プロパティ」ウィンドウで「ライブラリ」カテゴリを選択します。
-[start=7]
+
. 「コンパイル」タブで「プロジェクトの追加」をクリックし、「 ``AnnProcessor`` 」プロジェクトを指定します。
image::images/demo-properties-compile.png[title="プロジェクトの「プロパティ」ウィンドウ内の「ライブラリ」カテゴリにある「コンパイル」タブ"]
「コンパイル」タブは、link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+Javaコンパイラ+]の ``-classpath`` オプションに相当します。この注釈プロセッサは、注釈定義と注釈プロセッサの両方を含む単一のJARファイルであるため、これをプロジェクトのクラスパス(つまり「コンパイル」タブ)に追加する必要があります。
-[start=8]
+
. 「プロジェクト・プロパティ」ウィンドウで「コンパイル」カテゴリを選択し、「注釈処理を有効にする」および「エディタでの注釈処理を有効にする」チェックボックスを選択します。
-[start=9]
+
. 「注釈プロセッサ」テキスト領域の横にある「追加」ボタンをクリックし、「注釈プロセッサFQN」フィールドに * ``「proc.HandleableProcessor」`` *と入力することによって、実行する注釈プロセッサを指定します。
image::images/demo-processor-fqn.png[title="「注釈プロセッサFQN」ダイアログ・ボックス"]
@@ -403,13 +403,13 @@
image::images/demo-properties-compiling.png[title="プロジェクトの「プロパティ」ウィンドウ内の「コンパイル」カテゴリ"]
-[start=10]
+
. 「プロパティ」ウィンドウで「OK」をクリックします。
*注意:* ``Main.java`` ファイルでは、依然としてコンパイル・エラーが表示される場合があります。これは、 ``handleStuff`` メソッドを宣言している ``MainExtras.java`` ファイルを、IDEがまだ認識できていないためです。 ``MainExtras.java`` ファイルは、最初にDemoプロジェクトをビルドした後で生成されます。プロジェクトで「保存時にコンパイル」が有効になっている場合は、 ``Main.java`` を保存したときにIDEがプロジェクトをコンパイルしました。
-[start=11]
+
. 「Demo」プロジェクトを右クリックし、「ビルド」を選択します。
プロジェクトをビルドした後に「プロジェクト」ウィンドウでそのプロジェクトを見ると、新しい ``「生成されたソース」`` ノードが ``demo/MainExtras.java`` ファイルとともに表示されます。
@@ -432,7 +432,7 @@
}
----
-[start=12]
+
. 「Demo」プロジェクトを右クリックし、「実行」を選択します。
「実行」をクリックすると、「出力」ウィンドウに次が表示されるはずです。Demoプロジェクトがコンパイルされ、メッセージが出力されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_pt_BR.asciidoc
index dc0e256..94d7e49 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_pt_BR.asciidoc
@@ -65,13 +65,13 @@
Quando você clica em Finalizar, o IDE cria o projeto de biblioteca de classes e lista o projeto na janela Projetos.
-[start=3]
+
. Clique com o botão direito do mouse no nó do projeto AnnProcessor na janela Projetos e escolha Propriedades.
-[start=4]
+
. Na categoria Códigos-fonte, confirme se JDK 6 ou JDK 7 está especificado como o formato de código-fonte/binário.
-[start=5]
+
. Selecione a guia Bibliotecas e confirme se a plataforma Java está definida como JDK 1.6 ou JDK 1.7. Clique em OK para fechar a janela Propriedades do Projeto.
Neste exercício, você criará dois pacotes Java e uma classe Java em cada um destes pacotes.
@@ -84,13 +84,13 @@
image::images/packages.png[title="A estrutura do projeto para o processador de anotação."]
-[start=4]
+
. Clique com o botão direito do mouse no pacote Java ``ann`` e selecione Nova > Classe Java.
-[start=5]
+
. Digite * ``Handleable`` * para o nome da classe. Clique em Finalizar.
-[start=6]
+
. Modifique o novo arquivo ``Handleable.java`` para fazer as alterações a seguir. Salve o arquivo.
[source,java]
@@ -110,13 +110,13 @@
Agora precisamos adicionar um código para que o processador de anotação processe a anotação ``Handleable`` .
-[start=7]
+
. Clique com o botão direito do mouse no pacote * ``proc`` * e selecione Nova > Classe Java.
-[start=8]
+
. Digite * ``HandleableProcessor`` * para o Nome da Classe. Clique em Finalizar.
-[start=9]
+
. Modifique a classe ``HandleableProcessor.java`` para adicionar o código a seguir. Salve as alterações.
*Observação.* O valor de ``@SupportedSourceVersion`` (em *negrito*) dependerá da versão do JDK que você está usando e será ``(SourceVersion.RELEASE_7)`` ou ``(SourceVersion.RELEASE_6)`` .
@@ -333,7 +333,7 @@
*}
----
-[start=10]
+
. Compile o projeto clicando com o botão direito do mouse no projeto ``AnnProcessor`` e escolhendo Compilar.
@@ -346,10 +346,10 @@
3. Digite * ``demo.Main`` * no campo Criar Classe Principal. Clique em Finalizar.
image::images/demo-project-wizard.png[title="Criando projeto de Demonstração no assistente de Novo Projeto."]
-[start=4]
+
. Abra a janela Propriedades do Projeto e confirme se JDK 6 ou JDK 7 está selecionado como o formato de código-fonte/binário no painel Códigos-fonte e se a plataforma Java está definida como JDK 1.6 ou JDK 1.7 no painel Bibliotecas.
-[start=5]
+
. Modifique a classe ``Main.java`` para adicionar o código a seguir. Salve as alterações.
[source,java]
@@ -382,20 +382,20 @@
Após salvar o código ``Main.java`` , você verá que o IDE relata diversos erros de compilação. Isso acontece porque o processador de anotação ainda não foi adicionado no projeto.
-[start=6]
+
. Clique com o botão direito do mouse no nó do projeto ``Demo`` , na janela Projetos, escolha Propriedades e, em seguida, selecione a categoria Bibliotecas na janela Propriedades do Projeto.
-[start=7]
+
. Na guia Compilar, clique em Adicionar Projeto e localize o projeto ``AnnProcessor`` .
image::images/demo-properties-compile.png[title="Guia Compilar na categoria Bibliotecas da janela Propriedades do projeto"]
A guia Compilar corresponde a opção ``-classpath`` do link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+compilador Java+]. Como o processador de anotação é um arquivo JAR único que contém a definição da anotação e o processador de anotação, ele deve ser adicionado na classpath do projeto, que é a guia Compilar.
-[start=8]
+
. Selecione a categoria Compilação na janela Propriedades do Projeto e marque as caixas de seleção Ativar Processamento de Anotações e Ativar Processamento de Anotações no Editor.
-[start=9]
+
. Especifique o processador de anotações a ser executado clicando no botão Adicionar ao lado da área de texto Processadores de Anotações e digitando * ``proc.HandleableProcessor`` * no campo FQN do Processador de Anotações.
image::images/demo-processor-fqn.png[title="Caixa de diálogo FQN do Processador de Anotação"]
@@ -403,13 +403,13 @@
image::images/demo-properties-compiling.png[title="Categoria compilação na janela Propriedades do projeto"]
-[start=10]
+
. Clique em OK na janela Propriedades.
*Observação.* No arquivo ``Main.java`` talvez você ainda veja os erros de compilação. Isso é porque o IDE ainda não pode localizar o arquivo ``MainExtras.java`` que declara o método ``handleStuff`` . O arquivo ``MainExtras.java`` será gerado após você desenvolver o projeto Demo pela primeira vez. Se Compilar ao Salvar estiver ativado para seu projeto, o IDE compilou o projeto quando você salvou o ``Main.java`` .
-[start=11]
+
. Clique com o botão direito do mouse no projeto Demo e escolha Construir.
Após construir o projeto, se você examinar os projetos na janela Projetos, poderá agora ver um novo nó ``Códigos-fonte Gerados`` com o arquivo ``demo/MainExtras.java`` .
@@ -432,7 +432,7 @@
}
----
-[start=12]
+
. Clique com o botão direito do mouse no projeto Demonstração e escolha Executar.
Quando você clicar em Executar, deverá ver o seguinte na janela Saída. O projeto Demonstração é compilado e imprime a mensagem.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ru.asciidoc
index d978f37..313e8f5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_ru.asciidoc
@@ -65,13 +65,13 @@
При нажатии кнопки "Готово" среда IDE создаст проект библиотеки классов, который появится в окне Projects ("Проекты").
-[start=3]
+
. Щелкните правой кнопкой мыши узел проекта AnnProcessor в окне Projects ("Проекты") и выберите Properties ("Свойства").
-[start=4]
+
. В категории "Источники" подтвердите, что для JDK 6 или JDK 7 указан формат исходного кода/двоичный формат.
-[start=5]
+
. Выберите вкладку "Библиотеки" и подтвердите, что платформой Java является JDK 1.6 или JDK 1.7. Нажмите кнопку "ОК", чтобы закрыть окно Project Properties ("Свойства проекта").
В этом упражнении мы создадим несколько пакетов Java и по одному классу Java в каждом из пакетов.
@@ -84,13 +84,13 @@
image::images/packages.png[title="Структура проекта для обработчика аннотаций."]
-[start=4]
+
. Щелкните правой кнопкой мыши пакет Java ``ann`` и выберите New ("Создать") > Java class ("Класс Java").
-[start=5]
+
. Введите * ``Handleable`` * в поле Class Name ("Имя класса"). Нажмите кнопку "Завершить".
-[start=6]
+
. Измените файл ``Handleable.java`` , добавив приведенный ниже код. Сохраните файл.
[source,java]
@@ -110,13 +110,13 @@
Теперь необходимо добавить к обработчику аннотаций код для обработки аннотации ``Handleable`` .
-[start=7]
+
. Щелкните правой кнопкой мыши пакет* `` Java `` proc* и выберите New ("Создать") > Java class ("Класс Java").
-[start=8]
+
. Введите * ``HandleableProcessor`` * в поле Class Name ("Имя класса"). Нажмите кнопку "Завершить".
-[start=9]
+
. Измените класс ``HandleableProcessor.java`` , добавив нижеприведенный код. Сохраните изменения.
*Примечание.* Значение ``@SupportedSourceVersion`` (выделено *жирным шрифтом*) зависит от используемой версии JDK и может быть двух вариантов: ``(SourceVersion.RELEASE_7)`` или ``(SourceVersion.RELEASE_6)`` .
@@ -333,7 +333,7 @@
*}
----
-[start=10]
+
. Создайте проект, щелкнув правой кнопкой мыши проект ``AnnProcessor`` и выбрав 'Сборка'.
@@ -346,10 +346,10 @@
3. Введите * ``demo.Main`` * в поле Create Main Class ("Создать главный класс"). Нажмите кнопку "Завершить".
image::images/demo-project-wizard.png[title="Создание проекта Demo в мастере создания проектов."]
-[start=4]
+
. Откройте окно 'Свойства проекта' и убедитесь, что JDK 6 или JDK 7 выбран как двоичный формат/формат исходного кода на панели "Исходные коды", а также что JDK 1.6 or JDK 1.7 установлен как платформа Java на панели "Библиотеки".
-[start=5]
+
. Измените класс ``Main.java`` , добавив приведенный ниже код. Сохраните изменения.
[source,java]
@@ -382,20 +382,20 @@
После сохранения кода ``Main.java`` можно увидеть, что среда IDE сообщает о ряде ошибок компиляции. Это происходит, поскольку обработчик аннотаций еще не добавлен в проект.
-[start=6]
+
. Щелкните правой кнопкой мыши узел проекта ``Demo`` в окне "Проекты", выберите "Свойства", затем выберите категорию "Библиотеки" в окне 'Свойства проекта'.
-[start=7]
+
. На вкладке Compile ("Компиляция") щелкните Add Project ("Добавить проект") и найдите проект ``AnnProcessor`` .
image::images/demo-properties-compile.png[title="Вкладка 'Компилировать' в категории 'Библиотеки' окна свойств проекта"]
Вкладка "Компиляция" соответствует параметру ``-classpath`` link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+компилятора Java+]. Поскольку обработчик аннотаций является единым файлом JAR, который содержит как определение аннотаций, так и обработчик аннотаций, его следует добавить к пути классов для проекта, которым является вкладка Compile ("Компиляция").
-[start=8]
+
. Выберите категорию "Компиляция" в окне "Свойства проекта" и установите флажки "Разрешить обработку аннотаций" и "Разрешить обработку аннотаций в редакторе".
-[start=9]
+
. Укажите, какой обработчик аннотаций должен быть запущен, нажав кнопку Add ("Добавить") рядом с текстовой областью обработчиков аннотаций и введя * ``proc.HandleableProcessor`` * в поле FQN ("Полностью определенное имя") обработчика аннотаций.
image::images/demo-processor-fqn.png[title="Диалоговое окно 'FQN обработчика аннотаций'"]
@@ -403,13 +403,13 @@
image::images/demo-properties-compiling.png[title="Категория "Компиляция" в окне "Свойства проекта"."]
-[start=10]
+
. Нажмите кнопку OK в окне Properties ("Свойства").
*Примечание.* В файле ``Main.java`` все еще могут отображаться ошибки компиляции. Это происходит, поскольку в среде IDE еще не определено местоположение файла ``MainExtras.java`` , в котором объявляется метод ``handleStuff`` . После первого создания проекта Demo будет создан файл ``MainExtras.java`` . Если для проекта включено режим Compile On Save ("Компилировать при сохранении"), среда IDE компилирует проект при сохранении ``Main.java`` .
-[start=11]
+
. Щелкните правой кнопкой мыши проект Demo и выберите Build ("Сборка").
Если после сборки проекта взглянуть на него в окне Projects ("Проекты"), то можно будет увидеть новый узел ``Generated Sources`` с файлом ``demo/MainExtras.java`` .
@@ -432,7 +432,7 @@
}
----
-[start=12]
+
. Щелкните правой кнопкой мыши проект Demo и выберите Run ("Запустить").
При щелчке Run ("Запустить") в окне вывода можно будет увидеть следующее. Выполняется компиляция проекта Demo, и на экран выводится сообщение.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_zh_CN.asciidoc
index a83342a..d050620 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-custom_zh_CN.asciidoc
@@ -65,13 +65,13 @@
单击 "Finish"(完成),此时 IDE 将创建类库项目,并在 "Projects"(项目)窗口中列出该项目。
-[start=3]
+
. 在 "Projects"(项目)窗口中,右键单击 AnnProcessor 项目节点,然后选择 "Properties"(属性)。
-[start=4]
+
. 在 "Sources"(源)类别中,确认将 JDK 6 或 JDK 7 指定为源代码/二进制格式。
-[start=5]
+
. 选择 "Libraries"(库)标签,然后确认将 Java 平台设置为 "JDK 1.6" 或 "JDK 1.7"。单击 "OK"(确定),以关闭 "Project Properties"(项目属性)窗口。
在本练习中,将创建两个 Java 包,并在每个包中创建一个 Java 类。
@@ -84,13 +84,13 @@
image::images/packages.png[title="标注处理程序项目的结构。"]
-[start=4]
+
. 右键单击 ``ann`` Java 包,然后选择 "New"(新建)> "Java Class"(Java 类)。
-[start=5]
+
. 键入 * ``Handleable`` * 作为类名。单击 "Finish"(完成)。
-[start=6]
+
. 修改新的 ``Handleable.java`` 文件,进行如下更改。保存该文件。
[source,java]
@@ -110,13 +110,13 @@
现在,您需要为标注处理程序添加处理 ``Handleable`` 标注的代码。
-[start=7]
+
. 右键单击 * ``proc`` * Java 包,然后选择 "New"(新建)> "Java Class"(Java 类)。
-[start=8]
+
. 键入 * ``HandleableProcessor`` * 作为类名。单击 "Finish"(完成)。
-[start=9]
+
. 修改 ``HandleableProcessor.java`` 类,以添加如下代码。保存所做的更改。
*注:* ``@SupportedSourceVersion`` 的值(*粗体*)将依赖于您正在使用的 JDK 版本,将为 ``(SourceVersion.RELEASE_7)`` 或 ``(SourceVersion.RELEASE_6)`` 。
@@ -333,7 +333,7 @@
*}
----
-[start=10]
+
. 右键单击 ``AnnProcessor`` 项目,然后选择 "Build"(构建)以构建项目。
@@ -346,10 +346,10 @@
3. 在 "Create Main Class"(创建主类)字段中,键入 * ``demo.Main`` *。单击 "Finish"(完成)。
image::images/demo-project-wizard.png[title="在新建项目向导中创建 "Demo"(演示)项目。"]
-[start=4]
+
. 打开 "Project Properties"(项目属性)窗口,确认在 "Sources"(源)面板中选择 "JDK 6" 或 "JDK 7" 作为源代码/二进制格式,然后确认在 "Libraries"(库)面板中将 Java 平台设置为 "JDK 1.6" 或 "JDK 1.7"。
-[start=5]
+
. 修改 ``Main.java`` 类,以添加如下代码。保存所做的更改。
[source,java]
@@ -382,20 +382,20 @@
保存 ``Main.java`` 代码后,您会看到 IDE 报告多个编译错误。这是由于标注处理程序尚未添加到项目中。
-[start=6]
+
. 在 "Projects"(项目)窗口中,右键单击 ``Demo`` 项目节点,选择 "Properties"(属性),然后在 "Project Properties"(项目属性)窗口中选择 "Libraries"(库)类别。
-[start=7]
+
. 在 "Compile"(编译)标签中,单击 "Add Project"(添加项目),然后找到 ``AnnProcessor`` 项目。
image::images/demo-properties-compile.png[title="项目的 "Properties"(属性)窗口 "Libraries"(库)类别中的 "Compile"(编译)标签"]
"Compile"(编译)标签对应于 link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+Java 编译器+]的 ``-classpath`` 选项。由于标注处理程序是包含标注定义和标注处理程序的单一 JAR 文件,因此,应在 "Compile"(编译)标签中将其添加到项目的类路径中。
-[start=8]
+
. 在 "Project Properties"(项目属性)窗口中选择 "Compiling"(编译)类别,然后选中 "Enable Annotation Processing"(启用标注处理)和 "Enable Annotation Processing in Editor"(在编辑器中启用标注处理)复选框。
-[start=9]
+
. 单击 "Annotation Processors"(标注处理程序)文本区域旁边的 "Add"(添加)按钮,然后在 "Annotation Processor FQN"(标注处理程序 FQN)字段中键入 * ``proc.HandleableProcessor`` * 以指定要运行的标注处理程序。
image::images/demo-processor-fqn.png[title=""Annotation Processor FQN"(标注处理程序 FQN)对话框"]
@@ -403,13 +403,13 @@
image::images/demo-properties-compiling.png[title="项目 "Properties"(项目属性)窗口中的 "Compiling"(编译)类别"]
-[start=10]
+
. 在 "Properties"(属性)窗口中单击 "OK"(确定)。
*注:*在 ``Main.java`` 文件中,仍可能会看到一些编译错误。这是由于 IDE 仍然找不到声明 ``handleStuff`` 方法的 ``MainExtras.java`` 文件。首次构建 Demo 项目后,将构建 ``MainExtras.java`` 文件。如果为项目启用了 "Compile On Save"(在保存时编译)功能,则在保存 ``Main.java`` 时,IDE 将编译项目。
-[start=11]
+
. 右键单击 "Demo" 项目,然后选择 "Build"(构建)。
在构建项目后,如果在 "Projects"(项目)窗口中查看该项目,则可以看到包含 ``demo/MainExtras.java`` 文件的新 ``Generated Sources`` (构建的源文件)节点。
@@ -432,7 +432,7 @@
}
----
-[start=12]
+
. 右键单击 "Demo" 项目,然后选择 "Run"(运行)。
单击 "Run"(运行)时,"Output"(输出)窗口中应显示以下内容。Demo 项目编译并打印该信息。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok.asciidoc
index c983fcc..f31d25d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok.asciidoc
@@ -63,17 +63,17 @@
-[start=5]
+
. Right-click the ``testann`` package node in the Projects window and choose New > Java class.
-[start=6]
+
. Type ``MyBooks`` for the Class Name and confirm that the class will be created in the ``testann`` package. Click Finish.
When you click Finish the IDE opens the new class in the editor.
-[start=7]
+
. In the source editor, add the following three fields to ``MyBooks.java`` .
[source,java]
@@ -91,17 +91,17 @@
-[start=8]
+
. Place your insert cursor in the class declaration and press Ctrl-Space to invoke the editor's code completion support.
-[start=9]
+
. Select ``MyBooks (int year, String title, String author) - generate`` in the code completion list to generate a constructor for ``MyBooks.java`` .
image::images/generate-constructor.png[title="Code completion to generate constructor"]
-[start=10]
+
. Save your changes.
@@ -119,10 +119,10 @@
-[start=5]
+
. Choose the Compiling category in the Project Properties window.
-[start=6]
+
. Confirm that the Enable Annotation Processing checkbox is selected (it is enabled by default) and select the Enable Annotation Processing in Editor checkbox.
image::images/properties2.png[title="Compiling category in Properties window"]
@@ -133,7 +133,7 @@
-[start=7]
+
. Click OK in the Project Properties window and return to the ``MyBooks.java`` file.
If you expand the Libraries node in the Projects window, you can see that ``lombok.jar`` is now listed as a project library.
@@ -149,7 +149,7 @@
-[start=2]
+
. Click the hint in the editor's left margin and add import for ``lombok.Data`` .
image::images/import-lombok.png[title="Hint in editor to import lombok"]
@@ -188,7 +188,7 @@
-[start=3]
+
. Open the ``TestBooks.java`` file with the _main_ method and add the following code (in bold) to create a new object of the ``MyBooks`` class.
[source,java]
@@ -206,7 +206,7 @@
-[start=4]
+
. Add the following code to print out the values of the ``books`` variable.
To return the values, we call the getter methods that were auto-generated by ``lombok.jar`` . While you are typing, note that the auto-generated artifacts are available from the code completion window.
@@ -228,10 +228,10 @@
-[start=5]
+
. Save your changes.
-[start=6]
+
. Right-click the project node in the Projects window and choose Run (F6).
When you run the application you should see the following output that shows that the application compiled successfully.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ja.asciidoc
index d54dd87..93be892 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ja.asciidoc
@@ -62,16 +62,16 @@
「終了」をクリックすると、IDEによってJavaアプリケーション・プロジェクトが作成され、 ``TestBooks.java`` クラスがエディタに表示されます。ここで、新しいプロジェクトが「プロジェクト」ウィンドウに表示され、 ``TestBooks.java`` クラスが「ソース・パッケージ」ノードの下にある ``testann`` パッケージに含まれていることが確認できます。
-[start=5]
+
. 「プロジェクト」ウィンドウで「 ``testann`` 」パッケージ・ノードを右クリックし、「新規」>「Javaクラス」を選択します。
-[start=6]
+
. 「クラス名」に「* ``MyBooks`` *」と入力し、そのクラスが ``testann`` パッケージ内に作成されることを確認します。「終了」をクリックします。
「終了」をクリックすると、IDEによって新しいクラスがエディタに表示されます。
-[start=7]
+
. ソース・エディタで、次の3つのフィールドを ``MyBooks.java`` に追加します。
[source,java]
@@ -87,14 +87,14 @@
}
----
-[start=8]
+
. 挿入カーソルをクラス宣言に置き、[Ctrl]-[Space]を押して、エディタのコード補完サポートを呼び出します。
-[start=9]
+
. コード補完リストで「 ``MyBooks (int year, String title, String author) - generate`` 」を選択して、 ``MyBooks.java`` のコンストラクタを生成します。
image::images/generate-constructor.png[title="コンストラクタを生成するためのコード補完"]
-[start=10]
+
. 変更を保存します。
@@ -111,10 +111,10 @@
「コンパイル」タブで追加されたリソースは、link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+Javaコンパイラ+]の ``-classpath`` オプションに相当します。 ``lombok.jar`` は、注釈定義と注釈プロセッサの両方を含む単一のJARファイルであるため、これをプロジェクトのクラスパス(つまり「コンパイル」タブ)に追加する必要があります。
-[start=5]
+
. 「プロジェクト・プロパティ」ウィンドウで「コンパイル」カテゴリを選択します。
-[start=6]
+
. 「注釈処理を有効にする」チェックボックスが選択されていることを確認し(デフォルトでは有効)、「エディタでの注釈処理を有効にする」チェックボックスを選択します。
image::images/properties2.png[title="「プロパティ」ウィンドウ内の「コンパイル」カテゴリ"]
@@ -123,7 +123,7 @@
「エディタでの注釈処理を有効にする」チェックボックスを選択することにより、エディタに注釈処理の結果が表示されるようになります。注釈プロセッサによって生成されたどの追加アーティファクト(クラス、メソッド、フィールドなど)もIDEエディタに表示されるようになり、コード補完、「ナビゲータ」、「型に移動」、「使用状況を検索」などで使用できるようになります。
-[start=7]
+
. 「プロジェクト・プロパティ」ウィンドウで「OK」をクリックして、 ``MyBooks.java`` ファイルに戻ります。
「プロジェクト」ウィンドウで「ライブラリ」ノードを展開すると、 ``lombok.jar`` がプロジェクト・ライブラリとして表示されるようになっていることがわかります。
@@ -138,7 +138,7 @@
プロジェクトLombokがサポートする注釈の詳細は、Lombokのlink:http://projectlombok.org/features/index.html[+機能の概要+]を参照してください。
-[start=2]
+
. エディタの左マージンにあるヒントをクリックして、 ``lombok.Data`` のインポートを追加します。
image::images/import-lombok.png[title="lombokをインポートするためのエディタ内のヒント"]
@@ -175,7 +175,7 @@
コード補完ウィンドウを呼び出すと([Ctrl]-[Space])、生成されたアーティファクトも選択可能になっているのが確認できます。ここで、プロジェクトがコンパイルされ、生成されたアーティファクトをプログラムの他の部分からコールできることを確認します。
-[start=3]
+
. _main_メソッドで ``TestBooks.java`` ファイルを開き、次のコード(太字)を追加して、 ``MyBooks`` クラスの新規オブジェクトを作成します。
[source,java]
@@ -191,7 +191,7 @@
}
----
-[start=4]
+
. ``books`` 変数の値を出力するための次のコードを追加します。
値を返すため、 ``lombok.jar`` によって自動生成された取得メソッドをコールします。入力中に、自動生成されたアーティファクトをコード補完ウィンドウから使用できます。
@@ -211,10 +211,10 @@
}
----
-[start=5]
+
. 変更を保存します。
-[start=6]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」([F6])を選択します。
このアプリケーションを実行すると、アプリケーションが正常にコンパイルされたことを示す次の出力が表示されるはずです。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_pt_BR.asciidoc
index c2b79af..58e1fd4 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_pt_BR.asciidoc
@@ -62,16 +62,16 @@
Quando você clica em Finalizar, o IDE cria a aplicação Java e abre a classe ``TestBooks.java`` no editor. Você pode ver que o novo projeto está agora visível na janela Projetos e que a classe ``TestBooks.java`` está no pacote ``testann`` sob o nó Pacotes de Código-fonte.
-[start=5]
+
. Clique com o botão direito do mouse no nó do pacote ``testann`` na janela Projetos e escolha Novo > Classe Java.
-[start=6]
+
. Digite * ``MyBooks`` * para o Nome da Classe e confirme que a classe será criada no pacote ``testann`` . Clique em Finalizar.
Quando você clicar em Finalizar, o IDE abre a nova classe no editor.
-[start=7]
+
. No editor de código-fonte, adicione os seguintes três campos em ``MyBooks.java`` .
[source,java]
@@ -87,14 +87,14 @@
}
----
-[start=8]
+
. Coloque o ponteiro do mouse na declaração da classe e pressione Ctrl-Espaço para chamar o suporte de autocompletar código do editor.
-[start=9]
+
. Selecione ``MyBooks (int year, String title, String author) - generate`` na lista autocompletar código para gerar um construtor para ``MyBooks.java`` .
image::images/generate-constructor.png[title="Recurso autocompletar código para gerar o construtor"]
-[start=10]
+
. Salve as alterações.
@@ -111,10 +111,10 @@
Os recursos adicionados à guia Compilar correspondem à opção ``-classpath`` do link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+compilador Java+]. Como ``lombok.jar`` é um arquivo JAR único que contém definições de anotação e processadores de anotações, é recomendado adicioná-lo ao classpath do projeto, que é a guia Compilação.
-[start=5]
+
. Escolha a categoria Compilação na janela Propriedades do Projeto.
-[start=6]
+
. Confirme se a caixa de seleção Ativar o Processamento de Anotações está selecionada (ela é ativada por default) e selecione a caixa de seleção Ativar o Processamento de Anotações no Editor.
image::images/properties2.png[title="Categoria de compilação na janela Propriedades"]
@@ -123,7 +123,7 @@
Ao selecionar a caixa de seleção, Ativar Processamento de Anotações no Editor, você faz com que o processamento de anotações fique visível no editor. Quaisquer artefatos adicionais que forem gerados por processadores de anotações (classes, métodos, campos, etc.) ficam visíveis no editor IDE e disponíveis para a conclusão de código, no Navegador, Ir para Tipo, Localizar usos e outros.
-[start=7]
+
. Clique em OK na janela Propriedades do Projeto e retorne para o arquivo ``MyBooks.java`` .
Caso você expanda o nó Bibliotecas na janela Projetos, verá que a ``lombok.jar`` está agora listada como uma biblioteca do projeto.
@@ -138,7 +138,7 @@
Para aprender mais sobre quais anotações são suportadas pelo Projeto Lombok, consulte a link:http://projectlombok.org/features/index.html[+Visão Geral das Funcionalidades+] do Lombok.
-[start=2]
+
. Clique na dica na margem direita do editor e adicione importar para ``lombok.Data`` .
image::images/import-lombok.png[title="Dica no editor para importar lombok"]
@@ -175,7 +175,7 @@
É possível também chamar a janela autocompletar código (Ctrl-Espaço) e ver que os artefatos gerados estão disponíveis para pegá-los. Agora, veremos que o projeto compila e os artefatos gerados podem ser chamados de outras partes do programa.
-[start=3]
+
. Abra o arquivo ``TestBooks.java`` com o método _main_ e adicione o código a seguir (em negrito) para criar um novo objeto da classe ``MyBooks`` .
[source,java]
@@ -191,7 +191,7 @@
}
----
-[start=4]
+
. Adicione o seguinte código para imprimir os valores da variável ``books`` .
Para voltar os valores, chamamos os métodos getter que são autogerados por ``lombok.jar`` . Enquanto estiver digitando, observe que os artefatos autogerados estão disponíveis da janela autocompletar código.
@@ -211,10 +211,10 @@
}
----
-[start=5]
+
. Salve as alterações.
-[start=6]
+
. Clique com o botão direito do mouse no nó na janela Projetos e selecione Executar (F6).
Ao executar a aplicação, você deverá ver a seguinte saída que mostra que a aplicação foi compilada com êxito.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ru.asciidoc
index ec531ef..e548489 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_ru.asciidoc
@@ -62,16 +62,16 @@
После нажатия кнопки "Готово" среда IDE создаст проект приложения Java и откроет класс ``TestBooks.java`` в редакторе. Как вы можете видеть, теперь новый проект отображается в окне "Проекты", а класс ``TestBooks.java`` находится в пакете ``testann`` в узле "Исходные файлы".
-[start=5]
+
. Правой кнопкой мыши щелкните узел с пакетом ``testann`` в окне "Проекты", затем выберите "Создать" > "Класс Java".
-[start=6]
+
. Введите * ``MyBooks`` * в поле "Имя класса" и подтвердите создание класса в пакете ``testann`` . Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE откроет новый класс в редакторе.
-[start=7]
+
. В редакторе исходного кода добавьте три следующих поля в ``MyBooks.java`` .
[source,java]
@@ -87,14 +87,14 @@
}
----
-[start=8]
+
. Поместите курсор в объявление класса и нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова функции автозавершения кода редактора.
-[start=9]
+
. Выберите ``MyBooks (int year, String title, String author) - generate`` в списке автозавершения кода, чтобы создать конструктор для ``MyBooks.java`` .
image::images/generate-constructor.png[title="Автозавершение кода для создания конструктора"]
-[start=10]
+
. Сохраните изменения.
@@ -111,10 +111,10 @@
Ресурсы, добавленные на вкладке "Компиляция", соответствуют параметру ``-classpath`` link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+компилятора Java+]. Поскольку файл ``lombok.jar`` является отдельным файлом JAR, содержащим определения аннотаций и процессоры аннотаций, его необходимо добавить в путь к классам проекта, соответствующий вкладке "Компиляция".
-[start=5]
+
. Выберите в окне "Свойства проекта" категорию "Компиляция".
-[start=6]
+
. Убедитесь, что флажок "Включить обработку аннотаций" установлен (параметр активирован по умолчанию). Также установите флажок "Включить обработку аннотаций в редакторе".
image::images/properties2.png[title="Выберите в окне "Свойства проекта" категорию "Компиляция"."]
@@ -123,7 +123,7 @@
При установке флажка "Включить обработку аннотаций в редакторе" результаты обработки аннотаций становятся видимыми в редакторе. Дополнительные артефакты, созданные процессорами аннотаций (классы, методы, поля и др.), становятся видимыми в редакторе среды IDE и доступными для функции автозавершения кода, навигатора, перехода к типу, поиска случаев использования и пр.
-[start=7]
+
. В окне "Свойства проекта" нажмите кнопку "ОК" и вернитесь в файл ``MyBooks.java`` .
Развернув узел "Библиотеки" в окне "Проекты", вы увидите, что теперь файл ``lombok.jar`` находится в списке библиотек проекта.
@@ -138,7 +138,7 @@
Дополнительные сведения об аннотациях, поддерживаемых в проекте Lombok, приведены в разделе link:http://projectlombok.org/features/index.html[+Обзор функций+] Lombok.
-[start=2]
+
. Щелкните всплывающую подсказку в левом поле редактора и добавьте импорт для ``lombok.Data`` .
image::images/import-lombok.png[title="Подсказка в редакаторе для импорта lombok"]
@@ -175,7 +175,7 @@
Можно также вызвать окно автозавершения кода (CTRL+ПРОБЕЛ) и проверить доступность созданных артефактов для выбора. Теперь необходимо убедиться, что проект выполняет компиляцию, а созданные артефакты можно вызвать из других компонентов программы.
-[start=3]
+
. Откройте файл ``TestBooks.java`` с методом _main_ и добавьте следующий код (выделен полужирным шрифтом), чтобы создать новый объект класса ``MyBooks`` .
[source,java]
@@ -191,7 +191,7 @@
}
----
-[start=4]
+
. Добавьте следующий код, который выводит на экран значения переменной ``books`` .
Для возврата значений следует вызвать методы получения, автоматически созданные в файле ``lombok.jar`` . Обратите внимание, что при вводе автоматически созданные артефакты доступны в окне автозавершения кода.
@@ -211,10 +211,10 @@
}
----
-[start=5]
+
. Сохраните изменения.
-[start=6]
+
. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите команду "Выполнить" (F6).
После запуска приложения на экране должны отобразиться следующие выходные данные, демонстрирующие успешность компиляции.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_zh_CN.asciidoc
index f2474a7..0a3fc1b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/annotations-lombok_zh_CN.asciidoc
@@ -62,16 +62,16 @@
单击 "Finish"(完成),此时 IDE 将创建 Java 应用程序项目,并在编辑器中打开 ``TestBooks.java`` 类。您可以看到,新项目现在显示在 "Projects"(项目)窗口中,并且 ``TestBooks.java`` 类位于 "Source Packages"(源包)节点下的 ``testann`` 包中。
-[start=5]
+
. 在 "Projects"(项目)窗口中,右键单击 ``testann`` 包节点,然后选择 "New"(新建)> "Java Class"(Java 类)。
-[start=6]
+
. 键入 * ``MyBooks`` * 作为类名,并确认将在 ``testann`` 包中创建类。单击 "Finish"(完成)。
单击 "Finish"(完成)后,IDE 将在编辑器中打开新类。
-[start=7]
+
. 在源代码编辑器中,将以下三个字段添加到 ``MyBooks.java`` 中。
[source,java]
@@ -87,14 +87,14 @@
}
----
-[start=8]
+
. 将插入光标放在类声明中,然后按 Ctrl-空格组合键,以调用编辑器的代码完成支持。
-[start=9]
+
. 在代码完成列表中选择 ``MyBooks (int year, String title, String author) - generate`` (MyBooks (int year, String title, String author) - 生成),以生成 ``MyBooks.java`` 的构造函数。
image::images/generate-constructor.png[title="用于生成构造函数的代码完成功能"]
-[start=10]
+
. 保存所做的更改。
@@ -111,10 +111,10 @@
在 "Compile"(编译)标签上添加的资源对应于 link:http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options[+Java 编译器+]的 ``-classpath`` 选项。鉴于 ``lombok.jar`` 是一个同时包含标注定义和标注处理程序的单一 JAR 文件,您应该在 "Compile"(编译)标签中将其添加到项目的类路径中。
-[start=5]
+
. 在 "Project Properties"(项目属性)窗口中,选择 "Compiling"(编译)类别。
-[start=6]
+
. 确认选中了 "Enable Annotation Processing"(启用标注处理)复选框(默认为启用),然后选择 "Enable Annotation Processing in Editor"(在编辑器中启用标注处理)复选框。
image::images/properties2.png[title=""Properties"(属性)窗口中的 "Compiling"(编译)类别"]
@@ -123,7 +123,7 @@
通过选中 "Enable Annotation Processing in Editor"(在编辑器中启用标注处理)复选框,可在编辑器中查看标注处理结果。标注处理程序生成的其他任何工件(类、方法、字段等)均会显示在 IDE 编辑器中,并且可用于代码完成、导航器、跳转类型、查找使用实例等。
-[start=7]
+
. 在 "Project Properties"(项目属性)窗口单击 "OK"(确定),返回到 ``MyBooks.java`` 文件。
如果在 "Projects"(项目)窗口中展开 "Libraries"(库)节点,则可以看到 ``lombok.jar`` 现在被列为项目库。
@@ -138,7 +138,7 @@
要了解有关 Project Lombok 支持的标注的详细信息,请参见 Lombok 的link:http://projectlombok.org/features/index.html[+功能概述+]。
-[start=2]
+
. 单击编辑器左旁注中的提示,然后为 ``lombok.Data`` 添加 import。
image::images/import-lombok.png[title="编辑器中导入 lombok 的提示"]
@@ -175,7 +175,7 @@
还可以调用代码完成窗口(Ctrl-空格键),然后查看生成的工件是否可供选择。现在,我们看到项目已编译,生成的工件可以通过程序的其他部分调用。
-[start=3]
+
. 打开包含 _main_ 方法的 ``TestBooks.java`` 文件,并添加下面的代码(粗体)以创建 ``MyBooks`` 类的新对象。
[source,java]
@@ -191,7 +191,7 @@
}
----
-[start=4]
+
. 添加以下代码,以输出 ``books`` 变量的值。
要返回值,我们调用 ``lombok.jar`` 自动生成的 getter 方法。键入时,请注意代码完成窗口是否提供了自动生成的工件。
@@ -211,10 +211,10 @@
}
----
-[start=5]
+
. 保存所做的更改。
-[start=6]
+
. 在 "Projects"(项目)窗口中,右键单击项目节点,然后选择 "Run"(运行)(F6 键)。
运行应用程序时,应会显示以下输出,说明应用程序编译成功。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/code-inspect.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/code-inspect.asciidoc
index 62d6e30..b34bb76 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/code-inspect.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/code-inspect.asciidoc
@@ -203,7 +203,7 @@
-[start=4]
+
. Click the Inspect button to initiate the static code analysis.
The result of the static code analysis is displayed in the Inspector Window below the Source Editor.
The description of the selected bug is displayed in the frame on the right.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ja.asciidoc
index 3c397ff..9580718 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ja.asciidoc
@@ -90,7 +90,7 @@
--
-[start=3]
+
. 「インストーラ」ダイアログ・ボックスで「次」をクリックし、インストールを続行します。
[.feature]
@@ -99,10 +99,10 @@
--
-[start=4]
+
. ライセンス契約を確認し、ライセンス契約オプションを選択して、「インストール」をクリックします。
-[start=5]
+
. インストールが完了したら、「終了」をクリックします。
@@ -134,7 +134,7 @@
*注意:* この構成を最初に実行する前に、<<plugin,FindBugs>>プラグインをインストールする必要があります。
-[start=4]
+
. 「検査」をクリックします。
分析の結果が「インスペクタ・ウィンドウ」の左にツリー・ビューとして表示されます。
@@ -170,7 +170,7 @@
*注意:* 「 ``NetBeans Javaヒント`` 」構成のスコープ(ファイル、パッケージ、またはプロジェクト)を定義できます。
-[start=3]
+
. 「構成」ラジオ・ボタンを選択し、ドロップダウン・リストで「 ``NetBeans Javaヒント`` 」を選択します。
[.feature]
@@ -179,14 +179,14 @@
--
-[start=4]
+
. 「検査」をクリックします。
IDEでは、「インスペクタ・ウィンドウ」内のツリー・ビューに、「 ``NetBeans Javaヒント`` 」構成を使用した分析の結果が表示されます。
image::images/hintsconfig.png[]
-[start=5]
+
. 「インスペクタ」ウィンドウで、左のツールバーの<<categorize,カテゴリ化>>ボタンをクリックし、カテゴリにグループ化された問題を表示します。
image::images/catview.png[]
@@ -221,7 +221,7 @@
*注意:* 「 ``FindBugs`` 」構成を使用して、ファイル、パッケージまたはプロジェクトを検査できます。
-[start=3]
+
. 「検査」ダイアログ・ボックスで、「 ``FindBugs`` 」構成を選択します。
[.feature]
@@ -230,7 +230,7 @@
--
-[start=4]
+
. 「検査」ボタンをクリックして、静的コード分析を開始します。
ソース・エディタの下にある「インスペクタ・ウィンドウ」に、静的コード分析の結果が表示されます。
右のフレームに、選択したbugの説明が表示されます。
@@ -241,7 +241,7 @@
--
-[start=5]
+
. または、左のツールバーの<<categorize,カテゴリ化>>ボタンをクリックし、カテゴリにグループ化されたbugを表示します。
image::images/fbcat.png[]
@@ -270,10 +270,10 @@
--
-[start=4]
+
. 「エディタ」オプションで「FindBugsの実行」を選択します。
-[start=5]
+
. 「OK」をクリックします。
ここで、bugが報告されたソース・コード内で[Alt]-[Enter]を押し、表示されたヒントの末尾にある黒い右矢印をクリックすると、IDEでは、潜在的なbugに対するいくつかの修正オプションが表示されます。
@@ -297,13 +297,13 @@
image::images/configurations-db.png[]
-[start=4]
+
. 「構成」ドロップダウン・リストで「 ``デフォルト`` 」が選択されていることを確認します。
-[start=5]
+
. 「アナライザ」ドロップダウン・リストで ``「JRE 8プロファイル準拠」`` 、 ``「NetBeans Javaヒント」`` または ``「FindBugs」`` アナライザを選択します。
-[start=6]
+
. 前のステップで選択したアナライザに応じて、検証するプロファイル、 ``デフォルト`` 構成に含める検査またはbugを選択します。
[.feature]
@@ -312,7 +312,7 @@
--
-[start=7]
+
. 「OK」をクリックして「 ``デフォルト`` 」構成を保存します。
@@ -334,13 +334,13 @@
image::images/newconfig-created.png[]
-[start=5]
+
. 「アナライザ」ドロップダウン・リストで ``「JRE 8プロファイル準拠」`` 、 ``「NetBeans Javaヒント」`` または ``「FindBugs」`` 選択します。
-[start=6]
+
. 構成に含めるプロファイル、検査またはbugを指定します。
-[start=7]
+
. 「OK」をクリックして編集内容を保存し、「構成」ダイアログ・ボックスを閉じます。
作成された「 ``newConfig`` 」構成が、「検査」ダイアログ・ボックスの「構成」ドロップダウン・リストで選択可能になります。
@@ -363,7 +363,7 @@
image::images/delete.png[]
-[start=5]
+
. 「構成の削除」ダイアログ・ボックスで、「はい」をクリックして構成の削除を確認します。
image::images/delete-confirm.png[]
@@ -397,7 +397,7 @@
--
-[start=4]
+
. 「検査」ダイアログ・ボックスで、「検査」をクリックしてソース・コード分析を実行します。
検査操作が完了すると、ソース・エディタの下にある「インスペクタ・ウィンドウ」に、検出されたコードまたはbugに適用可能なヒントが表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_pt_BR.asciidoc
index 8ce39e8..d8ccf7a 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_pt_BR.asciidoc
@@ -82,7 +82,7 @@
--
-[start=3]
+
. Na caixa de diálogo Instalador, clique em Próximo para continuar com a instalação.
[.feature]
@@ -91,10 +91,10 @@
--
-[start=4]
+
. Revise o acordo de licença, selecione a opção do contrato de licença e clique em Instalar.
-[start=5]
+
. Quando a instalação for concluída, clique em Finalizar.
@@ -126,7 +126,7 @@
*Observação:* você precisa instalar o plug-in <<plugin,Findbugs>> para executar esta configuração pela primeira vez.
-[start=4]
+
. Clique em Inspecionar.
Os resultados da análise são exibidos na janela Inspetor como uma view em árvore à esquerda.
@@ -162,7 +162,7 @@
*Observação:* você pode definir um escopo (um arquivo, pacote ou projeto) para a configuração de ``Dicas Java NetBeans`` .
-[start=3]
+
. Selecione o botão de rádio Configuração e escolha ``Dicas Java NetBeans`` na lista drop-down.
[.feature]
@@ -171,14 +171,14 @@
--
-[start=4]
+
. Clique em Inspecionar.
O IDE exibe a view em árvore com os resultados da análise, com a configuração ``Dicas Java NetBeans`` na Janela Inspetor.
image::images/hintsconfig.png[]
-[start=5]
+
. Na Janela Inspetor, clique no botão <<categorize,Categorizar>> na barra de ferramentas à esquerda para exibir os problemas agrupados em categorias.
image::images/catview.png[]
@@ -213,7 +213,7 @@
*Observação:* Você pode inspecionar um arquivo, pacote ou projeto(s) com a configuração ``FindBugs`` .
-[start=3]
+
. Na caixa de diálogo Inspecionar, selecione a configuração ``FindBugs`` .
[.feature]
@@ -222,7 +222,7 @@
--
-[start=4]
+
. Clique no botão Inspecionar para iniciar a análise de código estático.
O resultado da análise de código estático é exibido na Janela do Inspetor abaixo do editor de código-fonte.
A descrição do erro selecionado é exibida no quadro à direita.
@@ -233,7 +233,7 @@
--
-[start=5]
+
. Se preferir, clique no botão <<categorize,Categorizar>> na barra de ferramentas à esquerda para exibir os erros agrupados em categorias.
image::images/fbcat.png[]
@@ -262,10 +262,10 @@
--
-[start=4]
+
. Selecione a opção Executar FindBugs no Editor.
-[start=5]
+
. Clique em OK.
Se você agora pressionar Alt-Enter o código-fonte onde um erro é reportado e clique na seta preta apontando para a direita no final da dica exibida, o IDE mostra algumas opções de correção para um possível erro.
@@ -289,13 +289,13 @@
image::images/configurations-db.png[]
-[start=4]
+
. Garantir ``Default`` é selecionado na lista drop-down Configurações.
-[start=5]
+
. Na lista drop-down Analisador, selecione o analisador ``Conformidade de Perfis do JRE 8`` , ``Dicas Java Netbeans`` ou ``FindBugs`` .
-[start=6]
+
. Dependendo da escolha do analisador na etapa anterior, selecione o perfil a ser validado, as inspeções ou os erros que você precisa incluir na configuração ``Padrão`` .
[.feature]
@@ -304,7 +304,7 @@
--
-[start=7]
+
. Clique em OK para salvar sua configuração ``Default`` .
@@ -326,13 +326,13 @@
image::images/newconfig-created.png[]
-[start=5]
+
. Na lista drop-down Analisador, escolha ``Conformidade de Perfis do JRE 8`` , ``Dicas Java Netbeans`` ou ``FindBugs`` .
-[start=6]
+
. Especifique o perfil, as inspeções ou os erros a serem incluídos na sua própria configuração.
-[start=7]
+
. Clique em OK para salvar suas edições e fechar a caixa de diálogo Configurações.
A configuração ``newConfig`` criada está disponível na lista drop-down Configuração da caixa de diálogo Inspecionar.
@@ -355,7 +355,7 @@
image::images/delete.png[]
-[start=5]
+
. Na caixa de diálogo Deletar Configuração, clique em Sim para confirmar a exclusão da configuração.
image::images/delete-confirm.png[]
@@ -389,7 +389,7 @@
--
-[start=4]
+
. Na caixa de diálogo Inspecionar, clique em Inspecionar para executar a análise de código-fonte.
Após a operação Inspecionar ser concluída, as dicas que podem ser aplicadas a seu código ou erros que foram encontradas são exibidas na janela Inspetor abaixo o Editor de Código-fonte.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ru.asciidoc
index f8635eb..ab5167e 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_ru.asciidoc
@@ -82,7 +82,7 @@
--
-[start=3]
+
. В диалоговом окне 'Программа установки' щелкните 'Далее', чтобы продолжить установку.
[.feature]
@@ -91,10 +91,10 @@
--
-[start=4]
+
. Прочтите лицензионное соглашение, выберите положение лицензионного соглашения и щелкните 'Установить'.
-[start=5]
+
. По завершении установки нажмите кнопку "Готово".
@@ -126,7 +126,7 @@
*Примечание.* Необходимо установить подключаемый модуль <<plugin,FindBugs>> для запуска этой конфигурации в первый раз.
-[start=4]
+
. Нажмите кнопку "Проверить".
Результаты анализа отображаются в окне 'Инспектор' в представлении дерева слева.
@@ -162,7 +162,7 @@
*Примечание.* Можно определить область (файлы. пакеты или проекты) для конфигурации ``Подсказки Java NetBeans`` .
-[start=3]
+
. Выберите переключатель 'Конфигурация' и выберите ``Подсказки Java NetBeans`` в раскрывающемся списке.
[.feature]
@@ -171,14 +171,14 @@
--
-[start=4]
+
. Нажмите кнопку "Проверить".
В среде IDE отображается представление дерева с результатами анализа с конфигурацией ``Подсказки Java NetBeans`` в окне 'Инспектор'.
image::images/hintsconfig.png[]
-[start=5]
+
. В окне 'Инспектор' нажмите кнопку <<categorize,Категоризировать>> на панели инструментов слева для просмотра проблем, сгруппированных в категории.
image::images/catview.png[]
@@ -213,7 +213,7 @@
*Примечание.* Можно проверить файлы, пакеты или проекты с помощью конфигурации ``FindBugs`` .
-[start=3]
+
. В диалоговом окне 'Проверка' выберите конфигурацию ``FindBugs`` .
[.feature]
@@ -222,7 +222,7 @@
--
-[start=4]
+
. Щелкните кнопку 'Инспектор' для запуска статического анализа кода.
Результат статического анализа кода отображается в окне 'Инспектор' ниже редактора исходного кода.
Описание выбранной проблемы отображается в фрейме справа.
@@ -233,7 +233,7 @@
--
-[start=5]
+
. В качестве альтернативы нажмите кнопку <<categorize,Категоризировать>> на панели инструментов слева для просмотра проблем, сгруппированных в категории.
image::images/fbcat.png[]
@@ -262,10 +262,10 @@
--
-[start=4]
+
. Выберите 'Выполнить FindBugs' в параметре 'Редактор'.
-[start=5]
+
. Нажмите кнопку "ОК".
Если сейчас нажать Alt-Enter в исходном коде, где сообщается о проблеме, и щелкнуть черную стрелку в конце отображаемой подсказки, в IDE показываются некоторые варианты исправления возможных проблем.
@@ -289,13 +289,13 @@
image::images/configurations-db.png[]
-[start=4]
+
. Убедитесь, что в раскрывающемся списке 'Конфигурация' выбрано ``По умолчанию`` .
-[start=5]
+
. В раскрывающемся списке 'Средство анализа' выберите средство анализа ``Соответствие профилей JRE 8`` , ``Подсказки Netbeans Java`` или ``FindBugs`` .
-[start=6]
+
. В зависимости от выбранного средства анализа в предыдущем шаге выберите профиль, проверки или ошибки, которые необходимо включить в конфигурацию ``по умолчанию`` .
[.feature]
@@ -304,7 +304,7 @@
--
-[start=7]
+
. Нажмите ОК, чтобы сохранить конфигурацию ``По умолчанию`` .
@@ -326,13 +326,13 @@
image::images/newconfig-created.png[]
-[start=5]
+
. В раскрывающемся списке 'Средство анализа' выберите ``Соответствие профилей JRE 8`` , ``Подсказки Netbeans Java`` или ``FindBugs`` .
-[start=6]
+
. Укажите профиль, проверки или ошибки для включения в вашу конфигурацию.
-[start=7]
+
. Нажмите ОК, чтобы сохранить правки и закрыть диалоговое окно 'Конфигурацию'.
Созданная конфигурация ``newConfig`` доступна в раскрывающемся списке 'Конфигурация' в диалоговом окне 'Инспектор'.
@@ -355,7 +355,7 @@
image::images/delete.png[]
-[start=5]
+
. В диалоговом окне 'Удалить конфигурацию' щелкните 'Да', чтобы подствердить удаление конфигурации.
image::images/delete-confirm.png[]
@@ -389,7 +389,7 @@
--
-[start=4]
+
. В диалоговом окне 'Проверка' щелкните 'Проверка', чтобы выполнить анализ исходного кода.
После завершения операции 'Проверка', подсказки, которые могут быть применены к коду или проблемам, которые были найдены, отображаются в окне 'Инспектор' ниже редактора исходного кода.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_zh_CN.asciidoc
index 3a2b203..f47c995 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/code-inspect_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/code-inspect_zh_CN.asciidoc
@@ -82,7 +82,7 @@
--
-[start=3]
+
. 在 "Installer"(安装程序)对话框中,单击 "Next"(下一步)以继续安装。
[.feature]
@@ -91,10 +91,10 @@
--
-[start=4]
+
. 查看许可证协议,选择许可证协议选项,然后单击 "Install"(安装)。
-[start=5]
+
. 安装完成后,单击 "Finish"(完成)。
@@ -126,7 +126,7 @@
*注:*首次运行此配置时,需要安装 <<plugin,FindBugs>> 插件。
-[start=4]
+
. 单击 "Inspect"(检查)。
分析的结果以树视图显示在 "Inspector"(检查器)窗口的左侧。
@@ -162,7 +162,7 @@
*注:*可以为 ``NetBeans Java Hints`` (NetBeans Java 提示)配置定义范围(文件、包或项目)。
-[start=3]
+
. 选择 "Configuration"(配置)单选按钮并在下拉列表中选择 ``NetBeans Java Hints`` (NetBeans Java 提示)。
[.feature]
@@ -171,14 +171,14 @@
--
-[start=4]
+
. 单击 "Inspect"(检查)。
IDE 显示树视图,使用 ``NetBeans Java Hints`` (NetBeans Java 提示)配置进行分析的结果显示在 "Inspector"(检查器)窗口中。
image::images/hintsconfig.png[]
-[start=5]
+
. 在 "Inspector"(检查器)窗口,在左侧的工具栏中单击 <<categorize,Categorize(分类)>>按钮可以按照类别分组查看问题。
image::images/catview.png[]
@@ -213,7 +213,7 @@
*注:*可以使用 ``FindBugs`` 配置检查文件、包或项目。
-[start=3]
+
. 在 "Inspect"(检查)对话框中,选择 ``FindBugs`` 配置。
[.feature]
@@ -222,7 +222,7 @@
--
-[start=4]
+
. 单击 "Inspect"(检查)按钮可启动静态代码分析。
静态代码分析的结果显示在源代码编辑器下的 "Inspector"(检查器)窗口中。
所选错误的说明将显示在右侧框架中。
@@ -233,7 +233,7 @@
--
-[start=5]
+
. 此外,在左侧的工具栏中单击 <<categorize,Categorize>>(分类)按钮可以按照类别分组查看错误。
image::images/fbcat.png[]
@@ -262,10 +262,10 @@
--
-[start=4]
+
. 在 "Editor"(编辑器)选项中选择 "Run FindBugs"(运行 FindBugs)。
-[start=5]
+
. 单击 "OK"(确定)。
现在,如果在源代码中报告了错误的位置按 Alt-Enter,并单击所显示提示结尾的指向右侧的黑色箭头,则 IDE 将针对潜在错误显示一些修复选项。
@@ -289,13 +289,13 @@
image::images/configurations-db.png[]
-[start=4]
+
. 确保在 "Configurations"(配置)下拉列表中选择了 ``Default`` (默认)。
-[start=5]
+
. 在 "Analyzer"(分析器)下拉列表中,选择 ``JRE 8 Profiles Conformance`` (JRE 8 配置文件一致性)、 ``Netbeans Java Hints`` (NetBeans Java 提示)或 ``FindBugs`` 分析器。
-[start=6]
+
. 根据在上一步选择的分析器,选择要验证的配置文件、需要在 ``Default`` (默认)配置中包含的检查或错误。
[.feature]
@@ -304,7 +304,7 @@
--
-[start=7]
+
. 单击 "OK"(确定)可保存 ``Default`` (默认)配置。
@@ -326,13 +326,13 @@
image::images/newconfig-created.png[]
-[start=5]
+
. 在 "Analyzer"(分析器)下拉列表中,选择 ``JRE 8 Profiles Conformance`` (JRE 8 配置文件一致性)、 ``Netbeans Java Hints`` (NetBeans Java 提示)或 ``FindBugs`` 。
-[start=6]
+
. 指定要包括到您自己的配置中的配置文件、检查或错误。
-[start=7]
+
. 单击 "OK"(确定)保存所做编辑并关闭 "Configurations"(配置)对话框。
此时所创建的 ``newConfig`` 配置在 "Inspect"(检查)对话框的 "Configuration"(配置)下拉列表中可用。
@@ -355,7 +355,7 @@
image::images/delete.png[]
-[start=5]
+
. 在 "Delete Configuration"(删除配置)对话框中,单击 "Yes"(是)以确认删除配置。
image::images/delete-confirm.png[]
@@ -389,7 +389,7 @@
--
-[start=4]
+
. 在 "Inspect"(检查)对话框中,单击 "Inspect"(检查)以执行源代码分析。
检查操作完成后,将在源代码编辑器下的 "Inspector"(检查器)窗口中显示可应用于找到的代码或错误的提示。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded.asciidoc
index bb18041..e3eadc2 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded.asciidoc
@@ -48,22 +48,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repository Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/java/debugging-samples*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
*Note.* For more about checking out sources with Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
@@ -83,14 +83,14 @@
When you click Open the IDE opens and displays the project in the Projects window. If you expand the project node in the Projects window you can see that the project is a simple Java Swing application.
-[start=4]
+
. Right-click the project node and choosing Run to launch the Gallery application.
-[start=5]
+
. In the Gallery application, click 'More' to add images and click 'Less' to remove images.
image::images/debugging-gallery-app.png[title="Gallery application"]
-[start=6]
+
. Close the Gallery application window.
The Gallery project is a simple multi-threaded application that you will debug in this tutorial.
@@ -105,7 +105,7 @@
When you click Open the IDE opens and displays the project in the Projects window. If you expand the project node in the Projects window you can see that the project is a simple Java application.
-[start=3]
+
. Right-click the project node and choosing Run to launch the Deadlock application.
When you click Run, the Output window opens and displays the following output.
@@ -120,7 +120,7 @@
MyThread1 successfully finished
----
-[start=4]
+
. Allow the application to end normally (five minutes).
When the Deadlock application ends you will see the following in the Output window.
@@ -147,14 +147,14 @@
When you click Debug, the IDE starts the Gallery application and opens the default debugging windows. The IDE automatically opens the Debugging window in the left side of the main window and opens the Debugger Console in the Output window.
-[start=2]
+
. Click 'More' three times in the Gallery application to start three threads displaying animated images.
If you look in the Debugging window you can see that a new thread was started for each animation.
image::images/debugging-start.png[title="Debugging window"]
-[start=3]
+
. Suspend two of the threads by clicking the 'Suspend thread' button to the right of the thread in the Debugging window.
When a thread is suspended, the icon for the thread changes to indicate the new state. You can expand the thread node to view the thread's call stack. You can right-click items in the Debugging window to open a pop-up menu with debug commands.
@@ -180,7 +180,7 @@
You can see that the Program Counter in the margin of the editor indicates your position as you step through the method.
-[start=6]
+
. Click 'More' in the Gallery application to start a new thread that will hit the method breakpoint.
When the new thread hits the method breakpoint a New Breakpoint Hit notification appears in the Debugging window that informs you that another thread hit a breakpoint while you were stepping through the method.
@@ -193,7 +193,7 @@
image::images/debugging-current-suspended.png[title="New Breakpoint Hit notification"]
-[start=7]
+
. Click the arrow in the New Breakpoint Hit notification to switch the current thread to the new thread (Thread_Roman).
When you switch to the new thread you can see the following:
@@ -202,10 +202,10 @@
* A 'suspended thread' annotation is now visible in the margin at line 191 indicating that a thread (Thread_Jirka) is suspended at that line.
image::images/debugging-editor-suspendedannot.png[title="Editor showing debugging annotations"]
-[start=8]
+
. Click Step Over a few times to step through the new current thread (Thread_Roman).
-[start=9]
+
. Right-click the 'suspended thread' annotation in the editor margin and choose Set as Current Thread > Thread_Jirka to switch back to the suspended thread.
image::images/debugging-editor-setcurrent.png[title="Editor showing Set as Current Thread pop-up"]
@@ -238,20 +238,20 @@
image::images/debug-deadlock-setbkpt.png[title="Editor showing breakpoint set at line 20"]
-[start=3]
+
. Right-click the Deadlock project in the Projects window and choose Debug.
The ``main`` method will run the two threads, and both threads will be suspended at one of the breakpoints. You can see the threads suspended by the breakpoints in the Debugging window.
-[start=4]
+
. In the Debugging Window, resume the suspended threads ( ``MyThread1`` and ``MyThread2`` ) by clicking the Resume buttons to the right of the suspended threads in the Debugging window.
image::images/debug-deadlock-resume.png[title="Resuming suspended threads in the Debugging window"]
Resuming the threads ``MyThread1`` and ``MyThread2`` will create the deadlock state.
-[start=5]
+
. Choose Debug\Check for Deadlock from the main menu to check the suspended threads for deadlocks.
image::images/debug-deadlock-detected.png[title="Resuming suspended threads in the Debugging window"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ja.asciidoc
index 106b96d..8ba4354 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ja.asciidoc
@@ -65,22 +65,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/java/debugging-samples*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
*注意:*Subversionを使用したソースのチェックアウトの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
@@ -102,14 +102,14 @@
「開く」をクリックすると、IDEによりプロジェクトが「プロジェクト」ウィンドウで開かれ、表示されます。「プロジェクト」ウィンドウでプロジェクト・ノードを展開すると、このプロジェクトが単純なJava Swingアプリケーションであることがわかります。
-[start=4]
+
. プロジェクト・ノードを右クリックし、「実行」を選択してGalleryアプリケーションを起動します。
-[start=5]
+
. Galleryアプリケーションで、「詳細表示」をクリックしてイメージを追加したり、「簡易表示」をクリックしてイメージを除去したりします。
image::images/debugging-gallery-app.png[title="Galleryアプリケーション"]
-[start=6]
+
. Galleryアプリケーションのウィンドウを閉じます。
Galleryプロジェクトは、このチュートリアルでデバッグする単純なマルチスレッド・アプリケーションです。
@@ -125,7 +125,7 @@
「開く」をクリックすると、IDEによりプロジェクトが「プロジェクト」ウィンドウで開かれ、表示されます。「プロジェクト」ウィンドウでプロジェクト・ノードを展開すると、このプロジェクトが単純なJavaアプリケーションであることがわかります。
-[start=3]
+
. プロジェクト・ノードを右クリックし、「実行」を選択してDeadlockアプリケーションを起動します。
「実行」をクリックすると、「出力」ウィンドウが開き、次の出力が表示されます。
@@ -140,7 +140,7 @@
MyThread1 successfully finished
----
-[start=4]
+
. アプリケーションが通常どおり終了するのを待ちます(5分)。
Deadlockアプリケーションが終了したら、次の内容が「出力」ウィンドウに表示されます。
@@ -169,14 +169,14 @@
「デバッグ」をクリックすると、IDEでGalleryアプリケーションが起動し、デフォルトのデバッグ用ウィンドウが表示されます。IDEによって、メイン・ウィンドウの左側に「デバッグ」ウィンドウが自動的に表示され、「出力」ウィンドウに「デバッガ・コンソール」が表示されます。
-[start=2]
+
. Galleryアプリケーションで「詳細表示」を3回クリックし、アニメーション・イメージを表示する3つのスレッドを開始します。
「デバッグ」ウィンドウでは、各アニメーションに対して新しいスレッドが開始されたことがわかります。
image::images/debugging-start.png[title="「デバッグ」ウィンドウ"]
-[start=3]
+
. 「デバッグ」ウィンドウのスレッドの右にある「スレッドを一時停止」ボタンをクリックして、スレッドのうち2つを一時停止します。
スレッドが一時停止されると、スレッドのアイコンが新しい状態に変わります。スレッド・ノードを展開してスレッドのコール・スタックを表示できます。デバッグ・コマンドを使用してポップアップ・メニューを開くには、「デバッグ」ウィンドウの項目を右クリックします。
@@ -203,7 +203,7 @@
エディタのマージンにある「プログラム・カウンタ」に、メソッドのステップ実行での位置が示されます。
-[start=6]
+
. Galleryアプリケーションで「詳細表示」をクリックして、メソッド・ブレークポイントをヒットする新しいスレッドを開始します。
新しいスレッドがメソッド・ブレークポイントをヒットすると、メソッドのステップ実行中に別のスレッドがブレークポイントをヒットしたことを通知する「新しいブレークポイントのヒット」通知が「デバッグ」ウィンドウに表示されます。
@@ -216,7 +216,7 @@
image::images/debugging-current-suspended.png[title="「新しいブレークポイントのヒット」通知"]
-[start=7]
+
. 「新しいブレークポイントのヒット」通知内の矢印をクリックして、現在のスレッドを新しいスレッド(Thread_Roman)に切り替えます。
新しいスレッドに切り替えるとき、次のことを確認できます。
@@ -225,10 +225,10 @@
* 191行目のマージンに一時停止しているスレッドを示す注釈が表示され、スレッド(Thread_Jirka)がその行で一時停止されていることを示します。
image::images/debugging-editor-suspendedannot.png[title="デバッグ注釈が表示されたエディタ"]
-[start=8]
+
. 「ステップ・オーバー」を何回かクリックして、新しい現在のスレッド(Thread_Roman)をステップ実行します。
-[start=9]
+
. 一時停止しているスレッドを示す注釈をエディタのマージンで右クリックし、「現在のスレッドとして設定」>「Thread_Jirka」を選択して、元の一時停止されたスレッドに切り替えます。
image::images/debugging-editor-setcurrent.png[title="「現在のスレッドとして設定」ポップアップが表示されたエディタ"]
@@ -262,20 +262,20 @@
image::images/debug-deadlock-setbkpt.png[title="20行目にブレークポイントが設定されていることを示すエディタ"]
-[start=3]
+
. 「プロジェクト」ウィンドウでDeadlockプロジェクトを右クリックし、「デバッグ」を選択します。
``main`` メソッドによって2つのスレッドが実行され、これらのスレッドは、ブレークポイントの1つで両方とも一時停止されます。「デバッグ」ウィンドウでは、スレッドがブレークポイントによって一時停止されたことがわかります。
-[start=4]
+
. 「デバッグ」ウィンドウで、「デバッグ」ウィンドウ内の一時停止されたスレッドの右にある「再開」ボタンをクリックすることによって、一時停止されたスレッド( ``MyThread1`` および ``MyThread2`` )を再開します。
image::images/debug-deadlock-resume.png[title="「デバッグ」ウィンドウでの一時停止されたスレッドの再開"]
``MyThread1`` スレッドおよび ``MyThread2`` スレッドを再開すると、デッドロックの状況が作成されます。
-[start=5]
+
. メイン・メニューから「デバッグ」-「デッドロックを確認」を選択して、一時停止されたスレッドにデッドロックがないかを確認します。
image::images/debug-deadlock-detected.png[title="「デバッグ」ウィンドウでの一時停止されたスレッドの再開"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_pt_BR.asciidoc
index f6f422f..47f2412 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_pt_BR.asciidoc
@@ -65,22 +65,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar Pastas do Repositório.
-[start=4]
+
. Expanda o nó raiz e selecione *samples/java/debugging-samples*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
*Observação.* Para saber mais sobre como efetuar check-out do Subversion, consulte a seção link:../ide/subversion.html#settingUp[+Configurando o Subversion+] no link:../ide/subversion.html[+Guia do Subversion no NetBeans IDE+].
@@ -102,14 +102,14 @@
Quando você clicar em Abrir, o IDE abrirá e exibirá o projeto na janela Projetos. Se você expandir o nó do projeto na janela Projetos, poderá observar que o projeto é uma aplicação Java Swing simples.
-[start=4]
+
. Clique com o botão direito do mouse no nó do projeto e escolha Executar para iniciar a aplicação Gallery.
-[start=5]
+
. Na aplicação Gallery, clique em 'Mais' para adicionar imagens e clique em 'Menos' para remover as imagens.
image::images/debugging-gallery-app.png[title="Aplicação Gallery"]
-[start=6]
+
. Feche a janela da aplicação Gallery.
O projeto Gallery é uma aplicação multithread simples que você irá depurar neste tutorial.
@@ -125,7 +125,7 @@
Quando você clicar em Abrir, o IDE abrirá e exibirá o projeto na janela Projetos. Se você expandir o nó do projeto na janela Projetos, observará que o projeto é uma aplicação Java simples.
-[start=3]
+
. Clique com o botão direito do mouse no nó do projeto e escolha Executar para iniciar a aplicação Deadlock.
Quando você clica em Executar, a janela de Saída abre e exibe a saída a seguir.
@@ -140,7 +140,7 @@
MyThread1 successfully finished
----
-[start=4]
+
. Permite que a aplicação seja finalizada normalmente (cinco minutos).
Quando a aplicação Deadlock for finalizada, será exibido o seguinte na janela de Saída.
@@ -169,14 +169,14 @@
Quando você clica em Depurar, o IDE inicia a aplicação Gallery e abre as janelas de depuração default. O IDE abre automaticamente a janela Depuração no lado esquerdo da janela principal e abre a Console do Depurador na janela de Saída.
-[start=2]
+
. Clique três vezes em "Mais" na aplicação Gallery para iniciar três threads que exibem imagens animadas.
Se você observar a janela Depuração, poderá verificar que um novo thread foi iniciado para cada animação.
image::images/debugging-start.png[title="Janela de Depuração"]
-[start=3]
+
. Suspenda dois threads clicando no botão "Suspender thread" à direita do thread, na janela Depuração.
Quando um thread é suspenso, o ícone do thread é alterado para indicar o novo estado. Você pode expandir o nó thread para exibir a pilha de chamadas do thread. Você pode clicar com o botão direito do mouse nos itens na janela Depuração para abrir um menu pop-up com os comandos de depuração.
@@ -203,7 +203,7 @@
Você observará que o Contador do Programa na margem do editor indica sua posição à medida que você avança passo a passo pelo método.
-[start=6]
+
. Clique em "Mais" na aplicação Gallery para iniciar um novo thread que atingirá o ponto de interrupção do método.
Quando o novo thread atingir o ponto de interrupção do método, uma notificação de Nova Ocorrência de Ponto de Interrupção atingida será exibida na janela Depuração, informando que outro thread atingiu um ponto de interrupção enquanto você avançava passo a passo pelo método.
@@ -216,7 +216,7 @@
image::images/debugging-current-suspended.png[title="Notificação de Nova Ocorrência de Ponto de Interrupção"]
-[start=7]
+
. Clique na seta, na notificação na notificação de Nova Ocorrência de Ponto de Interrupção atingida, para alternar o thread atual para o novo thread (Thread_Roman).
Quando alternar para o novo thread, você observará o seguinte:
@@ -225,10 +225,10 @@
* Uma anotação "thread suspenso" ficará visível na margem, na linha 191, indicando que um thread (Thread_Jirka) está suspenso nessa linha.
image::images/debugging-editor-suspendedannot.png[title="Editor que mostra as anotações de depuração"]
-[start=8]
+
. Clique em Fazer Step Over algumas vezes para avançar passo a passo pelo novo thread atual (Thread_Roman).
-[start=9]
+
. Clique com o botão direito do mouse na anotação "thread suspenso" na margem do editor e escolha Definir como Thread Atual > Thread_Jirka para voltar ao thread suspenso.
image::images/debugging-editor-setcurrent.png[title="Editor mostrando a pop-up Definir como Thread Atual"]
@@ -262,20 +262,20 @@
image::images/debug-deadlock-setbkpt.png[title="Editor que mostra o ponto de interrupção definido na linha 20"]
-[start=3]
+
. Clique com o botão direito do mouse no projeto Deadlock, na janela Projetos, e escolha Depurar.
O método ``main`` executará os dois threads e ambos serão suspensos em um dos pontos de interrupção. Você pode visualizar os threads suspensos pelos pontos de interrupção na janela Depuração.
-[start=4]
+
. Na janela Depuração, retome os threads suspensos ( ``MyThread1`` e ``MyThread2`` ) clicando nos botões Retomar à direita dos threads suspensos na janela Depuração.
image::images/debug-deadlock-resume.png[title="Retomando threads suspensos na janela Depuração"]
A retomada dos threads ``MyThread1`` e ``MyThread2`` criará o estado de deadlock.
-[start=5]
+
. Escolha Depurar\Verificar Deadlock no menu principal para verificar se há deadlock nos threads suspensos.
image::images/debug-deadlock-detected.png[title="Retomando threads suspensos na janela Depuração"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ru.asciidoc
index 063c739..0832a7b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_ru.asciidoc
@@ -65,22 +65,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку Browse ("Обзор") для открытия диалогового окна Browse Repository Folders ("Обзор папок репозитория").
-[start=4]
+
. Разверните корневой узел и выберите *samples/java/debugging-samples*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку 'Готово'.
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечание.* Дополнительные сведения об изъятии для использования источников с помощью Subversion см. в разделе link:../ide/subversion.html#settingUp[+Настройка Subversion+] в link:../ide/subversion.html[+Руководстве по Subversion в IDE NetBeans+].
@@ -102,14 +102,14 @@
При выборе "Open" в среде IDE проект будет открыт и выведен на экран в окне "Projects". После развертывания узла проекта в окне "Projects" видно, что он представляет собой простое приложение на Java для Swing.
-[start=4]
+
. Для запуска приложения "Gallery" щелкните правой кнопкой мыши узел проекта и выберите "Run".
-[start=5]
+
. В приложении "Gallery" нажмите кнопку "More" для добавления изображений и "Less" для удаления изображений.
image::images/debugging-gallery-app.png[title="Приложение "Gallery"."]
-[start=6]
+
. Закройте окно приложения "Gallery".
Проект Gallery представляет собой простое многопоточное приложение, процесс отладки которого описывается в данном руководстве.
@@ -125,7 +125,7 @@
При выборе "Open" в среде IDE проект будет открыт и выведен на экран в окне "Projects". После развертывания узла проекта в окне "Projects" видно, что он представляет собой простое приложение Java.
-[start=3]
+
. Для запуска приложения "Deadlock" щелкните правой кнопкой мыши узел проекта и выберите "Run".
При нажатии кнопки "Run" откроется окно "Output", в котором отображается следующая выходная информация.
@@ -140,7 +140,7 @@
MyThread1 successfully finished
----
-[start=4]
+
. Пусть приложение нормально завершит работу (пять минут).
По завершении работы приложения "Deadlock" в окне "Output" должна отображаться следующая информация.
@@ -169,14 +169,14 @@
После нажатия кнопки "Debug" в среде IDE запускается приложение "Gallery", и открываются окна отладки по умолчанию. Окно "Debugging" автоматически открывается в левой области главного окна, а окно "Debugger Console" – в окне "Output".
-[start=2]
+
. Трижды нажмите кнопку "More" в приложении "Gallery" для запуска трех потоков выполнения для воспроизведения анимированных изображений.
В окне "Debugging" отобразится процесс запуска новых потоков выполнения для каждой анимации.
image::images/debugging-start.png[title="Окно отладки"]
-[start=3]
+
. Приостановите два потока выполнения путем нажатия кнопки "Suspend thread" справа от каждого потока в окне "Debugging".
Если поток выполнения приостановлен, соответствующий значок изменится, отражая его новое состояние. Для просмотра стека вызовов потока выполнения можно развернуть узел этого потока. Щелкните правой кнопкой мыши элементы в окне 'Отладка', чтобы открыть всплывающее меню с командами отладки.
@@ -203,7 +203,7 @@
В счетчике строк кода в поле редактора отображается текущее положение в коде при пошаговом выполнении метода.
-[start=6]
+
. Нажмите кнопку "More" в приложении "Gallery" для запуска нового потока выполнения, который должен достичь точки останова.
Когда новый поток выполнения достигнет точки останова, установленной в методе, в окне "Debugging" появится уведомление "New Breakpoint Hit", информирующее о том, что еще один поток выполнения достиг точки останова в процессе последовательного выполнения метода.
@@ -216,7 +216,7 @@
image::images/debugging-current-suspended.png[title="Уведомление 'Достижение новой точки останова'"]
-[start=7]
+
. Для переключения между текущим потоком выполнения и новым потоком (Thread_Roman) в уведомлении "New Breakpoint Hit" нажмите кнопку со стрелкой.
После переключения на новый поток выполнения на экране можно увидеть следующее:
@@ -225,10 +225,10 @@
* В поле строки 191 появилась аннотация приостановки потока, указывающая на то, что поток выполнения (Thread_Jirka) приостановлен на этой строке.
image::images/debugging-editor-suspendedannot.png[title="Редактор, в котором отображаются аннотации отладки"]
-[start=8]
+
. Для пошагового выполнения нового текущего потока (Thread_Roman) несколько раз нажмите "Обход процедур".
-[start=9]
+
. Щелкните правой кнопкой мыши аннотацию приостановки потока в поле редактора и выберите "Set as Current Thread > Thread_Jirka" для обратного переключения на приостановленный поток.
image::images/debugging-editor-setcurrent.png[title="Редактор, в котором отображается всплывающее окно 'Задан как текущий поток'"]
@@ -262,20 +262,20 @@
image::images/debug-deadlock-setbkpt.png[title="В редакторе отображаются точки останова, заданные в строке 20"]
-[start=3]
+
. Щелкните правой кнопкой мыши проект "Deadlock" в окне "Projects" и выберите "Debug".
При вызове метода ``main`` будут запущены эти два потока выполнения, при этом оба потока будут приостановлены в одной из точек останова. Потоки, приостановленные в точках останова, можно просмотреть в окне "Debugging".
-[start=4]
+
. В окне "Debugging" возобновите приостановленные потоки выполнения ( ``MyThread1`` и ``MyThread2`` ) путем нажатия кнопки "Resume" справа от приостановленных потоков.
image::images/debug-deadlock-resume.png[title="Восстановление приостановленных потоков в окне "Отладка"."]
Возобновление потоков выполнения ``MyThread1`` и ``MyThread2`` приведет к возникновению ситуации взаимоблокировки.
-[start=5]
+
. Выберите в главном меню команду "Debug\Check for Deadlock" для проверки приостановленных потоков выполнения на наличие взаимоблокировок.
image::images/debug-deadlock-detected.png[title="Восстановление приостановленных потоков в окне "Отладка"."]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_zh_CN.asciidoc
index b9b3e43..3f07dfa 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-multithreaded_zh_CN.asciidoc
@@ -65,22 +65,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repository Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点,然后选择 *samples/java/debugging-samples*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
*注:*有关使用 Subversion 检出源的详细信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
@@ -102,14 +102,14 @@
单击 "Open"(打开)之后,IDE 将在 "Projects"(项目)窗口中打开并显示该项目。如果在 "Projects"(项目)窗口中展开该节点,您可以看到该项目是一个简单的 Java Swing 应用程序。
-[start=4]
+
. 右键单击该项目节点并选择 "Run"(运行)以启动 Gallery 应用程序。
-[start=5]
+
. 在 Gallery 应用程序中,单击 "More"(更多)可添加图像,单击 "Less"(更少)可删除图像。
image::images/debugging-gallery-app.png[title="Gallery 应用程序"]
-[start=6]
+
. 关闭 Gallery 应用程序窗口。
Gallery 项目是一个简单的多线程应用程序,在本教程中,您将对其进行调试。
@@ -125,7 +125,7 @@
单击 "Open"(打开)之后,IDE 将在 "Projects"(项目)窗口中打开并显示该项目。如果在 "Projects"(项目)窗口中展开该节点,您可以看到该项目是一个简单的 Java 应用程序。
-[start=3]
+
. 右键单击该项目节点并选择 "Run"(运行)以启动 Deadlock 应用程序。
单击 "Run"(运行)之后,"Output"(输出)窗口将打开并显示以下输出。
@@ -140,7 +140,7 @@
MyThread1 successfully finished
----
-[start=4]
+
. 等待应用程序正常结束(五分钟)。
当 Deadlock 应用程序结束时,您将在 "Output"(输出)窗口中看到以下内容。
@@ -169,14 +169,14 @@
单击 "Debug"(调试)之后,IDE 将启动 Gallery 应用程序并打开默认的调试窗口。IDE 会自动在主窗口的左侧打开 "Debugging"(调试)窗口,并在 "Output"(输出)窗口中打开调试器控制台。
-[start=2]
+
. 在 Gallery 应用程序中单击 "More"(更多)三次以启动显示动画图像的三个线程。
查看 "Debugging"(调试)窗口,您可看到为每个动画都启动了一个新线程。
image::images/debugging-start.png[title=""Debugging"(调试)窗口"]
-[start=3]
+
. 通过单击 "Debugging"(调试)窗口中线程右侧的 "'Suspend thread"(挂起线程)按钮挂起两个线程。
当线程挂起之后,该线程的图标会相应变化以指示新的状态。您可以展开线程节点查看线程的调用堆栈。您可以右键单击 "Debugging"(调试)窗口中的条目以打开一个带调试命令的弹出式菜单。
@@ -203,7 +203,7 @@
单步调试该方法时,您可以看到编辑器旁注中的程序计数器指示了您的位置。
-[start=6]
+
. 在 Gallery 应用程序中单击 "More"(更多)以启动一个将遇到该方法断点的新线程。
当新线程遇到方法断点时,"Debugging"(调试)窗口中会显示一个 "New Breakpoint Hit"(遇到新断点)通知,告诉您在单步调试该方法时另一个线程遇到了断点。
@@ -216,7 +216,7 @@
image::images/debugging-current-suspended.png[title="遇到新断点通知"]
-[start=7]
+
. 单击 "New Breakpoint Hit"(遇到新断点)通知中的箭头可从当前线程切换到新线程 (Thread_Roman)。
切换到新线程后,您可以看到以下变化:
@@ -225,10 +225,10 @@
* 现在,可以在第 191 行的旁注中看到一个 "suspended thread"(挂起的线程)标注,表示一个线程 (Thread_Jirka) 在该行挂起。
image::images/debugging-editor-suspendedannot.png[title="显示调试标注的编辑器"]
-[start=8]
+
. 多次单击 "Step Over"(步过)以单步调试新的当前线程 (Thread_Roman)。
-[start=9]
+
. 右键单击编辑器旁注中的 "suspended thread"(挂起的线程)标注并选择 "Set as Current Thread"(设置为当前线程)> "Thread_Jirka" 切换回挂起的线程。
image::images/debugging-editor-setcurrent.png[title="显示 "Set as Current Thread"(设置为当前线程)弹出窗口的编辑器"]
@@ -262,20 +262,20 @@
image::images/debug-deadlock-setbkpt.png[title="显示在第 20 行设置断点的编辑器"]
-[start=3]
+
. 在 "Projects"(项目)窗口中右键单击 Deadlock 项目,然后选择 "Debug"(调试)。
``main`` 方法将运行两个线程,这两个线程都将在其中一个断点处挂起。您可以在 "Debugging"(调试)窗口中看到由断点挂起的线程。
-[start=4]
+
. 在 "Debugging"(调试)窗口中,可以通过单击挂起的线程右侧的 "Resume"(恢复)按钮来恢复挂起的线程( ``MyThread1`` 和 ``MyThread2`` )。
image::images/debug-deadlock-resume.png[title="恢复 "Debugging"(调试)窗口中挂起的线程"]
恢复线程 ``MyThread1`` 和 ``MyThread2`` 将造成死锁状况。
-[start=5]
+
. 从主菜单中选择 "Debug\Check for Deadlock"(调试\检查死锁)可检查挂起的线程以查找死锁。
image::images/debug-deadlock-detected.png[title="恢复 "Debugging"(调试)窗口中挂起的线程"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc
index 9651673..e5cb3f5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc
@@ -69,13 +69,13 @@
image::images/debug-navigator.png[]
-[start=2]
+
. Right-click the Guess button in the snapshot and choose Go to Component Declaration from the popup menu. When you choose Go to Component Declaration, the IDE opens the source file in the editor and moves the cursor to the line in the code where ``guessButton`` is declared.
image::images/debug-gotodeclaration.png[]
-[start=3]
+
. Right-click the Guess button in the snapshot again and choose Go to Component Source. When you choose Go to Component Source, the IDE opens the source file in the editor and moves the cursor to the line in the source code for the JButton component.
image::images/debug-gotosource.png[]
@@ -102,16 +102,16 @@
image::images/debug-customlisteners.png[]
-[start=2]
+
. Right-click *com.toy.anagrams.ui.Anagrams$3* below the Custom Listeners node and choose Go to Component Source in the popup menu. The source code opens in the editor at the line where the listener is defined.
-[start=3]
+
. Select the empty text field in the snapshot. Alternatively, you can select the ``guessedWord`` text field in the Navigator window. When you select the text field, the items in the Events window will change automatically to display the listeners for the selected component.
-[start=4]
+
. In the Events window, double-click the Event Log node to open the Select Listener window. Alternatively, you can right-click the Event Log node and choose Set Logging Events from the popup menu.
-[start=5]
+
. Select the ``java.awt.event.KeyListener`` listener from the dialog. Click OK.
image::images/debug-select-listener.png[]
@@ -119,7 +119,7 @@
This listener is now listening for keyboard events in the text field.
-[start=6]
+
. In the Anagram Game application, type some characters in the text field. When you type a character in the text field, the event is recorded in the events log. If you expand the Event Log node you can see that each keystroke is now logged. New events appear each time that you type in the Anagram Game application text field. If you expand an individual event, for example ``keyPressed`` , you can see the properties of that event in the log.
image::images/debug-eventlog.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ja.asciidoc
index 7852728..aa97cab 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ja.asciidoc
@@ -61,7 +61,7 @@
「終了」をクリックすると、IDEがプロジェクトを作成し、そのプロジェクトが「プロジェクト」ウィンドウで開きます。
-[start=4]
+
. ツールバーの「デバッグ」ボタン([Ctrl]-[F5]、Macの場合は[⌘]-[F5])をクリックしてデバッグ・セッションを開始します。
または、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「デバッグ」を選択します。
@@ -71,7 +71,7 @@
デバッガの実行の詳細は、_NetBeans IDEによるアプリケーションの開発_のlink:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG798[+Javaアプリケーション・プロジェクトの実行およびデバッグ+]を参照してください。
-[start=5]
+
. メイン・メニューから「デバッグ」>「GUIスナップショットを作成」を選択します。
「GUIスナップショットを作成」を選択すると、IDEによってGUIのスナップショットが作成され、そのスナップショットがメイン・ウィンドウに表示されます。
@@ -105,14 +105,14 @@
image::images/debug-navigator.png[title="GUIスナップショット"]
-[start=2]
+
. スナップショット内の「Guess」ボタンを右クリックし、ポップアップ・メニューから「コンポーネント宣言へ移動」を選択します。
「コンポーネント宣言へ移動」を選択すると、IDEによってソース・ファイルがエディタに表示され、 ``guessButton`` が宣言されているコード内の行にカーソルが移動されます。
image::images/debug-gotodeclaration.png[title="コンポーネントが宣言されているコードの行"]
-[start=3]
+
. スナップショット内の「Guess」ボタンをもう一度右クリックし、「コンポーネント・ソースへ移動」を選択します。
「コンポーネント・ソースへ移動」を選択すると、IDEによってソース・ファイルがエディタに表示され、JButtonコンポーネントのソース・コード内の行にカーソルが移動されます。
@@ -127,19 +127,19 @@
*注意:*NetBeans IDE 7.1では、「オプション」ウィンドウの「Javaデバッガ」タブは「その他」カテゴリ内にあります。
-[start=3]
+
. カテゴリ・リストの「ビジュアル・デバッグ」を選択し、「*コンポーネント階層の変更箇所をトラック*」を選択します。「OK」をクリックします。
-[start=4]
+
. デバッグ・セッション(実行中の場合)を停止します。
*注意:*「オプション」ウィンドウでコマンドを有効にした後、「階層の追加へ移動」コマンドを使用できるようにするには、デバッグ・セッションを再起動して、新規のGUIスナップショットを取る必要があります。
-[start=5]
+
. 新規デバッグ・セッションを開始し、GUIスナップショットを作成します。
-[start=6]
+
. GUIスナップショット内のコンポーネントを右クリックし、「階層の追加へ移動」を選択します。
IDEによって、コンポーネントが追加されている行の部分のソース・コードがエディタに表示されます。
@@ -157,13 +157,13 @@
image::images/debug-customlisteners.png[title="コンポーネントがコンテナに追加されているソース・コードの行"]
-[start=2]
+
. 「カスタム・リスナー」ノードの下にある「*com.toy.anagrams.ui.Anagrams$3*」を右クリックし、ポップアップ・メニューで「コンポーネント・ソースへ移動」を選択します。
リスナーが定義されている行の部分のソース・コードがエディタに表示されます。
-[start=3]
+
. スナップショット内の空のテキスト・フィールドを選択します。
または、「ナビゲータ」ウィンドウで「 ``guessedWord`` 」テキスト・フィールドを選択できます。
@@ -171,20 +171,20 @@
このテキスト・フィールドを選択すると、「イベント」ウィンドウ内の項目が自動的に変更され、選択されたコンポーネントのリスナーが表示されます。
-[start=4]
+
. 「イベント」ウィンドウで、「イベント・ログ」ノードをダブルクリックして「リスナーを選択」ウィンドウを開きます。
または、「イベント・ログ」ノードを右クリックし、ポップアップ・メニューから「ロギング・イベントを設定」を選択できます。
-[start=5]
+
. ダイアログから「 ``java.awt.event.KeyListener`` 」リスナーを選択します。「OK」をクリックします。
image::images/debug-select-listener.png[title="コンポーネントがコンテナに追加されているソース・コードの行"]
このリスナーは現在、テキスト・フィールド内のキーボード・イベントを待機しています。
-[start=6]
+
. Anagram Gameアプリケーションで、テキスト・フィールドに何文字か入力します。
テキスト・フィールドに文字を入力すると、そのイベントがイベント・ログに記録されます。「イベント・ログ」ノードを展開すると、各キー・ストロークがログに記録されていることが確認できます。Anagram Gameアプリケーションのテキスト・フィールドに入力するたびに、新しいイベントが表示されます。個々のイベント(たとえば、 ``keyPressed`` )を展開すると、ログ内のそのイベントのプロパティが表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_pt_BR.asciidoc
index ebe8b2f..aa6857c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_pt_BR.asciidoc
@@ -61,7 +61,7 @@
Quando você clica em Finalizar, o IDE cria o projeto e o abre na janela Projetos.
-[start=4]
+
. Clique no botão Depurar na barra de ferramentas (Ctrl-F5; -F5 no Mac) para iniciar a sessão de depuração.
Alternativamente, clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Depurar.
@@ -71,7 +71,7 @@
Para obter mais informações sobre a execução do depurador, consulte link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG798[+Sobre Execução e Depuração de Projetos de Aplicação Java+] em _Desenvolvendo Aplicações com o NetBeans IDE_.
-[start=5]
+
. Escolha Depurar > Obter Snapshot da GUI no menu principal.
Quando você escolhe Obter um Snapshot da GUI, o IDE irá obter um snapshot da GUI e irá abrir o snapshot na janela principal.
@@ -105,14 +105,14 @@
image::images/debug-navigator.png[title="Snapshot GUI"]
-[start=2]
+
. Clique com o botão direito do mouse no botão Adivinhar no snapshot e escolha Ir para a Declaração do Componente no menu pop-up.
Quando você escolhe Ir para a Declaração do Componente, o IDE abre o arquivo de códigos-fonte no editor e move o cursor para a linha no código onde ``guessButton`` está declarado.
image::images/debug-gotodeclaration.png[title="Linha de código onde o componente é declarado"]
-[start=3]
+
. Clique novamente com o botão direito do mouse no botão Adivinhar no snapshot e escolha Ir para o Código-fonte do Componente.
Quando você escolhe Ir para o Código-fonte do Componente, o IDE abre o arquivo de códigos-fonte no editor e move o cursor para a linha no código para o componente JButton.
@@ -127,19 +127,19 @@
*Observação.* No NetBeans IDE 7.1, a guia Depurador Java está localizada na categoria Diversos na janela Opções.
-[start=3]
+
. Selecione Depuração Visual na lista de categorias e selecione *Rastrear as localizações das alterações de hierarquia do componente*. Clique em OK.
-[start=4]
+
. Interrompa sua sessão de depuração (se uma estiver em execução).
*Observação.* Após ativar o comando na janela Opções, você precisará reiniciar sua sessão de depuração e obter um novo snapshot GUI antes de usar o comando Ir Para a Adição de Hierarquia.
-[start=5]
+
. Inicie uma sessão de depuração e obtenha um snapshot da GUI.
-[start=6]
+
. Clique com o botão direito do mouse em um componente no snapshot da GUI e escolha Ir Para a Adição de Hierarquia.
O IDE irá abrir o código-fonte no editor na linha onde o componente está adicionado.
@@ -157,13 +157,13 @@
image::images/debug-customlisteners.png[title="Linha do código-fonte onde o componente é adicionado ao contêiner"]
-[start=2]
+
. Clique com o botão direito do mouse em *com.toy.anagrams.ui.Anagrams$3* abaixo do nó Listeners Personalizados e escolha Ir para o Código-fonte do Componente no menu pop-up.
O código-fonte é aberto no editor na linha onde o listener está definido.
-[start=3]
+
. Selecione o campo de texto vazio no snapshot.
Outra opção é selecionar o campo de texto ``guessedWord`` na janela Navegador.
@@ -171,20 +171,20 @@
Quando você selecionar o campo de texto, os itens na janela Eventos irá mudar automaticamente para exibir os listeners para o componente selecionado.
-[start=4]
+
. Na janela Eventos, clique duas vezes no nó Log de Eventos para abrir a janela Selecionar Listener.
Se preferir, clique com o botão direito do mouse no nó Log de Eventos e escolha Definir o Log de Eventos do menu pop-up.
-[start=5]
+
. Selecione o listener ``java.awt.event.KeyListener`` na caixa de diálogo. Clique em OK.
image::images/debug-select-listener.png[title="Linha do código-fonte onde o componente é adicionado ao contêiner"]
Este listener está agora fazendo listening para eventos de teclado no campo de texto.
-[start=6]
+
. Na aplicação Jogo de Anagramas, digite alguns caracteres no campo de texto.
Quando você digita um caractere no campo de texto, o evento é registrado no log de eventos. Caso você expanda o nó Log de Eventos, poderá ver que cada tecla pressionada está agora registrada. Novos eventos aparecem todas as vezes que você digita no campo de texto da aplicação Jogo de Anagramas. Se você expandir um evento individual, por exemplo ``keyPressed`` , poderá ver as propriedades daquele evento no log.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ru.asciidoc
index b9656c5..cb87d34 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_ru.asciidoc
@@ -61,7 +61,7 @@
При нажатии на кнопку 'Готово' IDE создает проект, который открывается в окне 'Проекты'.
-[start=4]
+
. Нажмите кнопку 'Отладка' на панели инструментов (Ctrl-F5; ⌘-F5 в Mac) для запуска сеанса отладки.
Также вы можете щелкнуть правой кнопкой мыши узел проекта в окне 'Проекты' и выбрав 'Отладка'.
@@ -71,7 +71,7 @@
Дополнительные сведения о работе с отладчиком см. в разделе link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG798[+Запуск и отладка проектов приложений Java+] в документе _Разработка приложений в IDE NetBeans_.
-[start=5]
+
. В главном меню выберите "Отладка" > "Сделать снимок графического интерфейса пользователя".
При выборе пункта "Сделать снимок графического интерфейса пользователя" среда IDE сделает моментальный снимок графического интерфейса пользователя и откроет снимок в главном окне.
@@ -105,14 +105,14 @@
image::images/debug-navigator.png[title="Снимок графического интерфейса пользователя"]
-[start=2]
+
. Щелкните кнопку "Определить" правой кнопкой мыши и во всплывающем меню выберите пункт "Перейти к объявлению компонента".
При выборе команды "Перейти к объявлению компонента" среда IDE открывает файл исходного кода в редакторе и перемещает курсор на ту строку в коде, в которой объявляется ``guessButton`` .
image::images/debug-gotodeclaration.png[title="Строка кода, в которой объявлен компонент"]
-[start=3]
+
. Щелкните кнопку "Определить" правой кнопкой мыши на моментальном снимке и выберите "Перейти к исходному коду компонента".
При выборе команды "Перейти к исходному коду компонента" среда IDE открывает файл исходного кода в редакторе и перемещает курсор на строку исходного кода компонента JButton.
@@ -127,19 +127,19 @@
*Примечание.* В NetBeans IDE 7.1 вкладка 'Отладчик' находится в категории 'Разное' в том же окне 'Параметры'.
-[start=3]
+
. В списке категорий выберите "Визуальная отладка", а затем выберите *Отслеживать местоположения изменений в иерархии компонентов*. Нажмите кнопку "ОК".
-[start=4]
+
. Остановите сеанс отладки (если он запущен).
*Примечание.* После включения команды 'Перейти к добавлению иерархии' в окне 'Параметры' потребуется начать сеанс отладки заново и сделать новый снимок графического интерфейса. После этого можно будет использовать команду.
-[start=5]
+
. Начните новый сеанс отладки и сделайте снимок графического интерфейса.
-[start=6]
+
. Щелкните компонент правой кнопкой мыши на моментальном снимке графического интерфейса пользователя и выберите "Перейти к добавлению иерархии".
Среда IDE откроет исходный код в редакторе на строке, в которой добавляется компонент.
@@ -157,13 +157,13 @@
image::images/debug-customlisteners.png[title="Строка исходного кода, в которой компонент добавлен в контейнер"]
-[start=2]
+
. Правой кнопкой мыши щелкните *com.toy.anagrams.ui.Anagrams$3* в узле "Особые прослушиватели" и во всплывающем выберите команду "Перейти к исходному тексту компонента".
Исходный код открывается в редакторе на той строке, в которой определяется прослушиватель.
-[start=3]
+
. Выберите пустое текстовое поле на снимке.
Также можно выбрать текстовое поле ``guessedWord`` в окне "Навигатор".
@@ -171,20 +171,20 @@
При выборе текстового поля элементы в окне "События" автоматически изменятся, и в окне будут отображены прослушиватели выбранного компонента.
-[start=4]
+
. В окне "События" дважды щелкните узел "Журнал событий". При этом откроется окно "Выбор прослушивателя".
Также можно щелкнуть правой кнопкой мыши узел Event Log и выбрать 'Задать события журналирования' во всплывающем меню.
-[start=5]
+
. В диалоге выберите прослушивающий процесс ``java.awt.event.KeyListener`` . Нажмите кнопку "ОК".
image::images/debug-select-listener.png[title="Строка исходного кода, в которой компонент добавлен в контейнер"]
Теперь прослушиватель прослушивает события клавиатуры в текстовом поле.
-[start=6]
+
. В приложении "Анаграммы" в текстовом поле введите несколько символов.
При вводе вами символа это событие записывается в журнал. Развернув узел "Журнал событий", вы увидите, что каждое нажатие клавиши записано. Новые события появляются при каждом вводе символов в текстовое поле игры "Анаграммы". Развернув отдельное событие, например ``keyPressed`` , вы увидите свойства этого события в журнале.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_zh_CN.asciidoc
index 88f3f8e..fd80222 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/debug-visual_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/debug-visual_zh_CN.asciidoc
@@ -61,7 +61,7 @@
单击 "Finish"(完成),此时 IDE 将创建项目并在 "Projects"(项目)窗口中打开该项目。
-[start=4]
+
. 单击工具栏中的“调试”按钮(Ctrl-F5 组合键;在 Mac 上为 ⌘-F5 组合键)以启动调试会话。
或者,在“项目”窗口中右键单击项目节点,然后选择“调试”。
@@ -71,7 +71,7 @@
有关运行调试器的更多信息,请参见_使用 NetBeans IDE 开发应用程序_中的link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG798[+关于运行和调试 Java 应用程序项目+]。
-[start=5]
+
. 从主菜单中选择“调试”>“生成 GUI 快照”。
选择“生成 GUI 快照”时,IDE 将生成 GUI 的快照,并在主窗口中打开该快照。
@@ -105,14 +105,14 @@
image::images/debug-navigator.png[title="GUI 快照"]
-[start=2]
+
. 在快照中右键单击 "Guess" 按钮,然后从弹出式菜单中选择“转至组件声明”。
选择 "Go to Component Declaration"(转至组件声明)时,IDE 将在编辑器中打开源文件,然后将光标移至代码中声明 ``guessButton`` 的行。
image::images/debug-gotodeclaration.png[title="声明组件的代码行"]
-[start=3]
+
. 在快照中再次右键单击 "Guess" 按钮,然后选择 "Go to Component Source"(转至组件源文件)。
选择 "Go to Component Source"(转至组件源文件)时,IDE 将在编辑器中打开源文件,然后将光标移至 JButton 组件源代码中的相应行。
@@ -127,19 +127,19 @@
*注:*在 NetBeans IDE 7.1 中,"Java Debugger"(Java 调试器)标签位于 "Options"(选项)窗口中的 "Miscellaneous"(其他)类别下。
-[start=3]
+
. 在类别列表中选择“可视调试”,然后选择*跟踪组件分层结构更改的位置*。单击 "OK"(确定)。
-[start=4]
+
. 停止调试会话(如果正在运行)。
*注:*在 "Options"(选项)窗口中启用此命令后,需要重新启动调试会话并生成新的 GUI 快照,然后才能使用 "Go to Hierarchy Addition"(转至分层结构其他源文件)命令。
-[start=5]
+
. 启动新的调试会话并生成 GUI 快照。
-[start=6]
+
. 在 GUI 快照中右键单击组件,然后选择“转至分层结构其他源文件”。
IDE 将在编辑器中添加组件的行上打开源代码。
@@ -157,13 +157,13 @@
image::images/debug-customlisteners.png[title="将组件添加到容器中的源代码行"]
-[start=2]
+
. 右键单击 "Custom Listeners"(定制监听程序)节点下方的 *com.toy.anagrams.ui.Anagrams$3*,然后在弹出式菜单中选择“转至组件源文件”。
源代码在编辑器中定义监听程序的行上打开。
-[start=3]
+
. 在快照中选择空文本字段。
此外,也可以在“导航器”窗口中选择 ``guessedWord`` 文本字段。
@@ -171,20 +171,20 @@
选择文本字段时,“事件”窗口中的项将会自动更改,以显示选定组件的监听程序。
-[start=4]
+
. 在“事件”窗口中,双击 "Event Log"(事件日志)节点打开 "Select Listener"(选择监听程序)窗口。
此外,也可以右键单击 "Event Log"(事件日志)节点,然后从弹出式菜单中选择 "Set Logging Events"(设置日志记录事件)。
-[start=5]
+
. 从对话框中选择 ``java.awt.event.KeyListener`` 监听程序。单击 "OK"(确定)。
image::images/debug-select-listener.png[title="将组件添加到容器中的源代码行"]
此监听程序现在正在监听文本字段中的键盘事件。
-[start=6]
+
. 在 Anagram Game 应用程序的文本字段中,键入一些字符。
在文本字段中键入字符时,将在事件日志中记录事件。如果展开 "Event Log"(事件日志)节点,您可以看到现在记录了每个击键。每次在 Anagram Game 应用程序文本字段中键入时,都会显示新事件。如果展开单个事件,例如 ``keyPressed`` ,日志中会显示该事件的属性。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform.asciidoc
index 119d0c3..12455f5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform.asciidoc
@@ -217,11 +217,11 @@
--
+
-[start=4]
+
. Click *Inspect*.
The suggested refactoring changes display in the preview panel.
-[start=5]
+
. Click *Do Refactoring* to apply the changes if required.
== Summary
diff --git a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ja.asciidoc
index 7447e25..0ef5e52 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ja.asciidoc
@@ -104,7 +104,7 @@
--
-[start=7]
+
. 必要に応じて、「リファクタリングを実行」をクリックして変更を適用します。
<<top,先頭>>
@@ -157,7 +157,7 @@
--
-[start=5]
+
. 必要に応じて、「リファクタリングを実行」をクリックして変更を適用します。
@@ -190,7 +190,7 @@
--
-[start=5]
+
. 「OK」をクリックして編集を保存します。
*デフォルトの「 ``インポートの編成`` 」構成を実行して適用するには:*
@@ -207,7 +207,7 @@
--
-[start=5]
+
. 必要に応じて、「リファクタリングを実行」をクリックして変更を適用します。
<<top,先頭>>
@@ -232,10 +232,10 @@
--
-[start=4]
+
. (オプション)「 ``検査`` 」を右クリックしてポップアップ・メニューから「名前変更」を選択し、カスタム検査に必要な名前(たとえば、 ``MyCustomInspection`` )を指定して、[Enter]を押します。
-[start=5]
+
. 「スクリプトの編集」をクリックします。「スクリプト」テキスト領域が表示されます。
[.feature]
@@ -244,7 +244,7 @@
--
-[start=6]
+
. 「スクリプト」テキスト領域に検査の説明とコードを入力するか、または「エディタで開く」をクリックし、 ``MyCustomInspection.hint`` ファイルで同じ内容を指定します。
[.feature]
@@ -253,10 +253,10 @@
--
-[start=7]
+
. 「スクリプト」テキスト領域の下にある「保存」をクリックするか、またはエディタで[Ctrl]-[S]を押して編集を保存します。
-[start=8]
+
. 「OK」をクリックして「検査の管理」ダイアログ・ボックスを閉じるか、またはエディタで ``MyCustomInspection.hint`` ファイルを閉じます。
カスタム検査が完成し、適用する準備ができました。
@@ -272,11 +272,11 @@
--
-[start=4]
+
. 「検査」をクリックします。
提案されたリファクタリングの変更がプレビュー・パネルに表示されます。
-[start=5]
+
. 必要に応じて、「リファクタリングを実行」をクリックして変更を適用します。
<<top,先頭>>
diff --git a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_pt_BR.asciidoc
index 92db8a4..40ad5d2 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_pt_BR.asciidoc
@@ -93,7 +93,7 @@
--
-[start=7]
+
. Clique em Efetuar a Refatoração para aplicar as alterações, se necessário.
<<top,início>>
@@ -146,7 +146,7 @@
--
-[start=5]
+
. Clique em Efetuar a Refatoração para aplicar as alterações, se necessário.
@@ -179,7 +179,7 @@
--
-[start=5]
+
. Clique em OK para salvar suas edições.
*Para executar e aplicar a configuração default ``Organizar Importações`` :*
@@ -196,7 +196,7 @@
--
-[start=5]
+
. Clique em Efetuar a Refatoração para aplicar as alterações, se necessário.
<<top,início>>
@@ -221,10 +221,10 @@
--
-[start=4]
+
. (Opcional) Clique com o botão direito do mouse em ``Inspecionar`` , escolha Renomear no menu pop-up, especifique o nome necessário para sua inspeção personalizada (por exemplo, ``MyCustomInspection`` ) e pressione Enter.
-[start=5]
+
. Clique em Editar Script. A área de texto Script é exibida.
[.feature]
@@ -233,7 +233,7 @@
--
-[start=6]
+
. Digite a descrição e o código da inspeção na área de texto Script ou clique em Abrir no Editor e especifique o mesmo no arquivo ``MyCustomInspection.hint`` .
[.feature]
@@ -242,10 +242,10 @@
--
-[start=7]
+
. Clique em Salvar abaixo da área de texto Script ou pressione Ctrl-S no Editor para salvar suas edições.
-[start=8]
+
. Clique em OK para fechar a caixa de diálogo Gerenciar Inspeções ou feche o arquivo ``MyCustomInspection.hint`` no Editor.
Sua inspeção personalizada está feita e pronta para ser aplicada.
@@ -261,11 +261,11 @@
--
-[start=4]
+
. Clique em Inspecionar.
As alterações de refatoração sugeridas são exibidas no painel de exibição.
-[start=5]
+
. Clique em Efetuar a Refatoração para aplicar as alterações, se necessário.
<<top,início>>
diff --git a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ru.asciidoc
index aab3677..2efadc0 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_ru.asciidoc
@@ -93,7 +93,7 @@
--
-[start=7]
+
. Нажмите кнопку "Реорганизовать код", чтобы применить изменения, если это необходимо.
<<top,В начало>>
@@ -146,7 +146,7 @@
--
-[start=5]
+
. Нажмите кнопку "Реорганизовать код", чтобы применить изменения, если это необходимо.
@@ -179,7 +179,7 @@
--
-[start=5]
+
. Нажмите кнопку "ОК", чтобы сохранить изменения.
*Чтобы запустить и применить настройку по умолчанию ``Упорядочение операторов импорта`` , выполните следующие действия.*
@@ -196,7 +196,7 @@
--
-[start=5]
+
. Нажмите кнопку "Реорганизовать код", чтобы применить изменения, если это необходимо.
<<top,В начало>>
@@ -221,10 +221,10 @@
--
-[start=4]
+
. (Дополнительно) Правой кнопкой мыши щелкните ``Проверка`` , выберите "Переименовать" в раскрывающемся меню, укажите имя пользовательской проверки (например, ``MyCustomInspection`` ), затем нажмите ENTER.
-[start=5]
+
. Нажмите кнопку "Правка сценария". Отобразится текстовое поле со сценарием.
[.feature]
@@ -233,7 +233,7 @@
--
-[start=6]
+
. Введите описание проверки и код в текстовую область сценария или нажмите кнопку "Открыть" в редакторе и укажите те же данные в файле ``MyCustomInspection.hint`` .
[.feature]
@@ -242,10 +242,10 @@
--
-[start=7]
+
. Чтобы сохранить изменения, нажмите кнопку "Сохранить" под текстовым полем со сценарием или нажмите сочетание клавиш CTRL+S в редакторе.
-[start=8]
+
. Нажмите кнопку "ОК", чтобы закрыть диалоговое окно "Управление проверками" или закройте файл ``MyCustomInspection.hint`` в редакторе.
Пользовательская проверка создана и может быть применена.
@@ -261,11 +261,11 @@
--
-[start=4]
+
. Нажмите кнопку "Проверить".
Предлагаемые изменения реорганизации отобразятся на панели предварительного просмотра.
-[start=5]
+
. Нажмите кнопку "Реорганизовать код", чтобы применить изменения, если это необходимо.
<<top,В начало>>
diff --git a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_zh_CN.asciidoc
index 146c322..eb509d2 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/editor-inspect-transform_zh_CN.asciidoc
@@ -93,7 +93,7 @@
--
-[start=7]
+
. 单击 "Do Refactoring"(执行重构)以应用所做的更改(如有必要)。
<<top,返回页首>>
@@ -146,7 +146,7 @@
--
-[start=5]
+
. 单击 "Do Refactoring"(执行重构)以应用所做的更改(如有必要)。
@@ -179,7 +179,7 @@
--
-[start=5]
+
. 单击 "OK"(确定)保存所做的编辑。
*运行并应用默认的 ``Organize Imports`` (组织导入)配置:*
@@ -196,7 +196,7 @@
--
-[start=5]
+
. 单击 "Do Refactoring"(执行重构)以应用所做的更改(如有必要)。
<<top,返回页首>>
@@ -221,10 +221,10 @@
--
-[start=4]
+
. (可选)右键单击 ``Inspection`` (检查),从弹出式菜单中选择 "Rename"(重命名),指定定制检查所需的名称(例如 ``MyCustomInspection`` ),然后按 Enter 键。
-[start=5]
+
. 单击 "Edit Script"(编缉脚本)。显示 "Script"(脚本)文本区域。
[.feature]
@@ -233,7 +233,7 @@
--
-[start=6]
+
. 在 "Script"(脚本)文本区域中键入检查描述和代码,或者在编辑器中单击 "Open"(打开),并在 ``MyCustomInspection.hint`` 文件中指定相同的内容。
[.feature]
@@ -242,10 +242,10 @@
--
-[start=7]
+
. 单击 "Script"(脚本)文本区域下方的 "Save"(保存),或在编辑器中按 Ctrl-S 组合键保存所做的编辑。
-[start=8]
+
. 单击 "OK"(确定)以关闭 "Manage Inspections"(管理检查)对话框,或在编辑器中关闭 ``MyCustomInspection.hint`` 文件。
您的定制检查已完成并准备进行应用。
@@ -261,11 +261,11 @@
--
-[start=4]
+
. 单击 "Inspect"(检查)。
建议的重构更改显示在预览面板中。
-[start=5]
+
. 单击 "Do Refactoring"(执行重构)以应用所做的更改(如有必要)。
<<top,返回页首>>
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced.asciidoc
index 16151cc..0a489cb 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced.asciidoc
@@ -64,7 +64,7 @@
NOTE: The ``GridBagCustomizerAdvancedTutorial`` project uses the ``JUnit`` and ``JUnit 4`` class libraries, which are located in the Update Center. You need to click Resolve Problems in the Open project dialog box, then click Resolve in the Resolve Reference Problems dialog box and install the JUnit plugin following the instructions in the NetBeans IDE Installer. When the installation is completed, click Finish to close the NetBeans IDE Installer dialog box, then click Close to close the Resolve Reference Problems dialog box.
-[start=3]
+
. Expand ``Source Packages > tutorial`` and double-click ``ContactsAdvancedInitial.java`` .
The sample form opens in the GUI Builder Design view.
@@ -129,10 +129,10 @@
Highlighted ``JLabel1`` displays in the first cell.
-[start=3]
+
. Right-click the second cell of the newly added row.
-[start=4]
+
. From the context menu, choose ``Add Components > Swing Controls > Text Field`` .
Highlighted ``JTextField1`` displays in the second cell.
@@ -168,8 +168,8 @@
To remove the ``JTextField1`` component's text, complete the following steps:
-1. In the Design view, select the ``JTextField1`` component and press F2 (alternatively, select Edit Text from the context menu).
-2. Delete the selected text and press Enter.
+. In the Design view, select the ``JTextField1`` component and press F2 (alternatively, select Edit Text from the context menu).
+. Delete the selected text and press Enter.
=== Reorganizing Layout
@@ -187,13 +187,13 @@
The GridBag Customizer can resize several components together thus making room for the second column of text fields.
-[start=4]
+
. Click outside the form to deselect the resized text fields.
-[start=5]
+
. Control-click to select all the ``Skype:`` and ``Home Phone:`` ``JLabel`` and ``JTextField`` components in the ``Phone`` section.
-[start=6]
+
. Position the cursor over the selection and drag them to the right of the top two text fields.
image::images/movesecondcolumn.png[]
@@ -216,7 +216,7 @@
2. Click the browse button (image::images/browsebutton.png[]) to the right of the ``Insets`` text field.
The ``Insets`` dialog box displays.
-[start=3]
+
. Enter ``5`` in the ``Left:`` text field, and click OK.
@@ -291,7 +291,7 @@
--
-[start=3]
+
. Right-click the second column header and choose ``Insert Column After`` from the context menu.
An empty cell for the new button displays.
@@ -301,7 +301,7 @@
--
-[start=4]
+
. Right-click inside the newly created cell and choose ``Add Component`` > ``Swing Controls`` > ``Button`` from the context menu.
A new ``jButton1`` button is added.
@@ -311,13 +311,13 @@
--
-[start=5]
+
. Click the Baseline-Related Anchor button (image::images/baselineanchor.png[]) in the Property Customizer to align the new button with the two existing ones in the row.
-[start=6]
+
. Click the browse button (image::images/browsebutton.png[]) to the right of the Insets text field. The Insets dialog box displays. Enter 5 in the Top: text field, and click OK.
-[start=7]
+
. To check how the main container layout looks now, right-click the designed subcontainer and choose ``Design Parent Container`` from the context menu.
image::images/designparentcontainer.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ja.asciidoc
index 2b5aa17..60a3613 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ja.asciidoc
@@ -73,7 +73,7 @@
*注意:* ``GridBagCustomizerAdvancedTutorial`` プロジェクトでは、更新センターから入手できる ``JUnit`` と ``JUnit 4`` クラス・ライブラリを使用します。「プロジェクトを開く」ダイアログ・ボックスで「問題を解決」をクリックし、次に「参照の問題を解決」ダイアログ・ボックスで「解決」をクリックし、NetBeans IDEのインストーラの指示に従ってJUnitプラグインをインストールする必要がありますインストールが完了したら、「終了」をクリックして「NetBeans IDEのインストーラ」ダイアログ・ボックスを閉じ、「閉じる」をクリックして「参照の問題を解決」ダイアログ・ボックスを閉じます。
-[start=3]
+
. ``「ソース・パッケージ」>「tutorial」`` を展開し、 ``ContactsAdvancedInitial.java`` をダブルクリックします。
サンプル・フォームがGUIビルダーの「デザイン」ビューで開きます。
@@ -138,10 +138,10 @@
強調表示された ``JLabel1`` が最初のセルに表示されます。
-[start=3]
+
. 新しく追加された行の2つ目のセルを右クリックします。
-[start=4]
+
. コンテキスト・メニューから ``「コンポーネントを追加」>「Swingコントロール」>「テキスト・フィールド」`` を選択します。
強調表示された ``JTextField1`` が2つ目のセルに表示されます。
@@ -177,9 +177,9 @@
``JTextField1`` コンポーネントのテキストを除去するには、次の手順を行います:
-[start=1]
-1. 「デザイン」ビューで、 ``JTextField1`` コンポーネントを選択し、[F2]を押します(または、コンテキスト・メニューから「テキストを編集」を選択します)。
-2. 選択されているテキストを削除し、[Enter]を押します。
+
+. 「デザイン」ビューで、 ``JTextField1`` コンポーネントを選択し、[F2]を押します(または、コンテキスト・メニューから「テキストを編集」を選択します)。
+. 選択されているテキストを削除し、[Enter]を押します。
=== レイアウトの再配置
@@ -197,13 +197,13 @@
GridBagカスタマイザは複数のコンポーネントのサイズをまとめて変更でき、それによって、テキスト・フィールドの2番目の列の領域が確保されます。
-[start=4]
+
. フォームの外側をクリックして、サイズが変更されたテキスト・フィールドの選択を解除します。
-[start=5]
+
. 「 ``Phone`` 」セクション内の「 ``Skype:`` 」と「 ``Home Phone:`` 」の ``JLabel`` と ``JTextField`` コンポーネントを[Ctrl]を押しながらクリックしてすべて選択します。
-[start=6]
+
. 選択範囲の上にカーソルを置き、上の2つのテキスト・フィールドの右にドラッグします。
image::images/movesecondcolumn.png[]
@@ -226,7 +226,7 @@
2. 「 ``インセット`` 」テキスト・フィールドの右にある「参照」ボタン(image::images/browsebutton.png[])をクリックします。
「 ``インセット`` 」ダイアログ・ボックスが表示されます。
-[start=3]
+
. 「 ``左:`` 」テキスト・フィールドに「 ``5`` 」と入力し、「OK」をクリックします。
@@ -301,7 +301,7 @@
--
-[start=3]
+
. 2番目の列ヘッダーを右クリックし、コンテキスト・メニューから「 ``列を後ろに挿入`` 」を選択します。
新しいボタンのための空のセルが表示されます。
@@ -311,7 +311,7 @@
--
-[start=4]
+
. 新しく作成されたセルの内部を右クリックし、コンテキスト・メニューから「 ``コンポーネントを追加`` 」>「 ``Swingコントロール`` 」>「 ``ボタン`` 」を選択します。
新しい「 ``jButton1`` 」ボタンが追加されます。
@@ -321,13 +321,13 @@
--
-[start=5]
+
. プロパティ・カスタマイザで「ベースライン関連のアンカー」ボタン(image::images/baselineanchor.png[])をクリックし、新しいボタンをこの行にある2つの既存のボタンにそろえます。
-[start=6]
+
. 「インセット」テキスト・フィールドの右にある「参照」ボタン(image::images/browsebutton.png[])をクリックします。「インセット」ダイアログ・ボックスが表示されます。「上:」テキスト・フィールドに「5」と入力し、「OK」をクリックします。
-[start=7]
+
. メイン・コンテナの現在のレイアウトの外観を確認するには、デザインされたサブコンテナを右クリックし、コンテキスト・メニューから「 ``親コンテナをデザイン`` 」を選択します。
image::images/designparentcontainer.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_pt_BR.asciidoc
index 7cfd561..75c9bbc 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_pt_BR.asciidoc
@@ -73,7 +73,7 @@
*Observação:* o projeto ``GridBagCustomizerAdvancedTutorial`` usa as bibliotecas de classe ``Junit`` e ``JUnit 4`` , que estão localizadas na Central de Atualização. Você precisa clicar em Resolver Problemas na caixa de diálogo Abrir projeto, em seguida, clique em Resolver na caixa de diálogo Resolver Problemas de referência e instale o plug-in JUnit seguindo as instruções no Instalador NetBeans IDE. Quando a instalação for concluída, clique em Finalizar para fechar a caixa de diálogo do Instalador do NetBeans IDE e, em seguida, clique em Fechar para fechar a caixa de diálogo Resolver Problemas de Referência.
-[start=3]
+
. Expanda ``Pacotes de Código-fonte > tutorial`` e clique duas vezes em ``ContactsAdvancedInitial.java`` .
O form de exemplo é aberto na view Design do GUI Builder.
@@ -138,10 +138,10 @@
O ``JLabel1`` realçado é exibido na primeira célula.
-[start=3]
+
. Clique com o botão direito do mouse na segunda célula da linha recém-adicionada.
-[start=4]
+
. No menu de contexto, escolha ``Adicionar Componentes > Controle do Swing >Campo de Texto`` .
O ``JTextField1`` realçado é exibido na segunda célula.
@@ -177,8 +177,8 @@
Para remover o texto do componente ``JTextField1`` , conclua as seguintes etapas:
-1. Na view Design, selecione o componente ``JTextField1`` e pressione F2 (alternativamente, selecione Editar Texto no menu de contexto).
-2. Delete o texto selecionado e pressione Enter.
+. Na view Design, selecione o componente ``JTextField1`` e pressione F2 (alternativamente, selecione Editar Texto no menu de contexto).
+. Delete o texto selecionado e pressione Enter.
=== Reorganizando o Layout
@@ -196,13 +196,13 @@
O GridBag Customizer pode redimensionar diversos componentes juntos, portanto, criando espaço para a segunda coluna de campos de texto.
-[start=4]
+
. Clique fora do form para cancelar a seleção dos campos de texto redimensionados.
-[start=5]
+
. Pressione Ctrl e clique para selecionar todos os ``Skype:`` e ``Telefone Residencial:`` dos componentes ``JLabel`` e ``JTextField`` na seção ``Telefone`` .
-[start=6]
+
. Posicione o cursor sobre a seleção e arraste-o para a direita dos dois campos superiores de texto.
image::images/movesecondcolumn.png[]
@@ -225,7 +225,7 @@
2. Clique no botão Procurar (image::images/browsebutton.png[]) à direita do campo de texto ``Insets`` .
A caixa de diálogo ``Insets`` é exibida.
-[start=3]
+
. Insira ``5`` no campo de texto ``Esquerda:`` e clique em OK.
@@ -301,7 +301,7 @@
--
-[start=3]
+
. Clique com o botão direito do mouse no cabeçalho da segunda coluna e escolha ``Inserir Coluna Após`` a partir do menu de contexto.
Uma célula vazia para o novo botão é exibida.
@@ -311,7 +311,7 @@
--
-[start=4]
+
. Clique com o botão direito do mouse na célula recém-criada e escolha ``Adicionar Componente`` > ``Controles do Swing`` > ``Botão`` a partir do menu de contexto.
Um novo botão ``jButton1`` é adicionado.
@@ -321,13 +321,13 @@
--
-[start=5]
+
. Clique no botão de Âncora Relacionado à Linha de Base (image::images/baselineanchor.png[]) no Personalizador de Propriedades para alinhar o botão Novo com os dois existentes na linha.
-[start=6]
+
. Clique no botão Procurar (image::images/browsebutton.png[]) à direita do campo de texto Insets. A caixa de diálogo Insets é exibida. Insira 5 no campo de texto Superior: e clique em OK.
-[start=7]
+
. Para verificar a aparência do contêiner principal, clique com o botão direito do mouse no subcontêiner desenhado e escolha ``Criar Contêiner Pai`` no menu de contexto.
image::images/designparentcontainer.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ru.asciidoc
index 9c1a9c2..ae44379 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_ru.asciidoc
@@ -73,7 +73,7 @@
*Примечание.* В проекте ``GridBagCustomizerAdvancedTutorial`` используются библиотеки классов ``JUnit`` и ``JUnit 4`` , которые можно найти в центре обновлений. Необходимо щелкнуть 'Решить проблемы' в диалоговом окне 'Открыть проект', затем щелкните 'Решить' в диалоговом окне 'решить проблемы ссылок' и установить подключаемый модуль в соответствии с инструкциями в установщике IDE NetBeans. После завершения установки нажмите 'Готово', чтобы закрыть диалоговое окно установщика IDE NetBeans, затем нажмите 'Закрыть', чтобы закрыть диалоговое окно 'Разрешение проблем ссылок'.
-[start=3]
+
. Разверните ``Пакеты исходного кода`` > учебное руководство и дважды щелкните ``ContactsAdvancedInitial.java`` .
В конструкторе графического интерфейса откроется образец формы в режиме конструктора.
@@ -138,10 +138,10 @@
Выделенное ``JLabel1`` отображается в первой ячейке.
-[start=3]
+
. Щелкните правой кнопкой мыши первую ячейку добавленной строки.
-[start=4]
+
. В контекстном меню выберите ``Add Components ("Добавление компонентов") > Swing Controls ("Элементы управления Swing") > Text Field ("Текстовое поле")`` .
Выделенное поле ``JTextField1`` отображается во второй ячейке.
@@ -177,8 +177,8 @@
Чтобы удалить текст компонента ``JTextField1`` , выполните следующие действия:
-1. В представлении Design ("Проект") выберите ``JTextField1`` и нажмите клавишу F2 (либо выберите Edit Text ("Изменить текст") из контекстного меню).
-2. Удалите выбранный текст и нажмите ENTER.
+. В представлении Design ("Проект") выберите ``JTextField1`` и нажмите клавишу F2 (либо выберите Edit Text ("Изменить текст") из контекстного меню).
+. Удалите выбранный текст и нажмите ENTER.
=== Реорганизация компоновки
@@ -196,13 +196,13 @@
Настройщик GridBag может изменить размер нескольких компонентов одновременно, тем самым давая место для второго столбца текстовых полей.
-[start=4]
+
. Щелкните вне формы, чтобы отменить выбор текстовых полей, размер которых был изменен.
-[start=5]
+
. Удерживая клавишу CTRL, щелкните компоненты ``Skype:`` , ``Home Phone:`` , ``JLabel`` и ``JTextField`` в разделе ``Phone`` , чтобы выбрать их.
-[start=6]
+
. Наведите курсор на выбранные компоненты и перетащите их направо от двух верхних текстовых полей.
image::images/movesecondcolumn.png[]
@@ -225,7 +225,7 @@
2. Нажмите кнопку обзора (image::images/browsebutton.png[]) справа от текстового поля ``Вставки`` .
Отобразится диалоговое окно ``Insets`` ("Вставки").
-[start=3]
+
. Введите ``5`` в текстовое поле ``Left:`` ("Лево:") и нажмите кнопку "OК".
@@ -300,7 +300,7 @@
--
-[start=3]
+
. Щелкните правой кнопкой мыши второй заголовок столбца и выберите ``Insert Column After`` ("Вставить столбец после") из контекстного меню.
Отобразится пустая ячейка для новой кнопки.
@@ -310,7 +310,7 @@
--
-[start=4]
+
. Щелкните созданную ячейку правой кнопкой мыши и выберите ``Add Component`` ("Добавить компонент") > ``Swing Controls`` ("Элементы управления Swing") > ``Button`` ("Кнопка") из контекстного меню.
Будет добавлена новая кнопка ``jButton1`` .
@@ -320,13 +320,13 @@
--
-[start=5]
+
. Нажмите кнопку привязки, связанной с базовой линией, (image::images/baselineanchor.png[]) в 'Средстве настройки свойств' для выравнивания новой кнопки с двумя существующими в строке.
-[start=6]
+
. Нажмите кнопку обзора (image::images/browsebutton.png[]) справа от текстового поля 'Вставки'. Отобразится диалоговое окно "Вставки". Введите 5 в текстовое поле 'Вверх' и нажмите OK.
-[start=7]
+
. Чтобы проверить, как основной макет контейнера выглядит сейчас, щелкните правой кнопкой мыши разработанный вложенный контейнер и выберите в контекстном меню ``Конструировать родительский контейнер`` .
image::images/designparentcontainer.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_zh_CN.asciidoc
index 8131095..7086fa3 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-advanced_zh_CN.asciidoc
@@ -73,7 +73,7 @@
*注:* ``GridBagCustomizerAdvancedTutorial`` 项目使用 ``JUnit`` 和 ``JUnit 4`` 类库,这些库位于更新中心内。需要在 "Open project"(打开项目)对话框中单击 "Resolve Problems"(解决问题),然后在 "Resolve Reference Problems"(解决引用问题)对话框中单击 "Resolve"(解决),并按照 NetBeans IDE 安装程序中的说明安装 JUnit 插件。安装完成后,单击 "Finish"(完成)以关闭 "NetBeans IDE Installer"(NetBeans IDE 安装程序)对话框,然后单击 "Close"(关闭)以关闭 "Resolve Reference Problems"(解决引用问题)对话框。
-[start=3]
+
. 展开 ``源包 > tutorial`` ,然后双击 ``ContactsAdvancedInitial.java`` 。
此时将在 GUI 构建器的 "Design"(设计)视图中打开样例窗体。
@@ -138,10 +138,10 @@
此时将在第一个单元格中突出显示 ``JLabel1`` 。
-[start=3]
+
. 右键单击新添加的行的第二个单元格。
-[start=4]
+
. 从上下文菜单中,选择 ``"Add Components"(添加组件)> "Swing Controls"(Swing 控件)> "Text Field"(文本字段)`` 。
此时将在第二个单元格中突出显示 ``JTextField1`` 。
@@ -177,8 +177,8 @@
要删除 ``JTextField1`` 组件的文本,请完成以下步骤:
-1. 在 "Design"(设计)视图中,选择 ``JTextField1`` 组件,然后按 F2 键(或者,从上下文菜单中选择 "Edit Text"(编辑文本))。
-2. 删除选定的文本,然后按 Enter 键。
+. 在 "Design"(设计)视图中,选择 ``JTextField1`` 组件,然后按 F2 键(或者,从上下文菜单中选择 "Edit Text"(编辑文本))。
+. 删除选定的文本,然后按 Enter 键。
=== 重新组织布局
@@ -196,13 +196,13 @@
GridBag 定制器可以同时调整几个组件的大小,从而为文本字段的第二列腾出空间。
-[start=4]
+
. 在窗体外部单击以取消选择调整了大小的文本字段。
-[start=5]
+
. 按住 Ctrl 键单击以选择 ``Phone`` 部分的所有 ``Skype:`` 、 ``Home Phone:`` ``JLabel`` 和 ``JTextField`` 组件。
-[start=6]
+
. 将光标放在所选组件上,然后将其拖至上面两个文本字段的右侧。
image::images/movesecondcolumn.png[]
@@ -225,7 +225,7 @@
2. 单击 ``Insets`` (插入量)文本字段右侧的浏览按钮 (image::images/browsebutton.png[])。
此时将显示 ``Insets`` (插入量)对话框。
-[start=3]
+
. 在 ``Left:`` (左侧:)文本字段中输入 ``5`` ,然后单击 "OK"(确定)。
@@ -300,7 +300,7 @@
--
-[start=3]
+
. 右键单击第二列的标题,然后从上下文菜单中选择 ``Insert Column After`` (在后面插入列)。
此时将显示新按钮的空单元格。
@@ -310,7 +310,7 @@
--
-[start=4]
+
. 在新创建的单元格内右键单击,然后从上下文菜单中选择 ``Add Component`` (添加组件)> ``Swing Controls`` (Swing 控件)> ``Button`` (按钮)。
此时将添加一个新的 ``jButton1`` 按钮。
@@ -320,13 +320,13 @@
--
-[start=5]
+
. 单击属性定制器中的 "Baseline-Related Anchor"(与基线相关的锚点)按钮 (image::images/baselineanchor.png[]),将新按钮与行中的两个现有按钮对齐。
-[start=6]
+
. 单击 "Insets"(插入量)文本字段右侧的浏览按钮 (image::images/browsebutton.png[])。此时将显示 "Insets"(插入量)对话框。在 "Top:"(上:)文本字段中输入 5,然后单击 "OK"(确定)。
-[start=7]
+
. 要立即查看主容器布局的外观,请右键单击设计的子容器,然后从上下文菜单中选择 ``Design Parent Container`` (设计父容器)。
image::images/designparentcontainer.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic.asciidoc
index 15f7f01..bc95a1d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic.asciidoc
@@ -229,7 +229,7 @@
image::images/multiselect.png[]
-[start=2]
+
. Change the ``Anchor`` layout constraint of the labels to ``Line Start`` .
The labels are anchored to the left.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ja.asciidoc
index fa86f5b3..35c98e5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ja.asciidoc
@@ -239,7 +239,7 @@
image::images/multiselect.png[]
-[start=2]
+
. これらのラベルの「 ``アンカー`` 」レイアウト制約を「 ``行の始め`` 」に変更します。
これらのラベルが左側に固定されました。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_pt_BR.asciidoc
index 20e85e1..a592377 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_pt_BR.asciidoc
@@ -239,7 +239,7 @@
image::images/multiselect.png[]
-[start=2]
+
. Altere a restrição do layout ``Âncora`` dos labels para ``Início da Linha`` .
Os labels são ancorados na esquerda.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ru.asciidoc
index d914e85..e2a89fe 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_ru.asciidoc
@@ -239,7 +239,7 @@
image::images/multiselect.png[]
-[start=2]
+
. Измените ограничение компоновки ``Anchor`` ("Привязка") меток на ``Line Start`` ("Начало строки").
Метки выровняются по левой стороне.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_zh_CN.asciidoc
index a3d643d..6908877 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gbcustomizer-basic_zh_CN.asciidoc
@@ -239,7 +239,7 @@
image::images/multiselect.png[]
-[start=2]
+
. 将标签的 ``锚点`` 布局约束更改为 ``行首`` 。
标签将锚定到左侧。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart.asciidoc
index efccab2..2dec647 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart.asciidoc
@@ -54,10 +54,10 @@
-[start=3]
+
. Type *DisplayJFrame* as the Class Name.
-[start=4]
+
. Type *org.demo* as the Package. Click Finish.
image::images/groovy-newjframe2.png[]
@@ -66,20 +66,20 @@
-[start=5]
+
. Right-click the project node in the Projects window and choose New > Other to open the New File dialog box.
-[start=6]
+
. Select Groovy Class in the Groovy category. Click Next.
image::images/groovy-newgroovyclass.png[]
-[start=7]
+
. Type *GreetingProvider* as the Class Name.
-[start=8]
+
. Select the ``org.demo`` package from the Package dropdown list. Click Finish.
When you click Finish the IDE creates the Groovy file and opens the file in the editor.
@@ -104,17 +104,17 @@
----
-[start=3]
+
. Open ``DisplayJFrame.java`` in the editor (if not already open) and click the Design tab.
-[start=4]
+
. Open the Palette (Window > Palette from the main menu) and drag and drop a Text Field element ( ``jTextField`` ) from the Palette and into the JFrame.
image::images/groovy-jtextfield.png[]
-[start=5]
+
. Click the Source tab in the editor and add the following code at the top of the class body to instantiate the Groovy class and in the constructor to call the ``getGreeting()`` method in the Groovy class.
[source,java]
@@ -139,7 +139,7 @@
-[start=6]
+
. Right-click the project node in the Projects window and choose Run.
When you choose Run, the IDE compiles and launches the application.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ja.asciidoc
index 7984dd4..995550b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ja.asciidoc
@@ -59,14 +59,14 @@
または、「検索」フィールドに`groovy`と入力して、プラグインのリストをフィルタできます。
-[start=4]
+
. 「GroovyおよびGrails」プラグインのチェックボックスをオンにして、「アクティブ化」をクリックします。
image::images/groovy-plugin.png[title="プラグイン・マネージャで選択されたGroovyプラグイン"]
-[start=5]
+
. NetBeans IDEのインストーラのウィンドウで「アクティブ化」をクリックして、Groovyプラグインをアクティブ化します。
-[start=6]
+
. インストールが完了したらNetBeans IDEのインストーラのウィンドウで「終了」をクリックし、プラグイン・マネージャで「閉じる」をクリックします。
@@ -90,27 +90,27 @@
2. 「JFrameフォーム」を「Swing GUIフォーム」カテゴリから選択します。「次」をクリックします。
image::images/groovy-newjframe.png[title="新規ファイル・ウィザードの「JFrameフォーム」テンプレート"]
-[start=3]
+
. 「クラス名」に「*DisplayJFrame*」と入力します。
-[start=4]
+
. 「パッケージ」に「*org.demo*」と入力します。「終了」をクリックします。
image::images/groovy-newjframe2.png[title="新規JFrameフォーム・ウィザードの「名前と場所」パネル"]
「終了」をクリックすると、IDEはJFrameフォームを作成し、そのファイルがエディタで開かれます。
-[start=5]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「新規」→「その他」を選択して「新規ファイル」ダイアログ・ボックスを開きます。
-[start=6]
+
. 「Groovy」カテゴリから「Groovyクラス」を選択します。「次」をクリックします。
image::images/groovy-newgroovyclass.png[title="新規ファイル・ウィザードの「Groovyクラス」テンプレート"]
-[start=7]
+
. 「クラス名」に「*GreetingProvider*」と入力します。
-[start=8]
+
. 「パッケージ」ドロップダウン・リストから「 ``org.demo`` パッケージ」を選択します。「終了」をクリックします。
「終了」をクリックすると、IDEではGroovyファイルが作成され、エディタでこのファイルが開かれます。
@@ -135,14 +135,14 @@
}
----
-[start=3]
+
. エディタで ``DisplayJFrame.java`` を開いて(まだ開いていない場合)、「デザイン」タブをクリックします。
-[start=4]
+
. 「パレット」(メイン・メニューから「ウィンドウ」>「パレット」を選択)を開いて、「テキスト・フィールド」要素( ``jTextField`` )を「パレット」からJFrameにドラッグ・アンド・ドロップします。
image::images/groovy-jtextfield.png[title="エディタの「デザイン」ビューで開かれるDesignJFrameのJTextfield"]
-[start=5]
+
. エディタで「ソース」タブをクリックし、Groovyクラスをインスタンス化し、コンストラクタでGroovyクラスの ``getGreeting()`` メソッドをコールするために、クラス本文の上部に次のコードを追加します。
[source,java]
@@ -163,7 +163,7 @@
image::images/groovy-codecompletion.png[title="エディタでのコード補完"]
-[start=6]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」を選択します。
「実行」を選択すると、IDEはアプリケーションをコンパイルして起動します。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_pt_BR.asciidoc
index 40524f7..f9734e8 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_pt_BR.asciidoc
@@ -59,14 +59,14 @@
Se preferir, digite `groovy` no campo Pesquisar para filtrar a lista de plug-ins.
-[start=4]
+
. Marque a caixa de seleção do plug-in Groovy e Grails e clique em Ativar.
image::images/groovy-plugin.png[title="Plug-in do Groovy selecionado no gerenciador de Plug-ins"]
-[start=5]
+
. Clique em Ativar na janela do Instalador do NetBeans IDE para ativar o plug-in do Groovy.
-[start=6]
+
. Clique em Finalizar na janela do Instalador do NetBeans IDE após a instalação ser concluída e, em seguida, clique em Fechar no gerenciador de Plug-ins.
@@ -90,27 +90,27 @@
2. Selecione o Form JFrame na categoria Forms de GUI Swing. Clique em Próximo.
image::images/groovy-newjframe.png[title="Modelo de Form JFrame no assistente Novo Arquivo"]
-[start=3]
+
. Digite *DisplayJFrame* como o Nome da Classe.
-[start=4]
+
. Digite *org.demo* como o Pacote. Clique em Finalizar.
image::images/groovy-newjframe2.png[title="Painel Nome e Localização no assistente Novo Form JFrame"]
Quando você clica em Finalizar, o IDE cria o form JFrame e abre o arquivo no editor.
-[start=5]
+
. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Novo > Outro para abrir a caixa de diálogo Novo Arquivo.
-[start=6]
+
. Selecione a Classe Groovy na categoria Groovy. Clique em Próximo.
image::images/groovy-newgroovyclass.png[title="Modelo de Classe Groovy no assistente Novo Arquivo"]
-[start=7]
+
. Digite *GreetingProvider* como o Nome da Classe.
-[start=8]
+
. Selecione o pacote ``org.demo`` na lista drop-down Pacote. Clique em Finalizar.
Quando você clica em Finalizar, o IDE cria o arquivo Groovy e abre-o no editor.
@@ -135,14 +135,14 @@
}
----
-[start=3]
+
. Abra ``DisplayJFrame.java`` no editor (se ainda não estiver aberto) e clique na guia Design.
-[start=4]
+
. Abra a Paleta (Janela > Paleta do menu principal) e arraste e solte um elemento Campo de Texto ( ``jTextField`` ) da Paleta e para o JFrame.
image::images/groovy-jtextfield.png[title="JTextfield no DesignJFrame será aberto na view de Design do editor"]
-[start=5]
+
. Clique na guia Código-fonte do editor e adicione o seguinte código à parte superior do corpo da classe para instanciar a classe Groovy e no construtor para chamar o método ``getGreeting()`` na classe Groovy.
[source,java]
@@ -163,7 +163,7 @@
image::images/groovy-codecompletion.png[title="Autocompletar código no editor"]
-[start=6]
+
. Clique com o botão direito do mouse no nó na janela Projetos e selecione Executar.
Quando escolher Executar o IDE compila e aciona a aplicação.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ru.asciidoc
index 0c727f6..bb54232 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_ru.asciidoc
@@ -59,14 +59,14 @@
В качестве альтернативы вы можете ввести `groovy` в поле поиска, чтобы отфильтровать список подключаемых модулей.
-[start=4]
+
. Установите подключаемый модуль 'Groovy and Grails' и нажмите 'Активировать'.
image::images/groovy-plugin.png[title="Подключаемый модуль 'Groovy' выбран в диспетчере подключаемых модулей"]
-[start=5]
+
. Нажмите кнопку 'Активировать' в окне 'Мастер установки NetBeans IDE', чтобы активировать подключаемый модуль Groovy.
-[start=6]
+
. Нажмите кнопку 'Завершить' в окне 'Мастер установки NetBeans IDE' после завершения установки и затем нажмите 'Закрыть' в диспетчере подключаемых модулей.
@@ -90,27 +90,27 @@
2. В категории 'Формы Swing GUI' выберите 'Форма JFrame'. Нажмите 'Далее'.
image::images/groovy-newjframe.png[title="Шаблон формы JFrame в мастере создания файлов"]
-[start=3]
+
. В поле 'Имя класса' введите *DisplayJFrame*.
-[start=4]
+
. В поле 'Пакет' введите *org.demo*. Нажмите 'Готово'.
image::images/groovy-newjframe2.png[title="Панель 'Имя и местоположение' в мастере создания форм JFrame"]
При нажатии на кнопку 'Готово' в среде IDE создается форма JFrame, и в редакторе открывается соответствующий файл.
-[start=5]
+
. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Создать > Другое'. Откроется диалоговое окно мастера создания файлов.
-[start=6]
+
. В категории Groovy выберите 'Класс Groovy'. Нажмите 'Далее'.
image::images/groovy-newgroovyclass.png[title="Шаблон класса Groovy в мастере создания файлов"]
-[start=7]
+
. В поле 'Имя класса' введите *GreetingProvider*.
-[start=8]
+
. В списке 'Пакеты' выберите пакет ``org.demo`` . Нажмите кнопку "Завершить".
При нажатии на кнопку 'Готово' IDE создает файл Groovy и открывает его в редакторе.
@@ -135,14 +135,14 @@
}
----
-[start=3]
+
. Откройте файл ``DisplayJFrame.java`` в редакторе (если он еще не открыт) и перейдите на вкладку 'Конструирование'.
-[start=4]
+
. Откройте палитру (выберите 'Окно > Палитра' в главном меню) и перетащите элемент 'Текстовое поле' ( ``jTextField`` ) и палитры на форму JFrame.
image::images/groovy-jtextfield.png[title="Элемент JTextfield в файле DesignJFrame на вкладке 'Конструирование' в редакторе"]
-[start=5]
+
. Перейдите на вкладку 'Исходный код' и добавьте следующий исходный код в верхнюю часть тела класса, чтобы создать экземпляр класса Groovy и вызвать метод ``getGreeting()`` в классе Groovy в конструкторе.
[source,java]
@@ -163,7 +163,7 @@
image::images/groovy-codecompletion.png[title="Автозавершение кода в редакторе"]
-[start=6]
+
. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите "Выполнить".
Если выбрать команду 'Выполнить', IDE выполнит сборку и запуск приложения.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_zh_CN.asciidoc
index 5dace37..8d6d194 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/groovy-quickstart_zh_CN.asciidoc
@@ -59,14 +59,14 @@
或者,您也可以在搜索字段中键入 `groovy` 以过滤插件列表。
-[start=4]
+
. 选中 "Groovy and Grails"(Groovy 和 Grails)插件对应的复选框,然后单击 "Activate"(激活)。
image::images/groovy-plugin.png[title="在插件管理器中选定的 Groovy 插件"]
-[start=5]
+
. 在 "NetBeans IDE Installer"(NetBeans IDE 安装程序)窗口中单击 "Activate"(激活)以激活 Groovy 插件。
-[start=6]
+
. 在安装完成之后,在 "NetBeans IDE Installer"(NetBeans IDE 安装程序)窗口中单击 "Finish"(完成),然后在插件管理器中单击 "Close"(关闭)。
@@ -90,27 +90,27 @@
2. 在 "Swing GUI Forms"(Swing GUI 窗体)类别中选择 "JFrame Form"(JFrame 窗体)。单击 "Next"(下一步)。
image::images/groovy-newjframe.png[title=""New File"(新建文件)向导中的 JFrame 窗体模板"]
-[start=3]
+
. 键入 *DisplayJFrame* 作为类名。
-[start=4]
+
. 键入 *org.demo* 作为包。单击 "Finish"(完成)。
image::images/groovy-newjframe2.png[title=""New JFrame Form"(新建 JFrame 窗体)向导中的 "Name and Location"(名称和位置)面板"]
单击 "Finish"(完成)后,IDE 将创建 JFrame 窗体并在编辑器中打开文件。
-[start=5]
+
. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "New"(新建)> "Other"(其他)以打开 "New File"(新建文件)对话框。
-[start=6]
+
. 在 "Groovy" 类别中选择 "Groovy Class"(Groovy 类)。单击 "Next"(下一步)。
image::images/groovy-newgroovyclass.png[title=""New File"(新建文件)向导中的 Groovy 类模板"]
-[start=7]
+
. 键入 *GreetingProvider* 作为类名。
-[start=8]
+
. 从 "Package"(包)下拉列表中选择 ``org.demo`` 包。单击“完成”。
单击 "Finish"(完成)后,IDE 将创建 Groovy 文件并在编辑器中打开该文件。
@@ -135,14 +135,14 @@
}
----
-[start=3]
+
. 在编辑器中打开 ``DisplayJFrame.java`` (如果尚未打开),然后单击 "Design"(设计)标签。
-[start=4]
+
. 打开 "Palette"(组件面板)(从主菜单中选择 "Window"(窗口)> "Palette"(组件面板)),然后将 "Text Field"(文本字段)元素 ( ``jTextField`` ) 从 "Palette"(组件面板)拖放到 JFrame。
image::images/groovy-jtextfield.png[title="在编辑器 "Design"(设计)视图中打开的 DesignJFrame 中的 JTextfield"]
-[start=5]
+
. 在编辑器中单击 "Source"(源)标签,然后在类主体顶部添加以下代码以实例化 Groovy 类并在构造函数中调用 Groovy 类中的 ``getGreeting()`` 方法。
[source,java]
@@ -163,7 +163,7 @@
image::images/groovy-codecompletion.png[title="编辑器中的代码完成功能"]
-[start=6]
+
. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Run"(运行)。
选择 "Run"(运行)后,IDE 将编译并启动应用程序。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n.asciidoc
index 56b4f6c..2365c2f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n.asciidoc
@@ -64,13 +64,13 @@
image::images/navigator.png[]
-[start=2]
+
. In the Properties window, select the checkbox in the Automatic Internationalization property.
image::images/properties.png[]
-[start=3]
+
. Click Upgrade in the GUI Form Format Upgrade dialog box.
If the checkbox is selected, the IDE creates the ``Bundle.properties`` file in the ``demo`` package as it is set in the ``Properties Bundle File`` property.
@@ -80,13 +80,13 @@
If you need to have the ``Bundle.properties`` file in a different location, you can click the ellipsis (...) button to the right of the Properties Bundle File and choose a location or directly type the path in the property's text field.
-[start=4]
+
. In the Projects window, double-click the ``Bundle.properties`` node in the Projects Window or right-click the node and choose Edit.
The properties file is opened in the Source Editor. As you can see, all appropriate Keys and Values for Form ``FindDialog.java`` are generated. (The name of each key is derived from the form file name and the component Variable name. For example, the key ``FindDialog.jLabel1.text`` is generated for a component with the variable name ``jLabel1`` placed in form file ``FindDialog`` . The value ``jLabel1`` represents component's Text property in this example.
-[start=5]
+
. Close the ``Bundle.properties`` file.
@@ -100,13 +100,13 @@
NOTE: You can also internationalize other properties that have String values, such as Mnemonic, Accessible Name, Accessible Descriptor, and ToolTip.
-[start=3]
+
. The property editor is switched to resource bundle mode. Check that the Bundle Name field is set to ``demo.Bundle`` and the Key field contains the string ``FindDialog.jLabel1.text``
-[start=4]
+
. Type ``Find What:`` in the Value field.
-[start=5]
+
. Click OK.
Repeat the previous steps for all the components so that the form looks like the following picture:
@@ -137,10 +137,10 @@
image::images/addlocale_new.png[]
-[start=5]
+
. In the Projects window, right-click ``Bundle.properties`` and choose Open.
-[start=6]
+
. Translate individual messages in the correspondent column of the table to a new language (for example, Spanish), as shown below:
[.feature]
@@ -149,16 +149,16 @@
--
-[start=7]
+
. Press Ctrl-S to save your edits.
-[start=8]
+
. Select the ``FindDialog.java`` tab to display the form you are internationalizing.
-[start=9]
+
. Right-click the root node in the Navigator window and choose Reload Form (alternatively, press Ctrl-R).
-[start=10]
+
. Click Save in the Question dialog box that displays.
The form is reopened and the Spanish locale is loaded in in the design, as shown below:
@@ -180,10 +180,10 @@
--
-[start=4]
+
. Click OK.
-[start=5]
+
. Right-click the InternationalizeDemo project and choose Run.
The IDE runs the ``FindDialog`` dialog box in the Spanish locale like shown below.
@@ -240,13 +240,13 @@
--
-[start=5]
+
. For demonstration purposes, select ``examples.Find`` and click the Remove Source(s) button.
-[start=6]
+
. Click Next.
-[start=7]
+
. Check if the Internationalization Wizard offers the correct properties files ``examples.Antenna`` and ``examples.ContactEditor`` . If it does not, use the Select Resource button to choose the correct properties file.
[.feature]
@@ -255,13 +255,13 @@
--
-[start=8]
+
. Click Next.
-[start=9]
+
. Skip page 3 of the Wizard since you are not going to create any fields and modify additional values and click Next.
-[start=10]
+
. All hard-coded strings are displayed in the last step of Internationalization wizard and it is possible to decide which of them will come from the properties file (use checkbox). You can further customize individual keys, values, comments, and format of replaced strings by clicking on the ellipsis (...) button for a string.
[.feature]
@@ -270,7 +270,7 @@
--
-[start=11]
+
. Click Finish.
Now, the internationalization of source code is finished, other locale can be <<newlocale,added>> and <<testlocale,tested>> as it was shown previously.
@@ -290,16 +290,16 @@
The IDE shows Internationalization dialog box and pre-fills the first hard-coded string from the ``Find.java`` source code .
-[start=2]
+
. Click Select to select a particular properties file or create a new one.
-[start=3]
+
. In the Select Resource Bundle dialog box, enter ``Find.properties`` in the File Name text field, click Create New and then OK.
-[start=4]
+
. You can modify format of replaced string, key, value or comment if it is necessary. We'll just leave the default values.
-[start=5]
+
. Click Replace to confirm the change and move a focus on the next hard-coded string.
If a hard-coded string does not need to be replaced, click the Skip button.
@@ -317,10 +317,10 @@
The IDE opens the ``Find.java`` file in the Source Editor.
-[start=2]
+
. Scroll through the source code and find the main method.
-[start=3]
+
. Insert the following line in bold in the main method:
[source,xml]
@@ -359,23 +359,23 @@
}
----
-[start=4]
+
. Place the mouse cursor within the parentheses of the ``System.out.println();`` so that an internationalized string is inserted as a parameter.
-[start=5]
+
. Press Ctrl-Shift-J to invoke Insert Internationalized String dialog box (alternatively, you can choose Tools > Internationalization > Insert Internationalized String from the main menu).
-[start=6]
+
. For Bundle Name, click the Select button, select the ``Source Packages > examples`` folder, and enter ``Find`` as the Bundle name in the File Name text field. Then click OK.
The Bundle Name field of the Insert Internationalized String dialog box shows ``examples.Find`` .
-[start=7]
+
. Type ``Start`` in the Key drop-down box and ``Start Find Dialog`` in the Value field. Then click OK.
image::images/insi18nstring.png[]
-[start=8]
+
. The IDE inserts an internationalized string:
[source,xml]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ja.asciidoc
index d749509..e67b72c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ja.asciidoc
@@ -81,13 +81,13 @@
image::images/navigator.png[]
-[start=2]
+
. 「プロパティ」ウィンドウで、「自動国際化」プロパティのチェックボックスを選択します。
image::images/properties.png[]
-[start=3]
+
. 「GUIフォーム形式のアップグレード」ダイアログ・ボックスで「アップグレード」をクリックします。
チェックボックスが選択されると、「 ``プロパティ・バンドル・ファイル`` 」プロパティで設定されているとおりに、IDEが ``demo`` パッケージ内に ``Bundle.properties`` ファイルを作成します。
@@ -97,13 +97,13 @@
``Bundle.properties`` ファイルを別の場所に置く必要がある場合は、「プロパティ・バンドル・ファイル」の右側の省略符号ボタン(...)をクリックして場所を選択するか、プロパティのテキスト・フィールドにパスを直接入力できます。
-[start=4]
+
. 「プロジェクト」ウィンドウで、「プロジェクト」ウィンドウの「 ``Bundle.properties`` 」ノードをダブルクリックするか、またはノードを右クリックして「編集」を選択します。
プロパティ・ファイルがソース・エディタに表示されます。フォーム ``FindDialog.java`` に適切なキーと値がすべて生成されていることがわかります。各キーの名前は、フォームのファイル名とコンポーネントの変数名から派生されます。たとえば、キー ``FindDialog.jLabel1.text`` は、フォーム・ファイル ``FindDialog`` に配置された ``jLabel1`` という変数名を持つコンポーネント用に生成されます。値 ``jLabel1`` は、この例ではコンポーネントの「text」プロパティを表しています。
-[start=5]
+
. ``Bundle.properties`` ファイルを閉じます。
@@ -117,13 +117,13 @@
*注意:* Mnemonic、Accessible Name、Accessible Descriptor、ToolTipなどの、文字列値を持つその他のプロパティも国際化できます。
-[start=3]
+
. プロパティ・エディタがリソース・バンドル・モードに切り替わります。「バンドル名」フィールドが ``demo.Bundle`` に設定され、「キー」フィールドに文字列 ``FindDialog.jLabel1.text`` が含まれていることを確認します。
-[start=4]
+
. 「値」フィールドに「 ``Find What:`` 」と入力します。
-[start=5]
+
. 「OK」をクリックします。
すべてのコンポーネントで前述の手順を繰り返すと、フォームは次の図のようになります。
@@ -154,10 +154,10 @@
image::images/addlocale_new.png[]
-[start=5]
+
. 「プロジェクト」ウィンドウで、 ``Bundle.properties`` を右クリックして「開く」を選択します。
-[start=6]
+
. 次に示すように、表の対応する列の個々のメッセージを、新しい言語(スペイン語など)に変換します。
[.feature]
@@ -166,16 +166,16 @@
--
-[start=7]
+
. [Ctrl]-[S]を押して編集を保存します。
-[start=8]
+
. 「 ``FindDialog.java`` 」タブを選択して、国際化しているフォームを表示します。
-[start=9]
+
. 「ナビゲータ」ウィンドウのルート・ノードを右クリックし、「フォームの再ロード」を選択します(または[Ctrl]+[R]を押します)。
-[start=10]
+
. 表示される「質問」ダイアログ・ボックスで「保存」をクリックします。
フォームが再度開き、次に示すように、スペイン語ロケールがデザインにロードされます。
@@ -197,10 +197,10 @@
--
-[start=4]
+
. 「OK」をクリックします。
-[start=5]
+
. 「InternationalizeDemo」プロジェクトを右クリックし、「実行」を選択します。
次に示すように、IDEによって「 ``FindDialog`` 」ダイアログ・ボックスがスペイン語ロケールで実行されます。
@@ -257,13 +257,13 @@
--
-[start=5]
+
. デモの目的で、「 ``examples.Find`` 」を選択し、「ソースを除去」ボタンをクリックします。
-[start=6]
+
. 「次」をクリックします。
-[start=7]
+
. 国際化ウィザードが正しいプロパティ・ファイル ``examples.Antenna`` と ``examples.ContactEditor`` を提示するかどうかを確認します。提示しない場合、「リソースを選択」ボタンを使用して正しいプロパティ・ファイルを選択します。
[.feature]
@@ -272,13 +272,13 @@
--
-[start=8]
+
. 「次」をクリックします。
-[start=9]
+
. フィールドを作成する予定はないため、ウィザードの3ページ目をスキップし、追加の値を変更して「次」をクリックします。
-[start=10]
+
. ハードコードされた文字列は、国際化ウィザードの最後のステップですべて表示されます。それらのうちどれがプロパティ・ファイルからのものかを判断できます(チェックボックスを使用)。文字列の省略符号ボタン(...)をクリックして、個々のキー、値、コメント、および置換した文字列の書式をさらにカスタマイズできます。
[.feature]
@@ -287,7 +287,7 @@
--
-[start=11]
+
. 「終了」をクリックします。
これでソース・コードの国際化は終了し、前述したように、他のロケールも<<newlocale,追加>>したり<<testlocale,テスト>>したりできます。
@@ -307,16 +307,16 @@
IDEは、「国際化」ダイアログ・ボックスと、事前入力済の ``Find.java`` ソース・コードから最初にハードコードされた文字列を表示します。
-[start=2]
+
. 「選択」をクリックして特定のプロパティ・ファイルを選択するか、または新しいプロパティ・ファイルを作成します。
-[start=3]
+
. 「リソース・バンドルを選択」ダイアログ・ボックスで、「ファイル名」テキスト・フィールドに「 ``Find.properties`` 」と入力し、「新規作成」をクリックしてから「OK」をクリックします。
-[start=4]
+
. 必要に応じて、置換された文字列、キー、値、またはコメントの書式を変更できます。デフォルトの値はそのままにします。
-[start=5]
+
. 「置換」をクリックして変更を確認し、フォーカスを次のハードコードされた文字列に移動します。
ハードコードされた文字列を置換する必要がない場合は、「スキップ」ボタンをクリックします。
@@ -334,10 +334,10 @@
IDEは、ソース・エディタで ``Find.java`` ファイルを開きます。
-[start=2]
+
. ソース・コードをスクロールし、mainメソッドを探します。
-[start=3]
+
. mainメソッドに、次の太字の行を挿入します。
[source,xml]
@@ -376,23 +376,23 @@
}
----
-[start=4]
+
. ``System.out.println();`` の括弧内にカーソルを移動して、国際化文字列をパラメータとして挿入できるようにします。
-[start=5]
+
. [Ctrl]-[Shift]-[J]を押して「国際化文字列を挿入」ダイアログ・ボックスを起動します(または、メイン・メニューから「ツール」>「国際化」>「国際化文字列を挿入」を選択できます)。
-[start=6]
+
. 「バンドル名」で、「選択」ボタンをクリックし、 ``「ソース・パッケージ」>「examples」`` フォルダを選択して、「ファイル名」テキスト・フィールドにバンドル名として「 ``Find`` 」と入力します。「OK」をクリックします。
「国際化文字列を挿入」ダイアログ・ボックスの「バンドル名」フィールドに、「 ``examples.Find`` 」と表示されます。
-[start=7]
+
. 「キー」ドロップダウン・ボックスに「 ``Start`` 」と入力し、「値」フィールドに「 ``Start Find Dialog`` 」と入力します。「OK」をクリックします。
image::images/insi18nstring.png[]
-[start=8]
+
. 次のように、IDEが国際化文字列を挿入します。
[source,xml]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_pt_BR.asciidoc
index a7ed003..4b39bf5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_pt_BR.asciidoc
@@ -81,13 +81,13 @@
image::images/navigator.png[]
-[start=2]
+
. Na janela Propriedades, marque a caixa de seleção na propriedade Automatic Internationalization.
image::images/properties.png[]
-[start=3]
+
. Clique em Upgrade na caixa de diálogo Upgrade do Formato do Form GUI.
Se a caixa de seleção estiver marcada, o IDE cria o arquivo ``Bundle.properties`` no pacote ``demo`` conforme está definido na propriedade ``Properties Bundle File`` .
@@ -97,13 +97,13 @@
Se você precisar que o arquivo ``Bundle.properties`` fique em outro local, poderá clicar no botão de reticências (...) à direita do Arquivo Conjunto de Propriedades e escolher um local ou digitar diretamente o caminho no campo de texto da propriedade.
-[start=4]
+
. Na janela Projetos, clique duas vezes no nó ``Bundle.properties`` na janela Projetos ou clique com o botão direito do mouse no nó e escolha Editar.
O arquivo de propriedades é aberto no Editor de Código-fonte. Como você pode ver, todas as chaves e os valores apropriados para o form ``FindDialog.java`` são gerados. (O nome de cada chave é obtido do nome do arquivo de form e do nome de variável do componente). Por exemplo, a chave ``FindDialog.jLabel1.text`` é gerada para um componente com o nome de variável ``jLabel1`` colocado no arquivo de form ``FindDialog`` . O valor ``jLabel1`` representa a propriedade Text do componente neste exemplo.
-[start=5]
+
. Escolha o arquivo ``Bundle.properties`` .
@@ -117,13 +117,13 @@
*Observação:* você também pode internacionalizar outras propriedades que tenham valor de Strings, como Mnemonic, Accessible Name, Accessible Descriptor e ToolTip.
-[start=3]
+
. O editor de propriedade é alternado para o modo de pacote de recursos. Verifique se o campo Nome do Pacote está definido como ``demo.Bundle`` e se o campo Chave contém a string ``FindDialog.jLabel1.text``
-[start=4]
+
. Digite ``Localizar:`` no campo Valor.
-[start=5]
+
. Clique em OK.
Repita as etapas anteriores para todos os componentes para que o form tenha a aparência semelhante à figura a seguir:
@@ -154,10 +154,10 @@
image::images/addlocale_new.png[]
-[start=5]
+
. Na janela Projetos, clique com o botão direito do mouse em ``Bundle.properties`` e escolha Abrir.
-[start=6]
+
. Traduza mensagens individuais na coluna correspondente da tabela para o novo idioma (por exemplo, espanhol), como mostrado abaixo:
[.feature]
@@ -166,16 +166,16 @@
--
-[start=7]
+
. Pressione Ctrl-S para salvar suas edições.
-[start=8]
+
. Selecione a guia ``FindDialog.java`` para exibir o form que você está internacionalizando.
-[start=9]
+
. Clique com o botão direito do mouse no nó-raiz da janela Navegador e escolha Recarregar Form (se preferir, pressione Ctrl-R).
-[start=10]
+
. Clique em Salvar na caixa de diálogo Pergunta que é exibida.
O form é reaberto e a configuração regional Espanhol é carregada no design, como mostrado abaixo:
@@ -197,10 +197,10 @@
--
-[start=4]
+
. Clique em OK.
-[start=5]
+
. Clique com o botão direito do mouse no nó do projeto InternationalizeDemo e escolha Executar.
O IDE executa a caixa de diálogo ``FindDialog`` na configuração regional Espanhol, como mostrado abaixo.
@@ -257,13 +257,13 @@
--
-[start=5]
+
. Para fins de demonstração, selecione ``examples.Find.`` e clique no botão Remover Código-fonte.
-[start=6]
+
. Clique em Próximo.
-[start=7]
+
. Verifique se o Assistente de Internacionalização oferece os arquivos de propriedades corretos ``examples.Antenna`` e ``examples.ContactEditor`` . Caso não ofereça, use o botão Selecionar Recurso para escolher o arquivo de propriedades correto.
[.feature]
@@ -272,13 +272,13 @@
--
-[start=8]
+
. Clique em Próximo.
-[start=9]
+
. Pule a página 3 do Assistente, pois você não criará quaisquer campos nem modificará valores adicionais, e clique em Próximo.
-[start=10]
+
. Todas as strings codificadas são exibidas na última etapa do Assistente de internacionalização e é possível decidir quais delas virão do arquivo de propriedades (use a caixa de seleção). Você pode personalizar ainda mais comentários, valores, chaves individuais e o formato de strings substituídas clicando no botão de reticências (...) de uma string.
[.feature]
@@ -287,7 +287,7 @@
--
-[start=11]
+
. Clique em Finalizar.
Agora, que a internacionalização do código-fonte está finalizada, outra configuração regional pode ser <<newlocale,adicionada>> e <<testlocale,testada>>, como mostrado anteriormente.
@@ -307,16 +307,16 @@
O IDE mostra a caixa de diálogo Internacionalização e faz um preenchimento prévio da primeira string codificada do código-fonte ``Find.java`` .
-[start=2]
+
. Clique em Selecionar para selecionar um arquivo de propriedades particular ou crie um novo.
-[start=3]
+
. Na caixa de diálogo Selecionar Pacote de Recursos , digite ``Find.properties`` no campo de texto Nome do Arquivo, clique em Criar Novo e, em seguida, em OK.
-[start=4]
+
. Você pode modificar o formato da string substituída, a chave, o valor ou o comentário, se necessário. Nós manteremos os valores default.
-[start=5]
+
. Clique em Substituir para confirmar a alteração e mover um foco na próxima string codificada.
Se uma string codificada não precisar ser substituída, clique no botão Ignorar.
@@ -334,10 +334,10 @@
O IDE abre o arquivo ``Find.java`` no Editor de Código-fonte.
-[start=2]
+
. Role pelo código-fonte e localize o método principal.
-[start=3]
+
. Insira a seguinte linha em negrito no método principal:
[source,xml]
@@ -376,23 +376,23 @@
}
----
-[start=4]
+
. Coloque o cursor do mouse em parênteses em ``System.out.println();`` de forma que uma string internacionalizada seja inserida como um parâmetro.
-[start=5]
+
. Pressione Ctrl-Shift-J para chamar a caixa de diálogo Inserir String Internacionalizada (se preferir, é possível escolher Ferramentas > Internacionalização > Inserir String Internacionalizada no menu principal).
-[start=6]
+
. Para o Nome do Pacote, clique no botão Selecionar, selecione a pasta ``Pacotes de Código-fonte > exemplos`` e insira ``Localizar`` como o Nome do pacote no campo de texto Nome do Arquivo. Em seguida, clique em OK.
O campo Nome do Pacote da caixa de diálogo Inserir String Internacionalizada mostra ``examples.Find`` .
-[start=7]
+
. Digite ``Iniciar`` na caixa drop-down Chave e ``Iniciar caixa de diálogo Localizar`` no campo Valor. Em seguida, clique em OK.
image::images/insi18nstring.png[]
-[start=8]
+
. O IDE insere uma string internacionalizada:
[source,xml]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ru.asciidoc
index 841806c..eb819eb 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_ru.asciidoc
@@ -81,13 +81,13 @@
image::images/navigator.png[]
-[start=2]
+
. В окне Properties ("Свойства") установите флажок для свойства Automatic Internationalization ("Автоматическая интернационализация").
image::images/properties.png[]
-[start=3]
+
. Нажмите кнопку Upgrade ("Обновить") в диалоговом окне GUI Form Format Upgrade ("Обновление формата формы графического интерфейса").
Если флажок установлен, среда IDE создаст файл ``Bundle.properties`` в пакете ``demo`` , поскольку он установлен в свойстве ``Properties Bundle File`` ("Файл набора свойств").
@@ -97,13 +97,13 @@
Если нужно, чтобы файл ``Bundle.properties`` находился в другом месте, можно нажать расположенную справа кнопку обзора (...) и выбрать местоположение, либо ввести путь непосредственно в текстовом поле свойства.
-[start=4]
+
. В окне 'Проекты' дважды щелкните узел ``Bundle.properties`` в окне 'Проекты' или щелкните правой кнопкой мыши узел и выберите 'Правка'.
Файл свойств откроется в редакторе исходного кода. Как можно увидеть, созданы все необходимые ключи и значения для формы ``FindDialog.java`` . (Имя каждого из ключей является производным от имени файла формы и имени переменной компонента. Например, ключ ``FindDialog.jLabel1.text`` создан из компонента с именем переменной ``jLabel1`` , который помещен в файл формы ``FindDialog`` . Значение ``jLabel1`` представляет в данном примере свойство Text ("Текст") компонента.
-[start=5]
+
. Закройте файл ``Bundle.properties`` .
@@ -117,13 +117,13 @@
*Примечание.* Также можно интернационализовать другие свойства, содержащие строковые значения, такие как Mnemonic, Accessible Name, Accessible Descriptor и ToolTip.
-[start=3]
+
. Редактор свойств переключен в режим набора ресурсов. Убедитесь, что в поле Bundle Name ("Имя набора") введено ``demo.Bundle`` , а поле Key ("Ключ") содержит строку ``FindDialog.jLabel1.text``
-[start=4]
+
. Введите ``Find What:`` в поле Value ("Значение").
-[start=5]
+
. Нажмите кнопку "ОК".
Повторите вышеприведенные действия для всех компонентов, чтобы форма выглядела подобно следующей иллюстрации:
@@ -154,10 +154,10 @@
image::images/addlocale_new.png[]
-[start=5]
+
. В окне 'Проекты' щелкните правой кнопкой мыши ``Bundle.properties`` и выберите 'Открыть'.
-[start=6]
+
. Переведите отдельные сообщения в соответствующем столбце таблицы на новый (например, испанский) язык, как показано ниже:
[.feature]
@@ -166,16 +166,16 @@
--
-[start=7]
+
. Нажмите Ctrl+S для сохранения изменений.
-[start=8]
+
. Выберите вкладку ``FindDialog.java`` для отображения интернационализируемой формы.
-[start=9]
+
. Щелкните правой кнопкой мыши корневой узел в окне 'Навигатор' и выберите 'Перезагрузить форму' (или нажмите Ctrl+R).
-[start=10]
+
. Выберите Save ("Сохранить") в отобразившемся диалоговом окне Question ("Вопрос").
Форма будет открыта заново и в проект будет загружена испанская локаль, как показано ниже:
@@ -197,10 +197,10 @@
--
-[start=4]
+
. Нажмите кнопку "ОК".
-[start=5]
+
. Щелкните правой кнопкой мыши проект InternationalizeDemo и выберите Run ("Запустить").
Среда IDE запустит диалоговое окно ``FindDialog`` на испанском, как показано ниже.
@@ -257,13 +257,13 @@
--
-[start=5]
+
. Для демонстрации выберите ``examples.Find`` и нажмите кнопку Remove Source(s) ("Удалить источник(и)").
-[start=6]
+
. Нажмите кнопку "Далее".
-[start=7]
+
. Убедитесь, что мастер интернационализации предлагает верные файлы свойств: ``examples.Antenna`` и ``examples.ContactEditor`` . Если это не так, используйте кнопку Select Resource ("Выбор ресурса") для выбора верного файла свойств.
[.feature]
@@ -272,13 +272,13 @@
--
-[start=8]
+
. Нажмите кнопку "Далее".
-[start=9]
+
. Пропустите страницу 3 мастера, поскольку мы не будем заниматься здесь созданием полей и изменением дополнительных значений и нажмите кнопку Next ("Далее").
-[start=10]
+
. Все жестко определенные строки отображаются на последнем этапе работы с мастером интернационализации. Здесь можно определить, какие из них будут исходить из файла свойств (используйте флажок). Можно также осуществлять дополнительную настройку отдельных ключей, значений и формата замененных строк, нажимая на кнопку многоточия (...) для нужной строки.
[.feature]
@@ -287,7 +287,7 @@
--
-[start=11]
+
. Нажмите кнопку "Завершить".
Теперь интернационализация исходного кода завершена, и можно <<newlocale,добавлять>> и <<testlocale,тестировать>> локали, как было показано ранее.
@@ -307,16 +307,16 @@
В среде IDE отображается диалоговое окно Internationalization ("Интернационализация"), в которое автоматически вставляется первая жестко определенная строка из исходного кода ``Find.java`` .
-[start=2]
+
. Нажмите кнопку Select ("Выбор"), чтобы выбрать определенный файл свойств или создать новый.
-[start=3]
+
. В диалоговом окне 'Выбор пакета ресурсов' в поле 'Имя файла' введите ``Find.properties`` , нажмите 'Создать' и ОК.
-[start=4]
+
. Формат замененной строки, ключа, значения или комментария при необходимости можно заменить. Мы просто оставим значения по умолчанию.
-[start=5]
+
. Нажмите кнопку Replace ("Замена"), чтобы подтвердить изменение, и переместите фокус на следующую жестко определенную строку.
Если жестко определенная строка не требует замены, нажмите кнопку Skip ("Пропуск").
@@ -334,10 +334,10 @@
Среда IDE откроет файл ``Find.java`` в редакторе исходного кода.
-[start=2]
+
. Найдите в исходном коде главный метод.
-[start=3]
+
. Вставьте следующую строку, выделенную жирным шрифтом, в главный метод:
[source,xml]
@@ -376,23 +376,23 @@
}
----
-[start=4]
+
. Поместите курсор в скобках выражения ``System.out.println();`` и вставьте интернационализированную строку как параметр.
-[start=5]
+
. Нажмите Ctrl-Shift-J для вызова диалогового окна Insert Internationalized String ("Вставить интернационализированную строку") (как вариант, можно выбрать Tools ("Сервис") > Internationalization ("Интернационализация") > Insert Internationalized String ("Вставить интернационализированную строку") из главного меню).
-[start=6]
+
. Для ввода имени набора нажмите кнопку Select ("Выбор"), выберите ``Source Packages ("Исходные пакеты") > папку`` примеров и введите ``Find`` в качестве имя набора в текстовое поле File Name ("Имя файла"). После этого нажмите кнопку OK.
В поле 'Имя пакета' в диалоговом окне 'Вставка интернационализированной строки' отображается ``examples.Find`` .
-[start=7]
+
. Введите ``Start`` в раскрывающееся окно Key ("Ключ") и ``Start Find Dialog`` в поле Value ("Значение"). После этого нажмите кнопку OK.
image::images/insi18nstring.png[]
-[start=8]
+
. Среда IDE вставит интернационализированную строку:
[source,xml]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_zh_CN.asciidoc
index 82c946c..0eca93a 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-automatic-i18n_zh_CN.asciidoc
@@ -81,13 +81,13 @@
image::images/navigator.png[]
-[start=2]
+
. 在 "Properties"(属性)窗口中,选中 "Automatic Internationalization"(自动国际化)属性中的复选框。
image::images/properties.png[]
-[start=3]
+
. 在 "GUI Form Format Upgrade"(GUI 窗体格式升级)对话框中,单击 "Upgrade"(升级)。
如果选中该复选框,则 IDE 将按照 ``Properties Bundle File`` (属性包文件)属性中的设置在 ``demo`` 包中创建 ``Bundle.properties`` 文件。
@@ -97,13 +97,13 @@
如果您需要在其他位置创建 ``Bundle.properties`` 文件,则可以单击 "Properties Bundle File"(属性包文件)右侧的省略号 (...) 按钮,然后选择一个位置,或者直接在该属性的文本字段中键入路径。
-[start=4]
+
. 在 "Projects"(项目)窗口中,双击 ``Bundle.properties`` 节点,或者右键单击该节点,然后选择 "Edit"(编辑)。
将在源代码编辑器中打开该属性文件。正如您所看到的,将为窗体 ``FindDialog.java`` 生成所有相应的键和值。(每个键的名称是从窗体文件名和组件变量名派生的。例如,键 ``FindDialog.jLabel1.text`` 是为窗体文件 ``FindDialog`` 中包含的变量名为 ``jLabel1`` 的组件生成的。在此示例中,值 ``jLabel1`` 表示组件的 "text" 属性。
-[start=5]
+
. 关闭 ``Bundle.properties`` 文件。
@@ -117,13 +117,13 @@
*注:*您还可以对具有字符串值的其他属性进行国际化,例如助记符、可访问的名称、可访问的描述符和工具提示。
-[start=3]
+
. 属性编辑器将切换至资源包模式。检查 "Bundle Name"(包名)字段是否设置为 ``demo.Bundle`` ,以及 "Key"(键)字段是否包含字符串 ``FindDialog.jLabel1.text`` 。
-[start=4]
+
. 在 "Value"(值)字段中键入 ``Find What:`` 。
-[start=5]
+
. 单击 "OK"(确定)。
对所有组件重复执行以上步骤,使该窗体如下图所示:
@@ -154,10 +154,10 @@
image::images/addlocale_new.png[]
-[start=5]
+
. 在 "Projects"(项目)窗口中,右键单击 ``Bundle.properties`` ,然后选择 "Open"(打开)。
-[start=6]
+
. 将相应表列中的各条消息转换为新语言(例如西班牙语),如下所示:
[.feature]
@@ -166,16 +166,16 @@
--
-[start=7]
+
. 按 Ctrl-S 组合键保存所做的编辑。
-[start=8]
+
. 选择 ``FindDialog.java`` 标签,以显示要国际化的窗体。
-[start=9]
+
. 在 "Navigator"(导航器)窗口中右键单击根节点,然后选择 "Reload Form"(重新加载窗体)(或者,按 Ctrl-R 组合键)。
-[start=10]
+
. 在显示的 "Question"(问题)对话框中单击 "Save"(保存)。
将重新打开该窗体,并在设计区域中加载西班牙语语言环境,如下所示:
@@ -197,10 +197,10 @@
--
-[start=4]
+
. 单击 "OK"(确定)。
-[start=5]
+
. 右键单击 "InternationalizeDemo" 项目,然后选择 "Run"(运行)。
IDE 将在西班牙语语言环境中运行 ``FindDialog`` 对话框,如下所示。
@@ -257,13 +257,13 @@
--
-[start=5]
+
. 为了便于演示,选择 ``examples.Find`` ,然后单击 "Remove Source(s)"(删除源)按钮。
-[start=6]
+
. 单击 "Next"(下一步)。
-[start=7]
+
. 检查国际化向导是否提供了正确的属性文件 ``examples.Antenna`` 和 ``examples.ContactEditor`` 。如果未提供,请使用 "Select Resource"(选择资源)按钮来选择正确的属性文件。
[.feature]
@@ -272,13 +272,13 @@
--
-[start=8]
+
. 单击 "Next"(下一步)。
-[start=9]
+
. 跳过该向导的第 3 页(因为您不打算创建任何字段并修改其他值),然后单击 "Next"(下一步)。
-[start=10]
+
. 所有固定编码字符串都将显示在国际化向导的最后一步中,您可以在该步中确定将哪些字符串包含在属性文件中(使用复选框)。您也可以进一步定制各个键、值、注释和替换字符串的格式,方法是单击字符串的省略号 (...) 按钮。
[.feature]
@@ -287,7 +287,7 @@
--
-[start=11]
+
. 单击 "Finish"(完成)。
现在,已完成源代码的国际化,接下来可以按照先前所述<<newlocale,添加>>和<<testlocale,测试>>其他语言环境。
@@ -307,16 +307,16 @@
IDE 将显示 "Internationalization"(国际化)对话框,并预先填写 ``Find.java`` 源代码中的第一个固定编码字符串。
-[start=2]
+
. 单击 "Select"(选择)以选择特定的属性文件,或者创建新文件。
-[start=3]
+
. 在 "Select Resource Bundle"(选择资源包)对话框中,在 "File Name"(文件名)文本字段中输入 ``Find.properties`` ,单击 "Create New"(新建),然后单击 "OK"(确定)。
-[start=4]
+
. 您可以修改替换字符串的格式、键、值或注释(如有必要)。我们将仅保留默认值。
-[start=5]
+
. 单击 "Replace"(替换)以确认更改,并将焦点移到下一个固定编码字符串上。
如果不需要替换固定编码字符串,请单击 "Skip"(跳过)按钮。
@@ -334,10 +334,10 @@
IDE 将在源代码编辑器中打开 ``Find.java`` 文件。
-[start=2]
+
. 滚动查看源代码并查找 main 方法。
-[start=3]
+
. 在 main 方法中插入以下用粗体显示的行:
[source,xml]
@@ -376,23 +376,23 @@
}
----
-[start=4]
+
. 将鼠标光标放在 ``System.out.println();`` 的圆括号内,以便作为参数插入国际化字符串。
-[start=5]
+
. 按 Ctrl-Shift-J 组合键调用 "Insert Internationalized String"(插入国际化字符串)对话框(也可以从主菜单中选择 "Tools"(工具)> "Internationalization"(国际化)> "Insert Internationalized String"(插入国际化字符串))。
-[start=6]
+
. 对于 "Bundle Name"(包名),单击 "Select"(选择)按钮,选择 ``"Source Packages"(源包)> "Examples"(样例)`` 文件夹,然后在 "File Name"(文件名)文本字段中输入 ``Find`` 作为包名。然后,单击 "OK"(确定)。
"Insert Internationalized String"(插入国际化字符串)对话框的 "Bundle Name"(包名称)字段显示 ``examples.Find`` 。
-[start=7]
+
. 在 "Key"(键)下拉框中键入 ``Start`` ,并在 "Value"(值)字段中键入 ``Start Find Dialog`` 。然后,单击 "OK"(确定)。
image::images/insi18nstring.png[]
-[start=8]
+
. IDE 将插入国际化字符串:
[source,xml]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-binding.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-binding.asciidoc
index dd2f230..5f11e86 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-binding.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-binding.asciidoc
@@ -76,16 +76,16 @@
* Clear the Create Main Class checkbox.
-[start=4]
+
. Click Finish to exit the wizard and set up the project.
-[start=5]
+
. In the Projects window, right-click the NumberSlider project node and choose New > JFrame Form.
(If JFrame Form is not available in the New menu, choose Other. Then in the New File wizard, select the Swing GUI Forms category and select the JFrame Form template.)
-[start=6]
+
. In the Name and Location page of the wizard, perform the following operations:
* Type ``NumberSliderFrame`` for the class name.
* Type ``numberslider`` for the package name.
@@ -96,16 +96,16 @@
--
-[start=7]
+
. Click Finish to exit the wizard and create the form.
``NumberSliderFrame.java`` should open in design mode in the editing area.
-[start=8]
+
. From the Swing Controls section of the Palette, drag a slider component into the design area. (If the Palette window is not open, choose Window > Palette.)
-[start=9]
+
. From the Palette, drag a text field component to the design area.
The resulting form might look something like the screenshot below. However, positioning is not important for purposes of this example.
@@ -138,7 +138,7 @@
--
-[start=4]
+
. Click OK.
You have just bound the ``value`` bean property of the slider to the ``text`` value of the text field.
@@ -241,7 +241,7 @@
--
-[start=4]
+
. In the Entity Classes page of the wizard, make sure the Generate Named Query Annotations for Persistent Fields and Create Persistence Unit checkboxes are selected.
[.feature]
@@ -250,10 +250,10 @@
--
-[start=5]
+
. Make any customizations that you want to make to the names of the generated classes and their location.
-[start=6]
+
. Click Finish.
You should see nodes for the entity classes in the Projects window.
@@ -272,10 +272,10 @@
Specify ``app`` as a userid and ``app`` as a password, if you are prompted for a userid and password.
-[start=3]
+
. Expand the node for the connection, and expand its Tables node.
-[start=4]
+
. Drag the node for the table on to the form and press Ctrl as you drop the table.
A JTable is created and its columns are bound to the columns in the database table.
@@ -290,10 +290,10 @@
--
-[start=2]
+
. Click Import Data to Form. From the Import Data to Form dialog box, select the database table to which you want to bind your components. Click OK.
-[start=3]
+
. From the Binding Source combo box, select the item that represents the result list of the entity class. For example, if the entity class is called, ``Customer.java`` , the list object would be generated as ``customerList`` .
[.feature]
@@ -302,16 +302,16 @@
--
-[start=4]
+
. Leave the Binding Expression value as ``null`` .
-[start=5]
+
. If there are any database columns that you do not want to appear in the JTable, select those columns in the Selected list and move them to the Available list.
-[start=6]
+
. Select the Advanced tab to further configure the binding. For example, you can specify a validator or converter, or you can specify behavior if the binding source is null or unreadable.
-[start=7]
+
. Click OK.
*To bind the data to a JList component:*
@@ -326,16 +326,16 @@
--
-[start=4]
+
. Leave the Binding Expression value as ``null`` .
-[start=5]
+
. In the Display Expression drop-down list, select the property that represents the database column that contains the values that you want to display in the list.
-[start=6]
+
. Select the Advanced tab to further configure the binding.
-[start=7]
+
. Click OK.
*To bind the data to a JComboBox component:*
@@ -350,19 +350,19 @@
--
-[start=4]
+
. Leave the Binding Expression value as ``null`` and click OK.
-[start=5]
+
. Right-click the combo box again and choose Bind > selectedItem.
-[start=6]
+
. Bind to the property that you want to be affected by the user selection.
image::images/combo-item.png[]
-[start=7]
+
. Click OK to save your edits.
The Beans Binding library (as of version 1.2.1) does not have a DetailBinding class that enables you to specify how to derive the _display_ values for the JComboBox. So you will need to write some custom code. One approach is to write a custom cell renderer, as shown below.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ja.asciidoc
index 4884d07..eaa91b6 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ja.asciidoc
@@ -76,16 +76,16 @@
* 「メイン・クラスの作成」チェックボックスを選択解除します。
-[start=4]
+
. 「終了」をクリックしてウィザードを終了し、プロジェクトを設定します。
-[start=5]
+
. 「プロジェクト」ウィンドウで「NumberSlider」プロジェクト・ノードを右クリックし、「新規」>「JFrameフォーム」を選択します。
(「JFrameフォーム」が「新規」メニューにない場合は、「その他」を選択します。次に、新規ファイル・ウィザードで「Swing GUIフォーム」カテゴリを選択してから「JFrameフォーム」テンプレートを選択します。)
-[start=6]
+
. ウィザードの名前と場所ページで、次の操作を行います。
* クラス名に「 ``NumberSliderFrame`` 」と入力します。
* パッケージ名に「 ``numberslider`` 」と入力します。
@@ -96,16 +96,16 @@
--
-[start=7]
+
. 「終了」をクリックしてウィザードを終了し、フォームを作成します。
``NumberSliderFrame.java`` が編集領域にデザイン・モードで開きます。
-[start=8]
+
. パレットの「Swingコントロール」セクションからスライダ・コンポーネントをデザイン領域までドラッグします。「パレット」ウィンドウが開いていない場合は、「ウィンドウ」>「パレット」を選択します。
-[start=9]
+
. パレットから、テキスト・フィールド・コンポーネントをデザイン領域までドラッグします。
フォームは次のスクリーンショットのようになります。この例では、配置は重要ではありません。
@@ -138,7 +138,7 @@
--
-[start=4]
+
. 「OK」をクリックします。
これで、スライダの「 ``value`` 」Beanプロパティがテキスト・フィールドの「 ``text`` 」の値にバインドされました。
@@ -241,7 +241,7 @@
--
-[start=4]
+
. ウィザードのエンティティ・クラス・ページで、「持続フィールド用のNamedQuery注釈を生成」および「持続性ユニットを作成」チェックボックスが選択されていることを確認します。
[.feature]
@@ -250,10 +250,10 @@
--
-[start=5]
+
. 生成されたクラスの名前と場所をカスタマイズします。
-[start=6]
+
. 「終了」をクリックします。
「プロジェクト」ウィンドウにエンティティ・クラスのノードが表示されます。
@@ -272,10 +272,10 @@
ユーザーIDおよびパスワードを求められたら、 ``app`` をユーザーID、 ``app`` をパスワードとして指定します。
-[start=3]
+
. 接続のノードを展開し、「表」ノードを展開します。
-[start=4]
+
. 表のノードをフォームにドラッグし、[Ctrl]を押しながら表にドロップします。
JTableが作成され、その列はデータベース表の列にバインドされます。
@@ -290,10 +290,10 @@
--
-[start=2]
+
. 「データをフォームにインポート」をクリックします。「データをフォームにインポート」ダイアログ・ボックスで、コンポーネントをバインドするデータベース表を選択します。「OK」をクリックします。
-[start=3]
+
. 「ソースをバインディング」コンボ・ボックスで、エンティティ・クラスの結果リストを表す項目を選択します。たとえば、エンティティ・クラスの名前が ``Customer.java`` の場合、listオブジェクトは ``customerList`` として生成されます。
[.feature]
@@ -302,16 +302,16 @@
--
-[start=4]
+
. 「式をバインディング」の値は「 ``null`` 」のままにしてください。
-[start=5]
+
. JTableに表示しないデータベース列がある場合は、「選択」リストでそれらの列を選択して「使用可能」リストに移動します。
-[start=6]
+
. さらにバインディングを構成するには、「詳細」タブを選択します。たとえば、バリデータやコンバータを指定したり、バインディング・ソースがnullまたは読取り不能な場合の動作を指定することができます。
-[start=7]
+
. 「OK」をクリックします。
*データをJListコンポーネントにバインドする*
@@ -326,16 +326,16 @@
--
-[start=4]
+
. 「式をバインディング」の値は「 ``null`` 」のままにしてください。
-[start=5]
+
. 「式を表示」ドロップダウン・リストで、リストに表示する値を含むデータベース列を表すプロパティを選択します。
-[start=6]
+
. さらにバインディングを構成するには、「詳細」タブを選択します。
-[start=7]
+
. 「OK」をクリックします。
*データをJComboBoxコンポーネントにバインドする*
@@ -350,19 +350,19 @@
--
-[start=4]
+
. 「式をバインディング」の値を「 ``null`` 」のままにして、「OK」をクリックします。
-[start=5]
+
. コンボ・ボックスをもう一度右クリックし、「バインド」>「selectedItem」を選択します。
-[start=6]
+
. ユーザーの選択によって影響の出るプロパティにバインドします。
image::images/combo-item.png[]
-[start=7]
+
. 「OK」をクリックして編集を保存します。
JComboBoxの_display_値を取得する方法を指定できるDetailBindingクラスは、バージョン1.2.1時点ではBeans Bindingライブラリにありません。このため、カスタム・コードを記述する必要があります。1つの方法として、次に示すようにカスタムのセル・レンダラを記述できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_pt_BR.asciidoc
index 7505a3f..471422b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_pt_BR.asciidoc
@@ -76,16 +76,16 @@
* Desmarque a caixa de seleção Criar Classe Principal.
-[start=4]
+
. Clique em Finalizar para sair do assistente e configurar o projeto.
-[start=5]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto NumberSlider e selecione Novo > Form JFrame.
(Se o form JFrame não estiver disponível no menu Novo, escolha Outro. Em seguida, no assistente para Novo Arquivo, selecione a categoria Forms de GUI Swing e selecione o modelo Form JFrame.)
-[start=6]
+
. Na página Nome e Localização do assistente, realize as seguintes operações:
* Digite ``NumberSliderFrame`` para o nome da classe.
* Digite ``numberslider`` como o nome do pacote.
@@ -96,16 +96,16 @@
--
-[start=7]
+
. Clique em Finalizar para sair do assistente e criar o form.
``NumberSliderFrame.java`` deve ser aberto no modo de design na área de edição.
-[start=8]
+
. Na seção Controles Swing da Paleta, arraste um componente de controle deslizante para a área de design. (Se a janela Paleta não estiver aberta, escolha Janela > Paleta).
-[start=9]
+
. Da Paleta, arraste um componente de campo de texto para a área de design.
O form resultante é parecido com a tela abaixo. Entretanto, o posicionamento não é importante para fins deste exemplo.
@@ -138,7 +138,7 @@
--
-[start=4]
+
. Clique em OK.
Você acabou de vincular a propriedade de bean ``value`` do controle deslizante ao valor ``text`` do campo de texto.
@@ -241,7 +241,7 @@
--
-[start=4]
+
. Na página Classes de Entidade do assistente, verifique se as caixas de seleção Gerar Anotações de Consulta Nomeada e Criar Unidades Persistentes estão selecionadas.
[.feature]
@@ -250,10 +250,10 @@
--
-[start=5]
+
. Faça quaisquer personalizações que desejar nos nomes das classes geradas e em sua localização.
-[start=6]
+
. Clique em Finalizar.
Você deve ver nós das classes de entidade na janela Projetos.
@@ -272,10 +272,10 @@
Especifique ``app`` como id do usuário e ``app`` como senha, se for solicitado um id do usuário e uma senha.
-[start=3]
+
. Expanda o nó da conexão e expanda seu nó Tabelas.
-[start=4]
+
. Arraste o nó para a tabela no form e pressione Ctrl enquanto arrasta a tabela.
Um JTable é criado e suas colunas são vinculadas às colunas na tabela do banco de dados.
@@ -290,10 +290,10 @@
--
-[start=2]
+
. Clique em Importar Dados para Form. Na caixa de diálogo Importar Dados para Form, selecione a tabela de banco de dados a qual você deseja vincular seus componentes. Clique em OK.
-[start=3]
+
. Na caixa de combinação Vincular Origem, selecione o item que representa a lista de resultados da classe da entidade. Por exemplo, se a classe da entidade for chamada, ``Customer.java`` , o objeto da lista seria gerado como ``customerList`` .
[.feature]
@@ -302,16 +302,16 @@
--
-[start=4]
+
. Deixe o valor Expressão de Vinculação como ``nulo`` .
-[start=5]
+
. Se houver quaisquer colunas de banco de dados que você deseja que apareça na JTable, selecione essas colunas na lista Selecionado e mova-as para a lista Disponível.
-[start=6]
+
. Selecione a guia Avançado para configurar a vinculação. Por exemplo, você pode especificar um validador ou conversor, ou pode especificar o comportamento se a origem da vinculação for nula ou ilegível.
-[start=7]
+
. Clique em OK.
*Para vincular os dados a um componente JList:*
@@ -326,16 +326,16 @@
--
-[start=4]
+
. Deixe o valor Expressão de Vinculação como ``nulo`` .
-[start=5]
+
. Na lista drop-down Exibir expressão, selecione a propriedade que representa a coluna do banco de dados que contém os valores que você deseja exibir na lista.
-[start=6]
+
. Selecione a guia Avançado para configurar a vinculação.
-[start=7]
+
. Clique em OK.
*Para vincular os dados a um componente JComboBox:*
@@ -350,19 +350,19 @@
--
-[start=4]
+
. Deixe o valor da Expressão de Vinculação como ``nulo`` e clique em OK.
-[start=5]
+
. Clique com o botão direito do mouse na caixa de combinação novamente e escolha Vincular > Item selecionado.
-[start=6]
+
. Vincule à propriedade que você deseja que seja afetada pela seleção do usuário.
image::images/combo-item.png[]
-[start=7]
+
. Clique em OK para salvar suas edições.
A biblioteca Vinculação de Beans (a partir da versão 1.2.1) não possui uma classe DetailBinding que permite que você especifique como derivar os valores de _exibição_ de JComboBox. Portanto, você precisará escrever algum código personalizado. Uma abordagem é escrever um renderizador de célula personalizado, como mostrado abaixo.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ru.asciidoc
index 0a971ec..f2cad3d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_ru.asciidoc
@@ -76,16 +76,16 @@
* Снимите флажок "Создать главный класс".
-[start=4]
+
. Нажмите кнопку Finish ("Готово"), чтобы выйти из мастера и приступить к настройке проекта.
-[start=5]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел проекта NumberSlider и выберите 'Создать' > 'Форма JFrame'.
(Если пункт JFrame Form отсутствует в меню New, выберите пункт Other ("Другое"). Затем в мастере создания файлов выберите категорию Swing GUI Forms ("Формы графического интерфейса Swing") и затем выберите шаблон JFrame Form.)
-[start=6]
+
. На странице Name and Location ("Имя и местоположение") мастера выполните следующие операции:
* Введите ``NumberSliderFrame`` в поле имени класса.
* Введите ``numberslider`` в поле имени пакета.
@@ -96,16 +96,16 @@
--
-[start=7]
+
. Нажмите кнопку Finish ("Готово") для выхода из мастера и создания формы.
В области редактирования должен открыться файл ``NumberSliderForm.java`` в режиме проектирования.
-[start=8]
+
. Перетащите компонент ползунка в область проектирования из раздела Swing ("Элементы управления Swing") в Palette ("Палитра"). (Если окно палитры не открыто, выберите Window ("Окно") > Palette ("Палитра")).
-[start=9]
+
. Перетащите компонент текстового поля в область проектирования из окна палитры.
Полученная форма может выглядеть подобно приведенному ниже снимку экрана. Но для данного примера позиция не важна.
@@ -138,7 +138,7 @@
--
-[start=4]
+
. Нажмите кнопку "ОК".
Мы только что привязали свойство компонента ползунка ``value`` ("значение") к значению текстового поля ``text`` ("текст").
@@ -241,7 +241,7 @@
--
-[start=4]
+
. На странице мастера Entity Classes ("Сущностные классы") убедитесь, что установлены флажки Generate Named Query Annotations for Persistent Fields ("Создать аннотации именованных запросов для полей ") и Create Persistence Unit ("Создать блок сохранения состояния").
[.feature]
@@ -250,10 +250,10 @@
--
-[start=5]
+
. Внесите любые необходимые изменения в имена и местоположение созданных классов.
-[start=6]
+
. Нажмите кнопку "Завершить".
Узлы для сущностных классов можно будет увидеть в окне Projects ("Проекты").
@@ -272,10 +272,10 @@
При появлении соответствующего запроса укажите значение ``app`` в качестве идентификатора пользователя и то же значение ``app`` в качестве пароля.
-[start=3]
+
. Разверните узел для подключения и разверните его узел Tables ("Таблицы").
-[start=4]
+
. Перетащите узел для таблицы на форму и нажмите клавишу Ctrl при завершении перетаскивания таблицы.
Будет создана таблица JTable, и ее столбцы будут привязаны к столбцам в таблице базы данных.
@@ -290,10 +290,10 @@
--
-[start=2]
+
. Нажмите кнопку Import Data to Form ("Импортировать данные в форму"). В диалоговом окне Import Data to Form ("Импортировать данные в форму") выберите таблицу данных, к которой следует привязать свои компоненты. Нажмите кнопку "ОК".
-[start=3]
+
. Из поля со списком Binding Source ("Источник привязки") выберите элемент, представляющий результирующий список сущностного класса. Например, если сущностный класс называется ``Customer.java`` , объект списка будет создан как ``customerList`` .
[.feature]
@@ -302,16 +302,16 @@
--
-[start=4]
+
. Значением выражения привязки оставьте ``null`` .
-[start=5]
+
. При наличии столбцов баз данных, которые не следует включать в JTable, выберите эти столбцы в списке Selected ("Выбранные") и переместите их в список Available ("Доступные").
-[start=6]
+
. Выберите вкладку Advanced ("Дополнительные") для расширенной настройки привязки. Там, например, можно указать средство проверки или преобразователь, либо поведение в случае, если источник привязки не читается или имеет значение null.
-[start=7]
+
. Нажмите кнопку "ОК".
*Для привязки данных к компоненту JList выполните следующие действия.*
@@ -326,16 +326,16 @@
--
-[start=4]
+
. Значением выражения привязки оставьте ``null`` .
-[start=5]
+
. В раскрывающемся списке Display Expression ("Отображаемое выражение") выберите свойство, представляющее столбец базы данных, содержащий значения, которые необходимо отобразить в списке.
-[start=6]
+
. Выберите вкладку Advanced ("Дополнительные") для расширенной настройки привязки.
-[start=7]
+
. Нажмите кнопку "ОК".
*Для привязки данных к компоненту JComboBox выполните следующие действия.*
@@ -350,19 +350,19 @@
--
-[start=4]
+
. Оставьте значением Binding Expression ("Выражение привязки") ``null`` и нажмите кнопку "OК".
-[start=5]
+
. Вновь щелкните правой кнопкой мыши поле со списком и выберите "Bind > selectedItem".
-[start=6]
+
. Выполните привязку к свойству, на котором должен сказываться выбор пользователя
image::images/combo-item.png[]
-[start=7]
+
. Нажмите кнопку "ОК", чтобы сохранить изменения.
У библиотеки привязки компонентов (версии 1.2.1 и более ранних) нет класса DetailBinding, позволяющего указать, как следует извлекать _отображаемые_ значения для JComboBox. Так что необходимо будет написать немного собственного кода. Одним из подходов является написание собственного визуализатора ячеек, как показано ниже.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_zh_CN.asciidoc
index cc8570b..1d5679a 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-binding_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-binding_zh_CN.asciidoc
@@ -76,16 +76,16 @@
* 清除 "Create Main Class"(创建主类)复选框。
-[start=4]
+
. 单击 "Finish"(完成)退出向导并设置项目。
-[start=5]
+
. 在 "Projects"(项目)窗口中,右键单击 NumberSlider 项目节点并选择 "New"(新建)> "JFrame Form"(JFrame 窗体)。
(如果 "JFrame Form"(JFrame 窗体)在 "New"(新建)菜单中不可用,则选择 "Other"(其他)。然后在新建文件向导中,选择 "Swing GUI Forms"(Swing GUI 窗体)类别,然后选择 "JFrame Form"(JFrame 窗体)模板。)
-[start=6]
+
. 在向导的 "Name and Location"(名称和位置)页中,执行以下操作:
* 为类名键入 ``NumberSliderFrame`` 。
* 为包名键入 ``numberslider`` 。
@@ -96,16 +96,16 @@
--
-[start=7]
+
. 单击 "Finish"(完成)退出向导并创建窗体。
``NumberSliderFrame.java`` 应以设计模式在编辑区域中打开。
-[start=8]
+
. 从组件面板的 "Swing Controls"(Swing 控件)部分,将一个滑块组件拖至设计区域。(如果 "Palette"(组件面板)窗口未打开,请选择 "Window"(窗口)> "Palette"(组件面板)。)
-[start=9]
+
. 从组件面板中,将一个文本字段组件拖至设计区域。
生成的窗体可能类似于下面的屏幕快照。不过,对于本示例而言,定位并不重要。
@@ -138,7 +138,7 @@
--
-[start=4]
+
. 单击 "OK"(确定)。
刚才将滑块的 ``value`` Bean 属性绑定到了文本字段的 ``text`` 值。
@@ -241,7 +241,7 @@
--
-[start=4]
+
. 在该向导的 "Entity Classes"(实体类)页中,确保选中了 "Generate Named Query Annotations for Persistent Fields"(为持久性字段生成已命名的查询标注)和 "Create Persistence Unit"(创建持久性单元)复选框。
[.feature]
@@ -250,10 +250,10 @@
--
-[start=5]
+
. 对生成类的名称及其位置进行任何所需的定制。
-[start=6]
+
. 单击 "Finish"(完成)。
在 "Projects"(项目)窗口中,您会看到实体类的节点。
@@ -272,10 +272,10 @@
如果系统提示您提供用户 ID 和口令,请指定 ``app`` 作为用户 ID,并指定 ``app`` 作为口令。
-[start=3]
+
. 展开用于连接的节点,并展开其表节点。
-[start=4]
+
. 将表节点拖到窗体并在拖至表时按住 Ctrl 键。
这将创建 JTable,并将其列绑定到数据库表中的列。
@@ -290,10 +290,10 @@
--
-[start=2]
+
. 单击 "Import Data to Form"(将数据导入窗体)。在 "Import Data to Form"(将数据导入窗体)对话框中,选择要将组件绑定到的数据库表。单击 "OK"(确定)。
-[start=3]
+
. 在 "Binding Source"(绑定源)组合框中,选择表示实体类结果列表的项。例如,如果调用实体类 ``Customer.java`` ,则列表对象将生成为 ``customerList`` 。
[.feature]
@@ -302,16 +302,16 @@
--
-[start=4]
+
. 将绑定表达式的值保留为 ``空值`` 。
-[start=5]
+
. 如果不想在 JTable 中显示某些数据库列,请在 "Selected"(选定)列表中选择这些列,然后将它们移到 "Available"(可用)列表中。
-[start=6]
+
. 选择 "Advanced"(高级)标签进一步配置绑定内容。例如,您可以指定验证器或转换器,或者指定绑定源为空值或不可读时的行为。
-[start=7]
+
. 单击 "OK"(确定)。
*将数据绑定到 JList 组件:*
@@ -326,16 +326,16 @@
--
-[start=4]
+
. 将绑定表达式的值保留为 ``空值`` 。
-[start=5]
+
. 在 "Display Expression"(显示表达式)下拉列表中,选择表示数据库列的属性,该列包含了要在列表中显示的值。
-[start=6]
+
. 选择 "Advanced"(高级)标签进一步配置绑定内容。
-[start=7]
+
. 单击 "OK"(确定)。
*将数据绑定到 JComboBox 组件:*
@@ -350,19 +350,19 @@
--
-[start=4]
+
. 将绑定表达式值保留为 ``空值`` ,然后单击 "OK"(确定)。
-[start=5]
+
. 再次右键单击组合框,然后选择 "Bind"(绑定)> "selectedItem"。
-[start=6]
+
. 绑定到您希望受用户选择影响的属性。
image::images/combo-item.png[]
-[start=7]
+
. 单击 "OK"(确定)保存所做的编辑。
Bean 绑定库(从版本 1.2.1 起)没有 DetailBinding 类,该类用于指定如何为 JComboBox 派生 _display_ 值。因此,您需要编写一些定制代码。一种方法是编写定制单元格呈现器,如下所示。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser.asciidoc
index 203dbbe..cd72e82 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser.asciidoc
@@ -64,7 +64,7 @@
--
-[start=4]
+
. Click Finish.
@@ -84,10 +84,10 @@
--
-[start=4]
+
. Click Finish.
-[start=5]
+
. In the Properties window, enter `Demo application` for the Title property and press Enter to confirm.
*To add components to the JFrame form:*
@@ -102,10 +102,10 @@
--
-[start=2]
+
. Right-click the Edit item of the Menu Bar component and select Delete in the context menu.
-[start=3]
+
. To add a menu item that allows to open FileChooser from the running application, in the Swing Menus category in the Palette, select a new Menu Item (JMenuItem1), drag it to the Menu Bar, and drop it to the File item of the Menu Bar.
[.feature]
@@ -116,19 +116,19 @@
*Note: * Make sure the Menu Bar is selected before dragging another Menu Item there in order to have the latter added to the Menu Bar.
-[start=4]
+
. Right-click the jMenuItem1 in the Design view and choose Change Variable Name from the context menu. Rename the item to `Open` and click OK.
-[start=5]
+
. Make sure that the jMenuItem1 is still selected in the Design view. Press the Space bar to edit the text of the component. Change the text to `Open` and press Enter to confirm.
-[start=6]
+
. Specify the action handler for the Open menu item. Right-click the menu item and choose Events > Action > action Performed from the context menu. The GUI Builder automatically switches to the Source view and a new event handler method named ``OpenActionPerformed()`` is generated. The Navigator window should look as follows:
image::images/openactionperformednavigator.png[]
-[start=7]
+
. To add a menu item to exit FileChooser from the application being created, switch back into the Design mode, in the Swing Menus category in the Palette, select a Menu Item (JMenuItem1) and drag it to the Menu Bar below the Open menu item. Notice orange highlighting that indicates where the ``JMenuItem1`` is going to be placed.
[.feature]
@@ -137,16 +137,16 @@
--
-[start=8]
+
. Right-click ``jMenuItem1`` in the Design view and choose Change Variable Name from the context menu. Rename the item to `Exit` and click OK.
-[start=9]
+
. Make sure that the ``jMenuItem1`` is still selected in the Design view. Press the Space bar to edit the text of the component. Change the text to ``Exit`` and press Enter to confirm.
-[start=10]
+
. Specify the action handler for the Exit menu item. Right-click the menu item and choose Events > Action > action Performed from the context menu. The GUI Builder automatically switches to the Source view and a new event handler method is generated which is named `ExitActionPerformed()`.The `ExitActionPerformed` node appears in the Navigator window below the `OpenActionPerformed()` node.
-[start=11]
+
. To make the Exit menu item work, you include the following source into the `ExitActionPerformed()` method body:
[source,java]
@@ -155,7 +155,7 @@
System.exit(0);
----
-[start=12]
+
. Switch back into Design mode. From the Swing Controls category of the Palette, drag a Text Area ( ``JTextArea`` ) into the form like shown in the picture below.
[.feature]
@@ -164,7 +164,7 @@
--
-[start=13]
+
. Resize the added component to make room for the text displayed by the File Chooser later. Rename the variable to `textarea`. The form should look like the following screenshot:
[.feature]
@@ -183,10 +183,10 @@
As an alternative to the ``Add From Palette`` context menu, you can also drag and drop a ``JFileChooser`` component from the Swing Window category of the Palette to the white area of the GUI builder. It will have the same result, but it is a bit harder, because the preview of the ``JFileChooser`` is rather big and you might accidentally insert the window into one of the panels, which is not what you want.
-[start=3]
+
. A look in the Navigator confirms that a ``JFileChooser`` was added to the form.
-[start=4]
+
. Right-click the ``JFileChooser`` node and rename the variable to `fileChooser`.
image::images/navigator_jframe.png[]
@@ -224,7 +224,7 @@
*Note: * Remove the first and last lines of the code snippet that duplicate the existing ones in the source file.
-[start=3]
+
. If the editor reports errors in your code, right-click anywhere in the code and select Fix Imports or press Ctrl+Shift+I. In the Fix All Imports dialog box accept the defaults to update the import statements and click OK.
As you can see, you call the FileChooser's ``getSelectedFile()`` method to determine which file the user clicked, so you can work with it. This example reads the file contents and displays them in the TextArea.
@@ -244,7 +244,7 @@
--
-[start=4]
+
. Type the following in the text field:
[source,java]
@@ -253,10 +253,10 @@
new MyCustomFilter()
----
-[start=5]
+
. Click OK.
-[start=6]
+
. To make the custom code work, you write an inner (or outer) class ``MyCustomFilter`` that extends the ``FileFilter`` class. Copy and paste the following code snippet into the source of your class below the import statements to create an inner class implementing the filter.
[source,java]
@@ -288,7 +288,7 @@
image::images/run.png[]
-[start=3]
+
. In the running Demo application, choose Open in the File menu to trigger the action. The result should look like this:
[.feature]
@@ -297,7 +297,7 @@
--
-[start=4]
+
. To close the application, select Exit in the File menu.
Have a look at other useful Swing windows and dialogs like the ColorChooser or the OptionPane in the GUI Palette.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ja.asciidoc
index 92eac3f..282ba4e 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ja.asciidoc
@@ -64,7 +64,7 @@
--
-[start=4]
+
. 「終了」をクリックします。
@@ -84,10 +84,10 @@
--
-[start=4]
+
. 「終了」をクリックします。
-[start=5]
+
. 「プロパティ」ウィンドウで、「タイトル」プロパティに「`デモ・アプリケーション`」と入力し、[Enter]を押して確認します。
*JFrameフォームにコンポーネントを追加するには:*
@@ -102,10 +102,10 @@
--
-[start=2]
+
. 「メニュー・バー」コンポーネントの「編集」項目を右クリックし、コンテキスト・メニューの「削除」を選択します。
-[start=3]
+
. 実行中のアプリケーションからFileChooserを開くことができるメニュー項目を追加するには、パレットの「Swingメニュー」カテゴリで新しい「メニュー項目」(JMenuItem1)を選択し、それを「メニュー・バー」にドラッグして「メニュー・バー」の「ファイル」項目にドロップします。
[.feature]
@@ -116,19 +116,19 @@
*注意:* 別の「メニュー項目」をドラッグする場合は、それが「メニュー・バー」に追加されるように、その前に「メニュー・バー」が選択されていることを確認してください。
-[start=4]
+
. 「デザイン」ビューで「jMenuItem1」を右クリックし、コンテキスト・メニューから「変数名を変更」を選択します。項目の名前を「`Open`」に変更し、「OK」をクリックします。
-[start=5]
+
. 「デザイン」ビューで「jMenuItem1」が引続き選択されていることを確認します。[Space]バーを押して、コンポーネントのテキストを編集します。テキストを「`開く`」に変更し、[Enter]を押して確認します。
-[start=6]
+
. 「開く」メニュー項目のアクション・ハンドラを指定します。メニュー項目を右クリックし、コンテキスト・メニューから「イベント」>「アクション」>「actionPerformed」を選択します。GUIビルダーによって自動的に「ソース」ビューに切り替えられ、 ``OpenActionPerformed()`` という名前の新しいイベント・ハンドラ・メソッドが生成されます。「ナビゲータ」ウィンドウは次のようになります。
image::images/openactionperformednavigator.png[]
-[start=7]
+
. 作成されているアプリケーションからFileChooserを終了するためのメニュー項目を追加するには、「デザイン」モードに戻ってパレットの「Swingメニュー」カテゴリで「メニュー項目」(JMenuItem1)を選択し、それを「開く」メニュー項目の下にある「メニュー・バー」にドラッグします。オレンジ色の強調表示は ``JMenuItem1`` が配置される場所を示しています。
[.feature]
@@ -137,16 +137,16 @@
--
-[start=8]
+
. 「デザイン」ビューで「 ``jMenuItem1`` 」を右クリックし、コンテキスト・メニューから「変数名を変更」を選択します。項目の名前を「`Exit`」に変更し、「OK」をクリックします。
-[start=9]
+
. 「デザイン」ビューで「 ``jMenuItem1`` 」が引続き選択されていることを確認します。[Space]バーを押して、コンポーネントのテキストを編集します。テキストを「 ``終了`` 」に変更し、[Enter]を押して確認します。
-[start=10]
+
. 「終了」メニュー項目のアクション・ハンドラを指定します。メニュー項目を右クリックし、コンテキスト・メニューから「イベント」>「アクション」>「actionPerformed」を選択します。GUIビルダーによって自動的に「ソース」ビューに切り替えられ、`ExitActionPerformed()`という名前の新しいイベント・ハンドラ・メソッドが生成されます。「ナビゲータ」ウィンドウの「`OpenActionPerformed()`」ノードの下に「`ExitActionPerformed`」ノードが表示されます。
-[start=11]
+
. 「終了」メニュー項目を機能させるには、`ExitActionPerformed()`メソッドの本文に次のソースを追加します。
[source,java]
@@ -155,7 +155,7 @@
System.exit(0);
----
-[start=12]
+
. 「デザイン」モードに戻ります。次の図に示すように、パレットの「Swingコントロール」カテゴリから「テキスト領域」( ``JTextArea`` )をフォームにドラッグします。
[.feature]
@@ -164,7 +164,7 @@
--
-[start=13]
+
. 追加されたコンポーネントのサイズを変更して、後でファイル・チューザによって表示されるテキストの領域を確保します。変数の名前を「`textarea`」に変更します。フォームは次のスクリーンショットのようにします。
[.feature]
@@ -183,10 +183,10 @@
「 ``パレットから追加`` 」コンテキスト・メニューのかわりに、パレットの「Swingウィンドウ」カテゴリから、 ``JFileChooser`` コンポーネントをGUIビルダーの白い領域にドラッグ・アンド・ドロップすることもできます。それでも同じ結果になりますが操作が難しくなり、 ``JFileChooser`` のプレビューが非常に大きいため、ウィンドウを誤ってパネルに挿入して望まない結果になる可能性があります。
-[start=3]
+
. ナビゲータを見ると、 ``JFileChooser`` がフォームに追加されたことを確認できます。
-[start=4]
+
. 「 ``JFileChooser`` 」ノードを右クリックし、変数の名前を「`fileChooser`」に変更します。
image::images/navigator_jframe.png[]
@@ -224,7 +224,7 @@
*注意:* このコード・スニペットの最初と最後の行は、ソース・ファイル内の既存の行と重複するため、除去してください。
-[start=3]
+
. エディタによってコード内のエラーが報告された場合は、コード内の任意の場所を右クリックして「インポートを修正」を選択するか、または[Ctrl]+[Shift]+[I]を押します。「すべてのインポートを修正」ダイアログ・ボックスで、デフォルトを受け入れてインポート文を更新し、「OK」をクリックします。
このように、FileChooserの ``getSelectedFile()`` メソッドをコールしてユーザーがクリックしたファイルを判定し、それを処理できます。この例では、ファイルの内容を読み取ってテキスト領域に表示します。
@@ -244,10 +244,10 @@
--
-[start=4]
+
. テキスト・フィールドに「 ``new MyCustomFilter()`` 」と入力します。「OK」をクリックします。
-[start=5]
+
. このカスタム・コードを機能させるには、 ``FileFilter`` クラスを拡張する内部(または外部)クラス ``MyCustomFilter`` を記述します。次のコード・スニペットをクラスのソースのインポート文の下にコピーして貼り付け、このフィルタを実装する内部クラスを作成します。
[source,java]
@@ -279,7 +279,7 @@
image::images/run.png[]
-[start=3]
+
. 実行中のデモ・アプリケーションで、「ファイル」メニューの「開く」を選択してアクションをトリガーします。結果は次のようになります。
[.feature]
@@ -288,7 +288,7 @@
--
-[start=4]
+
. アプリケーションを終了するには、「ファイル」メニューの「終了」を選択します。
他にも、GUIパレットのColorChooserやOptionPaneなどの便利なSwingウィンドウやダイアログを試してみてください。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_pt_BR.asciidoc
index 776a068..3b02a77 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_pt_BR.asciidoc
@@ -64,7 +64,7 @@
--
-[start=4]
+
. Clique em Finalizar.
@@ -84,10 +84,10 @@
--
-[start=4]
+
. Clique em Finalizar.
-[start=5]
+
. Na janela Propriedades, insira `Aplicação de demonstração` para a propriedade Título e pressione Enter para confirmar.
*Para adicionar componentes ao form JFrame:*
@@ -102,10 +102,10 @@
--
-[start=2]
+
. Clique com o botão direito do mouse no item Editar do componente Barra de Menus e selecione Deletar no menu de contexto.
-[start=3]
+
. Para adicionar um item de menu que permita abrir o FileChooser a partir da aplicação em execução, na categoria Menus Swing na Paleta, selecione um novo item de menu (JMenuItem1) e arraste-o para a Barra de Menus e solte-o no item Arquivo na Barra de Menus.
[.feature]
@@ -116,19 +116,19 @@
*Observação:* assegure-se de que a Barra de Menus esteja selecionada antes de arrastar outro item de menu para ela para que o último seja adicionado na barra de menus.
-[start=4]
+
. Clique com o botão direito do mouse em jMenuItem1 na view Design e escolha Alterar Nome da Variável no menu de contexto. Renomeie o item como `Abrir` e clique em OK.
-[start=5]
+
. Assegure-se de que o jMenuItem1 ainda esteja selecionado na view Design. Pressione a barra de Espaço para editar o texto do componente. Altere o texto para `Abrir` e pressione Enter para confirmar.
-[start=6]
+
. Especifique o handler de ação para o item de menu Abrir. Clique com o botão direito do mouse no item do menu e escolha Eventos > Ação > Ação executada do menu de contexto. O GUI Builder alterna automaticamente para a view do Código-fonte e um novo método do handler de evento ``OpenActionPerformed()`` é gerado. A janela do Navegador deveria se semelhante a esta:
image::images/openactionperformednavigator.png[]
-[start=7]
+
. Para adicionar um item de menu para sair do FileChoser antes da aplicação ter sido criada, alterne de volta para o modo Design, na categoria Menu Swing na Paleta, selecione um item de menu (JMenuItem1) e arraste-o para a Barra de Menus abaixo do item de menu Abrir. Observe que o realce laranja indica onde o ``JMenuItem1`` será colocado.
[.feature]
@@ -137,16 +137,16 @@
--
-[start=8]
+
. Clique com o botão direito do mouse em ``jMenuItem1`` na view Design e escolha Alterar Nome da Variável no menu de contexto. Renomeie o item como `Sair` e clique em OK.
-[start=9]
+
. Assegure-se de que o ``jMenuItem1`` ainda esteja selecionado na view Design. Pressione a barra de Espaço para editar o texto do componente. Altere o texto para ``Sair`` e pressione Enter para confirmar.
-[start=10]
+
. Especifique o handler de ação para o item de menu Sair. Clique com o botão direito do mouse no item do menu e escolha Eventos > Ação > Ação executada do menu de contexto. O GUI Builder alterna automaticamente para a view do Código-fonte e um novo método de handler de evento é gerado, denominado `ExitActionPerformed()`. O nó `ExitActionPerformed` aparece na janela do Navegador abaixo do nó `OpenActionPerformed()`.
-[start=11]
+
. Para fazer com que o item de menu Sair funcione, você inclui o seguinte código-fonte no corpo do método `ExitActionPerformed`:
[source,java]
@@ -155,7 +155,7 @@
System.exit(0);
----
-[start=12]
+
. Volte para o modo Design. Na categoria Controles de Swing da Paleta, arraste uma Área de Texto ( ``JTextArea`` ) para o form, como mostrado na figura abaixo.
[.feature]
@@ -164,7 +164,7 @@
--
-[start=13]
+
. Redimensione o componente adicionado para criar espaço para o texto exibido mais tarde pelo Seletor de Arquivos. Renomeie a variável para `textarea`. O form deve parecer com a tela a seguir:
[.feature]
@@ -183,10 +183,10 @@
Como uma alternativa para o menu de contexto ``Adicionar da Paleta`` , você também pode arrastar e soltar um componente ``JFileChooser`` da categoria Janelas Swing da Paleta para a área branca do GUI Builder. Isso terá o mesmo resultado, mas é um pouco mais difícil porque a exibição do ``JFileChooser`` é um pouco grande e você poderá acidentalmente inserir a janela em um dos painéis, o que não é o desejado.
-[start=3]
+
. Um exame no Navegador confirma que um ``JFileChooser`` foi adicionado ao form.
-[start=4]
+
. Clique com o botão direito do mouse no nó ``JFileChooser`` e renomeie a variável para `fileChooser`.
image::images/navigator_jframe.png[]
@@ -224,7 +224,7 @@
*Observação: * Remova primeira e a última linha do snippet de código que duplicam os existentes no arquivo de código-fonte.
-[start=3]
+
. Se o editor relata erros em seu código, clique com o botão direito do mouse em qualquer lugar no código e selecione Corrigir Importações ou pressione Ctrl+Shift+I. Na caixa de diálogo Corrigir Todas as Importações aceite os defaults para atualizar as instruções de importação e clique em OK.
Como é possível ver, o método ``getSelectedFile()`` do Seletor de Arquivos é chamado para determinar em que arquivo o usuário clicou, para que você possa trabalhar com ele. Esse exemplo lê o conteúdo do arquivo e o exibe na Área de Texto.
@@ -244,10 +244,10 @@
--
-[start=4]
+
. Digite ``new MyCustomFilter()`` no campo de texto. Clique em OK.
-[start=5]
+
. Para fazer com que o código personalizado funcione, você escreve uma classe interna (ou externa) ``MyCustomFilter`` que estende a classe ``FileFilter`` . Copie e cole o seguinte snippet de código no código-fonte de sua classe abaixo das instruções de importação, para criar um classe interna que implementa o filtro.
[source,java]
@@ -279,7 +279,7 @@
image::images/run.png[]
-[start=3]
+
. Na aplicação de Demonstração em execução, escolha Abrir no menu Arquivo para acionar a ação. O resultado deve ficar da seguinte forma:
[.feature]
@@ -288,7 +288,7 @@
--
-[start=4]
+
. Para fechar a aplicação, selecione Sair no menu Arquivo.
Examine outras janelas e caixas de diálogo úteis do Swing como o Seletor de Cores ou o Painel de Opções na Paleta GUI.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ru.asciidoc
index 3f7697d..2e9f511 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_ru.asciidoc
@@ -64,7 +64,7 @@
--
-[start=4]
+
. Нажмите кнопку "Завершить".
@@ -84,10 +84,10 @@
--
-[start=4]
+
. Нажмите кнопку "Завершить".
-[start=5]
+
. В окне "Свойства" введите `Demo application` в качестве свойства "Заголовок" и нажмите ENTER для подтверждения.
*Чтобы добавить компоненты к форме JFrame, выполните следующие действия.*
@@ -102,10 +102,10 @@
--
-[start=2]
+
. Правой кнопкой мыши щелкните элемент "Правка" компонента "Строка меню" и выберите в контекстном меню пункт "Удалить".
-[start=3]
+
. Чтобы добавить пункт меню, позволяющий открывать компонент FileChooser из выполняемого приложения, в категории "Меню Swing" в окне "Палитра" выберите новый пункт меню (JMenuItem1), перетащите его в элемент "Строка меню" и поместите его в поле "Файл" элемента "Строка меню".
[.feature]
@@ -116,19 +116,19 @@
*Примечание. * Убедитесь, что панель меню выбрана до перетаскивания другого элемента меню в него, чтобы добавить этот другой элемент на панель меню.
-[start=4]
+
. Правой кнопкой мыши щелкните элемент jMenuItem1 в режиме конструирования и выберите 'Изменить имя переменной' в контекстном меню. Измените имя элемента на `Open` и нажмите кнопку "ОК".
-[start=5]
+
. Убедитесь, что элемент jMenuItem1 все еще выбран в режиме проектирования. Нажмите клавишу ПРОБЕЛ, чтобы изменить текст компонента. Измените текст на `Open` и нажмите ENTER для подтверждения.
-[start=6]
+
. Укажите обработчик действий для пункта меню "Open". Правой кнопкой мыши щелкните пункт меню и выберите в контекстном меню "События >Действие > Выполненное действие". GUI Builder автоматически переключается в режим просмотра исходного кода, и создается новый метод обработчика событий с именем ``OpenActionPerformed()`` . Окно навигатора должно выглядеть следующим образом:
image::images/openactionperformednavigator.png[]
-[start=7]
+
. Чтобы добавить пункт меню для выхода элемента FileChooser из создаваемого приложения, вернитесь в режим проектирования, в категории "Меню Swing" в окне "Палитра" выберите пункт меню JMenuItem1 и перетащите его в элемент "Строка меню" под пункт меню "Open". Место вставки элемента ``JMenuItem1`` выделено оранжевым цветом.
[.feature]
@@ -137,16 +137,16 @@
--
-[start=8]
+
. Щелкните правой кнопкой мыши элемент ``jMenuItem1`` в режиме конструирования и выберите 'Изменить имя переменной' в контекстном меню. Измените имя элемента на `Exit` и нажмите кнопку "ОК".
-[start=9]
+
. Убедитесь, что элемент ``jMenuItem1`` все еще выбран в режиме конструирования. Нажмите клавишу ПРОБЕЛ, чтобы изменить текст компонента. Измените текст на ``Exit`` и нажмите ENTER для подтверждения.
-[start=10]
+
. Укажите обработчик действий для пункта меню "Exit". Правой кнопкой мыши щелкните пункт меню и выберите в контекстном меню "События >Действие > Выполненное действие". GUI Builder автоматически переключается в режим просмотра исходного кода, и создается новый метод обработчика событий с именем `ExitActionPerformed()`. В окне навигатора, под узлом `OpenActionPerformed()` отображается узел `ExitActionPerformed`.
-[start=11]
+
. Чтобы сделать пункт меню "Exit" рабочим, в тело метода `ExitActionPerformed()` необходимо включить следующий исходный код:
[source,java]
@@ -155,7 +155,7 @@
System.exit(0);
----
-[start=12]
+
. Переключитесь обратно в режим проектирования. Перетащите текстовую область ( ``JTextArea`` ) из категории 'Элементы управления Swing' палитры на форму, как показано на иллюстрации.
[.feature]
@@ -164,7 +164,7 @@
--
-[start=13]
+
. Измените размер компонента, чтобы оставить место для текста, который отобразится в выборе файлов позже. Измените имя переменной на `textarea`. Форма должна иметь следующий вид:
[.feature]
@@ -183,10 +183,10 @@
Помимо использования контекстного меню ``Добавить из палитры`` можно также перетащить компонент ``JFileChooser`` из категории 'Окно Swing' палитры на белое поле конструктора графического интерфейса. Вы получите тот же результат, но данный метод требует немного больше усилий, так как эскиз ``JFileChooser`` занимает достаточно большую область экрана и можно случайно вставить окно в одну из панелей, что не соответствует поставленной задаче.
-[start=3]
+
. Навигатор показывает, что элемент ``JFileChooser`` добавлен в форму.
-[start=4]
+
. Щелкните узел ``JFileChooser`` правой кнопкой мыши и измените имя переменной на `fileChooser`.
image::images/navigator_jframe.png[]
@@ -224,7 +224,7 @@
*Примечание. * Удалите первую и последнюю строку фрагмента кода, которые дублируют существующие строки в исходном файле.
-[start=3]
+
. Если редактор создает отчет об ошибках в коде, щелкните правой кнопкой мыши в любом месте кода и выберите 'Исправить выражения импорта' или нажмите Ctrl+Shift+I. В диалоговом окне 'Исправить все выражения импорта' примите значения по умолчанию для обновления операторов импорта и нажмите OK.
Итак, метод FileChooser ``getSelectedFile()`` вызывается для определения файла, выбранного пользователем, в целях дальнейшей работы с ним. В этом примере считывается содержимое файлов, которое затем отображается в TextArea.
@@ -244,10 +244,10 @@
--
-[start=4]
+
. Введите ``new MyCustomFilter()`` в текстовое поле. Нажмите кнопку "ОК".
-[start=5]
+
. Для использования пользовательского кода необходимо создать внутренний (или внешний) класс ``MyCustomFilter`` , расширяющий класс ``FileFilter`` . Чтобы создать внутренний класс, реализующий фильтр, скопируйте и вставьте следующий фрагмент кода в исходный код класса под операторами импорта.
[source,java]
@@ -279,7 +279,7 @@
image::images/run.png[]
-[start=3]
+
. В меню 'Файл' запущенного демо-приложения выберите 'Открыть', чтобы инициировать действие. Результат должен иметь следующий вид:
[.feature]
@@ -288,7 +288,7 @@
--
-[start=4]
+
. Чтобы закрыть приложение, выберите "Выход" в меню "Файл".
Следует обратить внимание на другие полезные окна и диалоговые окна Swing, например ColorChooser или OptionPane в палитре графического интерфейса.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_zh_CN.asciidoc
index 7bfde95..7a39605 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-filechooser_zh_CN.asciidoc
@@ -64,7 +64,7 @@
--
-[start=4]
+
. 单击 "Finish"(完成)。
@@ -84,10 +84,10 @@
--
-[start=4]
+
. 单击 "Finish"(完成)。
-[start=5]
+
. 在 "Properties"(属性)窗口中,输入 `Demo application` 作为 "Title"(标题)属性,然后按 Enter 键进行确认。
*将组件添加到 JFrame 窗体中:*
@@ -102,10 +102,10 @@
--
-[start=2]
+
. 右键单击 "Menu Bar"(菜单栏)组件的 "Edit"(编辑)项,然后在上下文菜单中选择 "Delete"(删除)。
-[start=3]
+
. 要添加菜单项,以便从正在运行的应用程序打开文件选择器,请在 "Palette"(组件面板)的 "Swing Menus"(Swing 菜单)类别中,选择新的菜单项 (JMenuItem1),然后将其拖放至 "Menu Bar"(菜单栏)的 "File"(文件)项。
[.feature]
@@ -116,19 +116,19 @@
*注:*请确保先选择 "Menu Bar"(菜单栏),然后再将其他菜单项拖至此处,以便将后者添加到 "Menu Bar"(菜单栏)中。
-[start=4]
+
. 在 "Design"(设计)视图中右键单击 jMenuItem1,然后从上下文菜单中选择 "Change Variable Name"(更改变量名称)。将项重命名为 `Open`,然后单击 "OK"(确定)。
-[start=5]
+
. 确保 jMenuItem1 在 "Design"(设计)视图中仍处于选中状态。按空格键编缉组件的文本。将文本更改为 `Open`,然后按 Enter 键进行确认。
-[start=6]
+
. 为 "Open" 菜单项指定操作处理程序。右键单击菜单项,然后从上下文菜单中选择 "Events"(事件)> "Action"(操作)> "action Performed"(执行的操作)。GUI 构建器自动切换至 "Source"(源)视图,并构建名为 ``OpenActionPerformed()`` 的新事件处理程序方法。"Navigator"(导航器)窗口应如下所示:
image::images/openactionperformednavigator.png[]
-[start=7]
+
. 要添加菜单项,以便从正在创建的应用程序中退出文件选择器,并切换回 "Design"(设计)模式,请在 "Palette"(组件面板)的 "Swing Menus"(Swing 菜单)类别中,选择菜单项 (JMenuItem1),然后将其拖至 "Menu Bar"(菜单栏)中 "Open" 菜单项的下方。请注意橙色的突出显示,表示要放置 ``JMenuItem1`` 的位置。
[.feature]
@@ -137,16 +137,16 @@
--
-[start=8]
+
. 在 "Design"(设计)视图中右键单击 ``jMenuItem1`` ,然后从上下文菜单中选择 "Change Variable Name"(更改变量名称)。将项重命名为 `Exit`,然后单击 "OK"(确定)。
-[start=9]
+
. 确保 ``jMenuItem1`` 在 "Design"(设计)视图中仍处于选中状态。按空格键编缉组件的文本。将文本更改为 ``Exit`` ,然后按 Enter 键进行确认。
-[start=10]
+
. 为 "Exit" 菜单项指定操作处理程序。右键单击菜单项,然后从上下文菜单中选择 "Events"(事件)> "Action"(操作)> "action Performed"(执行的操作)。GUI 构建器自动切换至 "Source"(源)视图,并将构建名为 `ExitActionPerformed()` 的新事件处理程序方法。`ExitActionPerformed` 节点显示在 "Navigator"(导航器)窗口中 `OpenActionPerformed()` 节点的下方。
-[start=11]
+
. 要使 "Exit" 菜单项正常工作,需要将以下源添加到 `ExitActionPerformed()` 方法的主体中:
[source,java]
@@ -155,7 +155,7 @@
System.exit(0);
----
-[start=12]
+
. 切换回 "Design"(设计)模式。从 "Palette"(组件面板)的 "Swing Controls"(Swing 控件)类别中,将文本区域 ( ``JTextArea`` ) 拖入窗体中,如下图所示。
[.feature]
@@ -164,7 +164,7 @@
--
-[start=13]
+
. 调整已添加组件的大小,以便为文件选择器稍后显示的文本留出空间。将变量重命名为 `textarea`。此窗体应该类似于下面的屏幕快照:
[.feature]
@@ -183,10 +183,10 @@
除了 ``Add From Palette`` (从组件面板上添加)上下文菜单之外,还可以从 "Palette"(组件面板)的 "Swing Window"(Swing 窗口)将 ``JFileChooser`` 组件拖放至 GUI 构建器的空白区域。结果是一样的,但操作上有一些困难,因为 ``JFileChooser`` 的预览非常大,并且可能会不小心将窗口插入到错误的面板。
-[start=3]
+
. 查看导航器,确认 ``JFileChooser`` 已添加到窗体中。
-[start=4]
+
. 右键单击 ``JFileChooser`` 节点,并将变量重命名为 `fileChooser`。
image::images/navigator_jframe.png[]
@@ -224,7 +224,7 @@
*注:*删除代码片段中与源文件中现有的第一行和最后一行重复的行。
-[start=3]
+
. 如果编辑器报告了代码中有错误,则右键单击代码中的任意位置,然后选择 "Fix Imports"(修复导入)或按 Ctrl+Shift+I 键。在 "Fix All Imports"(修复所有导入)对话框中,接受默认值以更新导入的语句,然后单击 "OK"(确定)。
正如您所看到的,调用 FileChooser 的 ``getSelectedFile()`` 方法来确认用户所单击的文件,以便您可以对其进行操作。本示例读取文件内容,并将其显示在文本区域中。
@@ -244,10 +244,10 @@
--
-[start=4]
+
. 在文本字段中键入 ``new MyCustomFilter()`` 。单击 "OK"(确定)。
-[start=5]
+
. 要使定制代码正常工作,需要编写内部(或外部) ``MyCustomFilter`` 类,以扩展 ``FileFilter`` 类。复制以下代码片段,并将其粘贴到类的源代码中 import 语句的下方,以创建实现过滤器的内部类。
[source,java]
@@ -279,7 +279,7 @@
image::images/run.png[]
-[start=3]
+
. 在正运行的 Demo 应用程序中,从 "File"(文件)菜单中选择 "Open"(打开),以触发相应操作。该结果应该与此类似:
[.feature]
@@ -288,7 +288,7 @@
--
-[start=4]
+
. 要关闭该应用程序,请在 "File"(文件)菜单中选择 "Exit"(退出)。
查看 GUI 组件面板中的其他有用 Swing 窗口和对话框,如 "ColorChooser"(颜色选择器)或 "OptionPane"(选项窗格)。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.asciidoc
index 781ea70..87492b2 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.asciidoc
@@ -118,7 +118,7 @@
}
----
-[start=3]
+
. We are now going to add code for what we want the Exit Button to do. Replace the TODO line with `System.exit(0);`. Your finished Exit button code should look like this:
[source,java]
@@ -158,6 +158,7 @@
3. And finally, it will convert the sum to a type String and place it in `jTextField3`.
Lets get started!
+
[start=1]
1. Click the Design tab at the top of your work area to go back to the Form Design.
2. Right-click the Add button (`jButton2`). From the pop-up menu, select Events > Action > actionPerformed.
@@ -200,7 +201,7 @@
NOTE: The location of the ``NumberAddition`` project directory depends on the path you specified while creating the project in step 3 of the <<Exercise_1,Exercise 1: Creating a Project>> section.
-[start=3]
+
. Double-click the `NumberAddition.jar` file.
After a few seconds, the application should start.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ja.asciidoc
index 1b3da8f..0d9e8b2 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ja.asciidoc
@@ -142,7 +142,7 @@
}
----
-[start=3]
+
. 「Exit」ボタンで行う処理のコードを追加します。TODOの行を`System.exit(0);`に置き換えます。完成した「Exit」ボタンのコードは次のようになります。
[source,java]
@@ -183,6 +183,7 @@
それでは始めましょう。
+
[start=1]
1. 作業領域の上部にある「デザイン」タブをクリックし、フォームのデザインに戻ります。
2. 「Add」ボタン(`jButton2`)を右クリックします。ポップアップ・メニューから「イベント」>「アクション」>「actionPerformed」を選択します。
@@ -225,7 +226,7 @@
*注意:* ``NumberAddition`` プロジェクト・ディレクトリの場所は、<<Exercise_1,課題1: プロジェクトの作成>>の項でプロジェクトを作成するときにステップ3で指定したパスによって決まります。
-[start=3]
+
. `NumberAddition.jar`ファイルをダブルクリックします。
数秒後、アプリケーションが起動するはずです。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_pt_BR.asciidoc
index e3f5e82..6426bd7 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_pt_BR.asciidoc
@@ -136,7 +136,7 @@
}
----
-[start=3]
+
. Agora vamos adicionar o código da ação que desejamos que o botão Sair execute. Substitua a linha TODO por `System.exit(0);`. Seu código do botão Sair finalizado deve ter a seguinte aparência:
[source,java]
@@ -176,6 +176,7 @@
3. E, finalmente, ele converterá a soma para um tipo string e irá colocá-lo no `TextField3`.
Vamos começar!
+
[start=1]
1. Clique na guia Design na parte superior da sua área de trabalho para voltar para o Design do Form.
2. Clique com o botão direito do mouse no botão Adicionar (`jButton2`). No menu pop-up, escolha Eventos > Ação> actionPerformed.
@@ -218,7 +219,7 @@
*Observação:* a localização do diretório do projeto ``NumberAddition`` depende o caminho que você especificou ao criar o projeto na etapa 3 da seção <<Exercise_1,Exercício 1: Criando um Projeto>>.
-[start=3]
+
. Clique duas vezes no arquivo `NumberAddition.jar`.
Depois de alguns segundos, a aplicação deve ser iniciada.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ru.asciidoc
index 147033a..5130e91 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_ru.asciidoc
@@ -136,7 +136,7 @@
}
----
-[start=3]
+
. Теперь добавим код действия, которое должна выполнять кнопка "Exit". Замените строку TODO на `System.exit(0);`. Готовый код кнопки "Exit" должен выглядеть следующим образом:
[source,java]
@@ -176,6 +176,7 @@
3. И, наконец, она преобразует сумму в тип String и поместит ее в `jTextField3`.
Начнем!
+
[start=1]
1. Щелкните вкладку "Design" в верхней части рабочей области для возврата к экрану "Form Design".
2. Щелкните правой кнопкой мыши кнопку "Add" (`jButton2`). Во всплывающем меню выберите Events ("События") > Action ("Действие") > actionPerformed.
@@ -218,7 +219,7 @@
*Примечание.* Местоположение каталога проекта ``NumberAddition`` зависит от пути, указанного при создании проекта в шаге 3 в разделе <<Exercise_1,Упражнение 1. Создание проекта>>.
-[start=3]
+
. Дважды щелкните файл `NumberAddition.jar`.
Через несколько секунд приложение запустится.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_zh_CN.asciidoc
index 1845c8c..0da3861 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality_zh_CN.asciidoc
@@ -136,7 +136,7 @@
}
----
-[start=3]
+
. 现在,我们将为希望 "Exit" 按钮执行的操作添加代码。将 TODO 行替换为 `System.exit(0);`。完成的 "Exit" 按钮代码应如下所示:
[source,java]
@@ -176,6 +176,7 @@
3. 最后,将相加之和的类型转换为字符串,并将其放在 `jTextField3` 中。
我们现在就开始吧!
+
[start=1]
1. 单击工作区域顶部的“设计”标签以返回到窗体设计区域。
2. 右键单击 "Add" 按钮 (`jButton2`)。从弹出式菜单中选择“事件”>“操作”> "actionPerformed"。
@@ -218,7 +219,7 @@
*注:* ``NumberAddition`` 项目目录的位置取决于在<<Exercise_1,练习 1:创建项目>>部分中的第 3 步创建项目时指定的路径。
-[start=3]
+
. 双击 `NumberAddition.jar` 文件。
几秒钟后,将会启动应用程序。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps.asciidoc
index eb1acaf..da3a79f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps.asciidoc
@@ -58,7 +58,7 @@
image::images/prj.png[]
-[start=4]
+
. Double-click the ``Initial.java`` file.
The sample form opens in the GUI Builder Design view.
@@ -83,45 +83,45 @@
image::images/gap-highlighted.png[]
-[start=2]
+
. Hover the mouse pointer over the bottom part of the highlighted gap.
The pointer is changed to a vertical resizable one.
image::images/gap-resizable.png[]
-[start=3]
+
. Enlarge the selected gap to 50 by pressing the left mouse button, dragging the pointer downward, and releasing the left mouse button.
The new size of the gap is displayed in a tooltip.
image::images/resizing.png[]
-[start=4]
+
. Add a new label into the created gap by dragging it from the Swing Controls section of the Palette and dropping it so that its left edge is aligned with the left edge of the ``First Name`` label and its top edge has the suggested preferred gap from the ``First Name`` row.
image::images/jlabel.png[]
-[start=5]
+
. Double-click the label and change the text of the label to ``Middle Name:`` .
image::images/middle-name.png[]
-[start=6]
+
. Add a new text field to the right of the ``Middle Name:`` label by dragging it from the Swing Controls section of the Palette and dropping it so that it is baseline-aligned with the ``Middle Name`` label and its left edge is aligned with the other text fields.
image::images/textfield.png[]
-[start=7]
+
. Drag the right edge of the text field to align it with the right edge of the other text fields.
image::images/textfield-resized.png[]
-[start=8]
+
. Right-click the text inside the text field and choose Edit Text from the popup menu. Remove the text.
The ``Middle Name`` row is inserted between the form components.
@@ -173,7 +173,7 @@
image::images/edit-layout-space.png[]
-[start=2]
+
. Set the size of the Left and Right gaps to 0 and click OK.
The gaps to the left and right of the buttons are removed using the Edit Layout Space dialog box.
@@ -184,7 +184,7 @@
1. Double-click the gap at the bottom of the last button.
The Edit Layout Space dialog box is displayed.
-[start=2]
+
. In the Edit Layout Space dialog box, select the ``Resizable`` option and click OK.
[.feature]
@@ -193,7 +193,7 @@
--
-[start=3]
+
. Repeat steps 1 and 2 for the gap above the topmost button.
The gaps above and below the container with the buttons are made resizable.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ja.asciidoc
index c0620ec..c40f626 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ja.asciidoc
@@ -68,7 +68,7 @@
image::images/prj.png[]
-[start=4]
+
. ``Initial.java`` ファイルをダブルクリックします。
サンプル・フォームがGUIビルダーの「デザイン」ビューで開きます。
@@ -93,45 +93,45 @@
image::images/gap-highlighted.png[]
-[start=2]
+
. 強調表示されたギャップの下部にマウス・ポインタを置きます。
ポインタは、垂直方向にサイズ変更可能なポインタに変わります。
image::images/gap-resizable.png[]
-[start=3]
+
. マウスの左ボタンを押しながらポインタを下へドラッグして選択したギャップを50まで拡大し、マウスの左ボタンを離します。
ギャップの新しいサイズがツールチップに表示されます。
image::images/resizing.png[]
-[start=4]
+
. パレットの「Swingコントロール」セクションから新しいラベルをドラッグし、作成したギャップにドロップします。これにより、左端が「 ``First Name`` 」ラベルの左端にそろい、上端には「 ``First Name`` 」行からの提案された優先ギャップが確保されます。
image::images/jlabel.png[]
-[start=5]
+
. ラベルをダブルクリックし、ラベルのテキストを「 ``Middle Name:`` 」に変更します。
image::images/middle-name.png[]
-[start=6]
+
. パレットの「Swingコントロール」セクションから新しいテキスト・フィールドをドラッグして「 ``Middle Name:`` 」ラベルの右に追加します。これにより、新しいテキスト・フィールドはベースラインが「 ``Middle Name`` 」ラベルとそろい、左端が他のテキスト・フィールドとそろいます。
image::images/textfield.png[]
-[start=7]
+
. テキスト・フィールドの右端をドラッグして、他のテキスト・フィールドの右端とそろえます。
image::images/textfield-resized.png[]
-[start=8]
+
. テキスト・フィールド内のテキストを右クリックし、ポップアップ・メニューから「テキストを編集」を選択します。テキストを除去します。
「 ``Middle Name`` 」行がフォーム・コンポーネント間に挿入されます。
@@ -183,7 +183,7 @@
image::images/edit-layout-space.png[]
-[start=2]
+
. 左右のギャップのサイズを0に設定し、「OK」をクリックします。
「レイアウト・スペースを編集」ダイアログ・ボックスを使用して、ボタンの左右のギャップが除去されます。
@@ -194,7 +194,7 @@
1. 最後のボタンの下部にあるギャップをダブルクリックします。
「レイアウト・スペースを編集」ダイアログ・ボックスが表示されます。
-[start=2]
+
. 「レイアウト・スペースを編集」ダイアログ・ボックスで、「 ``サイズ変更可能`` 」オプションを選択し、「OK」をクリックします。
[.feature]
@@ -203,7 +203,7 @@
--
-[start=3]
+
. 一番上のボタンの上にあるギャップについて、ステップ1と2を繰り返します。
ボタンが含まれるコンテナの上下のギャップがサイズ変更可能になります。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_pt_BR.asciidoc
index 3db8ae6..048dc83 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_pt_BR.asciidoc
@@ -68,7 +68,7 @@
image::images/prj.png[]
-[start=4]
+
. Clique duas vezes no arquivo ``Initial.java`` .
O form de exemplo é aberto na view Design do GUI Builder.
@@ -93,45 +93,45 @@
image::images/gap-highlighted.png[]
-[start=2]
+
. Passe o ponteiro do mouse sobre a parte inferior da lacuna realçada.
O ponteiro é alterado para um redimensionável vertical.
image::images/gap-resizable.png[]
-[start=3]
+
. Aumente a lacuna selecionada para 50, pressionando o botão esquerdo do mouse, arrastando o ponteiro para baixo, e liberando o botão esquerdo do mouse.
O novo tamanho da lacuna é exibido em uma dica de ferramenta.
image::images/resizing.png[]
-[start=4]
+
. Adicionar um novo label à lacuna criada, arrastando-a da seção Controles Swing da Paleta e soltando-a para que sua borda esquerda seja alinhada com a borda esquerda do label ``Nome`` e sua borda superior tenha a lacuna preferencial sugerida da linha ``Nome`` .
image::images/jlabel.png[]
-[start=5]
+
. Clique duas vezes no label e altere o texto do label para ``Nome do Meio:`` .
image::images/middle-name.png[]
-[start=6]
+
. Adicione um novo campo de texto à direita do nome do label ``Nome do Meio:`` , arrastando-o da seção Controles Swing da Paleta e soltando-o, de forma que ele seja alinhado com o label do ``Nome do Meio`` e sua borda esquerda seja alinhada com os outros campos de texto.
image::images/textfield.png[]
-[start=7]
+
. Arraste a borda direita do campo de texto para alinhá-la com a borda direita dos outros campos de texto.
image::images/textfield-resized.png[]
-[start=8]
+
. Clique com o botão direito do mouse no texto no campo de texto e escolha Editar Texto no menu pop-up. Remover o texto.
A linha ``Nome do Meio`` é inserida entre os componentes do form.
@@ -183,7 +183,7 @@
image::images/edit-layout-space.png[]
-[start=2]
+
. Defina o tamanho das lacunas Esquerda e Direita para 0 e clique em OK.
As lacunas à esquerda e à direita dos botões são removidas usando a caixa de diálogo Editar Espaço de Layout.
@@ -194,7 +194,7 @@
1. Clique duas vezes na lacuna na parte inferior do último botão.
A caixa de diálogo Editar Espaço de Layout é exibida.
-[start=2]
+
. Na caixa de diálogo Editar Espaço de Layout, selecione a opção ``Redimensionável`` e clique em OK.
[.feature]
@@ -203,7 +203,7 @@
--
-[start=3]
+
. Repita as etapas 1 e 2 da lacuna acima do botão superior.
As lacunas acima e abaixo do contêiner com os botões são redimensionáveis.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ru.asciidoc
index 8ca5605..92bf92f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_ru.asciidoc
@@ -68,7 +68,7 @@
image::images/prj.png[]
-[start=4]
+
. Дважды щелкните файл ``Initial.java`` .
В конструкторе графического интерфейса откроется образец формы в режиме конструктора.
@@ -93,45 +93,45 @@
image::images/gap-highlighted.png[]
-[start=2]
+
. Наведите курсор мыши на нижнюю часть выделенного промежутка.
Указатель будет преобразован в вертикальный указатель с поддержкой изменения размера.
image::images/gap-resizable.png[]
-[start=3]
+
. Увеличить выбранный промежуток до 50 нажатием левой кнопки мыши, перетаскиванием указателя вниз, после чего следует отжать левую кнопку мыши.
Новый размер промежутка отображается в подсказке.
image::images/resizing.png[]
-[start=4]
+
. Добавить новую метку в созданный промежуток, перетащив его из раздела 'Элементы управления Swing' палитры и отпустив его таким образом, чтобы левая граница была выровнена с левой границей метки ``Имя`` а ее верхняя граница содержала указанный предпочитаемый промежуток из строки ``Имя`` .
image::images/jlabel.png[]
-[start=5]
+
. Дважды щелкните метку и измените текст метки на ``Отчество:`` .
image::images/middle-name.png[]
-[start=6]
+
. Добавьте новое текстовое поле к правой стороне метки ``Отчество:`` перетащив его из раздела 'Элементы управления Swing' палитры и отпустив его, таким образом, чтобы его базовая линия была выровнена с меткой ``Отчество`` , а левая граница была выровнена с другими текстовыми полями.
image::images/textfield.png[]
-[start=7]
+
. Перетащите правую границу текстового поля для выравнивания его с правой границей других текстовых полей.
image::images/textfield-resized.png[]
-[start=8]
+
. Щелкните правой кнопкой мыши текст внутри текстового поля и выбрав 'Редактировать текст' во всплывающем меню. Удалите текст.
Строка ``Отчество`` вставлена между компонентами формы.
@@ -183,7 +183,7 @@
image::images/edit-layout-space.png[]
-[start=2]
+
. Задайте размер левого и правого промежутка равным 0 и нажмите OK.
Промежутки справа и слева от кнопок удаляются с помощью диалогового окна 'Изменить пространство компоновки'.
@@ -194,7 +194,7 @@
1. Дважды щелкните промежуток в нижней части последней кнопки.
Отображается диалоговое окно 'Изменить пространство компоновки'.
-[start=2]
+
. В диалоговом окне выберите 'Изменить пространство компоновки' выберите параметр ``С поддержкой изменения размера`` и нажмите ОК.
[.feature]
@@ -203,7 +203,7 @@
--
-[start=3]
+
. Повторите шаги 1 и 2 для промежутка над самой верхней кнопкой.
Для промежутков выше и ниже контейнера с кнопками включена поддержка изменения размера.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_zh_CN.asciidoc
index 04e3680..94f99c1 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-gaps_zh_CN.asciidoc
@@ -68,7 +68,7 @@
image::images/prj.png[]
-[start=4]
+
. 双击 ``Initial.java`` 文件。
此时将在 GUI 构建器的 "Design"(设计)视图中打开样例窗体。
@@ -93,45 +93,45 @@
image::images/gap-highlighted.png[]
-[start=2]
+
. 将鼠标指针悬停在突出显示间距的底部。
指针将更改为垂直可调整大小的形状。
image::images/gap-resizable.png[]
-[start=3]
+
. 通过按鼠标左键向下拖动指针,然后释放鼠标按键,将所选间距扩大到 50。
间距的新大小将显示在工具提示中。
image::images/resizing.png[]
-[start=4]
+
. 在创建的间距中添加新标签,方法是从组件面板的 "Swing Controls"(Swing 控件)部分拖放标签,使其左侧边缘与 ``First Name`` (名字)标签的左侧边缘对齐,其顶部边缘与 ``First Name`` (名字)行具有建议的首选间距。
image::images/jlabel.png[]
-[start=5]
+
. 双击标签并将标签的文本更改为 ``Middle Name:`` (中间名:)。
image::images/middle-name.png[]
-[start=6]
+
. 通过在组件面板的 "Swing Controls"(Swing 控件)部分拖放新文本字段,将该字段添加到 ``Middle Name:`` (中间名:)标签的右侧,使其底部与 ``Middle Name`` (中间名)标签对齐,左侧边缘与其他文本字段对齐。
image::images/textfield.png[]
-[start=7]
+
. 拖动文本字段的右侧边缘,使其与其他文本字段的右侧边缘对齐。
image::images/textfield-resized.png[]
-[start=8]
+
. 右键单击文本字段中的文本并从弹出菜单中选择 "Edit Text"(编辑文本)。删除文本。
``Middle Name`` (中间名)行将插入到窗体组件之间。
@@ -183,7 +183,7 @@
image::images/edit-layout-space.png[]
-[start=2]
+
. 将左右两侧间距的大小设置为 0,然后单击 "OK"(确定)。
此时将使用 "Edit Layout Space"(编辑布局空间)对话框删除按钮左右两侧的间距。
@@ -194,7 +194,7 @@
1. 双击最后一个按钮底部的间距。
此时将显示 "Edit Layout Space"(编辑布局空间)对话框。
-[start=2]
+
. 在 "Edit Layout Space"(编辑布局空间)对话框中,选择 ``Resizable`` (可调整大小)选项,然后单击 "OK"(确定)。
[.feature]
@@ -203,7 +203,7 @@
--
-[start=3]
+
. 对顶部按钮上方的间距重复步骤 1 和 2。
带有按钮的容器上下的间距将成为可调整大小的间距。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display.asciidoc
index 60ec8ba..a4ed03e 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display.asciidoc
@@ -47,7 +47,7 @@
--
-[start=5]
+
. Click Finish.
@@ -89,7 +89,7 @@
--
-[start=2]
+
. Click Finish.
In the Projects window, you should see a new package appear within the `Source Packages` folder.
@@ -114,13 +114,13 @@
--
-[start=4]
+
. In the icon property dialog box, click Import to Project.
-[start=5]
+
. In the file chooser navigate to any image that is on your system that you want to use. Then click Next.
-[start=6]
+
. In the Select target folder page of the wizard, select the `newpackage` folder and click Finish.
[.feature]
@@ -129,7 +129,7 @@
--
-[start=7]
+
. Click OK to close the icon property dialog box.
After you click OK, the IDE does the following things:
@@ -201,10 +201,10 @@
--
-[start=4]
+
. Click the Select Main Class button.
-[start=5]
+
. Click OK to close the Project Properties dialog box.
*To build the project:*
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ja.asciidoc
index ef96e96..dc26c80 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ja.asciidoc
@@ -64,7 +64,7 @@
--
-[start=5]
+
. 「終了」をクリックします。
@@ -106,7 +106,7 @@
--
-[start=2]
+
. 「終了」をクリックします。
「プロジェクト」ウィンドウでは、`Source Packages`フォルダ内に新規パッケージが表示されているはずです。
@@ -131,13 +131,13 @@
--
-[start=4]
+
. アイコン・プロパティのダイアログ・ボックスで、「プロジェクトにインポート」をクリックします。
-[start=5]
+
. ファイル・チューザで、システム上にある、使用するイメージに移動します。「次」をクリックします。
-[start=6]
+
. ウィザードの「ターゲット・フォルダの選択」ページで、`newpackage`フォルダを選択し、「終了」をクリックします。
[.feature]
@@ -146,7 +146,7 @@
--
-[start=7]
+
. 「OK」をクリックしてアイコン・プロパティのダイアログ・ボックスを閉じます。
「OK」をクリックすると、IDEでは次の処理が行われます。
@@ -218,19 +218,19 @@
--
-[start=5]
+
. 「終了」をクリックします。
-[start=6]
+
. 「プロジェクト」ウィンドウで、「`BackgroundImageApp`」ノードを展開します。
-[start=7]
+
. 「ソース・パッケージ」ノードを右クリックし、「新規」>「JFrameフォーム」を選択します。
-[start=8]
+
. 「クラス名」に「`ImageDisplay`」と入力します。
-[start=9]
+
. 「パッケージ名」に「`org.me.mybackgroundapp`」と入力します。
[.feature]
@@ -239,43 +239,43 @@
--
-[start=10]
+
. 「終了」をクリックします。
-[start=11]
+
. 「デザイン」ビューで「JFrame」を右クリックし、ポップアップ・メニューから「レイアウトを設定」>「グリッド・バッグ・レイアウト」を選択します。
-[start=12]
+
. 「JFrame」を右クリックし、ポップアップ・メニューから「パレットから追加」>「Swingコンテナ」>「パネル」を選択します。
-[start=13]
+
. 「プロパティ」ウィンドウで、jPanelの「`opaque`」プロパティを選択解除します。
-[start=14]
+
. 「JFrame」を右クリックし、ポップアップ・メニューから「パレットから追加」>「Swingコントロール」>「ラベル」を選択します。
-[start=15]
+
. 「プロジェクト」ウィンドウで、「`org.me.mybackgroundapp`」ノードを右クリックし、「新規」>「Javaパッケージ」を選択します。
-[start=16]
+
. 「終了」をクリックします。新規パッケージが追加されます。
-[start=17]
+
. GUIデザイナで、フォームに追加したラベルを選択します。
-[start=18]
+
. 「プロパティ」ウィンドウで、「プロパティ」カテゴリをクリックし、アイコン・プロパティまでスクロールします。
-[start=19]
+
. 省略符号(...)ボタンをクリックします。
-[start=20]
+
. アイコン・プロパティのダイアログ・ボックスで、「プロジェクトにインポート」をクリックします。
-[start=21]
+
. ファイル・チューザで、システム上にある、使用するイメージに移動します。「次」をクリックします。
-[start=22]
+
. ウィザードの「ターゲット・フォルダの選択」ページで、`newpackage`リソース・フォルダを選択し、「終了」をクリックします。
[.feature]
@@ -284,13 +284,13 @@
--
-[start=23]
+
. 「OK」をクリックしてアイコン・プロパティのダイアログ・ボックスを閉じます。
-[start=24]
+
. ナビゲータで、「jPanel」を右クリックし、ポップアップ・メニューから「プロパティ」を選択します。
-[start=25]
+
. 「プロパティ」ダイアログ・ボックスで、「`グリッドX`」、「`グリッドY`」、「`ウエイトX`」、および「`ウエイトY`」プロパティを「`1`」に設定し、「`フィル`」プロパティを「`両方`」に設定します。
[.feature]
@@ -299,13 +299,13 @@
--
-[start=26]
+
. 「閉じる」をクリックします。
-[start=27]
+
. jLabelについて手順24と25を繰り返します。
-[start=28]
+
. 「プロパティ」ダイアログ・ボックスで、`text`プロパティを選択して`jLabel1`を削除します。
[.feature]
@@ -338,10 +338,10 @@
--
-[start=4]
+
. 「メイン・クラスを選択」ボタンをクリックします。
-[start=5]
+
. 「OK」をクリックして、「プロジェクト・プロパティ」ダイアログ・ボックスを閉じます。
*プロジェクトをビルドするには:*
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_pt_BR.asciidoc
index 8d31cb2..3f03fb2 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_pt_BR.asciidoc
@@ -64,7 +64,7 @@
--
-[start=5]
+
. Clique em Finalizar.
@@ -106,7 +106,7 @@
--
-[start=2]
+
. Clique em Finalizar.
Na janela Projetos, você deve ver um novo pacote que aparece na pasta `Pacotes do Código-fonte`.
@@ -131,13 +131,13 @@
--
-[start=4]
+
. Na caixa de diálogo da propriedade do ícone, clique em Importar para o Projeto.
-[start=5]
+
. Na seletor de arquivos, vá até qualquer imagem que esteja em seu sistema que você queira usar. Em seguida, clique em Próximo.
-[start=6]
+
. Na página Selecionar pasta de destino do assistente, selecione a pasta `newpackage` e clique em Finalizar.
[.feature]
@@ -146,7 +146,7 @@
--
-[start=7]
+
. Clique em OK para fechar a caixa de diálogo de propriedade do ícone.
Após clicar em OK, o IDE faz o seguinte:
@@ -218,19 +218,19 @@
--
-[start=5]
+
. Clique em Finalizar.
-[start=6]
+
. Na janela Projetos, expanda o nó `BackgroundImageApp`.
-[start=7]
+
. Clique com o botão direito do mouse no nó Pacotes de Código-fonte e escolha Novo > Form JFrame.
-[start=8]
+
. Em Nome da Classe, digite `ImageDisplay`.
-[start=9]
+
. Em Nome do Pacote, digite `org.me.mybackgroundapp`.
[.feature]
@@ -239,43 +239,43 @@
--
-[start=10]
+
. Clique em Finalizar.
-[start=11]
+
. Na view Design, clique com o botão direito do mouse em JFrame e selecione Definir Layout > Layout do Conjunto de Grades no menu pop-up.
-[start=12]
+
. Clique com o botão direito do mouse em JFrame e selecione Adicionar da Paleta > Contêineres Swing > Painel no menu pop-up.
-[start=13]
+
. Na janela Propriedades, desmarque a propriedade `opaque` do jPanel.
-[start=14]
+
. Clique com o botão direito do mouse em JFrame e selecione Adicionar da Paleta > Controles do Swing > Label no menu pop-up.
-[start=15]
+
. Na janela Projetos, clique com o botão direito do mouse no nó `org.me.mybackgroundapp` e escolha Novo > Pacote Java.
-[start=16]
+
. Clique em Finalizar. Um novo pacote é adicionado.
-[start=17]
+
. No Designer de GUI, selecione o label que adicionou ao seu form.
-[start=18]
+
. Na janela Propriedades, clique na categoria Propriedades e role até a propriedade do ícone.
-[start=19]
+
. Clique no botão de reticências (...).
-[start=20]
+
. Na caixa de diálogo da propriedade do ícone, clique em Importar para o Projeto.
-[start=21]
+
. Na seletor de arquivos, vá até qualquer imagem que esteja em seu sistema que você queira usar. Em seguida, clique em Próximo.
-[start=22]
+
. Na página Selecionar Pasta de Destino do assistente, selecione a pasta de recursos `newpackage` e clique em Finalizar.
[.feature]
@@ -284,13 +284,13 @@
--
-[start=23]
+
. Clique em OK para fechar a caixa de diálogo de propriedade do ícone.
-[start=24]
+
. No navegador, clique com o botão direito do mouse em jPanel e escolha Propriedades no menu pop-up.
-[start=25]
+
. Na caixa de dialogo Propriedades, defina as propriedades `Grid X`, `Grid Y`, `Weight X` e `Weight Y` como `1` e a propriedade `Fill` como `Both`.
[.feature]
@@ -299,13 +299,13 @@
--
-[start=26]
+
. Clique em Fechar.
-[start=27]
+
. Repita as etapas 24 e 25 para o jLabel.
-[start=28]
+
. Na caixa de diálogo Propriedades, selecione a propriedade `text` e delete `jLabel1`.
[.feature]
@@ -338,10 +338,10 @@
--
-[start=4]
+
. Clique no botão Selecionar Classe Principal.
-[start=5]
+
. Clique em OK para fechar a caixa de diálogo Propriedades do Projeto.
*Para construir o projeto:*
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ru.asciidoc
index b7ac48f..8e0c99b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_ru.asciidoc
@@ -64,7 +64,7 @@
--
-[start=5]
+
. Нажмите кнопку 'Готово'.
@@ -106,7 +106,7 @@
--
-[start=2]
+
. Нажмите кнопку 'Готово'.
В окне 'Проекты' в папке `Исходные пакеты` отображается новый пакет.
@@ -131,13 +131,13 @@
--
-[start=4]
+
. В диалоговом окне свойств значка щелкните Import to Project ("Импорт в проект").
-[start=5]
+
. В окне выбора файлов выберите любое сохраненное в компьютере изображение. Затем нажмите кнопку "Дальше".
-[start=6]
+
. На странице 'Выбор целевой папки' выберите папку `newpackage` и нажмите 'Готово'.
[.feature]
@@ -146,7 +146,7 @@
--
-[start=7]
+
. Нажмите ОК, чтобы закрыть диалоговое окно свойств значка.
При нажатии на кнопку OK IDE выполняет следующие действия:
@@ -218,19 +218,19 @@
--
-[start=5]
+
. Нажмите кнопку 'Готово'.
-[start=6]
+
. В окне 'Проекты' разверните узел `BackgroundImageApp`.
-[start=7]
+
. Щелкните правой кнопкой узел "Исходные файлы" и выберите форму "Создать" > "JFrame".
-[start=8]
+
. В качестве имени класса введите `ImageDisplay`.
-[start=9]
+
. В качестве имени пакета введите `org.me.mybackgroundapp`.
[.feature]
@@ -239,43 +239,43 @@
--
-[start=10]
+
. Нажмите кнопку 'Готово'.
-[start=11]
+
. В режиме конструирования щелкните правой кнопкой мыши объект JFrame и выберите 'Выбрать макет > Макет контейнера сетки' в контекстном меню.
-[start=12]
+
. Щелкните правой кнопкой мыши объект JFrame и выберите Добавить из палитры > Контейнеры Swing > Панель в контекстном меню.
-[start=13]
+
. В окне свойств отмените выбор свойства jPanel `opaque`.
-[start=14]
+
. Щелкните правой кнопкой мыши объект JFrame и выберите Добавить из палитры > Элементы управления Swing > Метка в контекстном меню.
-[start=15]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел `org.me.mybackgroundapp` и выберите 'Создать' > 'Пакет Java'.
-[start=16]
+
. Нажмите кнопку "Готово". В результате будет добавлен новый пакет.
-[start=17]
+
. В редакторе GUI Designer выберите метку, добавленную ранее в форму.
-[start=18]
+
. В окне "Свойства" щелкните категорию "Свойства" и выполните прокрутку до свойства "Значок".
-[start=19]
+
. Нажмите кнопку со многоточием (...).
-[start=20]
+
. В диалоговом окне свойств значка щелкните Import to Project ("Импорт в проект").
-[start=21]
+
. В окне выбора файлов выберите любое сохраненное в компьютере изображение. Затем нажмите кнопку "Дальше".
-[start=22]
+
. На странице 'Выбор целевой папки' в мастере выберите каталог ресурсов `newpackage` и нажмите 'Готово'.
[.feature]
@@ -284,13 +284,13 @@
--
-[start=23]
+
. Нажмите ОК, чтобы закрыть диалоговое окно свойств значка.
-[start=24]
+
. В навигаторе щелкните правой кнопкой мыши jPanel и выберите 'Свойства' во всплывающем меню.
-[start=25]
+
. В диалоговом окне Properties ("Свойства") установите свойства `Grid X`, `Grid Y`, `Weight X` и `Weight Y` на `1`, а свойство `Fill` на `Both`.
[.feature]
@@ -299,13 +299,13 @@
--
-[start=26]
+
. Выберите "Close" (Закрыть).
-[start=27]
+
. Повторите шаги 24 и 25 для jLabel.
-[start=28]
+
. В диалоговом окне 'Свойства' выберите свойство `text` и удалите `jLabel1`.
[.feature]
@@ -338,10 +338,10 @@
--
-[start=4]
+
. Нажмите кнопку 'Выбрать основной класс'.
-[start=5]
+
. Нажмите кнопку "ОК" для закрытия диалогового окна "Свойства проекта".
*Для сборки проекта:*
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_zh_CN.asciidoc
index 6d171aa..e3c6e7c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-image-display_zh_CN.asciidoc
@@ -64,7 +64,7 @@
--
-[start=5]
+
. 单击 "Finish"(完成)。
@@ -106,7 +106,7 @@
--
-[start=2]
+
. 单击 "Finish"(完成)。
在 "Projects"(项目)窗口中,您应该会看到新包出现在 `Source Packages`(源包)文件夹内。
@@ -131,13 +131,13 @@
--
-[start=4]
+
. 在 icon 属性对话框中,单击 "Import to Project"(导入到项目)。
-[start=5]
+
. 在文件选择器中,导航到系统上要使用的任何图像。然后,单击 "Next"(下一步)。
-[start=6]
+
. 在向导的 "Select target folder"(选择目标文件夹)页中,选择 `newpackage` 文件夹,然后单击 "Finish"(完成)。
[.feature]
@@ -146,7 +146,7 @@
--
-[start=7]
+
. 单击 "OK"(确定)以关闭 "icon property"(图标属性)对话框。
单击 "OK"(确定)后,IDE 将执行以下任务:
@@ -218,19 +218,19 @@
--
-[start=5]
+
. 单击 "Finish"(完成)。
-[start=6]
+
. 在 "Projects"(项目)窗口中,展开 `BackgroundImageApp` 节点。
-[start=7]
+
. 右键单击 "Source Packages"(源包)节点,然后选择 "New"(新建)> "JFrame Form"(JFrame 窗体)。
-[start=8]
+
. 键入 `ImageDisplay` 作为类名。
-[start=9]
+
. 键入 `org.me.mybackgroundapp` 作为包名。
[.feature]
@@ -239,43 +239,43 @@
--
-[start=10]
+
. 单击 "Finish"(完成)。
-[start=11]
+
. 在 "Design"(设计)视图中,右键单击 "JFrame",然后从弹出式菜单中选择 "Set Layout"(设置布局)> "Grid Bag Layout"(网格包布局)。
-[start=12]
+
. 右键单击 "JFrame",然后从弹出式菜单中选择 "Add From Palette"(从组件面板上添加)> "Swing Containers"(Swing 容器)> "Panel"(面板)。
-[start=13]
+
. 在 "Properties"(属性)窗口中,取消选择 jPanel 的 `opaque` 属性。
-[start=14]
+
. 右键单击 "JFrame",然后从弹出式菜单中选择 "Add From Palette"(从组件面板上添加)> "Swing Controls"(Swing 控件)> "Label"(标签)。
-[start=15]
+
. 在 "Projects"(项目)窗口中,右键单击 `org.me.mybackgroundapp` 节点,然后选择 "New"(新建)> "Java Package"(Java 包)。
-[start=16]
+
. 单击 "Finish"(完成)。添加新包。
-[start=17]
+
. 在 GUI 设计器中,选择已添加到窗体上的标签。
-[start=18]
+
. 在 "Properties"(属性)窗口中,单击 "Properties"(属性)类别,然后滚动到 icon 属性。
-[start=19]
+
. 单击省略号 (...) 按钮。
-[start=20]
+
. 在 icon 属性对话框中,单击 "Import to Project"(导入到项目)。
-[start=21]
+
. 在文件选择器中,导航到系统上要使用的任何图像。然后,单击 "Next"(下一步)。
-[start=22]
+
. 在向导的 "Select Target Folder"(选择目标文件夹)页中,选择 `newpackage` 资源文件夹,然后单击 "Finish"(完成)。
[.feature]
@@ -284,13 +284,13 @@
--
-[start=23]
+
. 单击 "OK"(确定)以关闭 "icon property"(图标属性)对话框。
-[start=24]
+
. 在 "Navigator"(导航器)窗口中,右键单击 "jPanel",然后从弹出式菜单中选择 "Properties"(属性)。
-[start=25]
+
. 在 "Properties"(属性)对话框中,将 `Grid X`、`Grid Y`、`Weight X` 和 `Weight Y` 属性设置为 `1`,并将 `Fill` 属性设置为 `Both`。
[.feature]
@@ -299,13 +299,13 @@
--
-[start=26]
+
. 单击 "Close"(关闭)。
-[start=27]
+
. 针对 jLabel 重复步骤 24 和 25。
-[start=28]
+
. 在 "Properties"(属性)对话框中,选择 `text` 属性,然后删除 `jLabel1`。
[.feature]
@@ -338,10 +338,10 @@
--
-[start=4]
+
. 单击 "Select Main Class"(选择主类)按钮。
-[start=5]
+
. 单击“确定”。关闭“项目属性”对话框。
*要构建项目,请执行以下操作:*
diff --git a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se.asciidoc
index 888f5be..72f7c23 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se.asciidoc
@@ -81,7 +81,7 @@
When you click OK a Sakila node appears under the MySQL Server node.
-[start=5]
+
. Right-click the Sakila node and choose Connect.
When you click Connect a database connection node for the Sakila database ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` ) is listed under the Databases node. When a connection is open you can view the data in the database by expanding the connection node.
@@ -96,7 +96,7 @@
3. Deselect the Use Dedicated Folder option, if selected.
For this tutorial there is little reason to copy project libraries to a dedicated folder because you will not need to share libraries with other users.
-[start=4]
+
. Deselect Create Main Class. Click Finish.
When you click Finish, the IDE creates the Java application project. The project does not have a main class. You will create a form and then set the form as the main class.
@@ -138,10 +138,10 @@
4. In the dialog box, select the ``hibernate.show_sql`` property and set the value to ``true`` . Click OK. This enables the debug logging of the SQL statements.
image::images/add-property-showsql.png[title="Add Hibernate Property dialog box showing setting value for the hibernate.show_sql property"]
-[start=5]
+
. Click Add under the Miscellaneous Properties node and select ``hibernate.query.factory_class`` in the Property Name dropdown list.
-[start=6]
+
. Type *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* as the Property Value.
This is the translator factory class that is used in Hibernate 4 that is bundled with the IDE.
@@ -173,7 +173,7 @@
</hibernate-configuration>
----
-[start=7]
+
. Save your changes to the file.
After you create the form and set it as the main class you will be able to see the SQL query printed in the IDE's Output window when you run the project.
@@ -189,7 +189,7 @@
2. Select Hibernate from the Categories list and HibernateUtil.java from the File Types list. Click Next.
image::images/hib-util.png[title="New File wizard showing how to create HibernateUtil"]
-[start=3]
+
. Type *HibernateUtil* for the class name and *sakila.util* as the package name. Click Finish.
When you click Finish, ``HibernateUtil.java`` opens in the editor. You can close the file because you do not need to edit the file.
@@ -281,7 +281,7 @@
|Table | ``resultTable``
|===
-[start=9]
+
. Save your changes.
In Design view your form should look similar to the following image.
@@ -306,7 +306,7 @@
image::images/hib-query-hqlresults.png[title="HQL Query Editor showing HQL query results"]
-[start=5]
+
. Type the following query in the HQL Query Editor and click Run HQL Query to check the query results when the search string is 'PE'.
[source,java]
@@ -326,7 +326,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. Open a new HQL Query Editor tab and type the following query in the editor pane. Click Run HQL Query.
[source,java]
@@ -361,7 +361,7 @@
It is possible to copy the queries from the HQL Query Editor tabs into the file and then modify the code.
-[start=3]
+
. Add the following methods to create the query based on the user input string.
[source,java]
@@ -379,7 +379,7 @@
The methods call a method called ``executeHQLQuery()`` and create the query by combining the query string with the user entered search string.
-[start=4]
+
. Add the ``executeHQLQuery()`` method.
[source,java]
@@ -402,16 +402,16 @@
The ``executeHQLQuery()`` method calls Hibernate to execute the selected query. This method makes use of the ``HibernateUtil.java`` utility class to obtain the Hibernate Session.
-[start=5]
+
. Right-click in the editor and choose Fix Imports (Ctrl-Shift-I; ⌘-Shift-I on Mac) to generate import statements for the Hibernate libraries ( ``org.hibernate.Query`` , ``org.hibernate.Session`` ) and ``java.util.List`` . Save your changes.
-[start=6]
+
. Create a Query button event handler by switching to the Design view and double-clicking the Query button.
The IDE creates the ``queryButtonActionPerformed`` method and displays the method in the Source view.
-[start=7]
+
. Modify the ``queryButtonActionPerformed`` method in the Source view by adding the following code so that a query is run when the user clicks the button.
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=8]
+
. Add the following method to display the results in the JTable.
[source,java]
@@ -453,7 +453,7 @@
}
----
-[start=9]
+
. Right-click in the editor and choose Fix Imports (Ctrl-Shift-I; ⌘-Shift-I on Mac) to generate an import statement for ``java.util.Vector`` and ``java.util.List`` . Save your changes.
After you save the form you can run the project.
@@ -471,7 +471,7 @@
image::images/browse-main-class.png[title="Setting the main class in the Browse Main Classes dialog"]
-[start=4]
+
. Click Run Project in the main toolbar to launch the application.
Type in a search string in the First Name or Last Name text field and click Query to search for an actor and see the details.
@@ -492,22 +492,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repostiory Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/java/DVDStoreAdmin-Ant*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
*Note.* You need a Subversion client to checkout the sources. For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
@@ -534,17 +534,17 @@
}
----
-[start=4]
+
. Right-click in the editor and choose Insert Code (Alt-Insert; Ctrl-I on Mac) and select Getter and Setter in the popup menu to generate getters and setters for the fields.
-[start=5]
+
. In the Generate Getters and Setters dialog box, select all the fields and click Generate.
image::images/getters-setters.png[title="Generate Getters and Setters dialog box"]
In the Generate Getters and Setters dialog box, you can use the Up arrow on the keyboard to move the selected item to the Actor node and then press the Space bar to select all fields in Actor.
-[start=6]
+
. Fix your imports and save your changes.
After you create the POJO for the table you will want to create an Hibernate Mapping File for ``Actor.java`` .
@@ -566,7 +566,7 @@
</hibernate-configuration>
----
-[start=5]
+
. Map the fields in ``Actor.java`` to the columns in the ACTOR table by making the following changes (in bold) to ``Actor.hbm.xml`` .
[source,xml]
@@ -605,7 +605,7 @@
</hibernate-mapping>
----
-[start=6]
+
. Click the Validate XML button in the toolbar and save your changes.
Creating individual POJOs and Hibernate mapping files might be a convenient way to further customizing your application.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ja.asciidoc
index 3ef1a5e..14efa1d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ja.asciidoc
@@ -81,7 +81,7 @@
「OK」をクリックすると、「MySQLサーバー」ノードの下に「Sakila」ノードが表示されます。
-[start=5]
+
. 「Sakila」ノードを右クリックし、「接続」を選択します。
「接続」をクリックすると、「Sakila」データベースのデータベース接続のノード( ``jdbc:mysql://localhost:3306/sakila [デフォルトの_ユーザー名_]`` )が「データベース」ノードに一覧表示されます。接続が開いたら、接続ノードを展開してデータベースのデータを表示できます。
@@ -96,7 +96,7 @@
3. 専用フォルダを使用するオプションが選択されている場合は選択を解除します。
このチュートリアルでは、ライブラリを他のユーザーと共有する必要がないので、プロジェクト・ライブラリを専用のフォルダにコピーする理由はほとんどありません。
-[start=4]
+
. 「メイン・クラスの作成」の選択を解除します。「終了」をクリックします。
「終了」をクリックすると、IDEでJavaアプリケーション・プロジェクトが作成されます。このプロジェクトにはメイン・クラスが設定されていません。フォームを作成し、このフォームをメイン・クラスとして設定します。
@@ -138,10 +138,10 @@
4. このダイアログ・ボックスで、「 ``hibernate.show_sql`` 」プロパティを選択し、値を「 ``true`` 」に設定します。「OK」をクリックします。これにより、SQL文のデバッグ・ロギングが有効になります。
image::images/add-property-showsql.png[title="hibernate.show_sqlプロパティの設定値が表示された「Hibernateのプロパティの追加」ダイアログ・ボックス"]
-[start=5]
+
. 「その他のプロパティ」ノードの下にある「追加」をクリックし、「プロパティ名」ドロップダウン・リストで「 ``hibernate.query.factory_class`` 」を選択します。
-[start=6]
+
. プロパティ値として*org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory*を入力します。
これは、IDEにバンドルされているHibernate 4で使用されるトランスレータ・ファクトリ・クラスです。
@@ -173,7 +173,7 @@
</hibernate-configuration>
----
-[start=7]
+
. 変更内容をファイルに保存します。
フォームを作成してメイン・クラスとして設定した後に、プロジェクトを実行すると、IDEの出力ウィンドウにSQL問合せが表示されます。
@@ -189,7 +189,7 @@
2. 「カテゴリ」の一覧から「Hibernate」を選択し、「ファイル・タイプ」の一覧から「HibernateUtil.java」を選択します。「次」をクリックします。
image::images/hib-util.png[title="HibernateUtilの作成方法を示す新規ファイル・ウィザード"]
-[start=3]
+
. クラス名として「*HibernateUtil*」を入力し、パッケージ名として「*sakila.util*」を入力します。「終了」をクリックします。
「終了」をクリックすると、 ``HibernateUtil.java`` がエディタに表示されます。このファイルは、編集する必要がないため閉じてかまいません。
@@ -281,7 +281,7 @@
|表 | ``resultTable``
|===
-[start=9]
+
. 変更を保存します。
デザイン・ビューのフォームは、次のイメージのような外観になります。
@@ -306,7 +306,7 @@
image::images/hib-query-hqlresults.png[title="HQL問合せ結果が表示されたHQL問合せエディタ"]
-[start=5]
+
. 検索文字列が「PE」の場合、次の問合せをHQL問合せエディタに入力して「HQL問合せの実行」をクリックし、問合せ結果を確認します。
[source,java]
@@ -326,7 +326,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. 新しいHQL問合せエディタのタブを開き、次の問合せをエディタ・ペインに入力します。「HQL問合せの実行」をクリックします。
[source,java]
@@ -361,7 +361,7 @@
問合せをHQL問合せエディタのタブからファイルにコピーし、コードを変更できます。
-[start=3]
+
. 次のメソッドを追加し、ユーザー入力文字列に基づく問合せを作成します。
[source,java]
@@ -379,7 +379,7 @@
このメソッドは、 ``executeHQLQuery()`` というメソッドをコールし、問合せ文字列をユーザーが入力した検索文字列と組み合せて問合せを作成します。
-[start=4]
+
. ``executeHQLQuery()`` メソッドを追加します。
[source,java]
@@ -402,16 +402,16 @@
``executeHQLQuery()`` メソッドは、Hibernateをコールして、選択した問合せを実行します。このメソッドは、 ``HibernateUtil.java`` ユーティリティ・クラスを使用してHibernateセッションを取得します。
-[start=5]
+
. エディタを右クリックして「インポートを修正」([Ctrl]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、Hibernateライブラリ( ``org.hibernate.Query`` 、 ``org.hibernate.Session`` )および ``java.util.List`` に対するインポート文を生成します。変更を保存します。
-[start=6]
+
. デザイン・ビューに切り替えて「問合せ」ボタンをダブルクリックすることで、「問合せ」ボタン・イベント・ハンドラを作成します。
IDEで ``queryButtonActionPerformed`` メソッドが作成され、このメソッドがソース・ビューに表示されます。
-[start=7]
+
. ユーザーがボタンをクリックすると問合せが実行されるように、ソース・ビューの ``queryButtonActionPerformed`` メソッドに次のコードを追加して変更します。
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=8]
+
. 次のメソッドを追加し、結果がJTableに表示されるようにします。
[source,java]
@@ -453,7 +453,7 @@
}
----
-[start=9]
+
. エディタを右クリックして「インポートを修正」([Ctrl]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、 ``java.util.Vector`` と ``java.util.List`` に対するインポート文を生成します。変更を保存します。
フォームの保存後、プロジェクトを実行できます。
@@ -471,7 +471,7 @@
image::images/browse-main-class.png[title="「メイン・クラスの参照」ダイアログでのメイン・クラスの設定"]
-[start=4]
+
. メイン・ツールバーの「プロジェクトの実行」をクリックし、アプリケーションを起動します。
検索文字列を「名」または「姓」テキスト・フィールドに入力し、「問合せ」をクリックして俳優を検索し、詳細を確認します。
@@ -492,22 +492,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/java/DVDStoreAdmin-Ant*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
*注意:*ソースをチェックアウトするには、Subversionクライアントが必要です。Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
@@ -534,17 +534,17 @@
}
----
-[start=4]
+
. エディタを右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、ポップアップ・メニューから「取得メソッドおよび設定メソッド」を選択して、フィールドに対する取得メソッドと設定メソッドを生成します。
-[start=5]
+
. 「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスですべてのフィールドを選択し、「生成」をクリックします。
image::images/getters-setters.png[title="「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックス"]
「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスでは、キーボードの[↑]を使用して、選択した項目を「Actor」ノードまで移動してから、[Space]バーを押してActor内のすべてのフィールドを選択できます。
-[start=6]
+
. インポートを修正して変更内容を保存します。
表のためのPOJOの作成後、 ``Actor.java`` のHibernateマッピング・ファイルを作成します。
@@ -566,7 +566,7 @@
</hibernate-configuration>
----
-[start=5]
+
. 次の太字部分の変更を ``Actor.hbm.xml`` に加えて、 ``Actor.java`` のフィールドをACTOR表の列にマップします。
[source,xml]
@@ -605,7 +605,7 @@
</hibernate-mapping>
----
-[start=6]
+
. ツールバーの「XMLの検証」ボタンをクリックし、変更内容を保存します。
POJOとHibernateのマッピング・ファイルを個別に作成すると、アプリケーションをさらにカスタマイズするときに役立つ場合があります。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_pt_BR.asciidoc
index f8dcb22..57c810a 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_pt_BR.asciidoc
@@ -81,7 +81,7 @@
Quando você clicar em OK, um nó do Salkila será exibido sob o nó Servidor MySQL.
-[start=5]
+
. Clique com o botão direito do mouse no nó do Sakila e escolha Conectar.
Quando você clicar em Conectar, um nó de conexão do banco de dados do banco de dados Sakila ( ``jdbc:mysql://localhost:3306/sakila [_nome de usuário_ em Default]`` ) será apresentado no nó Bancos de Dados. Quando uma conexão for aberta, você poderá exibir os dados no banco de dados ampliando o nó de conexão.
@@ -96,7 +96,7 @@
3. Desmarque a opção Usar Pasta Dedicada, se ela estiver selecionada.
Para este tutorial, não é necessário copiar as bibliotecas do projeto em uma pasta dedicada, pois você não precisará compartilhar bibliotecas com outros usuários.
-[start=4]
+
. Desmarque Criar Classe Principal. Clique em Finalizar.
Quando você clicar em Finalizar, o IDE criará o projeto da aplicação Java. O projeto não tem uma classe principal. Você criará um form e o definirá como classe principal.
@@ -138,10 +138,10 @@
4. Na caixa de diálogo, selecione a propriedade ``hibernate.show_sql`` e defina o valor para ``true`` . Clique em OK. Isso ativa o log de depuração das instruções SQL.
image::images/add-property-showsql.png[title="Caixa de diálogo Adicionar Propriedade Hibernate que mostra o valor de definição de hibernate.show_sql"]
-[start=5]
+
. Clique em Adicionar no nó Propriedades Diversas e selecione ``hibernate.query.factory_class`` na lista drop-down Nome da Propriedade.
-[start=6]
+
. Digite *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* como Valor da Propriedade.
Esta é a classe translator factory usada no Hibernate 4 que acompanha o IDE.
@@ -173,7 +173,7 @@
</hibernate-configuration>
----
-[start=7]
+
. Salve as alterações feitas no arquivo.
Após você criar o form e defini-lo como a classe principal você poderá ver a consulta SQL impressa na janela de Saída do IDE quando você executar o projeto.
@@ -189,7 +189,7 @@
2. Selecione Hibernate na lista Categorias e HibernateUtil.java na lista Tipos de Arquivo. Clique em Próximo.
image::images/hib-util.png[title="O assistente Novo Arquivo que mostram como criar HibernateUtil"]
-[start=3]
+
. Insira *HibernateUtil* como nome da classe e *sakila.util* como nome do pacote. Clique em Finalizar.
Quando você clicar em Finalizar, o ``HibernateUtil.java`` será aberto no editor. Você pode fechar o arquivo porque não precisa editá-lo.
@@ -281,7 +281,7 @@
|Tabela | ``resultTable``
|===
-[start=9]
+
. Salve as alterações.
Na view Design, seu form deve parecer com a imagem a seguir.
@@ -306,7 +306,7 @@
image::images/hib-query-hqlresults.png[title="Hql Editor de Consulta mostrando resultados da consulta HQL"]
-[start=5]
+
. Digite a consulta a seguir no Editor de Consultas HQL e clique em Executar consulta HQL para verificar os resultados da consulta quando a string de pesquisa for "PE".
[source,java]
@@ -326,7 +326,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. Abra uma nova guia do Editor de Consulta HQL e insira a consulta a seguir no painel do editor. Clique em Executar Consulta HQL.
[source,java]
@@ -361,7 +361,7 @@
É possível copiar as consultas das guias do Editor de Consulta HQL para o campo e, em seguida, modificar o código.
-[start=3]
+
. Adicione os métodos a seguir para criar a consulta com base na string de entrada do usuário.
[source,java]
@@ -379,7 +379,7 @@
Esses métodos chamam o método ``executeHQLQuery()`` e cria a consulta combinando a string de consulta com o usuário que inseriu a string de pesquisa.
-[start=4]
+
. Adicione o método ``executeHQLQuery()`` .
[source,java]
@@ -402,16 +402,16 @@
O método ``executeHQLQuery()`` chama o Hibernate para executar a consulta selecionada. Esse método usa a classe de utilitário ``HibernateUtil.java`` para obter a Sessão Hibernate.
-[start=5]
+
. Clique com o botão direito do mouse no Editor e escolha Corrigir Importações (ctrl-shift-i; ⌘-shift-i em mac) para gerar instruções de importação para as bibliotecas de Hibernação ( ``org.hibernate.query`` , ``org.hibernate.session`` ) e ``java.util.list`` . Salve as alterações.
-[start=6]
+
. Crie um handler de eventos do botão Consulta alternando para a view Design e clicando duas vezes no botão Consulta.
O IDE cria o método ``queryButtonActionPerformed`` e exibe o método na view Código-fonte.
-[start=7]
+
. Modifique o método ``queryButtonActionPerformed`` na view Código-fonte adicionando o código a seguir de modo que uma consulta seja executada quando o usuário clicar no botão.
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=8]
+
. Adicione o método a seguir para exibir os resultados na JTable.
[source,java]
@@ -453,7 +453,7 @@
}
----
-[start=9]
+
. Clique com o botão direito do mouse no editor e escolha Corrigir Importações (Ctrl-Shift-I; ⌘-Shift-I no Mac) para gerar uma instrução de importação para ``java.util.Vector`` e ``java.util.List`` . Salve as alterações.
Depois de salvar o form, você pode executar o projeto.
@@ -471,7 +471,7 @@
image::images/browse-main-class.png[title="Definindo a Classe Principal na caixa de diálogo Procurar Classes Principais"]
-[start=4]
+
. Clique em Executar Projeto principal na barra de ferramentas principal para iniciar a aplicação.
Insira uma string de pesquisa no campo de texto Nome ou Sobrenome e clique em Consulta para pesquisar um ator e exibir os detalhes.
@@ -492,22 +492,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar nas Pastas do Repositório:
-[start=4]
+
. Expanda o nó-raiz e selecione *samples/java/DVDStoreAdmin-Ant*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
*Observação.* É necessário um cliente Subversion para verificar os códigos-fonte. Para saber mais sobre a instalação do Subversion, consulte a seção link:../ide/subversion.html#settingUp[+Configurando o Subversion+] no link:../ide/subversion.html[+Guia do Subversion no NetBeans IDE+].
@@ -534,17 +534,17 @@
}
----
-[start=4]
+
. Clique com o botão direito do mouse no Editor e escolha Inserir Código (Alt-Insert; Ctrl-I em Mac) e selecione getter e setter no menu pop-up para gerar getters e setters para os campos.
-[start=5]
+
. Na caixa de diálogo Gerar Getters e Setters, selecione todos os campos e clique em Gerar.
image::images/getters-setters.png[title="Caixa de diálogo Gerar Getters e Setters"]
Na caixa de diálogo Gerar Getters e Setters, você pode usar a seta para cima no teclado para mover o item selecionado para o nó Ator e pressionar a barra de espaços para selecionar todos os campos em Ator.
-[start=6]
+
. Corrija as importações e salve as alterações.
Depois de criar o POJO para a tabela, você desejará criar um arquivo de mapeamento do Hibernate para ``Actor.java`` .
@@ -566,7 +566,7 @@
</hibernate-configuration>
----
-[start=5]
+
. Associe os campos ``Actor.java`` às colunas na tabela ACTOR fazendo as seguintes alterações (em negrito) no ``Actor.hbm.xml`` .
[source,xml]
@@ -605,7 +605,7 @@
</hibernate-mapping>
----
-[start=6]
+
. Clique no botão Validar XML na barra de ferramentas e salve as alterações.
A criação de POJOs individuais e arquivos de mapeamento do Hibernate pode ser um modo conveniente de personalizar ainda mais sua aplicação.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ru.asciidoc
index e2a5839..21ac9e4 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_ru.asciidoc
@@ -81,7 +81,7 @@
При нажатии кнопки "OK" узел "Sakila" появится под узлом "MySQL Server".
-[start=5]
+
. Щелкните правой кнопкой мыши узел "Sakila" и выберите "Connect".
После нажатия кнопки "Connect a database" под узлом "Databases" отобразится узел подключения к базе данных "Sakila" ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` ). При открытом подключении для просмотра данных в базе данных разверните этот узел подключения.
@@ -96,7 +96,7 @@
3. Снимите флажок "Использовать отдельную папку", если он установлен.
В рамках этого руководства копирование библиотек проекта в выделенную папку лишено смысла, поскольку совместное использование библиотек с другими пользователями не потребуется.
-[start=4]
+
. Снимите флажок "Create Main Class". Нажмите кнопку "Завершить".
При нажатии кнопки "Finish" в среде IDE будет создан проект приложения Java. В проекте нет главного класса. Следует создать форму и установить ее в качестве главного класса.
@@ -138,10 +138,10 @@
4. В диалоговом окне выберите свойство ``hibernate.show_sql`` и установите значение ``true`` . Нажмите кнопку "ОК". Это приведет ко включению протоколирования отладки операторов SQL.
image::images/add-property-showsql.png[title="Диалоговое окно 'Добавить свойство Hibernate', в котором отображаются значения настроек для свойства hibernate.show_sql"]
-[start=5]
+
. Щелкните "Добавить" в узле "Различные свойства" и выберите ``hibernate.query.factory_class`` в раскрывающемся списке "Имя свойства".
-[start=6]
+
. Введите *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* в качестве значения свойства.
Класс 'translator factory' используется в библиотеке Hibernate 4, связанной с IDE.
@@ -173,7 +173,7 @@
</hibernate-configuration>
----
-[start=7]
+
. Сохраните измененный файл.
После создания формы и настройки ее в качестве основного класса, вы сможете увидеть SQL запросов, выведенные на печать в окне вывода IDE при выполнении проекта.
@@ -189,7 +189,7 @@
2. Выберите "Hibernate" из списка "Categories" и "HibernateUtil.java" из списка "File Types". Нажмите кнопку "Далее".
image::images/hib-util.png[title="Описание создания HibernateUtil с помощью мастера создания файлов"]
-[start=3]
+
. Введите *HibernateUtil* в качестве имени класса и *sakila.util* в качестве имени пакета. Нажмите кнопку "Завершить".
После нажатия кнопки "Finish" в редакторе откроется класс ``HibernateUtil.java`` . Файл можно закрыть, т.к. необходимость в его изменении отсутствует.
@@ -281,7 +281,7 @@
|Таблица | ``resultTable``
|===
-[start=9]
+
. Сохраните изменения.
В режиме проектирования внешний вид формы выглядит так, как показано на следующем рисунке.
@@ -306,7 +306,7 @@
image::images/hib-query-hqlresults.png[title="Редактор запросов HQL с отображением результатов запроса HQL"]
-[start=5]
+
. Введите следующий запрос в редактор запросов HQL Query Editor и нажмите кнопку "Выполнить запрос HQL" для проверки результатов запроса при вводе значения "PE" в строку поиска.
[source,java]
@@ -326,7 +326,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. Откройте новую вкладку редактора HQL Query Editor и введите следующий запрос на панели редактирования. Нажмите кнопку "Run HQL Query".
[source,java]
@@ -361,7 +361,7 @@
Запросы можно скопировать из вкладок редактора запросов HQL Query Editor в файл, а затем изменить код.
-[start=3]
+
. Добавьте следующие методы для создания запроса на основе строки со вводимой пользователем информацией.
[source,java]
@@ -379,7 +379,7 @@
Эти методы обеспечивают вызов метода с именем ``executeHQLQuery()`` и создание запроса путем объединения строки запроса с информацией пользователя, вводимой в строку поиска.
-[start=4]
+
. Добавьте метод ``executeHQLQuery()`` .
[source,java]
@@ -402,16 +402,16 @@
Метод ``executeHQLQuery()`` обеспечивает вызов библиотеки Hibernate для выполнения выбранного запроса. В этом методе служебный класс ``HibernateUtil.java`` применяется для получения объекта Hibernate "Session".
-[start=5]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' (Ctrl-Shift-I; ⌘-Shift-I в Mac) для создания операторов импорта для библиотек Hibernate ( ``org.hibernate.Query`` , ``org.hibernate.Session`` ) и ``java.util.List`` . Сохраните изменения.
-[start=6]
+
. Создайте обработчик событий для кнопки "Query", переключившись в режим проектирования и дважды нажав кнопку "Query".
В среде IDE будет создан метод ``queryButtonActionPerformed`` , который затем отобразится в режиме просмотра исходного кода.
-[start=7]
+
. Измените метод ``queryButtonActionPerformed`` в режиме просмотра исходного кода путем добавления следующего кода, обеспечивающего выполнение запроса при нажатии кнопки пользователем.
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=8]
+
. Добавьте следующий метод для просмотра результатов в "JTable".
[source,java]
@@ -453,7 +453,7 @@
}
----
-[start=9]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' (Ctrl-Shift-I; ⌘-Shift-I в Mac) для создания оператора импорта для ``java.util.Vector`` и ``java.util.List`` . Сохраните изменения.
После сохранения формы можно запустить проект.
@@ -471,7 +471,7 @@
image::images/browse-main-class.png[title="Установка главного класса в диалоговом окне 'Обзор главных классов'"]
-[start=4]
+
. Нажмите кнопку "Run Project" на главной панели инструментов для запуска приложения.
Введите информацию в строке поиска для текстовых полей "First Name" или "Last Name" и нажмите кнопку "Query" для поиска актера и просмотра подробных данных.
@@ -492,22 +492,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку "Обзор" для открытия диалогового окна "Обзор папок репозитория".
-[start=4]
+
. Разверните корневой узел и выберите *samples/java/DVDStoreAdmin-Ant*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечание.* Для получения исходных файлов на редактирование требуется клиент Subversion. Дополнительные сведения об установке Subversion см. в разделе link:../ide/subversion.html#settingUp[+Настройка Subversion+] в link:../ide/subversion.html[+Руководстве по Subversion в IDE NetBeans+].
@@ -534,17 +534,17 @@
}
----
-[start=4]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Вставить код' (Alt-Insert, Ctrl-I на Mac) и выберите методы получения и установки в контекстном меню для создания методов получения и установки для полей.
-[start=5]
+
. В диалоговом окне "Generate Getters and Setters" выберите все поля и нажмите кнопку "Generate".
image::images/getters-setters.png[title="Диалоговое окно 'Создание методов получения и установки'"]
В диалоговом окне "Generate Getters and Setters" можно использовать стрелку вверх на клавиатуре для перемещения выбранного элемента к узлу "Actor", а затем нажать клавишу "пробел" и выбрать все поля "Actor".
-[start=6]
+
. Исправьте операторы импорта и сохраните измененные данные.
После создания объекта POJO для таблицы необходимо создать файл сопоставления библиотеки Hibernate для класса ``Actor.java`` .
@@ -566,7 +566,7 @@
</hibernate-configuration>
----
-[start=5]
+
. Сопоставьте поля в ``Actor.java`` со столбцами в таблице "ACTOR" путем внесения следующих изменений (выделены полужирным шрифтом) в ``Actor.hbm.xml`` .
[source,xml]
@@ -605,7 +605,7 @@
</hibernate-mapping>
----
-[start=6]
+
. Нажмите кнопку "Validate XML" на панели инструментов и сохраните изменения.
Создание объектов POJO и файлов сопоставления библиотеки Hibernate может эффективно использоваться для дальнейшей настройки приложения.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_zh_CN.asciidoc
index 92ca26e..ccae185 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/hibernate-java-se_zh_CN.asciidoc
@@ -81,7 +81,7 @@
单击 "OK"(确定),MySQL 服务器节点下随即出现一个 Sakila 节点。
-[start=5]
+
. 右键单击 "Sakila" 节点,然后选择 "Connect"(连接)。
单击 "Connect"(连接)后,"Databases"(数据库)节点下面将列出 Sakila 数据库连接节点 ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` )。打开连接时,可通过展开该连接节点查看数据库中数据。
@@ -96,7 +96,7 @@
3. 取消选中 "Use Dedicated Folder"(使用专用文件夹)选项(如果该选项处于选中状态)。
对于本教程,没有理由将项目库复制到指定文件夹,因为您将需要与其他用户共享库。
-[start=4]
+
. 取消选中 "Create Main Class"(创建主类)。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将创建 Java 应用程序项目。项目没有设置主类。您将创建一个窗体,然后将该窗体设置为主类。
@@ -138,10 +138,10 @@
4. 在此对话框中,选择 ``hibernate.show_sql`` 属性并将值设置为 ``true`` 。单击 "OK"(确定)。这将启用 SQL 语句的调试日志记录。
image::images/add-property-showsql.png[title="显示 hibernate.show_sql 属性的设置值的 "Add Hibernate Property"(添加 Hibernate 属性)对话框"]
-[start=5]
+
. 单击 "Miscellaneous Properties"(其他属性)节点下的 "Add"(添加),然后选择 "Property Name"(属性名称)下拉列表中的 ``hibernate.query.factory_class`` 。
-[start=6]
+
. 键入 *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* 作为属性值。
这是在随 IDE 捆绑提供的 Hibernate 4 中使用的转换器工厂类。
@@ -173,7 +173,7 @@
</hibernate-configuration>
----
-[start=7]
+
. 保存对该文件所做的更改。
创建窗体并将其设置为主类之后,在运行项目时还将看到输出到 IDE 的 "Output"(输出)窗口中的 SQL 查询。
@@ -189,7 +189,7 @@
2. 从 "Categories"(类别)列表中选择 "Hibernate",从 "File Types"(文件类型)列表中选择 HibernateUtil.java。单击 "Next"(下一步)。
image::images/hib-util.png[title="显示如何创建 HibernateUtil 的新建文件向导"]
-[start=3]
+
. 键入 *HibernateUtil* 作为类名,并键入 *sakila.util* 作为包名。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 ``HibernateUtil.java`` 将在编辑器中打开。由于不需要编辑该文件,因此可以关闭该文件。
@@ -281,7 +281,7 @@
|表 | ``resultTable``
|===
-[start=9]
+
. 保存所做的更改。
在 "Design"(设计)视图中,您的窗体应与下图类似。
@@ -306,7 +306,7 @@
image::images/hib-query-hqlresults.png[title="显示 HQL 查询结果的 HQL 查询编辑器"]
-[start=5]
+
. 在 HQL 查询编辑器中键入以下查询,然后单击 "Run HQL Query"(运行 HQL 查询)查询搜索字符串为 "PE" 时的查询结果。
[source,java]
@@ -326,7 +326,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. 打开一个新的 HQL 查询编辑器标签,在编辑器窗格中键入以下查询。单击 "Run HQL Query"(运行 HQL 查询)按钮。
[source,java]
@@ -361,7 +361,7 @@
可以将 HQL 查询编辑器标签中的查询复制到文件中,然后再修改代码。
-[start=3]
+
. 添加以下方法,以根据用户输入字符串创建查询。
[source,java]
@@ -379,7 +379,7 @@
这些方法调用一个名称为 ``executeHQLQuery()`` 的方法,并通过结合查询字符串与用户输入的搜索字符串来创建查询。
-[start=4]
+
. 添加 ``executeHQLQuery()`` 方法。
[source,java]
@@ -402,16 +402,16 @@
``executeHQLQuery()`` 方法调用 Hibernate 来执行选定的查询。该方法利用 ``HibernateUtil.java`` 实用程序类来获取 Hibernate 会话。
-[start=5]
+
. 在编辑器中右键单击并选择 "Fix Imports"(修复导入)(Ctrl-Shift-I;在 Mac 上为 ⌘-Shift-I)可为 Hibernate 库( ``org.hibernate.Query`` 、 ``org.hibernate.Session`` )和 ``java.util.List`` 生成导入语句。保存所做的更改。
-[start=6]
+
. 切换到 "Design"(设计)视图并双击 "Query" 按钮,创建一个 "Query" 按钮事件处理程序。
IDE 将创建 ``queryButtonActionPerformed`` 方法并在 "Source"(源)视图中显示该方法。
-[start=7]
+
. 在 "Source"(源)视图中修改 ``queryButtonActionPerformed`` 方法,添加以下代码,以便查询能在用户单击按钮时正确运行。
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=8]
+
. 添加以下方法,在 JTable 中显示结果。
[source,java]
@@ -453,7 +453,7 @@
}
----
-[start=9]
+
. 在编辑器中右键单击并选择 "Fix Imports"(修复导入)(Ctrl-Shift-I;在 Mac 上为 ⌘-Shift-I)可为 ``java.util.Vector`` 和 ``java.util.List`` 生成导入语句。保存所做的更改。
保存窗体之后,您可以运行项目。
@@ -471,7 +471,7 @@
image::images/browse-main-class.png[title="在 "Browse Main Classes"(浏览主类)对话框中设置主类"]
-[start=4]
+
. 单击主工具栏中的 "Run Project"(运行项目)以启动应用程序。
在 "First Name" 或 "Last Name" 字段中键入搜索字符串,并单击 "Query" 来搜索演员并查看详细信息。
@@ -492,22 +492,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repostiory Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点,然后选择 *samples/java/DVDStoreAdmin-Ant*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
*注:*需要 Subversion 客户端检出源代码。有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
@@ -534,17 +534,17 @@
}
----
-[start=4]
+
. 在编辑器中右键单击,选择 "Insert Code"(插入代码)(Alt-Insert;在 Mac 上为 Ctrl-I)并在弹出菜单中选择 "Getter and Setter"(Getter 和 Setter),可以为字段生成 getter 和 setter。
-[start=5]
+
. 在 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框中,选择所有字段并单击 "Generate"(生成)。
image::images/getters-setters.png[title=""Generate Getters and Setters"(生成 getter 和 setter)对话框"]
在 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框中,您可以使用键盘中的向上箭头将所选项目移动到 Actor 节点中,然后按空格键选择 Actor 中的所有字段。
-[start=6]
+
. 修复导入并保存更改。
为表创建 POJO 之后,您需要为 ``Actor.java`` 创建一个 Hibernate 映射文件。
@@ -566,7 +566,7 @@
</hibernate-configuration>
----
-[start=5]
+
. 对 ``Actor.hbm.xml`` 执行以下更改(黑体),将 ``Actor.java`` 中的字段映射到 ACTOR 表中的列。
[source,xml]
@@ -605,7 +605,7 @@
</hibernate-mapping>
----
-[start=6]
+
. 单击工具栏中的 "Validate XML"(验证 XML)按钮并保存更改。
如果要进一步定制应用程序,单独创建 POJO 和 Hibernate 映射文件可能是一种非常方便的方法。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy.asciidoc
index 700a124..2944560 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy.asciidoc
@@ -55,25 +55,25 @@
This zip archive contains source files for the application plus a few other files that will be used in the tutorial.
-[start=2]
+
. In NetBeans IDE, choose File > New Project.
-[start=3]
+
. In the Choose Category page, select Java Project With Existing Sources in the Java category and click Next.
-[start=4]
+
. On the Name and Location page of the wizard, type ``AnotherGrep`` as the project name and specify the project's location.
Click Next.
The project folder does _not_ have to be in the same location as the source files that you are importing into the project.
-[start=5]
+
. On the Existing Sources page of the wizard, specify the sources that will be in the project.
Click the Add Folder button that is to the right of the Source Package Folders field. Navigate to the ``DeploymentTutorial`` folder that you have just unzipped on your system, expand the folder, select the ``src`` folder, and click Open. The ``src`` folder is added to your Source Package Folders field.
-[start=6]
+
. Click Finish.
NOTE: If, for example, you want to exclude some source files from importing into the project, click Next to open the last Includes & Excludes window. In our case, we want to use all the source files in the ``src`` folder, so we click Finish to finish working in the New Project wizard.
@@ -309,19 +309,19 @@
3. For Windows XP, double-click Folder Options and select the File Types tab.
For Windows Vista or 7, click Default Programs and select Associate a file type or protocol with a program.
-[start=4]
+
. In the Registered File Types list, select JAR File.
-[start=5]
+
. (On Windows XP, in the Details section of the dialog box), click Change Program.
-[start=6]
+
. In the Open With dialog box, select Java Platform SE Binary.
-[start=7]
+
. Click OK to exit the Open With dialog box.
-[start=8]
+
. Click Close to exit the Folder Options dialog box (on Windows XP) or the Associate a file type or protocol with a specific program dialog box (on Windows 7).
NOTE: If JAR files are associated with the Java Platform SE Binary on your system but double-clicking still does not execute the file JAR file, you might need to specify the ``-jar`` option in the file association.
@@ -348,13 +348,13 @@
"C:\Program Files\Java\jre1.7.0_51\bin\javaw.exe" -jar "%1" %*
----
-[start=7]
+
. Click OK to exit the Editing Action for Type dialog box.
-[start=8]
+
. Click OK to exit the Edit File Type dialog box.
-[start=9]
+
. Click Close to exit the Folder Options dialog box.
NOTE: Starting with Windows Vista advanced file associations can be set via RegEdit. See the link:http://technet.microsoft.com/en-us/magazine/ee914604.aspx[+What Happened to the File Types Dialog?+] article for details.
@@ -382,7 +382,7 @@
C:\Program Files\Java\jdk1.7.0_51\bin
----
-[start=6]
+
. Click OK to exit the Environment Variables dialog box, and click OK to exit the System Properties dialog box.
If you are running on a UNIX or Linux system, the instructions for modifying your PATH variable depends on the shell program you are using. Consult the documentation of the shell that you are using for more information.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ja.asciidoc
index bc2232b..d643243 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ja.asciidoc
@@ -83,25 +83,25 @@
このzipアーカイブには、アプリケーションのソース・ファイルに加えて、このチュートリアルで使用されるその他のファイルもいくつか含まれています。
-[start=2]
+
. NetBeans IDEで、「ファイル」>「新規プロジェクト」を選択します。
-[start=3]
+
. カテゴリを選択ページで、「Java」カテゴリにある「既存のソースを使用するJavaプロジェクト」を選択し、「次」をクリックします。
-[start=4]
+
. ウィザードの名前と場所ページで、プロジェクト名として「 ``AnotherGrep`` 」と入力し、プロジェクトの場所を指定します。
「次」をクリックします。
プロジェクト・フォルダが、プロジェクトにインポートするソース・ファイルと同じ場所に存在する必要は_ありません_。
-[start=5]
+
. ウィザードの既存のソース・ページで、プロジェクトに含めるソースを指定します。
「ソース・パッケージ・フォルダ」フィールドの右にある「フォルダの追加」ボタンをクリックします。システム上にある解凍済の ``DeploymentTutorial`` フォルダに移動してそのフォルダを展開し、 ``src`` フォルダを選択して「開く」をクリックします。 ``src`` フォルダが「ソース・パッケージ・フォルダ」フィールドに追加されます。
-[start=6]
+
. 「終了」をクリックします。
*注意:* たとえば、プロジェクトへのインポートから一部のソース・ファイルを除外する場合は、「次」をクリックして最後の「含める/除外する」ウィンドウを開きます。ここでは、 ``src`` フォルダ内のすべてのソース・ファイルを使用するため、「終了」をクリックして新規プロジェクト・ウィザードでの操作を終了します。
@@ -331,18 +331,18 @@
*注意:* 2013年4月のJava SE 7 Update 21以降、すべてのJavaアプレットおよびWeb Startアプリケーションは、信頼できる証明書で署名することを求められます。詳細は、link:http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html[+JavaアプレットとWeb Start - コード署名+]を参照してください。
-[start=5]
+
. その他の設定はすべてデフォルト値のままにして、「OK」をクリックします。
-[start=6]
+
. プロジェクトのノードを右クリックし、「消去してビルド」を選択します。
このIDEコマンドによって、以前にコンパイルされたファイルやビルド出力がすべて削除され、アプリケーションが再コンパイルされて、プロジェクトが新しい設定でビルドされます。
-[start=7]
+
. IDEの外部で、 ``_PROJECT_HOME_/dist`` フォルダを開き、 ``launch.html`` ファイルをブラウザで開きます。
「Launch」ボタンを含むテスト用HTMLページが開きます。
-[start=8]
+
. 「Launch」ボタンをクリックしてアプリケーションを開きます。
Javaがロードされ、アプリケーションが起動されることが確認できます。
@@ -380,19 +380,19 @@
3. Windows XPの場合は、「フォルダ オプション」をダブルクリックし、「ファイルの種類」タブを選択します。
Windows VistaまたはWindows 7の場合は、「既定のプログラム」をクリックし、「ファイルの種類またはプロトコルのプログラムへの関連付け」を選択します。
-[start=4]
+
. 「登録されているファイルの種類」リストで、「JARファイル」を選択します。
-[start=5]
+
. (Windows XPの場合は、ダイアログ・ボックスの「詳細」セクションで)「プログラムの変更」をクリックします。
-[start=6]
+
. 「ファイルを開くプログラムの選択」ダイアログ・ボックスで、「Java Platform SEバイナリ」を選択します。
-[start=7]
+
. 「OK」をクリックして「ファイルを開くプログラムの選択」ダイアログ・ボックスを終了します。
-[start=8]
+
. 「閉じる」をクリックして、「フォルダ オプション」ダイアログ・ボックス(Windows XPの場合)、または「ファイルの種類またはプロトコルのプログラムへの関連付け」ダイアログ・ボックス(Windows 7の場合)を終了します。
*注意:* システム上でJARファイルがJava Platform SEバイナリに関連付けられているが、依然としてJARファイルをダブルクリックしても実行されない場合は、ファイルの関連付けで ``-jar`` オプションの指定が必要である可能性があります。
@@ -419,13 +419,13 @@
"C:\Program Files\Java\jre1.7.0_51\bin\javaw.exe" -jar "%1" %*
----
-[start=7]
+
. 「OK」をクリックして「アクションの編集」ダイアログ・ボックスを終了します。
-[start=8]
+
. 「OK」をクリックして「ファイルの種類の編集」ダイアログ・ボックスを終了します。
-[start=9]
+
. 「閉じる」をクリックして「フォルダ オプション」ダイアログ・ボックスを終了します。
*注意:* Windows Vista以降の詳細なファイルの関連付けは、RegEditを使用して設定できます。詳細は、link:http://technet.microsoft.com/en-us/magazine/ee914604.aspx[+「ファイルの種類」ダイアログで何が発生したか+]の記事を参照してください。
@@ -454,7 +454,7 @@
C:\Program Files\Java\jdk1.7.0_51\bin
----
-[start=6]
+
. 「OK」をクリックして「環境変数」ダイアログ・ボックスを終了し、「OK」をクリックして「システムのプロパティ」ダイアログ・ボックスを終了します。
UNIXまたはLinuxシステム上で実行している場合、PATH変数を変更するための手順は、使用しているシェル・プログラムによって異なります。詳細は、使用しているシェルのドキュメントを参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_pt_BR.asciidoc
index 388eca7..4be6cf4 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_pt_BR.asciidoc
@@ -84,25 +84,25 @@
Esse arquivo compactado zip contém arquivos de código-fonte para a aplicação, além de alguns outros arquivos que serão usados no tutorial.
-[start=2]
+
. No NetBeans IDE, escolha Arquivo > Novo Projeto.
-[start=3]
+
. Na página Selecionar Categoria, selecione Projeto Java com Códigos-fonte Existentes na categoria Java e clique em Próximo.
-[start=4]
+
. Na página Nome e Localização do assistente, digite ``AnotherGrep`` como o nome do projeto e especifique o local do projeto.
Clique em Próximo.
A pasta do projeto _não_ precisa estar no mesmo local que os arquivos de código-fonte que você está importando para o projeto.
-[start=5]
+
. Na página Códigos-fonte existentes do assistente, especifique os códigos-fonte que estarão no projeto.
Clique no botão Adicionar Pasta, à direita do campo Pastas de Pacote de Código-fonte. Navegue até a pasta ``DeploymentTutorial`` que você acabou de descompactar em seu sistema, expanda a pasta, selecione a pasta ``src`` e clique em Abrir. A pasta ``src`` é adicionada ao campo Pastas de Pacote de Código-fonte.
-[start=6]
+
. Clique em Finalizar.
*Observação:* Se, por exemplo, você desejar excluir alguns arquivos de código-fonte da importação para o projeto, clique em Próximo para abrir a última janela Inclusões e Exclusões. Em nosso caso, queremos usar todos os arquivos de código-fonte na pasta ``src`` , portanto clicamos em Finalizar para concluir o assistente Novo Projeto.
@@ -332,18 +332,18 @@
*Observação:* a partir do Java SE 7 Atualização 21 de abril de 2013, é recomendável que todos os Applets Java e Aplicações Web Start sejam assinados com um certificado confiável. Consulte link:http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html[+Applet Java e Web Start - Assinatura de Código+] para obter mais informações.
-[start=5]
+
. Deixe todas as outras definições com seus valores default e clique em OK.
-[start=6]
+
. Clique com o botão direito do mouse no nó do projeto e escolha Limpar e Construir Projeto.
Este comando do IDE deleta todos os arquivos anteriormente compilados e as saídas geradas, recompila sua aplicação e constrói o projeto com as novas definições.
-[start=7]
+
. Fora do IDE, abra a pasta ``_PROJECT_HOME_/dist`` e abra o arquivo ``launch.html`` no browser.
A página HTML de teste com o botão Iniciar é aberta.
-[start=8]
+
. Clique no botão Iniciar para abrir a aplicação.
Você pode ver que o Java foi carregado e a aplicação é iniciada.
@@ -381,19 +381,19 @@
3. Para Windows xp, clique duas vezes em Opções de Pasta e selecione a guia Tipos de Arquivo.
para Windows Vista ou 7, clique em Programas Default e selecione Associar um tipo de arquivo ou protocolo com um programa.
-[start=4]
+
. Na lista Tipos de Arquivos Registrados, selecione Arquivo JAR.
-[start=5]
+
. (no Windows XP, na seção Detalhes da caixa de diálogo), clique em Alterar Programa.
-[start=6]
+
. Na caixa de diálogo Abrir com, selecione Java Platform SE Binary.
-[start=7]
+
. Clique em OK para sair da caixa de diálogo Abrir com.
-[start=8]
+
. Clique em Fechar para sair da caixa de diálogo Opções de Pasta (no Windows xp) ou o tipo de arquivo ou associar um protocolo com uma caixa de diálogo de programa específico (no Windows 7).
*Observação:* se os arquivos JAR estiverem associados com o Java Platform SE Binary em seu sistema, mas ao clicar duas vezes ainda não foi executado o arquivo JAR, poderá ser necessário especificar a opção ``-jar`` na associação do arquivo.
@@ -420,13 +420,13 @@
"C:\Program Files\Java\jre1.7.0_51\bin\javaw.exe" -jar "%1" %*
----
-[start=7]
+
. Clique em OK para sair da caixa de diálogo Ação de Edição para o Tipo.
-[start=8]
+
. Clique em OK para sair da caixa de diálogo Editar Tipo de Arquivo.
-[start=9]
+
. Clique em Fechar para sair da caixa de diálogo Opções de Pasta.
*Observação:* iniciando com Windows Vista as associações do arquivo avançadas podem ser definidas por regedit. Consulte o artigo link:http://technet.microsoft.com/en-us/magazine/ee914604.aspx[+O que Aconteceu com a Caixa de Diálogo Tipos de Artigo?+] para obter detalhes.
@@ -455,7 +455,7 @@
C:\Program Files\Java\jdk1.7.0_51\bin
----
-[start=6]
+
. Clique em OK para sair da caixa de diálogo Variáveis de Ambiente, e clique em OK para sair da caixa de diálogo Propriedades do Sistema.
Se você estiver executando um sistema UNIX ou Linux, as instruções para modificar a variável PATH depende do programa shell que está em uso. Consulte a documentação do shell que está em uso para obter mais informações.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ru.asciidoc
index c472845..71f3c24 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_ru.asciidoc
@@ -83,25 +83,25 @@
Данный архив ZIP содержит файлы исходного кода для приложения, а также несколько других файлов, которые будут использованы в этом руководстве.
-[start=2]
+
. В IDE NetBeans выберите 'Файл' > 'Создать проект'.
-[start=3]
+
. На странице Choose Category ("Выбор категории") выберите Java Project With Existing Sources ("Проект Java с существующим исходным кодом") в категории Java и нажмите кнопку Next ("Далее").
-[start=4]
+
. На странице Name and Location ("Имя и местоположение") мастера введите ``AnotherGrep`` в поле имени проекта и укажите местоположение проекта.
Нажмите кнопку "Далее".
Местоположение папки проекта _не_ обязательно должно совпадать с местоположением исходных файлов, импортируемых в проект.
-[start=5]
+
. На странице мастера Existing Sources ("Существующие исходные файлы") укажите файлы исходного кода, которые будут включены в проект.
Нажмите кнопку Add Folder ("Добавить папку") справа от поля Source Package Folders ("Папки пакетов исходного кода"). Перейдите к папке ``DeploymentTutorial`` , которую только что разархивировали, разверните папку, выберите папку ``src`` и нажмите кнопку Open ("Открыть"). Папка ``src`` будет добавлена к полю Source Package Folders ("Папки пакетов исходного кода").
-[start=6]
+
. Нажмите кнопку "Завершить".
*Примечание.* Если, например, необходимо исключить определенные исходные файлы из операции импорта в проект, щелкните 'Далее', чтобы открыть последнее окно 'Включает & Исключает'. В этом случае необходимо использовать все исходные файлы в папке ``src`` поэтому нажимается кнопка 'Готово', чтобы завершить работу в мастере создания проектов.
@@ -331,18 +331,18 @@
*Примечание.* Начиная с обновления Java SE 7 Update 21, выпущенного в апреле 2013 г., рекомендуется использование подписанных доверенных сертификатов для всех Java-аплетов и приложений Web Start Для получения дополнительной информации см. link:http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html[+Апплеты Java и Web Start - подпись кода+].
-[start=5]
+
. Сохраните все прочие параметры по умолчанию и нажмите кнопку "OК".
-[start=6]
+
. Щелкните правой кнопкой мыши узел проекта и выберите Clean and Build Project ("Очистка и сборка проекта").
Данная команда среды IDE удалит все ранее скомпилированные файлы и результаты сборок, скомпилирует приложение заново и соберет проект с новыми параметрами.
-[start=7]
+
. Вне среды IDE откройте папку ``_PROJECT_HOME_/dist`` , после чего откройте файл ``launch.html`` в своем браузере.
Появится тестовая страница HTML с кнопкой Launch ("Запуск").
-[start=8]
+
. Нажмите кнопку Launch, чтобы открыть приложение.
Можно будет увидеть, что Java загружена и приложение запускается.
@@ -380,19 +380,19 @@
3. В Windows XP дважды щелкните 'Свойства папки' и выберите вкладку 'Типы файлов'.
Для Windows Vista или 7 щелкните 'Программы по умолчанию' и выберите 'Связать тип файла или протокол с программой'.
-[start=4]
+
. В списке "Зарегистрированные типы файлов" выберите файл JAR.
-[start=5]
+
. (В Windows XP в разделе "Сведения" диалогового окна щелкните "Изменить программу").
-[start=6]
+
. В диалоговом окне "Выбор программы" выберите Java Platform SE Binary.
-[start=7]
+
. Нажмите кнопку "OК" для выхода из диалогового окна "Выбор программы".
-[start=8]
+
. Нажмите кнопку 'Закрыть', чтобы закрыть диалоговое окно 'Свойства папки' (в Windows XP) или диалогового окна связывания типа файла или протокола с конкретными программами (в Windows 7).
*Примечание.* Если файлы JAR files связаны с Java Platform SE Binary в системе, но двойной щелчок все равно не запускает файл JAR, может потребовать указание параметра ``-jar`` в связи файлов.
@@ -419,13 +419,13 @@
"C:\Program Files\Java\jre1.7.0_51\bin\javaw.exe" -jar "%1" %*
----
-[start=7]
+
. Нажмите кнопку "OК" для выхода из диалогового окна "Изменение действия для типа".
-[start=8]
+
. Нажмите кнопку "OК" для выхода из диалогового окна "Изменение свойств типа файлов".
-[start=9]
+
. Нажмите кнопку "Закрыть" для выхода из диалогового окна "Свойства папки".
*Примечание.* Начиная с Windows Vista расширенные связи файлов можно настроить с помощью RegEdit. Дополнительные сведения см. в статье link:http://technet.microsoft.com/en-us/magazine/ee914604.aspx[+Что произошло с диалоговым окном типов файлов?+].
@@ -454,7 +454,7 @@
C:\Program Files\Java\jdk1.7.0_51\bin
----
-[start=6]
+
. Нажмите кнопку "OК" для выхода из диалогового окна "Переменные среды", затем нажмите кнопку "ОК" для выхода из диалогового окна "Свойства системы".
При работе в операционной системе UNIX или Linux способ изменения переменной среды PATH зависит от используемой программы интерпретатора команд. Ознакомьтесь с документацией по интерпретатору команд для получения дополнительных сведений.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_zh_CN.asciidoc
index 7423479..b160a70 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-deploy_zh_CN.asciidoc
@@ -83,25 +83,25 @@
该 zip 档案包含应用程序的源文件以及本教程中要使用的其他几个文件。
-[start=2]
+
. 在 NetBeans IDE 中,选择“文件”>“新建项目”。
-[start=3]
+
. 在“选择类别”页的 "Java" 类别中,选择“基于现有源代码的 Java 项目”,然后单击“下一步”。
-[start=4]
+
. 在向导的“名称和位置”页中,键入 ``AnotherGrep`` 作为项目名称,然后指定项目的位置。
单击 "Next"(下一步)。
项目文件夹_不必_与将要导入项目的源文件位于相同的位置。
-[start=5]
+
. 在向导的“现有源代码”页中,指定项目中要包含的源文件。
单击“源包文件夹”字段右侧的“添加文件夹”按钮。导航至刚在系统上解压缩的 ``DeploymentTutorial`` 文件夹,展开该文件夹,选择 ``src`` 文件夹,然后单击“打开”。此时将向“源包文件夹”字段中添加 ``src`` 文件夹。
-[start=6]
+
. 单击“完成”。
*注:*举例来说,如果要在导入到项目时排除某些源文件,请单击“下一步”打开最后一个“包括和排除”窗口。在本示例中,我们希望使用 ``src`` 文件夹中的所有源文件,因此,只需单击“完成”完成“新建项目”向导中的工作即可。
@@ -331,18 +331,18 @@
*注:*从 2013 年 4 月的 Java SE 7 Update 21 开始,鼓励使用可信证书对所有 Java 小应用程序和 Web Start 应用程序进行签名。有关详细信息,请参见 link:http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html[+Java 小应用程序和 Web Start - 代码签名+]。
-[start=5]
+
. 将所有其他设置保留默认值,然后单击“确定”。
-[start=6]
+
. 右键单击项目节点,然后选择“清理并构建”。
此 IDE 命令将删除以前编译的所有文件和构建输出,重新编译应用程序,然后使用新设置构建项目。
-[start=7]
+
. 在 IDE 外部,打开 ``_PROJECT_HOME_/dist`` 文件夹,然后在浏览器中打开 ``launch.html`` 文件。
此时将打开包含“启动”按钮的测试 HTML 页。
-[start=8]
+
. 单击“启动”按钮以打开应用程序。
您可以看到已加载 Java 并启动了应用程序。
@@ -380,19 +380,19 @@
3. 对于 Windows XP,双击“文件夹选项”,然后选择“文件类型”标签。
对于 Windows Vista 或 Windows 7,单击“默认程序”并选择“将文件类型或协议与程序关联”。
-[start=4]
+
. 在“已注册的文件类型”列表中,选择“JAR 文件”。
-[start=5]
+
. (在 Windows XP 上,在对话框的详细信息部分中)单击“更改程序”。
-[start=6]
+
. 在“打开方式”对话框中,选择 "Java Platform SE Binary"。
-[start=7]
+
. 单击“确定”以退出“打开方式”对话框。
-[start=8]
+
. 单击“关闭”以退出“文件夹选项”对话框(在 Windows XP 上)或“将文件类型或协议与特定程序关联”对话框(在 Windows 7 上)。
*注:*如果 JAR 文件与系统上的 Java Platform SE Binary 关联,但双击时仍不执行 JAR 文件,则可能需要在文件关联中指定 ``-jar`` 选项。
@@ -419,13 +419,13 @@
"C:\Program Files\Java\jre1.7.0_51\bin\javaw.exe" -jar "%1" %*
----
-[start=7]
+
. 单击“确定”以退出“编辑这种类型的操作”对话框。
-[start=8]
+
. 单击“确定”以退出“编辑文件类型”对话框。
-[start=9]
+
. 单击“关闭”以退出“文件夹选项”对话框。
*注:*从 Windows Vista 开始,可以通过 RegEdit 编辑高级文件关联。有关详细信息,请参见link:http://technet.microsoft.com/en-us/magazine/ee914604.aspx[+“文件类型”对话框有什么变化?+]一文。
@@ -454,7 +454,7 @@
C:\Program Files\Java\jdk1.7.0_51\bin
----
-[start=6]
+
. 单击“确定”以退出“环境变量”对话框,然后单击“确定”以退出“系统属性”对话框。
如果要在 UNIX 或 Linux 系统上运行,则如何修改 PATH 变量取决于所使用的 shell 程序。有关详细信息,请查阅所使用的 shell 的文档。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded.asciidoc
index 99c40a2..5462a47 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded.asciidoc
@@ -53,16 +53,16 @@
--
-[start=3]
+
. Click Activate.
-[start=4]
+
. At the Welcome panel of the Installer dialog box, click Activate.
-[start=5]
+
. When the activation is successfully completed, click Finish.
-[start=6]
+
. Click Close to close the Plugins dialog box.
*To install a remote Java SE platform in NetBeans IDE:*
@@ -76,10 +76,10 @@
--
-[start=2]
+
. Click Add Platform.
-[start=3]
+
. In the Select Platform Type of the Add Java Platform wizard, select Remote Java Standard Edition and click Next.
The IDE displays the Add Java Platform dialog box.
@@ -89,13 +89,13 @@
--
-[start=4]
+
. Specify the remote platform details such as the name, the IP address or DNS name of the device, login, password, and the path to the JRE on the remote device.
NOTE: The target operating system must be UNIX (Windows is not supported).
-[start=5]
+
. Click Finish. The IDE validates the remote JRE by executing a probe and downloads the remote JRE system properties.
A new remote Java SE platform displays in the Java Platform Manager dialog box.
@@ -125,11 +125,11 @@
--
-[start=4]
+
. Click Finish.
The IDE creates and opens the Java SE project in the Projects window.
-[start=5]
+
. Replace the ``// TODO code application logic here`` line with the following code:
[source,java]
@@ -141,7 +141,7 @@
System.out.println (c);
----
-[start=6]
+
. Save your changes by choosing File > Save.
To test your application, right-click the project name and choose Run from the context menu. The calculated output can be viewed in the Output window (Window > Output).
@@ -165,7 +165,7 @@
--
-[start=5]
+
. Verify that the default locations of the platform sources zip file and API documentation are valid. Click Finish to close the Add Java Platform dialog box.
JDK 8 is registered as a platform in the IDE.
@@ -175,7 +175,7 @@
--
-[start=6]
+
. Click Close.
*To configure your project to use JDK 8:*
@@ -189,7 +189,7 @@
--
-[start=3]
+
. Select the Sources category and set Source/Binary Format to JDK 8.
[.feature]
@@ -198,7 +198,7 @@
--
-[start=4]
+
. Specify the profile that is used as runtime on a remote platform (for example, Compact 2).
[.feature]
@@ -207,7 +207,7 @@
--
-[start=5]
+
. Click OK to save the changes.
Your project is set to recognize a particular runtime on a remote platform.
@@ -229,7 +229,7 @@
--
-[start=6]
+
. Click OK to save your edits.
If you run the project on a remote platform (Run > Run Project (project name)), the output will look similar to what is shown in the figure below.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ja.asciidoc
index 095cf69..74b551c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ja.asciidoc
@@ -68,16 +68,16 @@
--
-[start=3]
+
. 「アクティブ化」をクリックします。
-[start=4]
+
. 「インストーラ」ダイアログ・ボックスの「ようこそ」パネルで「アクティブ化」をクリックします。
-[start=5]
+
. アクティブ化が正常に完了したら、「終了」をクリックします。
-[start=6]
+
. 「閉じる」をクリックして「プラグイン」ダイアログ・ボックスを閉じます。
*NetBeans IDEへリモートJava SEプラットフォームをインストールするには:*
@@ -91,10 +91,10 @@
--
-[start=2]
+
. 「プラットフォームの追加」をクリックします。
-[start=3]
+
. 「Javaプラットフォームの追加」ウィザードの「プラットフォーム・タイプを選択」で「リモートJava Standard Edition」を選択して、「次」をクリックします。
IDEで「Javaプラットフォームの追加」ダイアログ・ボックスが表示されます。
@@ -104,13 +104,13 @@
--
-[start=4]
+
. デバイスの名前、IPアドレスまたはDNS名、ログイン、パスワード、リモート・デバイス上のJREへのパスなど、リモート・プラットフォームの詳細を指定します。
*注意:* ターゲット・オペレーティング・システムはUNIXである必要があります(Windowsはサポートされていません)。
-[start=5]
+
. 「終了」をクリックします。プローブを実行してリモートJREシステム・プロパティをダウンロードすることで、IDEでリモートJREが検証されます。
「Javaプラットフォーム・マネージャ」ダイアログ・ボックスに、新しいリモートJava SEプラットフォームが表示されます。
@@ -141,11 +141,11 @@
--
-[start=4]
+
. 「終了」をクリックします。
Java SEプロジェクトがIDEで作成され、「プロジェクト」ウィンドウで開かれます。
-[start=5]
+
. ``//TODO code application logic here`` 行を次のコードで置き換えます。
[source,java]
@@ -157,7 +157,7 @@
System.out.println (c);
----
-[start=6]
+
. 「ファイル」>「保存」を選択して、変更内容を保存します。
アプリケーションをテストするには、プロジェクト名を右クリックし、コンテキスト・メニューの「実行」を選択します。計算した出力は、「出力」ウィンドウで確認できます(「ウィンドウ」>「出力」)。
@@ -182,7 +182,7 @@
--
-[start=5]
+
. 「プラットフォームのソース」のzipファイルとAPIドキュメントのデフォルトの場所が有効であることを確認します。「終了」をクリックして「Javaプラットフォームの追加」ダイアログ・ボックスを閉じます。
JDK 8がIDEでプラットフォームとして登録されます。
@@ -192,7 +192,7 @@
--
-[start=6]
+
. 「閉じる」をクリックします。
*JDK 8を使用するようにプロジェクトを構成するには:*
@@ -206,7 +206,7 @@
--
-[start=3]
+
. 「ソース」カテゴリを選択して、「ソース/バイナリ形式」をJDK 8に設定します。
[.feature]
@@ -215,7 +215,7 @@
--
-[start=4]
+
. リモート・プラットフォームでランタイムとして使用するプロファイルを指定します(Compact 2など)。
[.feature]
@@ -224,7 +224,7 @@
--
-[start=5]
+
. 「OK」をクリックして変更を保存します。
プロジェクトは、リモート・プラットフォームで特定のランタイムを認識するように設定されます。
@@ -247,7 +247,7 @@
--
-[start=6]
+
. 「OK」をクリックして編集を保存します。
リモート・プラットフォーム(「実行」>「プロジェクトの実行」(プロジェクト名))でプロジェクトを実行する場合、出力は次の図のようになります。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_pt_BR.asciidoc
index 96ebb86..e6c20b1 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_pt_BR.asciidoc
@@ -68,16 +68,16 @@
--
-[start=3]
+
. Clique em Ativar.
-[start=4]
+
. No painel de Boas-vindas da caixa de diálogo do Instalador, clique em Ativar.
-[start=5]
+
. Quando a ativação foi concluída com êxito, clique em Finalizar.
-[start=6]
+
. Clique em Fechar para fechar a caixa de diálogo Plug-ins.
*Para instalar uma plataforma Java SE remota no NetBeans IDE:*
@@ -91,10 +91,10 @@
--
-[start=2]
+
. Clique em Adicionar Plataforma.
-[start=3]
+
. Na opção Selecionar Tipo de Plataforma do assistente de Adição de Plataforma Java, selecione Remote Java Standard Edition e clique em Próximo.
O IDE exibe a caixa de diálogo Adicionar Plataforma Java.
@@ -104,13 +104,13 @@
--
-[start=4]
+
. Especifique os detalhes da plataforma remota, como nome, endereço IP ou nome do DNS do dispositivo, log-in, senha e o caminho para o JRE no dispositivo remoto.
*Observação:* o sistema operacional de destino deve ser o UNIX (o Windows não é suportado).
-[start=5]
+
. Clique em Finalizar. O IDE valida o JRE remoto executando uma sondagem e faz download das propriedades do sistema JRE remoto.
Uma nova plataforma Java SE remota é exibida na caixa de diálogo Gerenciador de Plataformas Java.
@@ -141,11 +141,11 @@
--
-[start=4]
+
. Clique em Finalizar.
O IDE cria e abre o projeto Java SE na janela Projetos.
-[start=5]
+
. Substitua a linha ``// TODO code application logic here`` pelo seguinte código:
[source,java]
@@ -157,7 +157,7 @@
System.out.println (c);
----
-[start=6]
+
. Salve as alterações escolhendo Arquivo > Salvar.
Para testar sua aplicação, clique com o botão direito do mouse no nome do projeto e escolha Executar no menu de contexto. A saída calculada pode ser exibida na janela Saída (Janela > Saída).
@@ -182,7 +182,7 @@
--
-[start=5]
+
. Verifique se os locais padrão do arquivo zip de códigos-fonte da plataforma e da documentação da API são válidos. Clique em Finalizar para fechar a caixa de diálogo Adicionar Plataforma Java.
O JDK 8 é registrado como uma plataforma no IDE.
@@ -192,7 +192,7 @@
--
-[start=6]
+
. Clique em Fechar.
*Para configurar seu projeto, use o JDK 8:*
@@ -206,7 +206,7 @@
--
-[start=3]
+
. Selecione a Categoria Código-fonte e defina o Formato de Código-origem/Binário para JDK 8.
[.feature]
@@ -215,7 +215,7 @@
--
-[start=4]
+
. Especifique o perfil usado como runtime em uma plataforma remota (por exemplo, Compact 2).
[.feature]
@@ -224,7 +224,7 @@
--
-[start=5]
+
. Clique em OK para salvar as alterações.
Seu projeto está definido para reconhecer um determinado runtime em uma plataforma remota.
@@ -247,7 +247,7 @@
--
-[start=6]
+
. Clique em OK para salvar suas edições.
Se você executar o projeto em uma plataforma remota (Executar > Executar Projeto (nome do projeto)), a saída será semelhante à mostrada na figura a seguir.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ru.asciidoc
index ae44e03..768508a 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_ru.asciidoc
@@ -68,16 +68,16 @@
--
-[start=3]
+
. Нажмите кнопку 'Активировать'.
-[start=4]
+
. На панели приветствия в диалоговом окне программы установки нажмите кнопку 'Активировать'.
-[start=5]
+
. После успешного завершения активации нажмите кнопку 'Готово'.
-[start=6]
+
. Нажмите кнопку 'Закрыть', чтобы закрыть диалоговое окно 'Подключаемые модули'.
*Для установки удаленной платформы Java SE в среде NetBeans IDE:*
@@ -91,10 +91,10 @@
--
-[start=2]
+
. Нажмите 'Добавить платформу'.
-[start=3]
+
. В окне 'Выбор типа платформы' мастера платформ Java выберите Remote Java Standard Edition и нажмите кнопку 'Далее'.
IDE отображает диалоговое окно 'Добавить платформу Java'.
@@ -104,13 +104,13 @@
--
-[start=4]
+
. Укажите следующие сведения об удаленной платформе: имя, IP-адрес или DNS-имя устройства, имя пользователя, пароль и путь в JRE на удаленном устройстве.
*Примечание.* Целевая операционная система - UNIX (Windows не поддерживается).
-[start=5]
+
. Нажмите кнопку "Завершить". Среда IDE проверяет удаленную среду JRE, выполняя исследование, и загружает свойства удаленной системы JRE.
Новая удаленная платформа Java SE отображается в диалоговом окне 'Диспетчер платформ Java'.
@@ -141,11 +141,11 @@
--
-[start=4]
+
. Нажмите 'Готово'.
IDE создает проект Java SE и открывает его в окне 'Проекты'.
-[start=5]
+
. Замените строку ``// TODO code application logic here`` следующим кодом:
[source,java]
@@ -157,7 +157,7 @@
System.out.println (c);
----
-[start=6]
+
. Сохраните изменения, выбрав "Файл" > "Сохранить".
Для тестирования приложения щелкните на проекте правой кнопкой мыши и выберите "Выполнить" в контекстном меню. Рассчитанные выходные данные можно просматривать в диалоговом окне 'Выходные данные' (Окно > Выходные данные).
@@ -182,7 +182,7 @@
--
-[start=5]
+
. Проверьте правильность местоположений по умолчанию для zip-архива Platform Sources и документации API. Для закрытия диалога добавления платформы Java нажмите кнопку "Готово".
Платформа JDK 8 зарегистрирована в IDE.
@@ -192,7 +192,7 @@
--
-[start=6]
+
. Выберите "Close" (Закрыть).
*Настройка проекта для работы с JDK 8:*
@@ -206,7 +206,7 @@
--
-[start=3]
+
. Выберите категорию 'Источники', затем выберите JDK 8 в списке 'Исходный/двоичный формат'.
[.feature]
@@ -215,7 +215,7 @@
--
-[start=4]
+
. Укажите профиль, который используется в качестве стадии выполнения на удаленной платформе (например, Compact 2).
[.feature]
@@ -224,7 +224,7 @@
--
-[start=5]
+
. Нажмите OK для сохранения изменений.
Ваш проект настроен на распознавание определенной стадии выполнения на удаленной платформе.
@@ -247,7 +247,7 @@
--
-[start=6]
+
. Нажмите кнопку "ОК", чтобы сохранить изменения.
При запуске проекта на удаленной платформе (Запуск > Запуск проекта (имя проекта)) выходные данные выглядят практически так, как показано на рисунке ниже.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_zh_CN.asciidoc
index 5426e91..bc518bb 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-embedded_zh_CN.asciidoc
@@ -68,16 +68,16 @@
--
-[start=3]
+
. 单击 "Activate"(激活)。
-[start=4]
+
. 在 "Installer"(安装程序)对话框的 "Welcome"(欢迎使用)面板上,单击 "Activate"(激活)。
-[start=5]
+
. 在成功完成激活过程后,单击 "Finish"(完成)。
-[start=6]
+
. 单击 "Close"(关闭)以关闭 "Plugins"(插件)对话框。
*要在 NetBeans IDE 中安装远程 Java SE 平台,请执行以下操作:*
@@ -91,10 +91,10 @@
--
-[start=2]
+
. 单击 "Add Platform"(添加平台)。
-[start=3]
+
. 在 "Add Java Platform"(添加 Java 平台)向导的 "Select Platform Type"(选择平台类型)中,选择 "Remote Java Standard Edition"(远程 Java Standard Edition)并单击 "Next"(下一步)。
IDE 将显示 "Add Java Platform"(添加 Java 平台)对话框。
@@ -104,13 +104,13 @@
--
-[start=4]
+
. 指定远程平台的详细信息,例如,名称、设备的 IP 地址或 DNS 名称、登录名、口令以及远程设备上 JRE 的路径。
*注:*目标操作系统必须是 UNIX(不支持 Windows)。
-[start=5]
+
. 单击 "Finish"(完成)。IDE 将通过执行探测来验证远程 JRE,并下载远程 JRE 系统属性。
"Java Platform Manager"(Java 平台管理器)对话框中将显示新的远程 Java SE 平台。
@@ -141,11 +141,11 @@
--
-[start=4]
+
. 单击 "Finish"(完成)。
IDE 将在 "Projects"(项目)窗口中创建并打开 Java SE 项目。
-[start=5]
+
. 将 ``// TODO code application logic here`` 一行替换为以下代码:
[source,java]
@@ -157,7 +157,7 @@
System.out.println (c);
----
-[start=6]
+
. 通过选择 "File"(文件)> "Save"(保存)保存您所做的更改。
要测试应用程序,请右键单击项目名称,然后从上下文菜单中选择 "Run"(运行)。可以在 "Output"(输出)窗口("Window"(窗口)> "Output"(输出))中查看计算的输出。
@@ -182,7 +182,7 @@
--
-[start=5]
+
. 验证平台源 zip 文件和 API 文档的默认位置是否有效。单击 "Finish"(完成)以关闭 "Add Java Platform"(添加 Java 平台)对话框。
JDK 8 作为平台注册在 IDE 中。
@@ -192,7 +192,7 @@
--
-[start=6]
+
. 单击 "Close"(关闭)。
*要配置项目以使用 JDK 8,请执行以下操作:*
@@ -206,7 +206,7 @@
--
-[start=3]
+
. 选择 "Sources"(源)类别,然后将源代码/二进制格式设置为 "JDK 8"。
[.feature]
@@ -215,7 +215,7 @@
--
-[start=4]
+
. 指定在远程平台上用作运行时的配置文件(例如,简洁 2)。
[.feature]
@@ -224,7 +224,7 @@
--
-[start=5]
+
. 单击“确定”保存更改。
您的项目将设置为在远程平台上识别特定的运行时。
@@ -247,7 +247,7 @@
--
-[start=6]
+
. 单击 "OK"(确定)保存所做的编辑。
如果在远程平台上运行项目("Run"(运行)> "Run Project (project name)"(运行项目(项目名称))),则输出将看起来类似于下图中显示的内容。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ja.asciidoc
index 0c3551f..94c6df4 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ja.asciidoc
@@ -70,10 +70,10 @@
*注意:* ここで指定したパスは、ウィザードの「プロジェクト・フォルダ」フィールドに`` /`_NetBeansProjects_`/MyLib/ ``のように表示されます。
-[start=3]
+
. (オプション)「ライブラリの格納用に専用フォルダを使用」チェックボックスを選択し、ライブラリ・フォルダの場所を指定します。このオプションの詳細は、_NetBeans IDEによるアプリケーションの開発_のlink:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG455[+他のユーザーとのライブラリの共有+]を参照してください。
-[start=4]
+
. 「終了」をクリックします。「プロジェクト」および「ファイル」ウィンドウの両方にMyLibプロジェクトが表示されます。
@@ -98,13 +98,13 @@
image::images/addproj.png[]
-[start=2]
+
. `_NetBeansProjects_/`に移動して、`MyLib`プロジェクト・フォルダを選択します。「プロジェクトJARファイル」ペインに、プロジェクトに追加できるJARファイルが表示されます。実際にはまだMyLibのJARファイルをビルドしていませんが、JARファイルが一覧表示されることに注意してください。このJARファイルは、MyAppプロジェクトをビルド、実行したときに作成されます。
-[start=3]
+
. 「プロジェクトJARファイルの追加」をクリックします。
-[start=4]
+
. 「ライブラリ」ノードを展開します。MyLibプロジェクトのJARファイルがMyAppプロジェクトのクラスパスに追加されます。
@@ -135,10 +135,10 @@
}
----
-[start=4]
+
. 貼り付けたコードが正しくフォーマットされていない場合は、[Alt]-[Shift]-[F]を押して、ファイル全体を再フォーマットします。
-[start=5]
+
. [Ctrl]-[S]を押して、ファイルを保存します。
@@ -159,34 +159,34 @@
カーソルは`Li`の直後に置いたままにします。次の手順で、コード補完を使用して`Li`を`LibClass`に変えます。
-[start=4]
+
. [Ctrl]-[Space]を押して、コード補完ボックスを開きます。
語の補完方法の候補一覧が表示されます。ただし、必要なクラス`LibClass`が一覧に含まれない可能性があります。
-[start=5]
+
. 再び[Ctrl]-[Space]を押すとさらに候補が表示されます。
`LibClass`はこの一覧に含まれるはずです。
-[start=6]
+
. 「`LibClass`」を選択し、[Enter]を押します。IDEは残りのクラス名を整理し、自動的にクラスのimport文を作成します。
*注意:* IDEでは、コード補完ボックスの上に、選択されたクラスまたはパッケージに関するJavadoc情報を表示する別のボックスも表示されます。このパッケージにはJavadoc情報がないため、ボックスにJavadocが見つからないというメッセージが表示されます。
-[start=7]
+
. mainメソッドで、`LibClass`の後にピリオド(.)を入力します。再びコード補完ボックスが開きます。
-[start=8]
+
. `acrostic(String[]args) `メソッドを選択し、[Enter]を押します。IDEによって`acrostic`メソッドの内容が入力され、`args`パラメータが強調表示されます。
-[start=9]
+
. [Enter]を押して、パラメータとして`args`を設定します。
-[start=10]
+
. セミコロン(;)を入力します。
最後の行は次の行のようになるはずです。
@@ -198,7 +198,7 @@
String result = LibClass.acrostic(args);
----
-[start=11]
+
. [Enter]を押して、新しい行を開始します。次に`sout`と入力して、[Tab]を押します。省略名`sout`が`System.out.println("");`に展開され、引用符の間にカーソルが表示されます。引用符内に`Result=`、引用符の後に`+result`と入力します。
最後の行は次の行のようになるはずです。
@@ -210,7 +210,7 @@
System.out.println("Result = " + result);
----
-[start=12]
+
. [Ctrl]-[S]を押して、ファイルを保存します。
*注意:* `sout`は、ソース・エディタで使用できる多くのコード・テンプレートの1つです。コード・テンプレートのリストを検索して編集するには、「ツール」>「オプション」>「エディタ」>「コード・テンプレート」を選択します。
@@ -234,7 +234,7 @@
メイン・クラスは、すでに`acrostic.Main`に設定されているはずです。
-[start=2]
+
. 「引数」フィールドに`However we all feel zealous`と入力し、「OK」をクリックします。
@@ -262,13 +262,13 @@
JUnitテストをIDEで初めて作成する場合は、「JUnitのバージョンを選択」ダイアログ・ボックスが表示されます。[Enter]を押してJUnit 4.xを選択し、「テストを作成」ダイアログ・ボックスに進みます。
-[start=2]
+
. 「テストを作成」ダイアログ・ボックスで「OK」をクリックして、デフォルトのオプションでコマンドを実行します。IDEでは、`org.me.mylib`パッケージと`LibClassTest.java`ファイルが、別個の`test`フォルダに作成されます。このファイルを見つけるには、「テスト・パッケージ」ノード、「`org.me.mylib`」サブノードを順に展開します。
-[start=3]
+
. `LibClassTest.java`で、`public void testAcrostic()`メソッドの本文を削除します。
-[start=4]
+
. 行を削除した部分に次のコードを入力または貼り付けます。
[source,java]
@@ -280,7 +280,7 @@
assertEquals("Correct value", "foo", result);
----
-[start=5]
+
. [Ctrl]-[S]を押してファイルを保存します。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_pt_BR.asciidoc
index 2e541bf..2db1fff 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_pt_BR.asciidoc
@@ -70,10 +70,10 @@
*Observação:* o caminho especificado acima deve estar como a seguir no campo Pasta do Projeto do assistente: `` /`_NetBeansProjects_`/MyLib/ ``
-[start=3]
+
. (Opcional) Marque a caixa de seleção Utilizar Pasta Dedicada para Armazenamento de Bibliotecas e especifique o local da pasta de bibliotecas. Consulte link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG455[+Compartilhando uma Biblioteca com Outros Usuários+] em _Desenvolvendo Aplicações com o NetBeans IDE_ para obter mais informações sobre essa opção.
-[start=4]
+
. Clique em Finalizar. O projeto MyLib será exibido nas janelas Projetos e Arquivos.
@@ -98,13 +98,13 @@
image::images/addproj.png[]
-[start=2]
+
. Navegue para `_NetBeansProjects_/` e selecione a pasta de projeto `MyLib`. O painel Arquivos JAR do projeto mostrará os arquivos JAR que podem ser adicionados ao projeto. Observe que um arquivo JAR do MyLib está listado, embora ainda não tenha sido construído. Esse arquivo JAR será contruído quando você construir e executar o projeto MyApp.
-[start=3]
+
. Clique em Adicionar Arquivos JAR do Projeto.
-[start=4]
+
. Expanda o nó Bibliotecas. O arquivo JAR do projeto MyLib será adicionado ao classpath do projeto MyApp.
@@ -135,10 +135,10 @@
}
----
-[start=4]
+
. Se o código colado não estiver formatado corretamente, pressione Alt-Shift-F para reformatar todo o arquivo.
-[start=5]
+
. Pressione Ctrl-S para salvar o arquivo.
@@ -159,34 +159,34 @@
Deixe o cursor imediatamente depois de `Li`. Na próxima etapa, você utilizará a funcionalidade autocompletar código para transformar `Li` em `LibClass`.
-[start=4]
+
. Pressione Ctrl-Espaço para abrir a caixa para autocompletar código.
Aparece uma lista resumida de formas possíveis para completar a palavra. Contudo, a classe que você deseja, `LibClass`, pode não existir.
-[start=5]
+
. Pressione Ctrl-Espaço novamente para exibir uma lista mais longa de possíveis correspondências.
`LibClass` deve estar na lista.
-[start=6]
+
. Selecione `LibClass` e pressione Enter. O IDE preencherá o resto do nome da classe, além de criar automaticamente uma instrução de importação para a classe.
*Observação:* o IDE também abrirá uma caixa acima da caixa para autocompletar código que exibe informações de Javadoc da classe ou do pacote selecionado. Como não há informações Javadoc para esse pacote, a caixa exibe a mensagem "Não é possível localizar o Javadoc".
-[start=7]
+
. No método principal, digite um ponto (.) depois de `LibClass`. A caixa para autocompletar código se abrirá novamente.
-[start=8]
+
. Selecione o método `acrostic(String[]args)` e pressione Enter. O IDE preenche o método `acróstico` e mostra os realces do parâmetro `args`.
-[start=9]
+
. Pressione Enter para aceitar `args` como o parâmetro.
-[start=10]
+
. Insira um ponto-e-vírgula (;).
A linha final deve se parecer com a linha a seguir.
@@ -198,7 +198,7 @@
String result = LibClass.acrostic(args);
----
-[start=11]
+
. Pressione Enter para iniciar uma nova linha. Depois, digite `sout` e pressione Tab. A abreviação `sout` se expandirá para `System.out.println("");` com o cursor posicionado entre as aspas. Digite `Result =` dentro das aspas e `+ result` após as aspas finais.
A linha final deve se parecer com a linha a seguir.
@@ -210,7 +210,7 @@
System.out.println("Result = " + result);
----
-[start=12]
+
. Pressione Ctrl-S para salvar o arquivo.
*Observação:* `sout` é um dos vários modelos de código disponíveis no Editor de Código-fonte. Para encontrar e editar a lista de modelos de código, escolha Ferramentas > Opções > Editor > Modelo de Código.
@@ -234,7 +234,7 @@
A classe principal já deve estar definida para `acrostic.Main`.
-[start=2]
+
. Digite `However we all feel zealous `no campo Argumentos e clique em OK.
@@ -262,13 +262,13 @@
Se esta é a primeira vez que criou testes JUnit no IDE, você verá a caixa de diálogo Selecionar Versão de JUnit. Pressione Enter para selecionar JUnit 4.x e prosseguir para a caixa de diálogo Criar Testes.
-[start=2]
+
. Na caixa de diálogo Criar Testes, clique em OK para executar o comando com as opções default. O IDE criará o pacote `org.me.mylib` e o arquivo `LibClassTest.java` em uma pasta de `teste` separada. É possível localizar esse arquivo expandindo o nó Testar Pacotes e o subnó `org.me.mylib`.
-[start=3]
+
. Em `LibClassTest.java`, delete o corpo do método `public void testAcrostic()`.
-[start=4]
+
. No lugar das linhas deletadas, digite ou cole o seguinte:
[source,java]
@@ -280,7 +280,7 @@
assertEquals("Correct value", "foo", result);
----
-[start=5]
+
. Salve o arquivo pressionando Ctrl-S.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ru.asciidoc
index 8189f4c..5769a7d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_ru.asciidoc
@@ -70,10 +70,10 @@
*Примечание.* Путь, указанный выше, должен отображаться как следующий в поле папки проекта мастера: `` /`_NetBeansProjects_`/MyLib/ ``
-[start=3]
+
. Установите флажок "Использовать отдельную папку для хранения библиотек" и укажите местоположение папки библиотек (необязательно). Дополнительная информация об этой команде приведена в статье link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG455[+Предоставление доступа к библиотеке другим пользователям+] в документе _Разработка приложений с помощью NetBeans IDE_.
-[start=4]
+
. Нажмите кнопку 'Готово'. Проект "MyLib" будет открыт как в окне "Проекты", так и в окне "Файлы".
@@ -98,13 +98,13 @@
image::images/addproj.png[]
-[start=2]
+
. Перейдите к `_NetBeansProjects_/` и выберите папку проекта `MyLib`. На экране "Файлы JAR проекта" отображаются архивы JAR, которые можно добавить к проекту. Учтите, что архив JAR для проекта "MyLib" отображается даже в том случае, если он фактически еще не создан. Этот архив JAR будет создан в процессе сборки и выполнения проекта "MyApp".
-[start=3]
+
. Нажмите кнопку "Добавить файлы JAR проекта".
-[start=4]
+
. Разверните узел "Библиотеки". Архив JAR проекта "MyLib" добавлен в путь к классам проекта "MyApp".
@@ -135,10 +135,10 @@
}
----
-[start=4]
+
. Если вставленный код отформатирован неправильно, нажмите сочетание клавиш ALT+SHIFT+F для переформатирования всего файла.
-[start=5]
+
. Для сохранения файла нажмите сочетание клавиш CTRL+S.
@@ -159,34 +159,34 @@
Установите курсор сразу же после `Li`. Теперь можно воспользоваться функцией автозавершения кода для подстановки `LibClass` вместо `Li`.
-[start=4]
+
. Нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова окна автозавершения кода.
Появится небольшой список допустимых подстановок. Однако требуемого класса `LibClass` там может не оказаться.
-[start=5]
+
. Для просмотра расширенного списка возможных соответствий еще раз нажмите сочетание клавиш CTRL+ПРОБЕЛ.
Класс `LibClass` должен находиться в этом списке.
-[start=6]
+
. Выберите `LibClass` и нажмите ENTER. Оставшаяся часть имени класса будет автоматически подставлена в код средой IDE. Кроме того, для этого класса также автоматически создается оператор импорта.
*Примечание.* В IDE также открывается поле над полем завершения кода, в котором отображаются данные Javadoc для выбранного класса или пакета. Поскольку для этого пакета документация Javadoc отсутствует, в поле отображается сообщение "Не удалось найти сообщение Javadoc".
-[start=7]
+
. В главном методе введите точку (.) после записи `LibClass`. Снова появится поле автозавершения кода.
-[start=8]
+
. Выберите метод `acrostic(String[]args)` и нажмите ENTER. После автоматического заполнения метода `acrostic` появится выделенный параметр `args`.
-[start=9]
+
. Нажмите ENTER для подтверждения параметра `args`.
-[start=10]
+
. Введите точку с запятой (;).
Последняя строка должна выглядеть следующим образом.
@@ -198,7 +198,7 @@
String result = LibClass.acrostic(args);
----
-[start=11]
+
. Нажмите ENTER для вставки новой строки. Затем введите `sout` и нажмите клавишу TAB. Сокращение `sout` расширяется до `System.out.println("");`, а курсор устанавливается между кавычками. Введите `Result =` в кавычках и `+ result` после закрывающей кавычки.
Последняя строка должна выглядеть следующим образом.
@@ -210,7 +210,7 @@
System.out.println("Result = " + result);
----
-[start=12]
+
. Для сохранения файла нажмите сочетание клавиш CTRL+S.
*Примечание.* `sout` является одним из многих шаблонов кода, доступных в редакторе исходного кода. Чтобы найти и изменить список шаблонов кода, выберите "Средства > Параметры > Редактор > Шаблон кода".
@@ -234,7 +234,7 @@
В качестве главного класса должен быть указан `acrostic.Main`.
-[start=2]
+
. Введите `However we all feel zealous ` в поле "Аргументы" и нажмите кнопку "ОК".
@@ -262,13 +262,13 @@
Если тесты JUnit в среде IDE создаются впервые, появится диалоговое окно выбора версии "Выберите версию JUnit". Нажмите ENTER для выбора JUnit 4.x и перейдите (кнопка "Продолжить") к диалоговому окну "Создать тесты".
-[start=2]
+
. В диалоговом окне "Создать тесты" нажмите кнопку "ОК" для выполнения команды с параметрами по умолчанию. Средой IDE будет автоматически создан пакет `org.me.mylib` и файл `LibClassTest.java` в отдельной папке `test`. Этот файл можно просмотреть путем развертывания узла "Тесты" и в нем подузла `org.me.mylib`.
-[start=3]
+
. В `LibClassTest.java` удалите тело метода `public void testAcrostic()`.
-[start=4]
+
. Вместо удаленных строк введите или вставьте следующее:
[source,java]
@@ -280,7 +280,7 @@
assertEquals("Correct value", "foo", result);
----
-[start=5]
+
. Сохраните файл путем нажатия CTRL+S.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_zh_CN.asciidoc
index c2e7c0b..e3a527a 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-intro_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-intro_zh_CN.asciidoc
@@ -70,10 +70,10 @@
*注:*上面指定的路径在向导的“项目文件夹”字段中应显示如下:`` /`_NetBeansProjects_`/MyLib/ ``
-[start=3]
+
. (可选)选中“使用专用文件夹存储库”复选框,并指定库文件夹的位置。有关此选项的详细信息,请参见_使用 NetBeans IDE 开发应用程序_中的link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG455[+与其他用户共享库+]。
-[start=4]
+
. 单击 "Finish"(完成)。将同时在“项目”窗口和“文件”窗口中打开 MyLib 项目。
@@ -98,13 +98,13 @@
image::images/addproj.png[]
-[start=2]
+
. 浏览到 `_NetBeansProjects_/`,然后选择 `MyLib` 项目文件夹。“项目 JAR 文件”窗格显示了可以添加到项目中的 JAR 文件。请注意,系统将列出 MyLib 的 JAR 文件,即使您尚未实际构建 JAR 文件也是如此。在构建并运行 MyApp 项目时,将构建此 JAR 文件。
-[start=3]
+
. 单击“添加项目 JAR 文件”。
-[start=4]
+
. 展开“库”节点。MyLib 项目的 JAR 文件将添加到 MyApp 项目的类路径中。
@@ -135,10 +135,10 @@
}
----
-[start=4]
+
. 如果粘贴的代码格式不正确,请按 Alt-Shift-F 组合键重新设置整个文件的格式。
-[start=5]
+
. 按 Ctrl-S 组合键保存该文件。
@@ -159,34 +159,34 @@
将光标保留在紧随 `Li` 之后的位置。在下一步中,您将使用代码完成功能来将 `Li` 转换为 `LibClass`。
-[start=4]
+
. 按 Ctrl-空格键打开代码完成框。
将显示一个简短的列表,其中列出了用于完成该词的可能方式。但是,该列表中可能不会列出您所需的类 `LibClass`。
-[start=5]
+
. 再次按 Ctrl-空格键以显示较长的可能匹配项列表。
此列表中应该包含 `LibClass`。
-[start=6]
+
. 选择 `LibClass`,然后按 Enter 键。IDE 将填写该类名的其余部分,并且还将自动为该类创建一个 import 语句。
*注:*IDE 还将在代码完成框的上面打开一个框,该框显示选定类或包的 Javadoc 信息。由于此包没有对应的 Javadoc 信息,因此该框将显示“无法找到 Javadoc”消息。
-[start=7]
+
. 在主方法中 `LibClass` 后面键入句点 (.)。将再次打开代码完成框。
-[start=8]
+
. 选择 `acrostic(String[]args)` 方法,然后按 Enter 键。IDE 将填写 `acrostic` 方法并突出显示 `args` 参数。
-[start=9]
+
. 按 Enter 键以接受 `args` 参数。
-[start=10]
+
. 键入分号 (;)。
最后一行应与以下行类似。
@@ -198,7 +198,7 @@
String result = LibClass.acrostic(args);
----
-[start=11]
+
. 按 Enter 键以开始一个新行。然后,键入 `sout` 并按 Tab 键。`sout` 缩写将扩展为 `System.out.println("");`,且光标置于引号之间。在引号内键入 `Result =`,并在右引号后面键入 `+ result`。
最后一行应与以下行类似。
@@ -210,7 +210,7 @@
System.out.println("Result = " + result);
----
-[start=12]
+
. 按 Ctrl-S 组合键保存该文件。
*注:*`sout` 是源代码编辑器中许多可用的代码模板之一。要查找和编辑代码模板的列表,请选择“工具”>“选项”>“编辑器”>“代码模板”。
@@ -234,7 +234,7 @@
主类应该已设置为 `acrostic.Main`。
-[start=2]
+
. 在“参数”字段中键入 `However we all feel zealous`,然后单击“确定”。
@@ -262,13 +262,13 @@
如果这是您首次在 IDE 中创建 JUnit 测试,则系统会显示“选择 JUnit 版本”对话框提示。按 Enter 键以选择 "JUnit 4.x",然后继续执行“创建测试”对话框中的操作。
-[start=2]
+
. 在“创建测试”对话框中,单击“确定”以使用默认选项运行命令。IDE 在单独的 `test` 文件夹中创建 `org.me.mylib` 包和 `LibClassTest.java` 文件。通过展开“测试包”节点和 `org.me.mylib` 子节点,可以找到此文件。
-[start=3]
+
. 在 `LibClassTest.java` 中,删除 `public void testAcrostic()` 方法的主体。
-[start=4]
+
. 键入或粘贴以下代码,以代替删除的行:
[source,java]
@@ -280,7 +280,7 @@
assertEquals("Correct value", "foo", result);
----
-[start=5]
+
. 通过按 Ctrl-S 组合键保存该文件。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7.asciidoc
index 309e56c..77155d4 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7.asciidoc
@@ -61,7 +61,7 @@
--
-[start=3]
+
. Click Close.
@@ -81,7 +81,7 @@
--
-[start=6]
+
. Switch to the Sources tab of the Project Properties window and ensure JDK 7 is chosen as the Source/Binary Format.
[.feature]
@@ -90,7 +90,7 @@
--
-[start=7]
+
. Click OK to close the Project Properties dialog box. Your project is configured to recognize Java 7 language features.
@@ -130,14 +130,14 @@
If the pasted code is formatted incorrectly in the editor, press Alt-Shift-F to reformat.
-[start=2]
+
. In the Projects window, right-click the project's node and choose Run File. You will see the output of the application, which is the RGB code for the red color.
You can see that the build is successful and the application works when the target platform and source format is JDK 7.
image::images/output.png[]
-[start=3]
+
. Let's rollback to using JDK 6 and test how the application is complied with the JDK 6 compiler.
In the Projects window, right-click the project's node and choose Properties. In the Sources category, set the Source/Binary Format to ``JDK 6`` and click OK.
You can immediately see that the JDK6 parser does not recognize the syntax. The compilation fails because of the incompatible variable type.
@@ -148,7 +148,7 @@
--
-[start=4]
+
. Now, let's rewrite the code using the ``if-then-else`` statement instead of ``switch`` as follows:
[source,java]
@@ -251,10 +251,10 @@
----
-[start=2]
+
. Note that the IDE displays several hints, as shown above in this tutorial, of how you can optimize your code for the JDK 7 spec. Simply click on each hint and select the suggested action.
-[start=3]
+
. Finally, after you accept all the suggestions, you should have the JDK 7 compatible code shown below.
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ja.asciidoc
index 0a28956..d3271a3 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ja.asciidoc
@@ -61,7 +61,7 @@
--
-[start=3]
+
. 「閉じる」をクリックします。
@@ -81,7 +81,7 @@
--
-[start=6]
+
. 「プロジェクト・プロパティ」ウィンドウの「ソース」タブに切り替え、「ソース/バイナリ形式」として「JDK 7」が選択されていることを確認します。
[.feature]
@@ -90,7 +90,7 @@
--
-[start=7]
+
. 「OK」をクリックして、「プロジェクト・プロパティ」ダイアログ・ボックスを閉じます。プロジェクトが、Java 7言語機能を認識するように構成されています。
@@ -130,14 +130,14 @@
貼り付けたコードがエディタで誤ってフォーマットされている場合は、[Alt]-[Shift]-[F]を押して再フォーマットします。
-[start=2]
+
. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「ファイルの実行」を選択します。アプリケーションの出力(赤色のRGBコード)が表示されます。
ターゲット・プラットフォームとソース形式がJDK 7である場合は、ビルドが成功し、アプリケーションが正常に動作することがわかります。
image::images/output.png[]
-[start=3]
+
. 前に戻ってJDK 6を使用し、このアプリケーションがJDK 6コンパイラでどのようにコンパイルされるかをテストしてみます。
「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「プロパティ」を選択します。「ソース」カテゴリで、「ソース/バイナリ形式」を ``JDK 6`` に設定して「OK」をクリックします。
JDK6パーサーでこの構文が認識されないことがただちにわかります。互換性のない変数型のためにコンパイルが失敗します。
@@ -148,7 +148,7 @@
--
-[start=4]
+
. ここで、次のように、 ``switch`` のかわりに ``if-then-else`` 文を使用してコードを書き換えてみます。
[source,java]
@@ -251,10 +251,10 @@
----
-[start=2]
+
. このチュートリアルの上に示すように、コードをJDK 7仕様向けに最適化する方法を示す複数のヒントがIDEに表示されます。単純に各ヒントをクリックし、提案されたアクションを選択します。
-[start=3]
+
. 最終的に、すべての提案を受け入れると、次に示すJDK 7と互換性のあるコードが得られるはずです。
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_pt_BR.asciidoc
index 1567f39..c833090 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_pt_BR.asciidoc
@@ -61,7 +61,7 @@
--
-[start=3]
+
. Clique em Fechar.
@@ -81,7 +81,7 @@
--
-[start=6]
+
. Alterne para a guia Códigos-fonte da janela Propriedades do Projeto e certifique-se de que JDK 7 tenha sido escolhido como o formato do Código-fonte/Binário.
[.feature]
@@ -90,7 +90,7 @@
--
-[start=7]
+
. Clique em OK para fechar a caixa de diálogo Propriedades do Projeto. Seu projeto está configurado para reconhecer os recursos do idioma do Java 7.
@@ -130,14 +130,14 @@
Se o código colado for incorretamente colado no editor, pressione Alt-Shift-F para reformatar.
-[start=2]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Executar Arquivo. Você verá a saída da aplicação, que é o código RGB para a cor vermelha.
Você pode ver que a construção foi bem-sucedida e que a aplicação funciona quando a plataforma de destino e o formato do código-fonte são JDK 7.
image::images/output.png[]
-[start=3]
+
. Vamos reverter para o uso do JDK 6 e testar como a aplicação é compilada com o compilador do JDK 6.
Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Propriedades. Na categoria Códigos-fontes, defina o Formato Código-fonte/Binário para ``JDK 6`` e clique em OK.
Você pode ver imediatamente que o parser do JDK6 não reconhece a sintaxe. A compilação falha por causa do tipo de variável incompatível.
@@ -148,7 +148,7 @@
--
-[start=4]
+
. Agora, vamos reescrever o código usando a instrução ``if-then-else`` , em vez de ``switch`` , como segue:
[source,java]
@@ -251,10 +251,10 @@
----
-[start=2]
+
. Observe que o IDE exibe diversas dicas, como mostrado acima neste tutorial, de como é possível otimizar seu código para a especificação JDK 7. Basta clicar em cada dica e selecionar a ação sugerida.
-[start=3]
+
. Finalmente, depois de aceitar todas as sugestões, você deverá ter o código compatível com JDK 7 mostrado abaixo.
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ru.asciidoc
index 08be185..c9600c5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_ru.asciidoc
@@ -61,7 +61,7 @@
--
-[start=3]
+
. Выберите "Close" (Закрыть).
@@ -81,7 +81,7 @@
--
-[start=6]
+
. В окне 'Свойства проекта' перейдите на вкладку 'Исходный код'. В списке 'Исходный/двоичный формат' должна быть выбрана версия JDK 7.
[.feature]
@@ -90,7 +90,7 @@
--
-[start=7]
+
. Нажмите кнопку "ОК" для закрытия диалогового окна "Свойства проекта". Ваш проект настроен для работы с компонентами языка Java 7.
@@ -130,14 +130,14 @@
Если вставленный код некорректно форматируется в редакторе, нажмите сочетание клавиш ALT+SHIFT+F для выполнения повторного форматирования.
-[start=2]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел проекта и выберите 'Запустить файл'. На экране отобразится вывод приложения, который представляет собой код RGB для красного цвета.
Таким образом, сборка выполнена успешно, а приложение успешно работает при указании целевой платформы и исходного формата JDK 7.
image::images/output.png[]
-[start=3]
+
. Вернемся к JDK 6 и проверим компилирование приложения с помощью компилятора JDK 6.
В окне 'Проекты' щелкните правой кнопкой мыши узел проекта и выберите 'Свойства'. В категории 'Источники' в списке 'Исходный/двоичный формат' выберите ``JDK 6`` и нажмите ОК.
Сразу видно, что синтаксический анализатор JDK6 не распознает синтаксис. Компиляция завершается с ошибкой из-за несовместимого типа переменной.
@@ -148,7 +148,7 @@
--
-[start=4]
+
. Теперь перепишите код, используя оператор ``if-then-else`` вместо оператора ``switch`` :
[source,java]
@@ -251,10 +251,10 @@
----
-[start=2]
+
. Обратите внимание, что в среде IDE отображаются подсказки по оптимизации кода в соответствии со спецификациями JDK 7. Щелкните подсказки и выберите предложенные действия.
-[start=3]
+
. По принятии всех предложений будет создан код, совместимый с JDK 7. Этот код будет выглядеть так же, как код, показанный ниже.
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_zh_CN.asciidoc
index 290a239..e8a47fd 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk7_zh_CN.asciidoc
@@ -61,7 +61,7 @@
--
-[start=3]
+
. 单击 "Close"(关闭)。
@@ -81,7 +81,7 @@
--
-[start=6]
+
. 切换到 "Project Properties"(项目属性)窗口的 "Sources"(源)标签,并确保选择 "JDK 7" 作为源代码/二进制格式。
[.feature]
@@ -90,7 +90,7 @@
--
-[start=7]
+
. 单击“确定”。关闭“项目属性”对话框。您的项目配置为识别 Java 7 语言功能。
@@ -130,14 +130,14 @@
如果在编辑器中错误地设置了粘贴的代码格式,请按 Alt-Shift-F 组合键以重新设置格式。
-[start=2]
+
. 在 "Projects"(项目)窗口中,右键单击该项目节点并选择 "Run File"(运行文件)。此时将会看到应用程序输出,这是红色的 RGB 代码。
如果目标平台和源格式为 JDK 7,您可以看到构建成功,并且应用程序正常工作。
image::images/output.png[]
-[start=3]
+
. 让我们改用以前的 JDK 6,并测试如何使用 JDK 6 编译器编译应用程序。
在 "Projects"(项目)窗口中,右键单击该项目节点并选择 "Properties"(属性)。在 "Sources"(源)类别中,将源代码/二进制格式设置为 ``JDK 6`` ,然后单击 "OK"(确定)。
您可以立即看到 JDK6 解析器无法识别语法。编译将失败,因为变量类型不兼容。
@@ -148,7 +148,7 @@
--
-[start=4]
+
. 现在,让我们使用 ``if-then-else`` 语句而非 ``switch`` 重新编写代码,如下所示:
[source,java]
@@ -251,10 +251,10 @@
----
-[start=2]
+
. 请注意,IDE 将显示一些说明如何优化代码以符合 JDK 7 规范的提示,如本教程中上面所述。只需单击每个提示并选择建议的操作即可。
-[start=3]
+
. 最后,接受了所有建议后,您就应该具有与 JDK 7 兼容的代码,如下所示。
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8.asciidoc
index 9f00fa5..b222d65 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8.asciidoc
@@ -65,7 +65,7 @@
--
-[start=5]
+
. Verify that the default locations of the Platform Sources zip file and API documentation are valid. Click Finish to close the Add Java Platform dialog box.
JDK 8 is registered as a platform in the IDE.
@@ -75,7 +75,7 @@
--
-[start=6]
+
. Ensure JDK 1.8 is chosen in the Platforms list and click Close.
@@ -103,7 +103,7 @@
--
-[start=3]
+
. Select the Sources category and set Source/Binary Format to JDK 8.
[.feature]
@@ -112,7 +112,7 @@
--
-[start=4]
+
. Click OK to save the changes.
Your project is set to recognize new JDK 8 language features.
@@ -191,7 +191,7 @@
--
-[start=4]
+
. Click OK.
To see how the IDE checks whether classes used in your project belong to the specified profile, select Compact1 as a profile for the AnagramGame project and click OK.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ja.asciidoc
index c4586a7..22fd273 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ja.asciidoc
@@ -65,7 +65,7 @@
--
-[start=5]
+
. 「プラットフォームのソース」のzipファイルとAPIドキュメントのデフォルトの場所が有効であることを確認します。「終了」をクリックして「Javaプラットフォームの追加」ダイアログ・ボックスを閉じます。
JDK 8がIDEでプラットフォームとして登録されます。
@@ -75,7 +75,7 @@
--
-[start=6]
+
. 「プラットフォーム」リストで「JDK 1.8」が選択されていることを確認し、「閉じる」をクリックします。
@@ -103,7 +103,7 @@
--
-[start=3]
+
. 「ソース」カテゴリを選択して、「ソース/バイナリ形式」をJDK 8に設定します。
[.feature]
@@ -112,7 +112,7 @@
--
-[start=4]
+
. 「OK」をクリックして変更を保存します。
プロジェクトが、新しいJDK 8言語機能を認識するように設定されています。
@@ -191,7 +191,7 @@
--
-[start=4]
+
. 「OK」をクリックします。
プロジェクトで使用されるクラスが指定されたプロファイルに属すかどうかを、IDEでどのように確認するか参照するには、「Compact1」をAnagramGameプロジェクトのプロファイルとして選択して、「OK」をクリックします。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_pt_BR.asciidoc
index 049f691..f6e768f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_pt_BR.asciidoc
@@ -65,7 +65,7 @@
--
-[start=5]
+
. Verifique se os locais default do arquivo zip Códigos-fonte da Plataforma e da documentação da API são válidos. Clique em Finalizar para fechar a caixa de diálogo Adicionar Plataforma Java.
O JDK 8 é registrado como uma plataforma no IDE.
@@ -75,7 +75,7 @@
--
-[start=6]
+
. Assegure-se de que o JDK 1.8 esteja selecionado na lista Plataformas e clique em Fechar.
@@ -103,7 +103,7 @@
--
-[start=3]
+
. Selecione a Categoria Código-fonte e defina o Formato de Código-origem/Binário para JDK 8.
[.feature]
@@ -112,7 +112,7 @@
--
-[start=4]
+
. Clique em OK para salvar as alterações.
Seu projeto está definido para reconhecer as novas funcionalidades de linguagem do JDK 8.
@@ -191,7 +191,7 @@
--
-[start=4]
+
. Clique em OK.
Para verificar como o IDE verifica se as classes usadas em seu projeto pertencem ao perfil especificado, selecione Compact1 como perfil para o projeto Jogo de Anagramas e clique em OK.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ru.asciidoc
index 635667c..5c6b426 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_ru.asciidoc
@@ -65,7 +65,7 @@
--
-[start=5]
+
. Проверьте правильность местоположений по умолчанию для zip-архива Platform Sources и документации API. Для закрытия диалога добавления платформы Java нажмите кнопку "Готово".
Платформа JDK 8 зарегистрирована в IDE.
@@ -75,7 +75,7 @@
--
-[start=6]
+
. Убедитесь в том, что в списке "Платформы" выбран пункт "JDK 1.8", и нажмите кнопку "Закрыть".
@@ -103,7 +103,7 @@
--
-[start=3]
+
. Выберите категорию 'Источники', затем выберите JDK 8 в списке 'Исходный/двоичный формат'.
[.feature]
@@ -112,7 +112,7 @@
--
-[start=4]
+
. Нажмите OK для сохранения изменений.
Теперь проект настроен на распознавание новых функций языка JDK 8.
@@ -191,7 +191,7 @@
--
-[start=4]
+
. Нажмите ОК.
IDE проверяет, принадлежат ли классы, используемые в проекте, определенному профилю. Чтобы рассмотреть это на примере, выберите Compact1 в качестве профиля проекта AnagramGame и нажмите ОК.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_zh_CN.asciidoc
index ee7e87b..9300143 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/javase-jdk8_zh_CN.asciidoc
@@ -65,7 +65,7 @@
--
-[start=5]
+
. 验证平台源 zip 文件和 API 文档的默认位置是否有效。单击 "Finish"(完成)以关闭 "Add Java Platform"(添加 Java 平台)对话框。
JDK 8 作为平台注册在 IDE 中。
@@ -75,7 +75,7 @@
--
-[start=6]
+
. 确保在 "Platforms"(平台)列表中选择了 JDK 1.8,然后单击 "Close"(关闭)。
@@ -103,7 +103,7 @@
--
-[start=3]
+
. 选择 "Sources"(源)类别,然后将源代码/二进制格式设置为 "JDK 8"。
[.feature]
@@ -112,7 +112,7 @@
--
-[start=4]
+
. 单击“确定”保存更改。
此时将设置项目以识别新的 JDK 8 语言功能。
@@ -191,7 +191,7 @@
--
-[start=4]
+
. 单击 "OK"(确定)。
要了解 IDE 如何检查项目中使用的类是否属于指定的配置文件,请选择 "Compact1" 作为 AnagramGame 项目的配置文件,然后单击 "OK"(确定)。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart.asciidoc
index 1bb23ec..5be43da 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart.asciidoc
@@ -151,13 +151,13 @@
3. Select the Anagram Game Managed with JMX project.
image::images/jmx-newproject.png[title="Anagram Game Managed with JMX in New Project wizard"]
-[start=4]
+
. Click Next. There is no need to change the supplied default project name or location values. Confirm that the Set as Main Project checkbox is selected. Click Finish.
*Notes.* The IDE might prompt you to install the JUnit libraries if you did not install the JUnit plugin previously. You can click Resolve in the Resolve Resource Problems dialog box to launch the Installer to install the JUnit plugin. Alternatively, you can install the JUnit plugin in the Plugins manager.
-[start=5]
+
. Once your project is created, and set as the Main Project, Run it with JConsole by clicking the "Run Main Project with Monitoring and Management" JConsole button.
*Notes.* You might see a Connection Failed warning in the Java Monitoring & Management Console when the console attempts to connect to the Anagram Game process. For this tutorial you can click Insecure when you are prompted to authorize the connection.
@@ -169,20 +169,20 @@
The JConsole window is also displayed.
-[start=6]
+
. In the JConsole window, select the MBeans tab and in the tree layout on the left open down all nodes under ``anagrams.toy.com`` as shown below.
image::images/jmx-jconsole1.png[title="JConsole window"]
-[start=7]
+
. Select the Notifications node and click on the Subscribe button at the bottom so that JConsole will receive a new notification each time an anagram is solved.
-[start=8]
+
. Now go to the Anagrams Game window, and solve the first three or four anagrams (The answers are in the WordLibrary class, but here they are: abstraction, ambiguous, arithmetic, backslash, ...)
-[start=9]
+
. Go back to JConsole, and notice that it received the four notifications.
-[start=10]
+
. Click on the Attributes node and notice the attributes values are updated:
image::images/jmx-jconsole2.png[title="JConsole window showing updated values"]
link:/about/contact_form.html?to=3&subject=Feedback:%20Getting%20Started%20with%20JMX%20Monitoring[+Send Feedback on This Tutorial+]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ja.asciidoc
index 3c3b82e..505708c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ja.asciidoc
@@ -151,13 +151,13 @@
3. JMXで管理されたアナグラム・ゲーム・プロジェクトを選択します。
image::images/jmx-newproject.png[title="新規プロジェクト・ウィザードのJMXで管理されたアナグラム・ゲーム"]
-[start=4]
+
. 「次」をクリックします。指定されているデフォルトのプロジェクト名や場所の値を変更する必要はありません。「メイン・プロジェクトとして設定」チェックボックスが選択されていることを確認します。「終了」をクリックします。
*注意:*JUnitプラグインを以前にインストールしていない場合、JUnitライブラリのインストールを求めるメッセージが表示されることがあります。「リソースの問題を解決」ダイアログ・ボックスで「解決」をクリックしてインストーラを起動し、JUnitプラグインをインストールできます。プラグイン・マネージャでJUnitプラグインをインストールすることもできます。
-[start=5]
+
. プロジェクトを作成し、メイン・プロジェクトとして設定したら、モニタリングおよび管理によるメイン・プロジェクトの実行のJConsoleボタンをクリックして、JConsoleで実行します。
*注意:*コンソールからアナグラム・ゲーム・プロセスに接続しようとすると、Java Monitoring & Management Consoleに「接続に失敗しました。」という警告が表示されることがあります。このチュートリアルでは、接続の認証を求めるメッセージが表示されたら、「非セキュア」をクリックできます。
@@ -169,20 +169,20 @@
JConsoleウィンドウも表示されます。
-[start=6]
+
. JConsoleウィンドウで、「MBeans」タブを選択して、次に示すように、左側のツリー・レイアウトで ``anagrams.toy.com`` の下のすべてのノードを展開します。
image::images/jmx-jconsole1.png[title="JConsoleウィンドウ"]
-[start=7]
+
. 「通知」ノードを選択し、下にある「サブスクライブ」ボタンをクリックして、アナグラムが解決されるたびにJConsoleが新規通知を受け取れるようにします。
-[start=8]
+
. 「アナグラム・ゲーム」ウィンドウに移動し、最初の3つか4つのアナグラムを解きます(解答はWordLibraryクラス内にありますが、次のとおりです: abstraction、ambiguous、arithmetic、backslash、...)
-[start=9]
+
. JConsoleに戻り、4つの通知を受信したことを確認します。
-[start=10]
+
. 「属性」ノードをクリックし、属性値が更新されていることを確認します。
image::images/jmx-jconsole2.png[title="更新された値を示すJConsoleウィンドウ"]
link:/about/contact_form.html?to=3&subject=Feedback:%20Getting%20Started%20with%20JMX%20Monitoring[+このチュートリアルに関するご意見をお寄せください+]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_pt_BR.asciidoc
index a9087f4..b54b40b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_pt_BR.asciidoc
@@ -151,13 +151,13 @@
3. Selecione o Jogo de Anagramas Gerenciado com o projeto JMX.
image::images/jmx-newproject.png[title="Jogo de Anagramas Gerenciado com o JMX no assistente Novo Projeto"]
-[start=4]
+
. Clique em Próximo. Não é necessário alterar o nome do projeto default fornecido ou os valores do local. Confirme se a caixa de seleção Definir como Projeto Principal está selecionada. Clique em Finalizar.
*Observações.* O IDE poderá solicitar a instalação das bibliotecas JUnit se você não tiver instalado o plug-in do JUnit anteriormente. Você pode clicar em Resolver, na caixa de diálogo Resolver Problemas de Recursos, para iniciar o Instalador a fim de instalar o plug-in do JUnit. Se preferir, instale o plug-in do JUnit no gerenciador de Plug-ins.
-[start=5]
+
. Depois que seu projeto for criado e definido como o Projeto Principal, Execute-o com o JConsole, clicando no botão "Executar Projeto Principal com Monitoramento e Gerenciamento" da JConsole.
*Observações.* É possível que você veja uma advertência de Falha de Conexão na Console de Monitoramento e Gerenciamento Java quando a console tenta estabelecer conexão com o processo do Jogo de Anagramas. Neste tutorial, você pode clicar em Não Seguro quando solicitado a autorizar a conexão.
@@ -169,20 +169,20 @@
A janela JConsole também é exibida.
-[start=6]
+
. Na janela JConsole, selecione a guia MBeans e no layout da árvore à esquerda, abra todos os nós em ``anagrams.toy.com`` conforme mostrado abaixo.
image::images/jmx-jconsole1.png[title="Janela JConsole"]
-[start=7]
+
. Selecione o nó Notificações e clique no botão Assinar na parte inferior, de forma que o JConsole recebem uma nova notificação cada vez que um anagrama é resolvido.
-[start=8]
+
. Agora vá para a janela Jogo de Anagramas e resolva os primeiros três ou quatro anagramas. (As respostas estão na classe WordLibrary, mas aqui estão elas: abstração, ambíguos, aritmética, barra invertida...)
-[start=9]
+
. Volte para a JConsole e observe que ela recebeu as quatro notificações.
-[start=10]
+
. Clique no nó Atributos e observe que os valores do atributo estão atualizados:
image::images/jmx-jconsole2.png[title="Janela de JConsole mostrando valores atualizados"]
link:/about/contact_form.html?to=3&subject=Feedback:%20Getting%20Started%20with%20JMX%20Monitoring[+Enviar Feedback neste Tutorial+]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ru.asciidoc
index 025eaef..59a0f21 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_ru.asciidoc
@@ -151,13 +151,13 @@
3. Выберите проект 'Игра Anagram под управлениемJMX'.
image::images/jmx-newproject.png[title="Проект 'Игра Anagram под управлениемJMX' в мастере создания проектов"]
-[start=4]
+
. Нажмите 'Далее'. Имя проекта и местоположение по умолчанию можно не менять. Убедитесь, что установлен флажок "Задать в качестве основного проекта". Нажмите кнопку 'Готово'.
*Примечания.* Среда IDE может запросить разрешение на установку библиотеки JUnit, если вы не установили подключаемый модуль JUnit ранее. Вы можете нажать 'Разрешить' в диалоговом окне 'Разрешить проблему с ссылками' для запуска программы установки подключаемого модуля JUnit. В качестве альтернативы вы можете установить подключаемый модуль JUnit в диспетчере подключаемых модулей.
-[start=5]
+
. Когда проект создан и выбран в качестве основного, запустите его в консоли JConsole, нажав на кнопку 'Запуск основного проекта с функциями мониторинга и управления'.
*Примечания.* Вы можете увидеть предупреждение о сбое подключения на консоли управления и мониторинга Java при попытке консоли подключиться к процессу Anagram Game. Для этой учебной программы вы можете нажать Ненадежно, когда вам будет предложено разрешить подключение.
@@ -169,20 +169,20 @@
Также отображается окно JConsole.
-[start=6]
+
. В окне JConsole перейдите на вкладку MBeans и в дереве слева откройте все узлы под ``anagrams.toy.com`` , как показано на рисунке.
image::images/jmx-jconsole1.png[title="Окно JConsole"]
-[start=7]
+
. Выберите узел 'Уведомления' и нажмите кнопку 'Подписаться' в нижней части окна консоли. После этого JConsole будет получать уведомления при расшифровке каждой анаграммы.
-[start=8]
+
. Теперь перейдите в окно игры Anagram и расшифруйте первые три или четыре анаграммы (ответы находятся в классе WordLibrary: abstraction, ambiguous, arithmetic, backslash...)
-[start=9]
+
. Вернитесь в консоль JConsole. Вы увидите, что получено четыре уведомления.
-[start=10]
+
. При нажатии на узел 'Атрибуты' видно, что атрибуты обновлены:
image::images/jmx-jconsole2.png[title="Окно JConsole с обновленными значениями"]
link:/about/contact_form.html?to=3&subject=Feedback:%20Getting%20Started%20with%20JMX%20Monitoring[+Отправить отзыв по этому учебному курсу+]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_zh_CN.asciidoc
index 3149428..28cbd64 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-getstart_zh_CN.asciidoc
@@ -151,13 +151,13 @@
3. 选择 "Anagram Game Managed with JMX"(使用 JMX 管理的 Anagram Game)项目。
image::images/jmx-newproject.png[title=""New Project"(新建项目)向导中的 "Anagram Game Managed with JMX"(使用 JMX 管理的 Anagram Game)"]
-[start=4]
+
. 单击 "Next"(下一步)。无需更改提供的默认项目名称或位置值。确认 "Set as Main Project"(设置为主项目)复选框处于选中状态。单击 "Finish"(完成)。
*注:*如果您以前未安装 JUnit 插件,则 IDE 可能会提示您安装 JUnit 库。您可以单击 "Resolve Resource Problems"(解决资源问题)对话框中的 "Resolve"(解决)启动安装程序来安装 JUnit 插件。或者,您也可以在插件管理器中安装 JUnit 插件。
-[start=5]
+
. 创建项目并将其设置为主项目之后,通过单击 "Run Main Project with Monitoring and Management"(通过监视和管理运行主项目)JConsole 按钮使用 JConsole 运行该项目。
*注:*当 Java 监视和管理控制台尝试连接到 Anagram Game 进程时,您可能会在此控制台中看到 "Connection Failed"(连接失败)警告。对于本教程,当系统提示您授权连接时,您可以单击 "Insecure"(不安全)。
@@ -169,20 +169,20 @@
也将显示 "JConsole" 窗口。
-[start=6]
+
. 在 "JConsole" 窗口中,选择 "MBean" 标签,然后在左侧的树布局中向下打开 ``anagrams.toy.com`` 下的所有节点,如下所示。
image::images/jmx-jconsole1.png[title=""JConsole" 窗口"]
-[start=7]
+
. 选择 "Notifications"(通知)节点,然后单击底部的 "Subscribe"(订阅)按钮,这样在 Anagram 每次得到解决时 JConsole 都将会收到新通知。
-[start=8]
+
. 现在转到 "Anagrams Game" 窗口,然后解决前三个或前四个 Anagram(答案位于 WordLibrary 类中,而此处它们是:abstraction、ambiguous、arithmetic、backslash...)
-[start=9]
+
. 返回 JConsole,注意它收到了四个通知。
-[start=10]
+
. 单击 "Attributes"(属性)节点,可以看到更新了属性值:
image::images/jmx-jconsole2.png[title="显示已更新值的 "JConsole" 窗口"]
link:/about/contact_form.html?to=3&subject=Feedback:%20Getting%20Started%20with%20JMX%20Monitoring[+发送有关此教程的反馈意见+]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial.asciidoc
index bcc12d0..09064c8 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial.asciidoc
@@ -97,7 +97,7 @@
3. Select the Anagram Game Managed with JMX project.
image::images/jmx-newproject.png[title="Anagram Game Managed with JMX in New Project wizard"]
-[start=4]
+
. Click Next. There is no need to change the already the default project name and location values. Confirm that Set as Main Project is selected and click Finish.
@@ -117,7 +117,7 @@
You can provide a port on which the agent waits for incoming JMX requests. In this tutorial, we just keep the default port (1099). If you provided another port number, you would have to make the appropriate changes in every part of this tutorial. Also, in this tutorial, we do not specify a properties file. (For your own applications, we provide a wizard to help you create a management properties file.)
-[start=6]
+
. Choose Debug > Run Main Project with Monitoring and Management from the main menu to launch the Anagram Game application.
Alternatively, click the Run Main Project with Monitoring and Management button in the toolbar ( image::images/run-project24.png[title="Run Main Project with Monitoring and Management button"]).
@@ -140,10 +140,10 @@
2. Choose Java Application in the Java category. Click Next.
image::images/jmx-newjavaproject.png[title="New Java Project wizard"]
-[start=3]
+
. Type *JMXAnagramManager* as the Project Name.
-[start=4]
+
. Select Set as Main Project (if not selected) and deselect Create Main Class. Click Finish.
*Note.* You will use the JMX Manager wizard to generate the main runnable class in the next exercise.
@@ -159,19 +159,19 @@
2. Choose File > New File (Ctrl-N; ⌘-N on Mac) and select JMX Manager in the JMX category. Click Next.
image::images/jmx-newjmxmanager.png[title="JMX Manager template in New File wizard"]
-[start=3]
+
. Type *AnagramsManager* as the Class Name.
-[start=4]
+
. Type *com.toys.anagrams.manager* as the package name.
-[start=5]
+
. Confirm that Generate Main Method, Set as Project Main Class and Generate Sample MBean Discovery Code are selected. Click Next.
-[start=6]
+
. Click Edit to enter the JMX agent URL to which you want to connect.
-[start=7]
+
. Accept the default values in the RMI JMX Agent URL dialog box. Click OK.
The RMI JMX Agent URL dialog box helps you enter a valid JMX URL, composed of a Protocol, a Host, a Port and an URL path.
@@ -185,7 +185,7 @@
When you click OK the JMX Agent URL field is updated with the full URL according to the details specified in the RMI JMX Agent URL dialog box.
-[start=8]
+
. Confirm that Authenticated Connection and Generate Sample Code for Authenticated Connection are selected. Click Finish.
[.feature]
--
@@ -225,10 +225,10 @@
----
-[start=2]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) to generate any necessary import statements ( ``java.util.Set`` and ``java.util.Iterator`` ). Save your changes.
-[start=3]
+
. Choose Run > Run Main Project from the main menu.
Alternatively, right-click the JMXAnagramManager project node in the Projects window and choose Run.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ja.asciidoc
index e52cf48..753d2b6 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ja.asciidoc
@@ -96,7 +96,7 @@
3. JMXで管理されたアナグラム・ゲーム・プロジェクトを選択します。
image::images/jmx-newproject.png[title="新規プロジェクト・ウィザードのJMXで管理されたアナグラム・ゲーム"]
-[start=4]
+
. 「次」をクリックします。既存のデフォルトのプロジェクト名と場所の値を変更する必要はありません。「メイン・プロジェクトとして設定」が選択されていることを確認し、「終了」をクリックします。
@@ -116,7 +116,7 @@
エージェントが受信JMXリクエストを待機するポートを指定できます。このチュートリアルでは、デフォルト・ポート(1099)のままにします。別のポート番号を指定する場合は、このチュートリアルの各部分で適切な変更を行う必要があります。また、このチュートリアルでは、プロパティ・ファイルも指定しません。(独自のアプリケーションの場合、管理プロパティ・ファイルの作成に役立つウィザードが提供されます。)
-[start=6]
+
. メイン・メニューから「デバッグ」>「モニタリングと管理付きでメイン・プロジェクトを実行」を選択し、Anagram Gameアプリケーションを起動します。
あるいは、ツールバーの「モニタリングと管理付きでメイン・プロジェクトを実行」ボタン(image::images/run-project24.png[title="モニタリングおよび管理によるメイン・プロジェクトの実行のボタン"])をクリックします。
@@ -139,10 +139,10 @@
2. 「Java」カテゴリで「Javaアプリケーション」を選択します。「次」をクリックします。
image::images/jmx-newjavaproject.png[title="新規Javaプロジェクト・ウィザード"]
-[start=3]
+
. プロジェクト名として*「JMXAnagramManager」*と入力します。
-[start=4]
+
. 「メイン・プロジェクトとして設定」を選択し(選択されていない場合)、「メイン・クラスの作成」を選択解除します。「終了」をクリックします。
*注意:*次の課題で、JMXマネージャ・ウィザードを使用してメインの実行可能クラスを生成します。
@@ -158,19 +158,19 @@
2. 「ファイル」>「新規ファイル」([Ctrl]-[N]、Macの場合は[⌘]-N)を選択し、「JMX」カテゴリで「JMXマネージャ」を選択します。「次」をクリックします。
image::images/jmx-newjmxmanager.png[title="新規ファイル・ウィザードのJMXマネージャ・テンプレート"]
-[start=3]
+
. クラス名として*「AnagramsManager」*と入力します。
-[start=4]
+
. パッケージ名として*「com.toys.anagrams.manager」*と入力します。
-[start=5]
+
. 「mainメソッドを生成」、「プロジェクトのメイン・クラスとして設定」および「サンプルMBean検出コードの生成」が選択されていることを確認します。「次」をクリックします。
-[start=6]
+
. 「編集」をクリックして、接続するJMXエージェントURLを入力します。
-[start=7]
+
. RMI JMXエージェントURLダイアログ・ボックスでデフォルト値を受け入れます。「OK」をクリックします。
RMI JMXエージェントURLダイアログ・ボックスは、プロトコル、ホスト、ポートおよびURLパスで構成される有効なJMX URLの入力に有用です。
@@ -184,7 +184,7 @@
「OK」をクリックすると、RMI JMXエージェントURLダイアログ・ボックスで指定された詳細に基づいた完全なURLでJMXエージェントURLフィールドが更新されます。
-[start=8]
+
. 「認証された接続」および「認証された接続に対するサンプル・コードの生成」が選択されていることを確認します。「終了」をクリックします。
[.feature]
--
@@ -224,10 +224,10 @@
----
-[start=2]
+
. エディタで右クリックして「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、必要なインポート文( ``java.util.Set`` および ``java.util.Iterator`` )を生成します。変更を保存します。
-[start=3]
+
. メイン・メニューから「実行」>「メイン・プロジェクトの実行」を選択します。
または、「プロジェクト」ウィンドウでJMXAnagramManagerプロジェクト・ノードを右クリックし、「実行」を選択します。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_pt_BR.asciidoc
index 05459c5..1e3bee7 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_pt_BR.asciidoc
@@ -96,7 +96,7 @@
3. Selecione o Jogo de Anagramas Gerenciado com o projeto JMX.
image::images/jmx-newproject.png[title="Jogo de Anagramas Gerenciado com o JMX no assistente Novo Projeto"]
-[start=4]
+
. Clique em Próximo. Não é necessário alterar o nome do projeto default ou os valores do local. Confirme se a opção Definir como Projeto Principal foi selecionada e clique em Finalizar.
@@ -116,7 +116,7 @@
Você pode fornecer uma porta na qual o agente aguarda pelas solicitações JMX de entrada. Neste tutorial, mantemos a porta default (1099). Se você forneceu outro número de porta, terá que fazer as alterações apropriadas em cada parte deste tutorial. Além disso, neste tutorial, não especificamos um arquivo de propriedades. (Para suas próprias aplicações, fornecemos um assistente para ajudá-lo a criar um arquivo de propriedades de gerenciamento).
-[start=6]
+
. Escolha Depurar > Executar Projeto Principal com Monitoramento e Gerenciamento do menu principal para acionar a aplicação Jogo de Anagramas.
Se preferir, clique no botão Executar Projeto Principal com Monitoramento e Gerenciamento na barra de ferramentas ( image::images/run-project24.png[title="Botão Executar Projeto Principal com Monitoramento e Gerenciamento"]).
@@ -139,10 +139,10 @@
2. Escolha Aplicação Java na categoria Java. Clique em Próximo.
image::images/jmx-newjavaproject.png[title="Assistente Novo Projeto Java"]
-[start=3]
+
. Digite *JMXAnagramManager* como Nome do Projeto.
-[start=4]
+
. Selecione Definir como Projeto Principal (se não estiver selecionado) e desmarque a opção Criar Classe Principal. Clique em Finalizar.
*Observação.* Você usará o assistente Gerenciador JMX para gerar a classe executável principal no próximo exercício.
@@ -158,19 +158,19 @@
2. Escolha Arquivo > Novo Arquivo (Ctrl-N; ⌘-N no Mac) e selecione Gerenciador JMX na categoria JMX. Clique em Próximo.
image::images/jmx-newjmxmanager.png[title="O modelo do Gerenciador JMX no assistente Novo Arquivo"]
-[start=3]
+
. Digite *AnagramsManager* como o Nome da Classe.
-[start=4]
+
. Digite *com.toys.anagrams.manager* como o nome do pacote.
-[start=5]
+
. Confirme se Gerar Método Principal, Definir como Classe Principal do Projeto e Gerar Código de Descoberta do MBean de Amostra estão selecionados. Clique em Próximo.
-[start=6]
+
. Clique em Editar para digitar o URL do agente JMX para o qual você deseja estabelecer conexão.
-[start=7]
+
. Aceite os valores default na caixa de diálogo URL do Agente JMX do RMI. Clique em OK.
A caixa de diálogo URL do Agente JMX do RMI ajuda a informar um URL de JMX válido, composto de um Protocolo, um Host, uma Porta e um caminho de URL.
@@ -184,7 +184,7 @@
Quando você clicar em OK, o campo URL do Agente JMX é atualizado com o URL completo, de acordo com os detalhes especificados na caixa de diálogo URL do Agente JMX do RMI.
-[start=8]
+
. Confirme se Conexão Autenticada e Gerar Código de Amostra para Conexão Autenticada estão selecionados. Clique em Finalizar.
[.feature]
--
@@ -224,10 +224,10 @@
----
-[start=2]
+
. Clique com o botão direito do mouse no editor e escolha Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) para gerar quaisquer instruções de importação necessárias ( ``java.util.Set`` e ``java.util.Iterator`` ). Salve as alterações.
-[start=3]
+
. Escolha Executar > Executar Projeto Principal no menu principal.
Alternativamente, clique com o botão direito do mouse no nó do projeto JMXAnagramManager na janela Projetos e escolha Executar.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ru.asciidoc
index 4f6cece..624da71 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_ru.asciidoc
@@ -97,7 +97,7 @@
3. Выберите проект 'Игра Anagram под управлениемJMX'.
image::images/jmx-newproject.png[title="Проект 'Игра Anagram под управлениемJMX' в мастере создания проектов"]
-[start=4]
+
. Нажмите 'Далее'. Имя проекта и местоположение по умолчанию можно не менять. Проверьте, что установлен флажок 'Выбрать как основной проект', и нажмите 'Готово'.
@@ -117,7 +117,7 @@
Вы можете указать порт, с которого агент будет ожидать входящие запросы от JMX. В этом руководстве будет использоваться порт по умолчанию (1099). Если вы указали другой номер порта, вам потребуется внести соответствующие изменения на всех этапах. Кроме того, в этом руководстве не указывается файл свойств. (При разработке собственных приложений файлы свойств управления можно создавать с помощью мастера.)
-[start=6]
+
. Выберите 'Отладка > Запуск основного проекта с функциями мониторинга и управления' в главном меню, чтобы запустить приложение Anagram Game.
Также можно нажать кнопку 'Запуск основного проекта с функциями мониторинга и управления' на панели инструментов ( image::images/run-project24.png[title="Кнопка 'Запуск основного проекта с функциями мониторинга и управления'"]).
@@ -140,10 +140,10 @@
2. В категории Java выберите 'Приложение Java'. Нажмите 'Далее'.
image::images/jmx-newjavaproject.png[title="Мастер создания проектов Java"]
-[start=3]
+
. В поле 'Имя проекта' введите *JMXAnagramManager*.
-[start=4]
+
. Выберите параметр 'Выбрать как основной проект' (если он еще не выбран) и снимите флажок 'Создать основной класс'. Нажмите 'Готово'.
*Примечание.* В следующем упражнении вы узнаете, как создать основной выполняемый класс с помощью мастера диспетчера JMX.
@@ -159,19 +159,19 @@
2. Выберите 'Файл > Создать файл' (Ctrl-N; ⌘-N для Mac), затем выберите 'Диспетчер JMX' в категории JMX. Нажмите кнопку "Далее".
image::images/jmx-newjmxmanager.png[title="Шаблон диспетчера JMX в мастере создания файлов"]
-[start=3]
+
. В поле 'Имя класса' введите *AnagramsManager*.
-[start=4]
+
. В поле 'Имя пакета' укажите *com.toys.anagrams.manager*.
-[start=5]
+
. Убедитесь, что выбраны параметры 'Создать основной метод', 'Выбрать как основной класс проекта' и 'Создать пример кода обнаружения MBean'. Нажмите 'Далее'.
-[start=6]
+
. Нажмите 'Изменить' и укажите URL-адрес агента JMX, к которому будет выполняться подключение.
-[start=7]
+
. Оставьте все параметры по умолчанию в диалоговом окне 'URL-адрес агента RMI JMX' без изменения. Нажмите ОК.
В диалоговом окне 'URL-адрес агента RMI JMX' указывается действующий URL-адрес JMX, который включает в себя протокол, узел, порт и путь URL.
@@ -185,7 +185,7 @@
При нажатии на кнопку ОК в поле 'URL-адрес агента JMX' появляется обновленный полный URL-адрес, составленный на основе данных, указанных в диалоговом окне 'URL-адрес агента RMI JMX'.
-[start=8]
+
. Убедитесь, что выбраны параметры 'Аутентифицированное подключение' и 'Создать пример кода для аутентифицированного подключения'. Нажмите 'Готово'.
[.feature]
--
@@ -225,10 +225,10 @@
----
-[start=2]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' (Alt-Shift-I; ⌘-Shift-I в Mac), чтобы создать необходимые выражения импорта ( ``java.util.Set`` и ``java.util.Iterator`` ). Сохраните изменения.
-[start=3]
+
. Выберите 'Выполнить > Запуск основного проекта' в главном меню.
Также можно щелкнуть правой кнопкой мыши узел проекта JMXAnagramManager в окне 'Проекты' и выбрать 'Выполнить'.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_zh_CN.asciidoc
index a0c3ccc..1889757 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-manager-tutorial_zh_CN.asciidoc
@@ -96,7 +96,7 @@
3. 选择 "Anagram Game Managed with JMX"(使用 JMX 管理的 Anagram Game)项目。
image::images/jmx-newproject.png[title=""New Project"(新建项目)向导中的 "Anagram Game Managed with JMX"(使用 JMX 管理的 Anagram Game)"]
-[start=4]
+
. 单击 "Next"(下一步)。无需更改已有的默认项目名称和位置值。确认选中 "Set as Main Project"(设置为主项目),然后单击 "Finish"(完成)。
@@ -116,7 +116,7 @@
可以提供代理用于等待传入的 JMX 请求的端口。在本教程中,我们只保留默认端口 (1099)。如果您提供了其他端口号,则必须在本教程的每一部分进行适当的更改。另外,在本教程中,我们不指定属性文件。(针对您自己的应用程序,我们将提供一个向导来帮助您创建管理属性文件。)
-[start=6]
+
. 从主菜单中选择 "Debug"(调试)> "Run Main Project with Monitoring and Management"(通过监视和管理运行主项目)以启动 Anagram Game 应用程序。
或者,单击工具栏中的 "Run Main Project with Monitoring and Management"(通过监视和管理运行主项目)按钮 (image::images/run-project24.png[title=""Run Main Project with Monitoring and Management"(通过监视和管理运行主项目)按钮"])。
@@ -139,10 +139,10 @@
2. 选择 "Java" 类别中的 "Java Application"(Java 应用程序)。单击 "Next"(下一步)。
image::images/jmx-newjavaproject.png[title=""New Java Project"(新建 Java 项目)向导"]
-[start=3]
+
. 键入 *JMXAnagramManager* 作为项目名称。
-[start=4]
+
. 选择 "Set as Main Project"(设置为主项目)(如果未选中)并取消选择 "Create Main Class"(创建主类)。单击 "Finish"(完成)。
*注:*您将在下一个练习中使用 JMX 管理器向导生成可运行的主类。
@@ -158,19 +158,19 @@
2. 选择 "File"(文件)> "New File"(新建文件)(Ctrl-N 组合键;在 Mac 上为 ⌘-N 组合键),然后在 "JMX" 类别中选择 "JMX Manager"(JMX 管理器)。单击 "Next"(下一步)。
image::images/jmx-newjmxmanager.png[title=""New File"(新建文件)向导中的 JMX 管理器模板"]
-[start=3]
+
. 键入 *AnagramsManager* 作为类名。
-[start=4]
+
. 键入 *com.toys.anagrams.manager* 作为包名称。
-[start=5]
+
. 确认选中 "Generate Main Method"(生成 main 方法)、"Set as Project Main Class"(设置为项目主类)和 "Generate Sample MBean Discovery Code"(生成样例 MBean 发现代码)。单击 "Next"(下一步)。
-[start=6]
+
. 单击 "Edit"(编辑)以输入要连接到的 JMX 代理 URL。
-[start=7]
+
. 接受 "RMI JMX Agent URL"(RMI JMX 代理 URL)对话框中的默认值。单击 "OK"(确定)。
"RMI JMX Agent URL"(RMI JMX 代理 URL)对话框将帮助您输入有效的 JMX URL(由协议、主机、端口和 URL 路径组成)。
@@ -184,7 +184,7 @@
单击 "OK"(确定)后,将根据 "RMI JMX Agent URL"(RMI JMX 代理 URL)对话框中指定的详细信息使用完整 URL 更新 "JMX Agent URL"(JMX 代理 URL)字段。
-[start=8]
+
. 确认选中 "Authenticated Connection"(已验证连接)和 "Generate Sample Code for Authenticated Connection"(为已验证连接生成样例代码)。单击 "Finish"(完成)。
[.feature]
--
@@ -224,10 +224,10 @@
----
-[start=2]
+
. 在编辑器中右键单击,然后选择“修复导入”(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键),以生成所有必要的 import 语句( ``java.util.Set`` 和 ``java.util.Iterator`` )。保存所做的更改。
-[start=3]
+
. 从主菜单中选择“运行”>“运行主项目”。
或者,在“项目”窗口中右键单击 JMXAnagramManager 项目节点,然后选择“运行”。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial.asciidoc
index b1d1bd6..d0ed077 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial.asciidoc
@@ -95,16 +95,16 @@
When you click Finish the IDE creates the Anagram Game project and displays the project in the Projects window.
-[start=5]
+
. Right-click the AnagramGame project and select Properties.
-[start=6]
+
. Select the Sources category and confirm that the Source/Binary format is set to JDK 7 or JDK 8. Click OK.
*Note.* To select JDK 7 or JDK 8, the Java Platform for the AnagramGame project must also be at least JDK 7 or JDK 8, respectively. You can change the Java Platform for the AnagramGame in the Libraries category in the Properties window.
-[start=7]
+
. Right-click the Anagram Game project node and choose Run.
When you choose Run, the IDE builds and launches the Anagram Game application.
@@ -121,7 +121,7 @@
3. From the JMX category, select Standard MBean. Click Next.
image::images/jmx-newfile.png[title="Standard MBean file type in New File Wizard"]
-[start=4]
+
. Enter the following information Name and Location panel:
* Class Name: ``AnagramsStats``
* Location: Source Packages (default)
@@ -130,7 +130,7 @@
image::images/jmx-newmbean.png[]
-[start=5]
+
. Click Finish.
When you click Finish the ``AnagramsStats`` MBean class and ``AnagramsStatsMBean`` MBean interface are generated in the ``com.toy.anagrams.mbeans`` package of the AnagramGame project. These are now several empty skeletons that you will populate in the next exercise.
@@ -159,7 +159,7 @@
*Note.* Do not click OK yet!
-[start=4]
+
. Click Add Attribute again and add the following ``NumSolvedAnagrams`` attribute. Click OK.
* Attribute Name: ``NumSolvedAnagrams``
* Type: int
@@ -175,10 +175,10 @@
Next you will add three more attributes to keep track of the minimum and maximum thinking time the user took, and of the current anagram being proposed to the user.
-[start=5]
+
. Right-click in the source editor and select *JMX > Add MBean Attributes* in the popup menu.
-[start=6]
+
. Click the Add Attribute button and add the following attributes.
|===
@@ -198,13 +198,13 @@
*Note.* Notice that the attributes that you already created are listed in the dialog box.
-[start=7]
+
. Click OK and save your changes.
-[start=8]
+
. Right-click in the source editor and select *JMX > Add MBeans Operations* in the popup menu.
-[start=9]
+
. Click Add Operation and add the ``resetAll()`` operation and specify the following details. Click OK.
* Operation Name: ``resetAll``
* Return Type: ``void``
@@ -217,10 +217,10 @@
After you click OK you can see that the necessary code to expose the ``resetAll`` operation was generated in both the ``AnagramsStats`` MBean class and its interface.
-[start=10]
+
. Right-click in the source editor and select the *JMX > Implement NotificationEmitter interface* in the popup menu.
-[start=11]
+
. Specify the following details in the Implement NotificationEmitter interface dialog box.
* *Select Generate Delegation to Broadcaster.* All methods declared by the ``NotificationEmitter`` interface will be implemented by delegating to a notification broadcaster. A notification broadcaster simplifies the way the MBean will send notifications.
* *Select Generate Private Seq Number and Accessor.* Some code will be generated to handle the unique sequence number value that must be added to each notification that is sent.
@@ -236,7 +236,7 @@
You can see that the necessary code to implement the ``NotificationEmitter`` interface was generated in the ``AnagramsStats`` MBean class. You can see how the generated implementation delegates the handling of notifications to the ``NotificationBroadcasterSupport`` class.
-[start=12]
+
. Save your changes.
In this exercise you learned how to add attributes, operations and notifications emission to an MBean using the JMX Wizard module. The steps needed to populate your MBean with the necessary infrastructure to expose the management information you want are now finished. You now need to add internal logic to the ``AnagramsStats`` MBean class implementation, then build the bridge between the MBean and the Anagram Game application.
@@ -262,7 +262,7 @@
}
----
-[start=3]
+
. You also need to add some implementation code that will do the following:
* calculate the thinking time the user took to solve the last anagram,
* calculate the minimum and maximum thinking times,
@@ -349,10 +349,10 @@
The ``Anagrams`` class in the ``com.toy.anagrams.ui`` package is the ``main`` class of the Anagram Game application. The file opens in the Editor's Design view because the ``Anagrams`` class is also the User Interface class.
-[start=2]
+
. Click the Source button at the top of the Editor window to edit the class in the Source view.
-[start=3]
+
. Add the following empty ``initManagement()`` private method to the ``Anagrams`` class: after the ``Anagrams`` constructor.
[source,java]
@@ -368,7 +368,7 @@
}
----
-[start=4]
+
. Add the following call to the ``initManagement()`` method at the end of the ``Anagrams`` class constructor before the enclosing curly brace marking the end of the constructor.
[source,java]
@@ -390,7 +390,7 @@
image:images/jmx-initmanagement-sm.png[role="left", link="images/jmx-initmanagement.png"]
--
-[start=5]
+
. We now add the MBean registration code to the ``initManagement()`` method, using the JMX Module MBean registration wizard:
In the ``Anagrams.java`` source editor window, right-click *inside* the ``initManagement()`` method body, select the JMX submenu and then the "Generate MBean Registration..." action. In the "Instantiate and Register MBean" panel that shows up, keep the "Register Existing MBean" radio-button selected, click the Browse button, choose the ``AnagramsStats`` MBean class and click OK in the Browse panel. You should now see:
@@ -416,7 +416,7 @@
Therefore, you need to make the following changes to the code of the ``Anagrams.java`` file.
-[start=6]
+
. Add the following private field to the ``Anagrams`` class.
[source,java]
@@ -427,7 +427,7 @@
----
-[start=7]
+
. Initialize the reference to the ``AnagramsStats`` MBean in the ``initManagement()`` method by modifying the generated MBean Registration code so that it reads:
[source,java]
@@ -444,7 +444,7 @@
}
----
-[start=8]
+
. Initialize the ``AnagramsStats`` MBean state: when the Anagrams Game application starts up, an anagram is immediately displayed, so we need to pass to the MBean the anagram string value and to start computing thinking time. Copy and paste the lines below at the end of the ``initManagement()`` method:
[source,java]
@@ -467,7 +467,7 @@
You now need to add code to track the user's anagram solving experience.
-[start=9]
+
. Locate the ``nextTrialActionPerformed()`` method and paste the following code at the end of the ``nextTrialActionPerformed()`` method.
[source,java]
@@ -483,7 +483,7 @@
Each time that a new anagram is proposed to the user, the code tells the MBean which anagram it is and to start counting the user thinking time.
-[start=10]
+
. Locate the ``guessedWordActionPerformed()`` method and add the following lines to the code. Save your changes.
[source,java]
@@ -532,30 +532,30 @@
*Notes.* You might see a Connection Failed warning in the Java Monitoring & Management Console when the console attempts to connect to the Anagram Game process. For this tutorial you can click Insecure when you are prompted to authorize the connection.
-[start=2]
+
. Select the MBeans tab in the JConsole window.
-[start=3]
+
. In the tree layout in the left pane, expand all the nodes under ``com.toy.anagrams.mbeans`` .
image::images/jmx-jconsole-mbeans1.png[title="MBeans tab showing AnagramsStats node"]
-[start=4]
+
. Select the Notifications node and click on the Subscribe button at the bottom so that JConsole will receive a new notification each time an anagram is solved.
-[start=5]
+
. In the Anagrams Game window, and solve the first three or four anagrams.
The solutions to the anagrams (abstraction, ambiguous, arithmetic, backslash,...) are contained in the ``WordLibrary`` class.
-[start=6]
+
. In the JConsole window, and notice that it received notifications for each of the solutions.
[.feature]
--
image::images/jmx-jconsole-mbeans2-sm.png[role="left", link="images/jmx-jconsole-mbeans2.png"]
--
-[start=7]
+
. Click on the Attributes node and notice the attributes values are updated:
image::images/jmx-jconsole-mbeans3.png[title="MBeans tab showing AnagramsStats node"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ja.asciidoc
index f48d2ae..17f7c02 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ja.asciidoc
@@ -94,16 +94,16 @@
「終了」をクリックすると、IDEによってAnagram Gameプロジェクトが作成され、そのプロジェクトが「プロジェクト」ウィンドウに表示されます。
-[start=5]
+
. AnagramGameプロジェクトを右クリックし、「プロパティ」を選択します。
-[start=6]
+
. 「ソース」カテゴリを選択し、「ソース/バイナリ形式」がJDK 7またはJDK 8に設定されていることを確認します。「OK」をクリックします。
*注意:*「JDK 7」または「JDK 8」を選択するには、AnagramGameプロジェクトのJavaプラットフォームもそれぞれJDK 7またはJDK 8以上である必要があります。AnagramGameのJavaプラットフォームは、「プロパティ」ウィンドウの「ライブラリ」カテゴリで変更できます。
-[start=7]
+
. Anagram Gameプロジェクト・ノードを右クリックし、「実行」を選択します。
「実行」をクリックすると、IDEによってAnagram Gameアプリケーションがビルドおよび起動されます。
@@ -120,7 +120,7 @@
3. 「JMX」カテゴリから、「標準MBean」を選択します。「次」をクリックします。
image::images/jmx-newfile.png[title="新規ファイル・ウィザードの標準MBeanファイル・タイプ"]
-[start=4]
+
. 「名前と場所」パネルで次の情報を入力します。
* クラス名: ``AnagramsStats``
* 場所: ソース・パッケージ(デフォルト)
@@ -129,7 +129,7 @@
image::images/jmx-newmbean.png[]
-[start=5]
+
. 「終了」をクリックします。
「終了」をクリックすると、 ``AnagramsStats`` MBeanクラスおよび ``AnagramsStatsMBean`` MBeanインタフェースがAnagramGameプロジェクトの ``com.toy.anagrams.mbeans`` パッケージに作成されます。これらは、次の課題で移入されるの空のスケルトンです。
@@ -158,7 +158,7 @@
*注意:*まだ「OK」をクリックしないでください。
-[start=4]
+
. 「属性の追加」を再度クリックし、次の ``NumSolvedAnagrams`` 属性を追加します。「OK」をクリックします。
* 属性名: ``NumSolvedAnagrams``
* 型: int
@@ -174,10 +174,10 @@
次に、ユーザーが解答までにかかった最小と最大の思考時間および現在ユーザーに表示されているアナグラムを追跡するために、属性をさらに3個追加します。
-[start=5]
+
. ソース・エディタで右クリックし、ポップアップ・メニューで*「JMX」>「MBean属性の追加」*を選択します。
-[start=6]
+
. 「属性の追加」ボタンをクリックし、次の属性を追加します。
|===
@@ -197,13 +197,13 @@
*注意:*作成した属性がダイアログ・ボックスにリストされていることに注意してください。
-[start=7]
+
. 「OK」をクリックして変更内容を保存します。
-[start=8]
+
. ソース・エディタで右クリックし、ポップアップ・メニューで*「JMX」>「MBean操作の追加」*を選択します。
-[start=9]
+
. 「操作の追加」をクリックし、 ``resetAll()`` 操作を追加して次の詳細を指定します。「OK」をクリックします。
* 操作名: ``resetAll``
* 戻り型: ``void``
@@ -216,10 +216,10 @@
「OK」をクリックすると、 ``resetAll`` 操作を公開するために必要なコードが ``AnagramsStats`` MBeanクラスとそのインタフェースの両方に生成されていることが確認できます。
-[start=10]
+
. ソース・エディタで右クリックし、ポップアップ・メニューで*「JMX」>「NotificationEmitterインタフェースの実装」*を選択します。
-[start=11]
+
. 「NotificationEmitterインタフェースの実装」ダイアログで次の詳細を指定します。
* *「ブロードキャスタへの委任の生成」を選択します。* ``NotificationEmitter`` インタフェースによって宣言されているすべてのメソッドは、通知ブロードキャスタに委任することで実装されます。通知ブロードキャスタは、MBeanが通知を送信する方法を簡略化します。
* *「プライベート順序番号とアクセッサの生成」を選択します。*送信される各通知に追加される一意の順序番号値を処理するためのコードが生成されます。
@@ -235,7 +235,7 @@
``NotificationEmitter`` インタフェースを実装するために必要なコードが ``AnagramsStats`` MBeanクラスに生成されていることが確認できます。生成された実装によって通知の処理が ``NotificationBroadcasterSupport`` クラスに委任されたことが確認できます。
-[start=12]
+
. 変更を保存します。
この課題では、JMXウィザード・モジュールを使用して、属性、操作および通知の送信をMBeanに追加する方法を学習しました。これで、管理情報を公開するために必要なインフラストラクチャをMBeanに移入するために必要な手順が終了しました。 ``AnagramsStats`` MBeanクラスの実装に内部ロジックを追加し、MBeanとAnagram Gameアプリケーションの間にブリッジを作成する必要があります。
@@ -261,7 +261,7 @@
}
----
-[start=3]
+
. 次の処理を行う実装コードも追加する必要があります。
* ユーザーが最後のアナグラムを解くのにかかった思考時間の計算
* 最小および最大の思考時間の計算
@@ -348,10 +348,10 @@
``com.toy.anagrams.ui`` パッケージの ``Anagrams`` クラスは、Anagram Gameアプリケーションの ``main`` クラスです。 ``Anagrams`` クラスはユーザー・インタフェース・クラスでもあるため、ファイルはエディタの「デザイン」ビューで開きます。
-[start=2]
+
. エディタ・ウィンドウの上部にある「ソース」ボタンをクリックして、「ソース」ビューでクラスを編集します。
-[start=3]
+
. 次の空の ``initManagement()`` プライベート・メソッドを ``Anagrams`` クラス( ``Anagrams`` コンストラクタの後)に追加します。
[source,java]
@@ -367,7 +367,7 @@
}
----
-[start=4]
+
. 次の ``initManagement()`` メソッドへのコールを ``Anagrams`` クラス・コンストラクタの最後、コンストラクタの終わりを表す終了の波括弧の前に追加します。
[source,java]
@@ -389,7 +389,7 @@
image:images/jmx-initmanagement-sm.png[role="left", link="images/jmx-initmanagement.png"]
--
-[start=5]
+
. ここで、JMXモジュールMBean登録ウィザードを使用して、MBean登録コードを ``initManagement()`` メソッドに追加します。
``Anagrams.java`` ソース・エディタ・ウィンドウで、 ``initManagement()`` メソッド本体*内*を右クリックし、「JMX」サブメニュー、「MBean登録の生成」アクションの順に選択します。表示された「MBeanのインスタンス化と登録」パネルで、「既存のMBeanの登録」ラジオ・ボタンを選択されたままにし、「参照」ボタンをクリックします。「参照」パネルで「 ``AnagramsStats`` 」MBeanクラスを選択し、「OK」をクリックします。表示は次のようになります。
@@ -415,7 +415,7 @@
したがって、 ``Anagrams.java`` ファイルのコードに次の変更を行う必要があります。
-[start=6]
+
. 次のプライベート・フィールドを ``Anagrams`` クラスに追加します。
[source,java]
@@ -426,7 +426,7 @@
----
-[start=7]
+
. 生成されたMBean登録コードを次のように変更して、 ``initManagement()`` メソッド内の ``AnagramsStats`` MBeanへの参照を初期化します。
[source,java]
@@ -443,7 +443,7 @@
}
----
-[start=8]
+
. ``AnagramsStats`` MBeanの状態を初期化します。Anagrams Gameアプリケーションが起動されると、アナグラムがすぐに表示されます。MBeanにアナグラム文字列値を渡し、思考時間の計算を開始する必要があります。次の行をコピーして ``initManagement()`` メソッドの最後に貼り付けます。
[source,java]
@@ -466,7 +466,7 @@
ユーザーのアナグラムの解答の実績を追跡するコードを追加する必要があります。
-[start=9]
+
. ``nextTrialActionPerformed()`` メソッドを見つけて、次のコードを ``nextTrialActionPerformed()`` メソッドの最後に貼り付けます。
[source,java]
@@ -482,7 +482,7 @@
新しいアナグラムがユーザーに表示されるたびに、MBeanにそのアナグラムが示され、ユーザーの思考時間のカウントを開始するよう指示されます。
-[start=10]
+
. ``guessedWordActionPerformed()`` メソッドを見つけ、次の行をコードに追加します。変更を保存します。
[source,java]
@@ -531,30 +531,30 @@
*注意:*コンソールからアナグラム・ゲーム・プロセスに接続しようとすると、Java Monitoring & Management Consoleに「接続に失敗しました。」という警告が表示されることがあります。このチュートリアルでは、接続の認証を求めるメッセージが表示されたら、「非セキュア」をクリックできます。
-[start=2]
+
. JConsoleウィンドウで「MBeans」タブを選択します。
-[start=3]
+
. 左ペインのツリー・レイアウトで、 ``com.toy.anagrams.mbeans`` の下のノードをすべて展開します。
image::images/jmx-jconsole-mbeans1.png[title="AnagramsStatsノードを表示した「MBeans」タブ"]
-[start=4]
+
. 「通知」ノードを選択し、下にある「サブスクライブ」ボタンをクリックして、アナグラムが解決されるたびにJConsoleが新規通知を受け取れるようにします。
-[start=5]
+
. 「Anagrams Game」ウィンドウで最初の3、4個のアナグラムを解きます。
アナグラムの解答(abstraction、ambiguous、arithmetic、backslash、...)は、 ``WordLibrary`` クラスに含まれます。
-[start=6]
+
. JConsoleウィンドウで、解答のたびに通知を受信していることを確認します。
[.feature]
--
image::images/jmx-jconsole-mbeans2-sm.png[role="left", link="images/jmx-jconsole-mbeans2.png"]
--
-[start=7]
+
. 「属性」ノードをクリックし、属性値が更新されていることを確認します。
image::images/jmx-jconsole-mbeans3.png[title="AnagramsStatsノードを表示した「MBeans」タブ"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_pt_BR.asciidoc
index 2f3bc33..5dcf55e 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_pt_BR.asciidoc
@@ -94,16 +94,16 @@
Quando você clica em Finalizar, o IDE cria o projeto Jogo de Anagramas e exibe o projeto na janela Projetos.
-[start=5]
+
. Clique com o botão direito do mouse no projeto AnagramGame e selecione Propriedades.
-[start=6]
+
. Selecione a categoria Códigos-fonte e confirme se o formato de Código-fonte/Binário está definido como JDK 7 ou JDK 8. Clique em OK.
*Observação.* Para selecionar JDK 7 ou JDK 8, a Plataforma Java do projeto Jogo de Anagramas também deve ser pelo menos JDK 7 ou JKD 8, respectivamente. Você pode alterar a Plataforma Java do Jogo de Anagramas na categoria Bibliotecas na janela Propriedades.
-[start=7]
+
. Clique com o botão direito do mouse no nó de projeto Jogo de Anagramas e selecione Executar.
Quando escolher Executar, o IDE compilará e acionará a aplicação Jogo de Anagramas.
@@ -120,7 +120,7 @@
3. Na categoria JMX, selecione MBean Padrão. Clique em Próximo.
image::images/jmx-newfile.png[title="Tipo de arquivo MBean Padrão no Assistente Novo Arquivo"]
-[start=4]
+
. Digite as seguintes informações no painel Nome e Localização:
* Nome da Classe: ``AnagramsStats``
* Localização: Pacotes de Origem (default)
@@ -129,7 +129,7 @@
image::images/jmx-newmbean.png[]
-[start=5]
+
. Clique em Finalizar.
Quando você clicar em Finalizar, a classe ``AnagramsStats`` do MBean e a interface ``AnagramsStatsMBean`` do MBean são geradas no pacote ``com.toy.anagrams.mbeans`` do projeto AnagrmGame. Agora há vários esqueletos vazios que você preencherá no próximo exercício.
@@ -158,7 +158,7 @@
*Observação.* Não clique em OK ainda!
-[start=4]
+
. Clique em Adicionar Atributo novamente e adicione o seguinte atributo ``NumSolvedAnagrams`` . Clique em OK.
* Nome do Atributo: ``NumSolvedAnagrams``
* Tipo: int
@@ -174,10 +174,10 @@
Em seguida, você adicionará mais três atributos para manter controle do tempo mínimo e máximo de reflexão que o usuário leva e do anagrama atual que está sendo proposto ao usuário.
-[start=5]
+
. Clique com o botão direito do mouse no editor de código-fonte e selecione *JMX > Adicionar Atributos de MBean* no menu pop-up.
-[start=6]
+
. Clique no botão Adicionar Atributo e adicione os seguintes atributos.
|===
@@ -197,13 +197,13 @@
*Observação.* Observe que os atributos que você já criou estão listados na caixa de diálogo.
-[start=7]
+
. Clique em OK e salve suas alterações.
-[start=8]
+
. Clique com o botão direito do mouse no editor de código-fonte e selecione *JMX > Adicionar Operações de MBean* no menu pop-up.
-[start=9]
+
. Clique em Adicionar Operação e adicione a operação ``resetAll()`` e especifique os seguintes detalhes. Clique em OK.
* Nome da Operação: ``resetAll``
* Tipo de Retorno: ``void``
@@ -216,10 +216,10 @@
Depois de clicar em OK, você poderá ver se o código necessário para expor a operação ``resetAll`` foi gerado na classe ``AnagramsStats`` do MBean e em sua interface.
-[start=10]
+
. Clique com o botão direito do mouse no editor de código-fonte e selecione *JMX > Interface Implementar NotificationEmitter* no menu pop-up.
-[start=11]
+
. Especifique os seguintes detalhes na caixa de diálogo Implementar interface NotificationEmitter.
* *Selecione Gerar Delegação para Difusor.* Todos os métodos declarados pela interface ``NotificationEmitter`` serão implementados, delegando um difusor de notificação. Um difusor de notificação simplifica a forma em que o MBean enviará notificações.
* *Selecione Gerar Número de Sequência Privada e Acessador.* Um código será gerado para tratar o valor do número de sequência exclusivo que deve ser adicionado a cada notificação enviada.
@@ -235,7 +235,7 @@
Você pode ver que o código necessário para implementar a interface ``NotificationEmitter`` foi gerado na classe ``AnagramsStats`` do MBean. Você pode ver como a implementação gerada delega o tratamento de notificações para a classe ``NotificationBroadcasterSupport`` .
-[start=12]
+
. Salve as alterações.
Neste exercício, você aprendeu a adicionar atributos, operações e emissão de notificações a um MBean usando o módulo Assistente JMX. As etapas necessárias para preencher seu MBean com a infraestrutura necessária para expor as informações de gerenciamento que você quer são finalizadas agora. Agora você precisa adicionar uma lógica interna à implementação da classe ``AnagramsStats`` do MBean, em seguida, criar a ponte entre a aplicação MBean e o Jogo de Anagramas.
@@ -261,7 +261,7 @@
}
----
-[start=3]
+
. Você também precisa adicionar algum código de implementação que executará o seguinte:
* calcular o tempo de reflexão que o usuário levou para resolve o último anagrama,
* calcular os tempos mínimo e máximo de reflexão,
@@ -348,10 +348,10 @@
A classe ``Anagrams`` no pacote ``com.toy.anagrams.ui`` é a classe ``main`` da aplicação de Jogos de Anagramas. O arquivo é aberto na view Design do Editor porque a classe ``Anagrams`` também é a classe da Interface do Usuário.
-[start=2]
+
. Clique no botão Código-fonte na parte superior da janela Editor para editar a classe na view Código-fonte.
-[start=3]
+
. Adicione o seguinte método privado ``initManagement()`` vazio para a classe ``Anagrams`` : após o construtor ``Anagrams`` .
[source,java]
@@ -367,7 +367,7 @@
}
----
-[start=4]
+
. Adicione a seguinte chamada ao método ``initManagement()`` no fim do construtor da classe ``Anagrams`` antes de a chave de fechamento marcar o fim do construtor.
[source,java]
@@ -389,7 +389,7 @@
image:images/jmx-initmanagement-sm.png[role="left", link="images/jmx-initmanagement.png"]
--
-[start=5]
+
. Agora vamos adicionar o código de registro do MBean ao método ``initManagement()`` , usando o assistente de registro do MBean do Módulo JMX:
Na janela do editor do código-fonte ``Anagrams.java`` , clique com o botão direito do mouse *no* corpo do método ``initManagement()`` , selecione o submenu JMX e, em seguida, selecione a ação "Gerar Registro de MBean...". No painel "Instanciar e Registrar MBean", que é mostrado acima, mantenha o botão de opção "Registrar MBean Existente" selecionado, clique no botão Procurar ou escolha a classe ``AnagramsStats`` do MBean e clique em OK no painel Procurar. Agora você deverá ver o seguinte:
@@ -415,7 +415,7 @@
Portanto, você precisa fazer as seguintes alterações no código do arquivo ``Anagrams.java`` .
-[start=6]
+
. Adicione o seguinte campo privado à classe ``Anagrams`` .
[source,java]
@@ -426,7 +426,7 @@
----
-[start=7]
+
. Inicialize a referência ao MBean ``AnagramsStats`` no método ``initManagement()`` modificando o código de Registro do MBean gerado, de forma que ele leia o seguinte:
[source,java]
@@ -443,7 +443,7 @@
}
----
-[start=8]
+
. Inicialize o estado ``AnagramsStats`` do MBean: quando a aplicação Jogo de Anagramas é iniciada, um anagrama é exibido imediatamente. Assim, é necessário informar ao MBean o valor da string do anagrama e começar a calcular o tempo de reflexão. Copie e cole as linhas abaixo no fim do método ``initManagement()`` :
[source,java]
@@ -466,7 +466,7 @@
Agora você precisa adicionar o código para rastrear a experiência do usuário na resolução do anagrama.
-[start=9]
+
. Localize o método ``nextTrialActionPerformed()`` e cole o seguinte código no fim do método ``nextTrialActionPerformed()`` .
[source,java]
@@ -482,7 +482,7 @@
Cada vez que um novo anagrama é proposto ao usuário, o código informa ao MBean qual é o anagrama e começa a contar o tempo de reflexão do usuário.
-[start=10]
+
. Localize o método ``guessedWordActionPerformed()`` e adicione as seguintes linhas ao código. Salve as alterações.
[source,java]
@@ -531,30 +531,30 @@
*Observações.* É possível que você veja uma advertência de Falha de Conexão na Console de Monitoramento e Gerenciamento Java quando a console tenta estabelecer conexão com o processo do Jogo de Anagramas. Neste tutorial, você pode clicar em Não Seguro quando solicitado a autorizar a conexão.
-[start=2]
+
. Selecione a guia MBeans na janela JConsole.
-[start=3]
+
. No layout da árvore no painel esquerdo, expanda todos os nós em ``com.toy.anagrams.mbeans`` .
image::images/jmx-jconsole-mbeans1.png[title="Guia MBeans que mostra o nó AnagramsStats"]
-[start=4]
+
. Selecione o nó Notificações e clique no botão Assinar na parte inferior, de forma que o JConsole recebem uma nova notificação cada vez que um anagrama é resolvido.
-[start=5]
+
. Na janela Jogo de Anagramas, resolva os primeiros três ou quatro anagramas.
As soluções para os anagramas (abstração, ambíguos, aritmética, barra invertida,...) estão contidas na classe ``WordLibrary`` .
-[start=6]
+
. Na janela JConsole observe que ela recebeu notificações para cada uma das soluções.
[.feature]
--
image::images/jmx-jconsole-mbeans2-sm.png[role="left", link="images/jmx-jconsole-mbeans2.png"]
--
-[start=7]
+
. Clique no nó Atributos e observe que os valores do atributo estão atualizados:
image::images/jmx-jconsole-mbeans3.png[title="Guia MBeans que mostra o nó AnagramsStats"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ru.asciidoc
index 560c2ed..250508b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_ru.asciidoc
@@ -95,16 +95,16 @@
При нажатии на кнопку 'Готово' IDE создает проект Anagram Game, который отображается в окне 'Проекты'.
-[start=5]
+
. Щелкните проект AnagramGame правой кнопкой мыши и выберите 'Свойства'.
-[start=6]
+
. Выберите категорию 'Исходные файлы' и убедитесь, что в качестве формата исходных/двоичных файлов выбран JDK 7 или JDK 8. Нажмите OK.
*Примечание.* Возможность выбора JDK 7 или JDK 8 доступна, если проект AnagramGame создан на платформе Java соответствующей версии (JDK 7 или JDK 8). Версию платформы Java для проекта AnagramGame можно изменить в категории 'Библиотеки' в окне 'Свойства'.
-[start=7]
+
. Щелкните узел проекта Anagram Game правой кнопкой мыши и выберите 'Выполнить'.
При выборе команды 'Выполнить' IDE осуществляет сборку и запуск приложения Anagram.
@@ -121,7 +121,7 @@
3. В категории JMX выберите Standard MBean. Нажмите кнопку "Далее".
image::images/jmx-newfile.png[title="Тип файла Standard MBean в мастере создания файлов"]
-[start=4]
+
. На панели 'Имя и местоположение' введите следующие данные:
* Имя класса: ``AnagramsStats``
* Местоположение: Исходные пакеты (по умолчанию)
@@ -130,7 +130,7 @@
image::images/jmx-newmbean.png[]
-[start=5]
+
. Нажмите 'Готово'.
При нажатии на кнопку 'Готово' создаются класс MBean ``AnagramsStats`` и интерфейс MBean ``AnagramsStatsMBean`` в пакете ``com.toy.anagrams.mbeans`` проекта AnagramGame. Теперь у вас есть несколько пустых скелетов, которые вы заполните данными в следующем упражнении.
@@ -159,7 +159,7 @@
*Примечание.* Не нажимайте кнопку OK!
-[start=4]
+
. Нажмите кнопку 'Добавить атрибут' еще раз и добавьте атрибут ``NumSolvedAnagrams`` . Нажмите OK.
* Имя атрибута: ``NumSolvedAnagrams``
* Тип: int
@@ -175,10 +175,10 @@
Теперь необходимо добавить еще несколько атрибутов для отслеживания минимального и максимального затраченного времени и текущей анаграммы, которая отображается для пользователя.
-[start=5]
+
. Щелкните в редакторе правой кнопкой мыши и выберите *JMX > Добавить атрибуты MBean* в контекстном меню.
-[start=6]
+
. Нажмите кнопку 'Добавить атрибут' и добавьте следующие атрибуты.
|===
@@ -198,13 +198,13 @@
*Примечание.* Обратите внимание, что в диалоговом окне отображается список уже созданных атрибутов.
-[start=7]
+
. Нажмите ОК, чтобы сохранить изменения.
-[start=8]
+
. Щелкните в редакторе правой кнопкой мыши и выберите *JMX > Добавить операции MBean* в контекстном меню.
-[start=9]
+
. Нажмите кнопку 'Добавить операцию', добавьте операцию ``resetAll()`` и укажите следующие данные. Нажмите OK.
* Имя операции: ``resetAll``
* Тип возвращаемого значения: ``void``
@@ -217,10 +217,10 @@
После нажатия на кнопку ОК код, необходимый для предоставления операции ``resetAll`` , будет создан как в классе MBean ``AnagramsStats`` , так и в его интерфейсе.
-[start=10]
+
. Щелкните в редакторе правой кнопкой мыши и выберите *JMX > Реализовать интерфейс NotificationEmitter* в контекстном меню.
-[start=11]
+
. В диалоговом окне 'Реализация интерфейса NotificationEmitter' введите следующие данные.
* *Выберите параметр 'Создать делегирование для транслятора'.* Все методы, объявленные интерфейсом ``NotificationEmitter`` , будут реализованы путем делегирования транслятору уведомлений. Транслятор уведомлений упрощает отправку уведомлений компонентом MBean.
* *Выберите параметр 'Создать частный порядковый номер и модификатор'.* Будет создан код для обработки уникального значения порядкового номера, который будет присваиваться каждому отправленному уведомлению.
@@ -236,7 +236,7 @@
Код, необходимый для реализации интерфейса ``NotificationEmitter`` , будет создан в классе MBean ``AnagramsStats`` . Как видите, созданная реализация делегирует обработку уведомлений классу ``NotificationBroadcasterSupport`` .
-[start=12]
+
. Сохраните изменения.
Выполнив это упражнение, вы научились добавлять атрибуты, операции и функцию отправки уведомлений в компонент MBean с помощью модуля JMX Wizard. Этап заполнения скелета MBean функциональными элементами, необходимыми для предоставления управляющих данных, завершен. Теперь необходимо добавить внутреннюю логику в реализацию класса MBean ``AnagramsStats`` и установить связь между компонентом MBean и приложением Anagram.
@@ -262,7 +262,7 @@
}
----
-[start=3]
+
. Также потребуется код реализации, который будет выполнять следующие действия:
* вычислять время, затраченное пользователем на расшифровку последней анаграммы;
* вычислять минимальное и максимальное затраченное время;
@@ -349,10 +349,10 @@
Класс ``Anagrams`` в пакете ``com.toy.anagrams.ui`` является ``основным`` классом приложения Anagram. Файл открывается в режиме конструирования, так как класс ``Anagrams`` также является классом пользовательского интерфейса.
-[start=2]
+
. Нажмите кнопку 'Исходный код' в верхней части окна редактора, чтобы открыть класс в режиме редактирования исходного кода.
-[start=3]
+
. Добавьте пустой частный метод ``initManagement()`` в класс ``Anagrams`` после конструктора ``Anagrams`` .
[source,java]
@@ -368,7 +368,7 @@
}
----
-[start=4]
+
. Добавьте следующий вызов метода ``initManagement()`` в конструктор класса ``Anagrams`` перед закрывающей фигурной скобкой, обозначающей конец конструктора.
[source,java]
@@ -390,7 +390,7 @@
image:images/jmx-initmanagement-sm.png[role="left", link="images/jmx-initmanagement.png"]
--
-[start=5]
+
. Теперь необходимо добавить код регистрации MBean в метод ``initManagement()`` с помощью мастера регистрации MBean модуля JMX:
В файле ``Anagrams.java`` , открытом в редакторе исходного кода, щелкните правой кнопкой мыши *внутри* тела метода ``initManagement()`` , выберите меню JMX и команду 'Создать регистрацию MBean...'. На отобразившейся панели 'Создание экземпляра и регистрация MBean' оставьте выбранным параметр 'Зарегистрировать существующий MBean', нажмите кнопку 'Обзор', выберите класс MBean ``AnagramsStats`` и нажмите ОК на панели 'Обзор'. На экране отобразится следующее:
@@ -416,7 +416,7 @@
Следовательно, нужно внести изменения в файл ``Anagrams.java`` .
-[start=6]
+
. Добавьте в класс ``Anagrams`` следующее частное поле.
[source,java]
@@ -427,7 +427,7 @@
----
-[start=7]
+
. Инициализируйте ссылку на MBean ``AnagramsStats`` в методе ``initManagement()`` , изменив созданный код регистрации MBean следующим образом:
[source,java]
@@ -444,7 +444,7 @@
}
----
-[start=8]
+
. Инициализируйте состояние MBean ``AnagramsStats`` . При запуске приложения Anagrams немедленно отображается анаграмма, поэтому необходимо передать компоненту MBean значение строкового ресурса анаграммы и начать отсчет времени. Скопируйте и вставьте указанные ниже строки в конец метода ``initManagement()`` :
[source,java]
@@ -467,7 +467,7 @@
Теперь нужно добавить код для контроля результатов расшифровки анаграмм.
-[start=9]
+
. Найдите метод ``nextTrialActionPerformed()`` и вставьте следующий код в конец метода ``nextTrialActionPerformed()`` .
[source,java]
@@ -483,7 +483,7 @@
Каждый раз, когда пользователю предлагается новая анаграмма, код сообщает компоненту MBean, какая это анаграмма, и компонент начинает отсчет времени.
-[start=10]
+
. Найдите метод ``guessedWordActionPerformed()`` и добавьте в него следующие строки. Сохраните изменения.
[source,java]
@@ -532,30 +532,30 @@
*Примечания.* Вы можете увидеть предупреждение о сбое подключения на консоли управления и мониторинга Java при попытке консоли подключиться к процессу Anagram Game. Для этой учебной программы вы можете нажать Ненадежно, когда вам будет предложено разрешить подключение.
-[start=2]
+
. В окне JConsole перейдите на вкладку MBeans.
-[start=3]
+
. В дереве в левой части окна разверните все узлы в структуре ``com.toy.anagrams.mbeans`` .
image::images/jmx-jconsole-mbeans1.png[title="Вкладка MBeans с узлом AnagramsStats"]
-[start=4]
+
. Выберите узел 'Уведомления' и нажмите кнопку 'Подписаться' в нижней части экрана. Теперь JConsole будет получать уведомления при каждой расшифровке анаграммы.
-[start=5]
+
. В окне игры Anagram расшифруйте первые три или четыре анаграммы.
Расшифровки анаграмм (abstraction, ambiguous, arithmetic, backslash...) содержатся в классе ``WordLibrary`` .
-[start=6]
+
. В окне JConsole отображаются уведомления, полученные при расшифровке каждой из анаграмм.
[.feature]
--
image::images/jmx-jconsole-mbeans2-sm.png[role="left", link="images/jmx-jconsole-mbeans2.png"]
--
-[start=7]
+
. Нажмите на узел 'Атрибуты' и обратите внимание на обновленные значения атрибутов:
image::images/jmx-jconsole-mbeans3.png[title="Вкладка MBeans с узлом AnagramsStats"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_zh_CN.asciidoc
index 8c044de..6af0486 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/jmx-tutorial_zh_CN.asciidoc
@@ -94,16 +94,16 @@
单击“完成”后,IDE 将创建 Anagram Game 项目,并在“项目”窗口中显示该项目。
-[start=5]
+
. 右键单击 "AnagramGame" 项目,然后选择“属性”。
-[start=6]
+
. 选择“源”类别并确认源代码/二进制格式设置为 "JDK 7" 或 "JDK 8"。单击“确定”。
*注:*要选择 JDK 7 或 JDK 8,AnagramGame 项目的 Java 平台也必须分别至少为 JDK 7 或 JDK 8。可在“属性”窗口的“库”类别中更改 AnagramGame 的 Java 平台。
-[start=7]
+
. 右键单击 "Anagram Game" 项目节点并选择“运行”。
选择“运行”后,IDE 将构建并启动 Anagram Game 应用程序。
@@ -120,7 +120,7 @@
3. 从 "JMX" 类别中选择 "Standard MBean"(标准 MBean)。单击 "Next"(下一步)。
image::images/jmx-newfile.png[title=""New File"(新建文件)向导中的 "Standard MBean"(标准 MBean)文件类型"]
-[start=4]
+
. 在 "Name and Location"(名称和位置)面板中输入以下信息:
* 类名: ``AnagramsStats``
* 位置:源包(默认值)
@@ -129,7 +129,7 @@
image::images/jmx-newmbean.png[]
-[start=5]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成)后,将在 AnagramGame 项目的 ``com.toy.anagrams.mbeans`` 包中生成 ``AnagramsStats`` MBean 类和 ``AnagramsStatsMBean`` MBean 接口。这些现在是几个空框架,在下一练习中将进行填充。
@@ -158,7 +158,7 @@
*注:*还不要单击 "OK"(确定)!
-[start=4]
+
. 再次单击 "Add Attribute"(添加属性)并添加以下 ``NumSolvedAnagrams`` 属性。单击 "OK"(确定)。
* 属性名: ``NumSolvedAnagrams``
* 类型:int
@@ -174,10 +174,10 @@
接下来,将另外添加三个属性以跟踪用户所用的最短和最长思考时间以及当前向用户提供的 Anagram。
-[start=5]
+
. 在源代码编辑器中右键单击,然后在弹出菜单中选择 *JMX > Add MBean Attributes*(JMX > 添加 MBean 属性)。
-[start=6]
+
. 单击 "Add Attribute"(添加属性)按钮并添加以下属性。
|===
@@ -197,13 +197,13 @@
*注:*请注意,此对话框中列出了您已创建的属性。
-[start=7]
+
. 单击 "OK"(确定)保存您所做的更改。
-[start=8]
+
. 在源代码编辑器中右键单击,然后在弹出菜单中选择 *JMX > Add MBeans Operations*(JMX > 添加 MBean 操作)。
-[start=9]
+
. 单击 "Add Operation"(添加操作),然后添加 ``resetAll()`` 操作并指定以下详细信息。单击 "OK"(确定)。
* 操作名: ``resetAll``
* 返回类型: ``void``
@@ -216,10 +216,10 @@
单击 "OK"(确定)后,您可以看到在 ``AnagramsStats`` MBean 类及其接口中生成了公开 ``resetAll`` 操作所需的代码。
-[start=10]
+
. 在源代码编辑器中右键单击,然后在弹出菜单中选择 *JMX > Implement NotificationEmitter interface*(JMX > 实现 NotificationEmitter 接口)。
-[start=11]
+
. 在 "Implement NotificationEmitter interface"(实现 NotificationEmitter 接口)对话框中指定以下详细信息。
* *选择 "Generate Delegation to Broadcaster"(生成到广播器的委托)。*将通过委托到通知广播器来实现 ``NotificationEmitter`` 接口声明的所有方法。通知广播器将简化 MBean 发送通知的方式。
* *选择 "Generate Private Seq Number and Accessor"(生成私有序列号和存取方法)。*将生成一些代码以处理必须添加到发送的每个通知的唯一序列号值。
@@ -235,7 +235,7 @@
您可以看到在 ``AnagramsStats`` MBean 类中生成了实现 ``NotificationEmitter`` 接口所需的代码。您可以查看生成的实现如何将通知处理委托到 ``NotificationBroadcasterSupport`` 类。
-[start=12]
+
. 保存所做的更改。
在本练习中,您了解了如何使用 JMX 向导模块将属性、操作和发出的通知添加到 MBean 中。现已完成使用所需基础结构填充 MBean 以公开需要的管理信息所需执行的步骤。现在,您需要将内部逻辑添加到 ``AnagramsStats`` MBean 类实现中,然后在 MBean 与 Anagram Game 应用程序之间构建桥。
@@ -261,7 +261,7 @@
}
----
-[start=3]
+
. 您还需要添加将执行以下操作的某种实现代码:
* 计算用户解决最后一个 Anagram 所用的思考时间,
* 计算最短和最长的思考时间,
@@ -348,10 +348,10 @@
``com.toy.anagrams.ui`` 包中的 ``Anagrams`` 类是 Anagram Game 应用程序的 ``主`` 类。此文件将在编辑器的设计视图中打开,因为 ``Anagrams`` 类也是用户界面类。
-[start=2]
+
. 单击 "Editor"(编辑器)窗口顶部的 "Source"(源)按钮以便在 "Source"(源)视图中编辑该类。
-[start=3]
+
. 将以下空的 ``initManagement()`` 私有方法添加到 ``Anagrams`` 类中: ``Anagrams`` 构造函数后。
[source,java]
@@ -367,7 +367,7 @@
}
----
-[start=4]
+
. 将以下对 ``initManagement()`` 方法的调用添加到 ``Anagrams`` 类构造函数结尾,在标记该构造函数结尾的结束花括号之前。
[source,java]
@@ -389,7 +389,7 @@
image:images/jmx-initmanagement-sm.png[role="left", link="images/jmx-initmanagement.png"]
--
-[start=5]
+
. 现在,我们使用 JMX 模块 MBean 注册向导将 MBean 注册代码添加到 ``initManagement()`` 方法中:
在 ``Anagrams.java`` 源代码编辑器窗口中,在 ``initManagement()`` 方法主体*内部*右键单击,选择 "JMX" 子菜单,然后选择 "Generate MBean Registration..."(生成 MBean 注册...)操作。在显示的 "Instantiate and Register MBean"(实例化并注册 MBean)面板中,保持 "Register Existing MBean"(注册现有 MBean)单选按钮为选中状态,单击 "Browse"(浏览)按钮,选择 ``AnagramsStats`` MBean 类,然后在 "Browse"(浏览)面板中单击 "OK"(确定)。此时您应该会看到:
@@ -415,7 +415,7 @@
因此,您需要对 ``Anagrams.java`` 文件的代码进行以下更改。
-[start=6]
+
. 将以下私有字段添加到 ``Anagrams`` 类中。
[source,java]
@@ -426,7 +426,7 @@
----
-[start=7]
+
. 通过修改生成的 MBean 注册代码,初始化对 ``initManagement()`` 方法中 ``AnagramsStats`` MBean 的引用,使其如下所示:
[source,java]
@@ -443,7 +443,7 @@
}
----
-[start=8]
+
. 初始化 ``AnagramsStats`` MBean 状态:当 Anagrams Game 应用程序启动时,将立即显示一个 anagram,因此我们需要向 MBean 传递 anagram 字符串值并开始计算思考时间。在 ``initManagement()`` 方法结尾处复制并粘贴以下行:
[source,java]
@@ -466,7 +466,7 @@
您现在需要添加代码以跟踪用户的 anagram 解决体验。
-[start=9]
+
. 找到 ``nextTrialActionPerformed()`` 方法,然后将以下代码粘贴到 ``nextTrialActionPerformed()`` 方法的结尾处。
[source,java]
@@ -482,7 +482,7 @@
每次向用户提供新的 Anagram 时,该代码就会告知 MBean 是哪一个 Anagram 并开始对用户思考时间进行计数。
-[start=10]
+
. 找到 ``guessedWordActionPerformed()`` 方法并将以下行添加到代码中。保存所做的更改。
[source,java]
@@ -531,30 +531,30 @@
*注:*当 Java 监视和管理控制台尝试连接到 Anagram Game 进程时,您可能会在此控制台中看到 "Connection Failed"(连接失败)警告。对于本教程,当系统提示您授权连接时,您可以单击 "Insecure"(不安全)。
-[start=2]
+
. 在 JConsole 窗口中选择 "MBean" 标签。
-[start=3]
+
. 在左侧窗格的树布局中,展开 ``com.toy.anagrams.mbeans`` 下的所有节点。
image::images/jmx-jconsole-mbeans1.png[title="显示 "AnagramsStats" 节点的 "MBean" 标签"]
-[start=4]
+
. 选择 "Notifications"(通知)节点,然后单击底部的 "Subscribe"(订阅)按钮,这样在 Anagram 每次得到解决时 JConsole 都将会收到新通知。
-[start=5]
+
. 在 "Anagrams Game" 窗口中,解决前三个或前四个 Anagram。
Anagram 的解决方案(abstraction、ambiguous、arithmetic、backslash...)包含在 ``WordLibrary`` 类中。
-[start=6]
+
. 在 "JConsole" 窗口中,注意它收到了关于每个解决方案的通知。
[.feature]
--
image::images/jmx-jconsole-mbeans2-sm.png[role="left", link="images/jmx-jconsole-mbeans2.png"]
--
-[start=7]
+
. 单击 "Attributes"(属性)节点,可以看到更新了属性值:
image::images/jmx-jconsole-mbeans3.png[title="显示 "AnagramsStats" 节点的 "MBean" 标签"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/junit-intro.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/junit-intro.asciidoc
index ce0e264..7360d19 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/junit-intro.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/junit-intro.asciidoc
@@ -67,7 +67,7 @@
--
-[start=4]
+
. Copy the classes ``Utils.java`` and ``Vectors.java`` in the JUnitSampleSol project and paste them into the ``sample`` source package in JUnit-Sample.
If you look at the source code for the classes, you can see that ``Utils.java`` has three methods ( ``computeFactorial`` , ``concatWords`` , and ``normalizeWord`` ) and that ``Vectors.java`` has two methods ( ``equal`` and ``scalarMultiplication`` ). The next step is to create test classes for each class and write some test cases for the methods.
@@ -92,10 +92,10 @@
When you change the name of the test class, you will see a warning about changing the name. The default name is based on the name of the class you are testing, with the word Test appended to the name. For example, for the class ``MyClass.java`` , the default name of the test class is ``MyClassTest.java`` . Usually it is best to keep the default name, but for this tutorial you will change the name because you will also create JUnit 4 tests in the same package and the names of the test classes must be unique.
-[start=3]
+
. Select JUnit in the Framework dropdown list.
-[start=4]
+
. Deselect Test Initializer and Test Finalizer. Click OK.
[.feature]
--
@@ -103,7 +103,7 @@
--
-[start=5]
+
. Select JUnit 3.x in the Select JUnit Version dialog box.
[.feature]
--
@@ -181,7 +181,7 @@
----
-[start=3]
+
. Now add some assertions to test the method.
[source,java]
@@ -200,7 +200,7 @@
This test method uses the JUnit ``assertEquals`` method. To use the assertion, you supply the input variables and the expected result. To pass the test, the test method must successfully return all the expected results based on the supplied variables when running the tested method. You should add a sufficient number of assertions to cover the various possible permutations.
-[start=4]
+
. Modify the test skeleton for ``testEqual`` by deleting the generated method bodies and adding the following ``println`` .
[source,java]
@@ -221,7 +221,7 @@
----
-[start=5]
+
. Modify the ``testEqual`` method by adding the following assertions (displayed in bold).
[source,java]
@@ -252,7 +252,7 @@
This test uses the JUnit ``assertTrue`` and ``assertFalse`` methods to test a variety of possible results. For the test of this method to pass, the ``assertTrue`` must all be true and ``assertFalse`` must all be false.
-[start=6]
+
. Save your changes.
Compare: <<Exercise_32,Writing Test Methods for ``Vectors.java`` (JUnit 4)>>
@@ -309,7 +309,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. Add a ``println`` statement to display text about the test in the JUnit Test Results window.
[source,java]
@@ -340,10 +340,10 @@
};
}*
-[start=3]
+
. Fix your imports to import ``java.util.concurrent.TimeoutException`` .
-[start=4]
+
. Add the following code (displayed in bold) to the method to interrupt the thread and display a message if the test takes too long to execute.
[source,java]
@@ -368,7 +368,7 @@
You can modify the ``Thread.sleep`` line to change the number of milliseconds before the timeout is thrown.
-[start=5]
+
. Add the following ``println`` (displayed in bold) to print the text about the test in the JUnit Test Results window.
[source,java]
@@ -396,7 +396,7 @@
}
}*
-[start=2]
+
. Add the following ``println`` (displayed in bold) to print the text about the test in the JUnit Test Results window.
[source,java]
@@ -422,7 +422,7 @@
The test method ``testTemporarilyDisabled`` will run if you run the test class.
-[start=3]
+
. Prepend ``DISABLED_`` (displayed in bold) to the name of the test method.
[source,java]
@@ -484,10 +484,10 @@
When you change the name of the test class, you will see a warning about changing the name. The default name is based on the name of the class you are testing, with the word Test appended to the name. For example, for the class ``MyClass.java`` , the default name of the test class is ``MyClassTest.java`` . Unlike JUnit 3, in JUnit 4, test are not required to end with the word Test. Usually it is best to keep the default name, but because you are creating all the JUnit tests in the same package in this tutorial the names of the test classes have to be unique.
-[start=3]
+
. Select JUnit in the Framework dropdown list.
-[start=4]
+
. Deselect Test Initializer and Test Finalizer. Click OK.
[.feature]
--
@@ -495,7 +495,7 @@
--
-[start=5]
+
. Select JUnit 4.x in the Select JUnit Version dialog box. Click Select.
[.feature]
--
@@ -556,7 +556,7 @@
NOTE: When writing tests it is not necessary to change the printed output. You do this in this exercise so that it is easier to identify the test results in the output window.
-[start=3]
+
. Now add some assertions to test the method.
[source,java]
@@ -576,13 +576,13 @@
In this test method you use the JUnit ``assertEquals`` method. To use the assertion, you supply the input variables and the expected result. To pass the test, the test method must successfully return all the expected results based on the supplied variables when running the tested method. You should add a sufficient number of assertions to cover the various possible permutations.
-[start=4]
+
. Change the name of the ``testEqual`` test method to ``equalsCheck`` .
-[start=5]
+
. Delete the the generated method body of the ``equalsCheck`` test method.
-[start=6]
+
. Add the following ``println`` to the ``equalsCheck`` test method.*System.out.println("* VectorsJUnit4Test: equalsCheck()");*
The test method should now look like the following:
@@ -598,7 +598,7 @@
----
-[start=7]
+
. Modify the ``equalsCheck`` method by adding the following assertions (displayed in bold).
[source,java]
@@ -702,7 +702,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. Add a ``println`` statement to display text about the test in the JUnit Test Results window.
[source,java]
@@ -730,7 +730,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=3]
+
. Add the following code (displayed in bold) to set the timeout and to interrupt the thread if the method takes too long to execute.
[source,java]
@@ -744,7 +744,7 @@
You can see that the timeout is set to 1000 milliseconds.
-[start=4]
+
. Add the following ``println`` (displayed in bold) to print the text about the test in the JUnit Test Results window.
[source,java]
@@ -771,7 +771,7 @@
}*
-[start=2]
+
. Add the following property (displayed in bold) to the ``@Test`` annotation to specify that the test is expected to throw ``IllegalArgumentException`` .
[source,java]
@@ -785,7 +785,7 @@
----
-[start=3]
+
. Add the following ``println`` (displayed in bold) to print the text about the test in the JUnit Test Results window.
[source,java]
@@ -815,7 +815,7 @@
The test method ``temporarilyDisabledTest`` will run if you run the test class.
-[start=3]
+
. Add the ``@Ignore`` annotation (displayed in bold) above ``@Test`` to disable the test.*@Ignore*
[source,java]
@@ -829,7 +829,7 @@
----
-[start=4]
+
. Fix your imports to import ``org.junit.Ignore`` .
Compare: <<Exercise_245,Disabling a Test (JUnit 3)>>
@@ -899,7 +899,7 @@
----
-[start=6]
+
. Modify the ``suite()`` method to add the test classes that will be run as part of the suite.
[source,java]
@@ -918,7 +918,7 @@
----
-[start=7]
+
. Save your changes.
=== Creating JUnit 4 Test Suites
diff --git a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ja.asciidoc
index 5dddaef..9ffee16 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ja.asciidoc
@@ -84,19 +84,19 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「チェックアウトするフォルダ」パネルで、「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/java/JUnitSampleSol*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します。「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=6]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
@@ -113,7 +113,7 @@
3. *JUnitSampleSol*プロジェクトを開き(まだ開いていない場合)、「プロジェクト」ウィンドウで「ソース・パッケージ」ノードを展開します。
image::images/projects-window.png[title="「プロジェクト」ウィンドウ内のJUnit-SampleおよびJUnitSampleSolプロジェクト"]
-[start=4]
+
. JUnitSampleSolプロジェクト内のクラス ``Utils.java`` と ``Vectors.java`` をコピーし、それらをJUnit-Sample内の ``sample`` ソース・パッケージに貼り付けます。
クラスのソース・コードを見ると、 ``Utils.java`` に3つのメソッド( ``computeFactorial`` 、 ``concatWords`` 、および ``normalizeWord`` )があり、 ``Vectors.java`` に2つのメソッド( ``equal`` および ``scalarMultiplication`` )があることがわかります。次の手順では、各クラス用のテスト・クラスを作成し、メソッド用にいくつかのテスト・クラスを記述します。
@@ -140,14 +140,14 @@
テスト・クラスの名前を変更するときは、名前が変更されることを警告するメッセージが表示されます。デフォルト名は、テスト対象のクラス名をベースに、末尾に「Test」を追加したものです。たとえば、 ``MyClass.java`` クラスの場合、テスト・クラスのデフォルト名は「 ``MyClassTest.java`` 」です。通常はデフォルト名をそのまま使用するのが最適ですが、このチュートリアルでは、JUnit 4テストも同じパッケージ内に作成し、テスト・クラスの名前は一意にする必要があるため、名前を変更します。
-[start=3]
+
. 「フレームワーク」ドロップダウン・リストで「JUnit」を選択します。
-[start=4]
+
. 「テスト初期化」および「テスト終了」を選択解除します。「OK」をクリックします。
image::images/junit3-vectors-createtests.png[title="「JUnitのバージョンを選択」ダイアログ・ボックス"]
-[start=5]
+
. 「JUnitのバージョンを選択」ダイアログ・ボックスで「JUnit 3.x」を選択します。
image::images/junit3-select-version.png[title="「JUnitのバージョンを選択」ダイアログ・ボックス"]
@@ -221,7 +221,7 @@
}
----
-[start=3]
+
. ここで、メソッドをテストするためのアサーションを追加します。
[source,java]
@@ -240,7 +240,7 @@
このテスト・メソッドでは、JUnitの ``assertEquals`` メソッドが使用されます。アサーションを使用するには、入力変数と、期待する結果を指定します。テストに合格するには、テスト済メソッドを実行したときに、テスト・メソッドが供給した変数に基づいて、期待されるすべての結果を正常に返す必要があります。様々な考えられる並べ替えを実行するため、十分な数のアサーションを追加するようにしてください。
-[start=4]
+
. 生成されたメソッド本体を削除し、次の ``println`` を追加することによって、 ``testEqual`` のテスト・スケルトンを変更します。
[source,java]
@@ -260,7 +260,7 @@
}
----
-[start=5]
+
. 次のアサーションを追加することによって ``testEqual`` メソッドを変更します(太字部分が変更箇所)。
[source,java]
@@ -291,7 +291,7 @@
このテストはJUnitの ``assertTrue`` メソッドと ``assertFalse`` メソッドを使用して、考えられる様々な結果をテストします。このメソッドのテストに合格するには、 ``assertTrue`` がすべてtrue、 ``assertFalse`` がすべてfalseである必要があります。
-[start=6]
+
. 変更を保存します。
比較: <<Exercise_32, ``Vectors.java`` 用のテスト・メソッドの記述(JUnit 4)>>
@@ -356,7 +356,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. テストに関するテキストを「JUnitテスト結果」ウィンドウに表示するため、 ``println`` 文を追加します。
[source,java]
@@ -388,10 +388,10 @@
};
}*
-[start=3]
+
. ``java.util.concurrent.TimeoutException`` をインポートするために、インポートを修正します。
-[start=4]
+
. テストの実行に時間がかかりすぎる場合にスレッドが割込みされてメッセージが表示されるように、次のコード(太字で表示)をメソッドに追加します。
[source,java]
@@ -416,7 +416,7 @@
タイム・アウトがスローされる前にミリ秒の数字を変更するには、 ``Thread.sleep`` 行を変更します。
-[start=5]
+
. テストに関するテキストを「JUnitテスト結果」ウィンドウに出力するには、次の ``println`` (太字で表示)を追加します。
[source,java]
@@ -445,7 +445,7 @@
}
}*
-[start=2]
+
. テストに関するテキストを「JUnitテスト結果」ウィンドウに出力するには、次の ``println`` (太字で表示)を追加します。
[source,java]
@@ -472,7 +472,7 @@
テスト・クラスを実行すると、テスト・メソッド ``testTemporarilyDisabled`` が実行されます。
-[start=3]
+
. テスト・メソッドの名前の先頭に ``DISABLED_`` (太字で表示)を付加します。
[source,java]
@@ -539,14 +539,14 @@
テスト・クラスの名前を変更するときは、名前が変更されることを警告するメッセージが表示されます。デフォルト名は、テスト対象のクラス名をベースに、末尾に「Test」を追加したものです。たとえば、 ``MyClass.java`` クラスの場合、テスト・クラスのデフォルト名は「 ``MyClassTest.java`` 」です。JUnit 3とは異なり、JUnit 4ではテスト名の末尾に「Test」を付ける必要はありません。通常はデフォルト名をそのまま使用するのが最適ですが、このチュートリアルでは、すべてのJUnitテストを同じパッケージ内に作成するため、テスト・クラスの名前は一意にします。
-[start=3]
+
. 「フレームワーク」ドロップダウン・リストで「JUnit」を選択します。
-[start=4]
+
. 「テスト初期化」および「テスト終了」を選択解除します。「OK」をクリックします。
image::images/junit4-vectors-createtests.png[title="JUnit 4の「テストを作成」ダイアログ・ボックス"]
-[start=5]
+
. 「JUnitのバージョンを選択」ダイアログ・ボックスで「JUnit 4.x」を選択します。「選択」をクリックします。
image::images/junit4-select-version.png[title="「JUnitのバージョンを選択」ダイアログ・ボックス"]
@@ -604,7 +604,7 @@
*注意:*テストを記述する際に、プリントされた出力を変更する必要はありません。これはこの課題で行うため、テスト結果を出力ウィンドウで確認しやすくなります。
-[start=3]
+
. ここで、メソッドをテストするためのアサーションを追加します。
[source,java]
@@ -624,13 +624,13 @@
このテスト・メソッドでは、JUnit ``assertEquals`` メソッドを使用します。アサーションを使用するには、入力変数と、期待する結果を指定します。テストに合格するには、テスト済メソッドを実行したときに、テスト・メソッドが供給した変数に基づいて、期待されるすべての結果を正常に返す必要があります。様々な考えられる並べ替えを実行するため、十分な数のアサーションを追加するようにしてください。
-[start=4]
+
. ``testEqual`` テスト・メソッドの名前を ``equalsCheck`` に変更します。
-[start=5]
+
. ``equalsCheck`` テスト・メソッドの生成されたメソッドの本文を削除します。
-[start=6]
+
. 次の ``println`` を ``equalsCheck`` テスト・メソッドに追加します。*System.out.println("* VectorsJUnit4Test: equalsCheck()");*
テスト・メソッドは次のようになるはずです。
@@ -645,7 +645,7 @@
}
----
-[start=7]
+
. 次のアサーション(太字で表示)を追加することによって、 ``equalsCheck`` メソッドを変更します。
[source,java]
@@ -757,7 +757,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. テストに関するテキストを「JUnitテスト結果」ウィンドウに表示するため、 ``println`` 文を追加します。
[source,java]
@@ -786,7 +786,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=3]
+
. タイム・アウトを設定し、メソッドの実行に時間がかかりすぎる場合にスレッドが割込みされるようにするには、次のコード(太字で表示)を追加します。
[source,java]
@@ -800,7 +800,7 @@
タイム・アウトが1000ミリ秒に設定されていることがわかります。
-[start=4]
+
. テストに関するテキストを「JUnitテスト結果」ウィンドウに出力するには、次の ``println`` (太字で表示)を追加します。
[source,java]
@@ -827,7 +827,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=2]
+
. テストが ``IllegalArgumentException`` をスローするように指定するには、次のプロパティ(太字で表示)を ``@Test`` 注釈に追加します。
[source,java]
@@ -840,7 +840,7 @@
}
----
-[start=3]
+
. テストに関するテキストを「JUnitテスト結果」ウィンドウに出力するには、次の ``println`` (太字で表示)を追加します。
[source,java]
@@ -871,7 +871,7 @@
テスト・クラスを実行すると、テスト・メソッド ``temporarilyDisabledTest`` が実行されます。
-[start=3]
+
. テストを無効にするには、 ``@Test`` の上に ``@Ignore`` 注釈(太字で表示)を追加します。*@Ignore*
[source,java]
@@ -884,7 +884,7 @@
}
----
-[start=4]
+
. ``org.junit.Ignore`` をインポートするために、インポートを修正します。
比較: <<Exercise_245,テストの無効化(JUnit 3)>>
@@ -958,7 +958,7 @@
}
----
-[start=6]
+
. ``suite()`` メソッドを変更して、このスイートの一部として実行されるテスト・クラスを追加します。
[source,java]
@@ -976,7 +976,7 @@
}
----
-[start=7]
+
. 変更を保存します。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_pt_BR.asciidoc
index dcf9c72..de5056f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_pt_BR.asciidoc
@@ -84,19 +84,19 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. No painel Pastas para Checkout, clique em Procurar para abrir a caixa de diálogo Procurar Pastas do Repositório.
-[start=4]
+
. Expanda o nó raiz e selecione *samples/java/JUnitSampleSol*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local dos códigos-fonte. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=6]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
Para saber mais sobre a instalação do Subversion, consulte a seção link:../ide/subversion.html#settingUp[+Configurando o Subversion+] no link:../ide/subversion.html[+Guia do Subversion no NetBeans IDE+].
@@ -113,7 +113,7 @@
3. Abra o projeto *JUnitSampleSol* (se já não estiver aberto) e expanda o nó Pacotes de código-fonte na janela Projetos.
image::images/projects-window.png[title="Projetos -junit Amostra e junitsamplesol na janela Projetos"]
-[start=4]
+
. Copie as classes ``Utils.java`` e ``Vectors.java`` no projeto JUnitSampleSol, e cole-as no pacote de código-fonte ``sample`` no JUnit-Sample.
Se você observar o código-fonte das classes, perceberá que ``Utils.java`` tem três métodos ( ``computeFactorial`` , ``concatWords`` e ``normalizeWord`` ) e que ``Vectors.java`` tem dois métodos ( ``equals`` e ``scalarMultiplication`` ). O próximo passo é criar classes de teste para cada classe e escrever alguns casos de teste para os métodos.
@@ -140,14 +140,14 @@
Quando você alterar o nome da classe de teste, será exibido uma advertência sobre a alteração do nome. O nome default é baseado no nome da classe que você está testando, com a palavra Teste acrescentada ao nome. Por exemplo, para a classe ``MyClass.java`` , o nome default da classe de teste é ``MyClassTest.java`` . Normalmente, é melhor manter o nome default, mas para a finalidade deste tutorial você mudará o nome porque também irá criar testes JUnit 4 no mesmo pacote e os nomes das classes de teste devem ser únicos.
-[start=3]
+
. Selecione JUnit na lista drop-down Framework.
-[start=4]
+
. Desmarque Inicializador de Teste e Finalizador de Teste. Clique em OK.
image::images/junit3-vectors-createtests.png[title="Selecione caixa de diálogo versão JUnit"]
-[start=5]
+
. Selecione JUnit 3.x na caixa de diálogo Versão da JUnit.
image::images/junit3-select-version.png[title="Selecione caixa de diálogo versão JUnit"]
@@ -221,7 +221,7 @@
}
----
-[start=3]
+
. Agora adicione algumas asserções para testar o método.
[source,java]
@@ -240,7 +240,7 @@
Este método de teste usa o método ``assertEquals`` da JUnit. Para usar a asserção, forneça as variáveis de entrada e o resultado esperado. Para passar no teste, o método de teste deve retornar de modo bem-sucedido todos os resultados esperados com base nas variáveis fornecidas durante a execução do método. Você deve adicionar um número suficiente de asserções para abranger as várias permutações possíveis.
-[start=4]
+
. Modifique o esqueleto de teste para ``testEqual`` deletando os corpos de método gerados e adicionando a seguinte ``println`` .
[source,java]
@@ -260,7 +260,7 @@
}
----
-[start=5]
+
. Modifique o método ``testEqual`` adicionando as seguintes asserções (exibidas em negrito).
[source,java]
@@ -291,7 +291,7 @@
O teste usa os métodos ``assertTrue`` e ``assertFalse`` da JUnit para testar vários resultados possíveis. Para que o teste deste método seja aprovado, o ``assertTrue`` deve ser totalmente verdadeiro e ``assertFalse`` deve ser totalmente falso.
-[start=6]
+
. Salve as alterações.
Compare: <<Exercise_32,Escrevendo Métodos de Teste para ``Vectors.java`` (JUnit 4)>>
@@ -356,7 +356,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. Adicione uma instrução ``println`` para exibir o texto sobre o teste na janela Resultados de Testes JUnit.
[source,java]
@@ -388,10 +388,10 @@
};
}*
-[start=3]
+
. Corrija suas importações para importar ``java.util.concurrent.TimeoutException`` .
-[start=4]
+
. Adicione o código a seguir (exibido em negrito) para que o método interrompa o thread e exiba uma mensagem se o teste levar muito tempo para ser executado.
[source,java]
@@ -416,7 +416,7 @@
Você pode modificar a linha ``Thread.sleep`` para alterar o número de milissegundos antes que o time-out seja lançado.
-[start=5]
+
. Adicione a seguinte ``println`` (exibida em negrito) para imprimir o texto sobre o teste na janela Resultados dos Testes JUnit.
[source,java]
@@ -445,7 +445,7 @@
}
}*
-[start=2]
+
. Adicione a seguinte ``println`` (exibida em negrito) para imprimir o texto sobre o teste na janela Resultados dos Testes JUnit.
[source,java]
@@ -472,7 +472,7 @@
O método de teste ``testTemporarilyDisabled`` será executado se você executar a classe de teste.
-[start=3]
+
. Acrescente o prefixo ``DISABLED_`` (exibido em negrito) ao nome do método de teste.
[source,java]
@@ -539,14 +539,14 @@
Quando você alterar o nome da classe de teste, será exibido uma advertência sobre a alteração do nome. O nome default é baseado no nome da classe que você está testando, com a palavra Teste acrescentada ao nome. Por exemplo, para a classe ``MyClass.java`` , o nome default da classe de teste é ``MyClassTest.java`` . Diferente da JUnit 3, na JUnit 4, o teste não precisa ser finalizado com a palavra Teste. Normalmente, é melhor manter o nome default, porém, como você está criando todos os testes da JUnit no mesmo pacote neste tutorial, os nomes das classes de teste devem ser exclusivos.
-[start=3]
+
. Selecione JUnit na lista drop-down Framework.
-[start=4]
+
. Desmarque Inicializador de Teste e Finalizador de Teste. Clique em OK.
image::images/junit4-vectors-createtests.png[title="Caixa de diálogo Criar Testes JUnit 4"]
-[start=5]
+
. Selecione a JUnit 4.x na caixa de diálogo Selecionar a Versão da JUnit. Clique em Selecionar.
image::images/junit4-select-version.png[title="Selecione caixa de diálogo versão JUnit"]
@@ -604,7 +604,7 @@
*Observação.* Ao escrever testes, não é necessário alterar a saída impressa. Isso é realizado neste exercício, portanto é mais fácil identificar os resultados de teste na janela de saída.
-[start=3]
+
. Agora adicione algumas asserções para testar o método.
[source,java]
@@ -624,13 +624,13 @@
Neste método de teste, você usa o método ``assertEquals`` da JUnit. Para usar a asserção, forneça as variáveis de entrada e o resultado esperado. Para passar no teste, o método de teste deve retornar de modo bem-sucedido todos os resultados esperados com base nas variáveis fornecidas durante a execução do método. Você deve adicionar um número suficiente de asserções para abranger as várias permutações possíveis.
-[start=4]
+
. Altere o nome do método de teste ``testEqual`` para ``equalsCheck`` .
-[start=5]
+
. Delete o corpo do método gerado do método de teste ``equalsCheck`` .
-[start=6]
+
. Adicione o seguinte ``println`` ao método de teste ``equalsCheck`` .*System.out.println("* VectorsJUnit4Test: equalsCheck()");*
O método de teste deve ser semelhante a:
@@ -645,7 +645,7 @@
}
----
-[start=7]
+
. Modifique o método ``equalsCheck`` adicionando as asserções a seguir (exibidas em negrito).
[source,java]
@@ -757,7 +757,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. Adicione uma instrução ``println`` para exibir o texto sobre o teste na janela Resultados de Testes JUnit.
[source,java]
@@ -786,7 +786,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=3]
+
. Adicione o código a seguir (exibido em negrito) para definir o time-out e para interromper o thread se o método demorar muito tempo para ser executado.
[source,java]
@@ -800,7 +800,7 @@
Você pode observar que o time-out foi definido como 1000 milissegundos.
-[start=4]
+
. Adicione a seguinte ``println`` (exibida em negrito) para imprimir o texto sobre o teste na janela Resultados dos Testes JUnit.
[source,java]
@@ -827,7 +827,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=2]
+
. Adicione a propriedade a seguir (exibida em negrito) à anotação ``@Test`` para especificar que se espera que o teste lance a ``IllegalArgumentException`` .
[source,java]
@@ -840,7 +840,7 @@
}
----
-[start=3]
+
. Adicione a seguinte ``println`` (exibida em negrito) para imprimir o texto sobre o teste na janela Resultados dos Testes JUnit.
[source,java]
@@ -871,7 +871,7 @@
O método de teste ``temporarilyDisabledTest`` será executado se você executar a classe de teste.
-[start=3]
+
. Adicione a anotação ``@Ignore`` (exibida em negrito) acima de ``@Test`` para desativar o teste.*@Ignore*
[source,java]
@@ -884,7 +884,7 @@
}
----
-[start=4]
+
. Corrija as importações para importar a ``org.junit.Ignore`` .
Compare: <<Exercise_245,Desativando um Teste (JUnit 3)>>
@@ -958,7 +958,7 @@
}
----
-[start=6]
+
. Modifique o método ``suite()`` para adicionar as classes de teste que serão executadas como parte do conjunto.
[source,java]
@@ -976,7 +976,7 @@
}
----
-[start=7]
+
. Salve as alterações.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ru.asciidoc
index 1e7f82e..ef17495 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_ru.asciidoc
@@ -84,19 +84,19 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. В папках на панели "Взятие для изменения" нажмите кнопку "Обзор", чтобы открыть диалоговое окно "Обзор папок репозитория".
-[start=4]
+
. Разверните корневой узел и выберите *samples/java/JUnitSampleSol*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=6]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
Дополнительные сведения об установке Subversion см. в разделе link:../ide/subversion.html#settingUp[+Настройка Subversion+] в link:../ide/subversion.html[+Руководстве по Subversion в IDE NetBeans+].
@@ -113,7 +113,7 @@
3. Откройте проект *JUnitSampleSol* (если он еще не открыт) и разверните узел "Пакеты исходных файлов" в окне проектов.
image::images/projects-window.png[title="Проекты JUnit-Sample и JUnitSampleSol в окне 'Проекты'"]
-[start=4]
+
. Скопируйте файлы классов ``Utils.java`` и ``Vectors.java`` из проекта JUnitSampleSol в пакет исходного кода ``sample`` в JUnit-Sample.
Если открыть исходный код этих классов, можно заметить, что класс ``Utils.java`` содержит три метода ( ``computeFactorial`` , ``concatWords`` и ``normalizeWord`` ), а класс ``Vectors.java`` — два ( ``equal`` ``scalarMultiplication`` ). В следующем действии будут созданы тестовые классы для каждого класса и написаны тестовые примеры для методов.
@@ -140,14 +140,14 @@
В результате изменения имени тестового класса появится предупреждение об изменении имени. Имя по умолчанию – это имя тестируемого класса с добавленным словом "Test". Например, для класса ``MyClass.java`` именем по умолчанию тестового класса будет ``MyClassTest.java`` . Рекомендуется сохранить имя по умолчанию, но в рамках данного руководства имя будет изменено, так как в этом же пакете будут созданы тесты JUnit 4, а имена тестовых классов должны быть различными.
-[start=3]
+
. В списке "Среда" выберите JUnit.
-[start=4]
+
. Снимите флажки "Test Initializer" и "Test Finalizer". Нажмите кнопку "ОК".
image::images/junit3-vectors-createtests.png[title="Диалоговое окно 'Выбрать версию JUnit'"]
-[start=5]
+
. В диалоговом окне "Select JUnit Version" выберите JUnit 3.x.
image::images/junit3-select-version.png[title="Диалоговое окно 'Выбрать версию JUnit'"]
@@ -221,7 +221,7 @@
}
----
-[start=3]
+
. Затем добавьте несколько подтверждений для тестирования метода.
[source,java]
@@ -240,7 +240,7 @@
В этом тестовом методе используется метод JUnit ``assertEquals`` . Для использования утверждения необходимо указать входные переменные и ожидаемый результат. Для успешного прохождения теста метод теста должен выдать все ожидаемые результаты на основе переменных, введенных при выполнении тестового метода. Для охвата возможных перестановок следует добавить достаточное количество утверждений.
-[start=4]
+
. Измените скелет теста для ``testEqual`` путем удаления созданных тел методов и добавления следующего ``println`` .
[source,java]
@@ -260,7 +260,7 @@
}
----
-[start=5]
+
. Измените метод ``testEqual`` путем добавления следующих утверждений (выделены полужирным шрифтом).
[source,java]
@@ -291,7 +291,7 @@
В этом тесте используются методы JUnit ``assertTrue`` и ``assertFalse`` для тестирования всех возможных результатов. Для успешного прохождения теста утверждения ``assertTrue`` должны быть истинными, а ``assertFalse`` – ложными.
-[start=6]
+
. Сохраните изменения.
Сравните: <<Exercise_32,Написание тестовых методов для ``Vectors.java`` (JUnit 4)>>
@@ -356,7 +356,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. Добавьте оператор ``println`` для вывода на экран текста о тесте в окне "JUnit Test Results".
[source,java]
@@ -388,10 +388,10 @@
};
}*
-[start=3]
+
. Исправьте операторы импорта для импорта ``java.util.concurrent.TimeoutException`` .
-[start=4]
+
. Добавьте к методу следующий код (выделен полужирным шрифтом) для прерывания потока выполнения и вывода на экран сообщения в случае слишком долгого выполнения теста.
[source,java]
@@ -416,7 +416,7 @@
Можно изменить строку ``Thread.sleep`` для изменения количества миллисекунд до выдачи тайм-аута.
-[start=5]
+
. Добавьте следующий код ``println`` (выделен полужирным шрифтом) для отображения текста о тесте в окне "JUnit Test Results".
[source,java]
@@ -445,7 +445,7 @@
}
}*
-[start=2]
+
. Добавьте следующий код ``println`` (выделен полужирным шрифтом) для отображения текста о тесте в окне "JUnit Test Results".
[source,java]
@@ -472,7 +472,7 @@
При выполнении тестового класса будет выполнен тестовый метод ``testTemporarilyDisabled`` .
-[start=3]
+
. Введите ``DISABLED_`` (выделено полужирным шрифтом) перед именем тестового метода.
[source,java]
@@ -539,14 +539,14 @@
В результате изменения имени тестового класса появится предупреждение об изменении имени. Имя по умолчанию – это имя тестируемого класса с добавленным словом "Test". Например, для класса ``MyClass.java`` именем по умолчанию тестового класса будет ``MyClassTest.java`` . В отличие от JUnit 3, в JUnit 4 добавление слова "Test" к имени теста не обязательно. Рекомендуется сохранить имя по умолчанию, но так как в рамках данного руководства все тесты JUnit создаются в одном пакете, имена тестовых классов должны быть различны.
-[start=3]
+
. В списке "Среда" выберите JUnit.
-[start=4]
+
. Снимите флажки "Test Initializer" и "Test Finalizer". Нажмите кнопку "ОК".
image::images/junit4-vectors-createtests.png[title="Диалоговое окно 'Создать тесты для JUnit 4'"]
-[start=5]
+
. В диалоговом окне "Select JUnit Version" выберите JUnit 4.x. Нажмите кнопку "Выбрать".
image::images/junit4-select-version.png[title="Диалоговое окно 'Выбрать версию JUnit'"]
@@ -604,7 +604,7 @@
*Примечание.* При написании тестов изменять результат вывода не требуется. В этом упражнении это выполнено для упрощения идентификации результатов тестирования в окне вывода.
-[start=3]
+
. Затем добавьте несколько подтверждений для тестирования метода.
[source,java]
@@ -624,13 +624,13 @@
В этом тестовом методе используется метод JUnit ``assertEquals`` . Для использования утверждения необходимо указать входные переменные и ожидаемый результат. Для успешного прохождения теста метод теста должен выдать все ожидаемые результаты на основе переменных, введенных при выполнении тестового метода. Для охвата возможных перестановок следует добавить достаточное количество утверждений.
-[start=4]
+
. Измените имя тестового метода с ``testEqual`` на ``equalsCheck`` .
-[start=5]
+
. Удалите созданное тело тестового метода ``equalsCheck`` .
-[start=6]
+
. Добавьте следующий метод ``println`` в тестовый метод ``equalsCheck`` .*System.out.println("* VectorsJUnit4Test: equalsCheck()");*
Тестовый метод в результате должен выглядеть следующим образом:
@@ -645,7 +645,7 @@
}
----
-[start=7]
+
. Измените метод ``equalsCheck`` путем добавления следующих утверждений (выделены полужирным шрифтом).
[source,java]
@@ -757,7 +757,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. Добавьте оператор ``println`` для вывода на экран текста о тесте в окне "JUnit Test Results".
[source,java]
@@ -786,7 +786,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=3]
+
. Добавьте следующий код (выделен полужирным шрифтом) для определения тайм-аута и прерывания потока выполнения в случае слишком долгого выполнения метода.
[source,java]
@@ -800,7 +800,7 @@
Как видно в примере, для тайм-аута установлено значение 1000 миллисекунд.
-[start=4]
+
. Добавьте следующий код ``println`` (выделен полужирным шрифтом) для отображения текста о тесте в окне "JUnit Test Results".
[source,java]
@@ -827,7 +827,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=2]
+
. Добавьте следующее свойство (выделено полужирным шрифтом) в аннотацию ``@Test`` для определения необходимости выдачи ``IllegalArgumentException`` в результате выполнения теста.
[source,java]
@@ -840,7 +840,7 @@
}
----
-[start=3]
+
. Добавьте следующий код ``println`` (выделен полужирным шрифтом) для отображения текста о тесте в окне "JUnit Test Results".
[source,java]
@@ -871,7 +871,7 @@
При выполнении тестового класса будет выполнен тестовый метод ``temporarilyDisabledTest`` .
-[start=3]
+
. Для отключения теста добавьте аннотацию ``@Ignore`` (выделена полужирным шрифтом) над ``@Test`` .*@Ignore*
[source,java]
@@ -884,7 +884,7 @@
}
----
-[start=4]
+
. Исправьте операторы импорта для импорта ``org.junit.Ignore`` .
Сравните: <<Exercise_245,Отключение теста (JUnit 3)>>
@@ -958,7 +958,7 @@
}
----
-[start=6]
+
. Измените метод ``suite()`` , чтобы добавить тестовые классы, которые будут запускать часть набора тестов.
[source,java]
@@ -976,7 +976,7 @@
}
----
-[start=7]
+
. Сохраните изменения.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_zh_CN.asciidoc
index e478ad3..e9b8658 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/junit-intro_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/junit-intro_zh_CN.asciidoc
@@ -84,19 +84,19 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 在 "Folders to Checkout"(要检出的文件夹)面板中,单击 "Browse"(浏览),以打开 "Browse Repository Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点,然后选择 *samples/java/JUnitSampleSol*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的 "Local Folder"(本地文件夹)。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=6]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
@@ -113,7 +113,7 @@
3. 在 "Projects"(项目)窗口中,打开 *JUnitSampleSol* 项目(如果尚未打开),然后展开 "Source Packages"(源包)节点。
image::images/projects-window.png[title=""Projects"(项目)窗口中的 JUnit-Sample 和 JUnitSampleSol 项目"]
-[start=4]
+
. 复制 JUnitSampleSol 项目中的 ``Utils.java`` 和 ``Vectors.java`` 类,然后将其粘贴到 JUnit-Sample 的 ``sample`` 源包中。
如果查看这些类的源代码,则可以看到 ``Utils.java`` 包含三个方法( ``computeFactorial`` 、 ``concatWords`` 和 ``normalizeWord`` ),而 ``Vectors.java`` 包含两个方法( ``equal`` 和 ``scalarMultiplication`` )。接下来,为各类创建测试类并为这些方法编写一些测试用例。
@@ -140,14 +140,14 @@
更改测试类的名称之后,您将看到一个关于修改名称的警告。默认名称基于要测试的类名,并在该名称后面附加单词 Test。举例来说,对于 ``MyClass.java`` 类,测试类的默认名称为 ``MyClassTest.java`` 。通常,最好是保留默认名称,但是在教程中您将更改该名称,因为您还将在相同的包中创建 JUnit 4 测试,并且测试类的名称必须是惟一的。
-[start=3]
+
. 在 "Framework"(框架)下拉列表中选择 "JUnit"。
-[start=4]
+
. 取消选中 "Test Initializer"(测试初始化函数)和 "Test Finalizer"(测试终结方法)。单击 "OK"(确定)。
image::images/junit3-vectors-createtests.png[title="选择 "JUnit version"(JUnit 版本)对话框"]
-[start=5]
+
. 在 "Select JUnit Version"(选择 JUnit 版本)对话框中,选择 "JUnit 3.x"。
image::images/junit3-select-version.png[title="选择 "JUnit version"(JUnit 版本)对话框"]
@@ -221,7 +221,7 @@
}
----
-[start=3]
+
. 现在,添加一些断言来测试方法。
[source,java]
@@ -240,7 +240,7 @@
该测试方法使用 JUnit ``assertEquals`` 方法。要使用断言,您需要提供输入变量和预期的结果。在运行被测试的方法时,要通过测试,测试方法必须根据提供的变量成功返回所有预期的结果。您应该添加足够数量的断言来涵盖各种可能的排列。
-[start=4]
+
. 修改 ``testEqual`` 的测试框架:删除生成的方法主体并添加以下 ``println`` 。
[source,java]
@@ -260,7 +260,7 @@
}
----
-[start=5]
+
. 修改 ``testEqual`` 方法:添加以下断言(显示为粗体)。
[source,java]
@@ -291,7 +291,7 @@
此方法使用 JUnit ``assertTrue`` 和 ``assertFalse`` 方法来测试各种可能的结果。要通过此方法的测试, ``assertTrue`` 必须全部为 true,并且 ``assertFalse`` 必须全部为 false。
-[start=6]
+
. 保存所做的更改。
比较:<<Exercise_32,为 ``Vectors.java`` 编写测试方法(JUnit 4)>>
@@ -356,7 +356,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. 添加一个 ``println`` 语句,用于在 "JUnit Test Results"(JUnit 测试结果)窗口中显示关于测试的文本。
[source,java]
@@ -388,10 +388,10 @@
};
}*
-[start=3]
+
. 修复导入,以导入 ``java.util.concurrent.TimeoutException`` 。
-[start=4]
+
. 在方法中添加以下代码(显示为粗体),其作用是当测试任务的执行时间过长时中断线程并显示一条消息。
[source,java]
@@ -416,7 +416,7 @@
在抛出超时之前,您可以通过修改 ``Thread.sleep`` 代码行来更改毫秒数。
-[start=5]
+
. 添加以下 ``println`` (显示为粗体),用于在 "JUnit Test Results"(JUnit 测试结果)窗口中输出关于测试的文本。
[source,java]
@@ -445,7 +445,7 @@
}
}*
-[start=2]
+
. 添加以下 ``println`` (显示为粗体),用于在 "JUnit Test Results"(JUnit 测试结果)窗口中输出关于测试的文本。
[source,java]
@@ -472,7 +472,7 @@
测试方法 ``testTemporarilyDisabled`` 将在您运行测试类时运行。
-[start=3]
+
. 将 ``DISABLED_`` (显示为粗体)置于测试方法的名称之前。
[source,java]
@@ -539,14 +539,14 @@
更改测试类的名称之后,您将看到一个关于修改名称的警告。默认名称基于要测试的类名,并在该名称后面附加单词 Test。举例来说,对于 ``MyClass.java`` 类,测试类的默认名称为 ``MyClassTest.java`` 。与 JUnit 3 不同,在 JUnit 4 中,测试不需要以单词 Test 结尾。通常,最好是保留默认名称,但由于在本教程中您将在相同的包中创建所有 JUnit 测试,因此测试类的名称必须是惟一的。
-[start=3]
+
. 在 "Framework"(框架)下拉列表中选择 "JUnit"。
-[start=4]
+
. 取消选中 "Test Initializer"(测试初始化函数)和 "Test Finalizer"(测试终结方法)。单击 "OK"(确定)。
image::images/junit4-vectors-createtests.png[title="JUnit 4 "Create Tests"(创建测试)对话框"]
-[start=5]
+
. 在 "Select JUnit Version"(选择 JUnit 版本)对话框中,选择 "JUnit 4.x"。单击 "Select"(选择)。
image::images/junit4-select-version.png[title="选择 "JUnit version"(JUnit 版本)对话框"]
@@ -604,7 +604,7 @@
*注:*在编写测试时,不需要更改打印的输出。在本练习中,其作用是能够更加轻松地识别输出窗口中的测试结果。
-[start=3]
+
. 现在,添加一些断言来测试方法。
[source,java]
@@ -624,13 +624,13 @@
在此测试方法中,您使用了 JUnit ``assertEquals`` 方法。要使用断言,您需要提供输入变量和预期的结果。在运行被测试的方法时,要通过测试,测试方法必须根据提供的变量成功返回所有预期的结果。您应该添加足够数量的断言来涵盖各种可能的排列。
-[start=4]
+
. 将 ``testEqual`` 测试方法的名称更改为 ``equalsCheck`` 。
-[start=5]
+
. 删除 ``equalsCheck`` 测试方法的已生成方法主体。
-[start=6]
+
. 将以下 ``println`` 添加到 ``equalsCheck`` 测试方法中。*System.out.println("* VectorsJUnit4Test: equalsCheck()");*
现在,测试方法应如下所示:
@@ -645,7 +645,7 @@
}
----
-[start=7]
+
. 修改 ``equalsCheck`` 方法:添加以下断言(显示为粗体)。
[source,java]
@@ -757,7 +757,7 @@
assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
}*
-[start=3]
+
. 添加一个 ``println`` 语句,用于在 "JUnit Test Results"(JUnit 测试结果)窗口中显示关于测试的文本。
[source,java]
@@ -786,7 +786,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=3]
+
. 添加以下代码(显示为粗体),用于设置超时并在方法执行时间过长时中断线程。
[source,java]
@@ -800,7 +800,7 @@
可以看到,超时被设置为 1000 毫秒。
-[start=4]
+
. 添加以下 ``println`` (显示为粗体),用于在 "JUnit Test Results"(JUnit 测试结果)窗口中输出关于测试的文本。
[source,java]
@@ -827,7 +827,7 @@
System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
}*
-[start=2]
+
. 在 ``@Test`` 标注中添加以下属性(显示为粗体),指定测试应该抛出 ``IllegalArgumentException`` 。
[source,java]
@@ -840,7 +840,7 @@
}
----
-[start=3]
+
. 添加以下 ``println`` (显示为粗体),用于在 "JUnit Test Results"(JUnit 测试结果)窗口中输出关于测试的文本。
[source,java]
@@ -871,7 +871,7 @@
测试方法 ``temporarilyDisabledTest`` 将在您运行测试类时运行。
-[start=3]
+
. 在 ``@Test`` 上方添加 ``@Ignore`` 标注(显示为粗体)来禁用测试。*@Ignore*
[source,java]
@@ -884,7 +884,7 @@
}
----
-[start=4]
+
. 修复导入,以导入 ``org.junit.Ignore`` 。
比较:<<Exercise_245,禁用测试(JUnit 3)>>
@@ -958,7 +958,7 @@
}
----
-[start=6]
+
. 修改 ``suite()`` 方法,以添加要作为套件的一部分运行的测试类。
[source,java]
@@ -976,7 +976,7 @@
}
----
-[start=7]
+
. 保存所做的更改。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se.asciidoc
index 3e2aead..0915ccb 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se.asciidoc
@@ -72,7 +72,7 @@
When you click OK the IDE will run a script to create the Sakila database and populate the database tables. You can see the results of running the script in the Output window. A node for the Sakila database is also added under the MySQL Server node.
-[start=5]
+
. Right-click the Sakila node and choose Connect.
When you click Connect, a database connection node for the Sakila database ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` ) is listed under the Databases node. When a connection is open you can view the data in the database by expanding the connection node.
@@ -88,7 +88,7 @@
You can use the Maven version bundled with the IDE or specify the location of a local Maven installation (requires 2.0.9 or newer).
-[start=4]
+
. Click OK to close the Options window.
*Notes.*
@@ -135,16 +135,16 @@
2. Select Java Application from the Maven category. Click Next.
image::images/maven-project-wizard.png[title="Maven Archetypes in New Project wizard"]
-[start=3]
+
. Type *DVDStoreAdmin* for the project name and set the project location.
-[start=4]
+
. Modify the default Group Id and Version (optional).
The Group Id and Version will be used as the coordinates for the artifact in your local repository when you build the project.
-[start=5]
+
. Click Finish.
When you click finish the IDE creates the Maven project and opens the project in the Projects window. The IDE automatically creates the class ``App.java`` in the ``com.mycompany.dvdstoreadmin`` package. You can delete ``App.java`` because the application does not need it.
@@ -202,10 +202,10 @@
4. In the dialog box, select the ``hibernate.show_sql`` property and set the value to ``true`` . Click OK. This enables the debug logging of the SQL statements.
image::images/add-property-showsql.png[title="Add Hibernate Property dialog box showing setting value for the hibernate.show_sql property"]
-[start=5]
+
. Click Add under the Miscellaneous Properties node and select ``hibernate.query.factory_class`` in the Property Name dropdown list.
-[start=6]
+
. Type *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* in the text field. Click OK.
*Note.* Do not select the value from the drop-down list.
@@ -231,7 +231,7 @@
</hibernate-configuration>
----
-[start=7]
+
. Save your changes to the file.
When you run your project you will be able to see the SQL query printed in the IDE's Output window.
@@ -312,19 +312,19 @@
When you delete the default text, the text field will collapse. You can resize the text field later to adjust the alignment of the form elements.
-[start=4]
+
. Drag a Label element from the Palette and change the text to *Last Name*.
-[start=5]
+
. Drag a Text Field element next to the Last Name label and delete the default text.
-[start=6]
+
. Drag a Button element from the Palette and change the text to *Query*.
-[start=7]
+
. Drag a Table element from the Palette into the form.
-[start=8]
+
. Modify the Variable Name values of the following UI elements according to the values in the following table.
You can modify the Variable Name value of an element by right-clicking the element in the Design view and then choosing Change Variable Name. Alternatively, you can change the Variable Name directly in the Inspector window.
@@ -343,13 +343,13 @@
|Table | ``resultTable``
|===
-[start=9]
+
. Resize the text fields and align the form elements.
You can enable the Horizontal Resizable property for the text fields to ensure that the text fields resize with the window and that the spacing between elements remains constant.
-[start=10]
+
. Save your changes.
In Design view your form should look similar to the following image.
@@ -369,20 +369,20 @@
When you click Build, the IDE will download the necessary artifacts to your local Maven repository.
-[start=2]
+
. Expand the ``<default package>`` source package node under the Other Sources node in the Projects window.
-[start=3]
+
. Right-click ``hibernate.cfg.xml`` and choose Run HQL Query to open the HQL Editor.
-[start=4]
+
. Test the connection by typing ``from Actor`` in the HQL Query Editor. Click the Run HQL Query button ( image::images/run_hql_query_16.png[title="Run HQL Query button"] ) in the toolbar.
When you click Run HQL Query you should see the query results in the bottom pane of the HQL Query Editor.
image::images/hib-query-hqlresults.png[title="HQL Query Editor showing HQL query results"]
-[start=5]
+
. Type the following query in the HQL Query Editor and click Run HQL Query to check the query results when the search string is 'PE'.
[source,java]
@@ -402,7 +402,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. Open a new HQL Query Editor tab and type the following query in the editor pane. Click Run HQL Query.
[source,java]
@@ -436,7 +436,7 @@
It is possible to copy the queries from the HQL Query Editor tabs into the file and then modify the code.
-[start=3]
+
. Add the following methods to create the query based on the user input string.
[source,java]
@@ -454,7 +454,7 @@
The methods call a method called ``executeHQLQuery()`` and create the query by combining the query string with the user entered search string.
-[start=4]
+
. Add the ``executeHQLQuery()`` method.
[source,java]
@@ -477,16 +477,16 @@
The ``executeHQLQuery()`` method calls Hibernate to execute the selected query. This method makes use of the ``HibernateUtil.java`` utility class to obtain the Hibernate Session.
-[start=5]
+
. Fix your imports to add import statements for the Hibernate libraries ( ``org.hibernate.Query`` , ``org.hibernate.Session`` ) and ``java.util.List`` .
-[start=6]
+
. Create a Query button event handler by switching to the Design view and double-clicking the Query button.
The IDE creates the ``queryButtonActionPerformed`` method and displays the method in the Source view.
-[start=7]
+
. Modify the ``queryButtonActionPerformed`` method in the Source view by adding the following code so that a query is run when the user clicks the button.
[source,java]
@@ -501,7 +501,7 @@
}
----
-[start=8]
+
. Add the following method to display the results in the JTable.
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=9]
+
. Fix your imports (Ctrl+Shift+I) to add ``java.util.Vector`` and save your changes.
After you save the form you can run the project.
@@ -552,7 +552,7 @@
image::images/browse-main-class.png[title="Setting the main class in the Browse Main Classes dialog"]
-[start=4]
+
. Click Run Project in the main toolbar to launch the application.
When you invoke the Run action on a Maven project in the IDE, the IDE runs the Maven goals associated with the Run action. The IDE has default goals bound to IDE actions according to the project packaging. You can view the goals bound to the Run action in the Actions pane of the project's Properties window
@@ -578,22 +578,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repostiory Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/java/DVDStoreAdmin-Maven*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
*Notes.*
@@ -622,17 +622,17 @@
}
----
-[start=4]
+
. Generate the getters and setters for the fields by placing the insertion cursor in the source editor, typing Alt-Insert and then selecting Getter and Setter.
-[start=5]
+
. In the Generate Getters and Setters dialog box, select all the fields and click Generate.
image::images/getters-setters.png[title="Generate Getters and Setters dialog box"]
In the Generate Getters and Setters dialog box, you can use the Up arrow on the keyboard to move the selected item to the Actor node and then press the Space bar to select all fields in Actor.
-[start=6]
+
. Fix your imports and save your changes.
After you create the POJO for the table you will want to create an Hibernate Mapping File for ``Actor.java`` .
@@ -655,7 +655,7 @@
</hibernate-configuration>
----
-[start=6]
+
. Map the fields in ``Actor.java`` to the columns in the ACTOR table by making the following changes (in bold) to ``Actor.hbm.xml`` .
[source,xml]
@@ -694,7 +694,7 @@
</hibernate-mapping>
----
-[start=7]
+
. Click the Validate XML button in the toolbar and save your changes.
Creating individual POJOs and Hibernate mapping files might be a convenient way to further customize your application.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ja.asciidoc
index 155fb8c..c1f8124 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ja.asciidoc
@@ -80,7 +80,7 @@
「OK」をクリックすると、Sakilaデータベースを作成し、データベース表を生成するためのスクリプトがIDEによって実行されます。スクリプトを実行した結果は、「出力」ウィンドウで確認できます。「MySQLサーバー」ノードの下にSakilaデータベースのノードも追加されます。
-[start=5]
+
. 「Sakila」ノードを右クリックし、「接続」を選択します。
「接続」をクリックすると、Sakilaデータベースのデータベース接続ノード( ``jdbc:mysql://localhost:3306/sakila [デフォルトの_ユーザー名_]`` )が「データベース」ノードの下に一覧表示されます。接続が開いたら、接続ノードを展開してデータベースのデータを表示できます。
@@ -97,7 +97,7 @@
IDEにバンドルされているMavenバージョンを使用することも、ローカルのMavenインストール(2.0.9以降が必要)の場所を指定することもできます。
-[start=4]
+
. 「OK」をクリックして「オプション」ウィンドウを閉じます。
*注意:*
@@ -147,16 +147,16 @@
2. 「Maven」カテゴリから「Javaアプリケーション」を選択します。「次」をクリックします。
image::images/maven-project-wizard.png[title="新規プロジェクト・ウィザードでのMaven原型"]
-[start=3]
+
. プロジェクト名に「*DVDStoreAdmin*」と入力し、プロジェクトの場所を設定します。
-[start=4]
+
. デフォルトの「グループID」と「バージョン」を変更します(オプション)。
プロジェクトのビルド時に、ローカル・リポジトリのアーティファクトのコーディネートとして「グループID」と「バージョン」が使用されます。
-[start=5]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEがMavenプロジェクトを作成し、そのプロジェクトが「プロジェクト」ウィンドウで開きます。IDEでは、 ``com.mycompany.dvdstoreadmin`` パッケージに ``App.java`` クラスが自動的に作成されます。アプリケーションでは必要ないため、 ``App.java`` は削除してかまいません。
@@ -218,10 +218,10 @@
4. このダイアログ・ボックスで、「 ``hibernate.show_sql`` 」プロパティを選択し、値を「 ``true`` 」に設定します。「OK」をクリックします。これにより、SQL文のデバッグ・ロギングが有効になります。
image::images/add-property-showsql.png[title="hibernate.show_sqlプロパティの設定値が表示された「Hibernateのプロパティの追加」ダイアログ・ボックス"]
-[start=5]
+
. 「その他のプロパティ」ノードの下にある「追加」をクリックし、「プロパティ名」ドロップダウン・リストで「 ``hibernate.query.factory_class`` 」を選択します。
-[start=6]
+
. テキスト・フィールドに*org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory*を入力します。「OK」をクリックします。
*注意:*ドロップダウン・リストから値を選択しないでください。
@@ -247,7 +247,7 @@
</hibernate-configuration>
----
-[start=7]
+
. 変更内容をファイルに保存します。
プロジェクトを実行すると、IDEの出力ウィンドウにSQL問合せが表示されます。
@@ -335,19 +335,19 @@
デフォルトのテキストを削除すると、テキスト・フィールドが縮小されます。テキスト・フィールドは、フォーム要素の位置を調整するために、後でサイズ変更できます。
-[start=4]
+
. 「ラベル」要素をパレットからドラッグし、「*姓*」のテキストを変更します。
-[start=5]
+
. 「テキスト・フィールド」要素を「姓」ラベルの隣にドラッグし、デフォルトのテキストを削除します。
-[start=6]
+
. 「ボタン」要素をパレットからドラッグし、テキストを「*問合せ*」に変更します。
-[start=7]
+
. 「表」要素をパレットからフォームにドラッグします。
-[start=8]
+
. 次のUI要素の「変数名」の値を、次の表の値に従って変更します。
要素の「変数名」の値は、その要素を「デザイン」ビューの中で右クリックし、「変数名を変更」を選択することで変更できます。または、「変数名」を「インスペクタ」ウィンドウで直接変更することもできます。
@@ -366,13 +366,13 @@
|表 | ``resultTable``
|===
-[start=9]
+
. テキスト・フィールドのサイズを変更し、フォーム要素の位置揃えを行います。
テキスト・フィールドの「水平方向にサイズ変更可能」プロパティを有効にして、要素間のスペースを維持したまま、テキスト・フィールドをウィンドウにあわせてサイズ変更することができます。
-[start=10]
+
. 変更を保存します。
デザイン・ビューのフォームは、次のイメージのような外観になります。
@@ -393,20 +393,20 @@
「ビルド」をクリックすると、IDEによって、必要なアーティファクトがローカルMavenリポジトリにダウンロードされます。
-[start=2]
+
. 「プロジェクト」ウィンドウの「その他のソース」ノードの下にある、 ``<デフォルト・パッケージ>`` ソース・パッケージ・ノードを展開します。
-[start=3]
+
. 「 ``hibernate.cfg.xml`` 」を右クリックし、「HQL問合せの実行」を選択してHQL問合せエディタを開きます。
-[start=4]
+
. HQL問合せエディタに「 ``from Actor`` 」と入力して、接続をテストします。ツールバーの「HQL問合せの実行」ボタン(image::images/run_hql_query_16.png[title="「HQL問合せの実行」ボタン"])をクリックします。
「HQL問合せの実行」をクリックすると、問合せ結果がHQL問合せエディタの下のペインに表示されるはずです。
image::images/hib-query-hqlresults.png[title="HQL問合せ結果が表示されたHQL問合せエディタ"]
-[start=5]
+
. 検索文字列が「PE」の場合、次の問合せをHQL問合せエディタに入力して「HQL問合せの実行」をクリックし、問合せ結果を確認します。
[source,java]
@@ -426,7 +426,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. 新しいHQL問合せエディタのタブを開き、次の問合せをエディタ・ペインに入力します。「HQL問合せの実行」をクリックします。
[source,java]
@@ -461,7 +461,7 @@
問合せをHQL問合せエディタのタブからファイルにコピーし、コードを変更できます。
-[start=3]
+
. 次のメソッドを追加し、ユーザー入力文字列に基づく問合せを作成します。
[source,java]
@@ -479,7 +479,7 @@
このメソッドは、 ``executeHQLQuery()`` というメソッドをコールし、問合せ文字列をユーザーが入力した検索文字列と組み合せて問合せを作成します。
-[start=4]
+
. ``executeHQLQuery()`` メソッドを追加します。
[source,java]
@@ -502,16 +502,16 @@
``executeHQLQuery()`` メソッドは、Hibernateをコールして、選択した問合せを実行します。このメソッドは、 ``HibernateUtil.java`` ユーティリティ・クラスを使用してHibernateセッションを取得します。
-[start=5]
+
. Hibernateライブラリ( ``org.hibernate.Query`` 、 ``org.hibernate.Session`` )と ``java.util.List`` に対するインポート文を追加するように、インポートを修正します。
-[start=6]
+
. デザイン・ビューに切り替えて「問合せ」ボタンをダブルクリックすることで、「問合せ」ボタン・イベント・ハンドラを作成します。
IDEで ``queryButtonActionPerformed`` メソッドが作成され、このメソッドがソース・ビューに表示されます。
-[start=7]
+
. ユーザーがボタンをクリックすると問合せが実行されるように、ソース・ビューの ``queryButtonActionPerformed`` メソッドに次のコードを追加して変更します。
[source,java]
@@ -526,7 +526,7 @@
}
----
-[start=8]
+
. 次のメソッドを追加し、結果がJTableに表示されるようにします。
[source,java]
@@ -553,7 +553,7 @@
}
----
-[start=9]
+
. ``java.util.Vector`` を追加するようにインポートを修正し([Ctrl]-[Shift]-[I])、変更内容を保存します。
フォームの保存後、プロジェクトを実行できます。
@@ -578,7 +578,7 @@
image::images/browse-main-class.png[title="「メイン・クラスの参照」ダイアログでのメイン・クラスの設定"]
-[start=4]
+
. メイン・ツールバーの「プロジェクトの実行」をクリックし、アプリケーションを起動します。
IDEのMavenプロジェクトで「実行」アクションを呼び出すと、IDEは「実行」アクションに関連付けられたMavenゴールを実行します。IDEには、プロジェクトのパッケージに応じてIDEのアクションにバインドされたデフォルトのゴールがあります。プロジェクトの「プロパティ」ウィンドウの「アクション」ペインで、「実行」アクションにバインドされたゴールを表示できます。
@@ -605,22 +605,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/java/DVDStoreAdmin-Maven*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
*注意:*
@@ -650,17 +650,17 @@
}
----
-[start=4]
+
. フィールドに対する取得メソッドと設定メソッドは、挿入カーソルをソース・エディタに置き、[Alt]-[Insert]を押して「取得メソッドおよび設定メソッド」を選択することで生成します。
-[start=5]
+
. 「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスですべてのフィールドを選択し、「生成」をクリックします。
image::images/getters-setters.png[title="「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックス"]
「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスでは、キーボードの[↑]を使用して、選択した項目を「Actor」ノードまで移動してから、[Space]バーを押してActor内のすべてのフィールドを選択できます。
-[start=6]
+
. インポートを修正して変更内容を保存します。
表のためのPOJOの作成後、 ``Actor.java`` のHibernateマッピング・ファイルを作成します。
@@ -683,7 +683,7 @@
</hibernate-configuration>
----
-[start=6]
+
. 次の太字部分の変更を ``Actor.hbm.xml`` に加えて、 ``Actor.java`` のフィールドをACTOR表の列にマップします。
[source,xml]
@@ -722,7 +722,7 @@
</hibernate-mapping>
----
-[start=7]
+
. ツールバーの「XMLの検証」ボタンをクリックし、変更内容を保存します。
POJOとHibernateのマッピング・ファイルを個別に作成すると、アプリケーションをさらにカスタマイズするときに役立つ場合があります。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_pt_BR.asciidoc
index a77507a..4e707ad 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_pt_BR.asciidoc
@@ -82,7 +82,7 @@
Quando você clica em OK, o IDE executa um script para criar o banco de dados Sakila e preencher as tabelas do banco de dados. Você pode ver o resultado da execução do script na janela de Saída. É adicionado também um nó para o banco de dados Sakila sob o nó do Servidor MySQL.
-[start=5]
+
. Clique com o botão direito do mouse no nó do Sakila e escolha Conectar.
Quando você clica em Conectar, um nó de conexão do banco de dados do banco de dados Sakila ( ``jdbc:mysql://localhost:3306/sakila [_nome de usuário_ em Default]`` ) será listado abaixo do nó Bancos de Dados. Quando uma conexão for aberta, você poderá exibir os dados no banco de dados ampliando o nó de conexão.
@@ -99,7 +99,7 @@
Você pode usar a versão do Maven incorporada no IDE ou especificar a localização de uma instalação local do Maven (requer versão 2.0.9 ou posterior).
-[start=4]
+
. Clique em OK para fechar a janela Opções.
*Observações.*
@@ -149,16 +149,16 @@
2. Selecione Aplicação Java na categoria Maven. Clique em Próximo.
image::images/maven-project-wizard.png[title="Arquétipos do Maven no assistente Novo Projeto"]
-[start=3]
+
. Insira *DVDStoreAdmin* como nome do projeto e defina a sua localização.
-[start=4]
+
. Modifique o ID de Grupo default e a Versão (opcional).
O ID de Grupo e a Versão serão utilizadas como as coordenadas para o artefato em seu repositório local quando o projeto for construído.
-[start=5]
+
. Clique em Finalizar.
Quando você clicar em Finalizar, o IDE criará o projeto Maven e abrirá o projeto na janela Projetos. O IDE cria automaticamente a classe ``App.java`` no pacote ``com.mycompany.dvdstoreadmin`` . É possível deletar o ``App.java`` porque ele não é necessário para a aplicação.
@@ -220,10 +220,10 @@
4. Na caixa de diálogo, selecione a propriedade ``hibernate.show_sql`` e defina o valor para ``true`` . Clique em OK. Isso ativa o log de depuração das instruções SQL.
image::images/add-property-showsql.png[title="Caixa de diálogo Adicionar Propriedade Hibernate que mostra o valor de definição de hibernate.show_sql"]
-[start=5]
+
. Clique em Adicionar no nó Propriedades Diversas e selecione ``hibernate.query.factory_class`` na lista drop-down Nome da Propriedade.
-[start=6]
+
. Digite *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* no campo de texto. Clique em OK.
*Observação.* Não selecione o valor na lista drop-down.
@@ -249,7 +249,7 @@
</hibernate-configuration>
----
-[start=7]
+
. Salve as alterações feitas no arquivo.
Quando você executar seu projeto, poderá visualizar a consulta SQL impressa na janela de Saída do IDE.
@@ -337,19 +337,19 @@
Quando o texto default for deletado, o campo de texto é será contraído. É possível redimensionar o campo de texto em outro momento ao ajustar o alinhamento dos elementos do form.
-[start=4]
+
. Arraste um elemento Label da Paleta e altere o texto para *Sobrenome*.
-[start=5]
+
. Arraste um elemento Campo de texto para perto do label Sobrenome e delete o texto default.
-[start=6]
+
. Arraste um elemento de Botão da Paleta e altere o texto para *Consulta*.
-[start=7]
+
. Arraste um elemento Tabela da Paleta para dentro do form.
-[start=8]
+
. Modifique os valores do Nome da Variável dos seguintes elementos da UI de acordo com os valores na tabela a seguir.
Você pode modificar o valor do Nome da Variável de um elemento clicando com o botão direito do mouse no elemento na view Design e, em seguida, escolhendo Alterar Nome da Variável. De modo alternativo, você pode alterar o Nome da Variável diretamente na janela Inspetor.
@@ -368,13 +368,13 @@
|Tabela | ``resultTable``
|===
-[start=9]
+
. Redimensione os campos de texto e alinhe os elementos do form.
É possível ativar a propriedade Redimensionável na Horizontal dos campos de texto para garantir que os campos de texto sejam redimensionados com a janela e que o espaçamento entre os elementos permaneçam constantes.
-[start=10]
+
. Salve as alterações.
Na view Design, seu form deve parecer com a imagem a seguir.
@@ -395,20 +395,20 @@
Quando você clica em Compilar, o IDE submete a download os artefatos necessários para seu repositório Maven local.
-[start=2]
+
. Expanda o nó do pacote de código-fonte ``<pacote default>`` sob o nó Outros Códigos-fonte na janela Projetos.
-[start=3]
+
. Clique com o botão direito do mouse em ``hibernate.cfg.xml`` e escolha Executar Consulta HQL para abrir o Editor HQL.
-[start=4]
+
. Teste a conexão inserindo ``from Actor`` no Editor de Consultas HQL. Clique no botão Executar Consulta HQL ( image::images/run_hql_query_16.png[title="Botão Executar Consulta HQL"] ) na barra de ferramentas.
Quando você clicar em Executar Consulta HQL, deverá visualizar os resultados da consulta no painel inferior do Editor de Consultas HQL.
image::images/hib-query-hqlresults.png[title="Hql Editor de Consulta mostrando resultados da consulta HQL"]
-[start=5]
+
. Digite a consulta a seguir no Editor de Consultas HQL e clique em Executar consulta HQL para verificar os resultados da consulta quando a string de pesquisa for "PE".
[source,java]
@@ -428,7 +428,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. Abra uma nova guia do Editor de Consulta HQL e insira a consulta a seguir no painel do editor. Clique em Executar Consulta HQL.
[source,java]
@@ -463,7 +463,7 @@
É possível copiar as consultas das guias do Editor de Consulta HQL para o campo e, em seguida, modificar o código.
-[start=3]
+
. Adicione os métodos a seguir para criar a consulta com base na string de entrada do usuário.
[source,java]
@@ -481,7 +481,7 @@
Esses métodos chamam o método ``executeHQLQuery()`` e cria a consulta combinando a string de consulta com o usuário que inseriu a string de pesquisa.
-[start=4]
+
. Adicione o método ``executeHQLQuery()`` .
[source,java]
@@ -504,16 +504,16 @@
O método ``executeHQLQuery()`` chama o Hibernate para executar a consulta selecionada. Esse método usa a classe de utilitário ``HibernateUtil.java`` para obter a Sessão Hibernate.
-[start=5]
+
. Corrija suas importações e adicione instruções para as bibliotecas Hibernate ( ``org.hibernate.Query`` , ``org.hibernate.Session`` ) e ``java.util.List`` .
-[start=6]
+
. Crie um handler de eventos do botão Consulta alternando para a view Design e clicando duas vezes no botão Consulta.
O IDE cria o método ``queryButtonActionPerformed`` e exibe o método na view Código-fonte.
-[start=7]
+
. Modifique o método ``queryButtonActionPerformed`` na view Código-fonte adicionando o código a seguir de modo que uma consulta seja executada quando o usuário clicar no botão.
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=8]
+
. Adicione o método a seguir para exibir os resultados na JTable.
[source,java]
@@ -555,7 +555,7 @@
}
----
-[start=9]
+
. Corrija as importações (Ctrl+Shift+I) para adicionar o ``java.util.Vector`` e salve as alterações.
Depois de salvar o form, você pode executar o projeto.
@@ -580,7 +580,7 @@
image::images/browse-main-class.png[title="Definindo a Classe Principal na caixa de diálogo Procurar Classes Principais"]
-[start=4]
+
. Clique em Executar Projeto principal na barra de ferramentas principal para iniciar a aplicação.
Quando a ação Executar é chamada em um projeto Maven no IDE, o IDE executa os objetivos Maven associados com a ação Executar. O IDE possui objetivos default vinculados às ações do IDE de acordo com o pacote do projeto. É possível exibir os objetivos vinculados à ação Executar no painel Ações da janela Propriedades do projeto
@@ -607,22 +607,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar nas Pastas do Repositório:
-[start=4]
+
. Expanda o nó-raiz e selecione *samples/java/DVDStoreAdmin-Maven*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
*Observações.*
@@ -652,17 +652,17 @@
}
----
-[start=4]
+
. Gere os getters e setters para os campos colocando o cursor de inserção no editor de código-fonte, digitando Alt-Insert e, em seguida, selecionando Getter e Setter.
-[start=5]
+
. Na caixa de diálogo Gerar Getters e Setters, selecione todos os campos e clique em Gerar.
image::images/getters-setters.png[title="Caixa de diálogo Gerar Getters e Setters"]
Na caixa de diálogo Gerar Getters e Setters, você pode usar a seta para cima no teclado para mover o item selecionado para o nó Ator e pressionar a barra de espaços para selecionar todos os campos em Ator.
-[start=6]
+
. Corrija as importações e salve as alterações.
Depois de criar o POJO para a tabela, você desejará criar um arquivo de mapeamento do Hibernate para ``Actor.java`` .
@@ -685,7 +685,7 @@
</hibernate-configuration>
----
-[start=6]
+
. Associe os campos ``Actor.java`` às colunas na tabela ACTOR fazendo as seguintes alterações (em negrito) no ``Actor.hbm.xml`` .
[source,xml]
@@ -724,7 +724,7 @@
</hibernate-mapping>
----
-[start=7]
+
. Clique no botão Validar XML na barra de ferramentas e salve as alterações.
A criação de POJOs individuais e arquivos de mapeamento do Hibernate pode ser um modo conveniente de personalizar ainda mais sua aplicação.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ru.asciidoc
index 79894a5..76c1e37 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_ru.asciidoc
@@ -82,7 +82,7 @@
При нажатии клавиши OК среда IDE запустит сценарий, который создаст базу данных Sakila и заполнит ее таблицы. Результаты работы сценария можно увидеть в окне "Результаты". В серверный узел MySQL будет добавлен подузел для базы данных Sakila.
-[start=5]
+
. Щелкните правой кнопкой мыши узел "Sakila" и выберите "Connect".
При нажатии кнопки "Подключиться" узел подключения к базе данных "Sakila" ( ``jdbc:mysql://localhost:3306/sakila [по умолчанию: _username_]`` ) появится под узлом "Базы данных". При открытом подключении для просмотра данных в базе данных разверните этот узел подключения.
@@ -99,7 +99,7 @@
Можно использовать версию Maven, входящую в комплект среды IDE, либо указать местоположение локальной установки Maven (требуется версия 2.0.9 или более поздняя).
-[start=4]
+
. Для закрытия окна "Параметры" нажмите кнопку "ОК".
*Примечания.*
@@ -149,16 +149,16 @@
2. Выберите приложение Java из категорий Maven. Нажмите кнопку "Далее".
image::images/maven-project-wizard.png[title="Архетипы Maven в мастере создания проектов"]
-[start=3]
+
. Введите *DVDStoreAdmin* в качестве имени проекта и укажите местоположение проекта.
-[start=4]
+
. Измените указанные по умолчанию значения для "Group Id" и "Version" (необязательно).
Значения "Group Id" и "Version" используются в качестве координат артефакта в локальном репозитории при создании проекта.
-[start=5]
+
. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" проект Maven будет создан в среде IDE и открыт в окне "Проекты". Среда IDE автоматически создает класс ``App.java`` в пакете ``com.mycompany.dvdstoreadmin`` . Вы можете удалить этот класс ( ``App.java`` ), поскольку он не требуется приложению для работы.
@@ -220,10 +220,10 @@
4. В диалоговом окне выберите свойство ``hibernate.show_sql`` и установите значение ``true`` . Нажмите кнопку "ОК". Это приведет ко включению протоколирования отладки операторов SQL.
image::images/add-property-showsql.png[title="Диалоговое окно 'Добавить свойство Hibernate', в котором отображаются значения настроек для свойства hibernate.show_sql"]
-[start=5]
+
. Щелкните "Добавить" в узле "Различные свойства" и выберите ``hibernate.query.factory_class`` в раскрывающемся списке "Имя свойства".
-[start=6]
+
. Введите *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory* в текстовое поле. Нажмите кнопку "ОК".
*Примечание.* Не выбирайте значение из раскрывающегося списка.
@@ -249,7 +249,7 @@
</hibernate-configuration>
----
-[start=7]
+
. Сохраните измененный файл.
После запуска приложения появится возможность просмотра запроса SQL, представленного в окне "Output" среды IDE.
@@ -337,19 +337,19 @@
При удалении текста по умолчанию текстовое поле сворачивается. Позже можно будет изменить размер текстового поля для настройки выравнивания элементов формы.
-[start=4]
+
. Перетащите элемент "Label" с палитры и измените текст на *Last Name*.
-[start=5]
+
. Перетащите элемент "Text Field", поместите его рядом с меткой "Last Name" и удалите текст по умолчанию.
-[start=6]
+
. Перетащите элемент "Button" с палитры и измените текст на *Query*.
-[start=7]
+
. Перетащите элемент "Table" с палитры в форму.
-[start=8]
+
. Измените значения "Variable Name" следующих элементов пользовательского интерфейса в соответствии со значениями, приведенными в следующей таблице.
Вы можете изменить значение 'Имя переменной' для элемента, щелкнув правой кнопкой мыши элемент в представлении конструктора и выбрав 'Изменить имя переменной'. Кроме того, значение "Variable Name" можно изменить непосредственно в окне "Inspector".
@@ -368,13 +368,13 @@
|Таблица | ``resultTable``
|===
-[start=9]
+
. Измените размер текстового поля и выровняйте элементы формы.
Можно активировать свойство "Переменная ширина" для текстовых полей, чтобы обеспечить изменение размера текстовых полей вместе с окном и идентичность расстояний между элементами.
-[start=10]
+
. Сохраните изменения.
В режиме проектирования внешний вид формы выглядит так, как показано на следующем рисунке.
@@ -395,20 +395,20 @@
При нажатии кнопки "Сборка" IDE загрузит необходимые артефакты в локальный репозиторий Maven.
-[start=2]
+
. Раскройте узел исходного пакета ``<default package>`` в узле "Другие исходные файлы" окна "Проекты".
-[start=3]
+
. Щелкните правой кнопкой мыши файл ``hibernate.cfg.xml`` и выберите "Run HQL Query" для открытия редактора HQL Editor.
-[start=4]
+
. Протестируйте подключение путем ввода ``from Actor`` в редакторе запросов HQL Query Editor. Нажмите кнопку 'Выполнить запрос HQL' ( image::images/run_hql_query_16.png[title="Кнопка 'Выполнить запрос HQL'"] ) на панели инструментов.
При нажатии кнопки "Run HQL Query" результаты запроса должны отображаться в нижней области редактора запросов HQL Query Editor.
image::images/hib-query-hqlresults.png[title="Редактор запросов HQL с отображением результатов запроса HQL"]
-[start=5]
+
. Введите следующий запрос в редактор запросов HQL Query Editor и нажмите кнопку "Выполнить запрос HQL" для проверки результатов запроса при вводе значения "PE" в строку поиска.
[source,java]
@@ -428,7 +428,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. Откройте новую вкладку редактора HQL Query Editor и введите следующий запрос на панели редактирования. Нажмите кнопку "Run HQL Query".
[source,java]
@@ -463,7 +463,7 @@
Запросы можно скопировать из вкладок редактора запросов HQL Query Editor в файл, а затем изменить код.
-[start=3]
+
. Добавьте следующие методы для создания запроса на основе строки со вводимой пользователем информацией.
[source,java]
@@ -481,7 +481,7 @@
Эти методы обеспечивают вызов метода с именем ``executeHQLQuery()`` и создание запроса путем объединения строки запроса с информацией пользователя, вводимой в строку поиска.
-[start=4]
+
. Добавьте метод ``executeHQLQuery()`` .
[source,java]
@@ -504,16 +504,16 @@
Метод ``executeHQLQuery()`` обеспечивает вызов библиотеки Hibernate для выполнения выбранного запроса. В этом методе служебный класс ``HibernateUtil.java`` применяется для получения объекта Hibernate "Session".
-[start=5]
+
. Исправьте параметры импорта для добавления операторов импорта в библиотеки Hibernate ( ``org.hibernate.Query`` , ``org.hibernate.Session`` ) и ``java.util.List`` .
-[start=6]
+
. Создайте обработчик событий для кнопки "Query", переключившись в режим проектирования и дважды нажав кнопку "Query".
В среде IDE будет создан метод ``queryButtonActionPerformed`` , который затем отобразится в режиме просмотра исходного кода.
-[start=7]
+
. Измените метод ``queryButtonActionPerformed`` в режиме просмотра исходного кода путем добавления следующего кода, обеспечивающего выполнение запроса при нажатии кнопки пользователем.
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=8]
+
. Добавьте следующий метод для просмотра результатов в "JTable".
[source,java]
@@ -555,7 +555,7 @@
}
----
-[start=9]
+
. Исправьте параметры импорта (CTRL+SHIFT+I) для добавления ``java.util.Vector`` и сохраните измененные данные.
После сохранения формы можно запустить проект.
@@ -580,7 +580,7 @@
image::images/browse-main-class.png[title="Установка главного класса в диалоговом окне 'Обзор главных классов'"]
-[start=4]
+
. Нажмите кнопку "Run Project" на главной панели инструментов для запуска приложения.
При вызове в среде IDE в проекте Maven операции Run параметры Maven выполняются в среде IDE совместно с операцией Run. Среда IDE имеет цели по умолчанию, связанные с операциями IDE, соответствующими упаковке проекта. Связанные с операцией Run цели можно просмотреть на панели "Действия" окна "Свойства" проекта.
@@ -607,22 +607,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку "Обзор" для открытия диалогового окна "Обзор папок репозитория".
-[start=4]
+
. Разверните корневой узел и выберите *samples/java/DVDStoreAdmin-Maven*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечания.*
@@ -652,17 +652,17 @@
}
----
-[start=4]
+
. Создайте методы получения и установки для полей, поместив курсор вставки в редактор исходного кода и введя Alt-Insert, а затем выбрав Getter и Setter.
-[start=5]
+
. В диалоговом окне "Generate Getters and Setters" выберите все поля и нажмите кнопку "Generate".
image::images/getters-setters.png[title="Диалоговое окно 'Создание методов получения и установки'"]
В диалоговом окне "Generate Getters and Setters" можно использовать стрелку вверх на клавиатуре для перемещения выбранного элемента к узлу "Actor", а затем нажать клавишу "пробел" и выбрать все поля "Actor".
-[start=6]
+
. Исправьте операторы импорта и сохраните измененные данные.
После создания объекта POJO для таблицы необходимо создать файл сопоставления библиотеки Hibernate для класса ``Actor.java`` .
@@ -685,7 +685,7 @@
</hibernate-configuration>
----
-[start=6]
+
. Сопоставьте поля в ``Actor.java`` со столбцами в таблице "ACTOR" путем внесения следующих изменений (выделены полужирным шрифтом) в ``Actor.hbm.xml`` .
[source,xml]
@@ -724,7 +724,7 @@
</hibernate-mapping>
----
-[start=7]
+
. Нажмите кнопку "Validate XML" на панели инструментов и сохраните изменения.
Создание объектов POJO и файлов сопоставления библиотеки Hibernate может эффективно использоваться для дальнейшей настройки приложения.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_zh_CN.asciidoc
index 3e8ad9c..1fe84fd 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/maven-hib-java-se_zh_CN.asciidoc
@@ -80,7 +80,7 @@
单击 "OK"(确定)后,IDE 将运行脚本以创建 Sakila 数据库,并填充数据库表。您可以在 "Output"(输出)窗口中查看运行脚本的结果。此时,还会在 MySQL 服务器节点下方添加 Sakila 数据库的节点。
-[start=5]
+
. 右键单击 "Sakila" 节点,然后选择 "Connect"(连接)。
单击 "Connect"(连接)后,"Databases"(数据库)节点下面将列出 Sakila 数据库连接节点 ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` )。打开连接时,可通过展开该连接节点查看数据库中数据。
@@ -97,7 +97,7 @@
您可以使用与 IDE 捆绑在一起的 Maven 版本,也可以指定 Maven 在本地的安装位置(要求为 2.0.9 或更高版本)。
-[start=4]
+
. 选择 "OK"(确定)以关闭 "Options"(选项)窗口。
*注:*
@@ -147,16 +147,16 @@
2. 从 "Maven" 类别中选择 "Java Application"(Java 应用程序)。单击 "Next"(下一步)。
image::images/maven-project-wizard.png[title="新建项目向导中的 "Maven Archetypes"(Maven 原型)"]
-[start=3]
+
. 键入 *DVDStoreAdmin* 作为项目名称并设置项目位置。
-[start=4]
+
. 修改默认的组 ID 和版本(可选)。
构建项目时,组 ID 和版本将作为工件在本地资源库中的坐标使用。
-[start=5]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成)后,IDE 将创建 Maven 项目并在 "Projects"(项目)窗口中打开该项目。IDE 将自动在 ``com.mycompany.dvdstoreadmin`` 包中创建类 ``App.java`` 。您可以删除 ``App.java`` ,因为应用程序不需要使用该类。
@@ -218,10 +218,10 @@
4. 在此对话框中,选择 ``hibernate.show_sql`` 属性并将值设置为 ``true`` 。单击 "OK"(确定)。这将启用 SQL 语句的调试日志记录。
image::images/add-property-showsql.png[title="显示 hibernate.show_sql 属性的设置值的 "Add Hibernate Property"(添加 Hibernate 属性)对话框"]
-[start=5]
+
. 单击 "Miscellaneous Properties"(其他属性)节点下的 "Add"(添加),然后选择 "Property Name"(属性名称)下拉列表中的 ``hibernate.query.factory_class`` 。
-[start=6]
+
. 在文本字段中键入 *org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory*。单击 "OK"(确定)。
*注:*不要从下拉列表中选择值。
@@ -247,7 +247,7 @@
</hibernate-configuration>
----
-[start=7]
+
. 保存对该文件所做的更改。
运行项目时,您将能够在 IDE 的 "Output"(输出)窗口中看到输出的 SQL 查询。
@@ -335,19 +335,19 @@
删除默认文本后,文本字段将折叠起来。您可以稍后调整文本字段的大小,以调整窗体元素的对齐方式。
-[start=4]
+
. 从 "Palette"(组件面板)中拖出一个 "Label"(标签)元素,并将文本更改为 *Last Name*。
-[start=5]
+
. 拖放一个 "Text Field"(文本字段)元素到 "Last Name" 标签旁边,并删除默认文本。
-[start=6]
+
. 从 "Palette"(组件面板)中拖出一个 "Button"(按钮)元素,并将文本更改为 *Query*。
-[start=7]
+
. 从 "Palette"(组件面板)中拖放一个 "Table"(表)元素到窗体中。
-[start=8]
+
. 根据下表中的值更改以下 UI 元素的 "Variable Name"(变量名称)值。
您可以更改元素的 "Variable Name"(变量名称)值,方法是右键单击 "Design"(设计)视图中的元素并选择 "Change Variable Name"(更改变量名称)。或者,您可以直接在 "Inspector"(检查器)窗口中更改变量名称。
@@ -366,13 +366,13 @@
|表 | ``resultTable``
|===
-[start=9]
+
. 调整文本字段的大小并对齐窗体元素。
您可以对文本字段启用 "Horizontal Resizable"(可水平调整大小)属性,以确保文本字段的大小可随窗口进行调整且元素间距保持不变。
-[start=10]
+
. 保存所做的更改。
在 "Design"(设计)视图中,您的窗体应与下图类似。
@@ -393,20 +393,20 @@
单击 "Build"(构建)后,IDE 会将所需的工件下载到您本地的 Maven 资源库。
-[start=2]
+
. 在 "Projects"(项目)窗口中的 "Other Sources"(其他源)节点下展开 ``<默认包>`` 源包节点。
-[start=3]
+
. 右键单击 ``hibernate.cfg.xml`` 配置文件,然后选择 "Run HQL Query"(运行 HQL 查询)以打开 HQL 编辑器。
-[start=4]
+
. 通过在 HQL 查询编辑器中键入 ``from Actor`` 来测试连接。单击工具栏中的 "Run HQL Query"(运行 HQL 查询)按钮 (image::images/run_hql_query_16.png[title=""Run HQL Query"(运行 HQL 查询)按钮"])。
单击 "Run HQL Query"(运行 HQL 查询)按钮之后,您应该能在 HQL 查询编辑器的底部窗格中看到查询结果。
image::images/hib-query-hqlresults.png[title="显示 HQL 查询结果的 HQL 查询编辑器"]
-[start=5]
+
. 在 HQL 查询编辑器中键入以下查询,然后单击 "Run HQL Query"(运行 HQL 查询)查询搜索字符串为 "PE" 时的查询结果。
[source,java]
@@ -426,7 +426,7 @@
select actor0_.actor_id as col_0_0_ from sakila.actor actor0_ where (actor0_.first_name like 'PE%' )
----
-[start=6]
+
. 打开一个新的 HQL 查询编辑器标签,在编辑器窗格中键入以下查询。单击 "Run HQL Query"(运行 HQL 查询)按钮。
[source,java]
@@ -461,7 +461,7 @@
可以将 HQL 查询编辑器标签中的查询复制到文件中,然后再修改代码。
-[start=3]
+
. 添加以下方法,以根据用户输入字符串创建查询。
[source,java]
@@ -479,7 +479,7 @@
这些方法调用一个名称为 ``executeHQLQuery()`` 的方法,并通过结合查询字符串与用户输入的搜索字符串来创建查询。
-[start=4]
+
. 添加 ``executeHQLQuery()`` 方法。
[source,java]
@@ -502,16 +502,16 @@
``executeHQLQuery()`` 方法调用 Hibernate 来执行选定的查询。该方法利用 ``HibernateUtil.java`` 实用程序类来获取 Hibernate 会话。
-[start=5]
+
. 修复您的导入,为 Hibernate 库( ``org.hibernate.Query`` , ``org.hibernate.Session`` )和 ``java.util.List`` 添加导入语句。
-[start=6]
+
. 切换到 "Design"(设计)视图并双击 "Query" 按钮,创建一个 "Query" 按钮事件处理程序。
IDE 将创建 ``queryButtonActionPerformed`` 方法并在 "Source"(源)视图中显示该方法。
-[start=7]
+
. 在 "Source"(源)视图中修改 ``queryButtonActionPerformed`` 方法,添加以下代码,以便查询能在用户单击按钮时正确运行。
[source,java]
@@ -526,7 +526,7 @@
}
----
-[start=8]
+
. 添加以下方法,在 JTable 中显示结果。
[source,java]
@@ -553,7 +553,7 @@
}
----
-[start=9]
+
. 修复导入(Ctrl+Shift+I 组合键)以添加 ``java.util.Vector`` ,然后保存所做的更改。
保存窗体之后,您可以运行项目。
@@ -578,7 +578,7 @@
image::images/browse-main-class.png[title="在 "Browse Main Classes"(浏览主类)对话框中设置主类"]
-[start=4]
+
. 单击主工具栏中的 "Run Project"(运行项目)以启动应用程序。
在 IDE 中对 Maven 项目调用 "Run"(运行)操作时,IDE 将运行与 "Run"(运行)操作关联的 Maven 目标。IDE 具有绑定到 IDE 操作的默认目标,这些目标依据项目包而定。在项目 "Properties"(属性)窗口的 "Actions"(操作)窗格中,可以查看绑定到 "Run"(运行)操作的目标。
@@ -605,22 +605,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repostiory Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点,然后选择 *samples/java/DVDStoreAdmin-Maven*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
*注:*
@@ -650,17 +650,17 @@
}
----
-[start=4]
+
. 为字段生成 getter 和 setter 方法,方法是将光标放置在源代码编辑器中,按下 Alt-Insert 并选择 "Getter and Setter"(Getter 和 Setter)。
-[start=5]
+
. 在 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框中,选择所有字段并单击 "Generate"(生成)。
image::images/getters-setters.png[title=""Generate Getters and Setters"(生成 getter 和 setter)对话框"]
在 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框中,您可以使用键盘中的向上箭头将所选项目移动到 Actor 节点中,然后按空格键选择 Actor 中的所有字段。
-[start=6]
+
. 修复导入并保存更改。
为表创建 POJO 之后,您需要为 ``Actor.java`` 创建一个 Hibernate 映射文件。
@@ -683,7 +683,7 @@
</hibernate-configuration>
----
-[start=6]
+
. 对 ``Actor.hbm.xml`` 执行以下更改(黑体),将 ``Actor.java`` 中的字段映射到 ACTOR 表中的列。
[source,xml]
@@ -722,7 +722,7 @@
</hibernate-mapping>
----
-[start=7]
+
. 单击工具栏中的 "Validate XML"(验证 XML)按钮并保存更改。
如果要进一步定制应用程序,单独创建 POJO 和 Hibernate 映射文件可能是一种非常方便的方法。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/native_pkg.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/native_pkg.asciidoc
index 1771bef..e45e397 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/native_pkg.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/native_pkg.asciidoc
@@ -122,10 +122,10 @@
--
-[start=4]
+
. In the Name and Location panel, leave the default values for the Project Name and Project Location fields.
-[start=5]
+
. Click Finish.
The IDE creates and opens the Java SE project.
@@ -154,7 +154,7 @@
--
-[start=3]
+
. Click OK.
A Package as command is added to the project's context menu.
@@ -229,7 +229,7 @@
--
-[start=5]
+
. Click Finish.
The BrickBreaker JavaFX project displays in the Projects window in the IDE.
@@ -261,7 +261,7 @@
--
-[start=3]
+
. Click OK.
The Package as item is added to the project's context menu.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ja.asciidoc
index d60e45a..755c78f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ja.asciidoc
@@ -132,10 +132,10 @@
--
-[start=4]
+
. 「名前と場所」パネルで、「プロジェクト名」および「プロジェクトの場所」フィールドのデフォルト値をそのままにします。
-[start=5]
+
. 「終了」をクリックします。
IDEによってJava SEプロジェクトが作成され、開かれます。
@@ -164,7 +164,7 @@
--
-[start=3]
+
. 「OK」をクリックします。
「パッケージとして」コマンドがプロジェクトのコンテキスト・メニューに追加されます。
@@ -239,7 +239,7 @@
--
-[start=5]
+
. 「終了」をクリックします。
IDEの「プロジェクト」ウィンドウにBrickBreaker JavaFXが表示されます。
@@ -271,7 +271,7 @@
--
-[start=3]
+
. 「OK」をクリックします。
「パッケージとして」項目がプロジェクトのコンテキスト・メニューに追加されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_pt_BR.asciidoc
index 87e5ff8..72b3f3e 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_pt_BR.asciidoc
@@ -132,10 +132,10 @@
--
-[start=4]
+
. No painel Nome e Local, deixe os valores default para os campos Nome do Projeto e Localização do Projeto.
-[start=5]
+
. Clique em Finalizar.
O IDE cria e abre o projeto Java SE.
@@ -164,7 +164,7 @@
--
-[start=3]
+
. Clique em OK.
Um comando Encapsular como é adicionado ao menu de contexto do projeto.
@@ -239,7 +239,7 @@
--
-[start=5]
+
. Clique em Finalizar.
O projeto JavaFX do BrickBreaker é exibido na janela Projetos no IDE.
@@ -271,7 +271,7 @@
--
-[start=3]
+
. Clique em OK.
A opção Encapsular como item é adicionada ao menu de contexto do projeto.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ru.asciidoc
index 2fbc804..4e788a4 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_ru.asciidoc
@@ -132,10 +132,10 @@
--
-[start=4]
+
. На панели 'Имя и местоположение' оставьте без изменения данные в полях 'Имя проекта' и 'Местоположение проекта'.
-[start=5]
+
. Нажмите 'Готово'.
В IDE создается и открывается проект Java SE.
@@ -164,7 +164,7 @@
--
-[start=3]
+
. Нажмите ОК.
В контекстном меню проекта появится команда 'Упаковать'.
@@ -239,7 +239,7 @@
--
-[start=5]
+
. Нажмите 'Готово'.
Проект JavaFX BrickBreaker отображается в IDE в окне 'Проекты'.
@@ -271,7 +271,7 @@
--
-[start=3]
+
. Нажмите ОК.
В контекстном меню проекта появится пункт 'Упаковать'.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_zh_CN.asciidoc
index f0d3152..a2745eb 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/native_pkg_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/native_pkg_zh_CN.asciidoc
@@ -132,10 +132,10 @@
--
-[start=4]
+
. 在 "Name and Location"(名称和位置)面板中,保留 "Project Name"(项目名称)和 "Project Location"(项目位置)字段的默认值。
-[start=5]
+
. 单击 "Finish"(完成)。
IDE 将创建并打开 Java SE 项目。
@@ -164,7 +164,7 @@
--
-[start=3]
+
. 单击 "OK"(确定)。
包将作为命令添加到项目的上下文菜单中。
@@ -239,7 +239,7 @@
--
-[start=5]
+
. 单击 "Finish"(完成)。
BrickBreaker JavaFX 项目将显示在 IDE 的 "Projects"(项目)窗口中。
@@ -271,7 +271,7 @@
--
-[start=3]
+
. 单击 "OK"(确定)。
包将作为项添加到项目的上下文菜单中。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator.asciidoc
index 9d20865..0c51eaf 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator.asciidoc
@@ -75,7 +75,7 @@
2. Click the Available Plugins tab and select the checkboxes for the JMeter Kit and Load Generator plugins. Click Install.
image::images/generator-plugin.png[title="Load Generator plugins in Plugins manager"]
-[start=3]
+
. Step through the installer to download and install the plugins and click Finish. Click Close to close the Plugins Manager.
After installing the plugins, the category Load Testing Scripts is added to the New File wizard.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ja.asciidoc
index 6e24779..ce1cdcd 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ja.asciidoc
@@ -80,7 +80,7 @@
2. 「使用可能なプラグイン」タブをクリックし、JMeter Kitおよび負荷ジェネレータ・プラグインのチェックボックスを選択します。「インストール」をクリックします。
image::images/generator-plugin.png[title="プラグイン・マネージャの負荷ジェネレータ・プラグイン"]
-[start=3]
+
. インストーラの手順に従ってプラグインをダウンロードおよびインストールし、「終了」をクリックします。「閉じる」をクリックしてプラグイン・マネージャを終了します。
プラグインをインストールすると、新規ファイル・ウィザードに負荷テスト・スクリプト・カテゴリが追加されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_pt_BR.asciidoc
index d021a0a..087d73b 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_pt_BR.asciidoc
@@ -73,7 +73,7 @@
2. Clique na guia Plug-ins Disponíveis e marque as caixas de seleção dos plug-ins Kit do JMeter e Gerador de Carga. Clique em Instalar.
image::images/generator-plugin.png[title="Plug-ins do Gerador de Carga no Gerenciador de plug-ins"]
-[start=3]
+
. Acompanhe as páginas do instalador para fazer download e instalar os plug-ins e clique em Finalizar. Clique em Fechar para sair do Gerenciador de Plug-ins.
Depois de instalar os plug-ins, a categoria Scripts de Teste de Carga é adicionada ao assistente Novo Arquivo.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ru.asciidoc
index b308187..c799111 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_ru.asciidoc
@@ -73,7 +73,7 @@
2. Перейдите на вкладку 'Доступные подключаемые модули' и установите флажки для подключаемых модулей JMeter Kit и Load Generator. Нажмите кнопку "Установить".
image::images/generator-plugin.png[title="Подключаемый модуль генератора загрузки в диспетчере подключаемых модулей"]
-[start=3]
+
. Дождитесь, пока программа установки загрузит и установит подключаемые модули, затем нажмите кнопку "Готово". Нажмите кнопку "Закрыть, чтобы выйти из диспетчера подключаемых модулей.
По завершении установки подключаемых модулей в мастер создания файла будет добавлена категория "Load Testing Scripts" (Сценарии нагрузочного тестирования).
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_zh_CN.asciidoc
index c0fb25a..4adfaf9 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profile-loadgenerator_zh_CN.asciidoc
@@ -73,7 +73,7 @@
2. 单击 "Available Plugins"(可用插件)标签,然后选中 JMeter 工具包和负载生成器插件的复选框。单击 "Install"(安装)。
image::images/generator-plugin.png[title="插件管理器中的负载生成器插件"]
-[start=3]
+
. 逐步执行安装程序,以下载并安装插件,然后单击 "Finish"(完成)。单击 "Close"(关闭),以关闭插件管理器。
安装了插件之后,会将 "Load Testing Scripts"(负载测试脚本)类别添加到新建文件向导中。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro.asciidoc
index a5b8f2c..4c4f9e3 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro.asciidoc
@@ -61,7 +61,7 @@
When you click Finish, the IDE creates the Anagram Game sample project.
-[start=5]
+
. Choose Run > Set Main Project > AnagramGame from the main menu.
After you set the project as the main project you can see that the name of the Anagram Game project is in bold in the Projects window. By default, when using the IDE to profile a project, the IDE will profile the main project. If no project is set as the main project the IDE will profile the project that is selected in the Projects window.
@@ -114,10 +114,10 @@
Alternatively, right-click the project node in the Projects window and choose Profile.
-[start=3]
+
. Select Monitor in the Select Profiling Task dialog box.
-[start=4]
+
. Select additional monitor options, if desired. Click Run.
image::images/monitor-task.png[title="Selecting the Monitor Application profiling task"]
@@ -164,35 +164,35 @@
To use this option you also need to specify a profiling root method.
-[start=5]
+
. Click *customize* to open the Edit Profiling Roots dialog box.
image::images/select-cpu-task.png[title="Select CPU Profiling Task"]
-[start=6]
+
. In the Edit Profiling Roots dialog box, expand the AnagramGame node and select ``Sources/com.toy.anagrams.lib/WordLibrary`` . When profiling a project you can specify multiple root methods.
image::images/edit-profiling-roots.png[title="Dialog box for selecting the root methods"]
-[start=7]
+
. Click the Advanced button to open the Edit Profiling Roots (Advanced) dialog box which provides more advanced options for adding, editing and removing root methods.
image::images/edit-profiling-roots-adv.png[title="Dialog box for specifying the root methods"]
You can see that ``WordLibrary`` is listed as the root method. Click OK to close the Edit Profiling Roots (Advanced) dialog box.
-[start=8]
+
. Click OK to close the Edit Profiling Roots dialog box.
After you select the profiling root you can click *edit* in the Select Profiling Task dialog to modify the selected root method.
-[start=9]
+
. Select *Profile only project classes* for the Filter value.
The filter enables you to limit the classes that are instrumented. You can choose from the IDE's predefined profiling filters or create your own custom filters. You can click *Show filter value* to see a list of the classes that will be profiled when the selected filter is applied.
image::images/show-filter-value.png[title="Show Filter Value Dialog box"]
-[start=10]
+
. Click Run in the Select Profiling Task dialog box to start the profiling session.
When you click Run, the IDE launches the application and starts the profiling session. To view the profiling results, click Live Results in the Profiler window to open the Live Results window. The Live Results window displays the profiling data collected thus far. The data displayed is refreshed every few seconds by default. When analyzing CPU performance, the Live Results window displays information on the time spent in each method and the number of invocations of each method. You can see that in the Anagram Game application only the selected root methods are invoked initially.
@@ -255,7 +255,7 @@
1. Make sure the profiling session is still running.
(If you stopped the profiling session, repeat the steps to analyze memory performance and open the Live Results window.)
-[start=2]
+
. Right-click the line containing ``java.lang.String`` in the Live Results window and choose Take Snapshot and Show Allocation Stack Traces.
You can use the filter in the Live Results window to help you find the line.
@@ -265,19 +265,19 @@
The IDE takes a memory snapshot and opens the snapshot in the Allocation Stack Traces tab. In the Allocation Stack Traces tab you can explore the reverse call tree for the methods that instantiated the selected object.
-[start=3]
+
. Click the Save Snapshot to Project button in the snapshot toolbar (Ctrl-S; ⌘-S on Mac) to save the memory snapshot to your project. When you save the snapshot to your project, the snapshot is added to the list of Anagram Game's saved snapshots in the Profiler window. By default, snapshots are physically saved in the ``nbproject/private/profiler`` directory of your project. Saved snapshots are appended with the ``.nps`` suffix.
*Note.* You can save snapshots anywhere on your filesystem, however only snapshots saved in the default location in your project will be listed in the Profiler window. You can also click the "Save current view to image" button in the snapshot's toolbar to save the snapshot as an image files ( ``.png`` ) that can be viewed outside of the IDE.
-[start=4]
+
. Take another snapshot by clicking the Take Snapshot of Collected Results button in the Live Results toolbar (or alternatively, click the Take Snapshot button in the Profiler window). Save the snapshot.
-[start=5]
+
. In the window of one of the memory snapshots, click the Compute Difference button ( image::images/comparesnapshots.png[title="Compare Snapshot button"] ) in the snapshot toolbar. Alternatively, choose Profile > Compare Memory Snapshots from the main menu.
-[start=6]
+
. In the Select Snapshot to Compare, select one of the open snapshots from the list. Click OK.
image::images/profile-java-selectsnap.png[title="Select Snapshots to Compare dialog box"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ja.asciidoc
index a835190..70d2596 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ja.asciidoc
@@ -96,7 +96,7 @@
「終了」をクリックすると、IDEによってAnagram Gameサンプル・プロジェクトが作成されます。
-[start=5]
+
. メイン・メニューから「実行」>「メイン・プロジェクトとして設定」>「AnagramGame」を選択します。
プロジェクトをメイン・プロジェクトに設定すると、Anagram Gameプロジェクトの名前が太字で「プロジェクト」ウィンドウに表示されます。デフォルトでは、IDEを使用してプロジェクトをプロファイルすると、IDEによってメイン・プロジェクトがプロファイルされます。メイン・プロジェクトとして設定されたプロジェクトがない場合、IDEでは、「プロジェクト」ウィンドウで選択されたプロジェクトがプロファイルされます。
@@ -152,10 +152,10 @@
または、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「プロファイル」を選択します。
-[start=3]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで「モニター」を選択します。
-[start=4]
+
. 必要に応じて、追加のモニター・オプションを選択します。「実行」をクリックします。
image::images/monitor-task.png[title="「アプリケーションのモニター」プロファイリング・タスクの選択"]
@@ -203,35 +203,35 @@
このオプションを使用するには、プロファイリング用ルート・メソッドも指定する必要があります。
-[start=5]
+
. 「*カスタマイズ*」をクリックして「プロファイリング・ルートの編集」ダイアログ・ボックスを開きます。
image::images/select-cpu-task.png[title="「CPU」プロファイリング・タスクの選択"]
-[start=6]
+
. 「プロファイリング・ルートの編集」ダイアログ・ボックスで、「AnagramGame」ノードを展開し、 ``Sources/com.toy.anagrams.lib/WordLibrary`` を選択します。プロジェクトをプロファイリングする場合は、複数のルート・メソッドを指定できます。
image::images/edit-profiling-roots.png[title="ルート・メソッドを選択するためのダイアログ・ボックス"]
-[start=7]
+
. 「詳細」ボタンをクリックして、ルート・メソッドを追加、編集、および除去するためのより詳細なオプションを提供する「プロファイリング・ルートの編集(詳細)」ダイアログ・ボックスを開きます。
image::images/edit-profiling-roots-adv.png[title="ルート・メソッドを指定するためのダイアログ・ボックス"]
``WordLibrary`` がルート・メソッドとして表示されていることが確認できます。「OK」をクリックして「プロファイリング・ルートの編集(詳細)」ダイアログ・ボックスを閉じます。
-[start=8]
+
. 「OK」をクリックして「プロファイリング・ルートの編集」ダイアログ・ボックスを閉じます。
プロファイリング・ルートを選択した後に、「プロファイリング・タスクの選択」ダイアログ・ボックスで「*編集*」をクリックし、選択したルート・メソッドを変更できます。
-[start=9]
+
. 「フィルタ」値で「*プロジェクト・クラスだけをプロファイル*」を選択します。
フィルタを使用すると、インストゥルメントされるクラスを制限できます。IDEの事前定義されたプロファイリング・フィルタから選択するか、または独自のカスタム・フィルタを作成することができます。「*フィルタ値を表示*」をクリックして、選択したフィルタが適用されたときにプロファイルされるクラスの一覧を確認できます。
image::images/show-filter-value.png[title="「フィルタ値を表示」ダイアログ・ボックス"]
-[start=10]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで「実行」をクリックし、プロファイリング・セッションを開始します。
「実行」をクリックすると、IDEによってアプリケーションが起動され、プロファイリング・セッションが開始されます。プロファイリング結果を表示するには、「プロファイラ」ウィンドウ内の「ライブ結果」をクリックして「ライブ結果」ウィンドウを開きます。「ライブ結果」ウィンドウには、これまでに収集されたプロファイリング・データが表示されます。表示されるデータは、デフォルトでは数秒ごとにリフレッシュされます。CPUパフォーマンスを解析している場合、「ライブ結果」ウィンドウには、各メソッドの所要時間と各メソッドの呼出し回数に関する情報が表示されます。Anagram Gameアプリケーションでは、選択されたルート・メソッドのみが最初に呼び出されていることが確認できます。
@@ -297,7 +297,7 @@
1. プロファイリング・セッションが引続き実行中であることを確認します。
(プロファイリング・セッションを停止した場合は、メモリー・パフォーマンスを解析するための手順を繰り返し、「ライブ結果」ウィンドウを開きます。)
-[start=2]
+
. 「ライブ結果」ウィンドウで ``java.lang.String`` を含む行を右クリックし、「スナップショットを取得して割当てスタック・トレースを表示」を選択します。
「ライブ結果」ウィンドウでフィルタを使用して、行を検索できます。
@@ -307,19 +307,19 @@
IDEによってメモリー・スナップショットが作成され、そのスナップショットが「割当てスタック・トレース」タブに表示されます。「割当てスタック・トレース」タブでは、選択されたオブジェクトをインスタンス化したメソッドの逆コール・ツリーを調べることができます。
-[start=3]
+
. スナップショット・ツールバーの「プロジェクトにスナップショットを保存」ボタンをクリックして([Ctrl]-[S]、Macの場合は[⌘]-[S])、メモリー・スナップショットをプロジェクトに保存します。スナップショットをプロジェクトに保存すると、そのスナップショットが「プロファイラ」ウィンドウ内のAnagram Gameの保存されたスナップショットの一覧に追加されます。デフォルトでは、スナップショットはプロジェクトの ``nbproject/private/profiler`` ディレクトリ内に物理的に保存されます。保存されたスナップショットには ``.nps`` の接尾辞が付加されます。
*注意:*スナップショットはファイルシステム上の任意の場所に保存できますが、「プロファイラ」ウィンドウに一覧表示されるのは、プロジェクト内のデフォルトの場所に保存されたスナップショットのみです。また、スナップショットのツールバーにある「現在のビューをイメージに保存」ボタンをクリックして、そのスナップショットをIDEの外部で表示できるイメージ・ファイル( ``.png`` )として保存することもできます。
-[start=4]
+
. 「ライブ結果」ツールバーの「収集結果のスナップショットの作成」ボタンをクリックして、別のスナップショットを作成します(または、「プロファイラ」ウィンドウで「スナップショットの取得」ボタンをクリックします)。スナップショットを保存します。
-[start=5]
+
. いずれかのメモリー・スナップショットのウィンドウで、スナップショット・ツールバーの「相違の計算」ボタン(image::images/comparesnapshots.png[title="スナップショットの比較ボタン"])をクリックします。または、メイン・メニューから「プロファイル」>「メモリー・スナップショットを比較」を選択します。
-[start=6]
+
. 「比較するスナップショットを選択」で、一覧から開いたスナップショットのいずれかを選択します。「OK」をクリックします。
image::images/profile-java-selectsnap.png[title="「比較するスナップショットを選択」ダイアログ・ボックス"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_pt_BR.asciidoc
index a15d1db..30559b6 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_pt_BR.asciidoc
@@ -96,7 +96,7 @@
Quando você clica em Finalizar, o IDE cria o projeto de amostra Jogo de Anagramas.
-[start=5]
+
. Escolha Executar >Definir Projeto Principal > Jogo de Anagramas do menu principal.
Depois que você definir o projeto como o principal você pode ver o nome do projeto Jogo de Anagramas em negrito na janela Projetos. Por default, ao usar o IDE para criar o perfil de um projeto, o IDE criará o perfil do projeto principal. Se nenhum projeto estiver definido como o projeto principal, o IDE irá criar o perfil do projeto selecionado na janela Projetos.
@@ -152,10 +152,10 @@
Alternativamente, clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Perfil.
-[start=3]
+
. Selecione Monitorar na caixa de diálogo Selecionar Tarefa de Criação de Perfil.
-[start=4]
+
. Selecione opções do monitor adicionais, se desejado. Clique em Executar.
image::images/monitor-task.png[title="Selecionando a tarefas de criação de perfil Monitorar Aplicação"]
@@ -203,35 +203,35 @@
Para usar essa opção, é preciso também especificar um método-raiz de criação de perfil.
-[start=5]
+
. Clique em *Personalizar* para abrir a caixa de diálogo Editar Raízes da Criação de Perfil.
image::images/select-cpu-task.png[title="Selecione Tarefas de Criação de Perfil da CPU"]
-[start=6]
+
. Na caixa de diálogo Editar Raízes da Criação de Perfil, expanda o nó Jogo de Anagramas e selecione ``Sources/com.toy.anagrams.lib/WordLibrary`` . Ao criar o perfil de um projeto, você pode especificar vários métodos-raiz.
image::images/edit-profiling-roots.png[title="Caixa de diálogo para selecionar os métodos-raiz"]
-[start=7]
+
. Clique no botão Avançado para abrir a caixa de diálogo Editar Raízes da Criação de Perfil (Avançado), que fornece opções mais avançadas para adicionar, editar e remover métodos-raiz.
image::images/edit-profiling-roots-adv.png[title="Caixa de diálogo para especificar os métodos-raiz"]
É possível ver que ``WordLibrary`` está listado como o método-raiz. Clique em OK para fechar a caixa de diálogo Editar Raízes da Criação de Perfil.
-[start=8]
+
. Clique em OK para fechar a caixa de diálogo Editar Raízes da Criação de Perfil.
Após você selecionar a raiz de criação do perfil é possível clicar em *editar* na caixa de diálogo Selecionar Tarefa de Criação de Perfil para modificar o método-raiz selecionado.
-[start=9]
+
. Selecione *Criar perfil somente das classes do projeto* no valor Filtro.
O Filtro permite que você limite as classes que estão instrumentadas. É possível selecionar entre os filtros predefinidos de criação de perfil do IDE ou criar seus próprios filtros personalizados. Você pode clicar em *Mostrar valor do filtro* para ver uma lista das classes que terá o perfil criado quando o filtro selecionado for aplicado.
image::images/show-filter-value.png[title="Caixa de Diálogo Mostrar Valor do Filtro"]
-[start=10]
+
. Clique em Executar na caixa de diálogo Selecionar Tarefa de Criação de Perfil para iniciar a sessão de criação de perfil.
Quando você clica em Executar, o IDE inicia a aplicação e começa a sessão de criação de perfil. Para exibir os resultados da criação de perfil, clique em Resultados em tempo real na janela Criador de Perfil para abrir a janela Resultados em Tempo Real. A janela Resultados em Tempo Real exibe os dados de criação de perfil coletados até o momento. Os dados exibidos são atualizados, por default, a cada poucos segundos. Quando você analisa o desempenho da CPU, a janela Resultados em Tempo Real exibe informações sobre o tempo gasto em cada método e o número de chamadas de cada método. É possível ver que, no Jogo de Anagramas, somente os métodos-raiz selecionados são inicialmente chamados.
@@ -297,7 +297,7 @@
1. Assegure-se de que a sessão de criação de perfil ainda esteja em execução.
(Se você interrompeu a sessão de criação de perfil, repita as etapas para analisar o desempenho da memória e abra a janela Resultados em Tempo Real.)
-[start=2]
+
. Clique com o botão direito do mouse na linha que contém ``java.lang.String`` na janela Resultados em Tempo Real e selecione Obter Snapshot e Mostrar Rastreamentos da Pilha de Alocação.
Você pode usar o filtro na janela Resultados em Tempo Real para ajudá-lo a localizar a linha.
@@ -307,19 +307,19 @@
O IDE obtém um snapshot da memória e abre o snapshot na guia Rastreamentos da Pilha de Alocação. Na guia Rastreamentos da Pilha de Alocação, é possível explorar a árvore de chamadas reversa para os métodos que instanciaram o objeto selecionado.
-[start=3]
+
. Clique no botão Salvar Snapshot para o Projeto na barra de ferramentas de snapshot (ou Ctrl+S no Mac) para salvar o snapshot para o seu projeto. Quando você salva um snapshot em seu projeto, ele é adicionado à lista dos snapshots salvos do Jogo de Anagramas na janela Profiler. Por default, os snapshots são salvos fisicamente no diretório ``nbproject/private/profiler`` de seu projeto. O sufixo ``.nps`` é acrescentado aos snapshots salvos.
*Observação.* Você pode salvar snapshots em qualquer lugar em seu sistema de arquivos, porém somente os snapshots salvos na localização default de seu projeto serão listados na janela Profiler. Também é possível clicar no botão "Salvar view atual na imagem" na barra de ferramenta de snapshot para salvar o snapshot como arquivos de imagem ( ``.png`` ) que podem ser exibidos fora do IDE.
-[start=4]
+
. Obtenha outro snapshot clicando no botão Obter Snapshot de Resultados Coletados na barra de ferramentas Resultados em Tempo Real (ou, alternativamente, clique no botão Obter Snapshot na janela Profiler). Salve o snapshot.
-[start=5]
+
. Na janela de um dos snapshots de memória, clique no botão Calcular Diferença ( image::images/comparesnapshots.png[title="Botão Comparar Snapshot"] ) na barra de ferramentas do snapshots. Como alternativa, selecione Perfil > Comparar Snapshots de Memória no menu principal.
-[start=6]
+
. Em Selecionar Snapshot para Comparar, selecione um dos snapshots abertos na lista. Clique em OK.
image::images/profile-java-selectsnap.png[title="Caixa de diálogo Selecionar Snapshots para Comparar"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ru.asciidoc
index 8402b93..5097988 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_ru.asciidoc
@@ -97,7 +97,7 @@
При нажатии кнопки "Готово" среда IDE создает пример проекта Anagram Game.
-[start=5]
+
. Выберите 'Выполнить' > 'Настроить основной проект' > AnagramGame в главном меню.
После настройки проекта как основного имя проекта Anagram Game будет выделено полужирным в окне 'Проекты'. По умолчанию при использовании среды IDE для профилирования проекта среда IDE профилирует главный проект. Если ни один проект не выбран в качестве главного, среда IDE выполнит профилирование проекта, который выбран в окне 'Проекты'.
@@ -153,10 +153,10 @@
Также можно щелкнуть правой кнопкой мыши узел проекта в окне 'Проекты' и выбрать 'Профиль'.
-[start=3]
+
. Выберите "Наблюдение" в диалоговом окне "Выбор задачи профилирования".
-[start=4]
+
. При необходимости выберите дополнительные параметры монитора. Нажмите кнопку "Выполнить".
image::images/monitor-task.png[title="Выбор задачи профилирования приложения монитора"]
@@ -204,35 +204,35 @@
Для использования этого варианта также необходимо указать корневой метод профилирования.
-[start=5]
+
. Нажмите кнопку *настроить*, чтобы открыть диалоговое окно "Изменение корневых методов профилирования".
image::images/select-cpu-task.png[title="Выбор задачи профилирования ЦП"]
-[start=6]
+
. В диалоговом окне 'Изменение корневых методов профилирования' разверните узел AnagramGame и выберите ``Sources/com.toy.anagrams.lib/WordLibrary`` . При профилировании проекта можно указать несколько корневых методов профилирования.
image::images/edit-profiling-roots.png[title="Диалоговое окно для выбора корневых методов"]
-[start=7]
+
. Нажмите кнопку "Дополнительно", чтобы открыть диалоговое окно "Изменение корневых методов профилирования (Дополнительно)", в котором доступны дополнительные параметры для добавления, изменения и удаления корневых методов.
image::images/edit-profiling-roots-adv.png[title="Диалоговое окно для указания корневых методов"]
Можно видеть, что ``WordLibrary`` указан как корневой метод. Нажмите "ОК", чтобы закрыть диалоговое окно "Изменение корневых методов профилирования (Расширенное)".
-[start=8]
+
. Нажмите "ОК", чтобы закрыть диалоговое окно "Изменение корневых методов профилирования".
После выбора корневых методов профилирования можно щелкнуть *правка* в диалоговом окне 'Выбор задачи профилирования' дл изменения выбранного корневого метода.
-[start=9]
+
. Выберите *Профилировать только классы проекта* для значения "Фильтр".
Фильтр позволяет ограничить инструментируемые классы. Можно выбрать один из предварительно определенных фильтров профилирования IDE или создать собственные пользовательские фильтры. Щелкните *Показать значение фильтра* для просмотра списка классов, которые будут профилированы при применении выбранного фильтра.
image::images/show-filter-value.png[title="Диалоговое окно 'Показать значени фильтра'"]
-[start=10]
+
. Нажмите кнопку "Выполнить" в диалоговом окне "Выбрать задачу профилирования" для начала сеанса профилирования.
При нажатии кнопки "Выполнить" среда IDE запускает приложение Anagram Game и запускает сеанс профилирования. Чтобы просмотреть результаты профилирования, нажмите кнопку "Текущие результаты" в окне "Средство профилирования", при этом откроется окно "Текущие результаты". В окне "Текущие результаты" отображаются собранные на этот момент данные профилирования. По умолчанию отображаемые данные обновляются каждые несколько секунд. При анализе производительности ЦП в окне "Текущие результаты" отображаются сведения о времени, затраченным для каждого метода, и число вызовов каждого метода. Можно видеть, что в приложении Anagram Game изначально вызываются только выбранные корневые методы.
@@ -298,7 +298,7 @@
1. Убедитесь, что сеанс профилирования по-прежнему выполняется.
(Если сеанс профилирования остановлен, повторите действия для анализа производительности памяти и откройте окно "Текущие результаты".)
-[start=2]
+
. Правой кнопкой мыши щелкните строку, содержащую ``java.lang.String`` , в окне "Текущие результаты" и выберите "Получить снимок и показать стек операций выделения памяти".
Вы сможете использовать фильтр в окне 'Динамические результаты' для поиска строки.
@@ -308,19 +308,19 @@
Среда IDE получает моментальный снимок памяти и открывает его во вкладке "Трассировка стека операций выделения памяти". На вкладке "Трассировка стека операций выделения памяти" можно изучить обратное дерево вызовов для методов, создавших экземпляр выбранного объекта.
-[start=3]
+
. Нажмите кнопку "Сохранить моментальный снимок в проекте" на панели инструментов моментального снимка (Ctrl-S; ⌘-S в Mac), чтобы сохранить моментальный снимок памяти в проекте. При сохранении моментального снимка в проекте он добавляется к списку сохраненных моментальных снимков Anagram Game в окне "Средство профилирования". По умолчанию моментальные снимки физически сохраняются в каталоге ``nbproject/private/profiler`` проекта. К сохраненным моментальным снимкам добавляются суффикс ``.nps`` .
*Примечание.* Вы можете сохранять снимки в любом местоположении файловой системы, но только снимки, сохраненные в папке по умолчанию в проекте, будут указаны в окне средства профилирования. Также можно нажать кнопку "Сохранить текущее представление в изображении" на панели инструментов моментального снимка, чтобы сохранить снимок как файлы изображений ( ``.png`` ), которые можно просмотреть вне среды IDE.
-[start=4]
+
. Получите другой моментальный снимок, нажав кнопку "Сделать моментальный снимок собранных результатов" на панели инструментов "Текущие результаты" (или нажмите кнопку "Сделать моментальный снимок" в окне "Средство профилирования"). Сохраните моментальный снимок.
-[start=5]
+
. В окне одного из снимков памяти, нажмите кнопку 'Вычислить разницу' ( image::images/comparesnapshots.png[title="Кнопка 'Сравнить списки'"] ) на панели инструментов снимков. Или выберите "Профиль > Сравнить моментальные снимки памяти" в главном меню.
-[start=6]
+
. В окне "Выбор моментального снимка для сравнения" выберите один из открытых моментальных снимков в списке. Нажмите кнопку "ОК".
image::images/profile-java-selectsnap.png[title="Диалоговое окно 'Выбрать снимки для сравнения'"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_zh_CN.asciidoc
index 09c478f..4511709 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-intro_zh_CN.asciidoc
@@ -96,7 +96,7 @@
单击“完成”,此时 IDE 将创建 Anagram Game 样例项目。
-[start=5]
+
. 从主菜单中选择“运行”>“设置为主项目”> "AnagramGame"。
在将项目设置为主项目后,您可以看到 Anagram Game 项目的名称在“项目”窗口中显示为粗体。默认情况下,使用 IDE 对项目进行性能分析时,IDE 也将对主项目进行性能分析。如果未将项目设置为主项目,则 IDE 将会对在“项目”窗口中选择的项目进行分析。
@@ -152,10 +152,10 @@
此外,也可以在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Profile"(性能分析)。
-[start=3]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中选择 "Monitor"(监视)。
-[start=4]
+
. 根据需要,选择其他监视选项。单击 "Run"(运行)。
image::images/monitor-task.png[title="选择 "Monitor Application"(监视应用程序)性能分析任务"]
@@ -203,35 +203,35 @@
要使用此选项,还需要指定性能分析根方法。
-[start=5]
+
. 单击 *Customize*(定制),打开 "Edit Profiling Roots"(编辑性能分析根目录)对话框。
image::images/select-cpu-task.png[title="选择 CPU 性能分析任务"]
-[start=6]
+
. 在 "Edit Profiling Roots"(编辑性能分析根目录)对话框中,展开 "AnagramGame" 节点,然后选择 ``Sources/com.toy.anagrams.lib/WordLibrary`` 。对项目进行性能分析时,可以指定多个根方法。
image::images/edit-profiling-roots.png[title="用于选择根方法的对话框"]
-[start=7]
+
. 单击 "Advanced"(高级)按钮,以打开 "Edit Profiling Roots (Advanced)"(编辑性能分析根目录(高级))对话框,该对话框提供了更高级的选项,用于添加、编辑和删除根方法。
image::images/edit-profiling-roots-adv.png[title="用于指定根方法的对话框"]
您可以看到 ``WordLibrary`` 被列为根方法。单击 "OK"(确定)以关闭 "Edit Profiling Roots (Advanced)"(编辑性能分析根目录(高级))对话框。
-[start=8]
+
. 单击 "OK"(确定),以关闭 "Edit Profiling Roots"(编辑性能分析根目录)对话框。
在选择性能分析根目录后,在 "Select Profiling Task"(选择性能分析任务)对话框中单击 *edit*(编辑)即可修改所选的根方法。
-[start=9]
+
. 选择 *Profile only project classes*(只分析项目类)作为过滤器值。
使用此过滤器可以限制所分析的类。您可以从 IDE 的预定义性能分析过滤器中选择,也可以创建自己的定制过滤器。单击 *Show filter value*(显示过滤器值)即可查看在应用所选过滤器时进行分析的类列表。
image::images/show-filter-value.png[title=""Show Filter Value"(显示过滤器值)对话框"]
-[start=10]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中单击 "Run"(运行)以启动性能分析会话。
单击 "Run"(运行)后,IDE 将启动应用程序,并开始性能分析会话。要查看性能分析结果,请在 "Profiler"(分析器)窗口中单击 "Live Results"(实时结果)以打开 "Live Results"(实时结果)窗口。"Live Results"(实时结果)窗口将显示迄今为止收集的性能分析数据。默认情况下,每几秒钟就刷新一次显示的数据。分析 CPU 性能时,"Live Results"(实时结果)窗口会显示与每个方法所花费时间相关的信息,以及与每个方法的调用次数相关的信息。您可以看到,在 Anagram Game 应用程序中,最初只调用选定的根方法。
@@ -297,7 +297,7 @@
1. 确保性能分析会话仍在运行中。
(如果停止了性能分析会话,则重复执行相应步骤以分析内存性能并打开 "Live Results"(实时结果)窗口。)
-[start=2]
+
. 在 "Live Results"(实时结果)窗口中,右键单击 ``java.lang.String`` 所在行,然后选择 "Take Snapshot and Show Allocation Stack Traces"(生成快照并显示分配堆栈跟踪)。
使用 "Live Results"(实时结果)窗口中的过滤器可帮助您查找该行。
@@ -307,19 +307,19 @@
IDE 将会生成内存快照,并在 "Allocation Stack Traces"(分配堆栈跟踪)标签中打开快照。在 "Allocation Stack Traces"(分配堆栈跟踪)标签中,可以在反向调用树中浏览实例化了选定对象的方法。
-[start=3]
+
. 单击快照工具栏中的 "Save Snapshot to Project"(将快照保存到项目中)按钮(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键),将内存快照保存到项目中。将快照保存到项目中时,会在 "Profiler"(分析器)窗口中将该快照添加到 Anagram Game 的已保存快照的列表中。默认情况下,快照实际上保存在项目的 ``nbproject/private/profiler`` 目录中。已保存的快照会附加 ``.nps`` 后缀。
*注:*您可以将快照保存到文件系统上的任何位置,但只有保存在项目中默认位置的快照才会列在 "Profiler"(分析器)窗口中。此外,还可以单击快照工具栏中的 "Save current view to image"(将当前视图另存为图像)按钮,将快照保存为可以在 IDE 外部查看的图像文件 ( ``.png`` )。
-[start=4]
+
. 生成另一个快照,方法是:单击 "Live Results"(实时结果)工具栏中的 "Take Snapshot of Collected Results"(生成收集结果的快照)按钮(或者,也可以在 "Profiler"(分析器)窗口中单击 "Take Snapshot"(生成快照)按钮)。保存该快照。
-[start=5]
+
. 在某一内存快照的窗口中,单击快照工具栏中的 "Compute Difference"(计算差异)按钮 (image::images/comparesnapshots.png[title=""Compare Snapshot"(比较快照)按钮"])。此外,也可以从主菜单中选择 "Profile"(性能分析)> "Compare Memory Snapshots"(比较内存快照)。
-[start=6]
+
. 在 "Select Snapshot to Compare"(选择要比较的快照)中,从列表中选择其中一个打开的快照。单击 "OK"(确定)。
image::images/profile-java-selectsnap.png[title=""Select Snapshots to Compare"(选择要比较的快照)对话框"]
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints.asciidoc
index 16f53a5..850672f 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints.asciidoc
@@ -59,7 +59,7 @@
3. Select a profiling point type and the project. Click Next.
image::images/ppoints-newstopwatch.png[title="Screenshot of New Profiling Point dialog box"]
-[start=4]
+
. Type a name for the profiling point and customize the properties of the profiling point. Click Finish.
When you click Finish, an icon representing the profiling point type appears in the left margin of the source editor next to the line where you inserted the profiling point.
@@ -122,7 +122,7 @@
When you click Finish, the IDE creates the Anagram Game sample project.
-[start=5]
+
. Choose Run > Set Main Project > AnagramGame from the main menu.
After you set the project as the main project you can see that the name of the Anagram Game project is in bold in the Projects window. By default, when using the IDE to profile a project, the IDE will profile the main project. If no project is set as the main project the IDE will profile the project that is selected in the Projects window.
@@ -147,7 +147,7 @@
When you choose Timestamp and duration, the dialog box automatically sets the stopwatch to start at the beginning of the line of code and to end at the end of the following line. You can modify the lines where the stopwatch starts and stops.
-[start=6]
+
. Modify the *Location (stop)* setting to change the end line to a couple lines after the begin line. Click Finish.
image::images/stopwatch-dialog.png[title="Screenshot of New Profiling Point dialog box"]
@@ -158,17 +158,17 @@
If you open the Profiling Points window you can see that the stopwatch profiling point is added to the list.
-[start=7]
+
. Click Profile Main Project in the toolbar.
-[start=8]
+
. In the Select Profiling Task dialog box, click the *CPU* profiling task and select the *Advanced (instrumented)* option.
image::images/select-profiling-task1.png[title="Select Profiling Task dialog box"]
*Note.* Profiling points can be used when analyzing performance or memory usage.
-[start=9]
+
. Select *Use defined Profiling Points.* Click Run to start the profiling session.
If you click *Show active profiling points* you can view the profiling points that are enabled for the profiling session.
@@ -197,13 +197,13 @@
6. Specify a location where you want the files to be saved or keep the default location. Click Finish.
image::images/ppoints-profile-snapheap.png[title="New Take Snapshot profiling point with heap dump selected"]
-[start=7]
+
. Click Profile Main Project in the toolbar.
-[start=8]
+
. In the Select Profiling Task dialog box, click either *CPU* or *Memory* and select the *Advanced (instrumented)* option.
-[start=9]
+
. Select *Use defined profiling points.* Click Run to start the profiling session.
If you click *Show active profiling points* you can view the profiling points that are enabled for the profiling session.
@@ -235,13 +235,13 @@
5. Specify a name for the profiling point and ensure the location of the profiling point is correct. Click Finish.
image::images/ppoints-newreset.png[title="Screenshot of New Reset Results pane"]
-[start=6]
+
. Click Profile Main Project in the toolbar.
-[start=7]
+
. In the Select Profiling Task dialog box, click either *CPU* or *Memory* and select the *Advanced (instrumented)* option
-[start=8]
+
. Select *Use defined Profiling Points.* Click Run to start the profiling session.
If you click *Show active profiling points* you can view the profiling points that are enabled for the profiling session.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ja.asciidoc
index c70c2e8..a810aeb 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ja.asciidoc
@@ -93,7 +93,7 @@
3. プロファイリング・ポイント・タイプとプロジェクトを選択します。「次」をクリックします。
image::images/ppoints-newstopwatch.png[title="「新規プロファイリング・ポイント」ダイアログ・ボックスのスクリーンショット"]
-[start=4]
+
. プロファイリング・ポイントの名前を入力し、プロファイリング・ポイントのプロパティをカスタマイズします。「終了」をクリックします。
「終了」をクリックすると、プロファイリング・ポイント・タイプを表すアイコンが、ソース・エディタの左マージンの、プロファイリング・ポイントを挿入した行の横に表示されます。
@@ -160,7 +160,7 @@
「終了」をクリックすると、IDEによってAnagram Gameサンプル・プロジェクトが作成されます。
-[start=5]
+
. メイン・メニューから「実行」>「メイン・プロジェクトとして設定」>「AnagramGame」を選択します。
プロジェクトをメイン・プロジェクトに設定すると、Anagram Gameプロジェクトの名前が太字で「プロジェクト」ウィンドウに表示されます。デフォルトでは、IDEを使用してプロジェクトをプロファイルすると、IDEによってメイン・プロジェクトがプロファイルされます。メイン・プロジェクトとして設定されたプロジェクトがない場合、IDEでは、「プロジェクト」ウィンドウで選択されたプロジェクトがプロファイルされます。
@@ -186,7 +186,7 @@
「タイムスタンプと期間」を選択すると、ストップウォッチがコードのその行の先頭で開始し、次の行の最後で終了するようにダイアログ・ボックスによって自動的に設定されます。ストップウォッチが開始する行および停止する行は変更できます。
-[start=6]
+
. 「*場所(停止)*」設定を変更して、終了行を開始行の数行後に変更します。「終了」をクリックします。
image::images/stopwatch-dialog.png[title="「新規プロファイリング・ポイント」ダイアログ・ボックスのスクリーンショット"]
@@ -197,17 +197,17 @@
「プロファイリング・ポイント」ウィンドウを開くと、「ストップウォッチ」プロファイリング・ポイントが一覧に追加されていることが確認できます。
-[start=7]
+
. ツールバーの「メイン・プロジェクトのプロファイル」をクリックします。
-[start=8]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで*「CPU」*プロファイリング・タスクをクリックし、*「詳細(計測済)」*オプションを選択します。
image::images/select-profiling-task1.png[title="「プロファイリング・タスクの選択」ダイアログ・ボックス"]
*注意:*プロファイリング・ポイントは、パフォーマンスまたはメモリー使用状況を解析するときに使用できます。
-[start=9]
+
. 「*定義済みプロファイリング・ポイントを使用*」を選択します。「実行」をクリックして、プロファイリング・セッションを開始します。
「*アクティブなプロファイリング・ポイントを表示*」をクリックすると、そのプロファイリング・セッションに対して有効になっているプロファイリング・ポイントを表示できます。
@@ -237,13 +237,13 @@
6. ファイルが保存される場所を指定するか、またはデフォルトの場所のままにします。「終了」をクリックします。
image::images/ppoints-profile-snapheap.png[title="「ヒープ・ダンプ」が選択された新しい「スナップショットの取得」プロファイリング・ポイント"]
-[start=7]
+
. ツールバーの「メイン・プロジェクトのプロファイル」をクリックします。
-[start=8]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで*「CPU」*または*「メモリー」*をクリックし、*「詳細(計測済)」*オプションを選択します。
-[start=9]
+
. 「*定義済みプロファイリング・ポイントを使用*」を選択します。「実行」をクリックして、プロファイリング・セッションを開始します。
「*アクティブなプロファイリング・ポイントを表示*」をクリックすると、そのプロファイリング・セッションに対して有効になっているプロファイリング・ポイントを表示できます。
@@ -276,13 +276,13 @@
5. プロファイリング・ポイントの名前を指定し、そのプロファイリング・ポイントの場所が正しいことを確認します。「終了」をクリックします。
image::images/ppoints-newreset.png[title="新しい「結果のリセット」ペインのスクリーンショット"]
-[start=6]
+
. ツールバーの「メイン・プロジェクトのプロファイル」をクリックします。
-[start=7]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで*「CPU」*または*「メモリー」*をクリックし、*「詳細(計測済)」*オプションを選択します。
-[start=8]
+
. 「*定義済みプロファイリング・ポイントを使用*」を選択します。「実行」をクリックして、プロファイリング・セッションを開始します。
「*アクティブなプロファイリング・ポイントを表示*」をクリックすると、そのプロファイリング・セッションに対して有効になっているプロファイリング・ポイントを表示できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_pt_BR.asciidoc
index bd8af8f..d91ab93 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_pt_BR.asciidoc
@@ -93,7 +93,7 @@
3. Selecione um tipo de ponto de criação de perfil e o projeto. Clique em Próximo.
image::images/ppoints-newstopwatch.png[title="Tela da caixa de diálogo Novo Ponto de Criação de Perfil"]
-[start=4]
+
. Insira um nome para o ponto de criação de perfil e personalize suas propriedades. Clique em Finalizar.
Quando você clica em Finalizar, aparece um ícone que representa o tipo de ponto de criação de perfil na margem esquerda do editor de código-fonte ao lado da linha em que inseriu o ponto de criação de perfil.
@@ -160,7 +160,7 @@
Quando você clica em Finalizar, o IDE cria o projeto de amostra Jogo de Anagramas.
-[start=5]
+
. Escolha Executar >Definir Projeto Principal > Jogo de Anagramas do menu principal.
Depois que você definir o projeto como o principal você pode ver o nome do projeto Jogo de Anagramas em negrito na janela Projetos. Por default, ao usar o IDE para criar o perfil de um projeto, o IDE criará o perfil do projeto principal. Se nenhum projeto estiver definido como o projeto principal, o IDE irá criar o perfil do projeto selecionado na janela Projetos.
@@ -186,7 +186,7 @@
Quando escolher Timestamp e duração, a caixa de diálogo definirá automaticamente o cronômetro para iniciar no começo da linha de código até o final no término da linha seguinte. É possível modificar as linhas em que o cronômetro inicia e termina.
-[start=6]
+
. Modifique a definição de *Localização (fim)* para alterar a linha final para algumas linhas depois da linha de início. Clique em Finalizar.
image::images/stopwatch-dialog.png[title="Tela da caixa de diálogo Novo Ponto de Criação de Perfil"]
@@ -197,17 +197,17 @@
Se você abrir a janela Pontos de Criação de Perfil verá que o ponto de criação de perfil do cronômetro é adicionado à lista.
-[start=7]
+
. Clique em Criação de Perfil do Projeto Principal na barra de ferramentas.
-[start=8]
+
. Na caixa de diálogo Selecionar Tarefa de Criação de Perfil, clique na tarefa de criação de perfil *CPU* e selecione a opção *Avançado (instrumentado)*.
image::images/select-profiling-task1.png[title="Caixa de diálogo Selecionar Tarefa de Criação de Perfil"]
*Observação.* Os pontos de criação de perfil podem ser usados ao analisar o desempenho ou uso de memória.
-[start=9]
+
. Selecione *Usar Pontos de Criação de Perfil definidos.* Clique em Executar para iniciar a sessão de criação de perfil.
Se você clicar em *Mostrar pontos de criação de perfil ativos* você pode exibir os pontos de criação de perfil que são ativados para a sessão de criação de perfil.
@@ -237,13 +237,13 @@
6. Especifique uma localização onde deseja que os arquivos sejam salvos ou deixe a localização default. Clique em Finalizar.
image::images/ppoints-profile-snapheap.png[title="Novo ponto de criação de perfil Obter Snapshot com dump de heap selecionado"]
-[start=7]
+
. Clique em Criação de Perfil do Projeto Principal na barra de ferramentas.
-[start=8]
+
. Na caixa de diálogo Selecionar Tarefa de Criação de Perfil, clique em *CPU* ou *Memória* e selecione a opção *Avançado (instrumentado)*.
-[start=9]
+
. Selecione *Usar pontos de criação de perfil definidos*. Clique em Executar para iniciar a sessão de criação de perfil.
Se você clicar em *Mostrar pontos de criação de perfil ativos* você pode exibir os pontos de criação de perfil que são ativados para a sessão de criação de perfil.
@@ -276,13 +276,13 @@
5. Especifique um nome para o ponto de criação de perfil e certifique-se de que o local do ponto de criação de perfil esteja correto. Clique em Finalizar.
image::images/ppoints-newreset.png[title="Tela do painel Novo painel Redefinir Resultados"]
-[start=6]
+
. Clique em Criação de Perfil do Projeto Principal na barra de ferramentas.
-[start=7]
+
. Na caixa de diálogo Selecionar Tarefa de Criação de Perfil, clique em *CPU* ou *Memória* e selecione a opção *Avançado (instrumentado)*.
-[start=8]
+
. Selecione *Usar Pontos de Criação de Perfil definidos.* Clique em Executar para iniciar a sessão de criação de perfil.
Se você clicar em *Mostrar pontos de criação de perfil ativos* você pode exibir os pontos de criação de perfil que são ativados para a sessão de criação de perfil.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ru.asciidoc
index 1c3790a..512b683 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_ru.asciidoc
@@ -94,7 +94,7 @@
3. Выберите тип точки профилирования и проект. Нажмите кнопку "Далее".
image::images/ppoints-newstopwatch.png[title="Моментальный снимок диалогового окна 'Создать точку профилирования'"]
-[start=4]
+
. Введите имя точки профилирования и настройки ее свойства. Нажмите кнопку 'Готово'.
При нажатии кнопки "Готово" значок, обозначающий тип точки профилирования, появится в левом поле редактора исходного кода рядом со строкой для вставки точки профилирования.
@@ -161,7 +161,7 @@
При нажатии кнопки "Готово" среда IDE создает пример проекта Anagram Game.
-[start=5]
+
. Выберите 'Выполнить' > 'Настроить основной проект' > AnagramGame в главном меню.
После настройки проекта как основного имя проекта Anagram Game будет выделено полужирным в окне 'Проекты'. По умолчанию при использовании среды IDE для профилирования проекта среда IDE профилирует главный проект. Если ни один проект не выбран в качестве главного, среда IDE выполнит профилирование проекта, который выбран в окне 'Проекты'.
@@ -187,7 +187,7 @@
При выборе "Метка времени и длительность" диалоговое окно автоматически устанавливает запуск секундомера в начале строки кода и его остановку в конце следующей строки. Можно изменить строки запуска и остановки секундомера.
-[start=6]
+
. Измените параметр *Местоположение (конец)*, чтобы изменить строку окончания на несколько строчек после строки начала. Нажмите кнопку 'Готово'.
image::images/stopwatch-dialog.png[title="Моментальный снимок диалогового окна 'Создать точку профилирования'"]
@@ -198,17 +198,17 @@
При открытии окна "Точки профилирования" можно увидеть, что точка профилирования "секундомер" добавлена к списку.
-[start=7]
+
. Щелкните "Профилировать главный проект" на панели инструментов.
-[start=8]
+
. В диалоговом окне 'Выбрать задачу профилирования' щелкните задачу профилирования *ЦП* и выберите параметр *Расширенный (инструментарий)*.
image::images/select-profiling-task1.png[title="Диалоговое окно 'Выбор задачи профилирования'"]
*Примечание.* Точки профилирования могут быть использованы при анализе производительности и использования памяти.
-[start=9]
+
. Выберите *Использовать определенные точки профилирования.* Нажмите кнопку "Выполнить" для начала сеанса профилирования.
При щелчке *Показать активные точки профилирования* можно просмотреть активные точки профилирования, включенные для сеанса профилирования.
@@ -238,13 +238,13 @@
6. Укажите местоположение для сохранения файлов или оставьте местоположение по умолчанию. Нажмите кнопку "Завершить".
image::images/ppoints-profile-snapheap.png[title="Создать новый снимок точки профилирования с выбранным дампом кучи"]
-[start=7]
+
. Щелкните "Профилировать главный проект" на панели инструментов.
-[start=8]
+
. В диалоговом окне 'Выбрать задачу профилирования' щелкните *ЦП* или *Память* и выберите параметр *Расширенный (инструментарий)*.
-[start=9]
+
. Выберите *Использовать определенные точки профилирования.* Нажмите кнопку "Выполнить" для начала сеанса профилирования.
При щелчке *Показать активные точки профилирования* можно просмотреть активные точки профилирования, включенные для сеанса профилирования.
@@ -277,13 +277,13 @@
5. Укажите имя точки профилирования и убедитесь в правильности местоположения точки профилирования. Нажмите кнопку "Завершить".
image::images/ppoints-newreset.png[title="Снимок панели 'Новые результаты сброса'"]
-[start=6]
+
. Щелкните "Профилировать главный проект" на панели инструментов.
-[start=7]
+
. В диалоговом окне 'Выбрать задачу профилирования' щелкните *ЦП* или *Память* и выберите параметр *Расширенный (инструментарий)*
-[start=8]
+
. Выберите *Использовать определенные точки профилирования.* Нажмите кнопку "Выполнить" для начала сеанса профилирования.
При щелчке *Показать активные точки профилирования* можно просмотреть активные точки профилирования, включенные для сеанса профилирования.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_zh_CN.asciidoc
index fd72f40..225e392 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/profiler-profilingpoints_zh_CN.asciidoc
@@ -93,7 +93,7 @@
3. 选择性能分析点类型和项目。单击 "Next"(下一步)。
image::images/ppoints-newstopwatch.png[title=""New Profiling Point"(新建性能分析点)对话框的屏幕快照"]
-[start=4]
+
. 键入性能分析点的名称并定制其属性。单击 "Finish"(完成)。
单击 "Finish"(完成),此时在源代码编辑器的左旁注中,您会看到插入了性能分析点的行旁边将显示一个表示性能分析点类型的图标。
@@ -160,7 +160,7 @@
单击 "Finish"(完成),此时 IDE 将创建 Anagram Game 样例项目。
-[start=5]
+
. 从主菜单中选择 "Run"(运行)> "Set Main Project"(设置为主项目)> "AnagramGame"。
在将项目设置为主项目后,您可以看到 Anagram Game 项目的名称在 "Projects"(项目)窗口中显示为粗体。默认情况下,使用 IDE 对项目进行性能分析时,IDE 也将对主项目进行性能分析。如果未将项目设置为主项目,则 IDE 将会对在 "Projects"(项目)窗口中选择的项目进行分析。
@@ -186,7 +186,7 @@
选择 "Timestamp and duration"(时间戳和持续时间)时,对话框会自动将秒表设置为在代码行的开头开始,并在以下行的结尾结束。您可以修改秒表开始和结束所在的行。
-[start=6]
+
. 修改 *Location (stop)*(位置 (停止))设置,将结束行更改为开始行之后的几行。单击 "Finish"(完成)。
image::images/stopwatch-dialog.png[title=""New Profiling Point"(新建性能分析点)对话框的屏幕快照"]
@@ -197,17 +197,17 @@
打开 "Profiling Points"(性能分析点)窗口时,可以看到秒表性能分析点添加到了列表中。
-[start=7]
+
. 单击工具栏中的 "Profile Main Project"(分析主项目)。
-[start=8]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中,单击 *CPU* 性能分析任务并选择 *Advanced (instrumented)*(高级(分析))选项。
image::images/select-profiling-task1.png[title=""Select Profiling Task"(选择性能分析任务)对话框"]
*注:*可在分析性能或内存使用情况时使用性能分析点。
-[start=9]
+
. 选择 *Use defined Profiling Points*(使用定义的性能分析点)。单击 "Run"(运行)以启动性能分析会话。
单击 *Show active profiling points*(显示活动的性能分析点)时,可以查看为性能分析会话启用的性能分析点。
@@ -237,13 +237,13 @@
6. 指定文件的保存位置或保留默认位置。单击 "Finish"(完成)。
image::images/ppoints-profile-snapheap.png[title="选择了堆转储的新生成快照性能分析点"]
-[start=7]
+
. 单击工具栏中的 "Profile Main Project"(分析主项目)。
-[start=8]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中,单击 *CPU* 或 *Memory*(内存)并选择 *Advanced (instrumented)*(高级(分析))选项。
-[start=9]
+
. 选择 *Use defined Profiling Points*(使用定义的性能分析点)。单击 "Run"(运行)以启动性能分析会话。
单击 *Show active profiling points*(显示活动的性能分析点)时,可以查看为性能分析会话启用的性能分析点。
@@ -276,13 +276,13 @@
5. 指定性能分析点的名称,并确保性能分析点的位置正确无误。单击 "Finish"(完成)。
image::images/ppoints-newreset.png[title=""New Reset Results"(新重置结果)窗格的屏幕快照"]
-[start=6]
+
. 单击工具栏中的 "Profile Main Project"(分析主项目)。
-[start=7]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中,单击 *CPU* 或 *Memory*(内存)并选择 *Advanced (instrumented)*(高级(分析))选项
-[start=8]
+
. 选择 *Use defined Profiling Points*(使用定义的性能分析点)。单击 "Run"(运行)以启动性能分析会话。
单击 *Show active profiling points*(显示活动的性能分析点)时,可以查看为性能分析会话启用的性能分析点。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui.asciidoc
index f7dc268..04724a5 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui.asciidoc
@@ -64,13 +64,13 @@
1. In the Projects window, right-click the ``ContactEditor`` node and choose New > JFrame Form.
Alternatively, you can find a JFrame form by choosing New > Other > Swing GUI Forms > JFrame Form.
-[start=2]
+
. Enter ``ContactEditorUI`` as the Class Name.
-[start=3]
+
. Enter ``my.contacteditor`` as the package.
-[start=4]
+
. Click Finish.
The IDE creates the ``ContactEditorUI`` form and the ``ContactEditorUI`` class within the ``ContactEditorUI.java`` application and opens the ``ContactEditorUI`` form in the GUI Builder. Notice that the ``my.contacteditor`` package replaces the default package.
@@ -324,7 +324,7 @@
The JTextField's right edge snaps into alignment with the JPanel's recommended edge margin and the GUI Builder infers the appropriate resizing behavior.
-[start=3]
+
. Press Ctrl-S to save the file.
@@ -431,7 +431,7 @@
--
-[start=3]
+
. Press Ctrl-S to save the file.
@@ -470,7 +470,7 @@
The JTextField snaps into position on the right of the ``E-mail Address:`` JLabel and is chained to the JLabel. Its corresponding node is also added to the Inspector window.
-[start=3]
+
. Drag the resize handle of the JTextField toward the right of the enclosing JPanel until the alignment guidelines appear suggesting the offset between the JTextField and JPanel edges.
The JTextField's right edge snaps to the alignment guideline indicating the preferred margins.
@@ -523,7 +523,7 @@
--
-[start=3]
+
. Move the cursor over the top right corner of the JList in the lower JPanel. When the guidelines appear indicating that the JButton's top and right edges are aligned with that of the JList, shift-click to place the second button along the JFrame's right edge.
[.feature]
@@ -532,7 +532,7 @@
--
-[start=4]
+
. Add two additional JButtons below the two we already added to create a column. Make certain to position the JButtons such that the suggested spacing is respected and consistent. If you forget to release the Shift key prior to positioning the last JButton, simply press the Escape key.
[.feature]
@@ -541,7 +541,7 @@
--
-[start=5]
+
. Set the display text for each JButton. (You can edit a button's text by right-clicking the button and choosing Edit Text. Or you can click the button, pause, and then click again.) Enter `Add` for the top button, `Edit` for the second, `Remove` for the third, and `As Default` for the fourth.
The JButton components snap into the positions designated by the alignment guidelines. The width of the buttons changes to accommodate the new names.
@@ -592,10 +592,10 @@
--
-[start=4]
+
. Move the cursor to the right of the first JRadioButton. Shift-click to place the second and third JRadioButtons, being careful to respect the suggested component spacing. Make certain to release the Shift key prior to positioning the last JRadioButton.
-[start=5]
+
. Set the display text for each JRadioButton. (You can edit a button's text by right-clicking the button and choosing Edit Text. Or you can click the button, pause, and then click again.) Enter `HTML` for the left radio button, `Plain Text ` for the second, and `Custom` for the third.
Three JRadioButtons are added to the form and indented below the ``Mail Format`` JLabel.
@@ -626,7 +626,7 @@
--
-[start=5]
+
. Press Ctrl-S to save the file.
@@ -651,13 +651,13 @@
--
-[start=4]
+
. Add another JButton to the left of the first, making certain to place it using the suggested spacing along the JFrame's bottom edge.
-[start=5]
+
. Set the display text for each JButton. Enter ``OK`` for the left button and ``Cancel`` for right one. Notice that the width of the buttons changes to accommodate the new names.
-[start=6]
+
. Set the two JButtons to be the same size by selecting both, right-clicking either, and choosing Same Size > Same Width from the pop-up menu.
[.feature]
@@ -668,7 +668,7 @@
The ``JButton`` components appear in the form and their corresponding nodes are displayed in the Navigator window. The ``JButton`` components' code is also added to the form's source file which is visible in the Editor's Source view. Each of the JButtons are set to the same size as the button with the longest name.
-[start=7]
+
. Press Ctrl-S to save the file.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ja.asciidoc
index 324ed15..f48783c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ja.asciidoc
@@ -112,13 +112,13 @@
1. 「プロジェクト」ウィンドウで「 ``ContactEditor`` 」ノードを右クリックし、「新規」>「JFrameフォーム」を選択します。
または、「新規」>「その他」>「Swing GUIフォーム」>「JFrameフォーム」を選択してJFrameフォームを検索します。
-[start=2]
+
. クラス名として「 ``ContactEditorUI`` 」と入力します。
-[start=3]
+
. パッケージとして「 ``my.contacteditor`` 」と入力します。
-[start=4]
+
. 「終了」をクリックします。
IDEによって、 ``ContactEditorUI.java`` アプリケーション内に ``ContactEditorUI`` フォームと ``ContactEditorUI`` クラスが作成され、 ``ContactEditorUI`` フォームがGUIビルダー内で開きます。デフォルトのパッケージが ``my.contacteditor`` パッケージに置き換わります。
@@ -421,7 +421,7 @@
JTextFieldの右端が、ガイドラインが示すJPanelの端のマージンにあわせてスナップし、GUIビルダーで適切なサイズ変更の動作が表示されます。
-[start=3]
+
. [Ctrl]-[S]を押して、ファイルを保存します。
@@ -530,7 +530,7 @@
--
-[start=3]
+
. [Ctrl]-[S]を押して、ファイルを保存します。
@@ -571,7 +571,7 @@
JTextFieldが ``E-mail Address: `` JLabelの右側にスナップし、JLabelに関連付けられます。対応するノードが「インスペクタ」ウィンドウに追加されます。
-[start=3]
+
. JTextFieldとJPanelの間の適切なオフセットを示すガイドラインが表示されるまで、JTextFieldの右端にあるサイズ変更のハンドルをJPanelの右端の方向にドラッグします。
JTextFieldの右端が、適切なマージンを示すガイドラインにスナップします。
@@ -627,7 +627,7 @@
--
-[start=3]
+
. 下のJPanel内のJListの右上隅にカーソルを移動します。JButtonの上端と右端が、JListの上端と右端とそろっていることを示すガイドラインが表示されたら、[Shift]を押しながらクリックし、2つ目のボタンをJFrameの右端に沿って配置します。
[.feature]
@@ -636,7 +636,7 @@
--
-[start=4]
+
. 追加した2つのボタンの下にさらにJButtonを2つ縦に追加します。これらのJButtonは、ガイドラインに従い、間隔が同じになるように配置します。最後のJButtonを配置する前に[Shift]キーを離さなかった場合は、[Esc]キーを押します。
[.feature]
@@ -645,7 +645,7 @@
--
-[start=5]
+
. 各JButtonの表示テキストを設定します。(ボタンのテキストを編集するには、ボタンを右クリックして「テキストを編集」を選択します。または、ボタンをクリックし、しばらくしてからもう一度クリックすることもできます。)一番上のボタンは「`Add`」、2つ目のボタンは「`Edit`」、3つ目のボタンは「`Remove`」、4つ目のボタンは「`As Default`」にします。
JButtonコンポーネントはガイドラインが示す位置にスナップします。名前の長さにあわせてボタンの幅が変わります。
@@ -696,10 +696,10 @@
--
-[start=4]
+
. カーソルを最初のJRadioButtonの右側に移動します。[Shift]を押しながらクリックして、2つ目と3つ目のJRadioButtonを配置します(このとき、提示されたコンポーネントの間隔に従います)。[Shift]キーは、最後のJRadioButtonを配置する前に離します。
-[start=5]
+
. 各JRadioButtonの表示テキストを設定します。(ボタンのテキストを編集するには、ボタンを右クリックして「テキストを編集」を選択します。または、ボタンをクリックし、しばらくしてからもう一度クリックすることもできます。)左端のラジオ・ボタンは「`HTML`」、2つ目のラジオ・ボタンは「`Plain Text`」、3つ目のラジオ・ボタンは「`Custom`」にします。
3つのJRadioButtonがフォームに追加され、 ``Mail Format`` JLabelの下でインデントが設定されます。
@@ -730,7 +730,7 @@
--
-[start=5]
+
. [Ctrl]-[S]を押して、ファイルを保存します。
@@ -758,13 +758,13 @@
--
-[start=4]
+
. 別のJButtonを最初のJButtonの左側に追加します。このとき、JFrameの下端に沿ってガイドラインが示す間隔で配置します。
-[start=5]
+
. 各JButtonの表示テキストを設定します。左側のボタンには「 ``OK`` 」、右側のボタンには「 ``Cancel`` 」と入力します。名前の長さにあわせてボタンの幅が変わります。
-[start=6]
+
. 両方のJButtonを選択し、いずれか一方を右クリックし、ポップアップ・メニューから「同じサイズ」>「同じ幅」を選択することで2つのボタンを同じサイズにします。
[.feature]
@@ -775,7 +775,7 @@
``JButton`` コンポーネントがフォームに表示され、それに対応するノードが「ナビゲータ」ウィンドウに表示されます。 ``JButton`` コンポーネントのコードがフォームのソース・ファイルに追加されます。このコードは、エディタのソース・ビューで確認できます。各JButtonが、最も長い名前のボタンと同じサイズになります。
-[start=7]
+
. [Ctrl]-[S]を押して、ファイルを保存します。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_pt_BR.asciidoc
index 7eaff97..8847f93 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_pt_BR.asciidoc
@@ -87,13 +87,13 @@
1. na janela Projetos, clique com o botão direito do mouse no nó ``ContactEditor`` e selecione Novo > Form JFrame.
Outra opção é localizar um form JFrame escolhendo Novo > Outro > Forms da GUI Swing > Form JFrame.
-[start=2]
+
. Insira ``ContactEditorUI`` como Nome da Classe.
-[start=3]
+
. Insira ``my.contacteditor`` como o pacote.
-[start=4]
+
. Clique em Finalizar.
O IDE criará o form ``ContactEditorUI`` e a classe ``ContactEditorUI`` na aplicação ``ContactEditorUI.java`` e abrirá o form ``ContactEditorUI`` no GUI Builder. Observe que o pacote ``my.contacteditor`` substitui o pacote default.
@@ -392,7 +392,7 @@
A margem direita do JTextField se encaixará em alinhamento com a margem recomendada do JPanel e o GUI Builder deduzirá o comportamento de redimensionamento correto.
-[start=3]
+
. Pressione Ctrl-S para salvar o arquivo.
@@ -500,7 +500,7 @@
--
-[start=3]
+
. Pressione Ctrl-S para salvar o arquivo.
@@ -539,7 +539,7 @@
O JTextField se encaixará à direita do JLabel ``Endereço de E-mail:`` e será encadeado ao JLabel. O nó correspondente também será adicionado à janela Inspetor.
-[start=3]
+
. Arraste o handle de redimensionamento do JTextField em direção à direita do JPanel até que as linhas-guia de alinhamento sejam exibidas sugerindo o deslocamento entre as margens do JTextField e do JPanel.
A margem direita do JTextField se encaixará na linha-guia de alinhamento indicando as margens preferenciais.
@@ -595,7 +595,7 @@
--
-[start=3]
+
. Mova o cursor sobre o canto superior direito do JList no JPanel inferior. Quando as linhas-guia aparecerem, indicando que as margens superior e direita do JButton estão alinhadas às margens do JList, clique pressionando Shift para posicionar o segundo botão ao longo da margem direita do JFrame.
[.feature]
@@ -604,7 +604,7 @@
--
-[start=4]
+
. Adicione dois outros JButtons abaixo dos dois já adicionados para criar uma coluna. Certifique-se de posicionar os JButtons de maneira que o espaçamento sugerido seja respeitado e consistente. Se você se esquecer de soltar a tecla Shift antes de posicionar o último JButton, basta pressionar a tecla Escape.
[.feature]
@@ -613,7 +613,7 @@
--
-[start=5]
+
. Defina o texto de exibição de cada JButton. (Você pode editar o texto de um botão, clicando com o botão direito do mouse no botão e escolhendo Editar Texto. Ou você pode clicar no botão, pausar e clicar novamente.) Insira `Adicionar` para o botão superior, `Editar` para o segundo, `Remover` para o terceiro e `Default` para o quarto.
Os componentes JButton se encaixam nas posições designadas pelas linhas-guia de alinhamento. A largura dos botões muda para acomodar os novos nomes.
@@ -664,10 +664,10 @@
--
-[start=4]
+
. Mova o cursor à direita do primeiro JRadioButton. Clique pressionando a tecla Shift para inserir o segundo e o terceiro JRadioButtons, respeitando o espaçamento sugerido do componente. Certifique-se de soltar a tecla Shift antes de posicionar o último JRadioButton.
-[start=5]
+
. Defina o texto de exibição de cada JRadioButton. (Você pode editar o texto de um botão, clicando com o botão direito do mouse no botão e escolhendo Editar Texto. Ou você pode clicar no botão, pausar e clicar novamente.) Insira `HTML` para o botão de opção esquerdo, `Texto Simples ` para o segundo e `Personalizado` para o terceiro.
Três JRadioButtons serão adicionados ao form e recuados abaixo do JLabel ``Formato de Correio`` .
@@ -698,7 +698,7 @@
--
-[start=5]
+
. Pressione Ctrl-S para salvar o arquivo.
@@ -725,13 +725,13 @@
--
-[start=4]
+
. Adicione outro JButton à esquerda do primeiro, certificando-se de colocá-lo utilizando o espaçamento sugerido ao longo da margem inferior do JFrame.
-[start=5]
+
. Defina o texto de exibição de cada JButton. Insira ``OK`` para o botão esquerdo e ``Cancelar`` para o botão direito. Observe que a largura dos botões muda para acomodar os novos nomes.
-[start=6]
+
. Defina os dois JButtons para terem o mesmo tamanho selecionando-os, clicando com o botão direito do mouse em um deles e selecionando Mesmo Tamanho > Mesma Largura no menu pop-up.
[.feature]
@@ -742,7 +742,7 @@
Os componentes ``JButton`` serão exibidos no form e seus nós correspondentes serão exibidos na janela Navegador. O código dos componentes ``JButton`` também será adicionado ao arquivo de código-fonte do form, que é visível na view Código-fonte do Editor. Todos os JButtons serão definidos com o mesmo tamanho do botão que possuir o maior nome.
-[start=7]
+
. Pressione Ctrl-S para salvar o arquivo.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ru.asciidoc
index c44853a..3b68e65 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_ru.asciidoc
@@ -87,13 +87,13 @@
1. В окне 'Проекты' щелкните правой кнопкой мыши узел ``ContactEditor`` и выберите 'Создать' > 'Форма JFrame'.
Также форму JFrame можно найти, выбрав "Создать" > "Другое" > "Формы графического интерфейса Swing" > "Форма JFrame".
-[start=2]
+
. Введите ``ContactEditorUI`` в поле имени класса.
-[start=3]
+
. Введите ``my.numberaddition`` в поле пакета.
-[start=4]
+
. Нажмите кнопку "Завершить".
Среда IDE создаст форму ``ContactEditorUI`` и класс ``ContactEditorUI`` в рамках приложения ``ContactEditorUI.java`` и открывает форму ``ContactEditorUI`` в средстве GUI Builder. Обратите внимание, что пакет ``my.contacteditor`` сохраняется вместо пакета по умолчанию.
@@ -395,7 +395,7 @@
Правая граница компонента "JTextField" выравнивается согласно рекомендуемому размеру поля панели JPanel, и в GUI Builder выполняется соответствующая корректировка размеров.
-[start=3]
+
. Для сохранения файла нажмите сочетание клавиш CTRL+S.
@@ -507,7 +507,7 @@
--
-[start=3]
+
. Для сохранения файла нажмите сочетание клавиш CTRL+S.
@@ -550,7 +550,7 @@
Поле "JTextField" будет зафиксировано в позиции справа от компонента "JLabel" ``E-mail Address:`` и привязано к этому компоненту. В окне "Inspector" появится соответствующий узел.
-[start=3]
+
. Перетащите метку-манипулятор компонента "JTextField" к правой границе панели "JPanel" до появления на экране направляющих, обозначающих рекомендуемый интервал между границами "JTextField" и "JPanel".
Правая граница "JTextField" привязывается к направляющей, отображающей предпочтительные поля.
@@ -606,7 +606,7 @@
--
-[start=3]
+
. Наведите курсор на верхний правый угол списка "JList" на нижней панели "JPanel". При появлении направляющих, указывающих на выравнивание верхней и правой границ кнопки "JButton" по верхней и правой границам поля "JTextField", щелкните кнопкой мыши при нажатой клавише SHIFT для размещения второй кнопки у правого края компонента "JFrame".
[.feature]
@@ -615,7 +615,7 @@
--
-[start=4]
+
. Добавьте еще две кнопки "JButton" в позицию под ранее добавленными кнопками так, чтобы они образовали столбец. Эти кнопки должны размещаться с учетом требуемых интервалов, которые должны иметь одинаковый размер. В случае удерживания клавиши SHIFT во время размещения последней кнопки "JButton" можно нажать клавишу Escape для отмены действия.
[.feature]
@@ -624,7 +624,7 @@
--
-[start=5]
+
. Установите отображаемый текст для каждой кнопки "JButton". (Для изменения текста кнопки щелкните кнопку правой кнопкой мыши и выберите "Edit Text". В качестве альтернативы можно щелкнуть кнопку, выдержать паузу и щелкнуть еще раз.) Введите значение `Add` для верхней кнопки, `Edit` для второй, `Remove` для третьей и `As Default` для четвертой.
Компоненты "JButton" будут привязаны к позициям, обозначенным направляющими. Ширина кнопок будет изменена для размещения новых имен.
@@ -675,10 +675,10 @@
--
-[start=4]
+
. Переместите курсор вправо от первого компонента "JRadioButton". Щелкните мышью при нажатой клавише SHIFT для размещения второго и третьего переключателей, учитывая при этом рекомендуемый интервал между этими компонентами. Перед размещением последнего компонента "JRadioButton" отпустите клавишу SHIFT.
-[start=5]
+
. Установите отображаемый текст для каждого переключателя "JRadioButton". (Для изменения текста кнопки щелкните кнопку правой кнопкой мыши и выберите "Edit Text". В качестве альтернативы можно щелкнуть кнопку, выдержать паузу и щелкнуть еще раз.) Введите значение `HTML` для крайнего переключателя слева, `Plain Text ` для второго переключателя и `Custom` для третьего.
Итак, в форму добавлены три компонента "JRadioButton", которые расположены под компонентом "JLabel" ``Mail Format`` с требуемым отступом.
@@ -709,7 +709,7 @@
--
-[start=5]
+
. Для сохранения файла нажмите сочетание клавиш CTRL+S.
@@ -736,13 +736,13 @@
--
-[start=4]
+
. Добавьте еще одну кнопку "JButton" слева от первой с учетом необходимого пространства до нижнего края компонента "JFrame".
-[start=5]
+
. Установите отображаемый текст для каждой кнопки "JButton". Введите значение ``ОК`` для левой кнопки и ``Cancel`` для правой. Обратите внимание, что ширина кнопок изменяется для размещения новых имен.
-[start=6]
+
. Настройте сохранение одинакового размера для кнопок "JButton". Для этого выделите обе кнопки, щелкните правой кнопкой мыши одну из них и выберите "Одинаковый размер" > "Одинаковая ширина" во всплывающем меню.
[.feature]
@@ -753,7 +753,7 @@
Компоненты ``JButton`` появляются в форме, и соответствующие им узлы отображаются в окне "Навигатор". К исходному файлу формы также будет добавлен код компонентов ``JButton`` , что отображается в представлении "Source" редактора. Размер кнопок "JButton" будет скорректирован по размеру кнопки с самым длинным именем.
-[start=7]
+
. Для сохранения файла нажмите сочетание клавиш CTRL+S.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_zh_CN.asciidoc
index 05675db..dfabe4c 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart-gui_zh_CN.asciidoc
@@ -86,13 +86,13 @@
1. 在“项目”窗口中,右键单击 ``ContactEditor`` 节点,然后选择“新建”>“JFrame 窗体”。
此外,也可以选择“新建”>“其他”>“Swing GUI 窗体”>“JFrame 窗体”以查找 JFrame 窗体。
-[start=2]
+
. 输入 ``ContactEditorUI`` 作为类名。
-[start=3]
+
. 在“包”中输入 ``my.contacteditor`` 。
-[start=4]
+
. 单击“完成”。
IDE 在 ``ContactEditorUI.java`` 应用程序内创建 ``ContactEditorUI`` 窗体和 ``ContactEditorUI`` 类,并在 GUI 构建器中打开 ``ContactEditorUI`` 窗体。请注意, ``my.contacteditor`` 包取代了默认包。
@@ -399,7 +399,7 @@
JTextField 的右边缘将与 JPanel 的边缘对齐,并留出建议的边缘边距;同时,GUI 构建器会推断出合适的大小调整行为。
-[start=3]
+
. 按 Ctrl-S 组合键保存该文件。
@@ -512,7 +512,7 @@
--
-[start=3]
+
. 按 Ctrl-S 组合键保存该文件。
@@ -555,7 +555,7 @@
JTextField 在 ``E-mail Address:`` JLabel 的右侧对齐放置并链接到该 JLabel。"Inspector"(检查器)窗口中也将添加与其对应的节点。
-[start=3]
+
. 将 JTextField 的大小调整控柄向封闭 JPanel 的右侧拖动,直到出现对齐基准线以给出 JTextField 和 JPanel 边缘之间的建议偏移。
JTextField 的右边缘将与指示首选边距的对齐基准线对齐。
@@ -611,7 +611,7 @@
--
-[start=3]
+
. 将光标移到底部 JPanel 中 JList 的右上角。当出现基准线指示 JButton 的上边缘和右边缘与 JList 的上边缘和右边缘对齐时,请按住 Shift 键单击鼠标,从而沿 JFrame 的右边缘放置第二个按钮。
[.feature]
@@ -620,7 +620,7 @@
--
-[start=4]
+
. 在已添加的两个 JButton 的下方再添加两个 JButton,以创建一个列。请确保按照建议的间距放置 JButton 并保持间距的一致性。如果在放置最后一个 JButton 前忘记松开 Shift 键,只需按 Esc 键即可。
[.feature]
@@ -629,7 +629,7 @@
--
-[start=5]
+
. 设置每个 JButton 的显示文本。(可以通过右键单击按钮并选择 "Edit Text"(编辑文本)来编辑按钮的文本。或者,也可以单击按钮,稍等片刻,然后再次单击按钮。)为最上面的按钮输入 `Add`,为第二个按钮输入 `Edit`,为第三个按钮输入 `Remove`,为第四个按钮输入 `As Default`。
JButton 组件在对齐基准线指定的位置对齐放置。按钮的宽度将会更改以适应新名称。
@@ -680,10 +680,10 @@
--
-[start=4]
+
. 将光标移到第一个 JRadioButton 的右侧。按住 Shift 键单击鼠标以放置第二个和第三个 JRadioButton,同时注意保持建议的组件间距。请确保在放置最后一个 JRadioButton 前松开 Shift 键。
-[start=5]
+
. 设置每个 JRadioButton 的显示文本。(可以通过右键单击按钮并选择 "Edit Text"(编辑文本)来编辑按钮的文本。或者,也可以单击按钮,稍等片刻,然后再次单击按钮。)为左侧的单选按钮输入 `HTML`,为第二个单选按钮输入 `Plain Text`,为第三个单选按钮输入 `Custom`。
三个 JRadioButton 将添加到窗体中,并且缩进在 ``Mail Format`` JLabel 的下方。
@@ -714,7 +714,7 @@
--
-[start=5]
+
. 按 Ctrl-S 组合键保存该文件。
@@ -742,13 +742,13 @@
--
-[start=4]
+
. 将另一个 JButton 添加到第一个 JButton 的左侧,同时确保按照与 JFrame 下边缘的建议间距放置它。
-[start=5]
+
. 设置每个 JButton 的显示文本。为左侧按钮输入 ``OK`` ,为右侧按钮输入 ``Cancel`` 。请注意,按钮的宽度将会更改以适应新名称。
-[start=6]
+
. 将两个 JButton 设置为相同大小,方法是:选中它们,右键单击其中任何一个,然后从弹出式菜单中选择 "Same Size"(相同大小)> "Same Width"(相同宽度)。
[.feature]
@@ -759,7 +759,7 @@
``JButton`` 组件将出现在窗体中,且 "Navigator"(导航器)窗口中将显示与其对应的节点。 ``JButton`` 组件的代码也将添加到窗体的源文件中,可以在编辑器的 "Source"(源)视图中查看该文件。每个 JButton 的大小将被设置为与名称最长的按钮的大小相同。
-[start=7]
+
. 按 Ctrl-S 组合键保存该文件。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart.asciidoc
index 300ffb2..1481ad6 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart.asciidoc
@@ -45,7 +45,7 @@
1. In the IDE, choose File > New Project or click the "New Project" button in the toolbar.
-[start=2]
+
. In the New Project wizard, select Java Application, as shown in the figure below. Then click Next.
[.feature]
@@ -57,7 +57,7 @@
-[start=3]
+
. In the Name and Location page of the wizard, type `HelloWorldApp` in the Project Name field, (as shown in the figure below):
[.feature]
@@ -106,11 +106,11 @@
1. Between the braces, type `psvm` and press kbd:[Tab]. You should now see `public static void main` statement.
-[start=2]
+
. Within the `public static void main` statement, type `sout` and press kbd:[Tab]. You should now see a `System.out.println` statement.
-[start=3]
+
. Within the quotation marks, type `hello world`.
You should now see the following:
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart_ca.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart_ca.asciidoc
index 5250fd1..66b18c8 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart_ca.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart_ca.asciidoc
@@ -69,10 +69,10 @@
image::images/new-proj.png[]
-[start=3]
+
. En l'assistent de Nou projecte, expandiu la categoria Java i seleccioneu Aplicació Java, tal com es mostra en la següent figura. Després cliqueu a Següent. image::images/proj-wizard.png[]
-[start=4]
+
. En la pàgina del nom i la localització de l'assistent, feu el següent (com es mostra en la següent figura):
* En el camp del nom del projecte, escriviu `HelloWorldApp`.
* Deixeu sense marcar la casella de selecció, Utilitzar una carpeta dedicada per a emmagatzemar les biblioteques.
@@ -82,7 +82,7 @@
image::images/proj-wizard2.png[]
-[start=5]
+
. Cliqueu a Finalitzar
Es crea el projecte i s'obre a l'IDE. Hauríeu de visualitzar els següent components:
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart_ja.asciidoc
index ed3c5ae..0e49ef0 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart_ja.asciidoc
@@ -62,7 +62,7 @@
image::images/new-proj.png[]
-[start=3]
+
. 次の図に示すように、新規プロジェクト・ウィザードの「Java」カテゴリを展開し、「Javaアプリケーション」を選択します。「次」をクリックします。
[.feature]
@@ -71,7 +71,7 @@
--
-[start=4]
+
. ウィザードの名前と場所ページで、次の操作を行います(次の図を参照)。
* 「プロジェクト名」フィールドに`HelloWorldApp`と入力します。
* 「ライブラリの格納用に専用フォルダを使用」チェックボックスは選択されていない状態のままにします。
@@ -83,7 +83,7 @@
--
-[start=5]
+
. 「終了」をクリックします。
IDEでプロジェクトが作成され、表示されます。次のコンポーネントが表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart_pt_BR.asciidoc
index f783e70..321a509 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart_pt_BR.asciidoc
@@ -62,7 +62,7 @@
image::images/new-proj.png[]
-[start=3]
+
. No assistente Novo Projeto, expanda a categoria Java e selecione Aplicação Java, como mostrado na figura abaixo. Em seguida, clique em Próximo.
[.feature]
@@ -71,7 +71,7 @@
--
-[start=4]
+
. Na página Nome e Localização do assistente, adote o procedimento a seguir (como mostrado na figura abaixo):
* no campo Nome do Projeto, digite `HelloWorldApp`.
* Deixe desmarcada a caixa de seleção Utilizar Pasta Dedicada para Armazenar Bibliotecas.
@@ -83,7 +83,7 @@
--
-[start=5]
+
. Clique em Finalizar.
O projeto é criado e aberto no IDE. Agora você deve ver os seguintes componentes:
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart_ru.asciidoc
index b245315..04d361d 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart_ru.asciidoc
@@ -62,7 +62,7 @@
image::images/new-proj.png[]
-[start=3]
+
. В мастере создания проекта разверните категорию "Java" и выберите "Приложение Java". Затем нажмите кнопку "Дальше".
[.feature]
@@ -71,7 +71,7 @@
--
-[start=4]
+
. На странице мастера "Имя и местоположение" выполните следующие действия (см. рисунок ниже):
* введите `HelloWorldApp` в поле "Имя проекта";
* Не устанавливайте флажок "Использовать отдельную папку для хранения библиотек".
@@ -83,7 +83,7 @@
--
-[start=5]
+
. Нажмите кнопку "Завершить".
Проект будет создан и открыт в среде IDE. На экране должны быть представлены следующие элементы:
diff --git a/netbeans.apache.org/src/content/kb/docs/java/quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/quickstart_zh_CN.asciidoc
index 12528be..82767f0 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/quickstart_zh_CN.asciidoc
@@ -62,7 +62,7 @@
image::images/new-proj.png[]
-[start=3]
+
. 在新建项目向导中,展开 "Java" 类别,然后选择 "Java Application"(Java 应用程序),如下图所示。然后,单击 "Next"(下一步)。
[.feature]
@@ -71,7 +71,7 @@
--
-[start=4]
+
. 在向导的 "Name and Location"(名称和位置)页中,执行以下操作(如下图所示):
* 在 "Project Name"(项目名称)字段中,键入 `HelloWorldApp`。
* 将 "Use Dedicated Folder for Storing Libraries"(使用专用文件夹存储库)复选框保留为取消选中状态。
@@ -83,7 +83,7 @@
--
-[start=5]
+
. 单击 "Finish"(完成)。
此时将创建项目并在 IDE 中打开。此时,您应该看到以下组件:
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events.asciidoc
index 89b53fb..43db758 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events.asciidoc
@@ -36,13 +36,13 @@
1. link:cdi-intro.html[+Getting Started with CDI and JSF 2.0+]
-[start=2]
+
. link:cdi-inject.html[+Working with Injection and Qualifiers in CDI+]
-[start=3]
+
. link:cdi-validate.html[+Applying @Alternative Beans and Lifecycle Annotations+]
-[start=4]
+
. *Working with Events in CDI*
* <<event,Utilizing Events>>
* <<scopes,Handling Scopes>>
@@ -109,7 +109,7 @@
----
We inject an instance of an `Event` where the event payload will be an `Item`. The event payload is the state data passed from the event producer to the event observer which in this case passes the rejected Item. When the invalid item is handled, we fire the event and pass in the invalid item we received. This event based item handler is injected the same as any other item handler would be so we can swap it in and out whenever we need to and also can substitute it during testing.
-[start=7]
+
. Fix all imports. Either right-click in the editor and choose Fix Imports, or press Ctrl-Shift-I (⌘-Shift-I on Mac). Be sure to select `javax.enterprise.event.Event` as the fully qualified name to the `Event` class.
image::images/fix-all-imports.png[title="Right-click in the editor and choose Fix Imports to invoke the Fix Imports dialog"]
@@ -119,19 +119,19 @@
image::images/event-javadoc.png[title="Press Ctrl-Space to view Javadoc documentation on classes in the API"]
-[start=8]
+
. Create a qualifier named `Notify`. (Qualifiers were discussed in link:cdi-inject.html[+Working with Injection and Qualifiers in CDI+].)
-[start=9]
+
. Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=10]
+
. Select the Context and Dependency Injection category, then select Qualifier Type. Click Next.
-[start=11]
+
. Enter *Notify* as the class name, then enter *exercise4* as the package.
-[start=12]
+
. Click Finish. The new `Notify` qualifier opens in the editor.
[source,java]
@@ -144,7 +144,7 @@
}
----
-[start=13]
+
. Add the `@Notify` annotation to `EventItemHandler`.
[source,java]
@@ -158,7 +158,7 @@
----
We created a `@Notify` qualifier annotation to identify this error handler for injection and can use it in our `ItemProcessor` by adding it to the injection point.
-[start=14]
+
. Add the `@Notify` annotation to `EventItemHandler`'s injection point in `exercise2.ItemProcessor`.
[source,java]
@@ -189,17 +189,17 @@
----
(Use the editor's hint to add the import statement for `exercise4.Notify`.)
-[start=15]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button to run the project.
-[start=16]
+
. In the browser, click the '`Execute`' button, then return to the IDE and examine the server log in the Output window (Ctrl-4; ⌘-4 on Mac). Because the application that you have been building currently uses the `DefaultItemDao` to set up four `Item`s, then applies the `RelaxedItemValidator` on the `Item`s, you expect to see the `itemErrorHandler` fire twice.
image::images/output-window.png[title="View the GlassFish server log displayed in Output window"]
Currently though, we don't have anything observing the event. We can fix this by creating an _observer_ method using the `@Observes` annotation. This is the only thing needed to observe an event. To demonstrate, we can modify the `FileErrorReporter` (created in the link:cdi-validate.html[+previous tutorial+]) to respond to fired events by adding an observer method that calls its `handleItem()` method.
-[start=17]
+
. To make our `FileErrorReporter` respond to the event, add the following method to the class.
[source,java]
@@ -216,7 +216,7 @@
----
(Use the editor's hint to add an import statement for `javax.enterprise.event.Observes`.)
-[start=18]
+
. Run the project (F6; fn-F6 on Mac) again, click the '`Execute`' button, then return to the IDE and examine the server log in the Output window.
image::images/output-window2.png[title="View the GlassFish server log displayed in Output window"]
@@ -252,7 +252,7 @@
image::images/code-completion.png[title="Press Ctrl-Space when typing to invoke code completion suggestions"]
-[start=2]
+
. Run the project (F6; fn-F6 on Mac) again, click the '`Execute`' button, then return to the IDE and examine the server log in the Output window.
image::images/output-window3.png[title="View the GlassFish server log displayed in Output window"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ja.asciidoc
index e21e8d6..0526f2f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ja.asciidoc
@@ -104,7 +104,7 @@
----
イベント・ペイロードが`Item`になる`Event`のインスタンスを注入します。イベント・ペイロードとはイベント・プロデューサからイベント・オブザーバに渡される状態データのことで、この場合は却下されたItemが渡されます。無効な項目が処理されたら、イベントを起動して、受け取った無効な項目を渡します。このイベント・ベースの項目ハンドラは、他の項目ハンドラと同じように注入されるため、いつでも必要なときに交換したり、テスト中に取り換えたりできます。
-[start=7]
+
. すべてのインポートを修正します。エディタを右クリックして「インポートを修正」を選択するか、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押します。必ず`Event`クラスの完全修飾名として`javax.enterprise.event.Event`を選択するようにしてください。
image::images/fix-all-imports.png[title="エディタで右クリックして「インポートを修正」を選択し、「インポートを修正」ダイアログを呼び出す"]
@@ -114,19 +114,19 @@
image::images/event-javadoc.png[title="Ctrl-Space を押して、APIのクラスのJavadocドキュメントを表示する"]
-[start=8]
+
. `Notify`という名前の修飾子を作成します。(修飾子についてはlink:cdi-inject.html[+CDIの注入および修飾子の操作+]に記載。)
-[start=9]
+
. 「新規ファイル」(image:images/new-file-btn.png[])ボタンをクリックするか、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押してファイル・ウィザードを開きます。
-[start=10]
+
. 「コンテキストと依存性の注入」カテゴリから「修飾子タイプ」を選択します。「次」をクリックします。
-[start=11]
+
. クラス名として「*Notify*」、パッケージとして「*exercise4*」と入力します。
-[start=12]
+
. 「終了」をクリックします。新しい`Notify`修飾子がエディタで開きます。
[source,java]
@@ -139,7 +139,7 @@
}
----
-[start=13]
+
. `EventItemHandler`に`@Notify`注釈を追加します。
[source,java]
@@ -153,7 +153,7 @@
----
このエラー・ハンドラを注入のために識別し、`ItemProcessor`で注入ポイントに追加して使用できる`@Notify`修飾子注釈を作成しました。
-[start=14]
+
. `exercise2.ItemProcessor`で、`EventItemHandler`の注入ポイントに`@Notify`注釈を追加します。
[source,java]
@@ -184,17 +184,17 @@
----
(エディタのヒントを使用して`exercise4.Notify`のインポート文を追加します。)
-[start=15]
+
. 「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックして、プロジェクトを実行します。
-[start=16]
+
. ブラウザで「`Execute`」ボタンをクリックしてからIDEに戻り、「出力」ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])でサーバー・ログを調べます。ビルドしてきたアプリケーションは、現時点で`DefaultItemDao`を使用して4つの`Item`を設定してから`Item`に`RelaxedItemValidator`を適用するため、`itemErrorHandler`が2度起動するのが確認できるはずです。
image::images/output-window.png[title="「出力」ウィンドウに表示されたGlassFishサーバー・ログの確認"]
しかし、現時点ではイベントを監視しているものはありません。これは、`@Observes`注釈を使用して_オブザーバ_・メソッドを作成すれば修正できます。イベントを監視するために必要な手順はこれのみです。これを示すため、`FileErrorReporter` (link:cdi-validate.html[+前のチュートリアル+]で作成)にこの`handleItem()`メソッドをコールするオブザーバ・メソッドを追加して、起動されたイベントに応答するように変更できます。
-[start=17]
+
. `FileErrorReporter`がイベントに応答するようにするには、クラスに次のメソッドを追加します。
[source,java]
@@ -211,7 +211,7 @@
----
(エディタのヒントを使用して`javax.enterprise.event.Observes`のインポート文を追加します。)
-[start=18]
+
. 再びプロジェクトを実行([F6]、Macの場合は[fn]-[F6])し、「`Execute`」ボタンをクリックしてからIDEに戻り、「出力」ウィンドウでサーバー・ログを調べます。
image::images/output-window2.png[title="「出力」ウィンドウに表示されたGlassFishサーバー・ログの確認"]
@@ -247,7 +247,7 @@
image::images/code-completion.png[title="入力中に [Ctrl]-[Space]を押してコード補完の候補を呼び出す"]
-[start=2]
+
. 再びプロジェクトを実行([F6]、Macの場合は[fn]-[F6])し、「`Execute`」ボタンをクリックしてからIDEに戻り、「出力」ウィンドウでサーバー・ログを調べます。
image::images/output-window3.png[title="「出力」ウィンドウに表示されたGlassFishサーバー・ログの確認"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_pt_BR.asciidoc
index 2d962ad..72131d1 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_pt_BR.asciidoc
@@ -106,7 +106,7 @@
----
Injetamos uma instância de um `Event` em que a carga do evento será um `Item`. A carga do evento são os dados de estado passados do produtor de evento para o observador de evento que, nesse caso, passa o item rejeitado. Quando o item inválido é tratado, nós acionamos o evento e passamos no item inválido que recebemos. Esse handler de item com base em evento é injetado da mesma maneira que qualquer outro handler de item seria e, portanto, podemos colocá-lo ou tirá-lo sempre que precisarmos e também podemos substituí-lo durante os testes.
-[start=7]
+
. Corrigir todas as importações. Clique com o botão direito do mouse no editor e selecione Corrigir importações ou pressione Ctrl-Shift-I (⌘-Shift-I no Mac). Certifique-se de selecionar `javax.enterprise.event.Event` como o nome completamente qualificado para a classe `Event`.
image::images/fix-all-imports.png[title="Clique com o botão direito do mouse no Editor e escolha corrigir importa para chamar a caixa de diálogo Importações de Correção"]
@@ -116,19 +116,19 @@
image:images/event-javadoc.png[title="Pressione CTRL-Espaço para exibir documentação de Javadoc em classes na API"]
-[start=8]
+
. Crie um nome qualificador `Notify`. (Qualificadores foram discutidos em link:cdi-inject.html[+Trabalhando com Injeção e Qualificadores no CDI+].)
-[start=9]
+
. Clique no botão Novo Arquivo (image:images/new-file-btn.png[]) ou pressione CTRL-N (⌘-N no Mac) para abrir o assistente de Arquivo.
-[start=10]
+
. Selecione a categoria Injeção de Dependência e Contexto e, em seguida, selecione Tipo de Qualificador. Clique em Próximo.
-[start=11]
+
. Digite *Notify* como o nome da classe e, em seguida, digite *exercise4* como o pacote.
-[start=12]
+
. Clique em Finalizar. O novo qualificador `Notify` será aberto no editor.
[source,java]
@@ -141,7 +141,7 @@
}
----
-[start=13]
+
. Adicione a anotação `@Notify` a `EventItemHandler`.
[source,java]
@@ -155,7 +155,7 @@
----
Criamos uma anotação de qualificador `@Notify` para identificar esse handler de erros para injeção e podemos utilizá-lo em nosso `ItemProcessor` adicionando-o ao ponto de injeção.
-[start=14]
+
. Adicione a anotação `@Notify` ao ponto de injeção do `EventItemHandler` no `exercise2.ItemProcessor`.
[source,java]
@@ -186,17 +186,17 @@
----
(Utilize a dica do editor para adicionar a instrução de importação para `exercise4.Notify`.)
-[start=15]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) para executar o projeto.
-[start=16]
+
. No browser, clique no botão "`Execute`" e, em seguida, retorne para o IDE e examine o log do servidor na janela Saída (Ctrl-4; ⌘-4 no Mac). Como a aplicação que você tem construído atualmente utiliza o `DefaultItemDao` para configurar quatro `Item`s, e, em seguida, aplica o `RelaxedItemValidator` nos `Iten`s, é esperado ver o acionamento de `itemErrorHandler` duas vezes.
image::images/output-window.png[title="Exibir o log do GlassFish Server exibido na janela Saída"]
Atualmente, no entanto, não temos nada observando o evento. Podemos corrigir isso criando um método _observador_ utilizando a anotação `@Observes`. Essa é a única coisa necessária para observar um evento. Para demonstrar, podemos modificar o `FileErrorReporter` (criado no link:cdi-validate.html[+tutorial anterior+]) para responder a eventos acionados adicionando um método observador que chama seu método `handleItem()`.
-[start=17]
+
. Para fazer nosso `FileErrorReporter` responder ao evento, adicione o seguinte método à classe.
[source,java]
@@ -213,7 +213,7 @@
----
(Utilize a dica do editor para adicionar uma instrução de importação para `javax.enterprise.event.Observes`.)
-[start=18]
+
. Execute o projeto (F6; fn-F6 no Mac) novamente, clique no botão "`Execute`" e, em seguida, retorne para o IDE e examine o log do servidor na janela Saída.
image::images/output-window2.png[title="Exibir o log do GlassFish Server exibido na janela Saída"]
@@ -249,7 +249,7 @@
image::images/code-completion.png[title="Pressione Ctrl-Espaço ao digitar para chamar sugestões de autocompletar código"]
-[start=2]
+
. Execute o projeto (F6; fn-F6 no Mac) novamente, clique no botão "`Execute`" e, em seguida, retorne para o IDE e examine o log do servidor na janela Saída.
image::images/output-window3.png[title="Exibir o log do GlassFish Server exibido na janela Saída"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ru.asciidoc
index ddff293..eb89837 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_ru.asciidoc
@@ -104,7 +104,7 @@
----
Мы внедряем экземпляр `Event`, где информационным наполнением события будет `Item`. Информационным наполнением события являются данные состояния, передаваемые от производителя событий в наблюдатель событий, который в данном случае передает отклоненный элемент. При обработке недопустимого элемента мы инициируем событие и передаем полученный недопустимый элемент. Обработчик элементов на базе событий внедряется таким же образом, как любой другой обработчик элементов, поэтому его можно загружать и выгружать по мере необходимости, а также заменять во время тестирования.
-[start=7.]
+
. Исправление всех операторов импорта. Либо щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' или нажмите Ctrl-Shift-I (⌘-Shift-I в Mac). Убедитесь в том, что `javax.enterprise.event.Event` выбрано в качестве полного имени для класса `Event`.
image::images/fix-all-imports.png[title="Щелкните в редакторе правой кнопкой мыши и выберите "Исправить операторы импорта". "]
@@ -114,19 +114,19 @@
image::images/event-javadoc.png[title="Нажмите Ctrl-Space для просмотра документации Javadoc по классам в API"]
-[start=8.]
+
. Создайте квалификатор с именем `Notify`. (Квалификаторы были рассмотрены в разделе link:cdi-inject.html[+Работа со внедрением и квалификаторами в CDI+].)
-[start=9.]
+
. Щелкните 'Создать файл' ( image:images/new-file-btn.png[] ) или нажмите сочетание клавиш CTRL+N (⌘-N on Mac) для открытия мастера создания файлов.
-[start=10.]
+
. Выберите категорию "Внедрение контекстов и зависимостей", затем выберите "Тип "квалификатора". Нажмите кнопку "Далее".
-[start=11.]
+
. Введите *Notify* в качестве имени класса, затем укажите *exercise4* в качестве пакета.
-[start=12.]
+
. Нажмите кнопку "Завершить". Новый квалификатор `Notify` открывается в редакторе.
[source,java]
@@ -139,7 +139,7 @@
}
----
-[start=13.]
+
. Добавьте аннотацию `@Notify` к `EventItemHandler`.
[source,java]
@@ -153,7 +153,7 @@
----
Мы создали аннотацию квалификатора `@Notify`, чтобы определить обработчик ошибок для внедрения, и можем ее использовать в `ItemProcessor` путем добавления к точке внедрения.
-[start=14.]
+
. Добавьте аннотацию `@Notify` к точке внедрения`EventItemHandler` в `exercise2.ItemProcessor`.
[source,java]
@@ -184,17 +184,17 @@
----
Используйте подсказку редактора, чтобы добавить оператор импорта для `exercise4.Notify`.
-[start=15.]
+
. Для запуска проекта нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ).
-[start=16.]
+
. В браузере нажмите кнопку `Выполнить`, затем вернитесь в среду IDE и проверьте протокол сервера в окне вывода (Ctrl-4; ⌘-4 в Mac). Поскольку в создаваемом приложении в настоящий момент используется `DefaultItemDao` для настройки четырех элементов `Item`, затем применяется `RelaxedItemValidator` в элементах `Item`, ожидается, что инициирование`itemErrorHandler` произойдет дважды.
image::images/output-window.png[title="Просмотрите журнал сервера GlassFish, отображенный в окне вывода"]
Однако в настоящее время отсутствует наблюдение за событием. Это можно исправить путем создания метода _наблюдателя_ с помощью аннотации `@Observes`. Это единственное, что нужно для наблюдения за событием. Для демонстрации можно изменить класс `FileErrorReporter` (созданный в link:cdi-validate.html[+предыдущем учебном курсе+]), реагирующий на инициированные события, путем добавления метода наблюдателя, который вызывает метод `handleItem()`.
-[start=17.]
+
. Для создания ответа `FileErrorReporter` на событие добавьте следующий метод к классу.
[source,java]
@@ -211,7 +211,7 @@
----
Используйте подсказку редактора, чтобы добавить оператор импорта для `javax.enterprise.event.Observes`.
-[start=18.]
+
. Запустите проект еще раз (нажмите клавишу F6; fn+F6 на компьютерах Mac), нажмите кнопку `Выполнить`, затем вернитесь в среду IDE и проверьте протокол сервера в окне вывода.
image::images/output-window2.png[title="Просмотрите журнал сервера GlassFish, отображенный в окне вывода"]
@@ -248,7 +248,7 @@
image::images/code-completion.png[title="Нажмите сочетание клавиш CTRL+ПРОБЕЛ при вводе, чтобы вызвать поддержку автозавершения кода в редакторе. "]
-[start=2.]
+
. Запустите проект еще раз (нажмите клавишу F6; fn+F6 на компьютерах Mac), нажмите кнопку `Выполнить`, затем вернитесь в среду IDE и проверьте протокол сервера в окне вывода.
image::images/output-window3.png[title="Просмотрите журнал сервера GlassFish, отображенный в окне вывода"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_zh_CN.asciidoc
index 36f05f4..ab83847 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-events_zh_CN.asciidoc
@@ -104,7 +104,7 @@
----
我们会注入 `Event` 实例,其中事件有效负载为 `Item`。事件有效负载是指从事件生成器传递到事件观察器的状态数据,在本例中传递的是已拒绝的项。当处理无效项时,我们会引发事件并传入接收的无效项。此基于事件的项处理程序的插入方式与其他任何项处理程序的方式相同,因此我们可以在任何需要的时候将其换入换出,还可以在测试过程中进行替换。
-[start=7.]
+
. 修复所有导入。在编辑器中右键单击并选择 "Fix Imports"(修复导入),或者按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)。请务必选择 `javax.enterprise.event.Event` 作为 `Event` 类的全限定名称。
image::images/fix-all-imports.png[title="右键单击编辑器,然后选择 "Fix Imports"(修复导入)以调出 "Fix Imports"(修复导入)对话框"]
@@ -114,19 +114,19 @@
image::images/event-javadoc.png[title="按 Ctrl-空格键可查看有关 API 中类的 Javadoc 文档"]
-[start=8.]
+
. 创建一个限定符,名为 `Notify`。(link:cdi-inject.html[+使用 CDI 中的注入和限定符+]对限定符进行了介绍。)
-[start=9.]
+
. 单击 "New File"(新建文件)(image:images/new-file-btn.png[]) 按钮,或者按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)以打开文件向导。
-[start=10.]
+
. 选择 "Context and Dependency Injection"(上下文和依赖关系注入)类别,然后选择 "Qualifier Type"(限定符类型)。单击 "Next"(下一步)。
-[start=11.]
+
. 输入 *Notify* 作为类名,然后输入 *exercise4* 作为包。
-[start=12.]
+
. 单击 "Finish"(完成)。新的 `Notify` 限定符在编辑器中打开。
[source,java]
@@ -139,7 +139,7 @@
}
----
-[start=13.]
+
. 将 `@Notify` 标注添加到 `EventItemHandler`。
[source,java]
@@ -153,7 +153,7 @@
----
我们创建了一个 `@Notify` 限定符标注为注入标识此错误处理程序,并可以通过将其添加到注入点以在我们的 `ItemProcessor` 中使用。
-[start=14.]
+
. 在 `exercise2.ItemProcessor` 中,将 `@Notify` 标注添加到 `EventItemHandler` 的注入点。
[source,java]
@@ -184,17 +184,17 @@
----
(使用编辑器的提示为 `exercise4.Notify` 添加 import 语句。)
-[start=15.]
+
. 单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮以运行项目。
-[start=16.]
+
. 在浏览器中,单击 `Execute` 按钮,然后返回至 IDE,并在 "Output"(输出)窗口(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键)中查看服务器日志。因为已构建的应用程序目前使用 `DefaultItemDao` 设置四个 `Item`,然后在 `Item` 上应用 `RelaxedItemValidator`,您会看到 `itemErrorHandler` 引发两次。
image::images/output-window.png[title="查看显示在 "Output"(输出)窗口中的 GlassFish Server 日志"]
目前我们还无法观察事件。不过,可以通过使用 `@Observes` 标注创建 _observer_ 方法来解决此问题。只需执行此操作即可观察事件。为了进行演示,我们可以通过添加调用其 `handleItem()` 方法的观察器方法来修改 `FileErrorReporter`(已在link:cdi-validate.html[+上一教程+]中创建),以响应引发事件。
-[start=17.]
+
. 要使我们的 `FileErrorReporter` 响应事件,请向类中添加以下方法。
[source,java]
@@ -211,7 +211,7 @@
----
(使用编辑器的提示为 `javax.enterprise.event.Observes` 添加 import 语句。)
-[start=18.]
+
. 再次运行项目(F6;在 Mac 上为 fn-F6),单击 `Execute` 按钮,然后返回至 IDE 并检查 "Output"(输出)窗口中的服务器日志。
image::images/output-window2.png[title="查看显示在 "Output"(输出)窗口中的 GlassFish Server 日志"]
@@ -247,7 +247,7 @@
image::images/code-completion.png[title="在键入时按 Ctrl-空格键可调用代码完成建议"]
-[start=2.]
+
. 再次运行项目(F6;在 Mac 上为 fn-F6),单击 `Execute` 按钮,然后返回至 IDE 并检查 "Output"(输出)窗口中的服务器日志。
image::images/output-window3.png[title="查看显示在 "Output"(输出)窗口中的 GlassFish Server 日志"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject.asciidoc
index b817120..f3d0a9c 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject.asciidoc
@@ -41,10 +41,10 @@
* <<alternative,Alternative Injection Methods>>
* <<seealso,See Also>>
-[start=3]
+
. link:cdi-validate.html[+Applying @Alternative Beans and Lifecycle Annotations+]
-[start=4]
+
. link:cdi-events.html[+Working with Events in CDI+]
Contexts and Dependency Injection (CDI), specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], is an integral part of Java EE 6 and provides an architecture that allows Java EE components such as servlets, enterprise beans, and JavaBeans to exist within the lifecycle of an application with well-defined scopes. In addition, CDI services allow Java EE components such as EJB session beans and JavaServer Faces (JSF) managed beans to be injected and to interact in a loosely coupled way by firing and observing events.
@@ -88,31 +88,31 @@
DAO stands for _data access object_.
-[start=1]
+
. Begin by extracting the sample start project from the `cdiDemo.zip` file (See the <<requiredSoftware,table listing required resources>> above.) Open the project in the IDE by choosing File > Open Project (Ctrl-Shift-O; ⌘-Shift-O on Mac), then selecting the project from its location on your computer.
-[start=2]
+
. Right-click the project node in the Projects window and choose Properties.
-[start=3]
+
. Select the Run category and confirm that your GlassFish instance is selected in the Server dropdown list.
-[start=4]
+
. Create a new `Item` class, and store it in a new package named `exercise2`. Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=5]
+
. Select the Java category, then select Java Class. Click Next.
-[start=6]
+
. Enter *Item* as the class name, then type in *exercise2* as the package. (The new package is created upon completing the wizard.)
image::images/java-class-wizard.png[title="Create a new Java class using the File wizard"]
-[start=7]
+
. Click Finish. The new class and package are generated, and the `Item` class opens in the editor.
-[start=8]
+
. Create `value` and `limit` properties for the `Item` POJO, and implement the `toString()` method. Add the following content to the class.
[source,java]
@@ -130,19 +130,19 @@
}
----
-[start=9]
+
. Add getter and setter methods to the class. To do so, ensure that your cursor is placed between the class definition (i.e., between the class' curly brackets), then right-click in the editor and choose Insert Code (Alt-Insert; Ctrl-I on Mac). Choose Getter and Setter.
image::images/insert-code.png[title="Create getters and setters using the Insert Code popup"]
-[start=10]
+
. Select the `Item` check box (doing so selects all properties contained in the class).
image::images/generate-getters-setters.png[title="Select the class checkbox to select all properties contained in the class"]
-[start=11]
+
. Click Generate. Getter and setter methods are generated for the class.
[source,java]
@@ -176,7 +176,7 @@
}
----
-[start=12]
+
. Create a constructor that takes both `value` and `limit` arguments. Again, the IDE can assist with this. Press Ctrl-Space within the class definition and choose the '`Item(int value, int limit) - generate`' option.
image::images/generate-constructor.png[title="Press Ctrl-Space to utilize the editor's code completion facilities"]
@@ -199,22 +199,22 @@
...
----
-[start=13]
+
. Create an `ItemDao` interface to define how we get the list of `Item` objects. In this test application we anticipate using multiple implementations, so we will code to interfaces.
Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=14]
+
. Select the Java category, then select Java Interface. Click Next.
-[start=15]
+
. Type in *ItemDao* as the class name, then enter *exercise2* as the package.
-[start=16]
+
. Click Finish. The new interface is generated and opens in the editor.
-[start=17]
+
. Add a method called `fetchItems()` that returns a `List` of `Item` objects.
[source,java]
@@ -228,22 +228,22 @@
----
(Use the editor's hint to add the import statement for `java.util.List`.)
-[start=18]
+
. Create an `ItemProcessor` class. This is the main class that you will inject your beans into and execute the process from. For now, you will start with the DAO and look at how you will inject it into our processor bean.
Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=19]
+
. Select the Java category, then select Java Class. Click Next.
-[start=20]
+
. Type in *ItemProcessor* as the class name, then enter *exercise2* as the package. Click Finish.
The new class is generated and opens in the editor.
-[start=21]
+
. Modify the class as follows:
[source,java]
@@ -264,26 +264,26 @@
}
----
-[start=22]
+
. Fix imports. Either right-click in the editor and choose Fix Imports, or press Ctrl-Shift-I (⌘-Shift-I on Mac).
image::images/fix-imports.png[title="Right-click in the editor and choose Fix Imports to add import statements to the class"]
-[start=23]
+
. Click OK. Import statements for the following classes are required:
* `java.util.List`
* `javax.inject.Named`
* `javax.enterprise.context.RequestScoped`
-[start=24]
+
. Begin with a simple DAO that just creates a list of items and returns a fixed list of items.
In the Projects window, right-click the `exercise2` package node and choose New > Java Class. In the Java Class wizard, name the class `DefaultItemDao`. Click Finish.
image:images/java-class-wizard2.png[title="Create a new Java class using the Java Class wizard"]
-[start=25]
+
. In the editor, have `DefaultItemDao` implement the `ItemDao` interface, and provide an implementation of `fetchItems()`.
[source,java]
@@ -304,7 +304,7 @@
----
(Press Ctrl-Shift-I (⌘-Shift-I on Mac) to add import statements for `java.util.List` and `java.util.ArrayList`.)
-[start=26]
+
. Switch to the `ItemProcessor` class (press Ctrl-Tab). In order to inject the `DefaultItemDao` into `ItemProcessor`, we add the `javax.inject.Inject` annotation to the `ItemDao` field to indicate that this field is an injection point.
[source,java]
@@ -326,21 +326,21 @@
TIP: Utilize the editor's code completion support to add the `@Inject` annotation and import statement to the class. For example, type '`@Inj`', then press Ctrl-Space.#
-[start=27]
+
. Finally, we need some way to call the `execute()` method on the `ItemProcessor`. We can run this in a SE environment, but for now we'll keep it in a JSF page. Create a new page called `process.xhtml` that contains a button to call the `execute()` method.
Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=28]
+
. Select the JavaServer Faces category, then select JSF Page. Click Next.
-[start=29]
+
. Type in *process* as the file name, then click Finish.
image::images/new-jsf-page.png[title="Create a new Facelets page using the JSF file wizard"]
-[start=30]
+
. In the new `process.xhtml` file, add a button that is wired to the `ItemProcessor.execute()` method. Using EL, the default name for the managed bean is the same as the class name, but with the first letter being lower-case (i.e., `itemProcessor`).
[source,xml]
@@ -353,7 +353,7 @@
</h:body>
----
-[start=31]
+
. Before running the project, set the `process.xhtml` file as the new welcome page in the project's web deployment descriptor.
Use the IDE's Go to File dialog to quickly open the `web.xml` file. Choose Navigate > Go to File from the IDE's main menu (Alt-Shift-O; Ctrl-Shift-O on Mac), then type '`web`'.
@@ -361,7 +361,7 @@
image::images/go-to-file.png[title="Use the Go to File dialog to quickly locate a project file"]
-[start=32]
+
. Click OK. In the XML view of the `web.xml` file, make the following change.
[source,xml]
@@ -372,10 +372,10 @@
</welcome-file-list>
----
-[start=33]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button in the IDE's main toolbar. The project is compiled and deployed to GlassFish, and the `process.xhtml` file opens in the browser.
-[start=34]
+
. Click the '`Execute`' button that displays on the page. Switch back to the IDE and examine the GlassFish server log. The server log displays in the Output window (Ctrl-4; ⌘-4 on Mac) under the GlassFish Server tab. When the button is clicked, the log lists the items from our default DAO implementation.
image::images/output-window.png[title="Examine the server log in the IDE's Output window"]
@@ -422,13 +422,13 @@
Now that there are two classes that implement `ItemDao`, the choice is not so clear as to which bean we want to inject.
-[start=4]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button to run the project. Note that the project now fails to deploy.
You probably only need to save the file because the IDE will automatically deploy the project because Deploy on Save is enabled by default.
-[start=5]
+
. Examine the server log in the Output window (Ctrl-4; ⌘-4 on Mac). You see an error message similar to the following.
[source,java]
@@ -451,16 +451,16 @@
The IDE provides a wizard that enables you to generate CDI qualifiers.
-[start=6]
+
. Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=7]
+
. Select the Context and Dependency Injection category, then select Qualifier Type. Click Next.
-[start=8]
+
. Enter *Demo* as the class name, then enter *exercise2* as the package.
-[start=9]
+
. Click Finish. The new `Demo` qualifier opens in the editor.
[source,java]
@@ -491,7 +491,7 @@
Next you will add this qualifier to the default DAO implementation at the class level.
-[start=10]
+
. Switch to `DefaultItemDao` in the editor (press Ctrl-Tab), then type in '`@Demo`' above the class definition.
[source,java]
@@ -514,13 +514,13 @@
TIP: After typing '`@`', press Ctrl-Space to invoke code completion suggestions. The editor recognizes the `Demo` qualifier and lists `@Demo` as an option for code completion.#
-[start=11]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button to run the project. The project builds and deploys without errors.
NOTE: For this modification you might need to explicitly run the project to redeploy the application instead of incrementally deploying the changes.
-[start=12]
+
. In the browser, click the '`Execute`' button, then return to the IDE and examine the server log in the Output window. You see the following output.
[source,java]
@@ -534,7 +534,7 @@
Next you will add the `@Demo` annotation to the injection point in `ItemProcessor`.
-[start=13]
+
. Switch to `ItemProcessor` in the editor (press Ctrl-Tab), then make the following change.
[source,java]
@@ -556,7 +556,7 @@
}
----
-[start=14]
+
. In the browser, click the '`Execute`' button, then return to the IDE and examine the server log in the Output window. You see output from the default implementation (`DefaultItemDao`) again.
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ja.asciidoc
index db28b7e..d761fa7 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ja.asciidoc
@@ -41,10 +41,10 @@
* <<alternative,代替の注入方法>>
* <<seealso,関連項目>>
-[start=3]
+
. link:cdi-validate.html[+@Alternative Beanおよびライフサイクル注釈の適用+]
-[start=4]
+
. link:cdi-events.html[+CDIのイベントの操作+]
link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+]で指定されているコンテキストと依存性の注入(CDI: Contexts and Dependency Injection)はJava EE 6の不可欠な部分であり、サーブレット、エンタープライズBean、JavaBeansなどのJava EEコンポーネントが、アプリケーションのライフサイクル内で明確なスコープを持って存在できるようにするためのアーキテクチャを提供します。また、CDIサービスによって、EJBセッションBeanやJSF (JavaServer Faces)管理対象BeanなどのJava EEコンポーネントが注入可能になり、イベントの起動や監視による疎結合方式の対話が可能になります。
@@ -96,10 +96,10 @@
image::images/java-class-wizard.png[title="ファイル・ウィザードを使用した新しいJavaクラスの作成"]
-[start=7]
+
. 「終了」をクリックします。新しいクラスおよびパッケージが生成され、エディタで`Item`クラスが開きます。
-[start=8]
+
. POJOである`Item`に`value`および`limit`プロパティを作成して、`toString()`メソッドを実装します。次の内容をクラスに追加します。
[source,java]
@@ -117,19 +117,19 @@
}
----
-[start=9]
+
. 取得メソッドおよび設定メソッドをクラスに追加します。これを行うには、カーソルがクラス定義の間(クラスの中括弧の間)にあることを確認してからエディタ内で右クリックし、「コードを挿入」を選択します([Alt]-[Insert]、Macの場合は[Ctrl]-[I])。取得メソッドおよび設定メソッドを選択します。
image::images/insert-code.png[title="「コードを挿入」ポップアップを使用した取得メソッドおよび設定メソッドの作成"]
-[start=10]
+
. 「`Item`」チェックボックスを選択します(これで、クラスに含まれているプロパティがすべて選択されます)。
image::images/generate-getters-setters.png[title="クラスに含まれているすべてのプロパティを選択するためのクラスのチェックボックスの選択"]
-[start=11]
+
. 「生成」をクリックします。クラスの取得メソッドと設定メソッドが生成されます。
[source,java]
@@ -163,7 +163,7 @@
}
----
-[start=12]
+
. `value`と`limit`の両方の引数を取るコンストラクタを作成します。これにもIDEの支援機能を使用できます。クラス定義内で[Ctrl]-[Space]を押して、「`Item(int value, int limit) - 生成`」オプションを選択します。
image::images/generate-constructor.png[title="[Ctrl]-[Space]の押下によるエディタのコード補完機能の利用"]
@@ -186,22 +186,22 @@
...
----
-[start=13]
+
. `ItemDao`インタフェースを作成して、`Item`オブジェクトの一覧を取得する方法を定義します。このテスト・アプリケーションでは複数の実装を使用することを予定しているため、インタフェースへのコードを作成します。
「新規ファイル」(image:images/new-file-btn.png[])ボタンをクリックするか、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押してファイル・ウィザードを開きます。
-[start=14]
+
. 「Java」カテゴリから「Javaインタフェース」を選択します。「次」をクリックします。
-[start=15]
+
. クラス名として「*ItemDao*」、パッケージとして「*exercise2*」と入力します。
-[start=16]
+
. 「終了」をクリックします。新しいインタフェースが生成され、エディタで開かれます。
-[start=17]
+
. `Item`オブジェクトの`List`を返す`fetchItems()`という名前のメソッドを追加します。
[source,java]
@@ -215,22 +215,22 @@
----
(エディタのヒントを使用して`java.util.List`のインポート文を追加します。)
-[start=18]
+
. `ItemProcessor`クラスを作成します。これはメイン・クラスであり、ここにBeanを注入したり、ここからプロセスを実行したりします。今のところはDAOから始めて、プロセッサBeanにこれを注入する方法を見てみます。
「新規ファイル」(image:images/new-file-btn.png[])ボタンをクリックするか、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押してファイル・ウィザードを開きます。
-[start=19]
+
. 「Java」カテゴリから「Javaクラス」を選択します。「次」をクリックします。
-[start=20]
+
. クラス名として「*ItemProcessor*」、パッケージとして「*exercise2*」と入力します。「終了」をクリックします。
新しいクラスが生成され、エディタで開かれます。
-[start=21]
+
. 次のようにクラスを変更します。
[source,java]
@@ -251,19 +251,19 @@
}
----
-[start=22]
+
. インポートを修正します。エディタを右クリックして「インポートを修正」を選択するか、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押します。
image::images/fix-imports.png[title="エディタで右クリックして「インポートを修正」を選択し、クラスにインポート文を追加する"]
-[start=23]
+
. 「OK」をクリックします。次のクラスのインポート文が必要になります。
* `java.util.List`
* `javax.inject.Named`
* `javax.enterprise.context.RequestScoped`
-[start=24]
+
. 項目の一覧を作成して、決まった項目の一覧を返すのみの単純なDAOから始めます。
「プロジェクト」ウィンドウで「`exercise2`」パッケージ・ノードを右クリックし、「新規」>「Javaクラス」を選択します。新規Javaクラス・ウィザードで、クラス名を「`DefaultItemDao`」にします。「終了」をクリックします。
@@ -271,7 +271,7 @@
image::images/java-class-wizard2.png[title="Javaクラス・ウィザードを使用した新しいJavaクラスの作成"]
-[start=25]
+
. エディタで、`DefaultItemDao`に`ItemDao`インタフェースを実装させて、`fetchItems()`を実装します。
[source,java]
@@ -292,7 +292,7 @@
----
[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押して、`java.util.List`および`java.util.ArrayList`のインポート文を追加します。
-[start=26]
+
. `ItemProcessor`クラスに切り替えます([Ctrl]-[Tab]を押します)。`ItemProcessor`に`DefaultItemDao`を注入するために、`ItemDao`フィールドに`javax.inject.Inject`注釈を追加して、このフィールドが注入ポイントであることを示します。
[source,java]
@@ -314,21 +314,21 @@
TIP: エディタのコード補完サポートを利用して、クラスに`@Inject`注釈およびインポート文を追加します。たとえば、「`@Inj`」と入力してから[Ctrl]-[Space]を押します。#
-[start=27]
+
. 最後に、`ItemProcessor`で`execute()`メソッドをコールするためのなんらかの方法が必要です。これはSE環境なら実行できますが、今のところはJSFページ内にとどめておきます。`execute()`メソッドをコールするボタンを含む`process.xhtml`という名前の新しいページを作成します。
「新規ファイル」(image:images/new-file-btn.png[])ボタンをクリックするか、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押してファイル・ウィザードを開きます。
-[start=28]
+
. 「JavaServer Faces」カテゴリを選択し、「JSFページ」を選択します。「次」をクリックします。
-[start=29]
+
. ファイル名として「*process*」と入力してから「終了」をクリックします。
image::images/new-jsf-page.png[title="JSFファイル・ウィザードを使用した新しい「Facelets」ページの作成"]
-[start=30]
+
. 新しい`process.xhtml`ファイルで、`ItemProcessor.execute()`メソッドに接続されたボタンを追加します。ELを使用する場合、管理対象Beanのデフォルト名は、クラス名の最初の文字を小文字にした名前(つまり`itemProcessor`)になります。
[source,xml]
@@ -341,7 +341,7 @@
</h:body>
----
-[start=31]
+
. プロジェクトを実行する前に、`process.xhtml`ファイルをプロジェクトのWebデプロイメント・ディスクリプタの新しい開始ページに設定します。
IDEの「ファイルに移動」ダイアログを使用すると、すばやく`web.xml`を開けます。IDEのメイン・メニューで「ナビゲート」>「ファイルに移動」([Alt]-[Shift]-[O]、Macの場合は[Ctrl]-[Shift]-[O])を選択してから「`web`」と入力します。
@@ -349,7 +349,7 @@
image::images/go-to-file.png[title="「ファイルに移動」ダイアログを使用した、プロジェクト・ファイルの速やかな検索"]
-[start=32]
+
. 「OK」をクリックします。`web.xml`ファイルの「XML」ビューで、次のように変更します。
[source,xml]
@@ -360,10 +360,10 @@
</welcome-file-list>
----
-[start=33]
+
. IDEのメイン・ツールバーにある「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックします。プロジェクトがコンパイルされてGlassFishにデプロイされ、`process.xhtml`ファイルがブラウザで開きます。
-[start=34]
+
. ページに表示されている「`Execute`」ボタンをクリックします。IDEに戻ってGlassFishのサーバー・ログを調べます。サーバー・ログは、「出力」ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])の「GlassFish Server」タブの下に表示されます。ボタンをクリックすると、デフォルトDAO実装による項目がログに一覧表示されます。
image::images/output-window.png[title="IDEの「出力」ウィンドウでのサーバー・ログの確認"]
@@ -410,13 +410,13 @@
これで`ItemDao`を実装するクラスが2つになったため、どのBeanを注入する必要があるかがわからなくなりました。
-[start=4]
+
. 「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックして、プロジェクトを実行します。今度はプロジェクトのデプロイに失敗します。
「保存時にデプロイ」がデフォルトで有効になっていて、IDEがプロジェクトを自動的にデプロイするため、ファイルを保存するのみで済む可能性があります。
-[start=5]
+
. 出力ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])でサーバー・ログを調べます。次のようなエラー・メッセージが表示されています。
[source,java]
@@ -439,16 +439,16 @@
IDEには、CDI修飾子を生成できるウィザードがあります。
-[start=6]
+
. 「新規ファイル」(image:images/new-file-btn.png[])ボタンをクリックするか、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押してファイル・ウィザードを開きます。
-[start=7]
+
. 「コンテキストと依存性の注入」カテゴリから「修飾子タイプ」を選択します。「次」をクリックします。
-[start=8]
+
. クラス名として「*Demo*」、パッケージとして「*exercise2*」と入力します。
-[start=9]
+
. 「終了」をクリックします。新しい`Demo`修飾子がエディタで開きます。
[source,java]
@@ -479,7 +479,7 @@
次に、この修飾子をクラス・レベルでデフォルトのDAO実装に追加します。
-[start=10]
+
. エディタで`DefaultItemDao`に切り替え([Ctrl]-[Tab]を押し)、クラス定義の上に「`@Demo`」と入力します。
[source,java]
@@ -502,13 +502,13 @@
TIP:「`@`」を入力した後で[Ctrl]-[Space]を押して、コード補完の候補を呼び出します。エディタは`Demo`修飾子を認識して、コード補完のオプションとして`@Demo`を表示します。#
-[start=11]
+
. 「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックして、プロジェクトを実行します。プロジェクトがエラーなくビルドおよびデプロイされます。
*注意:*この変更では、変更を増分的にデプロイするのではなく、プロジェクトを明示的に実行してアプリケーションを再デプロイする必要がある場合があります。
-[start=12]
+
. ブラウザで「`Execute`」ボタンをクリックしてからIDEに戻り、「出力」ウィンドウでサーバー・ログを調べます。次のような出力が表示されます。
[source,java]
@@ -522,7 +522,7 @@
次に、`ItemProcessor`の注入ポイントに`@Demo`注釈を追加します。
-[start=13]
+
. エディタで`ItemProcessor`に切り替え([Ctrl]-[Tab]を押し)、次のように変更します。
[source,java]
@@ -544,7 +544,7 @@
}
----
-[start=14]
+
. ブラウザで「`Execute`」ボタンをクリックしてからIDEに戻り、「出力」ウィンドウでサーバー・ログを調べます。デフォルトの実装(`DefaultItemDao`)による出力が再度表示されます。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_pt_BR.asciidoc
index 0150944..2ba3b1b 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_pt_BR.asciidoc
@@ -41,10 +41,10 @@
* <<alternative,Métodos de Injeção Alternativos>>
* <<seealso,Consulte Também>>
-[start=3]
+
. link:cdi-validate.html[+Aplicando Anotações @Alternative Beans e de Ciclo de Vida+]
-[start=4]
+
. link:cdi-events.html[+Trabalhando com Eventos no CDI+]
A Injeção de Dependência e Contextos (CDI), especificada por link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], é parte integrante do Java EE 6 e fornece uma arquitetura que permite aos componentes do Java EE, como os servlets, enterprise beans e JavaBeans, existirem dentro do ciclo de vida de uma aplicação com escopos bem definidos. Além disso, os serviços CDI permitem que os componentes do Java EE, como beans de sessão EJB e beans gerenciados do JavaServer Faces (JSF), sejam injetados e interajam de maneira acoplada flexível, disparando e observando eventos.
@@ -96,10 +96,10 @@
image::images/java-class-wizard.png[title="Criar uma nova classe Java usando o assistente de Arquivo"]
-[start=7]
+
. Clique em Finalizar. A nova classe e o novo pacote são gerados e a classe `item` é aberta no editor.
-[start=8]
+
. Crie as propriedades `value` e `limit` para o POJO do `Item` e implemente o método `toString()`. Adicione o conteúdo a seguir à classe.
[source,java]
@@ -117,19 +117,19 @@
}
----
-[start=9]
+
. Adicione os métodos getter e setter à classe. Para isso, garanta que o cursor esteja colocado entre a definição de classe (ou seja, entre as chaves da classe) e, em seguida, clique com o botão direito do mouse no editor e escolha Inserir Código (Alt-Insert; Ctrl-I no Mac). Escolha Getter e Setter.
image::images/insert-code.png[title="Criar getters e setters usando o pop-up Inserir Código"]
-[start=10]
+
. Marque a caixa de seleção `Item` (fazer isso seleciona todas as propriedades contidas na classe).
image::images/generate-getters-setters.png[title="Marque a caixa de seleção da classe para selecionar todas as propriedades contidos na classe"]
-[start=11]
+
. Clique em Gerar. Os métodos getter e setter são gerados para a classe.
[source,java]
@@ -163,7 +163,7 @@
}
----
-[start=12]
+
. Crie um construtor que utilize os argumentos `value` e `limit`. Novamente, o IDE pode ajudar com isso. Pressione Ctrl-Espaço na definição da classe e escolha a opção "`Item(int value, int limit) - generate`".
image::images/generate-constructor.png[title="Pressione Ctrl-Espaço para utilizar os recursos de autocompletar código do editor"]
@@ -186,22 +186,22 @@
...
----
-[start=13]
+
. Crie uma interface `ItemDao` para definir como obtemos a lista de objetos `Item`. Nesta aplicação de teste, antecipamos o uso de várias implementações, portanto, codificaremos para interfaces.
Clique no botão Novo Arquivo (image:images/new-file-btn.png[]) ou pressione CTRL-N (⌘-N no Mac) para abrir o assistente de Arquivo.
-[start=14]
+
. Selecione a categoria Java e, em seguida, selecione Interface Java. Clique em Próximo.
-[start=15]
+
. Digite *ItemDao* como o nome da classe e, em seguida, insira *exercise2* como o pacote.
-[start=16]
+
. Clique em Finalizar. A nova interface será gerada e aberta no editor.
-[start=17]
+
. Adicione um método chamado `fetchItems()` que retorna uma `Lista` de objetos `Item`.
[source,java]
@@ -215,22 +215,22 @@
----
(Utilize a dica do editor para adicionar a instrução de importação de `java.util.List`.)
-[start=18]
+
. Crie uma classe `ItemProcessor`. É a classe principal em que você injetará seus beans e da qual executará o processo. Por enquanto, iniciaremos com a DAO e examinaremos como será feita a sua injeção no nosso bean processador.
Clique no botão Novo Arquivo (image:images/new-file-btn.png[]) ou pressione CTRL-N (⌘-N no Mac) para abrir o assistente de Arquivo.
-[start=19]
+
. Selecione a categoria Java e, em seguida, a Classe Java. Clique em Próximo.
-[start=20]
+
. Digite *ItemProcessor* como o nome da classe e, em seguida, *exercise2* como o pacote. Clique em Finalizar.
A nova classe é gerada e aberta no editor.
-[start=21]
+
. Modifique a classe como se segue:
[source,java]
@@ -251,19 +251,19 @@
}
----
-[start=22]
+
. Corrigir importações. Clique com o botão direito do mouse no editor e selecione Corrigir Importações ou pressione Ctrl-Shift-I (⌘-Shift-I no Mac).
image::images/fix-imports.png[title="Clique com o botão direito do mouse no editor e escolha Corrigir Importações para adicionar instruções de importação à classe"]
-[start=23]
+
. Clique em OK. Instruções de importação para as classes a seguir são necessárias:
* `java.util.List`
* `javax.inject.Named`
* `javax.enterprise.context.RequestScoped`
-[start=24]
+
. Comece com um DAO simples que apenas cria uma lista de itens e retorna uma lista fixa de itens.
Na janela Projetos, clique com o botão direito do mouse no nó de pacote `exercise2` e escolha Novo > Classe Java. No assistente de Classe Java, nomeie a classe `DefaultItemDao`. Clique em Finalizar.
@@ -271,7 +271,7 @@
image::images/java-class-wizard2.png[title="Criar uma nova classe Java usando o assistente de Classe Java"]
-[start=25]
+
. No editor, faça com que `DefaultItemDao` implemente a interface `ItemDao` e forneça uma implementação de `fetchItems()`.
[source,java]
@@ -292,7 +292,7 @@
----
(Pressione Ctrl-Shift-I (⌘-Shift-I no Mac) para adicionar instruções de importação para `java.util.List` e `java.util.ArrayList`.)
-[start=26]
+
. Mude para a classe `ItemProcessor` (pressione Ctrl-Tab). Para injetar o `DefaultItemDao` no `ItemProcessor`, adicionamos a anotação `javax.inject.Inject` ao campo `ItemDao` para indicar que esse campo é um ponto de injeção.
[source,java]
@@ -314,21 +314,21 @@
TIP: Utilize o suporte à funcionalidade autocompletar código do editor para adicionar a anotação `@Inject` e a instrução de importação à classe. Por exemplo, digite "`@Inj`" e, em seguida, pressione Ctrl-Espaço.#
-[start=27]
+
. Finalmente, precisamos de alguma maneira para chamar o método `execute()` no `ItemProcessor`. Podemos executá-lo em um ambiente SE, mas, no momento, o manteremos em uma página JSF. Crie uma nova página chamada `process.xhtml` que contém um botão para chamar o método `execute()`.
Clique no botão Novo Arquivo (image:images/new-file-btn.png[]) ou pressione CTRL-N (⌘-N no Mac) para abrir o assistente de Arquivo.
-[start=28]
+
. Selecione a categoria JavaServer Faces e selecione a Página JSF. Clique em Próximo.
-[start=29]
+
. Digite *processo* como o nome do arquivo e clique em Finalizar.
image::images/new-jsf-page.png[title="Criar uma nova página Facelets usando o assistente de arquivo JSF"]
-[start=30]
+
. No novo arquivo `process.xhtml`, adicione um botão que esteja conectado ao método `ItemProcessor.execute()`. Utilizando EL, o nome default para o bean gerenciado é o mesmo que o nome da classe, mas com a primeira letra minúscula (por exemplo., `itemProcessor`).
[source,xml]
@@ -341,7 +341,7 @@
</h:body>
----
-[start=31]
+
. Antes de executar o projeto, defina o arquivo `process.xhtml` como a nova página de boas-vindas no descritor de implantação web do projeto.
Utilize a caixa de diálogo Ir para Arquivo do IDE para abrir rapidamente o arquivo `web.xml`. Escolha Navegar > Ir para Arquivo no menu principal do IDE (Alt-Shift-O; Ctrl-Shift-O no Mac) e, em seguida, digite "`web`".
@@ -349,7 +349,7 @@
image::images/go-to-file.png[title="Use a caixa de diálogo Ir para Arquivo para localizar rapidamente um arquivo de projeto"]
-[start=32]
+
. Clique em OK. Na view XML do arquivo `web.xml`, faça a alteração a seguir.
[source,xml]
@@ -360,10 +360,10 @@
</welcome-file-list>
----
-[start=33]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) na barra de ferramentas principal do IDE. O projeto é compilado e implantado no GlassFish e o arquivo `process.xhtml` será aberto no browser.
-[start=34]
+
. Clique no botão "`Execute`" que é exibido na página. Volte ao IDE e examine o log do GlassFish Server. O log do servidor é exibido na janela Saída (Ctrl-4; ⌘-4 no Mac) na guia GlassFish Server. Quando o botão é clicado, o log lista os itens da nossa implementação de DAO default.
image::images/output-window.png[title="Examine o log do servidor na janela Saída do IDE"]
@@ -410,13 +410,13 @@
Agora que há duas classes que implementam o `ItemDao`, a escolha não está tão clara com relação a em qual bean queremos injetar.
-[start=4]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) para executar o projeto. Observe que o projeto agora falha na implantação.
Provavelmente, você só precisa salvar o arquivo porque o IDE implantará o projeto automaticamente, visto que a opção Implantar ao Salvar está ativada por default.
-[start=5]
+
. Examine o log do servidor na janela Saída (Ctrl-4; ⌘-4 no Mac). Será exibida uma mensagem de erro semelhante ao seguinte.
[source,java]
@@ -439,16 +439,16 @@
O IDE fornece um assistente que permite gerar qualificadores CDI.
-[start=6]
+
. Clique no botão Novo Arquivo (image:images/new-file-btn.png[]) ou pressione CTRL-N (⌘-N no Mac) para abrir o assistente de Arquivo.
-[start=7]
+
. Selecione a categoria Injeção de Dependência e Contexto e, em seguida, selecione Tipo de Qualificador. Clique em Próximo.
-[start=8]
+
. Digite *Demo* como o nome da classe e, em seguida, *exercise2* como o pacote.
-[start=9]
+
. Clique em Finalizar. O novo qualificador `Demo` será aberto no editor.
[source,java]
@@ -479,7 +479,7 @@
Em seguida, você adicionará este qualificador à implementação DAO default no nível da classe.
-[start=10]
+
. Altere para `DefaultItemDao` no editor (pressione Ctrl-Tab) e, em seguida, digite "`@Demo`" acima da definição da classe.
[source,java]
@@ -502,13 +502,13 @@
TIP: Depois de digitar "`@`", pressione Ctrl-Espaço para chamar sugestões da funcionalidade autocompletar código. O editor reconhece o qualificador `Demo` e lista `@Demo` como uma opção para a funcionalidade autocompletar código.#
-[start=11]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) para executar o projeto. O projeto será compilado e implantado sem erros.
*Observação.* Para esta modificação talvez você precise executar explicitamente o projeto para reimplantar a aplicação, em vez de implantar incrementalmente as alterações.
-[start=12]
+
. No browser, clique no botão "`Execute`", retorne para o IDE e examine o log do servidor na janela Saída. Você verá a seguinte saída.
[source,java]
@@ -522,7 +522,7 @@
Em seguida, você adicionará a anotação `@Demo` ao ponto de injeção em `ItemProcessor`.
-[start=13]
+
. Altere para `ItemProcessor` no editor (pressione Ctrl-Tab) e, em seguida, faça a seguinte alteração.
[source,java]
@@ -544,7 +544,7 @@
}
----
-[start=14]
+
. No browser, clique no botão "`Execute`", retorne para o IDE e examine o log do servidor na janela Saída. Você verá, novamente, a saída da implementação default (`DefaultItemDao`).
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ru.asciidoc
index 9a314cb..f67ee3a 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_ru.asciidoc
@@ -41,10 +41,10 @@
* <<alternative,Альтернативные методы внедрения>>
* <<seealso,Дополнительные сведения>>
-[start=3]
+
. link:cdi-validate.html[+Применение аннотации @Alternative и аннотаций жизненного цикла+]
-[start=4]
+
. link:cdi-events.html[+Обработка событий в CDI+]
Внедрение контекстов и зависимостей (CDI), определяемое документом link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], является неотъемлемой частью Java EE 6 и обеспечивает архитектуру, позволяющую компонентам Java EE (например, сервлетам, компонентам EJB и JavaBeans) существовать в жизненном цикле приложения с четко определенными контекстами. Кроме того, службы CDI позволяют компонентам Java EE (например, компонентам сеансов EJB и управляемым компонентам JavaServer Faces) внедряться и свободно взаимодействовать путем запуска и обработки событий.
@@ -96,10 +96,10 @@
image::images/java-class-wizard.png[title="Среда IDE может помочь в этом, предоставляя мастер библиотеки классов Java."]
-[start=7]
+
. Нажмите кнопку "Завершить". Выполняется создание нового класса и пакета, и класс `Item` открывается в редакторе.
-[start=8]
+
. Создайте свойства `value` и `limit` для POJO `Item` и реализуйте метод `toString()`. Добавьте следующее содержимое к классу.
[source,java]
@@ -117,19 +117,19 @@
}
----
-[start=9]
+
. Добавьте методы получения и установки к классу. Для этого убедитесь, что курсор размещен в определении класса (т.е. между фигурными скобками класса), затем щелкните в редакторе правой кнопкой мыши и выберите пункт "Вставить код" (ALT+INSERT; CTRL+I на компьютерах Mac). Выберите методы получения и установки.
image::images/insert-code.png[title="Создайте методы получения и установки с помощью всплывающего окна 'Вставить код'"]
-[start=10]
+
. Установите флажок `Item` (при этом выбираются все свойства, содержащиеся в классе).
image::images/generate-getters-setters.png[title="Установите флажок для класса для выбора всех свойств, содержащихся в классе"]
-[start=11]
+
. Нажмите кнопку "Создать". Для класса создаются методы получения и установки.
[source,java]
@@ -163,7 +163,7 @@
}
----
-[start=12]
+
. Создайте конструктор, который принимает оба аргумента `value` и `limit`. Кроме того, для этого можно использовать IDE. Нажмите сочетание клавиш CTRL+ПРОБЕЛ в определении класса и выберите параметр "`Item(int value, int limit) - generate`".
image::images/generate-constructor.png[title="Нажмите сочетание клавиш CTRL+ПРОБЕЛ, чтобы использовать функцию автозавершения кода в редакторе."]
@@ -186,22 +186,22 @@
...
----
-[start=13]
+
. Создайте интерфейс `ItemDao` для определения способа получения списка объектов `Item`. В этом тестовом приложении мы допускаем использование нескольких реализаций, следовательно, создаем код для интерфейсов.
Щелкните 'Создать файл' ( image:images/new-file-btn.png[] ) или нажмите сочетание клавиш CTRL+N (⌘-N on Mac) для открытия мастера создания файлов.
-[start=14]
+
. Выберите категорию Java, а затем команду "Интерфейс Java". Нажмите кнопку "Далее".
-[start=15]
+
. Введите *ItemDao* в качестве имени класса, затем укажите *exercise2* в качестве пакета.
-[start=16]
+
. Нажмите кнопку "Завершить". Интерфейс будет создан и открыт в редакторе.
-[start=17]
+
. Добавьте метод с именем `fetchItems()`, который возвращает элемент `List` объектов `Item`.
[source,java]
@@ -215,22 +215,22 @@
----
Используйте подсказку редактора, чтобы добавить оператор импорта для `java.util.List`.
-[start=18]
+
. Создайте класс `ItemProcessor`. Это главный класс для внедрения базовых элементов и выполнения процесса. базовый элемент.
Щелкните 'Создать файл' ( image:images/new-file-btn.png[] ) или нажмите сочетание клавиш CTRL+N (⌘-N on Mac) для открытия мастера создания файлов.
-[start=19]
+
. Выберите категорию Java, а затем выберите класс Java. Нажмите кнопку "Далее".
-[start=20]
+
. Введите *ItemProcessor* в качестве имени класса, затем укажите *exercise2* в качестве пакета. Нажмите кнопку "Завершить".
В редакторе будет создан и открыт новый класс.
-[start=21]
+
. Измените класс следующим образом:
[source,java]
@@ -251,19 +251,19 @@
}
----
-[start=22]
+
. Исправьте операторы импорта. Либо щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' или нажмите Ctrl-Shift-I (⌘-Shift-I в Mac).
image::images/fix-imports.png[title="Щелкните в редакторе правой кнопкой мыши и выберите 'Исправить операторы импорта' для добавления операторов импорта к классу"]
-[start=23]
+
. Нажмите кнопку "ОК". Операторы импорта требуются для следующих классов:
* `java.util.List`
* `javax.inject.Named`
* `javax.enterprise.context.RequestScoped`
-[start=24]
+
. Начните с простого DAO, который только создает список элементов и возвращает фиксированный список элементов.
В окне "Проекты" щелкните правой кнопкой мыши узел пакета `exercise2` и выберите "Создать > Класс Java". В мастере создания класса Java присвойте классу имя `DefaultItemDao`. Нажмите кнопку "Завершить".
@@ -271,7 +271,7 @@
image::images/java-class-wizard2.png[title="Создайте новый класс Java с помощью мастера классов Java"]
-[start=25]
+
. Необходимо, чтобы в редакторе элемент `DefaultItemDao` реализовывал интерфейс `ItemDao` и обеспечивал реализацию `fetchItems()`.
[source,java]
@@ -292,7 +292,7 @@
----
Нажмите сочетание клавиш Ctrl-Shift-I (⌘-Shift-I on Mac) для добавления операторов импорта для `java.util.List` and `java.util.ArrayList`.
-[start=26]
+
. Перейдите к классу `ItemProcessor` (нажмите сочетание клавиш CTRL+TAB). Чтобы внедрить `DefaultItemDao` в `ItemProcessor` добавляется аннотация `javax.inject.Inject` к полю `ItemDao` для указания того, что это поле является точкой внедрения.
[source,java]
@@ -315,21 +315,21 @@
TIP: Используйте поддержку автозавершения кода редактора для добавления аннотации `@Inject` и оператора импорта к классу. Например, введите `@Inj`, а затем нажмите CTRL+ПРОБЕЛ.#
-[start=27]
+
. Наконец, необходим способ для вызова метода `execute()` в `ItemProcessor`. Это можно выполнить в среде SE, но сейчас мы сделаем это на странице JSF. Создайте новую страницу с именем `process.xhtml`, которая содержит кнопку для вызова метода `execute()`.
Щелкните 'Создать файл' ( image:images/new-file-btn.png[] ) или нажмите сочетание клавиш CTRL+N (⌘-N on Mac) для открытия мастера создания файлов.
-[start=28]
+
. Выберите категорию JavaServer Faces, затем выберите страницу JSF. Нажмите кнопку "Далее".
-[start=29]
+
. Введите *process* в качестве имени файла, затем нажмите кнопку "Готово".
image::images/new-jsf-page.png[title="Создайте новую страницу Facelets с помощью мастера файлов JSF"]
-[start=30]
+
. В новом файле `process.xhtml` добавьте кнопку, которая привязана к методу `ItemProcessor.execute()`. При использовании языка выражений имя по умолчанию для управляемого компонента является таким же, как имя класса, но первая буква в нижнем регистре (т.е. `itemProcessor`).
[source,xml]
@@ -342,7 +342,7 @@
</h:body>
----
-[start=31]
+
. Перед выполнением проекта установите файл `process.xhtml` в качестве новой страницы приветствия в дескрипторе развертывания веб-приложения.
Используйте диалоговое окно среды IDE "Переход к файлу" для быстрого открытия файла `web.xml`. В основном меню среды IDE выберите "Переход > Перейти к файлу" (ALT+SHIFT+O; CTRL+SHIFT+O на компьютерах Mac), а затем введите `web`.
@@ -350,7 +350,7 @@
image::images/go-to-file.png[title="С помощью диалогового окна "Переход к файлу" быстро найдите файл проекта"]
-[start=32]
+
. Нажмите кнопку "ОК". В представлении XML для файла `web.xml` выполните следующие изменения.
[source,xml]
@@ -361,10 +361,10 @@
</welcome-file-list>
----
-[start=33]
+
. Нажмите кнопку 'Запустить проект' (image:images/run-project-btn.png[]) на главной панели инструментов IDE. Проект компилируется и развертывается на GlassFish, и файл `process.xhtml` открывается в браузере.
-[start=34]
+
. Нажмите кнопку `Выполнить` на странице. Вернитесь в среду IDE и проверьте протокол сервера GlassFish. Журнал сервера отображается в окне вывода (Ctrl-4; ⌘-4 в Mac) на вкладке 'Сервер GlassFish'. При нажатии кнопки журнал выводит список элементов из реализации DAO по умолчанию.
image::images/output-window.png[title="Проверьте журнал сервера в окне вывода IDE"]
@@ -411,13 +411,13 @@
Теперь, при наличии двух классов, которые внедряют`ItemDao`, не так ясно, какой базовый элемент необходимо внедрить.
-[start=4]
+
. Для запуска проекта нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ). Обратите внимание, что теперь развертывание проекта завершается сбоем.
Возможно, вам просто необходимо сохранить файл - IDE будет автоматически запускать проект, т.к. запуск при сохранении активирован по умолчанию.
-[start=5]
+
. Проверьте журнал сервера в окне вывода (Ctrl-4; ⌘-4 в Mac). Отобразится сообщение об ошибке, аналогичное следующему.
[source,java]
@@ -440,16 +440,16 @@
IDE предоставляет мастер, позволяющий создавать квалификаторы CDI.
-[start=6]
+
. Щелкните 'Создать файл' ( image:images/new-file-btn.png[] ) или нажмите сочетание клавиш CTRL+N (⌘-N on Mac) для открытия мастера создания файлов.
-[start=7]
+
. Выберите категорию "Внедрение контекстов и зависимостей", затем выберите "Тип "квалификатора". Нажмите кнопку "Далее".
-[start=8]
+
. Введите *Demo* в качестве имени класса, затем укажите *exercise2* в качестве пакета.
-[start=9]
+
. Нажмите кнопку "Завершить". Новый квалификатор `Demo` открывается в редакторе.
[source,java]
@@ -479,7 +479,7 @@
Затем этот квалификатор будет добавлен к реализатору DAO на уровне класса.
-[start=10]
+
. Перейдите в редакторе к `DefaultItemDao` (нажмите CTRL+TAB), а затем введите "`@Demo`" над определением класса.
[source,java]
@@ -503,13 +503,13 @@
TIP: После ввода `@` нажмите CTRL+ПРОБЕЛ для вызова предложений автозавершения кода. Редактор распознает квалификатор `Demo` и выводит `@Demo` в качестве параметра списка для автозавершения кода.#
-[start=11]
+
. Для запуска проекта нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ). Сборка и развертывание проекта выполняются без ошибок.
NOTE: Для этого изменения может потребоваться явно запустить проект для повторного развертывания приложения вместо развертывания изменений с приращением.
-[start=12]
+
. В браузере нажмите кнопку `Выполнить`, затем вернитесь в среду IDE и проверьте протокол сервера в окне вывода. На экран будет выведено следующее.
[source,java]
@@ -523,7 +523,7 @@
Затем вы добавите аннотацию `@Demo` к точке внедрения в`ItemProcessor`.
-[start=13]
+
. Перейдите в редакторе к `ItemProcessor` (нажмите CTRL+TAB), а затем выполните следующее изменение.
[source,java]
@@ -545,7 +545,7 @@
}
----
-[start=14]
+
. В браузере нажмите кнопку `Выполнить`, затем вернитесь в среду IDE и проверьте протокол сервера в окне вывода. На экран снова выводятся данные реализации по умолчанию (`DefaultItemDao`).
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_zh_CN.asciidoc
index 9010b17..be504d8 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-inject_zh_CN.asciidoc
@@ -41,10 +41,10 @@
* <<alternative,其他注入方法>>
* <<seealso,另请参见>>
-[start=3]
+
. link:cdi-validate.html[+应用 @Alternative Bean 和生命周期标注+]
-[start=4]
+
. link:cdi-events.html[+使用 CDI 中的事件+]
link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] 指定的上下文和依赖关系注入 (CDI) 是 Java EE 6 的一个组成部分,提供了一个体系结构,以允许 Java EE 组件(例如 Servlet、企业 Bean 和 JavaBeans)在具有明确定义范围的应用程序生命周期内存在。此外,CDI 服务允许 Java EE 组件(例如 EJB 会话 Bean 和 JavaServer Faces (JSF) 受管 Bean)注入并通过触发和观察事件以松散耦合的方式进行交互。
@@ -97,10 +97,10 @@
image::images/java-class-wizard.png[title="使用文件向导创建新 Java 类"]
-[start=7]
+
. 单击 "Finish"(完成)。新类和包生成,并在编辑器中打开 `Item` 类。
-[start=8]
+
. 为 `Item` POJO 创建 `value` 和 `limit` 属性,并实现 `toString()` 方法。在该类中添加以下内容。
[source,java]
@@ -118,19 +118,19 @@
}
----
-[start=9]
+
. 在该类中添加 getter 和 setter 方法。要执行此操作,请确保将光标置于类定义之间(例如,该类的花括号之间),然后右键单击编辑器并选择 "Insert Code"(插入代码)(Alt-Insert;在 Mac 上为 Ctrl-I)。选择 "Getter and Setter"(Getter 和 Setter)。
image::images/insert-code.png[title="使用 "Insert Code"(插入代码)弹出式窗口创建 getter 和 setter"]
-[start=10]
+
. 选中 `Item` 复选框(执行此操作可选择该类中包含的所有属性)。
image::images/generate-getters-setters.png[title="选中类复选框可选择该类中包含的所有属性"]
-[start=11]
+
. 单击 "Generate"(生成)。将为该类生成 getter 和 setter 方法。
[source,java]
@@ -164,7 +164,7 @@
}
----
-[start=12]
+
. 创建同时具有 `value` 和 `limit` 参数的构造函数。同样,IDE 可以帮助完成此操作。在类定义内按 Ctrl-空格键,并选择 `Item(int value, int limit) - generate` 选项。
image::images/generate-constructor.png[title="按 Ctrl-空格键可利用编辑器的代码完成功能"]
@@ -187,22 +187,22 @@
...
----
-[start=13]
+
. 创建 `ItemDao` 接口以定义获取 `Item` 对象列表的方式。在此测试应用程序中,预期将使用多个实现,因此将编写多个接口的代码。
单击 "New File"(新建文件)(image:images/new-file-btn.png[]) 按钮,或者按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)以打开文件向导。
-[start=14]
+
. 选择 "Java" 类别,然后选择 "Java Interface"(Java 接口)。单击 "Next"(下一步)。
-[start=15]
+
. 键入 *ItemDao* 作为类名,然后输入 *exercise2* 作为包。
-[start=16]
+
. 单击 "Finish"(完成)。将会生成新接口并在编辑器中将其打开。
-[start=17]
+
. 添加名为 `fetchItems()` 的方法,它将返回 `Item` 对象的 `List`。
[source,java]
@@ -216,22 +216,22 @@
----
(使用编辑器的提示为 `java.util.List` 添加 import 语句。)
-[start=18]
+
. 创建 `ItemProcessor` 类。这是要向其中注入 Bean 并从中执行进程的主类。目前,您将从 DAO 入手,了解如何将其注入我们的处理器 Bean。
单击 "New File"(新建文件)(image:images/new-file-btn.png[]) 按钮,或者按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)以打开文件向导。
-[start=19]
+
. 选择 "Java" 类别,然后选择 "Java Class"(Java 类)。单击 "Next"(下一步)。
-[start=20]
+
. 键入 *ItemProcessor* 作为类名,然后输入 *exercise2* 作为包。单击 "Finish"(完成)。
将会生成新类并在编辑器中将其打开。
-[start=21]
+
. 修改该类,如下所示:
[source,java]
@@ -252,19 +252,19 @@
}
----
-[start=22]
+
. 修复导入。在编辑器中右键单击并选择 "Fix Imports"(修复导入),或者按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)。
image::images/fix-imports.png[title="右键单击编辑器,然后选择 "Fix Imports"(修复导入)以将 import 语句添加到类中"]
-[start=23]
+
. 单击 "OK"(确定)。需要以下类的 import 语句:
* `java.util.List`
* `javax.inject.Named`
* `javax.enterprise.context.RequestScoped`
-[start=24]
+
. 首先是一个简单的 DAO,仅用于创建项列表并返回项的固定列表。
在 "Projects"(项目)窗口中,右键单击 `exercise2` 包节点并选择 "New"(新建)> "Java Class"(Java 类)。在 Java 类向导中,将类命名为 `DefaultItemDao`。单击 "Finish"(完成)。
@@ -272,7 +272,7 @@
image::images/java-class-wizard2.png[title="使用 Java 类向导创建新 Java 类"]
-[start=25]
+
. 在编辑器中,让 `DefaultItemDao` 实现 `ItemDao` 接口,然后提供 `fetchItems()` 实现。
[source,java]
@@ -293,7 +293,7 @@
----
(按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)为 `java.util.List` 和 `java.util.ArrayList` 添加 import 语句。)
-[start=26]
+
. 切换到 `ItemProcessor` 类(按 Ctrl-Tab 组合键)。为了将 `DefaultItemDao` 注入到 `ItemProcessor`,我们向 `ItemDao` 字段添加 `javax.inject.Inject` 标注以表示该字段为注入点。
[source,java]
@@ -316,21 +316,21 @@
TIP: 使用编辑器的代码完成支持向类中添加 `@Inject` 标注和 import 语句。例如,键入 `@Inj`,按后按 Ctrl-空格组合键。#
-[start=27]
+
. 最后,需要采用一些方式来调用 `ItemProcessor` 上的 `execute()` 方法。此方法可以在 SE 环境中运行,但现在会将其保留在 JSF 页。创建名为 `process.xhtml` 的新页,并包含用于调用 `execute()` 方法的按钮。
单击 "New File"(新建文件)(image:images/new-file-btn.png[]) 按钮,或者按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)以打开文件向导。
-[start=28]
+
. 选择 "JavaServer Faces" 类别,然后选择 "JSF Page"(JSF 页)。单击 "Next"(下一步)。
-[start=29]
+
. 键入 *process* 作为文件名,然后单击 "Finish"(完成)。
image::images/new-jsf-page.png[title="使用 JSF 文件向导创建新 Facelets 页"]
-[start=30]
+
. 在新的 `process.xhtml` 文件中,添加连接到 `ItemProcessor.execute()` 方法的按钮。使用 EL 时,受管 Bean 的默认名称与类名称相同,但是第一个字母用小写(例如,`itemProcessor`)。
[source,xml]
@@ -343,7 +343,7 @@
</h:body>
----
-[start=31]
+
. 运行此项目之前,在项目的 Web 部署描述符中将 `process.xhtml` 文件设置为新的欢迎页面。
使用 IDE 的 "Go to File"(转至文件)对话框快速打开 `web.xml` 文件。从 IDE 的主菜单中选择 "Navigate"(导航)> "Go to File"(转至文件)(Alt-Shift-O;在 Mac 上为 Ctrl-Shift-O),然后键入 "`web`"。
@@ -351,7 +351,7 @@
image::images/go-to-file.png[title="使用 "Go to File"(转至文件)对话框可快速找到项目文件"]
-[start=32]
+
. 单击 "OK"(确定)。在 `web.xml` 文件的 XML 视图中,进行以下更改。
[source,xml]
@@ -362,10 +362,10 @@
</welcome-file-list>
----
-[start=33]
+
. 在 IDE 的主工具栏中单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮。编译该项目并将其部署到 GlassFish,然后在浏览器中打开 `process.xhtml` 文件。
-[start=34]
+
. 单击页面上显示的 `Execute` 按钮。切换回 IDE 并检查 GlassFish Server 日志。服务器日志会显示在 "Output"(输出)窗口(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键)中 "GlassFish Server" 标签的下方。单击该按钮时,日志将列出默认 DAO 实现的项。
image::images/output-window.png[title="在 IDE 的 "Output"(输出)窗口中查看服务器日志"]
@@ -413,13 +413,13 @@
现在有两个实现 `ItemDao` 的类,因此无法确定要注入哪个 Bean。
-[start=4]
+
. 单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮以运行项目。请注意,项目现在无法部署。
您可能只需要保存文件,因为 "Deploy on Save"(在保存时部署)默认为启用状态,IDE 将自动部署项目。
-[start=5]
+
. 在 "Output"(输出)窗口(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键)中查看服务器日志。将会显示类似如下的错误消息。
[source,java]
@@ -442,16 +442,16 @@
IDE 提供可用于生成 CDI 限定符的向导。
-[start=6]
+
. 单击 "New File"(新建文件)(image:images/new-file-btn.png[]) 按钮,或者按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)以打开文件向导。
-[start=7]
+
. 选择 "Context and Dependency Injection"(上下文和依赖关系注入)类别,然后选择 "Qualifier Type"(限定符类型)。单击 "Next"(下一步)。
-[start=8]
+
. 输入 *Demo* 作为类名,然后输入 *exercise2* 作为包名。
-[start=9]
+
. 单击 "Finish"(完成)。新 `Demo` 限定符在编辑器中打开。
[source,java]
@@ -482,7 +482,7 @@
接下来,在类级别将此限定符添加到默认 DAO 实现。
-[start=10]
+
. 在编辑器中切换到 `DefaultItemDao`(按 Ctrl-Tab 组合键),然后在类定义上方键入 `@Demo`。
[source,java]
@@ -506,13 +506,13 @@
TIP: 键入 `@` 后,按 Ctrl-空格键以调用代码完成建议。编辑器识别 `Demo` 限定符并列出 `@Demo` 作为代码完成选项。#
-[start=11]
+
. 单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮以运行项目。该项目将构建和部署,且不出现错误。
NOTE: 对于此项修改,可能需要显式运行项目以重新部署应用程序而不是增量部署所做的更改。
-[start=12]
+
. 在浏览器中,单击 `Execute` 按钮,然后返回至 IDE 并检查 "Output"(输出)窗口中的服务器日志。将看到以下输出结果。
[source,java]
@@ -526,7 +526,7 @@
接下来,将向 `ItemProcessor` 中的注入点添加 `@Demo` 标注。
-[start=13]
+
. 在编辑器中切换到 `ItemProcessor`(按 Ctrl-Tab 组合键),然后进行以下更改。
[source,java]
@@ -548,7 +548,7 @@
}
----
-[start=14]
+
. 在浏览器中,单击 `Execute` 按钮,然后返回至 IDE 并检查 "Output"(输出)窗口中的服务器日志。您会再次看到默认实现 (`DefaultItemDao`) 的输出。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro.asciidoc
index 0900801..d89e978 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro.asciidoc
@@ -39,13 +39,13 @@
* <<upgrading,Upgrading to an EJB>>
* <<seealso,See Also>>
-[start=2]
+
. link:cdi-inject.html[+Working with Injection and Qualifiers in CDI+]
-[start=3]
+
. link:cdi-validate.html[+Applying @Alternative Beans and Lifecycle Annotations+]
-[start=4]
+
. link:cdi-events.html[+Working with Events in CDI+]
Contexts and Dependency Injection (CDI), specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], is an integral part of Java EE 6 and provides an architecture that allows Java EE components such as servlets, enterprise beans, and JavaBeans to exist within the lifecycle of an application with well-defined scopes. In addition, CDI services allow Java EE components such as EJB session beans and JavaServer Faces (JSF) managed beans to be injected and to interact in a loosely coupled way by firing and observing events.
@@ -90,20 +90,20 @@
image::images/new-web-application1.png[title="The CDI option, when selected, generates a beans.xml file for the project"]
-[start=6]
+
. Click Next.
-[start=7]
+
. In the Frameworks panel, select the JavaServer Faces option.
-[start=8]
+
. Click the Configuration tab and confirm that Facelets is selected as the Preferred Page Language. Click Finish.
When you click Finish, the IDE generates the web application project and opens the `index.xhtml` welcome page in the editor.
-[start=9]
+
. In the Projects window, expand the Libraries > GlassFish Server node you can see that the `weld-osgi-bundle.jar` library was automatically added. The GlassFish Server includes Weld, which is JBoss' implementation of the JSR-299 CDI specification.
image::images/projects-window1.png[title="New project contains CDI's beans.xml file and the GlassFish library includes the Weld JAR file"]
@@ -124,7 +124,7 @@
The new package and class are generated, and the class opens in the editor.
-[start=3]
+
. Annotate the class with the `@Named` and `@Dependent` annotations, and create a single method to return a string.
[source,java]
@@ -150,10 +150,10 @@
NOTE: The ``@Dependent`` annotation defines the scope of the managed bean. In an *implicit bean archive* a managed bean is only discoverable and can only be managed by the container when a scope is specified. The application in this tutorial will be packaged as an implicit bean archive if you specified Java EE 7 Web as the Java EE version when you created the project and you did not create ``beans.xml`` . For details on specifying the scope of managed beans, see link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure001.htm[+Using Annotations to Configure Managed Beans+] in the Java EE 7 Tutorial.
-[start=4]
+
. Save the file (Ctrl-S; ⌘-S on Mac). By adding the `@Named` annotation, the `MessageServerBean` class becomes a _managed bean_, as defined by CDI.
-[start=5]
+
. Switch to the `index.xhtml` Facelets page (press Ctrl-Tab) in the editor, and add the following content to the `<h:body>` tags.
[source,xml]
@@ -174,13 +174,13 @@
image::images/facelets-el-completion.png[title="Create new Java classes using the Java Class wizard"]
-[start=6]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button in the IDE's main toolbar. The project is compiled and deployed to GlassFish, and the application welcome page (`index.xhtml`) opens in the browser. You can see the "Hello World!" message from the `MessageServerBean` displayed on the page.
image::images/browser-output1.png[title="Application welcome page displays MessageServerBean details"]
-[start=7]
+
. Go back into the message bean and change the message to something else (e.g., "Hello Weld!"). Save the file (Ctrl-S; ⌘-S on Mac), then refresh the browser. The new message automatically appears. Thanks to the IDE's Deploy on Save feature, any changes you save result in automatic compilation and redeployment to the server.
From the third line in the page you can see that the class name is `exercise1.MessageServerBean`. Note that the bean is just a POJO (Plain Old Java Object). Even though you are developing in Java EE, there is no complex class hierarchy wrapped in layers of transactions, interceptors and all that "heavy" stuff you keep hearing about.
@@ -198,7 +198,7 @@
As we are using a Java EE stack, we can easily deploy our bean as an EJB with some small changes thanks to EJB 3.1.
-[start=1]
+
. Open the `MessageServerBean` and add the `javax.ejb.Stateless` annotation at the class level and change the string to 'Hello EJB!'.
[source,java]
@@ -225,7 +225,7 @@
}
----
-[start=2]
+
. Save the file (Ctrl-S; ⌘-S on Mac), then go to your browser and refresh. You will see output similar to the following:
image::images/browser-output-ejb1.png[title="Using the @Stateless annotation transforms MessageServerBean into an EJB"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ja.asciidoc
index 9a25e75..cae6193 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ja.asciidoc
@@ -40,13 +40,13 @@
* <<upgrading,EJBへのアップグレード>>
* <<seealso,関連項目>>
-[start=2]
+
. link:cdi-inject.html[+CDIの注入および修飾子の操作+]
-[start=3]
+
. link:cdi-validate.html[+@Alternative Beanおよびライフサイクル注釈の適用+]
-[start=4]
+
. link:cdi-events.html[+CDIのイベントの操作+]
link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+]で指定されているコンテキストと依存性の注入(CDI: Contexts and Dependency Injection)はJava EE 6の不可欠な部分であり、サーブレット、エンタープライズBean、JavaBeansなどのJava EEコンポーネントが、アプリケーションのライフサイクル内で明確なスコープを持って存在できるようにするためのアーキテクチャを提供します。また、CDIサービスによって、EJBセッションBeanやJSF (JavaServer Faces)管理対象BeanなどのJava EEコンポーネントが注入可能になり、イベントの起動や監視による疎結合方式の対話が可能になります。
@@ -92,19 +92,19 @@
image::images/new-web-application1.png[title="CDIオプションを選択すると、プロジェクトのbeans.xmlファイルが生成される"]
-[start=6]
+
. 「次」をクリックします。
-[start=7]
+
. 「フレームワーク」パネルで「JavaServer Faces」オプションを選択します。
-[start=8]
+
. 「構成」タブをクリックし、「優先ページ言語」として「Facelets」が選択されていることを確認します。「終了」をクリックします。
「終了」をクリックすると、IDEはWebアプリケーション・プロジェクトを生成し、`index.xhtml`開始ページがエディタに表示されます。
-[start=9]
+
. 「プロジェクト」ウィンドウで、「ライブラリ」>「GlassFish Server」ノードを展開すると、`weld-osgi-bundle.jar`ライブラリが自動的に追加されていることがわかります。GlassFish Serverには、JSR-299 CDI仕様のJBossの実装であるWeldが含まれています。
image::images/projects-window1.png[title="CDIのbeans.xmlファイルが挿入された新しいプロジェクトとWeld JARファイルが挿入されたGlassFishライブラリ"]
@@ -118,10 +118,10 @@
この課題では、EL構文を使用してCDI管理対象BeanをFaceletsページに接続する方法を示します。
-[start=1]
+
. 「プロジェクト」ウィンドウで「ソース・パッケージ」ノードを右クリックし、「新規」>「Javaクラス」を選択します。
-[start=2]
+
. 新規Javaクラス・ウィザードで、「クラス名」に「*MessageServerBean*」、「パッケージ」に「*exercise1*」と入力します。(ウィザードの完了時に新しいパッケージが作成されます。)「終了」をクリックします。
image::images/new-java-class.png[title="Javaクラス・ウィザードを使用した新しいJavaクラスの作成"]
@@ -129,7 +129,7 @@
新しいパッケージおよびクラスが生成され、エディタでクラスが開きます。
-[start=3]
+
. クラスに`@Named`および`@Dependent`注釈を付けて、文字列を返す1つのメソッドを作成します。
[source,java]
@@ -155,10 +155,10 @@
NOTE: ``@Dependent`` 注釈は、管理対象Beanのスコープを定義します。*暗黙的Beanアーカイブ*では、管理対象Beanは検出可能なだけで、スコープが指定されている場合にコンテナによってのみ管理されます。プロジェクトの作成時に ``beans.xml`` を作成しなかった場合、Java EEバージョンとしてJava EE 7 Webを指定すると、このチュートリアルのアプリケーションは暗黙的Beanアーカイブとしてパッケージされます。管理対象beanのスコープの指定の詳細は、Java EE 7チュートリアルのlink:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure001.htm[+注釈を使用した管理対象Beanの構成+]を参照してください。
-[start=4]
+
. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。`@Named`注釈を追加することで、CDIで定義されているように`MessageServerBean`クラスは_管理対象Bean_になります。
-[start=5]
+
. エディタで([Ctrl]-[Tab]を押して) `index.xhtml` Faceletsページに切り替え、`<h:body>`タグに次の内容を追加します。
[source,xml]
@@ -179,13 +179,13 @@
image::images/facelets-el-completion.png[title="Javaクラス・ウィザードを使用した新しいJavaクラスの作成"]
-[start=6]
+
. IDEのメイン・ツールバーにある「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。プロジェクトがコンパイルされてGlassFishにデプロイされ、アプリケーションの開始ページ(`index.xhtml`)がブラウザで開きます。「Hello World!」メッセージが`MessageServerBean`によってページに表示されます。
image::images/browser-output1.png[title="アプリケーションの開始ページにMessageServerBeanの詳細が表示される"]
-[start=7]
+
. メッセージBeanに戻って、メッセージを何か他のもの(「Hello Weld!」など)に変更します。ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してからブラウザをリフレッシュします。新しいメッセージが自動的に表示されます。IDEの「保存時にデプロイ」機能によって、保存した変更はすべて自動的にコンパイルされてサーバーに再デプロイメントされます。
ページの3行目から、クラス名が`exercise1.MessageServerBean`であることが確認できます。このBeanは単なるPOJO (Plain Old Java Object)であることに注目してください。Java EEで開発しているにもかかわらず、トランザクションやインターセプタなどが複数のレイヤーに重なった複雑なクラス階層は必要ありません。
@@ -228,7 +228,7 @@
}
----
-[start=2]
+
. ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してからブラウザに移動してリフレッシュします。次のような出力が表示されます。
image::images/browser-output-ejb1.png[title="@Stateless注釈を使用した、MessageServerBeanからEJBへの変換"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_pt_BR.asciidoc
index 7af2ca8..e75ca3d 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_pt_BR.asciidoc
@@ -40,13 +40,13 @@
* <<upgrading,Atualizando para um EJB>>
* <<seealso,Consulte Também>>
-[start=2]
+
. link:cdi-inject.html[+Trabalhando com Injeção e Qualificadores no CDI+]
-[start=3]
+
. link:cdi-validate.html[+Aplicando Anotações @Alternative Beans e de Ciclo de Vida+]
-[start=4]
+
. link:cdi-events.html[+Trabalhando com Eventos no CDI+]
A Injeção de Dependência e Contextos (CDI), especificada por link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], é parte integrante do Java EE 6 e fornece uma arquitetura que permite aos componentes do Java EE, como os servlets, enterprise beans e JavaBeans, existirem dentro do ciclo de vida de uma aplicação com escopos bem definidos. Além disso, os serviços CDI permitem que os componentes do Java EE, como beans de sessão EJB e beans gerenciados do JavaServer Faces (JSF), sejam injetados e interajam de maneira acoplada flexível, disparando e observando eventos.
@@ -92,19 +92,19 @@
image::images/new-web-application1.png[title="A opção CDI, quando selecionada, gera um arquivo beans.xml para o projeto"]
-[start=6]
+
. Clique em Próximo.
-[start=7]
+
. No painel Frameworks, selecione a opção JavaServer Faces.
-[start=8]
+
. Clique na guia Configuração e confirme se Facelets está selecionada como a Linguagem de Página Preferencial. Clique em Finalizar.
Quando você clica em Finalizar, o IDE gera o projeto de aplicação Web e abre a página de boas-vindas do arquivo `index.xhtml` no editor.
-[start=9]
+
. Na janela Projetos, expanda o nó Bibliotecas > GlassFish Server para ver se a biblioteca `weld-osgi-bundle.jar` foi adicionada automaticamente. O GlassFish Server inclui o Weld, que é uma implementação do JBoss da especificação JSR-299 CDI.
image::images/projects-window1.png[title="Novo projeto contém arquivo beans.xml do CDI e a biblioteca do GlassFish inclui o arquivo Weld JAR"]
@@ -125,7 +125,7 @@
O novo pacote e a nova classe serão gerados e a classe será aberta no editor.
-[start=3]
+
. Anote a classe com as anotações `@Named` e `@Dependent` e crie um único método para retornar uma string.
[source,java]
@@ -150,10 +150,10 @@
NOTE: A anotação ``@Dependent`` define o escopo do bean gerenciado. Em um *archive de bean implícito*, um bean gerenciado só pode ser descoberto e gerenciado pelo contêiner quando um escopo é especificado. A aplicação neste tutorial será encapsulada como um archive de bean implícito se você especificou o Java EE 7 Web como a versão do Java EE quando criou o projeto e não criou ``beans.xml`` . Para obter detalhes sobre como especificar o escopo de beans gerenciados, consulte link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure001.htm[+Usando Anotações para Configurar Beans Gerenciados+] no Tutorial do Java EE 7.
-[start=4]
+
. Salve o arquivo (Ctrl-S; ⌘-S no Mac). Com a adição da anotação `@Named`, a classe `MessageServerBean` se torna um _bean gerenciado_, como definido pelo CDI.
-[start=5]
+
. Vá para a página Facelets `index.xhtml` (pressione Crtl-Tab) no editor e adicione o seguinte conteúdo às tags `<h:body>`.
[source,xml]
@@ -174,13 +174,13 @@
image::images/facelets-el-completion.png[title="Criar novas classes Java usando o assistente de Classe Java"]
-[start=6]
+
. Clique no botão Executar Projeto (image::images/run-project-btn.png[]) na barra de ferramentas principal do IDE. O projeto será compilado e implantado no GlassFish e a página de boas-vindas da aplicação (`index.xhtml`) será aberta no browser. Você poderá ver a mensagem "Olá Mundo!" do `MessageServerBean` exibida na página.
image::images/browser-output1.png[title="A página de boas-vindas da aplicação exibe detalhes do MessageServerBean"]
-[start=7]
+
. Volte para o bean da mensagem e altere a mensagem para algo diferente (ex., "Olá Weld!"). Salve o arquivo (Ctrl-S;⌘-S no Mac) e, em seguida, atualize o browser. A nova mensagem aparecerá automaticamente. Graças à Implantação do IDE no recurso Salvar, quaisquer alterações salvas resultarão em compilação automática e reimplantação no servidor.
A partir da terceira linha da página você poderá ver que o nome da classe é `exercise1.MessageServerBean`. Observe que o bean é só um POJO (Plain Old Java Object - Objeto Java Antigo Simples). Embora esteja desenvolvendo no Java EE, não há hierarquia de classe complexa envolvida em camadas de transações, interceptores e todas as coisas "pesadas" que se costuma ouvir.
@@ -223,7 +223,7 @@
}
----
-[start=2]
+
. Salve o arquivo (Ctrl-S; ⌘-S no Mac), vá para o browser e atualize-o. Um resultado semelhante ao seguinte será visto:
image::images/browser-output-ejb1.png[title="Usar a anotação @stateless transforma o MessageServerBean em um EJB"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ru.asciidoc
index 41bbbcf..1b208fa 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_ru.asciidoc
@@ -39,13 +39,13 @@
* <<upgrading,Переход к EJB>>
* <<seealso,Дополнительные сведения>>
-[start=2]
+
. link:cdi-inject.html[+Работа с внедрением и квалификаторами в CDI+]
-[start=3]
+
. link:cdi-validate.html[+Применение аннотации @Alternative и аннотаций жизненного цикла+]
-[start=4]
+
. link:cdi-events.html[+Обработка событий в CDI+]
Внедрение контекстов и зависимостей (CDI), определяемое документом link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], является неотъемлемой частью Java EE 6 и обеспечивает архитектуру, позволяющую компонентам Java EE (например, сервлетам, компонентам EJB и JavaBeans) существовать в жизненном цикле приложения с четко определенными контекстами. Кроме того, службы CDI позволяют компонентам Java EE (например, компонентам сеансов EJB и управляемым компонентам JavaServer Faces) внедряться и свободно взаимодействовать путем запуска и обработки событий.
@@ -91,19 +91,19 @@
image::images/new-web-application1.png[title="Если выбран параметр CDI, он создает файл beans.xml для проекта"]
-[start=6]
+
. Нажмите кнопку "Далее".
-[start=7]
+
. На панели "Платформы" выберите параметр JavaServer Faces.
-[start=8]
+
. Перейдите на вкладку "Настройка" и убедитесь, что в качестве предпочтительного языка страницы выбран "Facelets". Нажмите кнопку "Завершить".
При нажатии кнопки "Завершить" в среде IDE создается проект веб-приложения и в редакторе открывается страница приветствия `index.xhtml`.
-[start=9]
+
. В окне "Проекты" разверните узел "Библиотеки > GlassFish Server". Вы увидите, что в этот узел автоматически добавлена библиотека `weld-osgi-bundle.jar`. В состав сервера GlassFish входит Weld, который является реализацией спецификации CDI JSR-299 от JBoss.
image::images/projects-window1.png[title="Новый проект содержит файл beans.xml CDI, а библиотека GlassFish включает файл Weld JAR"]
@@ -117,10 +117,10 @@
В этом упражнении демонстрируется способ связи компонентов, управляемых CDI, со страницами Facelets с помощью синтаксиса EL.
-[start=1]
+
. В окне "Проекты" щелкните правой кнопкой узел "Исходные файлы" и выберите команду "Создать" > "Класс Java".
-[start=2]
+
. В мастере создания класса Java введите имя класса *MessageServerBean* и введите *exercise1* в поле "Пакет". Новый пакет будет создан после завершения работы мастера. Нажмите "Готово".
image::images/new-java-class.png[title="Создайте новые классы Java с помощью мастера классов Java"]
@@ -128,7 +128,7 @@
Создаются новый пакет и класс, после чего класс открывается в редакторе.
-[start=3]
+
. Добавьте к классу аннотации `@Named` и `@Dependent` и создайте одиночный метод для возврата строки.
[source,java]
@@ -154,10 +154,10 @@
NOTE: Аннотация ``@Dependent`` определяет область действия управляемого компонента bean. В *архиве неявного компонента bean* управляемый компонент bean доступен только для обнаружения и может управляться контейнером, только если указана область действия. В данном упражнении приложение будет упаковано как архив неявного компонента bean (при условии, что в качестве версии проекта выбрана Java EE 7 и не создан файл ``beans.xml`` ). Подробные сведения об области действия управляемых компонентов bean см. в разделе link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure001.htm[+Настройка управляемых компонентов bean с помощью аннотаций+] учебного курса по Java EE 7.
-[start=4]
+
. Сохраните файл (сочетание клавиш Ctrl-S; ⌘-S в Mac). После добавления аннотации `@Named` класс `MessageServerBean` стал _ управляемым компонентом _, в соответствии с определением CDI.
-[start=5]
+
. Переключитесь в редакторе на страницу Facelets `index.xhtml`(нажмите сочетание клавиш CTRL+TAB) и добавьте следующий текст в теги `<h:body>`.
[source,xml]
@@ -177,13 +177,13 @@
image::images/facelets-el-completion.png[title="Создайте новые классы Java с помощью мастера классов Java"]
-[start=6]
+
. Нажмите кнопку 'Запустить проект' (image:images/run-project-btn.png[]) на главной панели инструментов IDE. Файл компилируется и развертывается в GlassFish, и страница приветствия приложения (`index.xhtml `) отображается в веб-браузере. На странице отображается текст "Hello World!" из `MessageServerBean`.
image::images/browser-output1.png[title="На странице приветствия приложения отображаются сведения о MessageServerBean"]
-[start=7]
+
. Вернитесь к компоненту сообщения и измените сообщение на другое (например, "Hello Weld!"). Сохраните файл (Ctrl-S; ⌘-S в Mac), затем обновите браузер. Автоматически отображается новое сообщение. Это происходит благодаря возможности "Развертывание при сохранении" среды IDE, все сохраненные изменения вызывают компиляцию и повторное развертывание на сервере.
В третьей строке на этой странице видно, что имя класса – `exercise1.MessageServerBean` Обратите внимание, что компонент представляет собой объект POJO (Plain Old Java Object, простой старый объект Java). Несмотря на использование Java EE, при разработке отсутствует комплексная иерархия классов, связанная уровнями транзакций, перехватами и другие сложные особенности.
@@ -226,7 +226,7 @@
}
----
-[start=2]
+
. Сохраните файл (Ctrl-S; ⌘-S в Mac), затем перейдите в браузер и обновите. Отображается приблизительно следующее:
image::images/browser-output-ejb1.png[title="Использование аннотации @Stateless преобразует MessageServerBean в EJB"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_zh_CN.asciidoc
index 67a6c18..7d9c97a 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-intro_zh_CN.asciidoc
@@ -39,13 +39,13 @@
* <<upgrading,升级到 EJB>>
* <<seealso,另请参见>>
-[start=2]
+
. link:cdi-inject.html[+使用 CDI 中的注入和限定符+]
-[start=3]
+
. link:cdi-validate.html[+应用 @Alternative Bean 和生命周期标注+]
-[start=4]
+
. link:cdi-events.html[+使用 CDI 中的事件+]
link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] 指定的上下文和依赖关系注入 (CDI) 是 Java EE 6 的一个组成部分,提供了一个体系结构,以允许 Java EE 组件(例如 Servlet、企业 Bean 和 JavaBeans)在具有明确定义范围的应用程序生命周期内存在。此外,CDI 服务允许 Java EE 组件(例如 EJB 会话 Bean 和 JavaServer Faces (JSF) 受管 Bean)注入并通过触发和观察事件以松散耦合的方式进行交互。
@@ -92,19 +92,19 @@
image::images/new-web-application1.png[title="在选中时为项目生成 beans.xml 文件的 CDI 选项"]
-[start=6]
+
. 单击 "Next"(下一步)。
-[start=7]
+
. 在 "Frameworks"(框架)面板中,选择 "JavaServer Faces" 选项。
-[start=8]
+
. 单击 "Configuration"(配置)标签,并确认将 Facelets 选作 "Preferred Page Language"(首选页面语言)。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 生成 Web 应用程序项目并在编辑器中打开 `index.xhtml` 欢迎页。
-[start=9]
+
. 在 "Projects"(项目)窗口中,展开 "Libraries"(库)> "GlassFish Server" 节点,可以看到自动添加了 `weld-osgi-bundle.jar` 库。GlassFish Server 包含 Weld,这是 JBoss 的 JSR-299 CDI 规范的实现。
image::images/projects-window1.png[title="新项目包含 CDI 的 beans.xml 文件和 GlassFish 库,该库包括 Weld JAR 文件"]
@@ -125,7 +125,7 @@
新类和包生成,并在编辑器中打开此类。
-[start=3]
+
. 使用 `@Named` 和 `@Dependent` 标注对此类进行标注,并创建一个返回字符串的方法。
[source,java]
@@ -151,10 +151,10 @@
NOTE: ``@Dependent`` 标注定义受管 Bean 的范围。在 *implicit bean archive*(隐式 Bean 档案)中,仅当指定了范围时,受管 Bean 才可发现并且只能由容器管理。如果在创建项目时指定 Java EE 7 Web 作为 Java EE 版本并且未创建 ``beans.xml`` ,则会将本教程中的应用程序打包为隐式 Bean 档案。有关指定受管 Bean 的范围的详细信息,请参见 Java EE 7 教程中的link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure001.htm[+使用标注配置受管 Bean+]。
-[start=4]
+
. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。根据 CDI 的定义,通过添加 `@Named` 标注,`MessageServerBean` 类成为_受管 Bean_。
-[start=5]
+
. 在编辑器中切换至 `index.xhtml` Facelets 页(按 Ctrl-Tab 组合键),然后在 `<h:body>` 标记中添加以下内容。
[source,xml]
@@ -174,13 +174,13 @@
image::images/facelets-el-completion.png[title="使用 Java 类向导创建新 Java 类"]
-[start=6]
+
. 在 IDE 的主工具栏中单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。编译该项目并将其部署到 GlassFish,并在浏览器中打开应用程序欢迎页 (`index.xhtml`)。您将看到来自该页上显示的 `MessageServerBean` 的 "Hello World!" 消息。
image::images/browser-output1.png[title="应用程序欢迎页显示 MessageServerBean 详细信息"]
-[start=7]
+
. 返回至消息 Bean 并将消息更改为其他内容(例如,"Hello Weld!")。保存文件(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键),然后刷新浏览器。将自动显示新消息。因为有了 IDE 的“在保存时部署”功能,保存的任何更改都会自动进行编辑并重新部署到服务器。
从此页第三行,您可以看到类名为 `exercise1.MessageServerBean`。请注意,Bean 只是一个 POJO(Plain Old Java Object,简单传统 Java 对象)。即使您现在使用 Java EE 进行开发,事务、拦截器以及重复出现的所有“重型”功能等层中也不会包含复杂的类分层结构。
@@ -223,7 +223,7 @@
}
----
-[start=2]
+
. 保存文件(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键),然后转到浏览器并刷新。将看到类似于以下内容的输出:
image::images/browser-output-ejb1.png[title="使用 @Stateless 标注将 MessageServerBean 转换为 EJB"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate.asciidoc
index 267073a..cdb77ff 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate.asciidoc
@@ -40,7 +40,7 @@
* <<lifecycle,Applying Lifecycle Annotations to Managed Beans>>
* <<seealso,See Also>>
-[start=4]
+
. link:cdi-events.html[+Working with Events in CDI+]
Contexts and Dependency Injection (CDI), specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], is an integral part of Java EE 6 and provides an architecture that allows Java EE components such as servlets, enterprise beans, and JavaBeans to exist within the lifecycle of an application with well-defined scopes. In addition, CDI services allow Java EE components such as EJB session beans and JavaServer Faces (JSF) managed beans to be injected and to interact in a loosely coupled way by firing and observing events.
@@ -88,16 +88,16 @@
Click the New File ( image:images/new-file-btn.png[] ) button or press Ctrl-N (⌘-N on Mac) to open the File wizard.
-[start=5]
+
. Select the Java category, then select Java Interface. Click Next.
-[start=6]
+
. Type in *ItemValidator* as the class name, then enter *exercise3* as the package.
-[start=7]
+
. Click Finish. The new interface is generated and opens in the editor.
-[start=8]
+
. Add a method called `isValid()` that takes an `Item` object and returns a `boolean` value.
[source,java]
@@ -109,7 +109,7 @@
----
(Use the editor's hint to add the import statement for `exercise2.Item`.)
-[start=9]
+
. Expand the `ItemProcessor` class to incorporate the new feature. Open `ItemProcessor` in the editor and make the following changes.
[source,java]
@@ -137,13 +137,13 @@
Use the editor's hint to add the import statement for `exercise3.ItemValidator`.
-[start=10]
+
. Create an implementation of `ItemValidator` named `DefaultItemValidator` that simply tests the limit against the value.
In the Projects window, right-click the `exercise3` package and choose New > Java Class. Name the class *DefaultItemValidator* and click Finish.
-[start=11]
+
. Have `DefaultItemValidator` implement `ItemValidator` and override the `isValid()` method as follows.
[source,java]
@@ -161,10 +161,10 @@
(Use the editor's hint to add the import statement for `exercise2.Item`.)
-[start=12]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button in the IDE's main toolbar. The project is compiled and deployed to GlassFish, and the application's welcome page (`process.xhtml`) opens in the browser.
-[start=13]
+
. Click the '`Execute`' button that displays on the page. Switch back to the IDE and examine the GlassFish server log. The server log displays in the Output window (Ctrl-4; ⌘-4 on Mac) under the GlassFish tab. You can see that items are being validated, and the only valid item listed is the case where the value is less than the limit.
[source,java]
@@ -179,13 +179,13 @@
image::images/output-window.png[title="View the server log in the Output window"]
-[start=14]
+
. Now consider a scenario where you have to deploy to a different site that is more relaxed and considers an item invalid only if the value is more than twice the limit. You may want to have another bean that implements the `ItemValidator` interface for that logic.
Create a new implementation of `ItemValidator` named `RelaxedItemValidator`. In the Projects window, right-click the `exercise3` package and choose New > Java Class. Name the class *RelaxedItemValidator* and click Finish.
-[start=15]
+
. Have `RelaxedItemValidator` implement `ItemValidator` and override the `isValid()` method as follows.
[source,java]
@@ -203,10 +203,10 @@
(Use the editor's hint to add the import statement for `exercise2.Item`.)
-[start=16]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button to run the project. Note that the project now fails to deploy.
-[start=17]
+
. Examine the server log in the Output window (Ctrl-4; ⌘-4 on Mac). You see an error message reporting an 'ambiguous dependency' problem. This occurs because you now have two classes implementing the same interface.
[source,java]
@@ -223,7 +223,7 @@
As mentioned, the only difference is based on deployment. For most deployments, you want to use the default validator, but for one deployment you want to use the 'relaxed' implementation. CDI offers the use of the `@Alternative` annotation which lets you package multiple beans that match an injection point without ambiguity errors, and the bean to use is defined in the `beans.xml`. This allows you to deploy both implementations in the same module with the only difference being the `beans.xml` definition, which can change over different deployments.
-[start=18]
+
. Add the `@Alternative` annotation and corresponding import statement to `RelaxedItemValidator` and `DefaultItemValidator`.
Open `RelaxedItemValidator` in the editor and make the following change.
@@ -268,13 +268,13 @@
If you deployed the application now you would get an 'unsatisfied dependency' error since you defined the two matching beans as alternative but you did not enable either of them in the `beans.xml` file.
-[start=19]
+
. Use the IDE's Go to File dialog to quickly open the `beans.xml` file. Choose Navigate > Go to File from the IDE's main menu (Alt-Shift-O; Ctrl-Shift-O on Mac), then type '`beans`'. Click OK.
image::images/go-to-file.png[title="Use the Go to File dialog to quickly locate a project file"]
-[start=20]
+
. Make the following change to the `beans.xml` file.
[source,xml]
@@ -294,7 +294,7 @@
This tells CDI to use the `RelaxedItemValidator` for this deployment. You can think of the `@Alternative` annotation as effectively disabling the bean, making it unavailable for injection, but allowing the implementation to be packaged with the other beans. Adding it as an alternative in the `beans.xml` file effectively re-enables the bean, making it available for injection. By moving this type of metadata to the `beans.xml` file, we can bundle different versions of the file with different deployments.
-[start=21]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button to run the project (Alternatively, press F6; fn-F6 on Mac). In the browser, click the '`Execute`' button that displays on the page. Switch back to the IDE and examine the GlassFish server log displayed in the Output window (Ctrl-4; ⌘-4 on Mac).
[source,java]
@@ -325,7 +325,7 @@
The new interface is generated and opens in the editor.
-[start=3]
+
. Add a method called `handleItem()` that takes an `Item` object as an argument.
[source,java]
@@ -339,13 +339,13 @@
(Use the editor's hint to add the import statement for `exercise2.Item`.)
-[start=4]
+
. Begin by implementing the `ItemErrorHandler` with a bogus handler named `FileErrorReporter` that saves item details to a file.
In the Projects window, right-click the `exercise3` package and choose New > Java Class. Name the class *FileErrorReporter* and click Finish.
-[start=5]
+
. Have `FileErrorReporter` implement `ItemErrorHandler` and override the `handleItem()` method as follows.
[source,java]
@@ -365,7 +365,7 @@
You want to open the file before you start handling items, leave it open for the duration of the process as content is added to the file, and then close the file when we the processing is done. You could manually add `initProcess()` and `finishProcess()` methods to the error reporter bean, but then you could not code to the interface since the caller would need to know about those class specific methods. You could add those same methods to the `ItemErrorReporter` interface but then you would have to unnecessarily implement those methods in every class that implements that interface. Instead, you can use some of the lifecycle annotations from the Managed Bean specification (included in link:http://jcp.org/en/jsr/detail?id=316[+JSR 316: Java Platform, Enterprise Edition 6 Specification+]) to call methods on the bean at certain points in the bean lifecycle. A `@PostConstruct` annotated method is called when the bean has been constructed and any dependencies the bean has have been injected. Likewise, a `@PreDestroy` annotated method is called just before the bean is disposed of by the container.
-[start=6]
+
. Add the following `init()` and `release()` methods with corresponding `@PostConstruct` and `@PreDestroy` annotations.
[source,java]
@@ -390,10 +390,10 @@
}
----
-[start=7]
+
. Fix imports. Either right-click in the editor and choose Fix Imports, or press Ctrl-Shift-I (⌘-Shift-I on Mac). Import statements for `javax.annotation.PostConstruct` and `javax.annotation.PreDestroy` are added to the top of the file.
-[start=8]
+
. Finally, add the new `ItemErrorHandler` bean to the `ItemProcessor`.
[source,java]
@@ -426,7 +426,7 @@
(Use the editor's hint to add the import statement for `exercise3.ItemErrorHandler`.)
-[start=9]
+
. Click the Run Project ( image:images/run-project-btn.png[] ) button to run the project (Alternatively, press F6; fn-F6 on Mac). In the browser, click the '`Execute`' button that displays on the page. Switch back to the IDE and examine the GlassFish server log displayed in the Output window (Ctrl-4; ⌘-4 on Mac).
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ja.asciidoc
index 532d059..b93becd 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ja.asciidoc
@@ -41,7 +41,7 @@
* <<lifecycle,管理対象Beanへのライフサイクル注釈の適用>>
* <<seealso,関連項目>>
-[start=4]
+
. link:cdi-events.html[+CDIのイベントの操作+]
link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+]で指定されているコンテキストと依存性の注入(CDI: Contexts and Dependency Injection)はJava EE 6の不可欠な部分であり、サーブレット、エンタープライズBean、JavaBeansなどのJava EEコンポーネントが、アプリケーションのライフサイクル内で明確なスコープを持って存在できるようにするためのアーキテクチャを提供します。また、CDIサービスによって、EJBセッションBeanやJSF (JavaServer Faces)管理対象BeanなどのJava EEコンポーネントが注入可能になり、イベントの起動や監視による疎結合方式の対話が可能になります。
@@ -88,16 +88,16 @@
「新規ファイル」(image:images/new-file-btn.png[])ボタンをクリックするか、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押してファイル・ウィザードを開きます。
-[start=5]
+
. 「Java」カテゴリから「Javaインタフェース」を選択します。「次」をクリックします。
-[start=6]
+
. クラス名として「*ItemValidator*」、パッケージとして「*exercise3*」と入力します。
-[start=7]
+
. 「終了」をクリックします。新しいインタフェースが生成され、エディタで開かれます。
-[start=8]
+
. `Item`オブジェクトを取って`boolean`値を返す`isValid()`という名前のメソッドを追加します。
[source,java]
@@ -109,7 +109,7 @@
----
(エディタのヒントを使用して`exercise2.Item`のインポート文を追加します。)
-[start=9]
+
. `ItemProcessor`クラスを拡張して新しい機能を組み込みます。エディタで`ItemProcessor`を開いて、次のように変更します。
[source,java]
@@ -137,13 +137,13 @@
エディタのヒントを使用して`exercise3.ItemValidator`のインポート文を追加します。
-[start=10]
+
. 値の制限値をテストするのみの、`DefaultItemValidator`という名前の`ItemValidator`の実装を作成します。
「プロジェクト」ウィンドウで「`exercise3`」パッケージを右クリックし、「新規」>「Javaクラス」を選択します。クラスに「*DefaultItemValidator*」という名前を付け、「終了」をクリックします。
-[start=11]
+
. 次のようにして、`DefaultItemValidator`で`ItemValidator`を実装し、`isValid()`メソッドをオーバーライドします。
[source,java]
@@ -161,10 +161,10 @@
(エディタのヒントを使用して`exercise2.Item`のインポート文を追加します。)
-[start=12]
+
. IDEのメイン・ツールバーにある「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックします。プロジェクトがコンパイルされてGlassFishにデプロイされ、アプリケーションの開始ページ(`process.xhtml`)がブラウザで開きます。
-[start=13]
+
. ページに表示されている「`Execute`」ボタンをクリックします。IDEに戻ってGlassFishのサーバー・ログを調べます。サーバー・ログは、「出力」ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])の「GlassFish」タブの下に表示されます。項目が検証されていることが表示されます。制限値より小さい、有効な項目のみが一覧表示されます。
[source,java]
@@ -179,13 +179,13 @@
image::images/output-window.png[title="「出力」ウィンドウでのサーバー・ログの表示"]
-[start=14]
+
. ここで、条件を緩和して、値が制限の2倍を超える場合にのみ項目を無効と見なす別のサイトへデプロイするシナリオを考えます。このロジックのために、`ItemValidator`インタフェースを実装する別のBeanを用意します。
`RelaxedItemValidator`という名前の`ItemValidator`の新しい実装を作成します。「プロジェクト」ウィンドウで「`exercise3`」パッケージを右クリックし、「新規」>「Javaクラス」を選択します。クラスに「*RelaxedItemValidator*」という名前を付け、「終了」をクリックします。
-[start=15]
+
. 次のようにして、`RelaxedItemValidator`で`ItemValidator`を実装し、`isValid()`メソッドをオーバーライドします。
[source,java]
@@ -203,10 +203,10 @@
(エディタのヒントを使用して`exercise2.Item`のインポート文を追加します。)
-[start=16]
+
. 「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックして、プロジェクトを実行します。今度はプロジェクトのデプロイに失敗します。
-[start=17]
+
. 出力ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])でサーバー・ログを調べます。「あいまいな依存性」の問題を報告するエラー・メッセージが確認できます。これは、現時点で同じインタフェースを実装しているクラスが2つあるために起こります。
[source,java]
@@ -223,7 +223,7 @@
前述のように、唯一の違いはデプロイメントに基づいています。ほとんどのデプロイメントにはデフォルトのバリデータを使用しますが、1つのデプロイメントには「緩和された」実装を使用するようにします。CDIでは、注入ポイントに一致するBeanが複数存在する場合でも、あいまい性のエラーを発生させずにパッケージ化できる`@Alternative`注釈を使用できます。使用するBeanは、`beans.xml`に定義します。これにより、`beans.xml`の定義のみが異なる両方の実装を同じモジュール内にデプロイできます(この定義はデプロイメントごとに変更できます)。
-[start=18]
+
. `@Alternative`注釈および対応するインポート文を、`RelaxedItemValidator`および`DefaultItemValidator`に追加します。
エディタで`RelaxedItemValidator`を開いて、次のように変更します。
@@ -268,13 +268,13 @@
ここでアプリケーションをデプロイすると「満たされない依存性」というエラーが出ますが、これは、一致するBeanを選択肢として2つ定義したけれども、`beans.xml`ファイルでどちらも有効にしていないためです。
-[start=19]
+
. IDEの「ファイルに移動」ダイアログを使用すると、すばやく`beans.xml`を開けます。IDEのメイン・メニューで「ナビゲート」>「ファイルに移動」([Alt]-[Shift]-[O]、Macの場合は[Ctrl]-[Shift]-[O])を選択してから「`beans`」と入力します。「OK」をクリックします。
image::images/go-to-file.png[title="「ファイルに移動」ダイアログを使用した、プロジェクト・ファイルの速やかな検索"]
-[start=20]
+
. `beans.xml`ファイルに以下の変更を加えます。
[source,xml]
@@ -294,7 +294,7 @@
これによって、このデプロイメントでは`RelaxedItemValidator`を使用することがCDIに伝えられます。`@Alternative`注釈は、Beanを事実上無効にして注釈に使用できないようにする一方で、他のBeanとともに実装をパッケージ化できるようにするものと考えることができます。これを`beans.xml`ファイルに代替として追加すると、事実上、Beanを再度有効にして、注入に使用できるようにします。このタイプのメタデータを`beans.xml`ファイルへ移動することで、様々なバージョンのファイルを様々なデプロイメントでバンドルできます。
-[start=21]
+
. 「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックして(または[F6]、Macの場合は[fn]-[F6]を押して)、プロジェクトを実行します。ブラウザで、ページに表示されている「`Execute`」ボタンをクリックします。IDEに戻り、出力ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])に表示されたGlassFishのサーバー・ログを調べます。
[source,java]
@@ -325,7 +325,7 @@
新しいインタフェースが生成され、エディタで開かれます。
-[start=3]
+
. 引数として`Item`オブジェクトを取る`handleItem()`という名前のメソッドを追加します。
[source,java]
@@ -339,13 +339,13 @@
(エディタのヒントを使用して`exercise2.Item`のインポート文を追加します。)
-[start=4]
+
. まず、項目の詳細をファイルに保存する`FileErrorReporter`という名前の偽のハンドラを持つ`ItemErrorHandler`を実装します。
「プロジェクト」ウィンドウで「`exercise3`」パッケージを右クリックし、「新規」>「Javaクラス」を選択します。クラスに「*FileErrorReporter*」という名前を付け、「終了」をクリックします。
-[start=5]
+
. 次のようにして、`FileErrorReporter`で`ItemErrorHandler`を実装し、`handleItem()`メソッドをオーバーライドします。
[source,java]
@@ -365,7 +365,7 @@
項目の処理を始める前にファイルを開き、処理中は開いたままにしてファイルに内容を追加し、処理が終了したらファイルを閉じるようにします。`initProcess()`および`finishProcess()`メソッドをエラー・レポータBeanに手動で追加することもできますが、そうするとコール元がそれらのクラス固有のメソッドについて知る必要があるため、インタフェースへのコードを作成できなくなります。それらの同じメソッドを`ItemErrorReporter`インタフェースに追加することもできますが、そうするとこのインタフェースを実装するすべてのクラスに、これらのメソッドを不必要に実装する必要があります。かわりに、管理対象Beanの仕様(link:http://jcp.org/en/jsr/detail?id=316[+JSR 316: Java Platform, Enterprise Edition 6の仕様+]に含まれる)からいくつかのライフサイクル注釈を使用して、Beanライフサイクルの特定の時点でBean上でメソッドをコールできます。Beanが構築され、Beanが持つすべての依存性が注入されると、`@PostConstruct`注釈付きメソッドがコールされます。同様に、Beanがコンテナによって破棄される直前に`@PreDestroy`注釈付きメソッドがコールされます。
-[start=6]
+
. 次のように、対応する`@PostConstruct`および`@PreDestroy`注釈を持つ`init()`および`release()`メソッドを追加します。
[source,java]
@@ -390,10 +390,10 @@
}
----
-[start=7]
+
. インポートを修正します。エディタを右クリックして「インポートを修正」を選択するか、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押します。`javax.annotation.PostConstruct`および`javax.annotation.PreDestroy`のインポート文がファイルの最初に追加されます。
-[start=8]
+
. 最後に、新しい`ItemErrorHandler` Beanを`ItemProcessor`に追加します。
[source,java]
@@ -426,7 +426,7 @@
(エディタのヒントを使用して`exercise3.ItemErrorHandler`のインポート文を追加します。)
-[start=9]
+
. 「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックして(または[F6]、Macの場合は[fn]-[F6]を押して)、プロジェクトを実行します。ブラウザで、ページに表示されている「`Execute`」ボタンをクリックします。IDEに戻り、出力ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])に表示されたGlassFishのサーバー・ログを調べます。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_pt_BR.asciidoc
index e178eb4..aaada55 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_pt_BR.asciidoc
@@ -40,7 +40,7 @@
* <<lifecycle,Aplicando Anotações de Ciclo de Vida em Beans gerenciado>>
* <<seealso,Consulte Também>>
-[start=4]
+
. link:cdi-events.html[+Trabalhando com Eventos no CDI+]
A Injeção de Dependência e Contextos (CDI), especificada por link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], é parte integrante do Java EE 6 e fornece uma arquitetura que permite aos componentes do Java EE, como os servlets, enterprise beans e JavaBeans, existirem dentro do ciclo de vida de uma aplicação com escopos bem definidos. Além disso, os serviços CDI permitem que os componentes do Java EE, como beans de sessão EJB e beans gerenciados do JavaServer Faces (JSF), sejam injetados e interajam de maneira acoplada flexível, disparando e observando eventos.
@@ -88,16 +88,16 @@
Clique no botão Novo Arquivo (image:images/new-file-btn.png[]) ou pressione CTRL-N (⌘-N no Mac) para abrir o assistente de Arquivo.
-[start=5]
+
. Selecione a categoria Java e, em seguida, selecione Interface Java. Clique em Próximo.
-[start=6]
+
. Digite *ItemValidator* como o nome da classe e, em seguida, *exercício3* como o pacote.
-[start=7]
+
. Clique em Finalizar. A nova interface será gerada e aberta no editor.
-[start=8]
+
. Adicione um método chamado `isValid()` que utiliza um objeto `Item` e retorna um valor `boolean`.
[source,java]
@@ -109,7 +109,7 @@
----
(Utilize a dica do editor para adicionar a instrução de importação para o `exercise2.Item`.)
-[start=9]
+
. Expanda a classe `ItemProcessor` para incorporar a nova funcionalidade. Abra o `ItemProcessor` no editor e faça as seguintes alterações.
[source,java]
@@ -137,13 +137,13 @@
(Utilize a dica do editor para adicionar a instrução de importação para `exercise3.ItemValidator`.)
-[start=10]
+
. Crie uma implementação do `ItemValidator` chamado `DefaultItemValidator` que simplesmente testa o limite com relação ao valor.
Na janela Projetos, clique com o botão direito do mouse no pacote `exercise3` e selecione Nova > Classe Java. Nomeie a classe como *DefaultItemValidator* e clique em Finalizar.
-[start=11]
+
. Faça com que o `DefaultItemValidator` implemente o `ItemValidator` e substitua o método `isValid()` como se segue.
[source,java]
@@ -161,10 +161,10 @@
(Utilize a dica do editor para adicionar a instrução de importação para o `exercise2.Item`.)
-[start=12]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) na barra de ferramentas principal do IDE. O projeto é compilado e implantado no GlassFish e a página de boas-vindas da aplicação (`process.xhtml`) será aberta no browser.
-[start=13]
+
. Clique no botão "`Execute`" que é exibido na página. Volte ao IDE e examine o log do GlassFish Server. O log do servidor é exibido na janela Saída (Ctrl-4; ⌘-4 no Mac) na guia GlassFish. É possível notar que os itens estão sendo validados e que o único item válido listado é o caso em que o valoe é menor que o limite.
[source,java]
@@ -179,13 +179,13 @@
image::images/output-window.png[title="Exiba o log do servidor na janela Saída"]
-[start=14]
+
. Agora, considere o cenário onde temos que implantar em um site diferente, mais flexível, e considere um item como inválido somente se o valor for mais de duas vezes maior que o limite. Pode ser necessário ter um outro bean que implemente a interface `ItemValidator` para essa lógica.
Crie uma nova implementação do `ItemValidator` chamada `RelaxedItemValidator`. Na janela Projetos, clique com o botão direito do mouse no pacote `exercise3` e selecione Nova > Classe Java. Nomeie a classe *RelaxedItemValidator* e clique em Finalizar.
-[start=15]
+
. Faça com que o `RelaxedItemValidator` implemente o `ItemValidator` e substitua o método `isValid()` como se segue.
[source,java]
@@ -203,10 +203,10 @@
(Utilize a dica do editor para adicionar a instrução de importação para o `exercise2.Item`.)
-[start=16]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) para executar o projeto. Observe que o projeto agora falha na implantação.
-[start=17]
+
. Examine o log do servidor na janela Saída (Ctrl-4; ⌘-4 no Mac). Você nota uma mensagem de erro relatando um problema de "dependência ambígua". Isso ocorre porque agora temos duas classes implementando a mesma interface.
[source,java]
@@ -223,7 +223,7 @@
Como mencionado anteriormente, a única diferença é baseada na implantação. Para a maioria das implantações, preferimos utilizar o validador default, mas para uma implantação, preferimos utilizar a implantação "flexível". O CDI oferece o uso da anotação `@Alternative` que lhe permite encapsular vários beans que coincidam com um ponto de injeção sem erros de ambiguidade e o bean a ser utilizado, que é definido no arquivo `beans.xml`. Isso lhe permite implantar as duas implementações no mesmo módulo com a definição `beans.xml` sendo a única diferença, que pode ser alterada ao longo de implantações diferentes.
-[start=18]
+
. Adicione a anotação `@Alternative` e as instruções de importação correspondentes a `RelaxedItemValidator` e `DefaultItemValidator`.
Abra o `RelaxedItemValidator` no editor e faça as seguintes alterações.
@@ -268,13 +268,13 @@
Se tivéssemos implantado a aplicação, agora obteríamos uma mensagem de erro "dependência não-satisfeita", já que definimos os dois beans coincidentes como alternativos, mas não ativamos nenhum deles no arquivo `beans.xml`.
-[start=19]
+
. Utilize a caixa de diálogo Ir para Arquivo do IDE para abrir rapidamente o arquivo `beans.xml`. Selecione Navegar > Ir para Arquivo no menu principal do IDE (Alt-Shift-O; Ctrl-Shift-O no Mac) e, em seguida, digite "`beans`". Clique em OK.
image::images/go-to-file.png[title="Use a caixa de diálogo Ir para Arquivo para localizar rapidamente um arquivo de projeto"]
-[start=20]
+
. Faça as seguintes alterações no arquivo `bean.xml`.
[source,xml]
@@ -294,7 +294,7 @@
Isso informa ao CDI que o `RelaxedItemValidator` deve ser usado para esta implantação. É possível achar que a anotação `@Alternative` desativa efetivamente o bean, tornando-o indisponível para injeção, mas permitindo que a implementação seja encapsulada com os outros beans. Adicioná-la como uma alternativa no arquivo `beans.xml` reabilita efetivamente o bean, tornando-o disponível para injeção. Ao movermos esse tipo de metadados para o arquivo `beans.xml`, podemos colocar no pacote versões diferentes do arquivo à várias implantações.
-[start=21]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) para executar o projeto (como alternativa, Pressione F6; fn-F6 no Mac). No browser, clique no botão "`Execute`" exibido na página. Volte ao IDE e examine o log do GlassFish Server exibido na janela Saída (Ctrl-4; ⌘-4 no Mac).
[source,java]
@@ -325,7 +325,7 @@
A nova interface será gerada e aberta no editor.
-[start=3]
+
. Adicione o método chamado `handleItem()` que utiliza um objeto `Item` como um argumento.
[source,java]
@@ -339,13 +339,13 @@
(Utilize a dica do editor para adicionar a instrução de importação para o `exercise2.Item`.)
-[start=4]
+
. Comece com a implementação do `ItemErrorHandler` com um handler falso chamado `FileErrorReporter` que salva os detalhes do item em um arquivo.
Na janela Projetos, clique com o botão direito do mouse no pacote `exercise3` e selecione Nova > Classe Java. Nomeie a classe *FileErrorReporter* e clique em Finalizar.
-[start=5]
+
. Faça com que o `FileErrorReporter` implemente o `ItemErrorHandler` e substitua o método `handlerItem()` como se segue.
[source,java]
@@ -365,7 +365,7 @@
Você deseja abrir o arquivo antes de começar a tratar itens, portanto, deixe-o aberto durante o processo em que o conteúdo é adicionado ao arquivo e, em seguida, feche o arquivo quando processamento tiver sido concluído. Você poderia adicionar manualmente os métodos `initProcess()` e `finishProcess()` ao bean de informe de erro, mas então não poderia codificar a interface, já que o chamador precisaria conhecer esses métodos específicos da classe. Você poderia adicionar esses mesmos métodos à interface `ItemErrorReporter`, mas então seria necessário implementar desnecessariamente tais métodos em cada classe que implemente aquela interface. Em vez disso, é possível utilizar algumas das anotações de ciclo de vida da especificação do Bean Gerenciado (incluídas na link:http://jcp.org/en/jsr/detail?id=316[+JSR 316: plataforma Java, Especificação do Enterprise Edition 6+]) para chamar os métodos no bean em alguns pontos no ciclo de vida do bean. Um método anotado `@PostConstruct` é chamado quando o bean tiver sido construído e qualquer dependência do bean tiver sido injetada. Da mesma forma, um método anotado `@PreDestroy` é chamado um pouco antes do bean ser descartado pelo contêiner.
-[start=6]
+
. Adicione os seguintes métodos `init()` e `release()` com as anotações `@PostConstruct` e `@PreDestroy` correspondentes.
[source,java]
@@ -390,10 +390,10 @@
}
----
-[start=7]
+
. Corrigir importações. Clique com o botão direito do mouse no editor e selecione Corrigir importações ou pressione Ctrl-Shift-I (⌘-Shift-I no Mac). Instruções de importação para `javax.annotation.PostConstruct` e `javax.annotation.PreDestroy` serão adicionadas à parte superior do arquivo.
-[start=8]
+
. Finalmente, adicione o novo bean `ItemErrorHandler` ao `ItemProcessor`.
[source,java]
@@ -426,7 +426,7 @@
(Utilize a dica do editor para adicionar a instrução de importação para o `exercise3.ItemErrorHandler`.)
-[start=9]
+
. Clique no botão Executar Projeto (image:images/run-project-btn.png[]) para executar o projeto (como alternativa, Pressione F6; fn-F6 no Mac). No browser, clique no botão "`Execute`" exibido na página. Volte ao IDE e examine o log do GlassFish Server exibido na janela Saída (Ctrl-4; ⌘-4 no Mac).
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ru.asciidoc
index f07b20d..50d763c 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_ru.asciidoc
@@ -40,7 +40,7 @@
* <<lifecycle,Применение аннотаций жизненного цикла к управляемым компонентам>>
* <<seealso,Дополнительные сведения>>
-[start=4]
+
. link:cdi-events.html[+Обработка событий в CDI+]
Внедрение контекстов и зависимостей (CDI), определяемое документом link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], является неотъемлемой частью Java EE 6 и обеспечивает архитектуру, позволяющую компонентам Java EE (например, сервлетам, компонентам EJB и JavaBeans) существовать в жизненном цикле приложения с четко определенными контекстами. Кроме того, службы CDI позволяют компонентам Java EE (например, компонентам сеансов EJB и управляемым компонентам JavaServer Faces) внедряться и свободно взаимодействовать путем запуска и обработки событий.
@@ -89,16 +89,16 @@
Щелкните 'Создать файл' ( image:images/new-file-btn.png[] ) или нажмите сочетание клавиш CTRL+N (⌘-N on Mac) для открытия мастера создания файлов.
-[start=5]
+
. Выберите категорию Java, а затем команду "Интерфейс Java". Нажмите кнопку "Далее".
-[start=6]
+
. Введите имя класса в *ItemValidator* и пакет *exercise3*.
-[start=7]
+
. Нажмите кнопку "Завершить". Интерфейс будет создан и открыт в редакторе.
-[start=8]
+
. Добавьте метод `isValid()`, который принимает в качестве параметра объект `Item` и возвращает логическое значение `boolean`.
[source,java]
@@ -110,7 +110,7 @@
----
С помощью подсказки редактора добавьте оператор импорта для `exercise2.Item`.
-[start=9]
+
. Расширьте класс `ItemProcessor` для добавления новой возможности. Откройте в редакторе `ItemProcessor` и внесите следующие изменения.
[source,java]
@@ -138,13 +138,13 @@
С помощью подсказки редактора добавьте оператор импорта для `exercise3.ItemValidator`.
-[start=10]
+
. Создайте реализацию `ItemValidator` под названием `DefaultItemValidator`, которая просто сравнивает значение с предельным.
В окне "Проекты" щелкните правой кнопкой пакет `exercise3` и выберите команду "Создать" > "Класс Java". Дайте классу имя *DefaultItemValidator* и нажмите кнопку "Готово".
-[start=11]
+
. В элементе `DefaultItemValidator` реализуйте `ItemValidator` и переопределите метод `isValid()` следующим образом.
[source,java]
@@ -162,10 +162,10 @@
С помощью подсказки редактора добавьте оператор импорта для `exercise2.Item`.
-[start=12]
+
. Нажмите кнопку 'Запустить проект' (image:images/run-project-btn.png[]) на главной панели инструментов IDE. Файл скомпилирован и развернут в GlassFish, и страница приветствия приложения (`process.xhtml`) отображается в веб-браузере.
-[start=13]
+
. Нажмите кнопку `Выполнить` на странице. Вернитесь в среду IDE и проверьте протокол сервера GlassFish. Журнал сервера отображается в окне вывода (Ctrl-4; ⌘-4 в Mac) на вкладке 'GlassFish'. В нем видно, что элементы проверяются и перечисляются только допустимые элементы, значение которых меньше предельного.
[source,java]
@@ -180,13 +180,13 @@
image::images/output-window.png[title="Просмотрите журнал сервера в окне вывода"]
-[start=14]
+
. Теперь рассмотрим случай, в котором вам необходимо выполнить развертывание в другом месте, менее жестком, считающим компонент недопустимым только в том случае, если его значение более чем в два раза превышает ограничение. Может потребоваться другой компонент для реализации интерфейса `ItemValidator` для данной логики.
Создайте новую реализацию `ItemValidator` с именем `RelaxedItemValidator`. В окне "Проекты" щелкните правой кнопкой пакет `exercise3` и выберите команду "Создать" > "Класс Java". Дайте классу имя *RelaxedItemValidator* и нажмите кнопку "Готово".
-[start=15]
+
. Сделайте `RelaxedItemValidator` реализацией `ItemValidator` и переопределите метод `isValid()` следующим образом.
[source,java]
@@ -204,10 +204,10 @@
С помощью подсказки редактора добавьте оператор импорта для `exercise2.Item`.
-[start=16]
+
. Для запуска проекта нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ). Обратите внимание, что теперь развертывание проекта завершается сбоем.
-[start=17]
+
. Проверьте журнал сервера в окне вывода (Ctrl-4; ⌘-4 в Mac). В протоколе отображается сообщение об ошибке неоднозначной зависимости. Это происходит по причине того, что имеются два класса, реализующих один и тот же интерфейс.
[source,java]
@@ -224,7 +224,7 @@
Как указано выше, единственное отличие связано с развертыванием. Для большинства развертываний можно использовать средство проверки по умолчанию, однако для одного развертывания может потребоваться использование "нежесткой" реализации. В CDI существует аннотация `@Alternative`, которая позволяет пакетировать несколько компонентов, соответствующих одной точке внедрения, без проблем неоднозначности, поскольку при этом используется компонент, указанный в файле `beans.xml` . Это позволяет развертывать в одном модуле обе реализации. При этом отличается только определение в файле `beans.xml` , которое уникально для каждой реализации.
-[start=18]
+
. Добавьте аннотацию `@Alternative` и соответствующий оператор импорта в `RelaxedItemValidator` и `DefaultItemValidator`.
Откройте в редакторе `RelaxedItemValidator` и внесите следующие изменения.
@@ -269,13 +269,13 @@
Выполняя развертывание приложения сейчас, вы получите ошибку "неудовлетворенная зависимость", так как два подходящих компонента были определены как альтернативные, но ни один из них не был активирован в файле `beans.xml` .
-[start=19]
+
. С помощью диалогового окна "Переход к файлу" в среде IDE откройте файл `beans.xml` . Выберите пункт "Переход" > "Переход к файлу" в главном меню среды IDE (сочетание клавиш ALT+SHIFT+O; CTRL+SHIFT+O в Mac OS), затем введите `beans`. Нажмите кнопку "ОК".
image::images/go-to-file.png[title="С помощью диалогового окна "Переход к файлу" быстро найдите файл проекта."]
-[start=20]
+
. Внесите следующие изменения в файл `beans.xml`
[source,xml]
@@ -295,7 +295,7 @@
Данная команда указывает CDI использовать `RelaxedItemValidator` для данного развертывания. Аннотация `@Alternative` может рассматриваться как способ отключения компонента, запрещения его внедрения и разрешения пакетирования реализации с другими компонентами. Добавление компонента в качестве альтернативы в файл `beans.xml` фактически снова разрешает компонент, делая его доступным для внедрения. Перемещение этого вида метаданных в файл `beans.xml` позволяет связать различные версии файла с различными развертываниями.
-[start=21]
+
. Для запуска проекта нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ). (В качестве альтернативы нажмите F6; fn-F6 в Mac) В браузере нажмите кнопку '`Выполнить`' на отображаемой странице. Переключите обратно в IDE и проверьте журнал сервера GlassFish, который отображается в окне вывода (Ctrl-4; ⌘-4 в Mac).
[source,java]
@@ -326,7 +326,7 @@
Интерфейс будет создан и открыт в редакторе.
-[start=3]
+
. Добавьте метод `handleItem()`, принимающий параметр типа `Item`.
[source,java]
@@ -340,13 +340,13 @@
С помощью подсказки редактора добавьте оператор импорта для `exercise2.Item`.
-[start=4]
+
. Выполните реализацию `ItemErrorHandler` с фиктивным обработчиком `FileErrorReporter`, сохраняющим данные элемента в файл.
В окне "Проекты" щелкните правой кнопкой пакет `exercise3` и выберите команду "Создать" > "Класс Java". Присвойте классу имя *FileErrorReporter* и нажмите кнопку "Готово".
-[start=5]
+
. Сделайте `FileErrorReporter` реализацией `ItemErrorHandler` и переопределите метод `handleItem()` следующим образом.
[source,java]
@@ -366,7 +366,7 @@
Вам нужно открыть файл до начала обработки элементов, оставить его открытым в течение процесса добавления содержимого в данный файл, а затем закрыть его по завершении процесса. Можно вручную добавить методы `initProcess()` и `finishProcess()` к компоненту средства сообщения об ошибке, но в этом случае вы не сможете выполнить кодирование интерфейса, так как вызывающей стороне будет необходимо знать данные специфичные для класса методы. Можно добавить те же методы к интерфейсу `ItemErrorReporter`, но в этом случае потребуется выполнить ненужное внедрение данных методов в каждый класс, реализующий данный интерфейс. Вместо этого можно использовать несколько аннотаций жизненного цикла из спецификации управляемых компонентов (входящей в link:http://jcp.org/en/jsr/detail?id=316[+JSR 316: спецификация платформы Java, Enterprise Edition 6+]) для вызова методов в компоненте в конкретных точках жизненного цикла компонента. Метод с аннотацией `@PostConstruct` вызывается после создания компонента и учета всех его зависимостей. Метод с аннотацией `@PreDestroy` аналогичным образом вызывается непосредственно перед удалением компонента контейнером.
-[start=6]
+
. Добавьте следующие методы `init()` и `release()` с аннотациями `@PostConstruct` и `@PreDestroy`.
[source,java]
@@ -391,10 +391,10 @@
}
----
-[start=7]
+
. Исправьте операторы импорта. Либо щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' или нажмите Ctrl-Shift-I (⌘-Shift-I в Mac). В начало файла добавляются операторы импорта для `javax.annotation.PostConstruct` и `javax.annotation.PreDestroy`.
-[start=8]
+
. После этого добавьте новый компонент `ItemErrorHandler` к `ItemProcessor`.
[source,java]
@@ -427,7 +427,7 @@
С помощью подсказки редактора добавьте оператор импорта для `exercise3.ItemErrorHandler`.
-[start=9]
+
. Для запуска проекта нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ). (В качестве альтернативы нажмите F6; fn-F6 в Mac) В браузере нажмите кнопку '`Выполнить`' на отображаемой странице. Переключите обратно в IDE и проверьте журнал сервера GlassFish, который отображается в окне вывода (Ctrl-4; ⌘-4 в Mac).
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_zh_CN.asciidoc
index 9c82deb..18bfd9d 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/cdi-validate_zh_CN.asciidoc
@@ -40,7 +40,7 @@
* <<lifecycle,将生命周期标注应用于受管 Bean>>
* <<seealso,另请参见>>
-[start=4]
+
. link:cdi-events.html[+使用 CDI 中的事件+]
link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] 指定的上下文和依赖关系注入 (CDI) 是 Java EE 6 的一个组成部分,提供了一个体系结构,以允许 Java EE 组件(例如 Servlet、企业 Bean 和 JavaBeans)在具有明确定义范围的应用程序生命周期内存在。此外,CDI 服务允许 Java EE 组件(例如 EJB 会话 Bean 和 JavaServer Faces (JSF) 受管 Bean)注入并通过触发和观察事件以松散耦合的方式进行交互。
@@ -89,16 +89,16 @@
单击 "New File"(新建文件)(image:images/new-file-btn.png[]) 按钮,或者按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)以打开文件向导。
-[start=5]
+
. 选择 "Java" 类别,然后选择 "Java Interface"(Java 接口)。单击 "Next"(下一步)。
-[start=6]
+
. 键入 *ItemValidator* 作为类名,然后输入 *exercise3* 作为包。
-[start=7]
+
. 单击 "Finish"(完成)。将会生成新接口并在编辑器中将其打开。
-[start=8]
+
. 添加名为 `isValid()` 的方法,以提取 `Item` 对象并返回 `boolean` 值。
[source,java]
@@ -110,7 +110,7 @@
----
(使用编辑器的提示为 `exercise2.Item` 添加 import 语句。)
-[start=9]
+
. 扩展 `ItemProcessor` 类以包含新功能。在编辑器中打开 `ItemProcessor`,并进行以下更改。
[source,java]
@@ -138,13 +138,13 @@
使用编辑器的提示为 `exercise3.ItemValidator` 添加 import 语句。
-[start=10]
+
. 创建一个 `ItemValidator` 实现,名为 `DefaultItemValidator`,该实现根据值简单地对 limit 进行测试。
在 "Projects"(项目)窗口中,右键单击 `exercise3` 包,并选择 "New"(新建)> "Java Class"(Java 类)。将该类命名为 *DefaultItemValidator*,然后单击 "Finish"(完成)。
-[start=11]
+
. 让 `DefaultItemValidator` 实现 `ItemValidator` 并覆盖 `isValid()` 方法,如下所示。
[source,java]
@@ -162,10 +162,10 @@
(使用编辑器的提示为 `exercise2.Item` 添加 import 语句。)
-[start=12]
+
. 在 IDE 的主工具栏中单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮。编译该项目并将其部署到 GlassFish,然后在浏览器中打开应用程序的欢迎页 (`process.xhtml`)。
-[start=13]
+
. 单击页面上显示的 `Execute` 按钮。切换回 IDE 并检查 GlassFish Server 日志。服务器日志会显示在 "Output"(输出)窗口(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键)中 "GlassFish" 标签的下方。然后会看到验证项,并列出唯一一个值小于 limit 的有效项。
[source,java]
@@ -180,13 +180,13 @@
image::images/output-window.png[title="在 "Output"(输出)窗口中查看服务器日志"]
-[start=14]
+
. 现在,请考虑以下情况,假定您必须部署到另一个更松散的站点,且仅当项值大于 limit 的两倍时,才将该项视为无效。您可能需要使用另一个 Bean 为该逻辑实现 `ItemValidator` 接口。
创建一个新的 `ItemValidator` 实现,名为 `RelaxedItemValidator`。在 "Projects"(项目)窗口中,右键单击 `exercise3` 包,并选择 "New"(新建)> "Java Class"(Java 类)。将该类命名为 *RelaxedItemValidator*,然后单击 "Finish"(完成)。
-[start=15]
+
. 让 `RelaxedItemValidator` 实现 `ItemValidator` 并覆盖 `isValid()` 方法,如下所示。
[source,java]
@@ -204,10 +204,10 @@
(使用编辑器的提示为 `exercise2.Item` 添加 import 语句。)
-[start=16]
+
. 单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮以运行项目。请注意,项目现在无法部署。
-[start=17]
+
. 在 "Output"(输出)窗口(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键)中查看服务器日志。您会看到一则错误消息,报告 "ambiguous dependency"(依赖关系不明确)问题。出现此错误的原因是,您现在有两个实现同一接口的类。
[source,java]
@@ -224,7 +224,7 @@
如前面所述,唯一的区别在于部署。对于大多数部署,需要使用默认验证器,但对于一个部署,需要使用 "relaxed" 实现。CDI 提供 `@Alternative` 标注,通过该标注可以包含与一个注入点匹配的多个 Bean 而不会出现多义性错误,且要使用的 Bean 在 `beans.xml` 中定义。这允许您在同一模块中部署这两个实现,唯一的差别在于 `beans.xml` 的定义,该定义可以根据不同的部署进行更改。
-[start=18]
+
. 将 `@Alternative` 标注和相应的 import 语句添加至 `RelaxedItemValidator` 和 `DefaultItemValidator`。
在编辑器中打开 `RelaxedItemValidator` 并进行以下更改。
@@ -269,13 +269,13 @@
如果现在部署了应用程序,则会收到 "unsatisfied dependency"(不符合要求的依赖关系)错误,因为您定义了两个匹配的 Bean 作为替代项,但是没有在 `beans.xml` 文件中启用这两个文件中的任何一个。
-[start=19]
+
. 使用 IDE 的 "Go to File"(转至文件)对话框快速打开 `beans.xml` 文件。从 IDE 的主菜单(Alt-Shift-O;在 Mac 上为 Ctrl-Shift-O)选择 "Navigate"(导航)> "Go to File"(转至文件),然后键入 "`beans`"。单击 "OK"(确定)。
image::images/go-to-file.png[title="使用 "Go to File"(转至文件)对话框可快速找到项目文件"]
-[start=20]
+
. 对 `beans.xml` 文件进行如下更改。
[source,xml]
@@ -295,7 +295,7 @@
这会通知 CDI 使用 `RelaxedItemValidator` 进行此部署。可以认为 `@Alternative` 标注有效禁用了 Bean,使其不能用于注入,但是允许该实现与其他 Bean 一起打包。在 `beans.xml` 文件中将其添加为替代项可有效地重新启用该 Bean,使其可用于注入。通过将此类型的元数据移动至 `beans.xml` 文件,可以将不同版本的文件与不同部署一起打包。
-[start=21]
+
. 单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮以运行项目(或者,按 F6 键;在 Mac 上按 fn-F6 组合键)。在浏览器中,单击页面上显示的 "`Execute`" 按钮。切换回 IDE 并查看 "Output"(输出)窗口(Ctrl-4 组合键,在 Mac 上为 ⌘-4 组合键)中显示的 GlassFish Server 日志。
[source,java]
@@ -326,7 +326,7 @@
将会生成新接口并在编辑器中将其打开。
-[start=3]
+
. 添加名为 `handleItem()` 的方法,该方法将 `Item` 对象作为参数。
[source,java]
@@ -340,13 +340,13 @@
(使用编辑器的提示为 `exercise2.Item` 添加 import 语句。)
-[start=4]
+
. 首先,使用名为 `FileErrorReporter` 的伪处理程序(该程序将项详细信息保存至文件)实现 `ItemErrorHandler`。
在 "Projects"(项目)窗口中,右键单击 `exercise3` 包,并选择 "New"(新建)> "Java Class"(Java 类)。将该类命名为 *FileErrorReporter*,然后单击 "Finish"(完成)。
-[start=5]
+
. 让 `FileErrorReporter` 实现 `ItemErrorHandler` 并覆盖 `handleItem()` 方法,如下所示。
[source,java]
@@ -366,7 +366,7 @@
您需要在开始处理项之前打开文件,并在向文件添加内容的过程中使其保持打开状态,然后在完成处理时关闭文件。您可以手动将 `initProcess()` 和 `finishProcess()` 方法添加到错误报告程序 Bean,但之后无法向接口添加代码,因为调用程序需要知道这些类特定的方法。您可以将以上这些方法添加到 `ItemErrorReporter` 接口,但之后必须在实现该接口的每个类中实现这些方法,这就产生了不必要的操作。不过,您可以使用受管 Bean 规范(link:http://jcp.org/en/jsr/detail?id=316[+JSR 316:Java 平台 Enterprise Edition 6 规范+]中包含)中的一些生命周期标注,在 Bean 生命周期中的某些时点对 Bean 调用方法。当已经构造了 Bean 且 Bean 的任何依赖关系都已注入时,则调用 `@PostConstruct` 标注的方法。同样,容器会在处理 Bean 之前调用 `@PreDestroy` 标注的方法。
-[start=6]
+
. 添加以下带有相应 `@PostConstruct` 和 `@PreDestroy` 标注的 `init()` 和 `release()` 方法。
[source,java]
@@ -391,10 +391,10 @@
}
----
-[start=7]
+
. 修复导入。在编辑器中右键单击并选择 "Fix Imports"(修复导入),或者按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)。`javax.annotation.PostConstruct` 和 `javax.annotation.PreDestroy` 的 Import 语句将添加到文件顶部。
-[start=8]
+
. 最后,向 `ItemProcessor` 添加 `ItemErrorHandler` Bean。
[source,java]
@@ -427,7 +427,7 @@
(使用编辑器的提示为 `exercise3.ItemErrorHandler` 添加 import 语句。)
-[start=9]
+
. 单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮以运行项目(或者,按 F6 键;在 Mac 上按 fn-F6 组合键)。在浏览器中,单击页面上显示的 "`Execute`" 按钮。切换回 IDE 并查看 "Output"(输出)窗口(Ctrl-4 组合键,在 Mac 上为 ⌘-4 组合键)中显示的 GlassFish Server 日志。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion.asciidoc
index fc05f68..bdf0883 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Conclusion
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -118,10 +118,10 @@
The JSF framework manages the request-response cycle by automating events that typically need to occur for each client request. These events are qualified into six distinct phases that are together known as the _JSF request processing lifecycle_. The book, link:http://www.amazon.com/JavaServer-Faces-2-0-Complete-Reference/dp/0071625097/ref=pd_bxgy_b_img_a[+JavaServer Faces 2.0: The Complete Reference+] by Ed Burns and Chris Schalk, describes the lifecycle phases as follows:
-[quote]
-----
+[NOTE]
+====
_[T]he request processing lifecycle performs all of the necessary back-end processing for which one would otherwise have to write his or her own code. The lifecycle directs the processing of incoming request parameters, and it manages a server-side set of UI components and synchronizes them to what the user sees in a client browser. It also satisfies follow-up requests for images, style sheets, scripts, and other kinds of resources required to complete the rendering of the UI._^<<footnote1,[1]>>^
-----
+====
The six lifecycle phases, according to link:http://www.amazon.com/JavaServer-Faces-2-0-Complete-Reference/dp/0071625097/ref=pd_bxgy_b_img_a[+JavaServer Faces 2.0+], are defined as follows:
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion_ja.asciidoc
index 232ba6d..d0bedc0 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/conclusion_ja.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, NetBeans の 電子商取引(Eコマース)のチュートリアル -まとめ
-==== チュートリアルの内容
+== チュートリアルの内容
1. link:intro_ja.html[+はじめに+]
2. link:design_ja.html[+アプリケーションの設計+]
@@ -58,7 +58,7 @@
その他のチュートリアルは、link:../../../trails/java-ee_ja.html[+Java EE と Java Web の学習+]を参照してください。特に以下のチュートリアルには興味があるかもしれません。
-==== JavaServer Faces (JSF)
+== JavaServer Faces (JSF)
* link:../../web/jsf20-intro_ja.html[+JavaServer Faces 2.0 の概要+]
@@ -67,7 +67,7 @@
* link:../../web/jsf20-crud_ja.html[+データベースを使った JavaServer Faces 2.0 CRUD アプリケーションの作成+]
-==== コンテキストと依存性注入(CDI) Contexts and Dependency Injection
+== コンテキストと依存性注入(CDI) Contexts and Dependency Injection
* link:../cdi-intro_ja.html[+コンテキストと依存性注入とJSF 2.0入門 Getting Started with Contexts and Dependency Injection and JSF 2.0+]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db.asciidoc
index 0778961..df3866e 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db.asciidoc
@@ -30,31 +30,6 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Connecting the Application to the Database
-==== Tutorial Contents
-
-1. link:intro.html[+Introduction+]
-2. link:design.html[+Designing the Application+]
-3. link:setup-dev-environ.html[+Setting up the Development Environment+]
-4. link:data-model.html[+Designing the Data Model+]
-5. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
-6. *Connecting the Application to the Database*
-* <<sampleData,Adding Sample Data to the Database>>
-* <<createConnPoolDataSource,Creating a Connection Pool and Data Source>>
-* <<testConnPoolDataSource,Testing the Connection Pool and Data Source>>
-* <<param,Setting Context Parameters>>
-* <<jstl,Working with JSTL>>
-* <<troubleshoot,Troubleshooting>>
-* <<seeAlso,See Also>>
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
This tutorial unit focuses on communication between the database and the application. You begin by adding sample data to the database and explore some of the features provided by the IDE's SQL editor. You set up a data source and connection pool on the GlassFish server, and proceed by creating a JSP page that tests the data source by performing a simple query on the database.
This unit also addresses how the application retrieves and displays images necessary for web presentation, and how to set context parameters and retrieve their values from web pages. Once you are certain the data source is working correctly, you apply JSTL's `core` and `sql` tag libraries to retrieve and display category and product images for the link:design.html#index[+index+] and link:design.html#category[+category+] pages.
@@ -87,11 +62,13 @@
* You can follow this tutorial unit without having completed previous units. To do so, perform the following three steps:
1. *Set up your MySQL database server.* Follow the steps outlined in: link:setup-dev-environ.html#communicate[+Communicating with the Database Server+].
2. *Create the `affablebean` schema on the database server.*
-1. Click on link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean_schema_creation.sql[+affablebean_schema_creation.sql+] and copy (Ctrl-C; ⌘-C on Mac) the entire contents of the file.
-2. Open the IDE's SQL editor. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `affablebean` database connection ( image::images/db-connection-node.png[] ) node and choose Execute Command. The IDE's SQL editor opens.
-3. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
-4. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the `affablebean` database.
-3. Open the link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot2.zip[+project snapshot+] in the IDE. In the IDE, press Ctrl-Shift-O (⌘-Shift-O on Mac) and navigate to the location on your computer where you unzipped the downloaded file.
+.. Click on link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean_schema_creation.sql[+affablebean_schema_creation.sql+] and copy (Ctrl-C; ⌘-C on Mac) the entire contents of the file.
+.. Open the IDE's SQL editor. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `affablebean` database connection ( image::images/db-connection-node.png[] ) node and choose Execute Command. The IDE's SQL editor opens.
+.. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
+.. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the `affablebean` database.
+
+[start=3]
+. Open the link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot2.zip[+project snapshot+] in the IDE. In the IDE, press Ctrl-Shift-O (⌘-Shift-O on Mac) and navigate to the location on your computer where you unzipped the downloaded file.
@@ -110,7 +87,9 @@
1. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `category` table ( image::images/db-table-node.png[] ) node and choose View Data. The SQL editor opens and displays with a GUI representation of the `category` table in the lower region. Note that the table is empty, as no data has yet been added.
image::images/category-table-empty.png[title="Use the SQL editor to view table data in the IDE"]
Also, note that the native SQL query used to generate the GUI representation is displayed in the upper region of the editor: '`select * from category`'.
-2. Delete '`select * from category`' and enter the following SQL statement:
+
+[start=2]
+. Delete '`select * from category`' and enter the following SQL statement:
[source,java]
----
@@ -118,8 +97,12 @@
INSERT INTO `category` (`name`) VALUES ('dairy'),('meats'),('bakery'),('fruit & veg');
----
This statement inserts four new records, each with a unique entry for the '`name`' column. Because the `id` column was specified as `AUTO_INCREMENT` when you created the schema, you do not need to worry about supplying a value.
-3. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The SQL statement is executed.
-4. To confirm that the data has been added, run the '`select * from category`' query again. To do so, you can use the SQL History window. Click the SQL History ( image::images/sql-history-btn.png[] ) button in the editor's toolbar and double-click the '`select * from category`' entry. The SQL History window lists all SQL statements that you recently executed in the IDE.
+
+[start=3]
+. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The SQL statement is executed.
+
+[start=4]
+. To confirm that the data has been added, run the '`select * from category`' query again. To do so, you can use the SQL History window. Click the SQL History ( image::images/sql-history-btn.png[] ) button in the editor's toolbar and double-click the '`select * from category`' entry. The SQL History window lists all SQL statements that you recently executed in the IDE.
Watch the screencast below to see how you can follow the above steps. When typing in the editor, be sure to take advantage of the IDE's code completion and suggestion facilities.
@@ -173,11 +156,15 @@
----
After running the statement, you'll see that the record contains an automatically incremented primary key, and the `last_update` column lists the current date and time.
* The value for the final column, '`category_id`', must correspond to a value contained in the `category` table's `id` column. Because you have already added four records to the `category` table, the `product` records you are inserting reference one of these four records. If you try to insert a `product` record that references a `category_id` that doesn't exist, a foreign key constraint fails.
-3. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar.
+
+[start=3]
+. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar.
*Note:* View the Output window (Ctrl-4; ⌘-4 on Mac) to see a log file containing results of the execution.
-4. Right-click the `product` table ( image::images/db-table-node.png[] ) node and choose View Data. You can see 16 new records listed in the table.
+
+[start=4]
+. Right-click the `product` table ( image::images/db-table-node.png[] ) node and choose View Data. You can see 16 new records listed in the table.
image::images/product-table.png[title="Choose View Data from a table node's right-click menu to verify sample data"]
@@ -221,16 +208,26 @@
* *Object Type:* `user`
* *Enabled:* `true`
image::images/jdbc-resource-gen-attributes.png[title="Create a new connection pool and data source using the JDBC Resource wizard"]
-5. Click Next. In Step 3, Additional Properties, you do not need to specify any additional configuration information for the data source.
-6. Click Next. In Step 4, Choose Database Connection, type in `AffableBeanPool` as the JDBC connection pool name. Also, ensure that the `Extract from Existing Connection` option is selected, and that the `jdbc:mysql://localhost:3306/affablebean` connection is listed.
-7. Click Next. In Step 5, Add Connection Pool Properties, specify the following details:
+
+[start=5]
+. Click Next. In Step 3, Additional Properties, you do not need to specify any additional configuration information for the data source.
+
+[start=6]
+. Click Next. In Step 4, Choose Database Connection, type in `AffableBeanPool` as the JDBC connection pool name. Also, ensure that the `Extract from Existing Connection` option is selected, and that the `jdbc:mysql://localhost:3306/affablebean` connection is listed.
+
+[start=7]
+. Click Next. In Step 5, Add Connection Pool Properties, specify the following details:
* *Datasource Classname:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
* *Resource Type:* `javax.sql.ConnectionPoolDataSource`
* *Description:* _(Optional)_ `Connects to the affablebean database`
Also, note that the wizard extracts and displays properties from the existing connection.
image::images/jdbc-resource-conn-pool.png[title="Create a new connection pool and data source using the JDBC Resource wizard"]
-8. Click Finish. The wizard generates a `sun-resources.xml` file for the project that contains all information required to set up the connection pool and data source on GlassFish. The `sun-resources.xml` file is a deployment descriptor specific to the GlassFish application server. When the project next gets deployed, the server will read in any configuration data contained in `sun-resources.xml`, and set up the connection pool and data source accordingly. Note that once the connection pool and data source exist on the server, your project no longer requires the `sun-resources.xml` file.
-9. In the Projects window (Ctrl-1; ⌘-1 on Mac), expand the Server Resources node and double-click the `sun-resources.xml` file to open it in the editor. Here you see the XML configuration required to set up the connection pool and data source. (Code below is formatted for readability.)
+
+[start=8]
+. Click Finish. The wizard generates a `sun-resources.xml` file for the project that contains all information required to set up the connection pool and data source on GlassFish. The `sun-resources.xml` file is a deployment descriptor specific to the GlassFish application server. When the project next gets deployed, the server will read in any configuration data contained in `sun-resources.xml`, and set up the connection pool and data source accordingly. Note that once the connection pool and data source exist on the server, your project no longer requires the `sun-resources.xml` file.
+
+[start=9]
+. In the Projects window (Ctrl-1; ⌘-1 on Mac), expand the Server Resources node and double-click the `sun-resources.xml` file to open it in the editor. Here you see the XML configuration required to set up the connection pool and data source. (Code below is formatted for readability.)
[source,xml]
----
@@ -276,8 +273,12 @@
</jdbc-connection-pool>
</resources>
----
-10. In the Projects window (Ctrl-1; ⌘-1 on Mac), right-click the `AffableBean` project node and choose Deploy. The GlassFish server reads configuration data from the `sun-resources.xml` file and creates the `AffableBeanPool` connection pool, and `jdbc/affablebean` data source.
-11. In the Services window, expand the Servers > GlassFish > Resources > JDBC node. Here you can locate the `jdbc/affablebean` data source listed under JDBC Resources, and the `AffableBeanPool` connection pool listed under Connection Pools.
+
+[start=10]
+. In the Projects window (Ctrl-1; ⌘-1 on Mac), right-click the `AffableBean` project node and choose Deploy. The GlassFish server reads configuration data from the `sun-resources.xml` file and creates the `AffableBeanPool` connection pool, and `jdbc/affablebean` data source.
+
+[start=11]
+. In the Services window, expand the Servers > GlassFish > Resources > JDBC node. Here you can locate the `jdbc/affablebean` data source listed under JDBC Resources, and the `AffableBeanPool` connection pool listed under Connection Pools.
image::images/gf-server-jdbc-resources.png[title="View data sources and connection pools registered on the server"]
Right-click data source and connection pool nodes to view and make changes to their properties. You can associate a data source with any connection pool registered on the server. You can edit property values for connection pools, and unregister both data sources and connection pools from the server.
@@ -304,10 +305,18 @@
1. Ensure that the GlassFish server is already running. In the Services window (Ctrl-5; ⌘-5 on Mac), expand the Servers node. Note the small green arrow next to the GlassFish icon ( image::images/gf-server-running-node.png[] ).
(If the server is not running, right-click the server node and choose Start.)
-2. Right-click the server node and choose View Admin Console. The GlassFish Administration Console opens in a browser.
-3. Log into the administration console. The default username / password is: `admin` / `adminadmin`.
-4. In the console's tree on the left, expand the Resources > JDBC > Connection Pools nodes, then click `AffableBeanPool`. In the main window, the Edit Connection Pool interface displays for the selected connection pool.
-5. Click the Ping button. If the ping succeeds, the GlassFish server has a working connection to the `affablebean` database on the MySQL server.
+
+[start=2]
+. Right-click the server node and choose View Admin Console. The GlassFish Administration Console opens in a browser.
+
+[start=3]
+. Log into the administration console. The default username / password is: `admin` / `adminadmin`.
+
+[start=4]
+. In the console's tree on the left, expand the Resources > JDBC > Connection Pools nodes, then click `AffableBeanPool`. In the main window, the Edit Connection Pool interface displays for the selected connection pool.
+
+[start=5]
+. Click the Ping button. If the ping succeeds, the GlassFish server has a working connection to the `affablebean` database on the MySQL server.
image::images/ping-succeeded.png[title="Ping the connection pool to determine whether it has a physical connection to the database"]
(If the ping fails, see suggestions in the <<troubleshoot,Troubleshooting>> section below.)
@@ -324,7 +333,9 @@
* *Sharing Scope:* `Shareable`
* *Description:* _(Optional)_ `Connects to database for AffableBean application`
image::images/add-resource-ref-dialog.png[title="Specify resource properties in the Add Resource Reference dialog"]
-4. Click OK. The new resource is added under the Resource References heading.
+
+[start=4]
+. Click OK. The new resource is added under the Resource References heading.
image::images/resource-reference.png[title="Create a reference to the data source for the application"]
To verify that the resource is now added to the `web.xml` file, click the XML tab located along the top of the editor. Notice that the following `<resource-ref>` tags are now included:
@@ -351,17 +362,25 @@
The project does not yet have a folder named '`test`' within the Web Pages location (i.e., within the `web` folder). By entering '`test`' into the Folder field, you have the IDE create the folder upon completing the wizard.
-4. Click finish. The IDE generates a new `testDataSource.jsp` file, and places it into the new `test` folder within the project.
-5. In the new `testDataSource.jsp` file, in the editor, place your cursor at the end of the line containing the `<h1>` tags (line 17). Press Return, then press Ctrl-Space to invoke code suggestions. Choose DB Report from the list of options.
+
+[start=4]
+. Click finish. The IDE generates a new `testDataSource.jsp` file, and places it into the new `test` folder within the project.
+
+[start=5]
+. In the new `testDataSource.jsp` file, in the editor, place your cursor at the end of the line containing the `<h1>` tags (line 17). Press Return, then press Ctrl-Space to invoke code suggestions. Choose DB Report from the list of options.
image::images/db-report.png[title="Press Ctrl-Space in editor to invoke code suggestions"]
If line numbers do not display, right-click in the left margin of the editor and choose Show Line Numbers.
-6. In the Insert DB Report dialog, specify the data source and modify the SQL query to be executed:
+
+[start=6]
+. In the Insert DB Report dialog, specify the data source and modify the SQL query to be executed:
* *Data Source:* `jdbc/affablebean`
* *Query Statement:* `SELECT * FROM category, product WHERE category.id = product.category_id`
image::images/insert-db-report.png[title="Specify the data source and SQL query to be executed"]
-7. Click OK. The dialog adds the `taglib` directives for the JSTL `core` and `sql` libraries to the top of the file:
+
+[start=7]
+. Click OK. The dialog adds the `taglib` directives for the JSTL `core` and `sql` libraries to the top of the file:
[source,java]
----
@@ -396,13 +415,21 @@
</c:forEach>
</table>
----
-8. Before running the file in a browser, make sure you have enabled the JDBC driver deployment option in NetBeans' GlassFish support. Choose Tools > Servers to open the Servers window. In the left column, select the GlassFish server you are deploying to. In the main column, ensure that the 'Enable JDBC Driver Deployment' option is selected, then click Close.
+
+[start=8]
+. Before running the file in a browser, make sure you have enabled the JDBC driver deployment option in NetBeans' GlassFish support. Choose Tools > Servers to open the Servers window. In the left column, select the GlassFish server you are deploying to. In the main column, ensure that the 'Enable JDBC Driver Deployment' option is selected, then click Close.
image::images/servers-window.png[title="Ensure that the Enable JDBC Driver Deployment option is selected"]
For Java applications that connect to a database, the server requires a JDBC driver to be able to create a communication bridge between the SQL and Java languages. In the case of MySQL, you use the link:http://www.mysql.com/downloads/connector/j/[+Connector/J+] JDBC driver. Ordinarily you would need to manually place the driver JAR file into the server's `lib` directory. With the 'Enable JDBC Driver Deployment' option selected, the server performs a check to see whether a driver is needed, and if so, the IDE deploys the driver to the server.
-9. Right-click in the editor and choose Run File (Shift-F6; fn-Shift-F6 on Mac). The `testDataSource.jsp` file is compiled into a servlet, deployed to the server, then runs in a browser.
-10. Open the Output window (Ctrl-4; ⌘-4 on Mac) and click the 'AffableBean (run)' tab. The output indicates that the driver JAR file (`mysql-connector-java-5.1.6-bin.jar`) is deployed.
+
+[start=9]
+. Right-click in the editor and choose Run File (Shift-F6; fn-Shift-F6 on Mac). The `testDataSource.jsp` file is compiled into a servlet, deployed to the server, then runs in a browser.
+
+[start=10]
+. Open the Output window (Ctrl-4; ⌘-4 on Mac) and click the 'AffableBean (run)' tab. The output indicates that the driver JAR file (`mysql-connector-java-5.1.6-bin.jar`) is deployed.
image::images/output-window-mysql-driver.png[title="When JDBC Driver Deployment is enabled, the IDE deploys the MySQL driver to GlassFish when required"]
-11. Examine `testDataSource.jsp` in the browser. You see an HTML table listing data contained in the `category` and `product` tables.
+
+[start=11]
+. Examine `testDataSource.jsp` in the browser. You see an HTML table listing data contained in the `category` and `product` tables.
image::images/test-data-source.png[title="The JSP page contains data extracted from the 'affablebean' database"]
(If you receive a server error, see suggestions in the <<troubleshoot,Troubleshooting>> section below.)
@@ -430,21 +457,35 @@
2. Import the `img` folder into the `AffableBean` project. Copy (Ctrl-C; ⌘-C on Mac) the `img` folder, then in the IDE's Projects window, paste (Ctrl-V; ⌘-V on Mac) the folder into the project's Web Pages node.
image::images/projects-win-img-folder.png[title="Import the 'img' folder into the AffableBean project"]
The `categories` and `products` folders contain the images that will be displayed in the link:design.html#index[+index+] and link:design.html#category[+category+] pages, respectively.
-3. Open the project's web deployment descriptor. In the Projects window, expand the Configuration Files node and double-click `web.xml`.
-4. Click the General tab, then expand Context Parameters and click the Add button.
-5. In the Add Context Parameter dialog, enter the following details:
+
+[start=3]
+. Open the project's web deployment descriptor. In the Projects window, expand the Configuration Files node and double-click `web.xml`.
+
+[start=4]
+. Click the General tab, then expand Context Parameters and click the Add button.
+
+[start=5]
+. In the Add Context Parameter dialog, enter the following details:
* *Parameter Name:* `productImagePath`
* *Parameter Value:* `img/products/`
* *Description:* _(Optional)_ `The relative path to product images`
image::images/add-context-param-dialog.png[title="Add initialization parameters using the Add Context Parameter dialog"]
-6. Click OK.
-7. Click the Add button again and enter the following details:
+
+[start=6]
+. Click OK.
+
+[start=7]
+. Click the Add button again and enter the following details:
* *Parameter Name:* `categoryImagePath`
* *Parameter Value:* `img/categories/`
* *Description:* _(Optional)_ `The relative path to category images`
-8. Click OK. The two context parameters are now listed:
+
+[start=8]
+. Click OK. The two context parameters are now listed:
image::images/context-parameters.png[title="Context parameters display in the web.xml interface"]
-9. Click the XML tab to view the XML content that has been added to the deployment descriptor. The following `<context-param>` entries have been added:
+
+[start=9]
+. Click the XML tab to view the XML content that has been added to the deployment descriptor. The following `<context-param>` entries have been added:
[source,xml]
----
@@ -460,7 +501,9 @@
<param-value>img/categories/</param-value>
</context-param>
----
-10. To test whether the values for the context parameters are accessible to web pages, open any of the project's web pages in the editor and enter EL expressions using the `initParam` implicit object. For example, open `index.jsp` and enter the following (New code in *bold*):
+
+[start=10]
+. To test whether the values for the context parameters are accessible to web pages, open any of the project's web pages in the editor and enter EL expressions using the `initParam` implicit object. For example, open `index.jsp` and enter the following (New code in *bold*):
[source,html]
----
@@ -475,7 +518,9 @@
</div>
</div>
----
-11. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the values for the `categoryImagePath` and `productImagePath` context parameters displayed in the page.
+
+[start=11]
+. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the values for the `categoryImagePath` and `productImagePath` context parameters displayed in the page.
image::images/context-params-browser.png[title="Use 'initParam' with JSP EL delimiters to display context parameter values"]
@@ -521,13 +566,17 @@
1. In the Projects window, double-click the `index.jsp` node to open it in the editor. (If already opened, press Ctrl-Tab to select it in the editor.)
2. At the top of the file, before the first `<div>` tag, place your cursor on a blank line, then type '`db`' and press Ctrl-Space. In the code-completion pop-up window that displays, choose DB Query.
image::images/db-query.png[title="Type 'db', then press Ctrl-Space to invoke code completion suggestions"]
-3. In the Insert DB Query dialog, enter the following details:
+
+[start=3]
+. In the Insert DB Query dialog, enter the following details:
* *Variable Name:* `categories`
* *Scope:* `page`
* *Data Source:* `jdbc/affablebean`
* *Query Statement:* `SELECT * FROM category`
image::images/insert-db-query.png[title="Specify query details to create an SQL query using JSTL <sql:query> tags"]
-4. Click OK. The dialog generates an SQL query using JSTL `<sql:query>` tags. Also, note that the required reference to the `sql` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
+
+[start=4]
+. Click OK. The dialog generates an SQL query using JSTL `<sql:query>` tags. Also, note that the required reference to the `sql` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
[source,html]
----
@@ -549,13 +598,19 @@
----
The SQL query creates a result set which is stored in the `categories` variable. You can then access the result set using EL syntax, e.g., `${categories}` (demonstrated below).
-5. Place your cursor at the end of '`<div id="indexRightColumn">`' (line 22), hit return, type '`jstl`' then press Ctrl-Space and choose JSTL For Each.
+
+[start=5]
+. Place your cursor at the end of '`<div id="indexRightColumn">`' (line 22), hit return, type '`jstl`' then press Ctrl-Space and choose JSTL For Each.
image::images/jstl-for-each.png[title="Type 'jstl', then press Ctrl-Space to invoke code completion suggestions"]
-6. In the Insert JSTL For Each dialog, enter the following details:
+
+[start=6]
+. In the Insert JSTL For Each dialog, enter the following details:
* *Collection:* `${categories.rows}`
* *Current Item of the Iteration:* `category`
image::images/insert-jstl-for-each.png[title="Specify details to create a 'for each' loop using JSTL <c:forEach> tags"]
-7. Click OK. The dialog sets up syntax for a JSTL `forEach` loop using `<c:forEach>` tags. Also, note that the required reference to the `core` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
+
+[start=7]
+. Click OK. The dialog sets up syntax for a JSTL `forEach` loop using `<c:forEach>` tags. Also, note that the required reference to the `core` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
[source,html]
----
@@ -573,7 +628,9 @@
If you are wondering what '`rows`' refers to in the generated code, recall that the `categories` variable represents a result set. More specifically, `categories` refers to an object that implements the `link:http://java.sun.com/products/jsp/jstl/1.1/docs/api/javax/servlet/jsp/jstl/sql/Result.html[+javax.servlet.jsp.jstl.sql.Result+]` interface. This object provides properties for accessing the rows, column names, and size of the query’s result set. When using dot notation as in the above example, '`categories.rows`' is translated in Java to '`categories.getRows()`'.
-8. Integrate the `<c:forEach>` tags into the page. You can nest the `<div class="categoryBox">` tags within the `forEach` loop so that HTML markup is generated for each of the four categories. Use EL syntax to extract the `category` table's `id` and `name` column values for each of the four records. Make sure to delete the other `<div class="categoryBox">` tags which exist outside the `forEach` loop. When you finish, the complete `index.jsp` file will look as follows. (`<c:forEach>` tags and contents are displayed in *bold*.)
+
+[start=8]
+. Integrate the `<c:forEach>` tags into the page. You can nest the `<div class="categoryBox">` tags within the `forEach` loop so that HTML markup is generated for each of the four categories. Use EL syntax to extract the `category` table's `id` and `name` column values for each of the four records. Make sure to delete the other `<div class="categoryBox">` tags which exist outside the `forEach` loop. When you finish, the complete `index.jsp` file will look as follows. (`<c:forEach>` tags and contents are displayed in *bold*.)
[source,html]
----
@@ -614,9 +671,13 @@
</c:forEach>
</div>*
----
-9. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the names and images of the four categories.
+
+[start=9]
+. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the names and images of the four categories.
image::images/index-category-images.png[title="'for each' loop extracts details from the database and utilizes them in the page"]
-10. Click any of the four images in the browser. The category page displays.
+
+[start=10]
+. Click any of the four images in the browser. The category page displays.
image::images/category-page.png[title="Category images from index page link to category page"]
To understand how linking takes place between the index and category pages, reexamine the HTML anchor tags within the `forEach` loop:
@@ -683,7 +744,9 @@
</sql:query>
----
Either use the Insert DB Query dialog as <<categoryIndex,described above>>, or use the editor's code suggestion and completion facilities by pressing Ctrl-Space while typing.
-3. Between the `<div id="categoryLeftColumn">` tags, replace the existing static placeholder content with the following `<c:forEach>` loop.
+
+[start=3]
+. Between the `<div id="categoryLeftColumn">` tags, replace the existing static placeholder content with the following `<c:forEach>` loop.
[source,html]
----
@@ -714,7 +777,9 @@
</div>
----
In the above snippet, you access the request's query string using '`pageContext.request.queryString`'. `pageContext` is another link:http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/bnahq.html#bnaij[+implicit object+] defined by the JSP Expression Language. The EL expression uses the `link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/jsp/PageContext.html[+PageContext+]` to access the current request (an `link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html[+HttpServletRequest+]` object). From `HttpServletRequest`, the `getQueryString()` method is called to obtain the value of the request's query string.
-4. Make sure to add the JSTL `core` and `sql` `taglib` directives to the top of the page. (This is done automatically when using the editor's code suggestion and completion facilities.)
+
+[start=4]
+. Make sure to add the JSTL `core` and `sql` `taglib` directives to the top of the page. (This is done automatically when using the editor's code suggestion and completion facilities.)
[source,java]
----
@@ -722,7 +787,9 @@
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-5. Run the project. In the browser, navigate to the category page and click the category buttons in the left column. Each time you click, the page refreshes highlighting the selected category.
+
+[start=5]
+. Run the project. In the browser, navigate to the category page and click the category buttons in the left column. Each time you click, the page refreshes highlighting the selected category.
image::images/category-page-bakery.png[title="Select categories by clicking category buttons in the left column"]
Also, note that the ID of the selected category is displayed in the page's URL. (In the above image, the bakery category is selected, and '`3`' is appended to the URL in the browser's navigation toolbar.)
@@ -743,11 +810,21 @@
<c:when test="${category.id == pageContext.request.queryString}">
----
(To set a breakpoint, click in the left margin of the line. A breakpoint ( image::images/breakpoint-icon.png[] ) icon displays.)
-2. In the IDE's main toolbar, click the Debug Project ( image::images/debug-project-btn.png[] ) button. A debugging session is activated for the project, and the application's index page opens in the browser.
-3. Click the bakery category in the index page. (You know that the ID for the bakery category is '`3`').
-4. Return to the IDE, and note that the debugger is suspended on the line containing the breakpoint. When suspended, the margin shows a green arrow on the breakpoint ( image::images/debugger-suspended-icon.png[] ), and the line displays with green background.
-5. Open the Variables window (Ctrl-Shift-1) and expand the Implicit Objects > pageContext > request > queryString node. Inspect the variable value and note that the value is '`3`', corresponding to the category ID from your selection.
-6. Press the Finish Debugger Session ( image::images/finish-debugger-session-btn.png[] ) button to terminate the debugger session.
+
+[start=2]
+. In the IDE's main toolbar, click the Debug Project ( image::images/debug-project-btn.png[] ) button. A debugging session is activated for the project, and the application's index page opens in the browser.
+
+[start=3]
+. Click the bakery category in the index page. (You know that the ID for the bakery category is '`3`').
+
+[start=4]
+. Return to the IDE, and note that the debugger is suspended on the line containing the breakpoint. When suspended, the margin shows a green arrow on the breakpoint ( image::images/debugger-suspended-icon.png[] ), and the line displays with green background.
+
+[start=5]
+. Open the Variables window (Ctrl-Shift-1) and expand the Implicit Objects > pageContext > request > queryString node. Inspect the variable value and note that the value is '`3`', corresponding to the category ID from your selection.
+
+[start=6]
+. Press the Finish Debugger Session ( image::images/finish-debugger-session-btn.png[] ) button to terminate the debugger session.
@@ -767,7 +844,9 @@
<sql:param value="${pageContext.request.queryString}"/>
</sql:query>*
----
-2. Use JSP EL syntax to extract the category name from the query and display it in the page. Make the following change to the `<p id="categoryTitle">` element. (Displayed in *bold*.)
+
+[start=2]
+. Use JSP EL syntax to extract the category name from the query and display it in the page. Make the following change to the `<p id="categoryTitle">` element. (Displayed in *bold*.)
[source,xml]
----
@@ -775,8 +854,12 @@
<p id="categoryTitle">*${selectedCategory.rows[0].name}*</p>
----
Since the result from the `selectedCategory` query contains only one item (i.e., user can select only one category), you can retrieve the first row of the result set using '`selectedCategory*.rows[0]*`'. If a user selects the 'meats' category for example, the returned expression would be '`{name=meats}`'. You could then access the category name with '`${selectedCategory.rows[0]*.name*}`'.
-3. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
-4. Return to the browser and refresh the category page. The name of the selected category now displays above the product table.
+
+[start=3]
+. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
+
+[start=4]
+. Return to the browser and refresh the category page. The name of the selected category now displays above the product table.
image::images/category-page-bakery-title.png[title="The name of the selected category dynamically displays above the product table"]
*Note:* As demonstrated in this and the previous step, you do not need to explicitly recompile, deploy, and run the project with each change to your code base. The IDE provides a Deploy on on Save feature, which is enabled for Java web projects by default. To verify that the feature is activated, right-click your project node in the Projects window and choose Properties. In the Project Properties window, click the Run category and examine the 'Deploy on Save' option.
@@ -803,7 +886,9 @@
<sql:param value="${pageContext.request.queryString}"/>
</sql:query>*
----
-2. Between the `<table id="productTable">` tags, replace the existing static table row placeholders (`<tr>` tags) with the following `<c:forEach>` loop. (Changes are displayed in *bold*.)
+
+[start=2]
+. Between the `<table id="productTable">` tags, replace the existing static table row placeholders (`<tr>` tags) with the following `<c:forEach>` loop. (Changes are displayed in *bold*.)
[source,xml]
----
@@ -851,8 +936,12 @@
For a description of JSP Expression Language operators, see the Java EE 5 Tutorial: link:http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/bnahq.html#bnaik[+JavaServer Pages Technology > Unified Expression Language > Operators+].
-3. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
-4. Return to the browser and refresh the category page. Product details now display within the table for the selected category.
+
+[start=3]
+. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
+
+[start=4]
+. Return to the browser and refresh the category page. Product details now display within the table for the selected category.
image::images/category-page-bakery-product-table.png[title="Product details are dynamically displayed for the selected category"]
You have now completed this tutorial unit. In it, you explored how to connect your application to the database by setting up a connection pool and data source on the server, then referenced the data source from the application. You also created several context parameters, and learned how to access them from JSP pages. Finally, you implemented JSTL tags into the application's web pages in order to dynamically retrieve and display database data.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db_ja.asciidoc
index 727037f..c7a8f49 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/connect-db_ja.asciidoc
@@ -30,31 +30,6 @@
:keywords: Apache NetBeans, Tutorials, NetBeans Eコマース チュートリアル-データベースへのアプリケーションの接続
-==== チュートリアルの内容
-
-1. link:intro_ja.html[+はじめに+]
-2. link:design_ja.html[+アプリケーションの設計+]
-3. link:setup-dev-environ_ja.html[+開発環境の設定+]
-4. link:data-model_ja.html[+データモデルの設計+]
-5. link:page-views-controller_ja.html[+ページビューとコントローラサーブレットの準備 +]
-6. *データベースへのアプリケーションの接続*
-* <<sampleData,データベースへサンプルデータを追加する>>
-* <<createConnPoolDataSource,コネクションプールとデータソースを作成する>>
-* <<testConnPoolDataSource,コネクションプールとデータソースをテストする>>
-* <<param,コンテキストパラメータを設定する>>
-* <<jstl,JSTL で作業する>>
-* <<troubleshoot,トラブルシューティング>>
-* <<seeAlso,関連項目>>
-7. link:entity-session_ja.html[+エンティティクラスとセッション Beans の追加+]
-8. link:manage-sessions_ja.html[+セッションの管理+]
-9. link:transaction_ja.html[+トランザクションビジネスロジックの統合+]
-10. link:language_ja.html[+言語サポートの追加+]
-11. link:security.html[+アプリケーションの保護+]
-12. link:test-profile.html[+アプリケーションの負荷��スト+]
-13. link:conclusion_ja.html[+まとめ+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
この単元は、データベースとアプリケーション間の通信について説明しています。あなたはデータベースにサンプルデータを追加し、IDE の SQL エディタによって提供されるいくつかの機能を調べることから始めます。あなたは GlassFish サーバーにデータソースとコネクションプールを設定し、簡単な JSP ページを作成してデータベースに単純なクエリを発行してデータソースをテストします。
この単元はまた、アプリケーションが Web 表示用の画像を取得して表示する方法と、コンテキストパラメータを設定して Web ページからその値を取得する方法に取り組みます。データソースが正しく動作していると確信している場合は、JSTL `core` と `sql` タグライブラリを適用して、link:design.html#index[+index+] ページとlink:design.html#category[+category+] ページでカテゴリと製品画像を取得して表示します。
@@ -91,16 +66,26 @@
1. *MySQL データベースサーバをセットアップします。*link:setup-dev-environ.html#communicate[+データベースサーバーと接続する+]に書いてある手順に従います。下記にアウトラインを示します。
-2. *データベースサーバーに affablebean スキーマを作成します。 *
+
+[start=2]
+. *データベースサーバーに affablebean スキーマを作成します。 *
1. link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean_schema_creation.sql[+affablebean_schema_creation.sql+] をクリックして、そのファイル全部をコピーします。( Ctrl-C、⌘-C Macで)。
-2. IDE の SQL エディタを開きます。サービスウィンドウ(Ctrl-5、⌘-5 Macの場合)で、`affablebean` データベース接続( image::images/db-connection-node.png[] )ノードを右クリックし「 Execute Command コマンドの実行」を選択します。 IDE の SQL エディタが開きます。
-3. エディターの中で affablebean.sql ファイルの内容を全部貼付け( Ctrl+V。⌘-V Macの場合)します。
+[start=2]
+. IDE の SQL エディタを開きます。サービスウィンドウ(Ctrl-5、⌘-5 Macの場合)で、`affablebean` データベース接続( image::images/db-connection-node.png[] )ノードを右クリックし「 Execute Command コマンドの実行」を選択します。 IDE の SQL エディタが開きます。
-4. エディタのツールバーの「 Run SQL (Sqlを実行)」( image::images/run-sql-btn.png[] ) ボタンを押します。スクリプトが MySQL サーバ上で実行されます。affablebean データベース テーブルが生成されます。
-3. IDE で link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot2.zip[+プロジェクトのスナップショット+]を開きます。IDE で、Ctrl-Shift-O、(⌘-Shift-O on Mac) を押して、ダウンロードしたファイルを解凍した場所をコンピュータに指示します。
+[start=3]
+. エディターの中で affablebean.sql ファイルの内容を全部貼付け( Ctrl+V。⌘-V Macの場合)します。
+
+
+[start=4]
+. エディタのツールバーの「 Run SQL (Sqlを実行)」( image::images/run-sql-btn.png[] ) ボタンを押します。スクリプトが MySQL サーバ上で実行されます。affablebean データベース テーブルが生成されます。
+
+
+[start=3]
+. IDE で link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot2.zip[+プロジェクトのスナップショット+]を開きます。IDE で、Ctrl-Shift-O、(⌘-Shift-O on Mac) を押して、ダウンロードしたファイルを解凍した場所をコンピュータに指示します。
@@ -123,7 +108,9 @@
また、GUI 表現で生成され使用されるネイティブ SQL クエリはエディタの上部領域に表示されることに気づいて下さい: [ `select * from category` ](カテゴリから*(すべて)選択)。
-2. 「'`select * from category`'」を削除し、次の SQL 文を入力してください:
+
+[start=2]
+. 「'`select * from category`'」を削除し、次の SQL 文を入力してください:
[source,java]
@@ -133,9 +120,13 @@
----
この文は、4つの新しいレコードを挿入します。それぞれは [ `name` ] 列に一意のエントリを持っています。スキーマを作成するとき、`id` 列は、AUTO_INCREMENT に設定されているので、あなたが値を設定することを心配する必要はありません。
-3. エディタのツールバーの「 Run SQL (sqlの実行)」( image::images/run-sql-btn.png[] ) ボタンを押します。SQL ステートメントが実行されます。
-4. データが追加されていることを確認するには、再度「`select * from category`」クエリを実行します。これを行うには、[ SQL History (SQL履歴)]ウィンドウが使用できます。エディタのツールバーの[ SQL History]( image::images/sql-history-btn.png[] ) ボタンをクリックして、「`select * from category`」エントリーをダブルクリックします。[ SQL History ]ウィンドウには、最近のIDEで実行されたすべてのSQLステートメントが表示されています。
+[start=3]
+. エディタのツールバーの「 Run SQL (sqlの実行)」( image::images/run-sql-btn.png[] ) ボタンを押します。SQL ステートメントが実行されます。
+
+
+[start=4]
+. データが追加されていることを確認するには、再度「`select * from category`」クエリを実行します。これを行うには、[ SQL History (SQL履歴)]ウィンドウが使用できます。エディタのツールバーの[ SQL History]( image::images/sql-history-btn.png[] ) ボタンをクリックして、「`select * from category`」エントリーをダブルクリックします。[ SQL History ]ウィンドウには、最近のIDEで実行されたすべてのSQLステートメントが表示されています。
上記の手順を実行する方法を確認するために、下記のスクリーンキャストを見てください。IDE のコード補完や提案機能のうまい使い方も確認してください。
@@ -147,7 +138,9 @@
1. `product` テーブル ( image::images/db-table-node.png[] )ノードで右クリックし、「Execute Command」(コマンド実行)」を選択します。「サービス」ウィンドウで「Execute Command」メニューのオプションを選択し IDE の SQL エディタを開きます。
-2. エディタで、次の `INSERT` 文をコピーして貼り付けします。
+
+[start=2]
+. エディタで、次の `INSERT` 文をコピーして貼り付けします。
[source,java]
@@ -195,11 +188,15 @@
* 最後の列、「 `category_id` 」は、`category` テーブルの `id` 列の中の値と一致する必要があります 。あなたは既に `category` テーブルに4つのレコードを追加しているので、あなたが挿入しようとしている `product` レコードは、これらの4つのレコードの一つを参照します。あなたが `product` レコードを挿入しようとするとまだ存在しない `category_id` を参照するので、外部キー制約により失敗します。
-3. Run SQL ( image::images/run-sql-btn.png[] )ボタンをエディタのツールバーで押します。
+
+[start=3]
+. Run SQL ( image::images/run-sql-btn.png[] )ボタンをエディタのツールバーで押します。
*注:* 出力ウィンドウ(Ctrl-4; ⌘-4 Macの場合)のViewに、、実行結果の入ったログファイルが表示されます。
-4. `product` テーブル( image::images/db-table-node.png[] )ノードを右クリックし、[ View Data データ表示] を選択します。あなたは16個の新しいレコードがテーブルに記載されているのを見ることができます。
+
+[start=4]
+. `product` テーブル( image::images/db-table-node.png[] )ノードを右クリックし、[ View Data データ表示] を選択します。あなたは16個の新しいレコードがテーブルに記載されているのを見ることができます。
image::images/product-table.png[title="Choose View Data from a table node's right-click menu to verify sample data"]
@@ -237,11 +234,17 @@
1. IDEのツールバーの [New File 新規ファイル]( image::images/new-file-btn.png[] )ボタンを押します。 (または、 Ctrl-N、 ⌘-N Mac)。
-2. *GlassFish* カテゴリを選択し、*JDBC Resource* を選択、[次へ] をクリック。
-3. JDBC リソースウィザードのステップ2で、`Create New JDBC Connection Pool` ( JDBCコネクションプール の新規作成)オプションを選択します。その際に3つの新しい手順がウィザードに追加され、コネクションプールの設定ができるようになります。
+[start=2]
+. *GlassFish* カテゴリを選択し、*JDBC Resource* を選択、[次へ] をクリック。
-4. データソース設定の詳細を入力します:
+
+[start=3]
+. JDBC リソースウィザードのステップ2で、`Create New JDBC Connection Pool` ( JDBCコネクションプール の新規作成)オプションを選択します。その際に3つの新しい手順がウィザードに追加され、コネクションプールの設定ができるようになります。
+
+
+[start=4]
+. データソース設定の詳細を入力します:
* *JNDI Name:* `jdbc/affablebean`
[tips]#慣例で JNDI 名は、 '`jdbc/`' 文字列で始まります。 #
@@ -252,11 +255,17 @@
image::images/jdbc-resource-gen-attributes.png[title="Create a new connection pool and data source using the JDBC Resource wizard"]
-5. 「次へ」をクリック。ステップ3、Additional Properties (追加のプロパティ)で、データソースのために追加の構成情報を指定する必要は全くありません。
-6. 「次へ」をクリック。ステップ4、Choose Database Connection(データベース接続の選択)で、JDBCコネクションプール名に、`AffableBeanPool` を入力します。また、 `Extract from Existing Connection`(既存の接続から抽出)オプションが選択されていること、`jdbc:mysql://localhost:3306/affablebean` 接続がリストにあることを確認します。
+[start=5]
+. 「次へ」をクリック。ステップ3、Additional Properties (追加のプロパティ)で、データソースのために追加の構成情報を指定する必要は全くありません。
-7. 次へをクリック。ステップ5、Add Connection Pool Properties(コネクションプールのプロパティを追加する)で、以下の詳細を指定します:
+
+[start=6]
+. 「次へ」をクリック。ステップ4、Choose Database Connection(データベース接続の選択)で、JDBCコネクションプール名に、`AffableBeanPool` を入力します。また、 `Extract from Existing Connection`(既存の接続から抽出)オプションが選択されていること、`jdbc:mysql://localhost:3306/affablebean` 接続がリストにあることを確認します。
+
+
+[start=7]
+. 次へをクリック。ステップ5、Add Connection Pool Properties(コネクションプールのプロパティを追加する)で、以下の詳細を指定します:
* *Datasource Classname:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
@@ -268,9 +277,13 @@
image::images/jdbc-resource-conn-pool.png[title="Create a new connection pool and data source using the JDBC Resource wizard"]
-8. [ Finish ]をクリックします。ウィザードは、プロジェクト用に`sun-resources.xml` ファイルを生成します。ファイルにはGlassFish上にコネクションプールとデータソースを設定するために必要な全ての情報が入っています。 `sun-resources.xml` ファイルは、GlassFishアプリケーションサーバーに固有のデプロイメント記述子です。プロジェクトがデプロイされると、サーバーは`sun-resources.xml`に含まれているすべての構成データを読込み、それに沿ってコネクションプールとデータソースをセットアップします。いったんコネクションプールとデータソースがサーバー上に存在すれば、あなたのプロジェクトは、もはや`sun-resources.xml`を必要としません。
-9. プロジェクトウィンドウ(Ctrl - 1; ⌘-1 Macの場合)で、Server Resources(サーバーリソース)ノードを展開し、`sun-resources.xml` ファイルをダブルクリックしてエディタに開きます。ここでは、 XML構成がコネクションプールとデータソースをセットアップするのに必要とされたことを理解してください。(以下のコードは読みやすさのためにフォーマットされています。)
+[start=8]
+. [ Finish ]をクリックします。ウィザードは、プロジェクト用に`sun-resources.xml` ファイルを生成します。ファイルにはGlassFish上にコネクションプールとデータソースを設定するために必要な全ての情報が入っています。 `sun-resources.xml` ファイルは、GlassFishアプリケーションサーバーに固有のデプロイメント記述子です。プロジェクトがデプロイされると、サーバーは`sun-resources.xml`に含まれているすべての構成データを読込み、それに沿ってコネクションプールとデータソースをセットアップします。いったんコネクションプールとデータソースがサーバー上に存在すれば、あなたのプロジェクトは、もはや`sun-resources.xml`を必要としません。
+
+
+[start=9]
+. プロジェクトウィンドウ(Ctrl - 1; ⌘-1 Macの場合)で、Server Resources(サーバーリソース)ノードを展開し、`sun-resources.xml` ファイルをダブルクリックしてエディタに開きます。ここでは、 XML構成がコネクションプールとデータソースをセットアップするのに必要とされたことを理解してください。(以下のコードは読みやすさのためにフォーマットされています。)
[source,xml]
@@ -318,9 +331,13 @@
</resources>
----
-10. プロジェクトウィンドウ(Ctrl-1; ⌘-1 Macの場合)で、`AffableBean` プロジェクトノードを右クリック し、「Deploy」(配置)を選択します。 GlassFish サーバーは、`sun-resources.xml` ファイルの設定データを読み取り、`AffableBeanPool` コネクションプールと `jdbc/affablebean` データソースを生成します。
-11. [Services サービス]ウィンドウで、Servers > GlassFish > Resources > JDBC ノードを展開します。 `jdbc/affablebean` データソースが JDBC リソースの下にリストされており、また、`AffableBeanPool` コネクションプールが Connection Pools の下にリストされているのを見つけることができます。
+[start=10]
+. プロジェクトウィンドウ(Ctrl-1; ⌘-1 Macの場合)で、`AffableBean` プロジェクトノードを右クリック し、「Deploy」(配置)を選択します。 GlassFish サーバーは、`sun-resources.xml` ファイルの設定データを読み取り、`AffableBeanPool` コネクションプールと `jdbc/affablebean` データソースを生成します。
+
+
+[start=11]
+. [Services サービス]ウィンドウで、Servers > GlassFish > Resources > JDBC ノードを展開します。 `jdbc/affablebean` データソースが JDBC リソースの下にリストされており、また、`AffableBeanPool` コネクションプールが Connection Pools の下にリストされているのを見つけることができます。
image::images/gf-server-jdbc-resources.png[title="View data sources and connection pools registered on the server"]
@@ -351,13 +368,21 @@
(サーバーが未実行の場合、サーバーノードを右クリックして、[ Start (開始)]を選択します。 )
-2. サーバーノードを右クリックし、[ View Admin Console()管理コンソールの表示 ] を選択します。 GlassFish の管理コンソールがブラウザに開きます。
-3. 管理コンソールにログインします。デフォルトのユーザ名/パスワードは: `admin/adminadmin`。
+[start=2]
+. サーバーノードを右クリックし、[ View Admin Console()管理コンソールの表示 ] を選択します。 GlassFish の管理コンソールがブラウザに開きます。
-4. 左側のコンソールツリーで、 リソース > JDBC > コネクションプールノードを展開し、 `AffableBeanPool` をクリックします。メインウィンドウに、選択したコネクションプール用の [ Edit Connection Pool ]インターフェイスが表示されます。
-5. ping ボタンをクリックします。 ping が成功した場合、 GlassFish サーバーは MySQL サーバ上の `affablebean` データベースへの接続ができています。
+[start=3]
+. 管理コンソールにログインします。デフォルトのユーザ名/パスワードは: `admin/adminadmin`。
+
+
+[start=4]
+. 左側のコンソールツリーで、 リソース > JDBC > コネクションプールノードを展開し、 `AffableBeanPool` をクリックします。メインウィンドウに、選択したコネクションプール用の [ Edit Connection Pool ]インターフェイスが表示されます。
+
+
+[start=5]
+. ping ボタンをクリックします。 ping が成功した場合、 GlassFish サーバーは MySQL サーバ上の `affablebean` データベースへの接続ができています。
image::images/ping-succeeded.png[title="Ping the connection pool to determine whether it has a physical connection to the database"]
@@ -369,9 +394,13 @@
1. プロジェクトウィンドウで、Configuration Files (設定ファイル)フォルダを展開し、`web.xml` をダブルクリックします。IDE のメインウィンドウでそのファイル用のグラフィカルなインターフェイスが表示されます。
-2. エディタの上部にある [References参照]タブをクリックします。Resource References (リソースの参照)見出しを展開して、[ Add ] をクリックします。[ Add Resource Reference(リソースリファレンスの追加)]ダイアログが開きます。
-3. ダイアログに以下の情報を入力してください:
+[start=2]
+. エディタの上部にある [References参照]タブをクリックします。Resource References (リソースの参照)見出しを展開して、[ Add ] をクリックします。[ Add Resource Reference(リソースリファレンスの追加)]ダイアログが開きます。
+
+
+[start=3]
+. ダイアログに以下の情報を入力してください:
* *Resource Name:* `jdbc/affablebean`
* *Resource Type:* `javax.sql.ConnectionPoolDataSource`
@@ -384,7 +413,9 @@
image::images/add-resource-ref-dialog.png[title="Specify resource properties in the Add Resource Reference dialog"]
-4. [OK] をクリックします。新しいリソースが Resource References (リソース参照) 見出しの下に追加されます。
+
+[start=4]
+. [OK] をクリックします。新しいリソースが Resource References (リソース参照) 見出しの下に追加されます。
image::images/resource-reference.png[title="Create a reference to the data source for the application"]
@@ -409,23 +440,33 @@
1. 新しいJSPページを作成しデータソースをテストします。 [New File (新規ファイル)] ( image::images/new-file-btn.png[] )ボタンを押します。 (または、 Ctrl-n、 ⌘-N Mac )。
-2. 、Web カテゴリーを選択し、JSP ファイルタイプを選択し、 [Next 次へ]クリックします。
-3. [ファイル名] に、「 `testDataSource` 」、[フォルダ] フィールドに「 `test` 」と入力します 。
+[start=2]
+. 、Web カテゴリーを選択し、JSP ファイルタイプを選択し、 [Next 次へ]クリックします。
+
+
+[start=3]
+. [ファイル名] に、「 `testDataSource` 」、[フォルダ] フィールドに「 `test` 」と入力します 。
image::images/new-jsp-wzd.png[title="Enter details to name and place a new JSP page into the project"]
プロジェクトの Web ページには、まだ `test` という名前のフォルダがありません (つまり、`web` フォルダ内に)。[Folder フォルダ]フィールドに [ `test` ] と入力すると、IDE はウィザードを完了する時に、そのフォルダを作成します。
-4. [ Finish ] をクリックします。 IDE が新しい `testDataSource.jsp` ファイルを生成し、プロジェクト内の新しい `test` フォルダにそれを配置します。
-5. エディタで、新しい `testDataSource.jsp` ファイルの中の `<h1>` タグを含む行の末尾にカーソルを置きます ( 17行 ) 。Return キーを押し、次に Ctrl-Space しコード補完を呼び出します。オプションの一覧から「 DB Report 」を選択します。
+[start=4]
+. [ Finish ] をクリックします。 IDE が新しい `testDataSource.jsp` ファイルを生成し、プロジェクト内の新しい `test` フォルダにそれを配置します。
+
+
+[start=5]
+. エディタで、新しい `testDataSource.jsp` ファイルの中の `<h1>` タグを含む行の末尾にカーソルを置きます ( 17行 ) 。Return キーを押し、次に Ctrl-Space しコード補完を呼び出します。オプションの一覧から「 DB Report 」を選択します。
image::images/db-report.png[title="Press Ctrl-Space in editor to invoke code suggestions"]
行番号が表示されない場合は、エディタの左余白を右クリックし「 Show Line Numbers (行番号表示)」を選択します。
-6. 「 Insert DB Report(DBレポートの挿入)」ダイアログボックスで、データソースを指定し、実行しようとする SQL クエリを変更します。:
+
+[start=6]
+. 「 Insert DB Report(DBレポートの挿入)」ダイアログボックスで、データソースを指定し、実行しようとする SQL クエリを変更します。:
* *Data Source:* `jdbc/affablebean`
@@ -433,7 +474,9 @@
image::images/insert-db-report.png[title="Specify the data source and SQL query to be executed"]
-7. 「OK」をクリックします。ダイアログは `taglib` ディレクティブ(指令)を JSTL/core と `sql` ライブラリの両方のファイルの先頭に追加します:
+
+[start=7]
+. 「OK」をクリックします。ダイアログは `taglib` ディレクティブ(指令)を JSTL/core と `sql` ライブラリの両方のファイルの先頭に追加します:
[source,java]
@@ -472,19 +515,27 @@
</table>
----
-8. ブラウザでファイルを実行する前に、あなたはNetBeans GlassFish サポートの JDBC ドライバの展開オプションを有効にしていることを確認します。 [ツール] >[サーバー] を選び、サービスウィンドウを開きます。左側の列で、あなたが配置している GlassFish サーバーを選択します。メインの列で、「 Enable JDBC Driver Deployment 」オプションが選択されて、いることを確認し、[Close 閉じる]をクリックします。
+
+[start=8]
+. ブラウザでファイルを実行する前に、あなたはNetBeans GlassFish サポートの JDBC ドライバの展開オプションを有効にしていることを確認します。 [ツール] >[サーバー] を選び、サービスウィンドウを開きます。左側の列で、あなたが配置している GlassFish サーバーを選択します。メインの列で、「 Enable JDBC Driver Deployment 」オプションが選択されて、いることを確認し、[Close 閉じる]をクリックします。
image::images/servers-window.png[title="Ensure that the Enable JDBC Driver Deployment option is selected"]
データベースに接続する Java アプリケーションでは、サーバーは JDBC ドライバ を必要とし、それによりSQL と Java 言語間の通信ブリッジを作成します。 MySQL の場合は、[ link:http://www.mysql.com/downloads/connector/j/[+Connector/J+] J という JDBC ドライバを使用します。通常、ドライバ JAR ファイルをサーバーの `lib` ディレクトリに手動で配置する必要があります。 [Enable JDBC Driver Deployment ](JDBC ドライバの配置を有効にする)オプションを選択すると、サーバーはドライバが必要どうかをチェックします。もし必要なら IDE はドライバをサーバーに配置します。
-9. エディタで右クリックし、[ Run File (ファイル実行)] (Shift-F6; fn-Shift-F6 on Mac) を選択します。 `testDataSource.jsp` ファイルがサーブレットにコンパイルされ、サーバーに配置されブラウザで実行されます。
-10. 出力ウィンドウを開きます( Ctrl-4、 ⌘ -4 Macの場合)。[ AffableBean(run) ]タブをクリック。「ドライバ JARファイル (`mysql-connector-java-5.1.6-bin.jar`) が配置されました。」という出力が表示されます。
+[start=9]
+. エディタで右クリックし、[ Run File (ファイル実行)] (Shift-F6; fn-Shift-F6 on Mac) を選択します。 `testDataSource.jsp` ファイルがサーブレットにコンパイルされ、サーバーに配置されブラウザで実行されます。
+
+
+[start=10]
+. 出力ウィンドウを開きます( Ctrl-4、 ⌘ -4 Macの場合)。[ AffableBean(run) ]タブをクリック。「ドライバ JARファイル (`mysql-connector-java-5.1.6-bin.jar`) が配置されました。」という出力が表示されます。
image::images/output-window-mysql-driver.png[title="When JDBC Driver Deployment is enabled, the IDE deploys the MySQL driver to GlassFish when required"]
-11. ブラウザで testDataSource.jsp を調べます。あなたは、HTMLテーブル一覧のデータに`category` と `product` テーブルが含まれているのを確認します。
+
+[start=11]
+. ブラウザで testDataSource.jsp を調べます。あなたは、HTMLテーブル一覧のデータに`category` と `product` テーブルが含まれているのを確認します。
image::images/test-data-source.png[title="The JSP page contains data extracted from the 'affablebean' database"]
@@ -502,7 +553,9 @@
1. ウェブデプロイメント記述子の中にパラメータ名をリスト(一覧を作成)する
-2. `initParam` オブジェクトを使い、JSPページ内のパラメータを呼び出す
+
+[start=2]
+. `initParam` オブジェクトを使い、JSPページ内のパラメータを呼び出す
JSP 式言語(EL)は _implicit objects_(暗黙オブジェクト)を定義します。`initParam` はその例です。JSP ページで作業するときはドット表記を使用して暗黙オブジェクトを利用できます。そして、EL デリミタ ( `${...}` )の中に式を配置することができます。たとえば、`myParam` という名前の初期化パラメータがある場合、JSPページから `${initParam.myParam}` 式でアクセスすることができます。
@@ -512,16 +565,24 @@
1. link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Fimg.zip[+web サイトサンプル画像+]をダウンロード、コンピュータ上にファイルを解凍します。解凍されたファイルは、 AffableBean アプリケーションで必要なすべての画像リソースが入った `img` フォルダです。
-2. `img` フォルダーを `AffableBean` プロジェクトの中にインポートします。`img` フォルダーをコピーし( Ctrl - C、 Mac上で ⌘ - C)、その後、IDE のプロジェクトウィンドウで、プロジェクト Webページのノードに貼り付けします( Ctrl + V。 ⌘ - V Macの場合)。
+
+[start=2]
+. `img` フォルダーを `AffableBean` プロジェクトの中にインポートします。`img` フォルダーをコピーし( Ctrl - C、 Mac上で ⌘ - C)、その後、IDE のプロジェクトウィンドウで、プロジェクト Webページのノードに貼り付けします( Ctrl + V。 ⌘ - V Macの場合)。
image::images/projects-win-img-folder.png[title="Import the 'img' folder into the AffableBean project"]
`categories` と `products` フォルダには、link:design.html#index[+index+] と link:design.html#category[+category+] ページで表示される画像が入っています。
-3. プロジェクトのWebデプロイメント記述子を開きます。プロジェクトウィンドウで、Configuration Files(構成ファイル) ノードを展開し、 `web.xml` をダブルクリックします。
-4. [General 全般]タブをクリックして、コンテキストパラメータを展開し、[Add追加]ボタンをクリックします。
+[start=3]
+. プロジェクトのWebデプロイメント記述子を開きます。プロジェクトウィンドウで、Configuration Files(構成ファイル) ノードを展開し、 `web.xml` をダブルクリックします。
-5. [ Add Context Parameter (コンテキストパラメータの追加)]ダイアログで、以下の情報を入力してください:
+
+[start=4]
+. [General 全般]タブをクリックして、コンテキストパラメータを展開し、[Add追加]ボタンをクリックします。
+
+
+[start=5]
+. [ Add Context Parameter (コンテキストパラメータの追加)]ダイアログで、以下の情報を入力してください:
* *Parameter Name(パラメータ名):* `productImagePath`
@@ -531,9 +592,13 @@
image::images/add-context-param-dialog.png[title="Add initialization parameters using the Add Context Parameter dialog"]
-6. [ OK ]をクリックします
-7. [ Add ]ボタンをもう一度クリックして、次の詳細を入力してください:
+[start=6]
+. [ OK ]をクリックします
+
+
+[start=7]
+. [ Add ]ボタンをもう一度クリックして、次の詳細を入力してください:
* *Parameter Name:* `categoryImagePath`
@@ -541,12 +606,16 @@
* *Description:* _(Optional)_ `The relative path to category images`
-8. OKをクリックします。 2つのコンテキストパラメータがリストされます:
+
+[start=8]
+. OKをクリックします。 2つのコンテキストパラメータがリストされます:
image::images/context-parameters.png[title="Context parameters display in the web.xml interface"]
-9. [XML]タブをクリックして、デプロイメント記述子に追加されているXMLコンテンツを表示します。次の `<context-param>` エントリが追加されました:
+
+[start=9]
+. [XML]タブをクリックして、デプロイメント記述子に追加されているXMLコンテンツを表示します。次の `<context-param>` エントリが追加されました:
[source,xml]
@@ -564,7 +633,9 @@
</context-param>
----
-10. コンテキストパラメータの値が web ページにアクセス可能かどうかをテストするために、エディタで任意のプロジェクトの Web ページを開き、`initParam` の暗黙的なオブジェクトを使い、EL式(expressions)を入力してください。たとえば、`index.jsp` を開き、以下を入力してください(新しいコードは太字で示します):
+
+[start=10]
+. コンテキストパラメータの値が web ページにアクセス可能かどうかをテストするために、エディタで任意のプロジェクトの Web ページを開き、`initParam` の暗黙的なオブジェクトを使い、EL式(expressions)を入力してください。たとえば、`index.jsp` を開き、以下を入力してください(新しいコードは太字で示します):
[source,html]
@@ -581,7 +652,9 @@
</div>
----
-11. プロジェクトを実行します。[ Run Project (プロジェクトを実行)] ( image::images/run-project-btn.png[] )ボタンをクリックします。プロジェクトのインデックスページがブラウザに表示されます。そして、ページに表示された`categoryImagePath` と `productImagePath` コンテキストパラメータの値を見てください。
+
+[start=11]
+. プロジェクトを実行します。[ Run Project (プロジェクトを実行)] ( image::images/run-project-btn.png[] )ボタンをクリックします。プロジェクトのインデックスページがブラウザに表示されます。そして、ページに表示された`categoryImagePath` と `productImagePath` コンテキストパラメータの値を見てください。
image::images/context-params-browser.png[title="Use 'initParam' with JSP EL delimiters to display context parameter values"]
@@ -630,11 +703,15 @@
1. プロジェクトウインドウで、`index.jsp` ノードをダブルクリックし、index.jsp をエディターに開きます。(すでに開いている場合は、Ctrl-Tab を押しエディターにそれを選びます)。
-2. ファイルの先頭で、最初の `<div>` タグの前で、カーソルを空白行に置き、 「`db`」 を入力し、Ctrl-Space を押します。コード補完ポップアップウインドウが表示されるので、[ DB Query ] を選択します。
+
+[start=2]
+. ファイルの先頭で、最初の `<div>` タグの前で、カーソルを空白行に置き、 「`db`」 を入力し、Ctrl-Space を押します。コード補完ポップアップウインドウが表示されるので、[ DB Query ] を選択します。
image::images/db-query.png[title="Type 'db', then press Ctrl-Space to invoke code completion suggestions"]
-3. [Insert DB Query(DBクエリー挿入)]ダイアログの中で、以下の詳細を入力します。:
+
+[start=3]
+. [Insert DB Query(DBクエリー挿入)]ダイアログの中で、以下の詳細を入力します。:
* *Variable Name:* `categories`
@@ -646,7 +723,9 @@
image::images/insert-db-query.png[title="Specify query details to create an SQL query using JSTL <sql:query> tags"]
-4. [ OK ]をクリックします。ダイアログは JSTL `<sql:query>` タグを使い SQL クエリを生成します。また、注意する必要があります。 そのディレクティブ(指示)が必要とした参照はページの先頭に自動的に挿入されています。(変更箇所は太字で表示されています。 )
+
+[start=4]
+. [ OK ]をクリックします。ダイアログは JSTL `<sql:query>` タグを使い SQL クエリを生成します。また、注意する必要があります。 そのディレクティブ(指示)が必要とした参照はページの先頭に自動的に挿入されています。(変更箇所は太字で表示されています。 )
[source,html]
@@ -670,11 +749,15 @@
----
SQLクエリは `categories` 変数に格納された結果セットを作成します。あなたは、EL構文(すなわち `${categories}` ) を使用して結果セットにアクセスできます(下記参照)。
-5. [ `<div id="indexRightColumn">` ] の末尾にカーソルを置き( 22行目)、return キーを押し、[ `jstl` ]と入力して、Ctrl - Spaceを押し、「 JSTL For Each 」を選択します。
+
+[start=5]
+. [ `<div id="indexRightColumn">` ] の末尾にカーソルを置き( 22行目)、return キーを押し、[ `jstl` ]と入力して、Ctrl - Spaceを押し、「 JSTL For Each 」を選択します。
image::images/jstl-for-each.png[title="Type 'jstl', then press Ctrl-Space to invoke code completion suggestions"]
-6. [ Insert JSTL For Each ]ダイアログで、次の詳細を入力してください:
+
+[start=6]
+. [ Insert JSTL For Each ]ダイアログで、次の詳細を入力してください:
* *Collection:* `${categories.rows}`
@@ -682,7 +765,9 @@
image::images/insert-jstl-for-each.png[title="Specify details to create a 'for each' loop using JSTL <c:forEach> tags"]
-7. [ OK ] をクリックします。ダイアログは `<c:forEach>` タグを使い、`forEach` ループ用の構文をセットアップします。また、注意する必要があります。`core` `taglib` ディレクティブ(指令)へ必要とされる参照が、自動的にページの先頭に挿入されています。(変更箇所は太字で表示されます。)
+
+[start=7]
+. [ OK ] をクリックします。ダイアログは `<c:forEach>` タグを使い、`forEach` ループ用の構文をセットアップします。また、注意する必要があります。`core` `taglib` ディレクティブ(指令)へ必要とされる参照が、自動的にページの先頭に挿入されています。(変更箇所は太字で表示されます。)
[source,html]
@@ -701,7 +786,9 @@
「 `rows` 」が生成されたコード中の何を参照しているかわからない場合は、 `categories` 変数が結果セットを表していることを思い出してください。具体的には、 `categories` は `link:http://java.sun.com/products/jsp/jstl/1.1/docs/api/javax/servlet/jsp/jstl/sql/Result.html[+javax.servlet.jsp.jstl.sql.Result+]` インターフェイスを実装したオブジェクトを参照しています。このオブジェクトは、行、列名にアクセスするためのプロパティと、クエリの結果セットのサイズを提供しています。上記の例のようにドット表記法を使用する時、「 `categories.rows` 」は Java で「`categories.getRows()` 」に変換されます
-8. `<c:forEach>` タグをページの中に統合します。`<div class="categoryBox">` タグを `forEach` ループの中にネストすることができます。そうして、HTMLマークアップが4つのカテゴリそれぞれに生成されます。EL構文を使用して、`category` テーブルの `id` と、4つのレコードそれぞれの `name` 列の値を抽出します。`forEach` ループ外に存在する他の`<div class="categoryBox">` タグを確実に削除してください。完了したときの完全な `index.jsp` ファイルは 次のようになります。(`<c:forEach>` タグと内容は太字で表示されています。)
+
+[start=8]
+. `<c:forEach>` タグをページの中に統合します。`<div class="categoryBox">` タグを `forEach` ループの中にネストすることができます。そうして、HTMLマークアップが4つのカテゴリそれぞれに生成されます。EL構文を使用して、`category` テーブルの `id` と、4つのレコードそれぞれの `name` 列の値を抽出します。`forEach` ループ外に存在する他の`<div class="categoryBox">` タグを確実に削除してください。完了したときの完全な `index.jsp` ファイルは 次のようになります。(`<c:forEach>` タグと内容は太字で表示されています。)
[source,html]
@@ -744,11 +831,15 @@
</div>*
----
-9. [ Run Project(プロジェクトを実行)] ( image::images/run-project-btn.png[] )ボタンをクリックします。プロジェクトのインデックスページがブラウザで開きます。あなたは4つのカテゴリの名前と画像を確認して下さい。
+
+[start=9]
+. [ Run Project(プロジェクトを実行)] ( image::images/run-project-btn.png[] )ボタンをクリックします。プロジェクトのインデックスページがブラウザで開きます。あなたは4つのカテゴリの名前と画像を確認して下さい。
image::images/index-category-images.png[title="'for each' loop extracts details from the database and utilizes them in the page"]
-10. ブラウザで4つのイメージのいずれかをクリックします。カテゴリページが表示されます。
+
+[start=10]
+. ブラウザで4つのイメージのいずれかをクリックします。カテゴリページが表示されます。
image::images/category-page.png[title="Category images from index page link to category page"]
@@ -802,7 +893,9 @@
1. JSTL `sql` タグライブラリーを使いデータベースからデータを取得します。
-2. JSTL `core` ライブラリーと EL構文を使い、データを表示します。
+
+[start=2]
+. JSTL `core` ライブラリーと EL構文を使い、データを表示します。
各3つのタスクに個別に取り組む
@@ -811,7 +904,9 @@
1. プロジェクトウィンドウで、`category.jsp` ノードをダブルクリックし エディタでそれを開きます。(既に、開いている場合エディタでそれを選択するために Ctrl - Tab を押します。)
-2. ファイルの先頭に次のSQLクエリを追加します。
+
+[start=2]
+. ファイルの先頭に次のSQLクエリを追加します。
[source,xml]
@@ -824,7 +919,9 @@
<<categoryIndex,上記で述べたように>>、 [ Insert DB Query(挿入DBのクエリ)] ダイアログボックスを使用するか、または、入力中にCtrl - Space キーを押してエディタのコード提案と補完機能を使用します。
-3. `<div id="categoryLeftColumn">` タグの間で、既存の静的なプレースホルダのコンテンツを、次の`<c:forEach>` ループに置き換えます。
+
+[start=3]
+. `<div id="categoryLeftColumn">` タグの間で、既存の静的なプレースホルダのコンテンツを、次の`<c:forEach>` ループに置き換えます。
[source,html]
@@ -857,7 +954,9 @@
----
上記のスニペットでは、'`pageContext.request.queryString`' を使用してリクエストのクエリ文字列にアクセスします。 [ `pageContext` ] は別のlink:http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/bnahq.html#bnaij[+暗黙オブジェクト+] で、JSP 式言語で定義されています。EL 式は `link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/jsp/PageContext.html[+PageContext+]` を使用して、現在のリクエスト( `link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/HttpServletRequest.html[+HttpServletRequest+]` オブジェクト)にアクセスします。`HttpServletRequest` から、`getQueryString()` メソッドが呼び出され、リクエストのクエリ文字列の値を取得します。
-4. JSTL `core` と `sql` `taglib` ディレクティブをページの先頭へ確実に追加してください 。(これはエディタのコード提案と補完機能を使用した時には自動的に行われます。)
+
+[start=4]
+. JSTL `core` と `sql` `taglib` ディレクティブをページの先頭へ確実に追加してください 。(これはエディタのコード提案と補完機能を使用した時には自動的に行われます。)
[source,java]
@@ -867,7 +966,9 @@
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-5. プロジェクトを実行します。ブラウザで、カテゴリページへ行き、左の列のカテゴリボタンをクリックします。クリックするたびに、ページが更新され、選択されたカテゴリをハイライトします。
+
+[start=5]
+. プロジェクトを実行します。ブラウザで、カテゴリページへ行き、左の列のカテゴリボタンをクリックします。クリックするたびに、ページが更新され、選択されたカテゴリをハイライトします。
image::images/category-page-bakery.png[title="Select categories by clicking category buttons in the left column"]
@@ -895,15 +996,25 @@
(ブレークポイントを設定するために、行の左マージンをクリックします。ブレークポイント ( image::images/breakpoint-icon.png[] ) アイコンが表示されます。 )
-2. IDEのメインツールバーで、 [Debug Project デバッグプロジェクト] ( image::images/debug-project-btn.png[] )ボタンをクリックします。デバッグセッションがプロジェクトに対してアクティブ化され、アプリケーションのインデックスページがブラウザに開きます。
-3. インデックスページで bakery (パン)のカテゴリをクリックします。(あなたは、bakery (パン)のカテゴリIDが ’`3`’ であることを知っています)。
+[start=2]
+. IDEのメインツールバーで、 [Debug Project デバッグプロジェクト] ( image::images/debug-project-btn.png[] )ボタンをクリックします。デバッグセッションがプロジェクトに対してアクティブ化され、アプリケーションのインデックスページがブラウザに開きます。
-4. IDE に戻り、デバッガがブレークポイントの行で中断していることに注意します。中断している時、マージンはブレークポイント ( image::images/debugger-suspended-icon.png[] ) で緑色の多印を表示しています。そして、その行は緑の背景で表示されています。
-5. 変数ウインドウを開いて(Ctrl-Shift-1)、暗黙オブジェクト Implicit Objects > pageContext > request > queryString ノードを展開します。変数の値を調べ、変数の値が ' `3` ' でそれはあなたが選択した category ID に対応していることに注意します。
+[start=3]
+. インデックスページで bakery (パン)のカテゴリをクリックします。(あなたは、bakery (パン)のカテゴリIDが ’`3`’ であることを知っています)。
-6. Finish Debugger Session (デバッガセッションを終了する)] ( image::images/finish-debugger-session-btn.png[] )ボタンを押して、デバッガセッションを狩猟します。
+
+[start=4]
+. IDE に戻り、デバッガがブレークポイントの行で中断していることに注意します。中断している時、マージンはブレークポイント ( image::images/debugger-suspended-icon.png[] ) で緑色の多印を表示しています。そして、その行は緑の背景で表示されています。
+
+
+[start=5]
+. 変数ウインドウを開いて(Ctrl-Shift-1)、暗黙オブジェクト Implicit Objects > pageContext > request > queryString ノードを展開します。変数の値を調べ、変数の値が ' `3` ' でそれはあなたが選択した category ID に対応していることに注意します。
+
+
+[start=6]
+. Finish Debugger Session (デバッガセッションを終了する)] ( image::images/finish-debugger-session-btn.png[] )ボタンを押して、デバッガセッションを狩猟します。
@@ -925,7 +1036,9 @@
</sql:query>*
----
-2. JSPのEL構文を使用してクエリからカテゴリ名を抽出し、それをページに表示します。`<p id="categoryTitle">` 要素に以下のように変更します。(太字で表示されています。)
+
+[start=2]
+. JSPのEL構文を使用してクエリからカテゴリ名を抽出し、それをページに表示します。`<p id="categoryTitle">` 要素に以下のように変更します。(太字で表示されています。)
[source,xml]
@@ -936,9 +1049,13 @@
[ `selectedCategory` ] クエリの結果には、1つのアイテムだけが入っています。(つまり、 ユーザはただ一つのカテゴリを選択できます)。「 `selectedCategory*.rows[0]*` 」を使い、結果セットの最初の行を取り出すことができます。例えば、ユーザーが「 'meats(肉)'」カテゴリを選択した場合、返される式は「'`{name=meats}`'」になります。その後はカテゴリ名 「 `${selectedCategory.rows[0]*.name*}` 」でアクセスできます。
-3. ファイルに加えた変更を保存します( Ctrl - S 、 ⌘ - S Mac)。
-4. ブラウザに戻り、カテゴリページを更新します。今選択したカテゴリの名前が製品テーブルの上に表示されます。
+[start=3]
+. ファイルに加えた変更を保存します( Ctrl - S 、 ⌘ - S Mac)。
+
+
+[start=4]
+. ブラウザに戻り、カテゴリページを更新します。今選択したカテゴリの名前が製品テーブルの上に表示されます。
image::images/category-page-bakery-title.png[title="The name of the selected category dynamically displays above the product table"]
@@ -968,7 +1085,9 @@
</sql:query>*
----
-2. `<table id="productTable">` タグの間で、既存の静的テーブルの行のプレースホルダ (`<tr>` タグ) を以下の`<c:forEach>` ループに置き換えます。(変更は太字で表示されています。)
+
+[start=2]
+. `<table id="productTable">` タグの間で、既存の静的テーブルの行のプレースホルダ (`<tr>` タグ) を以下の`<c:forEach>` ループに置き換えます。(変更は太字で表示されています。)
[source,xml]
@@ -1019,9 +1138,13 @@
JSP 式言語の演算子の説明については、 Java EE 5のチュートリアル: link:http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/bnahq.html#bnaik[+JavaServer Pages Technology > Unified Expression Language > Operators+] を見てください。
-3. ファイルに加えた変更を保存します。( Ctrl - S、 ⌘ - S Mac)
-4. ブラウザに戻り、カテゴリページを更新します。製品の詳細が選択したカテゴリのテーブルに表示されます。
+[start=3]
+. ファイルに加えた変更を保存します。( Ctrl - S、 ⌘ - S Mac)
+
+
+[start=4]
+. ブラウザに戻り、カテゴリページを更新します。製品の詳細が選択したカテゴリのテーブルに表示されます。
image::images/category-page-bakery-product-table.png[title="Product details are dynamically displayed for the selected category"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model.asciidoc
index 26562b8..d2d0252 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model.asciidoc
@@ -30,29 +30,6 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Designing the Data Model
-==== Tutorial Contents
-
-1. link:intro.html[+Introduction+]
-2. link:design.html[+Designing the Application+]
-3. link:setup-dev-environ.html[+Setting up the Development Environment+]
-4. *Designing the Data Model*
-* <<idEntities,Identifying Entities for the Data Model>>
-* <<createERDiagram,Creating an Entity-Relationship Diagram>>
-* <<forwardEngineer,Forward-Engineering to the Database>>
-* <<connectDB,Connecting to the Database from the IDE>>
-* <<seeAlso,See Also>>
-5. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
-6. link:connect-db.html[+Connecting the Application to the Database+]
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
This tutorial unit focuses on data modeling, or the process of creating a conceptual model of your storage system by identifying and defining the entities that your system requires, and their relationships to one another. The data model should contain all the logical and physical design parameters required to generate a script using the Data Definition Language (DDL), which can then be used to create a database.^<<footnote1,[1]>>^
In this unit, you work primarily with link:http://wb.mysql.com/[+MySQL Workbench+], a graphical tool that enables you to create data models, reverse-engineer SQL scripts into visual representations, forward-engineer data models into database schemata, and synchronize models with a running MySQL database server.
@@ -145,7 +122,9 @@
--
image::images/workbench.png[role="left", link="images/workbench.png"]
--
-2. Enter the following settings for the new schema:
+
+[start=2]
+. Enter the following settings for the new schema:
* *Schema Name:* `affablebean`
* *Default Collation:* `utf8 - utf8_unicode_ci`
* *Comments:* `Schema used with the AffableBean application`
@@ -167,13 +146,19 @@
--
image::images/workbench-empty-canvas.png[role="left", link="images/workbench-empty-canvas.png"]
--
-2. Click the New Table ( image::images/wb-new-table-icon.png[] ) icon located in the left margin, then hover your mouse onto the canvas and click again. A new table displays on the canvas.
+
+[start=2]
+. Click the New Table ( image::images/wb-new-table-icon.png[] ) icon located in the left margin, then hover your mouse onto the canvas and click again. A new table displays on the canvas.
image::images/wb-new-entity-table.png[title="Click the New Table icon to drag empty tables (entities) onto the canvas"]
-3. Double-click the table. The Table editor opens in the bottom region of the interface, allowing you to configure settings for the table.
+
+[start=3]
+. Double-click the table. The Table editor opens in the bottom region of the interface, allowing you to configure settings for the table.
*Note:* The terms 'table' and 'entity' are nearly synonymous in this tutorial unit. From the point of view of a database schema, you are creating tables. From a data modeling perspective, you are creating entities. Likewise, the columns that you later create for each table correspond to entity _properties_.
-4. In the Table editor, rename the table to one of the nouns you identified from the use-case above. Optionally add a comment describing the purpose of the table. For example:
+
+[start=4]
+. In the Table editor, rename the table to one of the nouns you identified from the use-case above. Optionally add a comment describing the purpose of the table. For example:
* *Name:* `customer`
* *Engine:* `InnoDB`
* *Comments:* `maintains customer details`
@@ -184,12 +169,16 @@
The link:http://www.innodb.com/[+InnoDB+] engine provides foreign key support, which is utilized in this tutorial. Later, under <<forwardEngineer,Forward-Engineering to the Database>>, you set the default storage engine used in Workbench to InnoDB.
-5. Under the *Catalog* tab in the left region of WorkBench (right region for version 5.1), expand the `affablebean` > `Tables` node. The *customer* table now displays.
+
+[start=5]
+. Under the *Catalog* tab in the left region of WorkBench (right region for version 5.1), expand the `affablebean` > `Tables` node. The *customer* table now displays.
image::images/wb-catalog-tab.png[title="Catalog tab automatically refreshes to display any changes to the schema"]
More importantly, note that the new `customer` table is now included in the `affablebean` schema. Because the `affablebean` schema was selected when you created the new EER diagram, any changes you make to the diagram are automatically bound to the schema.
-6. Repeat steps 2 - 4 above to add tables to the canvas for the remaining <<nounList,nouns you identified in the use-case above>>. Before naming your tables however, there is one important consideration which you should take into account. Certain keywords hold special meaning for the SQL dialect used by the MySQL server. Unfortunately, '`order`' is one of them. (For example, '`order`' can be used in an `ORDER BY` statement.) Therefore, instead of naming your table '`order`', name it '`customer_order`' instead. At this stage, don't worry about arranging the tables on the canvas in any special order.
+
+[start=6]
+. Repeat steps 2 - 4 above to add tables to the canvas for the remaining <<nounList,nouns you identified in the use-case above>>. Before naming your tables however, there is one important consideration which you should take into account. Certain keywords hold special meaning for the SQL dialect used by the MySQL server. Unfortunately, '`order`' is one of them. (For example, '`order`' can be used in an `ORDER BY` statement.) Therefore, instead of naming your table '`order`', name it '`customer_order`' instead. At this stage, don't worry about arranging the tables on the canvas in any special order.
For a list of reserved words used by the MySQL server, refer to the official manual: link:http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-1.html[+2.2. Reserved Words in MySQL 5.1+].
@@ -217,7 +206,9 @@
|`id` |`INT` |✓ |✓ |✓ |✓
|===
image::images/customer-id-column.png[title="Click to edit table columns in the Table editor"]
-3. Continue working in the `customer` table by adding the following `VARCHAR` columns. These columns should be self-explanatory, and represent data that would need to be captured for the Affable Bean business to process a customer order and send a shipment of groceries to the customer address.
+
+[start=3]
+. Continue working in the `customer` table by adding the following `VARCHAR` columns. These columns should be self-explanatory, and represent data that would need to be captured for the Affable Bean business to process a customer order and send a shipment of groceries to the customer address.
|===
|Column |Datatype |NN (Not Null)
@@ -237,11 +228,15 @@
[tips]#For an explanation of the `VARCHAR` data type, see the MySQL Reference Manual: link:http://dev.mysql.com/doc/refman/5.1/en/char.html[+10.4.1. The CHAR and VARCHAR Types+].#
image::images/customer-varchar-columns.png[title="Edit inline to add columns to customer table"]
-4. With the `customer` table selected on the canvas, choose Arrange > Reset Object Size to resize the table so that all columns are visible on the canvas. Also click the Indexes row so that any table indexes are also visible. (This includes primary and foreign keys, which becomes useful when you begin creating relationships between tables later in the exercise.)
+
+[start=4]
+. With the `customer` table selected on the canvas, choose Arrange > Reset Object Size to resize the table so that all columns are visible on the canvas. Also click the Indexes row so that any table indexes are also visible. (This includes primary and foreign keys, which becomes useful when you begin creating relationships between tables later in the exercise.)
When you finish, the `customer` entity looks as follows.
image::images/customer-table.png[title="'customer' table on EER canvas displays columns"]
-5. Follow the steps outlined above to create columns for the remaining tables.
+
+[start=5]
+. Follow the steps outlined above to create columns for the remaining tables.
==== category
@@ -323,17 +318,29 @@
Since foreign keys must be of the same data type as the columns they reference, notice that `category_id` is of type `TINYINT`, similar to the `category` table's primary key.
[tips]#The entity-relationship diagram in this tutorial uses link:http://en.wikipedia.org/wiki/Entity-relationship_model#Crow.27s_Foot_Notation[+Crow's Foot+] notation. You can alter the relationship notation in WorkBench by choosing Model > Relationship Notation.#
-3. Double-click the relationship (i.e., click the dashed line between the two entities). The Relationship editor opens in the bottom region of the interface.
-4. Change the default caption to '`belongs to`'. In other words, "product x belongs to category y." Note that this is a _unidirectional_ relationship: A `product` object contains a reference to the category it belongs to, but the related `category` object does not contain any references to the products it contains.
-5. Click the Foreign Key tab in the Relationship editor. You see the following display.
+
+[start=3]
+. Double-click the relationship (i.e., click the dashed line between the two entities). The Relationship editor opens in the bottom region of the interface.
+
+[start=4]
+. Change the default caption to '`belongs to`'. In other words, "product x belongs to category y." Note that this is a _unidirectional_ relationship: A `product` object contains a reference to the category it belongs to, but the related `category` object does not contain any references to the products it contains.
+
+[start=5]
+. Click the Foreign Key tab in the Relationship editor. You see the following display.
image::images/foreign-key-tab.png[title="Use the Foreign Key tab to modify a relationship's ordinality and cardinality"]
Under the Foreign key tab, you can modify a relationship's:
* *cardinality:* whether the relationship between two objects is _one-to-one_ or _one-to-many_.
* *ordinality:* whether a reference between entities must exist in order to maintain the integrity of the model. (Toggle the Mandatory checkbox for either side.)
* *type:* (i.e., _identifying_ or _non-identifying_). A non-identifying relationship, such as this one, refers to the fact that the child object (`product`) can be identified independently of the parent (`category`). An identifying relationship means that the child cannot be uniquely identified without the parent. An example of this is demonstrated later, when you create a many-to-many relationship between the `product` and `order` tables.
-6. Click the 1:n Non-Identifying Relationship ( image::images/one-many-btn.png[] ) button. In the following steps, you create a _one-to-many_ relationship between the `customer` and `customer_order` objects.
-7. Click the `order` table first (this table will contain the foreign key), then click the `customer` table. A relationship is formed between the two tables.
-8. Click the link between the two tables, and in the Relationship editor that displays, change the default caption to '`is placed by`'. The relationship now reads, "customer order x is placed by customer y."
+
+[start=6]
+. Click the 1:n Non-Identifying Relationship ( image::images/one-many-btn.png[] ) button. In the following steps, you create a _one-to-many_ relationship between the `customer` and `customer_order` objects.
+
+[start=7]
+. Click the `order` table first (this table will contain the foreign key), then click the `customer` table. A relationship is formed between the two tables.
+
+[start=8]
+. Click the link between the two tables, and in the Relationship editor that displays, change the default caption to '`is placed by`'. The relationship now reads, "customer order x is placed by customer y."
image::images/order-customer-relationship.png[title="A one-to-many relationship is defined between the customer and order objects"]
You can click and drag tables on the canvas into whatever position makes the most sense for your model. In the image above, the `order` table has been moved to the left of `customer`.
@@ -355,16 +362,26 @@
Recall that an _identifying relationship_ means that the child cannot be uniquely identified without the parent. Identifying relationships are indicated on the Workbench canvas by a solid line linking two tables. Here, the `customer_order_has_product` table forms an identifying relationship with its two parent tables, `customer_order` and `product`. A record contained in the `customer_order_has_product` table requires references from both tables in order to exist.
-3. Arrange the tables according to the following image. The _many-to-many_ relationship is highlighted below.
+
+[start=3]
+. Arrange the tables according to the following image. The _many-to-many_ relationship is highlighted below.
image::images/many-to-many-order-product.png[title="The 'customer_order_has_product' table contains two foreign keys to the order and product tables"]
The new `customer_order_has_product` table contains two foreign keys, `fk_customer_order_has_product_customer_order` and `fk_customer_order_has_product_product`, which reference the primary keys of the `customer_order` and `product` tables, respectively. These two foreign keys form a composite primary key for the `customer_order_has_product` table.
-4. Change the name of the new `customer_order_has_product` table to '`ordered_product`'. Double-click the `customer_order_has_product` table to open the Table editor. Enter `ordered_product` into the Name field.
-5. Rename the foreign key indexes to correspond to the new table name. In the `ordered_product`'s Table editor, click the Foreign Keys tab. Then, click into both foreign key entries and replace '`customer_order_has_product`' with '`ordered_product`'. When you finish, the two entries should read:
+
+[start=4]
+. Change the name of the new `customer_order_has_product` table to '`ordered_product`'. Double-click the `customer_order_has_product` table to open the Table editor. Enter `ordered_product` into the Name field.
+
+[start=5]
+. Rename the foreign key indexes to correspond to the new table name. In the `ordered_product`'s Table editor, click the Foreign Keys tab. Then, click into both foreign key entries and replace '`customer_order_has_product`' with '`ordered_product`'. When you finish, the two entries should read:
* `fk_*ordered_product*_customer_order`
* `fk_*ordered_product*_product`
image::images/ordered-product-foreign-key.png[title="Rename the foreign key indexes under the Foreign Keys tab in the Table editor"]
-6. Double-click the lines between the two objects and delete the default captions in the Relationship editor.
-7. Create a `quantity` column in the `ordered_product` table. To do so, click the Columns tab in the `ordered_product`'s Table editor. Enter the following details.
+
+[start=6]
+. Double-click the lines between the two objects and delete the default captions in the Relationship editor.
+
+[start=7]
+. Create a `quantity` column in the `ordered_product` table. To do so, click the Columns tab in the `ordered_product`'s Table editor. Enter the following details.
|===
|Column |Datatype |NN (Not Null) |UN (Unsigned) |Default
@@ -391,13 +408,23 @@
1. Set the default storage engine used in Workbench to InnoDB. Choose Tools > Options (MySQLWorkbench > Preferences on Mac) to open the Workbench Preferences window. Click the MySQL tab, then select InnoDB as the default storage engine.
image::images/inno-db.png[title="Set the default storage engine to InnoDB"]
The link:http://www.innodb.com/[+InnoDB+] engine provides foreign key support, which is utilized in this tutorial.
-2. Click OK to exit the Preferences window.
-3. Choose Database > Forward Engineer from the main menu.
-4. In the first panel of the Forward Engineer to Database wizard, select '`DROP Objects Before Each CREATE Object`', and '`Generate DROP SCHEMA`'.
+
+[start=2]
+. Click OK to exit the Preferences window.
+
+[start=3]
+. Choose Database > Forward Engineer from the main menu.
+
+[start=4]
+. In the first panel of the Forward Engineer to Database wizard, select '`DROP Objects Before Each CREATE Object`', and '`Generate DROP SCHEMA`'.
image::images/forward-engineer-wzd.png[title="Enable DROP options to be generated in the SQL script"]
These `DROP` options are convenient for prototyping - if you need to make changes to the schema or schema tables, the script will first delete (i.e., _drop_) these items before recreating them. (If you attempt to create items on the MySQL server that already exist, the server will flag an error.)
-5. Click Continue. In Select Objects to Forward Engineer panel, note that the Export MySQL Table Objects option is selected by default. Click the Show Filter button and note that all five tables in the `affablebean` schema are included.
-6. Click Continue. In the Review SQL Script panel, you can examine the SQL script that has been generated based on the data model. Optionally, click Save to File to save the script to a location on your computer.
+
+[start=5]
+. Click Continue. In Select Objects to Forward Engineer panel, note that the Export MySQL Table Objects option is selected by default. Click the Show Filter button and note that all five tables in the `affablebean` schema are included.
+
+[start=6]
+. Click Continue. In the Review SQL Script panel, you can examine the SQL script that has been generated based on the data model. Optionally, click Save to File to save the script to a location on your computer.
*Note:* In examining the script, you may notice that the following variables are set at the top of the file:
@@ -412,14 +439,20 @@
For an explanation of what these variables are, and their purpose in the script, see the official Workbench manual: link:http://dev.mysql.com/doc/workbench/en/workbench-faq.html[+Chapter 11. MySQL Workbench FAQ+].
-7. Click Continue. In the Connection Options panel, set the parameters for connecting to the running MySQL server.
+
+[start=7]
+. Click Continue. In the Connection Options panel, set the parameters for connecting to the running MySQL server.
* *Hostname:* `127.0.0.1` (_or `localhost`_)
* *Port:* `3306`
* *Username:* `root`
* *Password:* `nbuser`
(The parameters you set should correspond to those from link:setup-dev-environ.html#communicate[+Setting up the Development Environment: Communicating with the Database Server+].)
-8. Click Execute. In the final panel of the wizard, you receive confirmation that the wizard was able to connect to and execute the script successfully.
-9. Click Close to exit the wizard.
+
+[start=8]
+. Click Execute. In the final panel of the wizard, you receive confirmation that the wizard was able to connect to and execute the script successfully.
+
+[start=9]
+. Click Close to exit the wizard.
The `affablebean` schema is now created and exists on your MySQL server. In the next step, you connect to the schema, or _database_, from the IDE. At this stage you may ask, "What's the difference between a schema and a database?" In fact, the MySQL command `CREATE SCHEMA` is a synonym for `CREATE DATABASE`. (See link:http://dev.mysql.com/doc/refman/5.1/en/create-database.html[+12.1.10. CREATE DATABASE Syntax+].) Think of a schema as a blueprint that defines the contents of the database, including tables, relationships, views, etc. A database implements the schema by containing data in a way that adheres to the structure of the schema. This is similar to the object-oriented world of Java classes and objects. A class defines an object. When a program runs however, objects (i.e., class instances) are created, managed, and eventually destroyed as the program runs its course.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model_ja.asciidoc
index 749b042..0c41c14 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/data-model_ja.asciidoc
@@ -30,30 +30,6 @@
:keywords: Apache NetBeans, Tutorials, NetBeans Eコマースのチュートリアル-データモデルの設計
-==== チュートリアルの内容
-
-1. link:intro_ja.html[+はじめに+]
-2. link:design_ja.html[+アプリケーションの設計+]
-3. link:setup-dev-environ_ja.html[+開発環境の設定+]
-4. *データモデルの設計*
-
-* <<idEntities,データモデルのエンティティを識別する>>
-* <<createERDiagram,ER(エンティティ関係)図を作成する>>
-* <<forwardEngineer,データベースの Forward-Engineering>>
-* <<connectDB,IDE からデータベースへ接続する>>
-* <<seeAlso,参照>>
-5. link:page-views-controller_ja.html[+ページ ビュー と コントローラサーブレットの準備+]
-6. link:connect-db_ja.html[+データベースへのアプリケーションの接続+]
-7. link:entity-session_ja.html[+エンティティクラスとセッションBeans の追加+]
-8. link:manage-sessions_ja.html[+セッションの管理+]
-9. link:transaction_ja.html[+トランザクション ビジネスロジックの統合+]
-10. link:language_ja.html[+言語サポートの追加+]
-11. link:security.html[+アプリケーションの保護+]
-12. link:test-profile.html[+アプリケーションの負荷テスト+]
-13. link:conclusion_ja.html[+まとめ+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
この単元では、データモデリング、またはストレージシステムの概念モデルを作成する手順に焦点を当てています。そして、システムが必要とするエンティティとお互いの関係も識別し定義します。 データモデルには、すべての論理的および物理的な設計パラメータが含まれています。設計パラメータは、データ定義言語(DDL)がデータベースを作成するためのスクリプトを生成するのに必要とされます。^<<footnote1,[1]>>^
この単元では、主に link:http://wb.mysql.com/[+MySQL Workbench+] で仕事をします。ワークベンチは、データモデル、リバースエンジニア SQL スクリプトなどをビジュアルに作成するためのグラフィカルツールです。データモデルをforward-engineer(前方エンジニア)してデータベース構造の中に取り込み、動作中のMySQLデータベースサーバーとモデルとを同期します。
@@ -162,7 +138,9 @@
image::images/workbench.png[role="left", link="images/workbench.png"]
--
-2. 新しいスキーマ用に次の設定を入力します:
+
+[start=2]
+. 新しいスキーマ用に次の設定を入力します:
* *scheme: * `affablebean`
* *Default Collation:* `utf8 - utf8_unicode_ci`
@@ -190,14 +168,20 @@
image::images/workbench-empty-canvas.png[role="left", link="images/workbench-empty-canvas.png"]
--
-2. 左余白にある New Table(新しいテーブル)(image::images/wb-new-table-icon.png[] )アイコンをクリック。キャンバス上にマウスを移動し再度クリックします。キャンバス上に新しいテーブルが表示されます。
+
+[start=2]
+. 左余白にある New Table(新しいテーブル)(image::images/wb-new-table-icon.png[] )アイコンをクリック。キャンバス上にマウスを移動し再度クリックします。キャンバス上に新しいテーブルが表示されます。
image::images/wb-new-entity-table.png[title="Click the New Table icon to drag empty tables (entities) onto the canvas"]
-3. テーブルをダブルクリック。テーブルエディタが画面の下の方に開き、テーブルの設定を作成することができます。
+
+[start=3]
+. テーブルをダブルクリック。テーブルエディタが画面の下の方に開き、テーブルの設定を作成することができます。
*注:*「テーブル」と「エンティティ」という用語は、この単元ではほぼ同義語です。データベーススキーマの観点からすると、「テーブルを作成している」となります。データモデリングの観点からすると、「エンティティを作成している」ということなります。同様に、後の節で、エンティティ_プロパティ_に相当する各テーブルを作成します。
-4. テーブルエディタで、テーブルをユースケースから識別した一つ一つの名詞にリネームします。必要に応じてテーブルの目的をコメントに記載します。例:
+
+[start=4]
+. テーブルエディタで、テーブルをユースケースから識別した一つ一つの名詞にリネームします。必要に応じてテーブルの目的をコメントに記載します。例:
* *Name:* `customer`
* *Engine:* `InnoDB`
@@ -211,12 +195,16 @@
link:http://www.innodb.com/[+InnoDB+] エンジンは、このチュートリアルで利用する外部キーをサポートしています。後の節で、<<forwardEngineer,データベースのフォワードエンジニアリング>>を使うので、デフォルトのストレージエンジンをInnoDBに設定します(Workbenchを使って)。
-5. ワークベンチの左側にある*Catalog* タブの下(バージョン5.1の場合は右側)で、`affablebean` > `Tables` と展開します。*customer* テーブルが現れます。
+
+[start=5]
+. ワークベンチの左側にある*Catalog* タブの下(バージョン5.1の場合は右側)で、`affablebean` > `Tables` と展開します。*customer* テーブルが現れます。
image::images/wb-catalog-tab.png[title="Catalog tab automatically refreshes to display any changes to the schema"]
さらに重要なことに注意して下さい。新しい `customer` テーブルには、今、 `affablebean` スキーマが含まれています。新しく EER 図を作成した時に `affablebean` スキーマを選択したので、EER 図を変更したときはいつでも自動的にスキーマがバインドされます。
-6. <<nounList,上記のユースケースで識別した名詞>>の残り毎に、手順2から4を繰り返しキャンバスにテーブルを追加してください。しかしながら、テーブルに名前を付ける前に、考慮すべき重要な事があります。特定のキーワードは、MySQL サーバで使われる SQL 方言にとって特別な意味を持つことがあります。残念ながら、「`order`」はそのうちの1つです。 (「`order`」は、MySQL で「 `ORDER BY` 」ステートメントで使用されます)。したがって、「 `order` 」の代わりに「`customer_order`」という名前を付けます。この段階では、キャンバス上へのテーブル配置の順番はありません。
+
+[start=6]
+. <<nounList,上記のユースケースで識別した名詞>>の残り毎に、手順2から4を繰り返しキャンバスにテーブルを追加してください。しかしながら、テーブルに名前を付ける前に、考慮すべき重要な事があります。特定のキーワードは、MySQL サーバで使われる SQL 方言にとって特別な意味を持つことがあります。残念ながら、「`order`」はそのうちの1つです。 (「`order`」は、MySQL で「 `ORDER BY` 」ステートメントで使用されます)。したがって、「 `order` 」の代わりに「`customer_order`」という名前を付けます。この段階では、キャンバス上へのテーブル配置の順番はありません。
MySQLサーバーで使用される予約語のリストについては、公式マニュアルを参照してください: link:http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-1.html[+2.2. MySQL 5.1 での予約語+]
@@ -238,7 +226,9 @@
1. `customer` テーブル見出しをダブルクリックします。Workbench のテーブルエディターが立ち上がります。
-2. テーブルエディタで、Columnsタブをクリックします。表示されたテーブル内をクリックして、最初の列を編集します。以下を入力してください:
+
+[start=2]
+. テーブルエディタで、Columnsタブをクリックします。表示されたテーブル内をクリックして、最初の列を編集します。以下を入力してください:
|===
|Column |Datatype |PK (Primary Key) |NN (Not Null) |UN (Unsigned) |AI (Autoincrement)
@@ -248,7 +238,9 @@
image::images/customer-id-column.png[title="Click to edit table columns in the Table editor"]
-3. 引き続き、`customer` テーブルで作業し、以下の `VARCHAR` 列を追加します。これらの列は見ればすぐわかるようにしておくべきです。 Affable Bean ビジネスが顧客の注文を処理し、お客様のアドレスに食料品の出荷を送信するためにキャプチャされる必要があるデータを表しています。
+
+[start=3]
+. 引き続き、`customer` テーブルで作業し、以下の `VARCHAR` 列を追加します。これらの列は見ればすぐわかるようにしておくべきです。 Affable Bean ビジネスが顧客の注文を処理し、お客様のアドレスに食料品の出荷を送信するためにキャプチャされる必要があるデータを表しています。
|===
|Column |Datatype |NN (Not Null)
@@ -270,13 +262,17 @@
image::images/customer-varchar-columns.png[title="Edit inline to add columns to customer table"]
-4. キャンバス上で選択した `customer` テーブルで、「Arrange」>「Reset Object Size」を選び、テーブルのサイズを変更します。そうすれば、キャンバス上ですべての列が見えるようなります。インデックス行をクリックして、任意のテーブルのインデックスも表示されるようにします。(これには主キーと外部キーも含まれます。テーブル間のリレーションシップの作成をする場合に便利です。後の方で演習します)。
+
+[start=4]
+. キャンバス上で選択した `customer` テーブルで、「Arrange」>「Reset Object Size」を選び、テーブルのサイズを変更します。そうすれば、キャンバス上ですべての列が見えるようなります。インデックス行をクリックして、任意のテーブルのインデックスも表示されるようにします。(これには主キーと外部キーも含まれます。テーブル間のリレーションシップの作成をする場合に便利です。後の方で演習します)。
終了時に、`customer` エンティティ(実態)は次のように見えます。
image::images/customer-table.png[title="'customer' table on EER canvas displays columns"]
-5. 上記の手順に従って、残りのテーブル列を作成します。
+
+[start=5]
+. 上記の手順に従って、残りのテーブル列を作成します。
==== categoryカテゴリ
@@ -356,7 +352,9 @@
1. 左余白で、「1:n Non-Identifying Relationship(1:n 非依存関係)」( image::images/one-many-btn.png[] )ボタンをクリックします。これにより、 _one-to-many 1対多_の関係を作成することができます。
-2. `product` テーブルをクリックし、`category` テーブルをクリックします。最初にクリックしたテーブルに2番目のテーブルを参照するための外部キーが入ります。ここでは、categoryを参照することができる(`category` への参照が入った)`product` テーブルが欲しいのです。下の画像を参照してください。新しい列 `category_id` が `product` テーブルに追加されています。外部キーのインデックスつまり `fk_product_category` がテーブルのインデックスに追加されています。
+
+[start=2]
+. `product` テーブルをクリックし、`category` テーブルをクリックします。最初にクリックしたテーブルに2番目のテーブルを参照するための外部キーが入ります。ここでは、categoryを参照することができる(`category` への参照が入った)`product` テーブルが欲しいのです。下の画像を参照してください。新しい列 `category_id` が `product` テーブルに追加されています。外部キーのインデックスつまり `fk_product_category` がテーブルのインデックスに追加されています。
image::images/product-category-relationship.png[title="A one-to-many relationship is defined between the category and product objects"]
@@ -364,11 +362,17 @@
[tips]#このチュートリアルのエンティティ関係図では、link:http://en.wikipedia.org/wiki/Entity-relationship_model#Crow.27s_Foot_Notation[+Crow's Foot クローの足+] 表記を使用しています。Workbenchで、「モデル」>「関係表記」を選択すれば表記法を変更することができます。 #
-3. relationship 関係をダブルクリック(すなわち、2つのエンティティ間の破線クリックします)。 Relationship editor関係エディタが、画面の下部領域に表示されます。
-4. 既定の見出しを`belongs to`に変更します 。言い換えれば、 「製品xは、カテゴリーyに属している」ということです。 注意してください。これは_unidirectional_ 一方向関係です。: `product` 製品オブジェクトは自分が属するカテゴリへの参照を持っているが、関連づけられた`category` カテゴリーオブジェクトは自分のカテゴリに入っている製品への参照を全く持っていないのです。
+[start=3]
+. relationship 関係をダブルクリック(すなわち、2つのエンティティ間の破線クリックします)。 Relationship editor関係エディタが、画面の下部領域に表示されます。
-5. リレーションシップエディタで外部キータブをクリックします。次の表示を見てください。
+
+[start=4]
+. 既定の見出しを`belongs to`に変更します 。言い換えれば、 「製品xは、カテゴリーyに属している」ということです。 注意してください。これは_unidirectional_ 一方向関係です。: `product` 製品オブジェクトは自分が属するカテゴリへの参照を持っているが、関連づけられた`category` カテゴリーオブジェクトは自分のカテゴリに入っている製品への参照を全く持っていないのです。
+
+
+[start=5]
+. リレーションシップエディタで外部キータブをクリックします。次の表示を見てください。
image::images/foreign-key-tab.png[title="Use the Foreign Key tab to modify a relationship's ordinality and cardinality"]
@@ -386,11 +390,17 @@
訳者注。1:n の Identifying Relationship(特定関係) とは、1つのビルと複数の部屋の関係。部屋はビルの中にあるので、ビルなしには部屋は成り立たない。依存しているといってもいいかも。
1:n の Non-Identifying Relationship(非特定関係) とは、1つのレンタルDVDと複数のレンタルユーザーの関係。ユーザーは別にDVDに依存しているわけではないが、1:nの関係は成り立つ。
-6. 1:n Non-Identifying Relationship(1:n の非識別関係) ( image::images/one-many-btn.png[] )ボタンをクリックします。次の手順で、 `customer` と `customer_order` オブジェクトの間に_one-to-many_ 1対多 の関係を作成します。
-7. 最初に `order` テーブル(このテーブルには外部キーが入っています)をクリックします。次に `customer` テーブルをクリックします。これで、この2つの間に関係が作られます。
+[start=6]
+. 1:n Non-Identifying Relationship(1:n の非識別関係) ( image::images/one-many-btn.png[] )ボタンをクリックします。次の手順で、 `customer` と `customer_order` オブジェクトの間に_one-to-many_ 1対多 の関係を作成します。
-8. 2つのテーブル間のリンクをクリックすると、関係エディタで表示されるが、既定のキャプションを「`is placed by`配置される」に変更する 。関係は、今、「顧客注文×は 顧客yに配置される」と読めます。
+
+[start=7]
+. 最初に `order` テーブル(このテーブルには外部キーが入っています)をクリックします。次に `customer` テーブルをクリックします。これで、この2つの間に関係が作られます。
+
+
+[start=8]
+. 2つのテーブル間のリンクをクリックすると、関係エディタで表示されるが、既定のキャプションを「`is placed by`配置される」に変更する 。関係は、今、「顧客注文×は 顧客yに配置される」と読めます。
image::images/order-customer-relationship.png[title="A one-to-many relationship is defined between the customer and order objects"]
@@ -410,27 +420,39 @@
1. 左余白で、[n:m Identifying Relationship( n:m 関係の特定)](image::images/many-many-btn.png[] )ボタンを押します。これにより、あなたは _many-to-many_ 多対多 の関係を作成することができます 。
-2. `customer_order` テーブルをクリックし、 `product` テーブルをクリック。新しいテーブルが現れるので、`customer_order_has_product` と名前をつけます。
+
+[start=2]
+. `customer_order` テーブルをクリックし、 `product` テーブルをクリック。新しいテーブルが現れるので、`customer_order_has_product` と名前をつけます。
「 _identifying relationship_(関係を特定する) 」を思い出して下さい、つまり、子供は親なしに一意に識別することはできないということです。特定関係の場合は、Workbench キャンバス上の2つのテーブル間のリンクが実線で表示されます。ここでは、 `customer_order_has_product` テーブルは、2つの親テーブル(`customer_order` と `product`)と特定の関係を作ります。`customer_order_has_product` テーブルに含まれているレコードは 、それが存在するために、両方のテーブルからの参照を必要とします。
-3. 下図にしたがってテーブルをアレンジします。 _many-to-many_ 多対多 の関係は以下で強調表示されています。
+
+[start=3]
+. 下図にしたがってテーブルをアレンジします。 _many-to-many_ 多対多 の関係は以下で強調表示されています。
image::images/many-to-many-order-product.png[title="The 'customer_order_has_product' table contains two foreign keys to the order and product tables"]
新しい `customer_order_has_product` テーブルには、2つの外部キーが含まれています。 `fk_customer_order_has_product_customer_order` と `fk_customer_order_has_product_product` です。それぞれ `customer_order` と `product` テーブルの主キーを参照しています。これら2つの外部キーは、`customer_order_has_product` テーブルの複合主キーを形成します。
-4. 新しい `customer_order_has_product` テーブルの名前を、'`ordered_product`' に変更します。`customer_order_has_product` テーブルをダブルクリックし、テーブルエディタを開きます。[名前]フィールドに `ordered_product` と入力してください。
-5. 外部キーのインデックスを新しいテーブル名に対応した名前に変更します。「 `ordered_product`」テーブルエディターで、「Foreign Keys 外部キー」タブをクリックします。次に、両方の外部キーのエントリをクリックして、「`customer_order_has_product`」を「`ordered_product`」に変更します。完了したとき、2つのエントリを読んでください:
+[start=4]
+. 新しい `customer_order_has_product` テーブルの名前を、'`ordered_product`' に変更します。`customer_order_has_product` テーブルをダブルクリックし、テーブルエディタを開きます。[名前]フィールドに `ordered_product` と入力してください。
+
+
+[start=5]
+. 外部キーのインデックスを新しいテーブル名に対応した名前に変更します。「 `ordered_product`」テーブルエディターで、「Foreign Keys 外部キー」タブをクリックします。次に、両方の外部キーのエントリをクリックして、「`customer_order_has_product`」を「`ordered_product`」に変更します。完了したとき、2つのエントリを読んでください:
* `fk_*ordered_product*_customer_order`
* `fk_*ordered_product*_product`
image::images/ordered-product-foreign-key.png[title="Rename the foreign key indexes under the Foreign Keys tab in the Table editor"]
-6. 2つのオブジェクトの関の行をダブルクリックします。Relationship editor(関係エディタ)で既定のcaptions(見出し)を削除します。
-7. `ordered_product` テーブルに、`quantity` 列を作成します。これを行うには、「`ordered_product`」 テーブルエディタの [Columns] タブをクリックし、以下の情報を入力します。
+[start=6]
+. 2つのオブジェクトの関の行をダブルクリックします。Relationship editor(関係エディタ)で既定のcaptions(見出し)を削除します。
+
+
+[start=7]
+. `ordered_product` テーブルに、`quantity` 列を作成します。これを行うには、「`ordered_product`」 テーブルエディタの [Columns] タブをクリックし、以下の情報を入力します。
|===
|Column |Datatype |NN (Not Null) |UN (Unsigned) |Default
@@ -461,19 +483,29 @@
link:http://www.innodb.com/[+InnoDB+] エンジンは、このチュートリアルで利用されている foreign key (外部キー) をサポートしています。
-2. 「OK」をクリックしてPreferences (設定)ウィンドウを終了します。
-3. メインメニューから、Database > Forward Engineer を選択します。
+[start=2]
+. 「OK」をクリックしてPreferences (設定)ウィンドウを終了します。
-4. [Forward Engineer to Database」ウィザードの最初のパネルで、「`DROP Objects Before Each CREATE Object`」と「 `Generate DROP SCHEMA` 」を選択します。
+
+[start=3]
+. メインメニューから、Database > Forward Engineer を選択します。
+
+
+[start=4]
+. [Forward Engineer to Database」ウィザードの最初のパネルで、「`DROP Objects Before Each CREATE Object`」と「 `Generate DROP SCHEMA` 」を選択します。
image::images/forward-engineer-wzd.png[title="Enable DROP options to be generated in the SQL script"]
これらの `DROP` オプションは、プロトタイプには便利なものです。もしあなたが、スキーマまたはスキーマテーブルを変更したい場合には、スクリプトは、それらを再作成する前に、最初にこれらの item を削除します(つまり、_drop_)。 (もし、既にMySQLサーバーにある item を作成しようとすると、サーバーはエラーフラグを立てます。
-5. 「Continue 次へ」をクリックします。Forward Engineer パネルの「 Select Objects」で「Export MySQL Table Objects」オプションがデフォルトで設定されていることに注意します。「 Show Filter 」ボタンをクリックします。 `affablebean`スキーマの中に5つのテーブル全てが含まれていることに注意してください。
-6. 「Continue 次へ」 をクリックします。「 Review SQL Script 」パネルで、データモデルに基づいて生成された SQL スクリプトを調べることができます。必要に応じて、「 Save to File 」をクリックして、コンピュータにスクリプトを保存します。
+[start=5]
+. 「Continue 次へ」をクリックします。Forward Engineer パネルの「 Select Objects」で「Export MySQL Table Objects」オプションがデフォルトで設定されていることに注意します。「 Show Filter 」ボタンをクリックします。 `affablebean`スキーマの中に5つのテーブル全てが含まれていることに注意してください。
+
+
+[start=6]
+. 「Continue 次へ」 をクリックします。「 Review SQL Script 」パネルで、データモデルに基づいて生成された SQL スクリプトを調べることができます。必要に応じて、「 Save to File 」をクリックして、コンピュータにスクリプトを保存します。
*注:* スクリプトを調べるには、ファイルの先頭に次の変数を設定する必要があります:
@@ -488,7 +520,9 @@
「これらの変数は何?」そして「スクリプトの中での目的は何か?」の説明については、公式の Workbench マニュアルを参照してください: link:http://dev.mysql.com/doc/workbench/en/workbench-faq.html[+第11章。 MySQL Workbench FAQ+]。
-7. 「 Continue 」をクリックします。「 Connection Options 」パネルで、実行中のMySQLサーバに接続するためのパラメータを設定します。
+
+[start=7]
+. 「 Continue 」をクリックします。「 Connection Options 」パネルで、実行中のMySQLサーバに接続するためのパラメータを設定します。
* *Hostname:* `127.0.0.1` (_or `localhost`_)
@@ -500,9 +534,13 @@
(これから設定するパラメータは、以下の形式に対応しています。 link:setup-dev-environ.html#communicate[+開発環境の設定:データベースサーバーとの接続+])。
-8. 「 Execute 」をクリック。ウィザードの最後のパネルで、「the wizard was able to connect to and execute the script successfully ウィザードは正常にスクリプトを実行し、接続することができた。」という確認を受けとります。
-9. 「 Close 閉じる」をクリックして、ウィザードを終了します。
+[start=8]
+. 「 Execute 」をクリック。ウィザードの最後のパネルで、「the wizard was able to connect to and execute the script successfully ウィザードは正常にスクリプトを実行し、接続することができた。」という確認を受けとります。
+
+
+[start=9]
+. 「 Close 閉じる」をクリックして、ウィザードを終了します。
今、`affablebean` スキーマが作成され、スキーマはMySQLサーバ上にあります。次のステップでは、 IDEから、スキーマに接続、または_ データベース_へ接続します。この段階で、「スキーマとデータベースの違いは何?」と疑問を抱くかもしれません。実際に、 MySQLコマンド「 `CREATE SCHEMA` 」と「`CREATE DATABASE`」は同義語です。(link:http://dev.mysql.com/doc/refman/5.1/en/create-database.html[+12.1.10. CREATE DATABASE 構文+]を参照してください )。
スキーマをデータベースの内容を定義する設計図だと考えてください。データベースの内容には、テーブル、リレーションシップ、ビューなどがあります。データベースはスキーマ構造に合わせた方法でデータを格納します。これは、Javaクラスやオブジェクトのオブジェクト指向の世界に似ています。クラスはオブジェクトを定義します。しかしプログラムが走るとオブジェクト(つまり、クラスのインスタンス)が作成され、管理され、最後には、プログラムが破棄を実行してオブジェクトは破棄されます。
@@ -518,11 +556,17 @@
1. IDE で、「 Services サービス」ウィンドウを開き( Ctrl-5 。⌘-5 Macの場合)、データベース接続ノード(image::images/db-connection-node.png[] )へマウスを置きます。link:setup-dev-environ.html#communicate[+前の単元+]で作成した `affablebean` データベースインスタンスの場所です。
-2. `affablebean` データベースへの接続をリフレッシュします。そのために、接続ノードを右クリックし Refresh リフレッシュを選択します。
-3. 任意のテーブルノードを展開します。現在、スキーマで定義済みの5つのテーブルを見ることができます。
+[start=2]
+. `affablebean` データベースへの接続をリフレッシュします。そのために、接続ノードを右クリックし Refresh リフレッシュを選択します。
-4. 任意のテーブルノードを展開します。各テーブルには MySQL ワークベンチの作業で作成した列とインデックスがそこに含まれています。
+
+[start=3]
+. 任意のテーブルノードを展開します。現在、スキーマで定義済みの5つのテーブルを見ることができます。
+
+
+[start=4]
+. 任意のテーブルノードを展開します。各テーブルには MySQL ワークベンチの作業で作成した列とインデックスがそこに含まれています。
image::images/services-window-schema.png[title="Update the database connection to view schema tables"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design.asciidoc
index 3d87cc6..c12e266 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design.asciidoc
@@ -30,30 +30,6 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Designing the Application
-==== Tutorial Contents
-
-1. link:intro.html[+Introduction+]
-2. *Designing the Application*
-* <<scenario,The Scenario>>
-* <<requirements,Gathering Customer Requirements>>
-* <<mockups,Preparing Mockups>>
-* <<architecture,Determining the Architecture>>
-* <<planning,Planning the Project>>
-* <<seeAlso,See Also>>
-3. link:setup-dev-environ.html[+Setting up the Development Environment+]
-4. link:data-model.html[+Designing the Data Model+]
-5. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
-6. link:connect-db.html[+Connecting the Application to the Database+]
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
The application that you design in this tutorial is based on a real-world scenario. After being introduced to the tutorial scenario, you consolidate a high-level list of customer requirements. You then prepare a diagram of the application's business process flow, and a series of _mockups_ which help both you and your customer get a clearer picture of how the final application will look to an end-user. Finally, you break down the customer requirements into a set of implementation tasks, and structure your application so that the responsibilities and interactions among functional components are clearly defined.
This tutorial unit discusses the MVC (Model-View-Controller) design pattern. After investigating the benefits that this pattern offers, you set about mapping JSP, Servlet, and other technologies to the MVC architecture, and draft a diagram that illustrates the components of the application in terms of MVC.
@@ -73,7 +49,7 @@
This tutorial is based on the following scenario. Although this is a fictitious scenario, it demonstrates how the software you are about to develop can be applied to real-world business needs. It also serves as a platform from which you can derive customer requirements. Customer requirements should be established as clearly as possible before any design or implementation begins.
-==== The Scenario
+=== The Scenario
A small grocery store, the Affable Bean, collaborates with several local farms to supply a community with organic produce and foods. Due to a long-standing customer base and increasing affluence to the area, the store has decided to investigate the possibility of providing an online delivery service to customers. A recent survey has indicated that 90% of its regular clientele has continuous Internet access, and 65% percent would be interested in using this service.
@@ -98,9 +74,15 @@
* update item quantities in the shopping cart.
* view a summary of all items and quantities in the shopping cart.
* place an order and make payment through a secure checkout process.
-3. An administration console, enabling staff to view customer orders.
-4. Security, in the form of protecting sensitive customer data while it is transferred over the Internet, and preventing unauthorized access to the administration console.
-5. Language support for both English and Czech. (Website only)
+
+[start=3]
+. An administration console, enabling staff to view customer orders.
+
+[start=4]
+. Security, in the form of protecting sensitive customer data while it is transferred over the Internet, and preventing unauthorized access to the administration console.
+
+[start=5]
+. Language support for both English and Czech. (Website only)
The company staff are able to provide you with product and category images, descriptions and price details, as well as any website graphics that are to be used. The staff are also able to provide all text and language translations for the website.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design_ja.asciidoc
index 92fb500..c3c457e 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/design_ja.asciidoc
@@ -30,30 +30,6 @@
:keywords: Apache NetBeans, Tutorials, NetBeans E-commerce チュートリアル-アプリケーションの設計
-==== 内容
-
-1. link:intro_ja.html[+はじめに+]
-2. *アプリケーションの設計*
-* <<scenario,シナリオ>>
-* <<requirements,お客様の要件を収集する>>
-* <<mockups,モックアップを準備する>>
-* <<architecture,アーキテクチャを決定する>>
-* <<planning,プロジェクトを計画する>>
-* <<seeAlso,関連参照>>
-3. link:setup-dev-environ_ja.html[+開発環境の設定+]
-4. link:data-model_ja.html[+データモデルの設計+]
-5. link:page-views-controller_ja.html[+ページビューとコントローラサーブレットの準備+]
-6. link:connect-db_ja.html[+データベースへのアプリケーションの接続+]
-7. link:entity-session_ja.html[+エンティティクラスとセッション Bean の追加+]
-8. link:manage-sessions_ja.html[+セッションの管理+]
-9. link:transaction_ja.html[+トランザクションビジネスロジックの統合+]
-10. link:language_ja.html[+言語サポートの追加+]
-11. link:security.html[+アプリケーションの保護+]
-12. link:test-profile.html[+アプリケーションの負荷テスト+]
-13. link:conclusion_ja.html[+まとめ+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
このチュートリアルであなたが設計するアプリケーションは、実世界のシナリオに基づいています。チュートリアルのシナリオを紹介した後で、顧客の要件の高レベルのリストを整備します。その後、アプリケーションのビジネスプロセスのフロー図を準備します。あなたとあなたの顧客の両方に役立つ一連の_モックアップ_ を準備します。モックアップは最終的なアプリケーションがエンドユーザーにどう見えるかを画像にして明確にします。最後に、顧客の要件をブレークダウンして、一連の実装タスクのセットに落とし込み、アプリケーションを構造化して、機能コンポーネント間の職責と相互関係を明確に定義します。
この単元では、MVC (モデル- ビュー - コントローラ)デザインパターンについて説明します。このパターンが提供している利点を調査した後、あなたは JSP マッピング、サーブレットについて設定し、および他の技術を MVC アーキテクチャに設定します。そして、 アプリケーションのコンポーネントをMVCの観点から見た図を作成します。
@@ -73,7 +49,7 @@
このチュートリアルは、次のシナリオに基づいています。これは架空のシナリオですが、あなたがまさに開発しようとしているソフトウエアを実際のビジネスニーズに適用する方法を示しています。また同時に顧客の要件を引き出すことができるプラットフォームとして役に立ちます。お客様の要件は可能な限り明確にされるべきです。またすべての設計や実装を始める前に確立される必要があります。
-==== シナリオ
+=== シナリオ
小さな食料品店、Affable Bean(気さくな豆)は、いくつかの地元の農場と提携して、有機農産物、食品を地域社会に提供しています。長年の顧客基盤により、地域に対して豊かさ(地域での売り上げ)が増加しています。食料品店は顧客にオンライン配達サービスを提供する可能性を検討することにしました。最近の調査では、常連の 90% は継続的なインターネットアクセスを持っており、65% がこのサービスを利用することに興味があることがわかりました。
@@ -93,7 +69,9 @@
1. 実際の店舗で販売されている製品のオンラインでの表現。 4つのカテゴリ(乳製品、肉、パン、フルーツ&ベジタブル)があります。各カテゴリーには4つの製品があり、オンライン買い物客はそれを閲覧できます。各製品の詳細(すなわち、名前、画像、説明、価格)を提供します。
-2. ショッピングカート機能は、以下のことができること:
+
+[start=2]
+. ショッピングカート機能は、以下のことができること:
* 仮想ショッピングカートにアイテムを追加する。
@@ -105,11 +83,17 @@
* 安全な決済処理を通して、注文と支払いをする。
-3. 管理コンソール、スタッフが顧客の注文を表示することができる。
-4. セキュリティ。インターネット上で転送される重要な顧客データを保護でき、管理コンソールへの不正アクセスを防止する。
+[start=3]
+. 管理コンソール、スタッフが顧客の注文を表示することができる。
-5. 英語とチェコ言のサポート。(ウェブサイトのみ)
+
+[start=4]
+. セキュリティ。インターネット上で転送される重要な顧客データを保護でき、管理コンソールへの不正アクセスを防止する。
+
+
+[start=5]
+. 英語とチェコ言のサポート。(ウェブサイトのみ)
会社のスタッフは、製品とカテゴリの画像、説明と価格の詳細を提供することができるだけでなく、使用される任意のWebサイトのグラフィックも提供することができる。スタッフはまたウェブサイトのすべてのテキストと、言語の翻訳を提供することができる。
@@ -523,6 +507,8 @@
1. <<1,^>> より広範な一覧についてはこれを参照してください。
link:http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier3.html#1097966[+J2EE プラットフォームでのエンタープライズアプリケーションの設計 4.2.6.8章 :スクリプトレットを避けるためのカスタムタグの使い方+]。
-2. <<2,^>> MVC パターンについてのより詳細な情報についてはこれを参照してください。
+
+[start=2]
+. <<2,^>> MVC パターンについてのより詳細な情報についてはこれを参照してください。
link:http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch2.html#1105854[+J2EE プラットフォームでのエンタープライズアプリケーションの設計 11.1.1章:モデル-ビュー-コントローラのアーキテクチャ+]。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session.asciidoc
index 0f9732e..d9d68dd 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Adding Entity Classes and Session Beans
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -46,12 +46,24 @@
* <<addSession,Adding Session Beans>>
* <<access,Accessing Data with EJBs>>
* <<seeAlso,See Also>>
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=8]
+. link:manage-sessions.html[+Managing Sessions+]
+
+[start=9]
+. link:transaction.html[+Integrating Transactional Business Logic+]
+
+[start=10]
+. link:language.html[+Adding Language Support+]
+
+[start=11]
+. link:security.html[+Securing the Application+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -108,12 +120,12 @@
The official link:http://java.sun.com/products/ejb/[+EJB product page+] describes EnterPrise JavaBeans technology as a "server-side component architecture" that "enables rapid and simplified development of distributed, transactional, secure and portable applications." You can apply EJBs (i.e., Enterprise beans) to your projects, and the services provided by the technology remain transparent to you as a developer, thus eliminating the tedious and often error-prone task of adding a lot of boiler plate code which would otherwise be required. If you are new to EE development, you may question the need for EJBs in your Java web application. The book link:http://www.manning.com/panda/[+EJB 3 In Action+], by Debu Panda, Reza Rahman and Derek Lane, paraphrases the role of EJB technology nicely:
-[quote]
-----
+[NOTE]
+====
_Although many people think EJBs are overkill for developing relatively simple web applications of moderate size, nothing could be further from the truth. When you build a house, you don't build everything from scratch. Instead, you buy materials or even the services of a contractor as you need it. It isn't too practical to build an enterprise application from scratch either. Most server-side applications have a lot in common, including churning business logic, managing application state, storing and retrieving information from a relational database, managing transactions, implementing security, performing asynchronous processing, integrating systems, and so on.
As a framework, the EJB container provides these kinds of common functionality as out-of-the-box services so that your EJB components can use them in your applications without reinventing the wheel. For instance, let's say that when you build a credit card module in your web application, you write a lot of complex and error-prone code to manage transactions and security access control. You could have avoided that by using the declarative transaction and security services provided by the EJB container. These services as well as many others are available to EJB components when they are deployed in an EJB container. This means writing high-quality, feature-rich applications much faster than you might think._^<<footnote1,[1]>>^
-----
+====
You can think of EJB both as components, or Java classes that are incorporated in your project, as well as a _framework_ that provides numerous enterprise-related services. Some of the services that we take advantage of in this tutorial are described in link:http://www.manning.com/panda/[+EJB 3 In Action+] as follows:
@@ -199,8 +211,12 @@
When you choose the `jdbc/affablebean` data source, the IDE scans the database and lists the database tables in the Available Tables pane.
image::images/entity-from-database.png[title="Choose an available data source to have the IDE read in database tables"]
-5. Click the Add All button, then click Next.
-6. Step 3 of the Entity Classes from Database wizard differs slightly between NetBeans IDE 6.8 and 6.9. Depending on the version IDE you are using, perform the following steps.
+
+[start=5]
+. Click the Add All button, then click Next.
+
+[start=6]
+. Step 3 of the Entity Classes from Database wizard differs slightly between NetBeans IDE 6.8 and 6.9. Depending on the version IDE you are using, perform the following steps.
* <<68,NetBeans IDE 6.8>>
* <<69,NetBeans IDE 6.9>>
@@ -213,9 +229,15 @@
2. Click the Create Persistence Unit button. The Create Persistence Unit dialog opens.
image::images/create-pu.png[title="Use the Create Persistence Unit dialog to generate a persistence.xml file"]
A _persistence unit_ refers to a collection of entity classes that exist in an application. The above dialog generates a `persistence.xml` file, which is used by your persistence provider to specify configuration settings for the persistence unit. Note that 'EclipseLink (JPA 2.0)' is the default selection for the server associated with the project. Leave 'Table Generation Strategy' set to '`None`'. This prevents the persistence provider from affecting your database. (For example, if you want the persistence provider to delete then recreate the database based on the existing entity classes, you could set the strategy to '`Drop and Create`'. This action would then be taken each time the project is deployed.)
-3. Click Create.
-4. Back in Step 3: Entity Classes, note that the class names for the entities are based on database tables. For example, the `CustomerOrder` entity is mapped to the `customer_order` database table. Also note that the 'Generate Named Query Annotations for Persistent Fields' option is selected by default. We will be using various named queries later in the tutorial.
-5. Continue to <<step7,step 7>> below.
+
+[start=3]
+. Click Create.
+
+[start=4]
+. Back in Step 3: Entity Classes, note that the class names for the entities are based on database tables. For example, the `CustomerOrder` entity is mapped to the `customer_order` database table. Also note that the 'Generate Named Query Annotations for Persistent Fields' option is selected by default. We will be using various named queries later in the tutorial.
+
+[start=5]
+. Continue to <<step7,step 7>> below.
[[69]]
@@ -227,7 +249,9 @@
* The class names for the entities are based on database tables. For example, the `CustomerOrder` entity will be mapped to the `customer_order` database table.
* The 'Generate Named Query Annotations for Persistent Fields' option is selected by default. We will be using various named queries later in the tutorial.
* The 'Create Persistence Unit' option is selected by default. A _persistence unit_ is a collection of entity classes that exist in an application. The persistence unit is defined by a `persistence.xml` configuration file, which is read by your persistence provider. Enabling this option therefore means that the wizard will also generate a `persistence.xml` file and populate it with default settings.
-7. Click Finish. The JPA entity classes are generated, based on the `affablebean` database tables. You can examine the entity classes in the Projects window by expanding the newly created `entity` package. Also, note that the new persistence unit exists under the Configuration Files node.
+
+[start=7]
+. Click Finish. The JPA entity classes are generated, based on the `affablebean` database tables. You can examine the entity classes in the Projects window by expanding the newly created `entity` package. Also, note that the new persistence unit exists under the Configuration Files node.
image::images/entity-classes.png[title="View new entity classes in the Projects window"]
Note that the wizard generated an additional entity class, `OrderedProductPK`. Recall that the data model's `ordered_product` table uses a composite primary key that comprises the primary keys of both the `customer_order` and `product` tables. (See link:data-model.html#manyToMany[+Designing the Data Model - Creating Many-To-Many Relationships+].) Because of this, the persistence provider creates a separate entity class for the composite key, and _embeds_ it into the `OrderedProduct` entity. You can open `OrderedProduct` in the editor to inspect it. JPA uses the `@EmbeddedId` annotation to signify that the embeddable class is a composite primary key.
@@ -244,9 +268,13 @@
Press Ctrl-Space on the `@EmbeddedId` annotation to invoke the API documentation.
image::images/embedded-id.png[title="Press Ctrl-Space to invoke the API documentation"]
-8. Open the persistence unit (`persistence.xml`) in the editor. The IDE provides a Design view for persistence units, in addition to the XML view. The Design view provides a convenient way to make configuration changes to the persistence provider's management of the project.
+
+[start=8]
+. Open the persistence unit (`persistence.xml`) in the editor. The IDE provides a Design view for persistence units, in addition to the XML view. The Design view provides a convenient way to make configuration changes to the persistence provider's management of the project.
image::images/persistence-unit.png[title="Design view of the AffableBeanPU persistence unit"]
-9. Click the XML tab at the top of the `AffableBeanPU` persistence unit to open the XML view. Add the following property to the file.
+
+[start=9]
+. Click the XML tab at the top of the `AffableBeanPU` persistence unit to open the XML view. Add the following property to the file.
[source,xml]
----
@@ -280,15 +308,25 @@
1. Press Ctrl-N (⌘-N on Mac) to open the File wizard.
2. Select the Persistence category, then select Session Beans for Entity Classes.
image::images/session-beans-for-entity-classes.png[title="Select Session Beans for Entity Classes to generate a session facade for your persistence model"]
-3. Click Next.
-4. In Step 2: Entity Classes, note that all entity classes contained in your project are listed on the left, under Available Entity Classes. Click Add All. All entity classes are moved to the right, under Selected Entity Classes.
-5. Click Next.
-6. In Step 3: Generated Session Beans, type in *session* into the Package field.
+
+[start=3]
+. Click Next.
+
+[start=4]
+. In Step 2: Entity Classes, note that all entity classes contained in your project are listed on the left, under Available Entity Classes. Click Add All. All entity classes are moved to the right, under Selected Entity Classes.
+
+[start=5]
+. Click Next.
+
+[start=6]
+. In Step 3: Generated Session Beans, type in *session* into the Package field.
image::images/generated-session-beans.png[title="Specify the location of the new session beans, and whether to create interfaces"]
*Note:* You can use the wizard to generate local and remote interfaces for the session beans. While there is benefit to programming session beans to interfaces (For example, hiding business object interactions behind an interface enables you to further decouple the client from your business logic. This also means that you can code multiple implementations of the interface for your application, should the need arise.), this lies outside the scope of the tutorial. Note that EJB versions prior to 3.1 _require_ that you implement an interface for each session bean.
-7. Click Finish. The IDE generates session beans for each of the entity classes contained in your project. In the Projects window, expand the new `session` package to examine the session beans.
+
+[start=7]
+. Click Finish. The IDE generates session beans for each of the entity classes contained in your project. In the Projects window, expand the new `session` package to examine the session beans.
|===
|NetBeans 6.8 |NetBeans 6.9
@@ -298,7 +336,9 @@
*Note:* As shown above, NetBeans IDE 6.9 provides slight improvements in the way the Session Beans for Entity Classes wizard generates facade classes. Namely, boiler-plate code that is common to all classes is factored out into an abstract class named `AbstractFacade`. If you are working in version 6.9, open any of the facade classes that have been generated (aside from `AbstractFacade`). You'll see that the class extends `AbstractFacade`.
-8. Open a session facade in the editor, for example, `ProductFacade`. All of the generated session facades instantiate an link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+] using the link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+] annotation.
+
+[start=8]
+. Open a session facade in the editor, for example, `ProductFacade`. All of the generated session facades instantiate an link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+] using the link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+] annotation.
[source,java]
----
@@ -309,10 +349,11 @@
The `@PersistenceContext` annotation is used to inject a container-managed `EntityManager` into the class. In other words, we rely on GlassFish' EJB container to open and close `EntityManager`s as and when needed. The `unitName` element specifies the `AffableBeanPU` persistence unit, which has been defined in the application's `persistence.xml` file.
The `EntityManager` is an integral component of the Java Persistence API, and is responsible for performing persistence actions on the database. The book link:http://www.manning.com/panda/[+EJB 3 In Action+] describes the `EntityManager` as follows:
-[quote]
-----
+
+[NOTE]
+====
_The JPA `EntityManager` interface manages entities in terms of actually providing persistence services. While entities tell a JPA provider how they map to the database, they do not persist themselves. The `EntityManager` interface reads the ORM metadata for an entity and performs persistence operations._
-----
+====
Your application now contains a persistence model of the `affablebean` database in the form of JPA entity classes. It also contains a session facade consisting of Enterprise beans that can be used to access the entity classes. The next section demonstrates how you can access the database using the session beans and entity classes.
@@ -349,13 +390,17 @@
}
----
The `@EJB` annotation instructs the EJB container to instantiate the `categoryFacade` variable with the EJB named `CategoryFacade`.
-3. Use the IDE's hints to add import statements for:
+
+[start=3]
+. Use the IDE's hints to add import statements for:
* `javax.ejb.EJB`
* `session.CategoryFacade`
Pressing Ctrl-Shift-I (⌘-Shift-I on Mac) automatically adds required imports to your class.
-4. Add the following `init` method to the class. The web container initializes the servlet by calling its `init` method. This occurs only once, after the servlet is loaded and before it begins servicing requests.
+
+[start=4]
+. Add the following `init` method to the class. The web container initializes the servlet by calling its `init` method. This occurs only once, after the servlet is loaded and before it begins servicing requests.
[source,java]
----
@@ -380,7 +425,9 @@
image::images/method-signature.png[title="Over your mouse over the method while holding down the Ctrl key to view its signature"]
Clicking the hyperlink enables you to navigate directly to the method.
-5. Use the IDE's hint to add the `@Overrides` annotation. The `init` method is defined by `HttpServlet`'s superclass, `GenericServlet`.
+
+[start=5]
+. Use the IDE's hint to add the `@Overrides` annotation. The `init` method is defined by `HttpServlet`'s superclass, `GenericServlet`.
image::images/override.png[title="Use the IDE's hint to add the @Overrides annotation to the method"]
Adding the annotation is not required, however it does provide several advantages:
* It enables you to use compiler checking to ensure that you are actually overriding a method that you assume you are overriding.
@@ -388,21 +435,31 @@
For more information on annotations, see the link:http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html[+Java Tutorials: Annotations+].
-6. Now that you have set up an application-scoped attribute that contains a list of categories, modify the index page to access the newly created attribute.
+
+[start=6]
+. Now that you have set up an application-scoped attribute that contains a list of categories, modify the index page to access the newly created attribute.
Double-click the Web Pages > `index.jsp` node in the Projects window to open the file in the editor.
-7. Comment out (or delete) the `<sql:query>` statement that is listed at the top of the file. To comment out code in the editor, highlight the code, then press Ctrl-/ (⌘-/ on Mac).
+
+[start=7]
+. Comment out (or delete) the `<sql:query>` statement that is listed at the top of the file. To comment out code in the editor, highlight the code, then press Ctrl-/ (⌘-/ on Mac).
image::images/commented-out.png[title="Press Ctrl-/ to comment out a code snippet in the editor"]
-8. Modify the opening `<c:forEach>` tag so that its `items` attribute references the new application-scoped `categories` attribute.
+
+[start=8]
+. Modify the opening `<c:forEach>` tag so that its `items` attribute references the new application-scoped `categories` attribute.
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-9. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
+
+[start=9]
+. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
image::images/go-to-file.png[title="Use the Go to File dialog to quickly open files in the editor"]
-10. Comment out (or delete) the `<resource-ref>` entry. The entry was required for the `<sql>` tags in order to identify the data source registered on the server. We are now relying on JPA to access the database, and the `jdbc/affablebean` data source has already been specified in the persistence unit. (Refer to the <<pu,Design view of the project's persistence unit>> above.)
+
+[start=10]
+. Comment out (or delete) the `<resource-ref>` entry. The entry was required for the `<sql>` tags in order to identify the data source registered on the server. We are now relying on JPA to access the database, and the `jdbc/affablebean` data source has already been specified in the persistence unit. (Refer to the <<pu,Design view of the project's persistence unit>> above.)
Highlight the entire `<resource-ref>` entry, then press Ctrl-/ (⌘-/ on Mac).
@@ -417,7 +474,9 @@
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> *-->*
----
-11. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see that all four category names and images display.
+
+[start=11]
+. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see that all four category names and images display.
image::images/index-page.png[title="Verify that the index page is able to retrieve category details"]
@@ -444,14 +503,18 @@
1. Open `category.jsp` in the editor, and comment out (Ctrl-/; ⌘-/ on Mac) the JSTL `<sql>` statements that are listed at the top of the file.
image::images/comment-out-sql.png[title="Comment out JSTL <sql> statements in the category page"]
-2. Modify the opening `<c:forEach>` tag so that its `items` attribute references the application-scoped `categories` attribute. (This is identical to what you did above for `index.jsp`.)
+
+[start=2]
+. Modify the opening `<c:forEach>` tag so that its `items` attribute references the application-scoped `categories` attribute. (This is identical to what you did above for `index.jsp`.)
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-3. Run the project to examine the current state of the category page. Click the Run Project ( image::images/run-project-btn.png[] ) button. When the project's index page opens in the browser, click any of the four categories. The category buttons in the left column display and function as expected.
+
+[start=3]
+. Run the project to examine the current state of the category page. Click the Run Project ( image::images/run-project-btn.png[] ) button. When the project's index page opens in the browser, click any of the four categories. The category buttons in the left column display and function as expected.
image::images/category-page-left-column.png[title="Category buttons in left column display and function as expected"]
@@ -483,7 +546,9 @@
*Note:* The logic to determine the selected category within the left column category buttons is already implemented in `category.jsp` using an EL expression, which is comparable to calling `getQueryString()` in the servlet. The EL expression is: `pageContext.request.queryString`.
-3. Add the following line of code within the `if` statement.
+
+[start=3]
+. Add the following line of code within the `if` statement.
[source,java]
----
@@ -498,10 +563,14 @@
}
----
You use the `CategoryFacade`'s `find` method to retrieve the `Category` object based on the requested category ID. Note that you must cast `categoryId` to a `Short`, as this is the type used for the `id` field in the `Category` entity class.
-4. Click the badge ( image::images/editor-badge.png[] ) in the left margin to use the editor's hint to declare `selectedCategory` as a local variable within the `doGet` method.
+
+[start=4]
+. Click the badge ( image::images/editor-badge.png[] ) in the left margin to use the editor's hint to declare `selectedCategory` as a local variable within the `doGet` method.
image::images/local-variable.png[title="Use editor hints to declare local variables"]
Because `selectedCategory` is of type `Category`, which hasn't yet been imported into the class, the IDE automatically adds an import statement for `entity.Category` to the top of the file.
-5. Add the following line to place the retrieved `Category` object in the request scope.
+
+[start=5]
+. Add the following line to place the retrieved `Category` object in the request scope.
[source,java]
----
@@ -518,8 +587,12 @@
request.setAttribute("selectedCategory", selectedCategory);*
}
----
-6. In the editor, switch to `category.jsp`. (Press Ctrl-Tab and choose from the pop-up list.)
-7. Locate `<p id="categoryTitle">` and make the following change.
+
+[start=6]
+. In the editor, switch to `category.jsp`. (Press Ctrl-Tab and choose from the pop-up list.)
+
+[start=7]
+. Locate `<p id="categoryTitle">` and make the following change.
[source,xml]
----
@@ -529,7 +602,9 @@
</p>
----
You are now using the `selectedCategory` attribute, which you just placed in the request scope from the `ControllerServlet`. Using '`.name`' within the EL expression calls the `getName` method on the given `Category` object.
-8. Switch back to the browser and refresh the category page. The name of the selected category now displays in the page.
+
+[start=8]
+. Switch back to the browser and refresh the category page. The name of the selected category now displays in the page.
image::images/category-page-selected-category.png[title="Selected category name displays in the category page"]
@@ -562,9 +637,13 @@
}
----
Calling `getProductCollection()` here enables us to get a collection of all `Product`s associated with the `selectedCategory`.
-2. Use the editor's hint to define `categoryProducts` as a local variable for the `doGet` method.
+
+[start=2]
+. Use the editor's hint to define `categoryProducts` as a local variable for the `doGet` method.
image::images/local-variable2.png[title="Use editor hints to declare local variables"]
-3. Place the collection of `Product`s in the request scope so that it can be retrieved from the application's front-end.
+
+[start=3]
+. Place the collection of `Product`s in the request scope so that it can be retrieved from the application's front-end.
[source,java]
----
@@ -590,7 +669,9 @@
request.setAttribute("categoryProducts", categoryProducts);
}*
----
-4. Open the `category.jsp` file in the editor and make the following change to the product table.
+
+[start=4]
+. Open the `category.jsp` file in the editor and make the following change to the product table.
[source,java]
----
@@ -600,7 +681,9 @@
<c:forEach var="product" items="*${categoryProducts}*" varStatus="iter">
----
The `<c:forEach>` tag now references the `categoryProducts` collection. The `c:forEach` loop will now iterate over each `Product` object contained in the collection, and extract data accordingly.
-5. Press F6 (fn-F6 on Mac) to run the project. Navigate to the category page in the browser and note that all products now display for each category.
+
+[start=5]
+. Press F6 (fn-F6 on Mac) to run the project. Navigate to the category page in the browser and note that all products now display for each category.
image::images/category-page-product-table.png[title="Product table displays products of a given category"]
This tutorial unit provided a brief introduction to JPA and EJB technologies. It also described the role of Java specifications, and how their reference implementations are used by the GlassFish application server. It then demonstrated how to create a set of JPA entity classes that provide a Java implementation of the project database. Then, following the _session facade_ pattern, it showed how to create a set of EJB session beans that exist on top of the entity classes and enable convenient access to them. Finally, you modified the `AffableBean` project to utilize the new session beans and entities for database access required in the index and category pages.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ja.asciidoc
index d4b4afa..fb8b5ee 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ja.asciidoc
@@ -100,12 +100,12 @@
link:http://java.sun.com/products/ejb/[+EJB製品の公式ページ+]では、エンタープライズJavaBeansテクノロジを「分散型の、トランザクション可能な、セキュリティ保護された、可搬性があるアプリケーションの開発をすばやく簡単に行うことができるサーバー側コンポーネント・アーキテクチャ」と説明しています。EJB (エンタープライズBean)をプロジェクトに適用しても、このテクノロジが提供するサービスは開発者にとって透過的なままであり、EJBを使用しない場合に必要になる、大量のボイラープレート・コードを追加する退屈で間違えやすい作業を取り除くことができます。EE開発の経験が少ない場合、作成するJava WebアプリケーションでのEJBの必要性を疑問に思うかもしれません。Debu Panda氏、Reza Rahman氏およびDerek Lane氏による『link:http://www.manning.com/panda/[+EJB 3 In Action+]』の本では、EJBテクノロジの役割を次のようにうまく言い換えています。
-[quote]
-----
+[NOTE]
+====
_中規模の、比較的単純なWebアプリケーションの開発のためにEJBを使用することは大げさであると多くの人が考えていますが、これは大きな誤りです。家を建設するとき、すべてを一から造るわけではありません。かわりに資材を買ったり、必要に応じて請負業者のサービスを申し込んだりもします。同様に、エンタープライズ・アプリケーションを一からビルドすることはあまり現実的ではありません。ほとんどのサーバー側アプリケーションには、変動するビジネス・ロジック、アプリケーション状態の管理、リレーショナル・データベースに対する情報の格納および取得、トランザクションの管理、セキュリティの実装、非同期処理の実行、システムの統合など、多くの共通点があります。
フレームワークとして、EJBコンテナはこの種の共通の機能をすぐに使用できるサービスとして提供しており、EJBコンポーネントが車輪を再発明することなくアプリケーション内でこれらのサービスを使用できるようになっています。たとえば、Webアプリケーションでクレジット・カード・モジュールをビルドするときに、トランザクションやセキュリティ・アクセス制御の管理のために複雑で間違えやすい大量のコードを書いているとします。これは、EJBコンテナが提供する宣言型のトランザクションやセキュリティ・サービスを使用すれば避けられるはずです。EJBコンポーネントがEJBコンテナへデプロイされると、これらのサービスの他にも数々のサービスを使用できるようになります。これにより、高品質で豊富な機能を持つアプリケーションが、想像を大きく上回るほどの速さで書けるようになります。_^<<footnote1,[1]>>^
-----
+====
EJBは、プロジェクトに組み込まれたコンポーネントまたはJavaクラスと考えることも、多数のエンタープライズ関連のサービスを提供する_フレームワーク_と考えることもできます。このチュートリアルで利用するサービスのいくつかについては、『link:http://www.manning.com/panda/[+EJB 3 In Action+]』で次のように説明されています。
@@ -191,8 +191,12 @@
`jdbc/affablebean`データ・ソースを選択すると、IDEによってデータベースがスキャンされ、「使用可能な表」ペインにデータベースの表が一覧表示されます。
image::images/entity-from-database.png[title="使用可能なデータ・ソースの選択し、IDEでデータベースの表を読み取らせる"]
-5. 「すべてを追加」ボタンをクリックしてから「次」クリックします。
-6. データベースからのエンティティ・クラス・ウィザードのステップ3は、NetBeans IDE 6.8と6.9で少し異なります。使用するIDEのバージョンに応じて、以下の手順を実行します。
+
+[start=5]
+. 「すべてを追加」ボタンをクリックしてから「次」クリックします。
+
+[start=6]
+. データベースからのエンティティ・クラス・ウィザードのステップ3は、NetBeans IDE 6.8と6.9で少し異なります。使用するIDEのバージョンに応じて、以下の手順を実行します。
* <<68,NetBeans IDE 6.8>>
* <<69,NetBeans IDE 6.9>>
@@ -205,9 +209,15 @@
2. 「持続性ユニットを作成」ボタンをクリックします。「持続性ユニットを作成」ダイアログが開きます。
image::images/create-pu.png[title="「持続性ユニットを作成」ダイアログを使用したpersistence.xmlファイルの生成"]
_持続性ユニット_とは、アプリケーション内に存在するエンティティ・クラスのコレクションのことです。上のダイアログで、持続性プロバイダが持続性ユニットの構成設定を指定するために使用する`persistence.xml`ファイルが生成されます。このプロジェクトに関連付けられたサーバーには、「EclipseLink (JPA 2.0)」がデフォルトで選択されています。「表生成の方針」は「`なし`」のままにします。これにより、持続性プロバイダがデータベースに影響しないようになります。(たとえば、持続性プロバイダに、データベースを削除してから既存のエンティティ・クラスに基づいてデータベースを再作成させる場合は、方針を「`ドロップして作成`」に設定します。この場合、このアクションはプロジェクトがデプロイされるたびに行われます。)
-3. 「作成」をクリックします。
-4. ステップ3の「エンティティ・クラス」に戻ると、エンティティのクラス名がデータベースの表に基づいたものになっています。たとえば、`CustomerOrder`エンティティは`customer_order`データベース表にマップされています。また、「持続フィールド用のNamedQuery注釈を生成」オプションがデフォルトで選択されています。このチュートリアルの後半で、様々な名前付き問合せを使用します。
-5. 下の<<step7,ステップ7>>に進みます。
+
+[start=3]
+. 「作成」をクリックします。
+
+[start=4]
+. ステップ3の「エンティティ・クラス」に戻ると、エンティティのクラス名がデータベースの表に基づいたものになっています。たとえば、`CustomerOrder`エンティティは`customer_order`データベース表にマップされています。また、「持続フィールド用のNamedQuery注釈を生成」オプションがデフォルトで選択されています。このチュートリアルの後半で、様々な名前付き問合せを使用します。
+
+[start=5]
+. 下の<<step7,ステップ7>>に進みます。
[[69]]
@@ -219,7 +229,9 @@
* エンティティのクラス名は、データベース表に基づきます。たとえば、`CustomerOrder`エンティティは`customer_order`データベース表にマップされます。
* 「持続フィールド用のNamedQuery注釈を生成」オプションはデフォルトで選択されています。このチュートリアルの後半で、様々な名前付き問合せを使用します。
* 「持続性ユニットを作成」オプションはデフォルトで選択されています。_持続性ユニット_は、アプリケーション内に存在するエンティティ・クラスのコレクションです。持続性ユニットは、持続性プロバイダが読み取る`persistence.xml`構成ファイルで定義されます。したがって、このオプションを有効にすることは、ウィザードによって`persistence.xml`ファイルが生成されてデフォルト設定が割り当てられることにもなります。
-7. 「終了」をクリックします。JPAエンティティ・クラスが`affablebean`データベース表に基づいて生成されます。「プロジェクト」ウィンドウで新しく作成された`entity`パッケージを展開すると、エンティティ・クラスを調べることができます。また、「構成ファイル」ノードの下には新しい持続性ユニットがあります。
+
+[start=7]
+. 「終了」をクリックします。JPAエンティティ・クラスが`affablebean`データベース表に基づいて生成されます。「プロジェクト」ウィンドウで新しく作成された`entity`パッケージを展開すると、エンティティ・クラスを調べることができます。また、「構成ファイル」ノードの下には新しい持続性ユニットがあります。
image::images/entity-classes.png[title="「プロジェクト」ウィンドウでの新しいエンティティ・クラスの表示"]
ウィザードによって、追加のエンティティ・クラス`OrderedProductPK`が生成されています。データ・モデルの`ordered_product`表は、`customer_order`および`product`の両方の表の主キーで構成される複合主キーを使用することを思い出してください。(link:data-model.html#manyToMany[+データ・モデルの設計 - 多対多の関係の作成+]を参照。)このため、持続性プロバイダは複合キーのための別個のエンティティ・クラスを作成して、`OrderedProduct`エンティティに_埋込みます_。`OrderedProduct`をエディタで開くと、これを調べることができます。JPAは、組込み可能なクラスが複合主キーであることを示すために、`@EmbeddedId`注釈を使用します。
@@ -236,9 +248,13 @@
`@EmbeddedId`注釈で[Ctrl]-[Space]を押してAPIドキュメントを呼び出します。
image::images/embedded-id.png[title="[Ctrl]-[Space]の押下によるAPIドキュメントの呼出し"]
-8. エディタで持続性ユニット(`persistence.xml`)を開きます。IDEには「XML」ビューに加え、持続性ユニットのための「デザイン」ビューも用意されています。「デザイン」ビューは、プロジェクトの持続性プロバイダの管理構成を変更するための便利な方法を提供します。
+
+[start=8]
+. エディタで持続性ユニット(`persistence.xml`)を開きます。IDEには「XML」ビューに加え、持続性ユニットのための「デザイン」ビューも用意されています。「デザイン」ビューは、プロジェクトの持続性プロバイダの管理構成を変更するための便利な方法を提供します。
image::images/persistence-unit.png[title="AffableBeanPU持続性ユニットの「デザイン」ビュー"]
-9. `AffableBeanPU`持続ユニットの最上部にある「XML」タブをクリックして、「XML」ビューを開きます。ファイルに次のプロパティを追加します。
+
+[start=9]
+. `AffableBeanPU`持続ユニットの最上部にある「XML」タブをクリックして、「XML」ビューを開きます。ファイルに次のプロパティを追加します。
[source,xml]
----
@@ -272,15 +288,25 @@
1. [Ctrl]-[N] (Macの場合は[⌘]-[N])を押して、ファイル・ウィザードを開きます。
2. 「持続性」カテゴリを選択してから「エンティティ・クラスのセッションBean」を選択します。
image::images/session-beans-for-entity-classes.png[title="「エンティティ・クラスのセッションBean」を選択し、持続性モデルのセッション・ファサードを生成する"]
-3. 「次」をクリックします。
-4. ステップ2の「エンティティ・クラス」では、左側の「利用可能なエンティティ・クラス」の下に、プロジェクトに含まれているすべてのエンティティ・クラスが一覧表示されています。「すべてを追加」をクリックします。すべてのエンティティ・クラスが、右側の「選択されているエンティティ・クラス」の下に移動します。
-5. 「次」をクリックします。
-6. ステップ3の「生成されるセッションBean」で、「パッケージ」フィールドに「*session*」と入力します。
+
+[start=3]
+. 「次」をクリックします。
+
+[start=4]
+. ステップ2の「エンティティ・クラス」では、左側の「利用可能なエンティティ・クラス」の下に、プロジェクトに含まれているすべてのエンティティ・クラスが一覧表示されています。「すべてを追加」をクリックします。すべてのエンティティ・クラスが、右側の「選択されているエンティティ・クラス」の下に移動します。
+
+[start=5]
+. 「次」をクリックします。
+
+[start=6]
+. ステップ3の「生成されるセッションBean」で、「パッケージ」フィールドに「*session*」と入力します。
image::images/generated-session-beans.png[title="新しいセッションBeanの場所およびインタフェース作成の有無の指定"]
*注意:* このウィザードを使用して、セッションBeanのローカルおよびリモート・インタフェースを生成できます。セッションBeanをインタフェースとしてプログラミングするメリットはありますが(たとえば、ビジネス・オブジェクトの相互作用をインタフェースの後ろに隠すと、クライアントをビジネス・ロジックからさらに切り離すことができます。これにより、必要に応じてアプリケーション用にインタフェースの複数の実装をコーディングできるようになります)、これについてはこのチュートリアルでは扱いません。3.1より前のバージョンのEJBでは、セッションBeanごとにインタフェースを実装する_必要があります_。
-7. 「終了」をクリックします。IDEによって、プロジェクトに含まれるエンティティ・クラスごとにセッションBeanが生成されます。「プロジェクト」ウィンドウで、新しい`session`パッケージを展開してセッションBeanを調べます。
+
+[start=7]
+. 「終了」をクリックします。IDEによって、プロジェクトに含まれるエンティティ・クラスごとにセッションBeanが生成されます。「プロジェクト」ウィンドウで、新しい`session`パッケージを展開してセッションBeanを調べます。
|===
|NetBeans 6.8 |NetBeans 6.9
@@ -290,7 +316,9 @@
*注意: *上記のように、NetBeans IDE 6.9では、エンティティ・クラスのセッションBean・ウィザードがファサード・クラスを生成するようにわずかな改善が提供されます。つまり、すべてのクラスに共通するボイラープレート・コードが`AbstractFacade`という名前の抽象クラスに取り出されます。バージョン6.9を使用している場合は、生成されたいずれかのファサード・クラス(`AbstractFacade`を除く)を開いてください。そのクラスが`AbstractFacade`を継承していることがわかります。
-8. エディタでセッション・ファサード(たとえば、`ProductFacade`)を開きます。生成されたすべてのセッション・ファサードは、link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+]注釈を使用してlink:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+]をインスタンス化します。
+
+[start=8]
+. エディタでセッション・ファサード(たとえば、`ProductFacade`)を開きます。生成されたすべてのセッション・ファサードは、link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+]注釈を使用してlink:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+]をインスタンス化します。
[source,java]
----
@@ -301,10 +329,11 @@
`@PersistenceContext`注釈は、コンテナ管理対象`EntityManager`をクラスに注入するために使用されます。つまり、必要に応じてGlassFishのEJBコンテナを利用して`EntityManager`を開いたり閉じたりします。`unitName`要素には、アプリケーションの`persistence.xml`ファイルで定義されている`AffableBeanPU`持続性ユニットを指定します。
`EntityManager`はJava Persistence APIの重要なコンポーネントであり、データベースで持続性アクションを実行する役割を果たします。『link:http://www.manning.com/panda/[+EJB 3 In Action+]』の本では、`EntityManager`を次のように説明しています。
-[quote]
-----
+
+[NOTE]
+====
_JPA`EntityManager`インタフェースは、実際に持続性サービスを提供することでエンティティを管理します。エンティティは、JPAプロバイダに自身がデータベースにどのようにマップされているかを伝えますが、自身は持続しません。`EntityManager`インタフェースは、エンティティのORMメタデータを読み取って、持続性操作を実行します。_
-----
+====
アプリケーションに、JPAエンティティ・クラスの形式で`affablebean`データベースの持続性モデルが含まれるようになりました。また、エンティティ・クラスにアクセスするために使用できるエンタープライズBeanで構成されるセッション・ファサードも含まれています。次の項では、セッションBeanおよびエンティティ・クラスを使用してデータベースにアクセスする方法を示します。
@@ -341,13 +370,17 @@
}
----
`@EJB`注釈は、`CategoryFacade`という名前のEJBで`categoryFacade`変数をインスタンス化するようにEJBコンテナに指示します。
-3. IDEのヒントを使用して、次のインポート文を追加します。
+
+[start=3]
+. IDEのヒントを使用して、次のインポート文を追加します。
* `javax.ejb.EJB`
* `session.CategoryFacade`
[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押すと、必要なインポートが自動的にクラスに追加されます。
-4. 以下の`init`メソッドをクラスに追加します。Webコンテナは、その`init`メソッドをコールしてサーブレットを初期化します。これは、サーブレットがロードされてからサービス・リクエストを開始するまでの間に1回のみ発生します。
+
+[start=4]
+. 以下の`init`メソッドをクラスに追加します。Webコンテナは、その`init`メソッドをコールしてサーブレットを初期化します。これは、サーブレットがロードされてからサービス・リクエストを開始するまでの間に1回のみ発生します。
[source,java]
----
@@ -372,7 +405,9 @@
image::images/method-signature.png[title="[Ctrl]キーを押しながらカーソルをメソッド上に移動して署名を表示する"]
ハイパーリンクをクリックすると、メソッドに直接移動できます。
-5. IDEのヒントを使用して、`@Overrides`注釈を追加します。`init`メソッドは、`HttpServlet`のスーパー・クラスである`GenericServlet`によって定義されます。
+
+[start=5]
+. IDEのヒントを使用して、`@Overrides`注釈を追加します。`init`メソッドは、`HttpServlet`のスーパー・クラスである`GenericServlet`によって定義されます。
image::images/override.png[title="IDEのヒントを使用した、メソッドへの@Overrides注釈の追加"]
注釈を追加することは必須ではありませんが、これを行うと次のようないくつかの利点が得られます。
* 本当にオーバーライドするつもりのメソッドをオーバーライドしているかどうかを確認するためのコンパイラ・チェックを使用できるようになります。
@@ -380,21 +415,31 @@
注釈の詳細は、link:http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html[+Javaチュートリアル: 注釈+]を参照してください。
-6. これで、カテゴリの一覧を含むアプリケーション・スコープ指定された属性を設定したので、新しく作成した属性にアクセスするようにインデックス・ページを変更します。
+
+[start=6]
+. これで、カテゴリの一覧を含むアプリケーション・スコープ指定された属性を設定したので、新しく作成した属性にアクセスするようにインデックス・ページを変更します。
「プロジェクト」ウィンドウで「Webページ」>「`index.jsp`」ノードをダブルクリックして、このファイルをエディタで開きます。
-7. ファイルの最上部に一覧表示されている`<sql:query>`文をコメントアウト(または削除)します。エディタでコードをコメントアウトするには、コードを強調表示してから[Ctrl]-[/](Macの場合は[⌘]-[/])を押します。
+
+[start=7]
+. ファイルの最上部に一覧表示されている`<sql:query>`文をコメントアウト(または削除)します。エディタでコードをコメントアウトするには、コードを強調表示してから[Ctrl]-[/](Macの場合は[⌘]-[/])を押します。
image::images/commented-out.png[title="エディタでの[Ctrl]-[/]の押下によるコード・スニペットのコメントアウト"]
-8. `<c:forEach>`の開始タグを変更して、この`items`属性が、新しいアプリケーション・スコープ指定された`categories`属性を参照するようにします。
+
+[start=8]
+. `<c:forEach>`の開始タグを変更して、この`items`属性が、新しいアプリケーション・スコープ指定された`categories`属性を参照するようにします。
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-9. プロジェクトのWebデプロイメント・ディスクリプタを開きます。[Alt]-[Shift]-[O] (Macの場合は[Ctrl]-[Shift]-[O])を押して、「ファイルに移動」ダイアログで「`web`」と入力してから「OK」をクリックします。
+
+[start=9]
+. プロジェクトのWebデプロイメント・ディスクリプタを開きます。[Alt]-[Shift]-[O] (Macの場合は[Ctrl]-[Shift]-[O])を押して、「ファイルに移動」ダイアログで「`web`」と入力してから「OK」をクリックします。
image::images/go-to-file.png[title="「ファイルに移動」ダイアログを使用した、エディタへのファイルの速やかな表示"]
-10. `<resource-ref>`エントリをコメントアウト(または削除)します。このエントリは、サーバーに登録されたデータ・ソースを`<sql>`タグで識別するために必要でした。現時点では、JPAに依存してデータベースにアクセスしており、持続性ユニットに`jdbc/affablebean`データ・ソースがすでに指定されています。(上記の<<pu,プロジェクトの持続性ユニットの「デザイン」ビュー>>を参照。)
+
+[start=10]
+. `<resource-ref>`エントリをコメントアウト(または削除)します。このエントリは、サーバーに登録されたデータ・ソースを`<sql>`タグで識別するために必要でした。現時点では、JPAに依存してデータベースにアクセスしており、持続性ユニットに`jdbc/affablebean`データ・ソースがすでに指定されています。(上記の<<pu,プロジェクトの持続性ユニットの「デザイン」ビュー>>を参照。)
`<resource-ref>`エントリ全体を強調表示してから[Ctrl]-[/](Macの場合は[⌘]-[/])を押します。
@@ -409,7 +454,9 @@
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> *-->*
----
-11. プロジェクトを実行します。「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。プロジェクトのインデックス・ページがブラウザで開き、4つのすべてのカテゴリ名およびイメージが表示されるのが確認できます。
+
+[start=11]
+. プロジェクトを実行します。「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。プロジェクトのインデックス・ページがブラウザで開き、4つのすべてのカテゴリ名およびイメージが表示されるのが確認できます。
image::images/index-page.png[title="インデックス・ページにカテゴリの詳細を取得できることの確認"]
@@ -436,14 +483,18 @@
1. エディタで`category.jsp`を開き、ファイルの最上部に一覧表示されているJSTLの`<sql>`文を([Ctrl]-[/]、Macの場合は[⌘]-[/]で)コメントアウトします。
image::images/comment-out-sql.png[title="カテゴリ・ページでのJSTLの<sql>文のコメントアウト"]
-2. `<c:forEach>`の開始タグを変更して、この`items`属性が、アプリケーション・スコープ指定された`categories`属性を参照するようにします。(上記で`index.jsp`に対して実行した手順と同じです。)
+
+[start=2]
+. `<c:forEach>`の開始タグを変更して、この`items`属性が、アプリケーション・スコープ指定された`categories`属性を参照するようにします。(上記で`index.jsp`に対して実行した手順と同じです。)
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-3. プロジェクトを実行して、カテゴリ・ページの現在の状態を調べます。「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。プロジェクトのインデックス・ページがブラウザで開いたら、4つのカテゴリのいずれかをクリックします。左の列にカテゴリ・ボタンが表示され、想定したとおりに機能します。
+
+[start=3]
+. プロジェクトを実行して、カテゴリ・ページの現在の状態を調べます。「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。プロジェクトのインデックス・ページがブラウザで開いたら、4つのカテゴリのいずれかをクリックします。左の列にカテゴリ・ボタンが表示され、想定したとおりに機能します。
image::images/category-page-left-column.png[title="左の列にカテゴリのボタンが表示され、想定したとおりに機能する"]
@@ -475,7 +526,9 @@
*注意:* 左の列のカテゴリ・ボタン内で選択されたカテゴリを判定するためのロジックは、EL式を使用する`category.jsp`ですでに実装されています。これは、サーブレットで`getQueryString()`をコールすることに相当します。このEL式は`pageContext.request.queryString`です。
-3. `if`文の中に、次のコード行を追加します。
+
+[start=3]
+. `if`文の中に、次のコード行を追加します。
[source,java]
----
@@ -490,10 +543,14 @@
}
----
`CategoryFacade`の`find`メソッドを使用して、リクエストされたカテゴリIDに基づく`Category`オブジェクトを取得します。`categoryId`を、`Category`エンティティ・クラスの`id`フィールドに使用される型である`Short`にキャストする必要があります。
-4. 左マージンにあるバッジ(image::images/editor-badge.png[])をクリックしてエディタのヒントを使用し、`selectedCategory`を`doGet`メソッド内のローカル変数として宣言します。
+
+[start=4]
+. 左マージンにあるバッジ(image::images/editor-badge.png[])をクリックしてエディタのヒントを使用し、`selectedCategory`を`doGet`メソッド内のローカル変数として宣言します。
image::images/local-variable.png[title="エディタのヒントを使用してローカル変数を宣言する"]
`selectedCategory`はこのクラスにまだインポートされていない`Category`型であるため、IDEは`entity.Category`のインポート文をファイルの先頭に自動的に追加します。
-5. 取得した`Category`オブジェクトをリクエスト・スコープに置くために次の行を追加します。
+
+[start=5]
+. 取得した`Category`オブジェクトをリクエスト・スコープに置くために次の行を追加します。
[source,java]
----
@@ -510,8 +567,12 @@
request.setAttribute("selectedCategory", selectedCategory);*
}
----
-6. エディタで`category.jsp`に切り替えます。([Ctrl]-[Tab]を押してポップアップ・リストから選択します。)
-7. `<p id="categoryTitle">`を検索して、次のように変更します。
+
+[start=6]
+. エディタで`category.jsp`に切り替えます。([Ctrl]-[Tab]を押してポップアップ・リストから選択します。)
+
+[start=7]
+. `<p id="categoryTitle">`を検索して、次のように変更します。
[source,xml]
----
@@ -521,7 +582,9 @@
</p>
----
現時点で、`ControllerServlet`からリクエスト・スコープに置いたばかりの`selectedCategory`属性を使用しています。EL式の中で「`.name`」を使用すると、指定された`Category`オブジェクトで`getName`メソッドがコールされます。
-8. ブラウザに戻ってカテゴリ・ページをリフレッシュします。選択されたカテゴリの名前がページに表示されるようになっています。
+
+[start=8]
+. ブラウザに戻ってカテゴリ・ページをリフレッシュします。選択されたカテゴリの名前がページに表示されるようになっています。
image::images/category-page-selected-category.png[title="選択されたカテゴリの名前がカテゴリ・ページに表示される"]
@@ -554,9 +617,13 @@
}
----
ここで`getProductCollection()`をコールして、`selectedCategory`に関連付けられたすべての`Product`のコレクションを取得できます。
-2. エディタのヒントを使用して、`categoryProducts`を`doGet`メソッドのローカル変数として定義します。
+
+[start=2]
+. エディタのヒントを使用して、`categoryProducts`を`doGet`メソッドのローカル変数として定義します。
image::images/local-variable2.png[title="エディタのヒントを使用してローカル変数を宣言する"]
-3. リクエスト・スコープに`Product`のコレクションを置いて、アプリケーションのフロント・エンドから取得できるようにします。
+
+[start=3]
+. リクエスト・スコープに`Product`のコレクションを置いて、アプリケーションのフロント・エンドから取得できるようにします。
[source,java]
----
@@ -582,7 +649,9 @@
request.setAttribute("categoryProducts", categoryProducts);
}*
----
-4. エディタで`category.jsp`ファイルを開き、製品の表を次のように変更します。
+
+[start=4]
+. エディタで`category.jsp`ファイルを開き、製品の表を次のように変更します。
[source,java]
----
@@ -592,7 +661,9 @@
<c:forEach var="product" items="*${categoryProducts}*" varStatus="iter">
----
`<c:forEach>`タグは`categoryProducts`のコレクションを参照するようになりました。`c:forEach`ループはコレクションに含まれる各`Product`オブジェクトに対して繰り返され、それに応じてデータを抽出するようになりました。
-5. [F6] (Macの場合は[fn]-[F6])を押してプロジェクトを実行します。ブラウザでカテゴリ・ページに移動すると、各カテゴリですべての製品が表示されるようになっています。
+
+[start=5]
+. [F6] (Macの場合は[fn]-[F6])を押してプロジェクトを実行します。ブラウザでカテゴリ・ページに移動すると、各カテゴリですべての製品が表示されるようになっています。
image::images/category-page-product-table.png[title="製品の表に指定のカテゴリの製品が表示される"]
このチュートリアル・ユニットでは、JPAおよびEJBテクノロジを簡単に紹介しました。また、Java仕様の役割について、およびそのリファレンス実装をGlassFishアプリケーション・サーバーが使用する方法についても説明しました。その後、プロジェクト・データベースのJava実装を提供する一連のJPAエンティティ・クラスを作成する方法を示しました。さらに、_セッション・ファサード_・パターンに従って、エンティティ・クラス上に存在し、それらへの便利なアクセスを可能にする一連のEJBセッションBeanを作成する方法を示しました。最後に、`AffableBean`プロジェクトを変更して、インデックス・ページおよびカテゴリ・ページで必要なデータベースへのアクセスに、新しいセッションBeanおよびエンティティを利用するようにしました。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_pt_BR.asciidoc
index c836bf7..1993024 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_pt_BR.asciidoc
@@ -100,12 +100,12 @@
A link:http://java.sun.com/products/ejb/[+página oficial do produto EJB+] descreve a tecnologia EnterPrise JavaBeans como uma "arquitetura do componente do servidor" que "ativa o desenvolvimento rápido e simplificado de aplicações distribuídas, transacionais, seguras e portáteis". Voce pode aplicar EJBs (ou seja., Enterprise beans) aos projetos, e os serviços fornecidos pela tecnologia permanecerão transparentes para você como desenvolvedor, eliminando, assim, a tarefa tediosa e geralmente propensa a erros de adicionar vários códigos de placa que seriam, de outra maneira, necessários. Se for novo no desenvolvimento EE, pode questionar a necessidade de EJBs na aplicação Java Web. O livro link:http://www.manning.com/panda/[+EJB 3 Em Ação+], de Debu Panda, Reza Rahman e Derek Lane, parafraseia muito bem a atribuição da tecnologia EJB:
-[quote]
-----
+[NOTE]
+====
_Embora muitas pessoas pensem que EJBs são um exagero para desenvolvimento de aplicações Web relativamente simples e de tamanho moderado, isso não é verdade. Quando se constrói uma casa, não se constrói tudo desde o início. Em vez disso, se compra materiais ou até mesmo serviços terceirizados, conforme ncessário. Também não é muito prático construir uma aplicação corporativa desde o início. A maioria das aplicações de servidor tem muito em comum, incluindo a rotatividade da lógica de negócios, gerenciamento do estado da aplicação, armazenamento e recuperação de informações de um banco de dados relacional, gerenciamento de transações, implementação de segurança, execução de processamento assíncrono, integração de sistemas, e assim por diante.
Como framework, o contêiner do EJB fornece esses tipos de funcionalidade comum, como serviços de fábrica, de modo que os componentes do EJB podem utilizá-los nas aplicações sem reinventar a roda. Por exemplo, vamos dizer que quando se constrói um módulo de cartão de crédito na aplicação Web, você escreve muito código complexo e propenso ao erro para gerenciar transações e controle de acesso de segurança. Isso poderia ser evitado utilizando os serviços de transação declarativa e de segurança fornecidos pelo contêiner EJB. Esses serviços, bem como muitos outros, estão disponíveis para componentes do EJB quando eles são implantados em um contêiner EJB. Isso significa escrever aplicações de alta qualidade e ricos em funcionalidades muito mais rápido do que você poderia pensar._^<<footnote1,[1]>>^
-----
+====
É possível pensar no EJB como componentes ou classes Java que são incorporadas no projeto, bem como um _framework_ que fornece vários serviços relacionados à empresa. Alguns dos serviços que aproveitamos neste tutorial estão descritos em link:http://www.manning.com/panda/[+EJB 3 Em Ação+] como se segue:
@@ -191,8 +191,12 @@
Quando você escolhe a fonte de dados `jdbc/affablebean`, o IDE varre o banco de dados e lista as tabelas de banco de dados no painel Tabelas Disponíveis.
image::images/entity-from-database.png[title="Escolha uma origem de dados disponível para ter o IDE lido em tabelas de banco de dados"]
-5. Clique no botão Adicionar Tudo e, em seguida, em Próximo.
-6. Etapa 3 do assistente de Classes de Entidade do Banco de dados é um pouco diferente entre o NetBeans IDE 6.8 e 6.9. Dependendo da versão do IDE que você está usando, execute as seguintes etapas.
+
+[start=5]
+. Clique no botão Adicionar Tudo e, em seguida, em Próximo.
+
+[start=6]
+. Etapa 3 do assistente de Classes de Entidade do Banco de dados é um pouco diferente entre o NetBeans IDE 6.8 e 6.9. Dependendo da versão do IDE que você está usando, execute as seguintes etapas.
* <<68,NetBeans IDE 6.8>>
* <<69,NetBeans IDE 6.9>>
@@ -205,9 +209,15 @@
2. Clique no botão Criar Unidade de Persistência. A caixa de diálogo Criar Unidade de Persistência será aberta.
image::images/create-pu.png[title="Use a caixa de diálogo Criar Unidade de Persistência para gerar um arquivo persistence.xml"]
Uma _unidade de persistência_ se refere a uma coleção de classes de entidade que existem em uma aplicação. A caixa de diálogo acima gera um arquivo `persistence.xml`, que é usado por seu provedor de persistência para especificar as definições de configuração da unidade de persistência. Note que "EclipseLink (JPA 2. 0)" é a seleção default para o servidor associado ao projeto. Deixe "Estratégia de Geração de Tabela" definido como "`None`". Isso impede o provedor de persistência de afetar o banco de dados. (Por exemplo, se desejar que o provedor de persistência delete e, em seguida, recrie o banco de dados com base nas classes de entidade existentes, seria possível definir a estratégia como "`Drop and Create`". Essa ação seria, em seguida, executada toda vez que o projeto fosse implantado).
-3. Clique em Criar.
-4. De volta à Etapa 3: Classes de Entidade, note que os nomes de classes das entidades são baseados em tabelas de banco de dados. Por exemplo, a entidade `CustomerOrder` é mapeada para a tabela de banco de dados `customer_order`. Além disso, note que a opção "Gerar Anotações de Consulta Nomeada para Campos Persistentes" está selecionada por default. Começaremos utilizando várias consultas nomeadas posteriormente neste tutorial.
-5. Prossiga para a <<step7,etapa 7>> abaixo.
+
+[start=3]
+. Clique em Criar.
+
+[start=4]
+. De volta à Etapa 3: Classes de Entidade, note que os nomes de classes das entidades são baseados em tabelas de banco de dados. Por exemplo, a entidade `CustomerOrder` é mapeada para a tabela de banco de dados `customer_order`. Além disso, note que a opção "Gerar Anotações de Consulta Nomeada para Campos Persistentes" está selecionada por default. Começaremos utilizando várias consultas nomeadas posteriormente neste tutorial.
+
+[start=5]
+. Prossiga para a <<step7,etapa 7>> abaixo.
[[69]]
@@ -219,7 +229,9 @@
* Os nomes das classes das entidades são baseados em tabelas de banco de dados. Por exemplo, a entidade `CustomerOrder` será mapeada para a tabela de banco de dados `customer_order`.
* A opção "Gerar Anotações de Consulta Nomeada para Campos Persistentes" é selecionada por default. Começaremos utilizando várias consultas nomeadas posteriormente neste tutorial.
* A opção "Criar Unidade de Persistência" é selecionada por default. Uma _unidade de persistência_ é uma coleção de classes de entidade que existem em uma aplicação. A unidade de persistência é definida por um arquivo de configuração `persistence.xml`, que é lido pelo seu provedor de persistência. Portanto, ativar esta opção significa que o assistente também gerará um arquivo `persistence.xml` e irá preenchê-lo com as definições default.
-7. Clique em Finalizar. As classes de entidade JPA são geradas com base nas tabelas de banco de dados `affablebean`. Você pode examinar as classes de entidade na janela Projetos, expandindo o pacote `entity` recém-criado. Observe também que a nova unidade de persistência existe no nó Arquivos de Configuração.
+
+[start=7]
+. Clique em Finalizar. As classes de entidade JPA são geradas com base nas tabelas de banco de dados `affablebean`. Você pode examinar as classes de entidade na janela Projetos, expandindo o pacote `entity` recém-criado. Observe também que a nova unidade de persistência existe no nó Arquivos de Configuração.
image::images/entity-classes.png[title="Exibir novas classes de entidade na janela Projetos"]
Note que o assistente gerou uma classe de entidade adicional, `OrderedProductPK`. Lembre-se de que a tabela `ordered_product` do modelo de dados utiliza uma chave primária composta que inclui as chaves primárias das tabelas `customer_order` e `product`. (Consulte link:data-model.html#manyToMany[+Criação de Modelo de Dados: Criando Relacionamentos Muitos para Muitos+]). Por esse motivo, o provedor de persistência cria uma classe de entidade separada para a chave composta e _incorpora-a_ na entidade `OrderedProduct`. É possível abrir `OrderedProduct` no editor para inspecioná-lo. A JPA utiliza a anotação `@EmbeddedId` para significar que a classe que pode ser incorporada é uma chave primária composta.
@@ -236,9 +248,13 @@
Pressione Ctrl-Espaço na anotação `@EmbeddedId` para chamar a documentação da API.
image::images/embedded-id.png[title="Pressione Ctrl-Espaço para chamar a documentação da API"]
-8. Abra a unidade de persistência (`persistence. xml`) no editor. O IDE fornece uma view do Design das unidades de persistência, além da view XML. A view do Design fornece uma maneira conveniente de fazer mudanças na configuração para o gerenciamento do projeto do provedor de persistência.
+
+[start=8]
+. Abra a unidade de persistência (`persistence. xml`) no editor. O IDE fornece uma view do Design das unidades de persistência, além da view XML. A view do Design fornece uma maneira conveniente de fazer mudanças na configuração para o gerenciamento do projeto do provedor de persistência.
image::images/persistence-unit.png[title="View do Design da unidade de persistência AffableBeanPU"]
-9. Clique na guia XML na parte superior da unidade de persistência `AffableBeanPU` para abrir a view XML. Adicione a propriedade a seguir ao arquivo.
+
+[start=9]
+. Clique na guia XML na parte superior da unidade de persistência `AffableBeanPU` para abrir a view XML. Adicione a propriedade a seguir ao arquivo.
[source,xml]
----
@@ -272,15 +288,25 @@
1. Pressione Ctrl-N (⌘-N no Mac) para abrir o assistente de Arquivo.
2. Selecione a categoria Persistência e selecione Beans de Sessão para Classes de Entidade.
image::images/session-beans-for-entity-classes.png[title="Selecione Beans de Sessão para Classes de Entidade para gerar uma fachada da sessão para seu modelo de persistência"]
-3. Clique em Próximo.
-4. Na Etapa 2: Classes de Entidade, note que todas as classes de entidade contidas no projeto estão listadas à esquerda, em Classes de Entidade Disponíveis. Clique em Adicionar Tudo. Todas as classes de entidade são movidas para a direita, em Classes de Entidade Selecionadas.
-5. Clique em Próximo.
-6. Na Etapa 3: Beans de Sessão Gerados, digite *session* no campo Pacote.
+
+[start=3]
+. Clique em Próximo.
+
+[start=4]
+. Na Etapa 2: Classes de Entidade, note que todas as classes de entidade contidas no projeto estão listadas à esquerda, em Classes de Entidade Disponíveis. Clique em Adicionar Tudo. Todas as classes de entidade são movidas para a direita, em Classes de Entidade Selecionadas.
+
+[start=5]
+. Clique em Próximo.
+
+[start=6]
+. Na Etapa 3: Beans de Sessão Gerados, digite *session* no campo Pacote.
image::images/generated-session-beans.png[title="Especifique o local dos novos beans de sessão e se deseja criar interfaces"]
*Observação:* É possível utilizar o assistente para gerar interfaces locais e remotas para os beans de sessão. Embora haja vantagens em programar beans de sessão para interfaces (Por exemplo, ocultar interações de objetos de negócio atrás de uma interface permite desacoplar ainda mais o cliente de sua lógica de negócio. Isso também significa que você pode codificar várias implementações da interface para a aplicação, se necessário for) e isso está fora do escopo do tutorial. Note que as versões do EJB anteriores a 3.1 _requerem_ a implementação de uma interface para cada bean de sessão.
-7. Clique em Finalizar. O IDE gera beans de sessão para cada uma das classes de entidade contidas no projeto. Na janela Projetos, expanda o novo pacote `session` para examinar os beans de sessão.
+
+[start=7]
+. Clique em Finalizar. O IDE gera beans de sessão para cada uma das classes de entidade contidas no projeto. Na janela Projetos, expanda o novo pacote `session` para examinar os beans de sessão.
|===
|NetBeans 6.8 |NetBeans 6.9
@@ -290,7 +316,9 @@
*Observação:* Como mostrado acima, o NetBeans IDE 6.9 fornece alguns aprimoramentos na maneira como o assistente Beans de Sessão para Classes de Entidade gera classes de fachadas. Ou seja, o código "boiler-plate” que é comum a todas as classes é desconsiderado em uma classe abstrata denominada `AbstractFacade`. Caso esteja trabalhando na versão 6.9, abra qualquer uma das classes de fachada que foram geradas (sem ser a `AbstractFacade`). Você verá que a classe estende a `AbstractFacade`.
-8. Abra uma fachada de sessão no editor, por exemplo, `ProductFacade`. Todas as fachadas de sessão geradas instanciam um link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+] usando a anotação link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+].
+
+[start=8]
+. Abra uma fachada de sessão no editor, por exemplo, `ProductFacade`. Todas as fachadas de sessão geradas instanciam um link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+] usando a anotação link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+].
[source,java]
----
@@ -301,10 +329,10 @@
A anotação `@PersistenceContext` é usada para injetar um `EntityManager` gerenciado por contêiner na classe. Em outras palavras, nós confiamos no contêiner EJB do GlassFish para abrir e fechar os `EntityManager`s, onde e quando necessário. O elemento `unitName` especifica a unidade de persistência `AffableBeanPU`, que foi definida no arquivo `persistence.xml` da aplicação.
O `EntityManager` é um componente integrante da Java Persistence API e é responsável por executar ações de persistência no banco de dados. O livro link:http://www.manning.com/panda/[+EJB 3 em ação+] descreve o `EntityManager` como se segue:
-[quote]
-----
+[NOTE]
+====
_A interface `EntityManager` do JPA gerencia entidades em termos de fornecer, realmente, serviços de persistência. Embora as entidades digam a um provedor JPA como são mapeadas para o banco de dados, elas não fazem a própria persistência. A interface `EntityManager` lê os metadados ORM para uma entidade e executa operações de persistência._
-----
+====
Sua aplicação contém, agora, um modelo de persistência do banco de dados `affablebean` na forma de classes de entidade JPA. Também contém uma fachada de sessão que consiste em Enterprise beans que podem ser utilizados para acessar as classes de entidade. A próxima seção demonstra como você pode acessar o banco de dados utilizando os beans de sessão e as classes de entidade.
@@ -341,13 +369,17 @@
}
----
A anotação `@EJB` instrui o contêiner EJB a instanciar a variável `categoryFacade` com o EJB nomeado `CategoryFacade`.
-3. Utilize as dicas do IDE para adicionar instruções de importação para:
+
+[start=3]
+. Utilize as dicas do IDE para adicionar instruções de importação para:
* `javax.ejb.EJB`
* `session.CategoryFacade`
Pressionar Ctrl-Shift-I (⌘-Shift-I no Mac) adiciona, automaticamente, importações necessárias à classe.
-4. Adicione o seguinte método `init` à classe. O contêiner da Web inicializa o servlet chamando seu método `init`. Isso ocorre apenas uma vez, após o servlet carregar e antes de ele começar a atender solicitações.
+
+[start=4]
+. Adicione o seguinte método `init` à classe. O contêiner da Web inicializa o servlet chamando seu método `init`. Isso ocorre apenas uma vez, após o servlet carregar e antes de ele começar a atender solicitações.
[source,java]
----
@@ -372,7 +404,9 @@
image::images/method-signature.png[title="Coloque o mouse sobre o método e mantenha pressionada a tecla Ctrl para exibir sua assinatura"]
Clicar no hiperlink permite navegar diretamente para o método.
-5. Utilize a dica do IDE para adicionar a anotação `@Overrides`. O método `init` é definido pela superclasse do `HttpServlet`, `GenericServlet`.
+
+[start=5]
+. Utilize a dica do IDE para adicionar a anotação `@Overrides`. O método `init` é definido pela superclasse do `HttpServlet`, `GenericServlet`.
image::images/override.png[title="Utilize a dica do IDE para adicionar a anotação @Overrides para o método"]
Adicionar a anotação não é necessário, mas oferece várias vantagens:
* Permite utilizar a verificação do compilador para garantir que você esteja, realmente, substituindo o método que supõe estar substituindo.
@@ -380,21 +414,31 @@
Para obter mais informações sobre anotações, consulte link:http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html[+Tutoriais Java: Anotações+].
-6. Agora que configurou um atributo de escopo da aplicação que contém uma lista de categorias, modifique a página de índice para acessar o atributo recém-criado.
+
+[start=6]
+. Agora que configurou um atributo de escopo da aplicação que contém uma lista de categorias, modifique a página de índice para acessar o atributo recém-criado.
Clique duas vezes no nó Páginas Web > `index.jsp` na janela Projetos para abrir o arquivo no editor.
-7. Comente (ou delete) a instrução `<sql:query>` que está listada na parte superior do arquivo. Para comentar código no editor, realce o código e pressione Ctrl-/ (⌘-/ no Mac).
+
+[start=7]
+. Comente (ou delete) a instrução `<sql:query>` que está listada na parte superior do arquivo. Para comentar código no editor, realce o código e pressione Ctrl-/ (⌘-/ no Mac).
image::images/commented-out.png[title="Pressione Ctrl-/ para comentar um snippet de código no editor"]
-8. Modifique a tag `<c:forEach>` de abertura para que o atributo `items` faça referência ao novo atributo `categories` de escopo da aplicação.
+
+[start=8]
+. Modifique a tag `<c:forEach>` de abertura para que o atributo `items` faça referência ao novo atributo `categories` de escopo da aplicação.
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-9. Abra o descritor de implantação web do projeto. Pressione Alt-Shift-O (Ctrl-Shift-O no Mac) e na caixa de diálogo Ir para Arquivo, digite "`web`" e clique em OK.
+
+[start=9]
+. Abra o descritor de implantação web do projeto. Pressione Alt-Shift-O (Ctrl-Shift-O no Mac) e na caixa de diálogo Ir para Arquivo, digite "`web`" e clique em OK.
image::images/go-to-file.png[title="Use a caixa de diálogo Ir para Arquivo para abrir rapidamente arquivos no editor"]
-10. Comente (ou delete) a entrada `<resource-ref>`. A entrada foi necessária para as tags `<sql>`, a fim de identificar a fonte de dados registrada no servidor. Agora contamos com a JPA para acessar o banco de dados e a fonte de dados `jdbc/affablebean` já foi especificada na unidade de persistência. (Consulte a <<pu,View do design da unidade de persistência do projeto>> acima).
+
+[start=10]
+. Comente (ou delete) a entrada `<resource-ref>`. A entrada foi necessária para as tags `<sql>`, a fim de identificar a fonte de dados registrada no servidor. Agora contamos com a JPA para acessar o banco de dados e a fonte de dados `jdbc/affablebean` já foi especificada na unidade de persistência. (Consulte a <<pu,View do design da unidade de persistência do projeto>> acima).
Realce toda a entrada `<resource-ref>` e pressione Ctrl-/ (⌘-/ no Mac).
@@ -409,7 +453,9 @@
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> *-->*
----
-11. Execute o projeto. Clique no botão Executar Projeto (image::images/run-project-btn.png[]). A página de índice do projeto será aberta no browser e você verá que todos os nomes e imagens das quatro categorias serão exibidos.
+
+[start=11]
+. Execute o projeto. Clique no botão Executar Projeto (image::images/run-project-btn.png[]). A página de índice do projeto será aberta no browser e você verá que todos os nomes e imagens das quatro categorias serão exibidos.
image::images/index-page.png[title="Verifique se a página de índice pode recuperar detalhes da categoria"]
@@ -436,14 +482,18 @@
1. Abra `category.jsp` no editor e comente (Ctrl-/; ⌘-/ no Mac) as instruções JSTL `<sql>` listadas na parte superior do arquivo.
image::images/comment-out-sql.png[title="Comente instruções JSTL <sql> na página da categoria"]
-2. Modifique a tag `<c:forEach>` de abertura para que o atributo `itens` faça referência ao atributo `categorias` de escopo da aplicação. (Isso é idêntico ao que foi feito acima para `index.jsp`).
+
+[start=2]
+. Modifique a tag `<c:forEach>` de abertura para que o atributo `itens` faça referência ao atributo `categorias` de escopo da aplicação. (Isso é idêntico ao que foi feito acima para `index.jsp`).
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-3. Execute o projeto para examinar o estado atual da página da categoria. Clique no botão Executar Projeto (image::images/run-project-btn.png[]). Quando a página de índice do projeto abrir no browser, clique em qualquer uma das quatro categorias. Os botões de categoria na coluna esquerda serão exibidos e funcionarão como esperado.
+
+[start=3]
+. Execute o projeto para examinar o estado atual da página da categoria. Clique no botão Executar Projeto (image::images/run-project-btn.png[]). Quando a página de índice do projeto abrir no browser, clique em qualquer uma das quatro categorias. Os botões de categoria na coluna esquerda serão exibidos e funcionarão como esperado.
image::images/category-page-left-column.png[title="Os botões de categoria na coluna esquerdo serão exibidos e funcionarão conforme esperado"]
@@ -475,7 +525,9 @@
*Observação: * A lógica para determinar a categoria selecionada nos botões de categoria da coluna esquerda já está implementada em `category. jsp` utilizando uma expressão EL, o que é comparável a chamar `getQueryString()` no servlet. A expressão EL é: `pageContext.request.queryString`.
-3. Adicione a seguinte linha de código na instrução `if`.
+
+[start=3]
+. Adicione a seguinte linha de código na instrução `if`.
[source,java]
----
@@ -490,10 +542,14 @@
}
----
Você utiliza o método `find` da `CategoryFacade` para recuperar o objeto`Category` com base no ID da categoria solicitada. Observe que é necessário difundir `categoryId` para um `Short`, já que é o tipo utilizado para o campo `id` na classe de entidade `Category`.
-4. Clique no badge (image::images/editor-badge.png[]) na margem esquerda para usar a dica do editor para declarar `selectedCategory` como uma variável local dentro do método `doGet`.
+
+[start=4]
+. Clique no badge (image::images/editor-badge.png[]) na margem esquerda para usar a dica do editor para declarar `selectedCategory` como uma variável local dentro do método `doGet`.
image::images/local-variable.png[title="Usar dicas Editor para declarar variáveis locais"]
Como a `selectedCategory` é um tipo de `Category` que ainda não foi importada para a classe, o IDE adiciona automaticamente uma instrução de importação para `entity.Category` na parte superior do arquivo.
-5. Adicione a seguinte linha para colocar o objeto `Category` recuperado no escopo da solicitação.
+
+[start=5]
+. Adicione a seguinte linha para colocar o objeto `Category` recuperado no escopo da solicitação.
[source,java]
----
@@ -510,8 +566,12 @@
request.setAttribute("selectedCategory", selectedCategory);*
}
----
-6. No editor, mude para `category. jsp`. (Pressione Ctrl-Tab e escolha na lista pop-up).
-7. Localize `<p id="categoryTitle">` e faça a seguinte alteração.
+
+[start=6]
+. No editor, mude para `category. jsp`. (Pressione Ctrl-Tab e escolha na lista pop-up).
+
+[start=7]
+. Localize `<p id="categoryTitle">` e faça a seguinte alteração.
[source,xml]
----
@@ -521,7 +581,9 @@
</p>
----
Agora você está utilizando o atributo `selectedCategory`, que acabou de colocar no escopo da solicitação do `ControllerServlet`. Utilizar "`.name`" na expressão EL chama o método `getName` no objeto `Category` dado.
-8. Retorne ao browser e atualize a página da categoria. O nome da categoria selecionada será exibido, agora, na página.
+
+[start=8]
+. Retorne ao browser e atualize a página da categoria. O nome da categoria selecionada será exibido, agora, na página.
image::images/category-page-selected-category.png[title="O nome da categoria selecionada será exibido na página da categoria"]
@@ -554,9 +616,13 @@
}
----
Chamar `getProductCollection()` aqui permite obter uma coleção de todos os `Product`s associados a `selectedCategory`.
-2. Utilize a dica do editor para definir `categoryProducts` como uma variável local para o método `doGet`.
+
+[start=2]
+. Utilize a dica do editor para definir `categoryProducts` como uma variável local para o método `doGet`.
image::images/local-variable2.png[title="Usar dicas Editor para declarar variáveis locais"]
-3. Coloque a coleção de `Products` no escopo da solicitação, de modo que possa ser recuperado do front-end da aplicação.
+
+[start=3]
+. Coloque a coleção de `Products` no escopo da solicitação, de modo que possa ser recuperado do front-end da aplicação.
[source,java]
----
@@ -582,7 +648,9 @@
request.setAttribute("categoryProducts", categoryProducts);
}*
----
-4. Abra o arquivo `category.jsp` no editor e faça a seguinte alteração à tabela de produtos.
+
+[start=4]
+. Abra o arquivo `category.jsp` no editor e faça a seguinte alteração à tabela de produtos.
[source,java]
----
@@ -592,7 +660,9 @@
<c:forEach var="product" items="*${categoryProducts}*" varStatus="iter">
----
A tag `<c:forEach>` agora faz referência à coleção `categoryProducts`. O loop `c:forEach` agora se repetirá sobre cada objeto `Product` contido na coleção e extrairá os dados de acordo.
-5. Pressione F6 (fn-F6 no Mac) para executar o projeto. Navegue para a página da categoria no browser e note que todos os produtos agora são exibidos para cada categoria.
+
+[start=5]
+. Pressione F6 (fn-F6 no Mac) para executar o projeto. Navegue para a página da categoria no browser e note que todos os produtos agora são exibidos para cada categoria.
image::images/category-page-product-table.png[title="A tabela Produto exibe produtos de uma determinada categoria"]
Esta unidade do tutorial forneceu uma breve introdução às tecnologias JPA e EJB. Também descreveu a atribuição das especificações JAVA e como suas implementações de referência são utilizadas pelo servidor de aplicações GlassFish. Em seguida, demonstrou como criar um conjunto de classes de entidade JPA que fornecem uma implementação Java do banco de dados do projeto. Em seguida, seguindo o padrão _fachada de sessão_, mostrou como criar um conjunto de beans de sessão EJB que existem na parte superior das classes de entidade e permitir acesso conveniente a eles. Finalmente, você modificou o projeto `AffableBean` para utilizar os novos beans de sessão e entidades para acesso a banco de dados necessários nas páginas de índice e de categoria.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ru.asciidoc
index d4ca206..d9d2c56 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_ru.asciidoc
@@ -99,12 +99,12 @@
На официальной link:http://java.sun.com/products/ejb/[+странице продукта EJB+] технология EnterPrise JavaBeans описана как "компонентная архитектура клиент-сервер", которая "позволяет быстро и легко разрабатывать распределенные транзакционные безопасные и переносимые приложения." При применении EJB все службы, предоставляемые этой технологией, остаются прозрачными для разработчика, избавляя его от утомительного и часто приводящего к ошибкам добавления кода заготовок. Для новичка в разработке для Java EE потребность в EJB для веб-приложения Java неочевидна. В книге Дебу Панды, Реза Рахмана и Дерека Лейна (Debu Panda, Reza Rahman и Derek Lane) link:http://www.manning.com/panda/[+EJB 3 в действии (EJB 3 In Action)+] роль EJB четко сформулирована:
-[quote]
-----
+[NOTE]
+====
_Многие считают, что технология EJB не требуется для разработки сравнительно простых веб-приложений небольшого размера, но это далеко от действительности. Никто не начинает постройку дома с нуля. Постройка начинается с покупки материалов или найма подрядчика. Точно так же неэффективно разрабатывать приложение уровня предприятия с нуля. Большинство приложений на стороне сервера имеют много общего: бизнес-логику, управление состоянием приложения, сохранение и извлечение информации из реляционной базы данных, управление транзакциями, обеспечение безопасности, выполнение асинхронной обработки, интеграцию систем и так далее.
Контейнер EJB предоставляет эти функциональные возможности в виде встроенных, поэтому компоненты EJB могут использовать их в приложении. Это освобождает разработчика от необходимости изобретать велосипед. Например, при написании модуля обработки кредитных карт в веб-приложении необходимо создать большой объем сложного и приводящего к ошибкам кода для управления транзакциями и контроля безопасности доступа. Можно избежать этого, используя декларативные транзакции и службы безопасности контейнера EJB. Эти службы доступны компонентам EJB при развертывании в контейнере EJB, как и многие другие. Это позволяет создавать высококачественные многофункциональные приложения гораздо быстрее, чем можно подумать._^<<footnote1,[1]>>^
-----
+====
EJB можно рассматривать как компоненты или как классы Java, включенные в проект, а также как _платформу_, предоставляющую множество служб, связанных с уровнем предприятия. Некоторое службы, использованные в этом учебном курсе, описаны в книге link:http://www.manning.com/panda/[+EJB 3 в действии+] следующим образом:
@@ -190,8 +190,12 @@
При выборе источника данных `jdbc/affablebean` среда IDE сканирует базу данных и перечисляет таблицы в панели "Доступные таблицы".
image::images/entity-from-database.png[title="Выберите доступный источник данных для чтения IDE в таблицах баз данных"]
-5. Нажмите кнопку "Добавить", а затем - кнопку "Далее".
-6. Step 3 of the Entity Classes from Database wizard differs slightly between IDE NetBeans 6.8 and 6.9. В зависимости от используемой версии IDE выполните следующие шаги.
+
+[start=5]
+. Нажмите кнопку "Добавить", а затем - кнопку "Далее".
+
+[start=6]
+. Step 3 of the Entity Classes from Database wizard differs slightly between IDE NetBeans 6.8 and 6.9. В зависимости от используемой версии IDE выполните следующие шаги.
* <<68,IDE NetBeans 6.8>>
* <<69,IDE NetBeans 6.9>>
@@ -204,9 +208,15 @@
2. Нажмите кнопку "Создать блок сохранения состояния". Будет открыто диалоговое окно "Создание блока сохранения состояния".
image::images/create-pu.png[title="Используйте диалоговое окно 'Создание блока сохранения состояния' для создания файла persistence.xml"]
_Блок сохранения состояния_ ссылается на набор классов сущностей приложения. Описанное выше диалоговое окно создает файл `persistence.xml`, который используется поставщиком сохранения состояния для определения параметров блока сохранения состояния. Обратите внимание, что для проекта по умолчанию выбран сервер EclipseLink (JPA 2.0). Оставьте для стратегии генерирования таблиц значение `Нет`. Это предотвращает изменения базы данных поставщиком сохранения состояния. Например, если требуется, чтобы поставщик сохранения состояния удалил базу данных, а затем снова создал ее на основе классов сущностей, можно выбрать стратегию `Удалить и создать`. Теперь каждый раз при развертывании проекта будет выполняться это действие.
-3. Нажмите кнопку "Создать".
-4. Отобразится третий экран "Классы сущностей". Обратите внимание, что имена классов сущностей зависят от таблиц базы данных. Например, сущность `CustomerOrder` связана с таблицей базы данных `customer_order`. Также обратите внимание, что по умолчанию выбран параметр "Создание аннотаций именованных запросов для сохраняемых полей". В этом учебном курсе будут использованы различные именованные запросы.
-5. Продолжение смотрите ниже в <<step7,шаге 7>>.
+
+[start=3]
+. Нажмите кнопку "Создать".
+
+[start=4]
+. Отобразится третий экран "Классы сущностей". Обратите внимание, что имена классов сущностей зависят от таблиц базы данных. Например, сущность `CustomerOrder` связана с таблицей базы данных `customer_order`. Также обратите внимание, что по умолчанию выбран параметр "Создание аннотаций именованных запросов для сохраняемых полей". В этом учебном курсе будут использованы различные именованные запросы.
+
+[start=5]
+. Продолжение смотрите ниже в <<step7,шаге 7>>.
[[69]]
@@ -218,7 +228,9 @@
* имена классов сущностей зависят от таблиц базы данных. Например, сущность `CustomerOrder` связана с таблицей базы данных `customer_order`.
* Параметр "Создать аннотации именованных запросов для сохраняемых полей" выбирается по умолчанию. В этом учебном курсе будут использованы различные именованные запросы.
* Флажок "Создать блок сохранения состояния" установлен по умолчанию. _Блок сохранения состояния_ — это набор классов сущностей приложения. Сохранение состояния определяется файлом настройки `persistence.xml`, который используется поставщиком сохранения состояния. Включение этого параметра означает, что мастер создает также файл `persistence.xml` и заполняет его параметрами по умолчанию.
-7. Нажмите кнопку "Завершить". Классы сущностей JPA будут созданы на основе таблиц базы данных `affablebean`. Классы сущностей можно просмотреть в окне "Проекты", развернув только что созданный пакет `entity`. Обратите внимание, что новый блок сохранения состояния появляется в узле "Файлы настройки".
+
+[start=7]
+. Нажмите кнопку "Завершить". Классы сущностей JPA будут созданы на основе таблиц базы данных `affablebean`. Классы сущностей можно просмотреть в окне "Проекты", развернув только что созданный пакет `entity`. Обратите внимание, что новый блок сохранения состояния появляется в узле "Файлы настройки".
image::images/entity-classes.png[title="Узлы для сущностных классов можно будет увидеть в окне Projects ("Проекты")."]
Обратите внимание, что был создан дополнительный класс сущностей `OrderedProductPK`. Таблица `ordered_product` в модели данных использует составной первичный ключ, состоящий из первичных ключей таблиц `customer_order` и `product`. Ознакомьтесь с разделом link:data-model.html#manyToMany[+Проектирование модели данных — создание связей "многие ко многим"+]. Поэтому поставщик сохранения состояния создает отдельный класс сущностей для составного ключа и _внедряет_ его в сущность `OrderedProduct`. Для просмотра класса откройте его в редакторе `OrderedProduct`. Чтобы показать, что внедряемый класс является составным первичным ключом, в JPA используется аннотация `@EmbeddedId`.
@@ -235,9 +247,13 @@
Нажмите сочетание клавиш CTRL+ПРОБЕЛ на аннотации `@EmbeddedId` для вызова документации по интерфейсу API.
image::images/embedded-id.png[title="Для вызова документации по API нажмите сочетание клавиш CTRL+ПРОБЕЛ."]
-8. Откройте в редакторе блок сохранения состояния (`persistence.xml`). Для блоков сохранения состояния в среде IDE, кроме представления XML, доступно представление "Проектирование". Представление "Проектирование" позволяет удобно вносить изменения в параметры проекта, касающиеся управления поставщиком сохранения состояния.
+
+[start=8]
+. Откройте в редакторе блок сохранения состояния (`persistence.xml`). Для блоков сохранения состояния в среде IDE, кроме представления XML, доступно представление "Проектирование". Представление "Проектирование" позволяет удобно вносить изменения в параметры проекта, касающиеся управления поставщиком сохранения состояния.
image::images/persistence-unit.png[title="Представление проектирования AffableBeanPU единицы сохранения"]
-9. Чтобы открыть представление XML, выберите вкладку "XML" в верхней части блока сохранения состояния `AffableBeanPU`. Добавьте в файл следующее свойство.
+
+[start=9]
+. Чтобы открыть представление XML, выберите вкладку "XML" в верхней части блока сохранения состояния `AffableBeanPU`. Добавьте в файл следующее свойство.
[source,xml]
----
@@ -271,15 +287,25 @@
1. Нажмите сочетание клавиш CTRL+N (⌘-N на компьютере Mac) для открытия мастера создания файлов.
2. В категории "Сохранение состояния" выберите "Сеансные компоненты для классов сущностей".
image::images/session-beans-for-entity-classes.png[title="Выберите компоненты Beans сеанса для классов сущностей для создания фасадного сеанса для модели сохраняемости"]
-3. Нажмите кнопку "Далее".
-4. Второй экран "Классы сущностей". Обратите внимание, что все классы сущностей проекта перечислены слева в разделе "Доступные классы сущностей". Нажмите кнопку "Добавить все". Все классы сущностей перемещаются вправо в раздел "Выбранные классы сущностей".
-5. Нажмите кнопку "Далее".
-6. Третий экран "Созданные сеансные компоненты". Введите *session* в качестве имени пакета.
+
+[start=3]
+. Нажмите кнопку "Далее".
+
+[start=4]
+. Второй экран "Классы сущностей". Обратите внимание, что все классы сущностей проекта перечислены слева в разделе "Доступные классы сущностей". Нажмите кнопку "Добавить все". Все классы сущностей перемещаются вправо в раздел "Выбранные классы сущностей".
+
+[start=5]
+. Нажмите кнопку "Далее".
+
+[start=6]
+. Третий экран "Созданные сеансные компоненты". Введите *session* в качестве имени пакета.
image::images/generated-session-beans.png[title="Укажите местоположение загруженных исходных файлов в папке в "Source"."]
*Примечание.* Мастер может использоваться для создания локальных и удаленных интерфейсов к сеансным компонентам. Программирование сеансных компонентов с интерфейсами предпочтительнее (например, скрытие взаимодействия бизнес-объектов за интерфейсом позволяет отделить клиента от бизнес-логики, а при необходимости можно реализовать несколько вариантов интерфейса приложения). В то же время рассмотрение этого процесса выходит за рамки данного учебного курса. Обратите внимание, что версии EJB до 3.1 _требуют_ реализации интерфейса для каждого сеансного компонента.
-7. Нажмите кнопку "Завершить". В среде IDE создаются сеансные компоненты для каждого класса сущностей проекта. В окне "Проекты" разверните новый пакет `session` для просмотра сеансных компонентов.
+
+[start=7]
+. Нажмите кнопку "Завершить". В среде IDE создаются сеансные компоненты для каждого класса сущностей проекта. В окне "Проекты" разверните новый пакет `session` для просмотра сеансных компонентов.
|===
|Net Beans, версия 6.8 |Net Beans, версия 6.9
@@ -289,7 +315,9 @@
*Примечание.* Как показано выше, IDE NetBeans 6.9 обеспечивает незначительные усовершенствования аналогично созданию мастером компонентов сеансов для классов сущностей фасадных классов. А именно, код-заготовка, общий для всех классов, складывается в абстрактный класс, названный `AbstractFacade`. Работая в версии 6.9, откройте любой из созданных фасадных классов (кроме класса `AbstractFacade`). Видно, что этот класс расширяет `AbstractFacade`.
-8. Откройте сессионный фасад в редакторе, например в `ProductFacade`. Все редактируемые сессионные фасады создают link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+], используя аннотацию link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+].
+
+[start=8]
+. Откройте сессионный фасад в редакторе, например в `ProductFacade`. Все редактируемые сессионные фасады создают link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+], используя аннотацию link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+].
[source,java]
----
@@ -300,10 +328,11 @@
Аннотация `@PersistenceContext` используется для добавления в класс интерфейса `EntityManager`, управляемого контейнером. Другими словами, контейнер EJB проекта GlassFish используется для открытия и закрытия интерфейсов `EntityManager`, когда это необходимо. Элемент `unitName` указывает блок сохранения состояния `AffableBeanPU`, который был определен в файле `persistence.xml` приложения.
`EntityManager` (диспетчер сущностей) — внутренний компонент интерфейса API сохранения состояния Java, отвечающий за сохранение состояния в базе данных. В книге link:http://www.manning.com/panda/[+EJB 3 в действии+] `EntityManager` описан следующим образом:
-[quote]
-----
+
+[NOTE]
+====
_Интерфейс JPA `EntityManager` управляет сущностями в терминах реального обеспечения служб сохранения состояния. Когда сущности сообщают поставщику JPA о своем сопоставлении с базой данных, они не сохраняют свое состояние самостоятельно. Интерфейс `EntityManager` считывает метаданные ORM для сущности и производит операции сохранения состояния._
-----
+====
Теперь приложение содержит модель сохранения состояния базы данных `affablebean` в форме классов сущностей JPA. Также оно содержит фасад сеанса, состоящий из компонентов уровня приложения, используемых для доступа к классам сущностей. В следующем разделе показан способ доступа к базе данных при помощи сеансных компонентов и классов сущностей.
@@ -340,13 +369,17 @@
}
----
После добавления аннотации `@EJB` контейнер EJB создает экземпляр переменной `categoryFacade` с EJB `CategoryFacade`.
-3. С помощью подсказок среды IDE добавьте операторы импорта для следующих классов:
+
+[start=3]
+. С помощью подсказок среды IDE добавьте операторы импорта для следующих классов:
* `javax.ejb.EJB`
* `session.CategoryFacade`
При нажатии Ctrl-Shift-I (⌘-Shift-I в Mac) требуемые импорты автоматически добавляются к используемому классу.
-4. Добавьте в класс следующий метод `init`. Веб-контейнер инициализирует сервлет, вызывая свой метод `init`. Это происходит только один раз после загрузки сервлета и до начала обработки запросов.
+
+[start=4]
+. Добавьте в класс следующий метод `init`. Веб-контейнер инициализирует сервлет, вызывая свой метод `init`. Это происходит только один раз после загрузки сервлета и до начала обработки запросов.
[source,java]
----
@@ -371,7 +404,9 @@
image::images/method-signature.png[title="Подведите мышь к методу, удерживая клавишу Ctrl для просмотра его подписи."]
Щелкните гиперссылку для перехода к методу.
-5. С помощью подсказки среды IDE добавьте аннотацию `@Overrides` Метод `init` определяется надклассом `HttpServlet` и сервлетом `GenericServlet`.
+
+[start=5]
+. С помощью подсказки среды IDE добавьте аннотацию `@Overrides` Метод `init` определяется надклассом `HttpServlet` и сервлетом `GenericServlet`.
image::images/override.png[title="С помощью подсказки среды IDE добавьте аннотацию @Overrides "]
Добавление аннотации не обязательно, но дает следующие преимущества:
* Позволяет компилятору проверить, действительно ли переопределяется метод, который предполагается переопределить.
@@ -379,21 +414,31 @@
Дополнительные сведения об аннотациях приведены в курсе link:http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html[+Учебные курсы по Java: аннотации+].
-6. После создания в контексте приложения атрибута, содержащего список категорий, измените страницу-указатель таким образом, чтобы использовался этот атрибут.
+
+[start=6]
+. После создания в контексте приложения атрибута, содержащего список категорий, измените страницу-указатель таким образом, чтобы использовался этот атрибут.
Дважды щелкните узел "Веб-страницы" > `index.jsp` в окне "Проекты", чтобы открыть файл в редакторе.
-7. Закомментируйте (или удалите) оператор `<sql:query>` в начале файла. Для закомментирования кода в редакторе выделите код, затем нажмите Ctrl-/ (⌘-/ в Mac).
+
+[start=7]
+. Закомментируйте (или удалите) оператор `<sql:query>` в начале файла. Для закомментирования кода в редакторе выделите код, затем нажмите Ctrl-/ (⌘-/ в Mac).
image::images/commented-out.png[title="Нажмите Ctrl-/ для закомментирования фрагмента кода в редакторе"]
-8. Отредактируйте открывающий тег `<c:forEach>` так, чтобы его атрибут `items` указывал на новый атрибут контекста приложения `categories`.
+
+[start=8]
+. Отредактируйте открывающий тег `<c:forEach>` так, чтобы его атрибут `items` указывал на новый атрибут контекста приложения `categories`.
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-9. Откройте дескриптор развертывания веб-проекта. Нажмите сочетание клавиш ALT+SHIFT+O (CTRL+SHIFT+O в Mac OS) и в диалоговом окне "Переход к файлу" введите `web`, затем нажмите кнопку "ОК".
+
+[start=9]
+. Откройте дескриптор развертывания веб-проекта. Нажмите сочетание клавиш ALT+SHIFT+O (CTRL+SHIFT+O в Mac OS) и в диалоговом окне "Переход к файлу" введите `web`, затем нажмите кнопку "ОК".
image::images/go-to-file.png[title="С помощью диалогового окна "Переход к файлу" быстро откройте файлы в редакторе"]
-10. Закомментируйте (или удалите) запись `<resource-ref>`. Эта запись требовалась для определения тегами `<sql>` источника данных, зарегистрированного на сервере. Теперь для доступа к базе данных используется JPA, и источник данных `jdbc/affablebean` уже был указан в блоке сохранения состояния. Подробные сведения представлены выше в разделе <<pu,Представление проектирования поставщика сохранения состояния проекта>>.
+
+[start=10]
+. Закомментируйте (или удалите) запись `<resource-ref>`. Эта запись требовалась для определения тегами `<sql>` источника данных, зарегистрированного на сервере. Теперь для доступа к базе данных используется JPA, и источник данных `jdbc/affablebean` уже был указан в блоке сохранения состояния. Подробные сведения представлены выше в разделе <<pu,Представление проектирования поставщика сохранения состояния проекта>>.
Выделите всю запись `<resource-ref>`, затем нажмите Ctrl-/ (⌘-/ в Mac).
@@ -408,7 +453,9 @@
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> *-->*
----
-11. Выполните проект. Нажмите кнопку 'Запустить проект' ( image::images/run-project-btn.png[] ). В браузере откроется страница-указатель проекта, и отобразятся все четыре категории и изображения.
+
+[start=11]
+. Выполните проект. Нажмите кнопку 'Запустить проект' ( image::images/run-project-btn.png[] ). В браузере откроется страница-указатель проекта, и отобразятся все четыре категории и изображения.
image::images/index-page.png[title="Убедитесь в том, что к базе данных добавлены новые таблицы."]
@@ -435,14 +482,18 @@
1. Откройте `category.jsp` в редакторе и закомментируйте (Ctrl-/; ⌘-/ в Mac) операторы JSTL `<sql>`, указанные в верхней части файла.
image::images/comment-out-sql.png[title="Закомментируйте операторы JSTL <sql> на странице категорий"]
-2. Отредактируйте открывающий тег `<c:forEach>` так, чтобы его атрибут `items` указывал на атрибут контекста приложения `categories`. Эта же операция была проведена в файле `index.jsp`.
+
+[start=2]
+. Отредактируйте открывающий тег `<c:forEach>` так, чтобы его атрибут `items` указывал на атрибут контекста приложения `categories`. Эта же операция была проведена в файле `index.jsp`.
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-3. Выполните проект для проверки текущего состояния страницы категории. Нажмите кнопку 'Запустить проект' ( image::images/run-project-btn.png[] ). После отображения страницы-указателя в браузере щелкните одну из категорий. Кнопки категорий в левом столбце отображаются и работают ожидаемым образом.
+
+[start=3]
+. Выполните проект для проверки текущего состояния страницы категории. Нажмите кнопку 'Запустить проект' ( image::images/run-project-btn.png[] ). После отображения страницы-указателя в браузере щелкните одну из категорий. Кнопки категорий в левом столбце отображаются и работают ожидаемым образом.
image::images/category-page-left-column.png[title="Кнопки категорий в левом столбце отображаются и работают ожидаемым образом."]
@@ -474,7 +525,9 @@
*Примечание.* Логика определения выбранной категории кнопками левого столбца уже реализована в `category.jsp` с использованием выражения EL, что сравнимо с вызовом `getQueryString()` в сервлете. Выражение EL: `pageContext.request.queryString`.
-3. Добавьте в оператор `if` следующую строку кода.
+
+[start=3]
+. Добавьте в оператор `if` следующую строку кода.
[source,java]
----
@@ -489,10 +542,14 @@
}
----
С помощью принадлежащего классу `CategoryFacade``поискового` метода возвращается объект `Category`, который связан с идентификатором запрашиваемой категории. Обратите внимание, что необходимо привести `categoryId` к типу `Short`, поскольку такой тип используется в поле `id` класса сущностей `Category`.
-4. Щелкните метку ( image::images/editor-badge.png[] ) на левой границе для использования подсказки в редакторе для объявления `selectedCategory` как локальной переменной в методе `doGet`.
+
+[start=4]
+. Щелкните метку ( image::images/editor-badge.png[] ) на левой границе для использования подсказки в редакторе для объявления `selectedCategory` как локальной переменной в методе `doGet`.
image::images/local-variable.png[title="Использование подсказок редактора для объявления локальных переменных"]
Поскольку `selectedCategory` имеет тип `Category`, который не был ранее импортирован в класс, среда IDE автоматически добавляет выражение импорта для `entity.Category` в начало файла.
-5. Чтобы поместить полученный объект `Category` в контекст запроса, добавьте следующую строку.
+
+[start=5]
+. Чтобы поместить полученный объект `Category` в контекст запроса, добавьте следующую строку.
[source,java]
----
@@ -509,8 +566,12 @@
request.setAttribute("selectedCategory", selectedCategory);*
}
----
-6. Переключитесь в редакторе к файлу `category.jsp`. Для этого нажмите сочетание клавиш CTRL+TAB и выберите его во всплывающем списке.
-7. Найдите текст `<p id="categoryTitle">` и внесите следующие изменения.
+
+[start=6]
+. Переключитесь в редакторе к файлу `category.jsp`. Для этого нажмите сочетание клавиш CTRL+TAB и выберите его во всплывающем списке.
+
+[start=7]
+. Найдите текст `<p id="categoryTitle">` и внесите следующие изменения.
[source,xml]
----
@@ -520,7 +581,9 @@
</p>
----
Теперь используется атрибут `selectedCategory`, помещенный в контекст запроса в `ControllerServlet`. С помощью "`.name`" в выражении EL вызывается метод `getName` в данном объекте `Category`.
-8. Переключитесь обратно на окно браузера и обновите страницу категорий. Теперь на странице отображается имя выбранной категории.
+
+[start=8]
+. Переключитесь обратно на окно браузера и обновите страницу категорий. Теперь на странице отображается имя выбранной категории.
image::images/category-page-selected-category.png[title="Теперь на странице отображается имя выбранной категории."]
@@ -553,9 +616,13 @@
}
----
Здесь вызов `getProductCollection` позволяет получить коллекцию всех продуктов `Product`, связанных с выбранной категорией `selectedCategory`.
-2. Используйте подсказку редактора для определения `categoryProducts` в качестве локальной переменной для метода `doGet`.
+
+[start=2]
+. Используйте подсказку редактора для определения `categoryProducts` в качестве локальной переменной для метода `doGet`.
image::images/local-variable2.png[title="Использование подсказок редактора для объявления локальных переменных"]
-3. Поместите коллекцию продуктов `Product` в контекст запроса, чтобы ее можно было извлечь из внешнего интерфейса приложения.
+
+[start=3]
+. Поместите коллекцию продуктов `Product` в контекст запроса, чтобы ее можно было извлечь из внешнего интерфейса приложения.
[source,java]
----
@@ -581,7 +648,9 @@
request.setAttribute("categoryProducts", categoryProducts);
}*
----
-4. Откройте в редакторе `category.jsp` и внесите в таблицу запросов следующее изменение.
+
+[start=4]
+. Откройте в редакторе `category.jsp` и внесите в таблицу запросов следующее изменение.
[source,java]
----
@@ -591,7 +660,9 @@
<c:forEach var="product" items="*${categoryProducts}*" varStatus="iter">
----
Тег `<c:forEach>` теперь ссылается на набор `categoryProducts`. Цикл `c:forEach` теперь выполняется для каждого объекта `Product`, содержащегося в коллекции, и извлекает соответствующие данные.
-5. Для запуска проекта нажмите клавишу F6 (или сочетание клавиш fn+F6 в Mac OS) В браузере перейдите к странице категории и обратите внимание, что для каждой категории отображаются все продукты.
+
+[start=5]
+. Для запуска проекта нажмите клавишу F6 (или сочетание клавиш fn+F6 в Mac OS) В браузере перейдите к странице категории и обратите внимание, что для каждой категории отображаются все продукты.
image::images/category-page-product-table.png[title="Убедитесь в том, что к базе данных добавлены новые таблицы."]
Этот учебный курс — краткое введение в технологии JPA и EJB. Также здесь описана роль спецификаций Java и использование примеров их реализации в сервере приложений GlassFish. Показано, как создать набор классов сущностей JPA, предоставляющих реализацию базы данных проектов на уровне Java. Затем в соответствии с шаблоном _фасад сеанса_ показано создание набора сеансных компонентов EJB, которые расположены выше уровнем, чем классы сущностей, и предоставляют удобный доступ к ним. Наконец, проект `AffableBean` изменен для того, чтобы использовать новые сеансные компоненты и сущности для доступа к базе данных. Это требовалось в странице-указателе и странице категорий.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_zh_CN.asciidoc
index 552fd52..1665d85 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/entity-session_zh_CN.asciidoc
@@ -100,12 +100,12 @@
官方的 link:http://java.sun.com/products/ejb/[+EJB 产品页+]将 EnterPrise JavaBeans 技术描述为“服务器端组件体系结构”,可用于“快速简便地开发分布式、事务性、安全且可移植的应用程序”。可以将 EJB(即,企业 Bean)应用到项目中,该项技术提供的服务对于开发人员来说仍然是透明的,从而消除了添加大量样板化代码这种冗长且通常容易出错的任务,否则必须要完成这些任务。如果对 EE 开发不熟悉,可能会质疑 EJB 在 Java web 应用程序中的必要性。由 Debu Panda、Reza Rahman 和 Derek Lane 撰写的书籍link:http://www.manning.com/panda/[+《EJB 3 实践》+]对 EJB 技术的使用进行了详细的解释:
-[quote]
-----
+[NOTE]
+====
_虽然许多人认为用 EJB 开发相对简单的中型 Web 应用程序有些小题大做,但事实并非如此。建造房屋时,您不会一切都从头开始。而是根据需要购买材料,甚至购买承办商的服务。从头构建企业应用程序也是不切实际的。大多数服务器端应用程序有许多共同之处,包括改动业务逻辑、管理应用程序状态、存储和检索来自关系数据库的消息、管理事务、实现安全、执行异步处理和整合系统等。
作为一个框架,EJB 容器将这些通用功能以快捷服务的方式提供,以便 EJB 组件可以在应用程序中使用,而不必再浪费时间做无用功。例如,假定当您在 Web 应用程序中构建信用卡模块时,编写大量复杂而又容易出错的代码来管理事务和安全访问控制。通过使用 EJB 容器提供的声明性事务和安全服务,可以避免这些事情。在将这些服务及许多其他服务部署到 EJB 容器之后,它们即可用于 EJB 组件。这意味着编写高质量、功能丰富的应用程序可能要比想象的要快许多。_^<<footnote1,[1]>>^
-----
+====
可以将 EJB 视为纳入到项目中的组件或 Java 类,以及提供许多与企业相关服务的_框架_。link:http://www.manning.com/panda/[+《EJB 3 操作》+]介绍了本教程中使用的以下一些服务:
@@ -191,8 +191,12 @@
当选择 `jdbc/affablebean` 数据源时,IDE 对数据库进行扫描,并且在 "Available Tables"(可用表)窗格中列出数据库表。
image::images/entity-from-database.png[title="选择可用数据源以便让 IDE 在数据库表中进行读取"]
-5. 单击 "Add All"(全部添加)按钮,然后单击 "Next"(下一步)。
-6. “通过数据库生成实体类”向导的步骤 3 在 NetBeans IDE 6.8 与 6.9 之间略有不同。根据所使用的 IDE 版本,相应执行以下步骤。
+
+[start=5]
+. 单击 "Add All"(全部添加)按钮,然后单击 "Next"(下一步)。
+
+[start=6]
+. “通过数据库生成实体类”向导的步骤 3 在 NetBeans IDE 6.8 与 6.9 之间略有不同。根据所使用的 IDE 版本,相应执行以下步骤。
* <<68,NetBeans IDE 6.8>>
* <<69,NetBeans IDE 6.9>>
@@ -205,9 +209,15 @@
2. 单击 "Create Persistence Unit"(创建持久性单元)按钮。"Create Persistence Unit"(创建持久性单元)对话框打开。
image::images/create-pu.png[title="使用 "]
_持久性单元_是指应用程序中存在的实体类集合。上述对话框生成了 `persistence.xml` 文件,持久性提供器使用该文件指定持久性单元的配置设置。注:"EclipseLink (JPA 2.0)" 是与项目相关的服务器的默认选项。将 "Table Generation Strategy"(表生成策略)集合设置为 `None`(无)。这可以防止持久性提供器影响数据库。(例如,如果希望删除持久性提供器,然后重新创建基于现有实体类的数据库,则可以将策略设置为 `Drop and Create`(删除并创建)。每次部署项目时,都会使用该操作。)
-3. 单击 "Create"(创建)。
-4. 返回到“步骤 3:Entity Classes(实体类)”中,注意实体的类名称是基于数据表。例如,`CustomerOrder` 实体将映射到 `customer_order` 数据库表中。同时注:在默认情况下,已选中 "Generate Named Query Annotations for Persistent Fields"(为持久性字段生成已命名的查询批注)。我们将在本教程的以后部分使用不同的命名查询。
-5. 继续执行下面的<<step7,步骤 7>>。
+
+[start=3]
+. 单击 "Create"(创建)。
+
+[start=4]
+. 返回到“步骤 3:Entity Classes(实体类)”中,注意实体的类名称是基于数据表。例如,`CustomerOrder` 实体将映射到 `customer_order` 数据库表中。同时注:在默认情况下,已选中 "Generate Named Query Annotations for Persistent Fields"(为持久性字段生成已命名的查询批注)。我们将在本教程的以后部分使用不同的命名查询。
+
+[start=5]
+. 继续执行下面的<<step7,步骤 7>>。
[[69]]
@@ -219,7 +229,9 @@
* 实体的类名是基于数据库表的。例如,`CustomerOrder` 实体将映射到 `customer_order` 数据库表。
* 默认情况下,"Generate Named Query Annotations for Persistent Fields"(为持久性字段生成已命名的查询批注)选项处于选中状态。我们将在本教程的以后部分使用不同的命名查询。
* 默认情况下,"Create Persistence Unit"(创建持久性单元)选项处于选中状态。_持久性单元_是应用程序中存在的实体类集合。持久性单元是由 `persistence.xml` 配置文件定义的,该文件可供持久性提供器读取。因此,启用此选项意味着,该向导还将生成 `persistence.xml` 文件,并使用默认设置对其进行填充。
-7. 单击 "Finish"(完成)。将生成基于 `affablebean` 数据库表的 JPA 实体类。通过展开新创建的 `entity` 包,可以在 "Projects"(项目)窗口中检查实体类。另请注意,新的持久性单元位于 "Configuration Files"(配置文件)节点的下方。
+
+[start=7]
+. 单击 "Finish"(完成)。将生成基于 `affablebean` 数据库表的 JPA 实体类。通过展开新创建的 `entity` 包,可以在 "Projects"(项目)窗口中检查实体类。另请注意,新的持久性单元位于 "Configuration Files"(配置文件)节点的下方。
image::images/entity-classes.png[title="在 "]
注:向导将生成一个其他的实体类 `OrderedProductPK`。回想一下数据模型的 `ordered_product` 表使用由 `customer_order` 和 `product` 表的主键组成的复合主键。(请参见link:data-model.html#manyToMany[+设计数据模型 - 创建多对多关系+]。)为此,持久性提供器为复合键创建单独的实体类,并且将其_嵌入_到 `OrderedProduct` 实体中。可以在编辑器中打开 `OrderedProduct` 以检查该实体。JPA 使用 `@EmbeddedId` 标注来表示该可嵌入类是复合主键。
@@ -236,9 +248,13 @@
在 `@EmbeddedId` 标注上按 Ctrl-空格组合键以调用 API 文档。
image::images/embedded-id.png[title="按 Ctrl-空格键可调用 API 文档"]
-8. 在编辑器中打开持久性单元 (`persistence.xml`)。除了 XML 视图之外,IDE 还为持久性单位提供 "Design"(设计)视图。"Design"(设计)视图为项目持久性提供器管理的配置更改提供一个便利的方法。
+
+[start=8]
+. 在编辑器中打开持久性单元 (`persistence.xml`)。除了 XML 视图之外,IDE 还为持久性单位提供 "Design"(设计)视图。"Design"(设计)视图为项目持久性提供器管理的配置更改提供一个便利的方法。
image::images/persistence-unit.png[title="AffableBeanPU 持久性单元的设计视图"]
-9. 单击 `AffableBeanPU` 持久性单元顶部的 XML 标签以打开 XML 视图。在文件中添加以下属性。
+
+[start=9]
+. 单击 `AffableBeanPU` 持久性单元顶部的 XML 标签以打开 XML 视图。在文件中添加以下属性。
[source,xml]
----
@@ -272,15 +288,25 @@
1. 按 Ctrl-N 组合键(在 Mac 上为 ⌘-N 组合键)打开文件向导。
2. 选择 "Persistence"(持久性)类别,然后选择 "Session Beans for Entity Classes"(实体类的会话 Bean)。
image::images/session-beans-for-entity-classes.png[title="选择 "]
-3. 单击 "Next"(下一步)。
-4. 在“步骤 2:Entity Classes(实体类)”中,请注意项目中包含的所有实体类都列在 "Available Entity Classes"(可用的实体类)的左下方。单击 "Add All"(全部添加)。所有实体类都将移至 "Selected Entity Classes"(选定的实体类)右下方。
-5. 单击 "Next"(下一步)。
-6. 在步骤 3:生成的会话 Bean 中,在 "Package"(包)字段中键入 *session*。
+
+[start=3]
+. 单击 "Next"(下一步)。
+
+[start=4]
+. 在“步骤 2:Entity Classes(实体类)”中,请注意项目中包含的所有实体类都列在 "Available Entity Classes"(可用的实体类)的左下方。单击 "Add All"(全部添加)。所有实体类都将移至 "Selected Entity Classes"(选定的实体类)右下方。
+
+[start=5]
+. 单击 "Next"(下一步)。
+
+[start=6]
+. 在步骤 3:生成的会话 Bean 中,在 "Package"(包)字段中键入 *session*。
image::images/generated-session-beans.png[title="指定新会话 Bean 的位置以及是否创建接口"]
*注:*可以使用该向导为会话 Bean 生成本地接口和远程接口。虽然将会话 Bean 编程为接口有一定的益处(例如,通过将业务对象交互隐藏在接口后面,可以进一步将客户端与业务逻辑分离。这还意味着可以在需要时为应用程序接口的多个实现编写代码),便这并不在教程讨论的范围之内。注:EJB 3.1 之前的版本_需要_为每个会话 Bean 实现一个接口。
-7. 单击 "Finish"(完成)。IDE 将为项目中包含的每个实体类生成会话 Bean。在 "Projects"(项目)窗口中,展开新的 `session` 包,检查会话 Bean。
+
+[start=7]
+. 单击 "Finish"(完成)。IDE 将为项目中包含的每个实体类生成会话 Bean。在 "Projects"(项目)窗口中,展开新的 `session` 包,检查会话 Bean。
|===
|NetBeans 6.8 |NetBeans 6.9
@@ -290,7 +316,9 @@
*注:*如上所示,在 NetBeans IDE 6.9 中,实体类的会话 Bean 向导生成 Facade 类的方式略有改进。换而言之,将所有类共用的样板化代码提取到名为 `AbstractFacade` 的抽象类中。如果使用的是版本 6.9,请打开已生成的任何 Facade 类(`AbstractFacade` 除外)。您将会看到该类是对 `AbstractFacade` 的扩展。
-8. 在编辑器中打开一个会话 Facade,例如 `ProductFacade`。所有生成的会话 Facade 都使用 link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+] 标注实例化 link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+]。
+
+[start=8]
+. 在编辑器中打开一个会话 Facade,例如 `ProductFacade`。所有生成的会话 Facade 都使用 link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+] 标注实例化 link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+]。
[source,java]
----
@@ -301,10 +329,11 @@
`@PersistenceContext` 标注用于将容器管理的 `EntityManager` 注入类中。换而言之,我们依赖 GlassFish 的 EJB 容器,根据需要打开和关闭 `EntityManager`。`unitName` 元素用于指定 `AffableBeanPU` 持久性单元,该持久性单元已在应用程序的 `persistence.xml` 文件中定义。
`EntityManager` 是 Java 持久性 API 的有机组成部分,负责在数据库上执行持久性操作。link:http://www.manning.com/panda/[+《EJB 3 实践》+]对 `EntityManager` 的介绍如下所示:
-[quote]
-----
+
+[NOTE]
+====
_JPA `EntityManager` 接口通过实际提供持久性服务管理实体。虽然实例告诉 JPA 提供器其映射到数据库的方式,但它们不会保存其本身。`EntityManager` 接口读取实体的 ORM 元数据,并执行持久性操作。_
-----
+====
现在,应用程序包含 `affablebean` 数据库的 JPA 实体类型形式的持久性模型。它还包括一个由可用于访问实体类的企业 Bean 构成的会话 Facade。下一部分演示如何使用会话 Bean 和实体类访问数据库。
@@ -341,13 +370,17 @@
}
----
`@EJB` 标注指示 EJB 容器使用命名为 `CategoryFacade` 的 EJB 来实例化 `categoryFacade` 变量。
-3. 使用 IDE 的提示来为以下项添加导入语句:
+
+[start=3]
+. 使用 IDE 的提示来为以下项添加导入语句:
* `javax.ejb.EJB`
* `session.CategoryFacade`
按 Ctrl-Shift-I 组合键(在 Mac 上为 ⌘-Shift-I 组合键)自动将所需导入添加到类中。
-4. 将以下 `init` 方法添加到类中。Web 容器通过调用其 `init` 方法初始化 Servlet。这只在载入 Servlet 之后以及开始服务请求之前发生一次。
+
+[start=4]
+. 将以下 `init` 方法添加到类中。Web 容器通过调用其 `init` 方法初始化 Servlet。这只在载入 Servlet 之后以及开始服务请求之前发生一次。
[source,java]
----
@@ -372,7 +405,9 @@
image::images/method-signature.png[title="将鼠标悬停在方法上并同时按住 Ctrl 键可查看其签名"]
单击超链接可以直接导航到该方法。
-5. 使用 IDE 的提示添加 `@Overrides` 标注。`init` 方法是通过 `HttpServlet` 的超类 `GenericServlet` 定义的。
+
+[start=5]
+. 使用 IDE 的提示添加 `@Overrides` 标注。`init` 方法是通过 `HttpServlet` 的超类 `GenericServlet` 定义的。
image::images/override.png[title="使用 IDE 的提示向方法添加 @Overrides 标注"]
添加标注不是必需的,但是,它提供了若干优点:
* 通过它可使用编译器检查确保实际覆盖某个假定要覆盖的方法。
@@ -380,21 +415,31 @@
有关标注的详细信息,请参见 link:http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html[+Java 教程:标注+]。
-6. 现在已经设置了包含类别列表的应用程序范围内的属性,请修改索引页以访问新创建的属性。
+
+[start=6]
+. 现在已经设置了包含类别列表的应用程序范围内的属性,请修改索引页以访问新创建的属性。
在 "Projects"(项目)窗口中的双击 "Web Pages"(Web 页)> `index.jsp` 节点以在编辑器中打开该文件。
-7. 注释掉(或删除)列在文件顶部的 `<sql:query>` 语句。要在编辑器中注释掉代码,请突出显示该代码,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
+
+[start=7]
+. 注释掉(或删除)列在文件顶部的 `<sql:query>` 语句。要在编辑器中注释掉代码,请突出显示该代码,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
image::images/commented-out.png[title="按 Ctrl-/ 组合键可在编辑器中注释掉代码片段"]
-8. 修改打开的 `<c:forEach>` 标记,以便 `items` 属性引用新的应用程序范围内的 `categories` 属性。
+
+[start=8]
+. 修改打开的 `<c:forEach>` 标记,以便 `items` 属性引用新的应用程序范围内的 `categories` 属性。
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-9. 打开项目的 Web 部署描述符。按 Alt-Shift-O 组合键(在 Mac 上为 Ctrl-Shift-O 组合键)并且在 "Go to File"(转至文件)对话框中,键入 "`Web`",然后单击“确定”。
+
+[start=9]
+. 打开项目的 Web 部署描述符。按 Alt-Shift-O 组合键(在 Mac 上为 Ctrl-Shift-O 组合键)并且在 "Go to File"(转至文件)对话框中,键入 "`Web`",然后单击“确定”。
image::images/go-to-file.png[title="使用 "]
-10. 注释掉(或删除)`<resource-ref>` 条目。`<sql>` 标记需要使用此条目来标识服务器上注册的数据源。现在,我们依靠 JPA 访问数据库,并且已在持久性单元中指定了 `jdbc/affablebean` 数据源。(请参见上文的<<pu,项目持久性单元的 "Design"(设计)视图>>。)
+
+[start=10]
+. 注释掉(或删除)`<resource-ref>` 条目。`<sql>` 标记需要使用此条目来标识服务器上注册的数据源。现在,我们依靠 JPA 访问数据库,并且已在持久性单元中指定了 `jdbc/affablebean` 数据源。(请参见上文的<<pu,项目持久性单元的 "Design"(设计)视图>>。)
突出显示整个 `<resource-ref>` 条目,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
@@ -409,7 +454,9 @@
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> *-->*
----
-11. 运行项目。单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。项目的索引页在浏览器中打开,您可以看到所有四个类别名称和图像都显示出来。
+
+[start=11]
+. 运行项目。单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。项目的索引页在浏览器中打开,您可以看到所有四个类别名称和图像都显示出来。
image::images/index-page.png[title="确保索引页能够检索类别详细信息"]
@@ -436,14 +483,18 @@
1. 在编辑器中打开 `category.jsp`,然后注释掉(Ctrl-/;在 Mac 上为 ⌘-/)在文件顶部列出的 JSTL `<sql>` 语句。
image::images/comment-out-sql.png[title="在类别页中注释掉 JSTL <sql> 语句"]
-2. 修改打开的 `<c:forEach>` 标记,以便 `items` 属性引用应用程序范围内 `categories` 属性。(这与上面对 `index.jsp` 的操作相同。)
+
+[start=2]
+. 修改打开的 `<c:forEach>` 标记,以便 `items` 属性引用应用程序范围内 `categories` 属性。(这与上面对 `index.jsp` 的操作相同。)
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-3. 运行项目以检查类别页的当前状态。单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。当在浏览器中打开项目的索引页时,单击四个类别中的任何一个。左列中的类别按钮按预期显示和运行。
+
+[start=3]
+. 运行项目以检查类别页的当前状态。单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。当在浏览器中打开项目的索引页时,单击四个类别中的任何一个。左列中的类别按钮按预期显示和运行。
image::images/category-page-left-column.png[title="左栏中的类别按钮按预期显示和运行"]
@@ -475,7 +526,9 @@
*注:*在左列类别按钮中,确定所选定类别的逻辑已在 `category.jsp` 中使用 EL 表达式实现,这种表达式相当于在 Servlet 中调用 `getQueryString()`。EL 表达式是:`pageContext.request.queryString`。
-3. 在 `if` 语句内添加以下代码行。
+
+[start=3]
+. 在 `if` 语句内添加以下代码行。
[source,java]
----
@@ -490,10 +543,14 @@
}
----
根据请求的类别 ID,使用 `CategoryFacade` 的 `find` 方法检索 `Category` 对象。请注意,必须将 `categoryId` 强制转换为 `Short`,因为这是用于 `Category` 实体类中 `id` 字段的类型。
-4. 单击左旁注中的标记 (image::images/editor-badge.png[]) 以使用编辑器提示在 `doGet` 方法中将 `selectedCategory` 声明为一个局部变量。
+
+[start=4]
+. 单击左旁注中的标记 (image::images/editor-badge.png[]) 以使用编辑器提示在 `doGet` 方法中将 `selectedCategory` 声明为一个局部变量。
image::images/local-variable.png[title="使用编辑器提示声明局部变量"]
因为 `selectedCategory` 属于 `Category` 类型(尚未导入类中),所以,IDE 会将 `entity.Category` 的 import 语句自动添加到文件的顶部。
-5. 添加下列行以将检索的 `Category` 对象置入请求作用域中。
+
+[start=5]
+. 添加下列行以将检索的 `Category` 对象置入请求作用域中。
[source,java]
----
@@ -510,8 +567,12 @@
request.setAttribute("selectedCategory", selectedCategory);*
}
----
-6. 在编辑器中,切换到 `category.jsp`。(按 Ctrl-Tab 组合键,并从弹出式列表中选择。)
-7. 找到 `<p id="categoryTitle">`,进行以下更改。
+
+[start=6]
+. 在编辑器中,切换到 `category.jsp`。(按 Ctrl-Tab 组合键,并从弹出式列表中选择。)
+
+[start=7]
+. 找到 `<p id="categoryTitle">`,进行以下更改。
[source,xml]
----
@@ -521,7 +582,9 @@
</p>
----
现在使用的是 `selectedCategory` 属性,即刚刚从 `ControllerServlet` 添加到请求作用域的属性。在 EL 表达式内使用 "`.name`" 时,会对给定 `Category` 对象调用 `getName` 方法。
-8. 切换回浏览器,并刷新类别页。现在,选定的类别的名称显示在页面中。
+
+[start=8]
+. 切换回浏览器,并刷新类别页。现在,选定的类别的名称显示在页面中。
image::images/category-page-selected-category.png[title="所选类别名称显示在类别页中"]
@@ -554,9 +617,13 @@
}
----
此处,调用 `getProductCollection()` 可使我们获取与 `selectedCategory` 相关联的所有 `Product` 的集合。
-2. 使用编辑器的提示,将 `categoryProducts` 定义为 `doGet` 方法的局部变量。
+
+[start=2]
+. 使用编辑器的提示,将 `categoryProducts` 定义为 `doGet` 方法的局部变量。
image::images/local-variable2.png[title="使用编辑器提示声明局部变量"]
-3. 将 `Product` 集合置于请求作用域中,以便从应用程序的前端对其进行检索。
+
+[start=3]
+. 将 `Product` 集合置于请求作用域中,以便从应用程序的前端对其进行检索。
[source,java]
----
@@ -582,7 +649,9 @@
request.setAttribute("categoryProducts", categoryProducts);
}*
----
-4. 在编辑器中打开 `category.jsp` 文件,并对 product 表做出下列更改。
+
+[start=4]
+. 在编辑器中打开 `category.jsp` 文件,并对 product 表做出下列更改。
[source,java]
----
@@ -592,7 +661,9 @@
<c:forEach var="product" items="*${categoryProducts}*" varStatus="iter">
----
现在 `<c:forEach>` 标记可以引用 `categoryProducts` 集合。现在,`c:forEach` 循环将对该集合中包含的每个 `Product` 对象进行迭代,并且相应地提取数据。
-5. 按 F6 键(在 Mac 上为 fn-F6 组合键)运行项目。在浏览器中导航至类别页,并注意到现在将为每种类别显示所有产品。
+
+[start=5]
+. 按 F6 键(在 Mac 上为 fn-F6 组合键)运行项目。在浏览器中导航至类别页,并注意到现在将为每种类别显示所有产品。
image::images/category-page-product-table.png[title="产品表显示给定类别的产品"]
本单元简要地介绍了 JPA 和 EJB 技术。同时还介绍 Java 规范的角色,以及 GlassFish 应用服务器如何使用引用实现。其次,演示如何创建提供项目数据库的 Java 实现的 JPA 实体类集。然后,按照_会话 Facade _模式,演示如何创建 EJB 会话 Bean 集,这些 Bean 存在于实体类的顶部,并且可以更方便地对其进行访问。最后,修改 `AffableBean` 项目以利用新的会话 Bean 和实体进行索引页和类别页所需的数据库访问。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/intro.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/intro.asciidoc
index 039c6eb..c8fc4a5 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/intro.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/intro.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Introduction
-==== Tutorial Contents
+== Tutorial Contents
1. *Introduction*
* <<about,About this Tutorial>>
@@ -40,18 +40,42 @@
* <<ide,Why use an IDE?>>
* <<netBeans,Why use NetBeans?>>
* <<seeAlso,See Also>>
-2. link:design.html[+Designing the Application+]
-3. link:setup-dev-environ.html[+Setting up the Development Environment+]
-4. link:data-model.html[+Designing the Data Model+]
-5. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
-6. link:connect-db.html[+Connecting the Application to the Database+]
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=2]
+. link:design.html[+Designing the Application+]
+
+[start=3]
+. link:setup-dev-environ.html[+Setting up the Development Environment+]
+
+[start=4]
+. link:data-model.html[+Designing the Data Model+]
+
+[start=5]
+. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
+
+[start=6]
+. link:connect-db.html[+Connecting the Application to the Database+]
+
+[start=7]
+. link:entity-session.html[+Adding Entity Classes and Session Beans+]
+
+[start=8]
+. link:manage-sessions.html[+Managing Sessions+]
+
+[start=9]
+. link:transaction.html[+Integrating Transactional Business Logic+]
+
+[start=10]
+. link:language.html[+Adding Language Support+]
+
+[start=11]
+. link:security.html[+Securing the Application+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language.asciidoc
index d17acae..8b37cf6 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language.asciidoc
@@ -30,28 +30,6 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Adding Language Support
-==== Tutorial Contents
-
-1. link:intro.html[+Introduction+]
-2. link:design.html[+Designing the Application+]
-3. link:setup-dev-environ.html[+Setting up the Development Environment+]
-4. link:data-model.html[+Designing the Data Model+]
-5. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
-6. link:connect-db.html[+Connecting the Application to the Database+]
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. *Adding Language Support*
-* <<resourceBundles,Understanding Resource Bundles>>
-* <<multilingual,Making Pages Multilingual>>
-* <<toggle,Implementing a Language Toggle>>
-* <<seeAlso,See Also>>
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
The goal of this tutorial unit is to demonstrate how to enable language support for a web application. "Language support" here refers to the ability to display page views according to the customer-specified languages. Within the context of the `AffableBean` application, we have agreed to provide support for both English and Czech, as per the previously outlined link:design.html#requirements[+customer requirements+].
In order to accomplish this, you rely on Java's support for internationalization. You create a _resource bundle_ for each language and let the Java runtime environment determine the appropriate language for incoming client requests. You also implement a 'language toggle' to enable users to switch the languages manually.
@@ -92,8 +70,8 @@
In Java, a resource bundle is a representation of the link:http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/ResourceBundle.html[+`java.util.ResourceBundle`+] class. As stated in the Javadoc,
-[quote]
-----
+[NOTE]
+====
_Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.
This allows you to write programs that can:_
@@ -101,8 +79,7 @@
* _be easily localized, or translated, into different languages_
* _handle multiple locales at once_
* _be easily modified later to support even more locales_
-
-----
+====
From the Javadoc, you can also note that the `ResourceBundle` is parent to both link:http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/ListResourceBundle.html[+`ListResourceBundle`+] and link:http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/PropertyResourceBundle.html[+`PropertyResourceBundle`+]. In this tutorial we utilize the `PropertyResourceBundle`, which manages resources as text files that use the `.properties` extension and contain locale-specific information in the form of key-value pairs. With new each translation, a new version of the resource bundle is created by appending the locale identifier to the base name using an underscore ('`_`'). For example, snippets from two of the resource bundles you create in this tutorial look as follows:
@@ -165,26 +142,39 @@
If you receive an error when running the project, revisit the link:setup.html[+setup instructions+], which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Begin by creating a default resource bundle to contain text used in page views. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
-4. Under Categories select Other, then under File Types select Properties File.
+
+[start=3]
+. Begin by creating a default resource bundle to contain text used in page views. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
+
+[start=4]
+. Under Categories select Other, then under File Types select Properties File.
image::images/new-file-wzd.png[title="Create a new resource bundle using the File wizard"]
Note that the wizard provides a description for the selected file type:
-[quote]
-----
+
+[NOTE]
+====
_Creates a resource bundle (`.properties`) file suitable for internationalizing applications by separating out all human-visible text strings from your code. Resource bundle files can also be used to collect other types of strings, such as properties for Ant scripts. The created resource bundle contains only one locale, but you can add additional locales from the created file's contextual menu. The bundle can be edited in a text file (property-file format) for a specific locale or in a table that displays information for all locales._
-----
-5. Click Next. In the Name and Location step, name the file `messages` and type in `src/java/resources` in the Folder field. This will instruct the wizard to place the resource bundle in a new package named `resources`.
+====
+
+[start=5]
+. Click Next. In the Name and Location step, name the file `messages` and type in `src/java/resources` in the Folder field. This will instruct the wizard to place the resource bundle in a new package named `resources`.
image::images/new-properties-file-wzd.png[title="Specify the name and location of the resource bundle"]
-6. Click Finish. The `messages.properties` resource bundle is generated and opens in the editor.
+
+[start=6]
+. Click Finish. The `messages.properties` resource bundle is generated and opens in the editor.
Note that the new `messages.properties` file name does not have a language code appended to it, as was previously described. This is because this file will be used as the _default_ resource bundle. The default resource bundle is applied when the Java runtime environment does not find a direct match for the requested locale.
-7. Open the project's `index.jsp` file in the editor and note that the following text is currently used:
+
+[start=7]
+. Open the project's `index.jsp` file in the editor and note that the following text is currently used:
* *Greeting:* `Welcome to the online home of the Affable Bean Green Grocer.`
* *Introductory Message:* `Enjoy browsing and learning more about our unique home delivery service bringing you fresh organic produce, dairy, meats, breads and other delicious and healthy items to your doorstep.`
Also, note that we'll need language-specific names for the four categories that display when `index.jsp` renders in the browser. Since these names are currently taken from the database, we can use them as keys in the resource bundle.
Recall that one of the <<impDeets,implementation details>> outlined above states that "_if the browser's preferred language is neither English nor Czech, the site displays text in English._" Therefore, the values that we apply to the `messages.properties` file will be in English.
-8. In the `messages.properties` file, begin adding key-value pairs for the text used in the welcome page. Add the following content.
+
+[start=8]
+. In the `messages.properties` file, begin adding key-value pairs for the text used in the welcome page. Add the following content.
[source,java]
----
@@ -202,17 +192,27 @@
Comments are added using a number sign ('`#`'). Also, because the `fruit & veg` category name contains spaces, it is necessary to escape the space characters using a backslash ('`\`') in order to apply the name as a resource bundle key.
We are now finished with the default resource bundle for the application's welcome page. Let's continue by creating resource bundles for the customer-specified languages.
-9. In the Projects window, expand the Source Packages node, then right-click the `resources` > `messages.properties` file node and choose Customize. The Customizer dialog opens.
-10. In the Customizer dialog, click the Add Locale button. In the New Locale dialog that displays, enter '`en`' in the Language Code combo box, then click OK.
+
+[start=9]
+. In the Projects window, expand the Source Packages node, then right-click the `resources` > `messages.properties` file node and choose Customize. The Customizer dialog opens.
+
+[start=10]
+. In the Customizer dialog, click the Add Locale button. In the New Locale dialog that displays, enter '`en`' in the Language Code combo box, then click OK.
image::images/new-locale-dialog.png[title="The New Locale dialog enables you to add a new locale to an existing resource bundle base name"]
A _locale_ can be defined by both a language and a geographic region. The optional country code which can be used to specify the region can be applied to define formatting for dates, time, numbers, and currency. For more information, see the technical article, link:http://java.sun.com/developer/technicalArticles/J2SE/locale/[+Understanding Locale in the Java Platform+].
-11. Click the Add Locale button again, then enter '`cs`' in the Language Code combo box and click OK. The Customizer dialog displays as follows.
+
+[start=11]
+. Click the Add Locale button again, then enter '`cs`' in the Language Code combo box and click OK. The Customizer dialog displays as follows.
image::images/customizer-dialog.png[title="The New Locale dialog enables you to add a new locale to an existing resource bundle base name"]
-12. Click Close. In the Projects window, note that your resource bundles look as follows. You can expand a resource bundle to view the keys it contains.
+
+[start=12]
+. Click Close. In the Projects window, note that your resource bundles look as follows. You can expand a resource bundle to view the keys it contains.
image::images/projects-window.png[title="View resource bundles and the keys they contain in the Projects window"]
-13. Right-click any of the three resource bundles and choose Open. The Properties editor opens, enabling you to view and edit key-value pairs for all locales in a table layout.
+
+[start=13]
+. Right-click any of the three resource bundles and choose Open. The Properties editor opens, enabling you to view and edit key-value pairs for all locales in a table layout.
[.feature]
--
image::images/properties-editor.png[role="left", link="images/properties-editor.png"]
@@ -221,7 +221,9 @@
Press Shift-Esc to maximize the window in the IDE.
Note that when you add a new locale using the Customizer dialog, as you did for English and Czech in the previous steps, the keys and values of the default resource bundle are copied to the new locale.
-14. Modify the values for the Czech resource bundle. You can do this by _either_ clicking into the table cells for each row and typing your entries directly _or_ selecting the cell you want to edit and typing into the *Value* field located at the bottom of the Properties editor.
+
+[start=14]
+. Modify the values for the Czech resource bundle. You can do this by _either_ clicking into the table cells for each row and typing your entries directly _or_ selecting the cell you want to edit and typing into the *Value* field located at the bottom of the Properties editor.
* *greeting:* `Vítejte v našem domácím on-line obchodě Affable Bean Green Grocer.`
* *introText:* `Naše jedinečná dodávková služba Vám zajistí dopravu čerstvých organických produktů, mléčných výrobků, uzenin, pečiva a dalších delikates a zdravých výroků až ke dveřím.`
* *dairy:* `mléčné výrobky`
@@ -231,7 +233,9 @@
You can also add a comment to each key-value pair. Any text you enter into the *Comment* field in the Properties editor is added to the resource bundle text file above the key-value pair as a comment (i.e., following a '`#`' sign).
-15. Double-click the `messages_cs.properties` file node in the Projects window. Note that the text file has been updated according to your changes in the Properties editor.
+
+[start=15]
+. Double-click the `messages_cs.properties` file node in the Projects window. Note that the text file has been updated according to your changes in the Properties editor.
[source,java]
----
@@ -272,8 +276,12 @@
The `LocalizationContext` class belongs to the `javax.servlet.jsp.jstl.fmt` package. You can verify this by viewing the link:http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html[+JSTL 1.1 API Reference+] online.
-4. Click OK. The new context parameter is added to the table of existing context parameters under the General tab.
-5. Click the deployment descriptor's XML tab. Note that the following entry has been added to the file:
+
+[start=4]
+. Click OK. The new context parameter is added to the table of existing context parameters under the General tab.
+
+[start=5]
+. Click the deployment descriptor's XML tab. Note that the following entry has been added to the file:
[source,xml]
----
@@ -304,7 +312,9 @@
</div>
</div>
----
-3. Add `<fmt:message>` tags for the four category names, but use the `${category.name}` expression as the value for the `key` attribute. Since the category name is also used as the value for the `<img>` tag's `alt` attribute, follow the same procedure. The page's right column will look as follows.
+
+[start=3]
+. Add `<fmt:message>` tags for the four category names, but use the `${category.name}` expression as the value for the `key` attribute. Since the category name is also used as the value for the `<img>` tag's `alt` attribute, follow the same procedure. The page's right column will look as follows.
[source,html]
----
@@ -323,7 +333,9 @@
</c:forEach>
</div>
----
-4. Finally, ensure that you have the `fmt` tag library declared in the web page. Enter the following at the top of the file:
+
+[start=4]
+. Finally, ensure that you have the `fmt` tag library declared in the web page. Enter the following at the top of the file:
[source,java]
----
@@ -381,12 +393,22 @@
1. In Firefox, choose Tools > Options (Firefox > Preferences on Mac). In the window that displays, click the Content tab.
image::images/firefox-content.png[title="Examine your browser's preferred languages"]
-2. Under the Languages heading, click Choose.
-3. Select any language that is currently listed in the provided text area, then click Remove. (You should remember your language list and reinstate languages after completing this tutorial.)
-4. Click the 'Select Language to Add' drop-down and select `Czech [cs]`. Then click the Add button. The Czech language is added to the text area.
+
+[start=2]
+. Under the Languages heading, click Choose.
+
+[start=3]
+. Select any language that is currently listed in the provided text area, then click Remove. (You should remember your language list and reinstate languages after completing this tutorial.)
+
+[start=4]
+. Click the 'Select Language to Add' drop-down and select `Czech [cs]`. Then click the Add button. The Czech language is added to the text area.
image::images/firefox-languages.png[title="Specify your browser's preferred languages"]
-5. Click OK, then press Esc to close Firefox' Options window.
-6. Run the project ( image::images/run-project-btn.png[] ). When the welcome page opens in your browser, note that text is displayed in Czech.
+
+[start=5]
+. Click OK, then press Esc to close Firefox' Options window.
+
+[start=6]
+. Run the project ( image::images/run-project-btn.png[] ). When the welcome page opens in your browser, note that text is displayed in Czech.
image::images/czech-text.png[title="The displayed language is determined by your browser's language preferences"]
@@ -406,7 +428,9 @@
1. Use the Go to File dialog to open the `header` JSP fragment in the editor. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then type '`h`' in the dialog and click OK.
image::images/go-to-file-dialog.png[title="Use the Go to File dialog to quickly open project resources in the editor"]
-2. In the `header.jspf` file, locate the first `<div class="headerWidget">` tag (line 56), and replace the `[ language toggle ]` placeholder text with the following HTML markup.
+
+[start=2]
+. In the `header.jspf` file, locate the first `<div class="headerWidget">` tag (line 56), and replace the `[ language toggle ]` placeholder text with the following HTML markup.
[source,html]
----
@@ -423,10 +447,14 @@
Snapshot 8 includes the link:http://jquery.com/[+jQuery+] JavaScript library and takes advantage of various UI effects to enhance the appearance and behavior of the website. Aside from a link:http://plugins.jquery.com/project/validate[+jQuery plugin for client-side validation+] (discussed in the link:transaction.html#client[+previous tutorial unit+]), the snapshot implements an easing effect for category headings in the welcome page, as well as for category buttons in the category page. Configuration is included in `header.jspf` of the project snapshot. Rounded corners are implemented using CSS3's link:http://www.w3.org/TR/css3-background/#corners[+border-radius+] property (applied in `affablebean.css`).
-3. Run the project ( image::images/run-project-btn.png[] ) to see what the toggle looks like in the browser.
+
+[start=3]
+. Run the project ( image::images/run-project-btn.png[] ) to see what the toggle looks like in the browser.
image::images/language-toggle.png[title="Run the project to view the language toggle"]
Currently, the language toggle appears as in the above image regardless of what language the page displays in. In the next step, you integrate JSTL logic into the toggle so that it renders according to the language displayed on the page.
-4. Modify the toggle implementation as follows.
+
+[start=4]
+. Modify the toggle implementation as follows.
[source,html]
----
@@ -489,7 +517,9 @@
*Note:* The above implementation uses `<c:url>` tags to set up the toggle link. This is done in order to properly encode the request URL in the event that URL rewriting is used as a means for session tracking. Unit 8, link:manage-sessions.html#encodeUrl[+Managing Sessions+] provides a brief explanation of how the `<c:url>` tags can be used.
-5. Add a basic language test to the `header.jspf` file. This will enable us to check whether the toggle is properly rendering according to the client request's preferred language. Enter the following after the page's `<body>` tag.
+
+[start=5]
+. Add a basic language test to the `header.jspf` file. This will enable us to check whether the toggle is properly rendering according to the client request's preferred language. Enter the following after the page's `<body>` tag.
[source,html]
----
@@ -504,8 +534,12 @@
<div id="main">
----
-6. Ensure that you have set Czech as your browser's preferred language. (If you are following this tutorial unit sequentially, you've already done this. If not, refer to the steps outlined above in <<test,Test Supported Languages>>.)
-7. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
+
+[start=6]
+. Ensure that you have set Czech as your browser's preferred language. (If you are following this tutorial unit sequentially, you've already done this. If not, refer to the steps outlined above in <<test,Test Supported Languages>>.)
+
+[start=7]
+. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
image::images/language-test.png[title="Language toggle displays according to request's preferred language"]
If your browser's preferred language is set to Czech, you can note the following:
* The test that we introduced in the previous step indicates that '`cs`' is the preferred language.
@@ -538,7 +572,9 @@
String language = request.getParameter("language");*
}
----
-3. Place the `language` parameter in the request scope. Add the following.
+
+[start=3]
+. Place the `language` parameter in the request scope. Add the following.
[source,java]
----
@@ -553,7 +589,9 @@
request.setAttribute("language", language);*
}
----
-4. As a temporary measure, have the application forward the response to the `index.jsp` welcome page when the language toggle link is clicked. Add the following code.
+
+[start=4]
+. As a temporary measure, have the application forward the response to the `index.jsp` welcome page when the language toggle link is clicked. Add the following code.
[source,java]
----
@@ -577,7 +615,9 @@
}
----
Naturally, forwarding the user to the welcome page regardless of what page he or she is on is not an ideal way to handle the language toggle's behavior. We'll return to this matter in the next sub-section, <<keepTrack,Enable the Application to Keep Track of the Originating Page View>>. For the meantime however, this will allow us to examine the results of the current language toggle implementation when running the project.
-5. Switch to the `header.jspf` fragment (If the file is already opened in the editor, press Ctrl-Tab and choose the file.) and apply the link:http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/setLocale.html[+`<fmt:setLocale>`+] tag to set the page language based on the new `language` variable. Add the following.
+
+[start=5]
+. Switch to the `header.jspf` fragment (If the file is already opened in the editor, press Ctrl-Tab and choose the file.) and apply the link:http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/setLocale.html[+`<fmt:setLocale>`+] tag to set the page language based on the new `language` variable. Add the following.
[source,xml]
----
@@ -600,7 +640,9 @@
You can read the EL expression `${!empty language}` as, "False if the `language` variable is null or an empty string." See the link:http://download-llnw.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaim[+Java EE 5 Tutorial: Examples of EL Expressions+] for other available examples.
-6. Modify the language toggle implementation so that if a value has been set by the `<fmt:setLocale>` tag, the toggle displays according to the language specified by that value. (You can determine this value using the `${sessionScope['javax.servlet.jsp.jstl.fmt.locale.session']}` expression.)
+
+[start=6]
+. Modify the language toggle implementation so that if a value has been set by the `<fmt:setLocale>` tag, the toggle displays according to the language specified by that value. (You can determine this value using the `${sessionScope['javax.servlet.jsp.jstl.fmt.locale.session']}` expression.)
Enclose the current implementation within `<c:choose>` tags, and create logic similar to the current implementation in the event that the locale has been manually set. (Changes are displayed in *bold*.)
@@ -669,7 +711,9 @@
</div>
----
-7. Before examining the project in a browser, add another test that displays the value set by the `<fmt:setLocale>` tag. Add the following code beneath the test you created earlier.
+
+[start=7]
+. Before examining the project in a browser, add another test that displays the value set by the `<fmt:setLocale>` tag. Add the following code beneath the test you created earlier.
[source,xml]
----
@@ -701,16 +745,24 @@
For more information, refer to the Java EE 5 Tutorial: link:http://download-llnw.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaif[+Unified Expression Language: Resolving Expressions+].
-8. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
+
+[start=8]
+. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
image::images/toggle-page1.png[title="Welcome page displays according to browser's preferred language"]
In the above image, the server identifies Czech (`cs`) as the browser's preferred language from the `Accept-Language` HTTP header. This is indicated from the first test. The page displays in Czech, and the language toggle enables the user to choose English. The second test remains blank as the `<fmt:setLocale>` tag has not yet been called.
-9. Click the toggle link for English.
+
+[start=9]
+. Click the toggle link for English.
image::images/toggle-page2.png[title="Welcome page displays in English, according to toggle selection"]
When clicking the toggle link, the default Czech language is overridden by means of the `<fmt:setLocale>` tag implemented in the `header.jspf` file. Although the browser's preferred language remains Czech, you see that the page now displays according to the new language made available by the language toggle.
-10. Click the toggle link for Czech.
+
+[start=10]
+. Click the toggle link for Czech.
image::images/toggle-page3.png[title="Welcome page displays in Czech, according to toggle selection"]
Changing the language back to the browser's preferred language works as expected, however note that the deciding factor is no longer the language detected from the `Accept-Language` HTTP header, but is the language specified from the `<fmt:setLocale>` tag.
-11. Before continuing, remove the tests you added to the `header.jspf` file. (Deleted code in *[.line-through]#strike-through#* text.)
+
+[start=11]
+. Before continuing, remove the tests you added to the `header.jspf` file. (Deleted code in *[.line-through]#strike-through#* text.)
[source,html]
----
@@ -743,7 +795,9 @@
If you receive an error when running the project, revisit the link:setup.html[+setup instructions+], which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Use link:http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/c/set.html[+`<c:set>`+] tags to set a session-scoped `view` attribute for each of the page views. Open each of the page views in the editor and add the following code to the top of each file.
+
+[start=3]
+. Use link:http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/c/set.html[+`<c:set>`+] tags to set a session-scoped `view` attribute for each of the page views. Open each of the page views in the editor and add the following code to the top of each file.
==== index.jsp
@@ -799,7 +853,9 @@
Based on customer-agreed <<impDeets,implementation details>>, we do not need to provide a means of switching languages on the confirmation page view. From a usability perspective, a user will have already selected his or her preferred language prior to checkout. From an implementation perspective, recall that we destroy the user session upon a successfully completed order. (Refer back to the final paragraph in link:manage-sessions.html[+Managing Sessions+], which describes how to apply the `invalidate` method to explicitly terminate a user session.) If the Affable Bean staff were to insist on allowing customers to view their orders bilingually, you would need to consider the following scenarios, dependent on whether you destroy the user session upon displaying the confirmation page:
1. *Session destroyed:* Would be necessary to take extra measures to ensure that a `chooseLanguage` request from the confirmation page refers to the appropriate order, and can display customer-sensitive details in a secure fashion.
2. *Session maintained:* Would risk enabling users to mistakenly place double orders on their shopping cart. Also, by not terminating user sessions when they are no longer needed, an unnecessary load may be placed on the server.
-4. Open the `ControllerServlet` in the editor. (If already opened, press Ctrl-Tab and choose the file.) In the opened file, locate the portion of the `doGet` method that handles the `chooseLanguage` request (line 126).
+
+[start=4]
+. Open the `ControllerServlet` in the editor. (If already opened, press Ctrl-Tab and choose the file.) In the opened file, locate the portion of the `doGet` method that handles the `chooseLanguage` request (line 126).
Note that currently `chooseLanguage` requests are forwarded to the `index.jsp` welcome page.
@@ -824,7 +880,9 @@
return;*
}
----
-5. Use the `view` session attribute to forward the request back to the originating page view. Make the following changes (in *bold*).
+
+[start=5]
+. Use the `view` session attribute to forward the request back to the originating page view. Make the following changes (in *bold*).
[source,java]
----
@@ -873,8 +931,12 @@
ex.printStackTrace();
}
----
-6. Run the project ( image::images/run-project-btn.png[] ) to test it in the browser. When you navigate to the category, cart or checkout pages, switch languages using the language toggle. When you do so, you now remain within the same page view.
-7. In the browser, complete an order so that the application forwards you to the confirmation page. When you click the language toggle from the confirmation page, note that you are sent back to the website's welcome page.
+
+[start=6]
+. Run the project ( image::images/run-project-btn.png[] ) to test it in the browser. When you navigate to the category, cart or checkout pages, switch languages using the language toggle. When you do so, you now remain within the same page view.
+
+[start=7]
+. In the browser, complete an order so that the application forwards you to the confirmation page. When you click the language toggle from the confirmation page, note that you are sent back to the website's welcome page.
Implementation-wise, you may consider this to be sufficient. However, the Affable Bean staff have explicitly asked you to remove the language toggle from this page view. One way to accomplish this is to perform a test to determine whether the request _servlet path_ contains '`/confirmation`'.
@@ -914,15 +976,21 @@
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
----
-8. Run the project again and step through to the confirmation page. Note that the page no longer displays the language toggle.
+
+[start=8]
+. Run the project again and step through to the confirmation page. Note that the page no longer displays the language toggle.
image::images/confirmation-page.png[title="Language toggle no longer displays in confirmation page"]
-9. In the browser, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page inadvertently switches back to the originally displayed language. You may rightly identify the cause: upon a successfully completed order, the `ControllerServlet` destroys the user session and consequently the session-scoped locale that was set using the `<fmt:setLocale>` tag is also lost.
+
+[start=9]
+. In the browser, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page inadvertently switches back to the originally displayed language. You may rightly identify the cause: upon a successfully completed order, the `ControllerServlet` destroys the user session and consequently the session-scoped locale that was set using the `<fmt:setLocale>` tag is also lost.
To remedy this, open the `ControllerServlet` and locate the `invalidate()` method which is used to destroy user sessions (approximately line 259).
Use the editor's quick search facility: press Ctrl-F (⌘-F on Mac) and type in '`invalidate`'.
-10. Add code that extracts the session-scoped locale value prior to destroying the user session and resets the request-scoped `language` attribute to the locale value after the session has been destroyed. (Changes in *bold*.)
+
+[start=10]
+. Add code that extracts the session-scoped locale value prior to destroying the user session and resets the request-scoped `language` attribute to the locale value after the session has been destroyed. (Changes in *bold*.)
[source,java]
----
@@ -957,7 +1025,9 @@
userPath = "/confirmation";
}
----
-11. Run the project and again, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page now displays in the language you selected.
+
+[start=11]
+. Run the project and again, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page now displays in the language you selected.
You have now successfully integrated language support into the `AffableBean` application according to customer specification. You've factored out all text from page views, placed it into resource bundles, and have applied JSTL's `fmt` tag library to use resource bundle content based on the user's preferred language. You also implemented a language toggle that enables users to switch between English and Czech, and override their browser's default language choice. Download and examine link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot10.zip[+snapshot 10+] to compare your work with the state of the project at the end of this tutorial unit.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language_ja.asciidoc
index e6ef779..da286e9 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/language_ja.asciidoc
@@ -30,28 +30,6 @@
:keywords: Apache NetBeans, Tutorials, NetBeans Eコマース チュートリアル - 言語サポートの追加
-==== チュートリアルの内容
-
-1. link:intro_ja.html[+はじめに+]
-2. link:design_ja.html[+アプリケーションの設計+]
-3. link:setup-dev-environ_ja.html[+開発環境の設定+]
-4. link:data-model_ja.html[+データモデルの設計+]
-5. link:page-views-controller_ja.html[+ページビューとコントローラサーブレットの準備+]
-6. link:connect-db_ja.html[+データベースへのアプリケーションの接続+]
-7. link:entity-session_ja.html[+エンティティクラスとセッションBeanの追加+]
-8. link:manage-sessions_ja.html[+セッションの管理+]
-9. link:transaction_ja.html[+トランザクションビジネスロジックの統合+]
-10. *言語サポートの追加*
-* <<resourceBundles,リソースバンドルを理解する>>
-* <<multilingual,多言語対応ページを作成する>>
-* <<toggle,言語切り替えを実装する>>
-* <<seeAlso,関連参照>>
-11. link:security.html[+アプリケーションの保護+]
-12. link:test-profile.html[+アプリケーションの負荷テスト+]
-13. link:conclusion_ja.html[+まとめ+]
-
-image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
-
この単元の目標は、Webアプリケーションの言語サポートを有効にする方法を説明することです。「言語サポート」とは、ここでは顧客が指定した言語に応じてページビューを表示することを指します。`AffableBean` アプリケーションのコンテキスト内で、以前のlink:design.html#requirements[+お客様のご要望+]の概略にあったように、我々は英語とチェコ語の両方のサポートを提供することで合意しました。
これを達成するために、あなたは国際化のための Java サポートを使います。あなたは各言語用に_resource bundle_(リソースバンドル)を作成します。そして、Java ランタイム環境が着信したクライアントリクエストのために適切な言語を決定できるようにします。また、ユーザーが手動で言語を切り替えできるようにする「言語切り替え」を実装します。
@@ -95,8 +73,8 @@
Java では、リソースバンドルはlink:http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/ResourceBundle.html[+`java.util.ResourceBundle`+] クラスの表現です。Javadoc で述べられたように、
-[quote]
-----
+[NOTE]
+====
リソースバンドルはロケール固有のオブジェクトを含んでいます。プログラムがロケール固有のリソースを必要とするとき、例として文字列、あなたのプログラムは現在のユーザーのロケールに適したリソースバンドルから、それをロードすることができます。この方法で、リソースバンドルの中のロケール固有の情報全てではないが、ユーザーのロケールからほとんど隔離した、大部分が独立したプログラムコードを書くことができます。
これにより、あなたはプログラムを書くことができます:
@@ -106,9 +84,7 @@
* _一度に複数のロケールを処理する_
* _さらにロケールをサポートするように後から簡単に変更できる_
-
-
-----
+====
Javadoc から、`ResourceBundle`は、 link:http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/ListResourceBundle.html[+`ListResourceBundle`+] と link:http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/PropertyResourceBundle.html[+`PropertyResourceBundle`+]の両方の親であることに注意します。このチュートリアルでは、我々は `PropertyResourceBundle` を利用して、リソースを`.properties` 拡張子を使ったテキストファイルとして管理します。そしてそれには、キーと値のペアの形式でロケール固有の情報が入っています。新しい各翻訳では、リソースバンドルの新バージョンは、ロケール識別子をアンダースコア('`_`')を使用したベース名へ追加することで作成されます。たとえば、このチュートリアルで作成する2つのリソースバンドルの抜粋版は次のようになります:
@@ -157,19 +133,29 @@
1. あなたがサポートする予定の各言語のリソースバンドルを作成します。
-2. アプリケーションのリソースバンドルを登録するには、web.xml のデプロイメント記述子の中にコンテキストパラメータを設定します。
-3. ページビューで、 「hard-coded(ハードコーディングされた)」テキストをリソースバンドルの中のキーを参照する `<fmt:message>` タグに置き換えます。
+[start=2]
+. アプリケーションのリソースバンドルを登録するには、web.xml のデプロイメント記述子の中にコンテキストパラメータを設定します。
+
+
+[start=3]
+. ページビューで、 「hard-coded(ハードコーディングされた)」テキストをリソースバンドルの中のキーを参照する `<fmt:message>` タグに置き換えます。
次の演習では、上記の3つの手順を適用して、`AffableBean` の welcome ページに英語とチェコ語のサポートを統合する方法をデモします。そして Firefox を使用してブラウザの言語サポートでテストする方法を示して完了します。
1. <<createResource,リソースバンドルを作成する>>
-2. <<register,アプリケーションにリソースバンドルを登録する>>
-3. <<replace,「ハードコード化された」テキストを「`<fmt:message>`」タグに置換する>>
+[start=2]
+. <<register,アプリケーションにリソースバンドルを登録する>>
-4. <<test,サポートされた言語をテストする>>
+
+[start=3]
+. <<replace,「ハードコード化された」テキストを「`<fmt:message>`」タグに置換する>>
+
+
+[start=4]
+. <<test,サポートされた言語をテストする>>
[[createResource]]
@@ -177,31 +163,44 @@
1. AffableBean プロジェクトのlink:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot8.zip[+スナップショット8+]を IDE で開きます。[Open Project(プロジェクトを開く)] ( image::images/open-project-btn.png[] )ボタンをクリックして、ウィザードを使用して、プロジェクトをダウンロードしたコンピュータの場所を指示します。
-2. [Run Project(プロジェクトを実行)]( image::images/run-project-btn.png[] )ボタンをクリックしてプロジェクトを実行し、それが適切にデータベースとアプリケーションサーバーに設定されるようにします。
+
+[start=2]
+. [Run Project(プロジェクトを実行)]( image::images/run-project-btn.png[] )ボタンをクリックしてプロジェクトを実行し、それが適切にデータベースとアプリケーションサーバーに設定されるようにします。
プロジェクトを実行してエラーを受け取った場合、link:setup.html[+セットアップ手順+]を再度見ます。そこには、データベースを準備し IDE と GlassFish と MySQL 間の接続を確立する方法について説明されています。
-3. デフォルトのリソースバンドルの作成から始めて、ページビューで使用されるテキストを格納します。IDE のツールバーの [New File(新規ファイル)]( image::images/new-file-btn.png[] ) ボタンをクリックします。(または、Ctrl-n キーを押します。Macでは ⌘-N )。
-4. [Categories(カテゴリ)] の下の [Other(その他)] を選択し、 [File Types(ファイルの種類)] の下の [ Properties File (プロパティファイル)] を選択します。
+[start=3]
+. デフォルトのリソースバンドルの作成から始めて、ページビューで使用されるテキストを格納します。IDE のツールバーの [New File(新規ファイル)]( image::images/new-file-btn.png[] ) ボタンをクリックします。(または、Ctrl-n キーを押します。Macでは ⌘-N )。
+
+
+[start=4]
+. [Categories(カテゴリ)] の下の [Other(その他)] を選択し、 [File Types(ファイルの種類)] の下の [ Properties File (プロパティファイル)] を選択します。
image::images/new-file-wzd.png[title="Create a new resource bundle using the File wizard"]
注。このウィザードは、選択した [file type(ファイルの種類)] の説明を提供しています:
-[quote]
-----
-resource bundle(.properties) ファイルを作成してアプリケーションを国際化します。そのためにあなたのコードから目に見える全てのテキスト文字列を分離します。リソースバンドル ファイルは、Antスクリプトのプロパティのような、他の種類の文字列を収集することにも使用できます。作成されたリソースバンドルはロケールを一つだけ含みますが、あなたは、作成したファイルのコンテキストメニューからロケールを追加することもできます。バンドルは、特定のロケール用のテキストファイル(プロパティファイル形式)の中で編集されるか、またはすべてのロケールの情報を表示するテーブルの中で編集されることができます。
-----
-5. [次へ]をクリック。[Name and Location(名前と場所)] のステップで、File Name(ファイルの名前)]に [`messages` ]、 [Folder field(フォルダのフィールド)] に [`src/java/resources`] と入力します。これは、[`resources`]と名づけた新しいパッケージの中にリソースバンドルを配置するようウィザードに指示しています。
+[NOTE]
+====
+resource bundle(.properties) ファイルを作成してアプリケーションを国際化します。そのためにあなたのコードから目に見える全てのテキスト文字列を分離します。リソースバンドル ファイルは、Antスクリプトのプロパティのような、他の種類の文字列を収集することにも使用できます。作成されたリソースバンドルはロケールを一つだけ含みますが、あなたは、作成したファイルのコンテキストメニューからロケールを追加することもできます。バンドルは、特定のロケール用のテキストファイル(プロパティファイル形式)の中で編集されるか、またはすべてのロケールの情報を表示するテーブルの中で編集されることができます。
+====
+
+
+[start=5]
+. [次へ]をクリック。[Name and Location(名前と場所)] のステップで、File Name(ファイルの名前)]に [`messages` ]、 [Folder field(フォルダのフィールド)] に [`src/java/resources`] と入力します。これは、[`resources`]と名づけた新しいパッケージの中にリソースバンドルを配置するようウィザードに指示しています。
image::images/new-properties-file-wzd.png[title="Specify the name and location of the resource bundle"]
-6. [Finish]をクリックします。 [ Messages.properties ] リソースバンドルが生成され、エディタに開きます。
+
+[start=6]
+. [Finish]をクリックします。 [ Messages.properties ] リソースバンドルが生成され、エディタに開きます。
注意。前述したように、新しい `messages.properties` ファイル名には、それに付加された言語コードがありません。これは次の理由によるものです。このファイルは_default_(デフォルト)のリソースバンドルとして使用されるためです。デフォルトのリソースバンドルが適用されるのは、Javaランタイム環境が要求されたロケールに直接マッチするものを見つけられない時です。
-7. プロジェクトの `index.jsp` ファイルをエディタで開きます。次のテキストが現在使用されていることに注意してください:
+
+[start=7]
+. プロジェクトの `index.jsp` ファイルをエディタで開きます。次のテキストが現在使用されていることに注意してください:
* *Greeting:* `Welcome to the online home of the Affable Bean Green Grocer.`
(ごあいさつ: ようこそ愛想のよいビーンのグリーン食料品店オンラインホームへ。)
@@ -213,7 +212,9 @@
<<impDeets,「実装の詳細」>>の一つを思い出して下さい。上記の状態は「ブラウザの優先言語が英語でもチェコ語でない場合は、英語のテキストでサイトが表示される。」です。; したがって、我々が `messages.properties` ファイルに適用する値は英語になります。
-8. `messages.properties` ファイルの中に、welcome ページで使用されるテキストのキーと値のペアを追加することから始めます。以下の内容を追加します。
+
+[start=8]
+. `messages.properties` ファイルの中に、welcome ページで使用されるテキストのキーと値のペアを追加することから始めます。以下の内容を追加します。
[source,java]
@@ -233,29 +234,41 @@
今、我々はアプリケーションの welcome ページのデフォルトのリソースバンドルを完了しました。次は、お客様が指定した言語のリソースバンドルを引き続き作成しましょう。
-9. プロジェクトウィンドウで、[Source Packages(ソースパッケージ)] ノードを展開し、[`resources`] > [`messages.properties`] ファイルノードで右クリックし、 [Customize (カスタマイズ)]を選択します。[Customizer(カスタマイザ)] ダイアログが開きます。
-10. カスタマイザのダイアログで、[Add Locale(ロケールの追加)]ボタンをクリックします。[New Locale(新しいロケール)]ダイアログボックスが表示され、[Language Code(言語コード) ] コンボ ボックスで[ '`en`' ] を入力して、[ OK ] をクリックします。
+[start=9]
+. プロジェクトウィンドウで、[Source Packages(ソースパッケージ)] ノードを展開し、[`resources`] > [`messages.properties`] ファイルノードで右クリックし、 [Customize (カスタマイズ)]を選択します。[Customizer(カスタマイザ)] ダイアログが開きます。
+
+
+[start=10]
+. カスタマイザのダイアログで、[Add Locale(ロケールの追加)]ボタンをクリックします。[New Locale(新しいロケール)]ダイアログボックスが表示され、[Language Code(言語コード) ] コンボ ボックスで[ '`en`' ] を入力して、[ OK ] をクリックします。
image::images/new-locale-dialog.png[title="The New Locale dialog enables you to add a new locale to an existing resource bundle base name"]
言語と地域の両方に、_locale_(ロケール) が定義されます。地域を指定するために使われるオプションの country コードは、日付、時刻、数値、および通貨の書式を定義するために適用されます。詳細については、技術資料、link:http://java.sun.com/developer/technicalArticles/J2SE/locale/[+「Javaプラットフォームのロケールを理解する」+]を参照してください。
-11. [Add Locale(ロケールの追加)]ボタンをもう一度クリックし、次に、[Language Code(言語コード)]コンボボックスに[ `cs` ]と入力し、[OK]をクリックします。カスタマイザのダイアログが次のように表示されます。
+
+[start=11]
+. [Add Locale(ロケールの追加)]ボタンをもう一度クリックし、次に、[Language Code(言語コード)]コンボボックスに[ `cs` ]と入力し、[OK]をクリックします。カスタマイザのダイアログが次のように表示されます。
image::images/customizer-dialog.png[title="The New Locale dialog enables you to add a new locale to an existing resource bundle base name"]
-12. [Close(閉じる)]をクリックします。プロジェクトウィンドウで、リソースバンドルが次のように見えることに注意してください。あなたはリソースバンドルを展開して、それに含まれているキーを表示することができます。
+
+[start=12]
+. [Close(閉じる)]をクリックします。プロジェクトウィンドウで、リソースバンドルが次のように見えることに注意してください。あなたはリソースバンドルを展開して、それに含まれているキーを表示することができます。
image::images/projects-window.png[title="View resource bundles and the keys they contain in the Projects window"]
-13. 3つのリソースバンドルのいずれかを右クリックし、[ Open(オープン)]を選択します。プロパティエディタが開き、あなたはテーブルレイアウトですべてのロケールのキーと値のペアを見ることも編集することもできます。
+
+[start=13]
+. 3つのリソースバンドルのいずれかを右クリックし、[ Open(オープン)]を選択します。プロパティエディタが開き、あなたはテーブルレイアウトですべてのロケールのキーと値のペアを見ることも編集することもできます。
IDE 内でウィンドウを最大化するためには、Shift-Esc キーを押します。
注意。あなたはカスタマイザダイアログを使用して新しいロケールを追加すると、前の手順で英語とチェコ語でやったように、デフォルトのリソースバンドルのキーと値は、新しいロケールにコピーされます
-14. チェコ語リソースバンドルの値を変更します。これをするには、各行のテーブルのセルの中をクリックして直接あなたのエントリを入力するか、または、編集したいセルを選びプロパティエディタの下部にある *Value* フィールドに入力するか、どちらかの方法を使います。
+
+[start=14]
+. チェコ語リソースバンドルの値を変更します。これをするには、各行のテーブルのセルの中をクリックして直接あなたのエントリを入力するか、または、編集したいセルを選びプロパティエディタの下部にある *Value* フィールドに入力するか、どちらかの方法を使います。
* *greeting:* `Vítejte v našem domácím on-line obchodě Affable Bean Green Grocer.`
@@ -271,7 +284,9 @@
また、各キーと値のペアにコメントを追加することができます。プロパティエディタの *Comment* フィールドに入力した全てのテキストは、リソースバンドルのテキストファイルにコメントとしてキーと値のペアの上に追加されます。(すなわち、'`#`' 記号の後に続けて)。
-15. プロジェクトウィンドウ内の `messages_cs.properties` ファイルノードをダブルクリックします。テキストファイルはプロパティエディタであなたの変更に応じて更新されていることに注意して下さい。
+
+[start=15]
+. プロジェクトウィンドウ内の `messages_cs.properties` ファイルノードをダブルクリックします。テキストファイルはプロパティエディタであなたの変更に応じて更新されていることに注意して下さい。
[source,java]
@@ -308,9 +323,13 @@
1. プロジェクトウィンドウで、[Configuration Files(構成ファイル)]ノードを展開して、`web.xml` をダブルクリックしエディタに開きます。
-2. デプロイメント記述子の[General(全般)]タブでの下に、[Context Parameters(コンテキストパラメータ)]カテゴリを展開します。
-3. 「Add (追加)」ボタンをクリックし、[Add Context Parameter (コンテキストパラメータの追加)] ダイアログの中で次の値を入力します。
+[start=2]
+. デプロイメント記述子の[General(全般)]タブでの下に、[Context Parameters(コンテキストパラメータ)]カテゴリを展開します。
+
+
+[start=3]
+. 「Add (追加)」ボタンをクリックし、[Add Context Parameter (コンテキストパラメータの追加)] ダイアログの中で次の値を入力します。
* *Parameter Name:* `javax.servlet.jsp.jstl.fmt.localizationContext`
@@ -320,9 +339,13 @@
`LocalizationContext` クラスは、`javax.servlet.jsp.jstl.fmt` パッケージに所属しています。あなたは、link:http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html[+JSTLの1.1 APIリファレンス+] オンラインを見ることによってこれを確認することができます。
-4. [OK] をクリックします。新しいコンテキストパラメータは[General(全般)]タブの下の既存のコンテキストパラメータのテーブルに追加されます。
-5. デプロイメント記述子の XML タブをクリックします。以下のエントリがそのファイルに追加されていることに注意します:
+[start=4]
+. [OK] をクリックします。新しいコンテキストパラメータは[General(全般)]タブの下の既存のコンテキストパラメータのテーブルに追加されます。
+
+
+[start=5]
+. デプロイメント記述子の XML タブをクリックします。以下のエントリがそのファイルに追加されていることに注意します:
[source,xml]
@@ -342,7 +365,9 @@
1. プロジェクトの `index.jsp` ページをエディタに開きます。(もし既に開いている場合は、Ctrl-Tabを押し、そのファイルに切り替えます。 )
-2. ページの左側の列に表示されているハードコードされたテキストのインスタンスを削除しその場所に `<fmt:message>` タグを入力します。こうするために、 `key` 属性を使いリソースバンドルのキーを指示します。ページの左側の列は次のようになります。
+
+[start=2]
+. ページの左側の列に表示されているハードコードされたテキストのインスタンスを削除しその場所に `<fmt:message>` タグを入力します。こうするために、 `key` 属性を使いリソースバンドルのキーを指示します。ページの左側の列は次のようになります。
[source,html]
@@ -357,7 +382,9 @@
</div>
----
-3. 4つのカテゴリの名前に `<fmt:message>` タグを追加します。しかし、`key` 属性の値として、`${category.name}` 式を使用します。カテゴリ名は、`<img>` タグの `alt`(代替)属性の値としても使用されるので、同じ手順に従います。ページの右の列は次のようになります。
+
+[start=3]
+. 4つのカテゴリの名前に `<fmt:message>` タグを追加します。しかし、`key` 属性の値として、`${category.name}` 式を使用します。カテゴリ名は、`<img>` タグの `alt`(代替)属性の値としても使用されるので、同じ手順に従います。ページの右の列は次のようになります。
[source,html]
@@ -378,7 +405,9 @@
</div>
----
-4. 最後に、Web ページに `fmt` タグライブラリが宣言されていることを確認します。そのファイルの先頭に次のように入力してください:
+
+[start=4]
+. 最後に、Web ページに `fmt` タグライブラリが宣言されていることを確認します。そのファイルの先頭に次のように入力してください:
[source,java]
@@ -439,17 +468,27 @@
image::images/firefox-content.png[title="Examine your browser's preferred languages"]
-2. [Languages(言語)]見出しの下で、[Choose]をクリックします。
-3. 用意されたテキストエリアに現在リストされた任意の言語を選択して、[ Remove(削除)]をクリックします。 (あなたの言語のリストを覚えておいてください、そしてこのチュートリアルを完了後に言語を元に戻してください。
+[start=2]
+. [Languages(言語)]見出しの下で、[Choose]をクリックします。
-4. [ 'Select Language to Add' (言語を選択して追加する)]ドロップダウンをクリックして、 `Czech [cs]` を選択します。そして、[ Add (追加)]ボタンをクリックします。 Czech language (チェコ語) がテキストエリアに追加されます。
+
+[start=3]
+. 用意されたテキストエリアに現在リストされた任意の言語を選択して、[ Remove(削除)]をクリックします。 (あなたの言語のリストを覚えておいてください、そしてこのチュートリアルを完了後に言語を元に戻してください。
+
+
+[start=4]
+. [ 'Select Language to Add' (言語を選択して追加する)]ドロップダウンをクリックして、 `Czech [cs]` を選択します。そして、[ Add (追加)]ボタンをクリックします。 Czech language (チェコ語) がテキストエリアに追加されます。
image::images/firefox-languages.png[title="Specify your browser's preferred languages"]
-5. [OK]をクリックして、Esc キーを押し Firefoxの[Options(オプション)]ウィンドウを閉じます。
-6. プロジェクトを実行します( image::images/run-project-btn.png[] )。welcome ページがブラウザに開き、テキストがチェコ語で表示されることに注意してください。
+[start=5]
+. [OK]をクリックして、Esc キーを押し Firefoxの[Options(オプション)]ウィンドウを閉じます。
+
+
+[start=6]
+. プロジェクトを実行します( image::images/run-project-btn.png[] )。welcome ページがブラウザに開き、テキストがチェコ語で表示されることに注意してください。
image::images/czech-text.png[title="The displayed language is determined by your browser's language preferences"]
@@ -474,7 +513,9 @@
image::images/go-to-file-dialog.png[title="Use the Go to File dialog to quickly open project resources in the editor"]
-2. `header.jspf` ファイルで、最初の `<div class="headerWidget">` タグを見つけます( 56行)。そして、`[ language toggle ]`(言語切り替え) プレースホルダのテキストを以下のHTMLマークアップに置き換えます。
+
+[start=2]
+. `header.jspf` ファイルで、最初の `<div class="headerWidget">` タグを見つけます( 56行)。そして、`[ language toggle ]`(言語切り替え) プレースホルダのテキストを以下のHTMLマークアップに置き換えます。
[source,html]
@@ -492,12 +533,16 @@
上記の実装で、[ '`rounded`' ]クラスをトグルリンクに適用します。スナップショット8には、link:http://jquery.com/[+jQuery+] の JavaScriptのライブラリが含まれています。そして、Webサイトの外観と動作を強化するさまざまなUI効果を活用します。 link:http://plugins.jquery.com/project/validate[+クライアント側のjQueryプラグインの検証+] (link:transaction.html#client[+前の単元+]で議論しました)は別として、スナップショットは link:http://plugins.jquery.com/project/corners[+角丸用のプラグイン+]を実装しています。プラグインには`rounded`(丸みを帯びさせる)クラスが必要で、HTML要素に丸みを帯びた角の効果をつけるためのクラスです。その他の効果もまた適用されています。welcomeページのカテゴリ見出しの緩和効果だけでなく、カテゴリページのカテゴリボタンにも適用されています。構成はプロジェクトのスナップショットの `header.jspf` に実装されています。 /p>
-3. プロジェクトを実行 ( image::images/run-project-btn.png[] ) して、トグルがブラウザでどのように見えるか確認します。
+
+[start=3]
+. プロジェクトを実行 ( image::images/run-project-btn.png[] ) して、トグルがブラウザでどのように見えるか確認します。
image::images/language-toggle.png[title="Run the project to view the language toggle"]
現在のところ、「言語切り替え」は、どの言語でページが表示されていても、上の画像のように表示されます。次のステップで JSTL ロジックをトグルの中に統合します。そして、ページに表示された言語に応じてレンダリングされるようにします。
-4. トグル実装を次のように変更します。
+
+[start=4]
+. トグル実装を次のように変更します。
[source,html]
----
@@ -561,7 +606,9 @@
*注:* 上記の実装は、`<c:url>` タグを使用してトグルリンクをセットアップしています。これは、セッショントラッキングの手段としてURL書き換えが使用されるイベントの中でリクエストURLを正しくエンコードするために行われます。ユニット8、link:manage-sessions.html#encodeUrl[+セッション管理+] に「 `<c:url>` タグの使われ方」の簡単な説明が載っています。
-5. 基本的な言語のテストを `header.jspf` ファイルに追加します。これで、私たちが「クライアントリクエストの優先言語に応じてトグルが正常にレンダリングされるかどうか」を確認できるようになります。ページの `<body>` タグの後に次を入力します。
+
+[start=5]
+. 基本的な言語のテストを `header.jspf` ファイルに追加します。これで、私たちが「クライアントリクエストの優先言語に応じてトグルが正常にレンダリングされるかどうか」を確認できるようになります。ページの `<body>` タグの後に次を入力します。
[source,html]
@@ -578,9 +625,13 @@
<div id="main">
----
-6. あなたはブラウザの優先言語としてチェコ語を設定していることを確認し。 (あなたがこのチュートリアルの単元通りに実行している場合は、すでにこれを行っています。もしそうでない場合は、上記<<test,「サポートされた言語をテストする」>>に概説されている手順を参照して下さい。)
-7. プロジェクトを実行しますimage::images/run-project-btn.png[] )。そしてブラウザでアプリケーションの welcome ページを調べます。
+[start=6]
+. あなたはブラウザの優先言語としてチェコ語を設定していることを確認し。 (あなたがこのチュートリアルの単元通りに実行している場合は、すでにこれを行っています。もしそうでない場合は、上記<<test,「サポートされた言語をテストする」>>に概説されている手順を参照して下さい。)
+
+
+[start=7]
+. プロジェクトを実行しますimage::images/run-project-btn.png[] )。そしてブラウザでアプリケーションの welcome ページを調べます。
image::images/language-test.png[title="Language toggle displays according to request's preferred language"]
@@ -608,7 +659,9 @@
1. `ControllerServlet` をエディタで開きます。「Go To File(ファイルに移動)」ダイアログを使い(Alt-Shift-O(Ctrl -Shift-O Macの場合)を押し)、「'`controller`'」と入力し、「 OK」をクリックします。開いたファイルで、`chooseLanguage` リクエストを処理する `doGet` メソッドの部分を探します。( 126行) 。
-2. 「`// TODO: Implement language request`」コメントを削除します。リクエストのクエリ文字列から `language` パラメーターを抽出するコードを入力します。
+
+[start=2]
+. 「`// TODO: Implement language request`」コメントを削除します。リクエストのクエリ文字列から `language` パラメーターを抽出するコードを入力します。
[source,java]
@@ -622,7 +675,9 @@
}
----
-3. リクエストスコープの `language` を探し、以下を追加します。
+
+[start=3]
+. リクエストスコープの `language` を探し、以下を追加します。
[source,java]
----
@@ -638,7 +693,9 @@
}
----
-4. 一時的な措置として、言語切り替えリンクがクリックされた時、レスポンスをwelcomeページの`index.jsp` へ転送するようにアプリケーションにもたせます。次のコードを追加します。
+
+[start=4]
+. 一時的な措置として、言語切り替えリンクがクリックされた時、レスポンスをwelcomeページの`index.jsp` へ転送するようにアプリケーションにもたせます。次のコードを追加します。
[source,java]
@@ -664,7 +721,9 @@
----
当然のことながら、彼または彼女がどのページにいるかに関わらずユーザを welcome ページに転送することが、「言語切り替え」動作を処理する望ましい方法ではありません。我々は次のサブセクション<<keepTrack,Enable the Application to Keep Track of the Originating Page View>>(アプリケーションが元のページビューのトラックを保持することを可能にする。)でこの問題を再度扱います。しかしながら、その間にも、この方法でプロジェクトを実行して、私たちは現在の言語切り替えの実装の結果を確認できます。
-5. `header.jspf` フラグメントに切り替えて(もしファイルがエディターに既に開いている場合は、Ctrl-Tab を押して、そのファイルを選択します。)、link:http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/setLocale.html[+`<fmt:setLocale>`+]タグを、新しい`language`変数に基づいたページ言語を設定するために適用します。以下を追加します。
+
+[start=5]
+. `header.jspf` フラグメントに切り替えて(もしファイルがエディターに既に開いている場合は、Ctrl-Tab を押して、そのファイルを選択します。)、link:http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/setLocale.html[+`<fmt:setLocale>`+]タグを、新しい`language`変数に基づいたページ言語を設定するために適用します。以下を追加します。
[source,xml]
@@ -688,7 +747,9 @@
あなたは EL式 `${!empty language}` を次のように読むことができます。「language 変数が null または空の文字列」の場合は False。他の利用可能な例については、link:http://download-llnw.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaim[+Java EE 5チュートリアル: EL 式の例+] を見てください。
-6. 言語切り替えの実装を変更します。そして、`<fmt:setLocale>` タグによって値がすでに設定されている場合、トグルはその値に指定された言語に従い表示します。(あなたは、`${sessionScope['javax.servlet.jsp.jstl.fmt.locale.session']}` 式を使用して、この値を調べることができます。)
+
+[start=6]
+. 言語切り替えの実装を変更します。そして、`<fmt:setLocale>` タグによって値がすでに設定されている場合、トグルはその値に指定された言語に従い表示します。(あなたは、`${sessionScope['javax.servlet.jsp.jstl.fmt.locale.session']}` 式を使用して、この値を調べることができます。)
現在の実装を `<c:choose>` タグで囲みます。そして、ロケールが手動で設定されているイベントの中に、現在の実装と同様にロジックを作成します。(変更は太字で表示されています。)
@@ -759,7 +820,9 @@
</div>
----
-7. ブラウザでプロジェクトを調べる前に、 `<fmt:setLocale>` タグで設定された値を表示するテストを別に追加します。以前に作成したテストの下に、次のコードを追加します。
+
+[start=7]
+. ブラウザでプロジェクトを調べる前に、 `<fmt:setLocale>` タグで設定された値を表示するテストを別に追加します。以前に作成したテストの下に、次のコードを追加します。
[source,xml]
@@ -790,25 +853,33 @@
より詳細については、これを参照してください。Java EE 5 チュートリアル:link:http://download-llnw.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaif[+統一表現言語:式の解決+]
-8. プロジェクトを実行( image::images/run-project-btn.png[] )します。ブラウザでアプリケーションの welcome ページを調べます。
+
+[start=8]
+. プロジェクトを実行( image::images/run-project-btn.png[] )します。ブラウザでアプリケーションの welcome ページを調べます。
image::images/toggle-page1.png[title="Welcome page displays according to browser's preferred language"]
上の画像では、サーバーは `Accept-Language` HTTP ヘッダーからブラウザの優先言語としてチェコ (`cs`) を識別しています。これは最初のテストで指示したものです。チェコ語のページが表示され、言語の切り替えで、ユーザは英語を選択することができます。 `<fmt:setLocale>` タグがまだ呼び出されていないので、2番目のテストは空白のままです。
-9. 英語へのトグルリンクをクリックします。
+
+[start=9]
+. 英語へのトグルリンクをクリックします。
image::images/toggle-page2.png[title="Welcome page displays in English, according to toggle selection"]
トグルリンクをクリックすると、`header.jspf` ファイルに実装された `<fmt:setLocale>` タグにより、デフォルトのチェコ語がオーバーライドされます。ブラウザの優先言語はチェコ語のままですが、現在そのページは言語切り替えで利用可能にされた新しい言語で表示されているのを確認してください。
-10. チェコへのトグルリンクをクリックします。
+
+[start=10]
+. チェコへのトグルリンクをクリックします。
image::images/toggle-page3.png[title="Welcome page displays in Czech, according to toggle selection"]
ブラウザの優先言語に戻すための言語の切替は期待通り動きました。しかしながら、言語を決定する要因はもはや `Accept-Language` HTTPヘッダーで検出された言語ではなく、`<fmt:setLocale>` タグで指定された言語になっていることに注意してください。
-11. 続ける前に header.jspf ファイルに追加したテストを削除します。(削除するコードは取り消し線のついたテキストです。)
+
+[start=11]
+. 続ける前に header.jspf ファイルに追加したテストを削除します。(削除するコードは取り消し線のついたテキストです。)
[source,html]
@@ -839,11 +910,15 @@
1. link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot9.zip[+スナップショット9+] を IDE に開きます。プロジェクトを開く( image::images/open-project-btn.png[] )ボタンをクリックして、ウィザードを使用し、プロジェクトをダウンロードしたコンピュータの場所を指定します。
-2. プロジェクトを実行 ( image::images/run-project-btn.png[] ) ボタンをクリックしてプロジェクトを実行します。サイトをナビゲートして、任意のページビューから言語切り替えをクリックしたときにアプリケーションの welcome ページに返されることに注意してください。
+
+[start=2]
+. プロジェクトを実行 ( image::images/run-project-btn.png[] ) ボタンをクリックしてプロジェクトを実行します。サイトをナビゲートして、任意のページビューから言語切り替えをクリックしたときにアプリケーションの welcome ページに返されることに注意してください。
プロジェクトを実行してエラーが表示される場合、セットアップ手順を再度見て下さい。データベースを準備する方法、IDE と GlassFish と MySQL 間の接続を確立する方法がそこに載っています。
-3. link:http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/c/set.html[+`<c:set>`+] タグを使用して、各ページビューのセッションスコープ `view` 属性を設定します。各エディタで各ページビューを開き、各ファイルの先頭に次のコードを追加します。
+
+[start=3]
+. link:http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/c/set.html[+`<c:set>`+] タグを使用して、各ページビューのセッションスコープ `view` 属性を設定します。各エディタで各ページビューを開き、各ファイルの先頭に次のコードを追加します。
==== index.jsp
@@ -899,9 +974,13 @@
顧客と合意した <<impDeets,実装の詳細>> に基づき、我々は確認ページのビューでは言語切り替えを提供する必要はありません。使いやすさの観点から、チェックアウトする前に、ユーザーはすでに彼または彼女の好みの言語を選択しているでしょう。実装の観点から、注文を正常に完了するために我々はユーザセッションを破棄したことを思い出してください。(link:manage-sessions.html[+セッション管理+]の最後の段落に戻り参照してください。そこには、メソッドを`invalidate`(無効)にして明示的にユーザーセッションを終了する方法について説明してあります。)。Affable Bean スタッフが、お客様はバイリンガルの注文を表示することができるよう強く主張した場合には、次のシナリオをよく考える必要があります。確認ページを表示する時にユーザのセッションを破棄するかどうかに依存して検討する必要があります:
1. *セッションが破棄される:* 確認ページの `chooseLanguage` リクエストが適切なorder(注文)を参照していることを保障するための追加措置を講じる必要があるかどうか、そして顧客に敏感な詳細情報を安全な方法で表示するための追加措置を講じる必要があるかどうか。
-2. *セッションが保持される:* ユーザが誤って自分のショッピングカートでダブル注文をしてしてしまう危険性や、また不必要となったユーザーのセッションを終了しないためにサーバーに不必要な負荷をかけてよいか。
-4. `ControllerServlet` をエディタで開きます。(既に開いている場合、Ctrl-Tab を押し、そのファイルを選択します)。開いたファイルで、`chooseLanguage` リクエストを処理する `doGet` メソッドの部分を探します( 126行)。
+[start=2]
+. *セッションが保持される:* ユーザが誤って自分のショッピングカートでダブル注文をしてしてしまう危険性や、また不必要となったユーザーのセッションを終了しないためにサーバーに不必要な負荷をかけてよいか。
+
+
+[start=4]
+. `ControllerServlet` をエディタで開きます。(既に開いている場合、Ctrl-Tab を押し、そのファイルを選択します)。開いたファイルで、`chooseLanguage` リクエストを処理する `doGet` メソッドの部分を探します( 126行)。
注意。現在、chooseLanguage リクエストは index.jsp ウェルカムページに転送されます。
@@ -928,7 +1007,9 @@
}
----
-5. `view` セッション属性を使用して、リクエストを転送し元のページビューに戻ります。次の変更をします。(太字の部分)。
+
+[start=5]
+. `view` セッション属性を使用して、リクエストを転送し元のページビューに戻ります。次の変更をします。(太字の部分)。
[source,java]
@@ -982,9 +1063,13 @@
}
----
-6. プロジェクトを実行image::images/run-project-btn.png[] )し、ブラウザでそれをテストします。あなたが、カテゴリ、カートやチェックアウトのページに移動する時、言語切り替えを使用して言語を切り替えてみます。これを行うと、今や、あなたは同じページビュー内にとどまっています。
-7. ブラウザで、注文を完了し、アプリケーションはあなたを確認ページに転送します。確認ページから言語切り替えをクリックすると、あなたはウェブサイトのウェルカムページに戻らされることに注意します。
+[start=6]
+. プロジェクトを実行image::images/run-project-btn.png[] )し、ブラウザでそれをテストします。あなたが、カテゴリ、カートやチェックアウトのページに移動する時、言語切り替えを使用して言語を切り替えてみます。これを行うと、今や、あなたは同じページビュー内にとどまっています。
+
+
+[start=7]
+. ブラウザで、注文を完了し、アプリケーションはあなたを確認ページに転送します。確認ページから言語切り替えをクリックすると、あなたはウェブサイトのウェルカムページに戻らされることに注意します。
実装面では、あなたはこのことを十分に考慮する必要があります。しかし、Affable Beanスタッフがこのページビューから言語切り替えを明示的に削除するように求めています。これを実現する一つの方法は、リクエストの_servlet path_ が「'`/confirmation`'」を含んでいるかどうかを見つけ出すテストを実行することです。
@@ -1032,16 +1117,22 @@
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
----
-8. プロジェクトを再度実行し、確認ページにステップ実行します。そのページにはもはや言語切替えが表示されていないことに注意してください。
+
+[start=8]
+. プロジェクトを再度実行し、確認ページにステップ実行します。そのページにはもはや言語切替えが表示されていないことに注意してください。
image::images/confirmation-page.png[title="Language toggle no longer displays in confirmation page"]
-9. ブラウザで、言語切り替えを使用しその方法に沿ってもう一度言語を切り替えて、確認ページまでステップ実行します。注意して下さい。あなたが注文を完了するときに、確認ページが誤って最初に表示される言語に戻り切り替わります。あなたは正しく原因を特定することにします:正常に注文が完了したため、 `ControllerServlet` はユーザーセッションを破壊します。その結果として、`<fmt:setLocale>` タグを使用して設定されたセッションスコープのロケールが失われてしまうからです。
+
+[start=9]
+. ブラウザで、言語切り替えを使用しその方法に沿ってもう一度言語を切り替えて、確認ページまでステップ実行します。注意して下さい。あなたが注文を完了するときに、確認ページが誤って最初に表示される言語に戻り切り替わります。あなたは正しく原因を特定することにします:正常に注文が完了したため、 `ControllerServlet` はユーザーセッションを破壊します。その結果として、`<fmt:setLocale>` タグを使用して設定されたセッションスコープのロケールが失われてしまうからです。
この問題を解決するには、`ControllerServlet` を開き、ユーザーセッションを破壊するために使用する `invalidate()` メソッドを検索します。(だいたい 259行目)。
)エディタのクイック検索機能を使います:Ctrl-F(Macの場合 ⌘-F)を押し「`invalidate`」を入力します。
-10. ユーザセッションを破壊する前に、セッションスコープのロケールの値を抽出するコードを追加します。セッションが破棄された後に、リクエストスコープ `language` 属性にロケール値を再セットします。(変更は太字です。)
+
+[start=10]
+. ユーザセッションを破壊する前に、セッションスコープのロケールの値を抽出するコードを追加します。セッションが破棄された後に、リクエストスコープ `language` 属性にロケール値を再セットします。(変更は太字です。)
[source,java]
@@ -1078,7 +1169,9 @@
}
----
-11. プロジェクトを再び実行し、言語切り替えを使用する方法に従ってもう一度言語を切り替えて、確認ページまでステップ実行してください。あなたが注文を完了した時に、確認ページがあなたが選択した言語で今度は表示されることに注意してください。
+
+[start=11]
+. プロジェクトを再び実行し、言語切り替えを使用する方法に従ってもう一度言語を切り替えて、確認ページまでステップ実行してください。あなたが注文を完了した時に、確認ページがあなたが選択した言語で今度は表示されることに注意してください。
今あなたは、顧客仕様に応じた `AffableBean` アプリケーションの中に言語サポートを正常に統合しました。あなたはページビューからすべてのテキストを取り除き、それをリソースバンドルの中に配置しました。あなたは、JSTL `fmt` タグライブラリを、ユーザの好みの言語に基づいたリソースバンドルのコンテンツを使うように適用しました。あなたはまた、言語切り替えを実装し、ユーザーが英語とチェコ語を切り替えることができるようにしました。そして、ブラウザの既定の言語選択にオーバーライドしました。以下をダウンロードして調べて下さい。link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot10.zip[+スナップショット10+] とこの単元の最終プロジェクトの状態での作業とを比較してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions.asciidoc
index 24cfcb1..0f92e02 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Managing Sessions
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -45,11 +45,21 @@
* <<session-track,Examining Session Tracking Options>>
* <<time-out,Handling Session Time-Outs>>
* <<seeAlso,See Also>>
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=9]
+. link:transaction.html[+Integrating Transactional Business Logic+]
+
+[start=10]
+. link:language.html[+Adding Language Support+]
+
+[start=11]
+. link:security.html[+Securing the Application+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -262,14 +272,18 @@
* `WEB-INF/view/category.jsp`
* `WEB-INF/view/checkout.jsp`
* `controller/ControllerServlet`
-2. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
+
+[start=2]
+. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
If you receive an error when running the project, revisit the link:setup.html[+setup instructions+], which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Test the application's functionality in your browser. If you are continuing directly from the link:entity-session.html[+previous tutorial unit+], you'll note the following enhancements.
+
+[start=3]
+. Test the application's functionality in your browser. If you are continuing directly from the link:entity-session.html[+previous tutorial unit+], you'll note the following enhancements.
-==== category page
+=== category page
* Clicking 'add to cart' for the first time enables the shopping cart and 'proceed to checkout' widgets to display in the header.
* Clicking 'add to cart' results in an update to the number of cart items in the header's shopping cart widget.
@@ -279,7 +293,7 @@
[[cartPage]]
-==== cart page
+=== cart page
* Clicking 'clear cart' results in shopping cart being emptied of items.
* Clicking 'continue shopping' results in a return to the previously viewed category.
@@ -289,23 +303,31 @@
image::images/cart-page.png[title="Cart page includes shopping cart functionality"]
-==== checkout page
+=== checkout page
* Clicking 'view cart' results in the cart page displaying.
* Clicking 'submit purchase' results in the confirmation page displaying (without user-specific data).
image::images/checkout-page.png[title="Checkout page includes shopping cart functionality"]
-4. Use the Go to File dialog to open the `ControllerServlet` in the editor. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then type '`Controller`' in the dialog and click OK.
+
+[start=4]
+. Use the Go to File dialog to open the `ControllerServlet` in the editor. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then type '`Controller`' in the dialog and click OK.
image::images/go-to-file-dialog.png[title="Use the Go to File dialog to quickly open project resources in the editor"]
-5. Set a breakpoint in the `doPost` method on the line that creates an `HttpSession` object (line 150). To set a breakpoint, click in the left margin of the editor.
+
+[start=5]
+. Set a breakpoint in the `doPost` method on the line that creates an `HttpSession` object (line 150). To set a breakpoint, click in the left margin of the editor.
image::images/breakpoint.png[title="Click in editor's left margin to set breakpoints"]
To toggle line numbers for the editor, right-click in the left margin and choose Show Line Numbers.
-6. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The GlassFish server starts (or restarts, if it is already running) and opens a socket on its debug port number. The application welcome page opens in your browser.
+
+[start=6]
+. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The GlassFish server starts (or restarts, if it is already running) and opens a socket on its debug port number. The application welcome page opens in your browser.
You can view and modify the debug port number from the Servers window (Tools > Servers). Select the Java tab for the server you are using. Specify the port number in the 'Address to use' field under Debug Settings.
-7. When the application's welcome page displays in the browser, click any category image to navigate to the category page. Recall that clicking the 'add to cart' button sends an `addToCart` request to the server:
+
+[start=7]
+. When the application's welcome page displays in the browser, click any category image to navigate to the category page. Recall that clicking the 'add to cart' button sends an `addToCart` request to the server:
[source,java]
----
@@ -313,9 +335,13 @@
<form action="addToCart" method="post">
----
As you may recall from link:page-views-controller.html#controller[+Preparing the Page Views and Controller Servlet+], the `ControllerServlet`'s `doPost` method handles requests for the `/addToCart` URL pattern. You can therefore expect that when a user clicks an 'add to cart' button, the `doPost` method is called.
-8. Click 'add to cart' for any product in the category page. Switch back to the IDE and note that the debugger suspends on the breakpoint.
+
+[start=8]
+. Click 'add to cart' for any product in the category page. Switch back to the IDE and note that the debugger suspends on the breakpoint.
image::images/breakpoint-suspended.png[title="Debugger suspends on breakpoints in editor"]
-9. Place your cursor on the call to `getSession()` and press Ctrl-Space to invoke the Javadoc documentation.
+
+[start=9]
+. Place your cursor on the call to `getSession()` and press Ctrl-Space to invoke the Javadoc documentation.
image::images/javadoc-getsession.png[title="Press Ctrl-Space to invoke Javadoc documentation"]
According to the documentation, `getSession()` returns the `HttpSession` currently associated with the request, and if no session exists, the method creates a new session object.
@@ -359,10 +385,16 @@
* link:http://java.sun.com/j2se/javadoc/[+Javadoc Tool Official Home Page+]
* link:http://java.sun.com/j2se/javadoc/writingdoccomments/index.html[+How to Write Doc Comments for the Javadoc Tool+]
-10. Hover your mouse over the `session` variable. Note that the debugger suspends on the line _it is about to execute._ The value returned by `getSession()` has not yet been saved into the `session` variable, and you see a popup stating that "`session` is not a known variable in the current context."
+
+[start=10]
+. Hover your mouse over the `session` variable. Note that the debugger suspends on the line _it is about to execute._ The value returned by `getSession()` has not yet been saved into the `session` variable, and you see a popup stating that "`session` is not a known variable in the current context."
image::images/session-variable.png[title="Hover your mouse over variables and expressions to determine their current values"]
-11. Click the Step Over ( image::images/step-over-btn.png[] ) button in the debugger toolbar located above the editor. The line is executed, and the debugger steps to the next line in the file.
-12. Hover your mouse over the `session` variable again. Now you see the value currently set to the `session` variable.
+
+[start=11]
+. Click the Step Over ( image::images/step-over-btn.png[] ) button in the debugger toolbar located above the editor. The line is executed, and the debugger steps to the next line in the file.
+
+[start=12]
+. Hover your mouse over the `session` variable again. Now you see the value currently set to the `session` variable.
[.feature]
--
image::images/session-variable-set.png[role="left", link="images/session-variable-set.png"]
@@ -370,18 +402,30 @@
In NetBeans 6.9, you can click the grey pointer ( image::images/grey-pointer.png[] ) in the popup to expand a list of variable values contained in the highlighted element.
-13. Click the Step Over ( image::images/step-over-btn.png[] ) button (F8; fn-F8 on Mac) to arrive at the `if` statement (line 154). Because you just clicked the 'add to cart' button in the browser, you know that the expression `userPath.equals("/addToCart")` should evaluate to `true`.
-14. Highlight the `userPath.equals("/addToCart")` expression (by control-clicking with your mouse). This time you see a popup indicating the value of the expression you highlighted.
+
+[start=13]
+. Click the Step Over ( image::images/step-over-btn.png[] ) button (F8; fn-F8 on Mac) to arrive at the `if` statement (line 154). Because you just clicked the 'add to cart' button in the browser, you know that the expression `userPath.equals("/addToCart")` should evaluate to `true`.
+
+[start=14]
+. Highlight the `userPath.equals("/addToCart")` expression (by control-clicking with your mouse). This time you see a popup indicating the value of the expression you highlighted.
image::images/expression.png[title="Highlight expressions to determine their current values"]
-15. Press F8 (fn-F8 on Mac) to step to the next line (line 158). The application has been designed so that the `ShoppingCart` object for the user session is only created when the user adds an item to the cart for the first time. Since this is the first time the `addToCart` request has been received in this debug session, you can expect the `cart` object to equal `null`.
+
+[start=15]
+. Press F8 (fn-F8 on Mac) to step to the next line (line 158). The application has been designed so that the `ShoppingCart` object for the user session is only created when the user adds an item to the cart for the first time. Since this is the first time the `addToCart` request has been received in this debug session, you can expect the `cart` object to equal `null`.
image::images/cart-null.png[title="Cart object doesn't exist until user adds item to shopping cart"]
-16. Press F8 (fn-F8 on Mac) to step to the next line (line 160). Then, on line 160, where the `ShoppingCart` object is created, click the Step Into ( image::images/step-into-btn.png[] ) button. The debugger steps into the method being called. In this case, you are taken directly to the `ShoppingCart`'s constructor.
+
+[start=16]
+. Press F8 (fn-F8 on Mac) to step to the next line (line 160). Then, on line 160, where the `ShoppingCart` object is created, click the Step Into ( image::images/step-into-btn.png[] ) button. The debugger steps into the method being called. In this case, you are taken directly to the `ShoppingCart`'s constructor.
image::images/cart-constructor.png[title="Step into methods to follow runtime execution to other classes"]
-17. Press Ctrl-Tab to switch back to the `ControllerServlet`. Note that the IDE provides a Call Stack ( image::images/call-stack-badge.png[] ) badge on line 160, indicating that the debugger is currently suspended somewhere on a method higher up in the call stack.
+
+[start=17]
+. Press Ctrl-Tab to switch back to the `ControllerServlet`. Note that the IDE provides a Call Stack ( image::images/call-stack-badge.png[] ) badge on line 160, indicating that the debugger is currently suspended somewhere on a method higher up in the call stack.
Press Alt-Shift-3 (Ctrl-Shift-3 on Mac) to open the IDE's Call Stack window.
-18. Press F8 (fn-F8 on Mac) to continue stepping through code. When the debugger completes the `ShoppingCart` constructor, you are taken back to the `ControllerServlet`.
+
+[start=18]
+. Press F8 (fn-F8 on Mac) to continue stepping through code. When the debugger completes the `ShoppingCart` constructor, you are taken back to the `ControllerServlet`.
Line 161 of the `ControllerServlet` binds the newly-created `cart` object to the session.
@@ -397,7 +441,9 @@
--
If you expand the session > session > attributes node, you are able to view the objects that are bound to the session. In the above image, there are two items currently bound to the session (highlighted). These are `selectedCategory` and `categoryProducts`, instantiated in the `ControllerServlet` at lines 83 and 89, respectively. Both of these items were bound earlier, when you clicked a category image, and the `ControllerServlet` processed the category page request.
-19. Press F8 (fn-F8 on Mac) to execute line 161. The `cart` object is bound to the session, and the Variables window updates to reflect changes. In the Variables window, note that the session now contains three attributes, the third being the newly initialized `ShoppingCart` object (highlighted below).
+
+[start=19]
+. Press F8 (fn-F8 on Mac) to execute line 161. The `cart` object is bound to the session, and the Variables window updates to reflect changes. In the Variables window, note that the session now contains three attributes, the third being the newly initialized `ShoppingCart` object (highlighted below).
[.feature]
--
image::images/variables-win-session-cart.png[role="left", link="images/variables-win-session-cart.png"]
@@ -411,8 +457,12 @@
* a `Product` object is created using the ID (line 169)
* a new `ShoppingCartItem` is created using the `product` (line 170)
* the `ShoppingCartItem` is added to `ShoppingCart`'s `items` list (line 170)
-20. Press F8 (fn-F8 on Mac) to continue stepping through code while being mindful of the above-listed four actions. Pause when the debugger suspends on line 170.
-21. Create a watch on the session. This will allow you to view values contained in the session when you step into the `addItem` method in the next step. Right-click the session in the Variables window and choose Create Fixed Watch.
+
+[start=20]
+. Press F8 (fn-F8 on Mac) to continue stepping through code while being mindful of the above-listed four actions. Pause when the debugger suspends on line 170.
+
+[start=21]
+. Create a watch on the session. This will allow you to view values contained in the session when you step into the `addItem` method in the next step. Right-click the session in the Variables window and choose Create Fixed Watch.
image::images/create-watch.png[title="Create watches on variables as you step through code in a debug session"]
Alternatively, you can place your cursor on the `session` variable in the editor, then right-click and choose New Watch. The New Watch dialog enables you to specify variables or expressions to watch continuously when debugging an application. (In the case of expressions, highlight the expression first, then right-click and choose New Watch.)
@@ -421,23 +471,37 @@
A new watch is created on the `session` variable and all variables it contains. The watch is visible from the Watches window (Window > Debugging > Watches) or, if you toggle the Watches ( image::images/watch-btn.png[] ) button in the left margin of the Variables window, it displays in the top row of the Variables window.
The debugger enables you to keep an eye on variables as it steps through code. This can be helpful, for example if you'd like to follow changes to specific variable values (and don't want to need to sift through the full list presented in the Variables window with each step), or if you temporarily step into a class that doesn't contain the variables you are interested in.
-22. Click the Step Into ( image::images/step-into-btn.png[] ) button to step into `ShoppingCart`'s `addItem` method.
-23. Step through the `addItem` method until you reach line 53. As the Javadoc states, `addItem` _"adds a `ShoppingCartItem` to the `ShoppingCart`'s `items` list. If item of the specified `product` already exists in shopping cart list, the quantity of that item is incremented."_
-24. Examine the `session` variable which you created a watch on (<<step21,step 21>> above). The `items.add(scItem)` statement in line 51 added the new `ShoppingCartItem` to the `items` list in the `ShoppingCart`. This is evident by drilling into the third attribute (i.e., the `cart` variable) contained in the session.
+
+[start=22]
+. Click the Step Into ( image::images/step-into-btn.png[] ) button to step into `ShoppingCart`'s `addItem` method.
+
+[start=23]
+. Step through the `addItem` method until you reach line 53. As the Javadoc states, `addItem` _"adds a `ShoppingCartItem` to the `ShoppingCart`'s `items` list. If item of the specified `product` already exists in shopping cart list, the quantity of that item is incremented."_
+
+[start=24]
+. Examine the `session` variable which you created a watch on (<<step21,step 21>> above). The `items.add(scItem)` statement in line 51 added the new `ShoppingCartItem` to the `items` list in the `ShoppingCart`. This is evident by drilling into the third attribute (i.e., the `cart` variable) contained in the session.
[.feature]
--
image::images/variables-window-add-item.png[role="left", link="images/variables-window-add-item.png"]
--
At this stage, you can see how an `HttpSession` is created for the request, how a `ShoppingCart` object is created and attached to the session, and how a `ShoppingCartItem` is created based on the user's product choice, then added to the `ShoppingCart`'s list of `items`. The only remaining action is to forward the request to the `category.jsp` view.
-25. Open the header JSP fragment (`header.jspf`) in the editor and place a breakpoint on line 86. This line contains the EL statement within the shopping cart widget that displays the number of cart items.
+
+[start=25]
+. Open the header JSP fragment (`header.jspf`) in the editor and place a breakpoint on line 86. This line contains the EL statement within the shopping cart widget that displays the number of cart items.
image::images/breakpoint-jsp.png[title="You can suspend the debugger in JSP pages"]
-26. Click the Continue ( image::images/continue-btn.png[] ) button in the debugger toolbar. The debugger continues until execution completes, or until it reaches another breakpoint. In this case, the debugger suspends on line 86 in the header JSP fragment.
+
+[start=26]
+. Click the Continue ( image::images/continue-btn.png[] ) button in the debugger toolbar. The debugger continues until execution completes, or until it reaches another breakpoint. In this case, the debugger suspends on line 86 in the header JSP fragment.
*Note:* In order to suspend the debugger in a JSP page, you need to set a breakpoint. For example, when the `ControllerServlet` forwards the request to the appropriate view, the debugger will not automatically suspend within the JSP page.
-27. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) if it is not already open. Unlike with Java classes, the debugger _does not_ provide tooltips when you hover your mouse over variables or expressions in a JSP page. However, the Variables window does enable you to determine variable values as you step through code. So, where can you find the value for `${cart.numberOfItems}`?
-28. In the Variables window, expand the Implicit Objects > pageContext > session > session > attributes node. This provides access to the session object, just as you saw earlier when working in the `ControllerServlet`. In fact, you may note that the session which you created a watch on in step 21 above points to the very same object. Here you can verify that the value of `${cart.numberOfItems}` equals '`1`'.
+
+[start=27]
+. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) if it is not already open. Unlike with Java classes, the debugger _does not_ provide tooltips when you hover your mouse over variables or expressions in a JSP page. However, the Variables window does enable you to determine variable values as you step through code. So, where can you find the value for `${cart.numberOfItems}`?
+
+[start=28]
+. In the Variables window, expand the Implicit Objects > pageContext > session > session > attributes node. This provides access to the session object, just as you saw earlier when working in the `ControllerServlet`. In fact, you may note that the session which you created a watch on in step 21 above points to the very same object. Here you can verify that the value of `${cart.numberOfItems}` equals '`1`'.
[.feature]
--
image::images/variables-window-number-of-items.png[role="left", link="images/variables-window-number-of-items.png"]
@@ -446,7 +510,9 @@
Maximize the Variables window, or any window in the IDE, by right-clicking the window header, then choosing Maximize Window (Shift-Esc).
The debugger gives you access to the `pageContext` implicit object. `pageContext` represents the context of the JSP page, and offers direct access to various objects including the `HttpServletRequest`, `HttpSession`, and `ServletContext` objects. For more information, see the link:http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaij[+Java EE 5 Tutorial: Implicit Objects+].
-29. Click the Finish Session ( image::images/finish-session-btn.png[] ) button. The runtime finishes executing, and the debug session terminates. The browser displays a fully-rendered category page, and you can see that the shopping cart widget in the page header contains one item.
+
+[start=29]
+. Click the Finish Session ( image::images/finish-session-btn.png[] ) button. The runtime finishes executing, and the debug session terminates. The browser displays a fully-rendered category page, and you can see that the shopping cart widget in the page header contains one item.
Hopefully you now feel comfortable using the IDE's debugger not only to examine your project when it behaves unexpectedly, but also as a tool to become more familiar with code. Other useful buttons in the debugger toolbar include:
@@ -493,14 +559,24 @@
1. Begin by activating the HTTP Monitor for the server you are using. Choose Tools > Servers. In the left column of the Servers window, select the server you are using (GlassFish). Then, in the main column, select the Enable HTTP Monitor option.
image::images/servers-win-http-monitor.png[title="Select the Enable HTTP Monitor option to activate the HTTP Monitor"]
-2. If your server is already running, you need to restart it. However, since we plan to use the debugger, and running the debugger restarts the server to communicate on a different port, just click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The server restarts, a debug session begins and the application's welcome page opens in your browser. The HTTP Monitor displays in the bottom region of the IDE.
+
+[start=2]
+. If your server is already running, you need to restart it. However, since we plan to use the debugger, and running the debugger restarts the server to communicate on a different port, just click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The server restarts, a debug session begins and the application's welcome page opens in your browser. The HTTP Monitor displays in the bottom region of the IDE.
image::images/http-monitor.png[title="HTTP Monitor displays by default in bottom region of the IDE"]
-3. Click the AffableBean record in the left column (as shown in the above image). When you select records in the left column, the right (i.e., main) column refreshes to display corresponding data. In the above image, the Request tab displays the requested URI (`/AffableBean/`), the HTTP method (`GET`), and points out that there was no query string sent with the request.
-4. Select the Session tab. Note that there is a statement, "The session was created as a result of this request." This is due to the fact that the server has sent a `Set-Cookie` header for the `JSESSIONID` cookie in its response. Also note that the new session ID is listed under 'Session properties'. As will later be shown, the session ID is the value of the `JSESSIONID` cookie.
+
+[start=3]
+. Click the AffableBean record in the left column (as shown in the above image). When you select records in the left column, the right (i.e., main) column refreshes to display corresponding data. In the above image, the Request tab displays the requested URI (`/AffableBean/`), the HTTP method (`GET`), and points out that there was no query string sent with the request.
+
+[start=4]
+. Select the Session tab. Note that there is a statement, "The session was created as a result of this request." This is due to the fact that the server has sent a `Set-Cookie` header for the `JSESSIONID` cookie in its response. Also note that the new session ID is listed under 'Session properties'. As will later be shown, the session ID is the value of the `JSESSIONID` cookie.
image::images/session-tab.png[title="Session details are displayed under the Session tab in the HTTP Monitor"]
You may wonder how a session object was created from a request for the site welcome page. After all, the `ControllerServlet` does not handle the initial request for `/AffableBean/`, and nowhere does this request encounter `getSession()`. Or does it? Recall that JSP pages are compiled into servlets upon deployment. Once you've deployed your project to the server, you can actually use the IDE to view the JSP's compiled servlet on your server.
-5. In the Projects window, right-click the `index.jsp` file and choose View Servlet. An `index_jsp.java` file opens in the editor. This is the servlet that was automatically compiled from the `index.jsp` page.
-6. Perform a search in the file for `getSession`. Press Ctrl-F (⌘-F on Mac), type '`getSession`' in the search bar, then press Enter.
+
+[start=5]
+. In the Projects window, right-click the `index.jsp` file and choose View Servlet. An `index_jsp.java` file opens in the editor. This is the servlet that was automatically compiled from the `index.jsp` page.
+
+[start=6]
+. Perform a search in the file for `getSession`. Press Ctrl-F (⌘-F on Mac), type '`getSession`' in the search bar, then press Enter.
Ctrl-F (⌘-F on Mac) is a keyboard shortcut for Edit > Find.
@@ -519,12 +595,20 @@
To find out the location of the compiled servlet on your server, you can hover your mouse over the servlet's name tab above the editor. A popup displays the path to the file on your computer.
-7. In the browser, select a category then add an item to your cart. Switch back to the IDE. Note that the debugger suspends on the breakpoint in the `ControllerServlet` you set earlier (line 150). All breakpoints are remembered between sessions. To remove the breakpoint, you could click the breakpoint ( image::images/breakpoint-badge.png[] ) badge in the editor's left margin. However, since there are multiple breakpoints already set in the project, open the debugger's Breakpoints window (Window > Debugging > Breakpoints).
+
+[start=7]
+. In the browser, select a category then add an item to your cart. Switch back to the IDE. Note that the debugger suspends on the breakpoint in the `ControllerServlet` you set earlier (line 150). All breakpoints are remembered between sessions. To remove the breakpoint, you could click the breakpoint ( image::images/breakpoint-badge.png[] ) badge in the editor's left margin. However, since there are multiple breakpoints already set in the project, open the debugger's Breakpoints window (Window > Debugging > Breakpoints).
image::images/breakpoints-window.png[title="View all breakpoints in your project from the Breakpoints window"]
From the Breakpoints window, you can view and call actions on all breakpoints set in projects opened in the IDE.
-8. Right-click the breakpoint set in `header.jspf` and choose Delete. Then right-click the breakpoint set in the `ControllerServlet` and choose Disable. (You'll re-enable it later in this exercise.)
-9. Click the Continue ( image::images/continue-btn.png[] ) button. The request finishes executing, and the category page displays in the browser with one item added to the cart.
-10. In the HTTP Monitor, search for the `addToCart` request in the left column, then select it to display details in the main column.
+
+[start=8]
+. Right-click the breakpoint set in `header.jspf` and choose Delete. Then right-click the breakpoint set in the `ControllerServlet` and choose Disable. (You'll re-enable it later in this exercise.)
+
+[start=9]
+. Click the Continue ( image::images/continue-btn.png[] ) button. The request finishes executing, and the category page displays in the browser with one item added to the cart.
+
+[start=10]
+. In the HTTP Monitor, search for the `addToCart` request in the left column, then select it to display details in the main column.
Click the Ascending Sort ( image::images/ascending-sort-btn.png[] ) button so that the most recent records are listed at the top.
@@ -534,23 +618,39 @@
--
image::images/http-monitor-add-to-cart.png[role="left", link="images/http-monitor-add-to-cart.png"]
--
-11. Select the Cookies tab. Here you see that a cookie named `JSESSIONID` exists, and was sent from the client to the server. Note that the value for the cookie is the same as the Session ID displayed under the Session tab.
+
+[start=11]
+. Select the Cookies tab. Here you see that a cookie named `JSESSIONID` exists, and was sent from the client to the server. Note that the value for the cookie is the same as the Session ID displayed under the Session tab.
image::images/cookies-tab.png[title="Cookies are displayed under the Cookies tab in the HTTP Monitor"]
Likewise, if you click the Header tab, you see the cookie listed, since '`Cookie`' is a request header that was sent by the client.
image::images/headers-tab.png[title="Cookies are displayed under the Cookies tab in the HTTP Monitor"]
See Wikipedia's link:http://en.wikipedia.org/wiki/List_of_HTTP_headers[+List of HTTP headers+] for more information on request and response headers.
-12. Select the Session tab. There is a statement which indicates, "The session existed before this request." Also note that the `cart` attribute is listed under 'Session attributes after the request'. This makes sense, since we know that the `cart` object is bound to the session when the `addToCart` request is processed for the first time.
+
+[start=12]
+. Select the Session tab. There is a statement which indicates, "The session existed before this request." Also note that the `cart` attribute is listed under 'Session attributes after the request'. This makes sense, since we know that the `cart` object is bound to the session when the `addToCart` request is processed for the first time.
image::images/session-tab-add-to-cart.png[title="Session attributes are displayed under the Session tab in the HTTP Monitor"]
In the next few steps, locate the session ID and `JSESSIONID` cookie in the Variables window.
-13. Re-enable the breakpoint you set earlier in the `ControllerServlet`. Press Alt-Shift-5 (Ctrl-Shift-5 on Mac) to open the Breakpoints window, then click in the checkbox next to the breakpoint entry to re-enable it.
-14. In the browser, click the 'add to cart' button for one of the listed products.
-15. Switch to the IDE and note that the debugger is suspended on the breakpoint set in the `ControllerServlet`. Click the Step Over ( image::images/step-over-btn.png[] ) button so that the `session` variable is assigned to the session object.
-16. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) and expand session > session. You'll find the session ID listed as the value for the `id` variable.
-17. To locate the `JSESSIONID` cookie, recall that you can normally access cookies from a servlet by calling the link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] method on the `HttpServletRequest`. Therefore, drill into the request object: request > Inherited > request > request > Inherited > cookies. Here you see the `cookies` ArrayList. If you expand the list, you'll find the `JSESSIONID` cookie, the value of which is the session ID.
-18. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
+
+[start=13]
+. Re-enable the breakpoint you set earlier in the `ControllerServlet`. Press Alt-Shift-5 (Ctrl-Shift-5 on Mac) to open the Breakpoints window, then click in the checkbox next to the breakpoint entry to re-enable it.
+
+[start=14]
+. In the browser, click the 'add to cart' button for one of the listed products.
+
+[start=15]
+. Switch to the IDE and note that the debugger is suspended on the breakpoint set in the `ControllerServlet`. Click the Step Over ( image::images/step-over-btn.png[] ) button so that the `session` variable is assigned to the session object.
+
+[start=16]
+. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) and expand session > session. You'll find the session ID listed as the value for the `id` variable.
+
+[start=17]
+. To locate the `JSESSIONID` cookie, recall that you can normally access cookies from a servlet by calling the link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] method on the `HttpServletRequest`. Therefore, drill into the request object: request > Inherited > request > request > Inherited > cookies. Here you see the `cookies` ArrayList. If you expand the list, you'll find the `JSESSIONID` cookie, the value of which is the session ID.
+
+[start=18]
+. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
[[url-rewrite]]
@@ -573,34 +673,50 @@
1. Temporarily disable cookies in your browser. If you are using Firefox, you can choose Tools > Options (Firefox > Preferences on Mac). In the window that displays, select the Privacy tab, then under History, select 'Use custom settings for history' in the provided drop-down. Deselect the 'Accept cookies from sites' option.
image::images/firefox.png[title="Temporarily disable cookies in your browser"]
-2. Run the `AffableBean` project. When the welcome page displays, click into a category, then try adding an item to your cart. You'll see that the application's functionality is severely compromised in its present state.
+
+[start=2]
+. Run the `AffableBean` project. When the welcome page displays, click into a category, then try adding an item to your cart. You'll see that the application's functionality is severely compromised in its present state.
image::images/compromised.png[title="The application's functionality is compromised when the client doesn't accept cookies"]
As before, the server generates a session and binds objects to it. This is how the category page is able to display the selected category and products. However, the server has failed in its attempt to set a `JSESSIONID` cookie. Therefore, when the client makes a second request (when user clicks 'add to cart'), the server has no way of identifying the session which the request belongs to. It therefore cannot locate any of the attributes previously set in the session, such as `selectedCategory` and `categoryProducts`. This why the rendered response lacks the information specified by these attributes.
-3. Open the project's `category.jsp` page in the editor. Locate the line that implements the 'add to cart' button (line 58). The `<form>` element's `action` attribute determines the request sent to the server.
+
+[start=3]
+. Open the project's `category.jsp` page in the editor. Locate the line that implements the 'add to cart' button (line 58). The `<form>` element's `action` attribute determines the request sent to the server.
[source,java]
----
<form action="addToCart" method="post">
----
-4. Modify the request so that it is passed through the `<c:url>` tag.
+
+[start=4]
+. Modify the request so that it is passed through the `<c:url>` tag.
[source,java]
----
<form action="*<c:url value='addToCart'/>*" method="post">
----
-5. Press Ctrl-S (⌘-S on Mac) to save changes to the file. Recall that the IDE provides the Deploy on Save feature, which is enabled by default. This means that any saved changes are automatically deployed to your server.
-6. In the browser, select a different category so that the application renders the newly modified category page.
-7. Examine the source code for the page. In Firefox, you can press Ctrl-U (⌘-U on Mac). The 'add to cart' button for each product displays with the session ID appended to the URL.
+
+[start=5]
+. Press Ctrl-S (⌘-S on Mac) to save changes to the file. Recall that the IDE provides the Deploy on Save feature, which is enabled by default. This means that any saved changes are automatically deployed to your server.
+
+[start=6]
+. In the browser, select a different category so that the application renders the newly modified category page.
+
+[start=7]
+. Examine the source code for the page. In Firefox, you can press Ctrl-U (⌘-U on Mac). The 'add to cart' button for each product displays with the session ID appended to the URL.
[source,java]
----
<form action="addToCart*;jsessionid=4188657e21d72f364e0782136dde*" method="post">
----
-8. Click the 'add to cart' button for any item. You see that the server is now able to determine the session which the request belongs to, and renders the response appropriately.
-9. Before proceeding, make sure to re-enable cookies for your browser.
+
+[start=8]
+. Click the 'add to cart' button for any item. You see that the server is now able to determine the session which the request belongs to, and renders the response appropriately.
+
+[start=9]
+. Before proceeding, make sure to re-enable cookies for your browser.
Again, every link that a user is able to click on within the application, whose response requires some form of session-related data, needs to be properly encoded. Sometimes implementation is not as straight-forward as the example shown above. For example, the 'clear cart' widget used in `cart.jsp` currently sets a `clear` parameter to `true` when the link is clicked.
@@ -666,9 +782,13 @@
</session-timeout>
</session-config>
----
-2. Click the General tab, and type in '`10`' in the Session Timeout field.
+
+[start=2]
+. Click the General tab, and type in '`10`' in the Session Timeout field.
image::images/session-timeout.png[title="Specify session time-out for the application under the web.xml's General tab"]
-3. Save the file (Ctrl-S; ⌘-S on Mac).
+
+[start=3]
+. Save the file (Ctrl-S; ⌘-S on Mac).
If you switch back to the XML view, you'll see that the `<session-timeout>` element has been updated.
@@ -697,31 +817,51 @@
<session-timeout>*1*</session-timeout>
</session-config>
----
-2. Run the `AffableBean` project. In the browser, click into a category page, add several items to your cart, then click 'view cart'.
+
+[start=2]
+. Run the `AffableBean` project. In the browser, click into a category page, add several items to your cart, then click 'view cart'.
image::images/cart-page-session-intact.png[title="The cart page relies on a session object to display items in shopping cart"]
-3. Wait at least one full minute.
-4. Update the quantity for one of the items displayed in the cart page. (Any number between 1 and 99 is acceptable.) Click 'update'. The server returns an HTTP Status 500 message.
+
+[start=3]
+. Wait at least one full minute.
+
+[start=4]
+. Update the quantity for one of the items displayed in the cart page. (Any number between 1 and 99 is acceptable.) Click 'update'. The server returns an HTTP Status 500 message.
image::images/glassfish-error-report.png[title="NullPointerException occurs when request for expired session is received"]
-5. Examine the GlassFish server log in the IDE. Open the Output window (Ctrl-4; ⌘-4 on Mac) and select the GlassFish Server tab. Scroll to the bottom of the log to examine the error's stack trace.
+
+[start=5]
+. Examine the GlassFish server log in the IDE. Open the Output window (Ctrl-4; ⌘-4 on Mac) and select the GlassFish Server tab. Scroll to the bottom of the log to examine the error's stack trace.
[.feature]
--
image::images/gf-server-output.png[role="left", link="images/gf-server-output.png"]
--
The server log indicates that a `NullPointerException` occurred at line 184 in the `ControllerServlet`. The Output window forms a link to the line where the exception occurred.
-6. Click the link. You navigate directly to line 184 in the `ControllerServlet`. Hovering your mouse over the error badge in the editor's left margin provides a tooltip describing the exception.
+
+[start=6]
+. Click the link. You navigate directly to line 184 in the `ControllerServlet`. Hovering your mouse over the error badge in the editor's left margin provides a tooltip describing the exception.
image::images/nullpointer-exception.png[title="Error badge and tooltip indicate the location and cause of the problem"]
Because the session had already expired before the request was received, the servlet engine was unable to associate the request with its corresponding session. It was therefore unable to locate the `cart` object (line 151). The exception finally occurred in line 184 when the engine attempted to call a method on a variable equating to `null`.
Now that we've identified the problem, let's fix it by implementing a filter.
-7. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
-8. Select the *Web* category, then select *Filter* and click Next.
-9. Name the filter `SessionTimeoutFilter`. Type `filter` into the Packages field so that the filter class is placed in a new package when created.
-10. Click Next. Accept default settings and click Finish. A template for the `SessionTimeoutFilter` is generated and opens in the editor.
+
+[start=7]
+. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
+
+[start=8]
+. Select the *Web* category, then select *Filter* and click Next.
+
+[start=9]
+. Name the filter `SessionTimeoutFilter`. Type `filter` into the Packages field so that the filter class is placed in a new package when created.
+
+[start=10]
+. Click Next. Accept default settings and click Finish. A template for the `SessionTimeoutFilter` is generated and opens in the editor.
*Note:* Currently, in NetBeans 6.9, it isn't possible to use the wizard to set a mapping to a servlet that isn't registered in the web deployment descriptor. (`ControllerServlet` was registered using the `@WebServlet` annotation.) We'll therefore modify the generated code in the next step.
-11. Modify the `@WebFilter` annotation signature so that it appears as follows.
+
+[start=11]
+. Modify the `@WebFilter` annotation signature so that it appears as follows.
[source,java]
----
@@ -740,7 +880,9 @@
Use the Javadoc Index Search to pull up documentation on the `Filter` interface. Press Shift-F1 (fn-Shift-F1 on Mac), then type '`Filter`' into the search field and hit Enter. Select the 'Interface in javax.servlet' entry. The Javadoc documentation displays in the lower pane of the index search tool.
-12. Replace the body of the `SessionTimeoutFilter` with the following contents.
+
+[start=12]
+. Replace the body of the `SessionTimeoutFilter` with the following contents.
[source,java]
----
@@ -774,27 +916,55 @@
}
----
-13. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix import statements. (Imports need to be added for `HttpServletRequest` and `HttpSession`.) Also, use the editor hints to add the `@Override` annotation to the `init`, `destroy`, and `doFilter` methods.
+
+[start=13]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix import statements. (Imports need to be added for `HttpServletRequest` and `HttpSession`.) Also, use the editor hints to add the `@Override` annotation to the `init`, `destroy`, and `doFilter` methods.
In the coming steps, you run the debugger on the project and step through the `doFilter` method to see how it determines whether the request is bound to an existing session.
-14. Open the Breakpoints window (Alt-Shift-5; Ctrl-Shift-5 on Mac) and ensure that you do not have any existing breakpoints set. To delete a breakpoint, right-click the breakpoint and choose Delete. (If you completed the above exercise, <<http-monitor,Examining Client-Server Communication with the HTTP Monitor>>, you may have an outstanding breakpoint set in the `ControllerServlet`.)
-15. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar.
-16. When the welcome page displays in the browser, select a category, then add several items to your shopping cart.
-17. Set a breakpoint on the line in `SessionTimeoutFilter`'s `doFilter` method that tries to access the session (line 32).
+
+[start=14]
+. Open the Breakpoints window (Alt-Shift-5; Ctrl-Shift-5 on Mac) and ensure that you do not have any existing breakpoints set. To delete a breakpoint, right-click the breakpoint and choose Delete. (If you completed the above exercise, <<http-monitor,Examining Client-Server Communication with the HTTP Monitor>>, you may have an outstanding breakpoint set in the `ControllerServlet`.)
+
+[start=15]
+. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar.
+
+[start=16]
+. When the welcome page displays in the browser, select a category, then add several items to your shopping cart.
+
+[start=17]
+. Set a breakpoint on the line in `SessionTimeoutFilter`'s `doFilter` method that tries to access the session (line 32).
image::images/filter-breakpoint.png[title="Set a breakpoint on the getSession method"]
-18. In the browser, click the 'view cart' button. Switch to the IDE and note that the debugger has suspended on the breakpoint.
+
+[start=18]
+. In the browser, click the 'view cart' button. Switch to the IDE and note that the debugger has suspended on the breakpoint.
Recall that `getSession()` creates a new session object if the current one doesn't exist. Here, we use `getSession(false)`, which refrains from creating a new object if none is found. In other words, the method returns `null` if the session doesn't exist.
-19. Click the Step Over ( image::images/step-over-btn.png[] ) button, then hover your mouse over the `session` variable. Provided that a minute hasn't passed since the previous request was sent, you'll see that the variable has been assigned to a `StandardSessionFacade`. This represents the session object for the request.
+
+[start=19]
+. Click the Step Over ( image::images/step-over-btn.png[] ) button, then hover your mouse over the `session` variable. Provided that a minute hasn't passed since the previous request was sent, you'll see that the variable has been assigned to a `StandardSessionFacade`. This represents the session object for the request.
image::images/session-exists.png[title="Hover your mouse over variables to determine their current value"]
-20. Continue stepping through the method until the request is processed. Since `session` doesn't equal `null`, you skip the `if` statement and `chain.doFilter` then forwards the request to the `ControllerServlet` (line 44).
-21. In the browser, make sure a full minute has passed, then update a quantity for one of the product items in your cart. This is the same procedure we went through earlier in the exercise when the status 500 message was returned. Now that the filter intercepts requests heading to the `ControllerServlet`, let's see what happens when a session time-out occurs.
-22. After clicking 'update', switch to the IDE and note that the debugger is again suspended on the breakpoint set in the filter.
-23. Highlight the `req.getSession(false)` expression, then hover your mouse over it. Here you see the expression equates to `null`, as the session has already expired.
+
+[start=20]
+. Continue stepping through the method until the request is processed. Since `session` doesn't equal `null`, you skip the `if` statement and `chain.doFilter` then forwards the request to the `ControllerServlet` (line 44).
+
+[start=21]
+. In the browser, make sure a full minute has passed, then update a quantity for one of the product items in your cart. This is the same procedure we went through earlier in the exercise when the status 500 message was returned. Now that the filter intercepts requests heading to the `ControllerServlet`, let's see what happens when a session time-out occurs.
+
+[start=22]
+. After clicking 'update', switch to the IDE and note that the debugger is again suspended on the breakpoint set in the filter.
+
+[start=23]
+. Highlight the `req.getSession(false)` expression, then hover your mouse over it. Here you see the expression equates to `null`, as the session has already expired.
image::images/session-null.png[title="Highlight expressions and hover your mouse over them to determine their current value"]
-24. Continue stepping through the code. Now that the `session` variable equals `null`, the `if` statement on line 35 is processed, and the request is forwarded to `/index.jsp`. When the debugger finishes executing, you'll see that the browser displays the site's welcome page.
-25. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
-26. Open the project's `web.xml` file and change the session time-out interval back to 10 minutes.
+
+[start=24]
+. Continue stepping through the code. Now that the `session` variable equals `null`, the `if` statement on line 35 is processed, and the request is forwarded to `/index.jsp`. When the debugger finishes executing, you'll see that the browser displays the site's welcome page.
+
+[start=25]
+. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
+
+[start=26]
+. Open the project's `web.xml` file and change the session time-out interval back to 10 minutes.
[source,xml]
----
@@ -803,7 +973,9 @@
<session-timeout>*10*</session-timeout>
</session-config>
----
-27. Save (Ctrl-S; ⌘-S on Mac) the file.
+
+[start=27]
+. Save (Ctrl-S; ⌘-S on Mac) the file.
link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot6.zip[+Snapshot 6+] provides you with the completed project version for this tutorial unit. One final topic concerning session management should be mentioned. You can explicitly terminate a session by calling the `invalidate` method on the session object. If the session is no longer needed, it should be removed in order to conserve the memory available to your server. After you complete the next unit, link:transaction.html[+Integrating Transactional Business Logic+], you will see how the `ControllerServlet`, upon successfully processing a customer order, destroys the user's `cart` object and terminates the session using the `invalidate` method.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ja.asciidoc
index 4cca0e0..7b84075 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ja.asciidoc
@@ -256,14 +256,18 @@
* `WEB-INF/view/category.jsp`
* `WEB-INF/view/checkout.jsp`
* `controller/ControllerServlet`
-2. プロジェクトを実行(image::images/run-project-btn.png[])して、使用しているデータベースとアプリケーション・サーバーで適切に構成されていることを確認します。
+
+[start=2]
+. プロジェクトを実行(image::images/run-project-btn.png[])して、使用しているデータベースとアプリケーション・サーバーで適切に構成されていることを確認します。
プロジェクトの実行時にエラーが発生した場合は、データベースの準備や、IDE、GlassFishおよびMySQL間の接続の確立について説明したlink:setup.html[+設定手順+]をもう一度確認してください。
-3. ブラウザでアプリケーションの機能をテストします。link:entity-session.html[+前のチュートリアル・ユニット+]から直接継続している場合は、次のような機能拡張に気付くでしょう。
+
+[start=3]
+. ブラウザでアプリケーションの機能をテストします。link:entity-session.html[+前のチュートリアル・ユニット+]から直接継続している場合は、次のような機能拡張に気付くでしょう。
-==== カテゴリ・ページ
+=== カテゴリ・ページ
* 初めて「add to cart」をクリックするとショッピング・カートが有効になり、「proceed to checkout」ウィジェットがヘッダーに表示されます。
* 「add to cart」をクリックすると、ヘッダーにあるショッピング・カート・ウィジェットのカート項目の数が更新されます。
@@ -273,7 +277,7 @@
[[cartPage]]
-==== カート・ページ
+=== カート・ページ
* 「clear cart」をクリックすると、ショッピング・カートの項目が空になります。
* 「continue shopping」をクリックすると、前に表示されていたカテゴリ・ページに戻ります。
@@ -283,23 +287,31 @@
image::images/cart-page.png[title="ショッピング・カート機能があるカート・ページ"]
-==== チェックアウト・ページ
+=== チェックアウト・ページ
* 「view cart」をクリックすると、カート・ページが表示されます。
* 「submit purchase」をクリックすると、(ユーザー固有のデータなしで)確認ページが表示されます。
image::images/checkout-page.png[title="ショッピング・カート機能があるチェックアウト・ページ"]
-4. 「ファイルに移動」ダイアログを使用して、エディタで`ControllerServlet`を開きます。[Alt]-[Shift]-[O] (Macの場合は[Ctrl]-[Shift]-[O])を押してから、ダイアログで「`Controller`」と入力して「OK」をクリックします。
+
+[start=4]
+. 「ファイルに移動」ダイアログを使用して、エディタで`ControllerServlet`を開きます。[Alt]-[Shift]-[O] (Macの場合は[Ctrl]-[Shift]-[O])を押してから、ダイアログで「`Controller`」と入力して「OK」をクリックします。
image::images/go-to-file-dialog.png[title="「ファイルに移動」ダイアログを使用した、エディタへのプロジェクト・リソースの速やかな表示"]
-5. `HttpSession`オブジェクトを作成する行(150行目)の`doPost`メソッドにブレークポイントを設定します。ブレークポイントを設定するには、エディタの左マージンをクリックします。
+
+[start=5]
+. `HttpSession`オブジェクトを作成する行(150行目)の`doPost`メソッドにブレークポイントを設定します。ブレークポイントを設定するには、エディタの左マージンをクリックします。
image::images/breakpoint.png[title="エディタの左マージンのクリックによるブレークポイントの設定"]
エディタの行番号表示を切り替えるには、左マージンを右クリックして「行番号を表示」を選択します。
-6. デバッガを実行します。IDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image::images/debug-project-btn.png[])ボタンをクリックします。GlassFishサーバーが起動(すでに実行中の場合は再起動)し、そのデバッグ・ポート番号でソケットを開きます。アプリケーションの開始ページがブラウザで開きます。
+
+[start=6]
+. デバッガを実行します。IDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image::images/debug-project-btn.png[])ボタンをクリックします。GlassFishサーバーが起動(すでに実行中の場合は再起動)し、そのデバッグ・ポート番号でソケットを開きます。アプリケーションの開始ページがブラウザで開きます。
デバッグ・ポート番号は、「サーバー」ウィンドウ(「ツール」>「サーバー」)から表示および変更できます。使用しているサーバーの「Java」タブを選択します。「デバッグ設定」の下の「使用するアドレス」フィールドにポート番号を指定します。
-7. アプリケーションの開始ページがブラウザに表示されたら、いずれかのカテゴリ・イメージをクリックしてカテゴリ・ページに移動します。「add to cart」ボタンをクリックすると、次のようにサーバーに`addToCart`リクエストが送信されることを思い出してください。
+
+[start=7]
+. アプリケーションの開始ページがブラウザに表示されたら、いずれかのカテゴリ・イメージをクリックしてカテゴリ・ページに移動します。「add to cart」ボタンをクリックすると、次のようにサーバーに`addToCart`リクエストが送信されることを思い出してください。
[source,java]
----
@@ -307,9 +319,13 @@
<form action="addToCart" method="post">
----
link:page-views-controller.html#controller[+ページ・ビューおよびコントローラ・サーブレットの準備+]で説明したように、`ControllerServlet`の`doPost`メソッドは、`/addToCart`のURLパターンのリクエストを処理します。このため、ユーザーが「add to cart」ボタンをクリックすると`doPost`メソッドがコールされることを想定できます。
-8. カテゴリ・ページで、いずれかのカテゴリの「add to cart」をクリックします。IDEに戻ると、デバッガがブレークポイントで一時停止されていることがわかります。
+
+[start=8]
+. カテゴリ・ページで、いずれかのカテゴリの「add to cart」をクリックします。IDEに戻ると、デバッガがブレークポイントで一時停止されていることがわかります。
image::images/breakpoint-suspended.png[title="エディタのブレークポイントで一時停止されたデバッガ"]
-9. `getSession()`へのコールにカーソルを置き、[Ctrl]-[Space]を押してJavadocドキュメントを呼び出します。
+
+[start=9]
+. `getSession()`へのコールにカーソルを置き、[Ctrl]-[Space]を押してJavadocドキュメントを呼び出します。
image::images/javadoc-getsession.png[title="[Ctrl]-[Space]の押下によるJavadocドキュメントの呼出し"]
ドキュメントによると、`getSession()`は現時点でリクエストに関連付けられている`HttpSession`を返し、セッションが存在しない場合、このメソッドは新しいセッション・オブジェクトを作成します。
@@ -353,10 +369,16 @@
* link:http://java.sun.com/j2se/javadoc/[+Javadocツールの公式ホーム・ページ+]
* link:http://java.sun.com/j2se/javadoc/writingdoccomments/index.html[+Javadocツールのドキュメント・コメントを書く方法+]
-10. `session`変数の上にカーソルを移動します。デバッガは、_それが実行しようとしている_行で一時停止されています。`getSession()`によって返される値は、この時点では`session`変数に保存されておらず、ポップアップには「"`session`"は、現在のコンテキスト内で既知の変数ではありません。」と表示されます。
+
+[start=10]
+. `session`変数の上にカーソルを移動します。デバッガは、_それが実行しようとしている_行で一時停止されています。`getSession()`によって返される値は、この時点では`session`変数に保存されておらず、ポップアップには「"`session`"は、現在のコンテキスト内で既知の変数ではありません。」と表示されます。
image::images/session-variable.png[title="変数および式へのカーソルの移動による現在の値の判定"]
-11. エディタの上にあるデバッガ・ツールバーの「ステップ・オーバー」(image::images/step-over-btn.png[])ボタンをクリックします。この行が実行され、デバッガはファイルの次の行に進みます。
-12. 再度`session`変数の上にカーソルを移動します。今度は、`session`変数に現在設定されている値を確認します。
+
+[start=11]
+. エディタの上にあるデバッガ・ツールバーの「ステップ・オーバー」(image::images/step-over-btn.png[])ボタンをクリックします。この行が実行され、デバッガはファイルの次の行に進みます。
+
+[start=12]
+. 再度`session`変数の上にカーソルを移動します。今度は、`session`変数に現在設定されている値を確認します。
[.feature]
--
image:images/session-variable-set.png[role="left", link="images/session-variable-set.png"]
@@ -364,18 +386,30 @@
NetBeans 6.9では、ポップアップでグレーのポインタ(image::images/grey-pointer.png[])をクリックすると、強調表示された要素に含まれている変数の値の一覧を展開できます。
-13. 「ステップ・オーバー」(image::images/step-over-btn.png[])ボタン([F8]、Macの場合は[fn]-[F8])をクリックして`if`文(154行目)に入ります。ブラウザで「add to cart」ボタンをクリックしたばかりなので、`userPath.equals("/addToCart")`の式は`true`として評価されるはずです。
-14. [Ctrl]を押しながらマウスでクリックして`userPath.equals("/addToCart")`の式を強調表示します。今度は、強調表示した式の値を示すポップアップが表示されます。
+
+[start=13]
+. 「ステップ・オーバー」(image::images/step-over-btn.png[])ボタン([F8]、Macの場合は[fn]-[F8])をクリックして`if`文(154行目)に入ります。ブラウザで「add to cart」ボタンをクリックしたばかりなので、`userPath.equals("/addToCart")`の式は`true`として評価されるはずです。
+
+[start=14]
+. [Ctrl]を押しながらマウスでクリックして`userPath.equals("/addToCart")`の式を強調表示します。今度は、強調表示した式の値を示すポップアップが表示されます。
image::images/expression.png[title="式の強調表示による現在の値の判定"]
-15. [F8] (Macの場合は[fn]-[F8])を押して次の行(158行目)に進みます。このアプリケーションは、ユーザーが初めてカートに項目を追加するときにのみユーザー・セッションの`ShoppingCart`オブジェクトを作成するように設計されています。このデバッグ・セッションで`addToCart`リクエストが受け取られたのはこれが最初であるため、`cart`オブジェクトは`null`と等しいと想定できます。
+
+[start=15]
+. [F8] (Macの場合は[fn]-[F8])を押して次の行(158行目)に進みます。このアプリケーションは、ユーザーが初めてカートに項目を追加するときにのみユーザー・セッションの`ShoppingCart`オブジェクトを作成するように設計されています。このデバッグ・セッションで`addToCart`リクエストが受け取られたのはこれが最初であるため、`cart`オブジェクトは`null`と等しいと想定できます。
image::images/cart-null.png[title="Cartオブジェクトはユーザーがショッピング・カートに項目を追加するまで存在しない"]
-16. [F8] (Macの場合は[fn]-[F8])を押して次の行(160行目)に進みます。次に、`ShoppingCart`オブジェクトが作成される160行目で、「ステップ・イン」(image::images/step-into-btn.png[])ボタンをクリックします。コールされるメソッドにデバッガがステップ・インします。この場合、直接`ShoppingCart`のコンストラクタに移動します。
+
+[start=16]
+. [F8] (Macの場合は[fn]-[F8])を押して次の行(160行目)に進みます。次に、`ShoppingCart`オブジェクトが作成される160行目で、「ステップ・イン」(image::images/step-into-btn.png[])ボタンをクリックします。コールされるメソッドにデバッガがステップ・インします。この場合、直接`ShoppingCart`のコンストラクタに移動します。
image::images/cart-constructor.png[title="メソッドにステップ・インして実行時に他のクラスでの実行を追跡する"]
-17. [Ctrl]-[Tab]を押して`ControllerServlet`に戻ります。「コール・スタック」(image::images/call-stack-badge.png[])バッジが160行目に表示されます(現在、デバッガがコール・スタックの上位にあるいずれかのメソッドで一時停止されていることが表示されています)。
+
+[start=17]
+. [Ctrl]-[Tab]を押して`ControllerServlet`に戻ります。「コール・スタック」(image::images/call-stack-badge.png[])バッジが160行目に表示されます(現在、デバッガがコール・スタックの上位にあるいずれかのメソッドで一時停止されていることが表示されています)。
[Alt]-[Shift]-[3] (Macの場合は[Ctrl]-[Shift]-[3])を押すとIDEの「コール・スタック」ウィンドウが開きます。
-18. [F8] (Macの場合は[fn]-[F8])を押して、コードの実行を進めます。デバッガが`ShoppingCart`コンストラクタを完了すると、`ControllerServlet`に戻ります。
+
+[start=18]
+. [F8] (Macの場合は[fn]-[F8])を押して、コードの実行を進めます。デバッガが`ShoppingCart`コンストラクタを完了すると、`ControllerServlet`に戻ります。
`ControllerServlet`の161行目では、新しく作成された`cart`オブジェクトをセッションにバインドします。
@@ -391,7 +425,9 @@
--
「session」>「session」>「attributes」ノードを展開すると、セッションにバインドされているオブジェクトを表示できます。上記のイメージでは、現時点でセッションにバインドされている(強調表示された) 2つの項目があります。これらは、それぞれ`ControllerServlet`の83行目と89行目でインスタンス化された`selectedCategory`と`categoryProducts`です。これらの項目は両方とも、以前カテゴリ・イメージをクリックして`ControllerServlet`がカテゴリ・ページのリクエストを処理したときにバインドされました。
-19. [F8] (Macの場合は[fn]-[F8])を押して161行目を実行します。`cart`オブジェクトはセッションにバインドされており、「変数」ウィンドウは変更を反映して更新されます。「変数」ウィンドウでは、現在、セッションに3つの属性が含まれていることを確認できます。3つ目の変数は、新しく初期化された`ShoppingCart`オブジェクト(次で強調表示)です。
+
+[start=19]
+. [F8] (Macの場合は[fn]-[F8])を押して161行目を実行します。`cart`オブジェクトはセッションにバインドされており、「変数」ウィンドウは変更を反映して更新されます。「変数」ウィンドウでは、現在、セッションに3つの属性が含まれていることを確認できます。3つ目の変数は、新しく初期化された`ShoppingCart`オブジェクト(次で強調表示)です。
[.feature]
--
image:images/variables-win-session-cart.png[role="left", link="images/variables-win-session-cart.png"]
@@ -404,8 +440,12 @@
* IDを使用して`Product`オブジェクトが作成される(169行目)
* `product`を使用して新しい`ShoppingCartItem`が作成される(170行目)
* `ShoppingCartItem`が`ShoppingCart`の`items`リストに追加される(170行目)
-20. 上記で一覧表示された4つのアクションを意識しながら、[F8] (Macの場合は[fn]-[F8])を押して、コードの実行を進めます。デバッガが170行目で一時停止したら一時休止します。
-21. セッションにウォッチを作成します。これによって、次の手順で`addItem`メソッドにステップ・インするときに、セッションに含まれている値を表示できるようになります。「変数」ウィンドウでセッションを右クリックして、「固定ウォッチを作成」を選択します。
+
+[start=20]
+. 上記で一覧表示された4つのアクションを意識しながら、[F8] (Macの場合は[fn]-[F8])を押して、コードの実行を進めます。デバッガが170行目で一時停止したら一時休止します。
+
+[start=21]
+. セッションにウォッチを作成します。これによって、次の手順で`addItem`メソッドにステップ・インするときに、セッションに含まれている値を表示できるようになります。「変数」ウィンドウでセッションを右クリックして、「固定ウォッチを作成」を選択します。
image::images/create-watch.png[title="デバッグ・セッションでのコードのステップ実行による変数のウォッチの作成"]
または、エディタ内の`session`変数にカーソルを置いてから、右クリックして「新規ウォッチ」を選択します。「新規ウォッチ」ダイアログでは、アプリケーションのデバッグ時に継続的に監視する変数または式を指定できます。(式の場合は、最初に式を強調表示してから、右クリックして「新規ウォッチ」を選択します。)
@@ -414,23 +454,37 @@
`session`変数とそれに含まれるすべての変数の新しいウォッチが作成されます。ウォッチは、「ウォッチ」ウィンドウ(「ウィンドウ」>「デバッグ」>「ウォッチ」)から表示するか、「変数」ウィンドウの左マージンにある「ウォッチ」(image::images/watch-btn.png[])ボタンを切り替えて「変数」ウィンドウの最初の行に表示可能です。
コードをステップ実行しながら、デバッガで変数を監視できるようになります。これは、たとえば特定の変数の値をたどる場合(そして各手順で「変数」ウィンドウに示される全リストから選択しなくても済むようにする場合)や、調べる必要のある変数が含まれていないクラスに一時的にステップ・インする場合に役立ちます。
-22. 「ステップ・イン」(image::images/step-into-btn.png[])ボタンをクリックして、`ShoppingCart`の`addItem`メソッドにステップ・インします。
-23. 53行目まで`addItem`メソッドをステップ実行します。Javadocに記述されているとおり、`addItem`は_「`ShoppingCart`の`items`リストに`ShoppingCartItem`を追加します。指定された`product`の項目がすでにショッピング・カート・リストに存在する場合、その項目の数量が増加します。」_
-24. (上記の<<step21,ステップ21>>で)ウォッチを作成した`session`変数を調べます。51行目の`items.add(scItem)`文によって、`ShoppingCart`の`items`リストに新しい`ShoppingCartItem`が追加されました。これは、セッションに含まれている3つ目の属性(`cart`変数)を調べるとわかります。
+
+[start=22]
+. 「ステップ・イン」(image::images/step-into-btn.png[])ボタンをクリックして、`ShoppingCart`の`addItem`メソッドにステップ・インします。
+
+[start=23]
+. 53行目まで`addItem`メソッドをステップ実行します。Javadocに記述されているとおり、`addItem`は_「`ShoppingCart`の`items`リストに`ShoppingCartItem`を追加します。指定された`product`の項目がすでにショッピング・カート・リストに存在する場合、その項目の数量が増加します。」_
+
+[start=24]
+. (上記の<<step21,ステップ21>>で)ウォッチを作成した`session`変数を調べます。51行目の`items.add(scItem)`文によって、`ShoppingCart`の`items`リストに新しい`ShoppingCartItem`が追加されました。これは、セッションに含まれている3つ目の属性(`cart`変数)を調べるとわかります。
[.feature]
--
image:images/variables-window-add-item.png[role="left", link="images/variables-window-add-item.png"]
--
この段階で、リクエストのために`HttpSession`が作成される方法、`ShoppingCart`オブジェクトが作成されてセッションにアタッチされる方法、および`ShoppingCartItem`がユーザーの製品選択に基づいて作成され、`ShoppingCart`の`items`のリストに追加される方法を確認できます。残っているアクションは、`category.jsp`ビューへのリクエストの転送のみです。
-25. エディタでJSPフラグメント(`header.jspf`)を開き、86行目にブレークポイントを設定します。この行には、カート項目の数を表示する、ショッピング・カート・ウィジェット内のEL文が含まれています。
+
+[start=25]
+. エディタでJSPフラグメント(`header.jspf`)を開き、86行目にブレークポイントを設定します。この行には、カート項目の数を表示する、ショッピング・カート・ウィジェット内のEL文が含まれています。
image::images/breakpoint-jsp.png[title="JSPページでデバッガを一時停止できる"]
-26. デバッガ・ツールバーの「続行」(image::images/continue-btn.png[])ボタンをクリックします。デバッガは実行が完了するか、別のブレークポイントに達するまで続行されます。この場合、デバッガはヘッダーのJSPフラグメントの86行目で一時停止されます。
+
+[start=26]
+. デバッガ・ツールバーの「続行」(image::images/continue-btn.png[])ボタンをクリックします。デバッガは実行が完了するか、別のブレークポイントに達するまで続行されます。この場合、デバッガはヘッダーのJSPフラグメントの86行目で一時停止されます。
*注意:* JSPページでデバッガを一時停止させるには、ブレークポイントを設定する必要があります。たとえば、`ControllerServlet`がリクエストを適切なビューに転送したとき、デバッガはJSPページ内で自動的に一時停止されません。
-27. まだ開いていない場合は「変数」ウィンドウを開きます([Alt]-[Shift]-[1]、Macの場合は[Ctrl]-[Shift]-[1])。Javaクラスとは異なり、JSPページではデバッガで変数や式の上にカーソルを移動してもツールチップは表示_されません_。ただし、コードをステップ実行しながら、「変数」ウィンドウで変数の値を判定できます。では、`${cart.numberOfItems}`の値はどこにあるでしょうか。
-28. 「変数」ウィンドウで、「暗黙的なオブジェクト」>「pageContext」>「session」>「session」>「attributes」ノードを展開します。これによって、前に`ControllerServlet`をデバッグしていたときのように、セッション・オブジェクトにアクセスできるようになります。上記のステップ21でウォッチを作成したセッションは、実は同じオブジェクトを指しています。ここで、`${cart.numberOfItems}`の値が「`1`」と等しいことを確認できます。
+
+[start=27]
+. まだ開いていない場合は「変数」ウィンドウを開きます([Alt]-[Shift]-[1]、Macの場合は[Ctrl]-[Shift]-[1])。Javaクラスとは異なり、JSPページではデバッガで変数や式の上にカーソルを移動してもツールチップは表示_されません_。ただし、コードをステップ実行しながら、「変数」ウィンドウで変数の値を判定できます。では、`${cart.numberOfItems}`の値はどこにあるでしょうか。
+
+[start=28]
+. 「変数」ウィンドウで、「暗黙的なオブジェクト」>「pageContext」>「session」>「session」>「attributes」ノードを展開します。これによって、前に`ControllerServlet`をデバッグしていたときのように、セッション・オブジェクトにアクセスできるようになります。上記のステップ21でウォッチを作成したセッションは、実は同じオブジェクトを指しています。ここで、`${cart.numberOfItems}`の値が「`1`」と等しいことを確認できます。
[.feature]
--
image:images/variables-window-number-of-items.png[role="left", link="images/variables-window-number-of-items.png"]
@@ -439,7 +493,9 @@
「変数」ウィンドウなどのIDEのウィンドウは、いずれもウィンドウのヘッダーを右クリックしてから「ウィンドウを最大化」([Shift]-[Esc])を選択することで最大化できます。
デバッガで、`pageContext`の暗黙オブジェクトにアクセスできるようになります。`pageContext`はJSPページのコンテキストを示しており、`HttpServletRequest`、`HttpSession`、`ServletContext`オブジェクトなどの様々なオブジェクトへの直接的なアクセスを提供します。詳細は、link:http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaij[+Java EE 5チュートリアル: 暗黙オブジェクト+]を参照してください。
-29. セッションの終了(image::images/finish-session-btn.png[])ボタンをクリックします。ランタイムが実行を完了し、デバッグ・セッションが終了します。ブラウザにカテゴリ・ページが完全にレンダリングされ、ページ・ヘッダーにあるショッピング・カート・ウィジェットに1つの項目が含まれているのが確認できます。
+
+[start=29]
+. セッションの終了(image::images/finish-session-btn.png[])ボタンをクリックします。ランタイムが実行を完了し、デバッグ・セッションが終了します。ブラウザにカテゴリ・ページが完全にレンダリングされ、ページ・ヘッダーにあるショッピング・カート・ウィジェットに1つの項目が含まれているのが確認できます。
IDEデバッガは、プロジェクトが想定どおりに動作しない場合の検査用としてのみでなく、コードに詳しくなるためのツールとしても便利であることがわかるでしょう。他にも、デバッガ・ツールバーには次のような便利なボタンがあります。
@@ -486,14 +542,24 @@
1. まず、使用しているサーバーのHTTPモニターをアクティブ化します。「ツール」>「サーバー」を選択します。「サーバー」ウィンドウの左の列で、使用しているサーバー(GlassFish)を選択します。次にメインの列で、「HTTPモニターを有効化」オプションを選択します。
image::images/servers-win-http-monitor.png[title="「HTTPモニターを有効化」オプションの選択によるHTTPモニターのアクティブ化"]
-2. サーバーがすでに実行されている場合は再起動する必要があります。しかし、ここではデバッガを使用する予定であり、デバッガを実行すると異なるポートで通信するためにサーバーが再起動されるため、単にIDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image::images/debug-project-btn.png[])ボタンをクリックします。サーバーが再起動し、デバッグ・セッションが開始して、アプリケーションの開始ページがブラウザで開きます。HTTPモニターがIDEの最下部の領域に表示されます。
+
+[start=2]
+. サーバーがすでに実行されている場合は再起動する必要があります。しかし、ここではデバッガを使用する予定であり、デバッガを実行すると異なるポートで通信するためにサーバーが再起動されるため、単にIDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image::images/debug-project-btn.png[])ボタンをクリックします。サーバーが再起動し、デバッグ・セッションが開始して、アプリケーションの開始ページがブラウザで開きます。HTTPモニターがIDEの最下部の領域に表示されます。
image::images/http-monitor.png[title="HTTPモニターがデフォルトでIDEの最下部の領域に表示される"]
-3. 上記のイメージで示したように、左の列のAffableBeanレコードをクリックします。左の列でレコードを選択すると、右の(メインの)列がリフレッシュされ、対応するデータが表示されます。上記のイメージの「リクエスト」タブには、リクエストされたURI (`/AffableBean/`)およびHTTPメソッド(`GET`)が表示され、さらにリクエストと一緒に送信された問合せ文字列はなかったことが示されています。
-4. 「セッション」タブを選択します。「このリクエストの結果、セッションが作成されました」という文が表示されています。これは、サーバーがレスポンスとして`JSESSIONID` Cookieの`Set-Cookie`ヘッダーを送信したためです。また、新しいセッションIDが「セッション・プロパティ」の下に表示されています。後で示すように、セッションIDは`JSESSIONID` Cookieの値です。
+
+[start=3]
+. 上記のイメージで示したように、左の列のAffableBeanレコードをクリックします。左の列でレコードを選択すると、右の(メインの)列がリフレッシュされ、対応するデータが表示されます。上記のイメージの「リクエスト」タブには、リクエストされたURI (`/AffableBean/`)およびHTTPメソッド(`GET`)が表示され、さらにリクエストと一緒に送信された問合せ文字列はなかったことが示されています。
+
+[start=4]
+. 「セッション」タブを選択します。「このリクエストの結果、セッションが作成されました」という文が表示されています。これは、サーバーがレスポンスとして`JSESSIONID` Cookieの`Set-Cookie`ヘッダーを送信したためです。また、新しいセッションIDが「セッション・プロパティ」の下に表示されています。後で示すように、セッションIDは`JSESSIONID` Cookieの値です。
image::images/session-tab.png[title="セッションの詳細がHTTPモニターの「セッション」タブの下に表示される"]
サイトの開始ページのリクエストからセッション・オブジェクトが作成された方法について疑問に思うかもしれません。結局、`ControllerServlet`は`/AffableBean/`の最初のリクエストを処理しておらず、このリクエストが`getSession()`の影響を受ける機会はどこにもありません。それとも、これが行われたのでしょうか。JSPページは、デプロイメント時にサーブレットにコンパイルされることを思い出してください。サーバーにプロジェクトをデプロイすれば、実際にIDEを使用して、サーバー上のJSPのコンパイルされたサーブレットを表示できます。
-5. 「プロジェクト」ウィンドウで`index.jsp`ファイルを右クリックし、「サーブレットを表示」を選択します。エディタで`index_jsp.java`ファイルが開きます。これは、`index.jsp`ページから自動的にコンパイルされたサーブレットです。
-6. このファイルで`getSession`を検索します。[Ctrl]-[F] (Macの場合は[⌘]-[F])を押し、検索バーで「`getSession`」と入力してから[Enter]を押します。
+
+[start=5]
+. 「プロジェクト」ウィンドウで`index.jsp`ファイルを右クリックし、「サーブレットを表示」を選択します。エディタで`index_jsp.java`ファイルが開きます。これは、`index.jsp`ページから自動的にコンパイルされたサーブレットです。
+
+[start=6]
+. このファイルで`getSession`を検索します。[Ctrl]-[F] (Macの場合は[⌘]-[F])を押し、検索バーで「`getSession`」と入力してから[Enter]を押します。
[Ctrl]-[F] (Macの場合は[⌘]-[F])は、「編集」>「検索」のキーボード・ショートカットです。
@@ -509,12 +575,20 @@
サーバー上のコンパイルされたサーブレットの場所を見つけるには、エディタの上にあるサーブレット名のタブ上にカーソルを移動します。ポップアップに、コンピュータ上のファイルへのパスが表示されます。
-7. ブラウザで、カテゴリを選択してからカートに項目を追加します。IDEに戻ります。以前に設定した`ControllerServlet`のブレークポイント(150行目)でデバッガは一時停止されます。すべてのブレークポイントは、セッション間で記憶されます。ブレークポイントを除去するには、エディタの左マージンにある「ブレークポイント」(image::images/breakpoint-badge.png[])バッジをクリックします。しかし、このプロジェクトにはすでに複数のブレークポイントが設定されているため、「ウィンドウ」>「デバッグ」>「ブレークポイント」でデバッガの「ブレークポイント」ウィンドウを開きます。
+
+[start=7]
+. ブラウザで、カテゴリを選択してからカートに項目を追加します。IDEに戻ります。以前に設定した`ControllerServlet`のブレークポイント(150行目)でデバッガは一時停止されます。すべてのブレークポイントは、セッション間で記憶されます。ブレークポイントを除去するには、エディタの左マージンにある「ブレークポイント」(image::images/breakpoint-badge.png[])バッジをクリックします。しかし、このプロジェクトにはすでに複数のブレークポイントが設定されているため、「ウィンドウ」>「デバッグ」>「ブレークポイント」でデバッガの「ブレークポイント」ウィンドウを開きます。
image::images/breakpoints-window.png[title="「ブレークポイント」ウィンドウでのプロジェクトのすべてのブレークポイントの表示"]
「ブレークポイント」ウィンドウから、IDEで開いているプロジェクトで設定されたすべてのブレークポイントを表示してアクションをコールできます。
-8. `header.jspf`に設定されたブレークポイントを右クリックして、「削除」を選択します。その後、`ControllerServlet`に設定されたブレークポイントを右クリックして、「無効」を選択します。(この課題の後半で再度有効にします。)
-9. 「続行」(image::images/continue-btn.png[])ボタンをクリックします。リクエストの実行が終了し、カートに項目が1つ追加されたカテゴリ・ページがブラウザに表示されます。
-10. HTTPモニターの左の列で`addToCart`リクエストを検索して選択すると、メインの列に詳細が表示されます。
+
+[start=8]
+. `header.jspf`に設定されたブレークポイントを右クリックして、「削除」を選択します。その後、`ControllerServlet`に設定されたブレークポイントを右クリックして、「無効」を選択します。(この課題の後半で再度有効にします。)
+
+[start=9]
+. 「続行」(image::images/continue-btn.png[])ボタンをクリックします。リクエストの実行が終了し、カートに項目が1つ追加されたカテゴリ・ページがブラウザに表示されます。
+
+[start=10]
+. HTTPモニターの左の列で`addToCart`リクエストを検索して選択すると、メインの列に詳細が表示されます。
昇順ソート(image::images/ascending-sort-btn.png[])ボタンをクリックすると、最新のレコードが最上部に表示されます。
@@ -524,23 +598,39 @@
--
image:images/http-monitor-add-to-cart.png[role="left", link="images/http-monitor-add-to-cart.png"]
--
-11. 「Cookie」タブを選択します。ここでは、`JSESSIONID`という名前のCookieが存在し、クライアントからサーバーに送信されたことを確認できます。Cookieの値は、「セッション」タブの下に表示されたセッションIDと同じです。
+
+[start=11]
+. 「Cookie」タブを選択します。ここでは、`JSESSIONID`という名前のCookieが存在し、クライアントからサーバーに送信されたことを確認できます。Cookieの値は、「セッション」タブの下に表示されたセッションIDと同じです。
image::images/cookies-tab.png[title="HTTPモニターの「Cookie」タブに表示されたCookie"]
同様に、「ヘッダー」タブをクリックするとCookieが表示されます。これは、「`Cookie`」がクライアントによって送信されたリクエスト・ヘッダーであるためです。
image::images/headers-tab.png[title="HTTPモニターの「Cookie」タブに表示されたCookie"]
リクエストおよびレスポンス・ヘッダーの詳細は、ウィキペディアのlink:http://en.wikipedia.org/wiki/List_of_HTTP_headers[+HTTPヘッダーの一覧+]を参照してください。
-12. 「セッション」タブを選択します。「このリクエストの前にセッションが存在しました」という文が表示されています。また、`cart`属性が「リクエスト後のセッション属性」の下に表示されています。`addToCart`リクエストが初めて処理されるときに`cart`オブジェクトがセッションにバインドされるため、これは理にかなっています。
+
+[start=12]
+. 「セッション」タブを選択します。「このリクエストの前にセッションが存在しました」という文が表示されています。また、`cart`属性が「リクエスト後のセッション属性」の下に表示されています。`addToCart`リクエストが初めて処理されるときに`cart`オブジェクトがセッションにバインドされるため、これは理にかなっています。
image::images/session-tab-add-to-cart.png[title="HTTPモニターの「セッション」タブの下に表示されたセッション属性"]
以降のいくつかの手順では、「変数」ウィンドウでセッションIDおよび`JSESSIONID` Cookieを確認します。
-13. 以前に`ControllerServlet`に設定したブレークポイントを再度有効にします。[Alt]-[Shift]-[5] (Macの場合は[Ctrl]-[Shift]-[5])を押して「ブレークポイント」ウィンドウを開き、ブレークポイント・エントリの横にあるチェックボックスをクリックして、再度有効にします。
-14. ブラウザで、一覧表示された製品のうちの1つで「add to cart」ボタンをクリックします。
-15. IDEに切り替えると、デバッガが`ControllerServlet`に設定されたブレークポイントで一時停止されています。「ステップ・オーバー」(image::images/step-over-btn.png[])ボタンをクリックして、`session`変数をセッション・オブジェクトに割り当てます。
-16. 「変数」ウィンドウを開き([Alt]-[Shift]-[1]、Macの場合は[Ctrl]-[Shift]-[1])、「session」>「session」を展開します。セッションIDが「`id`」変数の値として表示されます。
-17. `JSESSIONID` Cookieを見つけるために、通常は`HttpServletRequest`でlink:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+]メソッドをコールすることで、サーブレットからCookieにアクセスできることを思い出してください。したがってrequestオブジェクトを、「request」>「継承」>「request」>「request」>「継承」>「cookies」と展開します。これで`cookies` ArrayListが表示されます。リストを展開すると`JSESSIONID` Cookieがあり、この値がセッションIDになります。
-18. セッションの終了(image::images/finish-session-btn.png[])ボタンをクリックして、デバッグ・セッションを終了します。
+
+[start=13]
+. 以前に`ControllerServlet`に設定したブレークポイントを再度有効にします。[Alt]-[Shift]-[5] (Macの場合は[Ctrl]-[Shift]-[5])を押して「ブレークポイント」ウィンドウを開き、ブレークポイント・エントリの横にあるチェックボックスをクリックして、再度有効にします。
+
+[start=14]
+. ブラウザで、一覧表示された製品のうちの1つで「add to cart」ボタンをクリックします。
+
+[start=15]
+. IDEに切り替えると、デバッガが`ControllerServlet`に設定されたブレークポイントで一時停止されています。「ステップ・オーバー」(image::images/step-over-btn.png[])ボタンをクリックして、`session`変数をセッション・オブジェクトに割り当てます。
+
+[start=16]
+. 「変数」ウィンドウを開き([Alt]-[Shift]-[1]、Macの場合は[Ctrl]-[Shift]-[1])、「session」>「session」を展開します。セッションIDが「`id`」変数の値として表示されます。
+
+[start=17]
+. `JSESSIONID` Cookieを見つけるために、通常は`HttpServletRequest`でlink:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+]メソッドをコールすることで、サーブレットからCookieにアクセスできることを思い出してください。したがってrequestオブジェクトを、「request」>「継承」>「request」>「request」>「継承」>「cookies」と展開します。これで`cookies` ArrayListが表示されます。リストを展開すると`JSESSIONID` Cookieがあり、この値がセッションIDになります。
+
+[start=18]
+. セッションの終了(image::images/finish-session-btn.png[])ボタンをクリックして、デバッグ・セッションを終了します。
[[url-rewrite]]
@@ -563,34 +653,50 @@
1. ブラウザのCookieを一時的に無効にします。Firefoxを使用している場合、「ツール」>「オプション」(Macの場合は「Firefox」>「プリファレンス」)を選択します。表示されたウィンドウで「プライバシー」タブを選択してから、表示されたドロップダウンで「記憶させる履歴を詳細設定する」を選択します。「サイトから送られてきたCookieを保存する」オプションを選択解除します。
image::images/firefox.png[title="ブラウザでの一時的なCookieの無効化"]
-2. `AffableBean`プロジェクトを実行します。開始ページが表示されたら、カテゴリをクリックしてからカートに項目を追加してみてください。現状ではアプリケーションがまったく機能しません。
+
+[start=2]
+. `AffableBean`プロジェクトを実行します。開始ページが表示されたら、カテゴリをクリックしてからカートに項目を追加してみてください。現状ではアプリケーションがまったく機能しません。
image::images/compromised.png[title="クライアントがCookieを受け入れない場合、アプリケーションは機能しない"]
以前と同様に、サーバーはセッションを生成して、そのセッションにオブジェクトをバインドします。このようにして、選択されたカテゴリおよび製品をカテゴリ・ページに表示できます。しかし、サーバーは`JSESSIONID` Cookieの設定に失敗しました。したがって、クライアントが2つ目のリクエストを作成したとき(ユーザーが「add to cart」をクリックしたとき)、サーバーにはリクエストが属しているセッションを識別する方法がありません。このため、以前にセッションで設定された`selectedCategory`や`categoryProducts`などの属性をいずれも見つけることができません。このような理由により、レスポンスのレンダリングにはこれらの属性によって指定される情報が欠如しています。
-3. エディタでプロジェクトの`category.jsp`ページを開きます。「add to cart」ボタンを実装する行(58行目)を見つけます。`<form>`要素の`action`属性によって、サーバーに送信されるリクエストが決まります。
+
+[start=3]
+. エディタでプロジェクトの`category.jsp`ページを開きます。「add to cart」ボタンを実装する行(58行目)を見つけます。`<form>`要素の`action`属性によって、サーバーに送信されるリクエストが決まります。
[source,java]
----
<form action="addToCart" method="post">
----
-4. リクエストを変更して、`<c:url>`タグを通して渡されるようにします。
+
+[start=4]
+. リクエストを変更して、`<c:url>`タグを通して渡されるようにします。
[source,java]
----
<form action="*<c:url value='addToCart'/>*" method="post">
----
-5. [Ctrl]-[S] (Macの場合は[⌘]-[S])を押して、ファイルへの変更を保存します。IDEは、デフォルトで有効な「保存時にデプロイ」機能が備わっていることを思い出してください。これによって、保存された変更はすべて自動的にサーバーにデプロイされます。
-6. ブラウザで異なるカテゴリを選択して、新しく変更されたカテゴリ・ページをアプリケーションにレンダリングさせます。
-7. このページのソース・コードを調べます。Firefoxでは[Ctrl]-[U] (Macの場合は[⌘]-[U])を押します。各製品の「add to cart」ボタンに、URLに付加されたセッションIDが一緒に表示されています。
+
+[start=5]
+. [Ctrl]-[S] (Macの場合は[⌘]-[S])を押して、ファイルへの変更を保存します。IDEは、デフォルトで有効な「保存時にデプロイ」機能が備わっていることを思い出してください。これによって、保存された変更はすべて自動的にサーバーにデプロイされます。
+
+[start=6]
+. ブラウザで異なるカテゴリを選択して、新しく変更されたカテゴリ・ページをアプリケーションにレンダリングさせます。
+
+[start=7]
+. このページのソース・コードを調べます。Firefoxでは[Ctrl]-[U] (Macの場合は[⌘]-[U])を押します。各製品の「add to cart」ボタンに、URLに付加されたセッションIDが一緒に表示されています。
[source,java]
----
<form action="addToCart*;jsessionid=4188657e21d72f364e0782136dde*" method="post">
----
-8. いずれかの項目で「add to cart」ボタンをクリックします。サーバーが、リクエストが属しているセッションを判定して、適切にレスポンスをレンダリングできるようになっていることを確認できます。
-9. 次に進む前に、ブラウザでCookieを再度有効にしてください。
+
+[start=8]
+. いずれかの項目で「add to cart」ボタンをクリックします。サーバーが、リクエストが属しているセッションを判定して、適切にレスポンスをレンダリングできるようになっていることを確認できます。
+
+[start=9]
+. 次に進む前に、ブラウザでCookieを再度有効にしてください。
前述のように、アプリケーション内でユーザーがクリックできるすべてのリンクは、そのレスポンスがなんらかの形式のセッション関連のデータを必要とする場合、適切にエンコードされる必要があります。上記の例ほど実装が単純ではない場合もあります。たとえば、`cart.jsp`で使用されている「clear cart」ウィジェットは、現時点ではリンクがクリックされると`clear`パラメータを`true`に設定します。
@@ -656,9 +762,13 @@
</session-timeout>
</session-config>
----
-2. 「一般」タブをクリックして、「セッション・タイム・アウト」フィールドに「`10`」と入力します。
+
+[start=2]
+. 「一般」タブをクリックして、「セッション・タイム・アウト」フィールドに「`10`」と入力します。
image::images/session-timeout.png[title="web.xmlの「一般」タブでの、アプリケーションのセッション・タイムアウトの指定"]
-3. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
+
+[start=3]
+. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
「XML」ビューに戻ると、`<session-timeout>`要素が更新されていることを確認できます。
@@ -687,31 +797,51 @@
<session-timeout>*1*</session-timeout>
</session-config>
----
-2. `AffableBean`プロジェクトを実行します。ブラウザでカテゴリ・ページをクリックして、項目をいくつかカートに追加してから「view cart」をクリックします。
+
+[start=2]
+. `AffableBean`プロジェクトを実行します。ブラウザでカテゴリ・ページをクリックして、項目をいくつかカートに追加してから「view cart」をクリックします。
image::images/cart-page-session-intact.png[title="カート・ページにはセッション・オブジェクトに応じてショッピング・カートの項目が表示される"]
-3. 少なくとも1分間待ちます。
-4. カート・ページに表示された項目のうち、1つの項目の数量を更新します。(1から99までのいずれかの数字を入力できます。)「update」をクリックします。サーバーからHTTPステータス500のメッセージが返されます。
+
+[start=3]
+. 少なくとも1分間待ちます。
+
+[start=4]
+. カート・ページに表示された項目のうち、1つの項目の数量を更新します。(1から99までのいずれかの数字を入力できます。)「update」をクリックします。サーバーからHTTPステータス500のメッセージが返されます。
image::images/glassfish-error-report.png[title="有効期限切れセッションに対するリクエストを受信するとNullPointerExceptionが発生する"]
-5. IDEでGlassFishサーバー・ログを調べます。「出力」ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])を開き、「GlassFish Server」タブを選択します。ログの最下部までスクロールして、エラーのスタック・トレースを調べます。
+
+[start=5]
+. IDEでGlassFishサーバー・ログを調べます。「出力」ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])を開き、「GlassFish Server」タブを選択します。ログの最下部までスクロールして、エラーのスタック・トレースを調べます。
[.feature]
--
image:images/gf-server-output.png[role="left", link="images/gf-server-output.png"]
--
サーバー・ログに、`ControllerServlet`の184行目で`NullPointerException`が発生したことが示されています。「出力」ウィンドウには、例外が発生した行へのリンクが表示されます。
-6. リンクをクリックします。`ControllerServlet`の184行目に直接移動します。エディタの左マージンにあるエラー・バッジの上にカーソルを置くと、例外を説明するツールチップが表示されます。
+
+[start=6]
+. リンクをクリックします。`ControllerServlet`の184行目に直接移動します。エディタの左マージンにあるエラー・バッジの上にカーソルを置くと、例外を説明するツールチップが表示されます。
image::images/nullpointer-exception.png[title="エラー・バッジとツールチップによる問題の場所および原因の提示"]
リクエストを受け取る前にセッションがすでに有効期限切れになっていたため、サーブレット・エンジンは、対応するセッションにリクエストを関連付けることができませんでした。このため、`cart`オブジェクトを見つけられませんでした(151行目)。最終的に184行目で、`null`と等しい変数のメソッドをエンジンがコールしようとしたときに例外が発生しました。
これで問題を特定できたので、フィルタを実装して修正しましょう。
-7. IDEのメイン・ツールバーにある「新規ファイル」(image::images/new-file-btn.png[])ボタンをクリックします。または、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押します。
-8. 「*Web*」カテゴリから「*フィルタ*」を選択し、「次」をクリックします。
-9. フィルタに「`SessionTimeoutFilter`」という名前を付けます。「パッケージ」フィールドに「`filter`」と入力して、フィルタ・クラスが作成時に新しいパッケージに配置されるようにします。
-10. 「次」をクリックします。デフォルトの設定を受け入れ、「終了」をクリックします。`SessionTimeoutFilter`のテンプレートが生成され、エディタで開きます。
+
+[start=7]
+. IDEのメイン・ツールバーにある「新規ファイル」(image::images/new-file-btn.png[])ボタンをクリックします。または、[Ctrl]-[N] (Macの場合は[⌘]-[N])を押します。
+
+[start=8]
+. 「*Web*」カテゴリから「*フィルタ*」を選択し、「次」をクリックします。
+
+[start=9]
+. フィルタに「`SessionTimeoutFilter`」という名前を付けます。「パッケージ」フィールドに「`filter`」と入力して、フィルタ・クラスが作成時に新しいパッケージに配置されるようにします。
+
+[start=10]
+. 「次」をクリックします。デフォルトの設定を受け入れ、「終了」をクリックします。`SessionTimeoutFilter`のテンプレートが生成され、エディタで開きます。
*注意:* NetBeans 6.9の時点では、ウィザードを使用してWebデプロイメント・ディスクリプタに登録されていないサーブレットへのマッピングを設定できません。(`ControllerServlet`は`@WebServlet`注釈を使用して登録されています。)このため、生成されたコードを次の手順で変更します。
-11. `@WebFilter`注釈署名を次のように変更します。
+
+[start=11]
+. `@WebFilter`注釈署名を次のように変更します。
[source,java]
----
@@ -730,7 +860,9 @@
`Filter`インタフェースに関するドキュメントを参照するには、「Javadoc索引検索」を使用します。[Shift]-[F1] (Macの場合は[fn]-[Shift]-[F1])を押してから、検索フィールドに「`Filter`」と入力して[Enter]を押します。「Interface in javax.servlet」エントリを選択します。索引検索ツールの下部のペインに、Javadocドキュメントが表示されます。
-12. `SessionTimeoutFilter`の本文を、次の内容に置き換えます。
+
+[start=12]
+. `SessionTimeoutFilter`の本文を、次の内容に置き換えます。
[source,java]
----
@@ -764,27 +896,55 @@
}
----
-13. [Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押してインポート文を修正します。(`HttpServletRequest`および`HttpSession`のためのインポートの追加が必要。)また、エディタのヒントを使用して`init`、`destroy`および`doFilter`メソッドに`@Override`注釈を追加します。
+
+[start=13]
+. [Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押してインポート文を修正します。(`HttpServletRequest`および`HttpSession`のためのインポートの追加が必要。)また、エディタのヒントを使用して`init`、`destroy`および`doFilter`メソッドに`@Override`注釈を追加します。
以降の手順では、プロジェクトでデバッガを実行して`doFilter`メソッドをステップ実行し、リクエストが既存のセッションにバインドされているかどうかをこのメソッドが判定する方法を確認します。
-14. 「ブレークポイント」ウィンドウを開き([Alt]-[Shift]-[5]、Macの場合は[Ctrl]-[Shift]-[5])、既存のブレークポイントが設定されていないことを確認します。ブレークポイントを削除するには、ブレークポイントを右クリックして「削除」を選択します。(前述の課題である<<http-monitor,HTTPモニターによるクライアントとサーバー間の通信の確認>>を完了した場合は、`ControllerServlet`に未処理のブレークポイントが設定されている可能性があります。)
-15. デバッガを実行します。IDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image::images/debug-project-btn.png[])ボタンをクリックします。
-16. ブラウザに開始ページが表示されたら、カテゴリを選択してからショッピング・カートにいくつか項目を追加します。
-17. `SessionTimeoutFilter`の`doFilter`メソッドで、セッションへのアクセスを試行する行(32行目)にブレークポイントを設定します。
+
+[start=14]
+. 「ブレークポイント」ウィンドウを開き([Alt]-[Shift]-[5]、Macの場合は[Ctrl]-[Shift]-[5])、既存のブレークポイントが設定されていないことを確認します。ブレークポイントを削除するには、ブレークポイントを右クリックして「削除」を選択します。(前述の課題である<<http-monitor,HTTPモニターによるクライアントとサーバー間の通信の確認>>を完了した場合は、`ControllerServlet`に未処理のブレークポイントが設定されている可能性があります。)
+
+[start=15]
+. デバッガを実行します。IDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image::images/debug-project-btn.png[])ボタンをクリックします。
+
+[start=16]
+. ブラウザに開始ページが表示されたら、カテゴリを選択してからショッピング・カートにいくつか項目を追加します。
+
+[start=17]
+. `SessionTimeoutFilter`の`doFilter`メソッドで、セッションへのアクセスを試行する行(32行目)にブレークポイントを設定します。
image::images/filter-breakpoint.png[title="getSessionメソッドへのブレークポイントの設定"]
-18. ブラウザで「view cart」ボタンをクリックします。IDEに切り替えると、デバッガがブレークポイントで一時停止されていることがわかります。
+
+[start=18]
+. ブラウザで「view cart」ボタンをクリックします。IDEに切り替えると、デバッガがブレークポイントで一時停止されていることがわかります。
その時点でセッション・オブジェクトが存在しない場合、`getSession()`は新しいセッション・オブジェクトを作成することを思い出してください。ここでは、オブジェクトが見つからなくても新規作成を行わない`getSession(false)`を使用します。つまり、セッションが存在しない場合、メソッドは`null`を返します。
-19. 「ステップ・オーバー」(image::images/step-over-btn.png[])ボタンをクリックしてから、`session`変数の上にカーソルを移動します。前回のリクエストが送信されてから1分が経過していなければ、変数が`StandardSessionFacade`に割り当てられていることを確認できます。これは、リクエストのセッション・オブジェクトを表します。
+
+[start=19]
+. 「ステップ・オーバー」(image::images/step-over-btn.png[])ボタンをクリックしてから、`session`変数の上にカーソルを移動します。前回のリクエストが送信されてから1分が経過していなければ、変数が`StandardSessionFacade`に割り当てられていることを確認できます。これは、リクエストのセッション・オブジェクトを表します。
image::images/session-exists.png[title="変数へのカーソルの移動によるその現在値の判定"]
-20. リクエストが処理されるまで、メソッドをステップ実行し続けます。`session`は`null`と等しくないため、`if`文をスキップすると、`chain.doFilter`はリクエストを`ControllerServlet`に転送します(44行目)。
-21. ブラウザで、1分間が過ぎたことを確認してから、カートの製品項目のうちの1つの数量を更新します。この手順は、この課題の最初の方で実行してステータス500のメッセージが返されたときと同じ手順です。ここでは、`ControllerServlet`に送信されたリクエストをフィルタがインターセプトするようになったので、セッション・タイム・アウトが起きるとどうなるかを確認しましょう。
-22. 「update」をクリックしてからIDEに切り替えると、フィルタに設定されたブレークポイントでデバッガが再度一時停止されています。
-23. `req.getSession(false)`の式を強調表示してから、この上にカーソルを移動します。ここでは、セッションがすでに有効期限切れになっているため、式が`null`と等しいことが確認できます。
+
+[start=20]
+. リクエストが処理されるまで、メソッドをステップ実行し続けます。`session`は`null`と等しくないため、`if`文をスキップすると、`chain.doFilter`はリクエストを`ControllerServlet`に転送します(44行目)。
+
+[start=21]
+. ブラウザで、1分間が過ぎたことを確認してから、カートの製品項目のうちの1つの数量を更新します。この手順は、この課題の最初の方で実行してステータス500のメッセージが返されたときと同じ手順です。ここでは、`ControllerServlet`に送信されたリクエストをフィルタがインターセプトするようになったので、セッション・タイム・アウトが起きるとどうなるかを確認しましょう。
+
+[start=22]
+. 「update」をクリックしてからIDEに切り替えると、フィルタに設定されたブレークポイントでデバッガが再度一時停止されています。
+
+[start=23]
+. `req.getSession(false)`の式を強調表示してから、この上にカーソルを移動します。ここでは、セッションがすでに有効期限切れになっているため、式が`null`と等しいことが確認できます。
image::images/session-null.png[title="強調表示した式へのカーソルの移動によるその現在値の判定"]
-24. 続けてコードをステップ実行します。ここでは、`session`変数が`null`と等しくなっているため、35行目の`if`文が処理され、リクエストが`/index.jsp`に転送されます。デバッガが実行を終了すると、ブラウザにサイトの開始ページが表示されます。
-25. セッションの終了(image::images/finish-session-btn.png[])ボタンをクリックして、デバッグ・セッションを終了します。
-26. プロジェクトの`web.xml`ファイルを開き、セッション・タイム・アウトの間隔を10分に戻します。
+
+[start=24]
+. 続けてコードをステップ実行します。ここでは、`session`変数が`null`と等しくなっているため、35行目の`if`文が処理され、リクエストが`/index.jsp`に転送されます。デバッガが実行を終了すると、ブラウザにサイトの開始ページが表示されます。
+
+[start=25]
+. セッションの終了(image::images/finish-session-btn.png[])ボタンをクリックして、デバッグ・セッションを終了します。
+
+[start=26]
+. プロジェクトの`web.xml`ファイルを開き、セッション・タイム・アウトの間隔を10分に戻します。
[source,xml]
----
@@ -793,7 +953,9 @@
<session-timeout>*10*</session-timeout>
</session-config>
----
-27. ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])します。
+
+[start=27]
+. ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])します。
link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot6.zip[+スナップショット6+]は、このチュートリアル・ユニットのプロジェクトの完成版を示しています。最後に、セッション管理に関する1つのトピックについて説明します。セッション・オブジェクトで`invalidate`メソッドをコールすることで、セッションを明示的に終了させることができます。セッションが不要になったら、サーバーが使用するメモリーを節約するために、そのセッションは除去するようにしてください。次のユニットであるlink:transaction.html[+ビジネス・ロジックの取引の統合+]を完了すると、顧客の注文を正常に処理したときに`ControllerServlet`が`invalidate`メソッドを使用してどのようにユーザーの`cart`オブジェクトを破棄し、セッションを終了するかがわかります。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_pt_BR.asciidoc
index 8fad189..84bd592 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_pt_BR.asciidoc
@@ -256,14 +256,18 @@
* `WEB-INF/view/category.jsp`
* `WEB-INF/view/checkout.jsp`
* `controller/ControllerServlet`
-2. Execute o projeto (image::images/run-project-btn.png[]) para garantir que esteja configurado corretamente com seu banco de dados e servidor de aplicações.
+
+[start=2]
+. Execute o projeto (image::images/run-project-btn.png[]) para garantir que esteja configurado corretamente com seu banco de dados e servidor de aplicações.
Se receber uma mensagem de erro ao executar o projeto, consulte novamente as link:setup.html[+instruções de configuração+], que descrevem como preparar um banco de dados e estabelecer conectividade entre o IDE, o GlassFish e o MySQL.
-3. Teste a funcionalidade da aplicação no browser. Se estiver prosseguindo diretamente da link:entity-session.html[+unidade anterior do tutorial+], notará as seguintes melhorias.
+
+[start=3]
+. Teste a funcionalidade da aplicação no browser. Se estiver prosseguindo diretamente da link:entity-session.html[+unidade anterior do tutorial+], notará as seguintes melhorias.
-==== página de categoria
+=== página de categoria
* Clicar em "adicionar ao carrinho" ativa, pela primeira vez, o carrinho de compras e os widgets "avançar para check-out" para serem exibidos no cabeçalho.
* Clicar em "adicionar ao carrinho" resulta em uma atualização no número de itens do carrinho no widget do carrinho de compras do cabeçalho.
@@ -273,7 +277,7 @@
[[cartPage]]
-==== página do carrinho
+=== página do carrinho
* Clicar em "limpar carrinho" resulta no esvaziamento dos itens do carrinho de compras.
* Clicar em "continuar comprando" resulta em um retorno à categoria exibida previamente.
@@ -283,23 +287,31 @@
image::images/cart-page.png[title="A página Carrinho inclui a funcionalidade do carrinho de compras"]
-==== página de check-out
+=== página de check-out
* Clicar em "exibir carrinho" resulta na exibição da página do carrinho.
* Clicar em "submeter compra" resulta na exibição da página de confirmação (sem dados específicos do usuário).
image::images/checkout-page.png[title="A página Check-out inclui a funcionalidade do carrinho de compras"]
-4. Utilize a caixa de diálogo Ir para Arquivo para abrir o `ControllerServlet` no editor. Pressione Alt-Shift-O (Ctrl-Shift-O no Mac), digite "`Controller`" na caixa de diálogo e clique em OK.
+
+[start=4]
+. Utilize a caixa de diálogo Ir para Arquivo para abrir o `ControllerServlet` no editor. Pressione Alt-Shift-O (Ctrl-Shift-O no Mac), digite "`Controller`" na caixa de diálogo e clique em OK.
image::images/go-to-file-dialog.png[title="Use a caixa de diálogo Ir para Arquivo para abrir rapidamente recursos do projeto no editor"]
-5. Defina um ponto de interrupção no método `doPost` na linha que cria um objeto `HttpSession` (linha 150). Para definir um ponto de interrupção, clique na margem esquerda do editor.
+
+[start=5]
+. Defina um ponto de interrupção no método `doPost` na linha que cria um objeto `HttpSession` (linha 150). Para definir um ponto de interrupção, clique na margem esquerda do editor.
image::images/breakpoint.png[title="Clique na margem esquerda do editor para definir pontos de interrupção"]
Para alternar números de linhas para o editor, clique com o botão direito do mouse na margem esquerda e selecione Exibir Número de Linhas.
-6. Execute o depurador. Clique no botão Depurar Projeto (image::images/debug-project-btn.png[]) na barra de ferramentas principal do IDE. O GlassFish Server será iniciado (ou reiniciado, se já estiver sendo executado) e abrirá um soquete no número da porta de depuração. A página de boas-vindas da aplicação será aberta no browser.
+
+[start=6]
+. Execute o depurador. Clique no botão Depurar Projeto (image::images/debug-project-btn.png[]) na barra de ferramentas principal do IDE. O GlassFish Server será iniciado (ou reiniciado, se já estiver sendo executado) e abrirá um soquete no número da porta de depuração. A página de boas-vindas da aplicação será aberta no browser.
É possível exibir e modificar o número da porta do depurador a partir da janela Servidores (Ferramentas > Servidores). Selecione a guia Java para o servidor que está utilizando. Especifique o número da porta no campo "Endereço a ser utilizado" em Definições de Depuração.
-7. Quando a página de boas-vindas da aplicação for exibida no browser, clique em qualquer imagem da categoria para navegar para a página da categoria. Lembre-se de que quando você clicar no botão "adicionar ao carrinho" uma solicitação `addToCart` será enviada ao servidor:
+
+[start=7]
+. Quando a página de boas-vindas da aplicação for exibida no browser, clique em qualquer imagem da categoria para navegar para a página da categoria. Lembre-se de que quando você clicar no botão "adicionar ao carrinho" uma solicitação `addToCart` será enviada ao servidor:
[source,java]
----
@@ -307,9 +319,13 @@
<form action="addToCart" method="post">
----
Como você deve se lembrar de link:page-views-controller.html#controller[+Preparando as Views de Página e o Servlet do Controlador+], o método `doPost` de `ControllerServlet` trata solicitações para o padrão de URL `/addToCart`. Você poderá, portanto, esperar que quando um usuário clica no botão "adicionar ao carrinho", o método `doPost` é chamado.
-8. Clique em "adicionar ao carrinho" para qualquer produto na página da categoria. Volte para o IDE e note que o depurador é suspenso no ponto de interrupção.
+
+[start=8]
+. Clique em "adicionar ao carrinho" para qualquer produto na página da categoria. Volte para o IDE e note que o depurador é suspenso no ponto de interrupção.
image::images/breakpoint-suspended.png[title="O depurador é suspenso em pontos de interrupção no editor"]
-9. Posicione o cursor na chamada para `getSession()` e pressione Ctrl-Espaço para chamar a documentação do Javadoc.
+
+[start=9]
+. Posicione o cursor na chamada para `getSession()` e pressione Ctrl-Espaço para chamar a documentação do Javadoc.
image::images/javadoc-getsession.png[title="Pressione Ctrl-Espaço para chamar a documentação do Javadoc"]
De acordo com a documentação, a `getSession()` retorna a `HttpSession` atualmente associada à solicitação e, caso não exista nenhuma sessão, o método cria um novo objeto de sessão.
@@ -353,10 +369,16 @@
* link:http://java.sun.com/j2se/javadoc/[+Home Page Oficial da Ferramenta Javadoc+]
* link:http://java.sun.com/j2se/javadoc/writingdoccomments/index.html[+Como Escrever Comentários Doc na Ferramenta Javadoc+]
-10. Passe o mouse sobre a variável `session`. Observe que o depurador é suspenso na linha _está prestes a ser executado._ O valor retornado por `getSession()` ainda não foi salvo na variável de `session` e você verá uma popup informando que "` session` não é uma variável conhecida "no contexto atual".
+
+[start=10]
+. Passe o mouse sobre a variável `session`. Observe que o depurador é suspenso na linha _está prestes a ser executado._ O valor retornado por `getSession()` ainda não foi salvo na variável de `session` e você verá uma popup informando que "` session` não é uma variável conhecida "no contexto atual".
image::images/session-variable.png[title="Passe o mouse sobre variáveis e expressões para determinar seus valores atuais"]
-11. Clique no botão Fazer Step Over (image::images/step-over-btn.png[]) na barra de ferramentas do depurador, localizada acima do editor. A linha será executada e o depurador passará para a próxima linha do arquivo.
-12. Passe novamente o mouse sobre a variável `session`. Agora você poderá ver o valor definido no momento para a variável `session`.
+
+[start=11]
+. Clique no botão Fazer Step Over (image::images/step-over-btn.png[]) na barra de ferramentas do depurador, localizada acima do editor. A linha será executada e o depurador passará para a próxima linha do arquivo.
+
+[start=12]
+. Passe novamente o mouse sobre a variável `session`. Agora você poderá ver o valor definido no momento para a variável `session`.
[.feature]
--
image::images/session-variable-set.png[role="left", link="images/session-variable-set.png"]
@@ -364,18 +386,30 @@
No NetBeans 6.9, você pode clicar no ponteiro cinza (image::images/grey-pointer.png[]) no popup para expandir uma lista de valores de variáveis contidos no elemento destacado.
-13. Clique o botão Fazer Step Over (image::images/step-over-btn.png[]) (F8; fn-F8 no Mac) para chegar à instrução `if` (linha 154). Como você acabou de clicar no botão "adicionar ao carrinho" no browser, deve sabe que a expressão `userPath.equals("/addToCart)` deverá ser avaliada como `true`.
-14. Realce a expressão `userPath.equals("/addToCart")` (clicando com o mouse enquanto mantém a tecla Ctrl pressionada). Desta vez você verá um popup que indica o valor da expressão que foi realçada.
+
+[start=13]
+. Clique o botão Fazer Step Over (image::images/step-over-btn.png[]) (F8; fn-F8 no Mac) para chegar à instrução `if` (linha 154). Como você acabou de clicar no botão "adicionar ao carrinho" no browser, deve sabe que a expressão `userPath.equals("/addToCart)` deverá ser avaliada como `true`.
+
+[start=14]
+. Realce a expressão `userPath.equals("/addToCart")` (clicando com o mouse enquanto mantém a tecla Ctrl pressionada). Desta vez você verá um popup que indica o valor da expressão que foi realçada.
image::images/expression.png[title="Destaque as expressões para determinar seus valores atuais"]
-15. Pressione F8 (fn-F8 no Mac) para passar para a próxima linha (linha 158). A aplicação foi criada para que o objeto `ShoppingCart` para a sessão do usuário seja criado somente quando o usuário adicionar um item ao carrinho pela primeira vez. Já que esta é a primeira vez que a solicitação `addToCart` foi recebida nesta sessão de depuração, pode-se esperar que o objeto `cart` seja igual a `null`.
+
+[start=15]
+. Pressione F8 (fn-F8 no Mac) para passar para a próxima linha (linha 158). A aplicação foi criada para que o objeto `ShoppingCart` para a sessão do usuário seja criado somente quando o usuário adicionar um item ao carrinho pela primeira vez. Já que esta é a primeira vez que a solicitação `addToCart` foi recebida nesta sessão de depuração, pode-se esperar que o objeto `cart` seja igual a `null`.
image::images/cart-null.png[title="O objeto carrinho não existe, até que o usuário adicione item ao carrinho de compras"]
-16. Pressione F8 (fn-F8 no Mac) para passar à próxima linha (linha 160). Depois, na linha 160, onde o objeto `ShoppingCart` é criado, clique no botão Fazer Step Into (image::images/step-into-btn.png[]). O depurador entra no método que está sendo chamado. Neste caso, você será levado diretamente ao construtor do `ShoppingCart`.
+
+[start=16]
+. Pressione F8 (fn-F8 no Mac) para passar à próxima linha (linha 160). Depois, na linha 160, onde o objeto `ShoppingCart` é criado, clique no botão Fazer Step Into (image::images/step-into-btn.png[]). O depurador entra no método que está sendo chamado. Neste caso, você será levado diretamente ao construtor do `ShoppingCart`.
image::images/cart-constructor.png[title="Fazer step into nos métodos para seguir a execução de runtime para outras classes"]
-17. Pressione Ctrl-Tab para voltar ao `ControllerServlet`. Observe que o IDE fornece um Emblema (image::images/call-stack-badge.png[]) de Pilha de Chamada na linha 160, indicando que o depurador está suspenso temporariamente em algum lugar em um método mais no início da pilha de chamada.
+
+[start=17]
+. Pressione Ctrl-Tab para voltar ao `ControllerServlet`. Observe que o IDE fornece um Emblema (image::images/call-stack-badge.png[]) de Pilha de Chamada na linha 160, indicando que o depurador está suspenso temporariamente em algum lugar em um método mais no início da pilha de chamada.
Pressione Alt-Shift-3 (Ctrl-Shift-3 no Mac) para abrir a janela Pilha de Chamada do IDE.
-18. Pressione F8 (fn-F8 no Mac) para continuar avançando pelo código. Quando o depurador conclui o construtor `ShoppingCart`, você é levado de volta ao `ControllerServlet`.
+
+[start=18]
+. Pressione F8 (fn-F8 no Mac) para continuar avançando pelo código. Quando o depurador conclui o construtor `ShoppingCart`, você é levado de volta ao `ControllerServlet`.
A linha 161 do `ControllerServlet` vincula o objeto `cart` recém-criado à sessão.
@@ -391,7 +425,9 @@
--
Se expandir o nó sessão > sessão > atributos, você poderá exibir os objetos que estão vinculados à sessão. Na imagem acima há dois itens vinculados atualmente à sessão (realçados). Eles são `selectedCategory` e `categoryProducts`, instanciados no `ControllerServlet`, nas linhas 83 e 89, respectivamente. Os dois itens foram vinculados anteriormente, quando você clicou na imagem de uma categoria, e o `ControllerServlet` processou a solicitação da página da categoria.
-19. Pressione F8 (fn-F8 no Mac) para executar a linha 161. O objeto `cart` será vinculado à sessão e a janela Variáveis será atualizada para exibir as alterações. Na janela Variáveis, note que agora a sessão contém três atributos, sendo o terceiro o objeto `ShoppingCart` recém-inicializado (realçado abaixo).
+
+[start=19]
+. Pressione F8 (fn-F8 no Mac) para executar a linha 161. O objeto `cart` será vinculado à sessão e a janela Variáveis será atualizada para exibir as alterações. Na janela Variáveis, note que agora a sessão contém três atributos, sendo o terceiro o objeto `ShoppingCart` recém-inicializado (realçado abaixo).
[.feature]
--
image::images/variables-win-session-cart.png[role="left", link="images/variables-win-session-cart.png"]
@@ -405,8 +441,12 @@
* um objeto `Product` é criado utilizando o ID (linha 169)
* um novo `ShoppingCartItem` é criado utilizando o `product` (linha 170)
* o `ShoppingCartItem` é adicionado à lista de `itens` do `ShoppingCart` (linha 170)
-20. Pressione F8 (fn-F8 no Mac) para continuar avançando pelo código, ao mesmo tempo ciente das quatro ações listadas acima. Pause quando o depurador for suspenso na linha 170.
-21. Crie um watch na sessão. Isso lhe permitirá exibir valores contidos na sessão ao fazer step into no método `addItem` na próxima etapa. Clique com o botão direito do mouse na sessão na janela Variáveis e selecione Criar Watch Fixo.
+
+[start=20]
+. Pressione F8 (fn-F8 no Mac) para continuar avançando pelo código, ao mesmo tempo ciente das quatro ações listadas acima. Pause quando o depurador for suspenso na linha 170.
+
+[start=21]
+. Crie um watch na sessão. Isso lhe permitirá exibir valores contidos na sessão ao fazer step into no método `addItem` na próxima etapa. Clique com o botão direito do mouse na sessão na janela Variáveis e selecione Criar Watch Fixo.
image::images/create-watch.png[title="Crie controles em variáveis, à medida que percorre o código em uma sessão de depuração"]
Como alternativa, você pode colocar o cursor na variável `session` no editor e, em seguida, clicar com o botão direito do mouse e selecionar Novo Watch. A caixa de diálogo Novo Watch permite que você especifique variáveis ou expressões para watch continuamente ao depurar uma aplicação. (No caso de expressões, realce primeiro a expressão e, em seguida, clique com o botão direito do mouse e selecione Novo Watch.)
@@ -415,23 +455,37 @@
Um novo watch será criado na variável `session` e em todas as variáveis que ela contiver. O watch é visível na janela Watches (Janela >Depuração >Watches) ou, se você alternar o botão Watches (image::images/watch-btn.png[]) na margem esquerda da janela Variáveis, ele será exibido na linha superior da janela Variáveis.
O depurador lhe permite ficar atento às variáveis enquanto percorre o código. Isso pode ser útil, por exemplo, se você quiser seguir as alterações de valores de variáveis específicas (e não quiser ter que analisar toda a lista apresentada na janela Variáveis em cada etapa) ou se fizer step into temporariamente em uma classe que não contenha as variáveis que lhe interessam.
-22. Clique na botão Fazer Step Into para (image::images/step-into-btn.png[]) fazer step into no método `addItem` do `ShoppingCart`.
-23. Percorra o método `addItem` até chegar na linha 53. Como o Javadoc atesta, `addItem` _"adiciona um `ShoppingCartItem` à lista de `items` do `ShoppingCart`. Se o item do `product` especificado já existe no carrinho de compra, a quantidade desse item é aumentada."_
-24. Examine a variável `session` na qual você criou um watch (<<step21,etapa 21>> acima). A instrução `items.add(scItem)` na linha 51 adicionou o novo `ShoppingCartItem` à lista de `items` no `ShoppingCart`. Isso fica evidente ao entrar no terceiro atributo (ex., a variável `cart`) contida na sessão.
+
+[start=22]
+. Clique na botão Fazer Step Into para (image::images/step-into-btn.png[]) fazer step into no método `addItem` do `ShoppingCart`.
+
+[start=23]
+. Percorra o método `addItem` até chegar na linha 53. Como o Javadoc atesta, `addItem` _"adiciona um `ShoppingCartItem` à lista de `items` do `ShoppingCart`. Se o item do `product` especificado já existe no carrinho de compra, a quantidade desse item é aumentada."_
+
+[start=24]
+. Examine a variável `session` na qual você criou um watch (<<step21,etapa 21>> acima). A instrução `items.add(scItem)` na linha 51 adicionou o novo `ShoppingCartItem` à lista de `items` no `ShoppingCart`. Isso fica evidente ao entrar no terceiro atributo (ex., a variável `cart`) contida na sessão.
[.feature]
--
image::images/variables-window-add-item.png[role="left", link="images/variables-window-add-item.png"]
--
Nesta etapa, você pode ver como uma `HttpSession` é criada para a solicitação, como um objeto `ShoppingCart` é criado e anexado à sessão e como um `ShoppingCartItem` é criado com base na escolha de produto do usuário e adicionado à lista de `Items` do `ShoppingCart`. A única ação remanescente é encaminhar a solicitação à view `category.jsp`.
-25. Abra o fragmento JSP do cabeçalho (`header.jsp`) no editor e coloque um ponto de interrupção na linha 86. Essa linha contém a instrução EL no widget do carrinho de compras que exibe o número de itens do carrinho.
+
+[start=25]
+. Abra o fragmento JSP do cabeçalho (`header.jsp`) no editor e coloque um ponto de interrupção na linha 86. Essa linha contém a instrução EL no widget do carrinho de compras que exibe o número de itens do carrinho.
image::images/breakpoint-jsp.png[title="Você pode suspender o depurador nas páginas JSP"]
-26. Clique no botão Continuar ( image::images/continue-btn.png[] ) na barra de ferramentas do depurador. O depurador continua agindo até que a execução seja concluída ou até atingir outro ponto de interrupção. Nesse caso, o depurador é suspenso na linha 86 no fragmento JSP do cabeçalho.
+
+[start=26]
+. Clique no botão Continuar ( image::images/continue-btn.png[] ) na barra de ferramentas do depurador. O depurador continua agindo até que a execução seja concluída ou até atingir outro ponto de interrupção. Nesse caso, o depurador é suspenso na linha 86 no fragmento JSP do cabeçalho.
*Observação:* para suspender o depurador em uma página JSP, é necessário definir um ponto de interrupção. Por exemplo, quando o `ControllerServlet` encaminha a solicitação à view apropriada, o depurador não será suspenso automaticamente dentro da página JSP.
-27. Abra a janela Variáveis (Alt-Shift-1; Ctrl-Shift-1 no Mac), se ainda não estiver aberta. Diferente do que acontece com as classes Java, o depurador _não_ fornece dicas de ferramenta quando o mouse é posicionado sobre as variáveis ou expressões em uma página JSP. Entretanto, a janela Variáveis lhe permitirá determinar os valores das variáveis ao percorrer o código. Então, onde você pode encontrar o valor para `${cart.numberOfItems}`?
-28. Na janela Variáveis, amplie o nó Objetos implícitos > pageContext > sessão > sessão > atributos. Isso permite o acesso ao objeto de sessão, como o que foi visto anteriormente ao trabalhar com o `ControllerServlet`. Na verdade, você pode notar que a sessão na qual um watch foi criado na etapa 21 acima indica o mesmo objeto. Aqui você pode verificar se o valor de `${cart.numberOfItems}` é igual a "`1`".
+
+[start=27]
+. Abra a janela Variáveis (Alt-Shift-1; Ctrl-Shift-1 no Mac), se ainda não estiver aberta. Diferente do que acontece com as classes Java, o depurador _não_ fornece dicas de ferramenta quando o mouse é posicionado sobre as variáveis ou expressões em uma página JSP. Entretanto, a janela Variáveis lhe permitirá determinar os valores das variáveis ao percorrer o código. Então, onde você pode encontrar o valor para `${cart.numberOfItems}`?
+
+[start=28]
+. Na janela Variáveis, amplie o nó Objetos implícitos > pageContext > sessão > sessão > atributos. Isso permite o acesso ao objeto de sessão, como o que foi visto anteriormente ao trabalhar com o `ControllerServlet`. Na verdade, você pode notar que a sessão na qual um watch foi criado na etapa 21 acima indica o mesmo objeto. Aqui você pode verificar se o valor de `${cart.numberOfItems}` é igual a "`1`".
[.feature]
--
image::images/variables-window-number-of-items.png[role="left", link="images/variables-window-number-of-items.png"]
@@ -440,7 +494,9 @@
Maximize a janela Variáveis, ou qualquer janela no IDE, clicando com o botão direito do mouse no cabeçalho da janela e, em seguida, selecionando Maximizar Janela (Shift-Esc).
O depurador lhe dá acesso ao objeto implícito `pageContext`. `pageContext` representa o contexto da página JSP e oferece acesso direto aos vários objetos, incluindo os objetos `HttpServletRequest`, `HttpSession` e `ServletContext`. Para obter mais informações, consulte o link:http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaij[+Tutorial do Java EE 5: Objetos Implícitos+].
-29. Clique no botão Finalizar Sessão (image::images/finish-session-btn.png[]). O runtime finaliza a execução e a sessão de depuração é encerrada. O browser exibe uma página de categoria totalmente renderizada e você poderá ver que o widget carrinho de compras no cabeçalho da página contém um item.
+
+[start=29]
+. Clique no botão Finalizar Sessão (image::images/finish-session-btn.png[]). O runtime finaliza a execução e a sessão de depuração é encerrada. O browser exibe uma página de categoria totalmente renderizada e você poderá ver que o widget carrinho de compras no cabeçalho da página contém um item.
Esperamos que agora você se sinta confortável ao utilizar o depurador do IDE, não somente para examinar seu projeto quando ele apresentar um comportamento inesperado, mas também como uma ferramenta que o ajuda a se familiarizar mais com o código. Outros botões úteis na barra de ferramentas do depurador incluem:
@@ -487,14 +543,24 @@
1. Comece com a ativação do monitor HTTP para o servidor que está utilizando. Selecione Ferramentas > Servidores. Na coluna à esquerda da janela Servidores, selecione o servidor que está utilizando (GlassFish). Em seguida, na coluna principal, selecione a opção Ativar Monitor HTTP.
image::images/servers-win-http-monitor.png[title="Selecione a opção Ativar Monitor HTTP para ativar o Monitor HTTP"]
-2. Se o servidor já estiver sendo executado, será necessário reiniciá-lo. No entanto, como pretende usar o depurador e executar o depurador reinicia o servidor para se comunicar em uma porta diferente, simplesmente clique no botão Depurar Projeto (image::images/debug-project-btn.png[]) no na barra de ferramentas principal do IDE. Quando o servidor é reiniciado, uma sessão de depuração é iniciada e a página de boas-vindas da aplicação é aberta no browser. O monitor HTTP é exibido na parte inferior do IDE.
+
+[start=2]
+. Se o servidor já estiver sendo executado, será necessário reiniciá-lo. No entanto, como pretende usar o depurador e executar o depurador reinicia o servidor para se comunicar em uma porta diferente, simplesmente clique no botão Depurar Projeto (image::images/debug-project-btn.png[]) no na barra de ferramentas principal do IDE. Quando o servidor é reiniciado, uma sessão de depuração é iniciada e a página de boas-vindas da aplicação é aberta no browser. O monitor HTTP é exibido na parte inferior do IDE.
image::images/http-monitor.png[title="O Monitor HTTP é exibido por default na região inferior do IDE"]
-3. Clique no registro AffableBean na coluna à esquerda (como mostrado na imagem acima). Quando você seleciona registros na coluna à esquerda, a coluna à direita (ex., principal) será atualizada para exibir os dados correspondentes. Na imagem acima, a guia Solicitação exibe o URI solicitado ( `/AffableBean/`), o método HTTP ( `GET`) e indica que nenhuma string de consulta foi enviada com a solicitação.
-4. Selecione a guia Sessão. Note que há uma instrução: "a sessão foi criada como resultado desta solicitação.&quot Isso se deve ao fato de o servidor ter enviado um cabeçalho `Set-Cookie` para o cookie`JSESSIONID` na sua resposta. Observe também que o novo ID da sessão está listado em "Propriedades da sessão". Como será mostrado mais tarde, o ID da sessão é o valor do cookie `JSESSIONID`.
+
+[start=3]
+. Clique no registro AffableBean na coluna à esquerda (como mostrado na imagem acima). Quando você seleciona registros na coluna à esquerda, a coluna à direita (ex., principal) será atualizada para exibir os dados correspondentes. Na imagem acima, a guia Solicitação exibe o URI solicitado ( `/AffableBean/`), o método HTTP ( `GET`) e indica que nenhuma string de consulta foi enviada com a solicitação.
+
+[start=4]
+. Selecione a guia Sessão. Note que há uma instrução: "a sessão foi criada como resultado desta solicitação.&quot Isso se deve ao fato de o servidor ter enviado um cabeçalho `Set-Cookie` para o cookie`JSESSIONID` na sua resposta. Observe também que o novo ID da sessão está listado em "Propriedades da sessão". Como será mostrado mais tarde, o ID da sessão é o valor do cookie `JSESSIONID`.
image::images/session-tab.png[title="Detalhes da sessão são exibidos na guia Sessão no Monitor HTTP"]
Talvez esteja pensando como um objeto de sessão foi criado de uma solicitação para a página de boas-vindas do site. Afinal, o `ControllerServlet` não trata a solicitação inicial para `/AffableBean/` e em nenhum lugar essa solicitação encontra `getSession()`. Ou encontra? Lembre-se de que as páginas JSP são compiladas em servlets na implantação. Depois de ter implantado o projeto no servidor, você poderá, na verdade, utilizar o IDE para exibir o servlet compilado do JSP no seu servidor.
-5. Na janela Projetos, clique com o botão direito do mouse no arquivo `index.jsp` e selecione Exibir Servlet. Será aberto um arquivo `index_jsp.java` no editor. Esse é o servlet que foi compilado automaticamente a partir da página `index.jsp`.
-6. Execute uma pesquisa no arquivo por `getSession`. Pressione Ctrl-F (⌘-F no Mac), digite "`getSession`" na barra de pesquisa e, em seguida, pressione Enter.
+
+[start=5]
+. Na janela Projetos, clique com o botão direito do mouse no arquivo `index.jsp` e selecione Exibir Servlet. Será aberto um arquivo `index_jsp.java` no editor. Esse é o servlet que foi compilado automaticamente a partir da página `index.jsp`.
+
+[start=6]
+. Execute uma pesquisa no arquivo por `getSession`. Pressione Ctrl-F (⌘-F no Mac), digite "`getSession`" na barra de pesquisa e, em seguida, pressione Enter.
Ctrl-F (⌘-F no Mac) é um atalho do teclado para Editar > Localizar.
@@ -510,12 +576,20 @@
Para encontrar a localização do servlet compilado no servidor, você pode passar o mouse sobre a guia do nome do servlet acima do editor. Um popup exibe o caminho o caminho para o arquivo no computador.
-7. No browser, selecione uma categoria e, em seguida, adicione um item ao seu carrinho. Volte para o IDE. Observe que o depurador é suspenso no ponto de interrupção no `ControllerServlet` que foi definido anteriormente (linha 150). Todos os pontos de interrupção são lembrados entre as sessões. Para remover o ponto de interrupção, você poderia clicar no emblema do ponto de interrupção (image::images/breakpoint-badge.png[]) na margem esquerda do editor. No entanto, como há vários pontos de interrupção já definidos no projeto, abra a janela Pontos de interrupção do depurador (Janela > Depuração > Pontos de Interrupção).
+
+[start=7]
+. No browser, selecione uma categoria e, em seguida, adicione um item ao seu carrinho. Volte para o IDE. Observe que o depurador é suspenso no ponto de interrupção no `ControllerServlet` que foi definido anteriormente (linha 150). Todos os pontos de interrupção são lembrados entre as sessões. Para remover o ponto de interrupção, você poderia clicar no emblema do ponto de interrupção (image::images/breakpoint-badge.png[]) na margem esquerda do editor. No entanto, como há vários pontos de interrupção já definidos no projeto, abra a janela Pontos de interrupção do depurador (Janela > Depuração > Pontos de Interrupção).
image::images/breakpoints-window.png[title="Exibir todos os pontos de interrupção em seu projeto na janela Pontos de interrupção"]
Na janela Pontos de interrupção, você pode exibir chamar ações em todos os pontos de interrupção definidos nos projetos abertos no IDE.
-8. Clique com o botão direito do mouse no ponto de interrupção definido em `header.jspf` e selecione Deletar. Em seguida, clique com o botão direito do mouse no ponto de interrupção definido no `ControllerServlet` e selecione Desativar. (Você irá reabilitá-lo mais tarde neste exercício.)
-9. Clique no botão Continuar (image::images/continue-btn.png[]). A execução da solicitação é finalizada e a página da categoria será exibida no browser com um item adicionado ao carrinho.
-10. No Monitor HTTP, procure a solicitação `addToCart` na coluna esquerda e, em seguida, selecione-a para exibir os detalhes na coluna principal.
+
+[start=8]
+. Clique com o botão direito do mouse no ponto de interrupção definido em `header.jspf` e selecione Deletar. Em seguida, clique com o botão direito do mouse no ponto de interrupção definido no `ControllerServlet` e selecione Desativar. (Você irá reabilitá-lo mais tarde neste exercício.)
+
+[start=9]
+. Clique no botão Continuar (image::images/continue-btn.png[]). A execução da solicitação é finalizada e a página da categoria será exibida no browser com um item adicionado ao carrinho.
+
+[start=10]
+. No Monitor HTTP, procure a solicitação `addToCart` na coluna esquerda e, em seguida, selecione-a para exibir os detalhes na coluna principal.
Clique no botão Classificação Ascendente (image::images/ascending-sort-btn.png[]) para que os registros mais recentes sejam listados na parte superior.
@@ -525,23 +599,39 @@
--
image::images/http-monitor-add-to-cart.png[role="left", link="images/http-monitor-add-to-cart.png"]
--
-11. Selecione a guia Cookies. Aqui você verá que existe um cookie chamado `JSESSIONID` e que foi enviado do cliente para o servidor. Observe que o valor para o cookie é igual ao do ID da Sessão exibido na guia Sessão.
+
+[start=11]
+. Selecione a guia Cookies. Aqui você verá que existe um cookie chamado `JSESSIONID` e que foi enviado do cliente para o servidor. Observe que o valor para o cookie é igual ao do ID da Sessão exibido na guia Sessão.
image::images/cookies-tab.png[title="Cookies são exibidos na guia Cookies no Monitor HTTP"]
Da mesma forma, se clicar na guia Cabeçalho, verá o cookie listado, já que "`Cookie`" é um cabeçalho da solicitação enviado pelo cliente.
image::images/headers-tab.png[title="Cookies são exibidos na guia Cookies no Monitor HTTP"]
Consulte a link:http://en.wikipedia.org/wiki/List_of_HTTP_headers[+Lista de cabeçalhos HTTP+] da Wikipedia para obter mais informações sobre cabeçalhos de solicitações e de respostas.
-12. Selecione a guia Sessão. Há uma instrução que indica: "A sessão existiu antes desta solilcitação". Note também que o atributo `cart` é listado em "Atributos de sessão depois da solicitação". Isso faz sentido, já que sabemos que o objeto `cart` está vinculado à sessão quando a solilcitação `addToCart` é processada pela primeira vez.
+
+[start=12]
+. Selecione a guia Sessão. Há uma instrução que indica: "A sessão existiu antes desta solilcitação". Note também que o atributo `cart` é listado em "Atributos de sessão depois da solicitação". Isso faz sentido, já que sabemos que o objeto `cart` está vinculado à sessão quando a solilcitação `addToCart` é processada pela primeira vez.
image::images/session-tab-add-to-cart.png[title="Atributos de sessão são exibidos na guia Sessão no Monitor HTTP"]
Nas próximas etapas, localize o ID da sessão e o cookie `JSESSIONID` na janela Variáveis.
-13. Reative o ponto de interrupção definido anteriormente no `ControllerServlet`. Pressione Alt-Shift-5 (Ctrl-Shift-5 no Mac) para abrir a janela Pontos de Interrupção e, em seguida, clique na caixa de seleção ao lado da entrada do ponto de interrupção para reativá-lo.
-14. No browser, clique no botão "adicionar ao carrinho" para um dos produtos listados.
-15. Alterne para o IDE e note que o depurador está suspenso no ponto de interrupção definido no `ControllerServlet`. Clique no botão Fazer Step Over (image::images/step-over-btn.png[]) para que a variável `session` seja atribuída ao objeto da sessão.
-16. Abra a janela Variáveis (Alt-Shift-1; Ctrl-Shift-1 no Mac) e expanda sessão > sessão. Você encontrará o ID da sessão listado como o valor para a variável `id`.
-17. Para localizar o cookie `JSESSIONID`, lembre-se de que você pode acessar normalmente os cookies de um servlet chamando o método link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] no `HttpServletRequest`. Portanto, entre no objeto da solicitação: solicitação > Herdado > solicitação > solicitação > Herdado > cookies. Aqui você pode ver a ArrayList `cookies`. Se expandir a lista, encontrará o cookie `JSESSIONID`, cujo valor é o ID da sessão.
-18. Clique no botão Finalizar Sessão (image::images/finish-session-btn.png[]) para encerrar a sessão de depuração.
+
+[start=13]
+. Reative o ponto de interrupção definido anteriormente no `ControllerServlet`. Pressione Alt-Shift-5 (Ctrl-Shift-5 no Mac) para abrir a janela Pontos de Interrupção e, em seguida, clique na caixa de seleção ao lado da entrada do ponto de interrupção para reativá-lo.
+
+[start=14]
+. No browser, clique no botão "adicionar ao carrinho" para um dos produtos listados.
+
+[start=15]
+. Alterne para o IDE e note que o depurador está suspenso no ponto de interrupção definido no `ControllerServlet`. Clique no botão Fazer Step Over (image::images/step-over-btn.png[]) para que a variável `session` seja atribuída ao objeto da sessão.
+
+[start=16]
+. Abra a janela Variáveis (Alt-Shift-1; Ctrl-Shift-1 no Mac) e expanda sessão > sessão. Você encontrará o ID da sessão listado como o valor para a variável `id`.
+
+[start=17]
+. Para localizar o cookie `JSESSIONID`, lembre-se de que você pode acessar normalmente os cookies de um servlet chamando o método link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] no `HttpServletRequest`. Portanto, entre no objeto da solicitação: solicitação > Herdado > solicitação > solicitação > Herdado > cookies. Aqui você pode ver a ArrayList `cookies`. Se expandir a lista, encontrará o cookie `JSESSIONID`, cujo valor é o ID da sessão.
+
+[start=18]
+. Clique no botão Finalizar Sessão (image::images/finish-session-btn.png[]) para encerrar a sessão de depuração.
[[url-rewrite]]
@@ -564,34 +654,50 @@
1. Desative os cookies temporariamente no browser. Se estiver utilizando o Firefox, poderá selecionar Ferramentas > Opções (Firefox > Preferências no Mac). Na janela exibida, selecione a guia Privacidade e, em seguida, em Histórico, selecione "Utilizar definições personalizadas para o histórico" na lista drop-down fornecida. Desmarque a opção "Aceitar cookies de sites".
image::images/firefox.png[title="Desative os cookies temporariamente no browser."]
-2. Execute o projeto `AffableBean`. Quando a página de boas-vindas for exibida, clique em uma categoria e, em seguida, tente adicionar um item ao seu carrinho. Você verá que a funcionalidade da aplicação está severamente comprometida no seu estado atual.
+
+[start=2]
+. Execute o projeto `AffableBean`. Quando a página de boas-vindas for exibida, clique em uma categoria e, em seguida, tente adicionar um item ao seu carrinho. Você verá que a funcionalidade da aplicação está severamente comprometida no seu estado atual.
image::images/compromised.png[title="A funcionalidade da aplicação fica comprometida quando o cliente não aceita cookies"]
Como antes, o servidor gera uma sessão e vincula objetos a ela. Isso mostra como a página da categoria pode exibir a categoria e os produtos selecionados. Entretanto, o servidor falhou na sua tentativa de definir um cookie `JSESSIONID`. Portanto, quando o cliente faz uma segunda solicitação (quando o usuário clica em "adicionar ao carrinho"), o servidor não tem como identificar a sessão à qual a solicitação pertence. Portanto, ele não pode localizar nenhum dos atributos definidos anteriormente na sessão, como `selectedCategory` e `categoryProducts`. Essa é a razão pela qual falta informações na resposta renderizada especificada por esses atributos.
-3. Abra a página `category.jsp` do projeto no editor. Localize a linha que implementa o botão "adicionar ao carrinho" (linha 58). O atributo `<form>` do elemento `action` determina a solicitação enviada ao servidor.
+
+[start=3]
+. Abra a página `category.jsp` do projeto no editor. Localize a linha que implementa o botão "adicionar ao carrinho" (linha 58). O atributo `<form>` do elemento `action` determina a solicitação enviada ao servidor.
[source,java]
----
<form action="addToCart" method="post">
----
-4. Modifique a solicitação de forma que seja passada pela guia `<c.url>`.
+
+[start=4]
+. Modifique a solicitação de forma que seja passada pela guia `<c.url>`.
[source,java]
----
<form action="*<c:url value='addToCart'/>*" method="post">
----
-5. Pressione Ctrl-S (⌘-S no Mac) para salvar as alterações do arquivo. Lembre-se de que o IDE fornece a funcionalidade Implantar ao Salvar, que é ativada por default. Isso significa que quaisquer alterações salvas são implantadas automaticamente no servidor.
-6. No browser, selecione uma categoria diferente para que a aplicação renderize a página da categoria modificada recentemente.
-7. Examine o código-fonte da página. No Firefox, você pode pressionar Ctrl-U (⌘-U no Mac). O botão "adicionar ao carrinho" de cada produto é exibido com o ID da sessão acrescentado ao URL.
+
+[start=5]
+. Pressione Ctrl-S (⌘-S no Mac) para salvar as alterações do arquivo. Lembre-se de que o IDE fornece a funcionalidade Implantar ao Salvar, que é ativada por default. Isso significa que quaisquer alterações salvas são implantadas automaticamente no servidor.
+
+[start=6]
+. No browser, selecione uma categoria diferente para que a aplicação renderize a página da categoria modificada recentemente.
+
+[start=7]
+. Examine o código-fonte da página. No Firefox, você pode pressionar Ctrl-U (⌘-U no Mac). O botão "adicionar ao carrinho" de cada produto é exibido com o ID da sessão acrescentado ao URL.
[source,java]
----
<form action="addToCart*;jsessionid=4188657e21d72f364e0782136dde*" method="post">
----
-8. Clique no botão "adicionar ao carrinho" de qualquer item. Você verá que o servidor agora pode determinar a sessão à qual a solicitação pertence e de renderizar a resposta de forma adequada.
-9. Antes de prosseguir, certifique-se de reativar os cookies no browser.
+
+[start=8]
+. Clique no botão "adicionar ao carrinho" de qualquer item. Você verá que o servidor agora pode determinar a sessão à qual a solicitação pertence e de renderizar a resposta de forma adequada.
+
+[start=9]
+. Antes de prosseguir, certifique-se de reativar os cookies no browser.
Novamente, cada link em que o usuário pode clicar na aplicação, cuja resposta exija alguma forma de dados relacionados à sessão, precisa ser codificado corretamente. Às vezes a implementação não é direta, como o exemplo mostrado acima. Por exemplo, o widget "limpar carrinho" utilizado no `cart.jsp` define atualmente um parâmetro `clear` como `true` quando o link é clicado.
@@ -657,9 +763,13 @@
</session-timeout>
</session-config>
----
-2. Clique na guia Geral e digite "`10`" no campo Time-out de Sessão.
+
+[start=2]
+. Clique na guia Geral e digite "`10`" no campo Time-out de Sessão.
image::images/session-timeout.png[title="Especifique o time-out de sessão para a aplicação na guia Geral do web.xml"]
-3. Salve o arquivo (Ctrl-S; ⌘-S no Mac).
+
+[start=3]
+. Salve o arquivo (Ctrl-S; ⌘-S no Mac).
Se voltar para a view XML, verá que o elemento `<session-timeout>` foi atualizado.
@@ -688,31 +798,51 @@
<session-timeout>*1*</session-timeout>
</session-config>
----
-2. Execute o projeto `AffableBean`. No browser, clique na página da categoria, adicione vários itens ao carrinho e, em seguida, clique em "ver carrinho".
+
+[start=2]
+. Execute o projeto `AffableBean`. No browser, clique na página da categoria, adicione vários itens ao carrinho e, em seguida, clique em "ver carrinho".
image::images/cart-page-session-intact.png[title="A página do carrinho depende de um objeto da sessão para exibir itens no carrinho de compras"]
-3. Aguarde pelo menos um minuto completo.
-4. Atualize a quantidade de um dos itens exibidos na página do carrinho. (Qualquer número entre 1 e 99 é aceitável.) Clique em "atualizar". O servidor retorna uma mensagem HTTP Status 500.
+
+[start=3]
+. Aguarde pelo menos um minuto completo.
+
+[start=4]
+. Atualize a quantidade de um dos itens exibidos na página do carrinho. (Qualquer número entre 1 e 99 é aceitável.) Clique em "atualizar". O servidor retorna uma mensagem HTTP Status 500.
image::images/glassfish-error-report.png[title="NullPointerException ocorre quando uma solicitação de sessão expirada é recebida"]
-5. Examine o log do GlassFish Server no IDE. Abra a janela Saída (Ctrl-4, ⌘-4 no Mac) e selecione a guia GlassFish Server. Role para a parte inferior do log para examinar o rastreamento da pilha de erro.
+
+[start=5]
+. Examine o log do GlassFish Server no IDE. Abra a janela Saída (Ctrl-4, ⌘-4 no Mac) e selecione a guia GlassFish Server. Role para a parte inferior do log para examinar o rastreamento da pilha de erro.
[.feature]
--
image::images/gf-server-output.png[role="left", link="images/gf-server-output.png"]
--
O log do servidor indica que uma `NullPointerException` ocorreu na linha 184 no `ControllerServlet`. A janela Saída forma um link para a linha em que ocorreu a exceção.
-6. Clique no link. Você pode navegar diretamente até a linha 184 no `ControllerServLet`. Passar o mouse sobre o emblema do erro na margem esquerda do editor fornece uma dica de ferramenta que descreve a exceção.
+
+[start=6]
+. Clique no link. Você pode navegar diretamente até a linha 184 no `ControllerServLet`. Passar o mouse sobre o emblema do erro na margem esquerda do editor fornece uma dica de ferramenta que descreve a exceção.
image::images/nullpointer-exception.png[title="O emblema do erro e a dica de ferramenta indicam a localização e a causa do problema"]
Como a sessão já havia expirado antes de a solicitação ter sido recebida, o mecanismo do servlet não poderá associar a solicitação à sua sessão correspondente. Portanto, ele não conseguiu localizar o objeto `cart` (linha 151). A exceção ocorreu finalmente na linha 184 quando o mecanismo tentou chamar um método em uma variável equivalente a `null`.
Agora que identificamos o problema, vamos corrigi-lo implementando um filtro.
-7. Clique no botão Novo Arquivo (image::images/new-file-btn.png[]) na barra de ferramentas do IDE. (Como alternativa, pressione Ctrl-N; ⌘-N no Mac.)
-8. Selecione a categoria *Web*e, em seguida, selecione *Filtro* e clique em Próximo.
-9. Nomeie o filtro`SessionTimeoutFilter`. Digite `filter` no campo Pacotes, para que a classe do filtro seja colocada em um novo pacote quando for criada.
-10. Clique em Próximo. Aceite as definições default e clique em Finalizar. Um modelo para o `SessionTimeoutFilter` será gerado e aberto no editor.
+
+[start=7]
+. Clique no botão Novo Arquivo (image::images/new-file-btn.png[]) na barra de ferramentas do IDE. (Como alternativa, pressione Ctrl-N; ⌘-N no Mac.)
+
+[start=8]
+. Selecione a categoria *Web*e, em seguida, selecione *Filtro* e clique em Próximo.
+
+[start=9]
+. Nomeie o filtro`SessionTimeoutFilter`. Digite `filter` no campo Pacotes, para que a classe do filtro seja colocada em um novo pacote quando for criada.
+
+[start=10]
+. Clique em Próximo. Aceite as definições default e clique em Finalizar. Um modelo para o `SessionTimeoutFilter` será gerado e aberto no editor.
*Observação:* atualmente, no NetBeans 6.9, não é possível utilizar o assistente para definir um mapeamento para um servlet que não esteja registrado no descritor de implantação da web. (O `ControllerServlet` foi registrado usando a anotação `@WebServlet`.) Portanto, modificaremos o código gerado na próxima etapa.
-11. Modifique a assinatura da anotação `@WebFilter`, de maneira que apareça da seguinte forma.
+
+[start=11]
+. Modifique a assinatura da anotação `@WebFilter`, de maneira que apareça da seguinte forma.
[source,java]
----
@@ -731,7 +861,9 @@
Utilize a opção Pesquisa Javadoc por Índice para puxar a documentação na interface `Filter`. Pressione Shift-F1 (fn-Shift-F1 no Mac) e, em seguida, digite "`Filter`" no campo de pesquisa e pressione Enter. Selecione a entrada "Interface no javax.servlet". A documentação Javadoc é exibida no painel inferior da ferramenta de pesquisa em índice.
-12. Substitua o corpo do `SessionTimeoutFilter` pelo conteúdo a seguir.
+
+[start=12]
+. Substitua o corpo do `SessionTimeoutFilter` pelo conteúdo a seguir.
[source,java]
----
@@ -765,27 +897,55 @@
}
----
-13. Pressione Ctrl-Shift-I (⌘-Shift-I no Mac) para corrigir instruções de importação. (As importações precisam ser adicionadas a `HttpServletRequest` e `HttpSession`.) Além disso, use as dicas do editor para adicionar a anotação `@Override` aos métodos `init`, `destroy` e `doFilter`.
+
+[start=13]
+. Pressione Ctrl-Shift-I (⌘-Shift-I no Mac) para corrigir instruções de importação. (As importações precisam ser adicionadas a `HttpServletRequest` e `HttpSession`.) Além disso, use as dicas do editor para adicionar a anotação `@Override` aos métodos `init`, `destroy` e `doFilter`.
Nas etapas a seguir, você executará o depurador no projeto e percorrerá o método `doFilter` para ver como ele determina se a solicitação está vinculada a uma sessão existente.
-14. Abra a janela Pontos de Interrupção (Alt-Shift-5; Ctrl-Shift-5 no Mac) e verifique se não há nenhum ponto de interrupção existente definido. Para deletar um ponto de interrupção, clique com o botão direito do mouse no ponto de interrupção e selecione Deletar. (Se tiver concluído o exercício acima, <<http-monitor,Examinando a Comunicação Cliente-Servidor com o Monitor de HTTP>>, poderá ter um ponto de verificação pendente definido no `ControllerServlet`.)
-15. Execute o depurador. Clique no botão Depurar Projeto (image::images/debug-project-btn.png[]) na barra de ferramentas principal do IDE.
-16. Quando a página de boas-vindas for exibida no browser, selecione uma categoria e, em seguida, adicione vários itens ao seu carrinho de compras.
-17. Defina um ponto de interrupção na linha no método `` doFilter` do `SessionTimeoutFilter `` que tenta acessar a sessão (linha 32).
+
+[start=14]
+. Abra a janela Pontos de Interrupção (Alt-Shift-5; Ctrl-Shift-5 no Mac) e verifique se não há nenhum ponto de interrupção existente definido. Para deletar um ponto de interrupção, clique com o botão direito do mouse no ponto de interrupção e selecione Deletar. (Se tiver concluído o exercício acima, <<http-monitor,Examinando a Comunicação Cliente-Servidor com o Monitor de HTTP>>, poderá ter um ponto de verificação pendente definido no `ControllerServlet`.)
+
+[start=15]
+. Execute o depurador. Clique no botão Depurar Projeto (image::images/debug-project-btn.png[]) na barra de ferramentas principal do IDE.
+
+[start=16]
+. Quando a página de boas-vindas for exibida no browser, selecione uma categoria e, em seguida, adicione vários itens ao seu carrinho de compras.
+
+[start=17]
+. Defina um ponto de interrupção na linha no método `` doFilter` do `SessionTimeoutFilter `` que tenta acessar a sessão (linha 32).
image::images/filter-breakpoint.png[title="Definir um ponto de interrupção no método getSession"]
-18. No browser, clique no botão "ver carrinho". Alterne para o IDE e note que o depurador foi suspenso no ponto de interrupção.
+
+[start=18]
+. No browser, clique no botão "ver carrinho". Alterne para o IDE e note que o depurador foi suspenso no ponto de interrupção.
Lembre-se de que `getSession()` cria um novo objeto de sessão, caso o atual não exista. Aqui, utilizamos o `getSession(false)`, que se abstém de criar um novo objeto, caso não seja encontrado nenhum. Em outras palavras, o método retorna `null`, se a sessão não existir.
-19. Clique no botão Fazer Step Over (image::images/step-over-btn.png[]) e, em seguida, passe o ponteiro do mouse sobre a variável `session`. Contanto que não tenha se passado um minuto desde que a solicitação anterior foi enviada, você verá que a variável foi designada a `StandardSessionFacade`. Isso representa o objeto de sessão para a solicitação.
+
+[start=19]
+. Clique no botão Fazer Step Over (image::images/step-over-btn.png[]) e, em seguida, passe o ponteiro do mouse sobre a variável `session`. Contanto que não tenha se passado um minuto desde que a solicitação anterior foi enviada, você verá que a variável foi designada a `StandardSessionFacade`. Isso representa o objeto de sessão para a solicitação.
image::images/session-exists.png[title="Passe o mouse sobre as variáveis para determinar seus valores atuais"]
-20. Continue percorrendo o método, até que a solicitação seja processada. Como `session` não é igual a `null`, ignore a instrução `if` e `chain.doFilter` e, em seguida, encaminhe a solicitação ao `ControllerServlet` (linha 44).
-21. No browser, certifique-se de que se passou um minuto completo e, em seguida, atualize a quantidade de um dos itens de produtos no carrinho. Esse é o mesmo procedimento que executamos anteriormente no exercício, quando foi retornada a mensagem status 500. Agora que o filtro intercepta as solicitações direcionadas ao `ControllerServlet`, veremos o que acontece quando ocorrer o time-out da sessão.
-22. Depois de clicar em "atualizar", alterne para o IDE e note que o depurador é suspenso novamente no ponto de interrupção definido no filtro.
-23. Realce a expressão `req.getSession(false)` e, em seguida, passe o mouse sobre ela. Aqui você verá que a expressão equivale a `null`, já que a sessão já expirou.
+
+[start=20]
+. Continue percorrendo o método, até que a solicitação seja processada. Como `session` não é igual a `null`, ignore a instrução `if` e `chain.doFilter` e, em seguida, encaminhe a solicitação ao `ControllerServlet` (linha 44).
+
+[start=21]
+. No browser, certifique-se de que se passou um minuto completo e, em seguida, atualize a quantidade de um dos itens de produtos no carrinho. Esse é o mesmo procedimento que executamos anteriormente no exercício, quando foi retornada a mensagem status 500. Agora que o filtro intercepta as solicitações direcionadas ao `ControllerServlet`, veremos o que acontece quando ocorrer o time-out da sessão.
+
+[start=22]
+. Depois de clicar em "atualizar", alterne para o IDE e note que o depurador é suspenso novamente no ponto de interrupção definido no filtro.
+
+[start=23]
+. Realce a expressão `req.getSession(false)` e, em seguida, passe o mouse sobre ela. Aqui você verá que a expressão equivale a `null`, já que a sessão já expirou.
image::images/session-null.png[title="Realce as expressões e passe o mouse sobre elas para determinar seu valor atual"]
-24. Continue percorrendo o código. Agora que a variável `session` equivale a `null`, a instrução `if` na linha 35 será processada e a solicitação será encaminhada para `/index.jsp`. Quando o depurador finalizar a execução, você verá que o browser exibirá a página de boas-vindas do site.
-25. Clique no botão Finalizar Sessão (image::images/finish-session-btn.png[]) para encerrar a sessão de depuração.
-26. Abra o arquivo `web.xml` do projeto e mude o intervalo de time-out da sessão de volta para 10 minutos.
+
+[start=24]
+. Continue percorrendo o código. Agora que a variável `session` equivale a `null`, a instrução `if` na linha 35 será processada e a solicitação será encaminhada para `/index.jsp`. Quando o depurador finalizar a execução, você verá que o browser exibirá a página de boas-vindas do site.
+
+[start=25]
+. Clique no botão Finalizar Sessão (image::images/finish-session-btn.png[]) para encerrar a sessão de depuração.
+
+[start=26]
+. Abra o arquivo `web.xml` do projeto e mude o intervalo de time-out da sessão de volta para 10 minutos.
[source,xml]
----
@@ -794,7 +954,9 @@
<session-timeout>*10*</session-timeout>
</session-config>
----
-27. Salve o arquivo (Ctrl-S; ⌘-S no Mac).
+
+[start=27]
+. Salve o arquivo (Ctrl-S; ⌘-S no Mac).
O link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot6.zip[+Snapshot 6+] fornece a versão completa do projeto para esta unidade do tutorial. Um tópico final com relação ao gerenciamento de sessão deve ser mencionado. É possível encerrar explicitamente uma sessão chamando o método `invalidate` no objeto de sessão. Caso a sessão não seja mais necessária, ela deve ser removida para conservar a memória disponível para o servidor. Depois de concluir a próxima unidade, link:transaction.html[+Integrando Lógica de Negócio Transacional+], você verá como o `ControllerServlet`, ao processar com sucesso um pedido do cliente, destrói o objeto `cart` do usuário e encerra a sessão usando o método `invalidate`.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ru.asciidoc
index 46d7743..ae3e060 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_ru.asciidoc
@@ -256,14 +256,18 @@
* `WEB-INF/view/category.jsp`
* `WEB-INF/view/checkout.jsp`
* `controller/ControllerServlet`
-2. Запустите проект ( image::images/run-project-btn.png[] ), чтобы убедиться, что этот проект правильно настроен с помощью используемой базы данных и сервера приложений.
+
+[start=2]
+. Запустите проект ( image::images/run-project-btn.png[] ), чтобы убедиться, что этот проект правильно настроен с помощью используемой базы данных и сервера приложений.
Если при выполнении проекта выводится сообщение об ошибке, еще раз обратитесь к link:setup.html[+указаниям по настройке+], в которых описаны принципы подготовки базы данных и установки соединения между средой IDE, сервером GlassFish и MySQL.
-3. Протестируйте функциональные возможности приложения в браузере. Если link:entity-session.html[+предыдущий раздел учебного курса+] уже изучен, обратите внимание на следующие расширения.
+
+[start=3]
+. Протестируйте функциональные возможности приложения в браузере. Если link:entity-session.html[+предыдущий раздел учебного курса+] уже изучен, обратите внимание на следующие расширения.
-==== страница категории
+=== страница категории
* Первое нажатие кнопки "add to cart" активирует корзину покупок и виджеты "proceed to checkout", отображаемые в заголовке.
* Нажатие кнопки "add to cart" приводит к обновлению числа товаров в виджете корзины покупок в заголовке.
@@ -273,7 +277,7 @@
[[cartPage]]
-==== страница корзины покупок
+=== страница корзины покупок
* Щелчок ссылки "clear cart" обеспечивает удаление всех товаров из корзины покупок.
* В результате щелчка ссылки "continue shopping" выполняется возврат к ранее просматриваемой категории.
@@ -283,23 +287,31 @@
image::images/cart-page.png[title="IDE NetBeans включает функции отладки."]
-==== страница проверки
+=== страница проверки
* В результате щелчка ссылки "view cart" отображается страница корзины.
* В результате нажатия "подтвердить покупку" на странице подтверждения отображаются результаты покупки (без указания информации о пользователе).
image::images/checkout-page.png[title="Страница кассы включает функцию покупательской корзины"]
-4. Используйте диалоговое окно "Перейти к файлу", чтобы открыть файл `ControllerServlet` в редакторе. Нажмите ALT+SHIFT+O (CTRL+SHIFT+O в Mac OS), затем введите "`Controller`" в поле диалога и нажмите кнопку "ОК".
+
+[start=4]
+. Используйте диалоговое окно "Перейти к файлу", чтобы открыть файл `ControllerServlet` в редакторе. Нажмите ALT+SHIFT+O (CTRL+SHIFT+O в Mac OS), затем введите "`Controller`" в поле диалога и нажмите кнопку "ОК".
image::images/go-to-file-dialog.png[title="С помощью диалогового окна "Переход к файлу" быстро откройте ресурсы проекта в редакторе"]
-5. Установите точку останова в методе `doPost` на строке, которая создает объект `HttpSession` (строка 150). Для установки точки останова щелкните в левом поле редактора.
+
+[start=5]
+. Установите точку останова в методе `doPost` на строке, которая создает объект `HttpSession` (строка 150). Для установки точки останова щелкните в левом поле редактора.
image::images/breakpoint.png[title="Щелкните левую границу редактора для задания точек останова"]
Для переключения номеров строк в редакторе щелкните правой кнопкой мыши в левом поле и выберите команду "Показать номера строк".
-6. Запустите отладчик. Нажмите кнопку 'Отладка проекта' (image::images/debug-project-btn.png[]) на главной панели инструментов IDE. Сервер GlassFish запускается (или перезапускается, если уже работал ) и открывает подключение через сокет по его отладочному номеру порта. В браузере откроется страница приветствия приложения.
+
+[start=6]
+. Запустите отладчик. Нажмите кнопку 'Отладка проекта' (image::images/debug-project-btn.png[]) на главной панели инструментов IDE. Сервер GlassFish запускается (или перезапускается, если уже работал ) и открывает подключение через сокет по его отладочному номеру порта. В браузере откроется страница приветствия приложения.
Можно просматривать и изменять номер порта отладки в диалоговом окне "Серверы" ("Сервис" > "Серверы"). Выберите вкладку "Java" для используемого сервера. Укажите номер порта в поле "Используемый адрес" под заголовком "Параметры отладки".
-7. При выводе страницы приветствия в браузере выберите категорию и добавьте несколько элементов в корзину покупок. Следует помнить, что нажатие кнопки "add to cart" отправляет запрос `addToCart` на сервер:
+
+[start=7]
+. При выводе страницы приветствия в браузере выберите категорию и добавьте несколько элементов в корзину покупок. Следует помнить, что нажатие кнопки "add to cart" отправляет запрос `addToCart` на сервер:
[source,java]
----
@@ -307,9 +319,13 @@
<form action="addToCart" method="post">
----
Как уже было описано в разделе link:page-views-controller.html#controller[+Подготовка представлений страницы и сервлета контроллера+], принадлежащий `ControllerServlet` метод `doPost` поддерживает запросы URL-адреса шаблона `/addToCart`. Следовательно, при нажатии кнопки "add to cart" ожидается вызов метода `doPost`.
-8. Нажмите кнопку "add to cart" для любого элемента на странице категорий. Перейдите к среде IDE и обратите внимание, что отладчик приостановил работу в точке останова.
+
+[start=8]
+. Нажмите кнопку "add to cart" для любого элемента на странице категорий. Перейдите к среде IDE и обратите внимание, что отладчик приостановил работу в точке останова.
image::images/breakpoint-suspended.png[title="Отладчик приостанавливает работу по достижении точек останова, заданных в редакторе"]
-9. Поместите курсор в месте вызова метода `getSession()` и нажмите сочетание клавиш CTRL+ПРОБЕЛ для вывода документации Javadoc.
+
+[start=9]
+. Поместите курсор в месте вызова метода `getSession()` и нажмите сочетание клавиш CTRL+ПРОБЕЛ для вывода документации Javadoc.
image::images/javadoc-getsession.png[title="Нажмите Ctrl-Space для вызова документации Javadoc"]
В соответствии с документацией метод `getSession()` возвращает объект `HttpSession`, связанный в настоящее время с запросом, и (при отсутствии сеанса) создает новый объект сеанса.
@@ -353,10 +369,16 @@
* link:http://java.sun.com/j2se/javadoc/[+Официальная домашняя страницы средства Javadoc+]
* link:http://java.sun.com/j2se/javadoc/writingdoccomments/index.html[+Принцип записи комментариев документации для средства Javadoc+]
-10. Наведите курсор на переменную `session`. Обратите внимание, что отладчик приостанавливает работу на строке, _которая должна быть запущена в нем._ Значение, возвращаемое `getSession()` еще не сохранено в переменной `session` и отображается всплываюшщее окно, в котором указывается, что "`session` не является известной переменной в текущем контексте".
+
+[start=10]
+. Наведите курсор на переменную `session`. Обратите внимание, что отладчик приостанавливает работу на строке, _которая должна быть запущена в нем._ Значение, возвращаемое `getSession()` еще не сохранено в переменной `session` и отображается всплываюшщее окно, в котором указывается, что "`session` не является известной переменной в текущем контексте".
image::images/session-variable.png[title="Наведите курсор на переменные и выражения для определения их текущих значений"]
-11. Нажмите кнопку 'Обход процедур' (image::images/step-over-btn.png[]) в отладчике на панели инструментов, расположенной выше в редакторе. Строка обрабатывается, и отладчик переходит к следующей строке файла.
-12. Снова наведите курсор на переменную `session`. Можно увидеть, что текущее значение сохранено в переменной `session`.
+
+[start=11]
+. Нажмите кнопку 'Обход процедур' (image::images/step-over-btn.png[]) в отладчике на панели инструментов, расположенной выше в редакторе. Строка обрабатывается, и отладчик переходит к следующей строке файла.
+
+[start=12]
+. Снова наведите курсор на переменную `session`. Можно увидеть, что текущее значение сохранено в переменной `session`.
[.feature]
--
image::images/session-variable-set.png[role="left", link="images/session-variable-set.png"]
@@ -364,18 +386,30 @@
В NetBeans 6.9 можно щелкнуть серый указатель ( image::images/grey-pointer.png[] ) во всплывающем окне, чтобы расширить список значений переменных, содержащихся в выделенном элементе.
-13. Нажмите кнопку 'Обход процедур' ( image::images/step-over-btn.png[] ) (F8; fn-F8 в Mac) для перехода к оператору `if` (строка 154). Поскольку в браузере только что была нажата кнопка "add to cart", выражение `userPath.equals("/addToCart")` должно иметь значение `true`.
-14. Выделите выражение `userPath.equals("/addToCart")` (нажав клавишу CTRL и щелкнув клавишей мыши). При этом будет выведено всплывающее окно со значением выделенного выражения.
+
+[start=13]
+. Нажмите кнопку 'Обход процедур' ( image::images/step-over-btn.png[] ) (F8; fn-F8 в Mac) для перехода к оператору `if` (строка 154). Поскольку в браузере только что была нажата кнопка "add to cart", выражение `userPath.equals("/addToCart")` должно иметь значение `true`.
+
+[start=14]
+. Выделите выражение `userPath.equals("/addToCart")` (нажав клавишу CTRL и щелкнув клавишей мыши). При этом будет выведено всплывающее окно со значением выделенного выражения.
image::images/expression.png[title="Выделите выражения для определения их текущих значений"]
-15. Нажмите клавишу F8 (fn-F8 в Mac OS) для перехода к следующей строке (строка 158). Приложение спроектировано таким образом, что объект `ShoppingCart` создается для пользовательского сеанса только при первом добавлении элемента в корзину пользователя. Поскольку запрос `addToCart` в этом сеансе отладки получен впервые, предполагается, что объект `cart` имеет значение `null`.
+
+[start=15]
+. Нажмите клавишу F8 (fn-F8 в Mac OS) для перехода к следующей строке (строка 158). Приложение спроектировано таким образом, что объект `ShoppingCart` создается для пользовательского сеанса только при первом добавлении элемента в корзину пользователя. Поскольку запрос `addToCart` в этом сеансе отладки получен впервые, предполагается, что объект `cart` имеет значение `null`.
image::images/cart-null.png[title="Объект покупательской корзины появляется только после добавления пользователем элемента к покупательской корзине"]
-16. Нажмите клавишу F8 (fn-F8 в Mac OS) для перехода к следующей линии (линия 160). Затем в строке 160, где создан объект `ShoppingCart`, нажмите кнопку 'Вход в' ( image::images/step-into-btn.png[] ). Отладчик переходит к вызываемому методу. В этом случае выполняется переход непосредственно к конструктору файла `ShoppingCart`.
+
+[start=16]
+. Нажмите клавишу F8 (fn-F8 в Mac OS) для перехода к следующей линии (линия 160). Затем в строке 160, где создан объект `ShoppingCart`, нажмите кнопку 'Вход в' ( image::images/step-into-btn.png[] ). Отладчик переходит к вызываемому методу. В этом случае выполняется переход непосредственно к конструктору файла `ShoppingCart`.
image::images/cart-constructor.png[title="Перейдите к методам для отслеживания этапа выполнения для других классов"]
-17. Нажмите сочетание клавиш CTRL+TAB для перехода к файлу `ControllerServlet`. Обратите внимание, что IDE предоставляет значок 'Стек вызовов' ( image::images/call-stack-badge.png[] ) в строке 160, указывая, что отладчик в настоящее время приостановлен где-то на методе выше в стеке вызовов.
+
+[start=17]
+. Нажмите сочетание клавиш CTRL+TAB для перехода к файлу `ControllerServlet`. Обратите внимание, что IDE предоставляет значок 'Стек вызовов' ( image::images/call-stack-badge.png[] ) в строке 160, указывая, что отладчик в настоящее время приостановлен где-то на методе выше в стеке вызовов.
Нажмите ALT+SHIFT+3 (CTRL+SHIFT+3 в Mac OS), чтобы открыть окно стека вызовов.
-18. Нажмите клавишу F8 (fn+F8 в системе Mac) для продолжения перехода по коду. При завершении обработки отладчиком конструктора `ShoppingCart` выполняется возврат к файлу `ControllerServlet`.
+
+[start=18]
+. Нажмите клавишу F8 (fn+F8 в системе Mac) для продолжения перехода по коду. При завершении обработки отладчиком конструктора `ShoppingCart` выполняется возврат к файлу `ControllerServlet`.
Строка 161 `ControllerServlet` привязывает вновь созданный объект `cart` к сеансу.
@@ -391,7 +425,9 @@
--
При последовательной развертке узлов "session" > "session" > "attributes" можно просмотреть объекты, привязанные к сеансу. На изображении выше отображены два элемента, привязанные в настоящее время к сеансу (выделены на снимке). Это `selectedCategory` и `categoryProducts`, показанные в `ControllerServlet` на строках 83 и 89, соответственно. Оба элемента были привязаны ранее при щелчке изображения категории и обработке запроса страниц категории в файле `ControllerServlet`.
-19. Нажмите клавишу F8 (fn-F8 в Mac OS) для выполнения кода со строки 161. Объект `cart` привязывается к сеансу, и диалоговое окно "Переменные" обновляется для отображения изменений. Обратите внимание, что в окне "Переменные" сеанс содержит в настоящий момент три атрибута, третьим атрибутом является только что инициализированный объект `ShoppingCart` (выделен на снимке ниже).
+
+[start=19]
+. Нажмите клавишу F8 (fn-F8 в Mac OS) для выполнения кода со строки 161. Объект `cart` привязывается к сеансу, и диалоговое окно "Переменные" обновляется для отображения изменений. Обратите внимание, что в окне "Переменные" сеанс содержит в настоящий момент три атрибута, третьим атрибутом является только что инициализированный объект `ShoppingCart` (выделен на снимке ниже).
[.feature]
--
image::images/variables-win-session-cart.png[role="left", link="images/variables-win-session-cart.png"]
@@ -405,8 +441,12 @@
* Объект `Product` создается с помощью идентификатора (строка 169).
* Новый экземпляр `ShoppingCartItem` создается с помощью `product` (строка 170).
* Экземпляр `ShoppingCartItem` добавляется в состоящий из `ShoppingCartItem` список `экземпляров` (строка 170).
-20. Нажмите клавишу F8 (fn+F8 в системе Mac OS), чтобы продолжить выполнение перехода по коду с учетом перечисленных выше четырех действий. Сделайте паузу, когда отладчик временно остановится на строке 170.
-21. Создайте наблюдение за сеансом. Эта функция позволит просматривать значения, содержащиеся в сеансе, при переходе к методу `addItem` в следующем шаге. Щелкните правой кнопкой мыши сеанс в диалоговом окне "Переменные" и выберите команду "Установить постоянное наблюдение".
+
+[start=20]
+. Нажмите клавишу F8 (fn+F8 в системе Mac OS), чтобы продолжить выполнение перехода по коду с учетом перечисленных выше четырех действий. Сделайте паузу, когда отладчик временно остановится на строке 170.
+
+[start=21]
+. Создайте наблюдение за сеансом. Эта функция позволит просматривать значения, содержащиеся в сеансе, при переходе к методу `addItem` в следующем шаге. Щелкните правой кнопкой мыши сеанс в диалоговом окне "Переменные" и выберите команду "Установить постоянное наблюдение".
image::images/create-watch.png[title="Создайте наблюдения за переменными при переходе по коду в сеансе отладки"]
Кроме того, вы можете поместить курсор на переменной `session` в редакторе, а затем щелкнуть правой кнопкой мыши и выбрать 'Новое наблюдение'. Диалоговое окно создания наблюдения позволяет определить переменные или выражения для постоянного наблюдения за отладкой приложения. (При использовании выражений, сначала выделите выражение, а затем щелкните правой кнопкой мыши и выберите 'Новое наблюдение').
@@ -415,23 +455,37 @@
Для переменной `session` и всех содержащихся в ней переменных создается наблюдение. Наблюдение отображается в окне 'Наблюдения' (Window > 'Отладка' > 'Наблюдения') или при переключении кнопки наблюдений ( image::images/watch-btn.png[] ) на левой границе окна 'Переменные' оно отображается в верхней строке окна 'Переменные'.
Отладчик позволяет наблюдать за переменными по мере перехода по коду. Это важно, например, при отслеживании изменения для отдельных значений переменных (без просмотра полного списка в окне "Переменные" для каждого шага) или при временном переходе к классу, не содержащему рассматриваемые переменные.
-22. Нажмите кнопок 'Вход в' ( image::images/step-into-btn.png[] ) для перехода к `ShoppingCart` к методу `addItem`.
-23. Последовательно шагайте по методу `addItem`, пока не достигните строки 53. Согласно документации Javadoc `addItem` _"добавляет элемент`ShoppingCartItem` в список `items` в файле `ShoppingCart`. Если указанный товар из списка `product` уже существует в списке корзины покупок, количество этого товара увеличивается."_
-24. Изучите переменную `session`, для которой был создан параметр наблюдения (<<step21,шаг 21>> выше). Выражение `items.add(scItem)` на странице 51 добавляет новый экземпляр `ShoppingCartItem` в список `items` в `ShoppingCart`. Этот процесс можно проследить при переходе к третьему атрибуту, содержащемуся в сеансе (например, переменной `cart`).
+
+[start=22]
+. Нажмите кнопок 'Вход в' ( image::images/step-into-btn.png[] ) для перехода к `ShoppingCart` к методу `addItem`.
+
+[start=23]
+. Последовательно шагайте по методу `addItem`, пока не достигните строки 53. Согласно документации Javadoc `addItem` _"добавляет элемент`ShoppingCartItem` в список `items` в файле `ShoppingCart`. Если указанный товар из списка `product` уже существует в списке корзины покупок, количество этого товара увеличивается."_
+
+[start=24]
+. Изучите переменную `session`, для которой был создан параметр наблюдения (<<step21,шаг 21>> выше). Выражение `items.add(scItem)` на странице 51 добавляет новый экземпляр `ShoppingCartItem` в список `items` в `ShoppingCart`. Этот процесс можно проследить при переходе к третьему атрибуту, содержащемуся в сеансе (например, переменной `cart`).
[.feature]
--
image::images/variables-window-add-item.png[role="left", link="images/variables-window-add-item.png"]
--
На данном этапе можно изучить принцип создания `HttpSession` для запроса, создания объекта `ShoppingCart` и его прикрепления к сеансу, а также создания элемента `ShoppingCartItem` на основе пользовательского выбора продукта с последующим добавлением в список `items` файла `ShoppingCart`. Последним действием является переадресация запроса в представление `category.jsp`.
-25. Откройте в редакторе фрагмент JSP заголовка (`header.jspf`) и разместите точку останова в строке 86. Эта строка содержит оператор на языке выражений в пределах виджета корзины покупок, отображающего число элементов корзины.
+
+[start=25]
+. Откройте в редакторе фрагмент JSP заголовка (`header.jspf`) и разместите точку останова в строке 86. Эта строка содержит оператор на языке выражений в пределах виджета корзины покупок, отображающего число элементов корзины.
image::images/breakpoint-jsp.png[title="Отладчик можно приостановить на страницах JSP"]
-26. Нажмите кнопку 'Продолжить' ( image::images/continue-btn.png[] ) на панели инструментов отладчика. Отладчик продолжает работу до завершения обработки или до следующей точки останова. В последнем случае отладчик приостанавливается на строке 86 фрагмента JSP заголовка.
+
+[start=26]
+. Нажмите кнопку 'Продолжить' ( image::images/continue-btn.png[] ) на панели инструментов отладчика. Отладчик продолжает работу до завершения обработки или до следующей точки останова. В последнем случае отладчик приостанавливается на строке 86 фрагмента JSP заголовка.
*Примечание.* Чтобы отложить работу отладчика на странице JSP требуется контрольная точка. Например, если в файле `ControllerServlet` выполняется переадресация запроса в соответствующее представление, отладчик не будет автоматически приостановлен на странице JSP.
-27. Откройте окно переменных (ALT+SHIFT+1; CTRL+SHIFT+1 в системе Mac OS), если оно еще не открыто. В отличие от классов Java отладчик _не_ предоставляет подсказки при наведении курсора мыши на переменные или выражения на странице JSP. Однако диалоговое окно "Переменные" не позволяет определять значения переменных при переходе по коду. Где можно найти значение для переменной `${cart.numberOfItems}`?
-28. Последовательно разверните в диалоговом окне "Переменные" узлы "Скрытые объекты" > "pageContext" > "session" > "session" > "attributes". В результате будет предоставлен доступ к объекту сеанса, как и при работе с файлом `ControllerServlet`. Обратите внимание, что сеанс, для которого на шаге 21 было создано наблюдение, указывает на сам объект. Здесь можно убедиться, что значение переменной `${cart.numberOfItems}` составляет "`1`".
+
+[start=27]
+. Откройте окно переменных (ALT+SHIFT+1; CTRL+SHIFT+1 в системе Mac OS), если оно еще не открыто. В отличие от классов Java отладчик _не_ предоставляет подсказки при наведении курсора мыши на переменные или выражения на странице JSP. Однако диалоговое окно "Переменные" не позволяет определять значения переменных при переходе по коду. Где можно найти значение для переменной `${cart.numberOfItems}`?
+
+[start=28]
+. Последовательно разверните в диалоговом окне "Переменные" узлы "Скрытые объекты" > "pageContext" > "session" > "session" > "attributes". В результате будет предоставлен доступ к объекту сеанса, как и при работе с файлом `ControllerServlet`. Обратите внимание, что сеанс, для которого на шаге 21 было создано наблюдение, указывает на сам объект. Здесь можно убедиться, что значение переменной `${cart.numberOfItems}` составляет "`1`".
[.feature]
--
image::images/variables-window-number-of-items.png[role="left", link="images/variables-window-number-of-items.png"]
@@ -440,7 +494,9 @@
Разверните окно 'Переменные' или любое окно в IDE, щелкнув правой кнопкой мыши заголовок окна, а затем выбрав 'Развернуть окно' (Shift-Esc).
Отладчик предоставляет доступ к скрытому объекту `pageContext`. `pageContext` предоставляет контекст страницы JSP и открывает прямой доступ к различным объектам, включая объекты `HttpServletRequest`, `HttpSession` и `ServletContext`. Для получения дополнительных сведений обратитесь к link:http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaij[+Учебному курсу по Java EE 5: скрытые объекты+].
-29. Нажмите кнопку 'Завершить сеанс' ( image::images/finish-session-btn.png[] ). Работа среды выполнения и сеанса отладки завершается. Браузер отображает страницу категорий с полной визуализацией, и виджет корзины покупок в заголовке страницы содержит один элемент.
+
+[start=29]
+. Нажмите кнопку 'Завершить сеанс' ( image::images/finish-session-btn.png[] ). Работа среды выполнения и сеанса отладки завершается. Браузер отображает страницу категорий с полной визуализацией, и виджет корзины покупок в заголовке страницы содержит один элемент.
Надеемся, что теперь использование отладчика среды IDE не только для анализа проекта при неожиданном поведении, но и в качестве средства изучения кода, не вызывает у вас затруднений. Ниже перечислены другие функциональные кнопки на панели инструментов:
@@ -487,14 +543,24 @@
1. Начните работу с активации монитора HTTP для используемого сервера. Выберите элементы "Сервис" > "Серверы". В левом столбце окна "Серверы" выберите используемый сервер (GlassFish). Затем выберите на главной панели режим "Включить монитор HTTP".
image::images/servers-win-http-monitor.png[title="Выберите режим 'Включить монитор HTTP', чтобы активировать монитор HTTP"]
-2. Если сервер уже запущен, необходимо перезапустить его. Однако поскольку планируется использование отладчика, а при запуске отладчика выполняется перезапуск сервера для взаимодействия с другим портом, просто нажмите кнопку 'Отладка проекта' ( image::images/debug-project-btn.png[] ) на главной панели инструментов IDE. Будет выполнена перезагрузка сервера, запустится сеанс отладки, и в браузере откроется страница приветствия приложения. В нижней области среды IDE будет отображен монитор HTTP.
+
+[start=2]
+. Если сервер уже запущен, необходимо перезапустить его. Однако поскольку планируется использование отладчика, а при запуске отладчика выполняется перезапуск сервера для взаимодействия с другим портом, просто нажмите кнопку 'Отладка проекта' ( image::images/debug-project-btn.png[] ) на главной панели инструментов IDE. Будет выполнена перезагрузка сервера, запустится сеанс отладки, и в браузере откроется страница приветствия приложения. В нижней области среды IDE будет отображен монитор HTTP.
image::images/http-monitor.png[title="Монитор HTTP отображается по умолчанию в нижней области среды IDE"]
-3. Щелкните запись AffableBean в левом столбце (как показано на снимке выше). При выборе записей в левом столбце правый (т.е. главный) столбец обновляется для отображения соответствующих данных. На изображении выше вкладка "Запрос" отображает идентификатор URI запроса (`/AffableBean/`), метод HTTP (`GET`) и указывает на отсутствие отправки строки запроса вместе с запросом.
-4. Выберите вкладку "Сеанс". Обратите внимание на утверждение: "Сеанс создан в результате этого запроса." Это вызвано отправкой сервером заголовка `Set-Cookie` для файла cookie `JSESSIONID` в качестве ответа. Также обратите внимание, что новый идентификатор сеанса указан в области "Свойства сеанса". Как будет продемонстрировано ниже, идентификатор сеанса представляет собой значение файла cookie `JSESSIONID`.
+
+[start=3]
+. Щелкните запись AffableBean в левом столбце (как показано на снимке выше). При выборе записей в левом столбце правый (т.е. главный) столбец обновляется для отображения соответствующих данных. На изображении выше вкладка "Запрос" отображает идентификатор URI запроса (`/AffableBean/`), метод HTTP (`GET`) и указывает на отсутствие отправки строки запроса вместе с запросом.
+
+[start=4]
+. Выберите вкладку "Сеанс". Обратите внимание на утверждение: "Сеанс создан в результате этого запроса." Это вызвано отправкой сервером заголовка `Set-Cookie` для файла cookie `JSESSIONID` в качестве ответа. Также обратите внимание, что новый идентификатор сеанса указан в области "Свойства сеанса". Как будет продемонстрировано ниже, идентификатор сеанса представляет собой значение файла cookie `JSESSIONID`.
image::images/session-tab.png[title="Сведения о сеансе отображаются на вкладке 'Сеанс' в мониторе HTTP"]
Может возникнуть вопрос о способе создания объекта сеанса из запроса для страницы приветствия сайта. Ведь в файле `ControllerServlet` не выполняется обработка начального запроса для `/AffableBean/`, и этот запрос нигде не сталкивается с методом `getSession()`. Или сталкивается? Напомним, что страницы JSP скомпилированы в сервлеты при развертывании. При первом развертывании проекта на сервере можно фактически использовать среду IDE для просмотра скомпилированного сервлета JSP на собственном сервере.
-5. В окне 'Проекты' щелкните правой кнопкой мыши файл `index.jsp` и выберите 'Просмотреть сервлет'. В редакторе откроется файл `index_jsp.java`. Файл является сервлетом, автоматически скомпилированным на основе страницы `index.jsp`.
-6. Выполните в файле поиск метода `getSession`. Нажмите Ctrl-F (⌘-F в Mac), введите '`getSession`' на панели поиска, затем нажмите кклавишу Enter.
+
+[start=5]
+. В окне 'Проекты' щелкните правой кнопкой мыши файл `index.jsp` и выберите 'Просмотреть сервлет'. В редакторе откроется файл `index_jsp.java`. Файл является сервлетом, автоматически скомпилированным на основе страницы `index.jsp`.
+
+[start=6]
+. Выполните в файле поиск метода `getSession`. Нажмите Ctrl-F (⌘-F в Mac), введите '`getSession`' на панели поиска, затем нажмите кклавишу Enter.
Ctrl-F (⌘-F в Mac) - это сочетание клавиш для 'Правка' > 'Найти'.
@@ -510,12 +576,20 @@
Для выяснения местоположения скомпилированного сервлета на сервере можно навести курсор мыши на вкладку с именем сервлета над редактором. Будет выведено всплывающее окно с путем к файлу на компьютере.
-7. Выберите категорию в браузере и добавьте товар в корзину. Перейдите в среду IDE. Заметим, что отладчик приостанавливает работу на точке останова в `ControllerServlet`, поставленную ранее (на строке 150). Все точки останова между сеансами запоминаются. Для удаления точки останова можно щелкнуть метку точки останова ( image::images/breakpoint-badge.png[] ) на левой границе редактора. Тем не менее, поскольку в проект уже добавлено несколько точек останова, откройте окно отладчика "Точки останова" ("Окно" > "Отладка" > "Точки останова").
+
+[start=7]
+. Выберите категорию в браузере и добавьте товар в корзину. Перейдите в среду IDE. Заметим, что отладчик приостанавливает работу на точке останова в `ControllerServlet`, поставленную ранее (на строке 150). Все точки останова между сеансами запоминаются. Для удаления точки останова можно щелкнуть метку точки останова ( image::images/breakpoint-badge.png[] ) на левой границе редактора. Тем не менее, поскольку в проект уже добавлено несколько точек останова, откройте окно отладчика "Точки останова" ("Окно" > "Отладка" > "Точки останова").
image::images/breakpoints-window.png[title="Просмотрите все точки останова в проекте в окне 'Точка останова'"]
В окне "Точки останова" можно просматривать и вызывать действия для всех точек останова, установленных в проектах, которые открыты в среде IDE.
-8. Щелкните правой кнопкой мыши точку останова, установленную в файле `header.jspf`, и выберите команду "Удалить". Then щелкните правой кнопкой мыши the breakpoint set in the `ControllerServlet` and choose Disable. (Позднее в этом упражнении будет выполнено ее повторное включение).
-9. Нажмите кнопку 'Продолжить' ( image::images/continue-btn.png[] ). Обработка запроса завершается, и на странице категорий браузера выводится добавленный в корзину товар.
-10. В мониторе HTTP выполните поиск запроса `addToCart` в левом столбце, затем выберите его для отображения подробных данных в главном столбце.
+
+[start=8]
+. Щелкните правой кнопкой мыши точку останова, установленную в файле `header.jspf`, и выберите команду "Удалить". Then щелкните правой кнопкой мыши the breakpoint set in the `ControllerServlet` and choose Disable. (Позднее в этом упражнении будет выполнено ее повторное включение).
+
+[start=9]
+. Нажмите кнопку 'Продолжить' ( image::images/continue-btn.png[] ). Обработка запроса завершается, и на странице категорий браузера выводится добавленный в корзину товар.
+
+[start=10]
+. В мониторе HTTP выполните поиск запроса `addToCart` в левом столбце, затем выберите его для отображения подробных данных в главном столбце.
Нажмите кнопку 'Сортировка по возрастанию' ( image::images/ascending-sort-btn.png[] ), чтобы последние записи были указаны в верхней части.
@@ -525,23 +599,39 @@
--
image::images/http-monitor-add-to-cart.png[role="left", link="images/http-monitor-add-to-cart.png"]
--
-11. Выберите вкладку "Файлы cookie". Здесь отображаются данные о существовании файла cookie с именем `JSESSIONID` и его отправке от клиента на сервер. Обратите внимание, что значение файла cookie совпадает с идентификатором сеанса, отображаемом на вкладке "Сеанс".
+
+[start=11]
+. Выберите вкладку "Файлы cookie". Здесь отображаются данные о существовании файла cookie с именем `JSESSIONID` и его отправке от клиента на сервер. Обратите внимание, что значение файла cookie совпадает с идентификатором сеанса, отображаемом на вкладке "Сеанс".
image::images/cookies-tab.png[title="Файлы cookies отображаются на вкладке 'Файлы Cookies' в мониторе HTTP"]
Схожие данные представлены на вкладке "Заголовок", на которой отображается файл cookie, поскольку `Cookie` является заголовком запроса, отправленного клиентом.
image::images/headers-tab.png[title="Файлы cookies отображаются на вкладке 'Файлы Cookies' в мониторе HTTP"]
Для получения дополнительных сведений о заголовках запроса и ответа обратитесь к странице веб-энциклопедии Wikipedia link:http://en.wikipedia.org/wiki/List_of_HTTP_headers[+Список заголовков HTTP+].
-12. Выберите вкладку "Сеанс". На вкладке отображается сообщение "Сеанс предшествует запросу". Также обратите внимание, что атрибут `cart` отображается в списке "Атрибуты сеанса после запроса". И это объяснимо, ведь объект `cart` привязывается к сеансу при первой обработке запроса `addToCart`.
+
+[start=12]
+. Выберите вкладку "Сеанс". На вкладке отображается сообщение "Сеанс предшествует запросу". Также обратите внимание, что атрибут `cart` отображается в списке "Атрибуты сеанса после запроса". И это объяснимо, ведь объект `cart` привязывается к сеансу при первой обработке запроса `addToCart`.
image::images/session-tab-add-to-cart.png[title="Атрибуты сеанса отображаются на вкладке 'Сеанс' в мониторе HTTP"]
В следующих нескольких шагах рассматривается поиск идентификатора сеанса и файла cookie `JSESSIONID` в диалоговом окне "Переменные".
-13. Снова активируйте точку останова, ранее установленную в файле `ControllerServlet`. Нажмите ALT+SHIFT+5 (CTRL+SHIFT+5 в Mac OS), чтобы открыть окно точек останова, затем установите флажок напротив точки останова, чтобы включить ее заново.
-14. Нажмите в браузере кнопку "add to cart" для одного из перечисленных продуктов.
-15. Перейдите в среду IDE и обратите внимание, что отладчик приостановился на точке останова, установленной в файле `ControllerServlet`. Нажмите кнопку 'Обход процедур' ( image::images/step-over-btn.png[] ) для назначения переменной `session` объекту сеанса.
-16. Откройте окно "Переменные" (ALT+SHIFT+1; CTRL+SHIFT+1 в Mac OS), чтобы развернуть session > session. Идентификатор сессии будет указан в качестве значения переменной `id`.
-17. При поиске файла cookie `JSESSIONID` следует помнить, что обычно файл cookie доступен из сервлета при вызове метода link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] в объекте `HttpServletRequest`. Поэтому перейдите к объекту запроса по пути: "request" > "Inherited" > "request" > "request" > "Inherited" > "cookies". Здесь можно просмотреть список `файлов cookie` ArrayList. При развертке списка можно найти файл cookie `JSESSIONID`, значением которого является идентификатор сеанса.
-18. Нажмите кнопку 'Завершить сеанс' ( image::images/finish-session-btn.png[] ), чтобы завершить сеанс отладки.
+
+[start=13]
+. Снова активируйте точку останова, ранее установленную в файле `ControllerServlet`. Нажмите ALT+SHIFT+5 (CTRL+SHIFT+5 в Mac OS), чтобы открыть окно точек останова, затем установите флажок напротив точки останова, чтобы включить ее заново.
+
+[start=14]
+. Нажмите в браузере кнопку "add to cart" для одного из перечисленных продуктов.
+
+[start=15]
+. Перейдите в среду IDE и обратите внимание, что отладчик приостановился на точке останова, установленной в файле `ControllerServlet`. Нажмите кнопку 'Обход процедур' ( image::images/step-over-btn.png[] ) для назначения переменной `session` объекту сеанса.
+
+[start=16]
+. Откройте окно "Переменные" (ALT+SHIFT+1; CTRL+SHIFT+1 в Mac OS), чтобы развернуть session > session. Идентификатор сессии будет указан в качестве значения переменной `id`.
+
+[start=17]
+. При поиске файла cookie `JSESSIONID` следует помнить, что обычно файл cookie доступен из сервлета при вызове метода link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] в объекте `HttpServletRequest`. Поэтому перейдите к объекту запроса по пути: "request" > "Inherited" > "request" > "request" > "Inherited" > "cookies". Здесь можно просмотреть список `файлов cookie` ArrayList. При развертке списка можно найти файл cookie `JSESSIONID`, значением которого является идентификатор сеанса.
+
+[start=18]
+. Нажмите кнопку 'Завершить сеанс' ( image::images/finish-session-btn.png[] ), чтобы завершить сеанс отладки.
[[url-rewrite]]
@@ -564,34 +654,50 @@
1. Временно отключите файлы cookie в браузере. При использовании Firefox можно выбрать пункт "Настройки" в меню "Инструменты" ("Firefox" > "Параметры" в системе Mac). Выберите в открывшемся диалоговом окне вкладку "Приватность", затем выберите в области "История" пункт "будет использовать ваши настройки хранения истории" в предоставленном раскрывающемся списке. Снимите флажок параметра "Принимать cookie с сайтов".
image::images/firefox.png[title="Временно отключите файлы cookie в браузере"]
-2. Запустите проект `AffableBean`. При отображении страницы приветствия щелкните категорию и попытайтесь добавить элемент в корзину. Обратите внимание, что функциональные возможности приложения строго ограничены.
+
+[start=2]
+. Запустите проект `AffableBean`. При отображении страницы приветствия щелкните категорию и попытайтесь добавить элемент в корзину. Обратите внимание, что функциональные возможности приложения строго ограничены.
image::images/compromised.png[title="Для функций приложения возникает угроза в случае, если клиента не принимает файлы cookies"]
Как и ранее, сервер создает сеанс и привязывает к нему объекты. Это метод для отображения выбранной категории и продуктов на странице категорий. Тем не менее, при попытке установить файл cookie `JSESSIONID` на сервере происходит сбой. Следовательно, при повторном запросе клиента (когда пользователь нажмите кнопку "add to cart") сервер не может определить сеанс, к которому относится запрос. Поэтому невозможно найти атрибуты, ранее установленные в сеансе, например `selectedCategory` и `categoryProducts`. По этой причине в отображаемом ответе отсутствуют данные, определяемые этими атрибутами.
-3. Откройте в редакторе страницу `category.jsp` проекта. Найдите строку, в которой реализуется кнопка "add to cart" (строка 58). Атрибут `action` элемента `<form>` определяет запрос, отправленный на сервер.
+
+[start=3]
+. Откройте в редакторе страницу `category.jsp` проекта. Найдите строку, в которой реализуется кнопка "add to cart" (строка 58). Атрибут `action` элемента `<form>` определяет запрос, отправленный на сервер.
[source,java]
----
<form action="addToCart" method="post">
----
-4. Измените запрос для его передачи посредством тега `<c:url>`.
+
+[start=4]
+. Измените запрос для его передачи посредством тега `<c:url>`.
[source,java]
----
<form action="*<c:url value='addToCart'/>*" method="post">
----
-5. Для сохранения изменений в файле нажмите сочетание клавиш CTRL+S (⌘-S в Mac). Помните, что среда IDE предоставляет функцию "Развертывание при сохранении", которая активна по умолчанию. Это означает, что все сохраненные изменения автоматически разворачиваются на сервере.
-6. Выберите в браузере другую категорию для отображения в приложении измененной страницы категорий.
-7. Изучите исходный код страницы. В Firefox можно нажать Ctrl-U (⌘-U в Mac). Отобразится кнопка "add to cart" для каждого продукта с идентификатором сеанса, добавленным к URL-адресу.
+
+[start=5]
+. Для сохранения изменений в файле нажмите сочетание клавиш CTRL+S (⌘-S в Mac). Помните, что среда IDE предоставляет функцию "Развертывание при сохранении", которая активна по умолчанию. Это означает, что все сохраненные изменения автоматически разворачиваются на сервере.
+
+[start=6]
+. Выберите в браузере другую категорию для отображения в приложении измененной страницы категорий.
+
+[start=7]
+. Изучите исходный код страницы. В Firefox можно нажать Ctrl-U (⌘-U в Mac). Отобразится кнопка "add to cart" для каждого продукта с идентификатором сеанса, добавленным к URL-адресу.
[source,java]
----
<form action="addToCart*;jsessionid=4188657e21d72f364e0782136dde*" method="post">
----
-8. Нажмите кнопку "add to cart" для любого товара. Теперь сервер способен определить сеанс, которому принадлежит запрос, и создает соответствующий ответ.
-9. Перед продолжением убедитесь, что файлы cookie в браузере снова включены.
+
+[start=8]
+. Нажмите кнопку "add to cart" для любого товара. Теперь сервер способен определить сеанс, которому принадлежит запрос, и создает соответствующий ответ.
+
+[start=9]
+. Перед продолжением убедитесь, что файлы cookie в браузере снова включены.
Снова возникает необходимость в шифровании каждой активной ссылки приложения, ответ которой требует определенной формы данных сеанса. Иногда реализация выполняется не так очевидно, как описывается в примере выше. Например, в настоящий момент виджет "clear cart", используемый на странице `cart.jsp`, устанавливает для параметра `clear` значение `true` при щелчке ссылки.
@@ -657,9 +763,13 @@
</session-timeout>
</session-config>
----
-2. Выберите вкладку "Общее" и введите в поле "Время ожидания сеанса" значение "`10`".
+
+[start=2]
+. Выберите вкладку "Общее" и введите в поле "Время ожидания сеанса" значение "`10`".
image::images/session-timeout.png[title="Укажите время ожидания сеанса для приложения на вкладке 'Общие' файла web.xml"]
-3. Сохраните файл (сочетание клавиш Ctrl-S; ⌘-S в Mac).
+
+[start=3]
+. Сохраните файл (сочетание клавиш Ctrl-S; ⌘-S в Mac).
При обратном переходе в представление XML можно заметить, что элемент `<session-timeout>` был обновлен.
@@ -688,31 +798,51 @@
<session-timeout>*1*</session-timeout>
</session-config>
----
-2. Запустите проект `AffableBean`. Щелкните на странице категорий в браузере, добавьте несколько элементов в корзину и щелкните ссылку "view cart".
+
+[start=2]
+. Запустите проект `AffableBean`. Щелкните на странице категорий в браузере, добавьте несколько элементов в корзину и щелкните ссылку "view cart".
image::images/cart-page-session-intact.png[title="Страница корзины зависит от объекта сеанса при отображении элементов в покупательской корзине"]
-3. Подождите минимум 1 минуту.
-4. Обновите количество для одного из товаров на странице корзины. (Допустимо любое число от 1 до 99.) Нажмите кнопку "update". Сервер отправит сообщение со статусом HTTP "500".
+
+[start=3]
+. Подождите минимум 1 минуту.
+
+[start=4]
+. Обновите количество для одного из товаров на странице корзины. (Допустимо любое число от 1 до 99.) Нажмите кнопку "update". Сервер отправит сообщение со статусом HTTP "500".
image::images/glassfish-error-report.png[title="NullPointerException возникает при получении запроса для сеанса, срок действия которого истек"]
-5. Изучите журнал сервера GlassFish в среде IDE. Откройте окно вывода (Ctrl-4; ⌘-4 в Mac) и перейдите на вкладку 'Сервер GlassFish'. Прокрутите до конца журнала для изучения трассировки стека ошибок.
+
+[start=5]
+. Изучите журнал сервера GlassFish в среде IDE. Откройте окно вывода (Ctrl-4; ⌘-4 в Mac) и перейдите на вкладку 'Сервер GlassFish'. Прокрутите до конца журнала для изучения трассировки стека ошибок.
[.feature]
--
image::images/gf-server-output.png[role="left", link="images/gf-server-output.png"]
--
Журнал сервера показывает, что исключение `NullPointerException` возникло в строке 184 `ControllerServlet`. В диалоговом окне "Вывод" появляется ссылка на строку, в которой возникло исключение.
-6. Щелкните ссылку. Вы попадете прямо на строку 184 в `ControllerServlet`. При наведении курсора мыши на значок ошибки в левом поле редактора выводится всплывающая подсказка с описанием исключения.
+
+[start=6]
+. Щелкните ссылку. Вы попадете прямо на строку 184 в `ControllerServlet`. При наведении курсора мыши на значок ошибки в левом поле редактора выводится всплывающая подсказка с описанием исключения.
image::images/nullpointer-exception.png[title="Метка ошибки и подсказка указывают местоположение и причину проблемы"]
Поскольку время ожидания сеанса истекло до получения запроса, механизму сервлета не удалось связать запрос с соответствующим сеансом. Таким образом, оказалось невозможным обнаружить объект `cart` (строка 151). В конце концов, исключение произойдет на строке 184, когда попытка вызова метода по переменной, имеющей значение `null`.
Проблема определена, для ее исправления необходимо реализовать фильтр.
-7. Нажмите кнопку 'Создать файл' (image::images/new-file-btn.png[]) на панели инструментов IDE. (В качестве альтернативы нажмите Ctrl-N; ⌘-N в Mac.)
-8. Выберите категорию "*Веб*", затем выберите *"Фильтр"* и нажмите кнопку "Далее".
-9. Присвойте фильтру имя `SessionTimeoutFilter`. Введите текст `filter` в поле "Пакеты" для размещения класса фильтра в новом пакете при его создании.
-10. Нажмите кнопку "Далее". Примите настройки по умолчанию и нажмите кнопку "Готово". Для фильтра `SessionTimeoutFilter` создается и открывается в редакторе шаблон.
+
+[start=7]
+. Нажмите кнопку 'Создать файл' (image::images/new-file-btn.png[]) на панели инструментов IDE. (В качестве альтернативы нажмите Ctrl-N; ⌘-N в Mac.)
+
+[start=8]
+. Выберите категорию "*Веб*", затем выберите *"Фильтр"* и нажмите кнопку "Далее".
+
+[start=9]
+. Присвойте фильтру имя `SessionTimeoutFilter`. Введите текст `filter` в поле "Пакеты" для размещения класса фильтра в новом пакете при его создании.
+
+[start=10]
+. Нажмите кнопку "Далее". Примите настройки по умолчанию и нажмите кнопку "Готово". Для фильтра `SessionTimeoutFilter` создается и открывается в редакторе шаблон.
*Примечание.* В настоящее время в NetBeans 6.9 не поддерживается использование мастера для задания сопоставления с сервлетом, которые не зарегистрирован в дескрипторе веб-развертывания. (`ControllerServlet` был зарегистрирован с помощью аннотации `@WebServlet`). Следовательно, необходимо изменить созданный код в следующем шаге.
-11. Измените подпись аннотации `@WebFilter` следующим образом:
+
+[start=11]
+. Измените подпись аннотации `@WebFilter` следующим образом:
[source,java]
----
@@ -731,7 +861,9 @@
Используйте функцию поиска документации по индексу, чтобы вытянуть документацию по интерфейсу `Filter`. Нажмите сочетание клавиш SHIFT+F1 (fn+SHIFT+F1 в системе Mac), введите текст `Filter` в поле поиска и нажмите ENTER. Выберите запись "Interface in javax.servlet". Документация Javadoc выводится на нижней панели средства поиска по индексу.
-12. Замените тело фильтра `SessionTimeoutFilter` на следующее содержимое.
+
+[start=12]
+. Замените тело фильтра `SessionTimeoutFilter` на следующее содержимое.
[source,java]
----
@@ -765,27 +897,55 @@
}
----
-13. Нажмите Ctrl-Shift-I (⌘-Shift-I в Mac) для исправления операторов импорта. (Необходимо добавить импорт для `HttpServletRequest` и `HttpSession`.) Используйте подсказки редактора чтобы добавить аннотацию `@Override` к методам `init`, `destroy` и `doFilter`.
+
+[start=13]
+. Нажмите Ctrl-Shift-I (⌘-Shift-I в Mac) для исправления операторов импорта. (Необходимо добавить импорт для `HttpServletRequest` и `HttpSession`.) Используйте подсказки редактора чтобы добавить аннотацию `@Override` к методам `init`, `destroy` и `doFilter`.
В следующих шагах выполняется запуск отладчика для проекта и переход по методу `doFilter` для просмотра способа определения привязки запроса существующему сеансу.
-14. Откройте окно точек останова (ALT+SHIFT+5; CTRL+SHIFT+5 в Mac OS) и удостоверьтесь, что не установлена ни одна точка останова. Для удаления точки останова щелкните правой кнопкой мыши точку останова и выбериет 'Удалить'. (Если было выполнено упражнение выше, <<http-monitor,Examining Client-Server Communication with the HTTP Monitor>> (Проверка соединения клиент-сервер с помощью HTTP-монитора), в `ControllerServlet` может быть установлена лишняя точка останова).
-15. Запустите отладчик. Нажмите кнопку 'Отладка проекта' (image::images/debug-project-btn.png[]) на главной панели инструментов IDE.
-16. При выводе страницы приветствия в браузере выберите категорию и добавьте несколько элементов в корзину покупок.
-17. Установите точку останова на строку принадлежащего фильтру `SessionTimeoutFilter` метода `doFilter`, который пытается получить доступ к сеансу (строка 32).
+
+[start=14]
+. Откройте окно точек останова (ALT+SHIFT+5; CTRL+SHIFT+5 в Mac OS) и удостоверьтесь, что не установлена ни одна точка останова. Для удаления точки останова щелкните правой кнопкой мыши точку останова и выбериет 'Удалить'. (Если было выполнено упражнение выше, <<http-monitor,Examining Client-Server Communication with the HTTP Monitor>> (Проверка соединения клиент-сервер с помощью HTTP-монитора), в `ControllerServlet` может быть установлена лишняя точка останова).
+
+[start=15]
+. Запустите отладчик. Нажмите кнопку 'Отладка проекта' (image::images/debug-project-btn.png[]) на главной панели инструментов IDE.
+
+[start=16]
+. При выводе страницы приветствия в браузере выберите категорию и добавьте несколько элементов в корзину покупок.
+
+[start=17]
+. Установите точку останова на строку принадлежащего фильтру `SessionTimeoutFilter` метода `doFilter`, который пытается получить доступ к сеансу (строка 32).
image::images/filter-breakpoint.png[title="Установите точку останова в методе getSession"]
-18. Щелкните в браузере ссылку "view cart". Перейдите к среде IDE и обратите внимание, что отладчик приостановил работу в точке останова.
+
+[start=18]
+. Щелкните в браузере ссылку "view cart". Перейдите к среде IDE и обратите внимание, что отладчик приостановил работу в точке останова.
Учтите, что метод `getSession()` создает новый объект сеанса, если текущий объект не существует. В данном случае используется метод `getSession(false)`, который не создает новый объект, если объект не найден. Другими словами, метод возвращает значение `null`, если сеанс не существует.
-19. Нажмите кнопку 'Обход процедур' ( image::images/step-over-btn.png[] ), затем подведите курсор мыши к переменной `session`. При условии, что с момента отправки предыдущего запроса не прошла минута, переменная присваивается типу `StandardSessionFacade`. Он представляет объект сеанса для запроса.
+
+[start=19]
+. Нажмите кнопку 'Обход процедур' ( image::images/step-over-btn.png[] ), затем подведите курсор мыши к переменной `session`. При условии, что с момента отправки предыдущего запроса не прошла минута, переменная присваивается типу `StandardSessionFacade`. Он представляет объект сеанса для запроса.
image::images/session-exists.png[title="Наведите курсор на переменные для определения их текущих значений"]
-20. Продолжайте двигаться по строкам метода, пока запрос не будет обработан. Поскольку переменная `session` не равна `null`, можно пропустить выражение `if`, и фильтр `chain.doFilter` направит запрос прямо к `ControllerServlet` (строка 44).
-21. Перейдите в браузер, убедитесь, что прошла минута, и обновите количество для одного из элементов продукта в корзине. Это та же самая процедура, которая выполнялась ранее в упражнении с возвратом сообщения 500. Выясним, что происходит при истечении времени ожидания сеанса теперь, когда фильтр перехватывает заголовки запросов для файла `ControllerServlet`.
-22. После щелчка элемента "Обновить" перейдите в среду IDE и обратите внимание, что отладчик снова приостановился на точке останова, установленной в фильтре.
-23. Выделите выражение `req.getSession(false)` и наведите на него курсор мыши. Обратите внимание, что выражение имеет значение `null`, поскольку время ожидания сеанса истекло.
+
+[start=20]
+. Продолжайте двигаться по строкам метода, пока запрос не будет обработан. Поскольку переменная `session` не равна `null`, можно пропустить выражение `if`, и фильтр `chain.doFilter` направит запрос прямо к `ControllerServlet` (строка 44).
+
+[start=21]
+. Перейдите в браузер, убедитесь, что прошла минута, и обновите количество для одного из элементов продукта в корзине. Это та же самая процедура, которая выполнялась ранее в упражнении с возвратом сообщения 500. Выясним, что происходит при истечении времени ожидания сеанса теперь, когда фильтр перехватывает заголовки запросов для файла `ControllerServlet`.
+
+[start=22]
+. После щелчка элемента "Обновить" перейдите в среду IDE и обратите внимание, что отладчик снова приостановился на точке останова, установленной в фильтре.
+
+[start=23]
+. Выделите выражение `req.getSession(false)` и наведите на него курсор мыши. Обратите внимание, что выражение имеет значение `null`, поскольку время ожидания сеанса истекло.
image::images/session-null.png[title="Выделите выражения и наведите курсор мыши на них для определения их текущих значений"]
-24. Продолжите переход по коду. Теперь переменная `session` равна `null`, выражение `if` на странице 35 обрабатывается, и запрос направляется прямо к `/index.jsp`. Когда отладчик завершает работу, в браузере выводится страница приветствия сайта.
-25. Нажмите кнопку 'Завершить сеанс' ( image::images/finish-session-btn.png[] ), чтобы завершить сеанс отладки.
-26. Откройте файл `web.xml` проекта и снова измените время ожидания сеанса на 10 минут.
+
+[start=24]
+. Продолжите переход по коду. Теперь переменная `session` равна `null`, выражение `if` на странице 35 обрабатывается, и запрос направляется прямо к `/index.jsp`. Когда отладчик завершает работу, в браузере выводится страница приветствия сайта.
+
+[start=25]
+. Нажмите кнопку 'Завершить сеанс' ( image::images/finish-session-btn.png[] ), чтобы завершить сеанс отладки.
+
+[start=26]
+. Откройте файл `web.xml` проекта и снова измените время ожидания сеанса на 10 минут.
[source,xml]
----
@@ -794,7 +954,9 @@
<session-timeout>*10*</session-timeout>
</session-config>
----
-27. Сохраните файл (Ctrl-S; ⌘-S в Mac).
+
+[start=27]
+. Сохраните файл (Ctrl-S; ⌘-S в Mac).
link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot6.zip[+Снимок 6+] демонстрирует полную версию проекта для данного раздела руководства. Рассмотрим еще один вопрос, касающийся управления сеансом. Можно завершить сеанс явным образом, вызвав метод `invalidate` для объекта сеанса. Если сеанс больше не требуется, необходимо удалить его для сохранения доступной памяти на сервере. После завершения следующего раздела, link:transaction.html[+Интеграция транзакционной бизнес-логики+], можно увидеть, как `ControllerServlet` после успешной обработки заказ клиента, уничтожает пользовательский объект `cart` и прерывает сессию, используя метод `invalidate`.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_zh_CN.asciidoc
index 3f7aa6a..6f1d2cc 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/manage-sessions_zh_CN.asciidoc
@@ -256,14 +256,18 @@
* `WEB-INF/view/category.jsp`
* `WEB-INF/view/checkout.jsp`
* `controller/ControllerServlet`
-2. 运行项目 (image::images/run-project-btn.png[]) 以确保它正确配置了数据库和应用服务器。
+
+[start=2]
+. 运行项目 (image::images/run-project-btn.png[]) 以确保它正确配置了数据库和应用服务器。
如果运行项目时接收到错误,请重新访问link:setup.html[+设置说明+],其中介绍了如何准备数据库及如何在 IDE、GlassFish 和 MySQL 之间建立连接。
-3. 在浏览器中测试应用程序的功能。如果直接从link:entity-session.html[+上一个教程单元+]继续往下操作,将注意到以下增强功能。
+
+[start=3]
+. 在浏览器中测试应用程序的功能。如果直接从link:entity-session.html[+上一个教程单元+]继续往下操作,将注意到以下增强功能。
-==== 类别页
+=== 类别页
* 首次单击 "add to cart" 会使购物车和 "proceed to checkout" 窗口部件显示在标题中。
* 单击 "add to cart" 将更新标题中购物车窗口部件中的购物车项目数。
@@ -273,7 +277,7 @@
[[cartPage]]
-==== 购物车页
+=== 购物车页
* 单击 "clear cart" 将清空购物车中的项目。
* 单击 "continue shopping" 将返回到上一个查看过的类别。
@@ -283,23 +287,31 @@
image::images/cart-page.png[title="购物车页包含购物车功能"]
-==== 结帐页
+=== 结帐页
* 单击 "view cart" 将显示购物车页。
* 单击 "submit purchase" 将显示确认页(不含特定于用户的数据)。
image::images/checkout-page.png[title="结帐页包含购物车功能"]
-4. 使用 "Go to File"(转至文件)对话框在编辑器中打开 `ControllerServlet`。按 Alt-Shift-O 组合键(在 Mac 上为 Ctrl-Shift-O 组合键),然后在对话框中键入 "`Controller`",并单击 "OK"(确定)。
+
+[start=4]
+. 使用 "Go to File"(转至文件)对话框在编辑器中打开 `ControllerServlet`。按 Alt-Shift-O 组合键(在 Mac 上为 Ctrl-Shift-O 组合键),然后在对话框中键入 "`Controller`",并单击 "OK"(确定)。
image::images/go-to-file-dialog.png[title="使用 "]
-5. 在 `doPost` 方法中创建 `HttpSession` 对象的那一行(第 150 行)上设置一个断点。要设置断点,请在编辑器的左旁注处单击。
+
+[start=5]
+. 在 `doPost` 方法中创建 `HttpSession` 对象的那一行(第 150 行)上设置一个断点。要设置断点,请在编辑器的左旁注处单击。
image::images/breakpoint.png[title="单击编辑器的左旁注以设置断点"]
要开启/关闭编辑器的行号,请右键单击左旁注,然后选择 "Show Line Numbers"(显示行号)。
-6. 运行调试器。单击 IDE 主工具栏中的 "Debug Project"(调试项目)(image::images/debug-project-btn.png[]) 按钮。GlassFish Server 启动(或者如果已在运行,则重新启动)并在其调试端口号上打开一个套接字。应用程序欢迎页在浏览器中打开。
+
+[start=6]
+. 运行调试器。单击 IDE 主工具栏中的 "Debug Project"(调试项目)(image::images/debug-project-btn.png[]) 按钮。GlassFish Server 启动(或者如果已在运行,则重新启动)并在其调试端口号上打开一个套接字。应用程序欢迎页在浏览器中打开。
可以在 "Servers"(服务器)窗口(通过 "Tools"(工具)> "Servers"(服务器)打开)中查看和修改调试端口号。为所使用的服务器选择 "Java" 标签。在 "Debug Settings"(调试设置)下方的 "Address to use"(要使用的地址)字段中指定端口号。
-7. 当浏览器中出现应用程序的欢迎页时,单击任意类别图像导航至类别页。请回忆一下,单击 "add to cart" 按钮将向服务器发送 `addToCart` 请求:
+
+[start=7]
+. 当浏览器中出现应用程序的欢迎页时,单击任意类别图像导航至类别页。请回忆一下,单击 "add to cart" 按钮将向服务器发送 `addToCart` 请求:
[source,java]
----
@@ -307,9 +319,13 @@
<form action="addToCart" method="post">
----
可以回忆一下link:page-views-controller.html#controller[+准备页面视图和控制器 Servlet+] 的内容,就会想起 `ControllerServlet` 的 `doPost` 方法可以处理 `/addToCart` URL 模式的请求。因此可能期望在用户单击 "add to cart" 按钮时,调用 `doPost` 方法。
-8. 在类别页中对任意产品单击 "add to cart"。切换回 IDE,注意到调试器在断点处挂起。
+
+[start=8]
+. 在类别页中对任意产品单击 "add to cart"。切换回 IDE,注意到调试器在断点处挂起。
image::images/breakpoint-suspended.png[title="调试器在编辑器中的断点处挂起"]
-9. 将光标放在 `getSession()` 的调用上,然后按 Ctrl-空格键来调用 Javadoc 文档。
+
+[start=9]
+. 将光标放在 `getSession()` 的调用上,然后按 Ctrl-空格键来调用 Javadoc 文档。
image::images/javadoc-getsession.png[title="按 Ctrl-空格键可调用 Javadoc 文档"]
根据文档,`getSession()` 返回当前与请求相关联的 `HttpSession`,如果会话不存在,该方法将创建一个新的会话对象。
@@ -353,10 +369,16 @@
* link:http://java.sun.com/j2se/javadoc/[+Javadoc 工具官方主页+]
* link:http://java.sun.com/j2se/javadoc/writingdoccomments/index.html[+如何编写适用于 Javadoc 工具的文档注释+]
-10. 将鼠标悬停在 `session` 变量上。请注意,调试器在_将要执行的行上_挂起。由 `getSession()` 返回的值尚未保存到 `session` 变量中,这时会显示一个弹出式窗口,指出“`session` 在当前上下文中不是已知变量。”
+
+[start=10]
+. 将鼠标悬停在 `session` 变量上。请注意,调试器在_将要执行的行上_挂起。由 `getSession()` 返回的值尚未保存到 `session` 变量中,这时会显示一个弹出式窗口,指出“`session` 在当前上下文中不是已知变量。”
image::images/session-variable.png[title="将鼠标悬停在变量和表达式上可确定其当前值"]
-11. 在位于编辑器上方的调试器工具栏中单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮。将执行该行,并且调试器执行到文件中的下一行。
-12. 再次将鼠标悬停在 `session` 变量上。现在,您会看到当前为 `session` 变量设置的值。
+
+[start=11]
+. 在位于编辑器上方的调试器工具栏中单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮。将执行该行,并且调试器执行到文件中的下一行。
+
+[start=12]
+. 再次将鼠标悬停在 `session` 变量上。现在,您会看到当前为 `session` 变量设置的值。
[.feature]
--
image::images/session-variable-set.png[role="left", link="images/session-variable-set.png"]
@@ -364,18 +386,30 @@
在 NetBeans 6.9 中,可在弹出式窗口中单击灰色指针 (image::images/grey-pointer.png[]) 以展开突出显示的元素中包含的变量值列表。
-13. 单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮(F8 键;在 Mac 上为 fn-F8 组合键)以到达 `if` 语句(第 154 行)。因为刚刚在浏览器中单击了 "add to cart" 按钮,所以表达式 `userPath.equals("/addToCart")` 的值应该为 `true`。
-14. 突出显示 `userPath.equals("/addToCart")` 表达式(方法是按住 Ctrl 键并单击鼠标)。此时,将看到一个弹出式窗口,其中指示了被突出显示的表达式的值。
+
+[start=13]
+. 单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮(F8 键;在 Mac 上为 fn-F8 组合键)以到达 `if` 语句(第 154 行)。因为刚刚在浏览器中单击了 "add to cart" 按钮,所以表达式 `userPath.equals("/addToCart")` 的值应该为 `true`。
+
+[start=14]
+. 突出显示 `userPath.equals("/addToCart")` 表达式(方法是按住 Ctrl 键并单击鼠标)。此时,将看到一个弹出式窗口,其中指示了被突出显示的表达式的值。
image::images/expression.png[title="突出显示表达式以确定其当前值"]
-15. 按 F8 键(在 Mac 上为 fn-F8 组合键)执行到下一行(第 158 行)。对应用程序进行了设计,以便仅在用户第一次将某个项目添加到购物车中时才创建用户会话的 `ShoppingCart` 对象。由于在此调试会话中,这是第一次收到 `addToCart` 请求,因此可以想到 `cart` 对象的值为`空值`。
+
+[start=15]
+. 按 F8 键(在 Mac 上为 fn-F8 组合键)执行到下一行(第 158 行)。对应用程序进行了设计,以便仅在用户第一次将某个项目添加到购物车中时才创建用户会话的 `ShoppingCart` 对象。由于在此调试会话中,这是第一次收到 `addToCart` 请求,因此可以想到 `cart` 对象的值为`空值`。
image::images/cart-null.png[title="直到用户将物品添加到购物车后,购物车对象才存在"]
-16. 按 F8 键(在 Mac 上为 fn-F8 组合键)执行到下一行(第 160 行)。然后,在第 160 行(创建 `ShoppingCart` 对象的位置),单击 "Step Into"(步入)(image::images/step-into-btn.png[]) 按钮。调试器步入正被调用的方法。在这种情况下,将直接转至 `ShoppingCart` 的构造函数。
+
+[start=16]
+. 按 F8 键(在 Mac 上为 fn-F8 组合键)执行到下一行(第 160 行)。然后,在第 160 行(创建 `ShoppingCart` 对象的位置),单击 "Step Into"(步入)(image::images/step-into-btn.png[]) 按钮。调试器步入正被调用的方法。在这种情况下,将直接转至 `ShoppingCart` 的构造函数。
image::images/cart-constructor.png[title="步入方法以继续对其他类执行运行时"]
-17. 按 Ctrl-Tab 组合键以切换回 `ControllerServlet`。请注意,IDE 在第 160 行提供了一个调用堆栈 (image::images/call-stack-badge.png[]) 标记,指出调试器当前在调用堆栈中较高级方法上的某个位置挂起。
+
+[start=17]
+. 按 Ctrl-Tab 组合键以切换回 `ControllerServlet`。请注意,IDE 在第 160 行提供了一个调用堆栈 (image::images/call-stack-badge.png[]) 标记,指出调试器当前在调用堆栈中较高级方法上的某个位置挂起。
按 Alt-Shift-3 组合键(在 Mac 上为 Ctrl-Shift-3 组合键),以打开 IDE 的 "Call Stack"(调用堆栈)窗口。
-18. 按 F8 键(在 Mac 上为 fn-F8 键)以继续逐步执行代码。当调试器完成 `ShoppingCart` 构造函数时,将转回至 `ControllerServlet`。
+
+[start=18]
+. 按 F8 键(在 Mac 上为 fn-F8 键)以继续逐步执行代码。当调试器完成 `ShoppingCart` 构造函数时,将转回至 `ControllerServlet`。
`ControllerServlet` 的第 161 行将新创建的 `cart` 对象绑定到会话。
@@ -391,7 +425,9 @@
--
如果展开 "session" > "session" > "attributes" 节点,可以查看绑定到会话的对象。在上面的图像中,当前有两个项目被绑定到会话(突出显示)。它们是 `selectedCategory` 和 `categoryProducts`,分别在 `ControllerServlet` 中的第 83 和 89 行进行实例化。之前单击类别图像时就绑定了这两个项目,并且 `ControllerServlet` 对类别页请求进行了处理。
-19. 按 F8 键(在 Mac 上为 fn-F8 组合键)以执行第 161 行。`cart` 对象将被绑定到会话,"Variables"(变量)窗口将更新以反映更改。在 "Variables"(变量)窗口中,请注意现在会话包含了三个属性,其中第三个就是新初始化的 `ShoppingCart` 对象(在下面被突出显示)。
+
+[start=19]
+. 按 F8 键(在 Mac 上为 fn-F8 组合键)以执行第 161 行。`cart` 对象将被绑定到会话,"Variables"(变量)窗口将更新以反映更改。在 "Variables"(变量)窗口中,请注意现在会话包含了三个属性,其中第三个就是新初始化的 `ShoppingCart` 对象(在下面被突出显示)。
[.feature]
--
image::images/variables-win-session-cart.png[role="left", link="images/variables-win-session-cart.png"]
@@ -405,8 +441,12 @@
* 使用 ID 创建 `Product` 对象(第 169 行)
* 使用 `product` 创建新的 `ShoppingCartItem`(第 170 行)
* 将 `ShoppingCartItem` 添加到 `ShoppingCart` 的 `items` 列表中(第 170 行)
-20. 按 F8 键(在 Mac 上为 fn-F8 键)继续执行代码,同时留意上面列出的四个操作。当调试器在第 170 行上挂起时挂起。
-21. 在会话上创建监视。这样可以在步入下一步中的 `addItem` 方法中时查看包含在会话中的值。右键单击 "Variables"(变量)窗口中的会话,然后选择 "Create Fixed Watch"(创建固定监视)。
+
+[start=20]
+. 按 F8 键(在 Mac 上为 fn-F8 键)继续执行代码,同时留意上面列出的四个操作。当调试器在第 170 行上挂起时挂起。
+
+[start=21]
+. 在会话上创建监视。这样可以在步入下一步中的 `addItem` 方法中时查看包含在会话中的值。右键单击 "Variables"(变量)窗口中的会话,然后选择 "Create Fixed Watch"(创建固定监视)。
image::images/create-watch.png[title="在调试会话中逐步执行代码时创建对变量的监视"]
此外,也可以在编辑器中将光标放在 `session` 变量上,然后右键单击并选择 "New Watch"(新建监视)。利用 "New Watch"(新建监视)对话框,可以在调试应用程序时指定要监视的变量或表达式。(如果是表达式的话,先突出显示该表达式,然后右键单击并选择 "New Watch"(新建监视)。)
@@ -415,23 +455,37 @@
将创建对 `session` 变量及其包含的所有变量的新监视。可在 "Watches"(监视)窗口("Window"(窗口)> "Debugging"(调试)> "Watches"(监视))中查看监视;或者,如果开启 "Variables"(变量)窗口左旁注中的 "Watches"(监视)(image::images/watch-btn.png[]) 按钮,则监视会显示在 "Variables"(变量)窗口的最上方一行中。
使用调试器可以在执行代码时观察变量。这在下面的情况中很有用,例如,要跟踪对特定变量值的更改(而并不需要查看在执行每一步时 "Variables"(变量)窗口中显示的整个列表),或者临时步入的某个类不包含您感兴趣的变量。
-22. 单击 "Step Into"(步入)(image::images/step-into-btn.png[]) 按钮以步入 `ShoppingCart` 的 `addItem` 方法。
-23. 逐步执行 `addItem` 方法直到第 53 行。正如 Javadoc 中说明的,`addItem`“将 `ShoppingCartItem` 添加到 `ShoppingCart` 的 `items` 列表中。如果指定的 `product` 的项目已经存在于购物车列表中,该项目的数量将增加”。
-24. 检查对其创建了监视的 `session` 变量(上面的<<step21,步骤 21>>)。第 51 行中的 `items.add(scItem)` 语句将新的 `ShoppingCartItem` 添加到 `ShoppingCart` 中的 `items` 列表中。通过更进一步地浏览会话中包含的第三个属性(即 `cart` 变量),这就显而易见了。
+
+[start=22]
+. 单击 "Step Into"(步入)(image::images/step-into-btn.png[]) 按钮以步入 `ShoppingCart` 的 `addItem` 方法。
+
+[start=23]
+. 逐步执行 `addItem` 方法直到第 53 行。正如 Javadoc 中说明的,`addItem`“将 `ShoppingCartItem` 添加到 `ShoppingCart` 的 `items` 列表中。如果指定的 `product` 的项目已经存在于购物车列表中,该项目的数量将增加”。
+
+[start=24]
+. 检查对其创建了监视的 `session` 变量(上面的<<step21,步骤 21>>)。第 51 行中的 `items.add(scItem)` 语句将新的 `ShoppingCartItem` 添加到 `ShoppingCart` 中的 `items` 列表中。通过更进一步地浏览会话中包含的第三个属性(即 `cart` 变量),这就显而易见了。
[.feature]
--
image::images/variables-window-add-item.png[role="left", link="images/variables-window-add-item.png"]
--
在此阶段,可以看到如何针对请求创建 `HttpSession`、如何创建 `ShoppingCart` 对象并将其连接到会话、如何根据用户的产品选择创建 `ShoppingCartItem` 然后将其添加到 `ShoppingCart` 的 `items` 列表中。剩下的唯一操作就是将请求转发到 `category.jsp` 视图。
-25. 在编辑器中打开标题 JSP 片段 (`header.jspf`),然后在第 86 行上设置一个断点。该行包含了用于显示购物车项目数的购物车窗口部件中的 EL 语句。
+
+[start=25]
+. 在编辑器中打开标题 JSP 片段 (`header.jspf`),然后在第 86 行上设置一个断点。该行包含了用于显示购物车项目数的购物车窗口部件中的 EL 语句。
image::images/breakpoint-jsp.png[title="您可以在 JSP 页中挂起调试器"]
-26. 单击调试器工具栏中的 "Continue"(继续)(image::images/continue-btn.png[]) 按钮。调试器将继续直到执行完成,或者直到遇到另一个断点。在这种情况下,调试器在标题 JSP 片段中的第 86 行上挂起。
+
+[start=26]
+. 单击调试器工具栏中的 "Continue"(继续)(image::images/continue-btn.png[]) 按钮。调试器将继续直到执行完成,或者直到遇到另一个断点。在这种情况下,调试器在标题 JSP 片段中的第 86 行上挂起。
*注:*为了在 JSP 页中挂起调试器,需要设置断点。例如,当 `ControllerServlet` 将请求转发到相应的视图时,调试器不会在 JSP 页中自动挂起。
-27. 打开 "Variables"(变量)窗口(Alt-Shift-1 组合键;在 Mac 上为 Ctrl-Shift-1 组合键)(如果尚未打开)。与 Java 类不同,在将鼠标悬停在 JSP 页中的变量或表达式上时,调试器_不会_提供工具提示。但是,使用 "Variables"(变量)窗口可以在逐步执行代码时确定变量的值。那么,在哪儿可以找到 `${cart.numberOfItems}` 的值?
-28. 在 "Variables"(变量)窗口中,展开 "Implicit Objects"(隐式对象)> "pageContext" > "session" > "session" > "attributes" 节点。这将提供对会话对象的访问,正如之前使用 `ControllerServlet` 时所看到的。实际上,可能注意到在上面的步骤 21 中对其创建了监视的会话恰好指向同一个对象。在此可以验证 `${cart.numberOfItems}` 的值等于 "`1`"。
+
+[start=27]
+. 打开 "Variables"(变量)窗口(Alt-Shift-1 组合键;在 Mac 上为 Ctrl-Shift-1 组合键)(如果尚未打开)。与 Java 类不同,在将鼠标悬停在 JSP 页中的变量或表达式上时,调试器_不会_提供工具提示。但是,使用 "Variables"(变量)窗口可以在逐步执行代码时确定变量的值。那么,在哪儿可以找到 `${cart.numberOfItems}` 的值?
+
+[start=28]
+. 在 "Variables"(变量)窗口中,展开 "Implicit Objects"(隐式对象)> "pageContext" > "session" > "session" > "attributes" 节点。这将提供对会话对象的访问,正如之前使用 `ControllerServlet` 时所看到的。实际上,可能注意到在上面的步骤 21 中对其创建了监视的会话恰好指向同一个对象。在此可以验证 `${cart.numberOfItems}` 的值等于 "`1`"。
[.feature]
--
image::images/variables-window-number-of-items.png[role="left", link="images/variables-window-number-of-items.png"]
@@ -440,7 +494,9 @@
最大化 "Variables"(变量)窗口,或 IDE 中的任何窗口,方法是右键单击窗口标题,然后选择 "Maximize"(最大化窗口)(Shift-Esc 组合键)。
使用调试器可以访问 `pageContext` 隐式对象。`pageContext` 代表 JSP 页的上下文,并提供对各种对象的直接访问,其中包括 `HttpServletRequest`、`HttpSession` 和 `ServletContext` 对象。有关详细信息,请参见 link:http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaij[+Java EE 5 教程:隐式对象+]。
-29. 单击 "Finish Session"(完成会话)(image::images/finish-session-btn.png[]) 按钮。运行时完成执行过程,调试会话终止。浏览器显示一个完全呈现的类别页,可以看到页面标题中的购物车窗口部件包含了一个项目。
+
+[start=29]
+. 单击 "Finish Session"(完成会话)(image::images/finish-session-btn.png[]) 按钮。运行时完成执行过程,调试会话终止。浏览器显示一个完全呈现的类别页,可以看到页面标题中的购物车窗口部件包含了一个项目。
希望您现在能够非常熟练地使用 IDE 的调试器,不仅可以在项目运行不正常时检查该项目,还可以用作为进一步熟悉代码的工具。调试器工具栏中其他有用的按钮包括:
@@ -487,14 +543,24 @@
1. 从激活正在使用的服务器的 HTTP 监视器开始。选择 "Tools"(工具)> "Servers"(服务器)。在 "Servers"(服务器)窗口的左列中,选择正在使用的服务器 (GlassFish)。然后,在主列中,选择 "Enable HTTP Monitor"(启用 HTTP 监视器)选项。
image::images/servers-win-http-monitor.png[title="选择 "]
-2. 如果服务器已经在运行了,则需要重新启动它。不过,由于我们打算使用调试器,并且运行调试器会重新启动服务器以在其他端口上通信,因此只需在 IDE 的主工具栏中单击 "Debug Project"(调试项目)(image::images/debug-project-btn.png[]) 按钮即可。将重新启动服务器,开始一个调试会话,并在浏览器中打开应用程序的欢迎页。HTTP 监视器显示在 IDE 的底部区域中。
+
+[start=2]
+. 如果服务器已经在运行了,则需要重新启动它。不过,由于我们打算使用调试器,并且运行调试器会重新启动服务器以在其他端口上通信,因此只需在 IDE 的主工具栏中单击 "Debug Project"(调试项目)(image::images/debug-project-btn.png[]) 按钮即可。将重新启动服务器,开始一个调试会话,并在浏览器中打开应用程序的欢迎页。HTTP 监视器显示在 IDE 的底部区域中。
image::images/http-monitor.png[title="默认情况下,HTTP 监视器显示在 IDE 的底部区域中"]
-3. 单击左列中的 AffableBean 记录(如上图所示)。在选择左列中的记录时,右列(即主列)将刷新以显示相应的数据。在上图中,"Request"(请求)标签显示了请求的 URI (`/AffableBean/`) 和 HTTP 方法 (`GET`),并指出没有任何查询字符串随请求发送。
-4. 选择 "Session"(会话)标签。请注意这句话,"The session was created as a result of this request."(由于该请求而创建了会话。)这是因为服务器在其响应中为 `JSESSIONID` cookie 发送了一个 `Set-Cookie` 标题。还请注意,新的会话 ID 列在 "Session properties"(会话属性)下面。下面您还将了解到,会话 ID 是 `JSESSIONID` cookie 的值。
+
+[start=3]
+. 单击左列中的 AffableBean 记录(如上图所示)。在选择左列中的记录时,右列(即主列)将刷新以显示相应的数据。在上图中,"Request"(请求)标签显示了请求的 URI (`/AffableBean/`) 和 HTTP 方法 (`GET`),并指出没有任何查询字符串随请求发送。
+
+[start=4]
+. 选择 "Session"(会话)标签。请注意这句话,"The session was created as a result of this request."(由于该请求而创建了会话。)这是因为服务器在其响应中为 `JSESSIONID` cookie 发送了一个 `Set-Cookie` 标题。还请注意,新的会话 ID 列在 "Session properties"(会话属性)下面。下面您还将了解到,会话 ID 是 `JSESSIONID` cookie 的值。
image::images/session-tab.png[title="会话详细信息显示在 HTTP 监视器中的 "]
您可能想知道如何通过对站点欢迎页的请求来创建会话对象。毕竟,`ControllerServlet` 不处理对于 `/AffableBean/` 的初始请求,并且该请求在任何地方都不会遇到 `getSession()`。确实如此吗?请回想一下,在进行部署时,JSP 页被编译成 Servlet。在将项目部署到服务器之后,实际上可以使用 IDE 查看服务器上 JSP 的已编译 Servlet。
-5. 在 "Projects"(项目)窗口中,右键单击 `index.jsp` 文件,然后选择 "View Servlet"(查看 Servlet)。`index_jsp.java` 文件在编辑器中打开。这就是由 `index.jsp` 页自动编译的 Servlet。
-6. 在文件中搜索 `getSession`。按 Ctrl-F 组合键(在 Mac 上为 ⌘-F 组合键),在搜索栏中键入 "`getSession`",然后按 Enter 键。
+
+[start=5]
+. 在 "Projects"(项目)窗口中,右键单击 `index.jsp` 文件,然后选择 "View Servlet"(查看 Servlet)。`index_jsp.java` 文件在编辑器中打开。这就是由 `index.jsp` 页自动编译的 Servlet。
+
+[start=6]
+. 在文件中搜索 `getSession`。按 Ctrl-F 组合键(在 Mac 上为 ⌘-F 组合键),在搜索栏中键入 "`getSession`",然后按 Enter 键。
Ctrl-F 组合键(在 Mac 上为 ⌘-F 组合键)是 "Edit"(编辑)> "Find"(查找)的快捷键。
@@ -510,12 +576,20 @@
要在服务器上找到已编译 Servlet 的位置,可以将鼠标悬停在编辑器上方的 Servlet 的名称标签上。弹出式窗口将显示计算机上文件的路径。
-7. 在浏览器中,选择一个类别,然后将一个项目添加到购物车中。切换回 IDE。请注意,调试器在 `ControllerServlet` 中之前设置的断点处(第 150 行)挂起。会话之间的所有断点都被记住。要删除断点,可在编辑器的左旁注中单击断点 (image::images/breakpoint-badge.png[]) 标记。然而,由于在项目中已经设置了多个断点,因此可以打开调试器的 "Breakpoints"(断点)窗口("Window"(窗口)> "Debugging"(调试)> "Breakpoints"(断点))。
+
+[start=7]
+. 在浏览器中,选择一个类别,然后将一个项目添加到购物车中。切换回 IDE。请注意,调试器在 `ControllerServlet` 中之前设置的断点处(第 150 行)挂起。会话之间的所有断点都被记住。要删除断点,可在编辑器的左旁注中单击断点 (image::images/breakpoint-badge.png[]) 标记。然而,由于在项目中已经设置了多个断点,因此可以打开调试器的 "Breakpoints"(断点)窗口("Window"(窗口)> "Debugging"(调试)> "Breakpoints"(断点))。
image::images/breakpoints-window.png[title="从 "]
从 Breakpoints"(断点)窗口中,可以在 IDE 中打开的项目中设置的所有断点上查看和调用操作。
-8. 右键单击 `header.jspf` 中设置的断点,选择 "Delete"(删除)。然后右键单击 `ControllerServlet` 中设置的断点并选择 "Disable"(禁用)。(稍后将在本练习中重新启用该断点。)
-9. 单击 "Continue"(继续)(image::images/continue-btn.png[]) 按钮。请求完成执行,在浏览器中显示类别页,并向购物车中添加了一个项目。
-10. 在 HTTP 监视器的左列中搜索 `addToCart` 请求,然后选择该请求以在主列中显示详细信息。
+
+[start=8]
+. 右键单击 `header.jspf` 中设置的断点,选择 "Delete"(删除)。然后右键单击 `ControllerServlet` 中设置的断点并选择 "Disable"(禁用)。(稍后将在本练习中重新启用该断点。)
+
+[start=9]
+. 单击 "Continue"(继续)(image::images/continue-btn.png[]) 按钮。请求完成执行,在浏览器中显示类别页,并向购物车中添加了一个项目。
+
+[start=10]
+. 在 HTTP 监视器的左列中搜索 `addToCart` 请求,然后选择该请求以在主列中显示详细信息。
单击 "Ascending Sort"(升序排序)(image::images/ascending-sort-btn.png[]) 按钮,使最近的记录列在最上方。
@@ -525,23 +599,39 @@
--
image::images/http-monitor-add-to-cart.png[role="left", link="images/http-monitor-add-to-cart.png"]
--
-11. 选择 "Cookie" 标签。在此处会看到存在一个名为 `JSESSIONID` 的 cookie,从客户端发送至服务器。请注意,cookie 的值与 "Session"(会话)标签下显示的会话 ID 相同。
+
+[start=11]
+. 选择 "Cookie" 标签。在此处会看到存在一个名为 `JSESSIONID` 的 cookie,从客户端发送至服务器。请注意,cookie 的值与 "Session"(会话)标签下显示的会话 ID 相同。
image::images/cookies-tab.png[title="Cookie 显示在 HTTP 监视器中的 "]
类似地,如果单击 "Header"(标头)标签,将看到列出的 cookie,这是因为 "`Cookie`" 是客户端发送的请求标头。
image::images/headers-tab.png[title="Cookie 显示在 HTTP 监视器中的 "]
有关请求和响应标头的详细信息,请参见维基百科的 link:http://en.wikipedia.org/wiki/List_of_HTTP_headers[+HTTP 标头列表+]。
-12. 选择 "Session"(会话)标签。有一条语句表明,"The session existed before this request."(会话在此请求前已存在。)还请注意,`cart` 属性列在 "Session attributes after the request"(请求后的会话属性)下面。这是有道理的,因为我们知道在第一次处理 `addToCart` 请求时,会将 `cart` 对象绑定到会话。
+
+[start=12]
+. 选择 "Session"(会话)标签。有一条语句表明,"The session existed before this request."(会话在此请求前已存在。)还请注意,`cart` 属性列在 "Session attributes after the request"(请求后的会话属性)下面。这是有道理的,因为我们知道在第一次处理 `addToCart` 请求时,会将 `cart` 对象绑定到会话。
image::images/session-tab-add-to-cart.png[title="会话属性显示在 HTTP 监视器中的 "]
在接下来的几步中,请在 "Variables"(变量)窗口找到会话 ID 和 `JSESSIONID` cookie。
-13. 重新启用之前在 `ControllerServlet` 中设置的断点。按 Alt-Shift-5 组合键(在 Mac 上为 Ctrl-Shift-5 组合键),以打开 "Breakpoints"(断点)窗口,然后单击断点条目旁边的复选框以重新启用该断点。
-14. 在浏览器中,对列出的其中一个产品单击 "add to cart" 按钮。
-15. 切换到 IDE 并请注意,调试器在 `ControllerServlet` 中设置的断点处挂起。单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮,以便将 `session` 变量指定给会话对象。
-16. 打开 "Variables"(变量)窗口(Alt-Shift-1 组合键;在 Mac 上为 Ctrl-Shift-1 组合键),展开 "session" > "session"。此时将发现会话 ID 以 `id` 变量值的形式列出。
-17. 要找到 `JSESSIONID` cookie,请回想一下,可以通过调用 `HttpServletRequest` 上的 link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] 方法来正常访问 Servlet 中的 cookie。因此,请向下浏览到请求对象:"request" > "Inherited"(已继承)> "request" > "request" > "Inherited"(已继承)> "cookies"。在此处可以看到 `cookies` ArrayList。如果展开列表,将看到 `JSESSIONID` cookie,其值就是会话 ID。
-18. 单击 "Finish Session"(完成会话)(image::images/finish-session-btn.png[]) 按钮以终止调试会话。
+
+[start=13]
+. 重新启用之前在 `ControllerServlet` 中设置的断点。按 Alt-Shift-5 组合键(在 Mac 上为 Ctrl-Shift-5 组合键),以打开 "Breakpoints"(断点)窗口,然后单击断点条目旁边的复选框以重新启用该断点。
+
+[start=14]
+. 在浏览器中,对列出的其中一个产品单击 "add to cart" 按钮。
+
+[start=15]
+. 切换到 IDE 并请注意,调试器在 `ControllerServlet` 中设置的断点处挂起。单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮,以便将 `session` 变量指定给会话对象。
+
+[start=16]
+. 打开 "Variables"(变量)窗口(Alt-Shift-1 组合键;在 Mac 上为 Ctrl-Shift-1 组合键),展开 "session" > "session"。此时将发现会话 ID 以 `id` 变量值的形式列出。
+
+[start=17]
+. 要找到 `JSESSIONID` cookie,请回想一下,可以通过调用 `HttpServletRequest` 上的 link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] 方法来正常访问 Servlet 中的 cookie。因此,请向下浏览到请求对象:"request" > "Inherited"(已继承)> "request" > "request" > "Inherited"(已继承)> "cookies"。在此处可以看到 `cookies` ArrayList。如果展开列表,将看到 `JSESSIONID` cookie,其值就是会话 ID。
+
+[start=18]
+. 单击 "Finish Session"(完成会话)(image::images/finish-session-btn.png[]) 按钮以终止调试会话。
[[url-rewrite]]
@@ -564,34 +654,50 @@
1. 在浏览器中临时禁用 cookie。如果使用的是 Firefox,可以选择 "Tools"(工具)> "Options"(选项)(在 Mac 上为 "Firefox"(Firefox)> "Preferences"(首选项))。在显示的窗口中,选择 "Privacy"(隐私)标签,然后在 "History"(历史)下面提供的下拉列表中选择 "Use custom settings for history"(使用定制历史记录设置)。取消选择 "Accept cookies from sites"(接受自站点的 cookie)选项。
image::images/firefox.png[title="在浏览器中临时禁用 cookie"]
-2. 运行 `AffableBean` 项目。当显示欢迎页时,单击进入某个类别,然后尝试将项目添加到购物车中。将看到应用程序的功能在当前状态下被严重削弱。
+
+[start=2]
+. 运行 `AffableBean` 项目。当显示欢迎页时,单击进入某个类别,然后尝试将项目添加到购物车中。将看到应用程序的功能在当前状态下被严重削弱。
image::images/compromised.png[title="当客户端不接受 Cookie 时,应用程序的功能会被削弱"]
和以前一样,服务器生成会话并将对象绑定到该会话。这样,类别页就可以显示所选的类别和产品。但是,服务器在尝试设置 `JSESSIONID` cookie 时失败了。因此,当客户端发出第二次请求时(当用户单击 "add to cart" 时),服务器无法识别该请求所属的会话。因而服务器无法找到之前在会话中设置的任何属性,例如 `selectedCategory` 和 `categoryProducts`。这就是呈现的响应缺少由这些属性指定的信息的原因。
-3. 在编辑器中打开项目的 `category.jsp` 页。找到实现 "add to cart" 按钮的代码行(第 58 行)。`<form>` 元素的 `action` 属性决定了发送到服务器的请求。
+
+[start=3]
+. 在编辑器中打开项目的 `category.jsp` 页。找到实现 "add to cart" 按钮的代码行(第 58 行)。`<form>` 元素的 `action` 属性决定了发送到服务器的请求。
[source,java]
----
<form action="addToCart" method="post">
----
-4. 修改请求以便通过 `<c:url>` 标记来传递该请求。
+
+[start=4]
+. 修改请求以便通过 `<c:url>` 标记来传递该请求。
[source,java]
----
<form action="*<c:url value='addToCart'/>*" method="post">
----
-5. 按 Ctrl-S 组合键(在 Mac 上为 ⌘-S)将更改保存到文件。请回想一下,IDE 提供了“在保存时部署”功能,默认情况下该功能处于启用状态。这意味着任何已保存的更改将自动部署到服务器。
-6. 在浏览器中,选择其他类别以便应用程序呈现新修改的类别页。
-7. 检查该页的源代码。在 Firefox 中,可以按 Ctrl-U 组合键(在 Mac 上为 ⌘-U 组合键)。将为每一个产品显示 "add to cart" 按钮,并将其会话 ID 附加到 URL。
+
+[start=5]
+. 按 Ctrl-S 组合键(在 Mac 上为 ⌘-S)将更改保存到文件。请回想一下,IDE 提供了“在保存时部署”功能,默认情况下该功能处于启用状态。这意味着任何已保存的更改将自动部署到服务器。
+
+[start=6]
+. 在浏览器中,选择其他类别以便应用程序呈现新修改的类别页。
+
+[start=7]
+. 检查该页的源代码。在 Firefox 中,可以按 Ctrl-U 组合键(在 Mac 上为 ⌘-U 组合键)。将为每一个产品显示 "add to cart" 按钮,并将其会话 ID 附加到 URL。
[source,java]
----
<form action="addToCart*;jsessionid=4188657e21d72f364e0782136dde*" method="post">
----
-8. 对任一项目单击 "add to cart" 按钮。您将看到现在服务器可以确定请求所属的会话,并且可以正确地呈现响应。
-9. 在继续往下进行之前,请确保为浏览器重新启用 cookie。
+
+[start=8]
+. 对任一项目单击 "add to cart" 按钮。您将看到现在服务器可以确定请求所属的会话,并且可以正确地呈现响应。
+
+[start=9]
+. 在继续往下进行之前,请确保为浏览器重新启用 cookie。
再有,用户能够在应用程序(其响应需要某种形式的与会话相关的数据)中单击的每一个链接都需要进行正确地编码。有时,实现并不像上面显示的示例那样直接。例如,在单击链接时,`cart.jsp` 中使用的 "clear cart" 窗口部件当前会将 `clear` 参数设置为 `true`。
@@ -657,9 +763,13 @@
</session-timeout>
</session-config>
----
-2. 单击 "General"(常规)标签,然后在 "Session Timeout"(会话超时)字段中键入 "`10`"。
+
+[start=2]
+. 单击 "General"(常规)标签,然后在 "Session Timeout"(会话超时)字段中键入 "`10`"。
image::images/session-timeout.png[title="在 web.xml 的 "]
-3. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。
+
+[start=3]
+. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。
如果切换回 XML 视图,将看到 `<session-timeout>` 元素已经更新。
@@ -688,31 +798,51 @@
<session-timeout>*1*</session-timeout>
</session-config>
----
-2. 运行 `AffableBean` 项目。在浏览器中,单击进入某个类别页,将若干项目添加到购物车中,然后单击 "view cart"。
+
+[start=2]
+. 运行 `AffableBean` 项目。在浏览器中,单击进入某个类别页,将若干项目添加到购物车中,然后单击 "view cart"。
image::images/cart-page-session-intact.png[title="购物车页依靠会话对象显示购物车中的物品"]
-3. 至少等待整一分钟。
-4. 更新购物车页中显示的任一项目的数量。(可接受 1 到 99 之间的任何数字。)单击 "update"。服务器返回一条 HTTP 状态 500 消息。
+
+[start=3]
+. 至少等待整一分钟。
+
+[start=4]
+. 更新购物车页中显示的任一项目的数量。(可接受 1 到 99 之间的任何数字。)单击 "update"。服务器返回一条 HTTP 状态 500 消息。
image::images/glassfish-error-report.png[title="在收到对已过期会话的请求时会发生 NullPointerException"]
-5. 在 IDE 中检查 GlassFish Server 日志。打开 "Output"(输出)窗口(Ctrl-4;在 Mac 上为 ⌘-4),然后选择 "GlassFish Server" 标签。滚动至日志的底部,以查看错误的堆栈跟踪。
+
+[start=5]
+. 在 IDE 中检查 GlassFish Server 日志。打开 "Output"(输出)窗口(Ctrl-4;在 Mac 上为 ⌘-4),然后选择 "GlassFish Server" 标签。滚动至日志的底部,以查看错误的堆栈跟踪。
[.feature]
--
image::images/gf-server-output.png[role="left", link="images/gf-server-output.png"]
--
服务器日志表明在 `ControllerServlet` 中的第 184 行上发生了 `NullPointerException`。"Output"(输出)窗口形成了一个链接,指向发生异常错误的代码行。
-6. 单击该链接。将直接导航至 `ControllerServlet` 中的第 184 行。将鼠标悬停在编辑器左旁注中的错误标记上,会提供一个描述异常错误的工具提示。
+
+[start=6]
+. 单击该链接。将直接导航至 `ControllerServlet` 中的第 184 行。将鼠标悬停在编辑器左旁注中的错误标记上,会提供一个描述异常错误的工具提示。
image::images/nullpointer-exception.png[title="错误标记和工具提示指示问题的所在位置及原因"]
由于在接收到请求之前会话已过期,所以 Servlet 引擎无法将请求与其相应的会话关联起来。因此,它找不到 `cart` 对象(第 151 行)。当引擎尝试对某个值等于`空值`的变量调用方法时,最终在第 184 行中发生异常错误。
既然我们已查明了问题,让我们通过实现一个过滤器来修复此问题。
-7. 在 IDE 的工具栏中单击 "New File"(新建文件)(image::images/new-file-btn.png[]) 按钮。(也可以按 Ctrl-N 组合键;在 Mac 上按 ⌘-N 组合键。)
-8. 选择 *Web* 类别,然后选择 *Filter*(过滤器)并单击 "Next"(下一步)。
-9. 将过滤器命名为 `SessionTimeoutFilter`。在 "Packages"(包)字段中键入 `filter` 以便在创建过滤器类时将其放入新的包中。
-10. 单击 "Next"(下一步)。接受默认设置,然后单击 "Finish"(完成)”。`SessionTimeoutFilter` 的模板生成,并在编辑器中打开。
+
+[start=7]
+. 在 IDE 的工具栏中单击 "New File"(新建文件)(image::images/new-file-btn.png[]) 按钮。(也可以按 Ctrl-N 组合键;在 Mac 上按 ⌘-N 组合键。)
+
+[start=8]
+. 选择 *Web* 类别,然后选择 *Filter*(过滤器)并单击 "Next"(下一步)。
+
+[start=9]
+. 将过滤器命名为 `SessionTimeoutFilter`。在 "Packages"(包)字段中键入 `filter` 以便在创建过滤器类时将其放入新的包中。
+
+[start=10]
+. 单击 "Next"(下一步)。接受默认设置,然后单击 "Finish"(完成)”。`SessionTimeoutFilter` 的模板生成,并在编辑器中打开。
*注:*当前,在 NetBeans 6.9 中,无法使用向导设置到未在 Web 部署描述符中注册的 Servlet 的映射。(已使用 `@WebServlet` 标注注册了 `ControllerServlet`。)因此,我们将在下一步中修改生成的代码。
-11. 修改 `@WebFilter` 标注签名以使其如下所示。
+
+[start=11]
+. 修改 `@WebFilter` 标注签名以使其如下所示。
[source,java]
----
@@ -731,7 +861,9 @@
使用 Javadoc 索引搜索来提取有关 `Filter` 接口的文档。按 Shift-F1 组合键(在 Mac 上为 fn-Shift-F1),然后在搜索字段中键入 "`Filter`",并按 Enter 键。选择 "Interface in javax.servlet" 条目。Javadoc 文档将显示在下方的索引搜索工具窗格中。
-12. 将 `SessionTimeoutFilter` 的主体替换为以下内容。
+
+[start=12]
+. 将 `SessionTimeoutFilter` 的主体替换为以下内容。
[source,java]
----
@@ -765,27 +897,55 @@
}
----
-13. 按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)以修复 import 语句。(需要对 `HttpServletRequest` 和 `HttpSession` 添加导入。)另外,还可以使用编辑器提示将 `@Override` 标注添加到 `init`、`destroy` 和 `doFilter` 方法中。
+
+[start=13]
+. 按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)以修复 import 语句。(需要对 `HttpServletRequest` 和 `HttpSession` 添加导入。)另外,还可以使用编辑器提示将 `@Override` 标注添加到 `init`、`destroy` 和 `doFilter` 方法中。
在接下来的步骤中,将对项目运行调试器,然后逐步执行 `doFilter` 方法以查看该方法如何确定请求是否已被绑定到某个现有会话。
-14. 打开 "Breakpoints"(断点)窗口(Alt-Shift-5 组合键;在 Mac 上为 Ctrl-Shift-5 组合键),确保没有设置任何现有的断点。要删除断点,请右键单击该断点,然后选择 "Delete"(删除)。(如果完成了上述练习,<<http-monitor,使用 HTTP 监视器检查客户端和服务器之间的通信>>,则可能在 `ControllerServlet` 中设置了突出显示的断点。)
-15. 运行调试器。单击 IDE 主工具栏中的 "Debug Project"(调试项目)(image::images/debug-project-btn.png[]) 按钮。
-16. 当浏览器中显示欢迎页时,请选择某个类别,然后将若干项目添加到购物车中。
-17. 在 `SessionTimeoutFilter` 中尝试访问会话的 `doFilter` 方法的代码行(第 32 行)上设置一个断点。
+
+[start=14]
+. 打开 "Breakpoints"(断点)窗口(Alt-Shift-5 组合键;在 Mac 上为 Ctrl-Shift-5 组合键),确保没有设置任何现有的断点。要删除断点,请右键单击该断点,然后选择 "Delete"(删除)。(如果完成了上述练习,<<http-monitor,使用 HTTP 监视器检查客户端和服务器之间的通信>>,则可能在 `ControllerServlet` 中设置了突出显示的断点。)
+
+[start=15]
+. 运行调试器。单击 IDE 主工具栏中的 "Debug Project"(调试项目)(image::images/debug-project-btn.png[]) 按钮。
+
+[start=16]
+. 当浏览器中显示欢迎页时,请选择某个类别,然后将若干项目添加到购物车中。
+
+[start=17]
+. 在 `SessionTimeoutFilter` 中尝试访问会话的 `doFilter` 方法的代码行(第 32 行)上设置一个断点。
image::images/filter-breakpoint.png[title="对 getSession 方法设置断点"]
-18. 在浏览器中,单击 "view cart" 按钮。切换到 IDE,并注意到调试器已在断点处挂起。
+
+[start=18]
+. 在浏览器中,单击 "view cart" 按钮。切换到 IDE,并注意到调试器已在断点处挂起。
请回想一下,如果当前没有会话对象,`getSession()` 将创建一个新的会话对象。在这里,我们使用 `getSession(false)` 避免在未找到对象的情况下创建新对象。也就是说,如果会话不存在,该方法将返回`空值`。
-19. 单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮,然后将鼠标悬停在 `session` 变量上。如果自从发送上一个请求开始还没有过去一分钟,将看到该变量已被指定给 `StandardSessionFacade`。这代表请求的会话对象。
+
+[start=19]
+. 单击 "Step Over"(步过)(image::images/step-over-btn.png[]) 按钮,然后将鼠标悬停在 `session` 变量上。如果自从发送上一个请求开始还没有过去一分钟,将看到该变量已被指定给 `StandardSessionFacade`。这代表请求的会话对象。
image::images/session-exists.png[title="将鼠标悬停在变量上可确定其当前值"]
-20. 继续逐步执行该方法,直到处理请求为止。因为 `session` 不等于`空值`,所以将跳过 `if` 语句和 `chain.doFilter`,然后将请求转发到 `ControllerServlet`(第 44 行)。
-21. 在浏览器中,请确保过去整一分钟,然后更新购物车中其中一个产品项目的数量。此过程与之前在练习中返回状态 500 消息时所经历的是同一过程。既然过滤器截取了到 `ControllerServlet` 的请求标头,我们来看一下当发生会话超时时会出现什么情况。
-22. 在单击 "update" 之后,切换到 IDE 并注意到调试器再次在过滤器中设置的断点上挂起。
-23. 突出显示 `req.getSession(false)` 表达式,然后将鼠标悬停在上面。在这里看到该表达式等于`空值`,因为会话已经过期。
+
+[start=20]
+. 继续逐步执行该方法,直到处理请求为止。因为 `session` 不等于`空值`,所以将跳过 `if` 语句和 `chain.doFilter`,然后将请求转发到 `ControllerServlet`(第 44 行)。
+
+[start=21]
+. 在浏览器中,请确保过去整一分钟,然后更新购物车中其中一个产品项目的数量。此过程与之前在练习中返回状态 500 消息时所经历的是同一过程。既然过滤器截取了到 `ControllerServlet` 的请求标头,我们来看一下当发生会话超时时会出现什么情况。
+
+[start=22]
+. 在单击 "update" 之后,切换到 IDE 并注意到调试器再次在过滤器中设置的断点上挂起。
+
+[start=23]
+. 突出显示 `req.getSession(false)` 表达式,然后将鼠标悬停在上面。在这里看到该表达式等于`空值`,因为会话已经过期。
image::images/session-null.png[title="突出显示表达式,然后将鼠标悬停在表达式上以确定其当前值"]
-24. 继续逐步执行代码。既然 `session` 变量等于`空值`,则将处理第 35 行的 `if` 语句,并将请求转发到 `/index.jsp`。当调试器完成执行时,将看到浏览器显示站点的欢迎页。
-25. 单击 "Finish Session"(完成会话)(image::images/finish-session-btn.png[]) 按钮以终止调试会话。
-26. 打开项目的 `web.xml` 文件,然后将会话超时间隔重新更改为 10 分钟。
+
+[start=24]
+. 继续逐步执行代码。既然 `session` 变量等于`空值`,则将处理第 35 行的 `if` 语句,并将请求转发到 `/index.jsp`。当调试器完成执行时,将看到浏览器显示站点的欢迎页。
+
+[start=25]
+. 单击 "Finish Session"(完成会话)(image::images/finish-session-btn.png[]) 按钮以终止调试会话。
+
+[start=26]
+. 打开项目的 `web.xml` 文件,然后将会话超时间隔重新更改为 10 分钟。
[source,xml]
----
@@ -794,7 +954,9 @@
<session-timeout>*10*</session-timeout>
</session-config>
----
-27. 保存(Ctrl-S;在 Mac 上为 ⌘-S)文件。
+
+[start=27]
+. 保存(Ctrl-S;在 Mac 上为 ⌘-S)文件。
link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot6.zip[+快照 6+] 为您提供了本教程单元中已完成的项目版本。还应当提一下有关会话管理的最后一个主题。可以通过对会话对象调用 `invalidate` 方法来显式终止某个会话。如果不再需要会话,应该将其删除以便节省服务器上的可用内存。完成下一单元(link:transaction.html[+集成事务业务逻辑+])后,您将了解 `ControllerServlet` 如何在成功处理完客户订单后销毁用户的 `cart` 对象,以及如何使用 `invalidate` 方法终止会话。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/netbeans-ecommerce-tutorial.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/netbeans-ecommerce-tutorial.asciidoc.disabled
similarity index 85%
rename from netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/netbeans-ecommerce-tutorial.asciidoc
rename to netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/netbeans-ecommerce-tutorial.asciidoc.disabled
index f37ddbf..58acf76 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/netbeans-ecommerce-tutorial.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/netbeans-ecommerce-tutorial.asciidoc.disabled
@@ -40,18 +40,42 @@
* <<ide,Why use an IDE?>>
* <<netBeans,Why use NetBeans?>>
* <<seeAlsoIntro,See Also>>
-2. <<design,Designing the Application>>
-3. <<setup-dev-environ,Setting up the Development Environment>>
-4. <<data-model,Designing the Data Model>>
-5. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
-6. <<connect-db,Connecting the Application to the Database>>
-7. <<entity-session,Adding Entity Classes and Session Beans>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=2]
+. <<design,Designing the Application>>
+
+[start=3]
+. <<setup-dev-environ,Setting up the Development Environment>>
+
+[start=4]
+. <<data-model,Designing the Data Model>>
+
+[start=5]
+. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
+
+[start=6]
+. <<connect-db,Connecting the Application to the Database>>
+
+[start=7]
+. <<entity-session,Adding Entity Classes and Session Beans>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -346,17 +370,39 @@
* <<architecture,Determining the Architecture>>
* <<planning,Planning the Project>>
* <<seeAlsoDesign,See Also>>
-3. <<setup-dev-environ,Setting up the Development Environment>>
-4. <<data-model,Designing the Data Model>>
-5. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
-6. <<connect-db,Connecting the Application to the Database>>
-7. <<entity-session,Adding Entity Classes and Session Beans>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=3]
+. <<setup-dev-environ,Setting up the Development Environment>>
+
+[start=4]
+. <<data-model,Designing the Data Model>>
+
+[start=5]
+. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
+
+[start=6]
+. <<connect-db,Connecting the Application to the Database>>
+
+[start=7]
+. <<entity-session,Adding Entity Classes and Session Beans>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -404,9 +450,15 @@
* update item quantities in the shopping cart.
* view a summary of all items and quantities in the shopping cart.
* place an order and make payment through a secure checkout process.
-3. An administration console, enabling staff to view customer orders.
-4. Security, in the form of protecting sensitive customer data while it is transferred over the Internet, and preventing unauthorized access to the administration console.
-5. Language support for both English and Czech. (Website only)
+
+[start=3]
+. An administration console, enabling staff to view customer orders.
+
+[start=4]
+. Security, in the form of protecting sensitive customer data while it is transferred over the Internet, and preventing unauthorized access to the administration console.
+
+[start=5]
+. Language support for both English and Czech. (Website only)
The company staff are able to provide you with product and category images, descriptions and price details, as well as any website graphics that are to be used. The staff are also able to provide all text and language translations for the website.
@@ -732,16 +784,36 @@
* <<run,Running the Web Project>>
* <<communicate,Communicating with the Database Server>>
* <<seeAlsoSetupDevEnviron,See Also>>
-4. <<data-model,Designing the Data Model>>
-5. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
-6. <<connect-db,Connecting the Application to the Database>>
-7. <<entity-session,Adding Entity Classes and Session Beans>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=4]
+. <<data-model,Designing the Data Model>>
+
+[start=5]
+. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
+
+[start=6]
+. <<connect-db,Connecting the Application to the Database>>
+
+[start=7]
+. <<entity-session,Adding Entity Classes and Session Beans>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -778,19 +850,33 @@
1. Start the NetBeans IDE. If you are running the IDE for the first time, you will see the IDE's Start Page.
image::images/ide-start-page.png[title="The NetBeans IDE Start Page"]
-2. Click the New Project ( image::images/new-project-btn.png[] ) button (Ctrl-Shift-N; ⌘-Shift-N on Mac) to create a new Java web project. The New Project wizard opens to guide you through the process. Under Categories choose Java Web, then under Projects choose Web Application.
+
+[start=2]
+. Click the New Project ( image::images/new-project-btn.png[] ) button (Ctrl-Shift-N; ⌘-Shift-N on Mac) to create a new Java web project. The New Project wizard opens to guide you through the process. Under Categories choose Java Web, then under Projects choose Web Application.
image::images/new-project-wzd.png[title="Create a project using the New Project wizard"]
-3. Click Next.
-4. In Step 2: Name and Location, name the project `AffableBean`. In this step, you can also designate the location on your computer where the project will reside. By default, the IDE creates a `NetBeansProjects` folder in your home directory. If you'd like to change the location, enter the path in the Project Location text field.
-5. Click Next.
-6. In Step 3: Server and Settings, specify GlassFish v3 as the server to which your project will be deployed during development. Since you've included GlassFish v3 in your NetBeans installation, you'll see that GlassFish v3 is listed in the Server drop-down field.
+
+[start=3]
+. Click Next.
+
+[start=4]
+. In Step 2: Name and Location, name the project `AffableBean`. In this step, you can also designate the location on your computer where the project will reside. By default, the IDE creates a `NetBeansProjects` folder in your home directory. If you'd like to change the location, enter the path in the Project Location text field.
+
+[start=5]
+. Click Next.
+
+[start=6]
+. In Step 3: Server and Settings, specify GlassFish v3 as the server to which your project will be deployed during development. Since you've included GlassFish v3 in your NetBeans installation, you'll see that GlassFish v3 is listed in the Server drop-down field.
If you wanted to deploy to a server that isn't yet registered with the IDE, you would click the Add button, and step through the Add Server Instance wizard. You can view all servers registered with the IDE from the Servers window (Choose Tools > Servers from the main menu).
-7. For Java EE Version, select Java EE 6 Web.
+
+[start=7]
+. For Java EE Version, select Java EE 6 Web.
The application that you create makes use of various Java EE 6 features, namely servlet annotations (new in the link:http://jcp.org/en/jsr/summary?id=315[+Servlet 3.0 Specification+]), and EJBs used directly in servlet containers (new in the link:http://jcp.org/en/jsr/summary?id=318[+EJB 3.1 Specification+]). Both Servlet 3.0 and EJB 3.1 are part of the Java EE 6 platform, therefore you require an EE-6 compliant server such as GlassFish v3 to work through this tutorial. For more information, see link:entity-session.html#specification[+About Specifications and Implementations+].
-8. Make sure that the 'Enable Contexts and Dependency Injection' option is deselected. This option is specific to the Contexts and Dependency Injection (CDI) technology, specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], and is not used in this tutorial. For more information, see link:../cdi-intro.html[+Getting Started with Contexts and Dependency Injection and JSF 2.0+].
+
+[start=8]
+. Make sure that the 'Enable Contexts and Dependency Injection' option is deselected. This option is specific to the Contexts and Dependency Injection (CDI) technology, specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], and is not used in this tutorial. For more information, see link:../cdi-intro.html[+Getting Started with Contexts and Dependency Injection and JSF 2.0+].
image::images/new-project-wzd2.png[title="Specify development server, EE version, and whether to include CDI support"]
Note that by default the context path for the application is the name of the project. This is the path at which your application can be accessed after it is deployed to the server. For example, GlassFish uses 8080 as its default port number, so during development you'll be able to access the project in a browser window from:
@@ -800,12 +886,16 @@
http://localhost:8080/AffableBean/
----
-9. Click Finish. The IDE generates a skeleton project named `AffableBean` that adheres to the link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE Blueprints conventions for web application structure+]. The IDE displays various windows in its default layout.
+
+[start=9]
+. Click Finish. The IDE generates a skeleton project named `AffableBean` that adheres to the link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE Blueprints conventions for web application structure+]. The IDE displays various windows in its default layout.
[.feature]
--
image::images/ide-default-layout.png[role="left", link="images/ide-default-layout.png"]
--
-10. Examine the IDE's default layout. Here's a brief overview of the displayed windows and tabs:
+
+[start=10]
+. Examine the IDE's default layout. Here's a brief overview of the displayed windows and tabs:
* *The Editor:* The editor (Ctrl-0; ⌘-0 on Mac) is the central component of the IDE, and is likely where you'll spend most of your time. The editor automatically adapts to the language you are working in, providing documentation support, code-completion, hints and error messages specific to the technology you are coding in.
* *Projects window:* The Projects window (Ctrl-1; ⌘-1 on Mac) is the entry point to your project sources. It provides a _logical view_ of important project contents, and groups files together based on their function (e.g., `Configuration Files`). When right-clicking file nodes within the Projects window, you can call actions common to your development tasks (i.e., `Build`, `Clean`, `Deploy`, `Run`).
* *Files window:* The Files window (Ctrl-2; ⌘-2 on Mac) provides a directory-based view of your project. That is, it enables you to view the structure of your project, as it exists in your computer's file system. From this window, you can view all files pertaining to your project, including the Ant build script, (`build.xml`), and files required by the IDE to handle the project (contained in the `nbproject` folder). If you've run your project, you can see the location of compiled Java files (`build` folder). If you've explicitly built your project (by choosing Build, or Clean and Build, from the project node's right-click menu in the Projects window), you can view the project's distributable WAR file (contained in the `dist` folder).
@@ -826,12 +916,16 @@
A browser window opens to display the project's welcome page.
image::images/hello-world.png[title="Project automatically deploys to server and displays in browser"]
So what just happened? When you run a web project, the IDE invokes the `run` Ant target in your project's build script. You can investigate by opening your project's `build.xml` file in the editor.
-2. Switch to the Files window (Ctrl-2; ⌘-2 on Mac), expand the project node and double-click the `build.xml` file contained in your project. When the `build.xml` file opens in the editor, the Navigator lists all Ant targets available to the script.
+
+[start=2]
+. Switch to the Files window (Ctrl-2; ⌘-2 on Mac), expand the project node and double-click the `build.xml` file contained in your project. When the `build.xml` file opens in the editor, the Navigator lists all Ant targets available to the script.
image::images/navigator-ant-targets.png[title="The Navigator lists all available Ant targets for the build.xml script"]
Normal Ant targets are displayed using the general target ( image::images/ant-normal-icon.png[] ) icon. The _emphasized_ Ant target ( image::images/ant-emphasized-icon.png[] ) icon merely indicates that the target includes a description, which is displayed as a tooltip (as shown in the above image). For more information, see link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG366[+Creating Java Projects+] in _Developing Applications with NetBeans IDE_.
-3. Double-click the `run` target. The `build-impl.xml` file opens in the editor and displays the target definition.
+
+[start=3]
+. Double-click the `run` target. The `build-impl.xml` file opens in the editor and displays the target definition.
[source,java]
----
@@ -862,13 +956,19 @@
Consult the official link:http://ant.apache.org/manual/index.html[+Ant Manual+] for more information on using Ant.
-4. To generate a distributable WAR file for your project, choose Clean and Build Project (or Clean and Build Main Project) from the IDE's Run menu.
-5. In the Files window (Ctrl-2; ⌘-2 on Mac) expand the project node. The `dist` folder contains the project WAR file. The `build` folder contains your compiled project.
+
+[start=4]
+. To generate a distributable WAR file for your project, choose Clean and Build Project (or Clean and Build Main Project) from the IDE's Run menu.
+
+[start=5]
+. In the Files window (Ctrl-2; ⌘-2 on Mac) expand the project node. The `dist` folder contains the project WAR file. The `build` folder contains your compiled project.
image::images/files-window.png[title="Files window provides a directory-based view of your project"]
*Note:* If you _clean_ the project (In the Projects window, choose Clean from the project node's right-click menu), both of these folders are removed.
-6. Switch to the Services window (Ctrl-5; ⌘-5 on Mac) and expand the Servers > GlassFish Server 3 > Applications node.
+
+[start=6]
+. Switch to the Services window (Ctrl-5; ⌘-5 on Mac) and expand the Servers > GlassFish Server 3 > Applications node.
image::images/services-win-deployed-app.png[title="Services window displays server status, deployed applications and resources"]
*Note:* "GlassFish v3" is the default server name for NetBeans 6.8 users.
@@ -1014,20 +1114,32 @@
* *Server Port Number:* `3306`
* *Administrator User Name:* `root`
* *Administrator Password:* `nbuser`
-2. Select the Save Password option.
+
+[start=2]
+. Select the Save Password option.
image::images/mysql-server-properties.png[title="Specify MySQL server settings"]
-3. Click OK. The IDE connects to your MySQL database server, and lists database instances that are maintained by the server. If you expand the Drivers node, you can also see that the IDE contains the link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBC driver+] for MySQL.
+
+[start=3]
+. Click OK. The IDE connects to your MySQL database server, and lists database instances that are maintained by the server. If you expand the Drivers node, you can also see that the IDE contains the link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBC driver+] for MySQL.
image::images/services-win-mysql.png[title="Connect to a MySQL server in the Services window"]
The application server (i.e., GlassFish) requires the driver to enable communication between your Java code and the the MySQL database. Because the IDE already contains the Connector/J driver, you do not need to download it. Furthermore, as will later be demonstrated, you can specify in your server settings to enable JDBC driver deployment so that the driver will be automatically deployed to GlassFish if it is missing on the server.
Steps 4-7 below are optional. You can configure the IDE to start and stop the MySQL server, as well as run an external administration tool on the server.
-4. Right-click the MySQL server node and choose Properties. In the MySQL Server Properties dialog, select the Admin Properties tab.
-5. In the 'Path/URL to admin tool' field, enter the path on your computer to the executable file of a database administration tool, such as link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]. The MySQL Administrator is included in the link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+] bundle.
-6. In the 'Path to start command' field, type in the path to the MySQL start command (i.e., `mysqld` or `mysqld_safe`, depending on your operating system. (See <<start,Start the Database Server>> above.)
+
+[start=4]
+. Right-click the MySQL server node and choose Properties. In the MySQL Server Properties dialog, select the Admin Properties tab.
+
+[start=5]
+. In the 'Path/URL to admin tool' field, enter the path on your computer to the executable file of a database administration tool, such as link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]. The MySQL Administrator is included in the link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+] bundle.
+
+[start=6]
+. In the 'Path to start command' field, type in the path to the MySQL start command (i.e., `mysqld` or `mysqld_safe`, depending on your operating system. (See <<start,Start the Database Server>> above.)
*Note:* For Unix-like systems, you may find that you can only invoke the start command with root or administrative privileges. To overcome this, you can create a script (using link:http://www.nongnu.org/gksu/[+GKSu+] for Linux and Solaris, link:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/osascript.1.html[+osascript+] for Mac) that will accomplish this task. For more information, see link:http://davidvancouvering.blogspot.com/2008/09/starting-mysql-in-netbeans-as.html[+this blog post+].
-7. In the 'Path to stop command' field, enter the path to the MySQL stop command (i.e., `mysqladmin shutdown`). Because the command requires a user account with shutdown privileges, you must enter username/password credentials in the Arguments field. For example:
+
+[start=7]
+. In the 'Path to stop command' field, enter the path to the MySQL stop command (i.e., `mysqladmin shutdown`). Because the command requires a user account with shutdown privileges, you must enter username/password credentials in the Arguments field. For example:
* *Arguments:* `-u root -pnbuser shutdown`
After you have set the fields listed under the Advanced Properties tab, you can:
@@ -1043,11 +1155,15 @@
1. Create the database instance which you will use in this tutorial. To do so, right-click the MySQL Server node and choose Create Database.
2. In the dialog that displays, type in `affablebean`. Select the 'Grant Full Access to' option, then select `root@localhost` from the drop-down field. This enables the `root` account on the `localhost` host access to the database. Later, when you create a connection pool on the server, you'll need to provide the `root` account and `nbuser` password as username/password credentials in order to grant the server access to the database.
image::images/create-mysql-db-dialog.png[title="Right-click the server node and choose Create Database to create a new database instance"]
-3. Click OK. When you do so, the database named `affablebean` is created, and a connection to the database is automatically established. Connections are displayed in the Services window using a connection node ( image::images/db-connection-node.png[] ).
+
+[start=3]
+. Click OK. When you do so, the database named `affablebean` is created, and a connection to the database is automatically established. Connections are displayed in the Services window using a connection node ( image::images/db-connection-node.png[] ).
*Note:* Connection nodes are persisted in the Services window. If you restart the IDE, the connection node displays with a jagged line ( image::images/connection-broken.png[] ), indicating that the connection is broken. To reconnect to a database, make sure that the database server is running, then right-click the node and choose Connect.
-4. Expand the connection node for the `affablebean` database. The connection contains the database's default schema (`affablebean`), and within that are nodes for tables, views, and procedures. Currently these are empty since we haven't created anything yet.
+
+[start=4]
+. Expand the connection node for the `affablebean` database. The connection contains the database's default schema (`affablebean`), and within that are nodes for tables, views, and procedures. Currently these are empty since we haven't created anything yet.
image::images/db-conn-affable-bean.png[title="Database connections contain the database's default schema and nodes for tables, views and procedures"]
At this stage, you've connected to the MySQL server from the IDE and have created a new database named `affablebean` which you'll use throughout the tutorial. Also, you've created a Java web project in the IDE, and have confirmed that it can be successfully built and deployed to your development server, and opened in a browser when run. Now that your development environment is ready, you can begin drafting the application's data model.
@@ -1116,15 +1232,33 @@
* <<forwardEngineer,Forward-Engineering to the Database>>
* <<connectDB,Connecting to the Database from the IDE>>
* <<seeAlsoDataModel,See Also>>
-5. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
-6. <<connect-db,Connecting the Application to the Database>>
-7. <<entity-session,Adding Entity Classes and Session Beans>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=5]
+. <<page-views-controller,Preparing the Page Views and Controller Servlet>>
+
+[start=6]
+. <<connect-db,Connecting the Application to the Database>>
+
+[start=7]
+. <<entity-session,Adding Entity Classes and Session Beans>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -1220,7 +1354,9 @@
--
image::images/workbench.png[role="left", link="images/workbench.png"]
--
-2. Enter the following settings for the new schema:
+
+[start=2]
+. Enter the following settings for the new schema:
* *Schema Name:* `affablebean`
* *Default Collation:* `utf8 - utf8_unicode_ci`
* *Comments:* `Schema used with the AffableBean application`
@@ -1242,13 +1378,19 @@
--
image::images/workbench-empty-canvas.png[role="left", link="images/workbench-empty-canvas.png"]
--
-2. Click the New Table ( image::images/wb-new-table-icon.png[] ) icon located in the left margin, then hover your mouse onto the canvas and click again. A new table displays on the canvas.
+
+[start=2]
+. Click the New Table ( image::images/wb-new-table-icon.png[] ) icon located in the left margin, then hover your mouse onto the canvas and click again. A new table displays on the canvas.
image::images/wb-new-entity-table.png[title="Click the New Table icon to drag empty tables (entities) onto the canvas"]
-3. Double-click the table. The Table editor opens in the bottom region of the interface, allowing you to configure settings for the table.
+
+[start=3]
+. Double-click the table. The Table editor opens in the bottom region of the interface, allowing you to configure settings for the table.
*Note:* The terms 'table' and 'entity' are nearly synonymous in this tutorial unit. From the point of view of a database schema, you are creating tables. From a data modeling perspective, you are creating entities. Likewise, the columns that you later create for each table correspond to entity _properties_.
-4. In the Table editor, rename the table to one of the nouns you identified from the use-case above. Optionally add a comment describing the purpose of the table. For example:
+
+[start=4]
+. In the Table editor, rename the table to one of the nouns you identified from the use-case above. Optionally add a comment describing the purpose of the table. For example:
* *Name:* `customer`
* *Engine:* `InnoDB`
* *Comments:* `maintains customer details`
@@ -1259,12 +1401,16 @@
The link:http://www.innodb.com/[+InnoDB+] engine provides foreign key support, which is utilized in this tutorial. Later, under <<forwardEngineer,Forward-Engineering to the Database>>, you set the default storage engine used in Workbench to InnoDB.
-5. Under the *Catalog* tab in the left region of WorkBench (right region for version 5.1), expand the `affablebean` > `Tables` node. The *customer* table now displays.
+
+[start=5]
+. Under the *Catalog* tab in the left region of WorkBench (right region for version 5.1), expand the `affablebean` > `Tables` node. The *customer* table now displays.
image::images/wb-catalog-tab.png[title="Catalog tab automatically refreshes to display any changes to the schema"]
More importantly, note that the new `customer` table is now included in the `affablebean` schema. Because the `affablebean` schema was selected when you created the new EER diagram, any changes you make to the diagram are automatically bound to the schema.
-6. Repeat steps 2 - 4 above to add tables to the canvas for the remaining <<nounList,nouns you identified in the use-case above>>. Before naming your tables however, there is one important consideration which you should take into account. Certain keywords hold special meaning for the SQL dialect used by the MySQL server. Unfortunately, '`order`' is one of them. (For example, '`order`' can be used in an `ORDER BY` statement.) Therefore, instead of naming your table '`order`', name it '`customer_order`' instead. At this stage, don't worry about arranging the tables on the canvas in any special order.
+
+[start=6]
+. Repeat steps 2 - 4 above to add tables to the canvas for the remaining <<nounList,nouns you identified in the use-case above>>. Before naming your tables however, there is one important consideration which you should take into account. Certain keywords hold special meaning for the SQL dialect used by the MySQL server. Unfortunately, '`order`' is one of them. (For example, '`order`' can be used in an `ORDER BY` statement.) Therefore, instead of naming your table '`order`', name it '`customer_order`' instead. At this stage, don't worry about arranging the tables on the canvas in any special order.
For a list of reserved words used by the MySQL server, refer to the official manual: link:http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-1.html[+2.2. Reserved Words in MySQL 5.1+].
@@ -1292,7 +1438,9 @@
|`id` |`INT` |✓ |✓ |✓ |✓
|===
image::images/customer-id-column.png[title="Click to edit table columns in the Table editor"]
-3. Continue working in the `customer` table by adding the following `VARCHAR` columns. These columns should be self-explanatory, and represent data that would need to be captured for the Affable Bean business to process a customer order and send a shipment of groceries to the customer address.
+
+[start=3]
+. Continue working in the `customer` table by adding the following `VARCHAR` columns. These columns should be self-explanatory, and represent data that would need to be captured for the Affable Bean business to process a customer order and send a shipment of groceries to the customer address.
|===
|Column |Datatype |NN (Not Null)
@@ -1312,11 +1460,15 @@
[tips]#For an explanation of the `VARCHAR` data type, see the MySQL Reference Manual: link:http://dev.mysql.com/doc/refman/5.1/en/char.html[+10.4.1. The CHAR and VARCHAR Types+].#
image::images/customer-varchar-columns.png[title="Edit inline to add columns to customer table"]
-4. With the `customer` table selected on the canvas, choose Arrange > Reset Object Size to resize the table so that all columns are visible on the canvas. Also click the Indexes row so that any table indexes are also visible. (This includes primary and foreign keys, which becomes useful when you begin creating relationships between tables later in the exercise.)
+
+[start=4]
+. With the `customer` table selected on the canvas, choose Arrange > Reset Object Size to resize the table so that all columns are visible on the canvas. Also click the Indexes row so that any table indexes are also visible. (This includes primary and foreign keys, which becomes useful when you begin creating relationships between tables later in the exercise.)
When you finish, the `customer` entity looks as follows.
image::images/customer-table.png[title="'customer' table on EER canvas displays columns"]
-5. Follow the steps outlined above to create columns for the remaining tables.
+
+[start=5]
+. Follow the steps outlined above to create columns for the remaining tables.
==== category
@@ -1398,17 +1550,29 @@
Since foreign keys must be of the same data type as the columns they reference, notice that `category_id` is of type `TINYINT`, similar to the `category` table's primary key.
[tips]#The entity-relationship diagram in this tutorial uses link:http://en.wikipedia.org/wiki/Entity-relationship_model#Crow.27s_Foot_Notation[+Crow's Foot+] notation. You can alter the relationship notation in WorkBench by choosing Model > Relationship Notation.#
-3. Double-click the relationship (i.e., click the dashed line between the two entities). The Relationship editor opens in the bottom region of the interface.
-4. Change the default caption to '`belongs to`'. In other words, "product x belongs to category y." Note that this is a _unidirectional_ relationship: A `product` object contains a reference to the category it belongs to, but the related `category` object does not contain any references to the products it contains.
-5. Click the Foreign Key tab in the Relationship editor. You see the following display.
+
+[start=3]
+. Double-click the relationship (i.e., click the dashed line between the two entities). The Relationship editor opens in the bottom region of the interface.
+
+[start=4]
+. Change the default caption to '`belongs to`'. In other words, "product x belongs to category y." Note that this is a _unidirectional_ relationship: A `product` object contains a reference to the category it belongs to, but the related `category` object does not contain any references to the products it contains.
+
+[start=5]
+. Click the Foreign Key tab in the Relationship editor. You see the following display.
image::images/foreign-key-tab.png[title="Use the Foreign Key tab to modify a relationship's ordinality and cardinality"]
Under the Foreign key tab, you can modify a relationship's:
* *cardinality:* whether the relationship between two objects is _one-to-one_ or _one-to-many_.
* *ordinality:* whether a reference between entities must exist in order to maintain the integrity of the model. (Toggle the Mandatory checkbox for either side.)
* *type:* (i.e., _identifying_ or _non-identifying_). A non-identifying relationship, such as this one, refers to the fact that the child object (`product`) can be identified independently of the parent (`category`). An identifying relationship means that the child cannot be uniquely identified without the parent. An example of this is demonstrated later, when you create a many-to-many relationship between the `product` and `order` tables.
-6. Click the 1:n Non-Identifying Relationship ( image::images/one-many-btn.png[] ) button. In the following steps, you create a _one-to-many_ relationship between the `customer` and `customer_order` objects.
-7. Click the `order` table first (this table will contain the foreign key), then click the `customer` table. A relationship is formed between the two tables.
-8. Click the link between the two tables, and in the Relationship editor that displays, change the default caption to '`is placed by`'. The relationship now reads, "customer order x is placed by customer y."
+
+[start=6]
+. Click the 1:n Non-Identifying Relationship ( image::images/one-many-btn.png[] ) button. In the following steps, you create a _one-to-many_ relationship between the `customer` and `customer_order` objects.
+
+[start=7]
+. Click the `order` table first (this table will contain the foreign key), then click the `customer` table. A relationship is formed between the two tables.
+
+[start=8]
+. Click the link between the two tables, and in the Relationship editor that displays, change the default caption to '`is placed by`'. The relationship now reads, "customer order x is placed by customer y."
image::images/order-customer-relationship.png[title="A one-to-many relationship is defined between the customer and order objects"]
You can click and drag tables on the canvas into whatever position makes the most sense for your model. In the image above, the `order` table has been moved to the left of `customer`.
@@ -1430,16 +1594,26 @@
Recall that an _identifying relationship_ means that the child cannot be uniquely identified without the parent. Identifying relationships are indicated on the Workbench canvas by a solid line linking two tables. Here, the `customer_order_has_product` table forms an identifying relationship with its two parent tables, `customer_order` and `product`. A record contained in the `customer_order_has_product` table requires references from both tables in order to exist.
-3. Arrange the tables according to the following image. The _many-to-many_ relationship is highlighted below.
+
+[start=3]
+. Arrange the tables according to the following image. The _many-to-many_ relationship is highlighted below.
image::images/many-to-many-order-product.png[title="The 'customer_order_has_product' table contains two foreign keys to the order and product tables"]
The new `customer_order_has_product` table contains two foreign keys, `fk_customer_order_has_product_customer_order` and `fk_customer_order_has_product_product`, which reference the primary keys of the `customer_order` and `product` tables, respectively. These two foreign keys form a composite primary key for the `customer_order_has_product` table.
-4. Change the name of the new `customer_order_has_product` table to '`ordered_product`'. Double-click the `customer_order_has_product` table to open the Table editor. Enter `ordered_product` into the Name field.
-5. Rename the foreign key indexes to correspond to the new table name. In the `ordered_product`'s Table editor, click the Foreign Keys tab. Then, click into both foreign key entries and replace '`customer_order_has_product`' with '`ordered_product`'. When you finish, the two entries should read:
+
+[start=4]
+. Change the name of the new `customer_order_has_product` table to '`ordered_product`'. Double-click the `customer_order_has_product` table to open the Table editor. Enter `ordered_product` into the Name field.
+
+[start=5]
+. Rename the foreign key indexes to correspond to the new table name. In the `ordered_product`'s Table editor, click the Foreign Keys tab. Then, click into both foreign key entries and replace '`customer_order_has_product`' with '`ordered_product`'. When you finish, the two entries should read:
* `fk_*ordered_product*_customer_order`
* `fk_*ordered_product*_product`
image::images/ordered-product-foreign-key.png[title="Rename the foreign key indexes under the Foreign Keys tab in the Table editor"]
-6. Double-click the lines between the two objects and delete the default captions in the Relationship editor.
-7. Create a `quantity` column in the `ordered_product` table. To do so, click the Columns tab in the `ordered_product`'s Table editor. Enter the following details.
+
+[start=6]
+. Double-click the lines between the two objects and delete the default captions in the Relationship editor.
+
+[start=7]
+. Create a `quantity` column in the `ordered_product` table. To do so, click the Columns tab in the `ordered_product`'s Table editor. Enter the following details.
|===
|Column |Datatype |NN (Not Null) |UN (Unsigned) |Default
@@ -1466,13 +1640,23 @@
1. Set the default storage engine used in Workbench to InnoDB. Choose Tools > Options (MySQLWorkbench > Preferences on Mac) to open the Workbench Preferences window. Click the MySQL tab, then select InnoDB as the default storage engine.
image::images/inno-db.png[title="Set the default storage engine to InnoDB"]
The link:http://www.innodb.com/[+InnoDB+] engine provides foreign key support, which is utilized in this tutorial.
-2. Click OK to exit the Preferences window.
-3. Choose Database > Forward Engineer from the main menu.
-4. In the first panel of the Forward Engineer to Database wizard, select '`DROP Objects Before Each CREATE Object`', and '`Generate DROP SCHEMA`'.
+
+[start=2]
+. Click OK to exit the Preferences window.
+
+[start=3]
+. Choose Database > Forward Engineer from the main menu.
+
+[start=4]
+. In the first panel of the Forward Engineer to Database wizard, select '`DROP Objects Before Each CREATE Object`', and '`Generate DROP SCHEMA`'.
image::images/forward-engineer-wzd.png[title="Enable DROP options to be generated in the SQL script"]
These `DROP` options are convenient for prototyping - if you need to make changes to the schema or schema tables, the script will first delete (i.e., _drop_) these items before recreating them. (If you attempt to create items on the MySQL server that already exist, the server will flag an error.)
-5. Click Continue. In Select Objects to Forward Engineer panel, note that the Export MySQL Table Objects option is selected by default. Click the Show Filter button and note that all five tables in the `affablebean` schema are included.
-6. Click Continue. In the Review SQL Script panel, you can examine the SQL script that has been generated based on the data model. Optionally, click Save to File to save the script to a location on your computer.
+
+[start=5]
+. Click Continue. In Select Objects to Forward Engineer panel, note that the Export MySQL Table Objects option is selected by default. Click the Show Filter button and note that all five tables in the `affablebean` schema are included.
+
+[start=6]
+. Click Continue. In the Review SQL Script panel, you can examine the SQL script that has been generated based on the data model. Optionally, click Save to File to save the script to a location on your computer.
*Note:* In examining the script, you may notice that the following variables are set at the top of the file:
@@ -1487,14 +1671,20 @@
For an explanation of what these variables are, and their purpose in the script, see the official Workbench manual: link:http://dev.mysql.com/doc/workbench/en/workbench-faq.html[+Chapter 11. MySQL Workbench FAQ+].
-7. Click Continue. In the Connection Options panel, set the parameters for connecting to the running MySQL server.
+
+[start=7]
+. Click Continue. In the Connection Options panel, set the parameters for connecting to the running MySQL server.
* *Hostname:* `127.0.0.1` (_or `localhost`_)
* *Port:* `3306`
* *Username:* `root`
* *Password:* `nbuser`
(The parameters you set should correspond to those from link:setup-dev-environ.html#communicate[+Setting up the Development Environment: Communicating with the Database Server+].)
-8. Click Execute. In the final panel of the wizard, you receive confirmation that the wizard was able to connect to and execute the script successfully.
-9. Click Close to exit the wizard.
+
+[start=8]
+. Click Execute. In the final panel of the wizard, you receive confirmation that the wizard was able to connect to and execute the script successfully.
+
+[start=9]
+. Click Close to exit the wizard.
The `affablebean` schema is now created and exists on your MySQL server. In the next step, you connect to the schema, or _database_, from the IDE. At this stage you may ask, "What's the difference between a schema and a database?" In fact, the MySQL command `CREATE SCHEMA` is a synonym for `CREATE DATABASE`. (See link:http://dev.mysql.com/doc/refman/5.1/en/create-database.html[+12.1.10. CREATE DATABASE Syntax+].) Think of a schema as a blueprint that defines the contents of the database, including tables, relationships, views, etc. A database implements the schema by containing data in a way that adheres to the structure of the schema. This is similar to the object-oriented world of Java classes and objects. A class defines an object. When a program runs however, objects (i.e., class instances) are created, managed, and eventually destroyed as the program runs its course.
@@ -1580,14 +1770,30 @@
* <<controller,Creating the Controller Servlet>>
* <<implement,Implementing the Controller Servlet>>
* <<seeAlsoPageViewsController,See Also>>
-6. <<connect-db,Connecting the Application to the Database>>
-7. <<entity-session,Adding Entity Classes and Session Beans>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=6]
+. <<connect-db,Connecting the Application to the Database>>
+
+[start=7]
+. <<entity-session,Adding Entity Classes and Session Beans>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -1695,7 +1901,9 @@
</div>*
</body>
----
-3. Add a reference to the stylesheet in the page's head, and change the title text.
+
+[start=3]
+. Add a reference to the stylesheet in the page's head, and change the title text.
[source,xml]
----
@@ -1706,7 +1914,9 @@
<title>*The Affable Bean*</title>
</head>
----
-4. Open the `affablebean.css` stylesheet in the editor. Begin creating style rules for the `<div>` IDs you just created.
+
+[start=4]
+. Open the `affablebean.css` stylesheet in the editor. Begin creating style rules for the `<div>` IDs you just created.
* Use the `width` and `height` properties to create space for each area.
* Use the `background` property to discern the areas when you view the page.
* In order to horizontally center the four areas in the page, you can include `margin: 20px auto` to the `body` rule. (`20px` applies to the top and bottom; `auto` creates equal spacing to the left and right.) Then include `float: left` to the left and right columns.
@@ -1749,9 +1959,13 @@
background: #eee;
}
----
-5. Click the Run Project ( image::images/run-project-btn.png[] ) button in the IDE's main toolbar. Project files that contain changes are automatically saved, any Java code in the project compiles, the project is packaged and deployed to GlassFish, and your browser opens to display the current state of the welcome page.
+
+[start=5]
+. Click the Run Project ( image::images/run-project-btn.png[] ) button in the IDE's main toolbar. Project files that contain changes are automatically saved, any Java code in the project compiles, the project is packaged and deployed to GlassFish, and your browser opens to display the current state of the welcome page.
image::images/index-page.png[title="Run the project to view the current state of pages"]
-6. Now, begin creating placeholders for page components within each of the four visible areas. Start with the header. Reviewing the link:design.html#index[+welcome page mockup+], the header should contain the following components:
+
+[start=6]
+. Now, begin creating placeholders for page components within each of the four visible areas. Start with the header. Reviewing the link:design.html#index[+welcome page mockup+], the header should contain the following components:
* logo
* logo text
* shopping cart widget
@@ -1799,7 +2013,9 @@
You can also take advantage of numerous keyboard shortcuts. Choose Help > Keyboard Shortcuts Card from the main menu.
-7. In the stylesheet, create rules for the new IDs and classes. Add the following rules beneath the `header` rule. (New code shown in *bold*.)
+
+[start=7]
+. In the stylesheet, create rules for the new IDs and classes. Add the following rules beneath the `header` rule. (New code shown in *bold*.)
[source,java]
----
@@ -1849,7 +2065,9 @@
To see how a property is affecting your page, you can comment it out, then refresh the page in the browser. To comment out code, position your cursor on a line, or highlight a block of code, then press Ctrl-/ (⌘-/ on Mac).
-8. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
+
+[start=8]
+. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
*Note:* The IDE's 'Deploy on Save' facility is automatically activated for Java web projects. This means that every time you save a file, the file is automatically compiled (i.e., if it is a Java class or JSP page) and the project is newly packaged and deployed to your server. Therefore, when you make HTML or CSS changes, you don't need to explicitly rerun the project to view the updated version in a browser. Simply save your file(s), then switch to the browser and refresh the page.
@@ -1859,7 +2077,9 @@
2. Create a set of styles to define the appearance.
3. View the page to examine the results of your changes.
Following these three steps, let's implement the components in the remaining areas.
-9. Create placeholders for components in the right column. According to the link:design.html#index[+welcome page mockup+], the right column contains four evenly-spaced boxes.
+
+[start=9]
+. Create placeholders for components in the right column. According to the link:design.html#index[+welcome page mockup+], the right column contains four evenly-spaced boxes.
Create the structure for the four boxes. Insert the following code between the `<div id="indexRightColumn">` tags. (New code shown in *bold*.)
@@ -1889,7 +2109,9 @@
</div>*
</div>
----
-10. Add style rules to `affablebean.css` for the new `categoryBox` and `categoryLabelText` classes. (New code shown in *bold*.)
+
+[start=10]
+. Add style rules to `affablebean.css` for the new `categoryBox` and `categoryLabelText` classes. (New code shown in *bold*.)
[source,java]
----
@@ -1929,9 +2151,13 @@
Like the CSS Preview, the Style Builder is synchronized with the editor. When you make a selection in the Style Builder, the style rule is automatically updated in the editor. Likewise, when you type changes into the editor, the selections in the Style Builder are instantly updated.
-11. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
+
+[start=11]
+. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
image::images/index-page3.png[title="Placeholders for header and right-column are visible when running project"]
-12. The left column and footer only require placeholders for static text, so let's implement both simultaneously.
+
+[start=12]
+. The left column and footer only require placeholders for static text, so let's implement both simultaneously.
Insert the following code between the `<div id="indexLefttColumn">` and `<div id="footer">` tags. (New code shown in *bold*.)
@@ -1951,7 +2177,9 @@
<p id="footerText">[ footer text ]</p>*
</div>
----
-13. Make changes to the `affablebean.css` stylesheet. It's not necessary to account for all new IDs and classes - you can fine-tune the appearance at a later point when you receive text and images from the customer.
+
+[start=13]
+. Make changes to the `affablebean.css` stylesheet. It's not necessary to account for all new IDs and classes - you can fine-tune the appearance at a later point when you receive text and images from the customer.
The horizontal rule (`<hr>`) tag runs the full length of its containing element (`<div id="footer"`). Therefore, to shorten it in accordance with the mockup image, you can adjust the width of `<div id="footer">`. (New code shown in *bold*.)
@@ -1973,7 +2201,9 @@
width: 300px;
}*
----
-14. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
+
+[start=14]
+. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
image::images/index-page4.png[title="Placeholders for left column and footer are visible"]
The welcome page is complete. You've created all necessary placeholders for components that will exist on the page.
@@ -2076,13 +2306,17 @@
Menu items provided by the IDE are often context-sensitive. For example, because you right-clicked the WEB-INF node, when the New Folder wizard displayed, `web/WEB-INF` was automatically entered in the Parent Folder field. Likewise, when you right-click a node in the Projects window and choose New, the list of file types is partially determined by your previous selections.
-3. Create two JSP segments: `header.jspf` and `footer.jspf`. To do so, right-click the newly created `jspf` folder and choose New > JSP. In the New JSP wizard, enter the file name, and under Options, select the Create as a JSP Segment option, then click Finish.
+
+[start=3]
+. Create two JSP segments: `header.jspf` and `footer.jspf`. To do so, right-click the newly created `jspf` folder and choose New > JSP. In the New JSP wizard, enter the file name, and under Options, select the Create as a JSP Segment option, then click Finish.
When you finish, you'll see `header.jspf` and `footer.jspf` displayed in your Projects window:
image::images/projects-win-jspf.png[title="Header and footer JSP fragments are displayed in the project"]
Now, you can copy the header code from any of the JSP pages and paste it into the `header.jspf` file. Likewise, you can copy the footer code from any of the JSP pages and paste it into the `footer.jspf` file. When you finish this task, you can remove the header and footer code from all of the JSP pages.
-4. Copy the header code from any of the JSP pages and paste it into the `header.jspf` file. The header should include the page doctype and the opening `<html>`, `<head>`, and `<body>` tags through to the closing tag for the `<div id="header">` element. Be sure to include placeholders for the shopping cart widget, language toggle, and 'proceed to checkout' button used along the top of page views. After you paste code into `header.jspf`, the file will look as follows.
+
+[start=4]
+. Copy the header code from any of the JSP pages and paste it into the `header.jspf` file. The header should include the page doctype and the opening `<html>`, `<head>`, and `<body>` tags through to the closing tag for the `<div id="header">` element. Be sure to include placeholders for the shopping cart widget, language toggle, and 'proceed to checkout' button used along the top of page views. After you paste code into `header.jspf`, the file will look as follows.
[source,html]
----
@@ -2123,7 +2357,9 @@
<img src="#" id="logoText" alt="the affable bean">
</div>
----
-5. Copy the footer code from any of the JSP pages and paste it into the `footer.jspf` file. The footer code should include the `<div id="footer">` element, through to the closing `<html>` tag. After you paste code into `footer.jspf`, the file will look as follows.
+
+[start=5]
+. Copy the footer code from any of the JSP pages and paste it into the `footer.jspf` file. The footer code should include the `<div id="footer">` element, through to the closing `<html>` tag. After you paste code into `footer.jspf`, the file will look as follows.
[source,html]
----
@@ -2136,7 +2372,9 @@
</body>
</html>
----
-6. Remove the header and footer code from all five JSP pages (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp`, and `confirmation.jsp`).
+
+[start=6]
+. Remove the header and footer code from all five JSP pages (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp`, and `confirmation.jsp`).
@@ -2150,12 +2388,22 @@
3. Click Finish. The `web.xml` file is created and added to the project. The IDE's graphical interface for the deployment descriptor opens in the editor.
The interface is categorized by the areas that can be configured in a web application. These areas are displayed as tabs in the editor toolbar, and include topics such as Servlets, Filters, References, and Security. The XML tab displays the entire source code for the file. Any changes you make in the graphical interface will cause immediate updates to the deployment descriptor's source code, which you can verify by switching to the XML tab. This is demonstrated in the following steps.
-4. Click the Pages tab, then click the Add JSP Property Group button. The Add JSP Property Group dialog opens.
-5. Type in '`header and footer settings`' for the Description field. Leave Display Name blank. Both the Display Name and Description fields are optional.
-6. For URL Patterns, specify the paths to the five views. Type in '`/index.jsp`' and '`/WEB-INF/view/*`'. Separate the two paths with a comma. (The '`*`' is a wildcard that represents all files within the given folder.)
+
+[start=4]
+. Click the Pages tab, then click the Add JSP Property Group button. The Add JSP Property Group dialog opens.
+
+[start=5]
+. Type in '`header and footer settings`' for the Description field. Leave Display Name blank. Both the Display Name and Description fields are optional.
+
+[start=6]
+. For URL Patterns, specify the paths to the five views. Type in '`/index.jsp`' and '`/WEB-INF/view/*`'. Separate the two paths with a comma. (The '`*`' is a wildcard that represents all files within the given folder.)
image::images/add-jsp-prop-group-dialog.png[title="Use the Add JSP Property Group dialog to specify <jsp-config> tags in the deployment descriptor"]
-7. Click OK. An entry is added to the JSP Properties Groups category in the Pages tab.
-8. Switch back to the XML tab. Notice that the following code has been added to the deployment descriptor.
+
+[start=7]
+. Click OK. An entry is added to the JSP Properties Groups category in the Pages tab.
+
+[start=8]
+. Switch back to the XML tab. Notice that the following code has been added to the deployment descriptor.
[source,xml]
----
@@ -2171,12 +2419,16 @@
*Note:* You may need to add carriage returns to the code so that it displays on multiple lines. You can right-click in the editor and choose Format (Alt-Shift-F; Ctrl-Shift-F on Mac) to have the code properly indented.
-9. Switch to the Pages tab again, and in the Include Preludes and Include Codas fields, enter the paths to the `header.jspf` and `footer.jspf` files, respectively. You can click the Browse button and navigate to the files in the provided dialog.
+
+[start=9]
+. Switch to the Pages tab again, and in the Include Preludes and Include Codas fields, enter the paths to the `header.jspf` and `footer.jspf` files, respectively. You can click the Browse button and navigate to the files in the provided dialog.
[.feature]
--
image::images/jsp-prop-groups-small.png[role="left", link="images/jsp-prop-groups.png"]
--
-10. Switch back to the XML tab. Note that the following code has been added. (Changes in *bold*.)
+
+[start=10]
+. Switch back to the XML tab. Note that the following code has been added. (Changes in *bold*.)
[source,xml]
----
@@ -2195,7 +2447,9 @@
To view the definitions of the above tags, as well as all tags available to you in the web deployment descriptor, consult the link:http://jcp.org/en/jsr/detail?id=315[+Servlet Specification+].
-11. Run the application again (press F6; fn-F6 on Mac). You've already removed the header and footer code from the `index.jsp` file, so you can determine whether it is automatically being added when the file is requested.
+
+[start=11]
+. Run the application again (press F6; fn-F6 on Mac). You've already removed the header and footer code from the `index.jsp` file, so you can determine whether it is automatically being added when the file is requested.
You will see that the <<welcome-page,welcome page displays as it did previously>>, with header and footer content included.
@@ -2212,7 +2466,9 @@
2. In the wizard, type `ControllerServlet` in the Class Name field.
3. In the Package field, type `controller`. (The new package is automatically created when you complete the wizard.)
image::images/servlet-wizard.png[title="Use the Servlet wizard to create servlets for your project"]
-4. Click Next. Step 3 of the wizard lets you configure the servlet. Of primary importance are the URL patterns that you need to specify. The patterns identify the URLs that invoke the servlet. For example, if you enter '`/category`', you are directing the servlet to handle a request that appears as follows.
+
+[start=4]
+. Click Next. Step 3 of the wizard lets you configure the servlet. Of primary importance are the URL patterns that you need to specify. The patterns identify the URLs that invoke the servlet. For example, if you enter '`/category`', you are directing the servlet to handle a request that appears as follows.
[source,java]
----
@@ -2220,9 +2476,13 @@
http://localhost/AffableBean*/category*
----
The URL patterns should correspond to the views and actions that a user can initiate. Looking at the link:design.html#index[+welcome page mockup+], a user should be able to select a category. We can therefore associate the `/category` URL with the action of clicking on a category image. Likewise, in the link:design.html#category[+category page+], users should be able to add an item to the shopping cart. We can therefore specify `/addToCart`.
-5. In the URL Pattern(s) field, type in '`/category, /addToCart, /viewCart`'. Patterns are separated by commas. You can add more patterns directly in the servlet class once it's created.
+
+[start=5]
+. In the URL Pattern(s) field, type in '`/category, /addToCart, /viewCart`'. Patterns are separated by commas. You can add more patterns directly in the servlet class once it's created.
image::images/servlet-wizard2.png[title="Configure servlet deployment directly in the wizard"]
-6. Click Finish. The IDE generates the `ControllerServlet` and opens it in the editor. The servlet and URL patterns are included in the `@WebServlet` annotation that appears above the class signature.
+
+[start=6]
+. Click Finish. The IDE generates the `ControllerServlet` and opens it in the editor. The servlet and URL patterns are included in the `@WebServlet` annotation that appears above the class signature.
[source,java]
----
@@ -2252,7 +2512,9 @@
<url-pattern>/viewCart</url-pattern>
</servlet-mapping>
----
-7. Add other URL patterns directly to the `@WebServlet` annotation's `urlPatterns` element. The application requires more URL patterns for other actions and views. You can type in the following patterns:
+
+[start=7]
+. Add other URL patterns directly to the `@WebServlet` annotation's `urlPatterns` element. The application requires more URL patterns for other actions and views. You can type in the following patterns:
* `/updateCart`
* `/checkout`
* `/purchase`
@@ -2271,7 +2533,9 @@
"/purchase",
"/chooseLanguage"*})
----
-8. Finally, include the `loadOnStartup` element so that the servlet is instantiated and initialized when the application is deployed. A value of `0` or greater will cause this to happen (`-1` is the default).
+
+[start=8]
+. Finally, include the `loadOnStartup` element so that the servlet is instantiated and initialized when the application is deployed. A value of `0` or greater will cause this to happen (`-1` is the default).
[source,java]
----
@@ -2306,8 +2570,12 @@
1. Open the Template Manager by choosing Tools > Templates from the main menu.
2. Expand the Web category, then select the Servlet template.
image::images/template-manager.png[title="Access and modify file templates via the Template Manager"]
-3. Click the Open in Editor button.
-4. Modify the template in the editor. The next time you create a new servlet (e.g., using the Servlet wizard), the new version will be applied.
+
+[start=3]
+. Click the Open in Editor button.
+
+[start=4]
+. Modify the template in the editor. The next time you create a new servlet (e.g., using the Servlet wizard), the new version will be applied.
@@ -2404,7 +2672,9 @@
}
----
As you continue through the tutorial, you'll return to the `ControllerServlet` and implement each of the mapped URL patterns individually.
-2. Examine the code above. There are several points to note:
+
+[start=2]
+. Examine the code above. There are several points to note:
* The servlet uses a `userPath` instance variable to get the requested URL pattern from the client:
[source,java]
@@ -2443,7 +2713,9 @@
You can control the keywords that display in the Tasks window. Open the Options window (Tools > Options; NetBeans > Preferences on Mac), then choose Miscellaneous > Tasks.
-3. Run the project (press F6; fn-F6 on Mac) and test to see whether the `ControllerServlet` is forwarding requests to the appropriate views.
+
+[start=3]
+. Run the project (press F6; fn-F6 on Mac) and test to see whether the `ControllerServlet` is forwarding requests to the appropriate views.
* Type in `http://localhost:8080/AffableBean/category` in the browser's address bar. The application's <<categoryPage,category page>> displays.
* Type in `http://localhost:8080/AffableBean/viewCart` in the browser's address bar. The application's <<cartPage,cart page>> displays.
* Type in `http://localhost:8080/AffableBean/checkout` in the browser's address bar. The application's <<checkoutPage,checkout page>> displays.
@@ -2520,13 +2792,27 @@
* <<jstl,Working with JSTL>>
* <<troubleshoot,Troubleshooting>>
* <<seeAlsoConnectDb,See Also>>
-7. <<entity-session,Adding Entity Classes and Session Beans>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=7]
+. <<entity-session,Adding Entity Classes and Session Beans>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -2566,7 +2852,9 @@
2. Open the IDE's SQL editor. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `affablebean` database connection ( image::images/db-connection-node.png[] ) node and choose Execute Command. The IDE's SQL editor opens.
3. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
4. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the `affablebean` database.
-3. Open the link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot2.zip[+project snapshot+] in the IDE. In the IDE, press Ctrl-Shift-O (⌘-Shift-O on Mac) and navigate to the location on your computer where you unzipped the downloaded file.
+
+[start=3]
+. Open the link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot2.zip[+project snapshot+] in the IDE. In the IDE, press Ctrl-Shift-O (⌘-Shift-O on Mac) and navigate to the location on your computer where you unzipped the downloaded file.
@@ -2585,7 +2873,9 @@
1. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `category` table ( image::images/db-table-node.png[] ) node and choose View Data. The SQL editor opens and displays with a GUI representation of the `category` table in the lower region. Note that the table is empty, as no data has yet been added.
image::images/category-table-empty.png[title="Use the SQL editor to view table data in the IDE"]
Also, note that the native SQL query used to generate the GUI representation is displayed in the upper region of the editor: '`select * from category`'.
-2. Delete '`select * from category`' and enter the following SQL statement:
+
+[start=2]
+. Delete '`select * from category`' and enter the following SQL statement:
[source,java]
----
@@ -2593,8 +2883,12 @@
INSERT INTO `category` (`name`) VALUES ('dairy'),('meats'),('bakery'),('fruit & veg');
----
This statement inserts four new records, each with a unique entry for the '`name`' column. Because the `id` column was specified as `AUTO_INCREMENT` when you created the schema, you do not need to worry about supplying a value.
-3. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The SQL statement is executed.
-4. To confirm that the data has been added, run the '`select * from category`' query again. To do so, you can use the SQL History window. Click the SQL History ( image::images/sql-history-btn.png[] ) button in the editor's toolbar and double-click the '`select * from category`' entry. The SQL History window lists all SQL statements that you recently executed in the IDE.
+
+[start=3]
+. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The SQL statement is executed.
+
+[start=4]
+. To confirm that the data has been added, run the '`select * from category`' query again. To do so, you can use the SQL History window. Click the SQL History ( image::images/sql-history-btn.png[] ) button in the editor's toolbar and double-click the '`select * from category`' entry. The SQL History window lists all SQL statements that you recently executed in the IDE.
Watch the screencast below to see how you can follow the above steps. When typing in the editor, be sure to take advantage of the IDE's code completion and suggestion facilities.
@@ -2648,11 +2942,15 @@
----
After running the statement, you'll see that the record contains an automatically incremented primary key, and the `last_update` column lists the current date and time.
* The value for the final column, '`category_id`', must correspond to a value contained in the `category` table's `id` column. Because you have already added four records to the `category` table, the `product` records you are inserting reference one of these four records. If you try to insert a `product` record that references a `category_id` that doesn't exist, a foreign key constraint fails.
-3. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar.
+
+[start=3]
+. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar.
*Note:* View the Output window (Ctrl-4; ⌘-4 on Mac) to see a log file containing results of the execution.
-4. Right-click the `product` table ( image::images/db-table-node.png[] ) node and choose View Data. You can see 16 new records listed in the table.
+
+[start=4]
+. Right-click the `product` table ( image::images/db-table-node.png[] ) node and choose View Data. You can see 16 new records listed in the table.
image::images/product-table.png[title="Choose View Data from a table node's right-click menu to verify sample data"]
@@ -2696,16 +2994,26 @@
* *Object Type:* `user`
* *Enabled:* `true`
image::images/jdbc-resource-gen-attributes.png[title="Create a new connection pool and data source using the JDBC Resource wizard"]
-5. Click Next. In Step 3, Additional Properties, you do not need to specify any additional configuration information for the data source.
-6. Click Next. In Step 4, Choose Database Connection, type in `AffableBeanPool` as the JDBC connection pool name. Also, ensure that the `Extract from Existing Connection` option is selected, and that the `jdbc:mysql://localhost:3306/affablebean` connection is listed.
-7. Click Next. In Step 5, Add Connection Pool Properties, specify the following details:
+
+[start=5]
+. Click Next. In Step 3, Additional Properties, you do not need to specify any additional configuration information for the data source.
+
+[start=6]
+. Click Next. In Step 4, Choose Database Connection, type in `AffableBeanPool` as the JDBC connection pool name. Also, ensure that the `Extract from Existing Connection` option is selected, and that the `jdbc:mysql://localhost:3306/affablebean` connection is listed.
+
+[start=7]
+. Click Next. In Step 5, Add Connection Pool Properties, specify the following details:
* *Datasource Classname:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
* *Resource Type:* `javax.sql.ConnectionPoolDataSource`
* *Description:* _(Optional)_ `Connects to the affablebean database`
Also, note that the wizard extracts and displays properties from the existing connection.
image::images/jdbc-resource-conn-pool.png[title="Create a new connection pool and data source using the JDBC Resource wizard"]
-8. Click Finish. The wizard generates a `sun-resources.xml` file for the project that contains all information required to set up the connection pool and data source on GlassFish. The `sun-resources.xml` file is a deployment descriptor specific to the GlassFish application server. When the project next gets deployed, the server will read in any configuration data contained in `sun-resources.xml`, and set up the connection pool and data source accordingly. Note that once the connection pool and data source exist on the server, your project no longer requires the `sun-resources.xml` file.
-9. In the Projects window (Ctrl-1; ⌘-1 on Mac), expand the Server Resources node and double-click the `sun-resources.xml` file to open it in the editor. Here you see the XML configuration required to set up the connection pool and data source. (Code below is formatted for readability.)
+
+[start=8]
+. Click Finish. The wizard generates a `sun-resources.xml` file for the project that contains all information required to set up the connection pool and data source on GlassFish. The `sun-resources.xml` file is a deployment descriptor specific to the GlassFish application server. When the project next gets deployed, the server will read in any configuration data contained in `sun-resources.xml`, and set up the connection pool and data source accordingly. Note that once the connection pool and data source exist on the server, your project no longer requires the `sun-resources.xml` file.
+
+[start=9]
+. In the Projects window (Ctrl-1; ⌘-1 on Mac), expand the Server Resources node and double-click the `sun-resources.xml` file to open it in the editor. Here you see the XML configuration required to set up the connection pool and data source. (Code below is formatted for readability.)
[source,xml]
----
@@ -2751,8 +3059,12 @@
</jdbc-connection-pool>
</resources>
----
-10. In the Projects window (Ctrl-1; ⌘-1 on Mac), right-click the `AffableBean` project node and choose Deploy. The GlassFish server reads configuration data from the `sun-resources.xml` file and creates the `AffableBeanPool` connection pool, and `jdbc/affablebean` data source.
-11. In the Services window, expand the Servers > GlassFish > Resources > JDBC node. Here you can locate the `jdbc/affablebean` data source listed under JDBC Resources, and the `AffableBeanPool` connection pool listed under Connection Pools.
+
+[start=10]
+. In the Projects window (Ctrl-1; ⌘-1 on Mac), right-click the `AffableBean` project node and choose Deploy. The GlassFish server reads configuration data from the `sun-resources.xml` file and creates the `AffableBeanPool` connection pool, and `jdbc/affablebean` data source.
+
+[start=11]
+. In the Services window, expand the Servers > GlassFish > Resources > JDBC node. Here you can locate the `jdbc/affablebean` data source listed under JDBC Resources, and the `AffableBeanPool` connection pool listed under Connection Pools.
image::images/gf-server-jdbc-resources.png[title="View data sources and connection pools registered on the server"]
Right-click data source and connection pool nodes to view and make changes to their properties. You can associate a data source with any connection pool registered on the server. You can edit property values for connection pools, and unregister both data sources and connection pools from the server.
@@ -2779,10 +3091,18 @@
1. Ensure that the GlassFish server is already running. In the Services window (Ctrl-5; ⌘-5 on Mac), expand the Servers node. Note the small green arrow next to the GlassFish icon ( image::images/gf-server-running-node.png[] ).
(If the server is not running, right-click the server node and choose Start.)
-2. Right-click the server node and choose View Admin Console. The GlassFish Administration Console opens in a browser.
-3. Log into the administration console. The default username / password is: `admin` / `adminadmin`.
-4. In the console's tree on the left, expand the Resources > JDBC > Connection Pools nodes, then click `AffableBeanPool`. In the main window, the Edit Connection Pool interface displays for the selected connection pool.
-5. Click the Ping button. If the ping succeeds, the GlassFish server has a working connection to the `affablebean` database on the MySQL server.
+
+[start=2]
+. Right-click the server node and choose View Admin Console. The GlassFish Administration Console opens in a browser.
+
+[start=3]
+. Log into the administration console. The default username / password is: `admin` / `adminadmin`.
+
+[start=4]
+. In the console's tree on the left, expand the Resources > JDBC > Connection Pools nodes, then click `AffableBeanPool`. In the main window, the Edit Connection Pool interface displays for the selected connection pool.
+
+[start=5]
+. Click the Ping button. If the ping succeeds, the GlassFish server has a working connection to the `affablebean` database on the MySQL server.
image::images/ping-succeeded.png[title="Ping the connection pool to determine whether it has a physical connection to the database"]
(If the ping fails, see suggestions in the <<troubleshoot,Troubleshooting>> section below.)
@@ -2799,7 +3119,9 @@
* *Sharing Scope:* `Shareable`
* *Description:* _(Optional)_ `Connects to database for AffableBean application`
image::images/add-resource-ref-dialog.png[title="Specify resource properties in the Add Resource Reference dialog"]
-4. Click OK. The new resource is added under the Resource References heading.
+
+[start=4]
+. Click OK. The new resource is added under the Resource References heading.
image::images/resource-reference.png[title="Create a reference to the data source for the application"]
To verify that the resource is now added to the `web.xml` file, click the XML tab located along the top of the editor. Notice that the following `<resource-ref>` tags are now included:
@@ -2826,17 +3148,25 @@
The project does not yet have a folder named '`test`' within the Web Pages location (i.e., within the `web` folder). By entering '`test`' into the Folder field, you have the IDE create the folder upon completing the wizard.
-4. Click finish. The IDE generates a new `testDataSource.jsp` file, and places it into the new `test` folder within the project.
-5. In the new `testDataSource.jsp` file, in the editor, place your cursor at the end of the line containing the `<h1>` tags (line 17). Press Return, then press Ctrl-Space to invoke code suggestions. Choose DB Report from the list of options.
+
+[start=4]
+. Click finish. The IDE generates a new `testDataSource.jsp` file, and places it into the new `test` folder within the project.
+
+[start=5]
+. In the new `testDataSource.jsp` file, in the editor, place your cursor at the end of the line containing the `<h1>` tags (line 17). Press Return, then press Ctrl-Space to invoke code suggestions. Choose DB Report from the list of options.
image::images/db-report.png[title="Press Ctrl-Space in editor to invoke code suggestions"]
If line numbers do not display, right-click in the left margin of the editor and choose Show Line Numbers.
-6. In the Insert DB Report dialog, specify the data source and modify the SQL query to be executed:
+
+[start=6]
+. In the Insert DB Report dialog, specify the data source and modify the SQL query to be executed:
* *Data Source:* `jdbc/affablebean`
* *Query Statement:* `SELECT * FROM category, product WHERE category.id = product.category_id`
image::images/insert-db-report.png[title="Specify the data source and SQL query to be executed"]
-7. Click OK. The dialog adds the `taglib` directives for the JSTL `core` and `sql` libraries to the top of the file:
+
+[start=7]
+. Click OK. The dialog adds the `taglib` directives for the JSTL `core` and `sql` libraries to the top of the file:
[source,java]
----
@@ -2871,13 +3201,21 @@
</c:forEach>
</table>
----
-8. Before running the file in a browser, make sure you have enabled the JDBC driver deployment option in NetBeans' GlassFish support. Choose Tools > Servers to open the Servers window. In the left column, select the GlassFish server you are deploying to. In the main column, ensure that the 'Enable JDBC Driver Deployment' option is selected, then click Close.
+
+[start=8]
+. Before running the file in a browser, make sure you have enabled the JDBC driver deployment option in NetBeans' GlassFish support. Choose Tools > Servers to open the Servers window. In the left column, select the GlassFish server you are deploying to. In the main column, ensure that the 'Enable JDBC Driver Deployment' option is selected, then click Close.
image::images/servers-window.png[title="Ensure that the Enable JDBC Driver Deployment option is selected"]
For Java applications that connect to a database, the server requires a JDBC driver to be able to create a communication bridge between the SQL and Java languages. In the case of MySQL, you use the link:http://www.mysql.com/downloads/connector/j/[+Connector/J+] JDBC driver. Ordinarily you would need to manually place the driver JAR file into the server's `lib` directory. With the 'Enable JDBC Driver Deployment' option selected, the server performs a check to see whether a driver is needed, and if so, the IDE deploys the driver to the server.
-9. Right-click in the editor and choose Run File (Shift-F6; fn-Shift-F6 on Mac). The `testDataSource.jsp` file is compiled into a servlet, deployed to the server, then runs in a browser.
-10. Open the Output window (Ctrl-4; ⌘-4 on Mac) and click the 'AffableBean (run)' tab. The output indicates that the driver JAR file (`mysql-connector-java-5.1.6-bin.jar`) is deployed.
+
+[start=9]
+. Right-click in the editor and choose Run File (Shift-F6; fn-Shift-F6 on Mac). The `testDataSource.jsp` file is compiled into a servlet, deployed to the server, then runs in a browser.
+
+[start=10]
+. Open the Output window (Ctrl-4; ⌘-4 on Mac) and click the 'AffableBean (run)' tab. The output indicates that the driver JAR file (`mysql-connector-java-5.1.6-bin.jar`) is deployed.
image::images/output-window-mysql-driver.png[title="When JDBC Driver Deployment is enabled, the IDE deploys the MySQL driver to GlassFish when required"]
-11. Examine `testDataSource.jsp` in the browser. You see an HTML table listing data contained in the `category` and `product` tables.
+
+[start=11]
+. Examine `testDataSource.jsp` in the browser. You see an HTML table listing data contained in the `category` and `product` tables.
image::images/test-data-source.png[title="The JSP page contains data extracted from the 'affablebean' database"]
(If you receive a server error, see suggestions in the <<troubleshoot,Troubleshooting>> section below.)
@@ -2905,21 +3243,35 @@
2. Import the `img` folder into the `AffableBean` project. Copy (Ctrl-C; ⌘-C on Mac) the `img` folder, then in the IDE's Projects window, paste (Ctrl-V; ⌘-V on Mac) the folder into the project's Web Pages node.
image::images/projects-win-img-folder.png[title="Import the 'img' folder into the AffableBean project"]
The `categories` and `products` folders contain the images that will be displayed in the link:design.html#index[+index+] and link:design.html#category[+category+] pages, respectively.
-3. Open the project's web deployment descriptor. In the Projects window, expand the Configuration Files node and double-click `web.xml`.
-4. Click the General tab, then expand Context Parameters and click the Add button.
-5. In the Add Context Parameter dialog, enter the following details:
+
+[start=3]
+. Open the project's web deployment descriptor. In the Projects window, expand the Configuration Files node and double-click `web.xml`.
+
+[start=4]
+. Click the General tab, then expand Context Parameters and click the Add button.
+
+[start=5]
+. In the Add Context Parameter dialog, enter the following details:
* *Parameter Name:* `productImagePath`
* *Parameter Value:* `img/products/`
* *Description:* _(Optional)_ `The relative path to product images`
image::images/add-context-param-dialog.png[title="Add initialization parameters using the Add Context Parameter dialog"]
-6. Click OK.
-7. Click the Add button again and enter the following details:
+
+[start=6]
+. Click OK.
+
+[start=7]
+. Click the Add button again and enter the following details:
* *Parameter Name:* `categoryImagePath`
* *Parameter Value:* `img/categories/`
* *Description:* _(Optional)_ `The relative path to category images`
-8. Click OK. The two context parameters are now listed:
+
+[start=8]
+. Click OK. The two context parameters are now listed:
image::images/context-parameters.png[title="Context parameters display in the web.xml interface"]
-9. Click the XML tab to view the XML content that has been added to the deployment descriptor. The following `<context-param>` entries have been added:
+
+[start=9]
+. Click the XML tab to view the XML content that has been added to the deployment descriptor. The following `<context-param>` entries have been added:
[source,xml]
----
@@ -2935,7 +3287,9 @@
<param-value>img/categories/</param-value>
</context-param>
----
-10. To test whether the values for the context parameters are accessible to web pages, open any of the project's web pages in the editor and enter EL expressions using the `initParam` implicit object. For example, open `index.jsp` and enter the following (New code in *bold*):
+
+[start=10]
+. To test whether the values for the context parameters are accessible to web pages, open any of the project's web pages in the editor and enter EL expressions using the `initParam` implicit object. For example, open `index.jsp` and enter the following (New code in *bold*):
[source,html]
----
@@ -2950,7 +3304,9 @@
</div>
</div>
----
-11. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the values for the `categoryImagePath` and `productImagePath` context parameters displayed in the page.
+
+[start=11]
+. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the values for the `categoryImagePath` and `productImagePath` context parameters displayed in the page.
image::images/context-params-browser.png[title="Use 'initParam' with JSP EL delimiters to display context parameter values"]
@@ -2996,13 +3352,17 @@
1. In the Projects window, double-click the `index.jsp` node to open it in the editor. (If already opened, press Ctrl-Tab to select it in the editor.)
2. At the top of the file, before the first `<div>` tag, place your cursor on a blank line, then type '`db`' and press Ctrl-Space. In the code-completion pop-up window that displays, choose DB Query.
image::images/db-query.png[title="Type 'db', then press Ctrl-Space to invoke code completion suggestions"]
-3. In the Insert DB Query dialog, enter the following details:
+
+[start=3]
+. In the Insert DB Query dialog, enter the following details:
* *Variable Name:* `categories`
* *Scope:* `page`
* *Data Source:* `jdbc/affablebean`
* *Query Statement:* `SELECT * FROM category`
image::images/insert-db-query.png[title="Specify query details to create an SQL query using JSTL <sql:query> tags"]
-4. Click OK. The dialog generates an SQL query using JSTL `<sql:query>` tags. Also, note that the required reference to the `sql` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
+
+[start=4]
+. Click OK. The dialog generates an SQL query using JSTL `<sql:query>` tags. Also, note that the required reference to the `sql` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
[source,html]
----
@@ -3024,13 +3384,19 @@
----
The SQL query creates a result set which is stored in the `categories` variable. You can then access the result set using EL syntax, e.g., `${categories}` (demonstrated below).
-5. Place your cursor at the end of '`<div id="indexRightColumn">`' (line 22), hit return, type '`jstl`' then press Ctrl-Space and choose JSTL For Each.
+
+[start=5]
+. Place your cursor at the end of '`<div id="indexRightColumn">`' (line 22), hit return, type '`jstl`' then press Ctrl-Space and choose JSTL For Each.
image::images/jstl-for-each.png[title="Type 'jstl', then press Ctrl-Space to invoke code completion suggestions"]
-6. In the Insert JSTL For Each dialog, enter the following details:
+
+[start=6]
+. In the Insert JSTL For Each dialog, enter the following details:
* *Collection:* `${categories.rows}`
* *Current Item of the Iteration:* `category`
image::images/insert-jstl-for-each.png[title="Specify details to create a 'for each' loop using JSTL <c:forEach> tags"]
-7. Click OK. The dialog sets up syntax for a JSTL `forEach` loop using `<c:forEach>` tags. Also, note that the required reference to the `core` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
+
+[start=7]
+. Click OK. The dialog sets up syntax for a JSTL `forEach` loop using `<c:forEach>` tags. Also, note that the required reference to the `core` `taglib` directive has been automatically inserted at the top of the page. (Changes displayed in *bold*.)
[source,html]
----
@@ -3048,7 +3414,9 @@
If you are wondering what '`rows`' refers to in the generated code, recall that the `categories` variable represents a result set. More specifically, `categories` refers to an object that implements the `link:http://java.sun.com/products/jsp/jstl/1.1/docs/api/javax/servlet/jsp/jstl/sql/Result.html[+javax.servlet.jsp.jstl.sql.Result+]` interface. This object provides properties for accessing the rows, column names, and size of the query’s result set. When using dot notation as in the above example, '`categories.rows`' is translated in Java to '`categories.getRows()`'.
-8. Integrate the `<c:forEach>` tags into the page. You can nest the `<div class="categoryBox">` tags within the `forEach` loop so that HTML markup is generated for each of the four categories. Use EL syntax to extract the `category` table's `id` and `name` column values for each of the four records. Make sure to delete the other `<div class="categoryBox">` tags which exist outside the `forEach` loop. When you finish, the complete `index.jsp` file will look as follows. (`<c:forEach>` tags and contents are displayed in *bold*.)
+
+[start=8]
+. Integrate the `<c:forEach>` tags into the page. You can nest the `<div class="categoryBox">` tags within the `forEach` loop so that HTML markup is generated for each of the four categories. Use EL syntax to extract the `category` table's `id` and `name` column values for each of the four records. Make sure to delete the other `<div class="categoryBox">` tags which exist outside the `forEach` loop. When you finish, the complete `index.jsp` file will look as follows. (`<c:forEach>` tags and contents are displayed in *bold*.)
[source,html]
----
@@ -3089,9 +3457,13 @@
</c:forEach>
</div>*
----
-9. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the names and images of the four categories.
+
+[start=9]
+. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see the names and images of the four categories.
image::images/index-category-images.png[title="'for each' loop extracts details from the database and utilizes them in the page"]
-10. Click any of the four images in the browser. The category page displays.
+
+[start=10]
+. Click any of the four images in the browser. The category page displays.
image::images/category-page.png[title="Category images from index page link to category page"]
To understand how linking takes place between the index and category pages, reexamine the HTML anchor tags within the `forEach` loop:
@@ -3150,7 +3522,9 @@
</sql:query>
----
Either use the Insert DB Query dialog as <<categoryIndex,described above>>, or use the editor's code suggestion and completion facilities by pressing Ctrl-Space while typing.
-3. Between the `<div id="categoryLeftColumn">` tags, replace the existing static placeholder content with the following `<c:forEach>` loop.
+
+[start=3]
+. Between the `<div id="categoryLeftColumn">` tags, replace the existing static placeholder content with the following `<c:forEach>` loop.
[source,html]
----
@@ -3181,7 +3555,9 @@
</div>
----
In the above snippet, you access the request's query string using '`pageContext.request.queryString`'. `pageContext` is another link:http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/bnahq.html#bnaij[+implicit object+] defined by the JSP Expression Language. The EL expression uses the `link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/jsp/PageContext.html[+PageContext+]` to access the current request (an `link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html[+HttpServletRequest+]` object). From `HttpServletRequest`, the `getQueryString()` method is called to obtain the value of the request's query string.
-4. Make sure to add the JSTL `core` and `sql` `taglib` directives to the top of the page. (This is done automatically when using the editor's code suggestion and completion facilities.)
+
+[start=4]
+. Make sure to add the JSTL `core` and `sql` `taglib` directives to the top of the page. (This is done automatically when using the editor's code suggestion and completion facilities.)
[source,java]
----
@@ -3189,7 +3565,9 @@
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-5. Run the project. In the browser, navigate to the category page and click the category buttons in the left column. Each time you click, the page refreshes highlighting the selected category.
+
+[start=5]
+. Run the project. In the browser, navigate to the category page and click the category buttons in the left column. Each time you click, the page refreshes highlighting the selected category.
image::images/category-page-bakery.png[title="Select categories by clicking category buttons in the left column"]
Also, note that the ID of the selected category is displayed in the page's URL. (In the above image, the bakery category is selected, and '`3`' is appended to the URL in the browser's navigation toolbar.)
@@ -3210,11 +3588,21 @@
<c:when test="${category.id == pageContext.request.queryString}">
----
(To set a breakpoint, click in the left margin of the line. A breakpoint ( image::images/breakpoint-icon.png[] ) icon displays.)
-2. In the IDE's main toolbar, click the Debug Project ( image::images/debug-project-btn.png[] ) button. A debugging session is activated for the project, and the application's index page opens in the browser.
-3. Click the bakery category in the index page. (You know that the ID for the bakery category is '`3`').
-4. Return to the IDE, and note that the debugger is suspended on the line containing the breakpoint. When suspended, the margin shows a green arrow on the breakpoint ( image::images/debugger-suspended-icon.png[] ), and the line displays with green background.
-5. Open the Variables window (Ctrl-Shift-1) and expand the Implicit Objects > pageContext > request > queryString node. Inspect the variable value and note that the value is '`3`', corresponding to the category ID from your selection.
-6. Press the Finish Debugger Session ( image::images/finish-debugger-session-btn.png[] ) button to terminate the debugger session.
+
+[start=2]
+. In the IDE's main toolbar, click the Debug Project ( image::images/debug-project-btn.png[] ) button. A debugging session is activated for the project, and the application's index page opens in the browser.
+
+[start=3]
+. Click the bakery category in the index page. (You know that the ID for the bakery category is '`3`').
+
+[start=4]
+. Return to the IDE, and note that the debugger is suspended on the line containing the breakpoint. When suspended, the margin shows a green arrow on the breakpoint ( image::images/debugger-suspended-icon.png[] ), and the line displays with green background.
+
+[start=5]
+. Open the Variables window (Ctrl-Shift-1) and expand the Implicit Objects > pageContext > request > queryString node. Inspect the variable value and note that the value is '`3`', corresponding to the category ID from your selection.
+
+[start=6]
+. Press the Finish Debugger Session ( image::images/finish-debugger-session-btn.png[] ) button to terminate the debugger session.
==== Display title heading above product table
@@ -3233,7 +3621,9 @@
<sql:param value="${pageContext.request.queryString}"/>
</sql:query>*
----
-2. Use JSP EL syntax to extract the category name from the query and display it in the page. Make the following change to the `<p id="categoryTitle">` element. (Displayed in *bold*.)
+
+[start=2]
+. Use JSP EL syntax to extract the category name from the query and display it in the page. Make the following change to the `<p id="categoryTitle">` element. (Displayed in *bold*.)
[source,xml]
----
@@ -3241,8 +3631,12 @@
<p id="categoryTitle">*${selectedCategory.rows[0].name}*</p>
----
Since the result from the `selectedCategory` query contains only one item (i.e., user can select only one category), you can retrieve the first row of the result set using '`selectedCategory*.rows[0]*`'. If a user selects the 'meats' category for example, the returned expression would be '`{name=meats}`'. You could then access the category name with '`${selectedCategory.rows[0]*.name*}`'.
-3. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
-4. Return to the browser and refresh the category page. The name of the selected category now displays above the product table.
+
+[start=3]
+. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
+
+[start=4]
+. Return to the browser and refresh the category page. The name of the selected category now displays above the product table.
image::images/category-page-bakery-title.png[title="The name of the selected category dynamically displays above the product table"]
*Note:* As demonstrated in this and the previous step, you do not need to explicitly recompile, deploy, and run the project with each change to your code base. The IDE provides a Deploy on on Save feature, which is enabled for Java web projects by default. To verify that the feature is activated, right-click your project node in the Projects window and choose Properties. In the Project Properties window, click the Run category and examine the 'Deploy on Save' option.
@@ -3269,7 +3663,9 @@
<sql:param value="${pageContext.request.queryString}"/>
</sql:query>*
----
-2. Between the `<table id="productTable">` tags, replace the existing static table row placeholders (`<tr>` tags) with the following `<c:forEach>` loop. (Changes are displayed in *bold*.)
+
+[start=2]
+. Between the `<table id="productTable">` tags, replace the existing static table row placeholders (`<tr>` tags) with the following `<c:forEach>` loop. (Changes are displayed in *bold*.)
[source,xml]
----
@@ -3317,8 +3713,12 @@
For a description of JSP Expression Language operators, see the Java EE 5 Tutorial: link:http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/bnahq.html#bnaik[+JavaServer Pages Technology > Unified Expression Language > Operators+].
-3. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
-4. Return to the browser and refresh the category page. Product details now display within the table for the selected category.
+
+[start=3]
+. Save (Ctrl-S; ⌘-S on Mac) changes made to the file.
+
+[start=4]
+. Return to the browser and refresh the category page. Product details now display within the table for the selected category.
image::images/category-page-bakery-product-table.png[title="Product details are dynamically displayed for the selected category"]
You have now completed this tutorial unit. In it, you explored how to connect your application to the database by setting up a connection pool and data source on the server, then referenced the data source from the application. You also created several context parameters, and learned how to access them from JSP pages. Finally, you implemented JSTL tags into the application's web pages in order to dynamically retrieve and display database data.
@@ -3455,12 +3855,24 @@
* <<addSession,Adding Session Beans>>
* <<access,Accessing Data with EJBs>>
* <<seeAlsoEntitySession,See Also>>
-8. <<manage-sessions,Managing Sessions>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=8]
+. <<manage-sessions,Managing Sessions>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -3608,8 +4020,12 @@
When you choose the `jdbc/affablebean` data source, the IDE scans the database and lists the database tables in the Available Tables pane.
image::images/entity-from-database.png[title="Choose an available data source to have the IDE read in database tables"]
-5. Click the Add All button, then click Next.
-6. Step 3 of the Entity Classes from Database wizard differs slightly between NetBeans IDE 6.8 and 6.9. Depending on the version IDE you are using, perform the following steps.
+
+[start=5]
+. Click the Add All button, then click Next.
+
+[start=6]
+. Step 3 of the Entity Classes from Database wizard differs slightly between NetBeans IDE 6.8 and 6.9. Depending on the version IDE you are using, perform the following steps.
* <<68,NetBeans IDE 6.8>>
* <<69,NetBeans IDE 6.9>>
@@ -3622,9 +4038,15 @@
2. Click the Create Persistence Unit button. The Create Persistence Unit dialog opens.
image::images/create-pu.png[title="Use the Create Persistence Unit dialog to generate a persistence.xml file"]
A _persistence unit_ refers to a collection of entity classes that exist in an application. The above dialog generates a `persistence.xml` file, which is used by your persistence provider to specify configuration settings for the persistence unit. Note that 'EclipseLink (JPA 2.0)' is the default selection for the server associated with the project. Leave 'Table Generation Strategy' set to '`None`'. This prevents the persistence provider from affecting your database. (For example, if you want the persistence provider to delete then recreate the database based on the existing entity classes, you could set the strategy to '`Drop and Create`'. This action would then be taken each time the project is deployed.)
-3. Click Create.
-4. Back in Step 3: Entity Classes, note that the class names for the entities are based on database tables. For example, the `CustomerOrder` entity is mapped to the `customer_order` database table. Also note that the 'Generate Named Query Annotations for Persistent Fields' option is selected by default. We will be using various named queries later in the tutorial.
-5. Continue to <<step7,step 7>> below.
+
+[start=3]
+. Click Create.
+
+[start=4]
+. Back in Step 3: Entity Classes, note that the class names for the entities are based on database tables. For example, the `CustomerOrder` entity is mapped to the `customer_order` database table. Also note that the 'Generate Named Query Annotations for Persistent Fields' option is selected by default. We will be using various named queries later in the tutorial.
+
+[start=5]
+. Continue to <<step7,step 7>> below.
[[69]]
@@ -3636,7 +4058,9 @@
* The class names for the entities are based on database tables. For example, the `CustomerOrder` entity will be mapped to the `customer_order` database table.
* The 'Generate Named Query Annotations for Persistent Fields' option is selected by default. We will be using various named queries later in the tutorial.
* The 'Create Persistence Unit' option is selected by default. A _persistence unit_ is a collection of entity classes that exist in an application. The persistence unit is defined by a `persistence.xml` configuration file, which is read by your persistence provider. Enabling this option therefore means that the wizard will also generate a `persistence.xml` file and populate it with default settings.
-7. Click Finish. The JPA entity classes are generated, based on the `affablebean` database tables. You can examine the entity classes in the Projects window by expanding the newly created `entity` package. Also, note that the new persistence unit exists under the Configuration Files node.
+
+[start=7]
+. Click Finish. The JPA entity classes are generated, based on the `affablebean` database tables. You can examine the entity classes in the Projects window by expanding the newly created `entity` package. Also, note that the new persistence unit exists under the Configuration Files node.
image::images/entity-classes.png[title="View new entity classes in the Projects window"]
Note that the wizard generated an additional entity class, `OrderedProductPK`. Recall that the data model's `ordered_product` table uses a composite primary key that comprises the primary keys of both the `customer_order` and `product` tables. (See link:data-model.html#manyToMany[+Designing the Data Model - Creating Many-To-Many Relationships+].) Because of this, the persistence provider creates a separate entity class for the composite key, and _embeds_ it into the `OrderedProduct` entity. You can open `OrderedProduct` in the editor to inspect it. JPA uses the `@EmbeddedId` annotation to signify that the embeddable class is a composite primary key.
@@ -3653,9 +4077,13 @@
Press Ctrl-Space on the `@EmbeddedId` annotation to invoke the API documentation.
image::images/embedded-id.png[title="Press Ctrl-Space to invoke the API documentation"]
-8. Open the persistence unit (`persistence.xml`) in the editor. The IDE provides a Design view for persistence units, in addition to the XML view. The Design view provides a convenient way to make configuration changes to the persistence provider's management of the project.
+
+[start=8]
+. Open the persistence unit (`persistence.xml`) in the editor. The IDE provides a Design view for persistence units, in addition to the XML view. The Design view provides a convenient way to make configuration changes to the persistence provider's management of the project.
image::images/persistence-unit.png[title="Design view of the AffableBeanPU persistence unit"]
-9. Click the XML tab at the top of the `AffableBeanPU` persistence unit to open the XML view. Add the following property to the file.
+
+[start=9]
+. Click the XML tab at the top of the `AffableBeanPU` persistence unit to open the XML view. Add the following property to the file.
[source,xml]
----
@@ -3689,15 +4117,25 @@
1. Press Ctrl-N (⌘-N on Mac) to open the File wizard.
2. Select the Persistence category, then select Session Beans for Entity Classes.
image::images/session-beans-for-entity-classes.png[title="Select Session Beans for Entity Classes to generate a session facade for your persistence model"]
-3. Click Next.
-4. In Step 2: Entity Classes, note that all entity classes contained in your project are listed on the left, under Available Entity Classes. Click Add All. All entity classes are moved to the right, under Selected Entity Classes.
-5. Click Next.
-6. In Step 3: Generated Session Beans, type in *session* into the Package field.
+
+[start=3]
+. Click Next.
+
+[start=4]
+. In Step 2: Entity Classes, note that all entity classes contained in your project are listed on the left, under Available Entity Classes. Click Add All. All entity classes are moved to the right, under Selected Entity Classes.
+
+[start=5]
+. Click Next.
+
+[start=6]
+. In Step 3: Generated Session Beans, type in *session* into the Package field.
image::images/generated-session-beans.png[title="Specify the location of the new session beans, and whether to create interfaces"]
*Note:* You can use the wizard to generate local and remote interfaces for the session beans. While there is benefit to programming session beans to interfaces (For example, hiding business object interactions behind an interface enables you to further decouple the client from your business logic. This also means that you can code multiple implementations of the interface for your application, should the need arise.), this lies outside the scope of the tutorial. Note that EJB versions prior to 3.1 _require_ that you implement an interface for each session bean.
-7. Click Finish. The IDE generates session beans for each of the entity classes contained in your project. In the Projects window, expand the new `session` package to examine the session beans.
+
+[start=7]
+. Click Finish. The IDE generates session beans for each of the entity classes contained in your project. In the Projects window, expand the new `session` package to examine the session beans.
|===
|NetBeans 6.8 |NetBeans 6.9
@@ -3707,7 +4145,9 @@
*Note:* As shown above, NetBeans IDE 6.9 provides slight improvements in the way the Session Beans for Entity Classes wizard generates facade classes. Namely, boiler-plate code that is common to all classes is factored out into an abstract class named `AbstractFacade`. If you are working in version 6.9, open any of the facade classes that have been generated (aside from `AbstractFacade`). You'll see that the class extends `AbstractFacade`.
-8. Open a session facade in the editor, for example, `ProductFacade`. All of the generated session facades instantiate an link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+] using the link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+] annotation.
+
+[start=8]
+. Open a session facade in the editor, for example, `ProductFacade`. All of the generated session facades instantiate an link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html[+`EntityManager`+] using the link:http://download.oracle.com/javaee/6/api/javax/persistence/PersistenceContext.html[+`@PersistenceContext`+] annotation.
[source,java]
----
@@ -3758,13 +4198,17 @@
}
----
The `@EJB` annotation instructs the EJB container to instantiate the `categoryFacade` variable with the EJB named `CategoryFacade`.
-3. Use the IDE's hints to add import statements for:
+
+[start=3]
+. Use the IDE's hints to add import statements for:
* `javax.ejb.EJB`
* `session.CategoryFacade`
Pressing Ctrl-Shift-I (⌘-Shift-I on Mac) automatically adds required imports to your class.
-4. Add the following `init` method to the class. The web container initializes the servlet by calling its `init` method. This occurs only once, after the servlet is loaded and before it begins servicing requests.
+
+[start=4]
+. Add the following `init` method to the class. The web container initializes the servlet by calling its `init` method. This occurs only once, after the servlet is loaded and before it begins servicing requests.
[source,java]
----
@@ -3789,7 +4233,9 @@
image::images/method-signature.png[title="Over your mouse over the method while holding down the Ctrl key to view its signature"]
Clicking the hyperlink enables you to navigate directly to the method.
-5. Use the IDE's hint to add the `@Overrides` annotation. The `init` method is defined by `HttpServlet`'s superclass, `GenericServlet`.
+
+[start=5]
+. Use the IDE's hint to add the `@Overrides` annotation. The `init` method is defined by `HttpServlet`'s superclass, `GenericServlet`.
image::images/override.png[title="Use the IDE's hint to add the @Overrides annotation to the method"]
Adding the annotation is not required, however it does provide several advantages:
* It enables you to use compiler checking to ensure that you are actually overriding a method that you assume you are overriding.
@@ -3797,21 +4243,31 @@
For more information on annotations, see the link:http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html[+Java Tutorials: Annotations+].
-6. Now that you have set up an application-scoped attribute that contains a list of categories, modify the index page to access the newly created attribute.
+
+[start=6]
+. Now that you have set up an application-scoped attribute that contains a list of categories, modify the index page to access the newly created attribute.
Double-click the Web Pages > `index.jsp` node in the Projects window to open the file in the editor.
-7. Comment out (or delete) the `<sql:query>` statement that is listed at the top of the file. To comment out code in the editor, highlight the code, then press Ctrl-/ (⌘-/ on Mac).
+
+[start=7]
+. Comment out (or delete) the `<sql:query>` statement that is listed at the top of the file. To comment out code in the editor, highlight the code, then press Ctrl-/ (⌘-/ on Mac).
image::images/commented-out.png[title="Press Ctrl-/ to comment out a code snippet in the editor"]
-8. Modify the opening `<c:forEach>` tag so that its `items` attribute references the new application-scoped `categories` attribute.
+
+[start=8]
+. Modify the opening `<c:forEach>` tag so that its `items` attribute references the new application-scoped `categories` attribute.
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-9. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
+
+[start=9]
+. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
image::images/go-to-file.png[title="Use the Go to File dialog to quickly open files in the editor"]
-10. Comment out (or delete) the `<resource-ref>` entry. The entry was required for the `<sql>` tags in order to identify the data source registered on the server. We are now relying on JPA to access the database, and the `jdbc/affablebean` data source has already been specified in the persistence unit. (Refer to the <<pu,Design view of the project's persistence unit>> above.)
+
+[start=10]
+. Comment out (or delete) the `<resource-ref>` entry. The entry was required for the `<sql>` tags in order to identify the data source registered on the server. We are now relying on JPA to access the database, and the `jdbc/affablebean` data source has already been specified in the persistence unit. (Refer to the <<pu,Design view of the project's persistence unit>> above.)
Highlight the entire `<resource-ref>` entry, then press Ctrl-/ (⌘-/ on Mac).
@@ -3826,7 +4282,9 @@
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> *-->*
----
-11. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see that all four category names and images display.
+
+[start=11]
+. Run the project. Click the Run Project ( image::images/run-project-btn.png[] ) button. The project's index page opens in the browser, and you see that all four category names and images display.
image::images/index-page.png[title="Verify that the index page is able to retrieve category details"]
@@ -3853,14 +4311,18 @@
1. Open `category.jsp` in the editor, and comment out (Ctrl-/; ⌘-/ on Mac) the JSTL `<sql>` statements that are listed at the top of the file.
image::images/comment-out-sql.png[title="Comment out JSTL <sql> statements in the category page"]
-2. Modify the opening `<c:forEach>` tag so that its `items` attribute references the application-scoped `categories` attribute. (This is identical to what you did above for `index.jsp`.)
+
+[start=2]
+. Modify the opening `<c:forEach>` tag so that its `items` attribute references the application-scoped `categories` attribute. (This is identical to what you did above for `index.jsp`.)
[source,java]
----
<c:forEach var="category" items="*${categories}*">
----
-3. Run the project to examine the current state of the category page. Click the Run Project ( image::images/run-project-btn.png[] ) button. When the project's index page opens in the browser, click any of the four categories. The category buttons in the left column display and function as expected.
+
+[start=3]
+. Run the project to examine the current state of the category page. Click the Run Project ( image::images/run-project-btn.png[] ) button. When the project's index page opens in the browser, click any of the four categories. The category buttons in the left column display and function as expected.
image::images/category-page-left-column.png[title="Category buttons in left column display and function as expected"]
@@ -3892,7 +4354,9 @@
*Note:* The logic to determine the selected category within the left column category buttons is already implemented in `category.jsp` using an EL expression, which is comparable to calling `getQueryString()` in the servlet. The EL expression is: `pageContext.request.queryString`.
-3. Add the following line of code within the `if` statement.
+
+[start=3]
+. Add the following line of code within the `if` statement.
[source,java]
----
@@ -3907,10 +4371,14 @@
}
----
You use the `CategoryFacade`'s `find` method to retrieve the `Category` object based on the requested category ID. Note that you must cast `categoryId` to a `Short`, as this is the type used for the `id` field in the `Category` entity class.
-4. Click the badge ( image::images/editor-badge.png[] ) in the left margin to use the editor's hint to declare `selectedCategory` as a local variable within the `doGet` method.
+
+[start=4]
+. Click the badge ( image::images/editor-badge.png[] ) in the left margin to use the editor's hint to declare `selectedCategory` as a local variable within the `doGet` method.
image::images/local-variable.png[title="Use editor hints to declare local variables"]
Because `selectedCategory` is of type `Category`, which hasn't yet been imported into the class, the IDE automatically adds an import statement for `entity.Category` to the top of the file.
-5. Add the following line to place the retrieved `Category` object in the request scope.
+
+[start=5]
+. Add the following line to place the retrieved `Category` object in the request scope.
[source,java]
----
@@ -3927,8 +4395,12 @@
request.setAttribute("selectedCategory", selectedCategory);*
}
----
-6. In the editor, switch to `category.jsp`. (Press Ctrl-Tab and choose from the pop-up list.)
-7. Locate `<p id="categoryTitle">` and make the following change.
+
+[start=6]
+. In the editor, switch to `category.jsp`. (Press Ctrl-Tab and choose from the pop-up list.)
+
+[start=7]
+. Locate `<p id="categoryTitle">` and make the following change.
[source,xml]
----
@@ -3938,7 +4410,9 @@
</p>
----
You are now using the `selectedCategory` attribute, which you just placed in the request scope from the `ControllerServlet`. Using '`.name`' within the EL expression calls the `getName` method on the given `Category` object.
-8. Switch back to the browser and refresh the category page. The name of the selected category now displays in the page.
+
+[start=8]
+. Switch back to the browser and refresh the category page. The name of the selected category now displays in the page.
image::images/category-page-selected-category.png[title="Selected category name displays in the category page"]
@@ -3971,9 +4445,13 @@
}
----
Calling `getProductCollection()` here enables us to get a collection of all `Product`s associated with the `selectedCategory`.
-2. Use the editor's hint to define `categoryProducts` as a local variable for the `doGet` method.
+
+[start=2]
+. Use the editor's hint to define `categoryProducts` as a local variable for the `doGet` method.
image::images/local-variable2.png[title="Use editor hints to declare local variables"]
-3. Place the collection of `Product`s in the request scope so that it can be retrieved from the application's front-end.
+
+[start=3]
+. Place the collection of `Product`s in the request scope so that it can be retrieved from the application's front-end.
[source,java]
----
@@ -3999,7 +4477,9 @@
request.setAttribute("categoryProducts", categoryProducts);
}*
----
-4. Open the `category.jsp` file in the editor and make the following change to the product table.
+
+[start=4]
+. Open the `category.jsp` file in the editor and make the following change to the product table.
[source,java]
----
@@ -4009,7 +4489,9 @@
<c:forEach var="product" items="*${categoryProducts}*" varStatus="iter">
----
The `<c:forEach>` tag now references the `categoryProducts` collection. The `c:forEach` loop will now iterate over each `Product` object contained in the collection, and extract data accordingly.
-5. Press F6 (fn-F6 on Mac) to run the project. Navigate to the category page in the browser and note that all products now display for each category.
+
+[start=5]
+. Press F6 (fn-F6 on Mac) to run the project. Navigate to the category page in the browser and note that all products now display for each category.
image::images/category-page-product-table.png[title="Product table displays products of a given category"]
This tutorial unit provided a brief introduction to JPA and EJB technologies. It also described the role of Java specifications, and how their reference implementations are used by the GlassFish application server. It then demonstrated how to create a set of JPA entity classes that provide a Java implementation of the project database. Then, following the _session facade_ pattern, it showed how to create a set of EJB session beans that exist on top of the entity classes and enable convenient access to them. Finally, you modified the `AffableBean` project to utilize the new session beans and entities for database access required in the index and category pages.
@@ -4123,11 +4605,21 @@
* <<session-track,Examining Session Tracking Options>>
* <<time-out,Handling Session Time-Outs>>
* <<seeAlsoManageSessions,See Also>>
-9. <<transaction,Integrating Transactional Business Logic>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=9]
+. <<transaction,Integrating Transactional Business Logic>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -4340,11 +4832,15 @@
* `WEB-INF/view/category.jsp`
* `WEB-INF/view/checkout.jsp`
* `controller/ControllerServlet`
-2. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
+
+[start=2]
+. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
If you receive an error when running the project, revisit the <<setup,setup instructions>>, which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Test the application's functionality in your browser. If you are continuing directly from the <<entity-session,previous tutorial unit>>, you'll note the following enhancements.
+
+[start=3]
+. Test the application's functionality in your browser. If you are continuing directly from the <<entity-session,previous tutorial unit>>, you'll note the following enhancements.
==== category page
@@ -4372,18 +4868,26 @@
* Clicking 'view cart' results in the cart page displaying.
* Clicking 'submit purchase' results in the confirmation page displaying (without user-specific data).
image::images/checkout-page.png[title="Checkout page includes shopping cart functionality"]
-4. Use the Go to File dialog to open the `ControllerServlet` in the editor. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then type '`Controller`' in the dialog and click OK.
+
+[start=4]
+. Use the Go to File dialog to open the `ControllerServlet` in the editor. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then type '`Controller`' in the dialog and click OK.
image::images/go-to-file-dialog.png[title="Use the Go to File dialog to quickly open project resources in the editor"]
-5. Set a breakpoint in the `doPost` method on the line that creates an `HttpSession` object (line 150). To set a breakpoint, click in the left margin of the editor.
+
+[start=5]
+. Set a breakpoint in the `doPost` method on the line that creates an `HttpSession` object (line 150). To set a breakpoint, click in the left margin of the editor.
image::images/breakpoint.png[title="Click in editor's left margin to set breakpoints"]
To toggle line numbers for the editor, right-click in the left margin and choose Show Line Numbers.
-6. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The GlassFish server starts (or restarts, if it is already running) and opens a socket on its debug port number. The application welcome page opens in your browser.
+
+[start=6]
+. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The GlassFish server starts (or restarts, if it is already running) and opens a socket on its debug port number. The application welcome page opens in your browser.
You can view and modify the debug port number from the Servers window (Tools > Servers). Select the Java tab for the server you are using. Specify the port number in the 'Address to use' field under Debug Settings.
-7. When the application's welcome page displays in the browser, click any category image to navigate to the category page. Recall that clicking the 'add to cart' button sends an `addToCart` request to the server:
+
+[start=7]
+. When the application's welcome page displays in the browser, click any category image to navigate to the category page. Recall that clicking the 'add to cart' button sends an `addToCart` request to the server:
[source,java]
----
@@ -4391,9 +4895,13 @@
<form action="addToCart" method="post">
----
As you may recall from link:page-views-controller.html#controller[+Preparing the Page Views and Controller Servlet+], the `ControllerServlet`'s `doPost` method handles requests for the `/addToCart` URL pattern. You can therefore expect that when a user clicks an 'add to cart' button, the `doPost` method is called.
-8. Click 'add to cart' for any product in the category page. Switch back to the IDE and note that the debugger suspends on the breakpoint.
+
+[start=8]
+. Click 'add to cart' for any product in the category page. Switch back to the IDE and note that the debugger suspends on the breakpoint.
image::images/breakpoint-suspended.png[title="Debugger suspends on breakpoints in editor"]
-9. Place your cursor on the call to `getSession()` and press Ctrl-Space to invoke the Javadoc documentation.
+
+[start=9]
+. Place your cursor on the call to `getSession()` and press Ctrl-Space to invoke the Javadoc documentation.
image::images/javadoc-getsession.png[title="Press Ctrl-Space to invoke Javadoc documentation"]
According to the documentation, `getSession()` returns the `HttpSession` currently associated with the request, and if no session exists, the method creates a new session object.
@@ -4437,10 +4945,16 @@
* link:http://java.sun.com/j2se/javadoc/[+Javadoc Tool Official Home Page+]
* link:http://java.sun.com/j2se/javadoc/writingdoccomments/index.html[+How to Write Doc Comments for the Javadoc Tool+]
-10. Hover your mouse over the `session` variable. Note that the debugger suspends on the line _it is about to execute._ The value returned by `getSession()` has not yet been saved into the `session` variable, and you see a popup stating that "`session` is not a known variable in the current context."
+
+[start=10]
+. Hover your mouse over the `session` variable. Note that the debugger suspends on the line _it is about to execute._ The value returned by `getSession()` has not yet been saved into the `session` variable, and you see a popup stating that "`session` is not a known variable in the current context."
image::images/session-variable.png[title="Hover your mouse over variables and expressions to determine their current values"]
-11. Click the Step Over ( image::images/step-over-btn.png[] ) button in the debugger toolbar located above the editor. The line is executed, and the debugger steps to the next line in the file.
-12. Hover your mouse over the `session` variable again. Now you see the value currently set to the `session` variable.
+
+[start=11]
+. Click the Step Over ( image::images/step-over-btn.png[] ) button in the debugger toolbar located above the editor. The line is executed, and the debugger steps to the next line in the file.
+
+[start=12]
+. Hover your mouse over the `session` variable again. Now you see the value currently set to the `session` variable.
[.feature]
--
image::images/session-variable-set.png[role="left", link="images/session-variable-set.png"]
@@ -4448,18 +4962,30 @@
In NetBeans 6.9, you can click the grey pointer ( image::images/grey-pointer.png[] ) in the popup to expand a list of variable values contained in the highlighted element.
-13. Click the Step Over ( image::images/step-over-btn.png[] ) button (F8; fn-F8 on Mac) to arrive at the `if` statement (line 154). Because you just clicked the 'add to cart' button in the browser, you know that the expression `userPath.equals("/addToCart")` should evaluate to `true`.
-14. Highlight the `userPath.equals("/addToCart")` expression (by control-clicking with your mouse). This time you see a popup indicating the value of the expression you highlighted.
+
+[start=13]
+. Click the Step Over ( image::images/step-over-btn.png[] ) button (F8; fn-F8 on Mac) to arrive at the `if` statement (line 154). Because you just clicked the 'add to cart' button in the browser, you know that the expression `userPath.equals("/addToCart")` should evaluate to `true`.
+
+[start=14]
+. Highlight the `userPath.equals("/addToCart")` expression (by control-clicking with your mouse). This time you see a popup indicating the value of the expression you highlighted.
image::images/expression.png[title="Highlight expressions to determine their current values"]
-15. Press F8 (fn-F8 on Mac) to step to the next line (line 158). The application has been designed so that the `ShoppingCart` object for the user session is only created when the user adds an item to the cart for the first time. Since this is the first time the `addToCart` request has been received in this debug session, you can expect the `cart` object to equal `null`.
+
+[start=15]
+. Press F8 (fn-F8 on Mac) to step to the next line (line 158). The application has been designed so that the `ShoppingCart` object for the user session is only created when the user adds an item to the cart for the first time. Since this is the first time the `addToCart` request has been received in this debug session, you can expect the `cart` object to equal `null`.
image::images/cart-null.png[title="Cart object doesn't exist until user adds item to shopping cart"]
-16. Press F8 (fn-F8 on Mac) to step to the next line (line 160). Then, on line 160, where the `ShoppingCart` object is created, click the Step Into ( image::images/step-into-btn.png[] ) button. The debugger steps into the method being called. In this case, you are taken directly to the `ShoppingCart`'s constructor.
+
+[start=16]
+. Press F8 (fn-F8 on Mac) to step to the next line (line 160). Then, on line 160, where the `ShoppingCart` object is created, click the Step Into ( image::images/step-into-btn.png[] ) button. The debugger steps into the method being called. In this case, you are taken directly to the `ShoppingCart`'s constructor.
image::images/cart-constructor.png[title="Step into methods to follow runtime execution to other classes"]
-17. Press Ctrl-Tab to switch back to the `ControllerServlet`. Note that the IDE provides a Call Stack ( image::images/call-stack-badge.png[] ) badge on line 160, indicating that the debugger is currently suspended somewhere on a method higher up in the call stack.
+
+[start=17]
+. Press Ctrl-Tab to switch back to the `ControllerServlet`. Note that the IDE provides a Call Stack ( image::images/call-stack-badge.png[] ) badge on line 160, indicating that the debugger is currently suspended somewhere on a method higher up in the call stack.
Press Alt-Shift-3 (Ctrl-Shift-3 on Mac) to open the IDE's Call Stack window.
-18. Press F8 (fn-F8 on Mac) to continue stepping through code. When the debugger completes the `ShoppingCart` constructor, you are taken back to the `ControllerServlet`.
+
+[start=18]
+. Press F8 (fn-F8 on Mac) to continue stepping through code. When the debugger completes the `ShoppingCart` constructor, you are taken back to the `ControllerServlet`.
Line 161 of the `ControllerServlet` binds the newly-created `cart` object to the session.
@@ -4475,7 +5001,9 @@
--
If you expand the session > session > attributes node, you are able to view the objects that are bound to the session. In the above image, there are two items currently bound to the session (highlighted). These are `selectedCategory` and `categoryProducts`, instantiated in the `ControllerServlet` at lines 83 and 89, respectively. Both of these items were bound earlier, when you clicked a category image, and the `ControllerServlet` processed the category page request.
-19. Press F8 (fn-F8 on Mac) to execute line 161. The `cart` object is bound to the session, and the Variables window updates to reflect changes. In the Variables window, note that the session now contains three attributes, the third being the newly initialized `ShoppingCart` object (highlighted below).
+
+[start=19]
+. Press F8 (fn-F8 on Mac) to execute line 161. The `cart` object is bound to the session, and the Variables window updates to reflect changes. In the Variables window, note that the session now contains three attributes, the third being the newly initialized `ShoppingCart` object (highlighted below).
[.feature]
--
image::images/variables-win-session-cart.png[role="left", link="images/variables-win-session-cart.png"]
@@ -4489,8 +5017,12 @@
* a `Product` object is created using the ID (line 169)
* a new `ShoppingCartItem` is created using the `product` (line 170)
* the `ShoppingCartItem` is added to `ShoppingCart`'s `items` list (line 170)
-20. Press F8 (fn-F8 on Mac) to continue stepping through code while being mindful of the above-listed four actions. Pause when the debugger suspends on line 170.
-21. Create a watch on the session. This will allow you to view values contained in the session when you step into the `addItem` method in the next step. Right-click the session in the Variables window and choose Create Fixed Watch.
+
+[start=20]
+. Press F8 (fn-F8 on Mac) to continue stepping through code while being mindful of the above-listed four actions. Pause when the debugger suspends on line 170.
+
+[start=21]
+. Create a watch on the session. This will allow you to view values contained in the session when you step into the `addItem` method in the next step. Right-click the session in the Variables window and choose Create Fixed Watch.
image::images/create-watch.png[title="Create watches on variables as you step through code in a debug session"]
Alternatively, you can place your cursor on the `session` variable in the editor, then right-click and choose New Watch. The New Watch dialog enables you to specify variables or expressions to watch continuously when debugging an application. (In the case of expressions, highlight the expression first, then right-click and choose New Watch.)
@@ -4499,23 +5031,37 @@
A new watch is created on the `session` variable and all variables it contains. The watch is visible from the Watches window (Window > Debugging > Watches) or, if you toggle the Watches ( image::images/watch-btn.png[] ) button in the left margin of the Variables window, it displays in the top row of the Variables window.
The debugger enables you to keep an eye on variables as it steps through code. This can be helpful, for example if you'd like to follow changes to specific variable values (and don't want to need to sift through the full list presented in the Variables window with each step), or if you temporarily step into a class that doesn't contain the variables you are interested in.
-22. Click the Step Into ( image::images/step-into-btn.png[] ) button to step into `ShoppingCart`'s `addItem` method.
-23. Step through the `addItem` method until you reach line 53. As the Javadoc states, `addItem` _"adds a `ShoppingCartItem` to the `ShoppingCart`'s `items` list. If item of the specified `product` already exists in shopping cart list, the quantity of that item is incremented."_
-24. Examine the `session` variable which you created a watch on (<<step21,step 21>> above). The `items.add(scItem)` statement in line 51 added the new `ShoppingCartItem` to the `items` list in the `ShoppingCart`. This is evident by drilling into the third attribute (i.e., the `cart` variable) contained in the session.
+
+[start=22]
+. Click the Step Into ( image::images/step-into-btn.png[] ) button to step into `ShoppingCart`'s `addItem` method.
+
+[start=23]
+. Step through the `addItem` method until you reach line 53. As the Javadoc states, `addItem` _"adds a `ShoppingCartItem` to the `ShoppingCart`'s `items` list. If item of the specified `product` already exists in shopping cart list, the quantity of that item is incremented."_
+
+[start=24]
+. Examine the `session` variable which you created a watch on (<<step21,step 21>> above). The `items.add(scItem)` statement in line 51 added the new `ShoppingCartItem` to the `items` list in the `ShoppingCart`. This is evident by drilling into the third attribute (i.e., the `cart` variable) contained in the session.
[.feature]
--
image::images/variables-window-add-item.png[role="left", link="images/variables-window-add-item.png"]
--
At this stage, you can see how an `HttpSession` is created for the request, how a `ShoppingCart` object is created and attached to the session, and how a `ShoppingCartItem` is created based on the user's product choice, then added to the `ShoppingCart`'s list of `items`. The only remaining action is to forward the request to the `category.jsp` view.
-25. Open the header JSP fragment (`header.jspf`) in the editor and place a breakpoint on line 86. This line contains the EL statement within the shopping cart widget that displays the number of cart items.
+
+[start=25]
+. Open the header JSP fragment (`header.jspf`) in the editor and place a breakpoint on line 86. This line contains the EL statement within the shopping cart widget that displays the number of cart items.
image::images/breakpoint-jsp.png[title="You can suspend the debugger in JSP pages"]
-26. Click the Continue ( image::images/continue-btn.png[] ) button in the debugger toolbar. The debugger continues until execution completes, or until it reaches another breakpoint. In this case, the debugger suspends on line 86 in the header JSP fragment.
+
+[start=26]
+. Click the Continue ( image::images/continue-btn.png[] ) button in the debugger toolbar. The debugger continues until execution completes, or until it reaches another breakpoint. In this case, the debugger suspends on line 86 in the header JSP fragment.
*Note:* In order to suspend the debugger in a JSP page, you need to set a breakpoint. For example, when the `ControllerServlet` forwards the request to the appropriate view, the debugger will not automatically suspend within the JSP page.
-27. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) if it is not already open. Unlike with Java classes, the debugger _does not_ provide tooltips when you hover your mouse over variables or expressions in a JSP page. However, the Variables window does enable you to determine variable values as you step through code. So, where can you find the value for `${cart.numberOfItems}`?
-28. In the Variables window, expand the Implicit Objects > pageContext > session > session > attributes node. This provides access to the session object, just as you saw earlier when working in the `ControllerServlet`. In fact, you may note that the session which you created a watch on in step 21 above points to the very same object. Here you can verify that the value of `${cart.numberOfItems}` equals '`1`'.
+
+[start=27]
+. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) if it is not already open. Unlike with Java classes, the debugger _does not_ provide tooltips when you hover your mouse over variables or expressions in a JSP page. However, the Variables window does enable you to determine variable values as you step through code. So, where can you find the value for `${cart.numberOfItems}`?
+
+[start=28]
+. In the Variables window, expand the Implicit Objects > pageContext > session > session > attributes node. This provides access to the session object, just as you saw earlier when working in the `ControllerServlet`. In fact, you may note that the session which you created a watch on in step 21 above points to the very same object. Here you can verify that the value of `${cart.numberOfItems}` equals '`1`'.
[.feature]
--
image::images/variables-window-number-of-items.png[role="left", link="images/variables-window-number-of-items.png"]
@@ -4524,7 +5070,9 @@
Maximize the Variables window, or any window in the IDE, by right-clicking the window header, then choosing Maximize Window (Shift-Esc).
The debugger gives you access to the `pageContext` implicit object. `pageContext` represents the context of the JSP page, and offers direct access to various objects including the `HttpServletRequest`, `HttpSession`, and `ServletContext` objects. For more information, see the link:http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaij[+Java EE 5 Tutorial: Implicit Objects+].
-29. Click the Finish Session ( image::images/finish-session-btn.png[] ) button. The runtime finishes executing, and the debug session terminates. The browser displays a fully-rendered category page, and you can see that the shopping cart widget in the page header contains one item.
+
+[start=29]
+. Click the Finish Session ( image::images/finish-session-btn.png[] ) button. The runtime finishes executing, and the debug session terminates. The browser displays a fully-rendered category page, and you can see that the shopping cart widget in the page header contains one item.
Hopefully you now feel comfortable using the IDE's debugger not only to examine your project when it behaves unexpectedly, but also as a tool to become more familiar with code. Other useful buttons in the debugger toolbar include:
@@ -4571,14 +5119,24 @@
1. Begin by activating the HTTP Monitor for the server you are using. Choose Tools > Servers. In the left column of the Servers window, select the server you are using (GlassFish). Then, in the main column, select the Enable HTTP Monitor option.
image::images/servers-win-http-monitor.png[title="Select the Enable HTTP Monitor option to activate the HTTP Monitor"]
-2. If your server is already running, you need to restart it. However, since we plan to use the debugger, and running the debugger restarts the server to communicate on a different port, just click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The server restarts, a debug session begins and the application's welcome page opens in your browser. The HTTP Monitor displays in the bottom region of the IDE.
+
+[start=2]
+. If your server is already running, you need to restart it. However, since we plan to use the debugger, and running the debugger restarts the server to communicate on a different port, just click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar. The server restarts, a debug session begins and the application's welcome page opens in your browser. The HTTP Monitor displays in the bottom region of the IDE.
image::images/http-monitor.png[title="HTTP Monitor displays by default in bottom region of the IDE"]
-3. Click the AffableBean record in the left column (as shown in the above image). When you select records in the left column, the right (i.e., main) column refreshes to display corresponding data. In the above image, the Request tab displays the requested URI (`/AffableBean/`), the HTTP method (`GET`), and points out that there was no query string sent with the request.
-4. Select the Session tab. Note that there is a statement, "The session was created as a result of this request." This is due to the fact that the server has sent a `Set-Cookie` header for the `JSESSIONID` cookie in its response. Also note that the new session ID is listed under 'Session properties'. As will later be shown, the session ID is the value of the `JSESSIONID` cookie.
+
+[start=3]
+. Click the AffableBean record in the left column (as shown in the above image). When you select records in the left column, the right (i.e., main) column refreshes to display corresponding data. In the above image, the Request tab displays the requested URI (`/AffableBean/`), the HTTP method (`GET`), and points out that there was no query string sent with the request.
+
+[start=4]
+. Select the Session tab. Note that there is a statement, "The session was created as a result of this request." This is due to the fact that the server has sent a `Set-Cookie` header for the `JSESSIONID` cookie in its response. Also note that the new session ID is listed under 'Session properties'. As will later be shown, the session ID is the value of the `JSESSIONID` cookie.
image::images/session-tab.png[title="Session details are displayed under the Session tab in the HTTP Monitor"]
You may wonder how a session object was created from a request for the site welcome page. After all, the `ControllerServlet` does not handle the initial request for `/AffableBean/`, and nowhere does this request encounter `getSession()`. Or does it? Recall that JSP pages are compiled into servlets upon deployment. Once you've deployed your project to the server, you can actually use the IDE to view the JSP's compiled servlet on your server.
-5. In the Projects window, right-click the `index.jsp` file and choose View Servlet. An `index_jsp.java` file opens in the editor. This is the servlet that was automatically compiled from the `index.jsp` page.
-6. Perform a search in the file for `getSession`. Press Ctrl-F (⌘-F on Mac), type '`getSession`' in the search bar, then press Enter.
+
+[start=5]
+. In the Projects window, right-click the `index.jsp` file and choose View Servlet. An `index_jsp.java` file opens in the editor. This is the servlet that was automatically compiled from the `index.jsp` page.
+
+[start=6]
+. Perform a search in the file for `getSession`. Press Ctrl-F (⌘-F on Mac), type '`getSession`' in the search bar, then press Enter.
Ctrl-F (⌘-F on Mac) is a keyboard shortcut for Edit > Find.
@@ -4594,12 +5152,20 @@
To find out the location of the compiled servlet on your server, you can hover your mouse over the servlet's name tab above the editor. A popup displays the path to the file on your computer.
-7. In the browser, select a category then add an item to your cart. Switch back to the IDE. Note that the debugger suspends on the breakpoint in the `ControllerServlet` you set earlier (line 150). All breakpoints are remembered between sessions. To remove the breakpoint, you could click the breakpoint ( image::images/breakpoint-badge.png[] ) badge in the editor's left margin. However, since there are multiple breakpoints already set in the project, open the debugger's Breakpoints window (Window > Debugging > Breakpoints).
+
+[start=7]
+. In the browser, select a category then add an item to your cart. Switch back to the IDE. Note that the debugger suspends on the breakpoint in the `ControllerServlet` you set earlier (line 150). All breakpoints are remembered between sessions. To remove the breakpoint, you could click the breakpoint ( image::images/breakpoint-badge.png[] ) badge in the editor's left margin. However, since there are multiple breakpoints already set in the project, open the debugger's Breakpoints window (Window > Debugging > Breakpoints).
image::images/breakpoints-window.png[title="View all breakpoints in your project from the Breakpoints window"]
From the Breakpoints window, you can view and call actions on all breakpoints set in projects opened in the IDE.
-8. Right-click the breakpoint set in `header.jspf` and choose Delete. Then right-click the breakpoint set in the `ControllerServlet` and choose Disable. (You'll re-enable it later in this exercise.)
-9. Click the Continue ( image::images/continue-btn.png[] ) button. The request finishes executing, and the category page displays in the browser with one item added to the cart.
-10. In the HTTP Monitor, search for the `addToCart` request in the left column, then select it to display details in the main column.
+
+[start=8]
+. Right-click the breakpoint set in `header.jspf` and choose Delete. Then right-click the breakpoint set in the `ControllerServlet` and choose Disable. (You'll re-enable it later in this exercise.)
+
+[start=9]
+. Click the Continue ( image::images/continue-btn.png[] ) button. The request finishes executing, and the category page displays in the browser with one item added to the cart.
+
+[start=10]
+. In the HTTP Monitor, search for the `addToCart` request in the left column, then select it to display details in the main column.
Click the Ascending Sort ( image::images/ascending-sort-btn.png[] ) button so that the most recent records are listed at the top.
@@ -4609,23 +5175,39 @@
--
image::images/http-monitor-add-to-cart.png[role="left", link="images/http-monitor-add-to-cart.png"]
--
-11. Select the Cookies tab. Here you see that a cookie named `JSESSIONID` exists, and was sent from the client to the server. Note that the value for the cookie is the same as the Session ID displayed under the Session tab.
+
+[start=11]
+. Select the Cookies tab. Here you see that a cookie named `JSESSIONID` exists, and was sent from the client to the server. Note that the value for the cookie is the same as the Session ID displayed under the Session tab.
image::images/cookies-tab.png[title="Cookies are displayed under the Cookies tab in the HTTP Monitor"]
Likewise, if you click the Header tab, you see the cookie listed, since '`Cookie`' is a request header that was sent by the client.
image::images/headers-tab.png[title="Cookies are displayed under the Cookies tab in the HTTP Monitor"]
See Wikipedia's link:http://en.wikipedia.org/wiki/List_of_HTTP_headers[+List of HTTP headers+] for more information on request and response headers.
-12. Select the Session tab. There is a statement which indicates, "The session existed before this request." Also note that the `cart` attribute is listed under 'Session attributes after the request'. This makes sense, since we know that the `cart` object is bound to the session when the `addToCart` request is processed for the first time.
+
+[start=12]
+. Select the Session tab. There is a statement which indicates, "The session existed before this request." Also note that the `cart` attribute is listed under 'Session attributes after the request'. This makes sense, since we know that the `cart` object is bound to the session when the `addToCart` request is processed for the first time.
image::images/session-tab-add-to-cart.png[title="Session attributes are displayed under the Session tab in the HTTP Monitor"]
In the next few steps, locate the session ID and `JSESSIONID` cookie in the Variables window.
-13. Re-enable the breakpoint you set earlier in the `ControllerServlet`. Press Alt-Shift-5 (Ctrl-Shift-5 on Mac) to open the Breakpoints window, then click in the checkbox next to the breakpoint entry to re-enable it.
-14. In the browser, click the 'add to cart' button for one of the listed products.
-15. Switch to the IDE and note that the debugger is suspended on the breakpoint set in the `ControllerServlet`. Click the Step Over ( image::images/step-over-btn.png[] ) button so that the `session` variable is assigned to the session object.
-16. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) and expand session > session. You'll find the session ID listed as the value for the `id` variable.
-17. To locate the `JSESSIONID` cookie, recall that you can normally access cookies from a servlet by calling the link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] method on the `HttpServletRequest`. Therefore, drill into the request object: request > Inherited > request > request > Inherited > cookies. Here you see the `cookies` ArrayList. If you expand the list, you'll find the `JSESSIONID` cookie, the value of which is the session ID.
-18. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
+
+[start=13]
+. Re-enable the breakpoint you set earlier in the `ControllerServlet`. Press Alt-Shift-5 (Ctrl-Shift-5 on Mac) to open the Breakpoints window, then click in the checkbox next to the breakpoint entry to re-enable it.
+
+[start=14]
+. In the browser, click the 'add to cart' button for one of the listed products.
+
+[start=15]
+. Switch to the IDE and note that the debugger is suspended on the breakpoint set in the `ControllerServlet`. Click the Step Over ( image::images/step-over-btn.png[] ) button so that the `session` variable is assigned to the session object.
+
+[start=16]
+. Open the Variables window (Alt-Shift-1; Ctrl-Shift-1 on Mac) and expand session > session. You'll find the session ID listed as the value for the `id` variable.
+
+[start=17]
+. To locate the `JSESSIONID` cookie, recall that you can normally access cookies from a servlet by calling the link:http://java.sun.com/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getCookies%28%29[+`getCookies`+] method on the `HttpServletRequest`. Therefore, drill into the request object: request > Inherited > request > request > Inherited > cookies. Here you see the `cookies` ArrayList. If you expand the list, you'll find the `JSESSIONID` cookie, the value of which is the session ID.
+
+[start=18]
+. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
[[url-rewrite]]
@@ -4648,34 +5230,50 @@
1. Temporarily disable cookies in your browser. If you are using Firefox, you can choose Tools > Options (Firefox > Preferences on Mac). In the window that displays, select the Privacy tab, then under History, select 'Use custom settings for history' in the provided drop-down. Deselect the 'Accept cookies from sites' option.
image::images/firefox.png[title="Temporarily disable cookies in your browser"]
-2. Run the `AffableBean` project. When the welcome page displays, click into a category, then try adding an item to your cart. You'll see that the application's functionality is severely compromised in its present state.
+
+[start=2]
+. Run the `AffableBean` project. When the welcome page displays, click into a category, then try adding an item to your cart. You'll see that the application's functionality is severely compromised in its present state.
image::images/compromised.png[title="The application's functionality is compromised when the client doesn't accept cookies"]
As before, the server generates a session and binds objects to it. This is how the category page is able to display the selected category and products. However, the server has failed in its attempt to set a `JSESSIONID` cookie. Therefore, when the client makes a second request (when user clicks 'add to cart'), the server has no way of identifying the session which the request belongs to. It therefore cannot locate any of the attributes previously set in the session, such as `selectedCategory` and `categoryProducts`. This why the rendered response lacks the information specified by these attributes.
-3. Open the project's `category.jsp` page in the editor. Locate the line that implements the 'add to cart' button (line 58). The `<form>` element's `action` attribute determines the request sent to the server.
+
+[start=3]
+. Open the project's `category.jsp` page in the editor. Locate the line that implements the 'add to cart' button (line 58). The `<form>` element's `action` attribute determines the request sent to the server.
[source,java]
----
<form action="addToCart" method="post">
----
-4. Modify the request so that it is passed through the `<c:url>` tag.
+
+[start=4]
+. Modify the request so that it is passed through the `<c:url>` tag.
[source,java]
----
<form action="*<c:url value='addToCart'/>*" method="post">
----
-5. Press Ctrl-S (⌘-S on Mac) to save changes to the file. Recall that the IDE provides the Deploy on Save feature, which is enabled by default. This means that any saved changes are automatically deployed to your server.
-6. In the browser, select a different category so that the application renders the newly modified category page.
-7. Examine the source code for the page. In Firefox, you can press Ctrl-U (⌘-U on Mac). The 'add to cart' button for each product displays with the session ID appended to the URL.
+
+[start=5]
+. Press Ctrl-S (⌘-S on Mac) to save changes to the file. Recall that the IDE provides the Deploy on Save feature, which is enabled by default. This means that any saved changes are automatically deployed to your server.
+
+[start=6]
+. In the browser, select a different category so that the application renders the newly modified category page.
+
+[start=7]
+. Examine the source code for the page. In Firefox, you can press Ctrl-U (⌘-U on Mac). The 'add to cart' button for each product displays with the session ID appended to the URL.
[source,java]
----
<form action="addToCart*;jsessionid=4188657e21d72f364e0782136dde*" method="post">
----
-8. Click the 'add to cart' button for any item. You see that the server is now able to determine the session which the request belongs to, and renders the response appropriately.
-9. Before proceeding, make sure to re-enable cookies for your browser.
+
+[start=8]
+. Click the 'add to cart' button for any item. You see that the server is now able to determine the session which the request belongs to, and renders the response appropriately.
+
+[start=9]
+. Before proceeding, make sure to re-enable cookies for your browser.
Again, every link that a user is able to click on within the application, whose response requires some form of session-related data, needs to be properly encoded. Sometimes implementation is not as straight-forward as the example shown above. For example, the 'clear cart' widget used in `cart.jsp` currently sets a `clear` parameter to `true` when the link is clicked.
@@ -4741,9 +5339,13 @@
</session-timeout>
</session-config>
----
-2. Click the General tab, and type in '`10`' in the Session Timeout field.
+
+[start=2]
+. Click the General tab, and type in '`10`' in the Session Timeout field.
image::images/session-timeout.png[title="Specify session time-out for the application under the web.xml's General tab"]
-3. Save the file (Ctrl-S; ⌘-S on Mac).
+
+[start=3]
+. Save the file (Ctrl-S; ⌘-S on Mac).
If you switch back to the XML view, you'll see that the `<session-timeout>` element has been updated.
@@ -4772,31 +5374,51 @@
<session-timeout>*1*</session-timeout>
</session-config>
----
-2. Run the `AffableBean` project. In the browser, click into a category page, add several items to your cart, then click 'view cart'.
+
+[start=2]
+. Run the `AffableBean` project. In the browser, click into a category page, add several items to your cart, then click 'view cart'.
image::images/cart-page-session-intact.png[title="The cart page relies on a session object to display items in shopping cart"]
-3. Wait at least one full minute.
-4. Update the quantity for one of the items displayed in the cart page. (Any number between 1 and 99 is acceptable.) Click 'update'. The server returns an HTTP Status 500 message.
+
+[start=3]
+. Wait at least one full minute.
+
+[start=4]
+. Update the quantity for one of the items displayed in the cart page. (Any number between 1 and 99 is acceptable.) Click 'update'. The server returns an HTTP Status 500 message.
image::images/glassfish-error-report.png[title="NullPointerException occurs when request for expired session is received"]
-5. Examine the GlassFish server log in the IDE. Open the Output window (Ctrl-4; ⌘-4 on Mac) and select the GlassFish Server tab. Scroll to the bottom of the log to examine the error's stack trace.
+
+[start=5]
+. Examine the GlassFish server log in the IDE. Open the Output window (Ctrl-4; ⌘-4 on Mac) and select the GlassFish Server tab. Scroll to the bottom of the log to examine the error's stack trace.
[.feature]
--
image::images/gf-server-output.png[role="left", link="images/gf-server-output.png"]
--
The server log indicates that a `NullPointerException` occurred at line 184 in the `ControllerServlet`. The Output window forms a link to the line where the exception occurred.
-6. Click the link. You navigate directly to line 184 in the `ControllerServlet`. Hovering your mouse over the error badge in the editor's left margin provides a tooltip describing the exception.
+
+[start=6]
+. Click the link. You navigate directly to line 184 in the `ControllerServlet`. Hovering your mouse over the error badge in the editor's left margin provides a tooltip describing the exception.
image::images/nullpointer-exception.png[title="Error badge and tooltip indicate the location and cause of the problem"]
Because the session had already expired before the request was received, the servlet engine was unable to associate the request with its corresponding session. It was therefore unable to locate the `cart` object (line 151). The exception finally occurred in line 184 when the engine attempted to call a method on a variable equating to `null`.
Now that we've identified the problem, let's fix it by implementing a filter.
-7. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
-8. Select the *Web* category, then select *Filter* and click Next.
-9. Name the filter `SessionTimeoutFilter`. Type `filter` into the Packages field so that the filter class is placed in a new package when created.
-10. Click Next. Accept default settings and click Finish. A template for the `SessionTimeoutFilter` is generated and opens in the editor.
+
+[start=7]
+. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
+
+[start=8]
+. Select the *Web* category, then select *Filter* and click Next.
+
+[start=9]
+. Name the filter `SessionTimeoutFilter`. Type `filter` into the Packages field so that the filter class is placed in a new package when created.
+
+[start=10]
+. Click Next. Accept default settings and click Finish. A template for the `SessionTimeoutFilter` is generated and opens in the editor.
*Note:* Currently, in NetBeans 6.9, it isn't possible to use the wizard to set a mapping to a servlet that isn't registered in the web deployment descriptor. (`ControllerServlet` was registered using the `@WebServlet` annotation.) We'll therefore modify the generated code in the next step.
-11. Modify the `@WebFilter` annotation signature so that it appears as follows.
+
+[start=11]
+. Modify the `@WebFilter` annotation signature so that it appears as follows.
[source,java]
----
@@ -4815,7 +5437,9 @@
Use the Javadoc Index Search to pull up documentation on the `Filter` interface. Press Shift-F1 (fn-Shift-F1 on Mac), then type '`Filter`' into the search field and hit Enter. Select the 'Interface in javax.servlet' entry. The Javadoc documentation displays in the lower pane of the index search tool.
-12. Replace the body of the `SessionTimeoutFilter` with the following contents.
+
+[start=12]
+. Replace the body of the `SessionTimeoutFilter` with the following contents.
[source,java]
----
@@ -4849,27 +5473,55 @@
}
----
-13. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix import statements. (Imports need to be added for `HttpServletRequest` and `HttpSession`.) Also, use the editor hints to add the `@Override` annotation to the `init`, `destroy`, and `doFilter` methods.
+
+[start=13]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix import statements. (Imports need to be added for `HttpServletRequest` and `HttpSession`.) Also, use the editor hints to add the `@Override` annotation to the `init`, `destroy`, and `doFilter` methods.
In the coming steps, you run the debugger on the project and step through the `doFilter` method to see how it determines whether the request is bound to an existing session.
-14. Open the Breakpoints window (Alt-Shift-5; Ctrl-Shift-5 on Mac) and ensure that you do not have any existing breakpoints set. To delete a breakpoint, right-click the breakpoint and choose Delete. (If you completed the above exercise, <<http-monitor,Examining Client-Server Communication with the HTTP Monitor>>, you may have an outstanding breakpoint set in the `ControllerServlet`.)
-15. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar.
-16. When the welcome page displays in the browser, select a category, then add several items to your shopping cart.
-17. Set a breakpoint on the line in `SessionTimeoutFilter`'s `doFilter` method that tries to access the session (line 32).
+
+[start=14]
+. Open the Breakpoints window (Alt-Shift-5; Ctrl-Shift-5 on Mac) and ensure that you do not have any existing breakpoints set. To delete a breakpoint, right-click the breakpoint and choose Delete. (If you completed the above exercise, <<http-monitor,Examining Client-Server Communication with the HTTP Monitor>>, you may have an outstanding breakpoint set in the `ControllerServlet`.)
+
+[start=15]
+. Run the debugger. Click the Debug Project ( image::images/debug-project-btn.png[] ) button in the IDE's main toolbar.
+
+[start=16]
+. When the welcome page displays in the browser, select a category, then add several items to your shopping cart.
+
+[start=17]
+. Set a breakpoint on the line in `SessionTimeoutFilter`'s `doFilter` method that tries to access the session (line 32).
image::images/filter-breakpoint.png[title="Set a breakpoint on the getSession method"]
-18. In the browser, click the 'view cart' button. Switch to the IDE and note that the debugger has suspended on the breakpoint.
+
+[start=18]
+. In the browser, click the 'view cart' button. Switch to the IDE and note that the debugger has suspended on the breakpoint.
Recall that `getSession()` creates a new session object if the current one doesn't exist. Here, we use `getSession(false)`, which refrains from creating a new object if none is found. In other words, the method returns `null` if the session doesn't exist.
-19. Click the Step Over ( image::images/step-over-btn.png[] ) button, then hover your mouse over the `session` variable. Provided that a minute hasn't passed since the previous request was sent, you'll see that the variable has been assigned to a `StandardSessionFacade`. This represents the session object for the request.
+
+[start=19]
+. Click the Step Over ( image::images/step-over-btn.png[] ) button, then hover your mouse over the `session` variable. Provided that a minute hasn't passed since the previous request was sent, you'll see that the variable has been assigned to a `StandardSessionFacade`. This represents the session object for the request.
image::images/session-exists.png[title="Hover your mouse over variables to determine their current value"]
-20. Continue stepping through the method until the request is processed. Since `session` doesn't equal `null`, you skip the `if` statement and `chain.doFilter` then forwards the request to the `ControllerServlet` (line 44).
-21. In the browser, make sure a full minute has passed, then update a quantity for one of the product items in your cart. This is the same procedure we went through earlier in the exercise when the status 500 message was returned. Now that the filter intercepts requests heading to the `ControllerServlet`, let's see what happens when a session time-out occurs.
-22. After clicking 'update', switch to the IDE and note that the debugger is again suspended on the breakpoint set in the filter.
-23. Highlight the `req.getSession(false)` expression, then hover your mouse over it. Here you see the expression equates to `null`, as the session has already expired.
+
+[start=20]
+. Continue stepping through the method until the request is processed. Since `session` doesn't equal `null`, you skip the `if` statement and `chain.doFilter` then forwards the request to the `ControllerServlet` (line 44).
+
+[start=21]
+. In the browser, make sure a full minute has passed, then update a quantity for one of the product items in your cart. This is the same procedure we went through earlier in the exercise when the status 500 message was returned. Now that the filter intercepts requests heading to the `ControllerServlet`, let's see what happens when a session time-out occurs.
+
+[start=22]
+. After clicking 'update', switch to the IDE and note that the debugger is again suspended on the breakpoint set in the filter.
+
+[start=23]
+. Highlight the `req.getSession(false)` expression, then hover your mouse over it. Here you see the expression equates to `null`, as the session has already expired.
image::images/session-null.png[title="Highlight expressions and hover your mouse over them to determine their current value"]
-24. Continue stepping through the code. Now that the `session` variable equals `null`, the `if` statement on line 35 is processed, and the request is forwarded to `/index.jsp`. When the debugger finishes executing, you'll see that the browser displays the site's welcome page.
-25. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
-26. Open the project's `web.xml` file and change the session time-out interval back to 10 minutes.
+
+[start=24]
+. Continue stepping through the code. Now that the `session` variable equals `null`, the `if` statement on line 35 is processed, and the request is forwarded to `/index.jsp`. When the debugger finishes executing, you'll see that the browser displays the site's welcome page.
+
+[start=25]
+. Click the Finish Session ( image::images/finish-session-btn.png[] ) button to terminate the debug session.
+
+[start=26]
+. Open the project's `web.xml` file and change the session time-out interval back to 10 minutes.
[source,xml]
----
@@ -4878,7 +5530,9 @@
<session-timeout>*10*</session-timeout>
</session-config>
----
-27. Save (Ctrl-S; ⌘-S on Mac) the file.
+
+[start=27]
+. Save (Ctrl-S; ⌘-S on Mac) the file.
link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot6.zip[+Snapshot 6+] provides you with the completed project version for this tutorial unit. One final topic concerning session management should be mentioned. You can explicitly terminate a session by calling the `invalidate` method on the session object. If the session is no longer needed, it should be removed in order to conserve the memory available to your server. After you complete the next unit, <<transaction,Integrating Transactional Business Logic>>, you will see how the `ControllerServlet`, upon successfully processing a customer order, destroys the user's `cart` object and terminates the session using the `invalidate` method.
@@ -4983,10 +5637,18 @@
* <<transactionProgrammatically,Setting up the Transaction Programmatically>>
* <<validate,Validating and Converting User Input>>
* <<seeAlsoTransaction,See Also>>
-10. <<language,Adding Language Support>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=10]
+. <<language,Adding Language Support>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -5056,11 +5718,15 @@
1. Open the link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot7.zip[+project snapshot+] for this tutorial unit in the IDE. Click the Open Project ( image::images/open-project-btn.png[] ) button and use the wizard to navigate to the location on your computer where you downloaded the project. If you are proceeding from the <<manage-sessions,previous tutorial unit>>, note that this project snapshot is identical to the state of the project after completing the previous unit, but with the following exceptions:
* The `confirmation.jsp` page is fully implemented.
* The `affablebean.css` stylesheet includes rules specific to the `confirmation.jsp` page implementation.
-2. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
+
+[start=2]
+. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
If you receive an error when running the project, revisit the <<setup,setup instructions>>, which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Test the application's functionality in your browser. In particular, step through the entire link:design.html#business[+business process flow+]. When you click the submit an order from the checkout page, the confirmation page currently displays as follows:
+
+[start=3]
+. Test the application's functionality in your browser. In particular, step through the entire link:design.html#business[+business process flow+]. When you click the submit an order from the checkout page, the confirmation page currently displays as follows:
image::images/confirmation-page-start.png[title="Confirmation page displays without any data relating to the processed order"]
No data related to the order is displayed on the confirmation page. In fact, in its current state the application doesn't do anything with the data from the checkout form. By the end of this tutorial unit, the application will gather customer data and use it to process an order. In its final state, the application will display a summary of the processed order on the confirmation page, remove the user's `ShoppingCart` and terminate the user session. (link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot8.zip[+Snapshot 8+] completes the request-response cycle when a checkout form is submitted.)
@@ -5072,7 +5738,9 @@
1. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.) In the New File wizard, select the Java EE category, then select Session Bean.
2. Click Next. Name the EJB '`OrderManager`', place the EJB in the `session` package, and accept other default settings. (Create a stateless session bean, and do not have the wizard generate an interface for the bean.)
image::images/ejb-wizard.png[title="Create a stateless EJB session bean using the Session Bean wizard"]
-3. Click Finish. The new `OrderManager` class is generated and opens in the editor.
+
+[start=3]
+. Click Finish. The new `OrderManager` class is generated and opens in the editor.
@@ -5085,7 +5753,9 @@
Press Ctrl-G to use the Go To Line dialog.
image::images/go-to-line.png[title="Use the Go to Line dialog to quickly navigate to a specific line"]
-3. Implement code that extracts the parameters from a submitted checkout form. Locate the `TODO: Implement purchase action` comment, delete it, and add the following:
+
+[start=3]
+. Implement code that extracts the parameters from a submitted checkout form. Locate the `TODO: Implement purchase action` comment, delete it, and add the following:
[source,java]
----
@@ -5131,8 +5801,12 @@
*@EJB
private OrderManager orderManager;*
----
-2. Press Ctrl-Shift-I (�:-Shift-I on Mac) to allow the editor to add an import statement for `session.OrderManager`.
-3. Use the extracted parameters, as well as the session `cart` object, as arguments for the `OrderManager.placeOrder` method. Add the following code:
+
+[start=2]
+. Press Ctrl-Shift-I (�:-Shift-I on Mac) to allow the editor to add an import statement for `session.OrderManager`.
+
+[start=3]
+. Use the extracted parameters, as well as the session `cart` object, as arguments for the `OrderManager.placeOrder` method. Add the following code:
[source,java]
----
@@ -5161,7 +5835,9 @@
--
image::images/tool-tip-create-method.png[role="left", link="images/tool-tip-create-method.png"]
--
-4. Click the tip. The IDE generates the `placeOrder` method in the `OrderManager` class.
+
+[start=4]
+. Click the tip. The IDE generates the `placeOrder` method in the `OrderManager` class.
[source,java]
----
@@ -5177,7 +5853,9 @@
}
----
The import statement for `cart.ShoppingCart` is also automatically inserted at the top of the file.
-5. In the new `placeOrder` method, use the method arguments to make calls to the (yet nonexistent) helper methods. Enter the following:
+
+[start=5]
+. In the new `placeOrder` method, use the method arguments to make calls to the (yet nonexistent) helper methods. Enter the following:
[source,java]
----
@@ -5190,8 +5868,12 @@
}
----
Note that we need to follow a particular order due to database constraints. For example, a `Customer` record needs to be created before the `CustomerOrder` record, since the `CustomerOrder` requires a reference to a `Customer`. Likewise, the `OrderedItem` records require a reference to an existing `CustomerOrder`.
-6. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `entity.Customer` and `entity.CustomerOrder` are automatically added to the top of the file.
-7. Use the editor hints to have the IDE generate method signatures for `addCustomer`, `addOrder`, and `addOrderedItems`. After utilizing the three hints, the `OrderManager` class looks as follows.
+
+[start=6]
+. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `entity.Customer` and `entity.CustomerOrder` are automatically added to the top of the file.
+
+[start=7]
+. Use the editor hints to have the IDE generate method signatures for `addCustomer`, `addOrder`, and `addOrderedItems`. After utilizing the three hints, the `OrderManager` class looks as follows.
[source,java]
----
@@ -5221,7 +5903,9 @@
}
----
Note that an error is still flagged in the editor, due to the fact that the method is currently lacking a return statement. The `placeOrder` signature indicates that the method returns an `int`. As will later be demonstrated, the method returns the order ID if it has been successfully processed, otherwise `0` is returned.
-8. Enter the following return statement.
+
+[start=8]
+. Enter the following return statement.
[source,java]
----
@@ -5235,7 +5919,9 @@
}
----
At this stage, all errors in the `OrderManager` class are resolved.
-9. Begin implementing the three helper methods. For now, simply add code that applies each method's input parameters to create new entity objects.
+
+[start=9]
+. Begin implementing the three helper methods. For now, simply add code that applies each method's input parameters to create new entity objects.
==== addCustomer
@@ -5316,9 +6002,13 @@
}*
}
----
-10. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. A dialog opens to display all classes that will be imported. Note that the dialog correctly guesses for `java.util.List`.
+
+[start=10]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. A dialog opens to display all classes that will be imported. Note that the dialog correctly guesses for `java.util.List`.
image::images/fix-all-imports.png[title="Press Ctrl-Shift-I to fix imports in a file"]
-11. Click OK. All necessary import statements are added, and the class becomes free of any compiler errors.
+
+[start=11]
+. Click OK. All necessary import statements are added, and the class becomes free of any compiler errors.
@@ -5367,8 +6057,12 @@
...
}
----
-2. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `javax.persistence.EntityManager` and `javax.persistence.PersistenceContext` are added to the top of the class.
-3. Use the `EntityManager` to mark entity objects to be written to the database. This is accomplished using the `persist` method in the `EntityManager` API. Make the following modifications to the helper methods.
+
+[start=2]
+. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `javax.persistence.EntityManager` and `javax.persistence.PersistenceContext` are added to the top of the class.
+
+[start=3]
+. Use the `EntityManager` to mark entity objects to be written to the database. This is accomplished using the `persist` method in the `EntityManager` API. Make the following modifications to the helper methods.
==== addCustomer
@@ -5469,9 +6163,13 @@
In the coming steps, you are going to examine the server log in the IDE's Output window. Before submitting the checkout form, open the Output window and clear the server log. You can accomplish this by right-clicking in the server log and choosing Clear (Ctrl-L; ⌘-L on Mac).
-3. Click the 'submit purchase' button. The server responds with an HTTP status 500 message.
+
+[start=3]
+. Click the 'submit purchase' button. The server responds with an HTTP status 500 message.
image::images/gf-error-report.png[title="Server responds with an HTTP status 500 message"]
-4. Switch to the IDE and examine the server log. The server log is located in the Output window (Ctrl-4; ⌘-4 on Mac) under the GlassFish server tab. You come across the following text.
+
+[start=4]
+. Switch to the IDE and examine the server log. The server log is located in the Output window (Ctrl-4; ⌘-4 on Mac) under the GlassFish server tab. You come across the following text.
[source,java]
----
@@ -5488,10 +6186,14 @@
Maximize the Output window by pressing Shift-Esc.
The underlines displayed in the server log form links allowing you to navigate directly to the lines in your source files where errors are occurring.
-5. Click the link to `session.OrderManager.addOrderedItems`. The editor displays the line that is causing the exception.
+
+[start=5]
+. Click the link to `session.OrderManager.addOrderedItems`. The editor displays the line that is causing the exception.
image::images/null-pointer-exception.png[title="Click links in server output window to navigate directly to offending lines in source files"]
To understand why `order.getId` method returns `null`, consider what the code is actually trying to accomplish. The `getId` method attempts to get the ID of an order which is currently in the process of being created. Since the ID is an auto-incrementing primary key, the database automatically generates the value only when the record is added. One way to overcome this is to manually synchronize the persistence context with the database. This can be accomplished using the `EntityManager`'s link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html#flush%28%29[+`flush`+] method.
-6. In the `addOrderedItems` method, add a call to flush the persistence context to the database.
+
+[start=6]
+. In the `addOrderedItems` method, add a call to flush the persistence context to the database.
[source,java]
----
@@ -5522,9 +6224,15 @@
}
}
----
-7. Rerun the project and step through the business process flow. This time, when you submit the checkout form the confirmation page displays.
-8. To confirm that the details have been recorded in the database, open the IDE's Services window (Ctrl-5; ⌘-5 on Mac). Locate the `affablebean` connection node. If the node appears broken ( image::images/connection-broken.png[] ), right-click the node and choose Connect.
-9. Drill into the connection and locate the `affablebean` database's `customer` table. Right-click the table and choose View Data. A graphical display of the `customer` table appears in the editor. The customer details that you added in the checkout form display as a record in the table.
+
+[start=7]
+. Rerun the project and step through the business process flow. This time, when you submit the checkout form the confirmation page displays.
+
+[start=8]
+. To confirm that the details have been recorded in the database, open the IDE's Services window (Ctrl-5; ⌘-5 on Mac). Locate the `affablebean` connection node. If the node appears broken ( image::images/connection-broken.png[] ), right-click the node and choose Connect.
+
+[start=9]
+. Drill into the connection and locate the `affablebean` database's `customer` table. Right-click the table and choose View Data. A graphical display of the `customer` table appears in the editor. The customer details that you added in the checkout form display as a record in the table.
image::images/customer-record.png[title="View Data menu option performs a 'select *' query on the selected table"]
In this manner, you can also examine the `customer_order` and `ordered_product` tables to determine whether data has been recorded.
@@ -5557,7 +6265,9 @@
According to the link:http://jcp.org/aboutJava/communityprocess/final/jsr318/index.html[+EJB Specification+], container-managed transactions are enabled by default for session beans. Furthermore, if you examine the Javadoc for both of the above annotations, you will rightly point out that `CONTAINER` is the default `TransactionManagementType`, and `REQUIRED` is the default `TransactionAttributeType`. In other words, neither of the two annotations is required for your code to run properly. However, it is often helpful to explicitly include default settings in your sources to improve readability.
-2. Currently, the `placeOrder` method returns the ID of the processed order. In the event that the transaction fails and the order isn't processed, have the method return '`0`'. Use a `try-catch` expression.
+
+[start=2]
+. Currently, the `placeOrder` method returns the ID of the processed order. In the event that the transaction fails and the order isn't processed, have the method return '`0`'. Use a `try-catch` expression.
[source,java]
----
@@ -5625,7 +6335,9 @@
If you'd like to see more templates, consult the Keyboard Shortcuts Card. The Keyboard Shortcuts Card provides a list of commonly-used code templates and keyboard shortcuts. Choose Help > Keyboard Shortcuts Card from the main menu.
-3. Add the following code. Explanation follows.
+
+[start=3]
+. Add the following code. Explanation follows.
[source,java]
----
@@ -5654,7 +6366,9 @@
You can test this by commenting out the `em.flush()` line you previously added. This way, you know that the first two methods (`addCustomer` and `addOrder`) process successfully, but the third method (`addOrderedItems`) fails. Run the project and submit the checkout form in the browser. Since the transaction doesn't roll back, the customer and order records are written to the database, but any ordered items are not. This leads to a situation where the database is corrupt.
To overcome this, you explicitly set the transaction for rollback in the `catch` clause. The above `@Resource` annotation is applied to grab an instance of the EJB's current `SessionContext`. The transaction is marked for rollback using the `setRollbackOnly` method.
-4. Run the project and step through the business process flow. When you submit an order, return to the IDE and examine the server log. You'll see output similar to the following:
+
+[start=4]
+. Run the project and step through the business process flow. When you submit an order, return to the IDE and examine the server log. You'll see output similar to the following:
[.feature]
--
image::images/transaction-output.png[role="left", link="images/transaction-output.png"]
@@ -5904,9 +6618,15 @@
* <<multilingual,Making Pages Multilingual>>
* <<toggle,Implementing a Language Toggle>>
* <<seeAlsoLanguage,See Also>>
-11. <<security,Securing the Application>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=11]
+. <<security,Securing the Application>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -6023,26 +6743,38 @@
If you receive an error when running the project, revisit the <<setup,setup instructions>>, which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Begin by creating a default resource bundle to contain text used in page views. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
-4. Under Categories select Other, then under File Types select Properties File.
+
+[start=3]
+. Begin by creating a default resource bundle to contain text used in page views. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.)
+
+[start=4]
+. Under Categories select Other, then under File Types select Properties File.
image::images/new-file-wzd.png[title="Create a new resource bundle using the File wizard"]
Note that the wizard provides a description for the selected file type:
[quote]
----
_Creates a resource bundle (`.properties`) file suitable for internationalizing applications by separating out all human-visible text strings from your code. Resource bundle files can also be used to collect other types of strings, such as properties for Ant scripts. The created resource bundle contains only one locale, but you can add additional locales from the created file's contextual menu. The bundle can be edited in a text file (property-file format) for a specific locale or in a table that displays information for all locales._
----
-5. Click Next. In the Name and Location step, name the file `messages` and type in `src/java/resources` in the Folder field. This will instruct the wizard to place the resource bundle in a new package named `resources`.
+
+[start=5]
+. Click Next. In the Name and Location step, name the file `messages` and type in `src/java/resources` in the Folder field. This will instruct the wizard to place the resource bundle in a new package named `resources`.
image::images/new-properties-file-wzd.png[title="Specify the name and location of the resource bundle"]
-6. Click Finish. The `messages.properties` resource bundle is generated and opens in the editor.
+
+[start=6]
+. Click Finish. The `messages.properties` resource bundle is generated and opens in the editor.
Note that the new `messages.properties` file name does not have a language code appended to it, as was previously described. This is because this file will be used as the _default_ resource bundle. The default resource bundle is applied when the Java runtime environment does not find a direct match for the requested locale.
-7. Open the project's `index.jsp` file in the editor and note that the following text is currently used:
+
+[start=7]
+. Open the project's `index.jsp` file in the editor and note that the following text is currently used:
* *Greeting:* `Welcome to the online home of the Affable Bean Green Grocer.`
* *Introductory Message:* `Enjoy browsing and learning more about our unique home delivery service bringing you fresh organic produce, dairy, meats, breads and other delicious and healthy items to your doorstep.`
Also, note that we'll need language-specific names for the four categories that display when `index.jsp` renders in the browser. Since these names are currently taken from the database, we can use them as keys in the resource bundle.
Recall that one of the <<impDeets,implementation details>> outlined above states that "_if the browser's preferred language is neither English nor Czech, the site displays text in English._" Therefore, the values that we apply to the `messages.properties` file will be in English.
-8. In the `messages.properties` file, begin adding key-value pairs for the text used in the welcome page. Add the following content.
+
+[start=8]
+. In the `messages.properties` file, begin adding key-value pairs for the text used in the welcome page. Add the following content.
[source,java]
----
@@ -6060,22 +6792,34 @@
Comments are added using a number sign ('`#`'). Also, because the `fruit & veg` category name contains spaces, it is necessary to escape the space characters using a backslash ('`\`') in order to apply the name as a resource bundle key.
We are now finished with the default resource bundle for the application's welcome page. Let's continue by creating resource bundles for the customer-specified languages.
-9. In the Projects window, expand the Source Packages node, then right-click the `resources` > `messages.properties` file node and choose Customize. The Customizer dialog opens.
-10. In the Customizer dialog, click the Add Locale button. In the New Locale dialog that displays, enter '`en`' in the Language Code combo box, then click OK.
+
+[start=9]
+. In the Projects window, expand the Source Packages node, then right-click the `resources` > `messages.properties` file node and choose Customize. The Customizer dialog opens.
+
+[start=10]
+. In the Customizer dialog, click the Add Locale button. In the New Locale dialog that displays, enter '`en`' in the Language Code combo box, then click OK.
image::images/new-locale-dialog.png[title="The New Locale dialog enables you to add a new locale to an existing resource bundle base name"]
A _locale_ can be defined by both a language and a geographic region. The optional country code which can be used to specify the region can be applied to define formatting for dates, time, numbers, and currency. For more information, see the technical article, link:http://java.sun.com/developer/technicalArticles/J2SE/locale/[+Understanding Locale in the Java Platform+].
-11. Click the Add Locale button again, then enter '`cs`' in the Language Code combo box and click OK. The Customizer dialog displays as follows.
+
+[start=11]
+. Click the Add Locale button again, then enter '`cs`' in the Language Code combo box and click OK. The Customizer dialog displays as follows.
image::images/customizer-dialog.png[title="The New Locale dialog enables you to add a new locale to an existing resource bundle base name"]
-12. Click Close. In the Projects window, note that your resource bundles look as follows. You can expand a resource bundle to view the keys it contains.
+
+[start=12]
+. Click Close. In the Projects window, note that your resource bundles look as follows. You can expand a resource bundle to view the keys it contains.
image::images/projects-window.png[title="View resource bundles and the keys they contain in the Projects window"]
-13. Right-click any of the three resource bundles and choose Open. The Properties editor opens, enabling you to view and edit key-value pairs for all locales in a table layout.
+
+[start=13]
+. Right-click any of the three resource bundles and choose Open. The Properties editor opens, enabling you to view and edit key-value pairs for all locales in a table layout.
Press Shift-Esc to maximize the window in the IDE.
Note that when you add a new locale using the Customizer dialog, as you did for English and Czech in the previous steps, the keys and values of the default resource bundle are copied to the new locale.
-14. Modify the values for the Czech resource bundle. You can do this by _either_ clicking into the table cells for each row and typing your entries directly _or_ selecting the cell you want to edit and typing into the *Value* field located at the bottom of the Properties editor.
+
+[start=14]
+. Modify the values for the Czech resource bundle. You can do this by _either_ clicking into the table cells for each row and typing your entries directly _or_ selecting the cell you want to edit and typing into the *Value* field located at the bottom of the Properties editor.
* *greeting:* `VÄ‚Âtejte vĂ‚Â našem domácÄ‚Âm on-line obchodÄ› Affable Bean Green Grocer.`
* *introText:* `Naše jedineÄŤná dodávková sluĹľba Vám zajistÄ‚Â dopravu ÄŤerstvÄ‚Ëťch organickÄ‚Ëťch produktĹŻ, mlĂ©ÄŤnÄ‚Ëťch vÄ‚ËťrobkĹŻ, uzenin, peÄŤiva a dalšĂÂch delikates a zdravÄ‚Ëťch vÄ‚ËťrokĹŻ aĹľ ke dveĹ™ĂÂm.`
* *dairy:* `mléčné výrobky`
@@ -6085,7 +6829,9 @@
You can also add a comment to each key-value pair. Any text you enter into the *Comment* field in the Properties editor is added to the resource bundle text file above the key-value pair as a comment (i.e., following a '`#`' sign).
-15. Double-click the `messages_cs.properties` file node in the Projects window. Note that the text file has been updated according to your changes in the Properties editor.
+
+[start=15]
+. Double-click the `messages_cs.properties` file node in the Projects window. Note that the text file has been updated according to your changes in the Properties editor.
[source,java]
----
@@ -6126,8 +6872,12 @@
The `LocalizationContext` class belongs to the `javax.servlet.jsp.jstl.fmt` package. You can verify this by viewing the link:http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html[+JSTL 1.1 API Reference+] online.
-4. Click OK. The new context parameter is added to the table of existing context parameters under the General tab.
-5. Click the deployment descriptor's XML tab. Note that the following entry has been added to the file:
+
+[start=4]
+. Click OK. The new context parameter is added to the table of existing context parameters under the General tab.
+
+[start=5]
+. Click the deployment descriptor's XML tab. Note that the following entry has been added to the file:
[source,xml]
----
@@ -6158,7 +6908,9 @@
</div>
</div>
----
-3. Add `<fmt:message>` tags for the four category names, but use the `${category.name}` expression as the value for the `key` attribute. Since the category name is also used as the value for the `<img>` tag's `alt` attribute, follow the same procedure. The page's right column will look as follows.
+
+[start=3]
+. Add `<fmt:message>` tags for the four category names, but use the `${category.name}` expression as the value for the `key` attribute. Since the category name is also used as the value for the `<img>` tag's `alt` attribute, follow the same procedure. The page's right column will look as follows.
[source,html]
----
@@ -6177,7 +6929,9 @@
</c:forEach>
</div>
----
-4. Finally, ensure that you have the `fmt` tag library declared in the web page. Enter the following at the top of the file:
+
+[start=4]
+. Finally, ensure that you have the `fmt` tag library declared in the web page. Enter the following at the top of the file:
[source,java]
----
@@ -6235,12 +6989,22 @@
1. In Firefox, choose Tools > Options (Firefox > Preferences on Mac). In the window that displays, click the Content tab.
image::images/firefox-content.png[title="Examine your browser's preferred languages"]
-2. Under the Languages heading, click Choose.
-3. Select any language that is currently listed in the provided text area, then click Remove. (You should remember your language list and reinstate languages after completing this tutorial.)
-4. Click the 'Select Language to Add' drop-down and select `Czech [cs]`. Then click the Add button. The Czech language is added to the text area.
+
+[start=2]
+. Under the Languages heading, click Choose.
+
+[start=3]
+. Select any language that is currently listed in the provided text area, then click Remove. (You should remember your language list and reinstate languages after completing this tutorial.)
+
+[start=4]
+. Click the 'Select Language to Add' drop-down and select `Czech [cs]`. Then click the Add button. The Czech language is added to the text area.
image::images/firefox-languages.png[title="Specify your browser's preferred languages"]
-5. Click OK, then press Esc to close Firefox' Options window.
-6. Run the project ( image::images/run-project-btn.png[] ). When the welcome page opens in your browser, note that text is displayed in Czech.
+
+[start=5]
+. Click OK, then press Esc to close Firefox' Options window.
+
+[start=6]
+. Run the project ( image::images/run-project-btn.png[] ). When the welcome page opens in your browser, note that text is displayed in Czech.
image::images/czech-text.png[title="The displayed language is determined by your browser's language preferences"]
@@ -6260,7 +7024,9 @@
1. Use the Go to File dialog to open the `header` JSP fragment in the editor. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then type '`h`' in the dialog and click OK.
image::images/go-to-file-dialog.png[title="Use the Go to File dialog to quickly open project resources in the editor"]
-2. In the `header.jspf` file, locate the first `<div class="headerWidget">` tag (line 56), and replace the `[ language toggle ]` placeholder text with the following HTML markup.
+
+[start=2]
+. In the `header.jspf` file, locate the first `<div class="headerWidget">` tag (line 56), and replace the `[ language toggle ]` placeholder text with the following HTML markup.
[source,html]
----
@@ -6277,10 +7043,14 @@
Snapshot 8 includes the link:http://jquery.com/[+jQuery+] JavaScript library and takes advantage of various UI effects to enhance the appearance and behavior of the website. Aside from a link:http://plugins.jquery.com/project/validate[+jQuery plugin for client-side validation+] (discussed in the link:transaction.html#client[+previous tutorial unit+]), the snapshot implements an easing effect for category headings in the welcome page, as well as for category buttons in the category page. Configuration is included in `header.jspf` of the project snapshot. Rounded corners are implemented using CSS3's link:http://www.w3.org/TR/css3-background/#corners[+border-radius+] property (applied in `affablebean.css`).
-3. Run the project ( image::images/run-project-btn.png[] ) to see what the toggle looks like in the browser.
+
+[start=3]
+. Run the project ( image::images/run-project-btn.png[] ) to see what the toggle looks like in the browser.
image::images/language-toggle.png[title="Run the project to view the language toggle"]
Currently, the language toggle appears as in the above image regardless of what language the page displays in. In the next step, you integrate JSTL logic into the toggle so that it renders according to the language displayed on the page.
-4. Modify the toggle implementation as follows.
+
+[start=4]
+. Modify the toggle implementation as follows.
[source,html]
----
@@ -6343,7 +7113,9 @@
*Note:* The above implementation uses `<c:url>` tags to set up the toggle link. This is done in order to properly encode the request URL in the event that URL rewriting is used as a means for session tracking. Unit 8, link:manage-sessions.html#encodeUrl[+Managing Sessions+] provides a brief explanation of how the `<c:url>` tags can be used.
-5. Add a basic language test to the `header.jspf` file. This will enable us to check whether the toggle is properly rendering according to the client request's preferred language. Enter the following after the page's `<body>` tag.
+
+[start=5]
+. Add a basic language test to the `header.jspf` file. This will enable us to check whether the toggle is properly rendering according to the client request's preferred language. Enter the following after the page's `<body>` tag.
[source,html]
----
@@ -6358,8 +7130,12 @@
<div id="main">
----
-6. Ensure that you have set Czech as your browser's preferred language. (If you are following this tutorial unit sequentially, you've already done this. If not, refer to the steps outlined above in <<test,Test Supported Languages>>.)
-7. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
+
+[start=6]
+. Ensure that you have set Czech as your browser's preferred language. (If you are following this tutorial unit sequentially, you've already done this. If not, refer to the steps outlined above in <<test,Test Supported Languages>>.)
+
+[start=7]
+. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
image::images/language-test.png[title="Language toggle displays according to request's preferred language"]
If your browser's preferred language is set to Czech, you can note the following:
* The test that we introduced in the previous step indicates that '`cs`' is the preferred language.
@@ -6392,7 +7168,9 @@
String language = request.getParameter("language");*
}
----
-3. Place the `language` parameter in the request scope. Add the following.
+
+[start=3]
+. Place the `language` parameter in the request scope. Add the following.
[source,java]
----
@@ -6407,7 +7185,9 @@
request.setAttribute("language", language);*
}
----
-4. As a temporary measure, have the application forward the response to the `index.jsp` welcome page when the language toggle link is clicked. Add the following code.
+
+[start=4]
+. As a temporary measure, have the application forward the response to the `index.jsp` welcome page when the language toggle link is clicked. Add the following code.
[source,java]
----
@@ -6431,7 +7211,9 @@
}
----
Naturally, forwarding the user to the welcome page regardless of what page he or she is on is not an ideal way to handle the language toggle's behavior. We'll return to this matter in the next sub-section, <<keepTrack,Enable the Application to Keep Track of the Originating Page View>>. For the meantime however, this will allow us to examine the results of the current language toggle implementation when running the project.
-5. Switch to the `header.jspf` fragment (If the file is already opened in the editor, press Ctrl-Tab and choose the file.) and apply the link:http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/setLocale.html[+`<fmt:setLocale>`+] tag to set the page language based on the new `language` variable. Add the following.
+
+[start=5]
+. Switch to the `header.jspf` fragment (If the file is already opened in the editor, press Ctrl-Tab and choose the file.) and apply the link:http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/setLocale.html[+`<fmt:setLocale>`+] tag to set the page language based on the new `language` variable. Add the following.
[source,xml]
----
@@ -6454,7 +7236,9 @@
You can read the EL expression `${!empty language}` as, "False if the `language` variable is null or an empty string." See the link:http://download-llnw.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaim[+Java EE 5 Tutorial: Examples of EL Expressions+] for other available examples.
-6. Modify the language toggle implementation so that if a value has been set by the `<fmt:setLocale>` tag, the toggle displays according to the language specified by that value. (You can determine this value using the `${sessionScope['javax.servlet.jsp.jstl.fmt.locale.session']}` expression.)
+
+[start=6]
+. Modify the language toggle implementation so that if a value has been set by the `<fmt:setLocale>` tag, the toggle displays according to the language specified by that value. (You can determine this value using the `${sessionScope['javax.servlet.jsp.jstl.fmt.locale.session']}` expression.)
Enclose the current implementation within `<c:choose>` tags, and create logic similar to the current implementation in the event that the locale has been manually set. (Changes are displayed in *bold*.)
@@ -6523,7 +7307,9 @@
</div>
----
-7. Before examining the project in a browser, add another test that displays the value set by the `<fmt:setLocale>` tag. Add the following code beneath the test you created earlier.
+
+[start=7]
+. Before examining the project in a browser, add another test that displays the value set by the `<fmt:setLocale>` tag. Add the following code beneath the test you created earlier.
[source,xml]
----
@@ -6551,16 +7337,24 @@
For more information, refer to the Java EE 5 Tutorial: link:http://download-llnw.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaif[+Unified Expression Language: Resolving Expressions+].
-8. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
+
+[start=8]
+. Run the project ( image::images/run-project-btn.png[] ) and examine the application welcome page in the browser.
image::images/toggle-page1.png[title="Welcome page displays according to browser's preferred language"]
In the above image, the server identifies Czech (`cs`) as the browser's preferred language from the `Accept-Language` HTTP header. This is indicated from the first test. The page displays in Czech, and the language toggle enables the user to choose English. The second test remains blank as the `<fmt:setLocale>` tag has not yet been called.
-9. Click the toggle link for English.
+
+[start=9]
+. Click the toggle link for English.
image::images/toggle-page2.png[title="Welcome page displays in English, according to toggle selection"]
When clicking the toggle link, the default Czech language is overridden by means of the `<fmt:setLocale>` tag implemented in the `header.jspf` file. Although the browser's preferred language remains Czech, you see that the page now displays according to the new language made available by the language toggle.
-10. Click the toggle link for Czech.
+
+[start=10]
+. Click the toggle link for Czech.
image::images/toggle-page3.png[title="Welcome page displays in Czech, according to toggle selection"]
Changing the language back to the browser's preferred language works as expected, however note that the deciding factor is no longer the language detected from the `Accept-Language` HTTP header, but is the language specified from the `<fmt:setLocale>` tag.
-11. Before continuing, remove the tests you added to the `header.jspf` file. (Deleted code in *[.line-through]#strike-through#* text.)
+
+[start=11]
+. Before continuing, remove the tests you added to the `header.jspf` file. (Deleted code in *[.line-through]#strike-through#* text.)
[source,html]
----
@@ -6593,7 +7387,9 @@
If you receive an error when running the project, revisit the <<setup,setup instructions>>, which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Use link:http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/c/set.html[+`<c:set>`+] tags to set a session-scoped `view` attribute for each of the page views. Open each of the page views in the editor and add the following code to the top of each file.
+
+[start=3]
+. Use link:http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/c/set.html[+`<c:set>`+] tags to set a session-scoped `view` attribute for each of the page views. Open each of the page views in the editor and add the following code to the top of each file.
==== index.jsp
@@ -6649,7 +7445,9 @@
Based on customer-agreed <<impDeets,implementation details>>, we do not need to provide a means of switching languages on the confirmation page view. From a usability perspective, a user will have already selected his or her preferred language prior to checkout. From an implementation perspective, recall that we destroy the user session upon a successfully completed order. (Refer back to the final paragraph in <<manage-sessions,Managing Sessions>>, which describes how to apply the `invalidate` method to explicitly terminate a user session.) If the Affable Bean staff were to insist on allowing customers to view their orders bilingually, you would need to consider the following scenarios, dependent on whether you destroy the user session upon displaying the confirmation page:
1. *Session destroyed:* Would be necessary to take extra measures to ensure that a `chooseLanguage` request from the confirmation page refers to the appropriate order, and can display customer-sensitive details in a secure fashion.
2. *Session maintained:* Would risk enabling users to mistakenly place double orders on their shopping cart. Also, by not terminating user sessions when they are no longer needed, an unnecessary load may be placed on the server.
-4. Open the `ControllerServlet` in the editor. (If already opened, press Ctrl-Tab and choose the file.) In the opened file, locate the portion of the `doGet` method that handles the `chooseLanguage` request (line 126).
+
+[start=4]
+. Open the `ControllerServlet` in the editor. (If already opened, press Ctrl-Tab and choose the file.) In the opened file, locate the portion of the `doGet` method that handles the `chooseLanguage` request (line 126).
Note that currently `chooseLanguage` requests are forwarded to the `index.jsp` welcome page.
@@ -6674,7 +7472,9 @@
return;*
}
----
-5. Use the `view` session attribute to forward the request back to the originating page view. Make the following changes (in *bold*).
+
+[start=5]
+. Use the `view` session attribute to forward the request back to the originating page view. Make the following changes (in *bold*).
[source,java]
----
@@ -6723,8 +7523,12 @@
ex.printStackTrace();
}
----
-6. Run the project ( image::images/run-project-btn.png[] ) to test it in the browser. When you navigate to the category, cart or checkout pages, switch languages using the language toggle. When you do so, you now remain within the same page view.
-7. In the browser, complete an order so that the application forwards you to the confirmation page. When you click the language toggle from the confirmation page, note that you are sent back to the website's welcome page.
+
+[start=6]
+. Run the project ( image::images/run-project-btn.png[] ) to test it in the browser. When you navigate to the category, cart or checkout pages, switch languages using the language toggle. When you do so, you now remain within the same page view.
+
+[start=7]
+. In the browser, complete an order so that the application forwards you to the confirmation page. When you click the language toggle from the confirmation page, note that you are sent back to the website's welcome page.
Implementation-wise, you may consider this to be sufficient. However, the Affable Bean staff have explicitly asked you to remove the language toggle from this page view. One way to accomplish this is to perform a test to determine whether the request _servlet path_ contains '`/confirmation`'.
@@ -6764,15 +7568,21 @@
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
----
-8. Run the project again and step through to the confirmation page. Note that the page no longer displays the language toggle.
+
+[start=8]
+. Run the project again and step through to the confirmation page. Note that the page no longer displays the language toggle.
image::images/confirmation-page.png[title="Language toggle no longer displays in confirmation page"]
-9. In the browser, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page inadvertently switches back to the originally displayed language. You may rightly identify the cause: upon a successfully completed order, the `ControllerServlet` destroys the user session and consequently the session-scoped locale that was set using the `<fmt:setLocale>` tag is also lost.
+
+[start=9]
+. In the browser, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page inadvertently switches back to the originally displayed language. You may rightly identify the cause: upon a successfully completed order, the `ControllerServlet` destroys the user session and consequently the session-scoped locale that was set using the `<fmt:setLocale>` tag is also lost.
To remedy this, open the `ControllerServlet` and locate the `invalidate()` method which is used to destroy user sessions (approximately line 259).
Use the editor's quick search facility: press Ctrl-F (⌘-F on Mac) and type in '`invalidate`'.
-10. Add code that extracts the session-scoped locale value prior to destroying the user session and resets the request-scoped `language` attribute to the locale value after the session has been destroyed. (Changes in *bold*.)
+
+[start=10]
+. Add code that extracts the session-scoped locale value prior to destroying the user session and resets the request-scoped `language` attribute to the locale value after the session has been destroyed. (Changes in *bold*.)
[source,java]
----
@@ -6807,7 +7617,9 @@
userPath = "/confirmation";
}
----
-11. Run the project and again, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page now displays in the language you selected.
+
+[start=11]
+. Run the project and again, step through to the confirmation page but switch languages once along the way using the language toggle. Note that when you complete an order, the confirmation page now displays in the language you selected.
You have now successfully integrated language support into the `AffableBean` application according to customer specification. You've factored out all text from page views, placed it into resource bundles, and have applied JSTL's `fmt` tag library to use resource bundle content based on the user's preferred language. You also implemented a language toggle that enables users to switch between English and Czech, and override their browser's default language choice. Download and examine link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot10.zip[+snapshot 10+] to compare your work with the state of the project at the end of this tutorial unit.
@@ -6877,8 +7689,12 @@
* <<usersGroups,Creating Users, Groups and Roles>>
* <<secureTransport,Configuring Secure Data Transport>>
* <<seeAlsoSecurity,See Also>>
-12. <<test-profile,Testing and Profiling>>
-13. <<conclusion,Conclusion>>
+
+[start=12]
+. <<test-profile,Testing and Profiling>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -6936,7 +7752,9 @@
If you receive an error when running the project, revisit the <<setup,setup instructions>>, which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Test the application's functionality in your browser. This snapshot provides an implementation of the administration console, as specified in the link:design.html#requirements[+customer requirements+]. To examine the administration console, enter the following URL in your browser:
+
+[start=3]
+. Test the application's functionality in your browser. This snapshot provides an implementation of the administration console, as specified in the link:design.html#requirements[+customer requirements+]. To examine the administration console, enter the following URL in your browser:
[source,java]
----
@@ -6955,7 +7773,9 @@
Likewise, you can view an order summary for each customer either by selecting an order from the administration console's "orders" table, or by clicking the "view order summary" link in a "customer details" display.
image::images/view-order-summary.png[title="Click 'view order summary' from a customer details display in order to view a customer's order details"]
Naturally, none of this information should be available to an anonymous site visitor. In the coming steps, you'll create login and error pages, so that when an unauthenticated user attempts to access the administration console, he or she will be directed to the login page. Upon successful login, the user is then redirected to the administration console's menu; upon login failure, the error page is displayed.
-4. Examine the project snapshot in the Projects window.
+
+[start=4]
+. Examine the project snapshot in the Projects window.
|===
|image::images/projects-window.png[title="The AdminServlet forwards requests to resources within the web/admin folder"] |
@@ -6974,7 +7794,9 @@
|===
-5. In the browser, return to the customer website by clicking the Affable Bean logo in the upper left corner of the web page. Step through the entire link:design.html#business[+business process flow+] of the application and note that the checkout process is handled over a non-secure channel.
+
+[start=5]
+. In the browser, return to the customer website by clicking the Affable Bean logo in the upper left corner of the web page. Step through the entire link:design.html#business[+business process flow+] of the application and note that the checkout process is handled over a non-secure channel.
When customers reach the checkout page, they are expected to submit sensitive personal information in order to complete their orders. Part of your task in this tutorial unit is to ensure that this data is sent over a secure channel. Because the administration console also enables authenticated users to view customers' personal information, it too needs to be configured so that data is sent over the Internet securely.
@@ -7053,9 +7875,13 @@
2. Name the file `login`, then click Finish. The new `login.jsp` file is created and opens in the editor.
3. Repeat the previous two steps to create a new `error.jsp` file. In the New JSP wizard, name the file `error`. When you finish, you'll have two new files listed in the Projects window.
image::images/projects-window-jsp.png[title="New JSP file nodes displayed in Projects window"]
-4. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
+
+[start=4]
+. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
image::images/go-to-file.png[title="Use the Go to File dialog to quickly open files in the editor"]
-5. In the editor, scroll to the bottom of the `web.xml` file and note the `<jsp-property-group>` entry created for JSP pages in the administration console. Add the new login and error JSP pages as `<url-pattern>` entries. (Changes in *bold*.)
+
+[start=5]
+. In the editor, scroll to the bottom of the `web.xml` file and note the `<jsp-property-group>` entry created for JSP pages in the administration console. Add the new login and error JSP pages as `<url-pattern>` entries. (Changes in *bold*.)
[source,xml]
----
@@ -7073,7 +7899,9 @@
You can equally configure the `<jsp-property-group>` entry from the `web.xml`'s visual editor. Click the Pages tab along the top of the editor, and enter the URL patterns into the respective JSP Property Group.
-6. Press Ctrl-Tab to switch to the `login.jsp` file in the editor. Delete the entire template contents for the file, then enter the following HTML form.
+
+[start=6]
+. Press Ctrl-Tab to switch to the `login.jsp` file in the editor. Delete the entire template contents for the file, then enter the following HTML form.
[source,html]
----
@@ -7091,7 +7919,9 @@
</form>
----
Note that the HTML form is based on the <<template,template provided above>>. Here, you use the "`j_security_check`" keyword as the value for the form's `action` attribute, and the "`j_username`" and "`j_password`" keywords as the values for the `name` attribute of the username and password text fields. The style of the form is implemented by encapsulating the form widgets within a `<div>` element, then defining a set of rules for the `loginBox` ID in `affablebean.css`.
-7. Press Ctrl-Tab and switch to the `error.jsp` file in the editor. Delete the entire template contents for the file, then enter the following.
+
+[start=7]
+. Press Ctrl-Tab and switch to the `error.jsp` file in the editor. Delete the entire template contents for the file, then enter the following.
[source,html]
----
@@ -7119,7 +7949,9 @@
* *Form Error Page:* `/admin/error.jsp`
* *Realm Name:* `file`
image::images/login-configuration.png[title="Specify security settings for the application using the IDE's web.xml visual editor"]
-4. Click the XML tab along the top of the editor and verify the changes made to the deployment descriptor. The following entry has been added to the bottom of the file:
+
+[start=4]
+. Click the XML tab along the top of the editor and verify the changes made to the deployment descriptor. The following entry has been added to the bottom of the file:
[source,xml]
----
@@ -7134,9 +7966,15 @@
</login-config>
----
This entry informs the servlet container that form-based authentication is used, the realm named `file` should be checked for user credentials, and specifies the whereabouts of the login and error pages.
-5. Click the Security tab again, then expand the Security Roles heading and click Add.
-6. In the Add Security Role dialog, type in `affableBeanAdmin` for the role name, then click OK. The new role entry is added beneath Security Roles.
-7. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
+
+[start=5]
+. Click the Security tab again, then expand the Security Roles heading and click Add.
+
+[start=6]
+. In the Add Security Role dialog, type in `affableBeanAdmin` for the role name, then click OK. The new role entry is added beneath Security Roles.
+
+[start=7]
+. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
[source,xml]
----
@@ -7147,18 +7985,30 @@
</security-role>
----
Here we've specified the name of a security role used with the application. We'll need to associate this role with the protected resources that define the administration console (under the Security Constraints heading below), and later we'll <<defineRoles,create this role on the GlassFish server>>.
-8. Click the Security tab again, then click the Add Security Constraint button.
-9. Type in `Admin` for the Display Name, then under Web Resource Collection click the Add button. Enter the following details, then when you are finished, click OK.
+
+[start=8]
+. Click the Security tab again, then click the Add Security Constraint button.
+
+[start=9]
+. Type in `Admin` for the Display Name, then under Web Resource Collection click the Add button. Enter the following details, then when you are finished, click OK.
* *Resource Name:* `Affable Bean Administration`
* *URL Pattern(s):* `/admin/*`
* *HTTP Method(s):* `All HTTP Methods`
image::images/add-web-resource.png[title="Specify which resources need to be protected using the Add Web Resource dialog"]
-10. Under the new Admin security constraint, select the Enable Authentication Constraint option and click the Edit button next to the Role Name(s) text field.
-11. In the dialog that displays, select the `affableBeanAdmin` role in the left column, then click Add. The role is moved to the right column.
+
+[start=10]
+. Under the new Admin security constraint, select the Enable Authentication Constraint option and click the Edit button next to the Role Name(s) text field.
+
+[start=11]
+. In the dialog that displays, select the `affableBeanAdmin` role in the left column, then click Add. The role is moved to the right column.
image::images/edit-role-names.png[title="Specify roles to be associated with an authentication constraint"]
-12. Click OK. The role is added to the Role Name(s) text field.
+
+[start=12]
+. Click OK. The role is added to the Role Name(s) text field.
image::images/security-tab.png[title="Security constraints include specifying the web resource collection, and role(s) that are granted access to the collection"]
-13. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
+
+[start=13]
+. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
[source,xml]
----
@@ -7177,8 +8027,12 @@
</security-constraint>
----
In these previous six steps, you've created a security constraint that specifies which resources need to be protected, and identifies the role(s) that are granted access to them. Since the administration console implementation is essentially everything contained within the application's `admin` folder, you use a wildcard (`*`). Although you've specified that all HTTP methods should be protected, you could have equally selected just GET and POST, since these are the only two that are handled by the `AdminServlet`. As previously mentioned, the `affableBeanAdmin` role that we declared still needs to be created on the GlassFish server.
-14. Run the project ( image::images/run-project-btn.png[] ) to examine how the application now handles access to the administration console.
-15. When the application opens in the browser, attempt to access the administration console by entering the following URL into the browser's address bar:
+
+[start=14]
+. Run the project ( image::images/run-project-btn.png[] ) to examine how the application now handles access to the administration console.
+
+[start=15]
+. When the application opens in the browser, attempt to access the administration console by entering the following URL into the browser's address bar:
[source,java]
----
@@ -7187,7 +8041,9 @@
----
When you attempt to access the administration console, the login page is now presented.
image::images/login-form.png[title="Unauthenticated attempts to access the administration console are redirected to the login page"]
-16. Click the 'submit' button to attempt login. You see the error page displayed.
+
+[start=16]
+. Click the 'submit' button to attempt login. You see the error page displayed.
image::images/error-page.png[title="Error page is displayed when the server is unable to authenticate a user"]
@@ -7248,16 +8104,24 @@
4. Log into the Administration Console by typing `admin` / `adminadmin` for the username / password.
5. In the Tree which displays in the left column of the Administration Console, expand the Configuration > Security > Realms nodes, then click the `file` realm.
image::images/file-realm.png[title="Expand the Configuration > Security > Realms nodes to view existing security realms"]
-6. In the main panel of the GlassFish Administration Console, under Edit Realm, click the Manage Users button.
-7. Under File Users, click the New button.
-8. Under New File Realm User, enter the following details:
+
+[start=6]
+. In the main panel of the GlassFish Administration Console, under Edit Realm, click the Manage Users button.
+
+[start=7]
+. Under File Users, click the New button.
+
+[start=8]
+. Under New File Realm User, enter the following details:
* *User ID:* `nbuser`
* *Group List:* `affableBeanAdmin`
* *New Password:* `secret`
* *Confirm New Password:* `secret`
image::images/new-file-realm-user.png[title="Enter new user and group details in the New File Realm User panel"]
Here, we are creating a user for the `file` security realm, which we've randomly named `nbuser`. We have also assigned the new user to a randomly named `affableBeanAdmin` group. Remember the `secret` password you set, as you will require it to later log into the `AffableBean` administration console.
-9. Click OK. The new `nbuser` user is now listed under File Users in the GlassFish Administration Console.
+
+[start=9]
+. Click OK. The new `nbuser` user is now listed under File Users in the GlassFish Administration Console.
image::images/nbuser-file-realm.png[title="All users and groups pertaining to the 'file' realm are displayed under File Users"]
Optionally close the browser window for the GlassFish Administration Console, or leave it open for the time being. You will need to return to the Administration Console in the <<mapApplication,Map Roles to Users and/or Groups>> step below.
@@ -7362,7 +8226,9 @@
*@RolesAllowed("affableBeanAdmin")*
public CustomerOrder findByCustomer(Object customer) { ... }
----
-3. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.annotation.security.RolesAllowed` is added to the top of the class.
+
+[start=3]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.annotation.security.RolesAllowed` is added to the top of the class.
The `findByCustomer` method is only called by the `AdminServlet`, which is previously authenticated into the `affableBeanAdmin` role using our implementation of form-based authentication. The use of the `@RolesAllowed` annotation here is not strictly necessary - its application simply guarantees that the method can only be called by a user who has been authenticated in the `affableBeanAdmin` role.
@@ -7403,20 +8269,28 @@
The Java EE 6 Tutorial defines the term _principal_ as, "An entity that can be authenticated by an authentication protocol in a security service that is deployed in an enterprise. A principal is identified by using a principal name and authenticated by using authentication data." See link:http://download.oracle.com/javaee/6/tutorial/doc/bnbxj.html#bnbxq[+Working with Realms, Users, Groups, and Roles: Some Other Terminology+] for more information.
-7. Click the Save button.
+
+[start=7]
+. Click the Save button.
At this stage, you have taken the necessary steps to enable you to log into the `AffableBean` administration console using the `nbuser` / `secret` username / password combination that you set earlier.
-8. Run the project ( image::images/run-project-btn.png[] ). When the application opens in the browser, attempt the access the administration console by entering the following URL into the browser's address bar:
+
+[start=8]
+. Run the project ( image::images/run-project-btn.png[] ). When the application opens in the browser, attempt the access the administration console by entering the following URL into the browser's address bar:
[source,java]
----
http://localhost:8080/AffableBean*/admin/*
----
-9. When the login page displays, enter the username and password you set earlier in the GlassFish Administration Console (`nbuser` / `secret`), then click 'submit'.
+
+[start=9]
+. When the login page displays, enter the username and password you set earlier in the GlassFish Administration Console (`nbuser` / `secret`), then click 'submit'.
Using form-based authentication, the server authenticates the client using the username and password credentials sent from the form. Because the `nbuser` belongs to the `affableBeanAdmin` group, and that group is associated with the `affableBeanAdmin` role, access is granted to the administration console.
-10. Click the 'log out' link provided in the administration console. The `nbuser` is logged out of the administration console, and you are returned to the login page.
+
+[start=10]
+. Click the 'log out' link provided in the administration console. The `nbuser` is logged out of the administration console, and you are returned to the login page.
The `AdminServlet` handles the '`/logout`' URL pattern by invalidating the user session:
@@ -7466,7 +8340,9 @@
----
The browser displays a warning, indicating that the server is presenting you with a self-signed certificate. In Firefox for example, the warning looks as follows.
image::images/ff-untrusted-connection.png[title="Firefox provides warnings for self-signed certificates"]
-4. Enable your browser to accept the self-signed certificate. With Firefox, click the Add Exception button displayed in the warning. The following pane displays, allowing you to view the certificate.
+
+[start=4]
+. Enable your browser to accept the self-signed certificate. With Firefox, click the Add Exception button displayed in the warning. The following pane displays, allowing you to view the certificate.
image::images/ff-confirm-security-exception.png[title="Firefox enables you to view the digital certificate before confirming the security exception"]
Click Confirm Security Exception. A secure connection is established on port 8181, and your local development server, GlassFish, is then able to display the following page.
image::images/gf-https.png[title="GlassFish provides a secure connection by default on port 8181"]
@@ -7474,17 +8350,25 @@
Aside from the HTTPS protocol displayed in the browser's address bar, Firefox indicates that a secure connection is established with the blue background behind `localhost` in the address bar. Also, a lock ( image::images/firefox-lock-icon.png[] ) icon displays in the lower right corner of the browser. You can click the lock icon for secure pages to review certificate details.
The following optional steps demonstrate how you can identify this security support in the GlassFish Administration Console.
-5. Open the GlassFish Administration Console in the browser. (Either type '`http://localhost:4848/`' in your browser, or click the '`go to the Administration Console`' link in the GlassFish server's welcome page, as displayed in the <<serverWelcomePage,image above>>.)
-6. In the Tree which displays in the left column of the Administration Console, expand the Configuration > Network Config nodes, then click the Network Listeners node.
+
+[start=5]
+. Open the GlassFish Administration Console in the browser. (Either type '`http://localhost:4848/`' in your browser, or click the '`go to the Administration Console`' link in the GlassFish server's welcome page, as displayed in the <<serverWelcomePage,image above>>.)
+
+[start=6]
+. In the Tree which displays in the left column of the Administration Console, expand the Configuration > Network Config nodes, then click the Network Listeners node.
The main panel displays the three network listeners enabled by default on the GlassFish server. `http-listener-2`, which has been configured to listen over port 8181, is the network listener used for secure connections.
image::images/network-listeners.png[title="View all HTTP listeners from the Network Listeners panel"]
For more information on network listeners, see the Oracle GlassFish Server 3.0.1 Administration Guide: link:http://docs.sun.com/app/docs/doc/821-1751/giuri?l=en&a=view[+About HTTP Network Listeners+].
-7. Under the Name column, click the link for `http-listener-2`. In the main panel, note that the Security checkbox is selected.
+
+[start=7]
+. Under the Name column, click the link for `http-listener-2`. In the main panel, note that the Security checkbox is selected.
image::images/edit-network-listener.png[title="Security is enabled for the 'http-listener-2' network listener"]
-8. Click the SSL tab. Note that TLS is selected. In the lower portion of the SSL panel, you see the Cipher Suites that are available for the connection. As stated in the Oracle GlassFish Server 3.0.1 Administration Guide, link:http://docs.sun.com/app/docs/doc/821-1751/ablnk[+Chapter 11: Administering System Security+],
+
+[start=8]
+. Click the SSL tab. Note that TLS is selected. In the lower portion of the SSL panel, you see the Cipher Suites that are available for the connection. As stated in the Oracle GlassFish Server 3.0.1 Administration Guide, link:http://docs.sun.com/app/docs/doc/821-1751/ablnk[+Chapter 11: Administering System Security+],
[quote]
----
_A cipher is a cryptographic algorithm used for encryption or decryption. SSL and TLS protocols support a variety of ciphers used to authenticate the server and client to each other, transmit certificates, and establish session keys. Some ciphers are stronger and more secure than others. Clients and servers can support different cipher suites. During a secure connection, the client and the server agree to use the strongest cipher that they both have enabled for communication, so it is usually sufficient to enable all ciphers._
@@ -7510,12 +8394,16 @@
*Note:* Recall that the `/checkout` URL pattern is handled by the `ControllerServlet`'s `doGet` method, and forwards the user to the checkout page.
-4. Under the new Checkout security constraint, select the Enable User Data Constraint option, then in the Transport Guarantee drop-down, select `CONFIDENTIAL`.
+
+[start=4]
+. Under the new Checkout security constraint, select the Enable User Data Constraint option, then in the Transport Guarantee drop-down, select `CONFIDENTIAL`.
image::images/checkout-security-constraint.png[title="Use the web.xml visual editor to specify security settings for the application"]
When you choose `CONFIDENTIAL` as a security constraint, you are instructing the server to encrypt data using TLS/SSL so that it cannot be read while in transit. For more information, see the Java EE 6 Tutorial, link:http://download.oracle.com/javaee/6/tutorial/doc/gkbaa.html#bncbm[+Specifying a Secure Connection+].
-5. Click the XML tab along the top of the editor. Note that the following `<security-constraint>` entry has been added.
+
+[start=5]
+. Click the XML tab along the top of the editor. Note that the following `<security-constraint>` entry has been added.
[source,xml]
----
@@ -7534,8 +8422,12 @@
</security-constraint>
----
Configuration for the customer checkout process is now complete. To ensure that a secure connection is applied for access to the administration console, simply specify that any requests handled by the `AdminServlet` are transmitted over a secure channel.
-6. Open the `AdminServlet`. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`admin`', then click OK.
-7. Use the link:http://download.oracle.com/javaee/6/api/javax/servlet/annotation/HttpConstraint.html[+`@HttpConstraint`+] annotation's `transportGuarantee` element to specify a `CONFIDENTIAL` security constraint. Make the following change (in *bold*).
+
+[start=6]
+. Open the `AdminServlet`. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`admin`', then click OK.
+
+[start=7]
+. Use the link:http://download.oracle.com/javaee/6/api/javax/servlet/annotation/HttpConstraint.html[+`@HttpConstraint`+] annotation's `transportGuarantee` element to specify a `CONFIDENTIAL` security constraint. Make the following change (in *bold*).
[source,java]
----
@@ -7553,12 +8445,20 @@
)
public class AdminServlet extends HttpServlet { ... }
----
-8. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.servlet.annotation.ServletSecurity.TransportGuarantee` is added to the top of the class.
-9. Run the project ( image::images/run-project-btn.png[] ) to examine the application's behavior in a browser.
-10. In the browser, step through the `AffableBean` website by selecting a product category and adding several items to your shopping cart. Then click the 'proceed to checkout' button. The website now automatically switches to a secure channel when presenting the checkout page. You see the HTTPS protocol displayed in the browser's address bar, and the port is changed to 8181.
+
+[start=8]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.servlet.annotation.ServletSecurity.TransportGuarantee` is added to the top of the class.
+
+[start=9]
+. Run the project ( image::images/run-project-btn.png[] ) to examine the application's behavior in a browser.
+
+[start=10]
+. In the browser, step through the `AffableBean` website by selecting a product category and adding several items to your shopping cart. Then click the 'proceed to checkout' button. The website now automatically switches to a secure channel when presenting the checkout page. You see the HTTPS protocol displayed in the browser's address bar, and the port is changed to 8181.
image::images/secure-checkout.png[title="The browser address bar indicates that a secure connection is established for customer checkout"]
Also, in Firefox, note the lock ( image::images/firefox-lock-icon.png[] ) icon displayed in the lower right corner of the browser.
-11. Investigate security for the administration console. Type in the following URL into the browser's address bar:
+
+[start=11]
+. Investigate security for the administration console. Type in the following URL into the browser's address bar:
[source,java]
----
@@ -7644,7 +8544,9 @@
* <<profile,Using the NetBeans Profiler>>
* <<glassFishTune,Tuning the GlassFish Server>>
* <<seeAlsoTestProfile,See Also>>
-13. <<conclusion,Conclusion>>
+
+[start=13]
+. <<conclusion,Conclusion>>
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -7701,16 +8603,24 @@
If you receive an error when running the project, revisit the <<setup,setup instructions>>, which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL. If you want to log into the project's administration console (not required in this tutorial unit), you'll need to create a user named `nbuser` on the GlassFish server. This task is described in Unit 11, link:security.html#createUsers[+Securing the Application: Create Users and/or Groups on the Server+].
-3. Open the IDE's Plugins Manager by choosing Tools > Plugins from the main menu. Select the Available Plugins tab, then type in '`jmeter`' into the Search field. When you see JMeter Kit displayed from the filtered results, select it by clicking the checkbox under the Install column.
+
+[start=3]
+. Open the IDE's Plugins Manager by choosing Tools > Plugins from the main menu. Select the Available Plugins tab, then type in '`jmeter`' into the Search field. When you see JMeter Kit displayed from the filtered results, select it by clicking the checkbox under the Install column.
image::images/plugins-manager.png[title="JMeter Kit is a NetBeans certified plugin available in the Plugins Manager"]
-4. Click Install. The IDE's installer informs you that two plugins will be installed: The JMeter Kit and the Load Generator, which provides a generic infrastructure for load generator engines registered in the IDE.
+
+[start=4]
+. Click Install. The IDE's installer informs you that two plugins will be installed: The JMeter Kit and the Load Generator, which provides a generic infrastructure for load generator engines registered in the IDE.
image::images/ide-installer.png[title="Plugins dependencies are automatically included during installation"]
-5. Click Next. Accept the license agreement, then click Install.
+
+[start=5]
+. Click Next. Accept the license agreement, then click Install.
You require an Internet connection to download the selected plugins.
The installer downloads, verifies, and installs the plugins. When installation has successfully completed, click Finish to exit the installer, then click Close to close the Plugins Manager.
-6. In the Projects window, note that a new Load Generator Scripts node displays in your project.
+
+[start=6]
+. In the Projects window, note that a new Load Generator Scripts node displays in your project.
image::images/load-generator-scripts.png[title="The Load Generator plugin enables you to access scripts from the Projects window"]
If you open the Files window (Ctrl-2; ⌘-2 on Mac), you'll see a new `jmeter` folder added to the project. (Recall that the Files window provides a directory-based view of projects, i.e., it displays the folder structure of projects as they exist on your computer's file system.) The `jmeter` folder corresponds to the Project window's Load Generator Scripts node, and will contain any load scripts that you later add to the project.
@@ -7753,24 +8663,42 @@
Instead of scrolling to the bottom of the list, simply begin typing '`load`'. As shown in the image below, the Load Testing Scripts category displays.
image::images/file-wizard-load.png[title="You can filter category entries by typing the category you are searching for"]
-3. Expand the Load Testing Scripts category and select *JMeter Plans*. Under File Types, select *New JMeter Plan*, then click Next.
-4. Name the plan `useCaseTest`, then click Finish. The new test plan displays in the Projects window.
+
+[start=3]
+. Expand the Load Testing Scripts category and select *JMeter Plans*. Under File Types, select *New JMeter Plan*, then click Next.
+
+[start=4]
+. Name the plan `useCaseTest`, then click Finish. The new test plan displays in the Projects window.
image::images/use-case-test.png[title="JMeter test plans display under Load Testing Scripts in the Projects window"]
-5. To begin customizing the plan in JMeter, right-click the `useCaseTest.jmx` node and choose External Edit. JMeter opens.
+
+[start=5]
+. To begin customizing the plan in JMeter, right-click the `useCaseTest.jmx` node and choose External Edit. JMeter opens.
image::images/jmeter.png[title="NetBeans template plan is provided when opening JMeter"]
*Note:* The NetBeans template plan includes various user-defined variables, as shown in the above image. Usage of several of these variables will become clear as we work with the test plan. For more information, see the Apache JMeter User's Manual: link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#User_Defined_Variables[+18.4.13 User Defined Variables+].
-6. Click the HTTP Request Defaults node in the left column. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request_Defaults[+HTTP Request Defaults+] panel enables you to set default values for all HTTP requests invoked from your test plan. Note that the entries for Server Name and Port Number are `${nb.server}` and `${nb.port}`, respectively. From the image above, you see that these equate to `localhost` and `8080`, which you typically use when deploying NetBeans projects to GlassFish.
-7. Click the Thread Group node in the left column. In JMeter, a "thread" refers to a user. Let's rename the Thread Group to `AffableBean` `Users`. Type '`AffableBean` `Users`' into the Name field under Thread Group.
+
+[start=6]
+. Click the HTTP Request Defaults node in the left column. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request_Defaults[+HTTP Request Defaults+] panel enables you to set default values for all HTTP requests invoked from your test plan. Note that the entries for Server Name and Port Number are `${nb.server}` and `${nb.port}`, respectively. From the image above, you see that these equate to `localhost` and `8080`, which you typically use when deploying NetBeans projects to GlassFish.
+
+[start=7]
+. Click the Thread Group node in the left column. In JMeter, a "thread" refers to a user. Let's rename the Thread Group to `AffableBean` `Users`. Type '`AffableBean` `Users`' into the Name field under Thread Group.
Let's begin recording requests for the test plan. To do so, we'll use JMeter's link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Proxy_Server[+HTTP Proxy Server+]. Instead of entering test plan requests manually, we'll run the proxy server and have it record requests sent from the browser. For large test plans this technique is invaluable.
-8. In the left column, right-click WorkBench and choose Add > Non-Test Elements > HTTP Proxy Server.
-9. In the HTTP Proxy Server panel, change the port number from `8080` to another, random number, for example `9090`. JMeter provides `8080` as its default port number for the proxy server. However, the GlassFish server also occupies the `8080` port, so we're modifying the proxy server's port number to avoid a port conflict.
-10. In the Grouping drop-down list, select 'Put each group in a new controller'. Also, deselect the 'Capture HTTP Headers' option. We do not require header information for each recorded request.
+
+[start=8]
+. In the left column, right-click WorkBench and choose Add > Non-Test Elements > HTTP Proxy Server.
+
+[start=9]
+. In the HTTP Proxy Server panel, change the port number from `8080` to another, random number, for example `9090`. JMeter provides `8080` as its default port number for the proxy server. However, the GlassFish server also occupies the `8080` port, so we're modifying the proxy server's port number to avoid a port conflict.
+
+[start=10]
+. In the Grouping drop-down list, select 'Put each group in a new controller'. Also, deselect the 'Capture HTTP Headers' option. We do not require header information for each recorded request.
image::images/http-proxy-server.png[title="Configure the proxy server"]
Note that the 'Use Recording Controller' option is selected by default for the Target Controller field. When you begin recording requests, they will be stored in the Recording Controller that is listed in the left column.
-11. Switch to your browser and temporarily change its port number to `9090`.
+
+[start=11]
+. Switch to your browser and temporarily change its port number to `9090`.
If you have previously configured your browser's proxy, remember your settings so that you may be able to reenter them after completing this exercise.
@@ -7782,27 +8710,45 @@
* Remove the `127.0.0.1` and `localhost` entries in the 'No Proxy for' field.
image::images/firefox-proxy.png[title="Specify 'localhost:9090' and remove entries in the 'No Proxy for' field"]
* Click OK.
-12. Clear your browser's cache before you begin recording requests. You want to make sure that the HTTP Proxy Server is able to record all resources required for displaying pages in the Affable Bean website, including images, JavaScript scripts and CSS stylesheets.
+
+[start=12]
+. Clear your browser's cache before you begin recording requests. You want to make sure that the HTTP Proxy Server is able to record all resources required for displaying pages in the Affable Bean website, including images, JavaScript scripts and CSS stylesheets.
In Firefox, you can do this by pressing Ctrl-Shift-Del (⌘-Shift-Del on Mac) to open the Clear Recent History dialog. Under 'Time range to clear', ensure that you've selected a range that extends to the first time the browser accessed the Affable Bean website. Select Cache, then click Clear Now.
image::images/ff-clear-recent-history.png[title="Clear your browser's cache before proceeding with recording"]
-13. Return to the JMeter Test Plan panel (<<testPlanPanel,shown above>>) and change the values for `nb.users` and `nb.rampup` to `99`.
+
+[start=13]
+. Return to the JMeter Test Plan panel (<<testPlanPanel,shown above>>) and change the values for `nb.users` and `nb.rampup` to `99`.
image::images/user-defined-variables.png[title="Double-click into User Defined Variables table to modify variables"]
The reason this is recommended is that JMeter automatically inserts user-defined variables throughout the test plan, wherever their values occur. So, for example, when the URL for `/AffableBean/js/jquery-1.4.2.js` is encountered, it will be recorded as: `AffableBean/js/jquery-1.4.*${nb.users}*.js`. Later, when we modify the value and rerun the test plan, URLs such as this will also change, which is not desired behavior. Here, we enter a random value (`99`), since we don't expect it to occur in the URLs that we are about to record.
-14. Return to the HTTP Proxy Server panel, then at the bottom of the panel, click the Start button. JMeter's proxy server is now listening on port 9090.
-15. Run the project ( image::images/run-project-btn.png[] ) from the IDE. The project is deployed to GlassFish, and the welcome page opens in the browser.
-16. Switch to JMeter and inspect the Recording Controller in the left column. All of the requests generated for accessing the welcome page are listed under the Recording Controller in a node named after the first request (i.e., `/AffableBean/`).
+
+[start=14]
+. Return to the HTTP Proxy Server panel, then at the bottom of the panel, click the Start button. JMeter's proxy server is now listening on port 9090.
+
+[start=15]
+. Run the project ( image::images/run-project-btn.png[] ) from the IDE. The project is deployed to GlassFish, and the welcome page opens in the browser.
+
+[start=16]
+. Switch to JMeter and inspect the Recording Controller in the left column. All of the requests generated for accessing the welcome page are listed under the Recording Controller in a node named after the first request (i.e., `/AffableBean/`).
image::images/recording-controller.png[title="Request grouping for welcome page displayed under Recording Controller"]
If you inspect the `/AffableBean/` node, you'll note that it is a link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Simple_Controller[+Simple Controller+]. Although dubbed a "Controller", the Simple Controller doesn't offer any functionality beyond enabling you to group elements together - as demonstrated here.
-17. Return to the browser and continue clicking through the website according to the use-case <<useCase,outlined above>>. You can select any of the categories and products. Stop when you reach the checkout page - the proxy server will not be able to record requests sent over HTTPS.^<<footnote1TestProfile,[1]>>^
+
+[start=17]
+. Return to the browser and continue clicking through the website according to the use-case <<useCase,outlined above>>. You can select any of the categories and products. Stop when you reach the checkout page - the proxy server will not be able to record requests sent over HTTPS.^<<footnote1TestProfile,[1]>>^
The elements within the Recording Controller will look as follows.
image::images/recording-controller2.png[title="Requests according to use-case listed under Recording Controller"]
-18. Stop the proxy server. Click the Stop button in JMeter's HTTP Proxy Server panel.
-19. In your browser, change the proxy configuration so that it no longer uses port 9090. In Firefox for example, return to the proxy configuration window (<<ff-proxy-config,displayed above>>) and select No Proxy.
-20. Manually create the request for `/AffableBean/purchase`. Perform the following steps:
+
+[start=18]
+. Stop the proxy server. Click the Stop button in JMeter's HTTP Proxy Server panel.
+
+[start=19]
+. In your browser, change the proxy configuration so that it no longer uses port 9090. In Firefox for example, return to the proxy configuration window (<<ff-proxy-config,displayed above>>) and select No Proxy.
+
+[start=20]
+. Manually create the request for `/AffableBean/purchase`. Perform the following steps:
1. Click the Simple Controller in JMeter's left column, then press Ctrl-X (⌘-X on Mac) to cut the element.
2. Click the Recording Controller, then press press Ctrl-V (⌘-V on Mac) to paste the element. The Simple Controller now displays beneath the `/AffableBean/checkout` request.
3. Click the Simple Controller node, then in its main panel rename the controller to `/AffableBean/purchase`.
@@ -7814,7 +8760,9 @@
* *Protocol:* `https`
* *Method:* `POST`
* *Path:* `/AffableBean/purchase`
-6. Under 'Send Parameters With the Request', click the Add button and create the following entries:
+
+[start=6]
+. Under 'Send Parameters With the Request', click the Add button and create the following entries:
|===
|Name |Value |Encode? |Include Equals?
@@ -7832,23 +8780,31 @@
|`creditcard` |`4444222233331111` |✓ |✓
|===
image::images/http-request.png[title="Configure an HTTP Request for HTTPS connection"]
-21. Now, add an link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager[+HTTP Cookie Manager+] to the test plan. Right-click the `AffableBean` `Users` thread group node in JMeter's left column, then choose Add > Config Element > HTTP Cookie Manager.
+
+[start=21]
+. Now, add an link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager[+HTTP Cookie Manager+] to the test plan. Right-click the `AffableBean` `Users` thread group node in JMeter's left column, then choose Add > Config Element > HTTP Cookie Manager.
Recall that the `AffableBean` application relies on a session-tracking mechanism (i.e., cookies or URL-rewriting) to remember which shopping cart belongs to which request. Therefore, we need to account for this in the test plan. JMeter acts as the client when sending requests to the server, however unlike a browser, it doesn't have cookies "enabled by default." We apply the HTTP Cookie Manager to the thread group so that the `JSESSIONID` cookie can be passed between client and server.
*Note:* If you want to employ URL rewriting as the session-tracking mechanism, you would need to add the link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_URL_Re-writing_Modifier[+HTTP URL Re-writing Modifier+] to the thread group.
-22. Finally, add an element to the test plan that simulates a delay between user-initiated requests.
+
+[start=22]
+. Finally, add an element to the test plan that simulates a delay between user-initiated requests.
1. Right-click the `/AffableBean/` Simple Controller in the left column and choose Add > Sampler > Test Action.
2. In the main panel, specify the following:
* *Name:* `user delay`
* *Duration (milliseconds):* `${nb.interleave}`
image::images/test-action.png[title="Use a Test Action element to simulate a delay between user-initiated requests"]
-3. In JMeter's left column, copy (Ctrl-C; ⌘-C on Mac) the new `user` `delay` Test Action node, then paste it (Ctrl-V; ⌘-V on Mac) into each of the other Simple Controllers ( image::images/simple-controller-node.png[] ) that form the test plan, except for the final one (`/AffableBean/purchase`).
+
+[start=3]
+. In JMeter's left column, copy (Ctrl-C; ⌘-C on Mac) the new `user` `delay` Test Action node, then paste it (Ctrl-V; ⌘-V on Mac) into each of the other Simple Controllers ( image::images/simple-controller-node.png[] ) that form the test plan, except for the final one (`/AffableBean/purchase`).
When you finish, the final six Simple Controllers and their contents will look as follows.
image::images/user-delay.png[title="Use copy and paste functionality to place existing elements elsewhere in your test plan"]
-23. (_Optional_.) Clean up the test plan. You can remove the Loop Controller and Constant Timer. (Right-click and choose Remove.) Also, move all of the Recording Controller's child elements directly into the `AffableBean` `Users` thread group, then remove the Recording Controller. When you finish, the test plan will look as follows.
+
+[start=23]
+. (_Optional_.) Clean up the test plan. You can remove the Loop Controller and Constant Timer. (Right-click and choose Remove.) Also, move all of the Recording Controller's child elements directly into the `AffableBean` `Users` thread group, then remove the Recording Controller. When you finish, the test plan will look as follows.
image::images/test-plan.png[title="Remove unnecessary items from test plan"]
@@ -7867,17 +8823,25 @@
*Note:* If you did not create the JMeter test plan in the <<createTestPlan,previous sub-section>>, you can download the complete link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FuseCaseTest.jmx[+`useCaseTest.jmx`+] file and add it to your project. To add it to the `AffableBean` project, copy it from your computer's file system (Ctrl-C; ⌘-C on Mac), then in the IDE, open the Files window (Ctrl-2; ⌘-2 on Mac), right-click the `jmeter` folder and choose Paste.
-2. Add several _listeners_ to the test plan:
+
+[start=2]
+. Add several _listeners_ to the test plan:
* Right-click `AffableBean` `Users` and choose Add > Listener > *Summary Report*.
* Right-click `AffableBean` `Users` and choose Add > Listener > *View Results Tree*.
* Right-click `AffableBean` `Users` and choose Add > Listener > *Graph Results*.
In JMeter, you require a _listener_ to record and display the results of your test plan. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Summary_Report[+Summary Report+] displays a table, with each row corresponding to each differently named request in your test. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#View_Results_Tree[+View Results Tree+] shows a tree of all sample responses, allowing you to view response details for any sample. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Graph_Results[+Graph Results+] listener displays a simple graph that plots all sample times.
-3. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
+
+[start=3]
+. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
* *`nb.users`:* `1`
* *`nb.interleave`:* `5000`
We begin the test by simulating just one user. The value for `nb.interleave` is used in the `user` `delay` Test Action that we created, and represents the duration of a pause in milliseconds. Therefore, the test will pause for 5 seconds between each user-initiated request.
-4. Click the Summary Report node so that you are able to view the test results while the test is running.
-5. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu.
+
+[start=4]
+. Click the Summary Report node so that you are able to view the test results while the test is running.
+
+[start=5]
+. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu.
The test plan runs for approximately 50 seconds. Note that request samples are taken every three seconds, during which you can watch as results are added and updated. Note that values for the `Average`, `Min`, and `Max` columns are represented in milliseconds.
image::images/summary-report.png[title="Summary Report displays results from the completed test plan"]
@@ -7892,7 +8856,9 @@
For further information, see the official jQuery documentation: link:http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery[+CDN Hosted jQuery+].
-6. Click the View Results Tree node. Here you see the individual results from each of the sample requests, listed in the order in which they occurred.
+
+[start=6]
+. Click the View Results Tree node. Here you see the individual results from each of the sample requests, listed in the order in which they occurred.
image::images/view-results-tree.png[title="View Results Tree displays a tree of all sample responses listed in the order in which they occurred"]
The green ( image::images/jmeter-ok-icon.png[] ) icons indicate an HTTP status response of 200. In the above image, under 'Sampler result' in the right panel, note that the Thread Name for the selected sample is 'AffableBean Users 1-1'. The second '1' represents the thread (i.e., user) number. When testing multiple threads, you can use View Results Tree listener to pinpoint exactly when each thread makes a request within the test. Finally, in the image above, note that the 'HTML (download embedded resources)' option is selected in the lower left corner. When you select the 'Response data' tab in the right panel, JMeter attempts to render the response as it would display in a browser.
@@ -7900,13 +8866,21 @@
In the coming steps, we'll add an increasing number of users to the test, and examine the server's overall throughput.
-7. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
+
+[start=7]
+. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
* *`nb.users`:* `20`
* *`nb.rampup`:* `20`
The `nb.rampup` variable is used in the `AffableBean` `Users` Thread Group panel, and specifies the ramp-up period in seconds. In this case, if we test 20 users and the ramp-up period is 20 seconds, then a new user will begin sending requests every second.
-8. Clear the results from the previous test by choosing Run > Clear All (Ctrl-E; ⌘-E on Mac).
-9. Click the Graph Results node so that you are able to view the test results while the test is running.
-10. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu. When the test plan runs, make the following observations:
+
+[start=8]
+. Clear the results from the previous test by choosing Run > Clear All (Ctrl-E; ⌘-E on Mac).
+
+[start=9]
+. Click the Graph Results node so that you are able to view the test results while the test is running.
+
+[start=10]
+. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu. When the test plan runs, make the following observations:
* A green square displays in the upper right corner of the interface, indicating that the test plan is running. Adjacent to the square is a ratio listing the number of active threads against the total number of threads being tested. For example, image::images/jmeter-active-threads.png[] demonstrates that the test is running, and that there are currently 15 active threads of a total of 20. Because of the ramp-up period, you should notice that the number of active threads increases each second to 20, remains at 20 for some time, then gradually decreases to zero, at which the square becomes gray indicating that the test has terminated.
* You can filter the graphs you wish to display by selecting the checkboxes above the graph. For an explanation of Median and Deviation, refer to the link:http://jakarta.apache.org/jmeter/usermanual/glossary.html[+JMeter User's Manual Glossary+]. The image below displays graphs for Average and Throughput only. The metric values provided at the bottom of the graph apply to the most recent sample.
* From the green line designating throughput, we see that the server was able to maintain a nearly consistent value as the load increased to 20 users. Toward the end of the test, as user number decreases, we see that the throughput slightly lessens. We can assume that this is simply due to the fact that there are fewer requests per unit of time.
@@ -8042,19 +9016,29 @@
*NetBeans 6.8 note:* The `useCaseTestRandom.jmx` script is not compatible with the JMeter Kit plugin for NetBeans 6.8. Because the script utilizes various logic controllers which unfortunately are not available in JMeter version 2.2, it will not run on the JMeter implementation in NetBeans 6.8. In order to become familiar with the Profiler, use `useCaseTest.jmx` in this exercise instead. If you use `useCaseTest.jmx`, you need to set the load script to run continuously. To do so, open the script in JMeter, select the `AffableBeanUsers` thread group, then in the main panel, select the 'Forever' checkbox for the Loop Count field.
-2. If you are running the Profiler for the first time, you need to perform a calibration step on the JDK. To do so, choose Profile > Advanced Commands > Run Profiler Calibration. For more information, refer to the NetBeans User FAQ wiki: link:http://wiki.netbeans.org/FaqProfilerCalibration[+What exactly does the Profiler Calibration mean?+].
-3. Click the Profile Project ( image::images/profile-btn.png[] ) button. When a project is profiled for the first time, its build script must be modified to enable profiling. The IDE warns you that it will modify the project's build script.
+
+[start=2]
+. If you are running the Profiler for the first time, you need to perform a calibration step on the JDK. To do so, choose Profile > Advanced Commands > Run Profiler Calibration. For more information, refer to the NetBeans User FAQ wiki: link:http://wiki.netbeans.org/FaqProfilerCalibration[+What exactly does the Profiler Calibration mean?+].
+
+[start=3]
+. Click the Profile Project ( image::images/profile-btn.png[] ) button. When a project is profiled for the first time, its build script must be modified to enable profiling. The IDE warns you that it will modify the project's build script.
image::images/enable-profiling.png[title="The project build script must be modified to enable profiling"]
*Note:* You can undo this action at a later point by choosing Profile > Advanced Commands > Unintegrate Profiler from the main menu. Alternatively, you can switch to the Files window, delete your project's `build.xml` file, then rename the `build-before-profiler.xml` file to `build.xml`.
-4. Click OK. The project's build file is modified, and the Profiler window opens for the project. The window enables you to select from one of three profiling tasks:
+
+[start=4]
+. Click OK. The project's build file is modified, and the Profiler window opens for the project. The window enables you to select from one of three profiling tasks:
* *Monitor Application:* Provides obtain high-level information about properties of the target JVM, including thread activity and memory allocations.
* *Analyze Performance:* Provides detailed data on application performance, including the time to execute methods and the number of times the method is invoked.
* *Analyze Memory:* Provides detailed data on object allocation and garbage collection.
-5. Click the Monitor button in the left column. Select the 'LoadGenerator Script' option, then choose `useTestCaseRandom.jmx` from the drop-down list.
+
+[start=5]
+. Click the Monitor button in the left column. Select the 'LoadGenerator Script' option, then choose `useTestCaseRandom.jmx` from the drop-down list.
image::images/monitor-application.png[title="Profiler window opens, enabling task selection and configuration"]
-6. Click Run. The IDE takes the following actions:
+
+[start=6]
+. Click Run. The IDE takes the following actions:
* Starts the GlassFish server in profile mode. (If the server is already running, it is first stopped.)
* Deploys the web application to GlassFish.
* Starts a profiling session, attaches the profiler to the server, and opens the Profiler Control Panel in the IDE.
@@ -8063,15 +9047,21 @@
*Note:* If the profiler does not run the load script after starting the application in profile mode, you can invoke it yourself. From the Projects window, right-click the script and choose External Edit. Then, in JMeter, press Ctrl-R (⌘-R on Mac) to run the script. If the left-hand graph displayed by the VM Telemetry Overview depicts the purple area as remaining horizontal (shown below), you can be fairly certain that the load script is not running.
image::images/vm-telemetry-overview-heap.png[title="The server is loaded, but the load script is not running"]
-7. In the Profiler Control Panel, click the Threads ( image::images/threads-btn.png[] ) button. The Threads window opens to display all threads maintained by the server while the application is running. You can select Live Threads Only, or Finished Threads Only in drop-down at the top of the window in order to filter the display according to live or finished threads.
+
+[start=7]
+. In the Profiler Control Panel, click the Threads ( image::images/threads-btn.png[] ) button. The Threads window opens to display all threads maintained by the server while the application is running. You can select Live Threads Only, or Finished Threads Only in drop-down at the top of the window in order to filter the display according to live or finished threads.
image::images/live-threads.png[title="View live threads maintained by the server at runtime"]
You can select the Enable Threads Monitoring option in the Profiler window (displayed <<profilerWindow,above>>). This will trigger the Threads window to open by default when running the Profiler.
-8. In the Profiler Control Panel, click the VM Telemetry ( image::images/vm-telemetry-btn.png[] ) button.
+
+[start=8]
+. In the Profiler Control Panel, click the VM Telemetry ( image::images/vm-telemetry-btn.png[] ) button.
Similar to the VM Telemetry Overview, the VM Telemetry window provides views on the JVM heap, garbage collection (GC), as well as threads and loaded classes.
-9. Ensure that the Memory (Heap) tab is selected at the bottom of the window, then allow the Profiler to monitor the heap while the load script runs against the application.
+
+[start=9]
+. Ensure that the Memory (Heap) tab is selected at the bottom of the window, then allow the Profiler to monitor the heap while the load script runs against the application.
You can hover your cursor over the graph to view real-time measurements of the heap size versus the used heap.
image::images/heap-popup.png[title="Hover your cursor over the graph for a real-time display of heap measurements"]
@@ -8181,9 +9171,15 @@
1. In the Administration Console Tree, expand the Configuration node, then click Thread Pools.
The GlassFish server provides two thread pools by default. The `http-thread-pool` thread pool is configured for use by network listeners, while `thread-pool-1` is configured for use by the ORB (object request broker) for RMI/IIOP requests. (A stand-alone web application deployed over a non-distributed environment, such as the `AffableBean` application, relies on the `http-thread-pool` by default.)
-2. Under the Thread Pool ID column, click `http-thread-pool`.
-3. In the *Max Thread Pool Size* field, adjust the maximum number of threads available to the thread pool.
-4. Click the Save button in the upper right corner, and then restart the server.
+
+[start=2]
+. Under the Thread Pool ID column, click `http-thread-pool`.
+
+[start=3]
+. In the *Max Thread Pool Size* field, adjust the maximum number of threads available to the thread pool.
+
+[start=4]
+. Click the Save button in the upper right corner, and then restart the server.
[[tip10]]
@@ -8203,7 +9199,9 @@
* *Pool Resize Quantity:* (`pool-resize-quantity`) Number of connections to be removed when pool idle timeout expires.
* *Idle Timeout:* (`idle-timeout-in-seconds`) Maximum time that connection can remain idle in the pool.
* *Max Wait Time:* (`max-wait-time-in-millis`) Amount of time caller waits before connection timeout is sent.
-3. Click the Save button in the upper right corner, and then restart the server.
+
+[start=3]
+. Click the Save button in the upper right corner, and then restart the server.
Connection pool settings can also be specified in the `sun-resources.xml` descriptor:
@@ -8633,9 +9631,15 @@
2. Open the IDE's SQL editor. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `affablebean` database connection ( image::images/db-connection-node.png[] ) node and choose Execute Command.
image::images/execute-command.png[title="Choose Execute Command from a connection node to open the IDE's SQL editor"]
The IDE's SQL editor opens.
-3. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
-4. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the database, and sample data is added to the `product` and `category` tables.
-3. *Create a connection pool and JDBC resource on GlassFish.*
+
+[start=3]
+. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
+
+[start=4]
+. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the database, and sample data is added to the `product` and `category` tables.
+
+[start=3]
+. *Create a connection pool and JDBC resource on GlassFish.*
1. In the Services window (Ctrl-5; ⌘-5 on Mac), expand the Servers > GlassFish Server 3 node and choose Properties. In the Servers window that displays, make sure the 'Enable JDBC Driver Deployment' option is selected. If your project requires the MySQL link:http://www.mysql.com/downloads/connector/j/[+Connector/J+] driver, this option will ensure that the driver is deployed to GlassFish when your project is deployed. (If the server is already running, you'll need to restart the server.)
2. In the Services window, right-click the GlassFish Server 3 node and choose Start.
3. Once the server is running, right-click the GlassFish Server 3 node and choose View Admin Console.
@@ -8646,25 +9650,43 @@
* *Resource Type:* `javax.sql.ConnectionPoolDataSource`
* *Database Vendor:* `MySql`
image::images/connection-pool.png[title="Specify settings to create a connection pool that connects with a MySQL database"]
-7. Click Next. Accept all defaults and click Finish.
-8. In the Connection Pools interface, click on your newly created `AffableBeanConnectionPool` to make the following change under the General tab:
+
+[start=7]
+. Click Next. Accept all defaults and click Finish.
+
+[start=8]
+. In the Connection Pools interface, click on your newly created `AffableBeanConnectionPool` to make the following change under the General tab:
* *Datasource Classname:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
image::images/datasource-classname.png[title="Set the datasource classname for the connection pool"]
-9. Click Save.
-10. Click the Additional Properties tab and ensure that the following three properties have been set. (There may be other properties listed - these are default settings, however the following three must be set manually.)
+
+[start=9]
+. Click Save.
+
+[start=10]
+. Click the Additional Properties tab and ensure that the following three properties have been set. (There may be other properties listed - these are default settings, however the following three must be set manually.)
* *User:* `root`
* *Password:* `nbuser`
* *URL:* `jdbc:mysql://localhost:3306/affablebean`
image::images/additional-properties.png[title="Set username, password and url to the database"]
-11. Click Save.
-12. Click the General tab, then click Ping. You should see a message indicating that the ping succeeded. The `AffableBeanPool` connection pool can now connect to your MySQL database server.
+
+[start=11]
+. Click Save.
+
+[start=12]
+. Click the General tab, then click Ping. You should see a message indicating that the ping succeeded. The `AffableBeanPool` connection pool can now connect to your MySQL database server.
image::images/ping-succeeded.png[title="Ping the MySQL server to determine whether the connection pool can connect"]
-13. In the Admin Console's Tree in the left column, click the Resources > JDBC > JDBC Resources node. The JDBC Resources interface opens in the main window.
-14. Click the New button to create a new JDBC resource, then enter the following details:
+
+[start=13]
+. In the Admin Console's Tree in the left column, click the Resources > JDBC > JDBC Resources node. The JDBC Resources interface opens in the main window.
+
+[start=14]
+. Click the New button to create a new JDBC resource, then enter the following details:
* *JNDI Name:* `jdbc/affablebean`
* *Connection Pool:* `AffableBeanPool`
image::images/jdbc-resource.png[title="Specify JNDI name and connection pool to create the JDBC resource"]
-15. Click OK.
+
+[start=15]
+. Click OK.
You have set up the MySQL server and can connect to it from the IDE's Services window. You created a database named `affablebean`, and populated the database's `product` and `category` tables with sample data. You then started the GlassFish server, and created a connection pool that enables the server to connect to the `affablebean` database. Finally, you created a JDBC resource which your application can use to reference the server's connection pool.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller.asciidoc
index 86cdb9d..b399548 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Preparing the Page Views and Controller Servlet
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -45,14 +45,30 @@
* <<controller,Creating the Controller Servlet>>
* <<implement,Implementing the Controller Servlet>>
* <<seeAlso,See Also>>
-6. link:connect-db.html[+Connecting the Application to the Database+]
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=6]
+. link:connect-db.html[+Connecting the Application to the Database+]
+
+[start=7]
+. link:entity-session.html[+Adding Entity Classes and Session Beans+]
+
+[start=8]
+. link:manage-sessions.html[+Managing Sessions+]
+
+[start=9]
+. link:transaction.html[+Integrating Transactional Business Logic+]
+
+[start=10]
+. link:language.html[+Adding Language Support+]
+
+[start=11]
+. link:security.html[+Securing the Application+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -160,7 +176,9 @@
</div>*
</body>
----
-3. Add a reference to the stylesheet in the page's head, and change the title text.
+
+[start=3]
+. Add a reference to the stylesheet in the page's head, and change the title text.
[source,xml]
----
@@ -171,7 +189,9 @@
<title>*The Affable Bean*</title>
</head>
----
-4. Open the `affablebean.css` stylesheet in the editor. Begin creating style rules for the `<div>` IDs you just created.
+
+[start=4]
+. Open the `affablebean.css` stylesheet in the editor. Begin creating style rules for the `<div>` IDs you just created.
* Use the `width` and `height` properties to create space for each area.
* Use the `background` property to discern the areas when you view the page.
* In order to horizontally center the four areas in the page, you can include `margin: 20px auto` to the `body` rule. (`20px` applies to the top and bottom; `auto` creates equal spacing to the left and right.) Then include `float: left` to the left and right columns.
@@ -214,9 +234,13 @@
background: #eee;
}
----
-5. Click the Run Project ( image::images/run-project-btn.png[] ) button in the IDE's main toolbar. Project files that contain changes are automatically saved, any Java code in the project compiles, the project is packaged and deployed to GlassFish, and your browser opens to display the current state of the welcome page.
+
+[start=5]
+. Click the Run Project ( image::images/run-project-btn.png[] ) button in the IDE's main toolbar. Project files that contain changes are automatically saved, any Java code in the project compiles, the project is packaged and deployed to GlassFish, and your browser opens to display the current state of the welcome page.
image::images/index-page.png[title="Run the project to view the current state of pages"]
-6. Now, begin creating placeholders for page components within each of the four visible areas. Start with the header. Reviewing the link:design.html#index[+welcome page mockup+], the header should contain the following components:
+
+[start=6]
+. Now, begin creating placeholders for page components within each of the four visible areas. Start with the header. Reviewing the link:design.html#index[+welcome page mockup+], the header should contain the following components:
* logo
* logo text
* shopping cart widget
@@ -264,7 +288,9 @@
You can also take advantage of numerous keyboard shortcuts. Choose Help > Keyboard Shortcuts Card from the main menu.
-7. In the stylesheet, create rules for the new IDs and classes. Add the following rules beneath the `header` rule. (New code shown in *bold*.)
+
+[start=7]
+. In the stylesheet, create rules for the new IDs and classes. Add the following rules beneath the `header` rule. (New code shown in *bold*.)
[source,java]
----
@@ -314,7 +340,9 @@
To see how a property is affecting your page, you can comment it out, then refresh the page in the browser. To comment out code, position your cursor on a line, or highlight a block of code, then press Ctrl-/ (⌘-/ on Mac).
-8. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
+
+[start=8]
+. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
*Note:* The IDE's 'Deploy on Save' facility is automatically activated for Java web projects. This means that every time you save a file, the file is automatically compiled (i.e., if it is a Java class or JSP page) and the project is newly packaged and deployed to your server. Therefore, when you make HTML or CSS changes, you don't need to explicitly rerun the project to view the updated version in a browser. Simply save your file(s), then switch to the browser and refresh the page.
@@ -324,7 +352,9 @@
2. Create a set of styles to define the appearance.
3. View the page to examine the results of your changes.
Following these three steps, let's implement the components in the remaining areas.
-9. Create placeholders for components in the right column. According to the link:design.html#index[+welcome page mockup+], the right column contains four evenly-spaced boxes.
+
+[start=9]
+. Create placeholders for components in the right column. According to the link:design.html#index[+welcome page mockup+], the right column contains four evenly-spaced boxes.
Create the structure for the four boxes. Insert the following code between the `<div id="indexRightColumn">` tags. (New code shown in *bold*.)
@@ -354,7 +384,9 @@
</div>*
</div>
----
-10. Add style rules to `affablebean.css` for the new `categoryBox` and `categoryLabelText` classes. (New code shown in *bold*.)
+
+[start=10]
+. Add style rules to `affablebean.css` for the new `categoryBox` and `categoryLabelText` classes. (New code shown in *bold*.)
[source,java]
----
@@ -394,9 +426,13 @@
Like the CSS Preview, the Style Builder is synchronized with the editor. When you make a selection in the Style Builder, the style rule is automatically updated in the editor. Likewise, when you type changes into the editor, the selections in the Style Builder are instantly updated.
-11. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
+
+[start=11]
+. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
image::images/index-page3.png[title="Placeholders for header and right-column are visible when running project"]
-12. The left column and footer only require placeholders for static text, so let's implement both simultaneously.
+
+[start=12]
+. The left column and footer only require placeholders for static text, so let's implement both simultaneously.
Insert the following code between the `<div id="indexLefttColumn">` and `<div id="footer">` tags. (New code shown in *bold*.)
@@ -416,7 +452,9 @@
<p id="footerText">[ footer text ]</p>*
</div>
----
-13. Make changes to the `affablebean.css` stylesheet. It's not necessary to account for all new IDs and classes - you can fine-tune the appearance at a later point when you receive text and images from the customer.
+
+[start=13]
+. Make changes to the `affablebean.css` stylesheet. It's not necessary to account for all new IDs and classes - you can fine-tune the appearance at a later point when you receive text and images from the customer.
The horizontal rule (`<hr>`) tag runs the full length of its containing element (`<div id="footer"`). Therefore, to shorten it in accordance with the mockup image, you can adjust the width of `<div id="footer">`. (New code shown in *bold*.)
@@ -438,7 +476,9 @@
width: 300px;
}*
----
-14. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
+
+[start=14]
+. Save (Ctrl-S; ⌘-S on Mac) the `index.jsp` and `affablebean.css` files, then switch to your browser and refresh the page to view its current state.
image::images/index-page4.png[title="Placeholders for left column and footer are visible"]
The welcome page is complete. You've created all necessary placeholders for components that will exist on the page.
@@ -448,9 +488,9 @@
1. Create `<div>` tags for the main page areas.
2. Iterate through each area and perform three steps:
-1. Create the structure in HTML.
-2. Create a set of styles to define the appearance.
-3. View the page to examine the results of your changes.
+.. Create the structure in HTML.
+.. Create a set of styles to define the appearance.
+.. View the page to examine the results of your changes.
Be sure to take advantage of the HTML and CSS support that the IDE provides for you. Some <<tipsTricks,tips and tricks>> are outlined below. If you just want to grab the code for the remaining pages and proceed with the tutorial, you can link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot1.zip[+download snapshot 1 of the `AffableBean` project+]. Images of initial mockup implementations for the remaining pages are included here.
@@ -541,13 +581,17 @@
Menu items provided by the IDE are often context-sensitive. For example, because you right-clicked the WEB-INF node, when the New Folder wizard displayed, `web/WEB-INF` was automatically entered in the Parent Folder field. Likewise, when you right-click a node in the Projects window and choose New, the list of file types is partially determined by your previous selections.
-3. Create two JSP segments: `header.jspf` and `footer.jspf`. To do so, right-click the newly created `jspf` folder and choose New > JSP. In the New JSP wizard, enter the file name, and under Options, select the Create as a JSP Segment option, then click Finish.
+
+[start=3]
+. Create two JSP segments: `header.jspf` and `footer.jspf`. To do so, right-click the newly created `jspf` folder and choose New > JSP. In the New JSP wizard, enter the file name, and under Options, select the Create as a JSP Segment option, then click Finish.
When you finish, you'll see `header.jspf` and `footer.jspf` displayed in your Projects window:
image::images/projects-win-jspf.png[title="Header and footer JSP fragments are displayed in the project"]
Now, you can copy the header code from any of the JSP pages and paste it into the `header.jspf` file. Likewise, you can copy the footer code from any of the JSP pages and paste it into the `footer.jspf` file. When you finish this task, you can remove the header and footer code from all of the JSP pages.
-4. Copy the header code from any of the JSP pages and paste it into the `header.jspf` file. The header should include the page doctype and the opening `<html>`, `<head>`, and `<body>` tags through to the closing tag for the `<div id="header">` element. Be sure to include placeholders for the shopping cart widget, language toggle, and 'proceed to checkout' button used along the top of page views. After you paste code into `header.jspf`, the file will look as follows.
+
+[start=4]
+. Copy the header code from any of the JSP pages and paste it into the `header.jspf` file. The header should include the page doctype and the opening `<html>`, `<head>`, and `<body>` tags through to the closing tag for the `<div id="header">` element. Be sure to include placeholders for the shopping cart widget, language toggle, and 'proceed to checkout' button used along the top of page views. After you paste code into `header.jspf`, the file will look as follows.
[source,html]
----
@@ -588,7 +632,9 @@
<img src="#" id="logoText" alt="the affable bean">
</div>
----
-5. Copy the footer code from any of the JSP pages and paste it into the `footer.jspf` file. The footer code should include the `<div id="footer">` element, through to the closing `<html>` tag. After you paste code into `footer.jspf`, the file will look as follows.
+
+[start=5]
+. Copy the footer code from any of the JSP pages and paste it into the `footer.jspf` file. The footer code should include the `<div id="footer">` element, through to the closing `<html>` tag. After you paste code into `footer.jspf`, the file will look as follows.
[source,html]
----
@@ -601,7 +647,9 @@
</body>
</html>
----
-6. Remove the header and footer code from all five JSP pages (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp`, and `confirmation.jsp`).
+
+[start=6]
+. Remove the header and footer code from all five JSP pages (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp`, and `confirmation.jsp`).
@@ -615,12 +663,22 @@
3. Click Finish. The `web.xml` file is created and added to the project. The IDE's graphical interface for the deployment descriptor opens in the editor.
The interface is categorized by the areas that can be configured in a web application. These areas are displayed as tabs in the editor toolbar, and include topics such as Servlets, Filters, References, and Security. The XML tab displays the entire source code for the file. Any changes you make in the graphical interface will cause immediate updates to the deployment descriptor's source code, which you can verify by switching to the XML tab. This is demonstrated in the following steps.
-4. Click the Pages tab, then click the Add JSP Property Group button. The Add JSP Property Group dialog opens.
-5. Type in '`header and footer settings`' for the Description field. Leave Display Name blank. Both the Display Name and Description fields are optional.
-6. For URL Patterns, specify the paths to the five views. Type in '`/index.jsp`' and '`/WEB-INF/view/*`'. Separate the two paths with a comma. (The '`*`' is a wildcard that represents all files within the given folder.)
+
+[start=4]
+. Click the Pages tab, then click the Add JSP Property Group button. The Add JSP Property Group dialog opens.
+
+[start=5]
+. Type in '`header and footer settings`' for the Description field. Leave Display Name blank. Both the Display Name and Description fields are optional.
+
+[start=6]
+. For URL Patterns, specify the paths to the five views. Type in '`/index.jsp`' and '`/WEB-INF/view/*`'. Separate the two paths with a comma. (The '`*`' is a wildcard that represents all files within the given folder.)
image::images/add-jsp-prop-group-dialog.png[title="Use the Add JSP Property Group dialog to specify <jsp-config> tags in the deployment descriptor"]
-7. Click OK. An entry is added to the JSP Properties Groups category in the Pages tab.
-8. Switch back to the XML tab. Notice that the following code has been added to the deployment descriptor.
+
+[start=7]
+. Click OK. An entry is added to the JSP Properties Groups category in the Pages tab.
+
+[start=8]
+. Switch back to the XML tab. Notice that the following code has been added to the deployment descriptor.
[source,xml]
----
@@ -636,12 +694,16 @@
*Note:* You may need to add carriage returns to the code so that it displays on multiple lines. You can right-click in the editor and choose Format (Alt-Shift-F; Ctrl-Shift-F on Mac) to have the code properly indented.
-9. Switch to the Pages tab again, and in the Include Preludes and Include Codas fields, enter the paths to the `header.jspf` and `footer.jspf` files, respectively. You can click the Browse button and navigate to the files in the provided dialog.
+
+[start=9]
+. Switch to the Pages tab again, and in the Include Preludes and Include Codas fields, enter the paths to the `header.jspf` and `footer.jspf` files, respectively. You can click the Browse button and navigate to the files in the provided dialog.
[.feature]
--
image::images/jsp-prop-groups-small.png[role="left", link="images/jsp-prop-groups.png"]
--
-10. Switch back to the XML tab. Note that the following code has been added. (Changes in *bold*.)
+
+[start=10]
+. Switch back to the XML tab. Note that the following code has been added. (Changes in *bold*.)
[source,xml]
----
@@ -660,7 +722,9 @@
To view the definitions of the above tags, as well as all tags available to you in the web deployment descriptor, consult the link:http://jcp.org/en/jsr/detail?id=315[+Servlet Specification+].
-11. Run the application again (press F6; fn-F6 on Mac). You've already removed the header and footer code from the `index.jsp` file, so you can determine whether it is automatically being added when the file is requested.
+
+[start=11]
+. Run the application again (press F6; fn-F6 on Mac). You've already removed the header and footer code from the `index.jsp` file, so you can determine whether it is automatically being added when the file is requested.
You will see that the <<welcome-page,welcome page displays as it did previously>>, with header and footer content included.
@@ -677,7 +741,9 @@
2. In the wizard, type `ControllerServlet` in the Class Name field.
3. In the Package field, type `controller`. (The new package is automatically created when you complete the wizard.)
image::images/servlet-wizard.png[title="Use the Servlet wizard to create servlets for your project"]
-4. Click Next. Step 3 of the wizard lets you configure the servlet. Of primary importance are the URL patterns that you need to specify. The patterns identify the URLs that invoke the servlet. For example, if you enter '`/category`', you are directing the servlet to handle a request that appears as follows.
+
+[start=4]
+. Click Next. Step 3 of the wizard lets you configure the servlet. Of primary importance are the URL patterns that you need to specify. The patterns identify the URLs that invoke the servlet. For example, if you enter '`/category`', you are directing the servlet to handle a request that appears as follows.
[source,java]
----
@@ -685,9 +751,13 @@
http://localhost/AffableBean*/category*
----
The URL patterns should correspond to the views and actions that a user can initiate. Looking at the link:design.html#index[+welcome page mockup+], a user should be able to select a category. We can therefore associate the `/category` URL with the action of clicking on a category image. Likewise, in the link:design.html#category[+category page+], users should be able to add an item to the shopping cart. We can therefore specify `/addToCart`.
-5. In the URL Pattern(s) field, type in '`/category, /addToCart, /viewCart`'. Patterns are separated by commas. You can add more patterns directly in the servlet class once it's created.
+
+[start=5]
+. In the URL Pattern(s) field, type in '`/category, /addToCart, /viewCart`'. Patterns are separated by commas. You can add more patterns directly in the servlet class once it's created.
image::images/servlet-wizard2.png[title="Configure servlet deployment directly in the wizard"]
-6. Click Finish. The IDE generates the `ControllerServlet` and opens it in the editor. The servlet and URL patterns are included in the `@WebServlet` annotation that appears above the class signature.
+
+[start=6]
+. Click Finish. The IDE generates the `ControllerServlet` and opens it in the editor. The servlet and URL patterns are included in the `@WebServlet` annotation that appears above the class signature.
[source,java]
----
@@ -717,7 +787,9 @@
<url-pattern>/viewCart</url-pattern>
</servlet-mapping>
----
-7. Add other URL patterns directly to the `@WebServlet` annotation's `urlPatterns` element. The application requires more URL patterns for other actions and views. You can type in the following patterns:
+
+[start=7]
+. Add other URL patterns directly to the `@WebServlet` annotation's `urlPatterns` element. The application requires more URL patterns for other actions and views. You can type in the following patterns:
* `/updateCart`
* `/checkout`
* `/purchase`
@@ -736,7 +808,9 @@
"/purchase",
"/chooseLanguage"*})
----
-8. Finally, include the `loadOnStartup` element so that the servlet is instantiated and initialized when the application is deployed. A value of `0` or greater will cause this to happen (`-1` is the default).
+
+[start=8]
+. Finally, include the `loadOnStartup` element so that the servlet is instantiated and initialized when the application is deployed. A value of `0` or greater will cause this to happen (`-1` is the default).
[source,java]
----
@@ -771,8 +845,12 @@
1. Open the Template Manager by choosing Tools > Templates from the main menu.
2. Expand the Web category, then select the Servlet template.
image::images/template-manager.png[title="Access and modify file templates via the Template Manager"]
-3. Click the Open in Editor button.
-4. Modify the template in the editor. The next time you create a new servlet (e.g., using the Servlet wizard), the new version will be applied.
+
+[start=3]
+. Click the Open in Editor button.
+
+[start=4]
+. Modify the template in the editor. The next time you create a new servlet (e.g., using the Servlet wizard), the new version will be applied.
@@ -869,7 +947,9 @@
}
----
As you continue through the tutorial, you'll return to the `ControllerServlet` and implement each of the mapped URL patterns individually.
-2. Examine the code above. There are several points to note:
+
+[start=2]
+. Examine the code above. There are several points to note:
* The servlet uses a `userPath` instance variable to get the requested URL pattern from the client:
[source,java]
@@ -908,7 +988,9 @@
You can control the keywords that display in the Tasks window. Open the Options window (Tools > Options; NetBeans > Preferences on Mac), then choose Miscellaneous > Tasks.
-3. Run the project (press F6; fn-F6 on Mac) and test to see whether the `ControllerServlet` is forwarding requests to the appropriate views.
+
+[start=3]
+. Run the project (press F6; fn-F6 on Mac) and test to see whether the `ControllerServlet` is forwarding requests to the appropriate views.
* Type in `http://localhost:8080/AffableBean/category` in the browser's address bar. The application's <<categoryPage,category page>> displays.
* Type in `http://localhost:8080/AffableBean/viewCart` in the browser's address bar. The application's <<cartPage,cart page>> displays.
* Type in `http://localhost:8080/AffableBean/checkout` in the browser's address bar. The application's <<checkoutPage,checkout page>> displays.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ja.asciidoc
index 6f410b1..323735e 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ja.asciidoc
@@ -151,7 +151,9 @@
</div>*
</body>
----
-3. ページのheadにスタイル・シートへの参照を追加し、タイトル・テキストを変更します。
+
+[start=3]
+. ページのheadにスタイル・シートへの参照を追加し、タイトル・テキストを変更します。
[source,xml]
----
@@ -162,7 +164,9 @@
<title>*The Affable Bean*</title>
</head>
----
-4. `affablebean.css`スタイル・シートをエディタで開きます。作成した`<div>` IDのスタイル・ルールを作成していきます。
+
+[start=4]
+. `affablebean.css`スタイル・シートをエディタで開きます。作成した`<div>` IDのスタイル・ルールを作成していきます。
* `width`および`height`プロパティを使用して、各領域のスペースを作成します。
* `background`プロパティを使用して、ページを表示したときに各領域を見分けられるようにします。
* ページの4つの領域を水平方向に中央にそろえるために、`margin: 20px auto`を`body`ルールを追加できます。(`20px`は上下のマージンに適用され、`auto`は左右均等に余白を作成します。)次に、左の列と右の列に`float: left`を追加します。
@@ -205,9 +209,13 @@
background: #eee;
}
----
-5. IDEのメイン・ツールバーにある「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。変更されたプロジェクト・ファイルが自動的に保存され、プロジェクト内のJavaコードがすべてコンパイルされます。プロジェクトがパッケージ化されてGlassFishにデプロイされ、ブラウザが開いて開始ページの現在の状態が表示されます。
+
+[start=5]
+. IDEのメイン・ツールバーにある「プロジェクトの実行」(image::images/run-project-btn.png[])ボタンをクリックします。変更されたプロジェクト・ファイルが自動的に保存され、プロジェクト内のJavaコードがすべてコンパイルされます。プロジェクトがパッケージ化されてGlassFishにデプロイされ、ブラウザが開いて開始ページの現在の状態が表示されます。
image::images/index-page.png[title="プロジェクトの実行による、ページの現在の状態の表示"]
-6. 次に、4つの各可視領域内にページ・コンポーネントのプレースホルダを作成していきます。ヘッダーから始めます。link:design.html#index[+開始ページのモックアップ+]を確認すると、ヘッダーには次のコンポーネントが含まれている必要があります。
+
+[start=6]
+. 次に、4つの各可視領域内にページ・コンポーネントのプレースホルダを作成していきます。ヘッダーから始めます。link:design.html#index[+開始ページのモックアップ+]を確認すると、ヘッダーには次のコンポーネントが含まれている必要があります。
* ロゴ
* ロゴ・テキスト
* ショッピング・カート・ウィジェット
@@ -255,7 +263,9 @@
様々なキーボード・ショートカットも利用できます。メイン・メニューから「ヘルプ」>「キーボード・ショートカット・カード」を選択します。
-7. スタイル・シートで、新しいIDおよびクラスのルールを作成します。次のルールを`header`ルールの下に追加します。新しいコードは*太字*で表示しています。
+
+[start=7]
+. スタイル・シートで、新しいIDおよびクラスのルールを作成します。次のルールを`header`ルールの下に追加します。新しいコードは*太字*で表示しています。
[source,java]
----
@@ -305,7 +315,9 @@
プロパティがページにどのような影響を与えているかを確認するには、そのプロパティをコメントアウトしてから、ブラウザでページをリフレッシュします。コードをコメントアウトするには、行の上にカーソルを置くかコード・ブロックを強調表示してから、[Ctrl]-[/] (Macの場合は[⌘]-[/])を押します。
-8. `index.jsp`および`affablebean.css`ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してから、ブラウザに切り替えてページをリフレッシュし、現在の状態を表示します。
+
+[start=8]
+. `index.jsp`および`affablebean.css`ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してから、ブラウザに切り替えてページをリフレッシュし、現在の状態を表示します。
*注意:* Java Webプロジェクトに対しては、IDEの「保存時にデプロイ」機能が自動的にアクティブ化されます。つまり、ファイルを保存するたびに、ファイルが自動的にコンパイルされ(JavaクラスまたはJSPページの場合)、プロジェクトが新たにパッケージ化されてサーバーにデプロイされます。したがって、HTMLまたはCSSを変更した場合は、プロジェクトを明示的に再実行しなくても、更新されたバージョンをブラウザで表示できます。ファイルを保存してから、ブラウザに切り替えてページをリフレッシュするのみです。
@@ -315,7 +327,9 @@
2. 一連のスタイルを作成して外観を定義します。
3. ページを表示して変更の結果を確認します。
これら3つの手順に従って、残りの領域のコンポーネントを実装しましょう。
-9. 右の列にコンポーネントのプレースホルダを作成します。link:design.html#index[+開始ページのモックアップ+]に従うと、右の列には等間隔で配置された4つのボックスが含まれています。
+
+[start=9]
+. 右の列にコンポーネントのプレースホルダを作成します。link:design.html#index[+開始ページのモックアップ+]に従うと、右の列には等間隔で配置された4つのボックスが含まれています。
4つのボックスの構造を作成します。次のコードを`<div id="indexRightColumn">`タグの間に挿入します。新しいコードは*太字*で表示しています。
@@ -345,7 +359,9 @@
</div>*
</div>
----
-10. 新しい`categoryBox`クラスおよび`categoryLabelText`クラスのスタイル・ルールを`affablebean.css`に追加します。新しいコードは*太字*で表示しています。
+
+[start=10]
+. 新しい`categoryBox`クラスおよび`categoryLabelText`クラスのスタイル・ルールを`affablebean.css`に追加します。新しいコードは*太字*で表示しています。
[source,java]
----
@@ -385,9 +401,13 @@
「CSSプレビュー」と同様に、「CSSスタイル・ビルダー」もエディタと同期しています。「スタイル・ビルダー」で選択すると、スタイル・ルールがエディタで自動的に更新されます。同様に、エディタで変更を入力すると、スタイル・ビルダーでの選択内容がすぐに更新されます。
-11. `index.jsp`および`affablebean.css`ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してから、ブラウザに切り替えてページをリフレッシュし、現在の状態を表示します。
+
+[start=11]
+. `index.jsp`および`affablebean.css`ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してから、ブラウザに切り替えてページをリフレッシュし、現在の状態を表示します。
image::images/index-page3.png[title="プロジェクト実行時にヘッダーおよび右の列のプレースホルダが表示される"]
-12. 左の列とフッターには静的テキストのプレースホルダのみが必要なので、両方を同時に実装しましょう。
+
+[start=12]
+. 左の列とフッターには静的テキストのプレースホルダのみが必要なので、両方を同時に実装しましょう。
次のコードを`<div id="indexLeftColumn">`タグおよび`<div id="footer">`タグの間に挿入します。新しいコードは*太字*で表示しています。
@@ -407,7 +427,9 @@
<p id="footerText">[ footer text ]</p>*
</div>
----
-13. `affablebean.css`スタイル・シートに変更を加えます。新しいIDとクラスをすべて考慮する必要はありません。後で顧客からテキストとイメージを受け取った時点で外観を調整できます。
+
+[start=13]
+. `affablebean.css`スタイル・シートに変更を加えます。新しいIDとクラスをすべて考慮する必要はありません。後で顧客からテキストとイメージを受け取った時点で外観を調整できます。
横罫線(`<hr>`)タグは、それを含んでいる要素(`<div id="footer">`)の長さ全体にわたって表示されます。したがって、モックアップ・イメージに従って短くするには、`<div id="footer">`の幅を調整します。新しいコードは*太字*で表示しています。
@@ -429,7 +451,9 @@
width: 300px;
}*
----
-14. `index.jsp`および`affablebean.css`ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してから、ブラウザに切り替えてページをリフレッシュし、現在の状態を表示します。
+
+[start=14]
+. `index.jsp`および`affablebean.css`ファイルを保存([Ctrl]-[S]、Macの場合は[⌘]-[S])してから、ブラウザに切り替えてページをリフレッシュし、現在の状態を表示します。
image::images/index-page4.png[title="左の列およびフッターのプレースホルダの表示"]
開始ページが完成しました。ページに含まれるコンポーネントに必要なプレースホルダをすべて作成しました。
@@ -439,9 +463,9 @@
1. メイン・ページ領域の`<div>`タグを作成します。
2. 各領域について、次の3つの手順を繰り返します。
-1. HTMLで構造を作成します。
-2. 一連のスタイルを作成して外観を定義します。
-3. ページを表示して変更の結果を確認します。
+.. HTMLで構造を作成します。
+.. 一連のスタイルを作成して外観を定義します。
+.. ページを表示して変更の結果を確認します。
IDEで提供されているHTMLおよびCSSのサポートを必ず利用してください。後述の<<tipsTricks,ヒントとコツ>>も参照してください。残りのページのコードは取り込むのみとし、チュートリアルの先に進む場合は、link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot1.zip[+`AffableBean`プロジェクトのスナップショット1をダウンロード+]できます。ここには、残りのページの初期モックアップ実装のイメージが含まれています。
@@ -532,13 +556,17 @@
IDEでは、状況に応じてメニュー項目が表示されます。たとえば、WEB-INFノードを右クリックして新規フォルダ・ウィザードを表示したときに、「親フォルダ」フィールドに`web/WEB-INF`が自動的に入力されました。同様に、「プロジェクト」ウィンドウでノードを右クリックしてから「新規」を選択すると、以前の選択内容に応じてファイル・タイプの一覧が部分的に変化します。
-3. 2つのJSPフラグメント`header.jspf`および`footer.jspf`を作成します。これを行うには、新しく作成した`jspf`フォルダを右クリックし、「新規」>「JSP」を選択します。新規JSPウィザードで、ファイル名を入力し、「オプション」から「JSPセグメントとして作成」オプションを選択し、「終了」をクリックします。
+
+[start=3]
+. 2つのJSPフラグメント`header.jspf`および`footer.jspf`を作成します。これを行うには、新しく作成した`jspf`フォルダを右クリックし、「新規」>「JSP」を選択します。新規JSPウィザードで、ファイル名を入力し、「オプション」から「JSPセグメントとして作成」オプションを選択し、「終了」をクリックします。
終了すると、「プロジェクト」ウィンドウに`header.jspf`と`footer.jspf`が表示されます。
image::images/projects-win-jspf.png[title="ヘッダーおよびフッターのJSPフラグメントがプロジェクトに表示される"]
次に、いずれかのJSPページからヘッダーのコードをコピーし、`header.jspf`ファイルに貼り付けます。同様に、いずれかのJSPページからフッターのコードをコピーし、`footer.jspf`ファイルに貼り付けます。この作業が終了したら、すべてのJSPページからヘッダーおよびフッターのコードを除去できます。
-4. いずれかのJSPページからヘッダーのコードをコピーし、`header.jspf`ファイルに貼り付けます。ヘッダーには、ページのdoctypeに加え、`<html>`、`<head>`および`<body>`の開始タグから`<div id="header">`要素の終了タグまでを含めるようにします。ページ・ビューの上部に使用されているショッピング・カート・ウィジェット、言語切替え、および「proceed to checkout」ボタンのプレースホルダを必ず含めてください。コードを貼り付けた後の`header.jspf`ファイルは次のようになります。
+
+[start=4]
+. いずれかのJSPページからヘッダーのコードをコピーし、`header.jspf`ファイルに貼り付けます。ヘッダーには、ページのdoctypeに加え、`<html>`、`<head>`および`<body>`の開始タグから`<div id="header">`要素の終了タグまでを含めるようにします。ページ・ビューの上部に使用されているショッピング・カート・ウィジェット、言語切替え、および「proceed to checkout」ボタンのプレースホルダを必ず含めてください。コードを貼り付けた後の`header.jspf`ファイルは次のようになります。
[source,html]
----
@@ -579,7 +607,9 @@
<img src="#" id="logoText" alt="the affable bean">
</div>
----
-5. いずれかのJSPページからフッターのコードをコピーし、`footer.jspf`ファイルに貼り付けます。フッターのコードには、`<div id="footer">`要素から`<html>`終了タグまでを含めるようにします。コードを貼り付けた後の`footer.jspf`ファイルは次のようになります。
+
+[start=5]
+. いずれかのJSPページからフッターのコードをコピーし、`footer.jspf`ファイルに貼り付けます。フッターのコードには、`<div id="footer">`要素から`<html>`終了タグまでを含めるようにします。コードを貼り付けた後の`footer.jspf`ファイルは次のようになります。
[source,html]
----
@@ -592,7 +622,9 @@
</body>
</html>
----
-6. 5つのJSPページ(`index.jsp`、`category.jsp`、`cart.jsp`、`checkout.jsp`および`confirmation.jsp`)すべてからヘッダーおよびフッターのコードを除去します。
+
+[start=6]
+. 5つのJSPページ(`index.jsp`、`category.jsp`、`cart.jsp`、`checkout.jsp`および`confirmation.jsp`)すべてからヘッダーおよびフッターのコードを除去します。
@@ -606,12 +638,22 @@
3. 「終了」をクリックします。`web.xml`ファイルが作成され、プロジェクトに追加されます。エディタにデプロイメント・ディスクリプタ用のIDEグラフィカル・インタフェースが開きます。
このインタフェースは、Webアプリケーションで構成可能な領域ごとに分類されています。これらの領域はタブとしてエディタのツールバーに表示され、「サーブレット」、「フィルタ」、「参照」、「セキュリティ」などの項目があります。「XML」タブには、ファイルのソース・コード全体が表示されます。このグラフィカル・インタフェースで変更を行うと、デプロイメント・ディスクリプタのソース・コードがすぐに更新され、「XML」タブに切り替えて確認できます。これを次の手順で示します。
-4. 「ページ」タブをクリックし、「JSPプロパティ・グループの追加」ボタンをクリックします。「JSPプロパティ・グループの追加」ダイアログが開きます。
-5. 「説明」フィールドに「`header and footer settings`」と入力します。「表示名」は空白にしておきます。「表示名」フィールドと「説明」フィールドはどちらもオプションです。
-6. 「URLパターン」には、5つのビューのパスを指定します。「`/index.jsp`」と「`/WEB-INF/view/*`」を入力します。2つのパスはカンマで区切ります。(「`*`」は、指定したフォルダにあるすべてのファイルを表すワイルド・カードです。)
+
+[start=4]
+. 「ページ」タブをクリックし、「JSPプロパティ・グループの追加」ボタンをクリックします。「JSPプロパティ・グループの追加」ダイアログが開きます。
+
+[start=5]
+. 「説明」フィールドに「`header and footer settings`」と入力します。「表示名」は空白にしておきます。「表示名」フィールドと「説明」フィールドはどちらもオプションです。
+
+[start=6]
+. 「URLパターン」には、5つのビューのパスを指定します。「`/index.jsp`」と「`/WEB-INF/view/*`」を入力します。2つのパスはカンマで区切ります。(「`*`」は、指定したフォルダにあるすべてのファイルを表すワイルド・カードです。)
image::images/add-jsp-prop-group-dialog.png[title="「JSPプロパティ・グループの追加」ダイアログを使用してデプロイメント・ディスクリプタに<jsp-config>タグを指定する"]
-7. 「OK」をクリックします。「ページ」タブの「JSPプロパティ・グループ」カテゴリにエントリが追加されます。
-8. 「XML」タブに戻ります。デプロイメント・ディスクリプタに次のコードが追加されています。
+
+[start=7]
+. 「OK」をクリックします。「ページ」タブの「JSPプロパティ・グループ」カテゴリにエントリが追加されます。
+
+[start=8]
+. 「XML」タブに戻ります。デプロイメント・ディスクリプタに次のコードが追加されています。
[source,xml]
----
@@ -627,12 +669,16 @@
*注意:* コードを複数の行に表示するには、キャリッジ・リターンを追加する必要があります。コードのインデントを適切に設定するには、エディタ内を右クリックし、「フォーマット」([Alt]-[Shift]-[F]、Macの場合は[Ctrl]-[Shift]-[F])を選択します。
-9. 「ページ」タブに戻り、「プレリュード(ヘッダー)を含める」フィールドと「コーダ(フッター)を含める」フィールドにそれぞれ`header.jspf`ファイルと`footer.jspf`ファイルのパスを入力します。「参照」ボタンをクリックし、表示されるダイアログでファイルを選択できます。
+
+[start=9]
+. 「ページ」タブに戻り、「プレリュード(ヘッダー)を含める」フィールドと「コーダ(フッター)を含める」フィールドにそれぞれ`header.jspf`ファイルと`footer.jspf`ファイルのパスを入力します。「参照」ボタンをクリックし、表示されるダイアログでファイルを選択できます。
[.feature]
--
image:images/jsp-prop-groups-small.png[role="left", link="images/jsp-prop-groups.png"]
--
-10. 「XML」タブに戻ります。次のコードが追加されています。変更場所は*太字*で示されています。
+
+[start=10]
+. 「XML」タブに戻ります。次のコードが追加されています。変更場所は*太字*で示されています。
[source,xml]
----
@@ -651,7 +697,9 @@
上記のタグおよびWebデプロイメント・ディスクリプタで使用できるすべてのタグの定義を表示するには、link:http://jcp.org/en/jsr/detail?id=315[+Servlet仕様+]を参照してください。
-11. アプリケーションを再度実行します([F6]、Macの場合は[fn]-[F6])。`index.jsp`ファイルからはヘッダーおよびフッターのコードをすでに除去したため、このファイルがリクエストされたときにコードが自動的に追加されるかどうかを確認できます。
+
+[start=11]
+. アプリケーションを再度実行します([F6]、Macの場合は[fn]-[F6])。`index.jsp`ファイルからはヘッダーおよびフッターのコードをすでに除去したため、このファイルがリクエストされたときにコードが自動的に追加されるかどうかを確認できます。
<<welcome-page,開始ページが以前と同じように表示され>>、ヘッダーとフッターの内容が含まれていることがわかります。
@@ -668,7 +716,9 @@
2. ウィザードで、「クラス名」フィールドに「`ControllerServlet`」と入力します。
3. 「パッケージ」フィールドに「`controller`」と入力します。(ウィザードの完了時に新しいパッケージが自動的に作成されます。)
image::images/servlet-wizard.png[title="サーブレット・ウィザードを使用した、プロジェクトのサーブレットの作成"]
-4. 「次」をクリックします。ウィザードのステップ3では、サーブレットを構成できます。最も重要なのは、URLパターンの指定です。これらのパターンは、サーブレットを起動するURLを識別します。たとえば、「`/category`」と入力すると、次のようなリクエストを処理するようにサーブレットに指示していることになります。
+
+[start=4]
+. 「次」をクリックします。ウィザードのステップ3では、サーブレットを構成できます。最も重要なのは、URLパターンの指定です。これらのパターンは、サーブレットを起動するURLを識別します。たとえば、「`/category`」と入力すると、次のようなリクエストを処理するようにサーブレットに指示していることになります。
[source,java]
----
@@ -676,9 +726,13 @@
http://localhost/AffableBean*/category*
----
URLパターンは、ユーザーが開始できるビューおよびアクションに対応するようにしてください。link:design.html#index[+開始ページのモックアップ+]を参照すると、ユーザーはカテゴリを選択できる必要があります。したがって、カテゴリ・イメージをクリックするアクションに`/category` URLを関連付けることができます。同様に、link:design.html#category[+カテゴリ・ページ+]で、ユーザーはショッピング・カートに項目を追加できる必要があります。したがって、`/addToCart`を指定できます。
-5. 「URLパターン」フィールドに「`/category,/addToCart,/viewCart`」と入力します。パターンはカンマで区切ります。サーブレット・クラスが作成されたら、他のパターンは直接追加できます。
+
+[start=5]
+. 「URLパターン」フィールドに「`/category,/addToCart,/viewCart`」と入力します。パターンはカンマで区切ります。サーブレット・クラスが作成されたら、他のパターンは直接追加できます。
image::images/servlet-wizard2.png[title="ウィザードによるサーブレット・デプロイメントの直接構成"]
-6. 「終了」をクリックします。IDEによって`ControllerServlet`が生成され、エディタで開きます。サーブレット名とURLパターンは、クラス署名の上にある`@WebServlet`注釈に含まれています。
+
+[start=6]
+. 「終了」をクリックします。IDEによって`ControllerServlet`が生成され、エディタで開きます。サーブレット名とURLパターンは、クラス署名の上にある`@WebServlet`注釈に含まれています。
[source,java]
----
@@ -708,7 +762,9 @@
<url-pattern>/viewCart</url-pattern>
</servlet-mapping>
----
-7. 他のURLパターンは`@WebServlet`注釈の`urlPatterns`要素に直接追加します。アプリケーションには、他のアクションとビューに対応する追加のURLパターンが必要です。次のパターンを入力できます。
+
+[start=7]
+. 他のURLパターンは`@WebServlet`注釈の`urlPatterns`要素に直接追加します。アプリケーションには、他のアクションとビューに対応する追加のURLパターンが必要です。次のパターンを入力できます。
* `/updateCart`
* `/checkout`
* `/purchase`
@@ -727,7 +783,9 @@
"/purchase",
"/chooseLanguage"*})
----
-8. 最後に、`loadOnStartup`要素を追加して、アプリケーションのデプロイ時にサーブレットのインスタンス化と初期化が行われるようにします。`0`以上の値を指定すると、この処理が行われます(デフォルトは`-1`)。
+
+[start=8]
+. 最後に、`loadOnStartup`要素を追加して、アプリケーションのデプロイ時にサーブレットのインスタンス化と初期化が行われるようにします。`0`以上の値を指定すると、この処理が行われます(デフォルトは`-1`)。
[source,java]
----
@@ -762,8 +820,12 @@
1. メイン・メニューから「ツール」>「テンプレート」を選択して、テンプレート・マネージャを開きます。
2. 「Web」カテゴリを展開し、「サーブレット」テンプレートを選択します。
image::images/template-manager.png[title="テンプレート・マネージャ経由でのファイル・テンプレートに対するアクセスおよび変更"]
-3. 「エディタで開く」ボタンをクリックします。
-4. エディタでテンプレートを変更します。次回(サーブレット・ウィザードなどで)新しいサーブレットを作成するときに、この新しいバージョンが適用されます。
+
+[start=3]
+. 「エディタで開く」ボタンをクリックします。
+
+[start=4]
+. エディタでテンプレートを変更します。次回(サーブレット・ウィザードなどで)新しいサーブレットを作成するときに、この新しいバージョンが適用されます。
@@ -860,7 +922,9 @@
}
----
チュートリアルに沿って進む場合は、`ControllerServlet`に戻り、マップされたURLパターンをそれぞれ個別に実装します。
-2. 上記のコードを確認してください。注意する点がいくつかあります。
+
+[start=2]
+. 上記のコードを確認してください。注意する点がいくつかあります。
* サーブレットは`userPath`インスタンス変数を使用して、クライアントからリクエストされたURLパターンを取得します。
[source,java]
@@ -899,7 +963,9 @@
「タスク」ウィンドウに表示するキーワードを制御できます。「オプション」ウィンドウを開き(「ツール」>「オプション」、Macの場合は「NetBeans」>「プリファレンス」)、「その他」>「タスク」を選択します。
-3. プロジェクトを実行し([F6]、Macの場合は[fn]-[F6])、`ControllerServlet`が適切なビューにリクエストを転送しているかどうかをテストします。
+
+[start=3]
+. プロジェクトを実行し([F6]、Macの場合は[fn]-[F6])、`ControllerServlet`が適切なビューにリクエストを転送しているかどうかをテストします。
* ブラウザのアドレス・バーに「`http://localhost:8080/AffableBean/category`」と入力します。アプリケーションの<<categoryPage,カテゴリ・ページ>>が表示されます。
* ブラウザのアドレス・バーに「`http://localhost:8080/AffableBean/viewCart`」と入力します。アプリケーションの<<cartPage,カート・ページ>>が表示されます。
* ブラウザのアドレス・バーに「`http://localhost:8080/AffableBean/checkout`」と入力します。アプリケーションの<<checkoutPage,チェックアウト・ページ>>が表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_pt_BR.asciidoc
index e6b728e..e814223 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_pt_BR.asciidoc
@@ -151,7 +151,9 @@
</div>*
</body>
----
-3. Adicione referências à folha de estilo no cabeçalho da página e altere o texto do título.
+
+[start=3]
+. Adicione referências à folha de estilo no cabeçalho da página e altere o texto do título.
[source,xml]
----
@@ -162,7 +164,9 @@
<title>*The Affable Bean*</title>
</head>
----
-4. Abra a folha de estilos `affablebean.css` no editor. Comece criando regras de estilo para os IDs `<div>` recém-criados.
+
+[start=4]
+. Abra a folha de estilos `affablebean.css` no editor. Comece criando regras de estilo para os IDs `<div>` recém-criados.
* Utilize as propriedades `width` e `height` para criar espaço para cada área.
* Utilize a propriedade `background` para discernir as áreas quando exibir a página.
* Para centralizar horizontalmente as quatro áreas na página, você pode incluir `margin: 20px auto` à regras `body`. (`20px)` aplica-se à parte superior e à inferior `auto` cria espaçamento igual para a esquerda e para a direita.) Depois inclua `float: left` às colunas da esquerda e da direita.
@@ -205,9 +209,13 @@
background: #eee;
}
----
-5. Clique no botão Executar Projeto (image::images/run-project-btn.png[]) na barra de ferramentas principal do IDE. Os arquivos do projeto que contêm alterações são automaticamente salvos, qualquer código Java no projeto é compilado, o projeto é encapsulado e implantado ao GlassFish e o browser é aberto para exibir o estado atual da página de boas-vindas.
+
+[start=5]
+. Clique no botão Executar Projeto (image::images/run-project-btn.png[]) na barra de ferramentas principal do IDE. Os arquivos do projeto que contêm alterações são automaticamente salvos, qualquer código Java no projeto é compilado, o projeto é encapsulado e implantado ao GlassFish e o browser é aberto para exibir o estado atual da página de boas-vindas.
image::images/index-page.png[title="Executar o projeto para exibir o estado atual das páginas"]
-6. Agora, comece criando placeholders para componentes da página dentro de cada uma das quatro áreas visíveis. Inicie com o cabeçalho. Revisando o link:design.html#index[+modelo da página de boas-vindas+], o cabeçalho deverá conter todos os componentes a seguir:
+
+[start=6]
+. Agora, comece criando placeholders para componentes da página dentro de cada uma das quatro áreas visíveis. Inicie com o cabeçalho. Revisando o link:design.html#index[+modelo da página de boas-vindas+], o cabeçalho deverá conter todos os componentes a seguir:
* Logotipo
* texto do logotipo
* widget de carrinho de compras
@@ -255,7 +263,9 @@
Você pode também aproveitar os vários atalhos do teclado. Selecione Ajuda > Cartão de Atalhos do Teclado no menu principal.
-7. Na folha de estilo, crie regras para os novos IDs e classes. Adicione as regras a seguir abaixo da regra `header`. (Novo código mostrado em *negrito*.)
+
+[start=7]
+. Na folha de estilo, crie regras para os novos IDs e classes. Adicione as regras a seguir abaixo da regra `header`. (Novo código mostrado em *negrito*.)
[source,java]
----
@@ -305,7 +315,9 @@
Para ver como uma propriedade está afetando sua página, você pode comentá-la e depois atualizar a página no browser. Para comentar o código, posicione o cursor em uma linha ou realce um bloco de código e, em seguida, pressione Ctrl-/ (⌘-/ no Mac).
-8. Salve (Ctrl-S; ⌘-S no Mac) os arquivos `index.jsp` e `affablebean.css` e, em seguida, mude para o browser e atualize a página para exibir seu estado atual.
+
+[start=8]
+. Salve (Ctrl-S; ⌘-S no Mac) os arquivos `index.jsp` e `affablebean.css` e, em seguida, mude para o browser e atualize a página para exibir seu estado atual.
*Observação:* o recurso "Implantar ao Salvar" do IDE é ativado automaticamente pelos projetos Java Web Isso significa que toda vez que você salva um arquivo ele é automaticamente compilado (exemplo, se for uma classe Java ou página JSP) e que o projeto está recém-encapsulado e implantado no seu servidor. Portanto, quando fizer alterações em HTML ou CSS, não é necessário reexecutar explicitamente o projeto pra exibir a versão atualizada em um browser. Simplesmente salve seu(s) arquivo(s) e, em seguida, mude para o browser e atualize a página.
@@ -315,7 +327,9 @@
2. Crie um conjunto de estilos para definir a aparência.
3. Exiba a página para examinar os resultados das suas alterações.
Seguindo essas três etapas, vamos implementar os componentes nas áreas remanescentes.
-9. Crie placeholders para componentes na coluna da direita. De acordo com o link:design.html#index[+modelo da página de boas-vindas+], a coluna da direita contém quatro caixas com espaçamento uniforme.
+
+[start=9]
+. Crie placeholders para componentes na coluna da direita. De acordo com o link:design.html#index[+modelo da página de boas-vindas+], a coluna da direita contém quatro caixas com espaçamento uniforme.
Crie a estrutura para as quatro caixas. Insira o código a seguir entre as tags `<div id="indexRightColumn">`. (Novo código mostrado em *negrito*.)
@@ -345,7 +359,9 @@
</div>*
</div>
----
-10. Adicione regras de estilo ao `addablebean.css` para as novas classes `categoryBox` e `categoryLabelText`. (Novo código mostrado em *negrito*.)
+
+[start=10]
+. Adicione regras de estilo ao `addablebean.css` para as novas classes `categoryBox` e `categoryLabelText`. (Novo código mostrado em *negrito*.)
[source,java]
----
@@ -385,9 +401,13 @@
Como a Visualização CSS, o Construtor de Estilo está sincronizado com o editor. Quando você faz uma seleção no Construtor de Estilo, a regra de estilo é atualizada automaticamente no editor. Do mesmo modo, ao digitar alterações no editor, as seleções no Construtor de Estilo são atualizadas instantaneamente.
-11. Salve (Ctrl-S; ⌘-S no Mac) os arquivos `index.jsp` e `affablebean.css` e, em seguida, mude para o browser e atualize a página para exibir seu estado atual.
+
+[start=11]
+. Salve (Ctrl-S; ⌘-S no Mac) os arquivos `index.jsp` e `affablebean.css` e, em seguida, mude para o browser e atualize a página para exibir seu estado atual.
image::images/index-page3.png[title="Placeholders para cabeçalho e a coluna da direita são visíveis ao executar o projeto"]
-12. A coluna da esquerda e o rodapé requerem placeholders apenas para o texto estático, então vamos implementar os dois simultaneamente.
+
+[start=12]
+. A coluna da esquerda e o rodapé requerem placeholders apenas para o texto estático, então vamos implementar os dois simultaneamente.
Insira o código a seguir entre as tags `<div id="indexLefttColumn">` e `<div id="footer">`. (Novo código mostrado em *negrito*.)
@@ -407,7 +427,9 @@
<p id="footerText">[ footer text ]</p>*
</div>
----
-13. Faça alterações na folha de estilo `affablebean.css`. Não é necessário explicar todos os novos IDs e classes: você pode ajustar a aparência posteriormente ao receber o texto e as imagens do cliente.
+
+[start=13]
+. Faça alterações na folha de estilo `affablebean.css`. Não é necessário explicar todos os novos IDs e classes: você pode ajustar a aparência posteriormente ao receber o texto e as imagens do cliente.
A tag de regra horizontal (`<hr>`) executa todos os elementos nela contidos (`<div id="footer"`). Portanto, para encurtá-la de acordo com a imagem de modelo, você pode ajustar a largura do `<div id="footer">`. (Novo código mostrado em *negrito*.)
@@ -429,7 +451,9 @@
width: 300px;
}*
----
-14. Salve (Ctrl-S; ⌘-S no Mac) os arquivos `index.jsp` e `affablebean.css` e, em seguida, mude para o browser e atualize a página para exibir o estado atual.
+
+[start=14]
+. Salve (Ctrl-S; ⌘-S no Mac) os arquivos `index.jsp` e `affablebean.css` e, em seguida, mude para o browser e atualize a página para exibir o estado atual.
image::images/index-page4.png[title="Placeholders para a coluna esquerda e o rodapé são visíveis"]
A página de boas-vindas foi concluída. Foram criados todos os placeholders necessários para componentes que existirão na página.
@@ -439,9 +463,9 @@
1. Crie tags `<div>` para as áreas da página principal.
2. Repita em cada área e execute as três etapas a seguir:
-1. Crie a estrutura em HTML.
-2. Crie um conjunto de estilos para definir a aparência.
-3. Exiba a página para examinar os resultados das suas alterações.
+.. Crie a estrutura em HTML.
+.. Crie um conjunto de estilos para definir a aparência.
+.. Exiba a página para examinar os resultados das suas alterações.
Assegure-se de aproveitar o suporte HTML e CSS que o IDE oferece. Algumas <<tipsTricks,dicas e truques>> estão descritos abaixo. Se desejar apenas pegar o código para as páginas remanescentes e prosseguir com o tutorial,você pode link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot1.zip[+fazer download do snapshot 1 do projeto `AffableBean`+]. Imagens das implementações do modelo inicial para as páginas remanescentes estão incluídas aqui.
@@ -532,13 +556,17 @@
Itens do menu fornecidos pelo IDE são geralmente sensíveis ao contexto. Por exemplo, como você clicou com o botão direito do mouse no nó WEB-INF, quando o assistente Nova Pasta foi exibido, `web/WEB-INF` foi inserido automaticamente no campo Pasta Pai. Do mesmo modo, ao clicar com o botão direito do mouse no nó da janela Projetos e selecionar Novo, a lista de tipos de arquivo será parcialmente determinada por seleções anteriores.
-3. Crie dois segmentos JSP: `header.jspf` e `footer.jspf`. Para fazer isso, clique com o botão direito do mouse na pasta `jspf` recém-criada e selecione Novo > JSP. No assistente Novo JSP, insira o nome do arquivo e em Opções, selecione a opção Criar como um Segmento JSP e clique em Finalizar.
+
+[start=3]
+. Crie dois segmentos JSP: `header.jspf` e `footer.jspf`. Para fazer isso, clique com o botão direito do mouse na pasta `jspf` recém-criada e selecione Novo > JSP. No assistente Novo JSP, insira o nome do arquivo e em Opções, selecione a opção Criar como um Segmento JSP e clique em Finalizar.
Ao finalizar, você visualizará `header.jspf` e `footer.jspf` exibidos na janela Projetos:
image::images/projects-win-jspf.png[title="Fragmentos JSP de cabeçalho e rodapé serão exibidos no projeto"]
Agora você pode copiar o código do cabeçalho de qualquer página JSP e colar no arquivo `header.jspf`. Do mesmo modo, você pode copiar o código do rodapé de qualquer página JSP e colar no arquivo `footer.jspf`. Ao finalizar essa tarefa , você poderá remover o código do cabeçalho e do rodapé de todas as páginas JSP.
-4. Copie o código do cabeçalho de qualquer página JSP e cole no arquivo `header.jspf`. O cabeçalho deve incluir o tipo de documento da página e as tags de abertura `<html>`, `<head>` e `<body>` até a tag de fechamento para o elemento `<div id="header&quot>`. Certifique-se de incluir placeholders para o widget de carrinho de compras, alternância de idioma e para o botão "ir para o check-out" utilizado na parte superior das views de páginas. Após colar o código no `header.jspf`, o arquivo terá a seguinte aparência.
+
+[start=4]
+. Copie o código do cabeçalho de qualquer página JSP e cole no arquivo `header.jspf`. O cabeçalho deve incluir o tipo de documento da página e as tags de abertura `<html>`, `<head>` e `<body>` até a tag de fechamento para o elemento `<div id="header&quot>`. Certifique-se de incluir placeholders para o widget de carrinho de compras, alternância de idioma e para o botão "ir para o check-out" utilizado na parte superior das views de páginas. Após colar o código no `header.jspf`, o arquivo terá a seguinte aparência.
[source,html]
----
@@ -579,7 +607,9 @@
<img src="#" id="logoText" alt="the affable bean">
</div>
----
-5. Copie o código do rodapé de qualquer página JSP e cole no arquivo `footer.jspf`. O código do rodapé deve incluir o elemento `<div id="footer">` até a tag de fechamento `<html>`. Após colar o código no `footer.jspf`, o arquivo terá a seguinte aparência.
+
+[start=5]
+. Copie o código do rodapé de qualquer página JSP e cole no arquivo `footer.jspf`. O código do rodapé deve incluir o elemento `<div id="footer">` até a tag de fechamento `<html>`. Após colar o código no `footer.jspf`, o arquivo terá a seguinte aparência.
[source,html]
----
@@ -592,7 +622,9 @@
</body>
</html>
----
-6. Remova o código de cabeçalho e rodapé de todas as cinco páginas JSP (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp` e `confirmation.jsp`).
+
+[start=6]
+. Remova o código de cabeçalho e rodapé de todas as cinco páginas JSP (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp` e `confirmation.jsp`).
@@ -606,12 +638,22 @@
3. Clique em Finalizar. O arquivo `web.xml` é criado e adicionado ao projeto. A interface gráfica do IDE para o descritor de implantação será aberta no editor.
A interface é categorizada pelas áreas que podem ser configuradas em uma aplicação web. Essas áreas são exibidas como guias na barra de ferramentas do editor e incluem tópicos como Servlets, Filtros, Referências e Segurança. A guia XML exibe o código-fonte inteiro do arquivo. Qualquer alteração feita na interface gráfica provocará atualizações imediatas no código-fonte do descritor de implantação, que você pode verificar alternando para a guia XML. Isso está demonstrado nas etapas a seguir.
-4. Clique na guia Páginas e, em seguida clique no botão Adicionar Grupo de Propriedade JSP. A caixa de diálogo Adicionar Grupo de Propriedade JSP será aberta.
-5. Digite "`definições de cabeçalho e rodapé`" no campo Descrição. Deixe Nome de Exibição em Branco. Os campos Nome de Exibição e Descrição são opcionais.
-6. Para Padrões de URL, especifique os caminhos para as cinco views. Digite "`/index.jsp`" e "`/WEB-INF/view/*`". Separe os dois caminhos com vírgula. (O "`*`" é um curinga que representa todos os arquivos dentro da pasta determinada.)
+
+[start=4]
+. Clique na guia Páginas e, em seguida clique no botão Adicionar Grupo de Propriedade JSP. A caixa de diálogo Adicionar Grupo de Propriedade JSP será aberta.
+
+[start=5]
+. Digite "`definições de cabeçalho e rodapé`" no campo Descrição. Deixe Nome de Exibição em Branco. Os campos Nome de Exibição e Descrição são opcionais.
+
+[start=6]
+. Para Padrões de URL, especifique os caminhos para as cinco views. Digite "`/index.jsp`" e "`/WEB-INF/view/*`". Separe os dois caminhos com vírgula. (O "`*`" é um curinga que representa todos os arquivos dentro da pasta determinada.)
image::images/add-jsp-prop-group-dialog.png[title="Use a caixa de diálogo Adicionar Grupo de Propriedade JSP para especificar as tags <jsp-config> no descritor de implantação"]
-7. Clique em OK. Uma entrada é adicionada à categoria Grupos de Propriedades JSP na guia Páginas.
-8. Volte para a guia XML. Note que o código a seguir foi adicionado ao descritor de implantação.
+
+[start=7]
+. Clique em OK. Uma entrada é adicionada à categoria Grupos de Propriedades JSP na guia Páginas.
+
+[start=8]
+. Volte para a guia XML. Note que o código a seguir foi adicionado ao descritor de implantação.
[source,xml]
----
@@ -627,12 +669,16 @@
*Observação:* pode ser necessário adicionar retorno de carro ao código para que ele seja exibido em várias linhas. Você pode clicar com o botão direito do mouse no editor e selecionar Formato (Alt-Shift-F; Ctrl-Shift-F no Mac) para que o código seja recuado corretamente.
-9. Volte novamente para a guia Páginas e nos campos Incluir Preludes e Incluir Codas, informe os caminhos para os arquivos `header.jspf` e `footer.jspf`, respectivamente. Você pode clicar no botão Browser e navegar para os arquivos na caixa de diálogo fornecida.
+
+[start=9]
+. Volte novamente para a guia Páginas e nos campos Incluir Preludes e Incluir Codas, informe os caminhos para os arquivos `header.jspf` e `footer.jspf`, respectivamente. Você pode clicar no botão Browser e navegar para os arquivos na caixa de diálogo fornecida.
[.feature]
--
image::images/jsp-prop-groups-small.png[role="left", link="images/jsp-prop-groups.png"]
--
-10. Volte para a guia XML. Note que o código a seguir foi adicionado. (Alterações em *negrito*.)
+
+[start=10]
+. Volte para a guia XML. Note que o código a seguir foi adicionado. (Alterações em *negrito*.)
[source,xml]
----
@@ -651,7 +697,9 @@
Para exibir as definições das tags acima, assim como de todas as tags disponíveis no descritor de implantação web, consulte link:http://jcp.org/en/jsr/detail?id=315[+Especificação do Servlet+].
-11. Execute a aplicação novamente (pressione F6; fn-F6 no Mac). O código do cabeçalho e rodapé já foi removido do arquivo `index.jsp`, portanto, você pode determinar se está sendo adicionado automaticamente quando o arquivo é solicitado.
+
+[start=11]
+. Execute a aplicação novamente (pressione F6; fn-F6 no Mac). O código do cabeçalho e rodapé já foi removido do arquivo `index.jsp`, portanto, você pode determinar se está sendo adicionado automaticamente quando o arquivo é solicitado.
Você verá que a <<welcome-page,página de boas-vindas será exibida como anteriormente>>, com o conteúdo do cabeçalho e rodapé incluído.
@@ -668,7 +716,9 @@
2. No assistente, digite `ControllerServlet` no campo Nome da Classe.
3. No campo Pacote, digite `controller`. (O novo pacote será criado automaticamente ao concluir o assistente.)
image::images/servlet-wizard.png[title="Use o assistente Criar Servlet para criar servlets para seu projeto"]
-4. Clique em Próximo. A etapa 3 do assistente permite que você configure o servlet. Os padrões de URL que precisam ser especificados são de importância primordial. Os padrões identificam os URLs que chamam o servlet. Por exemplo, se digitar "`/category`", você está direcionando o servlet para manipular uma requisição que aparece da maneira a seguir.
+
+[start=4]
+. Clique em Próximo. A etapa 3 do assistente permite que você configure o servlet. Os padrões de URL que precisam ser especificados são de importância primordial. Os padrões identificam os URLs que chamam o servlet. Por exemplo, se digitar "`/category`", você está direcionando o servlet para manipular uma requisição que aparece da maneira a seguir.
[source,java]
----
@@ -676,9 +726,13 @@
http://localhost/AffableBean*/category*
----
Os padrões de URL devem corresponder às views e ações que um usuário pode iniciar. Observando o link:design.html#index[+modelo da página de boas-vindas+], um usuário deve poder selecionar uma categoria. Entretanto, podemos associar o URL `/category` à ação de clicar na imagem de uma categoria. Do mesmo modo, na link:design.html#category[+página da categoria+], os usuários devem poder adicionar um item ao carrinho de compras. Podemos, portanto, especificar `/addToCart`.
-5. No campo Padrão(ões) de URL, digite "`/category/addToCart, /viewCart`". Padrões são separados por vírgulas. Você pode adicionar mais padrões diretamente na classe servlet depois de ela ter sido criada.
+
+[start=5]
+. No campo Padrão(ões) de URL, digite "`/category/addToCart, /viewCart`". Padrões são separados por vírgulas. Você pode adicionar mais padrões diretamente na classe servlet depois de ela ter sido criada.
image::images/servlet-wizard2.png[title="Configurar a implantação do servlet diretamente no assistente"]
-6. Clique em Finalizar. O IDE irá gerar `ControllerServlet` e o abrirá no editor. Os padrões de servlet e de URL estão incluídos na anotação `@WebServlet` que aparece acima da assinatura da classe.
+
+[start=6]
+. Clique em Finalizar. O IDE irá gerar `ControllerServlet` e o abrirá no editor. Os padrões de servlet e de URL estão incluídos na anotação `@WebServlet` que aparece acima da assinatura da classe.
[source,java]
----
@@ -708,7 +762,9 @@
<url-pattern>/viewCart</url-pattern>
</servlet-mapping>
----
-7. Adicione outros padrões de URL diretamente ao elemento `@WebServlet` da anotação `urlPatterns`. A aplicação requer mais padrões de URL para outras ações e views. Você pode digitar os seguintes padrões:
+
+[start=7]
+. Adicione outros padrões de URL diretamente ao elemento `@WebServlet` da anotação `urlPatterns`. A aplicação requer mais padrões de URL para outras ações e views. Você pode digitar os seguintes padrões:
* `/updatecart `
* `/checkout`
* `/purchase`
@@ -727,7 +783,9 @@
"/purchase",
"/chooseLanguage"*})
----
-8. Finalmente, inclua o elemento `loadOnStartup` para que o servlet seja instanciado e inicializado quando a aplicação for implantada. Um valor de `0` ou superior fará com que isso aconteça (`-1` é o default).
+
+[start=8]
+. Finalmente, inclua o elemento `loadOnStartup` para que o servlet seja instanciado e inicializado quando a aplicação for implantada. Um valor de `0` ou superior fará com que isso aconteça (`-1` é o default).
[source,java]
----
@@ -762,8 +820,12 @@
1. Abra o Gerenciador de Modelos selecionando Ferramentas > Modelos no menu principal.
2. Expanda a categoria Web e, em seguida, selecione o modelo Servlet.
image::images/template-manager.png[title="Acessar e modificar modelos de arquivos via Gerenciador de Modelos"]
-3. Clique no botão Abrir no Editor.
-4. Modifique o modelo no editor. Na próxima vez em que criar um novo servlet (por exemplo, utilizando o assistente de Servlet), a nova versão será aplicada.
+
+[start=3]
+. Clique no botão Abrir no Editor.
+
+[start=4]
+. Modifique o modelo no editor. Na próxima vez em que criar um novo servlet (por exemplo, utilizando o assistente de Servlet), a nova versão será aplicada.
@@ -860,7 +922,9 @@
}
----
Ao prosseguir com o tutorial, você retornará para o `ControllerServlet` e implementará individualmente cada um dos padrões de URL mapeados.
-2. Examine o código acima. Há vários pontos a serem observados:
+
+[start=2]
+. Examine o código acima. Há vários pontos a serem observados:
* O servlet utiliza uma variável da instância `userPath` para obter o padrão de URL solicitado pelo cliente:
[source,java]
@@ -899,7 +963,9 @@
Você pode controlar as palavras-chave que são exibidas na janela Tarefas. Abra a janela Opções (Ferramentas > Opções; NetBeans > Preferências no Mac) e, em seguida, selecione Diversos > Tarefas.
-3. Execute o projeto (pressione F6; fn-F6 no Mac) e teste para ver se o `ControllerServlet` está encaminhando solicitações para as views apropriadas.
+
+[start=3]
+. Execute o projeto (pressione F6; fn-F6 no Mac) e teste para ver se o `ControllerServlet` está encaminhando solicitações para as views apropriadas.
* Digite `http://localhost:8080/AffableBean/category` na barra de endereço do browser. A <<categoryPage,página da categoria>> da aplicação será exibida.
* Digite `http://localhost:8080/AffableBean/viewCart` na barra de endereço do browser. A <<cartPage,página do carrinho>> da aplicação será exibida.
* Digite `http://localhost:8080/AffableBean/checkout` na barra de endereço do browser. A <<checkoutPage,página de check-out>> da aplicação será exibida.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ru.asciidoc
index a20adc5..026412c 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_ru.asciidoc
@@ -151,7 +151,9 @@
</div>*
</body>
----
-3. Добавьте ссылку на таблицу стилей в заголовке страницы и измените текст заголовка.
+
+[start=3]
+. Добавьте ссылку на таблицу стилей в заголовке страницы и измените текст заголовка.
[source,xml]
----
@@ -162,7 +164,9 @@
<title>*The Affable Bean*</title>
</head>
----
-4. Откройте в редакторе таблицу стилей `affablebean.css`. Вначале создайте правила для идентификаторов созданных тегов `<div>`.
+
+[start=4]
+. Откройте в редакторе таблицу стилей `affablebean.css`. Вначале создайте правила для идентификаторов созданных тегов `<div>`.
* Для указания размеров областей используйте свойства `width` и `height`.
* Чтобы отличать области при просмотре страницы, используйте свойство `background`.
* Для горизонтального центрирования четырех областей на странице, можно добавить параметр `margin: 20px auto` к правилу `body`. (`20px` относится к верхнему и нижнему полю; `auto` создает равные промежутки слева и справа.) Затем добавьте параметр `float: left` к левому и правому столбцу.
@@ -205,9 +209,13 @@
background: #eee;
}
----
-5. Нажмите кнопку 'Запустить проект' (image::images/run-project-btn.png[]) на главной панели инструментов IDE. Измененные файлы проекта автоматически сохраняются, код Java компилируется, проект упаковывается и развертывается в GlassFish, затем открывается браузер для просмотра текущего состояния страницы приветствия.
+
+[start=5]
+. Нажмите кнопку 'Запустить проект' (image::images/run-project-btn.png[]) на главной панели инструментов IDE. Измененные файлы проекта автоматически сохраняются, код Java компилируется, проект упаковывается и развертывается в GlassFish, затем открывается браузер для просмотра текущего состояния страницы приветствия.
image::images/index-page.png[title="Выполните проект для просмотра текущего состояния страниц"]
-6. Теперь создайте заполнитель для компонентов страницы в каждой из четырех видимых областей. Начните с верхнего колонтитула. Согласно link:design.html#index[+макету страницы приветствия+], верхний колонтитул должен содержать следующие компоненты:
+
+[start=6]
+. Теперь создайте заполнитель для компонентов страницы в каждой из четырех видимых областей. Начните с верхнего колонтитула. Согласно link:design.html#index[+макету страницы приветствия+], верхний колонтитул должен содержать следующие компоненты:
* Логотип
* Текст логотипа
* Корзина покупок (элемент оформления)
@@ -255,7 +263,9 @@
Также доступно множество комбинаций клавиш. Выберите в основном меню "Справка" пункт "Таблица сочетаний клавиш".
-7. Создайте в таблице стилей правила для новых идентификаторов и классов. После правила `header` добавьте следующие правила. Новый код отображается *полужирным шрифтом*.
+
+[start=7]
+. Создайте в таблице стилей правила для новых идентификаторов и классов. После правила `header` добавьте следующие правила. Новый код отображается *полужирным шрифтом*.
[source,java]
----
@@ -305,7 +315,9 @@
Чтобы увидеть, как свойство действует на страницу, можно закомментировать его и обновить страницу в браузере. Чтобы закомментировать наведите курсор на строку или выделите блок кода, а затем нажмите Ctrl-/ (⌘-/ в Mac).
-8. Сохраните (Ctrl-S; ⌘-S в Mac) файлы `index.jsp` и `affablebean.css`, затем перейдите к браузеру и обновите страницу для просмотра текущего состояния.
+
+[start=8]
+. Сохраните (Ctrl-S; ⌘-S в Mac) файлы `index.jsp` и `affablebean.css`, затем перейдите к браузеру и обновите страницу для просмотра текущего состояния.
*Примечание.* Служебная программа 'Развертывать при сохранении' в IDE автоматически активируется для веб-проектов Java. Это означает, что при каждом сохранении файла, он автоматически компилируется (если это класс Java или страница JSP), и выполняется упаковывание и развертывание проекта на сервере. Поэтому при внесении изменений в HTML и CSS нет необходимости вручную перезапускать проект для просмотра обновленной версии в браузере. Просто сохраните файлы, перейдите к браузеру и обновите страницу.
@@ -315,7 +327,9 @@
2. Создание набора стилей для определения внешнего вида.
3. Просмотр страницы для анализа результатов этих изменений.
Выполняя эти действия, реализуем компоненты в оставшихся областях.
-9. Создайте заполнители для компонентов в правом столбце. В соответствии с link:design.html#index[+макетом страницы приветствия+], в правом столбце расположены четыре блока одинакового размера.
+
+[start=9]
+. Создайте заполнители для компонентов в правом столбце. В соответствии с link:design.html#index[+макетом страницы приветствия+], в правом столбце расположены четыре блока одинакового размера.
Создайте структуру четырех блоков. Вставьте следующий текст между тегами `<div id="indexRightColumn">`. Новый код отображается *полужирным шрифтом*.
@@ -345,7 +359,9 @@
</div>*
</div>
----
-10. Добавьте в файл `affablebean.css` правила стилей для новых классов `categoryBox` и `categoryLabelText`. Новый код отображается *полужирным шрифтом*.
+
+[start=10]
+. Добавьте в файл `affablebean.css` правила стилей для новых классов `categoryBox` и `categoryLabelText`. Новый код отображается *полужирным шрифтом*.
[source,java]
----
@@ -385,9 +401,13 @@
Так же как "Предварительный просмотр CSS", "Конструктор стилей CSS" синхронизирован с редактором. При выборе свойства в "Конструкторе стилей CSS" правило автоматически обновляется в редакторе. Аналогично, при внесении изменений в редакторе выбранные свойства в "Конструкторе стилей CSS" немедленно обновляются.
-11. Сохраните (Ctrl-S; ?-S в Mac) файлы `index.jsp` и `affablebean.css`, затем перейдите к браузеру и обновите страницу для просмотра текущего состояния.
+
+[start=11]
+. Сохраните (Ctrl-S; ?-S в Mac) файлы `index.jsp` и `affablebean.css`, затем перейдите к браузеру и обновите страницу для просмотра текущего состояния.
image::images/index-page3.png[title="Заполнители для заголовков и правого столбца отображаются при запуске проекта"]
-12. В левом столбце и нижнем колонтитуле требуются заполнители только для статического текста, поэтому добавьте их одновременно.
+
+[start=12]
+. В левом столбце и нижнем колонтитуле требуются заполнители только для статического текста, поэтому добавьте их одновременно.
Вставьте между тегами `<div id="indexLefttColumn">` и `<div id="footer">` следующий код. Новый код отображается *полужирным шрифтом*.
@@ -407,7 +427,9 @@
<p id="footerText">[ footer text ]</p>*
</div>
----
-13. Внесите изменения в таблицу стилей `affablebean.css`. Нет необходимости учитывать все новые идентификаторы и классы, можно улучшить внешний вид позже, после получения от клиента текста и изображений.
+
+[start=13]
+. Внесите изменения в таблицу стилей `affablebean.css`. Нет необходимости учитывать все новые идентификаторы и классы, можно улучшить внешний вид позже, после получения от клиента текста и изображений.
Тег горизонтальной линии (`<hr>`) занимает всю ширину родительского элемента (`<div id="footer"`). Поэтому для изменения ширины линии в соответствии с макетом следует изменить ширину элемента `<div id="footer">`. Новый код отображается *полужирным шрифтом*.
@@ -429,7 +451,9 @@
width: 300px;
}*
----
-14. Сохраните (Ctrl-S; ?-S в Mac) файлы `index.jsp` и `affablebean.css`, затем перейдите к браузеру и обновите страницу для просмотра текущего состояния.
+
+[start=14]
+. Сохраните (Ctrl-S; ?-S в Mac) файлы `index.jsp` и `affablebean.css`, затем перейдите к браузеру и обновите страницу для просмотра текущего состояния.
image::images/index-page4.png[title="Отображаются заполнители для левого столбца и нижнего колонтитула"]
Страница приветствия готова. Созданы все необходимые заполнители для компонентов, которые будут добавлены на страницу.
@@ -439,9 +463,9 @@
1. Создайте теги `<div>` для основных областей страницы.
2. Для каждой области страницы выполните следующие действия:
-1. Создание структуры с помощью HTML.
-2. Создание набора стилей для определения внешнего вида.
-3. Просмотр страницы для анализа результатов этих изменений.
+.. Создание структуры с помощью HTML.
+.. Создание набора стилей для определения внешнего вида.
+.. Просмотр страницы для анализа результатов этих изменений.
Не забывайте использовать поддержку HTML и CSS среды IDE. <<tipsTricks,Полезные советы>> Если требуется просто получить код для оставшихся страниц и продолжить выполнение учебного курса, можно link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot1.zip[+загрузить снимок 1 ` проекта AffableBean`+]. Изображения начальной реализации макетов оставшихся страниц.
@@ -532,13 +556,17 @@
Поведение элементов меню среды IDE часто зависит от контекста. Например, при щелчке правой кнопкой мыши узла WEB-INF когда отображен мастер создания папок, `web/WEB-INF` был автоматически введен в поле 'Родительская папка'. Точно так же, при щелчке правой кнопкой мыши узла в окне 'Проекты' и выборе 'Создать', список типов файлов частично определяется предыдущими выборками.
-3. Создайте два сегмента JSP: `header.jspf` и `footer.jspf`. Для этого щелкните правой кнопкой мыши новую созданную папку `jspf` и выберите 'Создать' > JSP. В мастере создания JSP введите имя файла и под надписью "Параметры" выберите параметр "Создать как сегмент JSP", затем нажмите кнопку "Готово".
+
+[start=3]
+. Создайте два сегмента JSP: `header.jspf` и `footer.jspf`. Для этого щелкните правой кнопкой мыши новую созданную папку `jspf` и выберите 'Создать' > JSP. В мастере создания JSP введите имя файла и под надписью "Параметры" выберите параметр "Создать как сегмент JSP", затем нажмите кнопку "Готово".
После этого в окне "Проекты" отображаются файлы `header.jspf` и `footer.jspf`:
image::images/projects-win-jspf.png[title="В проекте отображаются фрагменты JSP нижнего и верхнего колонтитулов"]
Теперь можно скопировать код верхнего колонтитула из любой страницы JSP и вставить его в файл `header.jspf`. Аналогично, можно скопировать текст нижнего колонтитула из любой страницы JSP и вставить его в файл `footer.jspf`. После этого можно удалить код верхнего и нижнего колонтитулов из всех страниц JSP.
-4. Скопируйте код верхнего колонтитула из любой страницы JSP и вставьте его в файл `header.jspf`. Верхний колонтитул должен включать описатель типа документа и открывающие теги `<html>`, `<head>` и `<body>` и текст до закрывающего тега элемента `<div id="header&quot>`. Убедитесь, что добавлены заполнители для элементов, используемых в верхней части представлений страниц: корзины покупок, переключателя языков и кнопки "Переход к проверке". После вставки кода в файл `header.jspf`, он будет выглядеть следующим образом:
+
+[start=4]
+. Скопируйте код верхнего колонтитула из любой страницы JSP и вставьте его в файл `header.jspf`. Верхний колонтитул должен включать описатель типа документа и открывающие теги `<html>`, `<head>` и `<body>` и текст до закрывающего тега элемента `<div id="header&quot>`. Убедитесь, что добавлены заполнители для элементов, используемых в верхней части представлений страниц: корзины покупок, переключателя языков и кнопки "Переход к проверке". После вставки кода в файл `header.jspf`, он будет выглядеть следующим образом:
[source,html]
----
@@ -579,7 +607,9 @@
<img src="#" id="logoText" alt="the affable bean">
</div>
----
-5. Скопируйте код нижнего колонтитула из любой страницы JSP и вставьте его в файл `footer.jspf`. Код нижнего колонтитула должен включать в себя элемент `<div id="footer">` и текст до закрывающего тега `<html>`. После вставки кода в файл `footer.jspf` он будет выглядеть следующим образом:
+
+[start=5]
+. Скопируйте код нижнего колонтитула из любой страницы JSP и вставьте его в файл `footer.jspf`. Код нижнего колонтитула должен включать в себя элемент `<div id="footer">` и текст до закрывающего тега `<html>`. После вставки кода в файл `footer.jspf` он будет выглядеть следующим образом:
[source,html]
----
@@ -592,7 +622,9 @@
</body>
</html>
----
-6. Удалите код верхнего и нижнего колонтитулов из всех пяти страниц JSP (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp` и `confirmation.jsp`).
+
+[start=6]
+. Удалите код верхнего и нижнего колонтитулов из всех пяти страниц JSP (`index.jsp`, `category.jsp`, `cart.jsp`, `checkout.jsp` и `confirmation.jsp`).
@@ -606,12 +638,22 @@
3. Нажмите кнопку "Завершить". Файл `web.xml` создается и добавляется в проект. В редакторе открывается графический интерфейс среды IDE для дескриптора развертывания.
Интерфейс разбит на категории в соответствии в областями, которые могут быть настроены в веб-приложении. Эти области (например, "Сервлеты", "Фильтры","Ссылки" и "Безопасность") отображаются на панели инструментов редактора как вкладки. На вкладке XML отображается весь исходный код файла. При любых изменениях, сделанных в графическом интерфейсе, исходный код дескриптора развертывания немедленно обновляется. В этом можно убедиться, открыв вкладку XML. Выполните следующие действия.
-4. Выберите вкладку "Страницы", затем нажмите кнопку "Добавить в группу свойств JSP". Открывается диалоговое окно "Добавление группы свойств JSP".
-5. Введите в поле "Описание" текст "`header and footer settings`". Оставьте поле "Отображаемое имя" пустым. Поля "Отображаемое имя" и "Описание" являются необязательными для заполнения.
-6. В поле "Шаблоны URL" введите пути к пяти представлениям. Введите "`/index.jsp`" и "`/WEB-INF/view/*`". Разделите эти два пути запятой. (Символ "`*`" — это подстановочный знак, обозначающий все файлы в данной папке.)
+
+[start=4]
+. Выберите вкладку "Страницы", затем нажмите кнопку "Добавить в группу свойств JSP". Открывается диалоговое окно "Добавление группы свойств JSP".
+
+[start=5]
+. Введите в поле "Описание" текст "`header and footer settings`". Оставьте поле "Отображаемое имя" пустым. Поля "Отображаемое имя" и "Описание" являются необязательными для заполнения.
+
+[start=6]
+. В поле "Шаблоны URL" введите пути к пяти представлениям. Введите "`/index.jsp`" и "`/WEB-INF/view/*`". Разделите эти два пути запятой. (Символ "`*`" — это подстановочный знак, обозначающий все файлы в данной папке.)
image::images/add-jsp-prop-group-dialog.png[title="Используйте диалоговое окно 'Добавить группу свойств JSP', чтобы указать теги <jsp-config> в дескрипторе развертывания"]
-7. Нажмите кнопку "ОК". В категорию "Группа свойств JSP" на вкладке "Страницы" добавляется запись.
-8. Переключитесь обратно на вкладку XML. Обратите внимание, что в дескриптор развертывания добавился следующий код.
+
+[start=7]
+. Нажмите кнопку "ОК". В категорию "Группа свойств JSP" на вкладке "Страницы" добавляется запись.
+
+[start=8]
+. Переключитесь обратно на вкладку XML. Обратите внимание, что в дескриптор развертывания добавился следующий код.
[source,xml]
----
@@ -627,12 +669,16 @@
*Примечание.* Может потребоваться добавление символа возврата каретки к коду, чтобы он отображался на нескольких строках. Можно щелкнуть правой кнопкой мыши в редакторе и выбрать 'Формат' (Alt-Shift-F, Ctrl-Shift-F на Mac), чтобы задать для код правильные отступы.
-9. Переключитесь снова на вкладку "Страницы" и введите в поля "Включить вводные части" и "Включить заключительные части" пути к файлам `header.jspf` и `footer.jspf` соответственно. Можно нажать кнопку "Обзор" и выбрать файлы в диалоговом окне.
+
+[start=9]
+. Переключитесь снова на вкладку "Страницы" и введите в поля "Включить вводные части" и "Включить заключительные части" пути к файлам `header.jspf` и `footer.jspf` соответственно. Можно нажать кнопку "Обзор" и выбрать файлы в диалоговом окне.
[.feature]
--
image::images/jsp-prop-groups-small.png[role="left", link="images/jsp-prop-groups.png"]
--
-10. Переключитесь обратно на вкладку XML. Обратите внимание, что добавился следующий код. (Изменения *выделены полужирным шрифтом*.)
+
+[start=10]
+. Переключитесь обратно на вкладку XML. Обратите внимание, что добавился следующий код. (Изменения *выделены полужирным шрифтом*.)
[source,xml]
----
@@ -651,7 +697,9 @@
Определения этих и остальных доступных в дескрипторе веб-развертывания тегов приведены в link:http://jcp.org/en/jsr/detail?id=315[+Спецификации сервлетов+].
-11. Выполните приложение повторно (нажмите клавишу F6; комбинацию клавиш fn+F6 в Mac OS). Код верхнего и нижнего колонтитулов уже удален из файла`index.jsp`, поэтому при запросе этого файла можно убедиться, что код автоматически добавляется.
+
+[start=11]
+. Выполните приложение повторно (нажмите клавишу F6; комбинацию клавиш fn+F6 в Mac OS). Код верхнего и нижнего колонтитулов уже удален из файла`index.jsp`, поэтому при запросе этого файла можно убедиться, что код автоматически добавляется.
<<welcome-page,Страница приветствия отображается как ранее>>, включая содержимое верхнего и нижнего колонтитулов.
@@ -668,7 +716,9 @@
2. В мастере введите в поле "Имя класса" `ControllerServlet`.
3. В поле "Пакет", введите `controller`. (Пакет автоматически создается после завершения работы мастера.)
image::images/servlet-wizard.png[title="Используйте мастер создания сервлетов для создания сервлетов для проекта"]
-4. Нажмите кнопку "Далее". На третьем экране мастера можно настроить сервлет. Наиболее значимыми являются шаблоны URL-адресов, которые требуется указать. Эти шаблоны определяют URL-адреса, по которым выполняется сервлет. Например, если ввести "`/category`", сервлет будет обрабатывать запросы следующего вида.
+
+[start=4]
+. Нажмите кнопку "Далее". На третьем экране мастера можно настроить сервлет. Наиболее значимыми являются шаблоны URL-адресов, которые требуется указать. Эти шаблоны определяют URL-адреса, по которым выполняется сервлет. Например, если ввести "`/category`", сервлет будет обрабатывать запросы следующего вида.
[source,java]
----
@@ -676,9 +726,13 @@
http://localhost/AffableBean*/category*
----
Шаблоны URL-адресов должны соответствовать представлениям и действиям пользователя. В соответствии с link:design.html#index[+макетом страницы приветствия+], пользователь должен иметь возможность выбрать категорию. Поэтому можно связать URL-адрес `/category` с действием нажатия изображения категории. Аналогично, на link:design.html#category[+странице категории+] пользователи должны иметь возможность добавить элемент в корзину покупок. Поэтому можно указать URL-адрес `/addToCart`.
-5. В поле "Шаблоны URL-адресов" введите `/category, /addToCart, /viewCart`. Шаблоны разделяются запятыми. Можно создать дополнительные шаблоны непосредственно в классе сервлета после его создания.
+
+[start=5]
+. В поле "Шаблоны URL-адресов" введите `/category, /addToCart, /viewCart`. Шаблоны разделяются запятыми. Можно создать дополнительные шаблоны непосредственно в классе сервлета после его создания.
image::images/servlet-wizard2.png[title="Настройте развертывание сервлета напрямую в мастере"]
-6. Нажмите кнопку "Завершить". `ControllerServlet` создается в среде IDE и открывается в редакторе. Сервлет и шаблоны URL-адресов включены в аннотацию `@WebServlet`, расположенную перед сигнатурой класса.
+
+[start=6]
+. Нажмите кнопку "Завершить". `ControllerServlet` создается в среде IDE и открывается в редакторе. Сервлет и шаблоны URL-адресов включены в аннотацию `@WebServlet`, расположенную перед сигнатурой класса.
[source,java]
----
@@ -708,7 +762,9 @@
<url-pattern>/viewCart</url-pattern>
</servlet-mapping>
----
-7. Добавьте остальные шаблоны URL-адресов прямо в аннотацию `@WebServlet` в элемент `urlPatterns`. В приложении требуются шаблоны URL-адресов для остальных действий и представлений. Можно ввести следующие шаблоны:
+
+[start=7]
+. Добавьте остальные шаблоны URL-адресов прямо в аннотацию `@WebServlet` в элемент `urlPatterns`. В приложении требуются шаблоны URL-адресов для остальных действий и представлений. Можно ввести следующие шаблоны:
* `/updateCart`
* `/checkout`
* `/purchase`
@@ -727,7 +783,9 @@
"/purchase",
"/chooseLanguage"*})
----
-8. Наконец, добавьте элемент `loadOnStartup`, чтобы экземпляр сервлета создавался и инициализировался при развертывании приложения. Для этого задайте значение `0` или большее (по умолчанию используется значение `-1`).
+
+[start=8]
+. Наконец, добавьте элемент `loadOnStartup`, чтобы экземпляр сервлета создавался и инициализировался при развертывании приложения. Для этого задайте значение `0` или большее (по умолчанию используется значение `-1`).
[source,java]
----
@@ -762,8 +820,12 @@
1. Откройте диспетчер шаблонов, выбрав в главном меню "Сервис" пункт "Шаблоны".
2. Разверните категорию Web, затем выберите шаблон "Сервлет".
image::images/template-manager.png[title="Доступ и изменение шаблонов файлов с помощью диспетчера шаблонов"]
-3. Нажмите кнопку "Открыть в редакторе".
-4. Измените шаблон в редакторе. При следующем создании нового сервлета (например, с помощью мастера создания сервлетов), будет применена новая версия.
+
+[start=3]
+. Нажмите кнопку "Открыть в редакторе".
+
+[start=4]
+. Измените шаблон в редакторе. При следующем создании нового сервлета (например, с помощью мастера создания сервлетов), будет применена новая версия.
@@ -860,7 +922,9 @@
}
----
Продолжив работу с учебным курсом, вы вернётесь к `ControllerServlet` и реализуете каждый из сопоставленных шаблонов URL-адреса отдельно.
-2. Рассмотрим этот код. Следует обратить внимание на следующие моменты:
+
+[start=2]
+. Рассмотрим этот код. Следует обратить внимание на следующие моменты:
* Сервлет использует переменную экземпляра `userPath` для получения запрошенного шаблона URL-адреса от клиента:
[source,java]
@@ -899,7 +963,9 @@
Можно управлять ключевыми словами, отображаемыми в окне "Задачи". Откройте окно "Параметры" (в меню "Сервис" пункт "Параметры"; меню NetBeans, пункт "Параметры" в Mac OS), затем выберите "Разное" > "Задания".
-3. Выполните проект (нажмите клавишу F6; fn+F6 в Mac OS) и проверьте, что `ControllerServlet` перенаправляет запросы соответствующим представлениям.
+
+[start=3]
+. Выполните проект (нажмите клавишу F6; fn+F6 в Mac OS) и проверьте, что `ControllerServlet` перенаправляет запросы соответствующим представлениям.
* Введите в строке адреса браузера `http://localhost:8080/AffableBean/category`. Отображается <<categoryPage,страница категории>> приложения.
* Введите в строке адреса браузера `http://localhost:8080/AffableBean/viewCart`. Отображается <<cartPage,страница корзины покупок>>.
* Введите в строке адреса браузера `http://localhost:8080/AffableBean/checkout`. Отображается <<checkoutPage,страница проверки>> приложения.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_zh_CN.asciidoc
index 9ef2f51..472b61c 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/page-views-controller_zh_CN.asciidoc
@@ -151,7 +151,9 @@
</div>*
</body>
----
-3. 在页面的头中添加对样式表的引用,并更改标题文本。
+
+[start=3]
+. 在页面的头中添加对样式表的引用,并更改标题文本。
[source,xml]
----
@@ -162,7 +164,9 @@
<title>*The Affable Bean*</title>
</head>
----
-4. 在编辑器中打开 `affablebean.css` 样式表。首先为刚创建的 `<div>` ID 创建样式规则。
+
+[start=4]
+. 在编辑器中打开 `affablebean.css` 样式表。首先为刚创建的 `<div>` ID 创建样式规则。
* 使用 `width` 和 `height` 属性创建每个区域所占的空间。
* 使用 `background` 属性区分显示的页面区域。
* 为了使四个区域在页面中水平居中,可以在 `body` 规则中包含 `margin: 20px auto`。(`20px` 适用于顶部和底部间距;`auto` 可在左侧和右侧创建相等的间距。)然后,在左栏和右栏中包括 `float: left`。
@@ -205,9 +209,13 @@
background: #eee;
}
----
-5. 在 IDE 的主工具栏中单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。此时,将自动保存包含更改的项目文件、编译项目中的任何 Java 代码、打包项目并将其部署到 GlassFish,并且浏览器随即打开以显示欢迎页的当前状态。
+
+[start=5]
+. 在 IDE 的主工具栏中单击 "Run Project"(运行项目)(image::images/run-project-btn.png[]) 按钮。此时,将自动保存包含更改的项目文件、编译项目中的任何 Java 代码、打包项目并将其部署到 GlassFish,并且浏览器随即打开以显示欢迎页的当前状态。
image::images/index-page.png[title="运行项目以查看页的当前状态"]
-6. 现在,开始分别为四个可视区域中的页面组件创建占位符。首先从页眉开始。查看link:design.html#index[+欢迎页模型+],页眉应该包含以下组件:
+
+[start=6]
+. 现在,开始分别为四个可视区域中的页面组件创建占位符。首先从页眉开始。查看link:design.html#index[+欢迎页模型+],页眉应该包含以下组件:
* 徽标
* 徽标文本
* 购物车窗口部件
@@ -255,7 +263,9 @@
您还可以利用大量的快捷键。从主菜单中选择 "Help"(帮助)> "Keyboard Shortcuts Card"(快捷键列表)。
-7. 在样式表中,为新 ID 和类创建规则。在 `header` 规则下面添加以下规则。(新代码以*粗体*显示。)
+
+[start=7]
+. 在样式表中,为新 ID 和类创建规则。在 `header` 规则下面添加以下规则。(新代码以*粗体*显示。)
[source,java]
----
@@ -305,7 +315,9 @@
要查看属性影响页面的方式,您可以将其注释掉,然后在浏览器中刷新页面。要注释掉代码,请将光标置于代码行上,或者突出显示代码块,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
-8. 保存(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)`index.jsp` 和 `affablebean.css` 文件,然后切换到浏览器并刷新页面以查看其当前状态。
+
+[start=8]
+. 保存(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)`index.jsp` 和 `affablebean.css` 文件,然后切换到浏览器并刷新页面以查看其当前状态。
*注:*系统会自动为 Java Web 项目激活 IDE 的“在保存时部署”功能。这意味着每次保存文件时,都会自动编译该文件(即,如果该文件为 Java 类或 JSP 页),并且还会重新打包项目并将其部署到服务器。因此,在进行 HTML 或 CSS 更改时,您不需要显式重新运行项目以在浏览器中查看更新后的版本。您只需保存文件,然后切换到浏览器并刷新页面。
@@ -315,7 +327,9 @@
2. 创建一组用于定义外观的样式。
3. 查看页面以检查更改后的结果。
按照这三个步骤,让我们实现其余区域中的组件。
-9. 为右栏中的组件创建占位符。根据link:design.html#index[+欢迎页模型+],右栏包含四个均匀分布的框。
+
+[start=9]
+. 为右栏中的组件创建占位符。根据link:design.html#index[+欢迎页模型+],右栏包含四个均匀分布的框。
为这四个框创建结构。在 `<div id="indexRightColumn">` 标记之间插入以下代码。(新代码以*粗体*显示。)
@@ -345,7 +359,9 @@
</div>*
</div>
----
-10. 在 `affablebean.css` 中为新的 `categoryBox` 和 `categoryLabelText` 类添加样式规则。(新代码以*粗体*显示。)
+
+[start=10]
+. 在 `affablebean.css` 中为新的 `categoryBox` 和 `categoryLabelText` 类添加样式规则。(新代码以*粗体*显示。)
[source,java]
----
@@ -385,9 +401,13 @@
与“CSS 预览”一样,样式构建器会与编辑器保持同步。当在样式构建器中做出选择时,编辑器中的样式规则也会自动更新。同样,当在编辑器中键入更改时,样式构建器中的选择也会立即更新。
-11. 保存(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)`index.jsp` 和 `affablebean.css` 文件,然后切换到浏览器并刷新页面以查看其当前状态。
+
+[start=11]
+. 保存(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)`index.jsp` 和 `affablebean.css` 文件,然后切换到浏览器并刷新页面以查看其当前状态。
image::images/index-page3.png[title="在运行项目时会显示页眉和右栏的占位符"]
-12. 左栏和页脚只需要静态文本的占位符,因此让我们同时实现这两个区域。
+
+[start=12]
+. 左栏和页脚只需要静态文本的占位符,因此让我们同时实现这两个区域。
在 `<div id="indexLefttColumn">` 和 `<div id="footer">` 标记之间插入以下代码。(新代码以*粗体*显示。)
@@ -407,7 +427,9 @@
<p id="footerText">[ footer text ]</p>*
</div>
----
-13. 更改 `affablebean.css` 样式表。此时无需考虑所有的新 ID 和类 - 您可在以后从客户接收到文本和图像时再微调外观。
+
+[start=13]
+. 更改 `affablebean.css` 样式表。此时无需考虑所有的新 ID 和类 - 您可在以后从客户接收到文本和图像时再微调外观。
水平规则 (`<hr>`) 标记会扩展至包含它的元素 (`<div id="footer"`) 的整个长度。因此,要根据模型图像缩短其长度,您可以调整 `<div id="footer">` 的宽度。(新代码以*粗体*显示。)
@@ -429,7 +451,9 @@
width: 300px;
}*
----
-14. 保存(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)`index.jsp` 和 `affablebean.css` 文件,然后切换到浏览器并刷新页面以查看其当前状态。
+
+[start=14]
+. 保存(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)`index.jsp` 和 `affablebean.css` 文件,然后切换到浏览器并刷新页面以查看其当前状态。
image::images/index-page4.png[title="显示左栏和页脚的占位符"]
欢迎页已经完成。您已经为将存在于页面上的组件创建了所有必需的占位符。
@@ -439,9 +463,9 @@
1. 为主页面区域创建 `<div>` 标记。
2. 依次为每个区域重复执行以下三个步骤:
-1. 在 HTML 中创建结构。
-2. 创建一组用于定义外观的样式。
-3. 查看页面以检查更改后的结果。
+.. 在 HTML 中创建结构。
+.. 创建一组用于定义外观的样式。
+.. 查看页面以检查更改后的结果。
请确保利用 IDE 所提供的 HTML 和 CSS 支持。下面介绍了一些<<tipsTricks,提示和技巧>>。如果您只希望获取其余页面的代码并继续完成本教程,可以link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot1.zip[+下载 `AffableBean` 项目的快照 1+]。此处包含其余页面的初始模型实现图像。
@@ -532,13 +556,17 @@
IDE 提供的菜单项通常与上下文有关。例如,由于您右键单击了 "WEB-INF" 节点,因此在显示新建文件夹向导时,会在 "Parent Folder"(父文件夹)字段中自动输入 `web/WEB-INF`。同样,当您在 "Projects"(项目)窗口中右键单击某个节点并选择“新建”时,所列的文件类型部分取决于您之前选择的项目。
-3. 创建两个 JSP 片段:`header.jspf` 和 `footer.jspf`。为此,请右键单击新创建的 `jspf` 文件夹,然后选择 "New"(新建)> "JSP"。在新建 JSP 向导中,输入文件名,在 "Options"(选项)下选择 "Create as a JSP Segment"(作为 JSP 片段创建)选项,然后单击 "Finish"(完成)。
+
+[start=3]
+. 创建两个 JSP 片段:`header.jspf` 和 `footer.jspf`。为此,请右键单击新创建的 `jspf` 文件夹,然后选择 "New"(新建)> "JSP"。在新建 JSP 向导中,输入文件名,在 "Options"(选项)下选择 "Create as a JSP Segment"(作为 JSP 片段创建)选项,然后单击 "Finish"(完成)。
完成后,将看到 `header.jspf` 和 `footer.jspf` 显示在 "Projects"(项目)窗口中:
image::images/projects-win-jspf.png[title="将在项目中显示页眉和页脚 JSP 片段"]
现在,您可以从任意 JSP 页中复制页眉代码并将其粘贴到 `header.jspf` 文件中。同样,您可以从任意 JSP 页中复制页脚代码并将其粘贴到 `footer.jspf` 文件中。完成此任务后,可以从所有 JSP 页中删除页眉和页脚代码。
-4. 从任意 JSP 页中复制页眉代码并将其粘贴到 `header.jspf` 文件中。页眉应该包括页面文档类型以及从 `<html>`、`<head>` 和 `<body>` 起始标记到 `<div id="header">` 元素的结束标记之间的内容。请确保包括在页面视图顶部使用的购物车窗口部件、语言切换和 "proceed to checkout" 按钮的占位符。在将代码粘贴到 `header.jspf` 中后,该文件将如下所示。
+
+[start=4]
+. 从任意 JSP 页中复制页眉代码并将其粘贴到 `header.jspf` 文件中。页眉应该包括页面文档类型以及从 `<html>`、`<head>` 和 `<body>` 起始标记到 `<div id="header">` 元素的结束标记之间的内容。请确保包括在页面视图顶部使用的购物车窗口部件、语言切换和 "proceed to checkout" 按钮的占位符。在将代码粘贴到 `header.jspf` 中后,该文件将如下所示。
[source,html]
----
@@ -579,7 +607,9 @@
<img src="#" id="logoText" alt="the affable bean">
</div>
----
-5. 从任意 JSP 页中复制页脚代码并将其粘贴到 `footer.jspf` 文件中。页脚代码应该包括从 `<div id="footer">` 元素到 `<html>` 结束标记之间的内容。在将代码粘贴到 `footer.jspf` 中后,该文件将如下所示。
+
+[start=5]
+. 从任意 JSP 页中复制页脚代码并将其粘贴到 `footer.jspf` 文件中。页脚代码应该包括从 `<div id="footer">` 元素到 `<html>` 结束标记之间的内容。在将代码粘贴到 `footer.jspf` 中后,该文件将如下所示。
[source,html]
----
@@ -592,7 +622,9 @@
</body>
</html>
----
-6. 从所有五个 JSP 页(`index.jsp`、`category.jsp`、`cart.jsp`、`checkout.jsp` 和 `confirmation.jsp`)中删除页眉和页脚。
+
+[start=6]
+. 从所有五个 JSP 页(`index.jsp`、`category.jsp`、`cart.jsp`、`checkout.jsp` 和 `confirmation.jsp`)中删除页眉和页脚。
@@ -606,12 +638,22 @@
3. 单击 "Finish"(完成)。将会创建 `web.xml` 文件并将其添加到项目中。编辑器中会打开部署描述符的 IDE 图形界面。
该界面按可以在 Web 应用程序中配置的区域进行分类。这些区域在编辑器工具栏中显示为标签,并包含 "Servlet"、“过滤器”、“引用”和“安全”等主题。"XML" 标签显示文件的整个源代码。您在图形界面中所做的任何更改将会导致立即更新部署描述符的源代码,通过切换到 "XML" 标签可以对此进行验证。下面的步骤演示了这一点。
-4. 单击 "Pages"(页面)标签,然后单击 "Add JSP Property Group"(添加 JSP 属性组)按钮。打开 "Add JSP Property Group"(添加 JSP 属性组)对话框。
-5. 在 "Description"(描述)字段中键入 "`header and footer settings`"。将 "Display Name"(显示名称)保留为空。"Display Name"(显示名称)和 "Description"(描述)字段均为可选字段。
-6. 对于 "URL Patterns"(URL 模式),指定五个视图的路径。键入 "`/index.jsp`" 和 "`/WEB-INF/view/*`"。使用逗号分隔这两个路径。("`*`" 是表示给定文件夹内所有文件的通配符。)
+
+[start=4]
+. 单击 "Pages"(页面)标签,然后单击 "Add JSP Property Group"(添加 JSP 属性组)按钮。打开 "Add JSP Property Group"(添加 JSP 属性组)对话框。
+
+[start=5]
+. 在 "Description"(描述)字段中键入 "`header and footer settings`"。将 "Display Name"(显示名称)保留为空。"Display Name"(显示名称)和 "Description"(描述)字段均为可选字段。
+
+[start=6]
+. 对于 "URL Patterns"(URL 模式),指定五个视图的路径。键入 "`/index.jsp`" 和 "`/WEB-INF/view/*`"。使用逗号分隔这两个路径。("`*`" 是表示给定文件夹内所有文件的通配符。)
image::images/add-jsp-prop-group-dialog.png[title="使用 "] 标记">
-7. 单击 "OK"(确定)。在 "Pages"(页面)标签的 "JSP Properties Groups"(JSP 属性组)类别中添加一个条目。
-8. 切换回 "XML" 标签。请注意,以下代码已添加到部署描述符中。
+
+[start=7]
+. 单击 "OK"(确定)。在 "Pages"(页面)标签的 "JSP Properties Groups"(JSP 属性组)类别中添加一个条目。
+
+[start=8]
+. 切换回 "XML" 标签。请注意,以下代码已添加到部署描述符中。
[source,xml]
----
@@ -627,12 +669,16 @@
*注:*您可能需要在代码中添加回车符,以便该代码显示为多行。可以在编辑器中单击鼠标右键并选择 "Format"(格式化)(Alt-Shift-F 组合键;在 Mac 上为 Ctrl-Shift-F 组合键)来适当缩进代码。
-9. 再次切换到 "Pages"(页面)标签,然后在 "Include Preludes"(包括 Prelude)和 "Include Codas"(包括 Coda)字段中,分别输入 `header.jspf` 和 `footer.jspf` 文件的路径。您可以单击 "Browse"(浏览)按钮,然后在提供的对话框中导航至这些文件。
+
+[start=9]
+. 再次切换到 "Pages"(页面)标签,然后在 "Include Preludes"(包括 Prelude)和 "Include Codas"(包括 Coda)字段中,分别输入 `header.jspf` 和 `footer.jspf` 文件的路径。您可以单击 "Browse"(浏览)按钮,然后在提供的对话框中导航至这些文件。
[.feature]
--
image::images/jsp-prop-groups-small.png[role="left", link="images/jsp-prop-groups.png"]
--
-10. 切换回 "XML" 标签。请注意,已经添加以下代码。(更改内容以*粗体*显示。)
+
+[start=10]
+. 切换回 "XML" 标签。请注意,已经添加以下代码。(更改内容以*粗体*显示。)
[source,xml]
----
@@ -651,7 +697,9 @@
要查看上述标记以及 Web 部署描述符中提供的所有标记的定义,请参见 link:http://jcp.org/en/jsr/detail?id=315[+Servlet 规范+]。
-11. 再次运行应用程序(按 F6 键;在 Mac 上为 fn-F6 组合键)。您已经删除了 `index.jsp` 文件中的页眉和页脚代码,因此可以确定在请求该文件时是否会自动添加页眉和页脚。
+
+[start=11]
+. 再次运行应用程序(按 F6 键;在 Mac 上为 fn-F6 组合键)。您已经删除了 `index.jsp` 文件中的页眉和页脚代码,因此可以确定在请求该文件时是否会自动添加页眉和页脚。
您将看到<<welcome-page,欢迎页显示的内容和以前一样>>,其中包括页眉和页脚内容。
@@ -668,7 +716,9 @@
2. 在向导的 "Class Name"(类名)字段中,键入 `ControllerServlet`。
3. 在 "Package"(包)字段中,键入 `controller`。(完成向导后,将会自动创建新包。)
image::images/servlet-wizard.png[title="使用 Servlet 向导可为项目创建 Servlet"]
-4. 单击 "Next"(下一步)。该向导的步骤 3 允许您配置 Servlet。最重要的是您需要指定 URL 模式。该模式标识用于调用 Servlet 的 URL。例如,如果输入 "`/category`",则会指定 Servlet 处理如下所示的请求。
+
+[start=4]
+. 单击 "Next"(下一步)。该向导的步骤 3 允许您配置 Servlet。最重要的是您需要指定 URL 模式。该模式标识用于调用 Servlet 的 URL。例如,如果输入 "`/category`",则会指定 Servlet 处理如下所示的请求。
[source,java]
----
@@ -676,9 +726,13 @@
http://localhost/AffableBean*/category*
----
URL 模式应该与用户可以启动的视图和操作相对应。查看link:design.html#index[+欢迎页模型+],用户应该能够选择类别。因此,我们可以将 `/category` URL 与单击类别图像的操作相关联。同样,在link:design.html#category[+类别页+]中,用户应该能够向购物车添加项目。因此,我们可以指定 `/addToCart`。
-5. 在 "URL Pattern(s)"(URL 模式)字段中,键入 "`/category, /addToCart, /viewCart`"。各模式之间使用逗号分隔。创建 Servlet 类后,您可以直接在其中添加更多模式。
+
+[start=5]
+. 在 "URL Pattern(s)"(URL 模式)字段中,键入 "`/category, /addToCart, /viewCart`"。各模式之间使用逗号分隔。创建 Servlet 类后,您可以直接在其中添加更多模式。
image::images/servlet-wizard2.png[title="直接在向导中配置 Servlet 部署"]
-6. 单击 "Finish"(完成)。IDE 生成 `ControllerServlet` 并在编辑器中将其打开。Servlet 和 URL 模式包括在 `@WebServlet` 标注中,该标注显示在类签名上面。
+
+[start=6]
+. 单击 "Finish"(完成)。IDE 生成 `ControllerServlet` 并在编辑器中将其打开。Servlet 和 URL 模式包括在 `@WebServlet` 标注中,该标注显示在类签名上面。
[source,java]
----
@@ -708,7 +762,9 @@
<url-pattern>/viewCart</url-pattern>
</servlet-mapping>
----
-7. 直接在 `@WebServlet` 标注的 `urlPatterns` 元素中添加其他 URL 模式。应用程序需要更多 URL 模式以便用于其他操作和视图。您可以键入下列模式:
+
+[start=7]
+. 直接在 `@WebServlet` 标注的 `urlPatterns` 元素中添加其他 URL 模式。应用程序需要更多 URL 模式以便用于其他操作和视图。您可以键入下列模式:
* `/updateCart`
* `/checkout`
* `/purchase`
@@ -727,7 +783,9 @@
"/purchase",
"/chooseLanguage"*})
----
-8. 最后,包括 `loadOnStartup` 元素,以便在部署应用程序时实例化和初始化该 Servlet。值等于或大于 `0` 将导致发生此行为(`-1` 为默认值)。
+
+[start=8]
+. 最后,包括 `loadOnStartup` 元素,以便在部署应用程序时实例化和初始化该 Servlet。值等于或大于 `0` 将导致发生此行为(`-1` 为默认值)。
[source,java]
----
@@ -762,8 +820,12 @@
1. 通过从主菜单中选择 "Tools"(工具)> "Templates"(模板)以打开 "Template Manager"(模板管理器)。
2. 展开 "Web" 类别,然后选择 "Servlet" 模板。
image::images/template-manager.png[title="通过模板管理器访问和修改文件模板"]
-3. 单击 "Open in Editor"(在编辑器中打开)按钮。
-4. 在编辑器中修改模板。下次您创建新的 Servlet(例如,使用 Servlet 向导)时,将会应用新版本。
+
+[start=3]
+. 单击 "Open in Editor"(在编辑器中打开)按钮。
+
+[start=4]
+. 在编辑器中修改模板。下次您创建新的 Servlet(例如,使用 Servlet 向导)时,将会应用新版本。
@@ -860,7 +922,9 @@
}
----
继续执行该教程的操作时,将返回 `ControllerServlet`,并单独实现每个映射的 URL 模式。
-2. 检查上面的代码。有几点需要注:
+
+[start=2]
+. 检查上面的代码。有几点需要注:
* Servlet 使用 `userPath` 实例变量从客户端获取请求的 URL 模式:
[source,java]
@@ -899,7 +963,9 @@
您可以控制 "Tasks"(任务)窗口中显示的关键字。打开 "Options"(选项)窗口("Tools"(工具)> "Options"(选项);在 Mac 上为 "NetBeans" > "Preferences"(首选项)),然后选择 "Miscellaneous"(其他)> "Tasks"(任务)。
-3. 运行项目(按 F6 键;在 Mac 上为 fn-F6 组合键)并测试以查看 `ControllerServlet` 是否将请求转发到相应的视图。
+
+[start=3]
+. 运行项目(按 F6 键;在 Mac 上为 fn-F6 组合键)并测试以查看 `ControllerServlet` 是否将请求转发到相应的视图。
* 在浏览器的地址栏中键入 `http://localhost:8080/AffableBean/category`。将显示应用程序的<<categoryPage,类别页>>。
* 在浏览器的地址栏中键入 `http://localhost:8080/AffableBean/viewCart`。将显示应用程序的<<cartPage,购物车页>>。
* 在浏览器的地址栏中键入 `http://localhost:8080/AffableBean/checkout`。将显示应用程序的<<checkoutPage,结帐页>>。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/security.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/security.asciidoc
index d6e6250..ef94dff 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/security.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/security.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Securing the Application
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -48,8 +48,12 @@
* <<usersGroups,Creating Users, Groups and Roles>>
* <<secureTransport,Configuring Secure Data Transport>>
* <<seeAlso,See Also>>
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -107,7 +111,9 @@
If you receive an error when running the project, revisit the link:setup.html[+setup instructions+], which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Test the application's functionality in your browser. This snapshot provides an implementation of the administration console, as specified in the link:design.html#requirements[+customer requirements+]. To examine the administration console, enter the following URL in your browser:
+
+[start=3]
+. Test the application's functionality in your browser. This snapshot provides an implementation of the administration console, as specified in the link:design.html#requirements[+customer requirements+]. To examine the administration console, enter the following URL in your browser:
[source,java]
----
@@ -126,7 +132,9 @@
Likewise, you can view an order summary for each customer either by selecting an order from the administration console's "orders" table, or by clicking the "view order summary" link in a "customer details" display.
image::images/view-order-summary.png[title="Click 'view order summary' from a customer details display in order to view a customer's order details"]
Naturally, none of this information should be available to an anonymous site visitor. In the coming steps, you'll create login and error pages, so that when an unauthenticated user attempts to access the administration console, he or she will be directed to the login page. Upon successful login, the user is then redirected to the administration console's menu; upon login failure, the error page is displayed.
-4. Examine the project snapshot in the Projects window.
+
+[start=4]
+. Examine the project snapshot in the Projects window.
|===
|image::images/projects-window.png[title="The AdminServlet forwards requests to resources within the web/admin folder"] |
@@ -145,7 +153,9 @@
|===
-5. In the browser, return to the customer website by clicking the Affable Bean logo in the upper left corner of the web page. Step through the entire link:design.html#business[+business process flow+] of the application and note that the checkout process is handled over a non-secure channel.
+
+[start=5]
+. In the browser, return to the customer website by clicking the Affable Bean logo in the upper left corner of the web page. Step through the entire link:design.html#business[+business process flow+] of the application and note that the checkout process is handled over a non-secure channel.
When customers reach the checkout page, they are expected to submit sensitive personal information in order to complete their orders. Part of your task in this tutorial unit is to ensure that this data is sent over a secure channel. Because the administration console also enables authenticated users to view customers' personal information, it too needs to be configured so that data is sent over the Internet securely.
@@ -224,9 +234,13 @@
2. Name the file `login`, then click Finish. The new `login.jsp` file is created and opens in the editor.
3. Repeat the previous two steps to create a new `error.jsp` file. In the New JSP wizard, name the file `error`. When you finish, you'll have two new files listed in the Projects window.
image::images/projects-window-jsp.png[title="New JSP file nodes displayed in Projects window"]
-4. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
+
+[start=4]
+. Open the project's web deployment descriptor. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`web`', then click OK.
image::images/go-to-file.png[title="Use the Go to File dialog to quickly open files in the editor"]
-5. In the editor, scroll to the bottom of the `web.xml` file and note the `<jsp-property-group>` entry created for JSP pages in the administration console. Add the new login and error JSP pages as `<url-pattern>` entries. (Changes in *bold*.)
+
+[start=5]
+. In the editor, scroll to the bottom of the `web.xml` file and note the `<jsp-property-group>` entry created for JSP pages in the administration console. Add the new login and error JSP pages as `<url-pattern>` entries. (Changes in *bold*.)
[source,xml]
----
@@ -244,7 +258,9 @@
You can equally configure the `<jsp-property-group>` entry from the `web.xml`'s visual editor. Click the Pages tab along the top of the editor, and enter the URL patterns into the respective JSP Property Group.
-6. Press Ctrl-Tab to switch to the `login.jsp` file in the editor. Delete the entire template contents for the file, then enter the following HTML form.
+
+[start=6]
+. Press Ctrl-Tab to switch to the `login.jsp` file in the editor. Delete the entire template contents for the file, then enter the following HTML form.
[source,html]
----
@@ -262,7 +278,9 @@
</form>
----
Note that the HTML form is based on the <<template,template provided above>>. Here, you use the "`j_security_check`" keyword as the value for the form's `action` attribute, and the "`j_username`" and "`j_password`" keywords as the values for the `name` attribute of the username and password text fields. The style of the form is implemented by encapsulating the form widgets within a `<div>` element, then defining a set of rules for the `loginBox` ID in `affablebean.css`.
-7. Press Ctrl-Tab and switch to the `error.jsp` file in the editor. Delete the entire template contents for the file, then enter the following.
+
+[start=7]
+. Press Ctrl-Tab and switch to the `error.jsp` file in the editor. Delete the entire template contents for the file, then enter the following.
[source,html]
----
@@ -290,7 +308,9 @@
* *Form Error Page:* `/admin/error.jsp`
* *Realm Name:* `file`
image::images/login-configuration.png[title="Specify security settings for the application using the IDE's web.xml visual editor"]
-4. Click the XML tab along the top of the editor and verify the changes made to the deployment descriptor. The following entry has been added to the bottom of the file:
+
+[start=4]
+. Click the XML tab along the top of the editor and verify the changes made to the deployment descriptor. The following entry has been added to the bottom of the file:
[source,xml]
----
@@ -305,9 +325,15 @@
</login-config>
----
This entry informs the servlet container that form-based authentication is used, the realm named `file` should be checked for user credentials, and specifies the whereabouts of the login and error pages.
-5. Click the Security tab again, then expand the Security Roles heading and click Add.
-6. In the Add Security Role dialog, type in `affableBeanAdmin` for the role name, then click OK. The new role entry is added beneath Security Roles.
-7. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
+
+[start=5]
+. Click the Security tab again, then expand the Security Roles heading and click Add.
+
+[start=6]
+. In the Add Security Role dialog, type in `affableBeanAdmin` for the role name, then click OK. The new role entry is added beneath Security Roles.
+
+[start=7]
+. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
[source,xml]
----
@@ -318,18 +344,30 @@
</security-role>
----
Here we've specified the name of a security role used with the application. We'll need to associate this role with the protected resources that define the administration console (under the Security Constraints heading below), and later we'll <<defineRoles,create this role on the GlassFish server>>.
-8. Click the Security tab again, then click the Add Security Constraint button.
-9. Type in `Admin` for the Display Name, then under Web Resource Collection click the Add button. Enter the following details, then when you are finished, click OK.
+
+[start=8]
+. Click the Security tab again, then click the Add Security Constraint button.
+
+[start=9]
+. Type in `Admin` for the Display Name, then under Web Resource Collection click the Add button. Enter the following details, then when you are finished, click OK.
* *Resource Name:* `Affable Bean Administration`
* *URL Pattern(s):* `/admin/*`
* *HTTP Method(s):* `All HTTP Methods`
image::images/add-web-resource.png[title="Specify which resources need to be protected using the Add Web Resource dialog"]
-10. Under the new Admin security constraint, select the Enable Authentication Constraint option and click the Edit button next to the Role Name(s) text field.
-11. In the dialog that displays, select the `affableBeanAdmin` role in the left column, then click Add. The role is moved to the right column.
+
+[start=10]
+. Under the new Admin security constraint, select the Enable Authentication Constraint option and click the Edit button next to the Role Name(s) text field.
+
+[start=11]
+. In the dialog that displays, select the `affableBeanAdmin` role in the left column, then click Add. The role is moved to the right column.
image::images/edit-role-names.png[title="Specify roles to be associated with an authentication constraint"]
-12. Click OK. The role is added to the Role Name(s) text field.
+
+[start=12]
+. Click OK. The role is added to the Role Name(s) text field.
image::images/security-tab.png[title="Security constraints include specifying the web resource collection, and role(s) that are granted access to the collection"]
-13. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
+
+[start=13]
+. Click the XML tab to examine how the file has been affected. Note that the following entry has been added:
[source,xml]
----
@@ -348,8 +386,12 @@
</security-constraint>
----
In these previous six steps, you've created a security constraint that specifies which resources need to be protected, and identifies the role(s) that are granted access to them. Since the administration console implementation is essentially everything contained within the application's `admin` folder, you use a wildcard (`*`). Although you've specified that all HTTP methods should be protected, you could have equally selected just GET and POST, since these are the only two that are handled by the `AdminServlet`. As previously mentioned, the `affableBeanAdmin` role that we declared still needs to be created on the GlassFish server.
-14. Run the project ( image::images/run-project-btn.png[] ) to examine how the application now handles access to the administration console.
-15. When the application opens in the browser, attempt to access the administration console by entering the following URL into the browser's address bar:
+
+[start=14]
+. Run the project ( image::images/run-project-btn.png[] ) to examine how the application now handles access to the administration console.
+
+[start=15]
+. When the application opens in the browser, attempt to access the administration console by entering the following URL into the browser's address bar:
[source,java]
----
@@ -358,7 +400,9 @@
----
When you attempt to access the administration console, the login page is now presented.
image::images/login-form.png[title="Unauthenticated attempts to access the administration console are redirected to the login page"]
-16. Click the 'submit' button to attempt login. You see the error page displayed.
+
+[start=16]
+. Click the 'submit' button to attempt login. You see the error page displayed.
image::images/error-page.png[title="Error page is displayed when the server is unable to authenticate a user"]
@@ -377,10 +421,10 @@
A _user_ is a unique identity recognized by the server. You define users on the server so that it can be able to determine who should have access to protected resources. You can optionally cluster users together into a _group_, which can be understood as a set of authenticated users. In order to specify which users and/or groups have access to protected resources, you create _roles_. As stated in the Java EE 6 Tutorial,
-[quote]
-----
+[NOTE]
+====
_A role is an abstract name for the permission to access a particular set of resources in an application. A role can be compared to a key that can open a lock. Many people might have a copy of the key. The lock doesn’t care who you are, only that you have the right key._
-----
+====
The role that a user or group is assigned to is what specifically allows the server to determine whether protected resources can be accessed. Users and groups can be assigned to multiple roles. As will be demonstrated below, you accomplish this by defining the role in the application, then mapping it to users and groups on the server.
@@ -419,16 +463,24 @@
4. Log into the Administration Console by typing `admin` / `adminadmin` for the username / password.
5. In the Tree which displays in the left column of the Administration Console, expand the Configuration > Security > Realms nodes, then click the `file` realm.
image::images/file-realm.png[title="Expand the Configuration > Security > Realms nodes to view existing security realms"]
-6. In the main panel of the GlassFish Administration Console, under Edit Realm, click the Manage Users button.
-7. Under File Users, click the New button.
-8. Under New File Realm User, enter the following details:
+
+[start=6]
+. In the main panel of the GlassFish Administration Console, under Edit Realm, click the Manage Users button.
+
+[start=7]
+. Under File Users, click the New button.
+
+[start=8]
+. Under New File Realm User, enter the following details:
* *User ID:* `nbuser`
* *Group List:* `affableBeanAdmin`
* *New Password:* `secret`
* *Confirm New Password:* `secret`
image::images/new-file-realm-user.png[title="Enter new user and group details in the New File Realm User panel"]
Here, we are creating a user for the `file` security realm, which we've randomly named `nbuser`. We have also assigned the new user to a randomly named `affableBeanAdmin` group. Remember the `secret` password you set, as you will require it to later log into the `AffableBean` administration console.
-9. Click OK. The new `nbuser` user is now listed under File Users in the GlassFish Administration Console.
+
+[start=9]
+. Click OK. The new `nbuser` user is now listed under File Users in the GlassFish Administration Console.
image::images/nbuser-file-realm.png[title="All users and groups pertaining to the 'file' realm are displayed under File Users"]
Optionally close the browser window for the GlassFish Administration Console, or leave it open for the time being. You will need to return to the Administration Console in the <<mapApplication,Map Roles to Users and/or Groups>> step below.
@@ -533,7 +585,9 @@
*@RolesAllowed("affableBeanAdmin")*
public CustomerOrder findByCustomer(Object customer) { ... }
----
-3. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.annotation.security.RolesAllowed` is added to the top of the class.
+
+[start=3]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.annotation.security.RolesAllowed` is added to the top of the class.
The `findByCustomer` method is only called by the `AdminServlet`, which is previously authenticated into the `affableBeanAdmin` role using our implementation of form-based authentication. The use of the `@RolesAllowed` annotation here is not strictly necessary - its application simply guarantees that the method can only be called by a user who has been authenticated in the `affableBeanAdmin` role.
@@ -578,20 +632,28 @@
The Java EE 6 Tutorial defines the term _principal_ as, "An entity that can be authenticated by an authentication protocol in a security service that is deployed in an enterprise. A principal is identified by using a principal name and authenticated by using authentication data." See link:http://download.oracle.com/javaee/6/tutorial/doc/bnbxj.html#bnbxq[+Working with Realms, Users, Groups, and Roles: Some Other Terminology+] for more information.
-7. Click the Save button.
+
+[start=7]
+. Click the Save button.
At this stage, you have taken the necessary steps to enable you to log into the `AffableBean` administration console using the `nbuser` / `secret` username / password combination that you set earlier.
-8. Run the project ( image::images/run-project-btn.png[] ). When the application opens in the browser, attempt the access the administration console by entering the following URL into the browser's address bar:
+
+[start=8]
+. Run the project ( image::images/run-project-btn.png[] ). When the application opens in the browser, attempt the access the administration console by entering the following URL into the browser's address bar:
[source,java]
----
http://localhost:8080/AffableBean*/admin/*
----
-9. When the login page displays, enter the username and password you set earlier in the GlassFish Administration Console (`nbuser` / `secret`), then click 'submit'.
+
+[start=9]
+. When the login page displays, enter the username and password you set earlier in the GlassFish Administration Console (`nbuser` / `secret`), then click 'submit'.
Using form-based authentication, the server authenticates the client using the username and password credentials sent from the form. Because the `nbuser` belongs to the `affableBeanAdmin` group, and that group is associated with the `affableBeanAdmin` role, access is granted to the administration console.
-10. Click the 'log out' link provided in the administration console. The `nbuser` is logged out of the administration console, and you are returned to the login page.
+
+[start=10]
+. Click the 'log out' link provided in the administration console. The `nbuser` is logged out of the administration console, and you are returned to the login page.
The `AdminServlet` handles the '`/logout`' URL pattern by invalidating the user session:
@@ -641,7 +703,9 @@
----
The browser displays a warning, indicating that the server is presenting you with a self-signed certificate. In Firefox for example, the warning looks as follows.
image::images/ff-untrusted-connection.png[title="Firefox provides warnings for self-signed certificates"]
-4. Enable your browser to accept the self-signed certificate. With Firefox, click the Add Exception button displayed in the warning. The following pane displays, allowing you to view the certificate.
+
+[start=4]
+. Enable your browser to accept the self-signed certificate. With Firefox, click the Add Exception button displayed in the warning. The following pane displays, allowing you to view the certificate.
image::images/ff-confirm-security-exception.png[title="Firefox enables you to view the digital certificate before confirming the security exception"]
Click Confirm Security Exception. A secure connection is established on port 8181, and your local development server, GlassFish, is then able to display the following page.
image::images/gf-https.png[title="GlassFish provides a secure connection by default on port 8181"]
@@ -649,21 +713,30 @@
Aside from the HTTPS protocol displayed in the browser's address bar, Firefox indicates that a secure connection is established with the blue background behind `localhost` in the address bar. Also, a lock ( image::images/firefox-lock-icon.png[] ) icon displays in the lower right corner of the browser. You can click the lock icon for secure pages to review certificate details.
The following optional steps demonstrate how you can identify this security support in the GlassFish Administration Console.
-5. Open the GlassFish Administration Console in the browser. (Either type '`http://localhost:4848/`' in your browser, or click the '`go to the Administration Console`' link in the GlassFish server's welcome page, as displayed in the <<serverWelcomePage,image above>>.)
-6. In the Tree which displays in the left column of the Administration Console, expand the Configuration > Network Config nodes, then click the Network Listeners node.
+
+[start=5]
+. Open the GlassFish Administration Console in the browser. (Either type '`http://localhost:4848/`' in your browser, or click the '`go to the Administration Console`' link in the GlassFish server's welcome page, as displayed in the <<serverWelcomePage,image above>>.)
+
+[start=6]
+. In the Tree which displays in the left column of the Administration Console, expand the Configuration > Network Config nodes, then click the Network Listeners node.
The main panel displays the three network listeners enabled by default on the GlassFish server. `http-listener-2`, which has been configured to listen over port 8181, is the network listener used for secure connections.
image::images/network-listeners.png[title="View all HTTP listeners from the Network Listeners panel"]
For more information on network listeners, see the Oracle GlassFish Server 3.0.1 Administration Guide: link:http://docs.sun.com/app/docs/doc/821-1751/giuri?l=en&a=view[+About HTTP Network Listeners+].
-7. Under the Name column, click the link for `http-listener-2`. In the main panel, note that the Security checkbox is selected.
+
+[start=7]
+. Under the Name column, click the link for `http-listener-2`. In the main panel, note that the Security checkbox is selected.
image::images/edit-network-listener.png[title="Security is enabled for the 'http-listener-2' network listener"]
-8. Click the SSL tab. Note that TLS is selected. In the lower portion of the SSL panel, you see the Cipher Suites that are available for the connection. As stated in the Oracle GlassFish Server 3.0.1 Administration Guide, link:http://docs.sun.com/app/docs/doc/821-1751/ablnk[+Chapter 11: Administering System Security+],
-[quote]
-----
+
+[start=8]
+. Click the SSL tab. Note that TLS is selected. In the lower portion of the SSL panel, you see the Cipher Suites that are available for the connection. As stated in the Oracle GlassFish Server 3.0.1 Administration Guide, link:http://docs.sun.com/app/docs/doc/821-1751/ablnk[+Chapter 11: Administering System Security+],
+
+[NOTE]
+====
_A cipher is a cryptographic algorithm used for encryption or decryption. SSL and TLS protocols support a variety of ciphers used to authenticate the server and client to each other, transmit certificates, and establish session keys. Some ciphers are stronger and more secure than others. Clients and servers can support different cipher suites. During a secure connection, the client and the server agree to use the strongest cipher that they both have enabled for communication, so it is usually sufficient to enable all ciphers._
-----
+====
At this stage, you have an understanding of how the GlassFish server supports secure connections out-of-the-box. Naturally, you could set up your own network listener, have it listen on a port other than 8181, enable SSL 3 instead of TLS (or both), or generate and sign your own digital certificates using Java's link:http://download.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html[+`keytool`+] management utility. You can find instructions on how to accomplish all of these tasks from the following resources:
* The Java EE 6 Tutorial, link:http://download.oracle.com/javaee/6/tutorial/doc/bnbxw.html[+Establishing a Secure Connection Using SSL+]
* Oracle GlassFish Server 3.0.1 Administration Guide, link:http://docs.sun.com/app/docs/doc/821-1751/ablnk[+Chapter 11: Administering System Security+]
@@ -685,12 +758,16 @@
*Note:* Recall that the `/checkout` URL pattern is handled by the `ControllerServlet`'s `doGet` method, and forwards the user to the checkout page.
-4. Under the new Checkout security constraint, select the Enable User Data Constraint option, then in the Transport Guarantee drop-down, select `CONFIDENTIAL`.
+
+[start=4]
+. Under the new Checkout security constraint, select the Enable User Data Constraint option, then in the Transport Guarantee drop-down, select `CONFIDENTIAL`.
image::images/checkout-security-constraint.png[title="Use the web.xml visual editor to specify security settings for the application"]
When you choose `CONFIDENTIAL` as a security constraint, you are instructing the server to encrypt data using TLS/SSL so that it cannot be read while in transit. For more information, see the Java EE 6 Tutorial, link:http://download.oracle.com/javaee/6/tutorial/doc/gkbaa.html#bncbm[+Specifying a Secure Connection+].
-5. Click the XML tab along the top of the editor. Note that the following `<security-constraint>` entry has been added.
+
+[start=5]
+. Click the XML tab along the top of the editor. Note that the following `<security-constraint>` entry has been added.
[source,xml]
----
@@ -709,8 +786,12 @@
</security-constraint>
----
Configuration for the customer checkout process is now complete. To ensure that a secure connection is applied for access to the administration console, simply specify that any requests handled by the `AdminServlet` are transmitted over a secure channel.
-6. Open the `AdminServlet`. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`admin`', then click OK.
-7. Use the link:http://download.oracle.com/javaee/6/api/javax/servlet/annotation/HttpConstraint.html[+`@HttpConstraint`+] annotation's `transportGuarantee` element to specify a `CONFIDENTIAL` security constraint. Make the following change (in *bold*).
+
+[start=6]
+. Open the `AdminServlet`. Press Alt-Shift-O (Ctrl-Shift-O on Mac) and in the Go to File dialog, type '`admin`', then click OK.
+
+[start=7]
+. Use the link:http://download.oracle.com/javaee/6/api/javax/servlet/annotation/HttpConstraint.html[+`@HttpConstraint`+] annotation's `transportGuarantee` element to specify a `CONFIDENTIAL` security constraint. Make the following change (in *bold*).
[source,java]
----
@@ -728,12 +809,20 @@
)
public class AdminServlet extends HttpServlet { ... }
----
-8. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.servlet.annotation.ServletSecurity.TransportGuarantee` is added to the top of the class.
-9. Run the project ( image::images/run-project-btn.png[] ) to examine the application's behavior in a browser.
-10. In the browser, step through the `AffableBean` website by selecting a product category and adding several items to your shopping cart. Then click the 'proceed to checkout' button. The website now automatically switches to a secure channel when presenting the checkout page. You see the HTTPS protocol displayed in the browser's address bar, and the port is changed to 8181.
+
+[start=8]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. An import statement for `javax.servlet.annotation.ServletSecurity.TransportGuarantee` is added to the top of the class.
+
+[start=9]
+. Run the project ( image::images/run-project-btn.png[] ) to examine the application's behavior in a browser.
+
+[start=10]
+. In the browser, step through the `AffableBean` website by selecting a product category and adding several items to your shopping cart. Then click the 'proceed to checkout' button. The website now automatically switches to a secure channel when presenting the checkout page. You see the HTTPS protocol displayed in the browser's address bar, and the port is changed to 8181.
image::images/secure-checkout.png[title="The browser address bar indicates that a secure connection is established for customer checkout"]
Also, in Firefox, note the lock ( image::images/firefox-lock-icon.png[] ) icon displayed in the lower right corner of the browser.
-11. Investigate security for the administration console. Type in the following URL into the browser's address bar:
+
+[start=11]
+. Investigate security for the administration console. Type in the following URL into the browser's address bar:
[source,java]
----
@@ -745,10 +834,10 @@
*Note:* You way wonder at this point how it is possible to switch from a secure connection back to a normal, unsecured one. This practice however is not recommended. The link:http://download.oracle.com/javaee/6/tutorial/doc/gkbaa.html#bncbm[+Java EE 6 Tutorial+] explains as follows:
-[quote]
-----
+[NOTE]
+====
_If you are using sessions, after you switch to SSL you should never accept any further requests for that session that are non-SSL. For example, a shopping site might not use SSL until the checkout page, and then it might switch to using SSL to accept your card number. After switching to SSL, you should stop listening to non-SSL requests for this session. The reason for this practice is that the session ID itself was not encrypted on the earlier communications. This is not so bad when you’re only doing your shopping, but after the credit card information is stored in the session, you don’t want a bad guy trying to fake the purchase transaction against your credit card. This practice could be easily implemented using a filter._
-----
+====
You have now successfully secured the `AffableBean` application according to the defined customer requirements. You've set up a login form for the administration console to authorize or deny access based on user credentials, and you configured the application and server to create a secure connection for access to the administration console, as well as the customer checkout process.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ.asciidoc
index ab6c888..02dc043 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Setting up the Development Environment
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -39,16 +39,36 @@
* <<run,Running the Web Project>>
* <<communicate,Communicating with the Database Server>>
* <<seeAlso,See Also>>
-4. link:data-model.html[+Designing the Data Model+]
-5. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
-6. link:connect-db.html[+Connecting the Application to the Database+]
-7. link:entity-session.html[+Adding Entity Classes and Session Beans+]
-8. link:manage-sessions.html[+Managing Sessions+]
-9. link:transaction.html[+Integrating Transactional Business Logic+]
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=4]
+. link:data-model.html[+Designing the Data Model+]
+
+[start=5]
+. link:page-views-controller.html[+Preparing the Page Views and Controller Servlet+]
+
+[start=6]
+. link:connect-db.html[+Connecting the Application to the Database+]
+
+[start=7]
+. link:entity-session.html[+Adding Entity Classes and Session Beans+]
+
+[start=8]
+. link:manage-sessions.html[+Managing Sessions+]
+
+[start=9]
+. link:transaction.html[+Integrating Transactional Business Logic+]
+
+[start=10]
+. link:language.html[+Adding Language Support+]
+
+[start=11]
+. link:security.html[+Securing the Application+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -85,19 +105,33 @@
1. Start the NetBeans IDE. If you are running the IDE for the first time, you will see the IDE's Start Page.
image::images/ide-start-page.png[title="The NetBeans IDE Start Page"]
-2. Click the New Project ( image::images/new-project-btn.png[] ) button (Ctrl-Shift-N; ⌘-Shift-N on Mac) to create a new Java web project. The New Project wizard opens to guide you through the process. Under Categories choose Java Web, then under Projects choose Web Application.
+
+[start=2]
+. Click the New Project ( image::images/new-project-btn.png[] ) button (Ctrl-Shift-N; ⌘-Shift-N on Mac) to create a new Java web project. The New Project wizard opens to guide you through the process. Under Categories choose Java Web, then under Projects choose Web Application.
image::images/new-project-wzd.png[title="Create a project using the New Project wizard"]
-3. Click Next.
-4. In Step 2: Name and Location, name the project `AffableBean`. In this step, you can also designate the location on your computer where the project will reside. By default, the IDE creates a `NetBeansProjects` folder in your home directory. If you'd like to change the location, enter the path in the Project Location text field.
-5. Click Next.
-6. In Step 3: Server and Settings, specify GlassFish v3 as the server to which your project will be deployed during development. Since you've included GlassFish v3 in your NetBeans installation, you'll see that GlassFish v3 is listed in the Server drop-down field.
+
+[start=3]
+. Click Next.
+
+[start=4]
+. In Step 2: Name and Location, name the project `AffableBean`. In this step, you can also designate the location on your computer where the project will reside. By default, the IDE creates a `NetBeansProjects` folder in your home directory. If you'd like to change the location, enter the path in the Project Location text field.
+
+[start=5]
+. Click Next.
+
+[start=6]
+. In Step 3: Server and Settings, specify GlassFish v3 as the server to which your project will be deployed during development. Since you've included GlassFish v3 in your NetBeans installation, you'll see that GlassFish v3 is listed in the Server drop-down field.
If you wanted to deploy to a server that isn't yet registered with the IDE, you would click the Add button, and step through the Add Server Instance wizard. You can view all servers registered with the IDE from the Servers window (Choose Tools > Servers from the main menu).
-7. For Java EE Version, select Java EE 6 Web.
+
+[start=7]
+. For Java EE Version, select Java EE 6 Web.
The application that you create makes use of various Java EE 6 features, namely servlet annotations (new in the link:http://jcp.org/en/jsr/summary?id=315[+Servlet 3.0 Specification+]), and EJBs used directly in servlet containers (new in the link:http://jcp.org/en/jsr/summary?id=318[+EJB 3.1 Specification+]). Both Servlet 3.0 and EJB 3.1 are part of the Java EE 6 platform, therefore you require an EE-6 compliant server such as GlassFish v3 to work through this tutorial. For more information, see link:entity-session.html#specification[+About Specifications and Implementations+].
-8. Make sure that the 'Enable Contexts and Dependency Injection' option is deselected. This option is specific to the Contexts and Dependency Injection (CDI) technology, specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], and is not used in this tutorial. For more information, see link:../cdi-intro.html[+Getting Started with Contexts and Dependency Injection and JSF 2.0+].
+
+[start=8]
+. Make sure that the 'Enable Contexts and Dependency Injection' option is deselected. This option is specific to the Contexts and Dependency Injection (CDI) technology, specified by link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], and is not used in this tutorial. For more information, see link:../cdi-intro.html[+Getting Started with Contexts and Dependency Injection and JSF 2.0+].
image::images/new-project-wzd2.png[title="Specify development server, EE version, and whether to include CDI support"]
Note that by default the context path for the application is the name of the project. This is the path at which your application can be accessed after it is deployed to the server. For example, GlassFish uses 8080 as its default port number, so during development you'll be able to access the project in a browser window from:
@@ -107,12 +141,16 @@
http://localhost:8080/AffableBean/
----
-9. Click Finish. The IDE generates a skeleton project named `AffableBean` that adheres to the link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE Blueprints conventions for web application structure+]. The IDE displays various windows in its default layout.
+
+[start=9]
+. Click Finish. The IDE generates a skeleton project named `AffableBean` that adheres to the link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE Blueprints conventions for web application structure+]. The IDE displays various windows in its default layout.
[.feature]
--
image::images/ide-default-layout.png[role="left", link="images/ide-default-layout.png"]
--
-10. Examine the IDE's default layout. Here's a brief overview of the displayed windows and tabs:
+
+[start=10]
+. Examine the IDE's default layout. Here's a brief overview of the displayed windows and tabs:
* *The Editor:* The editor (Ctrl-0; ⌘-0 on Mac) is the central component of the IDE, and is likely where you'll spend most of your time. The editor automatically adapts to the language you are working in, providing documentation support, code-completion, hints and error messages specific to the technology you are coding in.
* *Projects window:* The Projects window (Ctrl-1; ⌘-1 on Mac) is the entry point to your project sources. It provides a _logical view_ of important project contents, and groups files together based on their function (e.g., `Configuration Files`). When right-clicking file nodes within the Projects window, you can call actions common to your development tasks (i.e., `Build`, `Clean`, `Deploy`, `Run`).
* *Files window:* The Files window (Ctrl-2; ⌘-2 on Mac) provides a directory-based view of your project. That is, it enables you to view the structure of your project, as it exists in your computer's file system. From this window, you can view all files pertaining to your project, including the Ant build script, (`build.xml`), and files required by the IDE to handle the project (contained in the `nbproject` folder). If you've run your project, you can see the location of compiled Java files (`build` folder). If you've explicitly built your project (by choosing Build, or Clean and Build, from the project node's right-click menu in the Projects window), you can view the project's distributable WAR file (contained in the `dist` folder).
@@ -133,12 +171,16 @@
A browser window opens to display the project's welcome page.
image::images/hello-world.png[title="Project automatically deploys to server and displays in browser"]
So what just happened? When you run a web project, the IDE invokes the `run` Ant target in your project's build script. You can investigate by opening your project's `build.xml` file in the editor.
-2. Switch to the Files window (Ctrl-2; ⌘-2 on Mac), expand the project node and double-click the `build.xml` file contained in your project. When the `build.xml` file opens in the editor, the Navigator lists all Ant targets available to the script.
+
+[start=2]
+. Switch to the Files window (Ctrl-2; ⌘-2 on Mac), expand the project node and double-click the `build.xml` file contained in your project. When the `build.xml` file opens in the editor, the Navigator lists all Ant targets available to the script.
image::images/navigator-ant-targets.png[title="The Navigator lists all available Ant targets for the build.xml script"]
Normal Ant targets are displayed using the general target ( image::images/ant-normal-icon.png[] ) icon. The _emphasized_ Ant target ( image::images/ant-emphasized-icon.png[] ) icon merely indicates that the target includes a description, which is displayed as a tooltip (as shown in the above image). For more information, see link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG366[+Creating Java Projects+] in _Developing Applications with NetBeans IDE_.
-3. Double-click the `run` target. The `build-impl.xml` file opens in the editor and displays the target definition.
+
+[start=3]
+. Double-click the `run` target. The `build-impl.xml` file opens in the editor and displays the target definition.
[source,java]
----
@@ -169,13 +211,19 @@
Consult the official link:http://ant.apache.org/manual/index.html[+Ant Manual+] for more information on using Ant.
-4. To generate a distributable WAR file for your project, choose Clean and Build Project (or Clean and Build Main Project) from the IDE's Run menu.
-5. In the Files window (Ctrl-2; ⌘-2 on Mac) expand the project node. The `dist` folder contains the project WAR file. The `build` folder contains your compiled project.
+
+[start=4]
+. To generate a distributable WAR file for your project, choose Clean and Build Project (or Clean and Build Main Project) from the IDE's Run menu.
+
+[start=5]
+. In the Files window (Ctrl-2; ⌘-2 on Mac) expand the project node. The `dist` folder contains the project WAR file. The `build` folder contains your compiled project.
image::images/files-window.png[title="Files window provides a directory-based view of your project"]
*Note:* If you _clean_ the project (In the Projects window, choose Clean from the project node's right-click menu), both of these folders are removed.
-6. Switch to the Services window (Ctrl-5; ⌘-5 on Mac) and expand the Servers > GlassFish Server 3 > Applications node.
+
+[start=6]
+. Switch to the Services window (Ctrl-5; ⌘-5 on Mac) and expand the Servers > GlassFish Server 3 > Applications node.
image::images/services-win-deployed-app.png[title="Services window displays server status, deployed applications and resources"]
*Note:* "GlassFish v3" is the default server name for NetBeans 6.8 users.
@@ -321,20 +369,32 @@
* *Server Port Number:* `3306`
* *Administrator User Name:* `root`
* *Administrator Password:* `nbuser`
-2. Select the Save Password option.
+
+[start=2]
+. Select the Save Password option.
image::images/mysql-server-properties.png[title="Specify MySQL server settings"]
-3. Click OK. The IDE connects to your MySQL database server, and lists database instances that are maintained by the server. If you expand the Drivers node, you can also see that the IDE contains the link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBC driver+] for MySQL.
+
+[start=3]
+. Click OK. The IDE connects to your MySQL database server, and lists database instances that are maintained by the server. If you expand the Drivers node, you can also see that the IDE contains the link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBC driver+] for MySQL.
image::images/services-win-mysql.png[title="Connect to a MySQL server in the Services window"]
The application server (i.e., GlassFish) requires the driver to enable communication between your Java code and the the MySQL database. Because the IDE already contains the Connector/J driver, you do not need to download it. Furthermore, as will later be demonstrated, you can specify in your server settings to enable JDBC driver deployment so that the driver will be automatically deployed to GlassFish if it is missing on the server.
Steps 4-7 below are optional. You can configure the IDE to start and stop the MySQL server, as well as run an external administration tool on the server.
-4. Right-click the MySQL server node and choose Properties. In the MySQL Server Properties dialog, select the Admin Properties tab.
-5. In the 'Path/URL to admin tool' field, enter the path on your computer to the executable file of a database administration tool, such as link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]. The MySQL Administrator is included in the link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+] bundle.
-6. In the 'Path to start command' field, type in the path to the MySQL start command (i.e., `mysqld` or `mysqld_safe`, depending on your operating system. (See <<start,Start the Database Server>> above.)
+
+[start=4]
+. Right-click the MySQL server node and choose Properties. In the MySQL Server Properties dialog, select the Admin Properties tab.
+
+[start=5]
+. In the 'Path/URL to admin tool' field, enter the path on your computer to the executable file of a database administration tool, such as link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]. The MySQL Administrator is included in the link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+] bundle.
+
+[start=6]
+. In the 'Path to start command' field, type in the path to the MySQL start command (i.e., `mysqld` or `mysqld_safe`, depending on your operating system. (See <<start,Start the Database Server>> above.)
*Note:* For Unix-like systems, you may find that you can only invoke the start command with root or administrative privileges. To overcome this, you can create a script (using link:http://www.nongnu.org/gksu/[+GKSu+] for Linux and Solaris, link:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/osascript.1.html[+osascript+] for Mac) that will accomplish this task. For more information, see link:http://davidvancouvering.blogspot.com/2008/09/starting-mysql-in-netbeans-as.html[+this blog post+].
-7. In the 'Path to stop command' field, enter the path to the MySQL stop command (i.e., `mysqladmin shutdown`). Because the command requires a user account with shutdown privileges, you must enter username/password credentials in the Arguments field. For example:
+
+[start=7]
+. In the 'Path to stop command' field, enter the path to the MySQL stop command (i.e., `mysqladmin shutdown`). Because the command requires a user account with shutdown privileges, you must enter username/password credentials in the Arguments field. For example:
* *Arguments:* `-u root -pnbuser shutdown`
After you have set the fields listed under the Advanced Properties tab, you can:
@@ -350,11 +410,15 @@
1. Create the database instance which you will use in this tutorial. To do so, right-click the MySQL Server node and choose Create Database.
2. In the dialog that displays, type in `affablebean`. Select the 'Grant Full Access to' option, then select `root@localhost` from the drop-down field. This enables the `root` account on the `localhost` host access to the database. Later, when you create a connection pool on the server, you'll need to provide the `root` account and `nbuser` password as username/password credentials in order to grant the server access to the database.
image::images/create-mysql-db-dialog.png[title="Right-click the server node and choose Create Database to create a new database instance"]
-3. Click OK. When you do so, the database named `affablebean` is created, and a connection to the database is automatically established. Connections are displayed in the Services window using a connection node ( image::images/db-connection-node.png[] ).
+
+[start=3]
+. Click OK. When you do so, the database named `affablebean` is created, and a connection to the database is automatically established. Connections are displayed in the Services window using a connection node ( image::images/db-connection-node.png[] ).
*Note:* Connection nodes are persisted in the Services window. If you restart the IDE, the connection node displays with a jagged line ( image::images/connection-broken.png[] ), indicating that the connection is broken. To reconnect to a database, make sure that the database server is running, then right-click the node and choose Connect.
-4. Expand the connection node for the `affablebean` database. The connection contains the database's default schema (`affablebean`), and within that are nodes for tables, views, and procedures. Currently these are empty since we haven't created anything yet.
+
+[start=4]
+. Expand the connection node for the `affablebean` database. The connection contains the database's default schema (`affablebean`), and within that are nodes for tables, views, and procedures. Currently these are empty since we haven't created anything yet.
image::images/db-conn-affable-bean.png[title="Database connections contain the database's default schema and nodes for tables, views and procedures"]
At this stage, you've connected to the MySQL server from the IDE and have created a new database named `affablebean` which you'll use throughout the tutorial. Also, you've created a Java web project in the IDE, and have confirmed that it can be successfully built and deployed to your development server, and opened in a browser when run. Now that your development environment is ready, you can begin drafting the application's data model.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ja.asciidoc
index 40e3fa2..b3aa18e 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ja.asciidoc
@@ -80,19 +80,33 @@
1. NetBeans IDEを起動します。初めてIDEを実行している場合は、IDEのスタート・ページが表示されます。
image::images/ide-start-page.png[title="NetBeans IDEのスタート・ページ"]
-2. 「新規プロジェクト」(image::images/new-project-btn.png[])ボタンをクリックして([Ctrl]-[Shift]-[N]、Macの場合は[⌘]-[Shift]-[N])、新しいJava Webプロジェクトを作成します。プロセスをガイドする新規プロジェクト・ウィザードが開きます。「カテゴリ」から「Java Web」を選択し、次に「プロジェクト」から「Webアプリケーション」を選択します。
+
+[start=2]
+. 「新規プロジェクト」(image::images/new-project-btn.png[])ボタンをクリックして([Ctrl]-[Shift]-[N]、Macの場合は[⌘]-[Shift]-[N])、新しいJava Webプロジェクトを作成します。プロセスをガイドする新規プロジェクト・ウィザードが開きます。「カテゴリ」から「Java Web」を選択し、次に「プロジェクト」から「Webアプリケーション」を選択します。
image::images/new-project-wzd.png[title="新規プロジェクト・ウィザードを使用したプロジェクトの作成"]
-3. 「次」をクリックします。
-4. ステップ2の「名前と場所」で、プロジェクトに「`AffableBean`」という名前を付けます。このステップでは、プロジェクトが存在するコンピュータ上の場所を指定することもできます。デフォルトでは、IDEはホーム・ディレクトリ内に`NetBeansProjects`フォルダを作成します。場所を変更する場合は、「プロジェクトの場所」テキスト・フィールドにパスを入力します。
-5. 「次」をクリックします。
-6. ステップ3の「サーバーと設定」で、開発中にプロジェクトをデプロイするサーバーとしてGlassFish v3を指定します。NetBeansインストールにはGlassFish v3が含まれているので、「サーバー」ドロップダウン・フィールドには「GlassFish v3」が表示されています。
+
+[start=3]
+. 「次」をクリックします。
+
+[start=4]
+. ステップ2の「名前と場所」で、プロジェクトに「`AffableBean`」という名前を付けます。このステップでは、プロジェクトが存在するコンピュータ上の場所を指定することもできます。デフォルトでは、IDEはホーム・ディレクトリ内に`NetBeansProjects`フォルダを作成します。場所を変更する場合は、「プロジェクトの場所」テキスト・フィールドにパスを入力します。
+
+[start=5]
+. 「次」をクリックします。
+
+[start=6]
+. ステップ3の「サーバーと設定」で、開発中にプロジェクトをデプロイするサーバーとしてGlassFish v3を指定します。NetBeansインストールにはGlassFish v3が含まれているので、「サーバー」ドロップダウン・フィールドには「GlassFish v3」が表示されています。
IDEにまだ登録していないサーバーをデプロイする場合は、「追加」ボタンをクリックしてサーバー・インスタンスの追加ウィザードを実行します。IDEに登録されているすべてのサーバーは、「サーバー」ウィンドウ(メイン・メニューから「ツール」>「サーバー」を選択)から表示できます。
-7. 「Java EEバージョン」で、「Java EE 6 Web」を選択します。
+
+[start=7]
+. 「Java EEバージョン」で、「Java EE 6 Web」を選択します。
作成するアプリケーションでは、Java EE 6の様々な機能、つまり、サーブレット注釈(link:http://jcp.org/en/jsr/summary?id=315[+サーブレット3.0仕様+]の新機能)とサーブレット・コンテナ内で直接使用されるEJB (link:http://jcp.org/en/jsr/summary?id=318[+EJB 3.1仕様の新機能+])を使用します。サーブレット3.0とEJB 3.1はどちらもJava EE 6プラットフォームの一部であるため、このチュートリアルに沿って作業するには、GlassFish v3などのEE 6準拠サーバーが必要です。詳細は、link:entity-session.html#specification[+仕様および実装について+]を参照してください。
-8. 「コンテキストと依存性の注入を有効にする」オプションが選択されていないことを確認します。このオプションは、link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+]で規定されているコンテキストと依存性の注入(CDI: Contexts and Dependency Injection)テクノロジに固有のもので、このチュートリアルでは使用しません。詳細は、link:../cdi-intro.html[+コンテキストと依存性の注入およびJSF 2.0の開始+]を参照してください。
+
+[start=8]
+. 「コンテキストと依存性の注入を有効にする」オプションが選択されていないことを確認します。このオプションは、link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+]で規定されているコンテキストと依存性の注入(CDI: Contexts and Dependency Injection)テクノロジに固有のもので、このチュートリアルでは使用しません。詳細は、link:../cdi-intro.html[+コンテキストと依存性の注入およびJSF 2.0の開始+]を参照してください。
image::images/new-project-wzd2.png[title="開発サーバー、EEバージョン、CDIサポートを含めるかどうかの指定"]
デフォルトでは、アプリケーションのコンテキスト・パスはプロジェクトの名前です。これは、アプリケーションがサーバーにデプロイされた後でアクセスできるパスです。たとえば、GlassFishはデフォルトのポート番号として8080を使用するため、開発中はブラウザ・ウィンドウで以下からプロジェクトにアクセスできます。
@@ -102,12 +116,16 @@
http://localhost:8080/AffableBean/
----
-9. 「終了」をクリックします。IDEは、link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE BlueprintsのWebアプリケーション構造の規約+]に準拠した`AffableBean`という名前のスケルトン・プロジェクトを生成します。IDEに、デフォルト・レイアウトで様々なウィンドウが表示されます。
+
+[start=9]
+. 「終了」をクリックします。IDEは、link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE BlueprintsのWebアプリケーション構造の規約+]に準拠した`AffableBean`という名前のスケルトン・プロジェクトを生成します。IDEに、デフォルト・レイアウトで様々なウィンドウが表示されます。
[.feature]
--
image:images/ide-default-layout.png[role="left", link="images/ide-default-layout.png"]
--
-10. IDEのデフォルト・レイアウトを確認します。ここでは、表示されるウィンドウとタブについて簡単に説明します。
+
+[start=10]
+. IDEのデフォルト・レイアウトを確認します。ここでは、表示されるウィンドウとタブについて簡単に説明します。
* *エディタ: *エディタ([Ctrl]-[0]、Macの場合は[⌘]-[0])は、IDEの中心的なコンポーネントであり、作業時間のほとんどを費やす可能性がある場所です。エディタは、使用している言語に自動的に適応し、コーディングで使用するテクノロジに固有のドキュメント・サポート、コード補完、ヒントおよびエラー・メッセージを提供します。
* *「プロジェクト」ウィンドウ: *「プロジェクト」ウィンドウ([Ctrl]-[1]、Macの場合は[⌘]-[1])は、プロジェクト・ソースへのエントリ・ポイントです。重要なプロジェクト内容の_論理ビュー_が表示され、ファイルがその機能(たとえば、`構成ファイル`)に基づいてグループ分けされています。「プロジェクト」ウィンドウ内でファイル・ノードを右クリックすると、開発タスクに共通するアクション(つまり、`Build`、`Clean`、`Deploy`、`Run`)をコールできます。
* *「ファイル」ウィンドウ: *「ファイル」ウィンドウ([Ctrl]-[2]、Macの場合は[⌘]-[2])には、プロジェクトがディレクトリ・ベースで表示されます。つまり、コンピュータのファイル・システムに存在するプロジェクトの構造を表示できます。このウィンドウから、Antビルド・スクリプト(`build.xml`)やIDEでプロジェクトを処理するのに必要な(`nbproject`フォルダに格納された)ファイルを含む、プロジェクトに関係するすべてのファイルを表示できます。プロジェクトを実行した場合は、コンパイルされたJavaファイルの場所(`build`フォルダ)を表示できます。(「プロジェクト」ウィンドウのプロジェクト・ノードの右クリック・メニューから「ビルド」または「消去してビルド」を選択して)プロジェクトを明示的にビルドした場合は、(`dist`フォルダに格納された)プロジェクトの配布可能WARファイルを表示できます。
@@ -128,12 +146,16 @@
ブラウザ・ウィンドウが開き、プロジェクトの開始画面が表示されます。
image::images/hello-world.png[title="プロジェクトがサーバーに自動的にデプロイされてブラウザに表示される"]
では、何か起きたのでしょうか。Webプロジェクトを実行すると、IDEはプロジェクトのビルド・スクリプト内の`run` Antターゲットを呼び出します。プロジェクトの`build.xml`ファイルをエディタで開いて調べることができます。
-2. 「ファイル」ウィンドウに切り替えて([Ctrl]-[2]、Macの場合は[⌘]-[2])、プロジェクト・ノードを展開し、プロジェクトに含まれる`build.xml`ファイルをダブルクリックします。`build.xml`ファイルがエディタで開くと、スクリプトで使用できるすべてのAntターゲットがナビゲータに一覧表示されます。
+
+[start=2]
+. 「ファイル」ウィンドウに切り替えて([Ctrl]-[2]、Macの場合は[⌘]-[2])、プロジェクト・ノードを展開し、プロジェクトに含まれる`build.xml`ファイルをダブルクリックします。`build.xml`ファイルがエディタで開くと、スクリプトで使用できるすべてのAntターゲットがナビゲータに一覧表示されます。
image::images/navigator-ant-targets.png[title="ナビゲータにbuild.xmlスクリプトの使用可能なすべてのAntターゲットが一覧表示される"]
通常のAntターゲットは汎用のターゲット(image::images/ant-normal-icon.png[])アイコンを使用して表示されます。_強調された_Antターゲット(image::images/ant-emphasized-icon.png[])アイコンは、単にそのターゲットに(前述のイメージに示すように)ツールチップとして表示される説明が含まれることを示しています。詳細は、link:../../java/project-setup.html[+Javaプロジェクトの作成、インポート、および構成+]を参照してください。
-3. `run`ターゲットをダブルクリックします。`build-impl.xml`ファイルがエディタで開き、ターゲットの定義が表示されます。
+
+[start=3]
+. `run`ターゲットをダブルクリックします。`build-impl.xml`ファイルがエディタで開き、ターゲットの定義が表示されます。
[source,java]
----
@@ -164,13 +186,19 @@
Antの使用方法については、link:http://ant.apache.org/manual/index.html[+Ant公式マニュアル+]を参照してください。
-4. プロジェクトの配布可能WARファイルを生成するには、IDEの「実行」メニューから「プロジェクトを消去してビルド」(または「メイン・プロジェクトを消去してビルド」)を選択します。
-5. 「ファイル」ウィンドウ([Ctrl]-[2]、Macの場合は[⌘]-[2])でプロジェクト・ノードを展開します。`dist`フォルダにプロジェクトのWARファイルが格納されています。`build`フォルダにコンパイルされたプロジェクトが格納されています。
+
+[start=4]
+. プロジェクトの配布可能WARファイルを生成するには、IDEの「実行」メニューから「プロジェクトを消去してビルド」(または「メイン・プロジェクトを消去してビルド」)を選択します。
+
+[start=5]
+. 「ファイル」ウィンドウ([Ctrl]-[2]、Macの場合は[⌘]-[2])でプロジェクト・ノードを展開します。`dist`フォルダにプロジェクトのWARファイルが格納されています。`build`フォルダにコンパイルされたプロジェクトが格納されています。
image::images/files-window.png[title="「ファイル」ウィンドウにプロジェクトがディレクトリ・ベースで表示される"]
*注意: *(「プロジェクト」ウィンドウでプロジェクト・ノードの右クリック・メニューから「消去」を選択して)プロジェクトを_消去_すると、これらのフォルダが両方とも除去されます。
-6. 「サービス」ウィンドウに切り替えて([Ctrl]-[5]、Macの場合は[⌘]-[5])、「サーバー」>「GlassFish Server 3」>「アプリケーション」ノードを展開します。
+
+[start=6]
+. 「サービス」ウィンドウに切り替えて([Ctrl]-[5]、Macの場合は[⌘]-[5])、「サーバー」>「GlassFish Server 3」>「アプリケーション」ノードを展開します。
image::images/services-win-deployed-app.png[title="「サービス」ウィンドウにサーバー・ステータス、デプロイされたアプリケーションおよびリソースが表示される"]
*注意: *「GlassFish v3」はNetBeans 6.8ユーザー用のデフォルトのサーバー名です。
@@ -316,20 +344,32 @@
* *サーバー・ポート番号: *`3306`
* *管理ユーザー名: *`root`
* *管理パスワード: *`nbuser`
-2. 「パスワードを保存」オプションを選択します。
+
+[start=2]
+. 「パスワードを保存」オプションを選択します。
image::images/mysql-server-properties.png[title="MySQLサーバーの設定の指定"]
-3. 「OK」をクリックします。IDEがMySQLデータベース・サーバーに接続し、サーバーによって管理されているデータベース・インスタンスが一覧表示されます。また、「ドライバ」ノードを展開すると、IDEにMySQL用のlink:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBCドライバ+]が含まれていることがわかります。
+
+[start=3]
+. 「OK」をクリックします。IDEがMySQLデータベース・サーバーに接続し、サーバーによって管理されているデータベース・インスタンスが一覧表示されます。また、「ドライバ」ノードを展開すると、IDEにMySQL用のlink:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBCドライバ+]が含まれていることがわかります。
image::images/services-win-mysql.png[title="「サービス」ウィンドウでのMySQLサーバーへの接続"]
アプリケーション・サーバー(つまり、GlassFish)には、JavaコードとMySQLデータベース間の通信を有効にするドライバが必要です。IDEにはすでにConnector/Jドライバが含まれているので、ダウンロードする必要はありません。また、後で説明するように、サーバー設定でJDBCドライバをデプロイするように指定できるので、ドライバがサーバー上にない場合は自動的にGlassFishにデプロイされます。
以下のステップ4から7はオプションです。MySQLサーバーを起動および停止したり、サーバーに対して外部管理ツールを実行したりするようにIDEを構成できます。
-4. 「MySQLサーバー」ノードを右クリックして「プロパティ」を選択します。「MySQLサーバー・プロパティ」ダイアログで「管理プロパティ」を選択します。
-5. 「管理ツールのパスまたはURL」フィールドに、コンピュータ上にあるデータベース管理ツール(link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]など)の実行可能ファイルへのパスを入力します。MySQL Administratorは、link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+]バンドルに含まれています。
-6. 「起動コマンドへのパス」フィールドに、オペレーティング・システムに応じたMySQLの起動コマンド(つまり、`mysqld`または`mysqld_safe`)へのパスを入力します。(上記の<<start,データベース・サーバーの起動>>を参照してください。)
+
+[start=4]
+. 「MySQLサーバー」ノードを右クリックして「プロパティ」を選択します。「MySQLサーバー・プロパティ」ダイアログで「管理プロパティ」を選択します。
+
+[start=5]
+. 「管理ツールのパスまたはURL」フィールドに、コンピュータ上にあるデータベース管理ツール(link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]など)の実行可能ファイルへのパスを入力します。MySQL Administratorは、link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+]バンドルに含まれています。
+
+[start=6]
+. 「起動コマンドへのパス」フィールドに、オペレーティング・システムに応じたMySQLの起動コマンド(つまり、`mysqld`または`mysqld_safe`)へのパスを入力します。(上記の<<start,データベース・サーバーの起動>>を参照してください。)
*注意: *Unix系システムでは、起動コマンドを呼び出すことができるのはrootまたは管理者権限を持つユーザーのみである場合があります。これを解決するため、(LinuxおよびSolarisの場合はlink:http://www.nongnu.org/gksu/[+GKSu+]、Macの場合はlink:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/osascript.1.html[+osascript+]を使用して)この作業を行うスクリプトを作成できます。詳細は、link:http://davidvancouvering.blogspot.com/2008/09/starting-mysql-in-netbeans-as.html[+このブログ投稿+]を参照してください。
-7. 「停止コマンドへのパス」フィールドに、MySQLの停止コマンド(つまり、`mysqladmin shutdown`)へのパスを入力します。このコマンドは停止権限を持つユーザー・アカウントを必要とするので、「引数」フィールドにユーザー名/パスワード資格情報を入力する必要があります。例:
+
+[start=7]
+. 「停止コマンドへのパス」フィールドに、MySQLの停止コマンド(つまり、`mysqladmin shutdown`)へのパスを入力します。このコマンドは停止権限を持つユーザー・アカウントを必要とするので、「引数」フィールドにユーザー名/パスワード資格情報を入力する必要があります。例:
* *引数: *`-u root -pnbuser shutdown`
「詳細プロパティ」タブの下に一覧表示されたフィールドを設定すると、以下ができるようになります。
@@ -345,11 +385,15 @@
1. このチュートリアルで使用するデータベース・インスタンスを作成します。これを行うには、MySQLサーバー・ノードを右クリックして「データベースを作成」を選択します。
2. 表示されるダイアログで、「`affablebean`」と入力します。「フル・アクセスを許可」オプションを選択し、ドロップダウン・フィールドから「`root@localhost`」を選択します。これにより、`localhost`ホスト上の`root`アカウントがデータベースにアクセスできるようになります。後でサーバー上に接続プールを作成するときは、サーバーにデータベースへのアクセスを許可するため、ユーザー名/パスワード資格情報として`root`アカウントと`nbuser`パスワードを設定する必要があります。
image::images/create-mysql-db-dialog.png[title="サーバー・ノードを右クリックして「データベースを作成」を選択し、新しいデータベース・インスタンスを作成する"]
-3. 「OK」をクリックします。これを行うと、`affablebean`という名前のデータベースが作成され、データベースへの接続が自動的に確立されます。接続は、接続ノード(image::images/db-connection-node.png[])を使用して「サービス」ウィンドウに表示されます。
+
+[start=3]
+. 「OK」をクリックします。これを行うと、`affablebean`という名前のデータベースが作成され、データベースへの接続が自動的に確立されます。接続は、接続ノード(image::images/db-connection-node.png[])を使用して「サービス」ウィンドウに表示されます。
*注意: *接続ノードは「サービス」ウィンドウ内で維持されます。IDEを再起動すると、ギザギザの線が入った接続ノード(image::images/connection-broken.png[])が表示され、接続が切断されたことを示します。データベースに再接続するには、データベース・サーバーが実行されていることを確認してから、そのノードを右クリックして「接続」を選択します。
-4. `affablebean`データベースの接続ノードを展開します。接続にはデータベースのデフォルト・スキーマ(`affablebean`)が含まれており、その中に表、ビューおよびプロシージャのノードが含まれています。まだ何も作成していないので、現時点ではこれらは空です。
+
+[start=4]
+. `affablebean`データベースの接続ノードを展開します。接続にはデータベースのデフォルト・スキーマ(`affablebean`)が含まれており、その中に表、ビューおよびプロシージャのノードが含まれています。まだ何も作成していないので、現時点ではこれらは空です。
image::images/db-conn-affable-bean.png[title="データベース接続に、データベースのデフォルト・スキーマと、表、ビューおよびプロシージャのノードが含まれている"]
この段階で、IDEからMySQLサーバーへの接続が完了し、チュートリアル全体で使用する`affablebean`という名前の新しいデータベースが作成されました。また、IDEでのJava Webプロジェクトの作成を完了し、それを問題なくビルドして開発サーバーにデプロイし、実行時にブラウザで開くことができることを確認しました。これで、開発環境の準備が完了し、アプリケーションのデータ・モデルの設計を開始できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_pt_BR.asciidoc
index 8c00ac2..fa1aef7 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_pt_BR.asciidoc
@@ -80,19 +80,33 @@
1. Inicie o NetBeans IDE. Se estiver executando o IDE pela primeira vez, você verá a Página Inicial do IDE.
image::images/ide-start-page.png[title="A Página Inicial do NetBeans IDE"]
-2. Clique no botão Novo Projeto (image::images/new-project-btn.png[]) (Ctrl-Shift-N; ⌘-Shift-N no Mac) para criar um novo projeto Java Web. O assistente Novo Projeto será aberto para guiá-lo pelo processo. Em Categorias, selecione Java Web, depois, em Projetos, selecione Aplicação Web.
+
+[start=2]
+. Clique no botão Novo Projeto (image::images/new-project-btn.png[]) (Ctrl-Shift-N; ⌘-Shift-N no Mac) para criar um novo projeto Java Web. O assistente Novo Projeto será aberto para guiá-lo pelo processo. Em Categorias, selecione Java Web, depois, em Projetos, selecione Aplicação Web.
image::images/new-project-wzd.png[title="Criar um projeto usando o Assistente Novo Projeto"]
-3. Clique em Próximo.
-4. Na Etapa 2: Nome e Localização, dê o nome `AffableBean` ao projeto. Nesta etapa, você também pode designar a localização em seu computador onde o projeto residirá. Por default, o IDE cria a pasta `NetBeansProjects` no seu diretório home. Se você quiser alterar a localização, insira o caminho no campo de texto Localização do Projeto.
-5. Clique em Próximo.
-6. Na Etapa 3: Servidor e Definições, especifique o GlassFish v3 como o servidor no qual o projeto será implantado durante o desenvolvimento. Já que o GlassFish v3 foi incluído na sua instalação do NetBeans, você verá que o GlassFish v3 está listado no campo drop-down Servidor.
+
+[start=3]
+. Clique em Próximo.
+
+[start=4]
+. Na Etapa 2: Nome e Localização, dê o nome `AffableBean` ao projeto. Nesta etapa, você também pode designar a localização em seu computador onde o projeto residirá. Por default, o IDE cria a pasta `NetBeansProjects` no seu diretório home. Se você quiser alterar a localização, insira o caminho no campo de texto Localização do Projeto.
+
+[start=5]
+. Clique em Próximo.
+
+[start=6]
+. Na Etapa 3: Servidor e Definições, especifique o GlassFish v3 como o servidor no qual o projeto será implantado durante o desenvolvimento. Já que o GlassFish v3 foi incluído na sua instalação do NetBeans, você verá que o GlassFish v3 está listado no campo drop-down Servidor.
Se você quisesse implantar em um servidor que ainda não estivesse registrado no IDE, você deveria clicar no botão Adicionar e percorrer o assistente Adicionar Instância do Servidor. Você pode exibir todos os servidores registrados no IDE na janela Servidores (Selecione Ferramentas > Servidores no menu principal).
-7. Para a versão do Java EE, selecione Java EE 6 Web.
+
+[start=7]
+. Para a versão do Java EE, selecione Java EE 6 Web.
A aplicação que você criar usará várias funcionalidades do Java EE 6, principalmente anotações de servlet (novo na link:http://jcp.org/en/jsr/summary?id=315[+Especificação do Servlet 3.0+]) e EJBs usados diretamente nos contêineres de servlets (novo na link:http://jcp.org/en/jsr/summary?id=318[+Especificação do EJB 3.1+]). O Servlet 3.0 e o EJB 3.1 são parte da plataforma Java EE 6, portanto, é necessário um servidor compatível com EE-6 como o GlassFish v3 para usar neste tutorial. Para obter mais informações, consulte link:entity-session.html#specification[+Sobre Especificações e Implementações+].
-8. Certifique-se de que a opção "Ativar a Injeção de Dependência e Contextos" não está selecionada. Essa opção é específica para a tecnologia CDI (Injeção de Dependência e Contextos), especificada por link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] e não será usada neste tutorial. Para obter mais informações, consulte link:../cdi-intro.html[+Introdução à Injeção de Dependência e Contextos e ao JSF 2.0+].
+
+[start=8]
+. Certifique-se de que a opção "Ativar a Injeção de Dependência e Contextos" não está selecionada. Essa opção é específica para a tecnologia CDI (Injeção de Dependência e Contextos), especificada por link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] e não será usada neste tutorial. Para obter mais informações, consulte link:../cdi-intro.html[+Introdução à Injeção de Dependência e Contextos e ao JSF 2.0+].
image::images/new-project-wzd2.png[title="Especificar servidor de desenvolvimento, versão do EE e se deseja incluir suporte CDI"]
Observe que, por default, o caminho do contexto da aplicação é o nome do projeto. Esse é o caminho no qual sua aplicação pode ser acessada após ser implantada no servidor. Por exemplo, o GlassFish usa 8080 como seu número de porta default, portanto, durante o desenvolvimento, você poderá acessar o projeto em uma janela do browser a partir de:
@@ -102,12 +116,16 @@
http://localhost:8080/AffableBean/
----
-9. Clique em Finalizar. O IDE gera um projeto de esqueleto chamado `AffableBean` que adota as link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+convenções J2EE Blueprints para aplicações web+]. O IDE exibe as várias janelas em seu layout default.
+
+[start=9]
+. Clique em Finalizar. O IDE gera um projeto de esqueleto chamado `AffableBean` que adota as link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+convenções J2EE Blueprints para aplicações web+]. O IDE exibe as várias janelas em seu layout default.
[.feature]
--
image::images/ide-default-layout.png[role="left", link="images/ide-default-layout.png"]
--
-10. Examine o layout default do IDE. Segue aqui uma breve visão geral da janelas e guias exibidas:
+
+[start=10]
+. Examine o layout default do IDE. Segue aqui uma breve visão geral da janelas e guias exibidas:
* *O Editor:* O editor (Ctrl-0; ⌘-0 no Mac) é o componente central do IDE e é onde você provavelmente gastará uma grande parte do seu tempo. O editor adapta-se, automaticamente, ao idioma no qual você está trabalhando, fornecendo suporte à documentação, autocompletar código, dicas e mensagens de erro específicas da tecnologia na qual você está codificando.
* *Janela Projetos:* A janela Projetos (Ctrl-1; ⌘-1 no Mac) é o ponto de entrada para os códigos-fonte do seu projeto. Fornece uma _view lógica_ do conteúdo importante do projeto e agrupa os arquivos com base em suas funções (por exemplo, `Configuration Files`). Ao clicar com o botão direito do mouse na janela Projetos, você pode chamar ações comuns às suas tarefas de desenvolvimento (ou seja, `Build`, `Clean`, `Deploy` e `Run`).
* *Janela Arquivos:* A janela Arquivos (Ctrl-2; ⌘-2 no Mac) oferece uma view com base em diretório do seu projeto. Ou seja, permite que você exiba a estrutura do projeto como ele existe no sistema de arquivos do computador. Nessa janela, é possível exibir todos os arquivos que pertencem ao seu projeto, incluindo o script de construção Ant, (`build.xml`), e os arquivos necessários pelo IDE para tratar o projeto (contidos na pasta `nbproject`). Se você tiver executado o projeto, poderá ver a localização dos arquivos Java compilados (pasta `build`). Se tiver explicitamente construído o seu projeto (escolhendo Construir ou Limpar e Construir no menu de contexto do nó do projeto da janela Projetos), você poderá ver o arquivo WAR distribuível do projeto (contido na pasta `dist`).
@@ -128,12 +146,16 @@
Uma janela do browser será aberta para exibir a página de boas-vindas do projeto.
image::images/hello-world.png[title="O projeto será automaticamente implantado no servidor e será exibido no browser"]
Então, o que acabou de acontecer? Quando você executa um projeto web, o IDE chama o destino Ant `run` no script de construção do seu projeto. Investigue abrindo o arquivo `build.xml` de seu projeto no editor.
-2. Alterne para a janela Arquivos (Ctrl-2; ⌘-2 no Mac), expanda o nó do projeto e clique duas vezes no arquivo `build.xml` contido em seu projeto. Quando o arquivo `build.xml` é aberto no editor, o Navegador lista todos os destinos Ant disponíveis para o script.
+
+[start=2]
+. Alterne para a janela Arquivos (Ctrl-2; ⌘-2 no Mac), expanda o nó do projeto e clique duas vezes no arquivo `build.xml` contido em seu projeto. Quando o arquivo `build.xml` é aberto no editor, o Navegador lista todos os destinos Ant disponíveis para o script.
image::images/navigator-ant-targets.png[title="O Navegador lista todos os destinos Ant disponíveis para o script build.xml"]
Destinos Ant normais são exibidos usando o ícone destino Geral (image::images/ant-normal-icon.png[]). O ícone do destino Ant (image::images/ant-emphasized-icon.png[]) _enfatizado_ simplesmente indica que o destino inclui uma descrição, que é exibida como uma dica de ferramenta (como mostrado na imagem acima). Para obter mais informações, consulte link:../../java/project-setup.html[+Criando, Importando e Configurando Projetos Java+].
-3. Clique duas vezes no destino `run`. O arquivo `build-impl.xml` será aberto no editor e exibe a definição do destino.
+
+[start=3]
+. Clique duas vezes no destino `run`. O arquivo `build-impl.xml` será aberto no editor e exibe a definição do destino.
[source,java]
----
@@ -164,13 +186,19 @@
Consulte o link:http://ant.apache.org/manual/index.html[+Manual do Ant+] oficial para obter mais informações sobre como usar o Ant.
-4. Para gerar um arquivo WAR distribuível para seu projeto, selecione Limpar e Construir Projeto (ou Limpar e Construir Projeto Principal) no menu Executar do IDE.
-5. Na janela Arquivos (Ctrl-2; ⌘-2 no Mac), expanda o nó do projeto. A pasta `dist` contém arquivo WAR do projeto. A pasta `build` contém seu projeto compilado.
+
+[start=4]
+. Para gerar um arquivo WAR distribuível para seu projeto, selecione Limpar e Construir Projeto (ou Limpar e Construir Projeto Principal) no menu Executar do IDE.
+
+[start=5]
+. Na janela Arquivos (Ctrl-2; ⌘-2 no Mac), expanda o nó do projeto. A pasta `dist` contém arquivo WAR do projeto. A pasta `build` contém seu projeto compilado.
image::images/files-window.png[title="A janela Arquivos fornece uma view baseada em diretório de seu projeto"]
*Observação:* se você _limpar_ o projeto (na janela Projetos, selecione Limpar no menu de contexto do nó do projeto), essas duas pastas serão removidas.
-6. Alterne para a janela Serviços (Ctrl-5; ⌘-5 no Mac) e expanda o nó Servidores > GlassFish Server 3 > Aplicações.
+
+[start=6]
+. Alterne para a janela Serviços (Ctrl-5; ⌘-5 no Mac) e expanda o nó Servidores > GlassFish Server 3 > Aplicações.
image::images/services-win-deployed-app.png[title="A janela Serviços exibe o status do servidor, aplicações implantadas e recursos"]
*Observação:* O "GlassFish v3" é o nome default do servidor para os usuários do NetBeans 6.8.
@@ -316,20 +344,32 @@
* *Número da Porta do Servidor:* `3306`
* *Nome do Usuário Administrador:* `root`
* *Senha do Administrador:* `nbuser`
-2. Selecione a opção Salvar Senha.
+
+[start=2]
+. Selecione a opção Salvar Senha.
image::images/mysql-server-properties.png[title="Especificar definições do servidor MySQL"]
-3. Clique em OK. O IDE se conecta ao seu servidor de banco de dados MySQL e lista as instâncias do bancos de dados que são mantidas pelo servidor. Se expandir o nó Drivers, você também poderá ver que o IDE contém o link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+driver JDBC/Conector+] para MySQL.
+
+[start=3]
+. Clique em OK. O IDE se conecta ao seu servidor de banco de dados MySQL e lista as instâncias do bancos de dados que são mantidas pelo servidor. Se expandir o nó Drivers, você também poderá ver que o IDE contém o link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+driver JDBC/Conector+] para MySQL.
image::images/services-win-mysql.png[title="Conectar - se a um servidor MySQL na janela Serviços"]
O servidor de aplicações (ou seja, GlassFish) requer o driver para ativar a comunicação entre o seu código Java e o banco de dados MySQL. Devido ao IDE já conter o driver J/Conector, você não precisará fazer download dele. Além disso, como será demonstrado posteriormente, você pode especificar nas definições do servidor a ativação da implantação automática do driver JDBC no GlassFish, caso ele esteja ausente no servidor.
As etapas 4 a 7 abaixo são opcionais. Você pode configurar o IDE para iniciar e parar o servidor MySQL e também executar uma ferramenta de administração externa no servidor.
-4. Clique com o botão direito do mouse no nó do servidor MySQL e selecione Propriedades. Na caixa de diálogo Propriedades do Servidor MySQL, selecione a guia Propriedades de Admin.
-5. No campo “Caminho/URL para ferramenta admin”, digite o caminho no seu computador para o arquivo executável da ferramenta de administração do banco de dados, como, por exemplo, o link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]. O MySQL Administrator está incluído no pacote link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+].
-6. No campo “Caminho para o comando iniciar”, digite o caminho para o comando iniciar do MySQL (ou seja, `mysqld` ou `mysqld_safe`), dependendo do seu sistema operacional. (Consulte <<start,Iniciar o Servidor do Banco de dados>> acima.)
+
+[start=4]
+. Clique com o botão direito do mouse no nó do servidor MySQL e selecione Propriedades. Na caixa de diálogo Propriedades do Servidor MySQL, selecione a guia Propriedades de Admin.
+
+[start=5]
+. No campo “Caminho/URL para ferramenta admin”, digite o caminho no seu computador para o arquivo executável da ferramenta de administração do banco de dados, como, por exemplo, o link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+]. O MySQL Administrator está incluído no pacote link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+].
+
+[start=6]
+. No campo “Caminho para o comando iniciar”, digite o caminho para o comando iniciar do MySQL (ou seja, `mysqld` ou `mysqld_safe`), dependendo do seu sistema operacional. (Consulte <<start,Iniciar o Servidor do Banco de dados>> acima.)
*Observação:* Para sistemas tipo Unix, você pode descobrir que só pode chamar o comando iniciar com privilégios administrativos ou como root. Para superar isso, você pode criar um script (usando link:http://www.nongnu.org/gksu/[+GKSu+] para Linux e Solaris e link:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/osascript.1.html[+osascript+] para Mac) que irá realizar a tarefa. Para obter mais informações, consulte link:http://davidvancouvering.blogspot.com/2008/09/starting-mysql-in-netbeans-as.html[+o post deste blog+].
-7. No campo “Caminho para o comando parar”, digite o caminho para o comando parar do MySQL (ou seja, `mysqladmin shutdown`). Devido a esse comando exigir uma conta de usuário com privilégios de shutdown, você precisa inserir as credenciais de nome de usuário/senha no campo Argumentos. Por exemplo:
+
+[start=7]
+. No campo “Caminho para o comando parar”, digite o caminho para o comando parar do MySQL (ou seja, `mysqladmin shutdown`). Devido a esse comando exigir uma conta de usuário com privilégios de shutdown, você precisa inserir as credenciais de nome de usuário/senha no campo Argumentos. Por exemplo:
* *Argumentos:* `-u root -pnbuser shutdown`
Depois de ter definido os campos listados na guia Propriedades Avançadas, você poderá:
@@ -345,11 +385,15 @@
1. Crie a instância do banco de dados que será usada neste tutorial. Para fazer isso, clique com o botão direito do mouse no nó do servidor MySQL e selecione Criar Banco de Dados.
2. Na caixa de diálogo que é exibida, digite `affablebean`. Selecione a opção “Conceder Acesso Total para” e, em seguida, selecione `root@localhost` no campo drop-down. Isso permite que a conta `root` no host `localhost` acesse o banco de dados. Posteriormente, ao criar um pool de conexões no servidor, você precisará fornecer a conta `root` e a senha `nbuser` como as credenciais de nome de usuário/senha para conceder ao servidor o acesso ao banco de dados.
image::images/create-mysql-db-dialog.png[title="Clique com o botão direito do mouse no nó do servidor e selecione Criar Banco de Dados para criar uma nova instância do banco de dados"]
-3. Clique em OK. Quando você faz isso, o banco de dados chamado `affablebean` é criado, e a conexão ao banco de dados é estabelecida automaticamente. As conexões são exibidas na janela Serviços usando um nó de conexão (image::images/db-connection-node.png[]).
+
+[start=3]
+. Clique em OK. Quando você faz isso, o banco de dados chamado `affablebean` é criado, e a conexão ao banco de dados é estabelecida automaticamente. As conexões são exibidas na janela Serviços usando um nó de conexão (image::images/db-connection-node.png[]).
*Observação:* Os nós de conexão são mantidos na janela Serviços. Se você reiniciar o IDE, o nó de conexão será exibido com uma linha serrilhada (image::images/connection-broken.png[]), indicando que a conexão está interrompida. Para conectar-se novamente ao banco de dados, certifique-se de que o servidor do banco de dados está sendo executado e, em seguida, clique com o botão direito do mouse no nó e selecione Conectar.
-4. Expanda o nó de conexão do banco de dados `affablebean`. A conexão contém o esquema default do banco de dados (`affablebean`), e dentro dele existem nós para tabelas, views e procedimentos. Atualmente, eles estão vazios, pois ainda não criamos nada.
+
+[start=4]
+. Expanda o nó de conexão do banco de dados `affablebean`. A conexão contém o esquema default do banco de dados (`affablebean`), e dentro dele existem nós para tabelas, views e procedimentos. Atualmente, eles estão vazios, pois ainda não criamos nada.
image::images/db-conn-affable-bean.png[title="As conexões de banco de dados contêm o esquema default do banco de dados e os nós de tabelas, views e procedimentos"]
Neste estágio, você já criou a conexão ao servidor MySQL a partir do IDE e já criou um novo bando de dados chamado `affablebean`, que você usará durante todo o tutorial. Além disso, você criou o projeto Java Web no IDE e confirmou que ele pode ser compilado e implantado com sucesso no seu servidor de desenvolvimento e aberto em um browser ao ser executado. Agora que o ambiente de desenvolvimento está pronto, você pode começar a esboçar o modelo de dados da aplicação.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ru.asciidoc
index ebead03..a1b8804 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_ru.asciidoc
@@ -80,19 +80,33 @@
1. Start the IDE NetBeans. Если среда IDE запущена впервые, то откроется начальная страница среды IDE.
image::images/ide-start-page.png[title="The IDE NetBeans Start Page"]
-2. Нажмите кнопку 'Создать проект' ( image::images/new-project-btn.png[] ) (Ctrl-Shift-N; ⌘+Shift+N в Mac) для создания нового веб-проекта Java. Мастер создания проектов открывается с руководством по выполнению процесса. В окне Categories ("Категории") выберите Java Web, затем в Projects ("Проекты") выберите Web Application ("Веб-приложение").
+
+[start=2]
+. Нажмите кнопку 'Создать проект' ( image::images/new-project-btn.png[] ) (Ctrl-Shift-N; ⌘+Shift+N в Mac) для создания нового веб-проекта Java. Мастер создания проектов открывается с руководством по выполнению процесса. В окне Categories ("Категории") выберите Java Web, затем в Projects ("Проекты") выберите Web Application ("Веб-приложение").
image::images/new-project-wzd.png[title="Создайте проект с помощью мастера создания проектов"]
-3. Нажмите кнопку "Далее".
-4. На этапе 2, Name and Location ("Имя и местоположение"), назовите проект `AffableBean`. На данном этапе также можно указать папку на своем компьютере, где будет находиться проект. По умолчанию среда IDE создает папку `NetBeansProjects` в корневом каталоге. Если местоположение нужно изменить, введите путь в текстовом поле Project Location ("Местоположение проекта").
-5. Нажмите кнопку "Далее".
-6. На этапе 3: Server and Settings ("Сервер и настройки") укажите GlassFish v3 как сервер, на который будет развернут проект во время разработки. Поскольку GlassFish v3 включен в установку NetBeans, можно будет увидеть, что GlassFish v3 указан в раскрывающемся списке Server.
+
+[start=3]
+. Нажмите кнопку "Далее".
+
+[start=4]
+. На этапе 2, Name and Location ("Имя и местоположение"), назовите проект `AffableBean`. На данном этапе также можно указать папку на своем компьютере, где будет находиться проект. По умолчанию среда IDE создает папку `NetBeansProjects` в корневом каталоге. Если местоположение нужно изменить, введите путь в текстовом поле Project Location ("Местоположение проекта").
+
+[start=5]
+. Нажмите кнопку "Далее".
+
+[start=6]
+. На этапе 3: Server and Settings ("Сервер и настройки") укажите GlassFish v3 как сервер, на который будет развернут проект во время разработки. Поскольку GlassFish v3 включен в установку NetBeans, можно будет увидеть, что GlassFish v3 указан в раскрывающемся списке Server.
Если нужно развернуть сервер, который еще не зарегистрирован в среде IDE, следует нажать кнопку Add ("Добавить") и пройти через все этапы работы мастера добавления экземпляра сервера. Серверы, зарегистрированные в среде IDE, можно просмотреть в окне серверов (выберите Tools ("Средства") > Servers ("Серверы") из главного меню).
-7. В качестве версии Java EE выберите Java EE 6 Web.
+
+[start=7]
+. В качестве версии Java EE выберите Java EE 6 Web.
Создаваемое приложение будет использовать различные функции Java EE 6, а именно аннотации сервлетов (новинка link:http://jcp.org/en/jsr/summary?id=315[+Спецификации сервлетов Servlet 3.0+]) и компоненты EJB, используемые напрямую в контейнерах сервлетов (новинка link:http://jcp.org/en/jsr/summary?id=318[+Спецификации компонентов EJB 3.1+]). Как Servlet 3.0, так и EJB 3.1 являются частью платформы EE 6, поэтому для работы с данным учебным курсом необходим сервер, совместимый с EE 6, такой как GlassFish v3. Дополнительные сведения приведены в материале link:entity-session.html#specification[+О спецификациях и реализациях+].
-8. Убедитесь, что режим Enable Contexts and Dependency Injection ("Включить подключение контекстов и зависимостей") не выбран. Этот режим относится к только к технологии подключения контекстов и зависимостей (Contexts and Dependency Injection – CDI), определенной в спецификацииlink:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], и не используется в данном руководстве. Дополнительные сведения приведены в курсе link:../cdi-intro.html[+Начало работы с подключением контекстов и зависимостей и JSF 2.0+].
+
+[start=8]
+. Убедитесь, что режим Enable Contexts and Dependency Injection ("Включить подключение контекстов и зависимостей") не выбран. Этот режим относится к только к технологии подключения контекстов и зависимостей (Contexts and Dependency Injection – CDI), определенной в спецификацииlink:http://jcp.org/en/jsr/detail?id=299[+JSR-299+], и не используется в данном руководстве. Дополнительные сведения приведены в курсе link:../cdi-intro.html[+Начало работы с подключением контекстов и зависимостей и JSF 2.0+].
image::images/new-project-wzd2.png[title="Укажите сервер разработки, версию EE и нужна ли поддержка CDI"]
Обратите внимание, что по умолчанию контекстным путем для приложения является имя проекта. Это путь, по которому можно получить доступ к приложению после его развертывания на сервере. Например, в GlassFish используется 8080 как номер порта по умолчанию, поэтому в ходе разработки доступ к проекту можно будет выполнить в окне браузера по следующему адресу:
@@ -102,12 +116,16 @@
http://localhost:8080/AffableBean/
----
-9. Нажмите кнопку "Завершить". Среда IDE создает заготовку проекта под названием `AffableBean`, которая будет придерживаться link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+формата веб-приложений J2EE Blueprints+]. Среда IDE отображает различные окна в компоновке по умолчанию.
+
+[start=9]
+. Нажмите кнопку "Завершить". Среда IDE создает заготовку проекта под названием `AffableBean`, которая будет придерживаться link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+формата веб-приложений J2EE Blueprints+]. Среда IDE отображает различные окна в компоновке по умолчанию.
[.feature]
--
image::images/ide-default-layout.png[role="left", link="images/ide-default-layout.png"]
--
-10. Рассмотрим компоновку по умолчанию среды IDE. Вот краткий обзор отображаемых окон и вкладок:
+
+[start=10]
+. Рассмотрим компоновку по умолчанию среды IDE. Вот краткий обзор отображаемых окон и вкладок:
* *Редактор.* Редактор (Ctrl-0; ⌘-0 в Mac) является центральным компонентом IDE, и, скорее всего, именно с ним выполняется большая часть работы. Редактор автоматически адаптируется к используемому языку, предоставляя документацию, автозавершение кода, подсказки и сообщения об ошибках для конкретной технологии, в которой пишется код.
* *Окно 'Проекты'* Окно 'Проекты' (Ctrl-1; ⌘-1 в Mac) является точкой входа в ресурсы проекта. Обеспечивается _логическое представление_ важного содержимого проекта и группируются файлы вместе на основе их функций (например, `Файлы конфигурации`). После щелчка правой кнопкой мышиing узлов в окне 'Проекты' можно вызывать действия, которые являются общими для выполняемых задач разработки (например, `Сборка`, `Очистка`, `Развертывание`, `Запуск`).
* *Окно 'Файлы'* Окно 'Проекты' (Ctrl-2; ⌘-2 в Mac) содержит представление проекта на основе каталогов. Оно позволяет увидеть структуру проекта в том виде, как она существует в файловой системе компьютера. Из этого окна можно увидеть все файлы, относящиеся к проекту, включая сценарий сборки Ant (`build.xml`) и файлы, необходимые среде IDE для работы с проектом (содержатся в папке `nbproject`). При запуске проекта можно увидеть местоположение скомпилированных файлов Java (папка `build`). Если сборка проекта была выполнена явно (путем выбора 'Сборка' или 'Очистка и сборка' в контекстном меню узла проекта в окне 'Проекты'), то можно просмотреть распространяемый файл WAR (содержится в папке `dist`).
@@ -128,12 +146,16 @@
Откроется окно браузера с начальной страницей проекта.
image::images/hello-world.png[title="Проект автоматически разворачивается на сервере и отображаются в браузере"]
Что сейчас произошло? При выполнении веб-проекта среда IDE вызывает цель Ant `run` в сценарии сборки нашего проекта. Разобраться в этом можно, открыв файл `build.xml` проекта в редакторе.
-2. Переключитесь в окно 'Файлы' (Ctrl-2; ⌘-2 в Mac), разверните узел проекта и дважды щелкните файл, содержащийся в проекте `build.xml`. Когда файл `build.xml` открывается в редакторе, навигатор перечисляет все цели Ant, доступные сценарию.
+
+[start=2]
+. Переключитесь в окно 'Файлы' (Ctrl-2; ⌘-2 в Mac), разверните узел проекта и дважды щелкните файл, содержащийся в проекте `build.xml`. Когда файл `build.xml` открывается в редакторе, навигатор перечисляет все цели Ant, доступные сценарию.
image::images/navigator-ant-targets.png[title="В навигаторе перечислены все доступные целевые элементы Ant для сценария build.xml"]
Стандартные целевые элементы Ant отображаются с помощью значка общего целевого элемента ( image::images/ant-normal-icon.png[] ). _Выделенный_ значок целевого элемента ( image::images/ant-emphasized-icon.png[] ) лишь указывает на то, что целевой элемент включает в себя описание, которое отображается в виде подсказки (как показано на изображении выше). Дополнительные сведения приведены в курсе link:../../java/project-setup.html[+Создание, импорт и настройка проектов Java+].
-3. Дважды щелкните цель `run`. Файл `build-impl.xml` откроется в редакторе и отобразить определение цели.
+
+[start=3]
+. Дважды щелкните цель `run`. Файл `build-impl.xml` откроется в редакторе и отобразить определение цели.
[source,java]
----
@@ -164,13 +186,19 @@
Дополнительные сведения по использованию Ant приведены в официальном link:http://ant.apache.org/manual/index.html[+Руководстве по Ant+].
-4. Чтобы создать распространяемый файл WAR для своего проекта, выберите Clean and Build Project ("Очистить и собрать проект") либо Clean and Build Main Project ("Очистить и собрать главный проект") из меню Run ("Выполнить") среды IDE.
-5. В окне "Файлы" (Ctrl-2; ⌘-2 в Mac) разверните узел проекта. Папка `dist` содержит файл WAR проекта. Папка `build` содержит скомпилированный проект.
+
+[start=4]
+. Чтобы создать распространяемый файл WAR для своего проекта, выберите Clean and Build Project ("Очистить и собрать проект") либо Clean and Build Main Project ("Очистить и собрать главный проект") из меню Run ("Выполнить") среды IDE.
+
+[start=5]
+. В окне "Файлы" (Ctrl-2; ⌘-2 в Mac) разверните узел проекта. Папка `dist` содержит файл WAR проекта. Папка `build` содержит скомпилированный проект.
image::images/files-window.png[title="Окно 'Файлы' содержит представление проекта на основе каталогов."]
*Примечание.* При _очистке_ проекта (в окне 'Проекты' выберите меню правой кнопки мыши 'Очистить из узла проекта'), при этом оба элемента из этих папок удаляются.
-6. Перейдите в окно "Службы" (Ctrl-5; ⌘-5 в Mac) и разверните 'Серверы' > 'GlassFish Server 3' > 'Узел приложения'.
+
+[start=6]
+. Перейдите в окно "Службы" (Ctrl-5; ⌘-5 в Mac) и разверните 'Серверы' > 'GlassFish Server 3' > 'Узел приложения'.
image::images/services-win-deployed-app.png[title="В окне 'Службы' отображается состояние сервера, развернутых приложений и ресурсов"]
*Примечание.* "GlassFish v3" это имя сервера по умолчанию для пользователей NetBeans 6.8.
@@ -316,20 +344,32 @@
* *Номер порта сервера:* `3306`
* *Имя администратора:* `root`
* *Пароль администратора:* `nbuser`
-2. Выберите параметр Save Password ("Сохранить пароль").
+
+[start=2]
+. Выберите параметр Save Password ("Сохранить пароль").
image::images/mysql-server-properties.png[title="Укажите настройки сервера MySQL"]
-3. Нажмите кнопку "ОК". Среда IDE подключается к серверу базы данных MySQL и перечисляет экземпляры базы данных, находящиеся на сервере. Если развернуть узел Drivers ("Драйверы"), можно также увидеть, что среда IDE содержит драйвер link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBC+] для MySQL.
+
+[start=3]
+. Нажмите кнопку "ОК". Среда IDE подключается к серверу базы данных MySQL и перечисляет экземпляры базы данных, находящиеся на сервере. Если развернуть узел Drivers ("Драйверы"), можно также увидеть, что среда IDE содержит драйвер link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+Connector/J JDBC+] для MySQL.
image::images/services-win-mysql.png[title="Подключитесь к серверу MySQL в окне 'Службы'"]
Серверу приложений (т. е., GlassFish) необходим драйвер для обеспечения связи между кодом Java и базой данных MySQL. Поскольку среда IDE уже содержит драйвер Connector/J, его не нужно загружать. Более того, как будет показано ниже, в настройках сервера можно включить развертывание драйвера JDBC, так что драйвер будет автоматически развернут на GlassFish в случае его отсутствия на сервере.
Действия 4-7, приведенные ниже, не обязательны. Среду IDE можно настроить на запуск и остановку сервера MySQL, а также на работу в качестве внешнего средства администрирования на сервере.
-4. Щелкните правой кнопкой мыши узел сервера MySQL и выберите Properties ("Свойства"). В диалоговом окне Server Properties ("Свойства сервера") MySQL выберите вкладку Admin Properties ("Свойства администрирования").
-5. В поле Path/URL to admin tool ("Путь/URL-адрес средства администрирования") введите путь к исполняемому файлу средства администрирования баз данных, такого как link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+], на своем компьютере. MySQL Administrator входит в набор средств link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+].
-6. В поле Path to start command ("Путь к команде запуска") введите путь к команде запуска MySQL (т. е. `mysqld` или `mysqld_safe`, в зависимости от операционной системы). (См. <<start,Запуск сервера базы данных>> выше).
+
+[start=4]
+. Щелкните правой кнопкой мыши узел сервера MySQL и выберите Properties ("Свойства"). В диалоговом окне Server Properties ("Свойства сервера") MySQL выберите вкладку Admin Properties ("Свойства администрирования").
+
+[start=5]
+. В поле Path/URL to admin tool ("Путь/URL-адрес средства администрирования") введите путь к исполняемому файлу средства администрирования баз данных, такого как link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+], на своем компьютере. MySQL Administrator входит в набор средств link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI Tools+].
+
+[start=6]
+. В поле Path to start command ("Путь к команде запуска") введите путь к команде запуска MySQL (т. е. `mysqld` или `mysqld_safe`, в зависимости от операционной системы). (См. <<start,Запуск сервера базы данных>> выше).
*Примечание.* Для системах, схожих с Unix, можно обнаружить, что можно вызвать команду запуска с использованием корневых или административных привилегий. Чтобы решить эту проблему, можно создать сценарий (используя link:http://www.nongnu.org/gksu/[+gksu+] для Linux и Solaris, link:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/osascript.1.html[+osascript+] для Mac), который выполнит эту задачу. Дополнительные сведения приведены в link:http://davidvancouvering.blogspot.com/2008/09/starting-mysql-in-netbeans-as.html[+данной записи в блоге+].
-7. В поле Path to stop command ("Путь к команде остановки") введите путь к команде остановки MySQL (т. е., `mysqladmin shutdown`). Поскольку этой команде необходима учетная запись пользователя с правами на завершение работы, необходимо ввести имя пользователя/пароль в поле Arguments ("Аргументы"). Например:
+
+[start=7]
+. В поле Path to stop command ("Путь к команде остановки") введите путь к команде остановки MySQL (т. е., `mysqladmin shutdown`). Поскольку этой команде необходима учетная запись пользователя с правами на завершение работы, необходимо ввести имя пользователя/пароль в поле Arguments ("Аргументы"). Например:
* *Аргументы* `-u root -pnbuser shutdown`
После настройки полей, перечисленных на вкладке Advanced Properties ("Расширенные свойства"), можно:
@@ -345,11 +385,15 @@
1. Создайте экземпляр базы данных, который мы будем использовать на протяжении данного учебного курса. Для этого щелкните правой кнопкой мыши узел MySQL Server и выберите 'Создать базу данных'.
2. В отобразившемся диалоговом окне введите `affablebean`. Выберите параметр Grant Full Access ("Предоставить полный доступ"), затем выберите `root@localhost` из раскрывающегося поля. Это даст учетной записи на `root` на узле `localhost` доступ к данной базе данных. Позже, когда мы создадим на сервере пул подключений, будет необходимо предоставить учетную запись `root` и пароль `nbuser` как учетные данные, чтобы предоставить серверу доступ к базе данных.
image::images/create-mysql-db-dialog.png[title="Правой кнопкой мыши щелкните узел сервера и выберите "Создать базу данных", чтобы создать новый экземпляр базы данных"]
-3. Нажмите кнопку "ОК". Будет создана база данных `affablebean` и автоматически установлено подключение к ней. Подключения отображаются в окне 'Службы' с помощью узла подключения ( image::images/db-connection-node.png[] ).
+
+[start=3]
+. Нажмите кнопку "ОК". Будет создана база данных `affablebean` и автоматически установлено подключение к ней. Подключения отображаются в окне 'Службы' с помощью узла подключения ( image::images/db-connection-node.png[] ).
*Примечание.* Узлы подключения сохраняются в окне 'Службы'. Если вы перезагрузите IDE, узел подключения отобразится с неровной линией ( image::images/connection-broken.png[] ), что указывает на обрыв подключения. Для повторного соединения с базой данных убедитесь, что сервер баз данных запущен, щелкните правой кнопкой мыши узел и выберите 'Подключение'.
-4. Разверните узел подключения для базы данных `affablebean`. Он содержит схему базы данных по умолчанию (`affablebean`), в которой можно найти узлы таблиц, представлений и процедур. Сейчас они пусты, поскольку мы пока ничего не создали.
+
+[start=4]
+. Разверните узел подключения для базы данных `affablebean`. Он содержит схему базы данных по умолчанию (`affablebean`), в которой можно найти узлы таблиц, представлений и процедур. Сейчас они пусты, поскольку мы пока ничего не создали.
image::images/db-conn-affable-bean.png[title="Подключения к базам данных содержат схему базы данных по умолчанию и узлы для таблиц, представлений и процедур."]
Теперь мы подключены к серверу MySQL из среды IDE и создали новую базу данных `affablebean`, которую будем использовать на протяжении данного учебного курса. Кроме того, мы создали веб-проект Java в среде IDE и убедились, что его можно успешно собрать, развернуть на сервере разработки и открыть в браузере при выполнении. Теперь, когда среда разработки готова, можно приступить к наброску модели данных приложения.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_zh_CN.asciidoc
index 31d5e27..95c13b9 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup-dev-environ_zh_CN.asciidoc
@@ -80,19 +80,33 @@
1. 启动 NetBeans IDE。如果是首次运行 IDE,则会看到 IDE 的 "Start Page"(起始页)。
image::images/ide-start-page.png[title="NetBeans IDE 起始页"]
-2. 单击 "New Project"(新建项目)(image::images/new-project-btn.png[]) 按钮(Ctrl-Shift-N 组合键;在 Mac 上为 ⌘-Shift-N 组合键)以创建新的 Java Web 项目。此时,将打开新建项目向导,以指导您完成该过程。在 "Categories"(类别)下选择 "Java Web",并在 "Projects"(项目)下选择 "Web Application"(Web 应用程序)。
+
+[start=2]
+. 单击 "New Project"(新建项目)(image::images/new-project-btn.png[]) 按钮(Ctrl-Shift-N 组合键;在 Mac 上为 ⌘-Shift-N 组合键)以创建新的 Java Web 项目。此时,将打开新建项目向导,以指导您完成该过程。在 "Categories"(类别)下选择 "Java Web",并在 "Projects"(项目)下选择 "Web Application"(Web 应用程序)。
image::images/new-project-wzd.png[title="使用新建项目向导创建项目"]
-3. 单击 "Next"(下一步)。
-4. 在“步骤 2:Name and Location(名称和位置)”中,将项目命名为 `AffableBean`。在此步骤中,还可以指定计算机上项目的所在位置。默认情况下,IDE 将在主目录中创建 `NetBeansProjects` 文件夹。如果要更改位置,请在 "Project Location"(项目位置)文本字段中输入相应路径。
-5. 单击 "Next"(下一步)。
-6. 在步骤 3 "Server and Settings"(服务器和设置)中,将 GlassFish v3 指定为服务器。在开发期间,项目将部署到该服务器上。由于 NetBeans 安装中已包括 GlassFish v3,因此您会看到 "GlassFish v3" 在 "Server"(服务器)下拉字段中列出。
+
+[start=3]
+. 单击 "Next"(下一步)。
+
+[start=4]
+. 在“步骤 2:Name and Location(名称和位置)”中,将项目命名为 `AffableBean`。在此步骤中,还可以指定计算机上项目的所在位置。默认情况下,IDE 将在主目录中创建 `NetBeansProjects` 文件夹。如果要更改位置,请在 "Project Location"(项目位置)文本字段中输入相应路径。
+
+[start=5]
+. 单击 "Next"(下一步)。
+
+[start=6]
+. 在步骤 3 "Server and Settings"(服务器和设置)中,将 GlassFish v3 指定为服务器。在开发期间,项目将部署到该服务器上。由于 NetBeans 安装中已包括 GlassFish v3,因此您会看到 "GlassFish v3" 在 "Server"(服务器)下拉字段中列出。
如果要部署到尚未在 IDE 中注册的服务器上,则可以单击 "Add"(添加)按钮,然后逐步执行添加服务器实例向导。您可以在 "Servers"(服务器)窗口(从主菜单中选择 "Tools"(工具)> "Servers"(服务器))中查看在 IDE 中注册的所有服务器。
-7. 选择 "Java EE 6 Web" 作为 Java EE 版本。
+
+[start=7]
+. 选择 "Java EE 6 Web" 作为 Java EE 版本。
创建的应用程序将使用各种 Java EE 6 功能,即 Servlet 标注(link:http://jcp.org/en/jsr/summary?id=315[+Servlet 3.0 规范+]中的新增内容),以及直接在 Servlet 容器中使用的 EJB(link:http://jcp.org/en/jsr/summary?id=318[+EJB 3.1 规范+]中的新增内容)。Servlet 3.0 和 EJB 3.1 都是 Java EE 6 平台的一部分,因此,您需要与 EE-6 兼容的服务器(如 GlassFish v3)才能完成本教程的学习。有关详细信息,请参见link:entity-session.html#specification[+关于规范和实现+]。
-8. 确保取消选中 "Enable Contexts and Dependency Injection"(启用上下文和依赖关系注入)选项。此选项是特定于上下文和依赖关系注入 (CDI) 技术的,由 link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] 指定,不在本教程中使用。有关详细信息,请参见link:../cdi-intro.html[+上下文和依赖关系注入以及 JSF 2.0 入门指南+]。
+
+[start=8]
+. 确保取消选中 "Enable Contexts and Dependency Injection"(启用上下文和依赖关系注入)选项。此选项是特定于上下文和依赖关系注入 (CDI) 技术的,由 link:http://jcp.org/en/jsr/detail?id=299[+JSR-299+] 指定,不在本教程中使用。有关详细信息,请参见link:../cdi-intro.html[+上下文和依赖关系注入以及 JSF 2.0 入门指南+]。
image::images/new-project-wzd2.png[title="指定开发服务器、EE 版本以及是否包含 CDI 支持"]
请注意,默认情况下,应用程序的上下文路径是项目的名称。这是应用程序在部署到服务器之后可以访问的路径。例如,GlassFish 使用 8080 作为默认端口号,因此在开发期间,您可以通过以下路径在浏览器窗口中访问项目:
@@ -102,12 +116,16 @@
http://localhost:8080/AffableBean/
----
-9. 单击 "Finish"(完成)。IDE 将生成名为 `AffableBean` 的框架项目,该项目遵循 link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE BluePrints Web 应用程序结构约定+]。IDE 将按照其默认布局显示各种窗口。
+
+[start=9]
+. 单击 "Finish"(完成)。IDE 将生成名为 `AffableBean` 的框架项目,该项目遵循 link:http://java.sun.com/blueprints/code/projectconventions.html#99632[+J2EE BluePrints Web 应用程序结构约定+]。IDE 将按照其默认布局显示各种窗口。
[.feature]
--
image::images/ide-default-layout.png[role="left", link="images/ide-default-layout.png"]
--
-10. 检查 IDE 的默认布局。下面简要介绍了所显示的窗口和标签:
+
+[start=10]
+. 检查 IDE 的默认布局。下面简要介绍了所显示的窗口和标签:
* *Editor(编辑器):*编辑器(Ctrl-0 组合键;在 Mac 上为 ⌘-0 组合键)是 IDE 的中心组件,可能也是您花费时间最多的地方。编辑器可自动根据所使用的语言调整,同时提供了文档支持、代码完成以及特定于编码时采用的技术的提示和错误消息。
* *"Projects"(项目)窗口:*"Projects"(项目)窗口(Ctrl-1 组合键;在 Mac 上为 ⌘-1 组合键)是项目源的入口点。它提供了重要项目内容的_逻辑_视图,并根据文件功能(例如 `Configuration Files`)将其组合在一起。在 "Projects"(项目)窗口中右键单击文件节点时,可以调用对开发任务通用的操作(即 `Build`、`Clean`、`Deploy`、`Run`)。
* *"Files"(文件)窗口:*"Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键)提供了基于目录的项目视图。换而言之,该窗口使您可以查看项目的结构,因为它位于计算机的文件系统中。在此窗口中,可以查看与项目有关的所有文件,包括 Ant 构建脚本 (`build.xml`),以及 IDE 处理项目所需的文件(包含在 `nbproject` 文件夹中)。如果已运行项目,则可以看到编译的 Java 文件(`build` 文件夹)的位置。如果已明确构建项目(方法是:在 "Projects"(项目)窗口中右键单击项目节点,然后从弹出式菜单中选择 "Build"(构建)或 "Clean and Build"(清理并构建)),则可以查看项目的可分发 WAR 文件(包含在 `dist` 文件夹中)。
@@ -128,12 +146,16 @@
此时将打开一个浏览器窗口,以显示项目的欢迎页。
image::images/hello-world.png[title="项目会自动部署到服务器并显示在浏览器中"]
那么,刚才发生了什么情况?运行 Web 项目时,IDE 将调用项目构建脚本中的 `run` Ant 目标。您可以在编辑器中打开项目的 `build.xml` 文件进行调查。
-2. 切换至 "Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键),展开项目节点,然后双击项目中包含的 `build.xml` 文件。在编辑器中打开 `build.xml` 文件时,"Navigator"(导航器)会列出该脚本中的所有可用 Ant 目标。
+
+[start=2]
+. 切换至 "Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键),展开项目节点,然后双击项目中包含的 `build.xml` 文件。在编辑器中打开 `build.xml` 文件时,"Navigator"(导航器)会列出该脚本中的所有可用 Ant 目标。
image::images/navigator-ant-targets.png[title="导航器列出了 build.xml 脚本的所有可用 Ant 目标"]
使用常规目标 (image::images/ant-normal-icon.png[]) 图标显示正常 Ant 目标。_强调的_ Ant 目标 (image::images/ant-emphasized-icon.png[]) 图标仅指示目标包含显示为工具提示的描述(如上图所示)。有关详细信息,请参见link:../../java/project-setup.html[+创建、导入和配置 Java 项目+]。
-3. 双击 `run` 目标。`build-impl.xml` 文件在编辑器中打开,并显示目标定义。
+
+[start=3]
+. 双击 `run` 目标。`build-impl.xml` 文件在编辑器中打开,并显示目标定义。
[source,java]
----
@@ -164,13 +186,19 @@
有关使用 Ant 的详细信息,请参见正式的 link:http://ant.apache.org/manual/index.html[+Ant 手册+]。
-4. 要为项目构建可分发的 WAR 文件,请从 IDE 的 "Run"(运行)菜单中,选择 "Clean and Build Project"(清理并构建项目)(或 "Clean and Build Main Project"(清理并构建主项目))。
-5. 在 "Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键)中,展开项目节点。`dist` 文件夹中包含项目的 WAR 文件。`build` 文件夹中包含编译的项目。
+
+[start=4]
+. 要为项目构建可分发的 WAR 文件,请从 IDE 的 "Run"(运行)菜单中,选择 "Clean and Build Project"(清理并构建项目)(或 "Clean and Build Main Project"(清理并构建主项目))。
+
+[start=5]
+. 在 "Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键)中,展开项目节点。`dist` 文件夹中包含项目的 WAR 文件。`build` 文件夹中包含编译的项目。
image::images/files-window.png[]
*注:*如果清理项目(在 "Projects"(项目)窗口中,右键单击项目节点,然后从弹出式菜单中选择 _Clean_(清理)),则会删除这两个文件夹。
-6. 切换至 "Services"(服务)窗口(Ctrl-5 组合键;在 Mac 上为 ⌘-5 组合键),然后展开 "Servers"(服务器)> "GlassFish Server 3" > "Applications"(应用程序)节点。
+
+[start=6]
+. 切换至 "Services"(服务)窗口(Ctrl-5 组合键;在 Mac 上为 ⌘-5 组合键),然后展开 "Servers"(服务器)> "GlassFish Server 3" > "Applications"(应用程序)节点。
image::images/services-win-deployed-app.png[]
*注:*对于 NetBeans 6.8 用户,"GlassFish v3" 是默认服务器名称。
@@ -316,20 +344,32 @@
* *Server Port Number(服务器端口号):*`3306`
* *Administrator User Name(管理员用户名):*`root`
* *Administrator Password(管理员口令):*`nbuser`
-2. 选中 "Save Password"(保存口令)选项。
+
+[start=2]
+. 选中 "Save Password"(保存口令)选项。
image::images/mysql-server-properties.png[title="指定 MySQL 服务器设置"]
-3. 单击 "OK"(确定)。IDE 将会连接到 MySQL 数据库服务器,并列出由该服务器维护的数据库实例。如果展开 "Drivers"(驱动程序)节点,则还可以看到 IDE 中包含 MySQL 的link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+连接器/J JDBC 驱动程序+]。
+
+[start=3]
+. 单击 "OK"(确定)。IDE 将会连接到 MySQL 数据库服务器,并列出由该服务器维护的数据库实例。如果展开 "Drivers"(驱动程序)节点,则还可以看到 IDE 中包含 MySQL 的link:http://dev.mysql.com/doc/refman/5.1/en/connector-j.html[+连接器/J JDBC 驱动程序+]。
image::images/services-win-mysql.png[title="在 "]
应用服务器(即 GlassFish)需要驱动程序,才能实现 Java 代码与 MySQL 数据库之间的通信。由于 IDE 中已包含连接器/J 驱动程序,因此不需要进行下载。此外,如后面所述,可以在服务器设置中通过指定方式来启用 JDBC 驱动程序部署,从而将该驱动程序自动部署到 GlassFish(如果服务器上未安装该驱动程序)。
下面的步骤 4 至 7 为可选操作。您可以将 IDE 配置为启动和停止 MySQL 服务器,以及在服务器上运行外部管理工具。
-4. 右键单击 MySQL 服务器节点,然后选择 "Properties"(属性)。在 "MySQL Server Properties"(MySQL 服务器属性)对话框中,选择 "Admin Properties"(管理属性)标签。
-5. 在 "Path/URL to admin tool"(管理工具的路径/URL)字段中,输入计算机上数据库管理工具(如 link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+])的可执行文件的路径。MySQL Administrator 包含在 link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI 工具+]包中。
-6. 在 "Path to start command"(启动命令的路径)字段中,键入 MySQL 启动命令(即 `mysqld` 或 `mysqld_safe`)的路径,具体视操作系统而定。(请参见上面的<<start,启动数据库服务器>>。)
+
+[start=4]
+. 右键单击 MySQL 服务器节点,然后选择 "Properties"(属性)。在 "MySQL Server Properties"(MySQL 服务器属性)对话框中,选择 "Admin Properties"(管理属性)标签。
+
+[start=5]
+. 在 "Path/URL to admin tool"(管理工具的路径/URL)字段中,输入计算机上数据库管理工具(如 link:http://dev.mysql.com/doc/administrator/en/mysql-administrator-introduction.html[+MySQL Administrator+])的可执行文件的路径。MySQL Administrator 包含在 link:http://dev.mysql.com/downloads/gui-tools/[+MySQL GUI 工具+]包中。
+
+[start=6]
+. 在 "Path to start command"(启动命令的路径)字段中,键入 MySQL 启动命令(即 `mysqld` 或 `mysqld_safe`)的路径,具体视操作系统而定。(请参见上面的<<start,启动数据库服务器>>。)
*注:*对于类 Unix 系统,您可能会发现,只能使用根或管理权限调用启动命令。要解决这一问题,可以创建一个脚本(如果是 Linux 和 Solaris,请使用 link:http://www.nongnu.org/gksu/[+GKSu+];如果是 Mac,则使用 link:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/osascript.1.html[+osascript+]),以完成此任务。有关详细信息,请参见link:http://davidvancouvering.blogspot.com/2008/09/starting-mysql-in-netbeans-as.html[+此博客帖子+]。
-7. 在 "Path to stop command"(停止命令的路径)字段中,输入 MySQL 停止命令(即 `mysqladmin shutdown`)的路径。因为该命令要求提供具有关闭权限的用户帐户,因此必须在 "Arguments"(参数)字段中输入用户名/口令凭证。例如:
+
+[start=7]
+. 在 "Path to stop command"(停止命令的路径)字段中,输入 MySQL 停止命令(即 `mysqladmin shutdown`)的路径。因为该命令要求提供具有关闭权限的用户帐户,因此必须在 "Arguments"(参数)字段中输入用户名/口令凭证。例如:
* *参数:*`-u root -pnbuser shutdown`
设置了 "Advanced Properties"(高级属性)标签下列出的字段后,可以执行以下操作:
@@ -345,11 +385,15 @@
1. 创建将在本教程中使用的数据库实例。为此,请右键单击 MySQL 服务器节点,然后选择 "Create Database"(创建数据库)。
2. 在显示的对话框中,键入 `affablebean`。选中 "Grant Full Access to"(将完全访问权限授予)选项,然后从下拉字段中选择 `root@localhost`。这样就可以使用 `localhost` 主机上的 `root` 帐户访问数据库了。此后,在服务器上创建连接池时,需要提供 `root` 帐户和 `nbuser` 口令作为用户名/口令凭证,才能向服务器授予数据库访问权限。
image::images/create-mysql-db-dialog.png[title="右键单击服务器节点,然后选择 "]
-3. 单击 "OK"(确定)。在执行此操作后,将创建名为 `affablebean` 的数据库,并自动建立与数据库的连接。连接将通过连接节点 (image::images/db-connection-node.png[]) 显示在 "Services"(服务)窗口中。
+
+[start=3]
+. 单击 "OK"(确定)。在执行此操作后,将创建名为 `affablebean` 的数据库,并自动建立与数据库的连接。连接将通过连接节点 (image::images/db-connection-node.png[]) 显示在 "Services"(服务)窗口中。
*注:*连接节点一直保留在 "Services"(服务)窗口中。如果重新启动 IDE,则显示的连接节点 (image::images/connection-broken.png[]) 将带有锯齿线,这指示连接已中断。要重新连接到数据库,请确保数据库服务器正在运行,然后右键单击节点,并选择 "Connect"(连接)。
-4. 展开 `affablebean` 数据库的连接节点。连接中包含数据库的默认方案 (`affablebean`),其中包括表、视图和过程的节点。目前,这些节点都是空的,因为我们尚未创建任何内容。
+
+[start=4]
+. 展开 `affablebean` 数据库的连接节点。连接中包含数据库的默认方案 (`affablebean`),其中包括表、视图和过程的节点。目前,这些节点都是空的,因为我们尚未创建任何内容。
image::images/db-conn-affable-bean.png[title="数据库连接包含数据库的默认方案以及表、视图和过程的节点"]
在此阶段,您已从 IDE 中连接到 MySQL 服务器,并创建名为 `affablebean` 的新数据库,该数据库将在整个教程中使用。另外,您已在 IDE 中创建 Java Web 项目,并确认可以成功构建该项目并将其部署到开发服务器上,且已在运行时在浏览器中将其打开。现在,开发环境已经准备就绪,您可以开始设计应用程序的数据模型了。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup.asciidoc
index 44fabe8..ac8b614 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Setup Instructions
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -52,13 +52,19 @@
1. *Set up your MySQL database server.* Follow the steps outlined in: link:setup-dev-environ.html#communicate[+Communicating with the Database Server+].
2. *Create the `affablebean` schema on the database server, and populate the database with sample data:*
-1. Click on link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] and copy (Ctrl-C; ⌘-C on Mac) the entire contents of the file.
-2. Open the IDE's SQL editor. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `affablebean` database connection ( image::images/db-connection-node.png[] ) node and choose Execute Command.
+.. Click on link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] and copy (Ctrl-C; ⌘-C on Mac) the entire contents of the file.
+.. Open the IDE's SQL editor. In the Services window (Ctrl-5; ⌘-5 on Mac), right-click the `affablebean` database connection ( image::images/db-connection-node.png[] ) node and choose Execute Command.
image::images/execute-command.png[title="Choose Execute Command from a connection node to open the IDE's SQL editor"]
The IDE's SQL editor opens.
-3. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
-4. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the database, and sample data is added to the `product` and `category` tables.
-3. *Create a connection pool and JDBC resource on GlassFish.*
+
+[start=3]
+. Paste (Ctrl-V; ⌘-V on Mac) the entire contents of the `affablebean.sql` file into the editor.
+
+[start=4]
+. Click the Run SQL ( image::images/run-sql-btn.png[] ) button in the editor's toolbar. The script runs on your MySQL server. Tables are generated for the database, and sample data is added to the `product` and `category` tables.
+
+[start=3]
+. *Create a connection pool and JDBC resource on GlassFish.*
1. In the Services window (Ctrl-5; ⌘-5 on Mac), expand the Servers > GlassFish Server 3 node and choose Properties. In the Servers window that displays, make sure the 'Enable JDBC Driver Deployment' option is selected. If your project requires the MySQL link:http://www.mysql.com/downloads/connector/j/[+Connector/J+] driver, this option will ensure that the driver is deployed to GlassFish when your project is deployed. (If the server is already running, you'll need to restart the server.)
2. In the Services window, right-click the GlassFish Server 3 node and choose Start.
3. Once the server is running, right-click the GlassFish Server 3 node and choose View Admin Console.
@@ -69,25 +75,43 @@
* *Resource Type:* `javax.sql.ConnectionPoolDataSource`
* *Database Vendor:* `MySql`
image::images/connection-pool.png[title="Specify settings to create a connection pool that connects with a MySQL database"]
-7. Click Next. Accept all defaults and click Finish.
-8. In the Connection Pools interface, click on your newly created `AffableBeanConnectionPool` to make the following change under the General tab:
+
+[start=7]
+. Click Next. Accept all defaults and click Finish.
+
+[start=8]
+. In the Connection Pools interface, click on your newly created `AffableBeanConnectionPool` to make the following change under the General tab:
* *Datasource Classname:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
image::images/datasource-classname.png[title="Set the datasource classname for the connection pool"]
-9. Click Save.
-10. Click the Additional Properties tab and ensure that the following three properties have been set. (There may be other properties listed - these are default settings, however the following three must be set manually.)
+
+[start=9]
+. Click Save.
+
+[start=10]
+. Click the Additional Properties tab and ensure that the following three properties have been set. (There may be other properties listed - these are default settings, however the following three must be set manually.)
* *User:* `root`
* *Password:* `nbuser`
* *URL:* `jdbc:mysql://localhost:3306/affablebean`
image::images/additional-properties.png[title="Set username, password and url to the database"]
-11. Click Save.
-12. Click the General tab, then click Ping. You should see a message indicating that the ping succeeded. The `AffableBeanPool` connection pool can now connect to your MySQL database server.
+
+[start=11]
+. Click Save.
+
+[start=12]
+. Click the General tab, then click Ping. You should see a message indicating that the ping succeeded. The `AffableBeanPool` connection pool can now connect to your MySQL database server.
image::images/ping-succeeded.png[title="Ping the MySQL server to determine whether the connection pool can connect"]
-13. In the Admin Console's Tree in the left column, click the Resources > JDBC > JDBC Resources node. The JDBC Resources interface opens in the main window.
-14. Click the New button to create a new JDBC resource, then enter the following details:
+
+[start=13]
+. In the Admin Console's Tree in the left column, click the Resources > JDBC > JDBC Resources node. The JDBC Resources interface opens in the main window.
+
+[start=14]
+. Click the New button to create a new JDBC resource, then enter the following details:
* *JNDI Name:* `jdbc/affablebean`
* *Connection Pool:* `AffableBeanPool`
image::images/jdbc-resource.png[title="Specify JNDI name and connection pool to create the JDBC resource"]
-15. Click OK.
+
+[start=15]
+. Click OK.
You have set up the MySQL server and can connect to it from the IDE's Services window. You created a database named `affablebean`, and populated the database's `product` and `category` tables with sample data. You then started the GlassFish server, and created a connection pool that enables the server to connect to the `affablebean` database. Finally, you created a JDBC resource which your application can use to reference the server's connection pool.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ja.asciidoc
index 484ec9f..ce7b680 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ja.asciidoc
@@ -30,7 +30,6 @@
:keywords: Apache NetBeans, Tutorials, NetBeans Eコマースのチュートリアル - 設定に関する説明
-
1. link:intro.html[+概要+]
2. link:design.html[+アプリケーションの設計+]
3. link:setup-dev-environ.html[+開発環境の設定+]
@@ -51,13 +50,19 @@
1. *MySQLデータベース・サーバーを設定します。*link:setup-dev-environ.html#communicate[+データベース・サーバーとの通信+]で説明されている手順に従います。
2. *`affablebean`スキーマをデータベース・サーバーで作成し、データベースにサンプル・データを生成します。*
-1. link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+]をクリックし、ファイルのすべての内容をコピー([Ctrl]-[C]、Macの場合は[⌘]-[C])します。
-2. IDEのSQLエディタを開きます。「サービス」ウィンドウ([Ctrl]-[5]、Macの場合は[⌘]-[5])で、`affablebean`データベース接続(image::images/db-connection-node.png[])ノードを右クリックし、「コマンドの実行」を実行します。
+.. link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+]をクリックし、ファイルのすべての内容をコピー([Ctrl]-[C]、Macの場合は[⌘]-[C])します。
+.. IDEのSQLエディタを開きます。「サービス」ウィンドウ([Ctrl]-[5]、Macの場合は[⌘]-[5])で、`affablebean`データベース接続(image::images/db-connection-node.png[])ノードを右クリックし、「コマンドの実行」を実行します。
image::images/execute-command.png[title="接続ノードから「コマンドの実行」を選択してIDEのSQLエディタを開く"]
IDEのSQLエディタが開きます。
-3. `affablebean.sql`ファイルのすべての内容をエディタに貼り付けます([Ctrl]-[V]、Macの場合は[⌘]-[V])。
-4. エディタのツールバーにある「SQLの実行」(image::images/run-sql-btn.png[])ボタンをクリックします。スクリプトがMySQLサーバーで実行されます。データベースの表が生成され、サンプル・データが`product`表および`category`表に追加されます。
-3. *接続プールおよびJDBCリソースをGlassFishで作成します。*
+
+[start=3]
+.. `affablebean.sql`ファイルのすべての内容をエディタに貼り付けます([Ctrl]-[V]、Macの場合は[⌘]-[V])。
+
+[start=4]
+.. エディタのツールバーにある「SQLの実行」(image::images/run-sql-btn.png[])ボタンをクリックします。スクリプトがMySQLサーバーで実行されます。データベースの表が生成され、サンプル・データが`product`表および`category`表に追加されます。
+
+[start=3]
+. *接続プールおよびJDBCリソースをGlassFishで作成します。*
1. 「サービス」ウィンドウ([Ctrl]-[5]、Macの場合は[⌘]-[5])で「サーバー」>「GlassFish Server 3」ノードを展開し、「プロパティ」を選択します。表示される「サーバー」ウィンドウで「JDBCドライバのデプロイメントを有効化」オプションが選択されていることを確認します。プロジェクトでlink:http://www.mysql.com/downloads/connector/j/[+MySQL Connector/J+]ドライバが必要な場合は、このオプションによって、プロジェクトがデプロイされたときにドライバがGlassFishにデプロイされるようになります。サーバーがすでに実行されている場合、サーバーを再起動する必要はありません。
2. 「サービス」ウィンドウで「GlassFish Server 3」ノードを右クリックし、「起動」を選択します。
3. サーバーが実行されたら、「GlassFish Server 3」ノードを右クリックして、「管理コンソールを表示」を選択します。
@@ -68,25 +73,43 @@
* *リソース・タイプ:* `javax.sql.ConnectionPoolDataSource`
* *データベース・ベンダー:* `MySql`
image::images/connection-pool.png[title="MySQLデータベースと接続する接続プールを作成するための設定の指定"]
-7. 「次」をクリックします。デフォルトをすべて受け入れ、「終了」をクリックします。
-8. 「接続プール」インタフェースで、新しく作成した`AffableBeanConnectionPool`をクリックし、「一般」タブで次の変更を加えます。
+
+[start=7]
+. 「次」をクリックします。デフォルトをすべて受け入れ、「終了」をクリックします。
+
+[start=8]
+. 「接続プール」インタフェースで、新しく作成した`AffableBeanConnectionPool`をクリックし、「一般」タブで次の変更を加えます。
* *データ・ソース・クラス名:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
image::images/datasource-classname.png[title="接続プールのデータソース・クラス名の設定"]
-9. 「保存」をクリックします。
-10. 「追加プロパティ」タブをクリックし、次の3つのプロパティが設定されていることを確認します。他のプロパティが一覧表示されている場合があります。これらはデフォルト設定ですが、次の3つを手動で設定する必要があります。
+
+[start=9]
+. 「保存」をクリックします。
+
+[start=10]
+. 「追加プロパティ」タブをクリックし、次の3つのプロパティが設定されていることを確認します。他のプロパティが一覧表示されている場合があります。これらはデフォルト設定ですが、次の3つを手動で設定する必要があります。
* *ユーザー:* `root`
* *パスワード: *`nbuser`
* *URL:* `jdbc:mysql://localhost:3306/affablebean`
image::images/additional-properties.png[title="データベースのユーザー名、パスワードおよびURLの設定"]
-11. 「保存」をクリックします。
-12. 「一般」タブで「Ping」をクリックします。pingが成功したことを示すメッセージが表示されます。これで、`AffableBeanPool`接続プールはMySQLデータベース・サーバーに接続できます。
+
+[start=11]
+. 「保存」をクリックします。
+
+[start=12]
+. 「一般」タブで「Ping」をクリックします。pingが成功したことを示すメッセージが表示されます。これで、`AffableBeanPool`接続プールはMySQLデータベース・サーバーに接続できます。
image::images/ping-succeeded.png[title="MySQLサーバーに対してpingを実行し、接続プールが接続できるかどうかを判断する"]
-13. 管理コンソールの左の列にあるツリーで「リソース」>「JDBC」ノードを展開し、「JDBCリソース」ノードをクリックします。「JDBCリソース」インタフェースがメイン・ウィンドウに表示されます。
-14. 「新規」ボタンをクリックして新しいJDBCリソースを作成し、次の詳細を入力します。
+
+[start=13]
+. 管理コンソールの左の列にあるツリーで「リソース」>「JDBC」ノードを展開し、「JDBCリソース」ノードをクリックします。「JDBCリソース」インタフェースがメイン・ウィンドウに表示されます。
+
+[start=14]
+. 「新規」ボタンをクリックして新しいJDBCリソースを作成し、次の詳細を入力します。
* *JNDI名:* `jdbc/affablebean`
* *プール名:* `AffableBeanPool`
image::images/jdbc-resource.png[title="JNDI名および接続プールを指定してJDBCリソースを作成する"]
-15. 「OK」をクリックします。
+
+[start=15]
+. 「OK」をクリックします。
MySQLサーバーが設定され、IDEの「サービス」ウィンドウからそのサーバーに接続できます。`affablebean`という名前のデータベースを作成し、そのデータベースの`product`表および`category`表にサンプル・データを生成しました。次に、GlassFishサーバーを起動し、接続プールを作成して、そのサーバーが`affablebean`データベースに接続できるようにしました。最後に、JDBCリソースを作成し、アプリケーションがそのリソースを使用してサーバーの接続プールを参照できるようにしました。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_pt_BR.asciidoc
index 068e60d..4dbf7e4 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_pt_BR.asciidoc
@@ -51,13 +51,19 @@
1. *Configure seu servidor de banco de dados MySQL.* Siga as etapas descritas em: link:setup-dev-environ.html#communicate[+Comunicando-se com o Servidor do Banco de Dados+].
2. *Crie o esquema `affablebean` no servidor do banco de dados e preencha o banco de dados com dados de amostra:*
-1. Clique em link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] e copie (Ctrl-C; ⌘-C no Mac) todo o conteúdo do arquivo.
-2. Abra o editor SQL do IDE. Na janela Serviços (Ctrl-5; ⌘-5 no Mac), clique com o botão direito do mouse no nó de conexão do banco de dados `affablebean` (image::images/db-connection-node.png[]) e selecione Executar Comando.
+.. Clique em link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] e copie (Ctrl-C; ⌘-C no Mac) todo o conteúdo do arquivo.
+.. Abra o editor SQL do IDE. Na janela Serviços (Ctrl-5; ⌘-5 no Mac), clique com o botão direito do mouse no nó de conexão do banco de dados `affablebean` (image::images/db-connection-node.png[]) e selecione Executar Comando.
image::images/execute-command.png[title="Selecione Executar Comando em um nó de conexão para abrir o editor SQL do IDE"]
O editor SQL do IDE será aberto.
-3. Cole (Ctrl-V; ⌘-V no Mac) todo o conteúdo do arquivo `affablebean.sql` no editor.
-4. Clique no botão Executar SQL (image::images/run-sql-btn.png[]) na barra de ferramentas do editor. O script será executado no servidor MySQL. As tabelas serão geradas para o banco de dados e os dados de amostra serão adicionadas às tabelas `product` e `category`.
-3. *Crie um pool de conexões e recursos JDBC no GlassFish*
+
+[start=3]
+. Cole (Ctrl-V; ⌘-V no Mac) todo o conteúdo do arquivo `affablebean.sql` no editor.
+
+[start=4]
+. Clique no botão Executar SQL (image::images/run-sql-btn.png[]) na barra de ferramentas do editor. O script será executado no servidor MySQL. As tabelas serão geradas para o banco de dados e os dados de amostra serão adicionadas às tabelas `product` e `category`.
+
+[start=3]
+. *Crie um pool de conexões e recursos JDBC no GlassFish*
1. Na janela Serviços (Ctrl-5; ⌘-5 no Mac), expanda o nó Servidores > GlassFish Server 3 e selecione Propriedades. Na janela Servidores exibida, certifique-se de que a opção "Ativar Implantação do driver JDBC" esteja selecionada. Se o seu projeto exigir o driver link:http://www.mysql.com/downloads/connector/j/[+Conector/J+] do MySQL, esta opção irá garantir que o driver seja implantado no GlassFish quando o projeto for implantado. (Se o servidor já estiver sendo executado, ele deverá ser reiniciado.)
2. Na janela Serviços, clique com o botão direito do mouse no nó GLassFish Server 3 e selecione Iniciar.
3. Quando o servidor estiver sendo executado, clique com o botão direito do mouse no nó GlassFish Server 3 e selecione Exibir Console Admin.
@@ -68,25 +74,43 @@
* *Tipo de Recurso:*`javax.sql.ConnectionPoolDataSource`
* *Fornecedor do Banco de Dados* `MySql`
image::images/connection-pool.png[title="Especificar definições para criar um pool de conexões que estabelece conexão com um banco de dados MySQL"]
-7. Clique em Próximo. Aceite todos os defaults e clique em Finalizar.
-8. Na interface Pools de Conexões, clique no recém-criado `AffableBeanConnectionPool` para fazer as seguintes alterações na guia Geral:
+
+[start=7]
+. Clique em Próximo. Aceite todos os defaults e clique em Finalizar.
+
+[start=8]
+. Na interface Pools de Conexões, clique no recém-criado `AffableBeanConnectionPool` para fazer as seguintes alterações na guia Geral:
* *Nome da Classe da Fonte de Dados:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
image::images/datasource-classname.png[title="Defina o nome da classe da fonte de dados para o pool de conexões"]
-9. Clique em Salvar.
-10. Clique na guia Propriedades Adicionais e verifique se as três propriedades a seguir foram definidas. (Talvez existam outras propriedades listadas: estas são as definições default, no entanto as três seguintes devem ser configuradas manualmente.)
+
+[start=9]
+. Clique em Salvar.
+
+[start=10]
+. Clique na guia Propriedades Adicionais e verifique se as três propriedades a seguir foram definidas. (Talvez existam outras propriedades listadas: estas são as definições default, no entanto as três seguintes devem ser configuradas manualmente.)
* *Usuário:*`root`
* *Senha:*`nbuser`
* *URL:*`jdbc:mysql://localhost:3306/affablebean`
image::images/additional-properties.png[title="Defina o nome de usuário, a senha e o url do banco de dados"]
-11. Clique em Salvar.
-12. Clique na guia Geral e, em seguida, clique em Ping. Você deverá receber uma mensagem indicando que o ping foi bem-sucedido. O pool de conexões `AffableBeanPool` pode agora conectar-se com o servidor de banco de dados MySQL.
+
+[start=11]
+. Clique em Salvar.
+
+[start=12]
+. Clique na guia Geral e, em seguida, clique em Ping. Você deverá receber uma mensagem indicando que o ping foi bem-sucedido. O pool de conexões `AffableBeanPool` pode agora conectar-se com o servidor de banco de dados MySQL.
image::images/ping-succeeded.png[title="Pingue o servidor MySQL para determinar se o pool de conexões pode se conectar"]
-13. Na Árvore da Console Admin na coluna esquerda, clique no nó Recursos > JDBC > Recursos do JDBC. A interface Recursos do JDBC será aberta na janela principal.
-14. Clique no botão Novo para criar um novo recurso JDBC e, em seguida, informe os seguintes detalhes:
+
+[start=13]
+. Na Árvore da Console Admin na coluna esquerda, clique no nó Recursos > JDBC > Recursos do JDBC. A interface Recursos do JDBC será aberta na janela principal.
+
+[start=14]
+. Clique no botão Novo para criar um novo recurso JDBC e, em seguida, informe os seguintes detalhes:
* *Nome JNDI:*`jdbc/affablebean`
* *Pool de Conexões:*`AffableBeanPool`
image::images/jdbc-resource.png[title="Especifique o nome JNDI e o pool de conexões para criar o recurso JDBC"]
-15. Clique em OK.
+
+[start=15]
+. Clique em OK.
Você configurou o servidor MySQL e pode conectar-se a ele na janela Serviços do IDE. Um banco de dados chamado `affablebean` foi criado e as tabelas `product` e `category` do banco de dados foram preenchidas com dados de amostra. Em seguida, você iniciou o GlassFish Server e criou um pool de conexões que permite ao servidor estabelecer conexão com o banco de dados `affablebean`. Finalmente, você criou um recurso JDBC que sua aplicação pode utilizar para fazer referência ao pool de conexões do servidor.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ru.asciidoc
index 9e6149e..b38c9d5 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_ru.asciidoc
@@ -51,13 +51,19 @@
1. *Настройка сервера баз данных MySQL.* Выполните действия, описанные в разделе link:setup-dev-environ.html#communicate[+Связь с сервером базы данных+]
2. *Создайте на сервере базы данных схему `affablebean` и введите в базу данные примера:*
-1. Щелкните link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] и скопируйте (Ctrl-C; ⌘-C в Mac) все содержимое файла.
-2. Откройте редактор SQL в среде IDE. В окне 'Службы' (Ctrl-5; ⌘-5 в Mac), щелкните правой кнопкой мыши узел подключения к базе данных `affablebean` ( image::images/db-connection-node.png[] ) и выберите 'Выполнить команду'.
+.. Щелкните link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] и скопируйте (Ctrl-C; ⌘-C в Mac) все содержимое файла.
+.. Откройте редактор SQL в среде IDE. В окне 'Службы' (Ctrl-5; ⌘-5 в Mac), щелкните правой кнопкой мыши узел подключения к базе данных `affablebean` ( image::images/db-connection-node.png[] ) и выберите 'Выполнить команду'.
image::images/execute-command.png[title="Выберите элемент "Выполнение команды" из узла подключения для открытия редактора SQL в IDE"]
Откроется редактор SQL среды IDE.
-3. Вставьте (Ctrl-V; ⌘-V в Mac) все содержимое файла `affablebean.sql` в редактор.
-4. Нажмите кнопку 'Запустить SQL' (image::images/run-sql-btn.png[]) на панели инструментов редактора. На сервере MySQL будет выполнен сценарий. Для базы данных создаются релевантные таблицы с добавлением данных примера в таблицы `product` и `category`.
-3. *Создание пула подключений и ресурса JDBC на сервере GlassFish.*
+
+[start=3]
+. Вставьте (Ctrl-V; ⌘-V в Mac) все содержимое файла `affablebean.sql` в редактор.
+
+[start=4]
+. Нажмите кнопку 'Запустить SQL' (image::images/run-sql-btn.png[]) на панели инструментов редактора. На сервере MySQL будет выполнен сценарий. Для базы данных создаются релевантные таблицы с добавлением данных примера в таблицы `product` и `category`.
+
+[start=3]
+. *Создание пула подключений и ресурса JDBC на сервере GlassFish.*
1. Перейдите в окно "Службы" (Ctrl-5; ⌘-5 в Mac) и разверните 'Серверы' > узел 'GlassFish Server 3' и выберите 'Свойства'. В открывшемся окне "Серверы" проверьте, что выбран параметр "Включить развертывание драйвера JDBC". Если для проекта требуется драйвер MySQL link:http://www.mysql.com/downloads/connector/j/[+Connector/J+], этот параметр обеспечит развертывание драйвера на сервере GlassFish при развертывании проекта. (Если сервер уже запущен, необходимо перезапустить его).
2. В окне 'Службы' щелкните правой кнопкой мыши узел GlassFish Server 3 и выберите 'Запустить'.
3. После запуска сервера щелкните правой кнопкой мыши узел GlassFish Server 3 и выберите 'Просмотр консоли администратора'.
@@ -68,25 +74,43 @@
* *Тип ресурса:* `javax.sql.ConnectionPoolDataSource`
* *Поставщик базы данных:* `MySql`
image::images/connection-pool.png[title="Укажите настройки для создания пута подключений для соединеняи с базой данных MySQL"]
-7. Нажмите кнопку "Далее". Примите значения по умолчанию и нажмите кнопку "Готово".
-8. В интерфейсе "Пулы подключений" щелкните новый элемент `AffableBeanConnectionPool` для внесения следующих изменений на вкладке "Общее":
+
+[start=7]
+. Нажмите кнопку "Далее". Примите значения по умолчанию и нажмите кнопку "Готово".
+
+[start=8]
+. В интерфейсе "Пулы подключений" щелкните новый элемент `AffableBeanConnectionPool` для внесения следующих изменений на вкладке "Общее":
* *Имя класса источника данных:* `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
image::images/datasource-classname.png[title="Задайте имя класса источника данных для пула подключений"]
-9. Нажмите кнопку "Сохранить".
-10. Откройте вкладку "Дополнительные свойства" и проверьте, что установлены значения для следующих трех свойств. (В списке могут присутствовать и другие свойства, значения для которых установлены по умолчанию. Однако значения для следующих трех свойств необходимо указать вручную.)
+
+[start=9]
+. Нажмите кнопку "Сохранить".
+
+[start=10]
+. Откройте вкладку "Дополнительные свойства" и проверьте, что установлены значения для следующих трех свойств. (В списке могут присутствовать и другие свойства, значения для которых установлены по умолчанию. Однако значения для следующих трех свойств необходимо указать вручную.)
* *Пользователь:* `root`
* *Пароль:* `nbuser`
* *URL:* `jdbc:mysql://localhost:3306/affablebean`
image::images/additional-properties.png[title="Задайте имя пользователя, пароль и URL-адрес для базы данных"]
-11. Нажмите кнопку "Сохранить".
-12. Откройте вкладку "Общее" и нажмите "Ping". Должно появится сообщение об успешном выполнении команды ping. Теперь пул подключений `AffableBeanPool` соединен с сервером базы данных MySQL.
+
+[start=11]
+. Нажмите кнопку "Сохранить".
+
+[start=12]
+. Откройте вкладку "Общее" и нажмите "Ping". Должно появится сообщение об успешном выполнении команды ping. Теперь пул подключений `AffableBeanPool` соединен с сервером базы данных MySQL.
image::images/ping-succeeded.png[title="Проверьте с помощью команды Ping сервер MySQL, чтобы определить возможность соединения для пула подключений"]
-13. В дереве консоли администратора в левом столбце разверните узел "Ресурсы > JDBC > Ресурсы JDBC". В главном окне откроется интерфейс "Ресурсы JDBC".
-14. Для создания нового ресурса JDBC нажмите кнопку "Создать" и укажите следующие подробные сведения:
+
+[start=13]
+. В дереве консоли администратора в левом столбце разверните узел "Ресурсы > JDBC > Ресурсы JDBC". В главном окне откроется интерфейс "Ресурсы JDBC".
+
+[start=14]
+. Для создания нового ресурса JDBC нажмите кнопку "Создать" и укажите следующие подробные сведения:
* *Имя JNDI:* `jdbc/affablebean`
* *Пул подключений:* `AffableBeanPool`
image::images/jdbc-resource.png[title="Укажите имя JNDI и пул подключений для создания ресурса JDBC"]
-15. Нажмите кнопку "ОК".
+
+[start=15]
+. Нажмите кнопку "ОК".
После настройки сервера MySQL к нему можно подключиться в окне "Службы" в среде IDE. Должна быть создана база данных `affablebean` с заполненными таблицами `product` и `category` (для их заполнения используются данные примера). Далее запустите сервер GlassFish и создайте пул подключений, с помощью которого сервер сможет соединиться с базой данных `affablebean`. Наконец, создается ресурс JDBC, который используется в приложении для обращения к пулу подключений сервера.
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_zh_CN.asciidoc
index 5572f1a..ce0ea5f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/setup_zh_CN.asciidoc
@@ -51,13 +51,19 @@
1. *设置 MySQL 数据库服务器*。按照link:setup-dev-environ.html#communicate[+与数据库服务器进行通信+]中所述的步骤操作。
2. *在数据库服务器上创建 `affablebean` 方案,并使用样例数据填充数据库:*
-1. 单击 link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] 并复制(Ctrl-C;在 Mac 上为 ⌘-C)文件的所有内容。
-2. 打开 IDE 的 SQL 编辑器。在 "Services"(服务)窗口(按 Ctrl-5 组合键;在 Mac 上为 ⌘-5 组合键)中,右键单击 `affablebean` 数据库连接 (image::images/db-connection-node.png[]) 节点,然后选择 "Execute Command"(执行命令)。
+.. 单击 link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252Faffablebean.sql[+affablebean.sql+] 并复制(Ctrl-C;在 Mac 上为 ⌘-C)文件的所有内容。
+.. 打开 IDE 的 SQL 编辑器。在 "Services"(服务)窗口(按 Ctrl-5 组合键;在 Mac 上为 ⌘-5 组合键)中,右键单击 `affablebean` 数据库连接 (image::images/db-connection-node.png[]) 节点,然后选择 "Execute Command"(执行命令)。
image::images/execute-command.png[title="从连接节点中选择 "]
IDE 的 SQL 编辑器打开。
-3. 将 `affablebean.sql` 文件的所有内容粘贴(Ctrl-V;在 Mac 上为 ⌘-V)至编辑器。
-4. 在编辑器的工具栏中单击 "Run SQL"(运行 SQL)(image::images/run-sql-btn.png[]) 按钮。此脚本在 MySQL 服务器上运行。为数据库生成表,并将样例数据添加到 `product` 和 `category` 表。
-3. *在 GlassFish 上创建连接池和 JDBC 源。*
+
+[start=3]
+. 将 `affablebean.sql` 文件的所有内容粘贴(Ctrl-V;在 Mac 上为 ⌘-V)至编辑器。
+
+[start=4]
+. 在编辑器的工具栏中单击 "Run SQL"(运行 SQL)(image::images/run-sql-btn.png[]) 按钮。此脚本在 MySQL 服务器上运行。为数据库生成表,并将样例数据添加到 `product` 和 `category` 表。
+
+[start=3]
+. *在 GlassFish 上创建连接池和 JDBC 源。*
1. 在 "Services"(服务)窗口(Ctrl-5 组合键;在 Mac 上为 ⌘-5 组合键)中,展开 "Servers"(服务器)> "GlassFish Server 3" 节点,并选择 "Properties"(属性)。在显示的 "Servers"(服务器)窗口中,请确保选中 "Enable JDBC Driver Deployment"(启用 JDBC 驱动程序部署)。如果项目需要 MySQL link:http://www.mysql.com/downloads/connector/j/[+Connector/J+] 驱动程序,则此选项会确保在部署项目时将驱动程序部署到 GlassFish 上。(如果服务器已在运行,则需要重新启动服务器。)
2. 在 "Services"(服务)窗口中,右键单击 "GlassFish Server 3" 节点并选择 "Start"(启动)。
3. 运行该服务器之后,右键单击 "GlassFish Server 3" 节点,然后选择 "View Admin Console"(查看管理控制台)。
@@ -68,25 +74,43 @@
* *Resource Type(资源类型):*`javax.sql.ConnectionPoolDataSource`
* *Database Vendor(数据库供应商):*`MySql`
image::images/connection-pool.png[title="指定设置以创建连接至 MySQL 数据库的连接池"]
-7. 单击 "Next"(下一步)。接受所有默认值,然后单击 "Finish"(完成)。
-8. 在 "Connection Pools"(连接池)接口中,单击新创建的 `AffableBeanConnectionPool`,在 "General"(常规)标签下进行以下更改:
+
+[start=7]
+. 单击 "Next"(下一步)。接受所有默认值,然后单击 "Finish"(完成)。
+
+[start=8]
+. 在 "Connection Pools"(连接池)接口中,单击新创建的 `AffableBeanConnectionPool`,在 "General"(常规)标签下进行以下更改:
* *Datasource Classname(数据源类名):*`com.mysql.jdbc.jdbc2.optional.MysqlDataSource`
image::images/datasource-classname.png[title="为连接池设置数据源类名"]
-9. 单击 "Save"(保存)。
-10. 单击 "Additional Properties"(附加属性)标签,并确保已设置以下三个属性。(可能还列出其他属性,这些是默认设置,但是以下三个设置必须进行手动设置。)
+
+[start=9]
+. 单击 "Save"(保存)。
+
+[start=10]
+. 单击 "Additional Properties"(附加属性)标签,并确保已设置以下三个属性。(可能还列出其他属性,这些是默认设置,但是以下三个设置必须进行手动设置。)
* *User(用户):*`root`
* *Password(口令):*`nbuser`
* *URL:*`jdbc:mysql://localhost:3306/affablebean`
image::images/additional-properties.png[title="设置用户名、口令和指向数据库的 URL"]
-11. 单击 "Save"(保存)。
-12. 单击 "General"(常规)标签,然后单击 "Ping"。应会看到一则指示 ping 已成功的消息。`AffableBeanPool` 连接池现在可以连接到 MySQL 数据库服务器。
+
+[start=11]
+. 单击 "Save"(保存)。
+
+[start=12]
+. 单击 "General"(常规)标签,然后单击 "Ping"。应会看到一则指示 ping 已成功的消息。`AffableBeanPool` 连接池现在可以连接到 MySQL 数据库服务器。
image::images/ping-succeeded.png[title="对 MySQL 服务器执行 ping 操作以确定连接池能否连接"]
-13. 在左侧列中的管理控制台树中,单击 "Resources"(资源)> "JDBC" > "JDBC Resources"(JDBC 资源)节点。在主窗口中打开 "JDBC Resources"(JDBC 资源)界面。
-14. 单击 "New"(新建)按钮以创建新的 JDBC 资源,然后输入以下详细信息:
+
+[start=13]
+. 在左侧列中的管理控制台树中,单击 "Resources"(资源)> "JDBC" > "JDBC Resources"(JDBC 资源)节点。在主窗口中打开 "JDBC Resources"(JDBC 资源)界面。
+
+[start=14]
+. 单击 "New"(新建)按钮以创建新的 JDBC 资源,然后输入以下详细信息:
* *JNDI Name(JNDI 名称):*`jdbc/affablebean`
* *Connection Pool(连接池):*`AffableBeanPool`
image::images/jdbc-resource.png[title="指定 JNDI 名称和连接池以创建 JDBC 资源"]
-15. 单击 "OK"(确定)。
+
+[start=15]
+. 单击 "OK"(确定)。
已经设置 MySQL 服务器,并且可以从 IDE 的 "Services"(服务)窗口连接到此服务器。创建了名为 `affablebean` 的数据库,并使用样例数据填充了数据库的 `product` 和 `category` 表。然后,启动了 GlassFish Server,并创建一个连接池,服务器可通过它连接到 `affablebean` 数据库。最后,创建了一个 JDBC 资源,应用程序可使用它来引用服务器连接池的。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/test-profile.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/test-profile.asciidoc
index c77b828..a781386 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/test-profile.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/test-profile.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Testing and Profiling
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -48,7 +48,9 @@
* <<profile,Using the NetBeans Profiler>>
* <<glassFishTune,Tuning the GlassFish Server>>
* <<seeAlso,See Also>>
-13. link:conclusion.html[+Conclusion+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -105,16 +107,24 @@
If you receive an error when running the project, revisit the link:setup.html[+setup instructions+], which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL. If you want to log into the project's administration console (not required in this tutorial unit), you'll need to create a user named `nbuser` on the GlassFish server. This task is described in Unit 11, link:security.html#createUsers[+Securing the Application: Create Users and/or Groups on the Server+].
-3. Open the IDE's Plugins Manager by choosing Tools > Plugins from the main menu. Select the Available Plugins tab, then type in '`jmeter`' into the Search field. When you see JMeter Kit displayed from the filtered results, select it by clicking the checkbox under the Install column.
+
+[start=3]
+. Open the IDE's Plugins Manager by choosing Tools > Plugins from the main menu. Select the Available Plugins tab, then type in '`jmeter`' into the Search field. When you see JMeter Kit displayed from the filtered results, select it by clicking the checkbox under the Install column.
image::images/plugins-manager.png[title="JMeter Kit is a NetBeans certified plugin available in the Plugins Manager"]
-4. Click Install. The IDE's installer informs you that two plugins will be installed: The JMeter Kit and the Load Generator, which provides a generic infrastructure for load generator engines registered in the IDE.
+
+[start=4]
+. Click Install. The IDE's installer informs you that two plugins will be installed: The JMeter Kit and the Load Generator, which provides a generic infrastructure for load generator engines registered in the IDE.
image::images/ide-installer.png[title="Plugins dependencies are automatically included during installation"]
-5. Click Next. Accept the license agreement, then click Install.
+
+[start=5]
+. Click Next. Accept the license agreement, then click Install.
You require an Internet connection to download the selected plugins.
The installer downloads, verifies, and installs the plugins. When installation has successfully completed, click Finish to exit the installer, then click Close to close the Plugins Manager.
-6. In the Projects window, note that a new Load Generator Scripts node displays in your project.
+
+[start=6]
+. In the Projects window, note that a new Load Generator Scripts node displays in your project.
image::images/load-generator-scripts.png[title="The Load Generator plugin enables you to access scripts from the Projects window"]
If you open the Files window (Ctrl-2; ⌘-2 on Mac), you'll see a new `jmeter` folder added to the project. (Recall that the Files window provides a directory-based view of projects, i.e., it displays the folder structure of projects as they exist on your computer's file system.) The `jmeter` folder corresponds to the Project window's Load Generator Scripts node, and will contain any load scripts that you later add to the project.
@@ -157,24 +167,42 @@
Instead of scrolling to the bottom of the list, simply begin typing '`load`'. As shown in the image below, the Load Testing Scripts category displays.
image::images/file-wizard-load.png[title="You can filter category entries by typing the category you are searching for"]
-3. Expand the Load Testing Scripts category and select *JMeter Plans*. Under File Types, select *New JMeter Plan*, then click Next.
-4. Name the plan `useCaseTest`, then click Finish. The new test plan displays in the Projects window.
+
+[start=3]
+. Expand the Load Testing Scripts category and select *JMeter Plans*. Under File Types, select *New JMeter Plan*, then click Next.
+
+[start=4]
+. Name the plan `useCaseTest`, then click Finish. The new test plan displays in the Projects window.
image::images/use-case-test.png[title="JMeter test plans display under Load Testing Scripts in the Projects window"]
-5. To begin customizing the plan in JMeter, right-click the `useCaseTest.jmx` node and choose External Edit. JMeter opens.
+
+[start=5]
+. To begin customizing the plan in JMeter, right-click the `useCaseTest.jmx` node and choose External Edit. JMeter opens.
image::images/jmeter.png[title="NetBeans template plan is provided when opening JMeter"]
*Note:* The NetBeans template plan includes various user-defined variables, as shown in the above image. Usage of several of these variables will become clear as we work with the test plan. For more information, see the Apache JMeter User's Manual: link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#User_Defined_Variables[+18.4.13 User Defined Variables+].
-6. Click the HTTP Request Defaults node in the left column. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request_Defaults[+HTTP Request Defaults+] panel enables you to set default values for all HTTP requests invoked from your test plan. Note that the entries for Server Name and Port Number are `${nb.server}` and `${nb.port}`, respectively. From the image above, you see that these equate to `localhost` and `8080`, which you typically use when deploying NetBeans projects to GlassFish.
-7. Click the Thread Group node in the left column. In JMeter, a "thread" refers to a user. Let's rename the Thread Group to `AffableBean` `Users`. Type '`AffableBean` `Users`' into the Name field under Thread Group.
+
+[start=6]
+. Click the HTTP Request Defaults node in the left column. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request_Defaults[+HTTP Request Defaults+] panel enables you to set default values for all HTTP requests invoked from your test plan. Note that the entries for Server Name and Port Number are `${nb.server}` and `${nb.port}`, respectively. From the image above, you see that these equate to `localhost` and `8080`, which you typically use when deploying NetBeans projects to GlassFish.
+
+[start=7]
+. Click the Thread Group node in the left column. In JMeter, a "thread" refers to a user. Let's rename the Thread Group to `AffableBean` `Users`. Type '`AffableBean` `Users`' into the Name field under Thread Group.
Let's begin recording requests for the test plan. To do so, we'll use JMeter's link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Proxy_Server[+HTTP Proxy Server+]. Instead of entering test plan requests manually, we'll run the proxy server and have it record requests sent from the browser. For large test plans this technique is invaluable.
-8. In the left column, right-click WorkBench and choose Add > Non-Test Elements > HTTP Proxy Server.
-9. In the HTTP Proxy Server panel, change the port number from `8080` to another, random number, for example `9090`. JMeter provides `8080` as its default port number for the proxy server. However, the GlassFish server also occupies the `8080` port, so we're modifying the proxy server's port number to avoid a port conflict.
-10. In the Grouping drop-down list, select 'Put each group in a new controller'. Also, deselect the 'Capture HTTP Headers' option. We do not require header information for each recorded request.
+
+[start=8]
+. In the left column, right-click WorkBench and choose Add > Non-Test Elements > HTTP Proxy Server.
+
+[start=9]
+. In the HTTP Proxy Server panel, change the port number from `8080` to another, random number, for example `9090`. JMeter provides `8080` as its default port number for the proxy server. However, the GlassFish server also occupies the `8080` port, so we're modifying the proxy server's port number to avoid a port conflict.
+
+[start=10]
+. In the Grouping drop-down list, select 'Put each group in a new controller'. Also, deselect the 'Capture HTTP Headers' option. We do not require header information for each recorded request.
image::images/http-proxy-server.png[title="Configure the proxy server"]
Note that the 'Use Recording Controller' option is selected by default for the Target Controller field. When you begin recording requests, they will be stored in the Recording Controller that is listed in the left column.
-11. Switch to your browser and temporarily change its port number to `9090`.
+
+[start=11]
+. Switch to your browser and temporarily change its port number to `9090`.
If you have previously configured your browser's proxy, remember your settings so that you may be able to reenter them after completing this exercise.
@@ -186,27 +214,45 @@
* Remove the `127.0.0.1` and `localhost` entries in the 'No Proxy for' field.
image::images/firefox-proxy.png[title="Specify 'localhost:9090' and remove entries in the 'No Proxy for' field"]
* Click OK.
-12. Clear your browser's cache before you begin recording requests. You want to make sure that the HTTP Proxy Server is able to record all resources required for displaying pages in the Affable Bean website, including images, JavaScript scripts and CSS stylesheets.
+
+[start=12]
+. Clear your browser's cache before you begin recording requests. You want to make sure that the HTTP Proxy Server is able to record all resources required for displaying pages in the Affable Bean website, including images, JavaScript scripts and CSS stylesheets.
In Firefox, you can do this by pressing Ctrl-Shift-Del (⌘-Shift-Del on Mac) to open the Clear Recent History dialog. Under 'Time range to clear', ensure that you've selected a range that extends to the first time the browser accessed the Affable Bean website. Select Cache, then click Clear Now.
image::images/ff-clear-recent-history.png[title="Clear your browser's cache before proceeding with recording"]
-13. Return to the JMeter Test Plan panel (<<testPlanPanel,shown above>>) and change the values for `nb.users` and `nb.rampup` to `99`.
+
+[start=13]
+. Return to the JMeter Test Plan panel (<<testPlanPanel,shown above>>) and change the values for `nb.users` and `nb.rampup` to `99`.
image::images/user-defined-variables.png[title="Double-click into User Defined Variables table to modify variables"]
The reason this is recommended is that JMeter automatically inserts user-defined variables throughout the test plan, wherever their values occur. So, for example, when the URL for `/AffableBean/js/jquery-1.4.2.js` is encountered, it will be recorded as: `AffableBean/js/jquery-1.4.*${nb.users}*.js`. Later, when we modify the value and rerun the test plan, URLs such as this will also change, which is not desired behavior. Here, we enter a random value (`99`), since we don't expect it to occur in the URLs that we are about to record.
-14. Return to the HTTP Proxy Server panel, then at the bottom of the panel, click the Start button. JMeter's proxy server is now listening on port 9090.
-15. Run the project ( image::images/run-project-btn.png[] ) from the IDE. The project is deployed to GlassFish, and the welcome page opens in the browser.
-16. Switch to JMeter and inspect the Recording Controller in the left column. All of the requests generated for accessing the welcome page are listed under the Recording Controller in a node named after the first request (i.e., `/AffableBean/`).
+
+[start=14]
+. Return to the HTTP Proxy Server panel, then at the bottom of the panel, click the Start button. JMeter's proxy server is now listening on port 9090.
+
+[start=15]
+. Run the project ( image::images/run-project-btn.png[] ) from the IDE. The project is deployed to GlassFish, and the welcome page opens in the browser.
+
+[start=16]
+. Switch to JMeter and inspect the Recording Controller in the left column. All of the requests generated for accessing the welcome page are listed under the Recording Controller in a node named after the first request (i.e., `/AffableBean/`).
image::images/recording-controller.png[title="Request grouping for welcome page displayed under Recording Controller"]
If you inspect the `/AffableBean/` node, you'll note that it is a link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Simple_Controller[+Simple Controller+]. Although dubbed a "Controller", the Simple Controller doesn't offer any functionality beyond enabling you to group elements together - as demonstrated here.
-17. Return to the browser and continue clicking through the website according to the use-case <<useCase,outlined above>>. You can select any of the categories and products. Stop when you reach the checkout page - the proxy server will not be able to record requests sent over HTTPS.^<<footnote1,[1]>>^
+
+[start=17]
+. Return to the browser and continue clicking through the website according to the use-case <<useCase,outlined above>>. You can select any of the categories and products. Stop when you reach the checkout page - the proxy server will not be able to record requests sent over HTTPS.^<<footnote1,[1]>>^
The elements within the Recording Controller will look as follows.
image::images/recording-controller2.png[title="Requests according to use-case listed under Recording Controller"]
-18. Stop the proxy server. Click the Stop button in JMeter's HTTP Proxy Server panel.
-19. In your browser, change the proxy configuration so that it no longer uses port 9090. In Firefox for example, return to the proxy configuration window (<<ff-proxy-config,displayed above>>) and select No Proxy.
-20. Manually create the request for `/AffableBean/purchase`. Perform the following steps:
+
+[start=18]
+. Stop the proxy server. Click the Stop button in JMeter's HTTP Proxy Server panel.
+
+[start=19]
+. In your browser, change the proxy configuration so that it no longer uses port 9090. In Firefox for example, return to the proxy configuration window (<<ff-proxy-config,displayed above>>) and select No Proxy.
+
+[start=20]
+. Manually create the request for `/AffableBean/purchase`. Perform the following steps:
1. Click the Simple Controller in JMeter's left column, then press Ctrl-X (⌘-X on Mac) to cut the element.
2. Click the Recording Controller, then press press Ctrl-V (⌘-V on Mac) to paste the element. The Simple Controller now displays beneath the `/AffableBean/checkout` request.
3. Click the Simple Controller node, then in its main panel rename the controller to `/AffableBean/purchase`.
@@ -218,7 +264,9 @@
* *Protocol:* `https`
* *Method:* `POST`
* *Path:* `/AffableBean/purchase`
-6. Under 'Send Parameters With the Request', click the Add button and create the following entries:
+
+[start=6]
+. Under 'Send Parameters With the Request', click the Add button and create the following entries:
|===
|Name |Value |Encode? |Include Equals?
@@ -235,24 +283,33 @@
|`creditcard` |`4444222233331111` |✓ |✓
|===
+
image::images/http-request.png[title="Configure an HTTP Request for HTTPS connection"]
-21. Now, add an link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager[+HTTP Cookie Manager+] to the test plan. Right-click the `AffableBean` `Users` thread group node in JMeter's left column, then choose Add > Config Element > HTTP Cookie Manager.
+
+[start=21]
+. Now, add an link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager[+HTTP Cookie Manager+] to the test plan. Right-click the `AffableBean` `Users` thread group node in JMeter's left column, then choose Add > Config Element > HTTP Cookie Manager.
Recall that the `AffableBean` application relies on a session-tracking mechanism (i.e., cookies or URL-rewriting) to remember which shopping cart belongs to which request. Therefore, we need to account for this in the test plan. JMeter acts as the client when sending requests to the server, however unlike a browser, it doesn't have cookies "enabled by default." We apply the HTTP Cookie Manager to the thread group so that the `JSESSIONID` cookie can be passed between client and server.
*Note:* If you want to employ URL rewriting as the session-tracking mechanism, you would need to add the link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_URL_Re-writing_Modifier[+HTTP URL Re-writing Modifier+] to the thread group.
-22. Finally, add an element to the test plan that simulates a delay between user-initiated requests.
+
+[start=22]
+. Finally, add an element to the test plan that simulates a delay between user-initiated requests.
1. Right-click the `/AffableBean/` Simple Controller in the left column and choose Add > Sampler > Test Action.
2. In the main panel, specify the following:
* *Name:* `user delay`
* *Duration (milliseconds):* `${nb.interleave}`
image::images/test-action.png[title="Use a Test Action element to simulate a delay between user-initiated requests"]
-3. In JMeter's left column, copy (Ctrl-C; ⌘-C on Mac) the new `user` `delay` Test Action node, then paste it (Ctrl-V; ⌘-V on Mac) into each of the other Simple Controllers ( image::images/simple-controller-node.png[] ) that form the test plan, except for the final one (`/AffableBean/purchase`).
+
+[start=3]
+. In JMeter's left column, copy (Ctrl-C; ⌘-C on Mac) the new `user` `delay` Test Action node, then paste it (Ctrl-V; ⌘-V on Mac) into each of the other Simple Controllers ( image::images/simple-controller-node.png[] ) that form the test plan, except for the final one (`/AffableBean/purchase`).
When you finish, the final six Simple Controllers and their contents will look as follows.
image::images/user-delay.png[title="Use copy and paste functionality to place existing elements elsewhere in your test plan"]
-23. (_Optional_.) Clean up the test plan. You can remove the Loop Controller and Constant Timer. (Right-click and choose Remove.) Also, move all of the Recording Controller's child elements directly into the `AffableBean` `Users` thread group, then remove the Recording Controller. When you finish, the test plan will look as follows.
+
+[start=23]
+. (_Optional_.) Clean up the test plan. You can remove the Loop Controller and Constant Timer. (Right-click and choose Remove.) Also, move all of the Recording Controller's child elements directly into the `AffableBean` `Users` thread group, then remove the Recording Controller. When you finish, the test plan will look as follows.
image::images/test-plan.png[title="Remove unnecessary items from test plan"]
@@ -271,17 +328,25 @@
*Note:* If you did not create the JMeter test plan in the <<createTestPlan,previous sub-section>>, you can download the complete link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FuseCaseTest.jmx[+`useCaseTest.jmx`+] file and add it to your project. To add it to the `AffableBean` project, copy it from your computer's file system (Ctrl-C; ⌘-C on Mac), then in the IDE, open the Files window (Ctrl-2; ⌘-2 on Mac), right-click the `jmeter` folder and choose Paste.
-2. Add several _listeners_ to the test plan:
+
+[start=2]
+. Add several _listeners_ to the test plan:
* Right-click `AffableBean` `Users` and choose Add > Listener > *Summary Report*.
* Right-click `AffableBean` `Users` and choose Add > Listener > *View Results Tree*.
* Right-click `AffableBean` `Users` and choose Add > Listener > *Graph Results*.
In JMeter, you require a _listener_ to record and display the results of your test plan. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Summary_Report[+Summary Report+] displays a table, with each row corresponding to each differently named request in your test. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#View_Results_Tree[+View Results Tree+] shows a tree of all sample responses, allowing you to view response details for any sample. The link:http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Graph_Results[+Graph Results+] listener displays a simple graph that plots all sample times.
-3. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
+
+[start=3]
+. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
* *`nb.users`:* `1`
* *`nb.interleave`:* `5000`
We begin the test by simulating just one user. The value for `nb.interleave` is used in the `user` `delay` Test Action that we created, and represents the duration of a pause in milliseconds. Therefore, the test will pause for 5 seconds between each user-initiated request.
-4. Click the Summary Report node so that you are able to view the test results while the test is running.
-5. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu.
+
+[start=4]
+. Click the Summary Report node so that you are able to view the test results while the test is running.
+
+[start=5]
+. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu.
The test plan runs for approximately 50 seconds. Note that request samples are taken every three seconds, during which you can watch as results are added and updated. Note that values for the `Average`, `Min`, and `Max` columns are represented in milliseconds.
image::images/summary-report.png[title="Summary Report displays results from the completed test plan"]
@@ -296,7 +361,9 @@
For further information, see the official jQuery documentation: link:http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery[+CDN Hosted jQuery+].
-6. Click the View Results Tree node. Here you see the individual results from each of the sample requests, listed in the order in which they occurred.
+
+[start=6]
+. Click the View Results Tree node. Here you see the individual results from each of the sample requests, listed in the order in which they occurred.
image::images/view-results-tree.png[title="View Results Tree displays a tree of all sample responses listed in the order in which they occurred"]
The green ( image::images/jmeter-ok-icon.png[] ) icons indicate an HTTP status response of 200. In the above image, under 'Sampler result' in the right panel, note that the Thread Name for the selected sample is 'AffableBean Users 1-1'. The second '1' represents the thread (i.e., user) number. When testing multiple threads, you can use View Results Tree listener to pinpoint exactly when each thread makes a request within the test. Finally, in the image above, note that the 'HTML (download embedded resources)' option is selected in the lower left corner. When you select the 'Response data' tab in the right panel, JMeter attempts to render the response as it would display in a browser.
@@ -304,13 +371,21 @@
In the coming steps, we'll add an increasing number of users to the test, and examine the server's overall throughput.
-7. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
+
+[start=7]
+. Click the JMeter Template Plan node, then make the following changes to User Defined Variables:
* *`nb.users`:* `20`
* *`nb.rampup`:* `20`
The `nb.rampup` variable is used in the `AffableBean` `Users` Thread Group panel, and specifies the ramp-up period in seconds. In this case, if we test 20 users and the ramp-up period is 20 seconds, then a new user will begin sending requests every second.
-8. Clear the results from the previous test by choosing Run > Clear All (Ctrl-E; ⌘-E on Mac).
-9. Click the Graph Results node so that you are able to view the test results while the test is running.
-10. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu. When the test plan runs, make the following observations:
+
+[start=8]
+. Clear the results from the previous test by choosing Run > Clear All (Ctrl-E; ⌘-E on Mac).
+
+[start=9]
+. Click the Graph Results node so that you are able to view the test results while the test is running.
+
+[start=10]
+. Run the test plan. Choose Run > Start (Ctrl-R; ⌘-R on Mac) from the main menu. When the test plan runs, make the following observations:
* A green square displays in the upper right corner of the interface, indicating that the test plan is running. Adjacent to the square is a ratio listing the number of active threads against the total number of threads being tested. For example, image::images/jmeter-active-threads.png[] demonstrates that the test is running, and that there are currently 15 active threads of a total of 20. Because of the ramp-up period, you should notice that the number of active threads increases each second to 20, remains at 20 for some time, then gradually decreases to zero, at which the square becomes gray indicating that the test has terminated.
* You can filter the graphs you wish to display by selecting the checkboxes above the graph. For an explanation of Median and Deviation, refer to the link:http://jakarta.apache.org/jmeter/usermanual/glossary.html[+JMeter User's Manual Glossary+]. The image below displays graphs for Average and Throughput only. The metric values provided at the bottom of the graph apply to the most recent sample.
* From the green line designating throughput, we see that the server was able to maintain a nearly consistent value as the load increased to 20 users. Toward the end of the test, as user number decreases, we see that the throughput slightly lessens. We can assume that this is simply due to the fact that there are fewer requests per unit of time.
@@ -384,7 +459,7 @@
|1000 |25 |1966 |190.8/sec |0.00%
|===
- |
+
*Notes and observations:*
@@ -393,7 +468,6 @@
* In all tests, the `Error` `%` column remained at `0.00%`. The server was able to successfully respond to all requests, even when the computer's CPU levels were at a maximum, and JMeter was lagging in its ability to display results. This would indicate that the bottleneck in these tests was the computer's processing resources. (The computer had available memory for all tests.)
* The Average represents the average elapsed time (in milliseconds) for all requests serviced in the test plan. While the average values for the most demanding tests were still under 2 seconds, the Summary Report's Maximum values recorded for elapsed time were much higher, reaching nearly 70 seconds for the `/purchase` request. When determining what resources are required for a normal load, consider that these results do not include network time, and that most users are willing to wait at most 4 - 8 seconds for a response.^<<footnote2,[2]>>^
-|===
If the production server is on a machine that has resources similar to those of your development environment, and assuming your computer is not running other CPU-intensive processes while tests are conducted, you can get a rough idea of how many users can be served by examining your computer's CPU usage during tests. For example, if it has been decided that CPU levels for normal and peak loads will be approximately 30% and 70%, respectively, you can watch the CPU monitor as you increase the number of users with each run of the test plan. The following images suggest 150 users could be served during a normal load, and 400 during a peak load.
@@ -446,19 +520,29 @@
*NetBeans 6.8 note:* The `useCaseTestRandom.jmx` script is not compatible with the JMeter Kit plugin for NetBeans 6.8. Because the script utilizes various logic controllers which unfortunately are not available in JMeter version 2.2, it will not run on the JMeter implementation in NetBeans 6.8. In order to become familiar with the Profiler, use `useCaseTest.jmx` in this exercise instead. If you use `useCaseTest.jmx`, you need to set the load script to run continuously. To do so, open the script in JMeter, select the `AffableBeanUsers` thread group, then in the main panel, select the 'Forever' checkbox for the Loop Count field.
-2. If you are running the Profiler for the first time, you need to perform a calibration step on the JDK. To do so, choose Profile > Advanced Commands > Run Profiler Calibration. For more information, refer to the NetBeans User FAQ wiki: link:http://wiki.netbeans.org/FaqProfilerCalibration[+What exactly does the Profiler Calibration mean?+].
-3. Click the Profile Project ( image::images/profile-btn.png[] ) button. When a project is profiled for the first time, its build script must be modified to enable profiling. The IDE warns you that it will modify the project's build script.
+
+[start=2]
+. If you are running the Profiler for the first time, you need to perform a calibration step on the JDK. To do so, choose Profile > Advanced Commands > Run Profiler Calibration. For more information, refer to the NetBeans User FAQ wiki: link:http://wiki.netbeans.org/FaqProfilerCalibration[+What exactly does the Profiler Calibration mean?+].
+
+[start=3]
+. Click the Profile Project ( image::images/profile-btn.png[] ) button. When a project is profiled for the first time, its build script must be modified to enable profiling. The IDE warns you that it will modify the project's build script.
image::images/enable-profiling.png[title="The project build script must be modified to enable profiling"]
*Note:* You can undo this action at a later point by choosing Profile > Advanced Commands > Unintegrate Profiler from the main menu. Alternatively, you can switch to the Files window, delete your project's `build.xml` file, then rename the `build-before-profiler.xml` file to `build.xml`.
-4. Click OK. The project's build file is modified, and the Profiler window opens for the project. The window enables you to select from one of three profiling tasks:
+
+[start=4]
+. Click OK. The project's build file is modified, and the Profiler window opens for the project. The window enables you to select from one of three profiling tasks:
* *Monitor Application:* Provides obtain high-level information about properties of the target JVM, including thread activity and memory allocations.
* *Analyze Performance:* Provides detailed data on application performance, including the time to execute methods and the number of times the method is invoked.
* *Analyze Memory:* Provides detailed data on object allocation and garbage collection.
-5. Click the Monitor button in the left column. Select the 'LoadGenerator Script' option, then choose `useTestCaseRandom.jmx` from the drop-down list.
+
+[start=5]
+. Click the Monitor button in the left column. Select the 'LoadGenerator Script' option, then choose `useTestCaseRandom.jmx` from the drop-down list.
image::images/monitor-application.png[title="Profiler window opens, enabling task selection and configuration"]
-6. Click Run. The IDE takes the following actions:
+
+[start=6]
+. Click Run. The IDE takes the following actions:
* Starts the GlassFish server in profile mode. (If the server is already running, it is first stopped.)
* Deploys the web application to GlassFish.
* Starts a profiling session, attaches the profiler to the server, and opens the Profiler Control Panel in the IDE.
@@ -467,15 +551,21 @@
*Note:* If the profiler does not run the load script after starting the application in profile mode, you can invoke it yourself. From the Projects window, right-click the script and choose External Edit. Then, in JMeter, press Ctrl-R (⌘-R on Mac) to run the script. If the left-hand graph displayed by the VM Telemetry Overview depicts the purple area as remaining horizontal (shown below), you can be fairly certain that the load script is not running.
image::images/vm-telemetry-overview-heap.png[title="The server is loaded, but the load script is not running"]
-7. In the Profiler Control Panel, click the Threads ( image::images/threads-btn.png[] ) button. The Threads window opens to display all threads maintained by the server while the application is running. You can select Live Threads Only, or Finished Threads Only in drop-down at the top of the window in order to filter the display according to live or finished threads.
+
+[start=7]
+. In the Profiler Control Panel, click the Threads ( image::images/threads-btn.png[] ) button. The Threads window opens to display all threads maintained by the server while the application is running. You can select Live Threads Only, or Finished Threads Only in drop-down at the top of the window in order to filter the display according to live or finished threads.
image::images/live-threads.png[title="View live threads maintained by the server at runtime"]
You can select the Enable Threads Monitoring option in the Profiler window (displayed <<profilerWindow,above>>). This will trigger the Threads window to open by default when running the Profiler.
-8. In the Profiler Control Panel, click the VM Telemetry ( image::images/vm-telemetry-btn.png[] ) button.
+
+[start=8]
+. In the Profiler Control Panel, click the VM Telemetry ( image::images/vm-telemetry-btn.png[] ) button.
Similar to the VM Telemetry Overview, the VM Telemetry window provides views on the JVM heap, garbage collection (GC), as well as threads and loaded classes.
-9. Ensure that the Memory (Heap) tab is selected at the bottom of the window, then allow the Profiler to monitor the heap while the load script runs against the application.
+
+[start=9]
+. Ensure that the Memory (Heap) tab is selected at the bottom of the window, then allow the Profiler to monitor the heap while the load script runs against the application.
You can hover your cursor over the graph to view real-time measurements of the heap size versus the used heap.
image::images/heap-popup.png[title="Hover your cursor over the graph for a real-time display of heap measurements"]
@@ -547,10 +637,10 @@
From link:https://www.sun.com/offers/details/OptimizeGlassFishPerformance.xml[+Optimize GlassFish Performance in a Production Environment+]:
-[quote]
-----
-_The size of the heap is determined by the Java options -Xmx (maximum) and -Xms (minimum). While a larger heap can contain more objects and reduce the frequency of garbage collection, it may result in longer garbage collection times especially for a full GC cycle. The recommendation is to tune the heap based on the size of total available memory in your system, process data model (32-bit or 64-bit) and operating system._
-----
+[NOTE]
+====
+The size of the heap is determined by the Java options -Xmx (maximum) and -Xms (minimum). While a larger heap can contain more objects and reduce the frequency of garbage collection, it may result in longer garbage collection times especially for a full GC cycle. The recommendation is to tune the heap based on the size of total available memory in your system, process data model (32-bit or 64-bit) and operating system.
+====
1. In the Tree which displays in the left column of the Administration Console, expand the Configuration node, then click JVM Settings.
2. In the main panel, select the JVM Options tab.
@@ -569,9 +659,10 @@
From the link:http://docs.sun.com/app/docs/doc/819-3681/abefm[+Sun Java System Application Server 9.1 Performance Tuning Guide+]:
-[quote]
-----
-_The_ [Max Thread Pool Size] _parameter specifies the maximum number of simultaneous requests the server can handle. The default value is 5. When the server has reached the limit or request threads, it defers processing new requests until the number of active requests drops below the maximum amount. Increasing this value will reduce HTTP response latency times.
+[NOTE]
+====
+The [Max Thread Pool Size] parameter specifies the maximum number of simultaneous requests the server can handle. The default value is 5. When the server has reached the limit or request threads, it defers processing new requests until the number of active requests drops below the maximum amount. Increasing this value will reduce HTTP response latency times.
+====
In practice, clients frequently connect to the server and then do not complete their requests. In these cases, the server waits a length of time specified by the Idle Thread Timeout parameter._ [900 seconds, i.e., 15 minutes, is the default entry for GlassFish v3 and Open Source Edition 3.0.1.]
@@ -580,14 +671,20 @@
Adjust the thread count value based on your load and the length of time for an average request. In general, increase this number if you have idle CPU time and requests that are pending; decrease it if the CPU becomes overloaded. If you have many HTTP 1.0 clients (or HTTP 1.1 clients that disconnect frequently), adjust the timeout value to reduce the time a connection is kept open.
Suitable Request Thread Count values range from 100 to 500, depending on the load. If your system has extra CPU cycles, keep incrementally increasing thread count and monitor performance after each incremental increase. When performance saturates (stops improving), then stop increasing thread count._
-----
+
1. In the Administration Console Tree, expand the Configuration node, then click Thread Pools.
The GlassFish server provides two thread pools by default. The `http-thread-pool` thread pool is configured for use by network listeners, while `thread-pool-1` is configured for use by the ORB (object request broker) for RMI/IIOP requests. (A stand-alone web application deployed over a non-distributed environment, such as the `AffableBean` application, relies on the `http-thread-pool` by default.)
-2. Under the Thread Pool ID column, click `http-thread-pool`.
-3. In the *Max Thread Pool Size* field, adjust the maximum number of threads available to the thread pool.
-4. Click the Save button in the upper right corner, and then restart the server.
+
+[start=2]
+. Under the Thread Pool ID column, click `http-thread-pool`.
+
+[start=3]
+. In the *Max Thread Pool Size* field, adjust the maximum number of threads available to the thread pool.
+
+[start=4]
+. Click the Save button in the upper right corner, and then restart the server.
[[tip10]]
@@ -595,10 +692,10 @@
From link:https://www.sun.com/offers/details/OptimizeGlassFishPerformance.xml[+Optimize GlassFish Performance in a Production Environment+]:
-[quote]
-----
-_If your application uses Java DataBase Connectivity (JDBC) software for database access, it may be beneficial to tune your database connection pool. A general rule of thumb is to tune the value for `max-pool-size` and `steady-pool-size` to the same number of HTTP request processing threads. If your JDBC driver supports this feature, it is advisable to use JDBC drivers that use statement caching to re-use prepared statements._
-----
+[NOTE]
+====
+If your application uses Java DataBase Connectivity (JDBC) software for database access, it may be beneficial to tune your database connection pool. A general rule of thumb is to tune the value for `max-pool-size` and `steady-pool-size` to the same number of HTTP request processing threads. If your JDBC driver supports this feature, it is advisable to use JDBC drivers that use statement caching to re-use prepared statements.
+====
1. In the Administration Console Tree, expand the Resources > JDBC > Connection Pools node, then click the `AffableBeanPool` node.
2. In the General tab under Pool Settings, specify values for the following fields:
@@ -607,7 +704,9 @@
* *Pool Resize Quantity:* (`pool-resize-quantity`) Number of connections to be removed when pool idle timeout expires.
* *Idle Timeout:* (`idle-timeout-in-seconds`) Maximum time that connection can remain idle in the pool.
* *Max Wait Time:* (`max-wait-time-in-millis`) Amount of time caller waits before connection timeout is sent.
-3. Click the Save button in the upper right corner, and then restart the server.
+
+[start=3]
+. Click the Save button in the upper right corner, and then restart the server.
Connection pool settings can also be specified in the `sun-resources.xml` descriptor:
@@ -623,6 +722,7 @@
...
</jdbc-connection-pool>
----
+
link:/about/contact_form.html?to=3&subject=Feedback: NetBeans E-commerce Tutorial - Testing and Profiling[+Send Us Your Feedback+]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction.asciidoc
index a5ba188..ff0f497 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, The NetBeans E-commerce Tutorial - Integrating Transactional Business Logic
-==== Tutorial Contents
+== Tutorial Contents
1. link:intro.html[+Introduction+]
2. link:design.html[+Designing the Application+]
@@ -51,10 +51,18 @@
* <<transaction,Setting up the Transaction Programmatically>>
* <<validate,Validating and Converting User Input>>
* <<seeAlso,See Also>>
-10. link:language.html[+Adding Language Support+]
-11. link:security.html[+Securing the Application+]
-12. link:test-profile.html[+Testing and Profiling+]
-13. link:conclusion.html[+Conclusion+]
+
+[start=10]
+. link:language.html[+Adding Language Support+]
+
+[start=11]
+. link:security.html[+Securing the Application+]
+
+[start=12]
+. link:test-profile.html[+Testing and Profiling+]
+
+[start=13]
+. link:conclusion.html[+Conclusion+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -124,11 +132,15 @@
1. Open the link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot7.zip[+project snapshot+] for this tutorial unit in the IDE. Click the Open Project ( image::images/open-project-btn.png[] ) button and use the wizard to navigate to the location on your computer where you downloaded the project. If you are proceeding from the link:manage-sessions.html[+previous tutorial unit+], note that this project snapshot is identical to the state of the project after completing the previous unit, but with the following exceptions:
* The `confirmation.jsp` page is fully implemented.
* The `affablebean.css` stylesheet includes rules specific to the `confirmation.jsp` page implementation.
-2. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
+
+[start=2]
+. Run the project ( image::images/run-project-btn.png[] ) to ensure that it is properly configured with your database and application server.
If you receive an error when running the project, revisit the link:setup.html[+setup instructions+], which describe how to prepare the database and establish connectivity between the IDE, GlassFish, and MySQL.
-3. Test the application's functionality in your browser. In particular, step through the entire link:design.html#business[+business process flow+]. When you click the submit an order from the checkout page, the confirmation page currently displays as follows:
+
+[start=3]
+. Test the application's functionality in your browser. In particular, step through the entire link:design.html#business[+business process flow+]. When you click the submit an order from the checkout page, the confirmation page currently displays as follows:
image::images/confirmation-page-start.png[title="Confirmation page displays without any data relating to the processed order"]
No data related to the order is displayed on the confirmation page. In fact, in its current state the application doesn't do anything with the data from the checkout form. By the end of this tutorial unit, the application will gather customer data and use it to process an order. In its final state, the application will display a summary of the processed order on the confirmation page, remove the user's `ShoppingCart` and terminate the user session. (link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot8.zip[+Snapshot 8+] completes the request-response cycle when a checkout form is submitted.)
@@ -140,7 +152,9 @@
1. Click the New File ( image::images/new-file-btn.png[] ) button in the IDE's toolbar. (Alternatively, press Ctrl-N; ⌘-N on Mac.) In the New File wizard, select the Java EE category, then select Session Bean.
2. Click Next. Name the EJB '`OrderManager`', place the EJB in the `session` package, and accept other default settings. (Create a stateless session bean, and do not have the wizard generate an interface for the bean.)
image::images/ejb-wizard.png[title="Create a stateless EJB session bean using the Session Bean wizard"]
-3. Click Finish. The new `OrderManager` class is generated and opens in the editor.
+
+[start=3]
+. Click Finish. The new `OrderManager` class is generated and opens in the editor.
@@ -153,7 +167,9 @@
Press Ctrl-G to use the Go To Line dialog.
image::images/go-to-line.png[title="Use the Go to Line dialog to quickly navigate to a specific line"]
-3. Implement code that extracts the parameters from a submitted checkout form. Locate the `TODO: Implement purchase action` comment, delete it, and add the following:
+
+[start=3]
+. Implement code that extracts the parameters from a submitted checkout form. Locate the `TODO: Implement purchase action` comment, delete it, and add the following:
[source,java]
----
@@ -199,8 +215,12 @@
*@EJB
private OrderManager orderManager;*
----
-2. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to allow the editor to add an import statement for `session.OrderManager`.
-3. Use the extracted parameters, as well as the session `cart` object, as arguments for the `OrderManager.placeOrder` method. Add the following code:
+
+[start=2]
+. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to allow the editor to add an import statement for `session.OrderManager`.
+
+[start=3]
+. Use the extracted parameters, as well as the session `cart` object, as arguments for the `OrderManager.placeOrder` method. Add the following code:
[source,java]
----
@@ -229,7 +249,9 @@
--
image::images/tool-tip-create-method.png[role="left", link="images/tool-tip-create-method.png"]
--
-4. Click the tip. The IDE generates the `placeOrder` method in the `OrderManager` class.
+
+[start=4]
+. Click the tip. The IDE generates the `placeOrder` method in the `OrderManager` class.
[source,java]
----
@@ -245,7 +267,9 @@
}
----
The import statement for `cart.ShoppingCart` is also automatically inserted at the top of the file.
-5. In the new `placeOrder` method, use the method arguments to make calls to the (yet nonexistent) helper methods. Enter the following:
+
+[start=5]
+. In the new `placeOrder` method, use the method arguments to make calls to the (yet nonexistent) helper methods. Enter the following:
[source,java]
----
@@ -258,8 +282,12 @@
}
----
Note that we need to follow a particular order due to database constraints. For example, a `Customer` record needs to be created before the `CustomerOrder` record, since the `CustomerOrder` requires a reference to a `Customer`. Likewise, the `OrderedItem` records require a reference to an existing `CustomerOrder`.
-6. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `entity.Customer` and `entity.CustomerOrder` are automatically added to the top of the file.
-7. Use the editor hints to have the IDE generate method signatures for `addCustomer`, `addOrder`, and `addOrderedItems`. After utilizing the three hints, the `OrderManager` class looks as follows.
+
+[start=6]
+. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `entity.Customer` and `entity.CustomerOrder` are automatically added to the top of the file.
+
+[start=7]
+. Use the editor hints to have the IDE generate method signatures for `addCustomer`, `addOrder`, and `addOrderedItems`. After utilizing the three hints, the `OrderManager` class looks as follows.
[source,java]
----
@@ -289,7 +317,9 @@
}
----
Note that an error is still flagged in the editor, due to the fact that the method is currently lacking a return statement. The `placeOrder` signature indicates that the method returns an `int`. As will later be demonstrated, the method returns the order ID if it has been successfully processed, otherwise `0` is returned.
-8. Enter the following return statement.
+
+[start=8]
+. Enter the following return statement.
[source,java]
----
@@ -303,10 +333,12 @@
}
----
At this stage, all errors in the `OrderManager` class are resolved.
-9. Begin implementing the three helper methods. For now, simply add code that applies each method's input parameters to create new entity objects.
+
+[start=9]
+. Begin implementing the three helper methods. For now, simply add code that applies each method's input parameters to create new entity objects.
-==== addCustomer
+=== addCustomer
Create a new `Customer` object and return the object.
@@ -384,9 +416,13 @@
}*
}
----
-10. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. A dialog opens to display all classes that will be imported. Note that the dialog correctly guesses for `java.util.List`.
+
+[start=10]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) to fix imports. A dialog opens to display all classes that will be imported. Note that the dialog correctly guesses for `java.util.List`.
image::images/fix-all-imports.png[title="Press Ctrl-Shift-I to fix imports in a file"]
-11. Click OK. All necessary import statements are added, and the class becomes free of any compiler errors.
+
+[start=11]
+. Click OK. All necessary import statements are added, and the class becomes free of any compiler errors.
@@ -435,11 +471,15 @@
...
}
----
-2. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `javax.persistence.EntityManager` and `javax.persistence.PersistenceContext` are added to the top of the class.
-3. Use the `EntityManager` to mark entity objects to be written to the database. This is accomplished using the `persist` method in the `EntityManager` API. Make the following modifications to the helper methods.
+
+[start=2]
+. Press Ctrl-Shift-I (⌘:-Shift-I on Mac) to fix imports. Import statements for `javax.persistence.EntityManager` and `javax.persistence.PersistenceContext` are added to the top of the class.
+
+[start=3]
+. Use the `EntityManager` to mark entity objects to be written to the database. This is accomplished using the `persist` method in the `EntityManager` API. Make the following modifications to the helper methods.
-==== addCustomer
+=== addCustomer
[source,java]
@@ -461,7 +501,7 @@
----
-==== addOrder
+=== addOrder
[source,java]
@@ -485,7 +525,7 @@
----
-==== addOrderedItems
+=== addOrderedItems
[source,java]
@@ -537,9 +577,13 @@
In the coming steps, you are going to examine the server log in the IDE's Output window. Before submitting the checkout form, open the Output window and clear the server log. You can accomplish this by right-clicking in the server log and choosing Clear (Ctrl-L; ⌘-L on Mac).
-3. Click the 'submit purchase' button. The server responds with an HTTP status 500 message.
+
+[start=3]
+. Click the 'submit purchase' button. The server responds with an HTTP status 500 message.
image::images/gf-error-report.png[title="Server responds with an HTTP status 500 message"]
-4. Switch to the IDE and examine the server log. The server log is located in the Output window (Ctrl-4; ⌘-4 on Mac) under the GlassFish server tab. You come across the following text.
+
+[start=4]
+. Switch to the IDE and examine the server log. The server log is located in the Output window (Ctrl-4; ⌘-4 on Mac) under the GlassFish server tab. You come across the following text.
[source,java]
----
@@ -556,10 +600,14 @@
Maximize the Output window by pressing Shift-Esc.
The underlines displayed in the server log form links allowing you to navigate directly to the lines in your source files where errors are occurring.
-5. Click the link to `session.OrderManager.addOrderedItems`. The editor displays the line that is causing the exception.
+
+[start=5]
+. Click the link to `session.OrderManager.addOrderedItems`. The editor displays the line that is causing the exception.
image::images/null-pointer-exception.png[title="Click links in server output window to navigate directly to offending lines in source files"]
To understand why `order.getId` method returns `null`, consider what the code is actually trying to accomplish. The `getId` method attempts to get the ID of an order which is currently in the process of being created. Since the ID is an auto-incrementing primary key, the database automatically generates the value only when the record is added. One way to overcome this is to manually synchronize the persistence context with the database. This can be accomplished using the `EntityManager`'s link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html#flush%28%29[+`flush`+] method.
-6. In the `addOrderedItems` method, add a call to flush the persistence context to the database.
+
+[start=6]
+. In the `addOrderedItems` method, add a call to flush the persistence context to the database.
[source,java]
----
@@ -590,9 +638,15 @@
}
}
----
-7. Rerun the project and step through the business process flow. This time, when you submit the checkout form the confirmation page displays.
-8. To confirm that the details have been recorded in the database, open the IDE's Services window (Ctrl-5; ⌘-5 on Mac). Locate the `affablebean` connection node. If the node appears broken ( image::images/connection-broken.png[] ), right-click the node and choose Connect.
-9. Drill into the connection and locate the `affablebean` database's `customer` table. Right-click the table and choose View Data. A graphical display of the `customer` table appears in the editor. The customer details that you added in the checkout form display as a record in the table.
+
+[start=7]
+. Rerun the project and step through the business process flow. This time, when you submit the checkout form the confirmation page displays.
+
+[start=8]
+. To confirm that the details have been recorded in the database, open the IDE's Services window (Ctrl-5; ⌘-5 on Mac). Locate the `affablebean` connection node. If the node appears broken ( image::images/connection-broken.png[] ), right-click the node and choose Connect.
+
+[start=9]
+. Drill into the connection and locate the `affablebean` database's `customer` table. Right-click the table and choose View Data. A graphical display of the `customer` table appears in the editor. The customer details that you added in the checkout form display as a record in the table.
image::images/customer-record.png[title="View Data menu option performs a 'select *' query on the selected table"]
In this manner, you can also examine the `customer_order` and `ordered_product` tables to determine whether data has been recorded.
@@ -625,7 +679,9 @@
According to the link:http://jcp.org/aboutJava/communityprocess/final/jsr318/index.html[+EJB Specification+], container-managed transactions are enabled by default for session beans. Furthermore, if you examine the Javadoc for both of the above annotations, you will rightly point out that `CONTAINER` is the default `TransactionManagementType`, and `REQUIRED` is the default `TransactionAttributeType`. In other words, neither of the two annotations is required for your code to run properly. However, it is often helpful to explicitly include default settings in your sources to improve readability.
-2. Currently, the `placeOrder` method returns the ID of the processed order. In the event that the transaction fails and the order isn't processed, have the method return '`0`'. Use a `try-catch` expression.
+
+[start=2]
+. Currently, the `placeOrder` method returns the ID of the processed order. In the event that the transaction fails and the order isn't processed, have the method return '`0`'. Use a `try-catch` expression.
[source,java]
----
@@ -693,7 +749,9 @@
If you'd like to see more templates, consult the Keyboard Shortcuts Card. The Keyboard Shortcuts Card provides a list of commonly-used code templates and keyboard shortcuts. Choose Help > Keyboard Shortcuts Card from the main menu.
-3. Add the following code. Explanation follows.
+
+[start=3]
+. Add the following code. Explanation follows.
[source,java]
----
@@ -722,7 +780,9 @@
You can test this by commenting out the `em.flush()` line you previously added. This way, you know that the first two methods (`addCustomer` and `addOrder`) process successfully, but the third method (`addOrderedItems`) fails. Run the project and submit the checkout form in the browser. Since the transaction doesn't roll back, the customer and order records are written to the database, but any ordered items are not. This leads to a situation where the database is corrupt.
To overcome this, you explicitly set the transaction for rollback in the `catch` clause. The above `@Resource` annotation is applied to grab an instance of the EJB's current `SessionContext`. The transaction is marked for rollback using the `setRollbackOnly` method.
-4. Run the project and step through the business process flow. When you submit an order, return to the IDE and examine the server log. You'll see output similar to the following:
+
+[start=4]
+. Run the project and step through the business process flow. When you submit an order, return to the IDE and examine the server log. You'll see output similar to the following:
[.feature]
--
image::images/transaction-output.png[role="left", link="images/transaction-output.png"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction_ja.asciidoc
index 79965d1..8442483 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/ecommerce/transaction_ja.asciidoc
@@ -30,7 +30,7 @@
:keywords: Apache NetBeans, Tutorials, NetBeans Eコマース チュートリアル-トランザクションビジネスロジックの統合
-==== チュートリアルの内容
+== チュートリアルの内容
1. link:intro_ja.html[+はじめに+]
2. link:design_ja.html[+アプリケーションの設計+]
@@ -51,10 +51,18 @@
* <<transaction,トランザクションプログラムをセットアップする>>
* <<validate,ユーザー入力を検証する>>
* <<seeAlso,関連参照>>
-10. link:language_ja.html[+言語サポートの追加+]
-11. link:security.html[+アプリケーションの保護+]
-12. link:test-profile.html[+アプリケーションの負荷テスト+]
-13. link:conclusion_ja.html[+まとめ+]
+
+[start=10]
+. link:language_ja.html[+言語サポートの追加+]
+
+[start=11]
+. link:security.html[+アプリケーションの保護+]
+
+[start=12]
+. link:test-profile.html[+アプリケーションの負荷テスト+]
+
+[start=13]
+. link:conclusion_ja.html[+まとめ+]
image::../../../../images_www/articles/68/netbeans-stamp-68-69.png[title="Content on this page applies to NetBeans IDE, versions 6.8 and 6.9"]
@@ -140,11 +148,15 @@
* `affablebean.css` スタイルシートに `confirmation.jsp` ページを実装するための特有のルールが入っています。
-2. プロジェクトを実行 ( image::images/run-project-btn.png[] )し、データベースとアプリケーションサーバを適切に構成していることを確認してください。
+
+[start=2]
+. プロジェクトを実行 ( image::images/run-project-btn.png[] )し、データベースとアプリケーションサーバを適切に構成していることを確認してください。
プロジェクトを実行した時、エラーを受け取った場合は、link:setup.html[+セットアップ手順+]を再び見ます。そこに「データベースを準備して、IDE、GlassFish 、MySQL 間の接続を確立する方法」が書かれています。
-3. ブラウザでアプリケーションの機能をテストします。具体的には、全ての link:design.html#business[+ ビジネスプロセスフロー+] をステップ実行します。チェックアウトのページから [ submit an order(注文を送信する) ] をクリックすると、現在の確認ページが以下のように表示されます:
+
+[start=3]
+. ブラウザでアプリケーションの機能をテストします。具体的には、全ての link:design.html#business[+ ビジネスプロセスフロー+] をステップ実行します。チェックアウトのページから [ submit an order(注文を送信する) ] をクリックすると、現在の確認ページが以下のように表示されます:
image::images/confirmation-page-start.png[title="Confirmation page displays without any data relating to the processed order"]
@@ -157,11 +169,15 @@
1. IDE ツールバーの [ New File(新規ファイル)] ( image::images/new-file-btn.png[] ) ボタンをクリックします。(または Ctrl - n を押す、⌘ - n Mac)。[New File(新規ファイル)] のウィザードで、[ Java EE カテゴリ] を選択し、次に [Session BeanセッションBean] を選択します。
-2. [次へ]をクリック。[EJB Name]に [ `OrderManager` ] と入れ、Package(パッケージ) に [`session` (セッション)] をセット、他のデフォルト設定を受け入れます。 (ステートレスセッションBeanを作成します。ウィザードは Bean のインターフェイスを生成しません。 )
+
+[start=2]
+. [次へ]をクリック。[EJB Name]に [ `OrderManager` ] と入れ、Package(パッケージ) に [`session` (セッション)] をセット、他のデフォルト設定を受け入れます。 (ステートレスセッションBeanを作成します。ウィザードは Bean のインターフェイスを生成しません。 )
image::images/ejb-wizard.png[title="Create a stateless EJB session bean using the Session Bean wizard"]
-3. [Finish] をクリックします。新しい `OrderManager` クラスが生成され、エディタに開きます。
+
+[start=3]
+. [Finish] をクリックします。新しい `OrderManager` クラスが生成され、エディタに開きます。
@@ -170,13 +186,17 @@
1. プロジェクトの `ControllerServlet` を開きます。(プロジェクトウィンドウで ControllerServlet を選ぶか、またはAlt - Shift - O(Ctrl - Shift - O Mac)を押し [Go to File] ダイアログを使います。)
-2. `/purchase`リクエストが実装されいる doPost メソッド内のエリアに行きます(190行目)。
+
+[start=2]
+. `/purchase`リクエストが実装されいる doPost メソッド内のエリアに行きます(190行目)。
Ctrl - G を押し、[Go To Line] ダイアログを使用します。
image::images/go-to-line.png[title="Use the Go to Line dialog to quickly navigate to a specific line"]
-3. 送信されたチェックアウトフォームからパラメータを抽出するコードを実装します。「`TODO: Implement purchase action`」コメントを探し、それを削除し、以下を追加します:
+
+[start=3]
+. 送信されたチェックアウトフォームからパラメータを抽出するコードを実装します。「`TODO: Implement purchase action`」コメントを探し、それを削除し、以下を追加します:
[source,java]
@@ -225,9 +245,13 @@
private OrderManager orderManager;*
----
-2. Ctrl - Shift - I (⌘:- Shift Mac)を押し、エディタが `session.OrderManager` にインポート文を追加できるようにします。
-3. 抽出されたパラメータとセッション `cart` オブジェクトも同様に、`OrderManager.placeOrder` メソッドの引数として使います。次のコードを追加します:
+[start=2]
+. Ctrl - Shift - I (⌘:- Shift Mac)を押し、エディタが `session.OrderManager` にインポート文を追加できるようにします。
+
+
+[start=3]
+. 抽出されたパラメータとセッション `cart` オブジェクトも同様に、`OrderManager.placeOrder` メソッドの引数として使います。次のコードを追加します:
[source,java]
@@ -259,7 +283,9 @@
image::images/tool-tip-create-method.png[role="left", link="images/tool-tip-create-method.png"]
--
-4. [ tip ] をクリックします。 IDE は `placeOrder` メソッド を `OrderManager` クラスの中に 生成します。
+
+[start=4]
+. [ tip ] をクリックします。 IDE は `placeOrder` メソッド を `OrderManager` クラスの中に 生成します。
[source,java]
@@ -277,7 +303,9 @@
----
`cart.ShoppingCart` の import 文も同様に自動的にファイルの先頭に挿入されます。
-5. 新しい `placeOrder` メソッドで、メソッドの引数を使用して、 ヘルパーメソッド(まだ存在しない)への呼び出しを行います。次のように入力してください:
+
+[start=5]
+. 新しい `placeOrder` メソッドで、メソッドの引数を使用して、 ヘルパーメソッド(まだ存在しない)への呼び出しを行います。次のように入力してください:
[source,java]
@@ -293,9 +321,13 @@
私たちは、データベースの制約のために特定の順序に従う必要があります。たとえば、 `Customer` レコードは、`CustomerOrder` の前に作成される必要があります。というのは、`CustomerOrder` は `Customer`を参照する必要があるからです。同様に `OrderedItem` レコードは既にある `CustomerOrder` への参照を必要とします。
-6. Ctrl-Shift-I (⌘-Shift Macの場合)を押して、import を固定します。 `entity.Customer` と `entity.CustomerOrder` のインポート文が、自動的にファイルの先頭に追加されます。
-7. エディターのヒントを使い、`addCustomer`, `addOrder`, と `addOrderedItems` 用のメソッドシグニチャをIDEに生成させます。3つのヒントを利用した後の、`OrderManager` クラスは以下のようになります。
+[start=6]
+. Ctrl-Shift-I (⌘-Shift Macの場合)を押して、import を固定します。 `entity.Customer` と `entity.CustomerOrder` のインポート文が、自動的にファイルの先頭に追加されます。
+
+
+[start=7]
+. エディターのヒントを使い、`addCustomer`, `addOrder`, と `addOrderedItems` 用のメソッドシグニチャをIDEに生成させます。3つのヒントを利用した後の、`OrderManager` クラスは以下のようになります。
[source,java]
@@ -328,7 +360,9 @@
ここで留意すべきは、まだエディタにエラーフラグが立っていることです。そのメソッドに現在 return 文がないという事実によります。`placeOrder` シグニチャは、「そのメソッドは `int` を返す」ように指示しています。あとでデモしますが、それが成功裏に処理されると、そのメソッドは order ID を返します。それ以外の場合は、 `0` が返されます。
-8. 次の return 文を入力します。
+
+[start=8]
+. 次の return 文を入力します。
[source,java]
@@ -345,10 +379,12 @@
この段階で、`OrderManager` クラスのエラー はすべて解決されます。
-9. 3つのヘルパーメソッドの実装から始めます。今のところ、各メソッドの入力パラメータに新しいエンティティオブジェクトを生成させるコードを単に追加するだけです。
+
+[start=9]
+. 3つのヘルパーメソッドの実装から始めます。今のところ、各メソッドの入力パラメータに新しいエンティティオブジェクトを生成させるコードを単に追加するだけです。
-==== addCustomer
+=== addCustomer
新しい `Customer` オブジェクトを作成しそのオブジェクトを返します。
@@ -372,7 +408,7 @@
-==== addOrder
+=== addOrder
新しい `CustomerOrder` オブジェクトを作成しそのオブジェクトを返します。 `java.util.Random` クラスを使いランダムな confirmation(確認)番号を生成します。
@@ -398,7 +434,7 @@
-==== addOrderedItems
+=== addOrderedItems
`ShoppingCart` を反復処理して、`OrderedProduct` を作成します。 `OrderedProduct` を生成するために、あなたは `OrderedProductPK` エンティティクラス使用することができます。インスタンス化した `OrderedProductPK` は、`OrderedProduct` コンストラクタに渡すことができます は、デモを以下に示します。
@@ -429,11 +465,15 @@
}
----
-10. Ctrl-Shift-I(⌘-Shift Macの場合)を押して、importを固定します。ダイアログが開き、インポートされるすべてのクラスを表示します。ダイアログに`java.util.List` が正しく示されていることに注意してください。
+
+[start=10]
+. Ctrl-Shift-I(⌘-Shift Macの場合)を押して、importを固定します。ダイアログが開き、インポートされるすべてのクラスを表示します。ダイアログに`java.util.List` が正しく示されていることに注意してください。
image::images/fix-all-imports.png[title="Press Ctrl-Shift-I to fix imports in a file"]
-11. [ OK ]をクリックします。必要なすべてのインポート文が追加され、そのクラスのコンパイラエラーがなくなります。
+
+[start=11]
+. [ OK ]をクリックします。必要なすべてのインポート文が追加され、そのクラスのコンパイラエラーがなくなります。
@@ -484,12 +524,16 @@
}
----
-2. Ctrl-Shift-I(⌘:-Shift-I Macの場合)を押して、import を固定します。 `javax.persistence.EntityManager` と `javax.persistence.PersistenceContext` 用のインポート文がそのクラスの先頭に追加されます。
-3. `EntityManager` を使用して、 データベースに書き込まれるエンティティオブジェクトをマークします。これは、 `EntityManager` API の `persist` メソッドを使用して達成されます。ヘルパーメソッドに次の変更をします。
+[start=2]
+. Ctrl-Shift-I(⌘:-Shift-I Macの場合)を押して、import を固定します。 `javax.persistence.EntityManager` と `javax.persistence.PersistenceContext` 用のインポート文がそのクラスの先頭に追加されます。
-==== addCustomer
+[start=3]
+. `EntityManager` を使用して、 データベースに書き込まれるエンティティオブジェクトをマークします。これは、 `EntityManager` API の `persist` メソッドを使用して達成されます。ヘルパーメソッドに次の変更をします。
+
+
+=== addCustomer
[source,java]
@@ -511,7 +555,7 @@
----
-==== addOrder
+=== addOrder
[source,java]
@@ -535,7 +579,7 @@
----
-==== addOrderedItems
+=== addOrderedItems
[source,java]
@@ -578,7 +622,9 @@
1. F6 キーを押し( fn-F6 Macの場合)、プロジェクトを実行します。
-2. link:design.html#business[+ビジネスプロセスフロー+]をステップ実行します。チェックアウトのページに到着する時に書き込み動作が実行されるてもSQLエラーを起こさないとあなたが知っているデータを確実に入力してください。(検証は後の単元で説明します。 )たとえば、チェックアウトのフォームに次のように入力してください:
+
+[start=2]
+. link:design.html#business[+ビジネスプロセスフロー+]をステップ実行します。チェックアウトのページに到着する時に書き込み動作が実行されるてもSQLエラーを起こさないとあなたが知っているデータを確実に入力してください。(検証は後の単元で説明します。 )たとえば、チェックアウトのフォームに次のように入力してください:
* *name:* `Hugo Reyes`
@@ -594,11 +640,15 @@
以後の手順では、IDE の出力ウィンドウのサーバーログを調べます。チェックアウトフォームを送信する前に、出力ウィンドウを開いてサーバーのログをクリアします。あなたはサーバーログを右クリックして[ Clear クリア] (Ctrl-L; ⌘-L Mac)を選択することでできます。
-3. ['submit purchase' (購入送信)] ボタンををクリックします。サーバーは HTTP ステータス500 メッセージを返します。
+
+[start=3]
+. ['submit purchase' (購入送信)] ボタンををクリックします。サーバーは HTTP ステータス500 メッセージを返します。
image::images/gf-error-report.png[title="Server responds with an HTTP status 500 message"]
-4. DEにスイッチして、サーバーログを調べます。サーバーログは、[ GlassFish サーバー]タブの下の[Output(出力)ウィンドウ](Ctrl-4 、⌘-4 Macの場合)にあります。あなたは次のテキストを見つけます。
+
+[start=4]
+. DEにスイッチして、サーバーログを調べます。サーバーログは、[ GlassFish サーバー]タブの下の[Output(出力)ウィンドウ](Ctrl-4 、⌘-4 Macの場合)にあります。あなたは次のテキストを見つけます。
[source,java]
@@ -617,13 +667,17 @@
サーバーログに表示された下線は、エラーが発生したソースファイルの該当行への直接リンクです。
-5. `session.OrderManager.addOrderedItems` リンクをクリックします。エディタは例外を引き起こしている行を表示します。
+
+[start=5]
+. `session.OrderManager.addOrderedItems` リンクをクリックします。エディタは例外を引き起こしている行を表示します。
image::images/null-pointer-exception.png[title="Click links in server output window to navigate directly to offending lines in source files"]
なぜ、`order.getId` メソッドが`null`を返したかを理解するために、どのようなコードが実際に実行されようとしているか考えてみましょう。 `getId` メソッドは、生成されたプロセスに現在存在する order の ID 取得を試みます。IDは自動でインクリメントされる主キーなので、データベースは、レコードが追加された時のみ自動的に値を生成します。これを行うもう一つの方法は、手動で永続コンテキストとデータベースとを同期させることです。これは `EntityManager` の link:http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html#flush%28%29[+`flush`+] メソッドを使用して行うことができます。
-6. `addOrderedItems` メソッドで、flush を呼び出して、データベースに永続化コンテキストを追加します。
+
+[start=6]
+. `addOrderedItems` メソッドで、flush を呼び出して、データベースに永続化コンテキストを追加します。
[source,java]
@@ -656,11 +710,17 @@
}
----
-7. プロジェクトに戻り、ビジネスプロセスの流れをステップ実行します。今回は、チェックアウトフォームを送信したとき、確認ページが表示されます。
-8. データベースに記録されている詳細を確認するために、IDE の [サービス] ウィンドウを開きます。(Ctrl-5; ⌘-5 Macの場合) 。[ `affablebean` ] 接続ノードに行きます。もしノードが壊れて ( image::images/connection-broken.png[] )表示される場合、ノードを右クリックし、[ Connect (接続)] を選択します。
+[start=7]
+. プロジェクトに戻り、ビジネスプロセスの流れをステップ実行します。今回は、チェックアウトフォームを送信したとき、確認ページが表示されます。
-9. connection を展開します。そして `affablebean` データベースの `customer` テーブルに行きます。テーブルを右クリックし、[ View Data(データを表示)] を選択します。`customer`(顧客) テーブルがエディターにグラフィック表示されます。チェックアウトフォームに追加された customer(顧客)の詳細がテーブル内のレコードとして表示されます。
+
+[start=8]
+. データベースに記録されている詳細を確認するために、IDE の [サービス] ウィンドウを開きます。(Ctrl-5; ⌘-5 Macの場合) 。[ `affablebean` ] 接続ノードに行きます。もしノードが壊れて ( image::images/connection-broken.png[] )表示される場合、ノードを右クリックし、[ Connect (接続)] を選択します。
+
+
+[start=9]
+. connection を展開します。そして `affablebean` データベースの `customer` テーブルに行きます。テーブルを右クリックし、[ View Data(データを表示)] を選択します。`customer`(顧客) テーブルがエディターにグラフィック表示されます。チェックアウトフォームに追加された customer(顧客)の詳細がテーブル内のレコードとして表示されます。
image::images/customer-record.png[title="View Data menu option performs a 'select *' query on the selected table"]
@@ -696,7 +756,9 @@
link:http://jcp.org/aboutJava/communityprocess/final/jsr318/index.html[+EJB 仕様+]によると、 コンテナ管理トランザクションは、セッションBeanではデフォルトで有効になっています。さらに、あなたは上記の二つのアノテーションの Javadoc を調べると、`CONTAINER` はデフォルトの `TransactionManagementType` であり、および `REQUIRED` はデフォルトの `TransactionAttributeType` であるとあなたは正しく指摘するかもしれません。言い換えれば、2つのアノテーションのどちらもあなたのコードを正常に実行するためには必要ではありません。しかしながら、しばしば明示的にソースにデフォルト設定を入れることは読みやすさを向上させるために有用です。
-2. 現在、 `placeOrder` メソッドは処理した order の ID を返します。トランザクションが失敗し、注文が処理できない場合、メソッドは '`0`' を返します。`try-catch` 句を使用します。
+
+[start=2]
+. 現在、 `placeOrder` メソッドは処理した order の ID を返します。トランザクションが失敗し、注文が処理できない場合、メソッドは '`0`' を返します。`try-catch` 句を使用します。
[source,java]
@@ -765,7 +827,9 @@
もっと多くのテンプレートを見たいならば、キーボードショートカットカードを参照してください。キーボードショートカットカードは一般的に使用されるコードテンプレートのリストとキーボードショートカットを提供します。メインメニューから、[ Help (ヘルプ)] > [ Keyboard Shortcuts Card (キーボードショートカットカード)] を選択します。
-3. 次のコードを追加します。説明は後に示します。
+
+[start=3]
+. 次のコードを追加します。説明は後に示します。
[source,java]
@@ -796,7 +860,9 @@
この問題を解決するために、あなたは `catch` 句の中にロールバック用のトランザクションを明示的に設定します 。上記の `@Resource` 注釈は、EJBの現在の `SessionContext` のインスタンスをつかむために適用されます。`setRollbackOnly` メソッドを使用して、トランザクションがロールバックするようにマークします。
-4. プロジェクトを実行し、ビジネスプロセスフローをステップ実行します。order(注文)を送信したときに、IDE に戻りサーバーのログを調べます。出力が次のように表示されています:
+
+[start=4]
+. プロジェクトを実行し、ビジネスプロセスフローをステップ実行します。order(注文)を送信したときに、IDE に戻りサーバーのログを調べます。出力が次のように表示されています:
[.feature]
--
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient.asciidoc
index dd8ade1..6e3e117 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient.asciidoc
@@ -144,7 +144,7 @@
}
----
-[start=4]
+
. Save your changes.
You now have an enterprise application with a simple EJB that is exposed through a remote interface. You also have an independent class library that contains the EJB interface that can be distributed to other developers. Developers can add the library to their projects if they want to communicate with the EJB that is exposed by the remote interface and do not need to have the sources for the EJB. When you modify the code for the EJB, you only need to distribute a JAR of the updated class library if any of the interfaces change.
@@ -212,7 +212,7 @@
The IDE also automatically adds EJBRemoteInterface as a project Library.
-[start=4]
+
. Modify the ``main`` method to retrieve the String of the ``getResult`` method via the MySessionRemote interface. Save your changes.
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ja.asciidoc
index 7c78b70..12fe26d 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ja.asciidoc
@@ -144,7 +144,7 @@
}
----
-[start=4]
+
. 変更を保存します。
これで、リモート・インタフェースを介して公開される単純なEJBを含むエンタープライズ・アプリケーションができました。また、他の開発者に配布できるEJBインタフェースを含む独立したクラス・ライブラリもできました。開発者は、リモート・インタフェースによって公開されるEJBとやり取りする場合にはこのライブラリを自分のプロジェクトに追加でき、EJBのソースを持つ必要はありません。EJBのコードを変更したときは、インタフェースのいずれかを変更した場合に更新されたクラス・ライブラリのJARを配布するのみで済みます。
@@ -212,7 +212,7 @@
また、IDEによってEJBRemoteInterfaceがプロジェクト・ライブラリとして自動的に追加されます。
-[start=4]
+
. MySessionRemoteインタフェースを経由して ``getResult`` メソッドの文字列を取得するように ``main`` メソッドを変更します。変更を保存します。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_pt_BR.asciidoc
index dc867b6..5e6d0ea 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_pt_BR.asciidoc
@@ -144,7 +144,7 @@
}
----
-[start=4]
+
. Salve as alterações.
Agora você tem uma aplicação corporativa com um EJB simples que é exposto por meio de uma interface remota. Você também tem uma biblioteca de classe independente que contém a interface EJB que pode ser distribuída para outros desenvolvedores. Os desenvolvedores podem adicionar a biblioteca em seus projetos, caso desejem se comunicar com o EJB que é exposto pela interface remota e não precisam ter o código-fonte para o EJB. Quando você modifica o código para o EJB, somente precisa distribuir um JAR da biblioteca de classe atualizada, caso alguma das interfaces seja modificada.
@@ -212,7 +212,7 @@
O IDE também adiciona automaticamente a EJBRemoteInterface como uma Biblioteca do projeto.
-[start=4]
+
. Modifique o método ``main`` para recuperar a String do método ``getResult`` por meio da interface MySessionRemote. Salve as alterações.
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ru.asciidoc
index e170d94..9eb2202 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_ru.asciidoc
@@ -144,7 +144,7 @@
}
----
-[start=4]
+
. Сохраните изменения.
Теперь у нас есть корпоративное приложение с простым компонентом EJB, предоставляемым через удаленный интерфейс. У нас также имеется независимая библиотека классов, содержащая интерфейс EJB, которую можно разослать другим разработчикам. Разработчики могут добавлять библиотеку к своим проектам, если им нужна связь с EJB, предоставляемым через удаленный интерфейс, но не нужны исходные коды для EJB. При изменении кода для EJB достаточно распространить JAR обновленной библиотеки классов, если изменения затронули любой из интерфейсов.
@@ -212,7 +212,7 @@
Среда IDE также автоматически добавит EJBRemoteInterface как библиотеку проекта.
-[start=4]
+
. Измените ``главный`` метод извлечения строки метода ``getResult`` посредством интерфейса MySessionRemote. Сохраните изменения.
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_zh_CN.asciidoc
index 0fc5b3e..c51808a 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/entappclient_zh_CN.asciidoc
@@ -144,7 +144,7 @@
}
----
-[start=4]
+
. 保存所做的更改。
现在,您已创建了一个企业应用程序,其中包含通过远程接口公开的简单 EJB。您还创建了一个独立类库,其中包含可分发给其他开发者的 EJB 接口。如果开发者要与远程接口公开的 EJB 进行通信,并且不需要具有 EJB 源代码,则可以在项目中添加该库。在修改 EJB 的代码时,如果任何接口发生变化,您只需要分发更新的类库的 JAR。
@@ -212,7 +212,7 @@
IDE 还将自动添加 EJBRemoteInterface 作为项目库。
-[start=4]
+
. 修改 ``main`` 方法,以便通过 MySessionRemote 接口检索 ``getResult`` 方法的字符串。保存所做的更改。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb.asciidoc
index 07174e9..00ce76c 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb.asciidoc
@@ -104,10 +104,10 @@
(For this tutorial there is little reason to copy project libraries to a dedicated folder because you will not need to share libraries with other users or projects.)
Click Next.
-[start=5]
+
. Set the server to GlassFish Server and set the Java EE Version to Java EE 6 or Java EE 7.
-[start=6]
+
. Select Create EJB Module and Create Web Application Module. Click Finish.
image::images/new-entapp-wizard.png[title="New Project wizard"]
@@ -146,7 +146,7 @@
image::images/new-pu-wizard.png[title="Provider and Database panel"]
-[start=11]
+
. Click Finish.
When you click Finish, the IDE creates ``persistence.xml`` and the entity class ``NewsEntity.java`` . The IDE opens ``NewsEntity.java`` in the Source Editor.
@@ -162,10 +162,10 @@
private String body;
----
-[start=2]
+
. Right-click in the Source Editor and choose Insert Code (Alt-Insert; Ctrl-I on Mac) and select Getter and Setter to open the Generate Getters and Setters dialog box.
-[start=3]
+
. Select the ``body`` and ``title`` fields in the dialog box. Click Generate.
image::images/ejb-gettersetter.png[title="Generate Getters and Setters dialog box"]
@@ -173,7 +173,7 @@
When you click Generate, the IDE adds getter and setter methods for the fields.
-[start=4]
+
. Save the changes to ``NewsEntity.java`` .
You can close ``NewsEntity.java`` .
@@ -226,7 +226,7 @@
private MessageDrivenContext mdc;*
----
-[start=2]
+
. Introduce the entity manager into the class by right-clicking in the code and choosing Insert Code (Alt-Insert; Ctrl-I on Mac) and choosing Use Entity Manager from the pop-up menu. The IDE adds the following ``@PersistenceContext`` annotation to your source code.
[source,java]
@@ -245,7 +245,7 @@
}
----
-[start=3]
+
. Modify the ``persist`` method to change the name to ``save`` . The method should look like the following:
[source,java]
@@ -256,7 +256,7 @@
}
----
-[start=4]
+
. Modify the ``onMessage`` method by adding the following code (in bold) to the body of the method.
[source,java]
@@ -279,7 +279,7 @@
}
----
-[start=5]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) to generate any necessary import statements. Save your changes.
NOTE: When generating the import statements, you want to *make sure to import the ``javax.jms`` and ``javax.annotation.Resource`` libraries*.
@@ -361,7 +361,7 @@
When you implement ``HttpSessionListener`` , the IDE displays a warning in the margin.
-[start=2]
+
. Click the warning badge in the left margin and choose "Implement all abstract methods".
image::images/ejb-implementabstract.png[title="Editor hint to implement abstract methods"]
@@ -369,7 +369,7 @@
The IDE adds the ``sessionCreated`` and ``sessionDestroyed`` methods.
-[start=3]
+
. Add the static field ``counter`` and set the initial value to ``0`` .
[source,java]
@@ -381,7 +381,7 @@
*private static int counter = 0;*
----
-[start=4]
+
. Modify the generated bodies of the ``sessionCreated`` and ``sessionDestroyed`` methods to increase the value of a field when a new session starts and to decrease the value when a session finishes. The value will be stored in the field ``counter`` .
[source,java]
@@ -396,7 +396,7 @@
}
----
-[start=5]
+
. Add the following method that returns the current value of ``counter`` .
[source,java]
@@ -410,7 +410,7 @@
You will call this method from a servlet to display the current number of users/open sessions.
-[start=6]
+
. Save your changes.
The code for the session bean should now look like the following.
@@ -459,7 +459,7 @@
The IDE adds the ``@EJB`` annotation to inject the enterprise bean.
-[start=3]
+
. Use the Call Enterprise Bean dialog box again to inject the SessionManagerBean under the NewsApp-war node.
In your code you will see the following annotations that inject the two enterprise beans.
@@ -481,7 +481,7 @@
You can also see that the ``@WebServlet`` annotation is used to declare the class a servlet and to specify the servlet name. The ``@WebServlet`` annotation is part of the Servlet 3.0 API introduced in the Java EE 6 specification. You can identify servlets using the annotation instead of in the ``web.xml`` deployment descriptor. The NewsApp application does not contain ``web.xml`` .
-[start=4]
+
. In the ``processRequest`` method, add the following code (in bold) to return the current session or create a new one.
[source,java]
@@ -493,7 +493,7 @@
response.setContentType("text/html;charset=UTF-8");
----
-[start=5]
+
. Add the following code (in bold) to the ``processRequest`` method to print the messages and add a link to the PostMessage servlet. (Uncomment the code in the method if necessary.)
[source,xml]
@@ -513,7 +513,7 @@
----
-[start=6]
+
. Add the following code (in bold) to retrieve and print the number of users/open sessions.
[source,xml]
@@ -528,10 +528,10 @@
----
-[start=7]
+
. Press Ctrl-Shift-I to generate any necessary import statements for the class. When generating the import statements, you want to *import the ``java.util`` libraries*.
-[start=8]
+
. Save the changes to the file.
@@ -559,7 +559,7 @@
private Queue queue;*
----
-[start=2]
+
. You now add the code to send the JMS messages by adding the following code in bold to the ``processRequest`` method:
[source,java]
@@ -597,7 +597,7 @@
----
-[start=3]
+
. Add the following lines (in bold) to the ``processRequest`` method to add the web form for adding a message. (Uncomment the code to print the HTML if necessary.)
[source,xml]
@@ -616,7 +616,7 @@
----
-[start=4]
+
. Press Ctrl-Shift-I to generate any necessary import statements for the class.
NOTE: When selecting the libraries to import for ``Connection`` , ``ConnectionFactory`` , ``Session`` and ``Queue`` , *confirm that you import the ``javax.jms`` libraries*.
@@ -624,7 +624,7 @@
image::images/import-jms.png[title="Select the JMS libraries in the Fix All Imports dialog"]
-[start=5]
+
. Save your changes to the file.
@@ -658,22 +658,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repository Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/javaee/NewsAppEE6*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
NOTE: You need a Subversion client to checkout the sources. For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ja.asciidoc
index 20c519f..3edf2cf 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ja.asciidoc
@@ -103,10 +103,10 @@
このチュートリアルでは、ライブラリを他のユーザーまたはプロジェクトと共有する必要がないので、プロジェクト・ライブラリを専用のフォルダにコピーする理由はほとんどありません。
「次」をクリックします。
-[start=5]
+
. サーバーを「GlassFish Server」に設定し、「Java EEバージョン」を「Java EE 6」または「Java EE 7」に設定します。
-[start=6]
+
. 「EJBモジュールを作成」および「Webアプリケーション・モジュールを作成」を選択します。「終了」をクリックします。
image::images/new-entapp-wizard.png[title="新規プロジェクト・ウィザード"]
@@ -145,7 +145,7 @@
image::images/new-pu-wizard.png[title="「プロバイダとデータベース」パネル"]
-[start=11]
+
. 「終了」をクリックします。
「終了」をクリックすると、 ``persistence.xml`` およびエンティティ・クラス ``NewsEntity.java`` が作成されます。 ``NewsEntity.java`` がソース・エディタで表示されます。
@@ -161,10 +161,10 @@
private String body;
----
-[start=2]
+
. ソース・エディタ内を右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、「取得メソッドおよび設定メソッド」を選択して「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスを開きます。
-[start=3]
+
. ダイアログ・ボックスで、 ``body`` フィールドと ``title`` フィールドを選択します。「生成」をクリックします。
image::images/ejb-gettersetter.png[title="「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックス"]
@@ -172,7 +172,7 @@
「生成」をクリックすると、フィールド用の取得メソッドと設定メソッドが追加されます。
-[start=4]
+
. 変更内容を ``NewsEntity.java`` に保存します。
``NewsEntity.java`` を閉じます。
@@ -225,7 +225,7 @@
private MessageDrivenContext mdc;*
----
-[start=2]
+
. コード内を右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、ポップアップ・メニューから「エンティティ・マネージャの使用」を選択することで、クラスにエンティティ・マネージャを導入します。次の ``@PersistenceContext`` 注釈がソース・コードに追加されます。
[source,java]
@@ -244,7 +244,7 @@
}
----
-[start=3]
+
. ``persist`` メソッドを変更して名前を ``save`` に変更します。メソッドは次のようになります。
[source,java]
@@ -255,7 +255,7 @@
}
----
-[start=4]
+
. 次のコード(太字部分)をメソッドの本体に追加することで、 ``onMessage`` メソッドを変更します。
[source,java]
@@ -278,7 +278,7 @@
}
----
-[start=5]
+
. エディタを右クリックして「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、必要なインポート文を生成します。変更を保存します。
NOTE: インポート文を生成するときは、* ``javax.jms`` ライブラリと ``javax.annotation.Resource`` ライブラリを必ずインポート*してください。
@@ -360,7 +360,7 @@
``HttpSessionListener`` を実装すると、マージンに警告が表示されます。
-[start=2]
+
. 左マージンにある警告バッジをクリックして、「すべての抽象メソッドを実装」を選択します。
image::images/ejb-implementabstract.png[title="抽象メソッドを実装するためのエディタのヒント"]
@@ -368,7 +368,7 @@
``sessionCreated`` メソッドと ``sessionDestroyed`` メソッドが追加されます。
-[start=3]
+
. 静的フィールド ``counter`` を追加し、初期値を ``0`` に設定します。
[source,java]
@@ -380,7 +380,7 @@
*private static int counter = 0;*
----
-[start=4]
+
. 生成された ``sessionCreated`` メソッドと ``sessionDestroyed`` メソッドの本体を、新しいセッションが開始されるときにフィールドの値を増やし、セッションが終了するときに値を減らすように変更します。値は、フィールド ``counter`` に保存されます。
[source,java]
@@ -395,7 +395,7 @@
}
----
-[start=5]
+
. ``counter`` の現在の値を返す次のメソッドを追加します。
[source,java]
@@ -409,7 +409,7 @@
このメソッドをサーブレットからコールし、現在のユーザー数または開かれているセッション数を表示します。
-[start=6]
+
. 変更を保存します。
セッションBeanのコードは、次のようになっているはずです。
@@ -458,7 +458,7 @@
エンタープライズBeanを注入する ``@EJB`` 注釈が追加されます。
-[start=3]
+
. もう一度「エンタープライズBeanをコール」ダイアログ・ボックスを使用して、「NewsApp-war」ノードの下にSessionManagerBeanを注入します。
2つのエンタープライズBeanを注入する次の注釈がコードに表示されます。
@@ -480,7 +480,7 @@
また、クラス・サーブレットの宣言とサーブレット名の指定用に、 ``@WebServlet`` 注釈が使用されています。 ``@WebServlet`` 注釈は、Java EE 6仕様で導入されたServlet 3.0 APIの一部です。 ``web.xml`` デプロイメント・ディスクリプタで指定するかわりに、注釈を使用してサーブレットを特定できます。NewsAppアプリケーションには ``web.xml`` は含まれません。
-[start=4]
+
. ``processRequest`` メソッドに、現在のセッションを返すか新規に作成する、次のコード(太字部分)を追加します。
[source,java]
@@ -492,7 +492,7 @@
response.setContentType("text/html;charset=UTF-8");
----
-[start=5]
+
. ``processRequest`` メソッドにメッセージを出力する次のコード(太字部分)を追加して、リンクをPostMessageサーブレットに追加します。(必要な場合はメソッド内のコードをコメント解除します。)
[source,xml]
@@ -512,7 +512,7 @@
----
-[start=6]
+
. ユーザー数または開かれているセッションの数を取得および出力する、次のコード(太字部分)を追加します。
[source,xml]
@@ -527,10 +527,10 @@
----
-[start=7]
+
. [Ctrl]-[Shift]-[I]を押し、このクラスに必要なインポート文を生成します。インポート文を生成するときは、* ``java.util`` ライブラリをインポート*する必要があります。
-[start=8]
+
. 変更内容をファイルに保存します。
@@ -558,7 +558,7 @@
private Queue queue;*
----
-[start=2]
+
. 今度は、次に示す太字のコードを ``processRequest`` メソッドに追加し、JMSメッセージを送信するためのコードの追加を行います。
[source,java]
@@ -596,7 +596,7 @@
----
-[start=3]
+
. ``processRequest`` メソッドに次の行(太字部分)を追加して、メッセージを追加するためのWebフォームを追加します。(必要な場合はHTMLを出力するコードをコメント解除します。)
[source,xml]
@@ -615,7 +615,7 @@
----
-[start=4]
+
. [Ctrl]-[Shift]-[I]を押し、このクラスに必要なインポート文を生成します。
NOTE: ``Connection`` 、 ``ConnectionFactory`` 、 ``Session`` および ``Queue`` 用にインポートするライブラリを選択するときは、* ``javax.jms`` ライブラリをインポートしていることを確認してください*。
@@ -623,7 +623,7 @@
image::images/import-jms.png[title="「すべてのインポートを修正」ダイアログでのJMSライブラリの選択"]
-[start=5]
+
. 変更内容をファイルに保存します。
@@ -657,22 +657,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/javaee/NewsAppEE6*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
NOTE: ソースをチェックアウトするには、Subversionクライアントが必要です。Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_pt_BR.asciidoc
index e1e5666..b7708f1 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_pt_BR.asciidoc
@@ -103,10 +103,10 @@
(Para este tutorial, não há motivo para copiar as bibliotecas de projeto em uma pasta dedicada, pois você não precisará compartilhar bibliotecas com outros usuários ou projetos).
Clique em Próximo.
-[start=5]
+
. Defina o servidor como GlassFish Server e defina a versão do Java EE para Java EE 6 ou Java EE 7.
-[start=6]
+
. Selecione Criar Módulo EJB e Criar Módulo de Aplicação Web. Clique em Finalizar.
image::images/new-entapp-wizard.png[title="Assistente Novo Projeto"]
@@ -145,7 +145,7 @@
image::images/new-pu-wizard.png[title="Provedor e painel de Banco de Dados"]
-[start=11]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE cria ``persistence.xml`` e a classe de entidade ``NewsEntity.java`` . O IDE abre ``NewsEntity.java`` no Editor de Código-Fonte.
@@ -161,10 +161,10 @@
private String body;
----
-[start=2]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte e selecione Inserir Código (Alt-Insert; Ctrl-I no Mac) e selecione Getter e Setter para abrir a caixa de diálogo Gerar Getters e Setters.
-[start=3]
+
. Selecione os campos ``body`` e ``title`` na caixa de diálogo. Clique em Gerar.
image::images/ejb-gettersetter.png[title="Caixa de diálogo Gerar Getters e Setters"]
@@ -172,7 +172,7 @@
Quando você clica em Gerar, o IDE adiciona os métodos getter e setter nos campos.
-[start=4]
+
. Salve as alterações em ``NewsEntity.java`` .
Você pode fechar ``NewsEntity.java`` .
@@ -225,7 +225,7 @@
private MessageDrivenContext mdc;*
----
-[start=2]
+
. Introduza o gerenciador de entidades na classe clicando com o botão direito do mouse no código e selecionando Inserir Código (Alt-Insert; Ctrl-I no Mac), e selecionando Usar Gerenciador de Entidades no menu pop-up. O IDE adiciona a seguinte anotação ``@PersistenceContext`` ao seu código-fonte.
[source,java]
@@ -244,7 +244,7 @@
}
----
-[start=3]
+
. Modifique o método ``persist`` para alterar o nome para ``save`` . O método deve ter uma aparência semelhante a esta:
[source,java]
@@ -255,7 +255,7 @@
}
----
-[start=4]
+
. Modifique o método ``onMessage`` adicionando o seguinte código (em negrito) ao corpo do método.
[source,java]
@@ -278,7 +278,7 @@
}
----
-[start=5]
+
. Clique com o botão direito do mouse no editor e escolha Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) para gerar quaisquer instruções de importação necessárias. Salve as alterações.
NOTE: Quando geramos as instruções de importação, queremos *garantir a importação das bibliotecas ``javax.jms`` e ``javax.annotation.Resource`` *.
@@ -360,7 +360,7 @@
Quando você implementa ``HttpSessionListener`` , o IDE exibe uma advertência na margem.
-[start=2]
+
. Clique no emblema de advertência na margem esquerda e selecione "Implementar todos os métodos abstratos".
image::images/ejb-implementabstract.png[title="Dica do editor para implementar métodos abstratos"]
@@ -368,7 +368,7 @@
O IDE adiciona os métodos ``sessionCreated`` e ``sessionDestroyed`` .
-[start=3]
+
. Adicione o campo estático ``counter`` e defina o valor inicial como ``0`` .
[source,java]
@@ -380,7 +380,7 @@
*private static int counter = 0;*
----
-[start=4]
+
. Modifique os corpos gerados dos métodos ``sessionCreated`` e ``sessionDestroyed`` para aumentar o valor de um campo quando uma nova sessão for iniciada e para diminuir o valor quando uma sessão for finalizada. O valor será armazenado no campo ``counter`` .
[source,java]
@@ -395,7 +395,7 @@
}
----
-[start=5]
+
. Adicione o método a seguir, que retorna o valor atual de ``counter`` .
[source,java]
@@ -409,7 +409,7 @@
Você chamará este método de um servlet para exibir o número atual de usuários/sessões abertas.
-[start=6]
+
. Salve as alterações.
O código para o bean de sessão deve ter agora a seguinte aparência.
@@ -458,7 +458,7 @@
O IDE adiciona a anotação ``@EJB`` para injetar o enterprise bean.
-[start=3]
+
. Use a caixa de diálogo Chamar Enterprise Bean novamente para injetar SessionManagerBean no nó NewsApp-war.
Você verá no seu código as seguintes anotações que injetam os dois enterprise beans.
@@ -480,7 +480,7 @@
Você também pode ver que a anotação ``@WebServlet`` é usada para declarar a classe um servlet e especificar o nome do servlet. A anotação ``@WebServlet`` faz parte da API do Servlet 3.0 introduzida na especificação Java EE 6. Você pode identificar os servlets usando a anotação, em vez de no descritor de implantação ``web.xml`` . A aplicação NewsApp não contém ``web.xml`` .
-[start=4]
+
. No método ``processRequest`` , adicione o seguinte código (em negrito) para retornar a sessão atual ou criar uma nova sessão.
[source,java]
@@ -492,7 +492,7 @@
response.setContentType("text/html;charset=UTF-8");
----
-[start=5]
+
. Adicione o seguinte código (em negrito) ao método ``processRequest`` para imprimir as mensagens e adicionar um link ao servlet PostMessage. (Remova os comentários do código no método, se necessário.)
[source,xml]
@@ -512,7 +512,7 @@
----
-[start=6]
+
. Adicione o código seguinte (em negrito) para recuperar e imprimir o número de usuários/sessões abertas.
[source,xml]
@@ -527,10 +527,10 @@
----
-[start=7]
+
. Pressione Ctrl-Shift-I para gerar as instruções de importação necessárias para a classe. Ao gerar as instruções de importação, você deseja *importar as bibliotecas ``java.util`` *.
-[start=8]
+
. Salve as alterações feitas no arquivo.
@@ -558,7 +558,7 @@
private Queue queue;*
----
-[start=2]
+
. Agora você insere o código para enviar as mensagens JMS adicionando o seguinte código em negrito ao método ``processRequest`` :
[source,java]
@@ -596,7 +596,7 @@
----
-[start=3]
+
. Adicione as linhas a seguir (em negrito) ao método ``processRequest`` para adicionar o form web para adicionar uma mensagem. (Remova o comentário do código para imprimir o HTML, se necessário.)
[source,xml]
@@ -615,7 +615,7 @@
----
-[start=4]
+
. Pressione Ctrl-Shift-I para gerar as instruções de importação necessárias para a classe.
NOTE: ao selecionar bibliotecas para importação para ``Connection`` , ``ConnectionFactory`` , ``Session`` e ``Queue`` , *certifique-se de importar as bibliotecas ``javax.jms`` *.
@@ -623,7 +623,7 @@
image::images/import-jms.png[title="Selecione as bibliotecas JMS na caixa de diálogo Corrigir Todas as Importações"]
-[start=5]
+
. Salve as alterações feitas no arquivo.
@@ -657,22 +657,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar Pastas do Repositório.
-[start=4]
+
. Expanda o nó raiz e selecione *samples/javaee/NewsAppEE6*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
*Observações.*
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ru.asciidoc
index ca2d417..9e49679 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_ru.asciidoc
@@ -103,10 +103,10 @@
(В рамках этого руководства копирование библиотек проекта в отдельную папку нецелесообразно, поскольку совместное использование библиотек с другими пользователями или проектами не требуется.)
Нажмите кнопку "Далее".
-[start=5]
+
. В качестве сервера выберите сервер GlassFish, а в качестве версии Java EE укажите Java EE 6 или Java EE 7.
-[start=6]
+
. Выберите пункты "Создать модуль EJB" и "Создать модуль веб-приложения". Нажмите кнопку "Завершить".
image::images/new-entapp-wizard.png[title="Мастер создания проектов"]
@@ -145,7 +145,7 @@
image::images/new-pu-wizard.png[title="Панель 'Поставщик и база данных'"]
-[start=11]
+
. Нажмите кнопку "Завершить".
При нажатии кнопки "Завершить" в среде IDE будет создан файл ``persistence.xml`` и класс сущностей ``NewsEntity.java`` . ``NewsEntity.java`` будет открыт средой IDE в редакторе исходного кода.
@@ -161,10 +161,10 @@
private String body;
----
-[start=2]
+
. Щелкните правой кнопкой мыши в редакторе исходного кода, выберите пункт "Вставить код" (Alt-Insert; Ctrl-I на Mac) и выберите пункт "Методы получения и установки", чтобы открыть диалоговое окно "Создать методы получения и установки".
-[start=3]
+
. В диалоговом окне выберите поля ``body`` и ``title`` . Нажмите кнопку "Создать".
image::images/ejb-gettersetter.png[title="Диалоговое окно 'Создание методов получения и установки'"]
@@ -172,7 +172,7 @@
При нажатии кнопки "Создать" в среде IDE добавляются методы получения и установки для полей.
-[start=4]
+
. Сохраните изменения в ``NewsEntity.java`` .
``NewsEntity.java`` можно закрыть.
@@ -225,7 +225,7 @@
private MessageDrivenContext mdc;*
----
-[start=2]
+
. Добавьте диспетчер сущностей в класс, щелкнув правой кнопкой мыши в коде и выбрав 'Вставить код' (Alt-Insert, Ctrl-I в Mac) и выбрав 'Использовать диспетчер сущностей' из всплывающего меню. В среде IDE к исходному коду добавляется следующая аннотация ``@PersistenceContext`` .
[source,java]
@@ -244,7 +244,7 @@
}
----
-[start=3]
+
. Для изменения имени на ``save`` измените метод ``persist`` . В результате метод должен выглядеть следующим образом:
[source,java]
@@ -255,7 +255,7 @@
}
----
-[start=4]
+
. Измените метод ``onMessage`` путем добавления следующих строк кода (выделено полужирным шрифтом) в тело метода.
[source,java]
@@ -278,7 +278,7 @@
}
----
-[start=5]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' (Alt-Shift-I; ⌘-Shift-I в Mac) для создания необходимых операторов импорта. Сохраните изменения.
NOTE: При создании операторов импорта необходимо *убедиться в импорте библиотек ``javax.jms`` и ``javax.annotation.Resource`` *.
@@ -360,7 +360,7 @@
При реализации ``HttpSessionListener`` в среде IDE в поле отображается предупреждение.
-[start=2]
+
. Щелкните значок предупреждения в левом поле и выберите "Реализовать все абстрактные методы".
image::images/ejb-implementabstract.png[title="Подсказка редактора о реализации абстрактных методов"]
@@ -368,7 +368,7 @@
В среде IDE добавляются методы ``sessionCreated`` и ``sessionDestroyed`` .
-[start=3]
+
. Добавьте статическое поле ``counter`` и установите начальное значение на ``0`` .
[source,java]
@@ -380,7 +380,7 @@
*private static int counter = 0;*
----
-[start=4]
+
. Измените созданные тела методов ``sessionCreated`` и ``sessionDestroyed`` для увеличения значения поля при запуске нового сеанса и для уменьшения значения при завершении сеанса. Значение сохраняется в поле ``counter`` .
[source,java]
@@ -395,7 +395,7 @@
}
----
-[start=5]
+
. Добавьте следующий метод, возвращающий текущее значение поля ``counter`` .
[source,java]
@@ -409,7 +409,7 @@
Этот метод вызывается из сервлета для отображения текущего количества пользователей/открытых сеансов.
-[start=6]
+
. Сохраните изменения.
Теперь код сеансного компонента должен выглядеть следующим образом.
@@ -458,7 +458,7 @@
В среде IDE добавляется аннотация ``@EJB`` для ввода компонента EJB.
-[start=3]
+
. Используйте диалоговое окно "Вызов компонента EJB" еще раз для ввода компонента SessionManagerBean в узел NewsApp-war.
В коде можно увидеть следующие аннотации для ввода двух компонентов EJB.
@@ -480,7 +480,7 @@
Кроме того, можно увидеть, что аннотация ``@WebServlet`` используется для объявления класса сервлета и для указания имени сервлета. Аннотация ``@WebServlet`` является частью интерфейса API сервлета 3.0, представленного в спецификации Java EE 6. Сервлеты можно определить с помощью аннотации вместо дескриптора развертывания в ``web.xml`` . Приложение NewsApp не содержит ``web.xml`` .
-[start=4]
+
. В методе ``processRequest`` добавьте следующий код (выделено полужирным шрифтом) для возврата к текущему сеансу или создания нового.
[source,java]
@@ -492,7 +492,7 @@
response.setContentType("text/html;charset=UTF-8");
----
-[start=5]
+
. Добавьте следующий код (выделен жирным шрифтом) к методу ``processRequest`` для вывода сообщений и добавления ссылки на сервлет PostMessage. (При необходимости удалите знак комментария для кода в методе.)
[source,xml]
@@ -512,7 +512,7 @@
----
-[start=6]
+
. Добавьте следующий код (выделено полужирным шрифтом) для получения и отображения количества пользователей/открытых сеансов.
[source,xml]
@@ -527,10 +527,10 @@
----
-[start=7]
+
. Нажмите сочетание клавиш Ctrl+Shift+I для создания обязательных операторов импорта для класса. При создании операторов импорта может потребоваться *импортировать библиотеки ``java.util`` *.
-[start=8]
+
. Сохраните измененный файл.
@@ -558,7 +558,7 @@
private Queue queue;*
----
-[start=2]
+
. Теперь создадим код для передачи сообщения JMS путем добавления в метод ``processRequest`` следующих строк кода, выделенных полужирным шрифтом:
[source,java]
@@ -596,7 +596,7 @@
----
-[start=3]
+
. Добавьте следующие строки (выделены жирным шрифтом) к методу ``processRequest`` , чтобы добавить веб-форму добавления сообщения. (При необходимости, уберите знак комментария для вывода кода HTML)
[source,xml]
@@ -615,7 +615,7 @@
----
-[start=4]
+
. Нажмите сочетание клавиш Ctrl+Shift+I для создания обязательных операторов импорта для класса.
NOTE: При выборе библиотек для импорта для ``Connection`` , ``ConnectionFactory`` , ``Session`` и ``Queue`` , *убедитесь, что импортируются библиотеки ``javax.jms`` *.
@@ -623,7 +623,7 @@
image::images/import-jms.png[title="Выберите библиотеки JMS в диалоговом окне 'Исправить все выражения импорта'"]
-[start=5]
+
. Сохраните измененный файл.
@@ -653,30 +653,30 @@
* Загрузите link:https://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252FNewsAppEE6.zip[+архив завершенного проекта в формате zip+].
* Выполните проверку исходных файлов проекта на выходе из примеров NetBeans, выполнив перечисленные ниже действия.
-[start=1]
+
. Выберите в главном меню "Группа > Subversion > Проверить".
-[start=2]
+
. В диалоговом окне "Проверка" введите следующий URL-адрес репозитория:
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку Browse ("Обзор") для открытия диалогового окна Browse Repository Folders ("Обзор папок репозитория").
-[start=4]
+
. Разверните корневой узел и выберите *samples/javaee/NewsAppEE6*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечания.*
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_zh_CN.asciidoc
index 4db64d5..910124f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-ejb_zh_CN.asciidoc
@@ -103,10 +103,10 @@
(在本教程中,我们将项目库复制到一个专门的文件夹中,因为需要与其他用户或项目共享库。)
单击 "Next"(下一步)。
-[start=5]
+
. 将服务器设置为 "GlassFish Server",并将 Java EE 版本设置为 "Java EE 6" 或 "Java EE 7"。
-[start=6]
+
. 选中 "Create EJB Module"(创建 EJB 模块)和 "Create Web Application Module"(创建 Web 应用程序模块)。单击 "Finish"(完成)。
image::images/new-entapp-wizard.png[title="新建项目向导"]
@@ -145,7 +145,7 @@
image::images/new-pu-wizard.png[title=""Provider and Database"(提供器和数据库)面板"]
-[start=11]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将创建 ``persistence.xml`` 和 ``NewsEntity.java`` 实体类。IDE 将在源代码编辑器中打开 ``NewsEntity.java`` 。
@@ -153,7 +153,7 @@
在源代码编辑器中,执行以下步骤。
-[start=1]
+
. 将以下字段声明添加到类中:
[source,java]
@@ -163,10 +163,10 @@
private String body;
----
-[start=2]
+
. 在源代码编辑器中右键单击,选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键),然后选择 "Getter and Setter"(Getter 和 Setter),以打开 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框。
-[start=3]
+
. 在对话框中选择 ``body`` 和 ``title`` 字段。单击 "Generate"(生成)。
image::images/ejb-gettersetter.png[title=""Generate Getters and Setters"(生成 getter 和 setter)对话框"]
@@ -174,7 +174,7 @@
在单击 "Generate"(生成)时,IDE 将为字段添加 getter 和 setter 方法。
-[start=4]
+
. 保存对 ``NewsEntity.java`` 的更改。
您可以将 ``NewsEntity.java`` 关闭。
@@ -227,7 +227,7 @@
private MessageDrivenContext mdc;*
----
-[start=2]
+
. 在代码中右键单击,从弹出式菜单中选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键),然后选择 "Use Entity Manager"(使用实体管理器),以便将实体管理器引入类中。IDE 在源代码中添加以下 ``@PersistenceContext`` 标注。
[source,java]
@@ -246,7 +246,7 @@
}
----
-[start=3]
+
. 修改 ``persist`` 方法,将名称更改为 ``save`` 。该方法应如下所示:
[source,java]
@@ -257,7 +257,7 @@
}
----
-[start=4]
+
. 在 ``onMessage`` 方法主体中添加以下代码(以粗体显示)以修改该方法。
[source,java]
@@ -280,7 +280,7 @@
}
----
-[start=5]
+
. 在编辑器中右键单击,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键),以生成所有必要的 import 语句。保存所做的更改。
NOTE: 在生成 import 语句时,您需要*确保导入 ``javax.jms`` 和 ``javax.annotation.Resource`` 库*。
@@ -362,7 +362,7 @@
在实现 ``HttpSessionListener`` 时,IDE 将在旁注中显示一条警告。
-[start=2]
+
. 单击左旁注中的警告标记,然后选择 "Implement all abstract methods"(实现所有抽象方法)。
image::images/ejb-implementabstract.png[title="用于实现抽象方法的编辑器提示"]
@@ -370,7 +370,7 @@
IDE 将添加 ``sessionCreated`` 和 ``sessionDestroyed`` 方法。
-[start=3]
+
. 添加 ``counter`` 静态字段,并将初始值设置为 ``0`` 。
[source,java]
@@ -382,7 +382,7 @@
*private static int counter = 0;*
----
-[start=4]
+
. 修改生成的 ``sessionCreated`` 和 ``sessionDestroyed`` 方法主体,以便在新会话启动时增加字段值,并在会话完成时减少字段值。该值将存储在 ``counter`` 字段中。
[source,java]
@@ -397,7 +397,7 @@
}
----
-[start=5]
+
. 添加以下方法以返回当前的 ``counter`` 值。
[source,java]
@@ -411,7 +411,7 @@
将从 Servlet 中调用此方法以显示当前的用户/打开会话数。
-[start=6]
+
. 保存所做的更改。
现在,会话 Bean 代码应如下所示。
@@ -460,7 +460,7 @@
IDE 将添加 ``@EJB`` 标注以注入企业 Bean。
-[start=3]
+
. 可以再次使用 "Call Enterprise Bean"(调用企业 Bean)对话框在 NewsApp-war 节点下面注入 SessionManagerBean。
将会在代码中看到以下标注,它们用于注入两个企业 Bean。
@@ -482,7 +482,7 @@
您还会看到使用了 ``@WebServlet`` 标注将类声明为 Servlet 并指定了 Servlet 名称。 ``@WebServlet`` 标注是 Java EE 6 规范中引入的 Servlet 3.0 API 的一部分。可以使用标注标识 Servlet,而不是使用 ``web.xml`` 部署描述符。NewsApp 应用程序不包含 ``web.xml`` 。
-[start=4]
+
. 在 ``processRequest`` 方法中,添加以下代码(以粗体显示)以返回当前会话或创建新会话。
[source,java]
@@ -494,7 +494,7 @@
response.setContentType("text/html;charset=UTF-8");
----
-[start=5]
+
. 将以下代码(以粗体显示)添加到 ``processRequest`` 方法中,以输出消息并添加指向 PostMessage Servlet 的链接。(根据需要取消注释方法中的代码。)
[source,xml]
@@ -514,7 +514,7 @@
----
-[start=6]
+
. 添加以下代码(以粗体显示)以检索并输出用户/打开会话数。
[source,xml]
@@ -529,10 +529,10 @@
----
-[start=7]
+
. 按 Ctrl-Shift-I 组合键以为该类生成所有必要的 import 语句。在生成 import 语句时,您希望*导入 ``java.util`` 库*。
-[start=8]
+
. 保存对该文件所做的更改。
@@ -560,7 +560,7 @@
private Queue queue;*
----
-[start=2]
+
. 现在,通过将下面以粗体显示的代码添加到 ``processRequest`` 方法中,添加用于发送 JMS 消息的代码:
[source,java]
@@ -598,7 +598,7 @@
----
-[start=3]
+
. 将以下行(以粗体显示)添加到 ``processRequest`` 方法中,以添加用于添加消息的 Web 窗体。(根据需要取消注释用于输出 HTML 的代码。)
[source,xml]
@@ -617,7 +617,7 @@
----
-[start=4]
+
. 按 Ctrl-Shift-I 组合键以为该类生成所有必要的 import 语句。
NOTE: 在为 ``Connection`` 、 ``ConnectionFactory`` 、 ``Session`` 和 ``Queue`` 选择要导入的库时,*请确保导入 ``javax.jms`` 库*。
@@ -625,7 +625,7 @@
image::images/import-jms.png[title="在 "Fix All Imports"(修复所有导入)对话框中选择 JMS 库"]
-[start=5]
+
. 保存对该文件所做的更改。
@@ -659,22 +659,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repository Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点并选择 *samples/javaee/NewsAppEE6*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
NOTE: 需要 Subversion 客户端检出源代码。有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit.asciidoc
index 67bc326..769f883 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit.asciidoc
@@ -88,7 +88,7 @@
4. Deselect the Use Dedicated Folder option, if selected.
Click Next.
-[start=5]
+
. Set the server to *GlassFish Server* and set the Java EE Version to *Java EE 6 Web* or *Java EE 7 Web*.
Click Finish.
@@ -106,7 +106,7 @@
When you click Finish, the new class opens in the editor.
-[start=6]
+
. In the editor, add the following method ``addNumbers`` to the class.
[source,java]
@@ -123,7 +123,7 @@
NOTE: It is not necessary to add an ``@LocalBean`` annotation or implement an interface in this tutorial. By default the bean exposes a no-interface view when no view is explicitly specified.
-[start=7]
+
. Save your changes.
@@ -150,7 +150,7 @@
NOTE: The ``glassfish-embedded-static-shell.jar`` JAR does not contain the sources for the embedded EJB container. The ``glassfish-embedded-static-shell.jar`` JAR requires a local installation of GlassFish. The classpath for the local GlassFish installation is determined by the target server for the project. You can change the target server in the project's Properties dialog box.
-[start=4]
+
. Modify the generated skeleton test method to specify values for ``numberA`` , ``numberB`` and ``expResult`` and remove the default call to fail.
[source,java]
@@ -170,7 +170,7 @@
}
----
-[start=5]
+
. Right-click the project in the Projects window and choose Test.
When you run the test, the Test Results window opens in the IDE and displays the progress and results of the test.
@@ -238,10 +238,10 @@
}
----
-[start=2]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) to add import statements for ``java.util.HashMap`` and ``java.util.Map`` .
-[start=3]
+
. Run the test again to confirm that the modified test works and that the container is created correctly.
You can click the Rerun button in the Test Results window.
@@ -265,7 +265,7 @@
private static EJBContainer container;
----
-[start=2]
+
. Copy the code that creates the container from the ``testAddNumbers`` test method to the ``setUpClass`` method and
[source,java]
@@ -280,7 +280,7 @@
}
----
-[start=3]
+
. Copy the code that closes the container from the ``testAddNumbers`` test method to the ``tearDownClass`` method.
[source,java]
@@ -293,7 +293,7 @@
}
----
-[start=4]
+
. Remove the redundant code from the ``testAddNumbers`` method. Save your changes.
The test class should now look like the following.
@@ -382,7 +382,7 @@
When you click Finish, the new entity class opens in the editor. If you expand the Configuration Files node in the Projects window, you can see that the IDE automatically generated the ``persistence.xml`` file that defines the properties of the persistence unit ``WebAppJUnitPU`` .
-[start=8]
+
. In the editor, add the following private field to the entity class.
[source,java]
@@ -391,13 +391,13 @@
private String name;
----
-[start=9]
+
. Right-click in the Source Editor and choose Insert Code (Alt-Insert; Ctrl-I on Mac) and select Getter and Setter to open the Generate Getters and Setters dialog box.
-[start=10]
+
. Select the ``name`` field in the dialog box. Click Generate.
-[start=11]
+
. Add the following method to the class.
[source,java]
@@ -409,7 +409,7 @@
}
----
-[start=12]
+
. Use the ``@NamedQueries`` and ``@NamedQuery`` annotations to create a named SQL query.
[source,java]
@@ -420,13 +420,13 @@
public class SimpleEntity implements Serializable {
----
-[start=13]
+
. Create a default constructor.
You can click the suggestion icon that is displayed in the gutter next to the class declaration if you want the IDE to generate the constructor for you.
-[start=14]
+
. Fix your imports to add import statements for ``javax.persistence.NamedQueries`` , ``javax.persistence.NamedQuery`` and ``java.util.Date`` . Save your changes.
In addition to the default generated code, the entity class should now look similar to the following:
@@ -498,7 +498,7 @@
private EntityManager em;
----
-[start=3]
+
. Add the following ``verify`` and ``insert`` methods.
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=4]
+
. Fix your imports to import ``javax.persistence.Query`` and save your changes.
@@ -561,7 +561,7 @@
}
----
-[start=4]
+
. Right-click the project node in the Projects window and choose Test from the popup menu.
The Test Results window will open and display output that is similar to the following.
@@ -584,22 +584,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repository Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/javaee/WebAppJUnit*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
NOTE: You need a Subversion client to checkout the sources. For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ja.asciidoc
index a46b7a6..3569976 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ja.asciidoc
@@ -88,7 +88,7 @@
4. 専用フォルダを使用するオプションが選択されている場合は選択を解除します。
「次」をクリックします。
-[start=5]
+
. サーバーを*「GlassFish Server」*に設定し、「Java EEバージョン」を*「Java EE 6 Web」*または*「Java EE 7 Web」*に設定します。
「終了」をクリックします。
@@ -106,7 +106,7 @@
「終了」をクリックすると、新しいクラスがエディタに表示されます。
-[start=6]
+
. エディタで、クラスに以下のメソッド ``addNumbers`` を追加します。
[source,java]
@@ -123,7 +123,7 @@
NOTE: ``@LocalBean`` 注釈を追加したり、このチュートリアルでインタフェースを実装する必要はありません。ビューが明示的に指定されていない場合、デフォルトでは、インタフェースなしのビューが公開されます。
-[start=7]
+
. 変更を保存します。
@@ -150,7 +150,7 @@
NOTE: ``glassfish-embedded-static-shell.jar`` JARには、埋込みEJBコンテナのソースは含まれていません。 ``glassfish-embedded-static-shell.jar`` JARには、GlassFishのローカル・インストールが必要です。ローカルのGlassFishインストールのクラスパスは、プロジェクトのターゲット・サーバーによって決定されます。ターゲット・サーバーは、プロジェクトの「プロパティ」ダイアログ・ボックスで変更できます。
-[start=4]
+
. 生成されたスケルトン・テスト・メソッドを変更して、 ``numberA`` 、 ``numberB`` および ``expResult`` の値を指定し、デフォルトのfailのコールを除去します。
[source,java]
@@ -170,7 +170,7 @@
}
----
-[start=5]
+
. 「プロジェクト」ウィンドウでプロジェクトを右クリックし、「テスト」を選択します。
テストを実行すると、IDEで「テスト結果」ウィンドウが開き、テストの進捗状況と結果が表示されます。
@@ -238,10 +238,10 @@
}
----
-[start=2]
+
. エディタを右クリックして「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、 ``java.util.HashMap`` および ``java.util.Map`` 用のインポート文を追加します。
-[start=3]
+
. テストを再実行して、変更したテストが機能し、コンテナが正しく作成されることを確認します。
「テスト結果」ウィンドウの「再実行」ボタンをクリックできます。
@@ -265,7 +265,7 @@
private static EJBContainer container;
----
-[start=2]
+
. コンテナを作成するコードを ``testAddNumbers`` テスト・メソッドから ``setUpClass`` メソッドにコピーします。
[source,java]
@@ -280,7 +280,7 @@
}
----
-[start=3]
+
. コンテナを閉じるコードを ``testAddNumbers`` テスト・メソッドから ``tearDownClass`` メソッドにコピーします。
[source,java]
@@ -293,7 +293,7 @@
}
----
-[start=4]
+
. ``testAddNumbers`` から余分なコードを除去します。変更を保存します。
テスト・クラスは次のようになるはずです。
@@ -382,7 +382,7 @@
「終了」をクリックすると、新しいエンティティ・クラスがエディタに表示されます。「プロジェクト」ウィンドウの「構成ファイル」ノードを展開すると、持続性ユニット ``WebAppJUnitPU`` のプロパティを定義する ``persistence.xml`` ファイルがIDEによって自動的に生成されたことを確認できます。
-[start=8]
+
. エディタで、エンティティ・クラスに以下のprivateフィールドを追加します。
[source,java]
@@ -391,13 +391,13 @@
private String name;
----
-[start=9]
+
. ソース・エディタ内を右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、「取得メソッドおよび設定メソッド」を選択して「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスを開きます。
-[start=10]
+
. ダイアログ・ボックスで「 ``name`` 」フィールドを選択します。「生成」をクリックします。
-[start=11]
+
. クラスに以下のメソッドを追加します。
[source,java]
@@ -409,7 +409,7 @@
}
----
-[start=12]
+
. ``@NamedQueries`` および ``NamedQuery`` 注釈を使用して名前付きSQL問合せを作成します。
[source,java]
@@ -420,13 +420,13 @@
public class SimpleEntity implements Serializable {
----
-[start=13]
+
. デフォルト・コンストラクタを作成します。
IDEでコンストラクタを自動生成する場合は、クラス宣言の横のガターに表示された提案アイコンをクリックできます。
-[start=14]
+
. インポートを修正して、 ``javax.persistence.NamedQueries`` 、 ``javax.persistence.NamedQuery`` および ``java.util.Date`` のインポート文を追加します。変更を保存します。
デフォルトで生成されるコードに加えて、エンティティ・クラスは次のようになるはずです。
@@ -498,7 +498,7 @@
private EntityManager em;
----
-[start=3]
+
. 以下の ``verify`` および ``insert`` メソッドを追加します。
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=4]
+
. ``javax.persistence.Query`` をインポートするようにインポートを修正し、変更内容を保存します。
@@ -561,7 +561,7 @@
}
----
-[start=4]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、ポップアップ・メニューから「テスト」を選択します。
「テスト結果」ウィンドウが開き、以下のような出力が表示されます。
@@ -584,22 +584,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/javaee/WebAppJUnit*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
NOTE: ソースをチェックアウトするには、Subversionクライアントが必要です。Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_pt_BR.asciidoc
index 3350080..fba74df 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_pt_BR.asciidoc
@@ -88,7 +88,7 @@
4. Desmarque a opção Usar Pasta Dedicada, se ela estiver selecionada.
Clique em Próximo.
-[start=5]
+
. Defina o servidor como *GlassFish Server* e defina a versão do Java EE para *Java EE 6 Web* ou *Java EE 7 Web*.
Clique em Finalizar.
@@ -106,7 +106,7 @@
Quando você clica em Finalizar, a nova classe é aberta no editor.
-[start=6]
+
. No editor, adicione o seguinte método ``addNumbers`` à classe.
[source,java]
@@ -123,7 +123,7 @@
NOTE: Ele não é necessário para adicionar uma anotação ``@LocalBean`` ou implementar uma interface neste tutorial. Por default, o bean expõe uma view sem interface quando nenhuma view é especificada explicitamente.
-[start=7]
+
. Salve as alterações.
@@ -150,7 +150,7 @@
NOTE: O JAR ``glassfish-embedded-static-shell.jar`` não contém os códigos-fonte do contêiner EJB incorporado. O JAR ``glassfish-embedded-static-shell.jar`` requer uma instalação local do GlassFish. O classpath para a instalação local do GlassFish é determinado pelo servidor de destino do projeto. Você pode alterar o servidor de destino na caixa de diálogo Propriedades do projeto.
-[start=4]
+
. Modifique o método de teste esqueleto gerado para especificar valores para ``numberA`` , ``numberB`` e ``expResult`` e remova a chamada default para falha.
[source,java]
@@ -170,7 +170,7 @@
}
----
-[start=5]
+
. Clique com o botão direito do mouse no projeto na janela Projetos e selecione Testar.
Quando você executa o teste, a janela Resultados do Teste é aberta no IDE e exibe o andamento e os resultados do teste.
@@ -238,10 +238,10 @@
}
----
-[start=2]
+
. Clique com o botão direito do mouse no editor e selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) para adicionar instruções de importação para ``java.util.HashMap`` e ``java.util.Map`` .
-[start=3]
+
. Execute novamente o teste para confirmar se o teste modificado funciona e se o contêiner foi criado corretamente.
Você pode clicar no botão Reexecutar na janela Resultados do Teste.
@@ -265,7 +265,7 @@
private static EJBContainer container;
----
-[start=2]
+
. Copie o código que cria o contêiner do método de teste ``testAddNumbers`` para o método ``setUpClass`` e
[source,java]
@@ -280,7 +280,7 @@
}
----
-[start=3]
+
. Copie o código que fecha o contêiner do método de teste ``testAddNumbers`` para o método ``tearDownClass`` .
[source,java]
@@ -293,7 +293,7 @@
}
----
-[start=4]
+
. Remova o código redundante do método ``testAddNumbers`` . Salve as alterações.
A classe de teste deve se parecer com o seguinte.
@@ -382,7 +382,7 @@
Quando você clica em Finalizar, a nova classe de entidade é aberta no editor. Se você expandir o nó Arquivos de Configuração na janela Projetos, verá que o IDE gerou automaticamente o arquivo ``persistence.xml`` que define as propriedades da unidade de persistência ``WebAppJUnitPU`` .
-[start=8]
+
. No editor, adicione o campo privado a seguir à classe de entidade.
[source,java]
@@ -391,13 +391,13 @@
private String name;
----
-[start=9]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte e selecione Inserir Código (Alt-Insert; Ctrl-I no Mac) e selecione Getter e Setter para abrir a caixa de diálogo Gerar Getters e Setters.
-[start=10]
+
. Selecione o campo ``name`` na caixa de diálogo. Clique em Gerar.
-[start=11]
+
. Adicione o seguinte método à classe.
[source,java]
@@ -409,7 +409,7 @@
}
----
-[start=12]
+
. Use as anotações ``@NamedQueries`` e ``@NamedQuery`` para criar uma consulta SQL nomeada.
[source,java]
@@ -420,13 +420,13 @@
public class SimpleEntity implements Serializable {
----
-[start=13]
+
. Crie um construtor default.
Você pode clicar no ícone de sugestão exibido na medianiz, próximo à declaração de classe, se quiser que o IDE gere o construtor para você.
-[start=14]
+
. Corrija suas importações para adicionar instruções de importação para ``javax.persistence.NamedQueries`` , ``javax.persistence.NamedQuery`` e ``java.util.Date`` . Salve as alterações.
Além do código default gerado, a classe de entidade agora deve ser semelhante a:
@@ -498,7 +498,7 @@
private EntityManager em;
----
-[start=3]
+
. Adicione os seguintes métodos ``verify`` e ``insert`` .
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=4]
+
. Corrija suas importações para importar o ``javax.persistence.Query`` e salve as alterações.
@@ -561,7 +561,7 @@
}
----
-[start=4]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e escolha Testar no menu pop-up.
A janela Resultados do teste será aberta e exibirá uma saída semelhante à seguinte.
@@ -584,22 +584,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar Pastas do Repositório.
-[start=4]
+
. Expanda o nó raiz e selecione *samples/javaee/WebAppJUnit*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
NOTE: É necessário um cliente Subversion para verificar os códigos-fonte. Para saber mais sobre a instalação do Subversion, consulte a seção link:../ide/subversion.html#settingUp[+Configurando o Subversion+] no link:../ide/subversion.html[+Guia do Subversion no NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ru.asciidoc
index 9c84aa2..575b5ac 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_ru.asciidoc
@@ -90,7 +90,7 @@
4. Снимите флажок "Использовать отдельную папку", если он установлен.
Нажмите кнопку "Далее".
-[start=5]
+
. В качестве сервера выберите *GlassFish Server*, а в качестве версии Java EE - *Java EE 6 Web* или *Java EE 7 Web*.
Нажмите кнопку "Готово".
@@ -108,7 +108,7 @@
При нажатии кнопки "Готово" в редакторе откроется новый класс.
-[start=6]
+
. В редакторе добавьте к классу следующий метод ``addNumbers`` .
[source,java]
@@ -125,7 +125,7 @@
NOTE: Для выполнения заданий этого практического руководства не обязательно создавать аннотацию ``@LocalBean`` или реализацию интерфейса. Если представление не указано явным образом, по умолчанию компонент предоставляет безынтерфейсное представление.
-[start=7]
+
. Сохраните изменения.
@@ -152,7 +152,7 @@
NOTE: Файл JAR ``glassfish-embedded-static-shell.jar`` не содержит источников для встроенного контейнера EJB. Для файла ``glassfish-embedded-static-shell.jar`` требуется локальная установка GlassFish. Путь к классам для локальной установки GlassFish определяется целевым сервером для проекта. Целевой сервер можно изменить в диалоговом окне "Свойства" проекта.
-[start=4]
+
. Измените созданный каркасный тестовый метод, чтобы указать значения для ``numberA`` , ``numberB`` и ``expResult`` и удалить вызов сбоя по умолчанию.
[source,java]
@@ -172,7 +172,7 @@
}
----
-[start=5]
+
. Щелкните правой кнопкой мыши окно "Проекты" и выберите команду "Тест".
При выполнении теста в среде IDE откроется окно "Результаты тестирования", в котором отобразятся ход выполнения и результаты теста.
@@ -240,10 +240,10 @@
}
----
-[start=2]
+
. Щелкните правой кнопкой мыши в редакторе и выберите команду 'Исправить операторы импорта' (Alt-Shift-I; ⌘-Shift-I в Mac) для добавления операторов импорта для ``java.util.HashMap`` и ``java.util.Map`` .
-[start=3]
+
. Снова выполните тест для подтверждения работы измененного теста и правильности создания контейнера.
Можно нажать кнопку "Повторное выполнение" в окне "Результаты тестирования".
@@ -267,7 +267,7 @@
private static EJBContainer container;
----
-[start=2]
+
. Скопируйте код создания контейнера из тестового метода ``testAddNumbers`` в метод ``setUpClass`` .
[source,java]
@@ -282,7 +282,7 @@
}
----
-[start=3]
+
. Скопируйте код закрытия контейнера из тестового метода ``testAddNumbers`` в метод ``tearDownClass`` .
[source,java]
@@ -295,7 +295,7 @@
}
----
-[start=4]
+
. Удалите избыточный код из метода ``testAddNumbers`` . Сохраните изменения.
Теперь тестовый класс должен выглядеть следующим образом.
@@ -384,7 +384,7 @@
При нажатии кнопки "Готово" в редакторе откроется новый класс сущности. Если развернуть узел "Файлы настройки" в окне "Проекты, можно увидеть, что среда IDE автоматически создала файл ``persistence.xml`` , в котором определяются свойства единицы сохранения состояния ``WebAppJUnitPU`` .
-[start=8]
+
. В редакторе добавьте к классу сущности следующее закрытое поле.
[source,java]
@@ -393,13 +393,13 @@
private String name;
----
-[start=9]
+
. Щелкните правой кнопкой мыши в редакторе исходного кода, выберите пункт "Вставить код" (Alt-Insert; Ctrl-I на Mac) и выберите пункт "Методы получения и установки", чтобы открыть диалоговое окно "Создать методы получения и установки".
-[start=10]
+
. В диалоговом окне выберите поле ``name`` . Нажмите кнопку 'Создать'.
-[start=11]
+
. Добавьте к классу следующий метод.
[source,java]
@@ -411,7 +411,7 @@
}
----
-[start=12]
+
. Аннотации ``@NamedQueries`` и ``@NamedQuery`` используются для создания именованного запроса SQL.
[source,java]
@@ -422,13 +422,13 @@
public class SimpleEntity implements Serializable {
----
-[start=13]
+
. Создание конструктора по умолчанию.
Можно щелкнуть значок предложения, отображающийся во внутреннем поле рядом с объявлением класса, чтобы среда IDE создала конструктор.
-[start=14]
+
. Исправьте операторы импорта для добавления выражений импорта для ``javax.persistence.NamedQueries`` , ``javax.persistence.NamedQuery`` и ``java.util.Date`` . Сохраните изменения.
Помимо созданного кода по умолчанию теперь класс сущности должен выглядеть так, как показано ниже:
@@ -500,7 +500,7 @@
private EntityManager em;
----
-[start=3]
+
. Добавьте следующие методы ``verify`` и ``insert`` .
[source,java]
@@ -530,7 +530,7 @@
}
----
-[start=4]
+
. Исправьте операторы импорта, чтобы импортировать ``javax.persistence.Query`` , и сохраните изменения.
@@ -563,7 +563,7 @@
}
----
-[start=4]
+
. Правой кнопкой мыши щелкните узел свойств в окне "Проекты" и выберите "Тест" во всплывающем меню.
Откройте окно "Результаты тестирования", в котором будет отображен вывод, сходный со следующим.
@@ -586,21 +586,21 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку Browse ("Обзор") для открытия диалогового окна Browse Repository Folders ("Обзор папок репозитория").
-[start=4]
+
. Разверните корневой узел и выберите *samples/javaee/WebAppJUnit*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку 'Готово'.
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечания.*
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_zh_CN.asciidoc
index dd2d5cf..e5f4aa0 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-entapp-junit_zh_CN.asciidoc
@@ -88,7 +88,7 @@
4. 取消选中 "Use Dedicated Folder"(使用专用文件夹)选项(如果该选项处于选中状态)。
单击 "Next"(下一步)。
-[start=5]
+
. 将服务器设置为 *GlassFish Server*,并将 Java EE 版本设置为 *Java EE 6 Web* 或 *Java EE 7 Web*。
单击 "Finish"(完成)。
@@ -106,7 +106,7 @@
单击 "Finish"(完成),此时将在编辑器中打开新类。
-[start=6]
+
. 在编辑器中,将以下 ``addNumbers`` 方法添加到类中。
[source,java]
@@ -123,7 +123,7 @@
NOTE: 在本教程中,无需添加 ``@LocalBean`` 标注或实现接口。默认情况下,当未显式指定视图时,Bean 将公开无界面视图。
-[start=7]
+
. 保存所做的更改。
@@ -150,7 +150,7 @@
NOTE: ``glassfish-embedded-static-shell.jar`` JAR 不包含嵌入的 EJB 容器的源代码。 ``glassfish-embedded-static-shell.jar`` JAR 要求在本地安装 GlassFish。本地 GlassFish 安装的类路径是由项目的目标服务器确定的。您可以在项目的 "Properties"(属性)对话框中更改目标服务器。
-[start=4]
+
. 修改生成的框架测试方法以指定 ``numberA`` 、 ``numberB`` 和 ``expResult`` 的值,然后删除会失败的默认调用。
[source,java]
@@ -170,7 +170,7 @@
}
----
-[start=5]
+
. 在 "Projects"(项目)窗口中右键单击项目,然后选择 "Test"(测试)。
运行测试时,将在 IDE 中打开 "Test Results"(测试结果)窗口并显示测试进度和结果。
@@ -238,10 +238,10 @@
}
----
-[start=2]
+
. 在编辑器中右键单击,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)添加 ``java.util.HashMap`` 和 ``java.util.Map`` 的 import 语句。
-[start=3]
+
. 再次运行测试,以确认修改的测试正常工作并且正确创建了容器。
您可以在 "Test Results"(测试结果)窗口中单击 "Rerun"(重新运行)按钮。
@@ -265,7 +265,7 @@
private static EJBContainer container;
----
-[start=2]
+
. 将用于创建容器的代码从 ``testAddNumbers`` 测试方法复制到 ``setUpClass`` 方法和
[source,java]
@@ -280,7 +280,7 @@
}
----
-[start=3]
+
. 将用于关闭容器的代码从 ``testAddNumbers`` 测试方法复制到 ``tearDownClass`` 方法中。
[source,java]
@@ -293,7 +293,7 @@
}
----
-[start=4]
+
. 从 ``testAddNumbers`` 方法中删除多余的代码。保存所做的更改。
现在,测试类应如下所示。
@@ -382,7 +382,7 @@
单击 "Finish"(完成),此时将在编辑器中打开新的实体类。如果在 "Projects"(项目)窗口中展开 "Configuration Files"(配置文件)节点,则可以看到 IDE 自动生成了 ``persistence.xml`` 文件,该文件定义了 ``WebAppJUnitPU`` 持久性单元的属性。
-[start=8]
+
. 在编辑器中,将以下私有字段添加到实体类中。
[source,java]
@@ -391,13 +391,13 @@
private String name;
----
-[start=9]
+
. 在源代码编辑器中右键单击,选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键),然后选择 "Getter and Setter"(Getter 和 Setter),以打开 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框。
-[start=10]
+
. 在对话框中选择 ``name`` 字段。单击 "Generate"(生成)。
-[start=11]
+
. 将以下方法添加到类中。
[source,java]
@@ -409,7 +409,7 @@
}
----
-[start=12]
+
. 使用 ``@NamedQueries`` 和 ``@NamedQuery`` 标注来创建指定的 SQL 查询。
[source,java]
@@ -420,13 +420,13 @@
public class SimpleEntity implements Serializable {
----
-[start=13]
+
. 创建一个默认构造函数。
如果希望 IDE 生成构造函数,您可以单击类声明旁边的装订线中显示的建议图标。
-[start=14]
+
. 修复导入以添加 ``javax.persistence.NamedQueries`` 、 ``javax.persistence.NamedQuery`` 和 ``java.util.Date`` 的 import 语句。保存所做的更改。
除了默认的生成代码以外,实体类现在应类似于以下内容:
@@ -498,7 +498,7 @@
private EntityManager em;
----
-[start=3]
+
. 添加以下 ``verify`` 和 ``insert`` 方法。
[source,java]
@@ -528,7 +528,7 @@
}
----
-[start=4]
+
. 修复导入以导入 ``javax.persistence.Query`` 并保存所做的更改。
@@ -561,7 +561,7 @@
}
----
-[start=4]
+
. 在 "Projects"(项目)窗口中右键单击项目节点,然后从弹出式菜单中选择 "Test"(测试)。
此时将打开 "Test Results"(测试结果)窗口并显示类似下面的输出。
@@ -584,22 +584,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repository Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点并选择 *samples/javaee/WebAppJUnit*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
NOTE: 需要 Subversion 客户端检出源代码。有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted.asciidoc
index 9bbec97..54b8840 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted.asciidoc
@@ -82,13 +82,13 @@
4. Deselect the Use Dedicated Folder option, if selected. Click Next.
(For this tutorial there is little reason to copy project libraries to a dedicated folder because you will not need to share libraries with other users or projects.)
-[start=5]
+
. Select the GlassFish server and set the Java EE Version to Java EE 6 Web or Java EE 7 Web. Click Next.
image::images/newappwizard.png[title="Server and Settings panel in New Project wizard"]
-[start=6]
+
. Select JavaServer Faces in the Frameworks pane. Click Finish.
By default, the IDE will select the JSF 2.x library if you are developing a Java EE web application and deploying to the GlassFish server. The version of the default JSF library depends on the version bundled with your GlassFish server. The JSF 2.x library enables you to use Facelets as the page language and also provides support for JSF 1.2 and JSP.
@@ -135,13 +135,13 @@
You can keep the other default options (persistence unit name, EclipseLink persistence provider). Confirm that the persistence unit is using the Java Transaction API and that the Table Generation Strategy is set to Create so that the tables based on your entity classes are created when the application is deployed.
-[start=7]
+
. Click Finish in the New Entity Class wizard.
When you click Finish, the IDE creates the entity class and opens the class in the editor. You can see that the IDE generated the id field ``private Long id;`` and annotated the field with ``@Id`` and ``@GeneratedValue(strategy = GenerationType.AUTO)`` .
-[start=8]
+
. In the editor, add the ``message`` field (in bold) below the ``id`` field.
[source,java]
@@ -151,10 +151,10 @@
*private String message;*
----
-[start=9]
+
. Right-click in the editor and choose Insert Code (Alt-Insert; Ctrl-I on Mac) and then select Getter and Setter.
-[start=10]
+
. In the Generate Getters and Setters dialog box, select the ``message`` field and click Generate.
The IDE generates getter and setter methods for the field ``message`` .
@@ -162,7 +162,7 @@
image::images/getters-dialog.png[title="Create Persistence Unit wizard"]
-[start=11]
+
. Save your changes.
The entity class represents a table in the database. When you run this application, a database table for Message will be automatically created. The table will contain the columns ``id`` and ``message`` .
@@ -225,16 +225,16 @@
You will use the Managed Bean name ``MessageView`` as the value for the ``inputText`` and ``commandButton`` in the JSF page ``index.xhtml`` when calling methods in the bean.
-[start=4]
+
. Type *my.presentation* for the Package.
-[start=5]
+
. Type *MessageView* for the Name that will be used for the managed bean.
NOTE: When you create a managed bean using the wizard, the IDE will by default assign a name to the bean based on the name of the bean class and beginning with a lower-case letter. For this tutorial and demonstration purposes, you are explicitly assigning the bean a name that begins with an upper-case letter. When you reference the bean in the JSF pages you will use ``MessageView`` instead of ``messageView`` . If you did not explicitly assign the name, you would use the default ``messageView`` in the JSF page.
-[start=6]
+
. Set Scope to Request. Click Finish.
image::images/newjsfbean.png[title="New JSF Managed Bean wizard"]
@@ -287,7 +287,7 @@
----
-[start=3]
+
. Add the following code to create a new instance.
[source,java]
@@ -299,7 +299,7 @@
}
----
-[start=4]
+
. Add the following code to the class.
[source,java]
@@ -327,7 +327,7 @@
----
-[start=5]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) and save your changes.
You can use the code completion in the editor to help you type your code.
@@ -362,7 +362,7 @@
NOTE: If you copy and paste the code into the file, you will see a warning in the left margin next to the line containing ``<f:view>`` . You can place your insert cursor in the line and type Alt-Space to open the hint on how to resolve the error. The hint informs you that you need to add the ``xmlns:f="http://xmlns.jcp.org/jsf/core"`` library declaration.
-[start=3]
+
. Save your changes.
The ``inputText`` and ``commandButton`` components will invoke the methods in the named JSF managed bean ``MessageView`` . The ``postMessage`` method will return "theend", and the navigation handler will look for a page named ``theend.xhtml`` .
@@ -380,7 +380,7 @@
image::images/result-jsf-page.png[title="Creating the theend JSF file in the New JSF File wizard"]
-[start=5]
+
. Modify the file by typing the following between the <h:body> tags.
[source,xml]
@@ -405,7 +405,7 @@
When you choose Run, the IDE builds and deploys the application and opens ``index.xhtml`` in your browser.
-[start=2]
+
. Type a message in the text field. Click Post Message.
image::images/browser1.png[title="Application in browser"]
@@ -426,22 +426,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repository Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/javaee/SimpleEE6App*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
NOTE: You need a Subversion client to checkout the sources. For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ca.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ca.asciidoc
index 12763f1..c687265 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ca.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ca.asciidoc
@@ -84,13 +84,13 @@
4. Desmarqueu l'opció Utilitzar un directori dedicat per emmagatzemar biblioteques, si estès seleccionat. Cliqueu a Següent.
(Per aquesta guia d'aprenentatge no hi ha cap raó de pes per copiar les biblioteques del projecte a una carpeta dedicada perquè no necessitareu compartir les biblioteques amb altres usuaris o projectes.)
-[start=5]
+
. Establiu el servidor a GlassFish v3 i establiu la versió de Java EE a Java EE 6 web. Cliqueu a Següent.
image::../../../images_www/articles/71/javaee/gettingstarted/newappwizard.png[title="panell servidor i preferències en l'assistent de nou projecte"]
-[start=6]
+
. Seleccioneu JavaServer Faces en el panell de Frameworks. Cliqueu a Finalitzar
Per defecte, si esteu desenvolupant una aplicació web Java EE 6 i desplegant a GlassFish V3, l'IDE seleccionarà la biblioteca JSF2.0. La biblioteca JSF 2.0 us permet utilitzar Facelets com a llenguatge de la pàgina i també proporciona suport per a JSF 1.2 i JSP.
@@ -131,16 +131,16 @@
Podeu mantindre les altres opcions predeterminades (nom unitat de persistència, proveïdor de persistència EclipseLink). Comproveu que la unitat de persistència estigui utilitzant l'API de Transacció Java i que l'estratègia de generació de taula estigui establerta a Crear, ja que les tales basades en les vostres classes d'entitat són creades quant l'aplicació és desplegada.
-[start=7]
+
. Cliqueu a Crear, en l'assistent Nova unitat de persistència.
-[start=8]
+
. Cliqueu a Finalitzar el l'assistent de la nova classe d'entitat.
Quant cliqueu a Finalitzar, l'IDE crea la classe d'entitat i obre la classe en l'editor. Podeu veure que l'IDE ha generat el camp id ``private Long id;`` i ha anotat el camp amb ``@Id`` i ``@GeneratedValue(strategy = GenerationType.AUTO)`` .
-[start=9]
+
. En l'editor, afegiu el camp ``message`` (en negreta) després del camp ``id`` .
[source,java]
@@ -150,10 +150,10 @@
*private String message;*
----
-[start=10]
+
. Cliqueu amb el botó dret a l'editor i seleccioneu Inserir codi (Ctrl+I) i després seleccioneu Getter i Setter.
-[start=11]
+
. En el quadre de diàleg Generar Generate Getters i Setters, seleccioneu el camp ``message`` i cliqueu a Generar.
El IDE genera els mètodes getter i setter pel camp ``message`` .
@@ -161,7 +161,7 @@
image::images/getters-dialog.png[title="Assistent crear unitat de persistència"]
-[start=12]
+
. Deseu els vostres canvis.
La classe d'entitat representa una taula en la base de dades. Quant executeu aquesta aplicació, es crearà automàticament una taula Message a la base de dades. La taula contindrà les columnes ``id`` i ``message`` .
@@ -255,16 +255,16 @@
Utilitzareu el nom pel bean gestionat ``MessageView`` com el valor pel ``inputText`` i ``commandButton`` en la pàgina JSF ``index.xhtml`` quant crideu els mètodes en el bean.
-[start=4]
+
. Escriviu *my.presentation* pel paquet.
-[start=5]
+
. Escriviu *MessageView* pel nom que serà utilitzat pel bean gestionat.
Quan creeu el bean gestionat mitjançant l'assistent, l'IDE per defecte assignarà un nom al bean basat amb el nom de la classe bean.
-[start=6]
+
. Establir l'Àmbit a Petició. Cliqueu a Finalitzar
image::../../../images_www/articles/71/javaee/gettingstarted/newjsfbean.png[title="Nou assistent Bean gestionat per JSF"]
@@ -318,7 +318,7 @@
----
-[start=4]
+
. Afegiu el següent codi a la classe.
[source,java]
@@ -350,7 +350,7 @@
----
-[start=5]
+
. Corregiu les vostres importacions (Ctrl-Maj-I) i deseu els canvis.
Utilitzeu l'auto-completat de codi per a ajudar-vos quant escriviu el vostre codi.
@@ -383,7 +383,7 @@
image::images/jsfcodecompletion1.png[title="Auto-completat de codi en l'editor de codi"]
-[start=3]
+
. Deseu els vostres canvis.
Els components ``inputText`` i ``commandButton`` invocaran els mètodes en el bean gestionat JSF anomenat ``MessageView`` . El mètode ``postMessage`` retornarà "theend", i l'encarregat de navegació cercarà una pàgina anomenada ``theend.xhtml`` .
@@ -420,7 +420,7 @@
Quant seleccioneu Executar, l'IDE construeix i desplega l'aplicació i obre ``index.xhtml`` en el vostre navegador.
-[start=2]
+
. Escriviu un missatge en el camp de text. Cliqueu a Enviar missatge.
image::images/browser1.png[title="Aplicació en el navegador"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ja.asciidoc
index 840ce2a..e446ef3 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ja.asciidoc
@@ -82,13 +82,13 @@
4. 専用フォルダを使用するオプションが選択されている場合は選択を解除します。「次」をクリックします。
このチュートリアルでは、ライブラリを他のユーザーまたはプロジェクトと共有する必要がないので、プロジェクト・ライブラリを専用のフォルダにコピーする理由はほとんどありません。
-[start=5]
+
. 「GlassFish Server」を選択し、「Java EEバージョン」を「Java EE 6 Web」または「Java EE 7 Web」に設定します。「次」をクリックします。
image::images/newappwizard.png[title="新規プロジェクト・ウィザードの「サーバーと設定」パネル"]
-[start=6]
+
. 「フレームワーク」ペインで「JavaServer Faces」を選択します。「終了」をクリックします。
Java EE Webアプリケーションを開発し、GlassFishサーバーにデプロイしている場合は、デフォルトでJSF 2.xライブラリが選択されます。デフォルトのJSFライブラリのバージョンは、GlassFishサーバーにバンドルされているバージョンによって異なります。JSF 2.xライブラリにより、Faceletsをページ言語として使用でき、JSF 1.2およびJSPもサポートされます。
@@ -135,13 +135,13 @@
他のデフォルト・オプション(持続性ユニット名、EclipseLink持続性プロバイダ)はそのまま使用できます。持続性ユニットが「Java Transaction APIを使用」になっていること、およびアプリケーションデプロイ時にエンティティ・クラスに基づいた表が作成されるように「表生成戦略」が「作成」に設定されていることを確認します。
-[start=7]
+
. 新規エンティティ・クラス・ウィザードで「終了」をクリックします。
「終了」をクリックするとエンティティ・クラスが作成され、そのクラスがエディタに表示されます。IDEによってIDフィールド ``private Long id;`` が作成され、フィールドに ``@Id`` および ``@GeneratedValue(strategy=GenerationType.AUTO)`` という注釈が付与されます。
-[start=8]
+
. エディタで、 ``id`` フィールドの下に ``message`` フィールド(太字で表示)を追加します。
[source,java]
@@ -151,10 +151,10 @@
*private String message;*
----
-[start=9]
+
. エディタ内を右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、「取得メソッドおよび設定メソッド」を選択します。
-[start=10]
+
. 「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスで ``message`` フィールドを選択し、「生成」をクリックします。
``message`` フィールドに取得メソッドと設定メソッドが生成されます。
@@ -162,7 +162,7 @@
image::images/getters-dialog.png[title="「持続性ユニットを作成」ウィザード"]
-[start=11]
+
. 変更を保存します。
エンティティ・クラスは、データベース内の表を表します。このアプリケーションを実行すると、Messageのデータベース表が自動的に作成されます。この表には、 ``id`` 列と ``message`` 列が含まれます。
@@ -225,16 +225,16 @@
Beanでメソッドをコールするときに、管理対象Bean名の ``MessageView`` を、JSFページ ``index.xhtml`` の ``inputText`` および ``commandButton`` の値として使用します。
-[start=4]
+
. パッケージに「*my.presentation*」と入力します。
-[start=5]
+
. 管理対象Beanに使用する名前に「*MessageView*」と入力します。
NOTE: ウィザードを使用して管理対象Beanを作成すると、デフォルトでは、Beanクラスの名前に基づいて先頭を小文字にした名前がBeanに割り当てられます。このチュートリアルおよびデモでは、大文字で始まる名前をBeanに明示的に割り当てます。JSFページでこのBeanを参照するときは、 ``messageView`` ではなく ``MessageView`` を使用します。名前を明示的に割り当てなかった場合は、JSFページでデフォルトの ``messageView`` を使用します。
-[start=6]
+
. 「スコープ」を「リクエスト」に設定します。「終了」をクリックします。
image::images/newjsfbean.png[title="新規JSF管理対象Beanウィザード"]
@@ -287,7 +287,7 @@
----
-[start=3]
+
. 次のコードを追加して新しいインスタンスを作成します。
[source,java]
@@ -299,7 +299,7 @@
}
----
-[start=4]
+
. クラスに次のコードを追加します。
[source,java]
@@ -327,7 +327,7 @@
----
-[start=5]
+
. エディタ内を右クリックして「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、変更内容を保存します。
エディタでコード補完を使用すると、コードの入力に役立ちます。
@@ -362,7 +362,7 @@
NOTE: コードをコピーしてファイルに貼り付けると、 ``<f:view>`` がある行の左マージンに警告が表示されます。この行に挿入カーソルを置いて[Alt]-[Space]を入力すると、エラーの解決方法に関するヒントを開くことができます。このヒントは、 ``xmlns:f="http://xmlns.jcp.org/jsf/core"`` というライブラリ宣言を追加する必要があることを示しています。
-[start=3]
+
. 変更を保存します。
``inputText`` コンポーネントと ``commandButton`` コンポーネントが、名前付きのJSF管理対象Bean ``MessageView`` でメソッドを呼び出します。 ``postMessage`` メソッドが「theend」を返し、ナビゲーション・ハンドラが ``theend.xhtml`` という名前のページを検索します。
@@ -380,7 +380,7 @@
image::images/result-jsf-page.png[title="新規JSFファイル・ウィザードでのtheend JSFファイルの作成"]
-[start=5]
+
. 次のコードを<h:body> タグの間に入力してファイルを変更します。
[source,xml]
@@ -405,7 +405,7 @@
「実行」を選択すると、アプリケーションがビルドおよびデプロイされ、 ``index.xhtml`` がブラウザに表示されます。
-[start=2]
+
. テキスト・フィールドにメッセージを入力します。「Post Message」をクリックします。
image::images/browser1.png[title="ブラウザのアプリケーション"]
@@ -426,22 +426,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/javaee/SimpleEE6App*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
NOTE: ソースをチェックアウトするには、Subversionクライアントが必要です。Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_pt_BR.asciidoc
index 95b9388..c30dd73 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_pt_BR.asciidoc
@@ -82,13 +82,13 @@
4. Desmarque a opção Usar Pasta Dedicada, se ela estiver selecionada. Clique em Próximo.
(Para este tutorial, não há motivo para copiar as bibliotecas de projeto em uma pasta dedicada, pois você não precisará compartilhar bibliotecas com outros usuários ou projetos).
-[start=5]
+
. Selecione o servidor GlassFish Server e defina a versão do Java EE como Java EE 6 Web ou Java EE 7 Web. Clique em Próximo.
image::images/newappwizard.png[title="Painel Servidor e Definições no assistente Novo Projeto"]
-[start=6]
+
. Selecione JavaServer Faces no painel Frameworks. Clique em Finalizar.
Se você estiver desenvolvendo uma aplicação web Java EE e implantando-a no GlassFish Server, o IDE selecionará a biblioteca JSF 2.x como default. A versão da biblioteca JSF default depende da versão encapsulada de seu servidor GlassFish. A biblioteca JSF 2.x permite utilizar Facelets como a linguagem da página e também fornece o suporte para JSF 1.2 e JSP.
@@ -135,13 +135,13 @@
Você pode manter as outras opções default (nome da unidade de persistência, provedor da persistência EclipseLink). Confirme se a unidade de persistência está utilizando a Java Transaction API e se a Estratégia de Geração de Tabela é definida como Criar, para que as tabelas com base nas suas classes de entidade sejam criadas quando a aplicação é implantada.
-[start=7]
+
. Clique em Finalizar no assistente Nova Classe de Entidade.
Quando você clica em Finalizar, o IDE cria a classe de entidade e abre a classe no editor. Você pode ver que o IDE gerou o campo de id ``private Long id;`` e anotou o campo com ``@Id`` e ``@GeneratedValue(strategy = GenerationType.AUTO)`` .
-[start=8]
+
. No editor, adicione o campo ``mensagem`` (em negrito) abaixo do campo ``id`` .
[source,java]
@@ -151,10 +151,10 @@
*private String message;*
----
-[start=9]
+
. Clique com o botão direito do mouse no editor e selecione Inserir Código (Alt-Insert; Ctrl+I no Mac) e, em seguida, selecione Getter e Setter.
-[start=10]
+
. Na caixa de diálogo Gerar Getters e Setters, selecione o campo ``mensagem`` e clique em Gerar.
O IDE gera os métodos getter e setter para o campo ``mensagem`` .
@@ -162,7 +162,7 @@
image::images/getters-dialog.png[title="Assistente Criar Unidade de Persistência"]
-[start=11]
+
. Salve as alterações.
A classe de entidade representa uma tabela no banco de dados. Quando você executa esta aplicação, uma tabela do banco de dados para Mensagem será criada automaticamente. A tabela conterá as colunas ``id`` e ``mensagem`` .
@@ -225,16 +225,16 @@
Você utilizará o bean gerenciado de nome ``MessageView`` como o valor para ``inputText`` e ``commandButton`` na página JSF ``index.xhtml`` ao chamar métodos no bean.
-[start=4]
+
. Digite *my.presentation* para o Pacote.
-[start=5]
+
. Digite *MessageView* para o Nome que será utilizado para o bean gerenciado.
NOTE: Quando você cria um bean gerenciado utilizando o assistente, o IDE designará, por default, um nome para o bean, com base no nome da classe bean com uma letra minúscula. Para este tutorial e para fins de demonstração, você designa explicitamente ao bean um nome que começa com uma letra maiúscula. Ao referenciar o bean nas páginas JSF, você usará ``MessageView`` , em vez de ``messageView`` . Se você não tiver designado o nome explicitamente, deverá usar ``messageView`` default na página JSF.
-[start=6]
+
. Defina Escopo como Requisição. Clique em Finalizar.
image::images/newjsfbean.png[title="Novo assistente de Bean Gerenciado pelo JSF"]
@@ -287,7 +287,7 @@
----
-[start=3]
+
. Adicione o código a seguir para criar uma nova instância.
[source,java]
@@ -299,7 +299,7 @@
}
----
-[start=4]
+
. Adicione o seguinte código à classe.
[source,java]
@@ -327,7 +327,7 @@
----
-[start=5]
+
. Clique com o botão direito do mouse no editor, selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) e salve as alterações.
Você pode utilizar a funcionalidade para autocompletar código no editor para ajudar a digitar seu código.
@@ -362,7 +362,7 @@
NOTE: Se você copiar e colar o código no arquivo, receberá uma advertência na margem esquerda ao lado da linha que contém ``<f:view>`` . Você pode colocar o cursor de inserção na linha e digitar Alt-Espaço para abrir a dica sobre como resolver o erro. A dica informa que é necessário adicionar a declaração de biblioteca ``xmlns:f="http://xmlns.jcp.org/jsf/core"`` .
-[start=3]
+
. Salve as alterações.
Os componentes ``inputText`` e ``commandButton`` chamarão os métodos no bean gerenciado JSF nomeado ``MessageView`` . O método ``postMessage`` retornará "theend" e o handler de navegação procurará por uma página nomeada ``theend.xhtml`` .
@@ -380,7 +380,7 @@
image::images/result-jsf-page.png[title="Criando o arquivo JSF theend no assistente Novo Arquivo JSF"]
-[start=5]
+
. Modifique o arquivo digitando o seguinte entre as tags <h:body>.
[source,xml]
@@ -405,7 +405,7 @@
Quando você seleciona Executar, o IDE constrói e implanta a aplicação e abre o ``index.xhtml`` no browser.
-[start=2]
+
. Digite uma mensagem no campo de texto. Clique em Postar Mensagem.
image::images/browser1.png[title="Aplicação no browser"]
@@ -426,22 +426,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar Pastas do Repositório.
-[start=4]
+
. Expanda o nó de raiz e selecione *samples/javaee/SimpleEE6App*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
*Observações.*
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ru.asciidoc
index 93f2c32..a26c189 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_ru.asciidoc
@@ -82,13 +82,13 @@
4. Снимите флажок "Использовать отдельную папку", если он установлен. Нажмите кнопку "Далее".
(В рамках этого руководства копирование библиотек проекта в отдельную папку нецелесообразно, поскольку совместное использование библиотек с другими пользователями или проектами не требуется.)
-[start=5]
+
. Выберите сервер GlassFish и укажите Java EE 6 или Java EE 7 в качестве версии Java EE. Нажмите кнопку "Далее".
image::images/newappwizard.png[title="Панель 'Сервер и настройки' в мастере создания проектов"]
-[start=6]
+
. Выберите в панели "Платформы" JavaServer Faces. Нажмите кнопку "Завершить".
По умолчанию при разработке веб-приложения Java EE, развертываемого на сервере GlassFish, в среде IDE будет выбрана библиотека JSF 2.x. Версия используемой по умолчанию библиотеки JSF зависит от версии, поставляемой в комплекте с сервером GlassFish. Библиотека JSF 2.x позволяет использовать Facelets в качестве языка страниц и обеспечивает поддержку JSF 1.2 и JSP.
@@ -135,13 +135,13 @@
Можно сохранить другие параметры по умолчанию (имя блока сохранения состояния, поставщик сохранения состояния EclipseLink). Убедитесь в том, что для блока сохранения состояния используется интерфейс API транзакций Java и что для стратегии создания таблиц установлено значение "Создать", т. е. таблицы на основе классов сущностей создаются при развертывании приложения.
-[start=7]
+
. В мастере создания блока сохранения состояния нажмите кнопку "Завершить".
При нажатии кнопки "Завершить" в среде IDE будет создан класс сущностей, который откроется в редакторе. Как видно из примера, в среде IDE было создано поле id ``private Long id;`` , и для поля созданы аннотации ``@Id`` и ``@GeneratedValue(strategy = GenerationType.AUTO)`` .
-[start=8]
+
. В редакторе добавьте поле ``message`` (выделено полужирным шрифтом) под полем ``id`` .
[source,java]
@@ -151,10 +151,10 @@
*private String message;*
----
-[start=9]
+
. Щелкните правой кнопкой мыши в редакторе и выберите команду "Вставить код" (Alt-Insert; Ctrl-I для Mac), а затем "Получение и установка".
-[start=10]
+
. В диалоговом окне "Создание методов получения и установки" выберите поле ``message`` и нажмите кнопку "Создать".
В среде IDE будут созданы методы получения и установки для поля ``message`` .
@@ -162,7 +162,7 @@
image::images/getters-dialog.png[title="Мастер создания блоков сохранения состояния"]
-[start=11]
+
. Сохраните изменения.
Класс сущностей представляет собой таблицу в базе данных. При запуске этого приложения автоматически будет создана таблица базы данных для сообщения. Таблица будет состоять из столбцов ``id`` и ``message`` .
@@ -225,16 +225,16 @@
Имя управляемого компонента ``MessageView`` используется в качестве значения для ``inputText`` и ``commandButton`` на странице JSF ``index.xhtml`` при вызове методов в компоненте.
-[start=4]
+
. В поле "Пакет" введите *my.presentation*.
-[start=5]
+
. В поле "Имя", используемое для управляемого компонента, введите *MessageView*.
*Примечание.* При создании управляемого компонента с помощью мастера, IDE по умолчанию назначает имя компоненту на основе имени класса компонента, при этом имя будет начинаться с маленькой буквы. В данном руководстве и для демонстрационных целей вы назначаете базовому элементу имя, начинающееся с заглавной буквы. При ссылке на компонент на страницах JSF вы будете использовать ``MessageView`` вместо ``messageView`` . Если вы не назначали имени, то на странице JSF будет использоваться по умолчанию ``messageView`` .
-[start=6]
+
. Установите контекст для запроса. Нажмите кнопку "Завершить".
image::images/newjsfbean.png[title="Мастер создания новых управляемых компонентов JSF"]
@@ -287,7 +287,7 @@
----
-[start=3]
+
. Для создания нового экземпляра добавьте следующий код.
[source,java]
@@ -299,7 +299,7 @@
}
----
-[start=4]
+
. Добавьте следующий код к классу.
[source,java]
@@ -327,7 +327,7 @@
----
-[start=5]
+
. Щелкните правой кнопкой мыши в области редактора и выберите команду 'Исправить операторы импорта' (Alt-Shift-I; ⌘-Shift-I в Mac) и сохраните изменения.
Можно использовать автозавершение кода в редакторе, упрощающее ввод кода.
@@ -340,10 +340,10 @@
В этом упражнении будет выполнено несколько простых изменений страницы ``index.xhtml`` для добавления компонентов пользовательского интерфейса. Выполняется добавление формы с текстовым полем для ввода и кнопкой.
-[start=1]
+
. Откройте в редакторе ``index.xhtml`` .
-[start=2]
+
. Измените файл для добавления следующей простой формы между тегами ``<h:body>`` .
[source,xml]
@@ -366,7 +366,7 @@
*Примечание.* При копировании и вставке кода в файл отображается предупреждение на левом поле рядом со строков, содержащей ``<f:view>`` . Вы можете поместить курсор вставки на строку и нажать сочетание клавиш Alt-пробел для открытия подсказки по исправлению ошибки. Отображается подсказка о том, что требуется добавить объявление библиотеки ``xmlns:f="http://xmlns.jcp.org/jsf/core"`` .
-[start=3]
+
. Сохраните изменения.
Компоненты ``inputText`` и ``commandButton`` вызывают методы в управляемом компоненте JSF с именем ``MessageView`` . Метод ``postMessage`` возвращает "theend", а обработчик переходов выполняет поиск страницы с именем ``theend.xhtml`` .
@@ -384,7 +384,7 @@
image::images/result-jsf-page.png[title="Создание файла theend JSF в мастере создания файлов JSF"]
-[start=5]
+
. Измените файл посредством ввода следующего кода между тегов <h:body>.
[source,xml]
@@ -409,7 +409,7 @@
При выборе команды "Выполнить" в среде IDE происходит сборка и развертывание приложения, и в браузере открывается ``index.xhtml`` .
-[start=2]
+
. Введите сообщение в текстовое поле. Нажмите кнопку "Отправить сообщение".
image::images/browser1.png[title="Приложение в браузере"]
@@ -430,22 +430,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку Browse ("Обзор") для открытия диалогового окна Browse Repository Folders ("Обзор папок репозитория").
-[start=4]
+
. Разверните корневой узел и выберите *samples/javaee/SimpleEE6App*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечания.*
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_zh_CN.asciidoc
index 1eefadf..4246d23 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/javaee-gettingstarted_zh_CN.asciidoc
@@ -82,13 +82,13 @@
4. 取消选中 "Use Dedicated Folder"(使用专用文件夹)选项(如果该选项处于选中状态)。单击 "Next"(下一步)。
(在本教程中,我们将项目库复制到一个专门的文件夹中,因为需要与其他用户或项目共享库。)
-[start=5]
+
. 选择 "GlassFish Server",并将 "Java EE Version"(Java EE 版本)设置为 "Java EE 6 Web" 或 "Java EE 7 Web"。单击 "Next"(下一步)。
image::images/newappwizard.png[title="新建项目向导中的 "Server and Settings"(服务器和设置)面板"]
-[start=6]
+
. 在 "Frameworks"(框架)窗格中选择 "JavaServer Faces"。单击 "Finish"(完成)。
默认情况下,如果要开发 Java EE Web 应用程序并将其部署到 GlassFish Server 中,IDE 将选择 JSF 2.x 库。默认 JSF 库的版本取决于随 GlassFish Server 捆绑提供的版本。JSF 2.x 库允许将 Facelets 作为页面语言,并且还提供了 JSF 1.2 和 JSP 支持。
@@ -135,13 +135,13 @@
您可以保留其他默认选项(持久性单元名称、EclipseLink 持久性提供器)。确保持久性单元将使用 Java 事务 API,并且已将 "Table Generation Strategy"(表生成策略)设置为 "Create"(创建),以便在部署应用程序时将创建基于实体类的表。
-[start=7]
+
. 在新建实体类向导中单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将创建实体类并在编辑器中打开该类。您可以看到 IDE 生成了 id 字段 ``private Long id;`` 并使用 ``@Id`` 和 ``@GeneratedValue(strategy = GenerationType.AUTO)`` 标注该字段。
-[start=8]
+
. 在编辑器中,将 ``message`` 字段(以粗体显示)添加到 ``id`` 字段下面。
[source,java]
@@ -151,10 +151,10 @@
*private String message;*
----
-[start=9]
+
. 在编辑器中右键单击,选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键),然后选择 "Getter and Setter"(Getter 和 Setter)。
-[start=10]
+
. 在 "Generate Getters and Setters"(生成 getter 和 setter)对话框中,选择 ``message`` 字段,然后单击 "Generate"(生成)。
IDE 将为 ``message`` 字段生成 getter 和 setter 方法。
@@ -162,7 +162,7 @@
image::images/getters-dialog.png[title="创建持久性单元向导"]
-[start=11]
+
. 保存所做的更改。
实体类表示数据库中的表。在运行此应用程序时,将自动创建 Message 的数据库表。该表包含 ``id`` 和 ``message`` 列。
@@ -177,16 +177,16 @@
要创建会话 Bean,请执行以下步骤。
-[start=1]
+
. 右键单击项目节点,然后选择 "New"(新建)> "Other"(其他)。
-[start=2]
+
. 从 "Enterprise JavaBeans" 类别中选择 "Session Beans for Entity Classes"(实体类的会话 Bean)。单击 "Next"(下一步)。
-[start=3]
+
. 选择 ``Message`` 实体,然后单击 "Add"(添加)。单击 "Next"(下一步)。
-[start=4]
+
. 键入 *boundary* 作为包名。单击 "Finish"(完成)。
请注意,无需为会话 Bean 创建业务接口。相反,在此应用程序中,将使用无接口视图向本地受管 Bean 公开该 Bean。
@@ -233,16 +233,16 @@
在调用受管 Bean 中的方法时,将使用 Bean 名称 ``MessageView`` 作为 JSF 页 ``index.xhtml`` 中的 ``inputText`` 和 ``commandButton`` 的值。
-[start=4]
+
. 键入 *my.presentation* 作为包名。
-[start=5]
+
. 键入 *MessageView* 作为将用于受管 Bean 的名称。
NOTE: 在使用此向导创建受管 Bean 时,默认情况下 IDE 将会根据该 Bean 类的名称为该 Bean 指定名称,名称以小写字母开头。出于本教程和演示之目的,您要为 Bean 明确指定以小写字母开头的名称。在 JSF 页中引用 Bean 时,您要使用 ``MessageView`` 而不是 ``messageView`` 。如果尚未明确指定名称,则应在 JSF 页中使用默认的 ``messageView`` 。
-[start=6]
+
. 将 "Scope"(范围)设置为 "request"(请求)。单击 "Finish"(完成)。
image::images/newjsfbean.png[title="新建 JSF 受管 Bean 向导"]
@@ -295,7 +295,7 @@
----
-[start=3]
+
. 添加以下代码以创建新实例。
[source,java]
@@ -307,7 +307,7 @@
}
----
-[start=4]
+
. 在该类中添加以下代码。
[source,java]
@@ -335,7 +335,7 @@
----
-[start=5]
+
. 在编辑器中右键单击并选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 中为 ⌘-Shift-I 组合键),然后保存您的更改。
您可以在编辑器中使用代码完成以帮助键入代码。
@@ -370,7 +370,7 @@
NOTE: 如果将代码复制并粘贴到文件,您将会在 ``<f:view>`` 所在行旁边的左旁注中看到一条警告。您可以将插入光标放在该行中,然后按 Alt-Space 组合键以打开有关如何解决错误的提示。该提示告知您需要添加 ``xmlns:f="http://xmlns.jcp.org/jsf/core"`` 库声明。
-[start=3]
+
. 保存所做的更改。
``inputText`` 和 ``commandButton`` 组件将在命名 JSF 受管 Bean ``MessageView`` 中调用方法。 ``postMessage`` 方法返回 "theend",导航处理程序将查找名为 ``theend.xhtml`` 的页面。
@@ -381,22 +381,22 @@
在本练习中,将创建 JSF 页 ``theend.xhtml`` 。当用户在 ``index.xhtml`` 中单击 "Post Message" 按钮并在 JSF 受管 Bean 中调用 ``postMessage`` 方法时,将显示该页面。
-[start=1]
+
. 右键单击项目节点,然后选择 "New"(新建)> "Other"(其他)。
-[start=2]
+
. 从 "JavaServer Faces" 类别中选择 "JSF Page"(JSF 页)。单击 "Next"(下一步)。
-[start=3]
+
. 键入 *theend* 作为文件名。
-[start=4]
+
. 确认选择了 "Facelets" 选项。单击 "Finish"(完成)。
image::images/result-jsf-page.png[title="在新建 JSF 文件向导中创建 theend JSF 文件"]
-[start=5]
+
. 在 <h:body> 标记之间键入以下内容以修改该文件。
[source,xml]
@@ -421,7 +421,7 @@
在选择 "Run"(运行)时,IDE 构建和部署应用程序,并在浏览器中打开 ``index.xhtml`` 。
-[start=2]
+
. 在文本字段中键入消息。单击 "Post Message"。
image::images/browser1.png[title="浏览器中的应用程序"]
@@ -442,22 +442,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repository Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点并选择 *samples/javaee/SimpleEE6App*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
NOTE: 需要 Subversion 客户端检出源代码。有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing.asciidoc
index 6224ba1..ad327c3 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing.asciidoc
@@ -84,7 +84,7 @@
You can use the Maven version bundled with the IDE or specify the location of a local Maven installation (requires 2.0.9 or newer).
-[start=4]
+
. Click OK to close the Options window.
NOTE: Maven support is automatically enabled when Java is enabled in the IDE. You will need to enable the Java EE plugin if it is not enabled.
@@ -137,19 +137,19 @@
Alternatively, you can choose File > New File (Ctrl-N; ⌘-N on Mac) from the main menu and select Entity Class in the Persistence category.
-[start=2]
+
. Type *MyEntity* for the Class Name.
-[start=3]
+
. Select ``com.mycompany.mavenwebtestapp`` as the Package and set the Primary Key Type to * ``int`` *.
-[start=4]
+
. Confirm that Create Persistence Unit is selected. Click Next.
-[start=5]
+
. Select *jdbc/sample* in the Data Source dropdown list.
-[start=6]
+
. Confirm that Use Java Transaction APIs is selected and select Drop and Create as the Table Generation Strategy. Click Finish.
image::images/maven-testing-pu.png[title="Projects window showing generated projects"]
@@ -157,7 +157,7 @@
When you click Finish the IDE generates the MyEntity class and opens the class in the source editor. The IDE adds the ``eclipselink`` , ``javax.persistence`` and ``org.eclipse.persistence.jpa.modelgen.processor`` artifacts as project dependencies.
-[start=7]
+
. In the source editor, add the private field ``name`` to the class.
[source,java]
@@ -166,10 +166,10 @@
private String name;
----
-[start=8]
+
. Right-click in the editor and choose Getter and Setter in the Insert Code popup menu (Alt-Insert; Ctrl-I on Mac) to generate a getter and setter for the ``name`` field.
-[start=9]
+
. Add the following constructor.
[source,java]
@@ -181,7 +181,7 @@
}
----
-[start=10]
+
. Add the following ``@NamedQueries`` and ``@NamedQuery`` annotations (in bold) to create a named SQL query that will find all records in the MyEntity table.
[source,java]
@@ -194,13 +194,13 @@
----
-[start=11]
+
. Click the hint in the left margin next to the class declaration and choose the *Create default constructor* hint.
image::images/maven-testing-createconstructor.png[title="Projects window showing generated projects"]
-[start=12]
+
. Fix the import statements (Ctrl-Shift-I; ⌘-Shift-I on Mac) to add import statements for ``javax.persistence.NamedQuery`` , ``javax.persistence.NamedQueries`` and ``java.util.Date`` . Save your changes.
@@ -213,13 +213,13 @@
Alternatively, you can choose File > New File (Ctrl-N; ⌘-N on Mac) from the main menu to open the New File wizard.
-[start=2]
+
. Select Session Beans For Entity Classes in the Enterprise JavaBeans category. Click Next.
-[start=3]
+
. Select the ``MyEntity`` class from the list of Available Entity Classes and click Add. Click Next.
-[start=4]
+
. Use the default properties in the Generated Session Beans panel of the wizard. Click Finish.
When you click Finish the IDE generates ``AbstractFacade.java`` and ``MyEntityFacade.java`` in the ``com.mycompany.mavenwebtestapp`` package and opens the classes in the source editor.
@@ -247,7 +247,7 @@
}
----
-[start=5]
+
. Add the following methods to ``MyEntityFacade.java`` .
[source,java]
@@ -277,7 +277,7 @@
}
----
-[start=6]
+
. Fix your imports to add the required import statements. Save your changes.
image::images/maven-testing-fiximports.png[title="Projects window showing generated projects"]
@@ -300,13 +300,13 @@
By default, the IDE generates a skeleton test class that contains tests for each of the methods in ``MyEntityFacade`` and ``AbstractFacade`` . The IDE automatically adds a dependency on the JUnit 4.10 to the POM.
-[start=4]
+
. Annotate each of the test methods except ``testVerify`` with the ``@Ignore`` annotation. The IDE will skip each of the tests annotated with ``@Ignore`` when running the tests.
Alternatively, you can delete all the test methods except ``testVerify`` .
-[start=5]
+
. Locate the ``testVerify`` test method in the test class.
You can see that the test contains a line that calls on ``EJBContainer`` .
@@ -329,7 +329,7 @@
}
----
-[start=6]
+
. Make the following changes (in bold) to the skeleton of the ``testVerify`` test method.
[source,java]
@@ -350,13 +350,13 @@
}
----
-[start=7]
+
. Fix the import statements to add ``junit.framework.Assert`` . Save your changes.
You now need to modify the POM to add a dependency on the ``<glassfish.embedded-static-shell.jar>`` that is located in your local installation of the GlassFish server.
-[start=8]
+
. Open ``pom.xml`` in the editor and locate the ``<properties>`` element.
[source,xml]
@@ -369,7 +369,7 @@
----
-[start=9]
+
. Edit the ``<properties>`` element to add the ``<glassfish.embedded-static-shell.jar>`` element (in *bold*) that specifies the location of the JAR in your local GlassFish installation. You will then reference this property in the dependency on the artifact.
[source,xml]
@@ -387,13 +387,13 @@
NOTE: ``_<INSTALLATION_PATH>_`` is the absolute path to your local GlassFish installation. You will need to modify this element in the POM if the path to the local installation changes.
-[start=10]
+
. Right-click the Dependencies node in the Projects window and choose Add Dependency.
-[start=11]
+
. In the Add Dependency dialog box, type *embedded-static-shell* in the Query text field.
-[start=12]
+
. Locate the 4.0 JAR in the search results and click Add.
image::images/add-shell-dependency.png[title="Test Results window"]
@@ -403,7 +403,7 @@
You now want to modify the POM to specify the local installation of GlassFish as the source for the JAR.
-[start=13]
+
. Locate the dependency in the POM and make the following changes (in *bold*) to modify the element to reference the ``<glassfish.embedded-static-shell.jar>`` property that you added and to specify the ``<scope>`` . Save your changes.
[source,xml]
@@ -419,13 +419,13 @@
----
-[start=14]
+
. In the Services window, right-click the GlassFish Server node and choose Start.
The JavaDB database server will also start when you start the GlassFish Server.
-[start=15]
+
. In the Projects window, right-click the project node and choose Test.
When you choose Test the IDE will build application and run the test phase of the build lifecycle. The unit tests will be executed with the surefire plugin, which supports running JUnit 4.x tests. For more about the surefire plugin, see link:http://maven.apache.org/plugins/maven-surefire-plugin/[+http://maven.apache.org/plugins/maven-surefire-plugin/+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ja.asciidoc
index 58a9be1..f7cb544 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ja.asciidoc
@@ -84,7 +84,7 @@
IDEにバンドルされているMavenバージョンを使用することも、ローカルのMavenインストール(2.0.9以降が必要)の場所を指定することもできます。
-[start=4]
+
. 「OK」をクリックして「オプション」ウィンドウを閉じます。
NOTE: Mavenサポートは、IDEでJavaが有効になっている場合に自動的に有効になります。Java EEプラグインが有効になっていない場合は、有効にする必要があります。
@@ -137,19 +137,19 @@
または、メイン・メニューから「ファイル」>「新規ファイル」([Ctrl]-[N]、Macの場合は[⌘]-[N])を選択し、「持続性」カテゴリで「エンティティ・クラス」を選択することもできます。
-[start=2]
+
. 「クラス名」に「*MyEntity*」と入力します。
-[start=3]
+
. 「パッケージ」として「 ``com.mycompany.mavenwebtestapp`` 」を選択し、「主キー型」を* ``int`` *に設定します。
-[start=4]
+
. 「持続性ユニットを作成」が選択されていることを確認します。「次」をクリックします。
-[start=5]
+
. 「データ・ソース」ドロップダウン・リストで「*jdbc/sample*」を選択します。
-[start=6]
+
. 「Java Transaction APIを使用」が選択されていることを確認し、「表生成戦略」として「ドロップして作成」を選択します。「終了」をクリックします。
image::images/maven-testing-pu.png[title="生成されたプロジェクトを示す「プロジェクト」ウィンドウ"]
@@ -157,7 +157,7 @@
「終了」をクリックすると、IDEによってMyEntityクラスが生成され、ソース・エディタでクラスが開かれます。IDEによって、プロジェクト依存性として ``eclipselink`` 、 ``javax.persistence`` および ``org.eclipse.persistence.jpa.modelgen.processor`` アーティファクトが追加されます。
-[start=7]
+
. ソース・エディタで、クラスにprivateフィールド ``name`` を追加します。
[source,java]
@@ -166,10 +166,10 @@
private String name;
----
-[start=8]
+
. エディタ内を右クリックし、「コードを挿入」ポップアップ・メニューで「取得メソッドおよび設定メソッド」を選択して ``name`` フィールドの取得メソッドと設定メソッドを生成します。
-[start=9]
+
. 次のコンストラクタを追加します。
[source,java]
@@ -181,7 +181,7 @@
}
----
-[start=10]
+
. MyEntity表のすべてのレコードを検索する名前付きSQL問合せを作成するために、以下の ``@NamedQueries`` および ``@NamedQuery`` 注釈(太字部分)を追加します。
[source,java]
@@ -194,13 +194,13 @@
----
-[start=11]
+
. クラス宣言の左マージンにあるヒントをクリックして、「*デフォルト・コンストラクタを作成*」ヒントを選択します。
image::images/maven-testing-createconstructor.png[title="生成されたプロジェクトを示す「プロジェクト」ウィンドウ"]
-[start=12]
+
. インポート文を修正([Ctrl]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])して、 ``javax.persistence.NamedQuery`` 、 ``javax.persistence.NamedQueries`` および ``java.util.Date`` のインポート文を追加します。変更を保存します。
@@ -213,13 +213,13 @@
または、メイン・メニューから「ファイル」>「新規ファイル」([Ctrl]-[N]、Macの場合は[⌘]-[N])を選択して新規ファイル・ウィザードを開きます。
-[start=2]
+
. 「Enterprise JavaBeans」カテゴリで「エンティティ・クラスのセッションBean」を選択します。「次」をクリックします。
-[start=3]
+
. 「利用可能なエンティティ・クラス」のリストから ``MyEntity`` クラスを選択し、「追加」をクリックします。「次」をクリックします。
-[start=4]
+
. ウィザードの「生成されるセッションBean」パネルで、デフォルトのプロパティを使用します。「終了」をクリックします。
「終了」をクリックすると、IDEによって ``com.mycompany.mavenwebtestapp`` パッケージ内に ``AbstractFacade.java`` と ``MyEntityFacade.java`` が生成され、ソース・エディタでこれらのクラスが開きます。
@@ -247,7 +247,7 @@
}
----
-[start=5]
+
. ``MyEntityFacade.java`` に次のメソッドを追加します。
[source,java]
@@ -277,7 +277,7 @@
}
----
-[start=6]
+
. インポートを修正して必要なインポート文を追加します。変更を保存します。
image::images/maven-testing-fiximports.png[title="生成されたプロジェクトを示す「プロジェクト」ウィンドウ"]
@@ -300,13 +300,13 @@
デフォルトでは、IDEによって ``MyEntityFacade`` および ``AbstractFacade`` 内の各メソッド用のテストを含むスケルトン・テスト・クラスが生成されます。IDEによってJUnit 4.10への依存性がPOMに自動的に追加されます。
-[start=4]
+
. ``testVerify`` を除く各テスト・メソッドに ``@Ignore`` 注釈を付けます。テストを実行すると、IDEによって ``@Ignore`` 注釈の付いた各テストがスキップされます。
または、 ``testVerify`` 以外のすべてのテスト・メソッドを削除することもできます。
-[start=5]
+
. テスト・クラス内の ``testVerify`` テスト・メソッドを見つけます。
``EJBContainer`` をコールする行がテストに含まれていることがわかります。
@@ -329,7 +329,7 @@
}
----
-[start=6]
+
. ``testVerify`` テスト・メソッドのスケルトンに以下の変更(太字部分)を加えます。
[source,java]
@@ -350,13 +350,13 @@
}
----
-[start=7]
+
. インポート文を修正して ``junit.framework.Assert`` を追加します。変更を保存します。
ここでPOMを変更して、GlassFishサーバーのローカル・インストールにある ``<glassfish.embedded-static-shell.jar>`` に対する依存性を追加する必要があります。
-[start=8]
+
. エディタで ``pom.xml`` を開き、 ``<properties>`` 要素を見つけます。
[source,xml]
@@ -369,7 +369,7 @@
----
-[start=9]
+
. ``<properties>`` 要素を編集して、ローカルGlassFishインストールのJARの場所を指定する ``<glassfish.embedded-static-shell.jar>`` 要素(*太字*部分)を追加します。このプロパティをアーティファクトに対する依存性で参照します。
[source,xml]
@@ -387,13 +387,13 @@
NOTE: ``_<INSTALLATION_PATH>_`` は、ローカルGlassFishインストールの絶対パスです。ローカル・インストールへのパスが変更された場合は、POM内のこの要素を変更する必要があります。
-[start=10]
+
. 「プロジェクト」ウィンドウの「依存性」ノードを右クリックし、「依存性の追加」を選択します。
-[start=11]
+
. 「依存性の追加」ダイアログ・ボックスで、「問合せテキスト」フィールドに*「embedded-static-shell」*と入力します。
-[start=12]
+
. 検索結果で4.0 JARを見つけ、「追加」をクリックします。
image::images/add-shell-dependency.png[title="「テスト結果」ウィンドウ"]
@@ -403,7 +403,7 @@
ここでPOMを変更して、GlassFishのローカル・インストールをJARのソースとして指定します。
-[start=13]
+
. POMで依存性を見つけ、次のように(*太字*部分)、追加した ``<glassfish.embedded-static-shell.jar>`` プロパティを参照し、 ``<scope>`` を指定するよう要素を変更します。変更を保存します。
[source,xml]
@@ -419,13 +419,13 @@
----
-[start=14]
+
. 「サービス」ウィンドウで「GlassFish Server」ノードを右クリックし、「起動」を選択します。
GlassFish Serverを起動すると、JavaDBデータベース・サーバーも起動します。
-[start=15]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「テスト」を選択します。
「テスト」を選択すると、IDEによってアプリケーションがビルドされ、ビルド・ライフサイクルのテスト・フェーズが実行されます。この単体テストは、JUnit 4.xテストの実行をサポートするsurefireプラグインを使用して実行されます。surefireプラグインの詳細は、link:http://maven.apache.org/plugins/maven-surefire-plugin/[+http://maven.apache.org/plugins/maven-surefire-plugin/+]を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_pt_BR.asciidoc
index 2088bf9..bc1f381 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_pt_BR.asciidoc
@@ -84,7 +84,7 @@
Você pode usar a versão do Maven incorporada no IDE ou especificar a localização de uma instalação local do Maven (requer versão 2.0.9 ou posterior).
-[start=4]
+
. Clique em OK para fechar a janela Opções.
*Observações.* O suporte a Maven será automaticamente ativado quando o Java estiver ativado no IDE. Você precisará ativar o plug-in Java EE, se não estiver ativado.
@@ -139,19 +139,19 @@
Como alternativa, selecione Arquivo > Novo Arquivo (Ctrl-N; ⌘-N no Mac) no menu principal e selecione Classe de Entidade na categoria Persistência.
-[start=2]
+
. Digite *MyEntity* para o Nome da Classe.
-[start=3]
+
. Selecione ``com.mycompany.mavenwebtestapp`` como o Pacote e defina o Tipo de Chave Primária como * ``int`` *.
-[start=4]
+
. Confirme se Criar Unidade de Persistência está selecionado. Clique em Próximo.
-[start=5]
+
. Selecione *jdbc/sample* na lista drop-down Fonte de Dados.
-[start=6]
+
. Confirme se a opção Usar APIs de Transação Java está selecionada e selecione Soltar e Criar como a Estratégia de Geração de Tabela. Clique em Finalizar.
image::images/maven-testing-pu.png[title="Janela Projetos que mostra projetos gerados"]
@@ -159,7 +159,7 @@
Quando você clica em Finalizar, o IDE gera a classe MyEntity e abre a classe no editor de código-fonte. O IDE adiciona os artefatos ``eclipselink`` , ``javax.persistence`` e ``org.eclipse.persistence.jpa.modelgen.processor`` como dependências de projeto.
-[start=7]
+
. No editor de código-fonte, adicione o campo privado ``nome`` à classe.
[source,java]
@@ -168,10 +168,10 @@
private String name;
----
-[start=8]
+
. Clique com o botão direito do mouse no editor e selecione Getter e Setter no menu pop-up Inserir Código (Alt-Insert; Ctrl+I no Mac) para gerar um getter e um setter para o campo ``nome`` .
-[start=9]
+
. Adicione o construtor a seguir.
[source,java]
@@ -183,7 +183,7 @@
}
----
-[start=10]
+
. Adicione as anotações ``@NamedQueries`` e ``@NamedQuery`` a seguir (em negrito) para criar uma consulta SQL nomeada que localizará todos os registros na tabela MyEntity.
[source,java]
@@ -196,13 +196,13 @@
----
-[start=11]
+
. Clique na dica na margem esquerda próximo da declaração de classe e selecione a dica *Criar construtor default*.
image::images/maven-testing-createconstructor.png[title="Janela Projetos que mostra projetos gerados"]
-[start=12]
+
. Corrija as instruções de importação (Ctrl-Shift-I; ⌘-Shift-I no Mac) para adicionar instruções de importação para ``javax.persistence.NamedQuery`` , ``javax.persistence.NamedQueries`` e ``java.util.Date`` . Salve as alterações.
@@ -215,13 +215,13 @@
Como alternativa, selecione Arquivo > Novo Arquivo (Ctrl-N; ⌘-N no Mac) no menu principal para abrir o assistente Novo Arquivo.
-[start=2]
+
. Selecione Beans de Sessão para Classes de Entidade na categoria Enterprise JavaBeans. Clique em Próximo.
-[start=3]
+
. Na lista de Classes de Entidade Disponíveis, selecione ``MyEntity`` e clique em Adicionar. Clique em Próximo.
-[start=4]
+
. Use as propriedades default no painel Beans de Sessão Gerados do assistente. Clique em Finalizar.
Quando você clicar em Finalizar, o IDE gerará ``AbstractFacade.java`` e ``MyEntityFacade.java`` no pacote ``com.mycompany.mavenwebtestapp`` e abrirá as classes no editor de código-fonte.
@@ -249,7 +249,7 @@
}
----
-[start=5]
+
. Adicione os seguintes métodos a ``MyEntityFacade.java`` .
[source,java]
@@ -279,7 +279,7 @@
}
----
-[start=6]
+
. Corrija suas importações para adicionar as instruções de importação necessárias. Salve as alterações.
image::images/maven-testing-fiximports.png[title="Janela Projetos que mostra projetos gerados"]
@@ -302,13 +302,13 @@
Por default, o IDE gera uma classe de teste esqueleto que contém testes para cada um dos métodos em ``MyEntityFacade`` e ``AbstractFacade`` . O IDE adiciona, automaticamente, uma dependência no JUnit 4.10 para o POM.
-[start=4]
+
. Anote cada um dos métodos de teste, exceto ``testVerify`` , com a anotação ``@Ignore`` . O IDE ignorará cada um dos testes anotados com ``@Ignore`` ao executar os testes.
Como alternativa, você pode deletar todos os métodos de teste, exceto ``testVerify`` .
-[start=5]
+
. Localize o método de teste ``testVerify`` na classe de teste.
Você pode ver que o teste contém uma linha que chama ``EJBContainer`` .
@@ -331,7 +331,7 @@
}
----
-[start=6]
+
. Faça as seguintes alterações (em negrito) no esqueleto do método de teste ``testVerify`` .
[source,java]
@@ -352,13 +352,13 @@
}
----
-[start=7]
+
. Corrija as instruções de importação para adicionar ``junit.framework.Assert`` . Salve as alterações.
Você agora precisa modificar o POM para adicionar uma dependência ao ``<glassfish.embedded-static-shell.jar>`` que está localizado em sua instalação local do GlassFish Server.
-[start=8]
+
. Abra ``pom.xml`` no editor e localize o elemento ``<properties>`` .
[source,xml]
@@ -371,7 +371,7 @@
----
-[start=9]
+
. Edite o elemento ``<properties>`` para adicionar o elemento ``<glassfish.embedded-static-shell.jar>`` (em *negrito*) que especifica a localização do JAR em sua instalação GlassFish local. Em seguida, você fará referência a esta propriedade na dependência do artefato.
[source,xml]
@@ -389,13 +389,13 @@
NOTE: ``_<INSTALLATION_PATH>_`` é o caminho absoluto para sua instalação do GlassFish local. Será preciso modificar esse elemento no POM se o caminho para a instalação local for alterado.
-[start=10]
+
. Clique com o botão direito do mouse no nó Dependências na janela Projetos e selecione Adicionar Dependência.
-[start=11]
+
. Na caixa de diálogo Adicionar Dependência, digite *embedded-static-shell* no campo de texto Consultar.
-[start=12]
+
. Localize o JAR 4.0 nos resultados da pesquisa e clique em Adicionar.
image::images/add-shell-dependency.png[title="Janela Resultados do Teste"]
@@ -405,7 +405,7 @@
Agora você quer modificar o POM para especificar a instalação local do GlassFish como a origem para o JAR.
-[start=13]
+
. Localize a dependência no POM e faça as seguintes alterações (em *negrito*) para modificar o elemento para fazer referência à propriedade ``<glassfish.embedded-static-shell.jar>`` que você adicionou e para especificar o ``<escopo>`` . Salve as alterações.
[source,xml]
@@ -421,13 +421,13 @@
----
-[start=14]
+
. Na janela Serviços, clique com o botão direito do mouse no nó GlassFish Server e selecione Iniciar.
O servidor do banco de dados JavaDB também será iniciado quando você iniciar o GlassFish Server.
-[start=15]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Testar,
Quando você selecionar Testar, o IDE construirá a aplicação e executará a fase de teste do ciclo de vida da construção. Os testes de unidade serão executados com o plug-in surefire, que suporta a execução de testes JUnit 4.x. Para saber mais sobre o plug-in surefire, consulte link:http://maven.apache.org/plugins/maven-surefire-plugin/[+http://maven.apache.org/plugins/maven-surefire-plugin/+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ru.asciidoc
index 18f7cf6..8d32253 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_ru.asciidoc
@@ -84,7 +84,7 @@
Можно использовать версию Maven, входящую в комплект среды IDE, либо указать местоположение локальной установки Maven (требуется версия 2.0.9 или более поздняя).
-[start=4]
+
. Для закрытия окна "Параметры" нажмите кнопку "ОК".
*Примечания.* Поддержка Maven автоматически включается при включении Java в среде IDE. Если нет, необходимо включить подключаемый модуль Java EE.
@@ -139,19 +139,19 @@
В качестве альтернативы можно использовать 'Файл' > 'Создать файл' (Ctrl-N; ⌘-N в Mac) в главном меню и выбрать 'Класс сущности' в категории 'Сохраняемость'.
-[start=2]
+
. Введите *MyEntity* для имени класса.
-[start=3]
+
. Выберите ``com.mycompany.mavenwebtestapp`` в качестве пакета и установите тип первичного ключа * ``int`` *.
-[start=4]
+
. Подтвердите выбор "Создать единицу сохранения состояния". Нажмите кнопку "Далее".
-[start=5]
+
. Выберите *jdbc/sample* из раскрывающегося списка "Источник данных".
-[start=6]
+
. Подтвердите выбор "Использовать интерфейсы API транзакций Java" и выберите "Удалить и создать" в качестве стратегии создания таблицы. Нажмите кнопку 'Готово'.
image::images/maven-testing-pu.png[title="В окне 'Проекты' отображаются созданные проекты"]
@@ -159,7 +159,7 @@
После нажатия кнопки "Готово" среда IDE создает класс MyEntity и открывает его в редакторе исходного кода. В качестве зависимостей проекта IDE добавляет артефакты ``eclipselink`` , ``javax.persistence`` и ``org.eclipse.persistence.jpa.modelgen.processor`` .
-[start=7]
+
. В редакторе исходного поля добавьте к классу закрытое поле ``имя`` .
[source,java]
@@ -168,10 +168,10 @@
private String name;
----
-[start=8]
+
. Правой кнопкой мыши щелкните редактор и выберите "Методы получения и установки" во всплывающем меню "Вставка кода" (Alt-Insert; Ctrl-I на Mac), чтобы создать метод получения и установки для поля ``имя`` .
-[start=9]
+
. Добавьте следующий конструктор.
[source,java]
@@ -183,7 +183,7 @@
}
----
-[start=10]
+
. Добавьте следующие аннотации ``@NamedQueries`` и ``@NamedQuery`` (выделено жирным), чтобы создать запрос SQL с именем, который выполнит поиск всех записей в таблице MyEntity.
[source,java]
@@ -196,13 +196,13 @@
----
-[start=11]
+
. Щелкните подсказку в поле слева, рядом с объявлением класса, и выберите подсказку *Создать конструктор по умолчанию*.
image::images/maven-testing-createconstructor.png[title="В окне 'Проекты' отображаются созданные проекты"]
-[start=12]
+
. Исправьте импортированные операторы (Ctrl-Shift-I; ⌘-Shift-I в Mac) для добавления операторов импорта для ``javax.persistence.NamedQuery`` , ``javax.persistence.NamedQueries`` и ``java.util.Date`` . Сохраните изменения.
@@ -215,13 +215,13 @@
В качестве альтернативы можно использовать 'Файл' > 'Создать файл' (Ctrl-N; ⌘-N в Mac) в главном меню, чтобы открыть мастер создания файлов.
-[start=2]
+
. Выберите сеансные компоненты для классов сущностей в категории Enterprise JavaBeans. Нажмите кнопку "Далее".
-[start=3]
+
. Выберите класс ``MyEntity`` из списка доступных классов сущностей и нажмите кнопку "Добавить". Нажмите кнопку "Далее".
-[start=4]
+
. Используйте свойства по умолчанию на панели мастера "Созданные сеансные компоненты". Нажмите кнопку 'Готово'.
При нажатии кнопки "Готово" среда IDE создает ``AbstractFacade.java`` и ``MyEntityFacade.java`` в пакете ``com.mycompany.mavenwebtestapp`` и открывает классы в редакторе исходных кодов.
@@ -249,7 +249,7 @@
}
----
-[start=5]
+
. Добавьте следующие методы к ``MyEntityFacade.java`` .
[source,java]
@@ -279,7 +279,7 @@
}
----
-[start=6]
+
. Исправьте операторы импорта, чтобы добавить импорт всего, что нужно. Сохраните изменения.
image::images/maven-testing-fiximports.png[title="В окне 'Проекты' отображаются созданные проекты"]
@@ -302,13 +302,13 @@
По умолчанию среда IDE создает скелет тестового класса, содержащий тесты для каждого из методов в ``MyEntityFacade`` и ``AbstractFacade`` . Среда IDE автоматически добавляет к файлу POM зависимость от JUnit 4.10.
-[start=4]
+
. Аннотируйте каждый из тестовых методов, кроме ``testVerify`` , с помощью аннотации ``@Ignore`` . Выполняя тесты, среда IDE пропустит все тесты с аннотацией ``@Ignore`` .
Также можно удалить все тестовые методы, кроме ``testVerify`` .
-[start=5]
+
. Расположите метод теста ``testVerify`` в тестовом классе.
Тест содержит строку, вызывающую ``EJBContainer`` .
@@ -331,7 +331,7 @@
}
----
-[start=6]
+
. Внесите следующие изменения (выделено полужирным) в схему метода теста ``testVerify`` .
[source,java]
@@ -352,13 +352,13 @@
}
----
-[start=7]
+
. Исправьте выражения импорта для добавления ``junit.framework.Assert`` . Сохраните изменения.
Теперь необходимо внести изменения в файл POM и добавить зависимость от файла ``<glassfish.embedded-static-shell.jar>`` , расположенного в локальном каталоге установки сервера GlassFish.
-[start=8]
+
. Откройте файл ``pom.xml`` в редакторе и найдите элемент ``<properties>`` .
[source,xml]
@@ -371,7 +371,7 @@
----
-[start=9]
+
. Отредактируйте элемент ``<properties>`` , добавив в него элемент ``<glassfish.embedded-static-shell.jar>`` (выделен *полужирным шрифтом*), указывающий местоположение файла JAR в локальном каталоге установки GlassFish. Затем необходимо создать ссылку на это свойство в зависимости артефакта.
[source,xml]
@@ -389,13 +389,13 @@
NOTE: ``_<INSTALLATION_PATH>_`` - абсолютный путь к локальному каталогу установки GlassFish. В случае изменения пути к локальной установке потребуется изменить этот элемент в файле POM.
-[start=10]
+
. Щелкните правой кнопкой мыши узел "Зависимости" в окне проектов и выберите пункт "Добавить зависимость".
-[start=11]
+
. В диалоговом окне 'Добавление зависимости' в текстовом поле 'Запрос' введите *embedded-static-shell*.
-[start=12]
+
. Выделите файл 4.0 JAR в результатах поиска и нажмите 'Добавить'.
image::images/add-shell-dependency.png[title="Окно 'Результаты теста'"]
@@ -405,7 +405,7 @@
Теперь нужно внести изменения в файл POM, указав локальный каталог установки GlassFish в качестве источника JAR.
-[start=13]
+
. Найдите соответствующую зависимость в файле POM и внесите изменения (выделены *полужирным шрифтом*). Создайте в элементе ссылку на ранее добавленное свойство ``<glassfish.embedded-static-shell.jar>`` и укажите область ( ``<scope>`` ). Сохраните изменения.
[source,xml]
@@ -421,13 +421,13 @@
----
-[start=14]
+
. В окне 'Службы' щелкните правой кнопкой мыши узел GlassFish Server и выберите 'Пуск'.
Сервер базы данных JavaDB будет также запускаться при запуске сервера GlassFish.
-[start=15]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел проекта и выберите 'Тестирование'.
После выбора пункта "Тест" среда IDE создаст приложение и запустит этап тестирования жизненного цикла сборки. Модульные тесты будут выполнены при помощи подключаемого модуля surefire, который поддерживает запуск тестов JUnit 4.x. Подробнее о подключаемом модуле surefire см. link:http://maven.apache.org/plugins/maven-surefire-plugin/[+http://maven.apache.org/plugins/maven-surefire-plugin/+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_zh_CN.asciidoc
index 27bdc09..c821524 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp-testing_zh_CN.asciidoc
@@ -83,7 +83,7 @@
您可以使用与 IDE 捆绑在一起的 Maven 版本,也可以指定 Maven 在本地的安装位置(要求为 2.0.9 或更高版本)。
-[start=3]
+
. 选择“确定”以关闭“选项”窗口。
NOTE: 在 IDE 中启用 Java 后,会自动启用 Maven 支持。您将需要启用 Java EE 插件(如果尚未启用)。
@@ -136,19 +136,19 @@
此外,也可以从主菜单中选择 "File"(文件)> "New File"(新建文件)(Ctrl-N 组合键;在 Mac 上为 ⌘-N 组合键),然后在 "Persistence"(持久性)类别中选择 "Entity Class"(实体类)。
-[start=2]
+
. 键入 *MyEntity* 作为类名。
-[start=3]
+
. 选择 ``com.mycompany.mavenwebtestapp`` 作为包,并将 "Primary Key Type"(主键类型)设置为 * ``int`` *。
-[start=4]
+
. 确认选中了 "Create Persistence Unit"(创建持久性单元)。单击 "Next"(下一步)。
-[start=5]
+
. 在 "Data Source"(数据源)下拉列表中选择 *jdbc/sample*。
-[start=6]
+
. 确认选中了 "Use Java Transaction APIs"(使用 Java 事务 API),然后选择 "Drop and Create"(删除并创建)作为 "Table Generation Strategy"(表生成策略)。单击 "Finish"(完成)。
image::images/maven-testing-pu.png[title="显示已生成项目的 "Projects"(项目)窗口"]
@@ -156,7 +156,7 @@
在单击 "Finish"(完成)后,IDE 将生成 MyEntity 类,并在源代码编辑器中打开该类。IDE 将添加 ``eclipselink`` 、 ``javax.persistence`` 和 ``org.eclipse.persistence.jpa.modelgen.processor`` 工件作为项目依赖关系。
-[start=7]
+
. 在源代码编辑器中,将私有字段 ``name`` 添加到类中。
[source,java]
@@ -165,10 +165,10 @@
private String name;
----
-[start=8]
+
. 在编辑器中右键单击,然后从 "Insert Code"(插入代码)弹出式菜单(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键)中选择 "Getter and Setter"(Getter 和 Setter),以便为 ``name`` 字段生成 getter 和 setter。
-[start=9]
+
. 添加以下构造函数。
[source,java]
@@ -180,7 +180,7 @@
}
----
-[start=10]
+
. 添加以下 ``@NamedQueries`` 和 ``@NamedQuery`` 标注(以粗体显示),以创建命名 SQL 查询,用于在 MyEntity 表中查找所有记录。
[source,java]
@@ -193,13 +193,13 @@
----
-[start=11]
+
. 单击类声明旁边左旁注中的提示,然后选择 *Create default constructor*(创建默认的构造函数)提示。
image::images/maven-testing-createconstructor.png[title="显示已生成项目的 "Projects"(项目)窗口"]
-[start=12]
+
. 修复 import 语句(Ctrl-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键),以便为 ``javax.persistence.NamedQuery`` 、 ``javax.persistence.NamedQueries`` 和 ``java.util.Date`` 添加 import 语句。保存所做的更改。
@@ -212,13 +212,13 @@
此外,也可以从主菜单中选择 "File"(文件)> "New File"(新建文件)(Ctrl-N 组合键;在 Mac 上为 ⌘-N 组合键),以打开新建文件向导。
-[start=2]
+
. 在 "Enterprise JavaBeans" 类别中,选择 "Session Beans For Entity Classes"(实体类的会话 Bean)。单击 "Next"(下一步)。
-[start=3]
+
. 从 "Available Entity Classes"(可用的实体类)列表中选择 ``MyEntity`` 类,然后单击 "Add"(添加)。单击 "Next"(下一步)。
-[start=4]
+
. 使用该向导的 "Generated Session Beans"(生成的会话 Bean)面板中的默认属性。单击 "Finish"(完成)。
在单击 "Finish"(完成)后,IDE 将在 ``com.mycompany.mavenwebtestapp`` 包中生成 ``AbstractFacade.java`` 和 ``MyEntityFacade.java`` ,并在源编辑器中打开这些类。
@@ -246,7 +246,7 @@
}
----
-[start=5]
+
. 将以下方法添加到 ``MyEntityFacade.java`` 中。
[source,java]
@@ -276,7 +276,7 @@
}
----
-[start=6]
+
. 修复导入以添加所需的 import 语句。保存所做的更改。
image::images/maven-testing-fiximports.png[title="显示已生成项目的 "Projects"(项目)窗口"]
@@ -299,13 +299,13 @@
默认情况下,IDE 将生成框架测试类,其中包含 ``MyEntityFacade`` 和 ``AbstractFacade`` 中每个方法的测试。IDE 自动将 JUnit 4.10 的依赖关系添加到 POM 中。
-[start=4]
+
. 使用 ``@Ignore`` 标注对每个测试方法( ``testVerify`` 除外)进行标注。运行测试时,IDE 将跳过使用 ``@Ignore`` 标注的每个测试。
此外,也可以删除所有测试方法,但 ``testVerify`` 除外。
-[start=5]
+
. 找到测试类中的 ``testVerify`` 测试方法。
您可以看到该测试包含调用 ``EJBContainer`` 的一行。
@@ -328,7 +328,7 @@
}
----
-[start=6]
+
. 对 ``testVerify`` 测试方法的框架进行以下更改(以粗体显示)。
[source,java]
@@ -349,13 +349,13 @@
}
----
-[start=7]
+
. 修复 import 语句以添加 ``junit.framework.Assert`` 。保存所做的更改。
现在,您需要修改 POM 以添加位于 GlassFish Server 本地安装中的 ``<glassfish.embedded-static-shell.jar>`` 的依赖关系。
-[start=8]
+
. 在编辑器中打开 ``pom.xml`` 并找到 ``<properties>`` 元素。
[source,xml]
@@ -368,7 +368,7 @@
----
-[start=9]
+
. 编辑 ``<properties>`` 元素以添加 ``<glassfish.embedded-static-shell.jar>`` 元素(*粗体*),后者指定本地 GlassFish 安装中的 JAR 位置。然后,将在工件的依赖关系中引用此属性。
[source,xml]
@@ -386,13 +386,13 @@
NOTE: ``_<INSTALLATION_PATH>_`` 是本地 GlassFish 安装的绝对路径。如果该本地安装路径发生变化,则需要修改 POM 中的此元素。
-[start=10]
+
. 在 "Projects"(项目)窗口中右键单击 "Dependencies"(依赖关系)节点,然后选择 "Add Dependency"(添加依赖关系)。
-[start=11]
+
. 在 "Add Dependency"(添加依赖关系)对话框的 "Query"(查询)文本字段中,键入 *embedded-static-shell*。
-[start=12]
+
. 在搜索结果中找到 4.0 JAR,然后单击 "Add"(添加)。
image::images/add-shell-dependency.png[title=""Test Results"(测试结果)窗口"]
@@ -402,7 +402,7 @@
您现在需要修改 POM 以将 GlassFish 的本地安装指定为 JAR 的源。
-[start=13]
+
. 找到 POM 中的依赖关系并进行以下更改(*粗体*),以将元素修改为引用您添加的 ``<glassfish.embedded-static-shell.jar>`` 属性并指定 ``<scope>`` 。保存所做的更改。
[source,xml]
@@ -418,13 +418,13 @@
----
-[start=14]
+
. 在 "Services"(服务)窗口中,右键单击 "GlassFish Server" 节点并选择 "Start"(启动)。
当启动 GlassFish Server 时,还会启动 JavaDB 数据库服务器。
-[start=15]
+
. 在 "Projects"(项目)窗口中,右键单击项目节点,然后选择 "Test"(测试)。
在选择 "Test"(测试)时,IDE 将构建应用程序,并运行构建生命周期的测试阶段。单元测试将使用 Surefire 插件执行,该插件支持运行 JUnit 4.x 测试。有关 Surefire 插件的更多信息,请参见 link:http://maven.apache.org/plugins/maven-surefire-plugin/[+http://maven.apache.org/plugins/maven-surefire-plugin/+]。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp.asciidoc
index 7d1ddcc..d1e5d17 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp.asciidoc
@@ -96,7 +96,7 @@
You can use the Maven version bundled with the IDE or specify the location of a local Maven installation (requires 2.0.9 or newer).
-[start=4]
+
. Click OK to close the Options window.
NOTE: Maven support is automatically enabled when Java is enabled in the IDE. You will need to enable the Java EE plugin if it is not enabled.
@@ -135,22 +135,22 @@
image::images/maven-newproject1.png[title="Maven Enterprise Application project type in the New Project wizard"]
-[start=3]
+
. Type *MavenEnterpriseApp* for the the Project Name and set the Project Location.
-[start=4]
+
. (Optional) Modify the artifact details. Click Next.
image::images/maven-newproject2.png[title="Maven Project details in the New Project wizard"]
-[start=5]
+
. Select GlassFish Server for the Server.
-[start=6]
+
. Set the Java EE Version to Java EE 6 or Java EE 7.
-[start=7]
+
. Select Create EJB Module and Create Web App Module. Click Finish.
When you click Finish, the IDE creates the following projects from the Maven Enterprise Application archetype.
@@ -190,7 +190,7 @@
You can keep the other default options (persistence unit name, EclipseLink persistence provider).
-[start=5]
+
. Ensure that Use Java Transaction APIs is selected and that the Table Generation Strategy is set to Create so that the tables based on your entity classes are created when the application is deployed. Click Finish.
image::images/maven-persistenceunit.png[title="New Persistence Unit wizard"]
@@ -236,13 +236,13 @@
private String body;
----
-[start=2]
+
. Right-click in the Source Editor between the class definition and choose Insert Code (Alt-Insert; Ctrl-I on Mac) > Getter and Setter.
-[start=3]
+
. In the Generate Getters and Setters dialog box, select the ``body`` and ``title`` fields. Click Generate.
-[start=4]
+
. Save your changes to the class.
@@ -264,13 +264,13 @@
image::images/maven-messagedestination.png[title="Add Message Destination dialog"]
-[start=7]
+
. Confirm that the project destination is correct. Click Next.
image::images/maven-newmdb.png[title="New Message-Driven Bean wizard"]
-[start=8]
+
. Accept the default settings in the Activation Config Properties. Click Finish.
When you click Finish, the IDE generates the bean class and adds the following annotations that identify the class as a message-driven bean and configuration properties.
@@ -294,7 +294,7 @@
}
----
-[start=9]
+
. Inject the ``MessageDrivenContext`` resource into the class by adding the following annotated field to the class.
[source,java]
@@ -307,7 +307,7 @@
----
-[start=10]
+
. Introduce the entity manager into the class by adding the following annotated field (in bold).
[source,java]
@@ -325,7 +325,7 @@
The ``@PersistenceContext`` annotation specifies the context by declaring the persistence unit. The ``unitName`` value is the name of the persistence unit.
-[start=11]
+
. Add the following ``save`` method (in bold).
[source,java]
@@ -343,7 +343,7 @@
}*
----
-[start=12]
+
. Modify the ``onMessage`` method by adding the following (in bold) to the body:
[source,java]
@@ -366,7 +366,7 @@
}
----
-[start=13]
+
. Fix your import statements (Ctrl-Shift-I; ⌘-Shift-I on Mac) and save your changes.
NOTE: When generating the import statements, you want to make sure to import the * ``jms`` * and * ``javax.annotation.Resource`` * libraries.
@@ -404,10 +404,10 @@
When you click Finish, the class ``ListNews.java`` opens in the Source Editor.
-[start=4]
+
. Right-click in the Source Editor between the class definition and choose Insert Code (Alt-Insert; Ctrl-I on Mac) > Call Enterprise Bean.
-[start=5]
+
. In the Call Enterprise Bean dialog box, expand the MavenEnterpriseApp-ejb node and select NewsEntityFacade. Click OK.
image::images/maven-callbean.png[title="Call Enterprise Bean dialog"]
@@ -424,7 +424,7 @@
private NewsEntityFacade newsEntityFacade;
----
-[start=6]
+
. In the ``processRequest`` method, modify the method by adding the following lines (in bold) to the body of the method:
[source,xml]
@@ -447,7 +447,7 @@
NOTE: You might need to uncomment the code if you are using an earlier version of the IDE.
-[start=7]
+
. Fix your imports (Ctrl-Shift-I; ⌘-Shift-I on Mac) and save your changes.
When generating the import statements, you want to import the ``java.util`` libraries.
@@ -464,7 +464,7 @@
When you click Finish, the class ``PostMessage.java`` opens in the Source Editor.
-[start=4]
+
. In the Source Editor, use annotations to inject the ``ConnectionFactory`` and ``Queue`` resources by adding the following field declarations.
[source,java]
@@ -479,7 +479,7 @@
private Queue queue;*
----
-[start=5]
+
. Fix your imports to import the * ``javax.jms`` * libraries.
image::images/maven-searchdepend1.png[title="Fix All Imports dialog"]
@@ -493,7 +493,7 @@
image::images/maven-searchdepend2.png[title="Search in Maven Repositories dialog"]
-[start=6]
+
. Add the following code to send the JMS messages to the ``processRequest`` method.
[source,java]
@@ -528,7 +528,7 @@
}*
----
-[start=7]
+
. Add the following code (in bold) for the web form for adding a message.
[source,xml]
@@ -550,7 +550,7 @@
NOTE: You might need to uncomment the code if you are using an earlier version of the IDE.
-[start=8]
+
. Fix your imports and save your changes.
image::images/maven-jms-imports.png[title="Fix All Imports dialog"]
@@ -607,7 +607,7 @@
By declaring that the dependency is provided, Maven will not package the artifact when building the WAR archive.
-[start=4]
+
. Save your changes.
@@ -652,7 +652,7 @@
When you click Run the IDE will deploy the EAR archive and create the JMS resources on the server. The IDE will open the default project index page (link:http://localhost:8080/MavenEnterpriseApp-web/[+http://localhost:8080/MavenEnterpriseApp-web/+]) in your browser.
-[start=2]
+
. Open your browser to the following URL to display the ListNews page.
link:http://localhost:8080/MavenEnterpriseApp-web/ListNews[+http://localhost:8080/MavenEnterpriseApp-web/ListNews+].
@@ -662,10 +662,10 @@
image::images/maven-browser1.png[title="ListNews page open in the browser"]
-[start=3]
+
. Click Add new message.
-[start=4]
+
. Type a message in the form in the PostMessage servlet. Click Submit Query.
image::images/maven-browser2.png[title="PostMessage page open in the browser"]
@@ -689,7 +689,7 @@
The EAR archive is located in the ``target`` directory inside the enterprise application directory on your local system.
-[start=7]
+
. Click OK.
When you click OK, the GlassFish deploy tool deploys the application.
@@ -708,22 +708,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repostiory Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/javaee/MavenEnterpriseApp*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources (the local folder must be empty).
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
NOTE: For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ja.asciidoc
index ac6ab36..4acfbf1 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ja.asciidoc
@@ -95,7 +95,7 @@
IDEにバンドルされているMavenバージョンを使用することも、ローカルのMavenインストール(2.0.9以降が必要)の場所を指定することもできます。
-[start=4]
+
. 「OK」をクリックして「オプション」ウィンドウを閉じます。
NOTE: Mavenサポートは、IDEでJavaが有効になっている場合に自動的に有効になります。Java EEプラグインが有効になっていない場合は、有効にする必要があります。
@@ -134,22 +134,22 @@
image::images/maven-newproject1.png[title="新規プロジェクト・ウィザードのMavenエンタープライズ・アプリケーションのプロジェクト・タイプ"]
-[start=3]
+
. 「プロジェクト名」として「*MavenEnterpriseApp*」と入力し、プロジェクトの場所を設定します。
-[start=4]
+
. (オプション)アーティファクトの詳細を変更します。「次」をクリックします。
image::images/maven-newproject2.png[title="新規プロジェクト・ウィザードのMavenプロジェクトの詳細"]
-[start=5]
+
. サーバーとして「GlassFish Server」を選択します。
-[start=6]
+
. 「Java EEバージョン」を「Java EE 6」または「Java EE 7」に設定します。
-[start=7]
+
. 「EJBモジュールを作成」および「Webアプリケーション・モジュールを作成」を選択します。「終了」をクリックします。
「終了」をクリックすると、Mavenエンタープライズ・アプリケーション原型から次のプロジェクトが作成されます。
@@ -189,7 +189,7 @@
他のデフォルト・オプション(持続性ユニット名、EclipseLink持続性プロバイダ)はそのまま使用できます。
-[start=5]
+
. 「Java Transaction APIを使用」が選択されており、「表生成戦略」が「作成」に設定されていることを確認します。これにより、アプリケーションのデプロイ時に、エンティティ・クラスに基づいて表が作成されます。「終了」をクリックします。
image::images/maven-persistenceunit.png[title="新規持続性ユニット・ウィザード"]
@@ -235,13 +235,13 @@
private String body;
----
-[start=2]
+
. ソース・エディタ内のクラス定義の間を右クリックし、「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])>「取得メソッドおよび設定メソッド」を選択します。
-[start=3]
+
. 「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスで、 ``body`` フィールドおよび ``title`` フィールドを選択します。「生成」をクリックします。
-[start=4]
+
. 変更内容をクラスに保存します。
@@ -263,13 +263,13 @@
image::images/maven-messagedestination.png[title="「メッセージ送信先の追加」ダイアログ"]
-[start=7]
+
. プロジェクトの送信先が正しいことを確認します。「次」をクリックします。
image::images/maven-newmdb.png[title="新規メッセージ駆動型Beanウィザード"]
-[start=8]
+
. 「アクティブ化構成プロパティ」でデフォルトの設定を受け入れます。「終了」をクリックします。
「終了」をクリックすると、Beanクラスが生成され、クラスをメッセージ駆動型Beanと特定する次の注釈、および構成プロパティが追加されます。
@@ -293,7 +293,7 @@
}
----
-[start=9]
+
. 次の注釈済フィールドをクラスに追加して、 ``MessageDrivenContext`` リソースをクラスに注入します。
[source,java]
@@ -306,7 +306,7 @@
----
-[start=10]
+
. 次の注釈済フィールド(太字部分)を追加して、エンティティ・マネージャをクラスに導入します。
[source,java]
@@ -324,7 +324,7 @@
``@PersistenceContext`` 注釈は、持続性ユニットを宣言することで、コンテキストを指定します。 ``unitName`` 値は、持続性ユニットの名前です。
-[start=11]
+
. 次の ``save`` メソッド(太字部分)を追加します。
[source,java]
@@ -342,7 +342,7 @@
}*
----
-[start=12]
+
. 本文に次のコード(太字部分)を追加して、 ``onMessage`` メソッドを変更します。
[source,java]
@@ -365,7 +365,7 @@
}
----
-[start=13]
+
. インポート文を修正([Ctrl]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])して変更内容を保存します。
NOTE: インポート文の生成時に、* ``jms`` *と* ``javax.annotation.Resource`` *の各ライブラリを必ずインポートします。
@@ -403,10 +403,10 @@
「終了」をクリックすると、 ``ListNews.java`` というクラスがソース・エディタに表示されます。
-[start=4]
+
. ソース・エディタ内のクラス定義の間を右クリックし、「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])>「エンタープライズBeanをコール」を選択します。
-[start=5]
+
. 「エンタープライズBeanをコール」ダイアログ・ボックスで、「MavenEnterpriseApp-ejb」ノードを展開し、「NewsEntityFacade」を選択します。「OK」をクリックします。
image::images/maven-callbean.png[title="「エンタープライズBeanをコール」ダイアログ"]
@@ -423,7 +423,7 @@
private NewsEntityFacade newsEntityFacade;
----
-[start=6]
+
. ``processRequest`` メソッドで、以下の行(太字部分)をメソッドの本体に追加することでメソッドを変更します。
[source,xml]
@@ -446,7 +446,7 @@
NOTE: 以前のバージョンのIDEを使用している場合は、コードのコメント解除が必要になることがあります。
-[start=7]
+
. インポートを修正([Ctrl]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])して変更内容を保存します。
インポート文を生成するときは、 ``java.util`` ライブラリをインポートします。
@@ -463,7 +463,7 @@
「終了」をクリックすると、 ``PostMessage.java`` というクラスがソース・エディタに表示されます。
-[start=4]
+
. ソース・エディタで、注釈を使用して ``ConnectionFactory`` リソースおよび ``Queue`` リソースを注入します。これには、次のフィールド宣言を追加します。
[source,java]
@@ -478,7 +478,7 @@
private Queue queue;*
----
-[start=5]
+
. インポートを修正して* ``javax.jms`` *ライブラリをインポートします。
image::images/maven-searchdepend1.png[title="「すべてのインポートを修正」ダイアログ"]
@@ -492,7 +492,7 @@
image::images/maven-searchdepend2.png[title="「Mavenリポジトリで検索」ダイアログ"]
-[start=6]
+
. JMSメッセージを送信するための次のコードを ``processRequest`` メソッドに追加します。
[source,java]
@@ -527,7 +527,7 @@
}*
----
-[start=7]
+
. メッセージを追加するWebフォームのために、次のコード(太字部分)を追加します。
[source,xml]
@@ -549,7 +549,7 @@
NOTE: 以前のバージョンのIDEを使用している場合は、コードのコメント解除が必要になることがあります。
-[start=8]
+
. インポートを修正して変更内容を保存します。
image::images/maven-jms-imports.png[title="「すべてのインポートを修正」ダイアログ"]
@@ -606,7 +606,7 @@
依存性の提供を宣言することで、WARアーカイブのビルド時、アーティファクトがMavenによってパッケージ化されなくなります。
-[start=4]
+
. 変更を保存します。
@@ -651,7 +651,7 @@
「実行」をクリックすると、IDEによってサーバー上にEARアーカイブがデプロイされ、JMSリソースが作成されます。IDEがデフォルトのプロジェクト・インデックス・ページ(link:http://localhost:8080/MavenEnterpriseApp-web/[+http://localhost:8080/MavenEnterpriseApp-web/+])をブラウザで開きます。
-[start=2]
+
. ブラウザで次のURLを開き、ListNewsページを表示します。
link:http://localhost:8080/MavenEnterpriseApp-web/ListNews[+http://localhost:8080/MavenEnterpriseApp-web/ListNews+]
@@ -661,10 +661,10 @@
image::images/maven-browser1.png[title="ブラウザに表示されたListNewsページ"]
-[start=3]
+
. 「新規メッセージを追加」をクリックします。
-[start=4]
+
. PostMessageサーブレットのフォーム内に、メッセージを入力します。「問合せを送信」をクリックします。
image::images/maven-browser2.png[title="ブラウザに表示されたPostMessageページ"]
@@ -688,7 +688,7 @@
ローカル・システムでは、EARアーカイブはエンタープライズ・アプリケーション・ディレクトリ内の ``target`` ディレクトリ内に置かれています。
-[start=7]
+
. 「OK」をクリックします。
「OK」をクリックすると、GlassFishデプロイツールにより、アプリケーションがデプロイされます。
@@ -707,22 +707,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/javaee/MavenEnterpriseApp*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します(ローカル・フォルダは空である必要があります)。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
NOTE: Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_pt_BR.asciidoc
index 27e0a06..b11aab2 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_pt_BR.asciidoc
@@ -95,7 +95,7 @@
Você pode usar a versão do Maven incorporada no IDE ou especificar a localização de uma instalação local do Maven (requer versão 2.0.9 ou posterior).
-[start=4]
+
. Clique em OK para fechar a janela Opções.
NOTE: O suporte a Maven será automaticamente ativado quando o Java estiver ativado no IDE. Você precisará ativar o plug-in Java EE, se não estiver ativado.
@@ -134,22 +134,22 @@
image::images/maven-newproject1.png[title="Tipo do projeto Aplicação Corporativa Maven no assistente Novo Projeto"]
-[start=3]
+
. Digite *MavenEnterpriseApp* como nome do projeto e defina a Localização do Projeto.
-[start=4]
+
. (Opcional) Modifique os detalhes do artefato. Clique em Próximo.
image::images/maven-newproject2.png[title="Detalhes do Projeto Maven no assistente Novo Projeto"]
-[start=5]
+
. Selecione GlassFish Server como o Servidor.
-[start=6]
+
. Defina a versão do Java EE como Java EE 6 ou Java EE 7.
-[start=7]
+
. Selecione Criar Módulo EJB e Criar Módulo da Aplicação Web. Clique em Finalizar.
Quando você clica em Finalizar, o IDE cria os projetos a seguir a partir do arquétipo de Aplicação Corporativa Maven.
@@ -189,7 +189,7 @@
Você pode manter as outras opções default (nome da unidade de persistência, provedor da persistência EclipseLink).
-[start=5]
+
. Certifique-se de que a opção Utilizar APIs de Transação Java esteja selecionada e de que Estratégia de Geração de Tabela esteja definida como Criar, para que as tabelas baseadas nas classes de entidade sejam criadas quando a aplicação for implantada. Clique em Finalizar.
image::images/maven-persistenceunit.png[title="Assistente Nova Unidade de Persistência"]
@@ -235,13 +235,13 @@
private String body;
----
-[start=2]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte entre a definição da classe e selecione Inserir Código (Alt-Insert; Ctrl-I no Mac) > Getter e Setter.
-[start=3]
+
. Na caixa de diálogo Gerar Getters e Setters, selecione os campos ``body`` e ``title`` . Clique em Gerar.
-[start=4]
+
. Salve as alterações feitas na classe.
@@ -263,13 +263,13 @@
image::images/maven-messagedestination.png[title="Caixa de Diálogo Adicionar Destino da Mensagem"]
-[start=7]
+
. Confirme se o destino do projeto está correto. Clique em Próximo.
image::images/maven-newmdb.png[title="Assistente Novo Bean Baseado em Mensagens"]
-[start=8]
+
. Aceite as definições default nas Propriedades de Configuração de Ativação. Clique em Finalizar.
Quando você clica em Finalizar, o IDE gera a classe do bean e adiciona as anotações seguintes que identificam a classe como um bean baseado em mensagens e as propriedades de configuração.
@@ -293,7 +293,7 @@
}
----
-[start=9]
+
. Injete o recurso ``MessageDrivenContext`` na classe, adicionando o seguinte campo anotado à classe.
[source,java]
@@ -306,7 +306,7 @@
----
-[start=10]
+
. Introduza o gerenciador de entidade na classe, adicionando o seguinte campo anotado (em negrito).
[source,java]
@@ -324,7 +324,7 @@
A anotação ``@PersistenceContext`` especifica o contexto declarando a unidade de persistência. O valor de ``unitName`` é o nome da unidade de persistência.
-[start=11]
+
. Adicione o seguinte método ``save`` (em negrito).
[source,java]
@@ -342,7 +342,7 @@
}*
----
-[start=12]
+
. Modifique o método ``onMessage`` , adicionando o seguinte (em negrito) ao corpo:
[source,java]
@@ -365,7 +365,7 @@
}
----
-[start=13]
+
. Corrija as instruções de importação (Ctrl-Shift-I; ⌘-Shift-I no Mac) e salve as alterações.
NOTE: quando geramos as instruções de importação, queremos garantir a importação das bibliotecas ``jms`` * e * ``javax.annotation.Resource`` *.
@@ -403,10 +403,10 @@
Quando você clicar em Finalizar, a classe ``ListNews.java`` irá se abrir no Editor de Código-Fonte.
-[start=4]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte entre a definição de classes e selecione Inserir Código (Alt-Insert; Ctrl-I no Mac) > Chamar Enterprise Bean.
-[start=5]
+
. Na caixa de diálogo Chamar Enterprise Bean, expanda o nó MavenEnterpriseApp-ejb e selecione NewEntityFacade. Clique em OK.
image::images/maven-callbean.png[title="Caixa de diálogo Chamar Enterprise Bean"]
@@ -423,7 +423,7 @@
private NewsEntityFacade newsEntityFacade;
----
-[start=6]
+
. No método ``processRequest`` , modifique o método adicionando as seguintes linhas (em negrito) ao corpo do método:
[source,xml]
@@ -446,7 +446,7 @@
NOTE: Pode ser necessário cancelar o comentário do código, se estiver utilizando uma versão anterior do IDE.
-[start=7]
+
. Corrija as importações (Ctrl-Shift-I; ⌘-Shift-I no Mac) e salve as alterações.
Ao gerar as instruções de importação, você deseja importar as bibliotecas ``java.util`` .
@@ -463,7 +463,7 @@
Quando você clicar em Finalizar, a classe ``PostMessage.java`` será aberta no Editor de Código-Fonte.
-[start=4]
+
. No Editor de Código-Fonte, utilize anotações para injetar os recursos ``ConnectionFactory`` e ``Queue`` , adicionando as seguintes declarações de campo.
[source,java]
@@ -478,7 +478,7 @@
private Queue queue;*
----
-[start=5]
+
. Corrija as importações para importar as bibliotecas * ``javax.jms`` *.
image::images/maven-searchdepend1.png[title="Caixa de diálogo Corrigir Todas as Importações"]
@@ -492,7 +492,7 @@
image::images/maven-searchdepend2.png[title="Caixa de diálogo Pesquisar nos Repositórios Maven"]
-[start=6]
+
. Adicione o código a seguir para enviar as mensagens JMS ao método ``processRequest`` .
[source,java]
@@ -527,7 +527,7 @@
}*
----
-[start=7]
+
. Adicione o código a seguir (em negrito) ao web form para adicionar uma mensagem.
[source,xml]
@@ -549,7 +549,7 @@
NOTE: Pode ser necessário cancelar o comentário do código, se estiver utilizando uma versão anterior do IDE.
-[start=8]
+
. Corrija as importações e salve as alterações.
image::images/maven-jms-imports.png[title="Caixa de diálogo Corrigir Todas as Importações"]
@@ -606,7 +606,7 @@
Quando você declarar que a dependência é fornecida, o Maven não encapsulará o artefato ao construir o arquivo compactado WAR.
-[start=4]
+
. Salve as alterações.
@@ -651,7 +651,7 @@
Quando você clicar em Executar, o IDE implantará o arquivo compactado EAR e criará os recursos JMS no servidor. O IDE abrirá página default de índice do projeto (link:http://localhost:8080/MavenEnterpriseApp-web/[+http://localhost:8080/MavenEnterpriseApp-web/+]) no browser.
-[start=2]
+
. Abra o browser no URL a seguir para exibir a página ListNews.
link:http://localhost:8080/MavenEnterpriseApp-web/ListNews[+http://localhost:8080/MavenEnterpriseApp-web/ListNews+].
@@ -661,10 +661,10 @@
image::images/maven-browser1.png[title="A página ListNews será aberta no browser"]
-[start=3]
+
. Clique em Adicionar nova mensagem.
-[start=4]
+
. Digite uma mensagem no form no servlet PostMessage. Clique em Submeter Consulta.
image::images/maven-browser2.png[title="A página PostMessage será aberta no browser"]
@@ -688,7 +688,7 @@
O arquivo compactado EAR está localizado no diretório ``target`` dentro do diretório da aplicação corporativa no sistema local.
-[start=7]
+
. Clique em OK.
Quando você clica em OK, a ferramenta de implantação do GlassFish implanta a aplicação.
@@ -707,22 +707,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar nas Pastas do Repositório:
-[start=4]
+
. Expanda o nó raiz e selecione *samples/javaee/MavenEnterpriseApp*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local para o códigos-fonte (a pasta local precisa estar vazia).
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
NOTE: Para saber mais sobre a instalação do Subversion, consulte a seção link:../ide/subversion.html#settingUp[+Configurando o Subversion+] no link:../ide/subversion.html[+Guia do Subversion no NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ru.asciidoc
index 8677c27..461d282 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_ru.asciidoc
@@ -95,7 +95,7 @@
Можно использовать версию Maven, входящую в комплект среды IDE, либо указать местоположение локальной установки Maven (требуется версия 2.0.9 или более поздняя).
-[start=4]
+
. Для закрытия окна "Параметры" нажмите кнопку "ОК".
*Примечания.*
@@ -135,22 +135,22 @@
image::images/maven-newproject1.png[title="Тип проекта корпоративного приложения Maven в мастере создания проектов"]
-[start=3]
+
. Введите *MavenEnterpriseApp* в качестве имени проекта и укажите местоположение проекта.
-[start=4]
+
. (Необязательно) Измените подробные данные артефакта. Нажмите кнопку "Далее".
image::images/maven-newproject2.png[title="Сведения о проекте Maven в мастере создания проектов"]
-[start=5]
+
. В качестве сервера выберите сервер GlassFish.
-[start=6]
+
. В качестве версии Java EE выберите Java EE 6 или Java EE 7.
-[start=7]
+
. Установите флажки "Создать модуль EJB" и "Создать модуль веб-приложения". Нажмите кнопку "Завершить".
При нажатии кнопки "Готово" из архетипа приложения Maven Enterprise создаются следующие проекты:
@@ -190,7 +190,7 @@
Можно сохранить другие параметры по умолчанию (имя блока сохранения состояния, поставщик сохранения состояния EclipseLink).
-[start=5]
+
. Убедитесь в том, что установлен флажок "Использовать интерфейсы API Java Translaction", и что для стратегии создания таблиц установлено значение "Создать", т.е. таблицы на основе классов сущностей создаются при развертывании приложения. Нажмите кнопку "Завершить".
image::images/maven-persistenceunit.png[title="Мастер создания блоков сохранения состояния"]
@@ -236,13 +236,13 @@
private String body;
----
-[start=2]
+
. В редакторе исходного кода щелкните правой кнопкой мыши внутри определения класса и выберите "Вставка кода" (ALT+ISERT; CTRL+I на компьютере Mac) > "Методы получения и установки".
-[start=3]
+
. В диалоговом окне "Создание методов получения и установки" выберите поля ``body`` и ``title`` . Нажмите кнопку "Создать".
-[start=4]
+
. Сохраните изменения, внесенные в класс.
@@ -264,13 +264,13 @@
image::images/maven-messagedestination.png[title="Диалоговое окно "Добавление назначения сообщения"."]
-[start=7]
+
. Подтвердите, что адресат проекта выбран правильно. Нажмите кнопку "Далее".
image::images/maven-newmdb.png[title="Мастер создания компонентов, управляемых сообщениями"]
-[start=8]
+
. В диалоговом окне "Свойства конфигурации активации" оставьте настройки по умолчанию без изменений. Нажмите кнопку "Завершить".
При нажатии кнопки "Готово" автоматически создается класс компонента, к которому добавляются следующие аннотации, идентифицирующие класс как компонент, управляемый сообщениями, а также свойства настройки.
@@ -294,7 +294,7 @@
}
----
-[start=9]
+
. Введите в класс ресурс ``MessageDrivenContext`` посредством добавления к классу следующего аннотированного поля:
[source,java]
@@ -307,7 +307,7 @@
----
-[start=10]
+
. Введите в класс диспетчер объектов посредством добавления к классу следующего аннотированного поля (выделено полужирным шрифтом):
[source,java]
@@ -325,7 +325,7 @@
Аннотация ``@PersistenceContext`` указывает контекст путем объявления блока сохранения состояния. Значение ``unitName`` представляет собой имя блока сохранения состояния.
-[start=11]
+
. Добавьте следующий метод ``save`` (выделен полужирным шрифтом).
[source,java]
@@ -343,7 +343,7 @@
}*
----
-[start=12]
+
. Измените метод ``onMessage`` путем добавления следующих строк кода (выделены полужирным шрифтом) в тело метода:
[source,java]
@@ -366,7 +366,7 @@
}
----
-[start=13]
+
. Исправьте операторы импорта (Ctrl-Shift-I; ⌘-Shift-I в Mac) и сохраните изменения.
NOTE: При создании операторов импорта необходимо убедиться, что импортируются библиотеки * ``jms`` * и * ``javax.annotation.Resource`` *.
@@ -404,10 +404,10 @@
При нажатии кнопки "Готово" класс ``ListNews.java`` будет открыт в редакторе исходного кода.
-[start=4]
+
. Щелкните правой кнопкой мыши в редакторе исходного кода в определении класса и выберите команду "Вставка кода" (ALT+ISERT; CTRL+I на компьютере Mac) > "Вызов компонента EJB".
-[start=5]
+
. В диалоговом окне "Вызов компонента EJB" разверните узел MavenEnterpriseApp-ejb и выберите NewsEntityFacade. Нажмите кнопку "ОК".
image::images/maven-callbean.png[title="Диалоговое окно 'Вызвать компонент корпоративного уровня'"]
@@ -424,7 +424,7 @@
private NewsEntityFacade newsEntityFacade;
----
-[start=6]
+
. В методе ``processRequest`` внесите изменения, добавив следующие строки (выделены полужирным шрифтом) в тело метода:
[source,xml]
@@ -447,7 +447,7 @@
NOTE: Если используется более ранняя версия IDE необходимо удалить комментарии кода.
-[start=7]
+
. Исправьте выражения импорта (Ctrl-Shift-I; ⌘-Shift-I в Mac) и сохраните изменения.
При создании операторов импорта может потребоваться импортировать библиотеки ``java.util`` .
@@ -464,7 +464,7 @@
При нажатии кнопки "Готово" в редакторе исходного кода будет открыт класс ``PostMessage.java`` .
-[start=4]
+
. Используйте аннотации в редакторе исходного кода для ввода ресурсов ``ConnectionFactory`` и ``Queue`` путем добавления следующих объявлений полей.
[source,java]
@@ -479,7 +479,7 @@
private Queue queue;*
----
-[start=5]
+
. Для импорта библиотек * ``javax.jms`` * исправьте параметры импорта.
image::images/maven-searchdepend1.png[title="Диалоговое окно 'Исправить все выражения импорта'"]
@@ -493,7 +493,7 @@
image::images/maven-searchdepend2.png[title="Диалоговое окно 'Поиск в репозиториях Maven'"]
-[start=6]
+
. Добавьте следующие строки, используемые для отправки сообщений JMS, к методу ``processRequest`` .
[source,java]
@@ -528,7 +528,7 @@
}*
----
-[start=7]
+
. Добавьте следующие строки, используемые для отправки сообщений (выделены жирным шрифтом) к веб-форме.
[source,xml]
@@ -550,7 +550,7 @@
NOTE: Если используется более ранняя версия IDE необходимо удалить комментарии кода.
-[start=8]
+
. Исправьте операторы импорта и сохраните измененные данные.
image::images/maven-jms-imports.png[title="Диалоговое окно 'Исправить все выражения импорта'"]
@@ -607,7 +607,7 @@
Если в файле POM содержится объявление предоставленной зависимости, этот артефакт не пакетируется Maven при сборке архива WAR.
-[start=4]
+
. Сохраните изменения.
@@ -652,7 +652,7 @@
При нажатии команды "Выполнение" среда IDE разворачивает архив EAR и создает ресурсы JMS на сервере. Среда IDE откроет установленную по умолчанию начальную страницу приложения (link:http://localhost:8080/MavenEnterpriseApp-web/[+http://localhost:8080/MavenEnterpriseApp-web/+]) в браузере.
-[start=2]
+
. Для вывода страницы ListNews откройте в браузере следующий адрес URL.
link:http://localhost:8080/MavenEnterpriseApp-web/ListNews[+http://localhost:8080/MavenEnterpriseApp-web/ListNews+].
@@ -662,10 +662,10 @@
image::images/maven-browser1.png[title="Страница ListNews открыта в браузере"]
-[start=3]
+
. Нажмите кнопку "Добавить сообщение".
-[start=4]
+
. Введите сообщение в форму в сервлете PostMessage. Нажмите кнопку "Отправить запрос".
image::images/maven-browser2.png[title="Страница PostMessage открыта в браузере"]
@@ -689,7 +689,7 @@
Архив EAR расположен в каталоге ``target`` внутри каталога приложения уровня предприятия в локальной системе.
-[start=7]
+
. Нажмите кнопку "ОК".
При нажатии кнопки "ОК" выполняется развертывание приложения с помощью средства развертывания GlassFish.
@@ -708,22 +708,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку "Обзор" для открытия диалогового окна "Обзор папок репозитория".
-[start=4]
+
. Разверните корневой узел и выберите *samples/javaee/MavenEnterpriseApp*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов (папка должна быть пустой).
-[start=6]
+
. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечания.* For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in IDE NetBeans+].
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_zh_CN.asciidoc
index cbfc87f..8d237c3 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-entapp_zh_CN.asciidoc
@@ -94,7 +94,7 @@
您可以使用与 IDE 捆绑在一起的 Maven 版本,也可以指定 Maven 在本地的安装位置(要求为 2.0.9 或更高版本)。
-[start=3]
+
. 选择 "OK"(确定)以关闭 "Options"(选项)窗口。
NOTE: 在 IDE 中启用 Java 后,会自动启用 Maven 支持。您将需要启用 Java EE 插件(如果尚未启用)。
@@ -133,22 +133,22 @@
image::images/maven-newproject1.png[title="新建项目向导中的 "Maven Enterprise Application"(Maven 企业应用程序)项目类型"]
-[start=3]
+
. 键入 *MavenEnterpriseApp* 作为项目名称并设置项目位置。
-[start=4]
+
. (可选)修改工件详细信息。单击 "Next"(下一步)。
image::images/maven-newproject2.png[title="新建项目向导中的 "Maven Project"(Maven 项目)详细信息"]
-[start=5]
+
. 选择 GlassFish Server 作为服务器。
-[start=6]
+
. 将 "Java EE Version"(Java EE 版本)设置为 "Java EE 6" 或 "Java EE 7"。
-[start=7]
+
. 选中 "Create EJB Module"(创建 EJB 模块)和 "Create Web App Module"(创建 Web 应用程序模块)。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将使用 Maven 企业应用程序原型创建以下项目。
@@ -188,7 +188,7 @@
您可以保留其他默认选项(持久性单元名称、EclipseLink 持久性提供器)。
-[start=5]
+
. 确保选中 "Use Java Transaction APIs"(使用 Java 事务 API),并且将 "Table Generation Strategy"(表生成策略)设置为 "Create"(创建),以便在部署应用程序时创建基于实体类的表。单击 "Finish"(完成)。
image::images/maven-persistenceunit.png[title="新建持久性单元向导"]
@@ -234,13 +234,13 @@
private String body;
----
-[start=2]
+
. 在源代码编辑器的类定义之间右键单击,然后选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键)> "Getter and Setter"(Getter 和 Setter)。
-[start=3]
+
. 在 "Generate Getters and Setters"(生成 Getter 和 Setter)对话框中,选择 ``body`` 和 ``title`` 字段。单击 "Generate"(生成)。
-[start=4]
+
. 保存对该类所做的更改。
@@ -262,13 +262,13 @@
image::images/maven-messagedestination.png[title=""Add Message Destination"(添加消息目标)对话框"]
-[start=7]
+
. 确认项目目标正确无误。单击 "Next"(下一步)。
image::images/maven-newmdb.png[title="新建消息驱动 Bean 向导"]
-[start=8]
+
. 接受 "Activation Config Properties"(激活配置属性)中的默认设置。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将生成 Bean 类,并添加以下标注(将该类标识为消息驱动 Bean)和配置属性。
@@ -292,7 +292,7 @@
}
----
-[start=9]
+
. 在类中添加以下带标注的字段,以将 ``MessageDrivenContext`` 资源注入到类中。
[source,java]
@@ -305,7 +305,7 @@
----
-[start=10]
+
. 添加以下带标注的字段(以粗体显示),以将实体管理器引入到类中。
[source,java]
@@ -323,7 +323,7 @@
``@PersistenceContext`` 标注通过声明持久性单元来指定上下文。 ``unitName`` 值是持久性单元的名称。
-[start=11]
+
. 添加以下 ``save`` 方法(以粗体显示)。
[source,java]
@@ -341,7 +341,7 @@
}*
----
-[start=12]
+
. 在 ``onMessage`` 方法主体中,添加以下内容(以粗体显示)以修改该方法:
[source,java]
@@ -364,7 +364,7 @@
}
----
-[start=13]
+
. 修复 import 语句(Ctrl-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)并保存所做的更改。
NOTE: 在生成 import 语句时,您需要确保导入 * ``jms`` * 和 * ``javax.annotation.Resource`` *。
@@ -402,10 +402,10 @@
单击 "Finish"(完成),此时将在源代码编辑器中打开类 ``ListNews.java`` 。
-[start=4]
+
. 在源代码编辑器中的类定义之间右键单击,然后选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键)> "Call Enterprise Bean"(调用企业 Bean)。
-[start=5]
+
. 在 "Call Enterprise Bean"(调用企业 Bean)对话框中,展开 "MavenEnterpriseApp-ejb" 节点,然后选择 "NewsEntityFacade"。单击 "OK"(确定)。
image::images/maven-callbean.png[title=""Call Enterprise Bean"(调用企业 Bean)对话框"]
@@ -422,7 +422,7 @@
private NewsEntityFacade newsEntityFacade;
----
-[start=6]
+
. 在 ``processRequest`` 方法中,将以下代码行(以粗体显示)添加到方法主体中以修改该方法:
[source,xml]
@@ -445,7 +445,7 @@
NOTE: 如果您使用的是早期版本的 IDE,可能需要注释掉该代码。
-[start=7]
+
. 修复 import 语句(Ctrl-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)并保存所做的更改。
在生成 import 语句时,您希望导入 ``java.util`` 库。
@@ -462,7 +462,7 @@
单击 "Finish"(完成),此时将在源代码编辑器中打开类 ``PostMessage.java`` 。
-[start=4]
+
. 在源代码编辑器中,添加以下字段声明以使用标注注入 ``ConnectionFactory`` 和 ``Queue`` 资源。
[source,java]
@@ -477,7 +477,7 @@
private Queue queue;*
----
-[start=5]
+
. 修复 import 语句以导入 * ``javax.jms`` * 库。
image::images/maven-searchdepend1.png[title=""Fix All Imports"(修复所有导入)对话框"]
@@ -491,7 +491,7 @@
image::images/maven-searchdepend2.png[title=""Search in Maven Repositories"(在 Maven 资源库中搜索)对话框"]
-[start=6]
+
. 添加以下代码以将 JMS 消息发送到 ``processRequest`` 方法。
[source,java]
@@ -526,7 +526,7 @@
}*
----
-[start=7]
+
. 为用于添加消息的 Web 窗体添加以下代码(以粗体显示)。
[source,xml]
@@ -548,7 +548,7 @@
NOTE: 如果您使用的是早期版本的 IDE,可能需要注释掉该代码。
-[start=8]
+
. 修复导入并保存更改。
image::images/maven-jms-imports.png[title=""Fix All Imports"(修复所有导入)对话框"]
@@ -605,7 +605,7 @@
通过声明提供了依赖关系,在构建 WAR 档案时,Maven 将不打包该工件。
-[start=4]
+
. 保存所做的更改。
@@ -650,7 +650,7 @@
单击 "Run"(运行)后,IDE 将在服务器上部署 EAR 档案并创建 JMS 资源。IDE 将在浏览器中打开默认的项目索引页 (link:http://localhost:8080/MavenEnterpriseApp-web/[+http://localhost:8080/MavenEnterpriseApp-web/+])。
-[start=2]
+
. 打开浏览器,访问下列 URL 以显示 ListNews 页。
link:http://localhost:8080/MavenEnterpriseApp-web/ListNews[+http://localhost:8080/MavenEnterpriseApp-web/ListNews+]。
@@ -660,10 +660,10 @@
image::images/maven-browser1.png[title="在浏览器中打开的 ListNews 页"]
-[start=3]
+
. 单击 "Add New Message"(添加新消息)。
-[start=4]
+
. 在 PostMessage Servlet 的窗体中键入消息。单击 "Submit Query"(提交查询)。
image::images/maven-browser2.png[title="在浏览器中打开的 PostMessage 页"]
@@ -687,7 +687,7 @@
EAR 档案位于本地系统上的企业应用程序目录的 ``target`` 目录中。
-[start=7]
+
. 单击 "OK"(确定)。
在单击 "OK"(确定)时,GlassFish 部署工具将部署应用程序。
@@ -706,22 +706,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repostiory Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根节点并选择 *samples/javaee/MavenEnterpriseApp*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的本地文件夹(本地文件夹必须为空)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
NOTE: 有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi.asciidoc
index ef5f0e5..f54633e 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi.asciidoc
@@ -99,13 +99,13 @@
image::images/cdi-newpomproject.png[title="Maven POM Project archetype in the New Project wizard"]
-[start=3]
+
. Type *MavenOSGiCDIProject* as the Project name. Click Finish.
When you click Finish, the IDE creates the POM project and opens the project in the Projects window.
-[start=4]
+
. Expand the Project Files node in the Projects window and double-click ``pom.xml`` to open the file in the editor.
The basic POM for the project should be similar to the following.
@@ -128,7 +128,7 @@
----
-[start=5]
+
. Modify the parent ``pom.xml`` to add the following elements. Save your changes.
[source,xml]
@@ -179,10 +179,10 @@
image::images/cdi-new-osgiproject.png[title="Maven OSGi Bundle archetype in the New Project wizard"]
-[start=3]
+
. Type *MavenHelloServiceApi* for the Project Name.
-[start=4]
+
. Click Browse and select the *MavenOSGiCDIProject* POM project as the Location. Click Finish.
When you click Finish, the IDE creates the bundle project and opens the project in the Projects window. If you open ``pom.xml`` for the MavenHelloServiceApi project in the editor you can see that the ``packaging`` element specifies ``bundle`` and that the ``maven-bundle-plugin`` will be used when building the bundle.
@@ -244,25 +244,25 @@
You can also see that when you create an OSGi bundle project using the Maven OSGi Bundle archetype, the IDE added the ``org.osgi.core`` artifact as a dependency by default.
-[start=5]
+
. Right-click the MavenHelloServiceApi project node in the Projects window and choose Properties.
-[start=6]
+
. Select the Sources category in the Project Properties dialog box.
-[start=7]
+
. Set the *Source/Binary Format* to 1.6 and confirm that the *Encoding* is UTF-8. Click OK.
-[start=8]
+
. Right-click Source Packages node in the Projects window and choose New > Java Interface.
-[start=9]
+
. Type *Hello* for the Class Name.
-[start=10]
+
. Select *com.mycompany.mavenhelloserviceapi* as the Package. Click Finish.
-[start=11]
+
. Add the following ``sayHello`` method to the interface (in bold) and save your changes.
[source,java]
@@ -273,7 +273,7 @@
}
----
-[start=12]
+
. Right-click the project node in the Projects window and choose Build.
After you build the project, if you open the Files window and expand the project node you can see that ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` is created in the ``target`` folder.
@@ -283,7 +283,7 @@
The ``maven-bundle-plugin`` handles the generation of the ``MANIFEST.MF`` file when you build the project. If you open the ``MANIFEST.MF`` file in the compiled JAR you will see that the plugin generated a manifest header that declares the export packages. For OSGi, all bundles that you want to be exposed and available to other bundles must be listed in the ``Export-Package`` element in ``MANIFEST.MF`` .
-[start=13]
+
. Confirm that the ``MANIFEST.MF`` contains the ``Export-Package`` element (the element shown in *bold* in the example below).
[source,text]
@@ -342,22 +342,22 @@
When you implement ``Hello`` , the IDE will display an error that you need to resolve by adding the MavenHelloServiceApi project as a dependency.
-[start=12]
+
. Right-click the Dependencies node of *MavenHelloServiceImpl* in the Projects window and choose Add Dependency.
-[start=13]
+
. Click the Open Projects tab in the Add Library dialog.
-[start=14]
+
. Select MavenHelloServiceApi OSGi Bundle. Click Add.
image::images/cdi-add-dependency.png[title="Open Projects tab in the Add Library dialog"]
-[start=15]
+
. Right-click in the ``HelloImpl.java`` class that is open in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) to add an import statement for ``com.mycompany.mavenhelloserviceapi.Hello`` . Save your changes.
-[start=16]
+
. Expand the ``com.mycompany.mavenhelloserviceimpl`` package and double-click ``Activator.java`` to open the file in the editor.
image::images/cdi-activator.png[title="Activator class in the Projects window"]
@@ -367,7 +367,7 @@
An OSGi bundle does not require a bundle activator class, but you can use the ``start()`` method in the activator class, for example, to initialize services or other resources that are required by the bundle. In this exercise you will add some lines of code to the class that will print messages to the Output window. This will make it easier for you to identify when the bundle starts and stops.
-[start=17]
+
. Modify the ``start()`` and ``stop()`` methods in the bundle activator class to add the following lines (in bold).
[source,java]
@@ -412,10 +412,10 @@
When you build the bundle, the plugin will generate a Manifest Header in the bundle's manifest file in the JAR and specify the Bundle Activator class. The OSGi runtime looks for the ``Bundle-Activator`` header in the manifest file when a bundle is deployed.
-[start=18]
+
. Fix the import statements in ``Activator.java`` to import ``com.mycompany.mavenhelloserviceapi.Hello`` . Save your changes.
-[start=19]
+
. Expand the Dependencies node and confirm that the ``org.osgi.core`` artifact is listed as a dependency.
NOTE: Remove any older versions of the artifact that are listed under the Dependencies node by right-clicking the artifact and choosing Remove Dependency. The only dependencies should be the MavenHelloServiceApi project and the ``org.osgi.core`` artifact.
@@ -433,10 +433,10 @@
When you build the project the IDE will create the JAR files in the ``target`` folder of each of the projects and also install the snapshot JAR in the local repository. In the Files window, you can expand the ``target`` folder for each of the two bundle projects to see the two JAR archives ( ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` and ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` ).
-[start=2]
+
. Start the GlassFish server if not already started.
-[start=3]
+
. Copy the ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` to the ``glassfish/domains/domain1/autodeploy/bundles/`` directory of your GlassFish installation.
You should see output similar to the following in the GlassFish Server log in the Output window.
@@ -452,7 +452,7 @@
Right-click the GlassFish server node in the Services window and choose View Domain Server Log if the server log is not visible in the Output window.
-[start=4]
+
. Repeat the steps to copy the ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` to the ``autodeploy/bundles`` directory.
You should now see output similar to the following in the GlassFish server log.
@@ -529,7 +529,7 @@
----
-[start=3]
+
. Add the the following elements to add the GlassFish repository to the POM. Save your changes.
[source,xml]
@@ -584,7 +584,7 @@
NOTE: You will need to expand the editor fold to delete the HttpServlet methods.
-[start=10]
+
. Type the following code (in bold) to inject the service.
[source,java]
@@ -599,7 +599,7 @@
}
----
-[start=11]
+
. Add the following ``doGet`` method.
[source,java]
@@ -613,19 +613,19 @@
}
----
-[start=12]
+
. Right-click the project node and choose New > Other.
-[start=13]
+
. Select *beans.xml* in the Contexts and Dependency Injection category. Click Next.
-[start=14]
+
. Use the default file name ( ``beans`` ). Click Finish.
When you click Finish, the wizard will create the ``beans.xml`` file in the web application. CDI is automatically enabled if ``beans.xml`` is part of the application.
-[start=15]
+
. Modify the ``beans.xml`` file to change the default value for ``bean-discovery-mode`` to ``all`` .
[source,java]
@@ -641,31 +641,31 @@
* link:http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv001.htm[+25.1 Packaging CDI Applications+] in the Java EE 7 Tutorial
* link:http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions[+http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions+]
-[start=16]
+
. Right-click the Dependencies node of MavenHelloWebClient in the Projects window and choose Add Dependency.
-[start=17]
+
. Select *Provided* as the Scope.
-[start=18]
+
. Click the Open Projects tab in the Add Library dialog and select *MavenHelloServiceApi OSGi Bundle*. Click Add.
-[start=19]
+
. Right-click the Dependencies node again and choose Add Dependency.
-[start=20]
+
. Click the Dependency Management tab in the Add Library dialog and choose the ``osgi-cdi-api`` artifact that you specified in the parent POM project. Click Add.
image::images/cdi-add-dependency3.png[title="Dependency Management tab in the Add Library dialog"]
-[start=21]
+
. Right-click in ``HelloServlet.java`` in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) to add ``com.mycompany.mavenhelloserviceapi.Hello`` , ``javax.inject.Inject`` and ``org.glassfish.osgicdi.OSGiService`` . Save your changes.
NOTE: You might need to manually add an import statements for ``com.mycompany.mavenhelloserviceapi.Hello`` if the IDE does not automatically add it for you.
-[start=22]
+
. Right-click the MavenOSGiCDIProject and choose Clean and Build.
When you build the project, you should see output similar to the following in the Output window.
@@ -751,7 +751,7 @@
----
-[start=3]
+
. Modify the configuration elements of the ``maven-war-plugin`` to add bundle information to ``MANIFEST.MF`` . Save your changes.
[source,xml]
@@ -779,7 +779,7 @@
</plugin>
----
-[start=4]
+
. Right-click the MavenHelloWebClient project node in the Projects window and choose Clean and Build.
If you now expand the WAR archive and open ``MANIFEST.MF`` in the editor, you can see that ``MANIFEST.MF`` now contains additional information, including the ``Web-ContextPath: /mavenhellowebclient`` entry that you specified in the ``maven-bundle-plugin`` configuration and bundle name entries.
@@ -851,10 +851,10 @@
Right-click the GlassFish server node in the Services window and choose View Domain Admin Console.
-[start=2]
+
. Click Update Tool in the left navigation column.
-[start=3]
+
. Select ``glassfish-osgi-gui`` from the list of available add-ons.
Click Install and accept the license.
@@ -862,7 +862,7 @@
image::images/cdi-glassfish-addons.png[title="Update Tool GlassFish Admin Console"]
-[start=4]
+
. Restart the GlassFish server.
*Important: * If you are running GlassFish Server 3.1.2.2 you need to modify the ``osgi.properties`` file located in the ``_GLASSFISH-INSTALL_/glassfish/config/`` directory and set the value of the ``org.osgi.framework.startlevel.beginning`` property to "2" ( ``org.osgi.framework.startlevel.beginning=2`` ).
@@ -870,10 +870,10 @@
link:http://www.java.net/forum/topic/glassfish/glassfish/cannot-start-web-console-glassfish-version-3122[+ Cannot start web console in Glassfish version 3.1.2.2+].
-[start=5]
+
. Open the Admin Console again and click *server (Admin Server)* in the left navigation column.
-[start=6]
+
. Click the OSGi Console tab to view a list of the deployed OSGi bundles.
image::images/cdi-glassfish-console.png[title="Dependency Management tab in the Add Library dialog"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ja.asciidoc
index 3d3053c..3079bf9 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ja.asciidoc
@@ -99,13 +99,13 @@
image::images/cdi-newpomproject.png[title="新規プロジェクト・ウィザードのMaven POMプロジェクト原型"]
-[start=3]
+
. 「プロジェクト名」に「*MavenOSGiCDIProject*」と入力します。「終了」をクリックします。
「終了」をクリックすると、IDEがPOMプロジェクトを作成し、そのプロジェクトが「プロジェクト」ウィンドウで開きます。
-[start=4]
+
. 「プロジェクト」ウィンドウで「プロジェクト・ファイル」ノードを展開して「 ``pom.xml`` 」をダブルクリックし、エディタでそのファイルを開きます。
プロジェクトの基本的なPOMは、次のようになっているはずです。
@@ -128,7 +128,7 @@
----
-[start=5]
+
. 親の ``pom.xml`` を変更して、次の要素を追加します。変更を保存します。
[source,xml]
@@ -179,10 +179,10 @@
image::images/cdi-new-osgiproject.png[title="新規プロジェクト・ウィザードのMaven OSGiバンドル原型"]
-[start=3]
+
. 「プロジェクト名」に「*MavenHelloServiceApi*」と入力します。
-[start=4]
+
. 「参照」をクリックし、「場所」として「*MavenOSGiCDIProject*」POMプロジェクトを選択します。「終了」をクリックします。
「終了」をクリックすると、IDEがバンドル・プロジェクトを作成し、そのプロジェクトが「プロジェクト」ウィンドウで開きます。エディタでMavenHelloServiceApiプロジェクトの ``pom.xml`` を開くと、 ``packaging`` 要素に ``bundle`` が指定されていること、およびバンドルのビルド時に ``maven-bundle-plugin`` が使用されることがわかります。
@@ -244,25 +244,25 @@
また、Maven OSGiバンドル原型を使用してOSGiバンドル・プロジェクトを作成したときに、IDEによって ``org.osgi.core`` アーティファクトがデフォルトで依存性として追加されたこともわかります。
-[start=5]
+
. 「プロジェクト」ウィンドウでMavenHelloServiceApiプロジェクト・ノードを右クリックし、「プロパティ」を選択します。
-[start=6]
+
. 「プロジェクト・プロパティ」ダイアログ・ボックスで「ソース」カテゴリを選択します。
-[start=7]
+
. 「*ソース/バイナリ形式*」を1.6に設定し、「*エンコーディング*」がUTF-8であることを確認します。「OK」をクリックします。
-[start=8]
+
. 「プロジェクト」ウィンドウで「ソース・パッケージ」ノードを右クリックし、「新規」>「Javaインタフェース」を選択します。
-[start=9]
+
. 「クラス名」に「*Hello*」と入力します。
-[start=10]
+
. 「パッケージ」として「*com.mycompany.mavenhelloserviceapi*」を選択します。「終了」をクリックします。
-[start=11]
+
. インタフェースに次の ``sayHello`` メソッド(太字部分)を追加し、変更内容を保存します。
[source,java]
@@ -273,7 +273,7 @@
}
----
-[start=12]
+
. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「ビルド」を選択します。
プロジェクトをビルドした後、「ファイル」ウィンドウを開いてプロジェクト・ノードを展開すると、 ``target`` フォルダに ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` が作成されていることがわかります。
@@ -283,7 +283,7 @@
プロジェクトをビルドすると、 ``maven-bundle-plugin`` が ``MANIFEST.MF`` ファイルの生成を処理します。コンパイルされたJARの ``MANIFEST.MF`` ファイルを開くと、プラグインによって、エクスポート・パッケージを宣言するマニフェスト・ヘッダーが生成されたことがわかります。OSGiでは、公開して他のバンドルで使用できるようにするすべてのバンドルを ``MANIFEST.MF`` の ``Export-Package`` 要素内に列挙する必要があります。
-[start=13]
+
. ``MANIFEST.MF`` に ``Export-Package`` 要素(次の例で*太字*で示された要素)が含まれていることを確認します。
[source,java]
@@ -342,22 +342,22 @@
``Hello`` を実装すると、MavenHelloServiceApiプロジェクトを依存性として追加することによって解決する必要があるエラーがIDEに表示されます。
-[start=12]
+
. 「プロジェクト」ウィンドウの*MavenHelloServiceImpl*の「依存性」ノードを右クリックし、「依存性の追加」を選択します。
-[start=13]
+
. 「ライブラリの追加」ダイアログで、「開いているプロジェクト」タブをクリックします。
-[start=14]
+
. 「MavenHelloServiceApi OSGiバンドル」を選択します。「追加」をクリックします。
image::images/cdi-add-dependency.png[title="「ライブラリの追加」ダイアログの「開いているプロジェクト」タブ"]
-[start=15]
+
. エディタで開いている ``HelloImpl.java`` クラス内を右クリックして「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、 ``com.mycompany.mavenhelloserviceapi.Hello`` のインポート文を追加します。変更を保存します。
-[start=16]
+
. 「 ``com.mycompany.mavenhelloserviceimpl`` 」パッケージを展開し、「 ``Activator.java`` 」をダブルクリックしてこのファイルをエディタで開きます。
image::images/cdi-activator.png[title="「プロジェクト」ウィンドウのActivatorクラス"]
@@ -367,7 +367,7 @@
OSGiバンドルにはバンドル・アクティベータ・クラスは必要ありませんが、アクティベータ・クラスで ``start()`` メソッドを使用して、たとえば、バンドルが必要とするサービスまたはその他のリソースを初期化できます。この課題では、「出力」ウィンドウにメッセージを出力するクラスに、少量のコード行を追加します。これにより、バンドルが開始および停止するタイミングを簡単に識別できます。
-[start=17]
+
. バンドル・アクティベータ・クラスの ``start()`` および ``stop()`` メソッドを変更して、次の行(太字部分)を追加します。
[source,java]
@@ -412,10 +412,10 @@
バンドルをビルドすると、プラグインは、マニフェスト・ヘッダーをJAR内にあるバンドルのマニフェスト・ファイルに生成し、バンドル・アクティベータ・クラスを指定します。バンドルがデプロイされると、OSGiランタイムがマニフェスト・ファイル内の ``Bundle-Activator`` ヘッダーを検索します。
-[start=18]
+
. ``Activator.java`` のインポート文を修正して、 ``com.mycompany.mavenhelloserviceapi.Hello`` をインポートします。変更を保存します。
-[start=19]
+
. 「依存性」ノードを展開し、 ``org.osgi.core`` アーティファクトが依存性として表示されたことを確認します。
NOTE: 「依存性」ノードに古いバージョンのアーティファクトがリストされている場合、アーティファクトを右クリックして「依存性を削除」を選択し、削除します。依存性は、MavenHelloServiceApiプロジェクトおよび ``org.osgi.core`` アーティファクトのみである必要があります。
@@ -433,10 +433,10 @@
プロジェクトをビルドすると、IDEによって各プロジェクトの ``target`` フォルダ内にJARファイルが作成され、ローカル・リポジトリにもスナップショットJARがインストールされます。「ファイル」ウィンドウで、2つのバンドル・プロジェクトの ``target`` フォルダをそれぞれ展開すると、2つのJARアーカイブ( ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` および ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` )が表示されます。
-[start=2]
+
. GlassFishサーバーを起動します(まだ起動していない場合)。
-[start=3]
+
. ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` をGlassFishインストールの ``glassfish/domains/domain1/autodeploy/bundles/`` ディレクトリにコピーします。
「出力」ウィンドウ内のGlassFishのサーバー・ログに、次のような出力が表示されるはずです。
@@ -452,7 +452,7 @@
「出力」ウィンドウにサーバー・ログが表示されない場合は、「サービス」ウィンドウのGlassFishサーバー・ノードを右クリックして、「ドメイン・サーバー・ログを表示」を選択します。
-[start=4]
+
. これらの手順を繰り返して、 ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` を ``autodeploy/bundles`` ディレクトリにコピーします。
これで、GlassFishのサーバー・ログに次のような出力が表示されるはずです。
@@ -529,7 +529,7 @@
----
-[start=3]
+
. 次の要素を追加して、POMにGlassFishリポジトリを追加します。変更を保存します。
[source,xml]
@@ -584,7 +584,7 @@
NOTE: HttpServletメソッドを削除するには、エディタの折りたたみを展開する必要があります。
-[start=10]
+
. 次のコード(太字部分)を入力してサービスを注入します。
[source,java]
@@ -599,7 +599,7 @@
}
----
-[start=11]
+
. 次の ``doGet`` メソッドを追加します。
[source,java]
@@ -613,19 +613,19 @@
}
----
-[start=12]
+
. プロジェクト・ノードを右クリックし、「新規」>「その他」を選択します。
-[start=13]
+
. 「コンテキストと依存性の注入」カテゴリで*beans.xml*を選択します。「次」をクリックします。
-[start=14]
+
. デフォルトのファイル名( ``beans`` )を使用します。「終了」をクリックします。
「終了」をクリックすると、ウィザードによってWebアプリケーション内に ``beans.xml`` ファイルが作成されます。 ``beans.xml`` がアプリケーションの一部である場合は、CDIが自動的に有効になります。
-[start=15]
+
. ``beans.xml`` ファイルを変更して、 ``bean-discovery-mode`` のデフォルト値を ``all`` に変更します。
[source,java]
@@ -641,31 +641,31 @@
* Java EE 7チュートリアルのlink:http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv001.htm[+25.1 CDIアプリケーションのパッケージ+]
* link:http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions[+http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions+]
-[start=16]
+
. 「プロジェクト」ウィンドウのMavenHelloWebClientの「依存性」ノードを右クリックし、「依存性の追加」を選択します。
-[start=17]
+
. 「スコープ」として「*Provided*」を選択します。
-[start=18]
+
. 「ライブラリの追加」ダイアログで、「開いているプロジェクト」タブをクリックし、「*MavenHelloServiceApi OSGiバンドル*」を選択します。「追加」をクリックします。
-[start=19]
+
. もう一度「依存性」ノードを右クリックし、「依存性の追加」を選択します。
-[start=20]
+
. 「ライブラリの追加」ダイアログで「依存性管理」タブをクリックし、親POMプロジェクトで指定した ``osgi-cdi-api`` アーティファクトを選択します。「追加」をクリックします。
image::images/cdi-add-dependency3.png[title="「ライブラリの追加」ダイアログの「依存性管理」タブ"]
-[start=21]
+
. エディタで ``HelloServlet.java`` 内を右クリックし、「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択して ``com.mycompany.mavenhelloserviceapi.Hello`` 、 ``javax.inject.Inject`` および ``org.glassfish.osgicdi.OSGiService`` を追加します。変更を保存します。
NOTE: ``com.mycompany.mavenhelloserviceapi.Hello`` のインポート文がIDEによって自動的に追加されない場合は、手動で追加する必要があります。
-[start=22]
+
. MavenOSGiCDIProjectを右クリックし、「消去してビルド」を選択します。
プロジェクトをビルドすると、「出力」ウィンドウに次のような出力が表示されるはずです。
@@ -751,7 +751,7 @@
----
-[start=3]
+
. ``maven-war-plugin`` の構成要素を変更して、 ``MANIFEST.MF`` にバンドル情報を追加します。変更を保存します。
[source,xml]
@@ -779,7 +779,7 @@
</plugin>
----
-[start=4]
+
. 「プロジェクト」ウィンドウでMavenHelloWebClientプロジェクト・ノードを右クリックし、「消去してビルド」を選択します。
これで、WARアーカイブを展開して ``MANIFEST.MF`` をエディタで開くと、 ``maven-bundle-plugin`` の構成で指定した ``Web-ContextPath: /mavenhellowebclient`` エントリやバンドル名エントリを含む追加情報が ``MANIFEST.MF`` に含まれていることがわかります。
@@ -851,10 +851,10 @@
「サービス」ウィンドウのGlassFishサーバー・ノードを右クリックし、「ドメイン管理コンソールを表示」を選択します。
-[start=2]
+
. 左側のナビゲーション列で「更新ツール」をクリックします。
-[start=3]
+
. 利用可能なアドオンの一覧から ``glassfish-osgi-gui`` を選択します。
「インストール」をクリックしてライセンスに同意します。
@@ -862,7 +862,7 @@
image::images/cdi-glassfish-addons.png[title="更新ツールGlassFish管理コンソール"]
-[start=4]
+
. GlassFishサーバーを再起動します。
*重要: *GlassFish Server 3.1.2.2を使用している場合、 ``_GLASSFISH-INSTALL_/glassfish/config/`` ディレクトリにある ``osgi.properties`` ファイルを変更し、 ``org.osgi.framework.startlevel.beginning`` プロパティの値を"2"に設定する( ``org.osgi.framework.startlevel.beginning=2`` )必要があります。
@@ -870,10 +870,10 @@
link:http://www.java.net/forum/topic/glassfish/glassfish/cannot-start-web-console-glassfish-version-3122[+ Cannot start web console in Glassfish version 3.1.2.2+].
-[start=5]
+
. 管理コンソールを再度開き、左側のナビゲーション列で「*サーバー(管理サーバー)*」をクリックします。
-[start=6]
+
. 「OSGiコンソール」タブをクリックして、デプロイされているOSGiバンドルの一覧を表示します。
image::images/cdi-glassfish-console.png[title="「ライブラリの追加」ダイアログの「依存性管理」タブ"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_pt_BR.asciidoc
index 1040e36..90ce3da 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_pt_BR.asciidoc
@@ -99,13 +99,13 @@
image::images/cdi-newpomproject.png[title="Arquétipo do Projeto POM Maven no Assistente de Novo Projeto"]
-[start=3]
+
. Digite *MavenOSGiCDIProject* como nome do Projeto. Clique em Finalizar.
Quando você clica em Finalizar, o IDE cria o projeto POM e abre o projeto na janela Projetos.
-[start=4]
+
. Expanda o nó dos Arquivos do Projeto na janela Projetos e clique duas vezes em ``pom.xml`` para abrir o arquivo no editor.
O POM básico do projeto deverá ser similar ao seguinte.
@@ -128,7 +128,7 @@
----
-[start=5]
+
. Modifique o ``pom.xml`` pai para adicionar os elementos a seguir. Salve as alterações.
[source,xml]
@@ -179,10 +179,10 @@
image::images/cdi-new-osgiproject.png[title="Arquétipo do Pacote OSGI Maven no assistente de Novo Projeto"]
-[start=3]
+
. Digite *MavenHelloServiceApi* como Nome do Projeto.
-[start=4]
+
. Clique em Procurar e selecione o projeto POM *MavenOSGiCDIProject* como o Local. Clique em Finalizar.
Quando você clica em Finalizar, o IDE cria o projeto do pacote e abre o projeto na janela Projetos. Se você abrir ``pom.xml`` para o projeto MavenHelloServiceApi no editor, verá que o elemento ``encapsulamento`` especifica o ``pacote`` e que o ``plug-in-do-pacote-maven`` será usado ao construir o pacote.
@@ -244,25 +244,25 @@
Você também poderá ver que, ao criar um projeto de pacote OSGi utilizando o arquétipo do Pacote OSGi Maven, o IDE adicionou o artefato ``org.osgi.core`` como uma dependência por padrão.
-[start=5]
+
. Clique com o botão direito do mouse no nó do projeto MavenHelloServiceApi na janela Projetos e selecione Propriedades.
-[start=6]
+
. Selecione a categoria Códigos-fonte na caixa de diálogo Propriedades do Projeto.
-[start=7]
+
. Defina *Source/Binary Format* como 1.6 e confirme se a *Codificação* é UTF-8. Clique em OK.
-[start=8]
+
. Clique com o botão direito do mouse no nó Pacotes de Código-fonte e selecione Novo > Interface Java.
-[start=9]
+
. Digite *Hello* como Nome da Classe.
-[start=10]
+
. Selecione *com.mycompany.mavenhelloserviceapi* como o Pacote. Clique em Finalizar.
-[start=11]
+
. Adicione o método ``sayHello`` a seguir à interface (em negrito) e salve as alterações.
[source,java]
@@ -273,7 +273,7 @@
}
----
-[start=12]
+
. Clique com o botão direito do mouse no nó do projeto na janela Projetos e selecione Construir.
Depois de construir o projeto, se você abrir a janela Arquivos e expandir o nó do projeto, verá que ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` foi criado na pasta de ``destino`` .
@@ -283,7 +283,7 @@
O ``plug-in-do-pacote-maven`` trata da geração do arquivo ``MANIFEST.MF`` ao construir o projeto. Se abrir o arquivo ``MANIFEST.MF`` no JAR compilado, você verá que o plug-in gerou um cabeçalho de manifesto que declara os pacotes exportados. Para OSGi, todos os pacotes que você deseja que sejam expostos e estejam disponíveis para outros pacotes devem ser listados no elemento ``Exportar-Pacote`` no ``MANIFEST.MF`` .
-[start=13]
+
. Confirme se o ``MANIFEST.MF`` contém o elemento ``Export-Package`` (o elemento mostrado em *negrito* no exemplo abaixo).
[source,java]
@@ -342,22 +342,22 @@
Quando você implementar ``Hello`` , o IDE exibirá um erro que deverá ser resolvido adicionando o projeto MavenHelloServiceApi como uma dependência.
-[start=12]
+
. Clique com o botão direito do mouse no nó Dependências do *MavenHelloServiceImpl* na janela Projetos e selecione Adicionar Dependência.
-[start=13]
+
. Clique na guia Abrir Projetos na caixa de diálogo Adicionar Biblioteca.
-[start=14]
+
. Selecione o Pacote OSGi MavenHelloServiceApi. Clique em Add.
image::images/cdi-add-dependency.png[title="Clique na guia Abrir Projetos na caixa de diálogo Adicionar Biblioteca."]
-[start=15]
+
. Clique com o botão direito do mouse na classe ``HelloImpl.java`` que está aberta no editor e selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) para adicionar uma instrução de importação para ``com.mycompany.mavenhelloserviceapi.Hello`` . Salve as alterações.
-[start=16]
+
. Expanda o pacote ``com.mycompany.mavenhelloserviceimpl`` e clique duas vezes em ``Activator.java`` para abrir o arquivo no editor.
image::images/cdi-activator.png[title="Classe do ativador na janela Projetos"]
@@ -367,7 +367,7 @@
Um pacote OSGi não requer uma classe de ativador de pacote, mas é possível utilizar o método ``start()`` na classe do ativador, por exemplo, para inicializar serviços ou outros recursos necessários para o pacote. Neste exercício, você adicionará algumas linhas de código à classe que imprimirá mensagens na janela de Saída. Isso facilitará a identificação de quando um pacote é iniciado e parado.
-[start=17]
+
. Modifique os métodos ``start()`` e ``stop()`` na classe do ativador do pacote para adicionar as linhas a seguir (em negrito).
[source,java]
@@ -412,10 +412,10 @@
Quando você construir o pacote, o plug-in gerará um Cabeçalho de Manifesto no arquivo de manifesto do pacote no JAR e especificará a classe do Ativador do Pacote. O runtime do OSGi procura pelo cabeçalho ``Bundle-Activator`` no arquivo do manifesto quando um pacote é implantado.
-[start=18]
+
. Corrija as instruções de importação em ``Activator.java`` para importar ``com.mycompany.mavenhelloserviceapi.Hello`` . Salve as alterações.
-[start=19]
+
. Expanda o nó Dependências e confirme se o artefato ``org.osgi.core`` é listado como uma dependência.
NOTE: Remova todas as versões mais antigas do artefato que são listadas no nó Dependências, clicando com o botão direito do mouse no artefato e escolhendo Remover Dependência. As únicas dependências devem ser o projeto MavenHelloServiceApi e o artefato ``org.osgi.core`` .
@@ -433,10 +433,10 @@
Quando você construir o projeto, o IDE criará os arquivos JAR na pasta de ``destino`` de cada um dos projetos e também instalará o JAR de snapshot no repositório local. Na janela Arquivos, você pode expandir a pasta de ``destino`` para cada um dos dois projetos de pacotes e ver os dois arquivos compactados JAR ( ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` e ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` ).
-[start=2]
+
. Inicie o GlassFish Server, se ainda não o tiver feito.
-[start=3]
+
. Copie o ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` para o diretório ``glassfish/domains/domain1/autodeploy/bundles/`` da instalação do GlassFish.
No log do GlassFish Server, na janela de Saída, você deverá ver uma saída semelhante à mostrada a seguir.
@@ -452,7 +452,7 @@
Clique com o botão direito do mouse no nó do GlassFish Server na janela Serviços e selecione Exibir Log do Servidor de Domínio, se o log do servidor não estiver visível na janela de Saída.
-[start=4]
+
. Repita as etapas para copiar o ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` no diretório ``autodeploy/bundles`` .
No log do GlassFish Server, você agora deverá ver uma saída semelhante à mostrada a seguir.
@@ -529,7 +529,7 @@
----
-[start=3]
+
. Adicione os elementos a seguir para adicionar o repositório do GlassFish ao POM. Salve as alterações.
[source,xml]
@@ -584,7 +584,7 @@
NOTE: Você precisará expandir a pasta do editor para deletar os métodos do HttpServlet.
-[start=10]
+
. Digite o código a seguir (em negrito) para injetar o serviço.
[source,java]
@@ -599,7 +599,7 @@
}
----
-[start=11]
+
. Adicione o método ``doGet`` a seguir.
[source,java]
@@ -613,19 +613,19 @@
}
----
-[start=12]
+
. Clique com o botão direito do mouse no nó do projeto e selecione Novo > Outro.
-[start=13]
+
. Selecione *beans.xml* na categoria Contextos e Injeção de Dependências. Clique em Próximo.
-[start=14]
+
. Use o nome de arquivo default ( ``beans`` ). Clique em Finalizar.
Quando você clicar em Finalizar, o assistente criará o arquivo ``beans.xml`` na aplicação Web. O CDI será automaticamente ativado se o ``beans.xml`` for parte da aplicação.
-[start=15]
+
. Modifique o arquivo ``beans.xml`` para alterar o valor padrão de ``bean-discovery-mode`` para ``all`` .
[source,java]
@@ -641,31 +641,31 @@
* link:http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv001.htm[+25.1 Encapsulando Aplicações CDI+] no Tutorial do Java EE 7
* link:http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions[+http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions+]
-[start=16]
+
. Clique com o botão direito do mouse no nó Dependências do MavenHelloWebClient na janela Projetos e selecione Adicionar Dependência.
-[start=17]
+
. Selecione *Provided* como o Escopo.
-[start=18]
+
. Clique na guia Abrir Projetos na caixa de diálogo Adicionar Biblioteca e selecione *Pacote OSGi MavenHelloServiceApi*. Clique em Add.
-[start=19]
+
. Clique novamente com o botão direito do mouse no nó Dependências e selecione Adicionar Dependência.
-[start=20]
+
. Clique na guia Gerenciamento de Dependências na caixa de diálogo Adicionar Biblioteca e selecione o artefato ``osgi-cdi-api`` que você especificou no projeto POM pai. Clique em Add.
image::images/cdi-add-dependency3.png[title="Guia de Gerenciamento de Dependências na caixa de diálogo Adicionar Biblioteca"]
-[start=21]
+
. Clique com o botão direito do mouse em ``HelloServlet.java`` no editor e selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) para adicionar ``com.mycompany.mavenhelloserviceapi.Hello`` , ``javax.inject.Inject`` e ``org.glassfish.osgicdi.OSGiService`` . Salve as alterações.
NOTE: Pode ser preciso adicionar manualmente uma instrução de importação para o ``com.mycompany.mavenhelloserviceapi.hello`` se o IDE não adicionar automaticamente para você.
-[start=22]
+
. Clique com o botão direito do mouse em MavenOSGiCDIProject e selecione Limpar e Construir.
Ao construir o projeto, na janela de Saída, você deverá ver uma saída semelhante à seguinte.
@@ -751,7 +751,7 @@
----
-[start=3]
+
. Modifique os elementos de configuração do ``maven-war-plugin`` para adicionar informações do pacote ao ``MANIFEST.MF`` . Salve as alterações.
[source,xml]
@@ -779,7 +779,7 @@
</plugin>
----
-[start=4]
+
. Clique com o botão direito do mouse no nó do projeto MavenHelloWebClient na janela Projetos e selecione Limpar e Construir.
Ao expandir o arquivo compactado WAR e abrir o ``MANIFEST.MF`` no editor, você verá que o ``MANIFEST.MF`` contém informações adicionais, incluindo a entrada ``Web-ContextPath: /mavenhellowebclient`` especificada na configuração ``maven-bundle-plugin`` e entradas de nome de pacote.
@@ -851,10 +851,10 @@
Clique com o botão direito do mouse no nó do GlassFish server na janela Serviços e selecione Exibir Console de Admin de Domínio.
-[start=2]
+
. Clique na Ferramenta de Atualização na coluna de navegação esquerda.
-[start=3]
+
. Selecione ``glassfish-osgi-gui`` na lista de add-ons disponíveis.
Clique em Instalar e aceite a licença.
@@ -862,7 +862,7 @@
image::images/cdi-glassfish-addons.png[title="Ferramenta de Atualização da Console de Admin do GlassFish"]
-[start=4]
+
. Reinicie o GlassFish Server.
*Importante:* se você estiver executando GlassFish Server 3.1.2.2 você precisará modificar o arquivo ``osgi.properties`` localizado no diretório ``_GLASSFISH-INSTALL_/glassfish/config/`` e definir o valor da propriedade ``org.osgi.framework.startlevel.beginning`` como "2" ( ``org.osgi.framework.startlevel.beginning=2`` ).
@@ -870,10 +870,10 @@
link:http://www.java.net/forum/topic/glassfish/glassfish/cannot-start-web-console-glassfish-version-3122[+Não é possível iniciar a console Web no Glassfish versão 3.1.2.2+].
-[start=5]
+
. Abra a Console de Admin novamente e clique em *servidor (Servidor de Admin)* na coluna de navegação esquerda.
-[start=6]
+
. Clique na guia da Console do OSGi para exibir uma lista de pacotes OSGi implantados.
image::images/cdi-glassfish-console.png[title="Guia de Gerenciamento de Dependências na caixa de diálogo Adicionar Biblioteca"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ru.asciidoc
index bc8c2ec..1b90df0 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_ru.asciidoc
@@ -99,13 +99,13 @@
image::images/cdi-newpomproject.png[title="Архетип проекта Maven POM в мастере создания проектов"]
-[start=3]
+
. Введите *MavenOSGiCDIProject* в поле имени проекта. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE создает проект POM и открывает проект в окне "Проекты".
-[start=4]
+
. Разверните узел "Файлы проекта" в окне проектов и дважды щелкните файл ``pom.xml`` , чтобы открыть файл в редакторе.
Базовый файл POM для проекта должен быть аналогичен следующему.
@@ -128,7 +128,7 @@
----
-[start=5]
+
. Измените родительский файл ``pom.xml`` , добавив следующие элементы. Сохраните изменения.
[source,xml]
@@ -179,10 +179,10 @@
image::images/cdi-new-osgiproject.png[title="Архетип набора Maven OSGi в мастере создания проектов"]
-[start=3]
+
. Введите в поле имени проекта *MavenHelloServiceApi*.
-[start=4]
+
. Нажмите кнопку "Обзор" и выберите в качестве расположения проект POM *MavenOSGiCDIProject*. Нажмите кнопку "Завершить".
После нажатия кнопки "Готово" среда IDE создает проект и открывает его в окне проектов. Если открыть ``pom.xml`` для проекта MavenHelloServiceApi в редакторе, то вы увидите, что элемент ``packaging`` определяет ``bundle`` , и что ``maven-bundle-plugin`` будет использоваться при сборке пакета.
@@ -244,25 +244,25 @@
Также можно увидеть, что при создании проекта пакета OSGi с использованием архетипа пакета Maven OSGi среда IDE добавляет артефакт ``org.osgi.core`` в качестве зависимости по умолчанию.
-[start=5]
+
. Щелкните правой кнопкой мыши узел проекта MavenHelloServiceApi в окне проектов и выберите пункт "Свойства".
-[start=6]
+
. Выберите в диалоговом окне "Свойства проекта" категорию "Исходные файлы".
-[start=7]
+
. Укажите для параметра *Формат исходных/двоичных файлов* значение 1.6 и подтвердите, что *кодировка* — UTF-8. Нажмите кнопку "ОК".
-[start=8]
+
. Щелкните правой кнопкой мыши узел "Исходные пакеты" в окне проектов и выберите пункт "Создать" > "Интерфейс Java".
-[start=9]
+
. Введите в поле "Имя класса *Hello*.
-[start=10]
+
. Выберите пакет *com.mycompany.mavenhelloserviceapi*. Нажмите кнопку "Завершить".
-[start=11]
+
. Добавьте следующий метод ``sayHello`` к интерфейсу (выделено жирным) и сохраните изменения.
[source,java]
@@ -273,7 +273,7 @@
}
----
-[start=12]
+
. Щелкните правой кнопкой мыши узел проекта в окне проектов и выберите "Сборка".
После сборки проекта, если открыть окно "Файлы" и развернуть узел проекта, вы увидите, что файл ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` создан в папке ``target`` .
@@ -283,7 +283,7 @@
Подключаемый модуль ``maven-bundle-plugin`` обрабатывает создание файла ``MANIFEST.MF`` при сборке проекта. Если открыть файл ``MANIFEST.MF`` в скомпилированном файле JAR, можно увидеть, что модуль создал заголовок манифеста, который объявляет экспортные пакеты. Для OSGi все пакеты, которые нужно предоставить и сделать доступными для других пакетов, должны быть перечислены в элементе ``Export-Package`` в файле ``MANIFEST.MF`` .
-[start=13]
+
. Убедитесь, что файл ``MANIFEST.MF`` содержит элемент ``Export-Package`` (в приведенном ниже примере этот элемент выделен *жирным шрифтом*).
[source,java]
@@ -342,22 +342,22 @@
При внедрении ``Hello`` среда IDE отобразит ошибку, которую необходимо разрешить добавлением проекта MavenHelloServiceApi в качестве зависимости.
-[start=12]
+
. Щелкните правой кнопкой мыши узел "Зависимости" в *MavenHelloServiceImpl* в окне проектов и выберите пункт "Добавить зависимость".
-[start=13]
+
. Щелкните вкладку "Открытые проекты" в диалоговом окне "Добавить библиотеку".
-[start=14]
+
. Выберите пакет OSGi MavenHelloServiceApi. Нажмите кнопку "Add".
image::images/cdi-add-dependency.png[title="Откройте вкладку "Проекты" в диалоговом окне "Добавить библиотеку"."]
-[start=15]
+
. Щелкните правой кнопкой мыши класс ``HelloImpl.java`` , открытый в редакторе и выберите 'Исправить выражения импорта' (Alt-Shift-I; ⌘-Shift-I в Mac), чтобы добавить оператор импорта для ``com.mycompany.mavenhelloserviceapi.Hello`` . Сохраните изменения.
-[start=16]
+
. Разверните пакет ``com.mycompany.mavenhelloserviceimpl`` и дважды щелкните ``Activator.java`` для открытия файла в редакторе.
image::images/cdi-activator.png[title="Класс 'Активатор' в окне 'Проекты'."]
@@ -367,7 +367,7 @@
Класс активатора не является обязательным для пакета OSGi, но метод ``start()`` в классе активатора можно использовать, например, для инициализации служб или других нужных пакету ресурсов. В этом упражнении будут добавлены несколько строк кода в класс, который будет выводить сообщения в "Окно вывода". Это позволит определить, когда пакет запускается и останавливается.
-[start=17]
+
. Измените методы ``start()`` и ``stop()`` в классе активатора пакета, чтобы добавить следующие строки (выделено жирным).
[source,java]
@@ -412,10 +412,10 @@
При сборке пакета подключаемый модуль создает заголовок манифеста в файле манифеста проекта в файле JAR и указывает класс активатора пакета. При развертывании пакета среда выполнения OSGi ищет в файле манифеста заголовок ``Bundle-Activator`` .
-[start=18]
+
. Исправьте операторы импорта в ``Activator.java`` для импорта ``com.mycompany.mavenhelloserviceapi.Hello`` . Сохраните изменения.
-[start=19]
+
. Разверните узел "Зависимости" и убедитесь, что артефакт ``org.osgi.core`` добавлен в список зависимостей.
NOTE: Удалите все предыдущие версии артефакта в узле 'Зависимости'. Для этого щелкните артефакт правой кнопкой мыши и выберите 'Удалить зависимость'. Узел "Зависимости" должен содержать только проект MavenHelloServiceApi и артефакт ``org.osgi.core`` .
@@ -433,10 +433,10 @@
При сборке проекта среда IDE создает файлы JAR в папке ``target`` каждого из проектов, а также устанавливает снимок JAR в локальный репозиторий. В окне "Файлы" можно развернуть папку ``target`` для каждого из двух проектов пакетов чтобы увидеть два архива JAR ( ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` и ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` ).
-[start=2]
+
. Запустите сервер GlassFish, если он еще не запущен.
-[start=3]
+
. Скопируйте ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` в каталог ``glassfish/domains/domain1/autodeploy/bundles/`` вашей установки GlassFish.
Вы должны увидеть выходные данные, похожие на следующие данные журнала сервера GlassFish, в окне выходных данных.
@@ -452,7 +452,7 @@
Щелкните правой кнопкой мыши узел сервера GlassFish в окне "Службы" и выберите пункт "Просмотреть журнал сервера домена", если журнал сервера не виден в окне вывода.
-[start=4]
+
. Повторите действия по копированию файла ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` в каталог ``autodeploy/bundles`` .
Теперь в журнале сервера GlassFish вы должны видеть примерно следующий результат.
@@ -481,10 +481,10 @@
В этом упражнении указываются элементы зависимости в родительском проекте POM. Кроме того, добавляется репозиторий для артефактов, который будет использоваться в проекте.
-[start=1]
+
. Разверните узел "Файлы проекта" в проекте *MavenOSGiCDIProject* в окне проектов и дважды щелкните файл ``pom.xml`` , чтобы открыть файл в редакторе.
-[start=2]
+
. Измените родительский файл ``pom.xml`` , добавив следующие элементы управления зависимостями (выделены жирным шрифтом). Сохраните изменения.
[source,xml]
@@ -533,7 +533,7 @@
----
-[start=3]
+
. Добавьте следующие элементы, чтобы добавить к POM репозиторий GlassFish. Сохраните изменения.
[source,xml]
@@ -588,7 +588,7 @@
NOTE: Потребуется расширить свертывание редактора для удаления методов HttpServlet.
-[start=10]
+
. Для внедрения службы введите следующий код (выделен жирным).
[source,java]
@@ -603,7 +603,7 @@
}
----
-[start=11]
+
. Добавьте следующий метод ``doGet`` .
[source,java]
@@ -617,19 +617,19 @@
}
----
-[start=12]
+
. Щелкните узел проекта правой кнопкой мыши и выберите команду "Создать" > "Другие".
-[start=13]
+
. Выберите *beans.xml* в категории "Подключение контекстов и зависимостей". Нажмите кнопку "Далее".
-[start=14]
+
. Используйте имя файла по умолчанию ( ``beans`` ). Нажмите кнопку "Завершить".
При нажатии кнопки "Готово" мастер создает в веб-приложении файл ``beans.xml`` . Среда CDI автоматически включена, если ``beans.xml`` является частью приложения.
-[start=15]
+
. В файле ``beans.xml`` измените значение параметра ``bean-discovery-mode`` на ``all`` .
[source,java]
@@ -645,31 +645,31 @@
* link:http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv001.htm[+25.1 Упаковка приложений CDI+] в учебном курсе по Java EE 7
* link:http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions[+http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions+]
-[start=16]
+
. Щелкните правой кнопкой мыши узел "Зависимости" в MavenHelloWebClient в окне проектов и выберите пункт "Добавить зависимость".
-[start=17]
+
. Выберите *"Предоставленный"* в качестве области действия.
-[start=18]
+
. Щелкните в диалоговом окне добавления библиотеки вкладку "Открытые проекты" и выберите *пакет MavenHelloServiceApi OSGi *. Нажмите кнопку "Add".
-[start=19]
+
. Снова щелкните правой кнопкой мыши узел "Зависимости" и выберите пункт "Добавить зависимость".
-[start=20]
+
. Щелкните вкладку "Управление зависимостями" в диалоговом окне "Добавить библиотеку" и выберите артефакт ``osgi-cdi-api`` , указанный в родительском проекте POM. Нажмите кнопку "Add".
image::images/cdi-add-dependency3.png[title="Вкладка 'Управление зависимостями' в диалоговом окне 'Добавить библиотеку'"]
-[start=21]
+
. Щелкните правой кнопкой мыши ``HelloServlet.java`` в редакторе и выберите 'Исправить выражения импорта' (Alt-Shift-I; ⌘-Shift-I в Mac), чтобы добавить ``com.mycompany.mavenhelloserviceapi.Hello`` , ``javax.inject.Inject`` и ``org.glassfish.osgicdi.OSGiService`` . Сохраните изменения.
NOTE: Может потребоваться добавление вручную операторов импорта для ``com.mycompany.mavenhelloserviceapi.Hello`` , если среда IDE не добавит их автоматически.
-[start=22]
+
. Щелкните правой кнопкой мыши MavenOSGiCDIProject и выберите пункт "Очистка и сборка".
При сборке проекта в окне вывода должен появиться результат, похожий на следующий.
@@ -755,7 +755,7 @@
----
-[start=3]
+
. Исправьте элементы настройки в ``maven-war-plugin`` , чтобы добавить информацию о пакете к ``MANIFEST.MF`` . Сохраните изменения.
[source,xml]
@@ -783,7 +783,7 @@
</plugin>
----
-[start=4]
+
. Щелкните правой кнопкой мыши узел проекта MavenHelloWebClient project в окне проектов и выберите пункт "Очистка и сборка".
Теперь, если развернуть архив WAR и открыть файл ``MANIFEST.MF`` в редакторе, видно, что ``MANIFEST.MF`` теперь содержит дополнительные сведения, в том числе запись ``Web-ContextPath: /mavenhellowebclient`` , указанную в настройке ``maven-bundle-plugin`` и записях имени пакета.
@@ -855,10 +855,10 @@
Щелкните правой кнопкой мыши узел сервера GlassFish в окне "Службы" и выберите пункт "Просмотреть консоль администрирования домена".
-[start=2]
+
. Щелкните средство обновления в левом столбце навигации.
-[start=3]
+
. Выберите ``glassfish-osgi-gui`` из списка допустимых надстроек.
Нажмите "Установить" и примите лицензионное соглашение.
@@ -866,7 +866,7 @@
image::images/cdi-glassfish-addons.png[title="Средство обновления консоли администратора GlassFish"]
-[start=4]
+
. Перезапустите сервер приложений GlassFish.
*Важно!* При работе с GlassFish Server 3.1.2.2 необходимо внести изменения в файл ``osgi.properties`` , который находится в каталоге ``_GLASSFISH-INSTALL_/glassfish/config/`` , и задать для свойства ``org.osgi.framework.startlevel.beginning`` значение '2' ( ``org.osgi.framework.startlevel.beginning=2`` ).
@@ -874,10 +874,10 @@
link:http://www.java.net/forum/topic/glassfish/glassfish/cannot-start-web-console-glassfish-version-3122[+ Невозможно запустить веб-консоль на Glassfish версии 3.1.2.2+].
-[start=5]
+
. Снова откройте консоль администрирования и выберите пункт *сервер (сервер администрирования)* в левом столбце навигации.
-[start=6]
+
. Щелкните по вкладке консоли OSGi, чтобы просмотреть список развернутых пакетов OSGi.
image::images/cdi-glassfish-console.png[title="Вкладка 'Управление зависимостями' в диалоговом окне 'Добавить библиотеку'"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_zh_CN.asciidoc
index 3e40316..f791db3 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-osgiservice-cdi_zh_CN.asciidoc
@@ -99,13 +99,13 @@
image::images/cdi-newpomproject.png[title="新建项目向导中 Maven POM 项目原型"]
-[start=3]
+
. 键入 *MavenOSGiCDIProject* 作为项目名称。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将创建 POM 项目并在 "Projects"(项目)窗口中打开该项目。
-[start=4]
+
. 在 "Projects"(项目)窗口中展开 "Project Files"(项目文件)节点,然后双击 ``pom.xml`` 在编辑器中打开该文件。
项目的基本 POM 应类似于以下内容。
@@ -128,7 +128,7 @@
----
-[start=5]
+
. 修改父 ``pom.xml`` 以添加下列元素。保存所做的更改。
[source,xml]
@@ -179,10 +179,10 @@
image::images/cdi-new-osgiproject.png[title="新建项目向导中的 Maven OSGi 包原型"]
-[start=3]
+
. 键入 *MavenHelloServiceApi* 作为项目名称。
-[start=4]
+
. 单击 "Browse"(浏览),并选择 *MavenOSGiCDIProject* POM 项目作为位置。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将创建包项目并在 "Projects"(项目)窗口中打开该项目。如果在编辑器中打开 MavenHelloServiceApi 项目的 ``pom.xml`` ,则可以看到 ``packaging`` 元素指定了 ``bundle`` 并且构建包时将使用 ``maven-bundle-plugin`` 。
@@ -244,25 +244,25 @@
此外,您还可以看到,使用 Maven OSGi 包原型创建 OSGi 包项目时,IDE 在默认情况下将 ``org.osgi.core`` 工件添加为依赖关系。
-[start=5]
+
. 在 "Projects"(项目)窗口中右键单击 "MavenHelloServiceApi" 项目节点,然后选择 "Properties"(属性)。
-[start=6]
+
. 在 "Project Properties"(项目属性)对话框中选择 "Sources"(源)类别。
-[start=7]
+
. 将 *Source/Binary Format*(源代码/二进制格式)设置为 "1.6",并确认 *Encoding*(编码)是 "UTF-8"。单击 "OK"(确定)。
-[start=8]
+
. 在 "Projects"(项目)窗口中右键单击 "Source Packages"(源包)节点,然后选择 "New"(新建)> "Java Interface"(Java 接口)。
-[start=9]
+
. 键入 *Hello* 作为类名。
-[start=10]
+
. 在 "Package"(包)中选择 *com.mycompany.mavenhelloserviceapi*。单击 "Finish"(完成)。
-[start=11]
+
. 将以下 ``sayHello`` 方法添加到接口中(以粗体显示),然后保存所做的更改。
[source,java]
@@ -273,7 +273,7 @@
}
----
-[start=12]
+
. 在 "Projects"(项目)窗口中右键单击项目节点,并选择 "Build"(构建)。
构建项目后,如果打开 "Files"(文件)窗口,并展开项目节点,则可以看到在 ``target`` 文件夹中创建了 ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` 。
@@ -283,7 +283,7 @@
构建项目时, ``maven-bundle-plugin`` 将处理 ``MANIFEST.MF`` 文件的构建。如果打开已编译的 JAR 中的 ``MANIFEST.MF`` 文件,将看到此插件已生成一个清单标题,此标题声明了导出包。对于 OSGi,要公开并可供其他包使用的所有包都必须列在 ``MANIFEST.MF`` 的 ``Export-Package`` 元素中。
-[start=13]
+
. 确认 ``MANIFEST.MF`` 包含 ``Export-Package`` 元素(以下示例中*粗体*显示的元素)。
[source,java]
@@ -342,22 +342,22 @@
实现 ``Hello`` 时,IDE 将显示一个错误,您需要将 MavenHelloServiceApi 项目添加为依赖关系才能解决该错误。
-[start=12]
+
. 在 "Projects"(项目)窗口中右键单击 *MavenHelloServiceImpl* 的 "Dependencies"(依赖关系)节点,然后选择 "Add Dependency"(添加依赖关系)。
-[start=13]
+
. 在 "Add Library"(添加库)对话框中,单击 "Open Projects"(打开的项目)标签。
-[start=14]
+
. 选择 "MavenHelloServiceApi OSGi Bundle"(MavenHelloServiceApi OSGi 包)。单击 "ADD"(添加)。
image::images/cdi-add-dependency.png[title="在 "Add Library"(添加库)对话框中打开 "Projects"(项目)标签"]
-[start=15]
+
. 右键单击在编辑器中打开的 ``HelloImpl.java`` 类,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键),以添加 ``com.mycompany.mavenhelloserviceapi.Hello`` 的 import 语句。保存所做的更改。
-[start=16]
+
. 展开 ``com.mycompany.mavenhelloserviceimpl`` 包并双击 ``Activator.java`` ,即可在编辑器中打开该文件。
image::images/cdi-activator.png[title=""Projects"(项目)窗口中的激活器类"]
@@ -367,7 +367,7 @@
OSGi 包不需要包激活器类,但可以使用激活器类中的 ``start()`` 方法,例如,用于初始化包所需的服务或其他资源。在此练习中将向类中添加一些代码行,将消息打印到 "Output"(输出)窗口。这将更便于确定包启动和停止的时间。
-[start=17]
+
. 修改包激活器类中的 ``start()`` 和 ``stop()`` 方法,以添加下列行(以粗体显示)。
[source,java]
@@ -412,10 +412,10 @@
在构建包时,该插件将在 JAR 的包清单文件中构建清单标题,并指定包激活器类。部署包时,OSGi 运行时在清单文件中查找 ``Bundle-Activator`` 标题。
-[start=18]
+
. 在 ``Activator.java`` 中修复 import 语句,以导入 ``com.mycompany.mavenhelloserviceapi.Hello`` 。保存所做的更改。
-[start=19]
+
. 展开 "Dependencies"(依赖关系)节点,然后确认 ``org.osgi.core`` 工件作为依赖关系列出。
NOTE: 通过右键单击该工件并选择 "Remove Dependency"(移除依赖关系),移除 "Dependencies"(依赖关系)节点下列出的该工件的所有早期版本。唯一的依赖关系应是 MavenHelloServiceApi 项目和 ``org.osgi.core`` 工件。
@@ -433,7 +433,7 @@
构建项目时,IDE 将在每个项目的 ``target`` 文件夹中创建 JAR 文件,还将在本地资源库中安装快照 JAR。在 "Files"(文件)窗口中,可以展开两个包项目中任一个的 ``target`` 文件夹,以查看两个 JAR 档案( ``MavenHelloServiceApi-1.0-SNAPSHOT.jar`` 和 ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` )。
-[start=2]
+
. 启动 GlassFish Server(如果尚未启动)。
此时 "Output"(输出)窗口的 GlassFish Server 日志中应显示类似于以下内容的输出。
@@ -449,7 +449,7 @@
在 "Services"(服务)窗口中右键单击 "GlassFish Server" 节点,然后选择 "View Domain Server Log"(查看域服务器日志)(如果 "Output"(输出)窗口中不显示服务器日志)。
-[start=4]
+
. 重复执行相关步骤,将 ``MavenHelloServiceImpl-1.0-SNAPSHOT.jar`` 复制到 ``autodeploy/bundles`` 目录。
现在,GlassFish Server 日志中应显示类似于以下内容的输出。
@@ -478,10 +478,10 @@
在本练习中,将指定父 POM 项目中的依赖关系元素。此外,还将添加项目要使用的工件的资源库。
-[start=1]
+
. 在 "Projects"(项目)窗口中展开 *MavenOSGiCDIProject* 项目的 "Project Files"(项目文件)节点,然后双击 ``pom.xml`` 在编辑器中打开该文件。
-[start=2]
+
. 修改父 ``pom.xml`` 以添加下列依赖关系管理元素(以粗体显示)。保存所做的更改。
[source,xml]
@@ -530,7 +530,7 @@
----
-[start=3]
+
. 添加下列元素,将 GlassFish 资源库添加到 POM 中。保存所做的更改。
[source,xml]
@@ -585,7 +585,7 @@
NOTE: 需要展开编辑器折叠才能删除 HttpServlet 方法。
-[start=10]
+
. 键入以下将注入服务的代码(以粗体显示)。
[source,java]
@@ -600,7 +600,7 @@
}
----
-[start=11]
+
. 添加以下 ``doGet`` 方法。
[source,java]
@@ -614,19 +614,19 @@
}
----
-[start=12]
+
. 右键单击项目节点,然后选择 "New"(新建)> "Other"(其他)。
-[start=13]
+
. 在 "Contexts and Dependency Injection"(上下文和依赖关系注入)类别中选择 *beans.xml*。单击 "Next"(下一步)。
-[start=14]
+
. 使用默认文件名 ( ``beans`` )。单击 "Finish"(完成)。
单击 "Finish"(完成),此时该向导将在 Web 应用程序中创建 ``beans.xml`` 文件。如果 ``beans.xml`` 是该应用程序的一部分,则系统将自动启用 CDI。
-[start=15]
+
. 修改 ``beans.xml`` 文件以将 ``bean-discovery-mode`` 的默认值更改为 ``all`` 。
[source,java]
@@ -642,31 +642,31 @@
* Java EE 7 教程中的 link:http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv001.htm[+25.1:打包 CDI 应用程序+]
* link:http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions[+http://stackoverflow.com/questions/18107858/cdi-inject-fails-on-maven-embedded-glassfish-plugin-org-jboss-weld-exceptions+]
-[start=16]
+
. 在 "Projects"(项目)窗口中右键单击 "MavenHelloWebClient" 的 "Dependencies"(依赖关系)节点,然后选择 "Add Dependency"(添加依赖关系)。
-[start=17]
+
. 选择 *Provided* 作为作用域。
-[start=18]
+
. 在 "Add Library"(添加库)对话框中单击 "Open Projects"(打开的项目)标签,然后选择 *MavenHelloServiceApi OSGi Bundle(MavenHelloServiceApi OSGi 包)*。单击 "ADD"(添加)。
-[start=19]
+
. 再次右键单击 "Dependencies"(依赖关系)节点,然后选择 "Add Dependency"(添加依赖关系)。
-[start=20]
+
. 在 "Add Library"(添加库)对话框中单击 "Dependency Management"(依赖关系管理)标签,然后选择在父 POM 项目中指定的 ``osgi-cdi-api`` 工件。单击 "ADD"(添加)。
image::images/cdi-add-dependency3.png[title=""Add Library"(添加库)对话框中的 "Dependency Management"(依赖关系管理)标签"]
-[start=21]
+
. 在编辑器中右键单击 ``HelloServlet.java`` ,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键),以添加 ``com.mycompany.mavenhelloserviceapi.Hello`` 、 ``javax.inject.Inject`` 和 ``org.glassfish.osgicdi.OSGiService`` 。保存所做的更改。
NOTE: 如果 IDE 未自动添加 ``com.mycompany.mavenhelloserviceapi.Hello`` 的 import 语句,则可能需要手动进行添加。
-[start=22]
+
. 右键单击 "MavenOSGiCDIProject",然后选择 "Clean and Build"(清理并构建)。
构建项目时,"Output"(输出)窗口中应显示类似于以下内容的输出。
@@ -752,7 +752,7 @@
----
-[start=3]
+
. 修改 ``maven-war-plugin`` 的配置元素,将包信息添加到 ``MANIFEST.MF`` 中。保存所做的更改。
[source,xml]
@@ -780,7 +780,7 @@
</plugin>
----
-[start=4]
+
. 在 "Projects"(项目)窗口中,右键单击 "MavenHelloWebClient" 项目节点,然后选择 "Clean and Build"(清理并构建)。
如果您现在展开 WAR 档案,并在编辑器中打开 ``MANIFEST.MF`` ,则会看到 ``MANIFEST.MF`` 现在包含其他信息,包括您在 ``maven-bundle-plugin`` 配置和包名称条目中指定的 ``Web-ContextPath: /mavenhellowebclient`` 条目。
@@ -852,10 +852,10 @@
在 "Services"(服务)窗口中,右键单击 "GlassFish Server" 节点,然后选择 "View Domain Admin Console"(查看域管理控制台)。
-[start=2]
+
. 单击左侧导航栏中的 "Update Tool"(更新工具)。
-[start=3]
+
. 从可用附件列表中选择 ``glassfish-osgi-gui`` 。
单击 "Install"(安装),然后接受许可证。
@@ -863,7 +863,7 @@
image::images/cdi-glassfish-addons.png[title="GlassFish 管理控制台的 "Update Tool"(更新工具)"]
-[start=4]
+
. 重新启动 GlassFish Server。
*重要说明:*如果您运行的是 GlassFish Server 3.1.2.2,则需要修改位于 ``_GLASSFISH-INSTALL_/glassfish/config/`` 目录中的 ``osgi.properties`` 文件,并将 ``org.osgi.framework.startlevel.beginning`` 属性的值设置为 "2" ( ``org.osgi.framework.startlevel.beginning=2`` )。
@@ -871,10 +871,10 @@
link:http://www.java.net/forum/topic/glassfish/glassfish/cannot-start-web-console-glassfish-version-3122[+ 无法在 Glassfish 3.1.2.2 版中启动 Web 控制台+]。
-[start=5]
+
. 再次打开管理控制台,然后在左侧的导航栏中单击 *Server (Admin Server)*(服务器(管理服务器))。
-[start=6]
+
. 单击 "OSGi Console"(OSGi 控制台)标签,以查看已部署的 OSGi 包列表。
image::images/cdi-glassfish-console.png[title=""Add Library"(添加库)对话框中的 "Dependency Management"(依赖关系管理)标签"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi.asciidoc
index a82ab00..b122173 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi.asciidoc
@@ -137,7 +137,7 @@
}
----
-[start=6]
+
. Add the following field (in *bold*) to the class.
[source,java]
@@ -154,7 +154,7 @@
}
----
-[start=7]
+
. Add the following ``onOpen`` and ``onClose`` methods.
[source,java]
@@ -178,7 +178,7 @@
image::images/websocket-endpoint-hint.png[title="Code Hint in the Source Editor"]
-[start=8]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac). Save your changes.
You will see that import statements for classes in ``javax.websocket`` are added to the file.
@@ -213,7 +213,7 @@
This script will initiate the session handshake with the server when ``websocket.js`` is loaded by the browser.
-[start=5]
+
. Open ``index.html`` and add the following code (in *bold*) to the bottom of the file to load ``websocket.js`` when the page is finished loading.
[source,html]
@@ -246,7 +246,7 @@
<script type="text/javascript" src="websocket.js"></script>
----
-[start=2]
+
. Add the following declaration and methods to ``websocket.js`` . Save your changes.
[source,javascript]
@@ -269,7 +269,7 @@
When the page loads the JavaScript functions will print the message that the browser is connected to the endpoint. You can delete the functions after you confirm that the endpoint is performing correctly.
-[start=3]
+
. Right-click the project in the Projects window and choose Run.
When you run the application the IDE will start the GlassFish server and build and deploy the application. The index page will open in your browser and you will see the following message in the browser window.
@@ -312,7 +312,7 @@
</body>
----
-[start=3]
+
. Add the following code (in *bold*) for the canvas element.
[source,html]
@@ -325,7 +325,7 @@
</td>
----
-[start=4]
+
. Add the following ``<table>`` to add radio buttons to select the color and shape. Save your changes.
[source,html]
@@ -386,7 +386,7 @@
For more about ``javax.json.JsonObject`` , see the Java API for JSON Processing (link:http://jcp.org/en/jsr/detail?id=353[+JSR 353+]), which is part of the Java EE 7 Specification.
-[start=4]
+
. Create a getter and setter for ``json`` .
You can select getter and setter in the Insert Code popup menu (Alt-Ins on Windows; Ctrl-I on Mac) to open the Generate Getters and Setter dialog box. Alternatively, you can choose Source > Insert Code from the main menu.
@@ -394,7 +394,7 @@
image::images/websocket-generategetter.png[title="Generate Getter and Setter dialog box"]
-[start=5]
+
. Add a constructor for ``json`` .
[source,java]
@@ -410,7 +410,7 @@
image::images/websocket-generateconstructor.png[title="Generate Constructor popup menu"]
-[start=6]
+
. Add the following ``toString`` method:
[source,java]
@@ -424,7 +424,7 @@
}
----
-[start=7]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac). Save your changes.
@@ -484,7 +484,7 @@
When you click Finish the IDE creates the empty JavaScript file and opens the file in the editor. You can see the new file under the Web Pages node in the Projects window.
-[start=3]
+
. Add the following code to initialize the canvas and to add an event listener.
[source,javascript]
@@ -498,7 +498,7 @@
You can see that the ``defineImage`` method is invoked when the user clicks in the ``canvas`` element.
-[start=4]
+
. Add the following ``getCurrentPos`` , ``defineImage`` and ``drawImageText`` methods to construct the JSON structure and send it to the endpoint ( ``sendText(json)`` ).
[source,javascript]
@@ -578,7 +578,7 @@
You now need to add a ``sendText(json)`` method to send the JSON string using ``websocket.send()`` .
-[start=5]
+
. Open ``websocket.js`` in the editor and add the following methods for sending JSON to the endpoint and for drawing the image when a message is received from the endpoint.
[source,javascript]
@@ -600,7 +600,7 @@
NOTE: You can delete the code that you added to ``websocket.js`` for testing the endpoint.
-[start=6]
+
. Add the following line (in *bold*) to the bottom of ``index.html`` to load ``whiteboard.js`` .
[source,html]
@@ -634,13 +634,13 @@
}
----
-[start=4]
+
. Add an import statement for ``javax.websocket.Encoder`` and implement the abstract methods.
Place your cursor in the class declaration and type Alt-Enter and choose *Implement all abstract methods* from the popup menu.
-[start=5]
+
. Modify the generated abstract methods by making the following changes (in *bold*). Save your changes.
[source,java]
@@ -662,13 +662,13 @@
}
----
-[start=6]
+
. Right-click the project node and choose New > Java Class.
-[start=7]
+
. Type *FigureDecoder* as the Class Name and choose ``org.sample.whiteboardapp`` in the Package dropdown list. Click Finish.
-[start=8]
+
. In the source editor, implement the WebSocket Decoder interface by adding the following code (in *bold*):
[source,java]
@@ -680,10 +680,10 @@
}
----
-[start=9]
+
. Add an import statement for ``javax.websocket.Decoder`` and implement abstract methods.
-[start=10]
+
. Make the following changes (in *bold*) to the generated abstract methods.
[source,java]
@@ -718,7 +718,7 @@
}
----
-[start=11]
+
. Fix the imports and save your changes.
You now need to modify ``MyWhiteboard.java`` to specify the encoder and decoder.
@@ -740,10 +740,10 @@
----
-[start=3]
+
. Delete the ``onMessage`` method that was generated by default.
-[start=4]
+
. Add the following ``broadcastFigure`` method and annotate the method with ``@OnMessage`` .
[source,java]
@@ -760,10 +760,10 @@
}
----
-[start=5]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac). Save your changes.
-[start=6]
+
. Right-click the project in the Projects window and choose Run.
When you click Run the IDE opens a browser window to link:http://localhost:8080/WhiteboardApp/[+http://localhost:8080/WhiteboardApp/+].
@@ -793,7 +793,7 @@
websocket.binaryType = "arraybuffer";
----
-[start=2]
+
. Add the following method to send binary data to the endpoint.
[source,javascript]
@@ -805,7 +805,7 @@
}
----
-[start=3]
+
. Modify the ``onMessage`` method to add the following code (in *bold*) to select the method for updating the canvas according to the type of data in the incoming message.
[source,javascript]
@@ -824,7 +824,7 @@
The ``drawImageBinary`` method is invoked if a message with binary data is received.
-[start=4]
+
. Open ``whiteboard.js`` and add the following methods. The ``drawImageBinary`` method is invoked to update the canvas after parsing the incoming binary data. The ``defineImageBinary`` method is used to prepare a snapshot of the canvas as binary data.
[source,javascript]
@@ -861,7 +861,7 @@
You now need to add a way to invoke ``defineImageBinary`` when you want to generate the binary data as the type ``ArrayBuffer`` and send it to the endpoint.
-[start=5]
+
. Open ``index.html`` and modify the ``<table>`` element to add the following row to the table in the form.
[source,html]
@@ -880,7 +880,7 @@
The new row contains a Send Snapshot button to send a binary snapshot of the canvas to the connected peers. The ``defineImageBinary`` method in ``whiteboard.js`` is invoked when the button is clicked.
-[start=6]
+
. Open ``MyWhiteboard.java`` and add the following method that will send the binary data to peers when the endpoint receives a message with binary data.
[source,java]
@@ -916,7 +916,7 @@
The conditional code that you checks that if the element with the id ``checked``
-[start=2]
+
. Open ``index.html`` and modify the ``<table>`` element to add a checkbox to the form.
[source,html]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ja.asciidoc
index 631e721..d08d561 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ja.asciidoc
@@ -137,7 +137,7 @@
}
----
-[start=6]
+
. 次のフィールド(*太字*部分)をクラスに追加します。
[source,java]
@@ -154,7 +154,7 @@
}
----
-[start=7]
+
. 次の ``onOpen`` および ``onClose`` メソッドを追加します。
[source,java]
@@ -178,7 +178,7 @@
image::images/websocket-endpoint-hint.png[title="ソース・エディタのコード・ヒント"]
-[start=8]
+
. エディタで右クリックし、「インポートを修正」を選択します([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])。変更を保存します。
``javax.websocket`` のクラスのインポート文がファイルに追加されます。
@@ -213,7 +213,7 @@
このスクリプトは、ブラウザによって ``websocket.js`` がロードされる際、サーバーとセッション・ハンドシェイクを開始します。
-[start=5]
+
. ``index.html`` を開き、ページのロードの終了時に ``websocket.js`` をロードする次のコード(*太字*部分)をファイルの最後に追加します。
[source,html]
@@ -236,7 +236,7 @@
この課題では、ブラウザがエンドポイントに接続されたら、ブラウザ・ウィンドウに ``wsURI`` を出力するよう、簡単なメソッドをいくつかJavaScriptに追加します。
-[start=1]
+
. 次の ``<div>`` タグ(*太字*部分)を ``index.html`` に追加します。
[source,html]
@@ -248,7 +248,7 @@
<script type="text/javascript" src="websocket.js"></script>
----
-[start=2]
+
. 次の宣言とメソッドを ``websocket.js`` に追加します。変更を保存します。
[source,javascript]
@@ -271,7 +271,7 @@
ページがロードされると、JavaScript関数は、ブラウザがエンドポイントに接続されていることを示すメッセージを出力します。エンドポイントが正しく実行されていることを確認したら、関数を削除できます。
-[start=3]
+
. 「プロジェクト」ウィンドウでプロジェクトを右クリックし、「実行」を選択します。
アプリケーションを実行すると、IDEでGlassFishサーバーが起動され、アプリケーションがビルドおよびデプロイされます。ブラウザでindexページが開かれ、ブラウザ・ウィンドウに次のメッセージが表示されます。
@@ -314,7 +314,7 @@
</body>
----
-[start=3]
+
. canvas要素用に次のコード(*太字*部分)を追加します。
[source,html]
@@ -327,7 +327,7 @@
</td>
----
-[start=4]
+
. 次の ``<table>`` を追加して、色と形状を選択するラジオ・ボタンを追加します。変更を保存します。
[source,html]
@@ -388,7 +388,7 @@
``javax.json.JsonObject`` の詳細は、Java EE 7仕様の一部であるJava API for JSON Processing (link:http://jcp.org/en/jsr/detail?id=353[+JSR 353+])を参照してください。
-[start=4]
+
. ``json`` の取得および設定メソッドを作成します。
「コードを挿入」ポップアップ・メニュー(Windowsの場合は[Alt]-[Insert]、Macの場合は[Ctrl]-[I])で取得および設定メソッドを選択すると、「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックスが開きます。または、メイン・メニューから「ソース」>「コードを挿入」を選択します。
@@ -396,7 +396,7 @@
image::images/websocket-generategetter.png[title="「取得メソッドおよび設定メソッドの生成」ダイアログ・ボックス"]
-[start=5]
+
. ``json`` のコンストラクタを追加します。
[source,java]
@@ -412,7 +412,7 @@
image::images/websocket-generateconstructor.png[title="「コンストラクタの生成」ポップアップ・メニュー"]
-[start=6]
+
. 次の ``toString`` メソッドを追加します。
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=7]
+
. エディタで右クリックし、「インポートを修正」を選択します([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])。変更を保存します。
@@ -481,16 +481,16 @@
この課題では、 ``canvas`` 要素に描画される図形の詳細を、websocketエンドポイントに送信されるJSON構造にするJavaScriptファイルを作成します。
-[start=1]
+
. プロジェクト・ノードを右クリックし、「新規」>「JavaScriptファイル」を選択して新規JavaScriptファイル・ウィザードを開きます。
-[start=2]
+
. 「ファイル名」に*「whiteboard」*と入力します。「終了」をクリックします。
「終了」をクリックすると、IDEで空のJavaScriptファイルが作成され、エディタでこのファイルが開きます。「プロジェクト」ウィンドウの「Webページ」ノードの下に新規ファイルが表示されます。
-[start=3]
+
. キャンバスを初期化し、イベント・リスナーを追加する次のコードを追加します。
[source,javascript]
@@ -504,7 +504,7 @@
ユーザーが ``canvas`` 要素内をクリックすると、 ``defineImage`` メソッドが起動されることがわかります。
-[start=4]
+
. 次の ``getCurrentPos`` 、 ``defineImage`` および ``drawImageText`` メソッドを追加して、JSON構造を作成し、エンドポイントに送信します( ``sendText(json)`` )。
[source,javascript]
@@ -584,7 +584,7 @@
``websocket.send()`` を使用してJSON文字列を送信する ``sendText(json)`` メソッドを追加する必要があります。
-[start=5]
+
. エディタで ``websocket.js`` を開き、JSONをエンドポイントに送信するためのメソッドおよびエンドポイントからメッセージを受信したらイメージを描画するためのメソッドを追加します。
[source,javascript]
@@ -606,7 +606,7 @@
NOTE: エンドポイントのテスト用に ``websocket.js`` に追加したコードは削除できます。
-[start=6]
+
. ``whiteboard.js`` をロードする次の行(*太字*部分)を ``index.html`` の最後に追加します。
[source,html]
@@ -640,13 +640,13 @@
}
----
-[start=4]
+
. ``javax.websocket.Encoder`` のインポート文を追加し、抽象メソッドを実装します。
クラスの宣言にカーソルを置き、[Alt]-[Enter]を押して、ポップアップ・メニューから*「すべての抽象メソッドを実装」*を選択します。
-[start=5]
+
. 次の変更(*太字*部分)を加えて、生成された抽象メソッドを変更します。変更を保存します。
[source,java]
@@ -668,13 +668,13 @@
}
----
-[start=6]
+
. プロジェクト・ノードを右クリックし、「新規」>「Javaクラス」を選択します。
-[start=7]
+
. 「クラス名」に*「FigureDecoder」*と入力し、「パッケージ」ドロップダウン・リストで「 ``org.sample.whiteboardapp`` 」を選択します。「終了」をクリックします。
-[start=8]
+
. ソース・エディタで、次のコード(*太字*部分)を追加し、WebSocket Decoderインタフェースを実装します。
[source,java]
@@ -686,10 +686,10 @@
}
----
-[start=9]
+
. ``javax.websocket.Decoder`` のインポート文を追加し、抽象メソッドを実装します。
-[start=10]
+
. 生成された抽象メソッドに次の変更(*太字*部分)を加えます。
[source,java]
@@ -724,7 +724,7 @@
}
----
-[start=11]
+
. インポートを修正して変更内容を保存します。
次に、 ``MyWhiteboard.java`` を変更して、エンコーダとデコーダを指定する必要があります。
@@ -746,10 +746,10 @@
----
-[start=3]
+
. デフォルトで生成された ``onMessage`` メソッドを削除します。
-[start=4]
+
. 次の ``broadcastFigure`` メソッドを追加し、メソッドに ``@OnMessage`` の注釈を付けます。
[source,java]
@@ -766,10 +766,10 @@
}
----
-[start=5]
+
. エディタで右クリックし、「インポートを修正」を選択します([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])。変更を保存します。
-[start=6]
+
. 「プロジェクト」ウィンドウでプロジェクトを右クリックし、「実行」を選択します。
「実行」をクリックすると、IDEはブラウザ・ウィンドウでlink:http://localhost:8080/WhiteboardApp/[+http://localhost:8080/WhiteboardApp/+]を開きます。
@@ -799,7 +799,7 @@
websocket.binaryType = "arraybuffer";
----
-[start=2]
+
. バイナリ・データをエンドポイントに送信する次のメソッドを追加します。
[source,javascript]
@@ -811,7 +811,7 @@
}
----
-[start=3]
+
. ``onMessage`` メソッドを変更し、受信メッセージのデータ型に応じてキャンバスを更新するメソッドを選択する次のコード(*太字*部分)を追加します。
[source,javascript]
@@ -830,7 +830,7 @@
バイナリ・データのメッセージを受信すると、 ``drawImageBinary`` メソッドが起動されます。
-[start=4]
+
. ``whiteboard.js`` を開いて、次のメソッドを追加します。受信バイナリ・データの解析後、 ``drawImageBinary`` メソッドを起動してキャンバスを更新します。 ``defineImageBinary`` メソッドを使用して、バイナリ・データとしてキャンバスのスナップショットを準備します。
[source,javascript]
@@ -867,7 +867,7 @@
バイナリ・データを ``ArrayBuffer`` 型として生成し、エンドポイントに送信する場合に ``defineImageBinary`` を起動する方法を追加する必要があります。
-[start=5]
+
. ``index.html`` を開き、 ``<table>`` 要素を変更して、フォームの表に次の行を追加します。
[source,html]
@@ -886,7 +886,7 @@
新しい行には、接続されているピアにキャンバスのバイナリ・スナップショットを送信する「Send Snapshot」ボタンが含まれます。ボタンがクリックされると、 ``whiteboard.js`` の ``defineImageBinary`` メソッドが起動されます。
-[start=6]
+
. ``MyWhiteboard.java`` を開き、エンドポイントがバイナリ・データのメッセージを受信すると、ピアにバイナリ・データを送信する次のメソッドを追加します。
[source,java]
@@ -922,7 +922,7 @@
id ``checked`` の要素をチェックする条件コード
-[start=2]
+
. ``index.html`` を開き、 ``<table>`` 要素を変更してフォームにチェックボックスを追加します。
[source,html]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_pt_BR.asciidoc
index 3db14ea..31a3209 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_pt_BR.asciidoc
@@ -137,7 +137,7 @@
}
----
-[start=6]
+
. Adicione os campos a seguir (em *negrito*) à classe.
[source,java]
@@ -154,7 +154,7 @@
}
----
-[start=7]
+
. Adicione os seguintes métodos ``onOpen`` e ``onClose`` .
[source,java]
@@ -178,7 +178,7 @@
image::images/websocket-endpoint-hint.png[title="Dica do Código no Editor de Código-fonte"]
-[start=8]
+
. Clique com o botão direito do mouse no editor e selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac). Salve as alterações.
Você verá que as instruções de importação das classes no ``javax.websocket`` foram adicionadas ao arquivo.
@@ -213,7 +213,7 @@
Este script iniciará o handshake da sessão com o servidor quando ``websocket.js`` for carregado pelo browser.
-[start=5]
+
. Abra ``index.html`` e adicione o seguinte código (em *negrito*) na parte inferior do arquivo para carregar ``websocket.js`` quando a página terminar de carregar.
[source,html]
@@ -236,7 +236,7 @@
Neste exercício você adicionará alguns métodos simples ao arquivo JavaScript para imprimir o ``wsURI`` na janela do browser quando o browser for conectado ao ponto final.
-[start=1]
+
. Adicione a seguinte tag ``<div>`` (em *negrito*) para ``index.html``
[source,html]
@@ -248,7 +248,7 @@
<script type="text/javascript" src="websocket.js"></script>
----
-[start=2]
+
. Adicione a seguinte declaração e métodos ao ``websocket.js`` . Salve as alterações.
[source,javascript]
@@ -271,7 +271,7 @@
Quando a página carregar as funções de JavaScript imprimirá a mensagem que o browser está conectado ao ponto final. Você pode deletar as funções depois que confirmar se o ponto final está executando corretamente.
-[start=3]
+
. Clique com o botão direito do mouse na janela Projetos e selecione Executar.
Quando você executar a aplicação, o IDE iniciará o GlassFish server e construirá e implantará a aplicação. A página de índice será aberta no seu browser e você verá a seguinte mensagem na janela do browser.
@@ -314,7 +314,7 @@
</body>
----
-[start=3]
+
. Adicione o seguinte código (em *negrito*) ao elemento canvas.
[source,html]
@@ -327,7 +327,7 @@
</td>
----
-[start=4]
+
. Adicione a seguinte ``<table>`` para adicionar os botões de rádio para selecionar a cor e o formato. Salve as alterações.
[source,html]
@@ -388,7 +388,7 @@
Para obter mais informações sobre ``javax.json.JsonObject`` , consulte Java API para Processamento de JSON (link:http://jcp.org/en/jsr/detail?id=353[+JSR 353+]), que faz parte da Especificação Java EE 7.
-[start=4]
+
. Criar um getter e setter para ``json`` .
Você pode selecionar getter e setter no menu pop-up Inserir Código (Alt-Ins no Windows; Ctrl-I no Mac) para abrir a caixa de diálogo Gerar Getters e Setter. Se preferir, você pode escolher Origem > Inserir Código no menu principal.
@@ -396,7 +396,7 @@
image::images/websocket-generategetter.png[title="Caixa de diálogo Gerar Getter e Setter"]
-[start=5]
+
. Adicione um construtor para ``json`` .
[source,java]
@@ -412,7 +412,7 @@
image::images/websocket-generateconstructor.png[title="Menu pop-up Gerar Construtor"]
-[start=6]
+
. Adicione o método ``toString`` a seguir:
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=7]
+
. Clique com o botão direito do mouse no editor e selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac). Salve as alterações.
@@ -486,7 +486,7 @@
Quando você clica em Finalizar, o IDE cria o arquivo JavaScript vazio e o abre no editor. Você pode ver o novo arquivo no nó Páginas Web, na janela Projetos.
-[start=3]
+
. Adicione o seguinte código para iniciar a tela e adicionar um listener de evento.
[source,javascript]
@@ -500,7 +500,7 @@
Você pode ver que o método ``defineImage`` é chamado quando o usuário clica no elemento ``canvas`` .
-[start=4]
+
. Adicione os seguintes métodos ``getCurrentPos`` , ``defineImage`` e ``drawImageText`` para construir a estrutura JSON e enviá-la ao ponto final ( ``sendText(json)`` ).
[source,javascript]
@@ -580,7 +580,7 @@
Agora você precisa adicionar um método ``sendText(json)`` para enviar uma string JSON usando ``websocket.send()`` .
-[start=5]
+
. Abra ``websocket.js`` no editor e adicione os seguintes métodos para enviar JSON ao ponto final e para desenhar a imagem quando uma mensagem for recebida do ponto final.
[source,javascript]
@@ -602,7 +602,7 @@
NOTE: Você pode deletar o código adicionado ao ``websocket.js`` para testar o ponto final.
-[start=6]
+
. Adicione a seguinte linha (em *negrito*) na parte inferior de ``index.html`` para carregar o ``whiteboard.js`` .
[source,html]
@@ -636,13 +636,13 @@
}
----
-[start=4]
+
. Adicione uma instrução de importação para ``javax.websocket.Encoder`` e implemente os métodos abstratos.
Coloque o cursor na declaração de classe e digite Alt-Enter e selecione *Implementar todos os métodos abstratos* no menu pop-up.
-[start=5]
+
. Modifique os métodos abstratos gerados fazendo as seguintes alterações (em *negrito*). Salve as alterações.
[source,java]
@@ -664,13 +664,13 @@
}
----
-[start=6]
+
. Clique com o botão direito do mouse no nó do projeto e selecione Novo > Classe Java.
-[start=7]
+
. Digite *FigureEncoder* como o Nome da Classe e escolha ``org.sample.whiteboardapp`` na lista drop-down Pacote. Clique em Finalizar.
-[start=8]
+
. No editor de código-fonte, implemente a interface Decodificador do WebSocket adicionando o seguinte código (em *negrito*):
[source,java]
@@ -682,10 +682,10 @@
}
----
-[start=9]
+
. Adicione uma instrução de importação para ``javax.websocket.Decoder`` e implemente os métodos abstratos.
-[start=10]
+
. Faça as seguintes alterações (em *negrito*) para os métodos abstratos gerados.
[source,java]
@@ -720,7 +720,7 @@
}
----
-[start=11]
+
. Corrija as importações e salve as alterações.
Agora você precisa modificar ``MyWhiteboard.java`` para especificar o codificador e o decodificador.
@@ -742,10 +742,10 @@
----
-[start=3]
+
. Delete o método ``onMessage`` que foi gerado por default.
-[start=4]
+
. Adicione o seguinte método ``broadcastFigure`` e anote o método com ``@OnMessage`` .
[source,java]
@@ -762,10 +762,10 @@
}
----
-[start=5]
+
. Clique com o botão direito do mouse no editor e selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac). Salve as alterações.
-[start=6]
+
. Clique com o botão direito do mouse na janela Projetos e selecione Executar.
Quando você clicar em Executar, o IDE abre uma janela do browser para link:http://localhost:8080/WhiteboardApp/[+http://localhost:8080/WhiteboardApp/+].
@@ -795,7 +795,7 @@
websocket.binaryType = "arraybuffer";
----
-[start=2]
+
. Adicione o seguinte método para enviar dados binários para o ponto final.
[source,javascript]
@@ -807,7 +807,7 @@
}
----
-[start=3]
+
. Modifique o método ``onMessage`` para adicionar o seguinte código (em *negrito*) para selecionar o método para atualizar a tela, de acordo com o tipo de dados na mensagem de entrada.
[source,javascript]
@@ -826,7 +826,7 @@
O método ``drawImageBinary`` é chamado se uma mensagem com dados binários for recebida.
-[start=4]
+
. Abra ``whiteboard.js`` e adicione os seguintes métodos. O método ``drawImageBinary`` é chamado para atualizar a tela após fazer parse dos dados binários de entrada. O método ``defineImageBinary`` é usado para preparar um snapshot da tela como dados binários.
[source,javascript]
@@ -863,7 +863,7 @@
Agora você precisa adicionar uma forma de chamar ``defineImageBinary`` quando quiser gerar dados como o tipo ``ArrayBuffer`` e enviá-los ao ponto final.
-[start=5]
+
. Abra ``index.html`` e modifique o elemento ``<table>`` para adicionar a seguinte linha à tabela do form.
[source,html]
@@ -882,7 +882,7 @@
A nova linha contém um botão Enviar Snapshot para enviar um snapshot binário da tela para os colegas conectados. O método ``defineImageBinary`` em ``whiteboard.js`` será chamado quando o botão for clicado.
-[start=6]
+
. Abra ``MyWhiteboard.java`` e adicione o seguinte método que enviará os dados binários aos colegas quando o ponto final receber uma mensagem com dados binários.
[source,java]
@@ -918,7 +918,7 @@
O código condicional que você verifica se o elemento com o id for ``verificado``
-[start=2]
+
. Abra ``index.html`` e modifique o elemento ``<table>`` para adicionar uma caixa de seleção ao form.
[source,html]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ru.asciidoc
index 902ee6d..a3fbeb1 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_ru.asciidoc
@@ -137,7 +137,7 @@
}
----
-[start=6]
+
. Добавьте в класс следующее поле (выделено *полужирным шрифтом*).
[source,java]
@@ -154,7 +154,7 @@
}
----
-[start=7]
+
. Добавьте методы ``onOpen`` и ``onClose`` .
[source,java]
@@ -178,7 +178,7 @@
image::images/websocket-endpoint-hint.png[title="Подсказка к коду в редакторе исходного кода"]
-[start=8]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить операторы импорта' (Alt-Shift-I; ⌘-Shift-I для Mac). Сохраните изменения.
В результате в файл будут добавлены операторы импорта для классов в ``javax.websocket`` .
@@ -213,7 +213,7 @@
Этот сценарий инициализирует квитирование сеанса с сервером, когда браузер загружает файл ``websocket.js`` .
-[start=5]
+
. Откройте файл ``index.html`` и добавьте следующий код (выделен *полужирным шрифтом*) в самый нижний сегмент файла, чтобы по завершении загрузки страницы загружался файл ``websocket.js`` .
[source,html]
@@ -246,7 +246,7 @@
<script type="text/javascript" src="websocket.js"></script>
----
-[start=2]
+
. Добавьте следующее объявление и методы в файл ``websocket.js`` . Сохраните изменения.
[source,javascript]
@@ -269,7 +269,7 @@
При загрузке страницы функции JavaScript будут выводить сообщение о том, что браузер подключен к терминалу. Эти функции можно удалить после успешной проверки функционирования терминала.
-[start=3]
+
. Правой кнопкой мыши щелкните окно 'Проект' и выберите 'Выполнить'.
При запуске приложения среда IDE запускает сервер GlassFish и выполняет построение и развертывание приложения. В браузере открывается страница индекса со следующим сообщением.
@@ -312,7 +312,7 @@
</body>
----
-[start=3]
+
. Добавьте следующий код (выделен *полужирным шрифтом*) для элемента canvas.
[source,html]
@@ -325,7 +325,7 @@
</td>
----
-[start=4]
+
. Добавьте элемент ``<table>`` для создания переключателей, позволяющих выбирать цвет и форму. Сохраните изменения.
[source,html]
@@ -386,7 +386,7 @@
Дополнительные сведения о ``javax.json.JsonObject`` см. в описании интерфейса Java API for JSON Processing (link:http://jcp.org/en/jsr/detail?id=353[+JSR 353+]), который входит в спецификацию Java EE 7.
-[start=4]
+
. Создайте операторы получения и установки для ``json`` .
Методы получения и установки можно выбрать в раскрывающемся меню 'Вставить код' (Alt-Ins в Windows; Ctrl-I в Mac). В результате откроется диалоговое окно 'Создание методов получения и установки'. Также можно выбрать Исходный код > Вставить код в главном меню.
@@ -394,7 +394,7 @@
image::images/websocket-generategetter.png[title="Диалоговое окно 'Создание методов получения и установки'"]
-[start=5]
+
. Добавьте конструктор для ``json`` .
[source,java]
@@ -409,7 +409,7 @@
image::images/websocket-generateconstructor.png[title="Раскрывающееся меню 'Создать конструктор'"]
-[start=6]
+
. Добавьте метод ``toString`` :
[source,java]
@@ -423,7 +423,7 @@
}
----
-[start=7]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить операторы импорта' (Alt-Shift-I; ⌘-Shift-I для Mac). Сохраните изменения.
@@ -483,7 +483,7 @@
При нажатии кнопки 'Готово' среда IDE создает пустой файл JavaScript и открывает его в редакторе. Новый файл отображается в структуре узла 'Веб-страницы' в окне 'Проекты'.
-[start=3]
+
. Добавьте следующий код для инициализации элемента canvas и создания прослушивателя событий.
[source,javascript]
@@ -497,7 +497,7 @@
Когда пользователь нажимает на полотно (элемент ``canvas`` ), вызывается метод ``defineImage`` .
-[start=4]
+
. Добавьте методы ``getCurrentPos`` , ``defineImage`` и ``drawImageText`` для создания структуры JSON и ее отправки на терминал ( ``sendText(json)`` ).
[source,javascript]
@@ -577,7 +577,7 @@
Теперь необходимо добавить метод ``sendText(json)`` для отправки строковых данных JSON с помощью ``websocket.send()`` .
-[start=5]
+
. Откройте файл ``websocket.js`` в редакторе и добавьте следующие методы для отправки JSON на терминал и рисования изображения при получении сообщения от терминала.
[source,javascript]
@@ -599,7 +599,7 @@
NOTE: Код, добавленный в файл ``websocket.js`` для тестирования терминала, можно удалить.
-[start=6]
+
. Добавьте следующую строку (выделена *полужирным шрифтом*) в нижний сегмент файла ``index.html`` для загрузки файла ``whiteboard.js`` .
[source,html]
@@ -633,13 +633,13 @@
}
----
-[start=4]
+
. Добавьте оператор импорта для ``javax.websocket.Encoder`` и реализуйте абстрактные методы.
Поместите указатель мыши на объявление класса, нажмите Alt-Enter и выберите *Реализовать все абстрактные методы* в раскрывающемся меню.
-[start=5]
+
. Внесите следующие изменения в созданные абстрактные методы (выделены *полужирным шрифтом*). Сохраните изменения.
[source,java]
@@ -661,13 +661,13 @@
}
----
-[start=6]
+
. Щелкните узел проекта правой кнопкой мыши и выберите Создать > Класс Java.
-[start=7]
+
. В поле 'Имя класса' введите *FigureDecoder* и выберите ``org.sample.whiteboardapp`` в списке 'Пакет'. Нажмите 'Готово'.
-[start=8]
+
. В редакторе исходного кода реализуйте интерфейс декодера WebSocket. Для этого добавьте следующий код (выделен *полужирным шрифтом*):
[source,java]
@@ -679,10 +679,10 @@
}
----
-[start=9]
+
. Добавьте оператор импорта для ``javax.websocket.Decoder`` и реализуйте абстрактные методы.
-[start=10]
+
. Внесите следующие изменения (выделены *полужирным шрифтом*) в созданные абстрактные методы.
[source,java]
@@ -717,7 +717,7 @@
}
----
-[start=11]
+
. Исправьте операторы импорта и сохраните изменения.
Теперь необходимо внести изменения в файл ``MyWhiteboard.java`` и указать кодер и декодер.
@@ -739,10 +739,10 @@
----
-[start=3]
+
. Удалите метод ``onMessage`` , созданный по умолчанию.
-[start=4]
+
. Добавьте метод ``broadcastFigure`` и создайте для него аннотацию ``@OnMessage`` .
[source,java]
@@ -759,10 +759,10 @@
}
----
-[start=5]
+
. Щелкните правой кнопкой мыши в редакторе и выберите 'Исправить операторы импорта' (Alt-Shift-I; ⌘-Shift-I для Mac). Сохраните изменения.
-[start=6]
+
. В окне 'Проекты' щелкните проект правой кнопкой мыши и выберите 'Выполнить'.
При нажатии кнопки 'Выполнить' среда IDE открывает окно браузера с адресом link:http://localhost:8080/WhiteboardApp/[+http://localhost:8080/WhiteboardApp/+].
@@ -792,7 +792,7 @@
websocket.binaryType = "arraybuffer";
----
-[start=2]
+
. Добавьте следующий метод для отправки двоичных данных на терминал.
[source,javascript]
@@ -804,7 +804,7 @@
}
----
-[start=3]
+
. Измените метод ``onMessage`` и добавьте в него следующий код (выделен *полужирным шрифтом*), чтобы выбрать метод обновления полотна в соответствии с типом данных, переданных во входящем сообщении.
[source,javascript]
@@ -823,7 +823,7 @@
Метод ``drawImageBinary`` вызывается при получении сообщения с двоичными данными.
-[start=4]
+
. Откройте файл ``whiteboard.js`` и добавьте следующие методы. Метод ``drawImageBinary`` вызывается для обновления полотна после анализа входных двоичных данных. Метод ``defineImageBinary`` используется для подготовки снимка полотна в двоичном формате.
[source,javascript]
@@ -860,7 +860,7 @@
Теперь необходимо реализовать вызов метода ``defineImageBinary`` , когда требуется сгенерировать двоичные данные с типом ``ArrayBuffer`` и отправить их на терминал.
-[start=5]
+
. Откройте файл ``index.html`` и измените элемент ``<table>`` так, чтобы в таблице формы появилась следующая строка.
[source,html]
@@ -879,7 +879,7 @@
Новая строка содержит кнопку 'Отправить снимок', которая позволяет отправить двоичный снимок полотна на подключенные одноранговые узлы. При нажатии этой кнопки вызывается метод ``defineImageBinary`` в файле ``whiteboard.js`` .
-[start=6]
+
. Откройте файл ``MyWhiteboard.java`` и добавьте следующий метод. Этот метод используется для отправки двоичных данных на одноранговые узлы, когда на терминал поступает сообщение с двоичными данными.
[source,java]
@@ -915,7 +915,7 @@
Этот код условия проверяет, ``установлен ли флажок`` для элемента с этим идентификатором
-[start=2]
+
. Откройте файл ``index.html`` и измените элемент ``<table>`` , добавив в форму флажок.
[source,html]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_zh_CN.asciidoc
index a7edda8..c3161c8 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/maven-websocketapi_zh_CN.asciidoc
@@ -139,7 +139,7 @@
}
----
-[start=6]
+
. 将以下字段(*粗体*)添加到类中。
[source,java]
@@ -156,7 +156,7 @@
}
----
-[start=7]
+
. 添加以下 ``onOpen`` 和 ``onClose`` 方法。
[source,java]
@@ -180,7 +180,7 @@
image::images/websocket-endpoint-hint.png[title="源代码编辑器中的代码提示"]
-[start=8]
+
. 在编辑器中右键单击,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)。保存所做的更改。
您将看到 ``javax.websocket`` 中类的 import 语句会添加到文件中。
@@ -215,7 +215,7 @@
当浏览器加载 ``websocket.js`` 时,此脚本将启动与服务器的会话握手。
-[start=5]
+
. 打开 ``index.html`` ,然后将以下代码(*粗体*)添加到文件底部,以便在页面完成加载时加载 ``websocket.js`` 。
[source,html]
@@ -248,7 +248,7 @@
<script type="text/javascript" src="websocket.js"></script>
----
-[start=2]
+
. 将以下声明和方法添加到 ``websocket.js`` 。保存所做的更改。
[source,javascript]
@@ -271,7 +271,7 @@
当页面加载 JavaScript 时,这些函数将输出浏览器已连接到端点的消息。在确认端点正确执行之后,可以删除这些函数。
-[start=3]
+
. 在 "Projects"(项目)窗口中右键单击项目,然后选择 "Run"(运行)。
运行应用程序时,IDE 将启动 GlassFish Server,然后构建并部署应用程序。索引页将在浏览器中打开,并且您将会在浏览器窗口中看到以下消息。
@@ -314,7 +314,7 @@
</body>
----
-[start=3]
+
. 为 canvas 元素添加以下代码(*粗体*)。
[source,html]
@@ -327,7 +327,7 @@
</td>
----
-[start=4]
+
. 添加以下 ``<table>`` 以添加单选按钮用于选择颜色和形状。保存所做的更改。
[source,html]
@@ -388,7 +388,7 @@
有关 ``javax.json.JsonObject`` 的更多信息,请参见属于 Java EE 7 规范一部分的用于 JSON 处理的 Java API (link:http://jcp.org/en/jsr/detail?id=353[+JSR 353+])。
-[start=4]
+
. 为 ``json`` 创建 getter 和 setter。
可以在 "Insert Code"(插入代码)弹出菜单中选择 getter 和 setter(在 Windows 上为 Alt-Ins;在 Mac 上为 Ctrl-I),以便打开 "Generate Getters and Setter"(生成 getter 和 setter)对话框。或者,也可以从主菜单中选择 "Source"(源)> "Insert Code"(插入代码)。
@@ -396,7 +396,7 @@
image::images/websocket-generategetter.png[title=""Generate Getter and Setter"(生成 getter 和 setter)对话框"]
-[start=5]
+
. 为 ``json`` 添加构造函数。
[source,java]
@@ -412,7 +412,7 @@
image::images/websocket-generateconstructor.png[title=""Generate Constructor"(生成构造函数)弹出菜单"]
-[start=6]
+
. 添加以下 ``toString`` 方法:
[source,java]
@@ -426,7 +426,7 @@
}
----
-[start=7]
+
. 在编辑器中右键单击,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)。保存所做的更改。
@@ -486,7 +486,7 @@
单击 "Finish"(完成)后,IDE 将创建空 JavaScript 文件并在编辑器中打开该文件。您可以在 "Projects"(项目)窗口中的 "Web Pages"(Web 页)节点下看到该新文件。
-[start=3]
+
. 添加以下代码以初始化画布并添加事件监听程序。
[source,javascript]
@@ -500,7 +500,7 @@
您可以看到当用户在 ``canvas`` 元素中单击时调用了 ``defineImage`` 方法。
-[start=4]
+
. 添加下面的 ``getCurrentPos`` 、 ``defineImage`` 和 ``drawImageText`` 方法以构造 JSON 结构并将其发送到端点 ( ``sendText(json)`` )。
[source,javascript]
@@ -580,7 +580,7 @@
现在,您需要添加 ``sendText(json)`` 方法以使用 ``websocket.send()`` 发送 JSON 字符串。
-[start=5]
+
. 在编辑器中打开 ``websocket.js`` ,然后添加以下方法,用于将 JSON 发送到端点,以及在从端点收到消息时绘制图像。
[source,javascript]
@@ -602,7 +602,7 @@
NOTE: 可以删除已添加到 ``websocket.js`` 中的代码以测试端点。
-[start=6]
+
. 将以下行(*粗体*)添加到 ``index.html`` 的底部以加载 ``whiteboard.js`` 。
[source,html]
@@ -636,13 +636,13 @@
}
----
-[start=4]
+
. 为 ``javax.websocket.Encoder`` 添加 import 语句并实现抽象方法。
将光标放在类声明中,按下 Alt-Enter 组合键,然后从弹出菜单中选择 *Implement all abstract methods*(实现所有抽象方法)。
-[start=5]
+
. 通过进行以下更改(*粗体*)修改生成的抽象方法。保存所做的更改。
[source,java]
@@ -664,13 +664,13 @@
}
----
-[start=6]
+
. 右键单击项目节点,然后选择 "New"(新建)> "Java Class"(Java 类)。
-[start=7]
+
. 键入 *FigureDecoder* 作为类名,并在 "Package"(包)下拉列表中选择 ``org.sample.whiteboardapp`` 。单击 "Finish"(完成)。
-[start=8]
+
. 在源代码编辑器中,通过添加以下代码(*粗体*)来实现 WebSocket 解码器接口:
[source,java]
@@ -682,10 +682,10 @@
}
----
-[start=9]
+
. 为 ``javax.websocket.Decoder`` 添加 import 语句并实现抽象方法。
-[start=10]
+
. 对生成的抽象方法进行以下更改(*粗体*)。
[source,java]
@@ -720,7 +720,7 @@
}
----
-[start=11]
+
. 修复导入并保存更改。
现在,您需要修改 ``MyWhiteboard.java`` 以指定编码器和解码器。
@@ -742,10 +742,10 @@
----
-[start=3]
+
. 删除默认情况下生成的 ``onMessage`` 方法。
-[start=4]
+
. 添加以下 ``broadcastFigure`` 方法并使用 ``@OnMessage`` 标注该方法。
[source,java]
@@ -762,10 +762,10 @@
}
----
-[start=5]
+
. 在编辑器中右键单击,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)。保存所做的更改。
-[start=6]
+
. 在 "Projects"(项目)窗口中右键单击项目,然后选择 "Run"(运行)。
当您单击 "Run"(运行)时,IDE 会将浏览器窗口打开到 link:http://localhost:8080/WhiteboardApp/[+http://localhost:8080/WhiteboardApp/+]。
@@ -795,7 +795,7 @@
websocket.binaryType = "arraybuffer";
----
-[start=2]
+
. 添加以下方法以将二进制数据发送到端点。
[source,javascript]
@@ -807,7 +807,7 @@
}
----
-[start=3]
+
. 修改 ``onMessage`` 方法以添加以下代码(*粗体*),从而选择该方法用于根据传入消息中的数据类型更新画布。
[source,javascript]
@@ -826,7 +826,7 @@
如果收到包含二进制数据的消息,则会调用 ``drawImageBinary`` 方法。
-[start=4]
+
. 打开 ``whiteboard.js`` 并添加以下方法。在解析传入的二进制数据之后,会调用 ``drawImageBinary`` 方法以更新画布。 ``defineImageBinary`` 方法用于将画布快照准备为二进制数据。
[source,javascript]
@@ -863,7 +863,7 @@
现在,当您想要以 ``ArrayBuffer`` 类型生成二进制数据并将其发送到端点时,需要添加一种方法来调用 ``defineImageBinary`` 。
-[start=5]
+
. 打开 ``index.html`` ,然后修改 ``<table>`` 元素以将以下行添加到窗体中的表中。
[source,html]
@@ -882,7 +882,7 @@
新行包含 "Send Snapshot"(发送快照)按钮,用于将画布的二进制快照发送到已连接的对等方。单击此按钮时,将调用 ``whiteboard.js`` 中的 ``defineImageBinary`` 方法。
-[start=6]
+
. 打开 ``MyWhiteboard.java`` ,然后添加以下方法,用于在端点收到包含二进制数据的消息时将二进制数据发送到对等方。
[source,java]
@@ -904,7 +904,7 @@
可以修改应用程序以使用户能够停止向端点发送数据。默认情况下,只要对等方打开了页面就会立即连接所有这些对等方,并将数据从浏览器发送到连接的所有对等方。可以添加简单条件,以便只有在选择了此选项时才会将数据发送到端点。这并不影响接收数据。仍会从端点接收数据。
-[start=1]
+
. 修改 ``whiteboard.js`` 中的 ``defineImage`` 方法以添加以下代码(*粗体*)。
[source,javascript]
@@ -920,7 +920,7 @@
检查元素的 ID 是否为 ``checked`` 的条件代码
-[start=2]
+
. 打开 ``index.html`` ,然后修改 ``<table>`` 元素以向窗体中添加复选框。
[source,html]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee.asciidoc
index 968e2de..b1b4738 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee.asciidoc
@@ -132,16 +132,16 @@
When you set the project as the Main Project the name of the project will be in bold in the Projects window.
-[start=2]
+
. Choose Profile > Profile Main Project from the main menu.
NOTE: Select JDK 1.7 or JDK 1.8 if you are prompted to select a Java platform for profiling.
-[start=3]
+
. Select Monitor in the Select Profiling Task dialog box.
-[start=4]
+
. Click Run.
NOTE: If you have not used the profiler before you might be prompted to calibrate the profiler before you can click Run. For more on calibrating the profiler, see the section on link:../java/profiler-intro.html#calibrate[+Using the Profiler for the First Time+] in the link:../java/profiler-intro.html[+Introduction to Profiling Java Applications in NetBeans IDE+].
@@ -199,7 +199,7 @@
You can see on the scale in the dialog that the overhead will be relatively low.
-[start=6]
+
. Click the Live Profiling Results button in the Profiler window to open the Live Profiling Results tab.
image::images/sample-task-results.png[title="Results of Sample Application mode"]
@@ -224,7 +224,7 @@
You can see on the scale in the dialog that the overhead will be higher than in the Quick profile mode.
-[start=6]
+
. Click the Live Profiling Results button in the Profiler window to open the Live Profiling Results tab.
You can see that the Live Profiling Results tab shows the execution time for the ``init`` and ``service`` methods for the servlet in the ``Servlet2Stateless`` class and that each method was invoked one time. The ``init`` method in the ``StatelessSessionBean`` class was also invoked.
@@ -236,7 +236,7 @@
To improve the readability of the collected data, you can use the Results filter in the Hot Spots view in the Live Profiling Results window to filter the displayed results. The Results filter only filters the display of results and does not affect the classes that are instrumented. When you use the Results filter, you filter the results which start, contain or end with a defined pattern. You can also use more complex regular expressions for filtering. Data is filtered based on package/class/method names exactly as they appear in the first results table column. You can specify more than one pattern, separating the patterns by a space or comma with space.
-[start=7]
+
. In the web browser, type your name in the field and click Submit Query.
image::images/cpu-pane1-results1.png[title="Results of Profile Application mode"]
@@ -275,10 +275,10 @@
To profile part of an application you need to first specify the root methods. By selecting the profiling root, you limit the profiling to the methods called by the thread entering the profiling root.
-[start=6]
+
. In the Edit Profiling Roots dialog box, select Web Application View in the Select View drop-down list.
-[start=7]
+
. Expand the ServletStateless node and select the ``service`` method in the Servlets package. Click OK.
image::images/edit-profiling-roots.png[title="Web Application View in Edit Profiling Roots dialog"]
@@ -294,13 +294,13 @@
image::images/edit-profilingroots-pkg-adv.png[title="Edit Profiling Roots (Advanced) dialog"]
-[start=8]
+
. Click OK in the Edit Profiling Roots dialog box.
In the Select Profiling Task dialog box you can see that the Advanced profiling mode will be run using custom profiling roots. You can click *edit* to view and modify the selected root methods. Notice that the profiling overhead is now less than when no root methods were specified.
-[start=9]
+
. Select *Profile only project classes* from the Filter drop-down list. Click Run.
image::images/advanced-cpu-task-custom.png[title="Profile Application mode selected with a custom profiling root"]
@@ -316,7 +316,7 @@
Though the application has entered other methods since entering the profiling root, these other methods are not displayed because the instrumentation filter limits the instrumentation to classes that are part of the project.
-[start=10]
+
. In the web browser, type your name in the field and click Submit Query.
image::images/cpu-pane2-results1.png[title="Results of instrumenting methods using a profiling root after invoking sayHello method"]
@@ -326,10 +326,10 @@
The results display the performance of the application, but may not accurately represent the performance of an application that has been running for some time. One way to emulate the performance of a web application under more realistic conditions is to run a load generator script.
-[start=11]
+
. Repeat the previous step a few times in the browser and then click Reset Results in the Live Profiling Results tab to clear the results.
-[start=12]
+
. After the profiling results are reset, type your name and click Submit Query one more time.
image::images/cpu-pane2-results2.png[title="Results of instrumenting methods using a profiling root after invoking sayHello method"]
@@ -382,22 +382,22 @@
1. Stop the previous profiling session (if still running) by clicking the Stop button in the Profiler window.
When you click Stop, the IDE detaches from the application.
-[start=2]
+
. Choose Profile > Profile Main Project from the main menu.
-[start=3]
+
. Select *Memory* in the Select Profiling Task dialog box.
-[start=4]
+
. Select *Advanced*.
-[start=5]
+
. Select *Record full object lifecycle* to obtain data about surviving generations.
NOTE: If you select this option you will notice that the Overhead meter will increase substantially. When profiling an enterprise application, it is quite possible that you will need to increase the memory for the IDE because of the amount of collected data.
-[start=6]
+
. Deselect *Use defined Profiling Points* (if selected). Click Run.
image::images/profile-memory-advanced.png[title="Select Profiling Task dialog showing Memory task and options"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ja.asciidoc
index 906bb32..ddffdc7 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ja.asciidoc
@@ -131,16 +131,16 @@
プロジェクトをメイン・プロジェクトとして設定すると、「プロジェクト」ウィンドウでは、そのプロジェクト名が太字で表示されます。
-[start=2]
+
. メイン・メニューから「プロファイル」>「メイン・プロジェクトのプロファイル」を選択します。
NOTE: プロファイリング用のJavaプラットフォームを選択するプロンプトが表示された場合は、JDK 1.7またはJDK 1.8を選択します。
-[start=3]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで「モニター」を選択します。
-[start=4]
+
. 「実行」をクリックします。
NOTE: プロファイラを以前に使用したことがない場合は、「実行」をクリックできるようになる前に、プロファイラを調整するためのプロンプトが表示される場合があります。プロファイラの調整の詳細は、link:../java/profiler-intro.html[+NetBeans IDEでのJavaアプリケーションのプロファイリングの概要+]のlink:../java/profiler-intro.html#calibrate[+初めてのプロファイラの使用+]の項を参照してください。
@@ -198,7 +198,7 @@
ダイアログ内の目盛りを見ると、オーバーヘッドが比較的小さいことがわかります。
-[start=6]
+
. 「プロファイラ」ウィンドウの「プロファイリングのライブ結果」ボタンをクリックして、「プロファイリングのライブ結果」タブを開きます。
image::images/sample-task-results.png[title="「サンプル・アプリケーション」モードの結果"]
@@ -223,7 +223,7 @@
ダイアログ内の目盛りを見ると、オーバーヘッドが「簡易(サンプリング)」プロファイル・モードより大きいことがわかります。
-[start=6]
+
. 「プロファイラ」ウィンドウの「プロファイリングのライブ結果」ボタンをクリックして、「プロファイリングのライブ結果」タブを開きます。
「プロファイリングのライブ結果」タブに ``Servlet2Stateless`` クラス内のサーブレットの ``init`` および ``service`` メソッドの実行時間が表示され、各メソッドが1回ずつ呼び出されたことを確認できます。 ``StatelessSessionBean`` クラス内の ``init`` メソッドも呼び出されました。
@@ -235,7 +235,7 @@
収集されるデータの読みやすさを向上させるため、「プロファイリングのライブ結果」ウィンドウのホット・スポット・ビューで結果フィルタを使用して、表示される結果をフィルタできます。結果フィルタは、結果の表示をフィルタするのみであり、インストゥルメントされるクラスには影響しません。結果フィルタを使用すると、定義されたパターン「で始まる」、「を含む」または「で終わる」結果がフィルタされます。より複雑な正規表現をフィルタリングに使用することもできます。データは、最初の結果表の列に表示されたとおりのパッケージ/クラス/メソッド名に基づいてフィルタされます。複数のパターンをスペースまたはカンマとスペースで区切って指定できます。
-[start=7]
+
. Webブラウザで、フィールドに自分の名前を入力して「問合せを送信」をクリックします。
image::images/cpu-pane1-results1.png[title="「アプリケーションをプロファイル」モードの結果"]
@@ -274,10 +274,10 @@
アプリケーションの一部をプロファイルするには、最初にルート・メソッドを指定する必要があります。プロファイリング・ルートを選択することで、プロファイリングをプロファイリング・ルートに入っているスレッドによってコールされたメソッドに制限します。
-[start=6]
+
. 「プロファイリング・ルートの編集」ダイアログ・ボックスの「ビューを選択」ドロップダウン・リストで、「Webアプリケーション・ビュー」を選択します。
-[start=7]
+
. ServletStatelessノードを展開して、「サーブレット」パッケージ内の ``service`` メソッドを選択します。「OK」をクリックします。
image::images/edit-profiling-roots.png[title="「プロファイリング・ルートの編集」ダイアログの「Webアプリケーション・ビュー」"]
@@ -292,13 +292,13 @@
image::images/edit-profilingroots-pkg-adv.png[title="「プロファイリング・ルートの編集(詳細)」ダイアログ"]
-[start=8]
+
. 「プロファイリング・ルートの編集」ダイアログ・ボックスで「OK」をクリックします。
「プロファイリング・タスクの選択」ダイアログ・ボックスで、詳細プロファイリング・モードがカスタム・プロファイリング・ルートを使用して実行されることを確認できます。「*編集*」をクリックすると、選択したルート・メソッドを表示および変更できます。これで、ルート・メソッドを指定しなかった場合に比べてプロファイリングのオーバーヘッドが小さくなりました。
-[start=9]
+
. 「フィルタ」ドロップダウン・リストから「*プロジェクト・クラスだけをプロファイル*」を選択します。「実行」をクリックします。
image::images/advanced-cpu-task-custom.png[title="カスタム・プロファイリング・ルート付きで選択された「アプリケーションをプロファイル」モード"]
@@ -314,7 +314,7 @@
アプリケーションはプロファイリング・ルートに入った後で他のメソッドに入っていますが、インストゥルメント・フィルタによってインストゥルメントがプロジェクトの一部のクラスに制限されているため、これらの他のメソッドは表示されません。
-[start=10]
+
. Webブラウザで、フィールドに自分の名前を入力して「問合せを送信」をクリックします。
image::images/cpu-pane2-results1.png[title="sayHelloメソッドの呼出し後にプロファイリング・ルートを使用してメソッドをインストゥルメントした結果"]
@@ -324,10 +324,10 @@
結果には、アプリケーションのパフォーマンスが表示されますが、長期間実行されているアプリケーションのパフォーマンスが正確に表されていない可能性があります。より現実的な条件下でWebアプリケーションのパフォーマンスをエミュレートする1つの方法は、負荷ジェネレータ・スクリプトを実行することです。
-[start=11]
+
. ブラウザで前のステップを数回繰り返してから、「プロファイリングのライブ結果」タブの「結果のリセット」をクリックして結果をクリアします。
-[start=12]
+
. プロファイリング結果がリセットされたら、もう一度自分の名前を入力して「問合せを送信」をクリックします。
image::images/cpu-pane2-results2.png[title="sayHelloメソッドの呼出し後にプロファイリング・ルートを使用してメソッドをインストゥルメントした結果"]
@@ -380,22 +380,22 @@
1. 「プロファイラ」ウィンドウの「停止」ボタンをクリックして、以前のプロファイリング・セッションを停止します(まだ実行されている場合)。
「停止」をクリックすると、IDEがアプリケーションからデタッチされます。
-[start=2]
+
. メイン・メニューから「プロファイル」>「メイン・プロジェクトのプロファイル」を選択します。
-[start=3]
+
. 「プロファイリング・タスクの選択」ダイアログ・ボックスで「*メモリー*」を選択します。
-[start=4]
+
. *「詳細」*を選択します。
-[start=5]
+
. *「完全なオブジェクト・ライフサイクルを記録」*を選択して、存続している世代に関するデータを取得します。
NOTE: このオプションを選択すると、「オーバーヘッド」メーターが大幅に増加します。エンタープライズ・アプリケーションをプロファイリングするときは、収集されるデータ量のため、ほとんどの場合、IDE用のメモリーを増やす必要がありあります。
-[start=6]
+
. 「*定義済みプロファイリング・ポイントを使用*」を選択解除します(選択されている場合)。「実行」をクリックします。
image::images/profile-memory-advanced.png[title="「メモリー」タスクとオプションが表示された「プロファイリング・タスクの選択」ダイアログ"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_pt_BR.asciidoc
index 1331756..8ca906f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_pt_BR.asciidoc
@@ -131,16 +131,16 @@
Quando você definir o projeto como Projeto Principal, o nome do projeto estará em negrito na janela Projetos.
-[start=2]
+
. Escolha Perfil > Perfil do Projeto Principal no menu principal.
NOTE: Selecione o JDK 1.7 ou JDK 1.8 caso seja solicitado a selecionar uma plataforma Java para determinação de perfil.
-[start=3]
+
. Selecione Monitorar na caixa de diálogo Selecionar Tarefa de Criação de Perfil.
-[start=4]
+
. Clique em Executar.
NOTE: Caso não tenha usado o determinador de perfil antes, você pode ser solicitado a calibrá-lo antes que possa clicar em Executar. Para obter mais informações sobre a calibração do determinador de perfil, consulte a seção link:../java/profiler-intro.html#calibrate[+Usando o Determinador de Perfil pela Primeira Vez+] na link:../java/profiler-intro.html[+Introdução à Determinação de Perfil de Aplicações Java no NetBeans IDE+].
@@ -198,7 +198,7 @@
Observe na escala da caixa de diálogo que a sobrecarga estará relativamente baixa.
-[start=6]
+
. Clique no botão Resultados da Determinação Ao Vivo de Perfil na janela Determinador de Perfil para abrir a guia Resultados da Determinação Ao Vivo de Perfil.
image::images/sample-task-results.png[title="Modo dos Resultados Amostragem da Aplicação"]
@@ -223,7 +223,7 @@
Observe na escala na caixa de diálogo que a sobrecarga estará maior que no modo Rápido da aplicação.
-[start=6]
+
. Clique no botão Resultados da Determinação Ao Vivo de Perfil na janela Determinador de Perfil para abrir a guia Resultados da Determinação Ao Vivo de Perfil.
É possível ver que a guia Resultados da Determinação Ao Vivo de Perfil exibe o runtime dos métodos ``init`` e ``serviço`` para o servlet na classe ``Servlet2Stateless`` e que cada método foi chamado uma única vez. O método ``init`` na classe ``StatelessSessionBean`` também foi chamado.
@@ -235,7 +235,7 @@
Para melhorar a legibilidade dos dados coletados, é possível usar o filtro Resultados, na exibição de Hot Spots da janela Resultados da Determinação Ao Vivo de Perfil, para filtrar os resultados exibidos. O filtro Resultados filtra apenas a exibição dos resultados e não afeta as classes que são instrumentadas. Quando você usa o filtro Resultados, os resultados que iniciam com, contêm ou terminam com um padrão definido são filtrados. Também é possível usar expressões regulares mais complexas para filtragem. Os dados são filtrados com base nos nomes de pacote/classe/método exatamente como eles aparecem na primeira coluna da tabela de resultados. Mais de um padrão pode ser especificado, separando os padrões por um espaço ou uma vírgula com espaço.
-[start=7]
+
. No browser, digite seu nome no campo e clique em Enviar Consulta.
image::images/cpu-pane1-results1.png[title="Modo dos Resultados de Determinação de Perfil da Aplicação"]
@@ -274,10 +274,10 @@
Para determinar o perfil de parte de uma aplicação, é necessário primeiro especificar os métodos raiz. Ao selecionar a raiz da determinação de perfil, você limita a determinação de perfis aos métodos chamados pelo thread inserindo a raiz de determinação de perfil.
-[start=6]
+
. Na caixa de diálogo Editar Raízes da Determinação de Perfil, selecione Exibir Aplicação Web na lista drop-down Selecionar Exibição.
-[start=7]
+
. Expanda o nó do ServletStateless e selecione o método ``serviço`` no pacote Servlets. Clique em OK.
image::images/edit-profiling-roots.png[title="Exibir Aplicação Web na caixa de diálogo Editar Raízes de Determinação de Perfil"]
@@ -293,13 +293,13 @@
image::images/edit-profilingroots-pkg-adv.png[title="Caixa de diálogo Editar Raízes de Determinação de Perfil (Avançado)"]
-[start=8]
+
. Clique em OK na caixa de diálogo Editar Raízes de Determinação de Perfil.
Na caixa de diálogo Selecionar Tarefa de Determinação de Perfil, você pode ver que o modo Avançado de determinação de perfil será executado usando raízes personalizadas de determinação de perfil. É possível clicar em *editar* para visualizar e modificar o método raiz selecionado. Observe que a sobrecarga da determinação de perfil agora é menor do que quando nenhum método raiz foi especificado.
-[start=9]
+
. Selecione *Determinar Perfil somente das classes do projeto* na lista drop-down do Filtro. Clique em Executar.
image::images/advanced-cpu-task-custom.png[title="Modo de Perfil da Aplicação selecionado com uma raiz de determinação de perfil personalizada"]
@@ -315,7 +315,7 @@
Embora a aplicação tenha inserido outros métodos após inserir a raiz de determinação de perfil, esses outros métodos não são exibidos, pois o filtro de instrumentação limita a instrumentação para classes que são parte do projeto.
-[start=10]
+
. No browser, digite seu nome no campo e clique em Enviar Consulta.
image::images/cpu-pane2-results1.png[title="Resultados de métodos de instrumentação utilizando uma raiz de determinação de perfil após chamar o método sayHello"]
@@ -325,10 +325,10 @@
Os resultados exibem o desempenho da aplicação, mas podem não representar precisamente o desempenho de uma aplicação que vem sendo executada há algum tempo. Uma maneira de emular o desempenho de uma aplicação Web em condições mais realistas é executar um script gerador de carga.
-[start=11]
+
. Repita a etapa anterior algumas vezes no browser e clique em Redefinir Resultados na guia Resultados da Determinação Ao Vivo de Perfil para limpar os resultados.
-[start=12]
+
. Depois que os resultados de determinação de perfil forem redefinidos, digite seu nome e clique em Enviar Consulta mais uma vez.
image::images/cpu-pane2-results2.png[title="Resultados de métodos de instrumentação utilizando uma raiz de determinação de perfil após chamar o método sayHello"]
@@ -381,22 +381,22 @@
1. Pare a sessão anterior de determinação de perfil (se ainda estiver em execução) clicando no botão Parar na janela Determinação de Perfil.
Quando você clica em Parar, o IDE se desconecta da aplicação.
-[start=2]
+
. Escolha Perfil > Perfil do Projeto Principal no menu principal.
-[start=3]
+
. Selecione *Memória* na caixa de diálogo Selecionar Tarefa de Determinação de Perfil.
-[start=4]
+
. Selecione *Avançado*.
-[start=5]
+
. Selecione *Registrar ciclo de vida completo do objeto* para obter dados sobre gerações sobreviventes.
NOTE: Se selecionar essa opção, você notará que o medidor de Sobrecarga aumentará consideravelmente. Ao determinar o perfil da aplicação corporativa, pode ser que você precise aumentar a memória do IDE, devido à quantidade de dados coletados.
-[start=6]
+
. Desmarque a seleção de *Usar Pontos de Determinação de Perfil definidos* (se selecionado). Clique em Executar.
image::images/profile-memory-advanced.png[title="Caixa de diálogo Selecionar Tarefa de Determinação de Perfil diálogo mostrando tarefas e opções de Memória"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ru.asciidoc
index 471d1e9..0308045 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_ru.asciidoc
@@ -133,16 +133,16 @@
При настройке проекта как главного, имя проекта будет выделено полужирным в окне 'Проекты'.
-[start=2]
+
. Выберите "Профиль > Профилировать главный проект" в главном меню.
NOTE: Выберите JDK 1.7 или JDK 1.8 при отображении запроса на выбор платформы Java для профилирования.
-[start=3]
+
. Выберите "Наблюдение" в диалоговом окне "Выбор задачи профилирования".
-[start=4]
+
. Нажмите кнопку "Выполнить".
NOTE: Если средство профилирования не использовалось ранее, может быть отображен запрос на калибровку средства профилирования до выбора 'Выполнить'. Дополнительные сведения о калибровке профилировщика см. раздел link:../java/profiler-intro.html#calibrate[+Первое использование профилировщика+] в link:../java/profiler-intro.html[+Введение в профилирование приложений Java в IDE NetBeans+].
@@ -200,7 +200,7 @@
По шкале в диалоговом окне можно заметить, что трата системных ресурсов относительно невысока.
-[start=6]
+
. Нажмите кнопку "Текущие результаты профилирования" в окне "Профилирование", чтобы открыть вкладку текущих результатов профилирования.
image::images/sample-task-results.png[title="Результаты режима 'Образцы приложений'"]
@@ -225,7 +225,7 @@
По шкале в диалоговом окне можно заметить, что трата системных ресурсов выше, чем в режиме быстрого профилирования.
-[start=6]
+
. Нажмите кнопку "Текущие результаты профилирования" в окне "Профилирование", чтобы открыть вкладку текущих результатов профилирования.
На вкладке "Текущие результаты профилирования" показано время выполнения методов ``init`` и ``service`` для сервлета из класса ``Servlet2Stateless`` , и то, что каждый из методов был вызван один раз. Метод ``init`` в классе ``StatelessSessionBean`` также был вызван.
@@ -237,7 +237,7 @@
Для повышения удобочитаемости собранные данные можно фильтровать, используя фильтр "Результаты" в списке "Просмотр горячих точек" окна "Текущие результаты профилирования". Фильтр "Результаты" формирует выборку только по результатам и не затрагивает обрабатываемые классы. Используя фильтр "Результаты", можно отбирать результаты, которые соответствуют определенному шаблону. Для фильтрации можно использовать также более сложные регулярные выражения. Данные фильтруются по именам пакетов/классов/методов, в точности, как они появляются в первой колонке таблицы результатов. Можно определить более, чем один шаблон фильтрации, разделяя их пробелом или точкой с пробелом.
-[start=7]
+
. Введите свое имя в поле в веб-браузере и нажмите "Отправить запрос".
image::images/cpu-pane1-results1.png[title="Результаты режима 'Профилирование приложений'"]
@@ -276,10 +276,10 @@
Чтобы профилировать часть приложения необходимо сначала определить корневые методы. После выбора корневого метода профилирование будет применяться только к тем методам, которые вызываются потоком, входящим в корень профилирования.
-[start=6]
+
. В диалоговом окне "Изменить корневые методы профилирования" выберите "Вид веб-приложения" в раскрывающемся списке "Выбрать вид".
-[start=7]
+
. Разверните узел ServletStateless и выберите метод ``service`` в пакете сервлетов. Нажмите кнопку "ОК".
image::images/edit-profiling-roots.png[title="Представление веб-приложения в диалоговом окне 'Изменение корневых методов профилирования'"]
@@ -295,13 +295,13 @@
image::images/edit-profilingroots-pkg-adv.png[title="Диалоговое окно 'Изменение корневых методов профилирования' (Расширенное)"]
-[start=8]
+
. Нажмите кнопку "ОК" в диалоговом окне "Изменить корневые методы профилирования".
В диалоговом окне "Выбрать задачу профилирования" видно, что режим расширенного профилирования будет запущен с помощью специальных корневых методов профилирования. Чтобы просмотреть и изменить выбранный корневой метод нажмите *Изменить*. Заметим, что затраты системных ресурсов после этих действий ниже, чем была до настройки корневых методов.
-[start=9]
+
. Выберите *Профилировать только классы проекта* из раскрывающегося списка фильтров. Нажмите кнопку "Выполнить".
image::images/advanced-cpu-task-custom.png[title="Режим профилирования приложения выбран с нестандартным корнем профилирования"]
@@ -317,7 +317,7 @@
Хотя поток приложения выполнил вход в другие методы после входа в корень профилирования, эти методы не отображаются, поскольку фильтр инструментирования отбирает для инструментирования только те классы, которые являются частью проекта.
-[start=10]
+
. Введите свое имя в поле в веб-браузере и нажмите "Отправить запрос".
image::images/cpu-pane2-results1.png[title="Результаты методов инструментирования с использованием корня профилирования после вызова метода sayHello"]
@@ -327,10 +327,10 @@
Результирующие данные, которые отражают производительность приложения, могут не совсем точно описывать производительность приложения, работающего уже некоторое время. Один из способов сымитировать поведение веб-приложения в более реальных условиях — запустить сценарий генератора загрузки.
-[start=11]
+
. Повторите в браузере предыдущее действие несколько раз, затем нажмите "Сбросить результаты" на вкладке "Текущие результаты профилирования" для удаления результатов.
-[start=12]
+
. После сброса результатов профилирования введите свое имя и нажмите "Отправить запрос" еще раз.
image::images/cpu-pane2-results2.png[title="Результаты методов инструментирования с использованием корня профилирования после вызова метода sayHello"]
@@ -383,22 +383,22 @@
1. Остановите предыдущие сессии профилирования (если они все еще запущены), нажав кнопку "Завершить" в окне "Профилирование".
При нажатии "Остановить" среда IDE отсоединяется от приложения.
-[start=2]
+
. Выберите "Профиль > Профилировать главный проект" в главном меню.
-[start=3]
+
. Выберите *Память* в диалоговом окне "Выбрать задачу профилирования".
-[start=4]
+
. Выберите *Дополнительно*.
-[start=5]
+
. Выберите *Запись полного жизненного цикла объекта* для получения данных о выживании поколений.
NOTE: При выборе этого параметра уровень затрат системных ресурсов значительно повысится. При профилировании корпоративного приложения может понадобиться увеличить размер памяти, используемой IDE, из-за количество собранных данных.
-[start=6]
+
. Снимите отметку с параметра *Использовать определенные точки профилирования* (если он был отмечен). Нажмите кнопку "Выполнить".
image::images/profile-memory-advanced.png[title="Диалоговое окно 'Выбрать задачу профилированию', в котором поазывается задача и параметры памяти"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_zh_CN.asciidoc
index d21caa0..8915141 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/profiler-javaee_zh_CN.asciidoc
@@ -131,16 +131,16 @@
在将该项目设置为主项目后,该项目的名称将会在 "Projects"(项目)窗口中显示为粗体。
-[start=2]
+
. 从主菜单中选择 "Profile"(性能分析)> "Profile Main Project"(分析主项目)。
NOTE: 如果提示您选择要执行性能分析的 Java 平台,请选择 "JDK 1.7" 或 "JDK 1.8"。
-[start=3]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中选择 "Monitor"(监视)。
-[start=4]
+
. 单击 "Run"(运行)。
NOTE: 如果以前未使用过分析器,则可能会提示您先校准分析器,然后才能单击 "Run"(运行)。有关校准分析器的更多信息,请参见link:../java/profiler-intro.html[+在 NetBeans IDE 中对 Java 应用程序进行性能分析简介+]中有关link:../java/profiler-intro.html#calibrate[+首次使用分析器+]的部分。
@@ -198,7 +198,7 @@
通过该对话框中的比例,您可以看到开销相对较低。
-[start=6]
+
. 在 "Profiler"(分析器)窗口中单击 "Live Profiling Results"(实时性能分析结果)按钮,以打开 "Live Profiling Results"(实时性能分析结果)标签。
image::images/sample-task-results.png[title=""Sample Application"(样例应用程序)模式的结果"]
@@ -223,7 +223,7 @@
通过该对话框中的比例可以看到,与 "Quick"(快速)性能分析模式相比,该模式下产生的开销将相对较高。
-[start=6]
+
. 在 "Profiler"(分析器)窗口中单击 "Live Profiling Results"(实时性能分析结果)按钮,以打开 "Live Profiling Results"(实时性能分析结果)标签。
您可以看到,"Live Profiling Results"(实时性能分析结果)标签显示 ``Servlet2Stateless`` 类中 Servlet 的 ``init`` 和 ``service`` 方法的执行时间,并且每个方法都被调用了一次。此外,还调用了 ``StatelessSessionBean`` 类中的 ``init`` 方法。
@@ -235,7 +235,7 @@
为了更好地读取收集的数据,您可以在 "Live Profiling Results"(实时性能分析结果)窗口的 "Hot Spots"(热点)视图中使用 "Results"(结果)过滤器,以过滤显示的结果。"Results"(结果)过滤器仅过滤显示的结果,而不影响所分析的类。使用 "Results"(结果)过滤器时,可以按照定义的模式(起始为、包含、结束为)对结果进行过滤。此外,也可以使用更复杂的正则表达式进行过滤。数据是完全依据第一个结果表列中显示的包/类/方法名称过滤的。您可以指定多个模式,并用空格或逗号加空格来分隔这些模式。
-[start=7]
+
. 在 Web 浏览器的相应字段中键入名称,然后单击 "Submit Query"(提交查询)。
image::images/cpu-pane1-results1.png[title=""Profile Application"(分析应用程序)模式的结果"]
@@ -274,10 +274,10 @@
要对部分应用程序进行性能分析,需要首先指定根方法。通过选择性能分析根,可以只对进入性能分析根的线程所调用的方法进行分析。
-[start=6]
+
. 在 "Edit Profiling Roots"(编辑性能分析根目录)对话框的 "Select View"(选择视图)下拉列表中,选择 "Web Application View"(Web 应用程序视图)。
-[start=7]
+
. 展开 ServletStateless 节点,然后选择 Servlet 包中的 ``service`` 方法。单击 "OK"(确定)。
image::images/edit-profiling-roots.png[title=""Edit Profiling Roots"(编辑性能分析根目录)对话框中的 "Web Application View"(Web 应用程序视图)"]
@@ -293,13 +293,13 @@
image::images/edit-profilingroots-pkg-adv.png[title=""Edit Profiling Roots (Advanced)"(编辑性能分析根目录 (高级))对话框"]
-[start=8]
+
. 单击 "Edit Profiling Roots"(编辑性能分析根目录)对话框中的 "OK"(确定)。
在 "Select Profiling Task"(选择性能分析任务)对话框中,可以看到系统将使用定制性能分析根目录来运行 "Advanced"(高级)性能分析模式。您可以单击 *Edit*(编辑),以查看和修改选定的根方法。请注意,性能分析开销现在比尚未指定根方法时要少。
-[start=9]
+
. 从 "Filter"(过滤器)下拉列表中选择 *Profile only project classes*(只分析项目类)。单击 "Run"(运行)。
image::images/advanced-cpu-task-custom.png[title="对定制性能分析根目录选择了 "Profile Application"(性能分析应用程序)模式"]
@@ -315,7 +315,7 @@
虽然应用程序在进入性能分析根之后已进入其他方法,但并不显示这些其他的方法,因为分析过滤器限制仅对项目中的类进行分析。
-[start=10]
+
. 在 Web 浏览器的相应字段中键入名称,然后单击 "Submit Query"(提交查询)。
image::images/cpu-pane2-results1.png[title="在调用 sayHello 方法后使用性能分析根目录分析方法的结果"]
@@ -325,10 +325,10 @@
结果显示了应用程序性能,但可能无法准确地表示已持续运行一段时间的应用程序的性能。要在更为现实的情况下模拟 Web 应用程序的性能,一种方法是运行负载生成器脚本。
-[start=11]
+
. 在浏览器中多次重复执行上一步,然后单击 "Live Profiling Results"(实时性能分析结果)标签中的 "Reset Results"(重置结果),以清除结果。
-[start=12]
+
. 重置性能分析结果之后,键入名称,然后再单击一次 "Submit Query"(提交查询)。
image::images/cpu-pane2-results2.png[title="在调用 sayHello 方法后使用性能分析根目录分析方法的结果"]
@@ -381,22 +381,22 @@
1. 在 "Profiler"(分析器)窗口中单击 "Stop"(停止)按钮,以停止前一个性能分析会话(如果仍在运行)。
在单击 "Stop"(停止)后,IDE 将中断与应用程序的连接。
-[start=2]
+
. 从主菜单中选择 "Profile"(性能分析)> "Profile Main Project"(分析主项目)。
-[start=3]
+
. 在 "Select Profiling Task"(选择性能分析任务)对话框中选择 *Memory*(内存)。
-[start=4]
+
. 选择 *Advanced*(高级)。
-[start=5]
+
. 选择 *Record full object lifecycle*(记录完整对象生命周期)以便获取有关存活的年代数的数据。
NOTE: 如果选择此选项,您会注意到 "Overhead"(开销)计数器显著增加。对企业应用程序进行性能分析时,考虑到收集的数据量,很可能需要增加 IDE 的内存。
-[start=6]
+
. 取消选中 *Use defined Profiling Points*(使用定义的性能分析点)(如果已选中)。单击 "Run"(运行)。
image::images/profile-memory-advanced.png[title="显示内存任务和选项的 "Select Profiling Task"(选择性能分析任务)对话框"]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb.asciidoc
index b24e48b..72a0e06 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb.asciidoc
@@ -72,16 +72,16 @@
image::images/console-file-realm.png[title="Selecting the file realm node in admin console of application server"]
-[start=5]
+
. Click the Manage Users button at the top of the Edit Realm panel to open the File Users panel.
image::images/console-edit-realm.png[title="Edit Realm panel node in admin console of application server"]
-[start=6]
+
. Click the New button at the top of the File Users table in the File Users panel.
-[start=7]
+
. Enter the following data in the New File Realm User form. Click OK.
|===
@@ -133,10 +133,10 @@
Click Next.
-[start=4]
+
. Set the server to GlassFish and set the Java EE Version to Java EE 6.
-[start=5]
+
. Select Create EJB Module and deselect Create Web Application Module. Click Finish.
image::images/new-entapp-wizard.png[title="New File Realm User panel in admin console of application server"]
@@ -164,7 +164,7 @@
If you open the Libraries category of the Properties dialog box of the EJB module you will see that the JAR is added to the compile-time libraries.
-[start=5]
+
. In the source editor, add the following field declaration (in bold) to ``AccountStatus`` :
[source,java]
@@ -174,16 +174,16 @@
*private String amount = "250";*
----
-[start=6]
+
. In the source editor, right-click in the class and choose Insert Code (Alt-Insert; Ctrl-I on Mac) and then select Add Business Method to open the Add Business Method dialog box.
-[start=7]
+
. Type *getStatus* for the method name and set the return type to ``String`` .
The IDE automatically exposes the business method in the remote interface.
-[start=8]
+
. In the source editor, add the following line in bold to the ``getStatus`` method.
[source,java]
@@ -194,7 +194,7 @@
}
----
-[start=9]
+
. Type the following (in bold) to annotate the ``getStatus`` method.*@RolesAllowed({"USERS"})*
[source,java]
@@ -206,7 +206,7 @@
This annotation means that only users in the security role ``USERS`` can access the ``getStatus`` method.
-[start=10]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) and save your changes. Make sure that ``javax.annotation.security.RolesAllowed`` is added to the file.
@@ -223,13 +223,13 @@
Alternatively, you can open the New File wizard by choosing File > New File from the main menu. In this case, be sure that you select the Secure project in the Project dropdown list.
-[start=2]
+
. Select the GlassFish Descriptor file type in the GlassFish category. Click Next.
image::images/new-gf-descriptor.png[title="GlassFish descriptor file type in the New File wizard"]
-[start=3]
+
. Accept the default values in the wizard and click Finish.
When you click Finish, the IDE creates ``glassfish-application.xml`` and opens the file in the multi-view editor.
@@ -239,10 +239,10 @@
image::images/glassfish-application-descriptor.png[title="Security tab in the multi-view editor"]
-[start=4]
+
. In the Security tab of the multi-view editor, click Add Security Role Mapping and type *USERS* for the Security Role Name.
-[start=5]
+
. Click Add Group and type *bank_users* for the Group Name in the dialog box. Click OK.
The editor should now be similar to the following.
@@ -250,7 +250,7 @@
image::images/security-tab-descriptor.png[title="Security tab in the multi-view editor"]
-[start=6]
+
. Save your changes.
You can click on the XML tab in the multi-view editor to view deployment descriptor file in XML view. You can see that the deployment descriptor file now contains the following:
@@ -284,10 +284,10 @@
When you click Finish, ``Main.java`` opens in the source editor.
-[start=5]
+
. In the source editor, right-click in the ``Main.java`` file and choose Insert Code (Alt-Insert; Ctrl-I on Mac) and select Call Enterprise Bean.
-[start=6]
+
. In the Call Enterprise Bean dialog box, expand the Secure-ejb node and select AccountStatus. Click OK.
image::images/call-enterprise-bean.png[title="interface selected in the Call Enterprise Bean dialog box"]
@@ -305,7 +305,7 @@
If you expand the Libraries node in the Projects window you can see that the IDE added the SecureRemoteInterface JAR to the project classpath.
-[start=7]
+
. Modify the ``main`` method to add the following code and save your changes.
[source,java]
@@ -328,13 +328,13 @@
When you click Deploy, the IDE builds the EAR file, starts the application server (if it's not running) and deploys the EAR file to the server.
-[start=2]
+
. Right-click the SecureAppClient project node in the Projects window and choose Run. A dialog box appears prompting you for a username and password.
image::images/login-window.png[title="Login window prompting for username and password"]
-[start=3]
+
. Enter the user name ( ``manager`` ) and password ( ``password`` ) in the dialog box and click OK. The following will appear in the Output window:
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ja.asciidoc
index 33a3301..7f45b8d 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ja.asciidoc
@@ -72,16 +72,16 @@
image::images/console-file-realm.png[title="アプリケーション・サーバーの管理コンソールでのfileレルム・ノードの選択"]
-[start=5]
+
. 「レルムを編集」パネルの上部にある「ユーザー管理」ボタンをクリックして、「ファイル・ユーザー」パネルを開きます。
image::images/console-edit-realm.png[title="アプリケーション・サーバーの管理コンソールの「レルムを編集」パネル・ノード"]
-[start=6]
+
. 「ファイル・ユーザー」パネルの「ファイル・ユーザー」表の上部にある「新規」ボタンをクリックします。
-[start=7]
+
. 「新規ファイル・レルム・ユーザー」フォームに次のデータを入力します。「OK」をクリックします。
|===
@@ -133,10 +133,10 @@
「次」をクリックします。
-[start=4]
+
. サーバーをGlassFishに設定し、Java EEバージョンをJava EE 6に設定します。
-[start=5]
+
. 「EJBモジュールを作成」を選択し、「Webアプリケーション・モジュールを作成」を選択解除します。「終了」をクリックします。
image::images/new-entapp-wizard.png[title="アプリケーション・サーバーの管理コンソールの新規ファイル・レルム・ユーザー・パネル"]
@@ -164,7 +164,7 @@
EJBモジュールの「プロパティ」ダイアログ・ボックスの「ライブラリ」カテゴリを開くと、このJARがコンパイル時ライブラリに追加されていることがわかります。
-[start=5]
+
. ソース・エディタで次のフィールド宣言(太字部分)を ``AccountStatus`` に追加します。
[source,java]
@@ -174,16 +174,16 @@
*private String amount = "250";*
----
-[start=6]
+
. ソース・エディタで、クラス内を右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、「ビジネス・メソッドを追加」を選択して「ビジネス・メソッドを追加」ダイアログ・ボックスを開きます。
-[start=7]
+
. メソッド名に「*getStatus*」と入力し、戻り型を ``String`` に設定します。
ビジネス・メソッドが自動的にリモート・インタフェースに公開されます。
-[start=8]
+
. ソース・エディタで次に示す太字の行を ``getStatus`` メソッドに追加します。
[source,java]
@@ -194,7 +194,7 @@
}
----
-[start=9]
+
. 次に示す太字の部分を入力して ``getStatus`` メソッドに注釈を付けます。*@RolesAllowed({"USERS"})*
[source,java]
@@ -206,7 +206,7 @@
この注釈は、セキュリティ・ロール ``USERS`` のユーザーのみが ``getStatus`` メソッドにアクセスできることを示します。
-[start=10]
+
. エディタ内を右クリックして「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択し、変更内容を保存します。ファイルに ``javax.annotation.security.RolesAllowed`` が追加されていることを確認します。
@@ -223,13 +223,13 @@
または、メイン・メニューから「ファイル」>「新規ファイル」を選択して新規ファイル・ウィザードを開くこともできます。その場合は、必ず「プロジェクト」ドロップダウン・リストで「Secure」プロジェクトを選択してください。
-[start=2]
+
. 「GlassFish」カテゴリで「GlassFishディスクリプタ」ファイル・タイプを選択します。「次」をクリックします。
image::images/new-gf-descriptor.png[title="新規ファイル・ウィザードの「GlassFishディスクリプタ」ファイル・タイプ"]
-[start=3]
+
. ウィザードのデフォルト値を受け入れ、「終了」をクリックします。
「終了」をクリックすると、IDEによって ``glassfish-application.xml`` が作成され、ファイルがマルチビュー・エディタで開きます。
@@ -239,10 +239,10 @@
image::images/glassfish-application-descriptor.png[title="マルチビュー・エディタの「セキュリティ」タブ"]
-[start=4]
+
. マルチビュー・エディタの「セキュリティ」タブで、「セキュリティ・ロール・マッピングの追加」をクリックし、「セキュリティ・ロール名」に「*USERS*」と入力します。
-[start=5]
+
. 「グループを追加」をクリックし、ダイアログ・ボックスの「グループ名」に「*bank_users*」と入力します。「OK」をクリックします。
エディタは次のようになっているはずです。
@@ -250,7 +250,7 @@
image::images/security-tab-descriptor.png[title="マルチビュー・エディタの「セキュリティ」タブ"]
-[start=6]
+
. 変更を保存します。
マルチビュー・エディタ内の「XML」タブをクリックして、デプロイメント・ディスクリプタ・ファイルをXMLビューに表示できます。デプロイメント・ディスクリプタ・ファイルに次の内容が含まれることがわかります。
@@ -284,10 +284,10 @@
「終了」をクリックすると、 ``Main.java`` がソース・エディタに表示されます。
-[start=5]
+
. ソース・エディタで ``Main.java`` ファイル内を右クリックして「コードを挿入」([Alt]-[Insert]、Macの場合は[Ctrl]-[I])を選択し、「エンタープライズBeanをコール」を選択します。
-[start=6]
+
. 「エンタープライズBeanをコール」ダイアログ・ボックスで、「Secure-ejb」ノードを展開し、「AccountStatus」を選択します。「OK」をクリックします。
image::images/call-enterprise-bean.png[title="「エンタープライズBeanをコール」ダイアログ・ボックスで選択されたインタフェース"]
@@ -305,7 +305,7 @@
「プロジェクト」ウィンドウの「ライブラリ」ノードを展開すると、IDEによってSecureRemoteInterface JARがプロジェクトのクラスパスに追加されたことがわかります。
-[start=7]
+
. ``main`` メソッドを変更して次のコードを追加し、変更内容を保存します。
[source,java]
@@ -324,19 +324,19 @@
これでアプリケーションの準備が完了しました。まず、エンタープライズ・アプリケーションをサーバーにデプロイします。エンタープライズ・アプリケーションをデプロイした後、アプリケーション・クライアントを実行して、エンタープライズ・アプリケーション内のメソッドがセキュリティ保護されていること、およびユーザー・ロールが正しくマップされていることをテストできます。アプリケーション・クライアントを実行すると、 ``bank_users`` グループ内のユーザーのユーザー名とパスワードの入力を求められます。
-[start=1]
+
. 「プロジェクト」ウィンドウで「Secure」エンタープライズ・アプリケーション・プロジェクトのノードを右クリックし、「デプロイ」を選択します。
「デプロイ」をクリックすると、IDEはEARファイルをビルドし、アプリケーション・サーバーを起動し(実行されていない場合)、EARファイルをサーバーにデプロイします。
-[start=2]
+
. 「プロジェクト」ウィンドウでSecureAppClientプロジェクト・ノードを右クリックし、「実行」を選択します。ユーザー名とパスワードの入力を求めるダイアログ・ボックスが表示されます。
image::images/login-window.png[title="ユーザー名とパスワードの入力を求める「ログイン」ウィンドウ"]
-[start=3]
+
. ダイアログ・ボックスでユーザー名( ``manager`` )とパスワード( ``password`` )を入力し、「OK」をクリックします。「出力」ウィンドウに次のように表示されます。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_pt_BR.asciidoc
index 67bbc1f..8fd173a 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_pt_BR.asciidoc
@@ -72,16 +72,16 @@
image::images/console-file-realm.png[title="Selecionando o nó realm de arquivo na console de admin do servidor de aplicações"]
-[start=5]
+
. Clique no botão Gerenciar Usuários na parte superior do painel Editar Realm para abrir o painel Usuários do Arquivo.
image::images/console-edit-realm.png[title="Nó do painel Editar Realm console de admin do servidor de aplicações"]
-[start=6]
+
. Clique no botão Novo na parte superior da tabela Usuários do Arquivo no painel Usuários do Arquivo.
-[start=7]
+
. Digite os seguintes dados no form Novo Usuário de Realm do Arquivo. Clique em OK.
|===
@@ -133,10 +133,10 @@
Clique em Próximo.
-[start=4]
+
. Defina o servidor como GlassFish e defina a Versão para Java EE 6.
-[start=5]
+
. Selecione Criar Módulo EJB e desmarque a seleção Criar Módulo da Aplicação Web. Clique em Finalizar.
image::images/new-entapp-wizard.png[title="Painel Novo Realm de Arquivo do Usuário na console de admin do servidor de aplicações"]
@@ -164,7 +164,7 @@
Ao abrir a categoria Bibliotecas da caixa de diálogo Propriedades do módulo EJB, você verá que o JAR é adicionado às bibliotecas de tempo de compilação.
-[start=5]
+
. No editor de código-fonte, adicione a declaração de campo a seguir (em negrito) em ``AccountStatusBean`` :
[source,java]
@@ -174,16 +174,16 @@
*private String amount = "250";*
----
-[start=6]
+
. No editor de código fonte, clique com o botão direito do mouse na classe e selecione Inserir Código (Alt-Insert; Ctrl-I on Mac) e, então, selecione Adicionar Método de Negócios para abrir a caixa de diálogo Adicionar Método de Negócio.
-[start=7]
+
. Digite *getStatus* como nome do método e defina o tipo de retorno como ``String`` .
O IDE expõe automaticamente o método de negócios na interface remota.
-[start=8]
+
. No editor de código-fonte, adicione a linha a seguir em negrito ao método ``getStatus`` .
[source,java]
@@ -194,7 +194,7 @@
}
----
-[start=9]
+
. Digite o seguinte (em negrito) para anotar o método ``getStatus`` .*@RolesAllowed({"USERS"})*
[source,java]
@@ -206,7 +206,7 @@
Essa anotação significa que somente os usuários na atribuição de segurança ``USERS`` podem acessar o método ``getStatus`` .
-[start=10]
+
. Clique com o botão direito do mouse no editor, selecione Corrigir Importações (Alt-Shift-I; ⌘-Shift-I no Mac) e salve as alterações. Certifique-se de que o ``javax.annotation.security.RolesAllowed`` tenha sido adicionado ao arquivo.
@@ -223,13 +223,13 @@
Outra opção é abrir o assistente Novo Arquivo selecionando Arquivo > Novo Arquivo no menu principal. Nesse caso, certifique-se de que o projeto Proteger seja selecionando na lista drop-down do Projeto.
-[start=2]
+
. Selecione o tipo de arquivo Descritor GlassFish na categoria GlassFish. Clique em Próximo.
image::images/new-gf-descriptor.png[title="Tipo de arquivo do descritor do GlassFish no assistente Novo Arquivo"]
-[start=3]
+
. Aceite os valores default no assistente e clique em Finalizar.
Quando você clica em Finalizar, o IDE cria ``glassfish-application.xml`` e abre o arquivo no editor com multiview.
@@ -239,10 +239,10 @@
image::images/glassfish-application-descriptor.png[title="Guia Segurança no editor com multiview"]
-[start=4]
+
. Na guia Segurança do editor com multiview, clique em Adicionar Mapeamento de Atribuição de Segurança e digite *USERS* como Nome da Atribuição de Segurança.
-[start=5]
+
. Clique em Adicionar Grupo e digite *bank_users* como Nome do Grupo na caixa de diálogo. Clique em OK.
O editor deve estar parecido com o mostrado a seguir.
@@ -250,7 +250,7 @@
image::images/security-tab-descriptor.png[title="Guia Segurança no editor com multiview"]
-[start=6]
+
. Salve as alterações.
Você pode clicar na guia XML no editor com multiview para ver o arquivo do descritor de implantação na exibição XML. Você pode ver que o arquivo do descritor de implantação agora contém o seguinte:
@@ -284,10 +284,10 @@
Quando você clicar em Finalizar, o ``Main.java`` abrirá no editor de código-fonte.
-[start=5]
+
. No editor de código-fonte, clique com o botão direito do mouse no arquivo ``Main.java`` e selecione Inserir Código (Alt-Insert; Ctrl-I no Mac) e selecione Chamar Enterprise Beans.
-[start=6]
+
. Na caixa de diálogo Chamar Enterprise Eean, expanda o nó Secure-ejb e selecione AccountStatus. Clique em OK.
image::images/call-enterprise-bean.png[title="Interface selecionada na caixa de diálogo Chamar Enterprise Bean"]
@@ -305,7 +305,7 @@
Se expandir o nó Bibliotecas na janela Projetos, você poderá ver que o IDE adicionou SecureRemoteInterface JAR ao classpath do projeto.
-[start=7]
+
. Modifique o método ``main`` para adicionar o código a seguir e salvar suas alterações.
[source,java]
@@ -328,13 +328,13 @@
Quando você clica em Implantar, o IDE constrói o arquivo EAR, inicia o servidor de aplicações (se ainda não estiver em execução) e implanta o arquivo EAR no servidor.
-[start=2]
+
. Clique com o botão direito do mouse no nó do projeto SecureAppClient na janela Projetos e selecione Executar. Aparecerá uma caixa de diálogo solicitando um nome de usuário e senha.
image::images/login-window.png[title="Janela de Log-in para solicitar um nome de usuário e senha"]
-[start=3]
+
. Digite o nome de usuário ( ``manager`` ) e a senha ( ``password`` ) na caixa de diálogo e clique em OK. A mensagem a seguir é exibida na janela de Saída:
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ru.asciidoc
index 5a2f384..36d58bd 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_ru.asciidoc
@@ -72,16 +72,16 @@
image::images/console-file-realm.png[title="Выбор узла области файла на консоли администрирования сервера приложений"]
-[start=5]
+
. Нажмите кнопку "Управление пользователями" в верней участи панели "Редактировать область", чтобы открыть панель "Изменить область".
image::images/console-edit-realm.png[title="Узел панели 'Изменить область' на консоли администрирования сервера приложений"]
-[start=6]
+
. Нажмите кнопку "Новый" в верхней части таблицы "Пользователи файлов" на панели "Пользователи файлов".
-[start=7]
+
. Введите следующие данные в форму "Новый пользователь области файлов". Нажмите кнопку "ОК".
|===
@@ -133,10 +133,10 @@
Нажмите кнопку "Далее".
-[start=4]
+
. Установите сервер GlassFish, затем для параметра "Версия Java EE" выберите "Java EE 6".
-[start=5]
+
. Выберите "Создать модуль EJB" и отмените выбор "Создать модуль веб-приложения". Нажмите кнопку 'Готово'.
image::images/new-entapp-wizard.png[title="Панель 'Создать пользователя области файла' на консоли администрирования сервера приложений"]
@@ -164,7 +164,7 @@
При открытии категории "Библиотеки" диалогового окна "Свойства" модуля EJB можно заметить, что JAR добавлен к библиотеке для компиляции.
-[start=5]
+
. В редакторе исходного кода добавьте следующее объявление поля (полужирным шрифтом) к ``AccountStatus`` :
[source,java]
@@ -174,16 +174,16 @@
*private String amount = "250";*
----
-[start=6]
+
. В редакторе исходного кода щелкните правой кнопкой мыши в классе и выберите 'Вставить код' (Alt-Insert; Ctrl-I в Mac), а затем выберите 'Добавить бизнес-метод', чтобы открыть диалоговое окно 'Добавить бизнес-метод'.
-[start=7]
+
. Введите *getStatus* в качестве имени метода, затем установите для типа возвращаемого значения ``String`` .
Среда IDE автоматически открывает бизнес-метод в удаленном интерфейсе.
-[start=8]
+
. В редакторе исходного кода добавьте следующую строку с полужирным шрифтом к методу ``getStatus`` .
[source,java]
@@ -194,7 +194,7 @@
}
----
-[start=9]
+
. Введите следующее (полужирным шрифтом) для аннотации метода ``getStatus`` .*@RolesAllowed({"USERS"})*
[source,java]
@@ -206,7 +206,7 @@
Эта аннотация означает, что только пользователям с ролью безопасности ``USERS`` доступен метод ``getStatus`` .
-[start=10]
+
. Щелкните правой кнопкой мыши в области редактора и выберите команду 'Исправить операторы импорта' (Alt-Shift-I; ⌘-Shift-I в Mac) и сохраните изменения. Убедитесь, что к файлу добавлено ``javax.annotation.security.RolesAllowed`` .
@@ -223,13 +223,13 @@
Также можно открыть мастер "Создание файла", выбрав "Файл > Создание файла" в главном меню. В этом случае необходимо выбрать проект "Безопасность" в раскрывающемся списке "Проект".
-[start=2]
+
. Выберите тип файла "Дескриптор GlassFish" в категории GlassFish. Нажмите кнопку "Далее".
image::images/new-gf-descriptor.png[title="Тип файла дескриптора GlassFish в мастере создания файлов"]
-[start=3]
+
. Примите значения по умолчанию в мастере и щелкните "Готово".
При нажатии кнопки "Готово" среда IDE создает файл ``glassfish-application.xml`` и открывает его в редакторе исходного кода с несколькими представлениями.
@@ -239,10 +239,10 @@
image::images/glassfish-application-descriptor.png[title="Вкладка 'Безопасность' в редакторе с несколькими представлениями "]
-[start=4]
+
. На вкладке "Безопасность" редактора с несколькими представлениями щелкните "Добавить сопоставление роли безопасности" и введите *USERS* для параметра "Имя роли безопасности".
-[start=5]
+
. Щелкните "Добавить группу" и введите *bank_users* для параметра "Имя группы" в диалоговом окне. Нажмите кнопку "ОК".
Теперь текст в редакторе должен быть схож со следующим.
@@ -250,7 +250,7 @@
image::images/security-tab-descriptor.png[title="Вкладка 'Безопасность' в редакторе с несколькими представлениями "]
-[start=6]
+
. Сохраните изменения.
Можно щелкнуть вкладку "XML" в редакторе с несколькими представлениями, чтобы просмотреть файл дескриптора развертывания в представлении XML. Теперь этот файл дескриптора развертывания содержит следующий текст:
@@ -284,10 +284,10 @@
После нажатии кнопки "Готово" в редакторе исходного кода откроется ``Main.java`` .
-[start=5]
+
. В редакторе исходного кода щелкните правой кнопкой мыши в файле ``Main.java`` и выберите 'Вставить код' (Alt-Insert; Ctrl-I в Mac) и выберите 'Call Enterprise Bean'.
-[start=6]
+
. В диалоговом окне "Вызов компонента EJB" разверните узел Secure-ejb и выберите AccountStatus. Нажмите кнопку "ОК".
image::images/call-enterprise-bean.png[title="интерфейс, выбранный в диалоговом окне 'Вызвать компонент корпоративного уровня'"]
@@ -305,7 +305,7 @@
Если развернуть узел "Узел" в окне "Проекты", можно увидеть, что среда IDE добавила файл JAR SecureRemoteInterface к пути к классам проекта.
-[start=7]
+
. Измените метод ``main`` , чтобы добавить следующий код и сохранить изменения.
[source,java]
@@ -328,13 +328,13 @@
При нажатии кнопки "Развернуть" среда IDE создает файл EAR, запускает сервер приложений (если он еще не запущен) и выполняет развертывание файла EAR на сервере.
-[start=2]
+
. Правой кнопкой мыши щелкните узел проекта SecureAppClient в окне "Проект" и выберите "Выполнить". Появится диалоговое окно с запросом на ввод имени пользователя и пароля.
image::images/login-window.png[title="Окно входа с запросом на ввод имени пользователя и пароля"]
-[start=3]
+
. В диалоговом окне введите имя пользователя ( ``manager`` ) и пароль ( ``password`` ) и нажмите кнопку "ОК". В окне вывода появится следующее.
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_zh_CN.asciidoc
index 9c600dc..941a768 100644
--- a/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javaee/secure-ejb_zh_CN.asciidoc
@@ -72,16 +72,16 @@
image::images/console-file-realm.png[title="在应用服务器的管理控制台中选择文件领域节点"]
-[start=5]
+
. 单击 "Edit Realm"(编辑领域)面板顶部的 "Manage Users"(管理用户)按钮,打开 "File Users"(文件用户)面板。
image::images/console-edit-realm.png[title="应用服务器的管理控制台中的 "Edit Realm"(编辑领域)面板代码"]
-[start=6]
+
. 单击 "File Users"(文件用户)面板中 "File Users"(文件用户)表顶部的 "New"(新建)按钮。
-[start=7]
+
. 在 "New File Realm User"(新建文件领域用户)窗体中输入以下数据。单击 "OK"(确定)。
|===
@@ -133,10 +133,10 @@
单击 "Next"(下一步)。
-[start=4]
+
. 将服务器设置为 "GlassFish",并将 Java EE 版本设置为 "Java EE 6"。
-[start=5]
+
. 选中 "Create EJB Module"(创建 EJB 模块),并取消选中 "Create Web Application Module"(创建 Web 应用程序模块)。单击 "Finish"(完成)。
image::images/new-entapp-wizard.png[title="应用服务器的管理控制台中的 "New File Realm User"(新建文件领域用户)面板"]
@@ -164,7 +164,7 @@
如果打开 EJB 模块的 "Properties"(属性)对话框的 "Libraries"(库)类别,则会看到 JAR 已添加到编译时库中。
-[start=5]
+
. 在源代码编辑器中,将以下字段声明(以粗体显示)添加到 ``AccountStatus`` 中:
[source,java]
@@ -174,16 +174,16 @@
*private String amount = "250";*
----
-[start=6]
+
. 在源代码编辑器中,右键单击类,并选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键),然后选择 "Add Business Method"(添加 Business 方法),以打开 "Add Business Method"(添加 Business 方法)对话框。
-[start=7]
+
. 键入 *getStatus* 作为方法名称,并将返回类型设置为 ``String`` 。
IDE 将自动在远程接口中公开此业务方法。
-[start=8]
+
. 在源代码编辑器中,将以下代码行(以粗体显示)添加到 ``getStatus`` 方法中。
[source,java]
@@ -194,7 +194,7 @@
}
----
-[start=9]
+
. 键入以下内容(以粗体显示)来标注 ``getStatus`` 方法。*@RolesAllowed({"USERS"})*
[source,java]
@@ -206,7 +206,7 @@
此标注表示只有安全角色为 ``USERS`` 的用户才能访问 ``getStatus`` 方法。
-[start=10]
+
. 在编辑器中右键单击并选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 中为 ⌘-Shift-I 组合键),然后保存您的更改。确保 ``javax.annotation.security.RolesAllowed`` 已添加到该文件中。
@@ -223,13 +223,13 @@
此外,也可以从主菜单中选择 "File"(文件)> "New File"(新建文件),以打开新建文件向导。在这种情况下,请确保在 "Project"(项目)下拉列表中选择了 "Secure" 项目。
-[start=2]
+
. 选择 "GlassFish" 类别,然后再选择 "GlassFish Descriptor"(GlassFish 描述符)文件类型。单击 "Next"(下一步)。
image::images/new-gf-descriptor.png[title="新建文件向导中的 GlassFish 描述符文件类型"]
-[start=3]
+
. 接受该向导中的默认值,然后单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将创建 ``glassfish-application.xml`` 并在多视图编辑器中打开该文件。
@@ -239,10 +239,10 @@
image::images/glassfish-application-descriptor.png[title="多视图编辑器中的 "Security"(安全)标签"]
-[start=4]
+
. 在多视图编辑器的 "Security"(安全)标签中,单击 "Add Security Role Mapping"(添加安全角色映射),然后在 "Security Role Name"(安全角色名称)中键入 *USERS*。
-[start=5]
+
. 单击 "Add Group"(添加组),然后在对话框的 "Group Name"(组名称)中键入 *bank_users*。单击 "OK"(确定)。
编辑器现在应如下所示。
@@ -250,7 +250,7 @@
image::images/security-tab-descriptor.png[title="多视图编辑器中的 "Security"(安全)标签"]
-[start=6]
+
. 保存所做的更改。
通过单击多视图编辑器中的 "XML" 标签,可以在 XML 视图中查看部署描述符文件。您可以看到该部署描述符文件现在包含以下代码:
@@ -284,10 +284,10 @@
单击 "Finish"(完成),此时将在源代码编辑器中打开 ``Main.java`` 。
-[start=5]
+
. 在源代码编辑器中,右键单击 ``Main.java`` 文件,并选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键),然后选择 "Call Enterprise Bean"(调用企业 Bean)。
-[start=6]
+
. 在 "Call Enterprise Bean"(调用企业 Bean)对话框中,展开 "Secure-ejb" 节点,然后选择 "AccountStatus"。单击 "OK"(确定)。
image::images/call-enterprise-bean.png[title=""Call Enterprise Bean"(调用企业 Bean)对话框中选中了接口"]
@@ -305,7 +305,7 @@
如果在 "Projects"(项目)窗口中展开 "Libraries"(库)节点,则可以看到 IDE 已将 SecureRemoteInterface JAR 添加到了项目类路径中。
-[start=7]
+
. 通过添加以下代码来修改 ``main`` 方法,然后保存所做的更改。
[source,java]
@@ -328,13 +328,13 @@
在单击 "Deploy"(部署)后,IDE 将构建 EAR 文件,启动应用服务器(如果没有运行),并将该 EAR 文件部署到该服务器。
-[start=2]
+
. 在 "Projects"(项目)窗口中右键单击 "SecureAppClient" 项目节点,然后选择 "Run"(运行)。此时将出现一个对话框,提示您输入用户名和口令。
image::images/login-window.png[title="提示输入用户名和口令的登录窗口"]
-[start=3]
+
. 在对话框中输入用户名 ( ``manager`` ) 和口令 ( ``password`` ),然后单击 "OK"(确定)。"Output"(输出)窗口中将显示以下内容:
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng.asciidoc
index d1a6ca8..974d071 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng.asciidoc
@@ -33,18 +33,6 @@
Mobile embedded applications are employed in small embedded devices such as industrial metering devices, vending machines, security systems, modems, home electronics devices, and similar devices with either simple or no display and with some limited network connectivity. This example shows you how to develop a new Java ME embedded project in the NetBeans IDE using the Oracle Java Micro Edition Embedded platform that includes support for link:http://jcp.org/en/jsr/detail?id=228[+JSR 228+], the Information Module Profile-Next Generation API (IMP-NG). It will also explain how to debug and profile your own IMlet using NetBeans support for Oracle Java ME Embedded.
-
-=== Contents
-
-image::images/netbeans-stamp-80-74-73.png[title="Content on this page applies to the NetBeans IDE 7.3 and more recent"]
-
-* <<install,Installing Oracle Java ME Embedded>>
-* <<create,Creating an Embedded Project>>
-* <<run,Running the Application>>
-* <<debug,Debugging the Application>>
-* <<profile,Profiling the Application>>
-* <<nextsteps,See Also>>
-
*To complete this tutorial, you need the following software and resources:*
|===
@@ -86,16 +74,24 @@
image::images/plugins-small.png[role="left", link="images/plugins.png"]
--
-3. Click Activate.
-4. At the Welcome panel of the Installer dialog box, click Activate.
+
+[start=3]
+. Click Activate.
+
+[start=4]
+. At the Welcome panel of the Installer dialog box, click Activate.
[.feature]
--
image::images/installer-small.png[role="left", link="images/installer.png"]
--
-5. When the activation is successfully completed, click Finish.
-6. Click Close to close the Plugins dialog box.
+
+[start=5]
+. When the activation is successfully completed, click Finish.
+
+[start=6]
+. Click Close to close the Plugins dialog box.
*To install the Oracle Java ME Embedded platform:*
@@ -107,12 +103,22 @@
image::images/jpmanager-small.png[role="left", link="images/jpmanager.png"]
--
-2. Click Add Platform.
-3. In the Select Platform Type of the Add Java Platform wizard, select Java ME CLDC Platform Emulator and click Next.
+
+[start=2]
+. Click Add Platform.
+
+[start=3]
+. In the Select Platform Type of the Add Java Platform wizard, select Java ME CLDC Platform Emulator and click Next.
The IDE displays the Choose directory to search for platforms dialog box.
-4. Select the directory you installed the Java ME SDK Platform to (for example, ``C:\Java_ME_Platform_SDK_3.2`` ) and click Open.
-5. In the Platform Folders panel of the Add Java Platform wizard, ensure the platform you selected in the previous step is chosen and click Next.
-6. As soon as the IDE detects the platform, click Finish in the Detected Platforms panel of the the Add Java Platform wizard.
+
+[start=4]
+. Select the directory you installed the Java ME SDK Platform to (for example, ``C:\Java_ME_Platform_SDK_3.2`` ) and click Open.
+
+[start=5]
+. In the Platform Folders panel of the Add Java Platform wizard, ensure the platform you selected in the previous step is chosen and click Next.
+
+[start=6]
+. As soon as the IDE detects the platform, click Finish in the Detected Platforms panel of the the Add Java Platform wizard.
[.feature]
--
@@ -126,7 +132,9 @@
image::images/jpregistered-small.png[role="left", link="images/jpregistered.png"]
--
-7. In the Java Platform Manager dialog box, click Close.
+
+[start=7]
+. In the Java Platform Manager dialog box, click Close.
Now your NetBeans IDE is set up for mobile development.
@@ -137,17 +145,27 @@
1. Choose File > New Project.
The New Project dialog box displays.
-2. Select the Java ME category and the Embedded Application project. Click Next.
-3. In the Name and Location panel of the New Embedded Application wizard, specify ``EmbeddedApp`` as the project name.
+
+[start=2]
+. Select the Java ME category and the Embedded Application project. Click Next.
+
+[start=3]
+. In the Name and Location panel of the New Embedded Application wizard, specify ``EmbeddedApp`` as the project name.
[.feature]
--
image::images/newappname-small.png[role="left", link="images/newappname.png"]
--
-4. Leave the Create Default Package and IMlet Class option selected and click Next.
-5. Make sure CLDC Oracle Java(TM) Platform Micro Edition SDK is selected as the emulator platform and IMPNGPhone1 is selected as the device.
-6. Click Finish.
+
+[start=4]
+. Leave the Create Default Package and IMlet Class option selected and click Next.
+
+[start=5]
+. Make sure CLDC Oracle Java(TM) Platform Micro Edition SDK is selected as the emulator platform and IMPNGPhone1 is selected as the device.
+
+[start=6]
+. Click Finish.
An IMP-NG application with an IMLet is created in a standard IDE project.
image::images/prjcreated.png[]
@@ -161,8 +179,12 @@
1. In the Projects window, double-click the ``IMlet.java`` file and choose Edit.
The IDE opens the ``IMlet.java`` file in the Source Editor.
-2. Scroll through the source code and find the ``StartApp`` method.
-3. Insert the following line in bold in the ``StartApp`` method's body:
+
+[start=2]
+. Scroll through the source code and find the ``StartApp`` method.
+
+[start=3]
+. Insert the following line in bold in the ``StartApp`` method's body:
[source,java]
----
@@ -171,7 +193,9 @@
*System.out.println("Hello, world!");*
}
----
-4. Choose File > Save from the IDE's main menu to save the edits.
+
+[start=4]
+. Choose File > Save from the IDE's main menu to save the edits.
Now that you have created the application, you can run the application in the IDE as described below:
@@ -180,7 +204,9 @@
NOTE: Choose Window > Output > Output from the the IDE's main menu if the Output window is not visible.
-2. From the IDE's menu bar, choose Run > Run Project.
+
+[start=2]
+. From the IDE's menu bar, choose Run > Run Project.
The IMPNGPhone1 emulator starts and displays the EmbeddedApp application running.
[.feature]
@@ -197,11 +223,17 @@
image::images/output-small.png[role="left", link="images/output.png"]
--
-3. In the emulator, select ``Embedded App (running)`` and click Suspend on the right.
+
+[start=3]
+. In the emulator, select ``Embedded App (running)`` and click Suspend on the right.
The application is paused.
-4. Click Resume.
+
+[start=4]
+. Click Resume.
The application resumes running.
-5. To stop the application and close the emulator, click Stop and choose Application > Exit from the emulator's menu.
+
+[start=5]
+. To stop the application and close the emulator, click Stop and choose Application > Exit from the emulator's menu.
The run process is terminated in the IDE.
<<top,top>>
@@ -231,10 +263,18 @@
image::images/available-plugins-small.png[role="left", link="images/available-plugins.png"]
--
-4. Click Install.
-5. At the Welcome page of the Installer dialog box, click Next.
-6. At the License Agreement page, read the license agreements associated with the plugin. If you agree to the terms of all of the license agreements, click the appropriate option and then click Install.
-7. When the installation process is complete, leave the Restart IDE now option selected and click Finish.
+
+[start=4]
+. Click Install.
+
+[start=5]
+. At the Welcome page of the Installer dialog box, click Next.
+
+[start=6]
+. At the License Agreement page, read the license agreements associated with the plugin. If you agree to the terms of all of the license agreements, click the appropriate option and then click Install.
+
+[start=7]
+. When the installation process is complete, leave the Restart IDE now option selected and click Finish.
After NetBeans IDE restarts, you can start using the IDE to profile your mobile embedded application.
@@ -248,12 +288,22 @@
image::images/enable-small.png[role="left", link="images/enable.png"]
--
-3. (Applicable if this is first-time profiling of the project) In the Enable Profiling dialog box, click Yes to perform the integration.
-4. In the Profile dialog box, choose CPU Profiler, and optionally check Profile System Classes.
-5. Click Run.
+
+[start=3]
+. (Applicable if this is first-time profiling of the project) In the Enable Profiling dialog box, click Yes to perform the integration.
+
+[start=4]
+. In the Profile dialog box, choose CPU Profiler, and optionally check Profile System Classes.
+
+[start=5]
+. Click Run.
The emulator opens with the `EmbeddedApp` application running.
-6. Interact with the application.
-7. Exit the application or close the emulator.
+
+[start=6]
+. Interact with the application.
+
+[start=7]
+. Exit the application or close the emulator.
The IDE displays the profile data in the `cpu:_time_` window.
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ja.asciidoc
index 5f29161..b64be9d 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ja.asciidoc
@@ -79,16 +79,24 @@
image::images/plugins-small.png[role="left", link="images/plugins.png"]
--
-3. 「アクティブ化」をクリックします。
-4. 「インストーラ」ダイアログ・ボックスの「ようこそ」パネルで「アクティブ化」をクリックします。
+
+[start=3]
+. 「アクティブ化」をクリックします。
+
+[start=4]
+. 「インストーラ」ダイアログ・ボックスの「ようこそ」パネルで「アクティブ化」をクリックします。
[.feature]
--
image::images/installer-small.png[role="left", link="images/installer.png"]
--
-5. アクティブ化が正常に完了したら、「終了」をクリックします。
-6. 「閉じる」をクリックして「プラグイン」ダイアログ・ボックスを閉じます。
+
+[start=5]
+. アクティブ化が正常に完了したら、「終了」をクリックします。
+
+[start=6]
+. 「閉じる」をクリックして「プラグイン」ダイアログ・ボックスを閉じます。
*Oracle Java ME Embeddedプラットフォームをインストールする手順:*
@@ -100,12 +108,22 @@
image::images/jpmanager-small.png[role="left", link="images/jpmanager.png"]
--
-2. 「プラットフォームの追加」をクリックします。
-3. 「Javaプラットフォームの追加」ウィザードの「プラットフォーム・タイプを選択」で、「Java ME CLDCプラットフォーム・エミュレータ」を選択し、「次」をクリックします。
+
+[start=2]
+. 「プラットフォームの追加」をクリックします。
+
+[start=3]
+. 「Javaプラットフォームの追加」ウィザードの「プラットフォーム・タイプを選択」で、「Java ME CLDCプラットフォーム・エミュレータ」を選択し、「次」をクリックします。
IDEに、「プラットフォームを検索するディレクトリを選択してください」ダイアログ・ボックスが表示されます。
-4. Java ME SDKプラットフォームをインストールしたディレクトリ( ``C:\Java_ME_Platform_SDK_3.2`` など)を選択し、「開く」をクリックします。
-5. 「Javaプラットフォームの追加」ウィザードの「プラットフォームのフォルダ」パネルで、前の手順で選択したプラットフォームが選択されていることを確認し、「次」をクリックします。
-6. IDEがプラットフォームを検出したらすぐに、「Javaプラットフォームの追加」ウィザードの「検出されたプラットフォーム」パネルで「終了」をクリックします。
+
+[start=4]
+. Java ME SDKプラットフォームをインストールしたディレクトリ( ``C:\Java_ME_Platform_SDK_3.2`` など)を選択し、「開く」をクリックします。
+
+[start=5]
+. 「Javaプラットフォームの追加」ウィザードの「プラットフォームのフォルダ」パネルで、前の手順で選択したプラットフォームが選択されていることを確認し、「次」をクリックします。
+
+[start=6]
+. IDEがプラットフォームを検出したらすぐに、「Javaプラットフォームの追加」ウィザードの「検出されたプラットフォーム」パネルで「終了」をクリックします。
[.feature]
--
@@ -119,7 +137,9 @@
image::images/jpregistered-small.png[role="left", link="images/jpregistered.png"]
--
-7. 「Javaプラットフォーム・マネージャ」ダイアログ・ボックスで、「閉じる」をクリックします。
+
+[start=7]
+. 「Javaプラットフォーム・マネージャ」ダイアログ・ボックスで、「閉じる」をクリックします。
これで、NetBeans IDEがモバイル開発用に設定されます。
@@ -130,17 +150,27 @@
1. 「ファイル」>「新規プロジェクト」を選択します。
「新規プロジェクト」ダイアログ・ボックスが表示されます。
-2. 「Java ME」カテゴリと「埋込みアプリケーション」プロジェクトを選択します。「次」をクリックします。
-3. 新規埋込みアプリケーション・ウィザードの「名前と場所」パネルで、プロジェクト名として「 ``EmbeddedApp`` 」を指定します。
+
+[start=2]
+. 「Java ME」カテゴリと「埋込みアプリケーション」プロジェクトを選択します。「次」をクリックします。
+
+[start=3]
+. 新規埋込みアプリケーション・ウィザードの「名前と場所」パネルで、プロジェクト名として「 ``EmbeddedApp`` 」を指定します。
[.feature]
--
image::images/newappname-small.png[role="left", link="images/newappname.png"]
--
-4. 「デフォルト・パッケージとIMletクラスの作成」オプションは選択したままにし、「次」をクリックします。
-5. CLDC Oracle Java(TM) Platform Micro Edition SDKがエミュレータ・プラットフォームとして選択され、IMPNGPhone1がデバイスとして選択されていることを確認します。
-6. 「終了」をクリックします。
+
+[start=4]
+. 「デフォルト・パッケージとIMletクラスの作成」オプションは選択したままにし、「次」をクリックします。
+
+[start=5]
+. CLDC Oracle Java(TM) Platform Micro Edition SDKがエミュレータ・プラットフォームとして選択され、IMPNGPhone1がデバイスとして選択されていることを確認します。
+
+[start=6]
+. 「終了」をクリックします。
IMP-NGアプリケーションとIMLetが標準IDEプロジェクトに作成されます。
image::images/prjcreated.png[]
@@ -154,8 +184,12 @@
1. 「プロジェクト」ウィンドウで、「 ``IMlet.java`` 」ファイルをダブルクリックし、「編集」を選択します。
IDEによって、 ``IMlet.java`` ファイルがソース・エディタに開かれます。
-2. ソース・コードをスクロールし、 ``StartApp`` メソッドを探します。
-3. ``StartApp`` メソッドの本体に、次の太字の行を挿入します。
+
+[start=2]
+. ソース・コードをスクロールし、 ``StartApp`` メソッドを探します。
+
+[start=3]
+. ``StartApp`` メソッドの本体に、次の太字の行を挿入します。
[source,java]
----
@@ -164,7 +198,9 @@
*System.out.println("Hello, world!");*
}
----
-4. IDEのメイン・メニューから「ファイル」→「保存」を選択して、編集内容を保存します。
+
+[start=4]
+. IDEのメイン・メニューから「ファイル」→「保存」を選択して、編集内容を保存します。
これでアプリケーションが作成され、次の説明に従ってIDEでアプリケーションを実行できます。
@@ -173,7 +209,9 @@
*注意:* 「出力」ウィンドウが表示されない場合は、IDEのメイン・メニューから「ウィンドウ」→「出力」→「出力」を選択します。
-2. IDEのメニュー・バーから、「実行」→「プロジェクトの実行」を選択します。
+
+[start=2]
+. IDEのメニュー・バーから、「実行」→「プロジェクトの実行」を選択します。
IMPNGPhone1エミュレータが起動し、実行されているEmbeddedAppアプリケーションが表示されます。
[.feature]
@@ -190,11 +228,17 @@
image::images/output-small.png[role="left", link="images/output.png"]
--
-3. エミュレータで、「 ``Embedded App (running)`` 」を選択し、右側の「一時停止」をクリックします。
+
+[start=3]
+. エミュレータで、「 ``Embedded App (running)`` 」を選択し、右側の「一時停止」をクリックします。
アプリケーションが一時停止します。
-4. 「再開」をクリックします。
+
+[start=4]
+. 「再開」をクリックします。
アプリケーションの実行が再開します。
-5. アプリケーションを停止し、エミュレータを終了するには、「停止」をクリックし、エミュレータのメニューから「アプリケーション」→「終了」を選択します。
+
+[start=5]
+. アプリケーションを停止し、エミュレータを終了するには、「停止」をクリックし、エミュレータのメニューから「アプリケーション」→「終了」を選択します。
IDEで実行プロセスが終了します。
<<top,先頭>>
@@ -224,10 +268,18 @@
image::images/available-plugins-small.png[role="left", link="images/available-plugins.png"]
--
-4. 「インストール」をクリックします。
-5. 「インストーラ」ダイアログ・ボックスの「ようこそ」ページで「次」をクリックします。
-6. 「ライセンス契約」ページで、プラグインに関連するライセンス契約を読みます。ライセンス契約のすべての条件に同意する場合は、該当するオプションをクリックしてから「インストール」をクリックします。
-7. インストール・プロセスが完了したら、「今すぐIDEを再起動」オプションを選択したままにして「終了」をクリックします。
+
+[start=4]
+. 「インストール」をクリックします。
+
+[start=5]
+. 「インストーラ」ダイアログ・ボックスの「ようこそ」ページで「次」をクリックします。
+
+[start=6]
+. 「ライセンス契約」ページで、プラグインに関連するライセンス契約を読みます。ライセンス契約のすべての条件に同意する場合は、該当するオプションをクリックしてから「インストール」をクリックします。
+
+[start=7]
+. インストール・プロセスが完了したら、「今すぐIDEを再起動」オプションを選択したままにして「終了」をクリックします。
NetBeans IDEの再起動後に、IDEを使用したモバイル埋込みアプリケーションのプロファイリングを開始できます。
@@ -241,12 +293,22 @@
image::images/enable-small.png[role="left", link="images/enable.png"]
--
-3. (プロジェクトの初回プロファイリングに適用)「プロファイリングの有効化」ダイアログ・ボックスで、「はい」をクリックして統合を実行します。
-4. 「プロファイル」ダイアログ・ボックスで、CPUプロファイラを選択し、オプションでプロファイル・システム・クラスをチェックします。
-5. 「実行」をクリックします。
+
+[start=3]
+. (プロジェクトの初回プロファイリングに適用)「プロファイリングの有効化」ダイアログ・ボックスで、「はい」をクリックして統合を実行します。
+
+[start=4]
+. 「プロファイル」ダイアログ・ボックスで、CPUプロファイラを選択し、オプションでプロファイル・システム・クラスをチェックします。
+
+[start=5]
+. 「実行」をクリックします。
`EmbeddedApp`アプリケーションが実行されたエミュレータが開きます。
-6. アプリケーションと対話します。
-7. アプリケーションを終了するか、エミュレータを閉じます。
+
+[start=6]
+. アプリケーションと対話します。
+
+[start=7]
+. アプリケーションを終了するか、エミュレータを閉じます。
IDEにより、「`cpu:_time_`」ウィンドウにプロファイル・データが表示されます。
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_pt_BR.asciidoc
index 4279823..8e7f3e7 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_pt_BR.asciidoc
@@ -79,16 +79,24 @@
image::images/plugins-small.png[role="left", link="images/plugins.png"]
--
-3. Clique em Ativar.
-4. No painel de Boas-vindas da caixa de diálogo do Instalador, clique em Ativar.
+
+[start=3]
+. Clique em Ativar.
+
+[start=4]
+. No painel de Boas-vindas da caixa de diálogo do Instalador, clique em Ativar.
[.feature]
--
image::images/installer-small.png[role="left", link="images/installer.png"]
--
-5. Quando a ativação foi concluída com êxito, clique em Finalizar.
-6. Clique em Fechar para fechar a caixa de diálogo Plug-ins.
+
+[start=5]
+. Quando a ativação foi concluída com êxito, clique em Finalizar.
+
+[start=6]
+. Clique em Fechar para fechar a caixa de diálogo Plug-ins.
*Para instalar a plataforma Oracle Java ME Embedded:*
@@ -100,12 +108,22 @@
image::images/jpmanager-small.png[role="left", link="images/jpmanager.png"]
--
-2. Clique em Adicionar Plataforma.
-3. Em Selecionar Tipo de Plataforma do assistente Adicionar Plataforma Java, selecione Java ME CLDC Platform Emulator e clique em Próximo.
+
+[start=2]
+. Clique em Adicionar Plataforma.
+
+[start=3]
+. Em Selecionar Tipo de Plataforma do assistente Adicionar Plataforma Java, selecione Java ME CLDC Platform Emulator e clique em Próximo.
O IDE exibirá o diretório Escolher para a pesquisa de caixa de diálogo das plataformas.
-4. Selecione o diretório em que você instalou a Plataforma Java ME SDK (por exemplo, ``C:\Java_ME_Platform_SDK_3.2`` ) e clique em Abrir.
-5. No painel Pastas da Plataforma do assistente Adicionar Plataforma Java, verifique se a plataforma selecionada na etapa anterior foi escolhida e clique em Próximo.
-6. Assim que o IDE detectar a plataforma, clique em Finalizar no painel Plataformas Detectadas do assistente Adicionar Plataforma Java.
+
+[start=4]
+. Selecione o diretório em que você instalou a Plataforma Java ME SDK (por exemplo, ``C:\Java_ME_Platform_SDK_3.2`` ) e clique em Abrir.
+
+[start=5]
+. No painel Pastas da Plataforma do assistente Adicionar Plataforma Java, verifique se a plataforma selecionada na etapa anterior foi escolhida e clique em Próximo.
+
+[start=6]
+. Assim que o IDE detectar a plataforma, clique em Finalizar no painel Plataformas Detectadas do assistente Adicionar Plataforma Java.
[.feature]
--
@@ -119,7 +137,9 @@
image::images/jpregistered-small.png[role="left", link="images/jpregistered.png"]
--
-7. Na caixa de diálogo Gerenciador de Plataformas Java, clique em Fechar.
+
+[start=7]
+. Na caixa de diálogo Gerenciador de Plataformas Java, clique em Fechar.
Agora, seu NetBeans IDE está configurado para o desenvolvimento móvel.
@@ -130,17 +150,27 @@
1. Escolha Arquivo > Novo Projeto.
A caixa de diálogo Novo Projeto é exibida.
-2. Selecione a categoria de Java ME e o projeto da Aplicação Incorporada. Clique em Próximo.
-3. No painel Nome e Local do assistente Nova Aplicação Incorporada, especifique ``EmbeddedApp`` como nome do projeto.
+
+[start=2]
+. Selecione a categoria de Java ME e o projeto da Aplicação Incorporada. Clique em Próximo.
+
+[start=3]
+. No painel Nome e Local do assistente Nova Aplicação Incorporada, especifique ``EmbeddedApp`` como nome do projeto.
[.feature]
--
image::images/newappname-small.png[role="left", link="images/newappname.png"]
--
-4. Deixe a opção Criar Pacote Default e Classe de IMlet selecionada e clique em Próximo.
-5. Verifique se CLDC Oracle Java(TM) Platform Micro Edition SDK está selecionado na plataforma do emulador e se IMPNGPhone1 está selecionado como dispositivo.
-6. Clique em Finalizar.
+
+[start=4]
+. Deixe a opção Criar Pacote Default e Classe de IMlet selecionada e clique em Próximo.
+
+[start=5]
+. Verifique se CLDC Oracle Java(TM) Platform Micro Edition SDK está selecionado na plataforma do emulador e se IMPNGPhone1 está selecionado como dispositivo.
+
+[start=6]
+. Clique em Finalizar.
Uma aplicação IMP-NG com um IMLet será criado em um projeto IDE padrão.
image::images/prjcreated.png[]
@@ -154,8 +184,12 @@
1. Na janela Projetos, clique duas vezes no arquivo ``IMlet.java`` e escolha Editar.
O IDE abrirá o arquivo ``IMlet.java`` no Editor de Código-fonte.
-2. Role a tela pelo código-fonte e localize o método ``StartApp`` principal.
-3. Insira a seguinte linha em negrito no corpo do método ``StartApp`` :
+
+[start=2]
+. Role a tela pelo código-fonte e localize o método ``StartApp`` principal.
+
+[start=3]
+. Insira a seguinte linha em negrito no corpo do método ``StartApp`` :
[source,java]
----
@@ -164,7 +198,9 @@
*System.out.println("Hello, world!");*
}
----
-4. Escolha Arquivo > Salvar no menu principal do IDE para salvar as edições.
+
+[start=4]
+. Escolha Arquivo > Salvar no menu principal do IDE para salvar as edições.
Agora que você criou a aplicação, pode executá-la no IDE conforme descrito a seguir:
@@ -173,7 +209,9 @@
*Observação:* Escolha Janela > Saída > Saída no menu principal do IDE, caso a janela de Saída não esteja visível.
-2. Na barra de menu IDE, escolha Executar > Executar Projeto.
+
+[start=2]
+. Na barra de menu IDE, escolha Executar > Executar Projeto.
O emulador IMPNGPhone1 é iniciado e exibe a aplicação EmbeddedApp em execução.
[.feature]
@@ -190,11 +228,17 @@
image::images/output-small.png[role="left", link="images/output.png"]
--
-3. No emulador, selecione ``Aplicação Incorporada (em execução)`` e clique em Suspender, à direita.
+
+[start=3]
+. No emulador, selecione ``Aplicação Incorporada (em execução)`` e clique em Suspender, à direita.
A aplicação está pausada.
-4. Clique em Retomar.
+
+[start=4]
+. Clique em Retomar.
A aplicação retoma a execução.
-5. Para interromper a aplicação e fechar o emulador, clique em Interromper e escolha Aplicação > Sair do menu do emulador.
+
+[start=5]
+. Para interromper a aplicação e fechar o emulador, clique em Interromper e escolha Aplicação > Sair do menu do emulador.
O processo de execução é encerrado no IDE.
<<top,início>>
@@ -224,10 +268,18 @@
image::images/available-plugins-small.png[role="left", link="images/available-plugins.png"]
--
-4. Clique em Instalar.
-5. Pelo a página de Boas-vindas da caixa de diálogo do Instalador, clique em Próximo.
-6. Na página Contrato de Licença, leias os contratos associados ao plug-in. Se você concordar com os todos os termos da licença do contrato, clique na opção apropriada e, em seguida, clique em Instalar.
-7. Quando o processo de instalação for concluído, deixe a opção Reiniciar IDE agora selecionada e clique em Finalizar.
+
+[start=4]
+. Clique em Instalar.
+
+[start=5]
+. Pelo a página de Boas-vindas da caixa de diálogo do Instalador, clique em Próximo.
+
+[start=6]
+. Na página Contrato de Licença, leias os contratos associados ao plug-in. Se você concordar com os todos os termos da licença do contrato, clique na opção apropriada e, em seguida, clique em Instalar.
+
+[start=7]
+. Quando o processo de instalação for concluído, deixe a opção Reiniciar IDE agora selecionada e clique em Finalizar.
Quando o NetBeans IDE for selecionado, você poderá iniciar o uso do IDE para criar perfil na sua aplicação incorporada móvel.
@@ -241,12 +293,22 @@
image::images/enable-small.png[role="left", link="images/enable.png"]
--
-3. (Aplicável se essa for a primeira vez que um perfil é criado no projeto) Na caixa de diálogo Ativar Criação de Perfil, clique em Sim para executar a integração.
-4. Na caixa de diálogo Perfil, escolha Criador de Perfil de CPU e, opcionalmente, marque Classes de Sistema do Perfil.
-5. Clique em Executar.
+
+[start=3]
+. (Aplicável se essa for a primeira vez que um perfil é criado no projeto) Na caixa de diálogo Ativar Criação de Perfil, clique em Sim para executar a integração.
+
+[start=4]
+. Na caixa de diálogo Perfil, escolha Criador de Perfil de CPU e, opcionalmente, marque Classes de Sistema do Perfil.
+
+[start=5]
+. Clique em Executar.
O emulador é aberto com a aplicação `EmbeddedApp` em execução.
-6. Interaja com a aplicação.
-7. Saia da aplicação ou feche o emulador.
+
+[start=6]
+. Interaja com a aplicação.
+
+[start=7]
+. Saia da aplicação ou feche o emulador.
O IDE exibirá os dados de perfil na janela `cpu:_time_`.
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ru.asciidoc
index 1926d24..b27e049 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_ru.asciidoc
@@ -79,16 +79,24 @@
image::images/plugins-small.png[role="left", link="images/plugins.png"]
--
-3. Нажмите кнопку 'Активировать'.
-4. На панели приветствия в диалоговом окне программы установки нажмите кнопку 'Активировать'.
+
+[start=3]
+. Нажмите кнопку 'Активировать'.
+
+[start=4]
+. На панели приветствия в диалоговом окне программы установки нажмите кнопку 'Активировать'.
[.feature]
--
image::images/installer-small.png[role="left", link="images/installer.png"]
--
-5. После успешного завершения активации нажмите кнопку 'Готово'.
-6. Нажмите кнопку 'Закрыть', чтобы закрыть диалоговое окно 'Подключаемые модули'.
+
+[start=5]
+. После успешного завершения активации нажмите кнопку 'Готово'.
+
+[start=6]
+. Нажмите кнопку 'Закрыть', чтобы закрыть диалоговое окно 'Подключаемые модули'.
*Для установки встроенной платформы Oracle Java ME:*
@@ -100,12 +108,22 @@
image::images/jpmanager-small.png[role="left", link="images/jpmanager.png"]
--
-2. Нажмите 'Добавить платформу'.
-3. В окне 'Выбор типа платформы' мастера платформ Java выберите эмулятор платформы Java ME CLDC и нажмите кнопку 'Далее'.
+
+[start=2]
+. Нажмите 'Добавить платформу'.
+
+[start=3]
+. В окне 'Выбор типа платформы' мастера платформ Java выберите эмулятор платформы Java ME CLDC и нажмите кнопку 'Далее'.
В IDE отображается каталог 'Выбор' для поиска диалогового окна платформ.
-4. Выберите каталог, в который выполнена установка платформы Java ME SDK (например, ``C:\Java_ME_Platform_SDK_3.2`` ), и нажмите 'Открыть'.
-5. На панели 'Папки платформы' мастера добавления платформ Java убедитесь, что выделенная на предыдущем шаге платформа выбрана и щелкните 'Далее'.
-6. Как только IDE определит платформу, нажмите кнопку 'Готово' на панели 'Обнаруженные платформы' мастера добавления платформ Java.
+
+[start=4]
+. Выберите каталог, в который выполнена установка платформы Java ME SDK (например, ``C:\Java_ME_Platform_SDK_3.2`` ), и нажмите 'Открыть'.
+
+[start=5]
+. На панели 'Папки платформы' мастера добавления платформ Java убедитесь, что выделенная на предыдущем шаге платформа выбрана и щелкните 'Далее'.
+
+[start=6]
+. Как только IDE определит платформу, нажмите кнопку 'Готово' на панели 'Обнаруженные платформы' мастера добавления платформ Java.
[.feature]
--
@@ -119,7 +137,9 @@
image::images/jpregistered-small.png[role="left", link="images/jpregistered.png"]
--
-7. В диалоговом окне диспетчера платформ Java нажмите кнопку 'Закрыть'.
+
+[start=7]
+. В диалоговом окне диспетчера платформ Java нажмите кнопку 'Закрыть'.
Теперь среда IDE NetBeans настроена для мобильной разработки.
@@ -130,17 +150,27 @@
1. Выберите команду "Файл" > "Новый проект".
Отображается диалоговое окно 'Новый проект'.
-2. Выберите категорию Java ME и проект 'Встроенное приложение'. Нажмите кнопку 'Далее'.
-3. На панели 'Имя и местоположение' мастера создания встроенных приложений укажите ``EmbeddedApp`` в качестве имени проекта.
+
+[start=2]
+. Выберите категорию Java ME и проект 'Встроенное приложение'. Нажмите кнопку 'Далее'.
+
+[start=3]
+. На панели 'Имя и местоположение' мастера создания встроенных приложений укажите ``EmbeddedApp`` в качестве имени проекта.
[.feature]
--
image::images/newappname-small.png[role="left", link="images/newappname.png"]
--
-4. Не снимайте флажки 'Оставьте созданный пакет по умолчанию' и 'Параметр класса IMlet' и нажмите кнопку 'Далее'.
-5. Убедитесь, что в качестве платформы эмулятора выбран CLDC Oracle Java (TM) Platform Micro Edition SDK, а в качестве устройства - IMPNGPhone1.
-6. Нажмите кнопку 'Готово'.
+
+[start=4]
+. Не снимайте флажки 'Оставьте созданный пакет по умолчанию' и 'Параметр класса IMlet' и нажмите кнопку 'Далее'.
+
+[start=5]
+. Убедитесь, что в качестве платформы эмулятора выбран CLDC Oracle Java (TM) Platform Micro Edition SDK, а в качестве устройства - IMPNGPhone1.
+
+[start=6]
+. Нажмите кнопку 'Готово'.
Приложение IMP-NG с IMlet создается в стандартном проекте IDE.
image::images/prjcreated.png[]
@@ -154,8 +184,12 @@
1. В окне 'Проекты' дважды щелкните файл ``IMlet.java`` и выберите 'Правка'.
В IDE откроется файл ``IMlet.java`` в редакторе исходного кода.
-2. Просмотрите исходный код и найти метод ``StartApp`` .
-3. Вставьте следующую строку полужирным шрифтом в теле метода ``StartApp`` :
+
+[start=2]
+. Просмотрите исходный код и найти метод ``StartApp`` .
+
+[start=3]
+. Вставьте следующую строку полужирным шрифтом в теле метода ``StartApp`` :
[source,java]
----
@@ -164,7 +198,9 @@
*System.out.println("Hello, world!");*
}
----
-4. Выберите 'Файл' > 'Сохранить' в главном меню IDE, чтобы сохранить изменения.
+
+[start=4]
+. Выберите 'Файл' > 'Сохранить' в главном меню IDE, чтобы сохранить изменения.
Теперь, когда создано приложение, можно запустить приложение в IDE, как описано ниже:
@@ -173,7 +209,9 @@
*Примечание.* Выберите 'Окно'> 'Выходные данные' > 'Выход из главного меню IDE', если окно 'Выходные данные' не отображается.
-2. На панели меню IDE выберите 'Выполнить'> 'Выполнить проект'.
+
+[start=2]
+. На панели меню IDE выберите 'Выполнить'> 'Выполнить проект'.
Эмулятор IMPNGPhone1 запускается, и на нем отображается запущенное приложение EmbeddedApp.
[.feature]
@@ -190,11 +228,17 @@
image::images/output-small.png[role="left", link="images/output.png"]
--
-3. В эмуляторе выберите ``Встроенные приложения (запущено)`` и выберите 'Приостановить' справа.
+
+[start=3]
+. В эмуляторе выберите ``Встроенные приложения (запущено)`` и выберите 'Приостановить' справа.
Приложение приостановлено.
-4. Нажмите кнопку 'Возобновить'.
+
+[start=4]
+. Нажмите кнопку 'Возобновить'.
Приложение возобновило работу.
-5. Чтобы остановить приложение и закрыть эмулятор, нажмите кнопку 'Стоп' и выберите 'Приложение' > 'Выход' в меню эмулятора.
+
+[start=5]
+. Чтобы остановить приложение и закрыть эмулятор, нажмите кнопку 'Стоп' и выберите 'Приложение' > 'Выход' в меню эмулятора.
Процесс выполнения завершается в IDE.
<<top,В начало>>
@@ -224,10 +268,18 @@
image::images/available-plugins-small.png[role="left", link="images/available-plugins.png"]
--
-4. Нажмите кнопку 'Установить'.
-5. На странице "Добро пожаловать" диалогового окна программы установки нажмите кнопку "Далее".
-6. На странице "Лицензионное соглашение" ознакомьтесь с лицензионным соглашением, связанным с подключаемым модулем. При принятии всех условий лицензионного соглашения щелкните соответствующий параметр и щелкните 'Установить'.
-7. Когда процесс установки завершится, не снимайте флажок 'Перезапустить IDE сейчас' и нажмите кнопку 'Готово'.
+
+[start=4]
+. Нажмите кнопку 'Установить'.
+
+[start=5]
+. На странице "Добро пожаловать" диалогового окна программы установки нажмите кнопку "Далее".
+
+[start=6]
+. На странице "Лицензионное соглашение" ознакомьтесь с лицензионным соглашением, связанным с подключаемым модулем. При принятии всех условий лицензионного соглашения щелкните соответствующий параметр и щелкните 'Установить'.
+
+[start=7]
+. Когда процесс установки завершится, не снимайте флажок 'Перезапустить IDE сейчас' и нажмите кнопку 'Готово'.
После перезапуска IDE NetBeans можно использовать функции IDE для профилирования встроенных мобильных приложений.
@@ -241,12 +293,22 @@
image::images/enable-small.png[role="left", link="images/enable.png"]
--
-3. (Применимо, если это первое профилирование проекта) в диалоговом окне 'Включить профилирование' нажмите 'Да', чтобы выполнить интеграцию.
-4. В диалоговом окне 'Профиль', выберите профилировщик ЦП, и при необходимости проверьте системные классы профилей.
-5. Нажмите кнопку 'Выполнить'.
+
+[start=3]
+. (Применимо, если это первое профилирование проекта) в диалоговом окне 'Включить профилирование' нажмите 'Да', чтобы выполнить интеграцию.
+
+[start=4]
+. В диалоговом окне 'Профиль', выберите профилировщик ЦП, и при необходимости проверьте системные классы профилей.
+
+[start=5]
+. Нажмите кнопку 'Выполнить'.
Эмулятор открывается с запущенным приложением `EmbeddedApp`.
-6. Взаимодействие с приложением.
-7. Выход из приложения или закрытие эмулятора.
+
+[start=6]
+. Взаимодействие с приложением.
+
+[start=7]
+. Выход из приложения или закрытие эмулятора.
IDE отображает данные профиля в окне `ЦП:_время_`.
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_zh_CN.asciidoc
index 2abc380..28cf21f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/imp-ng_zh_CN.asciidoc
@@ -79,16 +79,24 @@
image::images/plugins-small.png[role="left", link="images/plugins.png"]
--
-3. 单击 "Activate"(激活)。
-4. 在 "Installer"(安装程序)对话框的 "Welcome"(欢迎使用)面板上,单击 "Activate"(激活)。
+
+[start=3]
+. 单击 "Activate"(激活)。
+
+[start=4]
+. 在 "Installer"(安装程序)对话框的 "Welcome"(欢迎使用)面板上,单击 "Activate"(激活)。
[.feature]
--
image::images/installer-small.png[role="left", link="images/installer.png"]
--
-5. 在成功完成激活过程后,单击 "Finish"(完成)。
-6. 单击 "Close"(关闭)以关闭 "Plugins"(插件)对话框。
+
+[start=5]
+. 在成功完成激活过程后,单击 "Finish"(完成)。
+
+[start=6]
+. 单击 "Close"(关闭)以关闭 "Plugins"(插件)对话框。
*安装 Oracle Java ME Embedded 平台:*
@@ -100,12 +108,22 @@
image::images/jpmanager-small.png[role="left", link="images/jpmanager.png"]
--
-2. 单击 "Add Platform"(添加平台)。
-3. 在 "Add Java Platform"(添加 Java 平台)向导的 "Select Platform Type"(选择平台类型)中,选择 "Java ME CLDC Platform Emulator"(Java ME CLDC 平台仿真器)并单击 "Next"(下一步)。
+
+[start=2]
+. 单击 "Add Platform"(添加平台)。
+
+[start=3]
+. 在 "Add Java Platform"(添加 Java 平台)向导的 "Select Platform Type"(选择平台类型)中,选择 "Java ME CLDC Platform Emulator"(Java ME CLDC 平台仿真器)并单击 "Next"(下一步)。
IDE 随即会显示 "Choose directory to search for platforms"(选择要在其中搜索平台的目录)对话框。
-4. 选择要在其中安装 Java ME SDK 平台的目录(例如, ``C:\Java_ME_Platform_SDK_3.2`` ),然后单击 "Open"(打开)。
-5. 在 "Add Java Platform"(添加 Java 平台)向导的 "Platform Folders"(平台文件夹)面板中,确保选择上一步骤中的所选平台,然后单击 "Next"(下一步)。
-6. 在 IDE 检测到平台之后,请立即在 "Add Java Platform"(添加 Java 平台)向导的 "Detected Platforms"(已检测到平台)面板中单击 "Finish"(完成)。
+
+[start=4]
+. 选择要在其中安装 Java ME SDK 平台的目录(例如, ``C:\Java_ME_Platform_SDK_3.2`` ),然后单击 "Open"(打开)。
+
+[start=5]
+. 在 "Add Java Platform"(添加 Java 平台)向导的 "Platform Folders"(平台文件夹)面板中,确保选择上一步骤中的所选平台,然后单击 "Next"(下一步)。
+
+[start=6]
+. 在 IDE 检测到平台之后,请立即在 "Add Java Platform"(添加 Java 平台)向导的 "Detected Platforms"(已检测到平台)面板中单击 "Finish"(完成)。
[.feature]
--
@@ -119,7 +137,9 @@
image::images/jpregistered-small.png[role="left", link="images/jpregistered.png"]
--
-7. 在 "Java Platform Manager"(Java 平台管理器)对话框中,单击 "Close"(关闭)。
+
+[start=7]
+. 在 "Java Platform Manager"(Java 平台管理器)对话框中,单击 "Close"(关闭)。
现在您已设置 NetBeans IDE,可以进行 Mobile 开发了。
@@ -130,17 +150,27 @@
1. 选择 "File"(文件)> "New Project"(新建项目)。
此时将显示 "New Project"(新建项目)对话框。
-2. 选择 "Java ME" 类别,然后选择 "Embedded Application"(嵌入式应用程序)项目。单击 "Next"(下一步)。
-3. 在 "New Embedded Application"(新建嵌入式应用程序)向导的 "Name and Location"(名称和位置)面板中,指定 ``EmbeddedApp`` 作为项目名称。
+
+[start=2]
+. 选择 "Java ME" 类别,然后选择 "Embedded Application"(嵌入式应用程序)项目。单击 "Next"(下一步)。
+
+[start=3]
+. 在 "New Embedded Application"(新建嵌入式应用程序)向导的 "Name and Location"(名称和位置)面板中,指定 ``EmbeddedApp`` 作为项目名称。
[.feature]
--
image::images/newappname-small.png[role="left", link="images/newappname.png"]
--
-4. 保持选中 "Create Default Package and IMlet Class"(创建默认包和 IMlet 类)选项,然后单击 "Next"(下一步)。
-5. 确保选择 "CLDC Oracle Java(TM) Platform Micro Edition SDK" 作为仿真器平台,并选择 "IMPNGPhone1" 作为设备。
-6. 单击 "Finish"(完成)。
+
+[start=4]
+. 保持选中 "Create Default Package and IMlet Class"(创建默认包和 IMlet 类)选项,然后单击 "Next"(下一步)。
+
+[start=5]
+. 确保选择 "CLDC Oracle Java(TM) Platform Micro Edition SDK" 作为仿真器平台,并选择 "IMPNGPhone1" 作为设备。
+
+[start=6]
+. 单击 "Finish"(完成)。
此时将在标准 IDE 项目中创建一个具有 IMLet 的 IMP-NG 应用程序。
image::images/prjcreated.png[]
@@ -154,8 +184,12 @@
1. 在 "Projects"(项目)窗口中,双击 ``IMlet.java`` 文件并选择 "Edit"(编辑)。
IDE 随即会在源代码编辑器中打开 ``IMlet.java`` 文件。
-2. 滚动查看源代码并查找 ``StartApp`` 方法。
-3. 在 ``StartApp`` 方法的主体中插入以下用粗体显示的行:
+
+[start=2]
+. 滚动查看源代码并查找 ``StartApp`` 方法。
+
+[start=3]
+. 在 ``StartApp`` 方法的主体中插入以下用粗体显示的行:
[source,java]
----
@@ -164,7 +198,9 @@
*System.out.println("Hello, world!");*
}
----
-4. 从 IDE 主菜单中选择 "File"(文件)> "Save"(保存)以保存所做的编辑。
+
+[start=4]
+. 从 IDE 主菜单中选择 "File"(文件)> "Save"(保存)以保存所做的编辑。
现在您已创建应用程序,您可以按照下述方法在 IDE 中运行该应用程序:
@@ -173,7 +209,9 @@
*注:*如果 "Output"(输出)窗口不可见,请从 IDE 主菜单中选择 "Window"(窗口)> "Output"(输出)> "Output"(输出)。
-2. 从 IDE 菜单栏中,选择 "Run"(运行)> "Run Project"(运行项目)。
+
+[start=2]
+. 从 IDE 菜单栏中,选择 "Run"(运行)> "Run Project"(运行项目)。
IMPNGPhone1 仿真器随即启动并显示 EmbeddedApp 应用程序正在运行。
[.feature]
@@ -190,11 +228,17 @@
image::images/output-small.png[role="left", link="images/output.png"]
--
-3. 在仿真器中,选择 ``Embedded App (running)`` 并单击右侧的 "Suspend"(挂起)。
+
+[start=3]
+. 在仿真器中,选择 ``Embedded App (running)`` 并单击右侧的 "Suspend"(挂起)。
此时将暂停应用程序。
-4. 单击 "Resume"(恢复)。
+
+[start=4]
+. 单击 "Resume"(恢复)。
此时将恢复运行应用程序。
-5. 要停止应用程序并关闭仿真器,请单击 "Stop"(停止)并从仿真器菜单中选择 "Application"(应用程序)> "Exit"(退出)。
+
+[start=5]
+. 要停止应用程序并关闭仿真器,请单击 "Stop"(停止)并从仿真器菜单中选择 "Application"(应用程序)> "Exit"(退出)。
此运行进程随即在 IDE 中终止。
<<top,返回页首>>
@@ -224,10 +268,18 @@
image::images/available-plugins-small.png[role="left", link="images/available-plugins.png"]
--
-4. 单击 "Install"(安装)。
-5. 在 "Installer"(安装程序)对话框的欢迎页,单击 "Next"(下一步)。
-6. 在 "License Agreement"(许可证协议)页上,阅读与该插件相关的许可证协议。如果您同意所有许可证协议条款,请单击适当的选项,然后单击 "Install"(安装)。
-7. 安装过程完成后,保持选中 "Restart IDE now"(立即重新启动 IDE)选项并单击 "Finish"(完成)。
+
+[start=4]
+. 单击 "Install"(安装)。
+
+[start=5]
+. 在 "Installer"(安装程序)对话框的欢迎页,单击 "Next"(下一步)。
+
+[start=6]
+. 在 "License Agreement"(许可证协议)页上,阅读与该插件相关的许可证协议。如果您同意所有许可证协议条款,请单击适当的选项,然后单击 "Install"(安装)。
+
+[start=7]
+. 安装过程完成后,保持选中 "Restart IDE now"(立即重新启动 IDE)选项并单击 "Finish"(完成)。
在重新启动 NetBeans IDE 之后,您即可开始使用 IDE 对您的 Mobile 嵌入式应用程序进行性能分析。
@@ -241,12 +293,22 @@
image::images/enable-small.png[role="left", link="images/enable.png"]
--
-3. (适用于首次对项目进行性能分析)在 "Enable Profiling"(启用性能分析)对话框中,单击 "Yes"(是)执行集成。
-4. 在 "Profile"(分析)对话框中,选择 "CPU Profiler"(CPU 分析器),并选择性地选中 "Profile System Classes"(分析系统类)。
-5. 单击 "Run"(运行)。
+
+[start=3]
+. (适用于首次对项目进行性能分析)在 "Enable Profiling"(启用性能分析)对话框中,单击 "Yes"(是)执行集成。
+
+[start=4]
+. 在 "Profile"(分析)对话框中,选择 "CPU Profiler"(CPU 分析器),并选择性地选中 "Profile System Classes"(分析系统类)。
+
+[start=5]
+. 单击 "Run"(运行)。
此时将打开仿真器,并显示正在运行的 `EmbeddedApp` 应用程序。
-6. 与应用程序交互。
-7. 退出应用程序或关闭仿真器。
+
+[start=6]
+. 与应用程序交互。
+
+[start=7]
+. 退出应用程序或关闭仿真器。
IDE 会在 `cpu:_时间_`窗口中显示分析数据。
[.feature]
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/java-card.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/java-card.asciidoc
index 23cecf9..8f49afa 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/java-card.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/java-card.asciidoc
@@ -39,17 +39,6 @@
*Extended*::: For newer, more powerful smart cards—this is new in Java Card 3.0. It supports a much more complete implementation of the Java Platform. Probably the coolest thing about it is native support for Servlets—you can actually write a web application using familiar APIs, which runs on a smart card!
-=== Contents
-
-* <<reqs,Required Software and Hardware>>
-* <<setup,Getting the Project Environment Set Up>>
-* <<types,Understanding Java Card Project Types>>
-* <<projects,Working With a Project>>
-* <<special,Using Special Plugin Features>>
-* <<sdk,Integrating Third-Party SDKs>>
-* <<related,Related Links>>
-
-
== Requirements
*To complete this tutorial, you need the following software and resources:*
@@ -86,7 +75,9 @@
image::images/install-javacard-plugins.png[]
-4. You need to to restart the IDE after installing the plugins to continue the tutorial steps that follow.
+
+[start=4]
+. You need to to restart the IDE after installing the plugins to continue the tutorial steps that follow.
=== Registering the Java Card Platform
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/java-card_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/java-card_ja.asciidoc
index 5b292b1..8d6d6ed 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/java-card_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/java-card_ja.asciidoc
@@ -39,16 +39,6 @@
*拡張*::: 強力な新しいスマート・カード用で、Java Card 3.0での新しいエディションです。これは、Javaプラットフォームのより完璧な実装をサポートしています。サーブレットがネイティブでサポートされる最大の利点は、使い慣れたAPIを使用してWebアプリケーションを作成して、そのアプリケーションをスマート・カード上で実行できることです。
-=== 内容
-
-* <<reqs,必要なソフトウェアとハードウェア>>
-* <<setup,プロジェクト環境設定の開始>>
-* <<types,Java Cardのプロジェクト・タイプの理解>>
-* <<projects,プロジェクトでの作業>>
-* <<special,特殊なプラグイン機能の使用>>
-* <<sdk,サードパーティSDKの統合>>
-* <<related,関連リンク>>
-
== 要件
@@ -86,7 +76,9 @@
image::images/install-javacard-plugins.png[]
-4. チュートリアルの手順を続けるには、プラグインのインストール後にIDEを再起動する必要があります。
+
+[start=4]
+. チュートリアルの手順を続けるには、プラグインのインストール後にIDEを再起動する必要があります。
=== Java Cardプラットフォームの登録
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/java-card_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/java-card_pt_BR.asciidoc
index 5e9729d..4459654 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/java-card_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/java-card_pt_BR.asciidoc
@@ -78,7 +78,9 @@
image::images/install-javacard-plugins.png[]
-4. É necessário reiniciar o IDE após a instalação dos plug-ins para continuar as etapas do tutorial a seguir.
+
+[start=4]
+. É necessário reiniciar o IDE após a instalação dos plug-ins para continuar as etapas do tutorial a seguir.
=== Registrando a Plataforma do Java Card
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/java-card_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/java-card_ru.asciidoc
index 8f3fde1..270e71f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/java-card_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/java-card_ru.asciidoc
@@ -78,7 +78,9 @@
image::images/install-javacard-plugins.png[]
-4. После установки подключаемого модуля требуется перезапустить среду IDE, а затем продолжить выполнение учебного курса.
+
+[start=4]
+. После установки подключаемого модуля требуется перезапустить среду IDE, а затем продолжить выполнение учебного курса.
=== Регистрация платформы Java Card
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/java-card_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/java-card_zh_CN.asciidoc
index 4f9ae13..2c9bedb 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/java-card_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/java-card_zh_CN.asciidoc
@@ -78,7 +78,9 @@
image::images/install-javacard-plugins.png[]
-4. 安装插件后,需要重新启动 IDE 才能继续执行下面的教程步骤。
+
+[start=4]
+. 安装插件后,需要重新启动 IDE 才能继续执行下面的教程步骤。
=== 注册 Java Card 平台
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/javacard.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/javacard.asciidoc
index f72d8cf..06980be 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/javacard.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/javacard.asciidoc
@@ -39,17 +39,6 @@
*Extended*::: For newer, more powerful smart cards—this is new in Java Card 3.0. It supports a much more complete implementation of the Java Platform. Probably the coolest thing about it is native support for Servlets—you can actually write a web application using familiar APIs, which runs on a smart card!
-=== Contents
-
-* <<reqs,Required Software and Hardware>>
-* <<setup,Getting the Project Environment Set Up>>
-* <<types,Understanding Java Card Project Types>>
-* <<projects,Working With a Project>>
-* <<special,Using Special Plugin Features>>
-* <<sdk,Integrating Third-Party SDKs>>
-* <<related,Related Links>>
-
-
== Requirements
*To complete this tutorial, you need the following software and resources:*
@@ -86,7 +75,9 @@
image::images/install-javacard-plugins.png[]
-4. You need to to restart the IDE after installing the plugins to continue the tutorial steps that follow.
+
+[start=4]
+. You need to to restart the IDE after installing the plugins to continue the tutorial steps that follow.
=== Registering the Java Card Platform
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/javacard_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/javacard_ja.asciidoc
index 8ed9187..6f685d2 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/javacard_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/javacard_ja.asciidoc
@@ -39,16 +39,6 @@
*拡張*::: 強力な新しいスマート・カード用で、Java Card 3.0での新しいエディションです。これは、Javaプラットフォームのより完璧な実装をサポートしています。サーブレットがネイティブでサポートされる最大の利点は、使い慣れたAPIを使用してWebアプリケーションを作成して、そのアプリケーションをスマート・カード上で実行できることです。
-=== 内容
-
-* <<reqs,必要なソフトウェアとハードウェア>>
-* <<setup,プロジェクト環境設定の開始>>
-* <<types,Java Cardのプロジェクト・タイプの理解>>
-* <<projects,プロジェクトでの作業>>
-* <<special,特殊なプラグイン機能の使用>>
-* <<sdk,サードパーティSDKの統合>>
-* <<related,関連リンク>>
-
== 要件
@@ -86,7 +76,9 @@
image::images/install-javacard-plugins.png[]
-4. チュートリアルの手順を続けるには、プラグインのインストール後にIDEを再起動する必要があります。
+
+[start=4]
+. チュートリアルの手順を続けるには、プラグインのインストール後にIDEを再起動する必要があります。
=== Java Cardプラットフォームの登録
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/javacard_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/javacard_pt_BR.asciidoc
index 182c26f..58a529f 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/javacard_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/javacard_pt_BR.asciidoc
@@ -78,7 +78,9 @@
image::images/install-javacard-plugins.png[]
-4. É necessário reiniciar o IDE após a instalação dos plug-ins para continuar as etapas do tutorial a seguir.
+
+[start=4]
+. É necessário reiniciar o IDE após a instalação dos plug-ins para continuar as etapas do tutorial a seguir.
=== Registrando a Plataforma do Java Card
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/javacard_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/javacard_ru.asciidoc
index 114e14a..c1da3f8 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/javacard_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/javacard_ru.asciidoc
@@ -78,7 +78,9 @@
image::images/install-javacard-plugins.png[]
-4. После установки подключаемого модуля требуется перезапустить среду IDE, а затем продолжить выполнение учебного курса.
+
+[start=4]
+. После установки подключаемого модуля требуется перезапустить среду IDE, а затем продолжить выполнение учебного курса.
=== Регистрация платформы Java Card
diff --git a/netbeans.apache.org/src/content/kb/docs/javame/javacard_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/javame/javacard_zh_CN.asciidoc
index 9598c67..a95b15e 100644
--- a/netbeans.apache.org/src/content/kb/docs/javame/javacard_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/javame/javacard_zh_CN.asciidoc
@@ -78,7 +78,9 @@
image::images/install-javacard-plugins.png[]
-4. 安装插件后,需要重新启动 IDE 才能继续执行下面的教程步骤。
+
+[start=4]
+. 安装插件后,需要重新启动 IDE 才能继续执行下面的教程步骤。
=== 注册 Java Card 平台
diff --git a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart.asciidoc
index 48f13c1..499d129 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart.asciidoc
@@ -82,7 +82,7 @@
image::images/php-name-location.png[title="New PHP Project wizard - Name and Location panel"]
-[start=3]
+
. In Step 3: Run Configuration, specify how you want to deploy your application. If you have set up your PHP development environment by configuring an *AMP package, you should select *Local Web Site* from the drop-down list, and specify the URL of the project, as it will appear in a browser.
. Select the Copy files from Sources Folder to another location option. Then, in the Copy to Folder field, type in the path to the deployment location on the server. (On Apache, this is the default `htdocs` directory.)
@@ -91,7 +91,7 @@
image::images/php-run-config.png[role="left", link="images/php-run-config.png"]
--
-[start=5]
+
. Click *Finish*. The IDE creates the project folder in your file system and the project opens in the IDE.
You can also use the Project wizard to add framework support to your project (provided in Step 4 of the wizard).
@@ -100,7 +100,7 @@
image::images/php-proj-win.png[title="Projects window displays MyAjaxApp project"]
-[start=6]
+
. Before beginning to code, quickly try running the application to ensure that configuration between the IDE, your server, and browser is set up properly.
In the IDE's editor, add an `echo` statement to the index page:
@@ -115,7 +115,7 @@
----
-[start=7]
+
. In the Projects window, right-click on the project node and choose Run. The IDE opens your default browser and displays the Hello World message you just created in `index.php`.
NOTE: If you have difficulty setting up your project or establishing communication between the IDE, the server and browser, see link:project-setup.html[+Setting Up a PHP Project+] for a more thorough description. The link:../../trails/php.html[+PHP Learning Trail+] can provide more information on configuring your environment.
@@ -157,7 +157,7 @@
----
-[start=4]
+
. Add some explanatory text to describe the purpose of the text field. You can copy and paste in the following text at a point just beneath the `<h1>` tags:
[source,html]
@@ -172,7 +172,7 @@
----
-[start=5]
+
. Add an HTML form to the page. You can do this by making use of the elements listed in the IDE's Palette. If the Palette is not open, choose Window > Palette from the main menu. Then, under HTML Forms, click on and drag a Form element into the page to a point beneath the `<p>` tags that you just added. The Insert Form dialog box opens. Specify the following:
* Action: autocomplete.php
@@ -184,7 +184,7 @@
Click OK. The HTML `<form>` tags are inserted into the page containing the attributes you specified. (GET is applied by default, and so is not explicitly declared.)
-[start=6]
+
. Add an HTML table to the page. Under the HTML category in the Palette, click on a Table element and drag it to a point between the `<form>` tags. The Insert Table dialog box opens. Specify the following:
* Rows: 2
@@ -196,7 +196,7 @@
image::images/insert-table.png[title="Insert table dialog"]
-[start=7]
+
. Right-click inside the Source Editor and choose Format. This tidies up the code. Your form should now display similar to that below:
[source,html]
@@ -225,7 +225,7 @@
----
-[start=8]
+
. Within the first row of the table, type the following text into the first column (changes in *bold*):
[source,html]
@@ -234,7 +234,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=9]
+
. Within the second column of the first row, instead of dragging a Text Input field from the Palette, type in the code below manually.
[source,html]
@@ -250,15 +250,15 @@
image:images/code-completion.png[title="Ctrl-Space triggers code completion in the Source Editor"]
The `onkeyup` attribute that you typed in above points to a JavaScript function named `doCompletion()`. This function is called each time a key is pressed in the form text field, and maps to the JavaScript call depicted in the Ajax <<flow-diagram,flow diagram>> above.
-[start=10]
+
. Before moving on to work in the JavaScript editor, make the new `index.html` file replace the `index.php` file as the entry point for the application.
To do so, right-click the project node in the Projects window and choose Properties. Select the *Run Configuration* category, then enter `index.html` in the Index File field. image:images/php-entry-point.png[title="Specify the application's entry point in the Project Properties window"]
-[start=11]
+
. Click OK to save changes and exit the Project Properties window.
-[start=12]
+
. Run the project to see what it looks like in a browser. Click the Run Project ( image:images/run-project-btn.png[] ) button. The `index.html` file displays in your default browser.
image:images/index-page.png[title="Run project to view its current state in browser"]
@@ -315,7 +315,7 @@
The above code performs a simple browser compatibility check for Firefox 3 and Internet Explorer versions 6 and 7). If you would like to incorporate more robust code for compatibility issues, consider using this link:http://www.quirksmode.org/js/detect.html[+browser detect script+] from link:http://www.quirksmode.org[+http://www.quirksmode.org+].
-[start=4]
+
. Switch back to `index.html` and add a reference to the JavaScript file between the `<head>` tags.
[source,html]
@@ -328,7 +328,7 @@
You can quickly toggle between pages opened in the editor by pressing Ctrl-Tab.
-[start=5]
+
. Insert a call to `init()` in the opening `<body>` tag.
[source,html]
@@ -443,7 +443,7 @@
}
----
-[start=4]
+
. In the editor, paste in the following code within the class (changes in *bold*).
[source,php]
@@ -530,10 +530,10 @@
1. In the Projects window, click the `index.php` file node. The file name becomes editable, enabling you to modify the name.
image:images/edit-file-name.png[title="Click on file nodes to edit names"]
-[start=2]
+
. Name the file `autocomplete`, then click Enter. Double-click the new `autocomplete.php` file to have it display in the editor.
-[start=3]
+
. Replace the file's existing code with the following script.
[source,php]
@@ -708,7 +708,7 @@
This new row, which can be identified as '`auto-row`', serves as a handle for the JavaScript code in order to insert a new HTML table that will form the auto-complete box.
-[start=2]
+
. Open `javascript.js` in the editor and the following three variables to the top of the file.
[source,java]
@@ -719,7 +719,7 @@
var autoRow;
----
-[start=3]
+
. Add the following lines (in *bold*) to the `init()` function.
[source,java]
@@ -747,7 +747,7 @@
</tr>
----
-[start=4]
+
. Add `appendComposer()` to `javascript.js`.
[source,java]
@@ -782,7 +782,7 @@
----
This function creates a new table row, inserts a link to a composer into it using the data passed to the function via its three parameters, and inserts the row into the index page's `complete-table` element.
-[start=5]
+
. Add `clearTable()` to `javascript.js`.
[source,java]
@@ -799,7 +799,7 @@
----
This function sets the display of the `complete-table` element to 'none', (i.e., makes it invisible), and it removes any existing composer name entries that were created.
-[start=6]
+
. Add `getElementY()` to `javascript.js`.
[source,java]
@@ -824,7 +824,7 @@
NOTE: See link:http://www.quirksmode.org/js/findpos.html[+this explanation+] of `offset` on link:http://www.quirksmode.org/[+http://www.quirksmode.org/+].
-[start=7]
+
. Modify the `callback()` function to call `clearTable()` each time new data is received from the server. Any composer entries that already exist in the auto-complete box are therefore removed before it becomes populated with new entries.
[source,java]
@@ -842,7 +842,7 @@
}
----
-[start=8]
+
. Add `parseMessages()` to `javascript.js`.
[source,java]
@@ -984,7 +984,7 @@
Perform a check on the validity of your CSS code by right-clicking in the CSS Editor and choosing Check CSS. Any errors encountered are displayed in the Output window (Windows > Output).
-[start=5]
+
. Switch to the `index.html` page in the editor (press Ctrl-Tab), and add a reference to the stylesheet between the `<head>` tags.
[source,java]
@@ -994,7 +994,7 @@
----
-[start=6]
+
. Run the application again. The index page displays in the browser using the stylesheet you just created. Each time you type in a character, an asynchronous request is sent to the server, and returned with XML data that has been prepared by `autocomplete.php`. As you enter more characters, the number of composer names decreases to reflect the new list of matches.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ja.asciidoc
index f5b17cb..8babd69 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ja.asciidoc
@@ -92,17 +92,17 @@
image::images/php-name-location.png[title="新規PHPプロジェクト・ウィザード - 「名前と場所」パネル"]
-[start=3]
+
. ステップ3の「実行構成」で、アプリケーションのデプロイ方法を指定します。*AMPパッケージを構成してPHP開発環境を設定した場合は、ドロップダウン・リストから「*ローカルWebサイト*」を選択し、ブラウザに表示するプロジェクトのURLを指定します。
-[start=4]
+
. 「ファイルをソース・フォルダから別の場所にコピー」オプションを選択します。次に、「フォルダにコピー」フィールドに、サーバー上のデプロイ先のパスを入力します。(Apacheでは、デフォルトの`htdocs`ディレクトリを使用します。)
[.feature]
--
image:images/php-run-config.png[role="left", link="images/php-run-config.png"]
--
-[start=5]
+
. 「*終了*」をクリックします。IDEによってプロジェクト・フォルダがファイル・システム内に作成され、プロジェクトがIDEで開きます。
プロジェクト・ウィザードを使用して、 フレームワークのサポートをプロジェクトに追加することもできます(ウィザードのステップ4)。
@@ -111,7 +111,7 @@
image::images/php-proj-win.png[title="MyAjaxAppプロジェクトが表示された「プロジェクト」ウィンドウ"]
-[start=6]
+
. コーディングを始める前に、アプリケーションを実行してみて、IDE、サーバー、ブラウザの間の構成が正しく設定されていることを確認します。
IDEのエディタで、indexページに次の`echo`文を追加します。
@@ -126,7 +126,7 @@
----
-[start=7]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」を選択します。IDEによってデフォルトのブラウザが開き、`index.php`で作成したメッセージ「Hello World」が表示されます。
*注意:* プロジェクトを設定できない場合、またはIDE、サーバー、およびブラウザ間で通信を確立できない場合は、link:project-setup.html[+PHPプロジェクトの設定+]を参照して、詳細な手順を確認してください。環境の構成については、link:../../trails/php.html[+PHPの学習+]を参照してください。
@@ -168,7 +168,7 @@
----
-[start=4]
+
. テキスト・フィールドの目的を説明するテキストを追加します。次のテキストをコピーして、`<h1>`タグのすぐ下に貼り付けることもできます。
[source,html]
@@ -183,7 +183,7 @@
----
-[start=5]
+
. ページにHTMLフォームを追加します。この操作を行うには、IDEのパレットに表示されている要素を使用します。パレットが開いていない場合は、メイン・メニューから「ウィンドウ」>「パレット」を選択します。次に「HTMLフォーム」の下にある「フォーム」要素をクリックし、ページ内に追加した`<p>`タグの下までドラッグします。「挿入フォーム」ダイアログ・ボックスが表示されます。次の値を指定します。
* アクション: autocomplete.php
@@ -195,7 +195,7 @@
「OK」をクリックします。指定した属性を含むHTMLの`<form>`タグがページに挿入されます。(GETはデフォルトで適用されるので、明示的に宣言しません。)
-[start=6]
+
. HTML表をページに追加します。パレットの「HTML」カテゴリの下で「表」要素をクリックし、`<form>`タグの間の位置までドラッグします。「挿入表」ダイアログ・ボックスが開きます。次の値を指定します。
* 行: 2
@@ -207,7 +207,7 @@
image::images/insert-table.png[title="「挿入表」ダイアログ"]
-[start=7]
+
. ソース・エディタ内を右クリックし、「フォーマット」を選択します。これでコードの体裁が整います。フォームは次のようになります。
[source,html]
@@ -236,7 +236,7 @@
----
-[start=8]
+
. 表の1行目の1列目に次のテキストを入力します(*太字*部分が変更箇所)。
[source,html]
@@ -245,7 +245,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=9]
+
. 1行目の2列目では、パレットから「テキスト入力」フィールドをドラッグしないで、次のコードを手動で入力します。
[source,html]
@@ -261,15 +261,15 @@
image:images/code-completion.png[title="[Ctrl]-[Space]を押してソース・エディタでトリガーされたコード補完"]
入力した`onkeyup`属性はJavaScript関数`doCompletion()`を指しています。この関数は、フォームのテキスト・フィールド内でキーが押されるたびにコールされ、Ajaxの<<flow-diagram,フロー図>>に示したJavaScriptコールに対応します。
-[start=10]
+
. JavaScriptエディタでの作業に移る前に、アプリケーションのエントリ・ポイントとして`index.php`ファイルを新しい`index.html`ファイルに置き換えます。
これを行うには、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「プロパティ」を選択します。「*実行構成*」カテゴリを選択し、「開始ファイル」フィールドに「`index.html`」と入力します。image:images/php-entry-point.png[title="「プロジェクト・プロパティ」ウィンドウで、アプリケーションのエントリ・ポイントを指定します。"]
-[start=11]
+
. 「OK」をクリックして変更を保存し、「プロジェクト・プロパティ」ウィンドウを終了します。
-[start=12]
+
. プロジェクトを実行して、ブラウザでどのように表示されるかを確認します。「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックします。`index.html`ファイルがデフォルトのブラウザに表示されます。
image:images/index-page.png[title="プロジェクトを実行してブラウザに現在の状態を表示"]
@@ -326,7 +326,7 @@
上のコードは、Firefox 3およびInternet Explorerバージョン6と7の単純なブラウザ互換性チェックを行います。互換性の問題に対してさらに堅牢なコードを取り込むには、link:http://www.quirksmode.org[+http://www.quirksmode.org+]のlink:http://www.quirksmode.org/js/detect.html[+ブラウザ検出スクリプト+]を使用することを検討してください。
-[start=4]
+
. `index.html`に戻り、JavaScriptファイルへの参照を`<head>`タグの間に追加します。
[source,html]
@@ -339,7 +339,7 @@
[Ctrl]-[Tab]を押すと、エディタ内で開いているページを簡単に切り替えることができます。
-[start=5]
+
. `init()`へのコールを開始`<body>`タグ内に挿入します。
[source,html]
@@ -454,7 +454,7 @@
}
----
-[start=4]
+
. エディタで、次のコードをクラス内に貼り付けます(変更箇所は*太字*で表示)。
[source,php]
@@ -542,7 +542,7 @@
image::images/edit-file-name.png[title="ファイル・ノードをクリックして名前を編集"]
-[start=2]
+
. ファイル名を`autocomplete`にし、[Enter]を押します。新しい`autocomplete.php`ファイルをダブルクリックし、エディタに表示します。
. このファイルの既存のコードを次のスクリプトに置き換えます。
@@ -717,7 +717,7 @@
----
この新しい行は「`auto-row`」として識別でき、オートコンプリート・ボックスを形成する新しいHTML表を挿入するための、JavaScriptコード用のハンドルの役割を果たします。
-[start=2]
+
. `javascript.js`をエディタで開き、次の3つの変数をファイルの先頭に追加します。
[source,java]
@@ -728,7 +728,7 @@
var autoRow;
----
-[start=3]
+
. 次の*太字*の行を`init()`関数に追加します。
[source,java]
@@ -756,7 +756,7 @@
</tr>
----
-[start=4]
+
. `appendComposer()`を`javascript.js`に追加します。
[source,java]
@@ -791,7 +791,7 @@
----
この関数は、表の新しい行を作成し、3つのパラメータによって関数に渡されたデータを使用して作曲家へのリンクを挿入してから、行をindexページの`complete-table`要素に挿入します。
-[start=5]
+
. `clearTable()`を`javascript.js`に追加します。
[source,java]
@@ -808,7 +808,7 @@
----
この関数は`complete-table`要素の表示を'none'に設定し(非表示にし)、作成された既存の作曲家の名前エントリを除去します。
-[start=6]
+
. `getElementY()`を`javascript.js`に追加します。
[source,java]
@@ -834,7 +834,7 @@
*注意: *link:http://www.quirksmode.org/[+http://www.quirksmode.org/+]にある`offset`に関するlink:http://www.quirksmode.org/js/findpos.html[+説明+]を参照してください。
-[start=7]
+
. `callback()`関数を変更して、サーバーから新しいデータを受け取るたびに`clearTable()`をコールするようにします。オートコンプリート・ボックスに作曲家のエントリがある場合は、新しいエントリが入力される前に除去されます。
[source,java]
@@ -852,7 +852,7 @@
}
----
-[start=8]
+
. `parseMessages()`を`javascript.js`に追加します。
[source,java]
@@ -995,7 +995,7 @@
CSSエディタ内を右クリックして「CSSの確認」を選択し、CSSコードの妥当性のチェックを実行します。エラーがあった場合は「出力」ウィンドウ(「ウィンドウ」>「出力」)に表示されます。
-[start=5]
+
. エディタで`index.html`ページに切り替え([Ctrl]-[Tab]を押します)、`<head>`タグの間にスタイル・シートへの参照を追加します。
[source,java]
@@ -1005,7 +1005,7 @@
----
-[start=6]
+
. アプリケーションをもう一度実行します。インデックス・ページが、作成したスタイル・シートを使用してブラウザに表示されます。文字を入力するたびに非同期のリクエストがサーバーに送信され、`autocomplete.php`によって作成されたXMLデータが返されます。さらに文字を入力すると、新しい一致リストを反映して作曲家の名前の数が減ります。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_pt_BR.asciidoc
index 2195e73..ecc0a27 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_pt_BR.asciidoc
@@ -89,10 +89,10 @@
image:images/php-name-location.png[title="Assistente Novo Projeto PHP: painel Nome e Localização"]
-[start=3]
+
. Na etapa 3: Configuração de Execução, especifique como você deseja implantar a aplicação. Se tiver definido o ambiente de desenvolvimento do PHP configurando um pacote *AMP, deverá selecionar *Local Web Site* na lista drop-down e especificar o URL do projeto, como ele aparecerá em um browser.
-[start=4]
+
. Selecione a opção Copiar arquivos da Pasta de Códigos-Fonte para outra localização. Em seguida, no campo Copiar para Pasta, digite o caminho para o local de implantação no servidor. (No Apache, é o diretório `htdocs` default.)
[.feature]
@@ -101,7 +101,7 @@
--
-[start=5]
+
. Clique em *Finalizar*. O IDE criará a pasta do projeto em seu sistema de arquivos e o projeto será aberto no IDE.
Você também pode utilizar o assistente Projeto para adicionar suporte ao framework para o projeto (fornecido na Etapa 4 do assistente).
@@ -111,7 +111,7 @@
image::images/php-proj-win.png[title="A janela Projetos exibe o projeto MyAjaxApp"]
-[start=6]
+
. Antes de começar a codificar, tente rapidamente executar a aplicação para garantir que a configuração entre o IDE, seu servidor e o browser esteja configurada corretamente.
No editor do IDE, adicione uma instrução `echo` à página de índice:
@@ -126,7 +126,7 @@
----
-[start=7]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Executar. O IDE abrirá o browser default e exibirá a mensagem Olá Mundo que você acabou de criar em `index.php`.
NOTE: se tiver dificuldade em configurar o projeto ou estabelecer comunicação entre o IDE, o servidor e o browser, consulte link:project-setup.html[+Configurando um Projeto PHP+] para obter uma descrição mais aprofundada. A link:../../trails/php.html[+Trilha de Aprendizado do PHP+] pode oferecer mais informações sobre como configurar o ambiente.
@@ -168,7 +168,7 @@
----
-[start=4]
+
. Adicione algum texto explicativo para descrever a finalidade do campo de texto. Você pode copiar e colar no texto a seguir, no ponto logo abaixo das tags `<h1>`:
[source,html]
@@ -183,7 +183,7 @@
----
-[start=5]
+
. Adicione um form HTML à página. Faça isso utilizando os elementos listados na Paleta do IDE. Se a Paleta não estiver aberta, selecione Janela > Paleta no menu principal. Em seguida, em Forms HTML, clique e arraste um elemento Form para a página, um ponto abaixo das tags `<p>` que você acabou de adicionar. A caixa de diálogo Inserir Form será aberta. Especifique o seguinte:
* Ação: autocomplete.php
@@ -195,7 +195,7 @@
Clique em OK. As tags HTML `<form>` serão inseridas na página que contém os atributos especificados. (GET é aplicado por default e, portanto, não é declarado explicitamente.)
-[start=6]
+
. Adicione uma tabela HTML à página. Na categoria HTML na Paleta, clique em um elemento Tabela e arraste-o para um ponto entre as tags `<form>`. A caixa de diálogo Inserir Tabela será aberta. Especifique o seguinte:
* Linhas: 2
@@ -208,7 +208,7 @@
image::images/insert-table.png[title="Caixa de diálogo Inserir tabela"]
-[start=7]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte e selecione Formatar. Isso limpa o código. Seu form agora deve ser semelhante ao abaixo:
[source,html]
@@ -237,7 +237,7 @@
----
-[start=8]
+
. Na primeira linha da tabela, digite o seguinte texto na primeira coluna (alterações em *negrito*):
[source,html]
@@ -246,7 +246,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=9]
+
. Na segunda coluna da primeira linha, em vez de arrastar um campo Entrada de Texto da Paleta, digite o código abaixo manualmente.
[source,html]
@@ -262,15 +262,15 @@
image:images/code-completion.png[title="Ctrl-Espaço aciona a função autocompletar código no Editor de Código-Fonte"]
O atributo `onkeyup` que você digitou acima aponta para uma função JavaScript chamada `doCompletion()`. Essa função é chamada toda vez que uma tecla é pressionada no campo de texto do form, e mapeia para a chamada JavaScript representada no <<flow-diagram,fluxograma>> do Ajax acima.
-[start=10]
+
. Antes de prosseguir para trabalhar no editor JavaScript, faça com que o novo arquivo `index.html` substitua o arquivo `index.php` como ponto de entrada da aplicação.
Para fazê-lo, clique com o botão direito do mouse no nó do projeto na janela Projetos e selecione Propriedades. Selecione a categoria *Configuração de Execução* e, em seguida, digite `index.html` no campo Arquivo de Índice. image:images/php-entry-point.png[title="Especificar o ponto de entrada da aplicação na janela Propriedades do Projeto"]
-[start=11]
+
. Clique em OK para salvar as alterações e sair da janela Propriedades do Projeto.
-[start=12]
+
. Execute o projeto para ver como ele é em um browser. Clique no botão Executar Projeto (image:images/run-project-btn.png[]). O arquivo `index.html` será exibido no browser default.
image:images/index-page.png[title="Executar projeto para exibir seu status atual no browser"]
@@ -328,7 +328,7 @@
O código acima executa um verificação simples de compatibilidade do browser para o Firefox 3 e para o Internet Explorer versões 6 e 7). Se desejar incorporar um código mais robusto para problemas de compatibilidade, considere usar este link:http://www.quirksmode.org/js/detect.html[+script de detecção de browser+] disponível em link:http://www.quirksmode.org[+http://www.quirksmode.org+].
-[start=4]
+
. Volte para `index.html` e adicione uma referência ao arquivo JavaScript entre as tags `<head>`.
[source,html]
@@ -341,7 +341,7 @@
Você pode alternar rapidamente entre as páginas abertas no editor pressionando Ctrl-Tab.
-[start=5]
+
. Insira uma chamada a `init()` na tag de abertura `<body>`.
[source,html]
@@ -456,7 +456,7 @@
}
----
-[start=4]
+
. No editor, cole no código a seguir dentro da classe (alterações em *negrito*).
[source,php]
@@ -542,8 +542,12 @@
1. Na janela Projetos, clique no nó de arquivo `index.php`. O nome do arquivo se tornará editável, permitindo modificar o nome.
image:images/edit-file-name.png[title="Clique nos nós dos arquivos para editar os nomes"]
-2. Nomeie o arquivo `autocomplete` e, em seguida, clique em Entrar. Clique duas vezes no novo arquivo `autocomplete.php` para que ele seja exibido no editor.
-3. Substitua o código existente do arquivo pelo script a seguir.
+
+[start=2]
+. Nomeie o arquivo `autocomplete` e, em seguida, clique em Entrar. Clique duas vezes no novo arquivo `autocomplete.php` para que ele seja exibido no editor.
+
+[start=3]
+. Substitua o código existente do arquivo pelo script a seguir.
[source,php]
----
@@ -716,7 +720,7 @@
----
Essa nova linha, que pode ser identificada como "`auto-row`", funciona como um handler para o código JavaScript cujo objetivo é inserir uma nova tabela HTML que formará a caixa da funcionalidade autocompletar.
-[start=2]
+
. Abra `javascript.js` no editor e as três variáveis a seguir na parte superior do arquivo.
[source,java]
@@ -727,7 +731,7 @@
var autoRow;
----
-[start=3]
+
. Adicione as seguintes linhas (em *negrito*) na função `init()`.
[source,java]
@@ -755,7 +759,7 @@
</tr>
----
-[start=4]
+
. Adicione `appendComposer()` a `javascript.js`.
[source,java]
@@ -790,7 +794,7 @@
----
Essa função cria uma nova linha da tabela, insere um link em um criador utilizando os dados passados para a função por meio de seus três parâmetros e insere a linha no elemento `complete-table` da página de índice.
-[start=5]
+
. Adicione `clearTable()` a `javascript.js`.
[source,java]
@@ -807,7 +811,7 @@
----
Essa função define a exibição do elemento `complete-table` como "none" (ou seja, o torna invisível) e remove quaisquer entradas de nome de criador existentes que tenham sido criadas.
-[start=6]
+
. Adicione `getElementY()` a `javascript.js`.
[source,java]
@@ -833,7 +837,7 @@
NOTE: Consulte link:http://www.quirksmode.org/js/findpos.html[+esta explicação+] de `offset` em link:http://www.quirksmode.org/[+http://www.quirksmode.org/+].
-[start=7]
+
. Modifique a função `callback()` para que chame `clearTable()` cada vez que novos dados forem recebidos do servidor. Quaisquer entradas do criador que já existam na caixa autocompletar serão, portanto, removidas, antes que esta seja preenchida com novas entradas.
[source,java]
@@ -851,7 +855,7 @@
}
----
-[start=8]
+
. Adicione `parseMessages()` a `javascript.js`.
[source,java]
@@ -994,7 +998,7 @@
Execute uma verificação da validade do seu código CSS, clicando com o botão direito do mouse no Editor CSS e selecionando Verificar CSS. Quaisquer erros encontrados são exibidos na janela de Saída (Janelas > Saída).
-[start=5]
+
. Alterne para a página `index.html` no editor (pressione Ctrl-Tab) e adicione uma referência à folha de estilo entre as tags `<head>`.
[source,java]
@@ -1004,7 +1008,7 @@
----
-[start=6]
+
. Execute a aplicação novamente. A página de índice é exibida no browser utilizando a folha de estilo recém-criada. Toda vez que você digita um caractere, uma solicitação assíncrona é enviada para o servidor e retornada com dados XML que foram preparados por `autocomplete.php`. Conforme você digita mais caracteres, o número de nomes de criador diminui para refletir a nova lista de correspondências.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ru.asciidoc
index 41bc13f..33f4cfd 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_ru.asciidoc
@@ -92,17 +92,17 @@
image::images/php-name-location.png[title="Мастер создания проектов PHP - панель 'Имя и местоположение'"]
-[start=3]
+
. На третьем экране "Настройки выполнения" укажите способ развертывания приложения. Если среда разработки PHP формировалась путем настройки пакета *AMP, необходимо выбрать в раскрывающемся списке пункт *Локальный веб-сайт* и указать URL-адрес проекта, который должен использоваться в браузере.
-[start=4]
+
. Выберите параметр "Скопировать файлы из папки источников в другое расположение". Затем в поле "Скопировать в папку" введите путь к местоположению для развертывания на сервере. На сервере Apache по умолчанию используется каталог `htdocs`.
[.feature]
--
image::images/php-run-config.png[role="left", link="images/php-run-config.png"]
--
-[start=5]
+
. Нажмите кнопку *Готово*. Среда IDE создает папку проекта в файловой системе, после чего этот проект открывается в среде IDE.
Также можно использовать мастер проектов для добавления в проект платформенной поддержки (предоставляется в действии 4 мастера проектов)
@@ -111,7 +111,7 @@
image::images/php-proj-win.png[title="В окне 'Проекты' отображается проект MyAjaxApp"]
-[start=6]
+
. Перед написанием программы попробуйте запустить приложение в целях проверки правильности настройки взаимосвязи между средой IDE, сервером и браузером.
В редакторе среды IDE добавьте оператор `echo` к начальной странице:
@@ -126,7 +126,7 @@
----
-[start=7]
+
. В окне "Проекты" щелкните правой кнопкой мыши узел проекта и выберите команду "Выполнить". В среде IDE открывается браузер по умолчанию, и на экране появляется сообщение "Hello World", только что созданное в `index.php`.
NOTE: При возникновении ошибок при настройке проекта или создании соединения между IDE, сервером и браузером более детальное описание см. в разделе link:project-setup.html[+Настройка проекта PHP+]. Дополнительные сведения относительно настройки среды содержатся в link:../../trails/php.html[+учебной карте PHP+].
@@ -168,7 +168,7 @@
----
-[start=4]
+
. Для описания назначения текстового поля следует добавить соответствующий пояснительный текст. Непосредственно под тегами `<h1>` можно скопировать и вставить следующий текст:
[source,html]
@@ -183,7 +183,7 @@
----
-[start=5]
+
. Добавьте к странице форму HTML. Для этого можно использовать элементы, содержащиеся в палитре среды IDE. Если палитра не открыта, выберите в главном меню "Окно" > "Палитра". Затем перейдите к узлу "Формы HTML", выберите элемент "Форма" и перетащите его на страницу под только что добавленные теги `<p>`. Появится диалоговое окно "Вставить форму". Введите следующее:
* Action: response.jsp;
@@ -195,7 +195,7 @@
Нажмите кнопку "ОК". Теги HTML `<form>` вставляются в страницу, содержащую указанные атрибуты. (Метод GET применяется по умолчанию, и, следовательно, не объявляется явно).
-[start=6]
+
. Добавьте к странице таблицу HTML. В категории палитры "HTML" выберите элемент "Таблица" и перетащите его непосредственно под теги `<form>`. Откроется диалоговое окно "Вставить таблицу". Введите следующее:
* Рядов : 2
@@ -208,7 +208,7 @@
image::images/insert-table.png[title="Диалоговое окно 'Вставить таблицу'"]
-[start=7]
+
. Щелкните правой кнопкой мыши редактор исходного кода и выберите команду "Форматировать". Последует выравнивание кода. Теперь форма должна выглядеть следующим образом:
[source,html]
@@ -237,7 +237,7 @@
----
-[start=8]
+
. В первый столбец первой строки таблицы введите следующий текст (изменения выделены *полужирным шрифтом*):
[source,html]
@@ -246,7 +246,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=9]
+
. Во второй столбец первой строки вручную введите указанный ниже код (вместо перетаскивания поля "Ввод текста" из окна "Палитра").
[source,html]
@@ -262,15 +262,15 @@
image:images/code-completion.png[title="Нажатие Ctrl-Space инициирует автозавершение кода в редакторе исходного кода"]
Атрибут `onkeyup`, введенный выше, указывает на функцию JavaScript с именем `doCompletion()`. Эта функция вызывается при каждом нажатии клавиши в текстовом поле формы и соответствует вызову JavaScript на приведенной выше <<flow-diagram,блок-схеме>> Ajax.
-[start=10]
+
. Перед переходом к работе с редактором JavaScript, замените файлом `index.html` файл `index.php` в качестве точки входа приложения.
Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите команду "Свойства". Выберите категорию *Конфигурация выполнения*, затем введите `index.html` в поле 'Файл индекса'. image:images/php-entry-point.png[title="Укажите точку входа приложения в окне 'Свойства проекта'"]
-[start=11]
+
. Нажмите кнопку "ОК" для подтверждения изменений и закройте окно "Свойства проекта".
-[start=12]
+
. Выполните проект и посмотрите, как он выглядит в браузере. Нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ). Файл `index.html` открывается в браузере по умолчанию.
image::images/index-page.png[title="Выполните проект для просмотра его текущего состояния в браузере"]
@@ -328,7 +328,7 @@
С помощью этого кода выполняется простая проверка совместимости веб-браузеров Firefox 3 и Internet Explorer версий 6 и 7). Если требуется добавить более надежный код, устраняющий ошибки совместимости, используйте link:http://www.quirksmode.org/js/detect.html[+сценарий для определения браузера+] с веб-сайта link:http://www.quirksmode.org[+http://www.quirksmode.org+].
-[start=4]
+
. Вернитесь к `index.php` и добавьте справочную информацию в файл JavaScript между тегами `<head>`.
[source,html]
@@ -341,7 +341,7 @@
Для быстрого перехода между страницами, открытыми в редакторе, можно воспользоваться сочетанием клавиш CTRL+TAB.
-[start=5]
+
. Вставьте вызов `init()` после открывающего тега `<body>`.
[source,html]
@@ -456,7 +456,7 @@
}
----
-[start=4]
+
. Вставьте в класс в редакторе следующий код (изменения выделены *полужирным шрифтом*).
[source,php]
@@ -545,10 +545,10 @@
image::images/edit-file-name.png[title="Щелкните узлы файлов для редактирования имен"]
-[start=2]
+
. Назовите файл `autocomplete` и нажмите ENTER. Дважды щелкните файл `autocomplete.php`, чтобы открыть его в редакторе.
-[start=3]
+
. Замените код файла на следующий.
[source,php]
@@ -722,7 +722,7 @@
----
Эта строка с идентификатором "`auto-row`" служит меткой для кода JavaScript, который вставляет новую таблицу HTML для формирования окна автозавершения.
-[start=2]
+
. Откройте файл `javascript.js` в редакторе и добавьте к верхнему фрагменту файла следующие переменные.
[source,java]
@@ -733,7 +733,7 @@
var autoRow;
----
-[start=3]
+
. Добавьте следующие строки (выделенные *полужирным шрифтом*) к функции `init()`.
[source,java]
@@ -761,7 +761,7 @@
</tr>
----
-[start=4]
+
. Добавьте `appendComposer()` в `javascript.js`.
[source,java]
@@ -796,7 +796,7 @@
----
Эта функция позволяет создавать новую строку таблицы и вставлять в нее ссылку на композитора с использованием данных, передаваемых в функцию посредством соответствующих трех параметров, а затем вставлять эту строку в элемент `complete-table` страницы-указателя.
-[start=5]
+
. Добавьте `clearTable()` в `javascript.js`.
[source,java]
@@ -813,7 +813,7 @@
----
Эта функция позволяет скрывать элемент `complete-table` (т.е. делать его невидимым), но не удаляет какие-либо существующие записи имен композиторов, созданные ранее.
-[start=6]
+
. Добавьте `getElementY()` в `javascript.js`.
[source,java]
@@ -839,7 +839,7 @@
NOTE: См. link:http://www.quirksmode.org/js/findpos.html[+это описание+] `смещения` в link:http://www.quirksmode.org/[+http://www.quirksmode.org/+].
-[start=7]
+
. Для вызова `clearTable()` при каждом получении данных с сервера можно соответствующим образом изменить функцию `callback()`. Поэтому любые скомбинированные записи, существующие в окне автозавершения, удаляются до того, как выполняется заполнение новыми записями.
[source,java]
@@ -857,7 +857,7 @@
}
----
-[start=8]
+
. Добавьте `parseMessages()` в `javascript.js`.
[source,java]
@@ -1000,7 +1000,7 @@
Выполните проверку кода CSS, щелкнув редактор CSS правой кнопкой мыши и выбрав команду "Проверить CSS". В окне "Вывод" можно просмотреть все ошибки ("Окно" > "Вывод").
-[start=5]
+
. Перейдите к странице `index.php` в редакторе и добавьте справочную информацию в таблицу стилей между тегами `<head>`.
[source,java]
@@ -1010,7 +1010,7 @@
----
-[start=6]
+
. Выполните проект еще раз. В браузере отображается страница-указатель с созданной таблицей стилей. При каждом вводе символа на сервер передается асинхронный запрос, который возвращается с данными XML, подготовленными при помощи `AutoCompleteServlet`. При вводе последующих символов количество вариантов имен композиторов уменьшается, и на экране появляется новый список соответствий.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_zh_CN.asciidoc
index 91e14ba..8940fed 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/ajax-quickstart_zh_CN.asciidoc
@@ -94,10 +94,10 @@
image::images/php-name-location.png[title="新建 PHP 项目向导 - "Name and Location"(名称和位置)面板"]
-[start=3]
+
. 在步骤 3 "Run Configuration"(运行配置)中,指定您要部署应用程序的方式。如果您已通过配置 *AMP 包设置了 PHP 开发环境,则应该从下拉列表中选择 *Local Web Site*(本地 Web 站点),并指定项目的 URL(将显示在浏览器中)。
-[start=4]
+
. 选中 "Copy files from Sources Folder to another location"(将源文件夹中的文件复制到其他位置)选项。然后,在 "Copy to Folder "(复制到文件夹)字段中,键入到服务器上部署位置的路径。(在 Apache 上,部署位置是默认的 `htdocs` 目录。)
[.feature]
@@ -106,7 +106,7 @@
--
-[start=5]
+
. 单击 *Finish*(完成)。IDE 在您的文件系统中创建项目文件夹,项目在 IDE 中打开。
您也可以使用项目向导 将框架支持添加到项目中(可在向导的步骤 4 中执行该操作)。
@@ -116,7 +116,7 @@
image::images/php-proj-win.png[title=""Projects"(项目)窗口将显示 MyAjaxApp 项目"]
-[start=6]
+
. 在开始编码前,请立即尝试运行该应用程序以确保正确设置了 IDE、您的服务器和浏览器之间的配置。
在 IDE 的编辑器中,向索引页中添加一个 `echo` 语句:
@@ -131,7 +131,7 @@
----
-[start=7]
+
. 在 "Projects"(项目)窗口中,右键单击项目节点,然后选择 "Run"(运行)。IDE 会打开您的默认浏览器,并显示您刚在 `index.php` 中创建的 Hello World 消息。
NOTE: 如果您在设置项目或在 IDE、服务器和浏览器之间建立通信时遇到困难,请参见link:project-setup.html[+设置 PHP 项目+]以获取更详细的说明。link:../../trails/php.html[+PHP 学习资源+]可以提供有关配置环境的更多信息。
@@ -173,7 +173,7 @@
----
-[start=4]
+
. 添加一些说明性文本以介绍文本字段的用途。您可以复制以下文本并将其粘贴在 `<h1>` 标记下方的某一位置:
[source,html]
@@ -188,7 +188,7 @@
----
-[start=5]
+
. 向该页面中添加一个 HTML 窗体。可以利用 IDE "Palette"(组件面板)中列出的元素执行此操作。如果组件面板没有打开,请从主菜单中选择 "Window"(窗口)> "Palette"(组件面板)。然后,在 "HTML Forms"(HTML 窗体)下,单击某个窗体元素,并将其拖至该页面中您刚添加的 `<p>` 标记下的某一位置。此时将打开 "Insert Form"(插入窗体)对话框。指定以下内容:
* "Action"(操作):autocomplete.php
@@ -200,7 +200,7 @@
单击 "OK"(确定)。HTML `<form>` 标记已插入到包含您所指定的属性的页面中。(GET 在默认情况下应用,因此没有进行显式声明。)
-[start=6]
+
. 向该页面添加一个 HTML 表格。在 "Palette"(组件面板)中的 "HTML" 类别下,单击某个表格元素,并将其拖至 `<form>` 标记之间的位置。"Insert Table"(插入表格)对话框即打开。指定以下内容:
* "Rows"(行):2
@@ -213,7 +213,7 @@
image::images/insert-table.png[title=""Insert table"(插入表格)对话框"]
-[start=7]
+
. 在源代码编辑器中单击鼠标右键,然后选择 "Format"(格式化代码)。此操作将对代码进行整理。现在,您的窗体应该如下显示:
[source,xml]
@@ -242,7 +242,7 @@
----
-[start=8]
+
. 将以下文本键入到此表格第一行的第一列中(更改的内容以*粗体*显示):
[source,xml]
@@ -251,7 +251,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=9]
+
. 在第一行的第二列中,手动键入以下代码(而不从 "Palette"(组件面板)中拖动一个文本输入字段)。
[source,java]
@@ -267,15 +267,15 @@
image:images/code-completion.png[title="在源代码编辑器中按 Ctrl-空格键可以触发代码完成"]
您在上文中键入的 `onkeyup` 属性指向名为 `doCompletion()` 的 JavaScript 函数。每次在窗体文本字段中按下一个键时,此函数都会被调用,并映射到以上 Ajax <<flow-diagram,流程图>>中所描述的 JavaScript 调用。
-[start=10]
+
. 在转为使用 JavaScript 编辑器之前,请将应用程序的入口点由 `index.php` 文件替换为新的 `index.html` 文件。
要执行此操作,请右键单击 "Projects"(项目)窗口中的项目节点,然后选择 "Properties"(属性)。选择 *Run Configuration*(运行配置)类别,然后在 "Index File"(索引文件)字段中输入 `index.html`。image:images/php-entry-point.png[title="在 "Project Properties"(项目属性)窗口中指定应用程序的入口点"]
-[start=11]
+
. 单击 "OK"(确定)以保存更改,然后退出 "Project Properties"(项目属性)窗口。
-[start=12]
+
. 运行该项目以查看其在浏览器中的外观。单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮。在默认浏览器中显示 `index.html` 文件。
image::images/index-page.png[title="运行项目以在浏览器中查看其当前状态"]
@@ -333,7 +333,7 @@
以上代码将对 Firefox 3 以及 Internet Explorer 版本 6 和 7 执行简单的浏览器兼容性检查。如果希望包含更多强健的代码以处理兼容性问题,建议您使用 link:http://www.quirksmode.org[+http://www.quirksmode.org+] 中的link:http://www.quirksmode.org/js/detect.html[+浏览器检测脚本+]。
-[start=4]
+
. 切换回 `index.html`,然后在 `<head>` 标记之间添加对 JavaScript 文件的引用。
[source,xml]
@@ -346,7 +346,7 @@
您可以按 Ctrl-Tab 组合键在编辑器中打开的页面之间快速切换。
-[start=5]
+
. 在开始标记 `<body>` 中,插入对 `init()` 的调用。
[source,java]
@@ -461,7 +461,7 @@
}
----
-[start=4]
+
. 在编辑器中,将以下代码粘贴到该类(更改内容以*粗体*显示)。
[source,php]
@@ -550,10 +550,10 @@
image::images/edit-file-name.png[title="单击文件节点可编辑名称"]
-[start=2]
+
. 将该文件命名为 `autocomplete`,然后单击 Enter 键。双击新的 `autocomplete.php` 文件,使其显示在编辑器中。
-[start=3]
+
. 将该文件的现有代码替换为以下脚本。
[source,php]
@@ -727,7 +727,7 @@
----
此新行(可以标识为 "`auto-row`")用作 JavaScript 代码的处理程序,以便插入一个新 HTML 表,该表将形成自动完成框。
-[start=2]
+
. 在编辑器中打开 `javascript.js`,并在文件顶部添加以下三个变量。
[source,java]
@@ -738,7 +738,7 @@
var autoRow;
----
-[start=3]
+
. 将以下行(以*粗体*显示)添加到 `init()` 函数中。
[source,java]
@@ -766,7 +766,7 @@
</tr>
----
-[start=4]
+
. 将 `appendComposer()` 添加到 `javascript.js`。
[source,java]
@@ -801,7 +801,7 @@
----
此函数创建了一个新的表行,并用其所含的三个参数传递的数据将指向作曲家的链接插入此表行中,然后将此行插入索引页的 `complete-table` 元素中。
-[start=5]
+
. 将 `clearTable()` 添加到 `javascript.js`。
[source,java]
@@ -818,7 +818,7 @@
----
此函数用于将 `complete-table` 元素的显示方式设置为 "none"(无)(也就是使其不可见),并删除所有已创建的现有作曲家名字条目。
-[start=6]
+
. 将 `getElementY()` 添加到 `javascript.js`。
[source,java]
@@ -844,7 +844,7 @@
NOTE: 请在 link:http://www.quirksmode.org/[+http://www.quirksmode.org/+] 上查看 `offset` 的link:http://www.quirksmode.org/js/findpos.html[+说明+]。
-[start=7]
+
. 修改 `callback()` 函数以便每次从服务器接收到新数据时都调用 `clearTable()`。因此,在用新条目填充自动完成框之前其中已存在的任何作曲家条目均会删除。
[source,java]
@@ -862,7 +862,7 @@
}
----
-[start=8]
+
. 将 `parseMessages()` 添加到 `javascript.js`。
[source,java]
@@ -1005,7 +1005,7 @@
对 CSS 代码的有效性执行检查,方法是右键单击 CSS 编辑器,然后选择 "Check CSS"(检查 CSS)。遇到的任何错误都会显示在 "Output"(输出)窗口中("Windows"(窗口)> "Output"(输出))。
-[start=5]
+
. 切换到编辑器中的 `index.html` 页(按 Ctrl-Tab 组合键),然后在 `<head>` 标记之间添加对样式表的引用。
[source,java]
@@ -1015,7 +1015,7 @@
----
-[start=6]
+
. 再次运行应用程序。将使用您刚创建的样式表在浏览器中显示索引页。每次您键入字符时,都会向服务器发送异步请求,并返回 `autocomplete.php` 准备好的 XML 数据。随着您输入的字符增多,为了反映匹配项的新列表,作曲家名字的数量会越来越少。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/code-templates.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/code-templates.asciidoc
index 2416e30..1a2f552 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/code-templates.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/code-templates.asciidoc
@@ -71,7 +71,7 @@
image::images/expanding-template-with-abb.png[]
-[start=3]
+
. The placeholder class name ( ``*class_name*`` ) is selected automatically. You can move between placeholders by pressing Tab. You can immediately type the name you want for the class and this name overwrites the placeholder. Press Enter when you are done and the IDE selects the name of the first function, which in this case is the constructor.
NOTE: Placeholder names are discussed in more detail in the <<placeholder,Placeholder name section>>.
@@ -79,7 +79,7 @@
image::images/select-constructor-name.png[]
-[start=4]
+
. Edit the function name or accept the default. Press Enter again, and the cursor moves to the inside of the function's body. In a real world scenario, you would now start coding the function and the rest of the class.
The final position of the cursor is determined by the ``${cursor}`` parameter. This parameter is described in the section <<reserved-name,Reserved names>>.
@@ -97,16 +97,16 @@
image::images/insert-template-with-cc.png[]
-[start=4]
+
. Select the new class template and press Enter. The IDE inserts it into your code.
-[start=5]
+
. The placeholder class name ( ``*class_name*`` ) is selected automatically. You can move between placeholders by pressing Tab. You can immediately type the name you want for the class and this name overwrites the placeholder. Press Enter when you are done and the IDE selects the name of the first function, which in this case is the constructor.
image::images/select-constructor-name.png[]
-[start=6]
+
. Edit the function name or accept the default. Press Enter again, and the cursor moves to the inside of the function's body. In a real world scenario, you would now start coding the function and the rest of the class.
== Surrounding code with a template
@@ -139,25 +139,25 @@
>
----
-[start=2]
+
. Select the line ``$b = 10;``
image::images/selected-variable.png[]
-[start=3]
+
. Click the Hint image::images/hint-icon.png[] icon or press Alt-Enter. The Surround with... dialog opens.
image::images/surround-hint.png[]
-[start=4]
+
. Click `` Surround with if{*true*){...``
image::images/surround-if-true.png[]
-[start=5]
+
. The IDE surrounds the line ``$b = 10;`` with an ``if(*true*){... `` template.
image::images/inserted-if-true.png[]
@@ -187,7 +187,7 @@
image::images/iter-cc.png[]
-[start=2]
+
. The iteration has two variables as parameters, ``$index`` and ``$array`` . ``$index`` is selected automatically for editing. (Pressing Tab moves between parameters.)
image::images/iteration1.png[]
@@ -197,10 +197,10 @@
image::images/iteration2.png[]
-[start=3]
+
. Press Enter or Tab. The parameter ``$array`` is selected.
-[start=4]
+
. Press Enter. The cursor enters the method body of the iteration.
The variable name refactoring feature in NetBeans enables you to change all instances of a variable name by editing only one instance. You see here how this is helpful when applied to template parameters.
@@ -210,7 +210,7 @@
*To associate a variable in a template with the correct method:*
-[start=1]
+
. In an empty PHP block, type the follwing code:
[source,php]
@@ -220,13 +220,13 @@
$arr = array(new ArrayIterator($array()), new ArrayObject($array()));?>
----
-[start=2]
+
. After the line declaring the ``$arr`` array, type ``fore`` and use code completion to insert the `` foreach`` template (abbreviation: ``fore`` ).
image::images/cc-foreach.png[]
-[start=3]
+
. Place the cursor in the body of the ``foreach`` function (you can press Enter twice to move the cursor there) and type ``$value`` , or only type ``$`` and select ``$value`` from code completion.
[source,php]
@@ -237,7 +237,7 @@
foreach ($arr as $value) {$value}?>
----
-[start=4]
+
. After ``$value`` , type ``->`` . Code completion offers you the correct methods for the ``$value`` variable, which is derived from the array ``$arr`` .
image::images/value-method-cc.png[]
@@ -367,13 +367,13 @@
image::images/code-template-options.png[]
-[start=2]
+
. Click New to open the New Code Template dialog box. Type in the abbreviation you want for the template and click OK.
image::images/new-abb.png[]
-[start=3]
+
. A new row is added to the table of code templates. This row contains only the abbreviation you provided. The cursor is in the Expanded Text tab, where the IDE placed the cursor automatically. You can begin typing the template's code immediately.
NOTE: To learn about the syntax of the code template's expanded text, see the section <<syntax,PHP Code Template Syntax.>>
diff --git a/netbeans.apache.org/src/content/kb/docs/php/code-templates_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/code-templates_ja.asciidoc
index a5f5eeb..0327953 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/code-templates_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/code-templates_ja.asciidoc
@@ -87,7 +87,7 @@
image::images/expanding-template-with-abb.png[]
-[start=3]
+
. プレースホルダのクラス名( ``*class_name*`` )が自動的に選択されます。[Tab]を押して、プレースホルダ間を移動できます。クラスに付ける名前をここで入力でき、入力した名前によってプレースホルダが上書きされます。終了して[Enter]を押すと、最初の関数(この場合はコンストラクタ)の名前がIDEで選択されます。
NOTE: プレースホルダ名については<<placeholder,プレースホルダ名>>の項で詳しく説明します。
@@ -95,7 +95,7 @@
image::images/select-constructor-name.png[]
-[start=4]
+
. 関数名を編集するか、またはデフォルトの名前をそのまま使用します。もう一度[Enter]を押すと、カーソルが関数本体の内部に移動します。実際には、ここで関数およびクラスの残り部分のコーディングを開始します。
カーソルの最終位置は ``${cursor}`` パラメータによって決定されます。このパラメータについては<<reserved-name,予約名>>の項で説明します。
@@ -114,16 +114,16 @@
image::images/insert-template-with-cc.png[]
-[start=4]
+
. 新規クラス・テンプレートを選択し、[Enter]キーを押します。IDEによって、コードに挿入されます。
-[start=5]
+
. プレースホルダのクラス名( ``*class_name*`` )が自動的に選択されます。[Tab]を押して、プレースホルダ間を移動できます。クラスに付ける名前をここで入力でき、入力した名前によってプレースホルダが上書きされます。終了して[Enter]を押すと、最初の関数(この場合はコンストラクタ)の名前がIDEで選択されます。
image::images/select-constructor-name.png[]
-[start=6]
+
. 関数名を編集するか、またはデフォルトの名前をそのまま使用します。もう一度[Enter]を押すと、カーソルが関数本体の内部に移動します。実際には、ここで関数およびクラスの残り部分のコーディングを開始します。
@@ -154,25 +154,25 @@
<?php$a = false;$b = 10;?>
----
-[start=2]
+
. 「 ``$b = 10;`` 」行を選択します。
image::images/selected-variable.png[]
-[start=3]
+
. ヒントimage::images/hint-icon.png[]・アイコンをクリックするか、[Alt]-[Enter]を押します。「囲む」ダイアログが開きます。
image::images/surround-hint.png[]
-[start=4]
+
. 「 ``Surround with if{*true*){...`` 」をクリックします。
image::images/surround-if-true.png[]
-[start=5]
+
. IDEで、「 ``$b=10;`` 」行が「 ``if(*true*){...`` 」テンプレートで囲まれます。
image::images/inserted-if-true.png[]
@@ -203,7 +203,7 @@
image::images/iter-cc.png[]
-[start=2]
+
. 繰返し処理には、パラメータとして ``$index`` および ``$array`` の2つの変数があります。 ``$index`` が編集のために自動的に選択されます。([Tab]を押すと、パラメータ間を移動します。)
image::images/iteration1.png[]
@@ -213,10 +213,10 @@
image::images/iteration2.png[]
-[start=3]
+
. [Enter]または[Tab]を押します。パラメータ ``$array`` が選択されます。
-[start=4]
+
. [Enter]を押します。カーソルが繰返し処理のメソッド本体に移動します。
NetBeansの変数名リファクタリング機能では、変数の1つのインスタンスを編集することにより、その変数のすべてのインスタンスを変更できます。これがテンプレートのパラメータに適用されると役に立つことがわかります。
@@ -233,13 +233,13 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));?>
----
-[start=2]
+
. ``$arr`` 配列を宣言する行の後に「 ``fore`` 」と入力し、コード補完を使用して ``foreach`` テンプレート(省略名 ``fore`` )を挿入します。
image::images/cc-foreach.png[]
-[start=3]
+
. ([Enter]を2回押すか、またはカーソルを移動して) ``foreach`` 関数の本体にカーソルを置き、「 ``$value`` 」と入力するか、または「 ``$`` 」とのみ入力してコード補完から「 ``$value`` 」を選択します。
[source,php]
@@ -248,7 +248,7 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));foreach ($arr as $value) {$value}?>
----
-[start=4]
+
. 「 ``$value`` 」に続けて「 ``->`` 」と入力します。コード補完により、配列 ``$arr`` から派生した ``$value`` 変数に対する適切なメソッドが提示されます。
image::images/value-method-cc.png[]
@@ -379,13 +379,13 @@
image::images/code-template-options.png[]
-[start=2]
+
. 「新規」をクリックして、「新規コード・テンプレート」ダイアログ・ボックスを開きます。テンプレートの省略名を入力して「OK」をクリックします。
image::images/new-abb.png[]
-[start=3]
+
. コード・テンプレートの表に新しい行が追加されます。この行の内容は、指定した省略名のみです。IDEで「展開されるテキスト」タブにカーソルが自動的に移動します。テンプレートのコードの入力をすぐに開始できます。
NOTE: コード・テンプレートの展開されるテキストの構文については、<<syntax,PHPコード・テンプレートの構文>>の項を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/code-templates_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/code-templates_pt_BR.asciidoc
index 2b0be56..48de0a5 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/code-templates_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/code-templates_pt_BR.asciidoc
@@ -87,7 +87,7 @@
image::images/expanding-template-with-abb.png[]
-[start=3]
+
. O nome de classe do placeholder ( ``*class_name*`` ) é selecionado automaticamente. Você pode mover-se entre os placeholders pressionando Tab. Você pode digitar imediatamente o nome desejado para a classe e este nome substitui o placeholder. Pressione Enter quando tiver terminado e o IDE selecionará o nome da primeira função, que neste caso é o construtor.
NOTE: os nomes do placeholder são abordados com mais detalhes na <<placeholder,seção Nome do Placeholder>>.
@@ -95,7 +95,7 @@
image::images/select-constructor-name.png[]
-[start=4]
+
. Edite o nome da função ou aceite o default. Pressione Enter novamente e o cursor irá para dentro do corpo da função. Em uma situação real, você poderia agora começar a codificar a função e o resto da classe.
A posição final do cursor é determinada pelo parâmetro ``${cursor}`` . Este parâmetro será descrito na seção <<reserved-name,Nomes Reservados>>.
@@ -114,16 +114,16 @@
image::images/insert-template-with-cc.png[]
-[start=4]
+
. Selecione o novo modelo de classe e pressione Enter. O IDE o insere no código.
-[start=5]
+
. O nome de classe do placeholder ( ``*class_name*`` ) é selecionado automaticamente. Você pode mover-se entre os placeholders pressionando Tab. Você pode digitar imediatamente o nome desejado para a classe e este nome substitui o placeholder. Pressione Enter quando tiver terminado e o IDE selecionará o nome da primeira função, que neste caso é o construtor.
image::images/select-constructor-name.png[]
-[start=6]
+
. Edite o nome da função ou aceite o default. Pressione Enter novamente e o cursor irá para dentro do corpo da função. Em uma situação real, você poderia agora começar a codificar a função e o resto da classe.
@@ -154,25 +154,25 @@
<?php$a = false;$b = 10;?>
----
-[start=2]
+
. Selecione a linha ``$b = 10;``
image::images/selected-variable.png[]
-[start=3]
+
. Clique no ícone Dica image::images/hint-icon.png[] ou pressione Alt-Enter. A caixa de diálogo Circundar com... será aberta.
image::images/surround-hint.png[]
-[start=4]
+
. Clique em ``Circundar com if{*true*){...``
image::images/surround-if-true.png[]
-[start=5]
+
. O IDE circunda a linha ``$b = 10;`` com um modelo ``if(*true*){...`` .
image::images/inserted-if-true.png[]
@@ -203,7 +203,7 @@
image::images/iter-cc.png[]
-[start=2]
+
. A iteração tem duas variáveis como parâmetros, ``$index`` e ``$array`` . ``$index`` é selecionada automaticamente para edição. (Pressionando Tab elas são movidas entre os parâmetros.)
image::images/iteration1.png[]
@@ -213,10 +213,10 @@
image::images/iteration2.png[]
-[start=3]
+
. Pressione Enter ou Tab. O parâmetro ``$array`` é selecionado.
-[start=4]
+
. Pressione Enter. O cursor insere o corpo do método da iteração.
A funcionalidade de refatoração do nome da variável no NetBeans permite alterar todas as instâncias de nome da variável editando somente uma instância. Aqui você pode ver como essa funcionalidade é útil quando aplicada nos parâmetros do modelo.
@@ -233,13 +233,13 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));?>
----
-[start=2]
+
. Depois da linha que declara o array ``$arr`` , digite ``fore`` e use a funcionalidade de autocompletar código para inserir o modelo ``foreach`` (abreviação: ``fore`` ).
image::images/cc-foreach.png[]
-[start=3]
+
. Coloque o cursor no corpo da função ``foreach`` (você pode pressionar Enter duas vezes para tirar o cursor de lá) e digite ``$value`` , ou digite somente ``$`` e selecione ``$value`` na funcionalidade autocompletar código.
[source,php]
@@ -248,7 +248,7 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));foreach ($arr as $value) {$value}?>
----
-[start=4]
+
. Depois de ``$value`` , digite ``->`` . A funcionalidade autocompletar código oferece os métodos corretos para a variável ``$value`` , que se deriva do array ``$arr`` .
image::images/value-method-cc.png[]
@@ -379,13 +379,13 @@
image::images/code-template-options.png[]
-[start=2]
+
. Clique em Novo para abrir a caixa de diálogo Novo Modelo de Código. Digite a abreviação que deseja para o modelo e clique em OK.
image::images/new-abb.png[]
-[start=3]
+
. É adicionada uma nova linha à tabela de modelos de código. Esta linha contém somente a abreviação fornecida. O cursor está na guia Texto Expandido, onde o IDE colocou o cursor automaticamente. Você pode começar a digitar imediatamente o código do modelo.
NOTE: para saber mais sobre a sintaxe do texto expandido do modelo de código, consulte a seção <<syntax,Sintaxe do Modelo de Código PHP.>>
diff --git a/netbeans.apache.org/src/content/kb/docs/php/code-templates_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/code-templates_ru.asciidoc
index 994a9d4..9b1d53d 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/code-templates_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/code-templates_ru.asciidoc
@@ -90,7 +90,7 @@
image::images/expanding-template-with-abb.png[]
-[start=3]
+
. Имя класса метки-заполнителя ( ``*class_name*`` ) выбирается автоматически. Для перехода от одного заполнителя к другому можно использовать клавишу Tab. Можно сразу указать требуемое имя класса, которое будет перезаписано для метки-заполнителя. После завершения ввода нажмите ENTER. В среде IDE будет выбрано имя первой функции, которой в данном варианте является конструктор.
NOTE: Имена заменителей описываются более детально в разделе <<placeholder,Раздел имен заменителей>>.
@@ -98,7 +98,7 @@
image::images/select-constructor-name.png[]
-[start=4]
+
. Отредактируйте имя функции или примите значение по умолчанию. Затем снова нажмите ENTER. Курсор переместится в тело функции. В реальном сценарии после этого начинается кодирование функции и остального класса.
Итоговое положение курсора определяется параметром ``${cursor}`` . Этот параметр описывается в разделе <<reserved-name,Зарезервированные имена>>.
@@ -117,16 +117,16 @@
image::images/insert-template-with-cc.png[]
-[start=4]
+
. Выберите шаблон нового класса и нажмите Enter. В среде IDE выполняется его вставка в код.
-[start=5]
+
. Имя класса метки-заполнителя ( ``*class_name*`` ) выбирается автоматически. Для перехода от одного заполнителя к другому можно использовать клавишу Tab. Можно сразу указать требуемое имя класса, которое будет перезаписано для метки-заполнителя. После завершения ввода нажмите ENTER. В среде IDE будет выбрано имя первой функции, которой в данном варианте является конструктор.
image::images/select-constructor-name.png[]
-[start=6]
+
. Отредактируйте имя функции или примите значение по умолчанию. Затем снова нажмите ENTER. Курсор переместится в тело функции. В реальном сценарии после этого начинается кодирование функции и остального класса.
@@ -157,25 +157,25 @@
<?php$a = false;$b = 10;?>
----
-[start=2]
+
. Выберите строку ``$b = 10;``
image::images/selected-variable.png[]
-[start=3]
+
. Нажмите на значок 'Подсказка' image::images/hint-icon.png[] или нажмите Alt-Enter. Откроется диалоговое окно "Окружение...".
image::images/surround-hint.png[]
-[start=4]
+
. Щелкните `` Surround with if{*true*){...``
image::images/surround-if-true.png[]
-[start=5]
+
. В среде IDE строка ``$b = 10;`` будет окружена шаблоном ``if(*true*){... `` .
image::images/inserted-if-true.png[]
@@ -206,7 +206,7 @@
image::images/iter-cc.png[]
-[start=2]
+
. В итерации в качестве параметров используются две переменных: ``$index`` и ``$array`` . Переменная ``$index`` выбирается для редактирования автоматически. (Для перемещения между параметрами используйте клавишу Tab.)
image::images/iteration1.png[]
@@ -216,10 +216,10 @@
image::images/iteration2.png[]
-[start=3]
+
. Нажмите Enter или Tab. Будет выбран параметр ``$array`` .
-[start=4]
+
. Нажмите ENTER. Курсор переместится в тело метода итерации.
Функция реорганизации имен переменных в NetBeans позволяет изменить все экземпляры имени переменной путем редактирования только одного экземпляра. В данном разделе рассматривается ее использование для параметров шаблона.
@@ -236,13 +236,13 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));?>
----
-[start=2]
+
. После строки с объявлением массива ``$arr`` введите ``fore`` и с помощью дополнения кода вставьте шаблон `` foreach`` (аббревиатура: ``fore`` ).
image::images/cc-foreach.png[]
-[start=3]
+
. Поместите курсор в тело функции ``foreach`` (для перемещения курсора можно дважды нажать ENTER) и введите значение ``$value`` или введите только ``$`` и выберите ``$value`` из дополнения кода.
[source,php]
@@ -251,7 +251,7 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));foreach ($arr as $value) {$value}?>
----
-[start=4]
+
. После ``$value`` введите ``->`` . Дополнение кода обеспечивает корректные методы для переменной ``$value`` , значение которой можно получить из массива ``$arr`` .
image::images/value-method-cc.png[]
@@ -382,13 +382,13 @@
image::images/code-template-options.png[]
-[start=2]
+
. Нажмите 'Создать'. В результате откроется диалоговое окно 'Создание шаблона кода'. Введите аббревиатуру для шаблона и нажмите кнопку "ОК".
image::images/new-abb.png[]
-[start=3]
+
. В таблицу шаблонов кода будет добавлена новая строка. Она содержит только введенную аббревиатуру. Курсор будет автоматически расположен на вкладке "Расширенный текст". Код шаблона можно ввести прямо на этой вкладке.
NOTE: Описание синтаксиса расширенного текста шаблона кода см. в разделе <<syntax,Синтаксис шаблона кода PHP.>>
diff --git a/netbeans.apache.org/src/content/kb/docs/php/code-templates_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/code-templates_zh_CN.asciidoc
index 4a25ac8..f9925f2 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/code-templates_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/code-templates_zh_CN.asciidoc
@@ -87,7 +87,7 @@
image::images/expanding-template-with-abb.png[]
-[start=3]
+
. 将自动选择占位符类名 ( ``*class_name*`` )。按 Tab 键可在占位符之间移动。您可以立即键入所需的类名,该名称将覆盖占位符。在完成后,按 Enter 键,IDE 将选择第一个函数的名称,此处为构造函数。
NOTE: <<placeholder,占位符名称>>部分详细讲述了占位符名称。
@@ -95,7 +95,7 @@
image::images/select-constructor-name.png[]
-[start=4]
+
. 编辑函数名称或接受默认值。再次按 Enter 键,光标将移到函数主体内部。在实际情况下,您现在将开始对函数和类的其余部分进行编码。
最终的光标位置是由 ``${cursor}`` 参数决定的。<<reserved-name,保留的名称>>部分中介绍了该参数。
@@ -114,16 +114,16 @@
image::images/insert-template-with-cc.png[]
-[start=4]
+
. 选择新的类模板并按 Enter 键。IDE 将在代码中插入该模板。
-[start=5]
+
. 将自动选择占位符类名 ( ``*class_name*`` )。按 Tab 键可在占位符之间移动。您可以立即键入所需的类名,该名称将覆盖占位符。在完成后,按 Enter 键,IDE 将选择第一个函数的名称,此处为构造函数。
image::images/select-constructor-name.png[]
-[start=6]
+
. 编辑函数名称或接受默认值。再次按 Enter 键,光标将移到函数主体内部。在实际情况下,您现在将开始对函数和类的其余部分进行编码。
@@ -154,25 +154,25 @@
<?php$a = false;$b = 10;?>
----
-[start=2]
+
. 选择行 ``$b = 10;``
image::images/selected-variable.png[]
-[start=3]
+
. 单击 "Hint"(提示)image::images/hint-icon.png[] 图标或按 Alt-Enter 组合键。此时将打开 "Surround with..."(包含方式...)对话框。
image::images/surround-hint.png[]
-[start=4]
+
. 单击 ``Surround with if{*true*){...`` (包含在 if{true){... 中)
image::images/surround-if-true.png[]
-[start=5]
+
. IDE 将 ``$b = 10;`` 行包含在 ``if(*true*){...`` 模板中。
image::images/inserted-if-true.png[]
@@ -203,7 +203,7 @@
image::images/iter-cc.png[]
-[start=2]
+
. 迭代将以下两个变量作为参数: ``$index`` 和 ``$array`` 。将自动选择 ``$index`` 以进行编辑。(按 Tab 键可在参数之间移动。)
image::images/iteration1.png[]
@@ -213,10 +213,10 @@
image::images/iteration2.png[]
-[start=3]
+
. 按 Enter 或 Tab 键。将选择 ``$array`` 参数。
-[start=4]
+
. 按 Enter 键。光标将进入迭代的方法主体。
通过使用 NetBeans 中的变量名称重构功能,您只需编辑变量名称的一个实例即可更改它的所有实例。由此看出,在应用于模板参数时,该功能是多么有用!
@@ -233,13 +233,13 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));?>
----
-[start=2]
+
. 在声明 ``$arr`` 数组的行后面,键入 ``fore`` ,然后使用代码完成插入 ``foreach`` 模板(缩写为 ``fore`` )。
image::images/cc-foreach.png[]
-[start=3]
+
. 将光标放在 ``foreach`` 函数主体中(可以按两次 Enter 键以将光标移到此处)并键入 ``$value`` ,或者仅键入 ``$`` 并从代码完成中选择 ``$value`` 。
[source,php]
@@ -248,7 +248,7 @@
<?php$arr = array(new ArrayIterator($array()), new ArrayObject($array()));foreach ($arr as $value) {$value}?>
----
-[start=4]
+
. 在 ``$value`` 后面,键入 ``->`` 。代码完成为您提供了 ``$value`` 变量的正确方法,该变量是从 ``$arr`` 数组派生的。
image::images/value-method-cc.png[]
@@ -379,13 +379,13 @@
image::images/code-template-options.png[]
-[start=2]
+
. 单击 "New"(新建)以打开 "New Code Template"(新建代码模板)对话框。键入所需的模板缩写,然后单击 "OK"(确定)。
image::images/new-abb.png[]
-[start=3]
+
. 将在代码模板表中添加一个新行。该行仅包含您提供的缩写。光标位于 "Expanded Text"(展开的文本)标签中,IDE 自动将光标放在该位置。您可以立即开始键入模板的代码。
NOTE: 要了解代码模板的展开文本的语法,请参见 <<syntax,PHP 代码模板语法>>部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc
index a29c773..e3e6810 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc
@@ -51,14 +51,14 @@
image::images/mamp-install.png[title="MAMP installer panel showing MAMP and MAMP-Pro options"]
-[start=3]
+
. Navigate to `/Applications/MAMP` and double-click `MAMP.app`. The MAMP Control Panel opens.
You can also install the MAMP Control dashboard widget as described in `MAMP/README.rtf`, which enables you to start and stop servers.
image::images/mamp-control-panel.png[]
-[start=4]
+
. Click Preferences to open the Preferences panel, then select the Ports tab.
. Click Set to Default Apache and MySQL ports. Apache port is reset to 80 and MySQL to 3306.
@@ -80,7 +80,7 @@
image::images/mysql-basic-properties.png[title="MySQL Basic Properties dialog containing MAMP's default connectivity settings"]
-[start=3]
+
. Select the Admin Properties tab to display settings that enable you to start and stop the database server from the IDE. MAMP maintains shell scripts in its `bin` folder. You can find scripts for starting and stopping servers there. For the path to the Admin tool, you have a choice; you can link to `MAMP.app` so that you can use the IDE to open MAMP's control panel. To do so, enter `/Applications/MAMP/MAMP.app`. However, an alternative option would be to use the link:http://dev.mysql.com/downloads/workbench/[+MySQL Workbench+], which provides an intuitive GUI interface for performing administrative operations (i.e., configuring and monitoring the MySQL server, managing users and connections, performing backups, etc.). To use MySQL Workbench, first download and install it, then enter the following settings into the dialog:
* *Path/URL to admin tool: *`/Applications/MySQL Tools/MySQLWorkbench.app` _(default installation for MySQL Workbench)_
@@ -89,12 +89,12 @@
image::images/mysql-admin-props.png[title="MySQL Admin Properties dialog containing sample administration settings"]
-[start=4]
+
. If you choose to use the MySQL Workbench as your MySQL admin tool, you need to specify the socket for the connection to MAMP's database. Start MySQL Workbench and from the main page, click New Server Instance in the Server Administration column.
image::images/mysql-workbench-home.png[]
-[start=5]
+
. The Create New Server Instance Profile dialog opens. Select the Local Socket/Pipe connection method and add the path to the socket file in the Parameters tab. The default location of the socket is: `/Applications/MAMP/tmp/mysql/mysql.sock`.
image::images/socket-path.png[]
@@ -134,7 +134,7 @@
;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
----
-[start=3]
+
. Locate the ``[xdebug]`` section and activate Xdebug (replace `xxxxxxxx` with the actual number). Add this section to the end of ``php.ini`` if it is not there.
[source,ini]
@@ -155,19 +155,19 @@
For an explanation of these properties, see Related Settings in the link:http://www.Xdebug.org/docs/remote[+Xdebug Remote Debugging+] documentation.
-[start=4]
+
. Note that the remote port specified for Xdebug in the previous step is: 9000. This is the default debugger port used in NetBeans. To verify this, choose NetBeans > Preferences from the main menu, then select PHP in the Options window.
image::images/php-options68.png[title="The debugging port can be set in the PHP Options window"]
If needed, you can change the debugger port here.
-[start=5]
+
. Open the MAMP control panel and select the PHP tab. Deselect Zend Optimizer.
image::images/mamp-control-panel-preferences-php.png[title="MAMP Control Panel with PHP tab, after Zend Optimizer has been unselected"]
-[start=6]
+
. Start (or restart) the MAMP Apache server.
== Debugging PHP Projects
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ja.asciidoc
index 786fdf3..22e8a23 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ja.asciidoc
@@ -58,7 +58,7 @@
image::images/mamp-install.png[title="MAMPおよびMAMP-Proオプションを示すMAMPインストーラ・パネル"]
-[start=3]
+
. `/Applications/MAMP`に移動して`MAMP.app`をダブルクリックします。MAMPコントロール・パネルが開きます。
`MAMP/README.rtf`に説明されているとおりにMAMPコントロール・ダッシュボード・ウィジェットをインストールし、サーバーを起動および停止することもできます。
@@ -66,10 +66,10 @@
image::images/mamp-control-panel.png[]
-[start=4]
+
. 「プリファレンス」をクリックして「プリファレンス」パネルを開き、「ポート」タブを選択します。
-[start=5]
+
. 「デフォルトのApacheおよびMySQLポートに設定」をクリックします。Apacheポートは80に、MySQLは3306にリセットされます。
image::images/mamp-control-panel-preferences-ports.png[title="ポートをデフォルト値に変更した後のMAMPコントロール・パネルと「ポート」タブ"]
@@ -92,7 +92,7 @@
image::images/mysql-basic-properties.png[title="MAMPのデフォルト接続設定を含むMySQL基本プロパティ・ダイアログ"]
-[start=3]
+
. 「管理プロパティ」タブを選択して、IDEからデータベース・サーバーを起動および停止するための設定を表示します。MAMPでは、`bin`フォルダにシェル・スクリプトが保持されます。ここで、サーバーを起動および停止するためのスクリプトを見つけることができます。管理ツールのパスに`MAMP.app`へのリンクを設定し、IDEを使用してMAMPのコントロール・パネルを開くことができます。これを行うには、`/Applications/MAMP/MAMP.app`を入力します。かわりに、管理操作(MySQLサーバーの構成およびモニタリング、ユーザーおよび接続の管理、バックアップの実行など)を実行するための直感的なGUIインタフェースが備えられたlink:http://dev.mysql.com/downloads/workbench/[+MySQL Workbench+]を使用することもできます。 MySQL Workbenchを使用するには、まずダウンロードおよびインストールし、次の設定をダイアログに入力します。
* *管理ツールのパス/URL: *`/Applications/MySQL Tools/MySQLWorkbench.app` _(MySQL Workbenchのデフォルト・インストール)_
@@ -102,13 +102,13 @@
image::images/mysql-admin-props.png[title="サンプルの管理設定を含むMySQL管理プロパティ・ダイアログ"]
-[start=4]
+
. MySQL WorkbenchをMySQL管理ツールとして使用する場合は、MAMPのデータベースへの接続用のソケットを指定する必要があります。MySQL Workbenchを起動し、メイン・ページでサーバー管理列の新規サーバー・インスタンスをクリックします。
image::images/mysql-workbench-home.png[]
-[start=5]
+
. 「新規サーバー・インスタンス・プロファイルの作成」ダイアログが開きます。ローカル・ソケット/パイプ接続方法を選択し、ソケット・ファイルのパスを「パラメータ」タブに追加します。ソケットのデフォルトの場所は`/Applications/MAMP/tmp/mysql/mysql.sock`です。
image::images/socket-path.png[]
@@ -139,7 +139,7 @@
`/Applications/MAMP/conf/php5/php.ini`
-[start=2]
+
. ``[Zend]`` セクションを見つけて、各行をコメントにします。
[source,ini]
@@ -153,7 +153,7 @@
;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
----
-[start=3]
+
. ``[xdebug]`` セクションを見つけて、Xdebugをアクティブ化します(`xxxxxxxx`を実際の数値に置き換えます)。このセクションが ``php.ini`` の末尾にない場合は追加します。
[source,ini]
@@ -173,20 +173,20 @@
----
これらのプロパティの説明については、link:http://www.Xdebug.org/docs/remote[+Xdebugリモート・デバッグ+]・ドキュメントの関連する設定を参照してください。
-[start=4]
+
. 前の手順でXdebugに指定されたリモート・ポートは9000です。これは、NetBeansで使用されるデフォルトのデバッガ・ポートです。これを確認するには、メイン・メニューから「NetBeans」>「プリファレンス」を選択し、「オプション」ウィンドウで「PHP」を選択します。
image::images/php-options68.png[title="デバッガ・ポートは、「PHPオプション」ウィンドウで設定できます。"]
必要に応じて、ここでデバッガ・ポートを変更できます。
-[start=5]
+
. MAMPコントロール・パネルを開き、「PHP」タブを選択します。Zendオプティマイザを選択解除します。
image::images/mamp-control-panel-preferences-php.png[title="Zendオプティマイザを選択解除した後のMAMPコントロール・パネルと「PHP」タブ"]
-[start=6]
+
. MAMP Apacheサーバーを起動(または再起動)します。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_pt_BR.asciidoc
index f12b5a8..28d0f8b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_pt_BR.asciidoc
@@ -59,7 +59,7 @@
image::images/mamp-install.png[title="Painel do instalador do MAMP mostrando as opções MAMP e MAMP-Pro"]
-[start=3]
+
. Navegue até `/Applications/MAMP` e clique duas vezes em `MAMP.app`. É aberto o Painel de Controle do MAMP.
Você também pode instalar o widget do painel de controle do MAMP conforme descrito em `MAMP/README.rtf`, que permite iniciar e interromper servidores.
@@ -67,10 +67,10 @@
image::images/mamp-control-panel.png[]
-[start=4]
+
. Clique em Preferências para abrir o painel Preferências; em seguida, selecione a guia Portas.
-[start=5]
+
. Clique em Definir como Padrão as portas do Apache e MySQL. A porta do Apache é redefinida como 80 e a do MySQL como 3306.
image::images/mamp-control-panel-preferences-ports.png[title="Painel de controle do MAMP com a guia Portas, depois que as portas foram alteradas para os valores padrão"]
@@ -93,7 +93,7 @@
image::images/mysql-basic-properties.png[title="Caixa de diálogo Propriedades Básicas do MySQL contendo as definições de conectividade padrão do MAMP"]
-[start=3]
+
. Selecione a guia Propriedades de Admin para exibir as definições que permitem a você iniciar e interromper o servidor de banco de dados no IDE. O MAMP mantém os scripts de shell na pasta `bin`. Nessa pasta, você encontra os scripts para iniciar e interromper os servidores. Para o caminho até a ferramenta Admin, você tem uma opção: pode estabelecer um link com `MAMP.app` de modo que possa usar o IDE para abrir o painel de controle do MAMP. Para isso, digite `/Applications/MAMP/MAMP.app`. Entretanto, uma opção alternativa seria usar o link:http://dev.mysql.com/downloads/workbench/[+MySQL Workbench+], que oferece uma interface GUI intuitiva para a execução de operações administrativas (isto é, configurar e monitorar o servidor MySQL, gerenciar usuários e conexões, fazer backups etc.). Para usar o MySQL Workbench, faça primeiramente o download e instale-o; em seguida, especifique as seguintes definições na caixa de diálogo:
* *Caminho/URL para a ferramenta admin: *`/Applications/MySQL Tools/MySQLWorkbench.app` _(instalação padrão do MySQL Workbench)_
@@ -103,13 +103,13 @@
image::images/mysql-admin-props.png[title="Caixa de diálogo Propriedades de Admin do MySQL contendo definições de administração de amostra"]
-[start=4]
+
. Se você optar por usar o MySQL Workbench como sua ferramenta admin do MySQL, especifique o soquete para conexão com o banco de dados do MAMP. Inicie o MySQL Workbench e, na página principal, clique em Nova Instância do Servidor, na coluna Administração do Servidor.
image::images/mysql-workbench-home.png[]
-[start=5]
+
. A caixa de diálogo Criar Perfil da Nova Instância do Servidor é aberta. Selecione o método de conexão Soquete/Pipe Local e adicione o caminho para o arquivo do soquete na guia Parâmetros. O local padrão do soquete é: `/Applications/MAMP/tmp/mysql/mysql.sock`.
image::images/socket-path.png[]
@@ -140,7 +140,7 @@
`/Applications/MAMP/conf/php5/php.ini`.
-[start=2]
+
. Localize a seção ``[Zend]`` e transforme cada linha em comentário.
[source,ini]
@@ -154,7 +154,7 @@
;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
----
-[start=3]
+
. Localize a seção ``[xdebug]`` e ative o Xdebug (substitua `xxxxxxxx` pelo número real). Adicione essa seção ao final de ``php.ini`` se não estiver lá.
[source,ini]
@@ -174,20 +174,20 @@
----
Para obter uma explicação dessas propriedades, consulte Related Settings na documentação link:http://www.Xdebug.org/docs/remote[+Xdebug Remote Debugging+].
-[start=4]
+
. Observe que a porta remota especificada para o Xdebug na etapa anterior é 9000. Essa é a porta do depurador padrão usada no NetBeans. Para confirmar, escolha NetBeans > Preferências no menu principal e selecione PHP na janela Opções.
image::images/php-options68.png[title="A porta de depuração pode ser definida na janela Opções PHP"]
Se for necessário, você poderá alterar a porta do depurador aqui.
-[start=5]
+
. Abra o painel de controle do MAMP e selecione a guia PHP. Desmarque Zend Optimizer.
image::images/mamp-control-panel-preferences-php.png[title="Painel de Controle do MAMP com a guia PHP, depois que o Zend Optimizer foi desmarcado"]
-[start=6]
+
. Inicie (ou reinicie) o servidor Apache do MAMP.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ru.asciidoc
index b4dfd80..71e8a1b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_ru.asciidoc
@@ -58,7 +58,7 @@
image::images/mamp-install.png[title="На экране установщика MAMP отображаются компоненты MAMP и MAMP-Pro"]
-[start=3]
+
. Перейдите в папку `/Applications/MAMP` и дважды щелкните файл `MAMP.app`. Открывается панель управления MAMP.
Также можно установить виджет панели управления MAMP, следуя инструкциям в файле `MAMP/README.rtf`. С помощью этого виджета можно будет запускать и останавливать серверы.
@@ -66,10 +66,10 @@
image::images/mamp-control-panel.png[]
-[start=4]
+
. Нажмите "Предпочтения". На открывшейся панели "Предпочтения" перейдите на вкладку "Порты".
-[start=5]
+
. Выберите параметр "Значения умолчанию" для портов Apache и MySQL. Для порта Apache устанавливается значение 80, а для порта MySQL - 3306.
image::images/mamp-control-panel-preferences-ports.png[title="Панель управления MAMP со вкладкой "Порты", на которой установлены значения портов по умолчанию"]
@@ -92,7 +92,7 @@
image::images/mysql-basic-properties.png[title="В диалоговом окне "Основные свойства MySQL" можно настроить параметры подключений MAMP, используемые по умолчанию"]
-[start=3]
+
. Перейдите на вкладку "Администрирование", где можно настроить параметры запуска и останова сервера баз данных в IDE. Сценарии оболочки MAMP хранятся в папке `bin`. Здесь находятся сценарии для запуска и останова серверов. Вы можете выбрать путь к средствам администрирования и связать IDE с файлом `MAMP.app`, чтобы в дальнейшем запускать панель управления MAMP из IDE. Для этого введите путь `/Applications/MAMP/MAMP.app`. В качестве альтернативы можно использовать инструмент link:http://dev.mysql.com/downloads/workbench/[+MySQL Workbench+], предоставляющий интуитивный графический интерфейс для выполнения административных задач, таких как настройка и мониторинг сервера MySQL, управление пользователями и подключениями, создание резервных копий и т. д. Чтобы использовать инструмент MySQL Workbench, необходимо сначала загрузить и установить его, а затем ввести в диалоговом окне следующие параметры:
* *Путь/URL средства администрирования: *`/Applications/MySQL Tools/MySQLWorkbench.app` _(папка установки MySQL Workbench по умолчанию)_
@@ -102,13 +102,13 @@
image::images/mysql-admin-props.png[title="В диалоговом окне "Администрирование MySQL" можно настроить примерные параметры администрирования"]
-[start=4]
+
. Если в качестве инструмента администрирования сервера MySQL планируется использовать MySQL Workbench, необходимо указать сокет для подключения к базе данных MAMP. Запустите MySQL Workbench. В разделе "Администрирование сервера" на главной странице выберите "Новый экземпляр сервера".
image::images/mysql-workbench-home.png[]
-[start=5]
+
. Отображается диалоговое окно "Создать профиль нового экземпляра сервера". Выберите метод подключения "Локальный сокет/канал" и укажите путь к файлу сокета на вкладке "Параметры". По умолчанию сокет находится в папке `/Applications/MAMP/tmp/mysql/mysql.sock`.
image::images/socket-path.png[]
@@ -139,7 +139,7 @@
`/Applications/MAMP/conf/php5/php.ini`.
-[start=2]
+
. Найдите раздел ``[Zend]`` и закомментируйте в нем все строки.
[source,ini]
@@ -153,7 +153,7 @@
;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
----
-[start=3]
+
. Найдите раздел ``[xdebug]`` и активируйте Xdebug (замените `xxxxxxxx` фактическим номером). Добавьте в конец файла ``php.ini`` следующий раздел (если он отсутствует).
[source,ini]
@@ -173,20 +173,20 @@
----
Пояснения см. в разделе "Связанные настройки" документа link:http://www.Xdebug.org/docs/remote[+Удаленная отладка Xdebug+].
-[start=4]
+
. Обратите внимание, что на предыдущем этапе был указан удаленный порт Xdebug 9000. Этот порт отладчика используется в NetBeans по умолчанию. Чтобы проверить номер порта, выберите "NetBeans > Предпочтения" в главном меню, затем выберите PHP в окне "Параметры".
image::images/php-options68.png[title="Порт отладки можно указать в окне "Параметры PHP""]
При необходимости здесь можно изменить порт отладчика.
-[start=5]
+
. Откройте панель управления MAMP и перейдите на вкладку "PHP". Снимите флажок для параметра Zend Optimizer.
image::images/mamp-control-panel-preferences-php.png[title="Панель управления MAMP со вкладкой "Порты", на которой установлены значения портов по умолчанию"]
-[start=6]
+
. Запустите (или перезапустите) сервер Apache MAMP.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_zh_CN.asciidoc
index c72b38e..b7c2281 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os_zh_CN.asciidoc
@@ -62,7 +62,7 @@
image::images/mamp-install.png[title="显示 MAMP 和 MAMP-Pro 选项的 MAMP 安装程序面板"]
-[start=3]
+
. 导航到 `/Applications/MAMP` 并双击 `MAMP.app`。此时将打开 MAMP 控制面板。
您还可以按照 `MAMP/README.rtf` 中所述安装 MAMP 控制板窗口部件,这使您能够启动和停止服务器。
@@ -70,10 +70,10 @@
image::images/mamp-control-panel.png[]
-[start=4]
+
. 单击 "Preferences"(首选项)打开 "Preferences"(首选项)面板,然后选择 "Ports"(端口)标签。
-[start=5]
+
. 单击 "Set to Default Apache and MySQL ports"(设置为默认的 Apache 和 MySQL 端口)。Apache 端口将重置为 80,MySQL 端口将重置为 3306。
image::images/mamp-control-panel-preferences-ports.png[title="在端口已更改为默认值之后带有 "Ports"(端口)标签的 MAMP 控制面板"]
@@ -96,7 +96,7 @@
image::images/mysql-basic-properties.png[title="包含 MAMP 默认连接设置的 "MySQL Basic Properties"(MySQL 基本属性)对话框"]
-[start=3]
+
. 选择 "Admin Properties"(管理属性)标签以显示可用于从 IDE 中启动和停止数据库服务器的设置。MAMP 在 `bin` 文件夹中维护 Shell 脚本。可以在此文件夹中查找用于启动和停止服务器的脚本。您可以选择管理工具的路径;可以链接到 `MAMP.app`,这样您就可以使用 IDE 打开 MAMP 的控制面板。为此,请输入 `/Applications/MAMP/MAMP.app`。但是,替代选项将使用 link:http://dev.mysql.com/downloads/workbench/[+MySQL Workbench+],它提供用于执行管理操作(即,配置和监视 MySQL 服务器,管理用户和连接,执行备份等)的直观 GUI 界面。要使用 MySQL Workbench,请先下载并安装它,然后在对话框中输入以下设置:
* *管理工具的路径/URL:*`/Applications/MySQL Tools/MySQLWorkbench.app` _(MySQL Workbench 的默认安装)_
@@ -106,13 +106,13 @@
image::images/mysql-admin-props.png[title="包含样例管理设置的 "MySQL Admin Properties"(MySQL 管理属性)对话框"]
-[start=4]
+
. 如果选择使用 MySQL Workbench 作为 MySQL 管理工具,则需要指定用于 MAMP 数据库连接的套接字。启动 MySQL Workbench,然后从主页中,单击 "Server Administration"(服务器管理)列中的 "New Server Instance"(新建服务器实例)。
image::images/mysql-workbench-home.png[]
-[start=5]
+
. 此时将打开 "Create New Server Instance Profile"(新建服务器实例配置文件)对话框。选择 "Local Socket/Pipe"(本地套接字/管道)连接方法,并在 "Parameters"(参数)标签中添加套接字文件的路径。套接字的默认位置为:`/Applications/MAMP/tmp/mysql/mysql.sock`。
image::images/socket-path.png[]
@@ -143,7 +143,7 @@
`/Applications/MAMP/conf/php5/php.ini`。
-[start=2]
+
. 找到 ``[Zend]`` 部分并注释掉每一行。
[source,ini]
@@ -157,7 +157,7 @@
;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
----
-[start=3]
+
. 找到 ``[xdebug]`` 部分并激活 Xdebug(将 `xxxxxxxx` 替换为实际数字)。将此部分添加到 ``php.ini`` 结尾(如果不存在)。
[source,ini]
@@ -177,20 +177,20 @@
----
有关这些属性的说明,请参见 link:http://www.Xdebug.org/docs/remote[+Xdebug 远程调试+]文档中的“相关设置”。
-[start=4]
+
. 请注意,在上一步中为 Xdebug 指定的远程端口为:9000。这是在 NetBeans 中使用的默认调试器端口。要对此进行验证,请从主菜单中选择 "NetBeans" > "Preferences"(首选项),然后在 "Options"(选项)窗口中选择 "PHP"。
image::images/php-options68.png[title="可以在 "PHP Options"(PHP 选项)窗口中设置调试端口"]
如果需要,您可以在此处更改调试器端口。
-[start=5]
+
. 打开 MAMP 控制面板并选择 "PHP" 标签。取消选择 "Zend Optimizer"(Zend 优化器)。
image::images/mamp-control-panel-preferences-php.png[title="取消选择 "Zend Optimizer"(Zend 优化器)之后带有 "PHP" 标签的 MAMP 控制面板"]
-[start=6]
+
. 启动(或重新启动)MAMP Apache 服务器。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc
index 6dbf48f..58a0f2e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc
@@ -152,7 +152,7 @@
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
----
-[start=3]
+
. Run the ``gedit`` application and edit the new configuration file ( ``mysite`` ) in it:
[source,bash]
@@ -162,7 +162,7 @@
----
If asked, enter the password that you specified for the root user during the installation of your operating system.
-[start=4]
+
. Change the Document Root to point to the new location:
[source,bash]
@@ -171,7 +171,7 @@
/home/<user>/public_html/
----
-[start=5]
+
. Change the Directory directive, replace
[source,ini]
@@ -189,7 +189,7 @@
image::images/ubuntu-change-directory-root.png[]
-[start=6]
+
. Save the file ``mysite``
==== Activating the New Virtual Host
@@ -202,7 +202,7 @@
sudo a2dissite default && sudo a2ensite mysite
----
-[start=2]
+
. Restart the Apache HTTP server:
[source,bash]
@@ -224,7 +224,7 @@
----
The MySQL command prompt appears.
-[start=2]
+
. At the command prompt enter the following command and press Enter:
[source,sql]
@@ -260,7 +260,7 @@
* php-pear
For each item, from the context menu choose Mark for installation.
-[start=4]
+
. The Mark additional required changes dialog box opens with a list of dependent packages that should be also installed to enable the work of the software. Click Mark.
. The system returns to the Synaptic Package Manager panel where the selected packages are marked for installation.
. Choose Apply on the toolbar. The Apply the following changes summary panel opens with a list of packages selected for installation. Click Apply.
@@ -268,7 +268,7 @@
NOTE: You can also install the modules by running the following command in the Terminal window: ``aptitude install php5-dev php-pear``
-[start=8]
+
. You can now download and install XDebug. Enter the following command in the Terminal window:
[source,bash]
@@ -290,7 +290,7 @@
----
If asked, enter the password specified for the root user during the installation of your operating system.
-[start=2]
+
. Open the file ``/etc/php5/apache2/php.ini`` .
. Add the following lines to the file:
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ja.asciidoc
index bff090c..e8a055b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ja.asciidoc
@@ -165,7 +165,7 @@
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
----
-[start=3]
+
. ``gedit`` アプリケーションを実行し、そこで新しい構成ファイル( ``mysite`` )を編集します。
[source,bash]
@@ -175,7 +175,7 @@
----
要求された場合は、オペレーティング・システムのインストール時にルート・ユーザー用に指定したパスワードを入力します。
-[start=4]
+
. ドキュメント・ルートを変更し、新しい場所を指定します。
[source,bash]
@@ -184,7 +184,7 @@
/home/<user>/public_html/
----
-[start=5]
+
. Directoryディレクティブを変更します。
[source,bash]
@@ -203,7 +203,7 @@
image::images/ubuntu-change-directory-root.png[]
-[start=6]
+
. ファイル ``mysite`` を保存します。
@@ -217,7 +217,7 @@
sudo a2dissite default && sudo a2ensite mysite
----
-[start=2]
+
. Apache HTTPサーバーを再起動します。
[source,bash]
@@ -232,7 +232,7 @@
MySQLデータベース・サーバーのインストール時に、ルート・ユーザーが作成されます。インストール中に、ルート・ユーザーのパスワードを設定するダイアログが開きます。このダイアログが開かなかったか、このダイアログでパスワードを設定しなかった場合は、MySQLのルート・ユーザーのパスワードを今すぐ作成する必要があります。他のMySQLサーバー・ユーザーを作成するには、パスワードが必要になります。
-[start=1]
+
. MySQLサーバーに接続するには、<<launchTerminal,ターミナルを起動>>し、ターミナル・ウィンドウで次のコマンドを入力します。
[source,bash]
@@ -242,7 +242,7 @@
----
MySQLコマンド・プロンプトが表示されます。
-[start=2]
+
. コマンド・プロンプトで次のコマンドを入力し、[Enter]を押します。
[source,sql]
@@ -281,22 +281,22 @@
* php-pear
各項目で、コンテキスト・メニューからインストールの「マーク」を選択します。
-[start=4]
+
. 依存パッケージの一覧が表示された「依存により要求された変更を追加しますか?」ダイアログ・ボックスが開きます(依存パッケージも、ソフトウェアの機能を有効にするためにインストールされます)。「マーク」をクリックします。
-[start=5]
+
. システムが「Synapticパッケージ・マネージャ」パネルに戻ると、選択したパッケージにインストールのマークが付いています。
-[start=6]
+
. ツールバーで「適用」を選択します。インストール対象として選択したパッケージの一覧が表示された「次の変更を適用のサマリー」パネルが開きます。「適用」をクリックします。
-[start=7]
+
. ダウンロードとインストールが正常に完了したら、「変更を適用」パネルが開きます。「閉じる」をクリックします。
NOTE: ターミナル・ウィンドウで次のコマンドを実行することで、モジュールをインストールすることもできます。 ``aptitude install php5-dev php-pear``
-[start=8]
+
. これでXDebugをダウンロードし、インストールできます。ターミナル・ウィンドウに次のコマンドを入力します。
[source,bash]
@@ -319,10 +319,10 @@
----
要求された場合は、オペレーティング・システムのインストール時にルート・ユーザー用に指定したパスワードを入力します。
-[start=2]
+
. ファイル ``/etc/php5/apache2/php.ini`` を開きます。
-[start=3]
+
. ファイルに次の行を追加します。
[source,ini]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_pt_BR.asciidoc
index 4c16bea..5aab38c 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_pt_BR.asciidoc
@@ -158,7 +158,9 @@
1. Para
acionar o Terminal, selecione Aplicações > Acessórios > Terminal. A janela Terminal será aberta.
-2. Para copiar o arquivo de configuração do host virtual default para um novo arquivo ( ``mysite`` ), digite o seguinte comando no prompt de comando:
+
+[start=2]
+. Para copiar o arquivo de configuração do host virtual default para um novo arquivo ( ``mysite`` ), digite o seguinte comando no prompt de comando:
[source,bash]
----
@@ -166,7 +168,7 @@
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
----
-[start=3]
+
. Execute a aplicação ``
gedit`` e edite o novo arquivo de configuração ( ``mysite`` ) nela:
@@ -177,7 +179,7 @@
----
Se solicitado, digite a senha especificada para o usuário raiz durante a instalação do sistema operacional.
-[start=4]
+
. Altere a Raiz do Documento para apontar para o novo local:
[source,bash]
@@ -186,7 +188,7 @@
/home/<user>/public_html/
----
-[start=5]
+
. Alterar a diretiva Directory, substituir
[source,bash]
@@ -205,7 +207,7 @@
image::images/ubuntu-change-directory-root.png[]
-[start=6]
+
. Salvar o arquivo ``mysite``
@@ -219,7 +221,7 @@
sudo a2dissite default && sudo a2ensite mysite
----
-[start=2]
+
. Reinicie o servidor HTTP Apache:
[source,bash]
@@ -234,7 +236,7 @@
Durante a instalação do servidor de banco de dados MySQL, um usuário raiz é criado. Durante a instalação, é exibida uma caixa de diálogo na qual você define a senha de usuário raiz. Se essa caixa de diálogo não tiver aberto ou se você não tiver definido uma senha nessa caixa de diálogo, terá que criar uma senha de usuário raiz MySQL agora. Você precisará da senha para criar outros usuários do servidor MySQL.
-[start=1]
+
. Para se conectar ao servidor MySQL,<<launchTerminal, acione o Terminal>> e na janela Terminal, insira o seguinte comando:
[source,bash]
@@ -244,7 +246,7 @@
----
O prompt de comando do MySQL será exibido.
-[start=2]
+
. No prompt de comando, digite o seguinte comando e pressione Enter:
[source,sql]
@@ -283,22 +285,22 @@
* php-pear
Para cada item, no menu de contexto, selecione Marcar para instalação.
-[start=4]
+
. A caixa de diálogo Marcar alterações adicionais necessárias será aberta com uma lista dos pacotes dependentes que também devem ser instalados para permitir o trabalho do software. Clique em Marcar.
-[start=5]
+
. O sistema retornará para o painel Gerenciador do Pacote Synaptic onde os pacotes selecionados estão marcados para instalação.
-[start=6]
+
. Selecione Aplicar na barra de ferramentas. O painel de resumo Aplicar as seguintes alterações será aberto com uma lista dos pacotes selecionados para instalação. Clique em Aplicar.
-[start=7]
+
. Quando o download e a instalação forem concluídos com êxito, o painel Alterações aplicadas será aberto. Clique em Fechar.
NOTE: você também pode instalar os módulos executando o seguinte comando na janela Terminal: ``aptitude install php5-dev php-pear``
-[start=8]
+
. Agora você pode fazer o download e instalar o XDebug. Digite o seguinte comando na janela Terminal:
[source,bash]
@@ -321,10 +323,10 @@
----
Se solicitado, informe a senha especificada para o usuário raiz durante a instalação do sistema operacional.
-[start=2]
+
. Abra o arquivo ``/etc/php5/apache2/php.ini`` .
-[start=3]
+
. Adicione as linhas a seguir ao arquivo:
[source,ini]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ru.asciidoc
index 502fd03..1dae726 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_ru.asciidoc
@@ -158,7 +158,9 @@
1. Для
запуска терминала выберите "Applications>Accessories>Terminal". Откроется окно терминала.
-2. Для копирования файла настройки из виртуального узла по умолчанию в новый файл ( ``mysite`` ) введите в командной строке следующую команду:
+
+[start=2]
+. Для копирования файла настройки из виртуального узла по умолчанию в новый файл ( ``mysite`` ) введите в командной строке следующую команду:
[source,bash]
----
@@ -166,7 +168,7 @@
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
----
-[start=3]
+
. Запустите приложение ``
gedit`` и отредактируйте в нем новый файл настройки ( ``mysite`` ):
@@ -177,7 +179,7 @@
----
При появлении запроса введите пароль, определенный для пользователя root во время установки операционной системы.
-[start=4]
+
. Измените корневой узел документов, указав в нем новое местоположение:
[source,bash]
@@ -186,7 +188,7 @@
/home/<user>/public_html/
----
-[start=5]
+
. Измените директиву Directory путем замены
[source,bash]
@@ -205,7 +207,7 @@
image::images/ubuntu-change-directory-root.png[]
-[start=6]
+
. Сохраните файл ``mysite``
@@ -219,7 +221,7 @@
sudo a2dissite default && sudo a2ensite mysite
----
-[start=2]
+
. Перезапустите сервер HTTP Apache:
[source,bash]
@@ -234,7 +236,7 @@
Во время установки сервера базы данных MySQL создается учетная запись пользователя root (администратора). В ходе установки открывается диалоговое окно, в котором требуется указать пароль пользователя root (администратора). Если это диалоговое окно не открылось или если в нем не был задан пароль, необходимо создать пароль пользователя root (администратора) MySQL сейчас. Этот пароль требуется для создания других пользователей сервера MySQL.
-[start=1]
+
. Для подключения к серверу MySQL<<launchTerminal, запустите терминал>> и в окне терминала введите следующую команду:
[source,bash]
@@ -244,7 +246,7 @@
----
Появится командная строка MySQL.
-[start=2]
+
. В этой командной строке введите следующую команду и нажмите ENTER:
[source,sql]
@@ -283,22 +285,22 @@
* php-pear
В контекстном меню для каждого элемента выберите "Mark for installation".
-[start=4]
+
. Появится диалоговое окно "Mark additional required changes", содержащее список зависимых пакетов, установка которых также является необходимой для функционирования программного обеспечения. Нажмите кнопку "Mark".
-[start=5]
+
. Происходит автоматический возврат к экрану "Synaptic Package Manager", на котором представлены выбранные пакеты, отмеченные для установки.
-[start=6]
+
. На панели инструментов выберите "Apply". Появится экран "Apply the following changes summary" со списком пакетов, выбранных для установки. Нажмите кнопку "Apply".
-[start=7]
+
. После успешного завершения загрузки и установки появляется экран "Changes applied". Выберите "Close" (Закрыть).
NOTE: Модули также можно установить путем запуска следующей команды в окне 'Терминал': ``aptitude install php5-dev php-pear``
-[start=8]
+
. После этого можно загрузить и установить отладчик XDebug. Введите следующую команду в окне "Terminal":
[source,bash]
@@ -321,10 +323,10 @@
----
При появлении запроса введите пароль, определенный для пользователя root во время установки операционной системы.
-[start=2]
+
. Откройте файл ``/etc/php5/apache2/php.ini`` .
-[start=3]
+
. Добавьте в файл следующие строки:
[source,ini]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_zh_CN.asciidoc
index 2bdc022..df76047 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu_zh_CN.asciidoc
@@ -158,7 +158,9 @@
1. 要
启动终端,请选择“应用程序”>“附件”>“终端”。此时将打开“终端”窗口。
-2. 要将默认虚拟主机的配置文件复制到新文件 ( ``mysite`` ),请在命令提示符下键入以下命令:
+
+[start=2]
+. 要将默认虚拟主机的配置文件复制到新文件 ( ``mysite`` ),请在命令提示符下键入以下命令:
[source,bash]
----
@@ -166,7 +168,7 @@
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
----
-[start=3]
+
. 运行 ``
gedit`` 应用程序并在其中编辑新配置文件 ( ``mysite`` ):
@@ -177,7 +179,7 @@
----
如果系统询问,请输入操作系统安装过程中为超级用户指定的口令。
-[start=4]
+
. 更改文档根目录以指向新位置:
[source,bash]
@@ -186,7 +188,7 @@
/home/<user>/public_html/
----
-[start=5]
+
. 更改目录指令,将
[source,bash]
@@ -205,7 +207,7 @@
image::images/ubuntu-change-directory-root.png[]
-[start=6]
+
. 保存文件 ``mysite``
@@ -219,7 +221,7 @@
sudo a2dissite default && sudo a2ensite mysite
----
-[start=2]
+
. 重新启动 Apache HTTP 服务器:
[source,bash]
@@ -242,7 +244,7 @@
----
此时将显示 MySQL 命令提示符。
-[start=2]
+
. 在命令提示符下输入以下命令并按 Enter 键:
[source,sql]
@@ -280,22 +282,22 @@
* php-pear
对于每一项,从上下文菜单中选择“Mark for installation”。
-[start=4]
+
. 打开“Mark additional required changes”对话框打开,其中具有相关包的列表,这些包也应该进行安装,以使软件能够正常工作。单击“Mark”。
-[start=5]
+
. 系统将返回到“Synaptic Package Manager”面板,其中所选的软件包已标记为要安装。
-[start=6]
+
. 选择工具栏上的“Apply”。此时将打开“Apply the following changes”概要面板,其中具有选择安装的包列表。单击“Apply”。
-[start=7]
+
. 成功完成下载和安装之后,“Changes applied”面板将会打开。单击 "Close"(关闭)。
NOTE: 您也可以通过在“终端”窗口中运行以下命令来安装这些模块: ``aptitude install php5-dev php-pear``
-[start=8]
+
. 现在,您可以下载并安装 XDebug。在“终端”窗口中输入以下命令:
[source,bash]
@@ -318,10 +320,10 @@
----
如果系统询问,请输入操作系统安装过程中为超级用户指定的口令。
-[start=2]
+
. 打开文件 ``/etc/php5/apache2/php.ini`` 。
-[start=3]
+
. 将以下行添加到此文件中:
[source,bash]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc
index 7baa9d2..7085cb9 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc
@@ -87,7 +87,7 @@
On Microsoft Vista, the User Access Control feature blocks the PHP installer from updating the Apache httpd configuration. Disable UAC while you are installing XAMPP. See link:http://support.microsoft.com/kb/922708[+Microsoft support+] for more information.
-[start=3]
+
. You are given the option to install the Apache server and the MySQL database server as services. If you install the Apache Server and MySQL as services, you will not have to start them manually through the XAMP Control Panel. Note that you have the option to install or uninstall these services in the <<xamppConstolPanel,XAMPP Control Panel>>.
. If you are using the self-extracting archive, after the archive is extracted, run the file ``setup-xampp.bat`` to configure the components of the package. (The XAMPP installer runs this file automatically.)
. After configuration, open the XAMP Control Panel. (You can open it manually by running the file ``XAMPP_HOME/xampp-control.exe`` or from the Xampp Control Panel icon that is automatically placed on your desktop.) When you open the XAMPP Control Panel, note that the modules that are installed as services are already running.
@@ -98,7 +98,7 @@
image::images/xampp-control-panel.png[]
-[start=6]
+
. The Svc checkboxes indicate that a module is installed as a Windows service and will start automatically on system startup. You can install or uninstall Windows services by selecting or unselecting the Svc checkbox. Uninstalling a Windows service does not uninstall the module, but it does require you to start the module manually. The XAMPP control panel includes buttons for stopping and starting modules and opening their administration consoles.
==== Checking XAMPP Installation
@@ -107,7 +107,7 @@
image::images/xampp-welcome-page.png[]
-[start=2]
+
. To ensure that the Apache and MySQL servers have been installed as system services, restart your operating system, run the browser, and enter the ``http://localhost`` URL again. The XAMPP welcome page opens. Note that the XAMPP welcome page includes a menu in the left margin through which you can check the status of XAMPP components and run ``phpinfo()`` , among other useful features. ``phpinfo()`` returns a screen with configuration information about your XAMPP components.
image::images/xampp-phpinfo.png[]
@@ -139,7 +139,7 @@
----
-[start=4]
+
. To attach
XDebug to the PHP engine, uncomment the following lines in the ``php.ini`` files (directly beneath the [Zend] section, add them if not there). Some additional notes have been added.
@@ -156,7 +156,7 @@
NOTE: Make sure the paths you specify match the location of the corresponding files as determined during your installation.
-[start=5]
+
. Save ``php.ini`` .
. Run the <<xamppConstolPanel,XAMPP Control Panel Application>> and restart the Apache server.
See link:http://wiki.netbeans.org/HowToConfigureXDebug[+our wiki+] and the link:http://www.xdebug.org/docs/install[+XDebug documentation+] for more information on how to configure XDebug.
@@ -186,7 +186,7 @@
On Microsoft Vista, do not install the Apache Server to the default location, which is in Program Files. All files in Program Files are write-protected.
-[start=3]
+
. When the installation is completed, restart the Apache server.
. To check that the installation is successful, run the browser and enter the following URL:
@@ -218,7 +218,7 @@
NOTE: If there is no installer available for the version of PHP you want to install, you have to install it manually from the .zip file. See link:http://php.net/manual/en/install.windows.manual.php[+Manual Instruction Steps+] in the php.net documentation.
-[start=2]
+
. When the download is complete, run the ``.msi`` installation file. The installation wizard starts.
. On the Apache Configuration Directory panel, specify the directory where the ``httpd.conf`` file is located, the default setting is ``C:\Program Files\Apache Software Foundation\Apache<version>\conf\`` . The PHP processing will be enabled automatically.
. If you want to use the MySQL database server, choose the Complete installation option or select the MySQL and MySQLi items in the Extensions list.
@@ -252,7 +252,7 @@
AddType Application/x-httpd-php .php
LoadModule php5_module "c:/php/sapi/php5apache2_2.dll"
----
-[start=3]
+
. If the lines are missing, add them, save ``httpd.conf`` , and restart Apache.
. Refresh the http://localhost:<port>/test.php page.
@@ -315,7 +315,7 @@
NOTE: Make sure the paths you specify match the names and locations of the corresponding files as determined during your installation.
-[start=3]
+
. To be sure that previously installed PHP engine supports using the MySQL database server:
1. Click Start > Control Panel.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ja.asciidoc
index 9da1a3c..0540084 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ja.asciidoc
@@ -90,13 +90,13 @@
Microsoft Vistaの場合、ユーザー・アクセス制御機能により、PHPインストーラはApache httpdの構成を更新できません。XAMPPをインストールしている間は、UACを無効にします。詳細は、link:http://support.microsoft.com/kb/922708[+Microsoftのサポート+]を参照してください。
-[start=3.]
+
. ApacheサーバーとMySQLデータベース・サーバーをサービスとしてインストールするオプションがあります。ApacheサーバーとMySQLをサービスとしてインストールすると、これらをXAMPPコントロール・パネルから手動で起動する必要がありません。サービスは、<<xamppConstolPanel,XAMPPコントロール・パネル>>でインストールまたはアンインストールできます。
-[start=4.]
+
. 自己抽出型アーカイブを使用する場合は、アーカイブの抽出後に ``setup-xampp.bat`` ファイルを実行して、パッケージのコンポーネントを構成します。(XAMPPのインストーラではこのファイルが自動的に実行されます。)
-[start=5.]
+
. 構成が完了したら、XAMPPコントロール・パネルを開きます。(これを開くには、 ``XAMPP_HOME/xampp-control.exe`` ファイルを手動で実行するか、デスクトップに自動的に配置されるXAMPPコントロール・パネルのアイコンを使用します。)XAMPPコントロール・パネルを開くとき、サービスとしてインストールされたモジュールはすでに実行されています。
*警告:* Windows Vistaでは、 ``xampp-control.exe`` が実行されない場合があります。かわりに ``xampp-start.exe`` を実行できます。
@@ -106,7 +106,7 @@
image::images/xampp-control-panel.png[]
-[start=6.]
+
. 「サービス」チェックボックスは、モジュールがWindowsのサービスとしてインストールされ、システムの起動時に自動的に起動することを示します。「サービス」チェックボックスを選択または選択解除することで、Windowsのサービスをインストールまたはアンインストールできます。Windowsのサービスをアンインストールしても、モジュールはアンインストールされませんが、モジュールを手動で起動する必要があります。XAMPPコントロール・パネルには、モジュールを停止または起動したり、その管理コンソールを開くためのボタンがあります。
@@ -117,7 +117,7 @@
image::images/xampp-welcome-page.png[]
-[start=2.]
+
. ApacheおよびMySQLサーバーがシステム・サービスとしてインストールされていることを確認するには、オペレーティング・システムを再起動してブラウザを起動し、もう一度URLに ``http://localhost`` と入力します。XAMPPの開始ページが開きます。XAMPPの開始ページの左マージンにはメニューが表示されており、これらのメニューを使用して様々な便利機能の中から、XAMPPコンポーネントのステータスを確認したり、 ``phpinfo()`` を実行したりできます。 ``phpinfo()`` は、XAMPPコンポーネントの構成情報が表示された画面を返します。
image::images/xampp-phpinfo.png[]
@@ -151,7 +151,7 @@
----
-[start=4.]
+
. XDebugをPHPエンジンにアタッチするには、 ``php.ini`` ファイルで次の行のコメントを解除します(これらの行は[Zend]セクションのすぐ下にあり、ない場合は追加します)。追加のコメントがいくつか追加されています。
[source,ini]
@@ -168,10 +168,10 @@
NOTE: 指定するパスは、インストール時に定義した対応するファイルの場所と一致していることを確認してください。
-[start=5.]
+
. ``php.ini`` を保存します。
-[start=6.]
+
. <<xamppConstolPanel,XAMPPコントロール・パネル・アプリケーション>>を実行し、Apacheサーバーを再起動します。
XDebugの構成方法の詳細は、link:http://wiki.netbeans.org/HowToConfigureXDebug[+Wiki+]およびlink:http://www.xdebug.org/docs/install[+XDebugのドキュメント+]を参照してください。
@@ -204,10 +204,10 @@
Microsoft Vistaでは、Apacheサーバーをデフォルトの場所である「Program Files」にインストールしないでください。「Program Files」内のファイルはすべて書込み保護されます。
-[start=3.]
+
. インストールが完了したら、Apacheサーバーを再起動します。
-[start=4.]
+
. インストールが正常に終了したことを確認するには、ブラウザを起動し、次のURLを入力します。
[source,ini]
@@ -241,19 +241,19 @@
*重要: *インストールするPHPバージョンのインストーラがない場合は、.zipファイルから手動でインストールする必要があります。php.netドキュメントのlink:http://php.net/manual/en/install.windows.manual.php[+手動による手順+]を参照してください。
-[start=2.]
+
. ダウンロードが完了したら、 ``.msi`` インストール・ファイルを実行します。インストール・ウィザードが起動します。
-[start=3.]
+
. 「Apache Configuration Directory」パネルで、 ``httpd.conf`` があるディレクトリを指定します(デフォルトの設定は、 ``C:\Program Files\Apache Software Foundation\Apache<version>\conf\`` です)。PHP処理が自動的に有効になります。
-[start=4.]
+
. MySQLデータベース・サーバーを使用する場合は、「Complete」インストール・オプションを選択するか、「Extensions」リストでMySQLとMySQLiの項目を選択します。
-[start=5.]
+
. インストールが完了した後、Apacheサーバーを再起動します。
-[start=6.]
+
. PHPエンジンが正常にインストールされていること、およびApache構成でPHP処理が有効になっていることを確認するには:
* メモ帳または他のテキスト・エディタを開きます。ファイルを作成し、次のテキストを入力します。
@@ -284,10 +284,10 @@
LoadModule php5_module "c:/php/sapi/php5apache2_2.dll"
----
-[start=3.]
+
. 行が見つからない場合は行を追加し、 ``httpd.conf`` を保存してApacheを再起動します。
-[start=4.]
+
. http://localhost:<port>/test.phpのページをリフレッシュします。
@@ -305,10 +305,10 @@
=== 環境の設定
-[start=1.]
+
. デフォルトの設定に従ってインストールを実行した場合、PHP処理は自動的に有効になります。
-[start=2.]
+
. XDebugをPHPエンジンにアタッチするには、 ``php.ini`` ファイルを検索して次の行を追加します。
*スレッド・セーフ*なPHP 5.2エンジンの場合:
@@ -356,7 +356,7 @@
NOTE: 指定するパスは、インストール時に定義した対応するファイルの名前および場所と一致していることを確認してください。
-[start=3.]
+
. 前にインストールしたPHPエンジンがMySQLデータベース・サーバーの使用をサポートしていることを確認するには:
1. 「スタート」>「コントロール パネル」をクリックします。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_pt_BR.asciidoc
index 8a7cdbb..5580c25 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_pt_BR.asciidoc
@@ -90,13 +90,13 @@
No Microsoft Vista, a funcionalidade Controle de Acesso do Usuário impede que o instalador do PHP atualize a configuração do httpd Apache. Desative o UAC ao instalar o XAMPP. Consulte o link:http://support.microsoft.com/kb/922708[+Suporte da Microsoft+] para obter mais informações.
-[start=3.]
+
. Você tem a opção de instalar o servidor Apache e o servidor de banco de dados MySQL como serviços. Se instalar o Servidor Apache e o MySQL como serviços, não terá que iniciá-los manualmente pelo Painel de Controle do XAMPP. Observe que você tem a opção de instalar ou desinstalar esses serviços no <<xamppConstolPanel,Painel de Controle do XAMPP>>.
-[start=4.]
+
. Se estiver utilizando o arquivo compactado autoextraível, depois de ele ter sido extraído, execute o arquivo ``setup-xampp.bat`` para configurar os componentes do pacote. (O instalador do XAMPP executa automaticamente o arquivo).
-[start=5.]
+
. Após configurar, abra o Painel de Controle do XAMPP. (Você pode abri-lo manualmente executando o arquivo ``XAMPP_HOME/xampp-control.exe`` ou a partir do ícone Painel de Controle do Xampp, que é automaticamente colocado em sua área de trabalho.) Ao abrir o Painel de Controle do XAMPP, observe que os módulos instalados como serviços já estão em execução.
*Advertência: *algumas vezes, no Windows Vista, o ``xampp-control.exe`` não será executado. No lugar dele, você pode executar o ``xampp-start.exe`` .
@@ -106,7 +106,7 @@
image::images/xampp-control-panel.png[]
-[start=6.]
+
. As caixas de seleção Svc indicam que um módulo está instalado como um serviço do Windows e será automaticamente iniciado na inicialização do sistema. Você pode instalar ou desinstalar os serviços do Windows marcando ou desmarcando a caixa de seleção Svc. A desinstalação de um serviço do Windows não desinstala o módulo, mas requer a inicialização manual do módulo. O painel de controle do XAMPP inclui botões para parar e iniciar módulos e para abrir seus consoles de administração.
@@ -117,7 +117,7 @@
image::images/xampp-welcome-page.png[]
-[start=2.]
+
. Para garantir que os servidores Apache e MySQL tenham sido instalados como serviços do sistema, reinicie o sistema operacional, execute o browser e digite o URL ``http://localhost`` novamente. A página de boas-vindas do XAMPP será aberta. Observe se a página de boas-vindas do XAMPP inclui um menu na margem esquerda, por meio do qual você pode verificar o status dos componentes do XAMPP e executar o ``phpinfo()`` , entre outras funcionalidades úteis. O ``phpinfo()`` retornará uma tela com informações de configuração sobre os componentes do XAMPP.
image::images/xampp-phpinfo.png[]
@@ -151,7 +151,7 @@
----
-[start=4.]
+
. Para anexar
XDebug ao mecanismo PHP, remova o comentário das linhas a seguir nos arquivos ``php.ini`` (diretamente abaixo da seção [Zend], adicione-os caso não estejam presentes). Algumas notas adicionais foram acrescentadas.
@@ -169,10 +169,10 @@
NOTE: certifique-se de que os caminhos especificados coincidam com o local dos arquivos correspondentes, conforme determinado durante a instalação.
-[start=5.]
+
. Salve o ``php.ini`` .
-[start=6.]
+
. Execute a <<xamppConstolPanel,Aplicação Painel de Controle do XAMPP>> e reinicie o servidor Apache.
Consulte link:http://wiki.netbeans.org/HowToConfigureXDebug[+nosso wiki+] e a link:http://www.xdebug.org/docs/install[+documentação do XDebug+] para obter mais informações sobre como configurar o XDebug.
@@ -205,10 +205,10 @@
No Microsoft Vista, não instale o Servidor Apache na localização default, que é Arquivos de Programas. Todos os arquivos em Arquivos de Programas estão protegidos contra gravação.
-[start=3.]
+
. Quando a instalação tiver sido concluída, reinicie o servidor Apache.
-[start=4.]
+
. Para verificar se a instalação foi bem-sucedida, execute o browser e insira o seguinte URL:
[source,ini]
@@ -238,25 +238,25 @@
=== Mecanismo PHP
-[start=1.]
+
. Faça download do link:http://windows.php.net/download/[+instalador binário do Windows+] para a versão PHP5 de sua escolha.
*Importante: *se não houver um instalador disponível na versão do PHP que você deseja instalar, instale-o manualmente pelo arquivo .zip. Consulte link:http://php.net/manual/en/install.windows.manual.php[+Etapas de Instrução Manual+] na documentação do php.net.
-[start=2.]
+
. Quando o download estiver concluído, execute o arquivo de instalação ``.msi`` . O assistente de instalação é iniciado.
-[start=3.]
+
. No painel Diretório de Configuração do Apache, especifique o diretório onde o arquivo ``httpd.conf`` está localizado, a definição default é ``C:\Arquivos de Programas\Apache Software Foundation\Apache<versão>\conf\`` . O processamento do PHP será ativado automaticamente.
-[start=4.]
+
. Se você desejar utilizar o servidor de banco de dados MySQL, escolha a opção de instalação Completa ou selecione os itens MySQL e MySQLi na lista Extensões.
-[start=5.]
+
. Depois que a instalação tiver sido concluída, reinicie o servidor Apache.
-[start=6.]
+
. Para verificar se o mecanismo PHP foi instalado com êxito e o processamento do PHP foi ativado na configuração do Apache:
* Abra o Bloco de Notas ou outro editor de texto. Crie um arquivo e digite o texto a seguir:
@@ -287,10 +287,10 @@
LoadModule php5_module "c:/php/sapi/php5apache2_2.dll"
----
-[start=3.]
+
. Se as linhas estiverem ausentes, adicione-as, salve o ``httpd.conf`` e reinicie o Apache.
-[start=4.]
+
. Atualize a página http://localhost:<port>/test.php.
@@ -356,7 +356,7 @@
NOTE: certifique-se de que os caminhos especificados coincidam com os nomes e os locais dos arquivos correspondentes, conforme determinado durante a instalação.
-[start=3.]
+
. Para ter certeza de que o mecanismo PHP instalado anteriormente suporte a utilização do servidor de banco de dados MySQL:
1. Clique em Iniciar > Painel de Controle.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ru.asciidoc
index 4269702..1aa04ce 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_ru.asciidoc
@@ -90,13 +90,13 @@
В Microsoft Vista функция контроля учетных записей пользователей (UAC) блокирует обновление установщиком PHP настройки службы httpd Apache. На время установки XAMPP следует отключить UAC. Для получения дополнительных сведений обратитесь к разделу link:http://support.microsoft.com/kb/922708[+Поддержка Майкрософт+].
-[start=3]
+
. Можно установить сервер Apache и сервер базы данных MySQL как веб-службы. Если Apache Server и MySQL установлены как службы, то нет необходимости запускать их вручную с помощью "XAMP Control Panel". Следует учитывать, что установить и удалить эти службы можно с помощью <<xamppConstolPanel,панели управления XAMPP>>.
-[start=4]
+
. При использовании самораспаковывающегося архива после его распаковки запустите файл ``setup-xampp.bat`` для настройки компонентов пакета. Программа установки XAMPP запускает этот файл автоматически.
-[start=5]
+
. После настройки откройте панель управления XAMP. Эту панель можно открыть посредством запуска файла ``XAMPP_HOME/xampp-control.exe`` или с помощью значка панель управления XAMPP, автоматически размещаемого на рабочем столе. При открытии панели управления XAMPP следует учитывать, что модули, установленные как службы, уже выполняются.
*Предупреждение. *Иногда в Windows Vista не удается запустить файл ``xampp-control.exe`` . В этом случае можно запустить ``xampp-start.exe`` .
@@ -106,7 +106,7 @@
image::images/xampp-control-panel.png[]
-[start=6]
+
. Флажки "Svc" указывают на то, что модуль устанавливается как служба Windows и автоматически выполняется при запуске системы. Службы Windows устанавливаются и удаляются при установке и снятии флажка "Svc". При удалении службы Windows сам модуль не удаляется, однако необходимо запускать его вручную. Панель управления XAMPP включает в себя кнопки запуска и остановки модулей, а также открытия их консолей администратора.
@@ -117,7 +117,7 @@
image::images/xampp-welcome-page.png[]
-[start=2]
+
. В целях обеспечения установки серверов Apache и MySQL в качестве служб системы перезапустите операционную систему, запустите браузер и повторно введите URL-адрес ``http://localhost`` . Откроется страница приветствия XAMPP. Обратите внимание на то, что в левом поле страницы приветствия XAMPP имеется меню, посредством которого можно проверить состояние компонентов XAMPP, запустить ``phpinfo()`` , а также воспользоваться другими важными функциями. При выполнении ``phpinfo()`` возвращается экран с информацией о настройке компонентов XAMPP.
image::images/xampp-phpinfo.png[]
@@ -151,7 +151,7 @@
----
-[start=4]
+
. Для присоединения
XDebug к механизму PHP раскомментируйте следующие строки в файлах ``php.ini`` (добавьте эти строки непосредственно в разделе [Zend]), если они отсутствуют. Добавлены дополнительные примечания.
@@ -169,10 +169,10 @@
NOTE: Убедитесь в том, что указанные пути соответствуют расположению соответствующих файлов, как это определено при установке.
-[start=5]
+
. Сохраните файл ``php.ini`` .
-[start=6]
+
. Запустите <<xamppConstolPanel,панель управления XAMPP>> и перезапустите сервер Apache.
Дополнительные сведения о настройке XDebug приведены на link:http://wiki.netbeans.org/HowToConfigureXDebug[+вики-странице+] и в link:http://www.xdebug.org/docs/install[+документации по XDebug+].
@@ -200,19 +200,19 @@
=== Сервер HTTP Apache
-[start=1]
+
. Загрузите link:http://httpd.apache.org/download.cgi[+сервер HTTP Apache2+].
-[start=2]
+
. Запустите установочный файл ``.msi`` . Запускается мастер установки. Следуйте указаниям.
В Microsoft Vista не следует устанавливать Apache Server в местоположение по умолчанию, находящееся в папке "Program Files". Все файлы в папке "Program Files" защищены от записи.
-[start=3]
+
. По завершении установки перезапустите сервер Apache.
-[start=4]
+
. Для проверки успешности установки запустите браузер и введите следующий URL-адрес:
[source,ini]
@@ -246,19 +246,19 @@
*Важно.*Если установщик для нужной версии PHP отсутствует, установите ее вручную из файла .zip. См. раздел link:http://php.net/manual/en/install.windows.manual.php[+Этапы ручной установки+] в документации php.net.
-[start=2]
+
. По завершении загрузки запустите установочный файл ``.msi`` . Запускается мастер установки.
-[start=3]
+
. На экране "Каталог конфигурации Apache" укажите каталог, в котором расположен файл ``httpd.conf`` (по умолчанию используется каталог ``C:\Program Files\Apache Software Foundation\Apache<version>\conf\`` ). Обработка кода PHP включается автоматически.
-[start=4]
+
. При необходимости использования сервера базы данных MySQL выберите вариант "Полная установка" или выберите элементы MySQL и MySQLi в списке "Расширения".
-[start=5]
+
. После завершения установки перезапустите сервер Apache.
-[start=6]
+
. Для проверки успешности установки механизма PHP и включения обработки кода PHP в настройке Apache выполните следующие действия:
* Откройте блокнот или любой другой текстовый редактор. Создайте файл и введите следующий текст:
@@ -289,10 +289,10 @@
LoadModule php5_module "c:/php/sapi/php5apache2_2.dll"
----
-[start=3]
+
. Если эти строки отсутствуют, добавьте их, сохраните ``httpd.conf`` и перезапустите сервер Apache.
-[start=4]
+
. Обновите страницу http://localhost:<port>/test.php.
@@ -358,7 +358,7 @@
NOTE: Убедитесь в том, что указанные пути соответствуют именам и расположению соответствующих файлов, как это определено при установке.
-[start=3]
+
. Для проверки того, что предварительно установленный механизм PHP поддерживает использование сервера базы данных MySQL выполните следующие действия:
1. Выберите команду "Пуск" > "Панель управления".
diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_zh_CN.asciidoc
index 85839cd..838ec0d 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows_zh_CN.asciidoc
@@ -90,13 +90,13 @@
在 Microsoft Vista 上,“用户访问控制”功能会阻止 PHP 安装程序更新 Apache httpd 配置。在安装 XAMPP 时请禁用 UAC。有关详细信息,请参见 link:http://support.microsoft.com/kb/922708[+Microsoft 支持+]。
-[start=3]
+
. 您可以选择作为服务安装 Apache 服务器和 MySQL 数据库服务器。如果将 Apache 服务器和 MySQL 作为服务进行安装,则您将不必通过 XAMPP 控制面板来手动启动它们。请注意,您可以在 <<xamppConstolPanel,XAMPP 控制面板>>中选择安装或卸载这些服务。
-[start=4]
+
. 如果您使用的是自解压档案文件,请在解压缩该档案文件之后,运行 ``setup-xampp.bat`` 文件以配置该包的组件。(XAMPP 安装程序会自动运行此文件。)
-[start=5]
+
. 配置之后,打开 XAMPP 控制面板。(您可以通过运行 ``XAMPP_HOME/xampp-control.exe`` 文件或通过自动置于桌面上的 XAMPP 控制面板图标手动打开该控制面板。)在打开 XAMPP 控制面板时,请注意作为服务安装的模块是否已在运行。
*警告:*在 Windows Vista 上,有时 ``xampp-control.exe`` 不会运行。这时您可以运行 ``xampp-start.exe`` 。
@@ -106,7 +106,7 @@
image::images/xampp-control-panel.png[]
-[start=6]
+
. "Svc" 复选框指示模块是作为 Windows 服务安装的,并且将在系统启动时自动启动。您可以通过选中或取消选中 "Svc" 复选框来安装或卸载 Windows 服务。卸载 Windows 服务不会卸载模块,但之后您需要手动启动该模块。XAMPP 控制面板包括用于停止和启动模块以及打开这些模块的管理控制台的按钮。
@@ -117,7 +117,7 @@
image::images/xampp-welcome-page.png[]
-[start=2]
+
. 要确保 Apache 和 MySQL 服务器已作为系统服务安装,请重新启动您的操作系统,再运行浏览器,然后再次输入 ``http://localhost`` URL。XAMPP 欢迎页面打开。请注意,XAMPP 欢迎页面在左旁注中包含一个菜单,您可以通过此菜单检查 XAMPP 组件的状态,运行 ``phpinfo()`` ,以及实现其他有用的功能。 ``phpinfo()`` 会返回一个屏幕,其中显示关于 XAMPP 组件的配置信息。
image::images/xampp-phpinfo.png[]
@@ -151,7 +151,7 @@
----
-[start=4]
+
. 要将
XDebug 附加到 PHP 引擎,请在 ``php.ini`` 文件中取消对以下行(恰好位于 [Zend] 部分下面;如果没有,请添加它们)的注释。已另外添加一些注释。
@@ -169,10 +169,10 @@
NOTE: 请确保您指定的路径与安装过程中所确定的相应文件的位置匹配。
-[start=5]
+
. 保存 ``php.ini`` 。
-[start=6]
+
. 运行 <<xamppConstolPanel,XAMPP Control Panel Application(XAMPP 控制面板应用程序)>>并重新启动 Apache 服务器。
有关如何配置 XDebug 的详细信息,请参见link:http://wiki.netbeans.org/HowToConfigureXDebug[+我们的 wiki+] 和 link:http://www.xdebug.org/docs/install[+XDebug 文档+]。
@@ -205,10 +205,10 @@
在 Microsoft Vista 上,不要将 Apache 服务器安装到 Program Files 中的默认位置。Program Files 中的所有文件均具有写保护。
-[start=3]
+
. 安装完成后,重新启动 Apache 服务器。
-[start=4]
+
. 要检查安装是否成功,请运行浏览器,然后输入以下 URL:
[source,ini]
@@ -242,19 +242,19 @@
*重要信息:*如果没有安装程序适用于您要安装的 PHP 版本,则必须手动从 .zip 文件中安装它。请参见 php.net 文档中的link:http://php.net/manual/en/install.windows.manual.php[+手动指令步骤+]。
-[start=2]
+
. 下载完成后,运行 ``.msi`` 安装文件。此时将启动安装向导。
-[start=3]
+
. 在“Apache 配置目录”面板上,指定 ``httpd.conf`` 文件所在的目录,默认设置是 ``C:\Program Files\Apache Software Foundation\Apache<version>\conf\`` 。PHP 处理将自动启用。
-[start=4]
+
. 如果您要使用 MySQL 数据库服务器,请选择“完全”安装选项,或在“扩展”列表中选择 "MySQL" 和 "MySQLi" 项。
-[start=5]
+
. 安装完成后,请重新启动 Apache 服务器。
-[start=6]
+
. 要检查 PHP 引擎是否已成功安装,以及是否在 Apache 配置中启用了 PHP 处理,请执行以下操作:
* 打开记事本或其他文本编辑器。创建一个文件并键入以下文本:
@@ -285,10 +285,10 @@
LoadModule php5_module "c:/php/sapi/php5apache2_2.dll"
----
-[start=3]
+
. 如果缺少以上几行,请添加它们,并保存 ``httpd.conf`` ,然后重新启动 Apache。
-[start=4]
+
. 刷新 http://localhost:<port>/test.php 页面。
@@ -306,10 +306,10 @@
=== 设置环境
-[start=1]
+
. 如果按照默认设置安装,则系统会自动启用 PHP 处理。
-[start=2]
+
. 要将
XDebug 附加到 PHP 引擎,请找到 ``php.ini`` 文件,并在其中添加以下几行:
@@ -358,7 +358,7 @@
NOTE: 请确保您指定的路径与安装过程中所确定的相应文件的名称和位置匹配。
-[start=3]
+
. 要确保先前安装的 PHP 引擎支持使用 MySQL 数据库服务器,请执行以下操作:
1. 单击“开始”>“控制面板”。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/debugging.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/debugging.asciidoc
index d2e6ea0..db6b8aa 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/debugging.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/debugging.asciidoc
@@ -240,16 +240,16 @@
3. In the Projects window, navigate to the current project node, click the right mouse button, and choose Debug from the popup menu. The IDE opens the Debugger windows and runs the project in the debugger until the breakpoint is reached.
NOTE: If the current project is set as Main, you can choose Debug > Debug Main Project, or press Ctrl-F5, or click image:images/debug-main-project-button.png[].
-[start=4]
+
. Switch to the Local Variables window. The window shows all the variables that have been initialized within the current function, their types, and values.
-[start=5]
+
. To view the value of a variable outside the function, bring the cursor on an occurrence of the variable. The tooltip shows the variable value.
-[start=6]
+
. To execute the program line by line including the lines within all the called functions, press F7 or choose Debug > Step Into and watch the changes to the variables' values in the Local Variables window.
-[start=7]
+
. To check the logic of the program by watching the changes of expressions, define a new watch:
1. To open the Watches window, choose Window > Debugging > Watches or press Ctrl-Shift-2. The Watches window opens.
@@ -261,22 +261,22 @@
*Important:* You must enable watches in the <<options,Debugging tab of PHP Options>> in order to set watches.
-[start=8]
+
. To cancel the line by line execution of the code within a function and spring to the next line after the function call, press Ctrl-F7/⌘-F7 or choose Debug > Step Out.
-[start=9]
+
. To skip the line by line execution of the code in a function, get the value returned by the function, and spring to the next line after the function call, press F8 or choose Debug > Step Over.
-[start=10]
+
. To pause the debugging session, choose Debug > Pause.
-[start=11]
+
. To continue the debugging session, choose Debug > Continue or press image:images/continue-debugging-session.png[].
-[start=12]
+
. To cancel the debugging session, press image:images/stop-debugging-session.png[].
-[start=13]
+
.
When the program reaches the end, the debugger windows close.
@@ -291,10 +291,10 @@
* Run configuration - Local Web Site
Find more details about setting up a PHP project in the document link:project-setup.html[+Setting Up a PHP Project+].
-[start=2]
+
. To enable the use of hotkeys during the session, position the cursor on the project node and choose Set as Main Project from the popup menu.
-[start=3]
+
. In the ``index.php`` file, enter the following code:
[source,php]
@@ -337,7 +337,7 @@
* The ``calcualte_sum ()`` function
* The ``calculate_sum_of_factorials ()`` function that calls the ``calculate_factorial`` function twice, then calls the ``calcualte_sum ()`` function once, and returns the calculated sum of factorials.
-[start=4]
+
. Set a breakpoint (Ctrl-F8/⌘-F8) at the beginning of the PHP block:
[source,php]
@@ -346,16 +346,16 @@
<?php
----
-[start=5]
+
. To start debugging, click image:images/debug-main-project-button.png[]. The debugger stops at the breakpoint.
-[start=6]
+
. Press F7 three times. The debugger stops at the line where the function ``calculate_sum_of_factorials ()`` is called. The Local Variables window shows the variables ``$m`` and ``$n`` with their values:
image::images/degugger-stopped-at-function-call.png[]
-[start=7]
+
. To step into the function ``calculate_sum_of_factorials()`` , press F7. The debugger starts to execute the code within the function ``calculate_sum_of_factorials ()`` and stops at the call of the function ``calculate_factorial()`` .
image::images/call-of-embedded-function.png[]
@@ -365,44 +365,44 @@
image::images/variables-inside-function-call-another-function.png[]
-[start=8]
+
. Press F7. The debugger starts to execute the code with the function ``calculate_factorial()`` . The Call Stack window shows the stack of calls to the functions in the reverse order with the last called function at the top of the list:
image::images/call-stack.png[]
-[start=9]
+
. Press F7 to step into the loop. View the values of the variables in the Variables window.
image::images/local-variables-inside-loop.png[]
-[start=10]
+
. When you make sure that the code works correctly, press Ctrl-F7/⌘-F7 to cancel the function execution. The program returns to the line next after the call of the function ``calculate_factorial()`` .
NOTE: Alternatively, you can press F7 until the program completes execution of the function ``calculate_factorial()`` . You will also return to the line next after its call.
image::images/call-of-embedded-function-second-time.png[]
-[start=11]
+
. Because you have just checked the function ``calculate_factorial()`` and know that it works correctly, you can skip its execution ("step over"). To step over, press F8. The program stops at the call of the function ``calculate_sum()`` .
image::images/cal-of-embedded-function-calculate-sum.png[]
-[start=12]
+
. To step into the function ``calculate_sum()`` , press F7.
-[start=13]
+
. To step over, press F8. In either case the debugger stops at the last line in the function ``calculate_sum_of_factorials()`` .
image::images/return-result.png[]
-[start=14]
+
. Press F7. The debugger moves to the line with the ``echo`` statement.
-[start=15]
+
. Press F7 till the debugger exits the program. The browser window opens and shows the result of program execution:
image::images/program-output.png[]
@@ -422,10 +422,10 @@
----
Suppose that this resulted from misspelling but actually you need to calculate sum.
-[start=2]
+
. Choose Debug > New Watch or press Ctrl/⌘-shift-F7. The New Watch window opens.
-[start=3]
+
. Enter the following expression and click OK.
[source,php]
@@ -435,7 +435,7 @@
----
The new expression appears in the Watches window.
-[start=4]
+
. Run the debugging session. When the debugger stops at the line
[source,php]
@@ -470,7 +470,7 @@
Find more information about link:wish-list-lesson2.html#htmlForm[+HTML input forms+].
-[start=2]
+
. Replace the following lines at the top of the <?php ?> block:
[source,php]
@@ -490,16 +490,16 @@
}
----
-[start=3]
+
. Set a breakpoint at the beginning of the <?php ?> block and start the <<debuggingSession,debugging session>>.
-[start=4]
+
. Press F7. The debugger steps into the program. The browser window opens but the input form is not displayed. This is correct behavior of the debugger because it has to pass through the entire source code of a web page before the page can be displayed. Practically, this means that the debugger passes through the code twice. First time the debugger processes the code to display the HTML input form. The second time the debugger executes PHP code step by step.
-[start=5]
+
. Press F7 till the debugger reaches the end of the program and the input form opens.
-[start=6]
+
. Fill in the form and click Enter. The debugging session continues as described in section <<sampleDebuggingSession,Sample Debugging Session>>.
@@ -518,7 +518,7 @@
* Ask Every Time, which has the IDE prompt you for the URL when you start a debugging session.
* Do Not Open Web Browser, which requires you to open the browser and enter the URL manually (you need the GET/POST XDEBUG_SESSION_START variable).
-[start=6]
+
. If you are using a proxy server for debugging, enter the server's host name and port in the Debugger Proxy section.
For more information, please see the link:http://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger[+Path Mapping in PHP Debugger+] post in the Net Beans for PHP blog.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/debugging_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/debugging_ja.asciidoc
index 5bd0250..845c3df 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/debugging_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/debugging_ja.asciidoc
@@ -242,16 +242,16 @@
3. 「プロジェクト」ウィンドウで現在のプロジェクト・ノードに移動し、マウスの右ボタンをクリックして、ポップアップ・メニューから「デバッグ」を選択します。IDEでデバッガ・ウィンドウが開き、ブレークポイントに達するまで、デバッガでプロジェクトが実行されます。
NOTE: 現在のプロジェクトがメインに設定されている場合は、「デバッグ」>「メイン・プロジェクトをデバッグ」を選択するか、[Ctrl]-[F5]を押すか、またはimage:images/debug-main-project-button.png[]をクリックできます。
-[start=4]
+
. 「ローカル変数」ウィンドウに切り替えます。このウィンドウには、現在の関数内で初期化されたすべての変数、その型、および値が表示されます。
-[start=5]
+
. 関数外の変数の値を表示するには、その変数の出現箇所にカーソルを置きます。ツールチップに変数の値が表示されます。
-[start=6]
+
. コールしているすべての関数内の行を含めてプログラムを1行ずつ実行するには、[F7]を押すか、「デバッグ」>「ステップ・イン」を選択して、「ローカル変数」ウィンドウで変数の値の変化をウォッチします。
-[start=7]
+
. 式の変化をウォッチしてプログラムのロジックを確認するには、次の手順で新しいウォッチを定義します。
.. 「ウォッチ」ウィンドウを開くには、「ウィンドウ」>「デバッグ」>「ウォッチ」を選択するか、または[Ctrl]-[Shift]-[2]を押します。「ウォッチ」ウィンドウが開きます。
.. 「ウォッチ」ウィンドウ内の任意の場所でマウスの右ボタンをクリックし、ポップアップ・メニューから「新規ウォッチ」を選択します。「新規ウォッチ」ウィンドウが開きます。
@@ -262,22 +262,22 @@
*重要:* ウォッチを設定するには、<<options,PHPオプションの「デバッグ」タブ>>でウォッチを有効にする必要があります。
-[start=8]
+
. 関数内のコードの1行ずつの実行を取り消して、関数コールの次の行まで移動するには、[Ctrl]-[F7]/[⌘]-[F7]を押すか、または「デバッグ」>「ステップ・アウト」を選択します。
-[start=9]
+
. 関数内のコードを1行ずつ実行しないで、関数から返される値を取得し、関数コールの次の行まで移動するには、[F8]を押すか、または「デバッグ」>「ステップ・オーバー」を選択します。
-[start=10]
+
. デバッグ・セッションを一時休止するには、「デバッグ」>「一時休止」を選択します。
-[start=11]
+
. デバッグ・セッションを続行するには、「デバッグ」>「続行」を選択するか、またはimage:images/continue-debugging-session.png[]を押します。
-[start=12]
+
. デバッグ・セッションを取り消すには、image:images/stop-debugging-session.png[]を押します。
-[start=13]
+
.
プログラムの最後に到達すると、デバッガ・ウィンドウが閉じます。
@@ -292,10 +292,10 @@
* 実行構成 - ローカルWebサイト
PHPプロジェクトの設定については、ドキュメントのlink:project-setup.html[+PHPプロジェクトの設定+]を参照してください。
-[start=2]
+
. セッション中のホット・キーの使用を有効にするには、カーソルをプロジェクト・ノードに置き、ポップアップ・メニューから「メイン・プロジェクトとして設定」を選択します。
-[start=3]
+
. ``index.php`` ファイルに次のコードを入力します。
[source,php]
@@ -339,7 +339,7 @@
* ``calcualte_sum ()`` 関数
* ``calculate_sum_of_factorials ()`` 関数(この関数は、 ``calculate_factorial`` 関数を2回コールしてから ``calcualte_sum ()`` 関数を1回コールし、階乗の和を返します。)
-[start=4]
+
. PHPブロックの先頭にブレークポイントを設定します([Ctrl]-[F8]/[⌘]-[F8])。
[source,php]
@@ -348,16 +348,16 @@
<?php
----
-[start=5]
+
. デバッグを開始するには、image:images/debug-main-project-button.png[]をクリックします。デバッガがブレークポイントで停止します。
-[start=6]
+
. [F7]を3回押します。関数 ``calculate_sum_of_factorials ()`` をコールしている行でデバッガが停止します。「ローカル変数」ウィンドウに、変数 ``$m`` と ``$n`` 、およびそれらの値が表示されます。
image::images/degugger-stopped-at-function-call.png[]
-[start=7]
+
. 関数 ``calculate_sum_of_factorials()`` にステップ・インするには、[F7]を押します。デバッガが関数 ``calculate_sum_of_factorials ()`` 内のコードの実行を開始し、関数 ``calculate_factorial()`` のコールで停止します。
image::images/call-of-embedded-function.png[]
@@ -367,44 +367,44 @@
image::images/variables-inside-function-call-another-function.png[]
-[start=8]
+
. [F7]を押します。デバッガが、関数 ``calculate_factorial()`` からコードの実行を開始します。「コール・スタック」ウィンドウに、関数へのコールのスタックが逆の順序で表示され、最後にコールされた関数がリストの先頭に表示されます。
image::images/call-stack.png[]
-[start=9]
+
. [F7]を押してループにステップ・インします。「変数」ウィンドウに変数の値が表示されます。
image::images/local-variables-inside-loop.png[]
-[start=10]
+
. コードが正常に機能することを確認したら、[Ctrl]-[F7]/[⌘]-[F7]を押して関数の実行を取り消します。プログラムは、関数 ``calculate_factorial()`` のコールの次の行に戻ります。
NOTE: プログラムで関数 ``calculate_factorial()`` の実行が完了するまでは、[F7]を押すこともできます。この場合も、コールの次の行に戻ります。
image::images/call-of-embedded-function-second-time.png[]
-[start=11]
+
. 関数 ``calculate_factorial()`` が正常に機能することを確認できたため、その実行を省略できます(ステップ・オーバー)。ステップ・オーバーするには、[F8]を押します。プログラムは、関数 ``calculate_sum()`` のコールで停止します。
image::images/cal-of-embedded-function-calculate-sum.png[]
-[start=12]
+
. 関数 ``calculate_sum()`` にステップ・インするには、[F7]を押します。
-[start=13]
+
. ステップ・オーバーするには、[F8]を押します。いずれの場合も、デバッガは関数 ``calculate_sum_of_factorials()`` の最後の行で停止します。
image::images/return-result.png[]
-[start=14]
+
. [F7]を押します。デバッガは ``echo`` 文の行に移動します。
-[start=15]
+
. デバッガがプログラムを終了するまで[F7]を押します。ブラウザ・ウィンドウが開き、プログラムの実行結果が表示されます。
image::images/program-output.png[]
@@ -425,10 +425,10 @@
----
実際には和を求める必要がありますが、間違えてこのように入力したとします。
-[start=2]
+
. 「デバッグ」>「新規ウォッチ」を選択するか、または[Ctrl]/[⌘]-[Shift]-[F7]を押します。「新規ウォッチ」ウィンドウが開きます。
-[start=3]
+
. 次の式を入力し、「OK」をクリックします。
[]
@@ -438,7 +438,7 @@
----
新しい式が「ウォッチ」ウィンドウに表示されます。
-[start=4]
+
. デバッグ・セッションを実行します。デバッガが次の行で停止します。
[]
@@ -473,7 +473,7 @@
詳細は、link:wish-list-lesson2.html#htmlForm[+HTML入力フォーム+]を参照してください。
-[start=2]
+
. <?php?>ブロックの先頭で、次の行を置き換えます。
[]
@@ -489,16 +489,16 @@
if (array_key_exists ("first_integer", $_POST) && array_key_exists ("second_integer", $_POST)) {$result = calculate_sum_of_factorials ($_POST["first_integer"], $_POST["second_integer"]);echo "Sum of factorials is " . $result;}
----
-[start=3]
+
. ブレークポイントを<?php?>ブロックの先頭に設定し、<<debuggingSession,デバッグ・セッション>>を開始します。
-[start=4]
+
. [F7]を押します。デバッガがプログラムにステップ・インします。ブラウザ・ウィンドウが開きますが、入力フォームは表示されません。Webページが表示される前に、デバッガがページのソース・コード全体を通過する必要があるため、これはデバッガの正常な動作です。実際には、デバッガがコードを2回通過することを意味します。1回目は、HTML入力フォームを表示するコードがデバッガで処理されます。2回目は、デバッガでPHPコードがステップ実行されます。
-[start=5]
+
. デバッガがプログラムの終わりに達し、入力フォームが開くまで[F7]を押します。
-[start=6]
+
. フォームに入力して[Enter]を押します。デバッグ・セッションは、<<sampleDebuggingSession,デバッグ・セッションの例>>の項に示すように処理を続行します。
@@ -517,7 +517,7 @@
* 毎回聞く: デバッグ・セッションを開始したとき、IDEによってURLの入力が求められます。
* Webブラウザを開かない: ブラウザを開いてURLを手動で入力するようにユーザーに求めます(GET/POST XDEBUG_SESSION_START変数が必要です)。
-[start=6]
+
. デバッグ用のプロキシ・サーバーを使用する場合、「デバッガ・プロキシ」セクションにサーバーのホスト名とポートを入力します。
詳細は、PHP向けのNetBeansブログに投稿されたlink:http://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger[+PHPデバッガでのパス・マッピング+]を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/debugging_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/debugging_pt_BR.asciidoc
index 4e2f671..1001903 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/debugging_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/debugging_pt_BR.asciidoc
@@ -243,16 +243,16 @@
3. Na janela Projetos, navegue para o nó do projeto atual, clique com o botão direito do mouse e selecione Depurar do menu pop-up. O IDE abrirá as janelas do Depurador e executará o projeto no depurador, até que o ponto de interrupção seja atingido.
NOTE: se o projeto atual for definido como Principal, você poderá selecionar Depurar > Depurar Projeto Principal ou pressione Ctrl-F5 ou clique em image:images/debug-main-project-button.png[].
-[start=4]
+
. Alterne para a janela Variáveis Locais. A janela mostra todas as variáveis que foram inicializadas na função atual, seus tipos e valores.
-[start=5]
+
. Para exibir o valor de uma variável fora da função, coloque o cursor em uma ocorrência da variável. A dica de ferramenta mostra o valor da variável.
-[start=6]
+
. Para executar o programa linha a linha, incluindo as linhas de todas as funções chamadas, pressione F7 ou selecione Depurar > Fazer Step Into e observe as alterações nos valores das variáveis na janela Variáveis Locais.
-[start=7]
+
. Para verificar a lógica do programa observando as alterações das expressões, defina um novo watch:
.. Para abrir a janela Watches, selecione Janela > Depuração > Watches ou pressione Ctrl-Shift-2. A janela Watches será aberta.
.. Em qualquer lugar na janela Watches, clique com o botão direito do mouse e selecione Novo Watch do menu pop-up. A Janela Novo Watch será Aberta.
@@ -263,22 +263,22 @@
*Importante:* você precisa ativar os watches na <<options,guia Depuração das Opções PHP>> para poder definir watches.
-[start=8]
+
. Para cancelar a execução linha a linha do código em uma função e passar para a próxima linha depois da chamada da função, pressione Ctrl-F7/⌘-F7 ou selecione Depurar > Fazer Step Out.
-[start=9]
+
. Para ignorar a execução linha a linha do código em uma função, obtenha o valor retornado pela função e passe para a próxima linha depois da chamada da função, pressione F8 ou selecione Depurar > Fazer Step Over.
-[start=10]
+
. Para pausar a sessão de depuração, selecione Depurar > Pausar.
-[start=11]
+
. Para continuar a sessão de depuração, selecione Depurar > Continuar ou pressione image:images/continue-debugging-session.png[].
-[start=12]
+
. Para cancelar a sessão de depuração, pressione image:images/stop-debugging-session.png[].
-[start=13]
+
. Quando o programa chegar ao fim, as janelas do depurador serão fechadas.
@@ -292,10 +292,10 @@
* Executar configuração: Web Site Local
Encontre mais detalhes sobre como configurar um projeto PHP no documento link:project-setup.html[+Configurando um Projeto PHP+].
-[start=2]
+
. Para permitir o uso de teclas de atalho durante a sessão, posicione o cursor no nó do projeto e selecione Definir como Projeto Principal no menu pop-up.
-[start=3]
+
. No arquivo ``index.php`` , digite o seguinte código:
[source,php]
@@ -308,7 +308,7 @@
* A função ``calcualte_sum ()``
* A função ``calculate_sum_of_factorials ()`` que chama a função ``calculate_factorial`` duas vezes, depois chama a função ``calcualte_sum ()`` uma vez e retorna a soma calculada dos fatoriais.
-[start=4]
+
. Definir um ponto de interrupção (Ctrl-F8/⌘-F8) no início do bloco PHP:
[source,php]
@@ -317,16 +317,16 @@
<?php
----
-[start=5]
+
. Para iniciar a depuração, clique em image:images/debug-main-project-button.png[]. O depurador para no ponto de interrupção.
-[start=6]
+
. Pressione F7 três vezes. O depurador para na linha em que a função ``calculate_sum_of_factorials ()`` é chamada. A janela Variáveis Locais mostra as variáveis ``$m`` e ``$n`` com seus valores:
image::images/degugger-stopped-at-function-call.png[]
-[start=7]
+
. Para fazer step into na função ``calculate_sum_of_factorials()`` , pressione F7. O depurador começa a executar o código na função ``calculate_sum_of_factorials ()`` e para na chamada da função ``calculate_factorial()`` .
image::images/call-of-embedded-function.png[]
@@ -336,19 +336,19 @@
image::images/variables-inside-function-call-another-function.png[]
-[start=8]
+
. Pressione F7. O depurador começa a executar o código com a função ``calculate_factorial()`` . A janela Pilha de Chamadas mostra a pilha de chamadas para as funções na ordem inversa, com a última função chamada na parte superior da lista:
image::images/call-stack.png[]
-[start=9]
+
. Pressione F7 para fazer step into no loop. Exiba os valores das variáveis na janela Variáveis.
image::images/local-variables-inside-loop.png[]
-[start=10]
+
. Quando você se certificar de que o código está funcionando corretamente, pressione Ctrl-F7/⌘-F7 para cancelar a execução da função. O programa retorna para a linha após a chamada da função ``calculate_factorial()`` .
NOTE: como alternativa, você pode pressionar F7, até que o programa conclua a execução da função ``calculate_factorial()`` . Você também retornará para a linha após essa chamada.
@@ -356,25 +356,25 @@
image::images/call-of-embedded-function-second-time.png[]
-[start=11]
+
. Como você acabou de verificar a função ``calculate_factorial()`` e sabe que ela está funcionando corretamente, pode pular sua execução ("fazer step over"). Para fazer step over, pressione F8. O programa para na chamada da função ``calculate_sum()`` .
image::images/cal-of-embedded-function-calculate-sum.png[]
-[start=12]
+
. Para fazer step into na função ``calculate_sum()`` , pressione F7.
-[start=13]
+
. Para fazer step over, pressione F8. Em qualquer um dos casos, o depurador para na última linha na função ``calculate_sum_of_factorials()`` .
image::images/return-result.png[]
-[start=14]
+
. Pressione F7. O depurador vai para a linha com a instrução ``echo`` .
-[start=15]
+
. Pressione F7, até que o depurador saia do programa. A janela do browser será aberta e mostrará o resultado da execução do programa:
image::images/program-output.png[]
@@ -395,10 +395,10 @@
----
Imagine que isso tenha resultado de um erro de digitação, mas você na verdade precise calcular a soma.
-[start=2]
+
. Selecione Depurar > Novo Watch ou pressione Ctrl/⌘-shift-F7. A Janela Novo Watch será Aberta.
-[start=3]
+
. Digite a seguinte expressão e clique em OK.
[source,php]
@@ -408,7 +408,7 @@
----
A nova expressão aparece na janela Watches.
-[start=4]
+
. Execute a sessão de depuração. Quando o depurador parar na linha
[source,php]
@@ -438,7 +438,7 @@
Encontre mais informações sobre link:wish-list-lesson2.html#htmlForm[+forms de entrada HTML+].
-[start=2]
+
. Substitua as seguintes linhas na parte superior do bloco <?php ?>:
[source,php]
@@ -454,16 +454,16 @@
if (array_key_exists ("first_integer", $_POST) && array_key_exists ("second_integer", $_POST)) {$result = calculate_sum_of_factorials ($_POST["first_integer"], $_POST["second_integer"]);echo "Sum of factorials is " . $result;}
----
-[start=3]
+
. Defina um ponto de interrupção no início do bloco <?php ?> e inicie a <<debuggingSession,sessão de depuração>>.
-[start=4]
+
. Pressione F7. O depurador entra no programa. A janela do browser é aberta mas o form de entrada não é exibido. Esse é o comportamento correto do depurador, porque ele tem que entrar em todo o código-fonte de uma página web, antes que a página possa ser exibida. Praticamente, isso significa que o depurador entra no código duas vezes. Na primeira vez, o depurador processa o código para exibir o form de entrada de HTML. Na segunda vez, o depurador executa o código PHP passo a passo.
-[start=5]
+
. Pressione F7, até que o depurador alcance o final do programa e o form de entrada seja aberto.
-[start=6]
+
. Preencha o form e clique em Enter. A sessão de depuração continua conforme descrito na seção <<sampleDebuggingSession,Sessão de Depuração de Amostra>>.
@@ -482,7 +482,7 @@
* Perguntar Todas as Vezes, que faz com que o IDE solicite o URL quando você inicia uma sessão de depuração.
* Não Abrir o Web Browser, que requer que você abra o browser e insira manualmente o URL (é preciso ter a variável GET/POST XDEBUG_SESSION_START).
-[start=6]
+
. Se você estiver usando um servidor proxy para a depuração, digite o nome do host e a porta do servidor na seção Proxy do Depurador.
Para obter mais informações, consulte o post link:http://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger[+Mapeamento do Caminho no Depurador PHP+] no blog Net Beans para o PHP.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/debugging_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/debugging_ru.asciidoc
index 19609b4..67c6b69 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/debugging_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/debugging_ru.asciidoc
@@ -243,16 +243,16 @@
3. В окне 'Проекты' перейдите к узлу текущего проекта, щелкните правой кнопкой мыши и выберите 'Отладка' во всплывающем меню. Среда IDE открывает окна отладки и выполняет проект в отладчике до достижения установленной точки останова.
NOTE: Если текущий проект настроен как 'Главный' выберите 'Отладка' > 'Отладка главного проекта' или нажмите Ctrl-F5, или щелкните image:images/debug-main-project-button.png[].
-[start=4]
+
. Перейдите в окно "Local Variables". В данном окне показаны все переменные, которые инициализированы внутри текущей функции, их типы и их значения.
-[start=5]
+
. Для просмотра значения переменной отдельно от функции переместите курсор на отображаемую переменную. Подсказка показывает значение переменной.
-[start=6]
+
. Для построчного выполнения программы (включая строки внутри всех вызванных функций) нажмите F7 или выберите "Debug > StepInto" и наблюдайте за изменениями значений переменных в окне "Локальные переменные".
-[start=7]
+
. Для проверки логики программы путем наблюдения за изменениями выражений определите новый параметр наблюдения:
.. Для открытия окна "Watches " выберите путь "Window > Debugging > Watches" или нажмите сочетание клавиш Ctrl-Shift-2. Откроется окно "Watches".
.. Щелкните окно "Watches" правой кнопкой мыши и выберите "New Watch" во всплывающем меню. Откроется окно "New Watch".
@@ -263,28 +263,28 @@
*Важно!* Для установки точек наблюдения необходимо включить точки наблюдения на <<options,вкладке Debugging ("Отладка") параметров PHP>>.
-[start=8]
+
. Для пропуска построчного выполнения кода в функции получите возвращенное этой функцией значение, перейдите к следующей строке после вызова функции и нажмите F8 или выберите "Debug > Step Over".
-[start=9]
+
. Для пропуска построчного выполнения кода в функции получите возвращенное этой функцией значение, перейдите к следующей строке после вызова функции и нажмите F8 или выберите "Debug > Step Over".
-[start=10]
+
. Для приостановки сеанса отладки выберите "Debug > Pause".
-[start=11]
+
. Для продолжения сеанса отладки выберите "Debug > Continue".
image::images/continue-debugging-session.png[].
-[start=12]
+
. Для отмены сеанса отладки нажмите
image::images/stop-debugging-session.png[].
-[start=13]
+
. После завершения программы окна отладки закрываются.
@@ -298,10 +298,10 @@
* Настройка выполнения – локальный веб-сайт
Для получения более подробной информации о настройке проекта PHP см. link:project-setup.html[+Настройка проекта PHP+].
-[start=2]
+
. Для активации возможности использования "горячих" клавиш во время сеанса установите курсор на узел проекта и выберите "Set as Main Project" во всплывающем меню.
-[start=3]
+
. Введите следующий код в файле ``index.php`` :
[source,php]
@@ -314,7 +314,7 @@
* функция ``calcualte_sum ()`` ;
* функция ``calculate_sum_of_factorials ()`` (дважды вызывает функцию ``calculate_factorial`` , затем однократно вызывает функцию ``calcualte_sum ()`` и возвращает рассчитанную сумму факториалов).
-[start=4]
+
. Задайте точку останова (Ctrl-F8/⌘-F8) в начале блока PHP:
[source,php]
@@ -323,16 +323,16 @@
<?php
----
-[start=5]
+
. Для начала отладка щелкните image:images/debug-main-project-button.png[]. Отладчик остановится по достижении точки останова.
-[start=6]
+
. Нажмите F7 три раза. Отладчик остановится в той строке, в которой вызывается функция ``calculate_sum_of_factorials ()`` . В окне "Local Variables" отображаются переменные ``$m`` и ``$n`` с соответствующими значениями:
image::images/degugger-stopped-at-function-call.png[]
-[start=7]
+
. Нажмите F7 для перехода к функции ``calculate_sum_of_factorials()`` . Отладчик начнет выполнение кода внутри функции ``calculate_sum_of_factorials ()`` и остановится при вызове функции ``calculate_factorial()`` .
image::images/call-of-embedded-function.png[]
@@ -342,19 +342,19 @@
image::images/variables-inside-function-call-another-function.png[]
-[start=8]
+
. Нажмите F7. Отладчик начнет выполнение кода с функцией ``calculate_factorial()`` . В окне "Call Stack" отображается стек вызовов функций в обратном порядке, начиная с последней вызванной функции:
image::images/call-stack.png[]
-[start=9]
+
. Нажмите F7 для перехода к циклу. Просмотрите значения переменных в окне Variables ("Переменные").
image::images/local-variables-inside-loop.png[]
-[start=10]
+
. После подтверждения правильности работы кода нажмите Ctrl-F7/⌘-F7, чтобы отменить выполнение функции. Затем будет выполнен возврат к строке, следующей после строки вызова функции ``calculate_factorial()`` .
NOTE: В качестве альтернативы можно нажимать F7 до завершения программой выполнения функции ``calculate_factorial()`` . После вызова этой функции также будет выполнен возврат к следующей строке.
@@ -362,25 +362,25 @@
image::images/call-of-embedded-function-second-time.png[]
-[start=11]
+
. Поскольку проверка функции ``calculate_factorial()`` была только что выполнена, и известно, что функция работает нормально, ее выполнение можно "пропустить". Для этого нажмите F8. Программа завершит работу при вызове функции ``calculate_sum()`` .
image::images/cal-of-embedded-function-calculate-sum.png[]
-[start=12]
+
. Для перехода к функции ``calculate_sum()`` нажмите F7.
-[start=13]
+
. Для этого нажмите F8. В любом случае отладчик остановится на последней строке в функции ``calculate_sum_of_factorials()`` .
image::images/return-result.png[]
-[start=14]
+
. Нажмите F7. Отладчик переместится к строке с оператором ``echo`` .
-[start=15]
+
. Нажимайте F7 до тех пор, пока отладчик не завершит работу с программой. Откроется окно браузера, в котором отображается результат выполнения программы:
image::images/program-output.png[]
@@ -401,10 +401,10 @@
----
Можно предположить, что это следствие неправильного написания кода, но фактически требуется еще раз подсчитать сумму.
-[start=2]
+
. Выберите 'Отладка' > 'Создать наблюдение' или нажмите Ctrl/⌘-shift-F7. Откроется окно "New Watch".
-[start=3]
+
. Введите следующее выражение и нажмите "ОК".
[source,php]
@@ -414,7 +414,7 @@
----
Новое выражение появится в окне "Watches".
-[start=4]
+
. Запустите сеанс отладки. После остановки отладчика остановится в указанной строке:
[source,php]
@@ -444,7 +444,7 @@
Дополнительная информация о link:wish-list-lesson2.html#htmlForm[+формах ввода HTML+].
-[start=2]
+
. Замените следующие строки в верхней части блока <? php? >:
[source,php]
@@ -460,16 +460,16 @@
if (array_key_exists ("first_integer", $_POST) && array_key_exists ("second_integer", $_POST)) {$result = calculate_sum_of_factorials ($_POST["first_integer"], $_POST["second_integer"]);echo "Sum of factorials is " . $result;}
----
-[start=3]
+
. Установите точку останова в начале блока <? php? > и начните <<debuggingSession,сеанс отладки>>.
-[start=4]
+
. Нажмите F7. Отладчик перейдет к программе. Откроется окно браузера, но форма ввода в нем не отображается. Это нормальный режим работы отладчика, поскольку для отображения веб-страницы отладчик должен пройти по всему исходному коду. Фактически это означает, что отладчик обрабатывает код дважды. Первый раз обрабатывается код для отображения формы ввода HTML. Второй раз поэтапно обрабатывается код PHP.
-[start=5]
+
. Нажимайте F7 до тех пор, пока не будет достигнут конец программы; после этого откроется форма ввода.
-[start=6]
+
. Заполните форму и нажмите Enter. Сеанс отладки будет продолжен, как описано в разделе <<sampleDebuggingSession,Пример сеанса отладки>>.
@@ -488,7 +488,7 @@
* Ask Every Time ("Спрашивать каждый раз"), указывающий среде IDE запрашивать URL-адрес у пользователя при каждом запуске сеанса отладки.
* Do Not Open Web Browser ("Не открывать веб-браузер"), в результате чего придется открыть браузер и ввести URL-адрес вручную (будет необходима переменная GET/POST XDEBUG_SESSION_START).
-[start=6]
+
. В случае использования для отладки прокси-сервера введите имя узла и порт сервера в разделе Debugger Proxy ("Прокси отладчика").
Дополнительные сведения приведены в записи link:http://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger[+Path Mapping in PHP Debugger ("Сопоставление путей в отладчике PHP")+] блога по Net Beans для PHP.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/debugging_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/debugging_zh_CN.asciidoc
index 3a2a8de..989b1c7 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/debugging_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/debugging_zh_CN.asciidoc
@@ -243,16 +243,16 @@
3. 在 "Projects"(项目)窗口中,导航至当前项目节点,单击鼠标右键,然后从弹出式菜单中选择 "Debug"(调试)。IDE 将打开调试器窗口并在调试器中运行该项目,直至到达断点为止。
NOTE: 如果当前项目设置为“主项目”,您可以选择“调试”>“调试主项目”,按 Ctrl-F5,或单击 image:images/debug-main-project-button.png[]。
-[start=4]
+
. 切换至 "Local Variables"(局部变量)窗口。该窗口显示当前函数中已初始化的所有变量及其类型和值。
-[start=5]
+
. 要查看该函数外部的变量值,请将光标置于此变量出现的某个位置上。工具提示会显示变量值。
-[start=6]
+
. 要逐行(包括所有被调用函数中的行)执行程序,请按 F7 键或选择 "Debug"(调试)> "Step Into"(步入),然后在 "Local Variables"(局部变量)窗口中监视这些变量值的更改。
-[start=7]
+
. 要通过监视表达式的更改来检查程序逻辑,请定义一个新监视:
.. 要打开 "Watches"(监视)窗口,请选择 "Window"(窗口)> "Debugging"(调试)> "Watches"(监视),或者按 Ctrl-Shift-2 组合键。"Watches"(监视)窗口打开。
.. 在 "Watches"(监视)窗口中的任意位置单击鼠标右键,然后从弹出式菜单中选择 "New Watch"(新建监视)。"New Watch"(新建监视)窗口打开。
@@ -263,22 +263,22 @@
*重要提示:*您必须在 <<options,PHP "Options"(选项)的 "Debugging"(调试)标签>>中启用监视才能设置监视。
-[start=8]
+
. 要取消对某个函数中代码的逐行执行操作并跳至该函数调用后的下一行,请按 Ctrl-F7/⌘-F7 组合键或选择 "Debug"(调试)> "Step Out"(步出)。
-[start=9]
+
. 要跳过对某个函数中代码的逐行执行操作,获取该函数返回的值,并跳至该函数调用后的下一行,请按 F8 键或选择 "Debug"(调试)> "Step Over"(步过)。
-[start=10]
+
. 要暂停调试会话,请选择 "Debug"(调试)> "Pause"(暂停)。
-[start=11]
+
. 要继续调试会话,请选择 "Debug"(调试)> "Continue"(继续)或按 image:images/continue-debugging-session.png[]。
-[start=12]
+
. 要取消调试会话,请按 image:images/stop-debugging-session.png[]。
-[start=13]
+
. 在程序结束时,调试器窗口会关闭。
@@ -292,10 +292,10 @@
* 运行配置 - "Local Web Site"(本地 Web 站点)
有关设置 PHP 项目的更多详细信息,请参见link:project-setup.html[+设置 PHP 项目+]文档。
-[start=2]
+
. 要在会话过程中使用热键,请将光标置于项目节点上,然后从弹出式菜单中选择 "Set as Main Project"(设置为主项目)。
-[start=3]
+
. 在 ``index.php`` 文件中,输入以下代码:
[source,php]
@@ -308,7 +308,7 @@
* ``calcualte_sum ()`` 函数
* ``calculate_sum_of_factorials ()`` 函数,该函数调用 ``calculate_factorial ()`` 函数两次,再调用 ``calcualte_sum ()`` 函数一次,然后返回计算的阶乘和。
-[start=4]
+
. 在 PHP 块的开头设置一个断点(Ctrl-F8/⌘-F8 组合键):
[source,php]
@@ -317,16 +317,16 @@
<?php
----
-[start=5]
+
. 要开始调试,请单击 image:images/debug-main-project-button.png[]。调试器将在断点处停止。
-[start=6]
+
. 按 F7 键三次。调试器将在调用函数 ``calculate_sum_of_factorials ()`` 的行上停止。"Local Variables"(局部变量)窗口会显示变量 ``$m`` 和 ``$n`` 以及它们的值:
image::images/degugger-stopped-at-function-call.png[]
-[start=7]
+
. 要步入函数 ``calculate_sum_of_factorials ()`` ,请按 F7 键。调试器开始执行函数 ``calculate_sum_of_factorials ()`` 中的代码,然后在函数 ``calculate_factorial ()`` 的调用处停止。
image::images/call-of-embedded-function.png[]
@@ -336,18 +336,18 @@
image::images/variables-inside-function-call-another-function.png[]
-[start=8]
+
. 按 F7 键。调试器开始执行函数 ``calculate_factorial ()`` 中的代码。"Call Stack"(调用堆栈)窗口将按倒序显示函数的调用堆栈,最后调用的函数位于列表顶部:
image::images/call-stack.png[]
-[start=9]
+
. 按 F7 键步入循环。在 "Variables"(变量)窗口中查看变量值。
image::images/local-variables-inside-loop.png[]
-[start=10]
+
. 如果您确定代码运行正常,请按 Ctrl-F7/⌘-F7 组合键,以取消函数执行。程序将在调用函数 ``calculate_factorial ()`` 后返回至下一行。
NOTE: 您也可以按 F7 键,直到程序执行完函数 ``calculate_factorial ()`` 为止。您也会在调用该函数后返回至下一行。
@@ -355,25 +355,25 @@
image::images/call-of-embedded-function-second-time.png[]
-[start=11]
+
. 由于您刚检查了函数 ``calculate_factorial ()`` ,并且确定其运行正常,因此可以跳过对该函数的再次执行操作(“步过”)。要越过该函数,请按 F8 键。程序将在函数 ``calculate_sum ()`` 的调用处停止。
image::images/cal-of-embedded-function-calculate-sum.png[]
-[start=12]
+
. 要步入函数 ``calculate_sum ()`` ,请按 F7 键。
-[start=13]
+
. 要越过该函数,请按 F8 键。对于任何一种情况,调试器都会在函数 ``calculate_sum_of_factorials ()`` 的最后一行停止。
image::images/return-result.png[]
-[start=14]
+
. 按 F7 键。调试器将移到 ``echo`` 语句所在的行上。
-[start=15]
+
. 按 F7 键,直到调试器退出程序为止。将打开浏览器窗口并显示程序执行的结果:
image::images/program-output.png[]
@@ -394,10 +394,10 @@
----
假定运算符的改变是由于拼写错误造成的,而实际上您需要计算和。
-[start=2]
+
. 选择 "Debug"(调试)> "New Watch"(新建监视),或者按 Ctrl/⌘-shift-F7 组合键。"New Watch"(新建监视)窗口打开。
-[start=3]
+
. 输入以下表达式,然后单击 "OK"(确定)。
[source,php]
@@ -407,7 +407,7 @@
----
"Watches"(监视)窗口中将显示新表达式。
-[start=4]
+
. 运行调试会话。当调试器在以下行停止时
[source,php]
@@ -437,7 +437,7 @@
有关详细信息,请参见 link:wish-list-lesson2.html#htmlForm[+HTML 输入窗体+]。
-[start=2]
+
. 替换 <?php ?> 块下键入或粘贴以下代码:
[source,php]
@@ -453,16 +453,16 @@
if (array_key_exists ("first_integer", $_POST) && array_key_exists ("second_integer", $_POST)) {$result = calculate_sum_of_factorials ($_POST["first_integer"], $_POST["second_integer"]);echo "Sum of factorials is " . $result;}
----
-[start=3]
+
. 在 <?php ?> 块的开头设置断点,然后启动<<debuggingSession,调试会话>>。
-[start=4]
+
. 按 F7 键。调试器将步入程序。同时,会打开浏览器窗口,但不显示输入窗体。这是调试器的正确行为,因为它必须首先通过 Web 页的整个源代码,然后才能显示该页面。实际上,这意味着调试器通过了两次代码。第一次是调试器处理代码以显示 HTML 输入窗体。第二次是调试器逐步执行 PHP 代码。
-[start=5]
+
. 按 F7 键,直到调试器到达程序末尾并且打开输入窗体为止。
-[start=6]
+
. 填写该窗体,然后单击 Enter 键。将继续调试会话(如<<sampleDebuggingSession,样例调试会话>>部分中所述)。
@@ -481,7 +481,7 @@
* "Ask Every Time"(每次都询问):让 IDE 提示您在启动调试会话时输入 URL。
* "Do Not Open Web Browser"(不打开 Web 浏览器):需要您手动打开浏览器并输入 URL(您需要 GET/POST XDEBUG_SESSION_START 变量)。
-[start=6]
+
. 使用代理服务器进行调试时,请在 "Debugger Proxy"(调试器代理)类别中输入该服务器的主机名和端口。
有关详细信息,请参见 "NetBeans for PHP"(NetBeans PHP) 博客中的 link:http://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger[+Path Mapping in PHP Debugger+](使用 PHP 调试器进行路径映射)的帖子。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/phpunit.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/phpunit.asciidoc
index d59a151..a999501 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/phpunit.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/phpunit.asciidoc
@@ -82,7 +82,7 @@
?>
----
-[start=2]
+
. Add a comment block with the link:http://sebastian-bergmann.de/archives/628-Improved-Skeleton-Generator-in-PHPUnit-3.html[+@assert annotation+] and some sample input and output. Note that one incorrect assertion is included in this example.
[source,php]
@@ -111,13 +111,13 @@
image::images/assert-cc.png[]image::images/assert-cc-complete.png[]
-[start=3]
+
. In the Projects window, right-click the Calculator.php node and select Tools > Create PHPUnit Tests. Note that you can create tests for all files in a project in the context menu for the Source Files node.
image::images/create-tests.png[]
-[start=4]
+
. The first time you create tests, a dialog opens asking you for the directory in which you want to store test files. In this example, the Browse function was used to create a ``tests`` directory.
image::images/test-directory.png[]
@@ -127,7 +127,7 @@
image::images/test-in-folder.png[]
-[start=5]
+
. The IDE generates a skeleton test class in a file called CalculatorTest.php, which appears in your Projects window and opens in the editor.
image::images/test-class-in-project.png[]
@@ -150,7 +150,7 @@
}
----
-[start=6]
+
. You can test either an individual file or the entire project. To test the project, right-click the project's parent node and select Test, or press Alt-F6. To test the Calculator.php file, right-clict the file's node and select Test, or press Ctrl-F6/⌘-F6. This example has only one class in one file, so the results are the same. The IDE runs the tests and displays the results in the Test Results window.
image::images/test-results-narrow.png[]
@@ -176,19 +176,19 @@
image::images/test-group-properties.png[]
-[start=3]
+
. Open ``CalculatorTest.php`` in the editor.
-[start=4]
+
. For the methods ``testAdd`` , ``testAdd3`` and ``testAdd5`` , add the annotation ``@group production`` .
image::images/production-group-annotation.png[]
-[start=5]
+
. For the methods ``testAdd2`` and ``testAdd4`` , add the annotations ``@group production`` and ``@group development`` . image::images/production-development-group-code.png[]
-[start=6]
+
. Right-click the ``Calculator.php`` node and select Test. A dialog opens, asking you which test groups to run. Select "development" and click OK. The IDE only runs the tests that are annotated with ``@group development`` .
image::images/select-test-group.png[]
@@ -256,19 +256,19 @@
----
-[start=2]
+
. Right-click the project node. From the context menu, select Code Coverage > Collect and Display Code Coverage. By default, Show Editor Bar is also selected.
image::images/turn-on-code-coverage.png[]
-[start=3]
+
. The editor now has a code coverage editor bar across the bottom. Because code coverage has not been tested, the editor bar reports 0% coverage. (It also displays this after you click Clear to clear test results.)
image::images/editor-bar-before.png[]
-[start=4]
+
. Click Test to test the open file or All Tests to run all tests for the project. The Test Results display. In addition, the Code Coverage bar tells you what percentage of your executable code statements is covered by tests. In the editor window, covered code is highlighted in green and uncovered code is highlighted in red.
WARNING: If you re-generate the test files AFTER adding the add2 function, the PHPUnit tests will not run. This is because PHPUnit creates two conflicting testAdd2 functions. Do not differentiate functions by appending numbers at the end if you plan to use PHPUnit on more than one such function. See the link:http://www.phpunit.de/ticket/701[+the PHPUnit documentation+].
@@ -276,13 +276,13 @@
image::images/editor-bar-after.png[]
-[start=5]
+
. In the Editor Bar, click on Report... The Code Coverage report opens, showing the results of all tests run on your project. Buttons in the report let you clear the results, run all the tests again, or deactivate code coverage (click Done).
image::images/code-coverage-report.png[]
-[start=6]
+
. You can add another class to your project, delete and recreate the test files and look at the code coverage report again. Your new class is listed. In the following report, the ``Calculator`` class again has a function that is not included in the tests.
image::images/code-coverage-report2.png[]
@@ -303,12 +303,12 @@
image::images/project-ctxmenu.png[]
-[start=2]
+
. Select the PHPUnit category. A dialog opens in which you can select a custom bootstrap, XML configuration, PHPUnit script, or test suite file.
image::images/proj-properties.png[]
-[start=3]
+
. If you are not familiar with the structure of bootstrap or XML configuration files, you can use NetBeans IDE to generate a skeleton for you. You can also find instructions about using the dialog by clicking Help.
image::images/proj-properties-selected.png[]
@@ -339,15 +339,15 @@
image::images/new-selenium.png[]
-[start=4]
+
. The first time you create a Selenium test, a dialog opens asking you to set a directory for Selenium test files. This should be a separate directory from PHPUnit test files. Otherwise, the Selenium tests run every time you run unit tests. Running functional tests like Selenium usually takes more time than running unit tests, therefore you will probably not want to run these tests every time you run unit tests.
-[start=5]
+
. Accept the defaults in the Name and Location page and click Finish. The new Selenium test file opens in the editor and appears in the Projects window.
image::images/selenium-test-in-project.png[]
-[start=6]
+
. The Run Selenium Tests item is now added to the project's context menu. Click this item, and the Selenium test results display in the Test Results window, the same as PHPUnit tests.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/phpunit_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/phpunit_ja.asciidoc
index affc219..f668690 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/phpunit_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/phpunit_ja.asciidoc
@@ -85,7 +85,7 @@
?>
----
-[start=2]
+
. link:http://sebastian-bergmann.de/archives/628-Improved-Skeleton-Generator-in-PHPUnit-3.html[+@assert注釈+]と、入力と出力の例を使用したコメント・ブロックを追加します。この例には間違った表明が1つ含まれています。
[source,php]
@@ -116,13 +116,13 @@
image::images/assert-cc-complete.png[]
-[start=3]
+
. 「プロジェクト」ウィンドウで「Calculator.php」ノードを右クリックし、「ツール」>「PHPUnitテストを作成」を選択します。「ソース・ファイル」ノードのコンテキスト・メニューで、プロジェクト内のすべてのファイルのテストを作成できます。
image::images/create-tests.png[]
-[start=4]
+
. テストを初めて作成するときは、テスト・ファイルを保存するディレクトリを指定するダイアログが開きます。この例では、参照機能を使用して ``tests`` ディレクトリを作成しています。
image::images/test-directory.png[]
@@ -132,7 +132,7 @@
image::images/test-in-folder.png[]
-[start=5]
+
. IDEによって、CalculatorTest.phpというファイルに、スケルトン・テスト・クラスが生成されます(このファイルは、「プロジェクト」ウィンドウに表示され、エディタで開きます)。
image::images/test-class-in-project.png[]
@@ -155,7 +155,7 @@
}
----
-[start=6]
+
. 1つのファイルまたはプロジェクト全体をテストできます。プロジェクトをテストするには、プロジェクトの親ノードを右クリックして「テスト」を選択するか、または[Alt]-[F6]を押します。Calculator.phpファイルをテストするには、ファイルのノードを右クリックして「テスト」を選択するか、または[Ctrl]-[F6]/[⌘]-[F6]を押します。この例では、1つのファイルに1つのクラスのみがあるため、結果は同じです。IDEによってテストが実行され、「テスト結果」ウィンドウに結果が表示されます。
image::images/test-results-narrow.png[]
@@ -181,19 +181,19 @@
image::images/test-group-properties.png[]
-[start=3]
+
. エディタで ``CalculatorTest.php`` を開きます。
-[start=4]
+
. メソッド ``testAdd`` 、 ``testAdd3`` 、および ``testAdd5`` について、注釈 ``@group production`` を追加します。
image::images/production-group-annotation.png[]
-[start=5]
+
. メソッド ``testAdd2`` および ``testAdd4`` について、注釈 ``@group production`` および ``@group development`` を追加します。image:images/production-development-group-code.png[]
-[start=6]
+
. ``Calculator.php`` ノードを右クリックし、「テスト」を選択します。ダイアログが開き、実行するテスト・グループを指定するように求められます。「development」を選択して「OK」をクリックします。IDEは、 ``@group development`` という注釈が付いたテストのみを実行します。
image::images/select-test-group.png[]
@@ -261,19 +261,19 @@
----
-[start=2]
+
. プロジェクト・ノードを右クリックします。コンテキスト・メニューから、「コード・カバレージ」>「コード・カバレージを収集し表示」を選択します。デフォルトでは、「エディタ・バーを表示」も選択されています。
image::images/turn-on-code-coverage.png[]
-[start=3]
+
. エディタの最下部に、コード・カバレージのエディタ・バーが表示されます。コード・カバレージはテストされていないので、エディタ・バーには0%のカバレージが表示されます。(「クリア」をクリックしてテスト結果をクリアした後もこのように表示されます。)
image::images/editor-bar-before.png[]
-[start=4]
+
. 「テスト」をクリックして開いているファイルをテストするか、または「すべてのテスト」をクリックしてプロジェクトのすべてのテストを実行します。テスト結果が表示されます。また、コード・カバレージのバーに、テストでカバーされている実行可能コード文の割合(パーセント)が示されます。エディタ・ウィンドウで、カバーされているコードは緑色で強調表示され、カバーされていないコードは赤で強調表示されます。
*警告: *add2関数を追加した後でテスト・ファイルを再生成した場合、PHPUnitテストは実行されません。これは、PHPUnitが2つの競合するtestAdd2関数を作成するためです。このような複数の関数についてPHPUnitを使用する場合、末尾に数字を付加することによって関数を区別しないでください。link:http://www.phpunit.de/ticket/701[+PHPUnitのドキュメント+]を参照してください。
@@ -281,13 +281,13 @@
image::images/editor-bar-after.png[]
-[start=5]
+
. エディタ・バーで、「レポート」をクリックします。コード・カバレージのレポートが開き、プロジェクトに対して実行されたすべてのテストの結果が表示されます。レポート内のボタンを使用して、結果をクリアしたり、すべてのテストを再実行したり、コード・カバレージを非アクティブ化(「完了」をクリック)できます。
image::images/code-coverage-report.png[]
-[start=6]
+
. プロジェクトに別のクラスを追加し、テスト・ファイルを削除して再作成して、コード・カバレージのレポートをもう一度確認できます。新しいクラスが表示されます。次のレポートでは、 ``Calculator`` クラスに、テストに含まれない関数が再度含まれています。
image::images/code-coverage-report2.png[]
@@ -306,19 +306,19 @@
*プロジェクト固有の構成を設定するには:*
-[start=1]
+
. プロジェクトのノードまたはプロジェクトの「テスト・ファイル」ノードを右クリックし、「プロパティ」を選択します。「プロパティ」ダイアログが開きます。
image::images/project-ctxmenu.png[]
-[start=2]
+
. 「PHPUnit」カテゴリを選択します。カスタムのブートストラップ、XML構成、PHPUnitスクリプト、またはテスト・スイート・ファイルを選択できるダイアログが開きます。
image::images/proj-properties.png[]
-[start=3]
+
. ブートストラップの構造やXML構成ファイルに精通していない場合は、NetBeans IDEを使用してスケルトンを生成できます。また、「ヘルプ」をクリックして、ダイアログを使用する手順を調べることができます。
image::images/proj-properties-selected.png[]
@@ -350,16 +350,16 @@
image::images/new-selenium.png[]
-[start=4]
+
. Seleniumのテストを初めて作成するときは、Seleniumのテスト・ファイル用のディレクトリを設定するダイアログが開きます。これは、PHPUnitのテスト・ファイルとは別のディレクトリにします。そうしないと、単体テストを実行するたびにSeleniumのテストが実行されます。Seleniumのような機能的なテストの実行は、単体テストの実行よりも時間がかかるため、単体テストを実行するたびにこれらのテストが実行されることは避けたい場合があります。
-[start=5]
+
. 名前と場所ページの設定はデフォルトのままにし、「終了」をクリックします。Seleniumの新しいテスト・ファイルがエディタで開き、「プロジェクト」ウィンドウに表示されます。
image::images/selenium-test-in-project.png[]
-[start=6]
+
. プロジェクトのコンテキスト・メニューに「Run Selenium Tests」という項目が追加されます。この項目をクリックすると、PHPUnitテストと同様に、Seleniumのテスト結果が「テスト結果」ウィンドウに表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/phpunit_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/phpunit_pt_BR.asciidoc
index baea026..dbd13a7 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/phpunit_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/phpunit_pt_BR.asciidoc
@@ -88,7 +88,7 @@
?>
----
-[start=2]
+
. Adicione um bloco de comentário com a link:http://sebastian-bergmann.de/archives/628-Improved-Skeleton-Generator-in-PHPUnit-3.html[+anotação @assert+] e alguma amostra de entrada e saída. Observe que uma afirmação incorreta está incluída neste exemplo.
[source,php]
@@ -117,13 +117,13 @@
image::images/assert-cc.png[]image::images/assert-cc-complete.png[]
-[start=3]
+
. Na janela Projetos, clique com o botão direito do mouse no nó Calulator.php e selecione Ferramentas > Criar Testes PHPUnit. Observe que você pode criar testes para todos os arquivos em um projeto a partir do menu de contexto para o nó Arquivos de Código-Fonte.
image::images/create-tests.png[]
-[start=4]
+
. Na primeira vez que você cria testes, uma caixa de diálogo é aberta perguntando pelo diretório onde deseja armazenar os arquivos de teste. Nesse exemplo, a função Procurar foi utilizada para criar um diretório ``testes`` .
image::images/test-directory.png[]
@@ -133,7 +133,7 @@
image::images/test-in-folder.png[]
-[start=5]
+
. O IDE gera uma classe de teste de esqueleto em um arquivo denominado CalculatorTest.php, que aparece em sua janela Projetos e é aberta no editor.
image::images/test-class-in-project.png[]
@@ -156,7 +156,7 @@
}
----
-[start=6]
+
. É possível testar um arquivo individual ou todo o projeto. Para testar o projeto, clique com o botão direito do mouse no nó pai do projeto e selecione Testar ou pressione Alt-F6. Para testar o arquivo Calculator.php, clique com o botão direito do mouse no nó do arquivo e selecione Testar ou pressione Ctrl-F6/⌘-F6. Esse exemplo tem somente uma classe em um arquivo, portanto, os resultados são os mesmos. O IDE executa os testes e exibe os resultados na janela Resultados do Teste.
image::images/test-results-narrow.png[]
@@ -182,19 +182,19 @@
image::images/test-group-properties.png[]
-[start=3]
+
. Abra ``CalculatorTest.php`` no editor.
-[start=4]
+
. Para os métodos ``testAdd`` , ``testAdd3`` e ``testAdd5`` , acrescente a anotação ``@group production`` .
image::images/production-group-annotation.png[]
-[start=5]
+
. para os métodos ``testAdd2`` e ``testAdd4`` , adicione as anotações ``@group production`` e ``desenvolvimento @group`` . image:images/production-development-group-code.png[]
-[start=6]
+
. Clique com o botão direito do mouse no nó ``Calculator.php`` e selecione Teste. Uma caixa de diálogo será aberta, perguntando quais grupos de teste serão executados. Selecione “development” e clique em OK. O IDE só executa os testes anotados com ``@group development`` .
image::images/select-test-group.png[]
@@ -262,18 +262,18 @@
----
-[start=2]
+
. Clique com o botão direito do mouse no nó do projeto. No menu de contexto, selecione Cobertura de Código > Coletar e Exibir a Cobertura de Código. Por default, Mostrar Barra do Editor também é selecionado.
image::images/turn-on-code-coverage.png[]
-[start=3]
+
. O editor agora tem uma barra do editor de cobertura de código na parte inferior. Como a cobertura do código ainda não foi testada, a barra do editor informa 0% de cobertura. (Ela também exibe isso após você clicar em Limpar para limpar os resultados do teste).
image::images/editor-bar-before.png[]
-[start=4]
+
. Clique em Testar para testar o arquivo aberto ou em Todos os Testes para executar todos os testes do projeto. Os Resultados do Teste serão Exibidos. Além disso, a barra Cobertura de Código lhe informa qual a porcentagem das instruções de código executáveis é coberta pelos testes. Na janela editor, o código coberto é realçado em verde e o código não coberto é realçado em vermelho.
WARNING: se os arquivos de testes forem gerados novamente DEPOIS da adição da função add2, os testes PHPUnit não serão executados. Isso ocorre porque o PHPUnit cria duas funções testAdd2 conflitantes. Não diferencie funções acrescentando números no final, caso pretenda usar o PHPUnit em mais de uma função como essa. Consulte a link:http://www.phpunit.de/ticket/701[+documentação do PHPUnit+].
@@ -281,13 +281,13 @@
image::images/editor-bar-after.png[]
-[start=5]
+
. Na Barra do Editor, clique em Relatório... O relatório de Cobertura de Código será aberto, mostrando os resultados de todos os testes executados em seu projeto. Os botões no relatório permitem limpar os resultados, reexecutar todos os testes ou desativar a cobertura de código (clique em Concluído).
image::images/code-coverage-report.png[]
-[start=6]
+
. Você pode adicionar outra classe ao seu projeto, deletar e recriar os arquivos de teste e examinar novamente o relatório de cobertura de código. Sua nova classe será listada. No relatório a seguir, a classe ``Calculator`` tem novamente uma função que não está incluída nos testes.
image::images/code-coverage-report2.png[]
@@ -310,13 +310,13 @@
image::images/project-ctxmenu.png[]
-[start=2]
+
. Selecione a categoria PHPUnit. Uma caixa de diálogo será aberta, na qual você pode selecionar um arquivo bootstrap personalizado, um arquivo de configuração XML ou um arquivo de conjunto de testes.
image::images/proj-properties.png[]
-[start=3]
+
. Se não estiver familiarizado com a estrutura dos arquivos bootstrap ou de configuração XML, você poderá usar o NetBeans IDE para gerar um esqueleto para você. Você também pode localizar instruções sobre como utilizar a caixa de diálogo clicando em Ajuda
image::images/proj-properties-selected.png[]
@@ -344,24 +344,24 @@
1. Abra um prompt de comando e execute o comando ``pear install Testing_Selenium-beta`` . É preciso ter `` PHP_HOME/php/PEAR`` em seu Caminho. Se o comando obtiver êxito, o prompt exibirá ``install ok: channel://pear.php.net/Testing_Selenium-0.4.3`` .
-[start=2]
+
. No IDE, abra Ferramentas > Plug-ins e instale o Módulo Selenium para PHP.
-[start=3]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto Calculador. Selecione Novo > Outro. O Assistente de Novo Arquivo será aberto. Selecione Selenium e clique em Próximo.
image::images/new-selenium.png[]
-[start=4]
+
. Na primeira vez que você cria um teste Selenium, será exibida uma caixa de diálogo solicitando que você defina um diretório para os arquivos de teste Selenium. Esse diretório deverá ser separado do diretório dos arquivos de teste PHPUnit. Caso contrário, os testes Selenium serão executados cada vez que você executar testes de unidade. A execução de testes funcionais como o Selenium, normalmente leva mais tempo do que a execução de testes de unidade, portanto, você provavelmente não desejará executar esses testes cada vez que executar testes de unidade.
-[start=5]
+
. Aceite os defaults na página Nome e Localização e clique em Finalizar. O novo arquivo de teste Selenium será aberto no editor e aparecerá na janela Projetos.
image::images/selenium-test-in-project.png[]
-[start=6]
+
. O item Executar Testes Selenium está agora adicionado ao menu de contexto do projeto. Clique nesse item e os resultados do teste Selenium serão exibidos na janela Resultados do Teste, da mesma forma que os resultados de testes PHPUnit.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/phpunit_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/phpunit_ru.asciidoc
index 54ce2b0..44e7397 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/phpunit_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/phpunit_ru.asciidoc
@@ -85,7 +85,7 @@
?>
----
-[start=2]
+
. Добавьте блок комментариев с link:http://sebastian-bergmann.de/archives/628-Improved-Skeleton-Generator-in-PHPUnit-3.html[+аннотацией @assert+], а также пример входных и выходных данных. Обратите внимание – в этот пример включено одно неверное подтверждение.
[source,php]
@@ -115,14 +115,14 @@
image::images/assert-cc.png[]image::images/assert-cc-complete.png[]
-[start=3]
+
. В окне "Проекты" правой кнопкой мыши щелкните узел Calculator.php и выберите команду "Сервис" > "Создать тесты PHPUnit". Обратите внимание на то, что тесты для всех файлов в проекте можно создавать в контекстном меню для узла "Исходные файлы".
image::images/create-tests.png[]
-[start=4]
+
. При первом создании тестов в диалоговом окне выводится вопрос о каталоге, в котором следует сохранить файлы тестов. В этом примере функция "Обзор" используется для создания папки ``tests`` .
@@ -134,7 +134,7 @@
image::images/test-in-folder.png[]
-[start=5]
+
. В среде IDE в файле с именем CalculatorTest.php создается базовый класс, который отображается в окне "Проекты" и открывается в редакторе.
@@ -158,7 +158,7 @@
}
----
-[start=6]
+
. Можно выполнить тестирование отдельного файла или целого проекта. Для тестирования проекта щелкните правой кнопкой мыши родительский узел проекта и выберите команду "Тестировать" или нажмите сочетание клавиш ALT+F6. Для тестирования файла Calculator.php щелкните правой кнопкой узел файла и выберите 'Тестировать' или нажмите Ctrl-F6/⌘-F6. В этом примере существует только один класс в одном файле, так что результаты являются идентичными. Среда IDE выполняет тесты и отображает результаты в окне "Результаты теста".
@@ -186,19 +186,19 @@
image::images/test-group-properties.png[]
-[start=3]
+
. Откройте файл ``CalculatorTest.php`` в редакторе.
-[start=4]
+
. Для методов ``testAdd`` , ``testAdd3`` и ``testAdd5`` добавьте аннотацию ``@group production`` .
image::images/production-group-annotation.png[]
-[start=5]
+
. Для методов ``testAdd2`` и ``testAdd4`` добавьте аннотации ``@group production`` и ``@group development`` . image:images/production-development-group-code.png[]
-[start=6]
+
. Правой кнопкой мыши щелкните узел ``Calculator.php`` и выберите "Тестировать". Откроется диалоговое окно выбора групп тестирования для выполнения. Выберите "разработка" и нажмите клавишу "ОК". Среда IDE выполняет только те тесты, которые имеют аннотацию ``@group development`` .
image::images/select-test-group.png[]
@@ -268,19 +268,19 @@
----
-[start=2]
+
. Щелкните узел проекта правой кнопкой мыши. В контекстном меню выберите команду "Охват кода" > "Сбор и отображения охвата кода". По умолчанию панель "Отобразить панель редактора" также выбрана.
image::images/turn-on-code-coverage.png[]
-[start=3]
+
. Панель покрытия кода теперь отображается в нижней части редактора. Поскольку тестирование покрытия кода еще не выполнялось, на панели редактора отображается значение покрытия, равное 0%. (Это значение также отображается при нажатии на кнопку "Очистить" для очистки результатов теста).
image::images/editor-bar-before.png[]
-[start=4]
+
. Выберите команду "Тестировать" для тестирования открытого файла или "Все тесты" для запуска всех тестов по проекту. Отобразится окно "Результаты теста". Кроме того, на панели "Покрытие кода" отобразится процент задействованных в тестах операторов исполняемого кода. Задействованный код в окне редактора выделяется зеленым цветом, а незадействованный код – красным цветом.
WARNING: При повторном создании файлов теста ПОСЛЕ добавления функции add2 тесты PHPUnit выполняться не будут. Причиной этого является то, что PHPUnit создает две конфликтующие функции testAdd2. Не разграничивайте функции добавляемыми в конце номерами, если планируете использовать PHPUnit для нескольких подобных функций. См. link:http://www.phpunit.de/ticket/701[+документацию по PHPUnit+].
@@ -289,13 +289,13 @@
image::images/editor-bar-after.png[]
-[start=5]
+
. На панели редактора щелкните элемент "Отчет...". Отобразится отчет "Покрытие кода", в котором будут показаны результаты всех тестов, выполненных для проекта. Кнопки в отчете позволяют очищать результаты, повторно выполнять тесты или отключать покрытие кода (нажмите кнопку "Готово").
image::images/code-coverage-report.png[]
-[start=6]
+
. Разработчик может добавить другой класс в проект, удалить и заново создать файлы теста, а также еще раз изучить отчет о покрытии кода. Будет показан новый класс. В следующем отчете класс ``Calculator`` снова содержит функцию, не включенную в тесты.
image::images/code-coverage-report2.png[]
@@ -318,13 +318,13 @@
image::images/project-ctxmenu.png[]
-[start=2]
+
. Выберите в нем категорию "PHPUnit". Откроется диалоговое окно, в котором можно выбрать особый файл начальной загрузки, конфигурацию XML, сценарий PHPUnit или файл набора тестов.
image::images/proj-properties.png[]
-[start=3]
+
. Пользователи, не знакомые со структурой начальной нагрузки или файлами конфигурации XML можно использовать IDE NetBeans для создания основы. Инструкции по использованию диалогового доступны при выборе 'Справка'.
image::images/proj-properties-selected.png[]
@@ -356,16 +356,16 @@
image::images/new-selenium.png[]
-[start=4]
+
. При первом создании теста Selenium будет открыто диалоговое окно, позволяющее установить каталог для файлов теста Selenium. Этот каталог должен отличаться от каталога файлов теста PHPUnit. В противном случае тесты Selenium будут запускаться при каждом запуске модульных тестов. Запуск функциональных тестов вида Selenium обычно занимает больше времени, чем запуск модульных тестов, поэтому их совместный запуск с модульными тестами скорее всего нежелателен.
-[start=5]
+
. Примите параметры по умолчанию на странице "Имя и местоположение" и нажмите кнопку "Готово". Новый файл теста Selenium откроется в редакторе и появится в окне "Проекты".
image::images/selenium-test-in-project.png[]
-[start=6]
+
. Элемент "Выполнить тесты Selenium" добавлен в контекстное меню проекта. Щелкните этот элемент, и результаты теста Selenium отобразятся в окне "Результаты теста", как и для тестов PHPUnit.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/phpunit_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/phpunit_zh_CN.asciidoc
index 622795a..4f6285f 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/phpunit_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/phpunit_zh_CN.asciidoc
@@ -85,7 +85,7 @@
?>
----
-[start=2]
+
. 添加一个包含 link:http://sebastian-bergmann.de/archives/628-Improved-Skeleton-Generator-in-PHPUnit-3.html[+@assert 标注+]以及一些样例输入和输出的注释块。请注意,本示例中包括一个错误的断言。
[source,php]
@@ -116,13 +116,13 @@
image::images/assert-cc-complete.png[]
-[start=3]
+
. 在 "Projects"(项目)窗口中,右键单击 "Calculator.php" 节点,然后选择 "Tools"(工具)> "Create PHPUnit Tests"(创建 PHPUnit 测试)。请注意,您可以在 "Source Files"(源文件)节点的上下文菜单中为项目中的所有文件创建测试。
image::images/create-tests.png[]
-[start=4]
+
. 第一次创建测试时,将会打开一个对话框,询问您要存储测试文件的目录。在本示例中,使用“浏览”功能创建了 ``tests`` 目录。
image::images/test-directory.png[]
@@ -132,7 +132,7 @@
image::images/test-in-folder.png[]
-[start=5]
+
. IDE 在一个名为 CalculatorTest.php 的文件中生成框架测试类,在 "Projects"(项目)窗口中会显示该文件,并在编辑器中将其打开。
image::images/test-class-in-project.png[]
@@ -155,7 +155,7 @@
}
----
-[start=6]
+
. 您既可以测试单个文件,也可以测试整个项目。要测试项目,请右键单击项目的父节点,然后选择 "Test"(测试)或按 Alt-F6 组合键。要测试 Calculator.php 文件,请右键单击该文件的节点,然后选择 "Test"(测试),或者按 Ctrl-F6/⌘-F6 组合键。本示例只有一个文件,且该文件中只有一个类,因此两种测试结果相同。IDE 会运行测试并在 "Test Results"(测试结果)窗口中显示结果。
image::images/test-results-narrow.png[]
@@ -181,19 +181,19 @@
image::images/test-group-properties.png[]
-[start=3]
+
. 在编辑器中打开 ``CalculatorTest.php`` 。
-[start=4]
+
. 为 ``testAdd`` 、 ``testAdd3`` 和 ``testAdd5`` 方法添加标注 ``@group production`` 。
image::images/production-group-annotation.png[]
-[start=5]
+
. 对于方法 ``testAdd2`` 和 ``testAdd4`` ,添加标注 ``@group production`` 和 ``@group development`` 。image:images/production-development-group-code.png[]
-[start=6]
+
. 右键单击 ``Calculator.php`` 节点,然后选择 "Test"(测试)。此时将会打开一个对话框,询问您要运行哪些测试组。选择 "development",然后单击 "OK"(确定)。IDE 只运行使用 ``@group development`` 标注的测试。
image::images/select-test-group.png[]
@@ -261,19 +261,19 @@
----
-[start=2]
+
. 右键单击项目节点。从上下文菜单中,选择 "Code Coverage"(代码覆盖率)> "Collect and Display Code Coverage"(收集并显示代码覆盖率)。默认情况下,"Show Editor Bar"(显示编辑器栏)也会处于选定状态。
image::images/turn-on-code-coverage.png[]
-[start=3]
+
. 现在,编辑器会在底部显示代码覆盖率编辑器栏。由于尚未测试代码覆盖率,因此编辑器栏报告覆盖率为 0%。(在单击 "Clear"(清除)以清除测试结果后,编辑器栏也会显示覆盖率为 0%。)
image::images/editor-bar-before.png[]
-[start=4]
+
. 单击 "Test"(测试)以测试打开的文件,或单击 "All Tests"(所有测试)以运行项目的所有测试。此时显示 "Test Results"(测试结果)。此外,"Code Coverage"(代码覆盖率)栏会告知您测试所覆盖的可执行代码语句百分比。在编辑器窗口中,覆盖的代码将以绿色突出显示,未覆盖的代码将以红色突出显示。
*警告:*如果在添加 add2 函数之后重新生成测试文件,则不会运行 PHPUnit 测试。这是因为 PHPUnit 创建了两个冲突的 testAdd2 函数。如果您计划对多个此类函数使用 PHPUnit,则不要通过在末尾附加数字的方式来区分函数。请参见 link:http://www.phpunit.de/ticket/701[+PHPUnit 文档+]。
@@ -281,13 +281,13 @@
image::images/editor-bar-after.png[]
-[start=5]
+
. 在编辑器栏中,单击 "Report..."(报告...)。代码覆盖率报告打开,其中显示了对项目运行的所有测试的结果。使用报告中的按钮,您可以清除结果,再次运行所有测试或取消激活代码覆盖率(单击 "Done"(完成))。
image::images/code-coverage-report.png[]
-[start=6]
+
. 您可以在项目中添加其他类;删除测试文件,然后重新创建测试文件;接下来,再次查看代码覆盖率报告。此时将会列出新类。在下面的报告中, ``Calculator`` 类又有一个函数未包括在测试中。
image::images/code-coverage-report2.png[]
@@ -310,13 +310,13 @@
image::images/project-ctxmenu.png[]
-[start=2]
+
. 选择 PHPUnit 类别。此时将打开一个对话框,可以在其中选择定制引导、XML 配置、PHPUnit 脚本或测试套件文件。
image::images/proj-properties.png[]
-[start=3]
+
. 如果您不熟悉引导或 XML 配置文件的结构,可以使用 NetBeans IDE 生成框架。您还可以通过单击 "Help"(帮助)查找有关使用该对话框的说明。
image::images/proj-properties-selected.png[]
@@ -343,25 +343,25 @@
1. 打开命令提示符,然后运行 ``pear install Testing_Selenium-beta`` 命令。您需要在 Path 变量中包含 ``PHP_HOME/php/PEAR`` 。如果成功运行该命令,则将显示以下提示: ``install ok: channel://pear.php.net/Testing_Selenium-0.4.3`` 。
-[start=2]
+
. 在 IDE 中,打开 "Tools"(工具)> "Plugins"(插件),然后安装 "Selenium Module for PHP"。
-[start=3]
+
. 在 "Projects"(项目)窗口中,右键单击 Calculator 项目的节点。选择 "New"(新建)> "Other"(其他)。此时将打开新建文件向导。选择 "Selenium",然后单击 "Next"(下一步)。
image::images/new-selenium.png[]
-[start=4]
+
. 第一次创建 Selenium 测试时,将会打开一个对话框,要求您设置 Selenium 测试文件的目录。此目录应不同于 PHPUnit 测试文件的目录。否则,每次运行单元测试时,Selenium 测试都会运行。运行 Selenium 之类的功能测试通常比运行单元测试所花费的时间长,因此在每次运行单元测试时,您可能不会希望运行这些测试。
-[start=5]
+
. 接受 "Name and Location"(名称和位置)页中的默认设置,然后单击 "Finish"(完成)。新 Selenium 测试文件在编辑器中打开,并在 "Projects"(项目)窗口中显示。
image::images/selenium-test-in-project.png[]
-[start=6]
+
. 现在,"Run Selenium Tests"(运行 Selenium 测试)项已添加到项目的上下文菜单中。单击此项,Selenium 测试结果随即显示在与 PHPUnit 测试相同的 "Test Results"(测试结果)窗口中。
diff --git a/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc
index 18a6adf..2560161 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc
@@ -79,13 +79,13 @@
A copy of the source files must be kept in a subfolder of the document root. However, you can have your Sources Folder in a different location than the document root and copy source files from this location to the document root. See <<copy-sources,Specifying the Run Configuration>>.
-[start=4]
+
. From the Default Encoding dropdown list, choose the default encoding for your project.
. If you want to store NetBeans metadata in a different location than your source files, select "Put NetBeans metadata into a separate directory." For example, you might want to store your sources in your document root but the NetBeans metadata in your NetBeansProjects directory.
image::images/new-php-project-m1.png[]
-[start=6]
+
. Click Next. The Run Configuration panel opens.
@@ -97,13 +97,13 @@
NOTE: If you are going to run the <<localServer,project on a local web server>>, do not forget to specify <<copyFilesFromSourcesFolder,copying the source files>> to it.
-[start=4]
+
. From the Default Encoding dropdown list, choose the default encoding for your project.
. If you want to store NetBeans metadata in a different location than your source files, select "Put NetBeans metadata into a separate directory." For example, you might want to store your sources in your document root but the NetBeans metadata in your NetBeansProjects directory.
image::images/new-php-project-with-ssources.png[]
-[start=6]
+
. Click Next. The Run Configuration panel opens.
@@ -115,7 +115,7 @@
The document root is the folder where the local web server looks for files to open in the browser. The document root is specified in the web server link:../../trails/php.html#configuration[+configuration file+]. After installation, the New Project wizard locates the document root and by default specifies the following path: ``<Document Root>\<New PHP Project>`` . Note that it is useful to be able to test the project on a local server.
-[start=4]
+
. If you want to store NetBeans metadata in a different location than your source files, select "Put NetBeans metadata into a separate directory." For example, you might want to store your sources in your document root but the NetBeans metadata in your NetBeansProjects directory.
. Click Next. The Remote Connection panel opens. The tutorial link:remote-hosting-and-ftp-account.html[+Deploying a PHP Application to a Remote Web Server+] describes how to set up remote connections.
@@ -149,13 +149,13 @@
image::images/run-configuration-local-server-project-with-existing-sources.png[]
-[start=3]
+
. If you are creating the project from existing sources, you can choose which source file to use as the index file.
. To store the project's source files in a different directory than the NetBeans IDE project, select "Copy files from Sources Folder to another location". _If you are creating a project from existing sources, this is a required step, unless the existing sources were already in the web folder of your Apache server._
The field by default specifies the following path: `` <Document Root>\<New PHP Project>`` . Use the Browse button to specify a different path, if necessary.
The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server link:../../trails/php.html#configuration[+configuration file+].
The wizard detects the Apache installation type, either a component or within a package, and provides the path to the default location of the ``htdocs`` folder for the current installation type. Therefore, if you accepted the default settings during the installation of the Apache server or the AMP package, choose the path from the dropdown list.
-[start=5]
+
. Click Finish. The IDE creates your PHP project.
@@ -170,12 +170,12 @@
image::images/project-properties-script.png[]
-[start=2]
+
. To specify the location of the PHP engine, click the Configure button next to the Use Default PHP Interpreter box. The PHP Options dialog opens on the General tab.
image::images/run-config-script-options-m1.png[]
-[start=3]
+
. In the PHP 5 Interpreter field, specify the path to the ``php.exe`` file. Use the Browse or Search... button, if necessary.
. To specify how the script execution results will be shown, select the relevant checkbox in the Open Result In area. The following options are available:
@@ -183,7 +183,7 @@
* Web Browser. The default browser window will open with the results of executing a script in the form of an HTML file.
* Editor. The results of executing a script will open as an HTML file in the IDE editor window.
-[start=5]
+
. Click OK. The Options dialog box closes and the system returns to the Run Configuration panel.
. Add any arguments, such as ``debug=true`` , and any link:http://www.php.net/manual/en/features.commandline.options.php[+PHP command-line options+].
@@ -204,7 +204,7 @@
image::images/pprop-sources.png[]
-[start=4]
+
. To complete the project customization, click OK.
@@ -221,7 +221,7 @@
image::images/pprop-runconfig.png[]
-[start=6]
+
. To complete the project customization, click OK.
@@ -237,7 +237,7 @@
image::images/pprop-include-path.png[]
-[start=5]
+
. To complete the project customization, click OK.
@@ -252,7 +252,7 @@
image::images/global-formatting.png[]
-[start=3]
+
. From the Language dropdown list, select the language to which the settings should be applied.
. From the Categories dropdown list, select the format items to which the setting will be applied.
. Set your desired formatting and click OK.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/project-setup_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/project-setup_ja.asciidoc
index d05496f..e2707d1 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/project-setup_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/project-setup_ja.asciidoc
@@ -79,16 +79,16 @@
ソース・ファイルのコピーは、ドキュメント・ルートのサブフォルダに保持される必要があります。ただし、ドキュメント・ルート以外の別の場所にソース・フォルダを保持することもでき、この場所からドキュメント・ルートにソース・ファイルをコピーすることもできます。<<copy-sources,実行構成の指定>>を参照してください。
-[start=4]
+
. 「デフォルトのエンコーディング」ドロップダウン・リストから、プロジェクトでデフォルトとなるエンコーディングを選択します。
-[start=5]
+
. NetBeansのメタデータをソース・ファイル以外の別の場所に保存する場合、「NetBeansのメタデータを別のディレクトリに配置」を選択します。たとえば、ソースはドキュメント・ルートに保存するが、NetBeansのメタデータはNetBeansProjectsディレクトリに保存する場合です。
image::images/new-php-project-m1.png[]
-[start=6]
+
. 「次」をクリックします。「実行構成」パネルが開きます。
@@ -101,16 +101,16 @@
NOTE: <<localServer,プロジェクトをローカルWebサーバー>>で実行する場合は、そのサーバーへの<<copyFilesFromSourcesFolder,ソース・ファイルのコピー>>を指定することを忘れないでください。
-[start=4]
+
. 「デフォルトのエンコーディング」ドロップダウン・リストから、プロジェクトでデフォルトとなるエンコーディングを選択します。
-[start=5]
+
. NetBeansのメタデータをソース・ファイル以外の別の場所に保存する場合、「NetBeansのメタデータを別のディレクトリに配置」を選択します。たとえば、ソースはドキュメント・ルートに保存するが、NetBeansのメタデータはNetBeansProjectsディレクトリに保存する場合です。
image::images/new-php-project-with-ssources.png[]
-[start=6]
+
. 「次」をクリックします。「実行構成」パネルが開きます。
@@ -123,10 +123,10 @@
ドキュメント・ルートは、ローカルWebサーバーがブラウザで開くファイルを探すフォルダです。ドキュメント・ルートは、Webサーバーのlink:../../trails/php.html#configuration[+構成ファイル+]で指定されています。インストール後、新規プロジェクト・ウィザードによってドキュメント・ルートが検索され、デフォルトでは、 ``<ドキュメント・ルート>\<新規PHPプロジェクト>`` というパスが指定されます。プロジェクトをローカル・サーバーでテストできることは便利です。
-[start=4]
+
. NetBeansのメタデータをソース・ファイル以外の別の場所に保存する場合、「NetBeansのメタデータを別のディレクトリに配置」を選択します。たとえば、ソースはドキュメント・ルートに保存するが、NetBeansのメタデータはNetBeansProjectsディレクトリに保存する場合です。
-[start=5]
+
. 「次」をクリックします。「リモート接続」パネルが開きます。チュートリアルのlink:remote-hosting-and-ftp-account.html[+リモートWebサーバーへのPHPアプリケーションのデプロイ+]に、リモート接続の設定方法が説明されています。
@@ -160,16 +160,16 @@
image::images/run-configuration-local-server-project-with-existing-sources.png[]
-[start=3]
+
. 既存のソースからプロジェクトを作成する場合、インデックス・ファイルとして使用するソース・ファイルを選択できます。
-[start=4]
+
. プロジェクトのソース・ファイルをNetBeans IDEプロジェクトとは異なるディレクトリに格納するには、「ファイルをソース・フォルダから別の場所にコピー」を選択します。_プロジェクトを既存のソースから作成する場合は、既存のソースがApacheサーバーのWebフォルダにすでに存在しないかぎり、これは必要なステップです。_
フィールドにはデフォルトで、 ``<ドキュメント・ルート>\<新規PHPプロジェクト>`` というパスが指定されています。必要な場合は、「参照」ボタンを使用して別のパスを指定します。
ドキュメント・ルートは、Webサーバーがブラウザで開くファイルを探すフォルダです。ドキュメント・ルートは、Webサーバーのlink:../../trails/php.html#configuration[+構成ファイル+]で指定されています。
ウィザードは、Apacheのインストール・タイプ(コンポーネントまたはパッケージ内のいずれか)を検出し、現在のインストール・タイプ用に ``htdocs`` フォルダのデフォルトの場所へのパスを提供します。そのため、ApacheサーバーまたはAMPパッケージのインストール中にデフォルトの設定を受け入れた場合は、ドロップダウン・リストからパスを選択します。
-[start=5]
+
. 「終了」をクリックします。IDEによってPHPプロジェクトが作成されます。
@@ -185,26 +185,26 @@
image::images/project-properties-script.png[]
-[start=2]
+
. PHPエンジンの場所を指定するには、「デフォルトのPHPインタプリタを使用」ボックスの横にある「構成」ボタンをクリックします。PHPオプションのダイアログの「一般」タブが開きます。
image::images/run-config-script-options-m1.png[]
-[start=3]
+
. 「PHP 5インタプリタ」フィールドで、 ``php.exe`` ファイルへのパスを指定します。必要な場合は、「参照」または「検索」ボタンを使用します。
-[start=4]
+
. スクリプトの実行結果の表示方法を指定するには、「結果を開く場所」領域で適切なチェックボックスを選択します。次のオプションがあります。
* 出力ウィンドウ。スクリプトの実行結果は、NetBeans IDEウィンドウの下部にある出力ウィンドウに表示されます。
* Webブラウザ。スクリプト実行の結果は、HTMLファイルの形式でデフォルトのブラウザ・ウィンドウに表示されます。
* エディタ。スクリプト実行の結果は、HTMLファイルとしてIDEエディタ・ウィンドウに表示されます。
-[start=5]
+
. 「OK」をクリックします。「オプション」ダイアログ・ボックスが閉じ、システムは「実行構成」パネルに戻ります。
-[start=6]
+
. ``debug=true`` などの任意の引数と、link:http://www.php.net/manual/en/features.commandline.options.php[+PHPコマンド行オプション+]を追加します。
@@ -225,7 +225,7 @@
image::images/pprop-sources.png[]
-[start=4]
+
. プロジェクトのカスタマイズを完了するには、「OK」をクリックします。
@@ -243,7 +243,7 @@
image::images/pprop-runconfig.png[]
-[start=6]
+
. プロジェクトのカスタマイズを完了するには、「OK」をクリックします。
@@ -260,7 +260,7 @@
image::images/pprop-include-path.png[]
-[start=5]
+
. プロジェクトのカスタマイズを完了するには、「OK」をクリックします。
@@ -276,16 +276,16 @@
image::images/global-formatting.png[]
-[start=3]
+
. 言語ドロップダウン・リストから、設定を適用する言語を選択します。
-[start=4]
+
. 「カテゴリ」ドロップダウン・リストから、設定を適用するフォーマット項目を選択します。
-[start=5]
+
. 目的のフォーマットを設定して「OK」をクリックします。
-[start=6]
+
. 詳細情報については「ヘルプ」ボタンをクリックします。
*プロジェクト固有のフォーマットを定義するには、次を実行します。*
diff --git a/netbeans.apache.org/src/content/kb/docs/php/project-setup_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/project-setup_pt_BR.asciidoc
index b637356..eb3a460 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/project-setup_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/project-setup_pt_BR.asciidoc
@@ -80,16 +80,16 @@
Uma cópia dos arquivos de código-fonte deve ser mantida em uma subpasta da raiz do documento. Entretanto, você pode ter uma Pasta de Códigos-Fonte em um local diferente da raiz do documento e copiar os arquivos de código-fonte desse local para a raiz do documento. Consulte <<copy-sources,Especificando a Configuração de Execução>>.
-[start=4]
+
. Na lista drop-down Codificação Default, selecione a codificação default do seu projeto.
-[start=5]
+
. Se você desejar armazenar metadados do NetBeans em um local diferente dos seus arquivos de código-fonte, selecione "Colocar metadados do NetBeans em um diretório separado". Por exemplo, você pode querer armazenar seus códigos-fonte na raiz do documento, mas os metadados do NetBeans no diretório Projetos do NetBeans.
image::images/new-php-project-m1.png[]
-[start=6]
+
. Clique em Próximo. O painel Configuração de Execução será aberto.
@@ -102,16 +102,16 @@
NOTE: <<localServer, se você for executar o projeto em um servidor Web local, não se esqueça de especificar a >><<copyFilesFromSourcesFolder,cópia dos arquivos de código-fonte>> para ele.
-[start=4]
+
. Na lista drop-down Codificação Default, selecione a codificação default do seu projeto.
-[start=5]
+
. Se você desejar armazenar metadados do NetBeans em um local diferente dos seus arquivos de código-fonte, selecione "Colocar metadados do NetBeans em um diretório separado". Por exemplo, você pode querer armazenar seus códigos-fonte na raiz do documento, mas os metadados do NetBeans no diretório Projetos do NetBeans.
image::images/new-php-project-with-ssources.png[]
-[start=6]
+
. Clique em Próximo. O painel Configuração de Execução será aberto.
@@ -124,10 +124,10 @@
A raiz do documento é a pasta em que o servidor Web local procura pelos arquivos a serem abertos no browser. A raiz do documento é especificada no link:../../trails/php.html#configuration[+arquivo de configuração+] do servidor Web. Depois da instalação, o assistente Novo Projeto localiza a raiz do documento e por default especifica o seguinte caminho: ``<Raiz do Documento>\<Novo Projeto PHP>`` . Observe que é útil poder testar o projeto em um servidor local.
-[start=4]
+
. Se você desejar armazenar metadados do NetBeans em um local diferente dos seus arquivos de código-fonte, selecione "Colocar metadados do NetBeans em um diretório separado". Por exemplo, você pode querer armazenar seus códigos-fonte na raiz do documento, mas os metadados do NetBeans no diretório Projetos do NetBeans.
-[start=5]
+
. Clique em Próximo. O painel Conexão Remota será aberto. O tutorial link:remote-hosting-and-ftp-account.html[+Implantando uma Aplicação PHP em um Servidor Web Remoto+] descreve como configurar conexões remotas.
@@ -161,16 +161,16 @@
image::images/run-configuration-local-server-project-with-existing-sources.png[]
-[start=3]
+
. Se você estiver criando um projeto a partir de códigos-fonte existentes, poderá selecionar qual arquivo de código-fonte usar como o arquivo de índice.
-[start=4]
+
. Para armazenar os arquivos de código-fonte do projeto em um diretório diferente do diretório do projeto NetBeans IDE, selecione “Copiar arquivos da Pasta de Códigos-Fonte para outro local”. _Se você estiver criando um projeto a partir de códigos-fonte existentes, essa é uma etapa necessária, a não ser que os códigos-fonte existentes já estejam na pasta Web do servidor Apache._
O campo, por default, especifica o seguinte caminho: ``<Raiz do Documento>\<Novo Projeto PHP>`` . Se necessário, use o botão Procurar para especificar um caminho diferente.
A raiz do documento é a pasta em que o servidor Web procura por arquivos a serem abertos no browser. A raiz do documento é especificada no link:../../trails/php.html#configuration[+arquivo de configuração+] do servidor Web.
O assistente detecta o tipo de instalação do Apache, um componente ou dentro de um pacote, e fornece o caminho para a localização default da pasta ``htdocs`` do tipo de instalação atual. Portanto, se você tiver aceitado as definições default durante a instalação do servidor Apache ou do pacote AMP, selecione o caminho na lista drop-down.
-[start=5]
+
. Clique em Finalizar. O IDE criará o projeto PHP.
@@ -186,26 +186,26 @@
image::images/project-properties-script.png[]
-[start=2]
+
. Para especificar a localização do mecanismo PHP, clique no botão Configurar ao lado da caixa Usar Interpretador PHP Default. A caixa de diálogo Opções do PHP será aberta na guia Geral.
image::images/run-config-script-options-m1.png[]
-[start=3]
+
. No campo Interpretador do PHP 5, especifique o caminho para o arquivo ``php.exe`` . Use o botão Procurar ou Pesquisar..., se necessário.
-[start=4]
+
. Para especificar como os resultados da execução do script serão mostrados, marque a caixa de seleção relevante na área Abrir Resultado Em. As seguintes opções estão disponíveis:
* Janela de Saída. Os resultados da execução de um script aparecerão na janela de saída na parte inferior da janela do NetBeans IDE.
* Web Browser. A janela do browser default se abrirá com os resultados da execução de um script no formato de um arquivo HTML.
* Editor. Os resultados da execução de um script se abrirão como um arquivo HTML na janela do editor do IDE.
-[start=5]
+
. Clique em OK. A caixa de diálogo Opções se fechará e o sistema retornará para o painel Configuração de Execução.
-[start=6]
+
. Adicionar qualquer argumento, como ``debug=true`` e qualquer link:http://www.php.net/manual/en/features.commandline.options.php[+opção de linha de comandos PHP+].
@@ -226,7 +226,7 @@
image::images/pprop-sources.png[]
-[start=4]
+
. Para concluir a personalização do projeto, clique em OK.
@@ -244,7 +244,7 @@
image::images/pprop-runconfig.png[]
-[start=6]
+
. Para concluir a personalização do projeto, clique em OK.
@@ -261,7 +261,7 @@
image::images/pprop-include-path.png[]
-[start=5]
+
. Para concluir a personalização do projeto, clique em OK.
@@ -277,16 +277,16 @@
image::images/global-formatting.png[]
-[start=3]
+
. Da lista drop-down Linguagem, selecione a linguagem na qual as definições deverão ser aplicadas.
-[start=4]
+
. Na lista drop-down Categorias, selecione os itens de formato nos quais a definição será aplicada.
-[start=5]
+
. Defina sua formatação desejada e clique em OK.
-[start=6]
+
. Clique no botão Ajuda para obter informações detalhadas.
*Para definir a formatação específica do projeto:*
diff --git a/netbeans.apache.org/src/content/kb/docs/php/project-setup_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/project-setup_ru.asciidoc
index 7df0f56..7449d35 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/project-setup_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/project-setup_ru.asciidoc
@@ -79,16 +79,16 @@
Копия исходных файлов должна быть сохранена в подпапке корневого узла документов. Однако папка "Sources Folder" не обязательно должна находиться в корневом узле документов, ей можно назначить и другое местоположение и отсюда копировать исходные файлы в корневой узел. См. раздел <<copy-sources,Выбор настройки выполнения нового проекта>>.
-[start=4]
+
. В раскрывающемся списке "Default Encoding" ("Кодировка по умолчанию") выберите для проекта кодировку по умолчанию.
-[start=5]
+
. Если требуется сохранение метаданных NetBeans в другом местоположении (не в папке "Source files"), выберите команду "Put NetBeans metadata into a separate directory" ("Поместить метаданные NetBeans в отдельный каталог"). Например, может потребоваться сохранение исходных файлов в корневом узле документов, а метаданных NetBeans – в каталоге "NetBeansProjects".
image::images/new-php-project-m1.png[]
-[start=6]
+
. Нажмите кнопку "Далее". Откроется панель "Настройки выполнения".
@@ -101,16 +101,16 @@
NOTE: Если планируется запуск <<localServer,проекта на локальном веб-сервере>>, не забудьте указать <<copyFilesFromSourcesFolder,копирование исходного файла>> в него.
-[start=4]
+
. В раскрывающемся списке "Default Encoding" ("Кодировка по умолчанию") выберите для проекта кодировку по умолчанию.
-[start=5]
+
. Если требуется сохранение метаданных NetBeans в другом местоположении (не в папке "Source files"), выберите команду "Put NetBeans metadata into a separate directory" ("Поместить метаданные NetBeans в отдельный каталог"). Например, может потребоваться сохранение исходных файлов в корневом узле документов, а метаданных NetBeans – в каталоге "NetBeansProjects".
image::images/new-php-project-with-ssources.png[]
-[start=6]
+
. Нажмите кнопку "Далее". Откроется панель "Настройки выполнения".
@@ -123,10 +123,10 @@
Корневой узел документов представляет собой папку, в которой на локальном веб-сервере выполняется поиск файлов для просмотра в браузере. Корневой узел документов указан в link:../../trails/php.html#configuration[+файле настройки+] веб-сервера. После завершения установки мастер создания проекта определяет корневой узел документов и по умолчанию указывает следующий путь: ``<Document Root>\<New PHP Project>`` . Обратите внимание, что полезно иметь возможность протестировать проект на локальном сервере.
-[start=4]
+
. Если требуется сохранение метаданных NetBeans в другом местоположении (не в папке "Source files"), выберите команду "Put NetBeans metadata into a separate directory" ("Поместить метаданные NetBeans в отдельный каталог"). Например, может потребоваться сохранение исходных файлов в корневом узле документов, а метаданных NetBeans – в каталоге "NetBeansProjects".
-[start=5]
+
. Нажмите кнопку "Далее". Откроется панель "Remote Connection" ("Удаленное подключение"). Процесс настройки удаленных подключений описан в учебном курсе link:remote-hosting-and-ftp-account.html[+Развертывание приложения PHP на удаленном веб-сервере+].
@@ -160,16 +160,16 @@
image::images/run-configuration-local-server-project-with-existing-sources.png[]
-[start=3]
+
. При создании проекта из существующих исходных кодов можно выбрать файл исходного кода для использования в качестве файла индекса.
-[start=4]
+
. Для хранения исходных файлов проекта в другом каталоге, отличном от проекта IDE NetBeans выберите "Копировать файлы из папки исходных файлов в другое местоположение". _При создании проекта из существующих исходных кодов данное действие является обязательным, кроме случаев, когда существующие исходные коды уже находились в папке "web" сервера Apache._
В этом поле по умолчанию указан следующий путь: `` <Document Root>\<New PHP Project>`` . Используйте кнопку "Browse" ("Обзор") для указания другого пути при необходимости.
Корень документов – это папка, в которой веб-сервер ищет файлы для открытия в браузере. Корневой узел документов указан в link:../../trails/php.html#configuration[+файле настройки+] веб-сервера.
Мастер обнаруживает тип установки Apache либо как отдельного компонента, либо в составе пакета и предлагает путь к папке по умолчанию ``htdocs`` (папка для текущего типа установки). Поэтому при принятии параметров по умолчанию в течение настройки сервера Apache или пакета AMP следует выбрать соответствующий путь в раскрывающемся списке.
-[start=5]
+
. Нажмите кнопку 'Готово'. Среда IDE создает проект PHP.
@@ -185,26 +185,26 @@
image::images/project-properties-script.png[]
-[start=2]
+
. Чтобы указать местоположение механизма PHP, нажмите кнопку "Configure" рядом с окном "Use Default PHP Interpreter". На вкладке "General" откроется диалоговое окно "PHP Options".
image::images/run-config-script-options-m1.png[]
-[start=3]
+
. В поле "PHP 5 Interpreter" укажите путь к файлу ``php.exe`` . При необходимости используйте кнопку "Browse" или кнопку "Search...".
-[start=4]
+
. Для указания формы отображения результатов выполнения сценария установите соответствующий флажок в области "Open Result In". Доступны следующие параметры:
* Окно 'Результаты'. Результаты выполнения сценария будут отображены в окне выходных данных в нижней части окна IDE NetBeans.
* Веб-браузер. Откроется окно браузера по умолчанию с результатами выполнения сценария в форме файла HTML.
* Редактор. Результаты выполнения сценария отобразятся в виде файла HTML в окне редактора IDE.
-[start=5]
+
. Нажмите кнопку "ОК". Диалоговое окно "Options" закроется, и будет выполнен возврат к панели "Run Configuration".
-[start=6]
+
. Добавьте любые аргументы, например ``debug=true`` и любые link:http://www.php.net/manual/en/features.commandline.options.php[+необязательные параметры командной строки PHP+].
@@ -225,7 +225,7 @@
image::images/pprop-sources.png[]
-[start=4]
+
. Для завершения настройки проекта нажмите кнопку "ОК".
@@ -243,7 +243,7 @@
image::images/pprop-runconfig.png[]
-[start=6]
+
. Для завершения настройки проекта нажмите кнопку "ОК".
@@ -260,7 +260,7 @@
image::images/pprop-include-path.png[]
-[start=5]
+
. Для завершения настройки проекта нажмите кнопку "ОК".
@@ -276,16 +276,16 @@
image::images/global-formatting.png[]
-[start=3]
+
. В раскрывающемся списке "Language" выберите язык, к которому должны быть применены параметры установки.
-[start=4]
+
. В раскрывающемся списке "Categories" выберите элементы формата, к которым будут применены эти параметры.
-[start=5]
+
. Укажите нужный тип форматирования и нажмите кнопку "ОК".
-[start=6]
+
. Для получения дополнительных сведений нажмите кнопку "Help".
*Выбор форматирования конкретного проекта.*
@@ -304,10 +304,10 @@
*Добавление библиотек JavaScript к проекту.*
-[start=1]
+
. Загрузите необходимые библиотеки JavaScript или укажите их местоположение, если они уже имеются.
-[start=2]
+
. Скопируйте библиотеки JavaScript в папку с проектом PHP с помощью среды IDE или проводника файлов.
Если свойства проекта установлены таким образом, что исходные коды проекта копируются в другое местоположение (см. <<sources,Исходные коды>>), то библиотеки JavaScript также будут копироваться в это местоположение. Если развертывание проекта осуществляется на удаленном сервере, то библиотеки JavaScript загружаются на этот сервере при следующей загрузке на него исходных кодов проекта.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/project-setup_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/project-setup_zh_CN.asciidoc
index 2ae9443..ec1a4db 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/project-setup_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/project-setup_zh_CN.asciidoc
@@ -80,16 +80,16 @@
源文件的副本必须保存在文档根目录的子文件夹中。不过,您也可以选择文档根目录以外的其他位置作为源文件夹,然后将该位置中的源文件复制到文档根目录。请参见<<copy-sources,指定运行配置>>。
-[start=4]
+
. 从 "Default Encoding"(默认编码)下拉列表中,选择项目的默认编码。
-[start=5]
+
. 如果要在不同于源文件的位置存储 NetBeans 元数据,请选择 "Put NetBeans metadata into a separate directory."(将 NetBeans 元数据放入单独的目录)。例如,您可能希望将源文件存储在文档根目录,而将 NetBeans 元数据存储在 NetBeansProjects 目录。
image::images/new-php-project-m1.png[]
-[start=6]
+
. 单击 "Next"(下一步)。"Run Configuration"(运行配置)面板打开。
@@ -102,16 +102,16 @@
NOTE: 如果要<<localServer,在本地 Web 服务器上运行项目>>,请不要忘记指定<<copyFilesFromSourcesFolder,将源文件复制>>到该服务器上。
-[start=4]
+
. 从 "Default Encoding"(默认编码)下拉列表中,选择项目的默认编码。
-[start=5]
+
. 如果要在不同于源文件的位置存储 NetBeans 元数据,请选择 "Put NetBeans metadata into a separate directory."(将 NetBeans 元数据放入单独的目录)。例如,您可能希望将源文件存储在文档根目录,而将 NetBeans 元数据存储在 NetBeansProjects 目录。
image::images/new-php-project-with-ssources.png[]
-[start=6]
+
. 单击 "Next"(下一步)。"Run Configuration"(运行配置)面板打开。
@@ -124,10 +124,10 @@
本地 Web 服务器会从文档根目录文件夹中查找要在浏览器中打开的文件。文档根目录是在 Web 服务器link:../../trails/php.html#configuration[+配置文件+]中指定的。安装完成后,新建项目向导将会找到文档根目录,并在默认情况下指定以下路径: ``<文档根目录>\<新 PHP 项目>`` 。请注意,必须能够在本地服务器上测试项目,这一点很有用。
-[start=4]
+
. 如果要在不同于源文件的位置存储 NetBeans 元数据,请选择 "Put NetBeans metadata into a separate directory."(将 NetBeans 元数据放入单独的目录)。例如,您可能希望将源文件存储在文档根目录,而将 NetBeans 元数据存储在 NetBeansProjects 目录。
-[start=5]
+
. 单击 "Next"(下一步)。"Remote Connection"(远程连接)面板打开。link:remote-hosting-and-ftp-account.html[+将 PHP 应用程序部署到远程 Web 服务器+]教程介绍了如何设置远程连接。
@@ -161,16 +161,16 @@
image::images/run-configuration-local-server-project-with-existing-sources.png[]
-[start=3]
+
. 如果项目是基于现有源创建的,则可以选择将哪个源文件用作索引文件。
-[start=4]
+
. 要将项目的源文件存储在不同于 NetBeans IDE 项目的目录中,请选择 "Copy files from Sources Folder to another location"(将源文件夹中的文件复制到其他位置)。_如果项目是基于现有源创建的,则这是必需的步骤,除非现有源已位于 Apache 服务器的 Web 文件夹中。_
默认情况下,该字段将指定以下路径: ``<文档根目录>\<新 PHP 项目>`` 。使用 "Browse"(浏览)按钮指定其他路径(如若需要)。
Web 服务器会从文档根目录文件夹中查找要在浏览器中打开的文件。文档根目录是在 Web 服务器link:../../trails/php.html#configuration[+配置文件+]中指定的。
该向导将检测 Apache 安装类型(组件或在包内),并提供当前安装类型的 ``htdocs`` 文件夹默认位置的路径。因此,如果在安装 Apache 服务器或 AMP 包的过程中接受了默认设置,请从下拉列表中选择路径。
-[start=5]
+
. 单击 "Finish"(完成)。IDE 将创建 PHP 项目。
@@ -186,26 +186,26 @@
image::images/project-properties-script.png[]
-[start=2]
+
. 要指定 PHP 引擎的位置,请单击 "Use Default PHP Interpreter"(使用默认 PHP 解释器)复选框旁边的 "Configure"(配置)按钮。此时将打开 PHP 的 "Options"(选项)对话框中的 "General"(常规)标签。
image::images/run-config-script-options-m1.png[]
-[start=3]
+
. 在 "PHP 5 Interpreter"(PHP 5 解释器)字段中,指定 ``php.exe`` 文件的路径。根据需要使用 "Browse..."(浏览...)或 "Search..."(搜索...)按钮。
-[start=4]
+
. 要指定脚本执行结果的显示方式,请在 "Open Result In"(显示结果的位置)区域中选中相关的复选框。可以使用以下选项:
* "Output"(输出)窗口。将在 NetBeans IDE 窗口底部的输出窗口中显示执行脚本的结果。
* Web 浏览器。将在默认的浏览器窗口中以 HTML 文件的形式显示执行脚本的结果。
* 编辑器。将在 IDE 编辑器窗口中以 HTML 文件的形式显示执行脚本的结果。
-[start=5]
+
. 单击 "OK"(确定)。将关闭 "Options"(选项)对话框,并且系统返回到 "Run Configuration"(运行配置)面板。
-[start=6]
+
. 添加任意参数,如 ``debug=true`` ,以及任意 link:http://www.php.net/manual/en/features.commandline.options.php[+PHP 命令行选项+]。
@@ -226,7 +226,7 @@
image::images/pprop-sources.png[]
-[start=4]
+
. 要完成项目定制,请单击 "OK"(确定)。
@@ -244,7 +244,7 @@
image::images/pprop-runconfig.png[]
-[start=6]
+
. 要完成项目定制,请单击 "OK"(确定)。
@@ -261,7 +261,7 @@
image::images/pprop-include-path.png[]
-[start=5]
+
. 要完成项目定制,请单击 "OK"(确定)。
@@ -277,16 +277,16 @@
image::images/global-formatting.png[]
-[start=3]
+
. 从 "Language"(语言)下拉列表中,选择将应用该设置的语言。
-[start=4]
+
. 从 "Categories"(类别)下拉列表中,选择将应用该设置的格式项。
-[start=5]
+
. 设置所需的格式,然后单击 "OK"(确定)。
-[start=6]
+
. 单击 "Help"(帮助)按钮,以获得详细信息。
*定义特定于项目的格式设置:*
diff --git a/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc
index 56db74f..55ec848 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc
@@ -69,14 +69,14 @@
image::images/new-project-name-location.png[title="Name and Location panel of New PHP Project wizard, with Source Folder location as XAmpp document root."]
-[start=4]
+
. In the Project Name text field, enter ``NewPHPProject`` .
. In the Sources Folder field, browse for your PHP document root and create a subfolder there called ``NewPHPProject`` . The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server link:index.html#configuration[+configuration file+]. For example, on Xampp, the document root is XAMPP_HOME/htdocs.
. Leave all other fields with their default values. Click Next. The Run Configuration window opens.
image::images/new-project-run-config.png[]
-[start=7]
+
. In the Run As drop-down list, select Local Web Site. The project will run on your local Apache server. Your other options are to run the project remotely via FTP and to run it from the command line.
. Leave the Project URL at default.
. Click Finish. The IDE creates the project.
@@ -90,7 +90,7 @@
image::images/getting-started-open-new-project.png[]
-[start=3]
+
. Enter the following code inside the ``<?php ?>`` block:
[source,php]
@@ -99,7 +99,7 @@
echo "Hello, world! This is my first PHP project!";
----
-[start=4]
+
. To run the project, position the cursor on the NewPHPProject node and choose Run from the context menu. The figure below shows what you should see in the browser window:
image::images/getting-started-browser-hello-world.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/quickstart_ja.asciidoc
index d665ace..8469bd8 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/quickstart_ja.asciidoc
@@ -71,25 +71,25 @@
image::images/new-project-name-location.png[title="XAmppドキュメント・ルートとして「ソース・フォルダ」の場所が指定された、新規PHPプロジェクト・ウィザードの「名前と場所」パネル。"]
-[start=4]
+
. 「プロジェクト名」テキスト・フィールドに、「 ``NewPHPProject`` 」と入力します。
-[start=5]
+
. 「ソース・フォルダ」フィールドで、PHPドキュメント・ルートを参照し、そこに ``NewPHPProject`` という名前のサブフォルダを作成します。ドキュメント・ルートは、Webサーバーがブラウザで開くファイルを探すフォルダです。ドキュメント・ルートは、Webサーバーのlink:../../trails/php.html#configuration[+構成ファイル+]で指定されています。たとえば、Xamppでは、ドキュメント・ルートはXAMPP_HOME/htdocsです。
-[start=6]
+
. 他のフィールドはすべてデフォルト値のままにします。「次」をクリックします。「実行構成」ウィンドウが開きます。
image::images/new-project-run-config.png[]
-[start=7]
+
. 「実行方法」ドロップダウン・リストで、「ローカルWebサイト」を選択します。プロジェクトはローカルのApacheサーバーで実行されます。その他のオプションは、FTP経由でリモートでのプロジェクトの実行と、コマンド行からのプロジェクトの実行です。
-[start=8]
+
. プロジェクトのURLはデフォルトのままにします。
-[start=9]
+
. 「終了」をクリックします。IDEによってプロジェクトが作成されます。
詳細は、link:project-setup.html[+NetBeansでのPHPプロジェクトの設定+]で学習してください。
@@ -103,7 +103,7 @@
image::images/getting-started-open-new-project.png[]
-[start=3]
+
. 次のコードを ``<?php?>>`` ブロック内部に入力します。
[source,php]
@@ -112,7 +112,7 @@
----
-[start=4]
+
. プロジェクトを実行するには、カーソルを「NewPHPProject」ノードに置き、コンテキスト・メニューから「実行」を選択します。ブラウザ・ウィンドウには、次の図のように表示されるはずです。
image::images/getting-started-browser-hello-world.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/quickstart_pt_BR.asciidoc
index bc908b8..7d32a9a 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/quickstart_pt_BR.asciidoc
@@ -71,25 +71,25 @@
image::images/new-project-name-location.png[title="Painel Nome e Localização do assistente Novo Projeto PHP, com localização da Pasta de Código-fonte como raiz de documento XAmpp"]
-[start=4]
+
. No campo de texto Nome do Projeto, digite ``NewPHPProject`` .
-[start=5]
+
. No campo Pasta de Códigos-fonte, procure a raiz do seu documento PHP e crie uma subpasta denominada ``NewPHPProject`` . A raiz do documento é a pasta em que o servidor Web procura por arquivos a serem abertos no browser. A raiz do documento é especificada no link:../../trails/php.html#configuration[+arquivo de configuração+] do servidor Web. Por exemplo, no Xampp, a raiz do documento é XAMPP_HOME/htdocs.
-[start=6]
+
. Deixe todos os outros campos com seus valores default. Clique em Próximo. O painel Configuração de Execução será aberto.
image::images/new-project-run-config.png[]
-[start=7]
+
. Na lista drop-down Executar Como, selecione Web Site Local. O projeto será executado no servidor Apache local. As outras opções são executar o projeto remotamente via FTP e executá-lo da linha de comandos.
-[start=8]
+
. Deixe o URL do projeto com o valor default.
-[start=9]
+
. Clique em Finalizar. O IDE criará o projeto.
Saiba mais sobre link:project-setup.html[+Configurando um projeto PHP no NetBeans+].
@@ -103,7 +103,7 @@
image::images/getting-started-open-new-project.png[]
-[start=3]
+
. Digite o seguinte código no bloco ``<?php ?>`` :
[source,php]
@@ -112,7 +112,7 @@
echo "Hello, world! This is my first PHP project!";
----
-[start=4]
+
. Para executar o projeto, posicione o cursor no nó NewPHPProject e selecione Executar no menu de contexto. A ilustração abaixo mostra o que deveria ser exibido na janela do browser:
image::images/getting-started-browser-hello-world.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/quickstart_ru.asciidoc
index 6227d49..f57bc50 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/quickstart_ru.asciidoc
@@ -72,13 +72,25 @@
2. В списке категорий выберите PHP.
3. В области "Проекты" выберите "Приложение PHP" и нажмите кнопку "Далее". Откроется панель "Новый проект PHP > Имя и местоположение".
image::images/new-project-name-location.png[title="Панель 'Имя и местоположение' мастера создания проектов PHP с местоположением исходной папки как корня документации XAmpp."]
-4. В текстовом поле наименования проекта введите ``NewPHPProject`` .
-5. В поле исходной папки перейдите к корню документов PHP и создайте подпапку ``NewPHPProject`` . Корень документов – это папка, в которой веб-сервер ищет файлы для открытия в браузере. Корневой узел документов указан в link:../../trails/php.html#configuration[+файле настройки+] веб-сервера. Например, в Xampp корнем документов является папка XAMPP_HOME/htdocs.
-6. В остальных полях оставьте значения по умолчанию. Нажмите кнопку "Далее". Откроется окно "Настройки выполнения".
+
+[start=4]
+. В текстовом поле наименования проекта введите ``NewPHPProject`` .
+
+[start=5]
+. В поле исходной папки перейдите к корню документов PHP и создайте подпапку ``NewPHPProject`` . Корень документов – это папка, в которой веб-сервер ищет файлы для открытия в браузере. Корневой узел документов указан в link:../../trails/php.html#configuration[+файле настройки+] веб-сервера. Например, в Xampp корнем документов является папка XAMPP_HOME/htdocs.
+
+[start=6]
+. В остальных полях оставьте значения по умолчанию. Нажмите кнопку "Далее". Откроется окно "Настройки выполнения".
image::images/new-project-run-config.png[]
-7. В раскрывающемся списке "Выполнить как" выберите "Локальный веб-сайт". Начнется выполнение проекта на локальном сервере Apache. Проект можно также выполнить удаленно через FTP или запустить его из командной строки.
-8. Оставьте поле "URL-адрес проекта" без изменений.
-9. Нажмите кнопку "Завершить". Средой IDE будет создан проект.
+
+[start=7]
+. В раскрывающемся списке "Выполнить как" выберите "Локальный веб-сайт". Начнется выполнение проекта на локальном сервере Apache. Проект можно также выполнить удаленно через FTP или запустить его из командной строки.
+
+[start=8]
+. Оставьте поле "URL-адрес проекта" без изменений.
+
+[start=9]
+. Нажмите кнопку "Завершить". Средой IDE будет создан проект.
Дополнительные сведения о link:project-setup.html[+настройке проекта PHP в NetBeans+].
@@ -88,7 +100,9 @@
1. Запустите среду IDE, выберите команду "Файл > Открыть проект". Откроется диалоговое окно "Открыть проект".
2. Выберите ``NewPHPProject`` и нажмите кнопку "Открыть проект". В окне проекта появится дерево проекта NewPHPProject, а в редакторе и в окне навигатора откроется файл ``index.php`` .
image::images/getting-started-open-new-project.png[]
-3. Введите следующий код в блок ``<?php ?>`` :
+
+[start=3]
+. Введите следующий код в блок ``<?php ?>`` :
[source,java]
----
@@ -96,7 +110,7 @@
echo "Hello, world! This is my first PHP project!";
----
-[start=4]
+
1. Для выполнения этого проекта поместите курсор на узел NewPHPProject и в контекстном меню выберите команду "Выполнить". На рисунке ниже показано, что должно отобразиться в окне браузера.
image::images/getting-started-browser-hello-world.png[]
Поздравляем! Программа работает!
diff --git a/netbeans.apache.org/src/content/kb/docs/php/quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/quickstart_zh_CN.asciidoc
index 5bf1b39..a319ab2 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/quickstart_zh_CN.asciidoc
@@ -71,25 +71,25 @@
image::images/new-project-name-location.png[title="新建 PHP 项目向导的 "Name and Location"(名称和位置)面板,其中 "Source Folder"(源文件夹)位置作为 XAmpp 文档根目录。"]
-[start=4]
+
. 在 "Project Name"(项目名称)文本字段中,输入 ``NewPHPProject`` 。
-[start=5]
+
. 在 "Sources Folder"(源文件夹)字段中,浏览到您的 PHP 文档根目录并在此处创建一个名为 ``NewPHPProject`` 的子目录。Web 服务器会从文档根目录文件夹中查找要在浏览器中打开的文件。文档根目录是在 Web 服务器link:../../trails/php.html#configuration[+配置文件+]中指定的。例如,对于 Xampp,文档根目录为 XAMPP_HOME/htdocs。
-[start=6]
+
. 将所有其他字段保留为其默认值。单击 "Next"(下一步)。"Run Configuration"(运行配置)窗口打开。
image::images/new-project-run-config.png[]
-[start=7]
+
. 在 "Run As"(运行方式)下拉列表中,选择 "Local Web Site"(本地 Web 站点)。该项目将在本地 Apache 服务器中运行。其他选项将通过 FTP 远程运行项目,以及在命令行中运行。
-[start=8]
+
. 将 "Project URL"(项目 URL)保留为默认值。
-[start=9]
+
. 单击 "Finish"(完成)。IDE 将创建该项目。
了解有关link:project-setup.html[+在 NetBeans 中设置 PHP 项目+]的更多信息。
@@ -103,7 +103,7 @@
image::images/getting-started-open-new-project.png[]
-[start=3]
+
. 在 ``<?php ?>`` 块内输入以下代码:
[source,php]
@@ -112,7 +112,7 @@
echo "Hello, world! This is my first PHP project!";
----
-[start=4]
+
. 要运行该项目,请将光标置于 "NewPHPProject" 节点上,然后从上下文菜单中选择 "Run"(运行)。下图显示了应在浏览器窗口中看到的内容:
image::images/getting-started-browser-hello-world.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account.asciidoc
index 4aaa54d..2fe4559 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account.asciidoc
@@ -99,13 +99,13 @@
image::images/manageremoteconnections.png[]
-[start=9]
+
. Click OK. You return to the Run Configuration panel.
-[start=10]
+
. In the Upload Directory field, enter the name of the subfolder in the initial directory where the source files will be uploaded. The prompt below the field shows the FTP host URL.
-[start=11]
+
. To complete setting up a new project, click Finish.
@@ -148,7 +148,7 @@
image::images/sync-ctxmenuitem.png[]
-[start=2]
+
. Select Synchronize. The IDE retrieves the file names and paths from the remote server and opens the Remote Synchronization dialog.
The Remote Synchronization dialog shows a table of project files. The remote versions on the file are on the left and the local versions are on the right. In the center column is an icon showing the operation that the IDE will perform on synchronization. Warning icons are on the far left. A summary of operations and problems appears at the bottom of the table. A verbose description of any errors appears below the table. Above the table are sets of checkboxes for filtering which problems and operations the dialog shows. For detailed information about this dialog, click Help.
@@ -156,31 +156,31 @@
image::images/main-dialog.png[]
-[start=3]
+
. Select multiple items in the table. At the bottom of the table the summary now only includes those items.
image::images/multiple-items.png[]
-[start=4]
+
. Right-click the selected items. A context menu of possible operations appears.
image::images/context-menu.png[]
-[start=5]
+
. If an item has a Resolve Conflicts error icon, select that item. A description of the error appears at the bottom of the table.
image::images/error-item.png[]
-[start=6]
+
. Select the item with an error. Select Diff... image:images/diff-icon.png[] from either the row of buttons or from the context menu. The Diff dialog opens. In this dialog, scroll down to each difference between the remote and local versions of the file. In the graphics view, you can apply or refuse to apply the remote change to your local file. If you want to edit the file manually, switch to the Textual tab. When you are finished with the diff, click OK. You return to the Remote Synchronization dialog. The operation for the file changes to Upload and the file is marked with an asterisk, because you changed it.
image::images/diff.png[]
-[start=7]
+
. If you have no conflict, click Synchronize. If you selected Show Summary Before Start, the Synchronize summary appears so you can review the operations one more time before performing the synchronization. If you approve of the operations, click OK.
image::images/sync-summary.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ja.asciidoc
index ed358a9..e606a1d 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ja.asciidoc
@@ -105,13 +105,13 @@
image::images/manageremoteconnections.png[]
-[start=9]
+
. 「OK」をクリックします。「実行構成」パネルに戻ります。
-[start=10]
+
. 「アップロード・ディレクトリ」フィールドで、ソース・ファイルがアップロードされる、初期ディレクトリのサブフォルダの名前を入力します。このフィールドの下のプロンプトにFTPホストのURLが表示されます。
-[start=11]
+
. 新規プロジェクトの設定を完了するには、「終了」をクリックします。
@@ -154,7 +154,7 @@
image::images/sync-ctxmenuitem.png[]
-[start=2]
+
. 「同期」を選択します。IDEでは、リモート・サーバーからファイル名とパスを取得し、リモート同期ダイアログが開きます。
リモート同期ダイアログには、プロジェクト・ファイルの表が表示されます。左側はファイルのリモート・バージョンで、右側はローカル・バージョンです。中央の列には、同期時にIDEで実行される操作を示すアイコンが表示されます。左端には警告アイコンが表示されます。表の最下部には、操作および問題のサマリーが表示されます。エラーの詳細な説明は、表の下に表示されます。表の上には、ダイアログに表示する問題や操作をフィルタリングするための一連のチェックボックスがあります。このダイアログの詳細を確認するには、「ヘルプ」をクリックしてください。
@@ -162,31 +162,31 @@
image::images/main-dialog.png[]
-[start=3]
+
. 表内で複数の項目を選択します。表の最下部のサマリーには、これらの項目のみが含まれます。
image::images/multiple-items.png[]
-[start=4]
+
. 選択した項目を右クリックします。コンテキスト・メニューに可能な操作が表示されます。
image::images/context-menu.png[]
-[start=5]
+
. 項目に「競合を解決」エラー・アイコンが表示されている場合は、その項目を選択します。表の最下部に、エラーの説明が表示されます。
image::images/error-item.png[]
-[start=6]
+
. エラーがある項目を選択します。ボタンの行、またはコンテキスト・メニューから、「差分」image:images/diff-icon.png[]を選択します。「差分」ダイアログが開きます。このダイアログで、ファイルのリモート・バージョンとローカル・バージョンの各差分まで下にスクロールします。グラフィックス表示で、リモートの変更をローカル・ファイルに適用するか、または適用を拒否できます。ファイルを手動で編集する場合は、「テキスト」タブに切り替えます。差分の処理が終了したら、「OK」をクリックします。リモート同期ダイアログに戻ります。ファイルに対する操作が「アップロード」に変わり、ファイルが変更されたことを示すアスタリスクがファイルにマークされます。
image::images/diff.png[]
-[start=7]
+
. 競合がない場合は、「同期」をクリックします。「開始前にサマリーを表示」を選択した場合は同期のサマリーが表示されるため、同期を実行する前に複数回、操作を確認できます。操作を承認する場合は、「OK」をクリックします。
image::images/sync-summary.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_pt_BR.asciidoc
index 5dd2970..45ccac6 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_pt_BR.asciidoc
@@ -105,13 +105,13 @@
image::images/manageremoteconnections.png[]
-[start=9.]
+
. Clique em OK. Você retornará para o painel Configuração de Execução.
-[start=10.]
+
. No campo Diretório de Upload, digite o nome da subpasta no diretório inicial onde será feito o upload do arquivos de código-fonte. O prompt abaixo do campo mostra o URL do host do FTP.
-[start=11.]
+
. Para concluir a configuração de um novo projeto, clique em Finalizar.
@@ -154,7 +154,7 @@
image::images/sync-ctxmenuitem.png[]
-[start=2.]
+
. Selecione Sincronizar. O IDE recupera os nomes dos arquivos e os caminhos do servidor remoto e abre a caixa de diálogo Sincronização Remota.
A caixa de diálogo Sincronização Remota mostra uma tabela de arquivos do projeto. As versões remotas do arquivo estão à esquerda e as versões locais estão à direita. Na coluna do centro, está um ícone que mostra a operação que o IDE executará na sincronização. Os ícones de advertência estão bem à esquerda. Um resumo das operações e problemas aparece na parte inferior da tabela. Uma descrição detalhada de todos os erros aparece abaixo da tabela. Acima da tabela estão conjuntos de caixas de seleção para filtrar quais problemas e operações a caixa de diálogo mostrará. Para obter informações detalhadas sobre essa caixa de diálogo, clique em Ajuda.
@@ -162,31 +162,31 @@
image::images/main-dialog.png[]
-[start=3.]
+
. Selecione vários itens da tabela. Na parte inferior da tabela o resumo incluirá, agora, apenas esses itens.
image::images/multiple-items.png[]
-[start=4.]
+
. Clique com o botão direito do mouse nos itens selecionados. Um menu de contexto de operações possíveis será exibido.
image::images/context-menu.png[]
-[start=5.]
+
. Se um item tiver u m ícone de erro Resolver Conflitos, selecione o item. Uma descrição do erro aparecerá na parte inferior da tabela.
image::images/error-item.png[]
-[start=6.]
+
. Selecione o item com um erro. Selecione Dif... image:images/diff-icon.png[] na linha de botões ou no menu de contexto. A caixa de diálogo Dif será aberta. Nessa caixa de diálogo, reole para baixo para cada diferença entre as versões remota e local do arquivo. Na view gráfica, você pode aplicar ou recusar a aplicar a alteração remota ao arquivo local. Se desejar editar o arquivo manualmente, alterne para a guia Textual. Quando tiver concluído com a dif, clique em OK. Você retornará para a caixa de diálogo Sincronização Remota. A operação para o arquivo é alterada para Upload e o arquivo é marcado com um asterisco, pois você o alterou.
image::images/diff.png[]
-[start=7.]
+
. Se não houver nenhum conflito, clique em Sincronizar. Se tiver selecionado Mostrar Resumo antes de Iniciar, o resumo Sincronizar será exibido para que você possa revisar as oeprações mais uma vez, antes de executar a sincronização. Se você aprovar as operações, clique em OK.
image::images/sync-summary.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ru.asciidoc
index ac41cdd..311f8c9 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_ru.asciidoc
@@ -105,13 +105,13 @@
image::images/manageremoteconnections.png[]
-[start=9.]
+
. Нажмите кнопку "ОК". Будет выполнен возврат к панели "Настройки выполнения".
-[start=10.]
+
. В поле "Каталог загрузки" введите имя подпапки в начальном каталоге, куда впоследствии будут выгружены исходные файлы. В запросе под этим полем содержится URL-адрес узла FTP.
-[start=11.]
+
. Для завершения настройки нового проекта нажмите кнопку "Готово".
@@ -154,7 +154,7 @@
image::images/sync-ctxmenuitem.png[]
-[start=2.]
+
. Выберите 'Синхронизация'. IDE извлекает имена файлов и пути с удаленного сервера и открывает диалоговое окно 'Удаленная синхронизация'.
Диалоговое окно 'Удаленная синхронизация', в котором отображается таблица файлов проекта. Удаленные версии в файлах находится слева, а локальные версии справа. В центральном столбце находится значок, указывающий операцию, выполняемую IDE при синхронизации. Значки предупреждения расположены по левому краю. Сводка операциям и проблемам отображается в нижней части таблицы. Подробное описание всех ошибок отображается под таблицей. Над таблицей находятся наборы флажков для фильтрации проблем и операций, отображаемых в диалоговом окне. Для получения более подробных данных об этом диалоговом окне щелкните 'Справка'.
@@ -163,31 +163,31 @@
-[start=3.]
+
. Выберите в таблице несколько элементов. В нижней части страницы в сводке теперь отображаются только эти элементы.
image::images/multiple-items.png[]
-[start=4.]
+
. Щелкните правой кнопкой мыши выбранные элементы. Откроется контекстное меню с возможными операциями.
image::images/context-menu.png[]
-[start=5.]
+
. Если у элемента имеется значок ошибки 'Разрешение конфликтов' выберите этот элемент. Описание ошибки отображается в нижней части таблицы.
image::images/error-item.png[]
-[start=6.]
+
. Выберите элемент с ошибкой. Выберите 'Различия...' image:images/diff-icon.png[] из ряда кнопок или из контекстного меню. Откроется диалоговое окно "Различия". В этом диалоговом окне с помощью прокрутки перейдите к каждому различию между удаленной и локальной версиями файла. В графическом представлении млжно применить или отклонить удаленные изменения локального файла. Если файл необходимо отредактировать вручную, перейдите на вкладку 'Текстовый'. После завершения работы с различиями нажмите кнопку ОК. Будет выполнен возврат в диалоговое окно удаленной синхронизации. Операция для файла изменится на 'Загрузку' и файл будет помечен звездочкой для указания его изменения.
image::images/diff.png[]
-[start=7.]
+
. При отсутствии конфликтов щелкните 'Синхронизация'. Если выбрано 'Показать сводку до запуска', отображается сводка по синхронизации, что позволяет просмотреть операции еще раз до выполнения синхронизации. Если все операции выбраны правильно, нажмите OK.
image::images/sync-summary.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_zh_CN.asciidoc
index ebc4f1a..2ab564e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/remote-hosting-and-ftp-account_zh_CN.asciidoc
@@ -102,13 +102,13 @@
image::images/manageremoteconnections.png[]
-[start=9.]
+
. 单击 "OK"(确定)。返回到 "Run Configuration"(运行配置)面板。
-[start=10.]
+
. 在 "Upload Directory"(上载目录)字段中,输入初始目录中将上载源文件的子文件夹名称。该字段下的提示显示 FTP 主机 URL。
-[start=11.]
+
. 要完成对新项目的设置,请单击 "Finish"(完成)。
@@ -151,7 +151,7 @@
image::images/sync-ctxmenuitem.png[]
-[start=2.]
+
. 选择 "Synchronize"(同步)。IDE 将从远程服务器检索文件名和路径并打开 "Remote Synchronization"(远程同步)对话框。
"Remote Synchronization"(远程同步)对话框将显示项目文件表。文件的远程版本位于左侧,本地版本位于右侧。中间列中有图标,用于显示 IDE 将在同步时执行的操作。"Warning"(警告)图标位于最左侧。表底部显示操作和问题的概要。表下方显示所有错误的详细说明。表上方是复选框集合,用于过滤对话框显示哪些问题和操作。有关此对话框的详细信息,请单击 "Help"(帮助)。
@@ -159,31 +159,31 @@
image::images/main-dialog.png[]
-[start=3.]
+
. 在表中选择多个项。表底部的概要现在只包含这些项。
image::images/multiple-items.png[]
-[start=4.]
+
. 右键单击所选项。此时将显示可能操作的上下文菜单。
image::images/context-menu.png[]
-[start=5.]
+
. 如果某一项具有 "Resolve Conflicts"(解决冲突)错误图标,则选择该项。表底部将显示错误说明。
image::images/error-item.png[]
-[start=6.]
+
. 选择出错的项。从按钮行或从上下文菜单选择 "Diff..."(比较...)image:images/diff-icon.png[]。此时将打开 "Diff"(比较)对话框。在此对话框中,向下滚动到文件的远程版本和本地版本之间的每个差异。在图形视图中,您可以应用或拒绝应用远程更改到本地文件。如果您要手动编辑文件,请切换到 "Textual"(文本)标签。完成比较操作后,单击 "OK"(确定)。您将返回到 "Remote Synchronization"(远程同步)对话框。对该文件的操作更改为 "Upload"(上载),并且该文件将用星号标记,因为您更改了它。
image::images/diff.png[]
-[start=7.]
+
. 如果您没有冲突,请单击 "Synchronize"(同步)。如果选择了 "Show Summary Before Start"(开始之前显示概要),则将显示 "Synchronize"(同步)概要,以便您可以在执行同步之前再一次检查操作。如果您批准操作,请单击 "OK"(确定)。
image::images/sync-summary.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/screencast-phpdoc_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/screencast-phpdoc_pt_BR.asciidoc
index 2edd6b6..307292b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/screencast-phpdoc_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/screencast-phpdoc_pt_BR.asciidoc
@@ -39,4 +39,4 @@
link:http://bits.netbeans.org/media/phpdoc.flv[+Download+] [16.0 MB]
-|===
\ No newline at end of file
+|===
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1.asciidoc
index 4c745f8..9913665 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1.asciidoc
@@ -58,13 +58,13 @@
image::images/mysql-ctxmenu-connect.png[]
-[start=3.]
+
. The NetBeans IDE connects to the MySQL server, checks for the databases available through the server, detects the system ``mysql`` database, and adds the corresponding new node ``mysql`` to the Databases tree.
image::images/mysql_node_added.png[]
-[start=4.]
+
. To execute an SQL command, you need to be connected to a database. Because only the MySQL system is available, you need to connect to it.
To connect to the system database, navigate to the ``mysql`` node and from the context menu choose Connect. If a connection does not already exist, the New Database Connection dialog box appears. The User Name field is by default filled in with root. In the Password field, enter the root user's password.
@@ -74,7 +74,7 @@
The New Database Connection dialog box shows the message "Connection established." Click OK. A new node named ``jdbc:mysql://localhost:3306/mysql`` is added to the Databases tree.
-[start=5.]
+
. Navigate to the ``jdbc:mysql://localhost:3306/mysql`` node and from the context menu choose Execute Command.
image::images/execute-command.png[]
@@ -112,15 +112,15 @@
image::images/databases-ctxmenu-newconnection.png[]
-[start=2.]
+
. In the New Connection Wizard's Locate Driver panel, select the `MySQL (Connector/J Driver).` Click Next. The Customize Connection panel opens.
image::images/locate-driver.png[]
-[start=3.]
+
. In the Database field, type `wishlist`.
-[start=4.]
+
. In the User Name and Password edit boxes, enter the name and the password specified in section <<CreateUser,Creating the Owner (User) of the Database>> (in our example ``phpuser`` and ``phpuserpw`` respectively). Tick Remember Password. Click Test Connection, and if the connection succeeds, click OK.
image::images/phpuser-connection.png[]
@@ -162,14 +162,14 @@
NOTE: If the menu item is disabled, you are already connected. Continue with step 2.
-[start=2.]
+
. From the same context menu, choose Execute Command. An empty SQL Command window opens.
-[start=3.]
+
. To create the wishers table,
-[start=1.]
+
. Type the following SQL query (note that you need to explicitly set character sets to UTF-8 for internationalization):
[source,sql]
@@ -180,13 +180,13 @@
NOTE: You can get a unique auto generated number from MySQL by specifying the AUTO_INCREMENT property for a field. MySQL will generate a unique number by incrementing the last number of the table and will automatically add to the auto incremented field. In our example the ID field is auto incremented.
-[start=2.]
+
. Click the right mouse button on the query and then choose Run Statement from the context menu.
NOTE: The default storage engine for MySQL is MyISAM, which does not support foreign keys. If you want to use foreign keys, consider using InnoDB as the storage engine.
-[start=4.]
+
. To create the wishes table:
.. Type the following SQL query:
@@ -196,10 +196,10 @@
----
.. Click the right mouse button on the query and then choose Run Statement from the context menu.
-[start=5.]
+
. To verify that the new tables are added to the database, switch to the Services window and then navigate to the jdbc:mysql://localhost:3306/wishlist connection node.
-[start=6.]
+
. Click the right mouse button and choose Refresh. The nodes wishers and wishes appear in the tree.
Note: You can download a set of SQL commands for creating the MySQL wishlist database link:https://netbeans.org/projects/www/downloads/download/php%252FSQL-files-for-MySQL.zip[+here+].
@@ -210,10 +210,10 @@
To test your application you will need some data in the database. The example below shows how to add two wishers and four wishes.
-[start=1.]
+
. On the jdbc:mysql://localhost:3306/wishlist connection, click the right mouse button and choose Execute Command. An empty SQL Command window opens.
-[start=2.]
+
. To add a wisher, use syntax similar to the example below:
[source,sql]
@@ -233,7 +233,7 @@
INSERT INTO wishers (name, password) VALUES ('Jerry', 'jerrymouse');
----
-[start=3.]
+
. To add the wishes, use syntax similar to the example below:
[source,sql]
@@ -247,7 +247,7 @@
NOTE: You can also execute the queries one after another as described in item 2.
-[start=4.]
+
. To view the test data, click the right mouse button on the relevant table and from the context menu choose View Data.
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ja.asciidoc
index c12b2b6..2371792 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ja.asciidoc
@@ -57,13 +57,13 @@
image::images/mysql-ctxmenu-connect.png[]
-[start=3.]
+
. NetBeans IDEはMySQLサーバーに接続し、サーバー経由で使用できるデータベースを確認して、システムの ``mysql`` データベースを検出し、対応する新しい ``mysql`` ノードをデータベース・ツリーに追加します。
image::images/mysql_node_added.png[]
-[start=4.]
+
. SQLコマンドを実行するには、データベースに接続する必要があります。MySQLシステムのみ使用可能なので、それに接続する必要があります。
システム・データベースに接続するには、「 ``mysql`` 」ノードに移動し、コンテキスト・メニューから「接続」を選択します。接続がまだ存在していない場合は、「データベースの新規接続」ダイアログ・ボックスが表示されます。「ユーザー名」フィールドは、デフォルトで「root」と入力されています。「パスワード」フィールドに、ルート・ユーザーのパスワードを入力します。
@@ -73,7 +73,7 @@
「データベースの新規接続」ダイアログ・ボックスに、「接続が確立されました。」というメッセージが表示されます。「OK」をクリックします。 ``jdbc:mysql://localhost:3306/mysql`` という名前の新しいノードがデータベース・ツリーに追加されます。
-[start=5.]
+
. 「 ``jdbc:mysql://localhost:3306/mysql`` 」ノードに移動し、コンテキスト・メニューから「コマンドの実行」を選択します。
image::images/execute-command.png[]
@@ -112,16 +112,16 @@
image::images/databases-ctxmenu-newconnection.png[]
-[start=2.]
+
. 新規接続ウィザードの「ドライバを検索」パネルで、「`MySQL (Connector/J Driver)`」を選択します。「次」をクリックします。「接続をカスタマイズ」パネルが開きます。
image::images/locate-driver.png[]
-[start=3.]
+
. 「データベース」フィールドに「`wishlist`」と入力します。
-[start=4.]
+
. 「ユーザー名」および「パスワード」編集ボックスで、<<CreateUser,データベースの所有者(ユーザー)の作成>>の項で指定したユーザー名とパスワード(この例ではそれぞれ ``phpuser`` と ``phpuserpw`` )を入力します。「パスワードを保存」を選択します。「接続をテスト」をクリックし、接続が成功したら、「OK」をクリックします。
image::images/phpuser-connection.png[]
@@ -160,10 +160,14 @@
1. データベースに接続するには、 ``jdbc:mysql://localhost:3306/wishlist`` 接続で、マウスの右ボタンをクリックし、コンテキスト・メニューから「接続」を選択します。
NOTE: メニュー項目が無効になっている場合は、すでに接続されています。ステップ2へ進んでください。
-2. 同じコンテキスト・メニューから「コマンドの実行」を選択します。空の「SQLコマンド」ウィンドウが開きます。
-3. wishers表を作成するには:
-[start=1.]
+[start=2]
+. 同じコンテキスト・メニューから「コマンドの実行」を選択します。空の「SQLコマンド」ウィンドウが開きます。
+
+[start=3]
+. wishers表を作成するには:
+
+
. 次のSQL問合せを入力します(国際化のためには文字セットを明示的にUTF-8に設定する必要があります)。
[source,sql]
@@ -173,16 +177,16 @@
----
NOTE: フィールドに「AUTO_INCREMENT」プロパティを指定すると、MySQLから自動生成される一意の番号を取得できます。MySQLは、表の最後の数字を増分して一意の番号を生成し、自動増分フィールドに自動的に追加します。この例では、IDフィールドが自動的に増分されます。
-[start=2.]
+
. 問合せでマウスの右ボタンをクリックし、コンテキスト・メニューから「文の実行」を選択します。
NOTE: MySQLのデフォルトのストレージ・エンジンはMyISAMで、外部キーをサポートしません。外部キーを使用する場合、ストレージ・エンジンとしてInnoDBを使用することを検討してください。
-[start=4.]
+
. wishes表を作成するには:
-[start=1.]
+
. 次のSQL問合せを入力します。
[source,sql]
@@ -191,13 +195,13 @@
CREATE TABLE wishes(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,wisher_id INT NOT NULL,description CHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,due_date DATE,FOREIGN KEY (wisher_id) REFERENCES wishers(id))
----
-[start=2.]
+
. 問合せでマウスの右ボタンをクリックし、コンテキスト・メニューから「文の実行」を選択します。
-[start=5.]
+
. 新しい表がデータベースに追加されたことを確認するには、「サービス」ウィンドウに切り替えて、jdbc:mysql://localhost:3306/wishlistの接続ノードに移動します。
-[start=6.]
+
. マウスの右ボタンをクリックし、「リフレッシュ」を選択します。「wishers」ノードと「wishes」ノードがツリーに表示されます。
注意: MySQL wishlistデータベースを作成するための一連のSQLコマンドは、link:https://netbeans.org/projects/www/downloads/download/php%252FSQL-files-for-MySQL.zip[+ここ+]からダウンロードできます。
@@ -208,10 +212,10 @@
アプリケーションをテストするには、データベース内にいくつかのデータが必要です。以降の例では、2つのウィッシャと4つのウィッシュを追加する方法を示します。
-[start=1.]
+
. jdbc:mysql://localhost:3306/wishlistの接続で、マウスの右ボタンをクリックして「コマンドの実行」を選択します。空の「SQLコマンド」ウィンドウが開きます。
-[start=2.]
+
. ウィッシャを追加するには、次の例のような構文を使用します。
[source,sql]
@@ -229,7 +233,7 @@
INSERT INTO wishers (name, password) VALUES ('Jerry', 'jerrymouse');
----
-[start=3.]
+
. ウィッシュを追加するには、次の例のような構文を使用します。
[source,sql]
@@ -243,7 +247,7 @@
NOTE: 項目2で説明しているように、問合せを次々に実行することもできます。
-[start=4.]
+
. テスト・データを表示するには、関連する表でマウスの右ボタンをクリックし、コンテキスト・メニューから「データを表示」を選択します。
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_pt_BR.asciidoc
index 30f24ed..5d539b4 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_pt_BR.asciidoc
@@ -57,13 +57,13 @@
image::images/mysql-ctxmenu-connect.png[]
-[start=3.]
+
. O NetBeans IDE conecta-se ao servidor MySQL, verifica quais bancos de dados estão disponíveis pelo servidor, detecta o banco de dados do sistema ``mysql`` , e adiciona o novo nó correspondente ``mysql`` na árvore Bancos de Dados.
image::images/mysql_node_added.png[]
-[start=4.]
+
. Para executar um comando SQL, você precisa estar conectado a um banco de dados. Como somente o sistema MySQL está disponível, você precisa se conectar ao mesmo.
Para conectar ao banco de dados do sistema, navegue até o nó ``mysql`` e, no menu de contexto, selecione Conectar. Se uma conexão ainda não existir, a caixa de diálogo Nova Conexão de Banco de Dados será exibida. O campo Nome do Usuário está preenchido, por default, com raiz. No campo Senha, insira a senha do usuário raiz.
@@ -73,7 +73,7 @@
A caixa de diálogo Nova Conexão de Banco de Dados mostra a mensagem "Conexão estabelecida". Clique em OK. Um novo nó chamado ``jdbc:mysql://localhost:3306/mysql`` é adicionado na árvore do Bancos de Dados.
-[start=5.]
+
. Navegue até o nó ``jdbc:mysql://localhost:3306/mysql`` e no menu de contexto selecione Executar Comando.
image::images/execute-command.png[]
@@ -112,16 +112,16 @@
image::images/databases-ctxmenu-newconnection.png[]
-[start=2.]
+
. No painel Novo Driver de Localização do Assistente de Conexão, selecione o `MySQL (Driver Conector/J).` Clique em Próximo. O painel Personalizar Conexão é aberto.
image::images/locate-driver.png[]
-[start=3.]
+
. No campo Banco de Dados, digite `wishlist`.
-[start=4.]
+
. Nas caixas de edição Nome do Usuário e Senha, insira o nome e a senha especificados na seção <<CreateUser,Criando o Proprietário (Usuário) do Banco de Dados>> (em nosso exemplo ``phpuser`` e ``!phpuser`` respectivamente). Marque Lembrar Senha. Clique em Testar Conexão e se a conexão for bem-sucedida, clique em OK.
image::images/phpuser-connection.png[]
@@ -161,13 +161,13 @@
1. Para conectar ao banco de dados, na conexão ``jdbc:mysql://localhost:3306/wishlist`` , clique com o botão direito do mouse e selecione Conectar no menu de contexto.
NOTE: se o item de menu estiver desativado, você já está conectado. Prossiga com a etapa 2.
-[start=2.]
+
. No mesmo menu de contexto, selecione Executar Comando. Uma janela Comando SQL vazia é aberta.
-[start=3.]
+
. Para criar a tabela de wishers,
-[start=1.]
+
. Digite a seguinte Consulta SQL (observe que é preciso definir explicitamente os conjuntos de caracteres como URF-8 para internacionalização):
[source,sql]
@@ -177,16 +177,16 @@
----
NOTE: você pode obter um número exclusivo gerado automaticamente do MySQL especificando a propriedade AUTO_INCREMENT de um campo. O MySQL irá gerar um número exclusivo incrementando o último número da tabela e adicionará automaticamente ao campo incrementado. No nosso exemplo, o campo ID é incrementado automaticamente.
-[start=2.]
+
. Clique com o botão direito do mouse na consulta e selecione Executar Instrução no menu de contexto.
NOTE: O mecanismo de armazenamento default do MySQL é o MyISAM, que não é compatível com teclas estrangeiras. Caso deseje usar teclas estrangeiras, considere usar InnoDB como mecanismo de armazenamento.
-[start=4.]
+
. Para criar a tabela de desejos:
-[start=1.]
+
. Digite a seguinte consulta SQL:
[source,sql]
@@ -195,13 +195,13 @@
CREATE TABLE wishes(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,wisher_id INT NOT NULL,description CHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,due_date DATE,FOREIGN KEY (wisher_id) REFERENCES wishers(id))
----
-[start=2.]
+
. Clique com o botão direito do mouse na consulta e selecione Executar Instrução no menu de contexto.
-[start=5.]
+
. Para verificar se as novas tabelas foram adicionadas ao banco de dados, alterne para a janela Serviços e navegue para o nó da conexão jdbc:mysql://localhost:3306/wishlist.
-[start=6.]
+
. Clique com o botão direito do mouse e selecione Atualizar. Os nós de wishers e desejos aparecem na árvore.
Observação: você pode fazer download de um conjunto de comandos SQL para criar link:https://netbeans.org/projects/www/downloads/download/php%252FSQL-files-for-MySQL.zip[+aqui+] o banco de dados da lista de desejos MySQL.
@@ -212,10 +212,10 @@
Para testar a aplicação, você precisará de alguns dados no banco de dados. O exemplo abaixo mostra como adicionar dois wishers e quatro desejos.
-[start=1.]
+
. Na conexão jdbc:mysql://localhost:3306/wishlist, clique com o botão direito do mouse e selecione Executar Comando. Uma janela Comando SQL vazia é aberta.
-[start=2.]
+
. Para adicionar um wisher, use uma sintaxe similar ao exemplo abaixo:
[source,sql]
@@ -233,7 +233,7 @@
INSERT INTO wishers (name, password) VALUES ('Jerry', 'jerrymouse');
----
-[start=3.]
+
. Para adicionar os desejos, use uma sintaxe similar ao exemplo abaixo:
[source,sql]
@@ -247,7 +247,7 @@
NOTE: você também pode executar as consultas uma após a outra, conforme descrito no item 2.
-[start=4.]
+
. Para visualizar os dados de teste, clique com o botão direito do mouse na tabela relevante e, no menu de contexto, selecione Exibir dados.
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ru.asciidoc
index f5a4717..42cb615 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_ru.asciidoc
@@ -57,13 +57,13 @@
image::images/mysql-ctxmenu-connect.png[]
-[start=3.]
+
. IDE NetBeans устанавливает соединение с сервером MySQL, проверяет наличие доступных баз данных с помощью сервера, обнаруживает системную базу данных ``mysql`` и добавляет соответствующий новый узел ``mysql`` к дереву баз данных.
image::images/mysql_node_added.png[]
-[start=4.]
+
. Для выполнения команды SQL необходимо подключение к базе данных. Поскольку доступна только система MySQL, следует подключиться к этой системе.
Для подключения к системной базе данных перейдите к узлу ``mysql`` и выберите "Connect" в контекстном меню. Если подключение на данный момент отсутствует, появится диалоговое окно "New Database Connection". В поле "User Name" по умолчанию вводится значение "root". В поле "Password" введите пароль пользователя root.
@@ -73,7 +73,7 @@
В диалоговом окне "New Database Connection" появится сообщение "Connection established". Нажмите кнопку "ОК". К дереву баз данных добавлен новый узел с именем ``jdbc:mysql://localhost:3306/mysql`` .
-[start=5.]
+
. Перейдите к узлу ``jdbc:mysql://localhost:3306/mysql`` и выберите в контекстном меню "Execute Command".
image::images/execute-command.png[]
@@ -112,16 +112,16 @@
image::images/databases-ctxmenu-newconnection.png[]
-[start=2.]
+
. На панели 'Обнаружение драйвера' в мастере создания подключений выберите `MySQL (Connector/J Driver).` Нажмите 'Далее'. Открывается панель 'Настройка соединения'.
image::images/locate-driver.png[]
-[start=3.]
+
. В поле 'База данных' введите `wishlist`.
-[start=4.]
+
. В полях "User Name" и "Password" введите соответственно имя и пароль пользователя, указанные в разделе <<CreateUser,Создание владельца (пользователя) базы данных>> (в нашем примере это ``phpuser`` и ``phpuserpw`` ). Установите флажок 'Запомнить пароль'. Нажмите 'Проверить подключение'. Если соединение установлено успешно, нажмите "OK".
image::images/phpuser-connection.png[]
@@ -161,13 +161,13 @@
1. Для подключения к базе данных щелкните правой кнопкой мыши узел подключения ``jdbc:mysql://localhost:3306/wishlist`` и выберите "Connect" в контекстном меню.
NOTE: Если пункт меню недоступен, пользователь уже подключен. Перейдите к действию 2.
-[start=2.]
+
. В том же контекстном меню выберите "Execute Command". Откроется пустое окно "SQL Command".
-[start=3.]
+
. Для создания таблицы "wishers"
-[start=1.]
+
. Введите следующий запрос SQL (отметьте, что как набор символов следует прямо установить UTF-8 для интернационализации):
[source,sql]
@@ -177,16 +177,16 @@
----
NOTE: Можно получить уникальный номер, автоматически создаваемый MySQL, задав свойство AUTO_INCREMENT для поля. MySQL создаст уникальный номер посредством увеличения на единицу последнего номера в таблице и автоматически добавит его к значению поля с этим свойством. В нашем примере автоматически должно увеличиваться значение в поле "ID".
-[start=2.]
+
. Щелкните запрос правой кнопкой мыши, затем выберите "Run Statement" в контекстном меню.
NOTE: Механизмом хранения по умолчанию для MySQL является MyISAM, не поддерживающий внешние ключи. Если нужна поддержка внешних ключей, используйте в качестве механизма хранения InnoDB.
-[start=4.]
+
. Для создания таблицы "Wishes"
-[start=1.]
+
. введите следующий запрос SQL:
[source,sql]
@@ -195,13 +195,13 @@
CREATE TABLE wishes(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,wisher_id INT NOT NULL,description CHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,due_date DATE,FOREIGN KEY (wisher_id) REFERENCES wishers(id))
----
-[start=2.]
+
. Щелкните запрос правой кнопкой мыши, затем выберите "Run Statement" в контекстном меню.
-[start=5.]
+
. Для проверки того, что новые таблицы добавлены к базе данных, перейдите к окну "Services", а затем к узлу подключения jdbc:mysql://localhost:3306/wishlist.
-[start=6.]
+
. Нажмите правую кнопку мыши и выберите "Refresh". В дереве появятся узлы "wishers" и "wishes".
Примечание. Набор команд SQL для создания базы данных wishlist MySQL можно загрузить link:https://netbeans.org/projects/www/downloads/download/php%252FSQL-files-for-MySQL.zip[+здесь+].
@@ -229,7 +229,7 @@
INSERT INTO wishers (name, password) VALUES ('Jerry', 'jerrymouse');
----
-[start=3.]
+
. Для добавления пожеланий ("wishes") введите следующие команды:
[source,sql]
@@ -243,7 +243,7 @@
NOTE: Также можно выполнять запросы один за другим, как описано в пункте 2.
-[start=4.]
+
. Для просмотра тестовых данных щелкните соответствующую таблицу правой кнопкой мыши и выберите из контекстного меню "View Data".
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_zh_CN.asciidoc
index 31548d2..07cb2e4 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson1_zh_CN.asciidoc
@@ -56,13 +56,13 @@
image::images/mysql-ctxmenu-connect.png[]
-[start=3.]
+
. NetBeans IDE 将连接到 MySQL 服务器,检查通过该服务器提供的数据库,检测系统 ``mysql`` 数据库,然后将相应的新节点 ``mysql`` 添加到 "Databases"(数据库)树中。
image::images/mysql_node_added.png[]
-[start=4.]
+
. 要执行 SQL 命令,您需要连接到一个数据库。由于仅提供了 MySQL 系统,因此,您需要连接到该系统。
要连接到系统数据库,请导航至 ``mysql`` 节点,然后从上下文菜单中选择 "Connect"(连接)。如果尚未建立连接,则会显示 "New Database Connection"(新建数据库连接)对话框。默认情况下,在 "User Name"(用户名)字段中填写 root。在 "Password"(口令)字段中,输入 root 用户的口令。
@@ -72,7 +72,7 @@
"New Database Connection"(新建数据库连接)对话框显示“已建立连接”消息。单击 "OK"(确定)。此时将在 "Databases"(数据库)树中添加一个名为 ``jdbc:mysql://localhost:3306/mysql`` 的新节点。
-[start=5.]
+
. 导航至 ``jdbc:mysql://localhost:3306/mysql`` 节点,然后从上下文菜单中选择 "Execute Command"(执行命令)。
image::images/execute-command.png[]
@@ -111,17 +111,17 @@
image::images/databases-ctxmenu-newconnection.png[]
-[start=2.]
+
. 在 "New Connection Wizard"(新建连接向导)的 "Locate Driver"(查找驱动程序)面板中,选择 `MySQL (Connector/J Driver)`(MySQL(Connector/J 驱动程序)),然后单击 "Next"(下一步)。此时将打开 "Customize Connection"(定制连接)面板。
image::images/locate-driver.png[]
-[start=3.]
+
. 在 "Database"(数据库)字段中,键入 `wishlist`。
-[start=4.]
+
. 在 "User Name"(用户名)和 "Password"(口令)编辑框中,输入在<<CreateUser,创建数据库所有者(用户)>>部分指定的名称和口令(在我们的示例中,分别是 ``phpuser`` 和 ``phpuserpw`` )。单击 "Remember Password"(记住口令)。单击 "Test Connection"(测试连接),如果连接成功,则单击 "OK"(确定)。
image::images/phpuser-connection.png[]
@@ -161,13 +161,13 @@
1. 要连接到数据库,请在 ``jdbc:mysql://localhost:3306/wishlist`` 连接上单击鼠标右键,然后从上下文菜单中选择 "Connect"(连接)。
NOTE: 如果禁用了该菜单项,则说明您已建立了连接。继续执行步骤 2。
-[start=2.]
+
. 从上述上下文菜单中选择 "Execute Command"(执行命令)。此时将打开一个空的 "SQL Command"(SQL 命令)窗口。
-[start=3.]
+
. 创建 wishers 表:
-[start=1.]
+
. 键入以下 SQL 查询(请注意,您需要将字符集明确设置为 UTF-8 以实现国际化):
[source,sql]
@@ -177,16 +177,16 @@
----
NOTE: 可通过为某个字段指定 AUTO_INCREMENT 属性,从 MySQL 中获取自动生成的唯一数字。MySQL 会通过增加表的最后一个数字来生成一个唯一数字,并自动将其添加到自动递增的字段中。在我们的示例中,"ID" 字段是自动递增的。
-[start=2.]
+
. 在查询上单击鼠标右键,然后从上下文菜单中选择 "Run Statement"(运行语句)。
NOTE: MySQL 的默认存储引擎是 MyISAM,它不支持外键。如果要使用外键,请考虑将 InnoDB 用作存储引擎。
-[start=4.]
+
. 创建 wishes 表:
-[start=1.]
+
. 键入以下 SQL 查询:
[source,sql]
@@ -195,13 +195,13 @@
CREATE TABLE wishes(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,wisher_id INT NOT NULL,description CHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,due_date DATE,FOREIGN KEY (wisher_id) REFERENCES wishers(id))
----
-[start=2.]
+
. 在查询上单击鼠标右键,然后从上下文菜单中选择 "Run Statement"(运行语句)。
-[start=5.]
+
. 要验证新表是否添加到数据库中,请切换至 "Services"(服务)窗口,然后导航至 jdbc:mysql://localhost:3306/wishlist 连接节点。
-[start=6.]
+
. 单击鼠标右键,然后选择 "Refresh"(刷新)。此时将在树中显示 wishers 和 wishes 节点。
注:您可以在link:https://netbeans.org/projects/www/downloads/download/php%252FSQL-files-for-MySQL.zip[+此处+]下载一组 SQL 命令以创建 MySQL wishlist 数据库。
@@ -212,10 +212,10 @@
要测试应用程序,您需要使用数据库中的某些数据。下面的示例说明了如何添加两个许愿者和四个愿望。
-[start=1.]
+
. 在 jdbc:mysql://localhost:3306/wishlist 连接上单击鼠标右键,然后选择 "Execute Command"(执行命令)。此时将打开一个空的 "SQL Command"(SQL 命令)窗口。
-[start=2.]
+
. 要添加许愿者,请使用类似下面示例的语法:
[source,sql]
@@ -233,7 +233,7 @@
INSERT INTO wishers (name, password) VALUES ('Jerry', 'jerrymouse');
----
-[start=3.]
+
. 要添加愿望,请使用类似下面示例的语法:
[source,sql]
@@ -247,7 +247,7 @@
NOTE: 您还可以依次执行查询,如第 2 项所述。
-[start=4.]
+
. 要查看测试数据,请在相关表上单击鼠标右键,然后从上下文菜单中选择 "View Data"(查看数据)。
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2.asciidoc
index a79086b..cc28c68 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2.asciidoc
@@ -87,22 +87,22 @@
NOTE: You can ignore warnings from the HTML validator.
-[start=2.]
+
. Remove the PHP block. The index.php file will not contain any PHP code.
image::images/remove-php-block.png[]
-[start=3.]
+
. Open the Palette from the Window menu or by pressing Ctrl-Shift-8.
-[start=4.]
+
. From the Palette's* HTML Forms* section, drag and drop a Form into the <body> section of ``index.php`` .
image::images/form-dnd.png[]
-[start=5.]
+
. The Insert Form dialog opens. In the Action field, type the path to the file to which the form will transfer data. In this case, type in ``wishlist.php`` . (You will create this file in the same location as ``index.php`` . See <<createNewFile,Creating wishlist.php and Testing the Application>>.) Select the GET method for transferring data. Give the form an arbitrary name, such as ``wishList`` . Click OK when you are done.
image::images/insert-form-dialog.png[]
@@ -112,13 +112,13 @@
image::images/blank-form.png[]
-[start=6.]
+
. Between the opening and closing tags of the form, type the text "Show wish list of: ".
-[start=7.]
+
. Drag a Text Input component from the *HTML Forms* section of the Palette to the space after the text "Show wish list of: ". The Insert Text Input dialog opens.
-[start=8.]
+
. Name the input ``user`` . Select input type ``text`` . Leave all other fields empty and click OK.
image::images/insert-text-input.png[]
@@ -128,16 +128,16 @@
image::images/form-with-text-input.png[]
-[start=9.]
+
. Add a blank line above the </form> tag. Into this blank line, drag and drop a Button component from the* HTML Forms* section of the Palette.
-[start=10.]
+
. The Insert Button dialog opens. Type ``Go`` into the Label field and click OK.
image::images/insert-button-dialog.png[]
-[start=11.]
+
. The form now looks like the code below, with one difference. In the code below, the ``method`` attribute is explicit in the `<form>` tag. NetBeans IDE did not add a method attribute to your form because GET is the default value of this attribute. However, you might understand the code more easily if the ``method`` attribute is explicit.
[source,html]
@@ -170,7 +170,7 @@
image::images/index-php-works.png[]
-[start=4.]
+
. In the Show wish list of: edit box, enter Tom and click Go. An empty page with the following URL appears: http://localhost:90/Lesson2/wishlist.php?user=tom. This URL indicates that your main page works properly.
@@ -196,7 +196,7 @@
</html>
----
-[start=2.]
+
. To display the title, enter the following code block immediately after the opening <body> tag, before the generated <?php tag:
[source,html]
@@ -223,7 +223,7 @@
image::images/wishlist-php-title-works.png[]
-[start=3.]
+
. Delete the commented section in the template PHP block. In its place, type or paste in the following code. This code opens the connection to the database.
*For the MySQL database:*
@@ -260,7 +260,7 @@
image::images/codecompletion.png[]image::images/codecompletion-oci.png[]
-[start=4.]
+
. Beneath the code to open the connection to the database, in the same PHP block, type or paste the following code. This code retrieves the ID of the wisher whose wish list was requested. If the wisher is not in the database, the code kills/exits the process and displays an error message.
*For the MySQL database:*
@@ -387,7 +387,7 @@
----
The </table> tag closes the table.
-[start=2.]
+
. Enter the following PHP code block above the closing </table> tag.
*For the MySQL database:*
@@ -432,7 +432,7 @@
WARNING: Make sure you type the names of database fields exactly as they are specified during the database table creation. For Oracle, column names are returned as uppercase by default.
-[start=3.]
+
. To test the application, run the project as described in the section <<createNewFile,Testing index.php>>.
image::images/wishlist-php-works.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ja.asciidoc
index 6b5e7fa..c720e37 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ja.asciidoc
@@ -89,22 +89,22 @@
NOTE: HTMLバリデータからの警告は無視できます。
-[start=2]
+
. PHPブロックを除去します。index.phpファイルにはPHPコードは含まれません。
image::images/remove-php-block.png[]
-[start=3]
+
. 「ウィンドウ」メニューから、または[Ctrl]-[Shift]-[8]を押して「パレット」を開きます。
-[start=4]
+
. パレットの「*HTMLフォーム*」セクションで、「フォーム」を ``index.php`` の<body>セクションにドラッグ・アンド・ドロップします。
image::images/form-dnd.png[]
-[start=5]
+
. 「挿入フォーム」ダイアログが開きます。「アクション」フィールドで、フォームによるデータの転送先のファイルへのパスを入力します。このケースでは、「 ``wishlist.php`` 」と入力します。(このファイルは ``index.php`` と同じ場所に作成します。<<createNewFile,wishlist.phpの作成とアプリケーションのテスト>>を参照。)データを転送するためのGETメソッドを選択します。フォームに対して ``wishList`` などの任意の名前を付けます。完了したら、「OK」をクリックします。
image::images/insert-form-dialog.png[]
@@ -114,13 +114,13 @@
image::images/blank-form.png[]
-[start=6]
+
. フォームの開始タグと終了タグの間に、「Show wish list of: 」というテキストを入力します。
-[start=7]
+
. パレットの「*HTMLフォーム*」セクションから、「テキスト入力」コンポーネントを「Show wish list of: 」の後のスペースにドラッグします。「挿入テキスト入力」ダイアログが開きます。
-[start=8]
+
. 入力に ``user`` という名前を付けます。入力タイプは「 ``テキスト`` 」を選択します。その他のすべてのフィールドを空白のままにし、「OK」をクリックします。
image::images/insert-text-input.png[]
@@ -130,16 +130,16 @@
image::images/form-with-text-input.png[]
-[start=9]
+
. </form> タグの上に空白行を追加します。この空白行に、パレットの「*HTMLフォーム*」セクションから「ボタン」コンポーネントをドラッグ・アンド・ドロップします。
-[start=10]
+
. 「挿入ボタン」ダイアログが開きます。「ラベル」フィールドに「 ``Go`` 」と入力して「OK」をクリックします。
image::images/insert-button-dialog.png[]
-[start=11]
+
. フォームは次のようなコードになり、違いは1つです。次のコードでは、<form>タグ内の ``method`` 属性が明示的になっています。NetBeans IDEはメソッド属性をフォームに追加しませんでしたが、この理由はGETがこの属性のデフォルト値であるためです。ただし、 ``method`` 属性が明示的であれば、コードが理解しやすくなる場合があります。
[source,html]
@@ -172,7 +172,7 @@
image::images/index-php-works.png[]
-[start=4]
+
. 「Show wish list of:」編集ボックスに「Tom」と入力し、「Go」をクリックします。URLがhttp://localhost:90/Lesson2/wishlist.php?user=tomの空のページが表示されます。このURLは、メイン・ページが正しく動作していることを示します。
@@ -199,7 +199,7 @@
----
-[start=2]
+
. タイトルを表示するには、開始の<body>タグの直後で、生成された<?phpタグの前に次のコード・ブロックを入力します。
[source,php]
@@ -225,7 +225,7 @@
image::images/wishlist-php-title-works.png[]
-[start=3]
+
. テンプレートPHPブロックのコメント付きセクションを削除します。その場所に、次のコードを入力するか、または貼り付けます。このコードはデータベースへの接続を開きます。
*MySQLデータベースの場合:*
@@ -262,7 +262,7 @@
image::images/codecompletion.png[]image::images/codecompletion-oci.png[]
-[start=4]
+
. コードの下にデータベースへの接続が開き、同じPHPブロックに次のコードを入力するか、または貼り付けます。このコードは、ウィッシュ・リストがリクエストされたウィッシャのIDを取得します。ウィッシャがデータベースに存在しない場合、コードはプロセスを終了し、エラー・メッセージを表示します。
*MySQLデータベースの場合:*
@@ -392,7 +392,7 @@
----
</table>タグが表を閉じます。
-[start=2]
+
. 次のPHPコード・ブロックを、終了</table>タグの前に入力します。
*MySQLデータベースの場合:*
@@ -440,7 +440,7 @@
NOTE: データベース表の作成時に指定したとおりに、データベース・フィールドの名前を入力していることを確認してください。Oracleの場合、列名はデフォルトで大文字で返されます。
-[start=3]
+
. アプリケーションをテストするには、<<createNewFile,index.phpのテスト>>の項の説明に従ってプロジェクトを実行します。
image::images/wishlist-php-works.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_pt_BR.asciidoc
index 00fb129..091c041 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_pt_BR.asciidoc
@@ -88,22 +88,22 @@
NOTE: você pode ignorar as advertências do validador HTML.
-[start=2]
+
. Remova o bloco PHP. O arquivo index.php não conterá códigos PHP.
image::images/remove-php-block.png[]
-[start=3]
+
. Abra a Paleta no menu Janela ou pressione Ctrl-Shift-8.
-[start=4]
+
. Na seção *Forms HTML* da Paleta, arraste e solte um Form na seção <body> do ``index.php`` .
image::images/form-dnd.png[]
-[start=5]
+
. A Caixa de Diálogo Inserir Form abre. No campo Ação, digite o caminho até o arquivo para o qual o form transferirá dados. Nesse caso, digite ``wishlist.php`` . (Você criará esse arquivo no mesmo local que o ``index.php`` . Consulte <<createNewFile,Criando wishlist.php e Testando a Aplicação>>.) Selecione o método GET para a transferência de dados. Dê um nome arbitrário ao form, como ``wishList`` . Clique em OK quando acabar.
image::images/insert-form-dialog.png[]
@@ -113,13 +113,13 @@
image::images/blank-form.png[]
-[start=6]
+
. Entre os identificadores de abertura e fechamento do form, digite o texto “Show wish list of: ”.
-[start=7]
+
. Arraste um componente de Entrada de Texto da seção *Forms HTML* da Paleta até o espaço após o texto “Show wish list of: ”. A caixa de diálogo Inserir Texto abre.
-[start=8]
+
. Nomeie a entrada como ``user`` . Selecione o tipo de entrada ``text`` . Deixe todos os outros campos vazios e clique em OK.
image::images/insert-text-input.png[]
@@ -129,16 +129,16 @@
image::images/form-with-text-input.png[]
-[start=9]
+
. Adicione uma linha em branco acima da tag </form>. Nessa linha em branco, arraste e solte um componente Botão da seção *Forms HTML* da Paleta.
-[start=10]
+
. A caixa de diálogo Inserir Botão abre. Digite ``Go`` no campo Label e clique em OK.
image::images/insert-button-dialog.png[]
-[start=11]
+
. Agora, o form se parece com o código abaixo, com uma única diferença. No código abaixo, o atributo ``method`` está explícito na tag <form>. O NetBeans IDE não adicionou o atributo method ao seu form, pois o GET é o valor default desse atributo. Entretanto, você pode entender o código com mais facilidade se o atributo ``method`` estiver explícito.
[source,xml]
@@ -171,7 +171,7 @@
image::images/index-php-works.png[]
-[start=4]
+
. Na lista de desejos Mostrar : caixa de edição, digite Tom e clique em Ir. Uma página vazia com a seguinte URL aparecerá: http://localhost:90/Lesson2/wishlist.php?user=tom. Esse URL indica que a sua página principal funciona corretamente.
@@ -198,7 +198,7 @@
----
-[start=2]
+
. Para exibir o título, digite o seguinte bloco de código imediatamente depois da tag de abertura <body>, antes da tag <?php gerada:
[source,php]
@@ -222,7 +222,7 @@
image::images/wishlist-php-title-works.png[]
-[start=3]
+
. Delete a seção comentada no bloco PHP do modelo. Em seu lugar, digite ou cole no código a seguir. Esse código abre a conexão ao banco de dados.
*Para o banco de dados MySQL:*
@@ -260,7 +260,7 @@
image::images/codecompletion.png[]image::images/codecompletion-oci.png[]
-[start=4]
+
. Abaixo do código para abrir a conexão ao banco de dados, no mesmo bloco PHP, digite ou cole o código a seguir. Esse código recupera o wisher ID cuja lista tenha sido solicitada. Se o wisher não estiver no banco de dados, o código terminará o processo, ou sairá dele, e exibirá uma mensagem de erro.
*Para o banco de dados MySQL:*
@@ -390,7 +390,7 @@
----
A tag </table> fecha a tabela.
-[start=2]
+
. Insira o seguinte bloco de código PHP acima da tag de fechamento </table>.
*Para o banco de dados MySQL:*
@@ -422,7 +422,7 @@
*Cuidado: *Certifique-se de digitar os nomes dos campos de banco de dados exatamente como eles foram especificados durante a criação da tabela do banco de dados. Para Oracle, os nomes das colunas são retornados com letras maiúsculas por default.
-[start=3]
+
. Para testar a aplicação, execute o projeto como descrito na seção <<createNewFile,Testando index.php>>.
image::images/wishlist-php-works.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ru.asciidoc
index c019579..e8e49f8 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_ru.asciidoc
@@ -88,22 +88,22 @@
NOTE: Можно пропустить предупреждения от средства проверки HTML.
-[start=2]
+
. Удалите блок PHP. Файл index.php не содержит код PHP.
image::images/remove-php-block.png[]
-[start=3]
+
. Откройте "Палитру" из меню "Окно" или нажав Ctrl-Shift-8.
-[start=4]
+
. Из раздела *Формы HTML* палитры перетащите форму в раздел <body> файла ``index.php`` .
image::images/form-dnd.png[]
-[start=5]
+
. Откроется диалоговое окно "Вставить форму". В поле "Действие" введите путь к файлу, в которой форма будет передавать данные. В данном случае введите ``wishlist.php`` . (Этот файл будет создан в том же местоположении, что и файл ``index.php`` . См. <<createNewFile,Создание wishlist.php и тестирование приложения>>.) Выберите метод GET для передачи данных. Присвойте форме произвольное имя, например, ``wishList`` . Нажмите кнопку "ОК" после выполнения действия.
image::images/insert-form-dialog.png[]
@@ -113,13 +113,13 @@
image::images/blank-form.png[]
-[start=6]
+
. Между открывающим и закрывающим тегами формы введите текст "Показать список пожеланий: ".
-[start=7]
+
. Перетащите компонент "Ввод текста" из раздела *Формы HTML* палитры в пространство после текста "Показать список пожеланий: ". Откроется диалоговое окно "Вставка ввода текста".
-[start=8]
+
. Присвойте вводу название ``user`` . Выберите тип ввода ``text`` . Оставьте все поля пустыми и нажмите кнопку "ОК".
image::images/insert-text-input.png[]
@@ -129,16 +129,16 @@
image::images/form-with-text-input.png[]
-[start=9]
+
. Добавьте пустую сроку над тегом </form>. В эту пустую строку перетащите компонент "Кнопка" из раздела * Формы HTML* палитры.
-[start=10]
+
. Откроется диалоговое окно "Вставить кнопку". Введите ``Go`` в поле "Метка" и нажмите кнопку "ОК".
image::images/insert-button-dialog.png[]
-[start=11]
+
. Теперь форма выглядит так, как показанный ниже код, с одним отличием. В коде ниже атрибут ``method`` явно указан в теге <form>. IDE NetBeans не добавил атрибут метода к используемой форме, поскольку значением по умолчанию этого атрибута является GET. Однако явное указание атрибута ``method`` упрощает понимание кода.
[source,xml]
@@ -171,7 +171,7 @@
image::images/index-php-works.png[]
-[start=4]
+
. В поле "Show wish list of" введите "Tom" и нажмите "Go". Появится пустая страница со следующим URL-адресом: http://localhost:90/Lesson2/wishlist.php?user=tom. Наличие этого URL-адреса означает, что главная страница функционирует правильно.
@@ -197,7 +197,7 @@
</html>
----
-[start=2]
+
. Для отображения заголовка после тега открытия <body> и перед генерируемым тегом <?php введите следующий блок кода:
[source,php]
@@ -224,7 +224,7 @@
image::images/wishlist-php-title-works.png[]
-[start=3]
+
. Удалите раздел в шаблоне блока PHP с комментарием. В этом месте введите или вставьте следующий код. Этот код открывает подключение к базе данных.
*Для базы данных MySQL*
@@ -261,7 +261,7 @@
image::images/codecompletion.png[]image::images/codecompletion-oci.png[]
-[start=4]
+
.
Под фрагментом кода, описывающим подключение к базе данных, в том же блоке PHP укажите следующий код. Этот код получает идентификатор автора пожеланий, чей список был запрошен. Если автор пожеланий отсутствует в базе данных, код уничтожает/завершает процесс и отображает сообщение об ошибке.
@@ -392,7 +392,7 @@
----
Тег </table> закрывает таблицу.
-[start=2]
+
. Введите следующий код блока PHP над закрывающим тегом </table>.
*Для базы данных MySQL*
@@ -440,7 +440,7 @@
*Предостережение. *Убедитесь, что названия полей базы данных введены точно так, как они указаны при создании таблицы базы данных. Для Oracle по умолчанию названия столбцов возвращаются в верхнем регистре.
-[start=3]
+
. Для тестирования приложения выполните проект, как описано в разделе <<createNewFile,Тестирование index.php>>.
image::images/wishlist-php-works.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_zh_CN.asciidoc
index 2e54de3..0d49179 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson2_zh_CN.asciidoc
@@ -89,22 +89,22 @@
NOTE: 您可以忽略来自 HTML 验证器的警告。
-[start=2]
+
. 删除 PHP 块。index.php 文件将不包含任何 PHP 代码。
image::images/remove-php-block.png[]
-[start=3]
+
. 从 "Window"(窗口)菜单中打开 "Palette"(组件面板),也可以按 Ctrl-Shift-8 组合键打开。
-[start=4]
+
. 从 "Palette"(组件面板)的 *HTML Forms*(HTML 窗体)部分中,将一个窗体拖放至 ``index.php`` 的 <body> 部分中。
image::images/form-dnd.png[]
-[start=5]
+
. "Insert Form"(插入窗体)对话框即打开。在 "Action"(操作)字段中,键入窗体将数据传输到的文件的路径。在本示例中,键入 ``wishlist.php`` 。(将在与 ``index.php`` 相同的位置中创建该文件。请参见<<createNewFile,创建 wishlist.php 和测试应用程序>>。)选择 "GET" 方法以传输数据。为窗体指定任意名称,例如 ``wishList`` 。完成后单击 "OK"(确定)。
image::images/insert-form-dialog.png[]
@@ -114,13 +114,13 @@
image::images/blank-form.png[]
-[start=6]
+
. 在窗体的开头和结尾标记之间,键入 "Show wish list of: " 文本。
-[start=7]
+
. 从 "Palette"(组件面板)的 *HTML Forms*(HTML 窗体)部分中,将一个文本输入组件拖放至 "Show wish list of: " 文本后面的空白区域中。"Insert Text Input"(插入文本输入)对话框打开。
-[start=8]
+
. 将输入命名为 ``user`` 。选择输入类型 ``text`` (文本)。将所有其他字段保留空白,然后单击 "OK"(确定)。
image::images/insert-text-input.png[]
@@ -130,16 +130,16 @@
image::images/form-with-text-input.png[]
-[start=9]
+
. 在 </form> 标记上面添加一个空行。从 "Palette"(组件面板)的 *HTML Forms*(HTML 窗体)部分中,将一个 "Button"(按钮)组件拖放至该空行中。
-[start=10]
+
. "Insert Button"(插入按钮)对话框打开。在 "Label"(标签)字段中键入 ``Go`` ,然后单击 "OK"(确定)。
image::images/insert-button-dialog.png[]
-[start=11]
+
. 现在,该窗体类似于下面的代码,但有一点不同。在下面的代码中,<form> 标记中的 ``method`` 属性是显式的。NetBeans IDE 没有在窗体中添加 method 属性,因为 GET 是该属性的默认值。不过,如果 ``method`` 属性是显式的,您可以更轻松地理解代码。
[source,xml]
@@ -172,7 +172,7 @@
image::images/index-php-works.png[]
-[start=4]
+
. 在 "Show wish list of:" 编辑框中,输入 Tom,然后单击 "Go"。将显示一个具有以下 URL 的空白页:http://localhost:90/Lesson2/wishlist.php?user=tom。该 URL 表示主页正常工作。
@@ -198,7 +198,7 @@
</html>
----
-[start=2]
+
. 要显示标题,请在紧靠起始 <body> 标记后面以及生成的 <?php 标记前面的位置输入以下代码块:
[source,php]
@@ -226,7 +226,7 @@
image::images/wishlist-php-title-works.png[]
-[start=3]
+
. 在模板 PHP 块中删除注释部分。在该位置键入或粘贴以下代码。该代码打开数据库连接。
*对于 MySQL 数据库:*
@@ -263,7 +263,7 @@
image::images/codecompletion.png[]image::images/codecompletion-oci.png[]
-[start=4]
+
. 在打开数据库连接的代码下面,在同一 PHP 块中键入或粘贴以下代码。该代码检索请求其愿望列表的许愿者的 ID。如果许愿者不在数据库中,代码将终止/退出该进程,然后显示一条错误消息。
*对于 MySQL 数据库:*
@@ -393,7 +393,7 @@
----
`</table>` 标记用于结束表。
-[start=2]
+
. 在结束 </table> 标记上面,输入以下 PHP 代码块。
*对于 MySQL 数据库:*
@@ -441,7 +441,7 @@
*警告:*确保键入的数据库字段名称与创建数据库表期间指定的名称完全相同。对于 Oracle,默认返回大写的列名。
-[start=3]
+
. 要测试应用程序,请按<<createNewFile,测试 index.php>> 部分所述运行项目。
image::images/wishlist-php-works.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3.asciidoc
index 4290245..e56c576 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3.asciidoc
@@ -129,7 +129,7 @@
----
-[start=2]
+
. Below the variables, add an `if ` clause. The parameter of the `if` clause checks that the page was requested from itself via the POST method. If not, the further validations are not performed and the page is shown with empty fields as described above.
[source,php]
@@ -141,7 +141,7 @@
}
----
-[start=3]
+
. Within the curly braces of the `if ` clause, add another `if ` clause that checks whether the user has filled in the wisher's name. If the text field "user" is empty, the value of `$userIsEmpty` is changed to true.
[source,php]
@@ -157,7 +157,7 @@
}
----
-[start=4]
+
. Add code that establishes a database connection. If the connection cannot be established, the MySQL or Oracle OCI8 error is sent to the output.
*For the MySQL database:*
@@ -207,7 +207,7 @@
}
----
-[start=5]
+
. Add code that checks whether a user whose name matches the "user" field already exists. The code does this by trying to find a wisher ID number for a name matching the name in the "user" field. If such an ID number exists, the value of `$userNameIsUnique` is changed to "false."
*For the MySQL database:*
@@ -270,7 +270,7 @@
}
----
-[start=6]
+
. After the code that checks if the user is unique, add a series of `if ` clauses that check whether the user entered and confirmed a password correctly. The code checks that the Password ("password") and Confirm Password ('password2) fields are not empty in the form and that they are identical. Otherwise the values of the corresponding boolean variables are changed accordingly.
[source,php]
@@ -282,7 +282,7 @@
}
----
-[start=7]
+
. Complete the `if ($_SERVER['REQUEST_METHOD'] == "POST")` clause by adding code that inserts a new entry into the "wishers" database. The code checks that the name of the wisher is specified uniquely and that the password is entered and confirmed validly. If the conditions are met, the code takes the "user" and "password" values from the HTML form and inserts them into the Name and Password columns, respectively, of a new row in the wishers database. After creating the row, the code closes the database connection and redirects the application to the page `editWishList.php` .
*For the MySQL database:*
@@ -434,7 +434,7 @@
?> *
----
-[start=2]
+
. Enter the following PHP code block inside the HTML input form below the code for the password input:
[source,php]
@@ -449,7 +449,7 @@
?>*
----
-[start=3]
+
. Enter the following PHP code blocks inside the HTML input form below the code for password confirmation:
[source,php]
@@ -478,31 +478,31 @@
image::images/index-php-3.png[]
-[start=2]
+
. On the index page, click the link next to the text Still don't have a wish list? The following form opens:
image::images/create-new-wisher-empty-form.png[]
-[start=3]
+
. Leave the fields empty and click Register. An error message displays.
image::images/create-new-wisher-name-empty.png[]
-[start=4]
+
. Enter the name of a registered wisher, for example, Tom in the Your name field, fill in the other fields correctly, and click Register. An error message displays.
-[start=5]
+
. Fill in the Password and Please confirm your password fields with different values and click Register. An error message displays.
-[start=6]
+
. Enter Bob in the Your name field, specify the same password in both password fields and click Register. The page that opens is empty but the redirection passed correctly as the URL ends with editWishList.php:
image::images/edit-wish-list-empty.png[]
-[start=7]
+
. To check that the data is stored in the database, navigate to wishers on the Services window below the wislist1 node and from the context menu choose View Data
image::images/wishers.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ja.asciidoc
index 86594d4..d01b796 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ja.asciidoc
@@ -127,7 +127,7 @@
----
-[start=2]
+
. 変数の下に ``if`` 節を追加します。 ``if`` 節のパラメータは、ページがPOSTメソッド経由で同じページからリクエストされたことを確認します。そうでない場合、それ以上の検証は実行されず、ページは前述のように空のフィールドで表示されます。
[source,php]
@@ -139,7 +139,7 @@
}
----
-[start=3]
+
. ``if`` 節の中括弧内に、ユーザーがウィッシャの名前を入力したかどうかを確認するための別の ``if`` 節を追加します。テキスト・フィールド「user」が空の場合は、 ``$userIsEmpty`` の値がtrueに変わります。
[source,php]
@@ -155,7 +155,7 @@
}
----
-[start=4]
+
. データベース接続を確立するコードを追加します。接続が確立できない場合、MySQLまたはOracle OCI8エラーが出力に送信されます。
*MySQLデータベースの場合:*
@@ -205,7 +205,7 @@
}
----
-[start=5]
+
. 「user」フィールドと名前が一致するユーザーが、すでに存在するかどうかを確認するコードを追加します。このコードは、「user」フィールド内の名前と一致する名前のウィッシャID番号の検索することによって、これを実行します。そのようなID番号が存在する場合、 ``$userNameIsUnique`` の値は「false」に変更されます。
*MySQLデータベースの場合:*
@@ -268,7 +268,7 @@
}
----
-[start=6]
+
. ユーザーが一意かどうかを確認するコードの後に、ユーザーがパスワードを正しく入力して確認入力したかどうかを確認する一連の ``if`` 節を追加します。コードは、フォーム内の「Password」("password")および「Confirm Password」('password2)の各フィールドが空でなく、同一であることを確認します。そうでない場合は、それに応じて対応するブール型変数の値が変わります。
[source,php]
@@ -280,7 +280,7 @@
}
----
-[start=7]
+
. 「wishers」データベースに新しいエントリを挿入するコードを追加して、 ``if ($_SERVER['REQUEST_METHOD']=="POST")`` 節を完成させます。コードは、ウィッシャの名前が一意に指定されていること、およびパスワードが有効に入力および確認されていることを確認します。条件を満たす場合、コードはHTMLフォームから「user」と「password」の値を取り、wishersデータベース内の新しい行のName列とPassword列にそれぞれ挿入します。行を作成した後、コードはデータベース接続を切断し、アプリケーションをページ ``editWishList.php`` にリダイレクトします。
*MySQLデータベースの場合:*
@@ -432,7 +432,7 @@
?> *
----
-[start=2]
+
. 次のPHPコード・ブロックを、HTML入力フォーム内の、パスワード入力のコードの下に入力します。
[source,php]
@@ -447,7 +447,7 @@
?>*
----
-[start=3]
+
. 次のPHPコード・ブロックを、HTML入力フォーム内の、パスワード確認のコードの下に入力します。
[source,php]
@@ -472,37 +472,37 @@
=== 新規ウィッシャの作成機能のテスト
-[start=1]
+
. アプリケーションを実行します。indexページが開きます。
image::images/index-php-3.png[]
-[start=2]
+
. indexページで、テキスト「Still don't have a wish list?」の横にあるリンクをクリックします。次のフォームが開きます。
image::images/create-new-wisher-empty-form.png[]
-[start=3]
+
. フィールドを空白のままにし、「Register」をクリックします。エラー・メッセージが表示されます。
image::images/create-new-wisher-name-empty.png[]
-[start=4]
+
. 登録済のウィッシャの名前を入力し(たとえば、「Your name」フィールドに「Tom」と入力)、その他のフィールドを正しく入力して、「Register」をクリックします。エラー・メッセージが表示されます。
-[start=5]
+
. 「Password」フィールドと「Please confirm your password」フィールドに異なる値を入力し、「Register」をクリックします。エラー・メッセージが表示されます。
-[start=6]
+
. 「Your name」フィールドに「Bob」と入力し、両方のパスワード・フィールドに同じパスワードを指定して「Register」をクリックします。表示されるページは空ですが、次のようにURLがeditWishList.phpで終わっているため、リダイレクションは正しく渡されています。
image::images/edit-wish-list-empty.png[]
-[start=7]
+
. データがデータベースに格納されたことを確認するには、「サービス」ウィンドウのwislist1ノードの下にあるwishersに移動し、コンテキスト・メニューから「データを表示」を選択します。
image::images/wishers.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_pt_BR.asciidoc
index 47a310f..8db85d2 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_pt_BR.asciidoc
@@ -126,7 +126,7 @@
----
-[start=2]
+
. Abaixo das variáveis, adicione uma cláusula ``se `` . O parâmetro da cláusula ``se`` verifica se a página foi solicitada a partir dela mesma usando o método POST. Caso contrário, as validações posteriores não são realizadas e a página é mostrada com campos vazios, como descrito acima.
[source,php]
@@ -138,7 +138,7 @@
}
----
-[start=3]
+
. Dentro das chaves da cláusula ``se `` , adicione outra cláusula ``se `` que verifica se o usuário preencheu o nome do wisher. Se o campo de texto "user" estiver vazio, o valor de ``$userIsEmpty`` será alterado para verdadeiro.
[source,php]
@@ -154,7 +154,7 @@
}
----
-[start=4]
+
. Adicione o código que estabelece uma conexão de banco de dados. Se não for possível estabelecer a conexão, o erro de MySQL ou Oracle OCI8 é enviado para a saída.
*Para o banco de dados MySQL:*
@@ -204,7 +204,7 @@
}
----
-[start=5]
+
. Adicione o código que verifica se um usuário cujo nome corresponde ao campo "user" já existe. O código faz isso, tentando localizar o número do wisher ID para um nome correspondente ao nome no campo "user". Se houver tal número de ID, o valor de ``$userNameIsUnique`` é alterado para "false".
*Para o banco de dados MySQL:*
@@ -267,7 +267,7 @@
}
----
-[start=6]
+
. Com do código que verifica se o usuário sendo único, adicione uma série de cláusulas ``se `` para verificar se o usuário inseriu e confirmou a senha corretamente. O código verifica se os campos Senha ("password") e Confirmar senha ('password2) não estão vazios no form e não são idênticos. Caso contrário, os valores das variáveis boolianas correspondentes são alterados de acordo.
[source,php]
@@ -279,7 +279,7 @@
}
----
-[start=7]
+
. Complete a cláusula ``se ($_SERVER['REQUEST_METHOD'] == "POST")`` adicionando o código que insere uma nova entrada no banco de dados "wishers". O código verifica se o nome do wisher é especificado exclusivamente e se a senha é indicada e confirmada validamente. Se as condições forem atendidas, o código pegará os valores "user" e "password" do form HTML e os inserirá nas colunas Nome e Senha, respectivamente, de uma nova linha no banco de dados wishers. Depois de criar a linha, o código fecha a conexão do banco de dados e redireciona a aplicação para a página ``editWishList.php`` .
*Para o banco de dados MySQL:*
@@ -431,7 +431,7 @@
?> *
----
-[start=2]
+
. Insira o seguinte bloco de código PHP dentro do form de entrada HTML abaixo do código da entrada de senha:
[source,php]
@@ -446,7 +446,7 @@
?>*
----
-[start=3]
+
. Insira os seguintes blocos de código PHP dentro do form de entrada HTML abaixo do código de confirmação de senha:
[source,php]
@@ -471,37 +471,37 @@
=== Testando a Funcionalidade da Criação do Novo Wisher
-[start=1]
+
. Execute a aplicação. A página de índice abre.
image::images/index-php-3.png[]
-[start=2]
+
. Na página de índice, clique no link ao lado do texto Ainda não possui uma lista de desejos? O seguinte form abre:
image::images/create-new-wisher-empty-form.png[]
-[start=3]
+
. Deixe estes campos em branco e clique em Registrar. Uma mensagem de erro é exibida
image::images/create-new-wisher-name-empty.png[]
-[start=4]
+
. Insira o nome de um wisher registrado, por exemplo, Tom no campo Seu nome, preencha os outros campos corretamente e clique em Registrar. Uma mensagem de erro é exibida.
-[start=5]
+
. Preencha os campos Senha e Confirme sua senha com valores diferentes e clique em Registrar. Uma mensagem de erro é exibida.
-[start=6]
+
. Insira Bob no campo Seu nome, especifique a mesma senha em ambos os campos de senha e clique em Registrar. A página exibida está vazia, mas o redirecionamento foi passado corretamente já que o URL termina com editWishList.php:
image::images/edit-wish-list-empty.png[]
-[start=7]
+
. Para verificar se os dados estão armazenados no banco de dados, vá para wishers na janela Serviços abaixo do nó wislist1 e no menu de contexto, selecione Visualizar Dados
image::images/wishers.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ru.asciidoc
index 0fedc32..085231b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_ru.asciidoc
@@ -126,7 +126,7 @@
----
-[start=2]
+
. Под переменными следует добавить блок ``if `` . Параметр блока ``if`` выполняет проверку того, что страница была запрошена из нее самой посредством метода POST. Если это не так, дальнейшие проверки допустимости не выполняются, и на экран выводится страница с пустыми полями, как описано выше.
[source,php]
@@ -138,7 +138,7 @@
}
----
-[start=3]
+
. Внутри фигурных скобок блока ``if `` добавьте другой блок ``if `` , позволяющий проверить, ввел ли пользователь имя автора пожелания в поле. Если текстовое поле "user" является пустым, значение ``$userIsEmpty`` меняется на "true".
[source,php]
@@ -154,7 +154,7 @@
}
----
-[start=4]
+
. Добавьте код, устанавливающий подключение к базе данных. Если установить подключение невозможно, то выводится ошибка MySQL или Oracle OCI8.
*Для базы данных MySQL*
@@ -204,7 +204,7 @@
}
----
-[start=5]
+
. Добавьте код, позволяющий проверить, существует ли пользователь, имя которого соответствует указанному в поле "user". Эта задача выполняется путем поиска идентификационного номера автора пожелания в соответствии с именем, указанным в поле "user". Если такой номер существует, значение ``$userNameIsUnique`` меняется на "false".
*Для базы данных MySQL*
@@ -267,7 +267,7 @@
}
----
-[start=6]
+
. После кода, проверяющего уникальность пользователя, добавьте серию блоков ``if `` , проверяющих, правильно ли пользователь ввел и подтвердил пароль. Код выполняет проверку того, что поля "Password" ("password") и "Confirm Password" ("password2") заполнены и идентичны друг другу. В противном случае значения соответствующих логических переменных также изменяются.
[source,php]
@@ -279,7 +279,7 @@
}
----
-[start=7]
+
. Завершите блок ``if ($_SERVER['REQUEST_METHOD'] == "POST")`` , добавив код, вставляющий новую запись в базу данных "Wishers". В соответствии с кодом выполняется проверка того, что имя пользователя указано однозначно и что пароль введен и подтвержден правильно. Если эти условия выполнены, код извлекает значения "user" и "password" из формы HTML и вставляет их соответственно в столбцы "Name" и "Password", относящиеся к новой строке в базе данных "Wishers". После создания строки код закрывает подключение к базе данных и переадресует приложение на страницу ``editWishList.php`` .
*Для базы данных MySQL*
@@ -431,7 +431,7 @@
?> *
----
-[start=2]
+
. Введите следующий блок кода PHP в форме ввода HTML под кодом для ввода пароля:
[source,php]
@@ -446,7 +446,7 @@
?>*
----
-[start=3]
+
. Введите следующий блок кода PHP в форме ввода HTML под кодом для подтверждения пароля:
[source,php]
@@ -474,28 +474,28 @@
image::images/index-php-3.png[]
-[start=2]
+
. На странице-указателе щелкните ссылку рядом с текстом "Still don't have a wish list?" Откроется следующая форма:
image::images/create-new-wisher-empty-form.png[]
-[start=3]
+
. Оставьте поля пустыми и нажмите кнопку Register ("Зарегистрировать"). На экране появится сообщение об ошибке.
image::images/create-new-wisher-name-empty.png[]
-[start=4]
+
. Введите имя зарегистрированного пользователя, например, "Tom" в поле "Your name", внимательно заполните другие поля и нажмите кнопку "Register". На экране появится сообщение об ошибке.
-[start=5]
+
. Заполните поля "Password" и "Please confirm your password" различными значениями и нажмите кнопку "Register". На экране появится сообщение об ошибке.
-[start=6]
+
. Введите "Bob" в поле "Your name", укажите в полях пароля один и тот же пароль и нажмите кнопку "Register". Откроется пустая страница, однако переадресация осуществляется правильно, поскольку URL-адрес заканчивается текстом "editWishList.php":
image::images/edit-wish-list-empty.png[]
-[start=7]
+
. Проверьте, что данные сохранены в базе данных, путем перехода к разделу "Wishers" в окне "Services", расположенном под узлом "wislist1", и выбора "View Data" в контекстном меню
image::images/wishers.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_zh_CN.asciidoc
index 89c8662..bdf8d15 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson3_zh_CN.asciidoc
@@ -126,7 +126,7 @@
----
-[start=2]
+
. 在这些变量下面,添加一个 ``if `` 子句。 ``if`` 子句的参数检查是否通过 POST 方法从自身请求页面。如果不是,将不执行进一步验证,并且页面显示上述空字段。
[source,php]
@@ -138,7 +138,7 @@
}
----
-[start=3]
+
. 在 ``if`` 子句的花括号中,添加另一个 ``if`` 子句,用于检查用户是否填写了许愿者的名字。如果文本字段 "user" 为空,则将 ``$userIsEmpty`` 值更改为 true。
[source,php]
@@ -154,7 +154,7 @@
}
----
-[start=4]
+
. 添加代码以建立数据库连接。如果无法建立连接,则将 MySQL 或 Oracle OCI8 错误发送到输出。
*对于 MySQL 数据库:*
@@ -204,7 +204,7 @@
}
----
-[start=5]
+
. 添加代码以检查名字与 "user" 字段匹配的用户是否已存在。该代码的工作方式是,尝试查找名字与 "user" 字段中的名字匹配的许愿者 ID 号。如果此类 ID 号存在,则将 ``$userNameIsUnique`` 的值更改为 "false"。
*对于 MySQL 数据库:*
@@ -267,7 +267,7 @@
}
----
-[start=6]
+
. 在检查用户是否唯一的代码后面,添加一系列 ``if`` 子句,以便检查用户是否正确输入并确认了口令。该代码检查窗体中的 Password ("password") 和 Confirm Password ('password2) 字段是否不为空以及是否相同。如果为空或不相同,则会更改相应的布尔型变量的值。
[source,php]
@@ -279,7 +279,7 @@
}
----
-[start=7]
+
. 通过添加在 "wishers" 数据库中插入新条目的代码,完成 ``if ($_SERVER['REQUEST_METHOD'] == "POST")`` 子句。该代码检查是否唯一地指定了许愿者名字,以及是否有效地输入并确认了口令。如果符合这些条件,该代码将从 HTML 窗体中提取 "user" 和 "password" 值,然后将其分别插入到 wishers 数据库新行中的 Name 和 Password 列。在创建该行后,该代码将关闭数据库连接并将应用程序重定向到 ``editWishList.php`` 页。
*对于 MySQL 数据库:*
@@ -431,7 +431,7 @@
?> *
----
-[start=2]
+
. 在 HTML 输入窗体中,在口令输入代码下输入以下 PHP 代码块:
[source,php]
@@ -446,7 +446,7 @@
?>*
----
-[start=3]
+
. 在 HTML 输入窗体中,在口令确认代码下面输入以下 PHP 代码块:
[source,php]
@@ -474,28 +474,28 @@
image::images/index-php-3.png[]
-[start=2]
+
. 在索引页中,单击 "Still don't have a wish list?" 文本旁边的链接。以下窗体打开:
image::images/create-new-wisher-empty-form.png[]
-[start=3]
+
. 将这些字段保留空白,然后单击 "Register"。此时将显示一条错误消息。
image::images/create-new-wisher-name-empty.png[]
-[start=4]
+
. 在 "Your name" 字段中输入注册的许愿者名字(如 Tom),正确填写其他字段,然后单击 "Register"。此时将显示一条错误消息。
-[start=5]
+
. 使用不同的值填写 "Password" 和 "Please confirm your password" 字段,然后单击 "Register"。此时将显示一条错误消息。
-[start=6]
+
. 在 "Your name" 字段中输入 Bob,在两个口令字段中指定相同的口令,然后单击 "Register"。打开的页为空页,但正确传送了重定向,因为 URL 以 editWishList.php 结尾:
image::images/edit-wish-list-empty.png[]
-[start=7]
+
. 要检查数据是否存储在数据库中,请导航到 "Services"(服务)窗口中的 wislist1 节点下面的 wishers,然后从上下文菜单中选择 "View Data"(查看数据)
image::images/wishers.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4.asciidoc
index b73078d..3bb993e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4.asciidoc
@@ -380,7 +380,9 @@
require_once("Includes/db.php");
----
-2. Replace the code that connects to the database and gets the ID of the wisher with a call to the `get_wisher_id_by_name` function.
+
+[start=2]
+. Replace the code that connects to the database and gets the ID of the wisher with a call to the `get_wisher_id_by_name` function.
For the *MySQL database*, the code you replace is:
@@ -459,7 +461,9 @@
No code is necessary here for opening a connection to the database. The connection is opened by the constructor of the WishDB class. If the name and/or password changes, you need to update only the relevant variables of the WishDB class.
-3. Replace the code that gets wishes for a wisher identified by ID with code that calls the `get_wishes_by_wisher_id` function.
+
+[start=3]
+. Replace the code that gets wishes for a wisher identified by ID with code that calls the `get_wishes_by_wisher_id` function.
For the *MySQL database*, the code you replace is:
@@ -494,7 +498,9 @@
----
-4. Remove the line that closes the database connection.
+
+[start=4]
+. Remove the line that closes the database connection.
[source,php]
----
@@ -524,8 +530,12 @@
----
-2. Delete the database connection credentials ( `$dbHost,` etc). These are now in `db.php` .
-3. Replace the code that connects to the database and gets the ID of the wisher with a call to the `get_wisher_id_by_name` function.
+
+[start=2]
+. Delete the database connection credentials ( `$dbHost,` etc). These are now in `db.php` .
+
+[start=3]
+. Replace the code that connects to the database and gets the ID of the wisher with a call to the `get_wisher_id_by_name` function.
For the *MySQL database*, the code you replace is:
@@ -596,7 +606,9 @@
----
The `WishDB` object exists as long as the current page is being processed. It is destroyed after the processing is completed or interrupted. The code for opening a connection to the database is not necessary because this is done by the WishDB function. The code for closing the connection is not necessary because the connection is closed as soon as the `WishDB` object is destroyed.
-4. Replace the code that inserts new wishers into the database with code that calls the `create_wisher` function.
+
+[start=4]
+. Replace the code that inserts new wishers into the database with code that calls the `create_wisher` function.
For the *MySQL database*, the code you replace is:
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ja.asciidoc
index d28f810..051554b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ja.asciidoc
@@ -384,7 +384,9 @@
require_once("Includes/db.php");
----
-2. データベースに接続してウィッシャのIDを取得するコードを、 `get_wisher_id_by_name` 関数のコールに置き換えます。
+
+[start=2]
+. データベースに接続してウィッシャのIDを取得するコードを、 `get_wisher_id_by_name` 関数のコールに置き換えます。
*MySQLデータベース*の場合に置き換えるコード:
@@ -463,7 +465,9 @@
データベースへの接続を開くコードは、ここでは必要ありません。WishDBクラスのコンストラクタによって接続が開かれます。名前またはパスワード(あるいはその両方)を変更した場合は、WishDBクラスの関連する変数のみ更新する必要があります。
-3. IDによって識別されるウィッシャのウィッシュを取得するコードを、 `get_wishes_by_wisher_id` 関数をコールするコードに置き換えます。
+
+[start=3]
+. IDによって識別されるウィッシャのウィッシュを取得するコードを、 `get_wishes_by_wisher_id` 関数をコールするコードに置き換えます。
*MySQLデータベース*の場合に置き換えるコード:
@@ -498,7 +502,9 @@
----
-4. データベース接続を切断する行を除去します。
+
+[start=4]
+. データベース接続を切断する行を除去します。
[source,php]
----
@@ -528,8 +534,12 @@
require_once("Includes/db.php");
----
-2. データベース接続の資格情報( `$dbHost,` など)を削除します。これらは現在 `db.php` にあります。
-3. データベースに接続してウィッシャのIDを取得するコードを、 `get_wisher_id_by_name` 関数のコールに置き換えます。
+
+[start=2]
+. データベース接続の資格情報( `$dbHost,` など)を削除します。これらは現在 `db.php` にあります。
+
+[start=3]
+. データベースに接続してウィッシャのIDを取得するコードを、 `get_wisher_id_by_name` 関数のコールに置き換えます。
*MySQLデータベース*の場合に置き換えるコード:
@@ -600,7 +610,9 @@
----
`WishDB` オブジェクトは、現在のページが処理されている間は存在します。これは、処理が完了したり割込みされた後に破棄されます。WishDB関数によってデータベースへの接続が開くため、データベースへの接続を開くコードは必要ありません。 `WishDB` オブジェクトが破棄されると同時に接続が切断されるため、接続を切断するためのコードは必要ありません。
-4. 新しいウィッシャをデータベースに挿入するコードを、 `create_wisher` 関数をコールするコードに置き換えます。
+
+[start=4]
+. 新しいウィッシャをデータベースに挿入するコードを、 `create_wisher` 関数をコールするコードに置き換えます。
*MySQLデータベース*の場合に置き換えるコード:
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_pt_BR.asciidoc
index 8010c5d..1a339ec 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_pt_BR.asciidoc
@@ -387,7 +387,9 @@
require_once("Includes/db.php");
----
-2. Substitua o código que estabelece conexão com o banco de dados e que obtém o wisher ID por uma chamada para a função `get_wisher_id_by_name` .
+
+[start=2]
+. Substitua o código que estabelece conexão com o banco de dados e que obtém o wisher ID por uma chamada para a função `get_wisher_id_by_name` .
Para o *banco de dados MySQL*, o código a ser substituído é:
@@ -466,7 +468,9 @@
Nenhum código é necessário para abrir uma conexão ao banco de dados. A conexão é aberta pelo construtor da classe WishDB. Se o nome e/ou a senha for alterado, você precisará atualizar somente as variáveis relevantes da classe WishDB.
-3. Substitua o código que recebe desejos de um wisher identificado pelo ID com um código que chama a função `get_wishes_by_wisher_id` .
+
+[start=3]
+. Substitua o código que recebe desejos de um wisher identificado pelo ID com um código que chama a função `get_wishes_by_wisher_id` .
Para o *banco de dados MySQL*, o código a ser substituído é:
@@ -501,7 +505,9 @@
----
-4. Remova a linha que fecha a conexão do banco de dados.
+
+[start=4]
+. Remova a linha que fecha a conexão do banco de dados.
[source,php]
----
@@ -530,8 +536,12 @@
----
-2. Delete a credencial da conexão do banco de dados ( `$dbHost,` etc). Esses estão agora em `db.php.` .
-3. Substitua o código que estabelece conexão com o banco de dados e que obtém o wisher ID por uma chamada para a função `get_wisher_id_by_name` .
+
+[start=2]
+. Delete a credencial da conexão do banco de dados ( `$dbHost,` etc). Esses estão agora em `db.php.` .
+
+[start=3]
+. Substitua o código que estabelece conexão com o banco de dados e que obtém o wisher ID por uma chamada para a função `get_wisher_id_by_name` .
Para o *banco de dados MySQL*, o código a ser substituído é:
@@ -602,7 +612,9 @@
----
O objeto `WishDB` existe enquanto a página atual estiver sendo processada. Ele é destruído depois que o processamento é concluído ou interrompido. O código para abrir uma conexão ao banco de dados não é necessário porque isso é feito pela função WishDB. O código para fechar a conexão não é necessário porque a conexão é fechada assim que o objeto `WishDB` é destruído.
-4. Substitua o código que insere novos desejos no banco de dados pelo código que chama a função `create_wisher` .
+
+[start=4]
+. Substitua o código que insere novos desejos no banco de dados pelo código que chama a função `create_wisher` .
Para o *banco de dados MySQL*, o código a ser substituído é:
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ru.asciidoc
index 6803cf3..b8dab0a 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_ru.asciidoc
@@ -389,7 +389,9 @@
----
-2. Замените код, который подключается к базе данных и получает идентификатор пожелания, вызовом функции ``get_wisher_id_by_name`` .
+
+[start=2]
+. Замените код, который подключается к базе данных и получает идентификатор пожелания, вызовом функции ``get_wisher_id_by_name`` .
Для *базы данных MySQL* вы заменяете следующий код:
@@ -468,7 +470,9 @@
Для открытия подключения к базе данных наличие кода не является необходимым. Открытие подключения выполняется конструктором класса WishDB. Если имя и/или пароль изменяются, необходимо обновить только соответствующие переменные класса WishDB.
-3. Замените код, который получает пожелания для автора пожеланий, идентифицированного с помощью кода, кодом, который вызывает функцию ``get_wishes_by_wisher_id`` .
+
+[start=3]
+. Замените код, который получает пожелания для автора пожеланий, идентифицированного с помощью кода, кодом, который вызывает функцию ``get_wishes_by_wisher_id`` .
Для *базы данных MySQL * вы заменяете следующий код:
@@ -503,7 +507,9 @@
----
-4. Удалите строку, которая закрывает подключение к базе данных.
+
+[start=4]
+. Удалите строку, которая закрывает подключение к базе данных.
[source,php]
----
@@ -533,8 +539,12 @@
----
-2. Удалите подтверждения подключения к базе данных ( ``$dbHost`` и пр.). Теперь они находятся в ``db.php`` .
-3. Замените код, который подключается к базе данных и получает идентификатор пожелания, вызовом функции ``get_wisher_id_by_name`` .
+
+[start=2]
+. Удалите подтверждения подключения к базе данных ( ``$dbHost`` и пр.). Теперь они находятся в ``db.php`` .
+
+[start=3]
+. Замените код, который подключается к базе данных и получает идентификатор пожелания, вызовом функции ``get_wisher_id_by_name`` .
Для *базы данных MySQL * вы заменяете следующий код:
@@ -604,7 +614,9 @@
----
Объект ``WishDB`` существует до тех пор, пока обрабатывается текущая страница. Если обработка завершена или прервана, этот объект уничтожается. Код для открытия подключения к базе данных не является необходимым, поскольку подключение выполняется посредством функции WishDB. Код для закрытия подключения также не является необходимым, поскольку подключение будет закрыто сразу же после уничтожения объекта ``WishDB`` .
-4. Замените код, который вставляет новых авторов пожеланий в базу данных, кодом, который вызывает функцию ``create_wisher`` .
+
+[start=4]
+. Замените код, который вставляет новых авторов пожеланий в базу данных, кодом, который вызывает функцию ``create_wisher`` .
Для *базы данных MySQL * вы заменяете следующий код:
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_zh_CN.asciidoc
index 220c5ef..ba7234e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson4_zh_CN.asciidoc
@@ -390,7 +390,9 @@
----
-2. 将连接到数据库并获取许愿者 ID 的代码替换为 ``get_wisher_id_by_name`` 函数调用。
+
+[start=2]
+. 将连接到数据库并获取许愿者 ID 的代码替换为 ``get_wisher_id_by_name`` 函数调用。
对于 *MySQL 数据库*,替换的代码为:
@@ -469,7 +471,9 @@
此处不需要用于打开数据库连接的代码。连接是通过 WishDB 类的构造函数打开的。如果名字和/或口令发生变化,您只需要更新 WishDB 类的相关变量即可。
-3. 将获取按 ID 标识的许愿者的愿望的代码替换为调用 ``get_wishes_by_wisher_id`` 函数的代码。
+
+[start=3]
+. 将获取按 ID 标识的许愿者的愿望的代码替换为调用 ``get_wishes_by_wisher_id`` 函数的代码。
对于 *MySQL 数据库*,替换的代码为:
@@ -504,7 +508,9 @@
----
-4. 删除关闭数据库连接的行。
+
+[start=4]
+. 删除关闭数据库连接的行。
[source,php]
----
@@ -534,8 +540,12 @@
----
-2. 删除数据库连接凭证( ``$dbHost`` 等)。这些凭证现在包含在 ``db.php`` 中。
-3. 将连接到数据库并获取许愿者 ID 的代码替换为 ``get_wisher_id_by_name`` 函数调用。
+
+[start=2]
+. 删除数据库连接凭证( ``$dbHost`` 等)。这些凭证现在包含在 ``db.php`` 中。
+
+[start=3]
+. 将连接到数据库并获取许愿者 ID 的代码替换为 ``get_wisher_id_by_name`` 函数调用。
对于 *MySQL 数据库*,替换的代码为:
@@ -606,7 +616,9 @@
----
只要处理当前页面, ``WishDB`` 对象就会存在。在处理完成或中断后,将销毁该对象。不需要用于打开数据库连接的代码,因为该操作是由 WishDB 函数完成的。不需要用于关闭连接的代码,因为在销毁 ``WishDB`` 对象后,将立即关闭连接。
-4. 将在数据库中插入新许愿者的代码替换为调用 ``create_wisher`` 函数的代码。
+
+[start=4]
+. 将在数据库中插入新许愿者的代码替换为调用 ``create_wisher`` 函数的代码。
对于 *MySQL 数据库*,替换的代码为:
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5.asciidoc
index 7080681..a0e093d 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5.asciidoc
@@ -126,7 +126,9 @@
1. Run the `createNewWisher.php` file and create a new wisher, for example Jack.
The `editWishList.php` opens with Hello Jack.
-2. Clear session cookies in your browser or end the session and run `editWishList.php` from the IDE.
+
+[start=2]
+. Clear session cookies in your browser or end the session and run `editWishList.php` from the IDE.
The `editWishList.php` file opens with Hello because no user has been transferred through a session. This is not correct because it enables someone who is not logged in and not registered to create or edit a wish list. In order to avoid this, the user needs to be redirected to the `index.php` page.
[[_logging_in_from_the_index_php_page]]
@@ -289,8 +291,12 @@
image::images/incorrectNamePasswordIndex.png[]
-4. Enter Tom in the Username edit box and tomcat in the Password edit box.
-5. Press Edit My Wish list. The editWishList.php page is displayed:
+
+[start=4]
+. Enter Tom in the Username edit box and tomcat in the Password edit box.
+
+[start=5]
+. Press Edit My Wish list. The editWishList.php page is displayed:
image::images/SuccessfulLogonOnIndexRedirectToEditWishList.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ja.asciidoc
index 2cdf66b..8edc711 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ja.asciidoc
@@ -128,7 +128,9 @@
1. `createNewWisher.php` ファイルを実行し、Jackなどの新しいウィッシャを作成します。
`editWishList.php` が開き、「Hello Jack」と表示されます。
-2. ブラウザのセッションCookieをクリアするか、またはセッションを終了して、IDEから `editWishList.php` を実行します。セッションを介して転送されたユーザーがいないため、
+
+[start=2]
+. ブラウザのセッションCookieをクリアするか、またはセッションを終了して、IDEから `editWishList.php` を実行します。セッションを介して転送されたユーザーがいないため、
`editWishList.php` ファイルが開き、「Hello」と表示されます。これは、未ログインおよび未登録のユーザーがウィッシュ・リストを作成したり編集できるようになるため、正しくありません。これを回避するには、ユーザーが `index.php` ページにリダイレクトされる必要があります。
[[_logging_in_from_the_index_php_page]]
@@ -291,8 +293,12 @@
image::images/incorrectNamePasswordIndex.png[]
-4. 「Username」編集ボックスに「Tom」と入力し、「Password」編集ボックスに「tomcat」と入力します。
-5. 「Edit My Wish List」をクリックします。editWishList.phpページが表示されます。
+
+[start=4]
+. 「Username」編集ボックスに「Tom」と入力し、「Password」編集ボックスに「tomcat」と入力します。
+
+[start=5]
+. 「Edit My Wish List」をクリックします。editWishList.phpページが表示されます。
image::images/SuccessfulLogonOnIndexRedirectToEditWishList.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_pt_BR.asciidoc
index c3aa193..b09d37a 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_pt_BR.asciidoc
@@ -125,7 +125,9 @@
1. Execute o arquivo `createNewWisher.php` e crie um novo wisher, por exemplo, Jack.
O `editWishList.php` abre com "Hello Jack" (Olá, Jack).
-2. Limpe os cookies da sessão em seu browser ou termine a sessão e execute `editWishList.php` no IDE.
+
+[start=2]
+. Limpe os cookies da sessão em seu browser ou termine a sessão e execute `editWishList.php` no IDE.
O arquivo `editWishList.php` abre com Hello porque nenhum usuário foi transferido a uma sessão. Isso não é correto, porque permite que alguém que não esteja conectado e não esteja registrado crie ou edite uma lista de desejos. Para evitar isso, o usuário precisa ser redirecionado para a página `index.php` .
[[_logging_in_from_the_index_php_page]]
@@ -288,8 +290,12 @@
image::images/incorrectNamePasswordIndex.png[]
-4. Digite Tom na caixa de edição Nome de Usuário e tomcat na caixa de edição Senha.
-5. Clique em Editar Minha Lista de Desejos. É exibida a página editWishList.php:
+
+[start=4]
+. Digite Tom na caixa de edição Nome de Usuário e tomcat na caixa de edição Senha.
+
+[start=5]
+. Clique em Editar Minha Lista de Desejos. É exibida a página editWishList.php:
image::images/SuccessfulLogonOnIndexRedirectToEditWishList.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ru.asciidoc
index 1bf80fa..aef83d0 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_ru.asciidoc
@@ -126,7 +126,9 @@
1. Запустите файл `createNewWisher.php` и создайте нового пользователя, например, с именем "Jack".
Откроется файл `editWishList.php` с приветственным сообщением "Hello Jack".
-2. Можно либо очистить файл cookie сеанса в используемом браузере, либо завершить сеанс и запустить файл `editWishList.php` в среде IDE.
+
+[start=2]
+. Можно либо очистить файл cookie сеанса в используемом браузере, либо завершить сеанс и запустить файл `editWishList.php` в среде IDE.
Откроется файл `editWishList.php` , содержащий текст "Hello", поскольку в рамках сеанса не были переданы какие-либо данные пользователя. Это нежелательный вариант, так как в данном случае незарегистрированный или не выполнивший вход в систему пользователь может создавать или редактировать список "Wish list". Во избежание этого следует выполнить переадресацию пользователя на страницу `index.php` .
[[_logging_in_from_the_index_php_page]]
@@ -289,8 +291,12 @@
image::images/incorrectNamePasswordIndex.png[]
-4. Введите "Tom" в поле "Username" и "tomcat" в поле "Password".
-5. Нажмите кнопку Edit My Wish List ("Редактировать мой список желаний"). Отобразится страница editWishList.php:
+
+[start=4]
+. Введите "Tom" в поле "Username" и "tomcat" в поле "Password".
+
+[start=5]
+. Нажмите кнопку Edit My Wish List ("Редактировать мой список желаний"). Отобразится страница editWishList.php:
image::images/SuccessfulLogonOnIndexRedirectToEditWishList.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_zh_CN.asciidoc
index cfe2f8e..78f36a9 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson5_zh_CN.asciidoc
@@ -127,7 +127,9 @@
1. 运行 `createNewWisher.php` 文件,然后创建一个新的许愿者,例如,Jack。
`editWishList.php` 打开,并显示 Hello Jack。
-2. 在浏览器中清除会话 Cookie,或者结束会话并从 IDE 中运行 `editWishList.php` 。
+
+[start=2]
+. 在浏览器中清除会话 Cookie,或者结束会话并从 IDE 中运行 `editWishList.php` 。
`editWishList.php` 文件打开并显示 Hello,因为没有通过会话传输任何用户。这是不正确的,因为它允许未登录和未注册的人创建或编辑愿望列表。为了避免出现该问题,需要将用户重定向到 `index.php` 页。
[[_logging_in_from_the_index_php_page]]
@@ -290,8 +292,12 @@
image::images/incorrectNamePasswordIndex.png[]
-4. 在 "Username" 编辑框中输入 Tom,在 "Password" 编辑框中输入 tomcat。
-5. 按 "Edit My Wish list"。将显示 editWishList.php 页:
+
+[start=4]
+. 在 "Username" 编辑框中输入 Tom,在 "Password" 编辑框中输入 tomcat。
+
+[start=5]
+. 按 "Edit My Wish list"。将显示 editWishList.php 页:
image::images/SuccessfulLogonOnIndexRedirectToEditWishList.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6.asciidoc
index 598dde4..4e00389 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6.asciidoc
@@ -102,7 +102,9 @@
The form contains an "Add Wish" input field of the `submit` type. This field implements the "Add Wish" button. When the user clicks Add Wish, they are redirected to the `editWish.php` page. Because no data is transferred through this form, no Server Request method is used.
-2. Add a table above the addNewWish form that displays the existing wishes for the wisher. The code is similar to `wishlist.php` .
+
+[start=2]
+. Add a table above the addNewWish form that displays the existing wishes for the wisher. The code is similar to `wishlist.php` .
*For the MySQL database*:
@@ -147,8 +149,12 @@
?>
</table>
----
-3. Create the `editWish.php` PHP file in the Source Files folder.
-4. In `editWish.php` , implement the Add Wish form. Type or paste the following code below the <? php ?> block:
+
+[start=3]
+. Create the `editWish.php` PHP file in the Source Files folder.
+
+[start=4]
+. In `editWish.php` , implement the Add Wish form. Type or paste the following code below the <? php ?> block:
[source,xml]
----
@@ -210,7 +216,9 @@
NOTE: In either case the description is empty. The difference is only in the `dueDate` .
-2. Update the Add Wish form so that the values of its input fields are retrieved from the `$wish` array. Replace the lines in the Add Wish form:
+
+[start=2]
+. Update the Add Wish form so that the values of its input fields are retrieved from the `$wish` array. Replace the lines in the Add Wish form:
[source,php]
----
@@ -438,17 +446,29 @@
1. Run the application. On the `index.php` page, fill in the fields: in the Username field, enter "Tom", in the Password field, enter "tomcat".
image::images/user-logon-to-edit-wish-list.png[]
-2. Press the Edit My Wish List button. The `editWishList.php` page opens.
+
+[start=2]
+. Press the Edit My Wish List button. The `editWishList.php` page opens.
image::images/edit-wish-list-add-wish.png[]
-3. Press the Back to Main Page button. The `index.php` page opens.
-4. Logon as Tom and press the Edit My Wish List button again. The `editWishList.php` page opens.
-5. Press the Add Wish button. The `editWish.php` page opens. Fill in the form.
+
+[start=3]
+. Press the Back to Main Page button. The `index.php` page opens.
+
+[start=4]
+. Logon as Tom and press the Edit My Wish List button again. The `editWishList.php` page opens.
+
+[start=5]
+. Press the Add Wish button. The `editWish.php` page opens. Fill in the form.
image::images/new-wish.png[]
Press the Back to the List button. The `editWishList.php` page opens but the entered wish is not added.
-6. Press the Add Wish button again. The `editWish.php` page opens. Fill in the due date and leave the description empty. Press the Save Changes button. The `editWish.php` page displays the input form with an error message and filled in due date.
-7. Press the Add Wish button again. The `editWish.php` page opens. Fill in the form and press the Save Changes button. The `editWishList.php` page shows an updated list of wishes.
+
+[start=6]
+. Press the Add Wish button again. The `editWish.php` page opens. Fill in the due date and leave the description empty. Press the Save Changes button. The `editWish.php` page displays the input form with an error message and filled in due date.
+
+[start=7]
+. Press the Add Wish button again. The `editWish.php` page opens. Fill in the form and press the Save Changes button. The `editWishList.php` page shows an updated list of wishes.
image::images/edit-wish-list-updated.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ja.asciidoc
index 5124752..ee613c1 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ja.asciidoc
@@ -103,7 +103,9 @@
フォームには、 `submit` 型の「Add Wish」入力フィールドが含まれています。このフィールドは「Add Wish」ボタンを実装します。ユーザーが「Add Wish」をクリックすると、 `editWish.php` ページにリダイレクトされます。データはこのフォームを介して転送されないため、サーバー・リクエスト・メソッドは使用されません。
-2. ウィッシャの既存のウィッシュを表示する表をaddNewWishフォームの上に追加します。コードは `wishlist.php` と似ています。
+
+[start=2]
+. ウィッシャの既存のウィッシュを表示する表をaddNewWishフォームの上に追加します。コードは `wishlist.php` と似ています。
*MySQLデータベースの場合*:
@@ -144,8 +146,12 @@
?>
</table>
----
-3. 「ソース・ファイル」フォルダで `editWish.php` PHPファイルを作成します。
-4. `editWish.php` でAdd Wishフォームを実装します。次のコードを<?php?>ブロックの下に入力するか、または貼り付けます。
+
+[start=3]
+. 「ソース・ファイル」フォルダで `editWish.php` PHPファイルを作成します。
+
+[start=4]
+. `editWish.php` でAdd Wishフォームを実装します。次のコードを<?php?>ブロックの下に入力するか、または貼り付けます。
[source,xml]
----
@@ -207,7 +213,9 @@
*注意:* どちらの場合も説明は空です。 `dueDate` が異なるのみです。
-2. Add Wishフォームの入力フィールドの値が `$wish` 配列から取得されるように、Add Wishフォームを更新します。Add Wishフォームの次の行が対象です。
+
+[start=2]
+. Add Wishフォームの入力フィールドの値が `$wish` 配列から取得されるように、Add Wishフォームを更新します。Add Wishフォームの次の行が対象です。
[source,php]
----
@@ -435,17 +443,29 @@
1. アプリケーションを実行します。 `index.php` ページで、「Username」フィールドに「Tom」、「Password」フィールドに「tomcat」と入力します。
image::images/user-logon-to-edit-wish-list.png[]
-2. 「Edit My Wish List」ボタンを押します。 `editWishList.php` ページが開きます。
+
+[start=2]
+. 「Edit My Wish List」ボタンを押します。 `editWishList.php` ページが開きます。
image::images/edit-wish-list-add-wish.png[]
-3. 「Back to Main Page」ボタンを押します。 `index.php` ページが開きます。
-4. 「Tom」としてログオンし、もう一度「Edit My Wish List」ボタンを押します。 `editWishList.php` ページが開きます。
-5. 「Add Wish」ボタンを押します。 `editWish.php` ページが開きます。フォームに入力します。
+
+[start=3]
+. 「Back to Main Page」ボタンを押します。 `index.php` ページが開きます。
+
+[start=4]
+. 「Tom」としてログオンし、もう一度「Edit My Wish List」ボタンを押します。 `editWishList.php` ページが開きます。
+
+[start=5]
+. 「Add Wish」ボタンを押します。 `editWish.php` ページが開きます。フォームに入力します。
image::images/new-wish.png[]
「Back to the List」ボタンを押します。 `editWishList.php` ページが開きますが、入力したウィッシュは追加されていません。
-6. 再度「Add Wish」ボタンを押します。 `editWish.php` ページが開きます。期日を入力し、説明を空のままにします。「Save Changes」ボタンを押します。 `editWish.php` ページには、エラー・メッセージが表示され、期日が入力されている状態の入力フォームが表示されます。
-7. 再度「Add Wish」ボタンを押します。 `editWish.php` ページが開きます。フォームに入力し、「Save Changes」ボタンを押します。 `editWishList.php` ページに更新されたウィッシュのリストが表示されます。
+
+[start=6]
+. 再度「Add Wish」ボタンを押します。 `editWish.php` ページが開きます。期日を入力し、説明を空のままにします。「Save Changes」ボタンを押します。 `editWish.php` ページには、エラー・メッセージが表示され、期日が入力されている状態の入力フォームが表示されます。
+
+[start=7]
+. 再度「Add Wish」ボタンを押します。 `editWish.php` ページが開きます。フォームに入力し、「Save Changes」ボタンを押します。 `editWishList.php` ページに更新されたウィッシュのリストが表示されます。
image::images/edit-wish-list-updated.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_pt_BR.asciidoc
index 043acc2..e9ae2a5 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_pt_BR.asciidoc
@@ -101,7 +101,9 @@
O form contém um campo de entrada "Adicionar Desejo" do tipo `submit` . Este campo implementa o botão "Adicionar desejo". Quando o usuário clica em Adicionar Desejo, ele é redirecionado para a página `editWish.php` . Como nenhum dado é transferido usando esse form, nenhum método de Solicitação do Servidor é usado.
-2. Adicione uma tabela acima do form addNewWish que exibe os desejos existentes para o wisher. O código é semelhante ao código `wishlist.php` .
+
+[start=2]
+. Adicione uma tabela acima do form addNewWish que exibe os desejos existentes para o wisher. O código é semelhante ao código `wishlist.php` .
*Para o banco de dados MySQL:*
@@ -146,8 +148,12 @@
?>
</table>
----
-3. Crie o arquivo PHP `editWish.php` na pasta Código-fonte.
-4. Em `editWish.php` , implemente o form Adicionar Desejo. Digite ou cole o seguinte código abaixo do bloco <? php?>:
+
+[start=3]
+. Crie o arquivo PHP `editWish.php` na pasta Código-fonte.
+
+[start=4]
+. Em `editWish.php` , implemente o form Adicionar Desejo. Digite ou cole o seguinte código abaixo do bloco <? php?>:
[source,xml]
----
@@ -209,7 +215,9 @@
*Observação:* Em ambos os casos a descrição fica vazia. Há diferença apenas em `dueDate` .
-2. Atualize o form Adicionar Desejo para que os valores de seus campos de entrada sejam recuperados do array `$wish` . Substitua as linhas no form Adicionar Desejo:
+
+[start=2]
+. Atualize o form Adicionar Desejo para que os valores de seus campos de entrada sejam recuperados do array `$wish` . Substitua as linhas no form Adicionar Desejo:
[source,php]
----
@@ -439,17 +447,29 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. Pressione o botão Editar Minha Lista de Desejos. A página `editWishList.php` abre.
+
+[start=2]
+. Pressione o botão Editar Minha Lista de Desejos. A página `editWishList.php` abre.
image::images/edit-wish-list-add-wish.png[]
-3. Pressione o botão Voltar à Página Principal. A página `index.php` abre.
-4. Faça log-in como Tom e pressione o botão Editar Minha Lista de Desejos novamente. A página `editWishList.php` abre.
-5. Pressione o botão Adicionar Desejo. A página `editWish.php` abre. Preencha o form.
+
+[start=3]
+. Pressione o botão Voltar à Página Principal. A página `index.php` abre.
+
+[start=4]
+. Faça log-in como Tom e pressione o botão Editar Minha Lista de Desejos novamente. A página `editWishList.php` abre.
+
+[start=5]
+. Pressione o botão Adicionar Desejo. A página `editWish.php` abre. Preencha o form.
image::images/new-wish.png[]
Pressione o botão Voltar à Lista. A página `editWishList.php` abre, mas o desejo inserido não foi adicionado.
-6. Pressione o botão Adicionar Desejo novamente. A página `editWish.php` abre. Preencha a data de vencimento e deixe a descrição vazia. Pressione o botão Salvar Alterações. A página `editWish.php` exibe o form de entrada com uma mensagem de erro e a data de vencimento preenchida.
-7. Pressione o botão Adicionar Desejo novamente. A página `editWish.php` abre. Preencha o form e pressione o botão Salvar Alterações. A página `editWishList.php` mostra uma lista de desejos atualizada.
+
+[start=6]
+. Pressione o botão Adicionar Desejo novamente. A página `editWish.php` abre. Preencha a data de vencimento e deixe a descrição vazia. Pressione o botão Salvar Alterações. A página `editWish.php` exibe o form de entrada com uma mensagem de erro e a data de vencimento preenchida.
+
+[start=7]
+. Pressione o botão Adicionar Desejo novamente. A página `editWish.php` abre. Preencha o form e pressione o botão Salvar Alterações. A página `editWishList.php` mostra uma lista de desejos atualizada.
image::images/edit-wish-list-updated.png[]
[[_application_source_code_after_the_current_lesson_is_completed]]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ru.asciidoc
index a5db041..5df1d49 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_ru.asciidoc
@@ -101,7 +101,9 @@
Форма содержит поле ввода "Add Wish" типа `submit` . Это поле реализует кнопку "Add Wish". При нажатии кнопки "Add Wish" пользователь перенаправляется на страницу `editWish.php` . Метод запроса к серверу не используется, т.к. данные посредством этой формы не передаются.
-2. Выше формы addNewWish добавьте таблицу, в которой отображаются пожелания данного лица. Этот код сходен с кодом `wishlist.php` .
+
+[start=2]
+. Выше формы addNewWish добавьте таблицу, в которой отображаются пожелания данного лица. Этот код сходен с кодом `wishlist.php` .
*Для базы данных MySQL*
@@ -145,8 +147,12 @@
?>
</table>
----
-3. В папке исходных файлов создайте файл PHP `editWish.php` .
-4. На станице `editWish.php` реализуйте форму "Add Wish". Введите или вставьте следующий код под блоком <? php ? >:
+
+[start=3]
+. В папке исходных файлов создайте файл PHP `editWish.php` .
+
+[start=4]
+. На станице `editWish.php` реализуйте форму "Add Wish". Введите или вставьте следующий код под блоком <? php ? >:
[source,xml]
----
@@ -208,7 +214,9 @@
*Примечание.*В любом случае описание пустое. Единственным отличием является `dueDate` .
-2. Обновите форму "Add Wish" таким образом, чтобы значения ее полей ввода были извлечены из массива `$wish` . Замените строки форме "Add Wish":
+
+[start=2]
+. Обновите форму "Add Wish" таким образом, чтобы значения ее полей ввода были извлечены из массива `$wish` . Замените строки форме "Add Wish":
[source,php]
----
@@ -439,17 +447,29 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. Нажмите кнопку "Edit My Wish List". Откроется страница `editWishList.php` .
+
+[start=2]
+. Нажмите кнопку "Edit My Wish List". Откроется страница `editWishList.php` .
image::images/edit-wish-list-add-wish.png[]
-3. Нажмите кнопку "Back to Main Page". Откроется страница `index.php` .
-4. Войдите в систему под именем "Tom" и снова нажмите кнопку "Edit My Wish List". Откроется страница `editWishList.php` .
-5. Нажмите кнопку "Add Wish". Откроется страница `editWish.php` . Заполните форму.
+
+[start=3]
+. Нажмите кнопку "Back to Main Page". Откроется страница `index.php` .
+
+[start=4]
+. Войдите в систему под именем "Tom" и снова нажмите кнопку "Edit My Wish List". Откроется страница `editWishList.php` .
+
+[start=5]
+. Нажмите кнопку "Add Wish". Откроется страница `editWish.php` . Заполните форму.
image::images/new-wish.png[]
Нажмите кнопку "Back to the List". Откроется страница `editWishList.php` , но новое пожелание в списке отсутствует.
-6. Снова нажмите кнопку "Add Wish". Откроется страница `editWish.php` . Укажите срок выполнения пожелания, а поле описания оставьте пустым. Нажмите кнопку "Save Changes". На странице `editWish.php` отображается форма ввода с сообщением об ошибке и заполненным полем срока выполнения пожелания.
-7. Снова нажмите кнопку "Add Wish". Откроется страница `editWish.php` . Заполните форму и нажмите кнопку "Save Changes". На странице `editWishList.php` отображается обновленный список пожеланий.
+
+[start=6]
+. Снова нажмите кнопку "Add Wish". Откроется страница `editWish.php` . Укажите срок выполнения пожелания, а поле описания оставьте пустым. Нажмите кнопку "Save Changes". На странице `editWish.php` отображается форма ввода с сообщением об ошибке и заполненным полем срока выполнения пожелания.
+
+[start=7]
+. Снова нажмите кнопку "Add Wish". Откроется страница `editWish.php` . Заполните форму и нажмите кнопку "Save Changes". На странице `editWishList.php` отображается обновленный список пожеланий.
image::images/edit-wish-list-updated.png[]
[[_application_source_code_after_the_current_lesson_is_completed]]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_zh_CN.asciidoc
index f5ffb92..6cdcf74 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson6_zh_CN.asciidoc
@@ -102,7 +102,9 @@
窗体包含 `submit` 类型的 "Add Wish" 输入字段。该字段实现 "Add Wish" 按钮。当用户单击 "Add Wish" 时,他们将重定向到 `editWish.php` 页。由于没有通过该窗体传输任何数据,因此,不会使用服务器请求方法。
-2. 在 addNewWish 窗体上面添加一个表以显示许愿者的现有愿望。代码类似于 `wishlist.php` 。
+
+[start=2]
+. 在 addNewWish 窗体上面添加一个表以显示许愿者的现有愿望。代码类似于 `wishlist.php` 。
*对于 MySQL 数据库*:
@@ -147,8 +149,12 @@
?>
</table>
----
-3. 在 "Source Files"(源文件)文件夹中创建 `editWish.php` PHP 文件。
-4. 在 `editWish.php` 中,实现 "Add Wish" 窗体。在 <? php ?> 块下键入或粘贴以下代码:
+
+[start=3]
+. 在 "Source Files"(源文件)文件夹中创建 `editWish.php` PHP 文件。
+
+[start=4]
+. 在 `editWish.php` 中,实现 "Add Wish" 窗体。在 <? php ?> 块下键入或粘贴以下代码:
[source,xml]
----
@@ -210,7 +216,9 @@
*注:*在这两种情况下,说明均为空。唯一的区别是 `dueDate` 。
-2. 更新 "Add Wish" 窗体,以便从 `$wish` 数组中检索其输入字段的值。将 "Add Wish" 窗体中的行:
+
+[start=2]
+. 更新 "Add Wish" 窗体,以便从 `$wish` 数组中检索其输入字段的值。将 "Add Wish" 窗体中的行:
[source,php]
----
@@ -437,17 +445,29 @@
1. 运行应用程序。在 `index.php` 页上,填写以下字段:在 "Username" 字段中输入 "Tom",在 "Password" 字段中输入 "tomcat"。
image::images/user-logon-to-edit-wish-list.png[]
-2. 按 "Edit My Wish List" 按钮。 `editWishList.php` 页打开。
+
+[start=2]
+. 按 "Edit My Wish List" 按钮。 `editWishList.php` 页打开。
image::images/edit-wish-list-add-wish.png[]
-3. 按 "Back to Main Page" 按钮。 `index.php` 页打开。
-4. 以 Tom 身份登录,然后再次按 "Edit My Wish List" 按钮。 `editWishList.php` 页打开。
-5. 按 "Add Wish" 按钮。 `editWish.php` 页打开。填写窗体。
+
+[start=3]
+. 按 "Back to Main Page" 按钮。 `index.php` 页打开。
+
+[start=4]
+. 以 Tom 身份登录,然后再次按 "Edit My Wish List" 按钮。 `editWishList.php` 页打开。
+
+[start=5]
+. 按 "Add Wish" 按钮。 `editWish.php` 页打开。填写窗体。
image::images/new-wish.png[]
按 "Back to the List" 按钮。 `editWishList.php` 页打开,但未添加输入的愿望。
-6. 再次按 "Add Wish" 按钮。 `editWish.php` 页打开。填写截止日期并将说明保留空白。按 "Save Changes" 按钮。 `editWish.php` 页将显示输入窗体,其中包含一条错误消息和填写的截止日期。
-7. 再次按 "Add Wish" 按钮。 `editWish.php` 页打开。填写窗体,然后按 "Save Changes" 按钮。 `editWishList.php` 页将显示更新的愿望列表。
+
+[start=6]
+. 再次按 "Add Wish" 按钮。 `editWish.php` 页打开。填写截止日期并将说明保留空白。按 "Save Changes" 按钮。 `editWish.php` 页将显示输入窗体,其中包含一条错误消息和填写的截止日期。
+
+[start=7]
+. 再次按 "Add Wish" 按钮。 `editWish.php` 页打开。填写窗体,然后按 "Save Changes" 按钮。 `editWishList.php` 页将显示更新的愿望列表。
image::images/edit-wish-list-updated.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7.asciidoc
index 05b3174..7bda4ac 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7.asciidoc
@@ -92,7 +92,9 @@
//The loop is left open
?>
----
-2. Implement the edit button. Add another table cell before the closing </table> tag, with the editWish form. This form contains a button component and a hidden component that sends the value of `$wishID` when the button is clicked. (Code for the MySQL database is shown, but the added code is the same and in the same location for Oracle Database.)
+
+[start=2]
+. Implement the edit button. Add another table cell before the closing </table> tag, with the editWish form. This form contains a button component and a hidden component that sends the value of `$wishID` when the button is clicked. (Code for the MySQL database is shown, but the added code is the same and in the same location for Oracle Database.)
[source,php]
----
@@ -118,7 +120,9 @@
</td>
</table>
----
-3. Change the `while` loop to use link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+alternative syntax+]. This makes it easy to execute HTML blocks inside the `while` loop. In the alternative `while` loop syntax, the opening curly bracket { is replaced by a colon :, and the ending curly bracket } is replaced by the statement `endwhile;` . Replace the opening curly bracket with a colon, delete the closing curly bracket, and add a new PHP block before the closing </table> tag with the `endwhile;` statement. This encorporates the new table cell into the `while` loop. Move the free result/free statement code to after the `endwhile;` statement. (Again, the code for MySQL is shown, but the code change and location is the same for Oracle Database.)
+
+[start=3]
+. Change the `while` loop to use link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+alternative syntax+]. This makes it easy to execute HTML blocks inside the `while` loop. In the alternative `while` loop syntax, the opening curly bracket { is replaced by a colon :, and the ending curly bracket } is replaced by the statement `endwhile;` . Replace the opening curly bracket with a colon, delete the closing curly bracket, and add a new PHP block before the closing </table> tag with the `endwhile;` statement. This encorporates the new table cell into the `while` loop. Move the free result/free statement code to after the `endwhile;` statement. (Again, the code for MySQL is shown, but the code change and location is the same for Oracle Database.)
[source,php]
----
@@ -141,7 +145,9 @@
?>
</table>
----
-4.
+
+[start=4]
+.
Fix the table row syntax. Move the row-closing </tr>\n characters from the due date echo statement to a new echo statement just above the `endwhile;` .
@@ -165,7 +171,9 @@
?>
</table>
----
-5.
+
+[start=5]
+.
The entire table, including the form with the Edit button inside the `while ` loop, now looks like this:
*For the MySQL database:*
@@ -346,7 +354,9 @@
}
----
-2. Add the `get_wish_by_wish_id` function to `db.php` .
+
+[start=2]
+. Add the `get_wish_by_wish_id` function to `db.php` .
*For the MySQL database:*
@@ -373,7 +383,9 @@
return $stid;
}
----
-3. In the main, top PHP block of `editWish.php` , add a condition to the final `else` statement. This is the `else` statement that inserts the wish to the database. Change it to an `else if` statement:
+
+[start=3]
+. In the main, top PHP block of `editWish.php` , add a condition to the final `else` statement. This is the `else` statement that inserts the wish to the database. Change it to an `else if` statement:
[source,php]
----
@@ -384,7 +396,9 @@
exit;
}
----
-4. Type or paste another `else if` statement below the one you just edited:
+
+[start=4]
+. Type or paste another `else if` statement below the one you just edited:
[source,php]
----
@@ -405,18 +419,28 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. Press the Edit My Wish List button. The `editWishList.php` page opens.
+
+[start=2]
+. Press the Edit My Wish List button. The `editWishList.php` page opens.
image::images/edit-wish-list-edit-wish.png[]
-3. Click Edit next to Icecream. The `editWish.php` page opens.
+
+[start=3]
+. Click Edit next to Icecream. The `editWish.php` page opens.
image::images/edit-wish.png[]
-4. Edit the fields and press Back to the List. The `editWishList.php` page opens but the changes are not saved.
-5. Press Edit next to Icecream. Clear the Describe your wish field and press Save Changes. An error message is displayed.
+
+[start=4]
+. Edit the fields and press Back to the List. The `editWishList.php` page opens but the changes are not saved.
+
+[start=5]
+. Press Edit next to Icecream. Clear the Describe your wish field and press Save Changes. An error message is displayed.
image::images/editWishEmptyDescription.png[]
-6. Enter Chocolate icecream in the Describe your wish field and press Save Changes. The `editWishList.php` page opens with the updated list.
+
+[start=6]
+. Enter Chocolate icecream in the Describe your wish field and press Save Changes. The `editWishList.php` page opens with the updated list.
image::images/editWishListWishAdded.png[]
@@ -454,7 +478,9 @@
oci_execute($stid);
}
----
-2. Create a new PHP file named `deleteWish.php` and enter the following code into the <? php ?> block:
+
+[start=2]
+. Create a new PHP file named `deleteWish.php` and enter the following code into the <? php ?> block:
[source,php]
----
@@ -464,7 +490,9 @@
header('Location: editWishList.php' );
----
The code enables the use of the `db.php` file. It then calls the function `delete_wish` from an instance of WishDB, with the `wishID` as the input parameter. Finally, the application is redirected to the `editWishList.php` page.
-3. To implement the Delete button, add another HTML table cell to the `while` loop in `editWishList.php` , directly below the code block for the `editWish` button. The HTML input form contains a hidden field for the `wishID` and a submit button labelled Delete. (Code for the MySQL database is shown, but the added code is the same and in the same location for Oracle Database.)
+
+[start=3]
+. To implement the Delete button, add another HTML table cell to the `while` loop in `editWishList.php` , directly below the code block for the `editWish` button. The HTML input form contains a hidden field for the `wishID` and a submit button labelled Delete. (Code for the MySQL database is shown, but the added code is the same and in the same location for Oracle Database.)
[source,php]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ja.asciidoc
index 1f79ea4..5452cf7 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ja.asciidoc
@@ -92,7 +92,9 @@
//The loop is left open
?>
----
-2. 編集ボタンを実装します。editWishフォームを使用して、終了の</table>タグの前に別の表のセルを追加します。このフォームには、ボタン・コンポーネントと、ボタンがクリックされたときに `$wishID` の値を送信する非表示コンポーネントが含まれています。(MySQLデータベース用のコードが示されていますが、追加されるコードはOracleデータベースの場合も同じで、同じ場所になります。)
+
+[start=2]
+. 編集ボタンを実装します。editWishフォームを使用して、終了の</table>タグの前に別の表のセルを追加します。このフォームには、ボタン・コンポーネントと、ボタンがクリックされたときに `$wishID` の値を送信する非表示コンポーネントが含まれています。(MySQLデータベース用のコードが示されていますが、追加されるコードはOracleデータベースの場合も同じで、同じ場所になります。)
[source,php]
----
@@ -118,7 +120,9 @@
</td>
</table>
----
-3. `while` ループを変更してlink:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+代替構文+]を使用します。これにより、 `while` ループ内のHTMLブロックを実行しやすくなります。代替の `while` ループ構文では、開始の中括弧{がコロン(:)に置き換えられ、終了の中括弧}が `endwhile;` 文に置き換えられます。開始の中括弧をコロンに置き換え、終了の中括弧を削除し、 `endwhile;` 文を使用して終了の</table>タグの前に新しいPHPブロックを追加します。これにより、新しい表のセルが `while` ループに組み込まれます。結果または文を解放するコードを `endwhile;` 文の後に移動します。(ここでも、MySQL用のコードが示されていますが、コード変更および場所はOracleデータベースの場合も同じです。)
+
+[start=3]
+. `while` ループを変更してlink:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+代替構文+]を使用します。これにより、 `while` ループ内のHTMLブロックを実行しやすくなります。代替の `while` ループ構文では、開始の中括弧{がコロン(:)に置き換えられ、終了の中括弧}が `endwhile;` 文に置き換えられます。開始の中括弧をコロンに置き換え、終了の中括弧を削除し、 `endwhile;` 文を使用して終了の</table>タグの前に新しいPHPブロックを追加します。これにより、新しい表のセルが `while` ループに組み込まれます。結果または文を解放するコードを `endwhile;` 文の後に移動します。(ここでも、MySQL用のコードが示されていますが、コード変更および場所はOracleデータベースの場合も同じです。)
[source,php]
----
@@ -141,7 +145,9 @@
?>
</table>
----
-4.
+
+[start=4]
+.
表の行の構文を修正します。行を終了する</tr>\n文字を、期日のecho文から `endwhile;` のすぐ上の新しいecho文に移動します。
@@ -165,7 +171,9 @@
?>
</table>
----
-5.
+
+[start=5]
+.
`while` ループ内に「Edit」ボタンを持つフォームを含む表の全体は、次のようになります。
*MySQLデータベースの場合:*
@@ -348,7 +356,9 @@
}
----
-2.
+
+[start=2]
+.
`get_wish_by_wish_id` 関数を `db.php` に追加します。
*MySQLデータベースの場合:*
@@ -375,7 +385,9 @@
return $stid;
}
----
-3. `editWish.php` のメインとなる先頭のPHPブロックで、最後の`else`文に条件を追加します。これはデータベースにウィッシュを挿入する `else` 文です。これを `else if` 文に変更します。
+
+[start=3]
+. `editWish.php` のメインとなる先頭のPHPブロックで、最後の`else`文に条件を追加します。これはデータベースにウィッシュを挿入する `else` 文です。これを `else if` 文に変更します。
[source,php]
----
@@ -386,7 +398,9 @@
exit;
}
----
-4. 別の `else if` 文を、前に編集した文の下に入力するか、または貼り付けます。
+
+[start=4]
+. 別の `else if` 文を、前に編集した文の下に入力するか、または貼り付けます。
[source,php]
----
@@ -407,20 +421,30 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. 「Edit My Wish List」ボタンを押します。 `editWishList.php` ページが開きます。
+
+[start=2]
+. 「Edit My Wish List」ボタンを押します。 `editWishList.php` ページが開きます。
image::images/edit-wish-list-edit-wish.png[]
-3. 「Icecream」の横の「Edit」をクリックします。 `editWish.php` ページが開きます。
+
+[start=3]
+. 「Icecream」の横の「Edit」をクリックします。 `editWish.php` ページが開きます。
image::images/edit-wish.png[]
-4. フィールドを編集して「Back to the List」を押します。 `editWishList.php` ページが開きますが、変更は保存されていません。
-5. 「Icecream」の横の「Edit」を押します。「Describe your wish」フィールドをクリアして「Save Changes」を押します。エラー・メッセージが表示されます。
+
+[start=4]
+. フィールドを編集して「Back to the List」を押します。 `editWishList.php` ページが開きますが、変更は保存されていません。
+
+[start=5]
+. 「Icecream」の横の「Edit」を押します。「Describe your wish」フィールドをクリアして「Save Changes」を押します。エラー・メッセージが表示されます。
image::images/editWishEmptyDescription.png[]
-6. 「Describe your wish」フィールドに「Chocolate icecream」と入力し、「Save Changes」を押します。 `editWishList.php` ページが開き、更新されたリストが表示されます。
+
+[start=6]
+. 「Describe your wish」フィールドに「Chocolate icecream」と入力し、「Save Changes」を押します。 `editWishList.php` ページが開き、更新されたリストが表示されます。
image::images/editWishListWishAdded.png[]
@@ -458,7 +482,9 @@
oci_execute($stid);
}
----
-2. `deleteWish.php` という名前の新しいPHPファイルを作成し、次のコードを<?php?>ブロック内に入力します。
+
+[start=2]
+. `deleteWish.php` という名前の新しいPHPファイルを作成し、次のコードを<?php?>ブロック内に入力します。
[source,php]
----
@@ -468,7 +494,9 @@
header('Location: editWishList.php' );
----
このコードにより、 `db.php` ファイルが使用できるようになります。入力パラメータとして `wishID` を使用し、WishDBのインスタンスから `delete_wish` 関数をコールします。最後に、アプリケーションが `editWishList.php` ページにリダイレクトされます。
-3. 「Delete」ボタンを実装するには、別のHTML表のセルを、 `editWishList.php` の `while` ループの内部で、 `editWish` ボタンのコード・ブロックのすぐ下に追加します。HTML入力フォームには、 `wishID` 用の非表示フィールドと、「Delete」というラベルが付いた送信ボタンが含まれています。(MySQLデータベース用のコードが示されていますが、追加されるコードはOracleデータベースの場合も同じで、同じ場所になります。)
+
+[start=3]
+. 「Delete」ボタンを実装するには、別のHTML表のセルを、 `editWishList.php` の `while` ループの内部で、 `editWish` ボタンのコード・ブロックのすぐ下に追加します。HTML入力フォームには、 `wishID` 用の非表示フィールドと、「Delete」というラベルが付いた送信ボタンが含まれています。(MySQLデータベース用のコードが示されていますが、追加されるコードはOracleデータベースの場合も同じで、同じ場所になります。)
[source,php]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_pt_BR.asciidoc
index eb288ab..cca60d2 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_pt_BR.asciidoc
@@ -92,7 +92,9 @@
//The loop is left open
?>
----
-2. Implemente o botão Editar. Adicione outra célula à tabela antes de fechar a tag </table> com o form editWish. Esse form contém um componente botão e um componente oculto que envia o valor `$wishID` ao clicar no botão. (O código para o banco de dados MySQL é mostrado, mas o código adicionado é o mesmo, no mesmo local, para o banco de dados Oracle).
+
+[start=2]
+. Implemente o botão Editar. Adicione outra célula à tabela antes de fechar a tag </table> com o form editWish. Esse form contém um componente botão e um componente oculto que envia o valor `$wishID` ao clicar no botão. (O código para o banco de dados MySQL é mostrado, mas o código adicionado é o mesmo, no mesmo local, para o banco de dados Oracle).
[source,php]
----
@@ -119,7 +121,9 @@
</table>
----
-3. Altere o loop `while` para usar a link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+sintaxe alternativa+]. Isso facilita a execução de blocos HTML dentro do loop `while` . Na sintaxe alternativa do loop `while` , as chaves de abertura { são substituídas por dois-pontos : e as chaves de fechamento } são substituídas pela instrução `endwhile;` . Substitua as chaves de abertura por dois-pontos, delete as chaves de fechamento e adicione um novo bloco PHP antes da tag de fechamento </table> com a instrução `endwhile;` . Isso incorpora a nova célula da tabela para o loop `while` . Mova o código instrução livre/resultado para após a instrução `endwhile.` (O código para o MySQL é exibido novamente, mas o código muda e o local é o mesmo para o banco de dados da Oracle).
+
+[start=3]
+. Altere o loop `while` para usar a link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+sintaxe alternativa+]. Isso facilita a execução de blocos HTML dentro do loop `while` . Na sintaxe alternativa do loop `while` , as chaves de abertura { são substituídas por dois-pontos : e as chaves de fechamento } são substituídas pela instrução `endwhile;` . Substitua as chaves de abertura por dois-pontos, delete as chaves de fechamento e adicione um novo bloco PHP antes da tag de fechamento </table> com a instrução `endwhile;` . Isso incorpora a nova célula da tabela para o loop `while` . Mova o código instrução livre/resultado para após a instrução `endwhile.` (O código para o MySQL é exibido novamente, mas o código muda e o local é o mesmo para o banco de dados da Oracle).
[source,php]
----
@@ -142,7 +146,9 @@
?>
</table>
----
-4.
+
+[start=4]
+.
Conserte a sintaxe da linha da tabela. Mova os caracteres de final de linha </tr>\n da instrução de exibição de data de vencimento para a nova instrução logo acima do `endwhile;` .
@@ -166,7 +172,9 @@
?>
</table>
----
-5.
+
+[start=5]
+.
A tabela inteira, incluindo o form com o botão Editar dentro do loop `while ` , agora tem a seguinte aparência:
*Para o banco de dados MySQL:*
@@ -347,7 +355,9 @@
}
----
-2.
+
+[start=2]
+.
Adicione a função `get_wish_by_wish_id` ao `db.php` .
*Para o banco de dados MySQL:*
@@ -375,7 +385,9 @@
return $stid;
}
----
-3. Na parte principal, no bloco PHP superior do `editWish.php` , adicione uma condição para a instrução`else` final. Esta é a instrução `else` que insere o desejo no banco de dados. Trocar para instrução `else if` :
+
+[start=3]
+. Na parte principal, no bloco PHP superior do `editWish.php` , adicione uma condição para a instrução`else` final. Esta é a instrução `else` que insere o desejo no banco de dados. Trocar para instrução `else if` :
[source,php]
----
@@ -386,7 +398,9 @@
exit;
}
----
-4. Digite ou cole outra instrução `else if` abaixo daquela que você acabou de editar:
+
+[start=4]
+. Digite ou cole outra instrução `else if` abaixo daquela que você acabou de editar:
[source,php]
----
@@ -407,20 +421,30 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. Pressione o botão Editar Minha Lista de Desejos. A página `editWishList.php` abre.
+
+[start=2]
+. Pressione o botão Editar Minha Lista de Desejos. A página `editWishList.php` abre.
image::images/edit-wish-list-edit-wish.png[]
-3. Clique em Editar ao lado de Icecream. A página `editWish.php` abre.
+
+[start=3]
+. Clique em Editar ao lado de Icecream. A página `editWish.php` abre.
image::images/edit-wish.png[]
-4. Edite os campos e pressione Voltar à Lista. A página `editWishList.php` abre, mas as alterações não são salvas.
-5. Pressione Editar ao lado de Icecream. Limpe o campo Descreva seu desejo e pressione Salvar Alterações. Uma mensagem de erro é exibida.
+
+[start=4]
+. Edite os campos e pressione Voltar à Lista. A página `editWishList.php` abre, mas as alterações não são salvas.
+
+[start=5]
+. Pressione Editar ao lado de Icecream. Limpe o campo Descreva seu desejo e pressione Salvar Alterações. Uma mensagem de erro é exibida.
image::images/editWishEmptyDescription.png[]
-6. Insira Chocolate Icecream no campo Descreva seu desejo e pressione Salvar Alterações. A página `editWishList.php` abre com uma lista atualizada.
+
+[start=6]
+. Insira Chocolate Icecream no campo Descreva seu desejo e pressione Salvar Alterações. A página `editWishList.php` abre com uma lista atualizada.
image::images/editWishListWishAdded.png[]
@@ -458,7 +482,9 @@
oci_execute($stid);
}
----
-2. Crie um novo arquivo PHP chamado `deleteWish.php` e insira o seguinte código no <? php?>:
+
+[start=2]
+. Crie um novo arquivo PHP chamado `deleteWish.php` e insira o seguinte código no <? php?>:
[source,php]
----
@@ -468,7 +494,9 @@
header('Location: editWishList.php' );
----
O código permite o uso do arquivo `db.php` . Em seguida, ele chama a função `delete_wish` a partir de uma instância do WishDB, com o `wishID` como o parâmetro de entrada. Finalmente, a aplicação é redirecionada para a página `editWishList.php` .
-3. Para implementar o botão Deletar, adicione outra célula da tabela ao loop `while` no `editWishList.php` , diretamente abaixo do código do bloco para o botão `editWish` . O form de entrada HTML contém um campo oculto para `wishID` e um botão de envio chamado Deletar. (O código para o banco de dados MySQL é mostrado, mas o código adicionado é o mesmo, no mesmo local, para o banco de dados Oracle).
+
+[start=3]
+. Para implementar o botão Deletar, adicione outra célula da tabela ao loop `while` no `editWishList.php` , diretamente abaixo do código do bloco para o botão `editWish` . O form de entrada HTML contém um campo oculto para `wishID` e um botão de envio chamado Deletar. (O código para o banco de dados MySQL é mostrado, mas o código adicionado é o mesmo, no mesmo local, para o banco de dados Oracle).
[source,php]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ru.asciidoc
index fd2619c..62dfefe 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_ru.asciidoc
@@ -93,7 +93,9 @@
//The loop is left open
?>
----
-2. Создайте кнопку правки. С помощью формы editWish добавьте еще одну ячейку таблицы перед закрывающим тегом </table>. Эта форма содержит компонент кнопки и скрытый компонент, который при нажатии кнопки отправляет значение `$wishID` . (Показан код для базы данных MySQL, но добавлен тот же код и в то же место, что и для базы данных Oracle.)
+
+[start=2]
+. Создайте кнопку правки. С помощью формы editWish добавьте еще одну ячейку таблицы перед закрывающим тегом </table>. Эта форма содержит компонент кнопки и скрытый компонент, который при нажатии кнопки отправляет значение `$wishID` . (Показан код для базы данных MySQL, но добавлен тот же код и в то же место, что и для базы данных Oracle.)
[source,php]
----
@@ -119,7 +121,9 @@
</td>
</table>
----
-3. Измените цикл `while` , чтобы использовать link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+альтернативный синтаксис+]. Это облегчает выполнение блоков HTML внутри цикла `while` . В альтернативном синтаксисе цикла `while` открывающая фигурная скобка "{" заменяется двоеточием ":", а завершающая фигурная скобка "}" заменяется оператором `endwhile;` . Замените открывающую фигурную скобку двоеточием, удалите закрывающую фигурную скобку и перед закрывающим тегом </table> добавьте новый блок PHP с оператором `endwhile;` . Это приводит к добавлению новой ячейки таблицы в цикле `while` . Переместите код оператора free result/free на место после оператора `endwhile;` . (И вновь приведен код для MySQL, но изменение кода и его местоположение точно такие же, как для базы данных Oracle.)
+
+[start=3]
+. Измените цикл `while` , чтобы использовать link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+альтернативный синтаксис+]. Это облегчает выполнение блоков HTML внутри цикла `while` . В альтернативном синтаксисе цикла `while` открывающая фигурная скобка "{" заменяется двоеточием ":", а завершающая фигурная скобка "}" заменяется оператором `endwhile;` . Замените открывающую фигурную скобку двоеточием, удалите закрывающую фигурную скобку и перед закрывающим тегом </table> добавьте новый блок PHP с оператором `endwhile;` . Это приводит к добавлению новой ячейки таблицы в цикле `while` . Переместите код оператора free result/free на место после оператора `endwhile;` . (И вновь приведен код для MySQL, но изменение кода и его местоположение точно такие же, как для базы данных Oracle.)
[source,php]
----
@@ -137,7 +141,9 @@
?>*
</table>
----
-4.
+
+[start=4]
+.
Исправьте синтаксис для строки таблицы. Переместите закрывающие строку символы </tr>\n из оператора echo для срока выполнения в новый оператор echo непосредственно над оператором `endwhile;` .
@@ -161,7 +167,9 @@
?>
</table>
----
-5.
+
+[start=5]
+.
Код для таблицы, включая форму с кнопкой "Edit" (Изменить), в цикле `while ` выглядит следующим образом.
*Для базы данных MySQL*
@@ -340,7 +348,9 @@
}
----
-2.
+
+[start=2]
+.
Добавьте функцию `get_wish_by_wish_id` к `db.php` .
*Для базы данных MySQL*
@@ -367,7 +377,9 @@
return $stid;
}
----
-3. В главный метод, в верхний блок PHP файла `editWish.php` , добавьте условие к последнему оператору `else`. Именно этот оператор `else` вставляет пожелание в базу данных. Замените его на оператор `else if` :
+
+[start=3]
+. В главный метод, в верхний блок PHP файла `editWish.php` , добавьте условие к последнему оператору `else`. Именно этот оператор `else` вставляет пожелание в базу данных. Замените его на оператор `else if` :
[source,php]
----
@@ -378,7 +390,9 @@
exit;
}
----
-4. Введите или вставьте другой оператор `else if` после только что отредактированного:
+
+[start=4]
+. Введите или вставьте другой оператор `else if` после только что отредактированного:
[source,php]
----
@@ -399,20 +413,30 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. Нажмите кнопку "Edit My Wish List". Откроется страница `editWishList.php` .
+
+[start=2]
+. Нажмите кнопку "Edit My Wish List". Откроется страница `editWishList.php` .
image::images/edit-wish-list-edit-wish.png[]
-3. Нажмите кнопку "Edit" рядом с пожеланием "Icecream". Откроется страница `editWish.php` .
+
+[start=3]
+. Нажмите кнопку "Edit" рядом с пожеланием "Icecream". Откроется страница `editWish.php` .
image::images/edit-wish.png[]
-4. Отредактируйте поля и нажмите кнопку "Back to the List". Откроется страница `editWishList.php` , однако изменения не сохранены.
-5. Нажмите кнопку "Edit" рядом с "Icecream". Очистите поле "Describe your wish" и нажмите кнопку "Save Changes". Появится сообщение об ошибке.
+
+[start=4]
+. Отредактируйте поля и нажмите кнопку "Back to the List". Откроется страница `editWishList.php` , однако изменения не сохранены.
+
+[start=5]
+. Нажмите кнопку "Edit" рядом с "Icecream". Очистите поле "Describe your wish" и нажмите кнопку "Save Changes". Появится сообщение об ошибке.
image::images/editWishEmptyDescription.png[]
-6. Введите "Chocolate icecream" в поле "Describe your wish" и нажмите "Save Changes". Откроется страница `editWishList.php` с обновленным списком пожеланий.
+
+[start=6]
+. Введите "Chocolate icecream" в поле "Describe your wish" и нажмите "Save Changes". Откроется страница `editWishList.php` с обновленным списком пожеланий.
image::images/editWishListWishAdded.png[]
@@ -450,7 +474,9 @@
oci_execute($stid);
}
----
-2. Создайте новый файл PHP с именем `deleteWish.php` и введите следующий код в блок <? php ? >:
+
+[start=2]
+. Создайте новый файл PHP с именем `deleteWish.php` и введите следующий код в блок <? php ? >:
[source,java]
----
@@ -458,7 +484,9 @@
require_once("Includes/db.php");WishDB::getInstance()->delete_wish ($_POST["wishID"]);header('Location: `editWishList.php` ' );
----
Код обращается к файлу `db.php` . Затем выполняется вызов функции `delete_wish` из экземпляра WishDB со значением `wishID` в качестве входного параметра. Наконец, выполняется перенаправление на страницу `editWishList.php` .
-3. Для реализации кнопки "Delete" (Удалить) добавьте еще одну ячейку таблицы HTML к циклу `while` в файле `editWishList.php` , непосредственно ниже блока кода для кнопки `editWish` . Форма ввода HTML содержит скрытое поле для `wishID` и кнопу отправки данных с надписью "Delete". (Показан код для базы данных MySQL, но добавлен тот же код и в то же место, что и для базы данных Oracle.)
+
+[start=3]
+. Для реализации кнопки "Delete" (Удалить) добавьте еще одну ячейку таблицы HTML к циклу `while` в файле `editWishList.php` , непосредственно ниже блока кода для кнопки `editWish` . Форма ввода HTML содержит скрытое поле для `wishID` и кнопу отправки данных с надписью "Delete". (Показан код для базы данных MySQL, но добавлен тот же код и в то же место, что и для базы данных Oracle.)
[source,php]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_zh_CN.asciidoc
index bc12603..8c9a09d 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson7_zh_CN.asciidoc
@@ -93,7 +93,9 @@
//The loop is left open
?>
----
-2. 实现 "Edit" 按钮。在结束 </table> 标记前面,使用 editWish 窗体添加另一个窗体元格。该窗体包含一个按钮组件和一个隐藏组件;在单击该按钮时,该隐藏组件将发送 `$wishID` 值。(显示的是 MySQL 数据库代码,但为 Oracle 数据库添加的代码是相同的并位于相同的位置。)
+
+[start=2]
+. 实现 "Edit" 按钮。在结束 </table> 标记前面,使用 editWish 窗体添加另一个窗体元格。该窗体包含一个按钮组件和一个隐藏组件;在单击该按钮时,该隐藏组件将发送 `$wishID` 值。(显示的是 MySQL 数据库代码,但为 Oracle 数据库添加的代码是相同的并位于相同的位置。)
[source,php]
----
@@ -119,7 +121,9 @@
</td>
</table>
----
-3. 更改 `while` 循环以使用link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+替代语法+]。这可简化在 `while` 循环中执行 HTML 块的过程。在替代 `while` 循环语法中,左花括号 { 将替换为冒号 (:),右花括号 } 将替换为 `endwhile;` 语句。将左花括号替换为冒号,删除右花括号,然后在结束 </table> 标记前面使用 `endwhile;` 语句添加一个新 PHP 块。这会将新表单元格包含在 `while` 循环中。将释放结果/释放语句代码移到 `endwhile;` 语句后面。(同样,显示的是 MySQL 数据库代码,但 Oracle 数据库的代码更改和位置是相同的。)
+
+[start=3]
+. 更改 `while` 循环以使用link:http://www.php.net/manual/en/control-structures.alternative-syntax.php[+替代语法+]。这可简化在 `while` 循环中执行 HTML 块的过程。在替代 `while` 循环语法中,左花括号 { 将替换为冒号 (:),右花括号 } 将替换为 `endwhile;` 语句。将左花括号替换为冒号,删除右花括号,然后在结束 </table> 标记前面使用 `endwhile;` 语句添加一个新 PHP 块。这会将新表单元格包含在 `while` 循环中。将释放结果/释放语句代码移到 `endwhile;` 语句后面。(同样,显示的是 MySQL 数据库代码,但 Oracle 数据库的代码更改和位置是相同的。)
[source,php]
----
@@ -142,7 +146,9 @@
?>
</table>
----
-4.
+
+[start=4]
+.
修复表行语法。将行结束 </tr>\n 字符从截止日期回显语句移到新回显语句(紧靠 `endwhile;` 上面)。
@@ -166,7 +172,9 @@
?>
</table>
----
-5.
+
+[start=5]
+.
整个表(包括将 "Edit" 按钮放在 `while` 循环内的窗体)现在显示如下:
*对于 MySQL 数据库:*
@@ -348,7 +356,9 @@
}
----
-2.
+
+[start=2]
+.
将 `get_wish_by_wish_id` 函数添加到 `db.php` 中。
*对于 MySQL 数据库:*
@@ -376,7 +386,9 @@
return $stid;
}
----
-3. 在 `editWish.php` 顶部的主 PHP 块中,在最终的 `else` 语句中添加一个条件。这是将愿望插入到数据库的 `else` 语句。将其更改为 `else if` 语句:
+
+[start=3]
+. 在 `editWish.php` 顶部的主 PHP 块中,在最终的 `else` 语句中添加一个条件。这是将愿望插入到数据库的 `else` 语句。将其更改为 `else if` 语句:
[source,php]
----
@@ -387,7 +399,9 @@
exit;
}
----
-4. 在刚编辑的语句下面,键入或粘贴另一个 `else if` 语句:
+
+[start=4]
+. 在刚编辑的语句下面,键入或粘贴另一个 `else if` 语句:
[source,php]
----
@@ -408,20 +422,30 @@
image::images/user-logon-to-edit-wish-list.png[]
-2. 按 "Edit My Wish List" 按钮。 `editWishList.php` 页打开。
+
+[start=2]
+. 按 "Edit My Wish List" 按钮。 `editWishList.php` 页打开。
image::images/edit-wish-list-edit-wish.png[]
-3. 单击 Icecream 旁边的 "Edit"。 `editWish.php` 页打开。
+
+[start=3]
+. 单击 Icecream 旁边的 "Edit"。 `editWish.php` 页打开。
image::images/edit-wish.png[]
-4. 编辑这些字段,然后按 "Back to the List"。 `editWishList.php` 页打开,但未保存更改。
-5. 按 Icecream 旁边的 "Edit"。清除 "Describe your wish" 字段,然后按 "Save Changes"。将显示一条错误消息。
+
+[start=4]
+. 编辑这些字段,然后按 "Back to the List"。 `editWishList.php` 页打开,但未保存更改。
+
+[start=5]
+. 按 Icecream 旁边的 "Edit"。清除 "Describe your wish" 字段,然后按 "Save Changes"。将显示一条错误消息。
image::images/editWishEmptyDescription.png[]
-6. 在 "Describe your wish" 字段中输入 Chocolate icecream,然后按 "Save Changes"。 `editWishList.php` 页打开,并更新列表。
+
+[start=6]
+. 在 "Describe your wish" 字段中输入 Chocolate icecream,然后按 "Save Changes"。 `editWishList.php` 页打开,并更新列表。
image::images/editWishListWishAdded.png[]
@@ -459,7 +483,9 @@
oci_execute($stid);
}
----
-2. 创建一个名为 `deleteWish.php` 的新 PHP 文件,然后在 <? php ?> 块下键入或粘贴以下代码:
+
+[start=2]
+. 创建一个名为 `deleteWish.php` 的新 PHP 文件,然后在 <? php ?> 块下键入或粘贴以下代码:
[source,php]
----
@@ -469,7 +495,9 @@
header('Location: editWishList.php' );
----
该代码允许使用 `db.php` 文件。然后,它会从 WishDB 实例中调用 `delete_wish` 函数,并将 `wishID` 作为输入参数。最后,应用程序将重定向到 `editWishList.php` 页。
-3. 要实现 "Delete" 按钮,请在 `editWishList.php` 的 `while` 循环中添加另一个 HTML 表单元格,紧靠 `editWish` 按钮的代码块下面。HTML 输入窗体包含 `wishID` 隐藏字段以及一个标记为 "Delete" 的提交按钮。(显示的是 MySQL 数据库代码,但为 Oracle 数据库添加的代码是相同的并位于相同的位置。)
+
+[start=3]
+. 要实现 "Delete" 按钮,请在 `editWishList.php` 的 `while` 循环中添加另一个 HTML 表单元格,紧靠 `editWish` 按钮的代码块下面。HTML 输入窗体包含 `wishID` 隐藏字段以及一个标记为 "Delete" 的提交按钮。(显示的是 MySQL 数据库代码,但为 Oracle 数据库添加的代码是相同的并位于相同的位置。)
[source,php]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8.asciidoc
index e1a9b22..b34275d 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8.asciidoc
@@ -113,7 +113,9 @@
else echo "visible";?>">
----
The `style` attribute defines whether the form is hidden or visible. The <?php ?> block is used to keep the form visible until the user logs on successfully.
-2. Enter the following code above the logon input form code:
+
+[start=2]
+. Enter the following code above the logon input form code:
[source,php]
----
@@ -121,7 +123,9 @@
<input type="submit" name="myWishList" value="My Wishlist"> onclick="javascript:showHideLogonForm()"/>
----
The code implements a button with the text "My Wishlist >>". The button stands in place of the logon form. Pressing the button calls the showHideLogonForm function.
-3. Add a `style` attribute to the wishList form:
+
+[start=3]
+. Add a `style` attribute to the wishList form:
[source,xml]
----
@@ -131,14 +135,18 @@
<input type="submit" value="Go" />
</form>
----
-4. Enter the following code above the wishList form:
+
+[start=4]
+. Enter the following code above the wishList form:
[source,xml]
----
<input type="submit" name="showWishList" value="Show Wish List of" onclick="javascript:showHideShowWishListForm()"/>
----
-5. Remove the following code from the form because it is already placed on the button:
+
+[start=5]
+. Remove the following code from the form because it is already placed on the button:
[source,php]
----
@@ -186,7 +194,9 @@
<link href="wishlist.css" type="text/css" rel="stylesheet" media="all" />
----
The styles "body" and "input" are automatically applied inside the corresponding tags so you do need to indicate them explicitly.
-2. To apply any other style (class) to an area, enclose the code that implements the area in the `<div class=""></div>` tags:
+
+[start=2]
+. To apply any other style (class) to an area, enclose the code that implements the area in the `<div class=""></div>` tags:
[source,html]
----
@@ -203,7 +213,9 @@
NOTE: When a class is specified within a <div> tag, no dot is required in preposition.
-3. You can use embedded <div> tags:
+
+[start=3]
+. You can use embedded <div> tags:
[source,html]
----
@@ -245,4 +257,4 @@
link:wish-list-lesson9.html[+Next lesson >>+]
-link:wish-list-tutorial-main-page.html[+Back to the Tutorial main page+]
\ No newline at end of file
+link:wish-list-tutorial-main-page.html[+Back to the Tutorial main page+]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ja.asciidoc
index e503603..974e437 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ja.asciidoc
@@ -112,7 +112,9 @@
else echo "visible";?>">
----
`style` 属性は、フォームが非表示か可視かを定義します。<?php?>ブロックは、ユーザーが正常にログオンするまでフォームを可視のままにするために使用されます。
-2. ログオン入力フォーム・コードの上に、次のコードを入力します。
+
+[start=2]
+. ログオン入力フォーム・コードの上に、次のコードを入力します。
[source,php]
----
@@ -120,7 +122,9 @@
<input type="submit" name="myWishList" value="My Wishlist"> onclick="javascript:showHideLogonForm()"/>
----
このコードは、「My Wishlist >>」というテキストを持つボタンを実装します。ログオン・フォームのかわりにボタンが表示されます。ボタンを押すと、showHideLogonForm関数がコールされます。
-3. wishListフォームに `style` 属性を追加します。
+
+[start=3]
+. wishListフォームに `style` 属性を追加します。
[source,xml]
----
@@ -130,14 +134,18 @@
<input type="submit" value="Go" />
</form>
----
-4. wishListフォームの上に、次のコードを入力します。
+
+[start=4]
+. wishListフォームの上に、次のコードを入力します。
[source,xml]
----
<input type="submit" name="showWishList" value="Show Wish List of" onclick="javascript:showHideShowWishListForm()"/>
----
-5. 次のコードはすでにボタンにあるので、フォームから除去します。
+
+[start=5]
+. 次のコードはすでにボタンにあるので、フォームから除去します。
[source,php]
----
@@ -185,7 +193,9 @@
<link href="wishlist.css" type="text/css" rel="stylesheet" media="all" />
----
スタイル「body」と「input」は対応するタグ内に自動的に適用されるため、明示的に指定する必要はありません。
-2. 別のスタイル(クラス)を領域に適用するには、領域を実装するコードを `<div class=""></div>` タグで囲みます。
+
+[start=2]
+. 別のスタイル(クラス)を領域に適用するには、領域を実装するコードを `<div class=""></div>` タグで囲みます。
[source,html]
----
@@ -202,7 +212,9 @@
*注意:* クラスが<div>タグの内部で指定されている場合、前にドットを置く必要はありません。
-3. 次の埋込み<div>タグを使用できます。
+
+[start=3]
+. 次の埋込み<div>タグを使用できます。
[source,html]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_pt_BR.asciidoc
index aa45d9e..66396c4 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_pt_BR.asciidoc
@@ -114,7 +114,9 @@
else echo "visible";?>">
----
O atributo `style` define se o form está oculto ou visível. O bloco <?php ?> é usado para manter o form visível até que o usuário efetue log-in com êxito.
-2. Digite o seguinte código acima do código do form de entrada de log-in:
+
+[start=2]
+. Digite o seguinte código acima do código do form de entrada de log-in:
[source,php]
----
@@ -122,7 +124,9 @@
<input type="submit" name="myWishList" value="My Wishlist"> onclick="javascript:showHideLogonForm()"/>
----
O código implementa um botão com o texto "My Wishlist >>". O botão fica no lugar do form de log-in. Se você pressionar o botão, a função showHideLog-inForm será chamada.
-3. Adicione um atributo `style` ao form wishList:
+
+[start=3]
+. Adicione um atributo `style` ao form wishList:
[source,xml]
----
@@ -132,14 +136,18 @@
<input type="submit" value="Go" />
</form>
----
-4. Digite o seguinte código acima do form WishList:
+
+[start=4]
+. Digite o seguinte código acima do form WishList:
[source,xml]
----
<input type="submit" name="showWishList" value="Show Wish List of" onclick="javascript:showHideShowWishListForm()"/>
----
-5. Remova o seguinte código do form porque ele já foi colocado no botão:
+
+[start=5]
+. Remova o seguinte código do form porque ele já foi colocado no botão:
[source,php]
----
@@ -187,7 +195,9 @@
<link href="wishlist.css" type="text/css" rel="stylesheet" media="all" />
----
Os estilos "body" e "input" são aplicados automaticamente dentro das tags correspondentes, assim, você precisa indicá-los explicitamente.
-2. Para aplicar outro estilo (classe) em uma área, circunde o código que implementa a área com as tags `<div class=""></div>` :
+
+[start=2]
+. Para aplicar outro estilo (classe) em uma área, circunde o código que implementa a área com as tags `<div class=""></div>` :
[source,html]
----
@@ -204,7 +214,9 @@
*Observação:*quando uma classe é especificada dentro de uma tag <div> , não é necessário um ponto na frente.
-3. Você pode usar tags <div> incorporadas:
+
+[start=3]
+. Você pode usar tags <div> incorporadas:
[source,html]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ru.asciidoc
index 28166bd..754b331 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_ru.asciidoc
@@ -111,7 +111,9 @@
else echo "visible";?>">
----
Атрибут `style` определяет, является форма скрытой или нет. Блок <?php ? > используется для поддержания отображения формы до тех пор, пока не будет выполнен успешный ввод данных пользователем.
-2. Введите следующий код перед кодом формы ввода "logon":
+
+[start=2]
+. Введите следующий код перед кодом формы ввода "logon":
[source,php]
----
@@ -119,7 +121,9 @@
<input type="submit" name="myWishList" value="My Wishlist"> onclick="javascript:showHideLogonForm()"/>
----
Код реализует кнопку с текстом "My Wishlist >>". Кнопка отображается вместо формы "logon". При нажатии кнопки вызывается функция "showHideLogonForm".
-3. Добавьте атрибут `style` к форме "logon":
+
+[start=3]
+. Добавьте атрибут `style` к форме "logon":
[source,xml]
----
@@ -129,14 +133,18 @@
<input type="submit" value="Go" />
</form>
----
-4. Вставьте следующий код над формой wishList:
+
+[start=4]
+. Вставьте следующий код над формой wishList:
[source,xml]
----
<input type="submit" name="showWishList" value="Show Wish List of" onclick="javascript:showHideShowWishListForm()"/>
----
-5. Удалите следующий код из формы, так как он уже помещен в кнопку:
+
+[start=5]
+. Удалите следующий код из формы, так как он уже помещен в кнопку:
[source,php]
----
@@ -184,7 +192,9 @@
<link href="wishlist.css" type="text/css" rel="stylesheet" media="all" />
----
Стили "body" и "input" автоматически применяются внутри соответствующих тегов, поэтому их необходимо указать явно.
-2. Для применения любого другого стиля (класса) к области заключите код, который реализует область, в теги `<div class=""></div>` :
+
+[start=2]
+. Для применения любого другого стиля (класса) к области заключите код, который реализует область, в теги `<div class=""></div>` :
[source,html]
----
@@ -201,7 +211,9 @@
*Примечание.* Если класс указывается в теге <div>, в начале не нужно указывать точки.
-3. Можно использовать вложенные теги <div>:
+
+[start=3]
+. Можно использовать вложенные теги <div>:
[source,html]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_zh_CN.asciidoc
index 1c721e0..490446c 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson8_zh_CN.asciidoc
@@ -110,7 +110,9 @@
<input type="submit" name="myWishList" value="My Wishlist"> onclick="javascript:showHideLogonForm()"/>
----
`style` 属性定义了是隐藏还是显示窗体。<?php ?> 块用于将窗体保持可见,直至用户成功登录。
-2. 在登录输入窗体代码上方输入以下代码:
+
+[start=2]
+. 在登录输入窗体代码上方输入以下代码:
[source,php]
----
@@ -118,7 +120,9 @@
<input type="submit" name="myWishList" value="My Wishlist"> onclick="javascript:showHideLogonForm()"/>
----
该代码实现一个包含 "My Wishlist >>" 文本的按钮。该按钮位于登录窗体所在的位置。如果按下该按钮,则会调用 showHideLogonForm 函数。
-3. 在 wishList 窗体中添加一个 `style` 属性:
+
+[start=3]
+. 在 wishList 窗体中添加一个 `style` 属性:
[source,xml]
----
@@ -128,14 +132,18 @@
<input type="submit" value="Go" />
</form>
----
-4. 在 wishList 窗体上方输入以下代码:
+
+[start=4]
+. 在 wishList 窗体上方输入以下代码:
[source,xml]
----
<input type="submit" name="showWishList" value="Show Wish List of" onclick="javascript:showHideShowWishListForm()"/>
----
-5. 从窗体中删除以下代码,因为它已位于按钮上:
+
+[start=5]
+. 从窗体中删除以下代码,因为它已位于按钮上:
[source,php]
----
@@ -183,7 +191,9 @@
<link href="wishlist.css" type="text/css" rel="stylesheet" media="all" />
----
将在相应标记内自动应用 "body" 和 "input" 样式,因此,您不需要明确指定这些样式。
-2. 要将任何其他样式(类)应用于某个区域,请将实现该区域的代码包含在 `<div class=""></div>` 标记内:
+
+[start=2]
+. 要将任何其他样式(类)应用于某个区域,请将实现该区域的代码包含在 `<div class=""></div>` 标记内:
[source,html]
----
@@ -200,7 +210,9 @@
*注:*在 <div> 标记中指定类时,不需要在前面添加圆点。
-3. 您可以使用嵌入式 <div> 标记:
+
+[start=3]
+. 您可以使用嵌入式 <div> 标记:
[source,html]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ja.asciidoc
index 2b5586f..29f0b43 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ja.asciidoc
@@ -120,7 +120,9 @@
3. link:project-setup.html#importSources[+既存のソースを使用したPHPプロジェクト+]を作成するには:
* ソース・フォルダのダウンロード済ソースの場所を指定する
* link:project-setup.html#remiteWebSite[+リモートWebサイト+]の実行構成を選択し、FTP接続を構成する
-4. プロジェクトの作成を完了します。
+
+[start=4]
+. プロジェクトの作成を完了します。
== クラスWishDBの更新
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_pt_BR.asciidoc
index 581b3b7..5031399 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_pt_BR.asciidoc
@@ -119,7 +119,9 @@
3. Crie um link:project-setup.html#importSources[+projeto PHP com códigos-fonte existentes+]:
* Especifique o local dos códigos-fonte dos quais fez download na pasta Source
* Escolha a configuração de execução link:project-setup.html#remiteWebSite[+Web Site Remoto+] e configure a conexão FTP
-4. Conclua a criação do projeto.
+
+[start=4]
+. Conclua a criação do projeto.
== Atualizando a Classe WishDB
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ru.asciidoc
index 47d2a55..94403b1 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_ru.asciidoc
@@ -119,7 +119,9 @@
3. Создайте проект PHP link:project-setup.html#importSources[+ с существующими исходными файлами+]:
* Укажите местоположение загруженных исходных файлов в папке в "Source".
* Выберите настройку выполнения link:project-setup.html#remiteWebSite[+Удаленный веб-сайт+] и настройте подключение по FTP.
-4. Завершите создание проекта.
+
+[start=4]
+. Завершите создание проекта.
== Обновление класса WishDB
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_zh_CN.asciidoc
index 5f18384..745fb30 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-lesson9_zh_CN.asciidoc
@@ -120,7 +120,9 @@
3. 创建link:project-setup.html#importSources[+基于现有源代码的 PHP 项目+]:
* 指定下载的源代码在“源”文件夹中的位置
* 选择link:project-setup.html#remiteWebSite[+远程 Web 站点+]运行配置并配置 FTP 连接
-4. 完成项目创建。
+
+[start=4]
+. 完成项目创建。
== 更新 WishDB 类
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1.asciidoc
index 02b984c..b435f20 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1.asciidoc
@@ -118,21 +118,27 @@
If you are connecting through NetBeans IDE, create a connection with the new user's name and password. Be certain to select the schema with the same name as the user. (See the link:../ide/oracle-db.html#connect[+Establishing a Connection to Oracle DB+] section of the Connecting to an Oracle Database tutorial.)
-2. To create the wishers table, run the following SQL query:
+
+[start=2]
+. To create the wishers table, run the following SQL query:
[source,sql]
----
create table wishers (id number not null,name varchar2(50) unique not null, password varchar2(50) not null, constraint wishers_pk primary key(id));
----
-3. To create the wishes table. run the following SQL query. Note that you create a foreign key, to associate wishes with a wisher.
+
+[start=3]
+. To create the wishes table. run the following SQL query. Note that you create a foreign key, to associate wishes with a wisher.
[source,sql]
----
create table wishes (id number not null, wisher_id number not null,description varchar2(255) not null, due_date date, constraint wishes_pk primary key(id), constraint wishes_fk1 foreign key(wisher_id) references wishers(id));
----
-4. Verify that the new tables are added to the database. If you are using NetBeans IDE to connect to the database, go to the Services window to the jdbc:oracle:thin:@localhost:1521:XE [phpuser on PHPUSER] connection node. The new tables are listed in the Tables node. (If they do not appear, right-click the connection and choose Refresh.)
+
+[start=4]
+. Verify that the new tables are added to the database. If you are using NetBeans IDE to connect to the database, go to the Services window to the jdbc:oracle:thin:@localhost:1521:XE [phpuser on PHPUSER] connection node. The new tables are listed in the Tables node. (If they do not appear, right-click the connection and choose Refresh.)
image::images/tables-in-services-window.png[]
@@ -150,7 +156,9 @@
create sequence wishers_id_seq start with 1 increment by 1;
----
-2. To trigger the sequence on the ID column of the wishers table when you add a new wisher, run the following SQL command:
+
+[start=2]
+. To trigger the sequence on the ID column of the wishers table when you add a new wisher, run the following SQL command:
[source,sql]
----
@@ -163,14 +171,18 @@
end;
/
----
-3. Add a sequence for the wishes table.
+
+[start=3]
+. Add a sequence for the wishes table.
[source,sql]
----
create sequence wishes_id_seq start with 1 increment by 1;
----
-4. Add a trigger to run the sequence on the ID column of the wishes table when you add a new wish.
+
+[start=4]
+. Add a trigger to run the sequence on the ID column of the wishes table when you add a new wish.
[source,sql]
----
@@ -198,14 +210,18 @@
insert into wishers (name, password) values ('Tom','tomcat');
----
-2. Add a wisher named Jerry, with the password 'jerrymouse.'
+
+[start=2]
+. Add a wisher named Jerry, with the password 'jerrymouse.'
[source,sql]
----
insert into wishers (name, password) values ('Jerry', 'jerrymouse');commit;
----
-3. Add the wishes.
+
+[start=3]
+. Add the wishes.
[source,sql]
----
@@ -215,7 +231,9 @@
insert into wishes (wisher_id, description)values (2, 'Candle');
commit;
----
-4. Verify that you added test data. If you are using NetBeans IDE to view the test data, click the right mouse button on the relevant table and from the context menu choose View Data.
+
+[start=4]
+. Verify that you added test data. If you are using NetBeans IDE to view the test data, click the right mouse button on the relevant table and from the context menu choose View Data.
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ja.asciidoc
index 010121f..1f0e789 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ja.asciidoc
@@ -119,21 +119,27 @@
NetBeans IDE経由で接続する場合、新しいユーザーの名前とパスワードを使用して接続を作成します。ユーザーと同じ名前を持つスキーマを選択するようにします。(Oracleデータベースへの接続チュートリアルのlink:../ide/oracle-db.html#connect[+Oracleデータベースへの接続の確立+]の項を参照。)
-2. wishers表を作成するには、次のSQL問合せを実行します。
+
+[start=2]
+. wishers表を作成するには、次のSQL問合せを実行します。
[source,sql]
----
create table wishers (id number not null,name varchar2(50) unique not null, password varchar2(50) not null, constraint wishers_pk primary key(id));
----
-3. wishes表を作成するには、次のSQL問合せを実行します。wishesとwisherを関連付けるために、外部キーを作成します。
+
+[start=3]
+. wishes表を作成するには、次のSQL問合せを実行します。wishesとwisherを関連付けるために、外部キーを作成します。
[source,sql]
----
create table wishes (id number not null, wisher_id number not null,description varchar2(255) not null, due_date date, constraint wishes_pk primary key(id), constraint wishes_fk1 foreign key(wisher_id) references wishers(id));
----
-4. 新しい表がデータベースに追加されたことを確認します。NetBeans IDEを使用してデータベースに接続している場合、「サービス」ウィンドウのjdbc:oracle:thin:@localhost:1521:XE [PHPUSERのphpuser]接続ノードに移動します。新しい表が「表」ノードに一覧表示されます。(それらが表示されない場合、接続を右クリックして「リフレッシュ」を選択します。)
+
+[start=4]
+. 新しい表がデータベースに追加されたことを確認します。NetBeans IDEを使用してデータベースに接続している場合、「サービス」ウィンドウのjdbc:oracle:thin:@localhost:1521:XE [PHPUSERのphpuser]接続ノードに移動します。新しい表が「表」ノードに一覧表示されます。(それらが表示されない場合、接続を右クリックして「リフレッシュ」を選択します。)
image::images/tables-in-services-window.png[]
@@ -151,7 +157,9 @@
create sequence wishers_id_seq start with 1 increment by 1;
----
-2. 新しいウィッシャを追加したときにwishers表のID列で順序をトリガーするには、次のSQLコマンドを実行します。
+
+[start=2]
+. 新しいウィッシャを追加したときにwishers表のID列で順序をトリガーするには、次のSQLコマンドを実行します。
[source,sql]
----
@@ -164,14 +172,18 @@
end;
/
----
-3. wishes表の順序を追加します。
+
+[start=3]
+. wishes表の順序を追加します。
[source,java]
----
create sequence wishes_id_seq start with 1 increment by 1;
----
-4. 新しいウィッシュを追加したときにwishes表のID列で順序を実行するためのトリガーを追加します。
+
+[start=4]
+. 新しいウィッシュを追加したときにwishes表のID列で順序を実行するためのトリガーを追加します。
[source,sql]
----
@@ -199,7 +211,9 @@
insert into wishers (name, password) values ('Tom','tomcat');
----
-2. Jerryという名前でパスワードが「jerrymouse」のウィッシャを追加します。
+
+[start=2]
+. Jerryという名前でパスワードが「jerrymouse」のウィッシャを追加します。
[source,sql]
@@ -207,7 +221,9 @@
insert into wishers (name, password) values ('Jerry', 'jerrymouse');commit;
----
-3. ウィッシュを追加します。
+
+[start=3]
+. ウィッシュを追加します。
[source,sql]
----
@@ -217,7 +233,9 @@
insert into wishes (wisher_id, description)values (2, 'Candle');
commit;
----
-4. テスト・データを追加したことを確認します。NetBeans IDEを使用してテスト・データを表示する場合、関連する表でマウスの右ボタンをクリックし、コンテキスト・メニューから「データを表示」を選択します。
+
+[start=4]
+. テスト・データを追加したことを確認します。NetBeans IDEを使用してテスト・データを表示する場合、関連する表でマウスの右ボタンをクリックし、コンテキスト・メニューから「データを表示」を選択します。
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_pt_BR.asciidoc
index 9c52bcb..c5e4bb9 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_pt_BR.asciidoc
@@ -119,21 +119,27 @@
Se estiver se conectando por meio do NetBeans IDE, crie uma conexão com o nome e a senha do novo usuário. Assegure-se de selecionar o esquema com o mesmo nome que o do usuário. (Consulte a seção link:../ide/oracle-db.html#connect[+Estabelecendo uma Conexão com o Banco de Dados Oracle+] do tutorial Conectando-se a um Banco de Dados Oracle.)
-2. Para criar a tabela wishers, execute a seguinte consulta SQL:
+
+[start=2]
+. Para criar a tabela wishers, execute a seguinte consulta SQL:
[source,sql]
----
create table wishers (id number not null,name varchar2(50) unique not null, password varchar2(50) not null, constraint wishers_pk primary key(id));
----
-3. Para criar a tabela wishes, execute a consulta SQL a seguir. Observe que você cria uma chave estrangeira que associa wishes com um wisher.
+
+[start=3]
+. Para criar a tabela wishes, execute a consulta SQL a seguir. Observe que você cria uma chave estrangeira que associa wishes com um wisher.
source,sql]
----
create table wishes (id number not null, wisher_id number not null,description varchar2(255) not null, due_date date, constraint wishes_pk primary key(id), constraint wishes_fk1 foreign key(wisher_id) references wishers(id));
----
-4. Verifique se as novas tabelas são adicionadas no banco de dados. Se você estiver usando o NetBeans IDE para se conetar ao banco de dados, acesse a janela Serviços do nó de conexão jdbc:oracle:thin:@localhost:1521:XE [phpuser on PHPUSER]. As novas tabelas serão listadas no nó Tabelas. (Se elas não aparecerem, clique com o botão direito do mouse na conexão e selecione Atualizar.)
+
+[start=4]
+. Verifique se as novas tabelas são adicionadas no banco de dados. Se você estiver usando o NetBeans IDE para se conetar ao banco de dados, acesse a janela Serviços do nó de conexão jdbc:oracle:thin:@localhost:1521:XE [phpuser on PHPUSER]. As novas tabelas serão listadas no nó Tabelas. (Se elas não aparecerem, clique com o botão direito do mouse na conexão e selecione Atualizar.)
image::images/tables-in-services-window.png[]
@@ -151,7 +157,9 @@
create sequence wishers_id_seq start with 1 increment by 1;
----
-2. Para acionar a sequência na coluna ID da tabela wishers quando você adiciona um novo wisher, execute o seguinte comando SQL:
+
+[start=2]
+. Para acionar a sequência na coluna ID da tabela wishers quando você adiciona um novo wisher, execute o seguinte comando SQL:
[source,sql]
----
@@ -164,18 +172,24 @@
end;
/
----
-3. Adicione uma sequência à tabela wishes.
+
+[start=3]
+. Adicione uma sequência à tabela wishes.
[source,sql]
----
create sequence wishes_id_seq start with 1 increment by 1;
----
-4. Add a trigger to run the sequence on the ID column of the wishes table when you add a new wish.
+
+[start=4]
+. Add a trigger to run the sequence on the ID column of the wishes table when you add a new wish.
[source,sql]
----
-4. Adicione um trigger para executar a sequência na coluna ID da tabela wishes quando você adiciona um novo wish.
+
+[start=4]
+. Adicione um trigger para executar a sequência na coluna ID da tabela wishes quando você adiciona um novo wish.
[source,sql]
----
@@ -203,14 +217,18 @@
insert into wishers (name, password) values ('Tom','tomcat');
----
-2. Adicione um wisher chamado Jerry com a senha "jerrymouse".
+
+[start=2]
+. Adicione um wisher chamado Jerry com a senha "jerrymouse".
[source,sql]
----
insert into wishers (name, password) values ('Jerry', 'jerrymouse');commit;
----
-3. Adicione os wishes.
+
+[start=3]
+. Adicione os wishes.
[source,sql]
----
@@ -220,7 +238,9 @@
insert into wishes (wisher_id, description)values (2, 'Candle');
commit;
----
-4. Verifique se você adicionou dados de teste. Se você estiver usando o NetBeans IDE para exibir os dados de teste, clique com o botão direito do mouse na tabela relevante e, no menu de contexto, selecione Exibir Dados.
+
+[start=4]
+. Verifique se você adicionou dados de teste. Se você estiver usando o NetBeans IDE para exibir os dados de teste, clique com o botão direito do mouse na tabela relevante e, no menu de contexto, selecione Exibir Dados.
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ru.asciidoc
index a993d3e..777155e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_ru.asciidoc
@@ -119,21 +119,27 @@
При соединении с помощью IDE NetBeans создайте соединение с использованием новых имени пользователя и пароля. Убедитесь в том, что выбрана схема с именем пользователя. (См. раздел link:../ide/oracle-db.html#connect[+Установка подключения к базе данных Oracle+] учебного курса "Подключение к базе данных Oracle").
-2. Чтобы создать таблицу wishers, выполните следующий запрос SQL:
+
+[start=2]
+. Чтобы создать таблицу wishers, выполните следующий запрос SQL:
[source,sql]
----
create table wishers (id number not null,name varchar2(50) unique not null, password varchar2(50) not null, constraint wishers_pk primary key(id));
----
-3. Чтобы создать таблицу wishes, выполните следующий запрос SQL. Обратите внимание на то, что для связывания пожеланий и пользователей, оставивших пожелания, создается внешний ключ.
+
+[start=3]
+. Чтобы создать таблицу wishes, выполните следующий запрос SQL. Обратите внимание на то, что для связывания пожеланий и пользователей, оставивших пожелания, создается внешний ключ.
[source,sql]
----
create table wishes (id number not null, wisher_id number not null,description varchar2(255) not null, due_date date, constraint wishes_pk primary key(id), constraint wishes_fk1 foreign key(wisher_id) references wishers(id));
----
-4. Убедитесь в том, что к базе данных добавлены новые таблицы. При соединении с базой данных с помощью IDE NetBeans перейдите в окне 'Службы' к узлу соединения jdbc:oracle:thin:@localhost:1521:XE [phpuser on PHPUSER]. Новые таблицы приведены в узле "Tables" (Таблицы). (Если они не отображаются, щелкните подключение правой кнопкой мыши и выберите команду "Refresh" (Обновить)).
+
+[start=4]
+. Убедитесь в том, что к базе данных добавлены новые таблицы. При соединении с базой данных с помощью IDE NetBeans перейдите в окне 'Службы' к узлу соединения jdbc:oracle:thin:@localhost:1521:XE [phpuser on PHPUSER]. Новые таблицы приведены в узле "Tables" (Таблицы). (Если они не отображаются, щелкните подключение правой кнопкой мыши и выберите команду "Refresh" (Обновить)).
image::images/tables-in-services-window.png[]
@@ -151,7 +157,9 @@
create sequence wishers_id_seq start with 1 increment by 1;
----
-2. Чтобы инициировать последовательность в столбце идентификаторов таблицы wishers при добавлении нового пользователя, оставившего запись, выполните следующую команду SQL:
+
+[start=2]
+. Чтобы инициировать последовательность в столбце идентификаторов таблицы wishers при добавлении нового пользователя, оставившего запись, выполните следующую команду SQL:
[source,sql]
----
@@ -164,14 +172,18 @@
end;
/
----
-3. Добавьте последовательность для таблицы wishes.
+
+[start=3]
+. Добавьте последовательность для таблицы wishes.
[source,sql]
----
create sequence wishes_id_seq start with 1 increment by 1;
----
-4. Добавьте триггер, запускающий последовательность в столбце идентификаторов таблицы wishes при добавлении нового пожелания.
+
+[start=4]
+. Добавьте триггер, запускающий последовательность в столбце идентификаторов таблицы wishes при добавлении нового пожелания.
[source,sql]
----
@@ -199,14 +211,18 @@
insert into wishers (name, password) values ('Tom','tomcat');
----
-2. Добавьте пользователя с именем Jerry и паролем "jerrymouse".
+
+[start=2]
+. Добавьте пользователя с именем Jerry и паролем "jerrymouse".
[source,sql]
----
insert into wishers (name, password) values ('Jerry', 'jerrymouse');commit;
----
-3. Добавьте пожелания.
+
+[start=3]
+. Добавьте пожелания.
[source,sql]
----
@@ -216,7 +232,9 @@
insert into wishes (wisher_id, description)values (2, 'Candle');
commit;
----
-4. Убедитесь в том, что данные добавлены. При использовании IDE NetBeans для просмотра данных проверки, щелкните правой кнопкой мыши соответствующую таблицу и выберите в контекстном меню 'Просмотреть данные'.
+
+[start=4]
+. Убедитесь в том, что данные добавлены. При использовании IDE NetBeans для просмотра данных проверки, щелкните правой кнопкой мыши соответствующую таблицу и выберите в контекстном меню 'Просмотреть данные'.
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_zh_CN.asciidoc
index 7cafdb3..81e167b 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-oracle-lesson1_zh_CN.asciidoc
@@ -119,21 +119,27 @@
如果通过 NetBeans IDE 进行连接,请使用新用户的名字和口令创建一个连接。确保选择的方案具有与用户相同的名称。(请参见“连接到 Oracle 数据库”教程的link:../ide/oracle-db.html#connect[+建立到 Oracle DB 的连接+]部分。)
-2. 要创建 wishers 表,请运行以下 SQL 查询:
+
+[start=2]
+. 要创建 wishers 表,请运行以下 SQL 查询:
[source,sql]
----
create table wishers (id number not null,name varchar2(50) unique not null, password varchar2(50) not null, constraint wishers_pk primary key(id));
----
-3. 要创建 wishes 表,请运行以下 SQL 查询。请注意,将创建一个外键,使愿望与许愿者相关联。
+
+[start=3]
+. 要创建 wishes 表,请运行以下 SQL 查询。请注意,将创建一个外键,使愿望与许愿者相关联。
[source,sql]
----
create table wishes (id number not null, wisher_id number not null,description varchar2(255) not null, due_date date, constraint wishes_pk primary key(id), constraint wishes_fk1 foreign key(wisher_id) references wishers(id));
----
-4. 验证是否将新表添加到数据库中。如果使用 NetBeans IDE 连接到数据库,请转至 "Services"(服务)窗口中的 jdbc:oracle:thin:@localhost:1521:XE [PHPUSER 上的 phpuser] 连接节点。将在 "Tables"(表)节点中列出新表。(如果未显示这些表,请右键单击连接,然后选择 "Refresh"(刷新)。)
+
+[start=4]
+. 验证是否将新表添加到数据库中。如果使用 NetBeans IDE 连接到数据库,请转至 "Services"(服务)窗口中的 jdbc:oracle:thin:@localhost:1521:XE [PHPUSER 上的 phpuser] 连接节点。将在 "Tables"(表)节点中列出新表。(如果未显示这些表,请右键单击连接,然后选择 "Refresh"(刷新)。)
image::images/tables-in-services-window.png[]
@@ -151,7 +157,9 @@
create sequence wishers_id_seq start with 1 increment by 1;
----
-2. 要在添加新的许愿者时在 wishers 表的 ID 列上触发序列,请运行以下 SQL 命令:
+
+[start=2]
+. 要在添加新的许愿者时在 wishers 表的 ID 列上触发序列,请运行以下 SQL 命令:
[source,sql]
----
@@ -164,14 +172,18 @@
end;
/
----
-3. 为 wishes 表添加一个序列。
+
+[start=3]
+. 为 wishes 表添加一个序列。
[source,sql]
----
create sequence wishes_id_seq start with 1 increment by 1;
----
-4. 添加一个触发器,以便在添加新的愿望时在 wishes 表的 ID 列上运行序列。
+
+[start=4]
+. 添加一个触发器,以便在添加新的愿望时在 wishes 表的 ID 列上运行序列。
[source,sql]
----
@@ -199,14 +211,18 @@
insert into wishers (name, password) values ('Tom','tomcat');
----
-2. 添加一个名为 Jerry 且口令为 jerrymouse 的许愿者。
+
+[start=2]
+. 添加一个名为 Jerry 且口令为 jerrymouse 的许愿者。
[source,sql]
----
insert into wishers (name, password) values ('Jerry', 'jerrymouse');commit;
----
-3. 添加愿望。
+
+[start=3]
+. 添加愿望。
[source,sql]
----
@@ -216,7 +232,9 @@
insert into wishes (wisher_id, description)values (2, 'Candle');
commit;
----
-4. 验证是否添加了测试数据。如果使用 NetBeans IDE 查看测试数据,请在相关表上单击鼠标右键,然后从上下文菜单中选择 "View Data"(查看数据)。
+
+[start=4]
+. 验证是否添加了测试数据。如果使用 NetBeans IDE 查看测试数据,请在相关表上单击鼠标右键,然后从上下文菜单中选择 "View Data"(查看数据)。
image::images/view-test-data.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page.asciidoc
index 46e9108..a264c5e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page.asciidoc
@@ -34,20 +34,36 @@
1. *=> Creating a Database Driven Application With PHP - Main page*
-2. Creating the Database
+
+[start=2]
+. Creating the Database
1. link:wish-list-lesson1.html[+Creating a MySQL Database+]
2. link:wish-list-oracle-lesson1.html[+Creating Oracle Database Tables+]
3.
link:wish-list-lesson2.html[+Designing the Application. Reading from the Database+]
-4. link:wish-list-lesson3.html[+ Creating a New Application User +]
-5. link:wish-list-lesson4.html[+Optimizing the Code+]
-6. link:wish-list-lesson5.html[+Adding Security. Implementing Application User Logon+]
-7. link:wish-list-lesson6.html[+Adding a New Wish to the Database+]
-8. link:wish-list-lesson7.html[+Updating and Deleting Entries in the Database+]
-9. link:wish-list-lesson8.html[+Making the Application Look Better Using the CSS Technology+]
-10. link:wish-list-lesson9.html[+Deploying the Application on a Remote Web Server+]
+
+[start=4]
+. link:wish-list-lesson3.html[+ Creating a New Application User +]
+
+[start=5]
+. link:wish-list-lesson4.html[+Optimizing the Code+]
+
+[start=6]
+. link:wish-list-lesson5.html[+Adding Security. Implementing Application User Logon+]
+
+[start=7]
+. link:wish-list-lesson6.html[+Adding a New Wish to the Database+]
+
+[start=8]
+. link:wish-list-lesson7.html[+Updating and Deleting Entries in the Database+]
+
+[start=9]
+. link:wish-list-lesson8.html[+Making the Application Look Better Using the CSS Technology+]
+
+[start=10]
+. link:wish-list-lesson9.html[+Deploying the Application on a Remote Web Server+]
In this tutorial, you use the PHP features in the Apache NetBeans to create and run a simple web application. The example shows how to create a wish list. After you create and deploy the application, it enables you to share information on wish lists with your friends, such as lists for wedding, birthday, or holiday gifts. The information is stored in the database that you create in Lesson 1.
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ja.asciidoc
index 93cb7dd..c619b40 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ja.asciidoc
@@ -33,20 +33,36 @@
1. *=> PHPを使用するデータベース駆動型アプリケーションの作成 - メイン・ページ*
-2. データベースの作成
+
+[start=2]
+. データベースの作成
1. link:wish-list-lesson1.html[+MySQLデータベースの作成+]
2. link:wish-list-oracle-lesson1.html[+Oracleデータベース表の作成+]
3.
link:wish-list-lesson2.html[+アプリケーションの設計。データベースからの読取り+]
-4. link:wish-list-lesson3.html[+新規アプリケーション・ユーザーの作成+]
-5. link:wish-list-lesson4.html[+コードの最適化+]
-6. link:wish-list-lesson5.html[+セキュリティの追加。アプリケーション・ユーザー・ログオンの実装+]
-7. link:wish-list-lesson6.html[+データベースへの新しいウィッシュの追加+]
-8. link:wish-list-lesson7.html[+データベース内のエントリの更新および削除+]
-9. link:wish-list-lesson8.html[+CSSテクノロジを使用したアプリケーションの外観の改良+]
-10. link:wish-list-lesson9.html[+リモートWebサーバーへのアプリケーションのデプロイ+]
+
+[start=4]
+. link:wish-list-lesson3.html[+新規アプリケーション・ユーザーの作成+]
+
+[start=5]
+. link:wish-list-lesson4.html[+コードの最適化+]
+
+[start=6]
+. link:wish-list-lesson5.html[+セキュリティの追加。アプリケーション・ユーザー・ログオンの実装+]
+
+[start=7]
+. link:wish-list-lesson6.html[+データベースへの新しいウィッシュの追加+]
+
+[start=8]
+. link:wish-list-lesson7.html[+データベース内のエントリの更新および削除+]
+
+[start=9]
+. link:wish-list-lesson8.html[+CSSテクノロジを使用したアプリケーションの外観の改良+]
+
+[start=10]
+. link:wish-list-lesson9.html[+リモートWebサーバーへのアプリケーションのデプロイ+]
image::images/netbeans-stamp-80-74-73.png[title="このページの内容は、NetBeans IDE 7.2、7.3、7.4および8.0に適用されます"]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_pt_BR.asciidoc
index 10e5676..87082e2 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_pt_BR.asciidoc
@@ -33,20 +33,36 @@
1. *=> Criando uma Aplicação Orientada a Banco de Dados com PHP - Página principal*
-2. Criando o Banco de Dados
+
+[start=2]
+. Criando o Banco de Dados
1. link:wish-list-lesson1.html[+Criando um Banco de Dados MySQL+]
2. link:wish-list-oracle-lesson1.html[+Criando Tabelas do Banco de Dados Oracle+]
3.
link:wish-list-lesson2.html[+Projetando a Aplicação. Lendo o Banco de Dados+]
-4. link:wish-list-lesson3.html[+Criando um Novo Usuário da Aplicação+]
-5. link:wish-list-lesson4.html[+Otimizando o Código+]
-6. link:wish-list-lesson5.html[+Adicionando Segurança. Implementando o Log-in de Usuário da Aplicação+]
-7. link:wish-list-lesson6.html[+Adicionando um Novo Desejo ao Banco de Dados+]
-8. link:wish-list-lesson7.html[+Atualizando e Deletando Entradas no Banco de Dados+]
-9. link:wish-list-lesson8.html[+Melhorando a Aparência da Aplicação Usando a Tecnologia CSS+]
-10. link:wish-list-lesson9.html[+Implantando a Aplicação em um Servidor Web Remoto+]
+
+[start=4]
+. link:wish-list-lesson3.html[+Criando um Novo Usuário da Aplicação+]
+
+[start=5]
+. link:wish-list-lesson4.html[+Otimizando o Código+]
+
+[start=6]
+. link:wish-list-lesson5.html[+Adicionando Segurança. Implementando o Log-in de Usuário da Aplicação+]
+
+[start=7]
+. link:wish-list-lesson6.html[+Adicionando um Novo Desejo ao Banco de Dados+]
+
+[start=8]
+. link:wish-list-lesson7.html[+Atualizando e Deletando Entradas no Banco de Dados+]
+
+[start=9]
+. link:wish-list-lesson8.html[+Melhorando a Aparência da Aplicação Usando a Tecnologia CSS+]
+
+[start=10]
+. link:wish-list-lesson9.html[+Implantando a Aplicação em um Servidor Web Remoto+]
image::images/netbeans-stamp-80-74-73.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.2, 7.3, 7.4 e 8.0"]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ru.asciidoc
index 2dc53ce..e25650e 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_ru.asciidoc
@@ -33,20 +33,36 @@
1. *=> Создание приложения на основе базы данных с помощью языка PHP – главная страница*
-2. Создание базы данных
+
+[start=2]
+. Создание базы данных
1. link:wish-list-lesson1.html[+Создание базы данных MySQL+]
2. link:wish-list-oracle-lesson1.html[+Создание таблиц базы данных Oracle+]
3.
link:wish-list-lesson2.html[+Проектирование приложения. Чтение из базы данных+]
-4. link:wish-list-lesson3.html[+Создание нового пользователя приложения+]
-5. link:wish-list-lesson4.html[+Усовершенствование кода+]
-6. link:wish-list-lesson5.html[+Добавление функций безопасности. Реализация входа пользователя в приложение+]
-7. link:wish-list-lesson6.html[+Добавление к базе данных новых желаний+]
-8. link:wish-list-lesson7.html[+Обновление и удаление записей в базе данных+]
-9. link:wish-list-lesson8.html[+Усовершенствование внешнего вида приложения с использованием технологии CSS+]
-10. link:wish-list-lesson9.html[+Развертывание приложения на удаленном веб-сервере+]
+
+[start=4]
+. link:wish-list-lesson3.html[+Создание нового пользователя приложения+]
+
+[start=5]
+. link:wish-list-lesson4.html[+Усовершенствование кода+]
+
+[start=6]
+. link:wish-list-lesson5.html[+Добавление функций безопасности. Реализация входа пользователя в приложение+]
+
+[start=7]
+. link:wish-list-lesson6.html[+Добавление к базе данных новых желаний+]
+
+[start=8]
+. link:wish-list-lesson7.html[+Обновление и удаление записей в базе данных+]
+
+[start=9]
+. link:wish-list-lesson8.html[+Усовершенствование внешнего вида приложения с использованием технологии CSS+]
+
+[start=10]
+. link:wish-list-lesson9.html[+Развертывание приложения на удаленном веб-сервере+]
image::images/netbeans-stamp-80-74-73.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.2, 7.3, 7.4 и 8.0"]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_zh_CN.asciidoc
index 43095a7..d901eb0 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/wish-list-tutorial-main-page_zh_CN.asciidoc
@@ -33,20 +33,36 @@
1. *=> 使用 PHP 创建数据库驱动的应用程序 - 主页*
-2. 创建数据库
+
+[start=2]
+. 创建数据库
1. link:wish-list-lesson1.html[+创建 MySQL 数据库+]
2. link:wish-list-oracle-lesson1.html[+创建 Oracle 数据库表+]
3.
link:wish-list-lesson2.html[+设计应用程序。从数据库读取数据+]
-4. link:wish-list-lesson3.html[+创建新的应用程序用户+]
-5. link:wish-list-lesson4.html[+优化代码+]
-6. link:wish-list-lesson5.html[+添加安全功能。实现应用程序用户登录+]
-7. link:wish-list-lesson6.html[+在数据库中添加新的愿望+]
-8. link:wish-list-lesson7.html[+更新和删除数据库中的条目+]
-9. link:wish-list-lesson8.html[+使用 CSS 技术改进应用程序的外观+]
-10. link:wish-list-lesson9.html[+将应用程序部署到远程 Web 服务器+]
+
+[start=4]
+. link:wish-list-lesson3.html[+创建新的应用程序用户+]
+
+[start=5]
+. link:wish-list-lesson4.html[+优化代码+]
+
+[start=6]
+. link:wish-list-lesson5.html[+添加安全功能。实现应用程序用户登录+]
+
+[start=7]
+. link:wish-list-lesson6.html[+在数据库中添加新的愿望+]
+
+[start=8]
+. link:wish-list-lesson7.html[+更新和删除数据库中的条目+]
+
+[start=9]
+. link:wish-list-lesson8.html[+使用 CSS 技术改进应用程序的外观+]
+
+[start=10]
+. link:wish-list-lesson9.html[+将应用程序部署到远程 Web 服务器+]
image::images/netbeans-stamp-80-74-73.png[title="此页上的内容适用于 NetBeans IDE 7.2、7.3、7.4 和 8.0"]
diff --git a/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast.asciidoc
index c6909ab..16ee5cb 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast.asciidoc
@@ -37,4 +37,4 @@
link:http://bits.netbeans.org/media/zf.flv[+Download+] (30.2 MB)
-|===
\ No newline at end of file
+|===
diff --git a/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_pt_BR.asciidoc
index 4171629..a37f023 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_pt_BR.asciidoc
@@ -37,4 +37,4 @@
link:http://bits.netbeans.org/media/zf.flv[+Download+] (30,2 MB)
-|===
\ No newline at end of file
+|===
diff --git a/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_zh_CN.asciidoc
index 6c37a7f..ec37e80 100644
--- a/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/php/zend-framework-screencast_zh_CN.asciidoc
@@ -38,4 +38,4 @@
link:http://bits.netbeans.org/media/zf.flv[+下载+] (30.2 MB)
-|===
\ No newline at end of file
+|===
diff --git a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart.asciidoc
index 96f8978..68d7ef0 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart.asciidoc
@@ -93,12 +93,12 @@
image::images/java-name-location.png[title="Specify the name and location for your application project"]
-[start=3]
+
. In the Server and Settings panel, select the server you want to deploy your application to. Only servers that are registered with the IDE are listed.
image::images/java-server-settings.png[title="Specify the server your application will be deployed to"]
-[start=4]
+
. Accept other default settings and click Finish. The project is generated in your file system and opens in the IDE.
When Java-based web projects are created, an link:http://ant.apache.org/[+Ant+] build script is automatically generated which enables you to compile the project so that it can be immediately deployed and run on a server that has been registered in the IDE.
@@ -146,7 +146,7 @@
----
-[start=2]
+
. Add some explanatory text to describe the purpose of the text field. You can copy and paste in the following text at a point just beneath the `<h1>` tags:
[source,html]
@@ -161,7 +161,7 @@
----
-[start=3]
+
. Add an HTML form to the page. You can do this by making use of the elements listed in the IDE's Palette. If the Palette is not open, choose Window > Palette from the main menu. Then, under HTML Forms, click on and drag a Form element into the page to a point beneath the `<p>` tags that you just added. The Insert Form dialog box opens. Specify the following:
* Action: autocomplete
@@ -173,7 +173,7 @@
Click OK. The HTML `<form>` tags are inserted into the page containing the attributes you specified. (GET is applied by default, and so is not explicitly declared.)
-[start=4]
+
. Add an HTML table to the page. Under the HTML category in the Palette, click on a Table element and drag it to a point between the `<form>` tags. The Insert Table dialog box opens. Specify the following:
* Rows: 2
@@ -183,7 +183,7 @@
image::images/insert-table.png[title="Insert table dialog"]
-[start=5]
+
. Right-click inside the Source Editor and choose Format. This tidies up the code. Your form should now display similar to that below:
[source,html]
@@ -212,7 +212,7 @@
----
-[start=6]
+
. Within the first row of the table, type the following text into the first column (changes in *bold*):
[source,html]
@@ -221,7 +221,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=7]
+
. Within the second column of the first row, instead of dragging a Text Input field from the Palette, type in the code below manually (changes in *bold*):
[source,html]
@@ -291,7 +291,7 @@
The above code performs a simple browser compatibility check for Firefox 3 and Internet Explorer versions 6 and 7). If you would like to incorporate more robust code for compatibility issues, consider using this link:http://www.quirksmode.org/js/detect.html[+browser detect script+] from link:http://www.quirksmode.org[+http://www.quirksmode.org+].
-[start=4]
+
. Switch back to the index page and add a reference to the JavaScript file between the `<head>` tags.
[source,html]
@@ -303,7 +303,7 @@
You can quickly toggle between pages opened in the Source Editor by pressing Ctrl-Tab.
-[start=5]
+
. Insert a call to `init()` in the opening `<body>` tag.
[source,javascript]
@@ -462,7 +462,7 @@
When you click Finish the IDE creates the class and opens the file in the Source Editor.
-[start=3]
+
. In the Source Editor, paste in the following code:
[source,java]
@@ -515,7 +515,7 @@
image::images/newservlet-name-location.png[]
-[start=3]
+
. In the Configure Servlet Deployment panel, change the URL pattern to *`/autocomplete`* so that it matches the URL that you previously set in the `XMLHttpRequest` object.
image::images/newservlet-configure-deployment.png[]
@@ -523,10 +523,10 @@
This panel saves you the step of needing to manually add these details to the deployment descriptor.
-[start=4]
+
. Optionally, select "Add servlet information to deployment descriptor." This is so your project is the same as the downloaded sample. With later versions of the IDE, by default the servlet is registered by a `@WebServlet` annotation instead of in a deployment descriptor. The project will still work if you use the `@WebServlet` annotation instead of a deployment descriptor.
-[start=5]
+
. Click Finish. The servlet is created and opens in the Source Editor.
The only methods you need to override are `doGet()`, to define how the servlet handles the `autocomplete` `GET` request, and `init()`, which needs to initiate a `ServletContext` so the servlet can access other classes in the application once it is put into service.
@@ -537,15 +537,15 @@
image::images/insert-code.png[title="Insert Code popup menu displayed in Source Editor"]
-[start=2]
+
. Choose Override Method. In the dialog that displays, all classes that `AutoCompleteServlet` inherits from are displayed. Expand the GenericServlet node and select `init(Servlet Config config)`.
image::images/new-override.png[title="Override dialog lists inherited classes"]
-[start=3]
+
. Click OK. The `init()` method is added in the Source Editor.
-[start=4]
+
. Add a variable for a `ServletContext` object and modify `init()` (changes in *bold*):
[source,java]
@@ -559,7 +559,7 @@
}
----
-[start=5]
+
. Add an import statement for `ServletContext`. You can do this by clicking on the lightbulb icon that displays in the left margin of the Source Editor
image::images/import-hint.png[title="Import hints display in left margin of the Source Editor"]
@@ -576,7 +576,7 @@
----
This creates a `HashMap` of all composer data, which is then employed by `doGet()`.
-[start=2]
+
. Scroll down to `doGet()` and implement the method as follows:
[source,xml]
@@ -749,7 +749,7 @@
----
The second row of the table contains another HTML table. This table represents the auto-complete box that will be used to populate composer names.
-[start=2]
+
. Open `javascript.js` in the Source Editor and the following three variables to the top of the file.
[source,javascript]
@@ -760,7 +760,7 @@
var autoRow;
----
-[start=3]
+
. Add the following lines (in *bold*) to the `init()` function.
[source,javascript]
@@ -775,7 +775,7 @@
----
One purpose of `init()` is to make elements inside the index page accessible to other functions that will modify the index page's DOM.
-[start=4]
+
. Add `appendComposer()` to `javascript.js`.
[source,javascript]
@@ -810,7 +810,7 @@
----
This function creates a new table row, inserts a link to a composer into it using the data passed to the function via its three parameters, and inserts the row into the index page's `complete-table` element.
-[start=5]
+
. Add `getElementY()` to `javascript.js`.
[source,javascript]
@@ -836,7 +836,7 @@
*Note:* See link:http://www.quirksmode.org/js/findpos.html[+this explanation+] of `offset` on link:http://www.quirksmode.org/[+http://www.quirksmode.org/+].
-[start=6]
+
. Add `clearTable()` to `javascript.js`.
[source,javascript]
@@ -853,7 +853,7 @@
----
This function sets the display of the `complete-table` element to 'none', (i.e., makes it invisible), and it removes any existing composer name entries that were created.
-[start=7]
+
. Modify the `callback()` function to call `clearTable()` each time new data is received from the server. Any composer entries that already exist in the auto-complete box are therefore removed before it becomes populated with new entries.
[source,javascript]
@@ -871,7 +871,7 @@
}
----
-[start=8]
+
. Add `parseMessages()` to `javascript.js`.
[source,javascript]
@@ -973,10 +973,10 @@
*Note.* You will need to change the link to return to the index page if your index page is ``index.jsp`` .
-[start=5]
+
. Create another JSP file in the project's Web Pages folder. Name the file `error.jsp`.
-[start=6]
+
. Replace the placeholder code in `error.jsp` with the following code:
[source,html]
@@ -1026,7 +1026,7 @@
The new file is created and opens in the editor.
-[start=3]
+
. Type the following rules in `stylesheet.css` in the editor. You can make use of the IDE's code completion support by pressing Ctrl-Space at points when you want to call up suggestions.
[source,css]
@@ -1096,7 +1096,7 @@
}
----
-[start=4]
+
. Open the CSS Styles window by choosing Window > Web > CSS Styles.
image::images/css-styles-window.png[title="CSS Styles window displaying h1 rule properties"]
@@ -1104,7 +1104,7 @@
You can use the CSS Styles window to quickly view the properties and edit style rules. When you select a rule in the upper pane of the CSS Style window you can see the properties of the rule in the lower pane. You can add a CSS Rules to the stylesheet by clicking the Edit CSS Rules icon (image:images/newcssrule.png[title="New CSS Property icon"]) in the toolbar of the upper pane. You can modify rules in the lower pane by editing the property sheet and add properties by clicking the Add Property icon (image:images/newcssproperty.png[title="New CSS Property icon"]) in the toolbar of the lower pane.
-[start=5]
+
. Switch to the index page in the Source Editor, and add a reference to the stylesheet between the `<head>` tags.
[source,html]
@@ -1113,7 +1113,7 @@
<link rel="stylesheet" type="text/css" href="stylesheet.css">
----
-[start=6]
+
. Add the `popupBox` class that is defined in the stylesheet to the `complete-table` element (changes in *bold*).
[source,html]
@@ -1155,7 +1155,7 @@
*Note:* This option displays under the Common tab for the GlassFish server. For Tomcat, it resides under the Connection tab.
-[start=3]
+
. Click Close.
If the server is already running, you need to restart it in order to allow changes to take effect. You can restart the server by opening the Services window (Window > Services), then right-clicking your server beneath the Servers node and choosing Restart.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ja.asciidoc
index f2a53dd..ec6e9ae07 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ja.asciidoc
@@ -94,12 +94,12 @@
image::images/java-name-location.png[title="アプリケーション・プロジェクトでの名前と場所の指定"]
-[start=3]
+
. 「サーバーと設定」パネルで、アプリケーションをデプロイするサーバーを選択します。IDEに登録されているサーバーのみ表示されます。
image::images/java-server-settings.png[title="アプリケーションのデプロイ先サーバーの指定"]
-[start=4]
+
. その他のデフォルト設定を受け入れ、「終了」をクリックします。プロジェクトがファイル・システムに生成され、IDEで開きます。
JavaベースのWebプロジェクトが作成されると、link:http://ant.apache.org/[+Ant+]ビルド・スクリプトが自動的に生成されます。このスクリプトによってプロジェクトをコンパイルし、IDEに登録されているサーバーにすぐにデプロイして実行できます。
@@ -147,7 +147,7 @@
----
-[start=2]
+
. テキスト・フィールドの目的を説明するテキストを追加します。次のテキストをコピーして、`<h1>`タグのすぐ下に貼り付けることもできます。
[source,html]
@@ -162,7 +162,7 @@
----
-[start=3]
+
. ページにHTMLフォームを追加します。この操作を行うには、IDEのパレットに表示されている要素を使用します。パレットが開いていない場合は、メイン・メニューから「ウィンドウ」>「パレット」を選択します。次に「HTMLフォーム」の下にある「フォーム」要素をクリックし、ページ内に追加した`<p>`タグの下までドラッグします。「挿入フォーム」ダイアログ・ボックスが表示されます。次の値を指定します。
* アクション: autocomplete
@@ -174,7 +174,7 @@
「OK」をクリックします。指定した属性を含むHTMLの`<form>`タグがページに挿入されます。(GETはデフォルトで適用されるので、明示的に宣言しません。)
-[start=4]
+
. HTML表をページに追加します。パレットの「HTML」カテゴリの下で「表」要素をクリックし、`<form>`タグの間の位置までドラッグします。「挿入表」ダイアログ・ボックスが開きます。次の値を指定します。
* 行: 2
@@ -184,7 +184,7 @@
image::images/insert-table.png[title="「挿入表」ダイアログ"]
-[start=5]
+
. ソース・エディタ内を右クリックし、「フォーマット」を選択します。これでコードの体裁が整います。フォームは次のようになります。
[source,xml]
@@ -213,7 +213,7 @@
----
-[start=6]
+
. 表の1行目の1列目に次のテキストを入力します(*太字*部分が変更箇所)。
[source,xml]
@@ -222,7 +222,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=7]
+
. 1行目の2列目では、パレットから「テキスト入力」フィールドをドラッグしないで、次のコードを手動で入力します(*太字*部分が変更箇所)。
[source,xml]
@@ -292,7 +292,7 @@
上のコードは、Firefox 3およびInternet Explorerバージョン6と7の単純なブラウザ互換性チェックを行います。互換性の問題に対してさらに堅牢なコードを取り込むには、link:http://www.quirksmode.org[+http://www.quirksmode.org+]のlink:http://www.quirksmode.org/js/detect.html[+ブラウザ検出スクリプト+]を使用することを検討してください。
-[start=4]
+
. indexページに戻り、JavaScriptファイルへの参照を`<head>`タグの間に追加します。
[source,xml]
@@ -304,7 +304,7 @@
[Ctrl]-[Tab]を押すと、ソース・エディタ内で開いているページ間を簡単に切り替えることができます。
-[start=5]
+
. `init()`へのコールを開始`<body>`タグ内に挿入します。
[source,java]
@@ -463,7 +463,7 @@
「終了」をクリックすると、IDEによってクラスが作成され、ファイルがソース・エディタで開きます。
-[start=3]
+
. ソース・エディタ内に、次のコードを貼り付けます。
[source,java]
@@ -516,7 +516,7 @@
image::images/newservlet-name-location.png[]
-[start=3]
+
. 「サーブレット・デプロイメントを構成」パネルで、URLパターンを*`/autocomplete`*にし、`XMLHttpRequest`オブジェクトで以前に設定したURLと一致するようにします。
image::images/newservlet-configure-deployment.png[]
@@ -524,10 +524,10 @@
このパネルによって、これらの詳細をデプロイメント・ディスクリプタに手動で追加する必要がなくなります。
-[start=4]
+
. オプションで、「サーブレット情報をデプロイメント・ディスクリプタに追加」を選択します。これにより、プロジェクトがダウンロードしたサンプルと同じになります。最近のバージョンのIDEでは、サーブレットはデフォルトで`@WebServlet`注釈によって登録され、デプロイメント・ディスクリプタには登録されません。デプロイメント・ディスクリプタのかわりに`@WebServlet`注釈を使用した場合も、プロジェクトは引続き機能します。
-[start=5]
+
. 「終了」をクリックします。サーブレットが作成され、ソース・エディタで開きます。
オーバーライドする必要があるメソッドは、サーブレットで`autocomplete``GET`リクエストを処理する方法を定義する`doGet()`と、サービスを開始後にサーブレットからアプリケーション内の他のクラスにアクセスできるように`ServletContext`を初期化する`init()`のみです。
@@ -538,15 +538,15 @@
image::images/insert-code.png[title="ソース・エディタに表示された「コードを挿入」ポップアップ・メニュー"]
-[start=2]
+
. 「メソッドをオーバーライド」を選択します。表示されるダイアログで、`AutoCompleteServlet`の継承元クラスがすべて表示されます。「GenericServlet」ノードを展開し、「`init(Servlet Config config)`」を選択します。
image::images/new-override.png[title="継承されたクラスが表示されたオーバーライド・ダイアログ"]
-[start=3]
+
. 「OK」をクリックします。`init()`メソッドがソース・エディタに追加されます。
-[start=4]
+
. `ServletContext`オブジェクトの変数を追加し、`init()`を変更します(*太字*部分が変更箇所)。
[source,java]
@@ -560,7 +560,7 @@
}
----
-[start=5]
+
. `ServletContext`のインポート文を追加します。そのためには、ソース・エディタの左マージンに表示される電球のアイコンをクリックします。
image::images/import-hint.png[title="ソース・エディタの左マージンに表示されたインポートのヒント"]
@@ -577,7 +577,7 @@
----
これで、すべての作曲家データの`HashMap`が作成されます。これは`doGet()`で使用されます。
-[start=2]
+
. `doGet()`までスクロールし、次のようにメソッドを実装します。
[source,xml]
@@ -750,7 +750,7 @@
----
表の2番目の行は、別のHTML表を含んでいます。この表は、作曲家の名前を挿入するためのオートコンプリート・ボックスを表します。
-[start=2]
+
. `javascript.js`をソース・エディタで開き、次の3つの変数をファイルの先頭に追加します。
[source,java]
@@ -761,7 +761,7 @@
var autoRow;
----
-[start=3]
+
. 次の*太字*の行を`init()`関数に追加します。
[source,java]
@@ -776,7 +776,7 @@
----
`init()`の目的の1つは、indexページのDOMを変更する他の関数からindexページ内の要素にアクセスできるようにすることです。
-[start=4]
+
. `appendComposer()`を`javascript.js`に追加します。
[source,java]
@@ -811,7 +811,7 @@
----
この関数は、表の新しい行を作成し、3つのパラメータによって関数に渡されたデータを使用して作曲家へのリンクを挿入してから、行をindexページの`complete-table`要素に挿入します。
-[start=5]
+
. `getElementY()`を`javascript.js`に追加します。
[source,java]
@@ -837,7 +837,7 @@
*注意: *link:http://www.quirksmode.org/[+http://www.quirksmode.org/+]にある`offset`に関するlink:http://www.quirksmode.org/js/findpos.html[+説明+]を参照してください。
-[start=6]
+
. `clearTable()`を`javascript.js`に追加します。
[source,java]
@@ -854,7 +854,7 @@
----
この関数は`complete-table`要素の表示を'none'に設定し(非表示にし)、作成された既存の作曲家の名前エントリを除去します。
-[start=7]
+
. `callback()`関数を変更して、サーバーから新しいデータを受け取るたびに`clearTable()`をコールするようにします。オートコンプリート・ボックスに作曲家のエントリがある場合は、新しいエントリが入力される前に除去されます。
[source,java]
@@ -872,7 +872,7 @@
}
----
-[start=8]
+
. `parseMessages()`を`javascript.js`に追加します。
[source,java]
@@ -974,10 +974,10 @@
*注意:*indexページが ``index.jsp`` の場合、indexページに戻るためのリンクを変更する必要があります。
-[start=5]
+
. プロジェクトの「Webページ」フォルダに、別のJSPファイルを作成します。ファイルに`error.jsp`という名前を付けます。
-[start=6]
+
. `error.jsp`内のプレースホルダ・コードを次のコードで置き換えます。
[source,html]
@@ -1027,7 +1027,7 @@
新規ファイルが作成され、エディタで開きます。
-[start=3]
+
. エディタで`stylesheet.css`に次のルールを入力します。IDEのコード補完サポートを利用するには、候補を呼び出したい場所で[Ctrl]-[Space]を押します。
[source,java]
@@ -1097,7 +1097,7 @@
}
----
-[start=4]
+
. 「ウィンドウ」→「Web」→「CSSスタイル」を選択して、「CSSスタイル」ウィンドウを開きます。
image::images/css-styles-window.png[title="h1ルールのプロパティを表示している「CSSスタイル」ウィンドウ"]
@@ -1105,7 +1105,7 @@
「CSSスタイル」ウィンドウを使用して、プロパティをすばやく表示し、スタイル・ルールを編集できます。「CSSスタイル」ウィンドウの上部ペインでルールを選択すると、下部ペインにルールのプロパティが表示されます。上部ペインのツールバーで「CSSルールの編集」アイコン(image:images/newcssrule.png[title="新規CSSプロパティ・アイコン"])をクリックして、スタイルシートにCSSルールを追加できます。プロパティ・シートを編集して下部ペインでルールを変更したり、下部ペインのツールバーで「プロパティの追加」アイコン(image:images/newcssproperty.png[title="新規CSSプロパティ・アイコン"])をクリックしてプロパティを追加したりできます。
-[start=5]
+
. ソース・エディタでindexページに切り替え、`<head>`タグの間にスタイル・シートへの参照を追加します。
[source,java]
@@ -1114,7 +1114,7 @@
<link rel="stylesheet" type="text/css" href="stylesheet.css">
----
-[start=6]
+
. スタイル・シートで定義されている`popupBox`クラスを`complete-table`要素に追加します(*太字*部分が変更箇所)。
[source,xml]
@@ -1156,7 +1156,7 @@
*注意:* このオプションは、GlassFishサーバーでは「共通」タブに表示されます。Tomcatでは「接続」タブに表示されます。
-[start=3]
+
. 「閉じる」をクリックします。
サーバーが実行中の場合、変更を有効にするにはサーバーを再起動する必要があります。サーバーを再起動するには、「サービス」ウィンドウを開き(「ウィンドウ」>「サービス」)、「サーバー」ノードの下で使用しているサーバーを右クリックし、「再起動」を選択します。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_pt_BR.asciidoc
index aeb6d77..813665e 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_pt_BR.asciidoc
@@ -94,12 +94,12 @@
image::images/java-name-location.png[title="Especifique o nome e a localização do seu projeto de aplicação"]
-[start=3]
+
. No painel Servidor e Definições, selecione o servidor em que deseja implantar a aplicação. Somente os servidores registrados no IDE estão listados.
image::images/java-server-settings.png[title="Especifique o servidor no qual sua aplicação será implantada"]
-[start=4]
+
. Aceite as outras definições default e clique em Finalizar. O projeto será gerado no sistema de arquivos e aberto no IDE.
Quando os projetos baseados em Java são criados, é gerado automaticamente um script de construção link:http://ant.apache.org/[+Ant+] que lhe permite compilar o projeto de forma que ele possa ser implantado imediatamente e executado em um servidor que tenha sido registrado no IDE.
@@ -147,7 +147,7 @@
----
-[start=2]
+
. Adicione algum texto explicativo para descrever a finalidade do campo de texto. Você pode copiar e colar no texto a seguir, no ponto logo abaixo das tags `<h1>`:
[source,html]
@@ -162,7 +162,7 @@
----
-[start=3]
+
. Adicione um form HTML à página. Faça isso utilizando os elementos listados na Paleta do IDE. Se a Paleta não estiver aberta, selecione Janela > Paleta no menu principal. Em seguida, em Forms HTML, clique e arraste um elemento Form para a página, um ponto abaixo das tags `<p>` que você acabou de adicionar. A caixa de diálogo Inserir Form será aberta. Especifique o seguinte:
* Ação: autocompletar código
@@ -174,7 +174,7 @@
Clique em OK. As tags HTML `<form>` serão inseridas na página que contém os atributos especificados. (GET é aplicado por default e, portanto, não é declarado explicitamente.)
-[start=4]
+
. Adicione uma tabela HTML à página. Na categoria HTML na Paleta, clique em um elemento Tabela e arraste-o para um ponto entre as tags `<form>`. A caixa de diálogo Inserir Tabela será aberta. Especifique o seguinte:
* Linhas: 2
@@ -184,7 +184,7 @@
image::images/insert-table.png[title="Caixa de diálogo Inserir tabela"]
-[start=5]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte e selecione Formatar. Isso limpa o código. Seu form agora deve ser semelhante ao abaixo:
[source,xml]
@@ -213,7 +213,7 @@
----
-[start=6]
+
. Na primeira linha da tabela, digite o seguinte texto na primeira coluna (alterações em *negrito*):
[source,xml]
@@ -222,7 +222,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=7]
+
. Na segunda coluna da primeira linha, em vez de arrastar um campo Entrada de Texto da Paleta, digite o código abaixo manualmente (alterações em *negrito*):
[source,xml]
@@ -292,7 +292,7 @@
O código acima executa um verificação simples de compatibilidade do browser para o Firefox 3 e para o Internet Explorer versões 6 e 7). Se desejar incorporar um código mais robusto para problemas de compatibilidade, considere usar este link:http://www.quirksmode.org/js/detect.html[+script de detecção de browser+] disponível em link:http://www.quirksmode.org[+http://www.quirksmode.org+].
-[start=4]
+
. Volte para a página do índice e adicione uma referência ao arquivo JavaScript entre as tags `<head>`.
[source,xml]
@@ -304,7 +304,7 @@
Você pode alternar rapidamente entre as páginas abertas no Editor de Código-fonte, pressionando Ctrl-Tab.
-[start=5]
+
. Insira uma chamada a `init()` na tag de abertura `<body>`.
[source,java]
@@ -463,7 +463,7 @@
Quando você clica em Finalizar, o IDE cria a classe e abre o arquivo no Editor de Código-fonte.
-[start=3]
+
. No Editor de Código-fonte, cole o seguinte código:
[source,java]
@@ -516,7 +516,7 @@
image::images/newservlet-name-location.png[]
-[start=3]
+
. No painel Configurar a Implantação do Servlet, altere o padrão do URL para *`/autocomplete`* para que ele corresponda ao URL que foi definido anteriormente no objeto `XMLHttpRequest`.
image::images/newservlet-configure-deployment.png[]
@@ -524,10 +524,10 @@
Esse painel elimina a necessidade de adicionar manualmente esses detalhes no descritor de implantação.
-[start=4]
+
. como opção, selecione "Adicionar informações do servlet ao descritor da implantação". Isso faz com que seu projeto seja o mesmo da amostra da qual fez download. Com versões posteriores do IDE, por default o servlet é registrado por uma anotação `@WebServlet`, em vez de um descritor da implantação. O projeto ainda funcionará se você usar a anotação `@WebServlet`, em vez de um descritor de implantação.
-[start=5]
+
. Clique em Finalizar. O servlet será criado e aberto no Editor de Código-fonte.
Os únicos métodos que você precisa substituir são `doGet()`, para definir como o servlet trataa solicitação `autocomplete` `GET`, e `init()`, que precisa iniciar um `ServletContext` de forma que o servlet possa acessar outras classes na aplicação, depois de ter sido posto em serviço.
@@ -538,15 +538,15 @@
image::images/insert-code.png[title="Menu pop-up Inserir Código exibido no Editor de Código-fonte"]
-[start=2]
+
. Selecione Substituir Método. Na caixa de diálogo que é exibida, todas as classes que `AutoCompleteServlet` herda são exibidas. Expanda o nó GenericServlet e selecione `init(Servlet Config config)`.
image::images/new-override.png[title="A caixa de diálogo Substituir lista classes herdadas"]
-[start=3]
+
. Clique em OK. O método `init()` é adicionado no Editor de Código-fonte.
-[start=4]
+
. Adicione uma variável para um objeto `ServletContext` e modifique `init()` (alterações em *negrito*):
[source,java]
@@ -560,7 +560,7 @@
}
----
-[start=5]
+
. Adicione uma instrução de importação para `ServletContext`. Você pode fazer isso clicando no ícone da lâmpada exibido na margem esquerda do Editor de Código-fonte
image::images/import-hint.png[title="Dicas de importação são exibidas na margem esquerda do Editor de Código-fonte"]
@@ -577,7 +577,7 @@
----
Isso cria um `HashMap` de todos os dados do composer, que é, em seguida, utilizado por `doGet()`.
-[start=2]
+
. Role para baixo para `doGet()` e implemente o método da seguinte forma:
[source,xml]
@@ -750,7 +750,7 @@
----
A segunda linha da tabela contém outra tabela HTML. Essa tabela representa a caixa autocompletar que será utilizada para preencher os nomes do composer.
-[start=2]
+
. Abra `javascript.js` no Editor de Código-fonte e as três variáveis seguintes no início do arquivo.
[source,java]
@@ -761,7 +761,7 @@
var autoRow;
----
-[start=3]
+
. Adicione as seguintes linhas (em *negrito*) na função `init()`.
[source,java]
@@ -776,7 +776,7 @@
----
Uma finalidade de `init()` é tornar os elementos que estão dentro da página de índice acessíveis para outras funções que modificarão o DOM da página de índice.
-[start=4]
+
. Adicione `appendComposer()` a `javascript.js`.
[source,java]
@@ -811,7 +811,7 @@
----
Essa função cria uma nova linha da tabela, insere um link em um criador utilizando os dados passados para a função por meio de seus três parâmetros e insere a linha no elemento `complete-table` da página de índice.
-[start=5]
+
. Adicione `getElementY()` a `javascript.js`.
[source,java]
@@ -837,7 +837,7 @@
*Observação: *Consulte link:http://www.quirksmode.org/js/findpos.html[+esta explicação+] de `offset` em link:http://www.quirksmode.org/[+http://www.quirksmode.org/+].
-[start=6]
+
. Adicione `clearTable()` a `javascript.js`.
[source,java]
@@ -854,7 +854,7 @@
----
Essa função define a exibição do elemento `complete-table` como "none" (ou seja, o torna invisível) e remove quaisquer entradas de nome de criador existentes que tenham sido criadas.
-[start=7]
+
. Modifique a função `callback()` para que chame `clearTable()` cada vez que novos dados forem recebidos do servidor. Quaisquer entradas do criador que já existam na caixa autocompletar serão, portanto, removidas, antes que esta seja preenchida com novas entradas.
[source,java]
@@ -872,7 +872,7 @@
}
----
-[start=8]
+
. Adicione `parseMessages()` a `javascript.js`.
[source,java]
@@ -974,10 +974,10 @@
*Observação.* Você precisará alterar o link para voltar à página de índice, se sua página de índice for ``index.jsp`` .
-[start=5]
+
. Crie outro arquivo JSP na pasta Páginas Web do projeto. Nomeie o arquivo de `error.jsp`.
-[start=6]
+
. Substitua o código do placeholder no `error.jsp` pelo seguinte código:
[source,html]
@@ -1027,7 +1027,7 @@
O movo arquivo será criado e aberto no editor.
-[start=3]
+
. Digite as seguintes regras em `stylesheet.css`, no editor. Você pode utilizar o suporte à funcionalidade autocompletar código do IDE pressionando Ctrl-Espaço nos pontos em que desejar acionar sugestões.
[source,java]
@@ -1097,7 +1097,7 @@
}
----
-[start=4]
+
. Abra a janela Estilos de CSS escolhendo Janela > Web > Estilos CSS.
image::images/css-styles-window.png[title="Janela Estilos de CSS exibindo as propriedades de regra h1"]
@@ -1105,7 +1105,7 @@
Você pode usar a janela Estilos de CSS para exibir rapidamente as propriedades e editar as regras de estilo. Quando você seleciona uma regra no painel superior da janela Estilo de CSS, pode ver as propriedades da regra no painel inferior. Você pode adicionar uma Regra de CSS à folha de estilos clicando no ícone Editar Regras de CSS (image:images/newcssrule.png[title="Ícone Nova Propriedade de CSS"]) na barra de ferramentas do painel superior. Você pode modificar as regras no painel inferior, editando a folha de propriedades, e adicionar propriedades clicando no ícone Adicionar Propriedade (image:images/newcssproperty.png[title="Ícone Nova Propriedade de CSS"]) na barra de ferramentas do painel inferior.
-[start=5]
+
. Alterne para a página no Editor de Código-fonte, e adicione uma referência à folha de estilo entre as tags `<head>`.
[source,java]
@@ -1114,7 +1114,7 @@
<link rel="stylesheet" type="text/css" href="stylesheet.css">
----
-[start=6]
+
. Adicione a classe `popupBox` que está definida na folha de estilo ao elemento `complete-table` (alterações em *negrito*).
[source,xml]
@@ -1156,7 +1156,7 @@
*Observação:* essa opção é exibida na guia Comum do GlassFish Server. Para Tomcat, ela reside na guia Conexão.
-[start=3]
+
. Clique em Fechar.
Se o servidor já estiver em execução, você precisará reiniciá-lo para permitir que as alterações tenham efeito. Você pode reiniciar o servidor, abrindo a janela Serviços (Janela > Serviços) e, em seguida, clicando com o botão direito do mouse no servidor embaixo do nó Servidores e selecionando Reiniciar.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ru.asciidoc
index 8ca6818..454646c 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_ru.asciidoc
@@ -94,12 +94,12 @@
image::images/java-name-location.png[title="Укажите имя проекта и местоположение проекта приложения"]
-[start=3]
+
. На панели "Сервер и параметры настройки" выберите сервер, на котором требуется выполнить развертывание приложения. В списке представлены только те серверы, которые зарегистрированы в среде IDE.
image::images/java-server-settings.png[title="Выберите сервер, на котором требуется выполнить развертывание приложения"]
-[start=4]
+
. Подтвердите остальные значения по умолчанию и нажмите кнопку "Готово". Проект создается в файловой системе и открывается в среде IDE.
При создании веб-проектов на основе Java автоматически создается сценарий сборки link:http://ant.apache.org/[+Ant+], отвечающий за компиляцию проекта, что позволяет немедленно развернуть и запустить его на сервере, зарегистрированном в среде IDE.
@@ -147,7 +147,7 @@
----
-[start=2]
+
. Для описания назначения текстового поля следует добавить соответствующий пояснительный текст. Непосредственно под тегами `<h1>` можно скопировать и вставить следующий текст:
[source,html]
@@ -162,7 +162,7 @@
----
-[start=3]
+
. Добавьте к странице форму HTML. Для этого можно использовать элементы, содержащиеся в палитре среды IDE. Если палитра не открыта, выберите в главном меню "Окно" > "Палитра". Затем перейдите к узлу "Формы HTML", выберите элемент "Форма" и перетащите его на страницу под только что добавленные теги `<p>`. Появится диалоговое окно "Вставить форму". Введите следующее:
* Действие: autocomplete
@@ -174,7 +174,7 @@
Нажмите кнопку "ОК". Теги HTML `<form>` вставляются в страницу, содержащую указанные атрибуты. (Метод GET применяется по умолчанию, и, следовательно, не объявляется явно).
-[start=4]
+
. Добавьте к странице таблицу HTML. В категории палитры "HTML" выберите элемент "Таблица" и перетащите его непосредственно под теги `<form>`. Откроется диалоговое окно "Вставить таблицу". Введите следующее:
* Строк: 2
@@ -184,7 +184,7 @@
image::images/insert-table.png[title="Диалоговое окно 'Вставить таблицу'"]
-[start=5]
+
. Щелкните правой кнопкой мыши редактор исходного кода и выберите команду "Форматировать". Последует выравнивание кода. Теперь форма должна выглядеть следующим образом:
[source,xml]
@@ -213,7 +213,7 @@
----
-[start=6]
+
. В первый столбец первой строки таблицы введите следующий текст (изменения выделены *полужирным шрифтом*):
[source,xml]
@@ -222,7 +222,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=7]
+
. Во второй столбец первой строки вместо перетаскивания поля "Ввод текста" из палитры введите указанный ниже код (изменения выделены *полужирным* шрифтом):
[source,xml]
@@ -292,7 +292,7 @@
С помощью этого кода выполняется простая проверка совместимости веб-браузеров Firefox 3 и Internet Explorer версий 6 и 7). Если требуется добавить более надежный код, устраняющий ошибки совместимости, используйте link:http://www.quirksmode.org/js/detect.html[+сценарий для определения браузера+] с веб-сайта link:http://www.quirksmode.org[+http://www.quirksmode.org+].
-[start=4]
+
. Вернитесь к странице индекса и добавьте ссылку на файл JavaScript между тегами `<head>`.
[source,xml]
@@ -304,7 +304,7 @@
Для быстрого перехода между страницами, открытыми в редакторе исходного кода, можно воспользоваться сочетанием клавиш CTRL+TAB.
-[start=5]
+
. Вставьте вызов `init()` после открывающего тега `<body>`.
[source,java]
@@ -463,7 +463,7 @@
После нажатия кнопки 'Готово' в IDE создается класс, а файл открывается в редакторе исходного кода.
-[start=3]
+
. В редакторе исходного кода вставьте следующий код:
[source,java]
@@ -516,7 +516,7 @@
image::images/newservlet-name-location.png[]
-[start=3]
+
. На панели 'Настройка развертывания сервлета' измените шаблон адреса URL *`/autocomplete`* таким образом, чтобы он соответствовал адресу URL, заданному ранее в объекте `XMLHttpRequest`.
image::images/newservlet-configure-deployment.png[]
@@ -524,10 +524,10 @@
Использование этой панели позволяет пропустить этап добавления дополнительных сведений вручную к дескриптору развертывания.
-[start=4]
+
. При желании выберите "Добавить информацию о сервлете в дескриптор развертывания". После выполнения этих действий созданный проект получится таким же, как загруженный пример. В последней версии среды IDE сервлет по умолчанию регистрируется аннотацией `@WebServlet` вместо регистрации в дескрипторе развертывания. Тем не менее, проект будет работать, если использовать аннотацию `@WebServlet` вместо дескриптора развертывания.
-[start=5]
+
. Нажмите кнопку "Завершить". Сервлет будет создан и открыт в редакторе исходного кода.
Единственными методами, которые следует переопределить, являются метод `doGet()` для определения обработки сервлетом запроса `autocomplete` `GET` и метод `init()`, который должен инициировать `ServletContext` для того, чтобы сервлет имел доступ к другим классам приложения после его запуска.
@@ -538,15 +538,15 @@
image::images/insert-code.png[title="Всплывающее меню 'Вставить код' отображается в в редакторе исходного кода"]
-[start=2]
+
. Выберите команду "Переопределить метод". В появившемся диалоговом окне отображаются все родительские классы сервлета `AutoCompleteServlet`. Разверните узел GenericServlet и выберите `init(Servlet Config config)`.
image::images/new-override.png[title="В диалоговом окне 'Переопределить' указаны унаследованные классы"]
-[start=3]
+
. Нажмите кнопку "ОК". Метод `init()` добавится в редактор исходного кода.
-[start=4]
+
. Добавьте переменную для объекта `ServletContext` и измените метод `init()` (изменения выделены *полужирным* шрифтом):
[source,java]
@@ -560,7 +560,7 @@
}
----
-[start=5]
+
. Добавьте оператор импорта для объекта `ServletContext`. Это можно сделать, выбрав значок лампочки, который отображается на экране в левом поле редактора исходного кода.
image::images/import-hint.png[title="Подсказки импорта отображаются в левом поле редактора исходного кода"]
@@ -577,7 +577,7 @@
----
При этом создается хранилище `HashMap`, включающее все данные о композиторах, которое затем используется методом `doGet()`.
-[start=2]
+
. Выполните прокрутку вниз до метода `doGet()` и реализуйте его следующим образом:
[source,xml]
@@ -750,7 +750,7 @@
----
Вторая строка таблицы содержит еще одну таблицу HTML. Эта таблица представляет поле автозавершения, используемое для автоматического ввода полных имен композиторов.
-[start=2]
+
. Откройте `javascript.js` в редакторе исходного кода и добавьте к первому фрагменту файла три следующих переменных:
[source,java]
@@ -761,7 +761,7 @@
var autoRow;
----
-[start=3]
+
. Добавьте следующие строки (выделенные *полужирным шрифтом*) к функции `init()`.
[source,java]
@@ -776,7 +776,7 @@
----
Одной из целей `init()` является предоставление доступа к элементам страницы индекса для других функций, используемых в целях изменения DOM страницы индекса.
-[start=4]
+
. Добавьте `appendComposer()` в `javascript.js`.
[source,java]
@@ -811,7 +811,7 @@
----
Эта функция позволяет создавать новую строку таблицы и вставлять в нее ссылку на композитора с использованием данных, передаваемых в функцию посредством соответствующих трех параметров, а затем вставлять эту строку в элемент `complete-table` страницы-указателя.
-[start=5]
+
. Добавьте `getElementY()` в `javascript.js`.
[source,java]
@@ -837,7 +837,7 @@
*Примечание.* См. link:http://www.quirksmode.org/js/findpos.html[+это описание+] `смещения` в link:http://www.quirksmode.org/[+http://www.quirksmode.org/+].
-[start=6]
+
. Добавьте `clearTable()` в `javascript.js`.
[source,java]
@@ -854,7 +854,7 @@
----
Эта функция позволяет скрывать элемент `complete-table` (т.е. делать его невидимым), но не удаляет какие-либо существующие записи имен композиторов, созданные ранее.
-[start=7]
+
. Для вызова `clearTable()` при каждом получении данных с сервера можно соответствующим образом изменить функцию `callback()`. Поэтому любые скомбинированные записи, существующие в окне автозавершения, удаляются до того, как выполняется заполнение новыми записями.
[source,java]
@@ -872,7 +872,7 @@
}
----
-[start=8]
+
. Добавьте `parseMessages()` в `javascript.js`.
[source,java]
@@ -974,10 +974,10 @@
*Примечание.* Если страница индекса имеет вид ``index.jsp`` , потребуется изменить ссылку для возврата на эту страницу.
-[start=5]
+
. Создайте еще один файл JSP в папке с веб-страницами проекта. Назовите файл `error.jsp`.
-[start=6]
+
. Измените код заглушки в файле `error.jsp` следующим кодом:
[source,html]
@@ -1027,7 +1027,7 @@
Новый файл будет создан и открыт в редакторе.
-[start=3]
+
. Введите следующие правила `stylesheet.css` в редакторе. При необходимости просмотра предложений можно использовать поддержку автозавершения кода среды IDE путем нажатия CTRL+ПРОБЕЛ.
[source,java]
@@ -1097,7 +1097,7 @@
}
----
-[start=4]
+
. Откройте окно стилей CSS, выбрав 'Окно' > 'Web'> 'Стили CSS'.
image::images/css-styles-window.png[title="Окно 'Стили CSS', в котором отображаются свойства правила h1"]
@@ -1105,7 +1105,7 @@
Можно использовать окно 'Стили CSS' для быстрого просмотра свойств и редактирования правил стилей. При выборе правила в верхней панели окна 'Стиль CSS' отображаются свойства правила в нижней панели. Можно добавить CSS правила к таблице стилей, нажав значок 'Изменить правила CSS' (image:images/newcssrule.png[title="Значок 'Новое свойство CSS'"]) на панели инструментов в верхней панели. Можно изменять правила в нижней панели путем редактирования таблицы свойств и добавления свойств, щелкнув значок 'Добавить свойство' (image:images/newcssproperty.png[title="Значок 'Новое свойство CSS'"]) на панели инструментов в нижней панели.
-[start=5]
+
. Перейдите на страницу индекса в редакторе исходного кода и добавьте ссылку на страницу стилей между тегами `<head>`.
[source,java]
@@ -1114,7 +1114,7 @@
<link rel="stylesheet" type="text/css" href="stylesheet.css">
----
-[start=6]
+
. Добавьте класс `popupBox`, определенный в таблице стилей, к элементу `complete-table` (начертание изменится на *жирное*).
[source,xml]
@@ -1156,7 +1156,7 @@
*Примечание.* Этот параметр отображается на вкладке 'Общие' для сервера GlassFish. На сервере Tomcat он расположен на вкладке "Соединение".
-[start=3]
+
. Выберите "Close" (Закрыть).
Если сервер уже запущен, необходимо перезапустить его для применения изменений. Сервер можно перезапустить, открыв окно 'Службы' (Window > 'Службы'), то щелкните правой кнопкой мыши сервер ниже узла 'Серверы' и выберите 'Перезапуск'.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_zh_CN.asciidoc
index ad896bf..a5e0adb 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/ajax-quickstart_zh_CN.asciidoc
@@ -94,12 +94,12 @@
image::images/java-name-location.png[title="为应用程序项目指定名称和位置"]
-[start=3]
+
. 在 "Server and Settings"(服务器和设置)面板中,选择要将您的应用程序部署到的服务器。这里仅列出了已在 IDE 中注册的服务器。
image::images/java-server-settings.png[title="指定应用程序将部署到的服务器"]
-[start=4]
+
. 接受其他默认设置,然后单击 "Finish"(完成)。项目在文件系统中生成,并在 IDE 中打开。
在创建基于 Java 的 Web 项目后,将自动构建用于编译该项目的 link:http://ant.apache.org/[+Ant+] 构建脚本,以便在 IDE 中注册的服务器上快速部署和运行该项目。
@@ -147,7 +147,7 @@
----
-[start=2]
+
. 添加一些说明性文本以介绍文本字段的用途。您可以复制以下文本并将其粘贴在 `<h1>` 标记下方的某一位置:
[source,html]
@@ -162,7 +162,7 @@
----
-[start=3]
+
. 向该页面中添加一个 HTML 窗体。可以利用 IDE "Palette"(组件面板)中列出的元素执行此操作。如果组件面板没有打开,请从主菜单中选择 "Window"(窗口)> "Palette"(组件面板)。然后,在 "HTML Forms"(HTML 窗体)下,单击某个窗体元素,并将其拖至该页面中您刚添加的 `<p>` 标记下的某一位置。此时将打开 "Insert Form"(插入窗体)对话框。指定以下内容:
* 操作:autocomplete
@@ -174,7 +174,7 @@
单击 "OK"(确定)。HTML `<form>` 标记已插入到包含您所指定的属性的页面中。(GET 在默认情况下应用,因此没有进行显式声明。)
-[start=4]
+
. 向该页面添加一个 HTML 表格。在 "Palette"(组件面板)中的 "HTML" 类别下,单击某个表格元素,并将其拖至 `<form>` 标记之间的位置。"Insert Table"(插入表格)对话框即打开。指定以下内容:
* "Rows"(行):2
@@ -184,7 +184,7 @@
image::images/insert-table.png[title=""Insert table"(插入表格)对话框"]
-[start=5]
+
. 在源代码编辑器中单击鼠标右键,然后选择 "Format"(格式化代码)。此操作将对代码进行整理。现在,您的窗体应该如下显示:
[source,xml]
@@ -213,7 +213,7 @@
----
-[start=6]
+
. 将以下文本键入到此表格第一行的第一列中(更改的内容以*粗体*显示):
[source,xml]
@@ -222,7 +222,7 @@
<td>*<strong>Composer Name:</strong>*</td>
----
-[start=7]
+
. 在第一行的第二列中,手动键入以下代码,而不是从组件面板中拖动 "Text Input"(文本输入)字段(更改的内容以*粗体*显示):
[source,xml]
@@ -292,7 +292,7 @@
以上代码将对 Firefox 3 以及 Internet Explorer 版本 6 和 7 执行简单的浏览器兼容性检查。如果希望包含更多强健的代码以处理兼容性问题,建议您使用 link:http://www.quirksmode.org[+http://www.quirksmode.org+] 中的link:http://www.quirksmode.org/js/detect.html[+浏览器检测脚本+]。
-[start=4]
+
. 切换回索引页,然后在 `<head>` 标记之间添加对 JavaScript 文件的引用。
[source,xml]
@@ -304,7 +304,7 @@
您可以按 Ctrl-Tab 组合键在源代码编辑器中打开的页面之间快速切换。
-[start=5]
+
. 在开始标记 `<body>` 中,插入对 `init()` 的调用。
[source,java]
@@ -463,7 +463,7 @@
单击“完成”,此时 IDE 将创建此类并在源代码编辑器中打开该文件。
-[start=3]
+
. 在源代码编辑器中,粘贴以下代码:
[source,java]
@@ -516,7 +516,7 @@
image::images/newservlet-name-location.png[]
-[start=3]
+
. 在 "Configure Servlet Deployment"(配置 Servlet 部署)面板中,将 URL 模式更改为 *`/autocomplete`*,使之与以前在 `XMLHttpRequest` 对象中设置的 URL 匹配。
image::images/newservlet-configure-deployment.png[]
@@ -524,10 +524,10 @@
此面板可以省去手动向部署描述符添加这些详细信息所需的步骤。
-[start=4]
+
. 也可以选择 "Add servlet information to deployment descriptor"(将 Servlet 信息添加到部署描述符)。这样,您的项目将与下载的样例相同。在使用 IDE 的高级版本时,默认情况下用 `@WebServlet` 标注而不是部署描述符来注册 Servlet。如果您使用 `@WebServlet` 标注而不是部署描述符,该项目仍将工作。
-[start=5]
+
. 单击 "Finish"(完成)。该 servlet 随即创建,并在源代码编辑器中打开。
您需要覆盖的方法只有 `doGet()`(该方法用于定义 servlet 处理 `autocomplete` `GET` 请求的方式)以及 `init()`(该方法需要启动一个 `ServletContext`,以便在应用程序提供服务时 servlet 可以访问该应用程序中的其他类)。
@@ -538,15 +538,15 @@
image::images/insert-code.png[title="源代码编辑器中显示的 "Insert Code"(插入代码)弹出式菜单"]
-[start=2]
+
. 选择 "Override Method"(覆盖方法)。在显示的对话框中,将显示 `AutoCompleteServlet` 继承的所有类。展开 GenericServlet 节点并选择 `init(Servlet Config config)`。
image::images/new-override.png[title=""Override"(覆盖)对话框列出继承的类"]
-[start=3]
+
. 单击 "OK"(确定)。`init()` 方法将添加到源代码编辑器中。
-[start=4]
+
. 为 `ServletContext` 对象添加一个变量并修改 `init()`(更改的内容以*粗体*显示):
[source,java]
@@ -560,7 +560,7 @@
}
----
-[start=5]
+
. 为 `ServletContext` 添加一个导入语句。通过单击源代码编辑器左旁注中显示的灯泡图标可以执行此操作
image::images/import-hint.png[title="导入提示显示在源代码编辑器的左旁注中"]
@@ -577,7 +577,7 @@
----
这将创建所有作曲家数据的 `HashMap`,然后由 `doGet()` 使用。
-[start=2]
+
. 向下滚动到 `doGet()` 并按如下方式实现该方法:
[source,xml]
@@ -750,7 +750,7 @@
----
此表格的第二行包含其他 HTML 表格。此表格表示将用于填写作曲家名字的自动完成框。
-[start=2]
+
. 在源代码编辑器中打开 `javascript.js`,并在文件顶部添加以下三个变量。
[source,java]
@@ -761,7 +761,7 @@
var autoRow;
----
-[start=3]
+
. 将以下行(以*粗体*显示)添加到 `init()` 函数中。
[source,java]
@@ -776,7 +776,7 @@
----
`init()` 的一个作用是使修改索引页 DOM 的其他函数可以访问索引页内的元素。
-[start=4]
+
. 将 `appendComposer()` 添加到 `javascript.js`。
[source,java]
@@ -811,7 +811,7 @@
----
此函数创建了一个新的表行,并用其所含的三个参数传递的数据将指向作曲家的链接插入此表行中,然后将此行插入索引页的 `complete-table` 元素中。
-[start=5]
+
. 将 `getElementY()` 添加到 `javascript.js`。
[source,java]
@@ -837,7 +837,7 @@
*注:*请在 link:http://www.quirksmode.org/[+http://www.quirksmode.org/+] 上查看 `offset` 的link:http://www.quirksmode.org/js/findpos.html[+说明+]。
-[start=6]
+
. 将 `clearTable()` 添加到 `javascript.js`。
[source,java]
@@ -854,7 +854,7 @@
----
此函数用于将 `complete-table` 元素的显示方式设置为“无”(也就是使其不可见),并删除所有已创建的现有作曲家名字条目。
-[start=7]
+
. 修改 `callback()` 函数以便每次从服务器接收到新数据时都调用 `clearTable()`。因此,在用新条目填充自动完成框之前其中已存在的任何作曲家条目均会删除。
[source,java]
@@ -872,7 +872,7 @@
}
----
-[start=8]
+
. 将 `parseMessages()` 添加到 `javascript.js`。
[source,java]
@@ -974,10 +974,10 @@
*注:*如果索引页为 ``index.jsp`` ,则需要更改链接以返回到该索引页。
-[start=5]
+
. 在该项目的“Web 页”文件夹下创建另一个 JSP 文件。将该文件命名为 `error.jsp`。
-[start=6]
+
. 将 `error.jsp` 中的占位符代码替换为以下代码:
[source,html]
@@ -1027,7 +1027,7 @@
此时会创建新文件,并在编辑器中打开。
-[start=3]
+
. 在编辑器的 `stylesheet.css` 中键入以下规则。您可以使用 IDE 的代码完成支持,方法是:在希望查看建议时按 Ctrl-空格组合键。
[source,java]
@@ -1097,7 +1097,7 @@
}
----
-[start=4]
+
. 选择 "Window"(窗口)> "Web" > "CSS Styles"(CSS 样式),打开 "CSS Styles"(CSS 样式)窗口。
image::images/css-styles-window.png[title=""CSS Styles"(CSS 样式)窗口显示 h1 规则属性"]
@@ -1105,7 +1105,7 @@
使用 "CSS Styles"(CSS 样式)窗口可以快速查看属性和编辑样式规则。当在 "CSS Styles"(CSS 样式)窗口的上方窗格中选择规则时,您可以在下方窗格中查看该规则的属性。单击上方窗格工具栏中的 "Edit CSS Rules"(编辑 CSS 规则)图标 (image:images/newcssrule.png[title=""New CSS Property"(新建 CSS 属性)图标"]),可以为样式表添加 CSS 规则。通过编辑属性表单可以在下方窗格中修改规则,通过单击下方窗格工具栏中的 "Add Property"(添加属性)图标 (image:images/newcssproperty.png[title=""New CSS Property"(新建 CSS 属性)图标"]) 可以添加属性。
-[start=5]
+
. 切换到源代码编辑器中的索引页,并在 `<head>` 标记之间添加对样式表的引用。
[source,java]
@@ -1114,7 +1114,7 @@
<link rel="stylesheet" type="text/css" href="stylesheet.css">
----
-[start=6]
+
. 将样式表中定义的 `popupBox` 类添加到 `complete-table` 元素中(更改的内容以*粗体*显示)。
[source,xml]
@@ -1156,7 +1156,7 @@
*注:*对于 GlassFish Server,此选项显示在 "Common"(通用)标签下。对于 Tomcat,则位于 "Connection"(连接)标签下。
-[start=3]
+
. 单击 "Close"(关闭)。
如果服务器已经运行,则必须重新启动服务器,更改才能生效。您可以通过以下方式重新启动服务器:打开 "Services"(服务)窗口("Window"(窗口)> "Services"(服务)),然后在 "Servers"(服务器)节点下右键单击您的服务器,并选择 "Restart"(重新启动)。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/applets.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/applets.asciidoc
index 0a1945f..21e372d 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/applets.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/applets.asciidoc
@@ -66,10 +66,10 @@
* If you are creating a new applet source file, select Java Class Library under Projects. Click Next.
* If you want to import an applet source file, select Java Project with Existing Sources. Click Next. Specify the file's location in the Source Packages Folder text box.
-[start=3]
+
. Under Project Name, type ``HelloApplet`` . Change the Project Location to any folder on your computer.
-[start=4]
+
. Click Finish. If you imported an applet source file, <<runanddebug,run it>>.
@@ -81,10 +81,10 @@
*Note:* For example, if you choose JDK 6 the applet might not run on machines that have an older version of the JRE or Java browser plugin.
-[start=3]
+
. Right-click the HelloApplet project node in the Projects window and select New > Other (Ctrl-N).
-[start=4]
+
. Under Categories, select Java. Under File Types, select Applet.
Alternatively, if you want to visually design your applet, select Swing GUI Forms > JApplet Form.
@@ -92,16 +92,16 @@
Click Next.
-[start=5]
+
. Under Class Name, type ``MyApplet`` . Under Package, type ``org.me.hello`` .
-[start=6]
+
. Click Finish.
The IDE creates the applet source file in the specified package. The applet source file opens in the Source editor.
-[start=7]
+
. Define your applet class by copying and pasting the following code over the existing default code:
[source,java]
@@ -177,13 +177,13 @@
* If you are using an applet JAR file that is not in an IDE project click Add File/Folder and locate the folder that contains the JAR file. Click Choose.
-[start=4]
+
. Confirm that the JAR that contains the applet source file is listed in the table in the Project Properties window. Click OK.
By default, the applet JAR file will be copied to the web application's web page library, which is the ``build/web `` folder. The ``build/web `` folder is the root directory of the application and is displayed as " ``/`` " in the Path in WAR column of the table. You can modify the location of the applet in the WAR by typing a new location for the applet in the Path in WAR column.
-[start=5]
+
. Click Close to close the Project Properties window.
When you build the ``HelloWebApplet`` project by choosing Run > Build Project (HelloWebApplet) from the main IDE's menu, the applet's JAR file is generated in the original ``HelloApplet`` project and is packaged in the ``HelloWebApplet`` project's WAR file. It is also added to the ``build/web`` folder. You can follow this process in the Output window and see the results in the Files window.
@@ -200,7 +200,7 @@
* If you want to embed the applet in a JSP file, double-click the default ``index.jsp`` file in the Projects window. This file is created by the IDE when you create a web project. It opens in the Source Editor.
* If you want to embed the applet in an HTML file, right-click the HelloWebApplet project node, and choose New > Other from the contextual menu. Under Categories, select Web. Under File Types, select HTML. Click Next. Give your HTML file a name, select the Web folder for its location, and click Finish.
-[start=2]
+
. Embed the applet in the file by adding the following applet tag anywhere between the file's ``<body>`` ``</body>`` tags:
* In an HTML file: [examplecode]# ``<applet code="org.me.hello.MyApplet" archive="HelloApplet.jar"></applet>`` #
@@ -212,7 +212,7 @@
* ``org.me.hello.MyApplet`` is the full classname to your applet.
* ``HelloApplet.jar`` is the JAR file that contains the applet.
-[start=3]
+
. Right-click the JSP node or HTML node in the Projects window and choose Run File from the contextual menu.
The server deploys the JSP file or HTML file in the IDE's default browser.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/applets_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/applets_ja.asciidoc
index 0c1030e..29c28ed 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/applets_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/applets_ja.asciidoc
@@ -66,10 +66,10 @@
* 新しいアプレット・ソース・ファイルを作成する場合、「プロジェクト」の下の「Javaクラス・ライブラリ」を選択します。「次」をクリックします。
* アプレット・ソース・ファイルをインポートする場合、既存のソースがあるJavaプロジェクトを選択します。「次」をクリックします。「ソース・パッケージのフォルダ」テキスト・ボックスで、ファイルの場所を指定します。
-[start=3]
+
. 「プロジェクト名」に「 ``HelloApplet`` 」と入力します。「プロジェクトの場所」をローカル・コンピュータ上の任意のフォルダに変更します。
-[start=4]
+
. 「終了」をクリックします。アプレット・ソース・ファイルをインポートした場合は、<<runanddebug,それを実行>>します。
@@ -81,10 +81,10 @@
*注意: *たとえば、JDK 6を選択した場合、それより古いバージョンのJREまたはJavaブラウザ・プラグインが存在するマシンでは、アプレットが動作しない可能性があります。
-[start=3]
+
. 「プロジェクト」ウィンドウの「HelloApplet」プロジェクト・ノードを右クリックし、「新規」>「その他」([Ctrl]-[N])を選択します。
-[start=4]
+
. 「カテゴリ」から「Java」を選択します。「ファイル・タイプ」から「アプレット」を選択します。
または、新しいアプレットを視覚的にデザインする場合、「Swing GUIフォーム」>「JAppletフォーム」を選択します。
@@ -92,16 +92,16 @@
「次」をクリックします。
-[start=5]
+
. 「クラス名」に「 ``MyApplet`` 」と入力します。「パッケージ」に「 ``org.me.hello`` 」と入力します。
-[start=6]
+
. 「終了」をクリックします。
IDEで、アプレット・ソース・ファイルが指定したパッケージ内に作成されます。ソース・エディタが開いて、アプレット・ソース・ファイルが表示されます。
-[start=7]
+
. 既存のデフォルト・コードの上に次のコードを コピーして貼り付け、アプレット・クラスを定義します。
[source,java]
@@ -177,13 +177,13 @@
* IDEプロジェクト内にないアプレットJARファイルを使用している場合、「ファイル/フォルダの追加」をクリックし、JARファイルを含むフォルダを特定します。「選択」をクリックします。
-[start=4]
+
. アプレットのソース・ファイルを含むJARが「プロジェクト・プロパティ」ウィンドウの表にリストされていることを確認します。「OK」をクリックします。
デフォルトでは、アプレットJARファイルはWebアプリケーションのWebページ・ライブラリ( ``build/web`` フォルダ)にコピーされます。 ``build/web`` フォルダはアプリケーションのルート・ディレクトリで、表の「WAR内のパス」列に" ``/`` "と表示されます。「WAR内のパス」列にアプレットの新しい場所を入力すると、WAR内のアプレットの場所を変更できます。
-[start=5]
+
. 「閉じる」をクリックして、「プロジェクト・プロパティ」ウィンドウを閉じます。
IDEのメイン・メニューから「実行」>「プロジェクトのビルド(HelloWebApplet)」を選択して ``HelloWebApplet`` プロジェクトをビルドすると、アプレットのJARファイルが元の ``HelloApplet`` プロジェクト内に生成され、 ``HelloWebApplet`` プロジェクトのWARファイルにパッケージ化されます。 ``build/web`` フォルダにも追加されます。この処理を「出力」ウィンドウで追跡し、結果を「ファイル」ウィンドウで確認できます。
@@ -200,7 +200,7 @@
* アプレットをJSPファイルに埋め込む場合は、「プロジェクト」ウィンドウにあるデフォルトの ``index.jsp`` ファイルをダブルクリックします。このファイルは、Webプロジェクトの作成時にIDEで作成されます。ソース・エディタにこのファイルが表示されます。
* アプレットをHTMLファイルに埋め込む場合は、「HelloWebApplet」プロジェクト・ノードを右クリックし、コンテキスト・メニューから「新規」>「その他」を選択します。「カテゴリ」から「Web」を選択します。「ファイル・タイプ」から「HTML」を選択します。「次」をクリックします。HTMLファイルに名前を付け、その場所としてWebフォルダを選択し、「終了」をクリックします。
-[start=2]
+
. 次のように、ファイルの ``<body>`` ``</body>`` の2つのタグの間の任意の場所にアプレット・タグを追加することで、アプレットをファイルに埋め込みます。
* HTMLファイル内: [examplecode]# ``<applet code="org.me.hello.MyApplet" archive="HelloApplet.jar"></applet>`` #
@@ -212,7 +212,7 @@
* ``org.me.hello.MyApplet`` はアプレットの完全クラス名です。
* ``HelloApplet.jar`` はアプレットを格納するJARファイル名です。
-[start=3]
+
. 「プロジェクト」ウィンドウでこのJSPノードまたはHTMLノードを右クリックし、コンテキスト・メニューから「ファイルを実行」を選択します。
サーバーによって、JSPファイルまたはHTMLファイルがIDEのデフォルト・ブラウザにデプロイされます。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/applets_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/applets_pt_BR.asciidoc
index bfb5ab2..89719c4 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/applets_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/applets_pt_BR.asciidoc
@@ -66,10 +66,10 @@
* Se você estiver criando um novo código-fonte de applet, selecione Biblioteca de Classe Java em Projetos. Clique em Próximo.
* Se você quiser importar um arquivo de código-fonte de applet, selecione Projeto Java com Códigos-Fonte existentes. Clique em Próximo. Especifique a localização do arquivo na caixa de texto Pasta de Pacotes de Códigos-Fonte.
-[start=3]
+
. Em Nome do Projeto, Digite ``HelloApplet`` . Altere o Local do Projeto para qualquer pasta do computador.
-[start=4]
+
. Clique em Finalizar. Se você tiver importado um arquivo de código-fonte do applet, <<runanddebug,execute-o>>.
@@ -81,10 +81,10 @@
*Observação:* Por exemplo, se selecionar JDK 6, o applet poderá não ser executado em máquinas que tenham uma versão mais antiga do plug-in JRE ou do browser Java.
-[start=3]
+
. Clique com o botão direito do mouse no nó do projeto HelloApplet na janela Projetos e selecione Novo > Outro (Ctrl-N).
-[start=4]
+
. Em Categorias, selecione Java. Em Tipos de Arquivos, selecione Applet.
Como alternativa, se você quiser criar visualmente o applet, selecione Forms de GUI do Swing > Form JApplet.
@@ -92,16 +92,16 @@
Clique em Próximo.
-[start=5]
+
. Em Nome da Classe, Digite ``MyApplet`` . Em Pacote, digite ``org.me.hello`` .
-[start=6]
+
. Clique em Finalizar.
O IDE criará o arquivo de código-fonte do applet no pacote especificado. O arquivo de código-fonte do applet será aberto no editor de Código-fonte.
-[start=7]
+
. Defina a classe do seu applet, copiando e colando o seguinte código sobre o código default existente:
[source,java]
@@ -177,13 +177,13 @@
* Se estiver usando um arquivo JAR do applet que não está no projeto IDE, clique em Adicionar Arquivo/Pasta e localize a pasta que contém o arquivo JAR. Clique em Escolher.
-[start=4]
+
. Confirme se o JAR que contém o arquivo do código-fonte do applet está listado na tabela na janela Propriedades do Projeto. Clique em OK.
Por default, o arquivo JAR do applet será copiado para a biblioteca da página Web da aplicação Web, que é a pasta ``build/web `` . A pasta ``build/web `` é o diretório-raiz da aplicação e é exibido como " ``/`` " no Caminho na coluna WAR da tabela. Você pode modificar a localização do applet no WAR digitando uma nova localização para o applet no Caminho na coluna WAR.
-[start=5]
+
. Clique em Fechar para fechar a janela Propriedades do Projeto.
Quando você constrói o projeto ``HelloWebApplet`` escolhendo Executar > Construir Projeto (HelloWebApplet) no menu principal do IDE, o arquivo JAR do applet é gerado no projeto ``HelloApplet`` original e é encapsulado no arquivo WAR do projeto ``HelloWebApplet`` . Ele também é adicionado à pasta ``build/web`` . Você pode seguir este processo na janela de Saída e ver os resultados na janela Arquivos.
@@ -200,7 +200,7 @@
* Se você quiser incorporar o applet em um arquivo JSP, clique duas vezes no arquivo ``index.jsp`` default na janela Projetos. Esse arquivo é criado pelo IDE quando você cria um projeto Web. Ele será aberto no Editor de Código-fonte.
* Se você quiser incorporar o applet em um arquivo HTML, clique com o botão direito do mouse no nó do projeto HelloWebApplet e selecione Novo > Outro a partir do menu de contexto. Em Categorias, selecione Web. Em Tipos de Arquivos, selecione HTML. Clique em Próximo. Forneça um nome para seu arquivo HTML, selecione a pasta Web como sua localização e clique em Finalizar.
-[start=2]
+
. Incorpore o applet no arquivo, adicionando a seguinte tag de applet em qualquer local entre as tags ``<body>`` ``</body>`` do arquivo:
* Em um arquivo HTML: [examplecode]# ``<applet code="org.me.hello.MyApplet" archive="HelloApplet.jar"></applet>`` #
@@ -212,7 +212,7 @@
* ``org.me.hello.MyApplet`` é o nome de classe completo para seu applet.
* ``HelloApplet.jar`` é o arquivo JAR que contém o applet.
-[start=3]
+
. Clique com o botão direito do mouse no nó JSP ou no nó HTML na janela Projetos e selecione Executar Arquivo no menu de contexto.
O servidor implanta o arquivo JSP ou o arquivo HTML no browser default do IDE.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/applets_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/applets_ru.asciidoc
index 3893948..4631439 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/applets_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/applets_ru.asciidoc
@@ -66,10 +66,10 @@
* Для создания нового исходного файла в области "Проекты" выберите пункт "Библиотека классов Java". Нажмите кнопку "Далее".
* Для импорта исходного файла апплета выберите пункт "Проект Java с существующим исходным кодом". Нажмите кнопку "Далее". Укажите местоположение файла в текстовом поле "Папка с исходными файлами".
-[start=3]
+
. В поле "Имя проекта" введите ``HelloApplet`` . В области "Расположение проекта" укажите любую папку на своем компьютере.
-[start=4]
+
. Нажмите кнопку "Завершить". Если файл исходного кода апплета был импортирован, <<runanddebug,запустите его>>.
@@ -81,10 +81,10 @@
*Примечание.* Если выбрана версия JDK 1.6, апплет может не запускаться на компьютерах, на которых установлена предыдущая версия JRE или подключаемого модуля Java для браузера.
-[start=3]
+
. Нажмите узел HelloApplet в окне "Проекты" и выберите "Новый" > "Другое" (Ctrl-N).
-[start=4]
+
. В области "Категории" выберите "Java". В области "Типы файлов" выберите "Апплет".
Если же нужно использовать визуальные средства для разработки апплета, выберите "Формы Swing GUI" > "Форма JApplet".
@@ -92,16 +92,16 @@
Нажмите кнопку "Далее".
-[start=5]
+
. В области "Имя класса" введите ``MyApplet`` . В поле "Пакет" введите ``org.me.hello`` .
-[start=6]
+
. Нажмите кнопку "Завершить".
Среда IDE создает исходный файл апплет в указанном пакете. Исходный файл апплета открывается в редакторе исходного кода.
-[start=7]
+
. Определите класс своего апплета, заменив существующий стандартный код следующим кодом:
[source,java]
@@ -177,13 +177,13 @@
* Если используемый файл апплета JAR не входит в проект IDE, нажмите 'Добавить файл/папку' и найдите папку с файлом JAR. Нажмите 'Выбрать'.
-[start=4]
+
. Убедитесь, что JAR с исходным файлом апплета отображается в таблице в окне 'Свойства проекта'. Нажмите кнопку "ОК".
По умолчанию файл JAR апплета будет скопирован в библиотеку страницы веб-приложения (папку ``build/web `` ). Папка ``build/web `` является корневым каталогом приложения и отображается в таблице как " ``/`` " в переменной Path в столбце WAR. Вы можете изменить расположение апплета в WAR. Для этого введите новое расположение апплета в переменной Path в столбце WAR.
-[start=5]
+
. Нажмите ОК, чтобы закрыть диалоговое окно 'Свойства проекта'.
При сборке проекта ``HelloWebApplet`` с помощью команды 'Выполнить > Собрать проект (HelloWebApplet)' главного меню IDE JAR-файл апплета создается в исходном проекте ``HelloApplet`` и упаковывается в WAR-файл проекта ``HelloWebApplet`` . Он также добавляется в папку ``build/web`` . Следить за процессом можно в окне "Результат", а конечный результат можно посмотреть в окне "Файлы".
@@ -200,7 +200,7 @@
* Если необходимо встроить апплет в файл JSP, дважды нажмите стандартный файл ``index.jsp`` в окне "Свойства". Этот файл создается средой IDE при создании веб-проекта. Файл открывается в редакторе исходного кода.
* Если необходимо внедрить апплет в файл HTML, щелкните правой кнопкой мыши узел проекта HelloWebApplet и выберите 'Создать' > 'Другие' в контекстном меню. В области "Категории" выберите "Web". В области "Типы файлов" выберите HTML. Нажмите кнопку "Далее". Укажите название файла HTML, выберите папку Web (она расположена в нужном месте) и нажмите "Завершить".
-[start=2]
+
. Встройте апплет в файл, добавив следующий тег апплета в любом месте в рамках тегов ``<body>`` ``</body>`` .
* В файле HTML: [examplecode]# ``<applet code="org.me.hello.MyApplet" archive="HelloApplet.jar"></applet>`` #
@@ -212,7 +212,7 @@
* ``org.me.hello.MyApplet`` - полное имя класса апплета.
* ``HelloApplet.jar`` - файл JAR, содержащий апплет.
-[start=3]
+
. В окне "Проекты" щелкните узел JSP или HTML правой кнопкой мыши и в контекстном меню выберите "Выполнить файл".
Сервер развертывает файл JSP или HTML в браузере среды IDE, установленном по умолчанию.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/applets_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/applets_zh_CN.asciidoc
index 59df714..3f2c29a 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/applets_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/applets_zh_CN.asciidoc
@@ -66,10 +66,10 @@
* 如果是创建一个新的小应用程序源文件,请在 "Projects"(项目)下选择 "Java Class Library"(Java 类库)。单击 "Next"(下一步)。
* 如果想导入小应用程序源文件,则选择 "Java Project with Existing Sources"(基于现有源代码的 Java 项目)。单击 "Next"(下一步)。在 "Source Packages Folder"(源包文件夹)文本框中指定该文件的位置。
-[start=3]
+
. 在 "Project Name"(项目名称)下,键入 ``HelloApplet`` 。将 "Project Location"(项目位置)更改为计算机上的任意文件夹。
-[start=4]
+
. 单击 "Finish"(完成)。如果已导入一个小应用程序源文件,则<<runanddebug,运行该文件>>。
@@ -81,10 +81,10 @@
*注:*例如,如果选择 JDK 6,则小应用程序可能不会在具有旧版本 JRE 或 Java 浏览器插件的计算机上运行。
-[start=3]
+
. 右键单击 "Projects"(项目)窗口中的 HelloApplet 项目节点,然后选择 "New"(新建)> "Other"(其他)(Ctrl-N 组合键)。
-[start=4]
+
. 在 "Categories"(类别)下,选择 "Java"。在 "File Types"(文件类型)下,选择 "Applet"(小应用程序)。
或者,如果想以可视方式设计您的小应用程序,则选择 "Swing GUI Forms"(Swing GUI 窗体)> "JApplet Form"(JApplet 窗体)。
@@ -92,16 +92,16 @@
单击 "Next"(下一步)。
-[start=5]
+
. 在 "Class Name"(类名)下,键入 ``MyApplet`` 。在 "Package"(包)下,键入 ``org.me.hello`` 。
-[start=6]
+
. 单击 "Finish"(完成)。
IDE 会在指定的包中创建小应用程序源文件。小应用程序源文件会在源代码编辑器中打开。
-[start=7]
+
. 通过复制以下代码并将其粘贴到现有默认代码上来定义您的小应用程序类:
[source,java]
@@ -177,13 +177,13 @@
* 如果您使用的小应用程序 JAR 文件不在 IDE 项目中,请单击 "Add File/Folder"(添加文件/文件夹),然后查找包含该 JAR 文件的文件夹。单击 "Choose"(选择)。
-[start=4]
+
. 确认在 "Project Properties"(项目属性)窗口的表中列出包含小应用程序源文件的 JAR。单击 "OK"(确定)。
默认情况下,会将小应用程序 JAR 文件复制到 Web 应用程序的 Web 页库,即 ``build/web `` 文件夹中。 ``build/web`` 文件夹是应用程序的根目录,且在表 WAR 列的 "Path"(路径)中显示为 " ``/`` "。通过在 WAR 列的 "Path"(路径)中键入小应用程序的新位置,可以修改 WAR 中的小应用程序位置。
-[start=5]
+
. 单击 "Close"(关闭)以关闭 "Project Properties"(项目属性)窗口。
在构建 ``HelloWebApplet`` 项目(从 IDE 的主菜单中选择 "Run"(运行)> "Build Project (HelloWebApplet)"(构建项目 (HelloWebApplet)))时,小应用程序的 JAR 文件将在原始的 ``HelloApplet`` 项目中生成,并在 ``HelloWebApplet`` 项目的 WAR 文件中打包。还会将其添加到 ``build/Web`` 文件夹中。可在 "Output"(输出)窗口中执行此过程,并在 "Files"(文件)窗口中查看结果。
@@ -200,7 +200,7 @@
* 如果想将小应用程序嵌入到 JSP 文件中,则在 "Projects"(项目)窗口中,双击默认的 ``index.jsp`` 文件。当创建 Web 项目时,由 IDE 创建该文件。将在源代码编辑器中打开该文件。
* 如果想将小应用程序嵌入到 HTML 文件中,则右键单击 HelloWebApplet 项目节点,然后从上下文菜单中选择 "New"(新建)> "Other"(其他)。在 "Categories"(类别)下,选择 "Web"。在 "File Types"(文件类型)下,选择 "HTML"。单击 "Next"(下一步)。指定 HTML 文件的名称,选择 Web 文件夹作为其位置,然后单击 "Finish"(完成)。
-[start=2]
+
. 通过在文件的 ``<body>`` ``</body>`` 标记之间的任意位置添加以下小应用程序标记,将小应用程序嵌入到该文件中:
* 在 HTML 文件中:[examplecode]# ``<applet code="org.me.hello.MyApplet" archive="HelloApplet.jar"></applet>`` #
@@ -212,7 +212,7 @@
* ``org.me.hello.MyApplet`` 是您的小应用程序的完整类名。
* ``HelloApplet.jar`` 是包含此小应用程序的 JAR 文件。
-[start=3]
+
. 右键单击 "Projects"(项目)窗口中的 JSP 节点或 HTML 节点,然后从上下文菜单中选择 "Run File"(运行文件)。
服务器将 JSP 文件或 HTML 文件部署在 IDE 的默认浏览器中。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support.asciidoc
index df6e249..d3acf51 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support.asciidoc
@@ -94,13 +94,13 @@
NetBeans plugins can be identified by the ``.nbm`` extension.
-[start=2]
+
. From the IDE's main menu, choose Tools > Plugins to open the Plugin Manager.
-[start=3]
+
. Select the Downloaded tab, then click the Add Plugins button.
-[start=4]
+
. In the Add Plugins dialog, navigate to the directory that contains the plugins and select the NetBeans plugins. Click Open.
image::images/plugin-archive-contents.png[title="The zip archive contains the NetBeans plugins"]
@@ -108,7 +108,7 @@
Hold down the Ctrl key to select multiple items.
-[start=5]
+
. In the Plugins manager, select each of the Struts2 plugins.
A description of the selected plugin is displayed in the right pane of the Plugins manager.
@@ -120,13 +120,13 @@
--
-[start=6]
+
. Click Install to open the NetBeans IDE Installer, then click Next and accept the license agreement.
*Note.* If you receive a validation warning, click Continue to install the plugin. A validation warning occurs if you attempt to install a plugin that has not been signed. While you can generally trust all plugins, when you install a plugin that has not been signed, you are doing so at your own risk.
-[start=7]
+
. Restart the IDE to allow changes to take effect.
After you install the plugin and restart the IDE, you can confirm that the plugin was installed by opening the Plugins manager, clicking the Installed tab and locating the plugin in the list of installed plugins.
@@ -221,12 +221,12 @@
When you select Frameworks, the right panel displays a Used Frameworks text area, which is empty if the application does not use a framework.
-[start=3]
+
. Click the Add button, then select the framework you want to use and click OK.
image::images/properties-add-framework.png[title="JavaServer Faces framework selected in the Add Framework dialog opened from the Project Properties window"]
-[start=4]
+
. Depending on the chosen framework, you can specify further framework-specific configuration settings or components in the Project Properties window.
image::images/add-icefaces.png[title="Adding a library for the ICEfaces component suite to the project"]
@@ -236,7 +236,7 @@
*Notes.* The libraries for JSF components are not included with the IDE. To use a component suite you need to download the required libraries and then create a NetBeans library that you can then add to the project classpath in the Project Properties window.
-[start=5]
+
. Click OK to confirm your selection and close the Project Properties window. The framework-specific artifacts and libraries are added to your project, which you can examine in the Projects window.
link:/about/contact_form.html?to=3&subject=Feedback:%20Adding%20Web%20Framework%20Support[+ Send Feedback on This Tutorial+]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ja.asciidoc
index 506458d..6d8befe 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ja.asciidoc
@@ -94,13 +94,13 @@
NetBeansプラグインは ``.nbm`` 拡張子によって識別できます。
-[start=2]
+
. IDEのメイン・メニューから、「ツール」>「プラグイン」を選択し、プラグイン・マネージャを開きます。
-[start=3]
+
. 「ダウンロード済」タブを選択し、「プラグインの追加」ボタンをクリックします。
-[start=4]
+
. 「プラグインの追加」ダイアログで、プラグインが入っているディレクトリに移動し、NetBeansプラグインを選択します。「開く」をクリックします。
image::images/plugin-archive-contents.png[title="NetBeansプラグインが含まれているzipアーカイブ"]
@@ -108,7 +108,7 @@
[Ctrl]キーを押しながら、複数の項目を選択します。
-[start=5]
+
. プラグイン・マネージャで、各Struts2プラグインを選択します。
プラグイン・マネージャの右ペインには、選択したプラグインの説明が表示されます。
@@ -120,13 +120,13 @@
--
-[start=6]
+
. 「インストール」をクリックしてNetBeans IDEインストーラを開き、「次」をクリックしてライセンス契約書に同意します。
*注意:*検証の警告が表示された場合、「続行」をクリックしてプラグインをインストールします。署名のないプラグインをインストールしようとすると、検証の警告が発生します。一般に、プラグインはすべて信頼できますが、署名のないプラグインをインストールする場合は自己責任で実行してください。
-[start=7]
+
. 変更を有効にするには、IDEを再起動します。
プラグインをインストールしてIDEを再起動した後、プラグイン・マネージャを開き、「インストール済」タブをクリックし、インストール済プラグインのリストでプラグインを見つけることで、プラグインがインストールされたことを確認できます。
@@ -221,12 +221,12 @@
「フレームワーク」を選択すると、右パネルに「使用しているフレームワーク」テキスト領域が表示されます。アプリケーションがフレームワークを使用していない場合、この領域は空です。
-[start=3]
+
. 「追加」ボタンをクリックし、使用するフレームワークを選択して、「OK」をクリックします。
image::images/properties-add-framework.png[title="「プロジェクト・プロパティ」ウィンドウから開かれた「フレームワークの追加」ダイアログで選択されたJavaServer Facesフレームワーク"]
-[start=4]
+
. 選択したフレームワークに応じて、「プロジェクト・プロパティ」ウィンドウでフレームワーク固有の構成設定またはコンポーネントをさらに指定できます。
image::images/add-icefaces.png[title="プロジェクトへのICEfacesコンポーネント・スイートのライブラリの追加"]
@@ -236,7 +236,7 @@
*注意:*JSFコンポーネントのライブラリは、IDEに含まれていません。コンポーネント・スイートを使用するには、必要なライブラリをダウンロードし、「プロジェクト・プロパティ」ウィンドウでプロジェクト・クラスパスに追加できるNetBeansライブラリを作成する必要があります。
-[start=5]
+
. 「OK」をクリックして選択内容を確認し、「プロジェクト・プロパティ」ウィンドウを閉じます。フレームワーク固有のアーティファクトとライブラリがプロジェクトに追加され、「プロジェクト」ウィンドウで確認できます。
link:/about/contact_form.html?to=3&subject=Feedback:%20Adding%20Web%20Framework%20Support[+ このチュートリアルに関するご意見をお寄せください+]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_pt_BR.asciidoc
index fa6a907..c47e54b 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_pt_BR.asciidoc
@@ -94,13 +94,13 @@
Os plug-ins do NetBeans podem ser identificados pela extensão ``.nbm`` .
-[start=2]
+
. No menu principal do IDE, selecione Ferramentas > Plug-ins para abrir o Gerenciador de Plug-ins.
-[start=3]
+
. Selecione a guia Download e clique no botão Adicionar Plug-ins.
-[start=4]
+
. Na caixa de diálogo Adicionar Plug-ins, navegue para o diretório que contém os plug-ins e selecione Plug-ins do NetBeans. Clique em Abrir.
image::images/plugin-archive-contents.png[title="O arquivo compactado zip contém os plug-ins do NetBeans"]
@@ -108,7 +108,7 @@
Mantenha pressionada a tecla Ctrl para selecionar vários itens.
-[start=5]
+
. No gerenciador de Plug-ins, selecione cada um dos plug-ins do Struts 2.
Uma descrição do plug-in selecionado será exibida no painel direito do gerenciador de Plug-ins.
@@ -120,13 +120,13 @@
--
-[start=6]
+
. Clique em Instalar para abrir o Instalador do NetBeans IDE e, em seguida, clique em Próximo e aceite o contrato de licença.
*Observação.* Se você receber uma advertência de validação, clique em Continuar para instalar o plug-in. Um advertência de validação ocorre se você tentar instalar um plug-in que não foi assinado. Embora você geralmente possa confiar em todos os plug-ins, quando instala um plug-in que não foi assinado, estará fazendo isso por seu próprio risco.
-[start=7]
+
. Reinicie o IDE para que as alterações tenham efeito.
Depois de ter instalado o plug-in e reiniciado o IDE, você poderá confirmar se o plug-in foi instalado ao abrir o gerenciador de Plug-ins, clicando na guia Instalados e localizando o plug-in na lista de plug-ins instalados.
@@ -221,12 +221,12 @@
Quando você selecionar Frameworks o painel direito exibe uma área de texto de Frameworks Usado, que fica vazia caso a aplicação não usa um framework.
-[start=3]
+
. Clique no botão Adicionar e, em seguida, selecione o framework que deseja usar e clique em OK.
image::images/properties-add-framework.png[title="Framework JavaServer Faces selecionado na caixa de diálogo Adicionar Framework aberta na janela Propriedades do Projeto"]
-[start=4]
+
. Dependendo do framework escolhido, você pode especificar definições ou componentes de configuração específicas do framework na janela Propriedades do Projeto.
image::images/add-icefaces.png[title="Adicionando uma biblioteca do conjunto de componentes ICEfaces ao projeto"]
@@ -236,7 +236,7 @@
*Observações.* As bibliotecas dos componentes JSF não estão incluídas no IDE. Para usar um conjunto de componentes você precisa fazer download das bibliotecas necessárias e, em seguida, criar uma biblioteca NetBeans que você pode adicionar ao classpath do projeto na janela Propriedades do Projeto.
-[start=5]
+
. Clique em OK para confirmar sua seleção e feche a janela Propriedades do Projeto. Os artefatos e bibliotecas específicos do framework são adicionados ao seu projeto, que você pode examinar na janela Projetos.
link:/about/contact_form.html?to=3&subject=Feedback:%20Adding%20Web%20Framework%20Support[+ Enviar Feedback neste Tutorial+]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ru.asciidoc
index 58e863b..3b99b49 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_ru.asciidoc
@@ -94,13 +94,13 @@
Подключаемые модули NetBeans можно опознать по их расширению ``.nbm`` .
-[start=2]
+
. Из основного меню среды IDE выберите Tools ("Сервис") > Plugins ("Подключаемые модули") для открытия диспетчера подключаемых модулей.
-[start=3]
+
. Выберите вкладку Downloaded ("Загруженные") и нажмите кнопку Add Plugins ("Добавление подключаемых модулей").
-[start=4]
+
. В диалоговом окне добавления подключаемых модулей перейдите к содержащему их каталогу и выберите модуль NetBeans. Нажмите кнопку Open ("Открыть").
image::images/plugin-archive-contents.png[title="Архив zip содержит подключаемые модули NetBeans"]
@@ -108,7 +108,7 @@
Нажмите и удерживайте клавишу Ctrl для выбора нескольких элементов.
-[start=5]
+
. В диспетчере подключаемых модулей выберите каждый из модулей Struts2.
Описание выбранного подключаемого модуля отображается на правой панели диспетчера подключаемых модулей.
@@ -120,13 +120,13 @@
--
-[start=6]
+
. Щелкните 'Установить', чтобы открыть установщик IDE NetBeans, а затем щелкните 'Далее' и примите условия лицензионного соглашения.
*Примечание.* При получении предупреждения проверки для установки подключаемого модуля щелкните 'Продолжить'. Предупреждение проверки выдается при попытке установить неподписанный подключаемый модуль. Хотя обычно всем подключаемым модулям можно доверять, установка неподписанного модуля осуществляется на ваш страх и риск.
-[start=7]
+
. Перезапустите среду IDE, чтобы дать изменениям возможность вступить в силу.
После установки подключаемого модуля и перезапуска среды IDE можно убедиться в том, что он установлен, открыв диспетчер подключаемых модулей, щелкнув вкладку Installed ("Установленные") и найдя его в списке установленных подключаемых модулей.
@@ -221,12 +221,12 @@
После выбора значения 'Платформы' на правой панели отображается текстовая область 'Используемые платформы'. Если приложение не использует никакие платформы, эта область будет пуста.
-[start=3]
+
. Нажмите кнопку 'Добавить', выберите нужную платформу и нажмите OK.
image::images/properties-add-framework.png[title="Платформа JavaServer Faces выбрана в диалоговом окне 'Добавление платформы', открытом в окне 'Свойства проекта'"]
-[start=4]
+
. В зависимости от выбранной платформы укажите относящиеся к этой платформе параметры конфигурации или компоненты, представленные в окне 'Свойства проекта'.
image::images/add-icefaces.png[title="Добавление библиотеки для набора компонентов ICEfaces в проект"]
@@ -236,7 +236,7 @@
*Примечания.* Библиотеки для компонентов JSF не входят в комплект IDE. Чтобы использовать наборы компонентов, необходимо загрузить требуемые библиотеки и создать библиотеку NetBeans, которую затем можно добавить в путь классов проекта в окне 'Свойства проекта'.
-[start=5]
+
. Нажмите кнопку "OК", чтобы подтвердить свой выбор, и закройте окно Project Properties ("Свойства проекта"). К проекту будут добавлены относящиеся к этой платформе артефакты и библиотеки, которые можно изучить в окне проектов.
link:/about/contact_form.html?to=3&subject=Feedback:%20Adding%20Web%20Framework%20Support[+ Отправить отзыв по этому учебному курсу+]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_zh_CN.asciidoc
index 0706568..c1265f1 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/framework-adding-support_zh_CN.asciidoc
@@ -94,13 +94,13 @@
NetBeans 插件可由 ``.nbm`` 扩展名来标识。
-[start=2]
+
. 从 IDE 的主菜单中,选择 "Tools"(工具)> "Plugins"(插件)以打开插件管理器。
-[start=3]
+
. 选择 "Downloaded"(已下载)标签,然后单击 "Add Plugins"(添加插件)按钮。
-[start=4]
+
. 在 "Add Plugins"(添加插件)对话框中,导航至包含插件的目录并选择 NetBeans 插件。单击 "Open"(打开)。
image::images/plugin-archive-contents.png[title="zip 档案文件包含 NetBeans 插件"]
@@ -108,7 +108,7 @@
按住 Ctrl 键可选择多个项目。
-[start=5]
+
. 在插件管理器中,选择每个 Struts2 插件。
插件管理器的右窗格中将显示选定插件的描述。
@@ -120,13 +120,13 @@
--
-[start=6]
+
. 单击 "Install"(安装)以打开 "NetBeans IDE Installer"(NetBeans IDE 安装程序),然后单击 "Next"(下一步)并接受许可证协议。
*注:*如果您接收到验证警告,请单击“继续”以安装该插件。在尝试安装未签名的插件时,将会出现验证警告。通常情况下,您可以信任所有插件,但是如果安装未签名的插件,则会带来一定的风险。
-[start=7]
+
. 重新启动 IDE 使更改生效。
在安装插件并重新启动 IDE 之后,可以通过打开插件管理器、单击 "Installed"(已安装)标签并在已安装插件的列表中查找插件来确认插件已安装。
@@ -221,12 +221,12 @@
选择 "Frameworks"(框架)时,右面板将显示 "Used Frameworks"(使用的框架)文本区域,如果应用程序未使用框架,则该文本区域为空。
-[start=3]
+
. 单击 "Add"(添加)按钮,然后选择要使用的框架并单击 "OK"(确定)。
image::images/properties-add-framework.png[title="从 "Project Properties"(项目属性)窗口打开的 "Add Framework"(添加框架)对话框中选择的 JavaServer Faces 框架"]
-[start=4]
+
. 根据所选框架,可以在 "Project Properties"(项目属性)窗口中进一步指定特定于框架的配置设置或组件。
image::images/add-icefaces.png[title="将 ICEfaces 组件套件的库添加到项目中"]
@@ -236,7 +236,7 @@
*注:*IDE 中不包含 JSF 组件的库。要使用组件套件,您需要下载所需的库,然后创建一个 NetBeans 库,您随后可以在 "Project Properties"(项目属性)窗口中将该库添加到项目类路径中。
-[start=5]
+
. 单击 "OK"(确定)以确认您的选择,然后关闭 "Project Properties"(项目属性)窗口。项目中将添加特定于框架的工件和库,您可以在 "Projects"(项目)窗口中对其进行检查。
link:/about/contact_form.html?to=3&subject=Feedback:%20Adding%20Web%20Framework%20Support[+ 发送有关此教程的反馈意见+]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart.asciidoc
index 2e4f55d..9a58e95 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart.asciidoc
@@ -67,10 +67,10 @@
You can confirm it is working correctly by running Grails from the command line (i.e., type "grails" at the command prompt).
-[start=2]
+
. Choose File > New Project (Ctrl-Shift-N) and then select "Grails Application" from the "Groovy" category. Click Next.
-[start=3]
+
. In Project Name, type "BookDemo"; in Project Location, select the folder where the application will be created. Click Finish.
The IDE runs the "grails create-app" command, showing the output in the Output window. The Projects window should show you this:
@@ -90,7 +90,7 @@
image::images/grails-65-8.png[]
-[start=4]
+
. Create some initial values in the Bootstrap.groovy class, which is within the Configuration node. The code added to the class is shown in bold below:
[source,java]
@@ -124,7 +124,7 @@
Click Finish. The controller is generated.
-[start=3]
+
. Comment out the one line generated within the braces and add "def scaffold = Book". You should now see this:
image::images/grails-65-13.png[]
@@ -138,22 +138,22 @@
image::images/grails-65-19.png[]
-[start=2]
+
. The URL is printed to the Output window. If the browser does not open automatically, paste the URL into a browser and then you'll see your application. Click the "BookController" link and you'll see this:
image::images/grails-65-14.png[]
-[start=3]
+
. Click New Book and then create a new entry:
image::images/grails-65-15.png[]
-[start=4]
+
. When you click Create, note that you can edit or delete the entry:
image::images/grails-65-17.png[]
-[start=5]
+
. ...and that the entry is reflected in the list of entries:
image::images/grails-65-18.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ja.asciidoc
index 8bba9d6..c5aae12 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ja.asciidoc
@@ -67,10 +67,10 @@
コマンド・ラインからGrailsを実行することで、正しく機能していることを確認できます(コマンド・プロンプトで"grails"と入力します)。
-[start=2]
+
. 「ファイル」>「新規プロジェクト」([Ctrl]-[Shift]-[N])を選択し、「Groovy」カテゴリから「Grailsアプリケーション」を選択します。「次」をクリックします。
-[start=3]
+
. 「プロジェクト名」に「BookDemo」と入力し、「プロジェクトの場所」にアプリケーションを作成するフォルダを選択します。「終了」をクリックします。
「grails create-app」コマンドが実行され、「出力」ウィンドウに出力が表示されます。「プロジェクト」ウィンドウに次のように表示されます。
@@ -90,7 +90,7 @@
image::images/grails-65-8.png[]
-[start=4]
+
. 「構成」ノード内のBootstrap.groovyクラスの初期値をいくつか作成します。クラスに追加するコードを次に太字で示します。
[source,java]
@@ -124,7 +124,7 @@
「終了」をクリックします。コントローラが生成されます。
-[start=3]
+
. 中括弧内に生成された1行をコメントにし、「def scaffold=Book」を追加します。次のような表示になります。
image::images/grails-65-13.png[]
@@ -138,22 +138,22 @@
image::images/grails-65-19.png[]
-[start=2]
+
. URLが「出力」ウィンドウに出力されます。ブラウザが自動的に開かない場合は、このURLをブラウザに貼り付けると、アプリケーションが表示されます。「BookController」リンクをクリックすると、次のような画面が表示されます。
image::images/grails-65-14.png[]
-[start=3]
+
. 「New Book」をクリックし、新規エントリを作成します。
image::images/grails-65-15.png[]
-[start=4]
+
. 「Create」をクリックすると、エントリを編集または削除できるようになります。
image::images/grails-65-17.png[]
-[start=5]
+
. また、新規エントリがエントリのリストに反映されます。
image::images/grails-65-18.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_pt_BR.asciidoc
index 7c0e94d..8059ecf 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_pt_BR.asciidoc
@@ -67,10 +67,10 @@
Você pode confirmar se ele está funcionando corretamente executando o Grails na linha de comandos (isto é, digite "grails" no prompt de comandos).
-[start=2]
+
. Selecione Arquivo > Novo Projeto (Ctrl-Shift-N) e selecione "Aplicação do Grails" na categoria "Groovy". Clique em Próximo.
-[start=3]
+
. Em Nome do Projeto, digite "BookDemo"; em Localização do Projeto, selecione a pasta em que a aplicação será criada. Clique em Finalizar.
O IDE executa o comando "grails create-app", mostrando a saída na janela de Saída. A janela Projetos deverá mostrar o seguinte:
@@ -90,7 +90,7 @@
image::images/grails-65-8.png[]
-[start=4]
+
. Crie alguns valores iniciais na classe Bootstrap.groovy, que está no nó Configuração. O código adicionado à classe é mostrado em negrito a seguir:
[source,java]
@@ -124,7 +124,7 @@
Clique em Finalizar. O controlador é gerado.
-[start=3]
+
. Comente a linha gerada entre as chaves e adicione "def scaffold = Book". O seguinte deverá ser exibido:
image::images/grails-65-13.png[]
@@ -138,22 +138,22 @@
image::images/grails-65-19.png[]
-[start=2]
+
. O URL é mostrado na janela de Saída. Se o browser não abrir automaticamente, cole o URL em um browser e você verá sua aplicação. Clique no link "BookController" e você verá isto:
image::images/grails-65-14.png[]
-[start=3]
+
. Clique em Novo Livro e crie uma nova entrada:
image::images/grails-65-15.png[]
-[start=4]
+
. Quando você clicar em Criar, observe que poderá editar ou deletar a entrada:
image::images/grails-65-17.png[]
-[start=5]
+
. ...e que a entrada é refletida na lista de entradas:
image::images/grails-65-18.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ru.asciidoc
index ebf432f..a0d603d 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_ru.asciidoc
@@ -67,10 +67,10 @@
Чтобы проверить, корректно ли работает Grails, запустите его из командной строки с помощью команды "grails".
-[start=2]
+
. Выберите команду "Файл" > "Создать проект" (CTRL+SHIFT+N), а затем – "Приложение Grails" из категории "Groovy". Нажмите кнопку "Далее".
-[start=3]
+
. В поле "Имя проекта" введите "BookDemo". В "Project Location" выберите папку, в которой будет создано приложение. Нажмите кнопку "Завершить".
Среда IDE выполняет команду "grails create-app", отображая результат выполнения в окне "Вывод". Окно "Проекты" должно выглядеть следующим образом:
@@ -90,7 +90,7 @@
image::images/grails-65-8.png[]
-[start=4]
+
. Создайте несколько начальных значений в классе Bootstrap.groovy, находящемся в узле Configuration. Добавленный к классу код выделен жирным шрифтом:
[source,java]
@@ -124,7 +124,7 @@
Нажмите кнопку "Завершить". Создание контроллера выполнено.
-[start=3]
+
. Закомментируйте строку, созданную внутри скобок, и добавьте "def scaffold = Book". На экране появится следующее окно:
image::images/grails-65-13.png[]
@@ -138,22 +138,22 @@
image::images/grails-65-19.png[]
-[start=2]
+
. Введите URL-адрес в окно "Вывод". Если страница браузера не открывается автоматически, вставьте URL-адрес в адресную строку браузера, после чего приложение откроется. Перейдите по ссылке "BookController". Появится следующее окно:
image::images/grails-65-14.png[]
-[start=3]
+
. Щелкните "New Book" и создайте новую запись:
image::images/grails-65-15.png[]
-[start=4]
+
. После нажатия кнопки "Создать" убедитесь в том, что запись может быть изменена или удалена:
image::images/grails-65-17.png[]
-[start=5]
+
. ...а также в том, что эта запись отображается в списке записей:
image::images/grails-65-18.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_zh_CN.asciidoc
index 4c60bf9..67ab24c 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/grails-quickstart_zh_CN.asciidoc
@@ -67,10 +67,10 @@
通过从命令行运行 Grails(即,在命令提示处键入 "grails"),可以确认其正常运行。
-[start=2]
+
. 选择 "File"(文件)> "New Project"(新建项目)(Ctrl-Shift-N)并从 "Groovy" 类别中选择 "Grails Application"(Grails 应用程序)。单击 "Next"(下一步)。
-[start=3]
+
. 在 "Project Name"(项目名称)中键入 "BookDemo";在 "Project Location"(项目位置)中,选择要在其中创建应用程序的文件夹位置。单击 "Finish"(完成)。
IDE 将运行 "grails create-app" 命令,并在 "Output"(输出)窗口显示输出。"Projects"(项目)窗口应显示以下内容:
@@ -90,7 +90,7 @@
image::images/grails-65-8.png[]
-[start=4]
+
. 在位于 "Configuration"(配置)节点中的 Bootstrap.groovy 类中创建了一些初始值。添加到该类的代码以黑体显示如下:
[source,java]
@@ -124,7 +124,7 @@
单击 "Finish"(完成)。已生成控制器。
-[start=3]
+
. 注释掉在花括号内所生成的一行代码,然后添加 "def scaffold = Book"。现在,您应看到如下所示的内容:
image::images/grails-65-13.png[]
@@ -138,22 +138,22 @@
image::images/grails-65-19.png[]
-[start=2]
+
. 该 URL 已被输出到 "Output"(输出)窗口。如果浏览器未自动打开,请将该 URL 粘贴到浏览器中,然后会看到该应用程序。单击 "BookController" 链接,您将看到以下内容:
image::images/grails-65-14.png[]
-[start=3]
+
. 单击 "New Book"(新建 Book),程序将创建一个新条目:
image::images/grails-65-15.png[]
-[start=4]
+
. 单击 "Create"(创建)之后,请注意可对该条目进行编辑或删除:
image::images/grails-65-17.png[]
-[start=5]
+
. 同时,该条目将被反映到条目列表中:
image::images/grails-65-18.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp.asciidoc
index 9963564..77ae27c 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp.asciidoc
@@ -80,7 +80,7 @@
When you click OK a Sakila node appears under the MySQL Server node.
-[start=5]
+
. Right-click the Sakila node and choose Connect.
When you click Connect a database connection node for the Sakila database ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` ) is listed under the Databases node. When a connection is open you can view the data in the database by expanding the connection node.
@@ -97,16 +97,16 @@
For this tutorial there is little reason to copy project libraries to a dedicated folder because you will not need to share libraries with other users.
-[start=4]
+
. Set the server to the GlassFish Server and set the Java EE Version to Java EE 6 Web or Java EE 7 Web. Click Next.
-[start=5]
+
. Select the JavaServer Faces checkbox and use the default JSF 2.x libraries.
-[start=6]
+
. Select the Hibernate checkbox in the list of frameworks.
-[start=7]
+
. Select the sakila database from the Database Connection drop down list. Click Finish.
*Note:* If the sakila database is not available as an option in the Frameworks panel in the wizard, check to see if the connection is listed under the Databases node in the Services window. If the connection is not there, you need to create the database connection.
@@ -133,18 +133,18 @@
image::images/add-property-showsql.png[title="Add Hibernate Property dialog box showing setting value for the hibernate.show_sql property"]
-[start=5]
+
. Expand the Miscellaneous Properties node and click Add.
-[start=6]
+
. In the dialog box, select the ``properties hibernate.current_session_context_class`` and set the value to ``thread`` to enable Hibernate's automatic session context management.
image::images/add-property-sessioncontext.png[title="Add Hibernate Property dialog box showing setting value for the hibernate.current_session_context_class property"]
-[start=7]
+
. Click Add again under the Miscellaneous Properties node and select ``hibernate.query.factory_class`` in the Property Name dropdown list.
-[start=8]
+
. Select *org.hibernate.hql.classic.ClassicQueryTranslatorFactory* as the Property Value. Click OK.
image::images/add-property-factoryclass.png[title="Add Hibernate Property dialog box showing setting value for the hibernate.query.factory_class property"]
@@ -169,7 +169,7 @@
</hibernate-configuration>
----
-[start=9]
+
. Save your changes to the file.
You can close the file because you do not need to edit the file again.
@@ -308,7 +308,7 @@
}
----
-[start=5]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac) to add any required import statements ( ``org.hibernate.Session`` ) and save your changes.
You will now modify ``FilmHelper.java`` to add methods that query the DB.
@@ -344,7 +344,7 @@
select film0_.film_id as col_0_0_ from sakila.film film0_
----
-[start=5]
+
. Type the following query to retrieve the records in the Film table where the film id is between 100 and 200.
[source,java]
@@ -356,7 +356,7 @@
The result window displays a list of records. Now that you have tested that the query returns the desired results, you can use the query in the helper class.
-[start=6]
+
. Add the following method ``getFilmTitles`` to ``FilmHelper.java`` to retrieve the films where the film id is between a certain range specified by the variables ``startID`` and ``endID`` .
[source,java]
@@ -375,7 +375,7 @@
}
----
-[start=7]
+
. Add the following method ``getActorsByID`` that retrieves the actors in a particular film. The method constructs the query using ``filmId`` as the input variable.
[source,java]
@@ -396,7 +396,7 @@
}
----
-[start=8]
+
. Fix your imports and save your changes.
When you fix your imports you want to choose ``java.util.List`` and ``org.hibernate.Query`` .
@@ -426,7 +426,7 @@
}
----
-[start=2]
+
. Add the following method to retrieve a single film according to ``filmId`` .
[source,java]
@@ -448,7 +448,7 @@
}
----
-[start=3]
+
. Add the following method to retrieve the film language according to ``langId`` .
[source,java]
@@ -470,7 +470,7 @@
}
----
-[start=4]
+
. Save your changes.
@@ -487,13 +487,13 @@
You will use the Managed Bean name ``filmController`` as the value for the ``inputText`` and ``commandButton`` in the JSF page ``index.xhtml`` when calling methods in the bean.
-[start=4]
+
. Select *dvdrental* for the Package.
-[start=5]
+
. Type *filmController* for the Name that will be used for the managed bean.
-[start=6]
+
. Set Scope to Session. Click Finish.
image::images/hib-newmanagedbean.png[title="New JSF Managed Bean wizard"]
@@ -538,7 +538,7 @@
}
----
-[start=2]
+
. Add the following code (in bold) to create the FilmController instance and retrieve the films.
[source,java]
@@ -578,7 +578,7 @@
}*
----
-[start=3]
+
. Add the following methods that are used to display the table and navigate the pages.* public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
@@ -624,7 +624,7 @@
The methods that return "index" or "browse" will prompt the JSF navigation handler to try to open a page named ``index.xhtml`` or ``browse.xhtml`` . The JSF 2.0 specification enables the use of implicit navigation rules in applications that use Facelets technology. In this application, no navigation rules are configured in ``faces-config.xml`` . Instead, the navigation handler will try to locate a suitable page in the application.
-[start=4]
+
. Add the following methods that access the helper class to retrieve additional film details.* public String getLanguage() {
int langID = current.getLanguageByLanguageId().getLanguageId().intValue();
String language = helper.getLangByID(langID);
@@ -655,7 +655,7 @@
----
-[start=5]
+
. Fix your imports (Ctrl-Shift-I) and save your changes.
You can use the code completion in the editor to help you type your code.
@@ -696,7 +696,7 @@
</h:body>
----
-[start=5]
+
. Modify the ``<ui:insert>`` element to change the default generated name to "body".
[source,html]
@@ -707,7 +707,7 @@
</div>
----
-[start=6]
+
. Save your changes.
The content enclosed within the ``<ui:define name="body">`` element in ``index.xhtml`` and ``browse.xhtml`` will be inserted into the location identified with `` <ui:insert name="body">Content</ui:insert>`` in the template.
@@ -736,7 +736,7 @@
</html>
----
-[start=2]
+
. Modify the page to use the JSF ``<ui:composition>`` and ``<ui:define>`` elements and add a ``<h:form>`` element.
[source,xml]
@@ -760,7 +760,7 @@
The ``<ui:composition>`` and ``<ui:define>`` elements are used in combination with the page template that you will create. The ``<ui:composition>`` element references the location of the template that will be used by this page. The ``<ui:define>`` element references the position in the template that the enclosed code will occupy.
-[start=3]
+
. Add the following navigation links that call the ``previous`` and ``next`` methods in the JSF managed bean.
[source,xml]
@@ -774,7 +774,7 @@
</ui:define>
----
-[start=4]
+
. Add the following ``dataTable`` element (in bold) to generate the table to display the retrieved items.
[source,xml]
@@ -808,7 +808,7 @@
----
-[start=5]
+
. Save your changes.
The index page will now display a list of film titles in the database. Each row in the table includes a "View" link that invokes the ``prepareView`` method in the managed bean. The ``prepareView`` method returns "browse" and will open ``browse.xhtml`` .
@@ -827,18 +827,18 @@
image::images/hib-faceletsclient.png[title="Facelets Template Client file type in New File wizard"]
-[start=3]
+
. Type *browse* for the File Name.
-[start=4]
+
. Locate the Template for the page by clicking Browse to open the Browse Files dialog box.
-[start=5]
+
. Expand the Web Pages folder and select ``template.xhtml`` . Click Select File.
image::images/hib-browsetemplate.png[title="Select the template in the Browse Files dialog"]
-[start=6]
+
. Select *<ui:composition>* for the Generated Root Tag. Click Finish.
When you click Finish, the file ``browse.xhtml`` opens in the editor with the following code.
@@ -864,7 +864,7 @@
You can see that the new file specifies the ``template.xhtml`` file and that the ``<ui:define>`` tag has the property ``name="body"``
-[start=7]
+
. Add the following code (in bold) between the ``<ui:define>`` tags to create the form and call the methods in the managed bean FilmController to retrieve the data and populate the form.
[source,xml]
@@ -933,7 +933,7 @@
You can see that ``browse.xhtml`` and ``index.xhtml`` will use the same page template.
-[start=8]
+
. Save your changes.
@@ -947,7 +947,7 @@
image::images/hib-browser1.png[title="Screenshot of browser displaying film list on index page"]
-[start=2]
+
. In your browser, click "View" to load ``browse.xhtml`` to view the film details.
@@ -962,22 +962,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Click Next.
-[start=3]
+
. Click Browse to open the Browse Repostiory Folders dialog box.
-[start=4]
+
. Expand the root node and select *samples/javaee/DVDStoreEE6*. Click OK.
-[start=5]
+
. Specify the Local Folder for the sources.
-[start=6]
+
. Click Finish.
When you click Finish, the IDE initializes the local folder as a Subversion repository and checks out the project sources.
-[start=7]
+
. Click Open Project in the dialog that appears when checkout is complete.
*Notes.* For more about installing Subversion, see the section on link:../ide/subversion.html#settingUp[+Setting up Subversion+] in the link:../ide/subversion.html[+Guide to Subversion in NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ja.asciidoc
index 99b940f..4ae939d 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ja.asciidoc
@@ -80,7 +80,7 @@
「OK」をクリックすると、「MySQLサーバー」ノードの下に「Sakila」ノードが表示されます。
-[start=5]
+
. 「Sakila」ノードを右クリックし、「接続」を選択します。
「接続」をクリックすると、「Sakila」データベースのデータベース接続のノード( ``jdbc:mysql://localhost:3306/sakila [デフォルトの_ユーザー名_]`` )が「データベース」ノードに一覧表示されます。接続が開いたら、接続ノードを展開してデータベースのデータを表示できます。
@@ -97,16 +97,16 @@
このチュートリアルでは、ライブラリを他のユーザーと共有する必要がないため、プロジェクト・ライブラリを専用のフォルダにコピーする理由はほとんどありません。
-[start=4]
+
. サーバーを「GlassFish Server」に設定し、「Java EEバージョン」を「Java EE 6 Web」または「Java EE 7 Web」に設定します。「次」をクリックします。
-[start=5]
+
. 「JavaServer Faces」チェックボックスを選択し、デフォルトのJSF 2.xライブラリを使用します。
-[start=6]
+
. フレームワークの選択リストで「Hibernate」チェックボックスを選択します。
-[start=7]
+
. 「データベース接続」ドロップダウン・リストから「Sakilaデータベース」を選択します。「終了」をクリックします。
*注意:* Sakilaデータベースがウィザードの「フレームワーク」パネルのオプションとして使用できない場合、この接続が「サービス」ウィンドウの「データベース」ノードに一覧表示されているかどうかを確認します。ここに接続がない場合、データベース接続を作成する必要があります。
@@ -133,18 +133,18 @@
image::images/add-property-showsql.png[title="hibernate.show_sqlプロパティの設定値が表示された「Hibernateのプロパティの追加」ダイアログ・ボックス"]
-[start=5]
+
. 「Miscellaneous Properties」ノードを展開し、「追加」をクリックします。
-[start=6]
+
. このダイアログ・ボックスで「 ``hibernate.current_session_context_class`` 」プロパティを選択し、値を「 ``thread`` 」に設定すると、Hibernateの自動セッション・コンテキスト管理が有効になります。
image::images/add-property-sessioncontext.png[title="hibernate.current_session_context_classプロパティの設定値が表示された「Hibernateのプロパティの追加」ダイアログ・ボックス"]
-[start=7]
+
. 「その他のプロパティ」ノードの下の「追加」を再度クリックし、「プロパティ名」ドロップダウン・リストで ``hibernate.query.factory_class`` を選択します。
-[start=8]
+
. 「プロパティ値」として「*org.hibernate.hql.classic.ClassicQueryTranslatorFactory*」を選択します。「OK」をクリックします。
image::images/add-property-factoryclass.png[title="hibernate.query.factory_classプロパティの設定値が表示された「Hibernateのプロパティの追加」ダイアログ・ボックス"]
@@ -169,7 +169,7 @@
</hibernate-configuration>
----
-[start=9]
+
. 変更内容をファイルに保存します。
このファイルは、再度編集する必要がないため閉じてかまいません。
@@ -308,7 +308,7 @@
}
----
-[start=5]
+
. エディタ上で右クリックし、「インポートを修正」([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択して必要なインポート文( ``org.hibernate.Session`` )を追加し、変更を保存します。
ここで ``FilmHelper.java`` を変更して、データベースに対して問合せを実行するメソッドを追加します。
@@ -344,7 +344,7 @@
select film0_.film_id as col_0_0_ from sakila.film film0_
----
-[start=5]
+
. 次の問合せを入力して、filmIdが100から200の間に含まれるレコードをFilm表から取り出します。
[source,java]
@@ -356,7 +356,7 @@
結果ウィンドウにレコードのリストが表示されます。問合せが適切な結果を返すことをテストできたので、この問合せをヘルパー・クラスで使用できます。
-[start=6]
+
. ``FilmHelper.java`` に次のメソッド ``getFilmTitles`` を追加して、filmIdが、変数 ``startID`` と ``endID`` で指定する範囲内にある映画を取り出します。
[source,java]
@@ -375,7 +375,7 @@
}
----
-[start=7]
+
. 特定の映画から俳優を取得する次のメソッド ``getActorsByID`` を追加します。メソッドは、入力変数として ``filmId`` を使用し、問合せを構成します。
[source,java]
@@ -396,7 +396,7 @@
}
----
-[start=8]
+
. インポートを修正して変更内容を保存します。
インポートを修正するときは、 ``java.util.List`` と ``org.hibernate.Query`` を選択します。
@@ -426,7 +426,7 @@
}
----
-[start=2]
+
. ``filmId`` に基づいて1つの映画を取り出す次のメソッドを追加します。
[source,java]
@@ -448,7 +448,7 @@
}
----
-[start=3]
+
. ``langId`` に基づいて映画の言語を取り出す次のメソッドを追加します。
[source,java]
@@ -470,7 +470,7 @@
}
----
-[start=4]
+
. 変更を保存します。
@@ -487,13 +487,13 @@
Beanでメソッドをコールするときに、管理対象Bean名 ``filmController`` を、JSFページ ``index.xhtml`` の ``inputText`` および ``commandButton`` の値として使用します。
-[start=4]
+
. パッケージに「*dvdrental*」を選択します。
-[start=5]
+
. 管理対象Beanに使用する名前に「*filmController*」と入力します。
-[start=6]
+
. スコープを「セッション」に設定します。「終了」をクリックします。
image::images/hib-newmanagedbean.png[title="新規JSF管理対象Beanウィザード"]
@@ -538,7 +538,7 @@
}
----
-[start=2]
+
. 次の太字部分のコードを追加してFilmControllerインスタンスを作成し、映画を取り出します。
[source,java]
@@ -578,7 +578,7 @@
}*
----
-[start=3]
+
. 表の表示とページへのナビゲートに使用される、次のメソッドを追加します。* public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
@@ -624,7 +624,7 @@
「index」または「browse」を返すメソッドによって、JSFナビゲーション・ハンドラは ``index.xhtml`` または ``browse.xhtml`` という名前のページを開くように求められます。JSF 2.0仕様では、Faceletsテクノロジを使用するアプリケーションで暗黙ナビゲーション・ルールを使用できます。このアプリケーションは、 ``faces-config.xml`` にナビゲーション・ルールが構成されていません。かわりに、ナビゲーション・ハンドラが、アプリケーション内で適切なページを検索しようとします。
-[start=4]
+
. 追加の映画の詳細を取り出すヘルパー・クラスにアクセスする、次のメソッドを追加します。* public String getLanguage() {
int langID = current.getLanguageByLanguageId().getLanguageId().intValue();
String language = helper.getLangByID(langID);
@@ -655,7 +655,7 @@
----
-[start=5]
+
. インポートを修正([Ctrl]-[Shift]-[I])して変更内容を保存します。
エディタでコード補完を使用すると、コードの入力に役立ちます。
@@ -696,7 +696,7 @@
</h:body>
----
-[start=5]
+
. ``<ui:insert>`` 要素を変更して、デフォルトで生成される名前を「body」に変えます。
[source,html]
@@ -707,7 +707,7 @@
</div>
----
-[start=6]
+
. 変更を保存します。
``index.xhtml`` および ``browse.xhtml`` の ``<ui:define name="body">`` 要素内の内容は、テンプレートの ``<ui:insert name="body">Content</ui:insert>`` で指定された場所に挿入されます。
@@ -736,7 +736,7 @@
</html>
----
-[start=2]
+
. ページを変更し、JSF ``<ui:composition>`` 要素および ``<ui:define>`` 要素を使用するようにして、 ``<h:form>`` 要素を追加します。
[source,xml]
@@ -760,7 +760,7 @@
``<ui:composition>`` 要素と ``<ui:define>`` 要素は、作成するページ・テンプレートと組み合せて使用されます。 ``<ui:composition>`` 要素は、このページによって使用されるテンプレートの場所を参照します。 ``<ui:define>`` 要素は、含まれているコードが占有するテンプレート内での位置を参照します。
-[start=3]
+
. JSF管理対象Beanで ``previous`` メソッドおよび ``next`` メソッドをコールする、次のナビゲーション・リンクを追加します。
[source,xml]
@@ -774,7 +774,7 @@
</ui:define>
----
-[start=4]
+
. 取り出された項目を表示する表を生成する次の ``dataTable`` 要素(太字部分)を追加します。
[source,xml]
@@ -808,7 +808,7 @@
----
-[start=5]
+
. 変更を保存します。
これで、indexページにデータベース内の映画のタイトル・リストが表示されます。表の各行に、管理対象Beanの ``prepareView`` メソッドを呼び出す「View」リンクがあります。 ``prepareView`` メソッドは「browse」を返し、 ``browse.xhtml`` を開きます。
@@ -827,18 +827,18 @@
image::images/hib-faceletsclient.png[title="新規ファイル・ウィザードの「Faceletsテンプレート・クライアント」ファイル・タイプ"]
-[start=3]
+
. 「ファイル名」に「*browse*」と入力します。
-[start=4]
+
. 「参照」をクリックして「ファイルを参照」ダイアログ・ボックスを開き、ページのテンプレートを特定します。
-[start=5]
+
. 「Webページ」フォルダを展開し、「 ``template.xhtml`` 」を選択します。「ファイルを選択」をクリックします。
image::images/hib-browsetemplate.png[title="「ファイルを参照」ダイアログでのテンプレートの選択"]
-[start=6]
+
. 「生成されたルート・タグ」に*<ui:composition>*を選択します。「終了」をクリックします。
「終了」をクリックすると、 ``browse.xhtml`` ファイルがエディタで開き、次のコードが表示されます。
@@ -864,7 +864,7 @@
新しいファイルが ``template.xhtml`` ファイルを指定し、 ``<ui:define>`` タグに ``name="body"`` プロパティがあることを確認できます。
-[start=7]
+
. ``<ui:define>`` タグの間に次の太字のコードを追加してフォームを作成し、管理対象BeanのFilmControllerでメソッドをコールして、データを取り出し、フォームを生成します。
[source,xml]
@@ -933,7 +933,7 @@
``browse.xhtml`` と ``index.xhtml`` が同じページ・テンプレートを使用していることが確認できます。
-[start=8]
+
. 変更を保存します。
@@ -947,7 +947,7 @@
image::images/hib-browser1.png[title="indexページに映画のリストが表示されたスクリーンショット"]
-[start=2]
+
. ブラウザで、「View」をクリックして ``browse.xhtml`` をロードし、映画の詳細を表示します。
@@ -962,22 +962,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
「次」をクリックします。
-[start=3]
+
. 「参照」をクリックして「リポジトリ・フォルダを参照」ダイアログ・ボックスを開きます。
-[start=4]
+
. ルート・ノードを展開し、*samples/javaee/DVDStoreEE6*を選択します。「OK」をクリックします。
-[start=5]
+
. ソースのローカル・フォルダを指定します。
-[start=6]
+
. 「終了」をクリックします。
「終了」をクリックすると、IDEではローカル・フォルダがSubversionリポジトリとして初期化され、プロジェクト・ソースがチェックアウトされます。
-[start=7]
+
. チェックアウトが完了するときに表示されるダイアログで、「プロジェクトを開く」をクリックします。
*注意:*Subversionのインストールの詳細は、link:../ide/subversion.html[+NetBeans IDEでのSubversionガイド+]のlink:../ide/subversion.html#settingUp[+Subversionの設定+]の項を参照してください。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_pt_BR.asciidoc
index 2618e96..576dceb 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_pt_BR.asciidoc
@@ -80,7 +80,7 @@
Quando você clicar em OK, um nó do Salkila será exibido sob o nó Servidor MySQL.
-[start=5]
+
. Clique com o botão direito do mouse no nó do Sakila e escolha Conectar.
Quando você clicar em Conectar, um nó de conexão do banco de dados do banco de dados Sakila ( ``jdbc:mysql://localhost:3306/sakila [_nome de usuário_ em Default]`` ) será apresentado no nó Bancos de Dados. Quando uma conexão for aberta, você poderá exibir os dados no banco de dados ampliando o nó de conexão.
@@ -97,16 +97,16 @@
Neste tutorial, não é necessário copiar as bibliotecas do projeto para uma pasta dedicada, pois você não precisará compartilhar bibliotecas com outros usuários.
-[start=4]
+
. Defina o servidor como GlassFish Server e defina a versão do Java EE para Java EE 6 Web ou Java EE 7 Web. Clique em Próximo.
-[start=5]
+
. Marque a caixa de seleção JavaServer Faces e utilize as bibliotecas default do JSF 2.x.
-[start=6]
+
. Marque a caixa de seleção Hibernar na lista de frameworks.
-[start=7]
+
. Selecione o banco de dados sakila na lista drop-down Conexão de Banco de Dados. Clique em Finalizar.
*Observação:* se o banco de dados sakila não estiver disponível como uma opção no painel Framework do assistente, verifique se a conexão está listada no nó Bancos de Dados da janela Serviços. Se a conexão não existir, será necessário criar a conexão do banco de dados.
@@ -133,18 +133,18 @@
image::images/add-property-showsql.png[title="Caixa de diálogo Adicionar Propriedade Hibernate que mostra o valor de definição de hibernate.show_sql"]
-[start=5]
+
. Expanda o nó Propriedades Diversas e clique em Adicionar.
-[start=6]
+
. Na caixa de diálogo, selecione ``properties hibernate.current_session_context_class`` e defina o valor para ``thread`` para ativar o gerenciamento de contexto automático da sessão do Hibernate.
image::images/add-property-sessioncontext.png[title="Adicione a caixa e diálogo Propriedade do Hibernate mostrando como definir o valor da propriedade hibernate.current_session_context_class"]
-[start=7]
+
. Clique novamente em Adicionar no nó Propriedades Diversas e selecione ``hibernate.query.factory_class`` na lista drop-down Nome da Propriedade.
-[start=8]
+
. Selecione *org.hibernate.hql.classic.ClassicQueryTranslatorFactory* como o Valor da Propriedade. Clique em OK.
image::images/add-property-factoryclass.png[title="Caixa de diálogo Adicionar Propriedade Hibernate que mostra o valor de definição de hibernate.query.factory_class"]
@@ -169,7 +169,7 @@
</hibernate-configuration>
----
-[start=9]
+
. Salve as alterações feitas no arquivo.
Você pode fechar o arquivo, pois não será necessário editá-lo novamente.
@@ -308,7 +308,7 @@
}
----
-[start=5]
+
. Clique com o botão direito do mouse no editor, selecione Corrigir importações (Alt-Shift-I; &#8984-Shift-I no Mac) para adicionar as instruções necessárias de importação ( ``org.hibernate.Session`` ) e salve suas alterações.
Agora você modificará ``FilmHelper.java`` para adicionar métodos de consulta do BD.
@@ -344,7 +344,7 @@
select film0_.film_id as col_0_0_ from sakila.film film0_
----
-[start=5]
+
. Digite a consulta a seguir para recuperar os registros da tabela Film, onde o id do filme está entre 100 e 200.
[source,java]
@@ -356,7 +356,7 @@
A janela de resultados exibirá uma lista de registros. Agora que você verificou que a consulta testada retorna os resultados desejados, utilize a consulta na classe do helper.
-[start=6]
+
. Adicione o método a seguir, ``getFilmTitles`` a ``FilmHelper.java`` , para recuperar os filmes, onde o id do filme está entre uma determinada faixa especificada pelas variáveis ``startID`` e ``endID`` .
[source,java]
@@ -375,7 +375,7 @@
}
----
-[start=7]
+
. Adicione o método a seguir, ``getActorsByID`` , para recuperar os atores de um filme específico. O método construirá a consulta utilizando ``filmId`` como a variável de entrada.
[source,java]
@@ -396,7 +396,7 @@
}
----
-[start=8]
+
. Corrija as importações e salve as alterações.
Ao corrigir suas importações, selecione ``java.util.List`` e ``org.hibernate.Query`` .
@@ -426,7 +426,7 @@
}
----
-[start=2]
+
. Adicione o método seguinte para recuperar um único filme de acordo com o ``filmId`` .
[source,java]
@@ -448,7 +448,7 @@
}
----
-[start=3]
+
. Adicione o método a seguir para recuperar o idioma do filme de acordo com o ``filmId`` .
[source,java]
@@ -470,7 +470,7 @@
}
----
-[start=4]
+
. Salve as alterações.
@@ -487,13 +487,13 @@
Você usará o nome ``filmController`` do Bean Gerenciado como o valor para ``inputText`` e ``commandButton`` na página JSF ``index.xhtml`` ao chamar métodos no Bean.
-[start=4]
+
. Selecione *dvdrental* para o Pacote.
-[start=5]
+
. Digite *filmController* como o Nome que será utilizado para o bean gerenciado.
-[start=6]
+
. Defina o Escopo Como Sessão. Clique em Finalizar.
image::images/hib-newmanagedbean.png[title="Novo assistente de Bean Gerenciado pelo JSF"]
@@ -538,7 +538,7 @@
}
----
-[start=2]
+
. Adicione o código a seguir (em negrito) para criar a instância do FilmController e recuperar os filmes.
[source,java]
@@ -578,7 +578,7 @@
}*
----
-[start=3]
+
. Adicione os métodos a seguir usados para exibir a tabela e navegar entre as páginas.* public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
@@ -624,7 +624,7 @@
Os métodos que retornam "index" ou "browse" solicitarão o handler de navegação JSF para tentar abrir uma página denominada ``index.xhtml`` ou ``browse.xhtml`` . A especificação JSF 2.0 permite a utilização de regras de navegação implícitas em aplicações que utilizam a tecnologia Facelets. Nesta aplicação, não há regras de navegação configuradas em ``faces-config.xml`` . Em vez disso, o handler de navegação tentará localizar a página adequada na aplicação.
-[start=4]
+
. Adicione os métodos a seguir que acessam a classe do helper para recuperar detalhes adicionais do filme.* public String getLanguage() {
int langID = current.getLanguageByLanguageId().getLanguageId().intValue();
String language = helper.getLangByID(langID);
@@ -655,7 +655,7 @@
----
-[start=5]
+
. Corrija as importações (Ctrl-Shift-I) e salve as alterações.
Você pode utilizar a funcionalidade para autocompletar código no editor para ajudar a digitar seu código.
@@ -696,7 +696,7 @@
</h:body>
----
-[start=5]
+
. Modifique o elemento ``<ui:insert>`` para alterar o nome gerado default para "corpo".
[source,html]
@@ -707,7 +707,7 @@
</div>
----
-[start=6]
+
. Salve as alterações.
O conteúdo do elemento ``<ui:define name="body">`` nos arquivos ``index.xhtml`` e ``browse.xhtml`` será inserido no local identificado com `` <ui:insert name="body">Content</ui:insert>`` no modelo.
@@ -736,7 +736,7 @@
</html>
----
-[start=2]
+
. Modifique a página para utilizar os elementos JSF ``<ui:composition>`` e ``<ui:define>`` e adicione um elemento ``<h:form>`` .
[source,xml]
@@ -760,7 +760,7 @@
Os elementos ``<ui:composition>`` e ``<ui:define>`` são utilizados em combinação com o modelo de página que você criará. O elemento ``<ui:composition>`` faz referência à localização do modelo que será utilizado por essa página. O elemento ``<ui:define>`` faz referência à posição no modelo que o código incluído ocupará.
-[start=3]
+
. Adicione os seguintes links de navegação que chamam os métodos ``previous`` e ``next`` no Bean gerenciado pelo JSF.
[source,xml]
@@ -774,7 +774,7 @@
</ui:define>
----
-[start=4]
+
. Adicione o seguinte elemento ``dataTable`` (em negrito) para gerar a tabela para exibir os itens recuperados.
[source,xml]
@@ -808,7 +808,7 @@
----
-[start=5]
+
. Salve as alterações.
A página de índice agora exibirá uma lista de títulos de filmes no banco de dados. Cada linha da tabela inclui um link "Exibir" que chama o método ``prepareView`` no bean gerenciado. O método ``prepareView`` retornará "browse" e abrirá o ``browse.xhtml`` .
@@ -827,18 +827,18 @@
image::images/hib-faceletsclient.png[title="Tipo de arquivo Cliente de Modelo de Facelets no assistente Novo Arquivo"]
-[start=3]
+
. Digite *browse* para o Nome do Arquivo.
-[start=4]
+
. Localize o Modelo da página clicando em Procurar para abrir a caixa de diálogo Procurar Arquivos.
-[start=5]
+
. Expanda a pasta Páginas Web e selecione ``template.xhtml`` . Clique em Selecionar Arquivo.
image::images/hib-browsetemplate.png[title="Selecione o modelo na caixa de diálogo Procurar Arquivos"]
-[start=6]
+
. Selecione *<ui:composition>* para a Tag Raiz Gerada. Clique em Finalizar.
Quando você clica em Finalizar, o arquivo ``browse.xhtml`` abrirá no editor com o código a seguir.
@@ -864,7 +864,7 @@
É possível ver que o novo arquivo especifica o arquivo ``template.xhtml`` e que a tag ``<ui:define>`` possui a propriedade ``name="body"``
-[start=7]
+
. Adicione o código a seguir (em negrito) entre as tags ``<ui:define>`` para criar o form e chamar os métodos no FilmController do Bean gerenciado para recuperar os dados e preencher o form.
[source,xml]
@@ -933,7 +933,7 @@
É possível ver que os arquivos ``browse.xhtml`` e ``index.xhtml`` utilizarão o mesmo modelo de página.
-[start=8]
+
. Salve as alterações.
@@ -947,7 +947,7 @@
image::images/hib-browser1.png[title="Tela do browser exibindo a lista de filme na página de índice"]
-[start=2]
+
. No browser, clique em "Exibir" para carregar o ``browse.xhtml`` e exibir os detalhes do filme.
@@ -962,22 +962,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Clique em Próximo.
-[start=3]
+
. Clique em Procurar para abrir a caixa de diálogo Procurar nas Pastas do Repositório:
-[start=4]
+
. Expanda o nó raiz e selecione *samples/javaee/DVDStoreEE6*. Clique em OK.
-[start=5]
+
. Especifique a Pasta Local dos códigos-fonte.
-[start=6]
+
. Clique em Finalizar.
Quando você clica em Finalizar, o IDE inicializa a pasta local como um repositório Subversion e verifica os códigos-fonte do projeto.
-[start=7]
+
. Clique em Abrir Projeto na caixa de diálogo exibida quando o check-out for concluído.
*Observações.* Para saber mais sobre a instalação do Subversion, consulte a seção link:../ide/subversion.html#settingUp[+Configurando o Subversion+] no link:../ide/subversion.html[+Guia do Subversion no NetBeans IDE+].
diff --git a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ru.asciidoc
index b48b4d5..a6f954d 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_ru.asciidoc
@@ -80,7 +80,7 @@
При нажатии кнопки "OK" узел "Sakila" появится под узлом "MySQL Server".
-[start=5]
+
. Щелкните правой кнопкой мыши узел "Sakila" и выберите "Connect".
После нажатия кнопки "Connect a database" под узлом "Databases" отобразится узел подключения к базе данных "Sakila" ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` ). При открытом подключении для просмотра данных в базе данных разверните этот узел подключения.
@@ -97,16 +97,16 @@
В рамках этого руководства копирование библиотек проекта в выделенную папку лишено смысла, поскольку совместное использование библиотек с другими пользователями не потребуется.
-[start=4]
+
. В качестве сервера выберите 'GlassFish Server', а в качестве версии Java EE -'Java EE 6 Web' или 'Java EE 7 Web'. Нажмите кнопку "Далее".
-[start=5]
+
. Установите флажок 'JavaServer Faces' и используйте стандартные библиотеки JSF 2.x.
-[start=6]
+
. В списке платформ установите флажок 'Гибернация'.
-[start=7]
+
. Выберите базу данных "sakila" из раскрывающегося списка "Соединение с базой данных". Нажмите кнопку 'Готово'.
*Примечание.* Если база данных Sakila не доступна в качестве параметра на панели Frameworks мастера, убедитесь, что соединение указано в списке узлов баз данных в окне 'Службы'. При отсутствии подключения следует создать подключение к базе данных.
@@ -133,18 +133,18 @@
image::images/add-property-showsql.png[title="Диалоговое окно 'Добавить свойство Hibernate', в котором отображаются значения настроек для свойства hibernate.show_sql"]
-[start=5]
+
. Разверните узел "Прочие свойства" и нажмите кнопку "Добавить".
-[start=6]
+
. В диалоговом окне выберите ``properties hibernate.current_session_context_class`` и установите значение ``thread`` для включения автоматического управления контекстами сеанса платформы Hibernate.
image::images/add-property-sessioncontext.png[title="Диалоговое окно 'Добавить свойство Hibernate', в котором отображаются значения настроек для свойства hibernate.current_session_context_class"]
-[start=7]
+
. Нажмите кнопку "Добавить" еще раз в узле "Разные свойства" и выберите ``hibernate.query.factory_class`` в раскрывающемся списке "Имя свойства".
-[start=8]
+
. Выберите *org.hibernate.hql.classic.ClassicQueryTranslatorFactory* как "Значение свойства". Нажмите кнопку "ОК".
image::images/add-property-factoryclass.png[title="Диалоговое окно 'Добавить свойство Hibernate', в котором отображаются значения настроек для свойства hibernate.query.factory_class property"]
@@ -169,7 +169,7 @@
</hibernate-configuration>
----
-[start=9]
+
. Сохраните измененный файл.
Файл можно закрыть, т.к. необходимость в его изменении отсутствует.
@@ -308,7 +308,7 @@
}
----
-[start=5]
+
. Щелкните правой кнопкой мыши в редакторе и выберите команду "Исправить операторы импорта" (ALT+SHIFT+I; &#8984+SHIFT+I на компьютере Mac) для добавления любого необходимого оператора импорта ( ``org.hibernate.Session`` ) и сохраните изменения.
Теперь можно изменить класс ``FilmHelper.java`` для добавления методов, выполняющих запрос данных в БД.
@@ -344,7 +344,7 @@
select film0_.film_id as col_0_0_ from sakila.film film0_
----
-[start=5]
+
. Введите следующий запрос на извлечение из таблицы "Film" записей, в которых идентификатор фильма находится между 100 и 200.
[source,java]
@@ -356,7 +356,7 @@
В окне результата отобразится список записей. Теперь, после подтверждения правильности получаемых после выполнения запроса результатов, можно использовать запрос в служебном классе.
-[start=6]
+
. Добавьте следующий метод ``getFilmTitles`` к ``FilmHelper.java`` для извлечения фильмов с идентификатором, находящимся в определенном диапазоне, ограниченном переменными ``startID`` и ``endID`` .
[source,java]
@@ -375,7 +375,7 @@
}
----
-[start=7]
+
. Добавьте следующий метод ``getActorsByID`` для извлечения актеров, задействованных в определенном фильме. Для создания запроса в этом методе в качестве входной переменной используется ``filmId`` .
[source,java]
@@ -396,7 +396,7 @@
}
----
-[start=8]
+
. Исправьте операторы импорта и сохраните измененные данные.
После исправления параметров импорта выберите ``java.util.List`` и ``org.hibernate.Query`` .
@@ -426,7 +426,7 @@
}
----
-[start=2]
+
. Добавьте следующий метод для извлечения отдельного фильма согласно ``filmId`` .
[source,java]
@@ -448,7 +448,7 @@
}
----
-[start=3]
+
. Добавьте следующий метод для извлечения языка фильма согласно ``langId`` .
[source,java]
@@ -470,7 +470,7 @@
}
----
-[start=4]
+
. Сохраните изменения.
@@ -487,13 +487,13 @@
Имя управляемого компонента ``filmController`` используется в качестве значения для ``inputText`` и ``commandButton`` на странице JSF ``index.xhtml`` во время вызова методов в компоненте.
-[start=4]
+
. Выберите *dvdrental* в качестве пакета.
-[start=5]
+
. Введите *filmController* в качестве имени, используемого для управляемого компонента.
-[start=6]
+
. Установите для параметра "Контекст" значение "Сеанс". Нажмите кнопку 'Готово'.
image::images/hib-newmanagedbean.png[title="Мастер создания новых управляемых компонентов JSF"]
@@ -538,7 +538,7 @@
}
----
-[start=2]
+
. Добавьте следующий код (выделенный полужирным шрифтом) для создания экземпляра FilmController и извлечения фильмов.
[source,java]
@@ -578,7 +578,7 @@
}*
----
-[start=3]
+
. Добавьте следующие методы, используемые для отображения таблицы и перехода к страницам.* public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
@@ -624,7 +624,7 @@
Методы, возвращающие "index" или "browse", запрашивают обработчик переходов JSF для попытки открытия страницы под именем ``index.xhtml`` или ``browse.xhtml`` . Спецификация JSF 2.0 допускает использование правила неявных переходов в приложениях, использующих технологию Facelets. В таком приложении правила переходов не настраиваются в ``faces-config.xml`` . Вместо этого обработчик переходов пытается найти подходящую страницу в приложении.
-[start=4]
+
. Добавьте следующие методы для обращения к служебному классу в целях извлечения дополнительных данных о фильме.* public String getLanguage() {
int langID = current.getLanguageByLanguageId().getLanguageId().intValue();
String language = helper.getLangByID(langID);
@@ -655,7 +655,7 @@
----
-[start=5]
+
. Исправьте операторы импорта (CTRL+SHIFT+I) и сохраните измененные данные.
Можно использовать автозавершение кода в редакторе, упрощающее ввод кода.
@@ -696,7 +696,7 @@
</h:body>
----
-[start=5]
+
. Измените элемент ``<ui:insert>`` для изменения созданного по умолчанию имени на "body".
[source,html]
@@ -707,7 +707,7 @@
</div>
----
-[start=6]
+
. Сохраните изменения.
Содержимое, заключенное в элементе ``<ui:define name="body">`` в файлах ``index.xhtml`` и ``browse.xhtml`` , будет вставлено в местоположение, определенное в шаблоне с помощью `` <ui:insert name="body">Content</ui:insert>`` .
@@ -736,7 +736,7 @@
</html>
----
-[start=2]
+
. Измените страницу для использования элементов JSF ``<ui:composition>`` и ``<ui:define>`` и добавьте элемент ``<h:form>`` .
[source,xml]
@@ -760,7 +760,7 @@
Элементы ``<ui:composition>`` и ``<ui:define>`` используются в сочетании с созданным шаблоном страницы. Элемент ``<ui:composition>`` ссылается на местоположение шаблона, используемого этой страницей. Элемент ``<ui:define>`` ссылается на позицию в шаблоне, занятую вложенным кодом.
-[start=3]
+
. Добавьте следующие ссылки перехода, вызывающие методы ``next`` и ``previous`` в управляемом компоненте JSF.
[source,xml]
@@ -774,7 +774,7 @@
</ui:define>
----
-[start=4]
+
. Добавьте следующий элемент (выделенный полужирным шрифтом) ``dataTable`` для создания таблицы, в которой будут отображены извлеченные элементы.
[source,xml]
@@ -808,7 +808,7 @@
----
-[start=5]
+
. Сохраните изменения.
Теперь на начальной странице отображается список названий фильмов из базы данных. Каждая строка в таблице содержит ссылку "Просмотр", вызывающую метод ``prepareView`` в управляемом компоненте. Метод ``prepareView`` возвращает "browse" и открывает файл ``browse.xhtml`` .
@@ -827,18 +827,18 @@
image::images/hib-faceletsclient.png[title="Тип файла клиента шаблона Facelets в мастере создания файлов"]
-[start=3]
+
. Введите *browse* в качестве имени файла.
-[start=4]
+
. Чтобы найти шаблон для страницы, нажмите кнопку 'Обзор'. В результате откроется диалоговое окно 'Обзор файлов'.
-[start=5]
+
. Разверните папку "Веб-страницы" и выберите ``template.xhtml`` . Нажмите "Выбрать файл".
image::images/hib-browsetemplate.png[title="Выберите шаблон в диалоговом окне 'Обзор файлов'"]
-[start=6]
+
. Выберите*<ui:composition>* в качестве созданного тега корня. Нажмите кнопку 'Готово'.
При нажатии кнопки "Готово" файл ``browse.xhtml`` открывается в редакторе со следующим кодом.
@@ -864,7 +864,7 @@
В новом файле указан файл ``template.xhtml`` , а тег ``<ui:define>`` обладает свойством ``name="body"``
-[start=7]
+
. Добавьте следующий код (выделенный полужирным шрифтом) между тегами ``<ui:define>`` для создания формы и вызовите методы в управляемом компоненте "FilmController" для извлечения данных и заполнения формы.
[source,xml]
@@ -933,7 +933,7 @@
Файлы ``browse.xhtml`` и ``index.xhtml`` используют один и тот же шаблон страницы.
-[start=8]
+
. Сохраните изменения.
@@ -947,7 +947,7 @@
image::images/hib-browser1.png[title="Снимок браузера, в котором отображается список фильмов на странице индекса"]
-[start=2]
+
. В браузере нажмите "Просмотр" для загрузки файла ``browse.xhtml`` для просмотра дополнительных сведений о фильме.
@@ -962,22 +962,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
Нажмите кнопку "Далее".
-[start=3]
+
. Нажмите кнопку "Обзор" для открытия диалогового окна "Обзор папок репозитория".
-[start=4]
+
. Разверните корневой узел и выберите *samples/javaee/DVDStoreEE6*. Нажмите кнопку "ОК".
-[start=5]
+
. Укажите локальную папку для исходных файлов.
-[start=6]
+
. Нажмите кнопку 'Готово'.
После нажатия кнопки "Готово" среда IDE инициализирует локальную папку в качестве репозитория Subversion и выполняет проверку исходных файлов проекта на выходе.
-[start=7]
+
. Щелкните команду "Открыть проект" в диалоговом окне, которое появится после завершения проверки.
*Примечания.* Дополнительные сведения об установке Subversion см. в разделе link:../ide/subversion.html#settingUp[+Настройка Subversion+] в link:../ide/subversion.html[+Руководстве по Subversion в IDE NetBeans+].
diff --git a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_zh_CN.asciidoc
index c1b6d61..a2f73b4 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/hibernate-webapp_zh_CN.asciidoc
@@ -80,7 +80,7 @@
单击 "OK"(确定),MySQL 服务器节点下随即出现一个 Sakila 节点。
-[start=5]
+
. 右键单击 "Sakila" 节点,然后选择 "Connect"(连接)。
单击 "Connect"(连接)后,"Databases"(数据库)节点下面将列出 Sakila 数据库连接节点 ( ``jdbc:mysql://localhost:3306/sakila [_username_ on Default]`` )。打开连接时,可通过展开该连接节点查看数据库中数据。
@@ -97,16 +97,16 @@
(对于本教程,没有理由将项目库复制到指定文件夹,因为您将需要与其他用户共享库)。
-[start=4]
+
. 将服务器设置为 "GlassFish Server",并将 Java EE 版本设置为 "Java EE 6 Web" 或 "Java EE 7 Web"。单击 "Next"(下一步)。
-[start=5]
+
. 选中 "JavaServer Faces" 复选框并使用默认 JSF 2.x 库。
-[start=6]
+
. 在框架列表中选中 "Hibernate" 复选框。
-[start=7]
+
. 从 "Database Connection"(数据库连接)下拉列表中选择 sakila 数据库。单击 "Finish"(完成)。
*注:* 如果向导的 "Frameworks"(框架)面板中没有 sakila 数据库这一选项,请查看该连接是否列在 "Services"(服务)窗口的 "Databases"(数据库)节点下。如果此处没有该连接,则需要创建数据库连接。
@@ -133,18 +133,18 @@
image::images/add-property-showsql.png[title="显示 hibernate.show_sql 属性的设置值的 "Add Hibernate Property"(添加 Hibernate 属性)对话框"]
-[start=5]
+
. 展开 "Miscellaneous Properties"(其他属性)节点并单击 "Add"(添加)。
-[start=6]
+
. 在此对话框中,选择 ``properties hibernate.current_session_context_class`` 并将值设置为 ``thread`` 以启用 Hibernate 的自动会话上下文管理。
image::images/add-property-sessioncontext.png[title="显示为 hibernate.current_session_context_class 属性设置值的 "Add Hibernate Property"(添加 Hibernate 属性)对话框"]
-[start=7]
+
. 在 "Miscellaneous Properties"(其他属性)节点下再次单击 "Add"(添加),然后在 "Property Name"(属性名称)下拉列表中选择 ``hibernate.query.factory_class`` 。
-[start=8]
+
. 选择 *org.hibernate.hql.classic.ClassicQueryTranslatorFactory* 作为属性值。单击 "OK"(确定)。
image::images/add-property-factoryclass.png[title="显示 hibernate.query.factory_class 属性的设置值的 "Add Hibernate Property"(添加 Hibernate 属性)对话框"]
@@ -169,7 +169,7 @@
</hibernate-configuration>
----
-[start=9]
+
. 保存对该文件所做的更改。
由于不需要再次编辑该文件,因此可以关闭该文件。
@@ -308,7 +308,7 @@
}
----
-[start=5]
+
. 在编辑器中右键单击并选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)以添加任何需要的 import 语句 ( ``org.hibernate.Session`` ),并保存更改。
现在将修改 ``FilmHelper.java`` 以添加查询数据库的方法。
@@ -344,7 +344,7 @@
select film0_.film_id as col_0_0_ from sakila.film film0_
----
-[start=5]
+
. 键入以下查询在 film id 为 100 到 200 的 Film 表中检索记录。
[source,java]
@@ -356,7 +356,7 @@
结果窗口中显示了一个记录列表。测试过该查询可返回期待的结果后,可在 helper 类中使用该查询。
-[start=6]
+
. 将下面的 ``getFilmTitles`` 方法添加到 ``FilmHelper.java`` 以检索影片,其中 film id 介于变量 ``startID`` 和 ``endID`` 所指定的特定范围之间。
[source,java]
@@ -375,7 +375,7 @@
}
----
-[start=7]
+
. 添加下面的 ``getActorsByID`` 方法以检索特定影片中的演员。该方法将 ``filmId`` 作为输入变量以构造查询。
[source,java]
@@ -396,7 +396,7 @@
}
----
-[start=8]
+
. 修复导入并保存更改。
修复导入时,要选择 ``java.util.List`` 和 ``org.hibernate.Query`` 。
@@ -426,7 +426,7 @@
}
----
-[start=2]
+
. 添加以下方法以根据 ``filmId`` 检索单个影片。
[source,java]
@@ -448,7 +448,7 @@
}
----
-[start=3]
+
. 添加以下方法以根据 ``langId`` 检索影片语言。
[source,java]
@@ -470,7 +470,7 @@
}
----
-[start=4]
+
. 保存所做的更改。
@@ -487,13 +487,13 @@
在调用受管 Bean 中的方法时,将使用 Bean 名称 ``filmController`` 作为 JSF 页面 ``index.xhtml`` 中的 ``inputText`` 和 ``commandButton`` 的值。
-[start=4]
+
. 选择 *dvdrental* 作为包。
-[start=5]
+
. 键入 *filmController* 作为将用于受管 Bean 的名称。
-[start=6]
+
. 将 "Scope"(范围)设置为 "Session"(会话)。单击 "Finish"(完成)。
image::images/hib-newmanagedbean.png[title="新建 JSF 受管 Bean 向导"]
@@ -538,7 +538,7 @@
}
----
-[start=2]
+
. 添加以下代码(以粗体显示),创建 FilmController 实例并检索影片。
[source,java]
@@ -578,7 +578,7 @@
}*
----
-[start=3]
+
. 添加用于显示表和导航页面的以下方法。* public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
@@ -624,7 +624,7 @@
返回 "index" 或 "browse" 的方法将提示 JSF 导航处理程序尝试打开名为 ``index.xhtml`` 或 ``browse.xhtml`` 的页面。JSF 2.0 规范允许在使用 Facelets 技术的应用程序中使用隐式导航规则。此应用程序中,没有在 ``faces-config.xml`` 中配置任何导航规则。导航处理程序将尝试在应用程序中查找合适的页面。
-[start=4]
+
. 添加以下方法以访问 helper 类,以便检索其他影片详细信息。* public String getLanguage() {
int langID = current.getLanguageByLanguageId().getLanguageId().intValue();
String language = helper.getLangByID(langID);
@@ -655,7 +655,7 @@
----
-[start=5]
+
. 修复导入(Ctrl-Shift-I 组合键)并保存更改。
您可以在编辑器中使用代码完成以帮助键入代码。
@@ -696,7 +696,7 @@
</h:body>
----
-[start=5]
+
. 修改 ``<ui:insert>`` 元素,以将生成的默认名称更改为 "body"。
[source,html]
@@ -707,7 +707,7 @@
</div>
----
-[start=6]
+
. 保存所做的更改。
``index.xhtml`` 和 ``browse.xhtml`` 中的 ``<ui:define name="body">`` 元素包含的内容将插入到使用模板中的 ``<ui:insert name="body">Content</ui:insert>`` 指定的位置。
@@ -736,7 +736,7 @@
</html>
----
-[start=2]
+
. 修改该页面以使用 JSF ``<ui:composition>`` 和 ``<ui:define>`` 元素,并添加 ``<h:form>`` 元素。
[source,xml]
@@ -760,7 +760,7 @@
``<ui:composition>`` 和 ``<ui:define>`` 元素将与所创建的页面模板结合使用。 ``<ui:composition>`` 元素引用此页面将使用的模板的位置。 ``<ui:define>`` 元素引用包含的代码将占用的模板位置。
-[start=3]
+
. 添加以下导航链接以调用 JSF 受管 Bean 中的 ``previous`` 和 ``next`` 方法。
[source,xml]
@@ -774,7 +774,7 @@
</ui:define>
----
-[start=4]
+
. 添加以下 ``dataTable`` 元素(以粗体显示)来生成表,以便显示检索到的条目。
[source,xml]
@@ -808,7 +808,7 @@
----
-[start=5]
+
. 保存所做的更改。
现在,index 页面将显示数据库中的影片名称列表。表中的每一行都包含 "View" 链接,用于调用受管 Bean 中的 ``prepareView`` 方法。 ``prepareView`` 方法返回 "browse" 并打开 ``browse.xhtml`` 。
@@ -827,18 +827,18 @@
image::images/hib-faceletsclient.png[title="新建文件向导中的 "Facelets Template Client"(Facelets 模板客户端)文件类型"]
-[start=3]
+
. 键入 *browse* 作为文件名。
-[start=4]
+
. 通过单击 "Browse"(浏览)打开 "Browse Files"(浏览文件)对话框,以查找页面模板。
-[start=5]
+
. 展开 "Web Pages"(Web 页)文件夹并选择 ``template.xhtml`` 。单击 "Select File"(选择文件)。
image::images/hib-browsetemplate.png[title="在 "Browse Files"(浏览文件)对话框中选择模板"]
-[start=6]
+
. 选择 *<ui:composition>* 作为生成的根标记。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 ``browse.xhtml`` 文件将在编辑器中打开,其中包含以下代码。
@@ -864,7 +864,7 @@
您可以看到新文件指定了 ``template.xhtml`` 文件,并且 ``<ui:define>`` 标记具有属性 ``name="body"``
-[start=7]
+
. 在 ``<ui:define>`` 标记之间添加以下代码(以粗体显示)以创建窗体,并调用受管 Bean FilmController 中的方法以检索数据和填充窗体。
[source,xml]
@@ -933,7 +933,7 @@
您可以看到 ``browse.xhtml`` 和 ``index.xhtml`` 使用相同的页面模板。
-[start=8]
+
. 保存所做的更改。
@@ -947,7 +947,7 @@
image::images/hib-browser1.png[title="在索引页上显示影片列表的浏览器的屏幕快照"]
-[start=2]
+
. 在浏览器中,单击 "View" 加载 ``browse.xhtml`` 以查看影片详细信息。
@@ -962,22 +962,22 @@
``https://svn.netbeans.org/svn/samples~samples-source-code``
单击 "Next"(下一步)。
-[start=3]
+
. 单击 "Browse"(浏览)以打开 "Browse Repostiory Folders"(浏览资源库文件夹)对话框。
-[start=4]
+
. 展开根目录节点,然后选择 *samples/javaee/DVDStoreEE6*。单击 "OK"(确定)。
-[start=5]
+
. 指定用于存储源代码的 "Local Folder"(本地文件夹)。
-[start=6]
+
. 单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 会将本地文件夹初始化为 Subversion 资源库,并检出项目源代码。
-[start=7]
+
. 在完成检出操作后将会显示一个对话框,在该对话框中单击 "Open Project"(打开项目)。
*注:*有关安装 Subversion 的更多信息,请参见 link:../ide/subversion.html[+NetBeans IDE 中的 Subversion 指南+]中有关link:../ide/subversion.html#settingUp[+设置 Subversion+] 的部分。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo.asciidoc
index f13a635..9db0e64 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo.asciidoc
@@ -51,7 +51,7 @@
Tomcat servlet container |Open Source Edition 3.1.x or 4.x
_ _
-[start=7]
+
.x or 8.x
|link:http://www.dojotoolkit.org/download[+Dojo Toolkit+] |version 1.8.x or later
@@ -87,7 +87,7 @@
*Note: *The Projects window (Ctrl-1; ⌘-1 on Mac) provides a _logical view_ of important project contents, and is the main entry point to your project sources. The Files window (Ctrl-2; ⌘-2 on Mac) shows a _directory-based view_ of your projects, and includes any files and folders that are not displayed in the Projects Window.
-[start=4]
+
. Expand the `Web Pages` node in the Projects window.
You can see that a ``resources`` folder is listed under the `Web Pages` node in the Projects window. The ``resources`` folder contains the Dojo core and Dijit libraries from the link:http://www.dojotoolkit.org/download[+Dojo toolkit+]. In order to implement Dojo's Tree widget, you essentially require two components: the `ItemFileReadStore` module from the core library and the `Tree` widget itself contained in the Dijit library.
@@ -98,7 +98,7 @@
*Note.* The `DojoX` library is not required for this project.
-[start=5]
+
. Expand the `Libraries` node in the Projects window and confirm that all the required libraries are on the classpath.
*Note.* Depending on your configuration, you might need to resolve a missing server problem. If you see a ``<Missing Java EE Server>`` node under the `Libraries` node, right-click the project node and choose Resolve Missing Server Problem in the popup menu.
@@ -138,7 +138,7 @@
* `link:http://dojotoolkit.org/reference-guide/1.6/djConfig.html[+djConfig+]` allows you to override global settings that control how Dojo operates (e.g., using the `parseOnLoad` property).
* `parseOnLoad` set to `true` ensures that widgets and page mark-up are parsed as the page is loaded.
-[start=3]
+
. Add a link to the `nihilo` link:http://docs.dojocampus.org/dijit/themes[+sample theme+] contained in the toolkit by adding the following `@import` statement (in bold) between the `<head>` tags and beneath the `<script>` tags that you added.
[source,xml]
@@ -161,7 +161,7 @@
The `nihilo` theme is included by default in the toolkit. You can expand the `dijit/themes` folder in the Projects window to see other sample themes that are provided by default.
-[start=4]
+
. Add the following class selector to the `<body>` tag of the page to specify the name of the theme you are using. When you do this, any Dojo widget which has been loaded into the page will be rendered using the styles associated with the theme.
[source,java]
@@ -193,7 +193,7 @@
* `link:http://docs.dojocampus.org/dojo/data/ItemFileReadStore[+dojo.data.ItemFileReadStore+]`: reads the JSON structured contents from an HTTP endpoint (In <<prepareServlet,Preparing a Servlet to Initiate a JSON Response>>, you'll implement a servlet for this purpose.) and stores all the items in-memory for simple and quick access.
* `link:http://docs.dojocampus.org/dijit/Tree[+dijit.Tree+]`: The Tree widget that provides a view of the JSON data retrieved from `ItemFileReadStore`.
-[start=2]
+
. Add the following code (in bold) to add an `ItemFileReadStore` and `Tree` widget.
[source,html]
@@ -232,13 +232,13 @@
At this point, you want to compile these sources and create a Java archive (JAR file) which you will add to the `DojoTreeSample` project.
-[start=3]
+
. Click the New Project button ( image:images/new-project-btn.png[] ) in the toolbar to open the New Project wizard.
-[start=4]
+
. In the New Project wizard, select the Java Class Library project template in the Java category. Click Next.
-[start=5]
+
. In the Name and Location panel of the Java Class Library wizard, type *`json`* as the Project Name. Click Finish.
When you click Finish the new project is created and opens in the Projects window.
@@ -246,26 +246,26 @@
You now need to copy the JSON sources that you download to the ``json`` project in the same way that you copied the Dojo toolkit resources to the ``DojoTreeSample`` project.
-[start=6]
+
. Extract the `JSON-java-master.zip` archive and copy (Ctrl-C; ⌘-C on Mac) the Java source files that are in the root folder.
*Note.* You do not need to copy the `zip` folder and its contents that is also located in the root folder of the extracted archive.
-[start=7]
+
. In the IDE's Projects window, right-click the Source Packages node and choose New > Java Package in the popup menu.
-[start=8]
+
. Type *json* as the Package Name. Click Finish.
-[start=9]
+
. Right-click the `json` source package and choose Paste in the popup menu.
When you expand the package you can see the ``json`` sources.
image::images/proj-win-json-sources.png[title="Sources are now contained in the new 'json' project"]
-[start=10]
+
. Right-click the `json` project node in the Projects window and choose Clean and Build to build the project.
When you build your project, all Java classes get compiled into `.class` files. The IDE creates a `build` folder to contain compiled classes, as well as a `dist` folder that contains a JAR file for the project. These folders can be viewed from the IDE's Files window.
@@ -277,7 +277,7 @@
Now that you have the `json.jar` file, you can resolve the reference problems that the `DojoTreeSample` project has been exhibiting since you opened it.
-[start=11]
+
. In the Projects window, right-click the `DojoTreeSample`'s Libraries node and choose Add JAR/Folder. Then, in the dialog, navigate to the location of the `json` project's `dist` folder and select the `json.jar` file.
Alternatively, you can right-click the Libraries node and choose Add Project in the popup menu and locate the `json` project in the Add Project dialog box.
@@ -289,10 +289,10 @@
*Note: *Although the `json.jar` file is listed under the project's `Libraries` node, it is referenced from its original location - not copied and added to the project (e.g., you won't be able to locate it under the `DojoTreeSample` project in the Files window). Therefore, if you change the location of the JAR file, the reference will be broken.
-[start=12]
+
. Expand the `Source Packages` > `dojo.indians` package and double-click the `Tribe` and `TribeDataManager` classes to open them in the editor.
-[start=13]
+
. Add necessary import statements to both classes. In each class, right-click in the editor and choose Fix Imports.
The `Tribe` class requires the following imports:
@@ -316,7 +316,7 @@
Note that the APIs for JSON classes are also provided at link:http://json.org/java[+http://json.org/java+] - you may want to keep this page open as you later examine code in `Tribe` and `TribeDataManager`.
-[start=14]
+
. Examine the ArrayList in `TribeDataManager`. The ArrayList is a collection of `Tribe` objects. Looking at the first element of the ArrayList, you can see a new `Tribe` object created and added to the list:
[source,java]
@@ -326,7 +326,7 @@
----
Each `Tribe` object captures three points of information: _tribe_, _category_, and _region_. The data for this exercise has been taken from Wikipedia's entry on link:http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States#Ethno-linguistic_classification[+Native Americans in the United States+]. As you can determine, multiple _tribes_ are classified within a _category_, and numerous categories may be contained within a larger _region_.
-[start=15]
+
. Open the `Tribe` class in the editor, and note that it is basically a link:http://java.sun.com/docs/books/tutorial/javabeans/index.html[+JavaBean+], with the exception of the `toJSONObject()` method:
[source,java]
@@ -341,7 +341,7 @@
}
----
-[start=16]
+
. Switch back to `TribeDataManager` (Ctrl-Tab) and examine the methods included in the class. Open the Navigator (Ctrl-7; ⌘-7 on Mac) to view a list of fields and properties contained in the class.
image::images/dojo-navigator.png[title="Use the Navigator to view class fields and properties"]
@@ -373,12 +373,12 @@
}
----
-[start=17]
+
. Open the Javadoc on the `getIndiansAsJSONObject()` method. You can do this by returning to the Navigator (Ctrl-7; ⌘-7 on Mac) and hovering over the method. Otherwise, choose Window > Other > Javadoc from the main menu, then click on the method signature in the editor.
image::images/javadoc-window.png[title="The Javadoc for TribeDataManager provides an example of JSON data"]
-[start=18]
+
. Examine the example of JSON data that is provided in the Javadoc. Note that the format of the data conforms to the examples provided in the link:http://o.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/available-stores/dojo-data-item[+Dojo documentation+].
@@ -390,16 +390,16 @@
image::images/debugger-breakpoint.png[title="Use the Java Debugger to step through code"]
-[start=2]
+
. Select the ``DojoTreeSample`` project in the Projects window.
-[start=3]
+
. Run the debugger (click the Debug Project button ( image:images/debug-btn.png[] ) in the toolbar).
-[start=4]
+
. Use the Step Into ( image:images/step-into-btn.png[] ) and Step Over ( image:images/step-over-btn.png[] ) buttons in the toolbar.
-[start=5]
+
. Examine variable and expression values in the Local Variables window (Window > Debugging > Variables).
For more information on the Java Debugger, see the following screencasts:
@@ -424,7 +424,7 @@
image::images/new-servlet-wizard.png[title="Use the New Servlet wizard to create servlets"]
-[start=3]
+
. Confirm that the default Servlet Name and URL Patterns values are correct. Click Finish to generate the skeleton class for the servlet.
The function of the servlet is to call the `getIndiansAsJSONObject()` method, and use the data from this method to respond to the client request. In order to prepare a response in JSON format, we have to first set the mime type of the response to JSON format.
@@ -432,7 +432,7 @@
*Note.* The wizard will automatically add the servlet name and URL pattern to `web.xml`. Consequently, any requests to the host domain (i.e., `http://localhost:8080/DojoTreeSample/`) for `TribeServlet` will be handled by the `dojo.indians.TribeServlet` class. If you open `web.xml` in the editor you can see that the file now contains the `<servlet>` and `<servlet-mapping>` elements.
-[start=4]
+
. Modify the `processRequest()` method by making the following changes (in bold).
[source,java]
@@ -444,7 +444,7 @@
This change sets the `Content-Type` header of the HTTP Response to indicate that any returned content is in JSON format.
-[start=5]
+
. Replace the commented code within the `processRequest()` method's `try` block with the following (changes in *bold*):
[source,java]
@@ -469,7 +469,7 @@
To reformat your code, right-click within the editor and choose Format.
-[start=6]
+
. Use the IDE's hints to add the following import statements.
[source,java]
@@ -479,7 +479,7 @@
import dojo.org.json.JSONObject;
----
-[start=7]
+
. To run the project, select the `DojoTreeSample` project node in the Projects window, then click the Run Project ( image:images/run-project-btn.png[] ) button in the IDE's toolbar.
The browser opens to display the welcome page (`dojoDemo.html`), and you can see that the Dojo Tree widget is displaying data from the ArrayList properly, as in the <<final,screenshot above>>.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ja.asciidoc
index fe263eb..95b20f0 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ja.asciidoc
@@ -51,7 +51,7 @@
Tomcatサーブレット・コンテナ |Open Source Edition 3.1.xまたは4.x
_ _
-[start=7]
+
.xまたは8.x
|link:http://www.dojotoolkit.org/download[+Dojoツールキット+] |バージョン1.8.x以降
@@ -87,7 +87,7 @@
*注意: *「プロジェクト」ウィンドウ([Ctrl]-[1]、Macの場合は[⌘]-[1])は、プロジェクト内の重要な項目の_論理ビュー_を示す、プロジェクト・ソースへのメイン・エントリ・ポイントです。「ファイル」ウィンドウ([Ctrl]-[2]、Macの場合は[⌘]-[2])には、プロジェクトの_ディレクトリ・ベースのビュー_が表示され、「プロジェクト」ウィンドウでは表示されないすべてのファイルやフォルダが含まれます。
-[start=4]
+
. 「プロジェクト」ウィンドウで`Web Pages`ノードを展開します。
「プロジェクト」ウィンドウの`Web Pages`ノードの下に ``resources`` フォルダが表示されます。 ``resources`` フォルダには、link:http://www.dojotoolkit.org/download[+Dojo toolkit+]からのDojoコアとDijitライブラリが含まれます。Dojoのツリー・ウィジェットを実装するには、コア・ライブラリの`ItemFileReadStore`モジュールと、Dijitライブラリに含まれている`Tree`ウィジェット自体の、2つのコンポーネントが基本的に必要です。
@@ -98,7 +98,7 @@
*注意:*このプロジェクトでは、`DojoX`ライブラリは不要です。
-[start=5]
+
. 「プロジェクト」ウィンドウで`Libraries`ノードを展開し、必要なすべてのライブラリがクラスパスにあることを確認します。
*注意:*構成によっては、不足しているサーバーの問題を解決しなければならないことがあります。`Libraries`ノードの下に ``<Missing Java EE Server>`` ノードが表示される場合は、プロジェクト・ノードを右クリックし、ポップアップ・メニューで「不足しているサーバーの問題を解決」を選択します。
@@ -138,7 +138,7 @@
* `link:http://dojotoolkit.org/reference-guide/1.6/djConfig.html[+djConfig+]`を使用すると、Dojoの動作を制御するグローバル設定をオーバーライドできます(たとえば、`parseOnLoad`プロパティを使用して)。
* `parseOnLoad`を`true`に設定すると、ページがロードされるときに必ずウィジェットとページ・マークアップが解析されます。
-[start=3]
+
. 次の`@import`文(太字)を`<head>`タグの間と追加する`<script>`タグの下に追加して、ツールキットに含まれる`nihilo`link:http://docs.dojocampus.org/dijit/themes[+サンプル・テーマ+]へのリンクを追加します。
[source,xml]
@@ -161,7 +161,7 @@
`nihilo`テーマはツールキットにデフォルトで含まれています。「プロジェクト」ウィンドウで`dijit/themes`フォルダを展開して、デフォルトで提供されている他のサンプル・テーマを表示できます。
-[start=4]
+
. 次のクラス・セレクタをページの`<body>`タグに追加して、使用しているテーマの名前を指定します。これを実行すると、ページにロードされているすべてのDojoウィジェットが、テーマに関連付けられたスタイルを使用してレンダリングされます。
[source,java]
@@ -193,7 +193,7 @@
* `link:http://docs.dojocampus.org/dojo/data/ItemFileReadStore[+dojo.data.ItemFileReadStore+]`: JSON構造化コンテンツをHTTPエンドポイントから読み取り(<<prepareServlet,JSONレスポンスを開始するサーブレットの準備>>で、この目的に使用するサーブレットを実装します)、すべての項目をメモリー内に保存して単純にすばやくアクセスできるようにします。
* `link:http://docs.dojocampus.org/dijit/Tree[+dijit.Tree+]`: `ItemFileReadStore`から取得されたJSONデータを表示するツリー・ウィジェットです。
-[start=2]
+
. 次のコード(太字)を追加して、`ItemFileReadStore`および`Tree`ウィジェットを追加します。
[source,html]
@@ -232,13 +232,13 @@
この時点で、これらのソースをコンパイルして、`DojoTreeSample`プロジェクトに追加するJava Archive (JARファイル)を作成します。
-[start=3]
+
. ツールバーの「新規プロジェクト」ボタン(image:images/new-project-btn.png[])をクリックして新規プロジェクト・ウィザードを開きます。
-[start=4]
+
. 新規プロジェクト・ウィザードで、「Java」カテゴリの「Javaクラス・ライブラリ」プロジェクト・テンプレートを選択します。「次」をクリックします。
-[start=5]
+
. Javaクラス・ライブラリ・ウィザードの「名前と場所」パネルで、「プロジェクト名」として「*`json`*」を入力します。「終了」をクリックします。
「終了」をクリックすると新しいプロジェクトが作成され、「プロジェクト」ウィンドウで開きます。
@@ -246,26 +246,26 @@
Dojoツールキット・リソースを ``DojoTreeSample`` プロジェクトにコピーしたのと同じ方法で、 ``json`` プロジェクトにダウンロードするJSONソースをコピーする必要があります。
-[start=6]
+
. `JSON-java-master.zip`アーカイブを抽出し、ルート・フォルダにあるJavaソース・ファイルをコピーします([Ctrl]-[C]、Macの場合は⌘-C)。
*注意:*抽出したアーカイブのルート・フォルダにある`zip`フォルダとその内容をコピーする必要はありません。
-[start=7]
+
. IDEの「プロジェクト」ウィンドウで「ソース・パッケージ」ノードを右クリックし、ポップアップ・メニューで「新規」>「Javaパッケージ」を選択します。
-[start=8]
+
. パッケージ名として*json*と入力します。「終了」をクリックします。
-[start=9]
+
. `json`ソース・パッケージを右クリックし、ポップアップ・メニューで「貼付け」を選択します。
パッケージを展開すると、 ``json`` ソースが表示されます。
image::images/proj-win-json-sources.png[title="新しい「json」プロジェクトに含まれるようになったソース"]
-[start=10]
+
. 「プロジェクト」ウィンドウで「`json`」プロジェクト・ノードを右クリックし、「消去してビルド」を選択してプロジェクトをビルドします。
プロジェクトをビルドすると、すべてのJavaクラスが`.class`ファイルにコンパイルされます。IDEは、コンパイル済クラスを格納するための`build`フォルダと、プロジェクトのJARファイルを格納する`dist`フォルダを作成します。これらのフォルダはIDEの「ファイル」ウィンドウから表示できます。
@@ -277,7 +277,7 @@
`json.jar`ファイルができたので、`DojoTreeSample`プロジェクトを開いたときから発生している参照の問題を解決できます。
-[start=11]
+
. 「プロジェクト」ウィンドウで`DojoTreeSample`の「ライブラリ」ノードを右クリックし、「JAR/フォルダの追加」を選択します。次に、ダイアログで`json`プロジェクトの`dist`フォルダの場所に移動し、`json.jar`ファイルを選択します。
「ライブラリ」ノードを右クリックしてポップアップ・メニューで「プロジェクトの追加」を選択し、「プロジェクトの追加」ダイアログ・ボックスで`json`プロジェクトを探すこともできます。
@@ -289,10 +289,10 @@
*注意: *`json.jar`ファイルはプロジェクトの「`ライブラリ`」ノードの下に表示されますが、元の場所から参照されます。コピーされてプロジェクトに追加されるのではありません(たとえば、「ファイル」ウィンドウで`DojoTreeSample`プロジェクトの下には見つかりません)。したがって、JARファイルの場所を変更すると、参照が壊れます。
-[start=12]
+
. 「`ソース・パッケージ`」> `dojo.indians`パッケージを展開し、`Tribe`クラスと`TribeDataManager`クラスをダブルクリックしてエディタで開きます。
-[start=13]
+
. 必要なインポート文を両方のクラスに追加します。各クラスで、エディタ上で右クリックし、「インポートを修正」を選択します。
`Tribe`クラスには次のインポートが必要です。
@@ -316,7 +316,7 @@
JSONクラスのAPIもlink:http://json.org/java[+http://json.org/java+]で提供されています。後で`Tribe`と`TribeDataManager`のコードを調べるので、このページを開いておいてください。
-[start=14]
+
. `TribeDataManager`のArrayListを調べます。ArrayListは`Tribe`オブジェクトのコレクションです。ArrayListの最初の要素を調べると、新しい`Tribe`オブジェクトが作成されてリストに追加されていることがわかります。
[source,java]
@@ -326,7 +326,7 @@
----
各`Tribe`オブジェクトは、「_部族_」、「_カテゴリ_」および「_地域_」という3つの情報を収集します。この課題用のデータは、Wikipediaの「link:http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States#Ethno-linguistic_classification[+Native Americans in the United States+]」のエントリから取得されています。ご存知のとおり、複数の「_部族_」が1つの「_カテゴリ_」に分類され、多数のカテゴリがより大きな1つの「_地域_」に含まれる場合があります。
-[start=15]
+
. `Tribe`クラスをエディタで開くと、これは基本的にlink:http://java.sun.com/docs/books/tutorial/javabeans/index.html[+JavaBean+]であり、`toJSONObject()`メソッドのみが異なることがわかります。
[source,java]
@@ -341,7 +341,7 @@
}
----
-[start=16]
+
. 再度`TribeDataManager`に切り替え([Ctrl]-[Tab])、クラスに含まれているメソッドを調べます。ナビゲータを開いて([Ctrl]-[7]、Macの場合は[⌘]-[7])、クラスに含まれているフィールドとプロパティのリストを表示します。
image::images/dojo-navigator.png[title="ナビゲータを使用した、クラスのフィールドおよびプロパティの表示"]
@@ -373,12 +373,12 @@
}
----
-[start=17]
+
. `getIndiansAsJSONObject()`メソッドに関するJavadocを開きます。これは、ナビゲータに戻り([Ctrl]-[7]、Macの場合は[⌘]-[7])、メソッドの上にカーソルを置くことで行うことができます。または、メイン・メニューから「ウィンドウ」>「その他」>「Javadoc」を選択し、エディタでメソッド署名をクリックします。
image::images/javadoc-window.png[title="JSONデータの例を示すTribeDataManagerのJavadoc"]
-[start=18]
+
. Javadocに示されているJSONデータの例を調べます。データの形式は、link:http://o.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/available-stores/dojo-data-item[+Dojoのドキュメント+]に示されている例に準拠しています。
@@ -390,16 +390,16 @@
image::images/debugger-breakpoint.png[title="Javaデバッガを使用したコードのステップ実行"]
-[start=2]
+
. 「プロジェクト」ウィンドウで「 ``DojoTreeSample`` 」プロジェクトを選択します。
-[start=3]
+
. デバッガを実行します(ツールバーで「プロジェクトをデバッグ」(image:images/debug-btn.png[])ボタンをクリックします)。
-[start=4]
+
. ツールバーの「ステップ・イン」(image:images/step-into-btn.png[])ボタンと「ステップ・オーバー」(image:images/step-over-btn.png[])ボタンを使用します。
-[start=5]
+
. 変数と式の値を「ローカル変数」ウィンドウ(「ウィンドウ」→「デバッグ」→「変数」)で調べます。
Javaデバッガの詳細は、次のスクリーンキャストを参照してください。
@@ -424,7 +424,7 @@
image::images/new-servlet-wizard.png[title="新規サーブレット・ウィザードを使用したサーブレットの作成"]
-[start=3]
+
. デフォルトのサーブレット名とURLパターン値が正しいことを確認します。「終了」をクリックすると、サーブレットのスケルトン・クラスが生成されます。
サーブレットの機能は、`getIndiansAsJSONObject()`メソッドをコールし、このメソッドからのデータを使用してクライアント・リクエストに応答することです。JSON形式のレスポンスを準備するには、最初にレスポンスのMIMEタイプをJSON形式に設定する必要があります。
@@ -432,7 +432,7 @@
*注意:*ウィザードにより、サーブレット名とURLパターンが自動的に`web.xml`に追加されます。その結果、`TribeServlet`のホスト・ドメイン(`http://localhost:8080/DojoTreeSample/`)に対するすべてのリクエストが、`dojo.indians.TribeServlet`クラスによって処理されます。エディタで`web.xml`を開くと、ファイルに`<servlet>`および`<servlet-mapping>`要素が含まれているのがわかります。
-[start=4]
+
. 次の変更(太字)を行って、`processRequest()`メソッドを変更します。
[source,java]
@@ -444,7 +444,7 @@
この変更により、HTTPレスポンスの`Content-Type`ヘッダーが、返される内容がすべてJSON形式であることを示すように設定されます。
-[start=5]
+
. `processRequest()`メソッドの`try`ブロック内のコメントアウトされているコードを、次のように置き換えます(*太字*部分が変更箇所)。
[source,java]
@@ -469,7 +469,7 @@
コードを再フォーマットするには、エディタ内で右クリックし、「フォーマット」を選択します。
-[start=6]
+
. IDEのヒントを使用して、次のインポート文を追加します。
[source,java]
@@ -479,7 +479,7 @@
import dojo.org.json.JSONObject;
----
-[start=7]
+
. プロジェクトを実行するには、「プロジェクト」ウィンドウで`DojoTreeSample`プロジェクト・ノードを選択し、IDEのツールバーの「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックします。
ブラウザが開いて開始画面(`dojoDemo.html`)が表示され、<<final,上のスクリーンショット>>のように、Dojo TreeウィジェットでArrayListのデータが正しく表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_pt_BR.asciidoc
index a2dc7ff..a1809a3 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_pt_BR.asciidoc
@@ -51,7 +51,7 @@
Contêiner do servlet Tomcat |Open Source Edition 3.1.x ou 4.x
_ _
-[start=7]
+
.x ou 8.x
|link:http://www.dojotoolkit.org/download[+Kit de ferramentas do Dojo+] |versão 1.8.x ou posterior
@@ -87,7 +87,7 @@
*Observação: *A janela Projetos (Ctrl-1; ⌘-1 no Mac) oferece uma _view lógica_ dos conteúdos importantes do projeto e é o ponto de entrada principal para os códigos-fonte do projeto. A janela Arquivos (Ctrl-2; ⌘-2 no Mac) mostra uma _view com base no diretório_ dos projetos e inclui os arquivos e as pastas que não são exibidos na Janela de Projetos.
-[start=4]
+
. Expanda o nó `Páginas Web` na janela Projetos.
Você pode ver que uma pasta ``recursos`` é listada sob o nó `Páginas Web` na janela Projetos. A pasta ``recursos`` contém o núcleo e as bibliotecas do Dojo do link:http://www.dojotoolkit.org/download[+kit de ferramentas do Dojo+]. Para implementar o widget Árvore do Dojo, são necessários basicamente 2 componentes: o módulo `ItemFileReadStore` da biblioteca core e o próprio widget `Árvore`, contido na biblioteca Dijit.
@@ -98,7 +98,7 @@
*Observação.* A biblioteca `DojoX` não é necessária nesse projeto.
-[start=5]
+
. Expanda o nó `Bibliotecas` na janela Projetos e confirme se todas as bibliotecas obrigatórias estão no classpath.
*Observação.* Dependendo da sua configuração, pode ser necessário resolver um problema de servidor ausente. Se você vir um nó ``<Servidor Java EE Ausente>`` sob o nó `Bibliotecas`, clique com o botão direito do mouse no nó do projeto e escolha Resolver Problema de Servidor Ausente no menu pop-up.
@@ -138,7 +138,7 @@
* O `link:http://dojotoolkit.org/reference-guide/1.6/djConfig.html[+djConfig+]` permite substituir as definições globais que controlam como o Dojo opera (por exemplo, usando a propriedade `parseOnLoad`).
* A propriedade `parseOnLoad` definida como `true` garante que o parse das marcações de página e dos widgets seja feito durante o carregamento da página.
-[start=3]
+
. Adicione um link ao tema de exemplo`nihilo` contido no kit de ferramentas, adicionando a instrução `@import` (em negrito) a seguir entre as tags `<head>` e sob as tags `<script>` adicionadas.
[source,xml]
@@ -161,7 +161,7 @@
O tema `nihilo` é incluído no kit de ferramenta por default. Você pode expandir a pasta `dijit/themes` na janela Projetos para ver outros temas de exemplo fornecidos por default.
-[start=4]
+
. Adicione o seguinte seletor de classe à tag `<body>` da página para especificar o nome do tema que você está usando. Quando você faz isso, qualquer widget do Dojo que tenha sido carregado na página será renderizado usando os estilos associados ao tema.
[source,java]
@@ -193,7 +193,7 @@
* `link:http://docs.dojocampus.org/dojo/data/ItemFileReadStore[+dojo.data.ItemFileReadStore+]`: lê o conteúdo com estrutura JSON de um ponto final HTTP (em <<prepareServlet,Preparando um Servlet para Iniciar uma Resposta JSON>>, você implementará um servlet com essa finalidade) e armazena todos os itens residentes na memória para um acesso rápido e simples.
* `link:http://docs.dojocampus.org/dijit/Tree[+dijit.Tree+]`: o widget Árvore que fornece uma view dos dados JSON recuperados do `ItemFileReadStore`.
-[start=2]
+
. Adicione o código (em negrito) a seguir para adicionar um widget `ItemFileReadStore` e `Árvore`.
[source,html]
@@ -232,13 +232,13 @@
Neste momento, compile esses códigos-fontes e crie um arquivo compactado JAR (arquivo Java) que possa ser adicionado ao projeto `DojoTreeSample`.
-[start=3]
+
. Clique no botão Novo Projeto (image:images/new-project-btn.png[]) na barra de ferramentas para abrir o assistente do Novo Projeto.
-[start=4]
+
. No assistente do Novo Projeto, selecione o tipo de projeto de Bibliotecas de Classes Java na categoria Java. Clique em Próximo.
-[start=5]
+
. No painel Nome e Local do assistente da Biblioteca de Classes Java, digite *`json`* como Nome do Projeto. Clique em Finalizar.
Quando você clicar em Finalizar, o novo projeto será criado e aberto na janela Projetos.
@@ -246,26 +246,26 @@
Agora, você precisa copiar os códigos-fontes JSON que obteve por download para o projeto ``json`` da mesma forma que copiou os recursos do kit de ferramentas Dojo no projeto ``DojoTreeSample`` .
-[start=6]
+
. Extraia o archive `JSON-java-master.zip` e copie (Ctrl-C; ⌘-C no Mac) os arquivos de código-fonte Java que estão na pasta-raiz.
*Observação.* Não é necessário copiar a pasta `zip` e seu conteúdo que também se encontra na pasta-raiz do archive extraído.
-[start=7]
+
. Na janela Projetos do IDE, clique com o botão direito do mouse no nó Pacotes de Código-fonte e selecione Novo > Pacote Java no menu pop-up.
-[start=8]
+
. Digite *json* como Nome do Pacote. Clique em Finalizar.
-[start=9]
+
. Clique com o botão direito do mouse no pacote de código-fonte `json` e escolha Colar no menu pop-up.
Ao expandir o pacote, você verá os códigos-fonte ``json`` .
image::images/proj-win-json-sources.png[title="Agora, os códigos-fonte estão contidos no novo projeto 'json'"]
-[start=10]
+
. Clique com o botão direito do mouse no nó do projeto `json` na janela Projetos e escolha Limpar e Compilar para compilar o projeto.
Quando você cria o projeto, todas as classes Java são criadas nos arquivos `.class`. O IDE cria uma pasta `build` que contém as classes criadas, bem como a pasta `dist` que contém um arquivo JAR para o projeto. Essas pastas podem ser exibidas na janela Arquivos do IDE.
@@ -277,7 +277,7 @@
Agora que o arquivo `json.jar` existe, é possível solucionar os problemas de referência que o projeto `DojoTreeSample` vem exibindo desde que foi aberto.
-[start=11]
+
. Na janela Projetos, clique com o botão direito no nó das Bibliotecas do `DojoTreeSample` e selecione Adicionar JAR/Pasta. Em seguida, na caixa de diálogo, vá até o local da pasta `dist` do projeto `json` e selecione o arquivo `json.jar`.
Se preferir, clique com o botão direito do mouse no nó Bibliotecas e escolha Adicionar Projeto no menu pop-up e localize o projeto `json` na caixa de diálogo Adicionar Projeto.
@@ -289,10 +289,10 @@
*Observação: *Mesmo que o arquivo `json.jar` esteja listado no nó `Libraries` do projeto, ele será referenciado na sua localização original, não sendo copiado e adicionado ao projeto (por exemplo, não será possível localizá-lo no projeto `DojoTreeSample` da janela Arquivos). Por isso, se você alterar o local do arquivo JAR, a referência será interrompida.
-[start=12]
+
. Expanda o pacote `Source Packages` > `dojo.indians` e clique duas vezes nas classes `Tribe` e `TribeDataManager` para abri-las no editor.
-[start=13]
+
. Adicione as instruções de importação necessárias para ambas as classes. Em cada classe, clique com o botão direito do mouse no editor e selecione Corrigir Importações.
A classe `Tribe` exige as seguintes importações:
@@ -316,7 +316,7 @@
Observe que as APIs para as classes JSON também são fornecidas em link:http://json.org/java[+http://json.org/java+] - você pode manter esta página aberta ao examinar posteriormente o código em `Tribe` e `TribeDataManager`.
-[start=14]
+
. Examine a ArrayList em `TribeDataManager`. A ArrayList é uma coleção de objetos da `Tribe`. Observando o primeiro elemento da ArrayList, é possível ver um novo objeto criado da `Tribe` e adicionado à lista:
[source,java]
@@ -326,7 +326,7 @@
----
Cada objeto da `Tribe` captura três pontos de informação: _tribo_, _categoria_ e _região_. Os dados para este exercício foram retirados da entrada da Wikipédia em link:http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States#Ethno-linguistic_classification[+Native Americans in the United States+]. Como você pode determinar, várias _tribos_ são classificadas em uma _categoria_ e diversas categorias podem estar contidas em uma grande _região_.
-[start=15]
+
. Abra a classe `Tribe` no editor e observe que ela é basicamente um link:http://java.sun.com/docs/books/tutorial/javabeans/index.html[+JavaBean+], com exceção do método `toJSONObject()`:
[source,java]
@@ -341,7 +341,7 @@
}
----
-[start=16]
+
. Retorne ao `TribeDataManager` (Ctrl-Tab) e examine os métodos incluídos na classe. Abra o Navegador (Ctrl-7; ⌘-7 no Mac) para exibir uma lista de campos e propriedades contidos na classe.
image::images/dojo-navigator.png[title="Utilizar o Navigator para exibir os campos e propriedades da classe"]
@@ -373,12 +373,12 @@
}
----
-[start=17]
+
. Abra o Javadoc no método `getIndiansAsJSONObject()`. É possível fazer isso retornando ao Navegador (Ctrl-7; ⌘-7 no Mac) e colocando o ponteiro sobre o método. Ou então, selecione Janela > Outro > Javadoc no menu principal e, em seguida, clique na assinatura do método no editor.
image::images/javadoc-window.png[title="O Javadoc para TribeDataManager fornece um exemplo de dados JSON"]
-[start=18]
+
. Examine o exemplo de dados JSON fornecidos no Javadoc. Observe que o formato dos dados está de acordo com os exemplos fornecidos na link:http://o.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/available-stores/dojo-data-item[+documentação do Dojo+].
@@ -390,16 +390,16 @@
image::images/debugger-breakpoint.png[title="Usar o Depurador Java para a etapa por meio de código"]
-[start=2]
+
. Selecione o projeto ``DojoTreeSample`` na janela Projetos.
-[start=3]
+
. Execute o depurador (clique no botão Depurar Projeto (image:images/debug-btn.png[] ) da barra de ferramentas).
-[start=4]
+
. Use os botões Fazer Step Into (image:images/step-into-btn.png[]) e Fazer Step Over (image:images/step-over-btn.png[]) da barra de ferramentas.
-[start=5]
+
. Examine os valores da variável e da expressão na janela Variáveis Locais (Janela > Depuração > Variáveis).
Para obter mais informações sobre o Depurador Java, consulte os seguintes screencasts:
@@ -424,7 +424,7 @@
image::images/new-servlet-wizard.png[title="Utilizar o assistente de Novo Servlet para criar servlets"]
-[start=3]
+
. Confirme se os valores padrão de Nome do Servlet e Padrões de URL estão corretos. Clique em Finalizar para gerar a classe skeleton do servlet.
A função do servlet é chamar o método `getIndiansAsJSONObject()` e usar os dados desse método para responder à solicitação do cliente. Para preparar uma resposta no formato JSON, temos que, primeiro, definir o tipo de mime da resposta para o formato JSON.
@@ -432,7 +432,7 @@
*Observação.* O assistente adicionará automaticamente o nome do servlet e o padrão de URL ao arquivo `web.xml`. Consequentemente, as solicitações ao domínio host (`http://localhost:8080/DojoTreeSample/`) pelo `TribeServlet` serão manipuladas pela classe `dojo.indians.TribeServlet`. Se você abrir `web.xml` no editor, verá que o arquivo agora contém os elementos `<servlet>` e `<servlet-mapping>`.
-[start=4]
+
. Modifique o método `processRequest()` fazendo as seguintes alterações (em negrito):
[source,java]
@@ -444,7 +444,7 @@
Isso altera o cabeçalho `Content-Type` da Resposta HTTP para indicar que qualquer conteúdo retornado está em um formato JSON.
-[start=5]
+
. Substitua o código comentado no bloco `try` do método `processRequest()` pelo seguinte (alterações em *negrito*):
[source,java]
@@ -469,7 +469,7 @@
Para reformatar o código, clique com o botão direito do mouse no editor e selecione Formatar.
-[start=6]
+
. Utilize as dicas do IDE para adicionar as instruções de importação a seguir.
[source,java]
@@ -479,7 +479,7 @@
import dojo.org.json.JSONObject;
----
-[start=7]
+
. Para executar o projeto, selecione o nó do projeto `DojoTreeSample` na janela Projetos e, em seguida, clique no botão Executar Projeto (image:images/run-project-btn.png[]) na barra de ferramentas do IDE.
O browser será aberto e exibirá uma página de boas-vindas (`dojoDemo.html`), e você poderá ver que o widget Árvore do Dojo exibirá dados da ArrayList corretamente, como na <<final,captura de tela acima>>.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ru.asciidoc
index e54935a..2b38de9 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_ru.asciidoc
@@ -51,7 +51,7 @@
Контейнер сервлетов Tomcat |Open Source Edition 3.1.x или 4.x
_ _
-[start=7]
+
.x или 8.x
|link:http://www.dojotoolkit.org/download[+Набор средств Dojo+] |версия 1.8.x или более поздняя
@@ -87,7 +87,7 @@
*Примечание. *Окно 'Проекты' (Ctrl-1; ⌘-1 в Mac) обеспечивает _логическое представление_ содержимого важных проектов и является основной точкой ввода для исходного кода проекта. Окно "Файлы" (Ctrl-2; ⌘-2 в Mac) отображает _представление на основе каталогов_ проектов, включая файлы и папки, не выведенные в окне "Проекты".
-[start=4]
+
. Разверните узел `Веб-страницы` в окне "Проекты".
Вы увидите, что в списке под узлом `Веб-страницы` в окне "Проекты" появилась папка ``resources`` . Папка ``resources`` содержит ядро Dojo и библиотеки Dijit из link:http://www.dojotoolkit.org/download[+набора инструментов Dojo+]. В целях реализации виджета дерева Dojo требуется два существенных компонента: модуль `ItemFileReadStore` из базовой библиотеки и сам виджет`Tree`, содержащийся в библиотеке Dijit.
@@ -98,7 +98,7 @@
*Примечание.* Библиотека `DojoX` для данного проекта не требуется.
-[start=5]
+
. Разверните узел `Библиотеки` в окне "Проекты" и убедитесь, что все требуемые библиотеки находятся на пути класса.
*Примечание.* В зависимости от конфигурации может потребоваться устранить проблему, связанную с отсутствием сервера. Если в списке под узлом `Библиотеки` присутствует узел ``<Отсутствующий сервер Java EE>`` , щелкните правой кнопкой мыши узел проекта и выберите "Устранить проблему отсутствующего сервера".
@@ -138,7 +138,7 @@
* `link:http://dojotoolkit.org/reference-guide/1.6/djConfig.html[+djConfig+]` позволяет переопределять глобальные параметры, управляющие работой Dojo (например, использование свойства `parseOnLoad`).
* Установка `parseOnLoad` в `true` гарантирует, что элементы оформления и разметка страницы подвергаются синтаксическому анализу при загрузке страницы.
-[start=3]
+
. Добавьте ссылку на `nihilo` link:http://docs.dojocampus.org/dijit/themes[+образец темы+], который содержится в наборе инструментальных средств путем добавления следующей инструкции `@import` (выделена полужирным шрифтом) между тегами `<заголовков>` тегами и ниже добавленных вами тегов `<сценария>`.
[source,xml]
@@ -161,7 +161,7 @@
Тема `nihilo` включается по умолчанию в набор инструментальных средств. Вы можете развернуть папку `dijit/themes` в окне 'Проекты', чтобы увидеть другие образцы тем, которые предоставлены по умолчанию.
-[start=4]
+
. Добавьте следующее средство выбора класса к тегу `<body>` страницы, чтобы указать имя темы, которая теперь используется. Когда мы это делаем, любой элемент оформления Dojo, загруженный на страницу, будет визуализирован с использованием стилей, связанных с заданной темой.
[source,java]
@@ -193,7 +193,7 @@
* `link:http://docs.dojocampus.org/dojo/data/ItemFileReadStore[+dojo.data.ItemFileReadStore+]`: считывает содержимое, имеющее структуру JSON, с оконечной точки HTTP (в разделе <<prepareServlet,Подготовка сервлета для инициализации ответа JSON>> мы применим сервлет для этого) и сохраняет все элементы в памяти для простого и быстрого доступа.
* `link:http://docs.dojocampus.org/dijit/Tree[+dijit.Tree+]`: элемент оформления дерева, выводящий представление данных JSON, полученных от `ItemFileReadStore`.
-[start=2]
+
. Добавьте следующий код (выделен полужирным шрифтом), чтобы добавить `ItemFileReadStore` и виджет `Tree`.
[source,html]
@@ -232,13 +232,13 @@
На данный момент необходимо скомпилировать эти источники и создать архив Java (файл JAR), который следует добавить к проекту `DojoTreeSample`.
-[start=3]
+
. Нажмите кнопку 'Создать проект' ( image:images/new-project-btn.png[] ) на панели инструментов, чтобы открыть мастер создания проектов.
-[start=4]
+
. В мастере создания проектов выберите шаблон проекта библиотеки классов Java в категории Java. Нажмите кнопку 'Далее'.
-[start=5]
+
. На панели 'Имя и местоположение' мастера библиотек классов Java введите *`json`* в качестве имени проекта. Нажмите кнопку "Завершить".
После нажатия кнопки 'Готово' новый проект будет создан и открыт в окне 'Проекты'.
@@ -246,26 +246,26 @@
Теперь необходимо скопировать исходный код JSON, загруженный в проект ``json`` , аналогично копированию ресурсов набора инструментальных средств Dojo в проект ``DojoTreeSample`` .
-[start=6]
+
. Распакуйте архив `JSON-java-master.zip` и скопируйте (Ctrl-C; ⌘-C на Mac) исходные файлы Java, находящиеся в корневой папке.
*Примечание.* Папку `zip` и ее содержимое копировать не требуется, так как она уже находится в корневой папке распакованного архива.
-[start=7]
+
. В окне "Проекты" в IDE щелкните правой кнопкой мыши узел "Исходные пакеты" и выберите пункт меню "Создать > Пакет Java".
-[start=8]
+
. В качестве имени пакета укажите *json*. Нажмите кнопку "Завершить".
-[start=9]
+
. Щелкните правой кнопкой мыши исходный пакет `json` и выберите пункт меню "Вставить".
Если развернуть пакет, будут видны исходные файлы ``json`` .
image::images/proj-win-json-sources.png[title="Источники теперь хранятся в новом проекте 'json'"]
-[start=10]
+
. Щелкните правой кнопкой мыши узел проекта `json` в окне 'Проекты' и выберите 'Очистить' и 'Построить' для сборки проекта.
При построении проекта все классы Java компилируются в файлы `.class`. Среда IDE создает папку `build`, содержащую скомпилированные классы, а также папку `dist`, содержащую файл JAR для проекта. Эти папки можно просматривать в окне Files ("Файлы") среды IDE.
@@ -277,7 +277,7 @@
Теперь, когда у нас есть файл `json.jar`, можно разрешить проблему со ссылками, которая имелась у проекта `DojoTreeSample` с момента его открытия.
-[start=11]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел Libraries `DojoTreeSample` и выберите 'Добавить файл JAR/папку'. Затем в диалоговом окне перейдите к местоположению папки `dist` проекта `json` и выберите файл `json.jar`.
Также можно щелкнуть правой кнопкой мыши узел "Библиотеки", выбрать пункт меню "Добавить проект" и выбрать проект `json` в диалоговом окне "Добавить проект".
@@ -289,10 +289,10 @@
*Примечание. *Хотя файл `json.jar` указан в узле проекта `Библиотеки`, ссылка на него находится в исходном местоположении - она не скопирована и добавлена к проекту (например, она отсутствует в проекте `DojoTreeSample` в окне 'Файлы'). Поэтому в случае изменения местоположения файла JAR ссылка будет нарушена.
-[start=12]
+
. Разверните `Source Packages` ("Пакеты исходного кода") > пакет `dojo.indians` и дважды щелкните классы `Tribe` и `TribeDataManager`, чтобы открыть их в редакторе.
-[start=13]
+
. Добавьте к обоим классам необходимые операторы импорта. Во всех классах щелкните правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта'.
Классу `Tribe` требуются следующие операторы импорта:
@@ -316,7 +316,7 @@
Обратите внимание, что интерфейсы API для классов JSON также предоставлены на link:http://json.org/java[+http://json.org/java+] – эту страницу может быть желательно оставить открытой, так как ниже мы рассмотрим код в `Tribe` и `TribeDataManager`.
-[start=14]
+
. Рассмотрение ArrayList в `TribeDataManager`. ArrayList является коллекцией объектов `Tribe`. Взглянув на первый элемент ArrayList, можно увидеть, что новый объект `Tribe` создан и добавлен к списку:
[source,java]
@@ -326,7 +326,7 @@
----
Каждый объект `Tribe` записывает три точки данных: _tribe_ ("племя"), _category_ ("группа") и _region_ ("регион"). Данные для этого упражнения взяты из статьи Википедии по link:http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States#Ethno-linguistic_classification[+коренным народам США+]. Как можно увидеть, _племена_ разбиваются на _группы_, и несколько категорий могут быть охвачены более крупным _регионом_.
-[start=15]
+
. Откройте класс `Tribe` в редакторе и обратите внимание, что он, по сути, является компонентом link:http://java.sun.com/docs/books/tutorial/javabeans/index.html[+JavaBean+], за исключением метода `toJSONObject()`:
[source,java]
@@ -341,7 +341,7 @@
}
----
-[start=16]
+
. Переключитесь обратно на `TribeDataManager` (Ctrl-Tab) и изучите методы, входящие в класс. Откройте навигатор (Ctrl-7; ⌘-7 в Mac), чтобы просмотреть список полей и свойств, содержащихся в классе.
image::images/dojo-navigator.png[title=""Навигатор компонентов" обеспечивает просмотр полей и свойств классов."]
@@ -373,12 +373,12 @@
}
----
-[start=17]
+
. Откройте документацию Javadoc по методу `getIndiansAsJSONObject()`. Для этого вернитесь в навигатор (Ctrl-7; ⌘-7 в Mac) и подведите курсор к методу. В ином случае выберите Window ("Окно") > Other ("Прочие") > Javadoc ("Документация Java") из основного меню и щелкните сигнатуру метода в редакторе.
image::images/javadoc-window.png[title="Javadoc для TribeDataManager обеспечивает пример данных JSON"]
-[start=18]
+
. Изучите образец данных JSON, предоставленный документацией Javadoc. Обратите внимание, что формат данных соответствует примерам, предоставленным в link:http://o.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/available-stores/dojo-data-item[+документации Dojo+].
@@ -390,16 +390,16 @@
image::images/debugger-breakpoint.png[title="Используйте отладчик Java для перехода по коду"]
-[start=2]
+
. Выберите проект ``DojoTreeSample`` в окне 'Проекты'.
-[start=3]
+
. Запустите отладчик (нажмите кнопку 'Отладка проекта' ( image:images/debug-btn.png[] ) на панели инструментов).
-[start=4]
+
. Используйте кнопки 'С заходом' ( image:images/step-into-btn.png[] ) и 'Без захода' ( image:images/step-over-btn.png[] ) на панели инструментов.
-[start=5]
+
. Изучите значения переменных и выражений в окне 'Локальные переменные' ('Окно' > 'Отладка' > 'Переменные').
Дополнительные сведения об отладчике Java приведены в следующих экранных демонстрациях:
@@ -424,7 +424,7 @@
image::images/new-servlet-wizard.png[title="Используйте мастер создания сервлетов для создания сервлетов"]
-[start=3]
+
. Проверьте значения по умолчанию в полях "Имя сервлета" и "Шаблоны URL". Нажмите "Готово", чтобы создать класс skeleton для сервлета.
Функция сервлета состоит в вызове метода `getIndiansAsJSONObject()` и использовании данных из этого метода для ответа на запрос клиента. Чтобы подготовить ответ в формате JSON, нам сперва надо установить формат JSON как тип MIME ответа.
@@ -432,7 +432,7 @@
*Примечание.* Мастер автоматически добавит имя сервлета и шаблон URL в файл `web.xml`. Как следствие, все запросы к домену размещения (т. е., `http://localhost:8080/DojoTreeSample/`) для `TribeServlet` будут обрабатываться классом `dojo.indians.TribeServlet`. Если открыть файл `web.xml` в редакторе, можно увидеть, что в этом файле появились элементы `<servlet>` и `<servlet-mapping>`.
-[start=4]
+
. Измените метод `processRequest()`, внеся следующие изменения (выделены полужирным шрифтом).
[source,java]
@@ -444,7 +444,7 @@
Это изменение устанавливает заголовок `Content-Type` для отклика HTTP, чтобы указать, что все возвращаемое содержимое имеет формат JSON.
-[start=5]
+
. Замените закомментированный код внутри блока `try` метода `processRequest()` на следующий код (изменения выделены *жирным шрифтом*):
[source,java]
@@ -469,7 +469,7 @@
Чтобы изменить формат кода, щелкните правой кнопкой мыши в редакторе и выберите 'Формат'.
-[start=6]
+
. Используйте подсказки IDE, чтобы добавить следующие операторы импорта.
[source,java]
@@ -479,7 +479,7 @@
import dojo.org.json.JSONObject;
----
-[start=7]
+
. Для запуска проекта выберите узел проекта `DojoTreeSample` в окне 'Проекты', затем нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ) на панели инструментов IDE.
Браузер откроется на странице приветствия (`dojoDemo.html`), и можно будет увидеть, что элемент оформления Dojo Tree правильно отображает данные из ArrayList, как показано на <<final,снимке экрана>> выше.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_zh_CN.asciidoc
index 1155c9f..ed4e546 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-dojo_zh_CN.asciidoc
@@ -51,7 +51,7 @@
Tomcat Servlet 容器 |Open Source Edition 3.1.x 或 4.x
_ _
-[start=7]
+
.x 或 8.x
|link:http://www.dojotoolkit.org/download[+Dojo 工具包+] |版本 1.8.x 或更高版本
@@ -87,7 +87,7 @@
*注:*"Projects"(项目)窗口(Ctrl-1 组合键;在 Mac 上为 ⌘-1 组合键)提供了重要项目内容的_逻辑视图_,也是项目源的主入口点。"Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键)显示_基于目录的项目视图_,其中包括 "Projects"(项目)窗口中未显示的任何文件和文件夹。
-[start=4]
+
. 在 "Projects"(项目)窗口中展开 `Web Pages`(Web 页)节点。
您可以看到 ``resources`` 文件夹已在 "Projects"(项目)窗口中的 `Web Pages`(Web 页)节点下列出。 ``resources`` 文件夹包含 link:http://www.dojotoolkit.org/download[+Dojo 工具包+]中的 Dojo 核心和 Dijit 库。为了实现 Dojo 的树窗口部件,您需要两个组件:来自 Core 库的 `ItemFileReadStore` 模块以及 Dijit 库中包含的`树`窗口部件本身。
@@ -98,7 +98,7 @@
*注:*此项目不需要 `DojoX` 库。
-[start=5]
+
. 在 "Projects"(项目)窗口中展开 `Libraries`(库)节点,并确认所有必需库均在类路径上。
*注:*根据您的配置不同,您可能需要解决缺少服务器问题。如果您在 `Libraries`(库)节点下看到 ``<Missing Java EE Server>`` (<缺少 Java EE 服务器>)节点,请右键单击项目节点,然后在弹出菜单中选择 "Resolve Missing Server Problem"(解决缺少服务器问题)。
@@ -138,7 +138,7 @@
* `link:http://dojotoolkit.org/reference-guide/1.6/djConfig.html[+djConfig+]` 允许您覆盖用于控制 Dojo 运行方式的全局设置(例如,使用 `parseOnLoad` 属性)。
* `parseOnLoad` 设置为 `true` 可确保在加载页面时解析窗口部件和页面标记。
-[start=3]
+
. 通过在 `<head>` 标记之间和添加的 `<script>` 标记下方添加以下 `@import` 语句(以粗体显示),可以为工具包中包含的 `nihilo` link:http://docs.dojocampus.org/dijit/themes[+样例主题+]添加一个链接。
[source,xml]
@@ -161,7 +161,7 @@
默认情况下,`nihilo` 主题包含在工具包中。通过在“项目”窗口中展开 `dijit/themes` 文件夹可以查看默认提供的其他样例主题。
-[start=4]
+
. 在页 `<body>` 标记中添加以下类选择器可以指定使用的主题的名称。当您执行此操作时,加载到页面中的任何 Dojo 窗口部件都将使用与主题关联的样式来呈现。
[source,java]
@@ -193,7 +193,7 @@
* `link:http://docs.dojocampus.org/dojo/data/ItemFileReadStore[+dojo.data.ItemFileReadStore+]`:从 HTTP 端点读取 JSON 结构化内容(在<<prepareServlet,准备 Servlet 以启动 JSON 响应>>中,将为此用途实现 servlet。)并将所有项都存储在内存中,以便简单、快速地进行访问。
* `link:http://docs.dojocampus.org/dijit/Tree[+dijit.Tree+]`:树窗口部件,它提供了从 `ItemFileReadStore` 中检索的 JSON 数据的视图。
-[start=2]
+
. 添加以下代码(以粗体显示)以便添加 `ItemFileReadStore` 和 `Tree` 窗口部件。
[source,html]
@@ -232,13 +232,13 @@
现在,我们要编译这些源代码并创建将添加到 `DojoTreeSample` 项目中的 Java 档案(JAR 文件)。
-[start=3]
+
. 单击工具栏中的 "New Project"(新建项目)按钮 (image:images/new-project-btn.png[]) 以便打开 "New Project"(新建项目)向导。
-[start=4]
+
. 在 "New Project"(新建项目)向导中,选择 "Java" 类别的 "Java Class Library"(Java 类库)项目模板。单击 "Next"(下一步)。
-[start=5]
+
. 在 "Java Class Library"(Java 类库)向导的 "Name and Location"(名称和位置)面板中,键入 *`json`* 作为项目名称。单击 "Finish"(完成)。
单击 "Finish"(完成)后,将创建新项目并在 "Projects"(项目)窗口中将其打开。
@@ -246,26 +246,26 @@
现在,您需要按照将 Dojo 工具包资源复制到 ``DojoTreeSample`` 项目的相同方式,将下载的 JSON 资源复制到 ``json`` 项目。
-[start=6]
+
. 提取 `JSON-java-master.zip` 档案并复制(Ctrl-C 组合键;在 Mac 上为 ⌘-C 组合键)根文件夹中的 Java 源文件。
*注:*您无需复制同样也位于所提取档案的根文件夹中的 `zip` 文件夹及其内容。
-[start=7]
+
. 在 IDE 的 "Projects"(项目)窗口中,右键单击 "Source Packages"(源包)节点,然后在弹出菜单中选择 "New"(新建)> "Java Package"(Java 包)。
-[start=8]
+
. 键入 *json* 作为包名称。单击 "Finish"(完成)。
-[start=9]
+
. 右键单击 `json` 源包,然后在弹出菜单中选择 "Paste"(粘贴)。
展开此包时,您可以看到 ``json`` 源。
image::images/proj-win-json-sources.png[title="源文件现已包含在新的 "json" 项目中"]
-[start=10]
+
. 在 "Projects"(项目)窗口中右键单击 `json` 项目节点,然后选择 "Clean and Build"(清理并构建)构建项目。
在构建项目时,所有 Java 类都将编译到 `.class` 文件中。IDE 会创建一个 `build` 文件夹来包含编译的类,同时创建一个 `dist` 文件夹来包含项目的 JAR 文件。从 IDE 的 "Files"(文件)窗口中可以查看这些文件夹。
@@ -277,7 +277,7 @@
现在,您已具有 `json.jar` 文件,因此可以解决 `DojoTreeSample` 项目自打开以来显现的引用问题。
-[start=11]
+
. 在 "Projects"(项目)窗口中,右键单击 `DojoTreeSample` 的 "Libraries"(库)节点并选择 "Add JAR/Folder"(添加 JAR/文件夹)。然后,在对话框中,导航至 `json` 项目的 `dist` 文件夹的位置并选择 `json.jar` 文件。
或者,也可以右键单击 "Libraries"(库)节点,然后在弹出菜单中选择 "Add Project"(添加项目)并在 "Add Project"(添加项目)对话框中定位 `json` 项目。
@@ -289,10 +289,10 @@
*注:*尽管 `json.jar` 文件列在项目的 `Libraries` 节点下,但该文件却是从原始位置引用的,而不是复制并添加到项目中的(例如,您将无法在 "Files"(文件)窗口中的 `DojoTreeSample` 项目下找到它)。因此,如果更改 JAR 文件的位置,引用将中断。
-[start=12]
+
. 展开 `Source Packages`(源包)> `dojo.indians` 包并双击 `Tribe` 和 `TribeDataManager` 类,以便在编辑器中将其打开。
-[start=13]
+
. 向两个类中添加必要的 import 语句。在每个类中,右键单击编辑器并选择 "Fix Imports"(修复导入)。
`Tribe` 类需要以下导入:
@@ -316,7 +316,7 @@
请注意,link:http://json.org/java[+http://json.org/java+] 中还提供用于 JSON 的 API - 以后检查 `Tribe` 和 `TribeDataManager` 中的代码时,可能要使此页保持打开状态。
-[start=14]
+
. 检查 `TribeDataManager` 中的 ArrayList。ArrayList 是 `Tribe` 对象的集合。查看 ArrayList 的第一个元素,您可以看到创建了一个新 `Tribe` 对象并将其添加到了列表中:
[source,java]
@@ -326,7 +326,7 @@
----
每个 `Tribe` 对象捕获三个信息点:_tribe_、_category_ 和 _region_。此练习中的数据摘自维基百科中有关 link:http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States#Ethno-linguistic_classification[+Native Americans in the United States+] 的条目。您可以确定,在一个 category 中可以对多个 _tribe __分类_,一个大的 _region_ 中可以包含许多 category。
-[start=15]
+
. 在编辑器中打开 `Tribe` 类,并请注意,它基本上是 link:http://java.sun.com/docs/books/tutorial/javabeans/index.html[+JavaBean+],`toJSONObject()` 方法除外:
[source,java]
@@ -341,7 +341,7 @@
}
----
-[start=16]
+
. 切换回 `TribeDataManager`(Ctrl-Tab 组合键)并检查该类中包括的方法。打开导航器(Ctrl-7 组合键;在 Mac 上为 ⌘-7 组合键),以查看该类中包含的字段和属性的列表。
image::images/dojo-navigator.png[title="使用导航器查看类字段和属性"]
@@ -373,12 +373,12 @@
}
----
-[start=17]
+
. 在 `getIndiansAsJSONObject()` 方法中打开 Javadoc。通过返回到导航器(Ctrl-7 组合键;在 Mac 上为 ⌘-7 组合键)并将光标悬停于方法上方可以执行此操作。否则,请从主菜单中选择 "Window"(窗口)> "Other"(其他)> "Javadoc",然后在编辑器中单击方法签名。
image::images/javadoc-window.png[title="TribeDataManager 的 Javadoc 提供 JSON 数据的示例"]
-[start=18]
+
. 检查在 Javadoc 中提供的 JSON 数据的示例。请注意,数据格式符合 link:http://o.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/available-stores/dojo-data-item[+Dojo 文档+]中提供的示例。
@@ -390,16 +390,16 @@
image::images/debugger-breakpoint.png[title="使用 Java 调试器逐步执行代码"]
-[start=2]
+
. 在 "Projects"(项目)窗口中选择 ``DojoTreeSample`` 项目。
-[start=3]
+
. 运行调试器(在工具栏中单击 "Debug Project"(调试项目)按钮 (image:images/debug-btn.png[]))。
-[start=4]
+
. 使用工具栏中的 "Step Into"(步入)(image:images/step-into-btn.png[]) 和 "Step Over"(步过)(image:images/step-over-btn.png[]) 按钮。
-[start=5]
+
. 在 "Local Variables"(局部变量)窗口中检查变量和表达式值("Window"(窗口)> "Debugging"(调试)> "Variables"(变量))。
有关 Java 调试器的详细信息,请参见以下屏幕快照:
@@ -424,7 +424,7 @@
image::images/new-servlet-wizard.png[title="使用新建 Servlet 向导创建 Servlet"]
-[start=3]
+
. 确认默认的 "Servlet Name"(Servlet 名称)和 "URL Patterns"(URL 模式)值正确。单击 "Finish"(完成)将为 Servlet 生成框架类。
Servlet 的功能是调用 `getIndiansAsJSONObject()` 方法,并使用来自此方法的数据响应客户端请求。为了准备 JSON 格式的响应,必须首先将响应的 MIME 类型设置为 JSON 格式。
@@ -432,7 +432,7 @@
*注:*此向导会自动将 Servlet 名称和 URL 模式添加到 `web.xml` 中。因此,对用于 `TribeServlet` 的主机域的任何请求(即 `http://localhost:8080/DojoTreeSample/`)都将由 `dojo.indians.TribeServlet` 类来处理。如果在编辑器中打开 `web.xml`,您可以看到此文件现在包含 `<servlet>` 和 `<servlet-mapping>` 元素。
-[start=4]
+
. 通过执行以下更改(以粗体显示)来修改 `processRequest()` 方法。
[source,java]
@@ -444,7 +444,7 @@
此更改将设置 HTTP 响应的 `Content-Type` 头,以指示任何返回的内容均为 JSON 格式。
-[start=5]
+
. 将 `processRequest()` 方法的 `try` 块内的注释代码替换为以下代码(更改以*粗体*显示):
[source,java]
@@ -469,7 +469,7 @@
要重新格式化代码,请在编辑器中单击右键并选择 "Format"(格式化代码)。
-[start=6]
+
. 使用 IDE 的提示添加以下 import 语句。
[source,java]
@@ -479,7 +479,7 @@
import dojo.org.json.JSONObject;
----
-[start=7]
+
. 要运行项目,请在 "Projects"(项目)窗口中选择 `DojoTreeSample` 项目节点,然后单击 IDE 工具栏中的 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮。
浏览器将打开以显示欢迎页 (`dojoDemo.html`),您可以看到 Dojo 数窗口部件正在正确显示 ArrayList 中的数据,如<<final,上面的屏幕快照>>所示。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery.asciidoc
index 20abe71..21144cc 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery.asciidoc
@@ -63,33 +63,33 @@
If you want to work in a Java Web project, select the *Java Web* category, then select *Web Application*.
-[start=3]
+
. Click Next and name the project `jqproject`. Also, specify the directory on your computer where you want save the project. Click Next.
-[start=4]
+
. In Step 3, for purposes of this tutorial, accept default settings provided in the wizard.
*Note:* If you are creating a PHP project for the first time and need help, see Configuring Your Environment for PHP Development in the link:../../trails/php.html[+PHP Learning Trail+].
-[start=5]
+
. Click *Finish* to complete the wizard and create a new project. The `jqproject` opens in the Projects window, and the project welcome file opens in the editor.
-[start=6]
+
. Create a plain HTML file, which you can work in for the remainder of this tutorial. Because the jQuery code that we'll be adding does not require any communication with a back-end server, we'll just run the HTML file in a browser to view results.
Right-click the project node and choose New > HTML file (Ctrl-N).
-[start=7]
+
. Name the file `index`, then click *Finish*. In the Projects window, note that the new `index.html` file is listed within the project, and that the file opens in the editor.
-[start=8]
+
. Take a look at what the welcome page looks like in a browser. To do so, right-click the `index.html` node in the Projects window and choose View. (You can also choose View from the file's right-click menu in the editor.) The page displays in a browser window.
image::images/browser-test.png[title="View the empty HTML template in a browser window"]
-[start=9]
+
. In the `index.html` file in the NetBeans editor, type in `jQuery Test Project` between the `<title>` tags, and create a pair of `<style>` tags within the page's `<head>` tags. (Changes in *bold*.)
[source,xml]
@@ -109,15 +109,15 @@
</html>
----
-[start=10]
+
. Configure your project so that the `index.html` file displays as the welcome file when the application is deployed and run. To do so, right-click the `jqproject` node in the Projects window and choose Properties.
* *PHP projects:* Select the *Run Configuration* category, then type in `index.html` in the *Index File* field.
* *Java Web projects:* Select the *Run* category, then type in `index.html` in the *Relative URL* field.
-[start=11]
+
. Click OK to close the Project Properties window and save changes.
-[start=12]
+
. At this stage, you can delete the original index file that was created with your project. In PHP projects, this is the `index.php` file; in Java Web projects, this is the `index.jsp` file.
To delete the file, right-click the file in the Projects window and choose Delete. In the confirmation dialog that displays, click *Yes*.
@@ -139,13 +139,13 @@
[alert]#For Java Web projects, ensure that you place the `js` folder in the project's web root. To do so, enter `web` in the *Parent Folder* field.#
-[start=4]
+
. Click *Finish* to exit the wizard.
-[start=5]
+
. Locate the jQuery library that you downloaded onto your computer. To date, the current library version is 1.4.2, so the file is typically named `jquery-1.4.2.js`. Copy the file to your clipboard (Ctrl-C; ⌘-C on Mac).
-[start=6]
+
. Paste the library file into the new `js` folder. To do so, right-click the `js` and choose Paste (Ctrl-V; ⌘-V on Mac). The `jquery-1.4.2.js` file node appears within the folder.
|===
@@ -162,7 +162,7 @@
|image:images/jquery-lib-php.png[title="Paste the jQuery library directly into your project"] |image:images/jquery-lib-java.png[title="Paste the jQuery library directly into your project"]
|===
-[start=7]
+
. In the editor, reference the jQuery library from the `index.html` file. To do so, add a pair of `<script>` tags and use the `src` attribute to point to the library location. (Changes in *bold*.)
[source,xml]
@@ -181,7 +181,7 @@
...
----
-[start=8]
+
. Save the file (Ctrl-S; ⌘-S on Mac).
The jQuery library is now included in the `jqproject` project, and referenced from our `index.html` file. We can begin adding jQuery functionality to the page.
@@ -201,7 +201,7 @@
<h1>Test.</h1>
----
-[start=2]
+
. Now we'll create a CSS class that makes an element appear blue when it is applied. Enter the following between the `<style>` tags in the `<head>` of the document:
[source,java]
@@ -210,7 +210,7 @@
.blue { color: blue; }
----
-[start=3]
+
. Next we'll set up a place to put our jQuery commands. Add a new set of `<script>` tags to the `<head>` of the document, e.g., after the `<script>` tags linking to the jQuery library. (Changes in *bold*.)
[source,xml]
@@ -237,7 +237,7 @@
The jQuery instructions that we will add must be executed only after all of the elements of the DOM have been loaded by the browser. This is important because jQuery behaviors connect to elements of the DOM, and these elements must be available to jQuery in order to get the results we expect. jQuery takes care of this for us through its built-in `(document).ready` function, which follows the jQuery object, represented by `$`.
-[start=4]
+
. Enter this construction between the script tags you just created:
[source,java]
@@ -288,7 +288,7 @@
</html>
----
-[start=5]
+
. To demonstrate how jQuery syntax works, let's try something simple. We'll add jQuery instructions to our page that will make the word 'Test' turn blue when we click on it. To accomplish this, we want jQuery to add the CSS class `.blue` to the `<h1>` element of the DOM when it receives a mouse click.
Enter the following code inside the `(document).ready` function, between the braces `{}`:
@@ -301,14 +301,14 @@
});
----
-[start=6]
+
. Save the document (Ctrl-S; ⌘-S on Mac), then right-click in the editor and choose View to load it in your web browser. Test it to see if it works. When you click on the word 'Test', it should turn blue.
image::images/blue-test.png[title="Text turns blue when clicked upon"]
This example uses the jQuery `click()` function to invoke the jQuery `addClass()` function when an element matching the CSS selector "`h1`" is encountered. The `$(this)` refers back to the calling element. If we were to add more `<h1>`s to our page, the same behavior will be applied to all of them with this single set of rules, and each will interact with jQuery independently. (You can try this yourself as a quick exercise.)
-[start=7]
+
. Another important quality of jQuery is that functions can be simply chained together to create more complicated or even sequenced behaviors. To demonstrate this let's add a jQuery instruction for a slow fadeOut to our `click()` function. Place a `fadeOut("slow")` jQuery function after the `addClass` function so that the line of code looks like this:
[source,java]
@@ -328,7 +328,7 @@
});
----
-[start=8]
+
. In the browser, refresh the page and then click 'Test.' You will see that it turns blue, and then fades out, disappearing from the page. (To try it again, you must refresh the page.)
@@ -410,7 +410,7 @@
----
Observe that the overall enclosing `<div>` element is given an `id` attribute with a value of `infolist`. Within this `<div>` element, there are four sets of `<h3>` tags and `<div>` tags that contain an image and unordered list.
-[start=2]
+
. Add a few inline CSS rules to the above markup. Delete the `.blue` style rule you created for testing purposes above. In its place, add the following rules. (Changes in *bold*.)
[source,xml]
@@ -427,20 +427,20 @@
When you type within `<style>` tags, take advantage of the IDE's built-in CSS code-completion by pressing Ctrl-Space.
-[start=3]
+
. Save the file (Ctrl-S; ⌘-S on Mac).
-[start=4]
+
. Now we'll add the the JPG portraits that are referenced in the above code fragment to our project. Retrieve the `pix` directory from the <<requiredSoftware,project resources you downloaded earlier>> and copy the entire directory to your project folder, placing it at the same level as `index.html`. After a brief moment, NetBeans automatically updates the Projects window to reflect that a new directory has been manually added to the project.
-[start=5]
+
. Switch to your browser and refresh the page.
image::images/structured-list.png[title="Structured list displays in a browser"]
There are a number of problems with this document that we will address. Firstly, it is more difficult than it needs to be to scan the list quickly to find the person you're looking for: one must scroll the page and visually inspect a lot of information that may not be of immediate interest. Four contacts in a list might be manageable, but if the number grew to say, 50, then the list would become much more difficult to use. Secondly, the document is visually plain, and is unlikely to blend in esthetically with most web site designs, particularly designs that have a strong graphic identity. We will address these issues by using the jQuery accordion widget, in combination with jQuery UI's default theme.
-[start=6]
+
. To produce the accordion effect, navigate to the location on your computer where you downloaded the accordion widget. Within the downloaded folder, you'll find a folder named '`development-bundle`'. Within the `development-bundle` folder, expand the `ui` folder and locate the following three scripts:
* `jquery.ui.core.js`
* `jquery.ui.widget.js`
@@ -449,7 +449,7 @@
Development versions of toolkit scripts are _unminimized_, meaning that their code is human-readable when viewed in an editor. Normally, you would want to switch to the compressed, minimized versions for a production-ready application in order to conserve download times.
-[start=7]
+
. Copy (Ctrl-C; ⌘-C on Mac) the three scripts and, back in the IDE, paste them in the `js` folder you <<js,created earlier>> in your `jqproject` folder.
You can paste by either pressing Ctrl-V (⌘-V on Mac), or right-clicking the `js` folder and choosing Paste.
@@ -457,10 +457,10 @@
The `development-bundle` > `ui` folder also contains a file named `jquery-ui-1.8.1.custom.js`. This file combines the three scripts listed above into a single script. You could equally paste this file into your project in place of the three individual scripts.
-[start=8]
+
. Reference the scripts in your `index.html` page by entering three `<script>` tags linking to these new JavaScript files. You can add the `<script>` tags immediately after the `<script>` tags that refers to the core jQuery library `jquery-1.4.2.js`. Use the existing `<script>` tags as a model.
-[start=9]
+
. Delete the test code we created inside the `(document).ready` function. You no longer need it.
The `<head>` tags of your file should now look as follows.
@@ -485,7 +485,7 @@
</head>
----
-[start=10]
+
. To make our static, unstyled list take on the accordion behavior is as simple as adding a single line of jQuery code. Enter this line into the `(document).ready` function. (Changes in *bold*.)
[source,java]
@@ -502,10 +502,10 @@
You've also specified '`autoHeight: false`' in the above snippet. This prevents the accordion widget from setting the height of each panel based on the highest content part contained within the markup. For more information, consult the link:http://docs.jquery.com/UI/Accordion[+accordion API documentation+].
-[start=11]
+
. Save the file (Ctrl-S; ⌘-S on Mac).
-[start=12]
+
. Go back to the web browser and refresh. Click on one of the names (other than the top one) to see the accordion effect in action. The jQuery accordion widget handles all the details of handling the DOM and responding to user mouse clicks.
image::images/accordion-list.png[title="Accordion widget handles user clicks and produces the accordion effect"]
@@ -525,7 +525,7 @@
[alert]#For Java Web projects, ensure that you place the `css` folder in the project's web root. To do so, enter `web` in the *Parent Folder* field.#
-[start=4]
+
. Paste the two items directly into the new `css` folder. To do so, right-click the `css` folder node and choose Paste. Your project folder should look as follows.
|===
@@ -542,7 +542,7 @@
|image:images/proj-win-php.png[title="Project contains the jQuery default theme"] |image:images/proj-win-java.png[title="Project contains the jQuery default theme"]
|===
-[start=5]
+
. Reference the `jquery-ui-1.8.1.custom.css` file from within your `index.html` web page. Add the following `<link>` tag within the page's head.
[source,java]
@@ -551,10 +551,10 @@
<link rel="stylesheet" href="css/jquery-ui-1.8.1.custom.css" type="text/css">
----
-[start=6]
+
. Save the file (Ctrl-S; ⌘-S on Mac).
-[start=7]
+
. Return to the web browser and refresh the page. Notice that the list now displays using jQuery's default theme, which is an esthetic improvement over the plain, unstylized version.
image::images/ui-lightness-theme.png[title="jQuery default theme enhances the appearance of the accordion widget"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ja.asciidoc
index 8a78f13..c191d82 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ja.asciidoc
@@ -70,33 +70,33 @@
Java Webプロジェクトで作業する場合は、「*Java Web*」カテゴリを選択し、「*Webアプリケーション*」を選択します。
-[start=3]
+
. 「次」をクリックし、プロジェクトに`jqproject`という名前を付けます。プロジェクトを保存するコンピュータ上のディレクトリも指定します。「次」をクリックします。
-[start=4]
+
. ステップ3で、このチュートリアルでは、ウィザードに示されるデフォルトの設定を受け入れます。
*注意:* PHPプロジェクトを初めて作成する場合で、ヘルプが必要なときは、link:../../trails/php.html[+PHPの学習+]のPHP開発のための環境の構成を参照してください。
-[start=5]
+
. 「*終了*」をクリックしてウィザードを完了し、新しいプロジェクトを作成します。「プロジェクト」ウィンドウに`jqproject`が開き、プロジェクトの開始ファイルがエディタで開かれます。
-[start=6]
+
. このチュートリアルの残り部分の作業に使用できるプレーンHTMLファイルを作成します。追加しようとしているjQueryコードは、バックエンド・サーバーとの通信を必要としないため、単純にHTMLファイルをブラウザで実行して結果を表示します。
プロジェクト・ノードを右クリックし、「新規」>「HTMLファイル」を選択します([Ctrl]-[N])。
-[start=7]
+
. ファイルに`index`という名前を付け、「*終了*」をクリックします。「プロジェクト」ウィンドウで、新しい`index.html`ファイルがプロジェクト内に表示され、ファイルがエディタで開かれます。
-[start=8]
+
. 開始ページがブラウザでどのように表示されるか見てみましょう。これを行うには、「プロジェクト」ウィンドウで`index.html`ノードを右クリックし、「表示」を選択します。(エディタでファイルの右クリック・メニューから「表示」を選択することもできます。)ページがブラウザ・ウィンドウに表示されます。
image::images/browser-test.png[title="ブラウザ・ウィンドウでの空のHTMLテンプレートの表示"]
-[start=9]
+
. NetBeansエディタで、`index.html`ファイルの`<title>`タグの間に「`jQuery Test Project`」と入力し、ページの`<head>`タグの間に1組の`<style>`タグを作成します。変更場所は*太字*で示されています。
[source,xml]
@@ -116,15 +116,15 @@
</html>
----
-[start=10]
+
. アプリケーションがデプロイされ実行されるときに`index.html`ファイルが開始ファイルとして表示されるように、プロジェクトを構成します。これを行うには、「プロジェクト」ウィンドウで`jqproject`ノードを右クリックし、「プロパティ」を選択します。
* *PHPプロジェクト:* 「*実行構成*」カテゴリを選択し、「*開始ファイル*」フィールドに「`index.html`」と入力します。
* *Java Webプロジェクト:* 「*実行*」カテゴリを選択し、「*相対URL*」フィールドに「`index.html`」と入力します。
-[start=11]
+
. 「OK」をクリックして「プロジェクト・プロパティ」ウィンドウを閉じ、変更を保存します。
-[start=12]
+
. この段階で、プロジェクトとともに作成されていた元のインデックス・ファイルを削除できます。PHPプロジェクトの場合これは`index.php`ファイル、Java Webプロジェクトの場合これは`index.jsp`ファイルです。
ファイルを削除するには、「プロジェクト」ウィンドウでファイルを右クリックし、「削除」を選択します。表示される確認ダイアログで、「*はい*」をクリックします。
@@ -146,13 +146,13 @@
[alert]#Java Webプロジェクトの場合は、必ずプロジェクトのWebルートに`js`フォルダを置いてください。これを行うには、「*親フォルダ*」フィールドに「`web`」と入力します。#
-[start=4]
+
. 「*終了*」をクリックしてウィザードを終了します。
-[start=5]
+
. コンピュータにダウンロードしたjQueryライブラリを見つけます。現在、ライブラリの最新バージョンは1.4.2なので、ファイルの名前は通常`jquery-1.4.2.js`です。ファイルをクリップボードにコピーします([Ctrl]-[C]、Macの場合は[⌘]-[C])。
-[start=6]
+
. ライブラリ・ファイルを新しい`js`フォルダに貼り付けます。これを行うには、`js`を右クリックし、「貼付け」を選択します([Ctrl]-[V]、Macの場合は[⌘]-[V])。フォルダ内に`jquery-1.4.2.js`ファイル・ノードが表示されます。
|===
@@ -169,7 +169,7 @@
|image:images/jquery-lib-php.png[title="プロジェクトへのjQueryライブラリの直接貼付け"] |image:images/jquery-lib-java.png[title="プロジェクトへのjQueryライブラリの直接貼付け"]
|===
-[start=7]
+
. エディタで、`index.html`ファイルからjQueryライブラリを参照します。これを行うには、1組の`<script>`タグを追加し、`src`属性を使用してライブラリの場所を指します。変更場所は*太字*で示されています。
[source,xml]
@@ -188,7 +188,7 @@
...
----
-[start=8]
+
. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
これで、jQueryライブラリが`jqproject`プロジェクトに追加され、`index.html`ファイルから参照されるようになりました。jQueryの機能をページに追加し始めることができます。
@@ -208,7 +208,7 @@
<h1>Test.</h1>
----
-[start=2]
+
. 次に、適用される要素を青で表示するCSSクラスを作成します。ドキュメントの`<head>`の`<style>`タグの間に次のように入力します。
[source,java]
@@ -217,7 +217,7 @@
.blue { color: blue; }
----
-[start=3]
+
. 次に、jQueryコマンドを置く場所を設定します。ドキュメントの`<head>`に、たとえばjQueryライブラリにリンクしている`<script>`タグの後に、新しい`<script>`タグのセットを追加します。変更場所は*太字*で示されています。
[source,xml]
@@ -244,7 +244,7 @@
追加するjQuery命令は、DOMのすべての要素がブラウザにロードされた後にのみ実行される必要があります。jQuery動作はDOMの要素に接続されるので、期待する結果を得るにはこれらの要素がjQueryで使用できる必要があるため、これは重要です。jQueryは、`$`で表される、jQueryオブジェクトの後に続く組込みの`(document).ready`関数を使用して、これを処理してくれます。
-[start=4]
+
. 先ほど作成したscriptタグの間に次の構文を追加します。
[source,java]
@@ -295,7 +295,7 @@
</html>
----
-[start=5]
+
. jQueryの構文がどのように機能するかを示すために、基本的なものを試してみましょう。「Test」という語をクリックしたときにそれを青に変化させるjQuery命令をページに追加します。これを行うには、jQueryがマウス・クリックを受け取ったときに、CSSクラス`.blue`をDOMの`<h1>`要素に追加するようにします。
`(document).ready`関数内の中括弧`{}`の間に、次のコードを入力します。
@@ -308,14 +308,14 @@
});
----
-[start=6]
+
. ドキュメントを保存し([Ctrl]-[S]、Macの場合は[⌘]-[S])、エディタ内で右クリックし、「表示」を選択してWebブラウザにロードします。機能するかどうかテストします。「Test」という語をクリックすると、青に変化するはずです。
image::images/blue-test.png[title="テキストをクリックしたときの青への変化"]
この例では、CSSセレクタ"`h1`" に一致する要素が見つかったときに、jQueryの`click()`関数を使用してjQueryの`addClass()`関数を呼び出しています。`$(this)`はコール元の要素を参照します。複数の`<h1>`をページに追加した場合、この1セットのルールによりそれらのすべてに同じ動作が適用され、それぞれが独立してjQueryと対話します。(簡単な課題として自分で試すことができます。)
-[start=7]
+
. 関数を単純に連結して、より複雑な動作や、さらには順序付けられた動作を作成できることも、jQueryの重要な特質です。これを示すために、ゆっくりフェード・アウトするjQuery命令を`click()`関数に追加しましょう。`fadeOut("slow")` jQuery関数を`addClass`関数の後に置いて、次のようなコード行にします。
[source,java]
@@ -335,7 +335,7 @@
});
----
-[start=8]
+
. ブラウザで、ページをリフレッシュし、「Test」をクリックします。青に変化した後、フェード・アウトしてページから消えます。(再度試すには、ページをリフレッシュする必要があります。)
@@ -417,7 +417,7 @@
----
全体を囲んでいる`<div>`要素には、`id`属性と値`infolist`が指定されています。この`<div>`要素内に、`<h3>`タグと`<div>`タグが4セットあり、イメージと順序なしリストが含まれています。
-[start=2]
+
. 前述のマークアップにいくつかのインラインCSSルールを追加します。テストの目的で作成した`.blue`スタイル・ルールを削除します。その場所に、次のルールを追加します。変更場所は*太字*で示されています。
[source,xml]
@@ -434,20 +434,20 @@
`<style>`タグ内に入力するときは、[Ctrl]-[Space]を押して、IDEに組み込まれているCSSコード補完を利用します。
-[start=3]
+
. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
-[start=4]
+
. 次に、上記のコード・フラグメントで参照されているJPG人物写真を追加します。<<requiredSoftware,先にダウンロードしたプロジェクト・リソース>>から`pix`ディレクトリを取出し、ディレクトリ全体をプロジェクト・フォルダにコピーして`index.html`と同じレベルに置きます。まもなく、NetBeansで「プロジェクト」ウィンドウが自動的に更新され、新しいディレクトリがプロジェクトに手動で追加されたことが反映されます。
-[start=5]
+
. ブラウザに切り替え、ページをリフレッシュします。
image::images/structured-list.png[title="ブラウザに表示された構造化リスト"]
このドキュメントにはいくつか問題があり、対処していきます。まず、探している人物をすばやく見つけるためにリストに目を通すことが、必要以上に困難になっています。ページをスクロールし、直接には関心のない多量の情報を目で調べる必要があります。リスト内の連絡先が4件なら扱えるかもしれませんが、たとえば50件に増えると、リストははるかに使用しづらくなるでしょう。次に、ドキュメントは視覚的に単純で、ほとんどのWebサイト・デザイン、特に、グラフィックの個性の強いデザインとは外観的に調和しないでしょう。jQueryアコーディオン・ウィジェットをjQuery UIのデフォルト・テーマと組み合せて使用することで、これらの問題に対処します。
-[start=6]
+
. アコーディオン効果を生成するには、アコーディオン・ウィジェットをダウンロードしたコンピュータ上の場所に移動します。ダウンロードしたフォルダの中に、「`development-bundle`」という名前のフォルダがあります。`development-bundle`フォルダ内の`ui`フォルダを展開し、次の3つのスクリプトを見つけます。
* `jquery.ui.core.js`
* `jquery.ui.widget.js`
@@ -456,7 +456,7 @@
Developmentバージョンのツールキットのスクリプトは_最小化されていない_ため、コードをエディタで表示して人間が読むことができます。通常、本番の準備ができたアプリケーションに使用する場合は、ダウンロード時間の節約のために、圧縮され最小化されたバージョンに切り替えることをお薦めします。
-[start=7]
+
. 3つのスクリプトをコピーし([Ctrl]-[C]、Macの場合は[⌘]-[C])、IDEに戻り、`jqproject`フォルダ内に<<js,先に作成した>>`js`フォルダに貼り付けます。
[Ctrl]-[V] (Macの場合は[⌘]-[V])を押すか、`js`フォルダを右クリックして「貼付け」を選択することで、貼付けできます。
@@ -464,10 +464,10 @@
`development-bundle`フォルダ内の`ui`フォルダには、`jquery-ui-1.8.1.custom.js`という名前のファイルもあります。このファイルは、前述の3つのスクリプトを1つのスクリプトにまとめたものです。3つの個別のスクリプトのかわりに、このファイルをプロジェクトに貼り付けることもできます。
-[start=8]
+
. `index.html`ページでスクリプトを参照するために、これらの新しいJavaScriptファイルにリンクする3つの`<script>`タグを入力します。`<script>`タグは、コアjQueryライブラリ`jquery-1.4.2.js`を参照する`<script>`タグの直後に追加できます。既存の`<script>`タグをモデルとして使用します。
-[start=9]
+
. `(document).ready`関数内に作成したテスト・コードを削除します。これはもう必要ありません。
これで、ファイルの`<head>`タグは次のようになるはずです。
@@ -492,7 +492,7 @@
</head>
----
-[start=10]
+
. 静的なスタイルなしリストにアコーディオン動作を与えるには、1行のjQueryコードを追加するのみで済みます。次の行を`(document).ready`関数に追加します。変更場所は*太字*で示されています。
[source,java]
@@ -509,10 +509,10 @@
上記のスニペットでは、「`autoHeight: false`」も指定しています。これは、アコーディオン・ウィジェットが各パネルの高さをマークアップ内で最も高いコンテンツ部分に基づいて設定することを防止します。詳細は、link:http://docs.jquery.com/UI/Accordion[+アコーディオンのAPIドキュメント+]を参照してください。
-[start=11]
+
. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
-[start=12]
+
. Webブラウザに戻り、リフレッシュします。いずれかの名前(最上部のもの以外)をクリックし、アコーディオン効果のアクションを確認します。jQueryアコーディオン・ウィジェットは、DOMの処理およびユーザーのマウス・クリックに対する応答の詳細をすべて処理します。
image::images/accordion-list.png[title="ユーザーのクリックを処理し、アコーディオン効果を生成するアコーディオン・ウィジェット"]
@@ -532,7 +532,7 @@
[alert]#Java Webプロジェクトの場合は、必ずプロジェクトのWebルートに`css`フォルダを置いてください。これを行うには、「*親フォルダ*」フィールドに「`web`」と入力します。#
-[start=4]
+
. 2つの項目をこの新しい`css`フォルダに直接貼り付けます。これを行うには、`css`フォルダ・ノードを右クリックし、「貼付け」を選択します。プロジェクト・フォルダは次のようになるはずです。
|===
@@ -549,7 +549,7 @@
|image:images/proj-win-php.png[title="プロジェクトに挿入されたjQueryデフォルト・テーマ"] |image:images/proj-win-java.png[title="プロジェクトに挿入されたjQueryデフォルト・テーマ"]
|===
-[start=5]
+
. `index.html` Webページ内から`jquery-ui-1.8.1.custom.css`ファイルを参照します。ページのhead内に次の`<link>`タグを追加します。
[source,java]
@@ -558,10 +558,10 @@
<link rel="stylesheet" href="css/jquery-ui-1.8.1.custom.css" type="text/css">
----
-[start=6]
+
. ファイルを保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
-[start=7]
+
. Webブラウザに戻り、ページをリフレッシュします。これで、jQueryのデフォルト・テーマを使用してリストが表示されるようになり、スタイル指定のない単純なリストに比べて外観が改善されました。
image::images/ui-lightness-theme.png[title="jQueryデフォルト・テーマで拡張されたアコーディオン・ウィジェットの外観"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_pt_BR.asciidoc
index 1ae02ee..54620d8 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_pt_BR.asciidoc
@@ -70,33 +70,33 @@
Se você deseja trabalhar em um projeto Java Web, selecione a categoria *Java Web* e depois selecione *aplicação Web*.
-[start=3]
+
. Clique em Próximo e nomeie o projeto como `jqproject`. Além disso, especifique o diretório no computador onde deseja salvar o projeto. Clique em Próximo.
-[start=4]
+
. Na Etapa 3, para os propósitos deste tutorial, aceite as definições default fornecidas no assistente.
*Observação:* Se estiver criando um projeto PHP pela primeira vez e precisar de ajuda, consulte Configurando seu Ambiente para Desenvolvimento PHP na link:../../trails/php.html[+Trilha de Aprendizado do PHP+].
-[start=5]
+
. Clique em *Finalizar* para concluir o assistente e criar um novo projeto. O `jqproject` será aberto na janela Projetos e o arquivo de boas-vindas do projeto, aberto no editor.
-[start=6]
+
. Crie um arquivo HTML simples, no qual você poderá trabalhar para o restante deste tutorial. Devido ao código jQuery que será adicionado não exigir qualquer comunicação com um servidor de backend, o arquivo HTML será executado em um browser para exibir os resultados.
Clique com o botão direito do mouse no nó do projeto e selecione Novo > Arquivo HTML (Ctrl-N).
-[start=7]
+
. Nomeie o arquivo como `index` e clique em *Finalizar*. Na janela Projetos, observe que o novo arquivo `index.html` está listado no projeto, e que o arquivo abre no editor.
-[start=8]
+
. Veja como é a aparência da página de boas-vindas no browser. Para isso, clique com o botão direito do mouse no nó do `index.html` na janela Projetos e selecione Exibir. (Também é possível selecionar Exibir no menu de contexto do arquivo do editor.) A página será exibida em uma janela do browser.
image::images/browser-test.png[title="Exibir o modelo HTML vazio em uma janela do browser"]
-[start=9]
+
. No arquivo `index.html` do editor do NetBeans, digite `jQuery Test Project` entre as tags `<title>` e crie um par de tags `<style>` dentro das tags `<head>` da página. (Alterações em *negrito*.)
[source,xml]
@@ -116,15 +116,15 @@
</html>
----
-[start=10]
+
. Configure seu projeto para que o `index.html` seja exibido como o arquivo de boas-vindas quando a aplicação estiver implantada e em execução. Para isso, clique com o botão direito do mouse no nó `jqproject` na janela Projetos e selecione Propriedades.
* *Projetos PHP:* Selecione a categoria *Executar Configuração* e, em seguida, digite `index.html` no campo *Arquivo de Índice*.
* *Projetos Java Web:* Selecione a categoria *Executar* e, em seguida, digite `index.html` no campo *URL Relativo*.
-[start=11]
+
. Clique em OK para fechar a janela Propriedades do Projeto e salvar as alterações.
-[start=12]
+
. Neste estágio, é possível deletar o arquivo original de índice criado com o seu projeto. Em projetos PHP, este é o arquivo `index.php`; em projetos Java Web, este é o arquivo `index.jsp`.
Para deletar o arquivo, clique com o botão direito do mouse no arquivo na janela Projetos e selecione Deletar. Na caixa de diálogo de confirmação que será exibida, clique em *Sim*.
@@ -146,13 +146,13 @@
[alert]#Nos projetos Java Web, coloque a pasta `js` na raiz da Web do projeto. Para fazer isso, digite `web` no campo *Pasta Pai*.#
-[start=4]
+
. Clique em *Finalizar* para sair do assistente.
-[start=5]
+
. Localize a biblioteca do jQuery obtida por download no computador. No momento, a versão atual da biblioteca é 1.4.2, portanto, o arquivo é normalmente chamado de `jquery-1.4.2.js`. Copie o arquivo para a área de transferência (Ctrl-C; ⌘-C no Mac).
-[start=6]
+
. Cole o arquivo da biblioteca na nova pasta `js`. Para isso, clique com o botão direito do mouse em `js` e selecione Colar (Ctrl-V; ⌘-V no Mac). O nó do arquivo `jquery-1.4.2.js` será exibido na pasta.
|===
@@ -169,7 +169,7 @@
|image:images/jquery-lib-php.png[title="Cole a biblioteca do jQuery diretamente no seu projeto"] |image:images/jquery-lib-java.png[title="Cole a biblioteca do jQuery diretamente no seu projeto"]
|===
-[start=7]
+
. No editor, referencie a biblioteca do jQuery no arquivo `index.html`. Para tanto, adicione um par de tags `<script>` e use o atributo `src` para indicar o local da biblioteca. (Alterações em *negrito*.)
[source,xml]
@@ -188,7 +188,7 @@
...
----
-[start=8]
+
. Salve o arquivo (Ctrl-S; &#8984-S no Mac).
Agora, a biblioteca do jQuery está incluída no projeto `jqproject` e será referenciada no arquivo `index.html`. Podemos começar adicionando recursos jQuery à página.
@@ -208,7 +208,7 @@
<h1>Test.</h1>
----
-[start=2]
+
. Agora, criaremos uma classe CSS que faz com que um elemento apareça azul quando ela for aplicada. Digite o seguinte entre as tags `<style>` no `<head>` do documento:
[source,java]
@@ -217,7 +217,7 @@
.blue { color: blue; }
----
-[start=3]
+
. A seguir, iremos configurar um local para colocar nossos comandos jQuery. Adicione um novo conjunto de tags `<script>` no `<head>` do documento, por exemplo, após as tags `<script>` vinculadas à biblioteca jQuery. (Alterações em *negrito*.)
[source,xml]
@@ -244,7 +244,7 @@
As instruções jQuery que adicionaremos deverão ser executadas somente depois de todos os elementos do DOM serem carregados pelo browser. Isso é importante porque os comportamentos do jQuery se conectam a elementos do DOM e esses elementos devem estar disponíveis para o jQuery para obtermos os resultados esperados. O jQuery cuida disso com sua função incorporada `(document).ready`, que segue o objeto jQuery, representado por `$`.
-[start=4]
+
. Digite esta construção entre as tags de script recém-criadas:
[source,java]
@@ -295,7 +295,7 @@
</html>
----
-[start=5]
+
. Para demonstrar como a sintaxe do jQuery funciona, tentaremos algo simples. Adicionaremos instruções jQuery à nossa página que farão com que a palavra 'Teste' fique azul quando clicarmos nela. Para fazer isso, queremos que o jQuery adicione a classe CSS `.blue` ao elemento `<h1>` do DOM quando ele for clicado.
Digite o seguinte código na função `(document).ready`, entre as chaves `{}`:
@@ -308,14 +308,14 @@
});
----
-[start=6]
+
. Salve o documento (Ctrl-S; &#8984-S no Mac), e, em seguida, clique com o botão direito do mouse no editor e escolha Exibir para carregá-lo em seu Web browser. Teste para ver se funciona. Quando você clicar na palavra 'Teste', ela deverá ficar azul.
image::images/blue-test.png[title="O texto fica azul quando clicado"]
Esse exemplo usa a função `click()` do jQuery para chamar a função `addClass()` do jQuery quando um elemento que corresponde ao seletor do CSS "`h1`" é encontrado. O `$(this)` refere-se ao elemento chamador. Se fôssemos adicionar mais `<h1>`s à nossa página, o mesmo comportamento seria aplicado a todos eles com esse único conjunto de regras e cada um interagiria com o jQuery de forma independente. (Tente você mesmo como um rápido exercício.)
-[start=7]
+
. Outra qualidade importante do jQuery é que as funções podem ser simplesmente encadeadas para criar comportamentos mais complicados ou em sequência. Para demonstrar isso, vamos adicionar uma instrução jQuery de um fadeOut lento à nossa função `click()`. Coloque uma função jQuery `fadeOut("slow")` depois da função `addClass` para que a linha de código fique dessa forma:
[source,java]
@@ -335,7 +335,7 @@
});
----
-[start=8]
+
. No browser, atualize a página e a seguir clique em 'Teste'. Você verá que ela fica azul e esmaece, desaparecendo da página. (Para tentar novamente, é preciso atualizar a página.)
@@ -417,7 +417,7 @@
----
Observe que o elemento circundado `<div>` recebe um atributo `id` com um valor de `infolist`. Dentro desse elemento `<div>`, há quatro conjuntos de tags `<h3>` e `<div>` tags que contêm uma imagem e uma lista não ordenada.
-[start=2]
+
. Adicione algumas regras CSS em linha na marcação acima. Delete a regra de estilo `.blue` criada acima para fins de teste. Em seu lugar, adicione as regras a seguir. (Alterações em *negrito*.)
[source,xml]
@@ -434,20 +434,20 @@
Ao digitar nas tags `<style>`, aproveite a funcionalidade autocompletar código CSS integrada do IDE pressionando Ctrl-Espaço.
-[start=3]
+
. Salve o arquivo (Ctrl-S; &#8984-S no Mac).
-[start=4]
+
. Agora, adicionaremos os retratos JPG referenciados no fragmento de código acima ao nosso projeto. Recupere o diretório `pix` dos <<requiredSoftware,recursos do projeto obtidas por download anteriormente>> e copie o diretório inteiro para a pasta do projeto, colocando-o no mesmo nível que `index.html`. Depois de um breve momento, o NetBeans automaticamente atualiza a janela Projetos para refletir que um novo diretório foi manualmente adicionado ao projeto.
-[start=5]
+
. Alterne para o browser e atualize a página.
image::images/structured-list.png[title="Exibições de lista estruturada em um browser"]
Há uma série de problemas com este documento que trataremos. Primeiramente, é mais difícil do que o necessário varrer a lista rapidamente para encontrar a pessoa que você procura: é preciso rolar a página e inspecionar visualmente várias informações que não interessam no momento. É possível gerenciar quatro contatos em uma lista, mas, se o número crescer para, digamos, 50, será muito mais difícil utilizar a lista. Em segundo lugar, o documento é visualmente simples e é improvável que combine esteticamente com a maioria dos designs de site, particularmente, designs que tenham uma forte identidade gráfica. Trataremos esses problemas usando o widget accordion do jQuery juntamente com o tema default da IU do jQuery.
-[start=6]
+
. Para produzir o efeito do accordion, navegue para o local em seu computador em que você fez o download do widget accordion. Na pasta obtida por download, você encontrará uma pasta chamada '`development-bundle`'. Na pasta `development-bundle`, expanda a pasta `ui` e localize os três scripts a seguir:
* `jquery.ui.core.js`
* `jquery.ui.widget.js`
@@ -456,7 +456,7 @@
As versões de desenvolvimento de scripts do kit de ferramentas _não são minimizadas_, o que significa que seu código pode ser lido pelas pessoas quando exibido em um editor. Normalmente, você alternaria para as versões compactadas e minimizadas de uma aplicação pronto para a produção, de forma a economizar o tempo de download.
-[start=7]
+
. Copie (Ctrl-C; &#8984-C no Mac) os três scripts e, de volta ao IDE, cole-os na pasta `js` que você <<js,criou anteriormente>> na pasta de seu `jqproject`.
É possível colar pressionando Ctrl-V (&#8984-V no Mac) ou clicando com o botão direito do mouse na pasta `js` e selecionando Colar.
@@ -464,10 +464,10 @@
A pasta `development-bundle` > `ui` também contém um arquivo chamado `jquery-ui-1.8.1.custom.js`. Esse arquivo combina os três scripts listados anteriormente em um único script. Você também pode colar esse arquivo em seu projeto, em vez dos três scripts individuais.
-[start=8]
+
. Referencie os scripts na página `index.html` inserindo três tags `<script>` vinculadas a esses novos arquivos JavaScript. Você pode adicionar as tags `<script>` imediatamente após as tags `<script>` que referenciam a biblioteca Core do jQuery `jquery-1.4.2.js`. Use as tags `<script>` existentes como modelo.
-[start=9]
+
. Delete o código de teste que criamos dentro da função `(document).ready`. ele não será mais necessário.
As tags `<head>` de seu arquivo devem ter a seguinte aparência:
@@ -492,7 +492,7 @@
</head>
----
-[start=10]
+
. Para que façamos com que nossa lista estática e sem estilo obtenha o comportamento do accordion, basta adicionar uma linha única de código jQuery. Digite esta linha na função `(document).ready`. (Alterações em *negrito*.)
[source,java]
@@ -509,10 +509,10 @@
Você também especificou '`autoHeight: false`' no snippet de código acima. Isso impede o widget accordion de definir a altura de cada painel com base na parte mais alta do conteúdo contida na marcação. Para obter mais informações, consulte a link:http://docs.jquery.com/UI/Accordion[+documentação da API do accordion+].
-[start=11]
+
. Salve o arquivo (Ctrl-S; &#8984-S no Mac).
-[start=12]
+
. Retorne ao Web browser e atualize-o. Clique em um dos nomes (que não seja o mais acima) para ver o efeito do accordion em ação. O widget accordion do jQuery trata todos os detalhes do manuseio do DOM e da resposta aos cliques do mouse do usuário.
image::images/accordion-list.png[title="O widget accordion manipula os cliques do usuário e produz o efeito accordion"]
@@ -532,7 +532,7 @@
[alert]#Nos projetos Java Web, coloque a pasta `css` na raiz da Web do projeto. Para fazer isso, digite `web` no campo *Pasta Pai*.#
-[start=4]
+
. Coloque os dois itens diretamente na nova pasta `css`. Para isso, clique com o botão direito do mouse no nó da pasta `css` e selecione Colar. A pasta do projeto deve ser semelhante ao seguinte:
|===
@@ -549,7 +549,7 @@
|image:images/proj-win-php.png[title="O projeto contém o tema default do jQuery"] |image:images/proj-win-java.png[title="O projeto contém o tema default do jQuery"]
|===
-[start=5]
+
. Referencie o arquivo `jquery-ui-1.8.1.custom.css` de dentro da sua página Web `index.html`. Adicione a tag `<link>` a seguir ao cabeçalho da página.
[source,java]
@@ -558,10 +558,10 @@
<link rel="stylesheet" href="css/jquery-ui-1.8.1.custom.css" type="text/css">
----
-[start=6]
+
. Salve o arquivo (Ctrl-S; &#8984-S no Mac).
-[start=7]
+
. Retorne ao browser e atualize a página. Observe que a lista agora é exibida usando o tema default do jQuery, o que representa uma melhoria estética em relação à versão simples e não estilizada.
image::images/ui-lightness-theme.png[title="O tema default do jQuery aprimora a aparência do widget accordion"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ru.asciidoc
index c54ffdc..e1ffa81 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_ru.asciidoc
@@ -71,33 +71,33 @@
Если необходимо работать с веб-проектом Java, выберите категорию *Java Web*, затем выберите *Веб-приложение*.
-[start=3]
+
. Нажмите кнопку "Далее" и присвойте проекту имя `jqproject`. Также, укажите каталог на компьютере для сохранения проекта. Нажмите кнопку "Далее".
-[start=4]
+
. В действии 3 для целей этого учебного курса примите параметры мастера по умолчанию.
*Примечание.* Если проект PHP создается в первый раз и требуется поддержка, см. раздел 'Настройка среды для разработки PHP' в link:../../trails/php.html[+Учебная карта PHP+].
-[start=5]
+
. Нажмите кнопку *Готово* для завершения работы мастера и создания нового проекта. Проект `jqproject` откроется в окне "Проекты", а в редакторе откроется файл приветствия проекта.
-[start=6]
+
. Создайте обычный файл HTML, с которым вы можете работать до завершения этого курса. Поскольку для кода jQuery, который будет добавлен, не требуется связь внутренним сервером, мы просто запустим файл HTML в браузере, чтобы просмотреть результаты.
Правой кнопкой мыши щелкните узел проекта и выберите "Новый > Файл HTML" (Ctrl-N).
-[start=7]
+
. Присвойте файлу имя `index`, затем нажмите кнопку *Готово*. В окне "Проекты" обратите внимание, что в проекте присутствует новый файл `index.html`, и этот файл открыт в редакторе.
-[start=8]
+
. Взгляните на страницу приветствия в браузере. Для этого правой кнопкой мыши щелкните узел `index.html` в окне "Проекты" и выберите "Просмотр". (Также можно выбрать пункт "Просмотр" в контекстном меню файла в редакторе.) Страница отобразится в окне браузера.
image::images/browser-test.png[title="Просмотрите пустой шаблон HTML в окне браузера"]
-[start=9]
+
. В файле `index.html` в редакторе NetBeans введите `jQuery Test Project` между тегами `<title>` и создайте пару тегов `<style>` внутри тегов `<head>` страницы. (Изменения *выделены полужирным шрифтом*.)
[source,xml]
@@ -117,15 +117,15 @@
</html>
----
-[start=10]
+
. Настройте проект, чтобы файл `index.html` отображался в качестве страницы приветствия при развертывании и запуске приложения. Для этого правой кнопкой мыши щелкните узел `jqproject` в окне "Проекты" и выберите "Свойства".
* *Проекты PHP:* Выберите категорию *Выполнить настройку*, затем введите `index.html` в поле *Файл индекса*.
* *Проекты Java Web:* Выберите категорию *Выполнить*, затем введите `index.html` в поле *Относительный URL-адрес*.
-[start=11]
+
. Нажмите "ОК", чтобы закрыть окно "Свойства проекта" и сохранить изменения.
-[start=12]
+
. На этом этапе можно удалить исходный файл индекса, который был создан вместе с проектом. В проекте PHP это файл `index.php`; в проектах Java Web это файл `index.jsp`.
Для удаления файла щелкните его правой кнопкой мыши в окне "Проекты" и выберите "Удалить". В появившемся диалоговом окне подтверждения нажмите кнопку *Да*.
@@ -147,13 +147,13 @@
[alert]#Для веб-проектов Java убедитесь, что папка `js` помещена в корневой веб-узел проекта. Для этого введите `web` в папке *Родительская папка*.#
-[start=4]
+
. Нажмите кнопку *Готово* для выхода из мастера.
-[start=5]
+
. Найдите библиотеку jQuery, загруженную на компьютер. На настоящий момент текущая версия библиотеки — 1.4.2, поэтому обычно файл называется `jquery-1.4.2.js`. Скопируйте файл в буфер (Ctrl-C; ⌘-C в Mac).
-[start=6]
+
. Вставьте файл библиотеки в новую папку `js`. Для этого щелкните правой кнопкой мыши `js` и выберите 'Вставить' (Ctrl-V; ⌘-V в Mac). В папке появится узел файла `jquery-1.4.2.js`.
|===
@@ -170,7 +170,7 @@
|image:images/jquery-lib-php.png[title="Вставьте библиотеку jQuery напрямую в проект"] |image:images/jquery-lib-java.png[title="Вставьте библиотеку jQuery напрямую в проект"]
|===
-[start=7]
+
. В редакторе укажите ссылку на библиотеку jQuery из файла `index.html`. Для этого добавьте пару тегов `<script>` и используйте атрибут `src`, чтобы указать местоположение библиотеки. (Изменения *выделены полужирным шрифтом*.)
[source,xml]
@@ -189,7 +189,7 @@
...
----
-[start=8]
+
. Сохраните файл (сочетание клавиш CTRL+S; &#8984+S в Mac OS).
Теперь библиотека jQuery включена в проект `jqproject`, и на нее содержится ссылка в файле `index.html`. Можно начать добавлять функции jQuery к странице.
@@ -209,7 +209,7 @@
<h1>Test.</h1>
----
-[start=2]
+
. Теперь создадим класс CSS, делающий элемент синим при применении. Введите следующее между тегами `<style>` в `<head>` заголовок:
[source,java]
@@ -218,7 +218,7 @@
.blue { color: blue; }
----
-[start=3]
+
. Теперь настроим место для размещения команд jQuery. Добавим новый набор тегов `<script>` к `<head>` документа, например, после тегов `<script>` со ссылкой на библиотеку jQuery. (Изменения *выделены полужирным шрифтом*.)
[source,xml]
@@ -245,7 +245,7 @@
Команды jQuery, которые мы добавим, должны быть выполнены только после загрузки браузером всех элементов модели DOM. Это важно, потому что поведения jQuery подключаются к элементам модели DOM, и эти элементы должны быть доступны для jQuery для получения ожидаемых результатов. jQuery выполняет это за нас с помощью встроенной функции `(document).ready`, которая следует за объектом jQuery, представленным `$`.
-[start=4]
+
. Введите эту конструкцию между только что созданными тегами script:
[source,java]
@@ -296,7 +296,7 @@
</html>
----
-[start=5]
+
. Для демонстрации работы синтаксиса jQuery попробуем выполнить простую операцию. Мы добавим к странице инструкции jQuery для изменения цвета слова "Test" на синий при его щелчке. Для этого библиотека jQuery должна добавить класс CSS `.blue` к элементу `<h1>` модели DOM при получении щелчка мыши.
Введите следующий код внутри функции `(document).ready` между скобок `{}`:
@@ -309,14 +309,14 @@
});
----
-[start=6]
+
. Сохраните документ (Ctrl-S; ⌘-S в Mac), затем щелкните правой кнопкой мыши в редакторе и выберите 'Просмотр' для просмотра в используемом веб-браузере. Выполните тестирование, чтобы проверить работу. При щелчке слова "Test" оно должно стать синим.
image::images/blue-test.png[title="При щелчке текста его цвет изменяется на синий"]
В этом примере используется функция `click()` jQuery для вызова функции `addClass()` jQuery при достижении элемента, соответствующего селектору CSS "`h1`". `$(this)` ссылается обратно на вызываемый элемент. Если добавить к странице дополнительные селекторы `<h1>`, это же поведение будет применено ко всем из них с этим набором правил, и каждый будет независимо взаимодействовать с jQuery. (Можно попробовать выполнить это как краткое упражнение.)
-[start=7]
+
. Другое важное качество jQuery — функции могут быть быстро объединены в цепочку для создания более сложных или последовательных поведений. Чтобы продемонстрировать это, добавим инструкцию jQuery для замедления fadeOut для нашей функции `click()`. Разместите функцию `fadeOut("slow")` jQuery после функции `addClass`, чтобы строка кода выглядела следующим образом:
[source,java]
@@ -336,7 +336,7 @@
});
----
-[start=8]
+
. В браузере обновите страницу и щелкните "Test". Текст станет синим, затем темнеет и исчезает со страницы. (Чтобы повторить, необходимо обновить страницу.)
@@ -418,7 +418,7 @@
----
Обратите внимание, что общему заключающему элементу `<div>` предоставлен атрибут `id` со значением `infolist`. В этом элементе `<div>` находятся четыре комплекта тегов `<h3>` и теги `<div>`, содержащие изображение и нумерованный список.
-[start=2]
+
. Добавьте несколько встроенных правил CSS к приведенной выше разметке. Удалите правило стиля `.blue`, созданное для целей тестирования выше. Вместо него добавьте следующие правила. (Изменения *выделены полужирным шрифтом*.)
[source,xml]
@@ -435,20 +435,20 @@
При вводе внутри тегов `<style>` используйте встроенную функцию автозавершения кода CSS среды IDE, вызываемую путем нажатия Ctrl-Space.
-[start=3]
+
. Сохраните файл (сочетание клавиш CTRL+S; &#8984+S в Mac OS).
-[start=4]
+
. Теперь добавим изображения JPG, на которые содержатся ссылки в приведенном выше фрагменте кода нашего проекта. Получите каталог `pix` из <<requiredSoftware,ресурсов проекта, загруженных ранее,>> и скопируйте каталог целиком в папку проекта, разместив его на том же уровне, что и файл `index.html`. Через некоторый момент среда NetBeans автоматически обновит окно "Проекты", чтобы отразить, что новый каталог добавлен в проект вручную.
-[start=5]
+
. Переключитесь на браузер и обновите страницу.
image::images/structured-list.png[title="Структурированный список отображается в браузере"]
Есть ряд проблем этого документа, которые будут решены. Во-первых, поиск нужного лица в списке сложнее, чем он должен быть: необходимо прокрутить страницу и визуально проверить множество информации, которая может быть ненужной. Список из четырех контактов может быть управляемым, но если их число вырастет, скажем, до 50, использование списка заметно усложнится. Во-вторых, документ визуально простой, и, скорей всего, не будет сочетаться с дизайном большинства веб-сайтов, в частности сайтом со множеством графики. Эти проблемы будут решены с помощью элемента оформления accordion jQuery вместе с темой jQuery UI по умолчанию.
-[start=6]
+
. Для создания эффекта accordion найдите на компьютере загруженный элемент оформления accordion. В загруженной папке найдите папку с именем "`development-bundle`". В папке `development-bundle` разверните папку `ui` и найдите три следующие сценария:
* `jquery.ui.core.js`
* `jquery.ui.widget.js`
@@ -457,7 +457,7 @@
Версии сценариев наборов инструментов для разработки _полные_, что означает, что их код удобочитаем при просмотре в редакторе. Обычно для готовых к использованию приложений необходимы сжатые версии, чтобы сократить время загрузки.
-[start=7]
+
. Скопируйте (Ctrl-C; &#8984-C в Mac) три сценария, вернитесь в среду IDE и вставьте их в `js` папку, <<js,созданную ранее >> в папке `jqproject`.
Для вставки можно использовать нажатие Ctrl-V (⌘-V в Mac) или щелкните правой кнопкой мыши папку `js` и выберите 'Вставить'.
@@ -465,10 +465,10 @@
В папке `development-bundle` > `ui` также содержится файл с именем `jquery-ui-1.8.1.custom.js`. В этом файле три указанных выше сценария объединены в один. Можно также вставить этот файл в проект вместо трех отдельных сценариев.
-[start=8]
+
. Создайте ссылки на сценарии на странице `index.html`, введя три тега `<script>` со ссылками на эти новые файлы JavaScript. Теги `<script>` можно добавить сразу после тегов `<script>`, которые ссылаются на `jquery-1.4.2.js` базовой библиотеки jQuery. Используйте существующие теги `<script>` в качестве модели.
-[start=9]
+
. Удалите тестовый код, созданный внутри функции `(document).ready`. Он больше не требуется.
Теперь теги `<head>` вашего файла должны выглядеть следующим образом.
@@ -493,7 +493,7 @@
</head>
----
-[start=10]
+
. Для того, чтобы статический список без стиля использовал поведение accordion, необходимо просто добавить одну строку кода jQuery. Введите эту строку в функцию `(document).ready`. (Изменения *выделены полужирным шрифтом*.)
[source,java]
@@ -510,10 +510,10 @@
В приведенном выше фрагменте кода также было указано "`autoHeight: false`". Это препятствует установке элементом оформления accordion высоты каждой панели на основе самой высокой части содержимого в разметке. Дополнительные сведения см. в link:http://docs.jquery.com/UI/Accordion[+документации accordion API+].
-[start=11]
+
. Сохраните файл (сочетание клавиш CTRL+S; &#8984+S в Mac OS).
-[start=12]
+
. Вернитесь к веб-браузеру и обновите страницу. Щелкните одно из имен (не верхнее), чтобы просмотреть действие accordion. Элемент оформления accordion jQuery обрабатывает все сведения обработки DOM и реагирования на щелчки мыши пользователем.
image::images/accordion-list.png[title="Виджет 'гармошка' обрабатывает щелчки мышью пользователей и создает звуковой эффект звука гармошки"]
@@ -533,7 +533,7 @@
[alert]#Для проектов Java Web убедитесь, что папка `js` помещена в корневой веб-узел проекта. Для этого введите `web` в папке *Родительская папка*.#
-[start=4]
+
. Вставьте два элемента непосредственно в новую папку `css`. Для этого щелкните правой кнопкой мыши узел папки `css` и выберите 'Вставить'. Папка проекта должна выглядеть следующим образом.
|===
@@ -550,7 +550,7 @@
|image:images/proj-win-php.png[title="Проект содержит тему jQuery, заданную по умолчанию"] |image:images/proj-win-java.png[title="Проект содержит тему jQuery, заданную по умолчанию"]
|===
-[start=5]
+
. Ссылка на файл `jquery-ui-1.8.1.custom.css` на веб-странице `index.html`. Добавьте следующий тег `<link>` в заголовок страницы.
[source,java]
@@ -559,10 +559,10 @@
<link rel="stylesheet" href="css/jquery-ui-1.8.1.custom.css" type="text/css">
----
-[start=6]
+
. Сохраните файл (сочетание клавиш CTRL+S; &#8984+S в Mac OS).
-[start=7]
+
. Вернитесь в веб-браузер и обновите страницу. Обратите внимание, что теперь список отображается с темой jQuery по умолчанию, что является эстетическим улучшением по сравнению с простой версией без стиля.
image::images/ui-lightness-theme.png[title="Тема jQuery, заданная по умолчанию, улучшает внешний вид виджета 'гармошка'"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_zh_CN.asciidoc
index 33f1672..b04a39a 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/js-toolkits-jquery_zh_CN.asciidoc
@@ -71,33 +71,33 @@
如果要使用 Java Web 项目,请选择 *Java Web* 类别,然后选择 *Web Application*(Web 应用程序)。
-[start=3]
+
. 单击 "Next"(下一步)并将项目命名为 `jqproject`。还要指定计算机中要用于保存项目的目录。单击 "Next"(下一步)。
-[start=4]
+
. 在步骤 3 中,就本教程而言,请接受向导中提供的默认设置。
*注:*如果您是初次创建 PHP 项目并且需要帮助,请参见 link:../../trails/php.html[+PHP 学习教程+]中的“为 PHP 开发配置环境”。
-[start=5]
+
. 单击 *Finish*(完成),以完成向导并创建新项目。`jqproject` 将在 "Projects"(项目)窗口中打开,并在编辑器中打开项目欢迎页。
-[start=6]
+
. 创建一个纯 HTML 文件,在本教程的剩余部分中,可以使用该文件。由于将要添加的 jQuery 代码不需要与后端服务器进行任何通信,因此只需在浏览器中运行该 HTML 文件便可查看结果。
右键单击项目节点并选择 "New"(新建)> "HTML file"(HTML 文件)(Ctrl-N 组合键)。
-[start=7]
+
. 将文件命名为 `index`,然后单击 *Finish*(完成)。在 "Projects"(项目)窗口中,注意项目中已列出新的 `index.html` 文件,且在编辑器中打开该文件。
-[start=8]
+
. 在浏览器中查看欢迎页的外观。要执行此操作,请右键单击 "Projects"(项目)窗口中的 `index.html` 节点并选择 "View"(查看)。(还可以在编辑器中从文件的右键单击菜单中选择 "View"(查看)。)将在浏览器窗口中显示该页。
image::images/browser-test.png[title="查看浏览器窗口中的空 HTML 模板"]
-[start=9]
+
. 在 NetBeans 编辑器的 `index.html` 文件中,在 `<title>` 标记之间键入 `jQuery Test Project`,并在页面的 `<head>` 标记内创建一对 `<style>` 标记。(更改内容以*粗体*显示。)
[source,xml]
@@ -117,15 +117,15 @@
</html>
----
-[start=10]
+
. 配置项目,以便在部署和运行应用程序时将 `index.html` 文件显示为欢迎文件。要执行此操作,请右键单击 "Projects"(项目)窗口中的 `jqproject` 节点,然后选择 "Properties"(属性)。
* *PHP 项目:*选择 *Run Configuration*(运行配置)类别,然后在 *Index File*(索引文件)字段中键入 `index.html`。
* *Java Web 项目:*选择 *Run*(运行)类别,然后在 *Relative URL*(相对 URL)字段中键入 `index.html`。
-[start=11]
+
. 单击 "OK"(确定)关闭 "Project Properties"(项目属性)窗口并保存更改。
-[start=12]
+
. 在此阶段,您可以删除随项目创建的原始索引文件。在 PHP 项目中,该文件为 `index.php` 文件;在 Java Web 项目中,该文件为 `index.jsp` 文件。
要删除该文件,请在 "Projects"(项目)窗口中右键单击文件,然后选择 "Delete"(删除)。在显示的确认对话框中,单击 *Yes*(是)。
@@ -147,13 +147,13 @@
[alert]#对于 Java Web 项目,确保将 `js` 文件夹放在项目的 Web 根中。为此,请在 *Parent Folder*(父文件夹)字段中输入 `web`。#
-[start=4]
+
. 单击 *Finish*(完成)退出向导。
-[start=5]
+
. 查找下载到计算机中的 jQuery 库。到目前为止,最新库版本为 1.4.2,因此文件通常命名为 `jquery-1.4.2.js`。将文件复制到剪贴板(Ctrl-C 组合键;在 Mac 上为 ⌘-C 组合键)。
-[start=6]
+
. 将库文件粘贴到新的 `js` 文件夹中。为此,请右键单击 `js` 并选择 "Paste"(粘贴)(Ctrl-V 组合键;在 Mac 上为 ⌘-V 组合键)。`jquery-1.4.2.js` 文件节点将出现在该文件夹中。
|===
@@ -170,7 +170,7 @@
|image:images/jquery-lib-php.png[title="将 jQuery 库直接粘贴到您的项目"] |image:images/jquery-lib-java.png[title="将 jQuery 库直接粘贴到您的项目"]
|===
-[start=7]
+
. 在编辑器中,从 `index.html` 文件中引用 jQuery 库。为此,请添加一对 `<script>` 标记并使用 `src` 属性指向库位置。(更改内容以*粗体*显示。)
[source,xml]
@@ -189,7 +189,7 @@
...
----
-[start=8]
+
. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。
现在,jQuery 库包含在 `jqproject` 项目中,并从 `index.html` 文件中引用。我们可以开始向页面中添加 jQuery 功能。
@@ -209,7 +209,7 @@
<h1>Test.</h1>
----
-[start=2]
+
. 现在我们将创建一个 CSS 类,当应用该类时使元素出现蓝色。在文档 `<head>` 的 `<style>` 标记间输入以下内容:
[source,java]
@@ -218,7 +218,7 @@
.blue { color: blue; }
----
-[start=3]
+
. 下一步,我们将建立一个容纳 jQuery 命令的地方。向文档的 `<head>` 中添加一组新的 `<script>` 标记(例如,在链接到 jQuery 库的 `<script>` 标记之后)。(更改内容以*粗体*显示。)
[source,xml]
@@ -245,7 +245,7 @@
我们将要添加的 jQuery 指令必须在浏览器加载所有 DOM 元素之后才能执行。这点很重要,因为 jQuery 行为与 DOM 元素连接在一起,jQuery 必须可以使用这些元素,以便得到预期结果。jQuery 通过其内置的 `(document).ready` 函数帮助实现此目的,该函数在 jQuery 对象之后,由 `$` 表示。
-[start=4]
+
. 在刚创建的脚本标记间输入以下结构:
[source,java]
@@ -296,7 +296,7 @@
</html>
----
-[start=5]
+
. 为了演示 jQuery 语法的原理,我们将尝试一些简单操作。将 jQuery 指令添加到页面中,单击 "Test" 时,该指令使该词变为蓝色。为实现此功能,我们希望 jQuery 在接收到鼠标单击事件后将 CSS 类 `.blue` 添加到 DOM 的 `<h1>` 元素中。
在 `(document).ready` 函数的花括号 `{}` 内输入下面的代码:
@@ -309,14 +309,14 @@
});
----
-[start=6]
+
. 保存文档(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键),然后在编辑器中单击右键并选择 "View"(查看),将其加载到 Web 浏览器中。测试其运行情况。当单击 "Test" 单词,该词将变成蓝色。
image::images/blue-test.png[title="单击文本时文本将变为蓝色"]
在本例中,当与 CSS 选择器 "`h1`" 相匹配的元素出现时,可使用 jQuery `click()` 函数调用 jQuery `addClass()` 函数。`$(this)` 指向调用元素。如果想在页面中添加更多的 `<h1>`,可以采用同一套规则下的相同行为,各行为单独与 jQuery 进行交互。(您可以自己尝试此练习)
-[start=7]
+
. jQuery 的另一项重要特质是其函数可被简单链接起来,以创建更加复杂甚至是串行化的行为。为演示这一点,我们将为 `click()` 函数添加一条“慢 fadeOut”指令。在 `addClass` 函数后面添加一个 `fadeOut("slow")` jQuery 函数,如下所示:
[source,java]
@@ -336,7 +336,7 @@
});
----
-[start=8]
+
. 在浏览器中刷新页面,然后单击 "Test"。您将看到 "Test" 变蓝,然后淡出,并从页面中消失。(想再试一次,必须刷新页面。)
@@ -418,7 +418,7 @@
----
注意整个 `<div>` 闭合元素被赋予了一个值为 `infolist` 的 `id` 属性。在此 `<div>` 元素中,有四组包含图像和未排序列表的 `<h3>` 标记和 `<div>` 标记。
-[start=2]
+
. 向上面的标记中添加一些内联 CSS 规则。删除您为上面的测试创建的 `.blue` 样式规则。在其位置添加以下规则。(更改内容以*粗体*显示。)
[source,xml]
@@ -435,20 +435,20 @@
在 `<style>` 标记内键入内容时,可以通过按 Ctrl-空格键利用 IDE 的内置 CSS 代码完成。
-[start=3]
+
. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。
-[start=4]
+
. 现在,我们将向项目添加以前代码片段中涉及的 JPG 肖像。从<<requiredSoftware,之前下载的项目资源>>中检索 `pix` 目录,将整个目录复制到项目文件夹中,将其与 `index.html` 目录同级放置。稍后,NetBeans 将自动更新 "Projects"(项目)窗口,可以看到该项目中已经添加了一个新目录。
-[start=5]
+
. 切换到浏览器并刷新页面。
image::images/structured-list.png[title="结构化列表显示在浏览器中"]
我们还要说明本文档的许多问题。首先,在列表中快速扫描以找到您要找的人变得更加困难:必须滚动页面查看大量可能和当前利益无关的信息。四个联系人的列表都是可管理的,但如果人数上升到 50 人(举例来说),使用列表将变得更加困难。其次,该文档看起来是简单的,不大可能很美观地插入大多数 Web 站点的设计,特别是有很强图形特征的设计。我们将通过组合使用 jQuery 可折叠面板窗口部件和 jQuery UI 的默认主题来解决这些问题。
-[start=6]
+
. 要生成可折叠面板效果,请导航至计算机上下载可折叠面板窗口部件的位置。在下载的文件夹中,您将发现一个名为 "`development-bundle`" 的文件夹。在 `development-bundle` 文件夹中,展开 `ui` 文件夹并查找以下三个脚本:
* `jquery.ui.core.js`
* `jquery.ui.widget.js`
@@ -457,7 +457,7 @@
工具包脚本的开发版未进行_最小化处理_,这意味着在编辑器中查看时,其代码易于读取。通常,您要切换到产品应用程序的已压缩的最小化版本,以节省下载时间。
-[start=7]
+
. 复制(Ctrl-C 组合键;在 Mac 上为 ⌘-C 组合键)这三个脚本,回到 IDE 中,将其粘贴到您之前在 `jqproject` 文件夹中<<js,创建>>的 `js` 文件夹。
可以通过按 Ctrl-V 组合键(在 Mac 上为 ⌘-V 组合键)或右键单击 `js` 文件夹并选择 "Paste"(粘贴)来进行粘贴。
@@ -465,10 +465,10 @@
`development-bundle` > `ui` 文件夹也包含一个名为 `jquery-ui-1.8.1.custom.js` 的文件。此文件将上面所列的三个脚本组合为一个脚本。也可以将此文件粘贴到项目中,以代替三个单独的脚本。
-[start=8]
+
. 通过输入三个链接到这些新 JavaScript 文件的 `<script>` 标记来引用 `index.html` 页面中的脚本。可在紧随引用核心 jQuery 库 `jquery-1.4.2.js` 的 `<script>` 标记之后的位置添加 `<script>` 标记。使用现有的 `<script>` 标记作为模型。
-[start=9]
+
. 删除我们在 `(document).ready` 函数中创建的测试代码。我们不再需要这些代码了。
现在,文件的 `<head>` 标记应如下所示。
@@ -493,7 +493,7 @@
</head>
----
-[start=10]
+
. 让静态、无样式的列表接受折叠行为就和添加一行 jQuery 代码一样简单。将此行输入 `(document).ready` 函数中。(更改内容以*粗体*显示。)
[source,java]
@@ -510,10 +510,10 @@
您还在上面的代码片段中指定了 "`autoHeight: false`"。这样可以防止可折叠面板窗口部件根据标记内包含的最高内容部分设置每个面板的高度。有关详细信息,请参见link:http://docs.jquery.com/UI/Accordion[+可折叠面板 API 文档+]。
-[start=11]
+
. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。
-[start=12]
+
. 返回 Web 浏览器并刷新。单击其中一个姓名(除了顶部第一个),查看实际的折叠效果。jQuery 可折叠面板窗口部件可处理有关处理 DOM 和响应用户鼠标单击的所有详细信息。
image::images/accordion-list.png[title="可折叠面板窗口部件处理用户单击并生成可折叠面板效果"]
@@ -533,7 +533,7 @@
[alert]#对于 Java Web 项目,请确保将 `css` 文件夹放在项目的 Web 根中。为此,请在 *Parent Folder*(父文件夹)字段中输入 `web`。#
-[start=4]
+
. 将这两项直接粘贴到新的 `css` 文件夹中。为此,请右键单击 `css` 文件夹节点并选择 "Paste"(粘贴)。项目文件夹应如下所示。
|===
@@ -550,7 +550,7 @@
|image:images/proj-win-php.png[title="项目包含 jQuery 默认主题"] |image:images/proj-win-java.png[title="项目包含 jQuery 默认主题"]
|===
-[start=5]
+
. 从 `index.html` Web 页中引用 `jquery-ui-1.8.1.custom.css` 文件。在页的头中添加以下 `<link>` 标记。
[source,java]
@@ -559,10 +559,10 @@
<link rel="stylesheet" href="css/jquery-ui-1.8.1.custom.css" type="text/css">
----
-[start=6]
+
. 保存文件(Ctrl-S;在 Mac 上为 ⌘-S)。
-[start=7]
+
. 返回到 Web 浏览器并刷新页面。请注意,现在使用 jQuery 的默认主题显示列表,这是简单、未风格化的版本的美学改进。
image::images/ui-lightness-theme.png[title="jQuery 默认主题增强可折叠面板窗口部件的外观"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic.asciidoc
index 92e0eb2..2298217 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic.asciidoc
@@ -69,7 +69,7 @@
Remember to note the user name and password.
-[start=3]
+
. Create a WebLogic domain.
You can use the link:http://download.oracle.com/docs/cd/E17904_01/web.1111/e14140/newdom.htm#i1073602[+Graphical Mode of the WebLogic Configuration Wizard+] to help you create the domain.
@@ -94,10 +94,10 @@
The IDE will automatically identify the domain for the server instance.
-[start=5]
+
. Type the username and password for the domain.
-[start=6]
+
. Enable JPA 2.0 (WebLogic Server 10.3.4 or 10.3.5 only). Click Finish.
*Note.* If you are registering an instance of WebLogic Server 12c (12.1.1.0) you do not need to enable JPA 2.0 because JPA 2.0 is enabled by default. If you are registering an instance of WebLogic Server 11g Rel 1 (10.3.4 or 10.3.5) you can enable JPA 2.0 when you register the server or in the Servers manager after the server is registered. See the section <<01e,Enabling Support for JPA 2.0 on Oracle WebLogic Server 11g>> below for more details.
@@ -126,13 +126,13 @@
You can right-click the Oracle WebLogic Server node and choose View Server Log if the tab is not visible.
-[start=2]
+
. Right-click the Oracle WebLogic Server node and choose View Admin Console.
When you choose View Admin Console, the login screen of the server opens in your browser.
-[start=3]
+
. Log in with the username and password that you specified when you installed the server.
After you log in, you will see the Home Page of the Admin Console in your browser.
@@ -159,7 +159,7 @@
The Domain tab of the Servers manager enables you to view and modify the username and password.
-[start=2]
+
. Click Enable JPA 2. Click Close.
When you click Enable JPA 2, the IDE will modify the WebLogic Server classpath to add the files to enable support for JPA 2.
@@ -170,16 +170,16 @@
* link:http://forums.oracle.com/forums/thread.jspa?threadID=1112476[+OTN Discussion Forum: 11g Release 1 Patch Set 3 (WLS 10.3.4) +]
* link:http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic[+Running JPA 2.0 API on WebLogic 10.3+]
-[start=3]
+
. Open the Oracle WebLogic Server Admin Console in your browser and log in.
-[start=4]
+
. Click *Domain* under the Domain Configurations section of the Admin Console.
-[start=5]
+
. Click the *JPA* tab under the Configuration tab.
-[start=6]
+
. Select *TopLink* in the Default JPA Provider dropdown list. Click Save.
image::images/admin-console-jpa.png[title="JPA tab in Oracle WebLogic Server Admin Console"]
@@ -209,10 +209,10 @@
image::images/new-project-ee6.png[title="Weblogic selected in New Project wizard"]
-[start=7]
+
. Select JavaServer Faces framework.
-[start=8]
+
. Select JSF 2.x from the Server Library dropdown list. Click Finish.
image::images/projectwizard-serverlib.png[title="Frameworks panel New Project wizard"]
@@ -292,7 +292,7 @@
When you click OK, the IDE creates the sample database and populates the database tables. If you expand the MySQL server node you can see that the list of databases now contains the new ``sample`` database.
-[start=5]
+
. Expand the MySQL server node and right-click the sample database and choose Connect.
When you click Connect, a database connection node for the database appears under the Databases node. You can expand the node to view the database tables.
@@ -367,7 +367,7 @@
The wizard lists the ``customer`` table and the related tables under Selected Tables.
-[start=5]
+
. Type *ejb* as the package for the generated classes. Click Finish.
When you click Finish, the IDE generates entity classes for each of the selected tables. You can expand the ``ejb`` source package node to view the generated entity classes.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ja.asciidoc
index c20ca21..aa2f8e6 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ja.asciidoc
@@ -69,7 +69,7 @@
ユーザー名とパスワードを必ずメモしておいてください。
-[start=3]
+
. WebLogicドメインを作成します。
ドメインの作成には、link:http://download.oracle.com/docs/cd/E17904_01/web.1111/e14140/newdom.htm#i1073602[+WebLogic構成ウィザードのグラフィカル・モード+]を使用できます。
@@ -94,10 +94,10 @@
IDEはサーバー・インスタンスのドメインを自動的に特定します。
-[start=5]
+
. ドメインのユーザー名とパスワードを入力します。
-[start=6]
+
. JPA 2.0を有効にします(WebLogic Server 10.3.4または10.3.5のみ)。「終了」をクリックします。
*注意:*WebLogic Server 12c (12.1.1.0)のインスタンスを登録する場合、JPA 2.0はデフォルトで有効になるため、有効にする必要はありません。WebLogic Server 11g リリース1 (10.3.4または10.3.5)のインスタンスを登録する場合は、サーバーの登録時か、サーバーの登録後にサーバー・マネージャで、JPA 2.0を有効にできます。詳細は、後述の<<01e,「Oracle WebLogic Server 11gでのJPA 2.0のサポートの有効化」>>を参照してください。
@@ -126,13 +126,13 @@
このタブが表示されていない場合は、Oracle WebLogic Serverのノードを右クリックし、「サーバー・ログの表示」を選択します。
-[start=2]
+
. Oracle WebLogic Serverのノードを右クリックし、「管理コンソールを表示」を選択します。
「管理コンソールを表示」を選択すると、サーバーのログイン画面がブラウザで開きます。
-[start=3]
+
. サーバーのインストール時に指定したユーザー名とパスワードを使用してログインします。
ログインすると、管理コンソールのホーム・ページがブラウザに表示されます。
@@ -159,7 +159,7 @@
サーバー・マネージャの「ドメイン」タブでは、ユーザー名とパスワードを表示および変更できます。
-[start=2]
+
. 「JPA 2を有効化」をクリックします。「閉じる」をクリックします。
「JPA 2を有効化」をクリックすると、IDEでWebLogic Serverのクラスパスが変更され、JPA 2のサポートを有効にするためのファイルが追加されます。
@@ -170,16 +170,16 @@
* link:http://forums.oracle.com/forums/thread.jspa?threadID=1112476[+OTNディスカッション・フォーラム: 11g リリース1パッチ・セット3 (WLS 10.3.4) +]
* link:http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic[+WebLogic 10.3でのJPA 2.0 APIの実行+]
-[start=3]
+
. Oracle WebLogic Serverの管理コンソールをブラウザで開き、ログインします。
-[start=4]
+
. 管理コンソールの「ドメイン構成」セクションの「*ドメイン*」をクリックします。
-[start=5]
+
. 「構成」タブの「*JPA*」タブをクリックします。
-[start=6]
+
. 「デフォルトJPAプロバイダ」ドロップダウン・リストで「*TopLink*」を選択します。「保存」をクリックします。
image::images/admin-console-jpa.png[title="Oracle WebLogic Server管理コンソールの「JPA」タブ"]
@@ -209,10 +209,10 @@
image::images/new-project-ee6.png[title="新規プロジェクト・ウィザードで選択されたWeblogic"]
-[start=7]
+
. JavaServer Facesフレームワークを選択します。
-[start=8]
+
. 「サーバー・ライブラリ」ドロップダウン・リストから「JSF 2.x」を選択します。「終了」をクリックします。
image::images/projectwizard-serverlib.png[title="新規プロジェクト・ウィザードの「フレームワーク」パネル"]
@@ -292,7 +292,7 @@
「OK」をクリックすると、sampleデータベースが作成され、データベース表が生成されます。MySQLサーバーのノードを展開すると、データベースのリストに新しい ``sample`` データベースが追加されていることがわかります。
-[start=5]
+
. MySQLサーバーのノードを展開し、sampleデータベースを右クリックし、「接続」を選択します。
「接続」をクリックすると、そのデータベースに対するデータベース接続ノードが「データベース」ノードの下に表示されます。ノードを展開すると、データベース表を表示できます。
@@ -367,7 +367,7 @@
``customer`` 表とそれに関連する表がウィザードの「選択した表」の下に一覧表示されます。
-[start=5]
+
. 生成されるクラスのパッケージとして「*ejb*」と入力します。「終了」をクリックします。
「終了」をクリックすると、選択した各表のエンティティ・クラスがIDEによって生成されます。 ``ejb`` ソース・パッケージ・ノードを展開すると、生成されたエンティティ・クラスを表示できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_pt_BR.asciidoc
index 3b17349..b872a84 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_pt_BR.asciidoc
@@ -69,7 +69,7 @@
Lembre-se de anotar o nome de usuário e a senha.
-[start=3]
+
. Crie um domínio do WebLogic.
Você pode usar o link:http://download.oracle.com/docs/cd/E17904_01/web.1111/e14140/newdom.htm#i1073602[+Modo Gráfico do Assistente de Configuração do WebLogic+] para ajudá-lo a criar o domínio.
@@ -94,10 +94,10 @@
O IDE automaticamente identificará o domínio da instância do servidor.
-[start=5]
+
. Digite o nome de usuário e a senha do domínio.
-[start=6]
+
. Ativar JPA 2.0 (Somente Servidor WebLogic 10.3.4 ou 10.3.5). Clique em Finalizar.
*Observação.* Se estiver registrando uma instância do Servidor WebLogic 12c (12.1.1.0) você precisará ativar o JPA 2.0 porque JPA 2.0 é ativado por default. Se você estiver registrando uma instância do WebLogic Server 11g Rel 1 (10.3.4 ou 10.3.5), você poderá ativar o JPA 2.0 ao registrar o servidor ou no Gerenciador de servidores depois que o servidor estiver registrado. Consulte a seção <<01e,Ativando Suporte para JPA 2.0 no Oracle WebLogic Server 11g>> abaixo para obter mais detalhes.
@@ -126,13 +126,13 @@
Caso a guia não esteja visível, você poderá clicar com o botão direito do mouse no nó do Oracle WebLogic Server e selecionar Exibir Log do Servidor.
-[start=2]
+
. Clique com o botão direito do mouse no nó do Oracle WebLogic Server e selecione Exibir Console de Administração.
Quando você escolhe Exibir Console Admin, a tela de log-in do servidor é aberta no browser.
-[start=3]
+
. Faça log-in com o nome de usuário e a senha especificados na instalação o servidor.
Após o log-in, você verá a Home Page da Console de Administração no seu browser.
@@ -159,7 +159,7 @@
A guia Domínio do Gerenciador de servidores permite que você exiba e modifique o nome de usuário e a senha.
-[start=2]
+
. Clique em Ativar JPA 2. Clique em Fechar.
Quando você clicar em Ativar JPA 2, o IDE modificará o classpath do WebLogic Server para adicionar os arquivos e ativar o suporte ao JPA 2.
@@ -170,16 +170,16 @@
* link:http://forums.oracle.com/forums/thread.jspa?threadID=1112476[+Fórum de Discussão OTN: 11g Release 1 Conjunto de Patches 3 (WLS 10.3.4)+]
* link:http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic[+Executando a API do JPA 2.0 no WebLogic 10.3+]
-[start=3]
+
. Abra a Console de Administração do Oracle WebLogic Server no seu browser e efetue log-in.
-[start=4]
+
. Clique em *Domínio* na seção Configurações de Domínio da Console de Administração.
-[start=5]
+
. Clique na guia *JPA* na guia Configuração.
-[start=6]
+
. Selecione *TopLink* na lista drop-down Provedor JPA Default. Clique em Salvar.
image::images/admin-console-jpa.png[title="guia JPA na Console de Administração do Oracle WebLogic Server"]
@@ -209,10 +209,10 @@
image::images/new-project-ee6.png[title="WebLogic selecionado no Assistente de Novo Projeto"]
-[start=7]
+
. Selecione o framework JavaServer Faces.
-[start=8]
+
. Selecione JSF 2.x na lista drop-down Biblioteca do Servidor. Clique em Finalizar.
image::images/projectwizard-serverlib.png[title="Painel Frameworks do assistente de Novo Projeto"]
@@ -292,7 +292,7 @@
Quando você clicar em OK, o IDE criará o banco de dados de amostra e preencherá as tabelas do banco de dados. Se você expandir o nó do servidor MySQL, você verá que a lista de bancos de dados agora contém o novo banco de dados ``sample`` .
-[start=5]
+
. Expanda o nó do servidor MySQL e clique com o botão direito do mouse no banco de dados de amostra e selecione Conectar.
Quando você clicar em Conectar, um nó de conexão de banco de dados para o banco de dados aparecerá sob o nó Bancos de Dados. É possível expandir o nó para exibir as tabelas do banco de dados.
@@ -367,7 +367,7 @@
O assistente lista a tabela ``customer`` e as tabelas relacionadas em Tabelas Selecionadas.
-[start=5]
+
. Digite *ejb* como o pacote para as classes geradas. Clique em Finalizar.
Quando você clicar em Finalizar, o IDE gerará as classes de entidade para cada tabela selecionada. É possível expandir o nó do pacote de código-fonte ``ejb`` para exibir as classes de entidade geradas.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ru.asciidoc
index e7fc424..1af97c7 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_ru.asciidoc
@@ -69,7 +69,7 @@
Не забудьте указать имя пользователя и пароль.
-[start=3]
+
. Создайте домен WebLogic.
Можно использовать link:http://download.oracle.com/docs/cd/E17904_01/web.1111/e14140/newdom.htm#i1073602[+графический режим мастера настройки WebLogic+] для создания домена.
@@ -94,10 +94,10 @@
IDE автоматически идентифицирует домен для экземпляра сервера.
-[start=5]
+
. Введите имя пользователя и пароль для домена.
-[start=6]
+
. Включите интерфейс JPA 2.0 (только для WebLogic Server 10.3.4 или 10.3.5). Нажмите кнопку "Завершить".
*Примечание.* При регистрации экземпляра WebLogic Server 12c (12.1.1.0) не требуется включать интерфейс JPA 2.0, так как он включен по умолчанию. Если вы регистрируете экземпляр сервера WebLogic 11g Rel 1 (10.3.4 или 10.3.5), вы можете активировать JPA 2.0 при регистрации сервера или в диспетчере серверов после регистрации. Дополнительные сведения см. в следующем разделе <<01e,Включение поддержки JPA 2.0 в Oracle WebLogic Server 11g>>.
@@ -126,13 +126,13 @@
Можно щелкнуть правой кнопкой мыши узел сервера Oracle WebLogic и выбрать 'Просмотреть журнал сервера', если вкладка не отображается.
-[start=2]
+
. Щелкните правой кнопкой мыши узел сервера Oracle WebLogic и выберите команду "Просмотреть администраторскую консоль".
При выборе команды "Просмотреть администраторскую консоль" в вашем браузере откроется экран входа на сервер.
-[start=3]
+
. Войдите с помощью имени пользователя и пароля, которые вы указали при установке сервера.
После входа вы увидите домашнюю страницу администраторской консоли в окне браузера.
@@ -159,7 +159,7 @@
Вкладка "Домен" диспетчера серверов позволяет просматривать и изменять имя пользователя и пароль.
-[start=2]
+
. Выберите "Активировать JPA 2". Выберите "Close" (Закрыть).
Когда вы выберете команду "Активировать JPA 2", IDE изменит путь класса сервера WebLogic для добавления файлов с целью активации поддержки JPA 2.
@@ -170,16 +170,16 @@
* link:http://forums.oracle.com/forums/thread.jspa?threadID=1112476[+Дискуссионный форум OTN: 11g Release 1 Patch Set 3 (WLS 10.3.4) +]
* link:http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic[+Запуск JPA 2.0 API на WebLogic 10.3+]
-[start=3]
+
. Откройте администраторскую консоль сервера Oracle WebLogic в браузере и войдите в систему.
-[start=4]
+
. Выберите команду *Домен* в разделе "Конфигурации домена" администраторской консоли.
-[start=5]
+
. Нажмите вкладку *JPA* в разделе "Конфигурация".
-[start=6]
+
. Выберите команду *TopLink* в раскрывающемся списке "Поставщик JPA по умолчанию". Нажмите кнопку "Сохранить".
image::images/admin-console-jpa.png[title="Вкладка 'JPA' консоли администрирования сервера Oracle WebLogic"]
@@ -209,10 +209,10 @@
image::images/new-project-ee6.png[title="В мастере создания проектов выбран Weblogic "]
-[start=7]
+
. Выберите платформу JavaServer Faces.
-[start=8]
+
. В списке 'Серверная библиотека' выберите JSF 2.x. Нажмите кнопку "Завершить".
image::images/projectwizard-serverlib.png[title="Панель 'Платформы' мастера создания проектов"]
@@ -292,7 +292,7 @@
Когда вы нажмете кнопку ОК, IDE создаст примерную базу данных и заполнит ее таблицы. Если вы расширите узел сервера MySQL, то увидите, что теперь список баз данных содержит новую базу данных ``sample`` .
-[start=5]
+
. Разверните узел сервера MySQL и щелкните правой кнопкой мыши образец базы данных и выберите 'Подключение'.
Когда вы нажмете кнопку "Подключиться", в узле "Базы данных" появится узел для подключения. Вы можете расширить узел для просмотра таблиц базы данных.
@@ -367,7 +367,7 @@
Мастер содержит таблицу ``customer`` и связанные с ней в разделе "Выделенные таблицы".
-[start=5]
+
. Введите *ejb* как пакет для сгенерированных классов. Нажмите кнопку "Завершить".
Когда вы нажмете кнопку "Готово", среда IDE сгенерирует классы сущностей для каждой из выделенных таблиц. Вы можете расширить узел исходного пакета ``ejb`` для просмотра генерированных классов сущностей.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_zh_CN.asciidoc
index d0e2b70..8ed1669 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf-jpa-weblogic_zh_CN.asciidoc
@@ -69,7 +69,7 @@
请务必记下用户名和口令。
-[start=3]
+
. 创建一个 WebLogic 域。
您可以使用 link:http://download.oracle.com/docs/cd/E17904_01/web.1111/e14140/newdom.htm#i1073602[+WebLogic 配置向导的图形模式+]来帮助创建域。
@@ -94,10 +94,10 @@
IDE 将自动识别服务器实例的域。
-[start=5]
+
. 键入该域的用户名和口令。
-[start=6]
+
. 启用 JPA 2.0(仅限 WebLogic Server 10.3.4 或 10.3.5)。单击 "Finish"(完成)。
*注:*如果注册 WebLogic Server 12c (12.1.1.0) 的实例,则不需要启用 JPA 2.0,因为默认情况下会启用 JPA 2.0。如果注册 WebLogic Server 11g Rel 1(10.3.4 或 10.3.5)的实例,则可在注册服务器时或在注册服务器后在服务器管理器中启用 JPA 2.0。有关更多详细信息,请参见下面的<<01e,在 Oracle WebLogic Server 11g 上启用 JPA 2.0 支持>>部分。
@@ -126,13 +126,13 @@
如果未显示该标签,您可以右键单击 "Oracle WebLogic Server" 节点,然后选择 "View Server Log"(查看服务器日志)。
-[start=2]
+
. 右键单击 "Oracle WebLogic Server" 节点,然后选择 "View Admin Console"(查看管理控制台)。
在选择 "View Admin Console"(查看管理控制台)时,将在浏览器中打开服务器的登录屏幕。
-[start=3]
+
. 使用在安装服务器时指定的用户名和口令进行登录。
在登录后,将在浏览器中看到管理控制台主页。
@@ -159,7 +159,7 @@
在服务器管理器的 "Domain"(域)标签中,您可以查看和修改用户名和口令。
-[start=2]
+
. 单击 "Enable JPA 2"(启用 JPA 2)。单击 "Close"(关闭)。
添加 "Enable JPA 2"(启用 JPA 2)时,IDE 将修改 WebLogic Server 类路径来添加文件,从而启用 JPA 2 支持。
@@ -170,16 +170,16 @@
* link:http://forums.oracle.com/forums/thread.jspa?threadID=1112476[+OTN 论坛:11g Release 1 Patch Set 3 (WLS 10.3.4)+]
* link:http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic[+在 WebLogic 10.3 中运行 JPA 2.0 API+]
-[start=3]
+
. 在浏览器中打开 Oracle WebLogic Server 管理控制台并登录。
-[start=4]
+
. 在管理控制台的 "Domain Configurations"(域配置)部分下面,单击 *Domain*(域)。
-[start=5]
+
. 在 "Configuration"(配置)标签下单击 *JPA* 标签。
-[start=6]
+
. 在 "Default JPA Provider"(默认 JPA 提供器)下拉列表中选择 *TopLink*。单击 "Save"(保存)。
image::images/admin-console-jpa.png[title="Oracle WebLogic Server 管理控制台中的 "JPA" 标签"]
@@ -209,10 +209,10 @@
image::images/new-project-ee6.png[title="新建项目向导中选择的 Weblogic"]
-[start=7]
+
. 选择 "JavaServer Faces" 框架。
-[start=8]
+
. 从 "Server Library"(服务器库)下拉列表中选择 "JSF 2.x"。单击 "Finish"(完成)。
image::images/projectwizard-serverlib.png[title="新建项目向导的 "Frameworks"(框架)面板"]
@@ -292,7 +292,7 @@
在单击 "OK"(确定)后,IDE 将创建 sample 数据库并填充数据库表。如果展开 "MySQL server"(MySQL 服务器)节点,则可以看到数据库列表现在包含新的 ``sample`` 数据库。
-[start=5]
+
. 展开 "MySQL server"(MySQL 服务器)节点,右键单击 sample 数据库,然后选择 "Connect"(连接)。
在单击 "Connect"(连接)后,将在 "Databases"(数据库)节点下面显示该数据库的数据库连接节点。您可以展开该节点以查看数据库表。
@@ -367,7 +367,7 @@
该向导将在 "Selected Tables"(选定的表)下面列出 ``customer`` 表和相关的表。
-[start=5]
+
. 键入 *ejb* 作为生成的类的包。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将为每个选定的表生成实体类。您可以展开 ``ejb`` 源包节点以查看生成的实体类。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud.asciidoc
index 5e6ad91..795834b 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud.asciidoc
@@ -116,7 +116,7 @@
image::images/run-sql-script.png[title="Open SQL files in the IDE's editor"]
-[start=7]
+
. Make sure that the `consult` database is selected in the Connection drop-down list in the SQL editor toolbar, then click the Run SQL ( image:images/run-sql-btn.png[] ) button.
When you click Run SQL, the following output appears in the Output window.
@@ -211,18 +211,18 @@
image::images/create-datasource.png[title="Specify a JNDI name and database connection to create a datasource"]
-[start=4]
+
. Click OK to close the dialog box and return to the wizard. The tables in the `consult` database appear in the Available Tables listbox.
-[start=5]
+
. Click the Add All button to select all tables contained in the database. Click Next.
image::images/new-entities-wizard.png[]
-[start=6]
+
. Type `jpa.entities` as the Package name.
-[start=7]
+
. Confirm that the checkboxes to generate named queries and create a persistence unit are selected. Click Finish.
When you click Finish, the IDE generates the entity classes in the `jpa.entities` package of the project.
@@ -262,20 +262,20 @@
The Available Entity Classes box lists the seven entity classes contained in the project. The box does not list the embeddable classes (`ClientPK.java` and `ProjectPK.java`).
-[start=2]
+
. Click Add All to move all the classes to the Selected Entity Classes box.
image::images/newjsf-wizard.png[title="New JSF Pages from Entity Classes wizard displays all entity classes contained in project"]
Click Next.
-[start=3]
+
. In Step 3 of the wizard, Generate JSF Pages and Classes, type `jpa.session` for the JPA Session Bean Package.
-[start=4]
+
. Type `jsf` for the JSF Classes Package.
-[start=5]
+
. Enter '`/resources/Bundle`' into the Localization Bundle Name field. This will generate a package named `resources` which the `Bundle.properties` file will reside in. (If you leave this blank, the properties bundle will be created in the project's default package.)
image::images/newjsf-wizard2.png[title="Specify package and folder names for generated files"]
@@ -287,7 +287,7 @@
In general, you can access and make changes to all templates maintained by the IDE using the Template Manager (Tools > Templates).
-[start=6]
+
. Click Finish. The IDE generates the stateless session beans in the `jpa.session` package, and the JSF session-scoped, managed beans in the `jsf` package. Each stateless session bean handles the operations for the corresponding entity class, including creating, editing, and destroying instances of the entity class via the Java Persistence API. Each JSF managed bean implements the `javax.faces.convert.Converter` interface and performs the work of converting instances of the corresponding entity class to `String` objects and vice versa.
If you expand the Web Pages node, you can see that the IDE generated a folder for each of the entity classes. Each folder contains the files `Create.xhtml`, `Edit.xhtml`, `List.xhtml` and `View.xhtml`. The IDE also modified the `index.xhtml` file by inserting links to each of the `List.xhtml` pages.
@@ -386,7 +386,7 @@
</h:body>
----
-[start=2]
+
. Click the '`Show All Consultant Items`' link. Looking at the code above, you can see that the target page is `/consultant/List.xhtml`. (In JSF 2.x, the file extension is inferred due to implicit navigation.)
image::images/empty-consultants-list.png[title="Consultants table is currently empty"]
@@ -413,10 +413,10 @@
Either right-click in the editor and choose Run Statement, or click the Run SQL ( image:images/run-sql-btn.png[] ) button. You can see the result of the script execution in the Output window.
-[start=3]
+
. Restart the GlassFish server. This is a necessary step to enable the server to reload and cache the new data contained in the `consult` database. To do so, click the GlassFish server tab in the Output window (The GlassFish server tab displays the server log.), then click the Restart Server ( image:images/glassfish-restart.png[] ) button in the left margin. The server stops, then restarts.
-[start=4]
+
. Run the project again and click the '`Show All Consultant Items`' link. You will see that the list is no longer empty.
[.feature]
--
@@ -461,7 +461,7 @@
To display line numbers, right-click in the editor's left margin and choose Show Line Numbers.
-[start=2]
+
. Use the IDE's Go to File dialog to open `template.xhtml`. Press Alt-Shift-O (Ctrl-Shift-O on Mac), then begin typing `template`.
image::images/go-to-file.png[title="Use the Go to File dialog to quickly open project files"]
@@ -469,7 +469,7 @@
Click OK (or press Enter).
-[start=3]
+
. The template applies the `<ui:insert>` tags to insert content from other files into its title and body. Place your cursor on the `<ui:insert>` tag, then press Ctrl-Space to invoke a documentation popup window.
image::images/doc-popup.png[title="Press Ctrl-Space to invoke a documentation popup on Facelets tags"]
@@ -477,10 +477,10 @@
You can press Ctrl-Space on JSF tags and their attributes to invoke a documentation pop-up. The documentation you see is taken from the descriptions provided in the official link:http://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/index.html[+JSF Tag Library Documentation+].
-[start=4]
+
. Switch back to the `List.xhtml` file (press Ctrl-Tab). The `<ui:define>` tags are used to define the content that will be applied to the template's title and body. This pattern is used for all four Facelets files (`Create.xhtml`, `Edit.xhtml`, `List.xhtml`, and `View.xhtml`) generated for each entity class.
-[start=5]
+
. Place your cursor on any of the EL expressions used for localized messages contained in the `Bundle.properties` file. Press Ctrl-Space to view the localized message.
[.feature]
--
@@ -492,7 +492,7 @@
In the above image, you can see that the EL expression resolves to '`List`', which is applied to the template title and can be verified from the page rendered in the browser.
-[start=6]
+
. Scroll to the bottom of the file and locate the code for the `Create New Consultant` link (Line 92). This is as follows:
[source,java]
@@ -501,7 +501,7 @@
<h:commandLink action="#{consultantController.prepareCreate}" value="#{bundle.ListConsultantCreateLink}"/>
----
-[start=7]
+
. Press Ctrl-Space on the `commandLink`'s `action` attribute to invoke the documentation pop-up.
The `action` attribute indicates the method that handles the request when the link is clicked in the browser. The following documentation is provided:
@@ -509,22 +509,22 @@
_MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application._
In other words, the `action` value typically refers to a method in a JSF managed bean that evaluates to a `String`. The string is then used by JSF's `NavigationHandler` to forward the request to the appropriate view. You verify this in the following steps.
-[start=8]
+
. Place your cursor on `consultantController` and press Ctrl-Space. The editor's code completion indicates that `consultantController` is a JSF managed bean.
image::images/code-completion-managed-bean.png[title="Code completion is provided for JSF managed beans"]
-[start=9]
+
. Move your cursor to `prepareCreate` and press Ctrl-Space. Code completion lists methods contained in the `ConsultantController` managed bean.
image::images/code-completion-properties.png[title="Code completion is provided for class methods"]
-[start=10]
+
. Press Ctrl (⌘ on Mac), then hover your mouse over `prepareCreate`. A link is formed, enabling you to navigate directly to the `prepareCreate()` method in the `ConsultantController` managed bean.
image::images/editor-navigation.png[title="Use editor navigation to quickly navigate source code"]
-[start=11]
+
. Click the link and view the `prepareCreate()` method (displayed below).
[source,java]
@@ -567,7 +567,7 @@
|StatusId |---
|===
-[start=3]
+
. Click Save. When you do so, a validation error is flagged for the `StatusId` field.
image::images/create-new-consultant.png[title="Enter sample data into the form"]
@@ -578,12 +578,12 @@
image::images/consultant-fk.png[title="Examine foreign key attributes in the Services window"]
-[start=4]
+
. To overcome the validation error, select `entity.ConsultantStatus[statusId=A]` from the `StatusId` drop-down list.
*Note: *You can leave the `RecruiterId` field blank. As indicated in the <<er-diagram,database entity-relationship diagram>>, there is a nullable, one-to-many relationship between the `CONSULTANT` and `RECRUITER` tables, meaning that entries in `CONSULTANT` do not need to be associated with a `RECRUITER` entry.
-[start=5]
+
. Click Save. A message displays, indicating that the consultant entry was successfully saved. If you click `Show All Consultant Items`, you'll see the new entry listed in the table.
In general, the generated Facelets pages provide errors for user input that introduces:
@@ -619,17 +619,17 @@
</h:panelGrid>
----
-[start=2]
+
. Examine the `value` applied to the `<f:selectItems>` tag. The `value` attribute determines the text that displays for each item in the drop-down list.
Press Ctrl-Space on `itemsAvailableSelectOne`. The editor's code completion indicates that the `ConsultantStatusController`'s `getItemsAvailableSelectOne()` method returns an array of `SelectItem` objects.
image::images/code-completion-returned-object.png[title="Code completion displays returned classes for methods"]
-[start=3]
+
. Press Ctrl (⌘ on Mac), then hover your mouse over `itemsAvailableSelectOne`. A link is formed, enabling you to navigate directly to the `getItemsAvailableSelectOne()` method in the `ConsultantStatus` entity's source code. Click this link.
-[start=4]
+
. Place your cursor on the `SelectItem[]` return value in the method signature, and press Ctrl-Space to invoke the documentation pop-up.
image::images/documentation-select-item.png[title="Press Ctrl-Space to invoke documentation support"]
@@ -638,14 +638,14 @@
As you can see, the `SelectItem` class belongs to the JSF framework. The `UISelectOne` component, as mentioned in the documentation, is represented by the `<h:selectOneMenu>` tag from the markup which you examined in <<markup,Step 1>> above.
-[start=5]
+
. Press Ctrl (⌘ on Mac), then hover your mouse over `findAll()`. A pop-up appears, displaying the method signature.
image::images/method-signature.png[title="View pop-ups of method signatures in the editor"]
You can see that here `ejbFacade.findAll()` returns a `List` of `ConsultantStatus` objects.
-[start=6]
+
. Navigate to `JsfUtil.getSelectItems`. Hover your mouse over `getSelectItems` and press Ctrl (⌘ on Mac), then click the link that displays.
*Note: *Recall that `JsfUtil` is one of the utility classes that was generated when you completed the <<jsfPagesEntityClasses,JSF Pages from Entity Classes wizard>>.
@@ -675,7 +675,7 @@
Now that you have verified that the entity `toString()` method is what is rendered in the browser when you view items in a drop-down list, modify the `ConsultantStatus` `toString()` method.
-[start=7]
+
. Open the `ConsultantStatus` entity class in the editor. Modify the `toString` method to return the `statusId` and `description`. These are entity properties which correspond to the two columns of the `CONSULTANT_STATUS` table.
[source,java]
@@ -686,7 +686,7 @@
}
----
-[start=8]
+
. Run the project again. When the browser displays the welcome page, click the `Show All Consultant Items` link, then click `Create New Consultant`.
Inspect the `StatusId` drop-down. You'll see that it now displays the status ID and description for the one record contained in the database's `CONSULTANT_STATUS` table.
@@ -761,10 +761,10 @@
You will use the property values that are specified in `glassfish-resources.xml` when you create the JDBC resource and connection pool.
-[start=2]
+
. Right-click the GlassFish Server node in the Services window and choose Open Domain Admin Console in the popup menu to open the GlassFish Console in your browser.
-[start=3]
+
. In the Common Tasks navigation panel of the GlassFish Console, expand the *JDBC* node and the *JDBC Resources* and *JDBC Connection Pools* nodes.
[.feature]
--
@@ -776,15 +776,15 @@
You can see the JDBC resources that are currently registered with the server. You will need to create `jdbc/consult` and `consultPool` if they are not listed under the JDBC node in the Common Tasks navigation panel. Some JDBC resources were created by default when you installed the server and are displayed as sub-nodes.
-[start=4]
+
. Click the *JDBC Connection Pools* node and click New in the New JDBC Connection Pool pane.
image::images/gf-new-jdbc-pool1.png[title="New JDBC Connection Pool pane in the GlassFish Admin Console"]
-[start=5]
+
. Type *consultPool* as the Pool Name, select *javax.sql.ConnectionPoolDataSource* as the Resource Type and select *MySql* as the Database Driver Vendor. Click Next.
-[start=6]
+
. In Step 2, locate and specify the values for the *URL*, *username* and *password* properties. Click Finish.
image::images/gf-new-jdbc-pool2.png[title="New JDBC Connection Pool panel in the GlassFish Admin Console"]
@@ -794,10 +794,10 @@
The new connection pool is created on the server when you click Finish and a node for the connection pool is displayed under the JDBC Connection Pools node.
-[start=7]
+
. Click the *JDBC Resources* node in the Common Tasks navigation panel and click New.
-[start=8]
+
. Type *jdbc/consult* for the JNDI Name and select *consultPool* in the Pool Name drop-down list. Click OK.
image::images/gf-new-jdbc-resource.png[title="New JDBC Resource pane in the GlassFish Admin Console"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ja.asciidoc
index 7e86567..a80b06e 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ja.asciidoc
@@ -116,7 +116,7 @@
image::images/run-sql-script.png[title="IDEのエディタ内でSQLファイルを開く"]
-[start=7]
+
. SQLエディタ・ツールバーの「接続」ドロップダウン・リストで`consult`データベースが選択されていることを確認し、「SQLの実行」(image:images/run-sql-btn.png[])ボタンをクリックします。
「SQLの実行」をクリックすると、「出力」ウィンドウに次の出力が表示されます。
@@ -211,18 +211,18 @@
image::images/create-datasource.png[title="データソースを作成するためのJNDI名およびデータベース接続の指定"]
-[start=4]
+
. 「OK」をクリックしてダイアログ・ボックスを閉じ、ウィザードに戻ります。`consult`データベース内の表が「使用可能な表」リスト・ボックスに表示されます。
-[start=5]
+
. 「すべてを追加」ボタンをクリックし、データベースに格納されているすべての表を選択します。「次」をクリックします。
image::images/new-entities-wizard.png[]
-[start=6]
+
. 「パッケージ」名に「`jpa.entities`」と入力します。
-[start=7]
+
. 名前付き問合せを生成するためのチェックボックスと持続性ユニットを作成するためのチェックボックスが選択されていることを確認します。「終了」をクリックします。
「終了」をクリックすると、IDEは、プロジェクトの`jpa.entities`パッケージにエンティティ・クラスを生成します。
@@ -262,20 +262,20 @@
「利用可能なエンティティ・クラス」ボックスに、プロジェクトに含まれる7つのエンティティ・クラスが一覧表示されます。このボックスには、組込み可能なクラス(`ClientPK.java`と`ProjectPK.java`)は一覧表示されません。
-[start=2]
+
. 「すべてを追加」をクリックして、すべてのクラスを「選択されているエンティティ・クラス」ボックスに移動します。
image::images/newjsf-wizard.png[title="プロジェクトに含まれるすべてのエンティティ・クラスが表示された「新規エンティティからのJSFページ・クラス」ウィザード"]
「次」をクリックします。
-[start=3]
+
. ウィザードのステップ3の「生成されたJSFページとクラス」で、「JPAセッションBeanパッケージ」に「`jpa.session`」と入力します。
-[start=4]
+
. 「JSFクラス・パッケージ」に「`jsf`」と入力します。
-[start=5]
+
. 「ローカリゼーション・バンドル名」フィールドに「`/resources/Bundle`」と入力します。これにより、`resources`という名前のパッケージが生成され、これに`Bundle.properties`ファイルが属します。ここを空白のままにした場合、プロパティ・バンドルはプロジェクトのデフォルトのパッケージ内に作成されます。
image::images/newjsf-wizard2.png[title="生成されたファイルに対するパッケージ名とフォルダ名の指定"]
@@ -287,7 +287,7 @@
一般に、IDEで管理されるすべてのテンプレートには、「テンプレート・マネージャ」(「ツール」>「テンプレート」)を使用してアクセスし、変更を加えることができます。
-[start=6]
+
. 「終了」をクリックします。ステートレス・セッションBeanが`jpa.session`パッケージ内に生成され、JSFセッション・スコープ指定管理対象Beanが`jsf`パッケージ内に生成されます。各ステートレス・セッションBeanは、対応するエンティティ・クラスの操作を処理します。これには、Java Persistence APIを経由したエンティティ・クラスのインスタンスの作成、編集および破棄が含まれます。各JSF管理対象Beanは、`javax.faces.convert.Converter`インタフェースを実装し、対応するエンティティ・クラスのインスタンスと`String`型オブジェクトの間の変換作業を行います。
「Webページ」ノードを展開すると、エンティティ・クラスごとにフォルダが生成されたことがわかります。各フォルダには、`Create.xhtml`、`Edit.xhtml`、`List.xhtml`および`View.xhtml`ファイルが格納されます。`index.xhtml`ファイルも変更され、各`List.xhtml`ページへのリンクが挿入されます。
@@ -386,7 +386,7 @@
</h:body>
----
-[start=2]
+
. 「`Show All Consultant Items`」リンクをクリックします。前出のコードを参照すると、ターゲット・ページが`/consultant/List.xhtml`であることがわかります。(JSF 2.xでは、ファイル拡張子は暗黙のナビゲーションによって推定されます。)
image::images/empty-consultants-list.png[title="コンサルタント表は現在空"]
@@ -413,10 +413,10 @@
エディタ内を右クリックして「文の実行」を選択するか、「SQLの実行」(image:images/run-sql-btn.png[])ボタンをクリックします。スクリプトの実行結果は「出力」ウィンドウで確認できます。
-[start=3]
+
. GlassFishサーバーを再起動します。`consult`データベースに含まれる新しいデータをサーバーが再ロードしたり、キャッシュに保存できるようにするには、このステップが必要となります。そのためには、「出力」ウィンドウのGlassFishサーバーのタブ(GlassFishサーバーのタブにはサーバーのログが表示される)をクリックし、左マージンにある「サーバーを再起動」(image:images/glassfish-restart.png[])ボタンをクリックします。サーバーが停止し、再起動します。
-[start=4]
+
. プロジェクトを再度実行し、「`Show All Consultant Items`」リンクをクリックします。リストが空でなくなっていることがわかります。
[.feature]
--
@@ -459,7 +459,7 @@
行番号を表示するには、エディタの左マージンを右クリックし、「行番号を表示」を選択します。
-[start=2]
+
. IDEの「ファイル」ダイアログを使用し、`template.xhtml`を開きます。[Alt]-[Shift]-[O] (Macの場合は[Ctrl]-[Shift]-[O])を押して、「`template`」と入力します。
image::images/go-to-file.png[title="「ファイルに移動」ダイアログを使用してプロジェクト・ファイルを速やかに開く"]
@@ -467,7 +467,7 @@
「OK」をクリックするか、[Enter]を押します。
-[start=3]
+
. このテンプレートは、他のファイルからタイトルと本体に内容を挿入するための`<ui:insert>`タグを適用します。`<ui:insert>`タグの上にカーソルを置いて、[Ctrl]-[Space]を押し、ドキュメント・ポップアップ・ウィンドウを呼び出します。
image::images/doc-popup.png[title="[Ctrl]-[Space]の押下による、Faceletsタグでのドキュメント・ポップアップの呼出し"]
@@ -475,10 +475,10 @@
JSFタグおよびその属性上で[Ctrl]-[Space]を押すと、ドキュメント・ポップアップを呼出しできます。表示されるドキュメントは、公式のlink:http://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/index.html[+JSFタグ・ライブラリ・ドキュメント+]で提供されている説明から取得したものです。
-[start=4]
+
. `List.xhtml`ファイルに戻ります([Ctrl]-[Tab]を押します)。`<ui:define>`タグは、テンプレートのタイトルと本体に適用する内容を定義するために使用されます。このパターンは、各エンティティ・クラスに対して生成される4つのFaceletsファイル(`Create.xhtml`、`Edit.xhtml`、`List.xhtml`、および`View.xhtml`)すべてに使用されます。
-[start=5]
+
. `Bundle.properties`ファイルに含まれる、ローカライズされたメッセージに使用される任意のEL式にカーソルを置きます。[Ctrl]-[Space]を押してローカライズされたメッセージを表示します。
[.feature]
--
@@ -488,7 +488,7 @@
前出のイメージに、「`List`」を解決するEL式が表示されています。これは、テンプレートのタイトルに適用され、ブラウザにレンダリングされるページから確認できます。
-[start=6]
+
. ファイルの最下部にスクロールし、92行目にある「`Create New Consultant`」リンクのコードに移動します。この内容は次のとおりです。
[source,java]
@@ -497,7 +497,7 @@
<h:commandLink action="#{consultantController.prepareCreate}" value="#{bundle.ListConsultantCreateLink}"/>
----
-[start=7]
+
. `commandLink`の`action`属性の上で[Ctrl]-[Space]を押し、ドキュメント・ポップアップを呼び出します。
`action`属性は、ブラウザ内でリンクがクリックされた際のリクエストを処理するメソッドを示します。次のドキュメントが表示されます。
@@ -505,22 +505,22 @@
_ユーザーがこのコンポーネントをアクティブ化したときに起動するアプリケーション・アクションを表すメソッド式。この式は、パラメータを取得せず、オブジェクト(論理的な結果を取得するためにコールされるtoString()オブジェクト)を返すpublicメソッドに評価される必要があり、このオブジェクトはこのアプリケーションのNavigationHandlerに渡されます。_
つまり、`action`値は通常、`String`型として評価されるJSF管理対象Bean内のメソッドを参照します。この文字列は、リクエストを適切なビューに転送するため、JSFの`NavigationHandler`に使用されます。これは次の手順で確認します。
-[start=8]
+
. カーソルを`consultantController`の上に置き、[Ctrl]-[Space]を押します。エディタのコード補完で、`consultantController`がJSF管理対象Beanであることが示されます。
image::images/code-completion-managed-bean.png[title="JSF管理対象Beanに対して提供されるコード補完"]
-[start=9]
+
. カーソルを`prepareCreate`に移動し、[Ctrl]-[Space]を押します。コード補完によって、`ConsultantController`管理対象Bean内に格納されたメソッドの一覧が表示されます。
image::images/code-completion-properties.png[title="クラス・メソッドに対して提供されるコード補完"]
-[start=10]
+
. [Ctrl] (Macの場合は[⌘])を押し、マウスを`prepareCreate`の上に移動します。リンクが形成され、このリンクを使用して`ConsultantController`管理対象Bean内の`prepareCreate()`メソッドに直接移動できます。
image::images/editor-navigation.png[title="エディタのナビゲーションを使用した、ソース・コードへの速やかな移動"]
-[start=11]
+
. リンクをクリックし、次に示す`prepareCreate()`メソッドを表示します。
[source,java]
@@ -563,7 +563,7 @@
|StatusId |---
|===
-[start=3]
+
. 「保存」をクリックします。これを実行すると、`StatusId`フィールドに検証エラーのフラグが表示されます。
image::images/create-new-consultant.png[title="フォームへのサンプル・データの入力"]
@@ -574,12 +574,12 @@
image::images/consultant-fk.png[title="「サービス」ウィンドウでの外部キー属性の調査"]
-[start=4]
+
. 検証エラーを解決するには、「`StatusId`」ドロップダウン・リストから「`entity.ConsultantStatus[statusId=A]`」を選択します。
*注意:* `RecruiterId`フィールドは空白のままでかまいません。<<er-diagram,データベースのエンティティ関係図>>に示すとおり、`CONSULTANT`表と`RECRUITER`表との間には、null可能な1対多の関係があります。これは、`CONSULTANT`内のエントリは`RECRUITER`エントリと関連付ける必要がないということです。
-[start=5]
+
. 「保存」をクリックします。consultantのエントリが正常に保存されたことを示すメッセージが表示されます。「`Show All Consultant Items`」をクリックすると、表にリストされた新規エントリが表示されます。
一般に、生成されたFaceletsページには、次のことが発生するユーザー入力に対してエラーを表示します。
@@ -615,17 +615,17 @@
</h:panelGrid>
----
-[start=2]
+
. `<f:selectItems>`タグに適用される`value`を確認します。`value`属性は、ドロップダウン・リストの各項目に表示するテキストを決定します。
`itemsAvailableSelectOne`上で[Ctrl]-[Space]を押します。エディタのコード補完に、`ConsultantStatusController`の`getItemsAvailableSelectOne()`メソッドが`SelectItem`オブジェクトの配列を返すことが示されます。
image::images/code-completion-returned-object.png[title="メソッドに対して返されるクラスが表示されたコード補完"]
-[start=3]
+
. [Ctrl] (Macの場合は[⌘])を押し、マウスを`itemsAvailableSelectOne`の上に移動します。リンクが形成され、このリンクを使用して`ConsultantStatus`エンティティのソース・コード内の`getItemsAvailableSelectOne()`メソッドに直接移動できます。リンクをクリックします。
-[start=4]
+
. メソッド署名内の`SelectItem[]`戻り値の上にカーソルを置き、[Ctrl]-[Space]を押してドキュメント・ポップアップを呼び出します。
image::images/documentation-select-item.png[title="[Ctrl]-[Space]の押下によるドキュメント・サポートの呼出し"]
@@ -634,14 +634,14 @@
表示されるように、`SelectItem`クラスはJSFフレームワークに属しています。このドキュメントにあるように、`UISelectOne`コンポーネントは、前出の<<markup,ステップ1>>で調べたマークアップからの`<h:selectOneMenu>`タグによって表現されます。
-[start=5]
+
. [Ctrl] (Macの場合は[⌘])を押し、マウスを`findAll()`の上に移動します。ポップアップが表示され、メソッド署名が示されます。
image::images/method-signature.png[title="エディタでのメソッド署名のポップアップの表示"]
ここで、`ejbFacade.findAll()`が`ConsultantStatus`オブジェクトの`List`を返すことが確認できます。
-[start=6]
+
. `JsfUtil.getSelectItems`に移動します。マウスを`getSelectItems`の上に移動し、[Ctrl] (Macの場合は[⌘])を押し、表示されるリンクをクリックします。
*注意:* `JsfUtil`は、<<jsfPagesEntityClasses,エンティティからのJSFページ・クラス・ウィザード>>の完了時に生成されたユーティリティ・クラスの1つであることを思い出してください。
@@ -671,7 +671,7 @@
これで、ドロップダウン・リストに項目を表示するときにブラウザにレンダリングされるのがエンティティの`toString()`メソッドであることを確認したので、`ConsultantStatus``toString()`メソッドを変更します。
-[start=7]
+
. エディタで`ConsultantStatus`エンティティ・クラスを開きます。`statusId`および`description`を返すように、`toString`メソッドを変更します。これらは、`CONSULTANT_STATUS`表の2つの列に対応するエンティティ・プロパティです。
[source,java]
@@ -682,7 +682,7 @@
}
----
-[start=8]
+
. プロジェクトを再実行します。ブラウザに開始ページが表示されたら、「`Show All Consultant Items`」リンクをクリックし、「`Create New Consultant`」をクリックします。
「`StatusId`」ドロップダウン・リストを確認します。これで、データベースの`CONSULTANT_STATUS`表に格納されている、あるレコードについてのステータスIDと説明が表示されるようになりました。
@@ -757,10 +757,10 @@
JDBCリソースと接続プールを作成する際は、`glassfish-resources.xml`で指定されているプロパティ値を使用します。
-[start=2]
+
. 「サービス」ウィンドウで「GlassFish Server」ノードを右クリックし、ポップアップ・メニューで「ドメイン管理コンソールを開く」を選択して、ブラウザでGlassFishコンソールを開きます。
-[start=3]
+
. GlassFishコンソールの共通タスク・ナビゲーション・パネルで、*「JDBC」*ノードおよび*「JDBCリソース」*および*「JDBC接続プール」*ノードを展開します。
[.feature]
--
@@ -772,15 +772,15 @@
現在サーバーに登録されているDBCリソースを確認できます。`jdbc/consult`と`consultPool`が共通タスク・ナビゲーション・パネルの「JDBC」ノードの下に表示されていない場合は、これらを作成する必要があります。一部のJDBCリソースは、サーバーのインストール時にデフォルトで作成されており、これらはサブノードとして表示されます。
-[start=4]
+
. *「JDBC接続プール」*ノードをクリックし、新規のJDBC接続プール・ペインで「新規」をクリックします。
image::images/gf-new-jdbc-pool1.png[title="GlassFish管理コンソールの新規のJDBC接続プール・ペイン"]
-[start=5]
+
. プール名として*consultPool*を入力し、リソース・タイプとして*javax.sql.ConnectionPoolDataSource*を選択し、データベース・ドライバ・ベンダーとして*MySql*を選択します。「次」をクリックします。
-[start=6]
+
. 手順2で、*URL*、*username*および*password*プロパティの値を検索して指定します。「終了」をクリックします。
image::images/gf-new-jdbc-pool2.png[title="GlassFish管理コンソールの新規のJDBC接続プール・パネル"]
@@ -790,10 +790,10 @@
「終了」をクリックするとサーバー上に新規の接続プールが作成され、「JDBC接続プール」ノードの下にその接続プールのノードが表示されます。
-[start=7]
+
. 共通タスク・ナビゲーション・パネルで*「JDBCリソース」*をクリックして、「新規」をクリックします。
-[start=8]
+
. JNDI名に*jdbc/consult*と入力し、「プール名」ドロップダウン・リストで*consultPool*を選択します。「OK」をクリックします。
image::images/gf-new-jdbc-resource.png[title="GlassFish管理コンソールの新規のJDBCリソース・ペイン"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_pt_BR.asciidoc
index b88e69a..e87b41c 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_pt_BR.asciidoc
@@ -121,7 +121,7 @@
image::images/run-sql-script.png[title="Abrir arquivos SQL no editor do IDE"]
-[start=7]
+
. Certifique-se de que o banco de dados `consult` esteja selecionado na lista drop-down Conexão da barra de ferramentas do editor SQL. Em seguida, clique no botão ( image:images/run-sql-btn.png[] ) Executar SQL.
Quando você clica em Executar SQL, a saída a seguir é exibida na janela de Saída.
@@ -216,18 +216,18 @@
image::images/create-datasource.png[title="Especificar um nome e uma conexão de banco de dados JNDI para criar uma fonte de dados"]
-[start=4]
+
. Clique em OK para fechar a caixa de diálogo e retornar ao assistente. As tabelas no banco de dados `consult` serão exibidas na lista de conteúdo Tabelas Disponíveis.
-[start=5]
+
. Clique no botão Adicionar Tudo para selecionar todas as tabelas contidas no banco de dados. Clique em Próximo.
image::images/new-entities-wizard.png[]
-[start=6]
+
. Digite `jpa.entities` como o nome do Pacote.
-[start=7]
+
. Verifique se as caixas de seleção para gerar as consultas nomeadas e criar uma unidade persistente estão marcadas. Clique em Finalizar.
Quando você clicar em Finalizar, o IDE gerará as classes de entidade no pacote `jpa.entities` do projeto.
@@ -267,20 +267,20 @@
A caixa Classes de Entidade Disponíveis lista as sete classes de entidade contidas no projeto. A caixa não lista as classes incorporadas (`ClientPK.java` e `ProjectPK.java`).
-[start=2]
+
. Clique em Adicionar Tudo para mover todas as classes para a caixa Classes de Entidade Selecionadas.
image::images/newjsf-wizard.png[title="O assistente de Novas Páginas JSF de Classes de Entidade exibe todas as classes de entidade contidas no projeto"]
Clique em Próximo.
-[start=3]
+
. Na etapa 3 do assistente, Gerar Classes e Páginas JSF, digite `jpa.session` no Pacote de Bean de Sessão JPA.
-[start=4]
+
. Digite `jsf` para o Pacote de Classes JSF.
-[start=5]
+
. Digite '`/resources/Bundle`' no campo Nome do Pacote de Localização. Isso gerará um pacote com o nome `resources` no qual o arquivo `Bundle.properties` residirá. (Se deixá-lo em branco, o conjunto de propriedades será criado no pacote default do projeto.)
image::images/newjsf-wizard2.png[title="Especificar pacote e nomes de pastas para os arquivos gerados"]
@@ -292,7 +292,7 @@
Em geral, você pode acessar e fazer alterações em todos os modelos mantidos pelo IDE utilizando o Gerenciador de Modelos (Ferramentas > Modelos).
-[start=6]
+
. Clique em Finalizar. O IDE gera os beans de sessão sem estado no pacote `jpa.session`, e o escopo de sessão e beans gerenciados com JSF no pacote `jsf`. Cada bean de sessão sem estado manipula as operações da classe de entidade correspondente, incluindo a criação, edição e destruição de instâncias da classe de entidade por meio da API de Persistência Java. Cada Bean gerenciado pelo JSF implementa a interface `javax.faces.convert.Converter` e realiza as tarefas de conversão das instâncias da classe de entidade correspondente para objetos `String` e vice-versa.
Se você expandir o nó Páginas Web, você poderá ver que o IDE gerou uma pasta para cada uma das classes de entidade. Cada pasta contém os arquivos `Create.xhtml`, `Edit.xhtml`, `List.xhtml` e `View.xhtml`. O IDE também modificou o arquivo `index.xhtml` inserindo links em cada uma das páginas `List.xhtml`.
@@ -391,7 +391,7 @@
</h:body>
----
-[start=2]
+
. Clique no link '`Mostrar todos os Itens do Consultor`'. Ao observar o código acima, você pode ver que a página de destino é `/consultant/List.xhtml`. (No JSF 2.x, a extensão do arquivo é deduzida devido à navegação implícita.)
image::images/empty-consultants-list.png[title="A tabela Consultores está vazia no momento"]
@@ -418,10 +418,10 @@
Clique com o botão direito do mouse no editor e selecione Executar Instrução ou clique no botão ( image:images/run-sql-btn.png[] ) Executar SQL. É possível ver o resultado da execução do script na janela de Saída.
-[start=3]
+
. Reinicie o GlassFish Server. Essa é uma etapa necessária para ativar o servidor e recarregar e armazenar no cache os novos dados contidos no banco de dados `consult`. Para isso, clique na guia do GlassFish Server na janela de Saída (A guia do GlassFish Server exibirá o log do servidor.), em seguida, clique no botão ( image:images/glassfish-restart.png[] ) Reiniciar Servidor na margem esquerda. O servidor para e, em seguida, reinicia.
-[start=4]
+
. Execute o projeto novamente e clique no link '`Mostrar Todos os Itens do Consultor`'. Você verá que a lista não está mais vazia.
[.feature]
--
@@ -464,7 +464,7 @@
Para exibir os números das linhas, clique com o botão direito do mouse na margem esquerda do editor e selecione Mostrar Números de Linhas.
-[start=2]
+
. Utilize a caixa de diálogo Ir para Arquivo do IDE para abrir o arquivo `template.xhtml`. Pressione Alt-Shift-O (Ctrl-Shift-O no Mac) e, em seguida, digite `modelo`.
image::images/go-to-file.png[title="Utilizar a caixa de diálogo Ir para Arquivo para abrir rapidamente arquivos do projeto"]
@@ -472,7 +472,7 @@
Clique em OK (ou pressione Enter).
-[start=3]
+
. O modelo aplica as tags `<ui:insert>` para inserir o conteúdo de outros arquivos no título e corpo. Coloque o cursor na tag `<ui:insert>` e pressione Ctrl-Espaço para chamar uma janela pop-up de documentação.
image::images/doc-popup.png[title="Pressione Ctrl-Espaço para chamar um pop-up de documentação nas tags de Facelets"]
@@ -480,10 +480,10 @@
É possível pressionar Ctrl-Espaço nas tags JSF e seus atributos para chamar o pop-up da documentação. A documentação exibida é obtida das descrições fornecidas na link:http://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/index.html[+Documentação da Biblioteca de Tags JSF+] Oficial.
-[start=4]
+
. Volte para o arquivo `List.xhtml` (pressione Ctrl-Tab). As tags `<ui:define>` são utilizadas para definir o conteúdo que será aplicado ao título e ao corpo do modelo. Esse padrão é utilizado nos quatro arquivos de Facelets (`Create.xhtml`, `Edit.xhtml`, `List.xhtml` e `View.xhtml`) gerados para cada classe de entidade.
-[start=5]
+
. Coloque seu cursor em qualquer uma das expressões EL utilizadas nas mensagens localizadas contidas no arquivo `Bundle.properties`. Pressione Ctrl-Espaço para exibir a mensagem localizada.
[.feature]
--
@@ -493,7 +493,7 @@
Na imagem acima, você pode ver que a expressão EL é determinada como '`List`', que é aplicada ao título do modelo e pode ser verificada na página renderizada no browser.
-[start=6]
+
. Navegue até a parte inferior do arquivo e localize o código do link `Criar novo consultor` (Linha 92). Trata-se do seguinte:
[source,java]
@@ -502,7 +502,7 @@
<h:commandLink action="#{consultantController.prepareCreate}" value="#{bundle.ListConsultantCreateLink}"/>
----
-[start=7]
+
. Pressione Ctrl-Espaço no atributo `action` do `commandLink` para chamar a janela pop-up da documentação.
O atributo `ação` indica o método que manipula a solicitação quando o link é clicado no browser. A documentação a seguir será fornecida:
@@ -510,22 +510,22 @@
_MethodExpression, que representa a ação da aplicação a qual será chamada quando este componente for ativado pelo usuário. A expressão deve ser interpretada como um método público que não toma nenhum parâmetro e retorna um Object (o toString() do qual é chamado para gerar o resultado lógico) que será passado para o NavigationHandler desta aplicação._
Em outras palavras, o valor de `action` se refere normalmente a um método em um bean gerenciado pelo JSF que é avaliado como uma `String`. Então, a string é utilizada pelo `NavigationHandler` do JSF para encaminhar a solicitação para a view apropriada. É possível verificar isso nas etapas a seguir.
-[start=8]
+
. Coloque o cursor no `consultantController` e pressione Ctrl-Espaço. A funcionalidade autocompletar código do editor indica que `consultantController` é um Bean gerenciado pelo JSF.
image::images/code-completion-managed-bean.png[title="A funcionalidade autocompletar código é fornecida para Beans gerenciados pelo JSF"]
-[start=9]
+
. Mova o cursor para `prepareCreate` e pressione Ctrl-Espaço. A funcionalidade autocompletar código lista os métodos contidos no Bean gerenciado `ConsultantController`.
image::images/code-completion-properties.png[title="A funcionalidade autocompletar código é fornecida para métodos de classe"]
-[start=10]
+
. Pressione Ctrl (&#8984 no Mac) e, em seguida mova o mouse sobre `prepareCreate`. É formado um link, que permite ir diretamente para o método `prepareCreate()` no Bean gerenciado `ConsultantController`.
image::images/editor-navigation.png[title="Utilizar a navegação do editor para ir rapidamente até o código-fonte"]
-[start=11]
+
. Clique no link e exiba o método `prepareCreate()` (exibido a seguir).
[source,java]
@@ -568,7 +568,7 @@
|StatusId |---
|===
-[start=3]
+
. Clique em Salvar. Quando você fizer isso, um erro de validação será sinalizado no campo `StatusId`.
image::images/create-new-consultant.png[title="Informar os dados de amostra no form"]
@@ -579,12 +579,12 @@
image::images/consultant-fk.png[title="Examinar os atributos da chave estrangeira na janela Serviços"]
-[start=4]
+
. Para solucionar o erro de validação, selecione `entity.ConsultantStatus[statusId=A]` na lista drop-down `StatusId`.
*Observação: *Você pode deixar o campo `RecruiterId` em branco. Conforme indicado no <<er-diagram,diagrama de relacionamento com as entidades do banco de dados>>, há um relacionamento que pode ser nulo, um para muitos entre as tabelas `CONSULTANT` e `RECRUITER`, indicando que as entradas em `CONSULTANT` não precisam estar associadas a uma entrada de `RECRUITER`.
-[start=5]
+
. Clique em Salvar. Será exibida uma mensagem indicando que a entrada do consultor foi salva com êxito. Se você clicar em `Exibir Todos os Itens do Consultor`, você verá a nova entrada listada na tabela.
Em geral, as páginas de Facelets geradas produzem erros para entradas do usuário que introduz:
@@ -620,17 +620,17 @@
</h:panelGrid>
----
-[start=2]
+
. Examine o `value` aplicado à tag `<f:selectItems>`. O atributo `value` determina o texto exibido para cada item na lista drop-down.
Pressione Ctrl-Espaço em `itemsAvailableSelectOne`. A funcionalidade autocompletar código do editor indica que o método `getItemsAvailableSelectOne()` do `ConsultantStatusController` retorna um array de objetos `SelectItem`.
image::images/code-completion-returned-object.png[title="A funcionalidade autocompletar código exibe as classes retornadas para os métodos"]
-[start=3]
+
. Pressione Ctrl (&#8984 no Mac) e, em seguida, mova o mouse sobre `itemsAvailableSelectOne`. É formado um link que permite ir diretamente para o método `getItemsAvailableSelectOne()` no código-fonte da entidade `ConsultantStatus`. Clique neste link.
-[start=4]
+
. Coloque o cursor sobre o valor de retorno `SelectItem[]` na assinatura do método e pressione Ctrl-Espaço para chamar a janela pop-up da documentação.
image::images/documentation-select-item.png[title="Pressione Ctrl-Espaço para chamar o suporte à documentação"]
@@ -639,14 +639,14 @@
Como você pode ver, a classe `SelectItem` pertence ao framework JSF. O componente `UISelectOne`, conforme mencionado na documentação, é representado pela tag `<h:selectOneMenu>` da marcação que você examinou na <<markup,Etapa 1>> acima.
-[start=5]
+
. Pressione Ctrl (&#8984 no Mac) e, em seguida, mova o mouse sobre `findAll()`. Uma janela pop-up será exibida com a assinatura do método.
image::images/method-signature.png[title="Exibir pop-ups das assinaturas do método no editor"]
É possível observar que aqui o `ejbFacade.findAll()` retorna uma `Lista` de objetos `ConsultantStatus`.
-[start=6]
+
. Vá para `JsfUtil.getSelectItems`. Coloque o mouse sobre `getSelectItems` e pressione Ctrl (&#8984 no Mac), a seguir, clique no link exibido.
*Observação: *Lembre-se de que `JsfUtil` é uma das classes de utilitário geradas ao concluir o <<jsfPagesEntityClasses,assistente de Páginas JSF de Classes de Entidade>>.
@@ -676,7 +676,7 @@
Agora que você verificou que o método `toString()` da entidade é o método renderizado no browser ao exibir os itens em uma lista drop-down, modifique o método `toString()` do `ConsultantStatus`.
-[start=7]
+
. Abra a classe de entidade `ConsultantStatus` no editor. Modifique o método `toString` para retornar `statusId` e `description`. Trata-se das propriedades da entidade que correspondem às duas colunas da tabela `CONSULTANT_STATUS`.
[source,java]
@@ -687,7 +687,7 @@
}
----
-[start=8]
+
. Execute o projeto novamente. Quando o browser exibir a página de boas-vindas, clique no link `Mostrar Todos os Itens do Consultor` e, em seguida, em `Criar Novo Consultor`.
Inspecione a lista drop-down `StatusId`. Você verá que agora ela exibe o ID de status e a descrição do registro contido na tabela `CONSULTANT_STATUS` do banco de dados.
@@ -762,10 +762,10 @@
Use os valores de propriedade especificados em `glassfish-resources.xml` ao criar o recurso JDBC e o pool de conexões.
-[start=2]
+
. Clique com o botão direito no nó GlassFish Server, na janela Serviços, e escolha Abrir Console Admin do Domínio no menu pop-up para abrir a Console do GlassFish no browser.
-[start=3]
+
. No painel de navegação Tarefas Comuns da Console do GlassFish, expanda o nó *JDBC* e os nós *Recursos JDBC* e *Pool de Conexões JDBC*.
[.feature]
--
@@ -777,15 +777,15 @@
Você pode ver os recursos JDBC que estão registrados atualmente no servidor. Será necessário criar `jdbc/consult` e `consultPool` se não estiverem listados sob o nó JDBC no painel de navegação Tarefas Comuns. Alguns recursos JDBC foram criados por padrão quando você instalou o servidor e são exibidos como subnós.
-[start=4]
+
. Clique no nó *Pools de Conexões JDBC* e clique em Novo no painel Novo Pool de Conexões JDBC.
image::images/gf-new-jdbc-pool1.png[title="Painel Novo Pool de Conexões JDBC na Console Admin do GlassFish"]
-[start=5]
+
. Digite *consultPool* como Nome do Pool, selecione *javax.sql.ConnectionPoolDataSource* como Tipo de Recurso e selecione *MySql* como Fornecedor do Driver de Banco de Dados. Clique em Próximo.
-[start=6]
+
. Na Etapa 2, localize e especifique os valores das propriedades *URL*, *nome do usuário* e *senha*. Clique em Finalizar.
image::images/gf-new-jdbc-pool2.png[title="Painel Novo Pool de Conexões JDBC na Console Admin do GlassFish"]
@@ -795,10 +795,10 @@
O novo pool de conexões é criado no servidor quando você clica em Concluir e um nó do pool de conexões é exibido sob o nó Pools de Conexões JDBC.
-[start=7]
+
. Clique no nó *Recursos JDBC* no painel de navegação Tarefas Comuns e clique em Novo.
-[start=8]
+
. Digite *jdbc/consult* como Nome da JNDI e selecione *consultPool* na lista drop-down Nome do Pool. Clique em OK.
image::images/gf-new-jdbc-resource.png[title="Painel Novo Recurso JDBC na Console Admin do GlassFish"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ru.asciidoc
index 22ac512..4def2db 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_ru.asciidoc
@@ -116,7 +116,7 @@
image::images/run-sql-script.png[title="Откройте файлы SQL в редакторе IDE"]
-[start=7]
+
. Убедитесь, что база данных `consult` выбрана в раскрывающемся списке "Соединение" на панели инструментов редактора SQL, затем нажмите кнопку 'Выполнить SQL' ( image:images/run-sql-btn.png[] ).
После нажатия кнопки "Запустить SQL" в окне вывода появятся следующие выходные данные.
@@ -211,18 +211,18 @@
image::images/create-datasource.png[title="Укажите имя JNDI и соединение с базой данных для создания источника данных"]
-[start=4]
+
. Нажмите кнопку "ОК" для закрытия диалогового окна и возврата в мастер. Таблицы базы данных `consult` выводятся в окне списка "Доступные таблицы".
-[start=5]
+
. Для выбора всех таблиц, имеющихся в базе данных, нажмите кнопку "Добавить все". Нажмите кнопку "Далее".
image::images/new-entities-wizard.png[]
-[start=6]
+
. Введите `jpa.entities` в качестве имени пакета.
-[start=7]
+
. Убедитесь, что установлены оба флажка — и создания именованных запросов, и создания блоков сохранения состояния. Нажмите кнопку "Завершить".
При нажатии кнопки "Готово" среда IDE создает классы сущностей в пакете проекта `jpa.entities`.
@@ -262,20 +262,20 @@
В окне "Доступные классы сущностей" выводится список из семи классов сущностей, имеющихся в этом проекте. В окне не выводятся встраиваемые классы (`ClientPK.java` и `ProjectPK.java`).
-[start=2]
+
. Нажмите кнопку "Добавить все" для переноса всех классов в окно "Выбранные классы сущностей".
image::images/newjsf-wizard.png[title="В мастере создания страниц JSF из классов сущностей отображаются все классы сущностей, содержащиеся в проекте"]
Нажмите кнопку "Далее".
-[start=3]
+
. На третьем экране мастера "Создание страниц JSF и классов" в поле "Пакет сеансного компонента JPA" введите `jpa.session`.
-[start=4]
+
. В поле "Пакет классов JSF" введите `jsf`.
-[start=5]
+
. В поле "Имя набора локализаций" введите "`/resources/Bundle`". Будет создан пакет с именем `resources`, в который входит файл `Bundle.properties`. (Если поле оставить пустым, набор свойств будет создан в пакете проекта по умолчанию.)
image::images/newjsf-wizard2.png[title="Укажите имена пакетов и папок для созданных файлов"]
@@ -287,7 +287,7 @@
В целом, для вызова и изменения всех шаблонов, поддерживаемых в среде IDE, используйте диспетчер шаблонов ("Сервис" > "Шаблоны").
-[start=6]
+
. Нажмите кнопку "Завершить". В среде IDE создаются сеансные компоненты без сохранения состояния в пакете `jpa.session` и управляемые компоненты JSF в контексте сеанса в пакете `jsf`. Каждый сеансный компонент без сохранения состояния обрабатывает операции для соответствующего класса сущностей, включая создание, правку и удаление экземпляров класса сущностей, с помощью интерфейса Java Persistence API. Каждый управляемый компонент JSF реализует интерфейс `javax.faces.convert.Converter` и играет роль экземпляров преобразования соответствующего класса сущностей в объекты `String` и наоборот.
При развертывании узла "Веб-страницы" можно отметить, что в среде IDE была создана папка для каждого класса сущностей. Каждая папка содержит файлы `Create.xhtml`, `Edit.xhtml`, `List.xhtml` и `View.xhtml`. В среде IDE также изменен файл `index.xhtml` посредством вставки ссылок на каждую из страниц `List.xhtml`.
@@ -386,7 +386,7 @@
</h:body>
----
-[start=2]
+
. Щелкните ссылку "`Показать все элементы консультантов`". При анализе приведенного выше кода можно отметить, что целевая страница – `/consultant/List.xhtml`. (В JSF 2.x расширение файла является предполагаемым из-за неявного перехода.)
image::images/empty-consultants-list.png[title="Таблица 'Consultants' в настоящее вермя пуста"]
@@ -413,10 +413,10 @@
Щелкните правой кнопкой мыши в редакторе и выберите 'Запустить оператор' или нажмите кнопку 'Запустить SQL' ( image:images/run-sql-btn.png[] ). Результаты выполнения сценария отображаются в окне вывода.
-[start=3]
+
. Перезапустите сервер приложений GlassFish. Это необходимо для перезагрузки и кэширования новых данных при помощи сервера, содержащихся в базе данных `consult`. Чтобы это сделать, перейдите на вкладку 'Сервер GlassFish' в окне вывода (на вкладке 'Сервер GlassFish' отображается журнал сервера). Затем нажмите кнопку 'Перезапустить сервер' в левом поле ( image:images/glassfish-restart.png[] ). Сервер остановится, затем перезапустится.
-[start=4]
+
. Выполните проект еще раз и щелкните ссылку "`Показать все элементы консультантов`". Теперь можно заметить, что список больше не пуст.
[.feature]
--
@@ -461,7 +461,7 @@
Чтобы отобразить номера строк, щелкните правой кнопкой мыши на левой границе редактора и выберите 'Показать номера строк'.
-[start=2]
+
. С помощью диалогового окна "Переход к файлу" в среде IDE откройте файл `template.xhtml`. Нажмите сочетание клавиш ALT+SCHIFT+O (CTRL+SHIFT+O в Mac), затем введите `template`.
image::images/go-to-file.png[title="С помощью диалогового окна "Переход к файлу" быстро откройте файлы проекта"]
@@ -469,7 +469,7 @@
Нажмите кнопку "ОК" (или нажмите ENTER).
-[start=3]
+
. В шаблоне применяются теги `<ui:insert>` для вставки содержимого из других файлов в заголовок и тело. Установите курсор на тег `<ui:insert>`, затем нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова всплывающего окна документации.
image::images/doc-popup.png[title="Нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова всплывающего окна документации в тегах Facelets"]
@@ -477,10 +477,10 @@
Для вызова всплывающего окна документации можно нажать сочетание клавиш CTRL+ПРОБЕЛ, установив курсор на тегах JSF и соответствующих атрибутах. Отображаемая документация взята из описаний, предоставленных в официальной link:http://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/index.html[+Документации о библиотеке тегов JSF+].
-[start=4]
+
. Вернитесь к файлу `List.xhtml` (нажмите CTRL+TAB). Теги `<ui:define>` используются для определения содержимого, которое применяется в заголовке и теле шаблона. Этот шаблон используется для всех четырех файлов Facelets (`Create.xhtml`, `Edit.xhtml`, `List.xhtml` и `View.xhtml`), созданных для каждого класса сущностей.
-[start=5]
+
. Установите курсор на одном из выражений на языке выражений, используемых для локализованных сообщений, содержащихся в файле `Bundle.properties`. Для просмотра локализованного сообщения нажмите сочетание клавиш CTRL+ПРОБЕЛ.
[.feature]
--
@@ -492,7 +492,7 @@
На приведенном выше изображении можно заметить, что выражение на языке выражений разрешено в списке "`List`", который применяется для заголовка шаблона и проверяется из отображаемой в браузере страницы.
-[start=6]
+
. Выполните прокрутку до конца файла и найдите код для ссылки `Create New Consultant` (строка 92). Это выглядит следующим образом:
[source,java]
@@ -501,7 +501,7 @@
<h:commandLink action="#{consultantController.prepareCreate}" value="#{bundle.ListConsultantCreateLink}"/>
----
-[start=7]
+
. Для вызова всплывающего окна документации нажмите сочетание клавиш CTRL+ПРОБЕЛ на атрибуте `action` для `commandLink`.
Атрибут `action` указывает на метод, обрабатывающий запрос при щелчке ссылки в браузере. Предоставлена следующая документация:
@@ -509,22 +509,22 @@
_Компонент MethodExpression определяет вызываемую операцию приложения при его активации пользователем. Выражение должно определять общедоступный метод, который не принимает параметры и возвращает объект (метод toString() которого вызывается для получения логического результата), передаваемый в NavigationHandler для этого приложения._
Другими словами, значение `action` обычно относится к методу в управляемом компоненте JSF, который имеет значение `String`. Затем строка используется в `NavigationHandler` JSF для передачи запроса в соответствующее представление. Проверка этого осуществляется при выполнении следующих действий.
-[start=8]
+
. Установите курсор на `consultantController` и нажмите сочетание клавиш CTRL+ПРОБЕЛ. Функция автозавершения кода в редакторе указывает на то, что `consultantController` является управляемым компонентом JSF.
image::images/code-completion-managed-bean.png[title="Автозавершение кода обеспечено для управляемых компонентов JSF"]
-[start=9]
+
. Переместите курсор на `prepareCreate` и нажмите сочетание клавиш CTRL+ПРОБЕЛ. При вызове функции автозавершения кода выводится список методов, содержащихся в управляемом компоненте `ConsultantController`.
image::images/code-completion-properties.png[title="Автозавершение кода обеспечено для методов классов"]
-[start=10]
+
. Нажмите CTRL (&#8984 в Mac), затем наведите указатель мыши на `prepareCreate`. Будет создана ссылка, с помощью которой можно перейти непосредственно к методу `prepareCreate()` в управляемом компоненте `ConsultantController`.
image::images/editor-navigation.png[title="Используйте навигацию в редакторе для быстрого перехода по исходному коду"]
-[start=11]
+
. Щелкните ссылку и просмотрите метод `prepareCreate()` (отображаемый ниже).
[source,java]
@@ -567,7 +567,7 @@
|StatusId |---
|===
-[start=3]
+
. Нажмите кнопку "Сохранить". При подобном заполнении поле `StatusId` будет отмечено ошибкой проверки.
image::images/create-new-consultant.png[title="Введите в форму образец данных"]
@@ -578,12 +578,12 @@
image::images/consultant-fk.png[title="Проверьте атрибуты внешних ключей в окне 'Службы'"]
-[start=4]
+
. Для устранения ошибки проверки выберите `entity.ConsultantStatus[statusId=A]` в раскрывающемся списке `StatusId`.
*Примечание. *Поле `RecruiterId` можно оставить пустым. Как указано на <<er-diagram,диаграмме "сущность/отношение" для базы данных>>, между таблицами `CONSULTANT` и `RECRUITER` существует нулевое отношение "один ко многим", что означает, что создавать отношение между записями в таблице `CONSULTANT` с записью `RECRUITER` не требуется.
-[start=5]
+
. Нажмите кнопку "Сохранить". На экран выводится сообщение об успешном сохранении записи consultant. При щелчке ссылки `Show All Consultant Items` в таблице появится новая запись.
Как правило, на созданных страницах Facelets отображаются ошибки вводимой пользователем информации:
@@ -619,17 +619,17 @@
</h:panelGrid>
----
-[start=2]
+
. Проверьте атрибут `value`, применяемый к тегу `<f:selectItems>`. Атрибут `value` определяет текст, отображаемый для каждой позиции в раскрывающемся списке.
Нажмите сочетание клавиш CTRL+ПРОБЕЛ, установив курсор на `itemsAvailableSelectOne`. Автозавершение кода в редакторе указывает, что метод `getItemsAvailableSelectOne()` для `ConsultantStatusController` возвращает массив объектов `SelectItem`.
image::images/code-completion-returned-object.png[title="Автозавершение кода отображает возвращаемые классы для методов"]
-[start=3]
+
. Нажмите CTRL (&#8984 в Mac), затем наведите указатель мыши на `itemsAvailableSelectOne`. Создается ссылка, позволяющая переходить непосредственно к методу `getItemsAvailableSelectOne()` в исходном коде сущностей `ConsultantStatus`. Щелкните эту ссылку.
-[start=4]
+
. Установите курсор на значении возврата `SelectItem[]` в сигнатуре метода и нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова всплывающего окна документации.
image::images/documentation-select-item.png[title="Для вызова поддержки документации нажмите сочетание клавиш CTRL+ПРОБЕЛ."]
@@ -638,14 +638,14 @@
Итак, класс `SelectItem` относится к инфраструктуре JSF. Компонент `UISelectOne`, как упоминалось в документации, представлен тегом `<h:selectOneMenu>` из разметки, проверенной выше в <<markup,Шаге 1>>.
-[start=5]
+
. Нажмите CTRL (&#8984 в Mac), затем наведите указатель мыши на `findAll()`. Появится всплывающее окно, отображающее сигнатуру метода.
image::images/method-signature.png[title="Просмотрите всплывающее окно сигнатур методов в редакторе"]
Здесь можно отметить, что `ejbFacade.findAll()` возвращает `List` объектов `ConsultantStatus`.
-[start=6]
+
. Перейдите к `JsfUtil.getSelectItems`. Наведите указатель мыши на `getSelectItems` и нажмите CTRL (&#8984 на компьютере Mac), затем щелкните появившуюся ссылку.
*Примечание. *Помните, что `JsfUtil` является одним из классов служебных программ, созданных при завершении <<jsfPagesEntityClasses,страниц JSF из мастера классов логических объектов>>.
@@ -675,7 +675,7 @@
После проверки того, что методом `toString()` сущности является метод, отображаемый в браузере при просмотре позиций в раскрывающемся списке, измените метод `ConsultantStatus` `toString()`.
-[start=7]
+
. Откройте класс сущностей `ConsultantStatus` в редакторе. Измените метод `toString` для возврата `statusId` и `description`. Это свойства записей, соответствующие двум столбцам таблицы `CONSULTANT_STATUS`.
[source,java]
@@ -686,7 +686,7 @@
}
----
-[start=8]
+
. Выполните проект еще раз. При отображении в браузере страницы приветствия щелкните ссылку `Show All Consultant Items`, затем нажмите `Create New Consultant`.
Просмотрите раскрывающийся список `StatusId`. Теперь на экран будет выведен идентификатор состояния и описание записи, содержащейся в таблице `CONSULTANT_STATUS` базы данных.
@@ -761,10 +761,10 @@
Для создания ресурса JDBC и пула соединений потребуются значения свойств, указанные в файле `glassfish-resources.xml`.
-[start=2]
+
. Щелкните правой кнопкой мыши узел GlassFish Server в окне "Службы" и выберите пункт меню "Открыть консоль администрирования домена". Консоль GlassFish откроется в браузере.
-[start=3]
+
. На панели "Общие задачи" в консоли GlassFish разверните узел *JDBC*, а также узлы *Ресурсы JDBC* и *Пулы соединений JDBC*.
[.feature]
--
@@ -776,15 +776,15 @@
В консоли отображаются текущие ресурсы JDBC, зарегистрированные на сервере. Если в списке под узлом JDBC на панели навигации "Общие задачи" отсутствуют ресурсы `jdbc/consult` и `consultPool`, их необходимо создать. Некоторые ресурсы JDBC , созданные по умолчанию при установке сервера, отображаются в виде дочерних узлов.
-[start=4]
+
. Выберите узел *Пулы соединений JDBC*, затем в разделе "Новый пул соединений JDBC" нажмите "Создать".
image::images/gf-new-jdbc-pool1.png[title="Раздел "Новый пул соединений JDBC" в консоли администрирования GlassFish"]
-[start=5]
+
. Укажите *consultPool* в качестве имени пула, выберите *javax.sql.ConnectionPoolDataSource* в списке "Тип ресурса", затем выберите *MySql* в списке "Поставщик драйверов базы данных". Нажмите кнопку "Далее".
-[start=6]
+
. На экране 2 укажите значения свойств *URL*, *имя пользователя* и *пароль*, найденные в файле. Нажмите "Готово".
image::images/gf-new-jdbc-pool2.png[title="Панель "Новый пул соединений JDBC" в консоли администрирования GlassFish"]
@@ -794,10 +794,10 @@
При нажатии на кнопку "Готово" на сервере создается новый пул соединений, и под узлом "Пулы соединений JDBC" в консоли появляется соответствующий узел.
-[start=7]
+
. Выберите узел *Ресурсы JDBC* на панели навигации "Общие задачи" и нажмите "Создать".
-[start=8]
+
. Укажите *jdbc/consult* в качестве имени JNDI и выберите *consultPool* в списке "Имя пула". Нажмите OK.
image::images/gf-new-jdbc-resource.png[title="Раздел "Новый ресурс JDBC" в консоли администрирования GlassFish"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_zh_CN.asciidoc
index cd8c562..6913135 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-crud_zh_CN.asciidoc
@@ -121,7 +121,7 @@
image::images/run-sql-script.png[title="在 IDE 的编辑器中打开 SQL 文件"]
-[start=7]
+
. 确保在 SQL 编辑器工具栏的 "Connection"(连接)下拉列表中选择了 `consult` 数据库,然后单击 "Run SQL"(运行 SQL)(image:images/run-sql-btn.png[]) 按钮。
单击 "Run SQL"(运行 SQL)时,"Output"(输出)窗口中出现以下输出内容。
@@ -216,18 +216,18 @@
image::images/create-datasource.png[title="指定 JNDI 名称和数据库连接以创建数据源"]
-[start=4]
+
. 单击 "OK"(确定)以关闭对话框并返回到向导。`consult` 数据库中的表出现在 "Available Tables"(可用表)列表框中。
-[start=5]
+
. 单击 "Add All"(全部添加)按钮以选择数据库中包含的所有表。单击 "Next"(下一步)。
image::images/new-entities-wizard.png[]
-[start=6]
+
. 键入 `jpa.entities` 作为包名称。
-[start=7]
+
. 确认已选中用于生成命名查询和创建持久性单元的复选框。单击 "Finish"(完成)。
单击 "Finish"(完成),此时 IDE 将在项目的 `jpa.entities` 包中生成实体类。
@@ -267,20 +267,20 @@
"Available Entity Classes"(可用的实体类)框列出了项目中所包含的七个实体类。该框并未列出可嵌入类(`ClientPK.java` 和 `ProjectPK.java`)。
-[start=2]
+
. 单击 "Add All"(全部添加)以将所有类移动到 "Selected Entity Classes"(选定的实体类)框中。
image::images/newjsf-wizard.png[title=""New JSF Pages from Entity Classes"(通过实体类新建 JSF 页)向导显示项目中包含的所有实体类"]
单击 "Next"(下一步)。
-[start=3]
+
. 在向导的“步骤 3”即 "Generate JSF Pages and Classes"(生成 JSF 页和类)中,键入 `jpa.session` 作为 JPA 会话 Bean 包。
-[start=4]
+
. 键入 `jsf` 作为 JSF 类包。
-[start=5]
+
. 在 "Localization Bundle Name"(本地化包名称)字段中输入 "`/resources/Bundle`"。这样将生成一个名为 `resources` 的包,其中将包含 `Bundle.properties` 文件。(如果将此字段保留为空,则在项目的默认包中将创建属性包。)
image::images/newjsf-wizard2.png[title="为生成的文件指定包名称和文件夹名称"]
@@ -292,7 +292,7 @@
通常,可以使用 "Template Manager"(模板管理器)("Tools"(工具)> "Templates"(模板))来访问和更改 IDE 维护的所有模板。
-[start=6]
+
. 单击 "Finish"(完成)。IDE 在 `jpa.session` 包中生成无状态会话 Bean,并在 `jsf` 包中生成 JSF 会话范围的受管 Bean。每个无状态会话 Bean 用于处理相应实体类的操作,其中包括通过 Java 持久性 API 创建、编辑和销毁实体类的实例。每个 JSF 受管 Bean 用于实现 `javax.faces.convert.Converter` 接口,并执行将相应实体类的实例转换为 `String` 对象的操作,反之亦然。
如果展开 "Web Pages"(Web 页)节点,则可以看到 IDE 为每个实体类生成了一个文件夹。每个文件夹都包含 `Create.xhtml`、`Edit.xhtml`、`List.xhtml` 和 `View.xhtml` 文件。IDE 还通过向每个 `List.xhtml` 页中插入链接来修改 `index.xhtml` 文件。
@@ -391,7 +391,7 @@
</h:body>
----
-[start=2]
+
. 单击 "`Show All Consultant Items`" 链接。查看上面的代码,则可以看到目标页为 `/consultant/List.xhtml`。(在 JSF 2.x 中,由于隐式导航所以文件扩展名是推断出来的。)
image::images/empty-consultants-list.png[title="Consultants 表当前为空"]
@@ -418,10 +418,10 @@
在编辑器中右键单击并选择 "Run Statement"(运行语句),或单击 "Run SQL"(运行 SQL)(image:images/run-sql-btn.png[]) 按钮。您可以在 "Output"(输出)窗口中查看脚本运行的结果。
-[start=3]
+
. 重新启动 GlassFish Server。这是使服务器可以重新加载和缓存 `consult` 数据库中包含的新数据所必需的步骤。为此,请在 "Output" 窗口中单击 "GlassFish Server" 标签("GlassFish Server" 标签显示服务器日志。),然后单击左旁注中的 "Restart Server"(重新启动服务器)(image:images/glassfish-restart.png[]) 按钮。服务器即会停止,然后重新启动。
-[start=4]
+
. 重新运行项目,然后单击 "`Show All Consultant Items`" 链接。将看到该列表不再为空。
[.feature]
--
@@ -466,7 +466,7 @@
要显示行号,请右键单击编辑器的左旁注,然后选择 " Show Line"(显示行号)。
-[start=2]
+
. 使用 IDE 的 "Go to File"(转至文件)对话框来打开 `template.xhtml`。按 Alt-Shift-O 组合键(在 Mac 上为 Ctrl-Shift-O 组合键),然后开始键入 `template`。
image::images/go-to-file.png[title="使用 "Go to File"(转至文件)对话框快速打开项目文件"]
@@ -474,7 +474,7 @@
单击 "OK"(确定)(或按 Enter 键)。
-[start=3]
+
. 模板将使用 `<ui:insert>` 标记将其他文件的内容插入到其标题和正文中。将光标置于 `<ui:insert>` 标记上,然后按 Ctrl-空格键调用文档弹出式窗口。
image::images/doc-popup.png[title="在 Facelets 标记上按 Ctrl-空格键调用文档弹出式窗口"]
@@ -482,10 +482,10 @@
可以在 JSF 标记及其属性上按 Ctrl-空格键调用文档弹出式窗口。您查看的文档是从正式的 link:http://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/index.html[+JSF 标记库文档+]所提供的描述中获取的。
-[start=4]
+
. 切换回 `List.xhtml` 文件(按 Ctrl-Tab 组合键)。`<ui:define>` 标记用来定义将应用于模板标题和正文的内容。为每个实体类生成的所有 4 个 Facelets 文件(`Create.xhtml`、`Edit.xhtml`、`List.xhtml` 和 `View.xhtml`)都使用了此模式。
-[start=5]
+
. 将您的光标置于任何 EL 表达式(用于包含在 `Bundle.properties` 文件中的本地化消息)上。按 Ctrl-空格键查看本地化消息。
[.feature]
--
@@ -497,7 +497,7 @@
在上图上,可以看到 EL 表达式解析为 "`List`",该表达式将应用到模板标题,并且可以从呈现在浏览器中的页面得到验证。
-[start=6]
+
. 滚动到文件底部并找到 `Create New Consultant` 链接的代码(第 92 行)。如下所示:
[source,java]
@@ -506,7 +506,7 @@
<h:commandLink action="#{consultantController.prepareCreate}" value="#{bundle.ListConsultantCreateLink}"/>
----
-[start=7]
+
. 在 `commandLink` 的 `action` 属性上按 Ctrl-空格键以调用文档弹出式窗口。
`action` 属性表示在浏览器中单击链接时处理请求的方法。将提供以下文档:
@@ -514,22 +514,22 @@
_方法表达式,用于表示在用户激活此组件时要调用的应用程序操作。该表达式的值必须为一个没有参数且返回对象(调用其 toString() 以派生逻辑结果)的公共方法,该对象将被传递到此应用程序的 NavigationHandler。_
换句话说,`action` 值通常是指 JSF 受管 Bean 中的一个方法,其值为 `String`。然后 JSF 的 `NavigationHandler` 会使用该字符串将请求转发到相应的视图中。可通过以下步骤来验证这一点。
-[start=8]
+
. 将光标置于 `consultantController` 上,然后按 Ctrl-空格组合键。编辑器的代码完成表明 `consultantController` 是一个 JSF 受管 Bean。
image::images/code-completion-managed-bean.png[title="为 JSF 受管 Bean 提供代码完成"]
-[start=9]
+
. 将光标移动到 `prepareCreate`,然后按 Ctrl-空格组合键。代码完成列出了包含在 `ConsultantController` 受管 Bean 中的方法。
image::images/code-completion-properties.png[title="为类方法提供代码完成"]
-[start=10]
+
. 按 Ctrl 键(在 Mac 上为 ⌘ 键),然后将鼠标悬停在 `prepareCreate` 上。形成了一个链接,您可以直接导航至 `ConsultantController` 受管 Bean 中的 `prepareCreate()` 方法。
image::images/editor-navigation.png[title="使用编辑器导航快速导航源代码"]
-[start=11]
+
. 单击链接并查看 `prepareCreate()` 方法(如下所示)。
[source,java]
@@ -572,7 +572,7 @@
|StatusId |---
|===
-[start=3]
+
. 单击 "Save"(保存)。当您执行此操作后,将对 `StatusId` 字段标记一个验证错误。
image::images/create-new-consultant.png[title="在窗体中输入样例数据"]
@@ -583,12 +583,12 @@
image::images/consultant-fk.png[title="在 "Services"(服务)窗口中检查外键属性"]
-[start=4]
+
. 要解决验证错误,请从 `StatusId` 下拉列表中选择 `entity.ConsultantStatus[statusId=A]`。
*注:*`RecruiterId` 字段可保留为空。正如<<er-diagram,数据库实体关系图>>中所示,在 `CONSULTANT` 和 `RECRUITER` 表之间存在一个允许为空值的一对多的关系,这就意味着 `CONSULTANT` 中的条目不需要与一个 `RECRUITER` 条目相关联。
-[start=5]
+
. 单击 "Save"(保存)。将显示一条消息,表明顾问条目已成功保存。如果单击 `Show All Consultant Items`,将看到新条目列在表中。
通常,生成的 Facelets 页会为产生下列问题的用户输入提供出错信息:
@@ -624,17 +624,17 @@
</h:panelGrid>
----
-[start=2]
+
. 检查应用于 `<f:selectItems>` 标记的 `value`。`value` 属性决定了为下拉列表中每项显示的文本。
在 `itemsAvailableSelectOne` 上按 Ctrl-空格组合键。编辑器的代码完成表示 `ConsultantStatusController` 的 `getItemsAvailableSelectOne()` 方法返回了 `SelectItem` 对象的数组。
image::images/code-completion-returned-object.png[title="代码完成显示方法的返回类"]
-[start=3]
+
. 按 Ctrl 键(在 Mac 上为 ⌘ 键),然后将鼠标悬停在 `itemsAvailableSelectOne` 上。形成了一个链接,您可以直接导航至 `ConsultantStatus` 实体源代码中的 `getItemsAvailableSelectOne()` 方法。单击该链接。
-[start=4]
+
. 将光标置于方法签名中的 `SelectItem[]` 返回值上,然后按 Ctrl-空格键调用文档弹出式窗口。
image::images/documentation-select-item.png[title="按 Ctrl-空格键调用文档支持"]
@@ -643,14 +643,14 @@
正如您所看到的,`SelectItem` 类属于 JSF 框架。文档中提到的 `UISelectOne` 组件使用您在上述<<markup,步骤 1>> 中检查的标记中的 `<h:selectOneMenu>` 标记来表示。
-[start=5]
+
. 按 Ctrl 键(在 Mac 上为 ⌘ 键),然后将鼠标悬停在 `findAll()` 上。随即出现一个弹出式窗口,显示方法签名。
image::images/method-signature.png[title="在编辑器中查看方法签名的弹出式窗口"]
可以看到此处的 `ejbFacade.findAll()` 返回了 `ConsultantStatus` 对象的 `List`。
-[start=6]
+
. 导航至 `JsfUtil.getSelectItems`。将鼠标悬停在 `getSelectItems` 上并按 Ctrl 键(在 Mac 上为 ⌘),然后单击显示的链接。
*注:*回想一下,`JsfUtil` 是在您完成<<jsfPagesEntityClasses,“通过实体类创建 JSF 页”向导>>时生成的一个实用程序类。
@@ -680,7 +680,7 @@
既然您已在查看下拉列表中的项时,验证了实体 `toString()` 方法正是浏览器中所呈现的内容,那么请修改 `ConsultantStatus` `toString()` 方法。
-[start=7]
+
. 在编辑器中打开 `ConsultantStatus` 实体类。修改 `toString` 方法以返回 `statusId` 和 `description`。这些是对应于 `CONSULTANT_STATUS` 表的两列的实体属性。
[source,java]
@@ -691,7 +691,7 @@
}
----
-[start=8]
+
. 重新运行项目。当浏览器显示欢迎页面时,单击 `Show All Consultant Items` 链接,然后单击 `Create New Consultant`。
检查 `StatusId` 下拉列表。将看到现在显示的是数据库的 `CONSULTANT_STATUS` 表中所包含的一个记录的状态 ID 和描述。
@@ -766,10 +766,10 @@
创建 JDBC 资源和连接池时,将使用在 `glassfish-resources.xml` 中指定的属性值。
-[start=2]
+
. 在 "Services"(服务)窗口中右键单击 "GlassFish Server" 节点,然后在弹出式菜单中选择 "Open Domain Admin Console"(打开域管理控制台)在浏览器中打开 GlassFish 控制台。
-[start=3]
+
. 在 GlassFish 控制台的 "Common Tasks"(常见任务)导航面板中,展开 *JDBC* 节点以及 *JDBC Resources*(JDBC 资源)和 *JDBC Connection Pools*(JDBC 连接池)节点。
[.feature]
--
@@ -781,15 +781,15 @@
您可以看到当前注册到服务器的 JDBC 资源。如果在 "Common Tasks"(常见任务)导航面板中的 "JDBC" 节点下未列出 `jdbc/consult` 和 `consultPool`,则您将需要创建它们。在安装服务器时,默认情况下创建了一些 JDBC 资源并且这些资源显示为子节点。
-[start=4]
+
. 单击 *JDBC Connection Pools*(JDBC 连接池)节点,然后在 "New JDBC Connection Pool"(新建 JDBC 连接池)窗格中单击 "New"(新建)。
image::images/gf-new-jdbc-pool1.png[title="GlassFish 管理控制台中的 "New JDBC Connection Pool"(新建 JDBC 连接池)窗格"]
-[start=5]
+
. 键入 *consultPool* 作为池名称,选择 *javax.sql.ConnectionPoolDataSource* 作为资源类型并选择 *MySql* 作为数据库驱动程序供应商。单击 "Next"(下一步)。
-[start=6]
+
. 在步骤 2 中,定位并指定 *URL*、*username* 和 *password* 属性的值。单击 "Finish"(完成)。
image::images/gf-new-jdbc-pool2.png[title="GlassFish 管理控制台中的 "New JDBC Connection Pool"(新建 JDBC 连接池)面板"]
@@ -799,10 +799,10 @@
单击 "Finish"(完成)时,将在服务器上创建新的连接池,并在 "JDBC Connection Pools"(JDBC 连接池)节点下显示此连接池的节点。
-[start=7]
+
. 在 "Common Tasks"(常见任务)导航面板中单击 *JDBC Resources*(JDBC 资源)节点并单击 "New"(新建)。
-[start=8]
+
. 为 "JNDI Name"(JNDI 名称)键入 *jdbc/consult*,并在 "Pool Name"(池名称)下拉列表中选择 *consultPool*。单击 "OK"(确定)。
image::images/gf-new-jdbc-resource.png[title="GlassFish 管理控制台中的 "New JDBC Resource"(新建 JDBC 资源)窗格"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro.asciidoc
index fab6815..8963e20 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro.asciidoc
@@ -82,12 +82,12 @@
*Note.* You might be prompted to resolve the reference to the JUnit libraries when you open the NetBeans project if you did not install the JUnit plugin when you installed the IDE.
-[start=3]
+
. Run the project to see what it looks like in a browser. Either right-click the `jsfDemo` project node in the Projects window and choose Run, or click the Run Project ( image:images/run-project-btn.png[] ) button in the main toolbar. The project is packaged and deployed to the GlassFish server, and your browser opens to display the welcome page (`index.xhtml`).
image::images/run-project.png[title="Run the project to view it in a browser"]
-[start=4]
+
. Click the Submit button. The response page (`response.xhtml`) displays as follows:
image::images/response.png[title="The welcome and response pages are currently static pages"]
@@ -95,13 +95,13 @@
Currently the welcome and response pages are static and, together with the `stylesheet.css` file and `duke.png` image, are the only application files accessible from a browser.
-[start=5]
+
. In the Projects window (Ctrl-1; ⌘-1 on Mac), right-click your project node and choose Properties to open the Project Properties window.
-[start=6]
+
. Select the Frameworks category and then click the Add button.
-[start=7]
+
. Select JavaServer Faces in the Add a Framework dialog box. Click OK.
image::images/add-framework.png[title="Add JSF support to an existing project"]
@@ -110,7 +110,7 @@
image::images/libraries-tab.png[title="Specify access to JSF 2.x libraries"]
-[start=8]
+
. Click the Configuration tab. You can specify how the Faces servlet is registered in the project's deployment descriptor. You can also indicate whether you want Facelets or JSP pages to be the used with the project.
image::images/jsf-configuration.png[title="Specify Faces servlet options and preferred language"]
@@ -119,7 +119,7 @@
image::images/jsf-components.png[title="Specify Faces servlet options and preferred language"]
-[start=9]
+
. Click OK to finalize changes and exit the Project Properties window.
After adding JSF support to your project, the project's `web.xml` deployment descriptor is modified to look as follows. (Changes in *bold*.)
@@ -183,7 +183,7 @@
image::images/managed-bean.png[title="Use the JSF Managed Bean wizard to create a new managed bean"]
-[start=3]
+
. Click Finish. The `UserNumberBean` class is generated and opens in the editor. Note the following annotations (shown in *bold*):
[source,java]
@@ -241,10 +241,10 @@
The above code generates a random number between 0 and 10, and outputs the number in the server log.
-[start=2]
+
. Fix imports. To do so, click the hint badge ( image:images/hint-icon.png[] ) that displays in the editor's left margin, then choose the option to import `java.util.Random` into the class.
-[start=3]
+
. Run the project again (click the Run Project ( image:images/run-project-btn.png[] ) button, or press F6; fn-F6 on Mac). When you run your project, the server's log file automatically opens in the Output window.
image::images/output1.png[title="The server's log file is automatically opens in the Output window"]
@@ -255,7 +255,7 @@
_If the value of the `eager()` attribute is `true`, and the `managed-bean-scope` value is "application", the runtime must instantiate this class when the application starts. This instantiation and storing of the instance must happen before any requests are serviced. If _eager_ is unspecified or `false`, or the `managed-bean-scope` is something other than "application", the default "lazy" instantiation and scoped storage of the managed bean happens._
-[start=4]
+
. Because `UserNumberBean` is session-scoped, have it implement the `Serializable` interface.
[source,java]
@@ -286,12 +286,12 @@
*Integer userNumber;*
----
-[start=2]
+
. Right-click in the editor and choose Insert Code (Alt-Insert; Ctrl-I on Mac). Choose Getter and Setter.
image::images/getter-setter.png[title="Use the IDE to generate accessor methods for properties"]
-[start=3]
+
. Select the `userNumber` : `Integer` option. Click Generate.
image::images/generate-getters-setters.png[title="Use the IDE to generate accessor methods for properties"]
@@ -299,7 +299,7 @@
Note that the `getUserNumber()` and `setUserNumber(Integer userNumber)` methods are added to the class.
-[start=4]
+
. Create a `response` property. Declare a `String` named `response`.
[source,java]
@@ -314,7 +314,7 @@
*String response;*
----
-[start=5]
+
. Create a getter method for `response`. (This application will not require a setter.) You could use the IDE's Generate Code pop-up shown in step 2 above to generate template code. For purposes of this tutorial however, just paste the below method into the class.
[source,html]
@@ -340,7 +340,7 @@
1. It tests whether the user-entered number (`userNumber`) equals the random number generated for the session (`randomInt`) and returns a `String` response accordingly.
2. It invalidates the user session if the user guesses the right number (i.e., if `userNumber` equals `randomInt`). This is necessary so that a new number is generated should the user want to play again.
-[start=6]
+
. Right-click in the editor and choose Fix Imports (Alt-Shift-I; ⌘-Shift-I on Mac). Import statements are automatically created for:
* `javax.servlet.http.HttpSession`
* `javax.faces.context.FacesContext`
@@ -378,7 +378,7 @@
Both index and response pages already contain the JSF UI components you require for this exercise. Simply uncomment them and comment out the HTML elements currently being used.
-[start=2]
+
. Comment out the HTML form element. To do so, highlight the HTML form element as in the image below, then press Ctrl-/ (⌘-/ on Mac).
*Note: *To highlight, either click and drag in the editor with your mouse, or, using the keyboard, hold Shift and press the arrow keys.
@@ -388,7 +388,7 @@
Use Ctrl-/ (⌘-/ on Mac) to toggle comments in the editor. You can also apply this keyboard shortcut to other file types, such as Java and CSS.
-[start=3]
+
. Uncomment the JSF HTML form component. Highlight the component as in the image below, then press Ctrl-/ (⌘-/ on Mac).
*Note.* You might need to press Ctrl-/ twice to uncomment the code.
@@ -400,7 +400,7 @@
image::images/undeclared-component.png[title="The editor provides error messages for undeclared components"]
-[start=4]
+
. To declare these components, use the IDE's code completion to add the tag library namespace to the page's `<html>` tag. Place your cursor on any of the undeclared tags and press Alt-Enter and click Enter to add the suggested tag library. (If there are multiple options, make sure to select the tag that is displayed in the editor before clicking Enter.) The JSF HTML tag library namespace is added to the `<html>` tag (shown in *bold* below), and the error indicators disappear.
*Note.* If the IDE does not provide the option to add the tag library you will need to manually modify the ``<html>`` element.
@@ -413,7 +413,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. Use the JSF expression language to bind `UserNumberBean`'s `userNumber` property to the `inputText` component. The `value` attribute can be used to specify the current value of the rendered component. Type in the code displayed in *bold* below.
[source,java]
@@ -426,7 +426,7 @@
JSF expression language uses the `#{}` syntax. Within these delimiters, you specify the name of the managed bean and the bean property you want to apply, separated by a dot (`.`). Now, when the form data is sent to the server, the value is automatically saved in the `userNumber` property using the property's setter (`setUserNumber()`). Also, when the page is requested and a value for `userNumber` has already been set, the value will automatically display in the rendered `inputText` component. For more information, see the link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-develop001.htm#BNAQP[+Java EE 7 Tutorial: 12.1.2 Using the EL to Reference Managed Beans+].
-[start=6]
+
. Specify the destination for the request that is invoked when clicking the form button. In the HTML version of the form, you were able to do this using the `<form>` tag's `action` attribute. With JSF, you can use the `commandButton`'s `action` attribute. Furthermore, due to JSF 2.x's implicit navigation feature, you only need to specify the name of the destination file, without the file extension.
Type in the code displayed in *bold* below.
@@ -462,14 +462,14 @@
Steps 7 through 12 below are optional. If you'd like to quickly build the project, skip ahead to <<response,`response.xhtml`>>.
-[start=7]
+
. Test whether the above EL expression does in fact call the `setUserNumber()` method when the request is processed. To do so, use the IDE's Java debugger.
Switch to the `UserNumberBean` class (Press Ctrl-Tab and choose the file from the list.) Set a breakpoint on the `setUserNumber()` method signature. You can do this by clicking in the left margin. A red badge displays, indicating a method breakpoint has been set.
image::images/set-breakpoint.png[title="Click in the editor's left margin to set breakpoints"]
-[start=8]
+
. Click the Debug Project ( image:images/breakpoint-btn.png[] ) button in the IDE's main toolbar. A debug session starts, and the project welcome page opens in the browser.
*Notes.*
@@ -477,15 +477,15 @@
* You might be prompted to confirm the server port for debugging the application.
* If a Debug Project dialog displays, select the default 'Server side Java' option and click Debug.
-[start=9]
+
. In the browser, enter a number into the form and click the 'submit' button.
-[start=10]
+
. Switch back to the IDE and inspect the `UserNumberBean` class. The debugger is suspended within the `setUserNumber()` method.
image::images/debugger-suspended.png[title="Debugger suspends according to breakpoints"]
-[start=11]
+
. Open the Debugger's Variables window (Choose Window > Debugging > Variables, or press Ctrl-Shift-1). You see the variable values for the point at which the debugger is suspended.
image::images/variables-window.png[title="Monitor variable values using the Debugger's Variables window"]
@@ -493,7 +493,7 @@
In the image above, a value of '`4`' is provided for the `userNumber` variable in the `setUserNumber()` signature. (The number 4 was entered into the form.) '`this`' refers to the `UserNumberBean` object that was created for the user session. Beneath it, you see that the value for the `userNumber` property is currently `null`.
-[start=12]
+
. In the Debugger toolbar, click the Step Into ( image:images/step-into-btn.png[] ) button. The debugger executes the line on which it is currently suspended. The Variables window refreshes, indicating changes from the execution.
image::images/variables-window2.png[title="Variables window refreshes when stepping through code"]
@@ -501,7 +501,7 @@
The `userNumber` property is now set to the value entered in the form.
-[start=13]
+
. Choose Debug > Finish Debugger Session (Shift-F5; Shift-Fn-F5 on Mac) from the main menu to stop the debugger.
@@ -514,7 +514,7 @@
*Note: *To highlight, either click and drag in the editor with your mouse, or, using the keyboard, hold Shift and press the arrow keys.
-[start=3]
+
. Uncomment the JSF HTML form component. Highlight the opening and closing `<h:form>` tags and the code between them, then press Ctrl-/ (⌘-/ on Mac).
At this stage, your code between the `<body>` tags looks as follows:
@@ -557,7 +557,7 @@
After uncommenting the JSF HTML form component, the editor indicates that the `<h:form>` and `<h:commandButton>` tags haven't been declared.
-[start=4]
+
. To declare these components, use the IDE's code completion to add the tag library namespace to the page's `<html>` tag.
Use the editor's code completion support to add required JSF namespaces to the file. When selecting a JSF or Facelets tag through code completion, the required namespace is automatically added to the document's root element. For more information, see link:jsf20-support.html#facelets[+JSF 2.x Support in NetBeans IDE+].
@@ -576,7 +576,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. Specify the destination for the request that is invoked when the user clicks the form button. You want to set the button so that when a user clicks it, he or she is returned to the index page. To accomplish this, use the `commandButton`'s `action` attribute. Type in the code displayed in *bold*.
[source,xml]
@@ -592,7 +592,7 @@
*Note: *By typing `action="index"`, you are relying on JSF's implicit navigation feature. When a user clicks the form button, the JSF runtime searches for a file named `index`. It assumes the file extension is the same as the extension used by file from which the request originated (`response*.xhtml*`) and looks for for the `index.xhtml` file in the same directory as the originating file (i.e., the webroot).
-[start=6]
+
. Replace the static "[ response here ]" text with the value of the `UserNumberBean`'s `response` property. To do this, use the JSF expression language. Enter the following (in *bold*).
[source,html]
@@ -603,7 +603,7 @@
<h4>*<h:outputText value="#{UserNumberBean.response}"/>*</h4>
----
-[start=7]
+
. Run the project (click the Run Project ( image:images/run-project-btn.png[] ) button, or press F6; fn-F6 on Mac). When the welcome page displays in the browser, enter a number and click `submit`. You see the response page display similar to the following (provided you did not guess the correct number).
image::images/response2.png[title="View the current status of the project in a browser"]
@@ -616,7 +616,7 @@
The following two steps correct these points, respectively.
-[start=8]
+
. Set the `<h:outputText>` tag's `escape` attribute to `false`. Place your cursor between `outputText` and `value`, insert a space, then press Ctrl-Space to invoke code-completion. Scroll down to choose the `escape` attribute and inspect the documentation.
image::images/escape-false.png[title="Press Ctrl-Space to view possible attribute values and documentation"]
@@ -632,7 +632,7 @@
<h4><h:outputText *escape="false"* value="#{UserNumberBean.response}"/></h4>
----
-[start=9]
+
. Set the `<h:form>` tag's `prependId` attribute to `false`. Place your cursor just after '`m`' in `<h:form>` and insert a space, then press Ctrl-Space to invoke code-completion. Scroll down to choose the `prependId` attribute and inspect the documentation. Then click Enter, and type `false` as the value.
[source,java]
@@ -657,26 +657,26 @@
The id for the form element is `j_idt5`, and this id is _prepended_ to the id for the Back button included in the form (shown in *bold* above). Because the Back button relies on the `#backButton` style rule (defined in `stylesheet.css`), this rule becomes obstructed when the JSF id is prepended. This can be avoided by setting `prependId` to `false`.
-[start=10]
+
. Run the project again (click the Run Project ( image:images/run-project-btn.png[] ) button, or press F6; fn-F6 on Mac). Enter a number in the welcome page, then click Submit. The response page now displays the response message without the `<p>` tags, and the Back button is positioned correctly.
image::images/response3.png[title="View the current status of the project in a browser"]
-[start=11]
+
. Click the Back button. Because the current value of `UserNumberBean`'s `userNumber` property is bound to the JSF `inputText` component, the number you previously entered is now displayed in the text field.
-[start=12]
+
. Inspect the server log in the IDE's Output window (Ctrl-4; ⌘-4 on Mac) to determine what the correct guess number is.
If you can't see the server log for any reason, you can open it by switching to the Services window (Ctrl-5; ⌘-5 on Mac) and expanding the Servers node. Then right-click the GlassFish server on which the project is deployed and choose View Server Log. If you cannot see the number in the server log, try rebuilding the application by right-clicking the project node and choosing Clean and Build.
-[start=13]
+
. Type in the correct number and click Submit. The application compares your input with the currently saved number and displays the appropriate message.
image::images/yay.png[title="Correct response is displayed when entering the matching number"]
-[start=14]
+
. Click the Back button again. Notice that the previously entered number is no longer displayed in the text field. Recall that `UserNumberBean`'s `getResponse()` method <<getResponse,invalidates the current user session>> upon guessing the correct number.
@@ -712,7 +712,7 @@
After completing the wizard, the template file opens in the editor. To view the template in a browser, right-click in the editor and choose View.
-[start=4]
+
. Examine the template file markup. Note the following points:
* The `facelets` tag library is declared in the page's `<html>` tag. The tag library has the `ui` prefix.
@@ -746,10 +746,10 @@
</div>
----
-[start=5]
+
. Reexamine the <<staticPage,welcome>> and <<responsePage,response>> pages. The only content that changes between the two pages is the title and the text contained in the grey square. The template, therefore, can provide all remaining content.
-[start=6]
+
. Replace the entire content of your template file with the content below.
[source,html]
@@ -783,7 +783,7 @@
* All `<ui:insert>` tags (and their containing `<div>` tags) have been removed, except for one named `box`.
* An `<ui:insert>` tag pair has been placed around the page title, and named `title`.
-[start=7]
+
. Copy relevant code from either the `index.xhtml` or `response.xhtml` file into the template. Add the content shown in *bold* below to the template file's `<h:body>` tags.
[source,html]
@@ -801,7 +801,7 @@
</h:body>
----
-[start=8]
+
. Run the project. When the welcome page opens in the browser, modify the URL to the following:
[source,java]
@@ -830,10 +830,10 @@
image::images/template-client.png[title="The Facelets Template Client wizard"]
-[start=4]
+
. Click Finish. The new `greeting.xhtml` template client file is generated and displays in the editor.
-[start=5]
+
. Examine the markup. Note the content hightlighted in *bold*.
[source,xml]
@@ -861,7 +861,7 @@
----
The template client file references a template using the `<ui:composition>` tag's `template` attribute. Because the template contains `<ui:insert>` tags for `title` and `box`, this template client contains `<ui:define>` tags for these two names. The content that you specify between the `<ui:define>` tags is what will be inserted into the template between the `<ui:insert>` tags of the corresponding name.
-[start=6]
+
. Specify `greeting` as the title for the file. Make the following change in *bold*.
[source,xml]
@@ -872,7 +872,7 @@
</ui:define>
----
-[start=7]
+
. Switch to the `index.xhtml` file (press Ctrl-Tab) and copy the content that would normally appear in the grey square that displays in the rendered page. Then switch back to `greeting.xhtml` and paste it into the template client file. (Changes in *bold*.)
[source,xml]
@@ -897,7 +897,7 @@
</ui:define>
----
-[start=8]
+
. Declare the JSF HTML tag library for the file. Place your cursor on any of the tags that are flagged with an error (any tag using the '`h`' prefix), and press Ctrl-Space. Then select the tag from the list of code completion suggestions. The tag library namespace is added to the file's `<html>` tag (shown in *bold* below), and the error indicators disappear.
[source,java]
@@ -951,14 +951,14 @@
----
Note that the file is identical to `greeting.xhtml`, except for the content specified between the `<ui:define>` tags for `title` and `box`.
-[start=2]
+
. In the project's `web.xml` deployment descriptor, modify the welcome file entry so that `greeting.xhtml` is the page that opens when the application is run.
In the Projects window, double-click Configuration Files > `web.xml` to open it in the editor. Under the Pages tab, change the Welcome Files field to `faces/greeting.xhtml`.
image::images/welcome-files.png[title="Change the Welcome Files entry in the deployment descriptor"]
-[start=3]
+
. Run the project to see what it looks like in a browser. Press F6 (fn-F6 on Mac), or click the Run Project ( image:images/run-project-btn.png[] ) button in the main toolbar. The project is deployed to the GlassFish server, and opens in a browser.
Using the Facelets template and template client files, the application behaves in exactly the same way as it did previously. By factoring out duplicated code in the application's welcome and response pages, you succeeded in reducing the size of the application and eliminated the possibility of writing more duplicate code, should more pages be added at a later point. This can make development more efficient and easier to maintain when working in large projects.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ja.asciidoc
index b58661c..e25160b 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ja.asciidoc
@@ -82,12 +82,12 @@
*注意:*IDEのインストール時にJUnitプラグインをインストールしていない場合は、NetBeansプロジェクトを開くときにJUnitライブラリへの参照を解決するよう求められることがあります。
-[start=3]
+
. プロジェクトを実行して、ブラウザでどのように表示されるかを確認します。「プロジェクト」ウィンドウで「`jsfDemo`」プロジェクト・ノードを右クリックして「実行」を選択するか、メイン・ツールバーの「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックします。プロジェクトがパッケージ化されてGlassFishサーバーにデプロイされ、ブラウザが開いて開始ページ(`index.xhtml`)が表示されます。
image::images/run-project.png[title="プロジェクトを実行してブラウザで表示"]
-[start=4]
+
. 「送信」ボタンをクリックします。レスポンス・ページ(`response.xhtml`)が次のように表示されます。
image::images/response.png[title="現在静的なページである開始ページとレスポンス・ページ"]
@@ -95,13 +95,13 @@
現在、開始ページとレスポンス・ページは静的なページで、`stylesheet.css`ファイルと`duke.png`イメージがあり、ブラウザからアクセスできる唯一のアプリケーション・ファイルです。
-[start=5]
+
. 「プロジェクト」ウィンドウ([Ctrl]-[1]、Macの場合は[⌘]-[1])で、プロジェクト・ノードを右クリックし、「プロパティ」を選択して、「プロジェクト・プロパティ」ウィンドウを開きます。
-[start=6]
+
. 「フレームワーク」カテゴリを選択し、「追加」ボタンをクリックします。
-[start=7]
+
. 「フレームワークの追加」ダイアログ・ボックスで、「JavaServer Faces」を選択します。「OK」をクリックします。
image::images/add-framework.png[title="既存のプロジェクトへのJSFサポートの追加"]
@@ -110,7 +110,7 @@
image::images/libraries-tab.png[title="JSF 2.xライブラリへのアクセスの指定"]
-[start=8]
+
. 「構成」タブをクリックします。Facesサーブレットをプロジェクトのデプロイメント・ディスクリプタにどのように登録するかを指定できます。また、プロジェクトでFaceletsまたはJSPページを使用するかどうかを示すこともできます。
image::images/jsf-configuration.png[title="Facesサーブレット・オプションと優先言語の指定"]
@@ -119,7 +119,7 @@
image::images/jsf-components.png[title="Facesサーブレット・オプションと優先言語の指定"]
-[start=9]
+
. 「OK」をクリックして変更を確定し、「プロジェクト・プロパティ」ウィンドウを終了します。
プロジェクトにJSFサポートを追加すると、プロジェクトの`web.xml`デプロイメント・ディスクリプタが変更されて次のようになります。変更場所は*太字*で示されています。
@@ -183,7 +183,7 @@
image::images/managed-bean.png[title="JSF管理対象Beanウィザードを使用した新しい管理対象Beanの作成"]
-[start=3]
+
. 「終了」をクリックします。`UserNumberBean`クラスが生成され、エディタで開かれます。次の注釈(*太字*で表示)を確認します。
[source,java]
@@ -241,10 +241,10 @@
このコードは0から10の間のランダムな数値を生成し、その数値をサーバー・ログに出力します。
-[start=2]
+
. インポートを修正します。そのためには、エディタの左マージンに表示されるヒント・バッチ(image:images/hint-icon.png[])をクリックし、`java.util.Random`をクラスにインポートするオプションを選択します。
-[start=3]
+
. プロジェクトを再度実行します(「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックするか、[F6] (Macの場合は[fn]-[F6])を押します)。プロジェクトを実行すると、サーバーのログ・ファイルが「出力」ウィンドウに自動的に開かれます。
image::images/output1.png[title="「出力」ウィンドウにサーバーのログ・ファイルが自動的に開きます。"]
@@ -255,7 +255,7 @@
_`eager()`属性の値が`true`で、`managed-bean-scope`の値がapplicationの場合は、アプリケーションの開始時にランタイムがこのクラスをインスタンス化する必要があります。このインスタンス化とインスタンスの格納は、他のリクエストを処理する前に実行される必要があります。_eager_の値が指定されていないか`false`の場合、または`managed-bean-scope`がapplication以外の場合は、デフォルトの「遅延」インスタンス化と管理対象Beanのスコープ指定記憶域が生じます。_
-[start=4]
+
. `UserNumberBean`はセッション・スコープ指定されているため、`Serializable`インタフェースを実装させます。
[source,java]
@@ -286,12 +286,12 @@
*Integer userNumber;*
----
-[start=2]
+
. エディタ内で右クリックし、「コードを挿入」を選択します([Alt]-[Insert]、Macの場合は[Ctrl]-[I])。取得メソッドおよび設定メソッドを選択します。
image::images/getter-setter.png[title="IDEを使用した、プロパティのアクセッサ・メソッドの生成"]
-[start=3]
+
. 「`userNumber`: `Integer`」オプションを選択します。「生成」をクリックします。
image::images/generate-getters-setters.png[title="IDEを使用した、プロパティのアクセッサ・メソッドの生成"]
@@ -299,7 +299,7 @@
`getUserNumber()`および`setUserNumber(Integer userNumber)`メソッドがクラスに追加されます。
-[start=4]
+
. `response`プロパティを作成します。`response`という名前の`String`を宣言します。
[source,java]
@@ -314,7 +314,7 @@
*String response;*
----
-[start=5]
+
. `response`の取得メソッドを作成します。(このアプリケーションでは設定メソッドは必要ありません。)前出のステップ2で示したIDEの「コードを生成」ポップアップを使用して、テンプレート・コードを生成することもできます。ただし、このチュートリアルでは、単純に次のメソッドをクラスに貼り付けます。
[source,html]
@@ -340,7 +340,7 @@
1. ユーザーが入力した数値(`userNumber`)がセッション用に生成されたランダムな数値(`randomInt`)と等しいかどうか、および`String`レスポンスが返されるかどうかがテストされます。
2. ユーザーが正しい数値を推測した場合(たとえば`userNumber`と`randomInt`が正しい場合)、ユーザー・セッションは無効化されます。ユーザーが再度操作する場合に新しい数値が生成されるようにするには、この処理が必要です。
-[start=6]
+
. エディタを右クリックし、「インポートを修正」を選択します([Alt]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])。次の項目用に、インポート文が自動的に作成されます。
* `javax.servlet.http.HttpSession`
* `javax.faces.context.FacesContext`
@@ -378,7 +378,7 @@
indexページとresponseページの両方に、ここで必要なJSF UIコンポーネントがすでに含まれています。それらをコメント解除し、現在使用しているHTML要素をコメントアウトします。
-[start=2]
+
. HTMLフォーム要素をコメントアウトします。これを行うには、次のイメージのHTMLフォーム要素を強調表示し、[Ctrl]-[/] (Macの場合は[⌘]-[/])を押します。
*注意: *強調表示するには、マウスを使用してエディタ内でクリックしてドラッグするか、キーボードを使用して、[Shift]を押しながら矢印キーを押します。
@@ -388,7 +388,7 @@
[Ctrl]-[/] (Macの場合は[⌘]-[/])を使用して、エディタ内のコメントを切り替えます。JavaやCSSなど、他のファイル・タイプにこのキーボード・ショートカットを適用することもできます。
-[start=3]
+
. JSF HTMLフォーム・コンポーネントをコメント解除します。次のイメージに示すように、コンポーネントを強調表示して[Ctrl]-[/] (Macの場合は[⌘]-[/])を押します。
*注意:*コードのコメントを外すには[Ctrl]-[/]を2回押すことが必要な場合があります。
@@ -400,7 +400,7 @@
image::images/undeclared-component.png[title="エディタに表示された、宣言されていないコンポーネントに関するエラー・メッセージ"]
-[start=4]
+
. これらのコンポーネントを宣言するには、IDEのコード補完を使用して、タグ・ライブラリ名前空間をページの`<html>`タグに追加します。宣言されていないいずれかのタグにカーソルを置き、[Alt]-[Enter]を押して提案されるタグ・ライブラリを追加します。(複数のオプションがある場合は、エディタに表示されているタグを選択してから[Enter]を押してください。)JSF HTMLタグ・ライブラリ名前空間が`<html>`タグ(次に*太字*で表示)に追加され、エラー表示が消えます。
*注意:*IDEでタグ・ライブラリを追加するオプションが表示されない場合、 ``<html>`` 要素を手動で変更する必要があります。
@@ -413,7 +413,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. JSF式言語を使用して、`UserNumberBean`の`userNumber`プロパティを`inputText`コンポーネントにバインドします。`value`属性は、レンダリングされたコンポーネントの現在の値を指定するために使用できます。次の*太字*で表示されているコードを入力します。
[source,java]
@@ -426,7 +426,7 @@
JSF式言語では`#{}`構文を使用します。これらの区切り文字内で、管理対象Beanの名前と、適用するBeanプロパティを、ドット(`.`)で区切って指定します。これで、フォーム・データがサーバーに送られると、プロパティの設定メソッド(`setUserNumber()`)を使用して、値が自動的に`userNumber`プロパティに保存されます。また、ページがリクエストされて`userNumber`の値がすでに設定されている場合、レンダリングされる`inputText`コンポーネントに値が自動的に表示されます。詳細は、link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-develop001.htm#BNAQP[+Java EE 7チュートリアル: 12.1.2項の式言語を使用した管理対象Beanの参照+]を参照してください。
-[start=6]
+
. フォーム・ボタンをクリックして呼び出されたリクエストの宛先を指定します。フォームのHTMLバージョンでは、`<form>`タグの`action`属性を使用してこれを実行できました。JSFの場合は、`commandButton`の`action`属性を使用できます。また、JSF 2.xの暗黙的なナビゲーション機能により、宛先のファイルの名前を指定するのみで済みます。ファイル拡張子は不要です。
次の*太字*で表示されているコードを入力します。
@@ -462,14 +462,14 @@
以降のステップ7から12は、オプションです。プロジェクトをすばやくビルドする場合は、<<response,`response.xhtml`>>に進みます。
-[start=7]
+
. 前出のEL式でリクエストを処理するときに`setUserNumber()`メソッドが実際にコールされるかどうかをテストします。これを行うには、IDEのJavaデバッガを使用します。
`UserNumberBean`クラスに切り替えます([Ctrl]-[Tab]を押し、一覧からファイルを選択します。)`setUserNumber()`メソッドの署名にブレークポイントを設定します。これを行うには、左マージンをクリックします。赤のバッジが表示され、メソッドのブレークポイントが設定されたことを示します。
image::images/set-breakpoint.png[title="エディタの左マージンのクリックによるブレークポイントの設定"]
-[start=8]
+
. IDEのメイン・ツールバーにある「プロジェクトをデバッグ」(image:images/breakpoint-btn.png[])ボタンをクリックします。デバッグ・セッションが開始され、プロジェクトの開始ページがブラウザに表示されます。
*注意:*
@@ -477,15 +477,15 @@
* アプリケーションのデバッグ用のサーバー・ポートの確認を求められることがあります。
* 「プロジェクトをデバッグ」ダイアログが表示されたら、デフォルトのサーバー側Javaオプションを選択して、「デバッグ」をクリックします。
-[start=9]
+
. ブラウザで、フォームに数値を入力し、「送信」ボタンをクリックします。
-[start=10]
+
. IDEに切り替え、`UserNumberBean`クラスを確認します。デバッガが`setUserNumber()`メソッド内で一時停止されています。
image::images/debugger-suspended.png[title="ブレークポイントによるデバッガの一時停止"]
-[start=11]
+
. デバッガの「変数」ウィンドウを開きます(「ウィンドウ」>「デバッグ」>「変数」を選択するか、[Ctrl]-[Shift]-[1]を押します)。デバッガが一時停止されている場所の変数値が表示されます。
image::images/variables-window.png[title="デバッガの「変数」ウィンドウを使用した変数値のモニター"]
@@ -493,7 +493,7 @@
前出のイメージでは、`setUserNumber()`署名の`userNumber`変数に、値`4`が指定されています。(数値4がフォームに入力されたため。)「`this`」は、ユーザー・セッション用に作成された`UserNumberBean`オブジェクトを参照します。その下にある`userNumber`プロパティの値は、現在`null`と表示されています。
-[start=12]
+
. デバッガのツールバーで、「ステップ・イン」(image:images/step-into-btn.png[])ボタンをクリックします。デバッガは、現在一時停止されている行を実行します。「変数」ウィンドウがリフレッシュされ、実行による変更が表示されます。
image::images/variables-window2.png[title="コードのステップ実行時の「変数」ウィンドウのリフレッシュ"]
@@ -501,7 +501,7 @@
`userNumber`プロパティは、フォームに入力された値に設定されます。
-[start=13]
+
. メイン・メニューから「デバッグ」→「デバッガ・セッションを終了」([Shift]-[F5]、Macでは[Shift]-[Fn]-[F5])を選択して、デバッガを停止します。
@@ -514,7 +514,7 @@
*注意: *強調表示するには、マウスを使用してエディタ内でクリックしてドラッグするか、キーボードを使用して、[Shift]を押しながら矢印キーを押します。
-[start=3]
+
. JSF HTMLフォーム・コンポーネントをコメント解除します。`<h:form>`の開始タグと終了タグ、およびそれらのタグ間にあるコードを強調表示し、[Ctrl]-[/] (Macの場合は[⌘]-[/])を押します。
この時点では、`<body>`タグ間のコードは次のようになります。
@@ -557,7 +557,7 @@
JSF HTMLフォーム・コンポーネントをコメント解除すると、エディタに`<h:form>`と`<h:commandButton>`タグが宣言されていないことが表示されます。
-[start=4]
+
. これらのコンポーネントを宣言するには、IDEのコード補完を使用して、タグ・ライブラリ名前空間をページの`<html>`タグに追加します。
エディタのコード補完サポートを使用して、必要なJSF名前空間をファイルに追加します。コード補完を使用してJSFまたはFaceletsタグを選択すると、必要な名前空間が自動的にドキュメントのルート要素に追加されます。詳細は、link:jsf20-support.html#facelets[+NetBeans IDEでのJSF 2.xのサポート+]を参照してください。
@@ -576,7 +576,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. フォーム・ボタンをクリックして呼び出されたリクエストの宛先を指定します。ユーザーがボタンをクリックするとindexページに戻るように、ボタンを設定します。これを行うには、`commandButton`の`action`属性を使用します。*太字*で表示されているコードを入力します。
[source,xml]
@@ -592,7 +592,7 @@
*注意:* 「`action="index"`」と入力すると、JSFの暗黙的なナビゲーション機能に依存することになります。ユーザーがフォーム・ボタンをクリックすると、JSFランタイムは`index`という名前のファイルを検索します。リクエスト元のファイル(`response*.xhtml*`)で使用されているのと同じファイル拡張子であると想定し、元のファイルと同じディレクトリ内(webrootなど)で`index.xhtml`ファイルを探します。
-[start=6]
+
. 静的テキスト「[response here]」を、`UserNumberBean`の`response`プロパティの値で置き換えます。これを行うには、JSF式言語を使用します。次の*太字*で示したコードを入力します。
[source,html]
@@ -603,7 +603,7 @@
<h4>*<h:outputText value="#{UserNumberBean.response}"/>*</h4>
----
-[start=7]
+
. プロジェクトを実行します(「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックするか、[F6] (Macの場合は[fn]-[F6])を押します)。ブラウザに開始ページが表示されたら、数値を入力して「`送信`」をクリックします。次のようなレスポンス・ページが表示されます(正しい数値を推測しなかった場合)。
image::images/response2.png[title="ブラウザでのプロジェクトの現在のステータスの表示"]
@@ -616,7 +616,7 @@
次の2つの手順で、これらの間違いを修正します。
-[start=8]
+
. `<h:outputText>`タグの`escape`属性を`false`に設定します。カーソルを`outputText`と`value`の間に置き、スペースを挿入してから[Ctrl]-[Space]を押して、コード補完を呼び出します。下にスクロールして`escape`属性を選択し、ドキュメントを確認します。
image::images/escape-false.png[title="[Ctrl]-[Space]の押下による考えられる属性値とドキュメントの表示"]
@@ -632,7 +632,7 @@
<h4><h:outputText *escape="false"* value="#{UserNumberBean.response}"/></h4>
----
-[start=9]
+
. `<h:form>`タグの`prependId`属性を`false`に設定します。カーソルを`<h:form>`の「`m`」のすぐ後に置き、スペースを入力してから[Ctrl]-[Space]を押して、コード補完を呼び出します。下にスクロールして`prependId`属性を選択し、ドキュメントを確認します。次に[Enter]を押し、値として「`false`」と入力します。
[source,java]
@@ -657,26 +657,26 @@
フォーム要素のIDは`j_idt5`です。このIDは、フォームに含まれている「戻る」ボタンのIDに付加されます(*太字*で表示)。「戻る」ボタンは`#backButton`スタイル・ルール(`stylesheet.css`で定義)に依存するため、JSFのIDが付加されると、このルールが妨げられます。これを回避するには、`prependId`を`false`に設定します。
-[start=10]
+
. プロジェクトを再度実行します(「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックするか、[F6] (Macの場合は[fn]-[F6])を押します)。開始ページに数値を入力し、「送信」をクリックします。レスポンス・ページに`<p>`タグのないレスポンス・メッセージが表示され、「戻る」ボタンが正しい位置に配置されます。
image::images/response3.png[title="ブラウザでのプロジェクトの現在のステータスの表示"]
-[start=11]
+
. 「戻る」ボタンをクリックします。`UserNumberBean`の`userNumber`プロパティの現在の値はJSF`inputText`コンポーネントにバインドされているため、前に入力した数値がテキスト・フィールドに表示されます。
-[start=12]
+
. IDEの「出力」ウィンドウでサーバー・ログを確認し([Ctrl]-[4]、Macの場合は[⌘]-[4])、正しい推測値を判断します。
なんらかの理由でサーバー・ログが表示されない場合は、「サービス」ウィンドウに切り替え([Ctrl]-[5]、Macの場合は[⌘]-[5])、「サーバー」ノードを展開します。次に、プロジェクトがデプロイされているGlassFishサーバーを右クリックし、「サーバー・ログを表示」を選択します。サーバー・ログに数値が見つけることができない場合は、プロジェクト・ノードを右クリックし、「消去してビルド」を選択して、アプリケーションを再ビルドしてみてください。
-[start=13]
+
. 正しい数値を入力し、「送信」をクリックします。アプリケーションは、入力された数値を現在保存されている数値と比較し、適切なメッセージを表示します。
image::images/yay.png[title="一致する数値を入力すると正しいレスポンスが表示される"]
-[start=14]
+
. 「戻る」ボタンをもう一度クリックします。前に入力した数値はテキスト・フィールドに表示されていません。`UserNumberBean`の`getResponse()`メソッドは、正しい数値が推測されると<<getResponse,現在のユーザー・セッションを無効にします>>。
@@ -712,7 +712,7 @@
ウィザードが完了すると、テンプレート・ファイルがエディタに開かれます。ブラウザでこのテンプレートを表示するには、エディタ内を右クリックし、「表示」を選択します。
-[start=4]
+
. テンプレート・ファイルのマークアップを確認します。次の点を確認します。
* `facelets`タグ・ライブラリがページの`<html>`タグ内で宣言されています。タグ・ライブラリに接頭辞`ui`があります。
@@ -746,10 +746,10 @@
</div>
----
-[start=5]
+
. <<staticPage,開始>>ページと<<responsePage,レスポンス>>・ページを再度確認します。2つのページ間で異なるコンテンツは、グレーの四角形の中にあるタイトルとテキストのみです。そのため、テンプレートで残りのすべてのコンテンツを提供できます。
-[start=6]
+
. テンプレート・ファイルのすべてのコンテンツを、次のコンテンツに置き換えます。
[source,html]
@@ -783,7 +783,7 @@
* `<ui:insert>`タグ(およびそれらに含まれる`<div>`タグ)が、`box`という名前のものを除き、すべて除去されます。
* ページ・タイトルを囲んで`<ui:insert>`タグ・ペアが配置され、`title`という名前が付けられています。
-[start=7]
+
. 該当するコードを、`index.xhtml`または`response.xhtml`ファイルからテンプレートにコピーします。次に*太字*で示されているコンテンツを、テンプレート・ファイルの`<h:body>`タグに追加します。
[source,html]
@@ -801,7 +801,7 @@
</h:body>
----
-[start=8]
+
. プロジェクトを実行します。ブラウザで開始ページが開いたら、URLを次のように変更します。
[source,java]
@@ -830,10 +830,10 @@
image::images/template-client.png[title="Faceletsテンプレート・クライアント・ウィザード"]
-[start=4]
+
. 「終了」をクリックします。新しいテンプレート・クライアント・ファイル`greeting.xhtml`が生成され、エディタに表示されます。
-[start=5]
+
. マークアップを確認します。*太字*で強調表示されているコンテンツを確認してください。
[source,xml]
@@ -861,7 +861,7 @@
----
テンプレート・クライアント・ファイルは、`<ui:composition>`タグの`template`属性を使用して、テンプレートを参照します。テンプレートには`title`および`box`の`<ui:insert>`タグが含まれているため、このテンプレート・クライアントには、これらの2つの名前の`<ui:define>`タグが含まれます。`<ui:define>`タグの間で指定するコンテンツは、テンプレートの対応する名前の`<ui:insert>`タグの間に挿入されるコンテンツです。
-[start=6]
+
. ファイルのタイトルとして「`greeting`」を指定します。次に*太字*で示す変更を加えます。
[source,xml]
@@ -872,7 +872,7 @@
</ui:define>
----
-[start=7]
+
. `index.xhtml`ファイルに切り替え([Ctrl]-[Tab])、表示されるページで、通常はグレーの四角形内に表示されるコンテンツをコピーします。`greeting.xhtml`に切り替え、テンプレート・クライアント・ファイルに貼り付けます。変更場所は*太字*で示されています。
[source,xml]
@@ -897,7 +897,7 @@
</ui:define>
----
-[start=8]
+
. ファイルのJSF HTMLタグ・ライブラリを宣言します。エラーのフラグが付いているタグ(「`h`」接頭辞を使用するタグ)にカーソルを置き、[Ctrl]-[Space]を押します。コード補完による候補の一覧から、タグを選択します。タグ・ライブラリ名前空間がファイルの`<html>`タグ(*太字*で表示)に追加され、エラー表示が消えます。
[source,java]
@@ -951,14 +951,14 @@
----
`title`および`box`の`<ui:define>`タグ間で指定されているコンテンツを除き、ファイルは`greeting.xhtml`と同じになります。
-[start=2]
+
. プロジェクトの`web.xml`デプロイメント・ディスクリプタで、アプリケーションを実行したときに`greeting.xhtml`ページが開かれるように、開始ファイルのエントリを変更します。
「プロジェクト」ウィンドウで「構成ファイル」>「`web.xml`」をダブルクリックして、エディタで開きます。「ページ」タブで「開始ファイル」フィールドを「`faces/greeting.xhtml`」に変更します。
image::images/welcome-files.png[title="デプロイメント・ディスクリプタでの「開始ファイル」エントリの変更"]
-[start=3]
+
. プロジェクトを実行して、ブラウザでどのように表示されるかを確認します。[F6] (Macの場合は[fn]-[F6])を押すか、メイン・ツールバーの「プロジェクトの実行」(image:images/run-project-btn.png[])ボタンをクリックします。プロジェクトがGlassFishサーバーにデプロイされ、ブラウザで開かれます。
Faceletsテンプレートおよびテンプレート・クライアント・ファイルを使用して、アプリケーションは以前とまったく同じように動作します。アプリケーションの開始ページとレスポンス・ページで重複しているコードを取り除くことによって、アプリケーションのサイズを小さくするとともに、後でページが追加されたときに重複したコードを記述することがなくなりました。これにより、大規模なプロジェクトで作業するときに、開発作業が効率化され、管理が容易になります。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_pt_BR.asciidoc
index 16c4f16..442c322 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_pt_BR.asciidoc
@@ -82,12 +82,12 @@
*Observação.* Você será solicitado a resolver a referência às bibliotecas JUnit quando abrir o projeto NetBeans, caso não tiver instalado o plug-in JUnit quando instalou o IDE.
-[start=3]
+
. Execute o projeto para ver como ele é em um browser. Clique com o botão direito do mouse no nó `jsfDemo` do projeto, na janela Projetos e selecione Executar ou clique no botão ( image:images/run-project-btn.png[] ) Executar Projeto na barra de ferramentas principal. O projeto é encapsulado e implantado no GlassFish Server e o browser é aberto para exibir a página de boas-vindas (`index.xhtml`).
image::images/run-project.png[title="Executar o projeto para exibi-lo em um browser"]
-[start=4]
+
. Clique no botão Submeter. A página de resposta (`response.xhtml`) é exibida desta forma:
image::images/response.png[title="A página de boas-vindas e de resposta, atualmente, são páginas estáticas"]
@@ -95,13 +95,13 @@
No momento, as páginas de boas-vindas e resposta são estáticas e, juntamente com o arquivo `stylesheet.css` e a imagem `duke.png`, são os únicos arquivos da aplicação acessíveis do browser.
-[start=5]
+
. Na janela Projetos (Ctrl-1; ⌘-1 no Mac), clique com o botão direito do mouse no nó do projeto e escolha Propriedades para abrir a janela Propriedades do Projeto.
-[start=6]
+
. Selecione a categoria Frameworks e, em seguida e clique no botão Adicionar.
-[start=7]
+
. Selecione JavaServer Faces na caixa de diálogo Adicionar um Framework. Clique em OK.
image::images/add-framework.png[title="Adicionar suporte JSF a um projeto existente"]
@@ -110,7 +110,7 @@
image::images/libraries-tab.png[title="Especificar o acesso a bibliotecas do JSF 2.x"]
-[start=8]
+
. Clique na guia Configuração. É possível especificar como o servlet Faces é registrado no descritor de implantação do projeto. Também é possível indicar se você deseja utilizar Facelets ou páginas JSP no projeto.
image::images/jsf-configuration.png[title="Especificar idioma preferencial e opções de servlet do Faces"]
@@ -119,7 +119,7 @@
image::images/jsf-components.png[title="Especificar idioma preferencial e opções de servlet do Faces"]
-[start=9]
+
. Clique em OK para concluir as alterações e sair da janela Propriedades do Projeto.
Depois de adicionar o suporte JSF ao seu projeto, o descritor de implantação `web.xml` do projeto é modificado para que tenha a aparência a seguir: (Alterações em *negrito*.)
@@ -183,7 +183,7 @@
image::images/managed-bean.png[title="Utilizar o Ben Gerenciado pelo JSF para criar um novo Bean gerenciado"]
-[start=3]
+
. Clique em Finalizar. A classe `UserNumberBean` é gerada e aberta no editor. Observe as anotações a seguir (mostradas em *negrito*):
[source,java]
@@ -241,10 +241,10 @@
O código acima gera um número aleatório entre 0 e 10, e o número é exibido no log do servidor.
-[start=2]
+
. Corrigir importações. Para isso, clique no indicador de dica ( image:images/hint-icon.png[] ) exibido na margem esquerda do editor, em seguida, selecione a opção para importar `java.util.Random` para a classe.
-[start=3]
+
. Execute o projeto novamente (clique no botão ( image:images/run-project-btn.png[] ) Executar Projeto ou pressione F6; fn-F6 no Mac). Quando você executa seu projeto, o arquivo de log do servidor é aberto automaticamente na janela de Saída.
image::images/output1.png[title="O arquivo de log do servidor é aberto automaticamente na janela de Saída"]
@@ -255,7 +255,7 @@
_Se o valor do atributo `eager()` for `true` e o valor de `managed-bean-scope` for "application", o runtime deverá instanciar essa classe quando a aplicação for iniciada. Essa instanciação e o armazenamento da instância devem ocorrer antes das solicitações serem processadas. Se _eager_ não estiver especificado ou for `false`, ou se o `managed-bean-scope` for diferente de "application", ocorrerá a instanciação "lenta" default e o armazenamento com escopo do Bean gerenciado._
-[start=4]
+
. Como o `UserNumberBean` está no escopo da sessão, implemente-o na interface `Serializable`.
[source,java]
@@ -286,12 +286,12 @@
*Integer userNumber;*
----
-[start=2]
+
. Clique com o botão direito do mouse no editor e selecione Inserir Código (Alt-Insert; Ctrl-I no Mac). Escolha Getter e Setter.
image::images/getter-setter.png[title="Utilizar o IDE para gerar métodos de acesso para as propriedades"]
-[start=3]
+
. Selecione a opção `userNumber` : `Integer`. Clique em Gerar.
image::images/generate-getters-setters.png[title="Utilizar o IDE para gerar métodos de acesso para as propriedades"]
@@ -299,7 +299,7 @@
Observe que os métodos `getUserNumber()` e `setUserNumber(Integer userNumber)` são adicionados à classe.
-[start=4]
+
. Crie uma propriedade `response`. Declare uma `String` denominada `response`.
[source,java]
@@ -314,7 +314,7 @@
*String response;*
----
-[start=5]
+
. Crie um método getter para `response`. (Esta aplicação não precisará de um setter.) Você pode utilizar a janela pop-up Gerar código do IDE mostrada acima, na etapa 2, para gerar o código do modelo. Neste tutorial, basta colar o método a seguir na classe.
[source,html]
@@ -340,7 +340,7 @@
1. Testa se o número informado pelo usuário (`userNumber`) é igual ao número aleatório gerado para a sessão (`randomInt`) e retorna uma resposta `String` apropriada.
2. Isso invalida a sessão do usuário se o usuário adivinhar o número correto (isto é, se `userNumber` for igual a `randomInt`). Isso é necessário para que um novo número seja gerado, caso o usuário queira jogar novamente.
-[start=6]
+
. Clique com o botão direito do mouse no editor e selecione Corrigir Importações (Alt-Shift-I; &#8984-Shift-I no Mac). As instruções de importação são criadas automaticamente para:
* `javax.servlet.http.HttpSession`
* `javax.faces.context.FacesContext`
@@ -378,7 +378,7 @@
As páginas de índice e resposta já contêm os componentes de IU do JSF necessários para este exercício. Basta eliminar os comentários existentes e fazer comentários nos elementos HTML que estiverem sendo usados.
-[start=2]
+
. Comente no elemento do form HTML. Para isso, realce o elemento de form HTML, como na imagem a seguir, e pressione Ctrl-/ (&#8984-/ no Mac).
*Observação: *para realçar, clique e arraste o elemento no editor com o mouse ou, utilizando o teclado, mantenha Shift pressionado e pressione as teclas de seta.
@@ -388,7 +388,7 @@
Utilize Ctrl-/ (&#8984-/ no Mac) para alternar entre comentários no editor. É possível aplicar esse atalho do teclado em outros tipos de arquivo, como Java e CSS.
-[start=3]
+
. Elimine o comentário do componente do form HTML JSF. Realce o componente, conforme indicado na imagem a seguir, e pressione Ctrl-/ (&#8984-/ no Mac).
*Observação.* Pode ser necessário pressionar Ctrl-/ duas vezes para remover os comentários do código.
@@ -400,7 +400,7 @@
image::images/undeclared-component.png[title="O editor fornecerá mensagens de erro para os componentes não declarados"]
-[start=4]
+
. Para declarar esses componentes, utilize a funcionalidade autocompletar código do IDE para adicionar o namespace da biblioteca de tag à tag `<html>` da página. Coloque o cursor em qualquer uma das tags não declaradas, pressione Alt-Enter e clique em Inserir para adicionar a biblioteca de tags sugerida. (Se houver várias opções, certifique-se de selecionar a tag exibida no editor antes de clicar em Inserir.) O namespace da biblioteca de tags HTML JSF será adicionado à tag `<html>` (mostrado em *negrito* abaixo), e os indicadores de erro desaparecerão.
*Observação.* Se o IDE não fornecer a opção de adicionar a biblioteca de tags, será necessário modificar manualmente o elemento ``<html>`` .
@@ -413,7 +413,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. Utilize a linguagem de expressão JSF para vincular a propriedade `userNumber` do `UserNumberBean` ao componente `inputText`. O atributo `value` pode ser utilizado para especificar o valor atual do componente renderizado. Digite o código exibido em *negrito* abaixo.
[source,java]
@@ -426,7 +426,7 @@
A linguagem de expressão JSF utiliza a sintaxe `#{}`. Dentro desses delimitadores, especifique o nome do bean gerenciado e a propriedade do Bean que deseja aplicar, separados por um ponto (`.`). Agora, quando os dados do form forem enviados ao servidor, o valor será salvo automaticamente na propriedade `userNumber` utilizando o setter da propriedade (`setUserNumber()`). Além disso, quando a página for solicitada e um valor para `userNumber` já tiver sido definido, o valor será exibido automaticamente no componente `inputText` renderizado. Para obter mais informações, consulte o link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-develop001.htm#BNAQP[+Tutorial do Java EE 7: 12.1.2 Usando o EL para Beans Gerenciados de Referência+].
-[start=6]
+
. Especifique o destino da solicitação chamada ao clicar no botão do form. Na versão HTML do form, você pode fazer isso utilizando o atributo `action` da tag `<form>`. Com o JSF, você pode utilizar o atributo `action` do `commandButton`. Além disso, devido à funcionalidade de navegação implícita do JSF 2.x, basta especificar apenas o nome do arquivo de destino, sem a sua extensão.
Digite o código exibido em *negrito* abaixo.
@@ -462,14 +462,14 @@
As etapas de 7 a 12 a seguir são opcionais. Se quiser construir o projeto rapidamente, passe para <<response,`response.xhtml`>>.
-[start=7]
+
. Verifique se a expressão EL acima chama o método `setUserNumber()` quando a solicitação é processada. Para isso, utilize o depurador Java do IDE.
Alterne para a classe `UserNumberBean` (Pressione Ctrl-Tab e selecione o arquivo na lista.) Defina um ponto de interrupção na assinatura do método `setUserNumber()`. É possível fazer isso clicando na margem esquerda. É exibido um indicador vermelho, mostrando que um ponto de interrupção do método foi definido.
image::images/set-breakpoint.png[title="Clique no margem esquerda do editor para definir pontos de interrupção"]
-[start=8]
+
. Clique no botão Depurar Projeto (image:images/breakpoint-btn.png[]) na barra de ferramentas principal do IDE. A sessão de depuração é iniciada, e a página de boas-vindas do projeto é aberta no browser.
*Observações.*
@@ -477,15 +477,15 @@
* Talvez seja necessário confirmar a porta do servidor para depurar a aplicação.
* Se uma caixa de diálogo Depurar Projeto for exibida, selecione a opção 'Java do Servidor' default e clique em Depurar.
-[start=9]
+
. No browser, digite um número no form e clique no botão "Submeter".
-[start=10]
+
. Volte ao IDE e inspecione a classe `UserNumberBean`. O depurador será interrompido no método `setUserNumber()`.
image::images/debugger-suspended.png[title="O depurador é suspenso de acordo com pontos de interrupção"]
-[start=11]
+
. Abra a janela Variáveis do Depurador (Selecione Janela > Depuração > Variáveis, ou pressione Ctrl-Shift-1). Você verá os valores das variáveis no ponto em que o depurador foi suspenso.
image::images/variables-window.png[title="Monitorar valores das variáveis utilizando a janela Variáveis do Depurador"]
@@ -493,7 +493,7 @@
Na imagem acima, o valor '`4`' foi fornecido à variável `userNumber` na assinatura `setUserNumber()`. (O número 4 foi inserido no form.) '`this`' se refere ao objeto `UserNumberBean` criado para a sessão do usuário. Abaixo dele, você verá que o valor da propriedade `userNumber` é atualmente `null`.
-[start=12]
+
. Na barra de ferramentas do Depurador, clique no botão Fazer Step Into (image:images/step-into-btn.png[]). O depurador executará a linha na qual ele está atualmente suspenso. A janela Variáveis se será atualiza, indicando as alterações na execução.
image::images/variables-window2.png[title="A janela de variáveis é atualizada ao percorrer o código"]
@@ -501,7 +501,7 @@
A propriedade `userNumber` agora está definida com o valor inserido no form.
-[start=13]
+
. Escolha Depurar > Finalizar Sessão do Depurador (Shift-F5; Shift-Fn-F5 no Mac) no menu principal para interromper o depurador.
@@ -514,7 +514,7 @@
*Observação: *Para realçar, clique e arraste o mouse no editor ou, utilizando o teclado, mantenha Shift pressionado e utilize as teclas de seta.
-[start=3]
+
. Elimine o comentário do componente do form HTML JSF. Realce as tags `<h:form>` de abertura e fechamento e o código entre elas, depois pressione Ctrl-/ (&#8984-/ no Mac).
Neste estágio, o código entre as tags `<body>` terão a seguinte aparência:
@@ -557,7 +557,7 @@
Após eliminar o comentário do componente de form HTML JSF, o editor indicará que as tags `<h:form>` e `<h:commandButton>` não foram declaradas.
-[start=4]
+
. Para declarar esses componentes, utilize a funcionalidade autocompletar código do IDE para adicionar o namespace da biblioteca de tag à tag `<html>` da página.
Utilize o suporte para a funcionalidade autocompletar código do editor para adicionar os namespaces JSF necessários ao arquivo. Quando você seleciona uma tag JSF ou Facelets por meio da funcionalidade autocompletar código, o namespace necessário é automaticamente adicionado ao elemento raiz do documento. Para obter mais informações, consulte link:jsf20-support.html#facelets[+Suporte JSF 2.x no NetBeans IDE+].
@@ -576,7 +576,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. Especifique o destino da solicitação que é chamada quando o usuário clica no botão do form. Você deseja definir o botão para que um usuário retorne à página de índice ao clicar nele. Para isso, utilize, o atributo `action` do `commandButton`. Digite o código exibido em *negrito*.
[source,xml]
@@ -592,7 +592,7 @@
*Observação: *Ao digitar `action="index"`, você estará confiando na funcionalidade de navegação implícita do JSF. Quando um usuário clica no botão do form, o runtime do JSF procura um arquivo denominado `índice`. Ele supõe que a extensão do arquivo é a mesma extensão utilizada pelo arquivo que originou a solicitação (`response*.xhtml*`) e procura o arquivo `index.xhtml` no mesmo diretório do arquivo de origem (por exemplo, webroot).
-[start=6]
+
. Substitua o texto estático "[ response here ]" pelo valor da propriedade `response` do `UserNumberBean`. Para isso, utilize a linguagem de expressão JSF. Digite (em *negrito*):
[source,html]
@@ -603,7 +603,7 @@
<h4>*<h:outputText value="#{UserNumberBean.response}"/>*</h4>
----
-[start=7]
+
. Execute o projeto (clique no botão ( image:images/run-project-btn.png[] ) Executar Projeto ou pressione F6; fn-F6 no Mac). Quando a página de boas-vindas for exibida no browser, informe um número e clique em `submeter`. Você verá a página de resposta com uma aparência semelhante à seguinte (contanto que você não adivinhe o número correto):
image::images/response2.png[title="Exibir o status atual do projeto em um browser"]
@@ -616,7 +616,7 @@
As duas etapas a seguir corrigirão estes pontos, respectivamente.
-[start=8]
+
. Defina o atributo `escape` da tag `<h:outputText>` como `false`. Coloque o cursor entre `outputText` e `value`, insira um espaço e pressione Ctrl-Espaço para chamar a funcionalidade autocompletar código. Role para baixo para selecionar o atributo `escape` e inspecione a documentação.
image::images/escape-false.png[title="Pressione Ctrl-Espaço para exibir possíveis valores do atributo e a documentação"]
@@ -632,7 +632,7 @@
<h4><h:outputText *escape="false"* value="#{UserNumberBean.response}"/></h4>
----
-[start=9]
+
. Defina, o atributo `prependId` da tag `<h:form>` como `false`. Coloque o cursor logo depois de '`m`' em `<h:form>`, insira um espaço, em seguida, pressione Ctrl-Espaço para chamar a funcionalidade autocompletar código. Role para baixo para selecionar o atributo `prependId` e inspecione a documentação. Clique em Inserir e digite `false` como valor.
[source,java]
@@ -657,26 +657,26 @@
O ID do elemento do form é `j_idt5` e esse ID é _precedido_ pelo ID do botão Voltar incluído no form (mostrado em *negrito* acima). Como o botão Voltar depende da regra de estilo do `#backButton` (definido em `stylesheet.css`), essa regra se torna um empecilho quando o ID do JSF é inserido como prefixo. Isso pode ser evitado ao definir `prependId` como `false`.
-[start=10]
+
. Execute o projeto novamente (clique no botão ( image:images/run-project-btn.png[] ) Executar Projeto ou pressione F6; fn-F6 no Mac). Insira um número na página de boas-vindas e clique em Submeter. A página de resposta agora exibe a mensagem de resposta sem as tags `<p>` e o botão Voltar está no lugar correto.
image::images/response3.png[title="Exibir o status atual do projeto em um browser"]
-[start=11]
+
. Clique no botão Voltar. Como o valor atual da propriedade `userNumber` do `UserNumberBean` está vinculado ao componente JSF `inputText`, o número inserido anteriormente agora será exibido no campo de texto.
-[start=12]
+
. Inspecione o log do servidor na janela de Saída do IDE (Ctrl-4; &#8984-4 no Mac) para determinar qual é o suposto número correto.
Se, por alguma razão, você não puder ver o log do servidor, você poderá abri-lo alternando para a janela Serviços (Ctrl-5; &#8984-5 no Mac) e expandindo o nó Servidores. Em seguida, clique com o botão direito do mouse no GlassFish Server no qual o projeto está implantado e selecione Exibir Log do Servidor. Se você não conseguir ver o número no log do servidor, tente construir novamente a aplicação clicando com o botão direito do mouse no nó do projeto e selecionando Limpar e Construir Projeto.
-[start=13]
+
. Digite o número correto e clique em Submeter. A aplicação irá comparar a sua entrada com o número atualmente salvo e exibirá a mensagem apropriada.
image::images/yay.png[title="A resposta correta será exibida ao inserir o número correspondente"]
-[start=14]
+
. Clique novamente no botão Voltar. Observe que o número inserido anteriormente não será mais exibido no campo de texto. Lembre-se de que o método `getResponse()` do `UserNumberBean` <<getResponse,invalida a sessão atual do usuário>> quando o número correto é descoberto.
@@ -712,7 +712,7 @@
Depois de concluir o assistente, o arquivo de modelo é aberto no editor. Para exibir o modelo em um browser, clique com o botão direito do mouse no Editor e selecione Exibir.
-[start=4]
+
. Examine a marcação do arquivo de modelo. Observe os pontos a seguir:
* A biblioteca de tags `facelets` é declarada na tag `<html>` da página. A biblioteca de tags possui o prefixo `ui`.
@@ -746,10 +746,10 @@
</div>
----
-[start=5]
+
. Examine novamente as páginas de <<staticPage,boas-vindas>> e de <<responsePage,resposta>>. O único conteúdo que é alterado nas duas páginas é o título e o texto contido no quadro cinza. O modelo, portanto, pode fornecer todo o conteúdo restante.
-[start=6]
+
. Substitua todo o conteúdo de seu arquivo de modelo pelo conteúdo abaixo.
[source,html]
@@ -783,7 +783,7 @@
* Todas as tags `<ui:insert>` (e suas tags `<div>`) foram removidas, exceto uma denominada `box`.
* Um par de tags `<ui:insert>` foi colocado no título da página e foi denominado `title`.
-[start=7]
+
. Copie o código relevante do arquivo `index.xhtml` ou `response.xhtml` para o modelo. Adicione o conteúdo mostrado em *negrito* abaixo das tags `<h:body>` do arquivo de modelo.
[source,html]
@@ -801,7 +801,7 @@
</h:body>
----
-[start=8]
+
. Execute o projeto. Quando a página de boas-vindas abrir no browser, modifique o URL para o seguinte:
[source,java]
@@ -830,10 +830,10 @@
image::images/template-client.png[title="Assistente de Cliente de Modelo de Facelets"]
-[start=4]
+
. Clique em Finalizar. O novo arquivo de cliente de modelo `greeting.xhtml` é gerado e exibido no editor.
-[start=5]
+
. Examine a marcação. Observe o conteúdo realçado em *negrito*.
[source,xml]
@@ -861,7 +861,7 @@
----
O arquivo de cliente de modelo faz referência a um modelo utilizando o atributo `template` da tag `<ui:composition>`. Como o modelo contém tags `<ui:insert>` de `title` e `box`, esse cliente de modelo contém as tags `<ui:define>` desses dois nomes. O conteúdo especificado entre as tags `<ui:define>` será o conteúdo inserido no modelo entre as tags `<ui:insert>` do nome correspondente.
-[start=6]
+
. Especifique `greeting` como o título do arquivo. Faça a seguinte alteração em *negrito*.
[source,xml]
@@ -872,7 +872,7 @@
</ui:define>
----
-[start=7]
+
. Alterne para o arquivo `index.xhtml` (pressione Ctrl-Tab) e copie o conteúdo que normalmente aparece no quadro cinza exibido na página renderizada. Em seguida, volte ao `greeting.xhtml` e cole-o no arquivo de cliente de modelo. (Alterações em *negrito*.)
[source,xml]
@@ -897,7 +897,7 @@
</ui:define>
----
-[start=8]
+
. Declare a biblioteca de tags HTML JSF do arquivo. Coloque o cursor em qualquer um das tags sinalizadas com um erro (qualquer tag com o prefixo `h`') e pressione Ctrl-Espaço. Em seguida, selecione a tag na lista de sugestões da funcionalidade autocompletar código. O namespace da biblioteca de tags será adicionado à tag `<html>` do arquivo (mostrado em *negrito* abaixo) e os indicadores de erro desaparecerão.
[source,java]
@@ -951,14 +951,14 @@
----
Observe que o arquivo é idêntico a `greeting.xhtml`, exceto pelo conteúdo especificado entre as tags `<ui:define>` de `title` e `box`.
-[start=2]
+
. No descritor de implantação `web.xml` do projeto, modifique a entrada do arquivo de boas-vindas para que `greeting.xhtml` seja a página exibida quando a aplicação for executada.
Na janela Projetos, clique duas vezes em Arquivos de Configuração > `web.xml` para abri-lo no editor. Na guia Páginas, altere o campo Arquivos de Boas-Vindas para `faces/greeting.xhtml`.
image::images/welcome-files.png[title="Alterar a entrada de Arquivos de Boas-Vindas no descritor de implantação"]
-[start=3]
+
. Execute o projeto para ver como ele é em um browser. Pressione F6 (fn-F6 no Mac) ou clique no botão (image:images/run-project-btn.png[]) Executar Projeto na barra de ferramentas principal. O projeto será implantado no GlassFish Server e aberto em um browser.
Quando você utiliza o modelo de Facelets e os arquivos de clientes de modelo, a aplicação se comportará exatamente da mesma forma que antes. Fatorando o código duplicado nas páginas de boas-vindas e de resposta da aplicação, você consegue reduzir o tamanho da aplicação e eliminar a possibilidade de escrever mais códigos duplicados, caso mais páginas sejam adicionadas posteriormente. Isso pode tornar o desenvolvimento mais fácil e eficiente ao trabalhar em grandes projetos.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ru.asciidoc
index 90bd034..3b283c5 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_ru.asciidoc
@@ -86,12 +86,12 @@
*Примечание.* При открытии проекта NetBeans может быть отображен запрос на разрешение ссылки на библиотеки JUnit, если при установке IDE не был установлен подключаемый модуль JUnit.
-[start=3]
+
. Выполните проект и посмотрите, как он выглядит в браузере. Либо щелкните правой кнопкой мыши узел проекта `jsfDemo` в окне 'Проекты' и выберите 'Запустить' или нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ) на главной панели инструментов. Проект запакован и разворачивается на сервере GlassFish, а в браузере открывается страница приветствия(`index.xhtml`).
image::images/run-project.png[title="Запустите проект, чтобы просмотреть его в браузере."]
-[start=4]
+
. Нажмите кнопку "Отправить". Страница ответа (`response.xhtml`) отображается следующим образом:
image::images/response.png[title="Страницы приветствия и отклика в настоящее время являются статическими страницами"]
@@ -99,13 +99,13 @@
В настоящее время страницы приветствия и отклика являются статическими, и совместно с файлом `stylesheet.css` и изображением `duke.png` они являются единственными файлами приложений, доступными из браузера.
-[start=5]
+
. В окне 'Проекты' (Ctrl-1; ⌘ -1 в Mac) щелкните правой кнопкой мыши узел проекта и выберите 'Свойства', чтобы открыть окно 'Свойства проекта'.
-[start=6]
+
. Выберите категорию 'Платформы', а затем нажмите кнопку 'Добавить'.
-[start=7]
+
. Выберите 'JavaServer Faces' в диалоговом окне 'Добавление платформы'. Нажмите кнопку 'ОК'.
image::images/add-framework.png[title="Добавление поддержки JSF к существующему проекту"]
@@ -114,7 +114,7 @@
image::images/libraries-tab.png[title="Укажите доступ к библиотекам JSF 2.x"]
-[start=8]
+
. Выберите вкладку "Настройка". Можно указать способ регистрации сервлета Faces в дескрипторе развертывания проекта. Также можно указать, нужно ли в проекте использовать страницы Facelets или JSP.
image::images/jsf-configuration.png[title="Укажите параметры сервлета Faces и предпочитаемый язык"]
@@ -123,7 +123,7 @@
image::images/jsf-components.png[title="Укажите параметры сервлета Faces и предпочитаемый язык"]
-[start=9]
+
. Нажмите кнопку "ОК" для подтверждения изменений и закройте окно "Свойства проекта".
После добавления поддержки JSF к проекту дескриптор развертывания `web.xml` изменяется и выглядит следующим образом. (Изменения *выделены полужирным шрифтом*.)
@@ -187,7 +187,7 @@
image::images/managed-bean.png[title="Используйте мастер управляемых компонентов JSF для создания нового управляемого компонента"]
-[start=3]
+
. Нажмите кнопку "Завершить". Класс `UserNumberBean` будет создан и открыт в редакторе. Обратите внимание на следующие аннотации (*выделено полужирным шрифтом*):
[source,java]
@@ -245,10 +245,10 @@
Вышеуказанный код создает случайное число от 0 до 10 и записывает это число в протокол сервера.
-[start=2]
+
. Исправьте операторы импорта. Для этого щелкните метку4 подсказки ( image:images/hint-icon.png[] ), которая отображается на левой границе редактора, затем выберите параметр для импорта `java.util.Random` в класс.
-[start=3]
+
. Повторно запустите проект (нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ) или нажмите F6; fn-F6 в Mac). При выполнении проекта файл протокола сервера автоматически открывается в окне вывода.
image::images/output1.png[title="Файл журнала сервера автоматически открывается в окне вывода."]
@@ -259,7 +259,7 @@
_Если атрибут `eager()` имеет значение `true`, а значением `managed-bean-scope` является "application", то в среде выполнения при запуске приложения должен быть создан экземпляр этого класса. Создание и сохранение экземпляра должно осуществляться до обслуживания запросов. Если атрибут _eager_ не указан либо имеет значение `false` или элементу `managed-bean-scope` не присвоено значение "приложение", по умолчанию происходит "ленивое" создание экземпляра и контекстное сохранение управляемого компонента._
-[start=4]
+
. Поскольку класс `UserNumberBean` входит в контекст сеанса, реализуется интерфейс `Serializable`.
[source,java]
@@ -290,12 +290,12 @@
*Integer userNumber;*
----
-[start=2]
+
. Щелкните правой кнопкой мыши в редакторе и выберите команду "Вставить код" (ALT+INS; CTRL+I на компьютере Mac). Выберите методы получения и установки.
image::images/getter-setter.png[title="Используйте IDE для создания методов доступа для свойств"]
-[start=3]
+
. Выберите параметр `userNumber`: `Integer`. Нажмите кнопку "Создать".
image::images/generate-getters-setters.png[title="Используйте IDE для создания методов доступа для свойств"]
@@ -303,7 +303,7 @@
Обратите внимание на то, что методы `getUserNumber()` и `setUserNumber(Integer userNumber)` добавлены в класс.
-[start=4]
+
. Создайте свойство `response`. Объявите `String` с именем `response`.
[source,java]
@@ -318,7 +318,7 @@
*String response;*
----
-[start=5]
+
. Создайте метод получения для `response`. (Для этого приложения не требуется метод установки). Для создания кода шаблона в среде IDE можно использовать всплывающее окно "Создание кода", упомянутое выше в действии 2. Однако в целях изучения данного руководства просто вставьте нижеуказанный метод в класс.
[source,html]
@@ -344,7 +344,7 @@
1. Тестирует введенное пользователем число (`userNumber`) на равенство случайному числу, сгенерированному для сеанса (`randomInt`), и возвращает соответствующий ответ `String`.
2. Определяет пользовательский сеанс как недействительный, если пользователь ввел правильное число (т.е., если `userNumber` равно `randomInt`). Это необходимо для того, чтобы новое сгенерированное число побудило пользователя сыграть еще раз.
-[start=6]
+
. Щелкните правой кнопкой мыши в области редактора и выберите команду "Исправить операторы импорта" (ALT+SHIFT+I; &#8984+SHIFT+I на компьютере Mac). Параметры импорта автоматически создаются для:
* `javax.servlet.http.HttpSession`
* `javax.faces.context.FacesContext`
@@ -382,7 +382,7 @@
Как индекс, так и страницы ответов уже содержат компоненты пользовательского интерфейса JSF, необходимые для этого упражнения. Просто раскомментируйте их и закомментируйте элементы HTML, используемые в настоящий момент.
-[start=2]
+
. Закомментируйте элемент формы HTML. Для этого выделите элемент формы HTML, как показано на изображении ниже, затем нажмите CTRL+/ (&#8984+/ на компьютере Mac).
*Примечание. *Для выделения воспользуйтесь функцией перетаскивания в редакторе с помощью мыши или с помощью клавиатуры удерживайте клавишу Shift и используйте клавиши со стрелками.
@@ -392,7 +392,7 @@
Для переключения комментариев нажмите сочетание клавиш CTRL+/ (&#8984+/ на компьютере Mac). Эту комбинацию клавиш также можно использовать для других типов файлов, например, Java и CSS.
-[start=3]
+
. Раскомментируйте компонент формы HTML для JSF. Выделите этот компонент, как показано на рисунке ниже, затем нажмите CTRL+/ (&#8984+/ на компьютере Mac).
*Примечание.* Возможно, вам придется нажать Ctrl-/ дважды, чтобы раскомментировать код.
@@ -404,7 +404,7 @@
image::images/undeclared-component.png[title="Редактор обеспечивает сообщения об ошибках для необъявленных компонентов"]
-[start=4]
+
. Для объявления этих компонентов используйте автозавершение кода IDE, чтобы добавить пространство имен библиотеки тегов в тег `<html>` страницы. Наведите курсор на любой из необъявленных тегов, нажмите Alt-Enter и нажмите Enter, чтобы добавить предложенные библиотеки тегов. (При наличии нескольких параметров перед нажатием клавиши ВВОД убедитесь, что выбран тег, отображаемый в редакторе.) Пространство имен библиотеки тегов HTML для JSF добавляется к тегу `<html>` (*выделено ниже полужирным шрифтом*), и указания на ошибки исчезают.
*Примечание.* Если в IDE нет возможности добавить библиотеку тегов, потребуется вручную изменить элемент ``<html>`` .
@@ -417,7 +417,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. Используйте язык выражения JSF для привязки свойства `userNumber` для `UserNumberBean` к компоненту `inputText`. Атрибут `value` используется для указания текущего значения визуализируемого компонента. Введите в код, отображаемый ниже *полужирным шрифтом*.
[source,java]
@@ -430,7 +430,7 @@
В языке выражения JSF используется синтаксис `#{}`. Внутри этих парных символов указывается имя требуемого управляемого компонента и его свойство, разделенные точкой (`.`). Теперь при отправке данных формы на сервер значение автоматически сохраняется в свойстве `userNumber` с помощью метода установки свойств (`setUserNumber()`). Кроме того, если страница запрошена и значение для `userNumber` уже установлено, значение автоматически отображается в визуализированном компоненте `inputText`. Дополнительные сведения приведены в link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-develop001.htm#BNAQP[+Руководстве по Java EE 7. Глава 12.1.2 Использование языка выражений для создания ссылок на управляемые сеансные объекты+].
-[start=6]
+
. Укажите адресата для запроса, который вызывается при нажатии кнопки формы. В HTML-версии формы это возможно выполнить с помощью атрибута `action` тега `<form>`. С помощью JSF можно использовать атрибут `action` для `commandButton`. Кроме того, благодаря внутренней функции навигации JSF 2.x вам нужно только указать имя конечного файла без расширения.
Введите код, отображаемый ниже *полужирным шрифтом*.
@@ -466,14 +466,14 @@
Нижеприведенные действия с 7 по 12 являются дополнительными. Если необходимо выполнить быструю сборку проекта, сразу перейдите к <<response,`response.xhtml`>>.
-[start=7]
+
. Протестируйте, выполняется ли вызов метода `setUserNumber()` вышеуказанным выражением на языке выражения при обработке запроса. Для выполнения этого используйте отладчик Java среды IDE.
Переключите на класс `UserNumberBean` (нажмите сочетание клавиш CTRL+TAB и выберите из списка файл). Установите точку останова в сигнатуре метода `setUserNumber()`. Это можно сделать, щелкнув мышкой в области левого поля. Появится красный значок, указывающий, что точка останова метода установлена.
image::images/set-breakpoint.png[title="Щелкните левую границу редактора для задания точек останова"]
-[start=8]
+
. Нажмите кнопку 'Отладка проекта' (image:images/breakpoint-btn.png[]) на главной панели инструментов IDE. Начинается сеанс отладки, и в браузере открывается страница приветствия проекта.
*Примечания.*
@@ -481,15 +481,15 @@
* Вам может быть предложено подтвердить порт сервера для отладки приложений.
* Если появится диалоговое окно 'Отладить проект', выберите опцию по умолчанию 'Java на стороне сервера' и нажмите кнопку 'Отладка'.
-[start=9]
+
. В браузере введите номер в форму и нажмите кнопку "Отправить".
-[start=10]
+
. Вернитесь в среду IDE и проверьте класс `UserNumberBean`. Отладчик приостановлен в методе `setUserNumber()`.
image::images/debugger-suspended.png[title="Выполняется приостановка отладчика в соответствии с точками останова"]
-[start=11]
+
. Откройте окно "Переменные отладчика" (выберите "Окно" > "Отладка > "Переменные" или нажмите сочетание клавиш CTRL+SHIFT+1). На экран будут выведены значения переменных для точки, в которой приостановлен отладчик.
image::images/variables-window.png[title="Отслеживание значений переменных с помощью окна 'Переменные отладчика'"]
@@ -497,7 +497,7 @@
На приведенном выше изображении значение "`4`" предоставлено для переменной `userNumber` в сигнатуре `setUserNumber()`. (Число 4 введено в форму.) "`this`" относится к объекту `UserNumberBean`, созданному для пользовательского сеанса. Далее можно отметить, что значение свойства `userNumber` в настоящий момент равно `null`.
-[start=12]
+
. На панели отладчика нажмите кнопку 'Вход в' ( image:images/step-into-btn.png[] ). Отладчик выполняет обработку строки, на которой он в настоящий момент приостановлен. Происходит обновление окна "Переменные" с указанием выполненных изменений.
image::images/variables-window2.png[title="Окно переменных обновляется при переходе по коду"]
@@ -505,7 +505,7 @@
Теперь свойству `userNumber` присвоено значение, введенное в форме.
-[start=13]
+
. Выберите Отладка> Завершить сеанс отладки (Shift-F5; Shift-Fn-F5 на Mac) из главного меню, чтобы остановить отладчик.
@@ -518,7 +518,7 @@
*Примечание: * Для выделения воспользуйтесь функцией перетаскивания в редакторе с помощью мыши или с помощью клавиатуры удерживайте клавишу Shift и используйте клавиши со стрелками.
-[start=3]
+
. Раскомментируйте компонент формы HTML для JSF. Выделите открывающий и закрывающий теги `<h:form>` и код между ними, затем нажмите CTRL+/ (&#8984+/ на компьютере Mac).
На данном этапе, код между тегами `<body>` выглядит следующим образом:
@@ -561,7 +561,7 @@
После того как компонент формы HTML для JSF раскомментирован, в редакторе будет указано, что теги `<h:form>` и `<h:commandButton>` не объявлены.
-[start=4]
+
. Для объявления этих компонентов используйте автозавершение кода IDE, чтобы добавить пространство имен библиотеки тегов в тег `<html>` страницы.
Используйте поддержку автозавершения кода в редакторе для добавления необходимых пространств имен JSF к файлу. При выборе тега JSF или Facelets через автозавершение кода происходит автоматическое добавление требуемого пространства имен к корневому элементу документа. Подробнее см. в разделе link:jsf20-support.html#facelets[+Поддержка JSF 2.x в IDE NetBeans+].
@@ -580,7 +580,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. Укажите адресата для запроса, который вызывается при нажатии пользователем кнопки формы. Кнопку необходимо установить так, чтобы при ее нажатии пользователь возвращался на страницу-указатель. Для этого следует использовать атрибут `action` для `commandButton`. Введите в код, отображаемый *полужирным шрифтом*.
[source,xml]
@@ -596,7 +596,7 @@
*Примечание. * При вводе `action="index"` пользователи в работе зависят от функции явной навигации в JSF. При нажатии кнопки формы в среде выполнения JSF осуществляется поиск файла с именем `index`. Предполагается, что расширение файла такое же, как у файла, от которого был направлен запрос (`response*.xhtml*`), и поиск файла `index.xhtml` выполняется в папке исходного файла (т.е. в корневом веб-узле).
-[start=6]
+
. Замените статический текст "[здесь ответ]" значением свойства `response` для `UserNumberBean`. Для этого используйте язык выражения JSF. Введите следующее (*выделено полужирным шрифтом*).
[source,html]
@@ -607,7 +607,7 @@
<h4>*<h:outputText value="#{UserNumberBean.response}"/>*</h4>
----
-[start=7]
+
. Запустите проект (нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ) или нажмите F6; fn-F6 в Mac). При появлении в браузере страницы приветствия введите номер и нажмите `submit`. Страница ответа будет отображаться следующим образом (выводится на экран, если введен неправильный номер).
image::images/response2.png[title="Просмотрит текущее состояния проекта в браузере"]
@@ -620,7 +620,7 @@
При выполнении следующих двух шагов эти ошибки устраняются.
-[start=8]
+
. Установите атрибут `escape` тега `<h:outputText>` на `false`. Установите курсор между `outputText` и `value`, вставьте пробел и нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова автозавершения кода. Прокрутите вниз для выбора атрибута `escape` и проверки документации.
image::images/escape-false.png[title="Нажмите Ctrl-Пробел для просмотра возможных значений атрибутов и документации"]
@@ -636,7 +636,7 @@
<h4><h:outputText *escape="false"* value="#{UserNumberBean.response}"/></h4>
----
-[start=9]
+
. Установите атрибут `prependId` тега `<h:form>` на `false`. Установите курсор сразу после "`m`" в `<h:form>` и вставьте пробел, затем нажмите сочетание клавиш CTRL+ПРОБЕЛ для вызова автозавершения кода. Прокрутите вниз для выбора атрибута `prependId` и проверки документации. Затем нажмите ENTER и в качестве значения введите `false`.
[source,java]
@@ -661,26 +661,26 @@
Идентификатором элемента формы является `j_idt5`, и этот идентификатор _предшествует_ идентификатору кнопки "Назад", включенной в форму (*выделено полужирным шрифтом* в приведенном выше примере). Поскольку кнопка "Назад" зависит от правила стиля `#backButton` (определенного в `stylesheet.css`), это правило становится блокированным, если идентификатор JSF предшествует идентификатору кнопки. Этого можно избежать, если для `prependId` установить значение `false`.
-[start=10]
+
. Повторно запустите проект (нажмите кнопку 'Запустить проект' ( image:images/run-project-btn.png[] ) или нажмите F6; fn-F6 в Mac). Введите число на странице приветствия, затем нажмите кнопку "Отправить". Теперь на странице ответа отображается ответное сообщение без тегов `<p>`, и кнопка "Назад" размещена правильно.
image::images/response3.png[title="Просмотрит текущее состояния проекта в браузере"]
-[start=11]
+
. Нажмите кнопку "Назад". Поскольку текущее значение свойства `userNumber` для `UserNumberBean` привязано к компоненту `inputText` JSF, ранее введенное число теперь отображается в текстовом поле.
-[start=12]
+
. Проверьте протокол сервера в окне вывода среды IDE (CTRL+4; &#8984+4 на компьютере Mac) для определения правильного загаданного числа.
Если по каким-то причинам просмотреть протокол сервера невозможно, откройте его посредством переключения на окно "Службы" (CTRL+5; &#8984+5 на компьютере Mac) и развертывания узла "Серверы". Затем щелкните правой кнопкой мыши сервер GlassFish, на котором развернут проект и выберите 'Просмотреть журнал сервера'. Если номер не отображается в журнале сервера, попробуйте повторно выполнить сборку приложения, щелкнув правой кнопкой мыши узел проекта и выбрав 'Очистка и сборка'.
-[start=13]
+
. Введите правильное число и нажмите кнопку "Отправить". В приложении происходит сравнение введенного числа с текущим сохраненным числом и выводится соответствующее сообщение.
image::images/yay.png[title="При вводе соответствующего числа отображается правильный отклик"]
-[start=14]
+
. Нажмите еще раз кнопку "Назад". Обратите внимание на то, что ранее введенное число более не отображается в текстовом поле. Следует помнить о том, что метод `getResponse()` для `UserNumberBean` <<getResponse,определяет текущий пользовательский сеанс как недействительный>> при угадывании правильного числа.
@@ -716,7 +716,7 @@
После завершения выполнения мастера в редакторе открывается файл шаблона. Для просмотра шаблона в браузере, щелкните правой кнопкой мыши в редакторе и выберите 'Просмотр'.
-[start=4]
+
. Проверьте разметку файла шаблона. Обратите внимание на следующие моменты.
* Библиотека тегов `facelets` объявлена в теге `<html>` страницы. Библиотека тегов имеет префикс `ui`.
@@ -750,10 +750,10 @@
</div>
----
-[start=5]
+
. Повторно проверьте страницу <<staticPage,приветствия>> и страницу <<responsePage,ответа>>. Содержимым, которое изменяется на этих страницах, является только заголовок и текст в сером квадрате. Следовательно, шаблон может включать в себя все остальное содержимое.
-[start=6]
+
. Замените все содержимое файла шаблона содержимым, приведенным ниже.
[source,html]
@@ -787,7 +787,7 @@
* Все теги `<ui:insert>` (вместе с тегами `<div>`) удаляются за исключением одного с именем `box`.
* В теги `<ui:insert>` вставляется заголовок страницы с именем `title`.
-[start=7]
+
. Скопируйте в шаблон соответствующий код из файла `index.xhtml` или файла `response.xhtml`. Добавьте содержимое, отображаемое ниже *полужирным шрифтом*, в теги `<h:body>` файла шаблона.
[source,html]
@@ -805,7 +805,7 @@
</h:body>
----
-[start=8]
+
. Выполните проект. При открытии страницы приветствия в браузере измените URL-адрес на следующий:
[source,java]
@@ -834,10 +834,10 @@
image::images/template-client.png[title="Мастер создания клиентов шаблона Facelets"]
-[start=4]
+
. Нажмите кнопку "Завершить". Будет создан новый файл клиента шаблона `greeting.xhtml`, который откроется в редакторе.
-[start=5]
+
. Проверьте разметку. Обратите внимание на содержимое, выделенное *полужирным шрифтом*.
[source,xml]
@@ -865,7 +865,7 @@
----
Файл клиента шаблона ссылается на шаблон с помощью атрибута `template` тега `<ui:composition>`. Поскольку шаблон содержит теги `<ui:insert>` для `title` и `box`, клиент шаблона содержит теги `<ui:define>` для этих двух имен. Содержимое, указываемое в тегах `<ui:define>`, - это содержимое, вставляемое в шаблон в тегах `<ui:insert>` соответствующего имени.
-[start=6]
+
. Укажите `greeting` в качестве заголовка файла. Внесите следующее изменение, выделенное *полужирным шрифтом*.
[source,xml]
@@ -876,7 +876,7 @@
</ui:define>
----
-[start=7]
+
. Перейдите к файлу `index.xhtml` (нажмите CTRL+TAB) и скопируйте содержимое, которое обычно появляется в сером квадрате, выведенном на визуализируемой странице. Затем обратно переключитесь на файл `greeting.xhtml` и вставьте его в файл клиента шаблона. (Изменения *выделены полужирным шрифтом*.)
[source,xml]
@@ -901,7 +901,7 @@
</ui:define>
----
-[start=8]
+
. Объявите библиотеку тегов HTML JSF для файла. Установите курсор на один из тегов, помеченных флагом ошибки (любой тег с префиксом "`h`"), и нажмите сочетание клавиш CTRL+ПРОБЕЛ. Затем выберите тег из списка предложений автозавершения кодов. Пространство имен библиотеки тегов добавляется к тегу `<html>` файла (выделено ниже *полужирным шрифтом*), и указания на ошибки исчезают.
[source,java]
@@ -955,14 +955,14 @@
----
Обратите внимание на то, что файл идентичен файлу `greeting.xhtml`, за исключением содержимого, указанного в тегах `<ui:define>` для `title` и `box`.
-[start=2]
+
. В дескрипторе развертывания `web.xml` проекта измените запись файла приветствия таким образом, чтобы при запуске приложения открывалась страница, представленная файлом `greeting.xhtml`.
В окне 'Проекты' дважды щелкните 'Файлы конфигурации' > `web.xml`, чтобы открыть его в редакторе. На вкладке "Страницы" измените поле "Файлы приветствия" на `faces/greeting.xhtml`.
image::images/welcome-files.png[title="Измените запись 'Файлы приветствия' в дескрипторе развертывания"]
-[start=3]
+
. Выполните проект и посмотрите, как он выглядит в браузере. Нажмите F6 (fn-F6 в Mac) или нажмите кнопку 'Запустить проект'( image:images/run-project-btn.png[] ) на главной панели инструментов. Проект будет развернут на сервере GlassFish и открыт в браузере.
При использовании шаблона Facelets и файлов клиента шаблона поведение приложения не меняется. Выделив повторяющийся код на страницах приветствия и ответа приложения, можно уменьшить размер приложения и устранить возможность написания повторяющегося кода, если впоследствии будут добавляться другие страницы. Это позволяет сделать разработку более эффективной и упростить управление при работе с большими проектами.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_zh_CN.asciidoc
index 8f40c88..563688f 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/jsf20-intro_zh_CN.asciidoc
@@ -86,12 +86,12 @@
*注:*如果在安装 IDE 时未安装 JUnit 插件,当打开 NetBeans 项目时,系统可能会提示您解析到 JUnit 库的引用。
-[start=3]
+
. 运行该项目以查看其在浏览器中的外观。在 "Projects"(项目)窗口中右键单击 `jsfDemo` 项目节点并选择 "Run"(运行),或单击主工具栏中的 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮。该项目将打包并部署到 GlassFish Server,并且您的浏览器随即打开以显示欢迎页 (`index.xhtml`)。
image::images/run-project.png[title="运行项目以在浏览器中查看它"]
-[start=4]
+
. 单击 "Submit" 按钮。响应页 (`response.xhtml`) 显示如下:
image::images/response.png[title="欢迎页和响应页当前为静态页"]
@@ -99,13 +99,13 @@
目前欢迎页和响应页为静态页面,另外还有 `stylesheet.css` 文件和 `duke.png` 图像,这些都是通过浏览器访问的仅有的应用程序文件。
-[start=5]
+
. 在 "Projects"(项目)窗口(Ctrl-1 组合键;在 Mac 上为 ⌘-1 组合键)中,右键单击项目节点,然后选择 "Properties"(属性)打开 "Project Properties"(项目属性)窗口。
-[start=6]
+
. 选择 "Frameworks"(框架)类别,然后单击 "Add"(添加)按钮。
-[start=7]
+
. 在 "Add a Framework"(添加框架)对话框中选择 "JavaServer Faces"。单击 "OK"(确定)。
image::images/add-framework.png[title="将 JSF 支持添加到现有项目"]
@@ -114,7 +114,7 @@
image::images/libraries-tab.png[title="指定对 JSF 2.x 库的访问权限"]
-[start=8]
+
. 单击 "Configuration"(配置)标签。可以指定 Faces Servlet 在项目的部署描述符中注册的方式。还可以指定是否需要在项目中使用 Facelets 或 JSP 页。
image::images/jsf-configuration.png[title="指定 Faces servlet 选项和首选语言"]
@@ -123,7 +123,7 @@
image::images/jsf-components.png[title="指定 Faces servlet 选项和首选语言"]
-[start=9]
+
. 单击 "OK"(确定)以完成更改并退出 "Project Properties"(项目属性)窗口。
在将 JSF 支持添加到项目中后,该项目的 `web.xml` 部署描述符修改为如下内容。(更改内容以*粗体*显示。)
@@ -187,7 +187,7 @@
image::images/managed-bean.png[title="使用 JSF 受管 Bean 向导创建新的受管 Bean"]
-[start=3]
+
. 单击 "Finish"(完成)。将会生成 `UserNumberBean` 类并在编辑器中将其打开。注意以下标注(*粗体*显示):
[source,java]
@@ -245,10 +245,10 @@
以上代码将生成一个 0 到 10 之间的随机数字,并将其输出到服务器日志中。
-[start=2]
+
. 修复导入。为此,请单击显示在编辑器左旁注中的提示标记 (image:images/hint-icon.png[]),然后选择相应选项将 `java.util.Random` 导入到类。
-[start=3]
+
. 再次运行项目(单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮,或者按 F6;在 Mac 上按 fn-F6)。当运行项目时,服务器的日志文件将自动在 "Output"(输出)窗口中打开。
image::images/output1.png[title="服务器的日志文件自动在 "Output"(输出)窗口中打开"]
@@ -259,7 +259,7 @@
_如果 `eager()` 属性的值为 `true`,且 `managed-bean-scope` 的值为 "application",则当应用程序启动时,运行时必须对该类执行实例化操作。必须在提供任何请求服务之前,对实例执行实例化和存储操作。如果 _eager_ 未指定或为 `false`,或者 `managed-bean-scope` 不是 "application",则会发生受管 Bean 的默认“延迟”实例化和作用域存储。_
-[start=4]
+
. 因为 `UserNumberBean` 属于会话范围,所以它将实现 `Serializable` 接口。
[source,java]
@@ -290,12 +290,12 @@
*Integer userNumber;*
----
-[start=2]
+
. 在编辑器中单击鼠标右键,然后选择 "Insert Code"(插入代码)(Alt-Insert 组合键;在 Mac 上为 Ctrl-I 组合键)。选择 "Getter and Setter"(Getter 和 Setter)。
image::images/getter-setter.png[title="使用 IDE 生成属性的存取方法"]
-[start=3]
+
. 选择 `userNumber` : `Integer` 选项。单击 "Generate"(生成)。
image::images/generate-getters-setters.png[title="使用 IDE 生成属性的存取方法"]
@@ -303,7 +303,7 @@
请注意,`getUserNumber()` 和 `setUserNumber(Integer userNumber)` 方法已添加到类中。
-[start=4]
+
. 创建一个 `response` 属性。声明一个名为 `response` 的 `String`。
[source,java]
@@ -318,7 +318,7 @@
*String response;*
----
-[start=5]
+
. 为 `response` 创建一个 getter 方法。(本应用程序不需要 setter。)可以使用以上步骤 2 中显示的 IDE 的 "Generate Code"(生成代码)弹出式窗口来生成模板代码。但是就本教程而言,只需将以下方法粘贴到类中即可。
[source,html]
@@ -344,7 +344,7 @@
1. 测试用户输入的数字 (`userNumber`) 是否等于为会话生成的随机数字 (`randomInt`),并相应地返回一个 `String` 响应。
2. 如果用户猜对了数字(即,如果 `userNumber` 等于 `randomInt`),则将使用户会话失效。这是必需的,以便当用户希望再玩一次时会生成一个新的数字。
-[start=6]
+
. 在编辑器中单击鼠标右键,然后选择 "Fix Imports"(修复导入)(Alt-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)。将为以下内容自动创建导入声明:
* `javax.servlet.http.HttpSession`
* `javax.faces.context.FacesContext`
@@ -382,7 +382,7 @@
索引页和响应页都已包含了本练习所需的 JSF UI 组件。只需取消其注释,并注释掉当前正在使用的 HTML 元素。
-[start=2]
+
. 注释掉 HTML 窗体元素。为此,请按照下图所示突出显示 HTML 窗体元素,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
*注:*要突出显示该表单元素,可以单击该元素,然后用鼠标在编辑器中拖动;也可以使用键盘,按住 Shift 键并按方向键。
@@ -392,7 +392,7 @@
在编辑器中使用 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)启用/禁用注释。还可以将此快捷键应用于其他文件类型,如 Java 和 CSS。
-[start=3]
+
. 取消 JSF HTML 窗体组件的注释。如下图所示突出显示组件,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
*注:*您可能需要按两次 Ctrl-/ 来取消注释代码。
@@ -404,7 +404,7 @@
image::images/undeclared-component.png[title="编辑器针对未声明的组件提供错误消息"]
-[start=4]
+
. 要声明这些组件,请使用 IDE 的代码完成将标记库名称空间添加到页面的 `<html>` 标记中。将光标放置在任何未声明的标记上方,然后按 Alt-Enter 组合键并单击 Enter 以添加建议的标记库。(如果有多个选项,请确保按 Enter 键之前选择了在编辑器中显示的标记。)JSF HTML 标记库名称空间将添加到 `<html>` 标记中(如以下*粗体*所示),并且错误指示符将消失。
*注:*如果 IDE 未提供用于添加标记库的选项,则您需要手动修改 ``<html>`` 元素。
@@ -417,7 +417,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. 使用 JSF 表达式语言将 `UserNumberBean` 的 `userNumber` 属性绑定到 `inputText` 组件。`value` 属性可用于指定所呈现组件的当前值。键入以下*粗体*显示的代码。
[source,java]
@@ -430,7 +430,7 @@
JSF 表达式语言使用 `#{}` 语法。在这些分隔符内,会指定用点 (`.`) 分隔的受管 Bean 的名称和需要应用的 Bean 属性。现在,将窗体数据发送至服务器时,会使用属性的 setter (`setUserNumber()`) 将该值自动保存到 `userNumber` 属性中。此外,当请求页面且已设置 `userNumber` 的值时,该值将自动显示在呈现的 `inputText` 组件中。有关更多信息,请参见 link:http://docs.oracle.com/javaee/7/tutorial/doc/jsf-develop001.htm#BNAQP[+Java EE 7 教程的第 12.1.2 节:使用 EL 引用受管 Bean+]。
-[start=6]
+
. 为单击窗体按钮时调用的请求指定目标。在 HTML 窗体版本中,可以使用 `<form>` 标记的 `action` 属性来完成此操作。在 JSF 中,可以使用 `commandButton` 的 `action` 属性。此外,由于 JSF 2.x 的隐式导航功能,您只需指定目标文件的名称,而无需文件扩展名。
键入以下*粗体*显示的代码。
@@ -466,14 +466,14 @@
以下步骤 7 至 12 为可选操作。如果希望快速构建项目,请跳至 <<response,`response.xhtml`>>。
-[start=7]
+
. 测试当处理请求时上述 EL 表达式是否实际调用了 `setUserNumber()` 方法。要执行此操作,请使用 IDE 的 Java 调试器。
切换到 `UserNumberBean` 类(按 Ctrl-Tab 组合键,然后从列表中选择文件。)在 `setUserNumber()` 方法签名上设置一个断点。可以通过单击左旁注来完成此操作。将显示一个红色的标记,表示已设置方法断点。
image::images/set-breakpoint.png[title="在编辑器的左旁注中单击以设置断点"]
-[start=8]
+
. 单击 IDE 主工具栏中的 "Debug Project"(调试项目)(image:images/breakpoint-btn.png[]) 按钮。将启动调试会话,并在浏览器中打开项目欢迎页面。
*注:*
@@ -481,15 +481,15 @@
* 系统可能会提示您确认用于调试应用程序的服务器端口。
* 如果显示了 "Debug Project"(调试项目)对话框,请选择默认 "Server side Java"(服务器端 Java)选项,然后单击 "Debug"(调试)。
-[start=9]
+
. 在浏览器中,将数字输入窗体中,然后单击 "submit" 按钮。
-[start=10]
+
. 切换回 IDE 并检查 `UserNumberBean` 类。在 `setUserNumber()` 方法内挂起执行调试器。
image::images/debugger-suspended.png[title="调试器根据断点挂起"]
-[start=11]
+
. 打开调试器的 "Variables"(变量)窗口(选择 "Window"(窗口)> "Debugging"(调试)> "Variables"(变量),或者按 Ctrl-Shift-1 组合键)。将看到调试器挂起所在点的变量值。
image::images/variables-window.png[title="使用调试器的 "Variables"(变量)窗口监视变量值"]
@@ -497,7 +497,7 @@
在上图中,`setUserNumber()` 签名中 `userNumber` 变量的值为 "`4`"。(窗体中输入了数字 4。)"`this`" 指的是为用户会话创建的 `UserNumberBean` 对象。在其下方,可看到 `userNumber` 属性的值目前为`空值`。
-[start=12]
+
. 在调试器工具栏中,单击 "Step Into"(步入)(image:images/step-into-btn.png[]) 按钮。调试器将执行当前挂起的行。"Variables"(变量)窗口将刷新,表示执行产生的更改。
image::images/variables-window2.png[title=""Variables"(变量)窗口在单步调试代码时刷新"]
@@ -505,7 +505,7 @@
`userNumber` 属性现在被设置为窗体中输入的值。
-[start=13]
+
. 从主菜单中选择 "Debug"(调试)> "Finish Debugger Session"(结束调试器会话)(Shift-F5 组合键;在 Mac 上为 Shift-Fn-F5 组合键)停止调试器。
@@ -518,7 +518,7 @@
*注:*要突出显示该表单元素,可以单击该元素,然后用鼠标在编辑器中拖动;也可以使用键盘,按住 Shift 键并按方向键。
-[start=3]
+
. 取消 JSF HTML 窗体组件的注释。突出显示 `<h:form>` 起始标记和结束标记及其之间的代码,然后按 Ctrl-/ 组合键(在 Mac 上为 ⌘-/ 组合键)。
此时,`<body>` 标记之间的代码如下所示:
@@ -561,7 +561,7 @@
在取消 JSF HTML 窗体组件的注释后,编辑器将指示 `<h:form>` 和 `<h:commandButton>` 标签未进行声明。
-[start=4]
+
. 要声明这些组件,请使用 IDE 的代码完成将标记库名称空间添加到页面的 `<html>` 标记中。
使用编辑器的代码完成支持将所需的 JSF 名称空间添加到文件中。当通过代码完成选择一个 JSF 或 Facelets 标记时,会自动将所需的名称空间添加到文档的根元素中。有关详细信息,请参见 link:jsf20-support.html#facelets[+NetBeans IDE 中的 JSF 2.x 支持+]。
@@ -580,7 +580,7 @@
*xmlns:h="http://xmlns.jcp.org/jsf/html"*>
----
-[start=5]
+
. 为用户单击窗体按钮时调用的请求指定目标。您希望设置一个按钮以便当用户单击该按钮时,会返回到索引页。要完成此功能,请使用 `commandButton` 的 `action` 属性。键入以*粗体*显示的代码。
[source,xml]
@@ -596,7 +596,7 @@
*注:*通过键入 `action="index"`,将可依赖 JSF 的隐式导航功能。当用户单击窗体按钮时,JSF 运行时会搜索一个名为 `index` 的文件。JSF 运行时将假定文件扩展名与请求源自的文件 (`response*.xhtml*`) 所使用的扩展名相同,并在与源文件相同的目录(即 Web 根目录)中查找 `index.xhtml` 文件。
-[start=6]
+
. 将静态的 "[ response here ]" 文本替换为 `UserNumberBean` 的 `response` 属性值。要执行此操作,请使用 JSF 表达式语言。输入以下内容(*粗体*)。
[source,html]
@@ -607,7 +607,7 @@
<h4>*<h:outputText value="#{UserNumberBean.response}"/>*</h4>
----
-[start=7]
+
. 运行项目(单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮,或者按 F6;在 Mac 上按 fn-F6)。当浏览器中显示欢迎页面时,输入一个数字,然后单击 `submit`。将看到响应页显示类似于以下的内容(如果您没有猜对数字)。
image::images/response2.png[title="在浏览器中查看项目的当前状态"]
@@ -620,7 +620,7 @@
以下两个步骤分别更正了这两个问题。
-[start=8]
+
. 将 `<h:outputText>` 标记的 `escape` 属性设置为 `false`。将光标置于 `outputText` 和 `value` 之间,插入一个空格,然后按 Ctrl-空格键调用代码完成。向下滚动以选择 `escape` 属性并检查文档。
image::images/escape-false.png[title="按 Ctrl-空格键查看可能的属性值和文档"]
@@ -636,7 +636,7 @@
<h4><h:outputText *escape="false"* value="#{UserNumberBean.response}"/></h4>
----
-[start=9]
+
. 将 `<h:form>` 标记的 `prependId` 属性设置为 `false`。将光标置于 `<h:form>` 中 "`m`" 的后面并插入一个空格,然后按 Ctrl-空格键调用代码完成。向下滚动以选择 `prependId` 属性并检查文档。然后按 Enter 键,并键入 `false` 作为值。
[source,java]
@@ -661,26 +661,26 @@
窗体元素的 id 为 `j_idt5`,并且此 id 被置于包含在窗体中的 "Back" 按钮的 _ID_ 前面(如以上*粗体*显示)。因为 "Back" 按钮依赖于 `#backButton` 样式规则(在 `stylesheet.css` 中定义),所以在前置 JSF id 时,将禁用该规则。可以通过将 `prependId` 设置为 `false` 来避免这种情况。
-[start=10]
+
. 再次运行项目(单击 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮,或者按 F6;在 Mac 上按 fn-F6)。在欢迎页面输入一个数字,然后单击 "Submit"。现在响应页显示了不带 `<p>` 标记的响应消息,并且 "Back" 按钮放在了正确的位置。
image::images/response3.png[title="在浏览器中查看项目的当前状态"]
-[start=11]
+
. 单击 "Back" 按钮。因为 `UserNumberBean` 的 `userNumber` 属性的当前值绑定到了 JSF `inputText` 组件,所以您之前输入的数字现在显示在文本字段中。
-[start=12]
+
. 在 IDE 的 "Output"(输出)窗口中检查服务器日志(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键),以确定正确的猜测数字是什么。
如果由于某种原因无法看到服务器日志,可以通过切换到 "Services"(服务)窗口(Ctrl-5 组合键;在 Mac 上为 ⌘-5 组合键)并展开 "Servers"(服务器)节点来打开日志。然后右键单击项目部署所在的 GlassFish Server,并选择 "View Server Log"(查看服务器日志)。如果在服务器日志中看不到该数字,请尝试通过右键单击项目节点并选择 "Clean and Build"(清理并构建)来重新构建应用程序。
-[start=13]
+
. 键入正确的数字,然后单击 "Submit"。应用程序将您的输入与当前保存的数字进行比较,并显示相应的消息。
image::images/yay.png[title="在输入匹配号时显示正确响应"]
-[start=14]
+
. 再次单击 "Back" 按钮。请注意,以前输入的数字在文本字段中不再显示。回想一下,当猜对了数字后,`UserNumberBean` 的 `getResponse()` 方法就会<<getResponse,使当前的用户会话失效>>。
@@ -716,7 +716,7 @@
完成向导之后,模板文件在编辑器中打开。要在浏览器中查看模板,请右键单击编辑器并选择 "View"(视图)。
-[start=4]
+
. 检查模板文件标记。请注意以下要点:
* 在页面的 `<html>` 标记中声明了 `facelets` 标记库。标记库具有 `ui` 前缀。
@@ -750,10 +750,10 @@
</div>
----
-[start=5]
+
. 重新检查<<staticPage,欢迎>>和<<responsePage,响应>>页面。这两个页面之间唯一更改的内容是包含在灰色方块中的标题和文本。因此,模板可以提供其余所有内容。
-[start=6]
+
. 将您的模板文件的全部内容替换为如下内容。
[source,html]
@@ -787,7 +787,7 @@
* 除了一个名为 `box` 的标记之外,所有 `<ui:insert>` 标记(及其包含的 `<div>` 标记)都已删除。
* 在页面标题周围放置了 `<ui:insert>` 标记对,并命名为 `title`。
-[start=7]
+
. 将 `index.xhtml` 或 `response.xhtml` 文件中的相关代码复制到模板中。将以下*粗体*显示的内容添加到模板文件的 `<h:body>` 标记中。
[source,html]
@@ -805,7 +805,7 @@
</h:body>
----
-[start=8]
+
. 运行项目。当欢迎页面在浏览器中打开时,将 URL 修改为以下内容:
[source,java]
@@ -834,10 +834,10 @@
image::images/template-client.png[title="Facelets 模板客户端向导"]
-[start=4]
+
. 单击 "Finish"(完成)。将生成新的 `greeting.xhtml` 模板客户端文件并显示在编辑器中。
-[start=5]
+
. 检查标记。请注意以*粗体*突出显示的内容。
[source,xml]
@@ -865,7 +865,7 @@
----
模板客户端文件通过使用 `<ui:composition>` 标记的 `template` 属性来引用模板。因为模板包含了 `title` 和 `box` 的 `<ui:insert>` 标记,所以该模板客户端包含了这两个名称的 `<ui:define>` 标记。您在 `<ui:define>` 标记之间指定的内容就是将插入到模板中相应名称的 `<ui:insert>` 标记之间的内容。
-[start=6]
+
. 指定 `greeting` 作为文件的标题。进行以下更改(*粗体*显示)。
[source,xml]
@@ -876,7 +876,7 @@
</ui:define>
----
-[start=7]
+
. 切换到 `index.xhtml` 文件(按 Ctrl-Tab 组合键),然后复制通常会出现在灰色方块(显示在所呈现的页面中)中的内容。然后切换回 `greeting.xhtml`,并将其粘贴到模板客户端文件中。(更改内容以*粗体*显示。)
[source,xml]
@@ -901,7 +901,7 @@
</ui:define>
----
-[start=8]
+
. 为该文件声明 JSF HTML 标记库。将光标置于任意一个被标记为错误的标记(任何使用 "`h`" 前缀的标记)上,然后按 Ctrl-空格组合键。然后从代码完成建议列表中选择标记。标记库名称空间将添加到该文件的 `<html>` 标记中(如以下*粗体*所示),并且错误指示符将消失。
[source,java]
@@ -955,14 +955,14 @@
----
请注意,该文件除了在 `title` 和 `box` 的 `<ui:define>` 标记之间指定的内容外,与 `greeting.xhtml` 是相同的。
-[start=2]
+
. 在此项目的 `web.xml` 部署描述符中,修改欢迎文件条目以使 `greeting.xhtml` 成为在运行此应用程序时所打开的页面。
在 "Projects"(项目)窗口中,双击 "Configuration Files"(配置文件)> `web.xml` 以在编辑器中将其打开。在 "Pages"(页面)标签下面,将 "Welcome Files"(欢迎文件)字段更改为 "`faces/greeting.xhtml`"。
image::images/welcome-files.png[title="更改部署描述符中的 "Welcome Files"(欢迎文件)条目"]
-[start=3]
+
. 运行该项目以查看其在浏览器中的外观。按 F6(在 Mac 上按 fn-F6),或单击主工具栏中的 "Run Project"(运行项目)(image:images/run-project-btn.png[]) 按钮。该项目将被部署到 GlassFish Server 并在浏览器中打开。
使用了 Facelets 模板和模板客户端文件,该应用程序的行为方式仍与以前一样。通过将应用程序欢迎页和响应页中的重复代码提取出来,可以成功减小应用程序的大小,并避免在以后添加更多页面时可能编写更多的重复代码。在使用大型项目时,这样便可以更有效更轻松地维护开发。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp.asciidoc
index fe97ac9..e3a8753 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp.asciidoc
@@ -102,16 +102,16 @@
The New Project wizard allows you to create an empty web application in a standard IDE project. The standard project uses an IDE-generated Ant build script to compile, deploy, and run the application.
-[start=2]
+
. In Project Name, enter *IFPWAFCAD*. Also, specify the location for the project on your computer. (By default, the IDE places projects in a `NetBeansProjects` folder located in your home directory.) Click Next.
-[start=3]
+
. In the Server and Settings panel, specify the GlassFish server as server which will be used to run the application.
*Note. *The GlassFish server displays in the Server drop-down field if you installed the Java version of the link:https://netbeans.org/downloads/index.html[+NetBeans IDE+]. Because the GlassFish server is included in the download, it is automatically registered with the IDE. If you want to use a different server for this project, click the Add button located next to the Server drop-down field, and register a different server with the IDE. However, working with servers other than the GlassFish server is beyond the scope of this tutorial.
-[start=4]
+
. In the Java EE Version field, select *Java EE 5*.
image::images/server-settings.png[title="Specify server settings in the New Web Application wizard"]
@@ -121,7 +121,7 @@
*Note.* You could equally set the project version to Java EE 6 or Java EE 7 and then create a `web.xml` deployment descriptor. (From the New File wizard, select the Web category, then Standard Deployment Descriptor.)
-[start=5]
+
. Click Finish. The IDE creates a project template for the entire application, and opens an empty JSP page (`index.jsp`) in the editor. The `index.jsp` file serves as the welcome page for the application.
@@ -148,10 +148,10 @@
[tips]#You can configure the Palette to your liking - right-click in the Palette and choose Show Big Icons and Hide Item Names to have it display as in the image above.#
-[start=4]
+
. Place your cursor at a point just after the `<h1>` tags. (This is where you want to implement the new HTML table.) Then, in the Palette, double-click the Table icon.
-[start=5]
+
. In the Insert Table dialog that displays, specify the following values then click OK:
* *Rows*: 2
@@ -159,7 +159,7 @@
* *Border Size*: 0
The HTML table code is generated and added to your page.
-[start=6]
+
. Add the following content to the table heading and the cell of the first table row (new content shown in *bold*):
[source,xml]
@@ -178,12 +178,12 @@
</tr>
----
-[start=7]
+
. For the bottom row of the table, insert an HTML form. To do so, place your cursor between the second pair of `<td>` tags, then double-click the HTML form ( image:images/html-form-icon.png[] ) icon in the Palette. In the Insert Form dialog, type in `response.jsp` in the Action text field, then click OK.
image::images/insert-form.png[title="Specify form settings in the Insert Form dialog"]
-[start=8]
+
. Type in the following content between the `<form>` tags (new content shown in *bold*):
[source,xml]
@@ -198,19 +198,19 @@
</tr>
----
-[start=9]
+
. Press Enter to add an empty line after the content you just added and then double-click Drop-down List in the Palette to open the Insert Drop-down dialog box.
-[start=10]
+
. Type `subject_id` for the Name text field in the Insert Drop-down dialog and click OK. Note that the code snippet for the drop-down list is added to the form.
The number of options for the drop-down is currently not important. Later in the tutorial you will add JSTL tags that dynamically generate options based on the data gathered from the Subject database table.
-[start=11]
+
. Add a submit button item ( image:images/submit-button.png[] ) to a point just after the drop-down list you just added. You can either use the Palette to do this, or invoke the editor's code completion as illustrated in the previous step. In the Insert Button dialog, enter `submit` for both the Label and Name text fields, then click OK.
-[start=12]
+
. To format your code, right-click in the editor and choose Format (Alt-Shift-F; Ctrl-Shift-F on Mac). Your code is automatically formatted, and should now look similar to the following:
[source,xml]
@@ -264,10 +264,10 @@
image::images/response-jsp-node.png[title="response.jsp node appears in the Projects window"]
-[start=4]
+
. In the editor, change the title to: `IFPWAFCAD - {placeholder}`.
-[start=5]
+
. Remove the `<h1>Hello World!</h1>` line between the `<body>` tags, then copy and paste the following HTML table into the body of the page:
[source,xml]
@@ -364,7 +364,7 @@
}
----
-[start=4]
+
. Link the stylesheet to `index.jsp` and `response.jsp`. In both pages, add the following line between the `<head>` tags:
[source,java]
@@ -425,27 +425,27 @@
[tips]#The JDBC data source relies on link:http://www.oracle.com/technetwork/java/jndi/index.html[+JNDI+], the Java Naming and Directory Interface. The JNDI API provides a uniform way for applications to find and access data sources. For more information, see link:http://docs.oracle.com/javase/jndi/tutorial/[+The JNDI Tutorial+].#
-[start=3]
+
. Optionally, add a description for the data source. For example, type in: `Accesses the database that provides data for the IFPWAFCAD application`.
-[start=4]
+
. Click Next, then click Next again to skip step 3, Additional Properties.
-[start=5]
+
. In Step 4, type in *IfpwafcadPool* for JDBC Connection Pool Name. Make sure the Extract from Existing Connection option is selected, and choose `jdbc:mysql://localhost:3306/MyNewDatabase` from the drop-down list. Click Next.
image::images/jdbc-resource-wizard2.png[title="Specify connection pool settings in the JDBC Resource wizard"]
*Note: *The wizard detects any database connections that have been set up in the IDE. Therefore, you need to have already created a connection to the `MyNewDatabase` database at this point. You can verify what connections have been created by opening the Services window (Ctrl-5; ⌘-5 on Mac) and looking for connection nodes ( image:images/connection-node-icon.png[] ) under the Databases category.
-[start=6]
+
. In Step 5, select `javax.sql.ConnectionPoolDataSource` in the Resource Type drop-down list.
Note that the IDE extracts information from the database connection you specified in the previous step, and sets name-value properties for the new connection pool.
image::images/jdbc-resource-wizard3.png[title="Default values are based on information extracted from the selected database connection"]
-[start=7]
+
. Click Finish. The wizard generates a `glassfish-resources.xml` file that contains entries for the data source and connection pool you specified.
In the Projects window, you can open the `glassfish-resources.xml` file that was created under the Server Resources node and note that, within the `<resources>` tags, a data source and connection pool have been declared containing the values you previously specified.
@@ -482,7 +482,7 @@
The new resource is now listed under the Resource References heading.
-[start=6]
+
. To verify that the resource is now added to the `web.xml` file, click the Source tab located along the top of the editor. Notice that the following <`resource-ref`> tags are now included.
[source,xml]
@@ -510,16 +510,16 @@
image::images/servers-window.png[title="JDBC Driver Deployment option enables automatic driver deployment"]
-[start=3]
+
. Before you close the Servers manager, make a note of the path indicated in the Domains folder text field. When you connect to the GlassFish server in the IDE, you are actually connecting to an _instance_ of the application server. Each instance runs applications in a unique domain, and the Domain Name field indicates the name of the domain your server is using. As shown in the image above, the driver JAR file should be located within `domain1`, which is the default domain created upon installing the GlassFish server.
-[start=4]
+
. Click Close to exit the Servers manager.
-[start=5]
+
. On your computer, navigate to the GlassFish server installation directory and drill into the `domains` > `domain1` > `lib` subfolder. Because you should have already deployed the IFPWAFCAD project to the server, you should see the `mysql-connector-java-5.1.6-bin.jar` file. If you do not see the driver JAR file, perform the following step.
-[start=6]
+
. Deploy your project to the server. In the IDE's Projects window, choose Deploy from the right-click menu of the project node. You can view progress in the IDE's Output window (Ctrl-4; ⌘-4 on Mac). The output indicates that the MySQL driver is deployed to a location in the GlassFish server.
image::images/output-window.png[title="Output window indicates that the MySQL driver has been deployed"]
@@ -573,7 +573,7 @@
The DB Report item uses the `<sql:query>` tag to create an SQL query, then it uses the `<c:forEach>` tag to loop through the query's `resultset` and output the retrieved data.
-[start=2]
+
. Place your cursor above the `<%@page ... %>` declaration (line 7), then double-click the DB Report item in the Palette. In the dialog that displays, enter the following details:
* *Variable Name:* `subjects`
* *Scope:* `page`
@@ -582,7 +582,7 @@
image::images/insert-db-report.png[title="Use the Insert DB Report dialog to specify query-specific details"]
-[start=3]
+
. Click OK. The following content is generated in the `index.jsp` file. (New content shown in *bold*.)
[source,xml]
@@ -622,7 +622,7 @@
----
Note that the IDE automatically added `taglib` directives needed for the JSTL tags used in the generated content (`<sql:query>` and `<c:forEach>`). A `taglib` directive declares that the JSP page uses custom (i.e., JSTL) tags, names the tag library that defines them, and specifies their tag prefix.
-[start=4]
+
. Run the project to see how it displays in a browser. Right-click the project node in the Projects window and choose Run.
When you choose Run, the IDE deploys the project to the GlassFish server, the index page is compiled into a servlet, and the welcome page opens in your default browser. The code generated from the DB Report item creates the following table in the welcome page.
@@ -634,10 +634,10 @@
The following steps demonstrate how to integrate the generated code into the HTML drop-down list you created earlier in the tutorial.
-[start=5]
+
. Examine the column data in the generated code. Two `<c:forEach>` tags are used; one is nested inside the other. This causes the JSP container (i.e., the GlassFish server) to perform a loop on all table rows, and for each row, it loops through all columns. In this manner, data for the entire table is displayed.
-[start=6]
+
. Integrate the `<c:forEach>` tags into the HTML form as follows. The value of each item becomes the `subject_id`, and the output text becomes the `name`, as recorded in the database. (Changes are displayed in *bold*).
[source,xml]
@@ -674,7 +674,7 @@
In either case, the `<c:forEach>` tags loop through all `subject_id` and `name` values from the SQL query, and insert each pair into the HTML `<option>` tags. In this manner, the form's drop-down list is populated with data.
-[start=7]
+
. Delete the table that was generated from the DB Report item. (Deletion shown below as *[.line-through]#strike-through text#*.)
[source,xml]
@@ -714,10 +714,10 @@
"http://www.w3.org/TR/html4/loose.dtd">
----
-[start=8]
+
. Save your changes (Ctrl-S; ⌘-S on Mac).
-[start=9]
+
. Refresh the welcome page of the project in your browser.
Note that the drop-down list in the browser now contains subject names that were retrieved from the database.
@@ -738,7 +738,7 @@
image::images/insert-db-query2.png[title="Use the Insert DB Query dialog to specify query-specific details"]
-[start=3]
+
. Click OK. The following content is generated in the `response.jsp` file. (New content shown in *bold*.)
[source,xml]
@@ -763,7 +763,7 @@
----
Note that the IDE automatically added the `taglib` directive needed for the `<sql:query>` tag. Also, note that you used an `<sql:param>` tag directly within the query. Because this query relies on the `subject_id` value that was submitted from `index.jsp`, you can extract the value using an EL (Expression Language) statement in the form of `${param.subject_id}`, and then pass it to the `<sql:param>` tag so that it can be used in place of the SQL question mark (`?`) during runtime.
-[start=4]
+
. Use a `<c:set>` tag to set a variable that corresponds to the first record (i.e., row) of the `resultset` returned from the query. (New content shown in *bold*.)
[source,xml]
@@ -779,7 +779,7 @@
----
Although the `resultset` returned from the query should only contain a single record, this is a necessary step because the page needs to access values from the record using EL (Expression Language) statements. Recall that in `index.jsp`, you were able to access values from the `resultset` simply by using a `<c:forEach>` tag. However, the `<c:forEach>` tag operates by setting a variable for the rows contained in the query, thus enabling you to extract values by including the row variable in EL statements.
-[start=5]
+
. Add the `taglib` directive for the JSTL `core` library to the top of the file, so that the `<c:set>` tag is understood. (New content shown in *bold*.)
[source,java]
@@ -789,7 +789,7 @@
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-[start=6]
+
. In the HTML markup, replace all placeholders with EL statements code that display the data held in the `counselorDetails` variable. (Changes below shown in *bold*):
[source,xml]
@@ -920,7 +920,7 @@
image::images/ping-succeeded.png[title="Test your connection pool by clicking Ping in the GlassFish server Admin Console"]
-[start=6]
+
. If the ping fails, click the Additional Properties tab and ensure that the listed property values are correctly set.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ja.asciidoc
index 47190aa..1bff873 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ja.asciidoc
@@ -101,16 +101,16 @@
新規プロジェクト・ウィザードを使用すると、標準的なIDEプロジェクト内に空のWebアプリケーションを作成できます。標準的なプロジェクトでは、IDEが生成したAntビルド・スクリプトを使用して、アプリケーションをコンパイル、デプロイおよび実行します。
-[start=2]
+
. 「プロジェクト名」に「*IFPWAFCAD*」と入力します。また、コンピュータ上でのプロジェクトの場所を指定します。デフォルトでは、IDEはホーム・ディレクトリの`NetBeansProjects`フォルダにプロジェクトを配置します。「次」をクリックします。
-[start=3]
+
. 「サーバーと設定」パネルで、アプリケーションの実行に使用するサーバーとしてGlassFishサーバーを指定します。
*注意: *GlassFishサーバーは、Javaバージョンのlink:https://netbeans.org/downloads/index.html[+NetBeans IDE+]がインストールされている場合に、「サーバー」ドロップダウン・フィールドに表示されます。GlassFishサーバーはダウンロードに含まれているため、自動的にIDEに登録されます。このプロジェクトで他のサーバーを使用する場合は、「サーバー」ドロップダウン・フィールドの横にある「追加」ボタンをクリックし、他のサーバーをIDEに登録します。ただし、GlassFishサーバー以外のサーバーの操作については、このチュートリアルでは説明しません。
-[start=4]
+
. 「Java EEバージョン」フィールドで「*Java EE 5*」を選択します。
image::images/server-settings.png[title="新規Webアプリケーション・ウィザードでのサーバー設定の指定"]
@@ -120,7 +120,7 @@
*注意:*同様に、プロジェクトのバージョンをJava EE 6またはJava EE 7に設定し、`web.xml`デプロイメント・ディスクリプタを作成することもできます。これを行うには、新規ファイル・ウィザードから「Web」カテゴリを選択し、「標準のデプロイメント・ディスクリプタ」を選択します。
-[start=5]
+
. 「終了」をクリックします。IDEでアプリケーション全体のプロジェクト・テンプレートが作成され、空のJSPページ(`index.jsp`)がエディタに表示されます。`index.jsp`ファイルはアプリケーションの開始ページとして動作します。
@@ -147,10 +147,10 @@
[tips]#「パレット」は好みにあわせて構成できます。「パレット」を右クリックして「大きなアイコンを表示」と「項目の名前を非表示」を選択すると、上のイメージのようになります。#
-[start=4]
+
. `<h1>`タグのすぐ後ろの場所にカーソルを置きます。ここに、新しいHTML表を実装します。「パレット」で「表」アイコンをダブルクリックします。
-[start=5]
+
. 表示される「挿入表」ダイアログで次の値を指定し、「OK」をクリックします。
* *行*: 2
@@ -158,7 +158,7 @@
* *境界線のサイズ*: 0
HTML表コードが生成され、ページに追加されます。
-[start=6]
+
. 次の内容を、表の見出しと、表の最初の行のセルに追加します(追加する内容は*太字*で表示)。
[source,xml]
@@ -177,12 +177,12 @@
</tr>
----
-[start=7]
+
. 表の最後の行にHTMLフォームを挿入します。そのためには、2番目のペアの`<td>`タグの間にカーソルを置き、パレットの「HTMLフォーム」(image:images/html-form-icon.png[])アイコンをダブルクリックします。「挿入フォーム」ダイアログで、「アクション」テキスト・フィールドに「`response.jsp`」と入力し、「OK」をクリックします。
image::images/insert-form.png[title="「挿入フォーム」ダイアログでのフォーム設定の指定"]
-[start=8]
+
. `<form>`タグの間に次の内容を入力します(追加する内容は*太字*で表示)。
[source,xml]
@@ -197,19 +197,19 @@
</tr>
----
-[start=9]
+
. [Enter]を押して、追加したコンテンツの後に空の行を追加し、パレットで「ドロップダウン・リスト」をダブルクリックして、「ドロップダウンの挿入」ダイアログ・ボックスを開きます。
-[start=10]
+
. 「ドロップダウンの挿入」ダイアログの「名前」テキスト・フィールドに「`subject_id`」と入力し、「OK」をクリックします。ドロップダウン・リストのコード・スニペットがフォームに追加されます。
ドロップダウン・リストのオプションの数は、ここでは重要ではありません。チュートリアルの後の手順で、Subjectデータベース表から収集したデータに基づいてオプションを動的に生成するJSTLタグを追加します。
-[start=11]
+
. 送信ボタン項目(image:images/submit-button.png[])を、先ほど追加したドロップダウン・リストの直後に追加します。これは、パレットを使用するか、前述のステップのようにエディタのコード補完を呼び出すことで操作できます。「挿入ボタン」ダイアログで、「ラベル」テキスト・フィールドと「名前」テキスト・フィールドの両方に「`submit`」と入力し、「OK」をクリックします。
-[start=12]
+
. コードをフォーマットするには、エディタ内を右クリックし、「フォーマット」([Alt]-[Shift]-[F]、Macの場合は[Ctrl]-[Shift]-[F])を選択します。コードが自動的にフォーマットされ、次のような外観になります。
[source,xml]
@@ -263,10 +263,10 @@
image::images/response-jsp-node.png[title="「プロジェクト」ウィンドウに表示されたresponse.jspノード"]
-[start=4]
+
. エディタで、タイトルを「`IFPWAFCAD - {placeholder}`」に変更します。
-[start=5]
+
. `<h1>Hello World!</h1>`行(`<body>`タグの間にあります)を除去し、次のHTML表をコピーしてページの本文に貼り付けます。
[source,xml]
@@ -363,7 +363,7 @@
}
----
-[start=4]
+
. スタイル・シートを`index.jsp`と`response.jsp`にリンクします。両方のページで、`<head>`タグの間に次の行を追加します。
[source,java]
@@ -424,27 +424,27 @@
[tips]#JDBCデータ・ソースは、link:http://www.oracle.com/technetwork/java/jndi/index.html[+JNDI+] (Java Naming and Directory Interface)に依存します。JNDI APIは、アプリケーションでデータ・ソースを検索、利用するための共通の手段を提供します。詳細は、link:http://docs.oracle.com/javase/jndi/tutorial/[+JNDIチュートリアル+]を参照してください。#
-[start=3]
+
. (オプション)データ・ソースには説明を追加できます。たとえば、「`IFPWAFCADアプリケーション用のデータを提供するデータベースにアクセスします`」と入力します。
-[start=4]
+
. 「次」をクリックし、もう一度「次」をクリックして、ステップ3「追加のプロパティ」をスキップします。
-[start=5]
+
. ステップ4で「JDBC接続プール名」に「*IfpwafcadPool*」と入力します。「既存の接続から抽出」オプションが選択されていることを確認し、ドロップダウン・リストから「`jdbc:mysql://localhost:3306/MyNewDatabase`」を選択します。「次」をクリックします。
image::images/jdbc-resource-wizard2.png[title="JDBCリソース・ウィザードでの接続プール設定の指定"]
*注意:* IDEで設定されたデータベース接続がある場合は、ウィザードで検出されます。そのため、この時点で`MyNewDatabase`データベースへの接続がすでに作成されている必要はありません。作成済の接続を確認するには、「サービス」ウィンドウを開き([Ctrl]-[5]、Macの場合は[⌘]-[5])、「データベース」カテゴリで接続ノード(image:images/connection-node-icon.png[])を検索します。
-[start=6]
+
. 手順5で、「リソースの型」ドロップダウン・リストで「`javax.sql.ConnectionPoolDataSource`」を選択します。
IDEは、前のステップで指定したデータベース接続から情報を抽出し、新規接続プール用の名前と値のプロパティを設定することに注意してください。
image::images/jdbc-resource-wizard3.png[title="選択したデータベース接続から抽出された情報に基づくデフォルト値"]
-[start=7]
+
. 「終了」をクリックします。ウィザードによって`glassfish-resources.xml`ファイルが生成され、指定したデータ・ソースと接続プール用のエントリが格納されます。
「プロジェクト」ウィンドウで、「サーバー・リソース」ノードに作成した`glassfish-resources.xml`ファイルを開くことができます。`<resources>`タグ内には、前に指定した値を持つデータ・ソースと接続プールが宣言されています。
@@ -481,7 +481,7 @@
「リソース参照」見出しの下に新しいリソースが表示されます。
-[start=6]
+
. リソースが`web.xml`ファイルに追加されたことを確認するには、エディタの最上部にある「ソース」タブをクリックします。次に示す<`resource-ref`> タグが含まれるようになりました。
[source,xml]
@@ -509,16 +509,16 @@
image::images/servers-window.png[title="JDBCドライバのデプロイメント・オプションによる、ドライバの自動デプロイメントの有効化"]
-[start=3]
+
. サーバー・マネージャを閉じる前に、「ドメイン・フォルダ」テキスト・フィールドに指定されたパスをメモします。IDEでGlassFishサーバーに接続すると、実際はアプリケーション・サーバーの_インスタンス_に接続されます。各インスタンスは一意のドメインでアプリケーションを実行し、「ドメイン名」フィールドはサーバーが使用しているドメインの名前を示します。上のイメージに示されているように、ドライバのJARファイルは`domain1`内に存在します。これは、GlassFishサーバーをインストールしたときに作成されたデフォルトのドメインです。
-[start=4]
+
. 「閉じる」をクリックしてサーバー・マネージャを終了します。
-[start=5]
+
. コンピュータ上で、GlassFishサーバーのインストール・ディレクトリに移動し、「`domains`」>「`domain1`」>「`lib`」サブフォルダに移動します。IFPWAFCADプロジェクトはすでにサーバーにデプロイされているため、「`mysql-connector-java-5.1.6-bin.jar`」ファイルが存在しているはずです。ドライバのJARファイルがない場合は、次のステップを実行します。
-[start=6]
+
. プロジェクトをサーバーにデプロイします。IDEの「プロジェクト」ウィンドウで、プロジェクト・ノードの右クリック・メニューから「デプロイ」を選択します。進捗状況は、IDEの出力ウィンドウ([Ctrl]-[4]、Macの場合は[⌘]-[4])に表示されます。この出力に、GlassFishサーバーの場所にMySQLドライバがデプロイされることが示されます。
image::images/output-window.png[title="MySQLドライバがデプロイされたことを示す「出力」ウィンドウ"]
@@ -572,7 +572,7 @@
「DBレポート」項目は、`<sql:query>`タグを使用してSQL問合せを作成してから、`<c:forEach>`タグを使用して問合せの`resultset`をループし、取得したデータを出力します。
-[start=2]
+
. `<%@page ... %>`宣言(行7)のすぐ上の行にカーソルを置き、パレットの「DBレポート」項目をダブルクリックします。表示されたダイアログに、次の詳細を入力します。
* *変数名:* `subjects`
* *スコープ:* `page`
@@ -581,7 +581,7 @@
image::images/insert-db-report.png[title="「DBレポートの挿入」ダイアログを使用した、問合せ固有の詳細の指定"]
-[start=3]
+
. 「OK」をクリックします。次の内容が`index.jsp`ファイル内に生成されます。新しい内容は*太字*で表示しています。
[source,xml]
@@ -621,7 +621,7 @@
----
生成されたコンテンツで使用されるJSTLタグに必要な`taglib`ディレクティブ(`<sql:query>`および`<c:forEach>`)が、IDEによって自動的に追加されました。`taglib`ディレクティブは、JSPページがカスタム(つまり、JSTL)タグを使用することを宣言し、タグを定義するタグ・ライブラリおよびタグの接頭辞を指定します。
-[start=4]
+
. プロジェクトを実行し、ブラウザでどのように表示されるかを確認します。「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」を選択します。
「実行」を選択すると、IDEによってプロジェクトがGlassFishサーバーにデプロイされ、indexページがサーブレットにコンパイルされ、開始ページがデフォルトのブラウザに表示されます。「DBレポート」項目から生成されたコードによって、開始ページ内に次の表が作成されます。
@@ -633,10 +633,10 @@
次の手順では、生成されたコードを、このチュートリアルで以前に作成したHTMLドロップダウン・リストに統合する方法について説明します。
-[start=5]
+
. 生成されたコードの列データを確認します。2つの`<c:forEach>`タグが使用されており、1つがもう1つの入れ子になっています。これにより、JSPコンテナ(つまり、GlassFishサーバー)が表のすべての行でループを実行し、行ごとにすべての列をループします。この方法で、表全体のデータが表示されます。
-[start=6]
+
. 次のように、`<c:forEach>`タグをHTMLフォームに統合します。データベースに記録されているように、各項目の値は`subject_id`に、出力テキストは`name`になります。変更場所は*太字*で示されています。
[source,xml]
@@ -673,7 +673,7 @@
どちらの場合も、`<c:forEach>`タグはSQL問合せからすべての`subject_id`の値と`name`の値をループし、各ペアをHTMLの`<option>`タグに挿入します。この方法で、フォームのドロップダウン・リストがデータと一緒に生成されます。
-[start=7]
+
. 「DBレポート」項目から生成された表を削除します。削除場所は*[.line-through]#取消し線#*で示されています。
[source,xml]
@@ -713,10 +713,10 @@
"http://www.w3.org/TR/html4/loose.dtd">
----
-[start=8]
+
. 変更を保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
-[start=9]
+
. プロジェクトの開始ページをブラウザでリフレッシュします。
ブラウザのドロップダウン・リストに、データベースから取得されたサブジェクトが追加されています。
@@ -737,7 +737,7 @@
image::images/insert-db-query2.png[title="「DB問合せの挿入」ダイアログを使用した、問合せ固有の詳細の指定"]
-[start=3]
+
. 「OK」をクリックします。次の内容が`response.jsp`ファイル内に生成されます。新しい内容は*太字*で表示しています。
[source,xml]
@@ -762,7 +762,7 @@
----
`<sql:query>`タグのために必要な`taglib`ディレクティブが、IDEによって自動的に追加されました。また、問合せ内で`<sql:param>`タグを直接使用しました。この問合せは`index.jsp`から送信される`subject_id`の値に依存しているため、`${param.subject_id}`形式の式言語(EL)文を使用してその値を抽出して`<sql:param>`タグに渡すことができます。実行時にはこの値が、SQL疑問符(`?`)のかわりに使用されます。
-[start=4]
+
. `<c:set>`タグを使用して、問合せから返される`resultset`の最初のレコード(つまり、行)に対応する変数を設定します。新しい内容は*太字*で表示しています。
[source,xml]
@@ -778,7 +778,7 @@
----
問合せから返される`resultset`には本来1件のレコードのみが含まれますが、このページは式言語(EL)文を使用してレコードの値にアクセスする必要があるため、このステップが必要になります。`index.jsp`では、`<c:forEach>`タグを使用するのみで`resultset`の値にアクセスできました。ただし、`<c:forEach>`タグは、問合せに含まれる行に変数を設定することで動作します。そのため、EL文に行変数を含めることで値を抽出できます。
-[start=5]
+
. JSTL`コア`ライブラリ用の`taglib`ディレクティブをファイルの先頭に追加し、`<c:set>`タグが認識されるようにします。新しい内容は*太字*で表示しています。
[source,java]
@@ -788,7 +788,7 @@
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-[start=6]
+
. HTMLマークアップで、すべてのプレースホルダを、`counselorDetails`変数に保持されているデータを表示するEL文のコードに置き換えます。変更場所は*太字*で示されています。
[source,xml]
@@ -919,7 +919,7 @@
image::images/ping-succeeded.png[title="GlassFishサーバーの管理コンソールでのPingのクリックによる接続プールのテスト"]
-[start=6]
+
. Pingが失敗した場合は、「追加プロパティ」タブをクリックし、一覧表示されているプロパティの値が正しく設定されていることを確認します。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_pt_BR.asciidoc
index 9fc1430..d60a2a6 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_pt_BR.asciidoc
@@ -102,16 +102,16 @@
O assistente de Novo Projeto permite criar uma aplicação Web vazia em um projeto IDE padrão. O projeto padrão utiliza um script de construção Ant gerado pelo IDE para compilar, implantar e executar a aplicação.
-[start=2]
+
. Em Nome do Projeto, digite *IFPWAFCAD*. Além disso, especifique o local para o projeto no computador. (Por default, o IDE coloca projetos em uma pasta`NetBeansProjects` localizada no diretório home). Clique em Próximo.
-[start=3]
+
. No painel Servidor e Configurações, especifique o GlassFish Server como o servidor que será utilizado para executar a aplicação.
*Observação.*O GlassFish Server será exibido no campo drop-down Servidor se você tiver instalado a versão Java do link:https://netbeans.org/downloads/index.html[+NetBeans IDE+]. Como o GlassFish Server está incluído no download, ele é automaticamente registrado no IDE. Se você quiser utilizar um servidor diferente para esse projeto, clique no botão Adicionar localizado ao lado do campo drop-down Servidor e registre um servidor diferente no IDE. No entanto, trabalhar com servidores que não o GlassFish Server está além do escopo deste tutorial.
-[start=4]
+
. No campo Versão do Java EE, selecione *Java EE 5*.
image::images/server-settings.png[title="Especificar configurações de servidor no assistente de Nova Aplicação Web"]
@@ -121,7 +121,7 @@
*Observação.* Você pode igualmente definir a versão do projeto como Java EE 6 ou Java EE 7 e, em seguida, criar um descritor de implantação `web.xml`. (No assistente de Novo Arquivo, selecione a categoria Web e, em seguida, Descritor de Implantação Padrão).
-[start=5]
+
. Clique em Finalizar. O IDE cria um modelo de projeto para toda a aplicação e abre uma página JSP vazia (`index.jsp`) no editor. O arquivo `index.jsp` serve como página de boas-vindas da aplicação.
@@ -148,10 +148,10 @@
[tips]#Você pode configurar a Paleta conforme desejar: clique com o botão direito do mouse na Paleta e selecione Mostrar Ícones Grandes e Ocultar Nomes dos Itens para que ela seja exibida como na imagem acima.#
-[start=4]
+
. Coloque o cursor em um ponto logo depois das tags `<h1>`. (É aí que você deseja implementar a nova tabela HTML.) Em seguida, na Paleta, clique duas vezes no ícone Tabela.
-[start=5]
+
. Na caixa de diálogo Inserir Tabela exibida, especifique os seguintes valores e clique em OK:
* *Linhas*: 2
@@ -159,7 +159,7 @@
* *Tamanho da Borda*: 0
O código da tabela HTML é gerado e adicionado a sua página.
-[start=6]
+
. Adicione o conteúdo a seguir ao cabeçalho da tabela e à célula da primeira linha da tabela (novo conteúdo mostrado em *negrito*):
[source,xml]
@@ -178,12 +178,12 @@
</tr>
----
-[start=7]
+
. Na linha inferior da tabela, insira um form HTML. Para isso, coloque o cursor entre o segundo par de tags `<td>`, em seguida, clique duas vezes no ícone do form HTML ( image:images/html-form-icon.png[] ) na Paleta. Na caixa de diálogo Inserir Form, digite `response.jsp` no campo Texto da Ação e, em seguida, clique em OK.
image::images/insert-form.png[title="Especificar as configurações do form na caixa de diálogo Inserir Form"]
-[start=8]
+
. Digite o conteúdo a seguir entre as tags `<form>` (novo conteúdo mostrado em *negrito*):
[source,xml]
@@ -198,19 +198,19 @@
</tr>
----
-[start=9]
+
. Pressione Enter para adicionar uma linha vazia após o conteúdo que você acabou de adicionar e, em seguida, clique duas vezes na Lista Drop-down na Paleta para abrir a caixa de diálogo Inserir Lista Drop-down.
-[start=10]
+
. Digite `subject_id` para o campo de texto Nome na caixa de diálogo Inserir Lista Drop-down e clique em OK. Observe que o snippet de código da lista drop-down será adicionado ao form.
O número de opções da lista drop-down não é importante no momento. Mais adiante neste tutorial, você adicionará tags JSTL que irão gerar dinamicamente as opções com base nos dados coletados da tabela do banco de dados Subject.
-[start=11]
+
. Adicione um item de botão Submeter ( image:images/submit-button.png[] ) ao ponto bem ao lado da lista drop-down adicionada. É possível utilizar a Paleta para fazer isso ou chamar a funcionalidade autocompletar código do editor, conforme ilustrado na etapa anterior. Na caixa de diálogo Inserir Botão, digite `submit` nos campos de texto Nome e Label e clique em OK.
-[start=12]
+
. Para formatar seu código, clique com o botão direito do mouse no editor e selecione Formatar (Alt-Shift-F; Ctrl-Shift-F no Mac). Seu código será formatado automaticamente e deverá ter a aparência semelhante ao seguinte código:
[source,xml]
@@ -264,10 +264,10 @@
image::images/response-jsp-node.png[title="o nó response.jsp é exibido na janela Projetos"]
-[start=4]
+
. No editor, altere o título `IFPWAFCAD: {placeholder}`.
-[start=5]
+
. Remova a linha `<h1>Hello World!</h1>` alinhe entre as tags `<body>` e copie e cole a tabela HTML a seguir no corpo da página:
[source,xml]
@@ -364,7 +364,7 @@
}
----
-[start=4]
+
. Vincule a folha de estilo a `index.jsp` e `response.jsp`. Nas duas páginas, adicione a linha a seguir entre as tags `<head>`:
[source,java]
@@ -425,27 +425,27 @@
[tips]#A fonte de dados JDBC conta com a link:http://www.oracle.com/technetwork/java/jndi/index.html[+JNDI+], a Interface de Nomenclatura e Diretório Java. A API JNDI fornece uma maneira uniforme de as aplicações encontrarem e acessarem as fontes de dados. Para obter mais informações, consulte link:http://docs.oracle.com/javase/jndi/tutorial/[+Tutorial do JNDI+].#
-[start=3]
+
. Como opção, adicione uma descrição para a fonte de dados. Por exemplo, digite: `Accesses the database that provides data for the IFPWAFCAD application`.
-[start=4]
+
. Clique em Próximo e em Próximo novamente para ignorar a etapa 3, Propriedades Adicionais.
-[start=5]
+
. Na Etapa 4, digite *IfpwafcadPool* para Nome do Pool de Conexões JDBC. Certifique-se de que a opção Extrair da Conexão Existente esteja selecionada e escolha `jdbc:mysql://localhost:3306/MyNewDatabase` na lista drop-down. Clique em Próximo.
image::images/jdbc-resource-wizard2.png[title="Especificar definições do pool de conexões no assistente de Recurso JDBC"]
*Observação: *O assistente detecta as conexões de banco de dados que tenham sido configuradas no IDE. Portanto, neste ponto, é necessário que você já tenha criado uma conexão ao banco de dados `MyNewDatabase`. Você pode verificar as conexões que foram criadas ao abrir a janela Serviços (Ctrl-5; &8984-5 no Mac) e procurar nós de conexão (image:images/connection-node-icon.png[]) na categoria Bancos de Dados.
-[start=6]
+
. Na Etapa 5, selecione `javax.sql.ConnectionPoolDataSource` na lista drop-down Tipo de Recurso.
Observe que o IDE extrai informações da conexão de banco de dados especificada na etapa anterior e define as propriedades de nome e valor para o novo pool de conexões.
image::images/jdbc-resource-wizard3.png[title="Os valores default são baseados nas informações extraídas da conexão de banco de dados selecionada"]
-[start=7]
+
. Clique em Finalizar. O assistente gera um arquivo `glassfish-resources.xml` que contém entradas para a fonte de dados e o pool de conexões especificados.
Na janela Projetos, você pode abrir o arquivo `glassfish-resources.xml` recém-criado em Recursos do Servidor e observar que, nas tags `<resources>`, foram declarados uma fonte de dados e um pool de conexões com os valores previamente especificados.
@@ -482,7 +482,7 @@
O novo recurso agora será listado abaixo do cabeçalho Referências de Recursos.
-[start=6]
+
. Para verificar se o recurso foi adicionado ao arquivo `web.xml`, clique na guia Código-fonte localizada na parte superior do editor. Observe que as tags <`resource-ref`> a seguir agora estão incluídas.
[source,xml]
@@ -510,16 +510,16 @@
image::images/servers-window.png[title="Opção Implantação de Driver JDBC ativa a implantação de driver automática"]
-[start=3]
+
. Antes de fechar o gerenciador de Servidores, anote o caminho indicado no campo de texto da pasta Domínios. Ao se conectar ao GlassFish Server no IDE, você está se conectando, na realidade, a uma _instância_ do servidor de aplicações. Cada instância executa aplicações em um domínio exclusivo e o campo Nome do Domínio indica o nome do domínio que o servidor está utilizando. Conforme mostrado na imagem acima, o arquivo JAR do driver deverá estar localizado em `domain1`, que é o domínio default criado na instalação do GlassFish Server.
-[start=4]
+
. Clique em Fechar para sair do gerenciador Servidores.
-[start=5]
+
. No computador, vá até o diretório de instalação do GlassFish Server e entre na subpasta `domínios` > `domain1` > `lib. `. Como você já deve ter implantando o projeto IFPWAFCAD no servidor, você verá o arquivo `mysql-connector-java-5.1.6-bin.jar`. Se você não vir o arquivo JAR do driver, execute a etapa a seguir.
-[start=6]
+
. Implante seu projeto no servidor. Na janela Projetos do IDE, selecione Implantar no menu de contexto do nó do projeto. Você pode ver o progresso na janela de Saída do IDE (Ctrl-4; &#8984-4 no Mac). A saída indica que o driver MySQL está implantado no GlassFish Server.
image::images/output-window.png[title="A janela de Saída indica que o driver MySQL foi implantado"]
@@ -573,7 +573,7 @@
O item Relatório do BD utiliza a tag `<sql:query>` para criar uma consulta SQL e, em seguida, utiliza a tag `<c:forEach>` para passar pelo `resultset`da consulta e obter os dados recuperados.
-[start=2]
+
. Coloque o cursor acima da declaração `<%@page ... %>` (linha 7) e, em seguida, clique duas vezes no item Relatório do BD na Paleta. Na caixa de diálogo que é exibida, insira os seguintes detalhes:
* *Nome da Variável:* `subjects`
* *Escopo:* `page`
@@ -582,7 +582,7 @@
image::images/insert-db-report.png[title="Use a caixa de diálogo Inserir Relatório do BD para especificar detalhes específicos da consulta"]
-[start=3]
+
. Clique em OK. O conteúdo a seguir é gerado no arquivo `index.jsp`. (Novo conteúdo mostrado em *negrito*.)
[source,xml]
@@ -622,7 +622,7 @@
----
Observe que o IDE adicionou automaticamente as diretivas `taglib` necessárias para as tags JSTL utilizadas no conteúdo gerado `<sql:query>` e `<c:forEach>`). Uma diretiva `taglib` declara que a página do JSP utiliza tags personalizadas (por exemplo, JSTL), nomeia a biblioteca de tags que as define e especifica seu prefixo de tag.
-[start=4]
+
. Execute o projeto para ver como ele é exibido no browser. Clique com o botão direito do mouse no nó na janela Projetos e selecione Executar.
Quando você seleciona Executar, o IDE implanta o projeto no GlassFish Server, a página de índice é compilada em um servlet e a página de boas-vindas é aberta no browser default. O código gerado do item Relatório de BD cria a tabela a seguir na página de boas-vindas.
@@ -634,10 +634,10 @@
As etapas a seguir demonstram como integrar o código gerado à lista drop-down HTML criada anteriormente no tutorial.
-[start=5]
+
. Examine os dados da coluna no código gerado. Duas tags `<c:forEach>` são utilizadas, uma está aninhada dentro da outra. Isso faz com que o contêiner JSP (por exemplo, o GlassFish Server) execute um loop em todas as linhas da tabela e, para cada linha, ele executa um loop em todas as colunas. Dessa maneira, os dados da tabela inteira são exibidos.
-[start=6]
+
. Integre as tags `<c:forEach>` no form HTML, conforme a seguir. O valor de cada item se torna `subject_id` e o texto de saída se torna o `name`, conforme registrado no banco de dados. (As alterações são exibidas em *negrito*).
[source,xml]
@@ -674,7 +674,7 @@
Em qualquer um dos casos, as tags `<c:forEach>` executam loop em todos os valores de `subject_id` e `name` da consulta SQL e inserem cada par nas tags `<option>` HTML. Dessa maneira, a lista drop-down do form é preenchida com dados.
-[start=7]
+
. Delete a tabela que foi gerada a partir do item Relatório de BD. (A exclusão é mostrada a seguir como *[.line-through]#texto tachado#*.)
[source,xml]
@@ -714,10 +714,10 @@
"http://www.w3.org/TR/html4/loose.dtd">
----
-[start=8]
+
. Salve as alterações (Ctrl-S; &#8984-S no Mac).
-[start=9]
+
. Atualize a página de boas-vindas do projeto no browser.
Note que a lista drop-down do browser contém, agora, nomes de assuntos que foram recuperados do banco de dados.
@@ -738,7 +738,7 @@
image::images/insert-db-query2.png[title="Use a caixa de diálogo Inserir Consulta do BD para especificar detalhes específicos da consulta"]
-[start=3]
+
. Clique em OK. O conteúdo a seguir é gerado no arquivo `response.jsp`. (Novo conteúdo mostrado em *negrito*.)
[source,xml]
@@ -763,7 +763,7 @@
----
Observe que o IDE adicionou automaticamente a diretiva `taglib` necessária para a tag `<sql:query>`. Além disso, observe que você utilizou uma tag `<sql:param>` diretamente na consulta. Como essa consulta conta com o valor `subject_id` que foi submetido de `index.jsp`, é possível extrair o valor utilizando uma instrução EL (Linguagem de Expressão) na forma de `${param.subject_id}` e, em seguida, passá-lo para a tag `<sql:param>`, para que ele possa ser utilizado no local do ponto de interrogação da SQL (`?`) durante o runtime.
-[start=4]
+
. Utilize uma tag `<c:set>` para definir uma variável que corresponda ao primeiro registro (ou seja, linha) do `resultset` retornado da consulta. (Novo conteúdo mostrado em *negrito*.)
[source,xml]
@@ -779,7 +779,7 @@
----
Embora o `resultset` retornado da consulta deva conter apenas um único registro, está é uma etapa necessária, pois a página precisa acessar valores do registro utilizando instruções EL (Linguagem de Expressão). Lembre-se que no `index.jsp` você podia acessar valores do `resultset` simplesmente utilizando uma tag `<c:forEach>`. No entanto, a tag `<c:forEach>` opera definindo uma variável para linhas contidas na consulta, permitindo, assim, extrair valores incluindo a variável da linha nas instruções EL.
-[start=5]
+
. Adicione a diretiva `taglib` para a biblioteca `core` do JSTL na parte superior do arquivo, para que a tag `<c:set>` seja entendida. (Novo conteúdo mostrado em *negrito*.)
[source,java]
@@ -789,7 +789,7 @@
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-[start=6]
+
. Na marcação HTML, substitua todos os espaços reservados por código de instruções EL que exibem os dados contidos na variável `counselorDetails`. (Alterações mostradas a seguir em *negrito*):
[source,xml]
@@ -920,7 +920,7 @@
image::images/ping-succeeded.png[title="Teste o seu pool de conexões clicando em Ping na Console de Administração do GlassFish Server"]
-[start=6]
+
. Se o ping falhar, clique na guia Propriedades Adicionais e verifique se os valores da propriedade listados estão corretamente definidos.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ru.asciidoc
index 5e39c05..ed8138e 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_ru.asciidoc
@@ -101,16 +101,16 @@
С помощью этого мастера можно создать пустое веб-приложение в стандартном проекте IDE. В стандартном проекте для компиляции, развертывания и выполнения приложения используется созданный в среде IDE сценарий сборки проекта Ant.
-[start=2]
+
. *В поле "Имя проекта" введите "IFPWAFCAD".* Также укажите местоположение проекта на компьютере. По умолчанию проекты в среде IDE помещаются в папку `NetBeansProjects` в домашнем каталоге. Нажмите кнопку "Далее".
-[start=3]
+
. В панели "Сервер и параметры" укажите сервер GlassFish в качестве сервера, на котором будет запускаться приложение.
*Примечание.*Сервер GlassFish отображается в раскрывающемся списке 'Сервер', если установлена версия Java link:https://netbeans.org/downloads/index.html[+IDE NetBeans+]. Поскольку сервер GlassFish включен в загрузку, он регистрируется в среде IDE автоматически. Для использования в проекте другого сервера нажмите кнопку "Добавить" рядом с полем с раскрывающимся списком "Сервер" и зарегистрируйте другой сервер в среде IDE. Работа с другими серверами, помимо GlassFish в рамках данного учебного курса не рассматривается.
-[start=4]
+
. В поле "Версия Java EE" выберите *Java EE 5*.
image::images/server-settings.png[title="Укажите настройки сервера в мастере создания веб-приложений"]
@@ -120,7 +120,7 @@
*Примечание.* Точно так же можно указать в качестве версии проекта Java EE 6 или Java EE 7, а затем создать дескриптор развертывания `web.xml`. В мастере создания файла выберите категорию "Web", а затем выберите "Стандартный дескриптор развертывания".
-[start=5]
+
. Нажмите кнопку "Завершить". Создается шаблон проекта для всего приложения и в редакторе открывается пустая страница JSP (`index.jsp`). Файл `index.jsp`служит в приложении страницей приветствия.
@@ -147,10 +147,10 @@
[tips]#Палитру можно настроить в соответствии с существующими требованиями - щелкните правой кнопкой мыши палитру и выберите 'Показать крупные значки' и 'Скрыть имена элементов', чтобы палитра выглядела как на рисунке выше.#
-[start=4]
+
. Установите курсор сразу же после тегов `<h1>`. (Именно в этом месте будет внедрена новая таблица HTML). Далее в окне "Палитра" дважды щелкните значок "Таблица".
-[start=5]
+
. В появившемся диалоговом окне "Вставка таблицы" укажите следующие значения и затем нажмите кнопку "ОК":
* *Рядов*: 2
@@ -158,7 +158,7 @@
* *Размер границы*: 0
Код таблицы HTML создан и добавлен на страницу.
-[start=6]
+
. Добавьте следующее содержимое в заголовок таблицы и ячейку первой строки таблицы (новое содержимое выделено *полужирным шрифтом*):
[source,xml]
@@ -177,12 +177,12 @@
</tr>
----
-[start=7]
+
. Для нижней строки таблицы вставьте форму HTML. Для этого поместите курсор между второй парой тегов `<td>` и дважды щелкните значок формы HTML ( image:images/html-form-icon.png[] ) на палитре. В диалоговом окне "Вставка формы" введите `response.jsp` в текстовом поле "Действие" и нажмите кнопку "ОК".
image::images/insert-form.png[title="Укажите настройки формы в диалоговом окне 'Вставить форму'"]
-[start=8]
+
. Между тегами `<form>` введите следующее содержимое (новое содержимое выделено *полужирным шрифтом*):
[source,xml]
@@ -197,19 +197,19 @@
</tr>
----
-[start=9]
+
. Нажмите клавишу Enter, чтобы добавить пустую строку после добавленного содержимого, затем дважды щелкните "Список" в палитре, чтобы открыть диалоговое окно "Вставить список".
-[start=10]
+
. В диалоговом окне "Вставить список" ведите `subject_id` для текстового поля "Имя" и нажмите "OK". Обратите внимание на то, что к форме добавляется фрагмент кода для раскрывающегося списка.
Количество параметров для раскрывающегося списка не имеет значения. Позже в этом учебном курсе будет показано добавление тегов JSTL для динамического создания на основе данных, полученных из таблицы базы данных "Subject".
-[start=11]
+
. Добавьте элемент кнопки 'Отправить' ( image:images/submit-button.png[] ) в точку, расположенную непосредственно после только что добавленного раскрывающегося списка. Для этого можно использовать окно "Палитра" или вызвать дополнение кода в редакторе, как показано в предыдущем шаге. В диалоговом окне "Вставка кнопки" в текстовых полях "Подпись" и "Имя" введите `Отправить` и нажмите кнопку ОК.
-[start=12]
+
. Для форматирования кода щелкните правой кнопкой мыши в редакторе и выберите 'Формат' (Alt-Shift-F; Ctrl-Shift-F в Mac). Код автоматически форматируется и должен теперь выглядеть следующим образом:
[source,xml]
@@ -263,10 +263,10 @@
image::images/response-jsp-node.png[title="Узел response.jsp отображается в окне 'Проекты'"]
-[start=4]
+
. В редакторе измените заголовок на `IFPWAFCAD - {местозаполнитель}`
-[start=5]
+
. Удалите строку `<h1>Hello World!</h1>` строка между тегами `<body>`. Скопируйте и вставьте в тело страницы следующую таблицу HTML:
[source,xml]
@@ -363,7 +363,7 @@
}
----
-[start=4]
+
. Подключите таблицу стилей к `index.jsp` и `response.jsp`. На обеих страницах добавьте следующую строку между тегами `<head>`:
[source,java]
@@ -424,27 +424,27 @@
[tips]#Источник данных JDBC использует link:http://www.oracle.com/technetwork/java/jndi/index.html[+JNDI+]. В интерфейсе API JNDI предоставляется единый для всех приложений способ поиска источников данных и получения доступа к ним. Дополнительные сведения приведены в link:http://docs.oracle.com/javase/jndi/tutorial/[+Учебном курсе по JND+].#
-[start=3]
+
. Дополнительно можно добавить описание источника данных. Например, укажите `Обеспечивает доступ к базам данных, поставляющим данные для приложения IFPWAFCAD`.
-[start=4]
+
. Нажмите кнопку "Далее". После этого еще раз нажмите кнопку "Далее" и пропустите шаг 3, "Дополнительные свойства".
-[start=5]
+
. В шаге 4 укажите имя пула подключений JDBC *IfpwafcadPool*. Убедитесь, что выбран параметр "Извлечь из существующего соединения" и выберите `jdbc:mysql://localhost:3306/MyNewDatabase` из раскрывающегося списка. Нажмите кнопку "Далее".
image::images/jdbc-resource-wizard2.png[title="Укажите настройки пула подключений в мастере ресурсов JDBC"]
*Примечание. *Мастер обнаруживает все соединения с базой данных, настроенные в IDE. Поэтому на этот момент должно существовать созданное подключение к базе данных `MyNewDatabase`. Можно проверить, какие подключения были созданы, открыв окно 'Службы' (Ctrl-5; ⌘-5 в Mac) и выполнив поиск узлов подключения ( image:images/connection-node-icon.png[] ) в категории 'Базы данных'.
-[start=6]
+
. На этапе 5 выберите файл `javax.sql.ConnectionPoolDataSource` в списке "Тип ресурса".
Обратите внимание на то, что среда IDE извлекает информацию из подключенной базы данных, указанной на предыдущем этапе, и задает свойства "имя-значение" для нового пула подключений.
image::images/jdbc-resource-wizard3.png[title="Значения по умолчанию основаны на данных, извлеченных из выбранного подключения к базе данных"]
-[start=7]
+
. Нажмите кнопку "Завершить". Мастер ресурсов создает файл `glassfish-resources.xml`, который содержит записи для источника данных и указанный пул подключения.
В окне "Проекты" можно открыть `glassfish-resources.xml`, созданный в дереве узла "Серверные ресурсы". Обратите внимание, что в тегах `<resources>` источник данных и пул соединений объявлены как содержащие ранее указанные значения.
@@ -481,7 +481,7 @@
Новый ресурс теперь перечислен в списке под заголовком 'Ссылки на ресурсы'.
-[start=6]
+
. Чтобы убедиться, что ресурс добавлен в файл `web.xml`, перейдите на вкладку "Исходный код" в верхней части экрана редактора. Заметим, что теперь в код включены следующие теги <`resource-ref`>.
[source,xml]
@@ -509,16 +509,16 @@
image::images/servers-window.png[title="Параметр развертывания драйвера JDBC обеспечивает поддержку автоматического развертывания драйверов"]
-[start=3]
+
. Прежде чем закрыть Диспетчер серверов, запишите путь, указанный в текстовом поле "Папка доменов". При подключении к серверу GlassFish в среде IDE фактически подключение выполняется к _экземпляру_ сервера приложений. Каждый экземпляр запускает приложения в уникальном домене, а в поле "Имя домена" указано имя используемого сервером домена. Как видно на рисунке выше, файл JAR драйвера должен находиться в `domain1`. Это домен по умолчанию, созданный при установке сервера GlassFish.
-[start=4]
+
. Нажмите кнопку "Закрыть", чтобы выйти из Диспетчера серверов.
-[start=5]
+
. На компьютере перейдите к каталогу установки GlassFish и войдите в подпапку `domains` > `domain1` > `lib`. Поскольку проект IFPWAFCAD уже должен быть развернут на сервере, должен отображаться файл `mysql-connector-java-5.1.6-bin.jar`. Если файл JAR драйвера не отображается, выполните следующий шаг.
-[start=6]
+
. Разверните проект на сервере. В окне 'Проекты' среды IDE выберите 'Развернуть' в контекстном меню узла проекта. Ход выполнения можно видеть в окне "Вывод" среды IDE (CTRL+4; &#8984+4 для Mac). В окне "Вывод" указывается, что драйвер MySQL развернут в местоположении на сервере GlassFish.
image::images/output-window.png[title="В окне вывода указывается, что драйвер MySQL был развернут"]
@@ -572,7 +572,7 @@
Для элемента "Отчет БД" при создании запроса SQL используется тег `<sql:query>`, после чего с помощью тега `<c:forEach>` обрабатывается `resultset` запроса, а затем выполняется вывод извлеченных данных.
-[start=2]
+
. Установите курсор над объявлением `<%@page ... %>` (строка 7) и дважды щелкните элемент "Отчет БД" в окне "Палитра". В открывшемся диалоговом окне введите следующие подробные сведения:
* *Имя переменной:* `subjects`
* *Контекст:* `страница`
@@ -581,7 +581,7 @@
image::images/insert-db-report.png[title="Используйте диалоговое окно 'Вставить отчет базы данных' для указания сведения, связанных с запросом"]
-[start=3]
+
. Нажмите кнопку "ОК". В файле `index.jsp` создается следующее содержимое. Новое содержимое выделено *полужирным шрифтом*.
[source,xml]
@@ -621,7 +621,7 @@
----
Обратите внимание на то, что в среде IDE автоматически добавлены директивы `taglib`, необходимые для тегов JSTL, используемых в созданном содержимом, (`<sql:query>` и `<c:forEach>`). Директива `taglib` объявляет, что на странице JSP используются пользовательские теги (JSTL), указывает библиотеку тегов, которая их определяет, а также префикс тега.
-[start=4]
+
. Запустите проект, чтобы проверить его отображение в браузере. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите "Выполнить".
При выборе "Выполнить", IDE развертывает проект на сервере GlassFish, страница индексов компилируется в сервлет, а страница приветствия открывается в браузере по умолчанию. Код, созданный на основе элемента "Отчет БД", определяет следующую таблицу на странице приветствия.
@@ -633,10 +633,10 @@
В следующих шагах рассматривается интеграция созданного кода в раскрывающийся список HTML, созданный выше при работе с данным учебным курсом.
-[start=5]
+
. Проверьте данные столбцов в созданном коде. Используется два тега `<c:forEach>`, причем один из них вставляется в другой. В результате контейнер JSP (сервер GlassFish) выполняет цикл по всем строкам таблицы с циклическим прохождением всех столбцов. Аналогично отображаются данные для всей таблицы.
-[start=6]
+
. Интегрируйте теги `<c:forEach>` в форму HTML следующим образом. Значение каждого элемента изменяется на `subject_id`, а текст вывода - на `name`, как записано в базе данных. (Изменения выделяются *полужирным шрифтом*).
[source,xml]
@@ -673,7 +673,7 @@
Во всех случаях теги `<c:forEach>` циклически обрабатывает значения `subject_id` и `name` из запроса SQL со вставкой каждой пары в теги HTML `<option>`. Таким образом раскрывающийся список формы заполняется данными.
-[start=7]
+
. Удалите таблицу, созданную из элемента "Отчет БД". (Удаление показано ниже *[.line-through]#перечеркнутым текстом#*.)
[source,xml]
@@ -713,10 +713,10 @@
"http://www.w3.org/TR/html4/loose.dtd">
----
-[start=8]
+
. Сохраните изменения (CTRK+S; &#8984+S в Mac OS).
-[start=9]
+
. Обновите страницу приветствия проекта в браузере.
Заметим, что раскрывающийся список в браузере теперь содержит названия тем, полученные из базы данных.
@@ -737,7 +737,7 @@
image::images/insert-db-query2.png[title="Используйте диалоговое окно 'Вставить запрос базы данных' для указания сведения, связанных с запросом"]
-[start=3]
+
. Нажмите кнопку "ОК". В файле `response.jsp` создается следующее содержимое. Новое содержимое выделено *полужирным шрифтом*.
[source,xml]
@@ -762,7 +762,7 @@
----
Обратите внимание на то, что в среде IDE автоматически добавлена директива `taglib` для тега `<sql:query>`. Также отметьте, что непосредственно в запросе использовался тег `<sql:param>`. Поскольку для этого запроса используется значение `subject_id`, отправленное с `index.jsp`, извлечь это значение можно с помощью оператора EL (язык выражений) в форме `${param.subject_id}`, а затем передать его для тега `<sql:param>`. В этом случае его можно использовать вместо вопросительного знака SQL (`?`) во время выполнения.
-[start=4]
+
. Используйте тег `<c:set>` для установки переменной, соответствующей первой записи (строке) `resultset`, возвращенного из запроса. Новое содержимое выделено *полужирным шрифтом*.
[source,xml]
@@ -778,7 +778,7 @@
----
Несмотря на то, что возвращенный из запроса `resultset` должен содержать только одну запись, этот шаг является обязательным, поскольку для страницы необходимо обеспечить доступ к значениям в записи с помощью операторов EL (язык выражений). Вспомните, что на странице `index.jsp` можно было получить доступ к значениям из `resultset` просто посредством тега `<c:forEach>`. Однако тег `<c:forEach>` функционирует путем настройки переменной для строк из запроса, что позволяет извлекать значения путем включения переменной строки в операторы EL.
-[start=5]
+
. Добавьте директиву `taglib` для `базовой` библиотеки JSTL файла. Это обеспечит распознавание тега `<c:set>`. Новое содержимое выделено *полужирным шрифтом*.
[source,java]
@@ -788,7 +788,7 @@
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-[start=6]
+
. В разметке HTML замените все местозаполнители кодом операторов EL с отображением данных из переменной `counselorDetails`. (Изменения выделены ниже *полужирным шрифтом*):
[source,xml]
@@ -919,7 +919,7 @@
image::images/ping-succeeded.png[title="Проверьте пул подключений, щелкнув 'Ping' на консоли администрирования сервера GlassFish"]
-[start=6]
+
. Если выполнение ping-тестирования завершается неуспешно, откройте вкладку "Дополнительные свойства" для проверки правильности настройки указанных значений свойств.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_zh_CN.asciidoc
index adb97bc..8fe2da9 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/mysql-webapp_zh_CN.asciidoc
@@ -102,16 +102,16 @@
使用新建项目向导,可以在标准 IDE 项目中创建空的 Web 应用程序。标准项目使用 IDE 构建的 Ant 构建脚本来编译、部署和运行应用程序。
-[start=2]
+
. 在 "Project Name"(项目名称)中,输入 *IFPWAFCAD*。同时,指定项目在计算机上的位置。(默认情况下,IDE 会将项目置于主目录下的 `NetBeansProjects` 文件夹中。)单击 "Next"(下一步)。
-[start=3]
+
. 在 "Server and Settings"(服务器和设置)面板中,指定 GlassFish Server 作为用于运行应用程序的服务器。
*注:*如果您安装了 Java 版本的 link:https://netbeans.org/downloads/index.html[+NetBeans IDE+],则 GlassFish Server 将显示在 "Server"(服务器)下拉字段中。由于 GlassFish Server 包含在下载中,因此会在 IDE 中自动进行注册。如果要对此项目使用其他服务器,请单击位于 "Server"(服务器)下拉字段旁边的 "Add"(添加)按钮,然后在 IDE 中注册其他服务器。但是,使用 GlassFish Server 之外的服务器不在本教程的讲述范围之内。
-[start=4]
+
. 在 "Java EE Version"(Java EE 版本)字段中,选择 *Java EE 5*。
image::images/server-settings.png[title="在新建 Web 应用程序向导中指定服务器设置"]
@@ -121,7 +121,7 @@
*注:*您同样可以将项目版本设置为 Java EE 6 或 Java EE 7,然后创建 `web.xml` 部署描述符。(从新建文件向导中选择 "Web" 类别,然后选择 "Standard Deployment Descriptor"(标准部署描述符)。)
-[start=5]
+
. 单击 "Finish"(完成)。IDE 将为整个应用程序创建一个项目模板,并在编辑器中打开一个空的 JSP 页 (`index.jsp`)。`index.jsp` 文件充当应用程序的欢迎页面。
@@ -148,10 +148,10 @@
[tips]#您可以根据自己的喜好配置 "Palette"(组件面板)- 在 "Palette"(组件面板)中单击鼠标右键并选择 "Show Big Icons"(显示大图标)和 "Hide Item Names"(隐藏项名称)可使其显示上图所示的内容。#
-[start=4]
+
. 将光标指针放在紧靠 `<h1>` 标记后面的位置。(该位置即是您要实现新的 HTML 表的位置。)然后,在 "Palette"(组件面板)中双击 "Table"(表)图标。
-[start=5]
+
. 在显示的 "Insert Table"(插入表格)对话框中,指定以下值,然后单击 "OK"(确定):
* *Rows(行):*2
@@ -159,7 +159,7 @@
* *Border Size(边框大小):*0
此时会生成 HTML 表代码并已添加到您的页面中。
-[start=6]
+
. 将以下内容添加到表标题和第一个表行的单元格中(新内容以*粗体*显示):
[source,xml]
@@ -178,12 +178,12 @@
</tr>
----
-[start=7]
+
. 在底部的表行中,插入一个 HTML 窗体。为此,请将光标置于第二对 `<td>` 标记之间,然后在 "Palette"(组件面板)中双击 "HTML form"(HTML 窗体)(image:images/html-form-icon.png[]) 图标。在 "Insert Form"(插入窗体)对话框的 "Action"(操作)文本字段中,键入 `response.jsp`,然后单击 "OK"(确定)。
image::images/insert-form.png[title="在 "Insert Form"(插入窗体)对话框中指定窗体设置"]
-[start=8]
+
. 在 `<form>` 标记之间键入以下内容(新内容以*粗体*显示):
[source,xml]
@@ -198,19 +198,19 @@
</tr>
----
-[start=9]
+
. 按 Enter 键将在您刚刚添加的内容之后添加一空行,然后双击 "Palette"(组件面板)中的 "Drop-down List"(下拉列表)以打开 "Insert Drop-down"(插入下拉列表)对话框。
-[start=10]
+
. 在 "Insert Drop-down"(插入下拉列表)对话框的 "Name"(名称)文本字段中键入 `subject_id`,然后单击 "OK"(确定)。请注意,下拉列表的代码片段会添加到窗体中。
下拉列表的选项数目当前并不重要。稍后,我们将在本教程中添加动态生成选项(基于从 Subject 数据库表收集的数据)的 JSTL 标记。
-[start=11]
+
. 就在您刚刚添加的下拉列表后的位置点处添加 "submit"(提交)按钮项 (image:images/submit-button.png[])。可以使用 "Palette"(组件面板)执行此操作,也可以调用编辑器的代码完成(如上一步中所述)。在 "Insert button"(插入按钮)对话框的 "Label"(标签)和 "Name"(名称)字段中均输入 `submit`,然后单击 "OK"(确定)。
-[start=12]
+
. 要设置代码的格式,请在编辑器中单击鼠标右键,然后选择 "Format"(格式化代码)(Alt-Shift-F 组合键;在 Mac 上为 Ctrl-Shift-F 组合键)。系统会为您的代码自动设置格式,并且类似于以下内容:
[source,xml]
@@ -264,10 +264,10 @@
image::images/response-jsp-node.png[title="response.jsp 节点显示在 "Projects"(项目)窗口中"]
-[start=4]
+
. 在编辑器中,将标题更改为:`IFPWAFCAD - {placeholder}`。
-[start=5]
+
. 删除 `<body>` 标记之间的 `<h1>Hello World!</h1>` 一行,然后复制下面的 HTML 表并将其粘贴到页面主体中:
[source,xml]
@@ -364,7 +364,7 @@
}
----
-[start=4]
+
. 将样式表链接到 `index.jsp` 和 `response.jsp`。在这两个页面中,将以下行添加到 `<head>` 标记之间:
[source,java]
@@ -425,27 +425,27 @@
[tips]#JDBC 数据源依赖于 link:http://www.oracle.com/technetwork/java/jndi/index.html[+JNDI+](Java Naming and Directory Interface,Java 命名和目录接口)。JNDI API 为应用程序查找和访问数据源提供了统一的方式。有关详细信息,请参见 link:http://docs.oracle.com/javase/jndi/tutorial/[+JNDI 教程+]。#
-[start=3]
+
. (可选)为数据源添加描述。例如,键入:`Accesses the database that provides data for the IFPWAFCAD application`。
-[start=4]
+
. 单击 "Next"(下一步),然后再次单击 "Next"(下一步)以跳过步骤 3“附加属性”。
-[start=5]
+
. 在步骤 4 中,键入 *IfpwafcadPool* 作为 JDBC 连接池名称。确保 "Extract from Existing Connection"(从现有连接中提取)选项已选中,然后从下拉列表中选择 `jdbc:mysql://localhost:3306/MyNewDatabase`。单击 "Next"(下一步)。
image::images/jdbc-resource-wizard2.png[title="在 JDBC 资源向导中指定连接池设置"]
*注:*该向导会检测已在 IDE 中设置的任何数据库连接。所以,此时您必须已创建 `MyNewDatabase` 数据库的连接。您可以通过打开 "Services"(服务)窗口(Ctrl-5;在 Mac 上为 ⌘-5)并在 "Databases"(数据库)类别下查找连接节点 (image:images/connection-node-icon.png[]),验证已创建的连接。
-[start=6]
+
. 在步骤 5 中,在 "Resource Type"(资源类型)下拉列表中选择 `javax.sql.ConnectionPoolDataSource`。
请注意 IDE 将从上一步中指定的数据库连接中提取信息,并为新连接池设置名称-值属性。
image::images/jdbc-resource-wizard3.png[title="默认值基于从所选数据库连接提取的信息"]
-[start=7]
+
. 单击 "Finish"(完成)。该向导生成 `glassfish-resources.xml` 文件,其中包含数据源和所指定的连接池的相应条目。
在 "Projects"(项目)窗口中,可以打开在 "Server Resources"(服务器资源)节点下创建的 `glassfish-resources.xml` 文件,请注意,在 `<resources>` 标记中已声明数据源和连接池包含您以前指定的值。
@@ -482,7 +482,7 @@
现在,新资源会列在 "Resource References"(资源引用)标题下面。
-[start=6]
+
. 要验证该资源现在是否已添加到 `web.xml` 文件中,请单击编辑器顶部的 "Source"(源)标签。请注意,现在包含了以下 <`resource-ref`> 标记。
[source,xml]
@@ -510,16 +510,16 @@
image::images/servers-window.png[title="使用 "JDBC Driver Deployment"(JDBC 驱动程序部署)选项可进行自动驱动程序部署"]
-[start=3]
+
. 在关闭服务器管理器之前,请记录 "Domains"(域)文件夹文本字段中指示的路径。在连接 IDE 中的 GlassFish Server 时,实际上是连接到应用服务器的_实例_。每个实例均会在唯一的域中运行应用程序,"Domain Name"(域名)字段指示了服务器所使用的域名。如上图所示,驱动程序 JAR 文件应该位于 `domain1` 中,它是安装 GlassFish Server 时创建的默认域。
-[start=4]
+
. 单击 "Close"(关闭)退出服务器管理器。
-[start=5]
+
. 在计算机上,导航至 GlassFish Server 安装目录,并向下浏览到 `domains` > `domain1` > `lib` 子文件夹。您应该已将 IFPWAFCAD 项目部署到服务器,因此应会看到 `mysql-connector-java-5.1.6-bin.jar` 文件。如果没有看到驱动程序 JAR 文件,请执行下列步骤。
-[start=6]
+
. 将您的项目部署到服务器。在 IDE 的 "Projects"(项目)窗口中,从项目节点的右键单击菜单中选择 "Deploy"(部署)。在 IDE 的 "Output"(输出)窗口中可以查看进度(Ctrl-4 组合键;在 Mac 上为 ⌘-4 组合键)。输出会提示 MySQL 驱动程序已部署到 GlassFish Server 中的某个位置。
image::images/output-window.png[title=""Output"(输出)窗口指示已部署 MySQL 驱动程序"]
@@ -573,7 +573,7 @@
"DB Report"(数据库报告)项使用 `<sql:query>` 标记创建 SQL 查询,然后使用 `<c:forEach>` 标记对查询的 `resultset` 执行循环操作并输出检索到的数据。
-[start=2]
+
. 将光标置于 `<%@page ... %>` 声明(第 7 行)上方,然后双击 "Palette"(组件面板)中的 "DB Report"(数据库报告)项。在显示的对话框中,输入以下详细信息:
* *Variable Name(变量名称):*`subjects`
* *Scope(范围):*`page`
@@ -582,7 +582,7 @@
image::images/insert-db-report.png[title="使用 "Insert DB Report"(插入数据库报告)对话框指定特定于查询的详细信息"]
-[start=3]
+
. 单击 "OK"(确定)。在 `index.jsp` 文件中生成以下内容。(新内容以*粗体*显示。)
[source,xml]
@@ -622,7 +622,7 @@
----
请注意,IDE 自动添加了生成的内容中使用的 JSTL 标记(`<sql:query>` 和 `<c:forEach>`)所需的 `taglib` 指令。`taglib` 指令声明 JSP 页使用定制(即,JSTL)标记,命名用于定义这些标记的标记库,并指定其标记前缀。
-[start=4]
+
. 运行该项目以查看其在浏览器中的显示方式。在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Run"(运行)。
当您选择 "Run"(运行)时,IDE 会将项目部署到 GlassFish Server,索引页将编译为 Servlet,并在默认浏览器中打开欢迎页。通过 "DB Report"(数据库报告)项生成的代码在欢迎页面中创建以下表格。
@@ -634,10 +634,10 @@
以下步骤演示了如何将生成的代码集成到您在本教程前面所创建的 HTML 下拉列表中。
-[start=5]
+
. 检查生成的代码中的列数据。共使用了两个 `<c:forEach>` 标记;其中一个标记嵌套在另一个标记内。这导致 JSP 容器(即,GlassFish Server)对所有表行执行循环,对于每行,可对其中的所有列执行循环操作。以此方式显示整个表的数据。
-[start=6]
+
. 将 `<c:forEach>` 标记集成到 HTML 窗体中,如下所示。根据数据库中记录的数据,每项的值将变为 `subject_id`,输出文本将变为 `name`。(所做的更改以*粗体*显示)。
[source,xml]
@@ -674,7 +674,7 @@
在两种情况下,`<c:forEach>` 标记都会对 SQL 查询中的所有 `subject_id` 和 `name` 值执行循环操作,并将每对值插入 HTML `<option>` 标记中。在这种方式下,窗体的下拉列表中会填入数据。
-[start=7]
+
. 删除通过 "DB Report"(数据库报告)项生成的表。(删除的内容在下面以*[.line-through]#删除线文本#*显示。)
[source,xml]
@@ -714,10 +714,10 @@
"http://www.w3.org/TR/html4/loose.dtd">
----
-[start=8]
+
. 保存更改(Ctrl-S 组合键;在 Mac 上为 ⌘-S 组合键)。
-[start=9]
+
. 在浏览器中刷新项目的欢迎页。
请注意,浏览器中的下拉列表现在包含从数据库检索到的主题名称。
@@ -738,7 +738,7 @@
image::images/insert-db-query2.png[title="使用 "Insert DB Query"(插入数据库查询)对话框指定特定于查询的详细信息"]
-[start=3]
+
. 单击 "OK"(确定)。在 `response.jsp` 文件中生成以下内容。(新内容以*粗体*显示。)
[source,xml]
@@ -763,7 +763,7 @@
----
请注意,IDE 自动添加了 `<sql:query>` 标记所需的 `taglib` 指令。另请注意,您在查询中直接使用了 `<sql:param>` 标记。由于此查询依赖于从 `index.jsp` 提交的 `subject_id` 值,因此可以使用 `${param.subject_id}` 格式的 EL(Expression Language,表达式语言)语句提取值,然后将其传递到 `<sql:param>` 标记,以便在运行时可以使用该值替换 SQL 问号 (`?`)。
-[start=4]
+
. 使用 `<c:set>` 标记设置与查询所返回的 `resultset` 的第一个记录(即,行)相对应的变量。(新内容以*粗体*显示。)
[source,xml]
@@ -779,7 +779,7 @@
----
尽管查询所返回的 `resultset` 应仅包含一个记录,但此步骤非常有必要,因为页面需要使用 EL(Expression Language,表达式语言)语句访问记录中的值。回想一下,在 `index.jsp` 中,您使用 `<c:forEach>` 标记即可轻松访问 `resultset` 中的值。但是,`<c:forEach>` 标记的操作方式是通过为查询中包含的行设置变量,从而使您可以通过在 EL 语句中包含行变量来提取值。
-[start=5]
+
. 将 JSTL `core` 库的 `taglib` 指令添加到文件顶部,以便可以识别 `<c:set>` 标记。(新内容以*粗体*显示。)
[source,java]
@@ -789,7 +789,7 @@
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
----
-[start=6]
+
. 在 HTML 标记中,将所有占位符替换为 EL 语句代码,该代码显示 `counselorDetails` 变量中保存的数据。(所做的更改在下面以*粗体*显示):
[source,xml]
@@ -920,7 +920,7 @@
image::images/ping-succeeded.png[title="通过在 GlassFish Server 管理控制台中单击 "Ping" 测试连接池"]
-[start=6]
+
. 如果 ping 失败,请单击 "Additional Properties"(附加属性)标签,并确保所列的属性值设置正确。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud.asciidoc
index e42b1a3..fffac89 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud.asciidoc
@@ -109,12 +109,12 @@
image::images/add-cloud.png[]
-[start=3]
+
. In the Choose Cloud field, select Oracle Cloud and click Next to open the Oracle Cloud panel.
image::images/oracle-cloud1.png[]
-[start=4]
+
. Fill in all fields. Browse for the folder containing the Oracle Java Cloud Service SDK JAR. Click Next.
When you click Next the IDE tests the connection to the cloud. A list of Cloud services appears if the connection is successful. Only the Oracle Cloud Remote server (Oracle WebLogic) is currently available.
@@ -122,7 +122,7 @@
*Note:* After you register an Oracle Cloud provider, you can change the Cloud details in its Properties. Open Properties by right-clicking the Oracle Cloud node and selecting Properties.
-[start=5]
+
. Confirm that the Oracle Cloud provider is displayed in the list of Cloud resources. Click Finish.
Oracle Cloud is now listed under the Cloud node in the Services window. You can right-click the Oracle Cloud node to open a context menu that provides commands for refreshing the list of services, opening a list of jobs and logs, removing the cloud instance or viewing the cloud's properties.
@@ -176,12 +176,12 @@
image::images/project-contextmenu.png[]
-[start=2]
+
. In the Project Properties, select the Run category.
image::images/run-properties.png[]
-[start=3]
+
. From the Server drop-down list, select the server you want (either Oracle Cloud Remote or local Oracle WebLogic). The server must be registered in the IDE. You can add a server by right-clicking the Servers node in the Services window.
@@ -212,7 +212,7 @@
Use the HR username and password when you register the HR schema with NetBeans IDE.
-[start=2]
+
. Create a Java Web Application using Java EE5 and your on-premises installation of WebLogic server. Enable the JSF framework for the application.
image::images/crudapp-eevers.png[]
@@ -220,37 +220,37 @@
image::images/crudapp-jsf.png[]
-[start=3]
+
. In the Projects window, right-click the project's root node and select New > Entity Classes from Database. The Entity Classes from Database wizard opens.
-[start=4]
+
. In the Entity Classes from Database wizard, select New Data Source from the Data Source drop-down box. The Create Data Source dialog opens.
image::images/crudapp-newdatasource.png[]
-[start=5]
+
. Name this datasource to match the database service name in your registered Oracle Cloud account.
image::images/cloud-db-name.png[]
-[start=6]
+
. Select the OracleXE HR database connection you created in Step 1. Click OK. The Create Data Source dialog closes.
image::images/create-datasource.png[]
-[start=7]
+
. In the Entity Classes from Database wizard, the Available Tables field fills with the HR schema table names. Select one of the tables, such as EMPLOYEES, and click Add. Click through the rest of the wizard, giving an arbitrary name to the package containing the entity classes and accepting all default values in other fields.
-[start=8]
+
. In the Projects window, right-click the project's root node and select New > JSF Pages from Entity Classes. The New JSF Pages from Entity Classes wizard opens.
-[start=9]
+
. In the Entity Classes panel, click Select All and click Next.
-[start=10]
+
. In the Generate JSF Pages and Classes panel, give appropriate names to the packages and JSF file folder and click Finish.
-[start=11]
+
. In the Projects window, right-click the project's root node and select Run. The IDE builds the project and deploys it to the on-premises WebLogic server. A browser opens on the project's landing page.
You now have a local version of a Java web application using CRUD and JSF. You can test and tweak the application locally. When the application is in a final state, deploy it to Oracle Cloud.
@@ -262,21 +262,21 @@
image::images/crudapp-properties.png[]
-[start=3]
+
. In the Projects window, expand the project's Configuration Files node and double-click ` persistence.xml`. The file opens in the XML Editor's Design view.
-[start=4]
+
. Under Table Generation Strategy, select Create.
image::images/crudapp-persistence.png[]
-[start=5]
+
. If your on-premises WebLogic server has JPA 2.0 enabled, you must change the persistence provider from the default EclipseLink, which uses JPA 2.0, to a JPA 1.0 provider such as OpenJPA.
*Note: *If your on-premises WebLogic server is not JPA 2.0-enabled, EclipseLink falls back to JPA 1.0. In this case you do not need to change persistence providers.
-[start=6]
+
. In the Projects window, right-click the project's root node and select Run. The IDE builds the project and deploys it to the Oracle Cloud Remote server. You can follow the progress of deployment in the IDE's Output window, in the Oracle Cloud Remote Deployment tab.
*Caution: *Oracle Cloud does not yet support the uploading of database tables. Therefore no data is available for your application when it is on Oracle Cloud.
@@ -294,35 +294,35 @@
image::images/new-servlet.png[]
-[start=2]
+
. Give the servlet an arbitrary name, select an existing package for it and click Finish. The servlet class opens in the editor.
-[start=3]
+
. Find the servlet's ``processRequest`` method, type ``System.ex`` in the method body and press Ctrl-Space to open code completion. Code completion does not offer you the possibility to complete ``System.exit`` because ``System.exit`` is disallowed by the Oracle Cloud whitelist. The IDE shows ``exit`` with a line through it.
image::images/cc-failure.png[]
-[start=4]
+
. Finish typing ``System.exit(1);`` . A warning appears. Scroll the cursor over the warning icon, and a tooltip appears informing you that ``java.lang.System.exit`` is not allowed.
image::images/whitelist-warning.png[]
-[start=5]
+
. In the Projects window, right-click the application's node and select Verify. Open the Output window (Window > Output > Output or Ctrl-4). The Output window includes a Whitelist tab that shows errors due to whitelist restrictions.
image::images/whitelist-output.png[]
-[start=6]
+
. Open the Action Items window (Window > Action Items or Ctrl-6). Whitelist violations appear as a separate group of action items.
*Tip:* Turn on Group Action Items by Category (bottom button on left) to see whitelist violations more easily.
image::images/whitelist-tasks.png[]
-[start=7]
+
. Try to deploy the project. A warning dialog appears informing you that whitelist violations were detected and asking if you want to continue with deployment. Click No. The dialog disappears.
-[start=8]
+
.
In the Projects window, right-click the application's node and select Properties. The application's Project Properties open. Select the Whitelists category. A list of active whitelists appears. In this dialog you can disable the whitelist.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ja.asciidoc
index a54af94..8facb5b 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ja.asciidoc
@@ -109,12 +109,12 @@
image::images/add-cloud.png[]
-[start=3]
+
. 「クラウドを選択」フィールドで、Oracle Cloudを選択し、「次」をクリックして「Oracle Cloud」パネルを開きます。
image::images/oracle-cloud1.png[]
-[start=4]
+
. すべてのフィールドに入力します。Oracle Java Cloud Service SDK JARが含まれているフォルダを参照します。「次」をクリックします。
「次」をクリックすると、IDEによりクラウドへの接続がテストされます。接続に成功した場合は、クラウド・サービスのリストが表示されます。Oracle Cloud Remoteサーバー(Oracle WebLogic)のみが現在使用可能です。
@@ -122,7 +122,7 @@
*注意:* Oracle Cloudプロバイダを登録した後、「プロパティ」でクラウドの詳細を変更できます。「Oracle Cloud」ノードを右クリックし、「プロパティ」を選択して、「プロパティ」を開きます。
-[start=5]
+
. Oracle Cloudプロバイダがクラウド・リソースのリストに表示されていることを確認します。「終了」をクリックします。
Oracle Cloudは、「サービス」ウィンドウの「クラウド」ノードにリストされています。「Oracle Cloud」ノードを右クリックして、サービスのリストをリフレッシュする、ジョブおよびログのリストを開く、クラウド・インスタンスを削除する、またはクラウドのプロパティを表示するコマンドを提供するコンテキスト・メニューを開くことができます。
@@ -176,12 +176,12 @@
image::images/project-contextmenu.png[]
-[start=2]
+
. 「プロジェクト・プロパティ」で、「実行」カテゴリを選択します。
image::images/run-properties.png[]
-[start=3]
+
. 「サーバー」ドロップダウン・リストから、目的のサーバー(Oracle Cloud RemoteまたはローカルOracle WebLogic)を選択します。サーバーをIDEに登録する必要があります。「サービス」ウィンドウの「サーバー」ノードを右クリックしてサーバーを追加できます。
@@ -212,7 +212,7 @@
NetBeans IDEにHRスキーマを登録する際には、HRユーザー名とパスワードを使用します。
-[start=2]
+
. Java EE5おびよびWebLogicサーバーのオンプレミス・インストールを使用してJava Webアプリケーションを作成します。アプリケーションに対してJSFフレームワークを有効にします。
image::images/crudapp-eevers.png[]
@@ -220,37 +220,37 @@
image::images/crudapp-jsf.png[]
-[start=3]
+
. 「プロジェクト」ウィンドウで、プロジェクトのルート・ノードを右クリックし、「新規」→「データベースからのエンティティ・クラス」を選択します。「データベースからのエンティティ・クラス」ウィザードが開きます。
-[start=4]
+
. 「データベースからのエンティティ・クラス」ウィザードで、「データ・ソース」ドロップダウン・ボックスから「新しいデータ・ソース」を選択します。「データ・ソースを作成」ダイアログが開きます。
image::images/crudapp-newdatasource.png[]
-[start=5]
+
. このデータソースに、登録したOracle Cloudアカウントのデータベース・サービス名と一致する名前を付けます。
image::images/cloud-db-name.png[]
-[start=6]
+
. 手順1で作成したOracleXE HRデータベース接続を選択します。「OK」をクリックします。「データ・ソースを作成」ダイアログが閉じます。
image::images/create-datasource.png[]
-[start=7]
+
. 「データベースからのエンティティ・クラス」ウィザードで、「使用可能な表」フィールドにHRスキーマ表名が入力されます。EMPLOYEESなど、表の1つを選択し、「追加」をクリックします。ウィザードの残りの部分をクリックして、エンティティ・クラスを含むパッケージに任意の名前を付け、他のフィールドはすべてデフォルト値を受け入れます。
-[start=8]
+
. 「プロジェクト」ウィンドウで、プロジェクトのルート・ノードを右クリックし、「新規」→「エンティティからのJSFページ・クラス」を選択します。「新規エンティティからのJSFページ・クラス」ウィザードが開きます。
-[start=9]
+
. 「エンティティ・クラス」パネルで、「すべて選択」をクリックし、「次」をクリックします。
-[start=10]
+
. 「生成されたJSFページとクラス」パネルで、パッケージとJSFファイル・フォルダに適切な名前を付け、「終了」をクリックします。
-[start=11]
+
. 「プロジェクト」ウィンドウでプロジェクトのルート・ノードを右クリックし、「実行」を選択します。IDEは、プロジェクトをビルドし、それをオンプレミスWebLogicサーバーにデプロイします。プロジェクトのランディング・ページにブラウザが開きます。
これで、CRUDおよびJSFを使用したJava Webアプリケーションのローカル・バージョンが作成されます。アプリケーションをローカルにテストおよび調整できます。アプリケーションが最終状態になったら、Oracle Cloudにデプロイします。
@@ -262,21 +262,21 @@
image::images/crudapp-properties.png[]
-[start=3]
+
. 「プロジェクト」ウィンドウで、プロジェクトの「構成ファイル」ノードを展開し、「`persistence.xml`」をダブルクリックします。ファイルがXMLエディタの「デザイン」ビューに開きます。
-[start=4]
+
. 「表生成戦略」で、「作成」を選択します。
image::images/crudapp-persistence.png[]
-[start=5]
+
. オンプレミスWebLogicサーバーでJPA 2.0が有効になっている場合は、持続性プロバイダを、JPA 2.0を使用するデフォルトのEclipseLinkから、OpenJPAなどのJPA 1.0プロバイダに変更する必要があります。
*注意: *オンプレミスWebLogicサーバーがJPA 2.0対応でない場合、EclipseLinkはJPA 1.0にフォールバックします。この場合は、持続性プロバイダを変更する必要がありません。
-[start=6]
+
. 「プロジェクト」ウィンドウでプロジェクトのルート・ノードを右クリックし、「実行」を選択します。IDEは、プロジェクトをビルドし、それをOracle Cloud Remoteサーバーにデプロイします。IDEの「出力」ウィンドウの「Oracle Cloud Remoteデプロイメント」タブで、デプロイメントの進捗状況をフォローできます。
*注意: *Oracle Cloudは、データベース表のアップロードをまだサポートしていません。したがって、これがOracle Cloud上にある場合は、アプリケーションで使用可能なデータはありません。
@@ -294,35 +294,35 @@
image::images/new-servlet.png[]
-[start=2]
+
. サーブレットに任意の名前を付け、そのサーブレットの既存のパッケージを選択し、「終了」をクリックします。サーブレット・クラスがエディタに開きます。
-[start=3]
+
. サーブレットの ``processRequest`` メソッドを探し、メソッド本文に「 ``System.ex`` 」と入力し、[Ctrl]-[Space]を押してコード補完を開きます。 ``System.exit`` はOracle Cloudホワイトリストで禁止されているため、コード補完は ``System.exit`` を補完する可能性のある提案を行いません。IDEは、取消し線が引かれた ``exit`` を表示します。
image::images/cc-failure.png[]
-[start=4]
+
. ``System.exit(1);`` の入力を終了します。警告が表示されます。カーソルを警告アイコンにスクロールすると、 ``java.lang.System.exit`` が許可されていないことを通知するツールチップが表示されます。
image::images/whitelist-warning.png[]
-[start=5]
+
. 「プロジェクト」ウィンドウでアプリケーションのノードを右クリックし、「検査」を選択します。「出力」ウィンドウを開きます(「ウィンドウ」→「出力」→「出力」または[Ctrl]-[4])。「出力」ウィンドウには、ホワイトリストの制限によるエラーを示す「ホワイト・リスト」タブがあります。
image::images/whitelist-output.png[]
-[start=6]
+
. 「アクション項目」ウィンドウを開きます(「ウィンドウ」→「アクション項目」または[Ctrl]-[6])。ホワイトリスト違反がアクション項目の独立したグループとして表示されます。
*ヒント:* 「アクション項目をカテゴリでグループ化」(左側の下部のボタン)をオンにすると、ホワイトリスト違反をより簡単に表示できます。
image::images/whitelist-tasks.png[]
-[start=7]
+
. プロジェクトのデプロイを試行します。ホワイトリスト違反が検出されたことを通知し、デプロイメントを続行するかどうかを確認する警告ダイアログが表示されます。「いいえ」をクリックします。ダイアログが消えます。
-[start=8]
+
.
「プロジェクト」ウィンドウでアプリケーションのノードを右クリックし、「プロパティ」を選択します。アプリケーションの「プロジェクト・プロパティ」が開きます。「ホワイト・リスト」カテゴリを選択します。アクティブなホワイトリストのリストが表示されます。このダイアログで、ホワイトリストを無効にできます。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_pt_BR.asciidoc
index e8819d5..6f9d8c7 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_pt_BR.asciidoc
@@ -109,12 +109,12 @@
image::images/add-cloud.png[]
-[start=3]
+
. No campo Escolher Nuvem, selecione Oracle Cloud e clique em Próximo para abrir o painel Oracle Cloud.
image::images/oracle-cloud1.png[]
-[start=4]
+
. Preencha todos os campos. Procure a pasta contendo o Oracle Java Cloud Service SDK JAR. Clique em Próximo.
Quando você clica em Próximo, o IDE testa a conexão com a nuvem. Uma lista de serviços de Nuvem é exibida caso a conexão seja bem-sucedida. Só o servidor Oracle Cloud Remote (Oracle WebLogic) está disponível no momento.
@@ -122,7 +122,7 @@
*Observação:* depois de registrar um provedor Oracle Cloud, você pode alterar os detalhes da Nuvem nas respectivas Propriedades. Abra a caixa de diálogo Propriedades clicando com o botão direito do mouse em Oracle Cloud e selecionando Propriedades.
-[start=5]
+
. Confirme se o provedor Oracle Cloud é exibido na lista de recursos de Nuvem. Clique em Finalizar.
O Oracle Cloud agora está listado no nó Nuvem da janela Serviços. Você pode clicar com o botão direito do mouse no nó Oracle Cloud para abrir um menu de contexto que oferece comandos para atualizar a lista de serviços, abrindo uma lista de jobs e logs, removendo a instância da nuvem ou exibindo as propriedades da nuvem.
@@ -176,12 +176,12 @@
image::images/project-contextmenu.png[]
-[start=2]
+
. Nas Propriedades do Projeto, selecione a categoria Executar.
image::images/run-properties.png[]
-[start=3]
+
. Na lista drop-down Servidor, selecione o servidor que você deseja (o Oracle Cloud Remote ou Oracle WebLogic local). O servidor deve estar registrado no IDE. É possível adicionar um servidor clicando com o botão direito do mouse na janela Serviços.
@@ -212,7 +212,7 @@
Use o nome de usuário e a senha de RH quando você se registrar no esquema RH com o NetBeans IDE.
-[start=2]
+
. Crie uma Aplicação Web Java usando o Java EE5 e sua instalação do servidor WebLogic local. Ative o framework JSF para a aplicação.
image::images/crudapp-eevers.png[]
@@ -220,37 +220,37 @@
image::images/crudapp-jsf.png[]
-[start=3]
+
. Na janela Projetos, clique com o botão direito do mouse no nó de root do projeto e selecione Novo > Classes de Entidade do Banco de Dados. As Classes de Entidade do assistente do Banco de Dados são abertas.
-[start=4]
+
. Em Classes de Entidade do assistente do Banco de Dados, selecione Nova Fonte de Dados na caixa drop-down Fonte de Dados. A caixa de diálogo Criar Fonte de Dados é aberta.
image::images/crudapp-newdatasource.png[]
-[start=5]
+
. Nomeie essa origem de dados para corresponder ao nome do serviço de banco de dados na sua conta Oracle Cloud registrada..
image::images/cloud-db-name.png[]
-[start=6]
+
. Selecione a conexão do banco de dados do OracleXE HR criada na Etapa 1. Clique em OK. A caixa de diálogo Criar Fonte de Dados é fechada.
image::images/create-datasource.png[]
-[start=7]
+
. Em Classes da Entidade do assistente de Banco de Dados, o campo Tabelas Disponíveis é preenchido com os nomes de tabela do esquema de RH. Selecione uma ou mais tabelas, como EMPLOYEES, e clique em Adicionar. Clique no restante do assistente, dando um nome arbitrário ao pacote contendo as classes da entidade e aceitando todos os valores default em outros campos.
-[start=8]
+
. Na janela Projetos, clique com o botão direito do mouse no nó de root do projeto e selecione Novo > Páginas JSF das Classes de Entidade. O Assistente de Novas Páginas JSF de Classes de Entidade é aberto.
-[start=9]
+
. No painel Classes de Entidade, clique em Selecionar Tudo e clique em Próximo.
-[start=10]
+
. No painel Gerar Páginas e Classes JSF, dê os nomes apropriados aos pacotes e à pasta de arquivos JSF e clique em Finalizar.
-[start=11]
+
. Na janela Projetos, clique com o botão direito do mouse no nó root do projeto e selecione Executar. O IDE cria o projeto e o implanta no local, no servidor WebLogic. Um browser é aberto na página inicial do projeto.
Agora, você tem uma versão local de uma aplicação Web Java usando CRUD e JSF. É possível testar e ajustar a aplicação localmente. Quando a aplicação estiver em estado final, implante-a no Oracle Cloud.
@@ -262,21 +262,21 @@
image::images/crudapp-properties.png[]
-[start=3]
+
. Na janela Projetos, expanda o nó Arquivos de Configuração do projeto e clique duas vezes em ` persistence.xml`. O arquivo é aberto na view Design do Editor XML.
-[start=4]
+
. Em Estratégia de Geração de Tabela, selecione Criar
image::images/crudapp-persistence.png[]
-[start=5]
+
. Se seu servidor WebLogic local tiver o JPA 2.0 ativado, você deverá alterar o provedor de persistência do EclipseLink default, que usa JPA 2.0, para um provedor JPA 1.0, como OpenJPA.
*Observação: *Se o seu servidor WebLogic local não estiver ativado para JPA 2.0, o EclipseLink fará o fallback para o JPA 1.0. Nesse caso, não é necessário para alterar provedores de persistência.
-[start=6]
+
. Na janela Projetos, clique com o botão direito do mouse no nó root do projeto e selecione Executar. O IDE compila o projeto e o implanta no servidor Oracle Cloud Remote. Você pode seguir o andamento da implantação na janela de Saída do IDE, na guia Implantação do Oracle Cloud Remote.
*Cuidado: *O Oracle Cloud ainda não suporta o upload de tabelas no banco de dados. Portanto, nenhum dado está disponível para sua aplicação quando ela estiver no Oracle Cloud.
@@ -294,35 +294,35 @@
image::images/new-servlet.png[]
-[start=2]
+
. Dê um nome arbitrário ao servlet, selecione um pacote existente para ele e clique em Concluir. A classe do servlet será aberta no editor.
-[start=3]
+
. Localize o método ``processRequest`` , digite ``System.ex`` no corpo do método e pressione Ctrl+Space para abrir o recurso autocompletar código. O recurso autocompletar código não oferece a possibilidade de completar o ``System.exit`` , pois o ``System.exit`` não está permitido na lista de permissões do Oracle Cloud. O IDE mostra ``exit`` com uma linha.
image::images/cc-failure.png[]
-[start=4]
+
. Finalize digitando ``System.exit(1);`` . Uma advertência será exibida. Role o cursor pelo ícone de advertência e uma dica de ferramenta será exibida, informando que o ``java.lang.System.exit`` não é permitido
image::images/whitelist-warning.png[]
-[start=5]
+
. Na janela Projetos, clique com o botão direito do mouse no nó da aplicação e selecione Verificar. Abra a janela de Saída (Janela > Saída > Saída ou Ctrl-4). A janela de Saída inclui uma guia Lista de Permissões que mostra erros devido a restrições da lista de restrições.
image::images/whitelist-output.png[]
-[start=6]
+
. Abra a janela Itens de Ação (Janela > Itens de Ação ou Ctrl-6). As violações de lista de permissão aparecem como um grupo separado de itens de ação.
*Dica:* Ative os Itens de Ação de Grupo por Categoria (botão inferior à esquerda) para ver as violações de lista de permissão mais facilmente.
image::images/whitelist-tasks.png[]
-[start=7]
+
. Tente implantar o projeto. Uma caixa de diálogo de advertência é exibida, informando que foram detectadas violações da lista de permissões e perguntando se você quer continuar com a implantação. Clique em Não. A caixa de diálogo desaparecerá.
-[start=8]
+
.
Na janela Projetos, clique com o botão direito do mouse no nó da aplicação e selecione Propriedades. As Propriedades do Projeto da aplicação serão abertas. Selecione a categoria das Listas de Permissão. Uma lista ativa de listas de permissão é exibida. Nessa caixa de diálogo, é possível desativar a lista de permissões.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ru.asciidoc
index 837dc47..28be1fb 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_ru.asciidoc
@@ -109,12 +109,12 @@
image::images/add-cloud.png[]
-[start=3]
+
. В поле 'Выбрать облако' выберите Oracle Cloud и нажмите кнопку 'Далее', чтобы открыть панель Oracle Cloud.
image::images/oracle-cloud1.png[]
-[start=4]
+
. Заполните все поля. Перейдите к папке, содержащей файл JAR для Oracle Java Cloud Service SDK. Нажмите кнопку 'Далее'.
После нажатия кнопки 'Далее' IDE проверяет подключение к облаку. Если соединение прошло успешно, отображается перечень облачных служб. В настоящее время доступен только удаленный сервер Oracle Cloud (Oracle WebLogic).
@@ -122,7 +122,7 @@
*Примечание.* После регистрации поставщика Oracle Cloud можно изменить данные облака в его свойствах. Откройте окно 'Свойства', щелкнув правой кнопкой мыши узел Oracle Cloud и выберите 'Свойства'.
-[start=5]
+
. Убедитесь, что поставщик Oracle Cloud отображается в списке ресурсов облачных служб. Нажмите кнопку 'Готово'.
Сейчас Oracle Cloud указан в узле 'Облако' в окне 'Службы'. Можно щелкнуть правой кнопкой мыши узел Oracle Cloud, чтобы открыть контекстное меню, которое содержит команды для обновления списка служб, открыв список заданий и журналов и удалив экземпляр облака или просмотрев свойства облака.
@@ -176,12 +176,12 @@
image::images/project-contextmenu.png[]
-[start=2]
+
. В окне 'Свойства проекта' выберите категорию 'Выполнить'.
image::images/run-properties.png[]
-[start=3]
+
. В раскрывающемся списке 'Сервер' выберите нужный сервер (удаленный сервер Oracle Cloud или локальный Oracle WebLogic). Сервер должен быть зарегистрирован в IDE. Можно добавить сервер, щелкнув правой кнопкой узел 'Серверы' в окне 'Службы'.
@@ -212,7 +212,7 @@
Используйте имя пользователя и пароль HR при регистрации схемы HR в IDE NetBeans.
-[start=2]
+
. Создайте веб-приложение Java с использованием Java EE5 и локальной установки сервера WebLogic. Включите поддержку платформы JSF для приложений.
image::images/crudapp-eevers.png[]
@@ -220,37 +220,37 @@
image::images/crudapp-jsf.png[]
-[start=3]
+
. В окне 'Проекты' щелкните правой кнопкой мыши корневой узел проекта и выберите 'Создать' > 'Классы логических объектов из баз данных'. Откроется мастер создания логических объектов на основе баз данных.
-[start=4]
+
. В мастере создания логических объектов на основе баз данных выберите 'Новый источник данных' из раскрывающегося списка 'Источники данных'. Откроется диалоговое окно 'Создать источник данных'.
image::images/crudapp-newdatasource.png[]
-[start=5]
+
. Имя этого источника данных должно совпадать с именем службы базы данных в используемой зарегистрированной учетной записи Oracle Cloud.
image::images/cloud-db-name.png[]
-[start=6]
+
. Выберите подключение к базе данных OracleXE HR, созданное на шаге 1. Нажмите кнопку 'ОК'. Диалоговое окно 'Создать источники данных' закрывается.
image::images/create-datasource.png[]
-[start=7]
+
. В мастере создания логических объектов на основе баз данных поле 'Доступные таблицы' заполняется именами таблиц схем HR. Выберите одну из таблиц, например EMPLOYEES, и нажмите 'Добавить'. Щелкните в остальных частях мастера, задав произвольное имя для пакета, содержащего классы логических объектов, и приняв все значения по умолчанию в других полях.
-[start=8]
+
. В окне 'Проекты' щелкните правой кнопкой мыши корневой узел проекта и выберите 'Создать' > 'Страницы JSF' из классов логических объектов. Откроется мастер создания страниц JSF из классов логических объектов
-[start=9]
+
. На панели 'Классы логических объектов' нажмите 'Выделить все' и нажмите кнопку 'Далее'.
-[start=10]
+
. На панели 'Создание страниц и классов JSF' задайте соответствующие имена для пакетов и папки файла JSF и нажмите кнопку 'Готово'.
-[start=11]
+
. В окне 'Проекты' щелкните правой кнопкой мыши корневой узел проекта и выберите пункт 'Выполнить'. IDE создает проект и развертывает его на локальном сервере WebLogic. Браузер открывается на целевой странице проекта.
Теперь у вас есть локальная версия веб-приложения Java, использующая CRUD и JSF. Можно проверить и настроить приложение локально. Когда приложение находится в конечном состоянии, разверните его в Oracle Cloud.
@@ -262,21 +262,21 @@
image::images/crudapp-properties.png[]
-[start=3]
+
. В окне 'Проекты' разверните узел проекта 'Файлы конфигурации' и дважды щелкните ` persistence.xml`. Файл откроется в режиме конструктора редактора XML.
-[start=4]
+
. В разделе 'Стратегия поколений таблицы' выберите пункт 'Создать'.
image::images/crudapp-persistence.png[]
-[start=5]
+
. Если на локальном сервере WebLogic включена поддержка JPA 2.0 , необходимо изменить поставщика сохранения c заданного по умолчанию EclipseLink, который использует JPA 2.0, на поставщика, который использует JPA 1.0, такого как OpenJPA.
*Примечание. *Если на локальном сервере WebLogic не включена поддержка JPA 2.0, выполняется откат EclipseLink к JPA 1.0. В этом случае не нужно менять поставщиков сохранения.
-[start=6]
+
. В окне 'Проекты' щелкните правой кнопкой мыши корневой узел проекта и выберите пункт 'Выполнить'. В IDE создается проект и он развертывается на удаленном сервере Oracle Cloud. Можно отслеживать ход выполнения развертывания в окне 'Выходные данные' в IDE на вкладке 'Удаленное развертывание в Oracle Cloud'.
*Предостережение. *Oracle Cloud в настоящее время не поддерживает загрузку таблиц баз данных. Поэтому данные недоступны для используемых приложений при их нахождении в Oracle Cloud.
@@ -294,35 +294,35 @@
image::images/new-servlet.png[]
-[start=2]
+
. Задайте для сервлета произвольное имя, выберите существующий пакет для него и нажмите кнопку 'Готово'. Класс сервлета открывается в редакторе.
-[start=3]
+
. Найдите метод сервлета ``processRequest`` , введите ``System.ex`` в теле метода и нажмите сочетание клавиш Ctrl-Space, чтобы открыть функцию автозавершения кода. Функция автозавершения кода не обеспечивает возможности завершения ``System.exit`` , потому что ``System.exit`` запрещен в белом списке Oracle Cloud. В IDE отображается ``exit`` с линией, проходящей через него.
image::images/cc-failure.png[]
-[start=4]
+
. Завершите ввод ``System.exit(1);`` . Отобразится предупреждение. Наведите курсор на значок предупреждения, и появится подсказка о том, что ``java.lang.System.exit`` запрещен.
image::images/whitelist-warning.png[]
-[start=5]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел приложения и выберите 'Проверить'. Откройте окно 'Выходные данные' ('Окно' > 'Выходные данные' > 'Выходные данные' или сочетание клавиш Ctrl-4). Окно 'Выходные данные' включает в себя вкладку 'Белый список', в которой отображаются ошибки, связанные с ограничениями белого списка.
image::images/whitelist-output.png[]
-[start=6]
+
. Откройте окно 'Элементы действий' ('Окно' > 'Элементы действий' или сочетание клавиш Ctrl-6). Нарушения соответствия стандартам белого списка отображаются как отдельная группа элементов действий.
*Совет.* Включите 'Элементы действий группы' по категориям (нижняя кнопка слева), чтобы сразу увидеть нарушения стандартов белого списка.
image::images/whitelist-tasks.png[]
-[start=7]
+
. Попробуйте выполнить развертывание проекта. Отображается диалоговое окно предупреждения, сообщающее о том, что были выявлены нарушения стандартов белого списка, и отобразится запрос на подтверждение продолжения развертывания. Нажмите кнопку 'Нет'. Диалоговое окно исчезнет.
-[start=8]
+
.
В окне 'Проекты' щелкните правой кнопкой мыши узел приложения и выберите 'Свойства'. Откроется окно 'Свойства проекта' приложения. Выберите категорию 'Белые списки'. Отобразится список активных белых списков. В этом диалоговом окне можно отключить белый список.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_zh_CN.asciidoc
index 2f78a70..a52e44c 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/oracle-cloud_zh_CN.asciidoc
@@ -109,12 +109,12 @@
image::images/add-cloud.png[]
-[start=3]
+
. 在 "Choose Cloud"(选择云)字段中,选择 "Oracle Cloud" 并单击 "Next"(下一步)以打开 "Oracle Cloud" 面板。
image::images/oracle-cloud1.png[]
-[start=4]
+
. 填写所有字段。浏览包含 Oracle Java Cloud Service SDK JAR 的文件夹。单击 "Next"(下一步)。
单击 "Next"(下一步)后,IDE 会测试到云的连接。如果连接成功,则会显示云服务列表。当前只有 Oracle Cloud Remote 服务器 (Oracle WebLogic) 可用。
@@ -122,7 +122,7 @@
*注:*在注册 Oracle Cloud 提供器之后,您可以在其 "Properties"(属性)中更改云详细信息。右键单击 "Oracle Cloud" 节点并选择 "Properties"(属性)以便打开 "Properties"(属性)。
-[start=5]
+
. 确认 Oracle Cloud 提供器已在云资源列表中显示。单击 "Finish"(完成)。
现在,Oracle Cloud 将在 "Services"(服务)窗口中的 "Cloud"(云)节点下方列出。您可以右键单击 "Oracle Cloud" 节点打开上下文菜单,该菜单提供了用于刷新服务列表、打开作业和日志列表、删除云实例或查看云属性的命令。
@@ -176,12 +176,12 @@
image::images/project-contextmenu.png[]
-[start=2]
+
. 在 "Project Properties"(项目属性)中,选择 "Run"(运行)类别。
image::images/run-properties.png[]
-[start=3]
+
. 从 "Server"(服务器)下拉列表中,选择所需服务器("Oracle Cloud Remote" 或 "local Oracle WebLogic"(本地 Oracle WebLogic))。该服务器必须已在 IDE 中注册。您可以通过在 "Services"(服务)窗口右键单击 "Servers"(服务器)节点来添加服务器。
@@ -212,7 +212,7 @@
将 HR 方案注册到 NetBeans IDE 时,请使用 HR 用户名和口令。
-[start=2]
+
. 使用 Java EE5 和 WebLogic Server 本地安装创建 Java Web 应用程序。为该应用程序启用 JSF 框架。
image::images/crudapp-eevers.png[]
@@ -220,37 +220,37 @@
image::images/crudapp-jsf.png[]
-[start=3]
+
. 在 "Projects"(项目)窗口中,右键单击项目的根节点,并选择 "New"(新建)> "Entity Classes from Database"(通过数据库生成实体类)。此时将打开 "Entity Classes from Database"(通过数据库生成实体类)向导。
-[start=4]
+
. 在 "Entity Classes from Database"(通过数据库生成实体类)向导中,从 "Data Source"(数据源)下拉框中选择 "New Data Source"(新建数据源)。此时将打开 "Create Data Source"(创建数据源)对话框。
image::images/crudapp-newdatasource.png[]
-[start=5]
+
. 为此数据源命名,使其与已注册的 Oracle Cloud 帐户中的数据库服务名称匹配。
image::images/cloud-db-name.png[]
-[start=6]
+
. 选择您在步骤 1 中创建的 OracleXE HR 数据库连接。单击 "OK"(确定)。此时将关闭 "Create Data Source"(创建数据源)对话框。
image::images/create-datasource.png[]
-[start=7]
+
. 在 "Entity Classes from Database"(通过数据库生成实体类)向导中,"Available Tables"(可用表)字段已使用 HR 方案表名填充。选择某个表(例如,EMPLOYEES),然后单击 "Add"(添加)。点进向导的其余部分,为包含实体类的包指定一个任意名称,并在其他字段中接受所有默认值。
-[start=8]
+
. 在 "Projects"(项目)窗口中,右键单击项目的根节点,然后选择 "New"(新建)> "JSF Pages from Entity Classes"(通过实体类创建 JSF 页)。此时将打开 "New JSF Pages from Entity Classes"(通过实体类新建 JSF 页)向导。
-[start=9]
+
. 在 "Entity Classes"(实体类)面板中,单击 "Select All"(全选)和 "Next"(下一步)。
-[start=10]
+
. 在 "Generate JSF Pages and Classes"(生成 JSF 页和类)面板中,为包和 JSF 文件所在的文件夹指定适当的名称并单击 "Finish"(完成)。
-[start=11]
+
. 在 "Projects"(项目)窗口中,右键单击项目的根节点,然后选择 "Run"(运行)。IDE 会构建项目并将其部署到本地 WebLogic Server。该项目的登录页上会打开一个浏览器。
现在,您已使用 CRUD 和 JSF 创建 Java Web 应用程序的本地版本。您可以本地测试和调整该应用程序。当应用程序处于最终状态时,请将其部署到 Oracle Cloud。
@@ -262,21 +262,21 @@
image::images/crudapp-properties.png[]
-[start=3]
+
. 在 "Projects"(项目)窗口中,展开项目的 "Configuration Files"(配置文件)节点,然后双击 `persistence.xml`。该文件将在 XML 编辑器的设计视图中打开。
-[start=4]
+
. 在 "Table Generation Strategy"(表生成策略)下选择 "Create"(创建)。
image::images/crudapp-persistence.png[]
-[start=5]
+
. 如果您的本地 WebLogic Server 已启用 JPA 2.0,则必须将持久性提供器从默认的 "EclipseLink"(使用 JPA 2.0)更改为 JPA 1.0 提供器(例如,OpenJPA)。
*注:*如果您的本地 WebLogic Server 未启用 JPA 2.0,EclipseLink 会退回到使用 JPA 1.0。此种情况下,您不必更改持久性提供器。
-[start=6]
+
. 在 "Projects"(项目)窗口中,右键单击项目的根节点,然后选择 "Run"(运行)。IDE 会构建项目并将其部署到 Oracle Cloud Remote 服务器。您可以在 IDE "Output"(输出)窗口中的 "Oracle Cloud Remote Deployment"(Oracle Cloud Remote 部署)标签内跟进部署进度。
*注意:*Oracle Cloud 尚不支持上载数据库表。因此,当应用程序位于 Oracle Cloud 中时,没有任何数据可用于该应用程序。
@@ -294,35 +294,35 @@
image::images/new-servlet.png[]
-[start=2]
+
. 为 servlet 指定任意名称,并为其选择一个现有包,然后单击 "Finish"(完成)。servlet 类随即在编辑器中打开。
-[start=3]
+
. 找到 servlet 的 ``processRequest`` 方法,在方法主体中键入 ``System.ex`` ,并按 Ctrl-空格键打开代码完成。代码完成不会向您提供完成 ``System.exit`` 的可能性,因为 Oracle Cloud 白名单已禁止 ``System.exit`` 。IDE 显示带有删除线的 ``exit`` 。
image::images/cc-failure.png[]
-[start=4]
+
. 完成键入 ``System.exit(1);`` 。此时将出现一条警告。在警告图标上滚动光标,此时会出现一条工具提示,通知您不允许使用 ``java.lang.System.exit`` 。
image::images/whitelist-warning.png[]
-[start=5]
+
. 在 "Projects"(项目)窗口中,右键单击应用程序的节点,然后选择 "Verify"(验证)。打开 "Output"(输出)窗口("Window"(窗口)> "Output"(输出) > "Output"(输出)或 Ctrl-4 组合键)。"Output"(输出)窗口包含一个 "Whitelist"(白名单)标签,该标签显示因白名单限制而导致的错误。
image::images/whitelist-output.png[]
-[start=6]
+
. 打开 "Action Items"(操作项)窗口("Window"(窗口)> "Action Items"(操作项)或 Ctrl-6 组合键)。白名单违规作为单独的一组操作项显示。
*提示:*打开 "Group Action Items by Category"(按类别对操作项进行分组)(左下方的按钮)可以更方便地查看白名单违规。
image::images/whitelist-tasks.png[]
-[start=7]
+
. 尝试部署项目。此时会显示一个警告对话框,通知您已检测到白名单违规,并询问您是否要继续部署。单击 "No"(否)。此对话框随即消失。
-[start=8]
+
.
在 "Projects"(项目)窗口中,右键单击该应用程序的节点,然后选择 "Properties"(属性)。此时将打开该应用程序的 "Project Properties"(项目属性)。选择 "Whitelists"(白名单)类别。此时会显示一个活动白名单列表。在此对话框中,您可以禁用白名单。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring.asciidoc
index 8ef102e..9e15c95 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring.asciidoc
@@ -83,10 +83,10 @@
The Java EE version depends upon the version of the server that is selected. The default Java EE version is Java EE 7 Web when the selected server is GlassFish Server 4.0.
-[start=5]
+
. In Step 4, the Frameworks panel, select Spring Web MVC.
-[start=6]
+
. Select *Spring Framework 3.x* in the Spring Library drop-down list.
image::images/frameworks-window.png[title="Spring Web MVC displayed in the Frameworks panel"]
@@ -94,15 +94,15 @@
Note that the IDE enables you to add the Spring 4.x library to your project, but for this tutorial you will use SimpleFormController that is not supported in Spring 4.x. Also, when you select Spring Web MVC, note that the JSTL (JavaServer Pages Standard Tag Library) library is added to the classpath during project creation by default. Deselect this option (as in the above screenshot), since you do not require JSTL for this tutorial.
-[start=7]
+
. Click the Configuration tab and note that the wizard enables you to specify the name and mapping of the Spring Dispatcher servlet.
image::images/spring-configuration.png[title="Specify the name and mapping of the Spring Dispatcher servlet under the Configuration tab"]
-[start=8]
+
. Click Finish. The IDE creates a project for the entire application, including all metadata, as well as the project's Ant build script which you can inspect from the Files window (Ctrl-2; ⌘-2 on Mac). You can view the template structure from the Projects window (Ctrl-1; ⌘-1 on Mac). Also note that four files open by default in the IDE's editor: `dispatcher-servlet.xml`, `applicationContext.xml`, `redirect.jsp`, and `index.jsp`.
-[start=9]
+
. In the Projects window, expand the new project's Libraries node and note that the Spring JARs are included in the project's classpath.
image::images/spring-libraries.png[title="Spring JARs are listed under the project's Libraries node"]
@@ -239,20 +239,20 @@
[tips]#NetBeans IDE provides templates for various Spring artifacts, including the Spring XML Configuration File, the link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/AbstractController.html[+`AbstractController`+], and the link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html[+`SimpleFormController`+].#
-[start=2]
+
. Click Next.
-[start=3]
+
. Name the class *HelloController* and create a new package for it by typing *controller* in the Package text field. Click Finish. The IDE creates the new class and opens it in the editor.
-[start=4]
+
. Specify controller properties by uncommenting the setter methods that display by default in the class template. To uncomment the code snippet, highlight the code as in the image below, then press Ctrl-/ (⌘-/ on Mac).
image::images/comment-out.png[title="Highlight code snippets, then press Ctrl-/ to toggle comments"]
[tips]#Pressing Ctrl-/ (⌘-/ on Mac) toggles comments in the editor.#
-[start=5]
+
. Make changes as follows (shown in *bold*).
[source,java]
@@ -275,16 +275,16 @@
You now need to create the `Name` class as a simple bean to hold information for each request.
-[start=6]
+
. In the Projects window, right-click on the project node and choose New > Java Class. The New Java Class wizard displays.
-[start=7]
+
. Enter *Name* for the Class Name, and for Package select *controller* from the drop-down list.
-[start=8]
+
. Click Finish. The `Name` class is created and opens in the editor.
-[start=9]
+
. For the `Name` class, create a field named `value`, then create accessor methods (i.e., getter and setter methods) for this field. Start by declaring the `value` field:
[source,java]
@@ -304,7 +304,7 @@
image::images/generate-code.png[title="The Generate Code popup menu enables you to set accessor methods"]
-[start=10]
+
. In the dialog that displays, select the `value : String` option, then click OK. The `getValue()` and `setValue()` methods are added to the `Name` class:
[source,java]
@@ -319,10 +319,10 @@
}
----
-[start=11]
+
. Press Ctrl-Tab and choose `HelloController` to switch back to the `HelloController` class. Note that the previous error badge has disappeared since the `Name` class now exists.
-[start=12]
+
. Delete the `doSubmitAction()` method and uncomment the link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html#setFormView(java.lang.String)[+`onSubmit()`+] method. The `onSubmit()` method enables you to create your own `ModelAndView`, which is what is required here. Make the following changes:
[source,java]
@@ -343,7 +343,7 @@
----
As indicated above, the `command` is recast as a `Name` object. An instance of `ModelAndView` is created, and the success view is obtained using a getter in `SimpleFormController`. Finally, the model is populated with data. The only item in our model is the hello message obtained from the `HelloService` created earlier. You use the `addObject()` method to add the hello message to the model under the name `helloMessage`.
-[start=13]
+
. Fix import errors by right-clicking in the editor and choosing Fix Imports (Ctrl-Shift-I; ⌘-Shift-I on Mac).
image::images/fix-imports70.png[title="Press Ctrl-Shift-I to fix imports in your file"]
@@ -351,7 +351,7 @@
*Note.* Confirm that * ``org.springframework.validation.BindException`` * and * ``org.springframework.web.servlet.ModelAndView`` * are selected in the Fix All Imports dialog box.
-[start=14]
+
. Click OK. The following import statement is added to the top of the file:
[source,java]
@@ -363,7 +363,7 @@
Note that at this stage, not all errors are fixed because the class still cannot identify the `HelloService` class, nor make use of its `sayHello()` method.
-[start=15]
+
. Within `HelloController`, declare a private field named `HelloService`:
[source,java]
@@ -389,7 +389,7 @@
----
All errors should now be fixed.
-[start=16]
+
. Register `HelloService` in `applicationContext.xml`. Open `applicationContext.xml` in the editor and enter the following bean declaration:
[source,java]
@@ -401,7 +401,7 @@
image::images/code-completion.png[title="Code completion invoked when pressing Ctrl-Space"]
-[start=17]
+
. Register `HelloController` in `dispatcher-servlet.xml`. Open `dispatcher-servlet.xml` in the editor and enter the following bean declaration:
[source,java]
@@ -433,10 +433,10 @@
----
-[start=4]
+
. Create another JSP page in the same manner <<create-jsp,as above>>, but name it `nameView`.
-[start=5]
+
. In the editor, add the following Spring tag library declaration to `nameView.jsp`.
[source,java]
@@ -446,10 +446,10 @@
----
This imports the link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html[+Spring tag library+], which contains tags useful when implementing views as JSP pages.
-[start=6]
+
. Change the contents of the `<title>` and `<h1>` tags to read: `Enter Your Name`.
-[start=7]
+
. Enter the following code beneath the `<h1>` tags:
[source,xml]
@@ -470,7 +470,7 @@
link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html#spring.tld.nestedPath[+spring:nestedPath+] enables you to prepend a specified path to a bean. So, when used with `spring:bind` as shown above, the path to the bean becomes: `name.value`. As you recall, the command name of `HelloController` is `name`. Therefore, this path refers to the `value` property of a bean named `name` in the page scope.
-[start=8]
+
. Change the relative entry point for the application. Currently, the project entry point is still `index.htm` which, as described in <<running,Running the Skeleton Project>> above, redirects to `WEB-INF/jsp/index.jsp`. You can specify an entry point for the project when it is deployed and run. In the Projects window, right-click the project node and choose Properties. The Project Properties dialog displays. Under Categories select Run. In the Relative URL field, type in `/hello.htm`, then click OK.
At this moment you may wonder where the mapping of `hello.htm` to `HelloController` is located. You have not added a mapping to the `urlMapping` bean, as is the case for `index.htm`, the skeleton project's welcome page. This is possible with a bit of Spring magic provided by the following bean definition in `dispatcher-servlet.xml`:
@@ -482,7 +482,7 @@
----
This bean is responsible for automatically creating an URL mapping for all controllers registered in the file. It takes the fully-qualified class name of the controller (in our case, `controller.HelloController`) and strips the package name and `Controller` suffix, then uses the result as a URL mapping. Therefore, for `HelloController` it creates a `hello.htm` mapping. This magic however does not work for controllers that are included in the Spring Framework, such as `ParameterizableViewController`. They require an explicit mapping.
-[start=9]
+
. In the Projects window right-click the project node and choose Run. This compiles, deploys and runs the project. Your default browser opens, displaying `hello.htm` as the project's `nameView`:
image::images/name-view.png[title="nameView is displayed in a browser"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ja.asciidoc
index 2062375..20bbccf 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ja.asciidoc
@@ -83,10 +83,10 @@
Java EEのバージョンは、選択したサーバーのバージョンによって異なります。選択したサーバーがGlassFish Server 4.0の場合、デフォルトJava EEバージョンはJava EE 7 Webです。
-[start=5]
+
. ステップ4の「フレームワーク」パネルで、「Spring Web MVC」を選択します。
-[start=6]
+
. 「Springライブラリ」ドロップダウン・リストで*「Spring Framework 3.x」*を選択します。
image::images/frameworks-window.png[title="「フレームワーク」パネルに表示された「Spring Web MVC」"]
@@ -94,15 +94,15 @@
IDEではSpring 4.xライブラリをプロジェクトに追加できますが、このチュートリアルではSpring 4.xでサポートされていないSimpleFormControllerを使用します。また、Spring Web MVCを選択すると、デフォルトでプロジェクト作成時にJSTL (JavaServer Pages Standard Tag Library)ライブラリがクラスパスに追加されます。このチュートリアルではJSTLは必要ないため、このオプションの選択を解除します(上のスクリーンショットを参照)。
-[start=7]
+
. 「構成」タブをクリックすると、このウィザードでSpring Dispatcherサーブレットの名前とマッピングを指定できます。
image::images/spring-configuration.png[title="「構成」タブでのSpring Dispatcherサーブレットの名前とマッピングの指定"]
-[start=8]
+
. 「終了」をクリックします。IDEでアプリケーション全体のプロジェクトが作成されます。このプロジェクトには、すべてのメタデータに加え、「ファイル」ウィンドウ([Ctrl]-[2]、Macの場合は[⌘]-[2])から検査できる、プロジェクトのAntビルド・スクリプトが含まれます。テンプレート構造は「プロジェクト」ウィンドウ([Ctrl]-[1]、Macの場合は[⌘]-[1])から表示できます。また、IDEのエディタで`dispatcher-servlet.xml`、`applicationContext.xml`、`redirect.jsp`および`index.jsp`の4つのファイルがデフォルトで開きます。
-[start=9]
+
. 「プロジェクト」ウィンドウで新規プロジェクトの「ライブラリ」ノードを展開すると、Spring JARがプロジェクトのクラスパスに含まれていることが確認できます。
image::images/spring-libraries.png[title="プロジェクトの「ライブラリ」ノードに一覧表示されているSpring JAR"]
@@ -239,20 +239,20 @@
[tips]#NetBeans IDEには、「Spring XML構成ファイル」、「link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/AbstractController.html[+`抽象コントローラ`+]」、「link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html[+`単純フォーム・コントローラ`+]」など、様々なSpringアーティファクト用のテンプレートが用意されています。#
-[start=2]
+
. 「次」をクリックします。
-[start=3]
+
. クラスに「*HelloController*」という名前を付け、「パッケージ」テキスト・フィールドに「*controller*」と入力してクラスの新規パッケージを作成します。「終了」をクリックします。IDEによって新しいクラスが生成され、エディタで開きます。
-[start=4]
+
. クラス・テンプレートのデフォルトで表示する取得メソッドのコメントを解除し、コントローラ・プロパティを指定します。コード・スニペットのコメントを解除するには、次のイメージに示すようにコードを強調表示して、[Ctrl]-[/] (Macの場合は[⌘]-[/])を押します。
image::images/comment-out.png[title="コード・スニペットを強調表示した後の[Ctrl]-[/]の押下によるコメントの切替え"]
[tips]#[Ctrl]-[/] (Macの場合は[⌘]-[/])を押して、エディタ内のコメントを切り替えます。#
-[start=5]
+
. 次のように変更を加えます(*太字*で表示)。
[source,java]
@@ -275,16 +275,16 @@
ここで、各リクエストの情報を保持するための単純なBeanとして、`Name`クラスを作成する必要があります。
-[start=6]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「新規」>「Javaクラス」を選択します。新規Javaクラス・ウィザードが表示されます。
-[start=7]
+
. 「クラス名」に「*Name*」と入力し、「パッケージ」のドロップダウン・リストから「*controller*」を選択します。
-[start=8]
+
. 「終了」をクリックします。`Name`クラスが作成され、エディタで開きます。
-[start=9]
+
. `Name`クラスに対し、`value`という名前のフィールドを作成し、このフィールドのアクセッサ・メソッド(取得メソッドと設定メソッド)を作成します。まず、`value`フィールドを宣言します。
[source,java]
@@ -304,7 +304,7 @@
image::images/generate-code.png[title="「コードを生成」ポップアップ・メニューから使用できるアクセッサ・メソッドの設定"]
-[start=10]
+
. 表示されるダイアログで、「`value: String`」オプションを選択し、「OK」をクリックします。`getValue()`および`setValue()`メソッドが`Name`クラスに追加されます。
[source,java]
@@ -319,10 +319,10 @@
}
----
-[start=11]
+
. [Ctrl]-[Tab]を押し、`HelloController`を選択して、`HelloController`クラスに切り替えます。`Name`クラスが存在するようになったため、以前のエラー・バッジは表示されなくなります。
-[start=12]
+
. `doSubmitAction()`メソッドを削除し、link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html#setFormView(java.lang.String)[+`onSubmit()`+]メソッドのコメントを解除します。`onSubmit()`メソッドを使用し、ここで必要な独自の`ModelAndView`を作成できます。次の変更を加えます。
[source,java]
@@ -343,7 +343,7 @@
----
上記に示すとおり、`command`は`Name`オブジェクトにキャストされます。`ModelAndView`のインスタンスが作成され、成功ビューが`SimpleFormController`の取得メソッドを使用して取得されます。最後に、モデルにデータが取り込まれます。このモデル内の唯一の項目は、以前の手順で作成した`HelloService`から取得された挨拶メッセージです。`addObject()`メソッドを使用し、`helloMessage`という名前のモデルに挨拶メッセージを追加します。
-[start=13]
+
. エディタ内を右クリックし、「インポートを修正」([Ctrl]-[Shift]-[I]、Macの場合は[⌘]-[Shift]-[I])を選択してインポート・エラーを修正します。
image::images/fix-imports70.png[title="[Ctrl]-[Shift]-[I]の押下によるファイルのインポートの修正"]
@@ -351,7 +351,7 @@
*注意:*「すべてのインポートを修正」ダイアログ・ボックスで* ``org.springframework.validation.BindException`` *と* ``org.springframework.web.servlet.ModelAndView`` *が選択されていることを確認してください。
-[start=14]
+
. 「OK」をクリックします。次のインポート文がファイルの最初に追加されます。
[source,java]
@@ -363,7 +363,7 @@
この時点では、クラスで`HelloService`クラスを特定することも、`sayHello()`メソッドを使用することもできないため、すべてのエラーが修正されるわけではありません。
-[start=15]
+
. `HelloController`内で`HelloService`という名前のprivateフィールドを宣言します。
[source,java]
@@ -389,7 +389,7 @@
----
今度はすべてのエラーが修正されるはずです。
-[start=16]
+
. `HelloService`を`applicationContext.xml`に登録します。`applicationContext.xml`をエディタで開き、次のBean宣言を入力します。
[source,java]
@@ -401,7 +401,7 @@
image::images/code-completion.png[title="[Ctrl]-[Space]を押して呼び出されたコード補完"]
-[start=17]
+
. `HelloController`を`dispatcher-servlet.xml`に登録します。`dispatcher-servlet.xml`をエディタで開き、次のBean宣言を入力します。
[source,java]
@@ -433,10 +433,10 @@
----
-[start=4]
+
. もう1つのJSPページを<<create-jsp,上記>>と同じ方法で作成し、名前は「`nameView`」とします。
-[start=5]
+
. エディタで、次のSpringタグ・ライブラリ宣言を`nameView.jsp`に追加します。
[source,java]
@@ -446,10 +446,10 @@
----
これにより、link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html[+Springタグ・ライブラリ+]がインポートされます。このライブラリには、ビューをJSPページとして実装する際に役立つタグが格納されます。
-[start=6]
+
. 「`Enter your name`」の入力を読み取るように、`<title>`タグと`<h1>`タグの内容を変更します。
-[start=7]
+
. `<h1>`タグの下に次のコードを入力します。
[source,xml]
@@ -470,7 +470,7 @@
link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html#spring.tld.nestedPath[+spring:nestedPath+]を使用することで、指定したパスをBeanの前に付加できます。そのため、上記のように`spring:bind`と一緒に使用すると、Beanへのパスは`name.value`になります。再コール時、`HelloController`コマンドの名前は`name`になります。そのため、ページ範囲内の`name`という名前のBeanの`value`プロパティがこのパスから参照されます。
-[start=8]
+
. アプリケーションの相対エントリ・ポイントを変更します。現在、プロジェクトのエントリ・ポイントは依然として`index.htm`であり、前述の<<running,スケルトン・プロジェクトの実行>>にあるとおり、このページから`WEB-INF/jsp/index.jsp`にリダイレクトされます。プロジェクトのデプロイおよび実行時のエントリ・ポイントを指定できます。「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「プロパティ」を選択します。「プロジェクト・プロパティ」ダイアログが表示されます。「カテゴリ」で「実行」を選択します。「相対URL」フィールドに「`/hello.htm`」と入力し、「OK」をクリックします。
この時点では、`hello.htm`から`HelloController`へのマッピングがどこにあるか疑問に感じるかもしれません。`urlMapping` Beanへのマッピングは、スケルトン・プロジェクトの開始ページである`index.htm`の場合と同様に、まだ追加していません。この処理は、次のようにBeanを`dispatcher-servlet.xml`に定義することで実現できるSpringの機能を使用すれば可能になります。
@@ -482,7 +482,7 @@
----
このBeanには、このファイルに登録されたすべてのコントローラに対してURLマッピングを自動的に作成する役割があります。コントローラ(ここでは`controller.HelloController`)の完全修飾クラス名が取得され、パッケージ名と`Controller`接尾辞が取り除かれて、その結果がURLマッピングに使用されます。そのため、`HelloController`の場合は`hello.htm`というマッピングが作成されます。しかしこの機能は、`ParameterizableViewController`のようなSpring Frameworkに含まれるコントローラには機能しません。これらには、明示的なマッピングが必要になります。
-[start=9]
+
. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」を選択します。これにより、プロジェクトがコンパイル、デプロイおよび実行されます。デフォルト・ブラウザが開き、`hello.htm`がプロジェクトの`nameView`として表示されます。
image::images/name-view.png[title="ブラウザでのnameViewの表示"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_pt_BR.asciidoc
index aeb2018..e3f67d8 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_pt_BR.asciidoc
@@ -83,10 +83,10 @@
A versão do Java EE depende da versão do servidor que está selecionada. A versão default do Java EE é Java EE 7 Web quando o servidor selecionado for GlassFish Server 4.0
-[start=5]
+
. Na Etapa 4, no painel Frameworks, selecione Spring Web MVC.
-[start=6]
+
. Selecione *Spring Framework 3.x* na lista drop-down Biblioteca de Springs.
image::images/frameworks-window.png[title="Spring Web MVC exibido no painel Frameworks"]
@@ -94,15 +94,15 @@
Observe que o IDE permite adicionar a biblioteca do Spring 4.x ao projeto, mas neste tutorial você usará SimpleFormController, que não é suportado no Spring 4.x. Além disso, quando você selecionar Spring Web MVC, lembre-se de que a biblioteca JSTL (JavaServer Pages Standard Tag Library) é adicionada ao classpath durante a criação do projeto por padrão. Desmarque essa opção (conforme indicado na captura de tela acima), já que o JSTL não é necessário para este tutorial.
-[start=7]
+
. Clique na guia Configuração e observe que o assistente permite especificar o nome e o mapeamento do servlet Spring Dispatcher.
image::images/spring-configuration.png[title="Especifique o nome e o mapeamento do servlet Spring Dispatcher na guia Configuração"]
-[start=8]
+
. Clique em Finalizar. O IDE cria um projeto para a aplicação inteiro, incluindo todos os metadados, assim como o script de construção Ant do projeto que você pode inspecionar na janela Arquivos (Ctrl-2; &#8984-2 no Mac). Você pode exibir a estrutura do modelo na janela Projetos (Ctrl-1; &#8984-1 no Mac). Observe também que quatro arquivos são abertos por default no editor do IDE: `dispatcher-servlet.xml`, `applicationContext.xml`, `redirect.jsp` e `index.jsp`.
-[start=9]
+
. Na janela Projetos, expanda o novo nó Bibliotecas do projeto e observe que JARs do Spring estão incluídos no classpath do projeto.
image::images/spring-libraries.png[title="Os JARs Spring são listados no nó das Bibliotecas do projeto"]
@@ -239,20 +239,20 @@
[tips]#O NetBeans IDE fornece modelos para vários artefatos do Spring, incluindo o Arquivo de Configuração do Spring XML, o link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/AbstractController.html[+`AbstractController`+] e o link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html[+`SimpleFormController`+].#
-[start=2]
+
. Clique em Próximo.
-[start=3]
+
. Chame a classe de *HelloController* e crie um novo pacote para ela, digitando *controller* no campo de texto Pacote. Clique em Finalizar. O IDE cria a nova classe e a abre no editor.
-[start=4]
+
. Especifique as propriedades do controlador, removendo o comentário dos métodos setter exibidos por default no modelo da classe. Para remover os comentários do snippet de código, realce o código como na imagem a seguir e pressione Ctrl-/ (&#8984-/ no Mac).
image::images/comment-out.png[title="Realce os snippets do código e, em seguida, pressione Ctrl-/ para alternar entre os comentários"]
[tips]#Pressionar Ctrl-/ (&#8984-/ no Mac) alterna entre os comentários no editor.#
-[start=5]
+
. Faças as alterações a seguir (alterações em *negrito*).
[source,java]
@@ -275,16 +275,16 @@
Você precisa criar a classe `Name` como um bean simples para manter as informações de cada solicitação.
-[start=6]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Nova > Classe Java. O assistente de Nova Classe Java é exibido.
-[start=7]
+
. Digite *Name* para o Nome da Classe, e, para Pacote, selecione *controller* na lista drop-down.
-[start=8]
+
. Clique em Finalizar. A classe `Name` é criada e aberta no editor.
-[start=9]
+
. Para a classe `Name`, crie um campo denominado `value` e, em seguida, crie os métodos acessadores (por exemplo, os métodos getter e setter) para esse campo. Inicie declarando o campo `value`:
[source,java]
@@ -304,7 +304,7 @@
image::images/generate-code.png[title="O menu pop-up Gerar Código permite definir métodos acessadores"]
-[start=10]
+
. Na caixa de diálogo exibida, selecione a opção `value : String`e clique em OK. Os métodos `getValue()` e `setValue()` são adicionados à classe `Name`:
[source,java]
@@ -319,10 +319,10 @@
}
----
-[start=11]
+
. Pressione Ctrl-Tab e selecione `HelloController` para retornar à classe `HelloController`. Observe que o indicador de erro anterior desapareceu, mas a classe `Name` existe agora.
-[start=12]
+
. Delete o método `doSubmitAction()` e remova os comentários do método link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html#setFormView(java.lang.String)[+`onSubmit()`+]. O método `onSubmit()` permite que você crie seu próprio `ModelAndView`, que é o necessário aqui. Faça as seguintes alterações:
[source,java]
@@ -343,7 +343,7 @@
----
Conforme indicado acima, o `command` é reconvertido como um objeto `Name`. Uma instância de `ModelAndView` é criada, e a view de sucesso é obtida por meio de um getter em `SimpleFormController`. Finalmente, o modelo é preenchido com os dados. O único item em nosso modelo é a mensagem hello obtida do `HelloService` criado anteriormente. Use o método `addObject()` para adicionar a mensagem hello ao modelo sob o nome `helloMessage`.
-[start=13]
+
. Corrija os erros de importação clicando com o botão direito do mouse no editor e selecionando Corrigir importações (Ctrl-Shift-I; ⌘-Shift-I no Mac).
image::images/fix-imports70.png[title="Pressione Ctrl-Shift-I para corrigir as importações no seu arquivo"]
@@ -351,7 +351,7 @@
*Observação.* Certifique-se de que as opções * ``org.springframework.validation.BindException`` * e * ``org.springframework.web.servlet.ModelAndView`` * estejam selecionadas na caixa de diálogo Corrigir Todas as Importações.
-[start=14]
+
. Clique em OK. A instrução de importação a seguir será adicionada ao início do arquivo:
[source,java]
@@ -363,7 +363,7 @@
Observe que nesse estágio, nem todos os erros são corrigidos, pois a classe ainda não pode identificar a classe `HelloService` e não utiliza seu método `sayHello()`.
-[start=15]
+
. No `HelloController`, declare um campo privado chamado `HelloService`:
[source,java]
@@ -389,7 +389,7 @@
----
Todos os erros deverão ser corrigidos agora.
-[start=16]
+
. Registre `HelloService` em `applicationContext.xml`. Abra `applicationContext.xml` no editor e insira a seguinte declaração de bean:
[source,java]
@@ -401,7 +401,7 @@
image::images/code-completion.png[title="Funcionalidade autocompletar código chamada ao pressionar Ctrl-Espaço"]
-[start=17]
+
. Registre `HelloController` em `dispatcher-servlet.xml`. Abra `dispatcher-servlet.xml` no editor e insira a seguinte declaração de bean:
[source,java]
@@ -433,10 +433,10 @@
----
-[start=4]
+
. Crie outra página JSP da mesma maneira <<create-jsp,conforme acima>>, mas nomeie-a como `nameView`.
-[start=5]
+
. No editor, adicione a declaração da biblioteca de tags do Spring a seguir a `nameView.JSP`.
[source,java]
@@ -446,10 +446,10 @@
----
Isso importa a link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html[+biblioteca de tags do Spring+], que contém tags úteis para a implementação de views como páginas JSP.
-[start=6]
+
. Altere o conteúdo das tags `<title>` e `<h1>` para que se leia: `Enter Your Name`.
-[start=7]
+
. Insira o código a seguir abaixo das tags `<h1>`:
[source,xml]
@@ -470,7 +470,7 @@
link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html#spring.tld.nestedPath[+spring:nestedPath+] permite que você anexe um caminho especificado a um bean. Sendo assim, quando usado com `spring:bind` conforme mostrado acima, o caminho para o bean se torna: `name.value`. Como você deve lembrar, o nome do comando de `HelloController` é `name`. Portanto, esse caminho se refere à propriedade `value` de um bean chamado `name` no escopo da página.
-[start=8]
+
. Altere o ponto de entrada relativo da aplicação. Atualmente, o ponto de entrada do projeto ainda é `index.htm` que, conforme descrito em <<running,Executando o Projeto de Esqueleto>> acima, redireciona para `WEB-INF/jsp/index.jsp`. Você pode especificar um ponto de entrada para o projeto quando ele é implantado e executado. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Propriedades. A caixa de diálogo Propriedades do Projeto será exibida. Em Categorias, selecione Executar. No campo URL Relativo, digite `/hello.htm`, em seguida, clique em OK.
Nesse momento, você deve estar pensando onde o mapeamento de `hello.htm` para `HelloController` se encontra. Você não adicionou um mapeamento para o bean `urlMapping`, como é o caso de `index.htm`, a página de boas-vindas do projeto de esqueleto. Isso é possível com um pouco da mágica do Spring fornecida a seguir pela definição do bean em `dispatcher-servlet.xml`:
@@ -482,7 +482,7 @@
----
Esse bean é responsável por criar automaticamente um mapeamento de URL para todos os controladores registrados no arquivo. Ele pega o nome de classe totalmente qualificado do controlador (em nosso caso, `controller.HelloController`) e retira o nome do pacote e o sufixo `Controller`, em seguida, usa o resultado como um mapeamento de URL. Portanto, para `HelloController`, ele cria um mapeamento `hello.htm`. Entretanto, essa mágica não funciona para controladores que estão incluídos no Spring Framework, como o `ParameterizableViewController`. Eles requerem mapeamento explícito.
-[start=9]
+
. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e selecione Executar. Isso compilará, implantará e executará o projeto. Seu browser default abrirá, exibindo `hello.htm` como o `nameView` do projeto:
image::images/name-view.png[title="A nameView é exibida em um browser"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ru.asciidoc
index 18267d7..a779209 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_ru.asciidoc
@@ -83,10 +83,10 @@
Версия Java EE зависит от версии выбранного сервера. Если выбран сервер GlassFish Server 4.0, в качестве версии Java EE по умолчанию указывается Java EE 7 Web.
-[start=5]
+
. На четвертом экране мастера на панели "Frameworks" выберите "Spring Web MVC".
-[start=6]
+
. Выберите *Spring Framework 3.x* в списке "Библиотека Spring".
image::images/frameworks-window.png[title="Spring Web MVC отображается на панели палтформы"]
@@ -94,15 +94,15 @@
Обратите внимание, что IDE позволяет добавить библиотеку Spring 4.x в проект, но в данном учебном курсе используется компонент SimpleFormController, не поддерживаемый на платформе Spring 4.x. Кроме того, если выбран вариант Spring Web MVC, следует помнить, что во время создания проекта в путь к классу по умолчанию добавляется библиотека JSTL (JavaServer Pages Standard Tag Library). Отключите этот параметр (как показано на снимке экрана), поскольку в этом учебном курсе не требуется JSTL.
-[start=7]
+
. Выберите вкладку "Настройка" и обратите внимание, что в мастере можно настроить имя и отображение сервлета обработчика Spring.
image::images/spring-configuration.png[title="Укажите имя и сопоставление сервлета Spring Dispatcher на вкладке 'Конфигурация'"]
-[start=8]
+
. Нажмите кнопку "Завершить". В результате создается проект для всего приложения, в т.ч. все метаданные, а также сценарий сборки проекта Ant, с которым можно ознакомиться в окне "Файлы" (сочетание клавиш CTRL+2; &#8984+2 в Mac OS). Структуру шаблона можно просмотреть в окне "Проекты" (сочетание клавиш CTRL+1; &#8984+1 в Mac OS). Также следует отметить, что по умолчанию в редакторе среды IDE открываются четыре файла: `dispatcher-servlet.xml`, `applicationContext.xml`, `redirect.jsp` и `index.jsp`.
-[start=9]
+
. В окне 'Проекты' разверните узел 'Библиотеки' нового проекта и обратите внимание, что файлы JAR Spring включены в путь к классу проекта.
image::images/spring-libraries.png[title="Файлы JAR Spring указаны в узле 'Библиотеки' проекта"]
@@ -239,20 +239,20 @@
[tips]#IDE NetBeans обеспечивает шаблоны для различных артефактов Spring, включая файл конфигурации Spring XML, link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/AbstractController.html[+`AbstractController`+] и link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html[+`SimpleFormController`+].#
-[start=2]
+
. Нажмите кнопку "Далее".
-[start=3]
+
. Назовите класс *HelloController* и создайте для него новый пакет, для этого введите в поле "Package" текст *controller*. Нажмите кнопку "Завершить". В среде IDE создается и открывается в редакторе новый класс.
-[start=4]
+
. Укажите свойства контроллера, раскомментировав методы установки, отображаемые шаблоном класса по умолчанию. Чтобы раскомментировать фрагмент кода, выделите его, как показано на рисунке, и нажмите сочетание клавиш CTRL+/ (&#8984+/ в Mac OS).
image::images/comment-out.png[title="Выделите фрагменты кода, затем нажмите Ctrl-/ для переключения комментариев"]
[tips]#Нажатие сочетания клавиш CTRL+/ (&#8984+/ в Mac OS) переключает комментарии в редакторе.#
-[start=5]
+
. Внесите следующие изменения (показаны *полужирным шрифтом*).
[source,java]
@@ -275,16 +275,16 @@
Требуется создать класс `Name` в качестве простого компонента, хранящего данные каждого запроса.
-[start=6]
+
. В окне 'Проекты', щелкните правой кнопкой мыши узел проекта и выберите 'Создать' > 'Класс Java'. Отображается мастер создания класса Java.
-[start=7]
+
. Введите имя класса *Name* и выберите в выпадающем списке пакет *controller*.
-[start=8]
+
. Нажмите кнопку "Завершить". Класс `Name` будет создан и открыт в редакторе.
-[start=9]
+
. В классе `Name` создайте поле `value`, затем создайте методы доступа (т.е. методы получения и установки) для этого поля. Сначала объявите поле `value`:
[source,java]
@@ -304,7 +304,7 @@
image::images/generate-code.png[title="Всплывающее меню создания кода позволяет настроить методы доступа"]
-[start=10]
+
. В диалоговом окне выберите параметр `value : String` и нажмите кнопку "ОК". Методы `getValue()` и `setValue()` добавляются к классу `Name`:
[source,java]
@@ -319,10 +319,10 @@
}
----
-[start=11]
+
. Нажмите сочетание клавиш CTRL+TAB и выберите `HelloController`, чтобы переключиться обратно к классу `HelloController`. Обратите внимание, что значок ошибки исчез, поскольку класс `Name` теперь существует.
-[start=12]
+
. Удалите метод `doSubmitAction()` и раскомментируйте метод link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html#setFormView(java.lang.String)[+`onSubmit()`+]. Метод `onSubmit()` позволяет создать собственный `ModelAndView`, что требуется здесь. Внесите следующие изменения:
[source,java]
@@ -343,7 +343,7 @@
----
Как указано выше, `command` приводится к объекту `Name`. Создается экземпляр `ModelAndView` и с помощью метода получения в `SimpleFormController` создается представление. После этого модель заполняется данными. Единственный элемент модели в данном случае — приветственное сообщение, получаемое из ранее созданной службы `HelloService`. Для добавления к модели приветственного сообщения можно использовать метод `addObject()` под именем `helloMessage`.
-[start=13]
+
. Исправьте ошибки импорта, щелкнув правой кнопкой мыши в редакторе и выбрав 'Исправить ошибки' (Ctrl-Shift-I; ⌘-Shift-I в Mac).
image::images/fix-imports70.png[title="Нажмите Ctrl-Shift-I, чтобы исправить выражения импорта в файле"]
@@ -351,7 +351,7 @@
*Примечание.* Убедитесь, что * ``org.springframework.validation.BindException`` * и * ``org.springframework.web.servlet.ModelAndView`` * выбраны в диалоговом окне 'Исправить все выражения импорта'.
-[start=14]
+
. Нажмите кнопку "ОК". В начало файла добавляется следующий оператор импорта:
[source,java]
@@ -363,7 +363,7 @@
Обратите внимание, что на данном этапе исправлены не все ошибки, поскольку класс по-прежнему не может определить класс `HelloService` и использовать его метод `sayHello()`.
-[start=15]
+
. Внутри `HelloController` объявите частное поле `HelloService`:
[source,java]
@@ -389,7 +389,7 @@
----
Все ошибки исправлены.
-[start=16]
+
. Зарегистрируйте `HelloService` в файле `applicationContext.xml`. Откройте в редакторе файл `applicationContext.xml` и введите следующее определение компонента:
[source,java]
@@ -401,7 +401,7 @@
image::images/code-completion.png[title="Автозавершение кода вызывается при нажатии Ctrl-Space"]
-[start=17]
+
. Зарегистрируйте `HelloController` в файле `dispatcher-servlet.xml`. Откройте в редакторе файл `dispatcher-servlet.xml` и введите следующее определение компонента:
[source,java]
@@ -433,10 +433,10 @@
----
-[start=4]
+
. <<create-jsp,Тем же способом>> создайте вторую страницу JSP и назовите ее `nameView`.
-[start=5]
+
. В редакторе добавьте следующее определение библиотеки тегов Spring к `nameView.jsp`.
[source,java]
@@ -446,10 +446,10 @@
----
При этом импортируется link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html[+библиотека тегов Spring+], содержащая полезные теги для реализации представлений как страниц JSP.
-[start=6]
+
. Измените содержимое тегов `<title>` и `<h1>` на `Enter Your Name`.
-[start=7]
+
. После тега `<h1>` введите следующий код:
[source,xml]
@@ -470,7 +470,7 @@
link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html#spring.tld.nestedPath[+spring:nestedPath+] позволяет добавить к компоненту слева определенный путь. Поэтому при использовании вместе с `spring:bind` путь к компоненту становится равным `name.value`. Как уже указывалось, имя команды `HelloController` — `name`. Поэтому этот путь ссылается на свойство `value` компонента `name` в контексте страницы.
-[start=8]
+
. Измените относительную точку входа для приложения. В настоящий момент точка входа по-прежнему `index.htm`, что в соответствии с разделом <<running,Выполнение схемы проекта>> перенаправляется на `WEB-INF/jsp/index.jsp`. Можно указать точку входа для проекта после его развертывания и запуска. В окне 'Проекты', щелкните правой кнопкой мыши узел проекта и выберите 'Свойства'. Открывается диалоговое окно "Свойства проекта". В области "Категории" выберите "Выполнить". В поле "Относительный URL-адрес" введите `/hello.htm` и нажмите кнопку "ОК".
Возникает вопрос: где же располагается отображение `hello.htm` на `HelloController`? Отображение не добавлялось к компоненту `urlMapping`, как в случае страницы приветствия схемы проекта `index.htm`. Такая возможность обеспечивается средствами автоматизации платформы Spring, предоставляемыми следующим определением компонента `dispatcher-servlet.xml`:
@@ -482,7 +482,7 @@
----
Этот компонент отвечает за автоматическое создание отображения URL-адресов для всех зарегистрированных в файле контроллеров. Из полностью определенного имени контроллера (в данном случае `controller.HelloController`) удаляется имя пакета и суффикс `Controller`, и затем результат используется как образец URL-адреса. Таким образом, для `HelloController` создается отображение `hello.htm`. Это средство, однако, не срабатывает для контроллеров, включенных в платформу Spring, например, `ParameterizableViewController`. Для них требуется явное отображение.
-[start=9]
+
. В окне 'Проекты' щелкните правой кнопкой мыши узел проекта и выберите 'Выполнить'. Проект компилируется, развертывается и выполняется. Открывается браузер по умолчанию и отображается `hello.htm` как `nameView` проекта:
image::images/name-view.png[title="nameView отображается в браузере"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_zh_CN.asciidoc
index 480d93a..83e2c92 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-spring_zh_CN.asciidoc
@@ -83,10 +83,10 @@
Java EE 版本取决于所选服务器的版本。当所选服务器为 GlassFish Server 4.0 时,默认 Java EE 版本是 Java EE 7 Web。
-[start=5]
+
. 在步骤 4 "Frameworks"(框架)面板中,选择 "Spring Web MVC"。
-[start=6]
+
. 在 "Spring Library"(Spring 库)下拉列表中选择 *Spring Framework 3.x*。
image::images/frameworks-window.png[title=""Frameworks"(框架)面板中显示的 Spring Web MVC"]
@@ -94,15 +94,15 @@
请注意,尽管使用 IDE 可以将 Spring 4.x 库添加到项目中,但是对于本教程,将使用 Spring 4.x 中不支持的 SimpleFormController。另外,当选择 "Spring Web MVC" 时,注意到在项目创建期间默认将 JSTL (JavaServer Pages Standard Tag Library) 库添加到类路径中。取消选择此选项(如以上屏幕快照中所示),因为本教程中不需要 JSTL。
-[start=7]
+
. 单击 "Configuration"(配置)标签,并请注意,您可以在向导中指定 Spring 分派程序 Servlet 的名称和映射。
image::images/spring-configuration.png[title="在 "Configuration"(配置)标签下指定 Spring 分派程序 Servlet 的名称和映射"]
-[start=8]
+
. 单击 "Finish"(完成)。IDE 将为整个应用程序创建一个项目,包括所有元数据以及可以从 "Files"(文件)窗口(Ctrl-2 组合键;在 Mac 上为 ⌘-2 组合键)中查看的项目的 Ant 构建脚本。可以从 "Projects"(项目)窗口(Ctrl-1 组合键;在 Mac 上为 ⌘-1 组合键)中查看模板结构。另请注意,默认情况下在 IDE 的编辑器中打开四个文件:`dispatcher-servlet.xml`、`applicationContext.xml`、`redirect.jsp` 和 `index.jsp`。
-[start=9]
+
. 在 "Projects"(项目)窗口中,展开新项目的 "Libraries"(库)节点,并请注意 Spring JAR 包含在项目的类路径中。
image::images/spring-libraries.png[title="Spring JAR 在项目的 "Libraries"(库)节点下列出"]
@@ -239,20 +239,20 @@
[tips]#NetBeans IDE 为各种 Spring 工件(包括 Spring XML 配置文件、link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/AbstractController.html[+`AbstractController`+] 和 link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html[+`SimpleFormController`+])提供了模板。#
-[start=2]
+
. 单击 "Next"(下一步)。
-[start=3]
+
. 将该类命名为 *HelloController* 并通过在 "Package"(包)文本字段中键入 *controller* 为其创建一个新的包。单击 "Finish"(完成)。IDE 将创建新类,并在编辑器中打开该类。
-[start=4]
+
. 通过取消注释 setter 方法(默认情况下,在类模板中显示)来指定控制器属性。要取消注释代码片段,请突出显示该代码(如下图所示),然后按 Ctrl-/ 组合键(在 Mac 上按 ⌘-/ 组合键)。
image::images/comment-out.png[title="突出显示代码片段,然后按 Ctrl-/ 以开启/关闭注释"]
[tips]#按 Ctrl-/ 组合键(在 Mac 上按 ⌘-/ 组合键)可在编辑器中开启/关闭注释。#
-[start=5]
+
. 进行以下更改(以*粗体*显示)。
[source,java]
@@ -275,16 +275,16 @@
现在,您需要创建 `Name` 类作为简单 Bean 以包含每个请求的信息。
-[start=6]
+
. 在 "Projects"(项目)窗口中,右键单击项目节点并选择 "New"(新建)> "Java Class"(Java 类)。此时将显示新建 Java 类向导。
-[start=7]
+
. 在 "Class Name"(类名)中输入 *Name*,从 "Package"(包)的下拉列表中选择 *controller*。
-[start=8]
+
. 单击 "Finish"(完成)。`Name` 类随即创建,并在编辑器中打开。
-[start=9]
+
. 对于 `Name` 类,创建一个名为 `value` 的字段,然后为该字段创建存取方法(即,getter 和 setter 方法)。首先声明 `value` 字段:
[source,java]
@@ -304,7 +304,7 @@
image::images/generate-code.png[title="通过 "Generate Code"(生成代码)弹出式菜单可以设置存取方法"]
-[start=10]
+
. 在显示的对话框中,选择 `value : String` 选项,然后单击 "OK"(确定)。`getValue()` 和 `setValue()` 方法会添加到 `Name` 类中:
[source,java]
@@ -319,10 +319,10 @@
}
----
-[start=11]
+
. 按 Ctrl-Tab 组合键并选择 `HelloController` 以切换回 `HelloController` 类。请注意,以前的错误标记已经消失,因为现在存在 `Name` 类。
-[start=12]
+
. 删除 `doSubmitAction()` 方法并取消注释 link:http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/mvc/SimpleFormController.html#setFormView(java.lang.String)[+`onSubmit()`+] 方法。使用 `onSubmit()` 方法,您可以创建自己的 `ModelAndView`,此处需要这样做。进行以下更改:
[source,java]
@@ -343,7 +343,7 @@
----
如上所述,将 `command` 重塑为 `Name` 对象。创建 `ModelAndView` 的一个实例,并且在 `SimpleFormController` 中使用 getter 获取成功视图。最后,用数据填充模型。我们模型中的唯一项就是从以前创建的 `HelloService` 中获取的 hello 消息。使用 `addObject` 方法将此 hello 消息添加到名称 `helloMessage` 下的模型中。
-[start=13]
+
. 在编辑器中单击鼠标右键并选择 "Fix Imports"(修复导入)(Ctrl-Shift-I 组合键;在 Mac 上为 ⌘-Shift-I 组合键)以修复导入错误。
image::images/fix-imports70.png[title="按 Ctrl-Shift-I 修复文件中的导入"]
@@ -351,7 +351,7 @@
*注:*确认在 "Fix All Imports"(修复所有导入)对话框中选择了 * ``org.springframework.validation.BindException`` * 和 * ``org.springframework.web.servlet.ModelAndView`` *。
-[start=14]
+
. 单击 "OK"(确定)。向文件顶部添加以下导入语句:
[source,java]
@@ -363,7 +363,7 @@
请注意,此时并未修复所有错误,因为该类仍然无法识别 `HelloService` 类,也不能使用其 `sayHello()` 方法。
-[start=15]
+
. 在 `HelloController` 中,声明一个名为 `HelloService` 的私有字段:
[source,java]
@@ -389,7 +389,7 @@
----
现在应该修复了所有错误。
-[start=16]
+
. 在 `applicationContext.xml` 中注册 `HelloService`。在编辑器中打开 `applicationContext.xml`,然后输入以下 Bean 声明:
[source,java]
@@ -401,7 +401,7 @@
image::images/code-completion.png[title="按 Ctrl-空格键时调用的代码完成"]
-[start=17]
+
. 在 `dispatcher-servlet.xml` 中注册 `HelloController`。在编辑器中打开 `dispatcher-servlet.xml`,然后输入以下 Bean 声明:
[source,java]
@@ -433,10 +433,10 @@
----
-[start=4]
+
. 采用与<<create-jsp,以上所述>>相同的方式创建另一个 JSP 页,但将其命名为 `nameView`。
-[start=5]
+
. 在编辑器中,将以下 Spring 标记库声明添加到 `nameView.jsp` 中。
[source,java]
@@ -446,10 +446,10 @@
----
这将导入 link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html[+Spring 标记库+],它包含将视图作为 JSP 页实现时有用的标记。
-[start=6]
+
. 将 `<title>` 和 `<h1>` 标记的内容更改为:`Enter Your Name`。
-[start=7]
+
. 在 `<h1>` 标记下面输入以下代码:
[source,xml]
@@ -470,7 +470,7 @@
link:http://static.springframework.org/spring/docs/2.5.x/reference/spring.tld.html#spring.tld.nestedPath[+spring:nestedPath+] 使您能够在 Bean 前面加上指定的路径。因此,当与上面显示的 `spring:bind` 一起使用时,Bean 的路径变为:`name.value`。当再次调用时,`HelloController` 的命令名称为 `name`。因此,该路径引用该页面范围内名为 `name` 的 Bean 的 `value` 属性。
-[start=8]
+
. 更改应用程序的相对入口点。当前,项目入口点仍然为 `index.htm`,如上面的<<running,运行框架项目>>中所述,它重定向到 `WEB-INF/jsp/index.jsp`。当部署和运行项目时,可以指定项目的入口点。在 "Projects"(项目)窗口中,右键单击该项目节点并选择 "Properties"(属性)。此时将显示 "Project Properties"(项目属性)对话框。在 "Categories"(类别)下,选择 "Run"(运行)。在 "Relative URL"(相对 URL)字段中,键入 `/hello.htm`,然后单击 "OK"(确定)。
此时,您可能希望了解 `hello.htm` 到 `HelloController` 的映射所在的位置。您尚未添加到 `urlMapping` Bean 的映射,框架项目的欢迎页 `index.htm` 就是这样。这可能就是 Spring 的特殊魅力所在,它是由 `dispatcher-servlet.xml` 文件中的下列 bean 定义提供的:
@@ -482,7 +482,7 @@
----
此 Bean 负责为文件中注册的所有控制器自动创建 URL 映射。它获取控制器的全限定类名(本例中为 `controller.HelloController`)并且去除读写包名称和 `Controller` 后缀,然后将结果用作 URL 映射。因此,对于 `HelloController` 而言,它创建了一个 `hello.htm` 映射。但是,此特点并不适于 Spring Framework 中包含的控制器,如 `ParameterizableViewController`。它们需要显式映射。
-[start=9]
+
. 在 "Projects"(项目)窗口中,右键单击该项目节点并选择 "Run"(运行)。这将编译、部署和运行该项目。您的默认浏览器会打开,并且将 `hello.htm` 显示为项目的 `nameView`:
image::images/name-view.png[title="nameView 显示在浏览器中"]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts.asciidoc
index d359214..e2fc778 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts.asciidoc
@@ -90,7 +90,7 @@
* *Application Resource*: Lets you specify the resource bundle which will be used in the `struts-config.xml` file for localizing messages. By default, this is `com.myapp.struts.ApplicationResource`.
* *Add Struts TLDs*: Lets you generate tag library descriptors for the Struts tag libraries. A tag library descriptor is an XML document which contains additional information about the entire tag library as well as each individual tag. In general this is not necessary, because you can refer to on-line URIs rather than local TLD files.
-[start=5]
+
. Click Finish. The IDE creates the project folder in your file system. As with any web application in the IDE, the project folder contains all of your sources and the IDE's project metadata, such as the Ant build script. However, your web application in addition has all of the Struts libraries on its classpath. Not only are they on the application's classpath, but they are included in the project and will be packaged with it later when you build the project.
The project opens in the IDE. The Projects window is the main entry point to your project sources. It shows a logical view of important project contents. For example, if you expand several nodes within the new project, it may appear as follows:
@@ -159,7 +159,7 @@
The link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+bean taglib+] provides you with numerous tags that are helpful when associating a form bean (i.e., an `ActionForm` bean) with the data collected from the form. The link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_html.html[+html taglib+] offers an interface between the view and other components necessary to a web application. For example, below you replace common html `form` tags with Struts' `<html:form>` tags. One benefit this provides is that it causes the server to locate or create a bean object that corresponds to the value provided for `html:form`'s `action` element.
-[start=4]
+
. Below the `<h1>` (or `<h2>`) tags, add the following:
[source,xml]
@@ -175,7 +175,7 @@
Whenever you finish typing in the Source Editor, you can tidy up the code by right-clicking and choosing Format (Alt-Shift-F).
-[start=5]
+
. In the Palette (Window > Palette) in the right region of the IDE, drag a Table item from the HTML category to a point just above the `<html:submit value="Login" />` line. The Insert Table dialog box displays. Set the rows to `3`, columns to `2`, and leave all other settings at `0`. Later in the tutorial, you will <<style,attach a stylesheet>> to affect the table display.
image::images/insert-table.png[title="The Palette provides dialogs for easy-to-use code templates"]
@@ -217,7 +217,7 @@
*Note: *You can safely delete the `<thead>` table row, as it is not used in this tutorial.
-[start=6]
+
. In the first table row, enter the following (changes in *bold*):
[source,xml]
@@ -229,7 +229,7 @@
</tr>
----
-[start=7]
+
. In the second table row, enter the following (changes in *bold*):
[source,xml]
@@ -242,7 +242,7 @@
----
The `html:text` element enables you to match the input fields from the form with properties in the form bean that will be created in the next step. So for example, the value of `property` must match a field declared in the form bean associated with this form.
-[start=8]
+
. Move the <html:submit value="Login" /> element into the second column of the third table row, so that the third table row appears as follows (changes in *bold*):
[source,xml]
@@ -304,7 +304,7 @@
</body>
----
-[start=3]
+
. Add a link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+bean taglib+] directive to the top of the file:
[source,java]
@@ -314,7 +314,7 @@
----
-[start=4]
+
. Add the following `<bean:write>` tags (changes in *bold*):
[source,html]
@@ -351,7 +351,7 @@
image::images/navigation-support.png[title="Navigation support is provided in struts-config.xml"]
-[start=3]
+
. In the `LoginForm` bean in the Source Editor, create fields and accompanying accessor methods that correspond to the `name` and `email` text input fields that you created in `login.jsp`. Because `name` has already been created in the `LoginForm` skeleton, you only need to implement `email`.
Add the following declaration beneath `name` (changes in *bold*):
@@ -384,7 +384,7 @@
image::images/new-struts-action.png[title="New Struts Action wizard"]
-[start=5]
+
. In the third step of the wizard, you are given the opportunity to associate the `Action` class with a form bean. Notice that the `LoginForm` bean you previously created is listed as an option for ActionForm Bean Name. Make the following adjustments to the panel:
* Delete the forward slash for the Input Resource field
* Set Scope to Request (Session is the default scope setting in Struts.)
@@ -447,7 +447,7 @@
----
In order to use the incoming form data, you need to take `execute`'s `ActionForm` argument and cast it as `LoginForm`, then apply the getter methods that you created earlier.
-[start=2]
+
. Type in the following conditional clause to perform validation on the incoming data:
[source,java]
@@ -489,7 +489,7 @@
}
----
-[start=3]
+
. Add a declaration for `FAILURE` to the `LoginAction` class (changes in *bold*):
[source,java]
@@ -516,10 +516,10 @@
private String error;
----
-[start=2]
+
. Add a getter method and a setter method for `error`, as <<accessors,demonstrated above>>.
-[start=3]
+
. Modify the setter method so that it appears as follows:
[source,xml]
@@ -532,7 +532,7 @@
----
-[start=4]
+
. Open `login.jsp` and make the following changes:
[source,xml]
@@ -553,7 +553,7 @@
----
-[start=5]
+
. In `LoginAction`, within the `if` conditional clause, add a statement to set the error message before forwarding the `failure` condition (changes in *bold*):
[source,java]
@@ -616,7 +616,7 @@
image::images/add-forward.png[title="Right-click and choose Struts > Add Forward"]
-[start=2]
+
. In the Add Forward dialog box, type `success` in Forward Name. Enter the path to `success.jsp` in the Resource File field (i.e., `/WEB-INF/success.jsp`). The dialog box should now look as follows:
image::images/add-forward-dialog.png[title="Add Forward dialog creates a forward entry in struts-config.xml"]
@@ -632,7 +632,7 @@
----
-[start=3]
+
. Perform the same action to add a forward entry for `failure`. Set the Resource File path to `/login.jsp`. The following `forward` entry is added to `struts-config.xml` (changes in *bold*):
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ja.asciidoc
index 2bb1796..882ba64 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ja.asciidoc
@@ -90,7 +90,7 @@
* *アプリケーション・リソース*: メッセージのローカライズのために`struts-config.xml`ファイルで使用されるリソース・バンドルを指定できます。デフォルトでは、`com.myapp.struts.ApplicationResource`です。
* *Struts TLDを追加*: Strutsタグ・ライブラリ用のタグ・ライブラリ・ディスクリプタを生成できます。タグ・ライブラリ・ディスクリプタは、タグ・ライブラリ全体のみでなく、各個別タグに関する追加情報も格納されるXMLドキュメントです。一般に、ローカルTLDファイルではなく、オンラインのURIを参照できるため、これは必要ありません。
-[start=5]
+
. 「終了」をクリックします。IDEによって、ファイル・システムにプロジェクト・フォルダが作成されます。IDEのWebアプリケーションでは、プロジェクト・フォルダに、すべてのソースとIDEのプロジェクト・メタデータ(Antビルド・スクリプトがなど)が含まれます。ただし、使用するWebアプリケーションには、そのクラスパス上にすべてのStrutsライブラリがさらに含まれます。これらはアプリケーションのクラスパス上に存在するのみでなく、プロジェクトに含まれるため、後でプロジェクトをビルドしたときに一緒にパッケージ化されます。
IDEでプロジェクトが開きます。「プロジェクト」ウィンドウは、プロジェクト・ソースへのメインのエントリ・ポイントです。ここには重要なプロジェクト内容の論理ビューが表示されます。たとえば、新しいプロジェクト内のいくつかのノードを展開すると、次のようになります。
@@ -159,7 +159,7 @@
link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+Bean taglib+]は、フォームから収集されたデータにフォームBean (`ActionForm` Bean)を関連付ける際に役立つ、多数のタグを提供します。link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_html.html[+html taglib+]は、ビューと、Webアプリケーションに必要な他のコンポーネントとの間のインタフェースを提供します。たとえば、次では一般的なhtml`form`タグをStrutsの`<html:form>`タグに置き換えます。この利点の1つは、こうすることで、`html:form`の`action`要素に提供される値に対応するBeanオブジェクトを、サーバーが検索または作成することです。
-[start=4]
+
. `<h1>` (または`<h2>`)タグの下に、次を追加します。
[source,xml]
@@ -175,7 +175,7 @@
ソース・エディタでの入力が終了するたびに、右クリックして「フォーマット」を選択([Alt]-[Shift]-[F])することにより、コードを整えることができます。
-[start=5]
+
. IDEの右側にあるパレット(「ウィンドウ」>「パレット」)で、「表」項目を「HTML」カテゴリから`<html:submit value="Login" />`行の直前の位置にドラッグします。「挿入表」ダイアログ・ボックスが表示されます。行を`3`、列を`2`に設定し、その他の設定はすべて`0`のままにします。このチュートリアルの後の方で、表の表示に影響する<<style,スタイル・シートを添付>>します。
image::images/insert-table.png[title="パレットによって提供される、コード・テンプレート用の簡単に使用できるダイアログ"]
@@ -217,7 +217,7 @@
*注意: *このチュートリアルでは使用されないため、表の`<thead>`行は安全に削除できます。
-[start=6]
+
. 表の最初の行に、次の*太字*で示した部分を入力します。
[source,xml]
@@ -229,7 +229,7 @@
</tr>
----
-[start=7]
+
. 表の2行目に、次の*太字*で示した部分を入力します。
[source,xml]
@@ -242,7 +242,7 @@
----
`html:text`要素によって、フォームからの入力フィールドを、次のステップで作成されるフォームBeanのプロパティと一致させることができます。たとえば、`property`の値は、このフォームに関連付けられたフォームBeanで宣言されているフィールドと一致します。
-[start=8]
+
. 表の3行目の2列目に<html:submit value="Login" /> 要素を移動し、表の3行目が次の*太字*で示した部分になるようにします。
[source,xml]
@@ -304,7 +304,7 @@
</body>
----
-[start=3]
+
. ファイルの先頭にlink:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+Bean taglib+]ディレクティブを追加します。
[source,java]
@@ -314,7 +314,7 @@
----
-[start=4]
+
. 次の*太字*で示した`<bean:write>`タグを追加します。
[source,html]
@@ -351,7 +351,7 @@
image::images/navigation-support.png[title="struts-config.xmlに提供されたナビゲーション・サポート"]
-[start=3]
+
. ソース・エディタの`LoginForm` Beanで、`login.jsp`内に作成した`name`および`email`テキスト入力フィールドに対応するフィールドと付随するアクセッサ・メソッドを作成します。`name`は`LoginForm`スケルトンですでに作成されているため、実装する必要があるのは`email`のみです。
`name`の下に、次の*太字*で示した宣言を追加します。
@@ -384,7 +384,7 @@
image::images/new-struts-action.png[title="新規Strutsアクション・ウィザード"]
-[start=5]
+
. ウィザードの3番目のステップで、`Action`クラスをフォームBeanと関連付けられます。ActionForm Bean名のオプションとして、前に作成した`LoginForm` Beanが表示されています。パネルに対して次の調整を適用します。
* 「入力リソース」フィールドのスラッシュを削除します。
* 「スコープ」を「リクエスト」に設定します(Strutsでは、「セッション」がデフォルトのスコープ設定します。)
@@ -447,7 +447,7 @@
----
受信フォーム・データを使用するには、`execute`の`ActionForm`引数を受け取り、`LoginForm`としてキャストして、前に作成した取得メソッドを適用します。
-[start=2]
+
. 受信データに検証を実行するため、次の条件節を入力します。
[source,java]
@@ -489,7 +489,7 @@
}
----
-[start=3]
+
. `FAILURE`の宣言を`LoginAction`クラスに追加します(変更箇所は*太字*で表示)。
[source,java]
@@ -516,10 +516,10 @@
private String error;
----
-[start=2]
+
. <<accessors,前に示した>>ように、`error`用の取得メソッドと設定メソッドを追加します。
-[start=3]
+
. 設定メソッドを次のように変更します。
[source,xml]
@@ -532,7 +532,7 @@
----
-[start=4]
+
. `login.jsp`を開き、次の変更を行います。
[source,xml]
@@ -553,7 +553,7 @@
----
-[start=5]
+
. `LoginAction`の`if`条件節内に、`failure`条件を転送する前にエラー・メッセージを設定する文を追加します(*太字*部分)。
[source,java]
@@ -616,7 +616,7 @@
image::images/add-forward.png[title="右クリックして「Struts」>「転送の追加」を選択"]
-[start=2]
+
. 「転送を追加」ダイアログ・ボックスで、「転送名」に「`success`」と入力します。「リソース・ファイル」フィールドに`success.jsp`のパス(`/WEB-INF/success.jsp`)を入力します。ダイアログ・ボックスは次のようになるはずです。
image::images/add-forward-dialog.png[title="「転送の追加」ダイアログでのstruts-config.xmlへのforwardエントリの作成"]
@@ -632,7 +632,7 @@
----
-[start=3]
+
. 同じ処理を行い、`failure`のforwardエントリを追加します。「リソース・ファイル」のパスを「`/login.jsp`」に設定します。次の*太字*で示した`forward`エントリが、`struts-config.xml`に追加されます。
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_pt_BR.asciidoc
index 3941c9b..5c95937 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_pt_BR.asciidoc
@@ -90,7 +90,7 @@
* *Recurso da Aplicação*: permite especificar o pacote de recursos que será usado no arquivo `struts-config.xml` para a localização de mensagens. Por default, é `com.myapp.struts.ApplicationResource`.
* *Adicionar TLDs do Struts*: permite gerar descritores de bibliotecas de tags para as bibliotecas de tags do Struts. Um descritor de biblioteca de tags é um documento XML que contém informações adicionais sobre toda a biblioteca de tags, bem como sobre cada tag individual. Em geral, isso não é necessário porque é possível consultar URIs on-line em vez dos arquivos TLD locais.
-[start=5]
+
. Clique em Finalizar. O IDE criará a pasta do projeto no sistema de arquivos. Assim como em qualquer aplicação Web do IDE, a pasta do projeto contém todos os seus códigos-fontes e os metadados do projeto do IDE, como o script de construção do Ant. No entanto, sua aplicação Web tem, além disso, todas as bibliotecas do Struts no seu classpath. Tais bibliotecas não estão somente no classpath da aplicação, mas também estão incluídas no projeto e serão encapsuladas com ele posteriormente quando este for construído.
O projeto será aberto no IDE. A janela Projetos é o ponto de entrada principal para os códigos-fonte do projeto. Ela mostra uma view lógica do conteúdo importante do projeto. Por exemplo, ao expandir diversos nós no novo projeto, ela será exibida da seguinte maneira:
@@ -159,7 +159,7 @@
O link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+bean taglib+] fornecerá inúmeras tags, úteis ao associar um bean de form (isto é, um Bean `ActionForm`) aos dados coletados do form. O link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_html.html[+html taglib+] oferece uma interface entre a view e os outros componentes necessários para a aplicação Web. Abaixo, por exemplo, você substitui as tags html `form` comuns pelas tags `<html:form>` do Struts. Uma vantagem dessa substituição é que ela faz com que o servidor localize ou crie um objeto do Bean que corresponda ao valor fornecido pelo elemento `action` de `html:form`.
-[start=4]
+
. Abaixo das tags `<h1>` (ou `<h2>`), adicione o seguinte:
[source,xml]
@@ -175,7 +175,7 @@
Sempre que terminar de digitar no Editor de Código-Fonte, você pode arrumar o código clicando com o botão direito do mouse e selecionando Formatar (Alt-Shift-F).
-[start=5]
+
. Na Paleta (Janela > Paleta), à direita do IDE, arraste um item Tabela da categoria HTML para um local logo acima da linha `<html:submit value="Log-in" />`. A caixa de diálogo Inserir Tabela será exibida. Defina as linhas como `3`, as colunas como `2` e deixe todas as outras definições como `0`. Mais adiante neste tutorial, você <<style,anexará uma folha de estilo>> para afetar a view da tabela.
image::images/insert-table.png[title="A Paleta fornece caixas de diálogos para facilitar o uso de modelos de código"]
@@ -217,7 +217,7 @@
*Observação: *Você pode deletar com segurança a linha `<thead>` da tabela, pois ela não será utilizada neste tutorial.
-[start=6]
+
. Na primeira linha da tabela, insira o seguinte (alterações em *negrito*):
[source,xml]
@@ -229,7 +229,7 @@
</tr>
----
-[start=7]
+
. Na segunda linha da tabela, digite o seguinte (alterações em *negrito*):
[source,xml]
@@ -242,7 +242,7 @@
----
O elemento `html:text` permite combinar os campos de entrada do form com as propriedades no Bean de form que serão criadas na próxima etapa. Assim, por exemplo, o valor de `property` deve corresponder a um campo declarado no Bean de form associado a este form.
-[start=8]
+
. Mova o elemento <html:submit value="Log-in" /> para a segunda coluna da terceira linha da tabela para que a terceira linha da tabela apareça da seguinte forma (alterações em *negrito*):
[source,xml]
@@ -304,7 +304,7 @@
</body>
----
-[start=3]
+
. Adicione uma diretiva link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+bean taglib+] na parte superior do arquivo:
[source,java]
@@ -314,7 +314,7 @@
----
-[start=4]
+
. Adicione as tags `<bean:write>` a seguir (alterações em *negrito*):
[source,html]
@@ -351,7 +351,7 @@
image::images/navigation-support.png[title="O suporte à navegação é fornecido em struts-config.xml"]
-[start=3]
+
. No Bean `LoginForm` no Editor de Código-Fonte, crie campos e métodos acessadores que correspondam aos campos de entrada de texto `name` e `email` que você criou no arquivo `login.jsp`. Como o `name` já foi criado no esqueleto de `LoginForm`, será necessário implementar somente o `email`.
Adicione a declaração a seguir abaixo de `name` (alterações em *negrito*):
@@ -384,7 +384,7 @@
image::images/new-struts-action.png[title="Assistente de Nova Ação do Struts"]
-[start=5]
+
. Na terceira etapa do assistente, você pode associar a classe `Action` a um Bean de form. Observe que o Bean `LoginForm` criado anteriormente está listado como uma opção de Nome do Bean ActionForm. Faça os seguintes ajustes no painel:
* Delete a barra inclinada do campo Recurso de Entrada
* Defina Escopo para Solicitação (Sessão é a definição de escopo default no Struts.)
@@ -447,7 +447,7 @@
----
Para usar os dados de entrada do form, é necessário tomar o argumento `ActionForm` de `execute` e lançá-lo como `LoginForm`, e ,em seguida, aplicar os métodos getter criados anteriormente.
-[start=2]
+
. Digite o seguinte na cláusula condicional para realizar a validação dos dados de entrada:
[source,java]
@@ -489,7 +489,7 @@
}
----
-[start=3]
+
. Adicione a declaração `FAILURE` na classe `LoginAction` (alterações em *negrito*):
[source,java]
@@ -516,10 +516,10 @@
private String error;
----
-[start=2]
+
. Adicione um método getter e um método setter para `error`, conforme <<accessors,demonstrado acima>>.
-[start=3]
+
. Modifique o método setter para que apareça da seguinte forma:
[source,xml]
@@ -532,7 +532,7 @@
----
-[start=4]
+
. Abra `login.jsp` e faça as seguintes alterações:
[source,xml]
@@ -553,7 +553,7 @@
----
-[start=5]
+
. Em `LoginAction`, na cláusula condicional `if`, adicione uma instrução para definir a mensagem de erro antes de encaminhar a condição de `failure` (alterações em *negrito*):
[source,java]
@@ -616,7 +616,7 @@
image::images/add-forward.png[title="Clique com o botão direito do mouse e selecione Struts > Adicionar Encaminhamento"]
-[start=2]
+
. Na caixa de diálogo Adicionar Encaminhamento, digite `success` no Nome de Encaminhamento. Indique o caminho a `success.jsp` no campo Arquivo de Recurso (isto é, `/WEB-INF/success.jsp`). A caixa de diálogo deverá ter a seguinte aparência:
image::images/add-forward-dialog.png[title="A caixa de diálogo Adicionar Encaminhamento cria uma entrada de encaminhamento no arquivo struts-config.xml"]
@@ -632,7 +632,7 @@
----
-[start=3]
+
. Execute a mesma ação para adicionar uma entrada de encaminhamento a `failure`. Defina o caminho do Arquivo de Recurso como `/login.jsp`. A entrada `forward` a seguir será adicionada a `struts-config.xml` (alterações em *negrito*):
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ru.asciidoc
index 2630480..43ff1c1 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_ru.asciidoc
@@ -90,7 +90,7 @@
* *Ресурс приложения*: Позволяет указать набор ресурсов, который будет использоваться в файле `struts-config.xml` для локализации сообщений. По умолчанию это `com.myapp.struts.ApplicationResource`.
* *Добавить файлы TLD Struts *: Позволяет создавать дескрипторы библиотеки тегов для библиотек тегов Struts. Дескриптор библиотеки тегов -- это документ XML, содержащий дополнительные сведения обо всей библиотеке тегов, а также о каждом отдельном теге. В целом это не является необходимым, поскольку можно сослаться на оперативные идентификаторы URI, а не на локальные файлы TLD.
-[start=5]
+
. Нажмите кнопку "Завершить". Среда IDE создает папку проекта в вашей файловой системе. Как и в случае любого веб-приложения в среде IDE, папка проекта содержит все исходные коды и метаданные проекта среды IDE, например сценарий сборки Ant. Однако у веб-приложения, кроме того, в пути к классам есть все библиотеки Struts. Они не только есть в пути к классам приложения, но они также входят в проект и будут пакетированы с ним позднее при сборке проекта.
Проект откроется в среде IDE. Окно "Проекты" является основной точкой входа исходных файлов проекта. Показано логическое представление важного содержимого проекта. Например, если раскрыть несколько узлов в новом проекте, они могут выглядеть следующим образом:
@@ -159,7 +159,7 @@
Библиотека тегов компонента link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+bean taglib+] содержит различные теги, которые можно использовать при ассоциировании компонента формы (например, компонента `ActionForm`) с данными, получаемыми с формы. link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_html.html[+Библиотека тегов html+] предлагает интерфейс между представлением и другими компонентами, необходимыми в веб-приложении. Например, ниже можно заменить обычные теги HTML `form` тегами Struts `<html:form>`. Благодаря этому, например, сервер ищет или создает объект компонента, соответствующий значению, указанному для элемента `action` в `html:form`.
-[start=4]
+
. Ниже тегов `<h1>` или `<h2>` добавьте следующее:
[source,xml]
@@ -175,7 +175,7 @@
При завершении ввода текста в редакторе исходного кода можно дополнительно упорядочить код, щелкнув правой кнопкой мыши и выбрав 'Формат' (Alt-Shift-F).
-[start=5]
+
. В окне "Палитра" ("Окно" > "Палитра") в правой области среды IDE перетащите элемент "Таблица" из раздела HTML в точку чуть выше строки `<html:submit value="Login" />`. Отобразится диалоговое окно вставки таблицы. Укажите число строк — `3`, столбцов — `2` и оставьте все остальные значения — `0`. Позднее в этом учебном курсе вы сможете добавить <<style,таблицу стилей>> для изменения отображения таблицы.
image::images/insert-table.png[title="На палитре предоставлено диалоговое окно для простых в использовании шаблонов кода"]
@@ -217,7 +217,7 @@
*Примечание. *Строку таблицы `<thead>` можно безопасно удалить, поскольку она не используется в этом учебном курсе.
-[start=6]
+
. В первой строке таблицы введите следующее (изменения указаны *жирным шрифтом*):
[source,xml]
@@ -229,7 +229,7 @@
</tr>
----
-[start=7]
+
. Во второй строке таблицы введите следующее (изменения указаны *жирным шрифтом*):
[source,xml]
@@ -242,7 +242,7 @@
----
Элемент `html:text` позволяет соотносить поля ввода из формы со свойствами в компоненте формы, который будет создан на следующем шаге. Так, например, значение элемента `property` должно соответствовать полю, объявленному в компоненте формы, связанном с этой формой.
-[start=8]
+
. Переместите элемент <html:submit value="Login" /> во второй столбец третьей строки таблицы, чтобы третья строка таблицы выглядела следующим образом (изменения выделены *жирным шрифтом*):
[source,xml]
@@ -304,7 +304,7 @@
</body>
----
-[start=3]
+
. Добавьте директиву link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+bean taglib+] к верхней части файла:
[source,java]
@@ -314,7 +314,7 @@
----
-[start=4]
+
. Добавьте следующие теги `<bean:write>` (изменения выделены *жирным шрифтом*):
[source,html]
@@ -351,7 +351,7 @@
image::images/navigation-support.png[title="Поддержка переходов предоставлена в struts-config.xml"]
-[start=3]
+
. В компоненте `LoginForm` в редакторе исходного кода создайте поля и сопутствующие методы доступа, соответствующие полям текстового ввода `name` и `email`, созданным в файле `login.jsp`. Поскольку поле `name` уже создано в скелете `LoginForm`, нужно реализовать только поле `email`.
Добавьте следующее объявление ниже поля `name` (изменения выделены *жирным шрифтом*):
@@ -384,7 +384,7 @@
image::images/new-struts-action.png[title="Мастер создания действий Struts"]
-[start=5]
+
. В третьем действии этого мастера предоставляется возможность ассоциировать класс `Action` с компонентом формы. Обратите внимание, что ранее созданный компонент `LoginForm` указан как вариант для пункта "Имя компонента ActionForm". Внесите на панель следующие изменения:
* Удалите прямую косую черту из поля "Входной ресурс"
* Укажите область запроса (Сеанс — это область запроса по умолчанию в платформе Struts.)
@@ -447,7 +447,7 @@
----
Чтобы использовать входящие данные формы, необходимо взять аргумент `ActionForm` из `execute`и привести его к `LoginForm`, затем применить методы получения, которые уже созданы ранее.
-[start=2]
+
. Введите следующее условие для выполнения проверки входящих данных:
[source,java]
@@ -489,7 +489,7 @@
}
----
-[start=3]
+
. Добавьте объявление `FAILURE` к классу `LoginAction` (изменения выделены *жирным шрифтом*):
[source,java]
@@ -516,10 +516,10 @@
private String error;
----
-[start=2]
+
. Добавьте методы получения и установки для `error`, как <<accessors,указано выше>>.
-[start=3]
+
. Измените метод установки, чтобы он выглядел следующим образом:
[source,xml]
@@ -532,7 +532,7 @@
----
-[start=4]
+
. Откройте `login.jsp` и внесите следующие изменения:
[source,xml]
@@ -553,7 +553,7 @@
----
-[start=5]
+
. В `LoginAction` в рамках блока `if` добавьте оператор, устанавливающий сообщение об ошибке, перед пересылкой условия `failure` (изменения выделены *жирным шрифтом*):
[source,java]
@@ -616,7 +616,7 @@
image::images/add-forward.png[title="Щелкните правой кнопкой мыши и выберите Struts > 'Добавить Forward'"]
-[start=2]
+
. В диалоговом окне "Добавить Forward" введите `success` в поле "Имя пересылку". Укажите путь к файлу `success.jsp` в поле файла ресурсов (напр., `/WEB-INF/success.jsp`). Диалоговое окно должно теперь выглядеть следующим образом:
image::images/add-forward-dialog.png[title="В диалоговом окне 'Добавить Forward' создается запись Forward в struts-config.xml"]
@@ -632,7 +632,7 @@
----
-[start=3]
+
. Выполните такое же действие, чтобы добавить запись пересылки для `failure`. Укажите в пути к файлу ресурсов `/login.jsp`. Следующая запись `forward` добавляется к файлу `struts-config.xml` (изменения выделены *жирным шрифтом*):
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_zh_CN.asciidoc
index f75da71..1f5500f 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-struts_zh_CN.asciidoc
@@ -90,7 +90,7 @@
* *Application Resource(应用程序资源)*:用于指定将在 `struts-config.xml` 文件中用来本地化消息的资源包。默认情况下,它是 `com.myapp.struts.ApplicationResource`。
* *Add Struts TLDs(添加 Struts TLD)*:用于生成 Struts 标记库的标记库描述符。标记库描述符是一个 XML 文档,其中包括有关整个标记库以及每个单独标记的附加信息。通常,此操作是不必要的,因为您可以参阅联机 URI,而不是本地 TLD 文件。
-[start=5]
+
. 单击 "Finish"(完成)。IDE 将在您的文件系统中创建项目文件夹。与 IDE 中的任何 Web 应用程序一样,此项目文件夹中包含所有的源代码和 IDE 的项目元数据(如 Ant 构建脚本)。但是除此之外,您的 Web 应用程序在其类路径上还具有所有的 Struts 库。这些 Struts 库不仅位于应用程序的类路径上,而且还包含在项目中,并且在稍后构建项目时将与项目打包在一起。
此项目在 IDE 中打开。"Projects"(项目)窗口是项目源的主入口点。它显示重要项目内容的逻辑视图。例如,如果展开新项目中的若干节点,则项目可能显示如下:
@@ -159,7 +159,7 @@
link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+Bean 标记库+]为您提供了大量标记,在将窗体 Bean(即 `ActionForm` Bean)与从窗体中收集的数据关联时,这些标记非常有用。link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_html.html[+html 标记库+]在视图和 Web 应用程序所必需的其他组件之间提供了一个接口。例如,下面您将使用 Struts 的 `<html:form>` 标记替换常用的 html `form` 标记。这样做的一个好处是使服务器查找或创建一个 Bean 对象,该对象对应于为 `html:form` 的 `action` 元素提供的值。
-[start=4]
+
. 在 `<h1>`(或 `<h2>`)标记下,添加以下代码:
[source,xml]
@@ -175,7 +175,7 @@
无论何时在源代码编辑器中完成键入,都可以通过右键单击并选择 "Format"(格式化)(Alt-Shift-F 组合键)来整理代码。
-[start=5]
+
. 在 IDE 右侧区域的组件面板("Window"(窗口)> "Palette"(组件面板))中,将 "Table"(表)项从 "HTML" 类别拖动至 `<html:submit value="Login" />` 行上方的某个位置。将显示 "Insert Table"(插入表格)对话框。将行设置为 `3`,列设置为 `2`,其他所有设置都保留为 `0`。在本教程中,稍后您将<<style,附加样式表>>来影响表的显示。
image::images/insert-table.png[title=""Palette"(组件面板)为易于使用的代码模板提供对话框"]
@@ -217,7 +217,7 @@
*注:*可以安全地删除 `<thead>` 表行,因为它不会在本教程中使用。
-[start=6]
+
. 在第一个表行中,输入以下内容(更改的内容以*粗体*显示):
[source,xml]
@@ -229,7 +229,7 @@
</tr>
----
-[start=7]
+
. 在第二个表行中,输入以下内容(更改的内容以*粗体*显示):
[source,xml]
@@ -242,7 +242,7 @@
----
通过 `html:text` 元素,您可以将此窗体中的输入字段与下一步中将创建的窗体 Bean 中的属性相匹配。例如,`property` 的值必须与此窗体关联的窗体 Bean 中声明的字段相匹配。
-[start=8]
+
. 将 <html:submit value="Login" /> 元素移动到第三个表行的第二列,以便第三个表行如下所示(更改的内容以*粗体*显示):
[source,xml]
@@ -304,7 +304,7 @@
</body>
----
-[start=3]
+
. 将 link:http://struts.apache.org/release/1.3.x/struts-taglib/dev_bean.html[+Bean 标记库+]指令添加到文件顶部:
[source,java]
@@ -314,7 +314,7 @@
----
-[start=4]
+
. 添加以下 `<bean:write>` 标记(更改的内容以*粗体*显示):
[source,html]
@@ -351,7 +351,7 @@
image::images/navigation-support.png[title="在 struts-config.xml 中提供导航支持"]
-[start=3]
+
. 在源代码编辑器中的 `LoginForm` Bean 中,创建字段以及随附的存取方法,这些方法与 `login.jsp` 中创建的 `name` 和 `email` 文本输入字段相对应。由于已在 `LoginForm` 框架中创建 `name`,因此只需要实现 `email`。
将以下声明添加到 `name` 下(更改的内容以*粗体*显示):
@@ -384,7 +384,7 @@
image::images/new-struts-action.png[title="新建 Struts 操作向导"]
-[start=5]
+
. 在此向导的第三步中,可以选择将 `Action` 类与窗体 Bean 相关联。请注意,以前创建的 `LoginForm` Bean 作为“ActionForm Bean 名称”的一个选项列出。对面板进行以下调整:
* 删除 "Input Resource"(输入资源)字段的正斜杠
* 将 "Scope"(范围)设置为 "Request"(请求)(在 Struts 中,"Session"(会话)是默认范围设置。)
@@ -447,7 +447,7 @@
----
为了使用传入的窗体数据,需要使用 `execute` 的 `ActionForm` 参数,并将其强制转换为 `LoginForm`,然后应用先前创建的 getter 方法。
-[start=2]
+
. 键入以下条件子句以对传入数据执行验证:
[source,java]
@@ -489,7 +489,7 @@
}
----
-[start=3]
+
. 将 `FAILURE` 的声明添加到 `LoginAction` 类中(更改以*粗体*显示):
[source,java]
@@ -516,10 +516,10 @@
private String error;
----
-[start=2]
+
. 为 `error` 添加 getter 方法和 setter 方法,<<accessors,如上所述>>。
-[start=3]
+
. 修改 setter 方法使它如下所示:
[source,xml]
@@ -532,7 +532,7 @@
----
-[start=4]
+
. 打开 `login.jsp` 并进行以下更改:
[source,xml]
@@ -553,7 +553,7 @@
----
-[start=5]
+
. 在 `LoginAction` 中,在 `if` 条件子句中添加一条语句,以便在转发 `failure` 条件之前设置错误消息(更改的内容以*粗体*显示):
[source,java]
@@ -616,7 +616,7 @@
image::images/add-forward.png[title="右键单击并选择 "Struts" > "Add Forward"(添加转发)"]
-[start=2]
+
. 在 "Add Forward"(添加转发)对话框的 "Forward Name"(转发名称)中,键入 `success`。在 "Resource File"(资源文件)字段中输入 `success.jsp` 的路径(即 `/WEB-INF/success.jsp`)。此对话框现在应如下所示:
image::images/add-forward-dialog.png[title=""Add Forward"(添加转发)对话框在 struts-config.xml 中创建一个转发条目"]
@@ -632,7 +632,7 @@
----
-[start=3]
+
. 执行相同的操作以添加 `failure` 的转发条目。将 "Resource File"(资源文件)路径设置为 `/login.jsp`。以下 `forward` 条目将添加到 `struts-config.xml`(更改的内容以*粗体*显示):
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket.asciidoc
index f16c33a..9e6703f 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket.asciidoc
@@ -105,7 +105,7 @@
* *Main Package.* The Java package in which all the generated artifacts will be put by the IDE.
* *Version.* The Wicket version. Any library in the Library Manager with a name starting with "Wicket" will be listed in the Version drop-down above. By default, the only version listed is 1.6.0 because that is the version provided by the plugin.
-[start=5]
+
. Click Finish.
The IDE creates the ``MyFirstWicketApp `` project. The project contains all of your sources and project metadata, such as the project's Ant build script. The project opens in the IDE. You can view its logical structure in the Projects window (Ctrl-1):
@@ -124,7 +124,7 @@
Click Next.
-[start=2]
+
. In the Name and Location panel, type ``MyFirstWicketApp`` in Project Name. Change the Project Location and the default Maven settings as required by your needs.
image::images/maven-3.png[]
@@ -132,7 +132,7 @@
Click Next.
-[start=3]
+
. Choose the appropriate server for your needs, as well as "Java EE 6 Web" for the Java EE Version setting.
image::images/maven-4.png[]
@@ -142,13 +142,13 @@
image::images/maven-5.png[]
-[start=4]
+
. Because we have added support for Java EE 6, no ``web.xml`` file is created in the previous step. However, Wicket requires the Wicket application filter to be registered in the ``web.xml`` file. Therefore, before continuining, we add a new ``web.xml`` file in the application.
Right-click the application, choose New > Other, followed by Web > Standard Deployment Descriptor (web.xml). Click Next and then click Finish.
-[start=5]
+
. Now we are ready to add Wicket support to the application. Right-click the project node and choose Properties. In the Project Properties dialog, select Frameworks, and click Wicket. Use the descriptions in the previous sections to fill out the details in the Wicket Configuration part of the dialog. Click OK.
The IDE creates all the Wicket files needed to get started:
@@ -167,7 +167,7 @@
Click Next.
-[start=2]
+
. In the Search field, type "wicket" and then select the archetype you would like to use.
image::images/maven-8.png[]
@@ -200,10 +200,10 @@
image::images/maven-9.png[]
-[start=2]
+
. In the dialog shown above, click New Library and create a new library with a name beginning with "Wicket". Add JARs to the library, that is, register the JARs of your preferred version of Wicket into the library you have created.
-[start=3]
+
.
When next you create a new web application, or when you add Wicket support to an existing application, the Frameworks panel will display your newly registered library, if its name begins with the word "Wicket":
@@ -445,7 +445,7 @@
* *Footer Panel.* The structure of the footer panel is the same as the header panel, described above.
-[start=2]
+
.
Right-click the project and run it. The IDE compiles the application, creates a WAR file, sends it to the deployment server, opens the IDE's default browser, and displays the application:
@@ -475,7 +475,7 @@
image::images/widget-2.png[]
-[start=2]
+
. After adding a line below the H1 element in the HTML file, drag the Label item from the Palette and drop it below the H1 element. You see the dialog below:
image::images/widget-3.png[]
@@ -534,7 +534,7 @@
}
----
-[start=3]
+
.
Save the files. Refresh the browser and you will see the Wicket Label, rendered in the ``HomePage.html`` file:
@@ -562,7 +562,7 @@
Choose Wicket Panel and click Next.
-[start=2]
+
. Type ``BannerPanel`` in File Name. You should now see the following:
image::images/panel-2.png[]
@@ -572,7 +572,7 @@
Notice that we now have two new files in our package, ``BannerPanel.html`` and ``BannerPanel.java`` .
-[start=3]
+
. Open ``BannerPanel.html`` and notice that the content of the file is as follows:
@@ -634,7 +634,7 @@
}
----
-[start=4]
+
. Our panel, while simple, is actually complete already. Lets add it to the home page. Open ``HomePage.java`` and then create a new instance of BannerPanel, by adding the following line to the end of the Constructor:
@@ -644,7 +644,7 @@
add(new BannerPanel("bannerPanel"));
----
-[start=5]
+
. Next, we need to render the panel. Open ``HomePage.html`` and add the placeholder tag right above the closing BODY tag, making sure to use the same Wicket identifier as used in the Java file:
@@ -654,7 +654,7 @@
<span wicket:id='bannerPanel'/>
----
-[start=6]
+
.
Run the project again. Notice that the panel is displayed, exactly where the HTML file specified it should be rendered:
@@ -701,7 +701,7 @@
</html>
----
-[start=2]
+
. On the matching Java side, notice that the following has been added automatically:
@@ -731,7 +731,7 @@
};
----
-[start=3]
+
. Press Ctrl-Shift-I and then make sure to select the correct import statements:
image::images/imports-1.png[]
@@ -754,7 +754,7 @@
import org.apache.wicket.util.string.Strings;
----
-[start=4]
+
.
Refresh the browser again and you will have an AJAX autocomplete field. As you type, the field will be filled with countries matching the entered text.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ja.asciidoc
index 7c942e7..973d34b 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ja.asciidoc
@@ -105,7 +105,7 @@
* *メイン・パッケージ。*生成されたすべてのアーティファクトがIDEによって格納されるJavaパッケージ。
* *バージョン。*Wicketのバージョン。名前が"Wicket"で始まるライブラリ・マネージャ内のライブラリが前述の「バージョン」ドロップダウンにリストされます。プラグインに含まれているバージョンは1.6.0のため、デフォルトでリストされるバージョンは1.6.0のみです。
-[start=5]
+
. 「終了」をクリックします。
IDEによって ``MyFirstWicketApp`` プロジェクトが作成されます。プロジェクトには、すべてのソースおよびプロジェクト・メタデータ(プロジェクトのAntビルド・スクリプトなど)が含まれます。IDEでプロジェクトが開きます。「プロジェクト」ウィンドウ([Ctrl]-[1])で、論理構造を表示できます。
@@ -124,7 +124,7 @@
「次」をクリックします。
-[start=2]
+
. 「名前と場所」パネルで、「プロジェクト名」に「 ``MyFirstWicketApp`` 」と入力します。必要に応じてプロジェクトの場所とデフォルトのMaven設定を変更します。
image::images/maven-3.png[]
@@ -132,7 +132,7 @@
「次」をクリックします。
-[start=3]
+
. ニーズに合う適切なサーバーを選択し、「Java EEバージョン」設定に「Java EE 6 Web」を選択します。
image::images/maven-4.png[]
@@ -142,13 +142,13 @@
image::images/maven-5.png[]
-[start=4]
+
. Java EE 6のサポートを追加したため、前述の手順で ``web.xml`` ファイルは作成されていません。しかし、WicketではWicketアプリケーション・フィルタを ``web.xml`` ファイルに登録する必要があります。したがって、先に進む前に ``web.xml`` ファイルをアプリケーションに追加します。
アプリケーションを右クリックし、「新規」>「その他」を選択し、続けて「Web」>「標準のデプロイメント・ディスクリプタ(web.xml)」を選択します。「次」をクリックし、「終了」をクリックします。
-[start=5]
+
. これで、アプリケーションにWicketサポートを追加する準備ができました。プロジェクト・ノードを右クリックし、「プロパティ」を選択します。「プロジェクト・プロパティ」ダイアログで、「フレームワーク」を選択し、「Wicket」をクリックします。前の項の説明を使用して、ダイアログのWicket構成部分の詳細を指定します。「OK」をクリックします。
IDEによって、必要なWicketファイルがすべて作成されます。
@@ -167,7 +167,7 @@
「次」をクリックします。
-[start=2]
+
. 「検索」フィールドに"wicket"と入力し、使用する原型を選択します。
image::images/maven-8.png[]
@@ -200,10 +200,10 @@
image::images/maven-9.png[]
-[start=2]
+
. 前述のダイアログで「新規ライブラリ」をクリックして、"Wicket"で始まる名前の新しいライブラリを作成します。JARをライブラリに追加します。つまり、希望のバージョンのWicketのJARを、作成したライブラリに登録します。
-[start=3]
+
.
次に新規のWebアプリケーションを作成する際、あるいは既存のアプリケーションにWicketサポートを追加する際、新たに登録したライブラリが("Wicket"で始まる名前であれば)「フレームワーク」パネルに表示されます。
@@ -445,7 +445,7 @@
* *フッター・パネル。*フッター・パネルの構造は、前述のヘッダー・パネルと同じです。
-[start=2]
+
.
プロジェクトを右クリックし、実行します。IDEでアプリケーションがコンパイルされ、WARファイルが作成されてデプロイメント・サーバーに送信されます。IDEのデフォルト・ブラウザが開き、アプリケーションが表示されます。
@@ -475,7 +475,7 @@
image::images/widget-2.png[]
-[start=2]
+
. HTMLファイルのH1要素の下に1行追加した後、パレットから「ラベル」アイテムをドラッグし、H1要素の下にドロップします。次のダイアログが表示されます。
image::images/widget-3.png[]
@@ -534,7 +534,7 @@
}
----
-[start=3]
+
.
ファイルを保存します。ブラウザをリフレッシュすると、 ``HomePage.html`` でレンダリングされるWicket Labelを確認できます。
@@ -562,7 +562,7 @@
「Wicketパネル」を選択し、「次」をクリックします。
-[start=2]
+
. 「ファイル名」に「 ``BannerPanel`` 」と入力します。次のようになります。
image::images/panel-2.png[]
@@ -572,7 +572,7 @@
パッケージに ``BannerPanel.html`` および ``BannerPanel.java`` という2つの新しいファイルがあることに注意してください。
-[start=3]
+
. ``BannerPanel.html`` を開き、ファイルの内容が次のようになっていることを確認します。
@@ -634,7 +634,7 @@
}
----
-[start=4]
+
. 単純ですが、これでパネルは完成です。ホーム・ページに追加しましょう。 ``HomePage.java`` を開き、次の行をコンストラクタの最後に追加して、BannerPanelの新しいインスタンスを作成します。
@@ -644,7 +644,7 @@
add(new BannerPanel("bannerPanel"));
----
-[start=5]
+
. 次に、パネルをレンダリングする必要があります。 ``HomePage.html`` を開き、終了のBODYタグの直前にプレースホルダ・タグを追加します。Javaファイルで使用されているのと同じWicket識別子を必ず使用してください。
@@ -654,7 +654,7 @@
<span wicket:id='bannerPanel'/>
----
-[start=6]
+
.
プロジェクトを再実行します。HTMLファイルで指定された場所にパネルが表示されていることに注意してください。
@@ -701,7 +701,7 @@
</html>
----
-[start=2]
+
. 対応するJava側で、次のコードが自動的に追加されていることに注意してください。
@@ -731,7 +731,7 @@
};
----
-[start=3]
+
. [Ctrl]-[Shift]-[I]を押します。正しいインポート文を必ず選択します。
image::images/imports-1.png[]
@@ -754,7 +754,7 @@
import org.apache.wicket.util.string.Strings;
----
-[start=4]
+
.
ブラウザを再度リフレッシュすると、AJAXのオートコンプリート・フィールドが表示されます。入力すると、このフィールドに、入力したテキストに一致する国が表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_pt_BR.asciidoc
index 2c28c35..0f09ad0 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_pt_BR.asciidoc
@@ -105,7 +105,7 @@
* *Pacote Principal.* O pacote Java no qual todos os artefatos gerados serão colocados pelo IDE.
* *Versão.* A versão do Wicket. Qualquer biblioteca no Gerenciador de Bibliotecas com um nome que começa com "Wicket" será listada na lista drop-down Versão acima. Por default, a única versão listada é 1.6.0 porque é a versão fornecida pelo plug-in.
-[start=5]
+
. Clique em Finalizar.
O IDE cria o projeto ``MyFirstWicketApp`` . O projeto contém todos os códigos-fonte e metadados do projeto, como o script de construção Ant do projeto. O projeto será aberto no IDE. Você pode exibir sua estrutura lógica na janela Projetos (Ctrl-1):
@@ -124,7 +124,7 @@
Clique em Próximo.
-[start=2]
+
. No painel Nome e Localização, digite ``MyFirstWicketApp`` no Nome do Projeto. Altere a Localização do Projeto e as definições default de Maven, conforme necessário.
image::images/maven-3.png[]
@@ -132,7 +132,7 @@
Clique em Próximo.
-[start=3]
+
. Escolha o servidor apropriado para suas necessidades, bem como "Java EE 6 Web" para a definição da Versão do Java EE.
image::images/maven-4.png[]
@@ -142,13 +142,13 @@
image::images/maven-5.png[]
-[start=4]
+
. Como não adicionamos suporte para Java EE 6, nenhum arquivo ``web.xml`` foi criado na etapa anterior. No entanto, o Wicket exige que o filtro da aplicação Wicket seja registrado no arquivo ``web.xml`` . Portanto, antes de continuar, adicionamos um novo arquivo ``web.xml`` na aplicação.
Clique com o botão direito do mouse na aplicação, escolha Novo > Outro, seguido por Web > Descritor de Implantação Padrão (web.xml). Clique em Próximo e, em seguida, em Finalizar.
-[start=5]
+
. Agora você está pronto para adicionar suporte do Wicket à aplicação. Clique com o botão direito do mouse no nó do projeto e escolha Propriedades. Na caixa de diálogo Propriedades do Projeto, selecione Frameworks e clique em Wicket. Use as descrições das seções anteriores para preencher os detalhes na parte de Configuração de Wicket na caixa de diálogo. Clique em OK.
O IDE cria todos os arquivos do Wicket necessários para começar:
@@ -167,7 +167,7 @@
Clique em Próximo.
-[start=2]
+
. No campo Pesquisa, digite "wicket" e, em seguida, selecione o arquétipo que você deseja usar.
image::images/maven-8.png[]
@@ -200,10 +200,10 @@
image::images/maven-9.png[]
-[start=2]
+
. Na caixa de diálogo mostrada acima, clique em Nova Biblioteca e crie uma nova biblioteca com um nome começando com "Wicket". Adicione JARs à biblioteca, isto é, registre os JARs de sua versão preferida do Wicket na biblioteca criada.
-[start=3]
+
.
Na próxima vez que você criar uma nova aplicação web ou quando você adicionar suporte do Wicket a uma aplicação existente, o painel Frameworks exibirá sua biblioteca recém-registrada, se seu nome começar com a palavra "Wicket":
@@ -445,7 +445,7 @@
* *Painel Rodapé.* A estrutura do painel rodapé é igual à do painel cabeçalho, descrita acima.
-[start=2]
+
.
Clique com o botão direito do mouse no projeto e execute-o. O IDE compila a aplicação, cria um arquivo WAR, envia-o para o servidor de implantação, abre o browser default do IDE e exibe a aplicação:
@@ -475,7 +475,7 @@
image::images/widget-2.png[]
-[start=2]
+
. Após adicionar uma linha abaixo do elemento H1 no arquivo HTML, arraste o item Label da Paleta e solte-o abaixo do elemento H1. Você verá a caixa de diálogo abaixo:
image::images/widget-3.png[]
@@ -534,7 +534,7 @@
}
----
-[start=3]
+
.
Salve os arquivos. Altere o browser e você verá o Label do Wicket, convertido no arquivo ``HomePage.html`` :
@@ -562,7 +562,7 @@
Escolha Painel Wicket e clique em Próximo.
-[start=2]
+
. Digite ``BannerPanel`` no Nome do Arquivo. Agora você deverá ver o seguinte:
image::images/panel-2.png[]
@@ -572,7 +572,7 @@
Observe que agora teremos dois arquivos novos em nosso pacote, ``BannerPanel.html`` e ``BannerPanel.java`` .
-[start=3]
+
. Abra ``BannerPanel.html`` e observe que o conteúdo do arquivo é o seguinte:
@@ -634,7 +634,7 @@
}
----
-[start=4]
+
. Nosso painel, embora simples, já está concluído. Vamos adicioná-lo à home page. Abra ``HomePage.java`` e, em seguida, crie uma nova instância de BannerPanel, adicionando a seguinte linha ao fim do Construtor:
@@ -644,7 +644,7 @@
add(new BannerPanel("bannerPanel"));
----
-[start=5]
+
. Em seguida, precisaremos converter o painel. Abra ``HomePage.html`` e adicione a tag do placeholder direito acima da tag BODY de fechamento, certificando-se de usar o mesmo identificador de Wicket usado no arquivo Java:
@@ -654,7 +654,7 @@
<span wicket:id='bannerPanel'/>
----
-[start=6]
+
.
Execute o projeto novamente. Observe que o painel é exibido, exatamente onde o arquivo HTML especificado deve ser convertido:
@@ -701,7 +701,7 @@
</html>
----
-[start=2]
+
. Na parte Java correspondente, observe que o seguinte foi adicionado automaticamente:
@@ -731,7 +731,7 @@
};
----
-[start=3]
+
. Pressione Ctrl-Shift-I e, em seguida, certifique-se de selecionar as instruções de importação corretas:
image::images/imports-1.png[]
@@ -754,7 +754,7 @@
import org.apache.wicket.util.string.Strings;
----
-[start=4]
+
.
Atualize o browser novamente e você terá um campo de preenchimento automático do AJAX. Conforme você digita, o campo será preenchido com países correspondentes ao texto digitado.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ru.asciidoc
index 28f7cea..a8ef036 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_ru.asciidoc
@@ -105,7 +105,7 @@
* *Основной пакет.* Пакет Java, в который среда IDE помещает все созданные артефакты.
* *Версия.* Версия Wicket. В вышеуказанном списке 'Версия' будут отображаться все библиотеки с префиксом 'Wicket', доступные в Диспетчере библиотек. По умолчанию в списке отображается только версия 1.6.0, так как именно эта версия предоставляется подключаемым модулем.
-[start=5]
+
. Нажмите 'Готово'.
Среда IDE создает проект ``MyFirstWicketApp `` . Проект содержит все исходные файлы и метаданные проекта, например сценарий построения Ant. Проект откроется в среде IDE. Логическую структуру можно просмотреть в окне 'Проекты' (Ctrl-1):
@@ -124,7 +124,7 @@
Нажмите 'Далее'.
-[start=2]
+
. На панели 'Имя и расположение' в поле 'Имя проекта' введите ``MyFirstWicketApp`` . Измените значения в поле 'Местоположение проекта' и параметры Maven как требуется.
image::images/maven-3.png[]
@@ -132,7 +132,7 @@
Нажмите 'Далее'.
-[start=3]
+
. Выберите нужный сервер. В качестве версии Java EE укажите 'Java EE 6 Web'.
image::images/maven-4.png[]
@@ -142,13 +142,13 @@
image::images/maven-5.png[]
-[start=4]
+
. Поскольку мы реализовали поддержку Java EE 6, на предыдущем этапе не создается файл ``web.xml`` . Однако Wicket требует, чтобы в файле ``web.xml`` был зарегистрирован фильтр приложения Wicket. Поэтому прежде чем продолжить, необходимо добавить в приложение новый файл ``web.xml`` .
Щелкните приложение правой кнопкой мыши и выберите Создать > Другие, затем выберите Веб > Стандартный дескриптор развертывания (web.xml). Нажмите кнопку "Далее", а затем нажмите кнопку "Готово".
-[start=5]
+
. Теперь можно реализовать поддержку Wicket в приложении. Щелкните правой кнопкой узел проекта и выберите команду "Свойства". В диалоговом окне 'Свойства проекта' выберите 'Платформы' и 'Wicket'. Используя информацию из предыдущих сценариев, заполните поля в разделе 'Конфигурация Wicket' диалогового окна. Нажмите OK.
Среда IDE все файлы Wicket, необходимые для начала работы:
@@ -167,7 +167,7 @@
Нажмите 'Далее'.
-[start=2]
+
. В поле 'Поиск' введите 'wicket', затем выберите архетип, который вы хотите использовать.
image::images/maven-8.png[]
@@ -200,10 +200,10 @@
image::images/maven-9.png[]
-[start=2]
+
. В диалоговом окне, показанном на рисунке, нажмите 'Создать библиотеку' и создайте новую библиотеку, имя которой должно иметь префикс 'Wicket'. Добавьте файлы JAR в созданную библиотеку (другими словами, зарегистрируйте файлы JAR предпочтительной версии Wicket в этой библиотеке).
-[start=3]
+
.
Впоследствии при создании очередного веб-приложения или добавлении поддержки Wicket в существующее приложение на панели 'Платформы' будет отображаться библиотека, которую вы только что зарегистрировали (если имя библиотеки имеет префикс 'Wicket'):
@@ -445,7 +445,7 @@
* *Панель нижнего колонтитула.* Панель нижнего колонтитула имеет такую же структуру, как и панель верхнего колонтитула, которая была описана ранее в этом разделе.
-[start=2]
+
.
Щелкните проект правой кнопкой мыши и запустите его выполнение. Среда IDE выполняет сборку приложения, создает файл WAR, отправляет его на сервер развертывания, открывает стандартный браузер IDE и отображает приложение:
@@ -475,7 +475,7 @@
image::images/widget-2.png[]
-[start=2]
+
. После добавления строки под элементом H1 в файле HTML перетащите элемент Label из палитры в область под элементом H1. Откроется следующее диалоговое окно:
image::images/widget-3.png[]
@@ -534,7 +534,7 @@
}
----
-[start=3]
+
.
Сохраните файлы. Обновите страницу в браузере. В результате отобразится виджет Wicket Label, представленный в файле ``HomePage.html`` :
@@ -562,7 +562,7 @@
Выберите 'Панель Wicket' и нажмите 'Далее'.
-[start=2]
+
. В поле 'Имя файла' введите ``BannerPanel`` . На экране должны быть представлены следующие параметры:
image::images/panel-2.png[]
@@ -572,7 +572,7 @@
В результате в пакете будет создано два новых файла: ``BannerPanel.html`` и ``BannerPanel.java`` .
-[start=3]
+
. Откройте файл ``BannerPanel.html`` и обратите внимание на содержимое этого файла:
@@ -634,7 +634,7 @@
}
----
-[start=4]
+
. Простая панель почти готова. Добавим ее на главную страницу. Откройте файл ``HomePage.java`` и создайте новый экземпляр элемента BannerPanel, добавив следующую строку в конечный сегмент конструктора:
@@ -644,7 +644,7 @@
add(new BannerPanel("bannerPanel"));
----
-[start=5]
+
. Теперь нужно отобразить панель. Откройте файл ``HomePage.html`` и добавьте тег-заполнитель сразу над закрывающим тегом BODY. Обязательно используйте такой же идентификатор Wicket, как и в файле Java:
@@ -654,7 +654,7 @@
<span wicket:id='bannerPanel'/>
----
-[start=6]
+
.
Выполните проект еще раз. Панель отображается на странице точно в том месте, которое указано в файле HTML:
@@ -701,7 +701,7 @@
</html>
----
-[start=2]
+
. В соответствующем представлении Java будут автоматически добавлены следующие элементы:
@@ -731,7 +731,7 @@
};
----
-[start=3]
+
. Нажмите Ctrl-Shift-I и выберите корректные операторы импорта:
image::images/imports-1.png[]
@@ -754,7 +754,7 @@
import org.apache.wicket.util.string.Strings;
----
-[start=4]
+
.
Обновите страницу в браузере еще раз. На странице появится автоматически заполняемое поле AJAX. При вводе символов в поле будет подставляться название страны, соответствующее введенному тексту.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_zh_CN.asciidoc
index 395ac8a..d14e778 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps-wicket_zh_CN.asciidoc
@@ -105,7 +105,7 @@
* *Main Package*(主包)。IDE 将生成的所有工件放入的 Java 包。
* *Version*(版本)。Wicket 版本。以上 "Version"(版本)下拉列表中将列出库管理器中名称以 "Wicket" 开头的所有库。默认情况下,唯一列出的版本是 1.6.0,因为这是插件所提供的版本。
-[start=5]
+
. 单击 "Finish"(完成)。
IDE 将创建 ``MyFirstWicketApp `` 项目。此项目包含所有源代码和项目元数据,例如项目的 Ant 构建脚本。此项目在 IDE 中打开。可以在 "Projects"(项目)窗口(Ctrl-1 组合键)中查看其逻辑结构:
@@ -124,7 +124,7 @@
单击 "Next"(下一步)。
-[start=2]
+
. 在 "Name and Location"(名称和位置)面板的 "Project Name"(项目名称)中,键入 ``MyFirstWicketApp`` 。根据您的需求更改 "Project Location"(项目位置)和默认 Maven 设置。
image::images/maven-3.png[]
@@ -132,7 +132,7 @@
单击 "Next"(下一步)。
-[start=3]
+
. 根据您的需求选择适当的服务器,并选择 "Java EE 6 Web" 作为 "Java EE Version"(Java EE 版本)设置。
image::images/maven-4.png[]
@@ -142,13 +142,13 @@
image::images/maven-5.png[]
-[start=4]
+
. 因为我们已添加对 Java EE 6 的支持,所以上一步中未创建 ``web.xml`` 文件。但是,Wicket 要求在 ``web.xml`` 文件中注册 Wicket 应用程序过滤器。因此,我们将在应用程序中添加新的 ``web.xml`` 文件,然后继续。
右键单击应用程序,选择 "New"(新建)> "Other"(其他),然后选择 "Web" > "Standard Deployment Descriptor"(标准部署描述符)(web.xml)。单击 "Next"(下一步),然后单击 "Finish"(完成)。
-[start=5]
+
. 此时我们即可将 Wicket 支持添加到应用程序中。右键单击项目节点,然后选择 "Properties"(属性)。在 "Project Properties"(项目属性)对话框中,选择 "Frameworks"(框架),然后单击 "Wicket"。使用前几部分中的描述在此对话框的 "Wicket Configuration"(Wicket 配置)部分中填写详细信息。单击 "OK"(确定)。
IDE 将创建入门所需的所有 Wicket 文件:
@@ -167,7 +167,7 @@
单击 "Next"(下一步)。
-[start=2]
+
. 在 "Search"(搜索)字段中,键入 "wicket",然后选择要使用的原型。
image::images/maven-8.png[]
@@ -200,10 +200,10 @@
image::images/maven-9.png[]
-[start=2]
+
. 在上面显示的对话框中,单击 "New Library"(新建库),使用以 "Wicket" 开头的名称创建一个新库。将 JAR 添加到该库中,即,将 Wicket 的首选版本的 JAR 注册到您已创建的库中。
-[start=3]
+
.
当您接下来创建新的 Web 应用程序时,或将 Wicket 支持添加到现有应用程序中时,"Frameworks"(框架)面板将显示新注册的库(如果其名称以 "Wicket" 一词开头):
@@ -445,7 +445,7 @@
* *Footer Panel*(页脚面板)。页脚面板的结构与页眉面板相同,如上所示。
-[start=2]
+
.
右键单击项目并运行该项目。IDE 将编译应用程序,创建 WAR 文件,将该文件发送到部署服务器,打开 IDE 的默认浏览器,并显示应用程序:
@@ -475,7 +475,7 @@
image::images/widget-2.png[]
-[start=2]
+
. 在 HTML 文件中的 H1 元素下方添加一行之后,将 "Label"(标签)项从 "Palette"(组件面板)拖放到 H1 元素下方。您会看到下面的对话框:
image::images/widget-3.png[]
@@ -534,7 +534,7 @@
}
----
-[start=3]
+
.
保存文件。刷新浏览器后,您将会看到在 ``HomePage.html`` 文件中呈现的 Wicket 标签:
@@ -562,7 +562,7 @@
选择 "Wicket Panel"(Wicket 面板)并单击 "Next"(下一步)。
-[start=2]
+
. 在 "File Name"(文件名)中键入 ``BannerPanel`` 。您现在应该看到下面的屏幕:
image::images/panel-2.png[]
@@ -572,7 +572,7 @@
请注意,我们的包中现在包含 ``BannerPanel.html`` 和 ``BannerPanel.java`` 这两个新文件。
-[start=3]
+
. 打开 ``BannerPanel.html`` ,注意此文件的内容如下:
@@ -634,7 +634,7 @@
}
----
-[start=4]
+
. 我们的面板虽然简单,但实际上已经完整。将该面板添加到主页中。打开 ``HomePage.java`` ,然后通过在构造函数结尾添加以下行来创建 BannerPanel 的新实例:
@@ -644,7 +644,7 @@
add(new BannerPanel("bannerPanel"));
----
-[start=5]
+
. 接下来,我们需要呈现面板。打开 ``HomePage.html`` ,然后在结束的 BODY 标记上方添加占位符标记,并确保使用 Java 文件中使用的相同 Wicket 标识符:
@@ -654,7 +654,7 @@
<span wicket:id='bannerPanel'/>
----
-[start=6]
+
.
重新运行项目。请注意,面板的显示位置完全如 HTML 文件指定的:
@@ -701,7 +701,7 @@
</html>
----
-[start=2]
+
. 在匹配的 Java 端,注意已自动添加了以下内容:
@@ -731,7 +731,7 @@
};
----
-[start=3]
+
. 按 Ctrl-Shift-I 组合键,然后确保选择正确的 import 语句:
image::images/imports-1.png[]
@@ -754,7 +754,7 @@
import org.apache.wicket.util.string.Strings;
----
-[start=4]
+
.
再次刷新浏览器后,您将具有一个 AJAX 自动完成字段。当您键入时,该字段中将填充与输入的文本匹配的国家/地区。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps.asciidoc
index 8ddd80c..8a3f326 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps.asciidoc
@@ -51,7 +51,7 @@
Oracle Web Logic server |4.x
_ _
-[start=7]
+
.x or 8.x
11gR1 (10.3.3) or later
@@ -99,7 +99,7 @@
String name;
----
-[start=4]
+
. Add the following constructor to the class:
[source,java]
@@ -108,7 +108,7 @@
public NameHandler() { }
----
-[start=5]
+
. Add the following line in the ``NameHandler()`` constructor:
[source,java]
@@ -126,7 +126,7 @@
image::images/encapsulatefields-dialog.png[]
-[start=2]
+
. Click Refactor.
Getter and setter methods are generated for the ``name`` field. The modifier for the class variable is set to ``private`` while getter and setter methods are generated with public modifiers. The Java class should now look similar to the following.
@@ -172,7 +172,7 @@
The Insert Form dialog box displays.
-[start=3]
+
. Specify the following values:
* *Action: *response.jsp
* *Method: *GET
@@ -182,22 +182,22 @@
image::images/input-form.png[]
-[start=4]
+
. Drag a Text Input item to a point just before the ``</form>`` tag, then specify the following values:
* *Name: *name
* *Type: *text
Click OK. An HTML ``<input>`` tag is added between the ``<form>`` tags. Delete the ``value`` attribute from this tag.
-[start=5]
+
. Drag a Button item to a point just before the ``</form>`` tag. Specify the following values:
* *Label: *OK
* *Type: *submit
Click OK. An HTML button is added between the ``<form>`` tags.
-[start=6]
+
. Type ``Enter your name:`` just before the first ``<input>`` tag, then change the default ``Hello World!`` text between the ``<h1>`` tags to ``Entry Form`` .
-[start=7]
+
. Right-click within the Source Editor and choose Format (Alt-Shift-F) to tidy the format of your code. Your ``index.jsp`` file should now appear similar to the following:
[source,xml]
@@ -234,7 +234,7 @@
* *Scope: *session
Click OK. Notice that the ``<jsp:useBean>`` tag is added beneath the ``<body>`` tag.
-[start=3]
+
. Drag a Set Bean Property item from the Palette to a point just before the ``<h1>`` tag and click OK. In the ``<jsp:setProperty>`` tag that appears, delete the empty ``value`` attribute and edit as follows. Delete the ``value = ""`` attribute if the IDE created it! Otherwise, it overwrites the value for ``name`` that you pass in ``index.jsp`` .
[source,java]
@@ -248,7 +248,7 @@
``<jsp:setProperty>`` documentation, you can set a property value in various ways. In this case, the user input coming from ``index.jsp`` becomes a name/value pair that is passed to the ``request`` object. When you set a property using the ``<jsp:setProperty>`` tag, you can specify the value according to the name of a property contained in the ``request`` object. Therefore, by setting ``property`` to ``name`` , you can retrieve the value specified by user input.
-[start=4]
+
. Change the text between the <h1> tags so that it looks like this:
[source,xml]
@@ -257,7 +257,7 @@
<h1>Hello, !</h1>
----
-[start=5]
+
. Drag a Get Bean Property item from the Palette and drop it after the comma between the ``<h1>`` tags. Specify the following values in the Insert Get Bean Property dialog:
* *Bean Name: *mybean
* *Property Name: *name
@@ -267,7 +267,7 @@
*Caution:* Property names are case-sensitive. The "name" property must be in the same case in ``response.jsp`` and in the input form in ``index.jsp`` .
-[start=6]
+
. Right-click within the Source Editor and choose Format (Alt-Shift-F) to tidy the format of your code. The ``<body>`` tags of your ``response.jsp`` file should now appear similar to the following:
[source,xml]
@@ -295,12 +295,12 @@
*Note:* By default, the project has been created with the Compile on Save feature enabled, so you do not need to compile your code first in order to run the application in the IDE.
-[start=2]
+
. The IDE opens an output window that shows the progress of running the application. Look at the HelloWeb tab in the Output window. In this tab, you can follow all the steps that the IDE performs. If there is a problem, the IDE displays error information in this window.
image::images/app-output-tab.png[]
-[start=3]
+
. The IDE opens an output window showing the server status. Look at the tab in the Output window with the name of your server.
*Important:* If the GlassFish server fails to start, start it manually and run the project again. You can start the server manually from the Services window, by right-clicking the server node and selecting Start.
@@ -309,13 +309,13 @@
image::images/gf-output-tab.png[]
-[start=4]
+
.
The ``index.jsp`` page opens in your default browser. Note that the browser window may open before the IDE displays the server output.
image::images/result1.png[]
-[start=5]
+
.
Enter your name in the text box, then click OK. The ``response.jsp`` page displays, providing you with a simple greeting.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ja.asciidoc
index 0f5f2d3..37a6300 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ja.asciidoc
@@ -51,7 +51,7 @@
Oracle WebLogic Server |4.x
_ _
-[start=7]
+
.xまたは8.x
11gR1 (10.3.3)以降
@@ -99,7 +99,7 @@
String name;
----
-[start=4]
+
. 次のコンストラクタをクラスに追加します。
[source,java]
@@ -108,7 +108,7 @@
public NameHandler() { }
----
-[start=5]
+
. ``nameHandler() `` コンストラクタに次の行を追加します。
[source,java]
@@ -126,7 +126,7 @@
image::images/encapsulatefields-dialog.png[]
-[start=2]
+
. 「リファクタリング」をクリックします。
``name`` フィールドの取得メソッドと設定メソッドが生成されます。クラス変数の修飾子は ``private`` に設定され、取得メソッドと設定メソッドはpublicの修飾子を指定して生成されます。Javaクラスは次のようになります。
@@ -172,7 +172,7 @@
「挿入フォーム」ダイアログ・ボックスが表示されます。
-[start=3]
+
. 次の値を指定します。
* *アクション:* response.jsp
* *メソッド:* GET
@@ -182,22 +182,22 @@
image::images/input-form.png[]
-[start=4]
+
. 「テキスト入力」項目を ``</form>`` タグの直前にドラッグし、次の値を指定します。
* *名前:* name
* *型:* text
「OK」をクリックします。 ``<form>`` タグの間にHTML ``<input>`` タグが追加されます。このタグから ``value`` 属性を削除します。
-[start=5]
+
. ``</form>`` タグの直前に「ボタン」項目をドラッグします。次の値を指定します。
* *ラベル:* OK
* *型:* submit
「OK」をクリックします。 ``<form>`` タグの間にHTMLのボタンが追加されます。
-[start=6]
+
. ``<input>`` タグの直前に「 ``Enter your name:`` 」と入力し、 ``<h1>`` タグで囲まれたデフォルトの「 ``Hello World!`` 」というテキストを「 ``Entry Form`` 」に変更します。
-[start=7]
+
. ソース・エディタ内を右クリックし、「フォーマット」([Alt]-[Shift]-[F])を選択してコードの体裁を整えます。 ``index.jsp`` ファイルは次のようになります。
[source,xml]
@@ -234,7 +234,7 @@
* *スコープ:* session
「OK」をクリックします。 ``<jsp:useBean>`` タグが ``<body>`` タグの下に追加されていることがわかります。
-[start=3]
+
. パレットから、「Beanプロパティを設定」項目を ``<h1>`` タグの直前にドラッグし、「OK」をクリックします。表示される ``<jsp:setProperty>`` タグ内で、空の ``value`` 属性を削除し、次のように編集します。 ``value=""`` 属性が作成されている場合は削除します。そうでない場合は、 ``index.jsp`` で渡す ``name`` の値が上書きされます。
[source,java]
@@ -248,7 +248,7 @@
``<jsp:setProperty>`` のドキュメントに示すように、様々な方法で設定できます。この例では、 ``index.jsp`` からのユーザー入力が、 ``request`` オブジェクトに渡される名前と値のペアになります。 ``<jsp:setProperty>`` タグを使用してプロパティを設定するとき、 ``request`` オブジェクトに含まれるプロパティの名前に従って値を指定できます。したがって、 ``property`` を ``name`` に設定することで、ユーザー入力で指定された値を取得できます。
-[start=4]
+
. <h1> タグの間のテキストを次のように変更します。
[source,xml]
@@ -257,7 +257,7 @@
<h1>Hello, !</h1>
----
-[start=5]
+
. パレットから「Beanプロパティを取得」項目をドラッグし、 ``<h1>`` タグ間のカンマの後にドロップします。「挿入Beanプロパティを取得」ダイアログで次の値を指定します。
* *Bean名: *mybean
* *プロパティ名: *name
@@ -267,7 +267,7 @@
*注意:* プロパティ名では大文字と小文字が区別されます。 ``response.jsp`` と ``index.jsp`` の入力フォームの"name" プロパティは、同じ大文字と小文字で指定する必要があります。
-[start=6]
+
. ソース・エディタ内を右クリックし、「フォーマット」([Alt]-[Shift]-[F])を選択してコードの体裁を整えます。 ``response.jsp`` ファイルの ``<body>`` タグは次のようになります。
[source,xml]
@@ -295,12 +295,12 @@
*注意:* プロジェクトはデフォルトで「保存時にコンパイル」機能が有効になっている状態で作成されているので、アプリケーションをIDEで実行するときに先にコードをコンパイルする必要はありません。
-[start=2]
+
. アプリケーションの実行の進行状況を示す出力ウィンドウが開きます。出力ウィンドウの「HelloWeb」タブを見てください。このタブでは、IDEで実行されるすべての手順を追跡できます。問題がある場合は、このウィンドウにエラー情報が表示されます。
image::images/app-output-tab.png[]
-[start=3]
+
. サーバーのステータスを示す出力ウィンドウが開きます。出力ウィンドウで、使用しているサーバーの名前が付いているタブを見てください。
*重要:* GlassFishサーバーの起動に失敗した場合は、手動で起動し、プロジェクトを再度実行してください。サーバーは、「サービス」ウィンドウでサーバー・ノードを右クリックし、「起動」を選択することで手動で起動できます。
@@ -309,13 +309,13 @@
image::images/gf-output-tab.png[]
-[start=4]
+
.
デフォルトのブラウザで ``index.jsp`` ページが開きます。IDEがサーバーの出力を表示する前に、ブラウザ・ウィンドウが開くこともあります。
image::images/result1.png[]
-[start=5]
+
.
テキスト・ボックスに名前を入力し、「OK」をクリックします。 ``response.jsp`` ページが表示され、単純な挨拶のメッセージが表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_pt_BR.asciidoc
index 8cea6a4..180eef2 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_pt_BR.asciidoc
@@ -51,7 +51,7 @@
Servidor Oracle WebLogic |4.x
_ _
-[start=7]
+
.x ou 8.x
11gR1 (10.3.3) ou mais recente
@@ -99,7 +99,7 @@
String name;
----
-[start=4]
+
. Adicione o construtor a seguir à classe:
[source,java]
@@ -108,7 +108,7 @@
public NameHandler() { }
----
-[start=5]
+
. Adicione a linha a seguir no construtor ``NameHandler()`` :
[source,java]
@@ -126,7 +126,7 @@
image::images/encapsulatefields-dialog.png[]
-[start=2]
+
. Clique em Refatorar.
Os métodos getter e setter são gerados para o campo ``name`` . O modificador da variável de classe é definido como ``private`` enquanto os métodos getter e setter são gerados com modificadores públicos. A classe Java deverá ser semelhante a:
@@ -172,7 +172,7 @@
A caixa de diálogo Inserir Form será exibida.
-[start=3]
+
. Especifique os valores a seguir:
* *Ação:* response.jsp
* *Método:* GET
@@ -182,22 +182,22 @@
image::images/input-form.png[]
-[start=4]
+
. Arraste um item Entrada de Texto para um ponto antes da tag ``</form>`` , em seguida, especifique os seguintes valores:
* *Nome:* nome
* *Tipo:* texto
Clique em OK. Uma tag HTML ``<input>`` será adicionada entre as tags ``<form>`` . Delete o atributo ``value`` dessa tag.
-[start=5]
+
. Arraste um item Botão para antes da tag ``</form>`` . Especifique os valores a seguir:
* *Label:* OK
* *Tipo:* envio
Clique em OK. Um botão HTML será adicionado entre as tags ``<form>`` .
-[start=6]
+
. Digite ``Indique seu nome:`` antes da primeira tag ``<input>`` , em seguida, altere o texto default ``Hello World!`` entre as tags ``<h1>`` para ``Entry Form`` .
-[start=7]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte e selecione Formatar (Alt-Shift-F) para aprimorar o formato do seu código. Seu arquivo ``index.jsp`` agora deverá ser semelhante ao seguinte:
[source,xml]
@@ -234,7 +234,7 @@
* *Escopo:* sessão
Clique em OK. Observe que a tag ``<jsp:useBean>`` é adicionada abaixo da tag ``<body>`` .
-[start=3]
+
. Arraste um item Definir Propriedade do Bean da Paleta para um ponto antes da tag ``<h1>`` e clique em OK. Na tag ``<jsp:setProperty>`` que aparece, delete o atributo ``value`` vazio e edite da seguinte forma: Delete o atributo ``value = ""`` se o IDE o tiver criado! Do contrário, ele substitui o valor de ``name`` indicado em ``index.jsp`` .
[source,java]
@@ -248,7 +248,7 @@
documentação de ``<jsp:setProperty>`` , você pode definir um valor de propriedade de várias formas. Nesse caso, a entrada do usuário que vem de ``index.jsp`` se torna um par nome/valor que é passado para o objeto ``request`` . Quando você define uma propriedade usando a tag ``<jsp:setProperty>`` , pode especificar o valor de acordo com o nome de uma propriedade contida no objeto ``request`` . Portanto, definindo ``property`` como ``name`` , você pode recuperar o valor especificado pela entrada do usuário.
-[start=4]
+
. Altere o texto entre as tags <h1> de forma que ele tenha a seguinte aparência:
[source,xml]
@@ -257,7 +257,7 @@
<h1>Hello, !</h1>
----
-[start=5]
+
. Arraste um item Propriedade Get Bean da Paleta e solte-o depois da vírgula entre as tags ``<h1>`` . Especifique os seguintes valores na caixa de diálogo Inserir Propriedade Get Bean:
* *Nome do Bean: *mybean
* *Nome da Propriedade: *nome
@@ -267,7 +267,7 @@
*Cuidado:* os nomes de propriedade fazem distinção entre maiúsculas e minúsculas. A propriedade "name" deve estar com a mesma colocação de maiúsculas e minúsculas que em ``response.jsp`` e na forma de entrada em ``index.jsp`` .
-[start=6]
+
. Clique com o botão direito do mouse no Editor de Código-Fonte e selecione Formatar (Alt-Shift-F) para aprimorar o formato do seu código. As tags ``<body>`` do seu arquivo ``response.jsp`` agora devem ser semelhantes ao seguinte:
[source,xml]
@@ -295,12 +295,12 @@
*Observação:* Por default, o projeto foi criado com a funcionalidade Compilar ao Salvar ativado, então, não é necessário compilar o código primeiro para executar a aplicação no IDE.
-[start=2]
+
. O IDE abre uma janela de saída que mostra o andamento da execução da aplicação. Veja a guia HellWeb na janela de Saída. Nessa guia, é possível acompanhar todas as etapas executadas pelo IDE. Se houver um problema, o IDE mostrará as informações do erro nessa janela.
image::images/app-output-tab.png[]
-[start=3]
+
. O IDE abre uma janela de saída mostrando a situação do servidor. Observe a guia na janela de Saída com o nome do servidor.
*Importante:* se a inicialização do GlassFish Server falhar, inicie-o manualmente e execute novamente o projeto. É possível iniciar o servidor manualmente a partir da janela Serviços clicando com o botão direito no nó do servidor e selecionando Iniciar.
@@ -309,13 +309,13 @@
image::images/gf-output-tab.png[]
-[start=4]
+
.
A página ``index.jsp`` será aberta no browser default. Observe que a janela do browser poderá abrir antes que o IDE exiba a saída do servidor.
image::images/result1.png[]
-[start=5]
+
.
Indique seu nome na caixa de texto e clique em OK. A página ``response.jsp`` é exibida com uma simples saudação.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ru.asciidoc
index e1bd3a0..2175142 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_ru.asciidoc
@@ -51,7 +51,7 @@
Сервер Oracle Web Logic |4.x
_ _
-[start=7]
+
.x или 8.x
11gR1 (10.3.3) или более поздние версии
@@ -99,7 +99,7 @@
String name;
----
-[start=4]
+
. Добавьте следующий конструктор к классу:
[source,java]
@@ -108,7 +108,7 @@
public NameHandler() { }
----
-[start=5]
+
. Добавьте следующую строку в конструктор ``NameHandler()`` :
[source,java]
@@ -126,7 +126,7 @@
image::images/encapsulatefields-dialog.png[]
-[start=2]
+
. Нажмите кнопку "Refactor" (Реорганизация).
Для поля ``name`` создаются методы получения и установки. Модификатор для переменной класса определяется как ``private`` , в то время как методы получения и установки создаются с модификаторами "public". Класс Java должен теперь выглядеть следующим образом.
@@ -172,7 +172,7 @@
Появится диалоговое окно "Insert Form".
-[start=3]
+
. Установите следующие значения:
* *Action:* response.jsp;
* *Method:* GET;
@@ -182,22 +182,22 @@
image::images/input-form.png[]
-[start=4]
+
. Перетащите элемент "Text Input" в позицию непосредственно перед тегом ``</form>`` , затем установите следующие значения:
* *Name:* name;
* *Type:* text.
Нажмите кнопку "ОК". Между тегами ``<form>`` будет добавлен тег HTML ``<input>`` . Удалите атрибут ``value`` из данного тега.
-[start=5]
+
. Перетащите элемент "Button" в позицию непосредственно перед тегом ``</form>`` . Установите следующие значения:
* *Label:* OK;
* *Type:* submit.
Нажмите кнопку "ОК". Между тегами ``<form>`` будет добавлена кнопка HTML.
-[start=6]
+
. Введите ``Enter your name:`` непосредственно перед первым тегом ``<input>`` , затем измените текст по умолчанию ``Hello World!`` , расположенный между тегами ``<h1>`` , на ``Entry Form`` .
-[start=7]
+
. Щелкните правой кнопкой мыши область редактора исходного кода и выберите "Format" (Alt+Shift+F) для переформатирования кода. Файл ``index.jsp`` должен теперь выглядеть следующим образом:
[source,xml]
@@ -234,7 +234,7 @@
* *Scope:* session.
Нажмите кнопку "ОК". Обратите внимание на то, что под тегом ``<body>`` добавляется тег ``<jsp:useBean>`` .
-[start=3]
+
. Перетащите элемент "Set Bean Property" из палитры и поместите его непосредственно перед тегом ``<h1>`` . Нажмите кнопку "OК". В появившемся теге ``<jsp:setProperty>`` удалите пустой атрибут ``value`` и измените его следующим образом: Eсли средой IDE был создан атрибут ``value = ""`` , удалите его. В противном случае значение ``name`` , введенное в форме ``index.jsp`` , будет перезаписано.
[source,java]
@@ -248,7 +248,7 @@
документации ``<jsp:setProperty>`` , значение свойства можно задать различными способами. В этом случае вводимые пользователем данные из ``index.jsp`` становятся парой имя/значение, передаваемой в объект ``request`` . При установке свойства с помощью тега ``<jsp:setProperty>`` можно указать значение в соответствии с именем свойства, содержащегося в объекте ``request`` . Поэтому при определении ``property`` в качестве ``name`` можно получить значение, указанное пользователем при вводе.
-[start=4]
+
. Измените текст между тегами <h1> следующим образом:
[source,xml]
@@ -257,7 +257,7 @@
<h1>Hello, !</h1>
----
-[start=5]
+
. Перетащите элемент "Get Bean Property" из палитры в позицию непосредственно после запятой между тегами ``<h1>`` . Укажите следующие значения в диалоговом окне "Insert Get Bean Property":
* *Bean Name: *mybean;
* *Property Name: *name.
@@ -267,7 +267,7 @@
*Обратите внимание:* имена Property нужно вводить с учетом регистра. Свойство "name" должно быть в одном регистре как в ``response.jsp`` , так и в форме ввода ``index.jsp`` .
-[start=6]
+
. Щелкните правой кнопкой мыши область редактора исходного кода и выберите "Format" (Alt+Shift+F) для переформатирования кода. Теперь теги ``<body>`` файла ``response.jsp`` должны выглядеть следующим образом:
[source,xml]
@@ -295,12 +295,12 @@
*Примечание.* По умолчанию, проект создается с включенной функцией 'Компилировать при сохранении', так что не нужно сначала компилировать код.
-[start=2]
+
. Среда IDE откроет окно 'Результаты', в котором отображается ход выполнения приложения. Взгляните на вкладку HelloWeb в окне вывода. В этой вкладке можно проследить все действия, выполняемые средой IDE. При наличии проблемы IDE отображает информацию об ошибке в этом окне.
image::images/app-output-tab.png[]
-[start=3]
+
. Среда IDE открывает окно 'Результаты', которое показывает состояние сервера. Взгляните на вкладку в окне вывода с именем сервера.
*Обратите внимание.* Если сервер GlassFish не запускается, запустите его вручную и после этого выполните проект снова. Сервер можно запустить вручную из окна 'Службы', щелкнув правой кнопкой мыши узел сервера и выбрав 'Пуск'.
@@ -309,13 +309,13 @@
image::images/gf-output-tab.png[]
-[start=4]
+
.
Страница ``index.jsp`` откроется в браузере по умолчанию. Обратите внимание, что окно браузера может открыться до отображения выходных данных сервера средой IDE.
image::images/result1.png[]
-[start=5]
+
.
Введите имя в текстовом поле и нажмите кнопку "OК". На экране появится страница ``response.jsp`` с простым приветствием.
diff --git a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_zh_CN.asciidoc
index 4b376be..8a1c2eb 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/quickstart-webapps_zh_CN.asciidoc
@@ -51,7 +51,7 @@
Oracle Web Logic 服务器 |4.x
_和_
-[start=7]
+
.x 或 8.x
11gR1 (10.3.3) 或更高版本
@@ -99,7 +99,7 @@
String name;
----
-[start=4]
+
. 将以下构造函数添加到类中:
[source,java]
@@ -108,7 +108,7 @@
public NameHandler() { }
----
-[start=5]
+
. 在 ``NameHandler()`` 构造函数中添加以下代码行:
[source,java]
@@ -126,7 +126,7 @@
image::images/encapsulatefields-dialog.png[]
-[start=2]
+
. 单击 "Refactor"(重构)。
将为 ``name`` 字段生成 getter 和 setter 方法。类变量的修饰符将被设置为 ``private`` ,而 getter 和 setter 方法将以 public 修饰符生成。Java 类现在应该与以下代码类似。
@@ -172,7 +172,7 @@
此时将显示 "Insert Form"(插入窗体)对话框。
-[start=3]
+
. 请指定以下值:
* *Action(操作):*response.jsp
* *Method(方法):*GET
@@ -182,22 +182,22 @@
image::images/input-form.png[]
-[start=4]
+
. 将一个 "Text Input"(文本输入)项拖至紧靠 ``</form>`` 标记前面的位置,然后指定以下值:
* *Name(名称):*name
* *Type(类型):*text
单击 "OK"(确定)。将在 ``<form>`` 标记之间添加一个 HTML ``<input>`` 标记。从此标记中删除 ``value`` 属性。
-[start=5]
+
. 将一个按钮项拖至紧靠 ``</form>`` 标记前面的位置。请指定以下值:
* *Label(标签):*OK
* *Type(类型):*submit
单击 "OK"(确定)。将在 ``<form>`` 标记之间添加一个 HTML 按钮。
-[start=6]
+
. 在紧靠第一个 ``<input>`` 标记前面的位置键入 ``Enter your name:`` ,然后将 ``<h1>`` 标记之间的默认 ``Hello World!`` 文本更改为 ``Entry Form`` 。
-[start=7]
+
. 在源代码编辑器中单击鼠标右键,然后选择 "Format"(格式化代码)(Alt-Shift-F 组合键)以整理代码的格式。 ``index.jsp`` 文件现在应该与以下代码类似:
[source,xml]
@@ -234,7 +234,7 @@
* *Scope(范围):*Session(会话)
单击 "OK"(确定)。请注意,将在 ``<body>`` 标记的下方添加 ``<jsp:useBean>`` 标记。
-[start=3]
+
. 将一个设置 Bean 属性项从 "Palette"(组件面板)拖至紧靠 ``<h1>`` 标记前面的位置,然后单击 "OK"(确定)。在出现的 ``<jsp:setProperty>`` 标记中,删除空的 ``value`` 属性,然后将其编辑为以下代码。如果 IDE 创建了 ``value = ""`` 属性,请将其删除!否则,它会覆盖传递到 ``index.jsp`` 中的 ``name`` 的值。
[source,java]
@@ -248,7 +248,7 @@
``<jsp:setProperty>`` 文档中所述,可以通过各种方法来设置属性值。在本例中, ``index.jsp`` 页上的用户输入将成为传递至 ``request`` 对象的名称/值对。当使用 ``<jsp:setProperty>`` 标记设置属性时,可以根据 ``request`` 对象中包含的属性名称来指定值。因此,通过将 ``property`` 设置为 ``name`` ,可以检索由用户输入所指定的值。
-[start=4]
+
. 更改 <h1> 标记之间的文本,以使其如下所示:
[source,xml]
@@ -257,7 +257,7 @@
<h1>Hello, !</h1>
----
-[start=5]
+
. 将一个获取 Bean 属性项从 "Palette"(组件面板)拖放至 ``<h1>`` 标记之间的逗号后面。在 "Insert Get Bean Property"(插入获取 Bean 属性)对话框中指定以下值:
* *Bean Name(Bean 名称):*mybean
* *Property Name(属性名称):*name
@@ -267,7 +267,7 @@
*注:*属性名称区分大小写。"name" 属性在 ``response.jsp`` 和 ``index.jsp`` 的输入窗体中必须具有相同的大小写形式。
-[start=6]
+
. 在源代码编辑器中单击鼠标右键,然后选择 "Format"(格式化代码)(Alt-Shift-F 组合键)以整理代码的格式。 ``response.jsp`` 文件的 ``<body>`` 标记现在应该与以下代码类似:
[source,xml]
@@ -295,12 +295,12 @@
*注:*默认情况下,将在启用“在保存时编译”功能的情况下创建项目,因此无需先编译代码即可在 IDE 中运行应用程序。
-[start=2]
+
. IDE 将打开一个输出窗口,其中显示运行应用程序的进度。查看 "Output"(输出)窗口中的 "HelloWeb" 标签。在此标签中,您可以遵循 IDE 执行的所有步骤。如果出现问题,IDE 将在此窗口中显示错误信息。
image::images/app-output-tab.png[]
-[start=3]
+
. IDE 会打开一个显示服务器状态的输出窗口。在 "Output"(输出)窗口中查看具有服务器名称的标签。
*重要信息:*如果 GlassFish Server 无法启动,请将其手动启动并再次运行该项目。可以手动启动该服务器,方法是:在 "Services"(服务)窗口中右键单击该服务器节点,然后选择 "Start"(启动)。
@@ -309,13 +309,13 @@
image::images/gf-output-tab.png[]
-[start=4]
+
.
将在默认浏览器中打开 ``index.jsp`` 页。请注意,在 IDE 显示服务器输出之前,浏览器窗口可能会打开。
image::images/result1.png[]
-[start=5]
+
.
在文本框中输入您的姓名,然后单击 "OK"(确定)。将出现 ``response.jsp`` 页,并向您显示一条简单的问候语。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/security-webapps.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/security-webapps.asciidoc
index 0a61706..3a4438e 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/security-webapps.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/security-webapps.asciidoc
@@ -84,37 +84,37 @@
*Note:* This tutorial shows how to configure security in the deployment descriptor, but EE 6 and EE 7 applications use annotations instead of a deployment descriptor, by default.
-[start=8]
+
. If you are using the GlassFish or WebLogic server and NetBeans IDE 7.0.1 or later, you need to generate a server-specific descriptor. Right-click the project's node and select New > Other > GlassFish > GlassFish Descriptor, or New > Other > WebLogic > WebLogic Descriptor. The Create Server-Specific Descriptor dialog opens. Accept all the defaults and click Finish. The server-specific descriptor, named either ``glassfish-web.xml`` or ``weblogic.xml`` , appears in the project in the Configuration Files folder.
-[start=9]
+
. In the Projects window of the IDE, right-click Web Pages and choose New > Other.
-[start=10]
+
. In the New File wizard, select Other as Category and Folder as File Type. Click Next.
-[start=11]
+
.
In the New Folder wizard, name the folder secureAdmin and click Finish.
The secureAdmin folder appears in the Projects window in the Web Pages folder.
-[start=12]
+
. Repeat the previous 3 steps to create another folder named secureUser.
-[start=13]
+
. Create a new ``html`` file in the secureUser folder by right-clicking the folder secureUser in the Projects window and choosing New > Other.
-[start=14]
+
. Select the HTML file type in the Other category. Click Next.
-[start=15]
+
. Name the new file pageU and click Finish.
When you click Finish, the file ``pageU.html`` opens in the Source Editor.
-[start=16]
+
. In the Source Editor, replace the existing code in ``pageU.html`` with the following code.[html-tag]#<html>
<head>
<title>#
@@ -130,10 +130,10 @@
</html>#
----
-[start=17]
+
. Right-click the secureAdmin folder and create a new ``html`` file named pageA.
-[start=18]
+
. In the Source Editor, replace the existing code in ``pageA.html`` with the following code.[html-tag]#<html>
<head>
<title>#
@@ -163,7 +163,7 @@
<p>#Request a secure User page [jsp-html-tag]#<a# [jsp-html-argument]#href=#[jsp-xml-value]#"secureUser/pageU.html"# [jsp-html-tag]#>#here![jsp-html-tag]#</a></p>#
----
-[start=2]
+
. Save your changes.
@@ -187,10 +187,10 @@
</form>#
----
-[start=4]
+
. Create a new ``html`` file named ``loginError.html`` in the Web Pages folder. This is a simple error page.
-[start=5]
+
. In the Source Editor, replace the existing code in ``loginError.html`` with the following code.[html-tag]#<html>
<head>
<title>#
@@ -224,20 +224,20 @@
*Note: *The Application Server must be running before you can access the Admin Console. To start the server, right-click the GlassFish server node and choose Start.
-[start=2]
+
. In the Admin Console, navigate to Configurations > server-config > Security > Realms > File. The Edit Realm panel opens.
image::images/edit-realm.png[]
-[start=3]
+
. Click the Manage Users button at the top of the Edit Realm panel. The File Users panel opens.
image::images/file-users.png[]
-[start=4]
+
. Click New. The New File Realm User panel opens. Type ``user`` as the user ID and ``userpw01`` as the password. Click OK.
-[start=5]
+
. Follow the previous steps to create a user named ``admin`` with password ``adminpw1`` in the ``file`` realm.
@@ -264,7 +264,7 @@
<role rolename="AdminRole"/>
----
-[start=3]
+
. Add a role named ``UserRole`` .
[source,java]
@@ -273,7 +273,7 @@
<role rolename="UserRole"/>
----
-[start=4]
+
. Add a user named ``admin`` with the password ``adminpw1`` and the role ``AdminRole`` .
[source,java]
@@ -282,7 +282,7 @@
<user username="admin" password="adminpw1" roles="AdminRole"/>
----
-[start=5]
+
. Add a user named ``user`` with the password ``userpw01`` and the role ``UserRole`` .
[source,java]
@@ -329,42 +329,42 @@
*Note: *The Application Server must be running before you can access the Admin Console. To start the server, right-click the WebLogic server node and select Start.
-[start=2]
+
. In the left pane select Security Realms. The Summary of Security Realms page opens.
-[start=3]
+
. On the Summary of Security Realms page select the name of the realm (default realm is "myrealm"). The Settings for Realm Name page opens.
-[start=4]
+
. On the Settings for Realm Name page select Users and Groups > Users. The Users table appears.
-[start=5]
+
. In the Users table, click New. The Create New User page opens.
-[start=6]
+
. Type in the name "user" and the password "userpw01". Optionally type in a description. Accept default Authentication Provider.
image::images/wl-admin-newuser.png[]
-[start=7]
+
. Click OK. You return to the Users table.
-[start=8]
+
. Click New and add a user with the name "admin" and the password "admin1".
-[start=9]
+
. Open the Groups tab. The Groups table appears.
-[start=10]
+
. Click New. The Create a New Group window opens.
-[start=11]
+
. Name the group userGroup. Accept the default provider and click OK. You return to the Groups table.
-[start=12]
+
. Click New and create the group adminGroup.
-[start=13]
+
. Open the Users tab for the next procedure.
Now add the ``admin`` user to ``adminGroup`` and the ``user`` user to ``userGroup`` .
@@ -378,13 +378,13 @@
image::images/wl-admin-usersettings.png[]
-[start=5]
+
. Click Save.
-[start=6]
+
. Return to the Users tab.
-[start=7]
+
. Click the ``user`` user and add it to the ``userGroup`` .
@@ -414,7 +414,7 @@
*Note: *If you want to use a form , select Form instead of basic and specify the login and login error pages.
-[start=4]
+
. Enter a realm name, depending on your server.
* *GlassFish:* Enter ``file`` as the Realm Name. This is the default realm name where you created the users on the GlassFish server.
* *Tomcat:* Do not enter a realm name.
@@ -422,10 +422,10 @@
image::images/security-roles.png[]
-[start=5]
+
. Expand the Security Roles node and click Add to add a role name.
-[start=6]
+
. Add the following Security Roles:
* ``AdminRole`` . Users added to this role will have access to the ``secureAdmin`` directory of the server.
* ``UserRole`` . Users added to this role will have access to the ``secureUser`` directory of the server.
@@ -433,17 +433,17 @@
*Caution:* GlassFish role names must begin with an upper-case letter.
-[start=7]
+
. Create and configure a security constraint named ``AdminConstraint`` by doing the following:
1. Click Add Security Constraint. A section for a new security constraint appears.
2. Enter ``AdminConstraint`` for the Display Name of the new security constraint.
image::images/admin-constraint.png[]
-[start=3]
+
. Click Add. The Add Web Resource dialog opens.
-[start=4]
+
.
In the Add Web Resource dialog, set the Resource Name to ``Admin`` and the URL Pattern to ``/secureAdmin/*`` and click OK. The dialog closes.
@@ -451,17 +451,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. Select Enable Authentication Constraint and click Edit. The Edit Role Names dialog opens.
-[start=6]
+
. In the Edit Role Names dialog box, select AdminRole in the left pane, click Add and then click OK.
After completing the above steps, the result should resemble the following figure:
image::images/constraints.png[]
-[start=8]
+
. Create and configure a security constraint named ``UserConstraint`` by doing the following:
1. Click Add Security Constraint to create a new security constraint.
2. Enter ``UserConstraint`` for the Display Name of the new security constraint.
@@ -488,16 +488,16 @@
image::images/login-forms.png[]
-[start=6]
+
. Enter a realm name, depending on your server.
* *GlassFish:* Enter ``file`` as the Realm Name. This is the default realm name where you created the users on the GlassFish server.
* *Tomcat:* Do not enter a realm name.
* *WebLogic:* Enter your realm name. The default realm is ``myrealm`` .
-[start=7]
+
. Expand the Security Roles node and click Add to add a role name.
-[start=8]
+
. Add the following Security Roles:
|===
@@ -508,7 +508,7 @@
|UserRole |Users added to this role have access to the ``secureUser`` directory of the server.
|===
-[start=9]
+
. Create and configure a security constraint named ``AdminConstraint`` by doing the following:
1. Click Add Security Constraint to create a new security constraint.
2. Enter ``AdminConstraint`` for the Display Name of the new security constraint.
@@ -520,17 +520,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. Select Enable Authentication Constraint and click Edit. The Edit Role Names dialog opens.
-[start=6]
+
. In the Edit Role Names dialog box, select AdminRole in the left pane, click Add and then click OK.
After completing the above steps, the result should resemble the following figure:
image::images/constraints.png[]
-[start=10]
+
. Create and configure a security constraint named ``UserConstraint`` by doing the following:
1. Click Add Security Constraint to create a new security constraint.
2. Enter ``UserConstraint`` for the Display Name of the new security constraint.
@@ -559,25 +559,25 @@
*Note:* For GlassFish server versions older than 3.1, this file is called ``sun-web.xml`` .
-[start=2]
+
. Select the Security tab to reveal the security roles.
-[start=3]
+
. Select the AdminRole security role node to open the Security Role Mapping pane.
-[start=4]
+
.
Click Add Principal and enter ``admin`` for the principal name. Click OK.
image::images/add-principal.png[]
-[start=5]
+
. Select the UserRole security role node to open the Security Role Mapping pane.
-[start=6]
+
. Click Add Principal and enter ``user`` for the principal name. Click OK
-[start=7]
+
. Save your changes to ``glassfish-web.xml`` .
You can also view and edit ``glassfish-web.xml`` in the XML editor by clicking the XML tab. If you open ``glassfish-web.xml`` in the XML editor, you can see that ``glassfish-web.xml`` has the following security role mapping information:
@@ -624,7 +624,7 @@
</security-role-assignment>#
----
-[start=3]
+
. Save your changes to ``weblogic.xml`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ja.asciidoc
index 19bf02c..6b4af96 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ja.asciidoc
@@ -84,37 +84,37 @@
*注意:* このチュートリアルではデプロイメント・ディスクリプタでセキュリティを構成する方法を示しますが、EE 6およびEE 7アプリケーションはデフォルトでデプロイメント・ディスクリプタのかわりに注釈を使用します。
-[start=8]
+
. GlassFishまたはWebLogicサーバーとNetBeans IDE 7.0.1以降を使用している場合は、サーバー固有のディスクリプタを生成する必要があります。プロジェクトのノードを右クリックし、「新規」>「その他」>「GlassFish」>「GlassFishディスクリプタ」または「新規」>「その他」>「WebLogic」>「WebLogicディスクリプタ」を選択します。「サーバー固有のディスクリプタを作成」ダイアログが開きます。デフォルトをすべて受け入れ、「終了」をクリックします。 ``glassfish-web.xml`` または ``weblogic.xml`` という名前の、サーバー固有のディスクリプタが、プロジェクトの「構成ファイル」フォルダに表示されます。
-[start=9]
+
. IDEの「プロジェクト」ウィンドウで「Webページ」を右クリックし、「新規」>「その他」を選択します。
-[start=10]
+
. 新規ファイル・ウィザードで、「カテゴリ」に「その他」を選択し、「ファイル・タイプ」に「フォルダ」を選択します。「次」をクリックします。
-[start=11]
+
.
新規フォルダ・ウィザードでフォルダに「secureAdmin」という名前を付け、「終了」をクリックします。
「プロジェクト」ウィンドウの「Webページ」フォルダに、secureAdminフォルダが表示されます。
-[start=12]
+
. 前の3つの手順を繰り返して、secureUserという名前の別のフォルダを作成します。
-[start=13]
+
. 「プロジェクト」ウィンドウで、secureUserフォルダを右クリックして「新規」>「その他」を選択し、secureUserフォルダ内に新しい ``html`` ファイルを作成します。
-[start=14]
+
. 「その他」カテゴリで「HTML」ファイル・タイプを選択します。「次」をクリックします。
-[start=15]
+
. 新しいファイルにpageUという名前を付け、「終了」をクリックします。
「終了」をクリックすると、ソース・エディタでファイル ``pageU.html`` が開きます。
-[start=16]
+
. ソース・エディタで、 ``pageU.html`` 内の既存コードを次のコードに置き換えます。[html-tag]#<html>
<head>
<title>#
@@ -130,10 +130,10 @@
</html>#
----
-[start=17]
+
. secureAdminフォルダを右クリックし、pageAという名前の新しい ``html`` ファイルを作成します。
-[start=18]
+
. ソース・エディタで、 ``pageA.html`` 内の既存コードを次のコードに置き換えます。[html-tag]#<html>
<head>
<title>#
@@ -163,7 +163,7 @@
<p>#Request a secure User page [jsp-html-tag]#<a# [jsp-html-argument]#href=#[jsp-xml-value]#"secureUser/pageU.html"# [jsp-html-tag]#>#here![jsp-html-tag]#</a></p>#
----
-[start=2]
+
. 変更を保存します。
@@ -187,10 +187,10 @@
</form>#
----
-[start=4]
+
. ``loginError.html`` という名前の新しい ``html`` ファイルを「Webページ」フォルダに作成します。これは、単純なエラー・ページです。
-[start=5]
+
. ソース・エディタで、 ``loginError.html`` 内の既存コードを次のコードに置き換えます。[html-tag]#<html>
<head>
<title>#
@@ -224,20 +224,20 @@
*注意:* 管理コンソールにアクセスする前に、Application Serverを起動している必要があります。サーバーを起動するには、GlassFishサーバーのノードを右クリックし、「起動」を選択します。
-[start=2]
+
. 管理コンソールで、「構成」>「server-config」>「セキュリティ」>「レルム」>「file」の順に展開します。「レルムを編集」パネルが開きます。
image::images/edit-realm.png[]
-[start=3]
+
. 「レルムを編集」パネルの上部にある「ユーザーを管理」ボタンをクリックします。「ファイル・ユーザー」パネルが開きます。
image::images/file-users.png[]
-[start=4]
+
. 「新規」をクリックします。新規ファイル・レルム・ユーザー・パネルが開きます。「ユーザーID」に「 ``user`` 」、パスワードに「 ``userpw01`` 」と入力します。「OK」をクリックします。
-[start=5]
+
. 前の手順に従って、名前が ``admin`` 、パスワードが ``adminpw1`` のユーザーを ``file`` レルムに作成します。
@@ -264,7 +264,7 @@
<role rolename="AdminRole"/>
----
-[start=3]
+
. ``UserRole`` という名前のロールを追加します。
[source,java]
@@ -273,7 +273,7 @@
<role rolename="UserRole"/>
----
-[start=4]
+
. 名前が ``admin`` 、パスワードが ``adminpw1`` 、ロールが ``AdminRole`` のユーザーを追加します。
[source,java]
@@ -282,7 +282,7 @@
<user username="admin" password="adminpw1" roles="AdminRole"/>
----
-[start=5]
+
. 名前が ``user`` 、パスワードが ``userpw01`` 、ロールが ``UserRole`` のユーザーを追加します。
[source,java]
@@ -329,42 +329,42 @@
*注意:* 管理コンソールにアクセスする前に、Application Serverを起動している必要があります。サーバーを起動するには、WebLogicサーバーのノードを右クリックし、「起動」を選択します。
-[start=2]
+
. 左ペインで、「セキュリティ・レルム」を選択します。セキュリティ・レルムのサマリー・ページが開きます。
-[start=3]
+
. セキュリティ・レルムのサマリー・ページで、レルムの名前を選択します(デフォルト・レルムは「myrealm」)。レルム名の設定ページが開きます。
-[start=4]
+
. レルム名の設定ページで、「ユーザー」を選択し、「グループ」>「ユーザー」を選択します。「ユーザー」表が表示されます。
-[start=5]
+
. 「ユーザー」表で「新規」をクリックします。新規ユーザーを作成ページが開きます。
-[start=6]
+
. 名前に「user」、パスワードに「userpw01」と入力します。必要に応じて、説明を入力します。デフォルトの認証プロバイダを受け入れます。
image::images/wl-admin-newuser.png[]
-[start=7]
+
. 「OK」をクリックします。「ユーザー」表に戻ります。
-[start=8]
+
. 「新規」をクリックし、名前が「admin」、パスワードが「admin1」のユーザーを追加します。
-[start=9]
+
. 「グループ」タブを開きます。「グループ」表が表示されます。
-[start=10]
+
. 「新規」をクリックします。「新規グループを作成」ウィンドウが開きます。
-[start=11]
+
. グループにuserGroupという名前を付けます。デフォルトのプロバイダを受け入れ、「OK」をクリックします。「グループ」表に戻ります。
-[start=12]
+
. 「新規」をクリックし、adminGroupというグループを作成します。
-[start=13]
+
. 次の手順のために「ユーザー」タブを開きます。
次に、 ``admin`` ユーザーを ``adminGroup`` 、 ``user`` ユーザーを ``userGroup`` に追加します。
@@ -378,13 +378,13 @@
image::images/wl-admin-usersettings.png[]
-[start=5]
+
. 「保存」をクリックします。
-[start=6]
+
. 「ユーザー」タブに戻ります。
-[start=7]
+
. ``user`` ユーザーをクリックし、 ``userGroup`` に追加します。
@@ -414,7 +414,7 @@
*注意:* フォームを使用する場合は、「基本」のかわりに「フォーム」を選択し、ログイン・ページおよびログイン・エラー・ページを指定します。
-[start=4]
+
. サーバーに応じたレルム名を入力します。
* *GlassFish:* 「レルム名」に「 ``file`` 」と入力します。これは、GlassFishサーバーでユーザーを作成した場所のデフォルト・レルム名です。
* *Tomcat:* レルム名は入力しないでください。
@@ -422,10 +422,10 @@
image::images/security-roles.png[]
-[start=5]
+
. 「セキュリティ・ロール」ノードを展開し、「追加」をクリックしてロール名を追加します。
-[start=6]
+
. 次のセキュリティ・ロールを追加します。
* ``AdminRole`` 。このロールに追加したユーザーは、サーバーの ``secureAdmin`` ディレクトリへのアクセス権を持ちます。
* ``UserRole`` 。このロールに追加したユーザーは、サーバーの ``secureUser`` ディレクトリへのアクセス権を持ちます。
@@ -433,17 +433,17 @@
*注意:* GlassFishのロール名は先頭が大文字である必要があります。
-[start=7]
+
. 次の手順に従って、 ``AdminConstraint`` という名前のセキュリティ制約を作成および構成します。
1. 「セキュリティ制約を追加」をクリックします。新しいセキュリティ制約のセクションが表示されます。
2. 新しいセキュリティ制約の「表示名」に「 ``AdminConstraint`` 」と入力します。
image::images/admin-constraint.png[]
-[start=3]
+
. 「追加」をクリックします。「Webリソースを追加」ダイアログが開きます。
-[start=4]
+
.
「Webリソースを追加」ダイアログで「リソース名」に「 ``Admin`` 」、「URLパターン」に「 ``/secureAdmin/*`` 」を設定し、「OK」をクリックします。ダイアログが閉じます。
@@ -451,17 +451,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. 「認証制約を有効にする」を選択し、「編集」をクリックします。「ロール名を編集」ダイアログが開きます。
-[start=6]
+
. 「ロール名を編集」ダイアログ・ボックスで左ペインの「AdminRole」を選択して「追加」をクリックし、「OK」をクリックします。
前述の手順を完了すると、次の図に示すような結果になるはずです。
image::images/constraints.png[]
-[start=8]
+
. 次の手順に従って、 ``UserConstraint`` という名前のセキュリティ制約を作成および構成します。
1. 「セキュリティ制約を追加」をクリックして新しいセキュリティ制約を作成します。
2. 新しいセキュリティ制約の「表示名」に「 ``UserConstraint`` 」と入力します。
@@ -488,16 +488,16 @@
image::images/login-forms.png[]
-[start=6]
+
. サーバーに応じたレルム名を入力します。
* *GlassFish:* 「レルム名」に「 ``file`` 」と入力します。これは、GlassFishサーバーでユーザーを作成した場所のデフォルト・レルム名です。
* *Tomcat:* レルム名は入力しないでください。
* *WebLogic:* 自分のレルム名を入力します。デフォルト・レルムは ``myrealm`` です。
-[start=7]
+
. 「セキュリティ・ロール」ノードを展開し、「追加」をクリックしてロール名を追加します。
-[start=8]
+
. 次のセキュリティ・ロールを追加します。
|===
@@ -508,7 +508,7 @@
|UserRole |このロールに追加したユーザーは、サーバーの ``secureUser`` ディレクトリへのアクセス権を持ちます。
|===
-[start=9]
+
. 次の手順に従って、 ``AdminConstraint`` という名前のセキュリティ制約を作成および構成します。
1. 「セキュリティ制約を追加」をクリックして新しいセキュリティ制約を作成します。
2. 新しいセキュリティ制約の「表示名」に「 ``AdminConstraint`` 」と入力します。
@@ -520,17 +520,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. 「認証制約を有効にする」を選択し、「編集」をクリックします。「ロール名を編集」ダイアログが開きます。
-[start=6]
+
. 「ロール名を編集」ダイアログ・ボックスで左ペインの「AdminRole」を選択して「追加」をクリックし、「OK」をクリックします。
前述の手順を完了すると、次の図に示すような結果になるはずです。
image::images/constraints.png[]
-[start=10]
+
. 次の手順に従って、 ``UserConstraint`` という名前のセキュリティ制約を作成および構成します。
1. 「セキュリティ制約を追加」をクリックして新しいセキュリティ制約を作成します。
2. 新しいセキュリティ制約の「表示名」に「 ``UserConstraint`` 」と入力します。
@@ -559,25 +559,25 @@
*注意:* 3.1よりも古いバージョンのGlassFishサーバーでは、このファイルの名前は ``sun-web.xml`` です。
-[start=2]
+
. 「セキュリティ」タブを選択し、セキュリティ・ロールを表示します。
-[start=3]
+
. AdminRoleのセキュリティ・ロール・ノードを選択し、「セキュリティ・ロールのマッピング」ペインを開きます。
-[start=4]
+
.
「プリンシパルの追加」をクリックし、「プリンシパル名」に「 ``admin`` 」と入力します。「OK」をクリックします。
image::images/add-principal.png[]
-[start=5]
+
. UserRoleのセキュリティ・ロール・ノードを選択し、「セキュリティ・ロールのマッピング」ペインを開きます。
-[start=6]
+
. 「プリンシパルの追加」をクリックし、「プリンシパル名」に「 ``user`` 」と入力します。「OK」をクリックします。
-[start=7]
+
. ``glassfish-web.xml`` に変更を保存します。
「XML」タブをクリックして、XMLエディタで ``glassfish-web.xml`` を表示および編集することもできます。XMLエディタで ``glassfish-web.xml`` を開くと、 ``glassfish-web.xml`` に次のセキュリティ・ロールのマッピング情報があることがわかります。
@@ -624,7 +624,7 @@
</security-role-assignment>#
----
-[start=3]
+
. ``weblogic.xml`` に変更を保存します。
diff --git a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_pt_BR.asciidoc
index 813dac1..ce7e287 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_pt_BR.asciidoc
@@ -84,37 +84,37 @@
*Observação:* este tutorial mostra como configurar a segurança no descritor de implantação, mas as aplicações EE 6 e EE 7 usam anotações em vez de um descritor de implantação, por padrão.
-[start=8]
+
. Se estiver usando um GlassFish ou WebLogic Server e o NetBeans IDE 7.0.1 ou posterior, você precisará gerar um descritor específico para o servidor. Clique com o botão direito do mouse no nó do projeto e selecione Novo > Outro > GlassFish > Descritor do GlassFish ou Novo > Outro > WebLogic > Descritor do WebLogic. A caixa de diálogo Criar Descritor Específico do Servidor será aberta. Aceite todos os defaults e clique em Finalizar. O descritor específico do servidor, chamado ``glassfish-web.xml`` ou ``weblogic.xml`` , aparecerá no projeto na pasta Arquivos de Configuração.
-[start=9]
+
. Na janela Projetos do IDE, clique com o botão direito do mouse em Páginas Web e selecione Novo > Outro.
-[start=10]
+
. No assistente de Novo Arquivo, selecione Outro como Categoria e Pasta como o Tipo de Arquivo. Clique em Próximo.
-[start=11]
+
.
No assistente de Nova Pasta, chame a pasta de secureAdmin e clique em Finalizar.
A pasta secureAdmin será exibida na janela Projetos da pasta Páginas Web.
-[start=12]
+
. Repita as três últimas etapas para criar outra pasta chamada secureUser.
-[start=13]
+
. Crie um novo arquivo ``html`` na pasta secureUser, clicando com o botão direito do mouse na janela Projetos e selecionando Novo > Outros.
-[start=14]
+
. Selecione o tipo de arquivo HTML na categoria Outro. Clique em Próximo.
-[start=15]
+
. Chame o novo arquivo de pageU e clique em Finalizar.
Quando você clica em Finalizar, o arquivo ``pageU.html`` é aberto no Editor de Código-Fonte.
-[start=16]
+
. No Editor de Código-Fonte, substitua o código existente em ``pageU.html`` pelo código a seguir:[html-tag]#<html>
<head>
<title>#
@@ -130,10 +130,10 @@
</html>#
----
-[start=17]
+
. Clique com o botão direito do mouse na pasta secureAdmin e crie um novo arquivo ``html`` chamado pageA.
-[start=18]
+
. No Editor de Código-Fonte, substitua o código existente em ``pageA.html`` pelo código a seguir:[html-tag]#<html>
<head>
<title>#
@@ -163,7 +163,7 @@
<p>#Request a secure User page [jsp-html-tag]#<a# [jsp-html-argument]#href=#[jsp-xml-value]#"secureUser/pageU.html"# [jsp-html-tag]#>#here![jsp-html-tag]#</a></p>#
----
-[start=2]
+
. Salve as alterações.
@@ -187,10 +187,10 @@
</form>#
----
-[start=4]
+
. Crie um novo arquivo ``html`` chamado ``loginError.html`` na pasta Páginas Web. Trata-se de uma página de erro simples.
-[start=5]
+
. No Editor de Código-Fonte, substitua o código existente em ``loginError.html`` pelo código a seguir:[html-tag]#<html>
<head>
<title>#
@@ -224,20 +224,20 @@
*Observação: *O Servidor de Aplicações deve estar em execução antes de você acessar a Console de Administração. Para iniciar o servidor, clique com o botão direito do mouse no nó do GlassFish Server e selecione Iniciar.
-[start=2]
+
. Na Console de Administração, vá até Configurações > server-config > Segurança > Realms > Arquivo. O painel Editar Realm será aberto.
image::images/edit-realm.png[]
-[start=3]
+
. Clique no botão Gerenciar Usuários na parte superior do painel Editar Realm. O painel Usuários do Arquivo será aberto.
image::images/file-users.png[]
-[start=4]
+
. Clique em Novo. O painel Novo Usuário do Realm do Arquivo será aberto. Digite ``user`` como o ID de usuário e ``userpw01`` como a senha. Clique em OK.
-[start=5]
+
. Siga as etapas anteriores para criar um usuário chamado ``admin`` com a senha ``adminpw1`` no realm ``file`` .
@@ -264,7 +264,7 @@
<role rolename="AdminRole"/>
----
-[start=3]
+
. Adicione uma atribuição chamada ``UserRole`` .
[source,java]
@@ -273,7 +273,7 @@
<role rolename="UserRole"/>
----
-[start=4]
+
. Adicione um usuário chamado ``admin`` com a senha ``adminpw1`` e a atribuição ``AdminRole`` .
[source,java]
@@ -282,7 +282,7 @@
<user username="admin" password="adminpw1" roles="AdminRole"/>
----
-[start=5]
+
. Adicione um usuário chamado ``user`` com a senha ``userpw01`` e a atribuição ``UserRole`` .
[source,java]
@@ -329,42 +329,42 @@
*Observação: *O Servidor de Aplicações deve estar em execução antes de você acessar a Console de Administração. Para iniciar o servidor, clique com o botão direito do mouse no nó do WebLogic Server e selecione Iniciar.
-[start=2]
+
. No painel esquerdo, selecione Realms de Segurança. A página Resumo de Realms de Segurança será aberta.
-[start=3]
+
. Na página Resumo de Realms de Segurança, selecione o nome do realm (o realm default é “myrealm”). A página Definições de Nome do Realm será aberta.
-[start=4]
+
. Na página Definições de Nome do Realm, selecione Usuários e Grupos > Usuários. A tabela Usuários será exibida.
-[start=5]
+
. Na tabela Usuários, clique em Novo. A página Criar Novo Usuário será aberta.
-[start=6]
+
. Digite no nome “user” e na senha “userpw01”. Opcionalmente, digite uma descrição. Aceite o Provedor de Autenticação default.
image::images/wl-admin-newuser.png[]
-[start=7]
+
. Clique em OK. Retorne para a tabela Usuários.
-[start=8]
+
. Clique em Novo e adicione um usuário chamado “admin” e a senha “admin1”.
-[start=9]
+
. Abra a guia Grupos. A tabela Grupos será exibida.
-[start=10]
+
. Clique em Novo. A janela Criar um Novo Grupo será aberta.
-[start=11]
+
. Defina o nome do grupo como userGroup. Aceite o provedor default e clique em OK. Você retornará para a tabela Grupos.
-[start=12]
+
. Clique em Novo e crie o grupo adminGroup.
-[start=13]
+
. Abra a guia Usuários para o próximo procedimento.
Agora, adicione o usuário ``admin`` ao ``adminGroup`` e o usuário ``user`` ao ``userGroup`` .
@@ -378,13 +378,13 @@
image::images/wl-admin-usersettings.png[]
-[start=5]
+
. Clique em Salvar.
-[start=6]
+
. Retorne à guia Usuários.
-[start=7]
+
. Clique no usuário ``user`` e adicione-o ao ``userGroup`` .
@@ -414,7 +414,7 @@
*Observação: *Se você quiser usar um form, selecione Form em vez de Básico e especifique o log-in e as páginas de erro de log-in.
-[start=4]
+
. Insira um nome de realm, dependendo do seu servidor.
* *GlassFish:* Especifique ``file`` como o Nome do Realm. Este é o nome default do realm onde você criou os usuários no GlassFish Server.
* *Tomcat:* Não especifique um nome de realm.
@@ -422,10 +422,10 @@
image::images/security-roles.png[]
-[start=5]
+
. Expanda o nó Atribuições de Segurança e clique em Adicionar para adicionar um nome de atribuição.
-[start=6]
+
. Adicione as Seguintes Atribuições de Segurança:
* ``AdminRole`` . Os usuários adicionados a esta atribuição terão acesso ao diretório ``secureAdmin`` do servidor.
* ``UserRole`` . Os usuários adicionados a esta atribuição terão acesso ao diretório ``secureUser`` do servidor.
@@ -433,17 +433,17 @@
*Cuidado:* os nomes de atribuição no GlassFish devem começar com letra maiúscula.
-[start=7]
+
. Crie e configure um restrição de segurança chamada ``AdminConstraint`` , fazendo o seguinte:
1. Clique em Adicionar Restrição de Segurança. Será exibida uma seção para a nova restrição de segurança.
2. Indique ``AdminConstraint`` para o Nome de View da nova restrição de segurança.
image::images/admin-constraint.png[]
-[start=3]
+
. Clique em Add. A caixa de diálogo Adicionar Recurso da Web é aberta.
-[start=4]
+
.
Na caixa de diálogo Adicionar Recurso da Web, defina o Nome do Recurso como ``Admin`` e o Padrão de URL como ``/secureAdmin/*`` e clique em OK. A caixa de diálogo é fechada.
@@ -451,17 +451,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. Selecione Ativar Restrição de Autenticação e clique em Editar. A caixa de diálogo Editar Nomes de Atribuições será aberta.
-[start=6]
+
. Na caixa de diálogo Editar Nomes de Atribuições, selecione AdminRole no painel esquerdo, clique em Adicionar e em OK.
Depois de concluídas as etapas acima, o resultado deverá ser semelhante à figura a seguir:
image::images/constraints.png[]
-[start=8]
+
. Crie e configure uma restrição de segurança chamada ``UserConstraint`` , fazendo o seguinte:
1. Clique em Adicionar restrição de segurança para criar uma nova restrição de segurança.
2. Indique ``UserConstraint`` para o Nome de View da nova restrição de segurança.
@@ -488,16 +488,16 @@
image::images/login-forms.png[]
-[start=6]
+
. Insira um nome de realm, dependendo do seu servidor.
* *GlassFish:* Especifique ``file`` como o Nome do Realm. Este é o nome default do realm onde você criou os usuários no GlassFish Server.
* *Tomcat:* Não especifique um nome de realm.
* *WebLogic:* Especifique o nome do realm. O realm default é ``myrealm`` .
-[start=7]
+
. Expanda o nó Atribuições de Segurança e clique em Adicionar para adicionar um nome de atribuição.
-[start=8]
+
. Adicione as Seguintes Atribuições de Segurança:
|===
@@ -508,7 +508,7 @@
|UserRole |Os usuários adicionados a esta atribuição terão acesso ao diretório ``secureUser`` do servidor.
|===
-[start=9]
+
. Crie e configure um restrição de segurança chamada ``AdminConstraint`` , fazendo o seguinte:
1. Clique em Adicionar restrição de segurança para criar uma nova restrição de segurança.
2. Especifique ``AdminConstraint`` para o Nome de View da nova restrição de segurança.
@@ -520,17 +520,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. Selecione Ativar Restrição de Autenticação e clique em Editar. A caixa de diálogo Editar Nomes de Atribuições será aberta.
-[start=6]
+
. Na caixa de diálogo Editar Nomes de Atribuições, selecione AdminRole no painel esquerdo, clique em Adicionar e em OK.
Depois de concluídas as etapas acima, o resultado deverá ser semelhante à figura a seguir:
image::images/constraints.png[]
-[start=10]
+
. Crie e configure uma restrição de segurança chamada ``UserConstraint`` , fazendo o seguinte:
1. Clique em Adicionar restrição de segurança para criar uma nova restrição de segurança.
2. Indique ``UserConstraint`` para o Nome de View da nova restrição de segurança.
@@ -559,25 +559,25 @@
*Observação:* Em versões do GlassFish Server anteriores à 3.1, esse arquivo é chamado ``sun-web.xml`` .
-[start=2]
+
. Selecione a guia Segurança para revelar as atribuições de segurança.
-[start=3]
+
. Selecione o nó da atribuição de segurança AdminRole para abrir o painel Mapeamento de Atribuição de Segurança.
-[start=4]
+
.
Clique em Adicionar principal e especifique ``admin`` como o nome principal. Clique em OK.
image::images/add-principal.png[]
-[start=5]
+
. Selecione o nó da atribuição de segurança UserRole para abrir o painel Mapeamento de Atribuição de Segurança.
-[start=6]
+
. Clique em Adicionar Principal e especifique ``user`` como o nome principal. Clique em OK
-[start=7]
+
. Salve as alterações em ``glassfish-web.xml`` .
Também é possível exibir e editar o ``glassfish-web.xml`` no editor de XML clicando na guia XML. Se você abrir o ``glassfish-web.xml`` no editor XML, você verá que o ``glassfish-web.xml`` possui as seguintes informações de mapeamento de atribuição de segurança:
@@ -624,7 +624,7 @@
</security-role-assignment>#
----
-[start=3]
+
. Salve as alterações em ``weblogic.xml`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ru.asciidoc
index 81bba6d..30b751e 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_ru.asciidoc
@@ -84,37 +84,37 @@
*Примечание.* В этом учебном курсе показано, как настроить параметры безопасности в дескрипторе развертывания, но приложения EE 6 и EE 7 по умолчанию используют аннотации вместо дескриптора развертывания.
-[start=8]
+
. При использовании сервера GlassFish или WebLogic и IDE NetBeans 7.0.1 или более поздней версии необходимо создать дескриптор для этого сервера. Щелкните правой кнопкой мыши узел проекта и выберите New ("Создать") > Other ("Другое") > GlassFish > GlassFish Descriptor ("Дескриптор GlassFish"), либо New ("Создать") > Other ("Другое") > WebLogic > WebLogic Descriptor ("Дескриптор WebLogic"). Откроется диалоговое окно создание дескриптора для конкретного сервера. Примите параметры по умолчанию и нажмите кнопку "Готово". Дескриптор для конкретного сервера, именуемый ``glassfish-web.xml`` либо ``weblogic.xml`` , появится в папке Configuration Files ("Файлы настройки") проекта.
-[start=9]
+
. В окне 'Проекты' в IDE щелкните правой кнопкой мыши 'Веб-страницы' и выберите 'Создать' > 'Другое'.
-[start=10]
+
. В мастере создания новых файлов выберите Other ("Другое") в качестве категории и Folder ("Папка") в качестве типа файла. Нажмите кнопку "Далее".
-[start=11]
+
.
В мастере создания новых папок назовите папку secureAdmin и нажмите кнопку Finish ("Готово").
Папка secureAdmin появится в окне Projects ("Проекты"), в папке Web Pages ("Веб-страницы").
-[start=12]
+
. Повторите 3 предыдущих действия для создания еще одной папки, именуемой secureUser.
-[start=13]
+
. Создайте новый файл ``html`` в папке secureUser. Для этого щелкните правой кнопкой мыши папку secureUser в окне 'Проекты' и выберите Создать > Другие.
-[start=14]
+
. В категории 'Другие' выберите тип файла HTML. Нажмите кнопку "Далее".
-[start=15]
+
. Назовите новый файл pageU и нажмите кнопку Finish ("Готово").
При нажатии этой кнопки файл ``pageU.html`` откроется в редакторе файлов исходного кода.
-[start=16]
+
. В редакторе файлов исходного кода замените существующий код в файле ``pageU.html`` следующим кодом.[html-tag]#<html>
<head>
<title>#
@@ -130,10 +130,10 @@
</html>#
----
-[start=17]
+
. Щелкните правой кнопкой мыши папку secureAdmin и создайте новый файл ``html`` под названием pageA.
-[start=18]
+
. В редакторе файлов исходного кода замените существующий код в ``pageA.html`` следующим кодом.[html-tag]#<html>
<head>
<title>#
@@ -163,7 +163,7 @@
<p>#Request a secure User page [jsp-html-tag]#<a# [jsp-html-argument]#href=#[jsp-xml-value]#"secureUser/pageU.html"# [jsp-html-tag]#>#here![jsp-html-tag]#</a></p>#
----
-[start=2]
+
. Сохраните изменения.
@@ -187,10 +187,10 @@
</form>#
----
-[start=4]
+
. Создайте новый файл ``html`` под названием ``loginError.html`` в папке Web Pages ("Веб-страницы"). Это простая страница ошибки.
-[start=5]
+
. В редакторе файлов исходного кода замените существующий код в ``loginError.html`` следующим кодом.[html-tag]#<html>
<head>
<title>#
@@ -224,20 +224,20 @@
*Примечание. * До получения доступа к консоли администрирования необходимо запустить сервер приложений. Чтобы запустить сервер, щелкните правой кнопкой мыши узел сервера GlassFish и выберите 'Пуск'.
-[start=2]
+
. В консоли администрирования перейдите к Configurations ("Настройки") > server-config > Security ("Безопасность") > Realms ("Области") > File ("Файл"). Откроется панель редактирования области.
image::images/edit-realm.png[]
-[start=3]
+
. Нажмите кнопку Manage Users ("Управлять пользователями") наверху панели редактирования области. Откроется панель File Users ("Пользователи файла").
image::images/file-users.png[]
-[start=4]
+
. Нажмите кнопку New ("Создать"). Откроется панель New File Realm User ("Новый пользователь области файла"). Введите ``user`` в качестве идентификатора пользователя и ``userpw01`` в качестве пароля. Нажмите кнопку "ОК".
-[start=5]
+
. Выполните приведенные выше действия, чтобы создать пользователя ``admin`` с паролем ``adminpw1`` в области ``file`` .
@@ -264,7 +264,7 @@
<role rolename="AdminRole"/>
----
-[start=3]
+
. Добавьте роль под названием ``UserRole`` .
[source,java]
@@ -273,7 +273,7 @@
<role rolename="UserRole"/>
----
-[start=4]
+
. Добавьте пользователя с именем ``admin`` , паролем ``adminpw1`` и ролью ``AdminRole`` .
[source,java]
@@ -282,7 +282,7 @@
<user username="admin" password="adminpw1" roles="AdminRole"/>
----
-[start=5]
+
. Добавьте пользователя с именем ``user`` , паролем ``userpw01`` и ролью ``UserRole`` .
[source,java]
@@ -329,42 +329,42 @@
*Примечание. * До получения доступа к консоли администрирования необходимо запустить сервер приложений. Чтобы запустить сервер, щелкните правой кнопкой мыши узел сервера WebLogic и выберите 'Пуск'.
-[start=2]
+
. В левой панели выберите Security Realms ("Области безопасности"). Откроется страница сводки областей безопасности.
-[start=3]
+
. На этой странице выберите имя области безопасности (имя по умолчанию – "myrealm"). Откроется страница Settings for Realm Name ("Настройки имени области").
-[start=4]
+
. На этой странице выберите Users and Groups ("Пользователи и группы") > Users ("Пользователи"). Появится таблица пользователей.
-[start=5]
+
. В таблице пользователей щелкните New ("Создать"). Откроется страница создания нового пользователя.
-[start=6]
+
. Введите там имя "user" и пароль "userpw01". Если хочется, введите описание пользователя. Примите поставщика проверки подлинности по умолчанию.
image::images/wl-admin-newuser.png[]
-[start=7]
+
. Нажмите кнопку "ОК". Мы вернемся к таблице пользователей.
-[start=8]
+
. Щелкните New ("Создать") и добавьте пользователя с именем"admin" и паролем "admin1".
-[start=9]
+
. Откройте вкладку Groups ("Группы"). Появится таблица групп.
-[start=10]
+
. Нажмите кнопку New ("Создать"). Откроется окно создания новой группы.
-[start=11]
+
. Назовите группу userGroup. Примите поставщика по умолчанию и нажмите кнопку "OK". Это вернет нас к таблице групп.
-[start=12]
+
. Щелкните New ("Создать") и создайте группу adminGroup.
-[start=13]
+
. Откройте вкладку Users ("Пользователи") для следующей процедуры.
Теперь добавьте пользователя ``admin`` к ``adminGroup`` и пользователя ``user`` к ``userGroup`` .
@@ -378,13 +378,13 @@
image::images/wl-admin-usersettings.png[]
-[start=5]
+
. Нажмите кнопку "Сохранить".
-[start=6]
+
. Вернитесь на вкладку Users ("Пользователи").
-[start=7]
+
. Щелкните пользователя ``user`` и добавьте его к ``userGroup`` .
@@ -414,7 +414,7 @@
*Примечание. * Если необходимо использовать формы, выберите 'Форма', а не 'Основные' и укажите имя входа и страницы входа с ошибками.
-[start=4]
+
. Введите имя области, в зависимости от используемого сервера.
* *GlassFish:* введите ``file`` в поле Realm Name ("Имя области"). Это имя области по умолчанию при создании пользователей на сервере GlassFish.
* *Tomcat:* не вводите имя области.
@@ -422,10 +422,10 @@
image::images/security-roles.png[]
-[start=5]
+
. Разверните узел Security Roles ("Роли безопасности") и нажмите кнопку Add ("Добавить") для добавления имени роли.
-[start=6]
+
. Добавьте следующие роли безопасности:
* ``AdminRole`` . Пользователи, добавленные к этой роли, получат доступ к каталогу ``secureAdmin`` на сервере.
* ``UserRole`` . Пользователи, добавленные к этой роли, получат доступ к каталогу ``secureUser`` на сервере.
@@ -433,17 +433,17 @@
*Внимание!* Имена ролей GlassFish должны начинаться с прописной буквы.
-[start=7]
+
. Создайте и настройте ограничение безопасности под названием ``AdminConstraint`` , выполнив следующее:
1. Щелкните Add Security Constraint ("Добавить ограничение безопасности"). Появится раздел для нового ограничения безопасности.
2. Введите ``AdminConstraint`` в качестве Display Name ("Отображаемое имя") нового ограничения безопасности.
image::images/admin-constraint.png[]
-[start=3]
+
. Нажмите кнопку "Add". Откроется диалоговое окно Add Web Resource ("Добавление веб-ресурса").
-[start=4]
+
.
В этом диалоговом окне установите Resource Name ("Имя ресурса") на ``Admin`` и шаблон URL на ``/secureAdmin/*`` , после чего нажмите кнопку "OK". Диалоговое окно закроется.
@@ -451,17 +451,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. Выберите Enable Authentication Constraint ("Включить ограничение проверки подлинности") и нажмите кнопку Edit ("Изменить"). Откроется диалоговое окно изменения имен роли.
-[start=6]
+
. В этом окне выберите AdminRole на левой панели, нажмите кнопку Add ("Добавить"), затем нажмите кнопку OK.
После завершения этих действий результат должен быть подобен этому рисунку:
image::images/constraints.png[]
-[start=8]
+
. Создайте и настройте ограничение безопасности под названием ``UserConstraint`` , выполнив следующее:
1. Щелкните Add Security Constraint ("Добавить ограничение безопасности"), чтобы добавить новое ограничение безопасности.
2. Введите ``UserConstraint`` в качестве Display Name ("Отображаемое имя") нового ограничения безопасности.
@@ -488,16 +488,16 @@
image::images/login-forms.png[]
-[start=6]
+
. Введите имя области, в зависимости от используемого сервера.
* *GlassFish:* введите ``file`` в поле Realm Name ("Имя области"). Это имя области по умолчанию при создании пользователей на сервере GlassFish.
* *Tomcat:* не вводите имя области.
* *WebLogic:* введите имя своей области. Областью по умолчанию является ``myrealm`` .
-[start=7]
+
. Разверните узел Security Roles ("Роли безопасности") и нажмите кнопку Add ("Добавить") для добавления имени роли.
-[start=8]
+
. Добавьте следующие роли безопасности:
|===
@@ -508,7 +508,7 @@
|UserRole |Пользователи, добавленные к этой роли, получат доступ к каталогу ``secureUser`` на сервере.
|===
-[start=9]
+
. Создайте и настройте ограничение безопасности под названием ``AdminConstraint`` , выполнив следующее:
1. Щелкните Add Security Constraint ("Добавить ограничение безопасности"), чтобы добавить новое ограничение безопасности.
2. Введите ``AdminConstraint`` в качестве Display Name ("Отображаемое имя") нового ограничения безопасности.
@@ -520,17 +520,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. Выберите Enable Authentication Constraint ("Включить ограничение проверки подлинности") и нажмите кнопку Edit ("Изменить"). Откроется диалоговое окно изменения имен роли.
-[start=6]
+
. В этом окне выберите AdminRole на левой панели, нажмите кнопку Add ("Добавить"), затем нажмите кнопку OK.
После завершения этих действий результат должен быть подобен этому рисунку:
image::images/constraints.png[]
-[start=10]
+
. Создайте и настройте ограничение безопасности под названием ``UserConstraint`` , выполнив следующее:
1. Щелкните Add Security Constraint ("Добавить ограничение безопасности"), чтобы добавить новое ограничение безопасности.
2. Введите ``UserConstraint`` в качестве Display Name ("Отображаемое имя") нового ограничения безопасности.
@@ -559,25 +559,25 @@
*Примечание.* Для сервера GlassFish с более поздними версиями, чем 3.1, для этого файла задается имя ``sun-web.xml`` .
-[start=2]
+
. Выберите вкладку Security ("Безопасность") для раскрытия ролей безопасности.
-[start=3]
+
. Выберите узел роли безопасности AdminRole, чтобы открыть страницу Security Role Mapping ("Сопоставление ролей безопасности").
-[start=4]
+
.
Щелкните Add Principal ("Добавить участника") и введите ``admin`` в качестве имени участника. Нажмите кнопку "ОК".
image::images/add-principal.png[]
-[start=5]
+
. Выберите узел роли безопасности UserRole, чтобы открыть страницу Security Role Mapping ("Сопоставление ролей безопасности").
-[start=6]
+
. Щелкните Add Principal ("Добавить участника") и введите ``user`` в качестве имени участника. Нажмите кнопку "OK".
-[start=7]
+
. Сохраните изменения в ``glassfish-web.xml`` .
``glassfish-web.xml`` также можно просматривать и редактировать в редакторе XML, щелкнув вкладку XML. Если открыть ``glassfish-web.xml`` в редакторе XML, то можно будет увидеть, что ``glassfish-web.xml`` содержит следующую информацию о сопоставлении ролей безопасности:
@@ -624,7 +624,7 @@
</security-role-assignment>#
----
-[start=3]
+
. Сохраните изменения в ``weblogic.xml`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_zh_CN.asciidoc
index 2cd2b99..b40b5f8 100644
--- a/netbeans.apache.org/src/content/kb/docs/web/security-webapps_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/web/security-webapps_zh_CN.asciidoc
@@ -84,37 +84,37 @@
*注:*本教程介绍了如何在部署描述符中配置安全功能,但 EE 6 和 EE 7 应用程序默认使用标注,而不是部署描述符。
-[start=8]
+
. 如果使用 GlassFish 或 WebLogic Server 以及 NetBeans IDE 7.0.1 或更高版本,则需生成特定于服务器的描述符。右键单击项目的节点并选择 "New"(新建)> "Other"(其他)> "GlassFish" > "GlassFish Descriptor"(GlassFish 描述符),或选择 "New"(新建)> "Other"(其他)> "WebLogic" > "WebLogic Descriptor"(WebLogic 描述符)。"Create Server-Specific Descriptor"(创建特定于服务器的描述符)对话框将会打开。接受所有默认值,然后单击 "Finish"(完成)。特定于服务器的描述符(名为 ``glassfish-web.xml`` 或 ``weblogic.xml`` )将出现在项目中的 "Configuration Files"(配置文件)文件夹中。
-[start=9]
+
. 在 IDE 的 "Projects"(项目)窗口中,右键单击 "Web Pages"(Web 页),然后选择 "New"(新建)> "Other"(其他)。
-[start=10]
+
. 在新建文件向导中,选择 "Other"(其他)作为类别,选择 "Folder"(文件夹)作为文件类型。单击 "Next"(下一步)。
-[start=11]
+
.
在新建文件夹向导中,将文件夹命名为 "secureAdmin",然后单击 "Finish"(完成)。
secureAdmin 文件夹将显示在 "Projects"(项目)窗口的 "Web Pages"(Web 页)文件夹中。
-[start=12]
+
. 重复前面的 3 个步骤,以创建另一个名为 secureUser 的文件夹。
-[start=13]
+
. 在 secureUser 文件夹中创建一个新的 ``html`` 文件,方法是在 "Projects"(项目)窗口中右键单击 secureUser 文件夹,然后选择 "New"(新建)> "Other"(其他)。
-[start=14]
+
. 在 "Other"(其他)类别中选择 "HTML" 文件类型。单击 "Next"(下一步)。
-[start=15]
+
. 将新文件命名为 "pageU",然后单击 "Finish"(完成)。
单击 "Finish"(完成),此时将在源代码编辑器中打开 ``pageU.html`` 文件。
-[start=16]
+
. 在源代码编辑器中,将 ``pageU.html`` 中的现有代码替换为以下代码。[html-tag]#<html>
<head>
<title>#
@@ -130,10 +130,10 @@
</html>#
----
-[start=17]
+
. 右键单击 secureAdmin 文件夹并创建一个新的名为 pageA 的 ``html`` 文件。
-[start=18]
+
. 在源代码编辑器中,将 ``pageA.html`` 中的现有代码替换为以下代码。[html-tag]#<html>
<head>
<title>#
@@ -163,7 +163,7 @@
<p>#Request a secure User page [jsp-html-tag]#<a# [jsp-html-argument]#href=#[jsp-xml-value]#"secureUser/pageU.html"# [jsp-html-tag]#>#here![jsp-html-tag]#</a></p>#
----
-[start=2]
+
. 保存所做的更改。
@@ -187,10 +187,10 @@
</form>#
----
-[start=4]
+
. 在 "Web Pages"(Web 页)文件夹中创建一个新的名为 ``loginError.html`` 的 ``html`` 文件。这是一个简单的错误页。
-[start=5]
+
. 在源代码编辑器中,将 ``loginError.html`` 中的现有代码替换为以下代码。[html-tag]#<html>
<head>
<title>#
@@ -224,20 +224,20 @@
*注:*必须运行应用服务器才能访问管理控制台。要启动服务器,请右键单击 GlassFish Server 节点并选择 "Start"(启动)。
-[start=2]
+
. 在 "Admin Console"(管理控制台)中,导航至 "Configurations"(配置)> "server-config" > "Security"(安全性)> "Realms"(领域)> "File"(文件)。"Edit Realm"(编辑领域)面板将会打开。
image::images/edit-realm.png[]
-[start=3]
+
. 单击 "Edit Realm"(编辑领域)面板顶部的 "Manage Users"(管理用户)按钮。将打开 "File Users"(文件用户)面板。
image::images/file-users.png[]
-[start=4]
+
. 单击 "New"(新建)。将打开 "New File Realm User"(新建文件领域用户)面板。键入 ``user`` 作为用户 ID,键入 ``userpw01`` 作为口令。单击 "OK"(确定)。
-[start=5]
+
. 按照前面的步骤在 ``file`` 领域中创建名为 ``admin`` 、口令为 ``adminpw1`` 的用户。
@@ -264,7 +264,7 @@
<role rolename="AdminRole"/>
----
-[start=3]
+
. 添加一个名为 ``UserRole`` 的角色。
[source,java]
@@ -273,7 +273,7 @@
<role rolename="UserRole"/>
----
-[start=4]
+
. 添加一个名为 ``admin`` 并具有 ``adminpw1`` 口令和 ``AdminRole`` 角色的用户。
[source,java]
@@ -282,7 +282,7 @@
<user username="admin" password="adminpw1" roles="AdminRole"/>
----
-[start=5]
+
. 添加一个名为 ``user`` 并具有 ``userpw01`` 口令和 ``UserRole`` 角色的用户。
[source,java]
@@ -329,42 +329,42 @@
*注:*必须运行应用服务器才能访问管理控制台。要启动服务器,请右键单击 WebLogic Server 节点并选择 "Start"(启动)。
-[start=2]
+
. 在左面板中,选择 "Security Realms"(安全领域)。"Summary of Security Realms"(安全领域概要)页将会打开。
-[start=3]
+
. 在 "Summary of Security Realms"(安全领域概要)页中,选择领域的名称(默认领域为 "myrealm")。"Settings for Realm Name"(领域名称设置)页将会打开。
-[start=4]
+
. 在 "Settings for Realm Name"(领域名称设置)页中,选择 "Users and Groups"(用户和组)> "Users"(用户)。将显示 "Users"(用户)表。
-[start=5]
+
. 在 "Users"(用户)表中,单击 "New"(新建)。"Create New User"(创建新用户)页将会打开。
-[start=6]
+
. 键入名称 "user" 和口令 "userpw01"。还可以键入说明。接受默认的 "Authentication Provider"(验证提供器)。
image::images/wl-admin-newuser.png[]
-[start=7]
+
. 单击 "OK"(确定)。您将返回到 "Users"(用户)表。
-[start=8]
+
. 单击 "New"(新建)并添加一个具有名称 "admin" 和口令 "admin1" 的用户。
-[start=9]
+
. 打开 "Groups"(组)标签。将显示 "Groups"(组)表。
-[start=10]
+
. 单击 "New"(新建)。"Create a New Group"(创建新组)窗口将会打开。
-[start=11]
+
. 将组命名为 userGroup。接受默认提供器并单击 "OK"(确定)。您将返回到 "Groups"(组)表。
-[start=12]
+
. 单击 "New"(新建)并创建组 adminGroup。
-[start=13]
+
. 为下一过程打开 "Users"(用户)标签。
现在,将 ``admin`` 用户添加至 ``adminGroup`` ,并将 ``user`` 用户添加至 ``userGroup`` 。
@@ -378,13 +378,13 @@
image::images/wl-admin-usersettings.png[]
-[start=5]
+
. 单击 "Save"(保存)。
-[start=6]
+
. 返回到 "Users"(用户)标签。
-[start=7]
+
. 单击 ``user`` 用户并将其添加至 ``userGroup`` 。
@@ -414,7 +414,7 @@
*注:*如果希望使用窗体,请选择 "Form"(窗体)而不是 "basic"(基本),并指定登录页和登录错误页。
-[start=4]
+
. 根据服务器输入领域名称。
* *GlassFish:*输入 ``file`` 作为领域名称。这是在 GlassFish Server 上创建用户所在的默认领域名称。
* *Tomcat:*请勿输入领域名称。
@@ -422,10 +422,10 @@
image::images/security-roles.png[]
-[start=5]
+
. 展开 "Security Roles "(安全角色)节点,然后单击 "Add"(添加)可添加角色名称。
-[start=6]
+
. 添加以下安全角色:
* ``AdminRole`` 。添加到此角色的用户将有权访问服务器的 ``secureAdmin`` 目录。
* ``UserRole`` 。添加到此角色的用户将有权访问服务器的 ``secureUser`` 目录。
@@ -433,17 +433,17 @@
*注:*GlassFish 角色名称必须以大写字母开头。
-[start=7]
+
. 通过执行以下操作,创建和配置名为 ``AdminConstraint`` 的安全约束:
1. 单击 "Add Security Constraint"(添加安全约束)。将显示新安全约束部分。
2. 输入 ``AdminConstraint`` 作为新安全约束的显示名称。
image::images/admin-constraint.png[]
-[start=3]
+
. 单击 "ADD"(添加)。将打开 "Add Web Resource"(增加 Web 资源)对话框。
-[start=4]
+
.
在 "Add Web Resource"(增加 Web 资源)对话框中,将 "Resource Name"(资源名称)设置为 ``Admin`` ,将 "URL Pattern"(URL 模式)设置为 ``/secureAdmin/*`` ,然后单击 "OK"(确定)。对话框将关闭。
@@ -451,17 +451,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. 选中 "Enable Authentication Constraint"(启用验证约束),然后单击 "Edit"(编辑)。"Edit Role Names"(编辑角色名称)对话框将会打开。
-[start=6]
+
. 在 "Edit Role Names"(编辑角色名称)对话框中,在左窗格中选择 AdminRole,单击 "Add"(添加),然后单击 "OK"(确定)。
在完成上述步骤之后,结果应如下图所示:
image::images/constraints.png[]
-[start=8]
+
. 通过执行以下操作,创建和配置名为 ``UserConstraint`` 的安全约束:
1. 单击 "Add Security Constraint"(添加安全约束),创建新的安全约束。
2. 输入 ``UserConstraint`` 作为新安全约束的显示名称。
@@ -488,16 +488,16 @@
image::images/login-forms.png[]
-[start=6]
+
. 根据服务器输入领域名称。
* *GlassFish:*输入 ``file`` 作为领域名称。这是在 GlassFish Server 上创建用户所在的默认领域名称。
* *Tomcat:*请勿输入领域名称。
* *WebLogic:*输入您的领域名称。默认领域是 ``myrealm`` 。
-[start=7]
+
. 展开 "Security Roles "(安全角色)节点,然后单击 "Add"(添加)可添加角色名称。
-[start=8]
+
. 添加以下安全角色:
|===
@@ -508,7 +508,7 @@
|UserRole |添加到此角色的用户将有权访问服务器的 ``secureUser`` 目录。
|===
-[start=9]
+
. 通过执行以下操作,创建和配置名为 ``AdminConstraint`` 的安全约束:
1. 单击 "Add Security Constraint"(添加安全约束),创建新的安全约束。
2. 输入 ``AdminConstraint`` 作为新安全约束的显示名称。
@@ -520,17 +520,17 @@
image::images/addwebresource.png[]
-[start=5]
+
. 选中 "Enable Authentication Constraint"(启用验证约束),然后单击 "Edit"(编辑)。"Edit Role Names"(编辑角色名称)对话框将会打开。
-[start=6]
+
. 在 "Edit Role Names"(编辑角色名称)对话框中,在左窗格中选择 AdminRole,单击 "Add"(添加),然后单击 "OK"(确定)。
在完成上述步骤之后,结果应如下图所示:
image::images/constraints.png[]
-[start=10]
+
. 通过执行以下操作,创建和配置名为 ``UserConstraint`` 的安全约束:
1. 单击 "Add Security Constraint"(添加安全约束),创建新的安全约束。
2. 输入 ``UserConstraint`` 作为新安全约束的显示名称。
@@ -559,25 +559,25 @@
*注:*对于早于 3.1 的 GlassFish Server 版本,此文件名为 ``sun-web.xml`` 。
-[start=2]
+
. 选择 "Security"(安全)标签以显示安全角色。
-[start=3]
+
. 选择 AdminRole 安全角色节点以打开 "Security Role Mapping"(安全角色映射)窗格。
-[start=4]
+
.
单击 "Add Principal"(添加主用户),并为主用户名称输入 ``admin`` 。单击 "OK"(确定)。
image::images/add-principal.png[]
-[start=5]
+
. 选择 UserRole 安全角色节点以打开 "Security Role Mapping"(安全角色映射)窗格。
-[start=6]
+
. 单击 "Add Principal"(添加主用户),并为主用户名称输入 ``user`` 。单击 "OK"(确定)。
-[start=7]
+
. 将更改保存到 ``glassfish-web.xml`` 。
此外,也可以通过单击 "XML" 标签,在 XML 编辑器中查看和编辑 ``glassfish-web.xml`` 。如果在 XML 编辑器中打开 ``glassfish-web.xml`` ,则可以看到 ``glassfish-web.xml`` 具有以下安全角色映射信息:
@@ -624,7 +624,7 @@
</security-role-assignment>#
----
-[start=3]
+
. 将更改保存到 ``weblogic.xml`` 。
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted.asciidoc
index b0940b3..b3fdfd9 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted.asciidoc
@@ -36,22 +36,7 @@
To watch a screencast that demonstrates deploying a Cordova application to the Android emulator, see link:../web/html5-cordova-screencast.html[+Video of Getting Started with Cordova Development+].
-=== Contents
-
-image::images/netbeans-stamp.png[title="Content on this page applies to the NetBeans IDE 7.3"]
-
-* <<installcordova,Installing Cordova>>
-* <<createproject,Creating a Cordova HTML5 Project>>
-* <<editapp,Modifying the Source Code>>
-* <<edithtml,Editing the HTML File>>
-* <<editconfig,Modifying the Cordova Configuration>>
-* <<editjs,Editing the JavaScript File>>
-* <<debug,Debugging the Application>>
-* <<summary,Summary>>
-* <<seealso,See Also>>
-
-
-==== To complete this tutorial, you will need the following resources.
+== To complete this tutorial, you will need the following resources.
|===
|Software or Resource |Version Required
@@ -87,8 +72,12 @@
You can download the installer from the link:http://nodejs.org[+Node.js site+].
-2. Open a terminal window.
-3. Run the following command to confirm that Node.js is installed.
+
+[start=2]
+. Open a terminal window.
+
+[start=3]
+. Run the following command to confirm that Node.js is installed.
[source,shell]
----
@@ -118,7 +107,9 @@
$ npm config list
----
* For additional information about configuring node.js, see link:https://npmjs.org/doc/config.html[+https://npmjs.org/doc/config.html+].
-4. Run the following command to install Cordova.
+
+[start=4]
+. Run the following command to install Cordova.
[source,shell]
----
@@ -136,7 +127,9 @@
$ npm update -g cordova
----
-5. Run the following command to confirm that Cordova is installed and to view the version.
+
+[start=5]
+. Run the following command to confirm that Cordova is installed and to view the version.
[source,shell]
----
@@ -146,13 +139,17 @@
If Cordova is installed you will see a version printed in the terminal window.
-6. Download and install the Git version control system, if not already installed.
+
+[start=6]
+. Download and install the Git version control system, if not already installed.
You can download the installer from the link:http://git-scm.com/[+Git site+].
*Note.* You need to add Git to your Path environment.
-7. Run the following command to confirm that Git is installed.
+
+[start=7]
+. Run the following command to confirm that Git is installed.
[source,shell]
----
@@ -195,13 +192,19 @@
1. Select File > New Project (Ctrl-Shift-N; ⌘-Shift-N on Mac) in the main menu to open the New Project wizard.
2. Select the *HTML5* category and then select *Cordova Application*. Click Next.
image::images/cordova-newproject-wizard1.png[title="Cordova Application template in the New Project wizard"]
-3. Type *CordovaMapApp* for the Project Name and specify the directory on your computer where you want to save the project. Click Next.
-4. In Step 3. Site Template, confirm that Download Online Template is selected and that the Cordova Hello World template is selected in the list. Click Next.
+
+[start=3]
+. Type *CordovaMapApp* for the Project Name and specify the directory on your computer where you want to save the project. Click Next.
+
+[start=4]
+. In Step 3. Site Template, confirm that Download Online Template is selected and that the Cordova Hello World template is selected in the list. Click Next.
image::images/cordova-newproject-wizard2.png[title="Site Templates panel in the New HTML5 Application wizard"]
*Note:* You must be online to create a project that is based on one of the online templates in the list.
-5. In Step 4. JavaScript Files, select the ``jquery`` and ``jquery-mobile`` JavaScript libraries in the Available pane and click the right-arrow button ( > ) to move the selected libraries to the Selected pane of the wizard. By default the libraries are created in the ``js/libraries`` folder of the project. For this tutorial you will use the "minified" versions of the JavaScript libraries.
+
+[start=5]
+. In Step 4. JavaScript Files, select the ``jquery`` and ``jquery-mobile`` JavaScript libraries in the Available pane and click the right-arrow button ( > ) to move the selected libraries to the Selected pane of the wizard. By default the libraries are created in the ``js/libraries`` folder of the project. For this tutorial you will use the "minified" versions of the JavaScript libraries.
You can use the text field in the panel to filter the list of JavaScript libraries. For example, type *jq* in the field to help you find the ``jquery`` libraries. You can Ctrl-click the names of the libraries to select multiple libraries.
@@ -211,7 +214,9 @@
* You can click on the library version number in the Version column to open a popup window that enables you to select older versions of the library. By default the wizard displays the most recent version.
* The minimized versions of the JavaScript libraries are compressed versions and the code is not comprehensible when viewed in an editor.
-6. In Step 5. Cordova Support, use the default values. Click *Finish* to complete the wizard.
+
+[start=6]
+. In Step 5. Cordova Support, use the default values. Click *Finish* to complete the wizard.
When you click Finish the IDE creates the project and displays a node for the project in the Projects window and opens the ``index.html`` file in the editor.
@@ -223,9 +228,13 @@
You can now test that your project runs and is deployed to the emulator for your target mobile device.
-7. Click the browser select icon in the toolbar and confirm that your target mobile device emulator is selected in the Cordova column in the table. In the Cordova column you can select the Android Emulator or iOS Simulator (requires OS X and XCode).
+
+[start=7]
+. Click the browser select icon in the toolbar and confirm that your target mobile device emulator is selected in the Cordova column in the table. In the Cordova column you can select the Android Emulator or iOS Simulator (requires OS X and XCode).
image::images/cordova-select-browser.png[title="Browser selected in dropdown list in toolbar"]
-8. Click the Run icon in the toolbar.
+
+[start=8]
+. Click the Run icon in the toolbar.
When you choose Run the IDE deploys the Cordova application to the emulator.
@@ -247,7 +256,9 @@
In the editor you can see that the IDE generated some code based on the Cordova Hello World template.
-2. In the editor, add references to the jQuery JavaScript libraries and CSS files that you added when you created the project. Add the following code (in *bold*) between the opening and closing ``<head>`` tags.
+
+[start=2]
+. In the editor, add references to the jQuery JavaScript libraries and CSS files that you added when you created the project. Add the following code (in *bold*) between the opening and closing ``<head>`` tags.
[source,xml]
----
@@ -272,7 +283,9 @@
You can see the path to the files in the Projects window and you can use the code completion in the editor to help you.
image::images/cordova-code-completion.png[title="Code completion in the editor"]
-3. Add the following link to the Google Maps JavaScript API between the `<head>` tags.
+
+[start=3]
+. Add the following link to the Google Maps JavaScript API between the `<head>` tags.
[source,xml]
----
@@ -282,7 +295,9 @@
*Note.* This is a link to the deprecated v2 of the JavaScript API. This JavaScript will work for the purpose of demonstration in this tutorial but you should use the newer version in a real application.
-4. Remove all the code between the `<body>` tags except for the following links to the `index.js` and `cordova.js` JavaScript files.
+
+[start=4]
+. Remove all the code between the `<body>` tags except for the following links to the `index.js` and `cordova.js` JavaScript files.
[source,xml]
----
@@ -300,7 +315,9 @@
The `cordova.js` is not visible in the Projects window because it is generated when you build the Cordova application.
-5. Add the following code (in *bold*) between the ``body`` tags.
+
+[start=5]
+. Add the following code (in *bold*) between the ``body`` tags.
[source,html]
----
@@ -349,7 +366,9 @@
You can use the Application tab to view and edit the Cordova configuration details about the application that are specified in `config.xml`.
-3. Click the Plugins tab in the Cordova panel.
+
+[start=3]
+. Click the Plugins tab in the Cordova panel.
The Plugins tab contains two panes. The Available pane displays a list of the Cordova plugins that are currently available.
@@ -357,7 +376,9 @@
*Note.* You can also edit the plugins that are installed by editing the `nbproject/plugins.properties` file in the editor.
-4. Remove all plugins except Device API, Dialogs (Notifications) and Geolocation. Click OK.
+
+[start=4]
+. Remove all plugins except Device API, Dialogs (Notifications) and Geolocation. Click OK.
image::images/cordova-properties-plugins.png[title="Cordova Plugins tab in the Project Properties window"]
@@ -369,7 +390,9 @@
The IDE generated some boilerplate code in `index.js` when you created the project. For this application you can remove all the generated code.
-2. Replace the generated code with the following code. Save your changes.
+
+[start=2]
+. Replace the generated code with the following code. Save your changes.
[source,java]
----
@@ -458,8 +481,12 @@
*Note.* For this tutorial the call to the `onDeviceReady` method is commented out because the method is not necessary when you are deploying the application to a mobile device emulator. If you want to run the application in a web browser you should uncomment the call to the `onDeviceReady` method.
-3. Reset your emulator by either restarting the emulator or resetting the settings.
-4. Click Run in the toolbar to deploy the application to the emulator.
+
+[start=3]
+. Reset your emulator by either restarting the emulator or resetting the settings.
+
+[start=4]
+. Click Run in the toolbar to deploy the application to the emulator.
On the iOS Simulator you are prompted to allow the application to use your current location.
@@ -487,7 +514,9 @@
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
----
-4. Click Run in the toolbar to run the application again.
+
+[start=4]
+. Click Run in the toolbar to run the application again.
When you run the application the debugger will hit the breakpoint when the application tries to determine your current location.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ja.asciidoc
index 8e0618d..d8fb8ac 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ja.asciidoc
@@ -36,22 +36,7 @@
CordovaアプリケーションをAndroidエミュレータにデプロイする方法を紹介するスクリーンキャストを視聴するには、link:../web/html5-cordova-screencast.html[+Cordova開発入門のビデオ+]を参照してください。
-=== 内容
-
-image::images/netbeans-stamp.png[title="このページの内容は、NetBeans IDE 7.3に適用されます"]
-
-* <<installcordova,Cordovaのインストール>>
-* <<createproject,Cordova HTML5プロジェクトの作成>>
-* <<editapp,ソース・コードの変更>>
-* <<edithtml,HTMLファイルの編集>>
-* <<editconfig,Cordova構成の変更>>
-* <<editjs,JavaScriptファイルの編集>>
-* <<debug,アプリケーションのデバッグ>>
-* <<summary,サマリー>>
-* <<seealso,関連項目>>
-
-
-==== このチュートリアルを完了するには、次のリソースが必要です。
+== このチュートリアルを完了するには、次のリソースが必要です。
|===
|ソフトウェアまたはリソース |必須バージョン
@@ -87,8 +72,12 @@
link:http://nodejs.org[+Node.jsサイト+]からインストーラをダウンロードできます。
-2. ターミナル・ウィンドウを開きます。
-3. 次のコマンドを実行して、Node.jsがインストールされていることを確認します。
+
+[start=2]
+. ターミナル・ウィンドウを開きます。
+
+[start=3]
+. 次のコマンドを実行して、Node.jsがインストールされていることを確認します。
[source,shell]
----
@@ -118,7 +107,9 @@
$ npm config list
----
* node.jsの構成の詳細は、link:https://npmjs.org/doc/config.html[+https://npmjs.org/doc/config.html+]を参照してください。
-4. 次のコマンドを実行して、Cordovaをインストールします。
+
+[start=4]
+. 次のコマンドを実行して、Cordovaをインストールします。
[source,shell]
----
@@ -136,7 +127,9 @@
$ npm update -g cordova
----
-5. 次のコマンドを実行して、Cordovaがインストールされていることを確認し、バージョンを表示します。
+
+[start=5]
+. 次のコマンドを実行して、Cordovaがインストールされていることを確認し、バージョンを表示します。
[source,shell]
----
@@ -146,13 +139,17 @@
Cordovaがインストールされている場合、ターミナル・ウィンドウにバージョンが出力されます。
-6. Gitバージョン管理システムがまだインストールされていない場合、ダウンロードしてインストールします。
+
+[start=6]
+. Gitバージョン管理システムがまだインストールされていない場合、ダウンロードしてインストールします。
link:http://git-scm.com/[+Gitサイト+]からインストーラをダウンロードできます。
*注意:*Path環境にGitを追加する必要があります。
-7. 次のコマンドを実行して、Gitがインストールされていることを確認します。
+
+[start=7]
+. 次のコマンドを実行して、Gitがインストールされていることを確認します。
[source,shell]
----
@@ -195,13 +192,19 @@
1. メイン・メニューで「ファイル」→「新規プロジェクト」([Ctrl]-[Shift]-[N]、Macの場合は[⌘]-[Shift]-[N])を選択して新規プロジェクト・ウィザードを開きます。
2. *HTML5*カテゴリを選択し、*「Cordovaアプリケーション」*を選択します。「次」をクリックします。
image::images/cordova-newproject-wizard1.png[title="新規プロジェクト・ウィザードのCordovaアプリケーション・テンプレート"]
-3. 「プロジェクト名」に*「CordovaMapApp」*と入力し、プロジェクトを保存するコンピュータ上のディレクトリを指定します。「次」をクリックします。
-4. 手順3の「サイト・テンプレート」で「オンライン・テンプレートをダウンロード」が選択され、リストで「CordovaのHello World」が選択されていることを確認します。「次」をクリックします。
+
+[start=3]
+. 「プロジェクト名」に*「CordovaMapApp」*と入力し、プロジェクトを保存するコンピュータ上のディレクトリを指定します。「次」をクリックします。
+
+[start=4]
+. 手順3の「サイト・テンプレート」で「オンライン・テンプレートをダウンロード」が選択され、リストで「CordovaのHello World」が選択されていることを確認します。「次」をクリックします。
image::images/cordova-newproject-wizard2.png[title="新規HTML5アプリケーション・ウィザードの「サイト・テンプレート」パネル"]
*注意:* リストのオンライン・テンプレートの1つに基づくプロジェクトを作成するにはオンラインになっている必要があります。
-5. 手順4の「JavaScriptファイル」では、「使用可能」ペインで ``jquery`` および ``jquery-mobile`` JavaScriptライブラリを選択し、右矢印ボタン( > )をクリックして、選択したライブラリをウィザードの「選択済」ペインに移動します。デフォルトでは、ライブラリはプロジェクトの「 ``js/libraries`` 」フォルダに作成されます。このチュートリアルでは、「縮小」バージョンのJavaScriptライブラリを使用します。
+
+[start=5]
+. 手順4の「JavaScriptファイル」では、「使用可能」ペインで ``jquery`` および ``jquery-mobile`` JavaScriptライブラリを選択し、右矢印ボタン( > )をクリックして、選択したライブラリをウィザードの「選択済」ペインに移動します。デフォルトでは、ライブラリはプロジェクトの「 ``js/libraries`` 」フォルダに作成されます。このチュートリアルでは、「縮小」バージョンのJavaScriptライブラリを使用します。
パネルのテキスト・フィールドを使用して、JavaScriptライブラリのリストをフィルタできます。たとえば、フィールドに*「jq」*と入力して、 ``jquery`` ライブラリを探します。[Ctrl]を押しながらライブラリの名前をクリックして、複数のライブラリを選択できます。
@@ -211,7 +214,9 @@
* 「バージョン」列でライブラリのバージョン番号をクリックして、旧バージョンのライブラリを選択できるポップアップ・ウィンドウを開くことができます。デフォルトでは、ウィザードには最新バージョンが表示されます。
* JavaScriptライブラリの最小バージョンは、圧縮されたバージョンであり、エディタで表示するとコードは包括的に表示されません。
-6. 手順5の「Cordovaサポート」ではデフォルト値を使用します。*「終了」*をクリックすると、ウィザードが完了します。
+
+[start=6]
+. 手順5の「Cordovaサポート」ではデフォルト値を使用します。*「終了」*をクリックすると、ウィザードが完了します。
「終了」をクリックすると、IDEによりプロジェクトが作成され、「プロジェクト」ウィンドウにプロジェクトのノードが表示され、エディタに ``index.html`` ファイルが開かれます。
@@ -223,9 +228,13 @@
これで、プロジェクトが実行され、ターゲット・モバイル・デバイスのエミュレータにデプロイされていることをテストできます。
-7. ツールバーのブラウザ選択アイコンをクリックし、表の「Cordova」列でターゲット・モバイル・デバイス・エミュレータが選択されていることを確認します。「Cordova」列では、「Androidエミュレータ」または「iOSシミュレータ」を選択できます(OS XおよびXCodeが必要)。
+
+[start=7]
+. ツールバーのブラウザ選択アイコンをクリックし、表の「Cordova」列でターゲット・モバイル・デバイス・エミュレータが選択されていることを確認します。「Cordova」列では、「Androidエミュレータ」または「iOSシミュレータ」を選択できます(OS XおよびXCodeが必要)。
image::images/cordova-select-browser.png[title="ツールバーのドロップダウン・リストで選択されたブラウザ"]
-8. ツールバーの「実行」アイコンをクリックします。
+
+[start=8]
+. ツールバーの「実行」アイコンをクリックします。
「実行」を選択すると、IDEでCordovaアプリケーションがエミュレータにデプロイされます。
@@ -247,7 +256,9 @@
エディタで、IDEにより「CordovaのHello World」テンプレートに基づいていくつかのコードが生成されたことを確認できます。
-2. エディタで、プロジェクトの作成時に追加したjQuery JavaScriptライブラリとCSSファイルへの参照を追加します。開始および終了 ``<head>`` タグの間に次のコード(*太字*)を追加します。
+
+[start=2]
+. エディタで、プロジェクトの作成時に追加したjQuery JavaScriptライブラリとCSSファイルへの参照を追加します。開始および終了 ``<head>`` タグの間に次のコード(*太字*)を追加します。
[source,xml]
----
@@ -272,7 +283,9 @@
「プロジェクト」ウィンドウでファイルへのパスを確認できます。また、エディタでコード補完を使用できます。
image::images/cordova-code-completion.png[title="エディタでのコード補完"]
-3. Google Maps JavaScript APIへの次のリンクを、`<head>`タグの間に追加します。
+
+[start=3]
+. Google Maps JavaScript APIへの次のリンクを、`<head>`タグの間に追加します。
[source,xml]
----
@@ -282,7 +295,9 @@
*注意:*これは、非推奨になったJavaScript API v2へのリンクです。このチュートリアルではデモ目的でこのJavaScriptを使用していますが、実際のアプリケーションでは最新バージョンを使用する必要があります。
-4. `index.js`および`cordova.js` JavaScriptファイルへの次のリンクを除いて、`<body>`タグの間のすべてのコードを削除します。
+
+[start=4]
+. `index.js`および`cordova.js` JavaScriptファイルへの次のリンクを除いて、`<body>`タグの間のすべてのコードを削除します。
[source,xml]
----
@@ -300,7 +315,9 @@
`cordova.js`はCordovaアプリケーションのビルド時に生成されるため、「プロジェクト」ウィンドウには表示されません。
-5. ``body`` タグの間に次のコード(*太字*)を追加します。
+
+[start=5]
+. ``body`` タグの間に次のコード(*太字*)を追加します。
[source,html]
----
@@ -349,7 +366,9 @@
「アプリケーション」タブを使用して、`config.xml`で指定されたアプリケーションのCordova構成詳細を表示および編集できます。
-3. 「Cordova」パネルで「プラグイン」タブをクリックします。
+
+[start=3]
+. 「Cordova」パネルで「プラグイン」タブをクリックします。
「プラグイン」タブには2つのペインがあります。「使用可能」ペインには、現在使用可能なCordovaプラグインのリストが表示されます。
@@ -357,7 +376,9 @@
*注意:*エディタで`nbproject/plugins.properties`ファイルを編集して、インストールされているプラグインを編集することもできます。
-4. Device API、Dialogs (Notifications)およびGeolocation以外のすべてのプラグインを削除します。「OK」をクリックします。
+
+[start=4]
+. Device API、Dialogs (Notifications)およびGeolocation以外のすべてのプラグインを削除します。「OK」をクリックします。
image::images/cordova-properties-plugins.png[title="「プロジェクト・プロパティ」ウィンドウの「Cordovaプラグイン」タブ"]
@@ -369,7 +390,9 @@
プロジェクトの作成時に、IDEで`index.js`にいくつかのボイラープレート・コードが生成されました。このアプリケーションでは、生成されたすべてのコードを削除できます。
-2. 生成されたコードを次のコードに置き換えます。変更を保存します。
+
+[start=2]
+. 生成されたコードを次のコードに置き換えます。変更を保存します。
[source,java]
----
@@ -458,8 +481,12 @@
*注意:*このチュートリアルでは、`onDeviceReady`メソッドの呼出しはコメントにされます。アプリケーションをモバイル・デバイス・エミュレータにデプロイする際に、このメソッドは不要であるためです。アプリケーションをWebブラウザで実行する場合は、`onDeviceReady`メソッドの呼出しをコメント解除する必要があります。
-3. エミュレータを再起動するか設定をリセットして、エミュレータをリセットします。
-4. ツールバーで「実行」をクリックして、アプリケーションをエミュレータにデプロイします。
+
+[start=3]
+. エミュレータを再起動するか設定をリセットして、エミュレータをリセットします。
+
+[start=4]
+. ツールバーで「実行」をクリックして、アプリケーションをエミュレータにデプロイします。
iOSシミュレータで、アプリケーションが現在の場所を使用することを許可するよう求めるメッセージが表示されます。
@@ -487,7 +514,9 @@
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
----
-4. ツールバーの「実行」をクリックして、アプリケーションを再度実行します。
+
+[start=4]
+. ツールバーの「実行」をクリックして、アプリケーションを再度実行します。
アプリケーションを実行すると、アプリケーションが現在の場所を特定しようとしたときに、デバッガでブレークポイントにヒットします。
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_pt_BR.asciidoc
index 02a7dad..c966679 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_pt_BR.asciidoc
@@ -37,11 +37,7 @@
-image::images/netbeans-stamp.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.3"]
-
-
-
-==== Para concluir este tutorial, você precisará dos recursos a seguir:
+== Para concluir este tutorial, você precisará dos recursos a seguir:
|===
|Software ou Recurso |Versão Necessária
@@ -77,8 +73,12 @@
Você pode fazer o download do instalador no link:http://nodejs.org[+site do Node.js+].
-2. Abra uma janela de terminal.
-3. Execute o comando a seguir para confirmar se o Node.js está instalado.
+
+[start=2]
+. Abra uma janela de terminal.
+
+[start=3]
+. Execute o comando a seguir para confirmar se o Node.js está instalado.
[source,shell]
----
@@ -108,7 +108,9 @@
$ npm config list
----
* Para obter informações adicionais sobre a configuração do node.js, consulte link:https://npmjs.org/doc/config.html[+https://npmjs.org/doc/config.html+].
-4. Execute o comando a seguir para instalar o Cordova.
+
+[start=4]
+. Execute o comando a seguir para instalar o Cordova.
[source,shell]
----
@@ -126,7 +128,9 @@
$ npm update -g cordova
----
-5. Execute o seguinte comando para confirmar se o Cordova está instalado e exibir a versão.
+
+[start=5]
+. Execute o seguinte comando para confirmar se o Cordova está instalado e exibir a versão.
[source,shell]
----
@@ -136,13 +140,17 @@
Se o Cordova estiver instalado, você verá uma versão impressa na janela do terminal.
-6. Faça o download e instale o sistema de controle de versão Git se não estiver instalado.
+
+[start=6]
+. Faça o download e instale o sistema de controle de versão Git se não estiver instalado.
Você pode fazer o download do instalador no link:http://git-scm.com/[+site do Git+].
*Observação.* Adicione o Git à variável de ambiente Path.
-7. Execute o comando a seguir para confirmar se o Git foi instalado.
+
+[start=7]
+. Execute o comando a seguir para confirmar se o Git foi instalado.
[source,shell]
----
@@ -185,13 +193,19 @@
1. Selecione Arquivo > Novo Projeto (Ctrl-Shift-N; ⌘-Shift-N no Mac) no menu principal para abrir o assistente Novo Projeto.
2. Selecione a categoria *HTML5* e, em seguida, selecione *Aplicação Cordova*. Clique em Próximo.
image::images/cordova-newproject-wizard1.png[title="Modelo de Aplicação Cordova no assistente de Novo Projeto"]
-3. Digite *CordovaMapApp* como Nome do Projeto e especifique o diretório no seu computador onde você quer salvar o projeto. Clique em Próximo.
-4. Na Etapa 3. Modelo de Site, confirme se Fazer Download do Modelo On-line está selecionado e se o modelo Cordova Hello World está selecionado na lista. Clique em Próximo.
+
+[start=3]
+. Digite *CordovaMapApp* como Nome do Projeto e especifique o diretório no seu computador onde você quer salvar o projeto. Clique em Próximo.
+
+[start=4]
+. Na Etapa 3. Modelo de Site, confirme se Fazer Download do Modelo On-line está selecionado e se o modelo Cordova Hello World está selecionado na lista. Clique em Próximo.
image::images/cordova-newproject-wizard2.png[title="Painel Modelos de Site no assistente da Nova Aplicação em HTML5"]
*Observação:* Você deve estar on-line para criar um projeto baseado em um dos modelos on-line da lista.
-5. Na Etapa 4. Arquivos JavaScript, selecione as bibliotecas JavaScript ``jquery`` e ``jquery-mobile`` no painel Disponível e clique no botão de seta para a direita ( > ) para mover as bibliotecas selecionadas para o painel Selecionado do assistente. Por default, as bibliotecas são criadas na pasta ``js/libraries`` do projeto. Para este tutorial, você utilizará as versões "minimizadas" das bibliotecas JavaScript.
+
+[start=5]
+. Na Etapa 4. Arquivos JavaScript, selecione as bibliotecas JavaScript ``jquery`` e ``jquery-mobile`` no painel Disponível e clique no botão de seta para a direita ( > ) para mover as bibliotecas selecionadas para o painel Selecionado do assistente. Por default, as bibliotecas são criadas na pasta ``js/libraries`` do projeto. Para este tutorial, você utilizará as versões "minimizadas" das bibliotecas JavaScript.
Você pode usar o campo de texto no painel para filtrar a lista de bibliotecas JavaScript. Por exemplo, digite *jq* no campo para ajudá-lo a encontrar as bibliotecas ``jquery`` . Você pode usar Ctrl-clique nos nomes das bibliotecas para selecionar várias bibliotecas.
@@ -201,7 +215,9 @@
* Você pode clicar no número de versão da biblioteca na coluna Versão para abrir uma janela pop-up que permite selecionar a ordem das versões de biblioteca. Por default, o assistente exibe a versão mais recente.
* As versões minimizadas das bibliotecas JavaScript são versões compactadas e o código não é abrangente quando exibido em um editor.
-6. Na Etapa 5. Suporte a Cordova, use os valores padrão. Clique em *Finalizar* para concluir o assistente.
+
+[start=6]
+. Na Etapa 5. Suporte a Cordova, use os valores padrão. Clique em *Finalizar* para concluir o assistente.
Quando você clicar em Finalizar, o IDE criará o projeto e exibirá um nó para o projeto na janela Projetos,e abrirá o arquivo ``index.html`` no editor.
@@ -213,9 +229,13 @@
Agora você pode testar a execução do projeto e ver se ele foi implantado no emulador do seu dispositivo móvel de destino.
-7. Clique no ícone de seleção do browser na barra de ferramentas e confirme se o seu emulador de dispositivo móvel de destino está selecionado na coluna Cordova da tabela. Na coluna Cordova, você pode selecionar o Emulador do Android ou do iOS (exige OS X e XCode).
+
+[start=7]
+. Clique no ícone de seleção do browser na barra de ferramentas e confirme se o seu emulador de dispositivo móvel de destino está selecionado na coluna Cordova da tabela. Na coluna Cordova, você pode selecionar o Emulador do Android ou do iOS (exige OS X e XCode).
image::images/cordova-select-browser.png[title="Browser selecionado na lista drop-down na barra de ferramentas"]
-8. Clique no ícone Executar na barra de ferramentas.
+
+[start=8]
+. Clique no ícone Executar na barra de ferramentas.
Quando você escolhe Executar, o IDE implanta a aplicação Cordova no emulador.
@@ -237,7 +257,9 @@
No editor, você pode ver que o IDE gerou um código baseado no modelo Cordova Hello World.
-2. No editor, adicione referências a bibliotecas JavaScript e arquivos CSS do jQuery que foram adicionados quando você criou o projeto. Adicione o seguinte código (em *negrito*) entre as tags de abertura e fechamento ``<head>`` .
+
+[start=2]
+. No editor, adicione referências a bibliotecas JavaScript e arquivos CSS do jQuery que foram adicionados quando você criou o projeto. Adicione o seguinte código (em *negrito*) entre as tags de abertura e fechamento ``<head>`` .
[source,xml]
----
@@ -262,7 +284,9 @@
Você vê o caminho para os arquivos na janela Projetos e, como ajuda, pode usar o preenchimento de código do editor.
image::images/cordova-code-completion.png[title="Autocompletar código no editor"]
-3. Adicione o link a seguir à API JavaScript do Google Maps entre as tags `<head>`.
+
+[start=3]
+. Adicione o link a seguir à API JavaScript do Google Maps entre as tags `<head>`.
[source,xml]
----
@@ -272,7 +296,9 @@
*Observação.* Este é um link para a v2 obsoleta da API JavaScript. Este JavaScript funcionará para fins de demonstração neste tutorial, mas você deve usar a versão mais nova em uma aplicação real.
-4. Remova todo o código entre as tags `<body>`, exceto os seguintes links para os arquivos JavaScript `index.js` e `cordova.js`.
+
+[start=4]
+. Remova todo o código entre as tags `<body>`, exceto os seguintes links para os arquivos JavaScript `index.js` e `cordova.js`.
[source,xml]
----
@@ -290,7 +316,9 @@
O `cordova.js` não é visto na janela Projetos porque é gerado na criação da aplicação Cordova.
-5. Adicione o seguinte código (em *negrito*) entre as tags ``body`` .
+
+[start=5]
+. Adicione o seguinte código (em *negrito*) entre as tags ``body`` .
[source,html]
----
@@ -339,7 +367,9 @@
Use a guia Aplicação para exibir e editar os detalhes de configuração do Cordova sobre a aplicação que são especificados em `config.xml`.
-3. Clique na guia Plug-ins do painel Cordova.
+
+[start=3]
+. Clique na guia Plug-ins do painel Cordova.
A guia Plug-ins contém dois painéis. O painel Disponível exibe uma lista dos plug-ins do Cordova que estão disponíveis atualmente.
@@ -347,7 +377,9 @@
*Observação.* É possível também editar os plug-ins instalados editando o arquivo `nbproject/plugins.properties` no editor.
-4. Remova todos os plug-ins exceto API do Dispositivo, Caixas de Diálogo (Notificações) e Localização Geográfica. Clique em OK.
+
+[start=4]
+. Remova todos os plug-ins exceto API do Dispositivo, Caixas de Diálogo (Notificações) e Localização Geográfica. Clique em OK.
image::images/cordova-properties-plugins.png[title="A guia Plug-ins do Cordova na janela Propriedades do Projeto"]
@@ -359,7 +391,9 @@
O IDE gerou um código padronizado em `index.js` quando você criou o projeto. Nessa aplicação, você pode remover todo o código gerado.
-2. Substitua o código gerado pelo seguinte código. Salve as alterações.
+
+[start=2]
+. Substitua o código gerado pelo seguinte código. Salve as alterações.
[source,java]
----
@@ -448,8 +482,12 @@
*Observação.* Neste tutorial, a chamada para o método `onDeviceReady` é definida como comentário porque o método não é necessário quando você está implantando a aplicação em um emulador de dispositivo móvel. Para executar a aplicação em um web browser, desfaça o comentário da chamada para o método `onDeviceReady`.
-3. Redefina o emulador reiniciando-o ou redefinindo as definições.
-4. Clique em Executar na barra de ferramentas para implantar a aplicação no emulador.
+
+[start=3]
+. Redefina o emulador reiniciando-o ou redefinindo as definições.
+
+[start=4]
+. Clique em Executar na barra de ferramentas para implantar a aplicação no emulador.
No Simulador do iOS, você é solicitado a permitir que a aplicação use sua localização atual.
@@ -477,7 +515,9 @@
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
----
-4. Clique em Executar na barra de ferramentas para executar a aplicação novamente.
+
+[start=4]
+. Clique em Executar na barra de ferramentas para executar a aplicação novamente.
Quando você executar a aplicação, o depurador atingirá o ponto de interrupção quando a aplicação tentar determinar sua localização atual.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ru.asciidoc
index 015b724..cfc03d0 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_ru.asciidoc
@@ -37,11 +37,7 @@
-image::images/netbeans-stamp.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.3"]
-
-
-
-==== Для выполнения этого учебного курса потребуются следующие материалы.
+== Для выполнения этого учебного курса потребуются следующие материалы.
|===
|Программное обеспечение или ресурс |Требуемая версия
@@ -77,8 +73,12 @@
Программу установки можно загрузить с link:http://nodejs.org[+сайта Node.js+].
-2. Откройте окно терминала.
-3. Чтобы убедиться в наличии Node.js, выполните следующую команду.
+
+[start=2]
+. Откройте окно терминала.
+
+[start=3]
+. Чтобы убедиться в наличии Node.js, выполните следующую команду.
[source,shell]
----
@@ -108,7 +108,9 @@
$ npm config list
----
* Для получения дополнительных сведений о настройке node.js см. link:https://npmjs.org/doc/config.html[+https://npmjs.org/doc/config.html+].
-4. Для установки Cordova выполните следующую команду.
+
+[start=4]
+. Для установки Cordova выполните следующую команду.
[source,shell]
----
@@ -126,7 +128,9 @@
$ npm update -g cordova
----
-5. Чтобы убедиться в успешной установке Cordova и просмотр информацию об используемой версии, выполните следующую команду.
+
+[start=5]
+. Чтобы убедиться в успешной установке Cordova и просмотр информацию об используемой версии, выполните следующую команду.
[source,shell]
----
@@ -136,13 +140,17 @@
Если установка Cordova выполнена, в окне терминала отобразится номер версии.
-6. Загрузите и установите систему контроля версий Git, если не сделали этого раньше.
+
+[start=6]
+. Загрузите и установите систему контроля версий Git, если не сделали этого раньше.
Программу установки можно загрузить с link:http://git-scm.com/[+сайта Git+].
*Примечание.* В среду Path требуется добавить Git.
-7. Для проверки успешной установки Git выполните следующую команду.
+
+[start=7]
+. Для проверки успешной установки Git выполните следующую команду.
[source,shell]
----
@@ -185,13 +193,19 @@
1. Выберите 'Файл' > 'Новый проект' (Ctrl-Shift-N; ⌘-Shift-N в Mac) в главном меню, чтобы открыть мастер создания проектов.
2. Выберите категорию *HTML5*, затем выберите *Приложение Cordova*. Нажмите кнопку "Далее".
image::images/cordova-newproject-wizard1.png[title="Шаблон приложения Cordova в мастере создания проектов"]
-3. Введите *CordovaMapApp* в качестве имени проекта и укажите каталог на компьютере, где следует сохранить проект. Нажмите 'Далее'.
-4. В шаге 3. "Шаблон сайта", убедитесь, что шаблоны Download Online и Cordova Hello World выбраны в списке. Нажмите кнопку "Далее".
+
+[start=3]
+. Введите *CordovaMapApp* в качестве имени проекта и укажите каталог на компьютере, где следует сохранить проект. Нажмите 'Далее'.
+
+[start=4]
+. В шаге 3. "Шаблон сайта", убедитесь, что шаблоны Download Online и Cordova Hello World выбраны в списке. Нажмите кнопку "Далее".
image::images/cordova-newproject-wizard2.png[title="Панель шаблонов сайта в мастере создания приложений HTML5"]
*Примечание.* Вы должны быть подключены к сети, чтобы создать проект, который основан на одном из интернет-шаблонов в списке.
-5. В шаге 4. "Файлы JavaScript" выберите библиотеки JavaScript ``jquery`` и ``jquery`` на панели 'Доступные' и щелкните кнопку со стрелкой вправо ( > ), чтобы переместить выбранные библиотеки на панель мастера 'Выбранное'. По умолчанию библиотеки создаются в папке проекта ``js/libraries`` . В этом учебном курсе будут использоваться "уменьшенные" версии библиотек JavaScript.
+
+[start=5]
+. В шаге 4. "Файлы JavaScript" выберите библиотеки JavaScript ``jquery`` и ``jquery`` на панели 'Доступные' и щелкните кнопку со стрелкой вправо ( > ), чтобы переместить выбранные библиотеки на панель мастера 'Выбранное'. По умолчанию библиотеки создаются в папке проекта ``js/libraries`` . В этом учебном курсе будут использоваться "уменьшенные" версии библиотек JavaScript.
Можно использовать текстовое поле на панели, чтобы отфильтровать список библиотек JavaScript. Например, введите *jq* в поле, чтобы найти библиотеки ``jquery`` . Вы можете удерживать нажатой клавишу Ctrl и щелкнуть левой кнопкой мыши имена библиотек для выбора нескольких библиотек.
@@ -201,7 +215,9 @@
* Можно нажать номер версии библиотеки в столбце 'Версия', чтобы открыть всплывающее окно, в котором можно выбрать предыдущие версии библиотек. По умолчанию в мастере отображается самая последняя версия.
* Минимизированные версии библиотек JavaScript - это сжатые версии, и при просмотре в редакторе код не является доступным для понимания.
-6. В шаге 5. "Служба поддержки Cordova", используйте значения по умолчанию. Для завершения мастера нажмите кнопку *Готово*.
+
+[start=6]
+. В шаге 5. "Служба поддержки Cordova", используйте значения по умолчанию. Для завершения мастера нажмите кнопку *Готово*.
После нажатия кнопки 'Готово' в IDE создается проект, отображается узел проекта в окне 'Проекты' и открывается файл ``index.html`` в редакторе.
@@ -213,9 +229,13 @@
Теперь вы можете выполнить проверку выполнения и развертывания проекта в эмуляторе для целевого мобильного устройства.
-7. Щелкните значок выбора браузера на панели инструментов и убедитесь, что в столбце Cordova таблицы выбран эмулятор целевого мобильного устройства. В столбце Cordova можно выбрать эмулятор Android или симулятор iOS (потребуется OS X и XCode).
+
+[start=7]
+. Щелкните значок выбора браузера на панели инструментов и убедитесь, что в столбце Cordova таблицы выбран эмулятор целевого мобильного устройства. В столбце Cordova можно выбрать эмулятор Android или симулятор iOS (потребуется OS X и XCode).
image::images/cordova-select-browser.png[title="Браузер, выбранный в раскрывающемся списке на панели инструментов."]
-8. Нажмите значок 'Выполнить' на панели инструментов.
+
+[start=8]
+. Нажмите значок 'Выполнить' на панели инструментов.
При нажатии кнопки 'Выполнить' среда IDE выполняет развертывание приложения Cordova в эмуляторе.
@@ -237,7 +257,9 @@
В редакторе можно увидеть, что среда IDE создала код на основе шаблона Cordova Hello World.
-2. Добавьте в редакторе ссылки на библиотеки jQuery JavaScript и файлы CSS, которые добавлялись при создании проекта. Добавьте следующий код (*полужирным шрифтом*) между открывающим и закрывающим тегами ``<head>`` .
+
+[start=2]
+. Добавьте в редакторе ссылки на библиотеки jQuery JavaScript и файлы CSS, которые добавлялись при создании проекта. Добавьте следующий код (*полужирным шрифтом*) между открывающим и закрывающим тегами ``<head>`` .
[source,xml]
----
@@ -262,7 +284,9 @@
В окне 'Проекты' можно увидеть путь к файлам и использовать функцию автозавершения кода в редакторе.
image::images/cordova-code-completion.png[title="Автозавершение кода в редакторе"]
-3. Добавьте следующую ссылку на Google Maps JavaScript API между тегами `<head>`.
+
+[start=3]
+. Добавьте следующую ссылку на Google Maps JavaScript API между тегами `<head>`.
[source,xml]
----
@@ -272,7 +296,9 @@
*Примечание.* Это ссылка на исключенную версию v2 JavaScript API. Эта версия JavaScript используется в данной учебной программе в демонстрационных целях. При создании настоящего приложения рекомендуется использовать новую версию.
-4. Удалите код между тегами `<body>` за исключением следующих ссылок на файлы JavaScript `index.js` и `cordova.js`.
+
+[start=4]
+. Удалите код между тегами `<body>` за исключением следующих ссылок на файлы JavaScript `index.js` и `cordova.js`.
[source,xml]
----
@@ -290,7 +316,9 @@
Файл `cordova.js` не отображается в окне 'Проекты', так как он генерируется при сборке приложения Cordova.
-5. Добавьте следующий код (*полужирным шрифтом*) между тегами ``body`` .
+
+[start=5]
+. Добавьте следующий код (*полужирным шрифтом*) между тегами ``body`` .
[source,html]
----
@@ -339,7 +367,9 @@
Вкладка 'Приложение' может использоваться для просмотра и изменения данных конфигурации Cordova о приложении, указанных в файле `config.xml`.
-3. Щелкните вкладку 'Подключаемые модули' на панели Cordova.
+
+[start=3]
+. Щелкните вкладку 'Подключаемые модули' на панели Cordova.
Вкладка 'Подключаемые модули' содержит две панели. На панели 'Доступно' отображается список подключаемых модулей Cordova, доступных в настоящее время.
@@ -347,7 +377,9 @@
*Примечание.* Кроме того, список установленных подключаемых модулей можно изменить путем внесения изменений в файл `nbproject/plugins.properties` в редакторе.
-4. Удалите все подключаемые модули за исключением следующих: API устройства (Device API), Диалоги (Уведомления) ( Dialogs (Notifications)) и Геолокация (Geolocation). Нажмите кнопку "ОК".
+
+[start=4]
+. Удалите все подключаемые модули за исключением следующих: API устройства (Device API), Диалоги (Уведомления) ( Dialogs (Notifications)) и Геолокация (Geolocation). Нажмите кнопку "ОК".
image::images/cordova-properties-plugins.png[title="Вкладка 'Подключаемые модули Cordova' в окне 'Свойства проекта'"]
@@ -359,7 +391,9 @@
При создании проекта в `index.js` был сгенерирован шаблон кода. Для данного приложения можно удалить весь сгенерированный код.
-2. Замените созданный код следующим: Сохраните изменения.
+
+[start=2]
+. Замените созданный код следующим: Сохраните изменения.
[source,java]
----
@@ -448,8 +482,12 @@
*Примечание.* Для данного учебного курса вызов метода `onDeviceReady` добавлен только в виде комментария, так как метод является необязательным для развертывания приложения в эмуляторе мобильного устройства. При необходимости выполнения приложения в веб-браузере следует удалить символы комментария перед вызовом метода `onDeviceReady`.
-3. Выполните сброс эмулятора, перезапустив эмулятор или сбросив его настройки.
-4. Нажмите 'Выполнить' на панели инструментов для развертывания приложения в эмуляторе.
+
+[start=3]
+. Выполните сброс эмулятора, перезапустив эмулятор или сбросив его настройки.
+
+[start=4]
+. Нажмите 'Выполнить' на панели инструментов для развертывания приложения в эмуляторе.
В симуляторе iOS появится запрос на разрешение приложению использовать ваше текущее месторасположение.
@@ -477,7 +515,9 @@
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
----
-4. Нажмите 'Выполнить' на панели инструментов, чтобы повторно выполнить приложение.
+
+[start=4]
+. Нажмите 'Выполнить' на панели инструментов, чтобы повторно выполнить приложение.
При выполнении приложения отладчик дойдет до точки останова, когда приложение попытается определить текущее местоположение.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_zh_CN.asciidoc
index ad97b66..1ca1238 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/cordova-gettingstarted_zh_CN.asciidoc
@@ -37,11 +37,7 @@
-image::images/netbeans-stamp.png[title="此页上的内容适用于 NetBeans IDE 7.3"]
-
-
-
-==== 要完成本教程,需要使用以下资源。
+== 要完成本教程,需要使用以下资源。
|===
|软件或资源 |要求的版本
@@ -77,8 +73,12 @@
可以从 link:http://nodejs.org[+Node.js 站点+]下载此安装程序。
-2. 打开一个终端窗口。
-3. 运行下面的命令以确认已安装 Node.js。
+
+[start=2]
+. 打开一个终端窗口。
+
+[start=3]
+. 运行下面的命令以确认已安装 Node.js。
[source,shell]
----
@@ -108,7 +108,9 @@
$ npm config list
----
* 有关配置 node.js 的其他信息,请参见 link:https://npmjs.org/doc/config.html[+https://npmjs.org/doc/config.html+]。
-4. 运行下面的命令以安装 Cordova。
+
+[start=4]
+. 运行下面的命令以安装 Cordova。
[source,shell]
----
@@ -126,7 +128,9 @@
$ npm update -g cordova
----
-5. 运行下面的命令以确认 Cordova 已安装并查看版本。
+
+[start=5]
+. 运行下面的命令以确认 Cordova 已安装并查看版本。
[source,shell]
----
@@ -136,13 +140,17 @@
如果已安装 Cordova,您将会看到版本显示在终端窗口中。
-6. 下载并安装 Git 版本控制系统(如果尚未安装)。
+
+[start=6]
+. 下载并安装 Git 版本控制系统(如果尚未安装)。
可以从 link:http://git-scm.com/[+Git 站点+]下载此安装程序。
*注:*需要将 Git 添加到 Path 环境中。
-7. 运行下面的命令以确认已安装 Git。
+
+[start=7]
+. 运行下面的命令以确认已安装 Git。
[source,shell]
----
@@ -185,13 +193,19 @@
1. 从主菜单中选择 "File"(文件)> "New Project"(新建项目)(Ctrl-Shift-N 组合键;在 Mac 上为 ⌘-Shift-N 组合键),以打开新建项目向导。
2. 选择 *HTML5* 类别,然后选择 *Cordova Application*(Cordova 应用程序)。单击 "Next"(下一步)。
image::images/cordova-newproject-wizard1.png[title="新建项目向导中的 Cordova 应用程序模板"]
-3. 为 "Project Name"(项目名称)键入 *CordovaMapApp*,并指定计算机上要保存项目的目录。单击 "Next"(下一步)。
-4. 在第 3 步 "Site Template"(站点模板)中,确认选中 "Download Online Template"(下载联机模板),并且在列表中选中 "Cordova Hello World" 模板。单击 "Next"(下一步)。
+
+[start=3]
+. 为 "Project Name"(项目名称)键入 *CordovaMapApp*,并指定计算机上要保存项目的目录。单击 "Next"(下一步)。
+
+[start=4]
+. 在第 3 步 "Site Template"(站点模板)中,确认选中 "Download Online Template"(下载联机模板),并且在列表中选中 "Cordova Hello World" 模板。单击 "Next"(下一步)。
image::images/cordova-newproject-wizard2.png[title=""New HTML5 Application"(新建 HTML5 应用程序)向导中的 "Site Templates"(站点模板)面板"]
*注:*要根据列表中的一个联机模板创建项目,您必须处于联机状态。
-5. 在第 4 步 "JavaScript Files"(JavaScript 文件)中,从 "Available"(可用)窗格选择 ``jquery`` 和 ``jquery-mobile`` JavaScript 库,单击右箭头按钮 ( > ) 以将所选库移动到向导的 "Selected"(选定)窗格。默认情况下,将在项目的 ``js/libraries`` 文件夹中创建库。在本教程中,您将使用 JavaScript 库的“缩小”版本。
+
+[start=5]
+. 在第 4 步 "JavaScript Files"(JavaScript 文件)中,从 "Available"(可用)窗格选择 ``jquery`` 和 ``jquery-mobile`` JavaScript 库,单击右箭头按钮 ( > ) 以将所选库移动到向导的 "Selected"(选定)窗格。默认情况下,将在项目的 ``js/libraries`` 文件夹中创建库。在本教程中,您将使用 JavaScript 库的“缩小”版本。
可以使用面板上的文本字段来过滤 JavaScript 库列表。例如,在字段中键入 *jq* 可帮助您查找 ``jquery`` 库。按住 Ctrl 单击库的名称可以选择多个库。
@@ -201,7 +215,9 @@
* 可以在 "Version"(版本)列中单击库版本号以打开弹出窗口,通过该窗口可以选择库的较早版本。默认情况下,向导显示最新的版本。
* JavaScript 库的最小化版本是压缩版本,在编辑器中查看时,不太容易理解代码。
-6. 在第 5 步 "Cordova Support"(Cordova 支持)中,使用默认值。单击*完成*即可完成此向导。
+
+[start=6]
+. 在第 5 步 "Cordova Support"(Cordova 支持)中,使用默认值。单击*完成*即可完成此向导。
单击 "Finish"(完成)时,IDE 将创建项目、在 "Projects"(项目)窗口中显示项目的节点并在编辑器中打开 ``index.html`` 文件。
@@ -213,9 +229,13 @@
您现在可以测试,项目运行并且已部署到目标移动设备的仿真器中。
-7. 单击工具栏中的浏览器选择图标,并确认在表的 "Cordova" 列中选定目标移动设备仿真器。在 "Cordova" 列中,可以选择 "Android Emulator"(Android 仿真器)或 "iOS Simulator"(iOS 模拟程序)(需要 OS X 和 XCode)。
+
+[start=7]
+. 单击工具栏中的浏览器选择图标,并确认在表的 "Cordova" 列中选定目标移动设备仿真器。在 "Cordova" 列中,可以选择 "Android Emulator"(Android 仿真器)或 "iOS Simulator"(iOS 模拟程序)(需要 OS X 和 XCode)。
image::images/cordova-select-browser.png[title="在工具栏下拉列表中选择的浏览器"]
-8. 单击工具栏中的 "Run"(运行)图标。
+
+[start=8]
+. 单击工具栏中的 "Run"(运行)图标。
选择 "Run"(运行)时,IDE 会将 Cordova 应用程序部署到仿真器。
@@ -237,7 +257,9 @@
在编辑器中,您可以看到 IDE 根据 Cordova Hello World 模板生成了一些代码。
-2. 在编辑器中,添加对您在创建项目时添加的 jQuery JavaScript 库和 CSS 文件的引用。在开始和结束的 ``<head>`` 标记之间添加下面的代码(*粗体*)。
+
+[start=2]
+. 在编辑器中,添加对您在创建项目时添加的 jQuery JavaScript 库和 CSS 文件的引用。在开始和结束的 ``<head>`` 标记之间添加下面的代码(*粗体*)。
[source,xml]
----
@@ -262,7 +284,9 @@
您可以在 "Projects"(项目)窗口中查看这些文件的路径,并且可以在编辑器中使用代码完成来帮助您操作。
image::images/cordova-code-completion.png[title="编辑器中的代码完成功能"]
-3. 将下面指向 Google Maps JavaScript API 的链接添加到 `<head>` 标记之间。
+
+[start=3]
+. 将下面指向 Google Maps JavaScript API 的链接添加到 `<head>` 标记之间。
[source,xml]
----
@@ -272,7 +296,9 @@
*注:*此链接指向已过时的 JavaScript API v2。在本教程中,此 JavaScript 将用于演示目的,在实际应用程序中应使用较新的版本。
-4. 删除 `<body>` 标记之间的所有代码,只保留下面指向 `index.js` 和 `cordova.js` JavaScript 文件的链接。
+
+[start=4]
+. 删除 `<body>` 标记之间的所有代码,只保留下面指向 `index.js` 和 `cordova.js` JavaScript 文件的链接。
[source,xml]
----
@@ -290,7 +316,9 @@
`cordova.js` 在 "Projects"(项目)窗口中不可见,因为它是在构建 Cordova 应用程序时生成的。
-5. 在 ``body`` 标记之间添加下面的代码(*粗体*)。
+
+[start=5]
+. 在 ``body`` 标记之间添加下面的代码(*粗体*)。
[source,html]
----
@@ -339,7 +367,9 @@
您可以使用 "Application"(应用程序)标签查看和编辑在 `config.xml` 中指定的有关应用程序的 Cordova 配置详细信息。
-3. 在 "Cordova" 面板中单击 "Plugins"(插件)标签。
+
+[start=3]
+. 在 "Cordova" 面板中单击 "Plugins"(插件)标签。
"Plugins"(插件)标签包含两个窗格。"Available"(可用)窗格显示当前可用的 Cordova 插件列表。
@@ -347,7 +377,9 @@
*注:*还可以通过在编辑器中编辑 `nbproject/plugins.properties` 文件来编辑已安装的插件。
-4. 删除“设备 API”、“对话框(通知)”和“地理位置”除外的所有插件。单击 "OK"(确定)。
+
+[start=4]
+. 删除“设备 API”、“对话框(通知)”和“地理位置”除外的所有插件。单击 "OK"(确定)。
image::images/cordova-properties-plugins.png[title=""Project Properties"(项目属性)窗口中的 "Cordova Plugins"(Cordova 插件)标签"]
@@ -359,7 +391,9 @@
在创建项目时,IDE 在 `index.js` 中生成了一些样板代码。对于此应用程序,您可以删除生成的所有代码。
-2. 将生成的代码替换为以下代码。保存所做的更改。
+
+[start=2]
+. 将生成的代码替换为以下代码。保存所做的更改。
[source,java]
----
@@ -448,8 +482,12 @@
*注:*在本教程中,注释掉了对 `onDeviceReady` 方法的调用,因为在将应用程序部署到移动设备仿真器时不需要此方法。如果要在 Web 浏览器中运行应用程序,则应取消注释对 `onDeviceReady` 方法的调用。
-3. 通过重新启动仿真器或重置设置来重置仿真器。
-4. 单击工具栏中的 "Run"(运行)将应用程序部署到仿真器。
+
+[start=3]
+. 通过重新启动仿真器或重置设置来重置仿真器。
+
+[start=4]
+. 单击工具栏中的 "Run"(运行)将应用程序部署到仿真器。
在 iOS 模拟程序上,系统会提示您允许应用程序使用您的当前位置。
@@ -477,7 +515,9 @@
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
----
-4. 单击工具栏中的 "Run"(运行)以再次运行应用程序。
+
+[start=4]
+. 单击工具栏中的 "Run"(运行)以再次运行应用程序。
运行应用程序时,调试器将在应用程序尝试确定您的当前位置时遇到断点。
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css.asciidoc
index b66885a..2d266f3 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css.asciidoc
@@ -38,21 +38,7 @@
To watch a screencast of this tutorial, see link:../web/html5-css-screencast.html[+Video of Working with CSS Style Sheets in HTML5 Applications+].
-=== Contents
-
-image::images/netbeans-stamp-80-74.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-* <<create,Creating the NetBeans HTML5 Application>>
-* <<viewing,Viewing the Application on Different Devices>>
-* <<layout,Modifying the Layout>>
-* <<newstylesheet,Create a Media Style Sheet>>
-* <<addrules,Add CSS Rules>>
-* <<preprocessors,Using CSS Preprocessors>>
-* <<summary,Summary>>
-* <<seealso,See Also>>
-
-
-==== To complete this tutorial, you will need the following resources.
+== To complete this tutorial, you will need the following resources.
|===
|Software or Resource |Version Required
@@ -113,7 +99,9 @@
You will also notice that the NetBeans icon is visible in the URL location field of the browser. You can click the icon to open a menu that provides various options for changing the display size of the browser and for enabling the Inspect in NetBeans mode.
-3. Click the Open NetBeans Action icon in the URL field of the browser to open the NetBeans menu and select Tablet Portrait in the menu.
+
+[start=3]
+. Click the Open NetBeans Action icon in the URL field of the browser to open the NetBeans menu and select Tablet Portrait in the menu.
The window resizes to the size of a tablet browser in portrait mode. The menu stretches to fill the right side and the entire menu is visible.
@@ -121,7 +109,9 @@
If you select one of the default devices in the menu the browser window will resize to the dimensions of the device. This enables you to see how the application will look on the selected device. HTML5 applications are usually designed to respond to the size of the screen of the device on which they are viewed. You can use JavaScript and CSS rules that respond to the screen size and modify how the application is displayed so that the layout is optimized for the device.
-4. Click the NetBeans icon again and select Smartphone Landscape in the NetBeans menu.
+
+[start=4]
+. Click the NetBeans icon again and select Smartphone Landscape in the NetBeans menu.
image::images/html5-css-tabletbrowser2.png[title="Select Smartphone Landscape in the NetBeans menu in the browser"]
The window resizes to the size of a smartphone in landscape orientation and you can see that the bottom part of the menu is not visible without scrolling.
@@ -145,7 +135,9 @@
When you click Finish the new style sheet opens in the editor.
-3. Add the following media rule to the style sheet.
+
+[start=3]
+. Add the following media rule to the style sheet.
[source,java]
----
@@ -160,9 +152,15 @@
Create code templates for code snippets that you might use frequently. You can create CSS code templates in the Code Templates tab in the Editor category of the Options window.
-4. Save your changes.
-5. Open ``index.html`` in the editor.
-6. Add the following link to the style sheet between the ``<head>`` tags in ``index.html`` . Save your changes.
+
+[start=4]
+. Save your changes.
+
+[start=5]
+. Open ``index.html`` in the editor.
+
+[start=6]
+. Add the following link to the style sheet between the ``<head>`` tags in ``index.html`` . Save your changes.
[source,java]
----
@@ -204,26 +202,42 @@
The lower pane displays all the properties that are defined in the CSS rule for the rule that is selected in the middle pane. In this case you can see that the rule for ``img`` defines the ``border`` , ``float`` and ``margin-right`` properties.
-3. Click the Document tab in the CSS Styles window.
-4. Select the ``css/mycss.css`` node and click the Edit CSS Rules button (image::images/newcssrule.png[title="Edit CSS Rules button"]) window to open the Edit CSS Rules dialog box.
+
+[start=3]
+. Click the Document tab in the CSS Styles window.
+
+[start=4]
+. Select the ``css/mycss.css`` node and click the Edit CSS Rules button (image::images/newcssrule.png[title="Edit CSS Rules button"]) window to open the Edit CSS Rules dialog box.
image::images/html5-css-styleswindow2.png[title="Edit CSS Rules dialog box"]
-5. Select Element as the Selector Type and type *img* as the Selector.
-6. Select ``css/mycss.css`` as the Style Sheet and *(max-width:480px)* as the At-Rule. Click OK.
+
+[start=5]
+. Select Element as the Selector Type and type *img* as the Selector.
+
+[start=6]
+. Select ``css/mycss.css`` as the Style Sheet and *(max-width:480px)* as the At-Rule. Click OK.
image::images/html5-css-editcssrules.png[title="Edit CSS Rules dialog box"]
When you click OK the IDE creates a CSS rule for ``img`` in the ``css/mycss.css`` style sheet between the brackets of the media rule. The new rule is now listed in the Applied Styles pane.
-7. Click the Selection tab in the CSS Styles window.
+
+[start=7]
+. Click the Selection tab in the CSS Styles window.
You can see that there are two CSS rules for ``img`` . One of the rules is located in ``mycss.css`` and one is located in ``basecss.css`` .
-8. Select the new ``img`` rule (defined in ``mycss.css`` ) in the Applied Styles pane of the CSS Styles window.
+
+[start=8]
+. Select the new ``img`` rule (defined in ``mycss.css`` ) in the Applied Styles pane of the CSS Styles window.
image::images/html5-css-styleswindow2.png[title="Styles for the selected element in the CSS Styles window"]
In the lower pane of the window you can see that the rule has no properties.
-9. Click Add Property in the left column in the lower pane of the CSS Styles window and type *width*.
-10. Type *90px* in the right column next to the ``width`` property and hit Return on your keyboard.
+
+[start=9]
+. Click Add Property in the left column in the lower pane of the CSS Styles window and type *width*.
+
+[start=10]
+. Type *90px* in the right column next to the ``width`` property and hit Return on your keyboard.
image::images/html5-css-styleswindow3.png[title="Image Properties pane of the CSS Styles window"]
When you start typing in the value column you can see that a drop-down list displays common values for the ``width`` property.
@@ -246,7 +260,9 @@
Some additional changes need to be made to the style sheet because the menu still does not fit within the window.
-11. Select the unordered list ( ``<ul>`` ) element in the browser window.
+
+[start=11]
+. Select the unordered list ( ``<ul>`` ) element in the browser window.
image::images/html5-css-smartphonebrowser2.png[title="List element selected in browser"]
When you select the element you can see that ``<ul>`` is selected in the Browser DOM window and you can see the styles that are applied to that element in the CSS Styles window.
@@ -255,16 +271,28 @@
If you select ``font-family`` in the CSS Styles window you can see that the ``font-family`` property and value are defined in the ``.ui-widget`` class selector.
-12. Click in the ``index.html`` file in the editor and then click the Document tab in the CSS Styles window.
-13. Expand the ``css/mycss.css`` node in the CSS Styles window.
+
+[start=12]
+. Click in the ``index.html`` file in the editor and then click the Document tab in the CSS Styles window.
+
+[start=13]
+. Expand the ``css/mycss.css`` node in the CSS Styles window.
image::images/html5-css-styleswindow4.png[title="Style sheet selected in Document tab of CSS Styles window"]
-14. Click the Edit CSS Rules button (image::images/newcssrule.png[title="Edit CSS Rules button"]) in the CSS Styles window to open the Edit CSS Rules dialog box.
-15. Select Class as the Selector Type and type *ui-widget* as the Selector.
-16. Select * ``css/mycss.css`` * as the Style Sheet and *(max-width:480px)* as the At-Rule. Click OK.
+
+[start=14]
+. Click the Edit CSS Rules button (image::images/newcssrule.png[title="Edit CSS Rules button"]) in the CSS Styles window to open the Edit CSS Rules dialog box.
+
+[start=15]
+. Select Class as the Selector Type and type *ui-widget* as the Selector.
+
+[start=16]
+. Select * ``css/mycss.css`` * as the Style Sheet and *(max-width:480px)* as the At-Rule. Click OK.
When you click OK the IDE adds the new rule to the ``mycss.css`` style sheet and opens the file in the editor. If the file does not open in the editor you can double-click the ``ui-widget`` rule under the ``css/mycss.css`` node in the CSS Styles window to open the style sheet. The cursor is placed in the line containing the rule in the style sheet.
-17. Add the following property and value (in bold) to the rule for ``ui-widget`` .
+
+[start=17]
+. Add the following property and value (in bold) to the rule for ``ui-widget`` .
[source,java]
----
@@ -283,7 +311,9 @@
After you add the rule you can see that the menu now fits in the page.
image::images/html5-css-smartphonebrowser3.png[title="Page viewed in browser with new CSS rules applied"]
-18. Click the NetBeans icon in the browser and select Tablet Portrait in the menu.
+
+[start=18]
+. Click the NetBeans icon in the browser and select Tablet Portrait in the menu.
When the browser window resizes you can see that the changes to the style sheet do not affect the display when the screen size is larger than 480 pixels wide.
@@ -300,26 +330,44 @@
*Note.* If you are installing LESS on OS X you might need to confirm that Node.js can be found in the ``usr/bin`` directory. For details, see the following link:http://stackoverflow.com/questions/8638808/problems-with-less-sublime-text-build-system[+note+].
-2. Expand the HTML5Demo project in the Files window.
-3. Right-click the ``public_html`` folder in the Files window and choose New > Folder in the popup menu.
+
+[start=2]
+. Expand the HTML5Demo project in the Files window.
+
+[start=3]
+. Right-click the ``public_html`` folder in the Files window and choose New > Folder in the popup menu.
If Folder is not an option in the popup menu, choose Other and then select the Folder file type in the Other category of the New File wizard.
-4. Type *scss* for the File Name. Click Finish.
+
+[start=4]
+. Type *scss* for the File Name. Click Finish.
When you click Finish the IDE generates the new folder in the ``public_html`` folder.
-5. Right-click the ``scss`` folder node in the Projects window and choose New > Sass File in the popup menu.
-6. Type *mysass* as the File Name.
-7. Click Configure to open the CSS Preprocessor tab in the Options window.
-8. Type the path to the Sass executable or click Browse to locate the executable on your local system. Click OK to close the Options window.
+
+[start=5]
+. Right-click the ``scss`` folder node in the Projects window and choose New > Sass File in the popup menu.
+
+[start=6]
+. Type *mysass* as the File Name.
+
+[start=7]
+. Click Configure to open the CSS Preprocessor tab in the Options window.
+
+[start=8]
+. Type the path to the Sass executable or click Browse to locate the executable on your local system. Click OK to close the Options window.
image::images/html5-css-cssoptions.png[title="Page viewed in browser with new CSS rules applied"]
-9. Select Compile Sass Files on Save in the New File wizard. Click OK.
+
+[start=9]
+. Select Compile Sass Files on Save in the New File wizard. Click OK.
image::images/html5-css-newsass.png[title="Page viewed in browser with new CSS rules applied"]
When you click OK the new Sass file ``mysass.scss`` opens in the editor.
-10. Add the following to ``mysass.scss`` and save your changes.
+
+[start=10]
+. Add the following to ``mysass.scss`` and save your changes.
[source,java]
----
@@ -351,7 +399,9 @@
* When you want to modify the CSS rules you should edit the Sass preprocessor file ``mysass.scss`` file and not the ``mysass.css`` style sheet because the style sheet is regenerated each time the preprocessor file is modified and saved.
* For documentation about Sass syntax and other Sass features, see the link:http://sass-lang.com/documentation/file.SASS_REFERENCE.html#[+Sass reference+].
-11. Open ``index.html`` and make the following changes to change the link to the style sheet from ``mycss.css`` to ``mysass.css`` . Save your changes.
+
+[start=11]
+. Open ``index.html`` and make the following changes to change the link to the style sheet from ``mycss.css`` to ``mysass.css`` . Save your changes.
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ja.asciidoc
index fab2457..5edd238 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ja.asciidoc
@@ -37,13 +37,7 @@
このチュートリアルのスクリーンショットを確認するには、link:../web/html5-css-screencast.html[+HTML5アプリケーションでのCSSスタイル・シートの操作のビデオ+]を参照してください。
-
-
-image::images/netbeans-stamp-80-74.png[title="このページの内容は、NetBeans IDE 7.4および8.0に適用されます"]
-
-
-
-==== このチュートリアルを完了するには、次のリソースが必要です。
+== このチュートリアルを完了するには、次のリソースが必要です。
|===
|ソフトウェアまたはリソース |必須バージョン
@@ -104,7 +98,9 @@
また、NetBeansアイコンがブラウザのURLの場所フィールドに表示されます。アイコンをクリックして、ブラウザの表示サイズの変更および「NetBeansでの検査」モードの有効化を行う各種オプションを提供するメニューを開くことができます。
-3. ブラウザの「URL」フィールドで「NetBeansアクションを開く」アイコンをクリックしてNetBeansメニューを開き、メニューで「タブレット縦」を選択します。
+
+[start=3]
+. ブラウザの「URL」フィールドで「NetBeansアクションを開く」アイコンをクリックしてNetBeansメニューを開き、メニューで「タブレット縦」を選択します。
ウィンドウが縦モードのタブレット・ブラウザのサイズに変更されます。メニューが右側に合せて伸張し、メニュー全体が表示されます。
@@ -112,7 +108,9 @@
メニューでデフォルト・デバイスの1つを選択した場合、ブラウザ・ウィンドウがデバイスのサイズに変更されます。これにより、アプリケーションが選択したデバイスでどのように表示されるかを確認できます。HTML5アプリケーションは、通常、表示されるデバイスの画面サイズに対応するように設計されています。画面サイズに対応するJavaScriptおよびCSSルールを使用し、レイアウトがデバイスに対して最適化されるようにアプリケーションの表示方法を変更できます。
-4. もう一度NetBeansアイコンをクリックし、「NetBeans」メニューで「スマートフォン横」を選択します。
+
+[start=4]
+. もう一度NetBeansアイコンをクリックし、「NetBeans」メニューで「スマートフォン横」を選択します。
image::images/html5-css-tabletbrowser2.png[title="ブラウザのNetBeansメニューで「スマートフォン横」を選択"]
ウィンドウが横方向のスマートフォンのサイズに変更され、スクロールしないとメニューの下部が表示されないことを確認できます。
@@ -136,7 +134,9 @@
「終了」をクリックすると、新規スタイル・シートがエディタに開きます。
-3. スタイル・シートに次のメディア・ルールを追加します。
+
+[start=3]
+. スタイル・シートに次のメディア・ルールを追加します。
[source,java]
----
@@ -151,9 +151,15 @@
頻繁に使用する可能性のあるコード・スニペットのコード・テンプレートを作成します。「オプション」ウィンドウの「エディタ」カテゴリの「コード・テンプレート」タブで、CSSコード・テンプレートを作成できます。
-4. 変更を保存します。
-5. エディタで ``index.html`` を開きます。
-6. スタイル・シートの ``index.html`` の ``<head>`` タグの間に次のリンクを追加します。変更を保存します。
+
+[start=4]
+. 変更を保存します。
+
+[start=5]
+. エディタで ``index.html`` を開きます。
+
+[start=6]
+. スタイル・シートの ``index.html`` の ``<head>`` タグの間に次のリンクを追加します。変更を保存します。
[source,java]
----
@@ -195,26 +201,42 @@
下部ペインには、中央ペインで選択したルールのCSSルールで定義されているすべてのプロパティが表示されます。この場合、 ``img`` のルールが ``border`` 、 ``float`` 、 ``margin-right`` の各プロパティを定義していることを確認できます。
-3. 「CSSスタイル」ウィンドウで「ドキュメント」タブをクリックします。
-4. 「 ``css/mycss.css`` 」ノードを選択し、「CSSルールの編集」ボタン(image::images/newcssrule.png[title="「CSSルールの編集」ボタン"])をクリックして、「CSSルールの編集」ダイアログ・ボックスを開きます。
+
+[start=3]
+. 「CSSスタイル」ウィンドウで「ドキュメント」タブをクリックします。
+
+[start=4]
+. 「 ``css/mycss.css`` 」ノードを選択し、「CSSルールの編集」ボタン(image::images/newcssrule.png[title="「CSSルールの編集」ボタン"])をクリックして、「CSSルールの編集」ダイアログ・ボックスを開きます。
image::images/html5-css-styleswindow2.png[title="「CSSルールの編集」ダイアログ・ボックス。"]
-5. 「セレクタ・タイプ」として「要素」を選択し、「セレクタ」として「*img*」を入力します。
-6. 「スタイルシート」として「 ``css/mycss.css`` 」を選択し、「@規則」として*(最大幅:480px)*を選択します。「OK」をクリックします。
+
+[start=5]
+. 「セレクタ・タイプ」として「要素」を選択し、「セレクタ」として「*img*」を入力します。
+
+[start=6]
+. 「スタイルシート」として「 ``css/mycss.css`` 」を選択し、「@規則」として*(最大幅:480px)*を選択します。「OK」をクリックします。
image::images/html5-css-editcssrules.png[title="「CSSルールの編集」ダイアログ・ボックス。"]
「OK」をクリックすると、IDEにより ``css/mycss.css`` スタイル・シートのメディア・ルールの中括弧内に ``img`` のCSSルールが作成されます。新しいルールが適用されたスタイル・ペインにリストされます。
-7. 「CSSスタイル」ウィンドウで「選択」タブをクリックします。
+
+[start=7]
+. 「CSSスタイル」ウィンドウで「選択」タブをクリックします。
``img`` に2つのCSSルールがあることがわかります。一方のルールは ``mycss.css`` にあり、もう一方は ``basecss.css`` にあります。
-8. 「CSSスタイル」ウィンドウの適用されたスタイル・ペインで新しい ``img`` ルール( ``mycss.css`` で定義)を選択します。
+
+[start=8]
+. 「CSSスタイル」ウィンドウの適用されたスタイル・ペインで新しい ``img`` ルール( ``mycss.css`` で定義)を選択します。
image::images/html5-css-styleswindow2.png[title="「CSSスタイル」ウィンドウの選択した要素のスタイル"]
ウィンドウの下部ペインで、ルールにプロパティがないことを確認できます。
-9. 「CSSスタイル」ウィンドウの下部ペインの左側の列で「プロパティの追加」をクリックして、*「width」*と入力します。
-10. 「 ``width`` 」プロパティの右側の列に*「90px」*と入力し、キーボードのリターン・キーを押します。
+
+[start=9]
+. 「CSSスタイル」ウィンドウの下部ペインの左側の列で「プロパティの追加」をクリックして、*「width」*と入力します。
+
+[start=10]
+. 「 ``width`` 」プロパティの右側の列に*「90px」*と入力し、キーボードのリターン・キーを押します。
image::images/html5-css-styleswindow3.png[title="「CSSスタイル」ウィンドウのイメージ・プロパティ・ペイン"]
値列への入力を始めると、ドロップダウン・リストに「 ``width`` 」プロパティの一般的な値が表示されるのを確認できます。
@@ -237,7 +259,9 @@
メニューはまだウィンドウ内に収まらないため、いくつかの変更をスタイル・シートに追加で行う必要があります。
-11. ブラウザ・ウィンドウで、順序なしリスト( ``<ul>`` )要素を選択します。
+
+[start=11]
+. ブラウザ・ウィンドウで、順序なしリスト( ``<ul>`` )要素を選択します。
image::images/html5-css-smartphonebrowser2.png[title="ブラウザで選択したリスト要素"]
要素を選択すると、「ブラウザDOM」ウィンドウで「 ``<ul>`` 」が選択され、「CSSスタイル」ウィンドウでその要素に適用されているスタイルを確認できます。
@@ -246,16 +270,28 @@
「CSSスタイル」ウィンドウで「 ``font-family`` 」を選択すると、 ``font-family`` プロパティと値が ``.ui-widget`` クラス・セレクタで定義されていることを確認できます。
-12. エディタで ``index.html`` ファイルをクリックし、「CSSスタイル」ウィンドウの「ドキュメント」タブをクリックします。
-13. 「CSSスタイル」ウィンドウで「 ``css/mycss.css`` 」ノードを展開します。
+
+[start=12]
+. エディタで ``index.html`` ファイルをクリックし、「CSSスタイル」ウィンドウの「ドキュメント」タブをクリックします。
+
+[start=13]
+. 「CSSスタイル」ウィンドウで「 ``css/mycss.css`` 」ノードを展開します。
image::images/html5-css-styleswindow4.png[title="「CSSスタイル」ウィンドウの「ドキュメント」タブで選択されたスタイル・シート"]
-14. 「CSSスタイル」ウィンドウの「CSSルールの編集」ボタン(image::images/newcssrule.png[title="「CSSルールの編集」ボタン"])をクリックして、「CSSルールの編集」ダイアログ・ボックスを開きます。
-15. 「セレクタ・タイプ」として「クラス」を選択し、「セレクタ」として「*ui-widget*」を入力します。
-16. 「スタイルシート」として*「 ``css/mycss.css`` 」*を選択し、「@規則」として*(最大幅:480px)*を選択します。「OK」をクリックします。
+
+[start=14]
+. 「CSSスタイル」ウィンドウの「CSSルールの編集」ボタン(image::images/newcssrule.png[title="「CSSルールの編集」ボタン"])をクリックして、「CSSルールの編集」ダイアログ・ボックスを開きます。
+
+[start=15]
+. 「セレクタ・タイプ」として「クラス」を選択し、「セレクタ」として「*ui-widget*」を入力します。
+
+[start=16]
+. 「スタイルシート」として*「 ``css/mycss.css`` 」*を選択し、「@規則」として*(最大幅:480px)*を選択します。「OK」をクリックします。
「OK」をクリックすると、IDEにより新規ルールが ``mycss.css`` スタイル・シートに追加され、エディタにファイルが開きます。ファイルがエディタに開かない場合は、「CSSスタイル」ウィンドウの「 ``css/mycss.css`` 」ノードで「 ``ui-widget`` 」ルールをダブルクリックしてスタイル・シートを開くことができます。カーソルは、スタイル・シートのルールを含む行に配置されます。
-17. 次のプロパティと値(太字)を ``ui-widget`` のルールに追加します。
+
+[start=17]
+. 次のプロパティと値(太字)を ``ui-widget`` のルールに追加します。
[source,java]
----
@@ -274,7 +310,9 @@
ルールを追加した後で、メニューがページに収まることを確認できます。
image::images/html5-css-smartphonebrowser3.png[title="新しいCSSルールが適用された、ブラウザに表示されるページ"]
-18. ブラウザのNetBeansアイコンをクリックし、メニューで「タブレット縦」を選択します。
+
+[start=18]
+. ブラウザのNetBeansアイコンをクリックし、メニューで「タブレット縦」を選択します。
ブラウザ・ウィンドウがサイズ変更されたら、画面サイズが480ピクセル幅より大きい場合にスタイル・シートが表示に影響しないことを確認できます。
@@ -291,26 +329,44 @@
*注意:*LESSをOS Xにインストールする場合、Node.jsが ``usr/bin`` ディレクトリにあることを確認する必要がある場合があります。詳細は、次のlink:http://stackoverflow.com/questions/8638808/problems-with-less-sublime-text-build-system[+ノート+]を参照してください。
-2. 「ファイル」ウィンドウでHTML5Demoプロジェクトを展開します。
-3. 「ファイル」ウィンドウで「 ``public_html`` 」フォルダを右クリックし、ポップアップ・メニューで「新規」>「フォルダ」を選択します。
+
+[start=2]
+. 「ファイル」ウィンドウでHTML5Demoプロジェクトを展開します。
+
+[start=3]
+. 「ファイル」ウィンドウで「 ``public_html`` 」フォルダを右クリックし、ポップアップ・メニューで「新規」>「フォルダ」を選択します。
ポップアップ・メニューのオプションに「フォルダ」がない場合、「その他」を選択し、新規ファイル・ウィザードの「その他」カテゴリで「フォルダ」ファイル・タイプを選択します。
-4. 「ファイル名」に*「scss」*と入力します。「終了」をクリックします。
+
+[start=4]
+. 「ファイル名」に*「scss」*と入力します。「終了」をクリックします。
「終了」をクリックすると、 ``public_html`` フォルダに新しいフォルダが生成されます。
-5. 「プロジェクト」ウィンドウで「 ``css`` 」フォルダ・ノードを右クリックし、ポップアップ・メニューで「新規」>「Sassファイル」を選択します。
-6. 「ファイル名」に*「mysass」*と入力します。
-7. 「構成」をクリックし、「オプション」ウィンドウで「CSSプリプロセッサ」タブを開きます。
-8. Sass実行可能ファイルのパスを入力するか、「参照」をクリックしてローカル・システムで実行可能ファイルを検索します。「OK」をクリックして「オプション」ウィンドウを閉じます。
+
+[start=5]
+. 「プロジェクト」ウィンドウで「 ``css`` 」フォルダ・ノードを右クリックし、ポップアップ・メニューで「新規」>「Sassファイル」を選択します。
+
+[start=6]
+. 「ファイル名」に*「mysass」*と入力します。
+
+[start=7]
+. 「構成」をクリックし、「オプション」ウィンドウで「CSSプリプロセッサ」タブを開きます。
+
+[start=8]
+. Sass実行可能ファイルのパスを入力するか、「参照」をクリックしてローカル・システムで実行可能ファイルを検索します。「OK」をクリックして「オプション」ウィンドウを閉じます。
image::images/html5-css-cssoptions.png[title="新しいCSSルールが適用された、ブラウザに表示されるページ"]
-9. 新規ファイル・ウィザードで「保存時にSassファイルをコンパイル」を選択します。「OK」をクリックします。
+
+[start=9]
+. 新規ファイル・ウィザードで「保存時にSassファイルをコンパイル」を選択します。「OK」をクリックします。
image::images/html5-css-newsass.png[title="新しいCSSルールが適用された、ブラウザに表示されるページ"]
「OK」をクリックすると、新しいSassファイル ``mysass.scss`` がエディタで開きます。
-10. 次の内容を ``mysass.scss`` に追加し、変更を保存します。
+
+[start=10]
+. 次の内容を ``mysass.scss`` に追加し、変更を保存します。
[source,java]
----
@@ -342,7 +398,9 @@
* プリプロセッサ・ファイルが変更されて保存されるたびにスタイル・シートが再生成されるため、CSSルールを変更する場合、 ``mysass.css`` スタイル・シートではなく、Sassプリプロセッサ・ファイル ``mysass.scss`` を編集します。
* Sassの構文およびその他のSassの機能に関するドキュメントとしては、link:http://sass-lang.com/documentation/file.SASS_REFERENCE.html#[+Sass reference+]を参照してください。
-11. ``index.html`` を開いて次の変更を加え、スタイル・シートへのリンクを ``mycss.css`` から ``mysass.css`` に変更します。変更を保存します。
+
+[start=11]
+. ``index.html`` を開いて次の変更を加え、スタイル・シートへのリンクを ``mycss.css`` から ``mysass.css`` に変更します。変更を保存します。
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_pt_BR.asciidoc
index f940386..e3b2875 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_pt_BR.asciidoc
@@ -37,13 +37,7 @@
Para observar um screencast deste tutorial, consulte link:../web/html5-css-screencast.html[+Vídeo do Trabalho com Folhas de Estilo CSS em Aplicações HTML5+].
-
-
-image::images/netbeans-stamp-80-74.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.4 e 8.0"]
-
-
-
-==== Para concluir este tutorial, você precisará dos recursos a seguir:
+== Para concluir este tutorial, você precisará dos recursos a seguir:
|===
|Software ou Recurso |Versão Necessária
@@ -104,7 +98,9 @@
Você obsevará também que o ícone do NetBeans ficará visível no campo do local do URL do browser. É possível clicar no ícone para abrir um menu que oferece várias opções para alterar o tamanho de exibição do browser e para ativar o modo Inspecionar no NetBeans.
-3. Clique no ícone Abrir Ação do NetBeans no campo URL do browser para abrir o menu NetBeans e selecionar Retrato do Tablet no menu.
+
+[start=3]
+. Clique no ícone Abrir Ação do NetBeans no campo URL do browser para abrir o menu NetBeans e selecionar Retrato do Tablet no menu.
A janela é redimensionada para o tamanho de um browser do tablet em modo retrato. O menu é estendido para preencher o lado direito e todo o menu ficar visível.
@@ -112,7 +108,9 @@
Se você selecionar um dos dispositivos default no menu, a janela do browser se redimensionará de acordo com as dimensões do dispositivo. Isso permite que você veja como será a aparência da aplicação no dispositivo selecionado. As aplicações em HTML5 geralmente são projetadas para responder ao tamanho da tela do dispositivo em que são exibidas. Você pode usar regras de JavaScript e CSS que respondam ao tamanho da tela e modificar a forma como as aplicações são exibidas, de maneira que o layout seja otimizado para o dispositivo.
-4. Clique no ícone NetBeans novamente e selecione Paisagem do Smartphone no menu do NetBeans.
+
+[start=4]
+. Clique no ícone NetBeans novamente e selecione Paisagem do Smartphone no menu do NetBeans.
image::images/html5-css-tabletbrowser2.png[title="Selecione Paisagem do Smartphone no menu do NetBeans no browser"]
A janela é redimensionada para o tamanho de um smartphone em orientação paisagem e você poderá ver que a parte inferior do menu não fica visível sem a rolagem de tela.
@@ -136,7 +134,9 @@
Quando você clicar em Finalizar, a nova folha de estilo será aberta no editor.
-3. Adicione a regra de mídia a seguir à folha de estilo.
+
+[start=3]
+. Adicione a regra de mídia a seguir à folha de estilo.
[source,java]
----
@@ -151,9 +151,15 @@
Crie modelos de código para os snippets de código que você usa mais frequentemente. Você pode criar modelos de código CSS na guia Modelos de Código na categoria Editor da janela Opções.
-4. Salve as alterações.
-5. Abra ``index.html`` no editor.
-6. Adicione o link a seguir à folha de estilo entre as tags ``<head>`` no ``index.html`` . Salve as alterações.
+
+[start=4]
+. Salve as alterações.
+
+[start=5]
+. Abra ``index.html`` no editor.
+
+[start=6]
+. Adicione o link a seguir à folha de estilo entre as tags ``<head>`` no ``index.html`` . Salve as alterações.
[source,java]
----
@@ -195,26 +201,42 @@
O painel inferior exibe todas as propriedades definidas na regra CSS para a regra que está selecionada no painel central. Nesse caso, é possível verificar que a regra para ``img`` define as propriedades ``borda`` , ``flutuação`` e ``margem`` .
-3. Clique na guia Documento na janela Estilos de CSS.
-4. Selecione o nó ``css/mycss.css`` e clique no botão Editar Regras de CSS (image::images/newcssrule.png[title="Botão Editar Regras de CSS"]) para abrir a caixa de diálogo Editar Regras de CSS.
+
+[start=3]
+. Clique na guia Documento na janela Estilos de CSS.
+
+[start=4]
+. Selecione o nó ``css/mycss.css`` e clique no botão Editar Regras de CSS (image::images/newcssrule.png[title="Botão Editar Regras de CSS"]) para abrir a caixa de diálogo Editar Regras de CSS.
image::images/html5-css-styleswindow2.png[title="Caixa de diálogo Editar Regras de CSS"]
-5. Selecione o Elemento como Tipo de Seletor e digite *img* como Seletor.
-6. Selecione ``css/mycss.css`` como Folha de Estilo e *(max-width:480px)* como Na Regra. Clique em OK.
+
+[start=5]
+. Selecione o Elemento como Tipo de Seletor e digite *img* como Seletor.
+
+[start=6]
+. Selecione ``css/mycss.css`` como Folha de Estilo e *(max-width:480px)* como Na Regra. Clique em OK.
image::images/html5-css-editcssrules.png[title="Caixa de diálogo Editar Regras de CSS"]
Quando você clica em OK, o IDE cria uma regra de CSS para ``img`` na folha de estilo ``css/mycss.css`` entre os colchetes da regra de mídia. A nova regra agora está listada no painel Estilos Aplicados.
-7. Clique na guia Seleção na janela Estilos de CSS.
+
+[start=7]
+. Clique na guia Seleção na janela Estilos de CSS.
Você pode ver que há duas regras de CSS para ``img`` . Uma das regras está localizada em ``mycss.css`` e a outra em ``basecss.css`` .
-8. Selecione a nova regra ``img`` (definida em ``mycss.css`` ) no painel Estilos Aplicados da janela Estilos de CSS.
+
+[start=8]
+. Selecione a nova regra ``img`` (definida em ``mycss.css`` ) no painel Estilos Aplicados da janela Estilos de CSS.
image::images/html5-css-styleswindow2.png[title="Estilos para o elemento selecionado na janela Estilos de CSS."]
No painel inferior da janela, você pode ver que a regra não têm propriedades.
-9. Clique em Adicionar Propriedade na coluna esquerda, no painel inferior da janela Estilos de CSS e digite *largura*.
-10. Digite *90px* na coluna direita próxima à propriedade ``width`` e tecle em Voltar ao teclado.
+
+[start=9]
+. Clique em Adicionar Propriedade na coluna esquerda, no painel inferior da janela Estilos de CSS e digite *largura*.
+
+[start=10]
+. Digite *90px* na coluna direita próxima à propriedade ``width`` e tecle em Voltar ao teclado.
image::images/html5-css-styleswindow3.png[title="Painel Propriedades da Imagem da janela Estilos de CSS"]
Quando você começar a digitar na coluna de valor verá que uma lista drop-down exibirá valores comuns para a propriedades ``width`` .
@@ -237,7 +259,9 @@
Algumas alterações adicionais precisam ser feitas na folha de estilo porque o menu ainda não cabe na janela.
-11. Selecione o elemento ( ``<ul>`` ) da lista não ordenada na janela do browser.
+
+[start=11]
+. Selecione o elemento ( ``<ul>`` ) da lista não ordenada na janela do browser.
image::images/html5-css-smartphonebrowser2.png[title="Elemento da lista selecionado no browser"]
Quando você seleciona o elemento, pode ver que ``<ul>`` está selecionada na janela Browser DOM e você pode ver os estilos aplicados a esse elemento na janela Estilo de CSS.
@@ -246,16 +270,28 @@
Se você selecionar ``font-family`` na janela Estilos de CSS, poderá ver que a propriedade e o valor ``font-family`` são definidos no seletor de classe ``.ui-widget`` .
-12. Clique no arquivo ``index.html`` no editor e clique na guia Documento na janela Estilos de CSS.
-13. Expanda o nó ``css/mycss.css`` ma janela de Estilos de CSS.
+
+[start=12]
+. Clique no arquivo ``index.html`` no editor e clique na guia Documento na janela Estilos de CSS.
+
+[start=13]
+. Expanda o nó ``css/mycss.css`` ma janela de Estilos de CSS.
image::images/html5-css-styleswindow4.png[title="Folha de Estilo selecionada na guia Documento da janela Estilos de CSS"]
-14. Clique no botão Editar Regras de CSS (image::images/newcssrule.png[title="Botão Editar Regras de CSS"]) na janela Estilos de CSS para abrir a caixa de diálogo Editar Regras de CSS.
-15. Selecione a Classe como Tipo de Seletor e digite *ui-widget* como Seletor.
-16. Selecione * ``css/mycss.css`` * como Folha de Estilo e *(max-width:480px)* como Na Regra. Clique em OK.
+
+[start=14]
+. Clique no botão Editar Regras de CSS (image::images/newcssrule.png[title="Botão Editar Regras de CSS"]) na janela Estilos de CSS para abrir a caixa de diálogo Editar Regras de CSS.
+
+[start=15]
+. Selecione a Classe como Tipo de Seletor e digite *ui-widget* como Seletor.
+
+[start=16]
+. Selecione * ``css/mycss.css`` * como Folha de Estilo e *(max-width:480px)* como Na Regra. Clique em OK.
Quando você clica em OK, o IDE adiciona a nova regra à folha de estilo ``mycss.css`` e abre o arquivo no editor. Se o arquivo não for aberto no editor, você pode clicar duas vezes na regra ``ui-widget`` no nó ``css/mycss.css`` na janela Estilos de CSS para abrir a folha de estilo. O cursor é colocado na linha que contém a regra na folha de estilo.
-17. Adicione a propriedade e o valor (em negrito) a seguir à regra para a ``ui-widget`` .
+
+[start=17]
+. Adicione a propriedade e o valor (em negrito) a seguir à regra para a ``ui-widget`` .
[source,java]
----
@@ -274,7 +310,9 @@
Depois de adicionar a regra, você pode ver que o menu agora se ajusta à página.
image::images/html5-css-smartphonebrowser3.png[title="Página exibida no browser com novas regras de CSS aplicadas"]
-18. Clique no ícone do NetBeans no browser e selecione Retrato do Tablet no menu.
+
+[start=18]
+. Clique no ícone do NetBeans no browser e selecione Retrato do Tablet no menu.
Quando a janela do browser é redimensionada, você pode ver que as alterações na folha de estilo não afetam a exibição quando o tamanho da tela é maior do que 480 pixels de largura.
@@ -291,26 +329,44 @@
*Observação.* Se estiver instalando o LESS no OS X pode ser necessário confirmar se o Node.js pode ser encontrado no diretório ``usr/bin`` . Para obter detalhes, consulte a seguinte link:http://stackoverflow.com/questions/8638808/problems-with-less-sublime-text-build-system[+nota+].
-2. Expanda o projeto HTML5Demo na janela Arquivos.
-3. Clique com o botão direito do mouse na pasta ``public_html`` na janela Arquivos e escolha Nova > Pasta no menu pop-up.
+
+[start=2]
+. Expanda o projeto HTML5Demo na janela Arquivos.
+
+[start=3]
+. Clique com o botão direito do mouse na pasta ``public_html`` na janela Arquivos e escolha Nova > Pasta no menu pop-up.
Se Pasta não for uma opção no menu pop-up, escolha Outro e selecione o tipo de arquivo Pasta na categoria Outro do assistente Novo Arquivo.
-4. Digite *scss* para Nome do Arquivo. Clique em Finalizar.
+
+[start=4]
+. Digite *scss* para Nome do Arquivo. Clique em Finalizar.
Quando você clicar em Finalizar o IDE gerará a nova pasta na pasta ``public_html`` .
-5. Clique com o botão direito do mouse no nó da pasta ``scss`` , na janela Projetos, e escolha Novo > Arquivo Sass no menu pop-up.
-6. Digite *mysass* como o Nome do Arquivo.
-7. Clique em Configurar para abrir a guia Pré-processador de CSS na janela Opções.
-8. Digite o caminho para o executável Sass ou clique em Procurar para localizar o executável em seu sistema local. Clique em OK para fechar a janela Opções.
+
+[start=5]
+. Clique com o botão direito do mouse no nó da pasta ``scss`` , na janela Projetos, e escolha Novo > Arquivo Sass no menu pop-up.
+
+[start=6]
+. Digite *mysass* como o Nome do Arquivo.
+
+[start=7]
+. Clique em Configurar para abrir a guia Pré-processador de CSS na janela Opções.
+
+[start=8]
+. Digite o caminho para o executável Sass ou clique em Procurar para localizar o executável em seu sistema local. Clique em OK para fechar a janela Opções.
image::images/html5-css-cssoptions.png[title="Página exibida no browser com novas regras de CSS aplicadas"]
-9. Selecione Compilar Arquivos Sass ao Salvar no assistente Novo Arquivo. Clique em OK.
+
+[start=9]
+. Selecione Compilar Arquivos Sass ao Salvar no assistente Novo Arquivo. Clique em OK.
image::images/html5-css-newsass.png[title="Página exibida no browser com novas regras de CSS aplicadas"]
Quando clicar em OK, o novo arquivo ``mysass.scss`` de Sass será aberto no editor.
-10. Adicione o seguinte em ``mysass.scss`` e salve suas alterações.
+
+[start=10]
+. Adicione o seguinte em ``mysass.scss`` e salve suas alterações.
[source,java]
----
@@ -342,7 +398,9 @@
* Quando quiser modificar as regras de CSS você deve editar o arquivo ``mysass.scss`` do pré-processador de Sass e não a folha de estilos ``mysass.css`` porque a folha de estilos é gerada novamente cada vez que o arquivo do pré-processador é modificado e salvo.
* Para documentação sobre a sintaxe de Sass e outras funcionalidades de Sass, consulte a link:http://sass-lang.com/documentation/file.SASS_REFERENCE.html#[+referência de Sass+].
-11. Abra ``index.html`` e faça as seguintes alterações no link da folha de estilos de ``mycss.css`` para ``mysass.css`` . Salve as alterações.
+
+[start=11]
+. Abra ``index.html`` e faça as seguintes alterações no link da folha de estilos de ``mycss.css`` para ``mysass.css`` . Salve as alterações.
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ru.asciidoc
index ac2a136..cc0f561 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_ru.asciidoc
@@ -37,13 +37,7 @@
Для просмотра демонстрационного ролика этого учебного курса см. раздел link:../web/html5-css-screencast.html[+Видеоролик по работе со страницами стилей CSS в приложениях HTML5+].
-
-
-image::images/netbeans-stamp-80-74.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.4 и 8.0"]
-
-
-
-==== Для выполнения этого учебного курса потребуются следующие материалы.
+== Для выполнения этого учебного курса потребуются следующие материалы.
|===
|Программное обеспечение или ресурс |Требуемая версия
@@ -104,7 +98,9 @@
Также следует отметить, что значок NetBeans отображается в местоположении адреса URL поля браузера. Вы можете щелкнуть значок, чтобы открыть меню, которое предоставляет различные варианты для изменения размера изображения в браузере, и для включения режима проверки в режиме NetBeans.
-3. Щелкните значок 'Открыть действие NetBeans' в адресной строке браузера URL, чтобы открыть меню NetBeans и выбрать в меню 'Планшет - портрет'.
+
+[start=3]
+. Щелкните значок 'Открыть действие NetBeans' в адресной строке браузера URL, чтобы открыть меню NetBeans и выбрать в меню 'Планшет - портрет'.
Размер окна изменится до размеров браузера планшета в режиме портрета. Меню можно растянуть, чтобы заполнить правую сторону, после чего меню будет видно полностью.
@@ -112,7 +108,9 @@
Если выбрать одно из заданных по умолчанию устройств в меню, окно браузера изменится до размеров устройства. Это позволит увидеть, как приложение будет выглядеть на выбранном устройстве. Приложения HTML5 обычно реагируют на размер экрана устройства, на котором они просматриваются. Можно использовать правила JavaScript и CSS, которые реагируют на размер экрана, а также изменять способ отображения приложений так, чтобы макет был оптимизирован для устройства.
-4. Щелкните значок NetBeans еще раз и выберите 'Смартфон - пейзаж' в меню NetBeans.
+
+[start=4]
+. Щелкните значок NetBeans еще раз и выберите 'Смартфон - пейзаж' в меню NetBeans.
image::images/html5-css-tabletbrowser2.png[title="Выберите 'Смартфон - пейзаж' в меню NetBeans в браузере"]
Размер окна изменяется до размера смартфона в горизонтальной ориентации, и пользователь сможет увидеть, что нижняя часть меню без прокрутки не видна.
@@ -136,7 +134,9 @@
После нажатия кнопки 'Готово' таблица новых стилей открывается в редакторе.
-3. Добавьте следующее правило носителей к таблице стилей.
+
+[start=3]
+. Добавьте следующее правило носителей к таблице стилей.
[source,java]
----
@@ -151,9 +151,15 @@
Создание шаблонов кода для фрагментов кода, которые можно использовать часто. Можно создавать шаблоны кода CSS на вкладке 'Шаблоны кода' в категории 'Редактор' окна 'Параметры'.
-4. Сохраните изменения.
-5. Откройте ``index.html`` в редакторе.
-6. Добавьте следующую ссылку на таблицу стилей между тегами ``<head>`` в ``index.html`` . Сохраните изменения.
+
+[start=4]
+. Сохраните изменения.
+
+[start=5]
+. Откройте ``index.html`` в редакторе.
+
+[start=6]
+. Добавьте следующую ссылку на таблицу стилей между тегами ``<head>`` в ``index.html`` . Сохраните изменения.
[source,java]
----
@@ -195,26 +201,42 @@
В нижней панели отображаются все свойства, которые определены в правиле CSS для правила, выбранного в средней панели. В этом случае видно, что правило для ``img`` определяет свойства ``border`` , ``float`` и ``margin-right`` .
-3. В окне 'Стили CSS' перейдите на вкладку 'Документы'.
-4. Выберите узел ``css/mycss.css`` и нажмите кнопку 'Изменить правила CSS' (image::images/newcssrule.png[title="Кнопка 'Изменить правила CSS'"]). В результате откроется диалоговое окно 'Изменение правил CSS'.
+
+[start=3]
+. В окне 'Стили CSS' перейдите на вкладку 'Документы'.
+
+[start=4]
+. Выберите узел ``css/mycss.css`` и нажмите кнопку 'Изменить правила CSS' (image::images/newcssrule.png[title="Кнопка 'Изменить правила CSS'"]). В результате откроется диалоговое окно 'Изменение правил CSS'.
image::images/html5-css-styleswindow2.png[title="Диалоговое окно 'Изменение правил CSS'"]
-5. Выберите элемент в качестве типа средства выбора и введите *img* в качестве средства выбора.
-6. Выберите ``css/mycss.css`` в качестве таблицы стилей и *(макс-шир:480пкс)* как At-Rule. Нажмите кнопку 'ОК'.
+
+[start=5]
+. Выберите элемент в качестве типа средства выбора и введите *img* в качестве средства выбора.
+
+[start=6]
+. Выберите ``css/mycss.css`` в качестве таблицы стилей и *(макс-шир:480пкс)* как At-Rule. Нажмите кнопку 'ОК'.
image::images/html5-css-editcssrules.png[title="Диалоговое окно 'Изменение правил CSS'"]
При нажатии кнопки ОК в IDE создается правило CSS для ``img`` в таблице стилей ``css/mycss.css`` между скобками правила носителей. Новое правило сейчас указано на панели 'Примененные стили'.
-7. В окне 'Стили CSS' перейдите на вкладку 'Выбор'.
+
+[start=7]
+. В окне 'Стили CSS' перейдите на вкладку 'Выбор'.
Можно видеть, что имеется два правила CSS для ``img`` . Одно из правил находится в ``mycss.css`` , а другое находится в ``basecss.css`` .
-8. Выберите новое правило ``img`` (определено в ``mycss.css`` ) на панели 'Примененные стили' в окне 'Стили CSS'.
+
+[start=8]
+. Выберите новое правило ``img`` (определено в ``mycss.css`` ) на панели 'Примененные стили' в окне 'Стили CSS'.
image::images/html5-css-styleswindow2.png[title="Стили для выбранного элемента в окне 'Стили CSS'"]
В нижней панели окна видно, что это правило не имеет свойств.
-9. Нажмите 'Добавить свойство' в левом столбце нижней панели окна 'Стили CSS' и введите *width*.
-10. Введите *90px* в правом столбце напротив свойства ``width`` и нажмите клавишу Return.
+
+[start=9]
+. Нажмите 'Добавить свойство' в левом столбце нижней панели окна 'Стили CSS' и введите *width*.
+
+[start=10]
+. Введите *90px* в правом столбце напротив свойства ``width`` и нажмите клавишу Return.
image::images/html5-css-styleswindow3.png[title="Панель 'Свойства изображения' в окне 'Стили CSS'"]
При вводе символов в столбце значений отображается список часто используемых значений свойства ``width`` .
@@ -237,7 +259,9 @@
Некоторые дополнительные изменения должны быть внесены в таблицу стилей, потому что меню по-прежнему не помещается в окно.
-11. Выберите элемент неупорядоченного списка ( ``<ul>`` ) в окне браузера.
+
+[start=11]
+. Выберите элемент неупорядоченного списка ( ``<ul>`` ) в окне браузера.
image::images/html5-css-smartphonebrowser2.png[title="Выводит список элементов, выбранных в браузере"]
При выборе элемента списка в окне 'Обзор DOM' выбирается элемент ``<ul>`` , а в окне 'Стили CSS' отображаются стили, примененные к этому элементу.
@@ -246,16 +270,28 @@
Если выбрать ``font-family`` в окне 'Стили CSS', то видно, что свойство и значение ``font-family`` определены в средстве выбора классов ``.ui-widget`` .
-12. Щелкните файл ``index.html`` в редакторе, а затем перейдите на вкладку 'Документ' в окне 'Стили CSS'.
-13. Разверните узел ``css/mycss.css`` в окне 'Стили CSS'.
+
+[start=12]
+. Щелкните файл ``index.html`` в редакторе, а затем перейдите на вкладку 'Документ' в окне 'Стили CSS'.
+
+[start=13]
+. Разверните узел ``css/mycss.css`` в окне 'Стили CSS'.
image::images/html5-css-styleswindow4.png[title="Таблица стилей, выбранная на вкладке 'Документ' окна 'Стили CSS'"]
-14. Нажмите кнопку 'Изменить правила CSS' (image::images/newcssrule.png[title="Кнопка 'Изменить правила CSS'"]) в окне 'Стили CSS', чтобы открыть диалоговое окно 'Изменить правила CSS'.
-15. Выберите 'Класс' как 'Тип средства выбора' и введите *ui-widget* как 'Средство выбора'.
-16. Выберите * ``css/mycss.css`` * как таблицу стилей и *(макс-шир:480пкс)* как At-Rule. Нажмите OK.
+
+[start=14]
+. Нажмите кнопку 'Изменить правила CSS' (image::images/newcssrule.png[title="Кнопка 'Изменить правила CSS'"]) в окне 'Стили CSS', чтобы открыть диалоговое окно 'Изменить правила CSS'.
+
+[start=15]
+. Выберите 'Класс' как 'Тип средства выбора' и введите *ui-widget* как 'Средство выбора'.
+
+[start=16]
+. Выберите * ``css/mycss.css`` * как таблицу стилей и *(макс-шир:480пкс)* как At-Rule. Нажмите OK.
После щелчка OK в IDE добавляется новое правило к таблице стилей ``mycss.css`` и открывается файл в редакторе. Если файл не открывается в редакторе, вы можете дважды щелкнуть правило ``ui-widget`` в узле ``css/mycss.css`` окна таблицы стилей, чтобы открыть таблицу стилей. Курсор помещается в строку, содержащую правило в таблице стилей.
-17. Добавьте следующее свойство и значение (выделено полужирным шрифтом) к правилу для ``ui-widget`` .
+
+[start=17]
+. Добавьте следующее свойство и значение (выделено полужирным шрифтом) к правилу для ``ui-widget`` .
[source,java]
----
@@ -274,7 +310,9 @@
После добавления правила видно, что меню теперь помещается на странице.
image::images/html5-css-smartphonebrowser3.png[title="Страница, просматриваемая в браузере, с новыми примененными правилами CSS"]
-18. Щелкните значок NetBeans в браузере и выберите в меню 'Планшет- портрет'.
+
+[start=18]
+. Щелкните значок NetBeans в браузере и выберите в меню 'Планшет- портрет'.
После изменения размера окна стало очевидно, что изменения таблицы стилей не повлияли на отображаемое изображение, если ширина экрана была больше 480 пикселей.
@@ -291,26 +329,44 @@
*Примечание.* При установке препроцессора LESS в операционной системе X убедитесь, что в каталоге ``usr/bin`` присутствует файл Node.js. Дополнительные сведения см. в link:http://stackoverflow.com/questions/8638808/problems-with-less-sublime-text-build-system[+примечании+].
-2. Разверните структуру проекта HTML5Demo в окне 'Файлы'.
-3. В том же окне 'Файлы' щелкните правой кнопкой мыши папку ``public_html`` и выберите Создать > Папка в раскрывающемся меню.
+
+[start=2]
+. Разверните структуру проекта HTML5Demo в окне 'Файлы'.
+
+[start=3]
+. В том же окне 'Файлы' щелкните правой кнопкой мыши папку ``public_html`` и выберите Создать > Папка в раскрывающемся меню.
Если в меню нет пункта 'Папка', выберите 'Другие' и укажите тип файла 'Папка' в категории 'Другие' мастера создания проектов.
-4. В поле 'Имя файла' введите *scss*. Нажмите кнопку 'Готово'.
+
+[start=4]
+. В поле 'Имя файла' введите *scss*. Нажмите кнопку 'Готово'.
При нажатии кнопки 'Готово' в мастере среда IDE создает новую вложенную папку в папке ``public_htmll`` .
-5. Щелкните правой кнопкой мыши узел папки ``scss`` в окне 'Проекты' и выберите Создать > Файл Sass в раскрывающемся меню.
-6. В поле 'Имя файла' введите *mysass*.
-7. Нажмите 'Настроить'. В результате откроется вкладка 'Препроцессор CSS' в окне 'Параметры'.
-8. Укажите путь к исполняемому файлу Sass или нажмите кнопку 'Обзор' и найдите исполняемый файл на локальном компьютере. Для закрытия окна "Параметры" нажмите кнопку "ОК".
+
+[start=5]
+. Щелкните правой кнопкой мыши узел папки ``scss`` в окне 'Проекты' и выберите Создать > Файл Sass в раскрывающемся меню.
+
+[start=6]
+. В поле 'Имя файла' введите *mysass*.
+
+[start=7]
+. Нажмите 'Настроить'. В результате откроется вкладка 'Препроцессор CSS' в окне 'Параметры'.
+
+[start=8]
+. Укажите путь к исполняемому файлу Sass или нажмите кнопку 'Обзор' и найдите исполняемый файл на локальном компьютере. Для закрытия окна "Параметры" нажмите кнопку "ОК".
image::images/html5-css-cssoptions.png[title="Страница, просматриваемая в браузере, с новыми примененными правилами CSS"]
-9. В мастере создания файлов выберите 'Компилировать файлы Sass при сохранении'. Нажмите кнопку 'ОК'.
+
+[start=9]
+. В мастере создания файлов выберите 'Компилировать файлы Sass при сохранении'. Нажмите кнопку 'ОК'.
image::images/html5-css-newsass.png[title="Страница, просматриваемая в браузере, с новыми примененными правилами CSS"]
При нажатии кнопки ОК в редакторе открывается новый файл Sass ``mysass.scss`` .
-10. Добавьте следующие элементы в файл ``mysass.scss`` и сохраните изменения.
+
+[start=10]
+. Добавьте следующие элементы в файл ``mysass.scss`` и сохраните изменения.
[source,java]
----
@@ -342,7 +398,9 @@
* Если вы хотите изменить правила CSS, необходимо вносить изменения в файл препроцессора Sass ``mysass.scss`` , а не в файл таблицы стилей ``mysass.css`` , потому что таблица стилей создается заново при каждом сохранении измененного файла препроцессора.
* Документацию о синтаксисе Sass и других компонентах Sass см. в разделе link:http://sass-lang.com/documentation/file.SASS_REFERENCE.html#[+Справочные материалы Sass+].
-11. Откройте файл ``index.html`` и измените ссылку на таблицу стилей с ``mycss.css`` на ``mysass.css`` . Сохраните изменения.
+
+[start=11]
+. Откройте файл ``index.html`` и измените ссылку на таблицу стилей с ``mycss.css`` на ``mysass.css`` . Сохраните изменения.
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_zh_CN.asciidoc
index 4dfbd57..fe33156 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-editing-css_zh_CN.asciidoc
@@ -37,13 +37,7 @@
要观看此教程的截屏视频,请参阅link:../web/html5-css-screencast.html[+在 HTML5 应用程序中使用 CSS 样式表的视频+]。
-
-
-image::images/netbeans-stamp-80-74.png[title="此页上的内容适用于 NetBeans IDE 7.4 和 8.0"]
-
-
-
-==== 要完成本教程,需要使用以下资源。
+== 要完成本教程,需要使用以下资源。
|===
|软件或资源 |要求的版本
@@ -104,7 +98,9 @@
您还可以看到,NetBeans 图标在浏览器的 URL 位置字段中可见。您可以单击图标以打开提供了各种选项的菜单,用于更改浏览器的显示大小和启用在 NetBeans 中检查模式。
-3. 单击浏览器 URL 字段中的 "Open NetBeans Action"(打开 NetBeans 操作)图标以打开 NetBeans 菜单,然后在菜单中选择 "Tablet Portrait"(平板电脑纵向)。
+
+[start=3]
+. 单击浏览器 URL 字段中的 "Open NetBeans Action"(打开 NetBeans 操作)图标以打开 NetBeans 菜单,然后在菜单中选择 "Tablet Portrait"(平板电脑纵向)。
窗口的大小将调整为平板电脑浏览器在纵向模式下的大小。菜单扩展以填充右侧,整个菜单可见。
@@ -112,7 +108,9 @@
如果在菜单中选择了默认设备之一,则浏览器窗口将调整到该设备尺寸的大小。这使您可以查看应用程序在所选设备上的外观如何。HTML5 应用程序通常设计为可以根据查看这些应用程序所用设备的屏幕大小做出响应。您可以使用响应屏幕大小的 JavaScript 和 CSS 规则并修改应用程序的显示方式,这样就可以针对设备优化布局。
-4. 再次单击 NetBeans 图标并在 NetBeans 菜单中选择 "Smartphone Landscape"(智能手机横向)。
+
+[start=4]
+. 再次单击 NetBeans 图标并在 NetBeans 菜单中选择 "Smartphone Landscape"(智能手机横向)。
image::images/html5-css-tabletbrowser2.png[title="在浏览器的 NetBeans 菜单中选择 "Smartphone Landscape"(智能手机横向)"]
窗口的大小将调整为智能手机横向的大小,您可以看到,需要滚动才能看到菜单的底部。
@@ -136,7 +134,9 @@
单击“完成”时,新样式表将在编辑器中打开。
-3. 将以下媒体规则添加到样式表中。
+
+[start=3]
+. 将以下媒体规则添加到样式表中。
[source,java]
----
@@ -151,9 +151,15 @@
为可能经常使用的代码片段创建代码模板。您可以在“选项”窗口中“编辑器”类别的“代码模板”标签中创建 CSS 代码模板。
-4. 保存所做的更改。
-5. 在编辑器中打开 ``index.html`` 。
-6. 将以下样式表链接添加到 ``index.html`` 的 ``<head>`` 标记之间。保存所做的更改。
+
+[start=4]
+. 保存所做的更改。
+
+[start=5]
+. 在编辑器中打开 ``index.html`` 。
+
+[start=6]
+. 将以下样式表链接添加到 ``index.html`` 的 ``<head>`` 标记之间。保存所做的更改。
[source,java]
----
@@ -195,26 +201,42 @@
底部窗格显示在 CSS 规则中为在中间窗格中选择的规则定义的所有属性。在本例中,您可以看到 ``img`` 的规则定义了 ``border`` 、 ``float`` 和 ``margin-right`` 属性。
-3. 在 "CSS Styles"(CSS 样式)窗口中单击 "Document"(文档)标签。
-4. 选择 ``css/mycss.css`` 节点,然后单击 "Edit CSS Rules"(编辑 CSS 规则)按钮 (image::images/newcssrule.png[title=""Edit CSS Rules"(编辑 CSS 规则)按钮"]) 窗口以打开 "Edit CSS Rules"(编辑 CSS 规则)对话框。
+
+[start=3]
+. 在 "CSS Styles"(CSS 样式)窗口中单击 "Document"(文档)标签。
+
+[start=4]
+. 选择 ``css/mycss.css`` 节点,然后单击 "Edit CSS Rules"(编辑 CSS 规则)按钮 (image::images/newcssrule.png[title=""Edit CSS Rules"(编辑 CSS 规则)按钮"]) 窗口以打开 "Edit CSS Rules"(编辑 CSS 规则)对话框。
image::images/html5-css-styleswindow2.png[title=""Edit CSS Rules"(编辑 CSS 规则)对话框"]
-5. 为 "Selector Type"(选择器类型)选择 "Element"(元素),为 "Selector"(选择器)选择类型 *img*。
-6. 为 "Style Sheet"(样式表)选择 ``css/mycss.css`` ,为 "At-Rule"(@ 规则)选择 *(max-width:480px)*。单击 "OK"(确定)。
+
+[start=5]
+. 为 "Selector Type"(选择器类型)选择 "Element"(元素),为 "Selector"(选择器)选择类型 *img*。
+
+[start=6]
+. 为 "Style Sheet"(样式表)选择 ``css/mycss.css`` ,为 "At-Rule"(@ 规则)选择 *(max-width:480px)*。单击 "OK"(确定)。
image::images/html5-css-editcssrules.png[title=""Edit CSS Rules"(编辑 CSS 规则)对话框"]
单击 "OK"(确定)时,IDE 将在媒体规则的方括号之间,为 ``css/mycss.css`` 样式表中的 ``img`` 创建 CSS 规则。新规则现在列出在 "Applied Styles"(应用的样式)窗格中。
-7. 在 "CSS Styles"(CSS 样式)窗口中单击 "Selection"(选择)标签。
+
+[start=7]
+. 在 "CSS Styles"(CSS 样式)窗口中单击 "Selection"(选择)标签。
您可以看到 ``img`` 有两个 CSS 规则。一个规则位于 ``mycss.css`` 中,一个规则位于 ``basecss.css`` 中。
-8. 选择新的 ``img`` 规则(在 "CSS Styles"(CSS 样式)窗口的 "Applied Styles"(应用的样式)窗格的 ``mycss.css`` 中定义)。
+
+[start=8]
+. 选择新的 ``img`` 规则(在 "CSS Styles"(CSS 样式)窗口的 "Applied Styles"(应用的样式)窗格的 ``mycss.css`` 中定义)。
image::images/html5-css-styleswindow2.png[title=""CSS Styles"(CSS 样式)窗口中所选元素的样式"]
在窗口的底部窗格中,可以看到该规则没有任何属性。
-9. 在 "CSS Styles"(CSS 样式)窗口底部窗格的左列中单击 "Add Property"(添加属性),然后键入 *width*。
-10. 在 ``width`` 属性旁边的右列中键入 *90px*,然后按键盘上的回车键。
+
+[start=9]
+. 在 "CSS Styles"(CSS 样式)窗口底部窗格的左列中单击 "Add Property"(添加属性),然后键入 *width*。
+
+[start=10]
+. 在 ``width`` 属性旁边的右列中键入 *90px*,然后按键盘上的回车键。
image::images/html5-css-styleswindow3.png[title=""CSS Styles"(CSS 样式)窗口的 "Image Properties"(图像属性)窗格"]
当您开始在值列中键入内容时,您会看到一个下拉列表显示 ``width`` 属性的常用值。
@@ -237,7 +259,9 @@
由于菜单仍不适合窗口,还需要对样式表做一些其他更改。
-11. 在浏览器窗口中选择无序列表 ( ``<ul>`` ) 元素。
+
+[start=11]
+. 在浏览器窗口中选择无序列表 ( ``<ul>`` ) 元素。
image::images/html5-css-smartphonebrowser2.png[title="列出在浏览器中选择的元素"]
选择元素时,在 "Browser DOM"(浏览器 DOM)窗口中可以看到选择了 ``<ul>`` ,在 "CSS Styles"(CSS 样式)窗口中可以看到应用到该元素的样式。
@@ -246,16 +270,28 @@
在 "CSS Styles"(CSS 样式)窗口中选择 ``font-family`` 时,可以看到在 ``.ui-widget`` 类选择器中定义了 ``font-family`` 属性和值。
-12. 在编辑器中单击 ``index.html`` 文件,然后在 "CSS Styles"(CSS 样式)窗口中单击 "Document"(文档)标签。
-13. 在 "CSS Styles"(CSS 样式)窗口中展开 ``css/mycss.css`` 节点。
+
+[start=12]
+. 在编辑器中单击 ``index.html`` 文件,然后在 "CSS Styles"(CSS 样式)窗口中单击 "Document"(文档)标签。
+
+[start=13]
+. 在 "CSS Styles"(CSS 样式)窗口中展开 ``css/mycss.css`` 节点。
image::images/html5-css-styleswindow4.png[title="在 "CSS Styles"(CSS 样式)窗口的 "Document"(文档)标签中选择的样式表"]
-14. 在 "CSS Styles"(CSS 样式)窗口中,单击 "Edit CSS Rules"(编辑 CSS 规则)按钮 (image::images/newcssrule.png[title=""Edit CSS Rules"(编辑 CSS 规则)按钮"]) 可打开 "Edit CSS Rules"(编辑 CSS 规则)对话框。
-15. 为 "Selector Type"(选择器类型)选择 "Class"(类),为 "Selector"(选择器)选择类型 *ui-widget*。
-16. 为 "Style Sheet"(样式表)选择 * ``css/mycss.css`` *,为 "At-Rule"(@ 规则)选择 *(max-width:480px)*。单击 "OK"(确定)。
+
+[start=14]
+. 在 "CSS Styles"(CSS 样式)窗口中,单击 "Edit CSS Rules"(编辑 CSS 规则)按钮 (image::images/newcssrule.png[title=""Edit CSS Rules"(编辑 CSS 规则)按钮"]) 可打开 "Edit CSS Rules"(编辑 CSS 规则)对话框。
+
+[start=15]
+. 为 "Selector Type"(选择器类型)选择 "Class"(类),为 "Selector"(选择器)选择类型 *ui-widget*。
+
+[start=16]
+. 为 "Style Sheet"(样式表)选择 * ``css/mycss.css`` *,为 "At-Rule"(@ 规则)选择 *(max-width:480px)*。单击 "OK"(确定)。
单击 "OK"(确定)时,IDE 将新规则添加到 ``mycss.css`` 样式表并在编辑器中打开文件。如果文件未在编辑器中打开,您可以在 "CSS Styles"(CSS 样式)窗口中双击 ``css/mycss.css`` 节点下的 ``ui-widget`` 规则以打开样式表。光标放在样式表中包含规则的行内。
-17. 向 ``ui-widget`` 的规则添加以下属性和值(粗体)。
+
+[start=17]
+. 向 ``ui-widget`` 的规则添加以下属性和值(粗体)。
[source,java]
----
@@ -274,7 +310,9 @@
添加规则之后,可以看到菜单现在与页面大小相符。
image::images/html5-css-smartphonebrowser3.png[title="在浏览器中查看应用了新 CSS 规则的页面"]
-18. 单击浏览器中的 NetBeans 图标并在菜单中选择 "Tablet Portrait"(平板电脑纵向)。
+
+[start=18]
+. 单击浏览器中的 NetBeans 图标并在菜单中选择 "Tablet Portrait"(平板电脑纵向)。
浏览器窗口大小调整时,可以看到,屏幕宽度大小超过 480 像素时,对样式表的更改不会影响显示。
@@ -291,26 +329,44 @@
*注:*如果在 OS X 上安装 LESS,则您可能需要确认可以在 ``usr/bin`` 目录中找到 Node.js。有关详细信息,请参见下面的link:http://stackoverflow.com/questions/8638808/problems-with-less-sublime-text-build-system[+注+]。
-2. 在 "Files"(文件)窗口中展开 HTML5Demo 项目。
-3. 在 "Files"(文件)窗口中右键单击 ``public_html`` 文件夹,然后在弹出菜单中选择 "New"(新建)> "Folder"(文件夹)。
+
+[start=2]
+. 在 "Files"(文件)窗口中展开 HTML5Demo 项目。
+
+[start=3]
+. 在 "Files"(文件)窗口中右键单击 ``public_html`` 文件夹,然后在弹出菜单中选择 "New"(新建)> "Folder"(文件夹)。
如果在弹出菜单中没有 "Folder"(文件夹)这一选项,请选择 "Other"(其他),然后在 "New File"(新建文件)向导的 "Other"(其他)类别中选择 "Folder"(文件夹)文件类型。
-4. 在 "File Name"(文件名)中键入 *scss*。单击 "Finish"(完成)。
+
+[start=4]
+. 在 "File Name"(文件名)中键入 *scss*。单击 "Finish"(完成)。
单击 "Finish"(完成)后,IDE 将在 ``public_html`` 文件夹中生成新文件夹。
-5. 在 "Projects"(项目)窗口中右键单击 ``scss`` 文件夹节点,然后在弹出菜单中选择 "New"(新建)> "Sass File"(Sass 文件)。
-6. 键入 *mysass* 作为文件名。
-7. 单击 "Configure"(配置)以便在 "Options"(选项)窗口中打开 "CSS Preprocessor"(CSS 预处理程序)标签。
-8. 键入 Sass 可执行文件的路径,或者单击 "Browse"(浏览)在本地系统上查找该可执行文件。选择“确定”以关闭“选项”窗口。
+
+[start=5]
+. 在 "Projects"(项目)窗口中右键单击 ``scss`` 文件夹节点,然后在弹出菜单中选择 "New"(新建)> "Sass File"(Sass 文件)。
+
+[start=6]
+. 键入 *mysass* 作为文件名。
+
+[start=7]
+. 单击 "Configure"(配置)以便在 "Options"(选项)窗口中打开 "CSS Preprocessor"(CSS 预处理程序)标签。
+
+[start=8]
+. 键入 Sass 可执行文件的路径,或者单击 "Browse"(浏览)在本地系统上查找该可执行文件。选择“确定”以关闭“选项”窗口。
image::images/html5-css-cssoptions.png[title="在浏览器中查看应用了新 CSS 规则的页面"]
-9. 在 "New File"(新建文件)向导中选择 "Compile Sass Files on Save"(保存时编译 Sass 文件)。单击 "OK"(确定)。
+
+[start=9]
+. 在 "New File"(新建文件)向导中选择 "Compile Sass Files on Save"(保存时编译 Sass 文件)。单击 "OK"(确定)。
image::images/html5-css-newsass.png[title="在浏览器中查看应用了新 CSS 规则的页面"]
单击 "OK"(确定)后,新 Sass 文件 ``mysass.scss`` 将在编辑器中打开。
-10. 将以下内容添加到 ``mysass.scss`` 并保存您所做的更改。
+
+[start=10]
+. 将以下内容添加到 ``mysass.scss`` 并保存您所做的更改。
[source,java]
----
@@ -342,7 +398,9 @@
* 当您希望修改 CSS 规则时,应编辑 Sass 预处理程序文件 ``mysass.scss`` 而不是 ``mysass.css`` 样式表,因为每次修改并保存此预处理程序文件时都会重新生成此样式表。
* 有关 Sass 语法和其他 Sass 功能的文档,请参见 link:http://sass-lang.com/documentation/file.SASS_REFERENCE.html#[+Sass 引用+]。
-11. 打开 ``index.html`` ,然后进行以下更改以便将指向样式表的链接从 ``mycss.css`` 更改为 ``mysass.css`` 。保存所做的更改。
+
+[start=11]
+. 打开 ``index.html`` ,然后进行以下更改以便将指向样式表的链接从 ``mycss.css`` 更改为 ``mysass.css`` 。保存所做的更改。
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted.asciidoc
index a0b011a..20de3f2 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted.asciidoc
@@ -70,20 +70,30 @@
image::images/html5-newproject1.png[title="HTML5 Application template in the New Project wizard"]
+
+
[start=3]
-3. Specify a Name and Location for the project. Click Next.
+. Specify a Name and Location for the project. Click Next.
For this exercise the name is not important.
+
+
[start=4]
-4. Select No Site Template. Click Finish.
+. Select No Site Template. Click Finish.
When you click Finish the IDE creates a new HTML5 project and opens ``index.html`` in the editor.
+
+
[start=5]
-5. Confirm that Chrome with NetBeans Integration is selected in the dropdown list in the toolbar.
-6. Click Run in the toolbar.
-7. Click Go to Chrome Web Store in the Install Chrome Extension dialog box.
+. Confirm that Chrome with NetBeans Integration is selected in the dropdown list in the toolbar.
+
+[start=6]
+. Click Run in the toolbar.
+
+[start=7]
+. Click Go to Chrome Web Store in the Install Chrome Extension dialog box.
image::images/html5-offline-extension1.png[title="Install Chrome Extension dialog box"]
@@ -93,8 +103,10 @@
image::images/html5-rerun-dialog.png[title="Install Chrome Extension dialog box"]
+
+
[start=8]
-8. Go to the Chrome browser and click Add to Chrome in the NetBeans Connector page. Click Add when you are prompted to confirm that you want to add the extension.
+. Go to the Chrome browser and click Add to Chrome in the NetBeans Connector page. Click Add when you are prompted to confirm that you want to add the extension.
image::images/html5-chrome-netbeanshome.png[title="NetBeans Connector page in the Chrome Web Store"]
@@ -102,8 +114,10 @@
image::images/html5-install-extension2.png[title="Confirmation in that extension was installed"]
+
+
[start=9]
-9. In the IDE, Click Re-Run Project in the Install Chrome Extension dialog box.
+. In the IDE, Click Re-Run Project in the Install Chrome Extension dialog box.
When you click Re-Run Project a new tab will open in the Chrome browser and you will see the index page of the HTML5 application.
@@ -129,23 +143,31 @@
image::images/html5-offline-extension1.png[title="Install Chrome extension dialog box"]
+
+
[start=2]
-2. Click *locate* in the dialog box to open the NetBeans IDE installation folder on your local system that contains the * ``netbeans-chrome-connector.crx`` * extension.
+. Click *locate* in the dialog box to open the NetBeans IDE installation folder on your local system that contains the * ``netbeans-chrome-connector.crx`` * extension.
image::images/html5-offline-extension2.png[title="NetBeans Connector extension is enabled in Chrome Extensions"]
+
+
[start=3]
-3. Open the Chrome extensions page ( ``chrome://extensions/`` ) in your Chrome browser.
+. Open the Chrome extensions page ( ``chrome://extensions/`` ) in your Chrome browser.
image::images/html5-offline-extension3.png[title="NetBeans Connector extension is enabled in Chrome Extensions"]
+
+
[start=4]
-4. Drag the ``netbeans-chrome-connector.crx`` extension into the Extensions page in the browser and click Add to confirm that you want to add the extension.
+. Drag the ``netbeans-chrome-connector.crx`` extension into the Extensions page in the browser and click Add to confirm that you want to add the extension.
After the extension is added you will see that the NetBeans Connector extension is added to the list of installed extensions.
+
+
[start=5]
-5. Click *Yes, the plugin is installed now* in the Install Chrome Extension dialog box to open the NetBeans HTML5 project in the Chrome browser. You will see the NetBeans Connector icon in the location bar of the browser tab.
+. Click *Yes, the plugin is installed now* in the Install Chrome Extension dialog box to open the NetBeans HTML5 project in the Chrome browser. You will see the NetBeans Connector icon in the location bar of the browser tab.
== Using the Embedded WebKit Browser
@@ -161,8 +183,10 @@
image::images/html5-embedded1.png[title="List of target browsers for HTML5 applications in the dropdown list in the toolbar"]
+
+
[start=2]
-2. Click Run in the toolbar or right-click the project node in the Projects window and choose Run.
+. Click Run in the toolbar or right-click the project node in the Projects window and choose Run.
When you run application the Web Browser window opens in the IDE.
@@ -179,10 +203,14 @@
image::images/html5-newproject1.png[title="HTML5 Application template in the New Project wizard"]
-[start=3]
-3. Type *HTML5Demo* for the Project Name and specify the directory on your computer where you want save the project. Click Next.
-4. In Step 3. Site Template, select No Site Template. Click Next.
+
+[start=3]
+. Type *HTML5Demo* for the Project Name and specify the directory on your computer where you want save the project. Click Next.
+
+
+[start=4]
+. In Step 3. Site Template, select No Site Template. Click Next.
image::images/html5-newproject2.png[title="Site Templates panel in the New HTML5 Application wizard"]
@@ -192,12 +220,16 @@
NOTE: You must be online to create a project that is based on one of the online templates in the list.
+
+
[start=5]
-5. In Step 4. Tools, select only "Bower", which is the standard HTML5 dependency management tool that you can use via the IDE.
+. In Step 4. Tools, select only "Bower", which is the standard HTML5 dependency management tool that you can use via the IDE.
image::images/html5-newproject3.png[title="Tools panel in the New HTML5 Application wizard"]
-6. Click *Finish* to complete the wizard.
+
+[start=6]
+. Click *Finish* to complete the wizard.
When you click Finish the IDE creates the project and displays a node for the project in the Projects window and opens the ``index.html`` file in the editor.
@@ -205,13 +237,17 @@
You can now test that your project displays correctly in the Chrome browser.
+
+
[start=7]
-7. Confirm that Chrome with NetBeans Connector integration is selected in the browser dropdown table in the toolbar.
+. Confirm that Chrome with NetBeans Connector integration is selected in the browser dropdown table in the toolbar.
image::images/html5-js-selectbrowser.png[title="Browser selected in dropdown list in toolbar"]
+
+
[start=8]
-8. Right-click the project node in the Projects window and choose Run.
+. Right-click the project node in the Projects window and choose Run.
When you choose Run the IDE opens a tab in the Chrome browser and displays the default ``index.html`` page of the application. The Browser DOM window opens in the IDE and displays the DOM tree of the page that is open in the browser.
@@ -235,23 +271,31 @@
image::images/html5-bower-1.png[title="bower1"]
+
+
[start=2]
-2. If Bower has not been installed, you will see the tab below. Click Configure Bower. If Bower has been installed, skip to step 5 below.
+. If Bower has not been installed, you will see the tab below. Click Configure Bower. If Bower has been installed, skip to step 5 below.
image::images/html5-bower-2.png[title="bower2"]
+
+
[start=3]
-3. Click the Install Bower link and go through the steps required for setting up Bower. To use Bower, you will also need Node, NPM, and Git. All these are standard tools used in the JavaScript ecosystem. Familiarize yourself with them if needed before continuining.
+. Click the Install Bower link and go through the steps required for setting up Bower. To use Bower, you will also need Node, NPM, and Git. All these are standard tools used in the JavaScript ecosystem. Familiarize yourself with them if needed before continuining.
image::images/html5-bower-3.png[title="bower3"]
+
+
[start=4]
-4. Specify the location of the Bower installation. Click Apply.
+. Specify the location of the Bower installation. Click Apply.
image::images/html5-bower-4.png[title="bower4"]
+
+
[start=5]
-5. Back in the Bower tab, search for the ``jquery`` and ``jqueryui`` JavaScript libraries. By default the libraries are created in the ``public_html/bower_components`` folder of the project. Change the ``.bowerrc`` file in your project, if you want the libraries to be installed in a different folder.
+. Back in the Bower tab, search for the ``jquery`` and ``jqueryui`` JavaScript libraries. By default the libraries are created in the ``public_html/bower_components`` folder of the project. Change the ``.bowerrc`` file in your project, if you want the libraries to be installed in a different folder.
You can use the text field in the panel to filter the list of JavaScript libraries. For example, type *jq* in the field to help you find the ``jquery`` libraries. You can Ctrl-click the names of the libraries to select multiple libraries.
@@ -265,8 +309,10 @@
image::images/html5-bower-6.png[title="bower6"]
+
+
[start=6]
-6. Click OK and Bower will download the JavaScript libraries and, once the process is complete, you should see them in the Projects window.
+. Click OK and Bower will download the JavaScript libraries and, once the process is complete, you should see them in the Projects window.
image::images/html5-bower-7.png[title="bower7"]
@@ -278,16 +324,22 @@
The ZIP archive contains two folders with files that you need to add to the project: ``pix`` and ``css`` .
+
+
[start=2]
-2. Copy the ``pix`` and ``css`` folders into the Site Root folder.
+. Copy the ``pix`` and ``css`` folders into the Site Root folder.
Note: If you are looking at the directory structure of the project, you need to copy the folders into the ``public_html`` folder.
image::images/html5-fileswindow.png[title="NetBeans menu in the Chrome browser tab"]
+
+
[start=3]
-3. Open `index.html` in the editor (if it is not already open).
-4. In the editor, add references to the JavaScript libraries that you added when you created the project by adding the following code (in bold) between the opening and closing ``<head>`` tags.
+. Open `index.html` in the editor (if it is not already open).
+
+[start=4]
+. In the editor, add references to the JavaScript libraries that you added when you created the project by adding the following code (in bold) between the opening and closing ``<head>`` tags.
[source,html]
----
@@ -310,8 +362,10 @@
image::images/html5-editor1.png[title="Code completion in the editor"]
+
+
[start=5]
-5. Remove the default '`TODO write content`' comment and type the following code between the ``body`` tags.
+. Remove the default '`TODO write content`' comment and type the following code between the ``body`` tags.
[source,html]
----
@@ -370,15 +424,19 @@
</body>
----
+
+
[start=6]
-6. Save your changes.
+. Save your changes.
When you save your changes the page automatically reloads in the browser and the page should look similar to the following image.
image::images/html5-runproject3.png[title="Reloaded page in in the Chrome browser tab"]
+
+
[start=7]
-7. Type the following inline CSS rules between the ``<head>`` tags in the file.
+. Type the following inline CSS rules between the ``<head>`` tags in the file.
[source,html]
----
@@ -401,8 +459,10 @@
image::images/dom-browser.png[title="Browser DOM window showing DOM tree"]
+
+
[start=8]
-8. Add the following link to the style sheet (in *bold*) between the `<head>` tags.
+. Add the following link to the style sheet (in *bold*) between the `<head>` tags.
[source,html]
----
@@ -419,8 +479,10 @@
You can open the ``basecss.css`` style sheet in the editor and modify the style sheet to add the CSS rules that you added in the previous step or create a new style sheet for the CSS rules.
+
+
[start=9]
-9. Add the following code between the ``<head>`` tags to run a jQuery script when the elements in the page are loaded.
+. Add the following code between the ``<head>`` tags to run a jQuery script when the elements in the page are loaded.
[source,html]
----
@@ -448,8 +510,10 @@
The instructions for jQuery take the form of a JavaScript method, with an optional object literal representing an array of parameters, and must be placed between the curly braces `{}` inside the `(document).ready` function in order to execute only at the proper time, which is after the DOM has completely loaded.
+
+
[start=10]
-10. Add the following code (in bold) inside the `(document).ready` function, between the braces `{}`.
+. Add the following code (in bold) inside the `(document).ready` function, between the braces `{}`.
[source,html]
----
@@ -505,8 +569,10 @@
You can tidy up your code by right-clicking in the editor and choosing Format.
+
+
[start=11]
-11. Modify the ``<div>`` element that encloses the page contents by adding the following `id` selector and value (in bold).
+. Modify the ``<div>`` element that encloses the page contents by adding the following `id` selector and value (in bold).
[source,html]
----
@@ -528,8 +594,10 @@
When you click OK in the dialog box a CSS rule for the ``infolist`` selector is automatically added to the ``basecss.css`` style sheet.
+
+
[start=12]
-12. Save your changes to ``index.html`` (Ctrl-S; ⌘-S on Mac).
+. Save your changes to ``index.html`` (Ctrl-S; ⌘-S on Mac).
When you save your changes the page in the web browser reloads automatically. You can see that the layout of the page has changed and that the page now uses the CSS style rules that are defined in the ``basecss.css`` style sheet. One of the lists below the ``<h3>`` is open but the others are now collapsed. You can click an ``<h3>`` element to expand the list.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ja.asciidoc
index 83a0223..6d6f659 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ja.asciidoc
@@ -37,13 +37,7 @@
NetBeans Java WebアプリケーションでjQueryを使用する方法のチュートリアルは、チュートリアルlink:../web/js-toolkits-jquery.html[+jQueryを使用したWebページの外観と使いやすさの強化+]を参照してください。
-
-
-image::images/netbeans-stamp-80-74.png[title="このページの内容は、NetBeans IDE 7.4および8.0に適用されます"]
-
-
-
-==== このチュートリアルを完了するには、次のリソースが必要です。
+== このチュートリアルを完了するには、次のリソースが必要です。
|===
|ソフトウェアまたはリソース |必須バージョン
@@ -87,13 +81,21 @@
この課題では、名前は重要ではありません。
-4. 「サイト・テンプレートなし」を選択します。「終了」をクリックします。
+
+[start=4]
+. 「サイト・テンプレートなし」を選択します。「終了」をクリックします。
「終了」をクリックすると、IDEにより新規HTML5プロジェクトが作成され、 ``index.html`` がエディタに開きます。
-5. NetBeans統合のあるChromeがツールバーのドロップダウン・リストで選択されていることを確認します。
-6. ツールバーの「実行」をクリックします。
-7. 「Chrome拡張機能のインストール」ダイアログ・ボックスで「Chrome Webストアへ移動」をクリックします。
+
+[start=5]
+. NetBeans統合のあるChromeがツールバーのドロップダウン・リストで選択されていることを確認します。
+
+[start=6]
+. ツールバーの「実行」をクリックします。
+
+[start=7]
+. 「Chrome拡張機能のインストール」ダイアログ・ボックスで「Chrome Webストアへ移動」をクリックします。
image::images/html5-offline-extension1.png[title="「Chrome拡張機能のインストール」ダイアログ・ボックス"]
「Chrome Webストアへ移動」をクリックすると、ChromeブラウザにChrome WebストアのNetBeans Connectorページが開きます。
@@ -101,13 +103,17 @@
*注意:*「Chrome拡張機能のインストール」では、拡張機能がインストールされた後にクリックするボタンが表示されます。
image::images/html5-rerun-dialog.png[title="「Chrome拡張機能のインストール」ダイアログ・ボックス"]
-8. Chromeブラウザに移動し、NetBeans Connectorページで「Chromeに追加」をクリックします。拡張機能を追加するかどうかを確認するプロンプトが表示されたら、「追加」をクリックします。
+
+[start=8]
+. Chromeブラウザに移動し、NetBeans Connectorページで「Chromeに追加」をクリックします。拡張機能を追加するかどうかを確認するプロンプトが表示されたら、「追加」をクリックします。
image::images/html5-chrome-netbeanshome.png[title="Chrome WebストアのNetBeans Connectorページ"]
拡張機能がインストールされると、拡張機能が追加されたことを示す通知が表示され、ChromeブラウザでNetBeans HTML5プロジェクトを実行するとNetBeans ConnectorアイコンがURLの場所バーに表示されます。
image::images/html5-install-extension2.png[title="拡張機能がインストールされたことの確認"]
-9. IDEで、「Chrome拡張機能のインストール」ダイアログ・ボックスの「プロジェクトの再実行」をクリックします。
+
+[start=9]
+. IDEで、「Chrome拡張機能のインストール」ダイアログ・ボックスの「プロジェクトの再実行」をクリックします。
「プロジェクトの再実行」をクリックすると、Chromeブラウザに新しいタブが開き、HTML5アプリケーションの索引ページが表示されます。
@@ -131,15 +137,23 @@
1. 「Chrome拡張機能のインストール」ダイアログ・ボックスで「接続なし」をクリックします。
image::images/html5-offline-extension1.png[title="「Chrome拡張機能のインストール」ダイアログ・ボックス"]
-2. ダイアログ・ボックスの*検索*をクリックして、ローカル・システム上の* ``netbeans-chrome-connector.crx`` *拡張機能を含むNetBeans IDEインストール・フォルダを開きます。
+
+[start=2]
+. ダイアログ・ボックスの*検索*をクリックして、ローカル・システム上の* ``netbeans-chrome-connector.crx`` *拡張機能を含むNetBeans IDEインストール・フォルダを開きます。
image::images/html5-offline-extension2.png[title="NetBeans Connector拡張機能がChromeの「拡張機能」で有効になっている"]
-3. ChromeブラウザでChromeの「拡張機能」ページ( ``chrome://extensions/`` )を開きます。
+
+[start=3]
+. ChromeブラウザでChromeの「拡張機能」ページ( ``chrome://extensions/`` )を開きます。
image::images/html5-offline-extension3.png[title="NetBeans Connector拡張機能がChromeの「拡張機能」で有効になっている"]
-4. ``netbeans-chrome-connector.crx`` 拡張機能をブラウザの「拡張機能」ページにドラッグし、「追加」をクリックして、拡張機能を追加することを確認します。
+
+[start=4]
+. ``netbeans-chrome-connector.crx`` 拡張機能をブラウザの「拡張機能」ページにドラッグし、「追加」をクリックして、拡張機能を追加することを確認します。
拡張機能が追加されると、NetBeans Connector拡張機能がインストール済拡張機能のリストに追加されていることが表示されます。
-5. 「Chrome拡張機能のインストール」ダイアログ・ボックスで*「はい、プラグインをただちにインストールします」*をクリックして、ChromeブラウザにNetBeans HTML5プロジェクトを開きます。ブラウザ・タブの場所バーにNetBeans Connectorアイコンが表示されます。
+
+[start=5]
+. 「Chrome拡張機能のインストール」ダイアログ・ボックスで*「はい、プラグインをただちにインストールします」*をクリックして、ChromeブラウザにNetBeans HTML5プロジェクトを開きます。ブラウザ・タブの場所バーにNetBeans Connectorアイコンが表示されます。
== 埋込みWebKitブラウザの使用
@@ -154,7 +168,9 @@
1. ツールバーのドロップダウン・リストで「埋込みWebKitブラウザ」を選択します。
image::images/html5-embedded1.png[title="ツールバーのドロップダウン・リストのHTML5アプリケーションのターゲット・ブラウザのリスト"]
-2. ツールバーで「実行」をクリックするか、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックして「実行」を選択します。
+
+[start=2]
+. ツールバーで「実行」をクリックするか、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックして「実行」を選択します。
アプリケーションを実行すると、IDEに「Webブラウザ」ウィンドウが開きます。
@@ -170,8 +186,12 @@
1. メイン・メニューで「ファイル」→「新規プロジェクト」([Ctrl]-[Shift]-[N]、Macの場合は[⌘]-[Shift]-[N])を選択して新規プロジェクト・ウィザードを開きます。
2. *HTML5*カテゴリを選択し、*「HTML5アプリケーション」*を選択します。「次」をクリックします。
image::images/html5-newproject1.png[title="新規プロジェクト・ウィザードのHTML5アプリケーション・テンプレート"]
-3. 「プロジェクト名」に*「HTML5Demo」*と入力し、プロジェクトを保存するコンピュータ上のディレクトリを指定します。「次」をクリックします。
-4. 手順3の「サイト・テンプレート」では、「サイト・テンプレートなし」を選択します。「次」をクリックします。
+
+[start=3]
+. 「プロジェクト名」に*「HTML5Demo」*と入力し、プロジェクトを保存するコンピュータ上のディレクトリを指定します。「次」をクリックします。
+
+[start=4]
+. 手順3の「サイト・テンプレート」では、「サイト・テンプレートなし」を選択します。「次」をクリックします。
image::images/html5-newproject2.png[title="新規HTML5アプリケーション・ウィザードの「サイト・テンプレート」パネル"]
「サイト・テンプレートなし」オプションを選択すると、ウィザードによって基本的な空のNetBeans HTML5プロジェクトが生成されます。ここで「終了」をクリックした場合、プロジェクトには「サイト・ルート」フォルダのみ含まれ、「サイト・ルート」フォルダには ``index.html`` ファイルのみ含まれます。
@@ -180,7 +200,9 @@
*注意:* リストのオンライン・テンプレートの1つに基づくプロジェクトを作成するにはオンラインになっている必要があります。
-5. 手順4の「JavaScriptファイル」では、「使用可能」ペインで ``jquery`` および ``jqueryui`` JavaScriptライブラリを選択し、右矢印アイコン( > )をクリックして、選択したライブラリをウィザードの「選択済」ペインに移動します。デフォルトでは、ライブラリはプロジェクトの「 ``js/libraries`` 」フォルダに作成されます。このチュートリアルでは、「縮小」バージョンのJavaScriptライブラリを使用します。
+
+[start=5]
+. 手順4の「JavaScriptファイル」では、「使用可能」ペインで ``jquery`` および ``jqueryui`` JavaScriptライブラリを選択し、右矢印アイコン( > )をクリックして、選択したライブラリをウィザードの「選択済」ペインに移動します。デフォルトでは、ライブラリはプロジェクトの「 ``js/libraries`` 」フォルダに作成されます。このチュートリアルでは、「縮小」バージョンのJavaScriptライブラリを使用します。
パネルのテキスト・フィールドを使用して、JavaScriptライブラリのリストをフィルタできます。たとえば、フィールドに*「jq」*と入力して、 ``jquery`` ライブラリを探します。[Ctrl]を押しながらライブラリの名前をクリックして、複数のライブラリを選択できます。
@@ -190,7 +212,9 @@
* 「バージョン」列でライブラリのバージョン番号をクリックして、旧バージョンのライブラリを選択できるポップアップ・ウィンドウを開くことができます。デフォルトでは、ウィザードには最新バージョンが表示されます。
* JavaScriptライブラリの最小バージョンは、圧縮されたバージョンであり、エディタで表示するとコードは包括的に表示されません。
-6. *「終了」*をクリックすると、ウィザードが完了します。
+
+[start=6]
+. *「終了」*をクリックすると、ウィザードが完了します。
「終了」をクリックすると、IDEによりプロジェクトが作成され、「プロジェクト」ウィンドウにプロジェクトのノードが表示され、エディタに ``index.html`` ファイルが開かれます。
@@ -202,9 +226,13 @@
ここで、プロジェクトがChromeブラウザに正しく表示されることをテストできます。
-7. NetBeans Connector統合付きChromeがツールバーのブラウザ・ドロップダウン表で選択されていることを確認します。
+
+[start=7]
+. NetBeans Connector統合付きChromeがツールバーのブラウザ・ドロップダウン表で選択されていることを確認します。
image::images/html5-js-selectbrowser.png[title="ツールバーのドロップダウン・リストで選択されたブラウザ"]
-8. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」を選択します。
+
+[start=8]
+. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「実行」を選択します。
「実行」を選択すると、IDEによってChromeブラウザにタブが開き、アプリケーションのデフォルトの ``index.html`` ページが表示されます。IDEで「ブラウザDOM」ウィンドウが開き、ブラウザで開いているページのDOMツリーが表示されます。
@@ -229,13 +257,19 @@
zipアーカイブには、プロジェクトに追加する必要のあるファイルを含む2つのフォルダ( ``pix`` および ``css`` )が含まれます。
-2. ``pix`` および ``css`` フォルダを「サイト・ルート」フォルダにコピーします。
+
+[start=2]
+. ``pix`` および ``css`` フォルダを「サイト・ルート」フォルダにコピーします。
*注意:*プロジェクトのディレクトリ構造を参照する場合は、フォルダを ``public_html`` フォルダにコピーする必要があります。
image::images/html5-fileswindow.png[title="Chromeブラウザ・タブの「NetBeans」メニュー"]
-3. エディタに`index.html`を開きます(まだ開いていない場合)。
-4. エディタで、開始および終了 ``<head>`` タグの間に次のコード(太字)を追加することで、プロジェクトの作成時に追加したJavaScriptライブラリへの参照を追加します。
+
+[start=3]
+. エディタに`index.html`を開きます(まだ開いていない場合)。
+
+[start=4]
+. エディタで、開始および終了 ``<head>`` タグの間に次のコード(太字)を追加することで、プロジェクトの作成時に追加したJavaScriptライブラリへの参照を追加します。
[source,xml]
----
@@ -257,7 +291,9 @@
エディタでのコード補完の使用が役立つ場合があります。
image::images/html5-editor1.png[title="エディタでのコード補完"]
-5. デフォルトの「`TODO write content`」コメントを削除し、 ``body`` タグの間に次のコードを入力します。
+
+[start=5]
+. デフォルトの「`TODO write content`」コメントを削除し、 ``body`` タグの間に次のコードを入力します。
[source,html]
----
@@ -315,12 +351,16 @@
</div>
</body>
----
-6. 変更を保存します。
+
+[start=6]
+. 変更を保存します。
変更を保存すると、ブラウザにページが自動的に再ロードされ、ページは次の図のようになります。
image::images/html5-runproject3.png[title="Chromeブラウザ・タブに再ロードされたページ"]
-7. 次のインラインCSSルールをファイルの ``<head>`` タグの間に入力します。
+
+[start=7]
+. 次のインラインCSSルールをファイルの ``<head>`` タグの間に入力します。
[source,xml]
----
@@ -342,7 +382,9 @@
「ブラウザDOM」ウィンドウを開くと、現在のページの構造を確認できます。
image::images/dom-browser.png[title="DOMツリーを表示している「ブラウザDOM」ウィンドウ"]
-8. スタイル・シートへの次のリンク(*bold*)を`<head>`タグの間に追加します。
+
+[start=8]
+. スタイル・シートへの次のリンク(*bold*)を`<head>`タグの間に追加します。
[source,xml]
----
@@ -359,7 +401,9 @@
エディタに ``basecss.css`` スタイル・シートを開き、スタイル・シートを変更して前の手順で追加したCSSルールを追加するか、CSSルールの新規スタイル・シートを作成できます。
-9. ``<head>`` タグの間に次のコードを追加して、ページの要素がロードされる際にjQueryスクリプトを実行します。
+
+[start=9]
+. ``<head>`` タグの間に次のコードを追加して、ページの要素がロードされる際にjQueryスクリプトを実行します。
[source,xml]
----
@@ -387,7 +431,9 @@
jQueryの命令は、JavaScriptメソッドの形式をとり、パラメータの配列を表すオプションのオブジェクト・リテラルを持ちます。また、適切なとき、つまりDOMが完全にロードされた後にのみ実行されるように、`(document).ready`関数内の中括弧`{}`の間に置く必要があります。
-10. `(document).ready`関数内の中括弧`{}`の間に、次のコード(太字)を追加します。
+
+[start=10]
+. `(document).ready`関数内の中括弧`{}`の間に、次のコード(太字)を追加します。
[source,xml]
----
@@ -443,7 +489,9 @@
エディタ内で右クリックし、「フォーマット」を選択すると、コードの体裁を整えることができます。
-11. 次の`id`セレクタと値(太字)を追加することで、ページのコンテンツを囲む ``<div>`` 要素を変更します。
+
+[start=11]
+. 次の`id`セレクタと値(太字)を追加することで、ページのコンテンツを囲む ``<div>`` 要素を変更します。
[source,html]
----
@@ -465,7 +513,9 @@
ダイアログ・ボックスで「OK」をクリックすると、 ``infolist`` セレクタのCSSルールが ``basecss.css`` スタイル・シートに自動的に追加されます。
-12. 変更を ``index.html`` に保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
+
+[start=12]
+. 変更を ``index.html`` に保存します([Ctrl]-[S]、Macの場合は[⌘]-[S])。
変更を保存すると、Webブラウザにページが自動的に再ロードされます。ページのレイアウトが変更され、 ``basecss.css`` スタイル・シートに定義されているCSSスタイル・ルールがページで使用されています。下のリストのうち ``<h3>`` は開いていますが、その他は縮小されています。 ``<h3>`` 要素をクリックしてリストを展開できます。
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_pt_BR.asciidoc
index a2221ef..9f24ae3 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_pt_BR.asciidoc
@@ -37,13 +37,7 @@
Para obter um tutorial sobre como usar o jQuery em uma aplicação Web Java do NetBeans, consulte o tutorial link:../web/js-toolkits-jquery.html[+Usando jQuery para Aprimorar a Aparência e a Usabilidade de uma Página Web+].
-
-
-image::images/netbeans-stamp-80-74.png[title="O conteúdo desta página se aplica ao NetBeans IDE 7.4 e 8.0"]
-
-
-
-==== Para concluir este tutorial, você precisará dos recursos a seguir:
+== Para concluir este tutorial, você precisará dos recursos a seguir:
|===
|Software ou Recurso |Versão Necessária
@@ -87,13 +81,21 @@
Para este exercício, o nome não é importante.
-4. Selecione Nenhum Modelo de Site. Clique em Finalizar.
+
+[start=4]
+. Selecione Nenhum Modelo de Site. Clique em Finalizar.
Quando você clicar em Finalizar, o IDE criará um novo projeto em HTML5 e abrirá o ``index.html`` no editor.
-5. Confirme que Chrome com Integração NetBeans está selecionado na lista drop-down, na Barra de Ferramentas.
-6. Clique em Executar na barra de ferramentas.
-7. Clique em Ir para Chrome Web Store na caixa de diálogo Instalar Extensão Chrome.
+
+[start=5]
+. Confirme que Chrome com Integração NetBeans está selecionado na lista drop-down, na Barra de Ferramentas.
+
+[start=6]
+. Clique em Executar na barra de ferramentas.
+
+[start=7]
+. Clique em Ir para Chrome Web Store na caixa de diálogo Instalar Extensão Chrome.
image::images/html5-offline-extension1.png[title="Caixa de diálogo Instalar Extensão Chrome"]
Quando você clica em Ir para Chrome Web Store, a página NetBeans Connector é aberta na Chrome Web Store, no browser Chrome.
@@ -101,13 +103,17 @@
*Observação.* A janela Instalar Extensão Chrome exibe um botão no qual você clicará depois da instalação da extensão.
image::images/html5-rerun-dialog.png[title="Caixa de diálogo Instalar Extensão Chrome"]
-8. Vá para o browser Chrome e clique em Adicionar ao Chrome na página NetBeans Connector. Clique em Adicionar quando você for solicitado a confirmar se deseja adicionar a extensão.
+
+[start=8]
+. Vá para o browser Chrome e clique em Adicionar ao Chrome na página NetBeans Connector. Clique em Adicionar quando você for solicitado a confirmar se deseja adicionar a extensão.
image::images/html5-chrome-netbeanshome.png[title="Página do NetBeans Connector na Chrome Web Store"]
Quando a extensão for instalada, você verá uma notificação de que a extensão foi adicionada. O ícone do NetBeans Connector ficará visível na barra de localização de URL quando você executar um projeto em HTML5 no NetBeans no browser Chrome.
image::images/html5-install-extension2.png[title="Confirmação de que a extensão foi instalada"]
-9. No IDE, clique em Executar Projeto Novamente na caixa de diálogo Instalar Extensão Chrome.
+
+[start=9]
+. No IDE, clique em Executar Projeto Novamente na caixa de diálogo Instalar Extensão Chrome.
Quando você clica em Executar Projeto Novamente, uma nova guia é aberta no browser Chrome e você vê a página de índice da aplicação em HTML5.
@@ -131,15 +137,23 @@
1. Clique em Não Conectado na caixa de diálogo Instalar Extensão Chrome.
image::images/html5-offline-extension1.png[title="Caixa de diálogo Instalar extensão Chrome"]
-2. Clique em *localizar* na caixa de diálogo para abrir a pasta de instalação do NetBeans IDE no seu sistema local que contém a extensão * ``netbeans-chrome-connector.crx`` *.
+
+[start=2]
+. Clique em *localizar* na caixa de diálogo para abrir a pasta de instalação do NetBeans IDE no seu sistema local que contém a extensão * ``netbeans-chrome-connector.crx`` *.
image::images/html5-offline-extension2.png[title="A extensão NetBeans Connector está ativada nas Extensões do Chrome"]
-3. Abra a página de extensões Chrome ( ``chrome://extensions/`` ) no seu browser Chrome.
+
+[start=3]
+. Abra a página de extensões Chrome ( ``chrome://extensions/`` ) no seu browser Chrome.
image::images/html5-offline-extension3.png[title="A extensão NetBeans Connector está ativada nas Extensões do Chrome"]
-4. Arraste a extensão ``netbeans-chrome-connector.crx`` para a página Extensões no browser e clique em Adicionar para confirmar que deseja adicionar a extensão.
+
+[start=4]
+. Arraste a extensão ``netbeans-chrome-connector.crx`` para a página Extensões no browser e clique em Adicionar para confirmar que deseja adicionar a extensão.
Depois de adicionar a extensão, você verá que a extensão NetBeans Connector foi adicionada à lista de extensões instaladas.
-5. Clique em *Sim, o plug-in está instalado agora* na caixa de diálogo Instalar Extensão Chrome para abrir o projeto do NetBeans em HTML5 no browser Chrome. Você verá o ícone do NetBeans Connector na barra de localização da guia do browser.
+
+[start=5]
+. Clique em *Sim, o plug-in está instalado agora* na caixa de diálogo Instalar Extensão Chrome para abrir o projeto do NetBeans em HTML5 no browser Chrome. Você verá o ícone do NetBeans Connector na barra de localização da guia do browser.
== Usando o Browser com Kit Web Incorporado
@@ -154,7 +168,9 @@
1. Selecione Browser com Kit Web Incorporado na lista drop-down na barra de ferramentas.
image::images/html5-embedded1.png[title="Lista de browsers de destino para aplicações em HTML5 na lista drop-down na barra de ferramentas."]
-2. Clique em Executar na barra de ferramentas ou clique com o botão direito do mouse no nó do projeto na janela Projetos e selecione Executar.
+
+[start=2]
+. Clique em Executar na barra de ferramentas ou clique com o botão direito do mouse no nó do projeto na janela Projetos e selecione Executar.
Quando você executa a aplicação, a janela Web Browser é aberta no IDE.
@@ -170,8 +186,12 @@
1. Selecione Arquivo > Novo Projeto (Ctrl-Shift-N; ⌘-Shift-N no Mac) no menu principal para abrir o assistente Novo Projeto.
2. Selecione a categoria *HTML5*e, em seguida, selecione *Aplicação HTML5*. Clique em Próximo.
image::images/html5-newproject1.png[title="Modelo de Aplicação em HTML5 no assistente de Novo Projeto"]
-3. Digite *HTML5Demo* para Nome do Projeto e especifique o diretório no seu computador onde você quer salvar o projeto. Clique em Próximo.
-4. Na Etapa 3. Modelo de Site, selecione Nenhum Modelo de Site. Clique em Próximo.
+
+[start=3]
+. Digite *HTML5Demo* para Nome do Projeto e especifique o diretório no seu computador onde você quer salvar o projeto. Clique em Próximo.
+
+[start=4]
+. Na Etapa 3. Modelo de Site, selecione Nenhum Modelo de Site. Clique em Próximo.
image::images/html5-newproject2.png[title="Painel Modelos de Site no assistente da Nova Aplicação em HTML5"]
Quando você seleciona a opção Nenhum Modelo de Site, o assistente gera um projeto básico em branco do NetBeans em HTML5. Se você clicar em Finalizar agora, o projeto conterá apenas uma pasta Root do Site e um arquivo ``index.html`` nessa pasta.
@@ -180,7 +200,9 @@
*Observação:* Você deve estar on-line para criar um projeto baseado em um dos modelos on-line da lista.
-5. Na Etapa 4. Arquivos de JavaScript, selecione as bibliotecas JavaScript ``jquery`` e ``jqueryui`` no painel Disponível e clique no ícone de seta para a direita ( > ) para mover as bibliotecas selecionadas para o painel Selecionado do assistente. Por default, as bibliotecas são criadas na pasta ``js/libraries`` do projeto. Para este tutorial, você utilizará as versões "minimizadas" das bibliotecas JavaScript.
+
+[start=5]
+. Na Etapa 4. Arquivos de JavaScript, selecione as bibliotecas JavaScript ``jquery`` e ``jqueryui`` no painel Disponível e clique no ícone de seta para a direita ( > ) para mover as bibliotecas selecionadas para o painel Selecionado do assistente. Por default, as bibliotecas são criadas na pasta ``js/libraries`` do projeto. Para este tutorial, você utilizará as versões "minimizadas" das bibliotecas JavaScript.
Você pode usar o campo de texto no painel para filtrar a lista de bibliotecas JavaScript. Por exemplo, digite *jq* no campo para ajudá-lo a encontrar as bibliotecas ``jquery`` . Você pode usar Ctrl-clique nos nomes das bibliotecas para selecionar várias bibliotecas.
@@ -190,7 +212,9 @@
* Você pode clicar no número de versão da biblioteca na coluna Versão para abrir uma janela pop-up que permite selecionar a ordem das versões de biblioteca. Por default, o assistente exibe a versão mais recente.
* As versões minimizadas das bibliotecas JavaScript são versões compactadas e o código não é abrangente quando exibido em um editor.
-6. Clique em *Finalizar* para concluir o assistente.
+
+[start=6]
+. Clique em *Finalizar* para concluir o assistente.
Quando você clicar em Finalizar, o IDE criará o projeto e exibirá um nó para o projeto na janela Projetos,e abrirá o arquivo ``index.html`` no editor.
@@ -202,9 +226,13 @@
Agora, você pode testar se o projeto é exibido corretamente no browser Chrome.
-7. Confirme que Chrome com Integração do Conector NetBeans está selecionado na lista drop-down do browser, na barra de ferramentas.
+
+[start=7]
+. Confirme que Chrome com Integração do Conector NetBeans está selecionado na lista drop-down do browser, na barra de ferramentas.
image::images/html5-js-selectbrowser.png[title="Browser selecionado na lista drop-down na barra de ferramentas"]
-8. Clique com o botão direito do mouse no nó na janela Projetos e selecione Executar.
+
+[start=8]
+. Clique com o botão direito do mouse no nó na janela Projetos e selecione Executar.
Quando você seleciona Executar, o IDE abre uma guia no browser Chrome e exibe á página ``index.html`` default da aplicação. A janela Browser DOM é aberta no IDE e exibe a árvore DOM da página que é aberta no browser.
@@ -229,13 +257,19 @@
O arquivo compactado zip contém duas pastas com arquivos que você precisa adicionar ao projeto: ``pix`` e ``css`` .
-2. Copie as pastas ``pix`` e ``css`` na pasta Root do Site.
+
+[start=2]
+. Copie as pastas ``pix`` e ``css`` na pasta Root do Site.
*Observação.* Se você estiver observando a estrutura de diretório do projeto, deverá copiar as pastas na pasta ``public_html`` .
image::images/html5-fileswindow.png[title="Menu NetBeans na guia do browser Chrome"]
-3. Abra `index.html` no editor (se ainda não estiver aberto).
-4. No editor, adicione referências para as bibliotecas JavaScript que você adicionou quando criou o projeto, adicionando o seguinte código (em negrito) entre as tags ``<head>`` de abertura e fechamento existentes.
+
+[start=3]
+. Abra `index.html` no editor (se ainda não estiver aberto).
+
+[start=4]
+. No editor, adicione referências para as bibliotecas JavaScript que você adicionou quando criou o projeto, adicionando o seguinte código (em negrito) entre as tags ``<head>`` de abertura e fechamento existentes.
[source,xml]
----
@@ -257,7 +291,9 @@
Você pode utilizar a funcionalidade de autocompletar código no editor para ajudá-lo.
image::images/html5-editor1.png[title="Autocompletar código no editor"]
-5. Remova o comentário default '`TODO write content`' e digite o seguinte entre as tags ``body`` .
+
+[start=5]
+. Remova o comentário default '`TODO write content`' e digite o seguinte entre as tags ``body`` .
[source,html]
----
@@ -315,12 +351,16 @@
</div>
</body>
----
-6. Salve as alterações.
+
+[start=6]
+. Salve as alterações.
Quando você salvar as alterações, a página é automaticamente recarregada no browser e deve ter aparência semelhante à da imagem.
image::images/html5-runproject3.png[title="Página recarregada na guia browser Chrome"]
-7. Digite as seguintes regras de CSS em linha entre as tags ``<head>`` no arquivo.
+
+[start=7]
+. Digite as seguintes regras de CSS em linha entre as tags ``<head>`` no arquivo.
[source,xml]
----
@@ -342,7 +382,9 @@
Se você abrir a janela do Browser DOM, poderá visualizar a estrutura atual da página.
image::images/dom-browser.png[title="A janela Browser DOM que mostra a árvore DOM"]
-8. Adicione o link a seguir à folha de estilo (em *negrito*) entre as tags `<head>`.
+
+[start=8]
+. Adicione o link a seguir à folha de estilo (em *negrito*) entre as tags `<head>`.
[source,xml]
----
@@ -359,7 +401,9 @@
É possível abrir a folha de estilo ``basecss.css`` no editor e modificá-la para adicionar as regras de CSS que você adicionou na etapa anterior ou criar uma nova folha de estilos para as regras de CSS.
-9. Adicione o seguinte código entre as tags ``<head>`` para executar um script de jQuery quando os elementos da página são carregados.
+
+[start=9]
+. Adicione o seguinte código entre as tags ``<head>`` para executar um script de jQuery quando os elementos da página são carregados.
[source,xml]
----
@@ -387,7 +431,9 @@
As instruções para o jQuery tomam a forma de um método JavaScript, com uma literal opcional de objeto representando um array de parâmetros, e devem ser colocadas entre chaves `{}` dentro da função `(document).ready` para serem executadas somente no momento apropriado, que é após o DOM ser completamente carregado.
-10. Adicione o seguinte código (em negrito) na função `(document).ready`, entre as chaves `{}`:
+
+[start=10]
+. Adicione o seguinte código (em negrito) na função `(document).ready`, entre as chaves `{}`:
[source,xml]
----
@@ -443,7 +489,9 @@
Você pode organizar seu código clicando com o botão direito do mouse no editor e selecionando Formato.
-11. Modifique o elemento ``<div>`` que circunscreve a página Conteúdo adicionando o seguinte seletor e valor `id` (em negrito).
+
+[start=11]
+. Modifique o elemento ``<div>`` que circunscreve a página Conteúdo adicionando o seguinte seletor e valor `id` (em negrito).
[source,html]
----
@@ -465,7 +513,9 @@
Quando você clicar em OK na caixa de diálogo, uma regra CSS para o seletor ``infolist`` será automaticamente adicionada à folha de estilo ``basecss.css`` .
-12. Salve suas alterações de ``index.html`` (Ctrl-S; ⌘-S no Mac).
+
+[start=12]
+. Salve suas alterações de ``index.html`` (Ctrl-S; ⌘-S no Mac).
Quando você salva as alterações, a página no web browser é recarregada automaticamente. Você pode ver que o layout da página mudou e que a página agora usa as regras de estilo de CSS definidas na folha de estilo ``basecss.css`` . Uma das listas abaixo de ``<h3>`` está aberta, mas as demais foram recolhidas. Você pode clicar em um elemento ``<h3>`` para expandir a lista.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ru.asciidoc
index 9625d67..b9fd650 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_ru.asciidoc
@@ -37,13 +37,7 @@
Подробнее о том, как использовать JQuery в веб-приложениях Java NetBeans, см. учебный курс link:../web/js-toolkits-jquery.html[+Использование jQuery для усовершенствования внешнего вида и удобства веб-страницы+].
-
-
-image::images/netbeans-stamp-80-74.png[title="Содержимое этой страницы применимо к IDE NetBeans 7.4 и 8.0"]
-
-
-
-==== Для выполнения этого учебного курса потребуются следующие материалы.
+== Для выполнения этого учебного курса потребуются следующие материалы.
|===
|Программное обеспечение или ресурс |Требуемая версия
@@ -87,13 +81,21 @@
Для этого упражнения имя не имеет значения.
-4. Выберите 'Без шаблона сайта'. Нажмите кнопку 'Готово'.
+
+[start=4]
+. Выберите 'Без шаблона сайта'. Нажмите кнопку 'Готово'.
Когда вы нажмете кнопку 'Готово', IDE создаст новый проект HTML5 и откроет файл ``index.html`` в редакторе.
-5. Убедитесь, что на панели инструментов в раскрывающимся списке выбран Chrome с NetBeans Integration.
-6. Нажмите кнопку 'Выполнить' на панели инструментов.
-7. Щелкните 'Перейти к веб-магазину Chrome' в диалоговом окне 'Установить расширение Chrome'.
+
+[start=5]
+. Убедитесь, что на панели инструментов в раскрывающимся списке выбран Chrome с NetBeans Integration.
+
+[start=6]
+. Нажмите кнопку 'Выполнить' на панели инструментов.
+
+[start=7]
+. Щелкните 'Перейти к веб-магазину Chrome' в диалоговом окне 'Установить расширение Chrome'.
image::images/html5-offline-extension1.png[title="Диалоговое окно 'Установить расширение Chrome'"]
При нажатии кнопки 'Перейти к веб-магазину Chrome' страница NetBeans Connector в веб-магазине Chrome откроется в браузере Chrome.
@@ -101,13 +103,17 @@
*Примечание.* В окне 'Установить расширение Chrome' отображается кнопка, после щелчка на которой выполняется установка расширения.
image::images/html5-rerun-dialog.png[title="Диалоговое окно 'Установить расширение Chrome'"]
-8. Перейдите к браузеру Chrome и нажмите кнопку 'Добавить в Chrome' на странице NetBeans Connector. Нажмите кнопку 'Добавить' при отображении запроса на подтверждение добавления расширения.
+
+[start=8]
+. Перейдите к браузеру Chrome и нажмите кнопку 'Добавить в Chrome' на странице NetBeans Connector. Нажмите кнопку 'Добавить' при отображении запроса на подтверждение добавления расширения.
image::images/html5-chrome-netbeanshome.png[title="Страница NetBeans Connector в веб-магазине Chrome"]
Когда расширение установлено, вы увидите уведомление о том, что расширение добавлено, а значок NetBeans Connector будет отображаться в адресной строке URL при запуске проекта NetBeans HTML5 в браузере Chrome.
image::images/html5-install-extension2.png[title="Подтверждение того, что расширение было установлено"]
-9. В IDE нажмите 'Повторно запустить проект' в диалоговом окне 'Установить расширение Chrome'.
+
+[start=9]
+. В IDE нажмите 'Повторно запустить проект' в диалоговом окне 'Установить расширение Chrome'.
После нажатия 'Повторно запустить проект' в браузере Chrome откроется новая вкладка и отобразится страница индексов приложений HTML5.
@@ -131,15 +137,23 @@
1. Щелкните 'Отсутствует подключение' в диалоговом окне 'Установить расширение Chrome'.
image::images/html5-offline-extension1.png[title="Диалоговое окно 'Установить расширение Chrome'"]
-2. Щелкните *найти* в диалоговом окне, чтобы открыть папку установки IDE NetBeans в локальной системе, содержащей расширение * ``netbeans-chrome-connector.crx`` *.
+
+[start=2]
+. Щелкните *найти* в диалоговом окне, чтобы открыть папку установки IDE NetBeans в локальной системе, содержащей расширение * ``netbeans-chrome-connector.crx`` *.
image::images/html5-offline-extension2.png[title="Расширение NetBeans Connector включено в расширениях Chrome"]
-3. Откройте страницу расширений Chrome ( ``chrome://extensions/`` ) в браузере Chrome.
+
+[start=3]
+. Откройте страницу расширений Chrome ( ``chrome://extensions/`` ) в браузере Chrome.
image::images/html5-offline-extension3.png[title="Расширение NetBeans Connector включено в расширениях Chrome"]
-4. Перетащите расширение ``netbeans-chrome-connector.crx`` на страницу 'Расширения' в браузере и нажмите кнопку 'Добавить', чтобы подтвердить добавление расширения.
+
+[start=4]
+. Перетащите расширение ``netbeans-chrome-connector.crx`` на страницу 'Расширения' в браузере и нажмите кнопку 'Добавить', чтобы подтвердить добавление расширения.
После добавления расширения вы увидите, что расширение NetBeans Connector добавлено в список установленных расширений.
-5. Щелкните *Да, подключаемый модуль сейчас установлен* в диалоговом окне 'Установить расширение Chrome', чтобы открыть проект NetBeans HTML5 в браузере Chrome. Вы увидите значок NetBeans Connector в адресной строке вкладки браузера.
+
+[start=5]
+. Щелкните *Да, подключаемый модуль сейчас установлен* в диалоговом окне 'Установить расширение Chrome', чтобы открыть проект NetBeans HTML5 в браузере Chrome. Вы увидите значок NetBeans Connector в адресной строке вкладки браузера.
== Использование встроенного браузера на базе WebKit
@@ -154,7 +168,9 @@
1. Выберите встроенный браузер на базе WebKit в раскрывающемся списке на панели инструментов.
image::images/html5-embedded1.png[title="Список целевых браузеров для приложений HTML5 в раскрывающемся списке на панели инструментов"]
-2. Нажмите 'Выполнить' на панели инструментов или щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Выполнить'.
+
+[start=2]
+. Нажмите 'Выполнить' на панели инструментов или щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Выполнить'.
При запуске приложения окно веб-браузера открывается в IDE.
@@ -170,8 +186,12 @@
1. Выберите 'Файл' > 'Новый проект' (Ctrl-Shift-N; ⌘-Shift-N в Mac) в главном меню, чтобы открыть мастер создания проектов.
2. Выберите категорию *HTML5*, затем выберите *Приложение HTML5*. Нажмите кнопку 'Далее'.
image::images/html5-newproject1.png[title="Шаблон приложения HTML5 в мастере создания проектов"]
-3. Введите *HTML5Demo* в качестве имени проекта и укажите каталог на компьютере, где следует сохранить проект. Нажмите кнопку 'Далее'.
-4. В шаге 3. Шаблон сайта, выберите 'Без шаблона сайта'. Нажмите кнопку 'Далее'.
+
+[start=3]
+. Введите *HTML5Demo* в качестве имени проекта и укажите каталог на компьютере, где следует сохранить проект. Нажмите кнопку 'Далее'.
+
+[start=4]
+. В шаге 3. Шаблон сайта, выберите 'Без шаблона сайта'. Нажмите кнопку 'Далее'.
image::images/html5-newproject2.png[title="Панель шаблонов сайта в мастере создания приложений HTML5"]
При выборе 'Без шаблона сайта' мастер создает базовый пустой проект NetBeans HTML5. Если нажать кнопку 'Готово', проект будет содержать только папку корня сайта и файл ``index.html`` в папке корня сайта.
@@ -180,7 +200,9 @@
*Примечание.* Вы должны быть подключены к сети, чтобы создать проект, который основан на одном из интернет-шаблонов в списке.
-5. В шаге 4. Файлы JavaScript - выберите библиотеки JavaScript ``jquery`` и ``jquerygui`` на панели 'Доступные' и щелкните значок со стрелкой вправо ( > ), чтобы переместить выбранные библиотеки на панель мастера 'Выбранное'. По умолчанию библиотеки создаются в папке проекта ``js/libraries`` . В этом учебном курсе будут использоваться "уменьшенные" версии библиотек JavaScript.
+
+[start=5]
+. В шаге 4. Файлы JavaScript - выберите библиотеки JavaScript ``jquery`` и ``jquerygui`` на панели 'Доступные' и щелкните значок со стрелкой вправо ( > ), чтобы переместить выбранные библиотеки на панель мастера 'Выбранное'. По умолчанию библиотеки создаются в папке проекта ``js/libraries`` . В этом учебном курсе будут использоваться "уменьшенные" версии библиотек JavaScript.
Можно использовать текстовое поле на панели, чтобы отфильтровать список библиотек JavaScript. Например, введите *jq* в поле, чтобы найти библиотеки ``jquery`` . Вы можете удерживать нажатой клавишу Ctrl и щелкнуть левой кнопкой мыши имена библиотек для выбора нескольких библиотек.
@@ -190,7 +212,9 @@
* Можно нажать номер версии библиотеки в столбце 'Версия', чтобы открыть всплывающее окно, в котором можно выбрать предыдущие версии библиотек. По умолчанию в мастере отображается самая последняя версия.
* Минимизированные версии библиотек JavaScript - это сжатые версии, и при просмотре в редакторе код не является доступным для понимания.
-6. Для завершения мастера нажмите кнопку *Готово*.
+
+[start=6]
+. Для завершения мастера нажмите кнопку *Готово*.
После нажатия кнопки 'Готово' в IDE создается проект, отображается узел проекта в окне 'Проекты' и открывается файл ``index.html`` в редакторе.
@@ -202,9 +226,13 @@
Теперь можно проверить, правильно ли отображается данный проект в браузере Chrome.
-7. Убедитесь, что на панели инструментов браузера в раскрывающимся списке выбран Chrome с NetBeans Integration.
+
+[start=7]
+. Убедитесь, что на панели инструментов браузера в раскрывающимся списке выбран Chrome с NetBeans Integration.
image::images/html5-js-selectbrowser.png[title="Браузер, выбранный в раскрывающемся списке на панели инструментов."]
-8. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите "Выполнить".
+
+[start=8]
+. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите "Выполнить".
При выборе 'Выполнить в IDE' открывается вкладка в браузере Chrome и отображается страница ``index.html`` по умолчанию для приложения. В среде IDE открывается окно 'Обзор DOM', в котором отображается дерево DOM открытой в браузере страницы.
@@ -229,13 +257,19 @@
ZIP-архив содержит две папки с файлами, которые нужно добавить к проекту: ``pix`` и ``css`` .
-2. Скопируйте папки ``pix`` и ``css`` в корневую папку сайта.
+
+[start=2]
+. Скопируйте папки ``pix`` и ``css`` в корневую папку сайта.
*Примечание.* Если проанализировать структуру каталогов проекта, необходимо скопировать папки в папку ``public_html`` .
image::images/html5-fileswindow.png[title="Меню NetBeans на вкладке браузера Chrome"]
-3. Откройте в редакторе `index.html` (если он еще не открыт).
-4. В редакторе добавьте ссылки на библиотеки JavaScript, которые были добавлены при создании проекта, добавив следующий код (выделен полужирным шрифтом) между открывающим и закрывающим тегами ``<head>`` .
+
+[start=3]
+. Откройте в редакторе `index.html` (если он еще не открыт).
+
+[start=4]
+. В редакторе добавьте ссылки на библиотеки JavaScript, которые были добавлены при создании проекта, добавив следующий код (выделен полужирным шрифтом) между открывающим и закрывающим тегами ``<head>`` .
[source,xml]
----
@@ -257,7 +291,9 @@
Для решения задач можно использовать функцию автозавершения кода в редакторе.
image::images/html5-editor1.png[title="Автозавершение кода в редакторе"]
-5. Удалите заданный по умолчанию комментарий '`TODO write content`' и введите следующий код между тегами ``body`` .
+
+[start=5]
+. Удалите заданный по умолчанию комментарий '`TODO write content`' и введите следующий код между тегами ``body`` .
[source,html]
----
@@ -315,12 +351,16 @@
</div>
</body>
----
-6. Сохраните изменения.
+
+[start=6]
+. Сохраните изменения.
При сохранении изменений страница автоматически перезагружается в браузере и должна выглядеть примерно так, как показано ниже.
image::images/html5-runproject3.png[title="Перезагруженная страница на вкладке браузера Chrome"]
-7. Введите следующие встроенные правила CSS между тегами ``<head>`` в файле.
+
+[start=7]
+. Введите следующие встроенные правила CSS между тегами ``<head>`` в файле.
[source,xml]
----
@@ -342,7 +382,9 @@
Если открыть окно 'Обзор DOM', отображается текущая структура страницы.
image::images/dom-browser.png[title="Окно 'Обзор DOM' с деревом DOM"]
-8. Добавьте следующую ссылку к странице стилей (выделена *полужирным* шрифтом) между тегами `<head>`.
+
+[start=8]
+. Добавьте следующую ссылку к странице стилей (выделена *полужирным* шрифтом) между тегами `<head>`.
[source,xml]
----
@@ -359,7 +401,9 @@
Можно открыть страницу стилей ``basecss.css`` в редакторе и изменить страницу стилей для добавления правил CSS, добавленных в предыдущем шаге, или создать новую страницу стиля для правил CSS.
-9. Добавьте следующий код между тегами ``<head>`` для запуска сценария jQuery при загрузке элементов страницы.
+
+[start=9]
+. Добавьте следующий код между тегами ``<head>`` для запуска сценария jQuery при загрузке элементов страницы.
[source,xml]
----
@@ -387,7 +431,9 @@
Команды для jQuery принимают форму метода JavaScript с дополнительным объектным литералом, предоставляющим массив параметров, который должен быть помещен между фигурными скобками `{}` в функции `(document).ready` для выполнения только в допустимый момент, то есть после полной загрузки модели DOM.
-10. Введите следующий код (выделен полужирным шрифтом) внутри функции `(document).ready`, между скобок `{}`.
+
+[start=10]
+. Введите следующий код (выделен полужирным шрифтом) внутри функции `(document).ready`, между скобок `{}`.
[source,xml]
----
@@ -443,7 +489,9 @@
Код можно упорядочить, щелкнув правой кнопкой мыши в редакторе и выбрав 'Формат'.
-11. Измените элемент ``<div>`` , заключающий содержимое страницы. путем добавления следующего средства выбора и значения `id` (выделено полужирным шрифтом).
+
+[start=11]
+. Измените элемент ``<div>`` , заключающий содержимое страницы. путем добавления следующего средства выбора и значения `id` (выделено полужирным шрифтом).
[source,html]
----
@@ -465,7 +513,9 @@
При нажатии кнопки ОК в диалоговом окне правило CSS для средства выбора ``infolist`` автоматически добавляется к таблице стилей ``basecss.css`` .
-12. Сохраните внесенные изменения в ``index.html`` (Ctrl-S; ⌘-S в Mac).
+
+[start=12]
+. Сохраните внесенные изменения в ``index.html`` (Ctrl-S; ⌘-S в Mac).
При сохранении изменений страница автоматически перезагружается в веб-браузере. Отображается, что макет страницы был изменен и что на странице теперь используются правила стилей CSS, которые определены в таблице стилей ``basecss.css`` . Один из снимков ниже ``<h3>`` открыт, но другие свернуты. Чтобы развернуть список, можно щелкнуть элемент ``<h3>`` .
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_zh_CN.asciidoc
index 31366f2..4460d4e 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-gettingstarted_zh_CN.asciidoc
@@ -37,13 +37,7 @@
有关如何在 NetBeans Java Web 应用程序中使用 jQuery 的教程,请参阅教程link:../web/js-toolkits-jquery.html[+使用 jQuery 改善 Web 页的外观和可用性+]。
-
-
-image::images/netbeans-stamp-80-74.png[title="此页上的内容适用于 NetBeans IDE 7.4 和 8.0"]
-
-
-
-==== 要完成本教程,需要使用以下资源。
+== 要完成本教程,需要使用以下资源。
|===
|软件或资源 |要求的版本
@@ -87,13 +81,21 @@
对于本练习,名称不重要。
-4. 选择 "No Site Template"(无站点模板)。单击 "Finish"(完成)。
+
+[start=4]
+. 选择 "No Site Template"(无站点模板)。单击 "Finish"(完成)。
单击 "Finish"(完成)时,IDE 会创建新的 HTML5 项目并在编辑器中打开 ``index.html`` 。
-5. 确认在工具栏的下拉列表中选择了 "Chrome with NetBeans Integration"(带有 NetBeans 集成的 Chrome)。
-6. 单击工具栏中的 "Run"(运行)。
-7. 在 "Install Chrome Extension"(安装 Chrome 扩展)对话框中单击 "Go to Chrome Web Store"(转到 Chrome Web Store)。
+
+[start=5]
+. 确认在工具栏的下拉列表中选择了 "Chrome with NetBeans Integration"(带有 NetBeans 集成的 Chrome)。
+
+[start=6]
+. 单击工具栏中的 "Run"(运行)。
+
+[start=7]
+. 在 "Install Chrome Extension"(安装 Chrome 扩展)对话框中单击 "Go to Chrome Web Store"(转到 Chrome Web Store)。
image::images/html5-offline-extension1.png[title=""Install Chrome Extension"(安装 Chrome 扩展)对话框"]
单击 "Go to Chrome Web Store"(转到 Chrome Web Store)时,Chrome 浏览器中将打开 Chrome Web Store 的 NetBeans Connector 页面。
@@ -101,13 +103,17 @@
*注:*"Install Chrome Extension"(安装 Chrome 扩展)将显示一个按钮,安装扩展之后单击该按钮。
image::images/html5-rerun-dialog.png[title=""Install Chrome Extension"(安装 Chrome 扩展)对话框"]
-8. 转到 Chrome 浏览器并单击 NetBeans Connector 页面中的 "Add to Chrome"(添加到 Chrome)。出现提示时,单击 "Add"(添加)以确认要添加扩展。
+
+[start=8]
+. 转到 Chrome 浏览器并单击 NetBeans Connector 页面中的 "Add to Chrome"(添加到 Chrome)。出现提示时,单击 "Add"(添加)以确认要添加扩展。
image::images/html5-chrome-netbeanshome.png[title="Chrome Web Store 中的 NetBeans Connector 页"]
安装扩展之后,您可以看到通知,声明扩展已添加,并且当您在 Chrome 浏览器中运行 NetBeans HTML5 项目时,NetBeans Connector 图标将在 URL 地址栏中可见。
image::images/html5-install-extension2.png[title="确认该扩展已安装"]
-9. 在 IDE 的 "Install Chrome Extension"(安装 Chrome 扩展)对话框中,单击 "Re-Run Project"(重新运行项目)。
+
+[start=9]
+. 在 IDE 的 "Install Chrome Extension"(安装 Chrome 扩展)对话框中,单击 "Re-Run Project"(重新运行项目)。
单击 "Re-Run Project"(重新运行项目)时,Chrome 浏览器中将打开一个新标签,您可以看到 HTML5 应用程序的索引页。
@@ -131,15 +137,23 @@
1. 在 "Install Chrome Extension"(安装 Chrome 扩展)对话框中单击 "Not Connected"(未连接)。
image::images/html5-offline-extension1.png[title=""Install Chrome Extension"(安装 Chrome 扩展)对话框"]
-2. 在对话框中单击 *locate(定位)*以打开本地系统上包含 * ``netbeans-chrome-connector.crx`` * 扩展的 NetBeans IDE 安装文件夹。
+
+[start=2]
+. 在对话框中单击 *locate(定位)*以打开本地系统上包含 * ``netbeans-chrome-connector.crx`` * 扩展的 NetBeans IDE 安装文件夹。
image::images/html5-offline-extension2.png[title="Chrome 扩展中已启用 NetBeans Connector 扩展"]
-3. 在 Chrome 浏览器中打开 Chrome 扩展页面 ( ``chrome://extensions/`` )。
+
+[start=3]
+. 在 Chrome 浏览器中打开 Chrome 扩展页面 ( ``chrome://extensions/`` )。
image::images/html5-offline-extension3.png[title="Chrome 扩展中已启用 NetBeans Connector 扩展"]
-4. 将 ``netbeans-chrome-connector.crx`` 扩展拖动到浏览器中的 "Extensions"(扩展)页面,然后单击 "Add"(添加)以确认要添加扩展。
+
+[start=4]
+. 将 ``netbeans-chrome-connector.crx`` 扩展拖动到浏览器中的 "Extensions"(扩展)页面,然后单击 "Add"(添加)以确认要添加扩展。
添加扩展之后,您可以看到 NetBeans Connector 扩展添加到了已安装扩展列表中。
-5. 在 "Install Chrome Extension"(安装 Chrome 扩展)对话框中单击 *Yes, the plugin is installed now(是,插件现在已安装)*可在 Chrome 浏览器中打开 NetBeans HTML5 项目。在浏览器标签的地址栏中可以看到 NetBeans Connector 图标。
+
+[start=5]
+. 在 "Install Chrome Extension"(安装 Chrome 扩展)对话框中单击 *Yes, the plugin is installed now(是,插件现在已安装)*可在 Chrome 浏览器中打开 NetBeans HTML5 项目。在浏览器标签的地址栏中可以看到 NetBeans Connector 图标。
== 使用嵌入式 WebKit 浏览器
@@ -154,7 +168,9 @@
1. 在工具栏的下拉列表中选择 "Embedded WebKit Browser"(嵌入式 WebKit 浏览器)。
image::images/html5-embedded1.png[title="工具栏下拉列表中 HTML5 应用程序的目标浏览器列表"]
-2. 在工具栏中单击 "Run"(运行),或者在 "Projects"(项目)窗口中右键单击项目节点并选择 "Run"(运行)。
+
+[start=2]
+. 在工具栏中单击 "Run"(运行),或者在 "Projects"(项目)窗口中右键单击项目节点并选择 "Run"(运行)。
运行应用程序时,IDE 中将打开 Web 浏览器窗口。
@@ -170,8 +186,12 @@
1. 从主菜单中选择 "File"(文件)> "New Project"(新建项目)(Ctrl-Shift-N 组合键;在 Mac 上为 ⌘-Shift-N 组合键),以打开新建项目向导。
2. 选择 *HTML5* 类别,然后选择 *HTML5 Application*(HTML5 应用程序)。单击 "Next"(下一步)。
image::images/html5-newproject1.png[title="新建项目向导中的 HTML5 应用程序模板"]
-3. 为 "Project Name"(项目名称)键入 *HTML5Demo*,并指定计算机中用于保存项目的目录。单击 "Next"(下一步)。
-4. 在第 3 步 "Site Template"(站点模板)中,选择 "No Site Template"(无站点模板)。单击 "Next"(下一步)。
+
+[start=3]
+. 为 "Project Name"(项目名称)键入 *HTML5Demo*,并指定计算机中用于保存项目的目录。单击 "Next"(下一步)。
+
+[start=4]
+. 在第 3 步 "Site Template"(站点模板)中,选择 "No Site Template"(无站点模板)。单击 "Next"(下一步)。
image::images/html5-newproject2.png[title=""New HTML5 Application"(新建 HTML5 应用程序)向导中的 "Site Templates"(站点模板)面板"]
选择 "No Site Template"(无站点模板)选项时,向导将生成基本的空 NetBeans HTML5 项目。如果立即单击 "Finish"(完成),则现在项目将仅包含站点根文件夹,该文件夹中有一个 ``index.html`` 文件。
@@ -180,7 +200,9 @@
*注:*要根据列表中的一个联机模板创建项目,您必须处于联机状态。
-5. 在第 4 步 "JavaScript Files"(JavaScript 文件)中,从 "Available"(可用)窗格选择 ``jquery`` 和 ``jqueryui`` JavaScript 库,单击右箭头图标 ( > ) 以将所选库移动到向导的 "Selected"(选定)窗格。默认情况下,将在项目的 ``js/libraries`` 文件夹中创建库。在本教程中,您将使用 JavaScript 库的“缩小”版本。
+
+[start=5]
+. 在第 4 步 "JavaScript Files"(JavaScript 文件)中,从 "Available"(可用)窗格选择 ``jquery`` 和 ``jqueryui`` JavaScript 库,单击右箭头图标 ( > ) 以将所选库移动到向导的 "Selected"(选定)窗格。默认情况下,将在项目的 ``js/libraries`` 文件夹中创建库。在本教程中,您将使用 JavaScript 库的“缩小”版本。
可以使用面板上的文本字段来过滤 JavaScript 库列表。例如,在字段中键入 *jq* 可帮助您查找 ``jquery`` 库。按住 Ctrl 单击库的名称可以选择多个库。
@@ -190,7 +212,9 @@
* 可以在 "Version"(版本)列中单击库版本号以打开弹出窗口,通过该窗口可以选择库的较早版本。默认情况下,向导显示最新的版本。
* JavaScript 库的最小化版本是压缩版本,在编辑器中查看时,不太容易理解代码。
-6. 单击*完成*即可完成此向导。
+
+[start=6]
+. 单击*完成*即可完成此向导。
单击 "Finish"(完成)时,IDE 将创建项目、在 "Projects"(项目)窗口中显示项目的节点并在编辑器中打开 ``index.html`` 文件。
@@ -202,9 +226,13 @@
现在,您可以测试项目在 Chrome 浏览器中是否正确显示。
-7. 确认在工具栏的浏览器下拉表中选择了 "Chrome with NetBeans Connector integration"(集成 NetBeans Connector 的 Chrome)。
+
+[start=7]
+. 确认在工具栏的浏览器下拉表中选择了 "Chrome with NetBeans Connector integration"(集成 NetBeans Connector 的 Chrome)。
image::images/html5-js-selectbrowser.png[title="在工具栏下拉列表中选择的浏览器"]
-8. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Run"(运行)。
+
+[start=8]
+. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Run"(运行)。
选择 "Run"(运行)时,IDE 将在 Chrome 浏览器中打开一个标签,然后显示应用程序的默认 ``index.html`` 页面。"Browser DOM"(浏览器 DOM)窗口将在 IDE 中打开,并显示在浏览器中打开的页面的 DOM 树。
@@ -229,13 +257,19 @@
Zip 归档文件包含两个文件夹,其中带有需要添加到项目的文件: ``pix`` 和 ``css`` 。
-2. 将 ``pix`` 和 ``css`` 文件夹复制到站点根文件夹。
+
+[start=2]
+. 将 ``pix`` 和 ``css`` 文件夹复制到站点根文件夹。
*注:*如果要查看项目的目录结构,需要将文件夹复制到 ``public_html`` 文件夹。
image::images/html5-fileswindow.png[title="Chrome 浏览器标签中的 NetBeans 菜单"]
-3. 在编辑器中打开 `index.html`(如果尚未打开)。
-4. 在编辑器中,通过在 ``<head>`` 左右标记之间添加以下代码(粗体)来添加引用,指向在创建项目时添加的 JavaScript 库。
+
+[start=3]
+. 在编辑器中打开 `index.html`(如果尚未打开)。
+
+[start=4]
+. 在编辑器中,通过在 ``<head>`` 左右标记之间添加以下代码(粗体)来添加引用,指向在创建项目时添加的 JavaScript 库。
[source,xml]
----
@@ -257,7 +291,9 @@
您可以在编辑器中使用代码完成功能来获取帮助。
image::images/html5-editor1.png[title="编辑器中的代码完成功能"]
-5. 删除默认的 `TODO write content` 注释,并在 ``body`` 标记之间键入以下代码。
+
+[start=5]
+. 删除默认的 `TODO write content` 注释,并在 ``body`` 标记之间键入以下代码。
[source,html]
----
@@ -315,12 +351,16 @@
</div>
</body>
----
-6. 保存所做的更改。
+
+[start=6]
+. 保存所做的更改。
保存更改时,将在浏览器中自动重新加载页面,其外观应该类似于以下图像。
image::images/html5-runproject3.png[title="在 Chrome 浏览器标签中重新加载的页面"]
-7. 在文件的 ``<head>`` 标记之间键入以下内联 CSS 规则。
+
+[start=7]
+. 在文件的 ``<head>`` 标记之间键入以下内联 CSS 规则。
[source,xml]
----
@@ -342,7 +382,9 @@
打开 "Browser DOM"(浏览器 DOM)窗口可以看到页面的当前结构。
image::images/dom-browser.png[title="显示 DOM 树的 "Browser DOM"(浏览器 DOM)窗口"]
-8. 将以下样式表链接(*粗体*)添加到 `<head>` 标记之间。
+
+[start=8]
+. 将以下样式表链接(*粗体*)添加到 `<head>` 标记之间。
[source,xml]
----
@@ -359,7 +401,9 @@
可以在编辑器中打开 ``basecss.css`` 样式表并修改样式表,用于添加在之前步骤中添加的 CSS 规则或者为 CSS 规则创建新样式表。
-9. 在 ``<head>`` 标记之间添加以下代码以便在加载页中的元素时运行 jQuery 脚本。
+
+[start=9]
+. 在 ``<head>`` 标记之间添加以下代码以便在加载页中的元素时运行 jQuery 脚本。
[source,xml]
----
@@ -387,7 +431,9 @@
jQuery 指令采用 JavaScript 方法的形式,通过一个可选的对象字面值来表示参数数组,且必须置于 `(document).ready` 函数内的花括号 `{}` 之间,从而只在合适的时间执行,也就是在 DOM 完全加载后。
-10. 在 `(document).ready` 函数的花括号 `{}` 内输入下面的代码(粗体)。
+
+[start=10]
+. 在 `(document).ready` 函数的花括号 `{}` 内输入下面的代码(粗体)。
[source,xml]
----
@@ -443,7 +489,9 @@
通过在编辑器中单击右键并选择 "Format"(格式化代码)可以清理代码。
-11. 通过添加以下 `id` 选择器和值(粗体),修改包含页面内容的 ``<div>`` 元素。
+
+[start=11]
+. 通过添加以下 `id` 选择器和值(粗体),修改包含页面内容的 ``<div>`` 元素。
[source,html]
----
@@ -465,7 +513,9 @@
在对话框中单击 "OK"(确定)时, ``infolist`` 选择器的 CSS 规则将自动添加到 ``basecss.css`` 样式表。
-12. 将更改保存到 ``index.html`` (Ctrl-S;在 Mac 上为 ⌘-S)。
+
+[start=12]
+. 将更改保存到 ``index.html`` (Ctrl-S;在 Mac 上为 ⌘-S)。
保存更改时,Web 浏览器中的页面将自动加载。可以看到,页面的布局已更改,现在页面将使用在 ``basecss.css`` 样式表中定义的 CSS 样式规则。将打开 ``<h3>`` 下的一个列表,但其他列表现在折叠。可以单击 ``<h3>`` 元素以展开列表。
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support.asciidoc
index 974f417..1fa117f 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support.asciidoc
@@ -42,21 +42,7 @@
To watch a screencast of this tutorial, see link:../web/html5-javascript-screencast.html[+Video of Testing and Debugging JavaScript in HTML5 Applications+].
-=== Contents
-
-image::images/netbeans-stamp.png[title="Content on this page applies to NetBeans IDE 8.0"]
-
-* <<createproject,Creating the NetBeans HTML5 Application>>
-* <<debugger,Using the JavaScript Debugger>>
-* <<unittests,Running JS Unit Tests>>
-* <<karmatests,How to Run Tests with Karma>>
-* <<jstestdriver,How to Run Tests with JS Test Driver>>
-* <<debugtest,Debugging a JS Unit Test with JS Test Driver>>
-* <<summary,Summary>>
-* <<seealso,See Also>>
-
-
-==== To complete this tutorial, you will need the following resources.
+== To complete this tutorial, you will need the following resources.
|===
|Software or Resource |Version Required
@@ -86,7 +72,9 @@
2. Expand the *Samples* node in the New Project wizard and select the *HTML5* category.
3. Select the *AngularJS Phone Catalog Tutorial* project. Click Next.
image::images/html5-js-newproject.png[title="AngularJS Phone Catalog Tutorial sample project in New File wizard"]
-4. Specify a location for the project. Click Finish.
+
+[start=4]
+. Specify a location for the project. Click Finish.
*Note.* Note that the URL of the template is github. The IDE needs to be able to access the network to retrieve the template archive. Check your proxy settings in the Options window if you encounter problems downloading the archive.
@@ -96,9 +84,13 @@
The project also includes several JavaScript unit test and configuration files that were generated by default.
-5. Confirm that Chrome with NetBeans Connector is selected in the dropdown list in the toolbar.
+
+[start=5]
+. Confirm that Chrome with NetBeans Connector is selected in the dropdown list in the toolbar.
image::images/html5-js-selectbrowser.png[title="Browser selected in dropdown list in toolbar"]
-6. Click the Run button in the toolbar (F6) or right-click the project node in the Projects window and choose Run.
+
+[start=6]
+. Click the Run button in the toolbar (F6) or right-click the project node in the Projects window and choose Run.
When you Run the project the front page of the HTML5 application opens in the Chrome browser and you can see a list of mobile phones. When you click the name of a mobile phone the page displays the phone details.
@@ -122,29 +114,41 @@
You can view the breakpoints that are set in the project by choosing Window > Debugging > Breakpoints to open the Breakpoints window.
image::images/html5-js-breakpoint2.png[title="List of breakpoints in Breakpoints window"]
-3. Click the Run button in the toolbar to run the project again.
+
+[start=3]
+. Click the Run button in the toolbar to run the project again.
When you run the project you will see the same page because the breakpoint that you set was not hit.
-4. In the browser, click one of the entries in the page, for example, Motorola Atrix4G.
+
+[start=4]
+. In the browser, click one of the entries in the page, for example, Motorola Atrix4G.
You will see that the page is partially loaded but that the data for the phone is missing because the data has not been passed to the JavaScript and rendered.
image::images/html5-js-break-details.png[title="Details page of the application is partially loaded in the browser"]
-5. In the editor in the IDE you can see that the breakpoint was hit and that the Program Counter is currently in line 16 of ``controllers.js`` .
-6. Hover your cursor over the ``phone`` variable to view a tooltip with information about the variable.
+
+[start=5]
+. In the editor in the IDE you can see that the breakpoint was hit and that the Program Counter is currently in line 16 of ``controllers.js`` .
+
+[start=6]
+. Hover your cursor over the ``phone`` variable to view a tooltip with information about the variable.
image::images/html5-js-variables1.png[title="Variables tooltip in editor"]
In the tooltip you can see the following information: ``phone = (Resource) Resource`` .
-7. Click the tooltip to expand the tooltip and view a list of the variables and values.
+
+[start=7]
+. Click the tooltip to expand the tooltip and view a list of the variables and values.
image::images/html5-js-variables.png[title="Expanded variables tooltip in editor"]
For example, when you expand the ``android`` node you can see the values of the strings ``os`` and ``ui`` .
You can also choose Window > Debugging > Variables to view the list in the Variables window.
-8. Use the step buttons in the toolbar to step through the JavaScript functions in the ``angular.js`` library or click the Continue button (F5) to resume the application.
+
+[start=8]
+. Use the step buttons in the toolbar to step through the JavaScript functions in the ``angular.js`` library or click the Continue button (F5) to resume the application.
== Running JS Unit Tests
@@ -162,7 +166,9 @@
You can choose how and where you want to install Karma. You will specify the installation later when you configure the project to use Karma. You can find information about the options for installing Karma on the link:http://karma-runner.github.io[+Karma website+].
-2. Create a Karma configuration file.
+
+[start=2]
+. Create a Karma configuration file.
In this tutorial this step is optional because the sample application already includes a Karma configuration file. You can create a skeleton Karma configuration file by selecting Karma Configuration File in the Unit Tests category of the New File wizard.
@@ -170,20 +176,34 @@
Alternatively, you can run the Karma ``init`` command on the command line. See the Karma documentation for more details on using the Karma ``init`` command.
-3. Expand the Configuration Files node in the Projects window and double-click ``karma.conf.js`` to open the file in the editor. Note that the sample includes two Karma configuration files.
+
+[start=3]
+. Expand the Configuration Files node in the Projects window and double-click ``karma.conf.js`` to open the file in the editor. Note that the sample includes two Karma configuration files.
In the Karma configuration file you can see the files that will be included and excluded when you run the tests. You can also see the Karma plugins that are required to run the tests with this configuration.
image::images/karma-plugins.png[title="Karma configuration file in the editor"]
-4. Right-click the project node in the Projects window and choose Properties in the popup menu.
-5. Select JavaScript Testing category in the Categories pane of the Project Properties window.
-6. Select Karma in the Testing Provider drop-down list. Click OK.
-7. Open the Project Properties window again and select Karma under the JavaScript Testing category in the Categories pane.
-8. Specify the location of your Karma installation.
+
+[start=4]
+. Right-click the project node in the Projects window and choose Properties in the popup menu.
+
+[start=5]
+. Select JavaScript Testing category in the Categories pane of the Project Properties window.
+
+[start=6]
+. Select Karma in the Testing Provider drop-down list. Click OK.
+
+[start=7]
+. Open the Project Properties window again and select Karma under the JavaScript Testing category in the Categories pane.
+
+[start=8]
+. Specify the location of your Karma installation.
If you installed Karma in your project directory you can click Search and the IDE will find the installation. You can also click Browse to manually locate your local Karma installation.
-9. Specify the location of your Karma configuration file. Click OK.
+
+[start=9]
+. Specify the location of your Karma configuration file. Click OK.
In this tutorial you can click Search and the IDE will find the default Karma configuration file. You can also click Browse to manually locate a configuration file.
@@ -191,7 +211,9 @@
When you click OK you can see that a Karma node appears under the project node in the Projects window. You right-click the Karma node and start and stop the Karma server and set the configuration file in the popup menu.
-10. Right-click the Karma node in the Projects window and choose Start in the popup menu.
+
+[start=10]
+. Right-click the Karma node in the Projects window and choose Start in the popup menu.
When you click Start the Karma server starts and a browser window opens that displays the status of the server.
@@ -203,12 +225,18 @@
*Note.* The browser window must be open and the Karma server must be running to run the unit tests.
-11. Right-click the Karma node and choose Set Configuration > ``karma.conf.js`` to confirm that the correct configuration file is selected. image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="Configure jsTest Driver node in Services window"]
-12. Disable any breakpoints that you set in the project.
+
+[start=11]
+. Right-click the Karma node and choose Set Configuration > ``karma.conf.js`` to confirm that the correct configuration file is selected. image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="Configure jsTest Driver node in Services window"]
+
+[start=12]
+. Disable any breakpoints that you set in the project.
You can disable the breakpoints by deselecting the checkbox for the breakpoints in the Breakpoints window.
-13. Right-click the project node in the Projects window and choose Test.
+
+[start=13]
+. Right-click the project node in the Projects window and choose Test.
When you choose Test the test runner runs the unit tests on the files. The IDE opens the Test Results window and displays the results of the test.
@@ -224,8 +252,12 @@
1. Download the link:http://code.google.com/p/js-test-driver/[+JS Test Driver JAR+] and save the JAR to your local system.
2. In the Services window, right-click the JS Test Driver node and choose Configure.
image::images/html5-js-testdriver-serviceswindow.png[title="Configure jsTest Driver node in Services window"]
-3. In the Configure dialog box, click Browse and locate the JS Test Driver JAR that you downloaded.
-4. Select the Chrome with NetBeans Connector (in NetBeans IDE 7.3, select Chrome with NetBeans JS Debugger) for the browser. Click OK.
+
+[start=3]
+. In the Configure dialog box, click Browse and locate the JS Test Driver JAR that you downloaded.
+
+[start=4]
+. Select the Chrome with NetBeans Connector (in NetBeans IDE 7.3, select Chrome with NetBeans JS Debugger) for the browser. Click OK.
image::images/html5-js-testdriver-configure.png[title="Configure jsTest Driver dialog box"]
*Notes.* You only need to specify the location of the JS Test Driver JAR the first time that you configure the JS Test Driver.
@@ -234,14 +266,24 @@
When you select Chrome with NetBeans Connector you can debug your tests that are run with JS Test Driver.
-5. Right-click the project node in the Projects window and choose New > Other.
-6. Select the *jsTestDriver Configuration File* in the Unit Tests category. Click Next.
-7. Confirm that *jsTestDriver* is the File Name.
-8. In the Created File field, confirm that the location for the file is the ``config`` folder of the project ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` ).
+
+[start=5]
+. Right-click the project node in the Projects window and choose New > Other.
+
+[start=6]
+. Select the *jsTestDriver Configuration File* in the Unit Tests category. Click Next.
+
+[start=7]
+. Confirm that *jsTestDriver* is the File Name.
+
+[start=8]
+. In the Created File field, confirm that the location for the file is the ``config`` folder of the project ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` ).
*Note.* The ``jsTestDriver.conf`` configuration file must be in the ``config`` folder of the project. If the location for the created file is not the ``config`` folder, click Browse and select ``AngularJSPhoneCat - Configuration Files`` folder in the dialog box.
-9. Confirm that the checkbox for downloading the Jasmine libraries is selected. Click Finish.
+
+[start=9]
+. Confirm that the checkbox for downloading the Jasmine libraries is selected. Click Finish.
image::images/html5-js-testdriver-configfile.png[title="New jsTestDriver Configuration File wizard"]
*Note.*You need to download the Jasmine libraries to run jsTestDriver. If you are notified that the IDE is unable to download the Jasmine libraries, check the proxy settings of the IDE in the Options window.
@@ -288,7 +330,9 @@
*
- test/unit/*.js
----
-10. After you update the configuration file you can right-click the project node in the Projects window and choose Test.
+
+[start=10]
+. After you update the configuration file you can right-click the project node in the Projects window and choose Test.
When you click Test the IDE automatically opens the JS Test runner in the Chrome browser and two tabs in the Output window.
@@ -303,7 +347,9 @@
*Note.* The browser window must be open and the jsTestDriver server must be running to run the unit tests. You can start the server and open the window by right-clicking the JS Test Driver node in the Services window and choosing Start.
image::images/html5-js-testdriver-outputwindow.png[title="Running JS unit tests tab in Output window"]
-11. Choose Window > Output > Test Results in the main menu to open the Test Results window and see the results of the tests.
+
+[start=11]
+. Choose Window > Output > Test Results in the main menu to open the Test Results window and see the results of the tests.
image::images/html5-js-testdriver-testresultswindow.png[title="Test Results window"]
You can click the green check icon in the left margin of the window to view the the expanded list of the tests that passed.
@@ -329,18 +375,26 @@
When you save your changes the page automatically reloads in the browser. You can see that the order of the phones in the list changed.
-3. Confirm that the JS Test Driver server is running and that the status message is visible in the Chrome browser window.
-4. Right-click the project node in the Projects window and choose Test.
+
+[start=3]
+. Confirm that the JS Test Driver server is running and that the status message is visible in the Chrome browser window.
+
+[start=4]
+. Right-click the project node in the Projects window and choose Test.
image::images/html5-js-testdriver-testresultswindow-fail.png[title="Failed test in Test Results window"]
When you run the test you can see that one of the tests failed with the message that the value "name" was encountered instead of the expected value "age".
-5. Open the Running JS unit tests tab in the Output window.
+
+[start=5]
+. Open the Running JS unit tests tab in the Output window.
image::images/html5-js-testdriver-outputwindow-fail.png[title="Failed test in Running JS unit tests tab in Output window"]
You can see in the message that the ``orderProp`` is expected to be ``age`` on line 41.
-6. Click the link in the Running JS unit tests tab to navigate to the line in the test that failed. The test file ``controllersSpec.js`` opens in the editor at line 41 (in *bold*)
+
+[start=6]
+. Click the link in the Running JS unit tests tab to navigate to the line in the test that failed. The test file ``controllersSpec.js`` opens in the editor at line 41 (in *bold*)
[source,java]
----
@@ -352,8 +406,12 @@
You can see that the test expected "age" as the value of ``scopeOrder.prop`` .
-7. Set a breakpoint at the line where the test failed (line 41).
-8. Right-click the project node in the Projects window and choose Test.
+
+[start=7]
+. Set a breakpoint at the line where the test failed (line 41).
+
+[start=8]
+. Right-click the project node in the Projects window and choose Test.
When you run the test again the program counter hits the breakpoint. If you hover your cursor over ``scopeOrder.prop`` you can see in the tooltip that the value of the variable is "name" when the breakpoint is hit.
@@ -361,7 +419,9 @@
Alternatively, you can choose Debug > Evaluate Expression in the main menu to open the Evaluate Code window. If you type the expression ``scopeOrder.prop`` in the window and click the Evaluate Code Fragment button (image::images/evaluate-button.png[title="Evaluate Expression button"])(Ctrl-Enter) the debugger displays the value of the expression in the Variables window.
-9. Click Continue in the toolbar to finish running the test.
+
+[start=9]
+. Click Continue in the toolbar to finish running the test.
[[summary]]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ja.asciidoc
index 5c22887..18e2c2a 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ja.asciidoc
@@ -43,11 +43,7 @@
-image::images/netbeans-stamp.png[title="このページの内容は、NetBeans IDE 8.0に適用されます"]
-
-
-
-==== このチュートリアルを完了するには、次のリソースが必要です。
+== このチュートリアルを完了するには、次のリソースが必要です。
|===
|ソフトウェアまたはリソース |必須バージョン
@@ -77,7 +73,9 @@
2. 新規プロジェクト・ウィザードで*「サンプル」*ノードを展開し、*「HTML5」*カテゴリを選択します。
3. *「AngularJSの端末カタログ・チュートリアル」*プロジェクトを選択します。「次」をクリックします。
image::images/html5-js-newproject.png[title="新規ファイル・ウィザードの「AngularJSの端末カタログ・チュートリアル」サンプル・プロジェクト"]
-4. プロジェクトの場所を指定します。「終了」をクリックします。
+
+[start=4]
+. プロジェクトの場所を指定します。「終了」をクリックします。
*注意:*テンプレートのURLはgithubです。IDEはネットワークにアクセスしてテンプレート・アーカイブを取得できる必要があります。アーカイブのダウンロードで問題が発生した場合は、「オプション」ウィンドウでプロキシ設定を確認します。
@@ -87,9 +85,13 @@
プロジェクトには、デフォルトで生成された複数のJavaScript単体テストおよび構成ファイルも含まれます。
-5. NetBeans Connector付きChromeがツールバーのドロップダウン・リストで選択されていることを確認します。
+
+[start=5]
+. NetBeans Connector付きChromeがツールバーのドロップダウン・リストで選択されていることを確認します。
image::images/html5-js-selectbrowser.png[title="ツールバーのドロップダウン・リストで選択されたブラウザ"]
-6. ツールバーで「実行」ボタンをクリックするか(F6)、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックして「実行」を選択します。
+
+[start=6]
+. ツールバーで「実行」ボタンをクリックするか(F6)、「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックして「実行」を選択します。
プロジェクトを実行すると、HTML5アプリケーションのフロント・ページがChromeブラウザに開き、携帯端末のリストが表示されます。携帯端末の名前をクリックすると、ページに端末の詳細が表示されます。
@@ -113,29 +115,41 @@
「ウィンドウ」→「デバッグ」→「ブレークポイント」を選択して「ブレークポイント」ウィンドウを開き、プロジェクトで設定したブレークポイントを表示できます。
image::images/html5-js-breakpoint2.png[title="「ブレークポイント」ウィンドウのブレークポイントのリスト"]
-3. ツールバーの「実行」ボタンをクリックして、プロジェクトを再度実行します。
+
+[start=3]
+. ツールバーの「実行」ボタンをクリックして、プロジェクトを再度実行します。
プロジェクトを実行すると、設定したブレークポイントがヒットしないため同じページが表示されます。
-4. ブラウザで、ページのMotorola Atrix4Gなどのエントリの1つをクリックします。
+
+[start=4]
+. ブラウザで、ページのMotorola Atrix4Gなどのエントリの1つをクリックします。
データはJavaScriptに渡されておらず、レンダリングされていないため、ページは部分的にロードされ、端末のデータはないことがわかります
image::images/html5-js-break-details.png[title="ブラウザに部分的にロードされたアプリケーションの詳細ページ"]
-5. IDEのエディタで、ブレークポイントがヒットし、プログラム・カウンタが現在 ``controllers.js`` の行16にあることを確認できます。
-6. ``phone`` 変数の上にカーソルを移動し、変数に関するツールチップ情報を表示します。
+
+[start=5]
+. IDEのエディタで、ブレークポイントがヒットし、プログラム・カウンタが現在 ``controllers.js`` の行16にあることを確認できます。
+
+[start=6]
+. ``phone`` 変数の上にカーソルを移動し、変数に関するツールチップ情報を表示します。
image::images/html5-js-variables1.png[title="エディタの変数ツールチップ"]
ツールチップに、 ``phone = (Resource) Resource`` という情報が表示されます。
-7. ツールチップをクリックしてツールチップを展開し、変数と値のリストを表示します。
+
+[start=7]
+. ツールチップをクリックしてツールチップを展開し、変数と値のリストを表示します。
image::images/html5-js-variables.png[title="エディタの展開された変数ツールチップ"]
たとえば、「 ``android`` 」ノードを展開すると、文字列 ``os`` および ``ui`` の値が表示されます。
「ウィンドウ」→「デバッグ」→「変数」を選択して、「変数」ウィンドウにリストを表示することもできます。
-8. ツールバーの手順ボタンを使用して、 ``angular.js`` ライブラリでJavaScript関数をステップ実行するか、「続行」ボタン(F5)をクリックしてアプリケーションを再開します。
+
+[start=8]
+. ツールバーの手順ボタンを使用して、 ``angular.js`` ライブラリでJavaScript関数をステップ実行するか、「続行」ボタン(F5)をクリックしてアプリケーションを再開します。
== JS単体テストの実行
@@ -153,7 +167,9 @@
Karmaをインストールする方法と場所を選択できます。Karmaを使用するようにプロジェクトを構成する場合は、インストールを後から指定します。link:http://karma-runner.github.io[+Karma Webサイト+]にKarmaをインストールするオプションについての情報を検索できます。
-2. Karma構成ファイルを作成します。
+
+[start=2]
+. Karma構成ファイルを作成します。
サンプル・アプリケーションにはKarma構成ファイルがすでに含まれているため、このチュートリアルでは、この手順はオプションです。新規ファイル・ウィザードの単体テスト・カテゴリでKarma構成ファイルを選択することで、スケルトンKarma構成ファイルを作成できます。
@@ -161,20 +177,34 @@
コマンド・ラインでKarma ``init`` コマンドを実行することもできます。Karma ``init`` コマンドの使用の詳細は、Karmaドキュメントを参照してください。
-3. 「プロジェクト」ウィンドウで「構成ファイル」ノードを展開して「 ``karma.conf.js`` 」をダブルクリックし、エディタでファイルを開きます。サンプルには、2つのKarma構成ファイルが含まれます。
+
+[start=3]
+. 「プロジェクト」ウィンドウで「構成ファイル」ノードを展開して「 ``karma.conf.js`` 」をダブルクリックし、エディタでファイルを開きます。サンプルには、2つのKarma構成ファイルが含まれます。
Karma構成ファイルには、テストの実行時に含められたり除外されたりするファイルが含まれます。この構成でテストを実行するのに必要なKarmaプラグインも含まれます。
image::images/karma-plugins.png[title="エディタ内のKarma構成ファイル"]
-4. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、ポップアップ・メニューで「プロパティ」を選択します。
-5. プロジェクト・プロパティ・ウィンドウの「カテゴリ」ペインで「JavaScriptテスト」カテゴリを選択します。
-6. 「テスト・プロバイダ」ドロップダウン・リストで「Karma」を選択します。「OK」をクリックします。
-7. プロジェクト・プロパティ・ウィンドウを再度開き、「カテゴリ」ペインの「JavaScriptテスト」カテゴリで「Karma」を選択します。
-8. Karmaインストールの場所を指定します。
+
+[start=4]
+. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、ポップアップ・メニューで「プロパティ」を選択します。
+
+[start=5]
+. プロジェクト・プロパティ・ウィンドウの「カテゴリ」ペインで「JavaScriptテスト」カテゴリを選択します。
+
+[start=6]
+. 「テスト・プロバイダ」ドロップダウン・リストで「Karma」を選択します。「OK」をクリックします。
+
+[start=7]
+. プロジェクト・プロパティ・ウィンドウを再度開き、「カテゴリ」ペインの「JavaScriptテスト」カテゴリで「Karma」を選択します。
+
+[start=8]
+. Karmaインストールの場所を指定します。
Karmaをプロジェクト・ディレクトリにインストールした場合は、「検索」をクリックするとIDEでインストールが検索されます。「参照」をクリックし、ローカルのKarmaインストールを手動で見つけることもできます。
-9. Karma構成ファイルの場所を指定します。「OK」をクリックします。
+
+[start=9]
+. Karma構成ファイルの場所を指定します。「OK」をクリックします。
このチュートリアルでは、「検索」をクリックするとIDEでデフォルトのKarma構成ファイルが検索されます。「参照」をクリックし、構成ファイルを手動で見つけることもできます。
@@ -182,7 +212,9 @@
「OK」をクリックすると、「プロジェクト」ウィンドウの「プロジェクト」ノードの下に「Karma」ノードが表示されます。「Karma」ノードを右クリックしてKarmaサーバーを起動および停止し、ポップアップ・メニューで構成ファイルを設定します。
-10. 「プロジェクト」ウィンドウで「Karma」ノードを右クリックし、ポップアップ・メニューで「起動」を選択します。
+
+[start=10]
+. 「プロジェクト」ウィンドウで「Karma」ノードを右クリックし、ポップアップ・メニューで「起動」を選択します。
「起動」をクリックするとKarmaサーバーが起動し、サーバーのステータスを示すブラウザ・ウィンドウが開きます。
@@ -194,12 +226,18 @@
*注意:*単体テストを実行するには、ブラウザ・ウィンドウが開き、Karmaサーバーが稼働している必要があります。
-11. 「Karma」ノードを右クリックして「構成を設定」>「 ``karma.conf.js`` 」の順に選択し、正しい構成ファイルが選択されていることを確認する必要があります。image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="「サービス」ウィンドウの「jsTestドライバの構成」ノード"]
-12. プロジェクトで設定したブレークポイントを無効にします。
+
+[start=11]
+. 「Karma」ノードを右クリックして「構成を設定」>「 ``karma.conf.js`` 」の順に選択し、正しい構成ファイルが選択されていることを確認する必要があります。image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="「サービス」ウィンドウの「jsTestドライバの構成」ノード"]
+
+[start=12]
+. プロジェクトで設定したブレークポイントを無効にします。
「ブレークポイント」ウィンドウでブレークポイントのチェックボックスを選択解除することにより、ブレークポイントを無効にできます。
-13. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「テスト」を選択します。
+
+[start=13]
+. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「テスト」を選択します。
「テスト」を選択すると、テスト・ランナーによってファイルで単体テストが実行されます。IDEにより「テスト結果」ウィンドウが開かれ、テストの結果が表示されます。
@@ -215,8 +253,12 @@
1. link:http://code.google.com/p/js-test-driver/[+JSテスト・ドライバJAR+]をダウンロードし、JARをローカル・システムに保存します。
2. 「サービス」ウィンドウで、「JSテスト・ドライバ」ノードを右クリックし、「構成」を選択します。
image::images/html5-js-testdriver-serviceswindow.png[title="「サービス」ウィンドウの「jsTestドライバの構成」ノード"]
-3. 「構成」ダイアログ・ボックスで、「参照」をクリックし、ダウンロードしたJSテスト・ドライバJARを特定します。
-4. ブラウザに、NetBeans Connector付きChrome (NetBeans IDE 7.3では、NetBeans JS Debugger付きChrome)を選択します。「OK」をクリックします。
+
+[start=3]
+. 「構成」ダイアログ・ボックスで、「参照」をクリックし、ダウンロードしたJSテスト・ドライバJARを特定します。
+
+[start=4]
+. ブラウザに、NetBeans Connector付きChrome (NetBeans IDE 7.3では、NetBeans JS Debugger付きChrome)を選択します。「OK」をクリックします。
image::images/html5-js-testdriver-configure.png[title="「jsTestドライバの構成」ダイアログ・ボックス"]
*注意:*JSテスト・ドライバを初めて構成する場合にのみ、JSテスト・ドライバJARの場所を指定する必要があります。
@@ -225,14 +267,24 @@
NetBeans ConnectorのあるChromeを選択した場合、JSテスト・ドライバで実行されるテストをデバッグできます。
-5. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「新規」>「その他」を選択します。
-6. 「単体テスト」カテゴリで*「jsTestDriver構成ファイル」*を選択します。「次」をクリックします。
-7. *jsTestDriver*がファイル名であることを確認します。
-8. 「作成されるファイル」フィールドで、ファイルの場所がプロジェクト( ``AngularJSPhoneCat/config/jsTestDriver.conf`` )の ``config`` フォルダであることを確認します。
+
+[start=5]
+. 「プロジェクト」ウィンドウでプロジェクト・ノードを右クリックし、「新規」>「その他」を選択します。
+
+[start=6]
+. 「単体テスト」カテゴリで*「jsTestDriver構成ファイル」*を選択します。「次」をクリックします。
+
+[start=7]
+. *jsTestDriver*がファイル名であることを確認します。
+
+[start=8]
+. 「作成されるファイル」フィールドで、ファイルの場所がプロジェクト( ``AngularJSPhoneCat/config/jsTestDriver.conf`` )の ``config`` フォルダであることを確認します。
*注意:* ``jsTestDriver.conf`` 構成ファイルはプロジェクトの ``config`` フォルダにある必要があります。作成されるファイルの場所が ``config`` フォルダでない場合は、「参照」をクリックし、ダイアログ・ボックスで「 ``AngularJSPhoneCat - Configuration Files`` 」フォルダを選択します。
-9. Jasmineライブラリのダウンロードのチェックボックスが選択されていることを確認します。「終了」をクリックします。
+
+[start=9]
+. Jasmineライブラリのダウンロードのチェックボックスが選択されていることを確認します。「終了」をクリックします。
image::images/html5-js-testdriver-configfile.png[title="新規jsTestDriver構成ファイル・ウィザード"]
*注意:* jsTestDriverを実行するにはJasmineライブラリをダウンロードする必要があります。IDEがJasmineライブラリをダウンロードできないことを通知された場合は、「オプション」ウィンドウでIDEのプロキシ設定を確認します。
@@ -279,7 +331,9 @@
*
- test/unit/*.js
----
-10. 構成ファイルの更新後、「プロジェクト」ウィンドウで「プロジェクト」ノードを右クリックして、「テスト」を選択できます。
+
+[start=10]
+. 構成ファイルの更新後、「プロジェクト」ウィンドウで「プロジェクト」ノードを右クリックして、「テスト」を選択できます。
「テスト」をクリックすると、IDEがChromeブラウザにJSテスト・ランナーを自動的に開き、「出力」ウィンドウに2つのタブを開きます。
@@ -294,7 +348,9 @@
*注意:*単体テストを実行するには、ブラウザ・ウィンドウが開き、jsTestDriverサーバーが稼働している必要があります。「サービス」ウィンドウの「JSテスト・ドライバ」ノードを右クリックし、「起動」を選択して、サーバーを起動し、ウィンドウを開くことができます。
image::images/html5-js-testdriver-outputwindow.png[title="「出力」ウィンドウの実行中のJS単体テスト・タブ"]
-11. メイン・メニューの「ウィンドウ」→「出力」→「テスト結果」を選択して、「テスト結果」ウィンドウを開き、テストの結果を確認します。
+
+[start=11]
+. メイン・メニューの「ウィンドウ」→「出力」→「テスト結果」を選択して、「テスト結果」ウィンドウを開き、テストの結果を確認します。
image::images/html5-js-testdriver-testresultswindow.png[title="「テスト結果」ウィンドウ"]
ウィンドウの左マージンの緑のチェック・アイコンをクリックして、成功したテストの展開したリストを表示できます。
@@ -320,18 +376,26 @@
変更を保存すると、ブラウザにページが自動的に再ロードされます。リスト内の端末の順序が変更されたことを確認できます。
-3. JSテスト・ドライバ・サーバーが稼動中で、ステータス・メッセージがChromeブラウザ・ウィンドウに表示されていることを確認します。
-4. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「テスト」を選択します。
+
+[start=3]
+. JSテスト・ドライバ・サーバーが稼動中で、ステータス・メッセージがChromeブラウザ・ウィンドウに表示されていることを確認します。
+
+[start=4]
+. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「テスト」を選択します。
image::images/html5-js-testdriver-testresultswindow-fail.png[title="「テスト結果」ウィンドウの失敗したテスト"]
テストを実行すると、期待される値"age"のかわりに値"name"が検出されたことを示すメッセージでテストの1つが失敗したことを確認できます。
-5. 「出力」ウィンドウの実行中のJS単体テスト・タブを開きます。
+
+[start=5]
+. 「出力」ウィンドウの実行中のJS単体テスト・タブを開きます。
image::images/html5-js-testdriver-outputwindow-fail.png[title="「出力」ウィンドウの「実行中のJS単体テスト」タブの失敗したテスト"]
``orderProp`` が行41に ``age`` を期待していることをメッセージで確認できます。
-6. 実行中のJS単体テスト・タブのリンクをクリックして、失敗したテストの行に移動します。テスト・ファイル ``controllersSpec.js`` がエディタの行41 (*太字*)に開きます
+
+[start=6]
+. 実行中のJS単体テスト・タブのリンクをクリックして、失敗したテストの行に移動します。テスト・ファイル ``controllersSpec.js`` がエディタの行41 (*太字*)に開きます
[source,java]
----
@@ -343,8 +407,12 @@
テストでは ``scopeOrder.prop`` の値として"age"が期待されたことがわかります。
-7. テストが失敗した行(行41)にブレークポイントを設定します。
-8. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「テスト」を選択します。
+
+[start=7]
+. テストが失敗した行(行41)にブレークポイントを設定します。
+
+[start=8]
+. 「プロジェクト」ウィンドウでプロジェクトのノードを右クリックし、「テスト」を選択します。
テストを再度実行すると、プログラム・カウンタがブレークポイントにヒットします。カーソルを ``scopeOrder.prop`` 上に移動すると、ブレークポイントにヒットしたときの変数の値が"name"であることをツールチップで確認できます。
@@ -352,7 +420,9 @@
または、メイン・メニューの「デバッグ」→「式の評価」を選択して、「コードを評価」ウィンドウを開くことができます。ウィンドウに式 ``scopeOrder.prop`` を入力し、「コード・フラグメントを評価(Ctrl+Enter)」ボタン(image::images/evaluate-button.png[title="「式の評価」ボタン"])をクリックすると、デバッガによって式の値が「変数」ウィンドウに表示されます。
-9. ツールバーの「続行」をクリックして、テストの実行を終了します。
+
+[start=9]
+. ツールバーの「続行」をクリックして、テストの実行を終了します。
[[summary]]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_pt_BR.asciidoc
index 04cc83a..b965fd3 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_pt_BR.asciidoc
@@ -43,11 +43,7 @@
-image::images/netbeans-stamp.png[title="O conteúdo desta página se aplica ao NetBeans IDE 8.0"]
-
-
-
-==== Para concluir este tutorial, você precisará dos recursos a seguir:
+== Para concluir este tutorial, você precisará dos recursos a seguir:
|===
|Software ou Recurso |Versão Necessária
@@ -77,7 +73,9 @@
2. Expanda o nó *Exemplos* no assistente do Novo Projeto e selecione a categoria *HTML5*.
3. Selecione o projeto *Tutorial do Catálogo de Telefone AngularJS*. Clique em Próximo.
image::images/html5-js-newproject.png[title="Projeto Tutorial do Catálogo de Telefone AngularJS no assiste de Novo Arquivo"]
-4. Selecione uma localização para o projeto. Clique em Finalizar.
+
+[start=4]
+. Selecione uma localização para o projeto. Clique em Finalizar.
*Observação.* Observe que o URL do modelo é github. O IDE precisa acessar a rede para recuperar o archive do modelo. Verifique as definições de proxy na janela Opções se você encontrar problemas ao fazer download do archive.
@@ -87,9 +85,13 @@
O projeto também inclui vários arquivos de configuração e teste de unidade JavaScript gerados por default.
-5. Confirme que Chrome com Conector do NetBeans está selecionado na lista drop-down, na barra de ferramentas.
+
+[start=5]
+. Confirme que Chrome com Conector do NetBeans está selecionado na lista drop-down, na barra de ferramentas.
image::images/html5-js-selectbrowser.png[title="Browser selecionado na lista drop-down na barra de ferramentas"]
-6. Clique no botão Executar na barra de ferramentas (F6) ou clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Executar.
+
+[start=6]
+. Clique no botão Executar na barra de ferramentas (F6) ou clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Executar.
Quando você executa o projeto, a página frontal da aplicação em HTML5 é aberta no browser Chrome e você pode ver uma lista de telefones celulares. Quando você clica no nome de um telefone celular, a página exibe os detalhes do telefone.
@@ -113,29 +115,41 @@
Você pode exibir os pontos de interrupção definidos no projeto escolhendo Janela > Depuração > Pontos de Interrupção para abrir a janela Pontos de Interrupção.
image::images/html5-js-breakpoint2.png[title="Lista de pontos de interrupção na janela Pontos de Interrupção"]
-3. Clique no botão Executar na barra de ferramentas para executar o projeto novamente.
+
+[start=3]
+. Clique no botão Executar na barra de ferramentas para executar o projeto novamente.
Quando você executar o projeto, verá a mesma página, porque o ponto de interrupção que você definiu não foi atingido.
-4. No browser, clique em uma das entradas na página, por exemplo, Motorola Atrix4G.
+
+[start=4]
+. No browser, clique em uma das entradas na página, por exemplo, Motorola Atrix4G.
Você verá que a página foi parcialmente carregada, mas que os dados do telefone estão ausentes, pois eles não foram transmitidos para o JavaScript e renderizados.
image::images/html5-js-break-details.png[title="Página Detalhes da aplicação parcialmente carregada no browser"]
-5. No editor no IDE, você pode ver que o ponto de interrupção foi atingido e que o Contador do Programa está atualmente na linha 16 de ``controllers.js`` .
-6. Passe o cursor na variável ``phone`` para exibir uma dica de ferramenta com informações sobre a variável.
+
+[start=5]
+. No editor no IDE, você pode ver que o ponto de interrupção foi atingido e que o Contador do Programa está atualmente na linha 16 de ``controllers.js`` .
+
+[start=6]
+. Passe o cursor na variável ``phone`` para exibir uma dica de ferramenta com informações sobre a variável.
image::images/html5-js-variables1.png[title="Dica de ferramentas no editor"]
Na dica de ferramentas, você pode ver as seguintes informações: ``telefone = (Recurso) Recurso`` .
-7. Clique na dica de ferramenta para expandi-la e exibir uma lista das variáveis e valores.
+
+[start=7]
+. Clique na dica de ferramenta para expandi-la e exibir uma lista das variáveis e valores.
image::images/html5-js-variables.png[title="Dica de ferramenta das variáveis expandida no editor"]
Por exemplo, quando você expande o nó ``android`` , pode ver os valores das strings ``os`` e ``ui`` ..
Você também pode escolher Janela > Depuração > Variáveis para exibir a lista na janela Variáveis.
-8. Use os botões de etapas da barra de ferramentas para avançar nas funções de JavaScript na biblioteca ``angular.js`` ou clique no botão Continuar (F5) para continuar a aplicação.
+
+[start=8]
+. Use os botões de etapas da barra de ferramentas para avançar nas funções de JavaScript na biblioteca ``angular.js`` ou clique no botão Continuar (F5) para continuar a aplicação.
== Executando Testes em JS Unit
@@ -153,7 +167,9 @@
Você pode escolher como e onde deseja instalar o Karma. A instalação deverá ser especificada posteriormente na configuração do projeto para usar o Karma. Encontre informações sobre as opções de instalação do Karma no link:http://karma-runner.github.io[+site do Karma+].
-2. Crie um arquivo de configuração de Karma.
+
+[start=2]
+. Crie um arquivo de configuração de Karma.
Neste tutorial, esta etapa é opcional porque a aplicação de amostra já inclui um arquivo de configuração de Karma. Você pode criar um arquivo de configuração de Karma base selecionando Arquivo de Configuração do Karma na categoria Testes de Unidade do assistente de Novo Arquivo.
@@ -161,20 +177,34 @@
Como alternativa, execute o comando ``init`` do Karma na linha de comandos. Consulte a documentação do Karma para obter mais detalhes sobre o uso do comando ``init`` .
-3. Expanda o nó Arquivos de Configuração na janela Projetos e clique duas vezes em ``karma.conf.js`` para abrir o arquivo no editor. Observe que a amostra inclui dois arquivos de configuração do Karma.
+
+[start=3]
+. Expanda o nó Arquivos de Configuração na janela Projetos e clique duas vezes em ``karma.conf.js`` para abrir o arquivo no editor. Observe que a amostra inclui dois arquivos de configuração do Karma.
No arquivo de configuração do Karma, você pode ver os arquivos que serão incluídos e excluídos na execução dos testes. Pode ver também os plug-ins do Karma que são exigidos para executar os testes com essa configuração.
image::images/karma-plugins.png[title="Arquivo de configuração do Karma no editor"]
-4. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e escolha Propriedades no menu pop-up.
-5. Selecione a categoria Teste JavaScript no painel Categorias da janela Propriedades do Projeto.
-6. Selecione Karma na lista drop-down Provedor de Testes. Clique em OK.
-7. Abra a janela Propriedades do Projeto novamente e selecione Karma sob a categoria Teste JavaScript no painel Categorias.
-8. Especifique o local da instalação do Karma.
+
+[start=4]
+. Na janela Projetos, clique com o botão direito do mouse no nó do projeto e escolha Propriedades no menu pop-up.
+
+[start=5]
+. Selecione a categoria Teste JavaScript no painel Categorias da janela Propriedades do Projeto.
+
+[start=6]
+. Selecione Karma na lista drop-down Provedor de Testes. Clique em OK.
+
+[start=7]
+. Abra a janela Propriedades do Projeto novamente e selecione Karma sob a categoria Teste JavaScript no painel Categorias.
+
+[start=8]
+. Especifique o local da instalação do Karma.
Se você tiver instalado o Karma no diretório de projetos, poderá clicar em Pesquisar e o IDE encontrará a instalação. Você também pode clicar em Procurar para localizar manualmente a instalação do Karma local.
-9. Especifique o local do arquivo de configuração do Karma. Clique em OK.
+
+[start=9]
+. Especifique o local do arquivo de configuração do Karma. Clique em OK.
Neste tutorial, você pode clicar em Pesquisar e o IDE encontrará o arquivo de configuração padrão do Karma. Pode também clicar em Procurar para localizar manualmente um arquivo de configuração.
@@ -182,7 +212,9 @@
Ao clicar em OK, você vê que um nó Karma aparece sob o nó do projeto na janela Projetos. Clique com o botão direito do mouse no nó Karma e inicie/interrompa o servidor Karma e defina o arquivo de configuração no menu pop-up.
-10. Na janela Projetos, clique com o botão direito do mouse no nó karma e escolha Iniciar no menu pop-up.
+
+[start=10]
+. Na janela Projetos, clique com o botão direito do mouse no nó karma e escolha Iniciar no menu pop-up.
Quando você clica em Iniciar o Karma, o servidor é iniciado e uma janela do browser é aberta exibindo o status do servidor.
@@ -194,12 +226,18 @@
*Observação.* A janela do browser deve estar aberta e o servidor Karma deve estar em execução para executar os testes de unidade.
-11. Clique com o botão direito do mouse no nó e escolha Definir Configuração > ``karma.conf.js`` para confirmar a seleção do arquivo de configuração correto. image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="Nó Configurar JS Test Driver na janela Serviços"]
-12. Desative quaisquer pontos de interrupção definidos no projeto.
+
+[start=11]
+. Clique com o botão direito do mouse no nó e escolha Definir Configuração > ``karma.conf.js`` para confirmar a seleção do arquivo de configuração correto. image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="Nó Configurar JS Test Driver na janela Serviços"]
+
+[start=12]
+. Desative quaisquer pontos de interrupção definidos no projeto.
Você pode desativar pontos de interrupção desmarcando a caixa de seleção para pontos de interrupção na janela Pontos de Interrupção.
-13. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Testes.
+
+[start=13]
+. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Testes.
Quando você escolhe Testar, o executor de teste executa os testes de unidade nos arquivos. O IDE abre a janela Resultados do Teste e exibe os resultados.
@@ -215,8 +253,12 @@
1. Faça download de link:http://code.google.com/p/js-test-driver/[+JAR do JS Test Driver+] e salve o JAR no sistema local.
2. Na janela Serviços, clique com o botão direito do mouse no nó JS Test Driver e escolha Configurar.
image::images/html5-js-testdriver-serviceswindow.png[title="Nó Configurar JS Test Driver na janela Serviços"]
-3. Na caixa de diálogo Configurar, clique em Procurar e localize o JAR do JS Test Driver que você obteve por download.
-4. Selecione Chrome com Conector NetBeans (no NetBeans IDE 7.3, selecione Chrome com Depurador JS do NetBeans) para o browser. Clique em OK.
+
+[start=3]
+. Na caixa de diálogo Configurar, clique em Procurar e localize o JAR do JS Test Driver que você obteve por download.
+
+[start=4]
+. Selecione Chrome com Conector NetBeans (no NetBeans IDE 7.3, selecione Chrome com Depurador JS do NetBeans) para o browser. Clique em OK.
image::images/html5-js-testdriver-configure.png[title="Caixa de diálogo Configurar JS Test Driver"]
*Observações.* Você só precisa especificar o local do JAR do JS Test Driver. na primeira vez que configurar o JS Test Driver.
@@ -225,14 +267,24 @@
A seleção do Chrome com NetBeans Connector permite depurar os testes executados com o JS Test Driver.
-5. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Novo > Outro.
-6. Selecione o *Arquuivo de Configuração jsTestDriver* na categoria Testes da Unidade. Clique em Próximo.
-7. Confirme se *jsTestDriver* é o Nome do Arquivo.
-8. No campo Criar Arquivo, confirme se o local dos arquivos é a pasta ``config`` do projeto ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` ).
+
+[start=5]
+. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Novo > Outro.
+
+[start=6]
+. Selecione o *Arquuivo de Configuração jsTestDriver* na categoria Testes da Unidade. Clique em Próximo.
+
+[start=7]
+. Confirme se *jsTestDriver* é o Nome do Arquivo.
+
+[start=8]
+. No campo Criar Arquivo, confirme se o local dos arquivos é a pasta ``config`` do projeto ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` ).
*Observação.* O arquivo de configuração ``jstestdriver.conf`` deve estar no ``config folder`` do projeto. Se o local do arquivo criado não for a ``pasta config`` , clique em Procurar e selecione ``AngularJSPhoneCat - Arquivos de Configuração`` na caixa de diálogo.
-9. Confirme se a caixa de seleção para fazer download das bibliotecas do Jasmine está selecionada. Clique em Finalizar.
+
+[start=9]
+. Confirme se a caixa de seleção para fazer download das bibliotecas do Jasmine está selecionada. Clique em Finalizar.
image::images/html5-js-testdriver-configfile.png[title="Assistente do Novo Arquivo de Configuração jsTestDriver"]
*Observação.*É necessário fazer download das bibliotecas do Jasmine para executar o jsTestDriver. Se você for notificado de que o IDE não pode fazer download das bibliotecas do Jasmine, verifique as configurações de proxy do IDE na janela Opções.
@@ -279,7 +331,9 @@
*
- test/unit/*.js
----
-10. Depois de atualizar o arquivo de configuração, na janela Projetos, clique com o botão direito do mouse no nó do projeto e escolha Testar.
+
+[start=10]
+. Depois de atualizar o arquivo de configuração, na janela Projetos, clique com o botão direito do mouse no nó do projeto e escolha Testar.
Quando você clica em Testar, o IDE abre automaticamente o executor JS Test no browser Chrome e duas guias na janela de Saída.
@@ -294,7 +348,9 @@
*Observação.* A janela do browser deve estar aberta e o servidor jsTestDriver deve estar em execução para executar os testes de unidade. Você pode iniciar o servidor e abrir a janela clicando com o botão direito do mouse no nó JS Test Driver na janela Serviços e escolhendo Iniciar.
image::images/html5-js-testdriver-outputwindow.png[title="Guia Executando testes de unidade JS na janela de Saída"]
-11. Escolha Janela > Saída > Resultados do Teste no menu principal para abrir a janela Resultados do Teste e ver os resultados.
+
+[start=11]
+. Escolha Janela > Saída > Resultados do Teste no menu principal para abrir a janela Resultados do Teste e ver os resultados.
image::images/html5-js-testdriver-testresultswindow.png[title="Janela Resultados do Teste"]
Você pode clicar no ícone de marcação verde na margem esquerda da janela para exibir as a lista expandida dos testes aprovados.
@@ -320,18 +376,26 @@
Quando você salva as alterações, a página no web browser é recarregada automaticamente. Você pode ver que a ordem dos telefones na lista foi alterada.
-3. Confirme se o servidor JS Test Driver está sendo executado e se a mensagem de status está visível na janela do browser Chrome.
-4. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Testes.
+
+[start=3]
+. Confirme se o servidor JS Test Driver está sendo executado e se a mensagem de status está visível na janela do browser Chrome.
+
+[start=4]
+. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Testes.
image::images/html5-js-testdriver-testresultswindow-fail.png[title="Janela Teste Reprovado nos Resultados de Teste"]
Quando você executar o teste, poderá ver que um dos testes falhou com a mensagem que o valor "nome" foi encontrado em vez de o valor esperado "idade".
-5. Abra a guia Executando testes de unidade JS na janela de Saída.
+
+[start=5]
+. Abra a guia Executando testes de unidade JS na janela de Saída.
image::images/html5-js-testdriver-outputwindow-fail.png[title="Guia Teste Reprovado na Execução dos testes de unidade JS na janela de Saída"]
Você poderá ver a mensagem de que é esperado que ``orderProp`` seja ``idade`` na linha 41.
-6. Clique no link na guia Executando testes de unidade JS para navegar até a linha em que o teste falhou. O arquivo de teste ``controllersSpec.js`` será aberto no editor na linha 41 (em *negrito*)
+
+[start=6]
+. Clique no link na guia Executando testes de unidade JS para navegar até a linha em que o teste falhou. O arquivo de teste ``controllersSpec.js`` será aberto no editor na linha 41 (em *negrito*)
[source,java]
----
@@ -343,8 +407,12 @@
Você pode ver que o teste esperava "idade" como o valor de ``scopeOrder.prop`` .
-7. Defina um ponto de interrupção na linha em que ocorreu a falha no teste (linha 41).
-8. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Testes.
+
+[start=7]
+. Defina um ponto de interrupção na linha em que ocorreu a falha no teste (linha 41).
+
+[start=8]
+. Clique com o botão direito do mouse no nó do projeto na janela Projetos e escolha Testes.
Quando você executar o teste novamente, o contador do programa atingirá o limite de ponto de interrupção. Se você passar o cursor sobre ``scopeOrder.prop`` , poderá ver na dica de ferramenta que o valor da variável é "nome" quando o ponto de interrupção for atingido.
@@ -352,7 +420,9 @@
Como alternativa, você poderá selecionar Depurar > Avaliar Expressão no menu principal para abrir a janela Avaliar Código. Se você digitar a expressão ``scopeOrder.prop`` na janela e clicar no botão Avaliar Fragmento do Código (image::images/evaluate-button.png[title="Botão Avaliar Expressão"])(Ctrl-Enter), o depurador exibirá o valor da expressão na janela Variáveis.
-9. Clique em Continuar na barra de ferramentas para finalizar a execução do teste.
+
+[start=9]
+. Clique em Continuar na barra de ferramentas para finalizar a execução do teste.
[[summary]]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ru.asciidoc
index dec8f14..f428b9a 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_ru.asciidoc
@@ -43,11 +43,7 @@
-image::images/netbeans-stamp.png[title="Содержимое на этой странице применимо к IDE NetBeans 8.0"]
-
-
-
-==== Для выполнения этого учебного курса потребуются следующие материалы.
+== Для выполнения этого учебного курса потребуются следующие материалы.
|===
|Программное обеспечение или ресурс |Требуемая версия
@@ -77,7 +73,9 @@
2. Разверните узел *Образцы* в мастере создания новых проектов и выберите категорию *HTML5*.
3. Выберите проект *Учебный курс по телефонному справочнику AngularJS*. Нажмите кнопку 'Далее'.
image::images/html5-js-newproject.png[title="Образец проекта 'Учебный курс по телефонному справочнику AngularJS' в мастере создания новых файлов"]
-4. Укажите местоположение проекта. Нажмите кнопку 'Готово'.
+
+[start=4]
+. Укажите местоположение проекта. Нажмите кнопку 'Готово'.
*Примечание.* Обратите внимание, что в качестве URL-адреса шаблона указано значение github. Для получения архива шаблона IDE требуется доступ в сеть. В случае возникновения проблем с загрузкой архива проверьте настройки прокси-сервера в окне "Параметры".
@@ -87,9 +85,13 @@
Проект также включает в себя несколько модулей тестирования JavaScript и файлов конфигурации, которые были созданы по умолчанию.
-5. Убедитесь, что в списке на панели инструментов выбран Chrome с NetBeans Connector.
+
+[start=5]
+. Убедитесь, что в списке на панели инструментов выбран Chrome с NetBeans Connector.
image::images/html5-js-selectbrowser.png[title="Браузер, выбранный в раскрывающемся списке на панели инструментов."]
-6. Нажмите кнопку 'Выполнить' на панели инструментов (F6) или щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Выполнить'.
+
+[start=6]
+. Нажмите кнопку 'Выполнить' на панели инструментов (F6) или щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Выполнить'.
Когда вы запустите проект с помощью кнопки 'Выполнить', первая страница приложения HTML5 откроется в браузере Chrome и там отобразится список мобильных телефонов. При нажатии на имя мобильного телефона на странице отображаются сведения о телефоне.
@@ -113,29 +115,41 @@
Для просмотра точек останова, заданных в проекте, выберите 'Окно' > 'Отладка' > 'Точки останова', чтобы открыть окно точек останова.
image::images/html5-js-breakpoint2.png[title="Список точек останова в окне 'Точки останова'"]
-3. Нажмите кнопку 'Выполнить' на панели инструментов, чтобы повторно запустить проект.
+
+[start=3]
+. Нажмите кнопку 'Выполнить' на панели инструментов, чтобы повторно запустить проект.
При запуске проекта отобразится та же страница, поскольку не была достигнута заданная точка останова.
-4. В браузере нажмите на одну из записей на странице, например Motorola Atrix4G.
+
+[start=4]
+. В браузере нажмите на одну из записей на странице, например Motorola Atrix4G.
Вы увидите, что страница загружена частично и данные для телефона отсутствует, поскольку данные не были переданы в JavaScript и визуализированы.
image::images/html5-js-break-details.png[title="Страница сведений приложения частично будет загружена в браузер"]
-5. В редакторе IDE вы можете видеть, что точка останова была достигнута и что счетчик программы находится в настоящее время в строке 16 файла ``controllers.js`` .
-6. Подведите курсор к переменной ``phone`` для просмотра подсказки с информацией о переменной.
+
+[start=5]
+. В редакторе IDE вы можете видеть, что точка останова была достигнута и что счетчик программы находится в настоящее время в строке 16 файла ``controllers.js`` .
+
+[start=6]
+. Подведите курсор к переменной ``phone`` для просмотра подсказки с информацией о переменной.
image::images/html5-js-variables1.png[title="Подсказка переменной в редакторе"]
В подсказке отображается следующая информация: ``phone = (Resource) Resource`` .
-7. Нажмите на подсказку, чтобы расширить ее и просмотреть список переменных и значений.
+
+[start=7]
+. Нажмите на подсказку, чтобы расширить ее и просмотреть список переменных и значений.
image::images/html5-js-variables.png[title="Расширенная подсказка переменной в редакторе"]
Например, при расширении узла ``android`` отображаются значения строк ``os`` и ``ui`` .
Также можно выбрать 'Окно' > 'Отладка' > 'Переменные' для просмотра списка в окне 'Переменные'.
-8. Используйте кнопки на панели инструментов для перехода между функциями JavaScript в библиотеке ``angular.js`` или щелкните 'Продолжить' (F5), чтобы возобновить работу приложения.
+
+[start=8]
+. Используйте кнопки на панели инструментов для перехода между функциями JavaScript в библиотеке ``angular.js`` или щелкните 'Продолжить' (F5), чтобы возобновить работу приложения.
== Выполнение тестов JS Unit
@@ -153,7 +167,9 @@
Вы можете выбрать способ и папку назначения для установки Karma. Папку установки можно указать позже при настройке проекта для работы с Karma. Сведения о вариантах установки Karma можно найти на link:http://karma-runner.github.io[+веб-сайте Karma+].
-2. Создайте файл конфигурации Karma.
+
+[start=2]
+. Создайте файл конфигурации Karma.
В рамках данного учебного курса этот этап можно пропустить, так как файл конфигурации Karma уже включен в состав образца приложения. Чтобы создать структуру файла конфигурации Karma, выберите "Файл конфигурации Karma" в категории "Модульные тесты" мастера создания файлов.
@@ -161,20 +177,34 @@
Также можно выполнить команду Karma ``init`` в командной строке. Дополнительные сведения об использовании команды Karma ``init`` см. в документации Karma.
-3. Разверните узел "Файлы конфигурации" в окне "Проекты" и дважды щелкните файл ``karma.conf.js`` , чтобы открыть его в редакторе. Обратите внимание, что образец проекта включает в себя два файла конфигурации Karma.
+
+[start=3]
+. Разверните узел "Файлы конфигурации" в окне "Проекты" и дважды щелкните файл ``karma.conf.js`` , чтобы открыть его в редакторе. Обратите внимание, что образец проекта включает в себя два файла конфигурации Karma.
В файле конфигурации Karma перечислены файлы, которые необходимо обрабатывать или исключать при выполнении тестов. Также здесь перечислены подключаемые модули Karma, которые требуются для выполнения тестов в данной конфигурации.
image::images/karma-plugins.png[title="Файл конфигурации Karma в редакторе"]
-4. Правой кнопкой мыши щелкните узел проекта в окне "Проекты" и выберите "Свойства" во всплывающем меню.
-5. Выберите категорию "Тестирование JavaScript" в разделе "Категории" окна "Свойства проекта".
-6. В списке "Тестовый провайдер" выберите Karma. Нажмите OK.
-7. Снова откройте окно "Свойства проекта" и выберите Karma в категории "Тестирование JavaScript" в разделе "Категории".
-8. Укажите путь к папке установки Karma.
+
+[start=4]
+. Правой кнопкой мыши щелкните узел проекта в окне "Проекты" и выберите "Свойства" во всплывающем меню.
+
+[start=5]
+. Выберите категорию "Тестирование JavaScript" в разделе "Категории" окна "Свойства проекта".
+
+[start=6]
+. В списке "Тестовый провайдер" выберите Karma. Нажмите OK.
+
+[start=7]
+. Снова откройте окно "Свойства проекта" и выберите Karma в категории "Тестирование JavaScript" в разделе "Категории".
+
+[start=8]
+. Укажите путь к папке установки Karma.
Если установка Karma была выполнена в каталог проекта, можно нажать "Поиск", и IDE обнаружит папку установки автоматически. Также можно нажать кнопку "Обзор" и выбрать папку установки Karma вручную.
-9. Укажите путь к файлу конфигурации Karma. Нажмите OK.
+
+[start=9]
+. Укажите путь к файлу конфигурации Karma. Нажмите OK.
В рамках данного учебного курса вы можете нажать кнопку "Поиск", и IDE обнаружит файл конфигурации Karma, используемый по умолчанию. Также можно нажать кнопку "Обзор" и выбрать файл конфигурации вручную.
@@ -182,7 +212,9 @@
При нажатии на кнопку ОК под узлом проекта в окне "Проекты" появится узел Karma. Щелкните узел Karma правой кнопкой мыши, чтобы запустить/остановить сервер Karma или выбрать файл конфигурации.
-10. Щелкните правой кнопкой мыши узел "Karma" в окне "Проекты" и выберите пункт меню "Запуск".
+
+[start=10]
+. Щелкните правой кнопкой мыши узел "Karma" в окне "Проекты" и выберите пункт меню "Запуск".
В результате будет запущен сервер Karma и откроется окно браузера с сообщением о статусе сервера.
@@ -194,12 +226,18 @@
*Примечание.* Для выполнения тестов должно быть открыто окно браузера и запущен сервер Karma.
-11. Щелкните правой кнопкой мыши узел Karma и выберите "Выбрать конфигурацию > ``karma.conf.js`` ", чтобы программа использовала верный файл конфигурации. image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="Настройка узла 'jsTest Driver' в окне 'Службы'"]
-12. Отключите все точки останова, заданные в проекте.
+
+[start=11]
+. Щелкните правой кнопкой мыши узел Karma и выберите "Выбрать конфигурацию > ``karma.conf.js`` ", чтобы программа использовала верный файл конфигурации. image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title="Настройка узла 'jsTest Driver' в окне 'Службы'"]
+
+[start=12]
+. Отключите все точки останова, заданные в проекте.
Точки останова можно отключить, сняв флажки для точек останова в окне 'Точки останова'.
-13. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Тестирование'.
+
+[start=13]
+. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Тестирование'.
Если выбрать пункт меню "Тестирование" исполнитель тестов запускает модульные тесты для файлов. В IDE открывается окно "Результаты тестов", в котором отображаются результаты тестирования.
@@ -215,8 +253,12 @@
1. Загрузите link:http://code.google.com/p/js-test-driver/[+JAR JS Test Driver+] и сохраните файл JAR в локальной системе.
2. В окне 'Службы' щелкните правой кнопкой мыши узел JS Test Driver и выберите 'Настройка'.
image::images/html5-js-testdriver-serviceswindow.png[title="Настройка узла 'jsTest Driver' в окне 'Службы'"]
-3. В диалоговом окне 'Настроить' щелкните 'Обзор' и найдите загруженный файл JAR JS Test Driver.
-4. Выберите Chrome с NetBeans Connector (в NetBeans IDE 7.3 - Chrome с NetBeans JS Debugger) в качестве браузера. Нажмите кнопку ОК.
+
+[start=3]
+. В диалоговом окне 'Настроить' щелкните 'Обзор' и найдите загруженный файл JAR JS Test Driver.
+
+[start=4]
+. Выберите Chrome с NetBeans Connector (в NetBeans IDE 7.3 - Chrome с NetBeans JS Debugger) в качестве браузера. Нажмите кнопку ОК.
image::images/html5-js-testdriver-configure.png[title="Диалоговое окно 'Настройка узла 'jsTest Driver'"]
*Примечания.* Местоположение файла JAR для JS Test Driver нужно указывать только при первой настройке JS Test Driver.
@@ -225,14 +267,24 @@
Если выбран вариант "Chrome с подключаемым модулем NetBeans", появляется возможность отладки тестов, выполняемых с помощью JS Test Driver.
-5. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите "New > Other"(Создать > Другое).
-6. Выберите *Файл конфигурации jsTestDriver* в категории 'Тестирование модулей'. Нажмите кнопку 'Далее'.
-7. Убедитесь, что *jsTestDriver* задан как 'Имя файла'.
-8. В поле 'Созданный файл' убедитесь, что файл находится в папке ``config`` проекта ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` ).
+
+[start=5]
+. Щелкните правой кнопкой мыши узел проекта в окне "Проекты" и выберите "New > Other"(Создать > Другое).
+
+[start=6]
+. Выберите *Файл конфигурации jsTestDriver* в категории 'Тестирование модулей'. Нажмите кнопку 'Далее'.
+
+[start=7]
+. Убедитесь, что *jsTestDriver* задан как 'Имя файла'.
+
+[start=8]
+. В поле 'Созданный файл' убедитесь, что файл находится в папке ``config`` проекта ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` ).
*Примечание.* Файлом конфигурации ``jsTestDriver.conf`` должна быть папка ``config`` проекта. Если местоположением созданного файла не явлется папка ``config`` , нажмите 'Обзор' и выберите папку ``AngularJSPhoneCat - Файлы конфигурации`` в диалоговом окне.
-9. Убедитесь, что установлен флажок для загрузки библиотек Jasmine. Нажмите кнопку 'Готово'.
+
+[start=9]
+. Убедитесь, что установлен флажок для загрузки библиотек Jasmine. Нажмите кнопку 'Готово'.
image::images/html5-js-testdriver-configfile.png[title="Мастер создания новых файлов конфигурации jsTestDriver"]
*Примечание.*Для запуска jsTestDriver необходимо загрузить библиотеки Jasmine. Если вы получаете уведомление о том, что IDE не удается загрузить библиотеки Jasmine, проверьте настройки прокси IDE в окне 'Параметры'.
@@ -279,7 +331,9 @@
*
- test/unit/*.js
----
-10. После обновления файла конфигурации можно щелкнуть правой кнопкой мыши узел проекта в окне "Проекты" и выбрать "Тестирование".
+
+[start=10]
+. После обновления файла конфигурации можно щелкнуть правой кнопкой мыши узел проекта в окне "Проекты" и выбрать "Тестирование".
После щелчка 'Тестировать IDE' автоматически открывается средство запуска JS Test в браузере Chrome и две вкладки в окне 'Выходные данные'.
@@ -294,7 +348,9 @@
*Примечание.* Для выполнения тестов модулей окно браузера должно быть открыто и сервер jsTestDriver должен быть запущен. Можно запустить сервер и открыть окно, щелкнув правой кнопкой мыши узел JS Test Driver в окне 'Службы' и выбрав 'Пуск'.
image::images/html5-js-testdriver-outputwindow.png[title="Выполнение тестов JS Unit в окне 'Выходные данные'"]
-11. Выберите "Окно > Результаты > Результаты тестов" в главном меню, чтобы открыть окно "Результаты тестов" и просмотреть итоги выполнения.
+
+[start=11]
+. Выберите "Окно > Результаты > Результаты тестов" в главном меню, чтобы открыть окно "Результаты тестов" и просмотреть итоги выполнения.
image::images/html5-js-testdriver-testresultswindow.png[title="Окно 'Результаты теста'"]
Можно нажать зеленый флажок в левом границе окна, чтобы просмотреть расширенный список успешно пройденных тестов.
@@ -320,18 +376,26 @@
При сохранении изменений страница автоматически перезагружается в браузере. Отображается изменение порядка телефонов в списке.
-3. Убедитесь, что сервер JS Test Driver запущен и что сообщение состояния отображается в окне браузера Chrome.
-4. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите команду 'Тестирование'.
+
+[start=3]
+. Убедитесь, что сервер JS Test Driver запущен и что сообщение состояния отображается в окне браузера Chrome.
+
+[start=4]
+. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите команду 'Тестирование'.
image::images/html5-js-testdriver-testresultswindow-fail.png[title="Тест с ошибкой в окне 'Результаты теста'"]
При запуске теста можно увидеть, что в одном из тестов произошла ошибка с сообщением, что значение "name" было обнаружено вместо ожидаемого значения "age".
-5. Откройте вкладку 'Выполнение тестов JS unit' в окне 'Выходные данные'.
+
+[start=5]
+. Откройте вкладку 'Выполнение тестов JS unit' в окне 'Выходные данные'.
image::images/html5-js-testdriver-outputwindow-fail.png[title="Тест с ошибкой на вкладке 'Выполнениетестов JS Unit' в окне 'Выходные данные'"]
Отображается сообщение о том, что ``orderProp`` должно быть ``age`` в строке 41.
-6. Щелкните ссылку на вкладке 'Выполнение тестов модулей JS' для перехода к строке, в которой в тесте произошла ошибка. Файл теста ``controllersSpec.js`` открывается в редакторе в строке 41 (выделена *полужирным* шрифтом)
+
+[start=6]
+. Щелкните ссылку на вкладке 'Выполнение тестов модулей JS' для перехода к строке, в которой в тесте произошла ошибка. Файл теста ``controllersSpec.js`` открывается в редакторе в строке 41 (выделена *полужирным* шрифтом)
[source,java]
----
@@ -343,8 +407,12 @@
Видно, что в тесте ожидалось "age" как значение ``scopeOrder.prop`` .
-7. Установите точку останова в строке, где в тесте произошла ошибка (строка 41).
-8. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Тестирование'.
+
+[start=7]
+. Установите точку останова в строке, где в тесте произошла ошибка (строка 41).
+
+[start=8]
+. Щелкните правой кнопкой мыши узел проекта в окне 'Проекты' и выберите 'Тестирование'.
При повторном запуске теста счетчик программы достигнет точки останова. При наведении курсора на ``scopeOrder.prop`` в подсказке видно, что переменная имеет значение "name" при достижении точки останова.
@@ -352,7 +420,9 @@
В качестве альтернативы можно выбрать 'Отладка' > 'Оценка выражений' в главном меню, чтобы открыть окно 'Оценка кода'. При вводе выражения ``scopeOrder.prop`` в окне и нажатии кнопки 'Оценить фрагмент кода' (image::images/evaluate-button.png[title="Кнопка 'Оценить выражение'"]) (Ctrl-Enter) в отладчике отображается значение выражения в окне 'Переменные'.
-9. Нажмите кнопку 'Продолжить' на панели инструментов, чтобы завершить выполнение теста.
+
+[start=9]
+. Нажмите кнопку 'Продолжить' на панели инструментов, чтобы завершить выполнение теста.
[[summary]]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_zh_CN.asciidoc
index ec5f980..49f6de3 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/html5-js-support_zh_CN.asciidoc
@@ -43,11 +43,7 @@
-image::images/netbeans-stamp.png[title="此页上的内容适用于 NetBeans IDE 8.0"]
-
-
-
-==== 要完成本教程,需要使用以下资源。
+== 要完成本教程,需要使用以下资源。
|===
|软件或资源 |要求的版本
@@ -77,7 +73,9 @@
2. 在新建项目向导中展开 *Samples*(示例)节点,然后选择 *HTML5* 类别。
3. 选择 *AngularJS Phone Catalog Tutorial*(AngularJS 电话目录教程)项目。单击 "Next"(下一步)。
image::images/html5-js-newproject.png[title="新建文件向导中 "AngularJS Phone Catalog Tutorial"(AngularJS 电话目录教程)示例项目"]
-4. 指定项目的位置。单击 "Finish"(完成)。
+
+[start=4]
+. 指定项目的位置。单击 "Finish"(完成)。
*注:*请注意,模板的 URL 为 github。IDE 需要能够访问该网络来检索模板档案。如果您在下载档案时遇到问题,请在 "Options"(选项)窗口中检查代理设置。
@@ -87,9 +85,13 @@
该项目还包含多个默认生成的 JavaScript 单元测试和配置文件。
-5. 确认在工具栏的下拉列表中选择了 "Chrome with NetBeans Connector"(包含 NetBeans Connector 的 Chrome)。
+
+[start=5]
+. 确认在工具栏的下拉列表中选择了 "Chrome with NetBeans Connector"(包含 NetBeans Connector 的 Chrome)。
image::images/html5-js-selectbrowser.png[title="在工具栏下拉列表中选择的浏览器"]
-6. 在工具栏中单击 "Run"(运行)按钮 (F6) 或者在 "Projects"(项目)窗口中右键单击项目节点并选择 "Run"(运行)。
+
+[start=6]
+. 在工具栏中单击 "Run"(运行)按钮 (F6) 或者在 "Projects"(项目)窗口中右键单击项目节点并选择 "Run"(运行)。
运行项目时,HTML5 应用程序的首页在 Chrome 浏览器中打开,您可以查看手机列表。单击某个手机的名称时,页中将显示该手机的详细信息。
@@ -113,29 +115,41 @@
可以通过选择 "Window"(窗口)> "Debugging"(调试)> "Breakpoints"(断点)来打开 "Breakpoints"(断点)窗口,在其中查看断点。
image::images/html5-js-breakpoint2.png[title=""Breakpoints"(断点)窗口中的断点列表"]
-3. 在工具栏中单击“运行”按钮可以再次运行项目。
+
+[start=3]
+. 在工具栏中单击“运行”按钮可以再次运行项目。
运行项目时,您可以看到相同的页,因为没有命中您设置的断点。
-4. 在浏览器中,单击页面中的一个条目,例如 Motorola Atrix4G。
+
+[start=4]
+. 在浏览器中,单击页面中的一个条目,例如 Motorola Atrix4G。
您可以看到,该页部分加载,但缺少电话的数据,因为数据未传递到 JavaScript 并呈现。
image::images/html5-js-break-details.png[title="浏览器中部分加载了应用程序的 "Details"(详细信息)页"]
-5. 在 IDE 的编辑器中,您可以看到命中了断点,并且程序计数器当前位于 ``controllers.js`` 的第 16 行。
-6. 将光标悬停在 ``phone`` 变量上可查看有关变量信息的工具提示。
+
+[start=5]
+. 在 IDE 的编辑器中,您可以看到命中了断点,并且程序计数器当前位于 ``controllers.js`` 的第 16 行。
+
+[start=6]
+. 将光标悬停在 ``phone`` 变量上可查看有关变量信息的工具提示。
image::images/html5-js-variables1.png[title="编辑器中的变量工具提示"]
在工具提示中,可以看到以下信息: ``phone = (Resource) Resource`` 。
-7. 单击工具提示可展开工具提示并查看变量和值的列表。
+
+[start=7]
+. 单击工具提示可展开工具提示并查看变量和值的列表。
image::images/html5-js-variables.png[title="编辑器中展开的变量工具提示"]
例如,展开 ``android`` 节点时,您可以看到字符串 ``os`` 和 ``ui`` 的值。
还可以选择 "Window"(窗口)> "Debugging"(调试)> "Variables"(变量),在 "Variables"(变量)窗口中查看列表。
-8. 使用工具栏中的步进按钮,可以逐步完成 ``angular.js`` 库中的 JavaScript 函数,或者单击 "Continue"(继续)按钮 (F5) 以继续应用程序。
+
+[start=8]
+. 使用工具栏中的步进按钮,可以逐步完成 ``angular.js`` 库中的 JavaScript 函数,或者单击 "Continue"(继续)按钮 (F5) 以继续应用程序。
== 运行 JS 单元测试
@@ -153,7 +167,9 @@
可以选择 Karma 的安装方式和位置。稍后在配置项目以使用 Karma 时,将指定安装。可以在 link:http://karma-runner.github.io[+Karma Web 站点+]上查找有关用于安装 Karma 的选项的信息。
-2. 创建 Karma 配置文件。
+
+[start=2]
+. 创建 Karma 配置文件。
在本教程中,此步骤是可选的,因为样例应用程序已含 Karma 配置文件。可以通过在新建文件向导的 "Unit Tests"(单元测试)类别中选择 "Karma Configuration File"(Karma 配置文件)来创建框架 Karma 配置文件。
@@ -161,20 +177,34 @@
或者,也可以在命令行上运行 Karma ``init`` 命令。有关使用 Karma ``init`` 命令的详细信息,请参见 Karma 文档。
-3. 在 "Projects"(项目)窗口中展开 "Configuration Files"(配置文件)节点,然后双击 ``karma.conf.js`` 在编辑器中打开该文件。请注意,样例包括两个 Karma 配置文件。
+
+[start=3]
+. 在 "Projects"(项目)窗口中展开 "Configuration Files"(配置文件)节点,然后双击 ``karma.conf.js`` 在编辑器中打开该文件。请注意,样例包括两个 Karma 配置文件。
在 Karma 配置文件中,可以查看在运行测试时将包含和排除的文件。还可以查看使用此配置运行测试时所需的 Karma 插件。
image::images/karma-plugins.png[title="编辑器中的 Karma 配置文件"]
-4. 在 "Projects"(项目)窗口中右键单击项目节点,然后在弹出式菜单中选择 "Properties"(属性)。
-5. 在 "Project Properties"(项目属性)窗口的 "Categories"(类别)窗格中选择 "JavaScript Testing"(JavaScript 测试)类别。
-6. 在 "Testing Provider"(测试提供器)下拉列表中选择 "Karma"。单击 "OK"(确定)。
-7. 再次打开 "Project Properties"(项目属性)窗口,然后在 "Categories"(类别)窗格中的 "JavaScript Testing"(JavaScript 测试)类别下选择 "Karma"。
-8. 指定 Karma 的安装位置。
+
+[start=4]
+. 在 "Projects"(项目)窗口中右键单击项目节点,然后在弹出式菜单中选择 "Properties"(属性)。
+
+[start=5]
+. 在 "Project Properties"(项目属性)窗口的 "Categories"(类别)窗格中选择 "JavaScript Testing"(JavaScript 测试)类别。
+
+[start=6]
+. 在 "Testing Provider"(测试提供器)下拉列表中选择 "Karma"。单击 "OK"(确定)。
+
+[start=7]
+. 再次打开 "Project Properties"(项目属性)窗口,然后在 "Categories"(类别)窗格中的 "JavaScript Testing"(JavaScript 测试)类别下选择 "Karma"。
+
+[start=8]
+. 指定 Karma 的安装位置。
如果您已在项目目录中安装 Karma,则可以单击 "Search"(搜索),IDE 将查找该安装。您还可以单击 "Browse"(浏览)以手动查找本地 Karma 安装。
-9. 指定 Karma 配置文件的位置。单击 "OK"(确定)。
+
+[start=9]
+. 指定 Karma 配置文件的位置。单击 "OK"(确定)。
在本教程中,您可以单击 "Search"(搜索),IDE 将查找默认 Karma 配置文件。您还可以单击 "Browse"(浏览)以手动查找配置文件。
@@ -182,7 +212,9 @@
单击 "OK"(确定)时,您可以看到 "Karma" 节点显示在 "Projects"(项目)窗口中的项目节点下方。右键单击 "Karma" 节点,启动和停止 Karma 服务器,并在弹出式菜单中设置配置文件。
-10. 在 "Projects"(项目)窗口中右键单击 "Karma" 节点,然后在弹出式菜单中选择 "Start"(启动)。
+
+[start=10]
+. 在 "Projects"(项目)窗口中右键单击 "Karma" 节点,然后在弹出式菜单中选择 "Start"(启动)。
单击 "Start"(启动)时,Karma 服务器将启动,并且浏览器窗口将打开以显示服务器状态。
@@ -194,12 +226,18 @@
*注:*要运行单元测试,必须打开浏览器窗口并且 Karma 服务器必须正在运行。
-11. 右键单击 "Karma" 节点并选择 "Set Configuration"(设置配置)> ``karma.conf.js`` 以确认选择了正确的配置文件。image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title=""Services"(服务)窗口中的 "Configure jsTest Driver"(配置 jsTest 驱动程序)节点"]
-12. 禁用在项目中设置的任意断点。
+
+[start=11]
+. 右键单击 "Karma" 节点并选择 "Set Configuration"(设置配置)> ``karma.conf.js`` 以确认选择了正确的配置文件。image::../../../images_www/articles/80/webclient/html5-js/karma-node.png[title=""Services"(服务)窗口中的 "Configure jsTest Driver"(配置 jsTest 驱动程序)节点"]
+
+[start=12]
+. 禁用在项目中设置的任意断点。
您可以在 "Breakpoints"(断点)窗口中取消选中断点的复选框以禁用断点。
-13. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Test"(测试)。
+
+[start=13]
+. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Test"(测试)。
选择 "Test"(测试)时,测试运行器将对文件运行单元测试。IDE 将打开 "Test Results"(测试结果)窗口并显示测试的结果。
@@ -215,8 +253,12 @@
1. 下载 link:http://code.google.com/p/js-test-driver/[+JS 测试驱动程序 JAR+] 并将 JAR 保存到本地系统。
2. 在 "Services"(服务)窗口中,右键单击 "JS Test Driver"(JS 测试驱动程序)节点并选择 "Configure"(配置)。
image::images/html5-js-testdriver-serviceswindow.png[title=""Services"(服务)窗口中的 "Configure jsTest Driver"(配置 jsTest 驱动程序)节点"]
-3. 在 "Configure"(配置)对话框中,单击 "Browse"(浏览)并找到所下载的 JS 测试驱动程序 JAR。
-4. 为浏览器选择 "Chrome with NetBeans Connector"(包含 NetBeans Connector 的 Chrome)(在 NetBeans IDE 7.3 中,选择 "Chrome with NetBeans JS Debugger"(包含 NetBeans JS 调试器的 Chrome))。单击 "OK"(确定)。
+
+[start=3]
+. 在 "Configure"(配置)对话框中,单击 "Browse"(浏览)并找到所下载的 JS 测试驱动程序 JAR。
+
+[start=4]
+. 为浏览器选择 "Chrome with NetBeans Connector"(包含 NetBeans Connector 的 Chrome)(在 NetBeans IDE 7.3 中,选择 "Chrome with NetBeans JS Debugger"(包含 NetBeans JS 调试器的 Chrome))。单击 "OK"(确定)。
image::images/html5-js-testdriver-configure.png[title=""Configure jsTest Driver"(配置 jsTest 驱动程序)对话框"]
*注:*只需要在首次配置 JS 测试驱动程序时指定 JS 测试驱动程序 JAR 的位置。
@@ -225,14 +267,24 @@
选择 "Chrome with NetBeans Connector"(包含 NetBeans Connector 的 Chrome)时,可以调试使用 JS 测试驱动程序运行的测试。
-5. 在项目窗口中,右键单击项目节点,然后选择 "New"(新建)> "Other"(其他)。
-6. 在 "Unit Tests"(单元测试)类别中,选择 *jsTestDriver Configuration File*(jsTestDriver 配置文件)。单击 "Next"(下一步)。
-7. 确认文件名为 *jsTestDriver*。
-8. 在 "Created File"(创建的文件)字段中,确认文件的位置是项目的 ``config`` 文件夹 ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` )。
+
+[start=5]
+. 在项目窗口中,右键单击项目节点,然后选择 "New"(新建)> "Other"(其他)。
+
+[start=6]
+. 在 "Unit Tests"(单元测试)类别中,选择 *jsTestDriver Configuration File*(jsTestDriver 配置文件)。单击 "Next"(下一步)。
+
+[start=7]
+. 确认文件名为 *jsTestDriver*。
+
+[start=8]
+. 在 "Created File"(创建的文件)字段中,确认文件的位置是项目的 ``config`` 文件夹 ( ``AngularJSPhoneCat/config/jsTestDriver.conf`` )。
*注:* ``jsTestDriver.conf`` 配置文件必须位于项目的 ``config`` 文件夹中。如果所创建文件的位置不在 ``config`` 文件夹中,请单击 "Browse"(浏览)并在对话框中选择 ``AngularJSPhoneCat - Configuration Files(AngularJSPhoneCat - 配置文件)`` 文件夹。
-9. 确认已经选中了下载 Jasmine 库的复选框。单击 "Finish"(完成)。
+
+[start=9]
+. 确认已经选中了下载 Jasmine 库的复选框。单击 "Finish"(完成)。
image::images/html5-js-testdriver-configfile.png[title="“新建 jsTestDriver 配置文件”向导"]
*注:*需要下载 Jasmine 库以运行 jsTestDriver。如果系统通知您 IDE 无法下载 Jasmine 库,请在 "Options"(选项)窗口中检查 IDE 的代理设置。
@@ -279,7 +331,9 @@
*
- test/unit/*.js
----
-10. 更新配置文件之后,可以在 "Projects"(项目)窗口中右键单击项目节点并选择 "Test"(测试)。
+
+[start=10]
+. 更新配置文件之后,可以在 "Projects"(项目)窗口中右键单击项目节点并选择 "Test"(测试)。
单击 "Test"(测试)时,IDE 自动在 Chrome 浏览器中打开 JS 测试运行器,并在 "Output"(输出)窗口中打开两个标签。
@@ -294,7 +348,9 @@
*注:*要运行单元测试,必须打开浏览器窗口并且 jsTestDriver 服务器必须正在运行。在 "Services"(服务)窗口中右键单击 "JS Test Driver"(JS 测试驱动器)节点,然后选择 "Start"(启动)可启动服务器并打开窗口。
image::images/html5-js-testdriver-outputwindow.png[title=""Output"(输出)窗口中 "Running JS unit tests"(运行的 JS 单元测试)标签"]
-11. 在主菜单中选择 "Window"(窗口)> "Output"(输出)> "Test Results"(测试结果)以打开 "Test Results"(测试结果)窗口,并查看测试的结果。
+
+[start=11]
+. 在主菜单中选择 "Window"(窗口)> "Output"(输出)> "Test Results"(测试结果)以打开 "Test Results"(测试结果)窗口,并查看测试的结果。
image::images/html5-js-testdriver-testresultswindow.png[title=""Test Results"(测试结果)窗口"]
可以在窗口的左边缘中单击绿色选中图标以查看已通过测试的展开列表。
@@ -320,18 +376,26 @@
保存更改时,浏览器中将自动重新加载页面。可以看到,列表中电话的顺序发生了更改。
-3. 确认 JS 测试驱动程序服务器正在运行,并且在 Chrome 浏览器窗口中可以看到状态消息。
-4. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Test"(测试)。
+
+[start=3]
+. 确认 JS 测试驱动程序服务器正在运行,并且在 Chrome 浏览器窗口中可以看到状态消息。
+
+[start=4]
+. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Test"(测试)。
image::images/html5-js-testdriver-testresultswindow-fail.png[title=""Test Results"(测试结果)窗口中的失败测试"]
运行测试时,您可以看到有一个测试失败,消息显示出现值 "name" 而非所需的值 "age"。
-5. 在 "Output"(输出)窗口中打开 "Running JS unit tests"(运行的 JS 单元测试)标签。
+
+[start=5]
+. 在 "Output"(输出)窗口中打开 "Running JS unit tests"(运行的 JS 单元测试)标签。
image::images/html5-js-testdriver-outputwindow-fail.png[title=""Output"(输出)窗口 "Running JS unit tests"(运行的 JS 单元测试)标签中失败的测试"]
在消息中,您可以看到第 41 行的 ``orderProp`` 应为 ``age`` 。
-6. 单击 "Running JS unit tests"(运行的 JS 单元测试)标签可导航到失败测试中的行。测试文件 ``controllersSpec.js`` 在编辑器中打开,位于第 41 行(*粗体*)
+
+[start=6]
+. 单击 "Running JS unit tests"(运行的 JS 单元测试)标签可导航到失败测试中的行。测试文件 ``controllersSpec.js`` 在编辑器中打开,位于第 41 行(*粗体*)
[source,java]
----
@@ -343,8 +407,12 @@
可以看到,测试需要 "age" 作为 ``scopeOrder.prop`` 的值。
-7. 在测试失败的行设置断点 (第 41 行)。
-8. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Test"(测试)。
+
+[start=7]
+. 在测试失败的行设置断点 (第 41 行)。
+
+[start=8]
+. 在 "Projects"(项目)窗口中右键单击项目节点,然后选择 "Test"(测试)。
再次运行测试时,程序计数器命中了断点。如果将光标悬停在 ``scopeOrder.prop`` 上,则可以看到,命中断点时,工具提示中变量的值为 "name"。
@@ -352,7 +420,9 @@
此外,您还可以在主菜单中选择 "Debug"(调试)> "Evaluate Expression"(计算表达式的值)以打开 "Evaluate Code"(计算代码的值)窗口。如果在窗口中键入表达式 ``scopeOrder.prop`` 并单击 "Evaluate Code Fragment"(计算代码片段的值)按钮 (image::images/evaluate-button.png[title=""Evaluate Expression"(计算表达式的值)按钮"]) (Ctrl-Enter),则调试器在 "Variables"(变量)窗口中显示表达式的值。
-9. 在工具栏中单击 "Continue"(继续)以完成运行测试。
+
+[start=9]
+. 在工具栏中单击 "Continue"(继续)以完成运行测试。
[[summary]]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cca.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cca.asciidoc
index db707a1..015cf95 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cca.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cca.asciidoc
@@ -38,7 +38,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -53,7 +55,9 @@
image::images/cca-1.png[]
-2. In ``customer.html`` , paste the below:
+
+[start=2]
+. In ``customer.html`` , paste the below:
[source,xml]
@@ -63,7 +67,9 @@
<i data-bind="text: $props.city"></i>
<hr>
----
-3.
+
+[start=3]
+.
In ``customer.json`` , paste the below:
@@ -83,7 +89,9 @@
}
}
----
-4.
+
+[start=4]
+.
In ``loader.js`` , paste the below:
@@ -125,7 +133,9 @@
Read more about Knockout for-each loops here: link:http://knockoutjs.com/documentation/foreach-binding.html[+http://knockoutjs.com/documentation/foreach-binding.html+].
-2. In the previous step, there's an assumption that an array named ``customers`` exists. Add it to the JavaScript file in the Oracle JET module:
+
+[start=2]
+. In the previous step, there's an assumption that an array named ``customers`` exists. Add it to the JavaScript file in the Oracle JET module:
[source,java]
@@ -137,7 +147,9 @@
{name: 'Val Kilmer', city: 'Seattle'}
];
----
-3.
+
+[start=3]
+.
In the ``define`` block, load the following, at the end of the list of references:
@@ -146,7 +158,9 @@
'ojs/ojcomposite', 'jet-composites/customer/loader'
----
-4.
+
+[start=4]
+.
Look in the browser and you should see the following:
image::images/cca-2.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-chatbot.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-chatbot.asciidoc
index 8850fa8..40e267e 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-chatbot.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-chatbot.asciidoc
@@ -38,7 +38,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -53,7 +55,9 @@
image::images/ccm029.png[]
-2. Follow the instructions from the Configuration section of:
+
+[start=2]
+. Follow the instructions from the Configuration section of:
* ``http://<bot server>:3000/samples/chat`` if you’re using a Docker Image before 0.6 *OR*
* ``http://<botserver>:8888/source/apps/chat/overview`` if you’re using a Docker image from 0.6
@@ -65,9 +69,13 @@
image::images/t060001.png[]
-2. In ``js/viewModels/Dashboard.js`` , add a reference to ``jet-composites/bot-client/loader`` and ``ojs/ojcomposite`` in the ``define`` block, to load the ``bot-client`` component.
-3. In ``js/views/Dashboard.html`` , set the following properties, below ``var self = this,`` :
+[start=2]
+. In ``js/viewModels/Dashboard.js`` , add a reference to ``jet-composites/bot-client/loader`` and ``ojs/ojcomposite`` in the ``define`` block, to load the ``bot-client`` component.
+
+
+[start=3]
+. In ``js/views/Dashboard.html`` , set the following properties, below ``var self = this,`` :
[source,java]
@@ -80,7 +88,9 @@
Can't get yours to work? Try ``71DB044C-0624-4533-9C98-B8E76BAF919D`` as the channel ID.
-4. In ``js/views/Dashboard.html`` , define the view as follows:
+
+[start=4]
+. In ``js/views/Dashboard.html`` , define the view as follows:
[source,xml]
@@ -92,7 +102,9 @@
user-id="[[userId]]">
</bot-client>
----
-5.
+
+[start=5]
+.
Run the application and interact with the ChatBot.
image::images/t060004.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cookbook.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cookbook.asciidoc
index 9984519..9be3adf 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cookbook.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-cookbook.asciidoc
@@ -40,8 +40,12 @@
image::images/cookbook-1.png[]
-2. Browse through the Oracle JET components listed in the Oracle JET Cookbook and get an idea of what's available.
-3.
+
+[start=2]
+. Browse through the Oracle JET components listed in the Oracle JET Cookbook and get an idea of what's available.
+
+[start=3]
+.
For example, let's take a look at the link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=barChart&demo=default[+Bar Chart+] component.
image::images/cookbook-2.png[]
@@ -59,21 +63,29 @@
image::images/cookbook-8.png[]
-2. To achieve this, go to the HTML tab and use the mouse to select the div with id set to "myToolbar", as shown below:
+
+[start=2]
+. To achieve this, go to the HTML tab and use the mouse to select the div with id set to "myToolbar", as shown below:
image::images/cookbook-4.png[]
Press the Delete key or right-click and delete the selected content.
-3. Click Apply, top right above the code:
+
+[start=3]
+. Click Apply, top right above the code:
image::images/cookbook-7.png[]
-4. The browser refreshes and the toolbar is no longer there:
+
+[start=4]
+. The browser refreshes and the toolbar is no longer there:
image::images/cookbook-9.png[]
-5. Now you have a subset of the recipe customized for your needs, as described in the next section. Play with various other recipes in the Oracle JET Cookbook by tweaking them and seeing the result.
+
+[start=5]
+. Now you have a subset of the recipe customized for your needs, as described in the next section. Play with various other recipes in the Oracle JET Cookbook by tweaking them and seeing the result.
Simply refresh the browser to return the recipe to its default state.
@@ -84,7 +96,9 @@
1. Once you're happy with the code in the recipe, copy the content of the HTML tab from the Oracle JET Cookbook recipe into your application, within the ``dashboard.html`` file.
-2. In NetBeans IDE, notice that there is component-specific code-completion, and documentation. Press Ctrl-Space within ``ojChart`` to see it:
+
+[start=2]
+. In NetBeans IDE, notice that there is component-specific code-completion, and documentation. Press Ctrl-Space within ``ojChart`` to see it:
image::images/cookbook-5.png[]
@@ -94,7 +108,9 @@
Notice that the properties shown in the code completion are context-sensitive to the currently used Oracle JET component. For example, instead of ``ojChart`` above, use a different component and then press Ctrl-Space over the properties and you will see that only properties that are applicable to the currently used Oracle JET component are shown.
-3. In the browser's Inspect tool, notice the error messages, because the ``dashboard.js`` file does not yet reference the chart that you are using in your ``dashboard.html`` file:
+
+[start=3]
+. In the browser's Inspect tool, notice the error messages, because the ``dashboard.js`` file does not yet reference the chart that you are using in your ``dashboard.html`` file:
[source,java]
@@ -117,7 +133,9 @@
After adding the above, you'll still see error messages in the browser, since the properties referenced in ``dashboard.html`` have not yet been defined in ``dashboard.js`` . That is the focus of the next step, below.
-4. In ``dashboard.js`` , below ``var self = this;`` , copy the body of the code in the JS tab in the Oracle JET Cookbook.
+
+[start=4]
+. In ``dashboard.js`` , below ``var self = this;`` , copy the body of the code in the JS tab in the Oracle JET Cookbook.
[source,java]
@@ -149,7 +167,9 @@
Be careful not to copy everything in the JS tab in the Oracle JET Cookbook, because the JS tab has code in a ``require`` block, while your ``dashboard.js`` contains a ``define`` block. Only copy the properties. Then take a careful look at whether all the properties are actually needed, i.e., whether they are referenced in the ``dashboard.html`` file. For example, now that you have no toolbar anymore, you can remove the properties above that relate to the toggle buttons, i.e., ``self.stackOptions`` and ``self.orientationOptions`` .
-5. Run the application and you should see the following in the browser:
+
+[start=5]
+. Run the application and you should see the following in the browser:
image::images/cookbook-3.png[]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-crud.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-crud.asciidoc
index 49c70a9..7a8dae0 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-crud.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-crud.asciidoc
@@ -38,7 +38,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -92,7 +94,9 @@
Simply copy the ``dashboard.js`` file and name it ``home.js`` . Similarly, copy the ``dashboard.html`` file and name it ``home.html`` . In the files, replace all references to ``Dashboard`` with ``Home`` . You should now have ``src/js/viewModels/home.js`` and ``src/js/views/home.html`` .
-2. Open the two files that have been created. The JavaScript file is a ``define`` block, using Require.js syntax, as shown below (with most of the comments removed here):
+
+[start=2]
+. Open the two files that have been created. The JavaScript file is a ``define`` block, using Require.js syntax, as shown below (with most of the comments removed here):
[source,java]
@@ -136,7 +140,9 @@
</div>
----
-3.
+
+[start=3]
+.
Check that your application structure in the ``src`` folder is now as follows, that is, make sure that your new Home module is named correctly and is found in the default location, as shown below:
image::images/navdrawer_4.png[]
@@ -166,7 +172,9 @@
Learn link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=router&demo=simple[+about the Oracle JET Router here+].
-2. Integrate the Oracle JET module into the application's navigation component by tweaking the Navigation setup in the ``src/js/appController.js`` file, as shown below in bold:
+
+[start=2]
+. Integrate the Oracle JET module into the application's navigation component by tweaking the Navigation setup in the ``src/js/appController.js`` file, as shown below in bold:
[source,java]
----
@@ -188,11 +196,15 @@
Learn link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=navigationbar&demo=navbar[+about the ojNavigationList component here+].
-3. You can now run the application and you should see the "Home" item in the navigation bar, which should route the application to the ``home`` module:
+
+[start=3]
+. You can now run the application and you should see the "Home" item in the navigation bar, which should route the application to the ``home`` module:
image::images/navdrawer_5.png[]
-4. Add more modules and integrate them into the application. Remove modules, by removing their references above and then deleting the related files from the application structure.
+
+[start=4]
+. Add more modules and integrate them into the application. Remove modules, by removing their references above and then deleting the related files from the application structure.
Congratulations! You have now learned how to create and load modules into your Oracle JET applications.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-databinding.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-databinding.asciidoc
index ef73f1e..45e7dd9 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-databinding.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-databinding.asciidoc
@@ -40,7 +40,9 @@
image::images/cookbook-3.png[]
-2. Also add a link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=select&demo=single[+Select+] component to your application, in the same Oracle JET module where the Bar Chart is found:
+
+[start=2]
+. Also add a link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=select&demo=single[+Select+] component to your application, in the same Oracle JET module where the Bar Chart is found:
* Read the link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=select&demo=single[+Select+] component recipe in the Oracle JET Cookbook and copy the recipe into your application, then take the steps below to tweak the code.
@@ -81,7 +83,9 @@
'ojs/ojselectcombobox'
----
-3.
+
+[start=3]
+.
In the browser, check that the application looks something like the below, that is, you should see a Bar Chart component and a Select component:
image::images/databinding-001.png[]
@@ -95,11 +99,17 @@
1. Notice in your HTML file that the Bar Chart component has its ``type`` property hardcoded to ``'bar'`` .
-2. Notice in your HTML file that the Select component has its ``value`` property set to the two-way binding array ``val`` , defined in your JavaScript file.
-3. Change the value of the Bar Chart component's ``type`` property to ``val()[0]`` . That means that when the ``val`` array changes, the first value defines the type of the Bar Chart, which will immediately update itself to the new value.
+[start=2]
+. Notice in your HTML file that the Select component has its ``value`` property set to the two-way binding array ``val`` , defined in your JavaScript file.
-4. In the browser, switch to a different chart type in the Select component and notice that the Bart Chart component automatically updates itself:
+
+[start=3]
+. Change the value of the Bar Chart component's ``type`` property to ``val()[0]`` . That means that when the ``val`` array changes, the first value defines the type of the Bar Chart, which will immediately update itself to the new value.
+
+
+[start=4]
+. In the browser, switch to a different chart type in the Select component and notice that the Bart Chart component automatically updates itself:
image::images/databinding-002.png[]
@@ -128,9 +138,13 @@
1. From the link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=statusMeterGauge&demo=statusMeterGaugeCircular[+Circular Status Meter Gauge recipe+], copy a gauge into your Oracle JET application.
-2. From the link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=textInput&demo=text[+Input Text recipe+], copy an input text into your Oracle JET application.
-3. Connect the two components together so that the current value of the gauge is shown in the input field and so that the gauge reflects the current value in the input field. Experiment with the link:http://knockoutjs.com/documentation/textinput-binding.html[+ ``textInput`` binding+], as follows:
+[start=2]
+. From the link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=textInput&demo=text[+Input Text recipe+], copy an input text into your Oracle JET application.
+
+
+[start=3]
+. Connect the two components together so that the current value of the gauge is shown in the input field and so that the gauge reflects the current value in the input field. Experiment with the link:http://knockoutjs.com/documentation/textinput-binding.html[+ ``textInput`` binding+], as follows:
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-flex.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-flex.asciidoc
index d2aaacc..3ce41bd 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-flex.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-flex.asciidoc
@@ -52,7 +52,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -70,7 +72,9 @@
<div class="oj-flex-item">
</div>
----
-2.
+
+[start=2]
+.
Right now, what we've got is one "div", which has been set as an "oj-flex-item". It has nothing in it and you can't tell that it's there when you look in the page, which will just be blank, aside from the "h1" content. A good tip when doing layouting with Flex Layout, i.e., at least during development, is to add an "oj-panel":
@@ -87,7 +91,9 @@
Therefore, the "oj-panel" is very useful when laying out items, to see where the containers and items are fitting within the page, regardless of whether you ultimately want to use "oj-panel" in the actual release of your product. It enables you to see what the padding is, while you can also use different colors in the background by using different alternate panels, via "oj-panel-alt".
-3. If that is our first row, let's put that in there:
+
+[start=3]
+. If that is our first row, let's put that in there:
[source,html]
@@ -102,7 +108,9 @@
image::images/flex-002.png[]
-4. Then copy that and put in a few of them, as follows:
+
+[start=4]
+. Then copy that and put in a few of them, as follows:
[source,html]
@@ -121,7 +129,9 @@
image::images/flex-003.png[]
-5. As you can see, the items are stacking up, they're looking OK, though they definitely don't have the padding around them that we would like, according to the link:http://www.oracle.com/webfolder/ux/middleware/alta/index.html[+Oracle Alta UI+]. Let's add a margin to each item, as follows:
+
+[start=5]
+. As you can see, the items are stacking up, they're looking OK, though they definitely don't have the padding around them that we would like, according to the link:http://www.oracle.com/webfolder/ux/middleware/alta/index.html[+Oracle Alta UI+]. Let's add a margin to each item, as follows:
[source,html]
@@ -144,7 +154,9 @@
That's the default that "oj-margin" gives us, from the Oracle Alta UI spec. Rather than overriding it, if needed, the better approach is to create your own CSS margin class, since the various Oracle JET components also make use of "oj-margin" and hence if you change "oj-margin" itself, you may end up with unintended side effects.
-6. Where we are now is that we have three "oj-flex-items", which are all contained by the "oj-flex" container in "index.html". Now, let's say that in the second row, i.e., the second "oj-flex-item", we want to put three or four other items:
+
+[start=6]
+. Where we are now is that we have three "oj-flex-items", which are all contained by the "oj-flex" container in "index.html". Now, let's say that in the second row, i.e., the second "oj-flex-item", we want to put three or four other items:
image::images/flex-005.png[]
@@ -175,7 +187,9 @@
third row
</div>
----
-7.
+
+[start=7]
+.
However, probably you don't need that whole border along the outside of the second level items. And maybe you want them to be side-by-side, instead. Right now, we have an "oj-flex-item", which contains other instances of "oj-flex-item". Since they're all "items", they're still children of the "container" item in the "index.html" page. Really, what you would like is for the second level items to be items for the "div" element that contains them. Therefore, let's add in an "oj-flex", which will turn that "div" element into a container:
@@ -202,9 +216,13 @@
image::images/flex-006.png[]
-8. Once you set a "div" as being a container, you enable it to control its own content. By default, containers flow in a row, as you can see above. The link:http://www.oracle.com/webfolder/technetwork/jet/uiComponents-flex-direction.html[+"flex-direction" property+] is, by default, set to "row". You can set that to "column", instead, as will be shown later, as well as "reverse row" and "reverse column". The reverse classes probably might mess things up for RTL languages, which Oracle JET automatically incorporates. You can also mess with the order, overriding the DOM order, which might cause conflicts with accessibility requirements and RTL language support, though. Be aware that this flexibility exists, if needed, as well as the problems that might occur.
-9. If you remove "oj-panel" and "oj-margin" from that "div" element, you will have a layout like this:
+[start=8]
+. Once you set a "div" as being a container, you enable it to control its own content. By default, containers flow in a row, as you can see above. The link:http://www.oracle.com/webfolder/technetwork/jet/uiComponents-flex-direction.html[+"flex-direction" property+] is, by default, set to "row". You can set that to "column", instead, as will be shown later, as well as "reverse row" and "reverse column". The reverse classes probably might mess things up for RTL languages, which Oracle JET automatically incorporates. You can also mess with the order, overriding the DOM order, which might cause conflicts with accessibility requirements and RTL language support, though. Be aware that this flexibility exists, if needed, as well as the problems that might occur.
+
+
+[start=9]
+. If you remove "oj-panel" and "oj-margin" from that "div" element, you will have a layout like this:
image::images/flex-007.png[]
@@ -253,7 +271,9 @@
There are now 4 columns in the middle and 2 across the bottom. As you resize this, the rows are maintained, becoming smaller and smaller as you make the browser smaller.
-10. However, let's say that we want the items in the second row to stack as we move smaller, i.e., as we get to a phone-size resolution. Since items inherit from their container, we'll use the "flex-direction" property, mentioned earlier, to switch from the default "row" direction to "column", when the resolution is "small", i.e., on mobile devices. Take note of the addition below, in bold:
+
+[start=10]
+. However, let's say that we want the items in the second row to stack as we move smaller, i.e., as we get to a phone-size resolution. Since items inherit from their container, we'll use the "flex-direction" property, mentioned earlier, to switch from the default "row" direction to "column", when the resolution is "small", i.e., on mobile devices. Take note of the addition below, in bold:
[source,html]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-gettingstarted.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-gettingstarted.asciidoc
index 972a6db..443e7f1 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-gettingstarted.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-gettingstarted.asciidoc
@@ -31,21 +31,7 @@
This document provides a step-by-step set of instructions guiding you through the process of getting started with the link:http://oraclejet.org[+Oracle JavaScript Extension Toolkit (JET)+]. JET empowers developers by providing a modular toolkit based on modern JavaScript, CSS3, and HTML5 design and development principles.
-
-=== Contents
-
-image::images/netbeans-stamp.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-* <<settingUp,Setting Up>>
-* <<downloading,Setting Up the Oracle JET QuickStart Basic Template>>
-* <<creatingAFirstModule,Creating a Custom JET Module>>
-* <<usingJETComponents,Using JET Components>>
-* <<creating,Creating Additional JET Modules>>
-* <<using1,Using the JET Cookbook>>
-* <<settingUpIntermodular,Setting Up Intermodular Communication>>
-
-
-==== To complete this tutorial, you will need the following resources.
+== To complete this tutorial, you will need the following resources.
|===
|Software or Resource |Version Required
@@ -78,7 +64,9 @@
Click Next.
-2. Type the name of the application, such as *CustomerVisualizer*, and select a location to store it, as shown below.
+
+[start=2]
+. Type the name of the application, such as *CustomerVisualizer*, and select a location to store it, as shown below.
image::images/newhtml5project-8.png[]
@@ -86,7 +74,9 @@
Click *Finish* to complete the wizard.
-3. When you click Finish, the IDE creates the project, which might take a moment, since several JavaScript libraries are included in the ZIP file. When the unzip process is complete, the IDE displays a node for the project in the Projects window.
+
+[start=3]
+. When you click Finish, the IDE creates the project, which might take a moment, since several JavaScript libraries are included in the ZIP file. When the unzip process is complete, the IDE displays a node for the project in the Projects window.
You now have a new HTML5/JavaScript project created from the Oracle JET QuickStart Basic template.
@@ -94,7 +84,9 @@
Spend some time exploring the project structure of the application. For example, look in *js/libs* and you will see the JavaScript libraries that constitute Oracle JET, while *js/viemodels* contains the JavaScript files, with their matching views in *js/views*.
-4. Right-click the project and choose Run. The browser opens and displays the template, as shown below.
+
+[start=4]
+. Right-click the project and choose Run. The browser opens and displays the template, as shown below.
image::images/newhtml5project-9.png[]
@@ -124,7 +116,9 @@
image::images/viewmodels-4.png[]
-2. Open the two files that have been created. The JavaScript file is a *define* block, using Require.js syntax, as shown below:
+
+[start=2]
+. Open the two files that have been created. The JavaScript file is a *define* block, using Require.js syntax, as shown below:
[source,javascript]
@@ -154,7 +148,9 @@
<h1>home</h1>
----
-3. Load the JET module into the application by tweaking the Router setup and Navigation setup in the *src/js/appController.js* file, as shown below in bold:
+
+[start=3]
+. Load the JET module into the application by tweaking the Router setup and Navigation setup in the *src/js/appController.js* file, as shown below in bold:
[source,java]
----
@@ -193,7 +189,6 @@
Congratulations! Your application is configured correctly and you have created and loaded your first custom module.
-[[template]]
== Using JET Components
In this section, you learn about a variety of different ways of creating JET components.
@@ -228,7 +223,9 @@
4.
In the lower part of the page, copy the content of the HTML Editor into your application, within the *home.html* file.
-5. Notice that there is component-specific code-completion, and documentation, press Ctrl-Space within *ojChart* to see it:
+
+[start=5]
+. Notice that there is component-specific code-completion, and documentation, press Ctrl-Space within *ojChart* to see it:
image::images/cookbook-1.png[]
@@ -238,11 +235,15 @@
*Note:* Notice that the properties shown in the code completion are context-sensitive to the currently used Oracle JET component. For example, instead of *ojChart* above, use a different component and then press Ctrl-Space over the properties and you will see that only properties that are applicable to the currently used Oracle JET component are shown.
-6. In the Output window (Ctrl-4), notice the error messages, because the *home.js* JavaScript file does not yet define the variables you have referenced in your HTML file, as shown below:
+
+[start=6]
+. In the Output window (Ctrl-4), notice the error messages, because the *home.js* JavaScript file does not yet define the variables you have referenced in your HTML file, as shown below:
image::images/cookbook-2.png[]
-7. In *home.js*, below *var self = this;*, copy the body of the code in the JS Editor section, near the end of the Bar Chart page.
+
+[start=7]
+. In *home.js*, below *var self = this;*, copy the body of the code in the JS Editor section, near the end of the Bar Chart page.
[source,java]
@@ -274,7 +275,9 @@
*Note:* Be careful not to copy everything in the JS Editor, because the JS Editor has code in a *require* block, while your *home.js* contains a *define* block.
-8. To enable the JET Chart component to be loaded into the application, include the *ojs/ojchart* reference in your *define* block, in your *home.js* file, as shown below:
+
+[start=8]
+. To enable the JET Chart component to be loaded into the application, include the *ojs/ojchart* reference in your *define* block, in your *home.js* file, as shown below:
[source,javascript]
@@ -283,7 +286,9 @@
define(['ojs/ojcore', 'knockout', *'ojs/ojchart',*
], function (oj, ko) {
----
-9.
+
+[start=9]
+.
Open the application in a browser and you should see the following:
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-intermodular.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-intermodular.asciidoc
index 6cd23b2..2bd7c84 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-intermodular.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-intermodular.asciidoc
@@ -38,7 +38,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -51,7 +53,9 @@
1. Knockout.js has the concept of a "binding context", which are global objects that can be referenced throughout your application. Spend some time learning about link:http://knockoutjs.com/documentation/binding-context.html[+the binding context here+].
-2. In any of your Oracle JET module's views, i.e., any of the HTML files that define the view of the Oracle JET modules, add the following:
+
+[start=2]
+. In any of your Oracle JET module's views, i.e., any of the HTML files that define the view of the Oracle JET modules, add the following:
[source,html]
@@ -62,9 +66,13 @@
Take note of the ``$root`` binding context in the above.
-3. In the browser, notice there is already content in the input field. Make a change in the input field and notice that something in the menubar changes!
-4. Open the ``appController.js`` file in the ``src/js`` file. In that file, notice the following property has been defined:
+[start=3]
+. In the browser, notice there is already content in the input field. Make a change in the input field and notice that something in the menubar changes!
+
+
+[start=4]
+. Open the ``appController.js`` file in the ``src/js`` file. In that file, notice the following property has been defined:
[source,java]
@@ -72,7 +80,9 @@
self.userLogin = ko.observable("john.hancock@oracle.com");
----
-5.
+
+[start=5]
+.
Create a new global variable, as follows:
@@ -109,7 +119,9 @@
image::images/ojtrain.png[]
-6. Create your own global variable and refer to it in your Oracle JET application.
+
+[start=6]
+. Create your own global variable and refer to it in your Oracle JET application.
The ``src/js/appController.js`` file is the central location in an Oracle JET application where global variables are defined and from which they can be accessed throughout the application.
@@ -130,7 +142,9 @@
If you're wondering where the element ID ``globalBody`` comes from, take a look in your ``index.html`` file.
-2. Now, instead of needing to refer to the ``$root`` binding context, you have a normal Knockout.js observable property that you can reference instead:
+
+[start=2]
+. Now, instead of needing to refer to the ``$root`` binding context, you have a normal Knockout.js observable property that you can reference instead:
[source,html]
@@ -138,7 +152,9 @@
<p>Name: <span data-bind="text: *userLogin*"></span></p>
----
-3.
+
+[start=3]
+.
Similarly, you can now get hold of the router and use it as follows:
@@ -165,7 +181,9 @@
"knockout-postbox": "0.6.0"
----
-2. In your ``scripts/grunt/config/oraclejet-build.js`` file, include ``knockout-postbox`` in the ``ojet build`` process:
+
+[start=2]
+. In your ``scripts/grunt/config/oraclejet-build.js`` file, include ``knockout-postbox`` in the ``ojet build`` process:
[source,java]
----
@@ -180,10 +198,14 @@
]
},
----
-3.
+
+[start=3]
+.
When you run ``ojet-build`` , you should see ``knockout-postbox`` in ``web/js/libs`` .
-4. Include the library in ``main.js`` , in the ``requirejs.config section`` :
+
+[start=4]
+. Include the library in ``main.js`` , in the ``requirejs.config section`` :
[source,java]
@@ -191,10 +213,14 @@
'knockout-postbox': 'libs/knockout-postbox/knockout-postbox'
----
-5.
+
+[start=5]
+.
In the JavaScript files of the Oracle JET modules where you want to use it, include ``'knockout-postbox'`` in the ``define`` block. Or maybe consider whether it should be loaded in the ``require`` block in the ``main.js`` file.
-6. Now you can use ``knockout-postbox`` , as described on its home page: link:https://github.com/rniemeyer/knockout-postbox[+https://github.com/rniemeyer/knockout-postbox+]. For example:
+
+[start=6]
+. Now you can use ``knockout-postbox`` , as described on its home page: link:https://github.com/rniemeyer/knockout-postbox[+https://github.com/rniemeyer/knockout-postbox+]. For example:
* *Publish.* In one of your Oracle JET modules, publish like this, in the ``handleDetached`` lifecycle method:
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-porting.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-porting.asciidoc
index df7e0b1..67ca001 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-porting.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-porting.asciidoc
@@ -31,21 +31,7 @@
This document provides a step-by-step set of instructions guiding you through the process of getting started with the link:http://oraclejet.org[+Oracle JavaScript Extension Toolkit (JET)+]. JET empowers developers by providing a modular toolkit based on modern JavaScript, CSS3, and HTML5 design and development principles.
-
-=== Contents
-
-image::images/netbeans-stamp.png[title="Content on this page applies to the NetBeans IDE 7.4 and 8.0"]
-
-* <<settingUp,Setting Up>>
-* <<downloading,Setting Up the Oracle JET QuickStart Basic Template>>
-* <<creatingAFirstModule,Creating a Custom JET Module>>
-* <<usingJETComponents,Using JET Components>>
-* <<creating,Creating Additional JET Modules>>
-* <<using1,Using the JET Cookbook>>
-* <<settingUpIntermodular,Setting Up Intermodular Communication>>
-
-
-==== To complete this tutorial, you will need the following resources.
+== To complete this tutorial, you will need the following resources.
|===
|Software or Resource |Version Required
@@ -78,7 +64,9 @@
Click Next.
-2. Type the name of the application, such as *CustomerVisualizer*, and select a location to store it, as shown below.
+
+[start=2]
+. Type the name of the application, such as *CustomerVisualizer*, and select a location to store it, as shown below.
image::images/newhtml5project-8.png[]
@@ -86,7 +74,9 @@
Click *Finish* to complete the wizard.
-3. When you click Finish, the IDE creates the project, which might take a moment, since several JavaScript libraries are included in the ZIP file. When the unzip process is complete, the IDE displays a node for the project in the Projects window.
+
+[start=3]
+. When you click Finish, the IDE creates the project, which might take a moment, since several JavaScript libraries are included in the ZIP file. When the unzip process is complete, the IDE displays a node for the project in the Projects window.
You now have a new HTML5/JavaScript project created from the Oracle JET QuickStart Basic template.
@@ -94,7 +84,9 @@
Spend some time exploring the project structure of the application. For example, look in *js/libs* and you will see the JavaScript libraries that constitute Oracle JET, while *js/viemodels* contains the JavaScript files, with their matching views in *js/views*.
-4. Right-click the project and choose Run. The browser opens and displays the template, as shown below.
+
+[start=4]
+. Right-click the project and choose Run. The browser opens and displays the template, as shown below.
image::images/newhtml5project-9.png[]
@@ -124,7 +116,9 @@
image::images/viewmodels-4.png[]
-2. Open the two files that have been created. The JavaScript file is a *define* block, using Require.js syntax, as shown below:
+
+[start=2]
+. Open the two files that have been created. The JavaScript file is a *define* block, using Require.js syntax, as shown below:
[source,javascript]
@@ -154,7 +148,9 @@
<h1>home</h1>
----
-3. Load the JET module into the application by tweaking the Router setup and Navigation setup in the *src/js/appController.js* file, as shown below in bold:
+
+[start=3]
+. Load the JET module into the application by tweaking the Router setup and Navigation setup in the *src/js/appController.js* file, as shown below in bold:
[source,java]
----
@@ -193,7 +189,6 @@
Congratulations! Your application is configured correctly and you have created and loaded your first custom module.
-[[template]]
== Using JET Components
In this section, you learn about a variety of different ways of creating JET components.
@@ -228,7 +223,9 @@
4.
In the lower part of the page, copy the content of the HTML Editor into your application, within the *home.html* file.
-5. Notice that there is component-specific code-completion, and documentation, press Ctrl-Space within *ojChart* to see it:
+
+[start=5]
+. Notice that there is component-specific code-completion, and documentation, press Ctrl-Space within *ojChart* to see it:
image::images/cookbook-1.png[]
@@ -238,11 +235,15 @@
*Note:* Notice that the properties shown in the code completion are context-sensitive to the currently used Oracle JET component. For example, instead of *ojChart* above, use a different component and then press Ctrl-Space over the properties and you will see that only properties that are applicable to the currently used Oracle JET component are shown.
-6. In the Output window (Ctrl-4), notice the error messages, because the *home.js* JavaScript file does not yet define the variables you have referenced in your HTML file, as shown below:
+
+[start=6]
+. In the Output window (Ctrl-4), notice the error messages, because the *home.js* JavaScript file does not yet define the variables you have referenced in your HTML file, as shown below:
image::images/cookbook-2.png[]
-7. In *home.js*, below *var self = this;*, copy the body of the code in the JS Editor section, near the end of the Bar Chart page.
+
+[start=7]
+. In *home.js*, below *var self = this;*, copy the body of the code in the JS Editor section, near the end of the Bar Chart page.
[source,java]
@@ -274,7 +275,9 @@
*Note:* Be careful not to copy everything in the JS Editor, because the JS Editor has code in a *require* block, while your *home.js* contains a *define* block.
-8. To enable the JET Chart component to be loaded into the application, include the *ojs/ojchart* reference in your *define* block, in your *home.js* file, as shown below:
+
+[start=8]
+. To enable the JET Chart component to be loaded into the application, include the *ojs/ojchart* reference in your *define* block, in your *home.js* file, as shown below:
[source,javascript]
@@ -283,7 +286,9 @@
define(['ojs/ojcore', 'knockout', *'ojs/ojchart',*
], function (oj, ko) {
----
-9.
+
+[start=9]
+.
Open the application in a browser and you should see the following:
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-rest.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-rest.asciidoc
index 1a810f6..b74934f 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-rest.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-rest.asciidoc
@@ -38,7 +38,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -75,9 +77,13 @@
Read about link:http://docs.oracle.com/middleware/jet230/jet/reference-jet/oj.ArrayTableDataSource.html[+ArrayTableDataSource+] here.
-2. In the ``define`` block, add a reference to ``ojs/ojtable`` .
-3. In the matching HTML file, add the following:
+[start=2]
+. In the ``define`` block, add a reference to ``ojs/ojtable`` .
+
+
+[start=3]
+. In the matching HTML file, add the following:
[source,xml]
@@ -106,7 +112,9 @@
1. The JET Common Model's oj.Model and oj.Collection allow applications to perform CRUD operations (create, read, update, delete) via REST services. Before going further, read about link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=crud&demo=table[+the Oracle JET Common Model here+]. Also read link:http://www.kennethlange.com/posts/oracle_jet.html[+Create a Web App with Oracle JET+].
-2. In the ``js`` folder, that is, in the folder where ``main.js`` is found, create a file named ``MovieFactory.js`` and add the following to it:
+
+[start=2]
+. In the ``js`` folder, that is, in the folder where ``main.js`` is found, create a file named ``MovieFactory.js`` and add the following to it:
[source,javascript]
@@ -138,7 +146,9 @@
To understand the idea behind the code above, think of it is an implementation of link:https://www.martinfowler.com/eaaCatalog/activeRecord.html[+Martin Fowler's "Active Record" pattern+], while its syntax is that of link:http://backbonejs.org/#Model[+Backbone.Model+] and link:http://backbonejs.org/#Collection[+Backbone.Collection+] in link:http://backbonejs.org/[+Backbone.js+]. For background reading on the Oracle JET Common Model, see the link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=home&demo=rootFramework_childCommonModel[+Oracle JET Cookbook section on Common Model+] and the link:https://docs.oracle.com/middleware/jet112/jet/developer/GUID-808434E0-CA80-405C-9450-59E0BF525700.htm#JETDG334[+Using the Oracle JET Common Model and Collection Framework section in the Oracle JET Developer Guide+]. Best of all, take a look at the JsDoc for link:http://docs.oracle.com/middleware/jet112/jet/reference-jet/oj.Model.html[+oj.Model+] and oj.Collection.
-3. Replace the complete content of the JavaScript file in your Oracle JET module with the following:
+
+[start=3]
+. Replace the complete content of the JavaScript file in your Oracle JET module with the following:
[source,javascript]
@@ -159,7 +169,9 @@
return viewModel;
});
----
-4.
+
+[start=4]
+.
The HTML side of your Oracle JET module does not need to change. It is exactly the same as in the previous section.
You should now see a table with data in your application.
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-settingup.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-settingup.asciidoc
index 2ea2d25..4d792dc 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-settingup.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-settingup.asciidoc
@@ -32,7 +32,6 @@
This document provides a step-by-step set of instructions guiding you through the process of setting up an application based on link:http://oraclejet.org[+Oracle JavaScript Extension Toolkit (JET)+]. JET empowers web and mobile developers by providing a modular toolkit based on modern JavaScript, CSS3, and HTML5 design and development principles.
-[[seealso]]
== Setting Up
In this exercise you learn how to set up an Oracle JET application via the ``ojet-cli`` tool.
@@ -52,7 +51,9 @@
*Note:* Do not use the Latest release of Node, i.e., v8.x. The Node Package Manager (NPM) version 5 that comes with Node v8.x has bugs that cause nested dev-dependencies to not be installed properly. This is listed in our link:http://www.oracle.com/webfolder/technetwork/jet/globalSupport-releaseNotes.html[+Release Notes for JET 3.2.0+] and we are watching the npm bugs to see when they are going to fix them.
-2. After completing the above step, install the Oracle JET Command Line ( ``link:https://github.com/oracle/ojet-cli[+ojet-cli+]`` ) tool as follows:
+
+[start=2]
+. After completing the above step, install the Oracle JET Command Line ( ``link:https://github.com/oracle/ojet-cli[+ojet-cli+]`` ) tool as follows:
[source,java]
@@ -65,7 +66,9 @@
Under the covers, the ``ojet-cli`` tool installs and uses popular JavaScript tools, such as Yeoman and Grunt, as can link:https://github.com/oracle/ojet-cli/blob/master/package.json[+be seen here+]. Where previously, you'd have to use commands such as ``yo`` and ``grunt`` , these are now hidden within the ``ojet-cli`` tool and do not need to be installed separately anymore.
-3. The ``-g`` argument in the previous step should have installed the ``ojet`` command globally, so that you should be able to run ``ojet`` anywhere, i.e., not in any specific folder or location since the ``ojet`` command should now be globally available. To try it out, run the following:
+
+[start=3]
+. The ``-g`` argument in the previous step should have installed the ``ojet`` command globally, so that you should be able to run ``ojet`` anywhere, i.e., not in any specific folder or location since the ``ojet`` command should now be globally available. To try it out, run the following:
[source,java]
----
@@ -75,7 +78,9 @@
The terminal window should now show all the commands available to be used with ``ojet`` . If not, you can manually configure the PATH of your system to include ``ojet-cli`` .
-4. Once you have successfully run ``ojet help`` , use ``ojet`` to create a new Oracle JET application, as follows:
+
+[start=4]
+. Once you have successfully run ``ojet help`` , use ``ojet`` to create a new Oracle JET application, as follows:
[source,java]
@@ -96,7 +101,9 @@
Open the application into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as shown in the screenshot above.
-5. Once the application is created, use the terminal window to navigate into the root folder, i.e., the top folder, which is named ``MyApp`` , and build and serve the application, as follows:
+
+[start=5]
+. Once the application is created, use the terminal window to navigate into the root folder, i.e., the top folder, which is named ``MyApp`` , and build and serve the application, as follows:
[source,java]
diff --git a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-working.asciidoc b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-working.asciidoc
index 01c32ab..2f09f16 100644
--- a/netbeans.apache.org/src/content/kb/docs/webclient/ojet-working.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/webclient/ojet-working.asciidoc
@@ -38,7 +38,9 @@
1. Follow the steps described in link:ojet-settingup.html[+Setting Up an Oracle JET Application+].
-2. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
+
+[start=2]
+. Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
image::images/navdrawer.png[]
@@ -92,7 +94,9 @@
Simply copy the ``dashboard.js`` file and name it ``home.js`` . Similarly, copy the ``dashboard.html`` file and name it ``home.html`` . In the files, replace all references to ``Dashboard`` with ``Home`` . You should now have ``src/js/viewModels/home.js`` and ``src/js/views/home.html`` .
-2. Open the two files that have been created. The JavaScript file is a ``define`` block, using Require.js syntax, as shown below (with most of the comments removed here):
+
+[start=2]
+. Open the two files that have been created. The JavaScript file is a ``define`` block, using Require.js syntax, as shown below (with most of the comments removed here):
[source,java]
@@ -136,7 +140,9 @@
</div>
----
-3.
+
+[start=3]
+.
Check that your application structure in the ``src`` folder is now as follows, that is, make sure that your new Home module is named correctly and is found in the default location, as shown below:
image::images/navdrawer_4.png[]
@@ -166,7 +172,9 @@
Learn link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=router&demo=simple[+about the Oracle JET Router here+].
-2. Integrate the Oracle JET module into the application's navigation component by tweaking the Navigation setup in the ``src/js/appController.js`` file, as shown below in bold:
+
+[start=2]
+. Integrate the Oracle JET module into the application's navigation component by tweaking the Navigation setup in the ``src/js/appController.js`` file, as shown below in bold:
[source,java]
----
@@ -188,11 +196,15 @@
Learn link:http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=navigationbar&demo=navbar[+about the ojNavigationList component here+].
-3. You can now run the application and you should see the "Home" item in the navigation bar, which should route the application to the ``home`` module:
+
+[start=3]
+. You can now run the application and you should see the "Home" item in the navigation bar, which should route the application to the ``home`` module:
image::images/navdrawer_5.png[]
-4. Add more modules and integrate them into the application. Remove modules, by removing their references above and then deleting the related files from the application structure.
+
+[start=4]
+. Add more modules and integrate them into the application. Remove modules, by removing their references above and then deleting the related files from the application structure.
Congratulations! You have now learned how to create and load modules into your Oracle JET applications.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/client.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/client.asciidoc
index 6859843..1a626de 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/client.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/client.asciidoc
@@ -79,8 +79,12 @@
If you are behind a firewall, you might need to specify a proxy server—otherwise the WSDL file cannot be downloaded. To specify the proxy server, click Set Proxy in the wizard. The IDE's Options window opens, where you can set the proxy universally for the IDE.
-4. Leave the package name blank. By default the client class package name is taken from the WSDL. In this case is ``com.cdyne.ws`` . Click Finish.
-5. In the Projects window, within the Web Service References node, you see the following:
+
+[start=4]
+. Leave the package name blank. By default the client class package name is taken from the WSDL. In this case is ``com.cdyne.ws`` . Click Finish.
+
+[start=5]
+. In the Projects window, within the Web Service References node, you see the following:
image::images/ws-refs.png[title="Projects window showing web service references"]
The Projects window shows that a web service called 'check' has made a number of 'CheckTextBody' and 'CheckTextBodyV2' operations available to your application. These operations check a string for spelling errors and returns data to be processed by the client. The V2 version of the service does not require authentication. You will use the ``checkSoap.CheckTextBodyV2`` operation throughout this tutorial.
@@ -134,10 +138,16 @@
1. Right-click the ``SpellCheckService`` project node in the Projects window, choose New > Other and then choose Web > Servlet. Click Next to open the New Servlet wizard.
2. Name the servlet ``SpellCheckServlet`` and type ``clientservlet`` in the Package drop-down. Click Next.
image::images/name-servlet.png[]
-3. In the Configure Servlet Deployment panel, note that the URL mapping for this servlet is ``/SpellCheckServlet`` . Accept the defaults and click Finish. The servlet opens in the Source Editor.
+
+[start=3]
+. In the Configure Servlet Deployment panel, note that the URL mapping for this servlet is ``/SpellCheckServlet`` . Accept the defaults and click Finish. The servlet opens in the Source Editor.
image::images/jaxwsc-servlet.png[]
-4. Put your cursor inside the Source Editor, inside the ``processRequest`` method body of ``SpellCheckServlet.java`` , and add some new lines right at the top of the method.
-5. Right-click in the space that you created in the previous step, and choose Insert Code > Call Web Service Operation. Click the ``checkSoap.CheckTextBodyV2`` operation in the "Select Operation to Invoke" dialog box,as shown below:
+
+[start=4]
+. Put your cursor inside the Source Editor, inside the ``processRequest`` method body of ``SpellCheckServlet.java`` , and add some new lines right at the top of the method.
+
+[start=5]
+. Right-click in the space that you created in the previous step, and choose Insert Code > Call Web Service Operation. Click the ``checkSoap.CheckTextBodyV2`` operation in the "Select Operation to Invoke" dialog box,as shown below:
image::images/insert-ws-ops.png[title="Projects window showing web service references"]
Click OK.
@@ -163,7 +173,9 @@
*@WebServiceRef(wsdlLocation = "http://wsf.cdyne.com/SpellChecker/check.asmx?WSDL")
private Check service;*
----
-6. Replace the ``try`` block of the ``processRequest()`` method with the code that follows. The in-line comments throughout the code below explain the purpose of each line.
+
+[start=6]
+. Replace the ``try`` block of the ``processRequest()`` method with the code that follows. The in-line comments throughout the code below explain the purpose of each line.
[source,html]
----
@@ -233,7 +245,9 @@
}
----
-7. You see a number of error bars and warning icons, indicating classes that are not found. To fix imports after pasting the code, either press Ctrl-Shift-I (⌘-Shift-I on Mac), or right-click anywhere, which opens a context menu, and select Fix Imports. (You have a choice of List classes to import. Accept the default java.util.List.) The full list of imported classes follows:
+
+[start=7]
+. You see a number of error bars and warning icons, indicating classes that are not found. To fix imports after pasting the code, either press Ctrl-Shift-I (⌘-Shift-I on Mac), or right-click anywhere, which opens a context menu, and select Fix Imports. (You have a choice of List classes to import. Accept the default java.util.List.) The full list of imported classes follows:
[source,java]
----
@@ -262,7 +276,9 @@
1. Right-click the project node and choose Run. After a while, the application deploys and displays the web page that you coded in the previous section.
2. Enter some text, making sure that some of it is incorrectly spelled:
image::images/jaxwsc-spellchecker-form.png[title="JSP page with text to check"]
-3. Click Spell Check and see the result:
+
+[start=3]
+. Click Spell Check and see the result:
image::images/jaxwsc-spellchecker-report.png[title="Spell Checker report showing errors"]
@@ -296,8 +312,12 @@
3. Name the form ``MainForm`` and place it in the package ``org.me.forms`` .
4. After you create the JFrame, open the project properties. In the Run category, set ``MainForm`` as the Main class.
image::images/asynch-main-class.png[]
-5. In the Editor, open the Design view of ``MainForm.java`` . From the Palette, drag and drop three Scroll Panes into ``MainForm`` . Position and size the scroll panes. They will hold the text fields for the text you type in to check, all the wrong words, and the suggestions for one wrong word.
-6. Drag and drop five Text Fields into ``MainForm`` . Drop three of them into the three scroll panes. Modify them as follows:
+
+[start=5]
+. In the Editor, open the Design view of ``MainForm.java`` . From the Palette, drag and drop three Scroll Panes into ``MainForm`` . Position and size the scroll panes. They will hold the text fields for the text you type in to check, all the wrong words, and the suggestions for one wrong word.
+
+[start=6]
+. Drag and drop five Text Fields into ``MainForm`` . Drop three of them into the three scroll panes. Modify them as follows:
|===
|Text Fields
@@ -314,9 +334,15 @@
|tfSuggestions1 |Y |N
|===
-7. Drag and drop a Progress Bar into ``MainForm`` . Name the variable ``pbProgress`` .
-8. Drag and drop two Buttons into ``MainForm`` . Name the first button ``btCheck`` and change its text to Check Text or Check Spelling. Name the second button ``btNextWrongWord`` , change its text to Next Wrong Word, and disable it.
-9. Drag and drop some Labels into ``MainForm`` , to give a title to your application and to describe the text fields.
+
+[start=7]
+. Drag and drop a Progress Bar into ``MainForm`` . Name the variable ``pbProgress`` .
+
+[start=8]
+. Drag and drop two Buttons into ``MainForm`` . Name the first button ``btCheck`` and change its text to Check Text or Check Spelling. Name the second button ``btNextWrongWord`` , change its text to Next Wrong Word, and disable it.
+
+[start=9]
+. Drag and drop some Labels into ``MainForm`` , to give a title to your application and to describe the text fields.
Arrange the appearance of the JFrame to your liking and save it. Next you add web service client functionality.
@@ -330,15 +356,27 @@
link:http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl[+http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl+]. Accept all the defaults and click Finish. This is the same procedure from Step 2 onwards described in <<creatingtheclient,Creating the Client>>.
-2. Expand the Web Service References node and right-click the ``check`` service. The context menu opens.
+
+[start=2]
+. Expand the Web Service References node and right-click the ``check`` service. The context menu opens.
image::images/asynch-edit-ws-attrib.png[]
-3. From the context menu, select Edit Web Service Attributes. The Web Service Attributes dialog opens.
-4. Select the WSDL Customization tab.
-5. Expand the Port Type Operations node. Expand the *first* ``CheckTextBodyV2`` node and select Enable Asynchronous Client.
+
+[start=3]
+. From the context menu, select Edit Web Service Attributes. The Web Service Attributes dialog opens.
+
+[start=4]
+. Select the WSDL Customization tab.
+
+[start=5]
+. Expand the Port Type Operations node. Expand the *first* ``CheckTextBodyV2`` node and select Enable Asynchronous Client.
image::images/enable-async-client.png[]
-6. Click OK. The dialog closes and a warning appears that changing the web service attributes will refresh the client node.
+
+[start=6]
+. Click OK. The dialog closes and a warning appears that changing the web service attributes will refresh the client node.
image::images/asynch-refresh-node-warning.png[]
-7. Click OK. The warning closes and your client node refreshes. If you expand the ``check`` node in Web Service References, you see that you now have Polling and Callback versions of the ``CheckTextBody`` operation.
+
+[start=7]
+. Click OK. The warning closes and your client node refreshes. If you expand the ``check`` node in Web Service References, you see that you now have Polling and Callback versions of the ``CheckTextBody`` operation.
image::images/asynch-ws-refs.png[]
Asynchronous web service clients for the SpellCheck service are now enabled for your application.
@@ -360,8 +398,12 @@
}
----
-2. In the Projects window, expand the ``AsynchSpellCheckClient`` 's Web Service References node and locate the ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` operation.
-3. Drag the ``CheckTextBodyV2 [Asynch Callback]`` operation into the empty ``callAsyncCallback`` method body. The IDE generates the following ``try`` block. Compare this generated code to the code generated for the synchronous client.
+
+[start=2]
+. In the Projects window, expand the ``AsynchSpellCheckClient`` 's Web Service References node and locate the ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` operation.
+
+[start=3]
+. Drag the ``CheckTextBodyV2 [Asynch Callback]`` operation into the empty ``callAsyncCallback`` method body. The IDE generates the following ``try`` block. Compare this generated code to the code generated for the synchronous client.
[source,java]
----
@@ -394,8 +436,12 @@
In this code, along with the web service invocation, you see that the response from the SpellCheck service is handled through an `` AsynchHandler `` object. Meanwhile, a ``Future`` object checks to see if a result has been returned and sleeps the thread until the result is complete.
-4. Switch back to the Design view. Double-click the Check Spelling button. The IDE automatically adds an ActionListener to the button and switches you to the Source view, with the cursor in the empty ``btCheckActionPerformed`` method.
-5. Add the following code to the ``btCheckActionPerformed`` method body. This code gets the text that you type into the ``tfYourText`` field, has the progress bar display a "waiting for server" message, disables the ``btCheck`` button, and calls the asynchronous callback method.
+
+[start=4]
+. Switch back to the Design view. Double-click the Check Spelling button. The IDE automatically adds an ActionListener to the button and switches you to the Source view, with the cursor in the empty ``btCheckActionPerformed`` method.
+
+[start=5]
+. Add the following code to the ``btCheckActionPerformed`` method body. This code gets the text that you type into the ``tfYourText`` field, has the progress bar display a "waiting for server" message, disables the ``btCheck`` button, and calls the asynchronous callback method.
[source,java]
----
@@ -408,7 +454,9 @@
callAsyncCallback(text);*
}
----
-6. At the beginning of the ``MainForm`` class, instantiate a private ``ActionListener`` field named ``nextWord`` . This ``ActionListener`` is for the Next Wrong Word button that advances one wrong word in the list of wrong words and displays the word and suggestions for correcting it. You create the private field here so you can unregister the ``ActionListener`` if it already has been defined. Otherwise, every time you check new text, you would add an additional listener and end up with multiple listeners calling ``actionPerformed()`` multiple times. The application would not behave correctly.
+
+[start=6]
+. At the beginning of the ``MainForm`` class, instantiate a private ``ActionListener`` field named ``nextWord`` . This ``ActionListener`` is for the Next Wrong Word button that advances one wrong word in the list of wrong words and displays the word and suggestions for correcting it. You create the private field here so you can unregister the ``ActionListener`` if it already has been defined. Otherwise, every time you check new text, you would add an additional listener and end up with multiple listeners calling ``actionPerformed()`` multiple times. The application would not behave correctly.
[source,java]
----
@@ -418,7 +466,9 @@
private ActionListener nextWord;
...
----
-7. Replace the entire ``callAsyncCallback`` method with the following code. Note that the outermost ``try`` block is removed. It is unnecessary because more specific ``try`` blocks are added inside the method. Other changes to the code are explained in code comments.
+
+[start=7]
+. Replace the entire ``callAsyncCallback`` method with the following code. Note that the outermost ``try`` block is removed. It is unnecessary because more specific ``try`` blocks are added inside the method. Other changes to the code are explained in code comments.
[source,java]
----
@@ -568,7 +618,9 @@
}
}
----
-8. Press Ctrl-Shift-I (⌘-Shift-I on Mac) and fix imports. This adds the following import statements:
+
+[start=8]
+. Press Ctrl-Shift-I (⌘-Shift-I on Mac) and fix imports. This adds the following import statements:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/client_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/client_ja.asciidoc
index d51a1c9..2ecde41 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/client_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/client_ja.asciidoc
@@ -81,8 +81,12 @@
ファイアウォールを使用している場合は、プロキシ・サーバーの指定が必要になることがあり、指定しないと、WSDLファイルをダウンロードできません。プロキシ・サーバーを指定するには、ウィザードの「プロキシを設定」をクリックします。IDEの「オプション」ウィンドウが開き、IDEのプロキシを汎用的に設定できます。
-4. パッケージ名は空白にしておきます。デフォルトでは、クライアント・クラスのパッケージ名はWSDLから取得されます。今回のケースでは ``com.cdyne.ws`` です。「終了」をクリックします。
-5. 「プロジェクト」ウィンドウの「Webサービス参照」ノードは、次のようになります。
+
+[start=4]
+. パッケージ名は空白にしておきます。デフォルトでは、クライアント・クラスのパッケージ名はWSDLから取得されます。今回のケースでは ``com.cdyne.ws`` です。「終了」をクリックします。
+
+[start=5]
+. 「プロジェクト」ウィンドウの「Webサービス参照」ノードは、次のようになります。
image::images/ws-refs.png[title="Webサービス参照を示す「プロジェクト」ウィンドウ"]
この「プロジェクト」ウィンドウは、「check」というWebサービスにより、アプリケーションでいくつかの「CheckTextBody」および「CheckTextBodyV2」操作が利用可能になっていることを示しています。これらの操作は、文字列をチェックしてスペル・ミスを発見し、クライアントで処理するデータを返します。サービスのV2バージョンでは認証を必要としません。このチュートリアル全体では、 ``checkSoap.CheckTextBodyV2`` 操作を使用します。
@@ -136,10 +140,16 @@
1. 「プロジェクト」ウィンドウで「 ``SpellCheckService`` 」プロジェクト・ノードを右クリックし、「新規」>「その他」を選択し、次に、「Web」>「サーブレット」を選択します。「次」をクリックして新規サーブレット・ウィザードを開きます。
2. サーブレットの名前を ``SpellCheckServlet`` とし、「パッケージ」のドロップダウンに「 ``clientservlet`` 」と入力します。「次」をクリックします。
image::images/name-servlet.png[]
-3. 「サーブレット・デプロイメントを構成」パネルで、このサーブレットのURLマッピングが ``/SpellCheckServlet`` であることを確認します。デフォルトを受け入れ、「終了」をクリックします。ソース・エディタでサーブレットが開きます。
+
+[start=3]
+. 「サーブレット・デプロイメントを構成」パネルで、このサーブレットのURLマッピングが ``/SpellCheckServlet`` であることを確認します。デフォルトを受け入れ、「終了」をクリックします。ソース・エディタでサーブレットが開きます。
image::images/jaxwsc-servlet.png[]
-4. ソース・エディタ内の ``SpellCheckServlet.java`` の ``processRequest`` メソッドの本体内にカーソルを置き、メソッドの直前に新しい行をいくつか加えます。
-5. 前のステップで作成したスペースで右クリックし、「コードを挿入」>「Webサービス操作をコール」を選択します。次に示すように、「呼び出す操作を選択」ダイアログ・ボックスで「 ``checkSoap.CheckTextBodyV2`` 」操作をクリックします。
+
+[start=4]
+. ソース・エディタ内の ``SpellCheckServlet.java`` の ``processRequest`` メソッドの本体内にカーソルを置き、メソッドの直前に新しい行をいくつか加えます。
+
+[start=5]
+. 前のステップで作成したスペースで右クリックし、「コードを挿入」>「Webサービス操作をコール」を選択します。次に示すように、「呼び出す操作を選択」ダイアログ・ボックスで「 ``checkSoap.CheckTextBodyV2`` 」操作をクリックします。
image::images/insert-ws-ops.png[title="Webサービス参照を示す「プロジェクト」ウィンドウ"]
「OK」をクリックします。
@@ -165,7 +175,9 @@
*@WebServiceRef(wsdlLocation = "http://wsf.cdyne.com/SpellChecker/check.asmx?WSDL")
private Check service;*
----
-6. ``processRequest()`` メソッドの ``try`` ブロックを次のコードに置き換えます。コード内のコメントは、各行の目的を説明しています。
+
+[start=6]
+. ``processRequest()`` メソッドの ``try`` ブロックを次のコードに置き換えます。コード内のコメントは、各行の目的を説明しています。
[source,html]
----
@@ -235,7 +247,9 @@
}
----
-7. 見つからないクラスを通知するエラー・バーや警告アイコンが表示されます。コードの貼付け後にインポートを修正するには、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押すか、任意の場所を右クリックしてコンテキスト・メニューを開き、「インポートを修正」を選択します。(インポートするListクラスを選択できます。デフォルトのjava.util.Listを受け入れます。)インポートされるクラスの一覧は、次のとおりです。
+
+[start=7]
+. 見つからないクラスを通知するエラー・バーや警告アイコンが表示されます。コードの貼付け後にインポートを修正するには、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押すか、任意の場所を右クリックしてコンテキスト・メニューを開き、「インポートを修正」を選択します。(インポートするListクラスを選択できます。デフォルトのjava.util.Listを受け入れます。)インポートされるクラスの一覧は、次のとおりです。
[source,java]
----
@@ -264,7 +278,9 @@
1. プロジェクトのノードを右クリックし、「実行」を選択します。しばらくすると、アプリケーションがデプロイされ、前の項でコード入力したWebページが表示されます。
2. テキストを入力します。誤ったスペルの単語が含まれるようにします。
image::images/jaxwsc-spellchecker-form.png[title="チェックするテキストが入力されたJSPページ"]
-3. 「Spell Check」をクリックして結果を確認します。
+
+[start=3]
+. 「Spell Check」をクリックして結果を確認します。
image::images/jaxwsc-spellchecker-report.png[title="誤りを表示するSpell Checkerのレポート"]
@@ -298,8 +314,12 @@
3. フォームの名前を「 ``MainForm`` 」にして、 ``org.me.forms`` パッケージに配置します。
4. JFrameの作成後、プロジェクトのプロパティを開きます。「実行」カテゴリで、 ``MainForm`` をメイン・クラスとして設定します。
image::images/asynch-main-class.png[]
-5. エディタで、 ``MainForm.java`` の「デザイン」ビューを開きます。「パレット」から3つのスクロール・ペインを ``MainForm`` にドラッグ・アンド・ドロップします。スクロール・ペインを配置してサイズ変更します。ここには、チェック対象の入力テキスト、誤った単語すべて、および誤った単語1つに対する修正候補のためのテキスト・フィールドが保持されます。
-6. 5つのテキスト・フィールドを ``MainForm`` にドラッグ・アンド・ドロップします。その中の3つを3つのスクロール・ペインにドロップします。次のように変更します。
+
+[start=5]
+. エディタで、 ``MainForm.java`` の「デザイン」ビューを開きます。「パレット」から3つのスクロール・ペインを ``MainForm`` にドラッグ・アンド・ドロップします。スクロール・ペインを配置してサイズ変更します。ここには、チェック対象の入力テキスト、誤った単語すべて、および誤った単語1つに対する修正候補のためのテキスト・フィールドが保持されます。
+
+[start=6]
+. 5つのテキスト・フィールドを ``MainForm`` にドラッグ・アンド・ドロップします。その中の3つを3つのスクロール・ペインにドロップします。次のように変更します。
|===
|テキスト・フィールド
@@ -316,9 +336,15 @@
|tfSuggestions1 |Y |N
|===
-7. 進捗バーを ``MainForm`` にドラッグ・アンド・ドロップします。変数に ``pbProgress`` という名前を付けます。
-8. 2つのボタンを ``MainForm`` にドラッグ・アンド・ドロップします。最初のボタンに ``btCheck`` という名前を付け、そのテキストを「Check Text」または「Check Spelling」に変更します。2番目のボタンに ``btNextWrongWord`` という名前を付け、そのテキストを「Next Wrong Word」に変更し、無効にします。
-9. いくつかのラベルを ``MainForm`` にドラッグ・アンド・ドロップし、アプリケーションにタイトルを付けたり、テキスト・フィールドを説明したりします。
+
+[start=7]
+. 進捗バーを ``MainForm`` にドラッグ・アンド・ドロップします。変数に ``pbProgress`` という名前を付けます。
+
+[start=8]
+. 2つのボタンを ``MainForm`` にドラッグ・アンド・ドロップします。最初のボタンに ``btCheck`` という名前を付け、そのテキストを「Check Text」または「Check Spelling」に変更します。2番目のボタンに ``btNextWrongWord`` という名前を付け、そのテキストを「Next Wrong Word」に変更し、無効にします。
+
+[start=9]
+. いくつかのラベルを ``MainForm`` にドラッグ・アンド・ドロップし、アプリケーションにタイトルを付けたり、テキスト・フィールドを説明したりします。
JFrameの外観を好みにあわせて調整し、保存します。次に、Webサービス・クライアントの機能を追加します。
@@ -332,15 +358,27 @@
link:http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl[+http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl+]。デフォルトをすべて受け入れ、「終了」をクリックします。これは、<<creatingtheclient,クライアントの作成>>のステップ2以降で説明されている手順と同じです。
-2. 「Webサービス参照」ノードを展開し、「 ``check`` 」サービスを右クリックします。コンテキスト・メニューが開きます。
+
+[start=2]
+. 「Webサービス参照」ノードを展開し、「 ``check`` 」サービスを右クリックします。コンテキスト・メニューが開きます。
image::images/asynch-edit-ws-attrib.png[]
-3. コンテキスト・メニューから「Webサービス属性を編集」を選択します。「Webサービス属性」ダイアログが開きます。
-4. 「WSDLカスタマイズ」タブを選択します。
-5. 「ポート・タイプ操作」ノードを展開します。*最初の* ``CheckTextBodyV2`` ノードを展開し、「非同期クライアントを有効にする」を選択します。
+
+[start=3]
+. コンテキスト・メニューから「Webサービス属性を編集」を選択します。「Webサービス属性」ダイアログが開きます。
+
+[start=4]
+. 「WSDLカスタマイズ」タブを選択します。
+
+[start=5]
+. 「ポート・タイプ操作」ノードを展開します。*最初の* ``CheckTextBodyV2`` ノードを展開し、「非同期クライアントを有効にする」を選択します。
image::images/enable-async-client.png[]
-6. 「OK」をクリックします。ダイアログが終了し、Webサービス属性を変更するとクライアント・ノードがリフレッシュされることを示す警告が表示されます。
+
+[start=6]
+. 「OK」をクリックします。ダイアログが終了し、Webサービス属性を変更するとクライアント・ノードがリフレッシュされることを示す警告が表示されます。
image::images/asynch-refresh-node-warning.png[]
-7. 「OK」をクリックします。警告が閉じ、クライアント・ノードがリフレッシュされます。「Webサービス参照」の ``check`` ノードを展開すると、 ``CheckTextBody`` 操作のポーリングとコールバックのバージョンがあることがわかります。
+
+[start=7]
+. 「OK」をクリックします。警告が閉じ、クライアント・ノードがリフレッシュされます。「Webサービス参照」の ``check`` ノードを展開すると、 ``CheckTextBody`` 操作のポーリングとコールバックのバージョンがあることがわかります。
image::images/asynch-ws-refs.png[]
これでSpellCheckサービスの非同期Webサービス・クライアントが、アプリケーションで有効になりました。
@@ -362,8 +400,12 @@
}
----
-2. 「プロジェクト」ウィンドウで、 ``AsynchSpellCheckClient`` の「Webサービス参照」ノードを展開し、 ``checkSoap.CheckTextBodyV2 [非同期コールバック]`` 操作を探します。
-3. ``CheckTextBodyV2 [非同期コールバック]`` 操作を空の ``callAsyncCallback`` メソッド本体にドラッグします。次の ``try`` ブロックが生成されます。この生成されたコードを、同期クライアント用に生成されたコードと比較します。
+
+[start=2]
+. 「プロジェクト」ウィンドウで、 ``AsynchSpellCheckClient`` の「Webサービス参照」ノードを展開し、 ``checkSoap.CheckTextBodyV2 [非同期コールバック]`` 操作を探します。
+
+[start=3]
+. ``CheckTextBodyV2 [非同期コールバック]`` 操作を空の ``callAsyncCallback`` メソッド本体にドラッグします。次の ``try`` ブロックが生成されます。この生成されたコードを、同期クライアント用に生成されたコードと比較します。
[source,java]
----
@@ -396,8 +438,12 @@
このコードでは、Webサービスの呼出しとともに、SpellCheckサービスからのレスポンスが ``AsynchHandler`` オブジェクトを介して処理されることがわかります。一方、 ``Future`` オブジェクトは、結果が返されたかどうかを確認し、その結果が完了するまでスレッドをスリープします。
-4. 「デザイン」ビューに戻ります。「Check Spelling」ボタンをダブルクリックします。ボタンにActionListenerが自動的に追加され、「ソース」ビューに切り替わり、カーソルは空の ``btCheckActionPerformed`` メソッドに置かれます。
-5. ``btCheckActionPerformed`` メソッドの本体に次のコードを追加します。このコードは、 ``tfYourText`` フィールドに入力されたテキストを取得して、サーバーを待機していることを示すメッセージを進捗バーに表示し、 ``btCheck`` ボタンを無効にして、非同期コールバック・メソッドをコールします。
+
+[start=4]
+. 「デザイン」ビューに戻ります。「Check Spelling」ボタンをダブルクリックします。ボタンにActionListenerが自動的に追加され、「ソース」ビューに切り替わり、カーソルは空の ``btCheckActionPerformed`` メソッドに置かれます。
+
+[start=5]
+. ``btCheckActionPerformed`` メソッドの本体に次のコードを追加します。このコードは、 ``tfYourText`` フィールドに入力されたテキストを取得して、サーバーを待機していることを示すメッセージを進捗バーに表示し、 ``btCheck`` ボタンを無効にして、非同期コールバック・メソッドをコールします。
[source,java]
----
@@ -410,7 +456,9 @@
callAsyncCallback(text);*
}
----
-6. ``MainForm`` クラスの先頭で、 ``nextWord`` という名前の ``ActionListener`` プライベート・フィールドをインスタンス化します。この ``ActionListener`` は、誤った単語のリスト内で単語を1つ進み、その単語と修正候補を表示する、「Next Wrong Word」ボタン用です。ここでプライベート・フィールドを作成すると、 ``ActionListener`` がすでに定義されている場合に登録解除できます。そうしないと、新しいテキストを確認するたびに、追加リスナーを追加するため、複数のリスナーが ``actionPerformed()`` を何度もコールする結果になります。アプリケーションが正しく動作しなくなる可能性があります。
+
+[start=6]
+. ``MainForm`` クラスの先頭で、 ``nextWord`` という名前の ``ActionListener`` プライベート・フィールドをインスタンス化します。この ``ActionListener`` は、誤った単語のリスト内で単語を1つ進み、その単語と修正候補を表示する、「Next Wrong Word」ボタン用です。ここでプライベート・フィールドを作成すると、 ``ActionListener`` がすでに定義されている場合に登録解除できます。そうしないと、新しいテキストを確認するたびに、追加リスナーを追加するため、複数のリスナーが ``actionPerformed()`` を何度もコールする結果になります。アプリケーションが正しく動作しなくなる可能性があります。
[source,java]
----
@@ -420,7 +468,9 @@
private ActionListener nextWord;
...
----
-7. ``callAsyncCallback`` メソッド全体を次のコードで置き換えます。最も外側の ``try`` ブロックは除去されることに注意してください。このブロックが必要ないのは、より具体的な ``try`` ブロックがメソッド内に追加されるためです。コードに対するその他の変更は、コード・コメントで説明します。
+
+[start=7]
+. ``callAsyncCallback`` メソッド全体を次のコードで置き換えます。最も外側の ``try`` ブロックは除去されることに注意してください。このブロックが必要ないのは、より具体的な ``try`` ブロックがメソッド内に追加されるためです。コードに対するその他の変更は、コード・コメントで説明します。
[source,java]
----
@@ -570,7 +620,9 @@
}
}
----
-8. [Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押してインポートを修正します。次のインポート文が追加されます。
+
+[start=8]
+. [Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押してインポートを修正します。次のインポート文が追加されます。
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/client_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/client_pt_BR.asciidoc
index 6de7ff5..c2d9bb6 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/client_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/client_pt_BR.asciidoc
@@ -81,8 +81,12 @@
Se você estiver protegido por firewall, talvez seja necessário especificar um servidor proxy, do contrário, o arquivo WSDL não poderá ser baixado. Para especificar o servidor proxy, clique em Definir Proxy no assistente. A janela Opções do IDE será aberta, onde você poderá definir o proxy de forma universal para o IDE.
-4. Deixe o nome do pacote em branco. Por default, o nome do pacote de classe do cliente é baseado no WSDL. Nesse caso, é ``com.cdyne.ws`` . Clique em Finalizar.
-5. Na janela Projetos, no nó Referências de Web Service, você verá o seguinte:
+
+[start=4]
+. Deixe o nome do pacote em branco. Por default, o nome do pacote de classe do cliente é baseado no WSDL. Nesse caso, é ``com.cdyne.ws`` . Clique em Finalizar.
+
+[start=5]
+. Na janela Projetos, no nó Referências de Web Service, você verá o seguinte:
image::images/ws-refs.png[title="Janela Projetos mostrando as referências de Web services"]
A janela Projetos mostra que um Web service chamado 'check' tornou disponível uma quantidade de operações 'CheckTextBody' e 'CheckTextBodyV2' para sua aplicação. Estas operações verificam se há erros de ortografia em uma sequência de caracteres e retorna os dados para serem processados pelo cliente. A versão V2 do serviço não requer autenticação. Você utilizará a operação ``checkSoap.CheckTextBodyV2`` neste tutorial.
@@ -136,10 +140,16 @@
1. Clique com o botão direito do mouse no nó do projeto ``SpellCheckService `` na janela Projetos, selecione Novo > Outro e, em seguida, selecione Web > Servlet. Clique em Próximo para abrir o assistente Novo Servlet.
2. Defina o nome do servlet como ``SpellCheckServlet`` e digite ``clientservlet`` na lista drop-down Pacote. Clique em Próximo.
image::images/name-servlet.png[]
-3. No painel Configurar Implantação do Servlet, observe que o mapeamento do URL deste servlet é ``/SpellCheckServlet`` . Aceite os defaults e clique em Finalizar. O servlet será aberto no Editor de Código-Fonte.
+
+[start=3]
+. No painel Configurar Implantação do Servlet, observe que o mapeamento do URL deste servlet é ``/SpellCheckServlet`` . Aceite os defaults e clique em Finalizar. O servlet será aberto no Editor de Código-Fonte.
image::images/jaxwsc-servlet.png[]
-4. Coloque o cursor no Editor de Código-Fonte, dentro do corpo do método ``processRequest`` de ``SpellCheckServlet.java`` e adicione algumas linhas novas logo acima do método.
-5. Clique com o botão direito do mouse no espaço criado na etapa anterior e selecione Inserir Código > Chamar Operação de Web Service. Clique na operação ``checkSoap.CheckTextBodyV2`` na caixa de diálogo "Selecionar Operação a Ser Chamada", conforme mostrado a seguir:
+
+[start=4]
+. Coloque o cursor no Editor de Código-Fonte, dentro do corpo do método ``processRequest`` de ``SpellCheckServlet.java`` e adicione algumas linhas novas logo acima do método.
+
+[start=5]
+. Clique com o botão direito do mouse no espaço criado na etapa anterior e selecione Inserir Código > Chamar Operação de Web Service. Clique na operação ``checkSoap.CheckTextBodyV2`` na caixa de diálogo "Selecionar Operação a Ser Chamada", conforme mostrado a seguir:
image::images/insert-ws-ops.png[title="Janela Projetos mostrando as referências de Web services"]
Clique em OK.
@@ -165,7 +175,9 @@
*@WebServiceRef(wsdlLocation = "http://wsf.cdyne.com/SpellChecker/check.asmx?WSDL")
private Check service;*
----
-6. Substitua o bloco ``try`` do método ``processRequest()`` pelo código a seguir. Os comentários alinhados no código a seguir explicam a finalidade de cada linha.
+
+[start=6]
+. Substitua o bloco ``try`` do método ``processRequest()`` pelo código a seguir. Os comentários alinhados no código a seguir explicam a finalidade de cada linha.
[source,html]
----
@@ -235,7 +247,9 @@
}
----
-7. Você verá diversas barras de erros e ícones de advertência indicando as classes não foram encontradas. Para corrigir as importações depois de colar o código, pressione Ctrl-Shift-I (⌘-Shift-I no Mac) ou clique com o botão direito do mouse em qualquer lugar, o que abrirá um menu de contexto. Lá, selecione Corrigir Importações. (Você poderá listar as classes para importação. Aceite o java.util.List default). Segue a lista das classes importadas:
+
+[start=7]
+. Você verá diversas barras de erros e ícones de advertência indicando as classes não foram encontradas. Para corrigir as importações depois de colar o código, pressione Ctrl-Shift-I (⌘-Shift-I no Mac) ou clique com o botão direito do mouse em qualquer lugar, o que abrirá um menu de contexto. Lá, selecione Corrigir Importações. (Você poderá listar as classes para importação. Aceite o java.util.List default). Segue a lista das classes importadas:
[source,java]
----
@@ -264,7 +278,9 @@
1. Clique com o botão direito do mouse no nó do projeto e selecione Executar. Após um tempo, a aplicação é implantada e exibe a página Web codificada na seção anterior.
2. Insira um texto, verificando se parte dele está escrita incorretamente:
image::images/jaxwsc-spellchecker-form.png[title="Página JSP com texto para verificação"]
-3. Clique em Verificar Ortografia e veja o resultado:
+
+[start=3]
+. Clique em Verificar Ortografia e veja o resultado:
image::images/jaxwsc-spellchecker-report.png[title="Relatório do Corretor Ortográfico mostrando erros"]
@@ -298,8 +314,12 @@
3. Defina o nome do form como ``MainForm`` e coloque-o no pacote ``org.me.forms`` .
4. Após a criar o JFrame, abra as propriedades do projeto. Na categoria Executar, defina ``MainForm`` como classe Principal.
image::images/asynch-main-class.png[]
-5. No Editor, abra a view Projeto de ``MainForm.java`` . Da Paleta, arraste e solte três Painéis de Rolagem no ``MainForm`` . Posicione e ajuste o tamanho dos painéis de rolagem. Eles conterão os campos de texto dos textos digitados para verificação, todas as palavras erradas e as sugestões para uma palavra errada.
-6. Arraste e solte cinco Campos de Texto no ``MainForm`` . Arraste três deles para dentro dos painéis de rolagem. Modifique-os da seguinte forma:
+
+[start=5]
+. No Editor, abra a view Projeto de ``MainForm.java`` . Da Paleta, arraste e solte três Painéis de Rolagem no ``MainForm`` . Posicione e ajuste o tamanho dos painéis de rolagem. Eles conterão os campos de texto dos textos digitados para verificação, todas as palavras erradas e as sugestões para uma palavra errada.
+
+[start=6]
+. Arraste e solte cinco Campos de Texto no ``MainForm`` . Arraste três deles para dentro dos painéis de rolagem. Modifique-os da seguinte forma:
|===
|Campos de Texto
@@ -316,9 +336,15 @@
|tfSuggestions1 |Y |N
|===
-7. Arraste e solte uma Barra de Andamento no ``MainFrame`` . Chame a variável de ``pbProgress`` .
-8. Arraste e solte dois Botões no ``MainForm`` . Defina o nome do primeiro botão como ``btCheck`` e altere seu texto para Verificar Texto ou Verificar Ortografia. Definia o nome do segundo botão como ``btNextWrongWord`` , altere seu texto para Próxima Palavra Errada e desative-o.
-9. Arraste e solte alguns Labels no ``MainForm`` para dar um título à aplicação e para descrever os campos de texto.
+
+[start=7]
+. Arraste e solte uma Barra de Andamento no ``MainFrame`` . Chame a variável de ``pbProgress`` .
+
+[start=8]
+. Arraste e solte dois Botões no ``MainForm`` . Defina o nome do primeiro botão como ``btCheck`` e altere seu texto para Verificar Texto ou Verificar Ortografia. Definia o nome do segundo botão como ``btNextWrongWord`` , altere seu texto para Próxima Palavra Errada e desative-o.
+
+[start=9]
+. Arraste e solte alguns Labels no ``MainForm`` para dar um título à aplicação e para descrever os campos de texto.
Arrume a aparência do JFrame de acordo com a sua preferência e salve-o. Depois, você adicionará a funcionalidade de cliente de Web service.
@@ -332,15 +358,27 @@
link:http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl[+http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl+]. Aceite todos os defaults e clique em Finalizar. Trata-se do mesmo procedimento da Etapa 2, descrito a seguir em <<creatingtheclient,Criando o Cliente>>.
-2. Expanda o nó Referências de Web Services e clique com o botão direito do mouse no serviço ``check`` . O menu de contexto será aberto.
+
+[start=2]
+. Expanda o nó Referências de Web Services e clique com o botão direito do mouse no serviço ``check`` . O menu de contexto será aberto.
image::images/asynch-edit-ws-attrib.png[]
-3. No menu de contexto, selecione Editar Atributos do Web Service. A caixa de diálogo Atributos do Web service será aberta.
-4. Selecione a guia Personalização de WSDL.
-5. Expanda o nó Operações de Tipos de Porta. Expanda o *primeiro* nó ``CheckTextBodyV2`` e selecione Ativar Cliente Assíncrono.
+
+[start=3]
+. No menu de contexto, selecione Editar Atributos do Web Service. A caixa de diálogo Atributos do Web service será aberta.
+
+[start=4]
+. Selecione a guia Personalização de WSDL.
+
+[start=5]
+. Expanda o nó Operações de Tipos de Porta. Expanda o *primeiro* nó ``CheckTextBodyV2`` e selecione Ativar Cliente Assíncrono.
image::images/enable-async-client.png[]
-6. Clique em OK. A caixa de diálogo será fechada e será exibida uma advertência informando que a alteração dos atributos de Web service atualizarão o nó do cliente.
+
+[start=6]
+. Clique em OK. A caixa de diálogo será fechada e será exibida uma advertência informando que a alteração dos atributos de Web service atualizarão o nó do cliente.
image::images/asynch-refresh-node-warning.png[]
-7. Clique em OK. A advertência será fechada e o nó do cliente, atualizado. Se expandir o nó ``check`` em Referências de Web Service, você verá que agora possui as versões Sondagem e Retorno de Chamada da operação ``CheckTextBody`` .
+
+[start=7]
+. Clique em OK. A advertência será fechada e o nó do cliente, atualizado. Se expandir o nó ``check`` em Referências de Web Service, você verá que agora possui as versões Sondagem e Retorno de Chamada da operação ``CheckTextBody`` .
image::images/asynch-ws-refs.png[]
Os clientes assíncronos de Web service do serviço SpellCheck agora estão ativados para sua aplicação.
@@ -362,8 +400,12 @@
}
----
-2. Na janela Projetos, expanda o nó Referências de Web Service do ``AsynchSpellCheckService`` e localize a operação ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` .
-3. Arraste a operação ``CheckTextBodyV2 [Asynch Callback]`` para o corpo do método ``callAsynchCallback`` vazio. O IDE irá gerar o seguinte bloco ``try`` . Compare este código gerado ao código gerado para o cliente síncrono.
+
+[start=2]
+. Na janela Projetos, expanda o nó Referências de Web Service do ``AsynchSpellCheckService`` e localize a operação ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` .
+
+[start=3]
+. Arraste a operação ``CheckTextBodyV2 [Asynch Callback]`` para o corpo do método ``callAsynchCallback`` vazio. O IDE irá gerar o seguinte bloco ``try`` . Compare este código gerado ao código gerado para o cliente síncrono.
[source,java]
----
@@ -396,8 +438,12 @@
Neste código, junto com a chamada do Web service, você observa que a resposta do serviço SpellCheck é manipulada por meio de um objeto ``AsynchHandler`` . Enquanto isso, um objeto ``Future`` verifica se foi retornado um resultado e inativa o thread até que o resultado seja concluído.
-4. Volte para a view do Projeto. Clique Duas Vezes no Botão Verificar Ortografia. O IDE adiciona automaticamente um ActionListener ao botão e alterna para a view Código-Fonte, com o cursor no método ``btCheckActionPerformed`` vazio.
-5. Adicione o seguinte código ao corpo do método ``btCheckActionPerformed`` . Este código toma o texto que você digitou no campo ``tfYourText`` , exibe a mensagem "aguardando servidor" na barra de progresso, desativa o botão ``btCheck`` e chama o método de retorno de chamada assíncrono.
+
+[start=4]
+. Volte para a view do Projeto. Clique Duas Vezes no Botão Verificar Ortografia. O IDE adiciona automaticamente um ActionListener ao botão e alterna para a view Código-Fonte, com o cursor no método ``btCheckActionPerformed`` vazio.
+
+[start=5]
+. Adicione o seguinte código ao corpo do método ``btCheckActionPerformed`` . Este código toma o texto que você digitou no campo ``tfYourText`` , exibe a mensagem "aguardando servidor" na barra de progresso, desativa o botão ``btCheck`` e chama o método de retorno de chamada assíncrono.
[source,java]
----
@@ -410,7 +456,9 @@
callAsyncCallback(text);*
}
----
-6. No início da classe ``MainForm`` , instancie um campo ``ActionListener`` privado denominado ``nextWord`` . Este ``ActionListener`` é para que o botão Próxima Palavra Errada que passa para a palavra errada seguinte da lista de palavras erradas e exibe a palavra e as sugestões para corrigi-la. Você cria o campo privado aqui, assim você pode cancelar o registro de ``ActionListener`` se ele já tiver sido definido. Do contrário, sempre que você verificar um novo texto, terá que adicionar um listener e o resultado será vários listeners chamando ``actionPerformed()`` várias vezes. Nesse caso, a aplicação não terá o comportamento correto.
+
+[start=6]
+. No início da classe ``MainForm`` , instancie um campo ``ActionListener`` privado denominado ``nextWord`` . Este ``ActionListener`` é para que o botão Próxima Palavra Errada que passa para a palavra errada seguinte da lista de palavras erradas e exibe a palavra e as sugestões para corrigi-la. Você cria o campo privado aqui, assim você pode cancelar o registro de ``ActionListener`` se ele já tiver sido definido. Do contrário, sempre que você verificar um novo texto, terá que adicionar um listener e o resultado será vários listeners chamando ``actionPerformed()`` várias vezes. Nesse caso, a aplicação não terá o comportamento correto.
[source,java]
----
@@ -420,7 +468,9 @@
private ActionListener nextWord;
...
----
-7. Substitua todo o método ``callAsynchCallback`` pelo código a seguir. Observe que o bloco ``try`` mais externo foi removido. Isso é desnecessário, pois blocos ``try`` mais específicos são adicionados ao método. Outras alterações no código são esclarecidas nos comentários do código.
+
+[start=7]
+. Substitua todo o método ``callAsynchCallback`` pelo código a seguir. Observe que o bloco ``try`` mais externo foi removido. Isso é desnecessário, pois blocos ``try`` mais específicos são adicionados ao método. Outras alterações no código são esclarecidas nos comentários do código.
[source,java]
----
@@ -570,7 +620,9 @@
}
}
----
-8. Pressione Ctrl-Shift-I (⌘-Shift-I no Mac) para corrigir importações. Isso adicionará as seguintes instruções de importação:
+
+[start=8]
+. Pressione Ctrl-Shift-I (⌘-Shift-I no Mac) para corrigir importações. Isso adicionará as seguintes instruções de importação:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/client_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/client_ru.asciidoc
index 844db17..fd7bc73 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/client_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/client_ru.asciidoc
@@ -81,8 +81,12 @@
Если компьютер защищен брандмауэром, то может потребоваться указать прокси-сервер, т.к. в противном случае загрузить файл WSDL будет невозможно. Чтобы указать прокси-сервер, нажмите в мастере кнопку "Настроить прокси". Открывается окно настроек среды IDE, в котором можно указать общий прокси-сервер для среды IDE.
-4. Название пакета указывать не следует. По умолчанию имя пакета класса клиента берется из WSDL. В данном случае это ``com.cdyne.ws`` . Нажмите 'Готово'.
-5. В окне "Проекты" в узле "Web Service References" должно быть представлено следующее:
+
+[start=4]
+. Название пакета указывать не следует. По умолчанию имя пакета класса клиента берется из WSDL. В данном случае это ``com.cdyne.ws`` . Нажмите 'Готово'.
+
+[start=5]
+. В окне "Проекты" в узле "Web Service References" должно быть представлено следующее:
image::images/ws-refs.png[title="Окно проекта, в котором показываются ссылки на веб-службу"]
В окне "Проекты" видно, что веб-служба под названием "check" сделала доступными для вашего приложения несколько операций "CheckTextBody" и "CheckTextBodyV2". В этих операциях строка проверяется на ошибки орфографии, и данные возвращаются для обработки клиентом. Версия службы V2 не требует проверки подлинности. В данном учебном курсе будет использоваться операция ``checkSoap.CheckTextBodyV2`` .
@@ -136,10 +140,16 @@
1. Щелкните правой кнопкой мыши узел проекта ``SpellCheckService`` в окне "Проекты", выберите команду "Создать > Прочее", а затем "Веб > Сервлет". Нажмите 'Далее', чтобы открыть мастер создания сервлетов.
2. Назовите сервлет ``SpellCheckServlet`` и введите ``clientservlet`` в раскрывающемся списке "Пакет". Нажмите 'Далее'.
image::images/name-servlet.png[]
-3. Обратите внимание, что сопоставление URL-адреса на панели 'Настройки развертывания сервлета' для данного сервлета имеет значение ``/SpellCheckServlet`` . Примите параметры по умолчанию и нажмите кнопку "Готово". Сервлет открывается в редакторе исходного кода.
+
+[start=3]
+. Обратите внимание, что сопоставление URL-адреса на панели 'Настройки развертывания сервлета' для данного сервлета имеет значение ``/SpellCheckServlet`` . Примите параметры по умолчанию и нажмите кнопку "Готово". Сервлет открывается в редакторе исходного кода.
image::images/jaxwsc-servlet.png[]
-4. Поместите указатель мыши в тело метода ``processRequest`` в проекте ``SpellCheckServlet.java`` и добавьте несколько новых строк прямо в верхней части метода.
-5. Щелкните правой кнопкой мыши область, созданную в предыдущем действии, и выберите "Вставить код > Вызвать операцию веб-службы". Выберите операцию ``checkSoap.CheckTextBodyV2`` в диалоговом окне "Выбор вызываемой операции", как указано ниже:
+
+[start=4]
+. Поместите указатель мыши в тело метода ``processRequest`` в проекте ``SpellCheckServlet.java`` и добавьте несколько новых строк прямо в верхней части метода.
+
+[start=5]
+. Щелкните правой кнопкой мыши область, созданную в предыдущем действии, и выберите "Вставить код > Вызвать операцию веб-службы". Выберите операцию ``checkSoap.CheckTextBodyV2`` в диалоговом окне "Выбор вызываемой операции", как указано ниже:
image::images/insert-ws-ops.png[title="Окно проекта, в котором показываются ссылки на веб-службу"]
Нажмите кнопку "ОК".
@@ -165,7 +175,9 @@
*@WebServiceRef(wsdlLocation = "http://wsf.cdyne.com/SpellChecker/check.asmx?WSDL")
private Check service;*
----
-6. Замените блок ``try`` в методе ``processRequest()`` следующим кодом. Встроенные комментарии в коде объясняют назначение каждой строки.
+
+[start=6]
+. Замените блок ``try`` в методе ``processRequest()`` следующим кодом. Встроенные комментарии в коде объясняют назначение каждой строки.
[source,html]
----
@@ -235,7 +247,9 @@
}
----
-7. Появятся панели ошибок и предупреждающие значки, указывающие на классы, которые не найдены. Чтобы исправить выражения импорта после вставки кода нажмите Ctrl-Shift-I (⌘-Shift-I в Mac) или щелкните правой кнопкой мыши в любом местоположении, после чего откроется контекстное меню и выберите 'Исправить выражения импорта'. Можно выбрать класс из списка классов List для импорта. Примите класс по умолчанию java.util.List. Ниже приведен полный список импортированных классов:
+
+[start=7]
+. Появятся панели ошибок и предупреждающие значки, указывающие на классы, которые не найдены. Чтобы исправить выражения импорта после вставки кода нажмите Ctrl-Shift-I (⌘-Shift-I в Mac) или щелкните правой кнопкой мыши в любом местоположении, после чего откроется контекстное меню и выберите 'Исправить выражения импорта'. Можно выбрать класс из списка классов List для импорта. Примите класс по умолчанию java.util.List. Ниже приведен полный список импортированных классов:
[source,java]
----
@@ -264,7 +278,9 @@
1. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить". Через некоторое время приложение должно развернуть и отобразить веб-страницу, код которой был написан по инструкциям в предыдущем разделе.
2. Введите произвольный текст, убедившись, что часть текста написана с ошибками:
image::images/jaxwsc-spellchecker-form.png[title="Страница JSP с текстом для проверки"]
-3. Нажмите кнопку "Проверка орфографии" и посмотрите результат:
+
+[start=3]
+. Нажмите кнопку "Проверка орфографии" и посмотрите результат:
image::images/jaxwsc-spellchecker-report.png[title="Отчет о работе средства проверки орфографии"]
@@ -298,8 +314,12 @@
3. Присвойте форме имя ``MainForm`` и разместите ее в пакете ``org.me.forms`` .
4. После создания формы JFrame откройте свойства проекта. В категории "Выполнить" укажите ``MainForm`` в качестве главного класса.
image::images/asynch-main-class.png[]
-5. Откройте режим проектирования для ``MainForm.java`` в редакторе. Перетащите с палитры три элемента "панель прокрутки" на ``MainForm`` . Задайте положение и размер панелей прокрутки. В них будут размещены поля с набираемым текстом, который требуется проверить, слова с ошибками и предложения по замене очередного неправильно написанного слова.
-6. Перетащите пять текстовых полей на форму ``MainForm`` . Три их них разместите на панелях прокрутки. Измените их следующим образом:
+
+[start=5]
+. Откройте режим проектирования для ``MainForm.java`` в редакторе. Перетащите с палитры три элемента "панель прокрутки" на ``MainForm`` . Задайте положение и размер панелей прокрутки. В них будут размещены поля с набираемым текстом, который требуется проверить, слова с ошибками и предложения по замене очередного неправильно написанного слова.
+
+[start=6]
+. Перетащите пять текстовых полей на форму ``MainForm`` . Три их них разместите на панелях прокрутки. Измените их следующим образом:
|===
|Текстовые поля
@@ -316,9 +336,15 @@
|tfSuggestions1 |Да |Нет
|===
-7. Перетащите индикатор выполнения на ``MainForm`` . Назовите переменную ``pbProgress`` .
-8. Перетащите две Кнопки на ``MainForm`` . Назовите первую кнопку ``btCheck`` и замените ее текст на "Проверить текст" или "Проверить правописание". Назовите вторую кнопку ``btNextWrongWord`` , измените ее текст на "Следующее слово с ошибкой" и сделайте ее неактивной.
-9. Перетащите несколько Ярлыков на ``MainForm`` , чтобы озаглавить ваше приложение и описать текстовые поля.
+
+[start=7]
+. Перетащите индикатор выполнения на ``MainForm`` . Назовите переменную ``pbProgress`` .
+
+[start=8]
+. Перетащите две Кнопки на ``MainForm`` . Назовите первую кнопку ``btCheck`` и замените ее текст на "Проверить текст" или "Проверить правописание". Назовите вторую кнопку ``btNextWrongWord`` , измените ее текст на "Следующее слово с ошибкой" и сделайте ее неактивной.
+
+[start=9]
+. Перетащите несколько Ярлыков на ``MainForm`` , чтобы озаглавить ваше приложение и описать текстовые поля.
Настройте внешний вид JFrame в соответствии с предпочтениям и сохраните его. Затем добавьте функциональные возможности клиента веб-службы.
@@ -332,15 +358,27 @@
link:http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl[+http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl+]. Примите параметры по умолчанию и нажмите кнопку "Готово". Используйте ту же процедуру, что и в разделе <<creatingtheclient,Создание клиента>>, начиная с пункта 2.
-2. Разверните 'Ссылки на веб-службы' и щелкните правой кнопкой мыши службу ``check`` . Откроется контекстное меню.
+
+[start=2]
+. Разверните 'Ссылки на веб-службы' и щелкните правой кнопкой мыши службу ``check`` . Откроется контекстное меню.
image::images/asynch-edit-ws-attrib.png[]
-3. В контекстном меню выберите "Правка атрибутов веб-службы". Откроется диалоговое окно "Атрибуты веб-службы".
-4. Перейдите на вкладку "Настройка WSDL".
-5. Разверните узел "Операции типа порта". Разверните узел *first* ``CheckTextBodyV2`` и выберите пункт "Включить асинхронный клиент".
+
+[start=3]
+. В контекстном меню выберите "Правка атрибутов веб-службы". Откроется диалоговое окно "Атрибуты веб-службы".
+
+[start=4]
+. Перейдите на вкладку "Настройка WSDL".
+
+[start=5]
+. Разверните узел "Операции типа порта". Разверните узел *first* ``CheckTextBodyV2`` и выберите пункт "Включить асинхронный клиент".
image::images/enable-async-client.png[]
-6. Нажмите кнопку "ОК". Диалоговое окно закроется, и появится предупреждение о том, что изменение атрибутов веб-службы приведет к обновлению узла клиента.
+
+[start=6]
+. Нажмите кнопку "ОК". Диалоговое окно закроется, и появится предупреждение о том, что изменение атрибутов веб-службы приведет к обновлению узла клиента.
image::images/asynch-refresh-node-warning.png[]
-7. Нажмите кнопку "ОК". Окно предупреждения закроется, и узел клиента будет обновлен. Если развернуть узел ``check`` в узле "Ссылки на веб-службы", появятся два варианта работы ``CheckTextBody`` : "Опрос" и "Обратный вызов".
+
+[start=7]
+. Нажмите кнопку "ОК". Окно предупреждения закроется, и узел клиента будет обновлен. Если развернуть узел ``check`` в узле "Ссылки на веб-службы", появятся два варианта работы ``CheckTextBody`` : "Опрос" и "Обратный вызов".
image::images/asynch-ws-refs.png[]
Теперь для приложения включены асинхронные клиенты веб-службы SpellCheck.
@@ -362,8 +400,12 @@
}
----
-2. В окне 'Проекты' разверните узел 'Ссылки на веб-службы' ``AsynchSpellCheckClient`` и найдите операцию ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` .
-3. Перетащите операцию ``CheckTextBodyV2 [Asynch Callback]`` в пустое тело метода ``callAsyncCallback`` . Создается следующий блок ``try`` . Сравните этот сгенерированный код с кодом, который генерируется для синхронных клиентов.
+
+[start=2]
+. В окне 'Проекты' разверните узел 'Ссылки на веб-службы' ``AsynchSpellCheckClient`` и найдите операцию ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` .
+
+[start=3]
+. Перетащите операцию ``CheckTextBodyV2 [Asynch Callback]`` в пустое тело метода ``callAsyncCallback`` . Создается следующий блок ``try`` . Сравните этот сгенерированный код с кодом, который генерируется для синхронных клиентов.
[source,java]
----
@@ -396,8 +438,12 @@
В этом коде, помимо вызова веб-службы, с помощью объекта ``AsynchHandler`` обрабатывается ответ от службы SpellCheck. В то же время объект ``Future`` проверяет, был ли возвращен результат, и приостанавливает работу потока до получения результата.
-4. Перейдите обратно к представлению проектирования. Дважды нажмите кнопку "Проверить правописание". При этом к кнопке автоматически добавляется действие ActionListener, и выполняется переход к представлению "Исходный код", причем курсор устанавливается в пустое тело метода ``btCheckActionPerformed`` .
-5. Добавьте следующий код к телу метода ``btCheckActionPerformed`` . Данный код получает текст, набираемый в поле ``tfYourText`` , отображает индикатор выполнения и сообщение "ожидание сервера", отключает кнопку ``btCheck`` и вызывает асинхронный метод с обратным вызовом.
+
+[start=4]
+. Перейдите обратно к представлению проектирования. Дважды нажмите кнопку "Проверить правописание". При этом к кнопке автоматически добавляется действие ActionListener, и выполняется переход к представлению "Исходный код", причем курсор устанавливается в пустое тело метода ``btCheckActionPerformed`` .
+
+[start=5]
+. Добавьте следующий код к телу метода ``btCheckActionPerformed`` . Данный код получает текст, набираемый в поле ``tfYourText`` , отображает индикатор выполнения и сообщение "ожидание сервера", отключает кнопку ``btCheck`` и вызывает асинхронный метод с обратным вызовом.
[source,java]
----
@@ -410,7 +456,9 @@
callAsyncCallback(text);*
}
----
-6. В начале класса ``MainForm`` используйте закрытое поле ``ActionListener`` с именем ``nextWord`` . Данный ``ActionListener`` предназначено для кнопки "Следующее слово с ошибкой", которая добавляет одно слово в список неправильно написанных слов и отображает возможные варианты его исправления. Создается частное поле, поэтому если действие ``ActionListener`` уже было определено, можно отменить его регистрацию. В противном случае каждый раз при проверке нового текста потребуется добавлять дополнительный прослушивающий процесс, что в свою очередь приведет к многократному вызову ``actionPerformed()`` . Приложение будет работать некорректно.
+
+[start=6]
+. В начале класса ``MainForm`` используйте закрытое поле ``ActionListener`` с именем ``nextWord`` . Данный ``ActionListener`` предназначено для кнопки "Следующее слово с ошибкой", которая добавляет одно слово в список неправильно написанных слов и отображает возможные варианты его исправления. Создается частное поле, поэтому если действие ``ActionListener`` уже было определено, можно отменить его регистрацию. В противном случае каждый раз при проверке нового текста потребуется добавлять дополнительный прослушивающий процесс, что в свою очередь приведет к многократному вызову ``actionPerformed()`` . Приложение будет работать некорректно.
[source,java]
----
@@ -420,7 +468,9 @@
private ActionListener nextWord;
...
----
-7. Замените весь метод ``callAsyncCallback`` следующим кодом. Обратите внимание, что крайний снаружи блок ``try`` удален. В нем нет необходимости, поскольку внутри метода добавлены более конкретные блоки ``try`` . Другие изменения в коде объяснены в комментариях к коду.
+
+[start=7]
+. Замените весь метод ``callAsyncCallback`` следующим кодом. Обратите внимание, что крайний снаружи блок ``try`` удален. В нем нет необходимости, поскольку внутри метода добавлены более конкретные блоки ``try`` . Другие изменения в коде объяснены в комментариях к коду.
[source,java]
----
@@ -570,7 +620,9 @@
}
}
----
-8. Нажмите Ctrl-Shift-I (⌘-Shift-I в Mac) и исправьте выражения импорта. Это приведет к добавлению следующих операторов импорта:
+
+[start=8]
+. Нажмите Ctrl-Shift-I (⌘-Shift-I в Mac) и исправьте выражения импорта. Это приведет к добавлению следующих операторов импорта:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/client_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/client_zh_CN.asciidoc
index 9acf35a..41cf17d 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/client_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/client_zh_CN.asciidoc
@@ -81,8 +81,12 @@
如果您处于防火墙的保护下,可能需要指定代理服务器,否则将无法下载 WSDL 文件。要指定代理服务器,请在向导中单击 "Set Proxy"(设置代理)。IDE 的 "Options"(选项)窗口将会打开,在此可为 IDE 设置普遍接受的代理。
-4. 将包名保留为空。默认情况下,将从 WSDL 中获取客户端类包名。在本例中为 ``com.cdyne.ws`` 。单击 "Finish"(完成)。
-5. 在 "Projects"(项目)窗口的 "Web Service References"(Web 服务引用)节点中,您将看到以下内容:
+
+[start=4]
+. 将包名保留为空。默认情况下,将从 WSDL 中获取客户端类包名。在本例中为 ``com.cdyne.ws`` 。单击 "Finish"(完成)。
+
+[start=5]
+. 在 "Projects"(项目)窗口的 "Web Service References"(Web 服务引用)节点中,您将看到以下内容:
image::images/ws-refs.png[title="显示 Web 服务引用的 "Projects"(项目)窗口"]
"Projects"(项目)窗口显示了一个名为 "check" 的 Web 服务,可以对应用程序执行多次 "CheckTextBody" 和 "CheckTextBodyV2" 操作。这些操作用于检查字符串是否存在拼写错误,并返回要由客户端处理的数据。该服务的 V2 版本不需要身份验证。在本教程中,将使用 ``checkSoap.CheckTextBodyV2`` 操作。
@@ -136,10 +140,16 @@
1. 在 "Projects"(项目)窗口中,右键单击 ``SpellCheckService`` 项目节点,选择 "New"(新建)> "Other"(其他),然后选择 "Web" > "Servlet"。单击 "Next"(下一步)以打开 "New Servlet"(新建 Servlet)向导。
2. 将 Servlet 命名为 ``SpellCheckServlet`` ,然后在 "Package"(包)下拉列表中键入 ``clientservlet`` 。单击 "Next"(下一步)。
image::images/name-servlet.png[]
-3. 在 "Configure Servlet Deployment"(配置 Servlet 部署)面板中,注意此 Servlet 的 URL 映射是 ``/SpellCheckServlet`` 。接受默认值,然后单击 "Finish"(完成)。该 Servlet 将在源代码编辑器中打开。
+
+[start=3]
+. 在 "Configure Servlet Deployment"(配置 Servlet 部署)面板中,注意此 Servlet 的 URL 映射是 ``/SpellCheckServlet`` 。接受默认值,然后单击 "Finish"(完成)。该 Servlet 将在源代码编辑器中打开。
image::images/jaxwsc-servlet.png[]
-4. 将光标置于源代码编辑器中的 ``SpellCheckServlet.java`` 的 ``processRequest`` 方法主体内,并在该方法的顶部添加一些新行。
-5. 右键单击上一步所创建的空白区域,然后选择 "Insert Code"(插入代码)> "Call Web Service Operation"(调用 Web 服务操作)。在 "Select Operation to Invoke"(选择要调用的操作)对话框中,单击 ``checkSoap.CheckTextBodyV2`` 操作,如下所示:
+
+[start=4]
+. 将光标置于源代码编辑器中的 ``SpellCheckServlet.java`` 的 ``processRequest`` 方法主体内,并在该方法的顶部添加一些新行。
+
+[start=5]
+. 右键单击上一步所创建的空白区域,然后选择 "Insert Code"(插入代码)> "Call Web Service Operation"(调用 Web 服务操作)。在 "Select Operation to Invoke"(选择要调用的操作)对话框中,单击 ``checkSoap.CheckTextBodyV2`` 操作,如下所示:
image::images/insert-ws-ops.png[title="显示 Web 服务引用的 "Projects"(项目)窗口"]
单击 "OK"(确定)。
@@ -165,7 +175,9 @@
*@WebServiceRef(wsdlLocation = "http://wsf.cdyne.com/SpellChecker/check.asmx?WSDL")
private Check service;*
----
-6. 将 ``processRequest()`` 方法的 ``try`` 块替换为以下代码。以下代码行中的注释说明了每行代码的用途。
+
+[start=6]
+. 将 ``processRequest()`` 方法的 ``try`` 块替换为以下代码。以下代码行中的注释说明了每行代码的用途。
[source,html]
----
@@ -235,7 +247,9 @@
}
----
-7. 您会看到许多错误线和警告图标,指示未找到的类。要在粘贴代码之后修复导入,请按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键),或在任意位置单击鼠标右键,然后在打开的上下文菜单中选择 "Fix Imports"(修复导入)。(您可以选择要导入的 List 类。此处将接受默认的 java.util.List。)以下是已导入类的完整列表:
+
+[start=7]
+. 您会看到许多错误线和警告图标,指示未找到的类。要在粘贴代码之后修复导入,请按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键),或在任意位置单击鼠标右键,然后在打开的上下文菜单中选择 "Fix Imports"(修复导入)。(您可以选择要导入的 List 类。此处将接受默认的 java.util.List。)以下是已导入类的完整列表:
[source,java]
----
@@ -264,7 +278,9 @@
1. 右键单击项目节点,然后选择 "Run"(运行)。稍后,应用程序将部署并显示上一部分所编码的 Web 页。
2. 输入一些文本,确保其中的某些文本存在拼写错误:
image::images/jaxwsc-spellchecker-form.png[title="带有要检查文本的 JSP 页"]
-3. 单击 "Spell Check",然后查看结果:
+
+[start=3]
+. 单击 "Spell Check",然后查看结果:
image::images/jaxwsc-spellchecker-report.png[title="显示错误的拼写检查器报告"]
@@ -298,8 +314,12 @@
3. 将该窗体命名为 ``MainForm`` ,然后将其放置在包 ``org.me.forms`` 中。
4. 创建 JFrame 后,打开项目属性。在 "Run"(运行)类别中,将 ``MainForm`` 设置为主类。
image::images/asynch-main-class.png[]
-5. 在编辑器中,打开 ``MainForm.java`` 的 "Design"(设计)视图。在组件面板中,将三个滚动窗格拖放至 ``MainForm`` 中。定位滚动窗格并调整其大小。这些窗格将包含要进行检查所键入的文本、所有错误词语以及对某个错误词语提出的建议的文本字段。
-6. 将五个文本字段拖放至 ``MainForm`` 中。将其中的三个拖放至三个滚动窗格中。按如下方式对其进行修改:
+
+[start=5]
+. 在编辑器中,打开 ``MainForm.java`` 的 "Design"(设计)视图。在组件面板中,将三个滚动窗格拖放至 ``MainForm`` 中。定位滚动窗格并调整其大小。这些窗格将包含要进行检查所键入的文本、所有错误词语以及对某个错误词语提出的建议的文本字段。
+
+[start=6]
+. 将五个文本字段拖放至 ``MainForm`` 中。将其中的三个拖放至三个滚动窗格中。按如下方式对其进行修改:
|===
|文本字段
@@ -316,9 +336,15 @@
|tfSuggestions1 |Y |N
|===
-7. 将进度栏拖放至 ``MainForm`` 中。将该变量命名为 ``pbProgress`` 。
-8. 将两个按钮拖放至 ``MainForm`` 中。将第一个按钮命名为 ``btCheck`` ,并将其文本更改为 "Check Text" 或 "Check Spelling"。将第二个按钮命名为 ``btNextWrongWord`` ,将其文本更改为 "Next Wrong Word",然后禁用该按钮。
-9. 将一些标签拖放至 ``MainForm`` 中,为应用程序提供一个标题并描述文本字段。
+
+[start=7]
+. 将进度栏拖放至 ``MainForm`` 中。将该变量命名为 ``pbProgress`` 。
+
+[start=8]
+. 将两个按钮拖放至 ``MainForm`` 中。将第一个按钮命名为 ``btCheck`` ,并将其文本更改为 "Check Text" 或 "Check Spelling"。将第二个按钮命名为 ``btNextWrongWord`` ,将其文本更改为 "Next Wrong Word",然后禁用该按钮。
+
+[start=9]
+. 将一些标签拖放至 ``MainForm`` 中,为应用程序提供一个标题并描述文本字段。
将 JFrame 的外观按您喜欢的方式进行排列,然后进行保存。接下来将添加 Web 服务客户端功能。
@@ -332,15 +358,27 @@
link:http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl[+http://wsf.cdyne.com/SpellChecker/check.asmx?wsdl+]。接受所有默认值,然后单击 "Finish"(完成)。这与<<creatingtheclient,创建客户端>>中所述步骤 2 以后的过程相同。
-2. 展开 "Web Service References"(Web 服务引用)节点,然后右键单击 ``check`` 服务。上下文菜单打开。
+
+[start=2]
+. 展开 "Web Service References"(Web 服务引用)节点,然后右键单击 ``check`` 服务。上下文菜单打开。
image::images/asynch-edit-ws-attrib.png[]
-3. 从上下文菜单中选择 "Edit Web Service Attributes"(编辑 Web 服务属性)。“Web 服务属性”对话框打开。
-4. 选择 "WSDL Customization"(WSDL 定制”)签。
-5. 展开 "Port Type Operations"(端口类型操作)节点。展开*第一个* ``CheckTextBodyV2`` 节点并选择 "Enable Asynchronous Client"(启用异步客户端)。
+
+[start=3]
+. 从上下文菜单中选择 "Edit Web Service Attributes"(编辑 Web 服务属性)。“Web 服务属性”对话框打开。
+
+[start=4]
+. 选择 "WSDL Customization"(WSDL 定制”)签。
+
+[start=5]
+. 展开 "Port Type Operations"(端口类型操作)节点。展开*第一个* ``CheckTextBodyV2`` 节点并选择 "Enable Asynchronous Client"(启用异步客户端)。
image::images/enable-async-client.png[]
-6. 单击 "OK"(确定)。该对话框关闭,并出现一条警告,指出更改 Web 服务属性将会刷新客户端节点。
+
+[start=6]
+. 单击 "OK"(确定)。该对话框关闭,并出现一条警告,指出更改 Web 服务属性将会刷新客户端节点。
image::images/asynch-refresh-node-warning.png[]
-7. 单击 "OK"(确定)。该警告信息关闭,并刷新客户端节点。如果展开 "Web Service References"(Web 服务引用)中的 ``check`` 节点,则会看到现在已具有 ``CheckTextBody`` 操作的 "Polling"(轮询)和 "Callback"(回调)版本。
+
+[start=7]
+. 单击 "OK"(确定)。该警告信息关闭,并刷新客户端节点。如果展开 "Web Service References"(Web 服务引用)中的 ``check`` 节点,则会看到现在已具有 ``CheckTextBody`` 操作的 "Polling"(轮询)和 "Callback"(回调)版本。
image::images/asynch-ws-refs.png[]
现已为您的应用程序启用了 SpellCheck 服务的异步 Web 服务客户端。
@@ -362,8 +400,12 @@
}
----
-2. 在 "Projects"(项目)窗口中,展开 ``AsynchSpellCheckClient`` 的 "Web Service References"(Web 服务引用)节点,并找到 ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` 操作。
-3. 将 ``CheckTextBodyV2 [Asynch Callback]`` 操作拖至空的 ``callAsyncCallback`` 方法主体中。IDE 会生成以下 ``try`` 块。将此生成的代码与为同步客户端生成的代码进行比较。
+
+[start=2]
+. 在 "Projects"(项目)窗口中,展开 ``AsynchSpellCheckClient`` 的 "Web Service References"(Web 服务引用)节点,并找到 ``checkSoap.CheckTextBodyV2 [Asynch Callback]`` 操作。
+
+[start=3]
+. 将 ``CheckTextBodyV2 [Asynch Callback]`` 操作拖至空的 ``callAsyncCallback`` 方法主体中。IDE 会生成以下 ``try`` 块。将此生成的代码与为同步客户端生成的代码进行比较。
[source,java]
----
@@ -396,8 +438,12 @@
在此代码与 Web 服务调用中,您会看到来自 SpellCheck 服务的响应是通过 ``AsynchHandler`` 对象进行处理的。同时, ``Future`` 对象会查看是否已返回了结果,然后使线程休眠直至完全返回了结果。
-4. 切换回 "Design"(设计)视图。双击 "Check Spelling" 按钮。IDE 会自动将 "ActionListener" 添加到按钮中,然后切换到 "Source"(源)视图中,光标同时出现在空的 ``btCheckActionPerformed`` 方法中。
-5. 将以下代码添加至 ``btCheckActionPerformed`` 方法主体。此代码会获取您在 ``tfYourText`` 字段中键入的文本,使进度栏显示 "waiting for server" 消息,并禁用 ``btCheck`` 按钮,以及调用异步回调方法。
+
+[start=4]
+. 切换回 "Design"(设计)视图。双击 "Check Spelling" 按钮。IDE 会自动将 "ActionListener" 添加到按钮中,然后切换到 "Source"(源)视图中,光标同时出现在空的 ``btCheckActionPerformed`` 方法中。
+
+[start=5]
+. 将以下代码添加至 ``btCheckActionPerformed`` 方法主体。此代码会获取您在 ``tfYourText`` 字段中键入的文本,使进度栏显示 "waiting for server" 消息,并禁用 ``btCheck`` 按钮,以及调用异步回调方法。
[source,java]
----
@@ -410,7 +456,9 @@
callAsyncCallback(text);*
}
----
-6. 在 ``MainForm`` 类的开头,实例化名为 ``nextWord`` 的私有 ``ActionListener`` 字段。此 ``ActionListener`` 字段是为 Next Wrong Word 按钮提供的,使用该按钮可以前进到错误词语列表中的下一个错误词语,并显示该词语以及更正它的建议。您可以在此处创建私有字段,这样就可以在定义了 ``ActionListener`` 的情况下取消对其的注册。否则,每次检查新文本时,都将添加一个额外的监听程序并最终出现多个监听程序多次调用 ``actionPerformed()`` 的情况。这样,该应用程序将无法正常运行。
+
+[start=6]
+. 在 ``MainForm`` 类的开头,实例化名为 ``nextWord`` 的私有 ``ActionListener`` 字段。此 ``ActionListener`` 字段是为 Next Wrong Word 按钮提供的,使用该按钮可以前进到错误词语列表中的下一个错误词语,并显示该词语以及更正它的建议。您可以在此处创建私有字段,这样就可以在定义了 ``ActionListener`` 的情况下取消对其的注册。否则,每次检查新文本时,都将添加一个额外的监听程序并最终出现多个监听程序多次调用 ``actionPerformed()`` 的情况。这样,该应用程序将无法正常运行。
[source,java]
----
@@ -420,7 +468,9 @@
private ActionListener nextWord;
...
----
-7. 将整个 ``callAsyncCallback`` 方法替换为以下代码。请注意,最外层的 ``try`` 块已删除。此代码块是多余的,因为已在方法内添加了更多特定的 ``try`` 块。并且在代码注释中介绍了对代码所做的其他更改。
+
+[start=7]
+. 将整个 ``callAsyncCallback`` 方法替换为以下代码。请注意,最外层的 ``try`` 块已删除。此代码块是多余的,因为已在方法内添加了更多特定的 ``try`` 块。并且在代码注释中介绍了对代码所做的其他更改。
[source,java]
----
@@ -570,7 +620,9 @@
}
}
----
-8. 按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)并修复导入。这样会添加以下 import 语句:
+
+[start=8]
+. 按 Ctrl-Shift-I 组合键(在 Mac 上按 ⌘-Shift-I 组合键)并修复导入。这样会添加以下 import 语句:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws.asciidoc
index 59afe96..371b3e5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws.asciidoc
@@ -42,16 +42,15 @@
3. => Coding and Testing the Web Service
4. link:./flower_wsdl_schema.html[+ Modifying the Schema and WSDL Files to Pass Binary Data+]
5. link:./flower_swing.html[+ Creating the Swing Client+]
+6. <<coding-ws,Coding the Web Service>>
+7. <<retrieve-jpeg-as-bytes,Get a JPEG File as an Array of Bytes>>
+8. <<read-bytes-as-image,Read an Array of Bytes as an Image>>
+9. <<implement-getflower,Implement getFlower>>
+10. <<create-byte-array-list,Create a List of Byte Arrays for All JPEG Files>>
+11. <<implement-getthumbnails,Implement getThumbnails>>
-
-1. <<coding-ws,Coding the Web Service>>
-
-1. <<retrieve-jpeg-as-bytes,Get a JPEG File as an Array of Bytes>>
-2. <<read-bytes-as-image,Read an Array of Bytes as an Image>>
-3. <<implement-getflower,Implement getFlower>>
-4. <<create-byte-array-list,Create a List of Byte Arrays for All JPEG Files>>
-5. <<implement-getthumbnails,Implement getThumbnails>>
-2. <<test-ws,Testing the Web Service>>
+[start=2]
+. <<test-ws,Testing the Web Service>>
[[coding-ws]]
@@ -75,10 +74,16 @@
return getBytes(resource);
}
----
-2. A warning appears that the IDE cannot find the class ``URL`` . Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` , either manually or by pressing Ctrl-Shift-I (⌘-Shift-I on Mac).
-3. A new warning appears. The warning states that the IDE cannot find the ``getBytes`` method. Left-click the warning icon and click the tip to create the ``getBytes`` method.
+
+[start=2]
+. A warning appears that the IDE cannot find the class ``URL`` . Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` , either manually or by pressing Ctrl-Shift-I (⌘-Shift-I on Mac).
+
+[start=3]
+. A new warning appears. The warning states that the IDE cannot find the ``getBytes`` method. Left-click the warning icon and click the tip to create the ``getBytes`` method.
image::images/create-method-tip.png[]
-4. The editor focuses on the ``getBytes`` method you just created. Add the following code to the method. This code link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+opens a connection to the URL+] you passed from the ``getFlowerBytes`` method and returns an ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` . The code then reads the input stream 1024 bytes at a time, stores the bytes in a byte array buffer, and writes from the buffer to a ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` .
+
+[start=4]
+. The editor focuses on the ``getBytes`` method you just created. Add the following code to the method. This code link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+opens a connection to the URL+] you passed from the ``getFlowerBytes`` method and returns an ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` . The code then reads the input stream 1024 bytes at a time, stores the bytes in a byte array buffer, and writes from the buffer to a ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` .
[source,java]
----
@@ -93,7 +98,9 @@
return bos.toByteArray();
}
----
-5. Add import statements for ``java.io.InputStream`` and ``java.io.ByteArrayOutputStream`` .
+
+[start=5]
+. Add import statements for ``java.io.InputStream`` and ``java.io.ByteArrayOutputStream`` .
[[read-bytes-as-image]]
@@ -109,42 +116,54 @@
private Image getImage(byte[] bytes, boolean isThumbnail) throws IOException {
}
----
-2. In the ``getImage`` method body, add a line that creates a ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` from the byte array that the method takes as a parameter.
+
+[start=2]
+. In the ``getImage`` method body, add a line that creates a ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` from the byte array that the method takes as a parameter.
[source,java]
----
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
----
-3. Add a line that creates an ``Object`` from the ``ByteArrayInputStream`` .
+
+[start=3]
+. Add a line that creates an ``Object`` from the ``ByteArrayInputStream`` .
[source,java]
----
Object source = bis;
----
-4. Add a line that creates an ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` from the generic ``Object`` .
+
+[start=4]
+. Add a line that creates an ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` from the generic ``Object`` .
[source,java]
----
ImageInputStream iis = ImageIO.createImageInputStream(source);
----
-5. Add a line that creates an ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` of all currently registered ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` s that can decode JPEG files.
+
+[start=5]
+. Add a line that creates an ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` of all currently registered ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` s that can decode JPEG files.
[source,java]
----
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg");
----
-6. Add a line that creates an ``ImageReader`` from the next element in the ``Iterator`` .
+
+[start=6]
+. Add a line that creates an ``ImageReader`` from the next element in the ``Iterator`` .
[source,java]
----
ImageReader reader = (ImageReader) readers.next();
----
-7. Add lines that create default link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+image read parameters+] but add 1-in-4 link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+subsampling+] to the image read parameters if the ``Image`` represents a thumbnail.
+
+[start=7]
+. Add lines that create default link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+image read parameters+] but add 1-in-4 link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+subsampling+] to the image read parameters if the ``Image`` represents a thumbnail.
[source,java]
----
@@ -154,7 +173,9 @@
param.setSourceSubsampling(4, 4, 0, 0);
}
----
-8. Lastly, add code that uses the ``ImageReader`` object to read the ``ImageInputStream`` object and to return an ``Image`` based on that object and the image read parameters.
+
+[start=8]
+. Lastly, add code that uses the ``ImageReader`` object to read the ``ImageInputStream`` object and to return an ``Image`` based on that object and the image read parameters.
[source,java]
----
@@ -162,7 +183,9 @@
reader.setInput(iis, true);
return reader.read(0, param);
----
-9. Press Ctrl-Shift-I (⌘-Shift-I on MacOS). The Fix All Imports dialog opens. Accept the default suggestions of the Fix All Imports dialog and click OK.
+
+[start=9]
+. Press Ctrl-Shift-I (⌘-Shift-I on MacOS). The Fix All Imports dialog opens. Accept the default suggestions of the Fix All Imports dialog and click OK.
image::images/fix-getimage-imports.png[]
The ``getImage`` method is now complete.
@@ -214,7 +237,9 @@
private static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-2. Add a method that creates an ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` and adds a byte array for every flower to the ``List`` .
+
+[start=2]
+. Add a method that creates an ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` and adds a byte array for every flower to the ``List`` .
[source,java]
----
@@ -228,7 +253,9 @@
return flowers;
}
----
-3. Add import statements for ``java.util.ArrayList`` and ``java.util.List`` .
+
+[start=3]
+. Add import statements for ``java.util.ArrayList`` and ``java.util.List`` .
[[implement-getthumbnails]]
@@ -334,13 +361,21 @@
*Important:* The GlassFish Server Open Source Edition must be Version 3.1 or later.
image::images/deployed-service.png[]
-2. Expand the project's Web Services node. Right-click the FlowerService and select Test Web Service.
+
+[start=2]
+. Expand the project's Web Services node. Right-click the FlowerService and select Test Web Service.
image::images/test-ws-node.png[]
-3. The web service tester opens in your browser. Type "rose" in the ``getFlower`` parameter field.
+
+[start=3]
+. The web service tester opens in your browser. Type "rose" in the ``getFlower`` parameter field.
image::images/ws-tester.png[]
-4. Press the ``getFlower`` button. The IDE shows you information about the invocation in the browser. When you look at the "Method Returned", you see that it is garbled. You want to see an image, not a series of symbols. However, since ``java.awt.Image`` is not a valid schema type, you need to manually configure the schema file to return binary image/jpeg data. You will do this in the next tutorial.
+
+[start=4]
+. Press the ``getFlower`` button. The IDE shows you information about the invocation in the browser. When you look at the "Method Returned", you see that it is garbled. You want to see an image, not a series of symbols. However, since ``java.awt.Image`` is not a valid schema type, you need to manually configure the schema file to return binary image/jpeg data. You will do this in the next tutorial.
image::images/ws-tester-badschema.png[]
-5.
+
+[start=5]
+.
== Next step:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ja.asciidoc
index 1d82af3..d082bd5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ja.asciidoc
@@ -42,16 +42,15 @@
3. => Webサービスのコーディングおよびテスト
4. link:./flower_wsdl_schema.html[+バイナリ・データを渡すためのスキーマとWSDLファイルの変更+]
5. link:./flower_swing.html[+Swingクライアントの作成+]
+6. <<coding-ws,Webサービスのコーディング>>
+7. <<retrieve-jpeg-as-bytes,JPEGファイルをバイト配列として取得>>
+8. <<read-bytes-as-image,バイト配列をイメージとして読み取る>>
+9. <<implement-getflower,getFlowerの実装>>
+10. <<create-byte-array-list,すべてのJPEGファイルのバイト配列のリストの作成>>
+11. <<implement-getthumbnails,getThumbnailsの実装>>
-
-1. <<coding-ws,Webサービスのコーディング>>
-
-1. <<retrieve-jpeg-as-bytes,JPEGファイルをバイト配列として取得>>
-2. <<read-bytes-as-image,バイト配列をイメージとして読み取る>>
-3. <<implement-getflower,getFlowerの実装>>
-4. <<create-byte-array-list,すべてのJPEGファイルのバイト配列のリストの作成>>
-5. <<implement-getthumbnails,getThumbnailsの実装>>
-2. <<test-ws,Webサービスのテスト>>
+[start=2]
+. <<test-ws,Webサービスのテスト>>
[[coding-ws]]
@@ -75,10 +74,16 @@
return getBytes(resource);
}
----
-2. IDEがクラス ``URL`` を見つけられないことを示す警告が表示されます。 ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` のインポート文を、手動で追加するか、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押して追加します。
-3. 新しい警告が表示されます。この警告は、IDEが ``getBytes`` メソッドを見つけられないことを示します。警告アイコンを左クリックし、ヒントをクリックして ``getBytes`` メソッドを作成します。
+
+[start=2]
+. IDEがクラス ``URL`` を見つけられないことを示す警告が表示されます。 ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` のインポート文を、手動で追加するか、[Ctrl]-[Shift]-[I] (Macの場合は[⌘]-[Shift]-[I])を押して追加します。
+
+[start=3]
+. 新しい警告が表示されます。この警告は、IDEが ``getBytes`` メソッドを見つけられないことを示します。警告アイコンを左クリックし、ヒントをクリックして ``getBytes`` メソッドを作成します。
image::images/create-method-tip.png[]
-4. 作成したばかりの ``getBytes`` メソッドがエディタでフォーカスされます。メソッドに次のコードを追加します。このコードは、 ``getFlowerBytes`` メソッドから渡したlink:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+URLへの接続を開き+]、 ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` を返します。次に、1024バイトごとに入力ストリームを読み取り、そのバイトをバイト配列バッファに保存して、バッファから ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` に書き込みます。
+
+[start=4]
+. 作成したばかりの ``getBytes`` メソッドがエディタでフォーカスされます。メソッドに次のコードを追加します。このコードは、 ``getFlowerBytes`` メソッドから渡したlink:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+URLへの接続を開き+]、 ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` を返します。次に、1024バイトごとに入力ストリームを読み取り、そのバイトをバイト配列バッファに保存して、バッファから ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` に書き込みます。
[source,java]
----
@@ -93,7 +98,9 @@
return bos.toByteArray();
}
----
-5. ``java.io.InputStream`` と ``java.io.ByteArrayOutputStream`` のインポート文を追加します。
+
+[start=5]
+. ``java.io.InputStream`` と ``java.io.ByteArrayOutputStream`` のインポート文を追加します。
[[read-bytes-as-image]]
@@ -109,42 +116,54 @@
private Image getImage(byte[] bytes, boolean isThumbnail) throws IOException {
}
----
-2. ``getImage`` メソッドの本文で、このメソッドがパラメータとして取得するバイト配列から ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` を作成する行を追加します。
+
+[start=2]
+. ``getImage`` メソッドの本文で、このメソッドがパラメータとして取得するバイト配列から ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` を作成する行を追加します。
[source,java]
----
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
----
-3. ``ByteArrayInputStream`` から ``Object`` を作成する行を追加します。
+
+[start=3]
+. ``ByteArrayInputStream`` から ``Object`` を作成する行を追加します。
[source,java]
----
Object source = bis;
----
-4. 汎用の ``Object`` から ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` を作成する行を追加します。
+
+[start=4]
+. 汎用の ``Object`` から ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` を作成する行を追加します。
[source,java]
----
ImageInputStream iis = ImageIO.createImageInputStream(source);
----
-5. JPEGファイルのデコードが可能な、現在登録されているすべての ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` から ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` を作成する行を追加します。
+
+[start=5]
+. JPEGファイルのデコードが可能な、現在登録されているすべての ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` から ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` を作成する行を追加します。
[source,java]
----
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg");
----
-6. ``Iterator`` の次の要素から ``ImageReader`` を作成する行を追加します。
+
+[start=6]
+. ``Iterator`` の次の要素から ``ImageReader`` を作成する行を追加します。
[source,java]
----
ImageReader reader = (ImageReader) readers.next();
----
-7. デフォルトのlink:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+イメージ読取りパラメータ+]を作成する行を追加します(ただし、 ``Image`` がサムネイルを表す場合はイメージ読取りパラメータに4対1のlink:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+サブサンプリング処理+]を追加)。
+
+[start=7]
+. デフォルトのlink:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+イメージ読取りパラメータ+]を作成する行を追加します(ただし、 ``Image`` がサムネイルを表す場合はイメージ読取りパラメータに4対1のlink:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+サブサンプリング処理+]を追加)。
[source,java]
----
@@ -154,7 +173,9 @@
param.setSourceSubsampling(4, 4, 0, 0);
}
----
-8. 最後に、 ``ImageReader`` オブジェクトを使用して ``ImageInputStream`` オブジェクトを読み取り、そのオブジェクトに基づく ``Image`` とイメージ読取りパラメータを返すコードを追加します。
+
+[start=8]
+. 最後に、 ``ImageReader`` オブジェクトを使用して ``ImageInputStream`` オブジェクトを読み取り、そのオブジェクトに基づく ``Image`` とイメージ読取りパラメータを返すコードを追加します。
[source,java]
----
@@ -162,7 +183,9 @@
reader.setInput(iis, true);
return reader.read(0, param);
----
-9. [Ctrl]-[Shift]-[I] (MacOSの場合は[⌘]-[Shift]-[I])を押します。「すべてのインポートを修正」ダイアログが開きます。「すべてのインポートを修正」のデフォルトの修正候補をすべて受け入れ、「OK」をクリックします。
+
+[start=9]
+. [Ctrl]-[Shift]-[I] (MacOSの場合は[⌘]-[Shift]-[I])を押します。「すべてのインポートを修正」ダイアログが開きます。「すべてのインポートを修正」のデフォルトの修正候補をすべて受け入れ、「OK」をクリックします。
image::images/fix-getimage-imports.png[]
これで ``getImage`` メソッドは完成です。
@@ -214,7 +237,9 @@
private static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-2. ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` を作成し、すべての花のバイト配列を ``List`` に追加するメソッドを追加します。
+
+[start=2]
+. ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` を作成し、すべての花のバイト配列を ``List`` に追加するメソッドを追加します。
[source,java]
----
@@ -228,7 +253,9 @@
return flowers;
}
----
-3. ``java.util.ArrayList`` と ``java.util.List`` のインポート文を追加します。
+
+[start=3]
+. ``java.util.ArrayList`` と ``java.util.List`` のインポート文を追加します。
[[implement-getthumbnails]]
@@ -334,13 +361,21 @@
*重要: *GlassFish Server Open Source Editionはバージョン3.1以降である必要があります。
image::images/deployed-service.png[]
-2. プロジェクトの「Webサービス」ノードを展開します。「FlowerService」を右クリックし、「Webサービスをテスト」を選択します。
+
+[start=2]
+. プロジェクトの「Webサービス」ノードを展開します。「FlowerService」を右クリックし、「Webサービスをテスト」を選択します。
image::images/test-ws-node.png[]
-3. Webサービスのテスト・ページがブラウザで開きます。「 ``getFlower`` 」パラメータ・フィールドに「rose」と入力します。
+
+[start=3]
+. Webサービスのテスト・ページがブラウザで開きます。「 ``getFlower`` 」パラメータ・フィールドに「rose」と入力します。
image::images/ws-tester.png[]
-4. 「 ``getFlower`` 」ボタンを押します。IDEが、この呼出しに関する情報をブラウザに表示します。「Method Returned」を見ると、中身が文字化けしていることがわかります。見たいのは記号の羅列ではなく、イメージです。しかし、 ``java.awt.Image`` は有効なスキーマ・タイプではないため、バイナリのimage/jpegデータを返すようにスキーマ・ファイルを手動で構成する必要があります。これは、次のチュートリアルで行います。
+
+[start=4]
+. 「 ``getFlower`` 」ボタンを押します。IDEが、この呼出しに関する情報をブラウザに表示します。「Method Returned」を見ると、中身が文字化けしていることがわかります。見たいのは記号の羅列ではなく、イメージです。しかし、 ``java.awt.Image`` は有効なスキーマ・タイプではないため、バイナリのimage/jpegデータを返すようにスキーマ・ファイルを手動で構成する必要があります。これは、次のチュートリアルで行います。
image::images/ws-tester-badschema.png[]
-5.
+
+[start=5]
+.
== 次の手順:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_pt_BR.asciidoc
index a64f1ef..47b7474 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_pt_BR.asciidoc
@@ -42,16 +42,15 @@
3. => Codificando e Testando o Web Service
4. link:./flower_wsdl_schema.html[+ Modificando o Esquema e os Arquivos WSDL para Passar Dados Binários+]
5. link:./flower_swing.html[+ Criando o Cliente Swing+]
+6. <<coding-ws,Codificando o Web Service>>
+7. <<retrieve-jpeg-as-bytes,Obter um Arquivo JPEG como um Array de Bytes>>
+8. <<read-bytes-as-image,Ler um Array de Bytes como uma Imagem>>
+9. <<implement-getflower,Implementar getFlower>>
+10. <<create-byte-array-list,Criar uma Lista de Arrays de Bytes para Todos os Arquivos JPEG>>
+11. <<implement-getthumbnails,Implementar getThumbnails>>
-
-1. <<coding-ws,Codificando o Web Service>>
-
-1. <<retrieve-jpeg-as-bytes,Obter um Arquivo JPEG como um Array de Bytes>>
-2. <<read-bytes-as-image,Ler um Array de Bytes como uma Imagem>>
-3. <<implement-getflower,Implementar getFlower>>
-4. <<create-byte-array-list,Criar uma Lista de Arrays de Bytes para Todos os Arquivos JPEG>>
-5. <<implement-getthumbnails,Implementar getThumbnails>>
-2. <<test-ws,Testando o Web Service>>
+[start=2]
+. <<test-ws,Testando o Web Service>>
[[coding-ws]]
@@ -75,10 +74,16 @@
return getBytes(resource);
}
----
-2. Será exibida uma advertência informando que o IDE não consegue encontrar o ``URL`` da classe. Adicione uma instrução de importação para o ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` manualmente ou pressionando Ctrl-Shift-I (⌘-Shift-I no Mac).
-3. Uma nova advertência será exibida. A advertência afirma que o IDE não pode encontrar o método ``getBytes`` . Clique com o botão esquerdo do mouse no ícone de advertência e clique na dica para criar o método ``getBytes`` .
+
+[start=2]
+. Será exibida uma advertência informando que o IDE não consegue encontrar o ``URL`` da classe. Adicione uma instrução de importação para o ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` manualmente ou pressionando Ctrl-Shift-I (⌘-Shift-I no Mac).
+
+[start=3]
+. Uma nova advertência será exibida. A advertência afirma que o IDE não pode encontrar o método ``getBytes`` . Clique com o botão esquerdo do mouse no ícone de advertência e clique na dica para criar o método ``getBytes`` .
image::images/create-method-tip.png[]
-4. O editor se concentra no método ``getBytes`` que você acabou de criar. Adicione o código a seguir ao método. Esse código link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+abre uma conexão para o URL+] que obtido do método ``getFlowerBytes`` e retorna um ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` . Em seguida, o código lê o fluxo de entrada 1024 bytes por vez, armazena os bytes em um buffer de array de bytes e grava do buffer em um ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` .
+
+[start=4]
+. O editor se concentra no método ``getBytes`` que você acabou de criar. Adicione o código a seguir ao método. Esse código link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+abre uma conexão para o URL+] que obtido do método ``getFlowerBytes`` e retorna um ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` . Em seguida, o código lê o fluxo de entrada 1024 bytes por vez, armazena os bytes em um buffer de array de bytes e grava do buffer em um ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` .
[source,java]
----
@@ -93,7 +98,9 @@
return bos.toByteArray();
}
----
-5. Adicione instruções importantes para ``java.io.InputStream`` e ``java.io.ByteArrayOutputStream`` .
+
+[start=5]
+. Adicione instruções importantes para ``java.io.InputStream`` e ``java.io.ByteArrayOutputStream`` .
[[read-bytes-as-image]]
@@ -109,42 +116,54 @@
private Image getImage(byte[] bytes, boolean isThumbnail) throws IOException {
}
----
-2. No corpo do método ``getImage`` , adicione uma linha que crie um ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` do array de bytes que o método utiliza como parâmetro.
+
+[start=2]
+. No corpo do método ``getImage`` , adicione uma linha que crie um ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` do array de bytes que o método utiliza como parâmetro.
[source,java]
----
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
----
-3. Adicione uma linha que crie um ``Object`` do ``ByteArrayInputStream`` .
+
+[start=3]
+. Adicione uma linha que crie um ``Object`` do ``ByteArrayInputStream`` .
[source,java]
----
Object source = bis;
----
-4. Adicione uma linha que crie uma ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` do ``Object`` genérico.
+
+[start=4]
+. Adicione uma linha que crie uma ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` do ``Object`` genérico.
[source,java]
----
ImageInputStream iis = ImageIO.createImageInputStream(source);
----
-5. Adicione uma linha que crie um ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` de todos os ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` atualmente registrados que podem decodificar arquivos JPEG.
+
+[start=5]
+. Adicione uma linha que crie um ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` de todos os ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` atualmente registrados que podem decodificar arquivos JPEG.
[source,java]
----
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg");
----
-6. Adicione uma linha que crie um ``ImageReader`` do próximo elemento do ``Iterator`` .
+
+[start=6]
+. Adicione uma linha que crie um ``ImageReader`` do próximo elemento do ``Iterator`` .
[source,java]
----
ImageReader reader = (ImageReader) readers.next();
----
-7. Adicione linhas que criem link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+parâmetros de leitura de imagem+] default, mas adicione 1 em 4 link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+subamostragem+] aos parâmetros de leitura da imagem se a ``Image`` representar uma miniatura.
+
+[start=7]
+. Adicione linhas que criem link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+parâmetros de leitura de imagem+] default, mas adicione 1 em 4 link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+subamostragem+] aos parâmetros de leitura da imagem se a ``Image`` representar uma miniatura.
[source,java]
----
@@ -154,7 +173,9 @@
param.setSourceSubsampling(4, 4, 0, 0);
}
----
-8. Por último, adicione o código que utiliza o objeto ``ImageReader`` para ler o objeto ``ImageInputStream`` e retornar uma ``Image`` com base nesse objeto e nos parâmetros de leitura da imagem.
+
+[start=8]
+. Por último, adicione o código que utiliza o objeto ``ImageReader`` para ler o objeto ``ImageInputStream`` e retornar uma ``Image`` com base nesse objeto e nos parâmetros de leitura da imagem.
[source,java]
----
@@ -162,7 +183,9 @@
reader.setInput(iis, true);
return reader.read(0, param);
----
-9. Pressione Ctrl-Shift-I (⌘-Shift-I no MacOS). A caixa de diálogo Corrigir Todas as Importações será aberta. Aceite as sugestões default da caixa de diálogo Corrigir todas as Importações e clique em OK.
+
+[start=9]
+. Pressione Ctrl-Shift-I (⌘-Shift-I no MacOS). A caixa de diálogo Corrigir Todas as Importações será aberta. Aceite as sugestões default da caixa de diálogo Corrigir todas as Importações e clique em OK.
image::images/fix-getimage-imports.png[]
O método ``getImage`` agora está concluído.
@@ -214,7 +237,9 @@
private static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-2. Adicione um método que crie uma ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` e que adicione um array de bytes para cada flor à ``List`` .
+
+[start=2]
+. Adicione um método que crie uma ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` e que adicione um array de bytes para cada flor à ``List`` .
[source,java]
----
@@ -228,7 +253,9 @@
return flowers;
}
----
-3. Adicione instruções de importação para ``java.util.ArrayList`` e ``java.util.List`` .
+
+[start=3]
+. Adicione instruções de importação para ``java.util.ArrayList`` e ``java.util.List`` .
[[implement-getthumbnails]]
@@ -334,13 +361,21 @@
*Importante:* é necessária a Versão 3.1 ou posterior do GlassFish Server Open Source Edition.
image::images/deployed-service.png[]
-2. Expanda o nó Web Services do projeto. Clique com o botão direito do mouse em FlowerService e selecione Testar Web Service.
+
+[start=2]
+. Expanda o nó Web Services do projeto. Clique com o botão direito do mouse em FlowerService e selecione Testar Web Service.
image::images/test-ws-node.png[]
-3. O testador do Web service será aberto no browser. Digite "rosa" no campo do parâmetro de ``getFlower`` .
+
+[start=3]
+. O testador do Web service será aberto no browser. Digite "rosa" no campo do parâmetro de ``getFlower`` .
image::images/ws-tester.png[]
-4. Pressione o botão ``getFlower`` . O IDE mostrará as informações sobre o chamado no browser. Ao observar o "Método Retornado", você verá que ele está truncado. Você deseja ver uma imagem, não uma série de símbolos. Entretanto, já que ``java.awt.Image`` não é um tipo de esquema válido, você precisa configurar manualmente o arquivo do esquema para retornar dados image/jpeg binários. Você fará isso no próximo tutorial.
+
+[start=4]
+. Pressione o botão ``getFlower`` . O IDE mostrará as informações sobre o chamado no browser. Ao observar o "Método Retornado", você verá que ele está truncado. Você deseja ver uma imagem, não uma série de símbolos. Entretanto, já que ``java.awt.Image`` não é um tipo de esquema válido, você precisa configurar manualmente o arquivo do esquema para retornar dados image/jpeg binários. Você fará isso no próximo tutorial.
image::images/ws-tester-badschema.png[]
-5.
+
+[start=5]
+.
== Próxima etapa:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ru.asciidoc
index ed79b7f..3b823fb 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_ru.asciidoc
@@ -42,16 +42,15 @@
3. => Написание кода веб-службы и ее тестирование
4. link:./flower_wsdl_schema.html[+ Изменение файлов схемы и WSDL для передачи двоичных данных+]
5. link:./flower_swing.html[+ Создание клиента Swing+]
+6. <<coding-ws,Создание кода веб-службы>>
+7. <<retrieve-jpeg-as-bytes,Получение файла JPEG в виде массива байтов>>
+8. <<read-bytes-as-image,Чтение массива байтов как изображения>>
+9. <<implement-getflower,Реализация метода getFlower>>
+10. <<create-byte-array-list,Создание списка массивов байтов для всех файлов JPEG>>
+11. <<implement-getthumbnails,Реализация метода getThumbnails>>
-
-1. <<coding-ws,Создание кода веб-службы>>
-
-1. <<retrieve-jpeg-as-bytes,Получение файла JPEG в виде массива байтов>>
-2. <<read-bytes-as-image,Чтение массива байтов как изображения>>
-3. <<implement-getflower,Реализация метода getFlower>>
-4. <<create-byte-array-list,Создание списка массивов байтов для всех файлов JPEG>>
-5. <<implement-getthumbnails,Реализация метода getThumbnails>>
-2. <<test-ws,Тестирование веб-службы>>
+[start=2]
+. <<test-ws,Тестирование веб-службы>>
[[coding-ws]]
@@ -75,10 +74,16 @@
return getBytes(resource);
}
----
-2. Появится предупреждение о том, что среде IDE не удается найти ``URL-адрес`` . Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` , вручную или путем нажатия Ctrl-Shift-I (⌘-Shift-I в Mac).
-3. Появится новое предупреждение. В предупреждении сообщается о том, что среде IDE не удается найти метод ``getBytes`` . Щелкните значок предупреждения левой кнопкой мыши и щелкните всплывающую подсказку для создания метода ``getBytes`` .
+
+[start=2]
+. Появится предупреждение о том, что среде IDE не удается найти ``URL-адрес`` . Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` , вручную или путем нажатия Ctrl-Shift-I (⌘-Shift-I в Mac).
+
+[start=3]
+. Появится новое предупреждение. В предупреждении сообщается о том, что среде IDE не удается найти метод ``getBytes`` . Щелкните значок предупреждения левой кнопкой мыши и щелкните всплывающую подсказку для создания метода ``getBytes`` .
image::images/create-method-tip.png[]
-4. В окне редактора будет выполнен переход к только что созданному методу ``getBytes`` . Добавьте в метод следующий код. Этот код служит для link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+установки подключения к URL-адресу+], переданному от метода ``getFlowerBytes`` , и возврата элемента ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` . Затем код считывает входной поток порциями по 1024 байта, сохраняет байты в буфере массива данных и записывает ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` на основе содержимого буфера.
+
+[start=4]
+. В окне редактора будет выполнен переход к только что созданному методу ``getBytes`` . Добавьте в метод следующий код. Этот код служит для link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+установки подключения к URL-адресу+], переданному от метода ``getFlowerBytes`` , и возврата элемента ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` . Затем код считывает входной поток порциями по 1024 байта, сохраняет байты в буфере массива данных и записывает ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` на основе содержимого буфера.
[source,java]
----
@@ -93,7 +98,9 @@
return bos.toByteArray();
}
----
-5. Добавьте операторы импорта для ``java.io.InputStream`` и ``java.io.ByteArrayOutputStream`` .
+
+[start=5]
+. Добавьте операторы импорта для ``java.io.InputStream`` и ``java.io.ByteArrayOutputStream`` .
[[read-bytes-as-image]]
@@ -109,42 +116,54 @@
private Image getImage(byte[] bytes, boolean isThumbnail) throws IOException {
}
----
-2. Добавьте в тело метода ``getImage`` строку, которая создает объект ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` из массива байтов, принимаемого методом в качестве параметра.
+
+[start=2]
+. Добавьте в тело метода ``getImage`` строку, которая создает объект ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` из массива байтов, принимаемого методом в качестве параметра.
[source,java]
----
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
----
-3. Добавьте строку для создания элемента ``Object`` на основе объекта ``ByteArrayInputStream`` .
+
+[start=3]
+. Добавьте строку для создания элемента ``Object`` на основе объекта ``ByteArrayInputStream`` .
[source,java]
----
Object source = bis;
----
-4. Добавьте строку для создания объекта ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` из общего объекта ``Object`` .
+
+[start=4]
+. Добавьте строку для создания объекта ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` из общего объекта ``Object`` .
[source,java]
----
ImageInputStream iis = ImageIO.createImageInputStream(source);
----
-5. Добавьте строку для создания элемента ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` для всех зарегистрированных в настоящее время объектов ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` в целях расшифровки файлов JPEG.
+
+[start=5]
+. Добавьте строку для создания элемента ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` для всех зарегистрированных в настоящее время объектов ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` в целях расшифровки файлов JPEG.
[source,java]
----
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg");
----
-6. Добавьте строку для создания объекта ``ImageReader`` для следующего элемента в ``Iterator`` .
+
+[start=6]
+. Добавьте строку для создания объекта ``ImageReader`` для следующего элемента в ``Iterator`` .
[source,java]
----
ImageReader reader = (ImageReader) readers.next();
----
-7. Добавьте строки для создания link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+параметров считывания изображения+] по умолчанию, однако если объект ``Image`` представляет эскиз, добавьте код link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+субдискретизации+] с шагом 4.
+
+[start=7]
+. Добавьте строки для создания link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+параметров считывания изображения+] по умолчанию, однако если объект ``Image`` представляет эскиз, добавьте код link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+субдискретизации+] с шагом 4.
[source,java]
----
@@ -154,7 +173,9 @@
param.setSourceSubsampling(4, 4, 0, 0);
}
----
-8. Добавьте код, использующий объект ``ImageReader`` для чтения объекта ``ImageInputStream`` и возврата элемента ``Image`` на основе этого объекта, а также параметров чтения изображения.
+
+[start=8]
+. Добавьте код, использующий объект ``ImageReader`` для чтения объекта ``ImageInputStream`` и возврата элемента ``Image`` на основе этого объекта, а также параметров чтения изображения.
[source,java]
----
@@ -162,7 +183,9 @@
reader.setInput(iis, true);
return reader.read(0, param);
----
-9. Нажмите Ctrl-Shift-I (⌘-Shift-I в MacOS). Откроется диалоговое окно Fix All Imports ("Исправление всех операторов импорта"). Примите настройку по умолчанию диалогового окна "Исправление всех операторов импорта" и нажмите кнопку "ОК".
+
+[start=9]
+. Нажмите Ctrl-Shift-I (⌘-Shift-I в MacOS). Откроется диалоговое окно Fix All Imports ("Исправление всех операторов импорта"). Примите настройку по умолчанию диалогового окна "Исправление всех операторов импорта" и нажмите кнопку "ОК".
image::images/fix-getimage-imports.png[]
Метод ``getImage`` готов.
@@ -214,7 +237,9 @@
private static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-2. Добавьте метод для создания объекта ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` и добавления массива байтов для каждого цветка в список ``List`` .
+
+[start=2]
+. Добавьте метод для создания объекта ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` и добавления массива байтов для каждого цветка в список ``List`` .
[source,java]
----
@@ -228,7 +253,9 @@
return flowers;
}
----
-3. Добавьте операторы импорта для ``java.util.ArrayList`` и ``java.util.List`` .
+
+[start=3]
+. Добавьте операторы импорта для ``java.util.ArrayList`` и ``java.util.List`` .
[[implement-getthumbnails]]
@@ -334,13 +361,21 @@
*Важно!* Требуется GlassFish Server Open Source Edition 3.1 или более поздняя версия.
image::images/deployed-service.png[]
-2. Разверните узел Web Services ("Веб-службы") проекта. Щелкните правой кнопкой мыши элемент FlowerService и выберите пункт "Тестировать веб-службу".
+
+[start=2]
+. Разверните узел Web Services ("Веб-службы") проекта. Щелкните правой кнопкой мыши элемент FlowerService и выберите пункт "Тестировать веб-службу".
image::images/test-ws-node.png[]
-3. В браузере откроется средство тестирования веб-службы. Введите текст "rose" в поле параметра ``getFlower`` .
+
+[start=3]
+. В браузере откроется средство тестирования веб-службы. Введите текст "rose" в поле параметра ``getFlower`` .
image::images/ws-tester.png[]
-4. Нажмите кнопку ``getFlower`` . Среда IDE выведет в браузере данные о вызове. Обратите внимание на область возврата метода: там расположен шифр. Однако на экране должно быть представлено изображение, а не последовательность символов. Поскольку ``java.awt.Image`` не является допустимым типом схемы, необходимо вручную настроить файл схемы для возврата двоичных данных изображения/jpeg. Эта процедура рассматривается в следующем учебном курсе.
+
+[start=4]
+. Нажмите кнопку ``getFlower`` . Среда IDE выведет в браузере данные о вызове. Обратите внимание на область возврата метода: там расположен шифр. Однако на экране должно быть представлено изображение, а не последовательность символов. Поскольку ``java.awt.Image`` не является допустимым типом схемы, необходимо вручную настроить файл схемы для возврата двоичных данных изображения/jpeg. Эта процедура рассматривается в следующем учебном курсе.
image::images/ws-tester-badschema.png[]
-5.
+
+[start=5]
+.
== Что дальше?
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_zh_CN.asciidoc
index be5c9e1..3d19f01 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower-code-ws_zh_CN.asciidoc
@@ -43,15 +43,16 @@
5. link:./flower_swing.html[+创建 Swing 客户端+]
*本课内容*
+6. <<coding-ws,对 Web 服务进行编码>>
-1. <<coding-ws,对 Web 服务进行编码>>
+. <<retrieve-jpeg-as-bytes,以字节数组形式获取 JPEG 文件>>
+. <<read-bytes-as-image,读取字节数组作为图像>>
+. <<implement-getflower,实现 getFlower>>
+. <<create-byte-array-list,为所有 JPEG 文件创建字节数组列表>>
+. <<implement-getthumbnails,实现 getThumbnails>>
-1. <<retrieve-jpeg-as-bytes,以字节数组形式获取 JPEG 文件>>
-2. <<read-bytes-as-image,读取字节数组作为图像>>
-3. <<implement-getflower,实现 getFlower>>
-4. <<create-byte-array-list,为所有 JPEG 文件创建字节数组列表>>
-5. <<implement-getthumbnails,实现 getThumbnails>>
-2. <<test-ws,测试 Web 服务>>
+[start=2]
+. <<test-ws,测试 Web 服务>>
[[coding-ws]]
@@ -75,10 +76,16 @@
return getBytes(resource);
}
----
-2. 随即出现 IDE 无法找到类 ``URL`` 的警告。通过手动方式或者按 Ctrl-Shift-I 组合键(在 Mac 上为 ⌘-Shift-I 组合键)为 ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` 添加一条导入语句。
-3. 随即出现新的警告。警告表明 IDE 无法找到 ``getBytes`` 方法。左键单击警告图标然后单击提示以创建 ``getBytes`` 方法。
+
+[start=2]
+. 随即出现 IDE 无法找到类 ``URL`` 的警告。通过手动方式或者按 Ctrl-Shift-I 组合键(在 Mac 上为 ⌘-Shift-I 组合键)为 ``link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html[+java.net.URL+]`` 添加一条导入语句。
+
+[start=3]
+. 随即出现新的警告。警告表明 IDE 无法找到 ``getBytes`` 方法。左键单击警告图标然后单击提示以创建 ``getBytes`` 方法。
image::images/create-method-tip.png[]
-4. 编辑器会将焦点置于刚刚创建的 ``getBytes`` 方法上。将以下代码添加到方法中。此代码link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+打开到 URL 的连接+],通过 ``getFlowerBytes`` 方法传递该 URL 并返回一个 ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` 。然后此代码读取输入流(一次 1024 个字节),将字节存储在字节数组缓冲区中,接着再从缓冲区写入 ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` 。
+
+[start=4]
+. 编辑器会将焦点置于刚刚创建的 ``getBytes`` 方法上。将以下代码添加到方法中。此代码link:http://download.oracle.com/javase/6/docs/api/java/net/URL.html#openStream%28%29[+打开到 URL 的连接+],通过 ``getFlowerBytes`` 方法传递该 URL 并返回一个 ``link:http://download.oracle.com/javase/6/docs/api/java/io/InputStream.html[+InputStream+]`` 。然后此代码读取输入流(一次 1024 个字节),将字节存储在字节数组缓冲区中,接着再从缓冲区写入 ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html[+ByteArrayOutputStream+]`` 。
[source,java]
----
@@ -93,7 +100,9 @@
return bos.toByteArray();
}
----
-5. 为 ``java.io.InputStream`` 和 ``java.io.ByteArrayOutputStream`` 添加导入语句。
+
+[start=5]
+. 为 ``java.io.InputStream`` 和 ``java.io.ByteArrayOutputStream`` 添加导入语句。
[[read-bytes-as-image]]
@@ -109,42 +118,54 @@
private Image getImage(byte[] bytes, boolean isThumbnail) throws IOException {
}
----
-2. 在 ``getImage`` 方法主体中,添加一行代码,以通过该方法作为参数传入的字节数组来创建 ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` 。
+
+[start=2]
+. 在 ``getImage`` 方法主体中,添加一行代码,以通过该方法作为参数传入的字节数组来创建 ``link:http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayInputStream.html[+ByteArrayInputStream+]`` 。
[source,java]
----
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
----
-3. 添加一行代码,以通过 ``ByteArrayInputStream`` 创建一个 ``Object`` 。
+
+[start=3]
+. 添加一行代码,以通过 ``ByteArrayInputStream`` 创建一个 ``Object`` 。
[source,java]
----
Object source = bis;
----
-4. 添加一行代码,以通过通用 ``Object`` 创建一个 ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` 。
+
+[start=4]
+. 添加一行代码,以通过通用 ``Object`` 创建一个 ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/stream/ImageInputStream.html[+ImageInputStream+]`` 。
[source,java]
----
ImageInputStream iis = ImageIO.createImageInputStream(source);
----
-5. 添加一行代码来为所有当前注册的可以解码 JPEG 文件的 ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` 创建一个 ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` 。
+
+[start=5]
+. 添加一行代码来为所有当前注册的可以解码 JPEG 文件的 ``link:http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html[+ImageReader+]`` 创建一个 ``link:http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html[+Iterator+]`` 。
[source,java]
----
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg");
----
-6. 添加一行代码,用于通过 ``Iterator`` 中的下一个元素创建 ``ImageReader`` 。
+
+[start=6]
+. 添加一行代码,用于通过 ``Iterator`` 中的下一个元素创建 ``ImageReader`` 。
[source,java]
----
ImageReader reader = (ImageReader) readers.next();
----
-7. 添加代码行以创建默认的link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+图像读取参数+],但是如果 ``Image`` 代表缩略图,请将四种link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+二次采样+]中的一种添加到图像读取参数中。
+
+[start=7]
+. 添加代码行以创建默认的link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html[+图像读取参数+],但是如果 ``Image`` 代表缩略图,请将四种link:http://download.oracle.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29[+二次采样+]中的一种添加到图像读取参数中。
[source,java]
----
@@ -154,7 +175,9 @@
param.setSourceSubsampling(4, 4, 0, 0);
}
----
-8. 最后,添加代码以使用 ``ImageReader`` 对象来读取 ``ImageInputStream`` 对象,并基于该对象和图像读取参数来返回 ``Image`` 。
+
+[start=8]
+. 最后,添加代码以使用 ``ImageReader`` 对象来读取 ``ImageInputStream`` 对象,并基于该对象和图像读取参数来返回 ``Image`` 。
[source,java]
----
@@ -162,7 +185,9 @@
reader.setInput(iis, true);
return reader.read(0, param);
----
-9. 按 Ctrl-Shift-I 组合键(在 MacOS 上按 ⌘-Shift-I 组合键)。"Fix All Imports"(修复所有导入)对话框即打开。接受 "Fix All Imports"(修复所有导入)对话框的默认建议,然后单击 "OK"(确定)。
+
+[start=9]
+. 按 Ctrl-Shift-I 组合键(在 MacOS 上按 ⌘-Shift-I 组合键)。"Fix All Imports"(修复所有导入)对话框即打开。接受 "Fix All Imports"(修复所有导入)对话框的默认建议,然后单击 "OK"(确定)。
image::images/fix-getimage-imports.png[]
``getImage`` 方法现在已完成。
@@ -214,7 +239,9 @@
private static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-2. 添加一个方法,该方法创建一个 ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` ,并将每朵花的字节数组添加到 ``List`` 中。
+
+[start=2]
+. 添加一个方法,该方法创建一个 ``link:http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html[+ArrayList+]`` ,并将每朵花的字节数组添加到 ``List`` 中。
[source,java]
----
@@ -228,7 +255,9 @@
return flowers;
}
----
-3. 为 ``java.util.ArrayList`` 和 ``java.util.List`` 添加导入语句。
+
+[start=3]
+. 为 ``java.util.ArrayList`` 和 ``java.util.List`` 添加导入语句。
[[implement-getthumbnails]]
@@ -334,13 +363,21 @@
*重要说明:*GlassFish Server Open Source Edition 的版本必须是 3.1 或更高版本。
image::images/deployed-service.png[]
-2. 展开项目的 "Web Services"(Web 服务)节点。右键单击 "FlowerService" 然后选择 "Test Web Service"(测试 Web 服务)。
+
+[start=2]
+. 展开项目的 "Web Services"(Web 服务)节点。右键单击 "FlowerService" 然后选择 "Test Web Service"(测试 Web 服务)。
image::images/test-ws-node.png[]
-3. Web 服务测试器在浏览器中打开。在 ``getFlower`` 参数字段中键入 "rose"。
+
+[start=3]
+. Web 服务测试器在浏览器中打开。在 ``getFlower`` 参数字段中键入 "rose"。
image::images/ws-tester.png[]
-4. 按 ``getFlower`` 按钮。IDE 在浏览器中显示有关调用的信息。查看“Method Returned”时,会看到乱码。您想要看到一幅图像,而不是一系列的符号。但是,由于 ``java.awt.Image`` 不是有效的方案类型,需要手动配置方案文件以返回二进制 image/jpeg 数据。这将在下一个教程中完成。
+
+[start=4]
+. 按 ``getFlower`` 按钮。IDE 在浏览器中显示有关调用的信息。查看“Method Returned”时,会看到乱码。您想要看到一幅图像,而不是一系列的符号。但是,由于 ``java.awt.Image`` 不是有效的方案类型,需要手动配置方案文件以返回二进制 image/jpeg 数据。这将在下一个教程中完成。
image::images/ws-tester-badschema.png[]
-5.
+
+[start=5]
+.
== 后续步骤:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview.asciidoc
index 0044c7d..b346a48 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview.asciidoc
@@ -50,7 +50,7 @@
5. link:./flower_swing.html[+ Creating the Swing Client+]
-=== Software Needed for the Tutorial
+== Software Needed for the Tutorial
*To follow this tutorial, you need the following software and resources.*
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ja.asciidoc
index e5759de..91f0c43 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ja.asciidoc
@@ -50,7 +50,7 @@
5. link:./flower_swing.html[+Swingクライアントの作成+]
-=== チュートリアルに必要なソフトウェア
+== チュートリアルに必要なソフトウェア
*このチュートリアルに従うには、次のソフトウェアとリソースが必要です。*
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_pt_BR.asciidoc
index 01710b9..ad5b306 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_pt_BR.asciidoc
@@ -50,7 +50,7 @@
5. link:./flower_swing.html[+ Criando o Cliente Swing+]
-=== Software Necessário para o Tutorial
+== Software Necessário para o Tutorial
*Para seguir este tutorial, são necessários os recursos e o software a seguir.*
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ru.asciidoc
index 43a9624..3cd4fac 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_ru.asciidoc
@@ -50,7 +50,7 @@
5. link:./flower_swing.html[+ Создание клиента Swing+]
-=== Программное обеспечение, требуемое для работы с данным учебным курсом.
+== Программное обеспечение, требуемое для работы с данным учебным курсом.
*Для работы с этим учебным курсом требуется следующее программное обеспечение и ресурсы.*
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_zh_CN.asciidoc
index 3a9938b..4b406f5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_overview_zh_CN.asciidoc
@@ -49,7 +49,7 @@
5. link:./flower_swing.html[+创建 Swing 客户端+]
-=== 本教程所需要的软件
+== 本教程所需要的软件
*要学习本教程,您需要具备以下软件和资源。*
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing.asciidoc
index 1510d1f..5fceb7e 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing.asciidoc
@@ -44,13 +44,20 @@
5. => Creating the Swing Client
+[start=1]
1. <<create-client-app,Creating the Client Application>>
-2. <<design-jframe,Designing the JFrame>>
-3.
+
+[start=2]
+. <<design-jframe,Designing the JFrame>>
+
+[start=3]
+.
<<bind-jframe,Binding the JFrame Components>>
-4. <<code-main-class,Coding the Main Class>>
+
+[start=4]
+. <<code-main-class,Coding the Main Class>>
== Creating the Client Application
@@ -64,7 +71,9 @@
3. Right-click the ``FlowerClient`` project node and choose New > Web Service Client from the context menu. The New Web Service Client wizard opens.
4. Select the WSDL URL radio button and paste the URL of the WSDL file into that field. (By default, the URL is ``http://localhost:8080/FlowerAlbumService/FlowerServiceService?wsdl`` . Find the URL in the browser by testing the web service and replacing ``?Tester`` with ``?wsdl`` at the end of the URL.) Accept all other default values, including a blank package name.
image::images/ws-client-wiz.png[]
-5. Click Finish. The IDE downloads the WSDL file, adds client stubs for interacting with the web service, and adds nodes to the Projects window in the Java application project.
+
+[start=5]
+. Click Finish. The IDE downloads the WSDL file, adds client stubs for interacting with the web service, and adds nodes to the Projects window in the Java application project.
image::images/client-generated-sources.png[title="Projects view showing new web service client"]
@@ -78,14 +87,24 @@
1. Right-click the ``FlowerClient`` node and select New > JFrame Form. Name the frame ``FlowerFrame`` . Place it in the ``flowerclient`` package.
2. The ``FlowerFrame`` opens in the editor. Open the Palette if it is not open. Extend the bottom boundary of the frame by around one-third.
image::images/opened-flowerform.png[]
-3. Drag a JPanel from the Swing Containers section of the Palette to the ``FlowerFrame`` . Expand it to fill the entire ``FlowerFrame`` .
+
+[start=3]
+. Drag a JPanel from the Swing Containers section of the Palette to the ``FlowerFrame`` . Expand it to fill the entire ``FlowerFrame`` .
image::images/add-panel.png[]
-4. Right-click the Panel in the Design View. Select Change Variable Name... from the context menu. Name the panel ``gardenFlowersPanel`` .
-5. Drag a JLabel from the Palette to the top of the `` gardenFlowersPanel`` . Right-click the label, and change the label's variable name to ``titleLabel`` . Right-click the ``titleLabel`` again and select Edit Text. Change the text to Garden Flowers. You may want to explore the ``titleLabel`` 's properties and give it a prominent font.
-6. Drag a Button Group into the design view. Accept the button group's default variable name of ``buttonGroup1`` .
-7. Drag four Radio Buttons into a horizontal row beneath the ``titleLabel`` . In the properties of each button, set it as a member of ``buttonGroup1`` . The buttons' other properties are as follows:
+
+[start=4]
+. Right-click the Panel in the Design View. Select Change Variable Name... from the context menu. Name the panel ``gardenFlowersPanel`` .
+
+[start=5]
+. Drag a JLabel from the Palette to the top of the `` gardenFlowersPanel`` . Right-click the label, and change the label's variable name to ``titleLabel`` . Right-click the ``titleLabel`` again and select Edit Text. Change the text to Garden Flowers. You may want to explore the ``titleLabel`` 's properties and give it a prominent font.
+
+[start=6]
+. Drag a Button Group into the design view. Accept the button group's default variable name of ``buttonGroup1`` .
+
+[start=7]
+. Drag four Radio Buttons into a horizontal row beneath the ``titleLabel`` . In the properties of each button, set it as a member of ``buttonGroup1`` . The buttons' other properties are as follows:
|===
-Radio Buttons in buttonGroup1
+|Radio Buttons in buttonGroup1
|Variable Name |Selected |Text
@@ -97,13 +116,27 @@
|sunflowerRadioButton |false |Sunflower
|===
-8. Drag a Scroll Pane to below the radio buttons. Expand it to fill all the horizontal space and about two-thirds of the free vertical space. Change the scroll pane's variable name to ``mainScrollPane`` .
-9. Drag a Panel into the ``mainScrollPane`` . Change the Panel's variable name to ``mainPanel`` .
-10. In the Design view, right-click the ``mainPanel`` and select Set Layout > Border Layout.
-11. Drag a Button into the ``mainPanel`` . Because the ``mainPanel`` has border layout, the button automatically fills the entire panel. Change the button's variable name to ``mainPictureButton`` and change the button's text to "Waiting for picture..."
-12. Drag another Scroll Pane to the space below the ``mainScrollPane`` . Expand the new scroll pane to fill up all remaining free space. Change the new scroll pane's variable name to ``thumbnailScrollPane`` .
-13. Drag a Panel into the ``thumbnailScrollPane`` . Change the Panel's variable name to ``thumbnailPanel`` . Set the ``thumbnailPanel`` 's layout to Grid Layout.
-14. Drag four Buttons into the ``thumbnailPanel`` . Because the ``thumbnailPanel`` has Grid Layout, the Buttons are automatically of equal size and completely fill the panel. The buttons' properties are as follows: Buttons in the thumbnailPanel
+
+[start=8]
+. Drag a Scroll Pane to below the radio buttons. Expand it to fill all the horizontal space and about two-thirds of the free vertical space. Change the scroll pane's variable name to ``mainScrollPane`` .
+
+[start=9]
+. Drag a Panel into the ``mainScrollPane`` . Change the Panel's variable name to ``mainPanel`` .
+
+[start=10]
+. In the Design view, right-click the ``mainPanel`` and select Set Layout > Border Layout.
+
+[start=11]
+. Drag a Button into the ``mainPanel`` . Because the ``mainPanel`` has border layout, the button automatically fills the entire panel. Change the button's variable name to ``mainPictureButton`` and change the button's text to "Waiting for picture..."
+
+[start=12]
+. Drag another Scroll Pane to the space below the ``mainScrollPane`` . Expand the new scroll pane to fill up all remaining free space. Change the new scroll pane's variable name to ``thumbnailScrollPane`` .
+
+[start=13]
+. Drag a Panel into the ``thumbnailScrollPane`` . Change the Panel's variable name to ``thumbnailPanel`` . Set the ``thumbnailPanel`` 's layout to Grid Layout.
+
+[start=14]
+. Drag four Buttons into the ``thumbnailPanel`` . Because the ``thumbnailPanel`` has Grid Layout, the Buttons are automatically of equal size and completely fill the panel. The buttons' properties are as follows: Buttons in the thumbnailPanel
|===
|Variable Name |Text
@@ -133,23 +166,25 @@
]]
1. Change to the Source view of the editor. Locate the beginning of the ``FlowerFrame`` class body and the ``FlowerFrame`` constructor.
+
image::images/ff-empty-constructor.png[]
-1. At the top of the class body of ``FlowerFrame`` , before the constructor, create an array of strings of the names of every flower.
+
+. At the top of the class body of ``FlowerFrame`` , before the constructor, create an array of strings of the names of every flower.
[source,java]
----
protected static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-1. Between the FLOWERS string array and the constructor, add a line that initializes a ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` named ``flowers`` . The map takes a ``String`` and maps it to an ``Image`` .
+. Between the FLOWERS string array and the constructor, add a line that initializes a ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` named ``flowers`` . The map takes a ``String`` and maps it to an ``Image`` .
[source,java]
----
private Map<String, Image> flowers;
----
-1. Add import statements for ``java.util.Map`` and ``java.awt.Image`` .
-2. Add code to the ``FlowerFrame`` constructor to associate a specific ``Image`` with a specific ``String`` for a specific instance of the ``flowers`` map
+. Add import statements for ``java.util.Map`` and ``java.awt.Image`` .
+. Add code to the ``FlowerFrame`` constructor to associate a specific ``Image`` with a specific ``String`` for a specific instance of the ``flowers`` map
[source,java]
----
@@ -164,7 +199,9 @@
initComponents();
}
----
-3. Initialize ``ItemListener`` s for the radio buttons and ``ActionListener`` s for the four flower buttons, and set the default title.
+
+[start=3]
+. Initialize ``ItemListener`` s for the radio buttons and ``ActionListener`` s for the four flower buttons, and set the default title.
[source,java]
----
@@ -193,7 +230,9 @@
sunflowerButton.addActionListener(bListener);
}
----
-4. Add import statements for ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` and ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` .
+
+[start=4]
+. Add import statements for ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` and ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` .
The constructor is now complete. You have compile error warnings in the code because the code does not contain the classes ``RBListener`` and ``ButtonListener`` . These two classes are custom implementations of ``ItemListener`` and ``ActionListener`` , respectively. You write these two classes in the next section.
@@ -205,7 +244,7 @@
]]
1. Find the ``public static void main(String args[])`` method in the ``FlowerFrame`` class body. Delete this method and its documentation. (The application uses the ``Main`` class instead.)
-1. In place of the ``main`` method, write a custom ``ItemListener`` for the radio buttons. This listener shows a new flower image when a radio button is chosen.
+. In place of the ``main`` method, write a custom ``ItemListener`` for the radio buttons. This listener shows a new flower image when a radio button is chosen.
[source,java]
----
@@ -216,8 +255,8 @@
}
}
----
-1. Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` .
-1. Below the custom ``ItemListener`` , write a custom ``ActionListener`` for the 4 flower buttons. When a button is clicked, the listener selects the related radio button:
+. Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` .
+. Below the custom ``ItemListener`` , write a custom ``ActionListener`` for the 4 flower buttons. When a button is clicked, the listener selects the related radio button:
[source,java]
----
@@ -232,8 +271,12 @@
}
}
----
-2. Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` .
-3. Below the custom ``ActionListener`` , write the ``showFlower`` method. This method determines which radio button is selected and gets an ``Image`` of the corresponding flower from the ``flowers`` map.
+
+[start=2]
+. Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` .
+
+[start=3]
+. Below the custom ``ActionListener`` , write the ``showFlower`` method. This method determines which radio button is selected and gets an ``Image`` of the corresponding flower from the ``flowers`` map.
[source,java]
----
@@ -272,8 +315,12 @@
} else mainPictureButton.setText("");
}
----
-4. Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` .
-5. Write the ``setThumbnails`` method. This method gets an image for each thumbnail from the ``flowers`` map. The ``Main`` class calls this method.
+
+[start=4]
+. Add an import statement for ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` .
+
+[start=5]
+. Write the ``setThumbnails`` method. This method gets an image for each thumbnail from the ``flowers`` map. The ``Main`` class calls this method.
[source,java]
----
@@ -301,7 +348,9 @@
}
}
----
-6. Fix the imports in ``FlowerFrame`` , if you did not fix them as you pasted in the code. You can fix them all at once by right-clicking in the editor and choosing Fix Imports from the context menu. The complete set of import statements follows:
+
+[start=6]
+. Fix the imports in ``FlowerFrame`` , if you did not fix them as you pasted in the code. You can fix them all at once by right-clicking in the editor and choosing Fix Imports from the context menu. The complete set of import statements follows:
[source,java]
----
@@ -318,14 +367,18 @@
1. Open the ``Main.java`` class in the editor.
image::images/main-empty.png[]
-2. In the class body, before the ``main`` method, initialize an ``int`` variable for the number of downloaded pictures.
+
+[start=2]
+. In the class body, before the ``main`` method, initialize an ``int`` variable for the number of downloaded pictures.
[source,java]
----
private static int downloadedPictures;
----
-3. In the ``main`` method body, create a ``HashMap`` of four flowers and another ``HashMap`` of four thumbnails.
+
+[start=3]
+. In the ``main`` method body, create a ``HashMap`` of four flowers and another ``HashMap`` of four thumbnails.
[source,java]
----
@@ -333,8 +386,12 @@
final Map<String,Image> flowers = new HashMap<String,Image>(4);
final Map<String,Image> thumbs = new HashMap<String,Image>(4);
----
-4. Add import statements for ``java.awt.Image`` , ``java.util.Map`` , and ``java.util.HashMap`` .
-5. In the ``main`` method body, add code to show the ``FlowerFrame`` .*// Show the FlowerFrame.*
+
+[start=4]
+. Add import statements for ``java.awt.Image`` , ``java.util.Map`` , and ``java.util.HashMap`` .
+
+[start=5]
+. In the ``main`` method body, add code to show the ``FlowerFrame`` .*// Show the FlowerFrame.*
[source,java]
----
@@ -342,7 +399,9 @@
final FlowerFrame frame = new FlowerFrame(flowers);
frame.setVisible(true);
----
-6. In the ``main`` method body, add code to connect the client to the service.*// The client connects to the service with this code.*
+
+[start=6]
+. In the ``main`` method body, add code to connect the client to the service.*// The client connects to the service with this code.*
[source,java]
----
@@ -350,8 +409,12 @@
FlowerServiceService service = new FlowerServiceService();
final FlowerService port = service.getFlowerServicePort();
----
-7. Add import statements for ``org.flower.service.FlowerService`` and ``org.flower.service.FlowerServiceService`` .
-8. In the ``main`` method body, add code that creates an array of four ``Runnable`` threads and calls the web service's ``getFlower`` operation once in each thread.*// The web service getFlower operation
+
+[start=7]
+. Add import statements for ``org.flower.service.FlowerService`` and ``org.flower.service.FlowerServiceService`` .
+
+[start=8]
+. In the ``main`` method body, add code that creates an array of four ``Runnable`` threads and calls the web service's ``getFlower`` operation once in each thread.*// The web service getFlower operation
// is called 4 times, each in a separate thread.
// When the operation finishes the picture is shown in
// a specific button.*
@@ -388,8 +451,12 @@
new Thread(tasks[i]).start();
}
----
-9. Add an import statement for ``org.flower.service.IOException_Exception`` .
-10. In the ``main`` method body, add code that calls the web service's ``getThumbnails`` operation in a separate thread.*// The web service getThumbnails operation is called
+
+[start=9]
+. Add an import statement for ``org.flower.service.IOException_Exception`` .
+
+[start=10]
+. In the ``main`` method body, add code that calls the web service's ``getThumbnails`` operation in a separate thread.*// The web service getThumbnails operation is called
// in a separate thread, just after the previous four threads finish.
// When the images are downloaded, the thumbnails are shown at
// the bottom of the frame.*
@@ -423,7 +490,9 @@
new Thread(thumbsTask).start();
----
-11. Fix the imports in ``Main.java`` , if you did not fix them as you pasted in the code. You can fix them all at once by right-clicking in the editor and choosing Fix Imports from the context menu. You are given a choice of List classes to import; select ``java.util.List`` . The complete set of import statements follows:
+
+[start=11]
+. Fix the imports in ``Main.java`` , if you did not fix them as you pasted in the code. You can fix them all at once by right-clicking in the editor and choosing Fix Imports from the context menu. You are given a choice of List classes to import; select ``java.util.List`` . The complete set of import statements follows:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ja.asciidoc
index 8656677..901163d 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ja.asciidoc
@@ -44,13 +44,20 @@
5. => Swingクライアントの作成
+[start=1]
1. <<create-client-app,クライアント・アプリケーションの作成>>
-2. <<design-jframe,JFrameのデザイン>>
-3.
+
+[start=2]
+. <<design-jframe,JFrameのデザイン>>
+
+[start=3]
+.
<<bind-jframe,JFrameコンポーネントのバインディング>>
-4. <<code-main-class,メイン・クラスのコーディング>>
+
+[start=4]
+. <<code-main-class,メイン・クラスのコーディング>>
== クライアント・アプリケーションの作成
@@ -64,7 +71,9 @@
3. 「 ``FlowerClient`` 」プロジェクト・ノードを右クリックし、コンテキスト・メニューから「新規」>「Webサービス・クライアント」を選択します。新規Webサービス・クライアント・ウィザードが開きます。
4. 「WSDL URL」ラジオ・ボタンを選択し、WSDLファイルのURLをそのフィールドに貼り付けます。デフォルトでは、URLは ``http://localhost:8080/FlowerAlbumService/FlowerServiceService?wsdl`` です。ブラウザでURLを見つけるには、Webサービスをテストし、URLの末尾を ``?Tester`` から ``?wsdl`` に置き換えます。空のパッケージ名を含め、他のデフォルト値をすべて受け入れます。
image::images/ws-client-wiz.png[]
-5. 「終了」をクリックします。IDEによりWSDLファイルがダウンロードされ、Webサービスと対話するためのクライアント・スタブが追加され、Javaアプリケーション・プロジェクトの「プロジェクト」ウィンドウにノードが追加されます。
+
+[start=5]
+. 「終了」をクリックします。IDEによりWSDLファイルがダウンロードされ、Webサービスと対話するためのクライアント・スタブが追加され、Javaアプリケーション・プロジェクトの「プロジェクト」ウィンドウにノードが追加されます。
image::images/client-generated-sources.png[title="新しいWebサービス・クライアントが表示された「プロジェクト」ビュー"]
@@ -78,14 +87,24 @@
1. 「 ``FlowerClient`` 」ノードを右クリックし、「新規」>「JFrameフォーム」を選択します。フレームに「 ``FlowerFrame`` 」という名前を付けます。このフレームを ``flowerclient`` パッケージに配置します。
2. ``FlowerFrame`` がエディタに表示されます。パレットが開かれていない場合は、パレットを開きます。フレームの下部の境界線をおよそ3分の1まで拡げます。
image::images/opened-flowerform.png[]
-3. パレットの「Swingコンテナ」セクションからJPanelを ``FlowerFrame`` にドラッグします。 ``FlowerFrame`` 全体を埋めるように拡げます。
+
+[start=3]
+. パレットの「Swingコンテナ」セクションからJPanelを ``FlowerFrame`` にドラッグします。 ``FlowerFrame`` 全体を埋めるように拡げます。
image::images/add-panel.png[]
-4. 「デザイン」ビューでこのパネルを右クリックします。コンテキスト・メニューから「変数名を変更...」を選択します。パネルに「 ``gardenFlowersPanel`` 」という名前を付けます。
-5. パレットからJLabelを ``gardenFlowersPanel`` の上にドラッグします。ラベルを右クリックし、ラベルの変数名を ``titleLabel`` に変更します。「 ``titleLabel`` 」を再度右クリックし、「テキストを編集」を選択します。テキストを「Garden Flowers」に変更します。必要に応じて、 ``titleLabel`` のプロパティを表示して、目立つフォントに変更します。
-6. 「ボタン・グループ」を「デザイン」ビューにドラッグします。ボタン・グループの変数名はデフォルトの ``buttonGroup1`` のままにします。
-7. 4つの「ラジオ・ボタン」を、 ``titleLabel`` の真下に横一列に並ぶようにドラッグします。各ボタンのプロパティで、 ``buttonGroup1`` のメンバーとして設定します。これらのボタンの他のプロパティは、次のとおりです。
+
+[start=4]
+. 「デザイン」ビューでこのパネルを右クリックします。コンテキスト・メニューから「変数名を変更...」を選択します。パネルに「 ``gardenFlowersPanel`` 」という名前を付けます。
+
+[start=5]
+. パレットからJLabelを ``gardenFlowersPanel`` の上にドラッグします。ラベルを右クリックし、ラベルの変数名を ``titleLabel`` に変更します。「 ``titleLabel`` 」を再度右クリックし、「テキストを編集」を選択します。テキストを「Garden Flowers」に変更します。必要に応じて、 ``titleLabel`` のプロパティを表示して、目立つフォントに変更します。
+
+[start=6]
+. 「ボタン・グループ」を「デザイン」ビューにドラッグします。ボタン・グループの変数名はデフォルトの ``buttonGroup1`` のままにします。
+
+[start=7]
+. 4つの「ラジオ・ボタン」を、 ``titleLabel`` の真下に横一列に並ぶようにドラッグします。各ボタンのプロパティで、 ``buttonGroup1`` のメンバーとして設定します。これらのボタンの他のプロパティは、次のとおりです。
|===
-buttonGroup1のラジオ・ボタン
+|buttonGroup1のラジオ・ボタン
|変数名 |選択状態 |テキスト
@@ -97,13 +116,27 @@
|sunflowerRadioButton |false |Sunflower
|===
-8. 「スクロール・ペイン」をラジオ・ボタンの下にドラッグします。横のスペースのすべて、および縦のスペースのおよそ3分の2を埋めるようにスクロール・ペインを拡げます。スクロール・ペインの変数名を ``mainScrollPane`` に変更します。
-9. 「パネル」を ``mainScrollPane`` にドラッグします。パネルの変数名を ``mainPanel`` に変更します。
-10. 「デザイン」ビューで ``mainPanel`` を右クリックし、「レイアウトを設定」>「境界線レイアウト」を選択します。
-11. 「ボタン」を ``mainPanel`` にドラッグします。 ``mainPanel`` に境界線レイアウトが設定されているため、ボタンはパネル全体を埋めるように自動的に拡げられます。ボタンの変数名を ``mainPictureButton`` に、ボタンのテキストを「Waiting for picture...」に変更します。
-12. もう1つの「スクロール・ペイン」を ``mainScrollPane`` の下のスペースにドラッグします。残りの全スペースを埋めるように、このスクロール・ペインを拡げます。新しいスクロール・ペインの変数名を ``thumbnailScrollPane`` に変更します。
-13. 「パネル」を ``thumbnailScrollPane`` にドラッグします。このパネルの変数名を ``thumbnailPanel`` に変更します。 ``thumbnailPanel`` のレイアウトを「グリッド・レイアウト」に設定します。
-14. 4つの「ボタン」を ``thumbnailPanel`` にドラッグします。 ``thumbnailPanel`` にグリッド・レイアウトが設定されているため、すべてのボタンが自動的に同じサイズになり、パネル全体を埋めるように拡げられます。これらのボタンのプロパティは、次のとおりです。 thumbnailPanelのボタン
+
+[start=8]
+. 「スクロール・ペイン」をラジオ・ボタンの下にドラッグします。横のスペースのすべて、および縦のスペースのおよそ3分の2を埋めるようにスクロール・ペインを拡げます。スクロール・ペインの変数名を ``mainScrollPane`` に変更します。
+
+[start=9]
+. 「パネル」を ``mainScrollPane`` にドラッグします。パネルの変数名を ``mainPanel`` に変更します。
+
+[start=10]
+. 「デザイン」ビューで ``mainPanel`` を右クリックし、「レイアウトを設定」>「境界線レイアウト」を選択します。
+
+[start=11]
+. 「ボタン」を ``mainPanel`` にドラッグします。 ``mainPanel`` に境界線レイアウトが設定されているため、ボタンはパネル全体を埋めるように自動的に拡げられます。ボタンの変数名を ``mainPictureButton`` に、ボタンのテキストを「Waiting for picture...」に変更します。
+
+[start=12]
+. もう1つの「スクロール・ペイン」を ``mainScrollPane`` の下のスペースにドラッグします。残りの全スペースを埋めるように、このスクロール・ペインを拡げます。新しいスクロール・ペインの変数名を ``thumbnailScrollPane`` に変更します。
+
+[start=13]
+. 「パネル」を ``thumbnailScrollPane`` にドラッグします。このパネルの変数名を ``thumbnailPanel`` に変更します。 ``thumbnailPanel`` のレイアウトを「グリッド・レイアウト」に設定します。
+
+[start=14]
+. 4つの「ボタン」を ``thumbnailPanel`` にドラッグします。 ``thumbnailPanel`` にグリッド・レイアウトが設定されているため、すべてのボタンが自動的に同じサイズになり、パネル全体を埋めるように拡げられます。これらのボタンのプロパティは、次のとおりです。 thumbnailPanelのボタン
|===
|変数名 |テキスト
@@ -134,22 +167,22 @@
1. エディタの「ソース」ビューに変更します。 ``FlowerFrame`` クラス本文の先頭と ``FlowerFrame`` コンストラクタを探します。
image::images/ff-empty-constructor.png[]
-1. コンストラクタの前にある ``FlowerFrame`` のクラス本文の先頭に、すべての花の名前の文字列配列を作成します。
+. コンストラクタの前にある ``FlowerFrame`` のクラス本文の先頭に、すべての花の名前の文字列配列を作成します。
[source,java]
----
protected static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-1. FLOWERS文字列配列とコンストラクタの間に、 ``flowers`` という名前の ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` を初期化する行を追加します。このマップは ``String`` を取って ``Image`` にマップします。
+. FLOWERS文字列配列とコンストラクタの間に、 ``flowers`` という名前の ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` を初期化する行を追加します。このマップは ``String`` を取って ``Image`` にマップします。
[source,java]
----
private Map<String, Image> flowers;
----
-1. ``java.util.Map`` と ``java.awt.Image`` のインポート文を追加します。
-2. ``flowers`` マップの特定のインスタンスで特定の ``Image`` を特定の ``String`` に関連付けるコードを、 ``FlowerFrame`` コンストラクタに追加します。
+. ``java.util.Map`` と ``java.awt.Image`` のインポート文を追加します。
+. ``flowers`` マップの特定のインスタンスで特定の ``Image`` を特定の ``String`` に関連付けるコードを、 ``FlowerFrame`` コンストラクタに追加します。
[source,java]
----
@@ -164,7 +197,9 @@
initComponents();
}
----
-3. ラジオ・ボタン用の ``ItemListener`` と4つの花のボタン用の ``ActionListener`` を初期化し、デフォルトのタイトルを設定します。
+
+[start=3]
+. ラジオ・ボタン用の ``ItemListener`` と4つの花のボタン用の ``ActionListener`` を初期化し、デフォルトのタイトルを設定します。
[source,java]
----
@@ -193,7 +228,9 @@
sunflowerButton.addActionListener(bListener);
}
----
-4. ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` と ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` のインポート文を追加します。
+
+[start=4]
+. ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` と ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` のインポート文を追加します。
これでコンストラクタは完成しました。ただし、コードに ``RBListener`` クラスと ``ButtonListener`` クラスが含まれていないため、コンパイル・エラーの警告が表示されます。この2つのクラスは、それぞれ ``ItemListener`` と ``ActionListener`` のカスタム実装です。この2つのクラスの記述は、次の項で行います。
@@ -204,8 +241,8 @@
]]
-1. ``FlowerFrame`` のクラス本文で ``public static void main(String args[])`` メソッドを探します。このメソッドとそのドキュメントを削除します。このアプリケーションでは、かわりに ``Main`` クラスを使用します。
-1. ``main`` メソッドのかわりに、カスタム ``ItemListener`` をラジオ・ボタン用に記述します。このリスナーは、ラジオ・ボタンが選択されたときに新しい花のイメージを表示します。
+. ``FlowerFrame`` のクラス本文で ``public static void main(String args[])`` メソッドを探します。このメソッドとそのドキュメントを削除します。このアプリケーションでは、かわりに ``Main`` クラスを使用します。
+. ``main`` メソッドのかわりに、カスタム ``ItemListener`` をラジオ・ボタン用に記述します。このリスナーは、ラジオ・ボタンが選択されたときに新しい花のイメージを表示します。
[source,java]
----
@@ -216,8 +253,8 @@
}
}
----
-1. ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` のインポート文を追加します。
-1. カスタム ``ItemListener`` の下に、カスタム ``ActionListener`` を4つの花のボタン用に記述します。ボタンがクリックされると、リスナーは関連するラジオ・ボタンを選択します。
+. ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` のインポート文を追加します。
+. カスタム ``ItemListener`` の下に、カスタム ``ActionListener`` を4つの花のボタン用に記述します。ボタンがクリックされると、リスナーは関連するラジオ・ボタンを選択します。
[source,java]
----
@@ -232,8 +269,12 @@
}
}
----
-2. ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` のインポート文を追加します。
-3. カスタム ``ActionListener`` の下に ``showFlower`` メソッドを記述します。このメソッドは、選択されているラジオ・ボタンを判断し、対応する花の ``Image`` を ``flowers`` マップから取得します。
+
+[start=2]
+. ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` のインポート文を追加します。
+
+[start=3]
+. カスタム ``ActionListener`` の下に ``showFlower`` メソッドを記述します。このメソッドは、選択されているラジオ・ボタンを判断し、対応する花の ``Image`` を ``flowers`` マップから取得します。
[source,java]
----
@@ -272,8 +313,12 @@
} else mainPictureButton.setText("");
}
----
-4. ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` のインポート文を追加します。
-5. ``setThumbnails`` メソッドを記述します。このメソッドは、各サムネイルのイメージを ``flowers`` マップから取得します。 ``Main`` クラスがこのメソッドをコールします。
+
+[start=4]
+. ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` のインポート文を追加します。
+
+[start=5]
+. ``setThumbnails`` メソッドを記述します。このメソッドは、各サムネイルのイメージを ``flowers`` マップから取得します。 ``Main`` クラスがこのメソッドをコールします。
[source,java]
----
@@ -301,7 +346,9 @@
}
}
----
-6. ``FlowerFrame`` のコードに貼り付けたときにインポートを修正していない場合は、インポートを修正します。エディタで右クリックし、コンテキスト・メニューから「インポートを修正」を選択すると、すべてのインポートを一度に修正できます。完成した一連のインポート文は次のようになります。
+
+[start=6]
+. ``FlowerFrame`` のコードに貼り付けたときにインポートを修正していない場合は、インポートを修正します。エディタで右クリックし、コンテキスト・メニューから「インポートを修正」を選択すると、すべてのインポートを一度に修正できます。完成した一連のインポート文は次のようになります。
[source,java]
----
@@ -318,14 +365,18 @@
1. ``Main.java`` クラスをエディタで開きます。
image::images/main-empty.png[]
-2. クラス本文の ``main`` メソッドの前で、ダウンロードした写真の数を示す ``int`` 変数を初期化します。
+
+[start=2]
+. クラス本文の ``main`` メソッドの前で、ダウンロードした写真の数を示す ``int`` 変数を初期化します。
[source,java]
----
private static int downloadedPictures;
----
-3. ``main`` メソッドの本文で、4つの花用の ``HashMap`` と、4つのサムネイル用に別の ``HashMap`` を作成します。
+
+[start=3]
+. ``main`` メソッドの本文で、4つの花用の ``HashMap`` と、4つのサムネイル用に別の ``HashMap`` を作成します。
[source,java]
----
@@ -333,8 +384,12 @@
final Map<String,Image> flowers = new HashMap<String,Image>(4);
final Map<String,Image> thumbs = new HashMap<String,Image>(4);
----
-4. ``java.awt.Image`` 、 ``java.util.Map`` および ``java.util.HashMap`` のインポート文を追加します。
-5. ``main`` メソッドの本文で、 ``FlowerFrame`` を表示するコードを追加します。*// Show the FlowerFrame.*
+
+[start=4]
+. ``java.awt.Image`` 、 ``java.util.Map`` および ``java.util.HashMap`` のインポート文を追加します。
+
+[start=5]
+. ``main`` メソッドの本文で、 ``FlowerFrame`` を表示するコードを追加します。*// Show the FlowerFrame.*
[source,java]
----
@@ -342,7 +397,9 @@
final FlowerFrame frame = new FlowerFrame(flowers);
frame.setVisible(true);
----
-6. ``main`` メソッドの本文で、クライアントをサービスに接続するコードを追加します。*// The client connects to the service with this code.*
+
+[start=6]
+. ``main`` メソッドの本文で、クライアントをサービスに接続するコードを追加します。*// The client connects to the service with this code.*
[source,java]
----
@@ -350,8 +407,12 @@
FlowerServiceService service = new FlowerServiceService();
final FlowerService port = service.getFlowerServicePort();
----
-7. ``org.flower.service.FlowerService`` と ``org.flower.service.FlowerServiceService`` のインポート文を追加します。
-8. ``main`` メソッドの本文で、4つの ``Runnable`` スレッドの配列を作成し、Webサービスの ``getFlower`` 操作をスレッドごとに一度コールするコードを追加します。*// The web service getFlower operation
+
+[start=7]
+. ``org.flower.service.FlowerService`` と ``org.flower.service.FlowerServiceService`` のインポート文を追加します。
+
+[start=8]
+. ``main`` メソッドの本文で、4つの ``Runnable`` スレッドの配列を作成し、Webサービスの ``getFlower`` 操作をスレッドごとに一度コールするコードを追加します。*// The web service getFlower operation
// is called 4 times, each in a separate thread.
// When the operation finishes the picture is shown in
// a specific button.*
@@ -388,8 +449,12 @@
new Thread(tasks[i]).start();
}
----
-9. ``org.flower.service.IOException_Exception`` のインポート文を追加します。
-10. the ``main`` メソッドの本文で、Webサービスの ``getThumbnails`` 操作を別スレッドでコールするコードを追加します。*// The web service getThumbnails operation is called
+
+[start=9]
+. ``org.flower.service.IOException_Exception`` のインポート文を追加します。
+
+[start=10]
+. the ``main`` メソッドの本文で、Webサービスの ``getThumbnails`` 操作を別スレッドでコールするコードを追加します。*// The web service getThumbnails operation is called
// in a separate thread, just after the previous four threads finish.
// When the images are downloaded, the thumbnails are shown at
// the bottom of the frame.*
@@ -423,7 +488,9 @@
new Thread(thumbsTask).start();
----
-11. ``Main.java`` のコードに貼り付けたときにインポートを修正していない場合は、インポートを修正します。エディタで右クリックし、コンテキスト・メニューから「インポートを修正」を選択すると、すべてのインポートを一度に修正できます。インポートするListクラスの選択肢が表示されたら、「 ``java.util.List`` 」を選択します。完成した一連のインポート文は次のようになります。
+
+[start=11]
+. ``Main.java`` のコードに貼り付けたときにインポートを修正していない場合は、インポートを修正します。エディタで右クリックし、コンテキスト・メニューから「インポートを修正」を選択すると、すべてのインポートを一度に修正できます。インポートするListクラスの選択肢が表示されたら、「 ``java.util.List`` 」を選択します。完成した一連のインポート文は次のようになります。
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_pt_BR.asciidoc
index 6a791e7..d5820e5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_pt_BR.asciidoc
@@ -44,13 +44,20 @@
5. => Criando o Cliente Swing
+[start=1]
1. <<create-client-app,Criando a Aplicação Cliente>>
-2. <<design-jframe,Projetando o JFrame>>
-3.
+
+[start=2]
+. <<design-jframe,Projetando o JFrame>>
+
+[start=3]
+.
<<bind-jframe,Vinculando os Componentes do JFrame>>
-4. <<code-main-class,Codificando a Classe Principal>>
+
+[start=4]
+. <<code-main-class,Codificando a Classe Principal>>
== Criando a Aplicação Cliente
@@ -64,7 +71,9 @@
3. Clique com o botão direito do mouse no nó do projeto ``FlowerClient`` e selecione Novo > Cliente de Web Service no menu de contexto. O assistente de Novo Cliente de Web Service será aberto.
4. Selecione o botão de opção URL WSDL e cole o URL do arquivo WSDL nesse campo. (Por default, o URL é ``http://localhost:8080/FlowerAlbumService/FlowerServiceService?wsdl`` . Localize o URL no browser testando o Web service e substituindo ``?Tester`` por ``?wsdl`` no final do URL.) Aceite todos os outros valores default, incluindo um nome de pacote em branco.
image::images/ws-client-wiz.png[]
-5. Clique em Finalizar. O IDE faz download do arquivo WSDL, adiciona stubs de cliente para interagir com o Web service e adiciona nós à janela Projetos no projeto de aplicação Java.
+
+[start=5]
+. Clique em Finalizar. O IDE faz download do arquivo WSDL, adiciona stubs de cliente para interagir com o Web service e adiciona nós à janela Projetos no projeto de aplicação Java.
image::images/client-generated-sources.png[title="Visualização Projetos mostrando o novo cliente do Web Service"]
@@ -78,14 +87,24 @@
1. Clique com o botão direito do mouse no nó ``FlowerClient`` e selecione Novo > Form JFrame. Chame o quadro de ``FlowerFrame`` . Coloque-o no pacote ``flowerclient`` .
2. ``FlowerFrame`` será aberto no editor. Abra a Paleta, se ainda não estiver aberta. Estenda o limite inferior do quadro em aproximadamente um terço.
image::images/opened-flowerform.png[]
-3. Arraste um JPanel da seção Contêineres Swing da Paleta para o ``FlowerFrame`` . Expanda-o para preencher o ``FlowerFrame`` inteiro.
+
+[start=3]
+. Arraste um JPanel da seção Contêineres Swing da Paleta para o ``FlowerFrame`` . Expanda-o para preencher o ``FlowerFrame`` inteiro.
image::images/add-panel.png[]
-4. Clique com o botão direito do mouse no Painel na View do Design. Selecione Alterar Nome da Variável... no menu de contexto. Defina o nome do painel como ``gardenFlowersPanel`` .
-5. Arraste um JLabel da Paleta para o início do `` gardenFlowersPanel`` . Clique com o botão direito do mouse no label e altere seu nome de variável para ``titleLabel`` . Clique com o botão direito do mouse novamente em ``titleLabel`` e selecione Editar Texto. Altere o texto para Flores do Jardim. Talvez você queira explorar as propriedades do ``titleLabel`` e dar a ele uma fonte de maior expressão.
-6. Arraste um Grupo de Botões para a view de design. Aceite o nome da variável default do grupo de botões, ``buttonGroup1`` .
-7. Arraste quatro Botões de Opções para uma linha horizontal abaixo do ``titleLabel`` . Nas propriedades de cada botão, defina-o como um membro de ``buttonGroup1`` . As outras propriedades dos botões são:
+
+[start=4]
+. Clique com o botão direito do mouse no Painel na View do Design. Selecione Alterar Nome da Variável... no menu de contexto. Defina o nome do painel como ``gardenFlowersPanel`` .
+
+[start=5]
+. Arraste um JLabel da Paleta para o início do `` gardenFlowersPanel`` . Clique com o botão direito do mouse no label e altere seu nome de variável para ``titleLabel`` . Clique com o botão direito do mouse novamente em ``titleLabel`` e selecione Editar Texto. Altere o texto para Flores do Jardim. Talvez você queira explorar as propriedades do ``titleLabel`` e dar a ele uma fonte de maior expressão.
+
+[start=6]
+. Arraste um Grupo de Botões para a view de design. Aceite o nome da variável default do grupo de botões, ``buttonGroup1`` .
+
+[start=7]
+. Arraste quatro Botões de Opções para uma linha horizontal abaixo do ``titleLabel`` . Nas propriedades de cada botão, defina-o como um membro de ``buttonGroup1`` . As outras propriedades dos botões são:
|===
-Botões de Opção em ButtonGroup1
+|Botões de Opção em ButtonGroup1
|Nome da Variável |Selecionado |Texto
@@ -97,13 +116,27 @@
|sunflowerRadioButton |falso |Girassol
|===
-8. Arraste um Painel de Rolagem para baixo dos botões de opções. Expanda-o para preencher todo o espaço horizontal e cerca de dois terços do espaço vertical livre. Altere o nome da variável do painel de rolagem para ``mainScrollPane`` .
-9. Arraste um Painel para o ``mainScrollPane`` . Altere o nome da variável do Painel para ``mainPanel`` .
-10. Na view Design, clique com o botão direito do mouse no ``mainPanel`` e selecione Definir layout > Layout da Borda.
-11. Arraste um Botão para o ``mainPanel`` . Como o ``mainPanel`` tem layout de borda, o botão automaticamente preenche todo o painel. Altere o nome da variável do botão para ``mainPictureButton`` e mude o texto do botão para "Aguardando imagem..."
-12. Arraste outro Painel de Rolagem para o espaço abaixo do ``mainScrollPane`` . Expanda o novo painel de rolagem para preencher todo o espaço livre remanescente. Altere o nome da variável do novo painel de rolagem para ``thumbnailScrollPane`` .
-13. Arraste um Painel para o ``thumbnailScrollPane`` . Altere o nome da variável do Painel para ``thumbnailPanel`` . Defina o layout do ``thumbnailPanel`` para Layout de Grade.
-14. Arraste quatro Botões para o ``thumbnailPanel`` Como o ``thumbnailPanel`` tem Layout de Grade, os botões são automaticamente de mesmo tamanho e preenchem o painel completamente. As propriedades dos botões são: Botões no thumbnailPanel
+
+[start=8]
+. Arraste um Painel de Rolagem para baixo dos botões de opções. Expanda-o para preencher todo o espaço horizontal e cerca de dois terços do espaço vertical livre. Altere o nome da variável do painel de rolagem para ``mainScrollPane`` .
+
+[start=9]
+. Arraste um Painel para o ``mainScrollPane`` . Altere o nome da variável do Painel para ``mainPanel`` .
+
+[start=10]
+. Na view Design, clique com o botão direito do mouse no ``mainPanel`` e selecione Definir layout > Layout da Borda.
+
+[start=11]
+. Arraste um Botão para o ``mainPanel`` . Como o ``mainPanel`` tem layout de borda, o botão automaticamente preenche todo o painel. Altere o nome da variável do botão para ``mainPictureButton`` e mude o texto do botão para "Aguardando imagem..."
+
+[start=12]
+. Arraste outro Painel de Rolagem para o espaço abaixo do ``mainScrollPane`` . Expanda o novo painel de rolagem para preencher todo o espaço livre remanescente. Altere o nome da variável do novo painel de rolagem para ``thumbnailScrollPane`` .
+
+[start=13]
+. Arraste um Painel para o ``thumbnailScrollPane`` . Altere o nome da variável do Painel para ``thumbnailPanel`` . Defina o layout do ``thumbnailPanel`` para Layout de Grade.
+
+[start=14]
+. Arraste quatro Botões para o ``thumbnailPanel`` Como o ``thumbnailPanel`` tem Layout de Grade, os botões são automaticamente de mesmo tamanho e preenchem o painel completamente. As propriedades dos botões são: Botões no thumbnailPanel
|===
|Nome da Variável |Texto
@@ -134,22 +167,22 @@
1. Alterne para a view de Código-fonte do editor. Localize o início do corpo da classe ``FlowerFrame`` e o construtor ``FlowerFrame`` .
image::images/ff-empty-constructor.png[]
-1. Na parte superior do corpo da classe do ``FlowerFrame`` , antes do construtor, crie um array de strings dos nomes de cada flor.
+. Na parte superior do corpo da classe do ``FlowerFrame`` , antes do construtor, crie um array de strings dos nomes de cada flor.
[source,java]
----
protected static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-1. Entre o array da string FLOWERS e o construtor, adicione uma linha que inicialize um ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` denominado ``flores`` . O mapa utiliza uma ``String`` e a mapeia para uma ``Image`` .
+. Entre o array da string FLOWERS e o construtor, adicione uma linha que inicialize um ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` denominado ``flores`` . O mapa utiliza uma ``String`` e a mapeia para uma ``Image`` .
[source,java]
----
private Map<String, Image> flowers;
----
-1. Adicione instruções de importação para ``java.util.Map`` e ``java.awt.Image`` .
-2. Adicione código ao construtor ``FlowerFrame`` para associar uma ``Image`` específica a uma ``String`` específica de uma instância específica do mapa ``flowers``
+. Adicione instruções de importação para ``java.util.Map`` e ``java.awt.Image`` .
+. Adicione código ao construtor ``FlowerFrame`` para associar uma ``Image`` específica a uma ``String`` específica de uma instância específica do mapa ``flowers``
[source,java]
----
@@ -164,7 +197,9 @@
initComponents();
}
----
-3. Inicialize ``ItemListener`` s para os botões de opções e ``ActionListener`` s para os quatro botões de flores e defina o título default.
+
+[start=3]
+. Inicialize ``ItemListener`` s para os botões de opções e ``ActionListener`` s para os quatro botões de flores e defina o título default.
[source,java]
----
@@ -193,7 +228,9 @@
sunflowerButton.addActionListener(bListener);
}
----
-4. Adicione instruções de importação para ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` e ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` .
+
+[start=4]
+. Adicione instruções de importação para ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` e ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` .
Agora, o construtor está completo. Você receberá advertências de erros de compilação no código porque ele não contém as classes ``RBListener`` e ``ButtonListener`` . Essas duas classes são implementações personalizadas do ``ItemListener`` e ``ActionListener`` , respectivamente. Você escreverá essas duas classes na próxima seção.
@@ -205,7 +242,7 @@
]]
1. Encontre o método ``public static void main(String args[])`` no corpo da classe ``FlowerFrame`` . Delete esse método e sua documentação. (A aplicação utilizará a classe ``Main`` .)
-1. No lugar do método ``main`` , escreva um ``ItemListener`` personalizado para os botões de opções. Esse listener mostrará uma nova imagem de flor quando um botão de opção for selecionado.
+. No lugar do método ``main`` , escreva um ``ItemListener`` personalizado para os botões de opções. Esse listener mostrará uma nova imagem de flor quando um botão de opção for selecionado.
[source,java]
----
@@ -216,8 +253,8 @@
}
}
----
-1. Adicione uma instrução de importação para ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` .
-1. Abaixo do ``ItemListener`` personalizado, escreva um ``ActionListener`` personalizado para os quatro botões de flores. Quando um botão for clicado, o listener selecionará o botão de opção relacionado:
+. Adicione uma instrução de importação para ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` .
+. Abaixo do ``ItemListener`` personalizado, escreva um ``ActionListener`` personalizado para os quatro botões de flores. Quando um botão for clicado, o listener selecionará o botão de opção relacionado:
[source,java]
----
@@ -232,8 +269,12 @@
}
}
----
-2. Adicione uma instrução de importação para ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` .
-3. Abaixo do ``ActionListener`` personalizado, escreva o método ``showFlower`` . Esse método determina o botão de opção selecionado e obtém uma ``Image`` da flor correspondente a partir do mapa ``flowers`` .
+
+[start=2]
+. Adicione uma instrução de importação para ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` .
+
+[start=3]
+. Abaixo do ``ActionListener`` personalizado, escreva o método ``showFlower`` . Esse método determina o botão de opção selecionado e obtém uma ``Image`` da flor correspondente a partir do mapa ``flowers`` .
[source,java]
----
@@ -272,8 +313,12 @@
} else mainPictureButton.setText("");
}
----
-4. Adicione uma instrução de importação para ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` .
-5. Escreva o método ``setThumbnails`` . Esse método obtém uma imagem para cada miniatura do mapa ``flowers`` . A classe ``Main`` chama esse método.
+
+[start=4]
+. Adicione uma instrução de importação para ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` .
+
+[start=5]
+. Escreva o método ``setThumbnails`` . Esse método obtém uma imagem para cada miniatura do mapa ``flowers`` . A classe ``Main`` chama esse método.
[source,java]
----
@@ -301,7 +346,9 @@
}
}
----
-6. Corrija as importações em ``FlowerFrame`` , caso elas não tenham sido corrigidas quando foram coladas no código. É possível corrigir todas de uma vez clicando com o botão direito do mouse no editor e selecionando Corrigir Importações, no menu de contexto. O conjunto completo de instruções de importação é:
+
+[start=6]
+. Corrija as importações em ``FlowerFrame`` , caso elas não tenham sido corrigidas quando foram coladas no código. É possível corrigir todas de uma vez clicando com o botão direito do mouse no editor e selecionando Corrigir Importações, no menu de contexto. O conjunto completo de instruções de importação é:
[source,java]
----
@@ -318,14 +365,18 @@
1. Abra a classe ``Main.java`` no editor.
image::images/main-empty.png[]
-2. No corpo da classe, antes do método ``principal`` , inicialize uma variável ``int`` para a quantidade de imagens obtidas por download.
+
+[start=2]
+. No corpo da classe, antes do método ``principal`` , inicialize uma variável ``int`` para a quantidade de imagens obtidas por download.
[source,java]
----
private static int downloadedPictures;
----
-3. No corpo do método ``main`` , crie um ``HashMap`` de quatro flores e outro ``HashMap`` de quatro miniaturas.
+
+[start=3]
+. No corpo do método ``main`` , crie um ``HashMap`` de quatro flores e outro ``HashMap`` de quatro miniaturas.
[source,java]
----
@@ -333,8 +384,12 @@
final Map<String,Image> flowers = new HashMap<String,Image>(4);
final Map<String,Image> thumbs = new HashMap<String,Image>(4);
----
-4. Adicione instruções de importação para ``java.awt.Image`` , ``java.util.Map`` e ``java.util.HashMap`` .
-5. No corpo do método ``main`` , adicione código para mostrar o ``FlowerFrame`` .*// Show the FlowerFrame.*
+
+[start=4]
+. Adicione instruções de importação para ``java.awt.Image`` , ``java.util.Map`` e ``java.util.HashMap`` .
+
+[start=5]
+. No corpo do método ``main`` , adicione código para mostrar o ``FlowerFrame`` .*// Show the FlowerFrame.*
[source,java]
----
@@ -342,7 +397,9 @@
final FlowerFrame frame = new FlowerFrame(flowers);
frame.setVisible(true);
----
-6. No corpo do método ``main`` , adicione o código para conectar o cliente ao serviço.*// The client connects to the service with this code.*
+
+[start=6]
+. No corpo do método ``main`` , adicione o código para conectar o cliente ao serviço.*// The client connects to the service with this code.*
[source,java]
----
@@ -350,8 +407,12 @@
FlowerServiceService service = new FlowerServiceService();
final FlowerService port = service.getFlowerServicePort();
----
-7. Adicione instruções de importação para ``org.flower.service.FlowerService`` e ``org.flower.service.FlowerServiceService`` .
-8. No corpo do método ``main`` , adicione o código que cria um array de quatro threads ``Runnable`` e chama a operação ``getFlower`` do Web service uma vez em cada thread.*// The web service getFlower operation
+
+[start=7]
+. Adicione instruções de importação para ``org.flower.service.FlowerService`` e ``org.flower.service.FlowerServiceService`` .
+
+[start=8]
+. No corpo do método ``main`` , adicione o código que cria um array de quatro threads ``Runnable`` e chama a operação ``getFlower`` do Web service uma vez em cada thread.*// The web service getFlower operation
// is called 4 times, each in a separate thread.
// When the operation finishes the picture is shown in
// a specific button.*
@@ -388,8 +449,12 @@
new Thread(tasks[i]).start();
}
----
-9. Adicione uma instrução de importação para ``org.flower.service.IOException_Exception`` .
-10. No corpo do método ``principal`` , adicione o código que chama a operação ``getThumbnails`` do Web service em um thread separado.*// The web service getThumbnails operation is called
+
+[start=9]
+. Adicione uma instrução de importação para ``org.flower.service.IOException_Exception`` .
+
+[start=10]
+. No corpo do método ``principal`` , adicione o código que chama a operação ``getThumbnails`` do Web service em um thread separado.*// The web service getThumbnails operation is called
// in a separate thread, just after the previous four threads finish.
// When the images are downloaded, the thumbnails are shown at
// the bottom of the frame.*
@@ -423,7 +488,9 @@
new Thread(thumbsTask).start();
----
-11. Corrija as importações em ``Main.java`` , caso elas não tenham sido corrigidas quando foram coladas no código. É possível corrigir todas de uma vez clicando com o botão direito do mouse no editor e selecionando Corrigir Importações, no menu de contexto. Você verá uma Lista de classes para importação; selecione ``java.util.List`` . O conjunto completo de instruções de importação é:
+
+[start=11]
+. Corrija as importações em ``Main.java`` , caso elas não tenham sido corrigidas quando foram coladas no código. É possível corrigir todas de uma vez clicando com o botão direito do mouse no editor e selecionando Corrigir Importações, no menu de contexto. Você verá uma Lista de classes para importação; selecione ``java.util.List`` . O conjunto completo de instruções de importação é:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ru.asciidoc
index 9f4f1d0..17ca65d 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_ru.asciidoc
@@ -44,13 +44,20 @@
5. => Создание клиента Swing
+[start=1]
1. <<create-client-app,Создание приложения клиента>>
-2. <<design-jframe,Проектирование JFrame>>
-3.
+
+[start=2]
+. <<design-jframe,Проектирование JFrame>>
+
+[start=3]
+.
<<bind-jframe,Привязка компонентов JFrame>>
-4. <<code-main-class,Написание кода главного класса>>
+
+[start=4]
+. <<code-main-class,Написание кода главного класса>>
== Создание клиента приложения
@@ -64,7 +71,9 @@
3. Щелкните правой кнопкой мыши узел проекта ``FlowerClient`` и последовательно выберите в контекстном меню команды "Создать" > "Клиент веб-службы". Появится мастер создания клиента веб-службы.
4. Выберите переключатель "URL-адрес WSDL" и вставьте в соответствующее поле URL-адрес файла WSDL. По умолчанию URL-адресом является ``http://localhost:8080/FlowerAlbumService/FlowerServiceService?wsdl`` . URL-адрес можно найти в браузере, выполнив тестирование веб-службы и заменив текст ``?Tester`` на ``?wsdl`` в конце URL-адреса. Примите все прочие значения по умолчанию, включая пустое имя пакета.
image::images/ws-client-wiz.png[]
-5. Нажмите кнопку "Завершить". В среде IDE выполняется загрузка файла WSDL, добавление заглушек клиента для взаимодействия с веб-службой, а также добавление узлов в проект приложения на Java в окне "Проекты".
+
+[start=5]
+. Нажмите кнопку "Завершить". В среде IDE выполняется загрузка файла WSDL, добавление заглушек клиента для взаимодействия с веб-службой, а также добавление узлов в проект приложения на Java в окне "Проекты".
image::images/client-generated-sources.png[title="Представление проекта, в котором отображается новый клиент веб-службы"]
@@ -78,14 +87,24 @@
1. Щелкните правой кнопкой мыши узел ``FlowerClient`` и выберите пункт "Создать", а затем – "Форма JFrame". Присвойте фрейму имя ``FlowerFrame`` . Разместите его в пакете ``flowerclient`` .
2. Фрейм ``FlowerFrame`` будет открыт в редакторе. Откройте палитру (если она еще не открыта). Растяните нижнюю границу фрейма приблизительно на одну треть.
image::images/opened-flowerform.png[]
-3. Перетащите панель JPanel из раздела "Контейнеры Swing" на палитре в фрейм ``FlowerFrame`` . Разверните панель, чтобы она заполнила все пространство фрейма ``FlowerFrame`` .
+
+[start=3]
+. Перетащите панель JPanel из раздела "Контейнеры Swing" на палитре в фрейм ``FlowerFrame`` . Разверните панель, чтобы она заполнила все пространство фрейма ``FlowerFrame`` .
image::images/add-panel.png[]
-4. Щелкните правой кнопкой мыши панель в представлении "Проектирование". Выберите в контекстном меню пункт "Изменить имя переменной...". Присвойте панели имя ``gardenFlowersPanel`` .
-5. Перетащите метку JLabel из палитры в верхнюю область панели `` gardenFlowersPanel`` . Щелкните метку правой кнопкой мыши и измените имя переменной метки на ``titleLabel`` . Снова щелкните правой кнопкой мыши метку ``titleLabel`` и выберите пункт "Изменить текст". Измените текст на "Garden Flowers". Можно также изучить свойства ``titleLabel`` и увеличить шрифт.
-6. Перетащите группу кнопок в представление "Проектирование". Примите имя группы кнопок ``buttonGroup1`` , заданное по умолчанию.
-7. Перетащите четыре переключателя в горизонтальный ряд под меткой ``titleLabel`` . В свойствах каждого переключателя укажите, что он является компонентом группы кнопок ``buttonGroup1`` . Для других свойств переключателей действительны следующие свойства:
+
+[start=4]
+. Щелкните правой кнопкой мыши панель в представлении "Проектирование". Выберите в контекстном меню пункт "Изменить имя переменной...". Присвойте панели имя ``gardenFlowersPanel`` .
+
+[start=5]
+. Перетащите метку JLabel из палитры в верхнюю область панели `` gardenFlowersPanel`` . Щелкните метку правой кнопкой мыши и измените имя переменной метки на ``titleLabel`` . Снова щелкните правой кнопкой мыши метку ``titleLabel`` и выберите пункт "Изменить текст". Измените текст на "Garden Flowers". Можно также изучить свойства ``titleLabel`` и увеличить шрифт.
+
+[start=6]
+. Перетащите группу кнопок в представление "Проектирование". Примите имя группы кнопок ``buttonGroup1`` , заданное по умолчанию.
+
+[start=7]
+. Перетащите четыре переключателя в горизонтальный ряд под меткой ``titleLabel`` . В свойствах каждого переключателя укажите, что он является компонентом группы кнопок ``buttonGroup1`` . Для других свойств переключателей действительны следующие свойства:
|===
-Переключатели в группе кнопок buttonGroup1
+|Переключатели в группе кнопок buttonGroup1
|Имя переменной |Выбрано |Текст
@@ -97,13 +116,27 @@
|sunflowerRadioButton |false |Sunflower
|===
-8. Перетащите панель с прокруткой в область под переключателями. Разверните панель, чтобы она заполнила всю область по горизонтали и приблизительно две трети свободной области по вертикали. Измените имя переменной панели с прокруткой на ``mainScrollPane`` .
-9. Перетащите панели на панель ``mainScrollPane`` . Измените имя переменной панели на ``mainPanel`` .
-10. В представление 'Конструирование' щелкните правой кнопкой мыши ``mainPanel`` и выберите 'Настроить макет' > 'Макет границ'.
-11. Перетащите кнопку на панель ``mainPanel`` . Поскольку панель ``mainPanel`` имеет границы, кнопка автоматически заполняет все пространство панели. Измените имя переменной кнопки на ``mainPictureButton`` , и введите для кнопки текст "Waiting for picture..."
-12. Перетащите еще одну панель с прокруткой в область под панелью ``mainScrollPane`` . Разверните новую панель с прокруткой, чтобы она заполнила все свободное пространство. Измените имя переменной новой панели с прокруткой на ``thumbnailScrollPane`` .
-13. Перетащите панель из палитры на панель ``thumbnailScrollPane`` . Измените имя переменной панели на ``thumbnailPanel`` . Установите в качестве формата панели ``thumbnailPanel`` формат сетки.
-14. Перетащите четыре кнопки на панель ``thumbnailPanel`` . Поскольку панель ``thumbnailPanel`` имеет формат сетки, кнопки автоматически становятся одинакового размера и полностью заполняют панель. Свойства кнопок Кнопки на панели thumbnailPanel
+
+[start=8]
+. Перетащите панель с прокруткой в область под переключателями. Разверните панель, чтобы она заполнила всю область по горизонтали и приблизительно две трети свободной области по вертикали. Измените имя переменной панели с прокруткой на ``mainScrollPane`` .
+
+[start=9]
+. Перетащите панели на панель ``mainScrollPane`` . Измените имя переменной панели на ``mainPanel`` .
+
+[start=10]
+. В представление 'Конструирование' щелкните правой кнопкой мыши ``mainPanel`` и выберите 'Настроить макет' > 'Макет границ'.
+
+[start=11]
+. Перетащите кнопку на панель ``mainPanel`` . Поскольку панель ``mainPanel`` имеет границы, кнопка автоматически заполняет все пространство панели. Измените имя переменной кнопки на ``mainPictureButton`` , и введите для кнопки текст "Waiting for picture..."
+
+[start=12]
+. Перетащите еще одну панель с прокруткой в область под панелью ``mainScrollPane`` . Разверните новую панель с прокруткой, чтобы она заполнила все свободное пространство. Измените имя переменной новой панели с прокруткой на ``thumbnailScrollPane`` .
+
+[start=13]
+. Перетащите панель из палитры на панель ``thumbnailScrollPane`` . Измените имя переменной панели на ``thumbnailPanel`` . Установите в качестве формата панели ``thumbnailPanel`` формат сетки.
+
+[start=14]
+. Перетащите четыре кнопки на панель ``thumbnailPanel`` . Поскольку панель ``thumbnailPanel`` имеет формат сетки, кнопки автоматически становятся одинакового размера и полностью заполняют панель. Свойства кнопок Кнопки на панели thumbnailPanel
|===
|Имя переменной |Текст
@@ -134,22 +167,22 @@
1. Перейдите в представление "Исходный код" в редакторе. Найдите начало тела класса ``FlowerFrame`` и конструктор ``FlowerFrame`` .
image::images/ff-empty-constructor.png[]
-1. В верхней части тела класса фрейма ``FlowerFrame`` создайте над строкой конструктора массив строк с названиями всех цветов.
+. В верхней части тела класса фрейма ``FlowerFrame`` создайте над строкой конструктора массив строк с названиями всех цветов.
[source,java]
----
protected static final String[] FLOWERS = {"aster", "honeysuckle", "rose", "sunflower"};
----
-1. Добавьте между массивом строк FLOWERS и конструктором строку, инициализирующую элемент ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` с именем ``flowers`` . Карта ссылок принимает объект ``String`` и устанавливает его соответствие с объектом ``Image`` .
+. Добавьте между массивом строк FLOWERS и конструктором строку, инициализирующую элемент ``link:http://download.oracle.com/javase/6/docs/api/java/util/Map.html[+java.util.Map+]`` с именем ``flowers`` . Карта ссылок принимает объект ``String`` и устанавливает его соответствие с объектом ``Image`` .
[source,java]
----
private Map<String, Image> flowers;
----
-1. Добавьте операторы импорта для ``java.util.Map`` и ``java.awt.Image`` .
-2. Добавьте код в конструктор ``FlowerFrame`` , чтобы связать определенный объект ``Image`` с определенным объектом ``String`` для определенного экземпляра карты ссылок ``flowers`` .
+. Добавьте операторы импорта для ``java.util.Map`` и ``java.awt.Image`` .
+. Добавьте код в конструктор ``FlowerFrame`` , чтобы связать определенный объект ``Image`` с определенным объектом ``String`` для определенного экземпляра карты ссылок ``flowers`` .
[source,java]
----
@@ -164,7 +197,9 @@
initComponents();
}
----
-3. Инициализируйте прослушиватели ``ItemListener`` для переключателей, а также прослушиватели ``ActionListener`` для четырех кнопок цветов и установите заголовок по умолчанию.
+
+[start=3]
+. Инициализируйте прослушиватели ``ItemListener`` для переключателей, а также прослушиватели ``ActionListener`` для четырех кнопок цветов и установите заголовок по умолчанию.
[source,java]
----
@@ -193,7 +228,9 @@
sunflowerButton.addActionListener(bListener);
}
----
-4. Добавьте операторы импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` и ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` .
+
+[start=4]
+. Добавьте операторы импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` и ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` .
Конструктор готов. В коде выводятся сообщения об ошибках, поскольку код не содержит классы ``RBListener`` и ``ButtonListener`` . Эти два класса представляют собой реализации прослушивателей ``ItemListener`` и ``ActionListener`` , соответственно. Запись этих классов в код рассматривается в следующем разделе.
@@ -205,7 +242,7 @@
]]
1. Найдите метод ``public static void main(String args[])`` в теле класса ``FlowerFrame`` . Удалите этот метод и его документацию. (Вместо него в приложении будет использован класс ``Main`` .)
-1. Напишите вместо метода ``main`` пользовательский прослушиватель ``ItemListener`` для переключателей. Этот прослушиватель служит для отображения нового изображения цветка при выборе переключателя.
+. Напишите вместо метода ``main`` пользовательский прослушиватель ``ItemListener`` для переключателей. Этот прослушиватель служит для отображения нового изображения цветка при выборе переключателя.
[source,java]
----
@@ -216,8 +253,8 @@
}
}
----
-1. Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` .
-1. Запишите под пользовательским прослушивателем ``ItemListener`` пользовательский прослушиватель ``ActionListener`` для четырех кнопок цветов. При нажатии кнопки прослушиватель выбирает соответствующий переключатель:
+. Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` .
+. Запишите под пользовательским прослушивателем ``ItemListener`` пользовательский прослушиватель ``ActionListener`` для четырех кнопок цветов. При нажатии кнопки прослушиватель выбирает соответствующий переключатель:
[source,java]
----
@@ -232,8 +269,12 @@
}
}
----
-2. Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` .
-3. Напишите под пользовательским прослушивателем ``ActionListener`` метод ``showFlower`` . Этот метод определяет выбранный переключатель и получает объект ``Image`` для соответствующего цветка из карты ссылок ``flowers`` .
+
+[start=2]
+. Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` .
+
+[start=3]
+. Напишите под пользовательским прослушивателем ``ActionListener`` метод ``showFlower`` . Этот метод определяет выбранный переключатель и получает объект ``Image`` для соответствующего цветка из карты ссылок ``flowers`` .
[source,java]
----
@@ -272,8 +313,12 @@
} else mainPictureButton.setText("");
}
----
-4. Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` .
-5. Напишите метод ``setThumbnails`` . Этот метод получает изображение для каждого эскиза из карты ссылок ``flowers`` . Метод вызывается посредством класса ``Main`` .
+
+[start=4]
+. Добавьте оператор импорта для ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` .
+
+[start=5]
+. Напишите метод ``setThumbnails`` . Этот метод получает изображение для каждого эскиза из карты ссылок ``flowers`` . Метод вызывается посредством класса ``Main`` .
[source,java]
----
@@ -301,7 +346,9 @@
}
}
----
-6. Исправьте операторы импорта ``FlowerFrame`` , если они не были исправлены ранее при вставке в код. Можно исправить все ошибки одновременно, щелкнув правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' в контекстном меню. Ниже представлен полный список операторов импорта:
+
+[start=6]
+. Исправьте операторы импорта ``FlowerFrame`` , если они не были исправлены ранее при вставке в код. Можно исправить все ошибки одновременно, щелкнув правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' в контекстном меню. Ниже представлен полный список операторов импорта:
[source,java]
----
@@ -318,14 +365,18 @@
1. Откройте класс ``Main.java`` в редакторе.
image::images/main-empty.png[]
-2. В теле класса инициализируйте переменную ``int`` перед методом ``main`` для числа загруженных изображений.
+
+[start=2]
+. В теле класса инициализируйте переменную ``int`` перед методом ``main`` для числа загруженных изображений.
[source,java]
----
private static int downloadedPictures;
----
-3. Создайте в теле метода ``main`` хранилище ``HashMap`` для четырех изображений цветов и второе хранилище ``HashMap`` для четырех эскизов.
+
+[start=3]
+. Создайте в теле метода ``main`` хранилище ``HashMap`` для четырех изображений цветов и второе хранилище ``HashMap`` для четырех эскизов.
[source,java]
----
@@ -333,8 +384,12 @@
final Map<String,Image> flowers = new HashMap<String,Image>(4);
final Map<String,Image> thumbs = new HashMap<String,Image>(4);
----
-4. Добавьте операторы импорта ``java.awt.Image`` , ``java.util.Map`` и ``java.util.HashMap`` .
-5. Добавьте в тело метода ``main`` код для отображения ``FlowerFrame`` .*// Show the FlowerFrame.*
+
+[start=4]
+. Добавьте операторы импорта ``java.awt.Image`` , ``java.util.Map`` и ``java.util.HashMap`` .
+
+[start=5]
+. Добавьте в тело метода ``main`` код для отображения ``FlowerFrame`` .*// Show the FlowerFrame.*
[source,java]
----
@@ -342,7 +397,9 @@
final FlowerFrame frame = new FlowerFrame(flowers);
frame.setVisible(true);
----
-6. Добавьте в тело метода ``main`` код для подключения клиента к веб-службе.*// The client connects to the service with this code.*
+
+[start=6]
+. Добавьте в тело метода ``main`` код для подключения клиента к веб-службе.*// The client connects to the service with this code.*
[source,java]
----
@@ -350,8 +407,12 @@
FlowerServiceService service = new FlowerServiceService();
final FlowerService port = service.getFlowerServicePort();
----
-7. Добавьте операторы импорта для ``org.flower.service.FlowerService`` и ``org.flower.service.FlowerServiceService`` .
-8. Добавьте в тело метода ``main`` код для создания массива четырех потоков ``Runnable`` и вызова операции ``getFlower`` веб-службы в каждом потоке.*// The web service getFlower operation
+
+[start=7]
+. Добавьте операторы импорта для ``org.flower.service.FlowerService`` и ``org.flower.service.FlowerServiceService`` .
+
+[start=8]
+. Добавьте в тело метода ``main`` код для создания массива четырех потоков ``Runnable`` и вызова операции ``getFlower`` веб-службы в каждом потоке.*// The web service getFlower operation
// is called 4 times, each in a separate thread.
// When the operation finishes the picture is shown in
// a specific button.*
@@ -388,8 +449,12 @@
new Thread(tasks[i]).start();
}
----
-9. Добавьте оператор импорта для ``org.flower.service.IOException_Exception`` .
-10. Добавьте в тело метода ``main`` код для вызова операции ``getThumbnails`` веб-службы в отдельном потоке.*// The web service getThumbnails operation is called
+
+[start=9]
+. Добавьте оператор импорта для ``org.flower.service.IOException_Exception`` .
+
+[start=10]
+. Добавьте в тело метода ``main`` код для вызова операции ``getThumbnails`` веб-службы в отдельном потоке.*// The web service getThumbnails operation is called
// in a separate thread, just after the previous four threads finish.
// When the images are downloaded, the thumbnails are shown at
// the bottom of the frame.*
@@ -423,7 +488,9 @@
new Thread(thumbsTask).start();
----
-11. Исправьте операторы импорта в ``Main.java`` , если они не были исправлены при вставке в код. Можно исправить все ошибки одновременно, щелкнув правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' в контекстном меню. Будет предоставлен список классов List для импорта; выберите ``java.util.List`` . Ниже представлен полный список операторов импорта:
+
+[start=11]
+. Исправьте операторы импорта в ``Main.java`` , если они не были исправлены при вставке в код. Можно исправить все ошибки одновременно, щелкнув правой кнопкой мыши в редакторе и выберите 'Исправить выражения импорта' в контекстном меню. Будет предоставлен список классов List для импорта; выберите ``java.util.List`` . Ниже представлен полный список операторов импорта:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_zh_CN.asciidoc
index 90f9d2d..da064fc 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_swing_zh_CN.asciidoc
@@ -44,13 +44,20 @@
*本课内容*
+[start=1]
1. <<create-client-app,创建客户端应用程序>>
-2. <<design-jframe,设计 JFrame>>
-3.
+
+[start=2]
+. <<design-jframe,设计 JFrame>>
+
+[start=3]
+.
<<bind-jframe,绑定 JFrame 组件>>
-4. <<code-main-class,对 Main 类进行编码>>
+
+[start=4]
+. <<code-main-class,对 Main 类进行编码>>
== 创建客户端应用程序
@@ -64,7 +71,9 @@
3. 右键单击 ``FlowerClient`` 项目节点,然后从上下文菜单选择 "New"(新建)> "Web Service Client"(Web 服务客户端)。此时将打开新建 Web 服务客户端向导。
4. 选择 WSDL URL 单选按钮,并将 WSDL 文件的 URL 粘贴到该字段。(默认情况下,该 URL 为 ``http://localhost:8080/FlowerAlbumService/FlowerServiceService?wsdl`` 。在浏览器中查找 URL,方法是测试 Web 服务,然后将 URL 末尾的 ``?Tester`` 替换为 ``?wsdl`` 。)接受其他所有默认值,包括空的包名称。
image::images/ws-client-wiz.png[]
-5. 单击 "Finish"(完成)。IDE 将下载该 WSDL 文件,添加与 Web 服务交互的客户端桩模块,并在 "Projects"(项目)窗口的 Java 应用程序项目中添加节点。
+
+[start=5]
+. 单击 "Finish"(完成)。IDE 将下载该 WSDL 文件,添加与 Web 服务交互的客户端桩模块,并在 "Projects"(项目)窗口的 Java 应用程序项目中添加节点。
image::images/client-generated-sources.png[title="显示新建 Web 服务客户端的项目视图"]
@@ -78,14 +87,25 @@
1. 右键单击 ``FlowerClient`` 节点,然后选择 "New"(新建)> "JFrame Form"(JFrame 窗体)。将该窗体命名为 ``FlowerFrame`` 。并且,将其置于 ``flowerclient`` 包中。
2. ``FlowerFrame`` 在编辑器中打开。如果 "Palette"(组件面板)尚未打开,请将其打开。扩展框架的底边框大约三分之一。
image::images/opened-flowerform.png[]
-3. 将 JPanel 从 "Palette"(组件面板)的 "Swing Container"(Swing 容器)部分拖至 ``FlowerFrame`` 。扩展该而板以填充整个 ``FlowerFrame`` 。
+
+[start=3]
+. 将 JPanel 从 "Palette"(组件面板)的 "Swing Container"(Swing 容器)部分拖至 ``FlowerFrame`` 。扩展该而板以填充整个 ``FlowerFrame`` 。
image::images/add-panel.png[]
-4. 右键单击 "Design"(设计)视图中的 "Panel"(面板)。从上下文菜单中选择 "Change Variable Name... "(更改变量名称...)。将该面板命名为 ``gardenFlowersPanel`` 。
-5. 将 JLabel 从 "Palette"(组件面板)拖至 ``gardenFlowersPanel`` 的顶部。右键单击标签,然后将标签的变量名称更改为 ``titleLabel`` 。再次右键单击 ``titleLabel`` 然后选择 "Edit Text"(编辑文本)。将文本更改为 "Garden Flowers"。可能希望浏览 ``titleLabel`` 的属性,并为其设置一个醒目的字体。
-6. 将 "Button Group"(按钮组)拖至设计视图中。接受按钮组的默认变量名称 ``buttonGroup1`` 。
-7. 将四个单选按钮拖至 ``titleLabel`` 下面的水平行中。在每个按钮的属性中,将其设置为 ``buttonGroup1`` 的成员。按钮的其他属性如下:
+
+[start=4]
+. 右键单击 "Design"(设计)视图中的 "Panel"(面板)。从上下文菜单中选择 "Change Variable Name... "(更改变量名称...)。将该面板命名为 ``gardenFlowersPanel`` 。
+
+[start=5]
+. 将 JLabel 从 "Palette"(组件面板)拖至 ``gardenFlowersPanel`` 的顶部。右键单击标签,然后将标签的变量名称更改为 ``titleLabel`` 。再次右键单击 ``titleLabel`` 然后选择 "Edit Text"(编辑文本)。将文本更改为 "Garden Flowers"。可能希望浏览 ``titleLabel`` 的属性,并为其设置一个醒目的字体。
+
+[start=6]
+. 将 "Button Group"(按钮组)拖至设计视图中。接受按钮组的默认变量名称 ``buttonGroup1`` 。
+
+[start=7]
+. 将四个单选按钮拖至 ``titleLabel`` 下面的水平行中。在每个按钮的属性中,将其设置为 ``buttonGroup1`` 的成员。按钮的其他属性如下:
+
|===
-buttonGroup1 中的单选按钮
+|buttonGroup1 中的单选按钮
|变量名称 |已选定 |文本
@@ -97,13 +117,27 @@
|sunflowerRadioButton |false |向日葵
|===
-8. 将 "Scroll Pane"(滚动窗格)拖至单选按钮的下方。扩展该窗格以填充全部水平空间以及大约三分之二的空余垂直空间。将滚动窗格的变量名称更改为 ``mainScrollPane`` 。
-9. 将 "Panel"(面板)拖至 ``mainScrollPane`` 中。将面板的变量名称更改为 ``mainPanel`` 。
-10. 在 "Design"(设计)视图中,右键单击 ``mainPanel`` 然后选择 "Set Layout"(设置布局)> "Border Layout"(边框式布局)。
-11. 将 "Button"(按钮)拖至 ``mainPanel`` 中。因为 ``mainPanel`` 具有边框式布局,所以按钮将自动填充整个面板。将按钮的变量名称更改为 ``mainPictureButton`` 并将按钮的文本更改为 "Waiting for picture..."
-12. 再将一个滚动窗格拖至 ``mainScrollPane`` 下面的空间中。扩展新滚动窗格以填满全部剩余空间。将新滚动窗格的变量名称更改为 ``thumbnailScrollPane`` 。
-13. 将 "Panel"(面板)拖至 ``thumbnailScrollPane`` 中。将面板的变量名称更改为 ``thumbnailPanel`` 。将 ``thumbnailPanel`` 的布局设置为 "Grid Layout"(网格式布局)。
-14. 将四个 "Buttons"(按钮)拖至 ``thumbnailPanel`` 中。因为 ``thumbnailPanel`` 具有网格式布局,所以按钮将自动变为相同大小并且完全填满面板。按钮的属性如下: thumbnailPanel 中的按钮
+
+[start=8]
+. 将 "Scroll Pane"(滚动窗格)拖至单选按钮的下方。扩展该窗格以填充全部水平空间以及大约三分之二的空余垂直空间。将滚动窗格的变量名称更改为 ``mainScrollPane`` 。
+
+[start=9]
+. 将 "Panel"(面板)拖至 ``mainScrollPane`` 中。将面板的变量名称更改为 ``mainPanel`` 。
+
+[start=10]
+. 在 "Design"(设计)视图中,右键单击 ``mainPanel`` 然后选择 "Set Layout"(设置布局)> "Border Layout"(边框式布局)。
+
+[start=11]
+. 将 "Button"(按钮)拖至 ``mainPanel`` 中。因为 ``mainPanel`` 具有边框式布局,所以按钮将自动填充整个面板。将按钮的变量名称更改为 ``mainPictureButton`` 并将按钮的文本更改为 "Waiting for picture..."
+
+[start=12]
+. 再将一个滚动窗格拖至 ``mainScrollPane`` 下面的空间中。扩展新滚动窗格以填满全部剩余空间。将新滚动窗格的变量名称更改为 ``thumbnailScrollPane`` 。
+
+[start=13]
+. 将 "Panel"(面板)拖至 ``thumbnailScrollPane`` 中。将面板的变量名称更改为 ``thumbnailPanel`` 。将 ``thumbnailPanel`` 的布局设置为 "Grid Layout"(网格式布局)。
+
+[start=14]
+. 将四个 "Buttons"(按钮)拖至 ``thumbnailPanel`` 中。因为 ``thumbnailPanel`` 具有网格式布局,所以按钮将自动变为相同大小并且完全填满面板。按钮的属性如下: thumbnailPanel 中的按钮
|===
|变量名称 |文本
@@ -134,6 +168,8 @@
1. 切换到编辑器的 "Source"(源)视图。找到 ``FlowerFrame`` 类主体的开头以及 ``FlowerFrame`` 构造函数。
image::images/ff-empty-constructor.png[]
+
+[start=1]
1. 在 ``FlowerFrame`` 类主体的顶部,并且在构造函数之前,创建一个用于表示每种花名称的字符串数组。
[source,java]
@@ -164,7 +200,9 @@
initComponents();
}
----
-3. 初始化单选按钮的 ``ItemListener`` 以及四个花形按钮的 ``ActionListener`` ,然后设置默认标题。
+
+[start=3]
+. 初始化单选按钮的 ``ItemListener`` 以及四个花形按钮的 ``ActionListener`` ,然后设置默认标题。
[source,java]
----
@@ -193,7 +231,9 @@
sunflowerButton.addActionListener(bListener);
}
----
-4. 为 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` 和 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` 添加导入语句。
+
+[start=4]
+. 为 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemListener.html[+java.awt.event.ItemListener+]`` 和 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html[+java.awt.event.ActionListener+]`` 添加导入语句。
现在已完成构造函数。代码中出现了编译错误警告,这是因为代码未包含类 ``RBListener`` 和 ``ButtonListener`` 。这两个类分别是 ``ItemListener`` 和 ``ActionListener`` 的定制实现。将在下一部分中编写这两个类。
@@ -205,7 +245,7 @@
]]
1. 在 ``FlowerFrame`` 类主体中找到 ``public static void main(String args[])`` 方法。删除此方法及其文档。(应用程序将改用 ``Main`` 类。)
-1. 为单选按钮编写定制 ``ItemListener`` 以代替 ``main`` 方法。当选择某个单选按钮时,该监听程序会显示新的鲜花图像。
+. 为单选按钮编写定制 ``ItemListener`` 以代替 ``main`` 方法。当选择某个单选按钮时,该监听程序会显示新的鲜花图像。
[source,java]
----
@@ -216,8 +256,9 @@
}
}
----
-1. 为 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` 添加一条导入语句。
-1. 在定制 ``ItemListener`` 的下面,为 4 个鲜花按钮编写定制 ``ActionListener`` 。当单击某个按钮时,监听程序会选择相关的单选按钮:
+
+. 为 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ItemEvent.html[+java.awt.event.ItemEvent+]`` 添加一条导入语句。
+. 在定制 ``ItemListener`` 的下面,为 4 个鲜花按钮编写定制 ``ActionListener`` 。当单击某个按钮时,监听程序会选择相关的单选按钮:
[source,java]
----
@@ -232,8 +273,12 @@
}
}
----
-2. 为 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` 添加一条导入语句。
-3. 在定制 ``ActionListener`` 的下面,编写 ``showFlower`` 方法。该方法用于确定哪一个单选按钮已选中并从 ``flowers`` 映射中获取相应鲜花的 ``Image`` 。
+
+[start=2]
+. 为 ``link:http://download.oracle.com/javase/6/docs/api/java/awt/event/ActionEvent.html[+java.awt.event.ActionEvent+]`` 添加一条导入语句。
+
+[start=3]
+. 在定制 ``ActionListener`` 的下面,编写 ``showFlower`` 方法。该方法用于确定哪一个单选按钮已选中并从 ``flowers`` 映射中获取相应鲜花的 ``Image`` 。
[source,java]
----
@@ -272,8 +317,12 @@
} else mainPictureButton.setText("");
}
----
-4. 为 ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` 添加一条导入语句。
-5. 编写 ``setThumbnails`` 方法。此方法从 ``flowers`` 映射为每个缩略图获取图像。 ``Main`` 类将调用此方法。
+
+[start=4]
+. 为 ``link:http://download.oracle.com/javase/6/docs/api/javax/swing/ImageIcon.html[+javax.swing.ImageIcon+]`` 添加一条导入语句。
+
+[start=5]
+. 编写 ``setThumbnails`` 方法。此方法从 ``flowers`` 映射为每个缩略图获取图像。 ``Main`` 类将调用此方法。
[source,java]
----
@@ -301,7 +350,9 @@
}
}
----
-6. 在 ``FlowerFrame`` 中修复导入(如果在代码中粘贴导入内容时未对其进行修复)。通过在编辑器中单击鼠标右键,然后从上下文菜单中选择 "Fix Imports"(修复导入),可以一次性修复所有导入内容。下面是完整的导入语句集:
+
+[start=6]
+. 在 ``FlowerFrame`` 中修复导入(如果在代码中粘贴导入内容时未对其进行修复)。通过在编辑器中单击鼠标右键,然后从上下文菜单中选择 "Fix Imports"(修复导入),可以一次性修复所有导入内容。下面是完整的导入语句集:
[source,java]
----
@@ -318,14 +369,18 @@
1. 在编辑器中打开 ``Main.java`` 类。
image::images/main-empty.png[]
-2. 在类主体中的 ``main`` 方法之前,为已下载的图片数初始化一个 ``int`` 变量。
+
+[start=2]
+. 在类主体中的 ``main`` 方法之前,为已下载的图片数初始化一个 ``int`` 变量。
[source,java]
----
private static int downloadedPictures;
----
-3. 在 ``main`` 方法主体中,创建四种花的 ``HashMap`` 以及四张缩略图的另一个 ``HashMap`` 。
+
+[start=3]
+. 在 ``main`` 方法主体中,创建四种花的 ``HashMap`` 以及四张缩略图的另一个 ``HashMap`` 。
[source,java]
----
@@ -333,8 +388,12 @@
final Map<String,Image> flowers = new HashMap<String,Image>(4);
final Map<String,Image> thumbs = new HashMap<String,Image>(4);
----
-4. 为 ``java.awt.Image`` 、 ``java.util.Map`` 和 ``java.util.HashMap`` 添加导入语句。
-5. 在 ``main`` 方法主体中,添加代码以显示 ``FlowerFrame`` 。*// Show the FlowerFrame.*
+
+[start=4]
+. 为 ``java.awt.Image`` 、 ``java.util.Map`` 和 ``java.util.HashMap`` 添加导入语句。
+
+[start=5]
+. 在 ``main`` 方法主体中,添加代码以显示 ``FlowerFrame`` 。*// Show the FlowerFrame.*
[source,java]
----
@@ -342,7 +401,9 @@
final FlowerFrame frame = new FlowerFrame(flowers);
frame.setVisible(true);
----
-6. 在 ``main`` 方法主体中,添加代码以将客户端连接到服务。*// The client connects to the service with this code.*
+
+[start=6]
+. 在 ``main`` 方法主体中,添加代码以将客户端连接到服务。*// The client connects to the service with this code.*
[source,java]
----
@@ -350,8 +411,12 @@
FlowerServiceService service = new FlowerServiceService();
final FlowerService port = service.getFlowerServicePort();
----
-7. 为 ``org.flower.service.FlowerService`` 和 ``org.flower.service.FlowerServiceService`` 添加导入语句。
-8. 在 ``main`` 方法主体中,添加代码,创建一个具有四个 ``Runnable`` 线程的数组,并在每个线程中调用一次 Web 服务的 ``getFlower`` 操作。*// The web service getFlower operation
+
+[start=7]
+. 为 ``org.flower.service.FlowerService`` 和 ``org.flower.service.FlowerServiceService`` 添加导入语句。
+
+[start=8]
+. 在 ``main`` 方法主体中,添加代码,创建一个具有四个 ``Runnable`` 线程的数组,并在每个线程中调用一次 Web 服务的 ``getFlower`` 操作。*// The web service getFlower operation
// is called 4 times, each in a separate thread.
// When the operation finishes the picture is shown in
// a specific button.*
@@ -388,8 +453,12 @@
new Thread(tasks[i]).start();
}
----
-9. 为 ``org.flower.service.IOException_Exception`` 添加一条导入语句。
-10. 在 ``main`` 方法主体中,添加代码以在单独的线程中调用 Web 服务的 ``getThumbnails`` 操作。*// The web service getThumbnails operation is called
+
+[start=9]
+. 为 ``org.flower.service.IOException_Exception`` 添加一条导入语句。
+
+[start=10]
+. 在 ``main`` 方法主体中,添加代码以在单独的线程中调用 Web 服务的 ``getThumbnails`` 操作。*// The web service getThumbnails operation is called
// in a separate thread, just after the previous four threads finish.
// When the images are downloaded, the thumbnails are shown at
// the bottom of the frame.*
@@ -423,7 +492,9 @@
new Thread(thumbsTask).start();
----
-11. 在 ``Main.java`` 中修复导入(如果在代码中粘贴导入内容时未对其进行修复)。通过在编辑器中单击鼠标右键,然后从上下文菜单中选择 "Fix Imports"(修复导入),可以一次性修复所有导入内容。您可以选择要导入的 List 类;请选择 ``java.util.List`` 。下面是完整的导入语句集:
+
+[start=11]
+. 在 ``Main.java`` 中修复导入(如果在代码中粘贴导入内容时未对其进行修复)。通过在编辑器中单击鼠标右键,然后从上下文菜单中选择 "Fix Imports"(修复导入),可以一次性修复所有导入内容。您可以选择要导入的 List 类;请选择 ``java.util.List`` 。下面是完整的导入语句集:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws.asciidoc
index c24a152..871301a 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws.asciidoc
@@ -44,6 +44,7 @@
5. link:./flower_swing.html[+ Creating the Swing Client+]
+[start=1]
1. <<create-web-app,Creating the Web Application>>
2. <<add-ws,Adding the Web Service>>
@@ -63,9 +64,13 @@
Alternatively, select New > Other and select Java Package in the Java category of the New File wizard.
-6. Name the package ``org.flower.resources`` . Click Finish.
+
+[start=6]
+. Name the package ``org.flower.resources`` . Click Finish.
image::images/new-package.png[]
-7. Copy the following images into ``org.flower.resources`` :
+
+[start=7]
+. Copy the following images into ``org.flower.resources`` :
* link:images/rose.jpg[+rose.jpg+]
* link:images/sunflower.jpg[+sunflower.jpg+]
* link:images/aster.jpg[+aster.jpg+]
@@ -93,15 +98,27 @@
The web service appears in the project's nodes in the Projects window. The Source Packages directory includes the service package and the resources package.
image::images/project-w-service-and-resources.png[]
-3. Open ``FlowerService.java`` in the editor. Switch to the Design view. A form appears in which you can add operations and quality of service elements to the web service.
+
+[start=3]
+. Open ``FlowerService.java`` in the editor. Switch to the Design view. A form appears in which you can add operations and quality of service elements to the web service.
image::images/flower-service-empty-design.png[]
-4. Click Add Operation. The Add Operation wizard opens.
-5. Name the operation ``getFlower`` . In the Return Type field, type or browse for ``java.awt.Image`` .
-6. In the Parameters tab, click Add. Name the parameter ``name`` and accept the default ``java.lang.String`` type.
+
+[start=4]
+. Click Add Operation. The Add Operation wizard opens.
+
+[start=5]
+. Name the operation ``getFlower`` . In the Return Type field, type or browse for ``java.awt.Image`` .
+
+[start=6]
+. In the Parameters tab, click Add. Name the parameter ``name`` and accept the default ``java.lang.String`` type.
image::images/add-getflower-param.png[]
-7. Open the Exceptions tab. Add an ``IOException`` .
+
+[start=7]
+. Open the Exceptions tab. Add an ``IOException`` .
image::images/io-exception.png[]
-8. Click OK and close the wizard. Then click Add Operation again, and add an operation with the following properties:
+
+[start=8]
+. Click OK and close the wizard. Then click Add Operation again, and add an operation with the following properties:
* *Name:* getThumbnails
* *Return type:* java.util.List
* *Exception: * IOException
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ja.asciidoc
index c898dd6..3119132 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ja.asciidoc
@@ -44,6 +44,7 @@
5. link:./flower_swing.html[+Swingクライアントの作成+]
+[start=1]
1. <<create-web-app,Webアプリケーションの作成>>
2. <<add-ws,Webサービスの追加>>
@@ -63,9 +64,13 @@
または、「新規」>「その他」を選択し、新規ファイル・ウィザードの「Java」カテゴリで「Javaパッケージ」を選択します。
-6. パッケージ名を ``org.flower.resources`` にします。「終了」をクリックします。
+
+[start=6]
+. パッケージ名を ``org.flower.resources`` にします。「終了」をクリックします。
image::images/new-package.png[]
-7. 次のイメージを ``org.flower.resources`` にコピーします。
+
+[start=7]
+. 次のイメージを ``org.flower.resources`` にコピーします。
* link:images/rose.jpg[+rose.jpg+]
* link:images/sunflower.jpg[+sunflower.jpg+]
* link:images/aster.jpg[+aster.jpg+]
@@ -93,15 +98,27 @@
Webサービスが、「プロジェクト」ウィンドウのこのプロジェクトのノードに表示されます。「ソース・パッケージ」ディレクトリには、「service」パッケージと「resources」パッケージが含まれています。
image::images/project-w-service-and-resources.png[]
-3. エディタで ``FlowerService.java`` を開きます。「デザイン」ビューに切り替えます。操作およびサービス品質の要素をWebサービスに追加できるフォームが表示されます。
+
+[start=3]
+. エディタで ``FlowerService.java`` を開きます。「デザイン」ビューに切り替えます。操作およびサービス品質の要素をWebサービスに追加できるフォームが表示されます。
image::images/flower-service-empty-design.png[]
-4. 「操作の追加」をクリックします。「操作の追加」ウィザードが開きます。
-5. 操作に ``getFlower`` という名前を付けます。「戻り値の型」フィールドに、「 ``java.awt.Image`` 」と入力するか、参照して入力します。
-6. 「パラメータ」タブで、「追加」をクリックします。このパラメータに ``name`` という名前を付け、デフォルトの ``java.lang.String`` 型を受け入れます。
+
+[start=4]
+. 「操作の追加」をクリックします。「操作の追加」ウィザードが開きます。
+
+[start=5]
+. 操作に ``getFlower`` という名前を付けます。「戻り値の型」フィールドに、「 ``java.awt.Image`` 」と入力するか、参照して入力します。
+
+[start=6]
+. 「パラメータ」タブで、「追加」をクリックします。このパラメータに ``name`` という名前を付け、デフォルトの ``java.lang.String`` 型を受け入れます。
image::images/add-getflower-param.png[]
-7. 「例外」タブを開きます。「 ``IOException`` 」を追加します。
+
+[start=7]
+. 「例外」タブを開きます。「 ``IOException`` 」を追加します。
image::images/io-exception.png[]
-8. 「OK」をクリックしてウィザードを閉じます。次に、「操作の追加」を再度クリックして、次のプロパティを使用して操作を追加します。
+
+[start=8]
+. 「OK」をクリックしてウィザードを閉じます。次に、「操作の追加」を再度クリックして、次のプロパティを使用して操作を追加します。
* *名前:* getThumbnails
* *戻り値の型:* java.util.List
* *例外: * IOException
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_pt_BR.asciidoc
index d8395cd..68d3de6 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_pt_BR.asciidoc
@@ -44,6 +44,7 @@
5. link:./flower_swing.html[+ Criando o Cliente Swing+]
+[start=1]
1. <<create-web-app,Criando a Aplicação Web>>
2. <<add-ws,Adicionando o Web Service>>
@@ -63,9 +64,13 @@
Se preferir, selecione Novo > Outro e selecione Pacote Java na categoria Java do assistente de Novo Arquivo.
-6. Nomeie o pacote ``org.flower.resources`` . Clique em Finalizar.
+
+[start=6]
+. Nomeie o pacote ``org.flower.resources`` . Clique em Finalizar.
image::images/new-package.png[]
-7. Copie as imagens a seguir para ``org.flower.resources`` :
+
+[start=7]
+. Copie as imagens a seguir para ``org.flower.resources`` :
* link:images/rose.jpg[+rose.jpg+]
* link:images/sunflower.jpg[+sunflower.jpg+]
* link:images/aster.jpg[+aster.jpg+]
@@ -93,15 +98,27 @@
O Web service aparecerá em nós do projeto na janela Projetos. O diretório Pacotes de Código-Fonte inclui o pacote do serviço e o pacote de recursos.
image::images/project-w-service-and-resources.png[]
-3. Abra ``FlowerService.java`` no editor. Alterne para a view de Design. Um form aparecerá, no qual você pode adicionar operações e elementos de qualidade de serviço ao Web service.
+
+[start=3]
+. Abra ``FlowerService.java`` no editor. Alterne para a view de Design. Um form aparecerá, no qual você pode adicionar operações e elementos de qualidade de serviço ao Web service.
image::images/flower-service-empty-design.png[]
-4. Clique em Adicionar Operação. O assistente Adicionar Operação será aberto.
-5. Nomeie a operação ``getFlower`` . No campo Tipo de Retorno, digite ou navegue para ``java.awt.Image`` .
-6. Na guia Parâmetros, clique em Adicionar. Nomeie o parâmetro ``nome`` e aceite o tipo ``java.lang.String`` default.
+
+[start=4]
+. Clique em Adicionar Operação. O assistente Adicionar Operação será aberto.
+
+[start=5]
+. Nomeie a operação ``getFlower`` . No campo Tipo de Retorno, digite ou navegue para ``java.awt.Image`` .
+
+[start=6]
+. Na guia Parâmetros, clique em Adicionar. Nomeie o parâmetro ``nome`` e aceite o tipo ``java.lang.String`` default.
image::images/add-getflower-param.png[]
-7. Abra a guia Exceções. Adicione uma ``IOException`` .
+
+[start=7]
+. Abra a guia Exceções. Adicione uma ``IOException`` .
image::images/io-exception.png[]
-8. Clique em OK e feche o assistente. Em seguida, clique novamente em Adicionar Operação e adicione uma operação com as seguintes propriedades:
+
+[start=8]
+. Clique em OK e feche o assistente. Em seguida, clique novamente em Adicionar Operação e adicione uma operação com as seguintes propriedades:
* *Nome:* getThumbnails
* *Tipo de retorno:* java.util.List
* *Exceção: * IOException
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ru.asciidoc
index 921ae53..8648170 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_ru.asciidoc
@@ -44,6 +44,7 @@
5. link:./flower_swing.html[+ Создание клиента Swing+]
+[start=1]
1. <<create-web-app,Создание веб-приложения>>
2. <<add-ws,Добавление веб-службы>>
@@ -63,9 +64,13 @@
Также можно выбрать пункт меню "Создать > Другие" и выбрать "Пакет Java" в категории "Java" мастера создания файлов.
-6. Присвойте пакету имя ``org.flower.resources`` . Нажмите кнопку "Завершить".
+
+[start=6]
+. Присвойте пакету имя ``org.flower.resources`` . Нажмите кнопку "Завершить".
image::images/new-package.png[]
-7. Скопируйте следующие изображения в пакет ``org.flower.resources`` :
+
+[start=7]
+. Скопируйте следующие изображения в пакет ``org.flower.resources`` :
* link:images/rose.jpg[+rose.jpg+]
* link:images/sunflower.jpg[+sunflower.jpg+]
* link:images/aster.jpg[+aster.jpg+]
@@ -93,15 +98,27 @@
В узле проекта в окне "Проекты" появится веб-служба. Каталог "Исходные файлы" включает в себя пакет для веб-служб и пакет ресурсов.
image::images/project-w-service-and-resources.png[]
-3. Откройте в редакторе файл ``FlowerService.java`` . Перейдите к представлению "Проектирование". Появится форма для добавления операций и элементов качества обслуживания в веб-службу.
+
+[start=3]
+. Откройте в редакторе файл ``FlowerService.java`` . Перейдите к представлению "Проектирование". Появится форма для добавления операций и элементов качества обслуживания в веб-службу.
image::images/flower-service-empty-design.png[]
-4. Нажмите кнопку "Добавить операцию". Откроется мастер добавления операции.
-5. Присвойте операции имя ``getFlower`` . Введите в поле "Тип возвращаемого значения" текст ``java.awt.Image`` или найдите этот тип, нажав кнопку "Обзор".
-6. Выберите вкладку "Параметры" и нажмите кнопку "Добавить". Введите текст ``name`` в качестве имени параметра и примите тип ``java.lang.String`` по умолчанию.
+
+[start=4]
+. Нажмите кнопку "Добавить операцию". Откроется мастер добавления операции.
+
+[start=5]
+. Присвойте операции имя ``getFlower`` . Введите в поле "Тип возвращаемого значения" текст ``java.awt.Image`` или найдите этот тип, нажав кнопку "Обзор".
+
+[start=6]
+. Выберите вкладку "Параметры" и нажмите кнопку "Добавить". Введите текст ``name`` в качестве имени параметра и примите тип ``java.lang.String`` по умолчанию.
image::images/add-getflower-param.png[]
-7. Откройте вкладку "Исключения". Добавьте исключение ``IOException`` .
+
+[start=7]
+. Откройте вкладку "Исключения". Добавьте исключение ``IOException`` .
image::images/io-exception.png[]
-8. Нажмите кнопку "ОК" и закройте мастер. Снова нажмите кнопку "Добавить операцию" и добавьте операцию со следующими свойствами:
+
+[start=8]
+. Нажмите кнопку "ОК" и закройте мастер. Снова нажмите кнопку "Добавить операцию" и добавьте операцию со следующими свойствами:
* *Имя:* getThumbnails
* *Тип возвращаемого значения:* java.util.List
* *Исключение: * IOException
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_zh_CN.asciidoc
index 825b50e..6602364 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_ws_zh_CN.asciidoc
@@ -44,6 +44,7 @@
*本课内容*
+[start=1]
1. <<create-web-app,创建 Web 应用程序>>
2. <<add-ws,添加 Web 服务>>
@@ -63,9 +64,13 @@
也可以选择 "New"(新建)> "Other"(其他),然后在新建文件向导的 "Java" 类别中选择 "Java Package"(Java 包)。
-6. 将包命名为 ``org.flower.resources`` 。单击 "Finish"(完成)。
+
+[start=6]
+. 将包命名为 ``org.flower.resources`` 。单击 "Finish"(完成)。
image::images/new-package.png[]
-7. 将以下图像复制到 ``org.flower.resources`` 中:
+
+[start=7]
+. 将以下图像复制到 ``org.flower.resources`` 中:
* link:images/rose.jpg[+rose.jpg+]
* link:images/sunflower.jpg[+sunflower.jpg+]
* link:images/aster.jpg[+aster.jpg+]
@@ -93,15 +98,27 @@
Web 服务出现在 "Projects"(项目)窗口中的项目节点中。"Source Packages"(源包)目录包括了服务包和资源包。
image::images/project-w-service-and-resources.png[]
-3. 在编辑器中打开 ``FlowerService.java`` 。切换到 "Design"(设计)视图。随即出现一个窗体,在该窗体中可以向 Web 服务中添加操作和服务质量元素。
+
+[start=3]
+. 在编辑器中打开 ``FlowerService.java`` 。切换到 "Design"(设计)视图。随即出现一个窗体,在该窗体中可以向 Web 服务中添加操作和服务质量元素。
image::images/flower-service-empty-design.png[]
-4. 单击 "Add Operation"(添加操作)。此时将打开添加操作向导。
-5. 将操作命名为 ``getFlower`` 。在 "Return Type"(返回类型)字段中,键入或浏览以找到 ``java.awt.Image`` 。
-6. 在 "Parameters"(参数)标签中,单击 "Add"(添加)。将参数命名为 ``name`` 并接受默认的 ``java.lang.String`` 类型。
+
+[start=4]
+. 单击 "Add Operation"(添加操作)。此时将打开添加操作向导。
+
+[start=5]
+. 将操作命名为 ``getFlower`` 。在 "Return Type"(返回类型)字段中,键入或浏览以找到 ``java.awt.Image`` 。
+
+[start=6]
+. 在 "Parameters"(参数)标签中,单击 "Add"(添加)。将参数命名为 ``name`` 并接受默认的 ``java.lang.String`` 类型。
image::images/add-getflower-param.png[]
-7. 打开 "Exceptions"(异常错误)标签。添加一个 ``IOException`` 。
+
+[start=7]
+. 打开 "Exceptions"(异常错误)标签。添加一个 ``IOException`` 。
image::images/io-exception.png[]
-8. 单击 "OK"(确定)并关闭向导。然后再次单击 "Add Operation"(添加操作),并添加带有以下属性的操作:
+
+[start=8]
+. 单击 "OK"(确定)并关闭向导。然后再次单击 "Add Operation"(添加操作),并添加带有以下属性的操作:
* *Name(名称):*getThumbnails
* *Return type(返回类型):*java.util.List
* *Exception(异常错误):*IOException
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema.asciidoc
index e01189a..f23bd59 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema.asciidoc
@@ -54,24 +54,36 @@
1. In the Projects window, expand the FlowerService web application node until you reach the ``WEB-INF`` node. Right-click the ``WEB-INF`` folder and select New > Folder. (You might need to select New > Other, then the Other category).
image::images/new-file-wiz-folder.png[]
-2. Click Next. The Name and Location page opens. Name the folder ``wsdl`` .
+
+[start=2]
+. Click Next. The Name and Location page opens. Name the folder ``wsdl`` .
image::images/wsdl-folder-name-location.png[]
-3. Click Finish. The folder ``wsdl`` appears in the Projects Window.
+
+[start=3]
+. Click Finish. The folder ``wsdl`` appears in the Projects Window.
image::images/wsdl-folder.png[]
-4. Expand the Web Services node and right-click the FlowerService node. Choose Generate and Copy WSDL...
-5. The Generate and Copy WSDL dialog opens with a navigation tree. Navigate to the ``wsdl`` folder you created (FlowerAlbumService > web > WEB-INF > wsdl) and click OK.
+
+[start=4]
+. Expand the Web Services node and right-click the FlowerService node. Choose Generate and Copy WSDL...
+
+[start=5]
+. The Generate and Copy WSDL dialog opens with a navigation tree. Navigate to the ``wsdl`` folder you created (FlowerAlbumService > web > WEB-INF > wsdl) and click OK.
You now see ``FlowerService.wsdl`` and ``FlowerService_schema1.xsd`` in the ``wsdl`` node. You also see a new node for Generated Sources (jax-ws).
image::images/generated-wsdl-and-schema.png[]
-6. Explicitly make the application server use your own version of the WSDL file. Otherwise the application server will generate its own WSDL file. Open ``FlowerService.java`` and locate the ``@WebService`` annotation. Add to this annotation the parameter ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` as shown below:
+
+[start=6]
+. Explicitly make the application server use your own version of the WSDL file. Otherwise the application server will generate its own WSDL file. Open ``FlowerService.java`` and locate the ``@WebService`` annotation. Add to this annotation the parameter ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` as shown below:
[source,java]
----
@WebService(serviceName = "FlowerService"*, wsdlLocation = "WEB-INF/wsdl/FlowerService.wsdl")*
----
-7. Modify the schema file ``FlowerService_schema1.xsd`` so it specifies the expected content type of the return element. To identify the return element in the schema file, open the schema file and find the complex types ``getThumbnailResponse`` and ``getFlowerResponse`` :
+
+[start=7]
+. Modify the schema file ``FlowerService_schema1.xsd`` so it specifies the expected content type of the return element. To identify the return element in the schema file, open the schema file and find the complex types ``getThumbnailResponse`` and ``getFlowerResponse`` :
[source,xml]
----
@@ -84,7 +96,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"/> </xs:sequence></xs:complexType>
----
-8. Add the following attributes to both return elements ( ``<xs:element name="return".../>):`` .
+
+[start=8]
+. Add the following attributes to both return elements ( ``<xs:element name="return".../>):`` .
[source,java]
----
@@ -108,7 +122,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"
xmime:expectedContentTypes="image/jpeg" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"/> </xs:sequence></xs:complexType>
----
-9. Now, when you redeploy the web service to the Tester application, and invoke one of the operations, you see that an image is correctly returned:
+
+[start=9]
+. Now, when you redeploy the web service to the Tester application, and invoke one of the operations, you see that an image is correctly returned:
image::images/ws-tester-goodschema.png[]
Now that the Tester application has confirmed that images are correctly being returned, you can create a Swing client to retrieve and display the images.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ja.asciidoc
index 5206298..7d7129b 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ja.asciidoc
@@ -54,24 +54,36 @@
1. 「プロジェクト」ウィンドウで、「FlowerService」Webアプリケーション・ノードを展開し、「 ``WEB-INF`` 」ノードを表示します。「 ``WEB-INF`` 」フォルダを右クリックし、「新規」>「フォルダ」を選択します。「新規」>「その他」を選択し、「その他」カテゴリを選択することが必要な場合もあります。
image::images/new-file-wiz-folder.png[]
-2. 「次」をクリックします。名前と場所ページが開きます。フォルダに ``wsdl`` という名前を付けます。
+
+[start=2]
+. 「次」をクリックします。名前と場所ページが開きます。フォルダに ``wsdl`` という名前を付けます。
image::images/wsdl-folder-name-location.png[]
-3. 「終了」をクリックします。「 ``wsdl`` 」フォルダが「プロジェクト」ウィンドウに表示されます。
+
+[start=3]
+. 「終了」をクリックします。「 ``wsdl`` 」フォルダが「プロジェクト」ウィンドウに表示されます。
image::images/wsdl-folder.png[]
-4. 「Webサービス」ノードを展開し、「FlowerService」ノードを右クリックします。「WSDLを生成してコピー...」を選択します。
-5. 「WSDLを生成してコピー」ダイアログが開き、ナビゲーション・ツリーが表示されます。作成した ``wsdl`` フォルダに移動し(「FlowerAlbumService」>「web」>「WEB-INF」>「wsdl」)、「OK」をクリックします。
+
+[start=4]
+. 「Webサービス」ノードを展開し、「FlowerService」ノードを右クリックします。「WSDLを生成してコピー...」を選択します。
+
+[start=5]
+. 「WSDLを生成してコピー」ダイアログが開き、ナビゲーション・ツリーが表示されます。作成した ``wsdl`` フォルダに移動し(「FlowerAlbumService」>「web」>「WEB-INF」>「wsdl」)、「OK」をクリックします。
「 ``FlowerService.wsdl`` 」と「 ``FlowerService_schema1.xsd`` 」が「 ``wsdl`` 」ノードに表示されます。また、「生成されたソース(jax-ws)」という新しいノードが表示されます。
image::images/generated-wsdl-and-schema.png[]
-6. アプリケーション・サーバーが独自バージョンのWSDLファイルを使用するように明示します。そうでない場合、アプリケーション・サーバー自体がWSDLファイルを生成します。 ``FlowerService.java`` を開き、 ``@WebService`` 注釈を探します。次に示すように、この注釈に ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` パラメータを追加します。
+
+[start=6]
+. アプリケーション・サーバーが独自バージョンのWSDLファイルを使用するように明示します。そうでない場合、アプリケーション・サーバー自体がWSDLファイルを生成します。 ``FlowerService.java`` を開き、 ``@WebService`` 注釈を探します。次に示すように、この注釈に ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` パラメータを追加します。
[source,java]
----
@WebService(serviceName = "FlowerService"*, wsdlLocation = "WEB-INF/wsdl/FlowerService.wsdl")*
----
-7. ``FlowerService_schema1.xsd`` スキーマ・ファイルを変更し、戻り要素に予想されるコンテンツ・タイプを指定します。戻り要素をスキーマ・ファイル内で識別するには、スキーマ・ファイルを開き、 ``getThumbnailResponse`` と ``getFlowerResponse`` の複合型を探します。
+
+[start=7]
+. ``FlowerService_schema1.xsd`` スキーマ・ファイルを変更し、戻り要素に予想されるコンテンツ・タイプを指定します。戻り要素をスキーマ・ファイル内で識別するには、スキーマ・ファイルを開き、 ``getThumbnailResponse`` と ``getFlowerResponse`` の複合型を探します。
[source,xml]
----
@@ -84,7 +96,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"/> </xs:sequence></xs:complexType>
----
-8. 次の属性を両方の戻り要素( ``<xs:element name="return".../>`` )に追加します。
+
+[start=8]
+. 次の属性を両方の戻り要素( ``<xs:element name="return".../>`` )に追加します。
[source,java]
----
@@ -108,7 +122,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"
xmime:expectedContentTypes="image/jpeg" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"/> </xs:sequence></xs:complexType>
----
-9. これで、TesterアプリケーションにWebサービスを再デプロイしてどちらかの操作を呼び出すと、イメージが正しく返されます。
+
+[start=9]
+. これで、TesterアプリケーションにWebサービスを再デプロイしてどちらかの操作を呼び出すと、イメージが正しく返されます。
image::images/ws-tester-goodschema.png[]
これで、イメージが正しく返され、Swingクライアントを作成してイメージを取得および表示できることが、Testerアプリケーションで確認されました。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_pt_BR.asciidoc
index dbacddd..6f31c19 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_pt_BR.asciidoc
@@ -54,24 +54,36 @@
1. Na janela Projetos, expanda o nó da aplicação Web FlowerService até chegar ao nó ``WEB-INF`` . Clique com o botão direito do mouse na pasta ``WEB-INF`` e selecione Nova > Pasta. (Talvez você precise selecionar Novo > Outro e, em seguida, a categoria Outro).
image::images/new-file-wiz-folder.png[]
-2. Clique em Próximo. A página Nome e Localização será aberta. Nomeie a pasta ``wsdl`` .
+
+[start=2]
+. Clique em Próximo. A página Nome e Localização será aberta. Nomeie a pasta ``wsdl`` .
image::images/wsdl-folder-name-location.png[]
-3. Clique em Finalizar. A pasta ``wsdl`` é exibida na Janela Projetos.
+
+[start=3]
+. Clique em Finalizar. A pasta ``wsdl`` é exibida na Janela Projetos.
image::images/wsdl-folder.png[]
-4. Expanda o nó Web Services e clique com o botão direito do mouse no nó FlowerService. Selecione Gerar e Copiar WSDL...
-5. A caixa de diálogo Gerar e Copiar WSDL será aberta com uma árvore de navegação. Navegue para a pasta ``wsdl`` que foi criada (FlowerAlbumService > Web > WEB-INF > wsdl) e clique em OK.
+
+[start=4]
+. Expanda o nó Web Services e clique com o botão direito do mouse no nó FlowerService. Selecione Gerar e Copiar WSDL...
+
+[start=5]
+. A caixa de diálogo Gerar e Copiar WSDL será aberta com uma árvore de navegação. Navegue para a pasta ``wsdl`` que foi criada (FlowerAlbumService > Web > WEB-INF > wsdl) e clique em OK.
Agora, você vê ``FlowerService.wsdl`` e ``FlowerService_schema1.xsd`` no nó ``wsdl`` . Você também vê um novo nó para Códigos-Fonte Gerados (jax-ws).
image::images/generated-wsdl-and-schema.png[]
-6. Explicitamente, faça com que o servidor de aplicações utilize sua própria versão do arquivo WSDL. Caso contrário, o servidor de aplicações gerará seu próprio arquivo WSDL. Abra ``FlowerService.java`` e localize a anotação ``@WebService`` . Adicione o parâmetro ``wsdlLocation="WEB-INF/wsdl/FlowerServiceService.wsdl"`` a esta anotação, como mostrado abaixo:
+
+[start=6]
+. Explicitamente, faça com que o servidor de aplicações utilize sua própria versão do arquivo WSDL. Caso contrário, o servidor de aplicações gerará seu próprio arquivo WSDL. Abra ``FlowerService.java`` e localize a anotação ``@WebService`` . Adicione o parâmetro ``wsdlLocation="WEB-INF/wsdl/FlowerServiceService.wsdl"`` a esta anotação, como mostrado abaixo:
[source,java]
----
@WebService(serviceName = "FlowerService"*, wsdlLocation = "WEB-INF/wsdl/FlowerService.wsdl")*
----
-7. Modifique o arquivo de esquema ``FlowerService_schema1.xsd`` para que especifique o tipo de conteúdo do elemento esperado. Para identificar o elemento de retorno no arquivo de esquema, abra o arquivo de esquema e encontre os tipos complexos ``getThumbnailResponse`` e ``getFlowerResponse`` :
+
+[start=7]
+. Modifique o arquivo de esquema ``FlowerService_schema1.xsd`` para que especifique o tipo de conteúdo do elemento esperado. Para identificar o elemento de retorno no arquivo de esquema, abra o arquivo de esquema e encontre os tipos complexos ``getThumbnailResponse`` e ``getFlowerResponse`` :
[source,xml]
----
@@ -84,7 +96,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"/> </xs:sequence></xs:complexType>
----
-8. Adicione os atributos a seguir aos dois elementos de retorno ( ``<xs:element name="return".../>):`` .
+
+[start=8]
+. Adicione os atributos a seguir aos dois elementos de retorno ( ``<xs:element name="return".../>):`` .
[source,java]
----
@@ -108,7 +122,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"
xmime:expectedContentTypes="image/jpeg" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"/> </xs:sequence></xs:complexType>
----
-9. Agora, quando reimplantar o Web service na aplicação de Teste e chamar uma das operações, você verá que uma imagem é retornada corretamente:
+
+[start=9]
+. Agora, quando reimplantar o Web service na aplicação de Teste e chamar uma das operações, você verá que uma imagem é retornada corretamente:
image::images/ws-tester-goodschema.png[]
Agora que a aplicação de Teste confirmou que as imagens estão sendo retornadas corretamente, você pode criar um cliente Swing para recuperá-las e exibi-las.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ru.asciidoc
index b1e0731..d15b8ec 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_ru.asciidoc
@@ -54,24 +54,36 @@
1. В окне 'Проекты' разверните узел веб-приложения FlowerService до перехода к узлу ``WEB-INF`` . Щелкните папку ``WEB-INF`` правой кнопкой мыши и выберите пункт "Создать", а затем – "Папка". (При необходимости выберите "Создать" > "Прочее", а затем – категорию "Прочее").
image::images/new-file-wiz-folder.png[]
-2. Нажмите кнопку "Далее". Откроется страница "Имя и местоположение". Присвойте папке имя ``wsdl`` .
+
+[start=2]
+. Нажмите кнопку "Далее". Откроется страница "Имя и местоположение". Присвойте папке имя ``wsdl`` .
image::images/wsdl-folder-name-location.png[]
-3. Нажмите кнопку "Завершить". В окне "Проекты" появится папка ``wsdl`` .
+
+[start=3]
+. Нажмите кнопку "Завершить". В окне "Проекты" появится папка ``wsdl`` .
image::images/wsdl-folder.png[]
-4. Разверните узел 'Веб-службы' и щелкните правой кнопкой мыши узел FlowerService. Выберите команду "Создать и копировать файл WSDL"
-5. Откроется диалоговое окно "Создать и копировать файл WSDL" с деревом навигации. Перейдите к созданной папке ``wsdl`` (FlowerAlbumService > web > WEB-INF > wsdl) и щелкните ОК.
+
+[start=4]
+. Разверните узел 'Веб-службы' и щелкните правой кнопкой мыши узел FlowerService. Выберите команду "Создать и копировать файл WSDL"
+
+[start=5]
+. Откроется диалоговое окно "Создать и копировать файл WSDL" с деревом навигации. Перейдите к созданной папке ``wsdl`` (FlowerAlbumService > web > WEB-INF > wsdl) и щелкните ОК.
Теперь в узле ``wsdl`` отображаются файлы ``FlowerService.wsdl`` и ``FlowerService_schema1.xsd`` . Также выводится новый узел для созданных исходных файлов (jax-ws).
image::images/generated-wsdl-and-schema.png[]
-6. Необходимо явно указать на необходимость использования созданной версии файла WSDL для сервера приложений. В противном случае на сервере приложений будет создан собственный файл WSDL. Откройте файл ``FlowerService.java`` и найдите аннотацию ``@WebService`` . Добавьте в эту аннотацию параметр ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` следующим образом:
+
+[start=6]
+. Необходимо явно указать на необходимость использования созданной версии файла WSDL для сервера приложений. В противном случае на сервере приложений будет создан собственный файл WSDL. Откройте файл ``FlowerService.java`` и найдите аннотацию ``@WebService`` . Добавьте в эту аннотацию параметр ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` следующим образом:
[source,java]
----
@WebService(serviceName = "FlowerService"*, wsdlLocation = "WEB-INF/wsdl/FlowerService.wsdl")*
----
-7. Измените файл схемы ``FlowerService_schema1.xsd`` таким образом, чтобы он определял ожидаемый тип возвращаемого элемента. Для определения возвращаемого элемента в файле схемы откройте этот файл и найдите составные типы ``getThumbnailResponse`` и ``getFlowerResponse`` :
+
+[start=7]
+. Измените файл схемы ``FlowerService_schema1.xsd`` таким образом, чтобы он определял ожидаемый тип возвращаемого элемента. Для определения возвращаемого элемента в файле схемы откройте этот файл и найдите составные типы ``getThumbnailResponse`` и ``getFlowerResponse`` :
[source,xml]
----
@@ -84,7 +96,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"/> </xs:sequence></xs:complexType>
----
-8. Добавьте следующие атрибуты в оба возвращаемых элемента ( ``<xs:element name="return".../>):`` .
+
+[start=8]
+. Добавьте следующие атрибуты в оба возвращаемых элемента ( ``<xs:element name="return".../>):`` .
[source,java]
----
@@ -108,7 +122,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"
xmime:expectedContentTypes="image/jpeg" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"/> </xs:sequence></xs:complexType>
----
-9. Теперь при повторном развертывании веб-службы в приложении тестирования и вызове одной из операций можно убедиться, что изображение возвращается корректно:
+
+[start=9]
+. Теперь при повторном развертывании веб-службы в приложении тестирования и вызове одной из операций можно убедиться, что изображение возвращается корректно:
image::images/ws-tester-goodschema.png[]
После подтверждения в приложении тестирования, что изображения возвращаются корректно, можно создать клиент Swing для получения и отображения изображений.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_zh_CN.asciidoc
index f190a67..af4cac0 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/flower_wsdl_schema_zh_CN.asciidoc
@@ -53,24 +53,36 @@
1. 在 "Projects"(项目)窗口中,展开 "FlowerService" Web 应用程序节点,直至到达 ``WEB-INF`` 节点。右键单击 ``WEB-INF`` 文件夹,然后选择 "New"(新建)> "Folder"(文件夹)。(可能需要选择 "New"(新建)> "Other"(其他),然后选择 "Other"(其他)类别)。
image::images/new-file-wiz-folder.png[]
-2. 单击 "Next"(下一步)。"Name and Location"(名称和位置)页打开。将该文件夹命名为 ``wsdl`` 。
+
+[start=2]
+. 单击 "Next"(下一步)。"Name and Location"(名称和位置)页打开。将该文件夹命名为 ``wsdl`` 。
image::images/wsdl-folder-name-location.png[]
-3. 单击 "Finish"(完成)。"Projects"(项目)窗口中将显示文件夹 ``wsdl`` 。
+
+[start=3]
+. 单击 "Finish"(完成)。"Projects"(项目)窗口中将显示文件夹 ``wsdl`` 。
image::images/wsdl-folder.png[]
-4. 展开 "Web Services"(Web 服务)节点,然后右键单击 "FlowerService" 节点。选择 "Generate and Copy WSDL..."(生成和复制 WSDL...)。
-5. "Generate and Copy WSDL"(生成和复制 WSDL)对话框打开,其中包含一个导航树。导航至您创建的 ``wsdl`` 文件夹 ("FlowerAlbumService" > "web" > "WEB-INF" > "wsdl"),然后单击 "OK"(确定)。
+
+[start=4]
+. 展开 "Web Services"(Web 服务)节点,然后右键单击 "FlowerService" 节点。选择 "Generate and Copy WSDL..."(生成和复制 WSDL...)。
+
+[start=5]
+. "Generate and Copy WSDL"(生成和复制 WSDL)对话框打开,其中包含一个导航树。导航至您创建的 ``wsdl`` 文件夹 ("FlowerAlbumService" > "web" > "WEB-INF" > "wsdl"),然后单击 "OK"(确定)。
现在,您将在 ``wsdl`` 节点中看到 ``FlowerService.wsdl`` 和 ``FlowerService_schema1.xsd`` 。还将看到 "Generated Sources"(生成的源文件)(jax-ws) 的新节点。
image::images/generated-wsdl-and-schema.png[]
-6. 明确指定应用服务器使用您自己的 WSDL 文件版本。否则,应用服务器将生成其自身的 WSDL 文件。打开 ``FlowerService.java`` 并找到 ``@WebService`` 标注。在此标注中添加参数 ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` ,如下所示:
+
+[start=6]
+. 明确指定应用服务器使用您自己的 WSDL 文件版本。否则,应用服务器将生成其自身的 WSDL 文件。打开 ``FlowerService.java`` 并找到 ``@WebService`` 标注。在此标注中添加参数 ``wsdlLocation="WEB-INF/wsdl/FlowerService.wsdl"`` ,如下所示:
[source,java]
----
@WebService(serviceName = "FlowerService"*, wsdlLocation = "WEB-INF/wsdl/FlowerService.wsdl")*
----
-7. 修改方案文件 ``FlowerService_schema1.xsd`` ,使其指定返回元素的所需内容类型。要在方案文件中标识返回元素,请打开该方案文件,然后找到复杂类型 ``getThumbnailResponse`` 和 ``getFlowerResponse`` :
+
+[start=7]
+. 修改方案文件 ``FlowerService_schema1.xsd`` ,使其指定返回元素的所需内容类型。要在方案文件中标识返回元素,请打开该方案文件,然后找到复杂类型 ``getThumbnailResponse`` 和 ``getFlowerResponse`` :
[source,xml]
----
@@ -83,7 +95,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"/> </xs:sequence></xs:complexType>
----
-8. 在两个返回元素 ( ``<xs:element name="return".../>`` ) 中添加以下属性。
+
+[start=8]
+. 在两个返回元素 ( ``<xs:element name="return".../>`` ) 中添加以下属性。
[source,java]
----
@@ -107,7 +121,9 @@
<xs:complexType name="getFlowerResponse"><xs:sequence><xs:element name="return" type="xs:base64Binary" minOccurs="0"
xmime:expectedContentTypes="image/jpeg" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"/> </xs:sequence></xs:complexType>
----
-9. 现在,向测试器应用程序重新部署 Web 服务并调用其中的一项操作时,您会看到正确返回图像:
+
+[start=9]
+. 现在,向测试器应用程序重新部署 Web 服务并调用其中的一项操作时,您会看到正确返回图像:
image::images/ws-tester-goodschema.png[]
由于 Tester 应用程序已经确保正确返回图像,所以可以创建一个 Swing 客户端来检索和显示图像。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws.asciidoc
index 601e629..b92c99a 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws.asciidoc
@@ -105,8 +105,12 @@
*Note.* You can create a JAX-WS web service in a Maven project. Choose File > New Project (Ctrl-Shift-N on Linux and Windows, ⌘-Shift-N on MacOS) and then Maven Web Application or Maven EJB module from the Maven category. If you haven't used Maven with NetBeans before, see link:http://wiki.netbeans.org/MavenBestPractices[+Maven Best Practices+].
-2. Name the project ``CalculatorWSApplication`` . Select a location for the project. Click Next.
-3. Select your server and Java EE version and click Finish.
+
+[start=2]
+. Name the project ``CalculatorWSApplication`` . Select a location for the project. Click Next.
+
+[start=3]
+. Select your server and Java EE version and click Finish.
*Note.* To use the Oracle WebLogic server, link:../web/jsf-jpa-weblogic.html#01[+register the server with the IDE+]. Also, if you are using the WebLogic server, watch the screencast on link:../javaee/weblogic-javaee-m1-screencast.html[+Deploying a Web Application to Oracle WebLogic+].
@@ -117,7 +121,9 @@
2. Name the web service ``CalculatorWS`` and type ``org.me.calculator`` in Package. Leave Create Web Service from Scratch selected.
3. If you are creating a Java EE project on GlassFish or WebLogic, select Implement Web Service as a Stateless Session Bean.
image::images/generate-ws-ee6.png[]
-4. Click Finish. The Projects window displays the structure of the new web service and the source code is shown in the editor area.
+
+[start=4]
+. Click Finish. The Projects window displays the structure of the new web service and the source code is shown in the editor area.
== Adding an Operation to the Web Service
@@ -136,29 +142,45 @@
* Find the web service's node in the Projects window. Right-click that node. A context menu opens.
image::images/add-op-cx-menu-item.png[]
-2. Click Add Operation in either the visual designer or the context menu. The Add Operation dialog opens.
-3. In the upper part of the Add Operation dialog box, type ``add`` in Name and type ``int`` in the Return Type drop-down list.
-4. In the lower part of the Add Operation dialog box, click Add and create a parameter of type ``int`` named ``i`` .
-5. Click Add again and create a parameter of type ``int`` called ``j`` .
+
+[start=2]
+. Click Add Operation in either the visual designer or the context menu. The Add Operation dialog opens.
+
+[start=3]
+. In the upper part of the Add Operation dialog box, type ``add`` in Name and type ``int`` in the Return Type drop-down list.
+
+[start=4]
+. In the lower part of the Add Operation dialog box, click Add and create a parameter of type ``int`` named ``i`` .
+
+[start=5]
+. Click Add again and create a parameter of type ``int`` called ``j`` .
You now see the following:
image::images/jaxws-60-add-operation.png[]
-6. Click OK at the bottom of the Add Operation dialog box. You return to the editor.
-7. Remove the default ``hello`` operation, either by deleting the ``hello()`` method in the source code or by selecting the ``hello`` operation in the visual designer and clicking Remove Operation.
+
+[start=6]
+. Click OK at the bottom of the Add Operation dialog box. You return to the editor.
+
+[start=7]
+. Remove the default ``hello`` operation, either by deleting the ``hello()`` method in the source code or by selecting the ``hello`` operation in the visual designer and clicking Remove Operation.
The visual designer now displays the following:
image::images/design-view-with-op.png[title="Web service visual designer showing added operation"]
-8. Click Source and view the code that you generated in the previous steps. It differs whether you created the service as an Java EE stateless bean or not. Can you see the difference in the screenshots below? (A Java EE 6 or Java EE 7 service that is not implemented as a stateless bean resembles a Java EE 5 service.)
+
+[start=8]
+. Click Source and view the code that you generated in the previous steps. It differs whether you created the service as an Java EE stateless bean or not. Can you see the difference in the screenshots below? (A Java EE 6 or Java EE 7 service that is not implemented as a stateless bean resembles a Java EE 5 service.)
image::images/jaxws-60-source.png[] image::images/stateless-ejb-code1.png[]
*Note.* In NetBeans IDE 7.3 and 7.4 you will notice that in the generated ``@WebService`` annotation the service name is specified explicitly:
``@WebService(serviceName = "CalculatorWS")`` .
-9. In the editor, extend the skeleton ``add`` operation to the following (changes are in bold):
+
+[start=9]
+. In the editor, extend the skeleton ``add`` operation to the following (changes are in bold):
[source,java]
----
@@ -218,15 +240,21 @@
2. Right-click the ``CalculatorWS_Client_Application`` node and choose New > Web Service Client. The New Web Service Client wizard opens.
3. Select Project as the WSDL source. Click Browse. Browse to the CalculatorWS web service in the CalculatorWSApplication project. When you have selected the web service, click OK.
image::images/browse-ws.png[]
-4. Do not select a package name. Leave this field empty.
+
+[start=4]
+. Do not select a package name. Leave this field empty.
image::images/javaclient-pkg.png[]
-5. Leave the other settings at default and click Finish.
+
+[start=5]
+. Leave the other settings at default and click Finish.
The Projects window displays the new web service client, with a node for the ``add`` method that you created:
image::images/ws-ref-in-client-project.png[]
-6. Double-click your main class so that it opens in the Source Editor. Drag the ``add`` node below the ``main()`` method.
+
+[start=6]
+. Double-click your main class so that it opens in the Source Editor. Drag the ``add`` node below the ``main()`` method.
image::images/dnd-add.png[]
You now see the following:
@@ -247,7 +275,9 @@
*Note:* Alternatively, instead of dragging the ``add`` node, you can right-click in the editor and then choose Insert Code > Call Web Service Operation.
-7. In the ``main()`` method body, replace the TODO comment with code that initializes values for ``i`` and ``j`` , calls ``add()`` , and prints the result.
+
+[start=7]
+. In the ``main()`` method body, replace the TODO comment with code that initializes values for ``i`` and ``j`` , calls ``add()`` , and prints the result.
[source,java]
----
@@ -255,7 +285,9 @@
public static void main(String[] args) {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);
}
----
-8. Surround the ``main()`` method code with a try/catch block that prints an exception.
+
+[start=8]
+. Surround the ``main()`` method code with a try/catch block that prints an exception.
[source,java]
----
@@ -263,7 +295,9 @@
public static void main(String[] args) {try {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);} catch (Exception ex) {System.out.println("Exception: " + ex);}
}
----
-9. Right-click the project node and choose Run.
+
+[start=9]
+. Right-click the project node and choose Run.
The Output window now shows the sum:
@@ -287,24 +321,40 @@
The New Web Service Client wizard opens.
-3. Select Project as the WSDL source and click Browse to open the Browse Web Services dialog box.
-4. Select the CalculatorWS web service in the CalculatorWSApplication project. Click OK to close the Browse Web Services dialog box.
+
+[start=3]
+. Select Project as the WSDL source and click Browse to open the Browse Web Services dialog box.
+
+[start=4]
+. Select the CalculatorWS web service in the CalculatorWSApplication project. Click OK to close the Browse Web Services dialog box.
image::images/browse-ws.png[]
-5. Confirm that the package name is empty in the New Web Service Client wizard and leave the other settings at the default value. Click Finish.
+
+[start=5]
+. Confirm that the package name is empty in the New Web Service Client wizard and leave the other settings at the default value. Click Finish.
The Web Service References node in the Projects window displays the structure of your newly created client, including the ``add`` operation that you created earlier in this tutorial.
-6. Right-click the ``CalculatorWSServletClient`` project node and choose New > Servlet. Name the servlet ``ClientServlet`` and place it in a package called ``org.me.calculator.client`` . Click Finish.
-7. To make the servlet the entry point to your application, right-click the CalculatorWSServletClient project node and choose Properties. Open the Run properties and type ``/ClientServlet`` in the Relative URL field. Click OK.
-8. If there are error icons for ``ClientServlet.java`` , right-click the project node and select Clean and Build.
-9. In the ``processRequest()`` method, add some empty lines after this line:
+
+[start=6]
+. Right-click the ``CalculatorWSServletClient`` project node and choose New > Servlet. Name the servlet ``ClientServlet`` and place it in a package called ``org.me.calculator.client`` . Click Finish.
+
+[start=7]
+. To make the servlet the entry point to your application, right-click the CalculatorWSServletClient project node and choose Properties. Open the Run properties and type ``/ClientServlet`` in the Relative URL field. Click OK.
+
+[start=8]
+. If there are error icons for ``ClientServlet.java`` , right-click the project node and select Clean and Build.
+
+[start=9]
+. In the ``processRequest()`` method, add some empty lines after this line:
[source,xml]
----
out.println("<h1>Servlet ClientServlet at " + request.getContextPath () + "</h1>");
----
-10. In the Source Editor, drag the ``add`` operation anywhere in the body of the ``ClientServlet`` class. The ``add()`` method appears at the end of the class code.
+
+[start=10]
+. In the Source Editor, drag the ``add`` operation anywhere in the body of the ``ClientServlet`` class. The ``add()`` method appears at the end of the class code.
*Note:* Alternatively, instead of dragging the ``add`` node, you can right-click in the editor and then choose Insert Code > Call Web Service Operation.
@@ -315,7 +365,9 @@
private int add(int i, int j) {org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();return port.add(i, j);
}
----
-11. Add code that initializes values for ``i`` and ``j`` , calls ``add()`` , and prints the result. The added code is in *boldface*:
+
+[start=11]
+. Add code that initializes values for ``i`` and ``j`` , calls ``add()`` , and prints the result. The added code is in *boldface*:
[source,xml]
----
@@ -342,7 +394,9 @@
} finally { out.close();}}
----
-12. Surround the added code with a try/catch block that prints an exception.
+
+[start=12]
+. Surround the added code with a try/catch block that prints an exception.
[source,xml]
----
@@ -368,7 +422,9 @@
} finally { out.close();}}
----
-13. Right-click the project node and choose Run.
+
+[start=13]
+. Right-click the project node and choose Run.
The server starts, the application is built and deployed, and the browser opens, displaying the calculation result, as shown below:
image::images/jaxws-60-webclient.png[]
@@ -386,18 +442,32 @@
If JSP is not available in the popup menu, choose New > Other and select JSP in the Web category of the New File wizard.
-4. Type *index* for the name of the JSP file in the New File wizard. Click Finish.
-5. Right-click the ``CalculatorWSJSPClient`` node and choose New > Web Service Client.
-6. Select Project as the WSDL source. Click Browse. Browse to the CalculatorWS web service in the CalculatorWSApplication project. When you have selected the web service, click OK.
+
+[start=4]
+. Type *index* for the name of the JSP file in the New File wizard. Click Finish.
+
+[start=5]
+. Right-click the ``CalculatorWSJSPClient`` node and choose New > Web Service Client.
+
+[start=6]
+. Select Project as the WSDL source. Click Browse. Browse to the CalculatorWS web service in the CalculatorWSApplication project. When you have selected the web service, click OK.
image::images/browse-ws.png[]
-7. Do not select a package name. Leave this field empty.
-8. Leave the other settings at default and click Finish.
+
+[start=7]
+. Do not select a package name. Leave this field empty.
+
+[start=8]
+. Leave the other settings at default and click Finish.
The Projects window displays the new web service client, as shown below:
image::images/ws-ref-in-jsp-client.png[]
-9. In the Web Service References node, expand the node that represents the web service. The ``add`` operation, which you will invoke from the client, is now exposed.
-10. Drag the ``add`` operation to the client's ``index.jsp`` page, and drop it below the H1 tags. The code for invoking the service's operation is now generated in the ``index.jsp`` page, as you can see here:
+
+[start=9]
+. In the Web Service References node, expand the node that represents the web service. The ``add`` operation, which you will invoke from the client, is now exposed.
+
+[start=10]
+. Drag the ``add`` operation to the client's ``index.jsp`` page, and drop it below the H1 tags. The code for invoking the service's operation is now generated in the ``index.jsp`` page, as you can see here:
[source,java]
----
@@ -420,7 +490,9 @@
Change the value for ``i`` and ``j`` from 0 to other integers, such as 3 and 4. Replace the commented out TODO line in the catch block with ``out.println("exception" + ex);`` .
-11. Right-click the project node and choose Run.
+
+[start=11]
+. Right-click the project node and choose Run.
The server starts, if it wasn't running already. The application is built and deployed, and the browser opens, displaying the calculation result:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ja.asciidoc
index 80feac6..e07c8fd 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ja.asciidoc
@@ -72,8 +72,12 @@
JAX-WS WebサービスをMavenプロジェクト内で作成できます。「ファイル」>「新規プロジェクト」(LinuxおよびWindowsの場合は[Ctrl]-[Shift]-[N]、MacOSの場合は[⌘]-[Shift]-[N])を選択し、「Maven」カテゴリから「Maven Webアプリケーション」または「Maven EJBモジュール」を選択します。NetBeansでMavenをまだ使用したことがない場合は、link:http://wiki.netbeans.org/MavenBestPractices[+Mavenのベスト・プラクティス+]を参照してください。
-2. プロジェクトに ``CalculatorWSApplication`` という名前を付けます。プロジェクトの場所を選択します。「次」をクリックします。
-3. サーバーとJava EEバージョンを選択し、「終了」をクリックします。
+
+[start=2]
+. プロジェクトに ``CalculatorWSApplication`` という名前を付けます。プロジェクトの場所を選択します。「次」をクリックします。
+
+[start=3]
+. サーバーとJava EEバージョンを選択し、「終了」をクリックします。
Oracle WebLogicサーバーを使用するには、link:../web/jsf-jpa-weblogic.html#01[+サーバーをIDEに登録します+]。また、WebLogicサーバーを使用する場合は、link:../javaee/weblogic-javaee-m1-screencast.html[+Oracle WebLogicへのWebアプリケーションのデプロイ+]のスクリーンキャストを視聴してください。
@@ -84,7 +88,9 @@
2. Webサービスに ``CalculatorWS`` という名前を付け、「パッケージ」に「 ``org.me.calculator`` 」と入力します。「Webサービスを新規に作成」を選択したままにします。
3. GlassFishまたはWebLogicでJava EEプロジェクトを作成する場合は、「ステートレス・セッションBeanとしてWebサービスを実装」を選択します。
image::images/generate-ws-ee6.png[]
-4. 「終了」をクリックします。「プロジェクト」ウィンドウに新しいWebサービスの構造が表示され、エディタ領域にソース・コードが表示されます。
+
+[start=4]
+. 「終了」をクリックします。「プロジェクト」ウィンドウに新しいWebサービスの構造が表示され、エディタ領域にソース・コードが表示されます。
== Webサービスへの操作の追加
@@ -103,29 +109,45 @@
* 「プロジェクト」ウィンドウからWebサービスのノードを見つけます。そのノードを右クリックします。コンテキスト・メニューが開きます。
image::images/add-op-cx-menu-item.png[]
-2. ビジュアル・デザイナまたはコンテキスト・メニューのいずれかで、「操作の追加」をクリックします。「操作の追加」ダイアログが開きます。
-3. 「操作の追加」ダイアログ・ボックスの上の部分で、「名前」に「 ``add`` 」、「戻り値の型」ドロップダウン・リストに「 ``int`` 」と入力します。
-4. 「操作の追加」ダイアログ・ボックスの下の部分で、「追加」をクリックして ``int`` 型の ``i`` という名前のパラメータを作成します。
-5. 再度「追加」をクリックし、 ``int`` 型の ``j`` というパラメータを作成します。
+
+[start=2]
+. ビジュアル・デザイナまたはコンテキスト・メニューのいずれかで、「操作の追加」をクリックします。「操作の追加」ダイアログが開きます。
+
+[start=3]
+. 「操作の追加」ダイアログ・ボックスの上の部分で、「名前」に「 ``add`` 」、「戻り値の型」ドロップダウン・リストに「 ``int`` 」と入力します。
+
+[start=4]
+. 「操作の追加」ダイアログ・ボックスの下の部分で、「追加」をクリックして ``int`` 型の ``i`` という名前のパラメータを作成します。
+
+[start=5]
+. 再度「追加」をクリックし、 ``int`` 型の ``j`` というパラメータを作成します。
次のようになります。
image::images/jaxws-60-add-operation.png[]
-6. 「操作の追加」ダイアログ・ボックスの最下部で「OK」をクリックします。エディタに戻ります。
-7. ソース・コードの ``hello()`` メソッドを除去するか、ビジュアル・デザイナで ``hello`` 操作を選択して「操作を除去」をクリックすることによって、デフォルトの ``hello`` 操作を除去します。
+
+[start=6]
+. 「操作の追加」ダイアログ・ボックスの最下部で「OK」をクリックします。エディタに戻ります。
+
+[start=7]
+. ソース・コードの ``hello()`` メソッドを除去するか、ビジュアル・デザイナで ``hello`` 操作を選択して「操作を除去」をクリックすることによって、デフォルトの ``hello`` 操作を除去します。
ビジュアル・デザイナでは次のように表示されます。
image::images/design-view-with-op.png[title="追加した操作が表示されたWebサービスのビジュアル・デザイナ"]
-8. 「ソース」をクリックし、前述の手順で作成したコードを表示します。これは、サービスをJava EEステートレスBeanとして作成したかどうかによって異なります。次のスクリーンショットの違いがわかりますか。(ステートレスBeanとして実装されていないJava EE 6サービスやJava EE 7サービスはJava EE 5サービスに似ています。)
+
+[start=8]
+. 「ソース」をクリックし、前述の手順で作成したコードを表示します。これは、サービスをJava EEステートレスBeanとして作成したかどうかによって異なります。次のスクリーンショットの違いがわかりますか。(ステートレスBeanとして実装されていないJava EE 6サービスやJava EE 7サービスはJava EE 5サービスに似ています。)
image::images/jaxws-60-source.png[] image::images/stateless-ejb-code1.png[]
*注意:*NetBeans IDE 7.3およおび7.4では、生成された ``@WebService`` 注釈に、次のサービス名が明示的に指定されていることがわかります。
``@WebService(serviceName = "CalculatorWS")`` 。
-9. エディタで、スケルトンの ``add`` 操作を次のように拡張します(変更部分は太字で表示)。
+
+[start=9]
+. エディタで、スケルトンの ``add`` 操作を次のように拡張します(変更部分は太字で表示)。
[source,java]
----
@@ -185,15 +207,21 @@
2. 「 ``CalculatorWS_Client_Application`` 」ノードを右クリックし、「新規」>「Webサービス・クライアント」を選択します。新規Webサービス・クライアント・ウィザードが開きます。
3. プロジェクトをWSDLソースとして選択します。「参照」をクリックします。CalculatorWSApplicationプロジェクトのCalculatorWS Webサービスを参照します。Webサービスを選択した後、「OK」をクリックします。
image::images/browse-ws.png[]
-4. パッケージ名を選択しないでください。このフィールドは空のままにします。
+
+[start=4]
+. パッケージ名を選択しないでください。このフィールドは空のままにします。
image::images/javaclient-pkg.png[]
-5. その他の設定はデフォルトのままにし、「終了」をクリックします。
+
+[start=5]
+. その他の設定はデフォルトのままにし、「終了」をクリックします。
「プロジェクト」ウィンドウに新しいWebサービス・クライアントが表示され、作成した ``add`` メソッドのノードが追加されています。
image::images/ws-ref-in-client-project.png[]
-6. メイン・クラスをダブルクリックしてソース・エディタで開きます。 ``main()`` メソッドの下に ``add`` ノードをドラッグします。
+
+[start=6]
+. メイン・クラスをダブルクリックしてソース・エディタで開きます。 ``main()`` メソッドの下に ``add`` ノードをドラッグします。
image::images/dnd-add.png[]
次のようになります。
@@ -214,7 +242,9 @@
*注意:* 別の方法として、 ``add`` ノードをドラッグするかわりに、エディタ上で右クリックして「コードを挿入」>「Webサービス操作をコール」を選択することもできます。
-7. ``main()`` メソッド本文で、TODOコメントを、 ``i`` および ``j`` の値を初期化し、 ``add()`` をコールし、結果を出力するコードに置き換えます。
+
+[start=7]
+. ``main()`` メソッド本文で、TODOコメントを、 ``i`` および ``j`` の値を初期化し、 ``add()`` をコールし、結果を出力するコードに置き換えます。
[source,java]
----
@@ -222,7 +252,9 @@
public static void main(String[] args) {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);
}
----
-8. ``main()`` メソッドのコードを、例外を出力するtry/catchブロックで囲みます。
+
+[start=8]
+. ``main()`` メソッドのコードを、例外を出力するtry/catchブロックで囲みます。
[source,java]
----
@@ -230,7 +262,9 @@
public static void main(String[] args) {try {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);} catch (Exception ex) {System.out.println("Exception: " + ex);}
}
----
-9. プロジェクトのノードを右クリックし、「実行」を選択します。
+
+[start=9]
+. プロジェクトのノードを右クリックし、「実行」を選択します。
「出力」ウィンドウで次のような合計が表示されます。
@@ -254,24 +288,40 @@
新規Webサービス・クライアント・ウィザードが開きます。
-3. WSDLソースとしてプロジェクトを選択し、「参照」をクリックして「Webサービスを参照」ダイアログ・ボックスを開きます。
-4. CalculatorWSApplicationプロジェクトでCalculatorWS Webサービスを選択します。「OK」をクリックして、「Webサービスを参照」ダイアログ・ボックスを閉じます。
+
+[start=3]
+. WSDLソースとしてプロジェクトを選択し、「参照」をクリックして「Webサービスを参照」ダイアログ・ボックスを開きます。
+
+[start=4]
+. CalculatorWSApplicationプロジェクトでCalculatorWS Webサービスを選択します。「OK」をクリックして、「Webサービスを参照」ダイアログ・ボックスを閉じます。
image::images/browse-ws.png[]
-5. 新規Webサービス・クライアント・ウィザードでパッケージ名が空白であることを確認し、他の設定はデフォルト値のままにします。「終了」をクリックします。
+
+[start=5]
+. 新規Webサービス・クライアント・ウィザードでパッケージ名が空白であることを確認し、他の設定はデフォルト値のままにします。「終了」をクリックします。
先ほどこのチュートリアルで作成した ``add`` 操作も含め、「プロジェクト」ウィンドウの「Webサービス参照」ノードに新しく作成したクライアントの構造が次のように表示されます。
-6. 「 ``CalculatorWSServletClient`` 」プロジェクト・ノードを右クリックし、「新規」>「サーブレット」を選択します。サーブレットに ``ClientServlet`` と名前を付け、 ``org.me.calculator.client`` というパッケージに保存します。「終了」をクリックします。
-7. サーブレットをアプリケーションのエントリ・ポイントにするには、「CalculatorWSServletClient」プロジェクト・ノードを右クリックし、「プロパティ」を選択します。「実行」プロパティを開き、「相対URL」フィールドに「 ``/ClientServlet`` 」と入力します。「OK」をクリックします。
-8. ``ClientServlet.java`` のエラー・アイコンがある場合、プロジェクト・ノードを右クリックし、「消去してビルド」を選択します。
-9. ``processRequest()`` メソッドで、この行の後に空白行をいくつか追加します。
+
+[start=6]
+. 「 ``CalculatorWSServletClient`` 」プロジェクト・ノードを右クリックし、「新規」>「サーブレット」を選択します。サーブレットに ``ClientServlet`` と名前を付け、 ``org.me.calculator.client`` というパッケージに保存します。「終了」をクリックします。
+
+[start=7]
+. サーブレットをアプリケーションのエントリ・ポイントにするには、「CalculatorWSServletClient」プロジェクト・ノードを右クリックし、「プロパティ」を選択します。「実行」プロパティを開き、「相対URL」フィールドに「 ``/ClientServlet`` 」と入力します。「OK」をクリックします。
+
+[start=8]
+. ``ClientServlet.java`` のエラー・アイコンがある場合、プロジェクト・ノードを右クリックし、「消去してビルド」を選択します。
+
+[start=9]
+. ``processRequest()`` メソッドで、この行の後に空白行をいくつか追加します。
[source,xml]
----
out.println("<h1>Servlet ClientServlet at " + request.getContextPath () + "</h1>");
----
-10. ソース・エディタで、 ``add`` 操作を ``ClientServlet`` クラスの本文の任意の場所にドラッグします。 ``add()`` メソッドがクラス・コードの末尾に表示されます。
+
+[start=10]
+. ソース・エディタで、 ``add`` 操作を ``ClientServlet`` クラスの本文の任意の場所にドラッグします。 ``add()`` メソッドがクラス・コードの末尾に表示されます。
*注意:* 別の方法として、 ``add`` ノードをドラッグするかわりに、エディタ上で右クリックして「コードを挿入」>「Webサービス操作をコール」を選択することもできます。
@@ -282,7 +332,9 @@
private int add(int i, int j) {org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();return port.add(i, j);
}
----
-11. ``i`` および ``j`` の値を初期化し、 ``add()`` をコールし、結果を出力するコードを追加します。追加されたコードは*太字*で示されています。
+
+[start=11]
+. ``i`` および ``j`` の値を初期化し、 ``add()`` をコールし、結果を出力するコードを追加します。追加されたコードは*太字*で示されています。
[source,xml]
----
@@ -309,7 +361,9 @@
} finally { out.close();}}
----
-12. 追加されたコードを、例外を出力するtry/catchブロックで囲みます。
+
+[start=12]
+. 追加されたコードを、例外を出力するtry/catchブロックで囲みます。
[source,xml]
----
@@ -335,7 +389,9 @@
} finally { out.close();}}
----
-13. プロジェクトのノードを右クリックし、「実行」を選択します。
+
+[start=13]
+. プロジェクトのノードを右クリックし、「実行」を選択します。
サーバーが起動し、アプリケーションがビルドおよびデプロイされ、ブラウザが開いて次のように計算結果を表示します。
image::images/jaxws-60-webclient.png[]
@@ -353,18 +409,32 @@
ポップアップ・メニューに「JSP」がない場合は、「新規」>「その他」を選択し、新規ファイル・ウィザードの「Web」カテゴリで「JSP」を選択します。
-4. 新規ファイル・ウィザードでJSPファイルの名前に*index*と入力します。「終了」をクリックします。
-5. 「 ``CalculatorWSJSPClient`` 」ノードを右クリックし、「新規」>「Webサービス・クライアント」を選択します。
-6. プロジェクトをWSDLソースとして選択します。「参照」をクリックします。CalculatorWSApplicationプロジェクトのCalculatorWS Webサービスを参照します。Webサービスを選択した後、「OK」をクリックします。
+
+[start=4]
+. 新規ファイル・ウィザードでJSPファイルの名前に*index*と入力します。「終了」をクリックします。
+
+[start=5]
+. 「 ``CalculatorWSJSPClient`` 」ノードを右クリックし、「新規」>「Webサービス・クライアント」を選択します。
+
+[start=6]
+. プロジェクトをWSDLソースとして選択します。「参照」をクリックします。CalculatorWSApplicationプロジェクトのCalculatorWS Webサービスを参照します。Webサービスを選択した後、「OK」をクリックします。
image::images/browse-ws.png[]
-7. パッケージ名を選択しないでください。このフィールドは空のままにします。
-8. その他の設定はデフォルトのままにし、「終了」をクリックします。
+
+[start=7]
+. パッケージ名を選択しないでください。このフィールドは空のままにします。
+
+[start=8]
+. その他の設定はデフォルトのままにし、「終了」をクリックします。
次のように、「プロジェクト」ウィンドウに新しいWebサービス・クライアントが表示されます。
image::images/ws-ref-in-jsp-client.png[]
-9. 「Webサービス参照」ノードで、Webサービスを示すノードを展開します。ここで、クライアントから呼び出す ``add`` 操作が表示されます。
-10. ``add`` 操作をクライアントの ``index.jsp`` ページにドラッグし、H1タグの下にドロップします。次のように、サービスの操作を呼び出すコードが ``index.jsp`` ページに生成されます。
+
+[start=9]
+. 「Webサービス参照」ノードで、Webサービスを示すノードを展開します。ここで、クライアントから呼び出す ``add`` 操作が表示されます。
+
+[start=10]
+. ``add`` 操作をクライアントの ``index.jsp`` ページにドラッグし、H1タグの下にドロップします。次のように、サービスの操作を呼び出すコードが ``index.jsp`` ページに生成されます。
[source,java]
----
@@ -387,7 +457,9 @@
``i`` および ``j`` の値を0から3や4などの整数に変更します。catchブロック内のコメントアウトされたTODO行を ``out.println("exception" +ex);`` に置き換えます。
-11. プロジェクトのノードを右クリックし、「実行」を選択します。
+
+[start=11]
+. プロジェクトのノードを右クリックし、「実行」を選択します。
サーバーが起動していない場合は起動します。アプリケーションがビルドおよびデプロイされ、ブラウザが開き、計算結果が表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_pt_BR.asciidoc
index f4223a4..6cc0000 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_pt_BR.asciidoc
@@ -72,8 +72,12 @@
Você pode criar um Web service JAX-WS em um projeto Maven. Selecione Arquivo > Novo Projeto (Ctrl-Shift-N no Linux e no Windows, ⌘-Shift-N no MacOS) e o módulo Aplicação Web Maven ou Maven EJB na categoria Maven. Se você nunca tiver usado Maven com NetBeans antes, consulte link:http://wiki.netbeans.org/MavenBestPractices[+Melhores Práticas para o Maven+].
-2. Nomeie o projeto ``CalculatorWSApplication`` . Selecione uma localização para o projeto. Clique em Próximo.
-3. Selecione o servidor e a versão do Java EE e clique em Finalizar.
+
+[start=2]
+. Nomeie o projeto ``CalculatorWSApplication`` . Selecione uma localização para o projeto. Clique em Próximo.
+
+[start=3]
+. Selecione o servidor e a versão do Java EE e clique em Finalizar.
Para usar o Oracle WebLogic server, link:../web/jsf-jpa-weblogic.html#01[+registre o servidor no IDE+]. Além disso, se você estiver usando o WebLogic server, observe a screencast em link:../javaee/weblogic-javaee-m1-screencast.html[+Implantando uma Aplicação Web para Oracle WebLogic+].
@@ -84,7 +88,9 @@
2. Chame o Web service de ``CalculatorWS`` e digite ``org.me.calculator`` no Pacote. Deixe Criar Web Service do Início selecionado.
3. Se você estiver criando um projeto Java EE em GlassFish ou WebLogic, selecione Implementar Web Service como um Bean de Sessão Sem Estado.
image::images/generate-ws-ee6.png[]
-4. Clique em Finalizar. A janela Projetos exibirá a estrutura do novo Web service e o código-fonte será mostrado na área do editor.
+
+[start=4]
+. Clique em Finalizar. A janela Projetos exibirá a estrutura do novo Web service e o código-fonte será mostrado na área do editor.
== Adicionando uma Operação ao Web service
@@ -103,29 +109,45 @@
* Localize o nó do Web service na janela Projetos. Clique com o botão direito do mouse no nó. Aparecerá um menu de contexto.
image::images/add-op-cx-menu-item.png[]
-2. Clique em Adicionar Operação no designer visual ou no menu de contexto. A caixa de diálogo Adicionar Operação será aberta.
-3. Na parte superior da caixa de diálogo Adicionar Operação, digite ``add`` em Nome e digite ``int`` na lista drop-down Tipo de Retorno.
-4. Na parte inferior da caixa de diálogo Adicionar Operação, clique em Adicionar e crie um parâmetro de tipo ``int`` chamado ``i`` .
-5. Clique novamente em Adicionar e crie um parâmetro de tipo ``int`` chamado de ``j`` .
+
+[start=2]
+. Clique em Adicionar Operação no designer visual ou no menu de contexto. A caixa de diálogo Adicionar Operação será aberta.
+
+[start=3]
+. Na parte superior da caixa de diálogo Adicionar Operação, digite ``add`` em Nome e digite ``int`` na lista drop-down Tipo de Retorno.
+
+[start=4]
+. Na parte inferior da caixa de diálogo Adicionar Operação, clique em Adicionar e crie um parâmetro de tipo ``int`` chamado ``i`` .
+
+[start=5]
+. Clique novamente em Adicionar e crie um parâmetro de tipo ``int`` chamado de ``j`` .
Agora você deverá ver o seguinte:
image::images/jaxws-60-add-operation.png[]
-6. Clique em OK na parte inferior da caixa de diálogo Adicionar Operação. Você retornará ao editor.
-7. Remova a operação ``hello`` default deletando o método ``hello()`` no código-fonte ou selecionando a operação ``hello`` no visual designer e clicando em Remover Operação.
+
+[start=6]
+. Clique em OK na parte inferior da caixa de diálogo Adicionar Operação. Você retornará ao editor.
+
+[start=7]
+. Remova a operação ``hello`` default deletando o método ``hello()`` no código-fonte ou selecionando a operação ``hello`` no visual designer e clicando em Remover Operação.
O visual designer agora exibe o seguinte:
image::images/design-view-with-op.png[title="Visual designer do Web service que mostra operação adicionada"]
-8. Clique em Código-Fonte e exiba o código que você gerou nas etapas anteriores. Será diferente se você tiver criado o serviço como um bean sem estado Java EE6 ou não. Você pode perceber as diferenças das telas abaixo? (Um serviço Java EE 6 ou Java EE 7 que não é implementado como bean sem estado parece um serviço Java EE 5.)
+
+[start=8]
+. Clique em Código-Fonte e exiba o código que você gerou nas etapas anteriores. Será diferente se você tiver criado o serviço como um bean sem estado Java EE6 ou não. Você pode perceber as diferenças das telas abaixo? (Um serviço Java EE 6 ou Java EE 7 que não é implementado como bean sem estado parece um serviço Java EE 5.)
image::images/jaxws-60-source.png[] image::images/stateless-ejb-code1.png[]
*Observação.* No NetBeans IDE 7.3 e 7.4 você verá que na anotação ``@WebService`` gerada, o nome do serviço é especificado explicitamente:
``@WebService(serviceName = "CalculatorWS")`` .
-9. No editor, estenda a operação de esqueleto ``add`` para o seguinte (alterações em negrito):
+
+[start=9]
+. No editor, estenda a operação de esqueleto ``add`` para o seguinte (alterações em negrito):
[source,java]
----
@@ -185,15 +207,21 @@
2. Clique com o botão direito do mouse no nó ``CalculatorWS_Client_Application`` e selecione Novo > Cliente de Web Service. O assistente de Novo Cliente de Web Service será aberto.
3. Selecione Projeto como o código-fonte WSDL. Clique em Procurar. Procure o Web service CalculatorWS no projeto CalculatorWSApplication. Depois de ter selecionado o Web service, clique em OK.
image::images/browse-ws.png[]
-4. Não selecione um nome de pacote. Deixe este campo vazio.
+
+[start=4]
+. Não selecione um nome de pacote. Deixe este campo vazio.
image::images/javaclient-pkg.png[]
-5. Deixe as outras definições como default e clique em Finalizar.
+
+[start=5]
+. Deixe as outras definições como default e clique em Finalizar.
A janela Projetos exibirá o novo cliente de Web service, com um nó para o método ``add`` que você criou:
image::images/ws-ref-in-client-project.png[]
-6. Clique duas vezes na classe principal para abri-la no Editor de Código-Fonte. Arraste o nó ``adicionar`` abaixo do método ``main()`` .
+
+[start=6]
+. Clique duas vezes na classe principal para abri-la no Editor de Código-Fonte. Arraste o nó ``adicionar`` abaixo do método ``main()`` .
image::images/dnd-add.png[]
Agora você deverá ver o seguinte:
@@ -214,7 +242,9 @@
*Observação:* como alternativa, em vez de arrastar o nó ``adicionar`` , você pode clicar com o botão direito do mouse no editor e, em seguida, selecionar Inserir Código > Operação de Chamada a Web service.
-7. No corpo do método ``main()`` , substitua o comentário TODO com o código que inicializa os valores de ``i`` e ``j`` , chama ``add()`` e mostra o resultado.
+
+[start=7]
+. No corpo do método ``main()`` , substitua o comentário TODO com o código que inicializa os valores de ``i`` e ``j`` , chama ``add()`` e mostra o resultado.
[source,java]
----
@@ -222,7 +252,9 @@
public static void main(String[] args) {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);
}
----
-8. Circunde o código do método ``main()`` com um bloco try/catch que imprime uma exceção.
+
+[start=8]
+. Circunde o código do método ``main()`` com um bloco try/catch que imprime uma exceção.
[source,java]
----
@@ -230,7 +262,9 @@
public static void main(String[] args) {try {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);} catch (Exception ex) {System.out.println("Exception: " + ex);}
}
----
-9. Clique com o botão direito do mouse no nó do projeto e selecione Executar.
+
+[start=9]
+. Clique com o botão direito do mouse no nó do projeto e selecione Executar.
A janela de Saída agora mostra a soma:
@@ -254,24 +288,40 @@
O assistente de Novo Cliente de Web Service será aberto.
-3. Selecione Projeto como origem WSDL e clique em Procurar para abrir a caixa de diálogo Procurar Web Services.
-4. Selecione o web service CalculatorWS no projeto CalculatorWSApplication. Clique em OK para fechar a caixa de diálogo Procurar Web Services.
+
+[start=3]
+. Selecione Projeto como origem WSDL e clique em Procurar para abrir a caixa de diálogo Procurar Web Services.
+
+[start=4]
+. Selecione o web service CalculatorWS no projeto CalculatorWSApplication. Clique em OK para fechar a caixa de diálogo Procurar Web Services.
image::images/browse-ws.png[]
-5. Confirme se o nome do pacote está vazio no assistente de Novo Cliente de Web Service e deixe as outras definições com o valor padrão. Clique em Finalizar.
+
+[start=5]
+. Confirme se o nome do pacote está vazio no assistente de Novo Cliente de Web Service e deixe as outras definições com o valor padrão. Clique em Finalizar.
O nó Referências de Web Service na janela Projetos exibe a estrutura do cliente recém-criado, que inclui a operação ``add`` que você criou anteriormente neste tutorial.
-6. Clique com o botão direito do mouse no nó do projeto ``CalculatorWSServletClient`` e selecione Novo > Servlet. Chame o servlet de ``ClientServlet`` e coloque-o em um pacote chamado ``org.me.calculator.client`` . Clique em Finalizar.
-7. Para tornar o servlet o ponto de entrada da aplicação, clique com o botão direito do mouse no nó do projeto CalculatorWSServletClient e selecione Propriedades. Abra as propriedades de Executar e digite ``/ClientServlet`` no campo URL Relativo. Clique em OK.
-8. Se houver ícones de erro em ``ClientServlet.java`` , clique com o botão direito do mouse no nó do projeto e selecione Limpar e Construir.
-9. No método ``processRequest()`` , adicione algumas linhas vazias depois desta linha:
+
+[start=6]
+. Clique com o botão direito do mouse no nó do projeto ``CalculatorWSServletClient`` e selecione Novo > Servlet. Chame o servlet de ``ClientServlet`` e coloque-o em um pacote chamado ``org.me.calculator.client`` . Clique em Finalizar.
+
+[start=7]
+. Para tornar o servlet o ponto de entrada da aplicação, clique com o botão direito do mouse no nó do projeto CalculatorWSServletClient e selecione Propriedades. Abra as propriedades de Executar e digite ``/ClientServlet`` no campo URL Relativo. Clique em OK.
+
+[start=8]
+. Se houver ícones de erro em ``ClientServlet.java`` , clique com o botão direito do mouse no nó do projeto e selecione Limpar e Construir.
+
+[start=9]
+. No método ``processRequest()`` , adicione algumas linhas vazias depois desta linha:
[source,xml]
----
out.println("<h1>Servlet ClientServlet at " + request.getContextPath () + "</h1>");
----
-10. No Editor de Código-Fonte, arraste a operação ``adicionar`` em qualquer lugar do corpo da classe ``ClientServlet`` . O método ``add()`` aparecerá ao final do código da classe.
+
+[start=10]
+. No Editor de Código-Fonte, arraste a operação ``adicionar`` em qualquer lugar do corpo da classe ``ClientServlet`` . O método ``add()`` aparecerá ao final do código da classe.
*Observação:* como alternativa, em vez de arrastar o nó ``adicionar`` , você pode clicar com o botão direito do mouse no editor e, em seguida, selecionar Inserir Código > Operação de Chamada a Web service.
@@ -282,7 +332,9 @@
private int add(int i, int j) {org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();return port.add(i, j);
}
----
-11. Adicione o código que inicializa os valores de ``i`` e ``j`` , chama ``add()`` e imprime o resultado. O código adicionado está em *negrito*:
+
+[start=11]
+. Adicione o código que inicializa os valores de ``i`` e ``j`` , chama ``add()`` e imprime o resultado. O código adicionado está em *negrito*:
[source,xml]
----
@@ -309,7 +361,9 @@
} finally { out.close();}}
----
-12. Circunde o código adicionado com um bloco try/catch que imprime uma exceção.
+
+[start=12]
+. Circunde o código adicionado com um bloco try/catch que imprime uma exceção.
[source,xml]
----
@@ -335,7 +389,9 @@
} finally { out.close();}}
----
-13. Clique com o botão direito do mouse no nó do projeto e selecione Executar.
+
+[start=13]
+. Clique com o botão direito do mouse no nó do projeto e selecione Executar.
O servidor será iniciado, a aplicação será construída e implantada e o browser será aberto, exibindo o resultado do cálculo, como mostrado abaixo:
image::images/jaxws-60-webclient.png[]
@@ -353,18 +409,32 @@
Se JSP não estiver disponível no menu pop-up, escolha Novo > Outro e selecione JSP na categoria Web do assistente de Novo Arquivo.
-4. Digite *index* como nome do arquivo JSP no assistente de Novo Arquivo. Clique em Finalizar.
-5. Clique com o botão direito do mouse no nó ``CalculatorWSJSPClient`` e selecione Novo > Cliente de Web service.
-6. Selecione Projeto como o código-fonte WSDL. Clique em Procurar. Procure o Web service CalculatorWS no projeto CalculatorWSApplication. Depois de ter selecionado o Web service, clique em OK.
+
+[start=4]
+. Digite *index* como nome do arquivo JSP no assistente de Novo Arquivo. Clique em Finalizar.
+
+[start=5]
+. Clique com o botão direito do mouse no nó ``CalculatorWSJSPClient`` e selecione Novo > Cliente de Web service.
+
+[start=6]
+. Selecione Projeto como o código-fonte WSDL. Clique em Procurar. Procure o Web service CalculatorWS no projeto CalculatorWSApplication. Depois de ter selecionado o Web service, clique em OK.
image::images/browse-ws.png[]
-7. Não selecione um nome de pacote. Deixe este campo vazio.
-8. Deixe as outras definições como default e clique em Finalizar.
+
+[start=7]
+. Não selecione um nome de pacote. Deixe este campo vazio.
+
+[start=8]
+. Deixe as outras definições como default e clique em Finalizar.
A janela Projetos exibe o novo cliente de web service, como mostrado abaixo:
image::images/ws-ref-in-jsp-client.png[]
-9. No nó Referências de Web Services, expanda o nó que representa o Web service. A operação ``adicionar`` , que você chamará do cliente, agora está exposta.
-10. Arraste a operação ``adicionar`` para a página ``index.jsp`` do cliente e solte-a abaixo das tags H1. O código para chamar a operação de serviço agora é gerado na página ``index.jsp`` , como você pode ver aqui:
+
+[start=9]
+. No nó Referências de Web Services, expanda o nó que representa o Web service. A operação ``adicionar`` , que você chamará do cliente, agora está exposta.
+
+[start=10]
+. Arraste a operação ``adicionar`` para a página ``index.jsp`` do cliente e solte-a abaixo das tags H1. O código para chamar a operação de serviço agora é gerado na página ``index.jsp`` , como você pode ver aqui:
[source,java]
----
@@ -387,7 +457,9 @@
Altere o valor de ``i`` e ``j`` de 0 por outros inteiros, como 3 e 4. Substitua a linha TODO comentada no bloco catch por ``out.println("exception" + ex);`` .
-11. Clique com o botão direito do mouse no nó do projeto e selecione Executar.
+
+[start=11]
+. Clique com o botão direito do mouse no nó do projeto e selecione Executar.
O servidor será iniciado, caso já não esteja em execução. A aplicação será construída e implantada e o browser será aberto, exibindo o resultado do cálculo:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ru.asciidoc
index d66ec83..8bf83fa 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_ru.asciidoc
@@ -72,8 +72,12 @@
Веб-службу JAX-WS можно создать в проекте Maven. Выберите 'Файл' > 'Создать проект' (Ctrl-Shift-N в Linux и Windows, ⌘-Shift-N ы MacOS), а затем веб-приложение Maven или модуль Maven EJB в категории Maven. Если ранее вы не использовали Maven со средой NetBeans, ознакомьтесь с документом link:http://wiki.netbeans.org/MavenBestPractices[+Maven Best Practices+] (Рекомендации по Maven).
-2. Дайте проекту имя ``CalculatorWSApplication`` . Выберите местоположение для проекта. Нажмите кнопку "Далее".
-3. Выберите свой сервер и версию Java EE и щелкните "Готово".
+
+[start=2]
+. Дайте проекту имя ``CalculatorWSApplication`` . Выберите местоположение для проекта. Нажмите кнопку "Далее".
+
+[start=3]
+. Выберите свой сервер и версию Java EE и щелкните "Готово".
Для использования сервера Oracle WebLogic link:../web/jsf-jpa-weblogic.html#01[+зарегистрируйте сервер с помощью среды IDE+]. Кроме этого, если вы используете сервер WebLogic, просмотрите экранную демонстрацию link:../javaee/weblogic-javaee-m1-screencast.html[+Deploying a Web Application to Oracle WebLogic+] (Развертывание веб-приложения на Oracle WebLogic).
@@ -84,7 +88,9 @@
2. Присвойте веб-службе имя ``CalculatorWS`` и введите ``org.me.calculator`` в поле "Пакет". Оставьте установленной кнопку-переключатель "Создать веб-службу с нуля".
3. При создании проекта Java EE на сервере GlassFish или WebLogic выберите 'Реализовать веб-службу' в качестве компонента сеанса без сохранения состояния.
image::images/generate-ws-ee6.png[]
-4. Нажмите кнопку 'Готово'. В окне "Проекты" отображается структура новой веб-службы, а в области редактора отображается исходный код.
+
+[start=4]
+. Нажмите кнопку 'Готово'. В окне "Проекты" отображается структура новой веб-службы, а в области редактора отображается исходный код.
== Добавление операции к веб-службам
@@ -103,29 +109,45 @@
* Найдите узел веб-службы в окне "Проекты". Щелкните узел правой кнопкой мыши. Откроется контекстное меню.
image::images/add-op-cx-menu-item.png[]
-2. Щелкните "Добавить операцию" либо в визуальном конструкторе, либо в контекстном меню. Откроется диалоговое окно "Добавление операции".
-3. В верхней части диалогового окна "Добавить операцию" введите ``add`` в 'Имя' и введите ``int`` в раскрывающийся список "Тип возвращаемого значения".
-4. В нижней части диалогового окна "Добавить операцию" нажмите кнопку "Добавить" и создайте параметр типа ``int`` с именем ``i`` .
-5. Снова щелкните "Добавить" и создайте параметр типа ``int`` с именем ``j`` .
+
+[start=2]
+. Щелкните "Добавить операцию" либо в визуальном конструкторе, либо в контекстном меню. Откроется диалоговое окно "Добавление операции".
+
+[start=3]
+. В верхней части диалогового окна "Добавить операцию" введите ``add`` в 'Имя' и введите ``int`` в раскрывающийся список "Тип возвращаемого значения".
+
+[start=4]
+. В нижней части диалогового окна "Добавить операцию" нажмите кнопку "Добавить" и создайте параметр типа ``int`` с именем ``i`` .
+
+[start=5]
+. Снова щелкните "Добавить" и создайте параметр типа ``int`` с именем ``j`` .
На экране должны быть представлены следующие параметры:
image::images/jaxws-60-add-operation.png[]
-6. Нажмите кнопку "ОК" в нижней части диалогового окна "Добавить операцию". Вы вернетесь в редактор.
-7. Удалите операцию по умолчанию ``hello`` . Для этого либо удалите метод ``hello()`` в исходном коде, либо выберите операцию ``hello`` в визуальном конструкторе и щелкните "Удалить операцию".
+
+[start=6]
+. Нажмите кнопку "ОК" в нижней части диалогового окна "Добавить операцию". Вы вернетесь в редактор.
+
+[start=7]
+. Удалите операцию по умолчанию ``hello`` . Для этого либо удалите метод ``hello()`` в исходном коде, либо выберите операцию ``hello`` в визуальном конструкторе и щелкните "Удалить операцию".
Теперь в Visual Designer отображается следующее:
image::images/design-view-with-op.png[title="В Visual Designer веб-службы отображается добавленная операция"]
-8. Нажмите кнопку "Исходный код" и посмотрите на код, созданный в результате предыдущих действий. Он будет различаться в зависимости от того, как создана служба: в качестве компонента Java EE без сохранения состояния или обычным способом. Обратите внимание на разницу в снимках экрана ниже: (Служба Java EE 6 или Java EE 7, не реализованная в качестве компонента без сохранения состояния, похожа на службу Java EE 5.)
+
+[start=8]
+. Нажмите кнопку "Исходный код" и посмотрите на код, созданный в результате предыдущих действий. Он будет различаться в зависимости от того, как создана служба: в качестве компонента Java EE без сохранения состояния или обычным способом. Обратите внимание на разницу в снимках экрана ниже: (Служба Java EE 6 или Java EE 7, не реализованная в качестве компонента без сохранения состояния, похожа на службу Java EE 5.)
image::images/jaxws-60-source.png[] image::images/stateless-ejb-code1.png[]
*Примечание.* При работе в IDE NetBeans 7.3 и 7.4 вы увидите, что в созданной аннотации ``@WebService`` имя службы указано явно:
``@WebService(serviceName = "CalculatorWS")`` .
-9. В редакторе расширьте схему операции ``add`` следующим образом (изменения выделены полужирным шрифтом):
+
+[start=9]
+. В редакторе расширьте схему операции ``add`` следующим образом (изменения выделены полужирным шрифтом):
[source,java]
----
@@ -185,15 +207,21 @@
2. Щелкните правой кнопкой мыши узел ``CalculatorWS_Client_Application`` и выберите "Создать > Клиент веб-службы". Появится мастер создания клиента веб-службы.
3. Выберите проект в виде исходного файла WSDL. Нажмите кнопку "Обзор". В проекте CalculatorWSApplication перейдите к веб-службе CalculatorWS. Выберите веб-службу и нажмите кнопку "ОК".
image::images/browse-ws.png[]
-4. Не выбирайте имя пакета. Оставьте это поле пустым.
+
+[start=4]
+. Не выбирайте имя пакета. Оставьте это поле пустым.
image::images/javaclient-pkg.png[]
-5. Оставьте значения остальных параметров по умолчанию и нажмите кнопку "Готово".
+
+[start=5]
+. Оставьте значения остальных параметров по умолчанию и нажмите кнопку "Готово".
В окне "Проекты" появится новый клиент веб-службы с узлом для созданного метода ``add`` :
image::images/ws-ref-in-client-project.png[]
-6. Дважды щелкните главный класс, чтобы открыть его в редакторе исходного кода. Перетащите узел ``add`` в местоположение ниже метода ``main()`` .
+
+[start=6]
+. Дважды щелкните главный класс, чтобы открыть его в редакторе исходного кода. Перетащите узел ``add`` в местоположение ниже метода ``main()`` .
image::images/dnd-add.png[]
На экране должны быть представлены следующие параметры:
@@ -214,7 +242,9 @@
*Примечание.* В качестве альтернативы, вместо перетаскивания узла ``add`` можно щелкнуть правой кнопкой мыши в редакторе, а затем выбрать 'Вставить код' > 'Dspdfnm операцию с веб-службой'.
-7. В теле метода ``main()`` замените комментарий TODO кодом, который инициализирует значения для ``i`` и ``j`` , вызывает ``add()`` и распечатывает результат.
+
+[start=7]
+. В теле метода ``main()`` замените комментарий TODO кодом, который инициализирует значения для ``i`` и ``j`` , вызывает ``add()`` и распечатывает результат.
[source,java]
----
@@ -222,7 +252,9 @@
public static void main(String[] args) {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);
}
----
-8. Окружите код метода ``main()`` блоком try/catch, который распечатывает исключение.
+
+[start=8]
+. Окружите код метода ``main()`` блоком try/catch, который распечатывает исключение.
[source,java]
----
@@ -230,7 +262,9 @@
public static void main(String[] args) {try {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);} catch (Exception ex) {System.out.println("Exception: " + ex);}
}
----
-9. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить".
+
+[start=9]
+. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить".
Теперь в окне "Вывод" отображается сумма:
@@ -254,24 +288,40 @@
Появится мастер создания клиента веб-службы.
-3. В качестве источника WSDL выберите "Проект" и нажмите кнопку "Обзор", чтобы открыть диалоговое окно "Обзор веб-служб".
-4. В проекте CalculatorWSApplication выберите веб-службу CalculatorWS. Нажмите кнопку OK, чтобы закрыть диалоговое окно "Обзор веб-служб".
+
+[start=3]
+. В качестве источника WSDL выберите "Проект" и нажмите кнопку "Обзор", чтобы открыть диалоговое окно "Обзор веб-служб".
+
+[start=4]
+. В проекте CalculatorWSApplication выберите веб-службу CalculatorWS. Нажмите кнопку OK, чтобы закрыть диалоговое окно "Обзор веб-служб".
image::images/browse-ws.png[]
-5. Оставьте поле "Имя пакета" в мастере создания клиентов веб-службы пустым и не меняйте значения всех остальных параметров, заданные по умолчанию. Нажмите "Готово".
+
+[start=5]
+. Оставьте поле "Имя пакета" в мастере создания клиентов веб-службы пустым и не меняйте значения всех остальных параметров, заданные по умолчанию. Нажмите "Готово".
Узел "Ссылки на веб-службу" в окне "Проекты" отражает структуру только что созданного клиента, включая операцию ``add`` , рассмотренную ранее в этом учебном курсе.
-6. Щелкните правой кнопкой мыши узел проекта ``CalculatorWSServletClient`` и выберите "Создать > Сервлет". Дайте сервлету имя ``ClientServlet`` и поместите его в пакет с именем ``org.me.calculator.client`` . Нажмите кнопку 'Готово'.
-7. Чтобы сделать сервлет точкой ввода в приложении щелкните правой кнопкой мыши узел проекта CalculatorWSServletClient и выберите 'Свойства'. Откройте "Свойства выполнения" и введите ``/ClientServlet`` в поле "Относительный адрес". Нажмите кнопку "ОК".
-8. При наличии значков ошибок для ``ClientServlet.java`` щелкните правой кнопкой мыши узел проекта и выберите 'Очистка и сборка'.
-9. В методе ``processRequest()`` добавьте несколько пустых строк после следующей строки:
+
+[start=6]
+. Щелкните правой кнопкой мыши узел проекта ``CalculatorWSServletClient`` и выберите "Создать > Сервлет". Дайте сервлету имя ``ClientServlet`` и поместите его в пакет с именем ``org.me.calculator.client`` . Нажмите кнопку 'Готово'.
+
+[start=7]
+. Чтобы сделать сервлет точкой ввода в приложении щелкните правой кнопкой мыши узел проекта CalculatorWSServletClient и выберите 'Свойства'. Откройте "Свойства выполнения" и введите ``/ClientServlet`` в поле "Относительный адрес". Нажмите кнопку "ОК".
+
+[start=8]
+. При наличии значков ошибок для ``ClientServlet.java`` щелкните правой кнопкой мыши узел проекта и выберите 'Очистка и сборка'.
+
+[start=9]
+. В методе ``processRequest()`` добавьте несколько пустых строк после следующей строки:
[source,xml]
----
out.println("<h1>Servlet ClientServlet at " + request.getContextPath () + "</h1>");
----
-10. В редакторе исходного кода перетащите операцию ``add`` в любое место тела класса ``ClientServlet`` . Метод ``add()`` отображается в конце кода класса.
+
+[start=10]
+. В редакторе исходного кода перетащите операцию ``add`` в любое место тела класса ``ClientServlet`` . Метод ``add()`` отображается в конце кода класса.
*Примечание.* В качестве альтернативы, вместо перетаскивания узла ``add`` можно щелкнуть правой кнопкой мыши в редакторе, а затем выбрать 'Вставить код' > 'Dspdfnm операцию с веб-службой'.
@@ -282,7 +332,9 @@
private int add(int i, int j) {org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();return port.add(i, j);
}
----
-11. Добавьте код, который инициализирует значения для ``i`` и ``j`` , вызывает ``add()`` и распечатывает результат. Добавленный код выделяется *полужирным начертанием*:
+
+[start=11]
+. Добавьте код, который инициализирует значения для ``i`` и ``j`` , вызывает ``add()`` и распечатывает результат. Добавленный код выделяется *полужирным начертанием*:
[source,xml]
----
@@ -309,7 +361,9 @@
} finally { out.close();}}
----
-12. Окружите добавленный код блоком try/catch, который распечатывает исключение.
+
+[start=12]
+. Окружите добавленный код блоком try/catch, который распечатывает исключение.
[source,xml]
----
@@ -335,7 +389,9 @@
} finally { out.close();}}
----
-13. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить".
+
+[start=13]
+. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить".
Запускается сервер, выполняются сборка и развертывание приложения, и открывается браузер, в котором отображается результат вычисления, как показано ниже:
image::images/jaxws-60-webclient.png[]
@@ -353,18 +409,32 @@
Если в меню отсутствует пункт "JSP", выберите "Создать > Другие", затем выберите JSP в категории "Веб" мастера создания файлов.
-4. В качестве имени файла JSP в мастере создания файлов укажите *index*. Нажмите "Готово".
-5. Щелкните правой кнопкой мыши узел ``CalculatorWSJSPClient`` и выберите "Создать > Клиент веб-службы".
-6. Выберите проект в виде исходного файла WSDL. Нажмите кнопку "Обзор". В проекте CalculatorWSApplication перейдите к веб-службе CalculatorWS. Выберите веб-службу и нажмите кнопку "ОК".
+
+[start=4]
+. В качестве имени файла JSP в мастере создания файлов укажите *index*. Нажмите "Готово".
+
+[start=5]
+. Щелкните правой кнопкой мыши узел ``CalculatorWSJSPClient`` и выберите "Создать > Клиент веб-службы".
+
+[start=6]
+. Выберите проект в виде исходного файла WSDL. Нажмите кнопку "Обзор". В проекте CalculatorWSApplication перейдите к веб-службе CalculatorWS. Выберите веб-службу и нажмите кнопку "ОК".
image::images/browse-ws.png[]
-7. Не выбирайте имя пакета. Оставьте это поле пустым.
-8. Оставьте значения остальных параметров по умолчанию и нажмите кнопку "Готово".
+
+[start=7]
+. Не выбирайте имя пакета. Оставьте это поле пустым.
+
+[start=8]
+. Оставьте значения остальных параметров по умолчанию и нажмите кнопку "Готово".
В окне "Проекты" появится новый клиент веб-службы, как показано ниже:
image::images/ws-ref-in-jsp-client.png[]
-9. В узле "Ссылки на веб-службы" разверните узел, соответствующий веб-службе. Теперь показана операция ``add`` , которую требуется вызывать посредством клиента.
-10. Перетащите операцию ``add`` на страницу клиента ``index.jsp`` ниже тегов H1. Теперь на странице ``index.jsp`` отображается код для вызова операции службы, показанный ниже:
+
+[start=9]
+. В узле "Ссылки на веб-службы" разверните узел, соответствующий веб-службе. Теперь показана операция ``add`` , которую требуется вызывать посредством клиента.
+
+[start=10]
+. Перетащите операцию ``add`` на страницу клиента ``index.jsp`` ниже тегов H1. Теперь на странице ``index.jsp`` отображается код для вызова операции службы, показанный ниже:
[source,java]
----
@@ -387,7 +457,9 @@
Измените значения для ``i`` и ``j`` с 0 на другие целые числа, например, на 3 и 4. В блоке "catch" замените закомментированную строчку "TODO" на ``out.println("exception" + ex);`` .
-11. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить".
+
+[start=11]
+. Щелкните правой кнопкой мыши узел проекта и выберите "Выполнить".
Запускается сервер, если он не был запущен ранее. После сборки и развертывания приложения открывается браузер, в котором отображается результат вычисления:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_zh_CN.asciidoc
index 80c091b..654c86f 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/jax-ws_zh_CN.asciidoc
@@ -72,8 +72,12 @@
您可以在 Maven 项目中创建 JAX-WS Web 服务。选择 "File"(文件)> "New Project"(新建项目)(在 Linux 和 Windows 上为 Ctrl-Shift-N 组合键,在 MacOS 上为 ⌘-Shift-N 组合键),然后从 "Maven" 类别中选择 "Maven Web Application"(Maven Web 应用程序)或 "Maven EJB module"(Maven EJB 模块)。如果您以前没有同时使用过 Maven 和 NetBeans,请参见 link:http://wiki.netbeans.org/MavenBestPractices[+Maven 最佳做法+]。
-2. 将该项目命名为 ``CalculatorWSApplication`` 。为该项目选择一个位置。单击 "Next"(下一步)。
-3. 选择服务器和 Java EE 版本,然后单击 "Finish"(完成)。
+
+[start=2]
+. 将该项目命名为 ``CalculatorWSApplication`` 。为该项目选择一个位置。单击 "Next"(下一步)。
+
+[start=3]
+. 选择服务器和 Java EE 版本,然后单击 "Finish"(完成)。
要使用 Oracle WebLogic Server,请link:../web/jsf-jpa-weblogic.html#01[+在 IDE 中注册服务器+]。另外,如果使用的是 WebLogic Server,请观看link:../javaee/weblogic-javaee-m1-screencast.html[+将 Web 应用程序部署到 Oracle WebLogic+] 截屏视频。
@@ -84,7 +88,9 @@
2. 将 Web 服务命名为 ``CalculatorWS`` ,并在 "Package"(包)中键入 ``org.me.calculator`` 。将 "Create Web Service from Scratch"(从头开始创建 Web 服务)保持选中状态。
3. 如果要在 GlassFish 或 WebLogic 上创建 Java EE 项目,请选择 "Implement Web Service as a Stateless Session Bean"(将 Web 服务作为无状态会话 Bean 实现)。
image::images/generate-ws-ee6.png[]
-4. 单击 "Finish"(完成)。"Projects"(项目)窗口将显示新 Web 服务的结构,并在编辑器区域中显示源代码。
+
+[start=4]
+. 单击 "Finish"(完成)。"Projects"(项目)窗口将显示新 Web 服务的结构,并在编辑器区域中显示源代码。
== 向 Web 服务中添加操作
@@ -103,29 +109,45 @@
* 在 "Projects"(项目)窗口中查找 Web 服务的节点。右键单击该节点。此时将打开一个上下文菜单。
image::images/add-op-cx-menu-item.png[]
-2. 在可视设计器或上下文菜单中,单击 "Add Operation"(添加操作)。"Add Operation"(添加操作)对话框打开。
-3. 在 "Add Operation"(添加操作)对话框的上半部分中,在 "Name"(名称)中键入 ``add`` ,并在 "Return Type"(返回类型)下拉列表中键入 ``int`` 。
-4. 在 "Add Operation"(添加操作)对话框的下半部分中,单击 "Add"(添加)以创建 ``int`` 类型的参数 ``i`` 。
-5. 然后,再次单击 "Add"(添加)以创建 ``int`` 类型的参数 ``j`` 。
+
+[start=2]
+. 在可视设计器或上下文菜单中,单击 "Add Operation"(添加操作)。"Add Operation"(添加操作)对话框打开。
+
+[start=3]
+. 在 "Add Operation"(添加操作)对话框的上半部分中,在 "Name"(名称)中键入 ``add`` ,并在 "Return Type"(返回类型)下拉列表中键入 ``int`` 。
+
+[start=4]
+. 在 "Add Operation"(添加操作)对话框的下半部分中,单击 "Add"(添加)以创建 ``int`` 类型的参数 ``i`` 。
+
+[start=5]
+. 然后,再次单击 "Add"(添加)以创建 ``int`` 类型的参数 ``j`` 。
现在,您将看到以下内容:
image::images/jaxws-60-add-operation.png[]
-6. 在 "Add Operation"(添加操作)对话框的底部,单击 "OK"(确定)。您将返回到编辑器中。
-7. 删除默认的 ``hello`` 操作,方法是在源代码中删除 ``hello()`` 方法或在可视设计器中选择 ``hello`` 操作并单击 "Remove Operation"(删除操作)。
+
+[start=6]
+. 在 "Add Operation"(添加操作)对话框的底部,单击 "OK"(确定)。您将返回到编辑器中。
+
+[start=7]
+. 删除默认的 ``hello`` 操作,方法是在源代码中删除 ``hello()`` 方法或在可视设计器中选择 ``hello`` 操作并单击 "Remove Operation"(删除操作)。
现在,可视设计器将显示以下内容:
image::images/design-view-with-op.png[title="显示已添加操作的 Web 服务可视设计器"]
-8. 单击 "Source"(源),然后查看在以上步骤中生成的代码。该代码会因您是否将服务创建为 Java EE 无状态 Bean 而有所不同。您能看到以下屏幕快照中的差别吗?(未作为无状态 Bean 实现的 Java EE 6 或 Java EE 7 服务类似于 Java EE 5 服务。)
+
+[start=8]
+. 单击 "Source"(源),然后查看在以上步骤中生成的代码。该代码会因您是否将服务创建为 Java EE 无状态 Bean 而有所不同。您能看到以下屏幕快照中的差别吗?(未作为无状态 Bean 实现的 Java EE 6 或 Java EE 7 服务类似于 Java EE 5 服务。)
image::images/jaxws-60-source.png[] image::images/stateless-ejb-code1.png[]
*注:*在 NetBeans IDE 7.3 和 7.4 中,您可以注意到生成的 ``@WebService`` 表示服务名显式指定:
``@WebService(serviceName = "CalculatorWS")`` 。
-9. 在编辑器中,将框架 ``add`` 操作扩展为以下代码(所做的更改以粗体显示):
+
+[start=9]
+. 在编辑器中,将框架 ``add`` 操作扩展为以下代码(所做的更改以粗体显示):
[source,java]
----
@@ -185,15 +207,21 @@
2. 右键单击 ``CalculatorWS_Client_Application`` 节点,然后选择 "New"(新建)> "Web Service Client"(Web 服务客户端)。此时将打开新建 Web 服务客户端向导。
3. 选择 "Project"(项目)作为 WSDL 源。单击 "Browse"(浏览)。浏览至 CalculatorWSApplication 项目中的 CalculatorWS Web 服务。选定 Web 服务后,单击 "OK"(确定)。
image::images/browse-ws.png[]
-4. 请勿选择包名。将此字段保留为空。
+
+[start=4]
+. 请勿选择包名。将此字段保留为空。
image::images/javaclient-pkg.png[]
-5. 将其他设置保留为默认值,然后单击 "Finish"(完成)。
+
+[start=5]
+. 将其他设置保留为默认值,然后单击 "Finish"(完成)。
"Projects"(项目)窗口将显示新的 Web 服务客户端,其中包括已创建的 ``add`` 方法的节点:
image::images/ws-ref-in-client-project.png[]
-6. 双击以在源代码编辑器中打开主类。将 ``add`` 节点拖至 ``main()`` 方法下面。
+
+[start=6]
+. 双击以在源代码编辑器中打开主类。将 ``add`` 节点拖至 ``main()`` 方法下面。
image::images/dnd-add.png[]
现在,您将看到以下内容:
@@ -214,7 +242,9 @@
*注:*或者,您也可以在编辑器中单击鼠标右键,然后选择 "Insert Code"(插入代码)> "Call Web Service Operation"(调用 Web 服务操作),而无需拖动 ``add`` 节点。
-7. 在 ``main()`` 方法主体中,将 TODO 注释替换为执行以下操作的代码:初始化 ``i`` 和 ``j`` 的值,调用 ``add()`` ,然后输出结果。
+
+[start=7]
+. 在 ``main()`` 方法主体中,将 TODO 注释替换为执行以下操作的代码:初始化 ``i`` 和 ``j`` 的值,调用 ``add()`` ,然后输出结果。
[source,java]
----
@@ -222,7 +252,9 @@
public static void main(String[] args) {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);
}
----
-8. 将 ``main()`` 方法代码包含在输出异常错误的 try/catch 块中。
+
+[start=8]
+. 将 ``main()`` 方法代码包含在输出异常错误的 try/catch 块中。
[source,java]
----
@@ -230,7 +262,9 @@
public static void main(String[] args) {try {int i = 3;int j = 4;int result = add(i, j);System.out.println("Result = " + result);} catch (Exception ex) {System.out.println("Exception: " + ex);}
}
----
-9. 右键单击项目节点,然后选择 "Run"(运行)。
+
+[start=9]
+. 右键单击项目节点,然后选择 "Run"(运行)。
"Output"(输出)窗口将立即显示二者之和:
@@ -254,24 +288,40 @@
此时将打开新建 Web 服务客户端向导。
-3. 选择 "Project"(项目)作为 WSDL 源,然后单击 "Browse"(浏览)以打开 "Browse Web Services"(浏览 Web 服务)对话框。
-4. 在 "CalculatorWSApplication" 项目中选择 "CalculatorWS" Web 服务。单击 "OK"(确定)关闭 "Browse Web Services"(浏览 Web 服务)对话框。
+
+[start=3]
+. 选择 "Project"(项目)作为 WSDL 源,然后单击 "Browse"(浏览)以打开 "Browse Web Services"(浏览 Web 服务)对话框。
+
+[start=4]
+. 在 "CalculatorWSApplication" 项目中选择 "CalculatorWS" Web 服务。单击 "OK"(确定)关闭 "Browse Web Services"(浏览 Web 服务)对话框。
image::images/browse-ws.png[]
-5. 在新建 Web 服务客户端向导中确认包名为空,并保留其他设置的默认值。单击 "Finish"(完成)。
+
+[start=5]
+. 在新建 Web 服务客户端向导中确认包名为空,并保留其他设置的默认值。单击 "Finish"(完成)。
"Projects"(项目)窗口中的 "Web Service References"(Web 服务引用)节点将显示新建客户端的结构,其中包括在本教程前面部分创建的 ``add`` 操作。
-6. 右键单击 ``CalculatorWSServletClient`` 项目节点,然后选择 "New"(新建)> "Servlet"。将该 Servlet 命名为 ``ClientServlet`` ,并将其置于名为 ``org.me.calculator.client`` 的包中。单击 "Finish"(完成)。
-7. 要使 servlet 成为应用程序的入口点,请右键单击 "CalculatorWSServletClient" 项目节点,然后选择 "Properties"(属性)。打开 "Run"(运行)属性,然后在 "Relative URL"(相对 URL)字段中键入 ``/ClientServlet`` 。单击 "OK"(确定)。
-8. 如果 ``ClientServlet.java`` 存在错误图标,请右键单击项目节点,然后选择 "Clean and Build"(清理并构建)。
-9. 在 ``processRequest()`` 方法中,在此行后添加一些空行:
+
+[start=6]
+. 右键单击 ``CalculatorWSServletClient`` 项目节点,然后选择 "New"(新建)> "Servlet"。将该 Servlet 命名为 ``ClientServlet`` ,并将其置于名为 ``org.me.calculator.client`` 的包中。单击 "Finish"(完成)。
+
+[start=7]
+. 要使 servlet 成为应用程序的入口点,请右键单击 "CalculatorWSServletClient" 项目节点,然后选择 "Properties"(属性)。打开 "Run"(运行)属性,然后在 "Relative URL"(相对 URL)字段中键入 ``/ClientServlet`` 。单击 "OK"(确定)。
+
+[start=8]
+. 如果 ``ClientServlet.java`` 存在错误图标,请右键单击项目节点,然后选择 "Clean and Build"(清理并构建)。
+
+[start=9]
+. 在 ``processRequest()`` 方法中,在此行后添加一些空行:
[source,xml]
----
out.println("<h1>Servlet ClientServlet at " + request.getContextPath () + "</h1>");
----
-10. 在源代码编辑器中,将 ``add`` 操作拖至 ``ClientServlet`` 类主体中的任意位置。将在类代码的末尾显示 ``add()`` 方法。
+
+[start=10]
+. 在源代码编辑器中,将 ``add`` 操作拖至 ``ClientServlet`` 类主体中的任意位置。将在类代码的末尾显示 ``add()`` 方法。
*注:*或者,您也可以在编辑器中单击鼠标右键,然后选择 "Insert Code"(插入代码)> "Call Web Service Operation"(调用 Web 服务操作),而无需拖动 ``add`` 节点。
@@ -282,7 +332,9 @@
private int add(int i, int j) {org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();return port.add(i, j);
}
----
-11. 添加执行以下操作的代码:初始化 ``i`` 和 ``j`` 值,调用 ``add()`` ,然后输出结果。添加的代码以*粗体显示*:
+
+[start=11]
+. 添加执行以下操作的代码:初始化 ``i`` 和 ``j`` 值,调用 ``add()`` ,然后输出结果。添加的代码以*粗体显示*:
[source,xml]
----
@@ -309,7 +361,9 @@
} finally { out.close();}}
----
-12. 将添加的代码包含在输出异常错误的 try/catch 块中。
+
+[start=12]
+. 将添加的代码包含在输出异常错误的 try/catch 块中。
[source,xml]
----
@@ -335,7 +389,9 @@
} finally { out.close();}}
----
-13. 右键单击项目节点,然后选择 "Run"(运行)。
+
+[start=13]
+. 右键单击项目节点,然后选择 "Run"(运行)。
将启动服务器;同时,系统将构建并部署应用程序,并且打开浏览器以显示计算结果,如下所示:
image::images/jaxws-60-webclient.png[]
@@ -353,18 +409,32 @@
如果 JSP 在弹出式菜单中不可用,请选择 "New"(新建)> "Other"(其他),然后在新建文件向导的 "Web" 类别中选择 "JSP"。
-4. 在新建文件向导中,键入 *index* 作为 JSP 文件的名称。单击 "Finish"(完成)。
-5. 右键单击 ``CalculatorWSJSPClient`` 节点,然后选择 "New"(新建)> "Web Service Client"(Web 服务客户端)。
-6. 选择 "Project"(项目)作为 WSDL 源。单击 "Browse"(浏览)。浏览至 CalculatorWSApplication 项目中的 CalculatorWS Web 服务。选定 Web 服务后,单击 "OK"(确定)。
+
+[start=4]
+. 在新建文件向导中,键入 *index* 作为 JSP 文件的名称。单击 "Finish"(完成)。
+
+[start=5]
+. 右键单击 ``CalculatorWSJSPClient`` 节点,然后选择 "New"(新建)> "Web Service Client"(Web 服务客户端)。
+
+[start=6]
+. 选择 "Project"(项目)作为 WSDL 源。单击 "Browse"(浏览)。浏览至 CalculatorWSApplication 项目中的 CalculatorWS Web 服务。选定 Web 服务后,单击 "OK"(确定)。
image::images/browse-ws.png[]
-7. 请勿选择包名。将此字段保留为空。
-8. 将其他设置保留为默认值,然后单击 "Finish"(完成)。
+
+[start=7]
+. 请勿选择包名。将此字段保留为空。
+
+[start=8]
+. 将其他设置保留为默认值,然后单击 "Finish"(完成)。
"Projects"(项目)窗口将显示新的 Web 服务客户端,如下所示:
image::images/ws-ref-in-jsp-client.png[]
-9. 在 "Web Service References"(Web 服务引用)节点中,展开表示 Web 服务的节点。此时将显示您要从客户端调用的 ``add`` 操作。
-10. 将 ``add`` 操作拖至客户端的 ``index.jsp`` 页,并将其放在 H1 标记下。在 ``index.jsp`` 页中立即生成用于调用服务操作的代码,如下所示:
+
+[start=9]
+. 在 "Web Service References"(Web 服务引用)节点中,展开表示 Web 服务的节点。此时将显示您要从客户端调用的 ``add`` 操作。
+
+[start=10]
+. 将 ``add`` 操作拖至客户端的 ``index.jsp`` 页,并将其放在 H1 标记下。在 ``index.jsp`` 页中立即生成用于调用服务操作的代码,如下所示:
[source,java]
----
@@ -387,7 +457,9 @@
将 ``i`` 和 ``j`` 的值从 0 更改为其他整数,如 3 和 4。将 catch 块中注释掉的 TODO 行替换为 ``out.println("exception" + ex);`` 。
-11. 右键单击项目节点,然后选择 "Run"(运行)。
+
+[start=11]
+. 右键单击项目节点,然后选择 "Run"(运行)。
将启动服务器(如果它尚未运行)。同时,系统将构建并部署应用程序,并且打开浏览器以显示计算结果:
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/rest.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/rest.asciidoc
index c96c158..0cd58a1 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/rest.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/rest.asciidoc
@@ -110,18 +110,30 @@
1. Register your MySQL server in the IDE, if the server is not registered. To register a MySQL server, go to the IDE's Services window, right-click the Databases node, and select Register MySQL server.
image::images/register-mysql-server.png[]
-2.
+
+[start=2]
+.
A dialog opens in which you type the configuration details of your MySQL server, including administrator user name and password. See "Configuring MySQL Server Properties" in link:../ide/install-and-configure-mysql-server.html[+Connecting to a MySQL Database+].
image::images/basic-mysql-properties.png[]
-3. Start the MySQL server and connect to it. See "Starting the MySQL Server" in link:../ide/install-and-configure-mysql-server.html[+Connecting to a MySQL Database+].
-4. Right-click the MySQL server node and select Create Database. The Create MySQL Database dialog opens.
+
+[start=3]
+. Start the MySQL server and connect to it. See "Starting the MySQL Server" in link:../ide/install-and-configure-mysql-server.html[+Connecting to a MySQL Database+].
+
+[start=4]
+. Right-click the MySQL server node and select Create Database. The Create MySQL Database dialog opens.
image::images/create-database.png[]
-5. Type ``sample`` as the new database name. Grant full access to your root user, or a user of your choice.
+
+[start=5]
+. Type ``sample`` as the new database name. Grant full access to your root user, or a user of your choice.
image::images/new-database-name.png[]
-6. Click OK. A dialog opens informing you that ``sample`` is the name of a sample database, and asking you if you want to create the tables, objects, and data for this database.
+
+[start=6]
+. Click OK. A dialog opens informing you that ``sample`` is the name of a sample database, and asking you if you want to create the tables, objects, and data for this database.
image::images/create-sample-contents.png[]
-7. Click Yes. The IDE creates and populates the database, and adds a connection to the database.
+
+[start=7]
+. Click Yes. The IDE creates and populates the database, and adds a connection to the database.
image::images/generated-db.png[]
@@ -142,8 +154,12 @@
Alternatively, you can create a Maven Web Application. Choose File > New Project (Ctrl-Shift-N on Linux and Windows, ⌘-Shift-N on MacOS). Under Categories, select Maven. Under Projects, select Maven Web Application and click Next.
-2. Under Project Name, enter ``CustomerDB`` . Click Next.
-3. Select either Java EE 6 Web or Java EE 7 Web. Under Server, select the server you want to use, but note that Java EE projects require GlassFish server 3.x or 4.x. Click through the remaining options and click Finish.
+
+[start=2]
+. Under Project Name, enter ``CustomerDB`` . Click Next.
+
+[start=3]
+. Select either Java EE 6 Web or Java EE 7 Web. Under Server, select the server you want to use, but note that Java EE projects require GlassFish server 3.x or 4.x. Click through the remaining options and click Finish.
*Important for Maven Projects:* In NetBeans IDE 7.2 you cannot set the server when you create a Maven web application. However, you need to set the server before you can create a persistence unit. Therefore, after you create the Maven web application, open the project's Properties and set the server in the Run properties. To open the project's Properties, right-click on the Project node and select Properties from the context menu.
@@ -156,22 +172,30 @@
1. Right-click the ``CustomerDB`` node and choose New > Other > Web Services > RESTful Web Services from Database. The New RESTful Web Service wizard opens, on the Database Tables panel.
image::images/open-wizard.png[]
-2. In the Database Tables panel, if you are using the GlassFish server, select the ``jdbc/sample`` data source from the Data Source drop-down field.
+
+[start=2]
+. In the Database Tables panel, if you are using the GlassFish server, select the ``jdbc/sample`` data source from the Data Source drop-down field.
If you are using Tomcat, select jdbc:derby://localhost:1527/sample. If the Derby database server does not start automatically, you need to start it from the Databases tab in the Services window.
*Note for MySQL users:* You have to create a new data source. Select New Data Source, give it an arbitrary descriptive name, and select the ``jdbc:mysql://localhost:3306/sample`` database connection. You created this connection when you created the sample database on MySQL.
image::images/new-mysql-datasource.png[]
-3. Under Available Tables, select CUSTOMER and then click Add. The DISCOUNT_CODE table, which has a relationship with the CUSTOMER table, is also automatically added to the Selected Tables list. If you are using a MySQL database or some versions of Derby, the MICRO_MARKET table is also added. You now see the following (Derby version):
+
+[start=3]
+. Under Available Tables, select CUSTOMER and then click Add. The DISCOUNT_CODE table, which has a relationship with the CUSTOMER table, is also automatically added to the Selected Tables list. If you are using a MySQL database or some versions of Derby, the MICRO_MARKET table is also added. You now see the following (Derby version):
image::images/select-tables.png[title="Database Tables panel of New Entity Classes from Database wizard, showing CUSTOMER and DISCOUNT_CODE tables selected"]
-4. Click Next. The Entity Classes page opens. Type ``entities`` for the Package name. You now see the following (Derby version).
+
+[start=4]
+. Click Next. The Entity Classes page opens. Type ``entities`` for the Package name. You now see the following (Derby version).
*Note:* The RESTful Web Services from Database wizard automatically generates JAXB annotations. If you generate entity classes for a Java EE application with the Entity Classes from Database wizard, and you might later want to create RESTful web services from those entity classes, make sure the Generate JAXB Annotations box is checked. You can also add JAXB annotations by hand to entity classes before running the RESTful Web Services from Entity Classes wizard. For more information, see link:http://netbeans.dzone.com/nb-generate-simpler-rest[+NetBeans to Generate Simpler RESTful Web Services+].
image::../../../images_www/articles/71/websvc/rest/entity-classes.png[]
-5. Click Next. A panel opens in which you can set the name and location of generated service classes and packages. For Java EE projects, you have the option of changing the name and location of the REST application configuration class.
+
+[start=5]
+. Click Next. A panel opens in which you can set the name and location of generated service classes and packages. For Java EE projects, you have the option of changing the name and location of the REST application configuration class.
For this tutorial, accept the defaults and click Finish. When you click Finish the IDE generates entity and service classes. In an Java EE project, the IDE also generates an application configuration class, which is a subclass of Application.
@@ -190,20 +214,30 @@
4. Select GlassFish Server as the target server and Java EE 6 Web or Java EE 7 Web as the Java EE version. Click Finish.
5. Right-click the ``CustomerDB`` project node and choose Test RESTful Web Services. A dialog opens asking if you want to generate the test client inside the service project or in another Java web project. This option lets you work around security restrictions in some browsers. You can use any Web project, as long as it is configured to deploy in the same server domain as the CustomerDB project.
image::../../../images_www/articles/71/websvc/rest/configure-test-client.png[]
-6. Select *Web Test Client in Project* and click Browse.
-7. Select the WebServiceTest project in the Select Project dialog box. Click OK.
+
+[start=6]
+. Select *Web Test Client in Project* and click Browse.
+
+[start=7]
+. Select the WebServiceTest project in the Select Project dialog box. Click OK.
The IDE generates the file ``test-resbeans.html`` in the WebServiceTest project. The IDE also automatically starts the server and deploys the CustomerDB application.
If the output window shows an error message that one or more classes fails to exist and the project does not build, add the Jersey libraries to the compile-time libraries. Right-click the project node and select Properties. In the Properties tree menu, select Libraries. Click Add Library and browse for the Jersey libraries.
-8. Right-click the WebServiceTest and choose Run.
-9. Open your browser to link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
+
+[start=8]
+. Right-click the WebServiceTest and choose Run.
+
+[start=9]
+. Open your browser to link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
image::../../../images_www/articles/71/websvc/rest/test-rest1.png[title="RESTful web service tester landing page in browser"]
On the left-hand side is the set of root resources. Here they are named ``entities.customer`` , ``entities.discountCodes`` and ``entities.microMarket`` .
-10. Click the ``entities.customer`` node. In the "Choose method to test" field, select either GET (application/json) or GET (application/xml). Click Test. The test client sends a request and displays the result in the Test Output section. The test client dispays the Raw View by default. The following image shows the response to an application/xml request.
+
+[start=10]
+. Click the ``entities.customer`` node. In the "Choose method to test" field, select either GET (application/json) or GET (application/xml). Click Test. The test client sends a request and displays the result in the Test Output section. The test client dispays the Raw View by default. The following image shows the response to an application/xml request.
image::images/test-rest-raw.png[]
There are 5 tabs in the Test Output section.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/rest_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/rest_ja.asciidoc
index eaac275..fe21f5c 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/rest_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/rest_ja.asciidoc
@@ -110,18 +110,30 @@
1. MySQLサーバーがまだ登録されていない場合、サーバーをIDEに登録します。MySQLサーバーを登録するには、IDEの「サービス」ウィンドウに移動し、「データベース」ノードを右クリックして「MySQLサーバーを登録」を選択します。
image::images/register-mysql-server.png[]
-2.
+
+[start=2]
+.
管理者のユーザー名やパスワードなどのMySQLサーバーの構成の詳細情報を入力するダイアログが開きます。link:../ide/install-and-configure-mysql-server.html[+MySQLデータベースへの接続+]のMySQLサーバー・プロパティの構成を参照してください。
image::images/basic-mysql-properties.png[]
-3. MySQLサーバーを起動し、これに接続します。link:../ide/install-and-configure-mysql-server.html[+MySQLデータベースへの接続+]のMySQLサーバーの起動を参照してください。
-4. MySQLサーバーのノードを右クリックし、「データベースを作成」を選択します。「MySQLデータベースの作成」ダイアログが開きます。
+
+[start=3]
+. MySQLサーバーを起動し、これに接続します。link:../ide/install-and-configure-mysql-server.html[+MySQLデータベースへの接続+]のMySQLサーバーの起動を参照してください。
+
+[start=4]
+. MySQLサーバーのノードを右クリックし、「データベースを作成」を選択します。「MySQLデータベースの作成」ダイアログが開きます。
image::images/create-database.png[]
-5. 新規データベース名として「 ``sample`` 」と入力します。rootユーザーまたは選択したユーザーにフル・アクセス権を付与します。
+
+[start=5]
+. 新規データベース名として「 ``sample`` 」と入力します。rootユーザーまたは選択したユーザーにフル・アクセス権を付与します。
image::images/new-database-name.png[]
-6. 「OK」をクリックします。ダイアログが開き、 ``sample`` がサンプル・データベースの名前であることを通知し、このデータベースの表、オブジェクトおよびデータを作成するかどうかをユーザーに質問します。
+
+[start=6]
+. 「OK」をクリックします。ダイアログが開き、 ``sample`` がサンプル・データベースの名前であることを通知し、このデータベースの表、オブジェクトおよびデータを作成するかどうかをユーザーに質問します。
image::images/create-sample-contents.png[]
-7. 「はい」をクリックします。IDEはデータベースを作成してデータを生成し、このデータベースに接続を追加します。
+
+[start=7]
+. 「はい」をクリックします。IDEはデータベースを作成してデータを生成し、このデータベースに接続を追加します。
image::images/generated-db.png[]
@@ -142,8 +154,12 @@
あるいは、Maven Webアプリケーションも作成できます。「ファイル」>「新規プロジェクト」(LinuxおよびWindowsでは[Ctrl]-[Shift]-[N]、MacOSでは[⌘]-[Shift]-[N])を選択します。「カテゴリ」から「Maven」を選択します。「プロジェクト」で「Maven Webアプリケーション」を選択して、「次」をクリックします。
-2. 「プロジェクト名」に「 ``CustomerDB`` 」と入力します。「次」をクリックします。
-3. 「Java EE 6 Web」または「Java EE 7 Web」を選択します。「サーバー」で使用するサーバーを選択しますが、Java EEプロジェクトには、GlassFishサーバー3.xまたは4.xが必要であることに注意してください。残りのオプションをクリックして進み、「終了」をクリックします。
+
+[start=2]
+. 「プロジェクト名」に「 ``CustomerDB`` 」と入力します。「次」をクリックします。
+
+[start=3]
+. 「Java EE 6 Web」または「Java EE 7 Web」を選択します。「サーバー」で使用するサーバーを選択しますが、Java EEプロジェクトには、GlassFishサーバー3.xまたは4.xが必要であることに注意してください。残りのオプションをクリックして進み、「終了」をクリックします。
*Mavenプロジェクトで重要: *NetBeans IDE 7.2では、Maven Webアプリケーションを作成するときはサーバーを設定できません。ただし、永続性ユニットを作成するには、サーバーを設定する必要があります。したがって、Maven Webアプリケーションを作成した後、プロジェクトの「プロパティ」を開き、「実行」プロパティでサーバーを設定します。プロジェクトの「プロパティ」を開くには、プロジェクト・ノードを右クリックし、コンテキスト・メニューから「プロパティ」を選択します。
@@ -156,22 +172,30 @@
1. 「 ``CustomerDB`` 」ノードを右クリックし、「新規」>「その他」>「Webサービス」>「データベースからのRESTful Webサービス」を選択します。新規RESTful Webサービス・ウィザードの「データベース表」パネルが開きます。
image::images/open-wizard.png[]
-2. GlassFishサーバーを使用している場合は、「データベース表」パネルの「データ・ソース」ドロップダウン・フィールドから「 ``jdbc/sample`` 」データ・ソースを選択します。
+
+[start=2]
+. GlassFishサーバーを使用している場合は、「データベース表」パネルの「データ・ソース」ドロップダウン・フィールドから「 ``jdbc/sample`` 」データ・ソースを選択します。
Tomcatを使用している場合は、「jdbc:derby://localhost:1527/sample」を選択します。Derbyデータベース・サーバーが自動的に起動しない場合は、「サービス」ウィンドウの「データベース」タブから起動する必要があります。
*MySQLユーザーへの注意:* 新規データ・ソースを作成する必要があります。「新規データ・ソース」を選択し、わかりやすい任意の名前を付け、「 ``jdbc:mysql://localhost:3306/sample`` 」データベース接続を選択します。この接続は、MySQL上にサンプル・データベースを作成したときに作成しました。
image::images/new-mysql-datasource.png[]
-3. 「使用可能な表」で「CUSTOMER」を選択し、「追加」をクリックします。CUSTOMERテーブルと関連のあるDISCOUNT_CODEテーブルが自動的に「選択した表」に追加されます。MySQLデータベースまたはDerbyの一部のバージョンを使用している場合は、MICRO_MARKET表も追加されます。次のようになります(Derbyバージョン)。
+
+[start=3]
+. 「使用可能な表」で「CUSTOMER」を選択し、「追加」をクリックします。CUSTOMERテーブルと関連のあるDISCOUNT_CODEテーブルが自動的に「選択した表」に追加されます。MySQLデータベースまたはDerbyの一部のバージョンを使用している場合は、MICRO_MARKET表も追加されます。次のようになります(Derbyバージョン)。
image::images/select-tables.png[title="データベースからの新規エンティティ・クラス・ウィザードの「データベース表」パネルでCUSTOMERおよびDISCOUNT_CODE表が選択された状態"]
-4. 「次」をクリックします。エンティティ・クラス・ページが開きます。「パッケージ名」に「 ``entities`` 」と入力します。次のようになります(Derbyバージョン)。
+
+[start=4]
+. 「次」をクリックします。エンティティ・クラス・ページが開きます。「パッケージ名」に「 ``entities`` 」と入力します。次のようになります(Derbyバージョン)。
*注意:* データベースからのRESTful Webサービス・ウィザードはJAXB注釈を自動的に生成します。Java EEアプリケーションのエンティティ・クラスを、「データベースからのエンティティ・クラス」ウィザードで生成し、後でこれらのエンティティ・クラスからRESTful Webサービスを作成する可能性がある場合は、「JAXB注釈を生成」ボックスが選択されていることを確認します。また、エンティティ・クラスからのRESTful Webサービス・ウィザードを実行する前に、JAXB注釈をエンティティ・クラスに手作業で追加することもできます。詳細は、link:http://netbeans.dzone.com/nb-generate-simpler-rest[+NetBeansによる簡易なRESTful Webサービスの生成+]を参照してください。
image::../../../images_www/articles/71/websvc/rest/entity-classes.png[]
-5. 「次」をクリックします。生成したサービス・クラスおよびパッケージの名前と場所を設定できるパネルが開きます。Java EEプロジェクトの場合、RESTアプリケーション構成クラスの名前と場所を変更できます。
+
+[start=5]
+. 「次」をクリックします。生成したサービス・クラスおよびパッケージの名前と場所を設定できるパネルが開きます。Java EEプロジェクトの場合、RESTアプリケーション構成クラスの名前と場所を変更できます。
このチュートリアルでは、デフォルトを受け入れて「終了」をクリックします。「終了」をクリックすると、IDEによってエンティティ・クラスとサービス・クラスが生成されます。Java EEプロジェクトでは、IDEによって、アプリケーションのサブクラスであるアプリケーション構成クラスも生成されます。
@@ -190,20 +214,30 @@
4. ターゲット・サーバーとして「GlassFish Server」を選択し、Java EEバージョンとして「Java EE 6 Web」または「Java EE 7 Web」を選択します。「終了」をクリックします。
5. ``CustomerDB`` プロジェクト・ノードを右クリックし、「RESTful Webサービスをテスト」を選択します。テスト・クライアントを生成する場所を、サービス・プロジェクト内にするか、別のJava Webプロジェクト内にするかを質問するダイアログが開きます。このオプションによって、一部のブラウザのセキュリティ制限を回避できます。CustomerDBプロジェクトと同じサーバー・ドメインにデプロイされるように構成されているかぎり、すべてのWebプロジェクトを使用できます。
image::../../../images_www/articles/71/websvc/rest/configure-test-client.png[]
-6. *「プロジェクト内のWebテスト・クライアント」*を選択し、「参照」をクリックします。
-7. 「プロジェクトを選択」ダイアログ・ボックスで「WebServiceTest」プロジェクトを選択します。「OK」をクリックします。
+
+[start=6]
+. *「プロジェクト内のWebテスト・クライアント」*を選択し、「参照」をクリックします。
+
+[start=7]
+. 「プロジェクトを選択」ダイアログ・ボックスで「WebServiceTest」プロジェクトを選択します。「OK」をクリックします。
IDEによって、 ``test-resbeans.html`` ファイルがWebServiceTestプロジェクトに生成されます。IDEによってサーバーの起動およびCustomerDBアプリケーションのデプロイも自動的に行われます。
1つ以上のクラスが存在しておらず、プロジェクトがビルドされないというエラー・メッセージが「出力」ウィンドウに表示された場合、コンパイル時ライブラリにJerseyライブラリを追加します。プロジェクトのノードを右クリックし、「プロパティ」を選択します。「プロパティ」ツリー・メニューで、「ライブラリ」を選択します。「ライブラリの追加」をクリックし、Jerseyライブラリを参照します。
-8. WebServiceTestを右クリックし、「実行」を選択します。
-9. ブラウザでlink:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]を開きます。
+
+[start=8]
+. WebServiceTestを右クリックし、「実行」を選択します。
+
+[start=9]
+. ブラウザでlink:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]を開きます。
image::../../../images_www/articles/71/websvc/rest/test-rest1.png[title="ブラウザでのRESTful Webサービス・テスターの開始ページ"]
左側にルート・リソースの組があります。ここでは、 ``entities.customer`` 、 ``entities.discountCodes`` および ``entities.microMarket`` という名前です。
-10. 「 ``entities.customer`` 」ノードをクリックします。「テストするメソッドを選択します」フィールドで、「GET (application/json)」または「GET (application/xml)」を選択します。「テスト」をクリックします。テスト・クライアントによってリクエストが送信され、「テスト出力」セクションに結果が表示されます。テスト・クライアントでは、デフォルトで「rawデータのビュー」が表示されます。次のイメージは、application/xmlリクエストに対するレスポンスを示しています。
+
+[start=10]
+. 「 ``entities.customer`` 」ノードをクリックします。「テストするメソッドを選択します」フィールドで、「GET (application/json)」または「GET (application/xml)」を選択します。「テスト」をクリックします。テスト・クライアントによってリクエストが送信され、「テスト出力」セクションに結果が表示されます。テスト・クライアントでは、デフォルトで「rawデータのビュー」が表示されます。次のイメージは、application/xmlリクエストに対するレスポンスを示しています。
image::images/test-rest-raw.png[]
「テスト出力」セクションには5つのタブがあります。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/rest_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/rest_pt_BR.asciidoc
index 0ebebea..5ae3dfe 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/rest_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/rest_pt_BR.asciidoc
@@ -110,18 +110,30 @@
1. Registre o servidor MySQL no IDE, se o servidor ainda não estiver registrado. Para registrar um servidor MySQL, vá à janela Serviços do IDE, clique com o botão direito do mouse no nó Banco de dados e selecione Registrar servidor MySQL.
image::images/register-mysql-server.png[]
-2.
+
+[start=2]
+.
Uma caixa de diálogo será aberta, na qual você digitará os detalhes de configuração do seu servidor MySQL, incluindo o nome de usuário e senha de administrador. Consulte “Configurando as Propriedades do Servidor MySQL” em link:../ide/install-and-configure-mysql-server.html[+Conectando-se a um Banco de dados MySQL+].
image::images/basic-mysql-properties.png[]
-3. Inicie o servidor MySQL e conecte-se a ele. Consulte “Iniciando o Servidor MySQL” em link:../ide/install-and-configure-mysql-server.html[+Conectando-se a um Banco de Dados MySQL+].
-4. Clique com o botão direito do mouse no nó do servidor MySQL e selecione Criar Banco de Dados. A caixa de diálogo Criar Banco de Dados MySQL será aberta.
+
+[start=3]
+. Inicie o servidor MySQL e conecte-se a ele. Consulte “Iniciando o Servidor MySQL” em link:../ide/install-and-configure-mysql-server.html[+Conectando-se a um Banco de Dados MySQL+].
+
+[start=4]
+. Clique com o botão direito do mouse no nó do servidor MySQL e selecione Criar Banco de Dados. A caixa de diálogo Criar Banco de Dados MySQL será aberta.
image::images/create-database.png[]
-5. Digite ``sample`` como o novo nome do banco de dados. Conceda acesso total ao usuário raiz, ou ao usuário que você desejar.
+
+[start=5]
+. Digite ``sample`` como o novo nome do banco de dados. Conceda acesso total ao usuário raiz, ou ao usuário que você desejar.
image::images/new-database-name.png[]
-6. Clique em OK. Uma caixa de diálogo é aberta, informando que ``sample`` é o nome de um banco de dados de amostra e perguntando se você deseja criar tabelas, objetos e dados para esse banco de dados.
+
+[start=6]
+. Clique em OK. Uma caixa de diálogo é aberta, informando que ``sample`` é o nome de um banco de dados de amostra e perguntando se você deseja criar tabelas, objetos e dados para esse banco de dados.
image::images/create-sample-contents.png[]
-7. Clique em Sim. O IDE cria e preenche o banco de dados, e adiciona uma conexão ao banco de dados.
+
+[start=7]
+. Clique em Sim. O IDE cria e preenche o banco de dados, e adiciona uma conexão ao banco de dados.
image::images/generated-db.png[]
@@ -142,8 +154,12 @@
Como alternativa, você pode criar uma aplicação Web Maven. Selecione Arquivo > Novo Projeto (Ctrl-Shift-N no Linux e no Windows, ⌘-Shift-N no MacOS). Em Categorias, selecione Maven. Em Projetos, selecione Aplicação Web Maven e clique em Próximo.
-2. Em Nome do Projeto, digite ``CustomerDB`` . Clique em Próximo.
-3. Selecione Java EE 6 Web ou Java EE 7 Web. Em Servidor, selecione o servidor que você deseja usar, mas observe que os projetos do Java EE exibe GlassFish server 3.x ou 4.x. Clique nas opções remanescentes e clique em Finalizar.
+
+[start=2]
+. Em Nome do Projeto, digite ``CustomerDB`` . Clique em Próximo.
+
+[start=3]
+. Selecione Java EE 6 Web ou Java EE 7 Web. Em Servidor, selecione o servidor que você deseja usar, mas observe que os projetos do Java EE exibe GlassFish server 3.x ou 4.x. Clique nas opções remanescentes e clique em Finalizar.
*Importante para Projetos Maven:* no NetBeans IDE 7.2 você não pode definir o servidor ao criar uma aplicação web Maven. Entretanto, você tem que definir o servidor antes de poder criar uma unidade de persistência. Portanto, após criar a aplicação web Maven, abra as Propriedades do projeto e defina o servidor nas propriedades de Execução. Para abrir as Propriedades do projeto, clique com o botão direito do mouse no nó Projeto e selecione Propriedades no menu de contexto.
@@ -156,22 +172,30 @@
1. Clique com o botão direito do mouse no nó ``CustomerDB`` e selecione Novo > Outro > Web Services > Web Services RESTful do Banco de dados. O assistente Novo Web Service RESTful é aberto, no painel Tabelas de Bancos de dados.
image::images/open-wizard.png[]
-2. No painel Tabelas do Banco de dados, se estiver utilizando o GlassFish Server, selecione a fonte de dados ``jdbc/sample`` no campo drop-down Fonte de Dados.
+
+[start=2]
+. No painel Tabelas do Banco de dados, se estiver utilizando o GlassFish Server, selecione a fonte de dados ``jdbc/sample`` no campo drop-down Fonte de Dados.
Se estiver utilizando o Tomcat, selecione jdbc:derby://localhost:1527/sample. Se o servidor de banco de dados Derby não iniciar automaticamente, será necessário iniciá-lo a partir da guia Bancos de dados na janela Serviços.
*Observação para usuários do MySQL:* É necessário criar uma nova fonte de dados. Selecione Nova Fonte de Dados, dê a ela um nome descritivo arbitrário e selecione a conexão de banco de dados ``jdbc:mysql://localhost:3306/sample`` . Essa conexão foi estabelecida ao criar o banco de dados de amostra no MySQL.
image::images/new-mysql-datasource.png[]
-3. Em Tabelas Disponíveis, selecione CUSTOMER e, em seguida, clique em Adicionar. A tabela DISCOUNT_CODE, que tem um relacionamento com a tabela CUSTOMER, também é adicionada automaticamente à lista Tabelas Selecionadas. Se você estiver usando um banco de dados MySQL ou algumas versões do Derby, a tabela MICRO_MARKET também será adicionada. Você agora verá o seguinte (versão do Derby):
+
+[start=3]
+. Em Tabelas Disponíveis, selecione CUSTOMER e, em seguida, clique em Adicionar. A tabela DISCOUNT_CODE, que tem um relacionamento com a tabela CUSTOMER, também é adicionada automaticamente à lista Tabelas Selecionadas. Se você estiver usando um banco de dados MySQL ou algumas versões do Derby, a tabela MICRO_MARKET também será adicionada. Você agora verá o seguinte (versão do Derby):
image::images/select-tables.png[title="Painel Tabelas de Bancos de Dados do assistente Novas Classes de Entidade do Banco de Dados que mostra as tabelas CUSTOMER e DISCOUNT_CODE selecionadas"]
-4. Clique em Próximo. A Página Classes de Entidade será aberta. Digite ``entities`` como o nome do Pacote. Você agora verá o seguinte (versão do Derby).
+
+[start=4]
+. Clique em Próximo. A Página Classes de Entidade será aberta. Digite ``entities`` como o nome do Pacote. Você agora verá o seguinte (versão do Derby).
*Observação:* O assistente Web Services RESTful do Banco de Dados gera automaticamente anotações JAXB. Se você gerar classes de entidade para uma aplicação Java EE com o assistente Classes de Entidade do Banco de dados e mais tarde quiser criar Web services RESTful com base nessas classes de entidade, certifique-se de que a caixa Gerar Anotações JAXB esteja marcada. Você também pode adicionar anotações JAXB manualmente às classes de entidade antes de executar o assistente Web Services RESTful de Classes de Entidade. Para obter mais informações, consulte link:http://netbeans.dzone.com/nb-generate-simpler-rest[+NetBeans para Gerar Web Services RESTful Mais Simples+].
image::../../../images_www/articles/71/websvc/rest/entity-classes.png[]
-5. Clique em Próximo. Um painel será aberto no qual você poderá definir o nome e a localização das classes e pacotes de serviços gerados. Para projetos do Java EE, você tem a opção de alterar o nome e a localização da classe de configuração da aplicação REST.
+
+[start=5]
+. Clique em Próximo. Um painel será aberto no qual você poderá definir o nome e a localização das classes e pacotes de serviços gerados. Para projetos do Java EE, você tem a opção de alterar o nome e a localização da classe de configuração da aplicação REST.
Para este tutorial, aceite os defaults e clique em Finalizar. Quando você clica em Finalizar o IDE gera classes de entidade e serviço. Em um projeto Java EE, o IDE também gera uma classe de configuração de aplicação, que é uma subclasse de Application.
@@ -190,20 +214,30 @@
4. Selecione o GlassFish Server como servidor de destino e o Java EE 6 ou Java EE 7 como a versão do Java EE. Clique em Finalizar.
5. Clique com o botão direito do mouse no nó do projeto ``CustomerDB`` e selecione Testar Web Services RESTful. Uma caixa de diálogo será aberta perguntando se você deseja gerar o cliente de teste dentro do projeto do serviço ou em um outro projeto Java Web. Essa opção permite a você driblar as restrições de segurança em alguns browsers. Você pode usar um projeto Web, contanto que ele esteja configurado para ser implantado no mesmo domínio de servidor que o projeto CustomerDB.
image::../../../images_www/articles/71/websvc/rest/configure-test-client.png[]
-6. Selecione *Cliente de Teste da Web no Projeto* e clique em Procurar.
-7. Selecione o projeto WebServiceTest na caixa de diálogo Selecionar Projeto. Clique em OK.
+
+[start=6]
+. Selecione *Cliente de Teste da Web no Projeto* e clique em Procurar.
+
+[start=7]
+. Selecione o projeto WebServiceTest na caixa de diálogo Selecionar Projeto. Clique em OK.
O IDE gera o arquivo ``test-resbeans.html`` no projeto WebServiceTest. O IDE também inicia automaticamente o servidor e implanta a aplicação CustomerDB.
Se a janela de saída mostrar uma mensagem de erro dizendo que uma ou mais classes não existe e que o projeto não pode ser construído, adicione as bibliotecas Jersey às bibliotecas de tempo de compilação. Clique com o botão direito do mouse no nó do projeto e selecione Propriedades. No menu em árvore Propriedades, selecione Bibliotecas. Clique em Adicionar Biblioteca e procure as bibliotecas Jersey.
-8. Clique com o botão direito do mouse em WebServiceTest e escolha Executar.
-9. Abra seu browser em link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
+
+[start=8]
+. Clique com o botão direito do mouse em WebServiceTest e escolha Executar.
+
+[start=9]
+. Abra seu browser em link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
image::../../../images_www/articles/71/websvc/rest/test-rest1.png[title="Página inicial de testes do Web service RESTful no browser"]
À esquerda está o conjunto de recursos raiz. Aqui eles são nomeados ``entities.customer`` e ``entities.discountCodes`` e ``entities.microMarket`` .
-10. Clique no nó ``entities.customer`` . No campo "Escolher método para testar", selecione GET (application/json) ou GET (application/xml). Clique em Testar. O cliente de teste enviará uma solicitação e exibirá o resultado na seção Saída do Teste. O cliente de teste exibirá a View Bruta por default. A imagem a seguir mostra a resposta a uma solicitação aplicação/xml.
+
+[start=10]
+. Clique no nó ``entities.customer`` . No campo "Escolher método para testar", selecione GET (application/json) ou GET (application/xml). Clique em Testar. O cliente de teste enviará uma solicitação e exibirá o resultado na seção Saída do Teste. O cliente de teste exibirá a View Bruta por default. A imagem a seguir mostra a resposta a uma solicitação aplicação/xml.
image::images/test-rest-raw.png[]
Existem 5 guias na seção Saída do Teste.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/rest_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/rest_ru.asciidoc
index 997d3c6..20937f5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/rest_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/rest_ru.asciidoc
@@ -110,18 +110,30 @@
1. Зарегистрируйте сервер MySQL в среде IDE, если он еще не зарегистрирован. Для регистрации сервера MySQL перейдите в окно 'Службы' среды IDE, щелкните правой кнопкой мыши узел Databases и выберите 'Регистрация сервера MySQL'.
image::images/register-mysql-server.png[]
-2.
+
+[start=2]
+.
Откроется диалоговое окно, в которое следует ввести параметры своего сервера MySQL, включая имя и пароль пользователя, являющегося администратором. См. раздел "Настройка свойств сервера MySQL" в разделе link:../ide/install-and-configure-mysql-server.html[+Подключение к базе данных MySQL+].
image::images/basic-mysql-properties.png[]
-3. Запустите сервер MySQL и подключитесь к нему. См. раздел "Запуск сервера MySQL" в разделе link:../ide/install-and-configure-mysql-server.html[+Подключение к базе данных MySQL+].
-4. Щелкните правой кнопкой мыши узел сервера MySQL и выберите Create Database ("Создать базу данных"). Откроется диалоговое окно создания базы данных MySQL.
+
+[start=3]
+. Запустите сервер MySQL и подключитесь к нему. См. раздел "Запуск сервера MySQL" в разделе link:../ide/install-and-configure-mysql-server.html[+Подключение к базе данных MySQL+].
+
+[start=4]
+. Щелкните правой кнопкой мыши узел сервера MySQL и выберите Create Database ("Создать базу данных"). Откроется диалоговое окно создания базы данных MySQL.
image::images/create-database.png[]
-5. Введите ``sample`` в качестве имени новой базы данных. Предоставьте полный доступ корневому пользователю или пользователю по своему выбору.
+
+[start=5]
+. Введите ``sample`` в качестве имени новой базы данных. Предоставьте полный доступ корневому пользователю или пользователю по своему выбору.
image::images/new-database-name.png[]
-6. Нажмите кнопку "ОК". Откроется диалоговое окно, сообщающее, что именем примера базы данных является ``sample`` и спрашивающее, следует ли создать таблицы, объекты и данные для этой базы данных.
+
+[start=6]
+. Нажмите кнопку "ОК". Откроется диалоговое окно, сообщающее, что именем примера базы данных является ``sample`` и спрашивающее, следует ли создать таблицы, объекты и данные для этой базы данных.
image::images/create-sample-contents.png[]
-7. Нажмите кнопку "Да". Среда IDE создаст и заполнит базу данных, а также добавит подключение к ней.
+
+[start=7]
+. Нажмите кнопку "Да". Среда IDE создаст и заполнит базу данных, а также добавит подключение к ней.
image::images/generated-db.png[]
@@ -142,8 +154,12 @@
Как вариант, можно создать веб-приложение Maven. Выберите 'Файл' > 'Создать проект' (Ctrl-Shift-N в Windows и Linux, ⌘-Shift-N в ОС Mac). В Categories ("Категории) выберите Maven. В Projects ("Проекты") выберите Maven Web Application ("Веб-приложение Maven") и нажмите кнопку Next ("Далее").
-2. Введите в поле "Имя проекта" текст ``CustomerDB`` . Нажмите кнопку "Далее".
-3. Выберите Java EE 6 Web либо Java EE 7 Web. В списке 'Сервер' выберите нужный сервер, но помните, что для проектов Java EE требуется GlassFish Server 3.x или 4.x. Пропустите все последующие настройки и нажмите 'Готово'.
+
+[start=2]
+. Введите в поле "Имя проекта" текст ``CustomerDB`` . Нажмите кнопку "Далее".
+
+[start=3]
+. Выберите Java EE 6 Web либо Java EE 7 Web. В списке 'Сервер' выберите нужный сервер, но помните, что для проектов Java EE требуется GlassFish Server 3.x или 4.x. Пропустите все последующие настройки и нажмите 'Готово'.
*Важное замечание для проектов Maven. * В NetBeans IDE 7.2 при создании веб-приложения Maven невозможно указать сервер. Однако сервер должен быть указан до создания блока сохранения состояния. Поэтому после создания веб-приложения Maven откройте свойства проекта и установите сервер в Run Рroperties ("Свойства выполнения"). Чтобы открыть свойства проекта, щелкните правой кнопкой мыши в узле 'Проект' и выберите 'Свойства' в контекстном меню.
@@ -156,22 +172,30 @@
1. Щелкните правой кнопкой мыши узел ``CustomerDB`` и выберите New ("Создать") > Other ("Другое") > Web Services ("Веб службы") > RESTful Web Services from Database ("Веб-службы RESTful из базы данных"). На панели Database Tables ("Таблицы базы данных") откроется мастер создания веб-службы RESTful.
image::images/open-wizard.png[]
-2. При использовании сервера GlassFish выберите в раскрывающемся списке "Источник данных" на панели "Таблицы" источник данных ``jdbc/sample`` .
+
+[start=2]
+. При использовании сервера GlassFish выберите в раскрывающемся списке "Источник данных" на панели "Таблицы" источник данных ``jdbc/sample`` .
При использовании сервера Tomcat выберите jdbc:derby://localhost:1527/sample. Если сервер базы данных Derby не запускается автоматически, необходимо запустить его на вкладке "Базы данных" в окне "Службы".
*Примечание для пользователей MySQL.* Необходимо будет создать новый источник данных. Выберите New Data Source ("Создать источник данных"), дайте ему произвольное описательное имя и выберите подключение к базе данных ``jdbc:mysql://localhost:3306/sample`` . Это подключение было создано при создании примера базы данных в MySQL.
image::images/new-mysql-datasource.png[]
-3. Выберите в области "Доступные таблицы" таблицу CUSTOMER и нажмите кнопку "Добавить". Таблица DISCOUNT_CODE, связанная с таблицей CUSTOMER, также добавляется в область "Выбранные таблицы" автоматически. Если вы используете базу данных MySQL или некоторые версии Derby, также добавляется таблица MICRO_MARKET. Теперь отображается следующее (версия Derby):
+
+[start=3]
+. Выберите в области "Доступные таблицы" таблицу CUSTOMER и нажмите кнопку "Добавить". Таблица DISCOUNT_CODE, связанная с таблицей CUSTOMER, также добавляется в область "Выбранные таблицы" автоматически. Если вы используете базу данных MySQL или некоторые версии Derby, также добавляется таблица MICRO_MARKET. Теперь отображается следующее (версия Derby):
image::images/select-tables.png[title="Панель 'Таблицы баз данных' новых классов сущностей из мастера баз данных, в которых показаны выделенные таблицы CUSTOMER и DISCOUNT_CODE"]
-4. Нажмите кнопку "Далее". Откроется страница Entity Classes ("Классы сущностей"). В поле 'Имя пакета' введите ``entities`` . Теперь отображается следующее (версия Derby).
+
+[start=4]
+. Нажмите кнопку "Далее". Откроется страница Entity Classes ("Классы сущностей"). В поле 'Имя пакета' введите ``entities`` . Теперь отображается следующее (версия Derby).
*Примечание.* Веб-службы RESTful из мастера баз данных автоматически создают аннотации JAXB. Если классы сущностей для приложения Java EE создаются при помощи мастера создания классов сущностей на основе базы данных и если впоследствии эти классы будут использоваться для создания веб-службы RESTful, убедитесь, что установлен флажок 'Создать аннотации JAXB'. Аннотации JAXB также можно вручную добавить к классам сущностей перед запуском мастера создания веб-служб RESTful из классов сущностей. Дополнительные сведения приведены в документе link:http://netbeans.dzone.com/nb-generate-simpler-rest[+NetBeans to Generate Simpler RESTful Web Services ("Использование NetBeans для создания более простых веб-служб RESTful") +].
image::../../../images_www/articles/71/websvc/rest/entity-classes.png[]
-5. Нажмите кнопку "Далее". Откроется панель, в которой можно задать имя и расположение созданных классов служб и пакеты. В проектах Java EE предусмотрена возможность изменения имени и местоположения класса конфигурации приложения REST.
+
+[start=5]
+. Нажмите кнопку "Далее". Откроется панель, в которой можно задать имя и расположение созданных классов служб и пакеты. В проектах Java EE предусмотрена возможность изменения имени и местоположения класса конфигурации приложения REST.
Для этого учебного курса примите параметры по умолчанию и нажмите кнопку "Готово". При на нажатии на кнопку 'Готово' IDE создает классы сущностей и служб. В проектах Java EE IDE также создает класс конфигурации приложения, который является подклассом для Application.
@@ -190,20 +214,30 @@
4. В качестве целевого сервера выберите GlassFish Server, а в качестве версии Java EE - Java EE 6 Web или Java EE 7 Web. Нажмите 'Готово'.
5. Щелкните правой кнопкой мыши узел проекта ``CustomerDB`` и выберите 'Тестировать веб-службы RESTful'. Откроется диалоговое окно, запрашивающее, следует ли создать тестовый клиент внутри проекта службы или в другом веб-проекте Java. Это позволяет обойти ограничения безопасности в некоторых браузерах. Можно использовать любой веб-проект, если он настроен на развертывание в том же домене сервера, что и проект CustomerDB.
image::../../../images_www/articles/71/websvc/rest/configure-test-client.png[]
-6. Выберите *Тестовый веб-клиент в проекте* и нажмите 'Обзор'.
-7. Выберите проект WebServiceTest в диалоговом окне 'Выбор проекта'. Нажмите кнопку "ОК".
+
+[start=6]
+. Выберите *Тестовый веб-клиент в проекте* и нажмите 'Обзор'.
+
+[start=7]
+. Выберите проект WebServiceTest в диалоговом окне 'Выбор проекта'. Нажмите кнопку "ОК".
IDE создает файл ``test-resbeans.html`` в проекте WebServiceTest. Кроме того, IDE автоматически запускает сервер и выполняет развертывание приложения CustomerDB.
Если в окне 'Результаты' появилось сообщение об ошибке, указывающее на отсутствие одного или нескольких классов и невозможность сборки проекта, добавьте в библиотеки компиляции библиотеки Jersey. Щелкните правой кнопкой мыши узел проекта и выберите команду "Свойства". Выберите в меню дерева "Свойства" пункт "Библиотеки". Щелкните "Добавить библиотеку" и перейдите к библиотекам Jersey.
-8. Щелкните проект WebServiceTest правой кнопкой мыши и выберите 'Выполнить'.
-9. В браузере откройте страницу link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
+
+[start=8]
+. Щелкните проект WebServiceTest правой кнопкой мыши и выберите 'Выполнить'.
+
+[start=9]
+. В браузере откройте страницу link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
image::../../../images_www/articles/71/websvc/rest/test-rest1.png[title="Целевая страница средства тестирования веб-службы RESTful в браузере"]
Слева расположен набор корневых ресурсов. Здесь они названы ``entities.customer`` , ``entities.discountCodes`` и ``entities.microMarket`` .
-10. Щелкните узел ``entities.customer`` . В поле "Выбрать метод для тестирования" выберите GET (приложение/json) или GET (приложение/xml). Нажмите кнопку тестирования. Тестируемый клиент отправляет запрос и выводит результат в разделе 'Результат тестирования'. Тестируемый клиент отображается по умолчанию в представлении необработанных данных На следующем изображении отображается отклик на запрос приложения/xml.
+
+[start=10]
+. Щелкните узел ``entities.customer`` . В поле "Выбрать метод для тестирования" выберите GET (приложение/json) или GET (приложение/xml). Нажмите кнопку тестирования. Тестируемый клиент отправляет запрос и выводит результат в разделе 'Результат тестирования'. Тестируемый клиент отображается по умолчанию в представлении необработанных данных На следующем изображении отображается отклик на запрос приложения/xml.
image::images/test-rest-raw.png[]
В разделе результатов тестирования отображается 5 вкладок.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/rest_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/rest_zh_CN.asciidoc
index 1279a5e..aa1230c 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/rest_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/rest_zh_CN.asciidoc
@@ -110,18 +110,30 @@
1. 如果未注册 MySQL 服务器,请在 IDE 中注册该服务器。要注册 MySQL 服务器,请转至 IDE 的 "Services"(服务)窗口,右键单击 "Databases"(数据库)节点,然后选择 "Register MySQL Server"(注册 MySQL 服务器)。
image::images/register-mysql-server.png[]
-2.
+
+[start=2]
+.
此时将打开一个对话框,您可以在其中键入 MySQL 服务器的配置详细信息,包括管理员用户名和口令。请参见link:../ide/install-and-configure-mysql-server.html[+连接到 MySQL 数据库+]中的“配置 MySQL 服务器属性”。
image::images/basic-mysql-properties.png[]
-3. 启动并连接到 MySQL 服务器。请参见link:../ide/install-and-configure-mysql-server.html[+连接到 MySQL 数据库+]中的“启动 MySQL 服务器”。
-4. 右键单击 "MySQL Server"(MySQL 服务器)节点,然后选择 "Create Database"(创建数据库)。此时将打开 "Create MySQL Database"(创建 MySQL 数据库)对话框。
+
+[start=3]
+. 启动并连接到 MySQL 服务器。请参见link:../ide/install-and-configure-mysql-server.html[+连接到 MySQL 数据库+]中的“启动 MySQL 服务器”。
+
+[start=4]
+. 右键单击 "MySQL Server"(MySQL 服务器)节点,然后选择 "Create Database"(创建数据库)。此时将打开 "Create MySQL Database"(创建 MySQL 数据库)对话框。
image::images/create-database.png[]
-5. 键入 ``sample`` 作为新数据库名称。为超级用户或所选的用户授予完全访问权限。
+
+[start=5]
+. 键入 ``sample`` 作为新数据库名称。为超级用户或所选的用户授予完全访问权限。
image::images/new-database-name.png[]
-6. 单击 "OK"(确定)。此时将打开一个对话框,告知您 ``sample`` 是样例数据库的名称,并询问您是否要为该数据库创建表、对象和数据。
+
+[start=6]
+. 单击 "OK"(确定)。此时将打开一个对话框,告知您 ``sample`` 是样例数据库的名称,并询问您是否要为该数据库创建表、对象和数据。
image::images/create-sample-contents.png[]
-7. 单击 "Yes"(是)。IDE 将创建并填充该数据库,并添加与该数据库的连接。
+
+[start=7]
+. 单击 "Yes"(是)。IDE 将创建并填充该数据库,并添加与该数据库的连接。
image::images/generated-db.png[]
@@ -142,8 +154,12 @@
或者,也可以创建 Maven Web 应用程序。选择 "File"(文件)> "New Project"(新建项目)(在 Linux 和 Windows 上为 Ctrl-Shift-N 组合键,在 MacOS 上为 ⌘-Shift-N 组合键)。在 "Categories"(类别)下,选择 "Maven"。在 "Projects"(项目)下,选择 "Maven Web Application"(Maven Web 应用程序),然后单击 "Next"(下一步)。
-2. 在 "Project Name"(项目名称)字段中,输入 ``CustomerDB`` 。单击 "Next"(下一步)。
-3. 选择 "Java EE 6 Web" 或 "Java EE 7 Web"。在 "Server"(服务器)下,选择要使用的服务器,但请注意,Java EE 项目需要使用 GlassFish Server 3.x 或 4.x。依次单击其余选项,然后单击 "Finish"(完成)。
+
+[start=2]
+. 在 "Project Name"(项目名称)字段中,输入 ``CustomerDB`` 。单击 "Next"(下一步)。
+
+[start=3]
+. 选择 "Java EE 6 Web" 或 "Java EE 7 Web"。在 "Server"(服务器)下,选择要使用的服务器,但请注意,Java EE 项目需要使用 GlassFish Server 3.x 或 4.x。依次单击其余选项,然后单击 "Finish"(完成)。
*Maven 项目重要说明:*在 NetBeans IDE 7.2 中,在创建 Maven Web 应用程序时,您无法设置服务器。而需在创建持久性单元之前设置服务器。因此,在创建 Maven Web 应用程序后,请打开项目的 "Properties"(属性)对话框并在 "Run"(运行)属性中设置服务器。要打开项目的 "Properties"(属性)对话框,请右键单击 "Project"(项目)节点,然后从上下文菜单中选择 "Properties"(属性)。
@@ -156,22 +172,30 @@
1. 右键单击 ``CustomerDB`` 节点,然后选择 "New"(新建)> "Other"(其他)> "Web Services"(Web 服务)> "RESTful Web Services from Database"(通过数据库创建 REST 风格的 Web 服务)。此时将在 "Database Tables"(数据库表)面板中打开新建 REST 风格的 Web 服务向导。
image::images/open-wizard.png[]
-2. 在 "Database Tables"(数据库表)面板中,如果使用的是 GlassFish Server,请从 "Data Source"(数据源)下拉列表字段中选择 ``jdbc/sample`` 数据源。
+
+[start=2]
+. 在 "Database Tables"(数据库表)面板中,如果使用的是 GlassFish Server,请从 "Data Source"(数据源)下拉列表字段中选择 ``jdbc/sample`` 数据源。
如果使用的是 Tomcat,请选择 jdbc:derby://localhost:1527/sample。如果 Derby 数据库服务器未能自动启动,需要从 "Services"(服务)窗口的 "Databases"(数据库)标签中启动它。
*MySQL 用户注意事项:*您必须创建新的数据源。选择 "New Data Source"(新建数据源),指定任意描述性名称,然后选择 ``jdbc:mysql://localhost:3306/sample`` 数据库连接。在 MySQL 上创建样例数据库时创建了该连接。
image::images/new-mysql-datasource.png[]
-3. 在 "Available Tables"(可用表)下,选择 "CUSTOMER",然后单击 "Add"(添加)。DISCOUNT_CODE 表(与 CUSTOMER 表有关联)将自动添加到 "Selected Tables"(选定表)列表中。如果使用 MySQL 数据库或某些版本的 Derby,则还将添加 MICRO_MARKET 表。现在将显示以下内容(Derby 版本):
+
+[start=3]
+. 在 "Available Tables"(可用表)下,选择 "CUSTOMER",然后单击 "Add"(添加)。DISCOUNT_CODE 表(与 CUSTOMER 表有关联)将自动添加到 "Selected Tables"(选定表)列表中。如果使用 MySQL 数据库或某些版本的 Derby,则还将添加 MICRO_MARKET 表。现在将显示以下内容(Derby 版本):
image::images/select-tables.png[title="“通过数据库新建实体类”向导的 "Database Tables"(数据库表)面板,其中显示已选定的 CUSTOMER 和 DISCOUNT_CODE 表"]
-4. 单击 "Next"(下一步)。"Entity Classes"(实体类)页打开。为包名键入 ``entities`` 。现在将显示以下内容(Derby 版本)。
+
+[start=4]
+. 单击 "Next"(下一步)。"Entity Classes"(实体类)页打开。为包名键入 ``entities`` 。现在将显示以下内容(Derby 版本)。
*注:*"RESTful Web Services from Database"(通过数据库创建 REST 风格的 Web 服务)向导会自动生成 JAXB 标注。如果使用 "Entity Classes from Database"(通过数据库生成实体类)向导为 Java EE 应用程序生成实体类,并且以后可能要通过这些实例类创建 REST 风格的 Web 服务,请确保选中 "Generate JAXB Annotations"(生成 JAXB 标注)框。此外,还可以在运行 "RESTful Web Services from Entity Classes"(通过实体类创建 REST 风格的 Web 服务)向导之前手动将 JAXB 标注添加到实体类中。有关详细信息,请参见link:http://netbeans.dzone.com/nb-generate-simpler-rest[+用于生成更简单的 REST 风格 Web 服务的 NetBeans+]。
image::../../../images_www/articles/71/websvc/rest/entity-classes.png[]
-5. 单击 "Next"(下一步)。打开了一个面板,在其中可以设置生成的服务类和包的名称及位置。对于 Java EE 项目,可以选择更改 REST 应用程序配置类的名称和位置。
+
+[start=5]
+. 单击 "Next"(下一步)。打开了一个面板,在其中可以设置生成的服务类和包的名称及位置。对于 Java EE 项目,可以选择更改 REST 应用程序配置类的名称和位置。
在本教程中,接受默认值,然后单击 "Finish"(完成)。单击 "Finish"(完成)后,IDE 将生成实体类和服务类。在 Java EE 项目中,IDE 还将生成应用程序配置类,这是应用程序的子类。
@@ -190,20 +214,30 @@
4. 选择 "GlassFish Server" 作为目标服务器,并选择 "Java EE 6 Web" 或 "Java EE 7 Web" 作为 Java EE 版本。单击 "Finish"(完成)。
5. 右键单击 ``CustomerDB`` 项目节点,并选择 "Test RESTful Web Services"(测试 REST 风格的 Web 服务)。此时将打开一个对话框,询问您是否要在服务项目或其他 Java Web 项目中生成测试客户端。通过此选项,可以解决某些浏览器中的安全限制问题。只要将 Web 项目配置为在 CustomerDB 项目所在的同一个服务器域中部署,您就可以使用任何 Web 项目了。
image::../../../images_www/articles/71/websvc/rest/configure-test-client.png[]
-6. 选择 *Web Test Client in Project*(项目中的 Web 测试客户端),然后单击 "Browse"(浏览)。
-7. 在 "Select Project"(选择项目)对话框中选择 "WebServiceTest" 项目。单击 "OK"(确定)。
+
+[start=6]
+. 选择 *Web Test Client in Project*(项目中的 Web 测试客户端),然后单击 "Browse"(浏览)。
+
+[start=7]
+. 在 "Select Project"(选择项目)对话框中选择 "WebServiceTest" 项目。单击 "OK"(确定)。
IDE 将在 WebServiceTest 项目中生成文件 ``test-resbeans.html`` 。IDE 还将自动启动服务器并部署 CustomerDB 应用程序。
如果输出窗口显示错误消息,指出一个或多个类不存在,且项目未构建,则请将 Jersey 库添加到编译时库中。右键单击项目节点,然后选择 "Properties"(属性)。在 "Properties"(属性)树状菜单中选择 "Libraries"(库)。单击 "Add Library"(添加库)并定位到 Jersey 库。
-8. 右键单击 "WebServiceTest",然后选择 "Run"(运行)。
-9. 将浏览器打开到 link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
+
+[start=8]
+. 右键单击 "WebServiceTest",然后选择 "Run"(运行)。
+
+[start=9]
+. 将浏览器打开到 link:http://localhost:8080/WebServicesTest/test-resbeans.html[+http://localhost:8080/WebServicesTest/test-resbeans.html+]
image::../../../images_www/articles/71/websvc/rest/test-rest1.png[title="浏览器中 REST 风格的 Web 服务测试器登录页"]
左侧是根资源集。此处将其命名为 ``entities.customer`` 、 ``entities.discountCodes`` 和 ``entities.microMarket`` 。
-10. 单击 ``entities.customer`` 节点。在 "Choose method to test"(选择要测试的方法)字段中,选择 GET (application/json) 或 GET (application/xml)。单击 "Test"(测试)。测试客户端发送请求并在 "Test Output"(测试输出)部分中显示结果。默认情况下,测试客户端显示原始视图。以下图像显示了对 application/xml 请求的响应。
+
+[start=10]
+. 单击 ``entities.customer`` 节点。在 "Choose method to test"(选择要测试的方法)字段中,选择 GET (application/json) 或 GET (application/xml)。单击 "Test"(测试)。测试客户端发送请求并在 "Test Output"(测试输出)部分中显示结果。默认情况下,测试客户端显示原始视图。以下图像显示了对 application/xml 请求的响应。
image::images/test-rest-raw.png[]
"Test Output"(测试输出)区域中有 5 个标签。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/wsit.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/wsit.asciidoc
index 0fcd19b..d4a6870 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/wsit.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/wsit.asciidoc
@@ -85,7 +85,9 @@
1. Choose File > New Project (Ctrl-Shift-N on Linux and Windows, ⌘-Shift-N on MacOS) to open the New Project wizard.
2. Expand the Samples category and select the Web Services node and then select the Calculator sample. Click Next.
image::images/wsit-newproject.png[title="New Project wizard showing calculator sample"]
-3. Confirm that a Java EE-compliant server is selected in the Server drop-down list. Click Finish.
+
+[start=3]
+. Confirm that a Java EE-compliant server is selected in the Server drop-down list. Click Finish.
When you click Finish the wizard creates two projects:
@@ -95,7 +97,9 @@
The CalculatorClientApp service might be badged with an error icon because the IDE cannot find the WSDL for the CalculatorWS service. The error will be resolved after you deploy CalculatorApp and clean and build the CalculatorClientApp.
image::images/wsit-projects.png[title="Projects window displaying the web service and the client"]
-4. Double-click the CalculatorWS web service to open the file in the editor and click the Design tab at the top of the editor to view the web service in the visual designer.
+
+[start=4]
+. Double-click the CalculatorWS web service to open the file in the editor and click the Design tab at the top of the editor to view the web service in the visual designer.
image::images/wsit-design.png[title="CalculatorWS service in Design GUI (Visual Designer) tab"]
*Note:* In the Quality of Service section in the design tab of the service you can see that _no_ options are enabled. As a result, the Quality of Service components have not been applied to this particular web service. You will look at a web service where a Quality of Service component _is_ enabled when you create the secure web service.
@@ -110,12 +114,16 @@
The server starts and the web service is deployed to the server. You will see a page open in your default browser that provides some details of the service.
image::images/wsit-browser1.png[title="CalculatorWS information window in browser"]
-2. Click on the WSDL link in the page in the browser to see the WSDL file that defines the web service.
+
+[start=2]
+. Click on the WSDL link in the page in the browser to see the WSDL file that defines the web service.
image::images/wsit-browser2.png[title="Calculator WS WSDL in browser"]
*Note.* If the WSDL does not display, check the URL in the browser's location bar. It should point to ``http://localhost:_your_port_number_/CalculatorApp/CalculatorWSService?WSDL`` .
-3. In the Projects window of the IDE, right-click CalculatorWS under the Web Services node and choose Test Web Service in the popup menu.
+
+[start=3]
+. In the Projects window of the IDE, right-click CalculatorWS under the Web Services node and choose Test Web Service in the popup menu.
When you test the web service a page for testing the service opens in your browser.
@@ -123,16 +131,22 @@
The IDE can provide a client for testing your web service and open the test application in your browser. In the test application you can enter values for each of the fields defined in the web service. The test application has a button that is labeled after the name of the operation in the service. When you click the button you will see the result of invoking the operation.
-4. Examine the CalculatorClientApp project in the Projects window for any error badges.
+
+[start=4]
+. Examine the CalculatorClientApp project in the Projects window for any error badges.
If there are error icons for ``ClientServlet.java`` , right-click the project node and choose Clean and Build in the popup menu. The errors appeared because the CalculatorWS service was not deployed. Now that it is deployed, the IDE can parse the WSDL and the ClientServlet compiles.
-5. Right-click the CalculatorClientApp project node and choose Run.
+
+[start=5]
+. Right-click the CalculatorClientApp project node and choose Run.
When you run the application an interface for the service opens in your browser.
image::images/wsit-browser4.png[title="Calculator Service client in browser"]
-6. Enter values in the two fields and click Get Result.
+
+[start=6]
+. Enter values in the two fields and click Get Result.
When you click Get Result the result of the operation is retrieved from the web service and displayed in the client.
@@ -159,11 +173,15 @@
The SecureCalculatorClientApp service might be badged with an error icon because the IDE cannot find the WSDL for the CalculatorWS service. The error will be resolved after you deploy SecureCalculatorApp and clean and build the SecureCalculatorClientApp.
-4. Double-click the CalculatorWS web service in the Web Services folder of SecureCalculatorApp to open the file in the editor and click the Design tab at the top of the editor to view the web service in the visual designer.
+
+[start=4]
+. Double-click the CalculatorWS web service in the Web Services folder of SecureCalculatorApp to open the file in the editor and click the Design tab at the top of the editor to view the web service in the visual designer.
*Note:* In the Quality of Service section in the design view of the service you can see that the Secure Service option is selected and that the other two options are not selected. The Quality of Service section in the design view specifies which of the Quality of Service components is _enabled_ for the current web service.
-5. Click Edit Web Service Attributes to open the Web Service Attributes Editor.
+
+[start=5]
+. Click Edit Web Service Attributes to open the Web Service Attributes Editor.
image::images/wsit-quality-dialog.png[title="Quality of Service page in WS Attributes Editor"]
In the Quality of Service tab you can see that a Version Compatibility option is selected. You should select the latest version that matches the version of Metro or .NET that is installed.
@@ -174,14 +192,18 @@
In this sample application the Username Authentication with Symmetric Keys security mechanism is selected. For a description of options and properties for the Username Authentication with Symmetric Keys security mechanism, see link:http://docs.oracle.com/cd/E19182-01/821-0015/gggsrv/index.html[+Username Authentication with Symmetric Key +]. For a description of other available security mechanisms, see link:http://docs.oracle.com/cd/E19182-01/820-0595/6ncatc2q5/index.html[+Configuring Security Mechanisms+].
-6. Expand the Input Message and Output Message sections in the Quality of Service tab.
+
+[start=6]
+. Expand the Input Message and Output Message sections in the Quality of Service tab.
image::images/wsit-quality-dialog2.png[title="Quality of Service page with Message Parts button enabled"]
The Message Parts button is enabled for Input Message and Output Message if you select the Username Authentication with Symmetric Keys as the security mechanism.
*Note:* The Authentication Token drop-down list and the options for Input Message are not enabled for the Username Authentication with Symmetric Keys security mechanism.
-7. Click the Message Parts button in the Input Message section.
+
+[start=7]
+. Click the Message Parts button in the Input Message section.
image::images/wsit-messageparts.png[title="Message Parts dialog"]
In the Message Parts dialog box you can see security options for different elements. You can select a checkbox to enable or disable the parts that should be signed, encrypted and required. For each element you can specify the following options:
@@ -192,8 +214,12 @@
Next you will look at how the web service client's Quality of Service is configured.
-8. In the Projects window, expand the Web Service References node in the *SecureCalculatorClientApp* project.
-9. Right-click the CalculatorWSService node and choose Edit Web Service Attributes in the popup menu to open the Web Service Attributes dialog box.
+
+[start=8]
+. In the Projects window, expand the Web Service References node in the *SecureCalculatorClientApp* project.
+
+[start=9]
+. Right-click the CalculatorWSService node and choose Edit Web Service Attributes in the popup menu to open the Web Service Attributes dialog box.
image::images/wsit-qos-wsservice.png[title="Web service client quality of service dialog"]
You can see that a default user "wsitUser" and password exist. The default user and password were created in the "file" realm.
@@ -213,7 +239,9 @@
When you run the client the application is deployed and and the interface for the service opens in the browser.
image::images/wsit-browser-secure1.png[title="Secure web service client in browser"]
-3. Type a number in each of the fields and click Get Result.
+
+[start=3]
+. Type a number in each of the fields and click Get Result.
When you click Get Result the page will display a message that the client was authenticated and will display the result of the operation.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ja.asciidoc
index 310791b..bbc55a9 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ja.asciidoc
@@ -85,7 +85,9 @@
1. 「ファイル」>「新規プロジェクト」(LinuxおよびWindowsの場合は[Ctrl]-[Shift]-[N]、MacOSの場合は[⌘]-[Shift]-[N])を選択し、新規プロジェクト・ウィザードを開きます。
2. 「サンプル」カテゴリを展開し、「Webサービス」ノードを選択して、「カリキュレータ」サンプルを選択します。「次」をクリックします。
image::images/wsit-newproject.png[title="カリキュレータ・サンプルを示す新規プロジェクト・ウィザード"]
-3. 「サーバー」ドロップダウン・リストでJava EEに準拠したサーバーが選択されていることを確認します。「終了」をクリックします。
+
+[start=3]
+. 「サーバー」ドロップダウン・リストでJava EEに準拠したサーバーが選択されていることを確認します。「終了」をクリックします。
「終了」をクリックすると、2つのプロジェクトが作成されます。
@@ -95,7 +97,9 @@
IDEでCalculatorWSサービスのWSDLを検出できないため、CalculatorClientAppサービスにエラー・アイコンが付いている場合があります。CalculatorAppをデプロイし、CalculatorClientAppを消去してビルドすると、エラーを解決できます。
image::images/wsit-projects.png[title="Webサービスとクライアントを表示する「プロジェクト」ウィンドウ"]
-4. CalculatorWS Webサービスをダブルクリックしてファイルをエディタで開き、エディタの上部の「デザインタブをクリックしてビジュアル・デザイナにWebサービスを表示します。
+
+[start=4]
+. CalculatorWS Webサービスをダブルクリックしてファイルをエディタで開き、エディタの上部の「デザインタブをクリックしてビジュアル・デザイナにWebサービスを表示します。
image::images/wsit-design.png[title="「デザイン」GUI (ビジュアル・デザイナ)タブのCalculatorWSサービス"]
*注意: *サービスの「デザイン」タブの「サービス品質」セクションで、有効にされたオプションが_ない_ことが確認できます。その結果、サービス品質コンポーネントはこの特定のWebサービスに適用されません。セキュリティ保護されたWebサービスを作成する際、サービス品質コンポーネントが_有効な_Webサービスについて確認します。
@@ -110,12 +114,16 @@
サーバーが起動し、Webサービスがサーバーにデプロイされます。デフォルト・ブラウザでページが開き、サービスの詳細が一部表示されます。
image::images/wsit-browser1.png[title="ブラウザのCalculatorWS情報ウィンドウ"]
-2. ブラウザでページのWSDLリンクをクリックすると、Webサービスを定義するWSDLファイルが表示されます。
+
+[start=2]
+. ブラウザでページのWSDLリンクをクリックすると、Webサービスを定義するWSDLファイルが表示されます。
image::images/wsit-browser2.png[title="ブラウザでのCalculator WS WSDL"]
*注意:*WSDLが表示されない場合、ブラウザのロケーション・バーでURLを確認してください。 ``http://localhost:_your_port_number_/CalculatorApp/CalculatorWSService?WSDL`` を指すようにしてください。
-3. IDEの「プロジェクト」ウィンドウで、「Webサービス」ノードの下の「CalculatorWS」を右クリックし、ポップアップ・メニューで「Webサービスをテスト」を選択します。
+
+[start=3]
+. IDEの「プロジェクト」ウィンドウで、「Webサービス」ノードの下の「CalculatorWS」を右クリックし、ポップアップ・メニューで「Webサービスをテスト」を選択します。
Webサービスをテストする場合、サービスのテスト用のページがブラウザで開きます。
@@ -123,16 +131,22 @@
IDEで、Webサービスをテストするためのクライアントが提供され、ブラウザでテスト・アプリケーションが開きます。テスト・アプリケーションで、Webサービスで定義された各フィールドに値を入力できます。テスト・アプリケーションには、サービスの操作の名前のラベルが付いたボタンがあります。ボタンをクリックすると、操作の起動の結果が表示されます。
-4. 「プロジェクト」ウィンドウで、エラー・バッジがないかCalculatorClientAppプロジェクトを調べます。
+
+[start=4]
+. 「プロジェクト」ウィンドウで、エラー・バッジがないかCalculatorClientAppプロジェクトを調べます。
``ClientServlet.java`` にエラー・アイコンがある場合、プロジェクト・ノードを右クリックし、ポップアップ・メニューで「消去してビルド」を選択します。エラーが表示されたのは、CalculatorWSサービスがデプロイされていなかったためです。デプロイされたため、IDEはこのWSDLを解析でき、ClientServletがコンパイルされます。
-5. 「CalculatorClientApp」プロジェクト・ノードを右クリックし、「実行」を選択します。
+
+[start=5]
+. 「CalculatorClientApp」プロジェクト・ノードを右クリックし、「実行」を選択します。
アプリケーションを実行すると、サービスのインタフェースがブラウザで開きます。
image::images/wsit-browser4.png[title="ブラウザでのCalculator Serviceクライアント"]
-6. 2つのフィールドに値を入力し、「Get Result」をクリックします。
+
+[start=6]
+. 2つのフィールドに値を入力し、「Get Result」をクリックします。
「Get Result」をクリックすると、操作の結果がWebサービスから取得されてクライアントに表示されます。
@@ -159,11 +173,15 @@
IDEでCalculatorWSサービスのWSDLを検出できないため、SecureCalculatorClientAppサービスにエラー・アイコンが付いている場合があります。SecureCalculatorAppをデプロイし、SecureCalculatorClientAppを消去してビルドすると、エラーを解決できます。
-4. SecureCalculatorAppの「Webサービス」フォルダでCalculatorWS Webサービスをダブルクリックしてファイルをエディタで開き、エディタの上部の「デザインタブをクリックしてビジュアル・デザイナにWebサービスを表示します。
+
+[start=4]
+. SecureCalculatorAppの「Webサービス」フォルダでCalculatorWS Webサービスをダブルクリックしてファイルをエディタで開き、エディタの上部の「デザインタブをクリックしてビジュアル・デザイナにWebサービスを表示します。
*注意: *サービスのデザイン・ビューの「サービス品質」セクションで、「セキュア・サービス」オプションは選択され、他の2つのオプションは選択されていないことがわかります。デザイン・ビューの「サービス品質」セクションでは、現在のWebサービスに対してどのサービス品質コンポーネントを_有効_にするかを指定します。
-5. 「Webサービス属性を編集」をクリックし、Webサービス属性エディタを開きます。
+
+[start=5]
+. 「Webサービス属性を編集」をクリックし、Webサービス属性エディタを開きます。
image::images/wsit-quality-dialog.png[title="WS属性エディタの「サービス品質」ページ"]
「サービス品質」タブで、「バージョン互換性」オプションが選択されていることが確認できます。インストールされているMetroまたは.NETのバージョンに一致する最新バージョンを選択します。
@@ -174,14 +192,18 @@
このサンプル・アプリケーションでは、「対称キーを使用したユーザー名認証」セキュリティ・メカニズムが選択されています。オプションの説明および「対称キーを使用したユーザー名認証」セキュリティ・メカニズムの詳細は、link:http://docs.oracle.com/cd/E19182-01/821-0015/gggsrv/index.html[+対称キーを使用したユーザー名認証+]を参照してください。その他の使用可能なセキュリティ・メカニズムの詳細は、link:http://docs.oracle.com/cd/E19182-01/820-0595/6ncatc2q5/index.html[+セキュリティ・メカニズムの構成+]を参照してください。
-6. 「サービス品質」タブの「入力メッセージ」および「出力メッセージ」セクションを展開します。
+
+[start=6]
+. 「サービス品質」タブの「入力メッセージ」および「出力メッセージ」セクションを展開します。
image::images/wsit-quality-dialog2.png[title="「メッセージ部品」ボタンが有効な「サービス品質」ページ"]
セキュリティ・メカニズムとして「対称キーを使用したユーザー名認証」を選択した場合、「入力メッセージ」および「出力メッセージ」で「メッセージ部品」ボタンが有効です。
*注意: *入力メッセージの「認証トークン」ドロップダウン・リストとオプションは、「対称キーを使用したユーザー名認証」セキュリティ・メカニズムの場合、有効ではありません。
-7. 「入力メッセージ」セクションで、「メッセージ部品」ボタンをクリックします。
+
+[start=7]
+. 「入力メッセージ」セクションで、「メッセージ部品」ボタンをクリックします。
image::images/wsit-messageparts.png[title="「メッセージ部品」ダイアログ"]
「メッセージ部品」ダイアログ・ボックスに、様々な要素のセキュリティ・オプションが表示されます。チェックボックスを選択して、部品の署名、暗号化および必須を有効または無効にできます。要素ごとに次のオプションを指定できます。
@@ -192,8 +214,12 @@
次に、Webサービス・クライアントのサービス品質がどのように構成されているかを確認します。
-8. 「プロジェクト」ウィンドウで、*「SecureCalculatorClientApp」*プロジェクトの「Webサービス参照」ノードを展開します。
-9. CalculatorWSServiceノードを右クリックし、ポップアップ・メニューで「Webサービス属性を編集」を選択し、「Webサービス属性」ダイアログ・ボックスを開きます。
+
+[start=8]
+. 「プロジェクト」ウィンドウで、*「SecureCalculatorClientApp」*プロジェクトの「Webサービス参照」ノードを展開します。
+
+[start=9]
+. CalculatorWSServiceノードを右クリックし、ポップアップ・メニューで「Webサービス属性を編集」を選択し、「Webサービス属性」ダイアログ・ボックスを開きます。
image::images/wsit-qos-wsservice.png[title="Webサービス・クライアントのサービス品質ダイアログ"]
デフォルト・ユーザー"wsitUser"およびパスワードが存在することを確認できます。デフォルト・ユーザーおよびパスワードは、ファイル・レルムで作成されました。
@@ -213,7 +239,9 @@
クライアントを実行すると、アプリケーションがデプロイされ、サービスのインタフェースがブラウザで開きます。
image::images/wsit-browser-secure1.png[title="ブラウザでの保護Webサービス・クライアント"]
-3. 各フィールドに数値を入力し、「Get Result」をクリックします。
+
+[start=3]
+. 各フィールドに数値を入力し、「Get Result」をクリックします。
「Get Result」をクリックすると、クライアントが認証されたことを示すメッセージおよび操作の結果がページに表示されます。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_pt_BR.asciidoc
index 7e75484..bfb7f0a 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_pt_BR.asciidoc
@@ -85,7 +85,9 @@
1. Escolha Arquivos > Novo Projeto (Ctrl-Shift-N no Linux e no Windows, ⌘-Shift-N no MacOS) para abrir o assistente Novo Projeto.
2. Expanda a categoria Amostras e selecione o nó Web Services e, em seguida, selecione a amostra Calculadora. Clique em Próximo.
image::images/wsit-newproject.png[title="Assistente Novo Projeto que mostra a amostra da calculadora"]
-3. Confirme se um servidor compatível com Java EE está selecionado na lista drop-down Servidor. Clique em Finalizar.
+
+[start=3]
+. Confirme se um servidor compatível com Java EE está selecionado na lista drop-down Servidor. Clique em Finalizar.
Quando clicar em Finalizar o assistente criará dois projetos:
@@ -95,7 +97,9 @@
O serviço CalculatorClientApp pode ser marcado com um ícone de erro porque o IDE não pode localizar o WSDL para o serviço CalculatorWS. O erro será resolvido depois que você implantar CalculatorApp e limpar e construir o CalculatorClientApp.
image::images/wsit-projects.png[title="Janela Projetos que exibe o Web service e o cliente"]
-4. Clique duas vezes no web service CalculatorWS para abrir o arquivo no editor e clique na guia Design na parte superior do editor para exibir o web service no designer visual.
+
+[start=4]
+. Clique duas vezes no web service CalculatorWS para abrir o arquivo no editor e clique na guia Design na parte superior do editor para exibir o web service no designer visual.
image::images/wsit-design.png[title="Serviço CalculatorWS noa guia Design GUI (Visual Designer)"]
*Observação:* na seção Qualidade de Serviço na guia design do serviço você pode ver que _nenhuma_ opção está ativada. Como resultado, os componentes da Qualidade de Serviço não foram aplicados a esse Web service em questão. Você verá um web service no qual um componente da Qualidade de Serviço _é_ ativado quando você criar o web service protegido.
@@ -110,12 +114,16 @@
O servidor é iniciado e o web service é implantado no servidor. Você verá uma página aberta em seu browser default que fornece alguns detalhes do serviço.
image::images/wsit-browser1.png[title="Janela de informações do CalculatorWS no browser"]
-2. Clique no link WSDL na página do browser para ver o arquivo WSDL que define o web service.
+
+[start=2]
+. Clique no link WSDL na página do browser para ver o arquivo WSDL que define o web service.
image::images/wsit-browser2.png[title="WSDL do Calculator WS no browser"]
*Observação.* Se o WSDL não for exibido, verifique o URL na barra de localização do browser. Ele deverá apontar para ``http://localhost:_seu_número_de_porta_/CalculatorApp/CalculatorWSService?WSDL`` .
-3. Na janela Projetos do IDE, clique com o botão direito do mouse em CalculatorWS no nó do Web Services e escolha Testar Web Service no menu pop-up.
+
+[start=3]
+. Na janela Projetos do IDE, clique com o botão direito do mouse em CalculatorWS no nó do Web Services e escolha Testar Web Service no menu pop-up.
Quando você testa o web service, uma página para testar o serviço é aberta em seu browser.
@@ -123,16 +131,22 @@
O IDE pode fornecer um cliente para testar seu web service e abrir a aplicação de teste em seu browser. Na aplicação de teste é possível inserir os valores para cada campo definido no Web service. A aplicação de teste tem um botão é identificado depois do nome da operação no serviço. Quando clicar no botão você verá o resultado da chamada da operação.
-4. Examine o projeto CalculatorClientApp na janela Projetos para obter emblemas de erros.
+
+[start=4]
+. Examine o projeto CalculatorClientApp na janela Projetos para obter emblemas de erros.
Se houver ícones de erro para ``ClientServlet.java`` , clique com o botão direito no nó do projeto e escolha Limpar e Construir no menu pop-up. Os erros surgiram porque o serviço CalculatorWS não foi implantado. Agora que ele está implantado, o IDE pode fazer parsing de seu WSDL e a compilação do ClientServlet.
-5. Clique com o botão direito do mouse no nó do projeto CalculatorClientApp e selecione Executar.
+
+[start=5]
+. Clique com o botão direito do mouse no nó do projeto CalculatorClientApp e selecione Executar.
Ao executar a aplicação, uma interface do serviço será aberta em seu browser.
image::images/wsit-browser4.png[title="Cliente do Serviço da Calculadora no browser"]
-6. Informe os valores nos dois campos e clique em Obter Resultado.
+
+[start=6]
+. Informe os valores nos dois campos e clique em Obter Resultado.
Ao clicar em Obter Resultado, o resultado da operação será recuperado no web service e exibido no cliente.
@@ -159,11 +173,15 @@
O serviço SecureCalculatorClientApp pode ser marcado com um ícone de erro porque o IDE não pode localizar o WSDL para o serviço CalculatorWS. O erro será resolvido depois que você implantar SecureCalculatorApp e limpar e construir o SecureCalculatorClientApp.
-4. Clique duas vezes no web service CalculatorWS na pasta Web Services de SecureCalculatorApp para abrir o arquivo no editor e clique na guia Design na parte superior do editor para exibir o web service no designer visual.
+
+[start=4]
+. Clique duas vezes no web service CalculatorWS na pasta Web Services de SecureCalculatorApp para abrir o arquivo no editor e clique na guia Design na parte superior do editor para exibir o web service no designer visual.
*Observação:* Na seção Qualidade de Serviço na view design do serviço você pode ver que a opção Serviço Seguro está selecionada e que as outras duas opções não foram selecionadas. A seção Qualidade de Serviço no Visual Designer especifica quais componentes da Qualidade de Serviço estão _ativados_ para o Web service atual.
-5. Clique em Editar Atributos do Web Service para abrir o Editor de Atributos do Web Service.
+
+[start=5]
+. Clique em Editar Atributos do Web Service para abrir o Editor de Atributos do Web Service.
image::images/wsit-quality-dialog.png[title="Página Qualidade de Serviço no Editor de Atributos do WS"]
Na guia Qualidade de Serviço você pode ver que uma opção de Compatibilidade de Versão foi selecionada. Selecione a versão mais recente que corresponda à versão do Metro ou do .NET que você tem instalada.
@@ -174,14 +192,18 @@
Nesta aplicação de amostra a Autenticação de Nome de Usuário com o mecanismo de segurança Chaves Simétrica é selecionada. Para obter uma descrição das opções e propriedades do mecanismo de segurança Autenticação do Nome de Usuário com Chaves Simétricas, consulte link:http://docs.oracle.com/cd/E19182-01/821-0015/gggsrv/index.html[+Autenticação do Nome de Usuário com Chaves Simétricas+]. Para obte uma descrição de outros mecanismos de segurança disponíveis. consulte link:http://docs.oracle.com/cd/E19182-01/820-0595/6ncatc2q5/index.html[+Configurando Mecanismos de Segurança+].
-6. Expanda as seções Mensagem de Entrada e Mensagem de Saída na guia Qualidade de Serviço.
+
+[start=6]
+. Expanda as seções Mensagem de Entrada e Mensagem de Saída na guia Qualidade de Serviço.
image::images/wsit-quality-dialog2.png[title="Página Qualidade de Serviço com o botão Partes da Mensagem ativado"]
O botão Partes da Mensagem é ativado para Mensagem de Entrada e Mensagem de Saída se você selecionar Autenticação do Nome de Usuário com Chaves Simétricas como o mecanismo de segurança.
*Observação:* a lista drop-down Token de Autenticação e as opções de Mensagem de Entrada não são ativadas para o mecanismo de segurança Autenticação de Nome de Usuário com Chaves Simétricas.
-7. Clique no botão Partes da Mensagem na seção Mensagem de Entrada.
+
+[start=7]
+. Clique no botão Partes da Mensagem na seção Mensagem de Entrada.
image::images/wsit-messageparts.png[title="Caixa de diálogo Partes da Mensagem"]
Na caixa de diálogo Partes da Mensagem você pode ver as opções de segurança de diferentes elementos. Você pode marcar uma caixa de seleção para ativar ou desativar as partes que devem ser assinadas, criptografadas e obrigatórias. Para cada elemento você pode especificar as seguintes opções:
@@ -192,8 +214,12 @@
Em seguida, verifique como a qualidade de serviço do cliente do Web service é configurada.
-8. Na janeja Projetos, expanda o nó Referências de Web Service no projeto *SecureCalculatorClientApp*.
-9. Clique com o botão direito do mouse no nó CalculatorWSService e escolha Editar Atributos do Web Service no menu pop-up para abrir a caixa de diálogo Atributos do Web Service.
+
+[start=8]
+. Na janeja Projetos, expanda o nó Referências de Web Service no projeto *SecureCalculatorClientApp*.
+
+[start=9]
+. Clique com o botão direito do mouse no nó CalculatorWSService e escolha Editar Atributos do Web Service no menu pop-up para abrir a caixa de diálogo Atributos do Web Service.
image::images/wsit-qos-wsservice.png[title="Caixa de diálogo de qualidade de serviço do cliente do Web service"]
Você pode ver que um usuário "wsitUser" e senha default existem. O usuário e a senha default foram criados no realm "arquivo".
@@ -213,7 +239,9 @@
Quando executar o cliente, a aplicação é implantada e a interface do serviço é aberta no browser.
image::images/wsit-browser-secure1.png[title="Cliente de Web service segudo no browser"]
-3. Digite um número em cada um dos campos e clique em Obter Resultado.
+
+[start=3]
+. Digite um número em cada um dos campos e clique em Obter Resultado.
Ao clicar em Obter Resultado, a página exibirá uma mensagem informando que o cliente foi autenticado e exibirá o resultado da operação.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ru.asciidoc
index 3d404d2..6070ca5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_ru.asciidoc
@@ -85,7 +85,9 @@
1. Выберите Файл > Создать проект (Ctrl-Shift-N для Linux и Windows, ⌘-Shift-N для MacOS). Откроется мастер создания проектов.
2. Разверните категорию 'Образцы', выберите узел 'Веб-службы', затем выберите образец 'Calculator'. Нажмите 'Далее'.
image::images/wsit-newproject.png[title="Мастер создания проектов, в котором отображается образец калькулятора"]
-3. Проверьте, что в списке 'Сервер' выбран сервер, совместимый с Java EE. Нажмите кнопку "Готово".
+
+[start=3]
+. Проверьте, что в списке 'Сервер' выбран сервер, совместимый с Java EE. Нажмите кнопку "Готово".
При нажатии на кнопку 'Готово' мастер создает два проекта:
@@ -95,7 +97,9 @@
Рядом со службой CalculatorClientApp может отображаться значок ошибки, так как IDE не может найти WSDL для службы CalculatorWS. Эта ошибка будет устранена после развертывания приложения CalculatorApp и очистки с последующей сборкой клиента CalculatorClientApp.
image::images/wsit-projects.png[title="В окне "Проекты" отображается веб-служба и клиент"]
-4. Дважды щелкните веб-службу CalculatorWS, чтобы открыть файл в редакторе. Перейдите на вкладку 'Конструирование' в верхней части редактора, чтобы открыть веб-службу в визуальном редакторе.
+
+[start=4]
+. Дважды щелкните веб-службу CalculatorWS, чтобы открыть файл в редакторе. Перейдите на вкладку 'Конструирование' в верхней части редактора, чтобы открыть веб-службу в визуальном редакторе.
image::images/wsit-design.png[title="Служба CalculatorWS на вкладке 'Разработка графических пользовательских интерфейсов (Visual Designer)'"]
*Примечание.* В разделе 'Quality of Service' на вкладке 'Конструирование' выбраны параметры _Нет_. В результате компонент "Качество обслуживания" не был применен к этой веб-службе. Веб-служба с _включенным_ компонентом Quality of Service будет рассмотрена при создании защищенной веб-службы.
@@ -110,12 +114,16 @@
Сервер запускается, и веб-служба развертывается на сервере. В стандартном браузере открывается страница с некоторыми сведениями о службе.
image::images/wsit-browser1.png[title="Окно сведений CalculatorWS в браузере"]
-2. Нажмите на ссылку WSDL на странице браузера, чтобы перейти к файлу WSDL, определяющему веб-службу.
+
+[start=2]
+. Нажмите на ссылку WSDL на странице браузера, чтобы перейти к файлу WSDL, определяющему веб-службу.
image::images/wsit-browser2.png[title="CalculatorWS WSDL в браузере"]
*Примечание.* Если WSDL не отображается, проверьте URL-адрес в адресной строке браузера. Она должна указывать на ``http://localhost:_your_port_number_/CalculatorApp/CalculatorWSService?WSDL`` .
-3. В окне 'Проекты' в среде IDE щелкните правой кнопкой мыши CalculatorWS в структуре узла 'Веб-службы' и выберите 'Тестировать веб-службу' в контекстном меню.
+
+[start=3]
+. В окне 'Проекты' в среде IDE щелкните правой кнопкой мыши CalculatorWS в структуре узла 'Веб-службы' и выберите 'Тестировать веб-службу' в контекстном меню.
При тестировании веб-службы в браузере открывается соответствующая страница.
@@ -123,16 +131,22 @@
IDE может предоставить клиент для тестирования веб-службы и открыть тестовое приложение в браузере. В тестовом приложении можно ввести значения в каждое из полей, определенных в веб-службе. В тестовом приложении есть кнопка, название которой соответствует имени операции в службе. При нажатии на эту кнопку отображается результат вызова операции.
-4. Проверьте, нет ли в проекте CalculatorClientApp в окне 'Проекты' сообщений об ошибках.
+
+[start=4]
+. Проверьте, нет ли в проекте CalculatorClientApp в окне 'Проекты' сообщений об ошибках.
Если рядом с компонентом ``ClientServlet.java`` отображаются сообщения об ошибках, щелкните узел проекта правой кнопкой мыши и выберите 'Очистить и собрать' в контекстном меню. Ошибки возникали в связи с отсутствием развернутой службы CalculatorWS. Теперь, когда эта служба развернута, IDE может выполнить анализ файла WSDL и сборку компонента ClientServlet.
-5. Щелкните правой кнопкой мыши узел проекта CalculatorClientApp и выберите 'Выполнить'.
+
+[start=5]
+. Щелкните правой кнопкой мыши узел проекта CalculatorClientApp и выберите 'Выполнить'.
При запуске приложения в браузере открывается интерфейс службы.
image::images/wsit-browser4.png[title="Клиент службы Calculator в браузере"]
-6. Введите значения в два поля и нажмите 'Получить результат'.
+
+[start=6]
+. Введите значения в два поля и нажмите 'Получить результат'.
При нажатии на кнопку 'Получить результат' результат операции извлекается из веб-службы и отображается в клиенте.
@@ -159,11 +173,15 @@
Рядом со службой SecureCalculatorClientApp может отображаться значок ошибки, так как IDE не может найти WSDL для службы CalculatorWS. Эта ошибка будет устранена после развертывания приложения SecureCalculatorApp и очистки с последующей сборкой клиента SecureCalculatorClientApp.
-4. Дважды щелкните веб-службу CalculatorWS в папке 'Веб-службы' проекта SecureCalculatorApp, чтобы открыть файл в редакторе. Перейдите на вкладку 'Конструирование' в верхней части редактора, чтобы открыть веб-службу в визуальном редакторе.
+
+[start=4]
+. Дважды щелкните веб-службу CalculatorWS в папке 'Веб-службы' проекта SecureCalculatorApp, чтобы открыть файл в редакторе. Перейдите на вкладку 'Конструирование' в верхней части редактора, чтобы открыть веб-службу в визуальном редакторе.
*Примечание.* В разделе 'Quality of Service' представления конструирования службы выбран параметр 'Защищенная служба', а другие два параметра не выбраны. В разделе 'Quality of Service' в представлении конструирования указаны компоненты Quality of Service, _включенные_ для текущей веб-службы.
-5. Нажмите 'Изменить атрибуты веб-службы', чтобы открыть редактор атрибутов веб-служб.
+
+[start=5]
+. Нажмите 'Изменить атрибуты веб-службы', чтобы открыть редактор атрибутов веб-служб.
image::images/wsit-quality-dialog.png[title="Страница 'Quality of Service' в редакторе атрибутов WS"]
На вкладке 'Quality of Service' выбран параметр 'Совместимость версий'. Выберите последнюю версию, соответствующую версии установленных модулей Metro или .NET.
@@ -174,14 +192,18 @@
В этом образце приложения выбран механизм защиты 'Аутентификация по имени пользователя с использованием симметричных ключей'. Описание параметров и свойств механизма защиты 'Аутентификация по имени пользователя с использованием симметричных ключей' приведено в разделе link:http://docs.oracle.com/cd/E19182-01/821-0015/gggsrv/index.html[+Аутентификация по имени пользователя с использованием симметричных ключей +]. Описания других доступных механизмов защиты приведены в разделе link:http://docs.oracle.com/cd/E19182-01/820-0595/6ncatc2q5/index.html[+Настройка механизмов защиты+].
-6. Разверните разделы 'Входное сообщение' и 'Выходное сообщение' на вкладке 'Quality of Service'.
+
+[start=6]
+. Разверните разделы 'Входное сообщение' и 'Выходное сообщение' на вкладке 'Quality of Service'.
image::images/wsit-quality-dialog2.png[title="Страница 'Quality of Service' с включенной кнопкой 'Части сообщения'"]
Если в качестве механизма защиты выбрана 'Аутентификация по имени пользователя с использованием симметричных ключей', в разделах 'Входное сообщение' и 'Выходное сообщение' становится активной кнопка 'Части сообщений'.
*Примечание.* Когда выбран механизм защиты 'Аутентификация по имени пользователя с использованием симметричных ключей', список 'Маркер аутентификации' и параметры в разделе 'Входное сообщение' неактивны.
-7. Нажмите кнопку 'Части сообщений' в разделе 'Входное сообщение'.
+
+[start=7]
+. Нажмите кнопку 'Части сообщений' в разделе 'Входное сообщение'.
image::images/wsit-messageparts.png[title="Диалоговое окно 'Части сообщений'"]
В диалоговом окне 'Части сообщений' отображаются параметры безопасности для различных элементов. Вы можете установить флажки, чтобы включить или отключить части сообщений, которые требуют подписи, шифрования или являются обязательными. Для каждого элемента можно указать следующие параметры:
@@ -192,8 +214,12 @@
Далее будет рассмотрена настройка 'Quality of Service' клиента веб-службы.
-8. В окне 'Проекты' разверните узел 'Ссылки на веб-службы' проекта *SecureCalculatorClientApp*.
-9. Щелкните правой кнопкой мыши узел CalculatorWSService и выберите 'Изменить атрибуты службы' в контекстном меню. Откроется диалоговое окно 'Атрибуты веб-службы'.
+
+[start=8]
+. В окне 'Проекты' разверните узел 'Ссылки на веб-службы' проекта *SecureCalculatorClientApp*.
+
+[start=9]
+. Щелкните правой кнопкой мыши узел CalculatorWSService и выберите 'Изменить атрибуты службы' в контекстном меню. Откроется диалоговое окно 'Атрибуты веб-службы'.
image::images/wsit-qos-wsservice.png[title="Диалоговое окно качества обслуживания клиента веб-службы"]
В этом окне по умолчанию заданы имя пользователя 'wsitUser' и пароль. Имя пользователя и пароль по умолчанию были созданы в области 'file'.
@@ -213,7 +239,9 @@
При запуске клиента выполняется развертывание приложения, и в браузере открывается интерфейс службы.
image::images/wsit-browser-secure1.png[title="Безопасный клиент веб-службы в браузере"]
-3. Введите число в каждое поле и нажмите 'Получить результат'.
+
+[start=3]
+. Введите число в каждое поле и нажмите 'Получить результат'.
При нажатии на кнопку 'Получить результат' на странице отображается сообщение о том, что клиент аутентифицирован, затем отображается результат операции.
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_zh_CN.asciidoc
index 032e0ec..634dce5 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/wsit_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/wsit_zh_CN.asciidoc
@@ -85,7 +85,9 @@
1. 选择 "File"(文件)> "New Project"(新建项目)(在 Linux 和 Windows 上为 Ctrl-Shift-N 组合键;在 MacOS 上为 ⌘-Shift-N 组合键)以打开 "New Project"(新建项目)向导。
2. 展开 "Samples"(样例)类别,选择 "Web Services"(Web 服务)节点,然后选择 "Calculator"(计算器)样例。单击 "Next"(下一步)。
image::images/wsit-newproject.png[title="显示计算器样例的新建项目向导"]
-3. 确认在 "Server"(服务器)下拉列表中选定 Java EE 兼容的服务器。单击 "Finish"(完成)。
+
+[start=3]
+. 确认在 "Server"(服务器)下拉列表中选定 Java EE 兼容的服务器。单击 "Finish"(完成)。
单击 "Finish"(完成)后,向导将创建以下两个项目:
@@ -95,7 +97,9 @@
可能会用一个错误图标标记 CalculatorClientApp 服务,因为 IDE 找不到 CalculatorWS 服务的 WSDL。部署 CalculatorApp,然后清理并构建 CalculatorClientApp 之后,该错误将得到解决。
image::images/wsit-projects.png[title="显示 Web 服务和客户端的 "Projects"(项目)窗口"]
-4. 双击 CalculatorWS Web 服务以在编辑器中打开此文件,然后单击编辑器顶部的 "Design"(设计)标签以在可视设计器中查看 Web 服务。
+
+[start=4]
+. 双击 CalculatorWS Web 服务以在编辑器中打开此文件,然后单击编辑器顶部的 "Design"(设计)标签以在可视设计器中查看 Web 服务。
image::images/wsit-design.png[title=""Design GUI"(设计 GUI)(可视设计器)标签中的 CalculatorWS 服务"]
*注:*在服务设计标签的 "Quality of Service"(服务质量)部分中,您可以看到_未_启用任何选项。因此,尚未将“服务质量”组件应用于此特定 Web 服务。您将看到创建安全 Web 服务时_启用_“服务质量”组件的 Web 服务。
@@ -110,12 +114,16 @@
服务器启动,并且 Web 服务部署到服务器中。您将会看到在默认浏览器中打开一个页面,其中提供服务的某些详细信息。
image::images/wsit-browser1.png[title="浏览器中的 CalculatorWS 信息窗口"]
-2. 单击浏览器中此页上的 WSDL 链接以查看定义 Web 服务的 WSDL 文件。
+
+[start=2]
+. 单击浏览器中此页上的 WSDL 链接以查看定义 Web 服务的 WSDL 文件。
image::images/wsit-browser2.png[title="浏览器中的计算器 WS WSDL"]
*注:*如果未显示 WSDL,请检查浏览器地址栏中的 URL。它应指向 ``http://localhost:_your_port_number_/CalculatorApp/CalculatorWSService?WSDL`` 。
-3. 在 IDE 的 "Projects"(项目)窗口中,右键单击 "Web Services"(Web 服务)节点下的 "CalculatorWS",然后在弹出菜单中选择 "Test Web Service"(测试 Web 服务)。
+
+[start=3]
+. 在 IDE 的 "Projects"(项目)窗口中,右键单击 "Web Services"(Web 服务)节点下的 "CalculatorWS",然后在弹出菜单中选择 "Test Web Service"(测试 Web 服务)。
测试 Web 服务时,将在浏览器中打开用于测试该服务的页面。
@@ -123,16 +131,22 @@
IDE 可以提供用于测试 Web 服务的客户端并在浏览器中打开测试应用程序。您可以在测试应用程序中为 Web 服务中定义的每个字段输入值。测试应用程序具有一个按钮,该按钮标记在服务中操作的名称之后。单击此按钮时,您将会看到调用操作的结果。
-4. 在 "Projects"(项目)窗口中检查 CalculatorClientApp 项目是否有任何错误标记。
+
+[start=4]
+. 在 "Projects"(项目)窗口中检查 CalculatorClientApp 项目是否有任何错误标记。
如果 ``ClientServlet.java`` 有错误图标,请右键单击该项目节点,然后在弹出菜单中选择 "Clean and Build"(清理并构建)。显示错误的原因是未部署 CalculatorWS 服务。既然部署了该服务,IDE 就可以解析 WSDL 并编译 ClientServlet 了。
-5. 右键单击 "CalculatorClientApp" 项目节点,然后选择 "Run"(运行)。
+
+[start=5]
+. 右键单击 "CalculatorClientApp" 项目节点,然后选择 "Run"(运行)。
运行应用程序时,将在浏览器中打开服务界面。
image::images/wsit-browser4.png[title="浏览器中的计算器服务客户端"]
-6. 在这两个字段中输入值,然后单击 "Get Result"(获取结果)。
+
+[start=6]
+. 在这两个字段中输入值,然后单击 "Get Result"(获取结果)。
单击 "Get Result"(获取结果)时,将从 Web 服务中检索操作结果并将其显示在客户端中。
@@ -159,11 +173,15 @@
可能会用一个错误图标标记 SecureCalculatorClientApp 服务,因为 IDE 找不到 CalculatorWS 服务的 WSDL。部署 SecureCalculatorApp,然后清理并构建 SecureCalculatorClientApp 之后,该错误将得到解决。
-4. 双击 SecureCalculatorApp 的 "Web Services"(Web 服务)文件夹中的 CalculatorWS Web 服务以在编辑器中打开此文件,然后单击编辑器顶部的 "Design"(设计)标签以在可视设计器中查看 Web 服务。
+
+[start=4]
+. 双击 SecureCalculatorApp 的 "Web Services"(Web 服务)文件夹中的 CalculatorWS Web 服务以在编辑器中打开此文件,然后单击编辑器顶部的 "Design"(设计)标签以在可视设计器中查看 Web 服务。
*注:*在服务设计视图的 "Quality of Service"(服务质量)部分中,您可以看到选中了 "Secure Service"(安全服务)选项,而其他两个选项未选中。设计视图中的 "Quality of Service"(服务质量)部分用于指定当前的 Web 服务所_启用_的服务质量组件。
-5. 单击 "Edit Web Service Attributes"(编辑 Web 服务属性)以打开 "Web Service Attributes Editor"(Web 服务属性编辑器)。
+
+[start=5]
+. 单击 "Edit Web Service Attributes"(编辑 Web 服务属性)以打开 "Web Service Attributes Editor"(Web 服务属性编辑器)。
image::images/wsit-quality-dialog.png[title="WS 属性编辑器中的 "Quality of Service"(服务质量)页"]
在 "Quality of Service"(服务质量)标签中,您可以看到选中了 "Version Compatibility"(版本兼容性)选项。应选择与已安装的 Metro 或 .NET 版本匹配的最新版本。
@@ -174,14 +192,18 @@
在此样例应用程序中,选中了 "Username Authentication with Symmetric Keys"(用户名验证以及对称密钥)安全机制。有关用户名验证以及对称密钥安全机制的选项和属性的描述,请参见link:http://docs.oracle.com/cd/E19182-01/821-0015/gggsrv/index.html[+用户名验证以及对称密钥+]。有关其他可用安全机制的描述,请参见link:http://docs.oracle.com/cd/E19182-01/820-0595/6ncatc2q5/index.html[+配置安全机制+]。
-6. 在 "Quality of Service"(服务质量)标签中,展开 "Input Message"(输入消息)和 "Output Message"(输出消息)部分。
+
+[start=6]
+. 在 "Quality of Service"(服务质量)标签中,展开 "Input Message"(输入消息)和 "Output Message"(输出消息)部分。
image::images/wsit-quality-dialog2.png[title="已启用 "Message Parts"(消息部件)按钮的 "Quality of Service"(服务质量)页"]
如果选择 "Username Authentication with Symmetric Keys"(用户名验证以及对称密钥)作为安全机制,则会为 "Input Message"(输入消息)和 "Output Message"(输出消息)启用 "Message Parts"(消息部件)按钮。
*注:*不为 "Username Authentication with Symmetric Keys"(用户名验证以及对称密钥)安全机制启用 "Authentication Token"(验证标记)下拉列表和 "Input Message"(输入消息)的选项。
-7. 单击 "Input Message"(输入消息)部分中的 "Message Parts"(消息部件)按钮。
+
+[start=7]
+. 单击 "Input Message"(输入消息)部分中的 "Message Parts"(消息部件)按钮。
image::images/wsit-messageparts.png[title=""Message Parts"(消息部件)对话框"]
在 "Message Parts"(消息部件)对话框中,可以查看不同元素的安全选项。可以选中相应复选框以启用或禁用应签名、加密和需要的部件。对于每个元素,可以指定以下选项:
@@ -192,8 +214,12 @@
接下来,您将了解 Web 服务客户端的服务质量是如何配置的。
-8. 在 "Projects"(项目)窗口中,展开 *SecureCalculatorClientApp* 项目中的 "Web Service References"(Web 服务引用)节点。
-9. 右键单击 "CalculatorWSService" 节点,然后在弹出菜单中选择 "Edit Web Service Attributes"(编辑 Web 服务属性)以打开 "Web Service Attributes"(Web 服务属性)对话框。
+
+[start=8]
+. 在 "Projects"(项目)窗口中,展开 *SecureCalculatorClientApp* 项目中的 "Web Service References"(Web 服务引用)节点。
+
+[start=9]
+. 右键单击 "CalculatorWSService" 节点,然后在弹出菜单中选择 "Edit Web Service Attributes"(编辑 Web 服务属性)以打开 "Web Service Attributes"(Web 服务属性)对话框。
image::images/wsit-qos-wsservice.png[title="Web 服务客户端服务质量对话框"]
您会看到存在默认用户 "wsitUser" 和口令。该默认用户和口令是在 "file"(文件)领域中创建的。
@@ -213,7 +239,9 @@
运行客户端时,将部署应用程序,并在浏览器中打开服务界面。
image::images/wsit-browser-secure1.png[title="浏览器中的安全 Web 服务客户端"]
-3. 在每个字段中键入一个数字,然后单击 "Get Result"(获取结果)。
+
+[start=3]
+. 在每个字段中键入一个数字,然后单击 "Get Result"(获取结果)。
单击 "Get Result"(获取结果)时,页面中将显示已验证客户端的消息并显示操作结果。
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/zillow.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/zillow.asciidoc
index 6960998..09099c7 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/zillow.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/zillow.asciidoc
@@ -73,7 +73,9 @@
4. Right-click the ZillowRegionChart project node and select Properties from the context window. The Project Properties dialog opens.
5. Right-click the project node and choose New > Servlet. The New Servlet wizard opens.
image::images/new-zillow-servlet.png[title="New Servlet wizard with ZillowRegionChartServlet"]
-6. Name the servlet ZillowRegionChartServlet. Create an arbitrary package for it, such as zillow.regionchart. Keep all other defaults and click Finish.
+
+[start=6]
+. Name the servlet ZillowRegionChartServlet. Create an arbitrary package for it, such as zillow.regionchart. Keep all other defaults and click Finish.
The servlet opens in an editor tab and the servlet and its parent package are visible in the Projects view, in the Source Packages node of the project.
@@ -88,8 +90,12 @@
1. Open the Services tab in the IDE. Expand the Web Services node. Navigate to the Zillow GetRegionChart operation.
image::images/z-llow-getregionchart.png[title="Services tab with expanded Web Services and Zillow nodes"]
-2. In the editor, locate the processRequest method in ZillowRegionChartServlet.java. Add an empty line at the beginning of the try block. Drag and drop the getRegionChart operation into the try block of processRequest().
-3. The Customize GET SaaS dialog box opens. You can enter real US city, state and zip code values or leave them null. (If you leave null values, you will get a chart of average house prices for the entire country.) Click OK.
+
+[start=2]
+. In the editor, locate the processRequest method in ZillowRegionChartServlet.java. Add an empty line at the beginning of the try block. Drag and drop the getRegionChart operation into the try block of processRequest().
+
+[start=3]
+. The Customize GET SaaS dialog box opens. You can enter real US city, state and zip code values or leave them null. (If you leave null values, you will get a chart of average house prices for the entire country.) Click OK.
The IDE generates code for the GET SaaS service. When this is completed, the processRequest() method looks as follows.
@@ -119,7 +125,9 @@
out.println("<img src=\""+result.getDataAsString() + "\" />");
----
-2. Move the output line to inside the ``if`` block, at the end. The ``if`` block now looks like this:
+
+[start=2]
+. Move the output line to inside the ``if`` block, at the end. The ``if`` block now looks like this:
[source,java]
----
@@ -130,9 +138,13 @@
out.println("<img src=\"" + result.getDataAsString() + "\" />");
}
----
-3. Replace the ``result.getDataAsString()`` method in the output with ``resultObj.getResponse().getUrl()`` . You can use code completion to select ``getResponse()`` from the different ``resultObj`` methods, as shown below, and then use code completion to select ``getUrl()`` from the ``getResponse`` methods.
+
+[start=3]
+. Replace the ``result.getDataAsString()`` method in the output with ``resultObj.getResponse().getUrl()`` . You can use code completion to select ``getResponse()`` from the different ``resultObj`` methods, as shown below, and then use code completion to select ``getUrl()`` from the ``getResponse`` methods.
image::images/zillow-getresponse-cc.png[title="Editor showing code completion for resultObj methods"]
-4. Change the catch block to catch ``JAXBException`` instead of ``Exception`` . You can also use a ``Logger.getLogger(...)`` method instead of printing a stack trace. You will have to import the relevant classes. See if you can use code completion and the Fix Imports context menu action to reproduce the following catch block:
+
+[start=4]
+. Change the catch block to catch ``JAXBException`` instead of ``Exception`` . You can also use a ``Logger.getLogger(...)`` method instead of printing a stack trace. You will have to import the relevant classes. See if you can use code completion and the Fix Imports context menu action to reproduce the following catch block:
[source,java]
----
@@ -141,7 +153,9 @@
Logger.getLogger(ZillowRegionChartServlet.class.getName()).log(Level.SEVERE, null, ex);
}
----
-5. Remove the commented-out output section from the parent try block in the servlet code.
+
+[start=5]
+. Remove the commented-out output section from the parent try block in the servlet code.
Your modifications to the code are now complete! The final servlet code should look like the following:
@@ -170,21 +184,7 @@
public class ZillowRegionChartServlet extends HttpServlet {
/**
- * Processes requests for both HTTP
-
-[source,java]
-----
-
-GET
-----
- and
-
-[source,java]
-----
-
-POST
-----
- methods.
+ * Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ja.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ja.asciidoc
index a6c7e11..9af363e 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ja.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ja.asciidoc
@@ -73,7 +73,9 @@
4. 「ZillowRegionChart」プロジェクト・ノードを右クリックし、コンテキスト・ウィンドウから「プロパティ」を選択します。「プロジェクト・プロパティ」ダイアログが開きます。
5. プロジェクト・ノードを右クリックし、「新規」>「サーブレット」を選択します。新規サーブレット・ウィザードが開きます。
image::images/new-zillow-servlet.png[title="ZillowRegionChartServletに関する新規サーブレット・ウィザード"]
-6. サーブレットにZillowRegionChartServletという名前を付けます。これにzillow.regionchartなどの任意のパッケージを作成します。他はすべてデフォルト値のままにし、「終了」をクリックします。
+
+[start=6]
+. サーブレットにZillowRegionChartServletという名前を付けます。これにzillow.regionchartなどの任意のパッケージを作成します。他はすべてデフォルト値のままにし、「終了」をクリックします。
サーブレットがエディタ・タブで開き、サーブレットとその親パッケージが「プロジェクト」ビュー内のこのプロジェクトの「ソース・パッケージ」ノードに表示されます。
@@ -88,8 +90,12 @@
1. IDEで「サービス」タブを開きます。「Webサービス」ノードを展開します。Zillow GetRegionChart操作に移動します。
image::images/z-llow-getregionchart.png[title="展開された「Webサービスノードと「Zillow」ノードが表示された「サービス」タブ"]
-2. このエディタでZillowRegionChartServlet.javaにprocessRequestメソッドを配置します。tryブロックの始めに空の行を追加します。getRegionChart操作をprocessRequest()のtryブロックにドラッグ・アンド・ドロップします。
-3. 「GET SaaSをカスタマイズ」ダイアログ・ボックスが開きます。実在の米国の市、州および郵便番号の値を入力するか、これらをnullのままにします。値をnullのままにした場合、国全体の平均住宅価格のチャートになります。「OK」をクリックします。
+
+[start=2]
+. このエディタでZillowRegionChartServlet.javaにprocessRequestメソッドを配置します。tryブロックの始めに空の行を追加します。getRegionChart操作をprocessRequest()のtryブロックにドラッグ・アンド・ドロップします。
+
+[start=3]
+. 「GET SaaSをカスタマイズ」ダイアログ・ボックスが開きます。実在の米国の市、州および郵便番号の値を入力するか、これらをnullのままにします。値をnullのままにした場合、国全体の平均住宅価格のチャートになります。「OK」をクリックします。
IDEでGET SaaSサービスのコードが生成されます。この処理が完了すると、processRequest()メソッドは次のようになります。
@@ -119,7 +125,9 @@
out.println("<img src=\""+result.getDataAsString() + "\" />");
----
-2. 出力行を末尾の ``if`` ブロックの内部に移動します。これで、 ``if`` ブロックは次のようになります。
+
+[start=2]
+. 出力行を末尾の ``if`` ブロックの内部に移動します。これで、 ``if`` ブロックは次のようになります。
[source,java]
----
@@ -130,9 +138,13 @@
out.println("<img src=\"" + result.getDataAsString() + "\" />");
}
----
-3. この出力の ``result.getDataAsString()`` メソッドを ``resultObj.getResponse().getUrl()`` に置き換えます。次に示すように、コード補完を使用して ``getResponse()`` を別の ``resultObj`` メソッドから選択し、コード補完を使用して ``getUrl()`` を ``getResponse`` メソッドから選択します。
+
+[start=3]
+. この出力の ``result.getDataAsString()`` メソッドを ``resultObj.getResponse().getUrl()`` に置き換えます。次に示すように、コード補完を使用して ``getResponse()`` を別の ``resultObj`` メソッドから選択し、コード補完を使用して ``getUrl()`` を ``getResponse`` メソッドから選択します。
image::images/zillow-getresponse-cc.png[title="resultObjメソッドのコード補完が表示されているエディタ"]
-4. catchブロックを ``Exception`` から ``JAXBException`` に変更します。スタック・トレースを出力するかわりに、 ``Logger.getLogger(...)`` メソッドを使用することもできます。関連クラスをインポートします。コード補完と「インポートを修正」コンテキスト・メニュー・アクションを使用し、次のcatchブロックを再生成できるかどうかを確認します。
+
+[start=4]
+. catchブロックを ``Exception`` から ``JAXBException`` に変更します。スタック・トレースを出力するかわりに、 ``Logger.getLogger(...)`` メソッドを使用することもできます。関連クラスをインポートします。コード補完と「インポートを修正」コンテキスト・メニュー・アクションを使用し、次のcatchブロックを再生成できるかどうかを確認します。
[source,java]
----
@@ -141,7 +153,9 @@
Logger.getLogger(ZillowRegionChartServlet.class.getName()).log(Level.SEVERE, null, ex);
}
----
-5. サーブレット・コードの親tryブロックから、出力セクションのコメントを解除します。
+
+[start=5]
+. サーブレット・コードの親tryブロックから、出力セクションのコメントを解除します。
これで、コードの変更が完了しました。最終的なサーブレット・コードは、次のようになります。
@@ -170,21 +184,7 @@
public class ZillowRegionChartServlet extends HttpServlet {
/**
- * Processes requests for both HTTP
-
-[source,java]
-----
-
-GET
-----
- and
-
-[source,java]
-----
-
-POST
-----
- methods.
+ * Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_pt_BR.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_pt_BR.asciidoc
index ef5b1e8..cd2e951 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_pt_BR.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_pt_BR.asciidoc
@@ -73,7 +73,9 @@
4. Clique com o botão direito do mouse no nó do projeto ZillowRegionChart e selecione Propriedades na janela de contexto. A caixa de diálogo Propriedades do Projeto será aberta.
5. Clique com o botão direito do mouse no nó do projeto e selecione Novo > Servlet. O assistente Novo Servlet será aberto.
image::images/new-zillow-servlet.png[title="Assistente Novo Servlet com ZillowRegionChartServlet"]
-6. Chame o servlet de ZillowRegionChartServlet. Crie um pacote arbitrário para ele, como zillow.regionchart. Mantenha todos os outros defaults e clique em Finalizar.
+
+[start=6]
+. Chame o servlet de ZillowRegionChartServlet. Crie um pacote arbitrário para ele, como zillow.regionchart. Mantenha todos os outros defaults e clique em Finalizar.
O servlet será aberto em uma guia do editor e o servlet e seu pacote pai ficam visíveis na view Projetos, no nó Pacotes de Códigos-Fonte do projeto.
@@ -88,8 +90,12 @@
1. Abra a guia Serviços no IDE. Expanda o nó Web Services. Navegue para a operação GetRegionChart do Zillow.
image::images/z-llow-getregionchart.png[title="Guia Serviços com Web Services e nós Zillow expandidos"]
-2. No editor, localize o método processRequest em ZillowRegionChartServlet.java. Adicione uma linha vazia no início do bloco de teste. Arraste e solte a operação getRegionChart no bloco de teste de processRequest().
-3. A caixa de diálogo Personalizar SaaS GET será aberta. Você pode indicar os valores reais de cidade, estado e CEP dos EUA ou deixá-los como nulo. (Se você deixar valores nulos, obterá um gráfico da média de preços de casa para todo o país.) Clique em OK.
+
+[start=2]
+. No editor, localize o método processRequest em ZillowRegionChartServlet.java. Adicione uma linha vazia no início do bloco de teste. Arraste e solte a operação getRegionChart no bloco de teste de processRequest().
+
+[start=3]
+. A caixa de diálogo Personalizar SaaS GET será aberta. Você pode indicar os valores reais de cidade, estado e CEP dos EUA ou deixá-los como nulo. (Se você deixar valores nulos, obterá um gráfico da média de preços de casa para todo o país.) Clique em OK.
O IDE gera o código do serviços SaaS GET. Quando isso estiver concluído, o método processRequest() terá a seguinte aparência.
@@ -119,7 +125,9 @@
out.println("<img src=\""+result.getDataAsString() + "\" />");
----
-2. Mova a linha de saída para dentro do bloco ``if`` , no final. O bloco ``if`` agora se parece com:
+
+[start=2]
+. Mova a linha de saída para dentro do bloco ``if`` , no final. O bloco ``if`` agora se parece com:
[source,java]
----
@@ -130,9 +138,13 @@
out.println("<img src=\"" + result.getDataAsString() + "\" />");
}
----
-3. Substitua o método ``result.getDataAsString()`` na saída por ``resultObj.getResponse().getUrl()`` . Você pode usar a funcionalidade autocompletar código para selecionar ``getResponse()`` de métodos ``resultObj`` diferentes, como mostrado abaixo e, em seguida, usar a funcionalidade autocompletar código para selecionar ``getUrl()`` de métodos ``getResponse`` .
+
+[start=3]
+. Substitua o método ``result.getDataAsString()`` na saída por ``resultObj.getResponse().getUrl()`` . Você pode usar a funcionalidade autocompletar código para selecionar ``getResponse()`` de métodos ``resultObj`` diferentes, como mostrado abaixo e, em seguida, usar a funcionalidade autocompletar código para selecionar ``getUrl()`` de métodos ``getResponse`` .
image::images/zillow-getresponse-cc.png[title="Editor que mostra a funcionalidade autocompletar código para métodos resultObj"]
-4. Altere o bloco catch para interceptar ``JAXBException`` em vez de ``Exception`` . Você também pode usar um método ``Logger.getLogger(...)`` em vez de imprimir um rastreamento de pilha. Você terá que importar as classes relevantes. Veja se você pode usar a funcionalidade autocompletar código e a ação do menu de contexto Corrigir Importações para reproduzir o seguinte bloco catch:
+
+[start=4]
+. Altere o bloco catch para interceptar ``JAXBException`` em vez de ``Exception`` . Você também pode usar um método ``Logger.getLogger(...)`` em vez de imprimir um rastreamento de pilha. Você terá que importar as classes relevantes. Veja se você pode usar a funcionalidade autocompletar código e a ação do menu de contexto Corrigir Importações para reproduzir o seguinte bloco catch:
[source,java]
----
@@ -141,7 +153,9 @@
Logger.getLogger(ZillowRegionChartServlet.class.getName()).log(Level.SEVERE, null, ex);
}
----
-5. Remova a seção de saída comentada do bloco try pai no código do servlet.
+
+[start=5]
+. Remova a seção de saída comentada do bloco try pai no código do servlet.
Suas modificações no código agora estão completas! O código final do servlet deve ter a seguinte aparência:
@@ -170,21 +184,7 @@
public class ZillowRegionChartServlet extends HttpServlet {
/**
- * Processes requests for both HTTP
-
-[source,java]
-----
-
-GET
-----
- and
-
-[source,java]
-----
-
-POST
-----
- methods.
+ * Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ru.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ru.asciidoc
index 8817e2c..59c87db 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ru.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_ru.asciidoc
@@ -73,7 +73,9 @@
4. Щелкните правой кнопкой мыши узел проекта ZillowRegionChart и выберите Properties ("Свойства") из окна контекстного меню. Откроется диалоговое окно Project Properties ("Свойства проекта").
5. Щелкните правой кнопкой мыши узел проекта и выберите в меню "Создать" пункт "Сервлет". Откроется мастер создания сервлетов.
image::images/new-zillow-servlet.png[title="Мастер создания сервлетов с ZillowRegionChartServlet"]
-6. Назовите сервлет ZillowRegionChartServlet. Создайте для него произвольный пакет, скажем zillow.regionchart. Сохраните все прочие параметры по умолчанию и нажмите кнопку Finish ("Готово").
+
+[start=6]
+. Назовите сервлет ZillowRegionChartServlet. Создайте для него произвольный пакет, скажем zillow.regionchart. Сохраните все прочие параметры по умолчанию и нажмите кнопку Finish ("Готово").
Сервлет откроется во вкладке редактора, и сервлет с его родительским пакетом станут видимы в представлении Projects ("Проекты"), в узле Source Packages ("Пакеты исходного кода") проекта.
@@ -88,8 +90,12 @@
1. Откройте вкладку Services ("Службы") в среде IDE. Разверните узел Web Services ("Веб-службы"). Перейдите к операции Zillow GetRegionChart.
image::images/z-llow-getregionchart.png[title="Вкладка 'Службы' с развернутыми узлами 'Веб-службы' и Zillow"]
-2. В редакторе, найдите метод processRequest в ZillowRegionChartServlet.java. Добавьте пустую строку в начале блока try. Перетащите операцию getRegionChart в блок try processRequest().
-3. Откроется диалоговое окно Customize GET SaaS ("Настройка GET для ПО как услуги"). Можно ввести реальные значения города, штата США и почтового индекса, либо оставить их значения неопределенными. (При оставлении неопределенных значений будет выдана диаграмма цен на дома для всей страны). Нажмите кнопку "ОК".
+
+[start=2]
+. В редакторе, найдите метод processRequest в ZillowRegionChartServlet.java. Добавьте пустую строку в начале блока try. Перетащите операцию getRegionChart в блок try processRequest().
+
+[start=3]
+. Откроется диалоговое окно Customize GET SaaS ("Настройка GET для ПО как услуги"). Можно ввести реальные значения города, штата США и почтового индекса, либо оставить их значения неопределенными. (При оставлении неопределенных значений будет выдана диаграмма цен на дома для всей страны). Нажмите кнопку "ОК".
Среда IDE создаст код для функции GET службы "ПО как услуги". По выполнении этого, метод processRequest() будет выглядеть следующим образом.
@@ -119,7 +125,9 @@
out.println("<img src=\""+result.getDataAsString() + "\" />");
----
-2. Переместите выдаваемую строку внутрь блока ``if`` в конце. Блок ``if`` теперь выглядит следующим образом:
+
+[start=2]
+. Переместите выдаваемую строку внутрь блока ``if`` в конце. Блок ``if`` теперь выглядит следующим образом:
[source,java]
----
@@ -130,9 +138,13 @@
out.println("<img src=\"" + result.getDataAsString() + "\" />");
}
----
-3. Замените метод ``result.getDataAsString()`` в выводе на ``resultObj.getResponse().getUrl()`` . С помощью автозавершения кода ``getResponse()`` можно выбирать из различных методов ``resultObj`` , после чего использовать автозавершение кода для выбора ``getUrl()`` из методов ``getResponse`` .
+
+[start=3]
+. Замените метод ``result.getDataAsString()`` в выводе на ``resultObj.getResponse().getUrl()`` . С помощью автозавершения кода ``getResponse()`` можно выбирать из различных методов ``resultObj`` , после чего использовать автозавершение кода для выбора ``getUrl()`` из методов ``getResponse`` .
image::images/zillow-getresponse-cc.png[title="В редакторе отображается завершение кода для методов resultObj"]
-4. Измените блок catch, чтобы он перехватывал ``JAXBException`` вместо ``Exception`` . Также можно использовать метод ``Logger.getLogger(...)`` вместо распечатки трассировки стека. Соответствующие классы нужно будет импортировать. Посмотрим, можно ли использовать автозавершение кода и действие контекстного меню Fix Imports ("Исправить импортированные") для воспроизведения следующего блока catch:
+
+[start=4]
+. Измените блок catch, чтобы он перехватывал ``JAXBException`` вместо ``Exception`` . Также можно использовать метод ``Logger.getLogger(...)`` вместо распечатки трассировки стека. Соответствующие классы нужно будет импортировать. Посмотрим, можно ли использовать автозавершение кода и действие контекстного меню Fix Imports ("Исправить импортированные") для воспроизведения следующего блока catch:
[source,java]
----
@@ -141,7 +153,9 @@
Logger.getLogger(ZillowRegionChartServlet.class.getName()).log(Level.SEVERE, null, ex);
}
----
-5. Удалите закомментированный раздел вывода из родительского блока try в коде servlet.
+
+[start=5]
+. Удалите закомментированный раздел вывода из родительского блока try в коде servlet.
Теперь в код внесены все необходимые изменения. Окончательный вариант кода сервлета выглядит так:
@@ -170,21 +184,7 @@
public class ZillowRegionChartServlet extends HttpServlet {
/**
- * Processes requests for both HTTP
-
-[source,java]
-----
-
-GET
-----
- and
-
-[source,java]
-----
-
-POST
-----
- methods.
+ * Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
diff --git a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_zh_CN.asciidoc b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_zh_CN.asciidoc
index b888975..4b230e0 100644
--- a/netbeans.apache.org/src/content/kb/docs/websvc/zillow_zh_CN.asciidoc
+++ b/netbeans.apache.org/src/content/kb/docs/websvc/zillow_zh_CN.asciidoc
@@ -73,7 +73,9 @@
4. 右键单击 ZillowRegionChart 项目节点,并从上下文窗口中选择 "Properties"(属性)。"Project Properties"(项目属性)对话框打开。
5. 右键单击项目节点,然后选择 "New"(新建)> "Servlet"。此时将打开新建 Servlet 向导。
image::images/new-zillow-servlet.png[title="带有 ZillowRegionChartServlet 的新建 Servlet 向导"]
-6. 将此 Servlet 命名为 ZillowRegionChartServlet。为它创建一个任意的包,如 zillow.regionchart。保留所有其他设置为默认值不变,然后单击 "Finish"(完成)。
+
+[start=6]
+. 将此 Servlet 命名为 ZillowRegionChartServlet。为它创建一个任意的包,如 zillow.regionchart。保留所有其他设置为默认值不变,然后单击 "Finish"(完成)。
该 Servlet 在一个编辑器标签中打开,该 Servlet 及其父包显示在 "Projects"(项目)视图中项目的 "Source Packages"(源包)节点下。
@@ -88,8 +90,12 @@
1. 在 IDE 中打开 "Services"(服务)标签。展开 "Web Services"(Web 服务)节点。定位到 Zillow GetRegionChart 操作。
image::images/z-llow-getregionchart.png[title="展开了 Web 服务和 Zillow 节点的 "Services"(服务)标签"]
-2. 在编辑器中,定位到 ZillowRegionChartServlet.java 中的 processRequest 方法。在 try 代码块的开头添加一个空行。将 getRegionChart 操作拖放至 processRequest() 的 try 代码块中。
-3. “定制 GET Saas 服务”对话框打开。可以输入实际的美国城市、州以及邮政编码值,也可以将它们保留为空值。(如果保留空值,将获得全国平均房屋价格表。)单击 "OK"(确定)。
+
+[start=2]
+. 在编辑器中,定位到 ZillowRegionChartServlet.java 中的 processRequest 方法。在 try 代码块的开头添加一个空行。将 getRegionChart 操作拖放至 processRequest() 的 try 代码块中。
+
+[start=3]
+. “定制 GET Saas 服务”对话框打开。可以输入实际的美国城市、州以及邮政编码值,也可以将它们保留为空值。(如果保留空值,将获得全国平均房屋价格表。)单击 "OK"(确定)。
IDE 将生成 GET SaaS 服务的代码。完成后,processRequest() 方法应如下所示。
@@ -119,7 +125,9 @@
out.println("<img src=\""+result.getDataAsString() + "\" />");
----
-2. 将输出行移至 ``if`` 块内的结尾处。现在, ``if`` 块显示如下:
+
+[start=2]
+. 将输出行移至 ``if`` 块内的结尾处。现在, ``if`` 块显示如下:
[source,java]
----
@@ -130,9 +138,13 @@
out.println("<img src=\"" + result.getDataAsString() + "\" />");
}
----
-3. 将输出中的 ``result.getDataAsString()`` 方法替换为 ``resultObj.getResponse().getUrl()`` 。可以使用代码完成功能从不同的 ``resultObj`` 方法中选择 ``getResponse()`` (如下所示),然后使用代码完成功能从 ``getResponse`` 方法中选择 ``getUrl()`` 。
+
+[start=3]
+. 将输出中的 ``result.getDataAsString()`` 方法替换为 ``resultObj.getResponse().getUrl()`` 。可以使用代码完成功能从不同的 ``resultObj`` 方法中选择 ``getResponse()`` (如下所示),然后使用代码完成功能从 ``getResponse`` 方法中选择 ``getUrl()`` 。
image::images/zillow-getresponse-cc.png[title="显示 resultObj 方法的代码完成的编辑器"]
-4. 将 catch 代码块更改为捕获 ``JAXBException`` ,而不是 ``Exception`` 。还可以使用 ``Logger.getLogger(...)`` 方法,而不是打印堆栈跟踪。必须导入相关的类。请确定是否可以使用代码完成和 "Fix Imports"(修复导入)上下文菜单操作来重新产生下面的 catch 代码块:
+
+[start=4]
+. 将 catch 代码块更改为捕获 ``JAXBException`` ,而不是 ``Exception`` 。还可以使用 ``Logger.getLogger(...)`` 方法,而不是打印堆栈跟踪。必须导入相关的类。请确定是否可以使用代码完成和 "Fix Imports"(修复导入)上下文菜单操作来重新产生下面的 catch 代码块:
[source,java]
----
@@ -141,7 +153,9 @@
Logger.getLogger(ZillowRegionChartServlet.class.getName()).log(Level.SEVERE, null, ex);
}
----
-5. 从 Servlet 代码中的父 try 代码块中删除被注释掉的输出部分。
+
+[start=5]
+. 从 Servlet 代码中的父 try 代码块中删除被注释掉的输出部分。
至此,对代码的修改已完成!最终的 Servlet 代码应如下所示:
@@ -170,21 +184,7 @@
public class ZillowRegionChartServlet extends HttpServlet {
/**
- * Processes requests for both HTTP
-
-[source,java]
-----
-
-GET
-----
- and
-
-[source,java]
-----
-
-POST
-----
- methods.
+ * Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
diff --git a/netbeans.apache.org/src/content/participate/submit-pr.asciidoc b/netbeans.apache.org/src/content/participate/submit-pr.asciidoc
index d5f9b3c..4dd068a 100644
--- a/netbeans.apache.org/src/content/participate/submit-pr.asciidoc
+++ b/netbeans.apache.org/src/content/participate/submit-pr.asciidoc
@@ -136,7 +136,7 @@
After submission (and certainly after someone starts reviewing the PR) you shouldn't touch the PR's history.
[[donating-code]]
-= Donating Code
+== Donating Code
You may find official information here: https://incubator.apache.org/ip-clearance/
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqAccessSourcesWeb.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqAccessSourcesWeb.asciidoc
index ba1ac58..9ce34b0 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqAccessSourcesWeb.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqAccessSourcesWeb.asciidoc
@@ -39,11 +39,17 @@
link:http://bits.netbeans.org/dev/nightly/[http://bits.netbeans.org/dev/nightly/]
----
-2. Click the link for the build you want.
-3. You will be shown an index page where you can find a link to the folder with ZIP archives of binary builds and sources.
+[start=2]
+. Click the link for the build you want.
-4. Click the link or add "zip/" to the end of the URL in your browser's address bar manually and hit enter. In other words, the complete URL might look like this:
+
+[start=3]
+. You will be shown an index page where you can find a link to the folder with ZIP archives of binary builds and sources.
+
+
+[start=4]
+. Click the link or add "zip/" to the end of the URL in your browser's address bar manually and hit enter. In other words, the complete URL might look like this:
[source,java]
----
@@ -51,7 +57,9 @@
link:http://bits.netbeans.org/dev/nightly/2010-06-11_00-01-15/zip/[http://bits.netbeans.org/dev/nightly/2010-06-11_00-01-15/zip/]
----
-5. There are about a dozen links on that page. The one you want begins with "netbeans-trunk-nightly" and ends with "-src.zip" Click
+
+[start=5]
+. There are about a dozen links on that page. The one you want begins with "netbeans-trunk-nightly" and ends with "-src.zip" Click
that link to download the source archive.
=== Apache Migration Information
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqDialogControlOKButton.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqDialogControlOKButton.asciidoc
index 5bcd11d..10af37f 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqDialogControlOKButton.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqDialogControlOKButton.asciidoc
@@ -41,7 +41,9 @@
1. Create a new Action in one of your modules using the wizard in the
NetBeans IDE
-2. Replace the code generated inside that ActionListener with this code below:
+
+[start=2]
+. Replace the code generated inside that ActionListener with this code below:
public void actionPerformed(ActionEvent e) {
MyForm form = new MyForm();
@@ -100,7 +102,9 @@
}
}
-3. Run your application and invoke the new action you added
+
+[start=3]
+. Run your application and invoke the new action you added
----
Here the OK button in the dialog is initially disabled, but becomes enabled when some characters are typed. Removing all characters will disable it again.
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqEditorHowToAddCodeTemplates.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqEditorHowToAddCodeTemplates.asciidoc
index 8a6b934..b44f1cd 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqEditorHowToAddCodeTemplates.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqEditorHowToAddCodeTemplates.asciidoc
@@ -44,7 +44,9 @@
</codetemplates>
----
-2. Register it for the mimetype in the layer.xml
+
+[start=2]
+. Register it for the mimetype in the layer.xml
[source,xml]
----
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqExternalLibraries.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqExternalLibraries.asciidoc
index 464edcd..b0884f0 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqExternalLibraries.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqExternalLibraries.asciidoc
@@ -39,7 +39,9 @@
2. link:#Things_done_in_IDE_build[Things done in IDE build]
3. link:#Things_done_in_NBM_build[Things done in NBM build]
4. link:#Golden_files[Golden files]
-8. link:#Apache_Migration_Information[Apache Migration Information]
+
+[start=8]
+. link:#Apache_Migration_Information[Apache Migration Information]
== How to store external libraries in the NetBeans Hg repository
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqFileBug.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqFileBug.asciidoc
index b7a0cad..5082a58 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqFileBug.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqFileBug.asciidoc
@@ -42,7 +42,9 @@
3. Instructions for running the test case.
4. What you would expect to see happen.
5. What you actually see happen.
-7. Be patient as the bug is assigned and evaluated, and provide additional information if requested. If all goes well it should be fixed for a future NetBeans release. The evaluator may also be able to offer some workarounds for use in current releases.
+
+[start=7]
+. Be patient as the bug is assigned and evaluated, and provide additional information if requested. If all goes well it should be fixed for a future NetBeans release. The evaluator may also be able to offer some workarounds for use in current releases.
=== Apache Migration Information
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqGeneralWhereIsJavasciidoc.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqGeneralWhereIsJavasciidoc.asciidoc
index fa9e2e5..2a7d25f 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqGeneralWhereIsJavasciidoc.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqGeneralWhereIsJavasciidoc.asciidoc
@@ -37,11 +37,17 @@
1. Go to the nightly build download site: link:http://bits.netbeans.org/dev/nightly/[http://bits.netbeans.org/dev/nightly/]
-2. Click the link for the build you want.
-3. Add "zip/" to the end of the URL in your browser's address bar and hit enter. In other words, the complete URL might look like this: link:http://bits.netbeans.org/dev/nightly/2010-06-11_00-01-15/zip/[http://bits.netbeans.org/dev/nightly/2010-06-11_00-01-15/zip/]
+[start=2]
+. Click the link for the build you want.
-5. There are about a dozen links on that page. The one you want begins with `netbeans-trunk-nightly` and ends with `-javadoc.zip`; click that link to download the Javadoc archive.
+
+[start=3]
+. Add "zip/" to the end of the URL in your browser's address bar and hit enter. In other words, the complete URL might look like this: link:http://bits.netbeans.org/dev/nightly/2010-06-11_00-01-15/zip/[http://bits.netbeans.org/dev/nightly/2010-06-11_00-01-15/zip/]
+
+
+[start=5]
+. There are about a dozen links on that page. The one you want begins with `netbeans-trunk-nightly` and ends with `-javadoc.zip`; click that link to download the Javadoc archive.
Finally, you can go to the update center (*Tools > Plugin Manager*) in the NetBeans IDE and request the *NetBeans API Documentation* module, which bundles Javadoc matching your IDE release. Use *Help > Javadoc References* (*View > Documentation Indices* in NetBeans 5.x) to see the overview pages for API sets currently used by your open projects. The IDE should also automatically display this Javadoc in code completion popups.
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqHideShowToolbar.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqHideShowToolbar.asciidoc
index 772d302..4f38f31 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqHideShowToolbar.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqHideShowToolbar.asciidoc
@@ -86,7 +86,9 @@
----
-2. Register the configuration files in `layer.xml`:
+
+[start=2]
+. Register the configuration files in `layer.xml`:
[source,xml]
----
@@ -103,7 +105,9 @@
----
-3. At runtime, set the toolbar configuration that you want:
+
+[start=3]
+. At runtime, set the toolbar configuration that you want:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqHowToReuseModules.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqHowToReuseModules.asciidoc
index 1563e5d..b41932e 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqHowToReuseModules.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqHowToReuseModules.asciidoc
@@ -119,7 +119,9 @@
1. Set `nbm.is.global=true` and/or `nbm.target.cluster="yourtargetcluster"`
-2. Create an instance of `org.netbeans.spi.autoupdate.AutoupdateClusterCreator` as a service provider. Unless you have an appropriate `AutoupdateClusterCreator` service in your platform application, these properties have no effect and all updates will always be installed in the user dir! Unfortunately, this is poorly documented.
+
+[start=2]
+. Create an instance of `org.netbeans.spi.autoupdate.AutoupdateClusterCreator` as a service provider. Unless you have an appropriate `AutoupdateClusterCreator` service in your platform application, these properties have no effect and all updates will always be installed in the user dir! Unfortunately, this is poorly documented.
The easy way to create one such `AutoupdateClusterCreator` was for me to adapt the source file of the default IDE implementation (link:http://hg.netbeans.org/main/file/tip/updatecenters/src/org/netbeans/modules/updatecenters/resources/NetBeansClusterCreator.java[http://hg.netbeans.org/main/file/tip/updatecenters/src/org/netbeans/modules/updatecenters/resources/NetBeansClusterCreator.java] ) to my own needs. Basically, all you have to do is replace one file name: "`netbeans.clusters`" must become "`yourbrandingappname.clusters`". You'll find the respective file in "`install-dir/etc`" of your application.
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqLookupDefault.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqLookupDefault.asciidoc
index a8c4abc..77df8fd 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqLookupDefault.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqLookupDefault.asciidoc
@@ -53,7 +53,9 @@
----
-2. Each module which wants to implement that service depends on the controller module which defines the interface, and creates and registers an implementation:
+
+[start=2]
+. Each module which wants to implement that service depends on the controller module which defines the interface, and creates and registers an implementation:
[source,java]
----
@@ -67,7 +69,9 @@
It is also possible to declaratively mask other people's implementations and declaratively order implementations so some will take precedence.
-3. The controller finds all implementations and uses them somehow:
+
+[start=3]
+. The controller finds all implementations and uses them somehow:
[source,java]
----
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqModuleObfuscation.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqModuleObfuscation.asciidoc
index a1ad395..b354ffe 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqModuleObfuscation.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqModuleObfuscation.asciidoc
@@ -57,7 +57,9 @@
proguard.jar.path=${tools.dir}/obfuscating/jar/proguard.jar
----
-2. Edit the `build.xml` of your module and override some targets as in the following excerpt:
+
+[start=2]
+. Edit the `build.xml` of your module and override some targets as in the following excerpt:
[source,xml]
----
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqNetBeansPlatformManager.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqNetBeansPlatformManager.asciidoc
index 1eb4b3b..896b9e4 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqNetBeansPlatformManager.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqNetBeansPlatformManager.asciidoc
@@ -78,13 +78,21 @@
1. Click Tools -> NetBeans Platforms (note that the menu item name varies slightly in older versions)
-2. Click the "Add Platform..." button in the lower right
-3. Locate the platform binary and click OK. In this example the proper path is ~/netbeans-repository/main/nbbuild/netbeans/.
+[start=2]
+. Click the "Add Platform..." button in the lower right
-4. You can associate sources and javadoc for this platform using the respective tabs in the platform manager
-5. You can also choose which version of the build scripts you want to us on the Harness tab. You'll usually want to use the version corresponding to that platform.
+[start=3]
+. Locate the platform binary and click OK. In this example the proper path is ~/netbeans-repository/main/nbbuild/netbeans/.
+
+
+[start=4]
+. You can associate sources and javadoc for this platform using the respective tabs in the platform manager
+
+
+[start=5]
+. You can also choose which version of the build scripts you want to us on the Harness tab. You'll usually want to use the version corresponding to that platform.
==== 4. Reference The New NetBeans Platform
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqNewXMLFileType.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqNewXMLFileType.asciidoc
index 63faa73..5ea78bc 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqNewXMLFileType.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqNewXMLFileType.asciidoc
@@ -49,7 +49,9 @@
1. Register the link:DevFaqDataLoader.asciidoc[loader] for text/xml mimetype
-2. The loader:
+
+[start=2]
+. The loader:
[source,java]
----
@@ -105,7 +107,9 @@
<hr/>
-3. The data object:
+
+[start=3]
+. The data object:
[source,java]
----
@@ -171,7 +175,9 @@
----
<hr/>
-4. The layer file:
+
+[start=4]
+. The layer file:
[source,xml]
----
@@ -237,7 +243,9 @@
----
<hr/>
-5. the MIME resolver:
+
+[start=5]
+. the MIME resolver:
[source,xml]
----
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqNonGuiPlatformApp.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqNonGuiPlatformApp.asciidoc
index 44014d2..be9b1c1 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqNonGuiPlatformApp.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqNonGuiPlatformApp.asciidoc
@@ -44,10 +44,18 @@
* Module System API
* Startup
* Utilities API
-4. Add a new module to the suite
-5. Create and register a `ModuleInstall` class
-6. The `restored()` method is effectively your application's `main` method.
-7. You may optionally override the `close()` method of your `ModuleInstall` to clean up resources upon shutdown, but be sure then to call `LifecycleManager.getDefault().shutDown()`.
+
+[start=4]
+. Add a new module to the suite
+
+[start=5]
+. Create and register a `ModuleInstall` class
+
+[start=6]
+. The `restored()` method is effectively your application's `main` method.
+
+[start=7]
+. You may optionally override the `close()` method of your `ModuleInstall` to clean up resources upon shutdown, but be sure then to call `LifecycleManager.getDefault().shutDown()`.
You will also need to suppress the splash screen by passing `--nosplash` argument when starting the app.
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqSignNbm.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqSignNbm.asciidoc
index 73da4bb..5e7bdc0 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqSignNbm.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqSignNbm.asciidoc
@@ -30,11 +30,17 @@
1. link:#Can_I_sign_Ant_based_NBMs_I_create.3F[Can I sign Ant based NBMs I create?]
1. link:#Isn.27t_there_an_easier_way.3F[Isn't there an easier way?]
2. link:#Great.21_Can_you_translate_that.3F[Great! Can you translate that?]
-2. link:#How_can_I_sign_Maven_based_NBMs_I_create.3F[How can I sign Maven based NBMs I create?]
+
+[start=2]
+. link:#How_can_I_sign_Maven_based_NBMs_I_create.3F[How can I sign Maven based NBMs I create?]
1. link:#Example[Example]
-3. link:#How_can_I_create_a_keystore_file_and_sign_Maven_based_NBMs_within_the_build_process.3F[How can I create a keystore file and sign Maven based NBMs within the build process?]
+
+[start=3]
+. link:#How_can_I_create_a_keystore_file_and_sign_Maven_based_NBMs_within_the_build_process.3F[How can I create a keystore file and sign Maven based NBMs within the build process?]
1. link:#Resources[Resources]
-4. link:#Apache_Migration_Information[Apache Migration Information]
+
+[start=4]
+. link:#Apache_Migration_Information[Apache Migration Information]
=== Can I sign Ant based NBMs I create?
@@ -42,7 +48,9 @@
1. Make a module project.
-2. Generate a keystore, e.g.
+
+[start=2]
+. Generate a keystore, e.g.
[source,java]
----
@@ -63,7 +71,9 @@
(RETURN if same as keystore password):
----
-3. Edit `nbproject/project.properties` to contain e.g.
+
+[start=3]
+. Edit `nbproject/project.properties` to contain e.g.
[source,java]
----
@@ -72,7 +82,9 @@
nbm_alias=myself
----
-4. Edit `nbproject/private/platform-private.properties` to contain e.g.
+
+[start=4]
+. Edit `nbproject/private/platform-private.properties` to contain e.g.
[source,java]
----
@@ -83,15 +95,21 @@
You could also pass `-Dstorepass=specialsauce` on the command line.
If you specify a keystore but `${storepass}` is undefined, you will be prompted for the password during the build.
-5. Build the NBM for the module. (Context menu of the project.) It should be signed.
-6. Try installing the NBM. (Expand `build` folder in *Files* view and double-click it.) It will not be trusted initially (and so the checkbox to really install it will initially be unchecked), since NetBeans does not know about your signature. But you can click *View Certificate* to examine the certificate. If you allow installation of this module, NetBeans will remember you approved this certificate and it will not ask you for confirmation next time.
+[start=5]
+. Build the NBM for the module. (Context menu of the project.) It should be signed.
+
+
+[start=6]
+. Try installing the NBM. (Expand `build` folder in *Files* view and double-click it.) It will not be trusted initially (and so the checkbox to really install it will initially be unchecked), since NetBeans does not know about your signature. But you can click *View Certificate* to examine the certificate. If you allow installation of this module, NetBeans will remember you approved this certificate and it will not ask you for confirmation next time.
Some notes:
1. You can probably get a root-authorized certificate from VeriSign or the like, and the Auto Update wizard should treat this as more trusted. Not yet investigated (please update this FAQ entry if you experiment with this).
-2. Keeping the keystore and its password in the `private` dir ensures that you will not accidentally commit either to source repository or include it in a source ZIP made with the Project Packager module. It may be safe to put the keystore in a shared directory (e.g. `nbproject`) if you are sure that the storepass is too hard to guess.
+
+[start=2]
+. Keeping the keystore and its password in the `private` dir ensures that you will not accidentally commit either to source repository or include it in a source ZIP made with the Project Packager module. It may be safe to put the keystore in a shared directory (e.g. `nbproject`) if you are sure that the storepass is too hard to guess.
==== Isn't there an easier way?
@@ -142,7 +160,9 @@
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
----
-2. Otherwise:
+
+[start=2]
+. Otherwise:
[source,xml]
----
@@ -174,9 +194,13 @@
1. Create a keystore with genkey task.
-2. Using the defined module list (${modules} this is defined by the IDE itself) go to all your modules and add the keystore location and alias information in its `nbproject/private/platform-private.properties` file.
-3. Call Netbeans build task so everything keeps going.
+[start=2]
+. Using the defined module list (${modules} this is defined by the IDE itself) go to all your modules and add the keystore location and alias information in its `nbproject/private/platform-private.properties` file.
+
+
+[start=3]
+. Call Netbeans build task so everything keeps going.
Enjoy!
@@ -195,9 +219,13 @@
1. Create a keystore (see the instructions above)
-2. Save the keystore file into a directory like `nbproject/private`. Make sure that it will not get committed to VCS like git/svn/hg! Or save it outside of the project. It depends on your preference.
-3. Update the `nbm-maven-plugin`-configuration in the pom.xml like this
+[start=2]
+. Save the keystore file into a directory like `nbproject/private`. Make sure that it will not get committed to VCS like git/svn/hg! Or save it outside of the project. It depends on your preference.
+
+
+[start=3]
+. Update the `nbm-maven-plugin`-configuration in the pom.xml like this
`
[source,xml]
@@ -227,7 +255,9 @@
More details about configuring the plugin can be found at the offical plugin page [2]
-4. Call `mvn clean package nbm:nbm -Dkeystorepass=yourpassword` to build a signed nbm.OR
+
+[start=4]
+. Call `mvn clean package nbm:nbm -Dkeystorepass=yourpassword` to build a signed nbm.OR
Call `mvn clean package nbm:nbm -Dkeystorepass=yourpassword -Dkeystore=/path/to/the/keystore.file`, if you want to reference the keystore manually. For more options see [3]
diff --git a/netbeans.apache.org/src/content/wiki/DevFaqWrapperModules.asciidoc b/netbeans.apache.org/src/content/wiki/DevFaqWrapperModules.asciidoc
index 249496b..d407ead 100644
--- a/netbeans.apache.org/src/content/wiki/DevFaqWrapperModules.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/DevFaqWrapperModules.asciidoc
@@ -93,10 +93,16 @@
1. `project.xml`
adjust the `<class-path-extension>`
-2. `project.properties`
+
+[start=2]
+. `project.properties`
specify `extra.module.files`
-3. remove the wrapper's release directory
-4. `build.xml`
+
+[start=3]
+. remove the wrapper's release directory
+
+[start=4]
+. `build.xml`
to override the `release` target
The following example demonstrates these steps.
diff --git a/netbeans.apache.org/src/content/wiki/FaqHowDoIFileACA.asciidoc b/netbeans.apache.org/src/content/wiki/FaqHowDoIFileACA.asciidoc
index ea582aa..f4e2ea3 100644
--- a/netbeans.apache.org/src/content/wiki/FaqHowDoIFileACA.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/FaqHowDoIFileACA.asciidoc
@@ -37,15 +37,21 @@
-2. Scan it and email it to link:mailto:oracle-ca_us@oracle.com[oracle-ca_us@oracle.com]
+
+[start=2]
+. Scan it and email it to link:mailto:oracle-ca_us@oracle.com[oracle-ca_us@oracle.com]
-3. Please check link:http://www.oracle.com/technetwork/goto/oca[list of approved CA signatories] for your name in the days following your submission. If your name does not show up, or shows up incorrectly, please contact link:mailto:jiri.kovalsky@oracle.com[Jiri Kovalsky] - NetBeans Community Manager.
+
+[start=3]
+. Please check link:http://www.oracle.com/technetwork/goto/oca[list of approved CA signatories] for your name in the days following your submission. If your name does not show up, or shows up incorrectly, please contact link:mailto:jiri.kovalsky@oracle.com[Jiri Kovalsky] - NetBeans Community Manager.
-4. If you have other questions, please consult the link:http://www.oracle.com/technetwork/oca-faq-405384.pdf[General FAQs guide].
+
+[start=4]
+. If you have other questions, please consult the link:http://www.oracle.com/technetwork/oca-faq-405384.pdf[General FAQs guide].
=== Apache Migration Information
diff --git a/netbeans.apache.org/src/content/wiki/HowToAddFAQEntries.asciidoc b/netbeans.apache.org/src/content/wiki/HowToAddFAQEntries.asciidoc
index 85e0c9c..5d3a3b7 100644
--- a/netbeans.apache.org/src/content/wiki/HowToAddFAQEntries.asciidoc
+++ b/netbeans.apache.org/src/content/wiki/HowToAddFAQEntries.asciidoc
@@ -65,13 +65,17 @@
* Note that the `link:_.asciidoc[ ]` braces make the entire thing a link to the actual answer page.
-3. Click the Save button to save the page (or click Cancel to discard your changes).
+
+[start=3]
+. Click the Save button to save the page (or click Cancel to discard your changes).
==== Adding the Answer
1. Now you are back to view mode of the FAQ index page. Scroll down and find your question as one of the bullet items in the list - It will be red. Click on your new (red) link.
-2. This will bring you to another edit window for the *answer page*. You can use the code below as a template for starting out your answer page, and fill in your own question (the same that you just entered into the FAQ index!) and answer.
+
+[start=2]
+. This will bring you to another edit window for the *answer page*. You can use the code below as a template for starting out your answer page, and fill in your own question (the same that you just entered into the FAQ index!) and answer.
[source,java]
----
@@ -83,7 +87,9 @@
----
-3. Finally, add information at the bottom of the FAQ that tells what version of NetBeans and what OS platform the FAQ works with. Just add the versions and platforms that you know are right. If "See also:" information is useful, add it here also.
+
+[start=3]
+. Finally, add information at the bottom of the FAQ that tells what version of NetBeans and what OS platform the FAQ works with. Just add the versions and platforms that you know are right. If "See also:" information is useful, add it here also.
[source,java]
----
@@ -95,7 +101,9 @@
----
-4. That's it. Click Save to save the page when you are done editing the answer.
+
+[start=4]
+. That's it. Click Save to save the page when you are done editing the answer.
==== What To Do About Long Lines of Text