java.util.logging.Logger Java Examples

The following examples show how to use java.util.logging.Logger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: As3PCodeDocs.java    From jpexs-decompiler with GNU General Public License v3.0 6 votes vote down vote up
public static String getJs() {
    String cached = docsCache.get("__js");
    if (cached != null) {
        return cached;
    }
    String js = "";
    InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.js");
    if (is == null) {
        Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.js needed for documentation not found");
    } else {
        js = new String(Helper.readStream(is), Utf8Helper.charset);
    }

    docsCache.put("__js", js);
    return js;
}
 
Example #2
Source File: AssemblyLine.java    From Java-Coding-Problems with MIT License 6 votes vote down vote up
private static void startConsumers() {

        logger.info(() -> "We have a consumers team of "
                + PROCESSORS + " members ...");

        consumerService = Executors.newWorkStealingPool();
        // consumerService = Executors.newCachedThreadPool();
        // consumerService = Executors.newWorkStealingPool(PROCESSORS);
        // consumerService = Executors.newFixedThreadPool(PROCESSORS);
        int queueSize = queue.size();

        startTime = System.currentTimeMillis();
        for (int i = 0; i < queueSize; i++) {    
            consumerService.execute(consumer);
        }

        consumerService.shutdown();
        try {
            consumerService.awaitTermination(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
        } catch (InterruptedException ex) {
            Logger.getLogger(AssemblyLine.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
 
Example #3
Source File: FrameEmployee.java    From dctb-utfpr-2018-1 with Apache License 2.0 6 votes vote down vote up
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    jText.setText("");
    openFile();
    Employee e = new Employee();
    try {
        e = readRecords();
        jText.setText(""+e);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(FrameEmployee.class.getName()).log(Level.SEVERE, null, ex);
    }
    catch (IOException evento){
    
    }
    closeFile();
    
  

}
 
Example #4
Source File: CapsuleCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
     * Instantiate the configured shape in Bullet.
     */
    protected void createShape(){
        objectId = createShape(axis, radius, height);
        Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(objectId));
        setScale(scale);
        setMargin(margin);
//        switch(axis){
//            case 0:
//                objectId=new CapsuleShapeX(radius,height);
//            break;
//            case 1:
//                objectId=new CapsuleShape(radius,height);
//            break;
//            case 2:
//                objectId=new CapsuleShapeZ(radius,height);
//            break;
//        }
//        objectId.setLocalScaling(Converter.convert(getScale()));
//        objectId.setMargin(margin);
    }
 
Example #5
Source File: Logging.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialization function that is called to instantiate the logging system. It takes
 * logger names (keys) and logging labels respectively
 *
 * @param map a map where the key is a logger name and the value a logging level
 * @throws IllegalArgumentException if level or names cannot be parsed
 */
public static void initialize(final Map<String, String> map) throws IllegalArgumentException {
    try {
        for (final Entry<String, String> entry : map.entrySet()) {
            Level level;

            final String key   = entry.getKey();
            final String value = entry.getValue();
            if ("".equals(value)) {
                level = Level.INFO;
            } else {
                level = Level.parse(value.toUpperCase(Locale.ENGLISH));
            }

            final String name = Logging.lastPart(key);
            final Logger logger = instantiateLogger(name, level);

            Logging.loggers.put(name, logger);
        }
    } catch (final IllegalArgumentException | SecurityException e) {
        throw e;
    }
}
 
Example #6
Source File: VideoDHGR.java    From jace with GNU General Public License v2.0 6 votes vote down vote up
protected void showDhgr(WritableImage screen, int xOffset, int y, int dhgrWord) {
    PixelWriter writer = screen.getPixelWriter();
    try {
        for (int i = 0; i < 7; i++) {
            Color color;
            if (!dhgrMode && hiresMode) {
                color = Palette.color[dhgrWord & 15];
            } else {
                color = Palette.color[FLIP_NYBBLE[dhgrWord & 15]];
            }
            writer.setColor(xOffset++, y, color);
            writer.setColor(xOffset++, y, color);
            writer.setColor(xOffset++, y, color);
            writer.setColor(xOffset++, y, color);
            dhgrWord >>= 4;
        }
    } catch (ArrayIndexOutOfBoundsException ex) {
        Logger.getLogger(getClass().getName()).warning("Went out of bounds in video display");
    }
}
 
Example #7
Source File: CreateViewAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void perform(final BaseNode node) {
   DatabaseConnection connection = node.getLookup().lookup(DatabaseConnection.class);

   String schemaName = findSchemaWorkingName(node.getLookup());

   try {
       boolean viewsSupported = connection.getConnector().getDriverSpecification(schemaName).areViewsSupported();
       if (!viewsSupported) {
           String message = NbBundle.getMessage (CreateViewAction.class, "MSG_ViewsAreNotSupported", // NOI18N
                   connection.getJDBCConnection().getMetaData().getDatabaseProductName().trim());
           DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.INFORMATION_MESSAGE));
           return;
       }

       Specification spec = connection.getConnector().getDatabaseSpecification();

       boolean viewAdded = AddViewDialog.showDialogAndCreate(spec, schemaName);
       if (viewAdded) {
           SystemAction.get(RefreshAction.class).performAction(new Node[]{node});
       }
   } catch(Exception exc) {
       Logger.getLogger(CreateViewAction.class.getName()).log(Level.INFO, exc.getLocalizedMessage(), exc);
       DbUtilities.reportError(NbBundle.getMessage (CreateViewAction.class, "ERR_UnableToCreateView"), exc.getMessage()); // NOI18N
   }
}
 
