Giter VIP home page Giter VIP logo

magritte's Introduction

Build Status

Most applications consist of a big number of model- or so called domain-objects. Building different views, editors, and reports; querying, validating and storing those objects is very repetitive and error-prone, if an object changes its shape frequently.

Magritte is a fully dynamic meta-description framework that helps to solve those problems, while keeping the full power with the programmer in all aspects. Moreover since Magritte is described in itself, you can let your users modify the meta-world and add their own fields and forms without writing a single line of code.

Installation

Christoph Lamprecht ported Magritte to Perl.

Add as a project dependency

In you project Baseline or Configuration definition, add to the spec:

baseline: 'Magritte' 
with: [ spec repository: 'github://magritte-metamodel/magritte:v3.8'; 
             loads: #(Core) ]; 

This snippet uses v3.8 release version, remember to change the release version to your needs. See BaselineOfMagritte for other groups to load beside of 'Core'.

Mailing-Lists

Development

Documentation

Papers

magritte's People

Contributors

dalehenrich avatar damiencassou avatar delware avatar ducasse avatar emaringolo avatar estebanlm avatar girba avatar googlecodeexporter avatar janbliznicenko avatar jecisc avatar jurajkubelka avatar krono avatar lin777 avatar marianopeck avatar nickager avatar noha avatar pavel-krivanek avatar renggli avatar seandenigris avatar sergestinckwich avatar stephaneggermont avatar vitormcruz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magritte's Issues

Morphic: More reasonable default label behavior

Version: 3.0.1

If we have an element description, but don't supply a label, there is still a 
label cell with only a $: in it (which would've been appended to the supplied 
label name). 

Two possible defaults:
* capitalize the accessor
* leave the label out completely if not supplied

Original issue reported on code.google.com by [email protected] on 13 Jun 2013 at 4:04

Magritte documentation out of sync

The Magritte documentation at http://book.seaside.st needs to be updated for 
Magritte 3, see for example 
http://book.seaside.st/book/advanced/magritte/first-examples

Original issue reported on code.google.com by [email protected] on 7 May 2012 at 10:27

Package Dependency Warning

I am getting the error message while trying to load magritte throught the Pharo5 Catalog on a Windows machine:

"This package depends on the following classes:
GRPharoPlatform
You must resolve these dependencies before you will be able to load these definitions:
GRPharoPlatform>>#magritteAllSubInstancesOf:do:
GRPharoPlatform>>#magritteClassNamed:
GRPharoPlatform>>#magritteColorClass
GRPharoPlatform>>#magritteEvaluatorClassFor:
GRPharoPlatform>>#magritteTimeStampClass
GRPharoPlatform>>#magritteTimeStampIfAbsent:
GRPharoPlatform>>#magritteUniqueObject

Select Proceed to continue, or close this window to cancel the operation."

Should this be provided as Magritte Project Dependencies?

[Feature]: Meta-Described Accessors

This is a logical part of the meta-layer that apparently just never got implemented.

Example:
Given aDescription, like MABooleanDescription new., you can now define an accessor via Magritte (e.g. a Morphic form).

As a test, let's try to use our description to read Smalltalk os isMacOSX:

  1. In a MA Morphic form, click "Remove" for the current null accessor.
  2. Now choose MAChainAccessor from the dropdown
  3. In the popup form:
    a. For the first accessor, choose MASelectorAccessor the dropdown and fill "os" into the edit field
    b. For the second accessor, choose MASelectorAccessor the dropdown and fill "isMacOSX" into the edit field

Now, DoIt: myDescription read: Smalltalk "==> true | false"

[Enh]: Memento DNU Magic

In conditions, one can get into some tortured hoop jumping like the following:

addCondition: [ :obj | 
            (obj readUsing: self descriptionTimeAndAHalf) <= ((SaltyDuration fromMinimumStaffing: obj) timeAndAHalfPossibleOn: (obj readUsing: self descriptionDate)) ]

What if we did something like:

MACachedMemento>>doesNotUnderstand: aMessage
  self model descriptionFor: aMessageSelector ifFound: [ : desc | ^ self readUsing: desc ].
  ^ super doesNotUnderstand: aMessage

Magritte-XMLBinding #fromXml: requires MADynamicDescribedObject support to avoid kind

I implemented MADynamicDescribedObject to avoid having to specify #kind: on 
descriptions when materialising xml using  #fromXml:

However the Json implementation #fromJson: doesn't require 
MADynamicDescribedObject. 
I view MADynamicDescribedObject as a hack that should be removed to simplify 
the core Magritte code.

I think Magritte-XMLBindings should be refactored so that #fromXml: can work in 
a similar way to #fromJson: and won't require the support of 
MADynamicDescribedObject which can then be removed

see also: http://code.google.com/p/magritte-metamodel/issues/detail?id=8 
(Magritte-json and Magritte-xml have divergent implementations)


Original issue reported on code.google.com by [email protected] on 8 Feb 2012 at 4:25

[Enh]: Add `#fieldDescription`

Sometimes you need a string representation of a field. For SelectorAccessors, it could easily be the readAccessor, for ChainAccessors maybe firstSelector:secondSelector, etc.

ActionDescription Enhancements

[Enh]: Actions, besides selectors, can now be any valuable (e.g. aBlock)

MAActionDescription new
label: 'Copy Baseline Load Snippet'; "[1]"
action: [ Clipboard clipboardText: self baselineLoadSnippet ];
yourself
  1. You will probably want to supply a label, since we don't have a selector. Magritte will still try to autocreate one, but from the source of the block.
  2. #selector[:] has been deprecated and will be transformed on first send

[Enh]: Flesh Out MAActions and hook into Glamour (This introduces a dependency on Glamour, which should obviously be an optionally loaded component)

MAReportComponent>>renderTableCaptionOn: sends #caption ... #caption not implemented

This is in Magritte-Seaside-lr.335 ... #caption is sent to a 
description, but I haven't found any implementors ... is this a bug 
waiting to happen or is magic involved:)

