Hello,
I have started a new application in which when i run the application in netbeans it shows:
Requested resource [VAADIN/themes/myTheme/favicon.ico]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Requested resource [VAADIN/themes/myTheme/favicon.ico]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Here is my code:
StockTrading.java
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
import com.vaadin.Application;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.SplitPanel;
import com.vaadin.ui.Window;
/**
*
-
@author Ankit
*/
public class StockTrading extends Application {Window mainWindow = null;
SplitPanel contentSplit = null;
Panel stockPanel = null;
Label label = new Label(“STOCK TRADING ACCOUNTING”);
StockForm sf = null;@Override
public void init() {setTheme("myTheme"); mainWindow = new Window("Stock Trading"); sf = new StockForm(); stockPanel = new Panel("STOCK ENTRY FORM"); stockPanel.setHeight("100%"); stockPanel.setContent(sf.makeStockForm()); System.out.println("After Form"); contentSplit = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL); contentSplit.setSplitPosition(30); contentSplit.setFirstComponent(label); contentSplit.setSecondComponent(stockPanel); System.out.println("after completion"); mainWindow.addComponent(contentSplit); setMainWindow(mainWindow);
}
}
StockForm.java
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
/**
*
-
@author Ankit
*/
public class StockForm {VerticalLayout formVert = null;
VerticalLayout contractDetailsGrid = null;
TextField contract_no = null;
TextField contract_date = null;
OptionGroupsExample op = null;public VerticalLayout makeStockForm() {
formVert = new VerticalLayout(); op = new OptionGroupsExample(); System.out.println("After Option"); contractDetailsGrid = new VerticalLayout(); contractDetailsGrid.setCaption("Contract Details"); contract_no = new TextField("Contract Note #"); contract_date = new TextField("Contract Date"); contractDetailsGrid.addComponent(contract_no); contractDetailsGrid.addComponent(contract_date); contractDetailsGrid.addComponent(op); formVert.addComponent(contractDetailsGrid); return formVert;
}
public static void main(String args){
StockForm stf = new StockForm();
stf.makeStockForm();}
public void setFormReadOnly(boolean readOnly) {
contract_no.setReadOnly(readOnly);
contract_date.setReadOnly(readOnly);}
}
OptionGroupsExample.java
import java.util.Arrays;
import java.util.List;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.AbstractSelect.Filtering;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.PopupDateField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
@SuppressWarnings(“serial”)
public class OptionGroupsExample extends VerticalLayout implements Property.ValueChangeListener {
GridLayout option = null;
GridLayout stk = null;
GridLayout opt = null;
GridLayout fut = null;
GridLayout amount = null;
VerticalLayout main = null;
private static final List<String> stock_option = Arrays.asList(new String[] {
"FUTIDX", "OPTIDX", "FUTSTK", "OPTSTK", "STK" });
private static final String[] stock_name = new String[]
{ “Bank of Rajasthan”, “RIL”,
“RCOMM”, “Ranbaxy”, “Indian OIL”, “Infosys”, “Wipro” };
private static final String index_type = new String
{ “Nifty”, “BSE” };
private static final String stock_type = new String
{ “Nifty”, “BSE” };
private static final String trade_type = new String
{ “Buy”, “Sell” };
private PopupDateField datetime;
TextField qty = null;
TextField price = null;
TextField stp = null;
public OptionGroupsExample() {
option = new GridLayout(5,1);
opt = new GridLayout(3,1);
stk = new GridLayout(1,1);
fut = new GridLayout(2,1);
amount = new GridLayout(2,1);
option.setSpacing(true);
// 'Shorthand' constructor - also supports data binding using Containers
OptionGroup citySelect = new OptionGroup("Select", stock_option);
System.out.println("this is option");
citySelect.setNullSelectionAllowed(false); // user can not 'unselect'
citySelect.select("FUTIDX"); // select this by default
citySelect.setImmediate(true); // send the change to the server at once
citySelect.addListener(this); // react when the user selects something
option.addComponent(citySelect);
setSpacing(true);
addComponent(option);
}
/*
* Shows a notification when a selection is made. The listener will be
* called whenever the value of the component changes, i.e when the user
* makes a new selection.
*/
public void valueChange(ValueChangeEvent event) {
option.getWindow().showNotification("Selected Type: " + event.getProperty());
if (event.getProperty().toString().equals("STK")){
ComboBox trade = new ComboBox("Trade Type");
for (int i = 0; i < trade_type.length; i++) {
trade.addItem(trade_type[i]
);
}
trade.setFilteringMode(Filtering.FILTERINGMODE_OFF);
trade.setImmediate(true);
stk.addComponent(trade);
ComboBox desc = new ComboBox("Select");
for (int i = 0; i < stock_name.length; i++) {
desc.addItem(stock_name[i]
);
}
desc.setFilteringMode(Filtering.FILTERINGMODE_OFF);
desc.setImmediate(true);
stk.addComponent(desc);
qty = new TextField("Quantity");
price = new TextField("Price");
amount.addComponent(qty);
amount.addComponent(price);
addComponent(stk);
addComponent(amount);
}else if (event.getProperty().toString().equals("FUTIDX")){
ComboBox trade = new ComboBox("Trade Type");
for (int i = 0; i < trade_type.length; i++) {
trade.addItem(trade_type[i]
);
}
trade.setFilteringMode(Filtering.FILTERINGMODE_OFF);
trade.setImmediate(true);
fut.addComponent(trade);
ComboBox desc = new ComboBox("Select");
for (int i = 0; i < index_type.length; i++) {
desc.addItem(index_type[i]
);
}
desc.setFilteringMode(Filtering.FILTERINGMODE_OFF);
desc.setImmediate(true);
fut.addComponent(desc);
datetime = new PopupDateField("Expiration Date:");
datetime.setValue(new java.util.Date());
datetime.setResolution(PopupDateField.RESOLUTION_DAY);
datetime.setImmediate(true);
fut.addComponent(datetime);
qty = new TextField("Quantity");
price = new TextField("Price");
amount.addComponent(qty);
amount.addComponent(price);
addComponent(fut);
addComponent(amount);
}else if (event.getProperty().toString().equals("OPTIDX")){
ComboBox trade = new ComboBox("Trade Type");
for (int i = 0; i < trade_type.length; i++) {
trade.addItem(trade_type[i]
);
}
trade.setFilteringMode(Filtering.FILTERINGMODE_OFF);
trade.setImmediate(true);
opt.addComponent(trade);
ComboBox desc = new ComboBox("Select");
for (int i = 0; i < index_type.length; i++) {
desc.addItem(index_type[i]
);
}
desc.setFilteringMode(Filtering.FILTERINGMODE_OFF);
desc.setImmediate(true);
opt.addComponent(desc);
datetime = new PopupDateField("Expiration Date:");
datetime.setValue(new java.util.Date());
datetime.setResolution(PopupDateField.RESOLUTION_DAY);
datetime.setImmediate(true);
opt.addComponent(datetime);
stp = new TextField("Strike Price");
opt.addComponent(stp);
qty = new TextField("Quantity");
price = new TextField("Price");
amount.addComponent(qty);
amount.addComponent(price);
addComponent(opt);
addComponent(amount);
}else if (event.getProperty().toString().equals("FUTSTK")){
ComboBox trade = new ComboBox("Trade Type");
for (int i = 0; i < trade_type.length; i++) {
trade.addItem(trade_type[i]
);
}
trade.setFilteringMode(Filtering.FILTERINGMODE_OFF);
trade.setImmediate(true);
fut.addComponent(trade);
ComboBox desc = new ComboBox("Select");
for (int i = 0; i < stock_type.length; i++) {
desc.addItem(stock_type[i]
);
}
desc.setFilteringMode(Filtering.FILTERINGMODE_OFF);
desc.setImmediate(true);
fut.addComponent(desc);
datetime = new PopupDateField("Expiration Date:");
datetime.setValue(new java.util.Date());
datetime.setResolution(PopupDateField.RESOLUTION_DAY);
datetime.setImmediate(true);
fut.addComponent(datetime);
qty = new TextField("Quantity");
price = new TextField("Price");
amount.addComponent(qty);
amount.addComponent(price);
addComponent(fut);
addComponent(amount);
}else if (event.getProperty().toString().equals("OPTSTK")){
ComboBox trade = new ComboBox("Trade Type");
for (int i = 0; i < trade_type.length; i++) {
trade.addItem(trade_type[i]
);
}
trade.setFilteringMode(Filtering.FILTERINGMODE_OFF);
trade.setImmediate(true);
opt.addComponent(trade);
ComboBox desc = new ComboBox("Select");
for (int i = 0; i < stock_type.length; i++) {
desc.addItem(stock_type[i]
);
}
desc.setFilteringMode(Filtering.FILTERINGMODE_OFF);
desc.setImmediate(true);
opt.addComponent(desc);
datetime = new PopupDateField("Expiration Date:");
datetime.setValue(new java.util.Date());
datetime.setResolution(PopupDateField.RESOLUTION_DAY);
datetime.setImmediate(true);
opt.addComponent(datetime);
stp = new TextField("Strike Price");
opt.addComponent(stp);
qty = new TextField("Quantity");
price = new TextField("Price");
amount.addComponent(qty);
amount.addComponent(price);
addComponent(opt);
addComponent(amount);
}
}
public void main(String args[]){
OptionGroupsExample og = new OptionGroupsExample();
}
}
when i run it it will show grey color blank page.
Please help me out .
Thanks is advance