From: <pen...@pe...> - 2009-06-09 19:31:55
|
Author: wseyler Date: 2009-06-09 14:31:39 -0500 (Tue, 09 Jun 2009) New Revision: 9047 Added: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/actions/global/ShowElementAlignmentHintsAction.java Modified: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/Translations.properties tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/editor/report/AbstractRenderComponent.java tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/settings/WorkspaceSettings.java tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/xul/designer-frame.xul Log: PRD-1405: Implemented a separate setting that allows turning on/off of "element alignment hints". Modified: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/Translations.properties =================================================================== --- tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/Translations.properties 2009-06-09 17:54:32 UTC (rev 9046) +++ tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/Translations.properties 2009-06-09 19:31:39 UTC (rev 9047) @@ -1528,6 +1528,10 @@ ReportPane.Processing=Processing... GeneralSettingsPanel.Launcher=Show Launcher on startup +ShowElementAlignmentHintsToggleCommand.Text=Element Alignment Hints +ShowElementAlignmentHintsToggleCommand.Description=Shows/Hides Element Alignment Hint Lines +ShowElementAlignmentHintsToggleCommand.Accelerator= + SnapToElementsToggleCommand.Text=Snap to Elements SnapToElementsToggleCommand.Description=Snap to Elements SnapToElementsToggleCommand.Accelerator= Added: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/actions/global/ShowElementAlignmentHintsAction.java =================================================================== --- tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/actions/global/ShowElementAlignmentHintsAction.java (rev 0) +++ tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/actions/global/ShowElementAlignmentHintsAction.java 2009-06-09 19:31:39 UTC (rev 9047) @@ -0,0 +1,56 @@ +package org.pentaho.reporting.designer.core.actions.global; + +import java.awt.event.ActionEvent; +import javax.swing.Action; + +import org.pentaho.reporting.designer.core.actions.AbstractDesignerContextAction; +import org.pentaho.reporting.designer.core.actions.ToggleStateAction; +import org.pentaho.reporting.designer.core.settings.SettingsListener; +import org.pentaho.reporting.designer.core.settings.WorkspaceSettings; +import org.pentaho.reporting.designer.core.util.KeyStrokeUtil; +import org.pentaho.reporting.designer.core.util.TranslationManager; + +/** + * Todo: Document Me + * + * @author Thomas Morgner + */ +public final class ShowElementAlignmentHintsAction extends AbstractDesignerContextAction + implements ToggleStateAction, SettingsListener +{ + private boolean state; + + public ShowElementAlignmentHintsAction() + { + putValue(Action.NAME, TranslationManager.getCoreInstance().getTranslation("ShowElementAlignmentHintsToggleCommand.Text")); + putValue(Action.SHORT_DESCRIPTION, TranslationManager.getCoreInstance().getTranslation( + "ShowElementAlignmentHintsToggleCommand.Description")); + putValue(Action.MNEMONIC_KEY, TranslationManager.getCoreInstance().getMnemonic("ShowElementAlignmentHintsToggleCommand.Text")); + putValue(Action.ACCELERATOR_KEY, KeyStrokeUtil.getKeyStroke(TranslationManager.getCoreInstance().getTranslation( + "ShowElementAlignmentHintsToggleCommand.Accelerator"))); + state = WorkspaceSettings.getInstance().isSnapToElements(); + + WorkspaceSettings.getInstance().addSettingsListener(this); + } + + public boolean isSelected() + { + return state; + } + + public void settingsChanged() + { + final boolean oldState = state; + state = WorkspaceSettings.getInstance().isShowElementAlignmentHints(); + firePropertyChange(SELECTED, oldState, state); + } + + /** + * Invoked when an action occurs. + */ + public void actionPerformed(final ActionEvent e) + { + final WorkspaceSettings applicationSettings = WorkspaceSettings.getInstance(); + applicationSettings.setShowElementAlignmentHints(!applicationSettings.isShowElementAlignmentHints()); + } +} \ No newline at end of file Modified: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/editor/report/AbstractRenderComponent.java =================================================================== --- tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/editor/report/AbstractRenderComponent.java 2009-06-09 17:54:32 UTC (rev 9046) +++ tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/editor/report/AbstractRenderComponent.java 2009-06-09 19:31:39 UTC (rev 9047) @@ -850,7 +850,7 @@ } } - if (WorkspaceSettings.getInstance().isSnapToElements()) + if (WorkspaceSettings.getInstance().isShowElementAlignmentHints()) { final float scaleFactor = getRenderContext().getZoomModel().getZoomAsPercentage(); g2d.setColor(getPrimaryGridColor()); Modified: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/settings/WorkspaceSettings.java =================================================================== --- tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/settings/WorkspaceSettings.java 2009-06-09 17:54:32 UTC (rev 9046) +++ tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/settings/WorkspaceSettings.java 2009-06-09 19:31:39 UTC (rev 9047) @@ -307,7 +307,18 @@ } } + public boolean isShowElementAlignmentHints() + { + return properties.getBoolean("ShowElementAlignmentHints", false); + } + + public void setShowElementAlignmentHints(final boolean showElementAlignmentHints) + { + properties.put("ShowElementAlignmentHints", String.valueOf(showElementAlignmentHints)); + fireSettingsChanged(); + } + public boolean isSnapToElements() { return properties.getBoolean("SnapToElements", false); Modified: tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/xul/designer-frame.xul =================================================================== --- tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/xul/designer-frame.xul 2009-06-09 17:54:32 UTC (rev 9046) +++ tools/report-designer/trunk/report-designer/src/org/pentaho/reporting/designer/core/xul/designer-frame.xul 2009-06-09 19:31:39 UTC (rev 9047) @@ -121,6 +121,8 @@ pen:action="org.pentaho.reporting.designer.core.actions.global.ShowElementFramesAction"/> </menupopup> </menu> + <pen:checkbox-menuitem id="show.element.alignment.hints" + pen:action="org.pentaho.reporting.designer.core.actions.global.ShowElementAlignmentHintsAction"/> <pen:checkbox-menuitem id="view.snap.to.element" pen:action="org.pentaho.reporting.designer.core.actions.global.SnapToElementsAction"/> <pen:checkbox-menuitem id="view.show-overlapping-elements" |