Moving textFile from one class to autofill a textarea in another - text

private void ManausActionPerformed(java.awt.event.ActionEvent evt) {
Cities cities=new Cities();
cities.setVisible(true);
this.dispose();
c.getSites("Manaus.txt");
c.getRestaraunt("Rio.txt");
cArray[0]=c;
// TODO add your handling code here:
}
So what i want to do is from my GUI on this button press these text files sent another Gui where its text fields will be Auto-Filled with the data and there will be other buttons and cites. its all in an object Array any help much appreciated.

Related

Preserve Selection when Scrolling GXT

I am using Sencha GXT Grid for a web app. But what I see is after scrolling the grid the selection is gone. I tried to preserve the selection by catching the scroll event and restoring the selected items (using setsecteditems() ). But was not successful also.
Is there a method to preserve the selection in sencha GXT grid.
Thanx
I have finally able to preserve the selection in Live grid view. I found two ways that I thought worth to share.It's kind of a hack :)
1. If you are receiving data from a server. You can maintain a boolean in server side data preserving the selection. and when you render rows in the client side you can add a style name to that row checking the boolean which is set previously.
the style name can be set using
grid.getView().setViewConfig(new GridViewConfig() {
#Override
public String getColStyle(Object model, ValueProvider<? super Data, ?> valueProvider, int rowIndex, int colIndex) {
return null;
}
#Override
public String getRowStyle(Objectmodel, int rowIndex) {
//Do the logic here and return the Style name
return null;
}
});
You can also maintain a list of keys in client side which contains the selected items. and use the previous method to add a style name if the row you are drawing is in the list.
Thanx :)

DialogTabPage object does not have method 'frameType'

This is related to my question posted here:
How to make dialog elments collapsible?
Another developer has added two groups to the dialog that is displayed when creating a payment proposal (CustVendPaymJournal_Vend Class) and the "Ok" and "Cancel" buttons are no longer displayed on smaller resolutions (1024x768).
To overcome this I am trying to group some dialog elements in DialogTabPage tabs. However I haven't had any success in my attempts.
This is what I have in the first couple lines of code in the dialog() method for CustVendCreatePaymJournal_Vend
public Object dialog()
{
LedgerJournalType ledgerJournalType;
DialogTabPage tab;
super();
tab = dialog.addTabPage("First tab");
}
I keep on receiving this error anywhere I try to add a tab in the dialog. I have tried to put it on CustVendPaymJournal (from which CustVendPaymJournal_Vend is inherited) also, but to no avail.
DialogTabPage object does not have method 'frameType'.
Try:
dialog = super();
tab = dialog.addTabPage("First tab");

LWUIT Form Text Area

I have a LWUIT form1 and form2 ,form1 is displayed with list of titles from Rss File,
1)If the user clicks on any title on fom1,i am able to navigate to form2 ,where i am displaying a text area(Contains Paragraphs of text( Description) from Rss),if suppose the user keep on reading the text and user reached at the end of a line(Cursor remains at the end)(scroll down) on form2. After that user clicks back button on form2,then user able to navigate to form1,
2)Again user clicks on any title on form1,then user should be able to see the text area(he should be able to read the description) from starting but not in the middle or end on form2(Because in Previous case user read all the description till end on form2.
My Problem is: Each time user clicks on any title on form1,i am able to navigate form2,but the cursor should always point to start of my text area(To allow the user start reading the description from statring)But my code is not working
How to reset form values each time it is displayed?
Here my Code:
private void displayCompleteNewsScreen(News detailNews) {
//log.debug("displayCompleteNewsScreen");
form2.removeAll();
form2.repaint();
form2.addCommand(m_backCommand);
form2.addCommandListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
form1.show();
}
});
Label pubDate = new Label(detailNews.getPubDate().substring(0, 16));
pubDate.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL));
form2.addComponent(pubDate);
textarea.setText(detailNews.getDescription());
form2.addComponent(textarea);
form2.show();
}
Try to set the focus to the TextArea everytime you show the Form. You can do that using textArea.requestFocus() after you show the Form.

JavaFX2.2 TableView:How to make a table cell be edited without mouse click?

I've encounter a problem with editable table cells. I'm using the TableView in my project just as the Tutorial on Oracle.
According to it, I use the setCellFactory method to reimplement the table cell as a text field with the help of the TextFieldTableCell class. However, I found the steps is a little complex to get to the point where the cell can be edited:
Let the table cell be selected by using direction key.
Press “Enter” to converts the cell to a text filed so that it is ready to be edited.
Clicking in the text field allows the contents to be edited
The problem is step 3, that you must use the mouse to click before you can input data in this table cell.
So, is there a solution to avoid step 3? That is the text field allows the data inputting when you just press “Enter”(step 2).
By the way, English is not my native language. Hope I have made myself clear.
The Node can be focused manually. The TextFieldTableCell is a TableCell that has a Node (Graphic) TextField which will be rendered when the cell is in editing mode. You need to focus to this textField manually but by using TextFieldTableCell you cannot access to the textField. However if you would prefer the alternative way described in the tutorial you are referring, then you have a chance to focus. The only changed method from that tutorial is:
#Override
public void startEdit() {
super.startEdit();
createTextField();
setText(null);
setGraphic(textField);
textField.selectAll();
// Set the focus
Platform.runLater(new Runnable() {
#Override
public void run() {
textField.requestFocus();
}
});
}
To start editing in a TableView without mouse-click event, invoke TreeView.edit(rowIndex, tableColumn);
For example:
//create tableview object
TableView<YourModel> tableView = new TableView<>();
//create column
TableColumn<YourModel, String> column = new TableColumn<>("Property Name");
//add column to tableview
tableView.getColumns().add(column);
//... your cell factory and the rest
//add an item
tableView.getItems().add(new YourModel());
//if you want to edit the selected item, get its index
int selectedIndex = tableView.getSelectionModel().getSelectedIndex();
//fire edit
tableView.edit(selectedIndex, column);

GXT: UiBinder new instance of a Widget

I have a TextField form inside a window. Created with UiBinding. Next to the TextField is a button. I wanted to know if it was possible to create a new TextField widget when that button was pressed using UiBinder?
This is what I have:
Window class:
#UiField
TextField text;
#UiField
HorizontalPanel hPanel;
....
#UiHandler("addText")
public void onClick(SelectEvent event){
hPanel.add(text);
}
My UiBinder file:
<gxt:Window ...(generic setup)...>
<g:VerticalPanel>
<gxt:FramedPanel>
<container:VericalLayoutContainer>
<container:child>
<g:HorizontalPanel ui:field="hPanel">
<form:FieldLabel text="Text">
<form:Widget>
<form:TextField ui:field="text"/>
</form:Widget>
</form:FieldLabel>
<button:TextButton ui:field="addText"/>
</g:HorizontalPanel>
</container:child>
</container:VericalLayoutContainer>
</gxt:FramedPanel>
</g:VerticalPanel>
</gxt:Window>
When I click the button it all it does is move the button from the right side of the text field to the left. I have more textfields in the window so I played around to see what it was really doing. It's taking that field and just moving it next to the button.
Is there a way I can create a new TextField underneath the original?
Probably LazyDomElement will help you.

Resources