Marklar
Zalozeni Projektu
- Prerequisities
- Prvni kroky
- Experiment
- Grafika
- Logika Experimentu
Struktura
- marklar-core
- marklar-fx-common
- marklar-driver-modbus
- marklar-pardWeight
- plastometer
- dilatometer
- lbm
- dokuwiki
GenericCell
je definovana v jadre a definuje tridu, ktera je pomoci tridy GenericCellUpdater extends ListCell<GenericCell>
vykreslovana do ListView
s jednotlivymi experimety. Pri jejim vytvareni je treba dodrzovat nektere direktivy
@FXML protected AnchorPane anchorPane;
definuje AnchorPane
, ktera by mela zaobalovat celou GenericCell
. GenericCell
je vzde treba vytvorit vlozenou do AnchorPane
, ktera MUSI MIT fx:id=“anchorPane”
.anchorPane
z predchoziho bodu musi mit nastavenou fixni height, tj. nastavit Pref height = xxx, Min height = USE_PREF_HEIGHT a Max height = USER_PREF_HEIGHT.fx:controller=“…”
. Misto toho se overriduje contructor a vola se v nem metoda setFXMLFile(String m_FXMLFile)
.fillGraphics()
je volana pri vkladani grafiky do ListView
. Je volana az po constructoru a mela by v sobe obsahovat defaultni plneni grafikysetBackgroundColor()
v zavislosti na ExperimentStatus
nastavuje barevne pozadi GenerciCell
public abstract class GenericCell implements Initializable { private String m_FXMLFile; protected ExperimentInstance expInst; @FXML protected AnchorPane anchorPane; public void setBackgroundColor() { if (expInst == null) { setBackgroundColor(Color.rgb(60,60,60)); } else { setBackgroundColor(ExperimentStatusHelper.toColor(expInst.getStatus())); } } public void setBackgroundColor(Color color) { if (anchorPane == null) return; int r = (int) (255 * color.getRed()); int g = (int) (255 * color.getGreen()); int b = (int) (255 * color.getBlue()); anchorPane.setStyle("-fx-background-color: rgba(" + r + "," + g + "," + b + ",0.3);"); } public GenericCell(ExperimentInstance expInst) { this.expInst = expInst; } public abstract void fillGraphics(); public void loadGraphics() { FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setResources(I18n.getGraphicsBundle()); fxmlLoader.setLocation(getClass().getResource(m_FXMLFile)); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException e) { throw new RuntimeException(e); } } public void setFXMLFile(String m_FXMLFile) { this.m_FXMLFile = m_FXMLFile; } + getters, setters, ... }