Permalink
Browse files

Refactored the diagram settings and dialog mode dialogs into a single…

… preferences dialog; allow custom color schemes to be defined (by means of config files).
  • Loading branch information...
1 parent 538e6c3 commit 59d91ef5ed16df1c1efd9ea81f2680aefa87d90c @jawi committed Jun 25, 2012
Showing with 824 additions and 3,618 deletions.
  1. +13 −0 client/src/main/java/nl/lxtreme/ols/client/Activator.java
  2. +9 −75 client/src/main/java/nl/lxtreme/ols/client/ClientController.java
  3. +0 −3 client/src/main/java/nl/lxtreme/ols/client/MainFrame.java
  4. +368 −0 client/src/main/java/nl/lxtreme/ols/client/PreferencesDialog.java
  5. +0 −70 client/src/main/java/nl/lxtreme/ols/client/action/ShowChannelLabelsDialogAction.java
  6. +0 −69 client/src/main/java/nl/lxtreme/ols/client/action/ShowDiagramModeSettingsDialogAction.java
  7. +0 −2 client/src/main/java/nl/lxtreme/ols/client/actionmanager/ActionManagerFactory.java
  8. +0 −250 client/src/main/java/nl/lxtreme/ols/client/diagram/settings/DiagramSettings.java
  9. +0 −761 client/src/main/java/nl/lxtreme/ols/client/diagram/settings/GeneralSettingsDialog.java
  10. +0 −250 client/src/main/java/nl/lxtreme/ols/client/diagram/settings/ModeSettingsDialog.java
  11. +0 −1,201 client/src/main/java/nl/lxtreme/ols/client/diagram/settings/MutableDiagramSettings.java
  12. +163 −0 client/src/main/java/nl/lxtreme/ols/client/osgi/UIColorSchemeManager.java
  13. +8 −7 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/laf/ChannelLabelsUI.java
  14. +25 −4 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/laf/UIManagerKeys.java
  15. +30 −15 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/ChannelLabelsViewModel.java
  16. +18 −0 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/SignalDiagramModel.java
  17. +27 −9 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/signalelement/ElementGroup.java
  18. +0 −4 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/signalelement/SignalElement.java
  19. +0 −893 client/src/test/java/nl/lxtreme/ols/client/diagram/settings/MutableDiagramSettingsTest.java
  20. +77 −0 ols.distribution/src/main/config/ols.ui.colorscheme-default.cfg
  21. +27 −0 ols.distribution/src/main/config/ols.ui.colorscheme-monochrome.cfg
  22. +26 −0 ols.distribution/src/main/config/ols.ui.colorscheme-sump.cfg
  23. +14 −5 ols.distribution/src/main/config/ols.ui.defaults.cfg
  24. +19 −0 util/src/main/java/nl/lxtreme/ols/util/ColorUtils.java
