1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    25
    Answers
    1
    Vote Rating
    1
    sanbenwu is on a distinguished road

      0  

    Default Answered: the grid setForceFit(true) and setAutoFill(true) not effect of the expect

    Answered: the grid setForceFit(true) and setAutoFill(true) not effect of the expect


    i set the grid view like this:
    grid.getView().setForceFit(true);
    grid.getView().setAutoFill(true);
    but when i click the Maximizable the window resize and the grid fit to the window size
    but the ColumnConfig did't fit to the window size.(it's size didn't changed)
    only i click the header of the ColumnConfig it resize.
    how to do auto fit the window size ?
    my all code is this:


    public class RoleListWindow extends Window {
    private TreeLoader<JsonData> loader;
    private TreeStore<JsonData> store;
    private JsonDataProperties prop;
    private ColumnModel<JsonData> columnModel;
    private TreeGrid<JsonData> grid;
    private ToolBar toolBar;
    private AddRoleWindow addRoleWindow;
    private RoleListWindow myself=this;
    private final CheckBoxSelectionModel<JsonData> sm;





    @Override
    public void onShow() {
    getTreeLoader().load();
    sm.deselectAll();
    }





    private final String URL_OF_ROLE_LIST = Const.SERVER + "role!showList.do";
    private final String URL_OF_ROLE_DEL = Const.SERVER + "role!showdel.do";


    public RoleListWindow() {






    sm=new CheckBoxSelectionModel<JsonData>(new IdentityValueProvider<JsonData>());
    init();
    }






    public JsonDataProperties getProp() {
    if(this.prop==null)
    this.prop = GWT.create(JsonDataProperties.class);
    return this.prop;
    }
    public void setProp(JsonDataProperties prop) {
    this.prop = prop;
    }


    public TreeStore<JsonData> getStore() {
    if(this.store==null){
    this.store = new TreeStore<JsonData>(new ModelKeyProvider<JsonData>() {
    @Override
    public String getKey(JsonData item) {
    return item.getId().toString();
    }
    });
    }
    return this.store;


    }
    private ColumnModel<JsonData> getColumnModel() {
    if(this.columnModel==null){
    ColumnConfig<JsonData, Integer> id = new ColumnConfig<JsonData, Integer>(getProp().id(), 50, "ID");
    ColumnConfig<JsonData, String> name = new ColumnConfig<JsonData, String>(getProp().name(), 400, "name");
    name.setCell(new AbstractCell<String>() {
    @Override
    public void render(Context context, String value, SafeHtmlBuilder sb) {
    String key = "<span ".concat( " title='").concat(value).concat("'").concat(">").concat(value).concat("</span>");
    sb.appendHtmlConstant(key);
    }
    });
    ColumnConfig<JsonData, Integer> states = new ColumnConfig<JsonData, Integer>(getProp().states(), 50, "state");
    states.setCell(new AbstractCell<Integer>() {
    @Override
    public void render(Context context, Integer value, SafeHtmlBuilder sb) {
    String style = "style='color: " + (value.intValue() == 1 ? "red" : "green") + "'";
    String key = "<span ".concat(style).concat(">").concat(value.intValue() == 1 ? "YES" : "NO").concat("</span>");
    sb.appendHtmlConstant(key);
    }
    });
    List<ColumnConfig<JsonData, ?>> l = new ArrayList<ColumnConfig<JsonData, ?>>();
    l.add(sm.getColumn());


    l.add(id);
    l.add(name);
    l.add(states);
    this.columnModel= new ColumnModel<JsonData>(l);
    }
    return this.columnModel;
    }


    private TreeLoader<JsonData> getTreeLoader() {
    if(this.loader==null) {
    JsonGridAutoBeanFactory factory = GWT.create(JsonGridAutoBeanFactory.class);
    DataRecordJsonReader reader = new DataRecordJsonReader(factory, JSonDataRecordResult.class);
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, URL_OF_ROLE_LIST);


    HttpProxy<JsonData> jsonProxy = new HttpProxy<JsonData>(requestBuilder) {
    };
    jsonProxy.setWriter(new UrlEncodingWriter<JsonData>(factory, JsonData.class));
    this.loader = new TreeLoader<JsonData>(jsonProxy, reader) {
    @Override
    public boolean hasChildren(JsonData parent) {
    return parent.getParent();
    }
    };
    this.loader.addLoadHandler(new ChildTreeStoreBinding<JsonData>(getStore()));
    }


    return this.loader;


    }




    private TreeGrid<JsonData> getGrid() {
    if(grid==null){
    ColumnModel<JsonData> columnModel = getColumnModel();
    grid = new TreeGrid<JsonData>(getStore(), columnModel, columnModel.getColumns().get(1));
    grid.addRowDoubleClickHandler(new RowDoubleClickEvent.RowDoubleClickHandler() {
    @Override
    public void onRowDoubleClick(RowDoubleClickEvent event) {
    JsonData data = (JsonData) event.getSource().getSelectionModel().getSelectedItem();
    AddRoleWindow addRoleWindow = getAddRoleWindow();
    addRoleWindow.setAddorEdit(1);
    addRoleWindow.setLoader(getTreeLoader());
    addRoleWindow.setStateValue(data.getStates());
    addRoleWindow.getRoleName().setValue(data.getName());
    addRoleWindow.getRoleDesc().setValue(data.getDesc());
    addRoleWindow.getRoleParent().setText(data.getParentName());
    addRoleWindow.getRoleParentId().setValue(data.getParentId());
    addRoleWindow.show();
    }
    });
    grid.setBorders(true);
    grid.setTreeLoader(getTreeLoader());
    grid.getTreeView().setAutoFill(true);
    this.grid.getTreeView().setForceFit(true);


    grid.getView().setStripeRows(true);
    grid.getView().setColumnLines(true);
    grid.getView().setTrackMouseOver(true);
    grid.getView().setForceFit(true);
    grid.getView().setAutoFill(true);
    grid.getView().setAutoExpandColumn(columnModel.getColumns().get(1));
    sm.setSelectionMode(Style.SelectionMode.SINGLE);
    grid.setSelectionModel(sm);
    }
    return this.grid;
    }


    private ToolBar getToolBar() {
    if(null==this.toolBar){
    this.toolBar = new ToolBar();
    Image add = new Image(IconHelper.getImageResource(UriUtils.fromSafeConstant("images/folder/add_16.png"), 16, 16));
    add.setTitle("add");
    Image del = new Image(IconHelper.getImageResource(UriUtils.fromSafeConstant("images/folder/remove_16.png"), 16, 16));
    del.setTitle("delete");

    add.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {


    AddRoleWindow addRoleWindow = getAddRoleWindow();
    new MessageBox("allsll","ssss").show();
    new MessageBox("allll",addRoleWindow.getClass().getName()+AddRoleWindow.class.getName()).show();
    addRoleWindow.setAddorEdit(0);
    addRoleWindow.setLoader(getTreeLoader());
    addRoleWindow.setStateValue(null);
    addRoleWindow.getRoleName().setValue(null);
    addRoleWindow.getRoleDesc().setValue(null);
    addRoleWindow.getRoleParent().setText(null);
    addRoleWindow.getRoleParentId().setValue(null);


    // addRoleWindow.show();
    }
    });
    del.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
    List<JsonData> list = sm.getSelectedItems();
    if (null != list && !list.isEmpty()) {
    Iterator<JsonData> it = list.iterator();
    final StringBuffer id = new StringBuffer();
    StringBuffer name = new StringBuffer();
    while (it.hasNext()) {
    JsonData data = it.next();
    id.append(data.getId()).append(",");
    name.append(data.getName()).append("\n");
    }
    final ConfirmMessageBox confirm = new ConfirmMessageBox("", "");
    confirm.addHideHandler(new HideEvent.HideHandler() {
    public void onHide(HideEvent event) {
    if (confirm.getHideButton() == confirm.getButtonById(Dialog.PredefinedButton.YES.name())) {
    Ajax.asynPost(URL_OF_ROLE_DEL.concat("?ids=").concat(id.toString()), new RequestCallback() {


    @Override
    public void onResponseReceived(Request request, Response response) {
    //To change body of implemented methods use File | Settings | File Templates.
    getTreeLoader().load();
    }


    @Override
    public void onError(Request request, Throwable exception) {
    //To change body of implemented methods use File | Settings | File Templates.
    }
    });
    } else if (confirm.getHideButton() == confirm.getButtonById(Dialog.PredefinedButton.NO.name())) {
    new AlertMessageBox("", "N").show();
    }
    }
    });


    confirm.show();


    }
    }
    });
    this.toolBar.add(add);
    toolBar.add(del);
    toolBar.add(export) ;
    }
    return this.toolBar;
    }
    private AddRoleWindow getAddRoleWindow(){
    if(this.addRoleWindow==null) {
    this.addRoleWindow= (AddRoleWindow) MoudleFactory.moudleMap.get(AddRoleWindow.class.getName());
    this.addRoleWindow = null == this.addRoleWindow ? new AddRoleWindow() : this.addRoleWindow;
    }
    return this.addRoleWindow;
    }
    private void init() {
    FlowLayoutContainer con = new FlowLayoutContainer();
    con.add(getToolBar(), new VerticalLayoutContainer.VerticalLayoutData(1, -1));
    con.add(getGrid(), new VerticalLayoutContainer.VerticalLayoutData(1, 1));


    this.setPixelSize(defaultWidth, defaultHeight);
    con.setScrollMode(ScrollSupport.ScrollMode.AUTO);


    this.add(con);
    this.setHeadingText("role list");
    this.setBodyBorder(true);
    this.setMinimizable(true);
    this.setMaximizable(true);




    setOnEsc(false);




    }




    class DataRecordJsonReader extends JsonReader<List<JsonData>, JSonDataRecordResult> {
    public DataRecordJsonReader(AutoBeanFactory factory, Class<JSonDataRecordResult> rootBeanType) {
    super(factory, rootBeanType);
    }


    @Override
    protected List<JsonData> createReturnData(Object loadConfig, JSonDataRecordResult records) {
    List<JsonData> r = records.getRecords();
    return r;
    }


    }


    interface JsonData {
    public Integer getId();


    public String getName();


    public String getDesc();


    public boolean getParent();
    public Integer getParentId() ;
    public String getParentName() ;


    public Integer getStates();
    }


    class KeyProvider implements ModelKeyProvider<JsonData> {


    @Override
    public String getKey(JsonData item) {
    return item.getId().toString();
    }
    }


    interface JSonDataRecordResult {
    public List<JsonData> getRecords();


    }


    interface JsonGridAutoBeanFactory extends AutoBeanFactory {
    AutoBean<JSonDataRecordResult> items();


    }


    interface JsonDataProperties extends PropertyAccess<JsonData> {
    @Editor.Path("id")
    ModelKeyProvider<JsonData> key();


    ValueProvider<JsonData, Integer> id();


    ValueProvider<JsonData, String> name();


    ValueProvider<JsonData, String> desc();


    ValueProvider<JsonData, Boolean> parent();
    ValueProvider<JsonData, Integer> parentId();
    ValueProvider<JsonData, String> parentName();
    ValueProvider<JsonData, Integer> states();


    }




    }

  2. change the FlowLayoutContainer to VerticalLayoutContainer
    like this:

    FlowLayoutContainer con = new FlowLayoutContainer();


    con.add(getToolBar(), new VerticalLayoutContainer.VerticalLayoutData(1, -1));
    con.add(getGrid(), new VerticalLayoutContainer.VerticalLayoutData(1, 1));



    VerticalLayoutContainer con=new VerticalLayoutContainer();
    con.add(getToolBar(), new VerticalLayoutContainer.VerticalLayoutData(1, -1));
    con.add(getGrid(), new VerticalLayoutContainer.VerticalLayoutData(1, 1));

  3. #2
    Sencha User
    Join Date
    Dec 2012
    Posts
    25
    Answers
    1
    Vote Rating
    1
    sanbenwu is on a distinguished road

      1  

    Default


    change the FlowLayoutContainer to VerticalLayoutContainer
    like this:

    FlowLayoutContainer con = new FlowLayoutContainer();


    con.add(getToolBar(), new VerticalLayoutContainer.VerticalLayoutData(1, -1));
    con.add(getGrid(), new VerticalLayoutContainer.VerticalLayoutData(1, 1));



    VerticalLayoutContainer con=new VerticalLayoutContainer();
    con.add(getToolBar(), new VerticalLayoutContainer.VerticalLayoutData(1, -1));
    con.add(getGrid(), new VerticalLayoutContainer.VerticalLayoutData(1, 1));

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."