Example #8
Source File: HttpMonitorHelper.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static File getDefaultWebXML(String domainLoc, String domainName) {
    String loc = domainLoc+"/"+domainName+"/config/default-web.xml"; // NOI18N
    File webXML = new File(loc);

    if (webXML.exists())  {
        String backupLoc = domainLoc+"/"+domainName+"/config/default-web.xml.orig"; // NOI18N
        File backupXml = new File(backupLoc);
        if (!backupXml.exists()) {
            try {
                copy(webXML,backupXml);
                createCopyAndUpgrade(backupXml, webXML);
            } catch (FileNotFoundException fnfe) {
                Logger.getLogger("payara-eecommon").log(Level.WARNING, "This file existed a few milliseconds ago: "+ webXML.getAbsolutePath(), fnfe);
            } catch (IOException ioe) {
                if (backupXml.exists()) {
                    backupXml.delete();
                    Logger.getLogger("payara-eecommon").log(Level.WARNING,"failed to backup data from "+webXML.getAbsolutePath(), ioe);
                } else {
                    Logger.getLogger("payara-eecommon").log(Level.WARNING,"failed to create backup file "+backupXml.getAbsolutePath(), ioe);
                }
            }
        }
        return webXML.exists() ? webXML : null;
    }
    return null;
}
 
Example #9
Source File: AndHowLog.java    From andhow with Apache License 2.0 6 votes vote down vote up
private AndHowLog(Logger baseLog, Class<?> clazz, Handler handler) {
	baseLogger = baseLog;
	baseLogger.setUseParentHandlers(false);	//Don't double print messages
	
	if (handler == null) {
		handler = DEFAULT_HANDLER;
	}
	
	Handler[] orgHandlers = baseLogger.getHandlers();
	
	//Make sure only have our single handler in place
	for (Handler h : orgHandlers) {
		baseLogger.removeHandler(h);
	}
	
	baseLogger.addHandler(handler);

	this.clazz = clazz;
	reloadLogLevel();
}
 
