Grid nested in horizontal layout generated, but not displayed completely - spring

I am trying to put vertical layout next to grid within one horizontal layout.
public class SprinklerDetailUI extends VerticalLayout {
private final VerticalLayout nozzleDetailLayout;
private final TextField nozzleName;
private final TextArea nozzleDescription;
private final TextField fitForSprinkler;
private final Grid<FlowSetEntity> flowGrid;
private final HorizontalLayout nozzleFlowLayout;
private final Nozzle nozzle;
List<FlowSetEntity> flowSetEntities = Stream.of(new FlowSetEntity(10, 4),
new FlowSetEntity(10, 4),
new FlowSetEntity(23, 35),
new FlowSetEntity(534, 10),
new FlowSetEntity(654, 53))
.collect(Collectors.toList());
public SprinklerDetailUI() {
this.nozzleName = new TextField("Nozzle name");
this.nozzleDescription = new TextArea("Description");
this.fitForSprinkler = new TextField("Fit for sprinkler");
this.nozzleDetailLayout = new VerticalLayout(nozzleName, nozzleDescription, fitForSprinkler);
this.nozzle = new Nozzle();
nozzle.setFlowSet(flowSetEntities);
this.flowGrid = new Grid<>(FlowSetEntity.class);
flowGrid.setColumns("pressure", "flowRate");
flowGrid.setItems(nozzle.getFlowSet());
flowGrid.setSizeFull();
this.nozzleFlowLayout = new HorizontalLayout(nozzleDetailLayout, flowGrid);
nozzleFlowLayout.setSizeFull();
add(nozzleFlowLayout);
}
}
FlowSetEntity.class
#Entity
#Getter
#Setter
#NoArgsConstructor
public class FlowSetEntity implements Comparable<FlowSetEntity> {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private double pressureInAtm;
private double flowRateInLPM;
#Transient
private Quantity<Pressure> pressure;
#Transient
private Quantity<FlowRate> flowRate;
#ManyToOne(optional = false)
private Nozzle nozzle;
public FlowSetEntity(double pressureInAtm, double flowRateInLPM) {
this.pressureInAtm = pressureInAtm;
this.flowRateInLPM = flowRateInLPM;
this.pressure = toAtm(pressureInAtm);
this.flowRate = toLPM(flowRateInLPM);
}
#Override
public int compareTo(FlowSetEntity o) {
int pressureCompare = Double.compare(this.pressureInAtm, o.pressureInAtm);
int flowCompare = Double.compare(this.flowRateInLPM, o.flowRateInLPM);
return pressureCompare != 0 ? pressureCompare : flowCompare;
}
}
Generated page looks like this:
browser view
I seems that grid structure is generated correctly, but for some reason it is not displayed completely. When displaying same grid in vertical layout everything is fine.

Based on that UI code my guess is you're simply lacking a height on the outermost VerticalLayout. That means the height of the HorizontalLayout inside it, and the Grid inside that, is set to be 100% of nothing.
The form next to the Grid renders correctly because it doesn't define a height, and the containing HorizontalLayout gets an intrinsic height to accommodate that form, but the 100% on the Grid is still evaluated against the defined height which is missing, because css.

Related

JPA - How to copy and modify it's content of Page object?

I have this Meeting and Favorite models;
public class Meeting implements Serializable {
private long id;
private String meetingTitle;
private Date meetingStartDate;
private User host;
}
public class MeetingFavorite implements Serializable {
private long id;
private boolean active = false;
private Meeting meeting;
private Date updatedDate;
}
And I can successfully fetch MeetingFavorite page object like;
#GetMapping(value = "/favorite-meetings", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE)
public ResponseEntity searchFavoriteMeetings(
MeetingFavoriteSpecification search, HttpSession session) {
Page<MeetingFavorite> page = meetingsService.findFavoriteMeetings(search);
return ResponseEntity.ok(page);
}
Is it possible to get Meeting contents only from MeetingFavorite Page w/ it's pagination data?
I tried this and it returns Meeting objects. But pagination data is lost.
Page<MeetingFavorite> page = meetingsService.findFavoriteMeetings(search);
List<Meeting> meetings = new ArrayList<Meeting>();
page.forEach(entity -> meetings.add(entity.getMeeting()));
final Page<Meeting> meetingPage = new PageImpl<>(meetings);
return ResponseEntity.ok(meetingPage);
Oh, I found the way. Thanks.
List<Meeting> meetings = new ArrayList<Meeting>();
page.forEach(entity -> meetings.add(entity.getMeeting()));
Sort sort = new Sort(Sort.Direction.DESC, "updatedDate");
Pageable pageable = new PageRequest(search.getOffset() / search.getLimit(), search.getLimit(), sort);
final Page<Meeting> meetingPage = new PageImpl<Meeting>(meetings, pageable, page.getTotalElements());
return ResponseEntity.ok(meetingPage);

