문제

I need a good way to maintain multiple form level data for menue selection. So for example If I have A and B, each might Have 1 2 3 so A A1 A2 A3 B B1 B2 B3

And this can continue for long, so that I could have A -> A1 -> A1.1 -> A1.1.1 -.... I have the following class in place, works ok But I suspect we could have better.

I just need to perform selection ni a selection tree like Widget, but each level of selection comes in another form (in J2ME)

import java.util.Vector;
 public class Tag {
    private String tag;
    private Vector childTags;
    private Tag parent;

    Tag(String tag, Vector childtag)
    {
        this.tag = tag;
        this.childTags= childTags;
    }

    public void setChildTags(Vector childTags) {
        this.childTags = childTags;
    }

    public Vector getChildTags() {
        return this.childTags;
    }

    public String getTag() {
        return this.tag;
    }


    public String toString(int depth)
    {
                String a  ="";
        if(depth==0)
        {
            a = a + this.getTag();
        }

        if(this.getChildTags()!= null)
        {

                    for(int k=0;k <this.getChildTags().capacity(); k++)
                      {
                                for (int i=0; i<depth; i++ ) {
                                        a = a + ("-");
                                }
                                a = a+ ( ((Tag)this.getChildTags().elementAt(k)).toString(depth++));
        }   }
    return a;
        }


}

올바른 솔루션이 없습니다

다른 팁

이 코드를 사용하여 MSDN에서 항목을 검색 할 수 있습니다.

// Starting with ClientContext, the constructor requires a URL to the 
// server running SharePoint. 
ClientContext context = new ClientContext("http:SiteUrl"); 

// Assume the web has a list named "Announcements". 
List announcementsList = context.Web.Lists.GetByTitle("Announcements"); 

// This creates a CamlQuery that has a RowLimit of 100, and also specifies Scope="RecursiveAll" 
// so that it grabs all list items, regardless of the folder they are in. 
CamlQuery query = CamlQuery.CreateAllItemsQuery(100); 
ListItemCollection items = announcementsList.GetItems(query); 

// Retrieve all items in the ListItemCollection from List.GetItems(Query). 
context.Load(items); 
context.ExecuteQuery(); 
foreach (ListItem listItem in items) 
{ 
 // We have all the list item data. For example, Title. 
  label1.Text = label1.Text + ", " + listItem["Title"]; 
} 
.

참조

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top