Wednesday, December 26, 2012

Rich Visualforce Editor Updates

Hi Guys, I am happy to announce new version of Rich Visualforce Plugin. I have added some exciting features to this release. The major change is you can use it with standalone version of force.com IDE.

Major features of this release:-

  • GIT Integration (it helps you to push your code to git repository on Ctrl+S key press.)
  • Added support for new visualforce tags.
  • Plugin works well with both force.com IDE as well as force.com eclipse plugins.


GIT Integration
Force.com IDE/Plugin never supported code versioning and many times I felt its necessity and added a new feature to this release. Now you can configure your project with GIT repository and this plugin provides git push on save event of apex page and class.

Added new visualforce tags support
Now plugin supports visulaforce tags introduced till 26 version of the API


Friday, December 14, 2012

Code snippet for salesforce multiselect picklist


Salesforce Multiselect Picklist

Hi Guys, we generally use multiselect picklist in salesforce here is an example of multiselect picklist.. which allows to show fields based on selected options.

see running example on http://ajayhada.force.com/MultiSelectTest 

---------- MultiSelectExample.page------------------
<apex:page controller="MultiselectExample">
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  <apex:form id="form">
  <div style="border:1px solid gray;width:100%;float:left;">
    <div style="border:1px solid gray;width:50%;float:left;">
        <apex:panelGrid columns="3" id="multipicklistbox">
            <apex:selectList id="sel1" value="{!leftselected}" multiselect="true" style="width:200px" size="8">
                <apex:selectOptions value="{!leftBoxValues}" />
            </apex:selectList>
                <apex:panelGroup >
                    <br/>
                    <apex:commandButton value=">" action="{!addtoLeftBox}" reRender="form" title="Select Objects"/>
                    <br/><br/>
                    <apex:commandButton value="<" action="{!addtoRightBox}" reRender="form" title="Deselect Objects"/>
                </apex:panelGroup>
            <apex:selectList id="sel2" value="{!rightselected}" multiselect="true" style="width:200px" size="8">
                <apex:selectOptions value="{!rightBoxValues}" />
            </apex:selectList>
        </apex:panelGrid><br/>
         <apex:inputText id="other" label="Other Text" rendered="{!IsOtherOptionSelected}"/>
    </div>
    <div style="border:1px solid gray;width:48%;float:left;">
    <apex:outputPanel id="selectedItems">
        {!rightBoxValues}
    </apex:outputPanel>  
    </div>
  </div>
    <apex:commandButton value="Print Selected" reRender="selectedItems"/>
    </apex:form>
</apex:page>

---------- MultiSelectExample.cls------------------

public class MultiselectExample {
    Public List<string> leftSelected{get;set;}
    Public List<string> rightSelected{get;set;}
    Set<string> leftValues = new Set<string>();
    Set<string> rightValues = new Set<string>();
    Set<string> selectedObjects = new Set<string>();
    
    public MultiselectExample(){
        for(integer i=0;i<10;i++){
            leftValues.add('selectList Item '+i);
        }
        leftValues.add('Other Value');
    }
    
    /* Add item to rightbox of picklist*/
    public PageReference addtoLeftBox(){
        rightSelected.clear();
        for(String s : leftSelected){
            leftValues.remove(s);
            rightValues.add(s);
        }
        return null;
    }
    
    /* Add item to leftbox of picklist*/
    public PageReference addtoRightBox(){
        leftSelected.clear();
        for(String s : rightSelected){
            rightValues.remove(s);
            leftValues.add(s);
        }
        return null;
    }

        /* return rightbox values of picklist */
    public List<SelectOption> getLeftBoxValues(){
        List<SelectOption> options = new List<SelectOption>();
        List<string> tempList = new List<String>();
        tempList.addAll(leftValues);
        tempList.sort();
        for(string s : tempList)
            options.add(new SelectOption(s,s));
        return options;
    }
        
        /* return leftbox values of picklist */
    public List<SelectOption> getRightBoxValues(){
        List<SelectOption> options1 = new List<SelectOption>();
        List<string> tempList = new List<String>();
        tempList.addAll(rightValues);
        tempList.sort();
        for(String s : tempList)
            options1.add(new SelectOption(s,s));
        return options1;
    }
    
    public Boolean getIsOtherOptionSelected(){
        Boolean retValue = false;
        for(String selObj: rightValues ){
            if(selObj.contains('Other')){
                return true;
            }
        }
        return retValue;
    }
    
    public PageReference printSelectedValues(){
        return null;
    }
}



Tuesday, June 26, 2012

Rich Visualforce Editor

Hi Guys, I started learning Force.com platform in November 2011, After few days I got frustrated with force.com eclipse IDE. Reasons we all know well, no auto complete, no context sensitive help, no versioning support,  no active development for this plugin.

Being a Java guy I decided to write a new eclipse plugin to fill this gape so started an open source project on github with name “Rich Visualforce Editor”. After some research and development & little hard work I released alpha version of that plugin, later I couldn’t keep this progress continue and released only one more update with couple of more features and bug fixes. But now I decided to start working on this again with some new features list.

My friend Abhinav Gupta, he motivated me to write this plugin for force.com community, I am very thankful of him. He published couple of posts on his blogs to introduce this plugin to force.com community, you can read following posts from his blog.