How can I add data to CRUD in Vaadin by using setItems for grid?

I'm going to add data to a CRUD component in Vaadin. It's an easy question here.
But the issue I got is that I cannot add data to the CRUD by first getting the grid object and then set its items to it.
Here is my Vaadin class. This class begins first to get data from a JPA Spring database. OK. That's works. And the data is transfered into a collection named crudData. Then the crudData is beings set to crud.getGrid().setItems(crudData); and that's not working. I assume that if I get the grid from the CRUD, then I can set the grid items as well too and then they will show up on the CRUD....but no...
#Data
public class StocksCrud {
private Crud<StockNames> crud;
private List<StockNames> crudData;
private StockNamesRepository stockNamesRepository;
private CrudEditor<StockNames> createStocksEditor() {
TextField stockName = new TextField("Name of the stock");
FormLayout form = new FormLayout(stockName);
Binder<StockNames> binder = new Binder<>(StockNames.class);
binder.bind(stockName, StockNames::getStockName, StockNames::setStockName);
return new BinderCrudEditor<>(binder, form);
}
public StocksCrud(StockNamesRepository stockNamesRepository) {
this.stockNamesRepository = stockNamesRepository;
// Fill the crud
crudData = new ArrayList<StockNames>();
for(StockNames stockName: stockNamesRepository.findAll()) {
crudData.add(new StockNames(stockName.getId(), stockName.getStockName()));
}
// Crate crud table
crud = new Crud<>(StockNames.class, createStocksEditor());
crud.getGrid().setItems(crudData); // This won't work
crud.addSaveListener(e -> saveStock(e.getItem()));
crud.addDeleteListener(e -> deleteStock(e.getItem()));
crud.getGrid().removeColumnByKey("id");
crud.addThemeVariants(CrudVariant.NO_BORDER);
}
private void deleteStock(StockNames stockNames) {
boolean exist = stockNamesRepository.existsBystockName(stockNames.getStockName());
if(exist == true) {
crudData.remove(stockNames);
stockNamesRepository.delete(stockNames);
}
}
private void saveStock(StockNames stockNames) {
System.out.println(stockNames == null);
System.out.println(stockNamesRepository == null);
boolean exist = stockNamesRepository.existsBystockName(stockNames.getStockName());
if(exist == false) {
crudData.add(stockNames);
stockNamesRepository.save(stockNames);
}
}
}
Here is my error output:
java.lang.ClassCastException: com.vaadin.flow.component.crud.CrudFilter cannot be cast to com.vaadin.flow.function.SerializablePredicate
I know that there is a way to set data to CRUD in Vaadin, by using a data provider class. But I don't want to use that. It's....to much code. I want to keep it clean and write less code in Java. Example here at the bottom: https://vaadin.com/components/vaadin-crud/java-examples
#Entity
#Data
#NoArgsConstructor
public class StockNames implements Cloneable{
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String stockName;
public StockNames(int id, String stockName) {
this.id = id;
this.stockName = stockName;
}
}
Update:
This is my code now
#Data
public class StocksCrud {
private Crud<StockNames> crud;
private List<StockNames> crudData;
private StockNamesRepository stockNamesRepository;
private CrudEditor<StockNames> createStocksEditor() {
TextField stockName = new TextField("Name of the stock");
FormLayout form = new FormLayout(stockName);
Binder<StockNames> binder = new Binder<>(StockNames.class);
binder.bind(stockName, StockNames::getStockName, StockNames::setStockName);
return new BinderCrudEditor<>(binder, form);
}
public StocksCrud(StockNamesRepository stockNamesRepository) {
this.stockNamesRepository = stockNamesRepository;
// Fill the crud
crudData = new ArrayList<StockNames>();
for(StockNames stockName: stockNamesRepository.findAll()) {
crudData.add(new StockNames(stockName.getId(), stockName.getStockName()));
}
// Create grid
Grid<StockNames> grid = new Grid<StockNames>();
grid.setItems(crudData);
// Crate crud table
crud = new Crud<>(StockNames.class, createStocksEditor());
crud.setGrid(grid);
crud.addSaveListener(e -> saveStock(e.getItem()));
crud.addDeleteListener(e -> deleteStock(e.getItem()));
//crud.getGrid().removeColumnByKey("id");
crud.addThemeVariants(CrudVariant.NO_BORDER);
}
private void deleteStock(StockNames stockNames) {
boolean exist = stockNamesRepository.existsBystockName(stockNames.getStockName());
if(exist == true) {
crudData.remove(stockNames);
stockNamesRepository.delete(stockNames);
}
}
private void saveStock(StockNames stockNames) {
System.out.println(stockNames == null);
System.out.println(stockNamesRepository == null);
boolean exist = stockNamesRepository.existsBystockName(stockNames.getStockName());
if(exist == false) {
crudData.add(stockNames);
stockNamesRepository.save(stockNames);
}
}
}
Update 2:
This gives an error.
// Create grid
Grid<StockNames> grid = new Grid<StockNames>();
StockNames s1 = new StockNames(1, "HELLO");
crudData.add(s1);
grid.setItems(crudData);
// Crate crud table
crud = new Crud<>(StockNames.class, createStocksEditor());
crud.setGrid(grid);
crud.addSaveListener(e -> saveStock(e.getItem()));
crud.addDeleteListener(e -> deleteStock(e.getItem()));
crud.getGrid().removeColumnByKey(grid.getColumns().get(0).getKey());
crud.addThemeVariants(CrudVariant.NO_BORDER);
The error is:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0'
What? I just added a object.
Assigning grid fixes the issue
Grid<StockNames> grid=new Grid<>(StockNames.class);
crud = new Crud<>(StockNames.class,grid, createStocksEditor());
In your code example you are relying on default implementation provided by Crud, thus CrudGrid is getting created. Its setDataProvider returns DataProvider<E,CrudFilter>, whereas Grid's DataProvider is of type: AbstractDataProvider<T, SerializablePredicate<T>> (This is because you are using ListDataProvider, which extends AbstractDataProvider<T, SerializablePredicate<T>>). This is what error states:
java.lang.ClassCastException: com.vaadin.flow.component.crud.CrudFilter cannot be cast to com.vaadin.flow.function.SerializablePredicate
So if you want to assign values via grid- you would first need to create one. Otherwise, as shown in the docs you could provide a custom dataprovider: PersonDataProvider
Update
This is an example code I am using. Adding a new item in Crud works, after I have added a no-args constructor to the bean:
import java.util.Random;
public class StockNames implements Cloneable{
Random rnd=new Random();
private int id;
private String stockName;
public StockNames(){
//You will an id generated automatically for you, but here is just an example
id=rnd.nextInt(12000);
}
public StockNames(int id, String stockName) {
this.id = id;
this.stockName = stockName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getStockName() {
return stockName;
}
public void setStockName(String stockName) {
this.stockName = stockName;
}
}
and the StockCrud class:
import com.vaadin.flow.component.crud.*;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.router.Route;
import java.util.ArrayList;
import java.util.List;
#Route("crudLayout")
public class StockCrud extends VerticalLayout {
private Crud<StockNames> crud;
private List<StockNames> crudData;
private CrudEditor<StockNames> createStocksEditor() {
TextField stockName = new TextField("Name of the stock");
FormLayout form = new FormLayout(stockName);
Binder<StockNames> binder = new Binder<>(StockNames.class);
binder.bind(stockName, StockNames::getStockName, StockNames::setStockName);
return new BinderCrudEditor<>(binder, form);
}
public StockCrud() {
// Fill the crud
crudData = new ArrayList<StockNames>();
for(int i=0;i<150;i++) {
crudData.add(new StockNames(i,"Name " + i));
}
// Crate crud table
Grid<StockNames> grid=new Grid<>(StockNames.class);
crud = new Crud<>(StockNames.class,grid, createStocksEditor());
//((CrudGrid )crud.getGrid()).setItems(crudData);
crud.getGrid().setItems(crudData); // This won't work
crud.addSaveListener(e -> saveStock(e.getItem()));
crud.addDeleteListener(e -> deleteStock(e.getItem()));
// crud.getGrid().removeColumnByKey("id");
crud.addThemeVariants(CrudVariant.NO_BORDER);
add(crud);
}
private void deleteStock(StockNames stockNames) {
// if(crudData.contains(stockNames)) {
crudData.remove(stockNames);
//}
}
private void saveStock(StockNames stockNames) {
System.out.println(stockNames == null);
if(!crudData.contains(stockNames)) {
crudData.add(stockNames);
}
}
}

wicket how to update a column value in a table when clicking on an ajaxlink of another column

I have a table, that has a column of links and another column of booleans, when I click on a link, the boolean of the other column should change to the opposite value, i.e., if its false to true and vice-versa.--> This is my goal.
This is a simplified description, the table has more columns that are not described here and I have a large number of classes.
In the main class, I add the table, and make the columns, as the excerpt below
Main.class
private void onInit(){
table=new BootstrapFallbackDefaultDataTable<PaymentArea,String>("payment-table", makeColumns(), paymentDetailsDataProvide, 10);
table.setOutputMarkupId(true);
add(table)
}
private List<IColumn<PaymentArea,String>> makeColumns(){
List<IColumn<PaymentArea,String>> columns = new ArrayList<>();
//some columns are added as PropertyColumn
//the next column is the one that have the ajaxLink
columns.add(new AbstractColumn<PaymentArea,String>(new StringResourceModel("payment-actions",this,null)){
#Override
public void populateItem(Item<ICellPopulator<PaymentArea>> item, String componentId, IModel<PaymentArea> rowmodel)
{
currentGoal = service.getPollById(rowmodel.getObject().getPaymentGUID()).getVoted();
invoiceId = rowmodel.getObject().getInvoiceGUID();
paymentId = rowmodel.getObject().getPaymentGUID();
item.add(new ContestButtonPayment2(componentId, currentGoal, invoiceId, paymentId));
});
//next column is the column that should be updated
columns.add(new AbstractColumn<PaymentArea, String>(new StringResourceModel("payment-contest",this,null)
{
#Override
public void populateItem(Item<ICellPopulator<PaymentArea>> item, String componentId, IModel<PaymentArea> rowmodel)
{
currentGoal = service.getPollById(rowmodel.getObject().getPaymentGUID()).getVoted();
item.add(new ConstestedColumn2(componentId, currentGoal));
}
});
return columns;
}
}
The next class is the class that defines the AjaxLink, for the column and for each row of the table.
ContestButtonPayment2.java
import java.util.List;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;
import nl.riskco.liberobc.client.business.services.IPollService;
import nl.riskco.liberobc.client.business.services.impl.PollServiceImpl;
import nl.riskco.liberobc.web.pages.details.invoices.main.LegendForButtons;
public class ContestButtonPayment2 extends Panel{
private static final long serialVersionUID = 1L;
private IPollService service;
private LegendForButtons text;
private Label label;
public ContestButtonPayment2(String componentId, List<String> currentGoal, String invoiceId, String paymentId){
super(componentId);
service = new PollServiceImpl();
initiateButton(currentGoal);
add(new AjaxLink("voteLink"){
private static final long serialVersionUID = 1L;
#Override
public void onClick(AjaxRequestTarget target) {
if(!currentGoal.contains("X"))
{
service.votePayment(paymentId,invoiceId);
text.setLegend("Revoke");
}//close if
else if(currentGoal.contains("X"))
{
System.out.println("payment: " + paymentId + " invoiceId: " + invoiceId);
service.revokePaymentVote(paymentId);
text.setLegend("Contest");
}
else{
System.out.println("Something went wrong");
}
//Update link
target.add(this);
}//close onclick
}.add(label));//close ajaxLink
}
public void initiateButton(List<String> currentGoal){
text = new LegendForButtons();
if(!currentGoal.contains("X"))
{
text.setLegend("Contest");
}
else
text.setLegend("Revoke");
label = new Label("buttonLabel", new PropertyModel(text,"legend"));
}
}
The class that needs to be updated
ConstestedColumn2.java
import java.util.List;
import org.apache.wicket.markup.html.panel.Panel;
import nl.riskco.Y.web.pages.utils.VoteBooleanLabelPanel;
public class ContestedColumn2 extends Panel{
private boolean resultX, resultY, resultZ;
private VoteBooleanLabelPanel labelX;
private VoteBooleanLabelPanel labelY;
private VoteBooleanLabelPanel labelZ;
private static final long serialVersionUID = 1L;
public ContestedColumn2(String id, List<String> currentGoal){
super(id);
resultX = currentGoal.contains("X");
labelX = new VoteBooleanLabelPanel("labelX", "X", resultX);
labelX.setOutputMarkupId(true);
add(labelX);
resultY = currentGoal.contains("Y");
labelY = new VoteBooleanLabelPanel("labelY", "Y", resultY);
labelY.setOutputMarkupId(true);
add(labelY);
resultZ= currentGoal.contains("Z");
labelZ = new VoteBooleanLabelPanel("labelZ", "Z", resultZ);
labelZ.setOutputMarkupId(true);
add(labelZ);
}
public ContestedColumn2(String id){
super(id);
}
}
VoteBooleanLabelPanel.java
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
public class VoteBooleanLabelPanel extends Panel{
private static final long serialVersionUID = 1L;
private Label label;
private boolean value;
public VoteBooleanLabelPanel(final String id, String text, boolean value) {
super(id);
String voteLabel = getCssClass(value);
label = new Label("icon", text);
label.add(new AttributeModifier("class",voteLabel));
add(label);
}
public VoteBooleanLabelPanel(final String id, String text){
super(id);
String voteLabel = getCssClass(value);
this.value = false;
label = new Label("icon", text);
label.add(new AttributeModifier("class",voteLabel));
add(label);
}
public void updateLabel(boolean value, AjaxRequestTarget target){
String voteLabel = getCssClass(value);
label.add(new AttributeModifier("class",voteLabel));
label.setOutputMarkupId(true);
target.add(label);
}
private String getCssClass(boolean value){
if(value)
return "label label-danger";
else
return "label label-default";
}
}
To understand better what is this last java class, below is its html
<wicket:panel>
<h4><span wicket:id="labelX"></span> <span wicket:id="labelY"></span> <span wicket:id="labelZ"></span></h4>
</wicket:panel>
Summary:
I would like when clicking on the link of row1 column2 to update the labelX values in the row1 column3 of the table.
labelX is represented on the table column (next to labelY and labelZ) as a X inside a grey square if its value is false and red if its value is true.
Does anyone knows how to this?
I think that I should use events, but I don't know how to it since I have so many classes.
The easiest and most clean way is to use Wicket events.
In onClick() broadcast an event with a payload, e.g.:
send(findParent(DataTable.class), Broadcast.BREADTH, new YourPayload(guid, target));
guid is getPaymentGUID() and target is the AjaxRequestTarget.
The event will be sent to the parent data table and from there it will be broadcasted to all its children.
In ConstestedColumn2.java you need to override onEvent(IEvent) and if the guid is the same then use the payload to update itself.
#Override public void onEvent(IEvent event) {
Object payload = event.getPayload();
if (payload instanceOf YourPayload) {
YourPayload yourPayload = (YourPayload) payload;
if (myGuid.equals(yourPayload.getGuid()) {
// some business logic
yourPayload.getTarget().add(this);
event.stop(); // no need to visit more children
}
}
}

Adding TreeView to a TableCeell in javafx

I need to add a TreeView to each cell in a particular column of a table.I am able to add Strings but I am not able to add TreeView. How can I do this?
This is my NodeInfo class
public class NodeInfo{
private TreeView<String> nodeTree;
private TreeItem<String> root;
private final Image rootIcon=new Image(getClass().getResourceAsStream("/images/nodes.gif"));
private final Image folderIcon=new Image(getClass().getResourceAsStream("/images/folder.gif"));
public void settreeView(String s)
{
nodeTree = new TreeView<>();
nodeTree.setEditable(true);
root = new TreeItem<>("Rootnode", new ImageView(rootIcon));
root.setExpanded(false);
nodeTree.setRoot(root);
for(int i=0;i<3; i++)
{
root.getChildren().add(new TreeItem<>(sharedFolders.get(i), new ImageView(folderIcon)));
}
}
public TreeView<String> gettreeView()
{
return nodeTree;
}
}
And this is controller class for UI
public class GrapevineController implements Initializable {
#FXML
private TableView<NodeInfo> tableView;
#FXML
private TableColumn<NodeInfo, TreeView<String>> nodeTree;
#FXML
private TableColumn<NodeInfo, String> name;
#FXML
private TableColumn<NodeInfo, String> favourite;
#FXML
private TableColumn<NodeInfo, String> updates;
#FXML
public static ObservableList<NodeInfo> sourceTree = FXCollections.observableArrayList();
#Override
public void initialize(URL url, ResourceBundle r){
tableView.setEditable(true);
nodeTree.setCellValueFactory(new PropertyValueFactory<NodeInfo, TreeView<String>> ("treeView"));
name.setCellValueFactory(new PropertyValueFactory<NodeInfo, String>("MacAddress"));
favourite.setCellValueFactory(new PropertyValueFactory<NodeInfo, String>("favourites"));
updates.setCellValueFactory(new PropertyValueFactory<NodeInfo, String>("update"));
tableView.setItems(sourceTree);
}

vaadin table must sort entries in chronological order descending i.e. latest at the top then down to the earliest notes

I have a vaadin table which is displaying Notes, with created date time. I want to sort entries in chronological order descending (i.e. latest at the top then down to the earliest notes) by default. When I added a new value it should be in top. This is a Java EE web application which is using Vaadin.
I tried ...
setSortContainerPropertyId(NoteContainer.DATE_CREATED);
setSortAscending(false);
sort();
inside my NoteTable constructor. But it only added the sorting functionality to DATE_CREATED column. when I clicked the that column header only it starts to sort. Please give me a proper solution...?
Note Table class constructor..
public NoteTable()
{
dataSource = new NoteContainer();
setContainerDataSource(dataSource);
NoteTableColumnGenerator columnGenerator = new NoteTableColumnGenerator();
addGeneratedColumn(ACTION, columnGenerator);
addGeneratedColumn(CREATED_BY, columnGenerator);
addGeneratedColumn(TEXT, columnGenerator);
setVisibleColumns(NoteContainer.NATURAL_COL_ORDER);
setSizeFull();
Object[] columns = getVisibleColumns();
for (int i = 0; i < columns.length; i++)
{
if (((String) columns[i]).equals(NoteContainer.DATE_CREATED))
setColumnWidth(columns[i], 150);
else if (((String) columns[i]).equals(NoteContainer.CREATED_BY))
setColumnWidth(columns[i], 150);
else if (((String) columns[i]).equals(NoteContainer.ACTION))
setColumnWidth(columns[i], 150);
else
setColumnWidth(columns[i], 550);
}
setColumnHeaders(NoteContainer.COL_HEADERS_ENGLISH);
setSelectable(true);
setImmediate(true);
setSortContainerPropertyId(NoteContainer.DATE_CREATED);
setSortAscending(false);
sort();
}
Note Container class
public class NoteContainer extends BeanItemContainer<CaseNote> implements Serializable
{
private static final long serialVersionUID = -5926608449530066014L;
public static final String DATE_CREATED = "dateCreated";
public static final String CREATED_BY = "createdBy";
public static final String TEXT = "text";
public static final String ACTION = "Action";
public static final Object[] NATURAL_COL_ORDER = new Object[] {
ACTION, DATE_CREATED, CREATED_BY, TEXT
};
public static final String[] COL_HEADERS_ENGLISH = new String[] {
"ACTION", "Date Created/Updated", "Created/Updated By", "Note"
};
/**
* Default Constructor.
*
*/
public NoteContainer()
{
super(CaseNote.class);
}
}
Note : CaseNote is an Entity Class.
I resolved it by my self..
I added sort(); inside the table refresh() method instead of NoteTable constructor.
Now it is working fine. thank you everyone, who tried to help me.. :)

Resources