Home > other >  Deployment headaches tableview not from FXML load (null)
Deployment headaches tableview not from FXML load (null)

Time:04-26


From hours later I tried to find errors, I don't know what is causing this problem, I'm using a controller class and a FXML, the problem is that in the initialization function tableview is null, don't know why, here's the controller:
Package controller. The popup;

The import controller. Controllerable;
The import elements. EditableTableCell;
The import java.net.URL;
Import the Java. Util. ResourceBundle;
The import deployment headaches. Event. An ActionEvent.
The import deployment headaches. Event. EventHandler;
The import deployment headaches. FXML. FXML;
The import deployment headaches. FXML. Initializable;
The import deployment headaches. Scene. Control. TableCell;
The import deployment headaches. Scene. Control. The TableColumn;
The import deployment headaches. Scene. Control. TableView;
The import deployment headaches. Scene. Control. TextField;
The import deployment headaches. Scene. Control. The cell. PropertyValueFactory;
The import deployment headaches. Stage. WindowEvent;
The import deployment headaches. Util. Callback;
The import model. CDUSettings;
The import model. Modelable;
The import model. Data. AnnouncementData;
The import model. Data. PopupData;
The import model. The popup. AnnouncmentsPopupModel;

Public class AnnouncementsPopupController implements Controllerable, Initializable
{
//& lt; Editor - a fold desc="FXML import stuff" defaultstate="collapsed" & gt;
@ FXML
Private TableView GuiAnnouncementsTable;
@ FXML//fx: id="guiAnnouncementAddColor
"Private TextField guiAnnouncementAddColor;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddDisplayedText
"Private TextField guiAnnouncementAddDisplayedText;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddDuration
"Private TextField guiAnnouncementAddDuration;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddFontEffect
"Private TextField guiAnnouncementAddFontEffect;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddFontSize
"Private TextField guiAnnouncementAddFontSize;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddId
"Private TextField guiAnnouncementAddId;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddType
"Private TextField guiAnnouncementAddType;//Value injected by FXMLLoader
@ FXML//fx: id="guiColorColumn
"Private TableColumn GuiAnnouncementColorColumn;//Value injected by FXMLLoader
@ FXML//fx: id="guiDisplayedTextColumn
"Private TableColumn GuiAnnouncementDisplayedTextColumn;//Value injected by FXMLLoader
@ FXML//fx: id="guiDurationColumn
"Private TableColumn GuiAnnouncementDurationColumn;//Value injected by FXMLLoader
@ FXML//fx: id="guiFontEffectColumn
"Private TableColumn GuiAnnouncementFontEffectColumn;//Value injected by FXMLLoader
@ FXML//fx: id="guiFontSizeColumn
"Private TableColumn GuiAnnouncementFontSizeColumn;//Value injected by FXMLLoader
@ FXML//fx: id="guiIdColumn
"Private TableColumn GuiAnnouncementIdColumn;//Value injected by FXMLLoader
@ FXML//fx: id="guiTypeColumn
"Private TableColumn GuiAnnouncementTypeColumn;//Value injected by FXMLLoader
//& lt;/editor - fold>

Private Modelable model=null;

Public AnnouncementsPopupController () {
ConnectToModel ();
}

@ Override
Public Modelable getModel () {
Return the model;
}

@ Override
Public void onCloseEvent (WindowEvent we)
{
CDUSettings. GetInstance (). ClearAnnouncements ();

For (PopupData announce: model. GetData ()) {
CDUSettings. GetInstance (). AddAnnouncement ((AnnouncementData) announce);
}
}

@ Override
Public void the initialize (URL URL, ResourceBundle rb)
{
ConnectToModel ();

Callback TableCell EditableFactory=
New Callback TableCell ()
{
@ Override
Public TableCell call (the TableColumn p) {
Return new EditableTableCell ();
}
};

GuiAnnouncementIdColumn. SetCellValueFactory (new PropertyValueFactory (" id "));
GuiAnnouncementIdColumn. SetCellFactory (editableFactory);
GuiAnnouncementIdColumn. SetOnEditCommit (new EventHandler ()
{
@ Override
Public void handle (the TableColumn. CellEditEvent T) {
(t.g etTableView (.) getItems () get (t.g etTablePosition () getRow ())). The setId (t.g etNewValue ());
}
});

GuiAnnouncementColorColumn. SetCellValueFactory (new PropertyValueFactory (" color "));
GuiAnnouncementColorColumn. SetCellFactory (editableFactory);
GuiAnnouncementColorColumn. SetOnEditCommit (new EventHandler
  • Related