Exemple #1
0
    def _get_action_handlers(self):
        from pyasm.widget.widget_config import WidgetConfig, WidgetConfigView

        
        # get all of the element names for this asset
        search_type_obj = SearchType.get(self.search_type)

        # get the sobject config
        default_config = WidgetConfig.get_default( \
            search_type_obj,self.view)

        config = WidgetConfigView.get_by_search_type(search_type_obj,self.view)
        
        from pyasm.widget import EditAllWdg
        from pyasm.web import WebContainer
        element_name = WebContainer.get_web().get_form_value(\
            EditAllWdg.ELEMENT_NAME)
        
        # store action handlers in a list, only getting one for now
        action_handlers = []

        action_handler_class = \
            config.get_action_handler(element_name)

        # else get it from the default handler
        if default_config != None and action_handler_class == "":
            action_handler_class = \
                default_config.get_action_handler(element_name)

        if action_handler_class == "":
            action_handler_class = self.get_default_action_handler()
        action_handler = WidgetConfig.create_widget( action_handler_class )
        action_handler.set_name(element_name)
        action_handler.set_input_prefix(self.input_prefix)

        action_handlers.append(action_handler)

        return action_handlers
Exemple #2
0
    def _get_action_handlers(my):
        from pyasm.widget.widget_config import WidgetConfig

        
        # get all of the element names for this asset
        search_type_obj = SearchType.get(my.search_type)

        # get the sobject config
        default_config = WidgetConfig.get_default( \
            search_type_obj,my.view)

        config = WidgetConfig.get_by_search_type(search_type_obj,my.view)
        
        from pyasm.widget import EditAllWdg
        from pyasm.web import WebContainer
        element_name = WebContainer.get_web().get_form_value(\
            EditAllWdg.ELEMENT_NAME)
        
        # store action handlers in a list, only getting one for now
        action_handlers = []

        action_handler_class = \
            config.get_action_handler(element_name)

        # else get it from the default handler
        if default_config != None and action_handler_class == "":
            action_handler_class = \
                default_config.get_action_handler(element_name)

        if action_handler_class == "":
            action_handler_class = my.get_default_action_handler()
        action_handler = WidgetConfig.create_widget( action_handler_class )
        action_handler.set_name(element_name)
        action_handler.set_input_prefix(my.input_prefix)

        action_handlers.append(action_handler)

        return action_handlers
Exemple #3
0
    def _get_action_handlers(self):

        # get all of the element names for this asset
        search_type_obj = SearchType.get(self.search_type)

        # if element names are not specified, then get it from the view
        from pyasm.widget.widget_config import WidgetConfigView, WidgetConfig
        if not self.element_names:
            config = WidgetConfigView.get_by_search_type(search_type_obj, self.view)
            self.element_names = config.get_element_names()

        else:
            # FIXME: do we just a WidgetConfig here????
            base_view = self.view
            config = WidgetConfigView.get_by_element_names(self.search_type, self.element_names, base_view=base_view)


        assert self.element_names
        assert config


        # create all of the handlers
        action_handlers = []

        for element_name in (self.element_names):
            action_handler_class = \
                config.get_action_handler(element_name)
            if action_handler_class == "":
                action_handler_class = self.get_default_action_handler()


            action_handler = WidgetConfig.create_widget( action_handler_class )
            action_handler.set_name(element_name)
            action_handler.set_input_prefix(self.input_prefix)
            action_options = config.get_action_options(element_name)
            for key,value in action_options.items():
                action_handler.set_option(key, value)



            action_handlers.append(action_handler)

        return action_handlers
Exemple #4
0
    def _get_action_handlers(my):

        # get all of the element names for this asset
        search_type_obj = SearchType.get(my.search_type)

        # if element names are not specified, then get it from the view
        from pyasm.widget.widget_config import WidgetConfigView, WidgetConfig
        if not my.element_names:
            config = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
            my.element_names = config.get_element_names()

        else:
            # FIXME: do we just a WidgetConfig here????
            base_view = my.view
            config = WidgetConfigView.get_by_element_names(my.search_type, my.element_names, base_view=base_view)


        assert my.element_names
        assert config


        # create all of the handlers
        action_handlers = []

        for element_name in (my.element_names):
            action_handler_class = \
                config.get_action_handler(element_name)
            if action_handler_class == "":
                action_handler_class = my.get_default_action_handler()


            action_handler = WidgetConfig.create_widget( action_handler_class )
            action_handler.set_name(element_name)
            action_handler.set_input_prefix(my.input_prefix)
            action_options = config.get_action_options(element_name)
            for key,value in action_options.items():
                action_handler.set_option(key, value)



            action_handlers.append(action_handler)

        return action_handlers
