All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gdt.jgui.entity.graph.JWebGraph Maven / Gradle / Ivy

The newest version!
package gdt.jgui.entity.graph;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Properties;
import java.util.logging.Logger;

import javax.swing.JMenu;
import javax.swing.JPanel;

import org.apache.commons.codec.binary.Base64;

import gdt.data.entity.BaseHandler;
import gdt.data.entity.Bond;
import gdt.data.entity.EdgeHandler;
import gdt.data.entity.EntityHandler;
import gdt.data.entity.GraphHandler;
import gdt.data.entity.NodeHandler;
import gdt.data.grain.Core;
import gdt.data.grain.Locator;
import gdt.data.grain.Sack;
import gdt.data.store.Entigrator;
import gdt.data.store.StoreAdapter;
import gdt.jgui.base.JBaseNavigator;
import gdt.jgui.console.JConsoleHandler;
import gdt.jgui.console.JContext;
import gdt.jgui.console.JFacetRenderer;
import gdt.jgui.console.JMainConsole;
import gdt.jgui.console.JRequester;
import gdt.jgui.console.WContext;
import gdt.jgui.console.WUtils;
import gdt.jgui.entity.JEntityFacetPanel;
import gdt.jgui.entity.bonddetail.JBondDetailFacetOpenItem;
import gdt.jgui.entity.edge.JBondsPanel;

public class JWebGraph implements WContext {
static boolean debug=false;
//private JMainConsole console;
private String entihome$;
private String entityKey$;
private String entityLabel$;
public JWebGraph(){
	
}
	@Override
	public String getWebConsole(Entigrator entigrator , String locator$) {
		return null;
	}

