Skip to content

Commit

Permalink
a6.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mararsh committed Apr 3, 2024
1 parent 9c0b777 commit 07fbd8e
Show file tree
Hide file tree
Showing 41 changed files with 693 additions and 802 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mara.mybox.controller.BaseData2DHandleController;
import mara.mybox.controller.BaseData2DTaskController;
import mara.mybox.data2d.Data2D;
import mara.mybox.db.data.ColumnDefinition.InvalidAs;
import mara.mybox.data2d.DataTable;
import mara.mybox.db.DerbyBase;
import mara.mybox.db.data.ColumnDefinition;
import mara.mybox.db.data.ColumnDefinition.InvalidAs;
import mara.mybox.db.data.Data2DColumn;
import mara.mybox.dev.MyBoxLog;
import mara.mybox.fxml.FxTask;
Expand All @@ -29,7 +29,7 @@ public class DescriptiveStatistic {
public int scale;
public InvalidAs invalidAs;

protected BaseData2DHandleController handleController;
protected BaseData2DTaskController taskController;
protected FxTask<Void> task;
protected Data2D data2D;
protected Map<StatisticType, List<String>> statisticRows;
Expand Down Expand Up @@ -147,7 +147,7 @@ public boolean prepare() {
public boolean prepareByColumns(String prefix, List<String> names) {
try {
if (names == null || names.isEmpty() || types.size() < 1) {
handleController.popError(message("SelectToHandle") + " " + prefix);
taskController.popError(message("SelectToHandle") + " " + prefix);
return false;
}
outputNames = new ArrayList<>();
Expand All @@ -173,7 +173,7 @@ public boolean prepareByColumns(String prefix, List<String> names) {

return true;
} catch (Exception e) {
handleController.popError(e.toString());
taskController.popError(e.toString());
MyBoxLog.error(e);
return false;
}
Expand All @@ -182,7 +182,7 @@ public boolean prepareByColumns(String prefix, List<String> names) {
public boolean prepareByRows() {
try {
if (types.size() < 1) {
handleController.popError(message("SelectToHandle"));
taskController.popError(message("SelectToHandle"));
return false;
}
outputNames = new ArrayList<>();
Expand All @@ -202,13 +202,13 @@ public boolean prepareByRows() {
}

if (outputNames.size() < 2) {
handleController.popError(message("SelectToHandle"));
taskController.popError(message("SelectToHandle"));
return false;
}

return true;
} catch (Exception e) {
handleController.popError(e.toString());
taskController.popError(e.toString());
MyBoxLog.error(e);
return false;
}
Expand Down Expand Up @@ -498,12 +498,12 @@ public DescriptiveStatistic setScale(int scale) {
return this;
}

public BaseData2DHandleController getHandleController() {
return handleController;
public BaseData2DTaskController getTaskController() {
return taskController;
}

public DescriptiveStatistic setHandleController(BaseData2DHandleController handleController) {
this.handleController = handleController;
public DescriptiveStatistic setTaskController(BaseData2DTaskController taskController) {
this.taskController = taskController;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @CreateDate 2022-1-19
* @License Apache License Version 2.0
*/
public abstract class BaseData2DChartController extends BaseData2DHandleController {
public abstract class BaseData2DChartController extends BaseData2DTaskController {

protected String selectedCategory, selectedValue, groupParameters;
protected DataTableGroup group;
Expand All @@ -51,9 +51,9 @@ public abstract class BaseData2DChartController extends BaseData2DHandleControll
protected ControlPlay playController;

@Override
public void initControls() {
public void initOptions() {
try {
super.initControls();
super.initOptions();

initDataTab();

Expand All @@ -67,7 +67,7 @@ public void initControls() {
noticeMemory();
});

displayAllCheck.visibleProperty().bind(allPagesRadio.selectedProperty());
displayAllCheck.visibleProperty().bind(sourceController.allPagesRadio.selectedProperty());
}

chartMaxData = UserConfig.getInt(baseName + "ChartMaxData", 100);
Expand Down Expand Up @@ -130,9 +130,9 @@ public void changed(ObservableValue ov, String oldValue, String newValue) {
}

@Override
public void refreshControls() {
public void sourceChanged() {
try {
super.refreshControls();
super.sourceChanged();
makeOptions();
} catch (Exception e) {
MyBoxLog.error(e);
Expand All @@ -141,7 +141,7 @@ public void refreshControls() {

public void makeOptions() {
try {
List<String> names = tableController.data2D.columnNames();
List<String> names = dataController.data2D.columnNames();
if (names == null || names.isEmpty()) {
return;
}
Expand Down Expand Up @@ -170,6 +170,7 @@ public void makeOptions() {
}
}

@Override
public boolean checkParameters() {
if (isSettingValues) {
return true;
Expand All @@ -188,9 +189,9 @@ public void noticeMemory() {
}

@Override
public boolean initData() {
public boolean checkOptions() {
try {
if (!super.initData()) {
if (!super.checkOptions()) {
return false;
}
if (categoryColumnSelector != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public abstract class BaseData2DChartHtmlController extends BaseData2DChartContr
protected ControlWebView webViewController;

@Override
public void initControls() {
public void initOptions() {
try {
super.initControls();
super.initOptions();

webViewController.setParent(this);

Expand Down Expand Up @@ -142,8 +142,8 @@ public boolean showRowNumber() {
}

@Override
public boolean initData() {
if (!super.initData()) {
public boolean checkOptions() {
if (!super.checkOptions()) {
return false;
}
categorysCol = -1;
Expand Down Expand Up @@ -278,7 +278,6 @@ public void pageLoaded() {
}

@FXML
@Override
public void dataAction() {
if (outputData == null || outputData.isEmpty()) {
popError(message("NoData"));
Expand All @@ -288,7 +287,6 @@ public void dataAction() {
}

@FXML
@Override
public void editAction() {
webViewController.editAction();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class BaseData2DRegressionController extends BaseData2DChartController {
protected ControlData2DView resultsController;

@Override
public void initControls() {
public void initOptions() {
try {
super.initControls();
super.initOptions();

alpha = UserConfig.getDouble(baseName + "Alpha", 0.05);
if (alpha >= 1 || alpha <= 0) {
Expand Down Expand Up @@ -104,13 +104,11 @@ public void showModelMenu(Event event) {
}

@FXML
@Override
public void dataAction() {
resultsController.dataAction();
}

@FXML
@Override
public void viewAction() {
resultsController.editAction();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ public void columnSelected() {
status
*/
public boolean checkSelections() {
return checkRowFilter() && checkedRows() && checkColumns();
return checkRowsFilter() && checkedRows() && checkColumns();
}

public List<List<String>> tableFiltered(boolean showRowNumber) {
return tableFiltered(checkedColsIndices, showRowNumber);
return rowsFiltered(checkedColsIndices, showRowNumber);
}

public List<List<String>> selectedData(FxTask task) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void sourceChanged(Data2D data) {
dataSizeLoaded = true;
data2D.setDataLoaded(true);
isSettingValues = false;
postLoadedTableData();
refreshControls();
notifyLoaded();
} catch (Exception e) {
Expand Down Expand Up @@ -206,7 +207,7 @@ public boolean hasData() {
/*
filter
*/
public boolean checkRowFilter() {
public boolean checkRowsFilter() {
if (filterController != null
&& !filterController.checkExpression(isAllPages())) {
String ferror = filterController.error;
Expand Down Expand Up @@ -250,11 +251,11 @@ public List<Integer> filteredRowsIndices() {
}

// If none selected then select all
public List<List<String>> tableFiltered(List<Integer> cols, boolean showRowNumber) {
return tableFiltered(selectedRowsIndices, cols, showRowNumber);
public List<List<String>> rowsFiltered(List<Integer> cols, boolean showRowNumber) {
return rowsFiltered(selectedRowsIndices, cols, showRowNumber);
}

public List<List<String>> tableFiltered(List<Integer> rows, List<Integer> cols,
public List<List<String>> rowsFiltered(List<Integer> rows, List<Integer> cols,
boolean showRowNumber) {
try {
if (rows == null || rows.isEmpty()
Expand Down Expand Up @@ -326,7 +327,7 @@ public List<List<String>> selectedData(FxTask task, List<Integer> cols, boolean
false, formatValues, ColumnDefinition.InvalidAs.Blank);
data = writer.getRows();
} else {
data = tableFiltered(cols, false);
data = rowsFiltered(cols, false);
}
data2D.stopTask();
return data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected boolean handle() {
checkedColsIndices, null, rowNumberCheck.isSelected(), null);
writer.setColumns(targetColumns)
.setHeaderNames(Data2DColumnTools.toNames(targetColumns))
.setWriteHeader(colNameCheck.isSelected());
.setWriteHeader(colNameCheck == null || colNameCheck.isSelected());
return handleAllData(this, writer);
}

Expand Down Expand Up @@ -337,7 +337,7 @@ protected boolean handle() {
} else {
writer.setColumns(outputColumns)
.setHeaderNames(Data2DColumnTools.toNames(outputColumns))
.setWriteHeader(colNameCheck.isSelected());
.setWriteHeader(colNameCheck == null || colNameCheck.isSelected());
writer.openWriter();
for (List<String> row : outputData) {
if (!isWorking()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,14 @@ public void sourceChanged() {
}
}

/*
data
*/
public boolean isAllPages() {
return sourceController.isAllPages();
}

public List<List<String>> rowsFiltered() {
return sourceController.rowsFiltered(checkedColsIndices, showRowNumber());
}

/*
options
*/
Expand Down Expand Up @@ -328,7 +329,7 @@ public boolean checkParameters() {
}
sourceController.formatValues
= formatValuesCheck != null && formatValuesCheck.isSelected();
return sourceController.checkRowFilter() && sourceController.checkedRows();
return sourceController.checkRowsFilter() && sourceController.checkedRows();
} catch (Exception e) {
MyBoxLog.error(e);
return false;
Expand Down Expand Up @@ -694,7 +695,7 @@ public List<List<String>> filteredData(List<Integer> colIndices, boolean needRow
if (isAllPages()) {
outputData = data2D.allRows(colIndices, needRowNumber);
} else {
outputData = sourceController.tableFiltered(colIndices, needRowNumber);
outputData = sourceController.rowsFiltered(colIndices, needRowNumber);
}
data2D.stopFilter();
if (outputData != null) {
Expand Down Expand Up @@ -801,7 +802,7 @@ public TmpTable tmpTable(String dname, List<Integer> colIndices, boolean needRow
}
tmpTable.setTask(data2DTask);
if (!isAllPages()) {
outputData = sourceController.tableFiltered(data2D.columnIndices(), needRowNumber);
outputData = sourceController.rowsFiltered(data2D.columnIndices(), needRowNumber);
if (outputData == null || outputData.isEmpty()) {
return null;
}
Expand Down
Loading

0 comments on commit 07fbd8e

Please sign in to comment.