Response from Lukas:


  Actually I don't know where MAReportComponent is coming from?

  Seems to be a long obsolete class, it should be removed. I don't see
  how it can work. Use MAReport.

Original issue reported on code.google.com by [email protected] on 16 Jun 2010 at 9:10

Decompose `#maEdit`

Sometimes you want to "almose #maEdit". Like I want to maEdit but then have an action after. This can be done from scratch via e.g.:

	self asMagritteMorph
		addButtons;
		addWindow;
		onAnswer: [ :newProject | self projects add: newProject ];
		openInWorld

This almost exactly duplicates #maEdit:

maEdit
 
	self asMagritteMorph
		addButtons;
		addWindow;
		openInWorld.

The problem is that maEdit returns the domain model object (self), not the MA model object. Even if ^ was added at the beginning, it would return the window; getting to the MA model is non-trivial because it is only stored in the save button, not the window, requiring something like: window submorphs tenth first first second first model

[Feature]: Dynamic Condition Labels

Allow code like the following:

"..."
addCondition: [ :obj | "whatever" ]
labelled: [ :obj | obj date mmddyyyy, ' is too far in the future'  ]

All Option Descriptions Should Be Extensible

Right now, only Single Option Descriptions allow you to add a new object not included in the initial options, but there doesn't seem to be anything specific to the Single-Option domain.

Relationships with Primitives

What if we want to have a MAToManyRelationDescription holding ByteStrings? ByteString has no field descriptions and so can't be specified in #classes:.

#asString and #copyFrom: might be generally useful here. For URL's, maybe they could be set as the accessors for a MAURLDescription

Magritte-Model overrides in Pharo 1.1

Was loading up Pharo 1.1 and noticed that Magritte-Model
SequenceableCollection>>reduce: and String>>lines overrides what's
already in Pharo and breaks some Pharo unit tests.  I assume this
isn't intentional and Pharo has recently added these methods.