	//@Override
	public  String getWebView(Entigrator entigrator, String locator$) {
		try{
			//boolean initSelector=false;
			Properties locator=Locator.toProperties(locator$);
			String webHome$=locator.getProperty(WContext.WEB_HOME);
			String entityLabel$=locator.getProperty(EntityHandler.ENTITY_LABEL);
			String edgeLabel$=locator.getProperty(JBondsPanel.EDGE_LABEL);
			String webRequester$=locator.getProperty(WContext.WEB_REQUESTER);
			String action$=locator.getProperty(JRequester.REQUESTER_ACTION);
			String filteredNodeLabels$=null;
			String[] sa=null;
			String shownLabels$=locator.getProperty(JGraphRenderer.SHOWN_NODES_LABELS);
			String nodeLabel$=locator.getProperty(JGraphRenderer.SELECTED_NODE_LABEL);
			if(shownLabels$!=null)
			 sa=Locator.toArray(shownLabels$);
			else
				sa=new String[]{entityLabel$}; 
			 
			if(debug)
				System.out.println("JWebGraph:web home="+webHome$+ " locator="+locator$);
				
			if(JGraphRenderer.ACTION_ENTITY.equals(action$)){
				//String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL);
				if(debug)
					System.out.println("JWebGraph:selected node="+nodeLabel$);
				if(nodeLabel$!=null){

				String nodeKey$=entigrator.indx_keyAtLabel(nodeLabel$);   
			    Properties foiLocator=new Properties();
			    foiLocator.setProperty(WContext.WEB_HOME,webHome$);
			    foiLocator.setProperty(WContext.WEB_REQUESTER,webRequester$);
			   	foiLocator.setProperty(BaseHandler.HANDLER_CLASS,JEntityFacetPanel.class.getName());
		    	foiLocator.setProperty(Entigrator.ENTIHOME,entigrator.getEntihome());
		    	foiLocator.setProperty(EntityHandler.ENTITY_KEY,nodeKey$);
				foiLocator.setProperty(EntityHandler.ENTITY_LABEL,nodeLabel$);
				JEntityFacetPanel efp=new JEntityFacetPanel();
				 return efp.getWebView(entigrator, Locator.toString(foiLocator));
				}
			}
			
			String entityKey$=entigrator.indx_keyAtLabel(entityLabel$);
			    Sack entity=entigrator.getEntityAtKey(entityKey$);
		    //    Core[]	ca=entity.elementGet("field");
			StringBuffer sb=new StringBuffer();
			sb.append("");
			sb.append("");
			sb.append("");
			
			sb.append(WUtils.getMenuBarScript());
			sb.append(WUtils.getMenuBarStyle());
			
			sb.append("");
			
			sb.append("");
			sb.append("");
		    sb.append("");
		    sb.append("
    "); sb.append("
  • Back
  • "); sb.append("
  • Home
  • "); String navLocator$=Locator.append(locator$, BaseHandler.HANDLER_CLASS, JBaseNavigator.class.getName()); navLocator$=Locator.append(navLocator$, Entigrator.ENTIHOME, entigrator.getEntihome()); String navUrl$=webHome$+"?"+WContext.WEB_LOCATOR+"="+Base64.encodeBase64URLSafeString(navLocator$.getBytes()); sb.append("
  • Base
  • "); // sb.append("
  • Base
  • "); sb.append("
  • "); sb.append("Context"); sb.append(""); sb.append("
  • "); sb.append("
  • About
  • "); sb.append("
"); sb.append(""); sb.append(""); sb.append("
Base:"); sb.append(entigrator.getBaseName()); sb.append("
Entity: "); sb.append(entityLabel$); sb.append("
Facet: Node
Context: Graph
"); sb.append(""); //initSelector=true; if(JGraphRenderer.ACTION_EDGE.equals(action$)&&shownLabels$!=null){ sa=EdgeHandler.filterNodesAtEdge(entigrator, sa, edgeLabel$); filteredNodeLabels$=Locator.toString(sa); } sb.append(""); sb.append(""); if(!JGraphRenderer.ACTION_EDGE.equals(action$)){ sb.append(""); sb.append(""); sb.append(""); } sb.append(""); sb.append("
"); sb.append(""); sb.append(""); sb.append("New tab"); sb.append("
"); sb.append("
");
		    sb.append("
"); // sb.append("
"); sb.append(""); sb.append("
    "); sb.append("
  • Details
  • "); sb.append("
"); if(debug) System.out.println("JWebGraph:getWebView:5"); if(action$==null) action$=JGraphRenderer.ACTION_RELATIONS; if(JGraphRenderer.ACTION_RELATIONS.equals(action$)){ //String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL); if(debug) System.out.println("JWebGraph:relations:selected node="+nodeLabel$); if(nodeLabel$!=null){ //nodeLabel$=nodeLabel$.replaceAll("\"", """); //nodeLabel$=nodeLabel$.replaceAll("'", "'"); // sb.append(getRelations(entigrator,entityKey$,nodeLabel$)); sb.append(getGraph(getRelations(entigrator, nodeLabel$))); //sb.append(getGraph(getScopeExpansion(entigrator, nodeLabel$,shownLabels$))); } } if(JGraphRenderer.ACTION_NETWORK_RELATIONS.equals(action$)){ //String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL); if(debug) System.out.println("JWebGraph:network relations:selected node="+nodeLabel$ +" shown labels="+shownLabels$); //nodeLabel$=nodeLabel$.replaceAll("\"", """); //nodeLabel$=nodeLabel$.replaceAll("'", "'"); // sb.append(getRelations(entigrator,entityKey$,nodeLabel$)); sb.append(getGraph(getNetworkRelations(entigrator, nodeLabel$,shownLabels$))); } if(JGraphRenderer.ACTION_SCOPE_RELATIONS.equals(action$)){ //String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL); if(debug) System.out.println("JWebGraph:scope relations:selected node="+nodeLabel$+" schown labels="+shownLabels$); //nodeLabel$=nodeLabel$.replaceAll("\"", """); //nodeLabel$=nodeLabel$.replaceAll("'", "'"); sb.append(getGraph(getScopeRelations(entigrator, nodeLabel$,shownLabels$))); } if(JGraphRenderer.ACTION_EXPAND.equals(action$)){ //String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL); //shownLabels$=locator.getProperty(SHOWN_NODES_LABELS); if(debug) System.out.println("JWebGraph:expansion:selected selection="+nodeLabel$+" nodes="+shownLabels$); // sb.append(getRelations(entigrator,entityKey$,nodeLabel$)); //nodeLabel$=nodeLabel$.replaceAll("\"", """); //nodeLabel$=nodeLabel$.replaceAll("'", "'"); sb.append(getGraph(getExpansion(entigrator, nodeLabel$,shownLabels$))); } if(JGraphRenderer.ACTION_NETWORK.equals(action$)){ //String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL); // shownLabels$=locator.getProperty(SHOWN_NODES_LABELS); if(debug) System.out.println("JWebGraph:network:selected selection="+nodeLabel$+" nodes="+shownLabels$); // sb.append(getRelations(entigrator,entityKey$,nodeLabel$)); //nodeLabel$=nodeLabel$.replaceAll("\"", """); //nodeLabel$=nodeLabel$.replaceAll("'", "'"); sb.append(getGraph(getNetwork(entigrator, nodeLabel$,shownLabels$))); } if(JGraphRenderer.ACTION_EDGE.equals(action$)){ //String nodeLabel$=locator.getProperty(SELECTED_NODE_LABEL); if(debug) System.out.println("JWebGraph:edge:label="+edgeLabel$+" selected selection="+nodeLabel$+" nodes="+shownLabels$); // sb.append(getRelations(entigrator,entityKey$,nodeLabel$)); //edgeLabel$=edgeLabel$.replaceAll("\"", """); //edgeLabel$=edgeLabel$.replaceAll("'", "'"); sb.append(getGraph(getEdge(entigrator, edgeLabel$,filteredNodeLabels$))); } sb.append(""); sb.append(""); sb.append(""); return sb.toString(); }catch(Exception e){ Logger.getLogger(JWebGraph.class.getName()).severe(e.toString()); } return null; } private static String getGraph( String dataSet$){ try{ StringBuffer sb=new StringBuffer(); sb.append(""); return sb.toString(); }catch(Exception e){ Logger.getLogger(JGraphFacetOpenItem.class.getName()).severe(e.toString()); } return null; } private static String getEdge(Entigrator entigrator, String edgeLabel$,String shownNodeslabels$){ try{ String[] scope=new String[0]; String[]sna=Locator.toArray(shownNodeslabels$); scope=new String[sna.length]; for(int i=0;i


© 2015 - 2025 Weber Informatics LLC | Privacy Policy