001package de.mikromedia.stableviews.model; 002 003import de.deepamehta.core.JSONEnabled; 004import de.deepamehta.plugins.topicmaps.model.TopicmapViewmodel; 005import java.util.logging.Level; 006import java.util.logging.Logger; 007import org.codehaus.jettison.json.JSONException; 008import org.codehaus.jettison.json.JSONObject; 009 010public class StableviewsTopicmapModel implements JSONEnabled { 011 012 JSONObject json = new JSONObject(); 013 014 public StableviewsTopicmapModel(TopicmapViewmodel topicmapViewmodel) { 015 json = topicmapViewmodel.toJSON(); 016 } 017 018 public void setMapStylesheet(String cssPath) { 019 try { 020 json.put("config", new JSONObject().put("dm4.topicmaps.stylesheet", cssPath)); 021 } catch (JSONException ex) { 022 Logger.getLogger(StableviewsTopicmapModel.class.getName()).log(Level.SEVERE, null, ex); 023 } 024 } 025 026 public JSONObject toJSON() { 027 return json; 028 } 029 030}