Griffon View Script Generated from NetBeans Not Showing - netbeans

I developed a UI in NetBeans that I want to use in my Griffon application. I chose to do so because I don't have enough time to figure out how to get the screen laid out correctly using SwingBuilder. According to the book Griffon in Action, I basically just need to place the .java file created in NetBeans under the appropriate package in the src directory of my Griffon project and run the griffon generate-view-script command with the fully qualified class name of the .java class (it took me a while to figure out how to do that). It then generates a .groovy file in the views directory that contains some code wrapping the .java class to make it work with SwingBuilder. When I try to run this as-is, nothing comes up. There are no exceptions being thrown, but nothing shows up either.

As it turns out, the .java class contains a Main() method in which the visible property of the class (it is a subclass of JFrame) is set to true. The Main() method does not get called by SwingBuilder, so the visible property was never being set to true. To correct this, I just had to add visible: true to the parameters to the generated widget node like below.
widget(new package.path.MyClass(), id: 'MyClass', visible: true)
Once I did that, it came up just fine.

Related

Intellij Main Class Always Changing

my question today is if there is a way for IntelliJ to build with the current class file I have Instead of always going into the configurations setting and changing the Main class from there.
Picture :
Ok I now understand want you want :)
I hope this image helps.
You can create a run configuration for each class with a main method. In this example we have three classes Main1, Main2 and Main3 which you can see on the left in the image. So I created three run configurations called Main1, Main2 and Main3 which have the corresponding classes set as Main class.
You can add multiple run configurations by clicking on the green plus.
In the toolbar you then can choose the run configuration which you want to run.
EDIT:
You can just make a right click on the main method and choose the option run. I guess that is what you want :)
You can probably go in and change the default to default to that class

Unknown class in Interface Builder file

Why am I still getting this error when I run my iPhone app? The file is a ViewController that I have been working to delete and replace, but it just won't die. As far as I know, I don't have any reference (string or otherwise) to this file in my project.
I have deleted the related file (I'm trying to get rid of it.)
I have cleaned the project and rebuilt.
I have "Reset Content and Settings" in my simulator.
I have done a grep (grep -i -r "TheClassName" *) and nothing matches except my UserInterfaceState.xcuserstate file.
I have searched the code using XCode's Find/Replace tab.
I have double checked my Build Phases and am pretty sure it isn't in there (its a large project).
Any other ideas? I've spent way too many hours trying to figure this simple thing out; I must be missing something.
Thanks!
Check your nibs or storyboard, and make sure none of your views are set to the class!
I finally fixed the problem after trying it on multiple machines over the course of almost 2 days! I will not be thwarted!
I tracked the problem down to a call to setViewControllers on a UINavigationController which is called on initialization of the application. I was always being passed 3 objects (there are 3 panes in the navigation controller). Even though I had deleted the third object, as previously explained, three objects would always be passed in. The class type of the first two was correct, but the third would just be a UIViewController. Curiously, this view controller had a nibName which corresponded to the object file and Xib file that I had previously deleted. Of course, when view was called on this borked UIViewController, it would crash since the corresponding nib had obviously been deleted. Remember, the textual name of this object or Xib could not be found in my directory with grep, so I have absolutely no idea how in the world it came into existence when I ran my app.
So, I figured the app may not have been cleaned properly. I double and triple checked this. I even validated that my Workspace settings were correct (File->Project Settings->Advanced). The app was indeed being recompiled fresh every time.
Secondly, I started thinking that perhaps the object was being set by some other means. Working backwards, I added some breakpoints and found out that initWithCoder was being called on the parent UINavigationController--this was eventually working down to call the setViewControllers on the object and assigning the three view controllers (one of which was the offending one). I could easily see from the call stack that the Nib file that was being loaded was deserializing something offensive.
So, I started digging into my Xib file. Of course, the object name wasn't in the file (as expected since the grep didn't find anything). I deleted and recreated the portion of the Xib that included my root UINavigationController. This ended up changing the Object ID and ref within the Xib file.
Secondly, I created a new Xib and UIViewController with the same names as the one which I had previously deleted, hoping that Xcode might be happy if I created and then re-deleted them. I then compiled, re-deleted them, updated by Xib file yet again, reverified with grep that yes, indeed, nothing existed with that name.
And it worked. After spending multiple days on this issues, I'm fairly sure that there is a bug here in the interface builder, but do I want to revisit this problem to file a bug report? Absolutely not...
In my case, I solved an issue by name of Custom class name of View instead of Custom class of ViewController. By mistake i added like this for view as shown below.
It Should be for ViewController like this.
This is in my case, for you may be it's related with another component.
This happens when the view class is in a framework. Select the framework's module. Example with a CocoaPod: HSegmentControl.
Make sure when you add or rename or move files around especially in folders, that when you add them you:
A. Create Groups, not references they don't usually read in.
B. Check the boxes for the apporpriate "Product(s) or Target(s)" you want to add the source to.
Another thing to try :
I had to toggle "Inherit from Target" under the "Module" control of "Custom Class."

