use of de.unijena.cheminf.mortar.gui.views.IDataTableView in project MORTAR by FelixBaensch.
the class GuiUtil method setImageStructureHeight.
//
/**
* Sets the height for structure images to each MoleculeDataModel object of the items list of the tableView.
* If image height is too small it will be set to GuiDefinitions.GUI_STRUCTURE_IMAGE_MIN_HEIGHT (50.0)
*
* @param aTableView TableView
* @param aHeight double
* @param aSettingsContainer SettingsContainer
*/
public static void setImageStructureHeight(TableView aTableView, double aHeight, SettingsContainer aSettingsContainer) {
double tmpHeight = (aHeight - GuiDefinitions.GUI_TABLE_VIEW_HEADER_HEIGHT - GuiDefinitions.GUI_PAGINATION_CONTROL_PANEL_HEIGHT) / aSettingsContainer.getRowsPerPageSetting();
if (aTableView.getClass().equals(ItemizationDataTableView.class)) {
tmpHeight = (aHeight - 2 * GuiDefinitions.GUI_TABLE_VIEW_HEADER_HEIGHT - GuiDefinitions.GUI_PAGINATION_CONTROL_PANEL_HEIGHT) / aSettingsContainer.getRowsPerPageSetting();
}
if (tmpHeight < GuiDefinitions.GUI_STRUCTURE_IMAGE_MIN_HEIGHT) {
tmpHeight = GuiDefinitions.GUI_STRUCTURE_IMAGE_MIN_HEIGHT;
}
if (aTableView.getClass().equals(ItemizationDataTableView.class)) {
for (MoleculeDataModel tmpMoleculeDataModel : ((IDataTableView) aTableView).getItemsList()) {
tmpMoleculeDataModel.setStructureImageHeight(tmpHeight);
String tmpFragmentationName = ((ItemizationDataTableView) aTableView).getFragmentationName();
if (!tmpMoleculeDataModel.hasMoleculeUndergoneSpecificFragmentation(tmpFragmentationName)) {
continue;
}
for (FragmentDataModel tmpFragmentDataModel : tmpMoleculeDataModel.getFragmentsOfSpecificAlgorithm(tmpFragmentationName)) {
tmpFragmentDataModel.setStructureImageHeight(tmpHeight);
}
}
} else {
for (MoleculeDataModel tmpMoleculeDataModel : ((IDataTableView) aTableView).getItemsList()) {
tmpMoleculeDataModel.setStructureImageHeight(tmpHeight);
}
}
}
use of de.unijena.cheminf.mortar.gui.views.IDataTableView in project MORTAR by FelixBaensch.
the class MainViewController method openGlobalSettingsView.
//
/**
* Opens settings view for global settings
*/
private void openGlobalSettingsView() {
SettingsViewController tmpSettingsViewController = new SettingsViewController(this.primaryStage, this.settingsContainer);
Platform.runLater(() -> {
if (tmpSettingsViewController.hasRowsPerPageChanged()) {
for (Tab tmpTab : this.mainTabPane.getTabs()) {
TableView tmpTableView = ((GridTabForTableView) tmpTab).getTableView();
int tmpListSize = 0;
tmpListSize = ((IDataTableView) tmpTableView).getItemsList().size();
int tmpPageIndex = ((GridTabForTableView) tmpTab).getPagination().getCurrentPageIndex();
int tmpRowsPerPage = this.settingsContainer.getRowsPerPageSetting();
int tmpPageCount = tmpListSize / tmpRowsPerPage;
if (tmpListSize % tmpRowsPerPage > 0) {
tmpPageCount++;
}
if (tmpPageIndex > tmpPageCount) {
tmpPageIndex = tmpPageCount;
}
((GridTabForTableView) tmpTab).getPagination().setPageCount(tmpPageCount);
((GridTabForTableView) tmpTab).getPagination().setCurrentPageIndex(tmpPageIndex);
((GridTabForTableView) tmpTab).getTableView().refresh();
GuiUtil.setImageStructureHeight(((GridTabForTableView) tmpTab).getTableView(), ((GridTabForTableView) tmpTab).getTableView().getHeight(), this.settingsContainer);
((GridTabForTableView) tmpTab).getTableView().refresh();
}
}
if (tmpSettingsViewController.hasKeepAtomContainerInDataModelChanged()) {
for (MoleculeDataModel tmpMoleculeDataModel : this.moleculeDataModelList) {
tmpMoleculeDataModel.setKeepAtomContainer(this.settingsContainer.getKeepAtomContainerInDataModelSetting());
}
for (ObservableList<FragmentDataModel> tmpFragmentDataModelList : this.mapOfFragmentDataModelLists.values()) {
for (FragmentDataModel tmpFragmentDataModel : tmpFragmentDataModelList) {
tmpFragmentDataModel.setKeepAtomContainer(this.settingsContainer.getKeepAtomContainerInDataModelSetting());
}
}
}
});
}
Aggregations