Hi All,
i developed a loginform.bxml where there are two fields and button to
submit.Once the submit the login form i want to lload the another home.bxml
file.
check the files........
loginform.bxml
<layout:Loginform title="Forms" maximized="true"
xmlns:bxml="http://pivot.apache.org/bxml"
xmlns:layout="a.b.c"
xmlns="org.apache.pivot.wtk">
<Border styles="{padding:6}">
<TablePane>
<columns>
<TablePane.Column width="1*"/>
</columns>
<TablePane.Row height="-1" >
<ImageView image="@logo.gif"/>
<Separator/>
</TablePane.Row>
<TablePane.Row height="-1" >
<Separator/>
</TablePane.Row>
<TablePane.Row height="1*">
<Form>
<Form.Section heading="Login">
<BoxPane bxml:id="nameBoxPane1"
Form.label="Username" styles="{horizontalAlignment:'center',
verticalAlignment:'center'}">
<TextInput bxml:id="user" prompt="username"/>
</BoxPane>
<BoxPane Form.label="Password"
styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
<TextInput bxml:id="pass" prompt="password"/>
</BoxPane>
<BoxPane
styles="{horizontalAlignment:'center',
verticalAlignment:'center'}">
<PushButton bxml:id="submitButton"
buttonData="Submit"
styles="{minimumAspectRatio:3}"/>
</BoxPane>
</Form.Section>
</Form>
</TablePane.Row>
</TablePane>
</Border>
</layout:Loginform>
Loginform.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package a.b.c;
import java.net.URL;
import org.apache.pivot.collections.HashMap;
import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.beans.Bindable;
import org.apache.pivot.collections.Map;
import org.apache.pivot.tutorials.stocktracker.StockTrackerWindow;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.ApplicationContext.DisplayHost;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
import org.apache.pivot.wtk.BoxPane;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Form;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.MessageType;
import org.apache.pivot.wtk.Prompt;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.TextInput;
import org.apache.pivot.wtk.Window;
public class Loginform extends Window implements Bindable {
private BoxPane nameBoxPane = null;
private TextInput usernameTextInput = null;
private TextInput passwordTextInput = null;
private PushButton submitButton = null;
private Label errorLabel = null;
@Override
public void initialize(Map<String, Object> namespace, URL
location, Resources resources) {
nameBoxPane = (BoxPane)namespace.get("nameBoxPane1");
usernameTextInput = (TextInput)namespace.get("user");
passwordTextInput = (TextInput)namespace.get("pass");
submitButton = (PushButton)namespace.get("submitButton");
errorLabel = (Label)namespace.get("errorLabel");
DisplayHost displayHost = new DisplayHost();
final Display display = new Display(displayHost);
Window window=null;
final Map<String, String> properties =new HashMap<String,
String>();
submitButton.getButtonPressListeners().add(new ButtonPressListener()
{
@Override
public void buttonPressed(Button button) {
close();
String lastName = usernameTextInput.getText();
String firstName = passwordTextInput.getText();
BXMLSerializer bxmlSerializer = new BXMLSerializer();
try{
final Window window =
(Forms)bxmlSerializer.readObject(getClass().getResource("forms.bxml"));
Window newWindow = new Window();
newWindow.open(getDisplay());
//close();
// window.open(display);
}catch (Exception e) {
}
//DesktopApplicationContext.main(HelloWTKX.class, null);
}
/*Form.Flag flag = null;
if (lastName.length() == 0 || firstName.length() == 0) {
flag = new Form.Flag(MessageType.ERROR, "Name is
required.");
}
Form.setFlag(nameBoxPane, flag);
if (flag == null) {
errorLabel.setText(null);
Prompt.prompt(lastName+" "+firstName, Loginform.this);
} else {
errorLabel.setText("Some required information is
missing.");
}*/
//lastNameTextInput.setText("Naren");
});
}
}
please tell me what are the changes required.
Thanks
prasad6779
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/login-page-problem-tp3151174p3151174.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.