private void createPresetCombo() {
    JLabel myTimelineLabel = new JLabel("timeline");
    myTimelineLabel.setFont(SwingGuiConstants.ARIAL_11);
    add(myTimelineLabel);
    CCNIOUtil.createDirectories(CCNIOUtil.dataPath("settings"));
    _myPresetList = new JComboBox<String>();
    _myPresetList.setEditable(true);

    _myPresetList.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent theE) {
            if (_myEventPoint == null) return;
            switch (theE.getStateChange()) {
              case ItemEvent.SELECTED:
                _myEventPoint.content(
                    new TimedEventPointContent(_myPresetList.getSelectedItem().toString()));
                _myController.view().render();
                break;
            }
          }
        });

    CCUIStyler.styleTransportComponent(_myPresetList, 120, 20);
    _myPanel.add(_myPresetList);
  }
  public CCGLProgramInterface(String theFunctionName) {
    _myFunctionName = theFunctionName;
    _myInterfaceAppend = theFunctionName + id++;

    List<String> mySource =
        CCNIOUtil.loadStrings(CCNIOUtil.classPath(this, getClass().getSimpleName() + ".glsl"));
    List<String> myUniforms = new ArrayList<>();
    StringBuffer mySourceBuffer = new StringBuffer();
    for (String myLine : mySource) {
      if (myLine.startsWith("uniform")) {
        String[] myParts = myLine.split(Pattern.quote(" "));
        mySourceBuffer.append("uniform ");
        mySourceBuffer.append(myParts[1]);
        mySourceBuffer.append(" ");
        mySourceBuffer.append(parameter(myParts[2]));
        myUniforms.add(myParts[2].replace(";", ""));
        mySourceBuffer.append("\n");
      } else if (myLine.contains("function")) {
        myLine = myLine.replace("function", parameter("function"));
        mySourceBuffer.append(myLine);
        mySourceBuffer.append("\n");
      } else {
        for (String myUniform : myUniforms) {
          myLine = myLine.replace(myUniform, parameter(myUniform));
        }
        mySourceBuffer.append(myLine);
        mySourceBuffer.append("\n");
      }
    }
    mySourceBuffer.append("\n");
    _mySource = mySourceBuffer.toString();
  }
示例#3
0
  private void loadSettings(final String theFile) {
    CCXMLElement myProcessXML = CCXMLIO.createXMLElement(CCNIOUtil.dataPath(theFile));
    System.out.println(CCNIOUtil.dataPath(theFile));
    CCXMLElement myStartTimeXML = myProcessXML.child("starttime");
    if (myStartTimeXML != null) _myStartTime = myStartTimeXML.intContent(0);

    CCXMLElement myRestartTimeXML = myProcessXML.child("restarttime");
    if (myRestartTimeXML != null) _myRestartTime = myRestartTimeXML.intContent(0);

    CCXMLElement myClassNameXML = myProcessXML.child("class");
    if (myClassNameXML == null)
      throw new RuntimeException("You have to define a class to start inside the process.xml!");
    _myClassName = myClassNameXML.content();

    CCXMLElement myClassPathXML = myProcessXML.child("classpath");
    if (myClassPathXML == null)
      throw new RuntimeException("You have to define a classpath inside the process.xml!");

    for (CCXMLElement myLibXML : myClassPathXML) {
      _myLibraries.add(myLibXML.content());
    }

    CCXMLElement myVMParametersXML = myProcessXML.child("vm_options");
    if (myVMParametersXML != null) {
      for (CCXMLElement myVMParameterXML : myVMParametersXML) {
        _myVirtualMachineOptions.add(myVMParameterXML.content());
      }
    }

    loadRestartOptions(myProcessXML.child("restart"));
  }
 public void setPresets(CCObjectPropertyHandle theObjectHandle) {
   _myPresetsPath = theObjectHandle.presetPath();
   CCNIOUtil.createDirectories(_myPresetsPath);
   _myPresetList.removeAllItems();
   for (Path myPath : CCNIOUtil.list(_myPresetsPath, "json")) {
     _myPresetList.addItem(CCNIOUtil.fileName(myPath.getFileName().toString()));
   }
 }