Example #10
Source File: Files.java    From Minepacks with GNU General Public License v3.0 6 votes vote down vote up
protected static @Nullable ItemStack[] readFile(@NotNull InventorySerializer itsSerializer, @NotNull File file, @NotNull Logger logger)
{
	if(file.exists())
	{
		try(FileInputStream fis = new FileInputStream(file))
		{
			int version = fis.read();
			byte[] out = new byte[(int) (file.length() - 1)];
			int readCount = fis.read(out);
			if(file.length() - 1 != readCount) logger.warning("Problem reading file, read " + readCount + " of " + (file.length() - 1) + " bytes.");
			return itsSerializer.deserialize(out, version);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	return null;
}
 
Example #11
Source File: LogWrapper.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private LogWrapper() {
  logger = Logger.getLogger(this.getClass().getCanonicalName());

  Cache cache = CliUtil.getCacheIfExists();
  if (cache != null && !cache.isClosed()) {
    //TODO - Abhishek how to set different log levels for different handlers???
    logger.addHandler(cache.getLogger().getHandler());
    CommandResponseWriterHandler handler = new CommandResponseWriterHandler();
    handler.setFilter(new Filter() {
      @Override
      public boolean isLoggable(LogRecord record) {
        return record.getLevel().intValue() >= Level.FINE.intValue();
      }
    });
    handler.setLevel(Level.FINE);
    logger.addHandler(handler);
  }
  logger.setUseParentHandlers(false);
}
 
Example #12
Source File: ClientSharedUtils.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public static void initLogger(String loggerName, String logFile,
    boolean initLog4j, Level level, final Handler handler) {
  clearLogger();
  if (initLog4j) {
    try {
      initLog4J(logFile, level);
    } catch (IOException ioe) {
      throw newRuntimeException(ioe.getMessage(), ioe);
    }
  }
  Logger log = Logger.getLogger(loggerName);
  log.addHandler(handler);
  log.setLevel(level);
  log.setUseParentHandlers(false);
  logger = log;
}
 
Example #13
Source File: SarlBatchCompiler.java    From sarl with Apache License 2.0 5 votes vote down vote up
private void setStaticField(Class<?> type, String name, org.apache.log4j.Logger logger) {
	try {
		final Field field = type.getDeclaredField(name);
		field.setAccessible(true);
		if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL) {
			final Field modifiersField = Field.class.getDeclaredField("modifiers"); //$NON-NLS-1$
			modifiersField.setAccessible(true);
			modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
		}
		field.set(null, logger);
	} catch (Exception exception) {
		reportInternalError(exception.getLocalizedMessage(), exception);
	}
}
 
Example #14
Source File: TestGetGlobalConcurrent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String... args) throws Exception {

        final String manager = System.getProperty("java.util.logging.manager", null);

        description = "TestGetGlobalConcurrent"
            + (System.getSecurityManager() == null ? " " :
               " -Djava.security.manager ")
            + (manager == null ? "" : "-Djava.util.logging.manager=" + manager);

        final Thread t1 = new Thread(new WaitAndRun(new Run1()), "test1");
        final Thread t2 = new Thread(new WaitAndRun(new Run2()), "test2");
        final Thread t3 = new Thread(new WaitAndRun(new Run3()), "test3");
        final Thread t4 = new Thread(new WaitAndRun(new Run4()), "test4");

        t1.setDaemon(true); t2.setDaemon(true); t3.setDaemon(true); t4.setDaemon(true);
        t1.start(); t2.start(); t3.start(); t4.start();

        Thread.sleep(10);

        Logger.getGlobal().info(messages[1]); // calling getGlobal() will
             // initialize the LogManager - and thus this message should appear.
        Logger.global.info(messages[2]); // Now that the LogManager is
             // initialized, this message should appear too.

        final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, 3));
        if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
            fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
        }

        t1.join(); t2.join(); t3.join(); t4.join();

        if (failed != null) {
             throw new Error("Test failed: "+description, failed);
        }

        System.out.println("Test passed");
    }
 
