<api-answers
question-version="1.29"
author="jhavlin@netbeans.org"
> <!-- This file was based on arch.xml file in module openide.io. -->
&api-questions;
<!-- <questionid="arch-overall"when="init"> Describetheoverallarchitecture. <hint> WhatwillbeAPIfor <ahref="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API"> clientsandwhatsupportAPI</a>? Whatpartswillbepluggable? Howwillplug-insberegistered?Pleaseuse<code><apitype="export"/></code> todescribeyourgeneralAPIsandspecifytheir <ahref="http://wiki.netbeans.org/API_Stability#Private"> stabilitycategories</a>. Ifpossiblepleaseprovidesimplediagrams. </hint> </question>
-->
<answer id="arch-overall">
<api
name="NbInputOutputAPI"
group="java" type="export"
category="official" url="@org-netbeans-api-io@/org/netbeans/api/io/package-summary.html"
>
<p>
The module contains APIs for creating output panes (e.g. output tabs in Output Window in the IDE)
and for writing data into them. It also supports some advanced techniques, e.g. color text,
hyperlinks, code folding, scrolling to stored positions.
</p>
</api>
<api
name="NbInputOutputSPI"
group="java" type="export"
category="official" url="@org-netbeans-api-io@/org/netbeans/spi/io/package-summary.html"
>
<p>
SPI for providing custom implementations of output window is also included in this module, in package
<code>org.netbeans.spi.io</code>
</p>
</api>
</answer>
<!-- <questionid="arch-quality"when="init"> Howwillthe<ahref="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a> ofyourcodebetestedand howarefutureregressionsgoingtobeprevented? <hint> Whatkindoftestingdo youwanttouse?Howmuchfunctionality,inwhichareas, shouldbecoveredbythetests?Howyoufindoutthatyour projectwassuccessful? </hint> </question>
-->
<answer id="arch-quality">
<p>
Unit test will be prepared for invocable code in API classes. But most of the
code is just definition of API and SPI.
</p>
</answer>
<!-- <questionid="arch-time"when="init"> Whatarethetimeestimatesofthework? <hint> Pleaseexpressyourestimatesofhowlongthedesign,implementation, stabilizationarelikelytolast.Howmanypeoplewillbeneededto implementthisandwhatistheexpectedmilestonebywhichtheworkshouldbe ready? </hint> </question>
-->
<answer id="arch-time">
<p>
The design, implementation, preparing unit tests and reviews will
probably take several weeks.
</p>
</answer>
<usecase id="print" name="Print a simple output to a new output tab">
<p>
The basic use-case is printing a simple text, e.g. text output of an application,
into a dedicated pane in the UI, e.g. a tab in Output Window in the IDE.
</p>
<pre>
InputOutput io = InputOutput.get("UseCase1", true);
io.getOut().println("This is a simple output");
io.getOut().close();
</pre>
</usecase>
<usecase id="printOnClickHyperlink" name="Print a line with hyperlink for invocation of arbitrary code">
<p>
Hyperlinks can be also used to invoke some code when clicked.
</p>
<pre>
InputOutput io = InputOutput.get("UseCase3", true);
io.getOut().print("A line containing a ");
io.getOut().print("hyperlink", Hyperlink.from(new Runnable() { public void run() {
System.gc();
}
}));
io.getOut().println(" for invocation of custom code.");
io.getOut().close();
</pre>
</usecase>
<usecase id="printColor" name="Print color text">
<p>
Print a color text. Users can select a predefined color for
common cases (debug, warning, failure, success), or custom
color specified as RGB value.
</p>
<pre>
InputOutput io = InputOutput.get("UseCase4", true);
io.getOut().println("Let's print some info", OutputColor.debug());
io.getOut().println("or warning with appropriate color", OutputColor.warning());
io.getOut().println("Maybe also text with custom reddish color", OutputColor.rgb(255, 16, 16));
io.getOut().close();
</pre>
</usecase>
<usecase id="printAndReset" name="Reset an InputOutput to clear all previosly printed text">
<p>
It is possible to reuse already created output pane and clear
all the previously printed text if it is not needed any more.
</p>
<pre>
InputOutput io = InputOutput.get("UseCase5", true);
io.getOut().println("Let's print some text");
io.getErr().println("and reset the pane immediately.");
io.reset();
io.getOut().println("The pane is now empty and we can reuse it simply");
io.getOut().close();
</pre>
</usecase>
</answer>
<!-- <questionid="arch-what"when="init"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<p>
The Input/Output API and SPI is a small module
which contains <code>InputOutput</code> and related interfaces used in
driving the Output Window.
</p>
<p>
The normal implementation is <code>org.netbeans.core.output2</code>.
</p>
</answer>
<!-- <questionid="compat-deprecation"when="init"> Howtheintroductionofyourprojectinfluencesfunctionality providedbypreviousversionoftheproduct? <hint> Ifyouareplanningtodeprecate/remove/changeanyexistingAPIs, listthemhereaccompaniedwiththereasonexplainingwhyyou aredoingso. </hint> </question>
-->
<answer id="compat-deprecation">
<p>
Backward compatibility of other modules is not broken.
</p>
<p>
This module should replace original I/O API module
<code>org.openide.io</code>, which has the same goals, but which is
not UI independent, and which is difficult to extend.
</p>
</answer>
<!-- <questionid="compat-i18n"when="impl"> Isyourmodulecorrectlyinternationalized? <hint> Correctinternationalizationmeansthatitobeysinstructions at<ahref="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html"> NetBeansI18Npages</a>. </hint> </question>
-->
<answer id="compat-i18n">
<p>
Yes. There is not much to internationalize.
</p>
</answer>
<!-- <questionid="compat-standards"when="init"> Doesthemoduleimplementordefineanystandards?Isthe implementationexactordoesitdeviatesomehow? </question>
-->
<answer id="compat-standards">
<p>
The module defines an API.
</p>
</answer>
<hint> Veryhelpfulforreadingsettingsistostoreversionnumber there,sofutureversionscandecidewhetherhowtoread/convert thesettingsandolderversionscanignorethenewones. </hint> </question>
-->
<answer id="compat-version">
<p>
N/A. No settings are read or written by this module.
</p>
</answer>
<!-- <questionid="deploy-dependencies"when="final"> Whatdoothermodulesneedtodotodeclareadependencyonthisone, inadditiontoorinsteadofthenormalmoduledependencydeclaration (e.g.tokenstorequire)? <hint> Provideasampleoftheactuallinesyouwouldaddtoamodulemanifest todeclareadependency,forexampleOpenIDE-Module-Requires:some.token. Ifothermodulesshouldnotdependonthismodule,orshouldjustusea simpleregularmoduledependency,youcanjustanswer"nothing".Ifyou intentionallyexposeasemistableAPItoclientsusingimplementation dependencies,youshouldmentionthathere(butthereisnoneedtogive anexampleofusage). </hint> </question>
-->
<answer id="deploy-dependencies">
<p>
Normal module dependency is enough.
</p>
<p>
Availability of some implementation of the SPI is guaranteed by "OpenIDE-Module-Needs: org.netbeans.spi.io.InputOutputProvider" in
the manifest of this module.
</p>
</answer>
<!-- <questionid="exec-threading"when="init"> Whatthreadingmodels,ifany,doesyourmoduleadhereto?Howthe projectbehaveswithrespecttothreading? <hint> IsyourAPIthreadsafe?Canitbeaccessedfromanythreadsor justfromsomededicatedones?AnyspecialrelationtoAWTand itsEventDispatchthread?Also ifyourmodulecallsforeignAPIswhichhaveaspecificthreadingmodel, indicatehowyoucomplywiththerequirementsformultithreadedaccess (synchronization,mutexes,etc.)applicabletothoseAPIs. IfyourmoduledefinesanyAPIs,orhascomplexinternalstructures thatmightbeusedfrommultiplethreads,declarehowyouprotect dataagainstconcurrentaccess,raceconditions,deadlocks,etc., andwhethersuchrulesareenforcedbyruntimewarnings,errors,assertions,etc. Examples:aclassmightbenon-thread-safe(likeJavaCollections);might befullythread-safe(internallocking);mightrequireaccessthroughamutex (andmayormaynotautomaticallyacquirethatmutexonbehalfofaclientmethod); mightbeabletorunonlyintheeventqueue;etc. Alsodescribewhenanyeventsarefired:synchronously,asynchronously,etc. Ideas:<ahref="http://core.netbeans.org/proposals/threading/index.html#recommendations">ThreadingRecommendations</a>(inprogress) </hint> </question>
-->
<answer id="exec-threading">
<p>
API classes are thread safe, they mostly represent immutable
objects, or delegate to the SPI.
</p>
<p>
Implementators of the SPI should ensure that their code is properly
synchronized, as it can be called from any thread.
</p>
</answer>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.