/******************************************************************************* * Breakout Cave Survey Visualizer * * Copyright (C) 2014 James Edwards * * jedwards8 at fastmail dot fm * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *******************************************************************************/ package org.breakout; import static org.andork.bind.EqualsBinder.bindEquals; import static org.andork.func.CompoundBimapper.compose; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Insets; import java.awt.LinearGradientPaint; import java.nio.file.Path; import java.util.Properties; import javax.swing.AbstractButton; import javax.swing.DefaultBoundedRangeModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JSlider; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.andork.awt.AWTUtil; import org.andork.awt.ColorUtils; import org.andork.awt.GridBagWizard; import org.andork.awt.GridBagWizard.DefaultAutoInsets; import org.andork.awt.I18n; import org.andork.awt.I18n.Localizer; import org.andork.awt.layout.BetterCardLayout; import org.andork.awt.layout.Drawer; import org.andork.awt.layout.Side; import org.andork.bind.BimapperBinder; import org.andork.bind.Binder; import org.andork.bind.BinderWrapper; import org.andork.bind.QMapKeyedBinder; import org.andork.bind.QObjectAttributeBinder; import org.andork.bind.ui.BetterCardLayoutBinder; import org.andork.bind.ui.ButtonSelectedBinder; import org.andork.bind.ui.ComponentBackgroundBinder; import org.andork.bind.ui.ComponentTextBinder; import org.andork.bind.ui.ISelectorSelectionBinder; import org.andork.bind.ui.JSliderValueBinder; import org.andork.func.LinearFloatBimapper; import org.andork.func.PathStringBimapper; import org.andork.func.RoundingFloat2IntegerBimapper; import org.andork.plot.PlotAxisConversionBinder; import org.andork.q.QMap; import org.andork.q.QObject; import org.andork.swing.OnEDT; import org.andork.swing.PaintablePanel; import org.andork.swing.border.FillBorder; import org.andork.swing.border.GradientFillBorder; import org.andork.swing.border.InnerGradientBorder; import org.andork.swing.border.MultipleGradientFillBorder; import org.andork.swing.border.OverrideInsetsBorder; import org.andork.swing.selector.DefaultSelector; import org.breakout.model.ColorParam; import org.breakout.model.ProjectModel; import org.breakout.model.RootModel; import org.breakout.update.UpdateStatusPanel; import org.jdesktop.swingx.JXColorSelectionButton; import com.andork.plot.LinearAxisConversion; import com.andork.plot.PlotAxis; import com.andork.plot.PlotAxis.LabelPosition; import com.andork.plot.PlotAxis.Orientation; import com.andork.plot.PlotAxisController; @SuppressWarnings("serial") public class SettingsDrawer extends Drawer { /** * */ private static final long serialVersionUID = -1786035787435736379L; Localizer localizer; JLabel projectFileLabel; JTextField projectFileField; JButton projectFileMenuButton; ViewButtonsPanel viewButtonsPanel; JLabel mouseSensitivityLabel; JSlider mouseSensitivitySlider; JLabel mouseWheelSensitivityLabel; JSlider mouseWheelSensitivitySlider; JLabel bgColorLabel; JXColorSelectionButton bgColorButton; JLabel ambientLightLabel; JSlider ambientLightSlider; JLabel distColorationLabel; PlotAxis distColorationAxis; PaintablePanel distColorationAxisPanel; JLabel colorParamLabel; DefaultSelector<ColorParam> colorParamSelector; JPanel colorParamButtonsPanel; BetterCardLayout colorParamButtonsLayout; JButton fitParamColorationAxisButton; JButton flipParamColorationAxisButton; JPanel colorParamDetailsPanel; BetterCardLayout colorParamDetailsLayout; PlotAxis paramColorationAxis; PaintablePanel paramColorationAxisPanel; JPanel colorByDepthButtonsPanel; JButton inferDepthAxisTiltButton; JButton resetDepthAxisTiltButton; JButton cameraToDepthAxisTiltButton; JPanel colorByDistanceButtonsPanel; JButton recalcColorByDistanceButton; JLabel glowDistLabel; PlotAxis glowDistAxis; PaintablePanel glowDistAxisPanel; JButton resetViewButton; JButton fitViewToEverythingButton; JButton fitViewToSelectedButton; JButton orbitToPlanButton; JButton debugButton; JLabel numSamplesLabel; JSlider numSamplesSlider; JLabel versionLabel; JPanel mainPanel; JScrollPane mainPanelScrollPane; JLabel openSurveyScanCommandLabel; BinderWrapper<QObject<RootModel>> rootBinder = new BinderWrapper<QObject<RootModel>>(); Binder<Path> currentProjectFileBinder = QObjectAttributeBinder.bind( RootModel.currentProjectFile, rootBinder); Binder<Integer> desiredNumSamplesBinder = QObjectAttributeBinder.bind( RootModel.desiredNumSamples, rootBinder); Binder<Integer> mouseSensitivityBinder = QObjectAttributeBinder.bind( RootModel.mouseSensitivity, rootBinder); Binder<Integer> mouseWheelSensitivityBinder = QObjectAttributeBinder .bind( RootModel.mouseWheelSensitivity, rootBinder); BinderWrapper<QObject<ProjectModel>> projectBinder = new BinderWrapper<QObject<ProjectModel>>(); Binder<CameraView> cameraViewBinder = QObjectAttributeBinder.bind( ProjectModel.cameraView, projectBinder); Binder<Color> backgroundColorBinder = QObjectAttributeBinder.bind( ProjectModel.backgroundColor, projectBinder); Binder<LinearAxisConversion> distRangeBinder = QObjectAttributeBinder.bind( ProjectModel.distRange, projectBinder); Binder<ColorParam> colorParamBinder = QObjectAttributeBinder.bind( ProjectModel.colorParam, projectBinder); Binder<QMap<ColorParam, LinearAxisConversion, ?>> paramRangesBinder = QObjectAttributeBinder.bind( ProjectModel.paramRanges, projectBinder); Binder<LinearAxisConversion> paramRangeBinder = QMapKeyedBinder.bindKeyed( colorParamBinder, paramRangesBinder); Binder<LinearAxisConversion> highlightRangeBinder = QObjectAttributeBinder.bind( ProjectModel.highlightRange, projectBinder); Binder<Float> ambientLightBinder = QObjectAttributeBinder.bind( ProjectModel.ambientLight, projectBinder); UpdateStatusPanel updateStatusPanel; private String loadedVersion; public SettingsDrawer(final I18n i18n, Binder<QObject<RootModel>> rootBinder, Binder<QObject<ProjectModel>> projectBinder) { this.rootBinder.bind(rootBinder); this.projectBinder.bind(projectBinder); new OnEDT() { @Override public void run() throws Throwable { localizer = i18n.forClass(SettingsDrawer.this.getClass()); delegate().dockingSide(Side.RIGHT); setUnderpaintBorder(GradientFillBorder.from(Side.TOP).to(Side.BOTTOM).colors( ColorUtils.darkerColor(getBackground(), 0.05), ColorUtils.darkerColor(Color.LIGHT_GRAY, 0.05))); setBorder(new OverrideInsetsBorder( new InnerGradientBorder(new Insets(0, 5, 0, 0), Color.GRAY), new Insets(0, 8, 0, 0))); createComponents(i18n); createLayout(); createListeners(); createBindings(); org.andork.awt.AWTUtil.traverse(SettingsDrawer.this, comp -> { if (comp instanceof AbstractButton) { AbstractButton button = (AbstractButton) comp; button.setOpaque(false); } }); } }; } private void createBindings() { ComponentTextBinder.bind(projectFileField, BimapperBinder.bind(PathStringBimapper.instance, currentProjectFileBinder)); ComponentBackgroundBinder.bind(bgColorButton, backgroundColorBinder); ButtonSelectedBinder .bind(viewButtonsPanel.getPlanButton(), bindEquals(CameraView.PLAN, cameraViewBinder)); ButtonSelectedBinder.bind(viewButtonsPanel.getPerspectiveButton(), bindEquals(CameraView.PERSPECTIVE, cameraViewBinder)); ButtonSelectedBinder.bind(viewButtonsPanel.getNorthButton(), bindEquals(CameraView.NORTH_FACING_PROFILE, cameraViewBinder)); ButtonSelectedBinder.bind(viewButtonsPanel.getSouthButton(), bindEquals(CameraView.SOUTH_FACING_PROFILE, cameraViewBinder)); ButtonSelectedBinder.bind(viewButtonsPanel.getEastButton(), bindEquals(CameraView.EAST_FACING_PROFILE, cameraViewBinder)); ButtonSelectedBinder.bind(viewButtonsPanel.getWestButton(), bindEquals(CameraView.WEST_FACING_PROFILE, cameraViewBinder)); ButtonSelectedBinder.bind(viewButtonsPanel.getAutoProfileButton(), bindEquals(CameraView.AUTO_PROFILE, cameraViewBinder)); JSliderValueBinder.bind(mouseSensitivitySlider, mouseSensitivityBinder); JSliderValueBinder.bind(mouseWheelSensitivitySlider, mouseWheelSensitivityBinder); PlotAxisConversionBinder.bind(distColorationAxis, distRangeBinder); ISelectorSelectionBinder.bind(colorParamSelector, colorParamBinder); BetterCardLayoutBinder.bind(colorParamDetailsPanel, colorParamDetailsLayout, colorParamBinder); BetterCardLayoutBinder.bind(colorParamButtonsPanel, colorParamButtonsLayout, colorParamBinder); PlotAxisConversionBinder.bind(paramColorationAxis, paramRangeBinder); PlotAxisConversionBinder.bind(glowDistAxis, highlightRangeBinder); JSliderValueBinder.bind(ambientLightSlider, BimapperBinder.bind(compose(new LinearFloatBimapper(0f, 0f, 1f, ambientLightSlider.getMaximum()), RoundingFloat2IntegerBimapper.instance), ambientLightBinder)); JSliderValueBinder.bind(numSamplesSlider, desiredNumSamplesBinder); } private void createComponents(I18n i18n) { projectFileLabel = new JLabel(); projectFileLabel.setFont(projectFileLabel.getFont().deriveFont(Font.BOLD).deriveFont(14f)); localizer.setText(projectFileLabel, "projectFileLabel.text"); projectFileField = new JTextField(); projectFileField.setEditable(false); projectFileField.setPreferredSize(new Dimension(150, projectFileField.getPreferredSize().height)); ImageIcon dropdownIcon = new ImageIcon(getClass().getResource("dropdown.png")); projectFileMenuButton = new JButton(dropdownIcon); projectFileMenuButton.setMargin(new Insets(2, 4, 2, 4)); viewButtonsPanel = new ViewButtonsPanel(); Color darkColor = new Color(255 * 3 / 10, 255 * 3 / 10, 255 * 3 / 10); bgColorLabel = new JLabel(); localizer.setText(bgColorLabel, "bgColorLabel.text"); bgColorButton = new JXColorSelectionButton(); ambientLightLabel = new JLabel(); localizer.setText(ambientLightLabel, "ambientLightLabel.text"); ambientLightSlider = new JSlider(0, 100, 50); ambientLightSlider.setOpaque(false); distColorationLabel = new JLabel(); localizer.setText(distColorationLabel, "distColorationLabel.text"); distColorationAxis = new PlotAxis(Orientation.HORIZONTAL, LabelPosition.TOP); distColorationAxisPanel = PaintablePanel.wrap(distColorationAxis); distColorationAxisPanel.setUnderpaintBorder( MultipleGradientFillBorder.from(Side.LEFT).to(Side.RIGHT).linear( new float[] { 0f, 1f }, new Color[] { ColorUtils.alphaColor(darkColor, 0), darkColor })); distColorationAxis.getAxisConversion().set(0, 0, 10000, 200); distColorationAxis.setForeground(Color.WHITE); distColorationAxis.setMajorTickColor(Color.WHITE); distColorationAxis.setMinorTickColor(Color.WHITE); colorParamLabel = new JLabel(); localizer.setText(colorParamLabel, "colorParamLabel.text"); colorParamSelector = new DefaultSelector<ColorParam>(); colorParamSelector.setAvailableValues(ColorParam.values()); colorParamButtonsPanel = new JPanel(); colorParamButtonsPanel.setOpaque(false); fitParamColorationAxisButton = new JButton(new ImageIcon(getClass().getResource("fit.png"))); fitParamColorationAxisButton.setMargin(new Insets(2, 2, 2, 2)); localizer.setToolTipText(fitParamColorationAxisButton, "fitParamColorationAxisButton.tooltip"); flipParamColorationAxisButton = new JButton(new ImageIcon(getClass().getResource("flip.png"))); flipParamColorationAxisButton.setMargin(new Insets(2, 2, 2, 2)); localizer.setToolTipText(flipParamColorationAxisButton, "flipParamColorationAxisButton.tooltip"); colorParamDetailsPanel = new JPanel(); colorParamDetailsPanel.setOpaque(false); paramColorationAxis = new PlotAxis(Orientation.HORIZONTAL, LabelPosition.TOP); paramColorationAxisPanel = PaintablePanel.wrap(paramColorationAxis); paramColorationAxisPanel.setUnderpaintBorder( MultipleGradientFillBorder .from(Side.LEFT) .to(Side.RIGHT) .linear( new float[] { 0f, 0.24f, 0.64f, 1f }, new Color[] { new Color(255, 249, 204), new Color(255, 195, 0), new Color(214, 6, 127), new Color(34, 19, 150) })); paramColorationAxis.setForeground(Color.WHITE); paramColorationAxis.setMajorTickColor(Color.WHITE); paramColorationAxis.setMinorTickColor(Color.WHITE); colorByDepthButtonsPanel = new JPanel(); colorByDepthButtonsPanel.setOpaque(false); inferDepthAxisTiltButton = new JButton(new ImageIcon(getClass().getResource("tilted-depth-axis.png"))); inferDepthAxisTiltButton.setMargin(new Insets(2, 2, 2, 2)); localizer.setToolTipText(inferDepthAxisTiltButton, "inferDepthAxisTiltButton.tooltip"); resetDepthAxisTiltButton = new JButton(new ImageIcon(getClass().getResource("vertical-depth-axis.png"))); resetDepthAxisTiltButton.setMargin(new Insets(2, 2, 2, 2)); localizer.setToolTipText(resetDepthAxisTiltButton, "resetDepthAxisTiltButton.tooltip"); cameraToDepthAxisTiltButton = new JButton(new ImageIcon(getClass().getResource("forward-depth-axis.png"))); cameraToDepthAxisTiltButton.setMargin(new Insets(2, 2, 2, 2)); localizer.setToolTipText(cameraToDepthAxisTiltButton, "cameraToDepthAxisTiltButton.tooltip"); colorByDistanceButtonsPanel = new JPanel(); colorByDistanceButtonsPanel.setOpaque(false); recalcColorByDistanceButton = new JButton(new ImageIcon(getClass().getResource("refresh.png"))); recalcColorByDistanceButton.setMargin(new Insets(2, 2, 2, 2)); localizer.setToolTipText(recalcColorByDistanceButton, "recalcColorByDistanceButton.tooltip"); glowDistLabel = new JLabel(); localizer.setText(glowDistLabel, "glowDistLabel.text"); glowDistAxis = new PlotAxis(Orientation.HORIZONTAL, LabelPosition.TOP); glowDistAxisPanel = PaintablePanel.wrap(glowDistAxis); glowDistAxisPanel.setUnderpaintBorder( MultipleGradientFillBorder.from(Side.LEFT).to(Side.RIGHT).linear( new float[] { 0f, 1f }, new Color[] { Color.CYAN, ColorUtils.alphaColor(Color.CYAN, 0) })); glowDistAxis.setForeground(Color.BLACK); glowDistAxis.setMajorTickColor(Color.BLACK); glowDistAxis.setMinorTickColor(Color.BLACK); mouseSensitivityLabel = new JLabel(); localizer.setText(mouseSensitivityLabel, "mouseSensitivityLabel.text"); mouseSensitivitySlider = new JSlider(); mouseSensitivitySlider.setValue(20); mouseSensitivitySlider.setOpaque(false); mouseWheelSensitivityLabel = new JLabel(); localizer.setText(mouseWheelSensitivityLabel, "mouseWheelSensitivityLabel.text"); mouseWheelSensitivitySlider = new JSlider(1, 2000, 200); mouseWheelSensitivitySlider.setOpaque(false); resetViewButton = new JButton("Reset View"); fitViewToSelectedButton = new JButton("Fit View to Selected"); fitViewToEverythingButton = new JButton("Fit View to Everything"); orbitToPlanButton = new JButton("Orbit to Plan"); numSamplesLabel = new JLabel(); localizer.setText(numSamplesLabel, "numSamplesLabel.text.off"); numSamplesSlider = new JSlider(1, 1, 1); numSamplesSlider.setOpaque(false); numSamplesSlider.setEnabled(false); debugButton = new JButton("Debug"); mainPanel = new JPanel(); mainPanel.setBorder(new EmptyBorder(5, 0, 5, 5)); mainPanel.setOpaque(false); mainPanelScrollPane = new JScrollPane(mainPanel); mainPanelScrollPane.setBorder(null); mainPanelScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); mainPanelScrollPane.setOpaque(false); mainPanelScrollPane.getViewport().setOpaque(false); JScrollBar verticalScrollBar = mainPanelScrollPane.getVerticalScrollBar(); verticalScrollBar.setUnitIncrement(5); Dimension iconButtonSize = flipParamColorationAxisButton.getPreferredSize(); iconButtonSize.height = colorParamSelector.comboBox().getPreferredSize().height; fitParamColorationAxisButton.setPreferredSize(iconButtonSize); recalcColorByDistanceButton.setPreferredSize(iconButtonSize); inferDepthAxisTiltButton.setPreferredSize(iconButtonSize); resetDepthAxisTiltButton.setPreferredSize(iconButtonSize); versionLabel = new JLabel(); versionLabel.setHorizontalAlignment(SwingConstants.CENTER); Properties versionProperties = loadVersionProperties(); loadedVersion = versionProperties.getProperty("version", "unknown"); String buildDate = versionProperties.getProperty("build.date", "unknown"); localizer.setFormattedText(versionLabel, "versionLabel.text", loadedVersion, buildDate); updateStatusPanel = new UpdateStatusPanel(i18n); AWTUtil.traverse(updateStatusPanel, comp -> { comp.setBackground(null); if (comp instanceof JComponent) { ((JComponent) comp).setOpaque(false); } }); } private void createLayout() { GridBagWizard w = GridBagWizard.create(mainPanel); w.defaults().autoinsets(new DefaultAutoInsets(3, 3)); w.put(pinButton()).xy(0, 0).northwest(); w.put(projectFileLabel).rightOf(pinButton()).west(); GridBagWizard projectFilePanel = GridBagWizard.quickPanel(); projectFilePanel.defaults().filly(); projectFilePanel.put(projectFileField).xy(0, 0).fillx(1.0); projectFilePanel.put(projectFileMenuButton).rightOfLast(); w.put(projectFilePanel.getTarget()).below(pinButton(), projectFileLabel).fillx(); w.put(viewButtonsPanel).belowLast().addToInsets(10, 0, 0, 0); w.put(resetViewButton).belowLast().fillx(1.0); w.put(fitViewToSelectedButton).belowLast().fillx(1.0); w.put(fitViewToEverythingButton).belowLast().fillx(1.0); w.put(orbitToPlanButton).belowLast().fillx(1.0); w.put(mouseSensitivityLabel).belowLast().west().addToInsets(10, 0, 0, 0); w.put(mouseSensitivitySlider).belowLast().fillx().north(); w.put(mouseWheelSensitivityLabel).belowLast().west().addToInsets(0, 0, 0, 0); w.put(mouseWheelSensitivitySlider).belowLast().fillx().north(); GridBagWizard bgPanel = GridBagWizard.quickPanel(); bgPanel.put(bgColorLabel).xy(0, 0).west(); bgPanel.put(bgColorButton).rightOfLast().west().weightx(1.0); w.put(bgPanel.getTarget()).belowLast().fillx().addToInsets(10, 0, 0, 0); w.put(ambientLightLabel).belowLast().west(); w.put(ambientLightSlider).belowLast().fillx(); w.put(distColorationLabel).belowLast().west().addToInsets(10, 0, 0, 0); w.put(distColorationAxisPanel).belowLast().fillx(); GridBagWizard colorParamPanel = GridBagWizard.quickPanel(); colorParamPanel.put(colorParamLabel).xy(0, 0).filly().west(); colorParamPanel.put(colorParamSelector.comboBox()).rightOfLast().fillboth(1.0, 0.0) .addToInsets(0, 5, 0, 0); colorParamButtonsPanel.setLayout(colorParamButtonsLayout = new BetterCardLayout()); colorParamButtonsLayout.setSizeHidden(false); colorParamPanel.put(colorParamButtonsPanel).rightOfLast().filly(1.0); colorParamPanel.put(fitParamColorationAxisButton).rightOfLast().filly(); colorParamPanel.put(flipParamColorationAxisButton).rightOfLast().filly(); w.put(colorParamPanel.getTarget()).belowLast().fillx().addToInsets(10, 0, 0, 0); colorParamDetailsPanel.setLayout(colorParamDetailsLayout = new BetterCardLayout()); colorParamDetailsLayout.setSizeHidden(false); w.put(colorParamDetailsPanel).belowLast().fillx(); w.put(paramColorationAxisPanel).belowLast().fillx(); colorByDepthButtonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); colorByDepthButtonsPanel.add(inferDepthAxisTiltButton); colorByDepthButtonsPanel.add(resetDepthAxisTiltButton); colorByDepthButtonsPanel.add(cameraToDepthAxisTiltButton); colorParamButtonsPanel.add(colorByDepthButtonsPanel, ColorParam.DEPTH); colorByDistanceButtonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); colorByDistanceButtonsPanel.add(recalcColorByDistanceButton); colorParamButtonsPanel.add(colorByDistanceButtonsPanel, ColorParam.DISTANCE_ALONG_SHOTS); w.put(glowDistLabel).belowLast().west().addToInsets(10, 0, 0, 0); w.put(glowDistAxisPanel).belowLast().fillx(); w.put(numSamplesLabel).belowLast().west().addToInsets(10, 0, 0, 0); w.put(numSamplesSlider).belowLast().fillx(); w.put(versionLabel).belowLast().south().weighty(1.0).fillx(); w.put(updateStatusPanel).belowLast().south().fillx(); w.put(debugButton).belowLast().southwest(); debugButton.setVisible(false); setLayout(new BorderLayout()); add(mainPanelScrollPane, BorderLayout.CENTER); } private void createListeners() { new PlotAxisController(distColorationAxis).removeMouseWheelListener(); new PlotAxisController(paramColorationAxis).removeMouseWheelListener(); new PlotAxisController(glowDistAxis).removeMouseWheelListener(); numSamplesSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateNumSamplesLabel(); } }); } public JButton getCameraToDepthAxisTiltButton() { return cameraToDepthAxisTiltButton; } public PlotAxis getDistColorationAxis() { return distColorationAxis; } public AbstractButton getFitParamColorationAxisButton() { return fitParamColorationAxisButton; } public JButton getFitViewToEverythingButton() { return fitViewToEverythingButton; } public JButton getFitViewToSelectedButton() { return fitViewToSelectedButton; } public AbstractButton getFlipParamColorationAxisButton() { return flipParamColorationAxisButton; } public PlotAxis getGlowDistAxis() { return glowDistAxis; } public JButton getInferDepthAxisTiltButton() { return inferDepthAxisTiltButton; } public String getLoadedVersion() { return loadedVersion; } public JButton getOrbitToPlanButton() { return orbitToPlanButton; } public PlotAxis getParamColorationAxis() { return paramColorationAxis; } public LinearGradientPaint getParamColorationAxisPaint() { return (LinearGradientPaint) ((FillBorder) paramColorationAxisPanel.getUnderpaintBorder()) .getPaint(paramColorationAxisPanel, null, 0, 0, paramColorationAxisPanel.getWidth(), paramColorationAxisPanel.getHeight()); } public PaintablePanel getParamColorationAxisPanel() { return paramColorationAxisPanel; } public JButton getProjectFileMenuButton() { return projectFileMenuButton; } public AbstractButton getRecalcColorByDistanceButton() { return recalcColorByDistanceButton; } public JButton getResetDepthAxisTiltButton() { return resetDepthAxisTiltButton; } public JButton getResetViewButton() { return resetViewButton; } public UpdateStatusPanel getUpdateStatusPanel() { return updateStatusPanel; } public ViewButtonsPanel getViewButtonsPanel() { return viewButtonsPanel; } private Properties loadVersionProperties() { Properties props = new Properties(); try { props.load(getClass().getClassLoader().getResourceAsStream("version.properties")); } catch (Exception ex) { } return props; } public void setMaxNumSamples(int maxNumSamples) { if (maxNumSamples != numSamplesSlider.getMaximum()) { Integer value = rootBinder.get().get(RootModel.desiredNumSamples); if (value == null) { value = numSamplesSlider.getValue(); } value = Math.min(value, maxNumSamples); DefaultBoundedRangeModel newModel = new DefaultBoundedRangeModel(value, 0, 1, maxNumSamples); numSamplesSlider.setModel(newModel); numSamplesSlider.setEnabled(maxNumSamples > 1); updateNumSamplesLabel(); } } private void updateNumSamplesLabel() { localizer.unregister(numSamplesLabel); if (numSamplesSlider.getValue() < 2) { localizer.setText(numSamplesLabel, "numSamplesLabel.text.off"); } else { localizer.setFormattedText(numSamplesLabel, "numSamplesLabel.text.on", numSamplesSlider.getValue()); } } }