Example #15
Source File: EngineLoggerTest.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * the user uses the user defined log. All log should be outputted to the
 * user defined logger.
 * 
 * @throws Exception
 */
public void testUserLogger( ) throws Exception
{
	// init the root logger
	FileHandler fileHandle = new FileHandler( "./utest/logger.txt" );
	try
	{
		Logger logger = Logger.getAnonymousLogger( );
		logger.addHandler( fileHandle );
		logger.setLevel( Level.ALL );
		logger.setUseParentHandlers( false );
		try
		{

			// start a default logger
			LoggerSetting setting = EngineLogger.createSetting(logger, null, null, Level.FINE, 0, 0);

			// all the log should be output to the root logger
			log( );
			EngineLogger.setLogger( setting, null );
			log( );
			EngineLogger.removeSetting(setting);
		}
		finally
		{
			logger.removeHandler( fileHandle );
		}
	}
	finally
	{
		fileHandle.close( );
	}
	// test the log file content
	checkLogging( "./utest/logger.txt", 0, 1, 1 );
}
 
Example #16
Source File: FailOverExecutionControlProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Logger logger() {
    if (logger == null) {
        logger = Logger.getLogger("jdk.jshell.execution");
        if (logger.getLevel() == null) {
            // Logging has not been specifically requested, turn it off
            logger.setLevel(Level.OFF);
        }
    }
    return logger;
}
 
Example #17
Source File: CopyPathToClipboardAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Get the project directory of the given project.
 *
 * @param project
 * @return
 */
private String getProjectDirectory(final Project project) {
    try {
        FileObject projectDirectory = project.getProjectDirectory();
        return getNativePath(projectDirectory);
    } catch (Exception e) {
        Logger.getLogger(CopyPathToClipboardAction.class.getName()).log(
                Level.FINE, null, e);
        return null;
    }
}
 
