How to create accessory views in Netbeans? - java

I am using the Netbeans platform for a little project. Have a few questions... How do you create docked accessory views? Are all views TopComponents that have individual docking properties? How do you create a view to the left of the TopComponents that shows a hierarchy of data in a tree control? I have looked at the Window manager and TopComponents but nothing googles for Accessory view. I would like to create a master-detail application... I would like to create views that are automagically docked for the master relationship and use Topcomponents/Scenes for the detail views. Any words on how to do this?
Bruce

I think you are asking about modes. TopComponents are docked into modes.
NetBeans platform by default provides few modes like explorer, etc. NetBeans platform also allows you to define your own modes so you can dock your TopComponents at different places.
To create new modes see official documentation provided in the Windows System API.
See here.

Related

How to implement repsonsive design in Eclipse RAP?

The Eclipse RAP (Remote Application Platform) project provides a way to write web applications using SWT.
Due to single sourcing, the written code can also be used in desktop SWT/RCP applications.
Since it is a framework for web applications I was wondering if it supports responsive design?
If so, a simple example would be great. It does not need to be RCP compatible.
I didn't find a lot on the internet, has there been any efforts towards supporting responsive design?
Due to the fact that RAP shields you from web technology, native CSS and other web-techniques won't work.
To summarize the comments, you will likely have to implement one or more custom layouts that adapt to the available space and show/hide/resize the managed controls accordingly.
You may also want to use custom controls or manipulate existing controls to adapt to the available space. in some places. For example, hide texts on toolbar buttons when space becomes rare.
RAP theming can also be leveraged to a certain extent in order to change the appearance and space of certain controls.
Further reading:
EclipseCon 2014 talk: https://www.eclipsecon.org/na2014/sites/default/files/slides/Responsive%20Applications%20Tutorial%20-%20EclipseCon%202014.pdf
A blog post with code examples about responsive UIs with SWT: http://www.codeaffine.com/2014/02/24/responsive-uis-with-eclipse-and-swt/
RAP Theming: https://eclipse.org/rap/developers-guide/devguide.php?topic=theming.html
Understanding SWT Layouts: https://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html (ignore the deprecation warning, the core concepts haven't changed since)
You can make it responsive with the use of Passe-Partout created by Tabris. This works in RAP and should be compatible with RCP.
They have made a custom layout : FluidGridLayout.
It's best you use it through the factory class com.eclipsesource.tabris.passepartout.PassePartout.
Source can be found on github:
https://github.com/eclipsesource/tabris/tree/master/com.eclipsesource.tabris.passepartout
Add this plugin to your dependency or just copy the source in your project.
See the blogpost at eclipsesource for basic info:
https://eclipsesource.com/products/tabris/eclipse-rap-documentation/responsive-design/
The great thing about it, is that you program it all in java.
Only issue that I now experience is with scrolling.
In my case I have a workbench and my editorpart needs a scrolledcomposite, only set to V_SCROLL. I've added two resize listeners to set the new minsize of the scrolledcomposite.
One resize listener on the display when the entire browser resizes.
A second resize listener for the parent when only the editorpart resizes. (fe when a view is resized or the editorpart is maximized)

Java FX Multiple Windows App

How are big applications (with lots of windows, lets say users administration, roles, payments, etc) designed. I'm a web developer and I'm used to develop different screens in different html files. I wanna know how to split windows generations in different files instead of having only one huge Application class.
Thanks in advance..
The question is a bit too broad to thoroughly answer, but I still think providing a partial answer here might be useful.
For an implementation of Banislav's strategy of hyperlinks controlling a swappable pane (which does not use FXML), see the related question: How to have menus in java desktop application.
For a small FXML based framework for switching panes see: Loading new fxml in the same scene with associated sample code. Note that sample is for small apps, for large apps a more rigorous framework would be preferred.
The next step up from the small framework listed above would be something like afterburner.fx, which is "a minimalistic (3 classes) JavaFX MVP framework". Even though small, afterburner.fx would probably suffice to be used as the core for a medium sized application. You can find a small sample application built using afterburner.fx named airhacks-control.
For something a bit more involved you can study the source of SceneBuilder and SceneBuilderKit. SceneBuilder is an open source design tool written in JavaFX. Understanding and adapting that code may be challenging for somebody coming from a web background as its implementation differs significantly from a traditional web application.
For very large applications, basing the application on a fully featured platform such as NetBeans RCP would probably be a preferred approach, though, as of this time, that is probably a large and difficult task to do well and likely requires mixing multiple frameworks rather than writing everything purely in JavaFX.
In JavaFX, you can use similar approach as in web development.
Use BorderPane as root pane.
Create main menu
You can use MenuBar with Menus and MenuItems. You can also use TreeView or ListView on like left side of screen. To position TreeView/ListView on left side you could use BorderPane and set it to left with setLeft.
Approach I prefer would be to use HyperLink control. Add multiple HyperLink's to VBox and again, set them on left side of BorderPane. Upon click, they will handle event which set's desired form on center of BorderPane.
I.e.

Creating a preferencs dialog for swing application

After years of working with shallow .properties files to hold preferences and settings of our application, we plan to create an MVC component for preferences dialog, backed up by some kind of model in file system or data base.
We aim to have something like eclipse (and many other IDE's and applications) has: a tree of application components on the left hand side of the dialog, each node in the list can have a matching preferences page with titles, sections, tabs and button groups.
We plan to make the GUI modular, and build according to xml files that define the GUI, and the relations between Swing controls to the matching properties.
So, before we begin inventing the wheel, I thought we could reuse some library that does exactly this.
I started investigating the eclipse source, but it's all SWT based, which I'm not sure how easy it is to integrate into our Swing based application.
So, does enyone know of a good java library to do the work for us?
One candidate is JIDE Dialogs. A variety of styles are supported.
You can start a demo from a browser here. In the tree on the left, select Jide Dialogs>Options Dialog Demo. Click one of the buttons that appear, to select a style.
In addition to providing the generic presentation layer for preferences, Eclipse's preferences framework also supports an optional persistence model, and a way to contribute preferences pages.

How to make dock-able plugins for NetBeans IDE in Java?

I have created one analogue clock with Java. But i want to make it dock-able in NetBeans IDE (like shown in the screen shot).
like the left side navigator, files, bottom tasks are hidden, once i press it it shows in left or bottom
Any help on this, how can i tell my NetBeans plugin to act like dock-able? After making it working i would like to publish it to the community plugin.
This is not too complicated using the NetBeans Rich Client Platform. Follow this tutorial - http://platform.netbeans.org/tutorials/nbm-paintapp.html#impMod
Basically, you'll create a ClockTopComponent using the wizard. TopComponents automatically get nice windowing features for free, like docking, hiding, tiling, etc.
FAQs about TopComponent

Netbeans Platform: Hide Tabs for just one TopComponent

netbeans platform has proved to be most useful for large applications. But what about small applications?
I'm building a small Price-List making software which only has one TopComponent which contains a JTable and a few buttons.
This component I've set to have closing/sliding etc disabled as this is mandatory to be there. I also DO NOT want to have ANY more top components.
Is there a way to remove the tabs? It seems pointles to show just one tab with the name of the TopComponent.
I hope you get what I mean!
Thanks in advance.
Molten Ice,
Geertjan Wielenga's blog is an invaluable source of information for the NetBeans Platform. He's written a post especially for this task:
http://blogs.oracle.com/geertjan/entry/farewell_to_space_consuming_weird
I've used this technique before and it works fine.
If you have any other questions related to the NetBeans Platform I would suggest that you try the Plaform Users section of the NetBeans forums.

Categories

Resources