Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom or default properties defined at load time. #24

Closed
end2endzone opened this issue May 31, 2019 · 1 comment
Closed

Support custom or default properties defined at load time. #24

end2endzone opened this issue May 31, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@end2endzone
Copy link
Owner

It would be interesting to be able to define default properties (defined by the user) when a file is loaded.

The proposed method is as follows:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <default>
    <property name="myapp.installation.date" value="2019-01-24" />
  </default>
  <shell>
  </shell>
</root>

The feature could also be usefull for implementing mutually exclusive menus.
For instance, by defining a default value of property display_menu_a to true, one can implement the following toggling menus:

  <menu name="A">
    <visibility properties="display_menu_a" />
    <actions>
      <!--Do something meaningful-->

      <!--Change the property to only show B.-->
      <property name="display_menu_a" value="" />
      <property name="display_menu_b" value="true" />
    </actions>
  </menu>
  <menu name="B">
    <visibility properties="display_menu_b" />
    <actions>
      <!--Do something meaningful-->

      <!--Change the property to only show A.-->
      <property name="display_menu_a" value="true" />
      <property name="display_menu_b" value="" />
    </actions>
  </menu>
@end2endzone end2endzone added the enhancement New feature or request label May 31, 2019
end2endzone added a commit that referenced this issue Jun 29, 2019
Issue #24 - Support custom or default properties defined at load time.
end2endzone added a commit that referenced this issue Jun 29, 2019
Issue #24 - Support custom or default properties defined at load time.
end2endzone added a commit that referenced this issue Jun 30, 2019
* issue24:
  Renamed <defaults> xml element to <default> xml element. Issue #24 - Support custom or default properties defined at load time.
  Renamed Defaults class to DefaultSettings class. Issue #24 - Support custom or default properties defined at load time.
  Updated CHANGES
  Updated UserManual.md for <defaults> section.
  Cleanup code.
  Fixed failing unit test: TestConfiguration.testIsValidConfigFile()
  Simplified implementation of `Configuration::applyDefaults()`. Implemented a filter in `ObjectFactory::parseDefaults()` to force only parsing <property> actions.
  Modified code to apply defaults properties when loading a configuration file.
  Added missing test files.
  Implemented parsing of Defaults class. Implemented unit test TestObjectFactory.testParseDefaults().
  Implemented Defaults class for storing default Actions.
@end2endzone
Copy link
Owner Author

Implemented in 33a7a29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant