Skip to content

Instantly share code, notes, and snippets.

@Groostav
Created January 19, 2017 22:11
Show Gist options
  • Save Groostav/c05bf2ce3e12677533c32fa7c1d2116a to your computer and use it in GitHub Desktop.
Save Groostav/c05bf2ce3e12677533c32fa7c1d2116a to your computer and use it in GitHub Desktop.
copy paste madness
package com.empowerops.doe;
import com.empowerops.jargon.model.Evaluable;
import com.empowerops.jargon.model.ExpensivePoint;
import com.empowerops.jargon.model.VariableSymbol;
import com.empowerops.linqalike.common.Tuple;
import javafx.scene.control.Button;
import javafx.scene.control.ListCell;
import javafx.scene.control.TextField;
/**
* Created by [somebody] on 12/23/2016.
*/
public class ListCellFactories {
public static ListCell<VariableSymbol> createVariableSymbolCell() {
return new ListCell<VariableSymbol>() {
@Override protected void updateItem(VariableSymbol item, boolean empty) {
super.updateItem(item, empty);
String text = null;
if (isEmpty()) {
//do nothing, leave default
}
else {
text = item.toString();
}
this.setText(text);
}
};
}
public static ListCell<DOEAlgorithm> getDOEAlgCell() {
return new ListCell<DOEAlgorithm>() {
@Override protected void updateItem(DOEAlgorithm item, boolean empty) {
super.updateItem(item, empty);
String text = null;
if (isEmpty()) {
//do nothing, leave default
}
else {
text = item.getName();
}
this.setText(text);
}
};
}
public static ListCell<ExpensivePoint> createExpensivePointCell() {
return new ListCell<ExpensivePoint>() {
@Override protected void updateItem(ExpensivePoint item, boolean empty) {
super.updateItem(item, empty);
String text = null;
if (isEmpty()) {
//do nothing, leave default
}
else {
text = item.toString();
}
this.setText(text);
}
};
}
public static ListCell<Evaluable> createEvaluableCell() {
return new ListCell<Evaluable>() {
@Override protected void updateItem(Evaluable item, boolean empty) {
super.updateItem(item, empty);
String text = null;
if (isEmpty()) {
//do nothing, leave default
}
else {
text = item.getResultSymbol().getCanonicalName();
}
this.setText(text);
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment