Skip to content
Snippets Groups Projects
Commit a910521e authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #141 - better prefilled value for export charts dialog

parent 7ba3dbd5
No related branches found
No related tags found
1 merge request!142merge v1_3_0 into master
......@@ -319,4 +319,16 @@ public class CategoriesChart extends VBox implements ChartExportable
return root.snapshot(sp, null);
}
@Override
public double getSuggestedWidth()
{
return getWidth() + 50;
}
@Override
public double getSuggestedHeight()
{
return getHeight() + 50;
}
}
\ No newline at end of file
......@@ -9,4 +9,8 @@ public interface ChartExportable
double getWidth();
double getHeight();
double getSuggestedWidth();
double getSuggestedHeight();
}
......@@ -8,6 +8,7 @@ import de.deadlocker8.budgetmaster.logic.utils.Helpers;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.SnapshotParameters;
import javafx.scene.control.Label;
......@@ -278,4 +279,35 @@ public class MonthBarChart extends VBox implements ChartExportable
return root.snapshot(sp, null);
}
@Override
public double getSuggestedWidth()
{
if(this.getChildren().size() < 2)
{
return 0;
}
Node currentNode = this.getChildren().get(0);
if(!(currentNode instanceof ScrollPane))
{
return 0;
}
ScrollPane scrollPane = (ScrollPane)currentNode;
Node content = scrollPane.getContent();
if(content == null)
{
return 0;
}
return ((Region)content).getWidth();
}
@Override
public double getSuggestedHeight()
{
return getHeight() + 50;
}
}
\ No newline at end of file
......@@ -169,4 +169,16 @@ public class MonthLineChart extends VBox implements ChartExportable
return root.snapshot(sp, null);
}
@Override
public double getSuggestedWidth()
{
return getWidth() + 50;
}
@Override
public double getSuggestedHeight()
{
return getHeight() + 50;
}
}
\ No newline at end of file
......@@ -54,8 +54,8 @@ public class ExportChartController
labelSavePath.setText(savePath.getAbsolutePath());
}
textFieldWidth.setText(String.valueOf((int)chart.getWidth()));
textFieldHeight.setText(String.valueOf((int)chart.getHeight()));
textFieldWidth.setText(String.valueOf((int)chart.getSuggestedWidth()));
textFieldHeight.setText(String.valueOf((int)chart.getSuggestedHeight()));
anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment