//
// Block palette
//
var ProgramEditorBlockPalette = function(options) {

    var container = options.container;
    var programEditorPanel = options.programEditorPanel;

    var blockPalette = $('<div>', { css: {  backgroundColor: 'white' } } );

    var createSection = function(name, content) {

        var div         = $('<div>', { css: {   width: '100%',
                                                cursor: 'pointer' } } );

        var title = $('<div>', { css: {paddingLeft: '2px' }} ).text(name);
        title.click( function(e) {
            if(content.is(":visible")) {
                content.hide();
            } else {
                content.show();
            }
        });

        div.append(title); 
        div.append(content);

        return div;
    }

    var createSensorBtn = function(name) {
        var btn = $('<button>', { css: { width: '100%' } } );
        btn.text(name);
        return btn;
    };

    var temp        = createSensorBtn("Temperature");
    var humidity    = createSensorBtn("Humidity");
    var co2         = createSensorBtn("CO2");

    var sensorContent = $('<div>');
    sensorContent.append(temp);
    sensorContent.append(humidity);
    sensorContent.append(co2);

    var sensors     = createSection("Sensors", sensorContent);
    blockPalette.append(sensors);

    var filterContent = $('<div>');
    var filterButton = $('<button>', { css: { width: '100%' } } );
    filterButton.text('Filter');
    filterButton.click( function() {
        programEditorPanel.showFilterBlockSelector();
    });
    filterContent.append(filterButton);
    var filters = createSection("Filters", filterContent);
    blockPalette.append(filters);

    container.append(blockPalette);

}

@@ -1354,24 +1354,478 @@
 $('%3Cdiv%3E');%0A
+%0A    var createFilterBtn = function(type) %7B%0A        console.log(%22%5BDEBUG%5D programEditorPanel%22, programEditorPanel);%0A        var btn = $('%3Cbutton%3E', %7B text: type, css: %7B width: '100%25' %7D %7D );%0A        btn.click(type, function(e) %7B%0A            programEditorPanel.addFilterBlock(e);%0A        %7D);%0A        return btn;%0A    %7D%0A%0A    var andButton   = createFilterBtn(%22and%22);%0A    var orButton    = createFilterBtn(%22or%22);%0A    var notButton   = createFilterBtn(%22not%22);%0A%0A
     var filt
@@ -1902,22 +1902,19 @@
 n.text('
-Filter
+...
 ');%0A    
@@ -2004,24 +2004,25 @@
 ();%0A    %7D);%0A
+%0A
     filterCo
@@ -2038,22 +2038,133 @@
 end(
-filterButton);
+andButton);%0A    filterContent.append(orButton);%0A    filterContent.append(notButton);%0A    filterContent.append(filterButton);%0A
 %0A   
@@ -2211,32 +2211,33 @@
 filterContent);%0A
+%0A
     blockPalette

Add filters buttons to palette.