Exemple #5
0
    def _get_action_handlers(my):

        # get all of the element names for this asset
        search_type_obj = SearchType.get(my.search_type)

        # discover any default handlers
        default_elements = []
        from pyasm.widget.widget_config import WidgetConfigView, WidgetConfig
        #xxconfig = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
        xxconfig = WidgetConfigView.get_by_search_type(my.search_type, my.view)
        xxelement_names = xxconfig.get_element_names()
        for element_name in xxelement_names:
            action_handler = xxconfig.get_action_handler(element_name)
            if action_handler == 'DefaultValueDatabaseAction':
                default_elements.append(element_name)




        # if element names are not specified, then get it from the view
        if not my.element_names:
            config = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
            my.element_names = config.get_element_names()


        else:
            base_view = my.view
            config = WidgetConfigView.get_by_element_names(my.search_type, my.element_names, base_view=base_view)


        # add the default elements
        for element_name in default_elements:
            if element_name not in my.element_names:
                my.element_names.append(element_name)


        assert my.element_names
        assert config

        # create all of the handlers
        action_handlers = []

        for element_name in (my.element_names):
            action_handler_class = \
                config.get_action_handler(element_name)

            if action_handler_class == "":
                action_handler_class = my.get_default_action_handler()

            action_handler = WidgetConfig.create_widget( action_handler_class )
            action_handler.set_name(element_name)
            action_handler.set_input_prefix(my.input_prefix)
            action_options = config.get_action_options(element_name)

            if my.data != None:
                element_data = my.data.get(element_name)
                action_handler.set_data(element_data)

            for key,value in action_options.items():
                action_handler.set_option(key, value)

            action_handlers.append(action_handler)



        return action_handlers
Exemple #6
0
    def _get_action_handlers(my):

        # get all of the element names for this asset
        search_type_obj = SearchType.get(my.search_type)

        # discover any default handlers
        default_elements = []
        from pyasm.widget.widget_config import WidgetConfigView, WidgetConfig
        tmp_config = WidgetConfigView.get_by_search_type(my.search_type, my.view)

        tmp_element_names = tmp_config.get_element_names()
        for element_name in tmp_element_names:
            action_handler = tmp_config.get_action_handler(element_name)
            if action_handler == 'DefaultValueDatabaseAction':
                default_elements.append(element_name)




        # if element names are not specified, then get it from the view
        if not my.element_names:
            config = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
            my.element_names = config.get_element_names()


        elif my.config_xml:
            config = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
            extra_config = WidgetConfig.get(view="tab", xml=my.config_xml)
            config.get_configs().insert(0, extra_config)

        else:
            base_view = my.view
            config = WidgetConfigView.get_by_element_names(my.search_type, my.element_names, base_view=base_view)


        # as a back up look up the definition in the view
        display_view = "table"
        display_config = WidgetConfigView.get_by_search_type(search_type_obj, display_view)


        # add the default elements
        for element_name in default_elements:
            if element_name not in my.element_names:
                my.element_names.append(element_name)


        assert my.element_names
        assert config

        # create all of the handlers
        action_handlers = []

        for element_name in my.element_names:

            action_handler_class = \
                    config.get_action_handler(element_name)

            # Try to get it from the display view
            if not action_handler_class:
                display_class = \
                        display_config.get_display_handler(element_name)
                try:
                    stmt = Common.get_import_from_class_path(display_class)
                    exec(stmt)
                    action_handler_class = eval("%s.get_default_action()" % display_class)
                except Exception, e:
                    print "WARNING: ", e
                    action_handler_class = ""

            if action_handler_class == "":
                action_handler_class = my.get_default_action_handler()

            action_handler = WidgetConfig.create_widget( action_handler_class )
            action_handler.set_name(element_name)
            action_handler.set_input_prefix(my.input_prefix)
            action_options = config.get_action_options(element_name)

            if my.data != None:
                element_data = my.data.get(element_name)
                action_handler.set_data(element_data)

            for key,value in action_options.items():
                action_handler.set_option(key, value)

            action_handlers.append(action_handler)
Exemple #7
0
    def _get_action_handlers(my):

        # get all of the element names for this asset
        search_type_obj = SearchType.get(my.search_type)

        # discover any default handlers
        default_elements = []
        from pyasm.widget.widget_config import WidgetConfigView, WidgetConfig
        xxconfig = WidgetConfigView.get_by_search_type(my.search_type, my.view)

        xxelement_names = xxconfig.get_element_names()
        for element_name in xxelement_names:
            action_handler = xxconfig.get_action_handler(element_name)
            if action_handler == 'DefaultValueDatabaseAction':
                default_elements.append(element_name)




        # if element names are not specified, then get it from the view
        if not my.element_names:
            config = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
            my.element_names = config.get_element_names()


        elif my.config_xml:
            config = WidgetConfigView.get_by_search_type(search_type_obj, my.view)
            extra_config = WidgetConfig.get(view="tab", xml=my.config_xml)
            config.get_configs().insert(0, extra_config)

        else:
            base_view = my.view
            config = WidgetConfigView.get_by_element_names(my.search_type, my.element_names, base_view=base_view)


        # add the default elements
        for element_name in default_elements:
            if element_name not in my.element_names:
                my.element_names.append(element_name)


        assert my.element_names
        assert config

        # create all of the handlers
        action_handlers = []

        for element_name in my.element_names:

            action_handler_class = \
                    config.get_action_handler(element_name)

            if action_handler_class == "":
                action_handler_class = my.get_default_action_handler()

            action_handler = WidgetConfig.create_widget( action_handler_class )
            action_handler.set_name(element_name)
            action_handler.set_input_prefix(my.input_prefix)
            action_options = config.get_action_options(element_name)

            if my.data != None:
                element_data = my.data.get(element_name)
                action_handler.set_data(element_data)

            for key,value in action_options.items():
                action_handler.set_option(key, value)

            action_handlers.append(action_handler)



        return action_handlers