Changes between Version 8 and Version 9 of AnotherPluginDevelopmentGuide
- Timestamp:
- 20.07.2012 11:21:40 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AnotherPluginDevelopmentGuide
v8 v9 67 67 || . . . . . bucket.png || of your choice, all of them are accessible via HTTP. || 68 68 || . . . . [#js script/] || Client-side !JavaScipt goes here. || 69 || . . . . . [#pluginjs plugin.js] || The JavaScipt plugin "main" file. || 70 || . . . . style/ || Another custom folder to separate the styles. || 69 || . . . . . renderer/ || All client renderer implementations are separated here by directory. || 70 || . . . . . . [#canvas canvas_renderers/] || || 71 || . . . . . . [#multi multi_renderers/] || || 72 || . . . . . . [#page page_renderers/] || || 73 || . . . . . . [#simple simple_renderers/] || || 74 || . . . . . [#pluginjs plugin.js] || The !JavaScipt plugin "main" file. || 75 || . . . . [#style style/] || CSS stylesheets located here are picked up automatically. || 71 76 |||| . . . . . screen.css || 72 77 … … 327 332 328 333 Enhancing the web client with !JavaScript based implementations is supported by 329 the unique plugin.jsfile.330 331 A plugin that loads some type specific renderer and adds a custom command:334 the unique {{{plugin.js}}} file. 335 336 A plugin with some custom command callbacks: 332 337 {{{#!js 333 338 dm4c.add_plugin('dm4.example.plugin', function() { 334 335 // load some renderer and a style sheet336 dm4c.load_field_renderer('/de.deepamehta.dm4-example/script/example_content_field_renderer.js')337 dm4c.load_page_renderer('/de.deepamehta.dm4-example/script/example_content_page_renderer.js')338 dm4c.load_stylesheet('/de.deepamehta.dm4-example/style/screen.css')339 339 340 340 // calls the alternative REST creation method with customized JSON format … … 369 369 370 370 Type specific renderer can be assigned declarative or programmatically in a migration and 371 manually in the web client.371 manually by editing the view configuration of a type in the web client. 372 372 373 373 Declarative renderer assignment: … … 382 382 type_uri: "dm4.webclient.view_config", 383 383 composite: { 384 dm4.webclient. field_renderer_uri: "dm4.example.content_field_renderer",384 dm4.webclient.simple_renderer_uri: "dm4.example.content_field_renderer", 385 385 dm4.webclient.page_renderer_uri: "dm4.example.content_page_renderer" 386 386 } … … 391 391 392 392 393 === !FieldRenderer === 394 395 A simple possibility to enhance the UI is the field renderer. The generic topic renderer 396 creates a fresh object for each composite part, so please use the prototype approach. 393 === !SimpleRenderer === #simple 394 395 A simple possibility to enhance the UI is the simple renderer. 397 396 398 397 {{{#!js 399 // a simple field renderer that renders an example topic name with anadditional CSS class400 dm4c.add_ field_renderer("dm4.example.content_field_renderer", {401 402 render_ field: function(field_model, parent_element) {403 dm4c.render.field_label( field_model, parent_element)404 parent_element.append($("<span>").addClass('example').text(field_model.value))398 // a simple example that renders a topic name with a additional CSS class 399 dm4c.add_simple_renderer('dm4.example.content_field_renderer', { 400 401 render_info: function(model, $parent) { 402 dm4c.render.field_label(model, $parent) 403 $parent.append($("<span>").addClass('example').text(model.value)) 405 404 }, 406 405 407 render_form _element: function(field_model, parent_element) {408 var $content = dm4c.render.input( field_model)409 parent_element.append($content)406 render_form: function(model, $parent) { 407 var $content = dm4c.render.input(model) 408 $parent.append($content) 410 409 return function() { // return input value 411 410 return $.trim($content.val()) … … 416 415 417 416 418 === !PageRenderer === 417 === !PageRenderer === #page 419 418 420 419 The page renderer can replace the whole page content. … … 443 442 444 443 445 == !TopicMapRenderer == 446 447 '''TBD''' describe additional topic map handling 444 === !MultiRenderer === #multi 445 446 '''TBD''' describe and write a multi renderer implementation 447 448 449 === !CanvasRenderer === #canvas 450 451 '''TBD''' describe additional canvas renderer 452 453 454 === Stylesheets === #style 455 456 All Stylesheets in the web resource folder are loaded by default. 457 458 Loading custom CSS files of a vendor plugin or something else: 459 {{{#!js 460 dm4c.load_stylesheet('/de.deepamehta.dm4-example/vendor/library/css/screen.css') 461 }}} 462 448 463 449 464 = Java = #java