use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceExpression method cellForIndex.
@Override
public TableCell cellForIndex(GuiTable table, int index) {
if (index == 0) {
expressionCell = new TableCellString("expression", e.getExpression());
expressionCell.setTooltip(expressionTooltip);
expressionCell.setEnabled(canEdit());
expressionCell.setShowsValidityState(true);
expressionCell.setValidityState(getValidityState(e, u));
expressionCell.addListener(val -> {
e.setExpression(val);
expressionCell.setValidityState(getValidityState(e, u));
});
expressionCell.setChangeListener(() -> {
if (parsed != null)
parsed.setDisplayString(parsedString());
});
return new TitledCell(title, expressionCell).withTitleTooltip(tooltip);
} else if (index == 1) {
parsed = new TableCellTitle("parsedExpression", parsedString());
parsed.setPositioning(TableCellTitle.Positioning.TOP);
return new TitledCell(parsed);
}
return null;
}
use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class RCGuiTables method defaultWeightElement.
public static TitledCell defaultWeightElement(Consumer<Float> consumer, Float value, String title, @Nullable List<String> tooltip) {
TableCellFloatNullable cell = new TableCellFloatNullable("value", value, 1.0f, 0, 1000, IvTranslations.get("reccomplex.gui.random.weight.default.short"), IvTranslations.get("reccomplex.gui.random.weight.custom.short"));
cell.setScale(Scales.pow(5));
cell.addListener(consumer);
return new TitledCell(title, cell).withTitleTooltip(tooltip);
}
use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceMazeRuleConnectAll method cellForIndexInSegment.
@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
if (segment == 0) {
TableCellBoolean preventCell = new TableCellBoolean("prevent", rule.preventConnection, TextFormatting.GOLD + IvTranslations.get("reccomplex.mazerule.connect.prevent"), TextFormatting.GREEN + IvTranslations.get("reccomplex.mazerule.connect.prevent"));
preventCell.addListener(val -> rule.preventConnection = val);
return new TitledCell(preventCell);
} else if (segment == 2) {
TableCellBoolean cell = new TableCellBoolean("additive", rule.additive, TextFormatting.GREEN + IvTranslations.get("reccomplex.mazerule.connectall.additive"), TextFormatting.GOLD + IvTranslations.get("reccomplex.mazerule.connectall.subtractive"));
cell.addListener(val -> {
rule.additive = val;
tableDelegate.reloadData();
});
return new TitledCell(cell);
} else if (segment == 4) {
return new TitledCell(new TableCellTitle("", IvTranslations.get("reccomplex.mazerule.connectall.preview")));
} else if (segment == 5) {
ConnectorFactory factory = new ConnectorFactory();
Set<Connector> blockedConnections = Collections.singleton(factory.get(ConnectorStrategy.DEFAULT_WALL));
List<SavedMazePath> exitPaths = MazeRuleConnectAll.getPaths(rule.exits, expected, blockedConnections, factory).collect(Collectors.toList());
return new TitledCell(new TableCellTitle("", exitPaths.get(index).toString()));
}
return super.cellForIndexInSegment(table, index, segment);
}
use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceMazeRuleConnect method cellForIndexInSegment.
@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
if (segment == 0) {
TableCellBoolean preventCell = new TableCellBoolean("prevent", rule.preventConnection, TextFormatting.GOLD + IvTranslations.get("reccomplex.mazerule.connect.prevent"), TextFormatting.GREEN + IvTranslations.get("reccomplex.mazerule.connect.ensure"));
preventCell.addListener(val -> rule.preventConnection = val);
return new TitledCell(preventCell);
}
return super.cellForIndexInSegment(table, index, segment);
}
use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceConnector method cellForIndex.
@Override
public TableCell cellForIndex(GuiTable table, int index) {
TableCellString cell = new TableCellString("connectorID", connector.id);
cell.addListener(val -> connector.id = val);
return new TitledCell(title, cell).withTitleTooltip(IvTranslations.formatLines("reccomplex.maze.connector.tooltip"));
}
Aggregations