Search Results

Search found 227 results on 10 pages for 'geertjan'.

Page 6/10 | < Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >

  • Embedded Nashorn in JEditorPane

    - by Geertjan
    Here's a prototype for some kind of backoffice content management system. Several interesting goodies are included, such as an embedded JavaScript editor, as can be seen in the screenshot: Key items of interest in the above are as follows: Embedded JavaScript editor (i.e., the latest and greatest Nashorn technology, look it up, if you're not aware of what that is.) The way that's done is to include the relevant JavaScript modules in your NetBeans Platform application. Make very sure to include "Lexer to NetBeans Bridge", which does a bunch of critical stuff under the hood. The JEditorPane is defined as follows, along the lines that I blogged about recently thanks to Steven Yi: javaScriptPane.setContentType("text/javascript"); EditorKit kit = CloneableEditorSupport.getEditorKit("text/javascript"); javaScriptPane.setEditorKit(kit); javaScriptPane.getDocument().putProperty("mimeType", "text/javascript"); Note that "javaScriptPane" above is simply a JEditorPane. Timon Veenstra's excellent solution for integrating Nodes with MultiViewElements, which is described here by Timon, and nowhere else in the world. The tab you see above is within a pluggable container, so anyone else could create a new module and register their own MultiViewElement such that it will be incorporated into the editor. A small trick to ensure that only one window opens per news item: @NbBundle.Messages("OpenNews=Open") private class OpenNewsAction extends AbstractAction { public OpenNewsAction() { super(Bundle.OpenNews()); } @Override public void actionPerformed(ActionEvent e) { News news = getLookup().lookup(News.class); Mode editorMode = WindowManager.getDefault().findMode("editor"); for (TopComponent tc : WindowManager.getDefault().getOpenedTopComponents(editorMode)) { if (tc.getDisplayName().equals(news.getTitle())) { tc.requestActive(); return; } } TopComponent tc = MultiViews.createMultiView("application/x-newsnode", NewsNode.this); tc.open(); tc.requestActive(); } } The rest of what you see above is all standard NetBeans Platform stuff. The sources of everything you see above is here: http://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.3/misc/CMSBackOffice

    Read the article

  • Smart Meter Management on the NetBeans Platform

    - by Geertjan
    Netinium® NCC is the operator console for the Netinium® AMM+ platform, a Head End system for multi-vendor smart meter and smart grid infrastructures. The role based NCC provides a uniform operations environment for grid operators and utilities to securely manage millions of smart meters, in-home displays and other smart devices using different types of communication networks such as IP, PLC, GPRS, CDMA and BPL. Based on the NetBeans Platform, the NCC offers the flexibility to easily extend the GUI with new functionality when new devices are added to the system.  For more information visit http://www.netinium.com.

    Read the article

  • Using irc in NetBeans IDE 7.2

    - by Geertjan
    Turns out to be easy to use irc in NetBeans IDE 7.2. Install Irssi (I was able to do apt-get to install it), which has a handy guide here, and then use the Terminal window in NetBeans IDE (Window | Output | Terminal): In the above, do this: irssi /connect irc.freenode.net /join #netbeans Then, next time you have a problem in NetBeans IDE or there's some question you have about how to do something, just type your question in the Terminal window and someone will help you, if someone is there who knows the answer.

    Read the article

  • Deploy from NetBeans IDE by Twisting an External Dial

    - by Geertjan
    Via this code in a NetBeans module, i.e., a registered NetBeans ModuleInstall class, you can twist the Tinkerforge Rotary Poti Bricklet to deploy the current application in the IDE: import com.tinkerforge.BrickMaster; import com.tinkerforge.BrickletLCD20x4; import com.tinkerforge.BrickletRotaryPoti; import com.tinkerforge.IPConnection; import javax.swing.Action; import javax.swing.JMenuItem; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectUtils; import org.openide.awt.Actions; import org.openide.modules.ModuleInstall; import org.openide.util.Utilities; public class Installer extends ModuleInstall { private static final String HOST = "localhost"; private static final int PORT = 4223; private static final String MASTERBRICKUID = "abc"; private static final String LCDUID = "abc"; private static final String ROTIUID = "abc"; private static IPConnection ipc; private static BrickMaster master = new BrickMaster(MASTERBRICKUID); private static BrickletLCD20x4 lcd = new BrickletLCD20x4(LCDUID); private static BrickletRotaryPoti poti = new BrickletRotaryPoti(ROTIUID); @Override public void restored() { try { ipc = new IPConnection(HOST, PORT); ipc.addDevice(master); ipc.addDevice(lcd); ipc.addDevice(poti); poti.setPositionCallbackPeriod(50); poti.addListener(new BrickletRotaryPoti.PositionListener() { @Override public void position(final short position) { lcd.backlightOn(); lcd.clearDisplay(); final Action runAction = Actions.forID("Project","org.netbeans.modules.project.ui.RunMainProject"); //The action must be invoked from menu item or toolbar button, //see line 147 in org.netbeans.modules.project.ui.actions.LookupSensitiveAction: JMenuItem jmi = new JMenuItem(runAction); //When position is 100 (range is -150 to 150), deploy the app //and print info about the project to the LCD display: if (position == 100) { jmi.doClick(); Project p = Utilities.actionsGlobalContext().lookup(Project.class); lcd.writeLine((short) 0, (short) 0, "Deployed:"); lcd.writeLine((short) 1, (short) 0, ProjectUtils.getInformation(p).getDisplayName()); } else { lcd.writeLine((short) 0, (short) 0, "Position: " + position); } } }); } catch (Exception e) { } } }

    Read the article

  • GeoToolkit Demo Embedded in an Application Framework via Maven

    - by Geertjan
    As a follow on to yesterday's blog entry, here's the equivalent starter application for GeoToolkit (also known as Geotk) on the NetBeans Platform, which ends up looking like this: The above is a border.shp file I found on-line, while here's a USA states shape file rendered in the application: Note that the navigation bar is also included, though that could later be migrated into the menu bar of the NetBeans Platform.  Download the Maven based NetBeans Platform application with GeoToolkit integration here: http://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.3/tutorials/geospatial/geotoolkit/MyGeospatialSystem It was quite tricky getting this sample together, parts of it, especially the installer, which creates the database, comes from the Puzzle GIS project, while the files come from on-line locations, with the JAI-related dependencies providing problems of their own. But it's definitely a starting point and you now have the basic Maven structure needed for getting started with GeoToolkit in the context of all the services and components provided by the NetBeans Platform.  Many thanks to Johann Sorel for his patience and help. 

    Read the article

  • Groovy Grapes in NetBeans IDE

    - by Geertjan
    The start of Groovy Grapes support in NetBeans IDE. Below you see a pure Groovy project, with the Groovy JAR and the Ivy JAR automatically on its classpath. There's also a Groovy script that makes use of a @Grab annotation. In the bottom left, in the Services window, you also see a Grape Repository browser, i.e., showing you the JARs that are currently in ".groovy/grapes". Click the images below to get a better look at them. Next, you see what happens when the project is run. The @Grab annotation automatically starts downloading the JARs that are needed and puts them into the ".groovy/grapes" folder. However, the "no suitable classloader found for grab" error message (which Google shows is a problem for lots of developers) prevents the application from running successfully: The final screenshot shows that I've put the JARs that I need onto the classpath of the project. I did that manually, hoping to learn from the NetBeans Maven project or the NetBeans Gradle project how to do that automatically. Also note that the @Grab annotation has been commented out. Now the error message about the classloader is avoided and the project runs. What needs to happen for Groovy Grapes support to be complete in NetBeans IDE: Figure out how to add the downloaded JARs to the project classpath automatically. Fix the refresh problem in the Grape Repository browser, i.e., right now the refresh doesn't happen automatically yet. Hopefully find a way to get around the grab classloader problem, i.e., it's not ideal that one needs to comment out the annotation. Let the user specify a different Grape repository, i.e., right now ".groovy/grapes" is assumed, but the user should be able to point the repository browser to something different. Maybe there should be support for multiple Grape repositories? Comments/feedback/help is welcome.

    Read the article

  • Presentation Plugin for NetBeans IDE 7.2

    - by Geertjan
    I got some excellent help from Mark Stephens, who is from IDR Solutions, which produces JPedal. Using the LGPL version of JPedal, and code provided by Mark, it's now possible to right-click the node that appears in the Presentation Window: ...after which, using a file browser (to locate a file on disk) or a URL (a very simple check is done, the URL must start with "http" and end with "pdf"), you can now open PDF files as images (thanks to conversion from PDF to images done by JPedal) into NetBeans IDE, typically (I imagine) for presentation purposes: Note that you should consider the plugin in "alpha" state. But, despite that, I've had good results. Try it and use the URL below, as a control test (since it works fine for me), which produces the result shown above: http://edu.netbeans.org/contrib/slides/netbeans-platform/presentation-4-actions.pdf  However, for some PDFs, the plugin doesn't work, and I don't know why yet (trying to figure it out with Mark), resulting in this stack trace: java.lang.ArrayIndexOutOfBoundsException: 8 at org.jpedal.objects.acroforms.formData.SwingData.completeField(Unknown Source) at org.jpedal.objects.acroforms.rendering.DefaultAcroRenderer.createField(Unknown Source) at org.jpedal.objects.acroforms.rendering.DefaultAcroRenderer.createDisplayComponentsForPage(Unknown Source) at org.jpedal.PDFtoImageConvertor.convert(Unknown Source) at org.jpedal.PdfDecoder.getPageAsImage(Unknown Source) at org.jpedal.PdfDecoder.getPageAsImage(Unknown Source) Here's the location of the plugin, install it into NetBeans IDE 7.2; feedback is very welcome: http://plugins.netbeans.org/plugin/44525

    Read the article

  • Smarter Search Results in NetBeans IDE 7.2

    - by Geertjan
    After you search your code using NetBeans IDE (using Ctrl-F for "Find" or Ctrl-H for "Replace"), you see the Search Results window, which looks like this: At least, the above is how it looks in NetBeans IDE 7.2. Before that, you didn't have all those extra columns (which can be displayed in the Search Results window after clicking the small button top right in the view) and you also didn't have the quick search (which is invoked by typing directly into the Search Results window), as can be seen here: So, the Search Results window now provides a lot more info than before. Being able to know the path to a file I've found, as well as the last modification date, file size, and the number of matches within the file, is useful at the end of a search process. In the NetBeans IDE 7.2 New & Noteworthy, the above changes are described in the Utilities section, as well as in the Quick Search in OutlineView section, where you can read that these are generic solutions that can be used in your own OutlineViews. Other OutlineViews in NetBeans IDE 7.2, such as the Debugger window, now also have these new features. A related article worth reading is Beefed Up Code Navigation Tools in NetBeans IDE 7.2. 

    Read the article

  • Baseline for GIS Applications

    - by Geertjan
    The application I introduced here yesterday can best be understood via its author's explanation: "As I developed several different WorldWind-based applications, I noticed that they all started out the same. Terramenta was born so I wouldn't have to recreate the baseline every time, I could just provide NetBeans plugin modules to introduce the new features required by different projects." So, to try it out for myself, I checked out the sources from the Mercurial repo today, built them, and ran them. hg clone https://bitbucket.org/heidtmare/terramenta On Windows, things worked fine, on Ubuntu they didn't because the relevant native libraries aren't provided yet out of the box. Here's the result: The above provides the WorldWind globe, together with all the standard options, e.g., for showing names and other WorldWind features, together with several features that I don't understand yet, such as tools for creating shapes and a recorder for replaying sequences. The complete application is like this, i.e., one single functionality module is provided, which exposes several API packages that can be extended: It would really be cool if the above module could also be added to a Maven-based application via a reference to a Maven repository, in the way that Timon Veenstra and the AgroSense team have made available their GeoViewer. One cool thing from the GeoViewer solution is the Flamingo menubar, which I added to Terramenta by simply putting the dependency below into the application POM: <dependency>    <groupId>nl.cloudfarming.client</groupId>    <artifactId>menu</artifactId>    <version>1.0.24</version></dependency> The result, without doing anything other than the above: I am looking forward to helping to document the use cases and developer scenarios for Terramenta! Something like this, created by Timon to demonstrate the GeoViewer use case would be cool to have: http://java.net/projects/agrosense/pages/ExampleGeoviewerNormal

    Read the article

  • IRC News from #netbeans on FreeNode

    - by Geertjan
    I joined the #netbeans channel on FreeNode last week and the discussions there are really great. It's so cool to not have the endless back and forth of an e-mail exchange. Instead, you can hammer out a complete solution to a problem while chatting live in the channel. A case in point was yesterday, when someone named 'charmeleon' wanted to create a NetBeans Platform based application that includes the "image" module from the NetBeans IDE sources. That way, he'd have a starting point for his own image-oriented application, since he'd not only have the NetBeans Platform, but also the sources of the "image" module. Had we been communicating via e-mail, it would have taken weeks, at least, to come to a solution. Instead, we hashed it out together live, including some very specific problems that would have been hard to communicate about via e-mail. In the end, I made a movie showing exactly the scenario that charmeleon was interested in: And, right now, in the #netbeans channel, charmeleon said: "NetBeans RCP feels like cheating once you start getting over the hump." I'm sure the fact that the hump was handled within a few hours of chatting on irc is a big contributor to that impression.

    Read the article

  • NetBeans "Find Usages" Tool Integrates JSF Expression Language

    - by Geertjan
    I saw this by Adam on Twitter today: Interesting. Let's try it. Here's my method "getCustomerId". I select it, right-click, and choose "Find Usages" (or press Alt-F7): A nice dialog appears: Then click "Find" and, guess what, this is what I see (click to enlarge it): Clearly, as you can see, I'm not only finding the Java controller class where the getter is used, but also the Facelets files, and, within those, the exact lines where the JSF expression language makes use of the getter. This is not a new feature, tried it and got the same result in 7.1.1, but it's really cool to know about nonetheless.

    Read the article

  • Mixing JavaFX, HTML 5, and Bananas with the NetBeans Platform

    - by Geertjan
    The banana in the image below can be dragged. Whenever the banana is dropped, the current date is added to the viewer: What's interesting is that the banana, and the viewer that contains it, is defined in HTML 5, with the help of a JavaScript and CSS file. The HTML 5 file is embedded within the JavaFX browser, while the JavaFX browser is embedded within a NetBeans TopComponent class. The only really interesting thing is how drop events of the banana, which is defined within JavaScript, are communicated back into the Java class. Here's how, i.e., in the Java class, parse the HTML's DOM tree to locate the node of interest and then set a listener on it. (In this particular case, the event listener adds the current date to the InstanceContent which is in the Lookup.) Here's the crucial bit of code: WebView view = new WebView(); view.setMinSize(widthDouble, heightDouble); view.setPrefSize(widthDouble, heightDouble); final WebEngine webengine = view.getEngine(); URL url = getClass().getResource("home.html"); webengine.load(url.toExternalForm()); webengine.getLoadWorker().stateProperty().addListener( new ChangeListener() { @Override public void changed(ObservableValue ov, State oldState, State newState) { if (newState == State.SUCCEEDED) { Document document = (Document) webengine.executeScript("document"); EventTarget banana = (EventTarget) document.getElementById("banana"); banana.addEventListener("click", new MyEventListener(), true); } } }); It seems very weird to me that I need to specify "click" as a string. I actually wanted the drop event, but couldn't figure out what the arbitrary string was for that. Which is exactly why strings suck in this context. Many thanks to Martin Kavuma from the Technical University of Eindhoven, who I met today and who inspired me to go down this interesting trail.

    Read the article

  • Save Actions in NetBeans IDE 7.3

    - by Geertjan
    Several developers, especially those familiar with equivalent functionality in Eclipse, have been asking for so-called "Save Actions", that is, support for actions that are automatically performed when a file is saved. Here's the related NetBeans issue: http://netbeans.org/bugzilla/show_bug.cgi?id=140719   In NetBeans IDE 7.3, the issue is resolved as follows: A new "On Save" tab is found in the "Editor" tab of the Options window. Defaults for all languages are set via the "All Languages" item in the drop-down. Here, for all languages, you can specify what kind (all, none, or only modified lines) of formatting and space removal will occur automatically when a file is saved: Via the drop-down, you see all the languages supported by the IDE: You can pick a language and then override the default On Save settings: Per language, there may be additional On Save settings. For example, for Java, you can specify that, when saving a Java file, unused import statements should be removed and/or the rules you've set for organizing import statements should be applied: There's also a set of new NetBeans IDE APIs for adding new On Save functionality via custom plugins. Via MIME type registration of OnSaveTask.Factory, you can register new On Save actions that will be run for files conforming to the relevant MIME type. There's also extensions via the Editor Options API for registering new panels (one per language) to the On Save panel in the Options window. I'll demonstrate some examples of the APIs in upcoming blog entries.

    Read the article

  • 5 Step Procedure for Android Deployment with NetBeans IDE

    - by Geertjan
    I'm finding that it's so simple to deploy apps to Android that I'm not needing to use the Android emulator at all, haven't been able to figure out how it works anyway (big blinky screen pops up that I don't know what to do with). I just simply deploy the app straight to Android, try it out there, and then uninstall it, if needed. The whole process (only step 4 and 5 below need to be done for each deployment iteration, after you've done steps 1, 2, and 3 once to set up the deployment environment), takes a few seconds. Here's what I do: On Android, go to Settings | Applications. Check "Unknown sources". In "Development", check "USB debugging". Connect Android to your computer via a USB cable. Start up NetBeans IDE, with NBAndroid installed, as described yesterday. and create your "Hello World" app. Right-click the project in the IDE and choose "Export Signed Android Package". Create a new keystore, or choose an existing one, via the wizard that appears. At the end of the wizard (would be nice if NBAndroid would let you set up a keystore once and then reuse it for all your projects, without needing to work through the whole wizard step by step each time), you'll have a new release APK file (Android deployment archive) in the project's 'bin' folder, which you can see in the Files window. Go to the command line (would be nice if NBAndroid were to support adb, would mean I wouldn't need the command line at all), browse to the location of the APK file above. Type "adb install helloworld-release.apk" or whatever the APK file is called. You should see a "Success" message in the command line. Now the application is installed. On your Android, go to "Applications", and there you'll see your brand new app. Then try it out there and delete it if you're not happy with it. After you've made a change in your app, simply repeat step 4 and 5, i.e., create a new APK and install it via adb. Step 4 and 5 take a couple of seconds. And, given that it's all so simple, I don't see the value of the Android emulator, at all.

    Read the article

  • JEditorPane on Steroids with Nashorn

    - by Geertjan
    Continuing from Embedded Nashorn in JEditorPane, here is the same JEditorPane on steroids with Nashorn, in the context of some kind of CMS backend system: Above, you see heavy reusage of NetBeans IDE editor infrastructure. Parts of it are with thanks to Steven Yi, who has done some great research in this area. Code completion, right-click popup menu, line numbering, editor toolbar, find/replace features, block selection, comment/uncomment features, etc, etc, etc, all the rich editor features from NetBeans IDE are there, within a plain old JEditorPane. And everything is externally extensible, e.g., new actions can be registered by external modules into the right-click popup menu or the editor toolbar or the sidebar, etc. For example, here's code completion (Ctrl-Space): It even has the cool new feature where if you select a closing brace and the opening brace isn't in the visible area, a rectangular popup appears at the top of the editor, to show how the current piece of code begins: The only thing I am missing is code folding! I wish that would work too, still figuring it out. What's also cool is that this is a Maven project. The sources: http://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.3/misc/CMSBackOffice2

    Read the article

  • HTML Tidy in NetBeans IDE

    - by Geertjan
    First step in integrating HTML Tidy (via its JTidy implementation) into NetBeans IDE: The reason why I started doing this is because I want to integrate this into the pluggable analyzer functionality of NetBeans IDE that I recently blogged about, i.e., where the FindBugs functionality is found. So a logical first step is to get it working in an Action class, after which I can port it into the analyzer infrastructure: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.awt.ActionRegistration; import org.openide.cookies.EditorCookie; import org.openide.cookies.LineCookie; import org.openide.loaders.DataObject; import org.openide.text.Line; import org.openide.text.Line.ShowOpenType; import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.openide.windows.IOProvider; import org.openide.windows.InputOutput; import org.openide.windows.OutputEvent; import org.openide.windows.OutputListener; import org.openide.windows.OutputWriter; import org.w3c.tidy.Tidy; @ActionID(     category = "Tools", id = "org.jtidy.TidyAction") @ActionRegistration(     displayName = "#CTL_TidyAction") @ActionReferences({     @ActionReference(path = "Loaders/text/html/Actions", position = 150),     @ActionReference(path = "Editors/text/html/Popup", position = 750) }) @Messages("CTL_TidyAction=Run HTML Tidy") public final class TidyAction implements ActionListener {     private final DataObject context;     private final OutputWriter writer;     private EditorCookie ec = null;     public TidyAction(DataObject context) {         this.context = context;         ec = context.getLookup().lookup(org.openide.cookies.EditorCookie.class);         InputOutput io = IOProvider.getDefault().getIO("HTML Tidy", false);         io.select();         writer = io.getOut();     }     @Override     public void actionPerformed(ActionEvent ev) {         Tidy tidy = new Tidy();         try {             writer.reset();             StringWriter stringWriter = new StringWriter();             PrintWriter errorWriter = new PrintWriter(stringWriter);             tidy.setErrout(errorWriter);             tidy.parse(context.getPrimaryFile().getInputStream(), System.out);             String[] split = stringWriter.toString().split("\n");             for (final String string : split) {                 final int end = string.indexOf(" c");                 if (string.startsWith("line")) {                     writer.println(string, new OutputListener() {                         @Override                         public void outputLineAction(OutputEvent oe) {                             LineCookie lc = context.getLookup().lookup(LineCookie.class);                             int lineNumber = Integer.parseInt(string.substring(0, end).replace("line ", ""));                             Line line = lc.getLineSet().getOriginal(lineNumber - 1);                             line.show(ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);                         }                         @Override                         public void outputLineSelected(OutputEvent oe) {}                         @Override                         public void outputLineCleared(OutputEvent oe) {}                     });                 }             }         } catch (IOException ex) {             Exceptions.printStackTrace(ex);         }     } } The string parsing above is ugly but gets the job done for now. A problem integrating this into the pluggable analyzer functionality is the limitation of its scope. The analyzer lets you select one or more projects, or individual files, but not a folder. So it doesn't work on folders in the Favorites window, for example, which is where I'd like to apply HTML Tidy, across multiple folders via the analyzer functionality. That's a bit of a bummer that I'm hoping to get around somehow.

    Read the article

  • JEditorPane Code Completion

    - by Geertjan
    Code completion in a JEditorPane: Unfortunately, a lot of this solution depends on the Java Editor support in the IDE. Therefore, to use it, in its current state, you'll need lots of Java Editor related JARs even though your own application probably doesn't include a Java Editor. A key thing one needs to do is implement the NetBeans Code Completion API, using the related tutorial in the NetBeans Platform Learning Trail, but register the CompletionProvider as follows: @MimeRegistration(mimeType = "text/x-dialog-binding", service = CompletionProvider.class) Then in the TopComponent, include this code, which will bind all the completion providers in the above location, i.e., text/x-dialog-binding, to the JEditorPane: EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java"); jEditorPane1.setEditorKit(kit); FileObject fob; try {     fob = FileUtil.getConfigRoot().createData("tmp.java");     DataObject dob = DataObject.find(fob);     jEditorPane1.getDocument().putProperty(             Document.StreamDescriptionProperty,             dob);     DialogBinding.bindComponentToFile(fob, 0, 0, jEditorPane1);     jEditorPane1.setText("Egypt"); } catch (IOException ex) {     Exceptions.printStackTrace(ex); } Not a perfect solution, a bit hacky, with a high overheard, but a start nonetheless. Someone should look in the NetBeans sources to see how this actually works and then create a generic solution that is not tied to the Java Editor.

    Read the article

  • PostgreSQL, Ubuntu, NetBeans IDE (Part 2)

    - by Geertjan
    Now let's create the start of a CRUD application on the NetBeans Platform, using Hibernate and PostgreSQL to do so. Here's what I see in NetBeans IDE after setting things up as outlined yesterday: The NetBeans Platform CRUD Tutorial should get you up and started creating the NetBeans Platform application. Open the generated "persistence.xml" in Design mode and then switch the persistence library to Hibernate. The Here's the application structure: The Hibernate module that you see above has this content: Here's the result: And here's the source code: http://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.3/misc/NBPostgreSQL

    Read the article

  • Feed Reader Fix

    - by Geertjan
    In the FeedReader sample (available in the New Projects window), there's this piece of code: private static Feed getFeed(Node node) { InstanceCookie ck = node.getLookup().lookup(InstanceCookie.class); if (ck == null) { throw new IllegalStateException("Bogus file in feeds folder: " + node.getLookup().lookup(FileObject.class)); } try { return (Feed) ck.instanceCreate(); } catch (ClassNotFoundException ex) { Exceptions.printStackTrace(ex); } catch (IOException ex) { Exceptions.printStackTrace(ex); } return null; } Since 7.1, for some reason, the above doesn't work. What does work, and is simpler, is this, instead of the above: private static Feed getFeed(Node node) { Feed f = FileUtil.getConfigObject("RssFeeds/sample.instance", Feed.class); if (f == null) { throw new IllegalStateException("Bogus file in feeds folder: " + node.getLookup().lookup(FileObject.class)); } return f; } So, the code needs to be fixed in the sample.

    Read the article

  • HTML Tidy in NetBeans IDE (Part 2)

    - by Geertjan
    This is what I was aiming for in the previous blog entry: What you can see above (especially if you click to enlarge it) is that I have HTML Tidy integrated into the NetBeans analyzer functionality, which is pluggable from 7.2 onwards. Well, if you set an implementation dependency on "Static Analysis Core", since it's not an official API yet. Also, the scopes of the analyzer functionality are not pluggable. That means you can 'only' set the analyzer's scope to one or more projects, one or more packages, or one or more files. Not one or more folders, which means you can't have a bunch off HTML files in a folder that you access via the Favorites window and then run the analyzer on that folder (or on multiple folders). Thus, to try out my new code, I had to put some HTML files into a package inside a Java application. Then I chose that package as the scope of the analyzer. Then I ran all the analyzers (i.e., standard NetBeans Java hints, FindBugs, as well as my HTML Tidy extension) on that package. The screenshot above is the result. Here's all the code for the above, which is a port of the Action code from the previous blog entry into a new Analyzer implementation: import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.swing.JComponent; import javax.swing.text.Document; import org.netbeans.api.fileinfo.NonRecursiveFolder; import org.netbeans.modules.analysis.spi.Analyzer; import org.netbeans.modules.analysis.spi.Analyzer.AnalyzerFactory; import org.netbeans.modules.analysis.spi.Analyzer.Context; import org.netbeans.modules.analysis.spi.Analyzer.CustomizerProvider; import org.netbeans.modules.analysis.spi.Analyzer.WarningDescription; import org.netbeans.spi.editor.hints.ErrorDescription; import org.netbeans.spi.editor.hints.ErrorDescriptionFactory; import org.netbeans.spi.editor.hints.Severity; import org.openide.cookies.EditorCookie; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; import org.openide.util.Exceptions; import org.openide.util.lookup.ServiceProvider; import org.w3c.tidy.Tidy; public class TidyAnalyzer implements Analyzer {     private final Context ctx;     private TidyAnalyzer(Context cntxt) {         this.ctx = cntxt;     }     @Override     public Iterable<? extends ErrorDescription> analyze() {         List<ErrorDescription> result = new ArrayList<ErrorDescription>();         for (NonRecursiveFolder sr : ctx.getScope().getFolders()) {             FileObject folder = sr.getFolder();             for (FileObject fo : folder.getChildren()) {                 for (ErrorDescription ed : doRunHTMLTidy(fo)) {                     if (fo.getMIMEType().equals("text/html")) {                         result.add(ed);                     }                 }             }         }         return result;     }     private List<ErrorDescription> doRunHTMLTidy(FileObject sr) {         final List<ErrorDescription> result = new ArrayList<ErrorDescription>();         Tidy tidy = new Tidy();         StringWriter stringWriter = new StringWriter();         PrintWriter errorWriter = new PrintWriter(stringWriter);         tidy.setErrout(errorWriter);         try {             Document doc = DataObject.find(sr).getLookup().lookup(EditorCookie.class).openDocument();             tidy.parse(sr.getInputStream(), System.out);             String[] split = stringWriter.toString().split("\n");             for (String string : split) {                 //Bit of ugly string parsing coming up:                 if (string.startsWith("line")) {                     final int end = string.indexOf(" c");                     int lineNumber = Integer.parseInt(string.substring(0, end).replace("line ", ""));                     string = string.substring(string.indexOf(": ")).replace(":", "");                     result.add(ErrorDescriptionFactory.createErrorDescription(                             Severity.WARNING,                             string,                             doc,                             lineNumber));                 }             }         } catch (IOException ex) {             Exceptions.printStackTrace(ex);         }         return result;     }     @Override     public boolean cancel() {         return true;     }     @ServiceProvider(service = AnalyzerFactory.class)     public static final class MyAnalyzerFactory extends AnalyzerFactory {         public MyAnalyzerFactory() {             super("htmltidy", "HTML Tidy", "org/jtidy/format_misc.gif");         }         public Iterable<? extends WarningDescription> getWarnings() {             return Collections.EMPTY_LIST;         }         @Override         public <D, C extends JComponent> CustomizerProvider<D, C> getCustomizerProvider() {             return null;         }         @Override         public Analyzer createAnalyzer(Context cntxt) {             return new TidyAnalyzer(cntxt);         }     } } The above only works on packages, not on projects and not on individual files.

    Read the article

  • Simple HTML5 Friendly Markup Sample

    - by Geertjan
    From a demo done by David Heffelfinger (who has a great Java EE 7 screencast series here), on HTML5 friendly markup. index.xhtml:  <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:jsf="http://xmlns.jcp.org/jsf"> <title>Data Entry Page</title> <body> <form method="POST" jsf:id='form'> <table> <tr> <td>Name:</td> <td><input jsf:id='name' type="text" jsf:value="${person.name}" /></td> </tr> <tr> <td>City</td> <th><input jsf:id='city' type="text" jsf:value="${person.city}"/></th> </tr> <tr> <td><input type="submit" value="Submit" jsf:action="confirmation" /></td> </tr> </table> </form> </body> </html> confirmation.xhtml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Data Confirmation Page</title> </head> <body> <h1>#{person.name}</h1> from <h2>#{person.city}</h2> </body> </html> Person.java: package org.demo; import javax.enterprise.inject.Model; @Model public class Person { String name; String city; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } }

    Read the article

  • YouTube: 14 NetBeans Web Development Tips in 7 Minutes

    - by Geertjan
    Are you sure you're getting everything out of NetBeans IDE? Here, especially for HTML5 developers, i.e., you're using some kind of combination of HTML, JavaScript, and CSS, is a slightly-HTML focused series of tips for NetBeans usage. Several secrets included, i.e., features that don't have much UI and that are a question of needing to know that they're there, otherwise you'll never know about them. Direct link to the (silent) movie: https://www.youtube.com/watch?v=JaqAi3r0k1Y

    Read the article

  • New: Online NetBeans 8 Crash Course

    - by Geertjan
    On Twitter today I came across an announcement for a brand new on-line course in NetBeans 8. Since NetBeans 8 has been released during the past few months, the course is really very new. Go here to get there directly: https://www.video2brain.com/de/videotraining/netbeans-ide-8-0-crashkurs Here's the general idea. As you can see, the course is in German. With my basic understanding of German, I've had no problem in following the course. The trainer speaks clearly and slowly and everything is very well structured. The course covers all the basics of NetBeans IDE. From getting set up to using all the key features. The quality of the videos is great and the content is clear and informative. Once you've bought the course, all the lessons are unlocked. As you can see, they're all quite short and there's really a lot of content, didn't all fit into the screenshot: Quite some work must have gone into this. Here's one of the free lessons in the course, to give an idea of what you'll get: https://www.video2brain.com/de/tutorial/texte-internationalisieren This one is also free: https://www.video2brain.com/de/tutorial/eclipse-projekt-importieren I highly recommend this course especially if you're switching, or thinking about switching, from a different IDE and want to get a thorough overview of all the features that NetBeans IDE provides. Everything in the course is done within NetBeans, which means no slides, just code. You get to see the workflow of all the standard tasks and, for these purposes, the course does a really great job.

    Read the article

  • Squibbly: LibreOffice Integration Framework for the Java Desktop

    - by Geertjan
    Squibbly is a new framework for Java desktop applications that need to integrate with LibreOffice, or more generally, need office features as part of a Java desktop solution that could include, for example, JavaFX components. Here's what it looks like, right now, on Ubuntu 13.04: Why is the framework called Squibbly? Because I needed a unique-ish name, because "squibble" sounds a bit like "scribble" (which is what one does with text documents, etc), and because of the many absurd definitions in the Urban Dictionary for the apparently real word "squibble", e.g., "A name for someone who is squibblish in nature." And, another e.g., "A squibble is a small squabble. A squabble is a little skirmish." But the real reason is the first definition (and definitely not the fourth definition): "Taking a small portion of another persons something, such as a small hit off of a pipe, a bite of food, a sip of a drink, or drag of a cigarette." In other words, I took (or "squibbled") a small portion of LibreOffice, i.e., OfficeBean, and integrated it into a NetBeans Platform application. Now anyone can add new features to it, to do anything they need, such as create a legislative software system as Propylon has done with their own solution on the NetBeans Platform: For me, the starting point was Chuk Munn Lee's similar solution from some years ago. However, he uses reflection a lot in that solution, because he didn't want to bundle the related JARs with the application. I understand that benefit but I find it even more beneficial to not need to require the user to specify the location of the LibreOffice location, since all the necessary JARs and native libraries (currently 32-bit Linux only, by the way) are bundled with the application. Plus, hundreds of lines of reflection code, as in Chuk's solution, is not fun to work with at all. Switching between applications is done like this: It's a work in progress, a proof of concept only. Just the result of a few hours of work to get the basic integration to work. Several problems remain, some of them potentially unsolvable, starting with these, but others will be added here as I identify them: Window management problems. I'd like to let the user have multiple LibreOffice applications and documents open at the same time, each in a new TopComponent. However, I haven't figured out how to do that. Right now, each application is opened into the same TopComponent, replacing the currently open application. I don't know the OfficeBean API well enough, e.g., should a single OfficeBean be shared among multiple TopComponents or should each of them have their own instance of it? Focus problems. When putting the application behind other applications and then switching back to the application, typing text becomes impossible. When closing a TopComponent and reopening it, the content is lost completely. Somehow the loss of focus, and then the return of focus, disables something. No idea how to fix that. The project is checked into this location, which isn't public yet, so you can't access it yet. Once it's publicly available, it would be great to get some code contributions and tweaks, etc. https://java.net/projects/squibbly Here's the source structure, showing especially how the OfficeBean JARs and native libraries (currently for Linux 32-bit only) fit in: Ultimately, would be cool to integrate or share code with http://joeffice.com!

    Read the article

  • YouTube: Realtime Graph Sharing on the NetBeans Platform

    - by Geertjan
    Yet another really cool movie by the Maltego team in South Africa, this time showing Visual Library widgets in their NetBeans Platform application shared in realtime between different users of the Maltego open source intelligence gathering and analytics software: What you see above is Maltego CaseFile. Below you find out more about it in the latest blog entry on the Maltego site: http://maltego.blogspot.be/2013/11/maltego-casefile-v2-released.html

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >