@Override protected String getLabelText() { Game g = Game.getTL(); GameLinks gl = GameLinks.getTL(); // Hack if (gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech")) return "<p>Thanks for playing the exercise!</p><p>We are interested in your opinions. This is optional.</p>"; else { String handle = g.getGameHandle(); if (handle != null && handle.length() > 0) handle = handle.toUpperCase(); else handle = "MMOWGLI"; return "<p>Thanks for playing the " + handle + " game!</p><p>We are interested in your opinions. This is optional.</p>"; } }
@HibernateSessionThreadLocalConstructor @SuppressWarnings("serial") public MapGameDesignPanel(GameDesignGlobals globs) { super(false, globs); Game g = Game.getTL(); TextArea titleTA; final Serializable uid = Mmowgli2UI.getGlobals().getUserID(); titleTA = (TextArea) addEditLine("Map Title", "Game.mapTitle", g, g.getId(), "MapTitle").ta; titleTA.setValue(g.getMapTitle()); titleTA.setRows(1); latTA = addEditLine("Map Initial Latitude", "Game.mmowgliMapLatitude"); boolean lastRO = latTA.isReadOnly(); latTA.setReadOnly(false); latTA.setValue("" + g.getMapLatitude()); latTA.setRows(1); latTA.setReadOnly(lastRO); latTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); try { String val = event.getProperty().getValue().toString(); double lat = Double.parseDouble(val); Game g = Game.getTL(); g.setMapLatitude(lat); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map latitude", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "<html>Check for proper decimal format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); lonTA = addEditLine("Map Initial Longitude", "Game.mmowgliMapLongitude"); lastRO = lonTA.isReadOnly(); lonTA.setReadOnly(false); lonTA.setValue("" + g.getMapLongitude()); lonTA.setRows(1); lonTA.setReadOnly(lastRO); lonTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { // System.out.println("lon valueChange"); HSess.init(); try { String val = event.getProperty().getValue().toString(); double lon = Double.parseDouble(val); Game g = Game.getTL(); g.setMapLongitude(lon); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map longitude", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "<html>Check for proper decimal format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); zoomTA = addEditLine("Map Initial Zoom", "Game.mmowgliMapZoom"); lastRO = zoomTA.isReadOnly(); zoomTA.setReadOnly(false); zoomTA.setValue("" + g.getMapZoom()); zoomTA.setRows(1); zoomTA.setReadOnly(lastRO); zoomTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); try { String val = event.getProperty().getValue().toString(); int zoom = Integer.parseInt(val); Game g = Game.getTL(); g.setMapZoom(zoom); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map zoom", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "Check for proper integer format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); Button b; this.addComponentLine( b = new Button("Set to generic Mmowgli Map Defaults", new MapDefaultSetter())); b.setEnabled(!globs.readOnlyCheck(false)); }