Path: blob/master/webroot/rsrc/js/phuix/PHUIXExample.js
12241 views
/**1* @provides javelin-behavior-phuix-example2* @requires javelin-install3* javelin-dom4* phuix-button-view5*/67JX.behavior('phuix-example', function(config) {8var node;9var spec;10var defaults;1112switch (config.type) {13case 'button':14var button = new JX.PHUIXButtonView();15defaults = {16text: null,17icon: null,18type: null,19color: null20};2122spec = JX.copy(defaults, config.spec);2324if (spec.text !== null) {25button.setText(spec.text);26}2728if (spec.icon !== null) {29button.setIcon(spec.icon);30}3132if (spec.type !== null) {33button.setButtonType(spec.type);34}3536if (spec.color !== null) {37button.setColor(spec.color);38}3940node = button.getNode();41break;42case 'icon':43var icon = new JX.PHUIXIconView();44defaults = {45icon: null,46color: null47};4849spec = JX.copy(defaults, config.spec);5051if (spec.icon !== null) {52icon.setIcon(spec.icon);53}5455if (spec.color !== null) {56icon.setColor(spec.color);57}5859node = icon.getNode();60break;61}6263JX.DOM.setContent(JX.$(config.id), node);64});656667