Example #18
Source File: ClusteringAlgoPanel.java    From moa with GNU General Public License v3.0 5 votes vote down vote up
public AbstractClusterer getClusterer1(){
    AbstractClusterer c = null;
    applyChanges();
    if(!algorithmOption1.getValueAsCLIString().equals("None")){
        try {
            c = (AbstractClusterer) ClassOption.cliStringToObject(algorithmOption1.getValueAsCLIString(), Clusterer.class, null);
        } catch (Exception ex) {
            Logger.getLogger(ClusteringAlgoPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return c;
}
 
Example #19
Source File: ExportPluginManager.java    From yeti with MIT License 5 votes vote down vote up
@Override
public void pluginMenuEvent(ActionEvent evt) {
    if (evt.getSource().getClass() == JMenuItem.class) {
        try {
            String scriptName = (((JMenuItem) evt.getSource()).getName());
            this.executeScript(scriptName);
        } catch (FileNotFoundException | ScriptException ex) {
            Logger.getLogger(AttributePluginManager.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
 
Example #20
Source File: ClientServerTest.java    From monsoon with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test(timeout = 20000)
public void slowEvaluate() {
    final int LIMIT = 10;  // To make the test not take forever.
    final Duration stepSize = Duration.standardMinutes(1);
    final List<Collection<CollectHistory.NamedEvaluation>> expected = generateEvaluation().limit(LIMIT).collect(Collectors.toList());
    when(history.evaluate(Mockito.any(), Mockito.isA(Duration.class)))
            .thenAnswer((invocation) -> {
                return generateEvaluation()
                        .limit(LIMIT)
                        .map(x -> {
                            try {
                                Thread.sleep(1000);
                            } catch (InterruptedException ex) {
                                Logger.getLogger(ClientServerTest.class.getName()).log(Level.SEVERE, null, ex);
                            }
                            Logger.getLogger(ClientServerTest.class.getName()).log(Level.INFO, "emitting {0}", x);
                            return x;
                        });
            });

    final List<Collection<CollectHistory.NamedEvaluation>> result = client.evaluate(singletonMap("name", expr), stepSize).collect(Collectors.toList());

    assertEquals(expected, result);

    verify(history, times(1)).evaluate(
            Mockito.<Map>argThat(
                    Matchers.hasEntry(
                            Matchers.equalTo("name"),
                            new ExprEqualTo(expr))),
            Mockito.eq(stepSize));
    verifyNoMoreInteractions(history);
}
 
Example #21
Source File: LibraryCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void uninstallFile(String filePath) {
    File projectDir = FileUtil.toFile(project.getProjectDirectory());
    File file = PropertyUtils.resolveFile(projectDir, filePath);
    if (file.exists()) {
        removeFile(file);
    } else {
        Logger.getLogger(LibraryCustomizer.class.getName()).log(
                Level.INFO, "Cannot delete file {0}. It no longer exists.",
                new Object[]{file.getAbsolutePath()});
    }
}
 
Example #22
Source File: ShapeTag.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
public SHAPEWITHSTYLE getShapes() {
    if (shapes == null && shapeData != null) {
        try {
            SWFInputStream sis = new SWFInputStream(swf, shapeData.getArray(), 0, shapeData.getPos() + shapeData.getLength());
            sis.seek(shapeData.getPos());
            shapes = sis.readSHAPEWITHSTYLE(getShapeNum(), false, "shapes");
            shapeData = null; // not needed anymore, give it to GC
        } catch (IOException ex) {
            Logger.getLogger(ShapeTag.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    return shapes;
}
 
Example #23
Source File: Hk2MessageDestinationManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void createConnector(File sunResourcesXml, String jndiName, String poolName) throws IOException {
    // <connector-resource pool-name="testconnectorpool" jndi-name="testconnector" />
    StringBuilder xmlBuilder = new StringBuilder(500);
    xmlBuilder.append(CONNECTOR_TAG_1);
    ResourceModifier.appendAttr(xmlBuilder, ATTR_JNDINAME, jndiName, true);
    ResourceModifier.appendAttr(xmlBuilder, ATTR_POOLNAME, poolName, true);
    xmlBuilder.append(CONNECTOR_TAG_2);

    String xmlFragment = xmlBuilder.toString();
    Logger.getLogger("payara-jakartaee").log(Level.FINER, "New Connector resource:\n" + xmlFragment);
    ResourceModifier.appendResource(sunResourcesXml, xmlFragment);
}
 
Example #24
Source File: RouterClient.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
RouterClient(final SessionManager session_manager, AbstractConnection conn, Logger logger, Router router) {
	this.router = router;
	this.connection = conn;
	this.logger = logger;
	this.client_interface = (RouterClientInterface)ARMIEvent.createProxy(conn, RouterClientInterface.class);
	this.current_interface = new Interface(RouterInterface.class, new RouterInterface() {
		public final void login(SessionID session_id, SessionInfo session_info, int client_id) {
			Session session = session_manager.get(session_id, session_info, client_id);
			doLogin(session, session_info, client_id);
		}
	});
}
 
Example #25
Source File: QueryCacheAdv.java    From jason with GNU Lesser General Public License v3.0 5 votes vote down vote up
public QueryCacheAdv(Agent ag, QueryProfiling p) {
    this.ag = ag;
    this.prof = p;
    logger  = Logger.getLogger(QueryCacheAdv.class.getName()+"-"+ag.getTS().getAgArch().getAgName());
    cache   = new HashMap<PredicateIndicator, List<Pair<Literal,List<Unifier>>>>();
    tmp     = new HashMap<PredicateIndicator, List<Pair<Literal,List<Unifier>>>>();
    noCache = new HashSet<QueryCacheKey>();
}
 
Example #26
Source File: ARFFLoader.java    From JSAT with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Uses the given file path to load a data set from an ARFF file. 
 * 
 * @param file the path to the ARFF file to load 
 * @return the data set from the ARFF file, or null if the file could not be loaded. 
 */
public static SimpleDataSet loadArffFile(File file) 
{
    try
    {
        return loadArffFile(new FileReader(file));
    }
    catch (FileNotFoundException ex)
    {
        Logger.getLogger(ARFFLoader.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}
 
Example #27
Source File: LoggerFinderAPITest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String argv[]) throws Exception {
    final LoggerFinderAPITest test = new LoggerFinderAPITest(false);
    final StringBuilder errors = new StringBuilder();
    errors.append(test.testGetLoggerOverriddenOnSpi());
    java.lang.System.Logger julLogger =
            java.lang.System.LoggerFinder.getLoggerFinder()
                    .getLogger("foo", LoggerFinderAPITest.class.getModule());
    errors.append(test.testDefaultJULLogger(julLogger));
    if (errors.length() > 0) throw new RuntimeException(errors.toString());
    java.lang.System.Logger julSystemLogger =
            java.lang.System.LoggerFinder.getLoggerFinder()
                    .getLogger("bar", Thread.class.getModule());
    errors.append(test.testDefaultJULLogger(julSystemLogger));
    if (errors.length() > 0) throw new RuntimeException(errors.toString());
    java.lang.System.Logger julLocalizedLogger =
            (java.lang.System.Logger)
            System.getLogger("baz", bundleLocalized);
    java.lang.System.Logger julLocalizedSystemLogger =
            java.lang.System.LoggerFinder.getLoggerFinder()
                    .getLocalizedLogger("oof", bundleLocalized, Thread.class.getModule());
    final String error = errors.toString();
    if (!error.isEmpty()) throw new RuntimeException(error);
    for (java.lang.System.Logger logger : new java.lang.System.Logger[] {
        julLogger, julSystemLogger, julLocalizedLogger, julLocalizedSystemLogger
    }) {
        test.testAllJdkExtensionMethods(logger);
        test.testAllAPIMethods(logger);
        test.testAllBridgeMethods(logger);
        test.testAllLogProducerMethods(logger);
    }
}
 
Example #28
Source File: DocumentTesting.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void setSameThreadInvoke(Context context, boolean sameThreadInvoke) {
    context.putProperty(SAME_THREAD_INVOKE, sameThreadInvoke);
    if (sameThreadInvoke) { // Disable logging of non-EDT usage
        Logger.getLogger("org.netbeans.editor.BaseDocument.EDT").setLevel(Level.OFF);
        Logger.getLogger("org.netbeans.modules.editor.lib2.view.DocumentView.EDT").setLevel(Level.OFF);
    }
}
 
Example #29
Source File: AbstractLoggerTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testGlobalLogger() throws Exception {
    final Logger root = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
    root.info("Test info message");
    root.config("Test info message");
    root.fine("Test info message");
    final List<LogEvent> events = eventAppender.getEvents();
    assertThat(events, hasSize(3));
    for (final LogEvent event : events) {
        final String message = event.getMessage().getFormattedMessage();
        assertThat(message, equalTo("Test info message"));
    }
}
 
Example #30
Source File: MainController.java    From JavaFX-Tutorial-Codes with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(URL url, ResourceBundle rb) {
    if (!Launcher.isSplashLoaded) {
        loadSplashScreen();
    }

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/genuinecoder/panel/sidepanel.fxml"));
        VBox box = loader.load();
        SidePanelController controller = loader.getController();
        controller.setCallback(this);
        drawer.setSidePane(box);
    } catch (IOException ex) {
        Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
    }

    HamburgerBackArrowBasicTransition transition = new HamburgerBackArrowBasicTransition(hamburger);
    transition.setRate(-1);
    hamburger.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
        transition.setRate(transition.getRate() * -1);
        transition.play();

        if (drawer.isOpened()) {
            drawer.close();
        } else {
            drawer.open();
        }
    });
}