I have created a JavaFX application, I have built native bundle using Ant, and I am obfuscating jar with Proguard-4.8.
I am able to create native bundle exe using that obfuscated jar successfully. When I run it, it launching the application successfully, All things are working fine, but there ia one problem in TableView. That is data are present in TableView, but I am not able to see data in TableView.
Below the screen shot taken from exe for TableView is attached -
Is there any extra settings or code changes needed in class which are mapped to Tableview for data association, at the time of obfuscating.
I am getting my own way
I use the long form of PropertyValueFactory :
col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Test, String>,
ObservableValue<String>>() {
public ObservableValue<String> call(TableColumn.CellDataFeatures<Test, String> t) {
// t.getValue() returns the Test instance for a particular TableView row
return t.getValue().testProperty();
// or
return new SimpleStringProperty(t.getValue().getMessage());
}
});
if you use "PropertyValueFactory " for the table, you should keep the Your_Object class from obfuscation. If you do not do that, the PropertyValueFactory cannot search the Your_Object after obfuscation because this object is obfuscated.
Please find the specification of the PropertyValueFactory class from Oracle at:
PropertyValueFactory specification
Imaging you have already buildup so many tables in different packages then you need to change all.
No I suggest using this in you proguard_config will help
-keepclassmembers public class yourpackage1.**, yourpackage2.** ,yourpackage3.**{
public javafx.beans.property.StringProperty *Property();
}
Related
I am developing an Eclipse RPC application and I have an editor (MainEditor) that contains two pages. The first page (Properties) displays the data of the model using some text fields and the second page (Source) is an editor that is instantiated from a class (SourceCodeEditor) that inherits the CompilationUnitEditor class and displays the source code that contains some annotations and some code.The annotations' values should correspond to the data in the model (the data is stored in variables in the model) .The new class (SourceCodeEditor) does nothing special it only override two super functions and executes the super implementation like so :
#Override
public void doSave(IProgressMonitor progressMonitor) {
super.doSave(progressMonitor);
}
#Override
public void doSaveAs() {
super.doSaveAs();
}
So I would like to add a listener to the instance of the SourceCodeEditor variable that updates the values of the annotations to correspond to the data in the model every time this editor/page is opened. The reason for that is that when I change a text field in the "Properties" page and open the "Source" page without saving the text displays the values before the change not after. If there is a better way to bind the values of the annotations in the source code and the variables of the model,please let me know.
I am trying to create a plugin to generate some java code and write back to the main source module. I was able to create a some simple pojo class using JavaPoet and write to the src/main/java.
To make this useful, it should read the code from src/maim/java folder and analyze the classes using reflection. Look for some annotation then generate some codes. Do I use the SourceTask for this case. Looked like I can only access the classes by the files. Is that possible to read the java classes as the class and using reflection analyze the class?
Since you specified what you want to do:
You'll need to implement an annotation processor. This has absolutely nothing to do with gradle, and a gradle plugin is actually the wrong way to go about this. Please look into Java Annotation Processor and come back with more questions if any come up.
With JavaForger you can read input classes and generate sourcecode based on that. It also provides an API to insert it into existing classes or create new classes based on the input file. In contrast to JavaPoet, JavaForger has a clear separation between code to be generated and settings on where and how to insert it. An example of a template for a pojo can look like this:
public class ${class.name}Data {
<#list fields as field>
private ${field.type} ${field.name};
</#list>
<#list fields as field>
public ${field.type} ${field.getter}() {
return ${field.name};
}
public void ${field.setter}(${field.type} ${field.name}) {
this.${field.name} = ${field.name};
}
</#list>
}
The example below uses a template called "myTemplate.javat" and adds some extra settings like creating the file if it does not exist and changing the path where the file will be created from */path/* to */pathToDto/*. The the path to the input class is given to read the class name and fields and more.
JavaForgerConfiguration config = JavaForgerConfiguration.builder()
.withTemplate("myTemplate.javat")
.withCreateFileIfNotExists(true)
.withMergeClassProvider(ClassProvider.fromInputClass(s -> s.replace("path", "pathToPojo")))
.build();
JavaForger.execute(config, "MyProject/path/inputFile.java");
If you are looking for a framework that allows changing the code more programatticaly you can also look at JavaParser. With this framework you can construct an abstract syntax tree from a java class and make changes to it.
I joined a GWT application project a few weeks ago. The codebase was started back in 2009. I am trying to replace a FlexTable with a CellTable so that I can take advantage of the sortable columns. The current version of GWT in the project is 2.7.0, but looking through the code, it looks like there are some features still used that have gone out of style. I am new to GWT, I could be wrong.
So far, things are functionally good. However, GWT seems to be overriding my attempts to update the CSS. I used the GWT dynatablerf sample as a model to add CSS to the CellTable. The TimeSlotWidget uses CellTable.Style:
interface TableResources extends CellTable.Resources {
#Override
#Source(value = {CellTable.Style.DEFAULT_CSS, "CellTablePatch.css"})
CellTable.Style cellTableStyle();
}
And then applies it to the CellTable like this:
table = new CellTable<TimeSlotListWidget.ScheduleRow>(ROWS_IN_A_DAY,
GWT.<TableResources> create(TableResources.class));
I tried to use this approach in my code. I even omitted the CellTable.Style.DEFAULT_CSS from the value list and created my own CSS stylesheet which started as a copy of the GWT CellTable.css
I noticed that GWT TimeSlotListWidget sample has an ui.xml file with UIBinder. My project does not currently use UIBinder.
When I run my code, there is a <style> block inserted into the page that seems to be the standard GWT CellTable.css. Then directly after that, another <style> block is inserted with my CSS. And my CSS is not overriding the standard GWT CSS.
How can I keep the GWT CellTable.css from being inserted? Why is it being inserted?
The problem is that in your code, you reuse CellTable.Style, and two different ClientBundles have used the same type but each bound their own CSS to it.
Instead, extend the CellTable.Style interface, and use that in your bundle:
interface MyCellTableStyle extends CellTable.Style {}
interface TableResources extends CellTable.Resources {
#Override
#Source(value = {CellTable.Style.DEFAULT_CSS, "CellTablePatch.css"})
MyCellTableStyle cellTableStyle();
}
I am creating a application using Netbeans Appication development.
i have created a API and a lookup that checks for all the implementation and displays them to a Jlist placed inside a TopComponent.
public interface DemoAPI {
public String getType();
public String getName();
}
used
Lookup.Result<DemoAPI> DemoResult;
DemoResult=Lookup.getDefault().lookupResult(DemoAPI.class);
public void resultChanged(LookupEvent ev) {
for (DemoAPI demo : DemoResult.allInstances()) {
//Added the demo to Jlist using demo.getName() as display Name
}
}
for getting all the implementation of DemoAPI and Displaying in ListBox.
How can i Display the properties (Type and Name) in the propertySheetView for the corresponding selected Jlist Value.
To achieve this you most certainly need to use Nodes combined with an ExplorerManager and a corresponding view, replacing your JList.
This tutorial explains the basics of nodes and using them with an ExplorerManager and all kind of different views. In your created nodes you would override the getSheed()-Method and create your PropertySheet there.
The Netbeans Developer FAQ is a nice place which descripes a lot of the usual tasks when developing an application. Nodes and Explorer should tell you a lot about Nodes, ExplorerManagers and the several Views. Properties and PropertySheets has some nice extra info regarding PropertySheets.
This is my first post here, recently i have been working with JSF2.0 with primefaces. we have this requirement to export PDF in our application. initially we used primefaces default dataexporter tag. but the format was simply terrible. so, i used itext to generate PDF. we have like upto 15 datatables in our app, and all of them require PDF exporting. i have created a method called generatePDF which creates the PDF using Itext for all the tables.
Interface PDFI {
public void setColNames();
public void setColValues();
public void setContentHeader();
}
Class DataEx {
public void generatePDF(ActionEvent event) {
// generate pdf...
}
}
consider i have a Datatable A in the view
Datatable A ...
bean behind this datatable..
Class BeanA implements PDFI {
//implemented methods
}
}
Class BeanB implements PDFI {
//implemented methods
}
and behind another datatable B, i do the same thing as above ..
so, my question here is, is this considered duplicate code ?? and also, is this the efficient way to do this.
any help is appreciated.
thanks ina dvance
Rule of thumb that I use before re-factoring duplicate code- when part of the code in one place have a bug- are you need to change the other one to? cause you probably will forget
in your case, it's look like you have duplicate code block. I'll consider add the require parameters to generatePDF so it'll do all work in one place.