Reported by Ramon Leon

Original issue reported on code.google.com by renggli on 23 Sep 2010 at 6:28

Magritte-json and Magritte-xml have divergent implementations

Magritte-Json and Magritte-xml have very different implementations, even though 
they are performing similar functions.
Also the magritte APIs are different. For example:
* Magritte-Json has a default serialisation scheme which is modifiable via 
description properties.
* Magritte-XMLBindings will not serialise until #xmlElementName: has been 
defined. 

Original issue reported on code.google.com by [email protected] on 8 Feb 2012 at 4:19

Magritte is bugfree

Please find some bugs, so that they can be fixed.

Original issue reported on code.google.com by renggli on 18 Feb 2009 at 10:07

  • Blocked on: #4

MATextDescription

There are two axes which require flexibility - Type (String | Text) and Purpose (e.g. memo, password). Right now, Purpose is implemented via inheritance, and Type is hard-coded to String

[Enh]: Basic Condition Dependencies

Some fields are naturally and inextricably related; enough so that if one fails validation, it doesn't make sense to even try to validate the other.

error adding a 1toMany relationship in MADescription editor

What steps will reproduce the problem?
1. go to /seaside/magritte/editor
2. select 1:m Relation
3. Click Add

What is the expected output?

Not sure... something?

What do you see instead?

Seaside Walkback

MessageNotUnderstood: UndefinedObject>>asArray

Debug Proceed Full Stack

Possible Causes

the receiver of the message is nil
a class extension hasn't been loaded correctly
you sent the wrong message
Stack Trace

thisContext
UndefinedObject(Object)>>doesNotUnderstand: #asArray
self
nil
aMessage
asArray
exception
MessageNotUnderstood: UndefinedObject>>asArray
resumeValue
nil
thisContext
MAReport>>cache
self
a MAReport
thisContext
MAReport>>hasMoreThanOnePage
self
a MAReport
thisContext
MAReport>>renderTableOn:
self
a MAReport
html
a WARenderCanvas
thisContext
[] in MAReport>>renderContentOn:
self
a MAReport
html
a WARenderCanvas

What version of the product are you using? On what operating system?

1.2 one-click

Original issue reported on code.google.com by renggli on 19 Dec 2009 at 4:18

Automatically Describe Objects

Initial snippet which may be helpful:

class instVarNames do: [ :e |
    | source | 
    source := 'description', e capitalized, '

    ^ MAStringDescription new
            accessor: #', e, '
            yourself'.
    class compile: source classified: 'Magritte' ]

Validation Problem

