Commits

Hector Miuler Malpica Gallegos  committed f1c6e77 Draft

Cambios menores, se agrego plugin para sbt para convertir a
proyecto eclipse, se grego libreria logback

  • Participants
  • Parent commits 969bd4b

Comments (0)

Files changed (9)

 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/main/scala"/>
-	<classpathentry kind="src" path="src/test/scala"/>
+	<classpathentry kind="src" output="target/scala-2.9.1/classes" path="src/main/scala"/>
+	<classpathentry kind="src" output="target/scala-2.9.1/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/scala-2.9.1/test-classes" path="src/test/scala"/>
+	<classpathentry kind="src" output="target/scala-2.9.1/test-classes" path="src/test/java"/>
+	<classpathentry kind="src" output="target/scala-2.9.1/classes" path="src/main/resources"/>
+	<classpathentry kind="lib" path="lib/gtk.jar"/>
 	<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-	<classpathentry kind="lib" path="lib/gtk.jar"/>
-	<classpathentry kind="output" path="target"/>
+	<classpathentry kind="lib" path="/home/miuler/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.0.6.jar"/>
+	<classpathentry kind="lib" path="/home/miuler/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.0.6.jar"/>
+	<classpathentry kind="lib" path="/home/miuler/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.5.jar"/>
+	<classpathentry kind="lib" path="/home/miuler/.ivy2/cache/junit/junit/jars/junit-4.10.jar"/>
+	<classpathentry kind="lib" path="/home/miuler/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.1.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="target/scala-2.9.1/classes"/>
 </classpath>
 target
+.cache
-<?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>blacknote</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.scala-ide.sdt.core.scalabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.scala-ide.sdt.core.scalanature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
+  <name>BlackNote</name>
+  <buildSpec>
+    <buildCommand>
+      <name>org.scala-ide.sdt.core.scalabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.scala-ide.sdt.core.scalanature</nature>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
 version := "1.0"
 
 
+// ==================================================================
+// DEPENDENCIES - COMPILE
+libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.0.6"
+
+// DEPENDENCIES - TEST
+libraryDependencies += "junit" % "junit" % "4.10"	% "test"
+// ==================================================================
+/usr/share/java/gtk.jar

File project/plugins.sbt

+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")

File src/main/resources/logback.xml

+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+  <consolePlugin/>
+  <!-- %relative %level [%thread] %logger{25} %message %nopex -->
+  
+  <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss,GMT} %-5p [%t] %c{10} %X{hub}/%X{device}/%X{channel} %m%n</pattern>
+    </encoder>
+  </appender>
+  
+  <root level="WARN">
+    <appender-ref ref="console"/>
+  </root>
+  
+  
+</configuration>

File src/main/scala/com/miuler/blacknote/BlackNote.scala

 import org.gnome.gdk.Event
 import org.gnome.gtk.Window.DeleteEvent
 import org.gnome.gtk.Button
+import org.gnome.gtk.CellRendererText
 import org.gnome.gtk.ComboBox
+import org.gnome.gtk.DataColumn
+import org.gnome.gtk.DataColumnString
 import org.gnome.gtk.Entry
 import org.gnome.gtk.Gtk
 import org.gnome.gtk.HBox
 import org.gnome.gtk.VBox
 import org.gnome.gtk.Widget
 import org.gnome.gtk.Window
-import Events.newMethodEventsToWindow
-import org.gnome.gtk.DataColumnString
-import org.gnome.gtk.DataColumn
-import org.gnome.gtk.CellRendererText
+
+import com.miuler.blacknote.Events.newMethodEventsToWindow
 
 class WindowConnect(window: Window) {
 
   }
 }
 
+
 object Events {
   implicit def newMethodEventsToWindow(window: Window) : WindowConnect = new WindowConnect(window)
 }
 
 
 
-
 class BlackNote() extends Window {
   
   println("BlackNote")
   val nombre = "Miuler"
+  val vBox = new VBox(false, 0)
+  
   initWindow()
+  initComboBox()
+  initButton()
+  showAll ()
   
+  private def initWindow() {
+    setDefaultSize(300, 200)
+  }
   
-  def initWindow() {
-    // ------------------------------------------------------------------------
-    this.setDefaultSize(300, 200)
-    val vBox = new VBox(false, 0)
+  private def initButton() {
+    val button = new Button("clickeame")
+    vBox.add(new Button("clickeame1"))
+    vBox.add(new Button("clickeame2"))
+    this.connect2(classOf[Window.DeleteEvent], onDeleteEvent)
+  }
+  
+  private def initComboBox() {
     val hBox = new HBox(false, 20)
     hBox.setBorderWidth(5)
+    hBox.add(new Label("Buscar :"))
     vBox.add(hBox)
     add(vBox)
     
     // ------------------------------------------------------------------------
-    hBox.add(new Label("Buscar :"))
-    
+    val firstColumnString = new DataColumnString()
+    val secondsColumnString = new DataColumnString()
+    val arrayColumns = Array[DataColumn](firstColumnString, secondsColumnString)
+    val model = new ListStore(arrayColumns)
+    val comboBox = new ComboBox(model, new Entry())
+    hBox.add(comboBox)
     // ------------------------------------------------------------------------
-    val firstColumnString = new DataColumnString()
-    val columns = Array[DataColumn](firstColumnString)
-    val model = new ListStore(columns)
-    val entry = new Entry()
-    val comboBox = new ComboBox(model, entry)
     val cellRendererText = new CellRendererText(comboBox)
     cellRendererText.setText(firstColumnString)
-    hBox.add(comboBox)
+    val cellRendererText2 = new CellRendererText(comboBox)
+    cellRendererText2.setText(secondsColumnString)
     // ------------------------------------------------------------------------
     var row = model.appendRow()
-    model.setValue(row, firstColumnString, "Miuler1")
+    model.setValue(row, firstColumnString, "Hector")
+    model.setValue(row, secondsColumnString, "Miuler")
     row = model.appendRow()
-    model.setValue(row, firstColumnString, "Miuler2")
+    model.setValue(row, firstColumnString, "Hector2")
+    model.setValue(row, secondsColumnString, "Miuler2")
     
-    // ------------------------------------------------------------------------
-    val button = new Button("clickeame")
-    vBox.add(new Button("clickeame1"))
-    vBox.add(new Button("clickeame2"))
-    this.connect2(classOf[Window.DeleteEvent], onDeleteEvent)
-
-    showAll ()
   }
   
   def onDeleteEvent (source: Widget, event: Event) = {
     Gtk.mainQuit
     false
   }
+  
 }
 
 

File src/main/scala/com/miuler/blacknote/Main.scala

 package com.miuler.blacknote
 
 import org.gnome.gtk.Gtk
-import org.gnome.gtk.GtkVBox
+import org.slf4j.LoggerFactory
 
 object Main {
+  
+  var log = LoggerFactory.getLogger(Main.getClass)
 
   def main(args: Array[String]) {
+    log.error("Inicio de la aplicacion")
+    log.warn("Inicio de la aplicacion")
+    log.info("Inicio de la aplicacion")
+    log.debug("Inicio de la aplicacion")
     Gtk.init(null)
     val prueba = new BlackNote()
     Gtk.main()