金細工師としての仕事用のサイトが必要です。プログラミングの経験が「ある程度」あるので、自分でやろうと思っていましたが、仕事の画像と基本的な連絡先情報を表示するためのサイトにすぎません。
私がやろうとしていることは、基本的にこれです:
宝石の画像/レンダリングをこのようなフォルダー構造に入れます
- public
- - images
- - - creations
- - - - JewelSet1
- - - - - Jewel1
- - - - - - img1
- - - - - - img2
- - - - - - img3
- - - - - Jewel2
- - - - JewelSet2
- - - - - Jewel3
- - javascripts
- - stylesheets
メソッドが初めて呼び出されると、public static Result index()
public/images/creations を検索し、作成した 3 つのオブジェクト (CreationSet、Image、Creation) にフォルダを分類する必要があります。これらは基本的に次のとおりです。
package models;
import java.awt.image.BufferedImage;
import play.db.ebean.Model;
import play.data.validation.Constraints;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Image extends Model{
@Id
public String id;
@Constraints.Required
public BufferedImage img = null;
@Constraints.Required
public String desc;
}
@Entity
public class Creation extends Model {
@Id
public String id;
@Constraints.Required
public String name;
@Constraints.Required
public String desc;
public List<Image> images = new ArrayList<Image>();
public void addImage(int priority, Image img){
images.add(priority, img);
}
}
@Entity
public class CreationSet extends Model {
@Id
public String id;
@Constraints.Required
public String name;
@Constraints.Required
public String desc;
public List<Creation> creations = new ArrayList<Creation>();
public void addCreations(int priority, Creation creation){
creations.add(priority, creation);
}
}
次に、 のリストをたどりCreationSet
、html-templates で適切な HTML を生成します。
これは正しい方法ですか?または、どのようにすればよいですか?