@@ -122,6 +122,15 @@ public void init( final BundleContext aContext, final DependencyManager aManager
.setInterface( ManagedService.class.getName(), props ) //
.setImplementation( UIManagerConfigurator.class ) );
+ props.put( Constants.SERVICE_PID, UIColorSchemeManager.PID );
+
+ // UI Manager Configuration...
+ aManager.add( //
+ createComponent() //
+ .setInterface(
+ new String[] { UIColorSchemeManager.class.getName(), ManagedServiceFactory.class.getName() }, props ) //
+ .setImplementation( UIColorSchemeManager.class ) );
+
// User session manager...
aManager.add( //
createComponent() //
@@ -165,6 +174,10 @@ public void init( final BundleContext aContext, final DependencyManager aManager
.setRequired( true ) //
) //
.add( createServiceDependency() //
+ .setService( UIColorSchemeManager.class ) //
+ .setRequired( true ) //
+ ) //
+ .add( createServiceDependency() //
.setService( ComponentProvider.class, "(OLS-ComponentProvider=Menu)" ) //
.setCallbacks( "addMenu", "removeMenu" ) //
.setRequired( false ) //
@@ -34,7 +34,8 @@
import nl.lxtreme.ols.api.acquisition.*;
import nl.lxtreme.ols.api.data.*;
import nl.lxtreme.ols.api.data.Cursor;
-import nl.lxtreme.ols.api.data.annotation.*;
+import nl.lxtreme.ols.api.data.annotation.Annotation;
+import nl.lxtreme.ols.api.data.annotation.AnnotationListener;
import nl.lxtreme.ols.api.data.export.*;
import nl.lxtreme.ols.api.data.project.*;
import nl.lxtreme.ols.api.devices.*;
@@ -43,7 +44,7 @@
import nl.lxtreme.ols.api.util.*;
import nl.lxtreme.ols.client.action.*;
import nl.lxtreme.ols.client.actionmanager.*;
-import nl.lxtreme.ols.client.diagram.settings.*;
+import nl.lxtreme.ols.client.osgi.*;
import nl.lxtreme.ols.client.signaldisplay.*;
import nl.lxtreme.ols.util.*;
import nl.lxtreme.ols.util.swing.*;
@@ -283,6 +284,7 @@ protected void run( final Deque<Integer> aArgs )
private volatile DataAcquisitionService dataAcquisitionService;
private volatile MainFrame mainFrame;
private volatile HostProperties hostProperties;
+ private volatile UIColorSchemeManager colorSchemeManager;
private volatile long acquisitionStartTime;
@@ -739,40 +741,6 @@ public final Device getDevice()
}
/**
- * Returns the current diagram settings.
- *
- * @return the current diagram settings, can be <code>null</code> if there is
- * no main frame to take the settings from.
- */
- @Deprecated
- public final DiagramSettings getDiagramSettings()
- {
- final Project currentProject = getCurrentProject();
- final UserSettings settings = currentProject.getSettings( MutableDiagramSettings.NAME );
- if ( settings instanceof DiagramSettings )
- {
- return ( DiagramSettings )settings;
- }
-
- // Overwrite the default created user settings object with our own. This
- // should be done implicitly, so make sure we keep the project's change flag
- // in the correct state...
- final MutableDiagramSettings diagramSettings = new MutableDiagramSettings( settings );
-
- final boolean oldChangedFlag = currentProject.isChanged();
- try
- {
- currentProject.setSettings( diagramSettings );
- }
- finally
- {
- currentProject.setChanged( oldChangedFlag );
- }
-
- return diagramSettings;
- }
-
- /**
* {@inheritDoc}
*/
public Exporter getExporter( final String aName ) throws IllegalArgumentException
@@ -1354,42 +1322,21 @@ public void showBundlesDialog( final Window aOwner )
}
/**
- * {@inheritDoc}
- */
- @Deprecated
- public void showDiagramModeSettingsDialog( final Window aParent )
- {
- if ( this.mainFrame != null )
- {
- final ModeSettingsDialog dialog = new ModeSettingsDialog( aParent, getDiagramSettings() );
- if ( dialog.showDialog() )
- {
- final DiagramSettings settings = dialog.getDiagramSettings();
- getCurrentProject().setSettings( settings );
- diagramSettingsUpdated();
- }
-
- dialog.dispose();
- }
- }
-
- /**
* Shows the global preferences dialog.
*
* @param aParent
* the parent window of the dialog, can be <code>null</code>.
*/
public void showPreferencesDialog( final Window aParent )
{
- final GeneralSettingsDialog dialog = new GeneralSettingsDialog( aParent, getDiagramSettings() );
+ final PreferencesDialog dialog = new PreferencesDialog( aParent, this.colorSchemeManager );
if ( dialog.showDialog() )
{
- final DiagramSettings settings = dialog.getDiagramSettings();
- getCurrentProject().setSettings( settings );
- diagramSettingsUpdated();
- }
+ // Ensure all UI-related changes are immediately visible...
+ repaintMainFrame();
- dialog.dispose();
+ // TODO persist the settings...
+ }
}
/**
@@ -1844,19 +1791,6 @@ private ToolContext createToolContext()
}
/**
- * Should be called after the diagram settings are changed. This method will
- * cause the main frame to be updated.
- */
- private void diagramSettingsUpdated()
- {
- if ( this.mainFrame != null )
- {
- this.mainFrame.diagramSettingsUpdated();
- repaintMainFrame();
- }
- }
-
- /**
* Returns the {@link Channel} with the given index.
*
* @param aChannelIdx
@@ -1030,9 +1030,6 @@ private JToolBar createMenuBars()
diagramMenu.addSeparator();
diagramMenu.add( this.controller.getAction( RemoveAnnotationsAction.ID ) );
- diagramMenu.addSeparator();
- diagramMenu.add( this.controller.getAction( ShowDiagramModeSettingsDialogAction.ID ) );
- diagramMenu.add( this.controller.getAction( ShowChannelLabelsDialogAction.ID ) );
this.toolsMenu = bar.add( new JMenu( "Tools" ) );
this.toolsMenu.setMnemonic( 'T' );
Oops, something went wrong.

0 comments on commit 59d91ef

Please sign in to comment.