के साथ लेआउट समस्याएं मेरे पास एक सामग्रीपैन है जो पूरी विंडो फिट बैठता है। इसमें एक शीर्ष कॉम्पोनेंट, केंद्र में एक विजेट है, और एक नीचे कॉम्पोनेंट है।GXT (Ext-GWT): ContentPanel
मैं लेआउट समस्याओं हो रही है, जब मैं topComponent के लिए विजेट जोड़ने की कोशिश के बाद ContentPanel एक बार गाया कर दिया गया है
public void onModuleLoad() {
final Viewport viewport = new Viewport();
viewport.setLayout(new FitLayout());
final ContentPanel contentPanel = new ContentPanel(new FitLayout());
contentPanel.setHeaderVisible(false);
final LayoutContainer topContainer = new LayoutContainer(
new FlowLayout());
final Button buttonOne = new Button("Top:One");
topContainer.add(buttonOne);
contentPanel.setTopComponent(topContainer);
contentPanel.add(new Button("Center"));
contentPanel.setBottomComponent(new Button("Bottom"));
viewport.add(contentPanel);
RootPanel.get().add(viewport);
// Later, add a second button to the topComponent ...
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
final Button buttonTwo = new Button("Top:Two");
topContainer.add(buttonTwo); // Doesn't show up at first.
topContainer.layout(); // Now, buttonTwo shows up. But we have
// a new problem: the "Bottom" button disappears...
contentPanel.layout(true); // This doesn't do anything, BTW.
}
});
}
इस बारे में एक दिलचस्प बात यह है, कि लेआउट में ही सही करती है, के रूप में जल्द क्योंकि मैं ब्राउज़र विंडो का आकार बदलता हूं। मैं इसे फिर से लेआउट सही ढंग से करने के लिए क्या कर सकता हूं (मैंने कई स्थानों और संयोजनों में कई layout()
कॉल इत्यादि जोड़ने की कोशिश की है, लेकिन अब तक कोई भाग्य नहीं है।)
(मैं जीडब्ल्यूटी का उपयोग कर रहा हूं GXT 2.2.1 के साथ 2.1.1।)
"हो रही लेआउट समस्याओं" क्या मतलब है? –
@ ट्रेविस: मेरे कोड में टिप्पणियों की तरह उल्लेख करें: पहले बटन पर दो दिखाई नहीं देते हैं। फिर, जब मैं लेआउट() को कॉल करता हूं, तो यह दिखाता है। लेकिन अब "नीचे" बटन गायब हो जाता है।जैसे ही मैं विंडो को मैन्युअल रूप से आकार देता हूं (यहां तक कि केवल एक पिक्सेल), लेआउट स्वयं को सुधारता है, यानी सभी बटन दिखाए जाते हैं। –