Package omnom.jaxb

Examples of omnom.jaxb.RecipeType


                Integer.parseInt(timeTextField.getText());
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, "You can't add anything that isn't a number in the 'Preparation Time' Field");
                return;
            }
            RecipeType recipe = new RecipeType();
            recipe.setName(nameTextField.getText());
            recipe.setServes(Integer.parseInt(servesTextField.getText()));
            recipe.setPrepareTime(Integer.parseInt(timeTextField.getText()));
            List<IngredientType> temp = recipe.getIngredients();
            temp.addAll(ingredients);
            List<String> steps = recipe.getSteps();
            String[] raw = jTextArea1.getText().replaceAll("\t", "").split("\n");
            for (String s : raw) {
                if (!s.equals("")) {
                    steps.add(s);
                }
View Full Code Here


            recipeList.setSelectedIndex(lastClicked);
        }
        if (DatabaseHandler.isConnected()) {
            int index = recipeList.locationToIndex(evt.getPoint());
            if (index >= 0) {
                RecipeType recipe = DatabaseHandler.recipeByNum(DatabaseHandler.getRecipeByName((String) recipeListModel.get(index)));
                while (ingredientModel.getRowCount() > 0) {
                    ingredientModel.removeRow(0);
                }
                List<IngredientType> ingredients = recipe.getIngredients();
                for (IngredientType i : ingredients) {
                    String[] temp = new String[2];
                    temp[0] = i.getName();
                    if (i.getNumerator() == 0) {
                        temp[1] = "";
                    } else if (i.getDenominator() == 0) {
                        temp[1] = "" + i.getNumerator();
                    } else {
                        temp[1] = i.getNumerator() + "/" + i.getDenominator();
                    }
                    temp[1] += " " + i.getUnit();
                    ingredientModel.addRow(temp);
                }
                int counter = 1;
                String instructions = "";
                for (String s : recipe.getSteps()) {
                    instructions += counter + ":   " + s + "\n\n";
                    counter++;
                }
                instructionTextField.setText(instructions);
            }
View Full Code Here

TOP

Related Classes of omnom.jaxb.RecipeType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.