cancel
Showing results for 
Search instead for 
Did you mean: 

How to populate values into list box?

damodar
Champ in-the-making
Champ in-the-making
Hi,

I created one new custom property to the content.  I wanted to make that as list box, by the help of Component Generator Framework I configured it with TextFieldGenerator, just I am getting simple text box.  Can you please give some advice how to make that text box as list box with some custom values?

Thanks in advance..
Damodar
14 REPLIES 14

gavinc
Champ in-the-making
Champ in-the-making
The only way of doing this out of the box is to set up a list of values constraint on your custom property.

If you do this and specify the values you want in the constraint the property sheet will automatically display a list box containing the configured values.

Have a look at this wiki page for details: http://wiki.alfresco.com/wiki/Constraints

damodar
Champ in-the-making
Champ in-the-making
Thanks gavinc,
It is working fine.

I want to have a default custom topic for the content, which I want to use it for allowing all viewers of the content to give their feed back.

When I create a document the feed back topic also should create along with it.  Is it possible? Can you please give some advice on this?

Thanks in advance…
Damodar

gavinc
Champ in-the-making
Champ in-the-making
There are a couple of ways you could do this…

You could either customise the CreateContentWizard by adding the code to create a topic for the new content. Have a look at CreateDiscussionDialog to see how a topic for a node gets created.

A better approach though maybe to create a custom repository action. The action could be responsible for creating a topic (discussion) for a node. This action can then be used from the "Run Action" option in the node details page or can be setup as a rule on a space. This means you could then setup a rule to add a topic to any content created in certain spaces in your repository.

Have a look at the following wiki pages:

http://wiki.alfresco.com/wiki/Custom_Actions
http://wiki.alfresco.com/wiki/Custom_Action_UI

damodar
Champ in-the-making
Champ in-the-making
Thanks Gavin,

I created a custom propertey and I configured it as list box using constraint, It is working fine. Now I am stucking in configuring it in advanced search.

I configured it for advanced search like below


<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
<type name="cm:content" />
</content-types>
<custom-properties>
<meta-data type="cm:content" property="cm:docRating" />
</custom-properties>
</advanced-search>
</config>


Here docRating is my custom property, Now it is getting as text field I wanted it to be list box like which is there in the property sheet.

Can you please guide me how to get my custom property in the advanced search as list box.

Thanks in Advance…
Damodar

gavinc
Champ in-the-making
Champ in-the-making
You are going to have to customise UISearchCustomProperties.

This class is responsible for generating the UI controls for each property being displayed. Currently this class does not support the component generator framework used by the property sheet component. You'll therefore need to add support for creating the drop down list.

Have a look at TextFieldGenerator and BaseComponentGenerator for the code that does this.

damodar
Champ in-the-making
Champ in-the-making
Hi,

By taking the help of http://wiki.alfresco.com/wiki/Custom_Actions   I created a custom action, in that I implemented  executeImpl method  as below

public void executeImpl(Action action, NodeRef actionedUponNodeRef)
   {
     
     
   
        // Check that the node still exists
      if (this.nodeService.exists(actionedUponNodeRef) == true)
      {
       
        String ndid=actionedUponNodeRef.id;       

        System.out.println("Inside FeedBackActionExecuter.executeImpl");
        String beanName = "CreateDiscussionDialog";
         Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName);

          if (bean == null)
          {
             System.out.println("Inside FeedBackActionExecuter.executeImpl: Bean is null");

             throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName +
                   "' has not been defined");
          }
         
          // make sure the bean implements the IDialogBean interface
          CreateDiscussionDialog dialog = null;
          if (bean instanceof CreateDiscussionDialog)
          {
             System.out.println("Inside FeedBackActionExecuter.executeImpl: Got the dialog");

             dialog = (CreateDiscussionDialog)bean;
          }
          else
          {
             throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName +
                   "' does not implement the required CreateDiscussionDialog interface");
          }
         
         
          // initialise the managed bean
//          dialog.init(action.getParameterValues());
       
         System.out.println("Inside FeedBackActionExecuter.executeImpl: Creating Topic");

       dialog.createTopic(ndid);
         System.out.println("Inside FeedBackActionExecuter.executeImpl: Created Topic");
      

      }
    
   }

Now It is redirecting to discussion dilog ui, which I don't want that.

I wanted a default custom topic called "Feed back" should be added to the content when it is creating or adding the content, and It should be allowed all viewers to pot their feedback.

Can you please give some clue on this.

Thanks in advance..
Damodar[/img]

gavinc
Champ in-the-making
Champ in-the-making
In CreateDiscussionDialog there is the following code

this.browseBean.clickSpace(forumNodeRef);‍

This sets up the context required to navigate to the desired space. You could try doing this in your action but setting the nodeRef to the node representing the topic instead of the parent forum object.

naveenkumar
Champ in-the-making
Champ in-the-making
i am using two drop down lists. Depending on the value selected in the first drop-down list I want to select a corresponding constraint to populate the second-drop down list.

For Example, If the first drop-down has values sports and academics, if the value sports is selected, the second drop-down must list swimming, running, etc. If the value academics is selected in the first drop-down, the second drop-down must show the values maths, science,etc…

Please any one suggest an idea to implement this… Now i am able to populate all the values in the second drop down list….


Thanks
Naveen

gavinc
Champ in-the-making
Champ in-the-making
You basically need to add an valueChangeListener to your component, the method that you provide in the value binding expression will get called, you can then change the List of values that will be used by the second drop down.