JavaFX Scenebuilder does not see ids when FXML is in a different package than controller

i installed netbeans with java se7, and javafx samples are running fine. In scenebuilder, i can select an ID for each control defined and annotated with #FXML in my controller. however, i like my project organised. when i create a new package, and move my FXML file there, (myapp/views) and the controller stays in the root where it was -> myapp, then in scenebuilder does not seem to find the id.
I know about the 'controller class' in the FXML, but since i didn't move my controller, that should not be changed.
More specific, when both my controller and fxml are in the package 'holidayapp', it works. moving the fxml to a subpackage holidayapp/views', doesn't work. The controller class remains
<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="holidayapp.HolidayViewController">
as the HolidayViewController remains in the root package. I do nothing else but moving the fxml file from the main package into a subpackage.
I would like to see the id's from the holidayViewController in my scenebuilder. Compoling and running with the fxml in a subpackage, was never any problem.
Thanks
I think you might be suffering from the following issue:
https://bugs.openjdk.java.net/browse/JDK-8091793
If you think you do, please consider to vote for and/or comment on this issue.
The way I worked with this was placing my Main class into the view (the one that extends Application). This gave me access to my Controller classes, their variables, and methods. This works for SceneBuilder 1.1.
I can only speak for when using Eclipse and not NetBeans so doing this may still result in nothing.

XCode wont let me use a Static Library View in my xib files

I created a new project of type Static Linked Library.
I have moved the code (previously working in the app) to the library leaving all the xib files in the app.
I have changed the export directory and added the library file from the derived data folder so it gets the compiled version and links to it.
I have added the library to the bundle and have verified it is in the app using iPhone Explorer
I have verified that the xib file recognized the new view type by removing and selecting the custom view type in the custom class field of the identity inspector.
I have changed all of the #import commands to reflect the <> VS "" change and have gotten the app to compile.
however none of the methods of my custom class can be executed. and an NSLog reports that the class is its base counterpart as opposed to the custom derived class.
I am at a loss and have spend a long time converting all the code I have to work in a library. I am hoping someone can help with this.
On this issue, it turns out that Objective C's compiler does not load the categories and custom classes in the libraries by default. There are 2 ways to overcome this.
And here are your options.
Create an Activation type method on the category that will be called to "Activate" that Class or Category. This will need to be done before the application loads any nib files. And seems like a bit of a pain in the butt. This was however how I originally overcame this issue.
Add linker flags that will tell objective C to load all libraries and attach any and all Categories and Classes within the libraries before executing the application. (this will need to be done, on top of #import(ing) the correct files from their correct locations. I will provide a graphic below. and provide the flags for search purposes
-ObjC is the first one I added, but -all_load really did the trick.
I hope that others can benefit from this experience.

Change display name of unit tests in JUnit Eclipse plugin

Is it possible for an Eclipse plugin to change the display name of unit tests run by the default Eclipse JUnit plugin?
Some background: I'm trying to create a plugin which will display unit test names (in the JUnit view in Eclipse) a bit different from the actual method name. If the actual test method name is "anEmptyCollectionHasSizeZero" I want it to be displayed in the Eclipse JUnit view as "An empty collection has size zero".
I've managed to display the test method names in the way described above as a separate view in a plugin, but would as I said like to get this feature integrated in the normal JUnit view. I tried to see if I could find a related extension point, but could not find anything. Is it possible to do this?
Also, is there a plugin which already does this, or similar?
I don't know the exact answer, but the best place to start is likely by looking at the code for org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart (in the plug-in org.eclipse.jdt.junit). That ViewPart is the JUnit view that you see in Eclipse.
It looks like org.eclipse.jdt.internal.junit.model.TestCaseElement.getTestMethodName() might be the place where the name is obtained from. Maybe you can trace how/when those elements are created and inject some other name. It looks like the implementation class is internal though (org.eclipse.jdt.internal.junit.model.TestElement), so you might be out of luck.
I'd suggest asking on the JDT forums about the possibility of doing this.
There don't seem to be any plugable way to change the label or the colors used.
(I had hoped the label provider used for the TestViewer was based on a PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator() so the image, label and color could be decorated, but that does not seem to be the case...)
You may want to look at the jnario sources. They have implemented something like that, where the JUnit window displays something that is surely not a stack frame.
You may use the setName() method of the class junit.framework.TestCase (or the constructor with the name parameter).
public MyTestCase() {
super("This is my JUnit test");
By default a TestCase defines the methods to be executed by it's name, which we have just overwritten. To make it runnable we have to overwrite the run method like this.
#Override
protected void runTest() throws Throwable {
testMyTest();
}