I've been struggling with a Magritte validation problem. I find that a 
condition I add (using #addCondition:labelled:) to a MABooleanDescription is 
only intermittently called.

I've simplified the conditions to reproduce the problem to a component 
description comprising of two MABooleanDescription descriptions. The second 
description includes the condition which is intermittently called.

If the value of the first description is true (ie the checkbox is checked) the 
second description's condition will be executed, however if it is false it will 
never be executed.

I suspect the problems lies in the code in  
MAValidatorVisitor>>#visitContainer: which calls MAGraphVisitor>>#use:during: 
which is as follows:

MAGraphVisitor >>use: anObject during: aBlock
    | previous |
    (seen includes: anObject)
        ifTrue: [ ^ self ].
    anObject isNil
        ifFalse: [ seen add: anObject ].
    previous := object. object := anObject.
    aBlock ensure: [ object := previous ]

If the first check box is false, and the second is also false then (seen 
includes: anObject) will return true and method returns early resulting in 
block associated with second description (self visit: description) never being 
executed. 

I've attached a file out of a simple component TestMagritteValidation 
illustrating the problem that I tested in the latest build from Hudson.

Thanks
Nick 

Original issue reported on code.google.com by renggli on 11 Oct 2010 at 7:29

[ENH]: Provide hook to initialize ToMany Instances

** Hold until requested. I needed this, but worked around it for the time 
being. If it comes up again, here's the result of my initial investigation...

The idea is to allow model constraints (e.g. between the parent and the new 
reference) to be set up before the new object is viewed.

Implementation notes:
1. The To Many Morph/Component would send "description initialize: self 
selected" instead of "self selected new"
2. MAToManyRelationDescription>>#initialize: aBlock (taking a class as an 
argument

Would be used like:

    MAToManyRelationDescription new
        accessor: #events;
        label: 'Events';
    classes: { MyDomainClass AnotherClass };
    initialize: [ :klass | klass new date: self date ].

Original issue reported on code.google.com by [email protected] on 9 Oct 2013 at 4:40

Extensible Reference Description Morph

There is not a viable control for the use case where you are choosing between several likely known options, but may also select an unknown object that was not part of the initial options. For example, when tagging people in a photos, you'd want to start with known people, but be able to add new people too.

Element Descriptions Break GT-Inspector Form Tab

DoIt: anElementDescription asMagritteMorph inspect.
Click "Form" tab.
Error!

I'm not sure this is even something we'll ever need, but the first step might be to implement #notEmpty on MAElementDescription

Auto-complete

Here are a few places where auto-complete would be helpful:

  • Relations. In this case, there would have to be some reasonable way to create an object from a typed string
  • Options
    • Fixed set: this is the most straightforward case. We just need to define the mapping between the input and the objects. *** This is already working!
    • Extensible: a bit more complex because one must specify how to turn an accepted string into an object

Now here's a new case. Not quite clear if/how it fits into the above. We have an unknown/giant set of options that is whittled down depending on the input. A use case is Google Places. There are near infinite number of possibilities until you start typing, and then the matches become fewer and fewer.

Thinking this through a bit, the only thing we have access to is the description, so that's where the difference has to be made. The thing is that the options will depend on the input, so we need something like optionsMatching:

Custom addition of ToMany Relationships

Use case:
Parent has many children, which it holds internally in a Dictionary.
If one was going to add a child programmatically, one would do something like:
Parent>>#addChild: aChild number: 3
  children at: 3 put: aChild

where the 3 appears to be (in the model) a property of the child, even though 
its really held as the key in the children dictionary. 

I want:
- the number to appear as a number editor in the new child editor, even though 
it's not really a property of the child. Like a virtual field
- the addition of a new element in a toMany relationship to be overridable; 
right now it happens in e.g. MAOneToManyMorph. I'd like it to delegate to the 
description, so that a user could say (pseudocode): 
  description addBlock: [ :collection :newElement | 
    collection at: newElement number put: newElement ].

What I discovered is that, since Dictionary>>#add: takes an association, a 
workaround is to create an Association subclass, which has the number (3 above) 
as its key, and aChild as its value, and add one instead of adding a Child.

E.g. 
    Association subclass: #IndexToChildAssociation

    IndexToChildAssociation>>descriptionIndex
    <magritteDescription>   
    ^ MANumberDescription new
        label: 'Index';
        selectorAccessor: #key.

    IndexToChildAssociation>>descriptionChild
    <magritteDescription>
    ^ MAToOneRelationDescription new
        label: 'Child';
        selectorAccessor: #value;
        classes: { Child }.

And then...

    descriptionChildren
    <magritteDescription>   
    ^ MAToManyRelationDescription new
        selectorAccessor: #children;
        classes: { IndexToChildAssociation. Child }.

Notice that the real model class (Child) must be included in #classes: or 
you'll get a validation error when trying to save a parent that already has 
children.

Original issue reported on code.google.com by [email protected] on 13 Mar 2014 at 2:28

Morphic: Long Labels are occluded

The StringMorphs are set to a default width. If the label is short, everything 
looks okay. But if the label is longer, the extra length of the text goes 
behind the view for the field data.

I tried changing to TextMorph instead, which solves the problem above, but then 
the fields aren't lined up. We need some kind of grid layout/morph

Original issue reported on code.google.com by [email protected] on 13 Jun 2013 at 8:03

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.